Mercurial > hg > svcore
diff base/View.cpp @ 78:c983dda79f72
* Replace crash with warning when a transform could not be automatically
re-run
* More sensible default paths for Vamp plugin lookup (at least on Linux and
OS/X)
* A start to making the y coords for time value layers etc align
* Set sensible y coords for text labels in time instant and value layers
author | Chris Cannam |
---|---|
date | Thu, 13 Apr 2006 18:29:10 +0000 |
parents | e1aad27029e3 |
children | ea730e3f9ace |
line wrap: on
line diff
--- a/base/View.cpp Wed Apr 12 09:59:40 2006 +0000 +++ b/base/View.cpp Thu Apr 13 18:29:10 2006 +0000 @@ -152,6 +152,47 @@ return m_layers[i-1]; } +bool +View::getValueExtents(QString unit, float &min, float &max) const +{ + bool have = false; + + for (LayerList::const_iterator i = m_layers.begin(); + i != m_layers.end(); ++i) { + + QString layerUnit; + float layerMin, layerMax; + + if ((*i)->getValueExtents(layerMin, layerMax, layerUnit) && + layerUnit.toLower() == unit.toLower()) { + + if (!have || layerMin < min) min = layerMin; + if (!have || layerMax > max) max = layerMax; + have = true; + } + } + + return have; +} + +int +View::getTextLabelHeight(const Layer *layer, QPainter &paint) const +{ + int y = 15 + paint.fontMetrics().ascent(); + + for (LayerList::const_iterator i = m_layers.begin(); + i != m_layers.end(); ++i) { + + if (*i == layer) return y; + + if ((*i)->needsTextLabelHeight()) { + y += paint.fontMetrics().height(); + } + } + + return y; +} + void View::propertyContainerSelected(View *client, PropertyContainer *pc) {