Mercurial > hg > sonic-visualiser
diff 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 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu Jul 05 11:07:01 2007 +0000 +++ b/main/MainWindow.cpp Thu Jul 05 15:36:37 2007 +0000 @@ -616,14 +616,14 @@ menu->addAction(action); m_rightButtonMenu->addAction(action); - action = new QAction(tr("&Delete Selected Items"), this); - action->setShortcut(tr("Del")); - action->setStatusTip(tr("Delete the selection from the current layer")); - connect(action, SIGNAL(triggered()), this, SLOT(deleteSelected())); - connect(this, SIGNAL(canEditSelection(bool)), action, SLOT(setEnabled(bool))); - m_keyReference->registerShortcut(action); - menu->addAction(action); - m_rightButtonMenu->addAction(action); + m_deleteSelectedAction = new QAction(tr("&Delete Selected Items"), this); + m_deleteSelectedAction->setShortcut(tr("Del")); + m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer")); + connect(m_deleteSelectedAction, SIGNAL(triggered()), this, SLOT(deleteSelected())); + connect(this, SIGNAL(canDeleteSelection(bool)), m_deleteSelectedAction, SLOT(setEnabled(bool))); + m_keyReference->registerShortcut(m_deleteSelectedAction); + menu->addAction(m_deleteSelectedAction); + m_rightButtonMenu->addAction(m_deleteSelectedAction); menu->addSeparator(); m_rightButtonMenu->addSeparator(); @@ -1431,11 +1431,6 @@ connect(action, SIGNAL(triggered()), this, SLOT(help())); m_keyReference->registerShortcut(action); menu->addAction(action); - - action = new QAction(tr("Sonic Visualiser on the &Web"), this); - action->setStatusTip(tr("Open the Sonic Visualiser website")); - connect(action, SIGNAL(triggered()), this, SLOT(website())); - menu->addAction(action); action = new QAction(tr("&Key and Mouse Reference"), this); action->setShortcut(tr("F2")); @@ -1444,6 +1439,11 @@ m_keyReference->registerShortcut(action); menu->addAction(action); + action = new QAction(tr("Sonic Visualiser on the &Web"), this); + action->setStatusTip(tr("Open the Sonic Visualiser website")); + connect(action, SIGNAL(triggered()), this, SLOT(website())); + menu->addAction(action); + action = new QAction(tr("&About Sonic Visualiser"), this); action->setStatusTip(tr("Show information about Sonic Visualiser")); connect(action, SIGNAL(triggered()), this, SLOT(about())); @@ -1839,6 +1839,17 @@ emit canEditSelection(haveSelection && haveCurrentEditableLayer); emit canSave(m_sessionFile != "" && m_documentModified); + if (m_viewManager && + (m_viewManager->getToolMode() == ViewManager::MeasureMode)) { + emit canDeleteSelection(haveCurrentLayer); + m_deleteSelectedAction->setText(tr("&Delete Current Measurement")); + m_deleteSelectedAction->setStatusTip(tr("Delete the measurement currently under the mouse pointer")); + } else { + emit canDeleteSelection(haveSelection && haveCurrentEditableLayer); + m_deleteSelectedAction->setText(tr("&Delete Selected Items")); + m_deleteSelectedAction->setStatusTip(tr("Delete items in current selection from the current layer")); + } + emit canChangePlaybackSpeed(true); int v = m_playSpeed->value(); emit canSpeedUpPlayback(v < m_playSpeed->maximum()); @@ -2126,14 +2137,23 @@ { if (m_paneStack->getCurrentPane() && m_paneStack->getCurrentPane()->getSelectedLayer()) { - - MultiSelection::SelectionList selections = - m_viewManager->getSelections(); - - for (MultiSelection::SelectionList::iterator i = selections.begin(); - i != selections.end(); ++i) { - - m_paneStack->getCurrentPane()->getSelectedLayer()->deleteSelection(*i); + + Layer *layer = m_paneStack->getCurrentPane()->getSelectedLayer(); + + if (m_viewManager && + (m_viewManager->getToolMode() == ViewManager::MeasureMode)) { + + layer->deleteCurrentMeasureRect(); + + } else { + + MultiSelection::SelectionList selections = + m_viewManager->getSelections(); + + for (MultiSelection::SelectionList::iterator i = selections.begin(); + i != selections.end(); ++i) { + layer->deleteSelection(*i); + } } } } @@ -3136,9 +3156,9 @@ delete m_keyReference; m_keyReference = 0; - closeSession(); if (m_preferencesDialog && m_preferencesDialog->isVisible()) { + closeSession(); // otherwise we'll have to wait for prefs changes m_preferencesDialog->applicationClosing(false); }