# HG changeset patch # User Chris Cannam # Date 1146138574 0 # Node ID ea730e3f9acefd5a0d589aaf131becd0744938c0 # Parent 97e08589552435abbcf439c44b553858733028a2 * Ensure consistent ordering of layer text labels * Fix erroneous SR mismatch warning when adding a wave-file model when no other wave-file model is present (only models that don't assert any particular playback samplerate) diff -r 97e085895524 -r ea730e3f9ace base/View.cpp --- a/base/View.cpp Wed Apr 26 16:27:34 2006 +0000 +++ b/base/View.cpp Thu Apr 27 11:49:34 2006 +0000 @@ -178,16 +178,21 @@ int View::getTextLabelHeight(const Layer *layer, QPainter &paint) const { - int y = 15 + paint.fontMetrics().ascent(); + std::map sortedLayers; for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) { + if ((*i)->needsTextLabelHeight()) { + sortedLayers[getObjectExportId(*i)] = *i; + } + } - if (*i == layer) return y; + int y = 15 + paint.fontMetrics().ascent(); - if ((*i)->needsTextLabelHeight()) { - y += paint.fontMetrics().height(); - } + for (std::map::const_iterator i = sortedLayers.begin(); + i != sortedLayers.end(); ++i) { + if (i->second == layer) return y; + y += paint.fontMetrics().height(); } return y; diff -r 97e085895524 -r ea730e3f9ace base/XmlExportable.cpp --- a/base/XmlExportable.cpp Wed Apr 26 16:27:34 2006 +0000 +++ b/base/XmlExportable.cpp Thu Apr 27 11:49:34 2006 +0000 @@ -15,6 +15,8 @@ #include "XmlExportable.h" #include +#include +#include QString XmlExportable::encodeEntities(QString s) @@ -49,6 +51,9 @@ int XmlExportable::getObjectExportId(const void * object) { + static QMutex mutex; + QMutexLocker locker(&mutex); + static std::map idMap; static int maxId = 0; diff -r 97e085895524 -r ea730e3f9ace base/XmlExportable.h --- a/base/XmlExportable.h Wed Apr 26 16:27:34 2006 +0000 +++ b/base/XmlExportable.h Thu Apr 27 11:49:34 2006 +0000 @@ -31,7 +31,7 @@ static QString encodeColour(QColor); - static int getObjectExportId(const void *); // not thread-safe + static int getObjectExportId(const void *); // thread-safe }; #endif