Mercurial > hg > svcore
diff base/View.cpp @ 29:8460b3bf8f04
* Implement play mute, level and pan controls and a layer visibility control
* Handle swapping the buffers in AudioCallbackPlaySource more gracefully, so
that in many cases it can be done inaudibly. Still gets it wrong when
playing in a noncontiguous selection.
* Fix to SV file save for non-2d sparse models
* Fixes to LED button drawing and AudioDial mouse functionality
* Add progress bar for Ogg file import
* Reshuffle PropertyContainer and its subclasses so it can be a QObject
* Add layer dormancy (invisible layer permitted to free its cache space)
* Optimisations to SpectrogramLayer, removing locks when reading/writing
individual pixels in the cache (should be unnecessary there) -- there's
still an issue here as we need a lock when reading from the model in
case the model is replaced, and we don't currently have one
* Several munlock() calls to make it harder to exhaust real memory if
running in an RT mode with mlockall() active
author | Chris Cannam |
---|---|
date | Fri, 17 Feb 2006 18:04:26 +0000 |
parents | 7dad8a310963 |
children | 4afaf0df4d51 |
line wrap: on
line diff
--- a/base/View.cpp Wed Feb 15 17:58:35 2006 +0000 +++ b/base/View.cpp Fri Feb 17 18:04:26 2006 +0000 @@ -44,7 +44,8 @@ m_selectionCached(false), m_deleting(false), m_haveSelectedLayer(false), - m_manager(0) + m_manager(0), + m_propertyContainer(new ViewPropertyContainer(this)) { // QWidget::setAttribute(Qt::WA_PaintOnScreen); } @@ -56,12 +57,14 @@ for (LayerList::iterator i = m_layers.begin(); i != m_layers.end(); ++i) { delete *i; } + + delete m_propertyContainer; } PropertyContainer::PropertyList View::getProperties() const { - PropertyList list; + PropertyContainer::PropertyList list; list.push_back(tr("Global Scroll")); list.push_back(tr("Global Zoom")); list.push_back(tr("Follow Playback")); @@ -69,27 +72,33 @@ } PropertyContainer::PropertyType -View::getPropertyType(const PropertyName &name) const +View::getPropertyType(const PropertyContainer::PropertyName &name) const { - if (name == tr("Global Scroll")) return ToggleProperty; - if (name == tr("Global Zoom")) return ToggleProperty; - if (name == tr("Follow Playback")) return ValueProperty; - return InvalidProperty; + if (name == tr("Global Scroll")) return PropertyContainer::ToggleProperty; + if (name == tr("Global Zoom")) return PropertyContainer::ToggleProperty; + if (name == tr("Follow Playback")) return PropertyContainer::ValueProperty; + return PropertyContainer::InvalidProperty; } int -View::getPropertyRangeAndValue(const PropertyName &name, - int *min, int *max) const +View::getPropertyRangeAndValue(const PropertyContainer::PropertyName &name, + int *min, int *max) const { if (name == tr("Global Scroll")) return m_followPan; if (name == tr("Global Zoom")) return m_followZoom; - if (name == tr("Follow Playback")) { *min = 0; *max = 2; return int(m_followPlay); } - return PropertyContainer::getPropertyRangeAndValue(name, min, max); + if (name == tr("Follow Playback")) { + if (min) *min = 0; + if (max) *max = 2; + return int(m_followPlay); + } + if (min) *min = 0; + if (max) *max = 0; + return 0; } QString -View::getPropertyValueLabel(const PropertyName &name, - int value) const +View::getPropertyValueLabel(const PropertyContainer::PropertyName &name, + int value) const { if (name == tr("Follow Playback")) { switch (value) { @@ -103,7 +112,7 @@ } void -View::setProperty(const PropertyName &name, int value) +View::setProperty(const PropertyContainer::PropertyName &name, int value) { if (name == tr("Global Scroll")) { setFollowGlobalPan(value != 0); @@ -135,14 +144,14 @@ PropertyContainer * View::getPropertyContainer(size_t i) { - if (i == 0) return this; + if (i == 0) return m_propertyContainer; return m_layers[i-1]; } void View::propertyContainerSelected(PropertyContainer *pc) { - if (pc == this) { + if (pc == m_propertyContainer) { if (m_haveSelectedLayer) { m_haveSelectedLayer = false; update(); @@ -380,21 +389,21 @@ View::setFollowGlobalPan(bool f) { m_followPan = f; - emit propertyContainerPropertyChanged(this); + emit propertyContainerPropertyChanged(m_propertyContainer); } void View::setFollowGlobalZoom(bool f) { m_followZoom = f; - emit propertyContainerPropertyChanged(this); + emit propertyContainerPropertyChanged(m_propertyContainer); } void View::setPlaybackFollow(PlaybackFollowMode m) { m_followPlay = m; - emit propertyContainerPropertyChanged(this); + emit propertyContainerPropertyChanged(m_propertyContainer); } void @@ -692,6 +701,7 @@ 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); else { if (scrollables != m_lastScrollableBackLayers) { @@ -730,6 +740,7 @@ size_t count = 0; for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + if ((*i)->isLayerDormant()) continue; if (count < scrollables.size()) { ++count; continue; @@ -1234,6 +1245,12 @@ return s; } +ViewPropertyContainer::ViewPropertyContainer(View *v) : + m_v(v) +{ + connect(m_v, SIGNAL(propertyChanged(PropertyName)), + this, SIGNAL(propertyChanged(PropertyName))); +} #ifdef INCLUDE_MOCFILES #include "View.moc.cpp"