Merge branch 'IDE/Options/SaveLayout' into 'main'

IDE/Options: Remember the window layout when closing via the close button in the window caption

See merge request freepascal.org/lazarus/lazarus!423
This commit is contained in:
Juha Manninen 2025-01-31 22:13:46 +00:00
commit 59bf489735
2 changed files with 10 additions and 8 deletions

View File

@ -8,6 +8,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
Constraints.MinWidth = 500
KeyPreview = True
Position = poWorkAreaCenter
OnClose = FormClose
OnKeyDown = FormKeyDown
OnShow = FormShow
object ButtonPanel: TButtonPanel[0]

View File

@ -86,6 +86,7 @@ type
procedure CategoryTreeExpanded(Sender: TObject; Node: TTreeNode);
procedure CategoryTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
function FilterEditFilterItem(ItemData: Pointer; out Done: Boolean): Boolean;
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormShow(Sender: TObject);
procedure HelpButtonClick(Sender: TObject);
@ -358,6 +359,12 @@ begin
Result:=OptEditor.ContainsTextInCaption(FilterEdit.Filter);
end;
procedure TIDEOptionsDialog.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
if WindowState <> wsMaximized then
IDEDialogLayoutList.SaveLayout(self);
end;
procedure TIDEOptionsDialog.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
// dialog
@ -431,12 +438,8 @@ end;
procedure TIDEOptionsDialog.OkButtonClick(Sender: TObject);
begin
if not Apply then
Exit;
// close
if WindowState <> wsMaximized then
IDEDialogLayoutList.SaveLayout(Self);
ModalResult := mrOk;
if Apply then
ModalResult := mrOk;
end;
procedure TIDEOptionsDialog.CancelButtonClick(Sender: TObject);
@ -446,8 +449,6 @@ begin
// ToDo: Set build target only for project options.
MainBuildBoss.SetBuildTargetProject1;
// close
if WindowState <> wsMaximized then
IDEDialogLayoutList.SaveLayout(Self);
ModalResult := mrCancel;
end;