mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-06 23:00:22 +02:00
IDE: fixed restoring designed form when HideIDEWindowsOnRun = true. issue #22535
git-svn-id: trunk@40177 -
This commit is contained in:
parent
b8182677b8
commit
7330294168
@ -1129,8 +1129,9 @@ begin
|
|||||||
FPrevShownWindow := GetForegroundWindow;
|
FPrevShownWindow := GetForegroundWindow;
|
||||||
if EnvironmentOptions.HideIDEOnRun then
|
if EnvironmentOptions.HideIDEOnRun then
|
||||||
MainIDE.UnhideIDE;
|
MainIDE.UnhideIDE;
|
||||||
if not EnvironmentOptions.SingleTaskBarButton then
|
if not EnvironmentOptions.SingleTaskBarButton and
|
||||||
Application.BringToFront;
|
not EnvironmentOptions.HideIDEOnRun then
|
||||||
|
Application.BringToFront;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
78
ide/main.pp
78
ide/main.pp
@ -8753,20 +8753,25 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
AForm: TCustomForm;
|
AForm: TCustomForm;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.HideIDE ENTERED HiddenWindowsOnRun.Count=',dbgs(HiddenWindowsOnRun.Count),
|
||||||
|
' LastFormActivated ',dbgsName(LastFormActivated),
|
||||||
|
' WindowMenuActive ',dbgsName(WindowMenuActiveForm));
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
// hide hints
|
// hide hints
|
||||||
Application.HideHint;
|
Application.HideHint;
|
||||||
SourceEditorManager.HideHint;
|
SourceEditorManager.HideHint;
|
||||||
|
|
||||||
// hide designer forms
|
// hide designer forms
|
||||||
CloseUnmodifiedDesigners;
|
// CloseUnmodifiedDesigners;
|
||||||
|
|
||||||
// collect all windows except the main bar
|
// collect all windows except the main bar
|
||||||
for i:=0 to Screen.CustomFormCount-1 do begin
|
for i:=0 to Screen.CustomFormCount-1 do
|
||||||
|
begin
|
||||||
AForm:=Screen.CustomForms[i];
|
AForm:=Screen.CustomForms[i];
|
||||||
if (AForm.Parent=nil) // ignore nested forms
|
if (AForm.Parent=nil) // ignore nested forms
|
||||||
and (AForm<>MainIDEBar) // ignore the main bar
|
and (AForm<>MainIDEBar) // ignore the main bar
|
||||||
and (AForm.Designer=nil) // ignore designer forms
|
|
||||||
and (not (csDesigning in AForm.ComponentState))
|
|
||||||
and (AForm.IsVisible) // ignore hidden forms
|
and (AForm.IsVisible) // ignore hidden forms
|
||||||
and (not (fsModal in AForm.FormState)) // ignore modal forms
|
and (not (fsModal in AForm.FormState)) // ignore modal forms
|
||||||
and (HiddenWindowsOnRun.IndexOf(AForm)<0) // ignore already collected forms
|
and (HiddenWindowsOnRun.IndexOf(AForm)<0) // ignore already collected forms
|
||||||
@ -8775,13 +8780,30 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// hide all collected windows
|
// hide all collected windows
|
||||||
for i:=0 to HiddenWindowsOnRun.Count-1 do begin
|
for i:=0 to HiddenWindowsOnRun.Count-1 do
|
||||||
|
begin
|
||||||
AForm:=TCustomForm(HiddenWindowsOnRun[i]);
|
AForm:=TCustomForm(HiddenWindowsOnRun[i]);
|
||||||
AForm.Hide;
|
if (AForm.Designer <> nil) or (csDesigning in AForm.ComponentState) then
|
||||||
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.HideIDE: HIDING VIA LCLINTF ',dbgsName(AForm),' WindowState ',dbgs(AForm.WindowState),
|
||||||
|
' IsIconic ',dbgs(LCLIntf.IsIconic(AForm.Handle)));
|
||||||
|
{$ENDIF}
|
||||||
|
LCLIntf.ShowWindow(AForm.Handle, SW_HIDE);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.HideIDE: HIDING NON DESIGNED FORM ',dbgsName(AForm));
|
||||||
|
{$ENDIF}
|
||||||
|
AForm.Hide;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// minimize IDE
|
// minimize IDE
|
||||||
MainIDEBar.HideIDE;
|
MainIDEBar.HideIDE;
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.HideIDE EXITED ');
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.CloseUnmodifiedDesigners;
|
procedure TMainIDE.CloseUnmodifiedDesigners;
|
||||||
@ -8802,19 +8824,49 @@ end;
|
|||||||
procedure TMainIDE.UnhideIDE;
|
procedure TMainIDE.UnhideIDE;
|
||||||
var
|
var
|
||||||
AForm: TCustomForm;
|
AForm: TCustomForm;
|
||||||
|
i: Integer;
|
||||||
|
AActiveForm: TCustomForm;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.UnhideIDE Active=',dbgsName(WindowMenuActiveForm));
|
||||||
|
{$ENDIF}
|
||||||
|
AActiveForm := WindowMenuActiveForm;
|
||||||
// unminimize IDE
|
// unminimize IDE
|
||||||
MainIDEBar.UnhideIDE;
|
MainIDEBar.UnhideIDE;
|
||||||
|
|
||||||
// show other windows
|
// show other windows but keep order as it was before hiding.
|
||||||
while HiddenWindowsOnRun.Count>0 do begin
|
for i := HiddenWindowsOnRun.Count - 1 downto 0 do
|
||||||
AForm:=TCustomForm(HiddenWindowsOnRun[0]);
|
begin
|
||||||
if (csDesigning in ComponentState) then
|
AForm:=TCustomForm(HiddenWindowsOnRun[i]);
|
||||||
ShowDesignerForm(AForm)
|
if (csDesigning in AForm.ComponentState) or (AForm.Designer <> nil) then
|
||||||
else
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.UnhideIDE: Showing LCLIntf AForm ',dbgsName(AForm),
|
||||||
|
' WindowState ',dbgs(AForm.WindowState),' LCLIntf.IsIconic ',
|
||||||
|
dbgs(LCLIntf.IsIconic(AForm.Handle)));
|
||||||
|
{$ENDIF}
|
||||||
|
if LCLIntf.IsIconic(AForm.Handle) then
|
||||||
|
LCLIntf.ShowWindow(AForm.Handle, SW_SHOWMINIMIZED)
|
||||||
|
else
|
||||||
|
LCLIntf.ShowWindow(AForm.Handle, SW_SHOWNORMAL);
|
||||||
|
// ShowDesignerForm(AForm)
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.UnhideIDE: Showing AForm ',dbgsName(AForm));
|
||||||
|
{$ENDIF}
|
||||||
AForm.Show;
|
AForm.Show;
|
||||||
HiddenWindowsOnRun.Delete(0);
|
end;
|
||||||
end;
|
end;
|
||||||
|
HiddenWindowsOnRun.Clear;
|
||||||
|
{$IFDEF DEBUGHIDEIDEWINDOWSONRUN}
|
||||||
|
DebugLn('TMainIDE.UnhideIDE: activating form ',dbgsName(AActiveForm));
|
||||||
|
{$ENDIF}
|
||||||
|
{activate form or app, must be so because of debugmanager !}
|
||||||
|
if Assigned(AActiveForm) then
|
||||||
|
AActiveForm.BringToFront
|
||||||
|
else
|
||||||
|
Application.BringToFront;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainIDE.SaveIncludeLinks;
|
procedure TMainIDE.SaveIncludeLinks;
|
||||||
|
Loading…
Reference in New Issue
Block a user