Mercurial > hg > tony
comparison 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 |
comparison
equal
deleted
inserted
replaced
193:abfbe8c2883b | 194:34797795a76c |
---|---|
526 m_rightButtonMenu->addAction(action); | 526 m_rightButtonMenu->addAction(action); |
527 | 527 |
528 action = new QAction(tr("C&lear Selection"), this); | 528 action = new QAction(tr("C&lear Selection"), this); |
529 action->setShortcut(tr("Esc")); | 529 action->setShortcut(tr("Esc")); |
530 action->setStatusTip(tr("Clear the selection")); | 530 action->setStatusTip(tr("Clear the selection")); |
531 connect(action, SIGNAL(triggered()), this, SLOT(clearSelection())); | 531 connect(action, SIGNAL(triggered()), this, SLOT(abandonSelection())); |
532 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); | 532 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); |
533 m_keyReference->registerShortcut(action); | 533 m_keyReference->registerShortcut(action); |
534 menu->addAction(action); | 534 menu->addAction(action); |
535 m_rightButtonMenu->addAction(action); | 535 m_rightButtonMenu->addAction(action); |
536 | 536 |
1769 Selection sel(f0, f1); | 1769 Selection sel(f0, f1); |
1770 m_viewManager->setSelection(sel); | 1770 m_viewManager->setSelection(sel); |
1771 } | 1771 } |
1772 | 1772 |
1773 void | 1773 void |
1774 MainWindow::clearSelection() | 1774 MainWindow::abandonSelection() |
1775 { | 1775 { |
1776 cerr << "MainWindow::clearSelection()" << endl; | 1776 // Named abandonSelection rather than clearSelection to indicate |
1777 // that this is an active operation -- it restores the original | |
1778 // content of the pitch track in the selected region rather than | |
1779 // simply un-selecting. | |
1780 | |
1781 cerr << "MainWindow::abandonSelection()" << endl; | |
1777 | 1782 |
1778 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Selection"), true); | 1783 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Selection"), true); |
1779 | 1784 |
1780 m_analyser->clearReAnalysis(); | 1785 MultiSelection::SelectionList selections = m_viewManager->getSelections(); |
1786 if (!selections.empty()) { | |
1787 Selection sel = *selections.begin(); | |
1788 m_analyser->clearReAnalysis(sel); | |
1789 } | |
1790 | |
1781 MainWindowBase::clearSelection(); | 1791 MainWindowBase::clearSelection(); |
1782 | 1792 |
1783 CommandHistory::getInstance()->endCompoundOperation(); | 1793 CommandHistory::getInstance()->endCompoundOperation(); |
1784 } | 1794 } |
1785 | 1795 |