Mercurial > hg > svapp
changeset 55:9fa273598830
* Add [x] button to pane to quickly delete it
author | Chris Cannam |
---|---|
date | Wed, 07 Nov 2007 16:37:17 +0000 |
parents | a798f5e6fc5e |
children | 75ad3f8f65aa |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Wed Nov 07 12:59:01 2007 +0000 +++ b/framework/MainWindowBase.cpp Wed Nov 07 16:37:17 2007 +0000 @@ -149,6 +149,8 @@ this, SLOT(paneDropAccepted(Pane *, QStringList))); connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QString)), this, SLOT(paneDropAccepted(Pane *, QString))); + connect(m_paneStack, SIGNAL(paneDeleteButtonClicked(Pane *)), + this, SLOT(paneDeleteButtonClicked(Pane *))); m_playSource = new AudioCallbackPlaySource(m_viewManager); @@ -1926,6 +1928,42 @@ } void +MainWindowBase::paneDeleteButtonClicked(Pane *pane) +{ + bool found = false; + for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { + if (m_paneStack->getPane(i) == pane) { + found = true; + break; + } + } + if (!found) { + std::cerr << "MainWindowBase::paneDeleteButtonClicked: Unknown pane " + << pane << std::endl; + return; + } + + CommandHistory::getInstance()->startCompoundOperation + (tr("Delete Pane"), true); + + while (pane->getLayerCount() > 0) { + Layer *layer = pane->getLayer(0); + if (layer) { + m_document->removeLayerFromView(pane, layer); + } else { + break; + } + } + + RemovePaneCommand *command = new RemovePaneCommand(this, pane); + CommandHistory::getInstance()->addCommand(command); + + CommandHistory::getInstance()->endCompoundOperation(); + + updateMenuStates(); +} + +void MainWindowBase::pollOSC() { if (!m_oscQueue || m_oscQueue->isEmpty()) return;
--- a/framework/MainWindowBase.h Wed Nov 07 12:59:01 2007 +0000 +++ b/framework/MainWindowBase.h Wed Nov 07 16:37:17 2007 +0000 @@ -223,6 +223,7 @@ virtual void paneAboutToBeDeleted(Pane *) = 0; virtual void paneDropAccepted(Pane *, QStringList) = 0; virtual void paneDropAccepted(Pane *, QString) = 0; + virtual void paneDeleteButtonClicked(Pane *); virtual void pollOSC(); virtual void handleOSCMessage(const OSCMessage &) = 0;