# HG changeset patch # User Chris Cannam # Date 1237477859 0 # Node ID 875a21ad7a95c6e8651f39c88b82f6fe703d893f # Parent 7fff1bb8cc3d55554a9d8139cd1c8169cc31a5e7 * Avoid resizing the window on file load to larger than the available screen size diff -r 7fff1bb8cc3d -r 875a21ad7a95 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Fri Mar 13 11:06:11 2009 +0000 +++ b/framework/MainWindowBase.cpp Thu Mar 19 15:50:59 2009 +0000 @@ -90,6 +90,7 @@ #include #include #include +#include #include #include @@ -239,6 +240,16 @@ } void +MainWindowBase::resizeConstrained(QSize size) +{ + QDesktopWidget *desktop = QApplication::desktop(); + QRect available = desktop->availableGeometry(); + QSize actual(std::min(size.width(), available.width()), + std::min(size.height(), available.height())); + resize(actual); +} + +void MainWindowBase::oscReady() { if (m_oscQueue && m_oscQueue->isOK()) { diff -r 7fff1bb8cc3d -r 875a21ad7a95 framework/MainWindowBase.h --- a/framework/MainWindowBase.h Fri Mar 13 11:06:11 2009 +0000 +++ b/framework/MainWindowBase.h Thu Mar 19 15:50:59 2009 +0000 @@ -151,6 +151,7 @@ public slots: virtual void preferenceChanged(PropertyContainer::PropertyName); + virtual void resizeConstrained(QSize); protected slots: virtual void zoomIn(); @@ -334,7 +335,7 @@ PaneCallback(MainWindowBase *mw) : m_mw(mw) { } virtual Pane *addPane() { return m_mw->addPaneToStack(); } virtual void setWindowSize(int width, int height) { - m_mw->resize(width, height); + m_mw->resizeConstrained(QSize(width, height)); } virtual void addSelection(int start, int end) { m_mw->m_viewManager->addSelection(Selection(start, end));