changeset 158:d8ec67a6e3c7

* attempt to ensure zoom-to-fit actually makes things fit (not obscured by the scale) -- not working * attempt to add vertical scrollbar optionally in main window -- not working -- no time to fix now
author Chris Cannam
date Mon, 02 Jul 2007 14:58:34 +0000
parents 5f1ff90327c6
children c07759e19346
files main/MainWindow.cpp
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Mon Jul 02 13:53:38 2007 +0000
+++ b/main/MainWindow.cpp	Mon Jul 02 14:58:34 2007 +0000
@@ -88,6 +88,7 @@
 #include <QProcess>
 #include <QCheckBox>
 #include <QRegExp>
+#include <QScrollArea>
 
 #include <iostream>
 #include <cstdio>
@@ -157,7 +158,14 @@
 
     m_descriptionLabel = new QLabel;
 
-    m_paneStack = new PaneStack(frame, m_viewManager);
+    QScrollArea *scroll = new QScrollArea(frame);
+    scroll->setWidgetResizable(true);
+    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
+    QFrame *subframe = new QFrame;
+    scroll->setWidget(subframe);
+
+    m_paneStack = new PaneStack(subframe, m_viewManager);
     connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)),
 	    this, SLOT(currentPaneChanged(Pane *)));
     connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)),
@@ -3216,6 +3224,11 @@
     size_t start = model->getStartFrame();
     size_t end = model->getEndFrame();
     size_t pixels = currentPane->width();
+    std::cerr << "pixels " << pixels << " -> ";
+    size_t sw = currentPane->getVerticalScaleWidth();
+    if (pixels > sw * 2) pixels -= sw * 2;
+    else pixels = 1;
+    std::cerr << pixels << " (sw = " << sw << ")";
     size_t zoomLevel = (end - start) / pixels;
 
     currentPane->setZoomLevel(zoomLevel);