Mercurial > hg > svcore
diff base/View.cpp @ 36:935a2419a77c
* Refactor Layer classes so as no longer to store a single View pointer;
instead they need to be able to draw themselves on any View on demand.
Layers with caches (e.g. spectrogram) will need to be further refactored
so as to maintain a per-View cache
* Begin refactoring MainWindow by pulling out the document stuff (set of
layers, models etc) into a Document class. Not yet in use.
This revision is fairly unstable.
author | Chris Cannam |
---|---|
date | Thu, 02 Mar 2006 16:58:49 +0000 |
parents | aaf73f7309f2 |
children | 838652cc31e6 |
line wrap: on
line diff
--- a/base/View.cpp Wed Mar 01 18:13:01 2006 +0000 +++ b/base/View.cpp Thu Mar 02 16:58:49 2006 +0000 @@ -52,6 +52,8 @@ View::~View() { + //!!! will want to _not_ delete layers + m_deleting = true; for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { @@ -411,6 +413,12 @@ } } +const Layer * +View::getSelectedLayer() const +{ + return const_cast<const Layer *>(const_cast<View *>(this)->getSelectedLayer()); +} + void View::setViewManager(ViewManager *manager) { @@ -789,7 +797,7 @@ { // True iff all views are scrollable for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { - if (!(*i)->isLayerScrollable()) return false; + if (!(*i)->isLayerScrollable(this)) return false; } return true; } @@ -801,8 +809,8 @@ LayerList scrollables; for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { - if ((*i)->isLayerDormant()) continue; - if ((*i)->isLayerScrollable()) scrollables.push_back(*i); + if ((*i)->isLayerDormant(this)) continue; + if ((*i)->isLayerScrollable(this)) scrollables.push_back(*i); else { if (testChanged && scrollables != m_lastScrollableBackLayers) { m_lastScrollableBackLayers = scrollables; @@ -840,7 +848,7 @@ size_t count = 0; for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { - if ((*i)->isLayerDormant()) continue; + if ((*i)->isLayerDormant(this)) continue; if (count < scrollables.size()) { ++count; continue; @@ -1148,7 +1156,7 @@ for (LayerList::iterator i = scrollables.begin(); i != scrollables.end(); ++i) { paint.setRenderHint(QPainter::Antialiasing, false); paint.save(); - (*i)->paint(paint, cacheRect); + (*i)->paint(this, paint, cacheRect); paint.restore(); } @@ -1192,7 +1200,7 @@ paint.setBrush(Qt::NoBrush); for (LayerList::iterator i = nonScrollables.begin(); i != nonScrollables.end(); ++i) { - (*i)->paint(paint, nonCacheRect); + (*i)->paint(this, paint, nonCacheRect); } paint.end();