comparison view/View.cpp @ 333:e74b56f07c73

* 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 b6df8b44b98d
children 4a542ba875c2
comparison
equal deleted inserted replaced
331:d2d2521a6c7e 333:e74b56f07c73
324 update(); 324 update();
325 325
326 changeVisible = true; 326 changeVisible = true;
327 } 327 }
328 328
329 if (e) emit centreFrameChanged(alignFromReference(f), 329 if (e) {
330 m_followPan, m_followPlay); 330 size_t rf = alignToReference(f);
331 std::cerr << "View[" << this << "]::setCentreFrame(" << f
332 << "): emitting centreFrameChanged("
333 << rf << ")" << std::endl;
334 emit centreFrameChanged(rf, m_followPan, m_followPlay);
335 }
331 } 336 }
332 337
333 return changeVisible; 338 return changeVisible;
334 } 339 }
335 340
867 Layer *layer = dynamic_cast<Layer *>(sender()); 872 Layer *layer = dynamic_cast<Layer *>(sender());
868 if (layer) emit propertyContainerNameChanged(layer); 873 if (layer) emit propertyContainerNameChanged(layer);
869 } 874 }
870 875
871 void 876 void
872 View::globalCentreFrameChanged(unsigned long f) 877 View::globalCentreFrameChanged(unsigned long rf)
873 { 878 {
874 if (m_followPan) { 879 if (m_followPan) {
875 setCentreFrame(alignToReference(f), false); 880 size_t f = alignFromReference(rf);
881 std::cerr << "View[" << this << "]::globalCentreFrameChanged(" << rf
882 << "): setting centre frame to " << f << std::endl;
883 setCentreFrame(f, false);
876 } 884 }
877 } 885 }
878 886
879 void 887 void
880 View::viewCentreFrameChanged(View *, unsigned long ) 888 View::viewCentreFrameChanged(View *, unsigned long )
1148 int pf = m_manager->getPlaybackFrame(); 1156 int pf = m_manager->getPlaybackFrame();
1149 if (!m_manager->getAlignMode()) return pf; 1157 if (!m_manager->getAlignMode()) return pf;
1150 1158
1151 Model *aligningModel = getAligningModel(); 1159 Model *aligningModel = getAligningModel();
1152 if (!aligningModel) return pf; 1160 if (!aligningModel) return pf;
1153 1161 /*
1154 Model *pm = m_manager->getPlaybackModel(); 1162 Model *pm = m_manager->getPlaybackModel();
1155 1163
1156 // std::cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf; 1164 // std::cerr << "View[" << this << "]::getAlignedPlaybackFrame: pf = " << pf;
1157 1165
1158 if (pm) { 1166 if (pm) {
1159 pf = pm->alignFromReference(pf); 1167 pf = pm->alignToReference(pf);
1160 // std::cerr << " -> " << pf; 1168 // std::cerr << " -> " << pf;
1161 } 1169 }
1162 1170 */
1163 int af = aligningModel->alignToReference(pf); 1171 int af = aligningModel->alignFromReference(pf);
1164 1172
1165 // std::cerr << ", aligned = " << af << std::endl; 1173 // std::cerr << ", aligned = " << af << std::endl;
1166 return af; 1174 return af;
1167 } 1175 }
1168 1176
1712 const QFontMetrics &metrics = paint.fontMetrics(); 1720 const QFontMetrics &metrics = paint.fontMetrics();
1713 1721
1714 for (MultiSelection::SelectionList::iterator i = selections.begin(); 1722 for (MultiSelection::SelectionList::iterator i = selections.begin();
1715 i != selections.end(); ++i) { 1723 i != selections.end(); ++i) {
1716 1724
1717 int p0 = getXForFrame(i->getStartFrame()); 1725 int p0 = getXForFrame(alignFromReference(i->getStartFrame()));
1718 int p1 = getXForFrame(i->getEndFrame()); 1726 int p1 = getXForFrame(alignFromReference(i->getEndFrame()));
1719 1727
1720 if (p1 < 0 || p0 > width()) continue; 1728 if (p1 < 0 || p0 > width()) continue;
1721 1729
1722 #ifdef DEBUG_VIEW_WIDGET_PAINT 1730 #ifdef DEBUG_VIEW_WIDGET_PAINT
1723 std::cerr << "View::drawSelections: " << p0 << ",-1 [" << (p1-p0) << "x" << (height()+1) << "]" << std::endl; 1731 std::cerr << "View::drawSelections: " << p0 << ",-1 [" << (p1-p0) << "x" << (height()+1) << "]" << std::endl;