Mercurial > hg > svcore
changeset 39:e1a0cf2dcc79
* Fix a crash in PortAudio output for mono data
* Don't construct a chromagram in TonalChangeDetect plugin ctor
* Update layer show/hide/dormancy for multi-view-capable layers -- the
dormancy concept doesn't really work with these constraints any more
author | Chris Cannam |
---|---|
date | Fri, 03 Mar 2006 17:52:21 +0000 (2006-03-03) |
parents | a6b2128eed56 |
children | b2d1a61ab916 |
files | base/Layer.cpp base/Layer.h |
diffstat | 2 files changed, 20 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/base/Layer.cpp Fri Mar 03 16:56:20 2006 +0000 +++ b/base/Layer.cpp Fri Mar 03 17:52:21 2006 +0000 @@ -15,18 +15,12 @@ #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? #include "PlayParameterRepository.h" -Layer::Layer() : - m_dormant(false) +Layer::Layer() { -// m_view = w; - - // Subclass must call this: -// w->addLayer(this); } Layer::~Layer() { -// m_view->removeLayer(this); } QString @@ -42,21 +36,7 @@ QObject::setObjectName(name); emit layerNameChanged(); } -/* -int -Layer::getXForFrame(long frame) const -{ - if (m_view) return m_view->getXForFrame(frame); - else return 0; -} -long -Layer::getFrameForX(int x) const -{ - if (m_view) return m_view->getFrameForX(x); - else return 0; -} -*/ QString Layer::toXmlString(QString indent, QString extraAttributes) const {
--- a/base/Layer.h Fri Mar 03 16:56:20 2006 +0000 +++ b/base/Layer.h Fri Mar 03 17:52:21 2006 +0000 @@ -19,6 +19,8 @@ #include <QRect> #include <QXmlAttributes> +#include <map> + class ZoomConstraint; class Model; class QPainter; @@ -175,17 +177,6 @@ virtual void setObjectName(const QString &name); /** - * Return the pixel x-coordinate corresponding to a given sample - * frame (which may be negative). - */ -// int getXForFrame(long frame) const; - - /** - * Return the closest frame to the given pixel x-coordinate. - */ -// long getFrameForX(int x) const; - - /** * Convert the layer's data (though not those of the model it * refers to) into an XML string for file output. This class * implements the basic name/type/model-id output; subclasses will @@ -203,27 +194,30 @@ virtual void setProperties(const QXmlAttributes &) = 0; /** - * Indicate that a layer is not currently visible and is not - * expected to become visible in the near future (for example - * because the user has explicitly removed or hidden it). The - * layer may respond by (for example) freeing any cache memory it - * is using, until next time its paint method is called. It does - * not need to remember not to draw itself; the view will handle - * that. + * Indicate that a layer is not currently visible in the given + * view and is not expected to become visible in the near future + * (for example because the user has explicitly removed or hidden + * it). The layer may respond by (for example) freeing any cache + * memory it is using, until next time its paint method is called. + * It does not need to remember not to draw itself; the view will + * handle that. */ - //!!! update for multiview - virtual void setLayerDormant(const View *, bool dormant) { m_dormant = dormant; } + virtual void setLayerDormant(const View *v, bool dormant) { + m_dormancy[v] = dormant; + } /** - * Return whether the layer is dormant (i.e. hidden). + * Return whether the layer is dormant (i.e. hidden) in the given + * view. */ - //!!! update for multiview - virtual bool isLayerDormant(const View *) const { return m_dormant; } + virtual bool isLayerDormant(const View *v) const { + if (m_dormancy.find(v) == m_dormancy.end()) return false; + return m_dormancy.find(v)->second; + } virtual PlayParameters *getPlayParameters(); public slots: - //!!! update for multiview void showLayer(View *, bool show); signals: @@ -236,8 +230,7 @@ void layerNameChanged(); protected: -// View *m_view; - bool m_dormant; + std::map<const void *, bool> m_dormancy; }; #endif