Mercurial > hg > svcore
annotate base/Layer.cpp @ 5:31c4ed2d5da6
* Hook up SV file i/o. You can now save and load sessions.
Some problems -- gain is not reloaded correctly for waveforms,
reloaded panes are not properly reconnected to the panner, and
no doubt plenty of others.
author | Chris Cannam |
---|---|
date | Tue, 17 Jan 2006 17:45:55 +0000 |
parents | 149bb02a41ba |
children | 44bbf5793d84 |
rev | line source |
---|---|
Chris@0 | 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ |
Chris@0 | 2 |
Chris@0 | 3 /* |
Chris@0 | 4 A waveform viewer and audio annotation editor. |
Chris@2 | 5 Chris Cannam, Queen Mary University of London, 2005-2006 |
Chris@0 | 6 |
Chris@0 | 7 This is experimental software. Not for distribution. |
Chris@0 | 8 */ |
Chris@0 | 9 |
Chris@0 | 10 #include "Layer.h" |
Chris@0 | 11 #include "View.h" |
Chris@0 | 12 |
Chris@0 | 13 #include <iostream> |
Chris@0 | 14 |
Chris@3 | 15 #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? |
Chris@3 | 16 |
Chris@0 | 17 Layer::Layer(View *w) |
Chris@0 | 18 { |
Chris@0 | 19 m_view = w; |
Chris@0 | 20 |
Chris@0 | 21 // Subclass must call this: |
Chris@0 | 22 // w->addLayer(this); |
Chris@0 | 23 } |
Chris@0 | 24 |
Chris@0 | 25 Layer::~Layer() |
Chris@0 | 26 { |
Chris@0 | 27 m_view->removeLayer(this); |
Chris@0 | 28 } |
Chris@0 | 29 |
Chris@0 | 30 void |
Chris@0 | 31 Layer::setObjectName(const QString &name) |
Chris@0 | 32 { |
Chris@0 | 33 QObject::setObjectName(name); |
Chris@0 | 34 emit layerNameChanged(); |
Chris@0 | 35 } |
Chris@0 | 36 |
Chris@3 | 37 QString |
Chris@3 | 38 Layer::toXmlString(QString indent, QString extraAttributes) const |
Chris@3 | 39 { |
Chris@3 | 40 QString s; |
Chris@3 | 41 |
Chris@3 | 42 s += indent; |
Chris@3 | 43 |
Chris@5 | 44 s += QString("<layer id=\"%2\" type=\"%1\" name=\"%3\" model=\"%4\" %5>\n") |
Chris@3 | 45 .arg(LayerFactory::instance()->getLayerTypeName |
Chris@3 | 46 (LayerFactory::instance()->getLayerType(this))) |
Chris@4 | 47 .arg(getObjectExportId(this)) |
Chris@3 | 48 .arg(objectName()) |
Chris@4 | 49 .arg(getObjectExportId(getModel())) |
Chris@3 | 50 .arg(extraAttributes); |
Chris@3 | 51 |
Chris@5 | 52 PropertyList properties = getProperties(); |
Chris@5 | 53 |
Chris@5 | 54 for (PropertyList::const_iterator i = properties.begin(); |
Chris@5 | 55 i != properties.end(); ++i) { |
Chris@5 | 56 |
Chris@5 | 57 int pv = getPropertyRangeAndValue(*i, 0, 0); |
Chris@5 | 58 s += indent + ""; |
Chris@5 | 59 s += QString("<property name=\"%1\" value=\"%2\"/>\n").arg(*i).arg(pv); |
Chris@5 | 60 } |
Chris@5 | 61 |
Chris@5 | 62 s += indent + "</layer>\n"; |
Chris@5 | 63 |
Chris@3 | 64 return s; |
Chris@3 | 65 } |
Chris@0 | 66 |
Chris@0 | 67 #ifdef INCLUDE_MOCFILES |
Chris@0 | 68 #include "Layer.moc.cpp" |
Chris@0 | 69 #endif |
Chris@0 | 70 |