# HG changeset patch # User Chris Cannam # Date 1236098787 0 # Node ID e4e0ae491a485006e9e0cb9d67c53d4cb8406814 # Parent ff1dc4f302bd8b8b5ad01931e225bc3b70232543 * Attempt to pick more sensible default centre frame for newly created view diff -r ff1dc4f302bd -r e4e0ae491a48 view/PaneStack.cpp --- a/view/PaneStack.cpp Fri Feb 27 14:24:54 2009 +0000 +++ b/view/PaneStack.cpp Tue Mar 03 16:46:27 2009 +0000 @@ -82,8 +82,19 @@ currentIndicator->setMinimumWidth(8); currentIndicator->setScaledContents(true); + long initialCentreFrame = -1; + for (int i = 0; i < m_panes.size(); ++i) { + long f = m_panes[i].pane->getCentreFrame(); + initialCentreFrame = f; + break; + } + Pane *pane = new Pane(frame); - pane->setViewManager(m_viewManager); + if (initialCentreFrame >= 0) { + pane->setViewManager(m_viewManager, initialCentreFrame); + } else { + pane->setViewManager(m_viewManager); + } layout->addWidget(pane, 0, 1, 2, 1); layout->setColumnStretch(1, 20); diff -r ff1dc4f302bd -r e4e0ae491a48 view/View.cpp --- a/view/View.cpp Fri Feb 27 14:24:54 2009 +0000 +++ b/view/View.cpp Tue Mar 03 16:46:27 2009 +0000 @@ -676,16 +676,19 @@ connect(this, SIGNAL(zoomLevelChanged(unsigned long, bool)), m_manager, SLOT(viewZoomLevelChanged(unsigned long, bool))); +// setCentreFrame(m_manager->getViewInitialCentreFrame()); + if (m_followPlay == PlaybackScrollPage) { - std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; +// std::cerr << "View::setViewManager: setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; setCentreFrame(m_manager->getGlobalCentreFrame(), false); } else if (m_followPlay == PlaybackScrollContinuous) { - std::cerr << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << std::endl; +// std::cerr << "View::setViewManager: setting centre frame to playback frame: " << m_manager->getPlaybackFrame() << std::endl; setCentreFrame(m_manager->getPlaybackFrame(), false); } else if (m_followPan) { - std::cerr << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; +// std::cerr << "View::setViewManager: (follow pan) setting centre frame to global centre frame: " << m_manager->getGlobalCentreFrame() << std::endl; setCentreFrame(m_manager->getGlobalCentreFrame(), false); } + if (m_followZoom) setZoomLevel(m_manager->getGlobalZoom()); movePlayPointer(getAlignedPlaybackFrame()); @@ -694,6 +697,13 @@ } void +View::setViewManager(ViewManager *vm, long initialCentreFrame) +{ + setViewManager(vm); + setCentreFrame(initialCentreFrame, false); +} + +void View::setFollowGlobalPan(bool f) { m_followPan = f; diff -r ff1dc4f302bd -r e4e0ae491a48 view/View.h --- a/view/View.h Fri Feb 27 14:24:54 2009 +0000 +++ b/view/View.h Tue Mar 03 16:46:27 2009 +0000 @@ -175,6 +175,7 @@ virtual const Layer *getSelectedLayer() const; virtual void setViewManager(ViewManager *m); + virtual void setViewManager(ViewManager *m, long initialFrame); virtual ViewManager *getViewManager() const { return m_manager; } virtual void setFollowGlobalPan(bool f);