Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 258:a31c65904a49
* Start adding a spreadsheet-style editor window for model data
author | Chris Cannam |
---|---|
date | Fri, 06 Jun 2008 15:26:27 +0000 |
parents | 6e8ebc86119a |
children | 1a1c764ea636 |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu May 29 14:35:32 2008 +0000 +++ b/main/MainWindow.cpp Fri Jun 06 15:26:27 2008 +0000 @@ -43,6 +43,7 @@ #include "widgets/AudioDial.h" #include "widgets/IconLoader.h" #include "widgets/LayerTreeDialog.h" +#include "widgets/ModelDataTableDialog.h" #include "widgets/ListInputDialog.h" #include "widgets/SubdividingMenu.h" #include "widgets/NotifyingPushButton.h" @@ -1180,6 +1181,14 @@ menu->addAction(raction); m_rightButtonLayerMenu->addAction(raction); + QAction *eaction = new QAction(tr("Edit Layer Data"), this); + eaction->setShortcut(tr("E")); + eaction->setStatusTip(tr("Edit the currently active layer as a data grid")); + connect(eaction, SIGNAL(triggered()), this, SLOT(editCurrentLayer())); + connect(this, SIGNAL(canEditLayer(bool)), eaction, SLOT(setEnabled(bool))); + menu->addAction(eaction); + m_rightButtonLayerMenu->addAction(eaction); + action = new QAction(il.load("editdelete"), tr("&Delete Layer"), this); action->setShortcut(tr("Ctrl+D")); action->setStatusTip(tr("Delete the currently active layer")); @@ -1190,6 +1199,7 @@ m_rightButtonLayerMenu->addAction(action); m_keyReference->registerShortcut(raction); // rename after delete, so delete layer goes next to delete pane + m_keyReference->registerShortcut(eaction); // edit also after delete } void @@ -3035,6 +3045,27 @@ } void +MainWindow::editCurrentLayer() +{ + //!!! maintain one per layer only + + Pane *pane = m_paneStack->getCurrentPane(); + if (pane) { + Layer *layer = pane->getSelectedLayer(); + if (layer) { + Model *model = layer->getModel(); + if (model) { + + ModelDataTableDialog *dialog = new ModelDataTableDialog(model); + dialog->setAttribute(Qt::WA_DeleteOnClose); // see below + dialog->show(); + return; + } + } + } +} + +void MainWindow::playSoloToggled() { MainWindowBase::playSoloToggled();