Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 73:ef8a3028c711
* Make font size in panes configurable, with a smaller default
* Add [ and ] to select prev/next pane
author | Chris Cannam |
---|---|
date | Tue, 11 Dec 2007 14:58:29 +0000 |
parents | 716e9d2f91c7 |
children | 864703bf64ac |
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp Fri Dec 07 16:47:31 2007 +0000 +++ b/framework/MainWindowBase.cpp Tue Dec 11 14:58:29 2007 +0000 @@ -278,6 +278,28 @@ if (m_paneStack) currentPane = m_paneStack->getCurrentPane(); if (currentPane) currentLayer = currentPane->getSelectedLayer(); + bool havePrevPane = false, haveNextPane = false; + bool havePrevLayer = false, haveNextLayer = false; + + if (currentPane) { + for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { + if (m_paneStack->getPane(i) == currentPane) { + if (i > 0) havePrevPane = true; + if (i < m_paneStack->getPaneCount()-1) haveNextPane = true; + break; + } + } + if (currentLayer) { + for (int i = 0; i < currentPane->getLayerCount(); ++i) { + if (currentPane->getLayer(i) == currentLayer) { + if (i > 0) havePrevLayer = true; + if (i < currentPane->getLayerCount()-1) haveNextLayer = true; + break; + } + } + } + } + bool haveCurrentPane = (currentPane != 0); bool haveCurrentLayer = @@ -330,6 +352,10 @@ emit canClearSelection(haveSelection); emit canEditSelection(haveSelection && haveCurrentEditableLayer); emit canSave(m_sessionFile != "" && m_documentModified); + emit canSelectPreviousPane(havePrevPane); + emit canSelectNextPane(haveNextPane); + emit canSelectPreviousLayer(havePrevLayer); + emit canSelectNextLayer(haveNextLayer); } void @@ -1812,6 +1838,90 @@ } void +MainWindowBase::previousPane() +{ + if (!m_paneStack) return; + + Pane *currentPane = m_paneStack->getCurrentPane(); + if (!currentPane) return; + + for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { + if (m_paneStack->getPane(i) == currentPane) { + if (i == 0) return; + m_paneStack->setCurrentPane(m_paneStack->getPane(i-1)); + updateMenuStates(); + return; + } + } +} + +void +MainWindowBase::nextPane() +{ + if (!m_paneStack) return; + + Pane *currentPane = m_paneStack->getCurrentPane(); + if (!currentPane) return; + + for (int i = 0; i < m_paneStack->getPaneCount(); ++i) { + if (m_paneStack->getPane(i) == currentPane) { + if (i == m_paneStack->getPaneCount()-1) return; + m_paneStack->setCurrentPane(m_paneStack->getPane(i+1)); + updateMenuStates(); + return; + } + } +} + +void +MainWindowBase::previousLayer() +{ + //!!! Not right -- pane lists layers in stacking order + + if (!m_paneStack) return; + + Pane *currentPane = m_paneStack->getCurrentPane(); + if (!currentPane) return; + + Layer *currentLayer = currentPane->getSelectedLayer(); + if (!currentLayer) return; + + for (int i = 0; i < currentPane->getLayerCount(); ++i) { + if (currentPane->getLayer(i) == currentLayer) { + if (i == 0) return; + m_paneStack->setCurrentLayer(currentPane, + currentPane->getLayer(i-1)); + updateMenuStates(); + return; + } + } +} + +void +MainWindowBase::nextLayer() +{ + //!!! Not right -- pane lists layers in stacking order + + if (!m_paneStack) return; + + Pane *currentPane = m_paneStack->getCurrentPane(); + if (!currentPane) return; + + Layer *currentLayer = currentPane->getSelectedLayer(); + if (!currentLayer) return; + + for (int i = 0; i < currentPane->getLayerCount(); ++i) { + if (currentPane->getLayer(i) == currentLayer) { + if (i == currentPane->getLayerCount()-1) return; + m_paneStack->setCurrentLayer(currentPane, + currentPane->getLayer(i+1)); + updateMenuStates(); + return; + } + } +} + +void MainWindowBase::playbackFrameChanged(unsigned long frame) { if (!(m_playSource && m_playSource->isPlaying()) || !getMainModel()) return;