Mercurial > hg > tony
diff src/MainWindow.cpp @ 292:2895ca89b024
implemented delete notes; needs testing
author | matthiasm |
---|---|
date | Wed, 11 Jun 2014 14:47:45 +0100 |
parents | cddada03e222 |
children | 9400e63ec5d7 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Tue Jun 03 15:28:01 2014 +0100 +++ b/src/MainWindow.cpp Wed Jun 11 14:47:45 2014 +0100 @@ -691,6 +691,15 @@ connect(this, SIGNAL(canSnapNotes(bool)), action, SLOT(setEnabled(bool))); menu->addAction(action); m_rightButtonMenu->addAction(action); + + action = new QAction(tr("Delete Notes"), this); + action->setShortcut(tr("Ctrl+d")); + action->setStatusTip(tr("Delete all notes within the selected region=")); + m_keyReference->registerShortcut(action); + connect(action, SIGNAL(triggered()), this, SLOT(deleteNotes())); + connect(this, SIGNAL(canSnapNotes(bool)), action, SLOT(setEnabled(bool))); + menu->addAction(action); + m_rightButtonMenu->addAction(action); action = new QAction(tr("Form Note from Selection"), this); action->setShortcut(tr("Ctrl+=")); @@ -2285,6 +2294,30 @@ } void +MainWindow::deleteNotes() +{ + FlexiNoteLayer *layer = + qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes)); + if (!layer) return; + + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + + if (!selections.empty()) { + + CommandHistory::getInstance()->startCompoundOperation + (tr("Delete Notes"), true); + + for (MultiSelection::SelectionList::iterator k = selections.begin(); + k != selections.end(); ++k) { + layer->deleteSelection(*k); + } + + CommandHistory::getInstance()->endCompoundOperation(); + } +} + + +void MainWindow::formNoteFromSelection() { FlexiNoteLayer *layer =