IDE: Fix a regression and another bug in "Center lost window" feature with designed forms. Issue #40940, patch by n7800.

This commit is contained in:
Juha 2024-07-12 09:49:12 +03:00
parent ad09697ffa
commit 6527e6e6b1

View File

@ -553,12 +553,22 @@ var
itmApplePref: TIDEMenuSection; itmApplePref: TIDEMenuSection;
{$ENDIF} {$ENDIF}
// corresponds to InitMenuItem procedure
function FormMatchesCmd(aForm: TCustomForm; aCmd: TIDEMenuCommand): Boolean; function FormMatchesCmd(aForm: TCustomForm; aCmd: TIDEMenuCommand): Boolean;
begin begin
if EnvironmentGuiOpts.Desktop.IDENameForDesignedFormList and IsFormDesign(aForm) then if not IsFormDesign(aForm) then
Result := aForm.Name = aCmd.Caption Result := aCmd.Caption = aForm.Caption
else else
Result := aForm.Caption = aCmd.Caption; case aForm.ClassName of
'TFrameProxyDesignerForm', // frame
'TNonControlProxyDesignerForm': // datamodule
Result := aCmd.Caption = AForm.Caption;
else // form
if EnvironmentGuiOpts.Desktop.IDENameForDesignedFormList then
Result := aCmd.Caption = aForm.Name
else
Result := aCmd.Caption = aForm.Caption;
end;
end; end;
{ TMainIDEBase } { TMainIDEBase }
@ -1531,9 +1541,9 @@ begin
AMenuItem.Caption := AForm.Caption; AMenuItem.Caption := AForm.Caption;
else // form else // form
if EnvironmentGuiOpts.Desktop.IDENameForDesignedFormList then if EnvironmentGuiOpts.Desktop.IDENameForDesignedFormList then
AMenuItem.Caption := AForm.Name+' - Designer' AMenuItem.Caption := AForm.Name
else else
AMenuItem.Caption := AForm.Caption+' - Designer'; AMenuItem.Caption := AForm.Caption;
end; end;
AMenuItem.UserTag := {%H-}PtrUInt(AForm); AMenuItem.UserTag := {%H-}PtrUInt(AForm);
end; end;