Revision 6:27f9c1f11598 main/MainWindow.cpp

View differences:

main/MainWindow.cpp
1878 1878
void
1879 1879
MainWindow::layerInAView(Layer *layer, bool inAView)
1880 1880
{
1881
    MainWindowBase::layerInAView(layer, inAView);
1881
//    std::cerr << "MainWindow::layerInAView(" << layer << "," << inAView << ")" << std::endl;
1882

  
1883
    if (!inAView) removeLayerEditDialog(layer);
1884

  
1885
    // Check whether we need to add or remove model from play source
1886
    Model *model = layer->getModel();
1887
    if (model) {
1888
        Model *source = model->getSourceModel();
1889
        if (inAView) {
1890
            m_playSource->addModel(model);
1891
            if (source && source != model) {
1892
                m_playSource->addModel(source);
1893
            }
1894
        } else {
1895
            bool found = false;
1896
            for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
1897
                Pane *pane = m_paneStack->getPane(i);
1898
                if (!pane) continue;
1899
                for (int j = 0; j < pane->getLayerCount(); ++j) {
1900
                    Layer *pl = pane->getLayer(j);
1901
                    if (pl && (pl->getModel() == model ||
1902
                               pl->getModel() == source)) {
1903
                        found = true;
1904
                        break;
1905
                    }
1906
                }
1907
                if (found) break;
1908
            }
1909
            if (!found) {
1910
                m_playSource->removeModel(model);
1911
                if (source && source != model) {
1912
                    m_playSource->removeModel(source);
1913
                }
1914
            }
1915
        }
1916
    }
1917

  
1918
    updateMenuStates();
1882 1919
}
1883 1920

  
1884 1921
void

Also available in: Unified diff