Mercurial > hg > svgui
diff view/View.cpp @ 835:7792b7667f74
Introduce (but don't yet populate) the fixed layers vector; rename m_layers to m_layerStack to reflect its ordering by stacking
author | Chris Cannam |
---|---|
date | Tue, 02 Sep 2014 14:47:04 +0100 |
parents | 9ad718fdc369 |
children | 1384485650e3 |
line wrap: on
line diff
--- a/view/View.cpp Tue Sep 02 10:31:23 2014 +0100 +++ b/view/View.cpp Tue Sep 02 14:47:04 2014 +0100 @@ -164,7 +164,7 @@ int View::getPropertyContainerCount() const { - return m_layers.size() + 1; // the 1 is for me + return m_layerStack.size() + 1; // the 1 is for me } const PropertyContainer * @@ -178,7 +178,7 @@ View::getPropertyContainer(int i) { if (i == 0) return m_propertyContainer; - return m_layers[i-1]; + return m_layerStack[i-1]; } bool @@ -186,8 +186,8 @@ { bool have = false; - for (LayerList::const_iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { QString layerUnit; float layerMin = 0.0, layerMax = 0.0; @@ -223,8 +223,8 @@ { std::map<int, Layer *> sortedLayers; - for (LayerList::const_iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { if ((*i)->needsTextLabelHeight()) { sortedLayers[getObjectExportId(*i)] = *i; } @@ -259,17 +259,17 @@ Layer *selectedLayer = 0; - for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if (*i == pc) { selectedLayer = *i; - m_layers.erase(i); + m_layerStack.erase(i); break; } } if (selectedLayer) { m_haveSelectedLayer = true; - m_layers.push_back(selectedLayer); + m_layerStack.push_back(selectedLayer); update(); } else { m_haveSelectedLayer = false; @@ -468,8 +468,8 @@ Layer::ColourSignificance maxSignificance = Layer::ColourAbsent; bool mostSignificantHasDarkBackground = false; - for (LayerList::const_iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { Layer::ColourSignificance s = (*i)->getLayerColourSignificance(); bool light = (*i)->hasLightBackground(); @@ -532,7 +532,7 @@ SingleColourLayer *scl = dynamic_cast<SingleColourLayer *>(layer); if (scl) scl->setDefaultColourFor(this); - m_layers.push_back(layer); + m_layerStack.push_back(layer); QProgressBar *pb = new QProgressBar(this); pb->setMinimum(0); @@ -599,9 +599,9 @@ delete m_cache; m_cache = 0; - for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if (*i == layer) { - m_layers.erase(i); + m_layerStack.erase(i); if (m_progressBars.find(layer) != m_progressBars.end()) { delete m_progressBars[layer].bar; delete m_progressBars[layer].cancel; @@ -641,7 +641,7 @@ if (sl && !(sl->isLayerDormant(this))) { return sl; } - if (!m_layers.empty()) { + if (!m_layerStack.empty()) { int n = getLayerCount(); while (n > 0) { --n; @@ -657,7 +657,7 @@ Layer * View::getSelectedLayer() { - if (m_haveSelectedLayer && !m_layers.empty()) { + if (m_haveSelectedLayer && !m_layerStack.empty()) { int n = getLayerCount(); while (n > 0) { --n; @@ -1182,7 +1182,7 @@ bool first = true; int startFrame = 0; - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if ((*i)->getModel() && (*i)->getModel()->isOK()) { @@ -1203,7 +1203,7 @@ bool first = true; int endFrame = 0; - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if ((*i)->getModel() && (*i)->getModel()->isOK()) { @@ -1229,7 +1229,7 @@ //!!! nah, this wants to always return the sr of the main model! - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if ((*i)->getModel() && (*i)->getModel()->isOK()) { return (*i)->getModel()->getSampleRate(); } @@ -1272,8 +1272,8 @@ Model *alignedModel = 0; Model *goodModel = 0; - for (LayerList::const_iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { Layer *layer = *i; @@ -1335,7 +1335,7 @@ View::areLayersScrollable() const { // True iff all views are scrollable - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if (!(*i)->isLayerScrollable(this)) return false; } return true; @@ -1352,7 +1352,7 @@ LayerList scrollables; bool metUnscrollable = false; - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { // SVDEBUG << "View::getScrollableBackLayers: calling isLayerDormant on layer " << *i << endl; // cerr << "(name is " << (*i)->objectName() << ")" // << endl; @@ -1388,7 +1388,7 @@ bool started = false; - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if ((*i)->isLayerDormant(this)) continue; if (!started && (*i)->isLayerScrollable(this)) { continue; @@ -1419,7 +1419,7 @@ PowerOfSqrtTwoZoomConstraint defaultZoomConstraint; - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { const ZoomConstraint *zoomConstraint = (*i)->getZoomConstraint(); if (!zoomConstraint) zoomConstraint = &defaultZoomConstraint; @@ -1443,7 +1443,7 @@ bool View::areLayerColoursSignificant() const { - for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + for (LayerList::const_iterator i = m_layerStack.begin(); i != m_layerStack.end(); ++i) { if ((*i)->getLayerColourSignificance() == Layer::ColourHasMeaningfulValue) return true; if ((*i)->isLayerOpaque()) break; @@ -1454,8 +1454,8 @@ bool View::hasTopLayerTimeXAxis() const { - LayerList::const_iterator i = m_layers.end(); - if (i == m_layers.begin()) return false; + LayerList::const_iterator i = m_layerStack.end(); + if (i == m_layerStack.begin()) return false; --i; return (*i)->hasTimeXAxis(); } @@ -1653,7 +1653,7 @@ // Profiler prof("View::paintEvent", false); // cerr << "View::paintEvent: centre frame is " << m_centreFrame << endl; - if (m_layers.empty()) { + if (m_layerStack.empty()) { QFrame::paintEvent(e); return; } @@ -2333,8 +2333,8 @@ bool someLayersIncomplete = false; - for (LayerList::iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { int c = (*i)->getCompletion(this); if (c < 100) { @@ -2352,11 +2352,11 @@ while (layerCompletion < 100) { - for (LayerList::iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { int c = (*i)->getCompletion(this); - if (i == m_layers.begin() || c < layerCompletion) { + if (i == m_layerStack.begin() || c < layerCompletion) { layerCompletion = c; } } @@ -2399,8 +2399,8 @@ paint.setPen(getForeground()); paint.setBrush(Qt::NoBrush); - for (LayerList::iterator i = m_layers.begin(); - i != m_layers.end(); ++i) { + for (LayerList::iterator i = m_layerStack.begin(); + i != m_layerStack.end(); ++i) { if(!((*i)->isLayerDormant(this))){ paint.setRenderHint(QPainter::Antialiasing, false); @@ -2495,9 +2495,9 @@ "ignore") .arg(extraAttributes); - for (int i = 0; i < (int)m_layers.size(); ++i) { - bool visible = !m_layers[i]->isLayerDormant(this); - m_layers[i]->toBriefXml(stream, indent + " ", + for (int i = 0; i < (int)m_layerStack.size(); ++i) { + bool visible = !m_layerStack[i]->isLayerDormant(this); + m_layerStack[i]->toBriefXml(stream, indent + " ", QString("visible=\"%1\"") .arg(visible ? "true" : "false")); }