# HG changeset patch # User Chris Cannam # Date 1183402652 0 # Node ID c07759e193466249dc6be92ee3f4becc2a8177ff # Parent d8ec67a6e3c77eb3742ac0a8ff1e8106d085e359 * Fix Zoom to Fit and the scroll area (though I'd prefer scrollbar on the left) diff -r d8ec67a6e3c7 -r c07759e19346 main/MainWindow.cpp --- a/main/MainWindow.cpp Mon Jul 02 14:58:34 2007 +0000 +++ b/main/MainWindow.cpp Mon Jul 02 18:57:32 2007 +0000 @@ -161,11 +161,16 @@ 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); + scroll->setFrameShape(QFrame::NoFrame); + +// QFrame *subframe = new QFrame; +// scroll->setWidget(subframe); + +// QGridLayout *sublayout = new QGridLayout; +// subframe->setLayout(sublayout); + +// m_paneStack = new PaneStack(subframe, m_viewManager); + m_paneStack = new PaneStack(scroll, m_viewManager); connect(m_paneStack, SIGNAL(currentPaneChanged(Pane *)), this, SLOT(currentPaneChanged(Pane *))); connect(m_paneStack, SIGNAL(currentLayerChanged(Pane *, Layer *)), @@ -177,6 +182,9 @@ connect(m_paneStack, SIGNAL(contextHelpChanged(const QString &)), this, SLOT(contextHelpChanged(const QString &))); +// sublayout->addWidget(m_paneStack, 0, 0); + scroll->setWidget(m_paneStack); + m_overview = new Overview(frame); m_overview->setViewManager(m_viewManager); m_overview->setFixedHeight(40); @@ -256,7 +264,7 @@ settings.endGroup(); layout->setSpacing(4); - layout->addWidget(m_paneStack, 0, 0, 1, 5); + layout->addWidget(scroll, 0, 0, 1, 5); layout->addWidget(m_overview, 1, 0); layout->addWidget(m_fader, 1, 1); layout->addWidget(m_playSpeed, 1, 2); @@ -3224,15 +3232,16 @@ 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 << ")"; + if (pixels > 4) pixels -= 4; + size_t zoomLevel = (end - start) / pixels; currentPane->setZoomLevel(zoomLevel); - currentPane->setStartFrame(start); + currentPane->setCentreFrame((start + end) / 2); } void