Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 147:140ea2569bcc
* Make ffwd/rewind constrained to the selection if Play Selection is on
author | Chris Cannam |
---|---|
date | Wed, 06 Jun 2007 14:42:41 +0000 |
parents | 56c00f977cac |
children | e2f13213c2f1 |
comparison
equal
deleted
inserted
replaced
146:d27f13651e67 | 147:140ea2569bcc |
---|---|
3292 | 3292 |
3293 size_t resolution = 0; | 3293 size_t resolution = 0; |
3294 if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapRight)) { | 3294 if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapRight)) { |
3295 frame = getMainModel()->getEndFrame(); | 3295 frame = getMainModel()->getEndFrame(); |
3296 } | 3296 } |
3297 | |
3298 if (m_viewManager->getPlaySelectionMode()) { | |
3299 MultiSelection::SelectionList sl = m_viewManager->getSelections(); | |
3300 if (!sl.empty()) { | |
3301 MultiSelection::SelectionList::iterator i = sl.end(); | |
3302 --i; | |
3303 size_t selectionEndFrame = i->getEndFrame(); | |
3304 if (frame > selectionEndFrame) frame = selectionEndFrame; | |
3305 } | |
3306 } | |
3297 | 3307 |
3298 m_viewManager->setPlaybackFrame(frame); | 3308 m_viewManager->setPlaybackFrame(frame); |
3299 } | 3309 } |
3300 | 3310 |
3301 void | 3311 void |
3302 MainWindow::ffwdEnd() | 3312 MainWindow::ffwdEnd() |
3303 { | 3313 { |
3304 if (!getMainModel()) return; | 3314 if (!getMainModel()) return; |
3305 m_viewManager->setPlaybackFrame(getMainModel()->getEndFrame()); | 3315 |
3316 size_t frame = getMainModel()->getEndFrame(); | |
3317 | |
3318 if (m_viewManager->getPlaySelectionMode()) { | |
3319 MultiSelection::SelectionList sl = m_viewManager->getSelections(); | |
3320 if (!sl.empty()) { | |
3321 MultiSelection::SelectionList::iterator i = sl.end(); | |
3322 --i; | |
3323 size_t selectionEndFrame = i->getEndFrame(); | |
3324 if (frame > selectionEndFrame) frame = selectionEndFrame; | |
3325 } | |
3326 } | |
3327 | |
3328 m_viewManager->setPlaybackFrame(frame); | |
3306 } | 3329 } |
3307 | 3330 |
3308 void | 3331 void |
3309 MainWindow::rewind() | 3332 MainWindow::rewind() |
3310 { | 3333 { |
3323 | 3346 |
3324 size_t resolution = 0; | 3347 size_t resolution = 0; |
3325 if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapLeft)) { | 3348 if (!layer->snapToFeatureFrame(pane, frame, resolution, Layer::SnapLeft)) { |
3326 frame = getMainModel()->getEndFrame(); | 3349 frame = getMainModel()->getEndFrame(); |
3327 } | 3350 } |
3328 | 3351 |
3352 if (m_viewManager->getPlaySelectionMode()) { | |
3353 MultiSelection::SelectionList sl = m_viewManager->getSelections(); | |
3354 if (!sl.empty()) { | |
3355 size_t selectionStartFrame = sl.begin()->getStartFrame(); | |
3356 if (frame < selectionStartFrame) frame = selectionStartFrame; | |
3357 } | |
3358 } | |
3359 | |
3329 m_viewManager->setPlaybackFrame(frame); | 3360 m_viewManager->setPlaybackFrame(frame); |
3330 } | 3361 } |
3331 | 3362 |
3332 void | 3363 void |
3333 MainWindow::rewindStart() | 3364 MainWindow::rewindStart() |
3334 { | 3365 { |
3335 if (!getMainModel()) return; | 3366 if (!getMainModel()) return; |
3336 m_viewManager->setPlaybackFrame(getMainModel()->getStartFrame()); | 3367 |
3368 size_t frame = getMainModel()->getStartFrame(); | |
3369 | |
3370 if (m_viewManager->getPlaySelectionMode()) { | |
3371 MultiSelection::SelectionList sl = m_viewManager->getSelections(); | |
3372 if (!sl.empty()) { | |
3373 size_t selectionStartFrame = sl.begin()->getStartFrame(); | |
3374 if (frame < selectionStartFrame) frame = selectionStartFrame; | |
3375 } | |
3376 } | |
3377 | |
3378 m_viewManager->setPlaybackFrame(frame); | |
3337 } | 3379 } |
3338 | 3380 |
3339 void | 3381 void |
3340 MainWindow::stop() | 3382 MainWindow::stop() |
3341 { | 3383 { |