Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 60:7b71da2d0631
* Some work on correct alignment when moving panes during playback
* Overhaul alignment for playback frame values (view manager now always
refers to reference-timeline values, only the play source deals in
playback model timeline values)
* When making a selection, ensure the selection regions shown in other
panes (and used for playback constraints if appropriate) are aligned
correctly. This may be the coolest feature ever implemented in any
program ever.
author | Chris Cannam |
---|---|
date | Thu, 22 Nov 2007 14:17:19 +0000 |
parents | eb596ef12041 |
children | 716e9d2f91c7 |
comparison
equal
deleted
inserted
replaced
59:bf1a53489ccc | 60:7b71da2d0631 |
---|---|
420 if (m_viewManager) m_viewManager->setPlaybackModel(0); | 420 if (m_viewManager) m_viewManager->setPlaybackModel(0); |
421 return; | 421 return; |
422 } | 422 } |
423 | 423 |
424 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); | 424 Model *prevPlaybackModel = m_viewManager->getPlaybackModel(); |
425 int frame = m_playSource->getCurrentPlayingFrame(); | |
426 | |
427 std::cerr << "playing frame (in ref model) = " << frame << std::endl; | |
425 | 428 |
426 View::ModelSet soloModels = p->getModels(); | 429 View::ModelSet soloModels = p->getModels(); |
427 | 430 |
428 View::ModelSet sources; | 431 View::ModelSet sources; |
429 for (View::ModelSet::iterator mi = soloModels.begin(); | 432 for (View::ModelSet::iterator mi = soloModels.begin(); |
435 for (View::ModelSet::iterator mi = sources.begin(); | 438 for (View::ModelSet::iterator mi = sources.begin(); |
436 mi != sources.end(); ++mi) { | 439 mi != sources.end(); ++mi) { |
437 soloModels.insert(*mi); | 440 soloModels.insert(*mi); |
438 } | 441 } |
439 | 442 |
443 //!!! Need an "atomic" way of telling the play source that the | |
444 //playback model has changed, and changing it on ViewManager -- | |
445 //the play source should be making the setPlaybackModel call to | |
446 //ViewManager | |
447 | |
440 for (View::ModelSet::iterator mi = soloModels.begin(); | 448 for (View::ModelSet::iterator mi = soloModels.begin(); |
441 mi != soloModels.end(); ++mi) { | 449 mi != soloModels.end(); ++mi) { |
442 if (dynamic_cast<RangeSummarisableTimeValueModel *>(*mi)) { | 450 if (dynamic_cast<RangeSummarisableTimeValueModel *>(*mi)) { |
443 m_viewManager->setPlaybackModel(*mi); | 451 m_viewManager->setPlaybackModel(*mi); |
444 } | 452 } |
451 getPlaybackModel()); | 459 getPlaybackModel()); |
452 | 460 |
453 m_playSource->setSoloModelSet(soloModels); | 461 m_playSource->setSoloModelSet(soloModels); |
454 | 462 |
455 if (a && b && (a != b)) { | 463 if (a && b && (a != b)) { |
456 int frame = m_playSource->getCurrentPlayingFrame(); | 464 /*!!! |
457 //!!! I don't really believe that these functions are the right way around | 465 int rframe = a->alignToReference(frame); |
458 int rframe = a->alignFromReference(frame); | 466 int bframe = b->alignFromReference(rframe); |
459 int bframe = b->alignToReference(rframe); | |
460 if (m_playSource->isPlaying()) m_playSource->play(bframe); | 467 if (m_playSource->isPlaying()) m_playSource->play(bframe); |
468 */ | |
469 if (m_playSource->isPlaying()) m_playSource->play(frame); | |
461 } | 470 } |
462 } | 471 } |
463 | 472 |
464 void | 473 void |
465 MainWindowBase::currentLayerChanged(Pane *p, Layer *) | 474 MainWindowBase::currentLayerChanged(Pane *p, Layer *) |
1373 Model *model = getMainModel(); | 1382 Model *model = getMainModel(); |
1374 if (!model) return; | 1383 if (!model) return; |
1375 | 1384 |
1376 size_t start = model->getStartFrame(); | 1385 size_t start = model->getStartFrame(); |
1377 size_t end = model->getEndFrame(); | 1386 size_t end = model->getEndFrame(); |
1387 if (m_playSource) end = std::max(end, m_playSource->getPlayEndFrame()); | |
1378 size_t pixels = currentPane->width(); | 1388 size_t pixels = currentPane->width(); |
1379 | 1389 |
1380 size_t sw = currentPane->getVerticalScaleWidth(); | 1390 size_t sw = currentPane->getVerticalScaleWidth(); |
1381 if (pixels > sw * 2) pixels -= sw * 2; | 1391 if (pixels > sw * 2) pixels -= sw * 2; |
1382 else pixels = 1; | 1392 else pixels = 1; |