comparison 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
comparison
equal deleted inserted replaced
77:2beca8ddcdc3 78:c983dda79f72
148 PropertyContainer * 148 PropertyContainer *
149 View::getPropertyContainer(size_t i) 149 View::getPropertyContainer(size_t i)
150 { 150 {
151 if (i == 0) return m_propertyContainer; 151 if (i == 0) return m_propertyContainer;
152 return m_layers[i-1]; 152 return m_layers[i-1];
153 }
154
155 bool
156 View::getValueExtents(QString unit, float &min, float &max) const
157 {
158 bool have = false;
159
160 for (LayerList::const_iterator i = m_layers.begin();
161 i != m_layers.end(); ++i) {
162
163 QString layerUnit;
164 float layerMin, layerMax;
165
166 if ((*i)->getValueExtents(layerMin, layerMax, layerUnit) &&
167 layerUnit.toLower() == unit.toLower()) {
168
169 if (!have || layerMin < min) min = layerMin;
170 if (!have || layerMax > max) max = layerMax;
171 have = true;
172 }
173 }
174
175 return have;
176 }
177
178 int
179 View::getTextLabelHeight(const Layer *layer, QPainter &paint) const
180 {
181 int y = 15 + paint.fontMetrics().ascent();
182
183 for (LayerList::const_iterator i = m_layers.begin();
184 i != m_layers.end(); ++i) {
185
186 if (*i == layer) return y;
187
188 if ((*i)->needsTextLabelHeight()) {
189 y += paint.fontMetrics().height();
190 }
191 }
192
193 return y;
153 } 194 }
154 195
155 void 196 void
156 View::propertyContainerSelected(View *client, PropertyContainer *pc) 197 View::propertyContainerSelected(View *client, PropertyContainer *pc)
157 { 198 {