comparison 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
comparison
equal deleted inserted replaced
54:a798f5e6fc5e 55:9fa273598830
147 this, SLOT(paneAboutToBeDeleted(Pane *))); 147 this, SLOT(paneAboutToBeDeleted(Pane *)));
148 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QStringList)), 148 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QStringList)),
149 this, SLOT(paneDropAccepted(Pane *, QStringList))); 149 this, SLOT(paneDropAccepted(Pane *, QStringList)));
150 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QString)), 150 connect(m_paneStack, SIGNAL(dropAccepted(Pane *, QString)),
151 this, SLOT(paneDropAccepted(Pane *, QString))); 151 this, SLOT(paneDropAccepted(Pane *, QString)));
152 connect(m_paneStack, SIGNAL(paneDeleteButtonClicked(Pane *)),
153 this, SLOT(paneDeleteButtonClicked(Pane *)));
152 154
153 m_playSource = new AudioCallbackPlaySource(m_viewManager); 155 m_playSource = new AudioCallbackPlaySource(m_viewManager);
154 156
155 connect(m_playSource, SIGNAL(sampleRateMismatch(size_t, size_t, bool)), 157 connect(m_playSource, SIGNAL(sampleRateMismatch(size_t, size_t, bool)),
156 this, SLOT(sampleRateMismatch(size_t, size_t, bool))); 158 this, SLOT(sampleRateMismatch(size_t, size_t, bool)));
1924 m_playSource->removeModel(model); 1926 m_playSource->removeModel(model);
1925 FFTDataServer::modelAboutToBeDeleted(model); 1927 FFTDataServer::modelAboutToBeDeleted(model);
1926 } 1928 }
1927 1929
1928 void 1930 void
1931 MainWindowBase::paneDeleteButtonClicked(Pane *pane)
1932 {
1933 bool found = false;
1934 for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
1935 if (m_paneStack->getPane(i) == pane) {
1936 found = true;
1937 break;
1938 }
1939 }
1940 if (!found) {
1941 std::cerr << "MainWindowBase::paneDeleteButtonClicked: Unknown pane "
1942 << pane << std::endl;
1943 return;
1944 }
1945
1946 CommandHistory::getInstance()->startCompoundOperation
1947 (tr("Delete Pane"), true);
1948
1949 while (pane->getLayerCount() > 0) {
1950 Layer *layer = pane->getLayer(0);
1951 if (layer) {
1952 m_document->removeLayerFromView(pane, layer);
1953 } else {
1954 break;
1955 }
1956 }
1957
1958 RemovePaneCommand *command = new RemovePaneCommand(this, pane);
1959 CommandHistory::getInstance()->addCommand(command);
1960
1961 CommandHistory::getInstance()->endCompoundOperation();
1962
1963 updateMenuStates();
1964 }
1965
1966 void
1929 MainWindowBase::pollOSC() 1967 MainWindowBase::pollOSC()
1930 { 1968 {
1931 if (!m_oscQueue || m_oscQueue->isEmpty()) return; 1969 if (!m_oscQueue || m_oscQueue->isEmpty()) return;
1932 std::cerr << "MainWindowBase::pollOSC: have " << m_oscQueue->getMessagesAvailable() << " messages" << std::endl; 1970 std::cerr << "MainWindowBase::pollOSC: have " << m_oscQueue->getMessagesAvailable() << " messages" << std::endl;
1933 1971