From c7fd915e1e1c15474062f0cb01f69f017b4d1358 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Wed, 13 Sep 2017 17:02:02 +0300 Subject: [PATCH] support restoring window state - #278, #234 --- dub.json | 2 +- src/dlangide.d | 2 ++ src/dlangide/ui/frame.d | 6 ++++++ src/dlangide/workspace/idesettings.d | 5 +++++ views/VERSION | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dub.json b/dub.json index 092788b..aac32c5 100644 --- a/dub.json +++ b/dub.json @@ -12,7 +12,7 @@ "stringImportPaths": ["views"], "dependencies": { - "dlangui": "==0.9.130", + "dlangui": "==0.9.131", "dsymbol": "~>0.2.9", "dcd": "~>0.9.1" }, diff --git a/src/dlangide.d b/src/dlangide.d index cf4a506..62e0133 100644 --- a/src/dlangide.d +++ b/src/dlangide.d @@ -105,6 +105,8 @@ extern (C) int UIAppMain(string[] args) { // show window window.show(); + // restore window state, size, position + frame.restoreUIStateOnStartup(); //jsonTest(); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 2b4477c..8d53185 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -1650,6 +1650,10 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } } + void restoreUIStateOnStartup() { + window.restoreWindowState(_settings.uiState); + } + /// return false to prevent closing bool onCanClose() { askForUnsavedEdits(delegate() { @@ -1663,6 +1667,8 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL } /// called when main window is closing void onWindowClose() { + window.saveWindowState(_settings.uiState); + _settings.save(); Log.i("onWindowClose()"); stopExecution(); } diff --git a/src/dlangide/workspace/idesettings.d b/src/dlangide/workspace/idesettings.d index 2e4f4f1..59be402 100644 --- a/src/dlangide/workspace/idesettings.d +++ b/src/dlangide/workspace/idesettings.d @@ -302,5 +302,10 @@ class IDESettings : SettingsFile { Setting obj =_setting.objectByPath("common", true); obj.setBoolean("autoOpenLastProject", value); } + + /// for saving window state, position, and other UI states + @property Setting uiState() { + return _setting.objectByPath("uiState", true); + } } diff --git a/views/VERSION b/views/VERSION index db67ad0..26731c8 100644 --- a/views/VERSION +++ b/views/VERSION @@ -1 +1 @@ -v0.7.78 \ No newline at end of file +v0.7.79 \ No newline at end of file