mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 02:16:48 +02:00
ideintf: the form position was not stored on form close because OnFormClose handler was never set + formatting (the second part of bug #0021270)
git-svn-id: trunk@35410 -
This commit is contained in:
parent
2ed303eb5a
commit
96a8ef8348
@ -201,15 +201,15 @@ type
|
|||||||
FApplied: boolean;
|
FApplied: boolean;
|
||||||
FFormCaption: string;
|
FFormCaption: string;
|
||||||
FVisible: boolean;
|
FVisible: boolean;
|
||||||
fWindowPlacement: TIDEWindowPlacement;
|
FWindowPlacement: TIDEWindowPlacement;
|
||||||
fLeft: integer;
|
FLeft: integer;
|
||||||
fTop: integer;
|
FTop: integer;
|
||||||
fWidth: integer;
|
FWidth: integer;
|
||||||
fHeight: integer;
|
FHeight: integer;
|
||||||
fWindowState: TIDEWindowState;
|
FWindowState: TIDEWindowState;
|
||||||
fForm: TCustomForm;
|
FForm: TCustomForm;
|
||||||
fFormID: string;
|
FFormID: string;
|
||||||
fDefaultWindowPlacement: TIDEWindowPlacement;
|
FDefaultWindowPlacement: TIDEWindowPlacement;
|
||||||
FDividers: TSimpleWindowLayoutDividerPosList;
|
FDividers: TSimpleWindowLayoutDividerPosList;
|
||||||
function GetFormCaption: string;
|
function GetFormCaption: string;
|
||||||
function GetFormID: string;
|
function GetFormID: string;
|
||||||
@ -240,13 +240,13 @@ type
|
|||||||
property FormCaption: string read GetFormCaption;
|
property FormCaption: string read GetFormCaption;
|
||||||
property WindowPlacement: TIDEWindowPlacement read fWindowPlacement write FWindowPlacement;
|
property WindowPlacement: TIDEWindowPlacement read fWindowPlacement write FWindowPlacement;
|
||||||
property DefaultWindowPlacement: TIDEWindowPlacement
|
property DefaultWindowPlacement: TIDEWindowPlacement
|
||||||
read fDefaultWindowPlacement write fDefaultWindowPlacement;
|
read FDefaultWindowPlacement write FDefaultWindowPlacement;
|
||||||
property Left: integer read fLeft write FLeft;
|
property Left: integer read FLeft write FLeft;
|
||||||
property Top: integer read fTop write FTop;
|
property Top: integer read FTop write FTop;
|
||||||
property Width: integer read fWidth write FWidth;
|
property Width: integer read FWidth write FWidth;
|
||||||
property Height: integer read fHeight write FHeight;
|
property Height: integer read FHeight write FHeight;
|
||||||
property WindowState: TIDEWindowState read fWindowState write FWindowState;
|
property WindowState: TIDEWindowState read FWindowState write FWindowState;
|
||||||
property Form: TCustomForm read fForm write SetForm;
|
property Form: TCustomForm read FForm write SetForm;
|
||||||
property Visible: boolean read FVisible write FVisible;
|
property Visible: boolean read FVisible write FVisible;
|
||||||
property Applied: boolean read FApplied write FApplied;
|
property Applied: boolean read FApplied write FApplied;
|
||||||
property Dividers: TSimpleWindowLayoutDividerPosList read FDividers;
|
property Dividers: TSimpleWindowLayoutDividerPosList read FDividers;
|
||||||
@ -993,14 +993,12 @@ end;
|
|||||||
|
|
||||||
procedure TIDEDialogLayoutStorage.OnCreateForm(Sender: TObject);
|
procedure TIDEDialogLayoutStorage.OnCreateForm(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if Sender=nil then ;
|
|
||||||
IDEDialogLayoutList.ApplyLayout(Sender as TControl);
|
IDEDialogLayoutList.ApplyLayout(Sender as TControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEDialogLayoutStorage.OnCloseForm(Sender: TObject;
|
procedure TIDEDialogLayoutStorage.OnCloseForm(Sender: TObject;
|
||||||
var CloseAction: TCloseAction);
|
var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
if Sender=nil then ;
|
|
||||||
IDEDialogLayoutList.SaveLayout(Sender as TControl);
|
IDEDialogLayoutList.SaveLayout(Sender as TControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1009,7 +1007,8 @@ var
|
|||||||
Form: TCustomForm;
|
Form: TCustomForm;
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
if Owner is TCustomForm then begin
|
if Owner is TCustomForm then
|
||||||
|
begin
|
||||||
Form:=TCustomForm(Owner);
|
Form:=TCustomForm(Owner);
|
||||||
Form.AddHandlerCreate(@OnCreateForm);
|
Form.AddHandlerCreate(@OnCreateForm);
|
||||||
Form.AddHandlerClose(@OnCloseForm);
|
Form.AddHandlerClose(@OnCloseForm);
|
||||||
@ -1020,7 +1019,8 @@ destructor TIDEDialogLayoutStorage.Destroy;
|
|||||||
var
|
var
|
||||||
Form: TCustomForm;
|
Form: TCustomForm;
|
||||||
begin
|
begin
|
||||||
if Owner is TCustomForm then begin
|
if Owner is TCustomForm then
|
||||||
|
begin
|
||||||
Form:=TCustomForm(Owner);
|
Form:=TCustomForm(Owner);
|
||||||
Form.RemoveAllHandlersOfObject(Self);
|
Form.RemoveAllHandlersOfObject(Self);
|
||||||
end;
|
end;
|
||||||
@ -1072,10 +1072,10 @@ begin
|
|||||||
fWindowPlacement:=StrToIDEWindowPlacement(Config.GetValue(
|
fWindowPlacement:=StrToIDEWindowPlacement(Config.GetValue(
|
||||||
P+'WindowPlacement/Value',IDEWindowPlacementNames[fWindowPlacement]));
|
P+'WindowPlacement/Value',IDEWindowPlacementNames[fWindowPlacement]));
|
||||||
// custom position
|
// custom position
|
||||||
fLeft:=Config.GetValue(P+'CustomPosition/Left',fLeft);
|
Left := Config.GetValue(P+'CustomPosition/Left', Left);
|
||||||
fTop:=Config.GetValue(P+'CustomPosition/Top',fTop);
|
Top := Config.GetValue(P+'CustomPosition/Top', Top);
|
||||||
fWidth:=Config.GetValue(P+'CustomPosition/Width',fWidth);
|
Width := Config.GetValue(P+'CustomPosition/Width', Width);
|
||||||
fHeight:=Config.GetValue(P+'CustomPosition/Height',fHeight);
|
Height := Config.GetValue(P+'CustomPosition/Height', Height);
|
||||||
// state
|
// state
|
||||||
fWindowState:=StrToIDEWindowState(Config.GetValue(
|
fWindowState:=StrToIDEWindowState(Config.GetValue(
|
||||||
P+'WindowState/Value',IDEWindowStateNames[fWindowState]));
|
P+'WindowState/Value',IDEWindowStateNames[fWindowState]));
|
||||||
@ -1099,10 +1099,10 @@ begin
|
|||||||
IDEWindowPlacementNames[fWindowPlacement],
|
IDEWindowPlacementNames[fWindowPlacement],
|
||||||
IDEWindowPlacementNames[iwpRestoreWindowSize]);
|
IDEWindowPlacementNames[iwpRestoreWindowSize]);
|
||||||
// custom position
|
// custom position
|
||||||
Config.SetDeleteValue(P+'CustomPosition/Left',fLeft,0);
|
Config.SetDeleteValue(P+'CustomPosition/Left', Left, 0);
|
||||||
Config.SetDeleteValue(P+'CustomPosition/Top',fTop,0);
|
Config.SetDeleteValue(P+'CustomPosition/Top', Top, 0);
|
||||||
Config.SetDeleteValue(P+'CustomPosition/Width',fWidth,0);
|
Config.SetDeleteValue(P+'CustomPosition/Width', Width, 0);
|
||||||
Config.SetDeleteValue(P+'CustomPosition/Height',fHeight,0);
|
Config.SetDeleteValue(P+'CustomPosition/Height', Height, 0);
|
||||||
// state
|
// state
|
||||||
Config.SetValue(P+'WindowState/Value',IDEWindowStateNames[fWindowState]);
|
Config.SetValue(P+'WindowState/Value',IDEWindowStateNames[fWindowState]);
|
||||||
Config.SetDeleteValue(P+'Visible/Value',FVisible,false);
|
Config.SetDeleteValue(P+'Visible/Value',FVisible,false);
|
||||||
@ -1202,15 +1202,18 @@ end;
|
|||||||
procedure TSimpleWindowLayout.SetForm(const AValue: TCustomForm);
|
procedure TSimpleWindowLayout.SetForm(const AValue: TCustomForm);
|
||||||
begin
|
begin
|
||||||
if fForm=AValue then exit;
|
if fForm=AValue then exit;
|
||||||
if (Form<>nil) then begin
|
if Assigned(Form) then
|
||||||
|
begin
|
||||||
RemoveFreeNotification(Form);
|
RemoveFreeNotification(Form);
|
||||||
Form.RemoveHandlerClose(@OnFormClose);
|
Form.RemoveHandlerClose(@OnFormClose);
|
||||||
end;
|
end;
|
||||||
fForm:=AValue;
|
fForm:=AValue;
|
||||||
if (Form<>nil) then begin
|
if Assigned(Form) then
|
||||||
|
begin
|
||||||
fFormID := Form.Name;
|
fFormID := Form.Name;
|
||||||
FFormCaption := Form.Caption;
|
FFormCaption := Form.Caption;
|
||||||
FreeNotification(Form);
|
FreeNotification(Form);
|
||||||
|
Form.AddHandlerClose(@OnFormClose);
|
||||||
Applied:=false;
|
Applied:=false;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1278,14 +1281,14 @@ begin
|
|||||||
Clear;
|
Clear;
|
||||||
FApplied:=Layout.Applied;
|
FApplied:=Layout.Applied;
|
||||||
FForm:=Layout.FForm;
|
FForm:=Layout.FForm;
|
||||||
fWindowPlacement:=Layout.fWindowPlacement;
|
FWindowPlacement:=Layout.FWindowPlacement;
|
||||||
fLeft:=Layout.fLeft;
|
FLeft:=Layout.FLeft;
|
||||||
fTop:=Layout.fTop;
|
FTop:=Layout.FTop;
|
||||||
fWidth:=Layout.fWidth;
|
FWidth:=Layout.FWidth;
|
||||||
fHeight:=Layout.fHeight;
|
FHeight:=Layout.FHeight;
|
||||||
fWindowState:=Layout.fWindowState;
|
FWindowState:=Layout.FWindowState;
|
||||||
fFormID:=Layout.fFormID;
|
FFormID:=Layout.FFormID;
|
||||||
fDefaultWindowPlacement:=Layout.fDefaultWindowPlacement;
|
FDefaultWindowPlacement:=Layout.FDefaultWindowPlacement;
|
||||||
FDividers.Assign(Layout.FDividers);
|
FDividers.Assign(Layout.FDividers);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user