comparison 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
comparison
equal deleted inserted replaced
291:cddada03e222 292:2895ca89b024
686 action = new QAction(tr("Merge Notes"), this); 686 action = new QAction(tr("Merge Notes"), this);
687 action->setShortcut(tr("Ctrl+\\")); 687 action->setShortcut(tr("Ctrl+\\"));
688 action->setStatusTip(tr("Merge all notes within the selected region into a single note")); 688 action->setStatusTip(tr("Merge all notes within the selected region into a single note"));
689 m_keyReference->registerShortcut(action); 689 m_keyReference->registerShortcut(action);
690 connect(action, SIGNAL(triggered()), this, SLOT(mergeNotes())); 690 connect(action, SIGNAL(triggered()), this, SLOT(mergeNotes()));
691 connect(this, SIGNAL(canSnapNotes(bool)), action, SLOT(setEnabled(bool)));
692 menu->addAction(action);
693 m_rightButtonMenu->addAction(action);
694
695 action = new QAction(tr("Delete Notes"), this);
696 action->setShortcut(tr("Ctrl+d"));
697 action->setStatusTip(tr("Delete all notes within the selected region="));
698 m_keyReference->registerShortcut(action);
699 connect(action, SIGNAL(triggered()), this, SLOT(deleteNotes()));
691 connect(this, SIGNAL(canSnapNotes(bool)), action, SLOT(setEnabled(bool))); 700 connect(this, SIGNAL(canSnapNotes(bool)), action, SLOT(setEnabled(bool)));
692 menu->addAction(action); 701 menu->addAction(action);
693 m_rightButtonMenu->addAction(action); 702 m_rightButtonMenu->addAction(action);
694 703
695 action = new QAction(tr("Form Note from Selection"), this); 704 action = new QAction(tr("Form Note from Selection"), this);
2283 CommandHistory::getInstance()->endCompoundOperation(); 2292 CommandHistory::getInstance()->endCompoundOperation();
2284 } 2293 }
2285 } 2294 }
2286 2295
2287 void 2296 void
2297 MainWindow::deleteNotes()
2298 {
2299 FlexiNoteLayer *layer =
2300 qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes));
2301 if (!layer) return;
2302
2303 MultiSelection::SelectionList selections = m_viewManager->getSelections();
2304
2305 if (!selections.empty()) {
2306
2307 CommandHistory::getInstance()->startCompoundOperation
2308 (tr("Delete Notes"), true);
2309
2310 for (MultiSelection::SelectionList::iterator k = selections.begin();
2311 k != selections.end(); ++k) {
2312 layer->deleteSelection(*k);
2313 }
2314
2315 CommandHistory::getInstance()->endCompoundOperation();
2316 }
2317 }
2318
2319
2320 void
2288 MainWindow::formNoteFromSelection() 2321 MainWindow::formNoteFromSelection()
2289 { 2322 {
2290 FlexiNoteLayer *layer = 2323 FlexiNoteLayer *layer =
2291 qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes)); 2324 qobject_cast<FlexiNoteLayer *>(m_analyser->getLayer(Analyser::Notes));
2292 if (!layer) return; 2325 if (!layer) return;