Mercurial > hg > sonic-visualiser
changeset 159:c07759e19346
* Fix Zoom to Fit and the scroll area (though I'd prefer scrollbar on the left)
author | Chris Cannam |
---|---|
date | Mon, 02 Jul 2007 18:57:32 +0000 (2007-07-02) |
parents | d8ec67a6e3c7 |
children | 10700f059548 |
files | main/MainWindow.cpp |
diffstat | 1 files changed, 18 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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