Mercurial > hg > tony
diff src/MainWindow.cpp @ 167:6b6906017536
Choose a different pitch candidate within selection by hitting Return
author | Chris Cannam |
---|---|
date | Mon, 03 Feb 2014 17:04:03 +0000 |
parents | 62ceae757fe0 |
children | c5e4eaeb9a27 |
line wrap: on
line diff
--- a/src/MainWindow.cpp Fri Jan 31 17:54:49 2014 +0000 +++ b/src/MainWindow.cpp Mon Feb 03 17:04:03 2014 +0000 @@ -536,6 +536,13 @@ connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown())); connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); menu->addAction(action); + + //!!! shortcuts, status tip, key reference etc + action = new QAction(tr("Switch Pitch Candidate"), this); + action->setShortcut(tr("Return")); + connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp())); + connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); + menu->addAction(action); } void @@ -1119,29 +1126,29 @@ while (m_paneStack->getPaneCount() > 0) { - Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1); + Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1); - while (pane->getLayerCount() > 0) { - m_document->removeLayerFromView - (pane, pane->getLayer(pane->getLayerCount() - 1)); - } - - m_overview->unregisterView(pane); - m_paneStack->deletePane(pane); + while (pane->getLayerCount() > 0) { + m_document->removeLayerFromView + (pane, pane->getLayer(pane->getLayerCount() - 1)); + } + + m_overview->unregisterView(pane); + m_paneStack->deletePane(pane); } while (m_paneStack->getHiddenPaneCount() > 0) { - Pane *pane = m_paneStack->getHiddenPane - (m_paneStack->getHiddenPaneCount() - 1); - - while (pane->getLayerCount() > 0) { - m_document->removeLayerFromView - (pane, pane->getLayer(pane->getLayerCount() - 1)); - } - - m_overview->unregisterView(pane); - m_paneStack->deletePane(pane); + Pane *pane = m_paneStack->getHiddenPane + (m_paneStack->getHiddenPaneCount() - 1); + + while (pane->getLayerCount() > 0) { + m_document->removeLayerFromView + (pane, pane->getLayer(pane->getLayerCount() - 1)); + } + + m_overview->unregisterView(pane); + m_paneStack->deletePane(pane); } delete m_document; @@ -1631,6 +1638,15 @@ } void +MainWindow::clearSelection() +{ + cerr << "MainWindow::clearSelection()" << endl; + + m_analyser->clearReAnalysis(); + MainWindowBase::clearSelection(); +} + +void MainWindow::selectionChanged() { MultiSelection::SelectionList selections = m_viewManager->getSelections(); @@ -1664,6 +1680,8 @@ void MainWindow::octaveShift(bool up) { + // Should this be in the Analyser? + float factor = (up ? 2.f : 0.5f); MultiSelection::SelectionList selections = m_viewManager->getSelections(); @@ -1707,6 +1725,28 @@ } void +MainWindow::switchPitchUp() +{ + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + + for (MultiSelection::SelectionList::iterator k = selections.begin(); + k != selections.end(); ++k) { + m_analyser->switchPitchCandidate(*k, true); + } +} + +void +MainWindow::switchPitchDown() +{ + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + + for (MultiSelection::SelectionList::iterator k = selections.begin(); + k != selections.end(); ++k) { + m_analyser->switchPitchCandidate(*k, false); + } +} + +void MainWindow::playSpeedChanged(int position) { PlaySpeedRangeMapper mapper(0, 200);