comparison main/MainWindow.cpp @ 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 63a9c88fbba9
children c07759e19346
comparison
equal deleted inserted replaced
157:5f1ff90327c6 158:d8ec67a6e3c7
86 #include <QSettings> 86 #include <QSettings>
87 #include <QDateTime> 87 #include <QDateTime>
88 #include <QProcess> 88 #include <QProcess>
89 #include <QCheckBox> 89 #include <QCheckBox>
90 #include <QRegExp> 90 #include <QRegExp>
91 #include <QScrollArea>
91 92
92 #include <iostream> 93 #include <iostream>
93 #include <cstdio> 94 #include <cstdio>
94 #include <errno.h> 95 #include <errno.h>
95 96
155 connect(m_viewManager, SIGNAL(inProgressSelectionChanged()), 156 connect(m_viewManager, SIGNAL(inProgressSelectionChanged()),
156 this, SLOT(inProgressSelectionChanged())); 157 this, SLOT(inProgressSelectionChanged()));
157 158
158 m_descriptionLabel = new QLabel; 159 m_descriptionLabel = new QLabel;
159 160
160 m_paneStack = new PaneStack(frame, m_viewManager); 161 QScrollArea *scroll = new QScrollArea(frame);
162 scroll->setWidgetResizable(true);
163 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
164
165 QFrame *subframe = new QFrame;
166 scroll->setWidget(subframe);
167
168 m_paneStack = new PaneStack(subframe, m_viewManager);
161 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), 169 connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)),
162 this, SLOT(currentPaneChanged(Pane *))); 170 this, SLOT(currentPaneChanged(Pane *)));
163 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), 171 connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)),
164 this, SLOT(currentLayerChanged(Pane *, Layer *))); 172 this, SLOT(currentLayerChanged(Pane *, Layer *)));
165 connect(m_paneStack, SIGNAL(rightButtonMenuRequested(Pane *, QPoint)), 173 connect(m_paneStack, SIGNAL(rightButtonMenuRequested(Pane *, QPoint)),
3214 if (!model) return; 3222 if (!model) return;
3215 3223
3216 size_t start = model->getStartFrame(); 3224 size_t start = model->getStartFrame();
3217 size_t end = model->getEndFrame(); 3225 size_t end = model->getEndFrame();
3218 size_t pixels = currentPane->width(); 3226 size_t pixels = currentPane->width();
3227 std::cerr << "pixels " << pixels << " -> ";
3228 size_t sw = currentPane->getVerticalScaleWidth();
3229 if (pixels > sw * 2) pixels -= sw * 2;
3230 else pixels = 1;
3231 std::cerr << pixels << " (sw = " << sw << ")";
3219 size_t zoomLevel = (end - start) / pixels; 3232 size_t zoomLevel = (end - start) / pixels;
3220 3233
3221 currentPane->setZoomLevel(zoomLevel); 3234 currentPane->setZoomLevel(zoomLevel);
3222 currentPane->setStartFrame(start); 3235 currentPane->setStartFrame(start);
3223 } 3236 }