comparison 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
comparison
equal deleted inserted replaced
257:6e8ebc86119a 258:a31c65904a49
41 #include "widgets/PropertyBox.h" 41 #include "widgets/PropertyBox.h"
42 #include "widgets/PropertyStack.h" 42 #include "widgets/PropertyStack.h"
43 #include "widgets/AudioDial.h" 43 #include "widgets/AudioDial.h"
44 #include "widgets/IconLoader.h" 44 #include "widgets/IconLoader.h"
45 #include "widgets/LayerTreeDialog.h" 45 #include "widgets/LayerTreeDialog.h"
46 #include "widgets/ModelDataTableDialog.h"
46 #include "widgets/ListInputDialog.h" 47 #include "widgets/ListInputDialog.h"
47 #include "widgets/SubdividingMenu.h" 48 #include "widgets/SubdividingMenu.h"
48 #include "widgets/NotifyingPushButton.h" 49 #include "widgets/NotifyingPushButton.h"
49 #include "widgets/KeyReference.h" 50 #include "widgets/KeyReference.h"
50 #include "widgets/LabelCounterInputDialog.h" 51 #include "widgets/LabelCounterInputDialog.h"
1178 connect(raction, SIGNAL(triggered()), this, SLOT(renameCurrentLayer())); 1179 connect(raction, SIGNAL(triggered()), this, SLOT(renameCurrentLayer()));
1179 connect(this, SIGNAL(canRenameLayer(bool)), raction, SLOT(setEnabled(bool))); 1180 connect(this, SIGNAL(canRenameLayer(bool)), raction, SLOT(setEnabled(bool)));
1180 menu->addAction(raction); 1181 menu->addAction(raction);
1181 m_rightButtonLayerMenu->addAction(raction); 1182 m_rightButtonLayerMenu->addAction(raction);
1182 1183
1184 QAction *eaction = new QAction(tr("Edit Layer Data"), this);
1185 eaction->setShortcut(tr("E"));
1186 eaction->setStatusTip(tr("Edit the currently active layer as a data grid"));
1187 connect(eaction, SIGNAL(triggered()), this, SLOT(editCurrentLayer()));
1188 connect(this, SIGNAL(canEditLayer(bool)), eaction, SLOT(setEnabled(bool)));
1189 menu->addAction(eaction);
1190 m_rightButtonLayerMenu->addAction(eaction);
1191
1183 action = new QAction(il.load("editdelete"), tr("&Delete Layer"), this); 1192 action = new QAction(il.load("editdelete"), tr("&Delete Layer"), this);
1184 action->setShortcut(tr("Ctrl+D")); 1193 action->setShortcut(tr("Ctrl+D"));
1185 action->setStatusTip(tr("Delete the currently active layer")); 1194 action->setStatusTip(tr("Delete the currently active layer"));
1186 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentLayer())); 1195 connect(action, SIGNAL(triggered()), this, SLOT(deleteCurrentLayer()));
1187 connect(this, SIGNAL(canDeleteCurrentLayer(bool)), action, SLOT(setEnabled(bool))); 1196 connect(this, SIGNAL(canDeleteCurrentLayer(bool)), action, SLOT(setEnabled(bool)));
1188 m_keyReference->registerShortcut(action); 1197 m_keyReference->registerShortcut(action);
1189 menu->addAction(action); 1198 menu->addAction(action);
1190 m_rightButtonLayerMenu->addAction(action); 1199 m_rightButtonLayerMenu->addAction(action);
1191 1200
1192 m_keyReference->registerShortcut(raction); // rename after delete, so delete layer goes next to delete pane 1201 m_keyReference->registerShortcut(raction); // rename after delete, so delete layer goes next to delete pane
1202 m_keyReference->registerShortcut(eaction); // edit also after delete
1193 } 1203 }
1194 1204
1195 void 1205 void
1196 MainWindow::setupTransformsMenu() 1206 MainWindow::setupTransformsMenu()
1197 { 1207 {
3029 if (ok) { 3039 if (ok) {
3030 layer->setPresentationName(newName); 3040 layer->setPresentationName(newName);
3031 setupExistingLayersMenus(); 3041 setupExistingLayersMenus();
3032 } 3042 }
3033 } 3043 }
3044 }
3045 }
3046
3047 void
3048 MainWindow::editCurrentLayer()
3049 {
3050 //!!! maintain one per layer only
3051
3052 Pane *pane = m_paneStack->getCurrentPane();
3053 if (pane) {
3054 Layer *layer = pane->getSelectedLayer();
3055 if (layer) {
3056 Model *model = layer->getModel();
3057 if (model) {
3058
3059 ModelDataTableDialog *dialog = new ModelDataTableDialog(model);
3060 dialog->setAttribute(Qt::WA_DeleteOnClose); // see below
3061 dialog->show();
3062 return;
3063 }
3064 }
3034 } 3065 }
3035 } 3066 }
3036 3067
3037 void 3068 void
3038 MainWindow::playSoloToggled() 3069 MainWindow::playSoloToggled()