comparison main/MainWindow.cpp @ 761:956134fa9f24

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
author Chris Cannam
date Wed, 13 Aug 2014 16:18:25 +0100
parents 5b4206f7d7d4
children 902756b8d8b1
comparison
equal deleted inserted replaced
760:5b4206f7d7d4 761:956134fa9f24
3878 MainWindow::currentPaneChanged(Pane *pane) 3878 MainWindow::currentPaneChanged(Pane *pane)
3879 { 3879 {
3880 MainWindowBase::currentPaneChanged(pane); 3880 MainWindowBase::currentPaneChanged(pane);
3881 3881
3882 if (!pane || !m_panLayer) return; 3882 if (!pane || !m_panLayer) return;
3883
3884 // If this pane contains the main model, it usually makes sense to
3885 // show the main model in the pan layer even if it isn't the top
3886 // layer in the pane (e.g. if the top layer is one derived from
3887 // the main model).
3888 bool containsMainModel = false;
3889 for (int i = pane->getLayerCount(); i > 0; ) {
3890 --i;
3891 Layer *layer = pane->getLayer(i);
3892 if (layer &&
3893 LayerFactory::getInstance()->getLayerType(layer) ==
3894 LayerFactory::Waveform &&
3895 layer->getModel() == getMainModel()) {
3896 containsMainModel = true;
3897 break;
3898 }
3899 }
3900
3901 if (containsMainModel) {
3902 m_panLayer->setModel(getMainModel());
3903 return;
3904 }
3905
3883 for (int i = pane->getLayerCount(); i > 0; ) { 3906 for (int i = pane->getLayerCount(); i > 0; ) {
3884 --i; 3907 --i;
3885 Layer *layer = pane->getLayer(i); 3908 Layer *layer = pane->getLayer(i);
3886 if (LayerFactory::getInstance()->getLayerType(layer) == 3909 if (LayerFactory::getInstance()->getLayerType(layer) ==
3887 LayerFactory::Waveform) { 3910 LayerFactory::Waveform) {