summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-01-14 10:29:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-01-14 16:04:17 +0000
commitd652af7d071bb5e5c3f7592d6dc7e7c400e711d3 (patch)
treeb30375691fdfc2bd8171c7666eeb87cceae15b10 /vcl
parent02d4f6a2494621a17bb59d743ed499cce555839a (diff)
merge the 'holy default' default window sizes to a single place
Change-Id: I247a52cf547da268e5aa6f7c9fef000c598b661b
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/vcl/layout.hxx2
-rw-r--r--vcl/source/window/dialog.cxx26
-rw-r--r--vcl/unx/generic/window/salframe.cxx18
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx22
4 files changed, 33 insertions, 35 deletions
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 5173687c603e..7c71d9ccb928 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -625,6 +625,8 @@ public:
bool set_property(const OString &rKey, const OString &rValue);
};
+VCL_DLLPUBLIC Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize);
+
// retro-fitting utilities //
//Get a Size which is large enough to contain all children with
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index ce98b75b502e..53eafdf6f782 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -637,6 +637,29 @@ long Dialog::Notify( NotifyEvent& rNEvt )
return nRet;
}
+Size bestmaxFrameSizeForScreenSize(const Size &rScreenSize)
+{
+ long w = rScreenSize.Width();
+ long h = rScreenSize.Height();
+
+ // fill in holy default values brought to us by product management
+ if (rScreenSize.Width() >= 800)
+ w = 785;
+ if (rScreenSize.Width() >= 1024)
+ w = 920;
+ if (rScreenSize.Width() >= 1280)
+ w = 1050;
+
+ if (rScreenSize.Height() >= 600)
+ h = 550;
+ if (rScreenSize.Height() >= 768)
+ h = 630;
+ if (rScreenSize.Height() >= 1024)
+ h = 875;
+
+ return Size(w, h);
+}
+
void Dialog::setInitialLayoutSize()
{
maLayoutTimer.Stop();
@@ -658,7 +681,8 @@ void Dialog::setInitialLayoutSize()
Size aSize = get_preferred_size();
- Size aMax = GetOptimalSize(WINDOWSIZE_MAXIMUM);
+ Size aMax(bestmaxFrameSizeForScreenSize(GetDesktopRectPixel().GetSize()));
+
aSize.Width() = std::min(aMax.Width(), aSize.Width());
aSize.Height() = std::min(aMax.Height(), aSize.Height());
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index 67ce56e08992..a30c32f145b6 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -31,6 +31,7 @@
#include "vcl/floatwin.hxx"
#include "vcl/svapp.hxx"
#include "vcl/keycodes.hxx"
+#include "vcl/layout.hxx"
#include "vcl/printerinfomanager.hxx"
#include "vcl/settings.hxx"
@@ -331,20 +332,9 @@ void X11SalFrame::Init( sal_uLong nSalFrameStyle, SalX11Screen nXScreen, SystemP
if( nSalFrameStyle & SAL_FRAME_STYLE_SIZEABLE &&
nSalFrameStyle & SAL_FRAME_STYLE_MOVEABLE )
{
- // fill in holy default values brought to us by product management
- if( aScreenSize.Width() >= 800 )
- w = 785;
- if( aScreenSize.Width() >= 1024 )
- w = 920;
- if( aScreenSize.Width() >= 1280 )
- w = 1050;
-
- if( aScreenSize.Height() >= 600 )
- h = 550;
- if( aScreenSize.Height() >= 768 )
- h = 630;
- if( aScreenSize.Height() >= 1024 )
- h = 875;
+ Size aBestFitSize(bestmaxFrameSizeForScreenSize(aScreenSize));
+ w = aBestFitSize.Width();
+ h = aBestFitSize.Height();
}
if( ! mpParent )
{
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 398ece4c300a..6343f5b149f8 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -22,6 +22,7 @@
#include <unx/gtk/gtkinst.hxx>
#include <unx/gtk/gtkgdi.hxx>
#include <vcl/keycodes.hxx>
+#include <vcl/layout.hxx>
#include <unx/wmadaptor.hxx>
#include <unx/sm.hxx>
#include <unx/salbmp.h>
@@ -1534,26 +1535,7 @@ void GtkSalFrame::Center()
Size GtkSalFrame::calcDefaultSize()
{
- Size aScreenSize = getDisplay()->GetScreenSize( GetDisplayScreen() );
- long w = aScreenSize.Width();
- long h = aScreenSize.Height();
-
- // fill in holy default values brought to us by product management
- if( aScreenSize.Width() >= 800 )
- w = 785;
- if( aScreenSize.Width() >= 1024 )
- w = 920;
- if( aScreenSize.Width() >= 1280 )
- w = 1050;
-
- if( aScreenSize.Height() >= 600 )
- h = 550;
- if( aScreenSize.Height() >= 768 )
- h = 630;
- if( aScreenSize.Height() >= 1024 )
- h = 875;
-
- return Size( w, h );
+ return bestmaxFrameSizeForScreenSize(getDisplay()->GetScreenSize(GetDisplayScreen()));
}
void GtkSalFrame::SetDefaultSize()