Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 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 | eb596ef12041 |
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;