Mercurial > hg > tony
diff src/MainWindow.cpp @ 194:34797795a76c
Clearing the selection by hitting Esc now restores the selected region of the pitch track to its contents from before the selection was made (and any alternate candidate chosen). Fixes feature #885
author | Chris Cannam |
---|---|
date | Wed, 05 Mar 2014 10:38:23 +0000 |
parents | 431a95c9d14d |
children | 797395e56489 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Wed Mar 05 09:45:17 2014 +0000 +++ b/src/MainWindow.cpp Wed Mar 05 10:38:23 2014 +0000 @@ -528,7 +528,7 @@ action = new QAction(tr("C&lear Selection"), this); action->setShortcut(tr("Esc")); action->setStatusTip(tr("Clear the selection")); - connect(action, SIGNAL(triggered()), this, SLOT(clearSelection())); + connect(action, SIGNAL(triggered()), this, SLOT(abandonSelection())); connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); m_keyReference->registerShortcut(action); menu->addAction(action); @@ -1771,13 +1771,23 @@ } void -MainWindow::clearSelection() +MainWindow::abandonSelection() { - cerr << "MainWindow::clearSelection()" << endl; + // Named abandonSelection rather than clearSelection to indicate + // that this is an active operation -- it restores the original + // content of the pitch track in the selected region rather than + // simply un-selecting. + + cerr << "MainWindow::abandonSelection()" << endl; CommandHistory::getInstance()->startCompoundOperation(tr("Clear Selection"), true); - m_analyser->clearReAnalysis(); + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + if (!selections.empty()) { + Selection sel = *selections.begin(); + m_analyser->clearReAnalysis(sel); + } + MainWindowBase::clearSelection(); CommandHistory::getInstance()->endCompoundOperation();