comparison src/MainWindow.cpp @ 184:ea15fa75ae6f

Ctrl+Return now switches the alternate pitch candidates on and off; Ctrl+Up/Down selects among them
author Chris Cannam
date Sun, 23 Feb 2014 17:59:23 +0000
parents 515bfde8aab7
children 4a98ce5b4266
comparison
equal deleted inserted replaced
183:bdee9e6f135b 184:ea15fa75ae6f
552 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown())); 552 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown()));
553 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); 553 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
554 menu->addAction(action); 554 menu->addAction(action);
555 555
556 //!!! shortcuts, status tip, key reference etc 556 //!!! shortcuts, status tip, key reference etc
557 action = new QAction(tr("Switch Pitch Candidate"), this); 557 action = new QAction(tr("Toggle Alternative Pitch Candidates"), this);
558 action->setShortcut(tr("Ctrl+Return")); 558 action->setShortcut(tr("Ctrl+Return"));
559 connect(action, SIGNAL(triggered()), this, SLOT(switchPitch())); 559 connect(action, SIGNAL(triggered()), this, SLOT(togglePitchCandidates()));
560 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
561 menu->addAction(action);
562
563 //!!! shortcuts, status tip, key reference etc
564 action = new QAction(tr("Pick Higher Pitch Candidate"), this);
565 action->setShortcut(tr("Ctrl+Up"));
566 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp()));
567 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
568 menu->addAction(action);
569
570 //!!! shortcuts, status tip, key reference etc
571 action = new QAction(tr("Pick Lower Pitch Candidate"), this);
572 action->setShortcut(tr("Ctrl+Down"));
573 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchDown()));
560 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); 574 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool)));
561 menu->addAction(action); 575 menu->addAction(action);
562 } 576 }
563 577
564 void 578 void
1750 1764
1751 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Pitches"), true); 1765 CommandHistory::getInstance()->startCompoundOperation(tr("Clear Pitches"), true);
1752 1766
1753 for (MultiSelection::SelectionList::iterator k = selections.begin(); 1767 for (MultiSelection::SelectionList::iterator k = selections.begin();
1754 k != selections.end(); ++k) { 1768 k != selections.end(); ++k) {
1755 m_analyser->clearPitches(*k); 1769 m_analyser->deletePitches(*k);
1756 } 1770 }
1757 1771
1758 CommandHistory::getInstance()->endCompoundOperation(); 1772 CommandHistory::getInstance()->endCompoundOperation();
1759 } 1773 }
1760 1774
1785 1799
1786 CommandHistory::getInstance()->endCompoundOperation(); 1800 CommandHistory::getInstance()->endCompoundOperation();
1787 } 1801 }
1788 1802
1789 void 1803 void
1790 MainWindow::switchPitch() 1804 MainWindow::togglePitchCandidates()
1805 {
1806 m_analyser->showPitchCandidates(!m_analyser->arePitchCandidatesShown());
1807 }
1808
1809 void
1810 MainWindow::switchPitchUp()
1791 { 1811 {
1792 CommandHistory::getInstance()->startCompoundOperation 1812 CommandHistory::getInstance()->startCompoundOperation
1793 (tr("Switch Pitch Candidate"), true); 1813 (tr("Switch Pitch Candidate"), true);
1794 1814
1795 MultiSelection::SelectionList selections = m_viewManager->getSelections(); 1815 MultiSelection::SelectionList selections = m_viewManager->getSelections();
1796 1816
1797 for (MultiSelection::SelectionList::iterator k = selections.begin(); 1817 for (MultiSelection::SelectionList::iterator k = selections.begin();
1798 k != selections.end(); ++k) { 1818 k != selections.end(); ++k) {
1799 m_analyser->switchPitchCandidate(*k, true); 1819 m_analyser->switchPitchCandidate(*k, true);
1820 }
1821
1822 CommandHistory::getInstance()->endCompoundOperation();
1823 }
1824
1825 void
1826 MainWindow::switchPitchDown()
1827 {
1828 CommandHistory::getInstance()->startCompoundOperation
1829 (tr("Switch Pitch Candidate"), true);
1830
1831 MultiSelection::SelectionList selections = m_viewManager->getSelections();
1832
1833 for (MultiSelection::SelectionList::iterator k = selections.begin();
1834 k != selections.end(); ++k) {
1835 m_analyser->switchPitchCandidate(*k, false);
1800 } 1836 }
1801 1837
1802 CommandHistory::getInstance()->endCompoundOperation(); 1838 CommandHistory::getInstance()->endCompoundOperation();
1803 } 1839 }
1804 1840