Mercurial > hg > svcore
comparison base/Layer.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 | 5e28cbb431d0 |
| children | e1a0cf2dcc79 |
comparison
equal
deleted
inserted
replaced
| 35:0164c8d3023b | 36:935a2419a77c |
|---|---|
| 13 #include <iostream> | 13 #include <iostream> |
| 14 | 14 |
| 15 #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? | 15 #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? |
| 16 #include "PlayParameterRepository.h" | 16 #include "PlayParameterRepository.h" |
| 17 | 17 |
| 18 Layer::Layer(View *w) : | 18 Layer::Layer() : |
| 19 m_dormant(false) | 19 m_dormant(false) |
| 20 { | 20 { |
| 21 m_view = w; | 21 // m_view = w; |
| 22 | 22 |
| 23 // Subclass must call this: | 23 // Subclass must call this: |
| 24 // w->addLayer(this); | 24 // w->addLayer(this); |
| 25 } | 25 } |
| 26 | 26 |
| 27 Layer::~Layer() | 27 Layer::~Layer() |
| 28 { | 28 { |
| 29 m_view->removeLayer(this); | 29 // m_view->removeLayer(this); |
| 30 } | 30 } |
| 31 | 31 |
| 32 QString | 32 QString |
| 33 Layer::getPropertyContainerIconName() const | 33 Layer::getPropertyContainerIconName() const |
| 34 { | 34 { |
| 40 Layer::setObjectName(const QString &name) | 40 Layer::setObjectName(const QString &name) |
| 41 { | 41 { |
| 42 QObject::setObjectName(name); | 42 QObject::setObjectName(name); |
| 43 emit layerNameChanged(); | 43 emit layerNameChanged(); |
| 44 } | 44 } |
| 45 | 45 /* |
| 46 int | 46 int |
| 47 Layer::getXForFrame(long frame) const | 47 Layer::getXForFrame(long frame) const |
| 48 { | 48 { |
| 49 if (m_view) return m_view->getXForFrame(frame); | 49 if (m_view) return m_view->getXForFrame(frame); |
| 50 else return 0; | 50 else return 0; |
| 54 Layer::getFrameForX(int x) const | 54 Layer::getFrameForX(int x) const |
| 55 { | 55 { |
| 56 if (m_view) return m_view->getFrameForX(x); | 56 if (m_view) return m_view->getFrameForX(x); |
| 57 else return 0; | 57 else return 0; |
| 58 } | 58 } |
| 59 | 59 */ |
| 60 QString | 60 QString |
| 61 Layer::toXmlString(QString indent, QString extraAttributes) const | 61 Layer::toXmlString(QString indent, QString extraAttributes) const |
| 62 { | 62 { |
| 63 QString s; | 63 QString s; |
| 64 | 64 |
| 85 } | 85 } |
| 86 return 0; | 86 return 0; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void | 89 void |
| 90 Layer::showLayer(bool show) | 90 Layer::showLayer(View *view, bool show) |
| 91 { | 91 { |
| 92 setLayerDormant(!show); | 92 setLayerDormant(view, !show); |
| 93 emit layerParametersChanged(); | 93 emit layerParametersChanged(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 | 96 |
| 97 #ifdef INCLUDE_MOCFILES | 97 #ifdef INCLUDE_MOCFILES |
