Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 164:75cafe7a9246
* Make it possible to "measure" a feature on the spectrogram by double-
clicking in measure mode
* Make shift-click-drag (for zoom to region) work in measure mode as well
as navigate mode. It would be nice to be able to shift-doubleclick to
zoom on a feature directly using a combination of these last two features,
but that isn't possible yet.
* Make Del delete the measurement under the mouse pointer.
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2007 15:36:37 +0000 |
parents | 652b22dcd4ed |
children | 33280c031d19 |
comparison
equal
deleted
inserted
replaced
163:652b22dcd4ed | 164:75cafe7a9246 |
---|---|
614 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool))); | 614 connect(this, SIGNAL(canPaste(bool)), action, SLOT(setEnabled(bool))); |
615 m_keyReference->registerShortcut(action); | 615 m_keyReference->registerShortcut(action); |
616 menu->addAction(action); | 616 menu->addAction(action); |
617 m_rightButtonMenu->addAction(action); | 617 m_rightButtonMenu->addAction(action); |
618 | 618 |
619 action = new QAction(tr("&Delete Selected Items"), this); | 619 m_deleteSelectedAction = new QAction(tr("&Delete Selected Items"), this); |
620 action->setShortcut(tr("Del")); | 620 m_deleteSelectedAction->setShortcut(tr("Del")); |
621 action->setStatusTip(tr("Delete the selection from the current layer")); | 621 m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer")); |
622 connect(action, SIGNAL(triggered()), this, SLOT(deleteSelected())); | 622 connect(m_deleteSelectedAction, SIGNAL(triggered()), this, SLOT(deleteSelected())); |
623 connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); | 623 connect(this, SIGNAL(canDeleteSelection(bool)), m_deleteSelectedAction, SLOT(setEnabled(bool))); |
624 m_keyReference->registerShortcut(action); | 624 m_keyReference->registerShortcut(m_deleteSelectedAction); |
625 menu->addAction(action); | 625 menu->addAction(m_deleteSelectedAction); |
626 m_rightButtonMenu->addAction(action); | 626 m_rightButtonMenu->addAction(m_deleteSelectedAction); |
627 | 627 |
628 menu->addSeparator(); | 628 menu->addSeparator(); |
629 m_rightButtonMenu->addSeparator(); | 629 m_rightButtonMenu->addSeparator(); |
630 | 630 |
631 m_keyReference->setCategory(tr("Selection")); | 631 m_keyReference->setCategory(tr("Selection")); |
1429 action->setShortcut(tr("F1")); | 1429 action->setShortcut(tr("F1")); |
1430 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); | 1430 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); |
1431 connect(action, SIGNAL(triggered()), this, SLOT(help())); | 1431 connect(action, SIGNAL(triggered()), this, SLOT(help())); |
1432 m_keyReference->registerShortcut(action); | 1432 m_keyReference->registerShortcut(action); |
1433 menu->addAction(action); | 1433 menu->addAction(action); |
1434 | |
1435 action = new QAction(tr("Sonic Visualiser on the &Web"), this); | |
1436 action->setStatusTip(tr("Open the Sonic Visualiser website")); | |
1437 connect(action, SIGNAL(triggered()), this, SLOT(website())); | |
1438 menu->addAction(action); | |
1439 | 1434 |
1440 action = new QAction(tr("&Key and Mouse Reference"), this); | 1435 action = new QAction(tr("&Key and Mouse Reference"), this); |
1441 action->setShortcut(tr("F2")); | 1436 action->setShortcut(tr("F2")); |
1442 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser")); | 1437 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser")); |
1443 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); | 1438 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); |
1444 m_keyReference->registerShortcut(action); | 1439 m_keyReference->registerShortcut(action); |
1440 menu->addAction(action); | |
1441 | |
1442 action = new QAction(tr("Sonic Visualiser on the &Web"), this); | |
1443 action->setStatusTip(tr("Open the Sonic Visualiser website")); | |
1444 connect(action, SIGNAL(triggered()), this, SLOT(website())); | |
1445 menu->addAction(action); | 1445 menu->addAction(action); |
1446 | 1446 |
1447 action = new QAction(tr("&About Sonic Visualiser"), this); | 1447 action = new QAction(tr("&About Sonic Visualiser"), this); |
1448 action->setStatusTip(tr("Show information about Sonic Visualiser")); | 1448 action->setStatusTip(tr("Show information about Sonic Visualiser")); |
1449 connect(action, SIGNAL(triggered()), this, SLOT(about())); | 1449 connect(action, SIGNAL(triggered()), this, SLOT(about())); |
1837 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); | 1837 emit canPlaySelection(haveMainModel && havePlayTarget && haveSelection); |
1838 emit canClearSelection(haveSelection); | 1838 emit canClearSelection(haveSelection); |
1839 emit canEditSelection(haveSelection && haveCurrentEditableLayer); | 1839 emit canEditSelection(haveSelection && haveCurrentEditableLayer); |
1840 emit canSave(m_sessionFile != "" && m_documentModified); | 1840 emit canSave(m_sessionFile != "" && m_documentModified); |
1841 | 1841 |
1842 if (m_viewManager && | |
1843 (m_viewManager->getToolMode() == ViewManager::MeasureMode)) { | |
1844 emit canDeleteSelection(haveCurrentLayer); | |
1845 m_deleteSelectedAction->setText(tr("&Delete Current Measurement")); | |
1846 m_deleteSelectedAction->setStatusTip(tr("Delete the measurement currently under the mouse pointer")); | |
1847 } else { | |
1848 emit canDeleteSelection(haveSelection && haveCurrentEditableLayer); | |
1849 m_deleteSelectedAction->setText(tr("&Delete Selected Items")); | |
1850 m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer")); | |
1851 } | |
1852 | |
1842 emit canChangePlaybackSpeed(true); | 1853 emit canChangePlaybackSpeed(true); |
1843 int v = m_playSpeed->value(); | 1854 int v = m_playSpeed->value(); |
1844 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); | 1855 emit canSpeedUpPlayback(v < m_playSpeed->maximum()); |
1845 emit canSlowDownPlayback(v > m_playSpeed->minimum()); | 1856 emit canSlowDownPlayback(v > m_playSpeed->minimum()); |
1846 | 1857 |
2124 void | 2135 void |
2125 MainWindow::deleteSelected() | 2136 MainWindow::deleteSelected() |
2126 { | 2137 { |
2127 if (m_paneStack->getCurrentPane() && | 2138 if (m_paneStack->getCurrentPane() && |
2128 m_paneStack->getCurrentPane()->getSelectedLayer()) { | 2139 m_paneStack->getCurrentPane()->getSelectedLayer()) { |
2129 | 2140 |
2130 MultiSelection::SelectionList selections = | 2141 Layer *layer = m_paneStack->getCurrentPane()->getSelectedLayer(); |
2131 m_viewManager->getSelections(); | 2142 |
2132 | 2143 if (m_viewManager && |
2133 for (MultiSelection::SelectionList::iterator i = selections.begin(); | 2144 (m_viewManager->getToolMode() == ViewManager::MeasureMode)) { |
2134 i != selections.end(); ++i) { | 2145 |
2135 | 2146 layer->deleteCurrentMeasureRect(); |
2136 m_paneStack->getCurrentPane()->getSelectedLayer()->deleteSelection(*i); | 2147 |
2148 } else { | |
2149 | |
2150 MultiSelection::SelectionList selections = | |
2151 m_viewManager->getSelections(); | |
2152 | |
2153 for (MultiSelection::SelectionList::iterator i = selections.begin(); | |
2154 i != selections.end(); ++i) { | |
2155 layer->deleteSelection(*i); | |
2156 } | |
2137 } | 2157 } |
2138 } | 2158 } |
2139 } | 2159 } |
2140 | 2160 |
2141 void | 2161 void |
3134 settings.endGroup(); | 3154 settings.endGroup(); |
3135 | 3155 |
3136 delete m_keyReference; | 3156 delete m_keyReference; |
3137 m_keyReference = 0; | 3157 m_keyReference = 0; |
3138 | 3158 |
3139 closeSession(); | |
3140 if (m_preferencesDialog && | 3159 if (m_preferencesDialog && |
3141 m_preferencesDialog->isVisible()) { | 3160 m_preferencesDialog->isVisible()) { |
3161 closeSession(); // otherwise we'll have to wait for prefs changes | |
3142 m_preferencesDialog->applicationClosing(false); | 3162 m_preferencesDialog->applicationClosing(false); |
3143 } | 3163 } |
3144 | 3164 |
3145 e->accept(); | 3165 e->accept(); |
3146 return; | 3166 return; |