diff view/PaneStack.cpp @ 516:e4e0ae491a48

* Attempt to pick more sensible default centre frame for newly created view
author Chris Cannam
date Tue, 03 Mar 2009 16:46:27 +0000
parents 666cdcae5f0d
children 566787389e59
line wrap: on
line diff
--- 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);