Mercurial > hg > svgui
comparison layer/TimeRulerLayer.cpp @ 272:87e4c880b4c8
* highlight the nearest measurement rect
* fix rewind during playback
author | Chris Cannam |
---|---|
date | Fri, 29 Jun 2007 13:58:08 +0000 |
parents | 1a49bd0d8375 |
children | cd2492c5fe45 |
comparison
equal
deleted
inserted
replaced
271:1a49bd0d8375 | 272:87e4c880b4c8 |
---|---|
149 int rate = m_model->getSampleRate(); | 149 int rate = m_model->getSampleRate(); |
150 | 150 |
151 RealTime rt = RealTime::frame2RealTime(frame, rate); | 151 RealTime rt = RealTime::frame2RealTime(frame, rate); |
152 double ratio = rt / rtick; | 152 double ratio = rt / rtick; |
153 | 153 |
154 int rounded = lrint(ratio); | 154 int rounded = int(ratio); |
155 RealTime rdrt = rtick * rounded; | 155 RealTime rdrt = rtick * rounded; |
156 | 156 |
157 int left = RealTime::realTime2Frame(rdrt, rate); | 157 int left = RealTime::realTime2Frame(rdrt, rate); |
158 resolution = RealTime::realTime2Frame(rtick, rate); | 158 resolution = RealTime::realTime2Frame(rtick, rate); |
159 int right = left + resolution; | 159 int right = left + resolution; |
160 | |
161 // std::cerr << "TimeRulerLayer::snapToFeatureFrame: type " | |
162 // << int(snap) << ", frame " << frame << " (time " | |
163 // << rt << ", tick " << rtick << ", rounded " << rdrt << ") "; | |
160 | 164 |
161 switch (snap) { | 165 switch (snap) { |
162 | 166 |
163 case SnapLeft: | 167 case SnapLeft: |
164 frame = left; | 168 frame = left; |
215 } | 219 } |
216 } | 220 } |
217 } | 221 } |
218 } | 222 } |
219 | 223 |
224 // std::cerr << " -> " << frame << " (resolution = " << resolution << ")" << std::endl; | |
225 | |
220 return true; | 226 return true; |
221 } | 227 } |
222 | 228 |
223 int | 229 int |
224 TimeRulerLayer::getMajorTickSpacing(View *v, bool &quarterTicks) const | 230 TimeRulerLayer::getMajorTickSpacing(View *v, bool &quarterTicks) const |