From 6f0e2f411ed57b45f4665c44d89d3c5e6d890a9a Mon Sep 17 00:00:00 2001 From: binarymaster Date: Mon, 25 Sep 2017 15:57:29 +0300 Subject: [PATCH] Main: Load and save window position and size --- src/editor/f_main.lfm | 1 - src/editor/f_main.pas | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/editor/f_main.lfm b/src/editor/f_main.lfm index fcc7377..d359463 100644 --- a/src/editor/f_main.lfm +++ b/src/editor/f_main.lfm @@ -21,7 +21,6 @@ object MainForm: TMainForm OnKeyDown = FormKeyDown OnKeyUp = FormKeyUp OnResize = FormResize - Position = poDefault LCLVersion = '1.6.0.4' object Splitter1: TSplitter Left = 518 diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index d429811..8fd1fa3 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -2599,6 +2599,14 @@ begin config := TConfig.CreateFile(EditorDir+'Editor.cfg'); + if config.ReadInt('Editor', 'XPos', -1) = -1 then + Position := poDesktopCenter + else begin + Left := config.ReadInt('Editor', 'XPos', Left); + Top := config.ReadInt('Editor', 'YPos', Top); + Width := config.ReadInt('Editor', 'Width', Width); + Height := config.ReadInt('Editor', 'Height', Height); + end; if config.ReadBool('Editor', 'Maximize', False) then WindowState := wsMaximized; ShowMap := config.ReadBool('Editor', 'Minimap', False); @@ -4024,6 +4032,10 @@ var begin config := TConfig.CreateFile(EditorDir+'Editor.cfg'); + config.WriteInt('Editor', 'XPos', Left); + config.WriteInt('Editor', 'YPos', Top); + config.WriteInt('Editor', 'Width', Width); + config.WriteInt('Editor', 'Height', Height); config.WriteBool('Editor', 'Maximize', WindowState = wsMaximized); config.WriteBool('Editor', 'Minimap', ShowMap); config.WriteInt('Editor', 'PanelProps', PanelProps.ClientWidth); -- 2.29.2