comparison view/View.cpp @ 815:09026c875301

Create separate play scroll modes for (Tony-style, DAW-style) page mode and (SV-style) paging with playhead alignment to centre on drag
author Chris Cannam
date Wed, 02 Jul 2014 17:30:09 +0100
parents 40c6c9344ff6
children 8bb9320f78a4
comparison
equal deleted inserted replaced
814:db31266cf606 815:09026c875301
53 QFrame(w), 53 QFrame(w),
54 m_centreFrame(0), 54 m_centreFrame(0),
55 m_zoomLevel(1024), 55 m_zoomLevel(1024),
56 m_followPan(true), 56 m_followPan(true),
57 m_followZoom(true), 57 m_followZoom(true),
58 m_followPlay(PlaybackScrollPage), 58 m_followPlay(PlaybackScrollPageWithCentre),
59 m_followPlayIsDetached(false), 59 m_followPlayIsDetached(false),
60 m_playPointerFrame(0), 60 m_playPointerFrame(0),
61 m_showProgress(showProgress), 61 m_showProgress(showProgress),
62 m_cache(0), 62 m_cache(0),
63 m_cacheCentreFrame(0), 63 m_cacheCentreFrame(0),
115 if (name == "Global Scroll") return m_followPan; 115 if (name == "Global Scroll") return m_followPan;
116 if (name == "Global Zoom") return m_followZoom; 116 if (name == "Global Zoom") return m_followZoom;
117 if (name == "Follow Playback") { 117 if (name == "Follow Playback") {
118 if (min) *min = 0; 118 if (min) *min = 0;
119 if (max) *max = 2; 119 if (max) *max = 2;
120 if (deflt) *deflt = int(PlaybackScrollPage); 120 if (deflt) *deflt = int(PlaybackScrollPageWithCentre);
121 return int(m_followPlay); 121 switch (m_followPlay) {
122 case PlaybackScrollContinuous: return 0;
123 case PlaybackScrollPageWithCentre: case PlaybackScrollPage: return 1;
124 case PlaybackIgnore: return 2;
125 }
122 } 126 }
123 if (min) *min = 0; 127 if (min) *min = 0;
124 if (max) *max = 0; 128 if (max) *max = 0;
125 if (deflt) *deflt = 0; 129 if (deflt) *deflt = 0;
126 return 0; 130 return 0;
150 setFollowGlobalZoom(value != 0); 154 setFollowGlobalZoom(value != 0);
151 } else if (name == "Follow Playback") { 155 } else if (name == "Follow Playback") {
152 switch (value) { 156 switch (value) {
153 default: 157 default:
154 case 0: setPlaybackFollow(PlaybackScrollContinuous); break; 158 case 0: setPlaybackFollow(PlaybackScrollContinuous); break;
155 case 1: setPlaybackFollow(PlaybackScrollPage); break; 159 case 1: setPlaybackFollow(PlaybackScrollPageWithCentre); break;
156 case 2: setPlaybackFollow(PlaybackIgnore); break; 160 case 2: setPlaybackFollow(PlaybackIgnore); break;
157 } 161 }
158 } 162 }
159 } 163 }
160 164
702 PlaybackFollowMode))); 706 PlaybackFollowMode)));
703 707
704 connect(this, SIGNAL(zoomLevelChanged(int, bool)), 708 connect(this, SIGNAL(zoomLevelChanged(int, bool)),
705 m_manager, SLOT(viewZoomLevelChanged(int, bool))); 709 m_manager, SLOT(viewZoomLevelChanged(int, bool)));
706 710
707 // setCentreFrame(m_manager->getViewInitialCentreFrame()); 711 switch (m_followPlay) {
708 712
709 if (m_followPlay == PlaybackScrollPage) { 713 case PlaybackScrollPage:
710 // SVDEBUG << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << endl; 714 case PlaybackScrollPageWithCentre:
711 setCentreFrame(m_manager->getGlobalCentreFrame(), false); 715 setCentreFrame(m_manager->getGlobalCentreFrame(), false);
712 } else if (m_followPlay == PlaybackScrollContinuous) { 716 break;
713 // SVDEBUG << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << endl; 717
718 case PlaybackScrollContinuous:
714 setCentreFrame(m_manager->getPlaybackFrame(), false); 719 setCentreFrame(m_manager->getPlaybackFrame(), false);
715 } else if (m_followPan) { 720 break;
716 // SVDEBUG << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << endl; 721
717 setCentreFrame(m_manager->getGlobalCentreFrame(), false); 722 case PlaybackIgnore:
723 if (m_followPan) {
724 setCentreFrame(m_manager->getGlobalCentreFrame(), false);
725 }
726 break;
718 } 727 }
719 728
720 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom()); 729 if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom());
721 730
722 movePlayPointer(getAlignedPlaybackFrame()); 731 movePlayPointer(getAlignedPlaybackFrame());
1014 setCentreFrame(m_playPointerFrame, false); 1023 setCentreFrame(m_playPointerFrame, false);
1015 } 1024 }
1016 break; 1025 break;
1017 1026
1018 case PlaybackScrollPage: 1027 case PlaybackScrollPage:
1028 case PlaybackScrollPageWithCentre:
1019 1029
1020 if (!pointerInVisibleArea && somethingGoingOn) { 1030 if (!pointerInVisibleArea && somethingGoingOn) {
1021 1031
1022 m_followPlayIsDetached = true; 1032 m_followPlayIsDetached = true;
1023 1033
2457 .arg(m_centreFrame) 2467 .arg(m_centreFrame)
2458 .arg(m_zoomLevel) 2468 .arg(m_zoomLevel)
2459 .arg(m_followPan) 2469 .arg(m_followPan)
2460 .arg(m_followZoom) 2470 .arg(m_followZoom)
2461 .arg(m_followPlay == PlaybackScrollContinuous ? "scroll" : 2471 .arg(m_followPlay == PlaybackScrollContinuous ? "scroll" :
2462 m_followPlay == PlaybackScrollPage ? "page" : "ignore") 2472 m_followPlay == PlaybackScrollPageWithCentre ? "page" :
2473 m_followPlay == PlaybackScrollPage ? "daw" :
2474 "ignore")
2463 .arg(extraAttributes); 2475 .arg(extraAttributes);
2464 2476
2465 for (int i = 0; i < (int)m_layers.size(); ++i) { 2477 for (int i = 0; i < (int)m_layers.size(); ++i) {
2466 bool visible = !m_layers[i]->isLayerDormant(this); 2478 bool visible = !m_layers[i]->isLayerDormant(this);
2467 m_layers[i]->toBriefXml(stream, indent + " ", 2479 m_layers[i]->toBriefXml(stream, indent + " ",