Mercurial > hg > sonic-visualiser
diff document/SVFileReader.cpp @ 154:f6ce5febc07f
* save/reload measurements in session
author | Chris Cannam |
---|---|
date | Tue, 26 Jun 2007 12:27:47 +0000 |
parents | 006c90387f40 |
children | 567df8af372c |
line wrap: on
line diff
--- a/document/SVFileReader.cpp Thu Jun 14 15:20:49 2007 +0000 +++ b/document/SVFileReader.cpp Tue Jun 26 12:27:47 2007 +0000 @@ -54,6 +54,8 @@ m_currentPlayParameters(0), m_datasetSeparator(" "), m_inRow(false), + m_inLayer(false), + m_inView(false), m_rowNumber(0), m_ok(false) { @@ -204,6 +206,14 @@ } else if (name == "selection") { ok = readSelection(attributes); + + } else if (name == "measurement") { + + ok = readMeasurement(attributes); + + } else { + std::cerr << "WARNING: SV-XML: Unexpected element \"" + << name.toLocal8Bit().data() << "\"" << std::endl; } if (!ok) { @@ -295,6 +305,8 @@ } else if (name == "row") { m_inRow = false; + } else if (name == "layer") { + m_inLayer = false; } else if (name == "view") { m_inView = false; } else if (name == "selections") { @@ -707,6 +719,9 @@ layer->setLayerDormant(m_currentPane, dormant); } + m_currentLayer = layer; + m_inLayer = true; + return true; } @@ -1064,6 +1079,21 @@ return true; } +bool +SVFileReader::readMeasurement(const QXmlAttributes &attributes) +{ + std::cerr << "SVFileReader::readMeasurement: inLayer " + << m_inLayer << ", layer " << m_currentLayer << std::endl; + + if (!m_inLayer) { + std::cerr << "WARNING: SV-XML: Measurement found outside layer" << std::endl; + return false; + } + + m_currentLayer->addMeasurementRect(attributes); + return true; +} + SVFileReaderPaneCallback::~SVFileReaderPaneCallback() { }