Mercurial > hg > svcore
comparison base/View.cpp @ 85:ea730e3f9ace
* 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)
author | Chris Cannam |
---|---|
date | Thu, 27 Apr 2006 11:49:34 +0000 |
parents | c983dda79f72 |
children | 5b8392e80ed6 |
comparison
equal
deleted
inserted
replaced
84:97e085895524 | 85:ea730e3f9ace |
---|---|
176 } | 176 } |
177 | 177 |
178 int | 178 int |
179 View::getTextLabelHeight(const Layer *layer, QPainter &paint) const | 179 View::getTextLabelHeight(const Layer *layer, QPainter &paint) const |
180 { | 180 { |
181 int y = 15 + paint.fontMetrics().ascent(); | 181 std::map<int, Layer *> sortedLayers; |
182 | 182 |
183 for (LayerList::const_iterator i = m_layers.begin(); | 183 for (LayerList::const_iterator i = m_layers.begin(); |
184 i != m_layers.end(); ++i) { | 184 i != m_layers.end(); ++i) { |
185 | |
186 if (*i == layer) return y; | |
187 | |
188 if ((*i)->needsTextLabelHeight()) { | 185 if ((*i)->needsTextLabelHeight()) { |
189 y += paint.fontMetrics().height(); | 186 sortedLayers[getObjectExportId(*i)] = *i; |
190 } | 187 } |
188 } | |
189 | |
190 int y = 15 + paint.fontMetrics().ascent(); | |
191 | |
192 for (std::map<int, Layer *>::const_iterator i = sortedLayers.begin(); | |
193 i != sortedLayers.end(); ++i) { | |
194 if (i->second == layer) return y; | |
195 y += paint.fontMetrics().height(); | |
191 } | 196 } |
192 | 197 |
193 return y; | 198 return y; |
194 } | 199 } |
195 | 200 |