Mercurial > hg > tony
comparison 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 |
comparison
equal
deleted
inserted
replaced
165:ebcfb8dce020 | 167:6b6906017536 |
---|---|
532 menu->addAction(action); | 532 menu->addAction(action); |
533 | 533 |
534 action = new QAction(tr("Octave Shift Down"), this); | 534 action = new QAction(tr("Octave Shift Down"), this); |
535 action->setShortcut(tr("PgDown")); | 535 action->setShortcut(tr("PgDown")); |
536 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown())); | 536 connect(action, SIGNAL(triggered()), this, SLOT(octaveShiftDown())); |
537 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); | |
538 menu->addAction(action); | |
539 | |
540 //!!! shortcuts, status tip, key reference etc | |
541 action = new QAction(tr("Switch Pitch Candidate"), this); | |
542 action->setShortcut(tr("Return")); | |
543 connect(action, SIGNAL(triggered()), this, SLOT(switchPitchUp())); | |
537 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); | 544 connect(this, SIGNAL(canClearSelection(bool)), action, SLOT(setEnabled(bool))); |
538 menu->addAction(action); | 545 menu->addAction(action); |
539 } | 546 } |
540 | 547 |
541 void | 548 void |
1117 { | 1124 { |
1118 if (!checkSaveModified()) return; | 1125 if (!checkSaveModified()) return; |
1119 | 1126 |
1120 while (m_paneStack->getPaneCount() > 0) { | 1127 while (m_paneStack->getPaneCount() > 0) { |
1121 | 1128 |
1122 Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1); | 1129 Pane *pane = m_paneStack->getPane(m_paneStack->getPaneCount() - 1); |
1123 | 1130 |
1124 while (pane->getLayerCount() > 0) { | 1131 while (pane->getLayerCount() > 0) { |
1125 m_document->removeLayerFromView | 1132 m_document->removeLayerFromView |
1126 (pane, pane->getLayer(pane->getLayerCount() - 1)); | 1133 (pane, pane->getLayer(pane->getLayerCount() - 1)); |
1127 } | 1134 } |
1128 | 1135 |
1129 m_overview->unregisterView(pane); | 1136 m_overview->unregisterView(pane); |
1130 m_paneStack->deletePane(pane); | 1137 m_paneStack->deletePane(pane); |
1131 } | 1138 } |
1132 | 1139 |
1133 while (m_paneStack->getHiddenPaneCount() > 0) { | 1140 while (m_paneStack->getHiddenPaneCount() > 0) { |
1134 | 1141 |
1135 Pane *pane = m_paneStack->getHiddenPane | 1142 Pane *pane = m_paneStack->getHiddenPane |
1136 (m_paneStack->getHiddenPaneCount() - 1); | 1143 (m_paneStack->getHiddenPaneCount() - 1); |
1137 | 1144 |
1138 while (pane->getLayerCount() > 0) { | 1145 while (pane->getLayerCount() > 0) { |
1139 m_document->removeLayerFromView | 1146 m_document->removeLayerFromView |
1140 (pane, pane->getLayer(pane->getLayerCount() - 1)); | 1147 (pane, pane->getLayer(pane->getLayerCount() - 1)); |
1141 } | 1148 } |
1142 | 1149 |
1143 m_overview->unregisterView(pane); | 1150 m_overview->unregisterView(pane); |
1144 m_paneStack->deletePane(pane); | 1151 m_paneStack->deletePane(pane); |
1145 } | 1152 } |
1146 | 1153 |
1147 delete m_document; | 1154 delete m_document; |
1148 m_document = 0; | 1155 m_document = 0; |
1149 m_viewManager->clearSelections(); | 1156 m_viewManager->clearSelections(); |
1629 Selection sel(f0, f1); | 1636 Selection sel(f0, f1); |
1630 m_viewManager->setSelection(sel); | 1637 m_viewManager->setSelection(sel); |
1631 } | 1638 } |
1632 | 1639 |
1633 void | 1640 void |
1641 MainWindow::clearSelection() | |
1642 { | |
1643 cerr << "MainWindow::clearSelection()" << endl; | |
1644 | |
1645 m_analyser->clearReAnalysis(); | |
1646 MainWindowBase::clearSelection(); | |
1647 } | |
1648 | |
1649 void | |
1634 MainWindow::selectionChanged() | 1650 MainWindow::selectionChanged() |
1635 { | 1651 { |
1636 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | 1652 MultiSelection::SelectionList selections = m_viewManager->getSelections(); |
1637 | 1653 |
1638 cerr << "MainWindow::selectionChanged" << endl; | 1654 cerr << "MainWindow::selectionChanged" << endl; |
1662 } | 1678 } |
1663 | 1679 |
1664 void | 1680 void |
1665 MainWindow::octaveShift(bool up) | 1681 MainWindow::octaveShift(bool up) |
1666 { | 1682 { |
1683 // Should this be in the Analyser? | |
1684 | |
1667 float factor = (up ? 2.f : 0.5f); | 1685 float factor = (up ? 2.f : 0.5f); |
1668 | 1686 |
1669 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | 1687 MultiSelection::SelectionList selections = m_viewManager->getSelections(); |
1670 | 1688 |
1671 CommandHistory::getInstance()->startCompoundOperation(tr("Octave Shift"), true); | 1689 CommandHistory::getInstance()->startCompoundOperation(tr("Octave Shift"), true); |
1702 } | 1720 } |
1703 } | 1721 } |
1704 } | 1722 } |
1705 | 1723 |
1706 CommandHistory::getInstance()->endCompoundOperation(); | 1724 CommandHistory::getInstance()->endCompoundOperation(); |
1725 } | |
1726 | |
1727 void | |
1728 MainWindow::switchPitchUp() | |
1729 { | |
1730 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | |
1731 | |
1732 for (MultiSelection::SelectionList::iterator k = selections.begin(); | |
1733 k != selections.end(); ++k) { | |
1734 m_analyser->switchPitchCandidate(*k, true); | |
1735 } | |
1736 } | |
1737 | |
1738 void | |
1739 MainWindow::switchPitchDown() | |
1740 { | |
1741 MultiSelection::SelectionList selections = m_viewManager->getSelections(); | |
1742 | |
1743 for (MultiSelection::SelectionList::iterator k = selections.begin(); | |
1744 k != selections.end(); ++k) { | |
1745 m_analyser->switchPitchCandidate(*k, false); | |
1746 } | |
1707 } | 1747 } |
1708 | 1748 |
1709 void | 1749 void |
1710 MainWindow::playSpeedChanged(int position) | 1750 MainWindow::playSpeedChanged(int position) |
1711 { | 1751 { |