diff --git a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy index 665f9e48..aa782f25 100644 --- a/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/MainFrameView.groovy @@ -91,7 +91,7 @@ class MainFrameView { settings = application.context.get("ui-settings") int rowHeight = application.context.get("row-height") builder.with { - application(size : [1024,768], id: 'main-frame', + application(size : [settings.mainFrameX,settings.mainFrameY], id: 'main-frame', locationRelativeTo : null, defaultCloseOperation : JFrame.DO_NOTHING_ON_CLOSE, title: application.configuration['application.title'] + " " + @@ -1456,10 +1456,10 @@ class MainFrameView { for (int i = 0; i < count; i++) settings.openTabs.add(tabbedPane.getTitleAt(i)) - File uiPropsFile = new File(core.home, "gui.properties") - uiPropsFile.withOutputStream { settings.write(it) } - def mainFrame = builder.getVariable("main-frame") + JFrame mainFrame = builder.getVariable("main-frame") + settings.mainFrameX = mainFrame.getSize().width + settings.mainFrameY = mainFrame.getSize().height mainFrame.setVisible(false) application.getWindowManager().findWindow("shutdown-window").setVisible(true) if (core != null) { @@ -1469,6 +1469,9 @@ class MainFrameView { }as Runnable) t.start() } + + File uiPropsFile = new File(core.home, "gui.properties") + uiPropsFile.withOutputStream { settings.write(it) } } private static class TreeExpansions implements TreeExpansionListener { diff --git a/gui/src/main/groovy/com/muwire/gui/UISettings.groovy b/gui/src/main/groovy/com/muwire/gui/UISettings.groovy index 7ecede81..8d06c32a 100644 --- a/gui/src/main/groovy/com/muwire/gui/UISettings.groovy +++ b/gui/src/main/groovy/com/muwire/gui/UISettings.groovy @@ -11,6 +11,7 @@ class UISettings { String font boolean autoFontSize int fontSize, fontStyle + int mainFrameX, mainFrameY boolean clearCancelledDownloads boolean clearFinishedDownloads boolean excludeLocalResult @@ -44,6 +45,9 @@ class UISettings { groupByFile = Boolean.parseBoolean(props.getProperty("groupByFile","false")) maxChatLines = Integer.parseInt(props.getProperty("maxChatLines","-1")) + mainFrameX = Integer.parseInt(props.getProperty("mainFrameX","1024")) + mainFrameY = Integer.parseInt(props.getProperty("mainFrameY","768")) + searchHistory = DataUtil.readEncodedSet(props, "searchHistory") openTabs = DataUtil.readEncodedSet(props, "openTabs") } @@ -68,6 +72,9 @@ class UISettings { props.setProperty("fontStyle", String.valueOf(fontStyle)) if (font != null) props.setProperty("font", font) + + props.setProperty("mainFrameX", String.valueOf(mainFrameX)) + props.setProperty("mainFrameY", String.valueOf(mainFrameY)) DataUtil.writeEncodedSet(searchHistory, "searchHistory", props) DataUtil.writeEncodedSet(openTabs, "openTabs", props)