# HG changeset patch # User Chris Cannam # Date 1183388314 0 # Node ID d8ec67a6e3c77eb3742ac0a8ff1e8106d085e359 # Parent 5f1ff90327c67b44a77c47535cccd499a74eea0c * 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 diff -r 5f1ff90327c6 -r d8ec67a6e3c7 main/MainWindow.cpp --- 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 #include #include +#include #include #include @@ -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);