Mercurial > hg > svgui
comparison layer/TimeInstantLayer.cpp @ 13:01849cd277e6
* Hook up tool selection buttons to switch the cursor mode
* Implement simple and multi-selection, snapping to the resolution
of the current layer. You can't actually do anything with a selection yet
author | Chris Cannam |
---|---|
date | Mon, 23 Jan 2006 17:02:57 +0000 |
parents | 2d5005f2b3d9 |
children | 02a718909b2d |
comparison
equal
deleted
inserted
replaced
12:484e7320f59f | 13:01849cd277e6 |
---|---|
222 paint.drawText(xbase + 5, ybase + 5 + metrics.ascent(), timeText); | 222 paint.drawText(xbase + 5, ybase + 5 + metrics.ascent(), timeText); |
223 paint.drawText(xbase + 5, ybase + 7 + metrics.ascent() + metrics.height(), | 223 paint.drawText(xbase + 5, ybase + 7 + metrics.ascent() + metrics.height(), |
224 points.begin()->label); | 224 points.begin()->label); |
225 } | 225 } |
226 | 226 |
227 int | |
228 TimeInstantLayer::getNearestFeatureFrame(int frame, | |
229 size_t &resolution, | |
230 bool snapRight) const | |
231 { | |
232 if (!m_model) { | |
233 return Layer::getNearestFeatureFrame(frame, resolution, snapRight); | |
234 } | |
235 | |
236 resolution = m_model->getResolution(); | |
237 SparseOneDimensionalModel::PointList points(m_model->getPoints(frame, frame)); | |
238 | |
239 int returnFrame = frame; | |
240 | |
241 for (SparseOneDimensionalModel::PointList::const_iterator i = points.begin(); | |
242 i != points.end(); ++i) { | |
243 | |
244 if (snapRight) { | |
245 if (i->frame > frame) { | |
246 returnFrame = i->frame; | |
247 break; | |
248 } | |
249 } else { | |
250 if (i->frame <= frame) { | |
251 returnFrame = i->frame; | |
252 } | |
253 } | |
254 } | |
255 | |
256 return returnFrame; | |
257 } | |
258 | |
227 void | 259 void |
228 TimeInstantLayer::paint(QPainter &paint, QRect rect) const | 260 TimeInstantLayer::paint(QPainter &paint, QRect rect) const |
229 { | 261 { |
230 if (!m_model || !m_model->isOK()) return; | 262 if (!m_model || !m_model->isOK()) return; |
231 | 263 |