From bdaaacdf6a12ec7896975afc344ae99d6539b3e9 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 1 Sep 2016 16:55:23 -0700 Subject: [PATCH 1/2] MatterControl now defaults to larger window size --- MatterControlApplication.cs | 48 +++++++++++++++++++++++++++++++++---- Submodules/agg-sharp | 2 +- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index 30bcc38b7..4b30fe53d 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -431,21 +431,59 @@ public static bool CameraPreviewActive = false; public static MatterControlApplication CreateInstance(int overrideWidth = -1, int overrideHeight = -1) { - // try and open our window matching the last size that we had for it. + int width = 0; + int height = 0; + + // check if the app has a size alread set string windowSize = ApplicationSettings.Instance.get(ApplicationSettingsKey.WindowSize); - int width = overrideWidth == -1 ? 601 : overrideWidth; - int height = overrideHeight == -1 ? 601 : overrideHeight; if (windowSize != null && windowSize != "") { + // try and open our window matching the last size that we had for it. string[] sizes = windowSize.Split(','); width = Math.Max(int.Parse(sizes[0]), (int)minSize.x + 1); height = Math.Max(int.Parse(sizes[1]), (int)minSize.y + 1); } + else // try to set it to a big size or the min size + { + Point2D desktopSize = OsInformation.DesktopSize; - using (new PerformanceTimer("Startup", "Total")) + if(overrideWidth != -1) + { + width = overrideWidth; + } + else // try to set it to a good size + { + if(width < desktopSize.x) + { + width = 1280; + } + } + + if(overrideHeight != -1) + { + height = overrideHeight; + } + else + { + if (height < desktopSize.y) + { + height = 720; + } + } + } + + using (new PerformanceTimer("Startup", "Total")) { instance = new MatterControlApplication(width, height); - } + + if (instance.DesktopPosition == new Point2D()) + { + Point2D desktopSize = OsInformation.DesktopSize; + + // Now try and center the window. If this is saved it will got overridden + instance.DesktopPosition = new Point2D((desktopSize.x - instance.Width)/2, (desktopSize.y - instance.Height)/2); + } + } return instance; } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 894258098..09920fb46 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 894258098ea4b81e3cc3c8f8cf6406ffd1c284a4 +Subproject commit 09920fb461fac8089d4b281c3a9d64e042dac502 From 4724bdd311584da9f1f6909929e3ded273d6ae28 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Thu, 1 Sep 2016 16:56:14 -0700 Subject: [PATCH 2/2] latest agg --- Submodules/agg-sharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 09920fb46..769f62ca0 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 09920fb461fac8089d4b281c3a9d64e042dac502 +Subproject commit 769f62ca0128288f42e486cce0fab470637673d0