Mercurial > hg > sonic-visualiser
changeset 84:41c491657587
* Further fix for restoring layer visibility from session file
* Better handling of error state in bzip file device to avoid spurious errors
* Fix #1495001 deleted layers prevail in saved session file
author | Chris Cannam |
---|---|
date | Fri, 05 Jan 2007 15:49:10 +0000 |
parents | 0d2fb43b5ee5 |
children | 4eae5b521a34 |
files | document/Document.cpp document/SVFileReader.cpp main/MainWindow.cpp |
diffstat | 3 files changed, 31 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/document/Document.cpp Fri Jan 05 14:46:45 2007 +0000 +++ b/document/Document.cpp Fri Jan 05 15:49:10 2007 +0000 @@ -747,12 +747,27 @@ m_mainModel->toXml(out, indent + " ", "mainModel=\"true\""); } + // Models that are not used in a layer that is in a view should + // not be written. Get our list of required models first. + + std::set<const Model *> used; + + for (LayerViewMap::const_iterator i = m_layerViewMap.begin(); + i != m_layerViewMap.end(); ++i) { + + if (i->first && !i->second.empty() && i->first->getModel()) { + used.insert(i->first->getModel()); + } + } + for (ModelMap::const_iterator i = m_models.begin(); i != m_models.end(); ++i) { const Model *model = i->first; const ModelRecord &rec = i->second; + if (used.find(model) == used.end()) continue; + // We need an intelligent way to determine which models need // to be streamed (i.e. have been edited, or are small) and // which should not be (i.e. remain as generated by a
--- a/document/SVFileReader.cpp Fri Jan 05 14:46:45 2007 +0000 +++ b/document/SVFileReader.cpp Fri Jan 05 15:49:10 2007 +0000 @@ -791,7 +791,22 @@ } if (!m_inData && m_currentPane) { + + QString visible = attributes.value("visible"); + bool dormant = (visible == "false"); + + // We need to do this both before and after adding the layer + // to the view -- we need it to be dormant if appropriate + // before it's actually added to the view so that any property + // box gets the right state when it's added, but the add layer + // command sets dormant to false because it assumes it may be + // restoring a previously dormant layer, so we need to set it + // again afterwards too. Hm + layer->setLayerDormant(m_currentPane, dormant); + m_document->addLayerToView(m_currentPane, layer); + + layer->setLayerDormant(m_currentPane, dormant); } return true;
--- a/main/MainWindow.cpp Fri Jan 05 14:46:45 2007 +0000 +++ b/main/MainWindow.cpp Fri Jan 05 15:49:10 2007 +0000 @@ -2873,7 +2873,7 @@ QApplication::restoreOverrideCursor(); - if (bzFile.errorString() != "") { + if (!bzFile.isOK()) { QMessageBox::critical(this, tr("Failed to write file"), tr("Failed to write to file \"%1\": %2") .arg(path).arg(bzFile.errorString()));