added TScreen handlers, implemented TMainIDE.UnHideIDE

git-svn-id: trunk@3041 -
This commit is contained in:
mattias 2002-08-18 08:57:15 +00:00
parent a5d058fef4
commit 8728f72a0f

View File

@ -98,6 +98,7 @@ type
//procedure FormPaint(Sender : TObject); //procedure FormPaint(Sender : TObject);
procedure OnApplicationUserInput(Sender: TObject; Msg: Cardinal); procedure OnApplicationUserInput(Sender: TObject; Msg: Cardinal);
procedure OnApplicationIdle(Sender: TObject); procedure OnApplicationIdle(Sender: TObject);
procedure OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm);
// file menu // file menu
procedure mnuNewUnitClicked(Sender : TObject); procedure mnuNewUnitClicked(Sender : TObject);
@ -554,6 +555,7 @@ type
procedure UpdateCaption; override; procedure UpdateCaption; override;
procedure HideIDE; override; procedure HideIDE; override;
procedure HideUnmodifiedDesigners; procedure HideUnmodifiedDesigners;
procedure UnhideIDE; override;
function DoConvertDFMFileToLFMFile(const DFMFilename: string): TModalResult; function DoConvertDFMFileToLFMFile(const DFMFilename: string): TModalResult;
// methods for codetools // methods for codetools
@ -846,6 +848,7 @@ begin
Name := NonModalIDEWindowNames[nmiwMainIDEName]; Name := NonModalIDEWindowNames[nmiwMainIDEName];
EnvironmentOptions.IDEWindowLayoutList.Apply(TForm(Self),Name); EnvironmentOptions.IDEWindowLayoutList.Apply(TForm(Self),Name);
OnResize:=@MainIDEResize; OnResize:=@MainIDEResize;
HiddenWindowsOnRun:=TList.Create;
{$IFDEF DisablePkgs} {$IFDEF DisablePkgs}
InitIDEComponents; InitIDEComponents;
@ -889,6 +892,7 @@ begin
// set OnIdle handlers // set OnIdle handlers
Application.AddOnUserInputHandler(@OnApplicationUserInput); Application.AddOnUserInputHandler(@OnApplicationUserInput);
Application.AddOnIdleHandler(@OnApplicationIdle); Application.AddOnIdleHandler(@OnApplicationIdle);
Screen.AddHandlerRemoveForm(@OnScreenRemoveForm);
SetupHints; SetupHints;
end; end;
@ -919,6 +923,7 @@ begin
FreeThenNil(EditorOpts); FreeThenNil(EditorOpts);
FreeThenNil(EnvironmentOptions); FreeThenNil(EnvironmentOptions);
FreeThenNil(InputHistories); FreeThenNil(InputHistories);
FreeThenNil(HiddenWindowsOnRun);
writeln('[TMainIDE.Destroy] B -> inherited Destroy...'); writeln('[TMainIDE.Destroy] B -> inherited Destroy...');
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Destroy B ');{$ENDIF} {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.Destroy B ');{$ENDIF}
@ -6280,27 +6285,25 @@ procedure TMainIDE.HideIDE;
var var
i: Integer; i: Integer;
AForm: TCustomForm; AForm: TCustomForm;
WindowsList: TList;
begin begin
HideUnmodifiedDesigners; HideUnmodifiedDesigners;
WindowsList:=TList.Create;
// 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<>Self) if (AForm<>Self)
and (AForm.Designer=nil) and (AForm.Visible) and (AForm.Designer=nil) and (AForm.Visible)
and (WindowsList.IndexOf(AForm)<0) and (not (fsModal in AForm.FormState))
and (not (fsModal in AForm.FormState)) then and (HiddenWindowsOnRun.IndexOf(AForm)<0)
WindowsList.Add(AForm); then
HiddenWindowsOnRun.Add(AForm);
end; end;
// hide all collected windows // hide all collected windows
for i:=0 to WindowsList.Count-1 do begin for i:=0 to HiddenWindowsOnRun.Count-1 do begin
AForm:=TCustomForm(WindowsList[i]); AForm:=TCustomForm(HiddenWindowsOnRun[i]);
AForm.Hide; AForm.Hide;
end; end;
// clean up
WindowsList.Free;
end; end;
procedure TMainIDE.HideUnmodifiedDesigners; procedure TMainIDE.HideUnmodifiedDesigners;
@ -6317,6 +6320,17 @@ begin
end; end;
end; end;
procedure TMainIDE.UnhideIDE;
var
AForm: TCustomForm;
begin
while HiddenWindowsOnRun.Count>0 do begin
AForm:=TCustomForm(HiddenWindowsOnRun[0]);
AForm.Show;
HiddenWindowsOnRun.Delete(0);
end;
end;
procedure TMainIDE.DoBringToFrontFormOrUnit; procedure TMainIDE.DoBringToFrontFormOrUnit;
begin begin
if FDisplayState = dsSource then begin if FDisplayState = dsSource then begin
@ -8236,6 +8250,11 @@ begin
if (SplashForm<>nil) then FreeThenNil(SplashForm); if (SplashForm<>nil) then FreeThenNil(SplashForm);
end; end;
procedure TMainIDE.OnScreenRemoveForm(Sender: TObject; AForm: TCustomForm);
begin
HiddenWindowsOnRun.Remove(AForm);
end;
function TMainIDE.ProjInspectorAddUnitToProject(Sender: TObject; function TMainIDE.ProjInspectorAddUnitToProject(Sender: TObject;
AnUnitInfo: TUnitInfo): TModalresult; AnUnitInfo: TUnitInfo): TModalresult;
var var
@ -8822,6 +8841,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.580 2003/05/25 12:12:36 mattias
added TScreen handlers, implemented TMainIDE.UnHideIDE
Revision 1.579 2003/05/24 11:06:43 mattias Revision 1.579 2003/05/24 11:06:43 mattias
started Hide IDE on run started Hide IDE on run