Mercurial > hg > svgui
comparison layer/TimeRulerLayer.cpp @ 918:4fe7a09be0fe osx-retina
Many fixes for the previous stuff
author | Chris Cannam |
---|---|
date | Tue, 17 Mar 2015 16:56:03 +0000 |
parents | 94e4952a6774 |
children | a5488775f880 |
comparison
equal
deleted
inserted
replaced
917:77a1d42353ce | 918:4fe7a09be0fe |
---|---|
47 m_model = model; | 47 m_model = model; |
48 emit modelReplaced(); | 48 emit modelReplaced(); |
49 } | 49 } |
50 | 50 |
51 bool | 51 bool |
52 TimeRulerLayer::snapToFeatureFrame(View *v, sv_frame_t &frame, | 52 TimeRulerLayer::snapToFeatureFrame(LayerGeometryProvider *v, sv_frame_t &frame, |
53 int &resolution, SnapType snap) const | 53 int &resolution, SnapType snap) const |
54 { | 54 { |
55 if (!m_model) { | 55 if (!m_model) { |
56 resolution = 1; | 56 resolution = 1; |
57 return false; | 57 return false; |
139 | 139 |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 int | 143 int |
144 TimeRulerLayer::getMajorTickSpacing(View *v, bool &quarterTicks) const | 144 TimeRulerLayer::getMajorTickSpacing(LayerGeometryProvider *v, bool &quarterTicks) const |
145 { | 145 { |
146 // return value is in milliseconds | 146 // return value is in milliseconds |
147 | 147 |
148 if (!m_model || !v) return 1000; | 148 if (!m_model || !v) return 1000; |
149 | 149 |
156 int minPixelSpacing = 50; | 156 int minPixelSpacing = 50; |
157 | 157 |
158 RealTime rtStart = RealTime::frame2RealTime(startFrame, sampleRate); | 158 RealTime rtStart = RealTime::frame2RealTime(startFrame, sampleRate); |
159 RealTime rtEnd = RealTime::frame2RealTime(endFrame, sampleRate); | 159 RealTime rtEnd = RealTime::frame2RealTime(endFrame, sampleRate); |
160 | 160 |
161 int count = v->width() / minPixelSpacing; | 161 int count = v->getPaintWidth() / minPixelSpacing; |
162 if (count < 1) count = 1; | 162 if (count < 1) count = 1; |
163 RealTime rtGap = (rtEnd - rtStart) / count; | 163 RealTime rtGap = (rtEnd - rtStart) / count; |
164 | 164 |
165 int incms; | 165 int incms; |
166 quarterTicks = false; | 166 quarterTicks = false; |
285 cerr << "hm, maybe X isn't in range after all (x = " << x << ", tw = " << tw << ", rect.x() = " << rect.x() << ", rect.width() = " << rect.width() << ")" << endl; | 285 cerr << "hm, maybe X isn't in range after all (x = " << x << ", tw = " << tw << ", rect.x() = " << rect.x() << ", rect.width() = " << rect.width() << ")" << endl; |
286 #endif | 286 #endif |
287 } | 287 } |
288 | 288 |
289 paint.setPen(greyColour); | 289 paint.setPen(greyColour); |
290 paint.drawLine(x, 0, x, v->height()); | 290 paint.drawLine(x, 0, x, v->getPaintHeight()); |
291 | 291 |
292 paint.setPen(getBaseQColor()); | 292 paint.setPen(getBaseQColor()); |
293 paint.drawLine(x, 0, x, 5); | 293 paint.drawLine(x, 0, x, 5); |
294 paint.drawLine(x, v->height() - 6, x, v->height() - 1); | 294 paint.drawLine(x, v->getPaintHeight() - 6, x, v->getPaintHeight() - 1); |
295 | 295 |
296 int y; | 296 int y; |
297 switch (m_labelHeight) { | 297 switch (m_labelHeight) { |
298 default: | 298 default: |
299 case LabelTop: | 299 case LabelTop: |
300 y = 6 + metrics.ascent(); | 300 y = 6 + metrics.ascent(); |
301 break; | 301 break; |
302 case LabelMiddle: | 302 case LabelMiddle: |
303 y = v->height() / 2 - metrics.height() / 2 + metrics.ascent(); | 303 y = v->getPaintHeight() / 2 - metrics.height() / 2 + metrics.ascent(); |
304 break; | 304 break; |
305 case LabelBottom: | 305 case LabelBottom: |
306 y = v->height() - metrics.height() + metrics.ascent() - 6; | 306 y = v->getPaintHeight() - metrics.height() + metrics.ascent() - 6; |
307 } | 307 } |
308 | 308 |
309 if (v->getViewManager() && v->getViewManager()->getOverlayMode() != | 309 if (v->getViewManager() && v->getViewManager()->getOverlayMode() != |
310 ViewManager::NoOverlays) { | 310 ViewManager::NoOverlays) { |
311 | 311 |
342 | 342 |
343 int sz = 5; | 343 int sz = 5; |
344 if (ticks == 10) { | 344 if (ticks == 10) { |
345 if ((i % 2) == 1) { | 345 if ((i % 2) == 1) { |
346 if (i == 5) { | 346 if (i == 5) { |
347 paint.drawLine(x, 0, x, v->height()); | 347 paint.drawLine(x, 0, x, v->getPaintHeight()); |
348 } else sz = 3; | 348 } else sz = 3; |
349 } else { | 349 } else { |
350 sz = 7; | 350 sz = 7; |
351 } | 351 } |
352 } | 352 } |
353 paint.drawLine(x, 0, x, sz); | 353 paint.drawLine(x, 0, x, sz); |
354 paint.drawLine(x, v->height() - sz - 1, x, v->height() - 1); | 354 paint.drawLine(x, v->getPaintHeight() - sz - 1, x, v->getPaintHeight() - 1); |
355 } | 355 } |
356 | 356 |
357 ms += incms; | 357 ms += incms; |
358 } | 358 } |
359 | 359 |