# HG changeset patch # User Chris Cannam # Date 1407943105 -3600 # Node ID 956134fa9f2459325d5ce365ffedbafa76653df6 # Parent 5b4206f7d7d4ee28a24dd0b2d9fe6413a5d21b5f If current pane has the main model in it as a waveform, use that for the pan layer even if it isn't the top layer in the pane diff -r 5b4206f7d7d4 -r 956134fa9f24 main/MainWindow.cpp --- a/main/MainWindow.cpp Wed Aug 13 16:10:36 2014 +0100 +++ b/main/MainWindow.cpp Wed Aug 13 16:18:25 2014 +0100 @@ -3880,6 +3880,29 @@ MainWindowBase::currentPaneChanged(pane); if (!pane || !m_panLayer) return; + + // If this pane contains the main model, it usually makes sense to + // show the main model in the pan layer even if it isn't the top + // layer in the pane (e.g. if the top layer is one derived from + // the main model). + bool containsMainModel = false; + for (int i = pane->getLayerCount(); i > 0; ) { + --i; + Layer *layer = pane->getLayer(i); + if (layer && + LayerFactory::getInstance()->getLayerType(layer) == + LayerFactory::Waveform && + layer->getModel() == getMainModel()) { + containsMainModel = true; + break; + } + } + + if (containsMainModel) { + m_panLayer->setModel(getMainModel()); + return; + } + for (int i = pane->getLayerCount(); i > 0; ) { --i; Layer *layer = pane->getLayer(i);