From: binarymaster Date: Mon, 25 Sep 2017 12:57:29 +0000 (+0300) Subject: Main: Load and save window position and size X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=6f0e2f411ed57b45f4665c44d89d3c5e6d890a9a;p=d2df-editor.git Main: Load and save window position and size --- 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);