IDE: using IDEIntf to show dockable windows

git-svn-id: trunk@25604 -
This commit is contained in:
mattias 2010-05-24 14:31:03 +00:00
parent d855825819
commit f25c0d95e5
21 changed files with 339 additions and 218 deletions

View File

@ -275,7 +275,6 @@ end;
procedure TAnchorDesigner.AnchorDesignerShow(Sender: TObject); procedure TAnchorDesigner.AnchorDesignerShow(Sender: TObject);
begin begin
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
Refresh(true); Refresh(true);
end; end;

View File

@ -98,7 +98,6 @@ begin
Name:=NonModalIDEWindowNames[nmiwClipbrdHistoryName]; Name:=NonModalIDEWindowNames[nmiwClipbrdHistoryName];
Caption := 'Clipboard History'; Caption := 'Clipboard History';
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
CopyToIDEBitBtn:=TBitBtn.Create(Self); CopyToIDEBitBtn:=TBitBtn.Create(Self);
with CopyToIDEBitBtn do begin with CopyToIDEBitBtn do begin

View File

@ -432,8 +432,7 @@ begin
Name:=NonModalIDEWindowNames[nmiwCodeBrowser]; Name:=NonModalIDEWindowNames[nmiwCodeBrowser];
Caption := lisCodeBrowser; Caption := lisCodeBrowser;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
ScopeGroupBox.Caption:=dlgScope; ScopeGroupBox.Caption:=dlgScope;
ScopeWithRequiredPackagesCheckBox.Caption:=lisWithRequiredPackages; ScopeWithRequiredPackagesCheckBox.Caption:=lisWithRequiredPackages;
RescanButton.Caption:=lisRescan; RescanButton.Caption:=lisRescan;

View File

@ -357,7 +357,6 @@ begin
Name:=NonModalIDEWindowNames[nmiwCodeExplorerName]; Name:=NonModalIDEWindowNames[nmiwCodeExplorerName];
Caption := lisMenuViewCodeExplorer; Caption := lisMenuViewCodeExplorer;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
MainNotebook.ActivePageComponent:=CodePage; MainNotebook.ActivePageComponent:=CodePage;

View File

@ -1781,11 +1781,7 @@ begin
end; end;
if Show then if Show then
begin begin
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name); IDEWindowCreators.ShowForm(CurDialog,BringToFront);
if BringToFront then
FDialogs[ADialogType].ShowOnTop
else
FDialogs[ADialogType].Show;
end; end;
end; end;

View File

@ -1485,8 +1485,7 @@ begin
with NewLayout do begin with NewLayout do begin
FormID:=TheFormID; FormID:=TheFormID;
WindowPlacementsAllowed:=[iwpRestoreWindowGeometry,iwpDefault, WindowPlacementsAllowed:=[iwpRestoreWindowGeometry,iwpDefault,
iwpCustomPosition,iwpUseWindowManagerSetting iwpCustomPosition,iwpUseWindowManagerSetting];
{$IFDEF IDEDocking},iwpDocked{$ENDIF}];
OnApply:=@Self.InternOnApplyWindowLayout; OnApply:=@Self.InternOnApplyWindowLayout;
DefaultWindowPlacement:=iwpRestoreWindowGeometry; DefaultWindowPlacement:=iwpRestoreWindowGeometry;
end; end;

View File

@ -41,7 +41,7 @@ uses
BasicCodeTools, FileProcs, CodeAtom, CodeCache, CodeToolManager, BasicCodeTools, FileProcs, CodeAtom, CodeCache, CodeToolManager,
Laz_DOM, Laz_XMLRead, Laz_XMLWrite, Laz_DOM, Laz_XMLRead, Laz_XMLWrite,
// IDEIntf // IDEIntf
ProjectIntf, LazIDEIntf, IDEHelpIntf, LazHelpIntf, Menus, IDEWindowIntf, ProjectIntf, LazIDEIntf, IDEHelpIntf, LazHelpIntf, Menus,
SrcEditorIntf, SrcEditorIntf,
// IDE // IDE
IDEOptionDefs, EnvironmentOpts, PackageSystem, IDEProcs, LazarusIDEStrConsts, IDEOptionDefs, EnvironmentOpts, PackageSystem, IDEProcs, LazarusIDEStrConsts,
@ -215,11 +215,9 @@ begin
if Show then if Show then
begin begin
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwFPDocEditorName).Apply;
FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor); FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor);
FPDocEditor.UpdateButtons; FPDocEditor.UpdateButtons;
FPDocEditor.Show; IDEWindowCreators.ShowForm(FPDocEditor);
FPDocEditor.MakeFullyVisible;
end; end;
end; end;
@ -279,7 +277,6 @@ begin
Application.AddOnIdleHandler(@ApplicationIdle); Application.AddOnIdleHandler(@ApplicationIdle);
Name := NonModalIDEWindowNames[nmiwFPDocEditorName]; Name := NonModalIDEWindowNames[nmiwFPDocEditorName];
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
BoldFormatButton.LoadGlyphFromLazarusResource('formatbold'); BoldFormatButton.LoadGlyphFromLazarusResource('formatbold');
UnderlineFormatButton.LoadGlyphFromLazarusResource('formatunderline'); UnderlineFormatButton.LoadGlyphFromLazarusResource('formatunderline');

View File

@ -14,7 +14,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 0 Left = 0
Height = 22 Height = 22
Top = 0 Top = 0
Width = 196 Width = 218
Caption = 'SingleTaskBarButtonCheckBox' Caption = 'SingleTaskBarButtonCheckBox'
Enabled = False Enabled = False
TabOrder = 0 TabOrder = 0
@ -27,7 +27,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 0 Left = 0
Height = 22 Height = 22
Top = 22 Top = 22
Width = 159 Width = 178
Caption = 'HideIDEOnRunCheckBox' Caption = 'HideIDEOnRunCheckBox'
TabOrder = 1 TabOrder = 1
end end
@ -46,7 +46,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'WindowPositionsGroupBox' Caption = 'WindowPositionsGroupBox'
ClientHeight = 342 ClientHeight = 338
ClientWidth = 562 ClientWidth = 562
TabOrder = 2 TabOrder = 2
object Bevel1: TBevel object Bevel1: TBevel
@ -55,7 +55,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 3 Height = 3
Top = 167 Top = 169
Width = 50 Width = 50
BorderSpacing.Left = 6 BorderSpacing.Left = 6
end end
@ -66,10 +66,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = WindowPositionsGroupBox AnchorSideRight.Control = WindowPositionsGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 195 Left = 210
Height = 3 Height = 3
Top = 167 Top = 169
Width = 361 Width = 346
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -79,9 +79,9 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = WindowPositionsListBox AnchorSideTop.Control = WindowPositionsListBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 70 Left = 70
Height = 14 Height = 18
Top = 161 Top = 161
Width = 119 Width = 134
BorderSpacing.Left = 70 BorderSpacing.Left = 70
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'lblWindowCaption' Caption = 'lblWindowCaption'
@ -93,10 +93,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = LeftEdit AnchorSideTop.Control = LeftEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = LeftEdit AnchorSideRight.Control = LeftEdit
Left = 321 Left = 314
Height = 14 Height = 18
Top = 185 Top = 189
Width = 52 Width = 59
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 3 BorderSpacing.Right = 3
Caption = 'LeftLabel' Caption = 'LeftLabel'
@ -106,10 +106,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TopEdit AnchorSideTop.Control = TopEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = TopEdit AnchorSideRight.Control = TopEdit
Left = 323 Left = 317
Height = 14 Height = 18
Top = 214 Top = 222
Width = 50 Width = 56
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 3 BorderSpacing.Right = 3
Caption = 'TopLabel' Caption = 'TopLabel'
@ -119,10 +119,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = WidthEdit AnchorSideTop.Control = WidthEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = WidthEdit AnchorSideRight.Control = WidthEdit
Left = 432 Left = 423
Height = 14 Height = 18
Top = 185 Top = 189
Width = 61 Width = 70
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 3 BorderSpacing.Right = 3
Caption = 'WidthLabel' Caption = 'WidthLabel'
@ -132,10 +132,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = HeightEdit AnchorSideTop.Control = HeightEdit
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = HeightEdit AnchorSideRight.Control = HeightEdit
Left = 426 Left = 416
Height = 14 Height = 18
Top = 214 Top = 222
Width = 67 Width = 77
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 3 BorderSpacing.Right = 3
Caption = 'HeightLabel' Caption = 'HeightLabel'
@ -163,8 +163,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 22 Height = 22
Top = 181 Top = 185
Width = 245 Width = 276
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UseWindowManagerSettingRadioButton' Caption = 'UseWindowManagerSettingRadioButton'
Checked = True Checked = True
@ -177,8 +177,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 22 Height = 22
Top = 209 Top = 213
Width = 132 Width = 148
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'DefaultRadioButton' Caption = 'DefaultRadioButton'
TabOrder = 2 TabOrder = 2
@ -190,8 +190,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 22 Height = 22
Top = 237 Top = 241
Width = 234 Width = 261
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'RestoreWindowGeometryRadioButton' Caption = 'RestoreWindowGeometryRadioButton'
TabOrder = 3 TabOrder = 3
@ -203,8 +203,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 22 Height = 22
Top = 265 Top = 269
Width = 181 Width = 202
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'CustomPositionRadioButton' Caption = 'CustomPositionRadioButton'
TabOrder = 4 TabOrder = 4
@ -215,8 +215,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WidthEdit AnchorSideRight.Control = WidthEdit
Left = 376 Left = 376
Height = 23 Height = 27
Top = 181 Top = 185
Width = 60 Width = 60
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -229,8 +229,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = HeightEdit AnchorSideRight.Control = HeightEdit
Left = 376 Left = 376
Height = 23 Height = 27
Top = 210 Top = 218
Width = 60 Width = 60
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -244,8 +244,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideRight.Control = WindowPositionsGroupBox AnchorSideRight.Control = WindowPositionsGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 496 Left = 496
Height = 23 Height = 27
Top = 181 Top = 185
Width = 60 Width = 60
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -259,8 +259,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideRight.Control = WindowPositionsGroupBox AnchorSideRight.Control = WindowPositionsGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 496 Left = 496
Height = 23 Height = 27
Top = 210 Top = 218
Width = 60 Width = 60
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -272,10 +272,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TopEdit AnchorSideTop.Control = TopEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ApplyButton AnchorSideRight.Control = ApplyButton
Left = 315 Left = 285
Height = 25 Height = 29
Top = 239 Top = 251
Width = 156 Width = 175
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -289,10 +289,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WindowPositionsGroupBox AnchorSideRight.Control = WindowPositionsGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 477 Left = 466
Height = 25 Height = 29
Top = 239 Top = 251
Width = 79 Width = 90
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
@ -301,19 +301,6 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
OnClick = ApplyButtonClick OnClick = ApplyButtonClick
TabOrder = 10 TabOrder = 10
end end
object DockedRadioButton: TRadioButton
AnchorSideLeft.Control = WindowPositionsGroupBox
AnchorSideTop.Control = CustomPositionRadioButton
AnchorSideTop.Side = asrBottom
Left = 6
Height = 22
Top = 293
Width = 133
BorderSpacing.Around = 6
Caption = 'DockedRadioButton'
TabOrder = 11
TabStop = False
end
end end
object HideMessagesIconsCheckBox: TCheckBox[3] object HideMessagesIconsCheckBox: TCheckBox[3]
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -322,7 +309,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 0 Left = 0
Height = 22 Height = 22
Top = 44 Top = 44
Width = 192 Width = 213
Caption = 'HideMessagesIconsCheckBox' Caption = 'HideMessagesIconsCheckBox'
TabOrder = 3 TabOrder = 3
end end
@ -333,7 +320,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 0 Left = 0
Height = 22 Height = 22
Top = 66 Top = 66
Width = 200 Width = 223
Caption = 'TitleStartsWithProjectCheckBox' Caption = 'TitleStartsWithProjectCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -346,7 +333,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 0 Left = 0
Height = 22 Height = 22
Top = 88 Top = 88
Width = 200 Width = 205
Caption = 'ProjectDirInIdeTitleCheckBox' Caption = 'ProjectDirInIdeTitleCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True

View File

@ -38,7 +38,6 @@ type
Bevel2: TBevel; Bevel2: TBevel;
CustomPositionRadioButton: TRadioButton; CustomPositionRadioButton: TRadioButton;
DefaultRadioButton: TRadioButton; DefaultRadioButton: TRadioButton;
DockedRadioButton: TRadioButton;
GetWindowPositionButton: TButton; GetWindowPositionButton: TButton;
HeightEdit: TSpinEdit; HeightEdit: TSpinEdit;
HeightLabel: TLabel; HeightLabel: TLabel;
@ -132,7 +131,6 @@ begin
UseWindowManagerSettingRadioButton.Caption := rsiwpUseWindowManagerSetting; UseWindowManagerSettingRadioButton.Caption := rsiwpUseWindowManagerSetting;
DefaultRadioButton.Caption := rsiwpDefault; DefaultRadioButton.Caption := rsiwpDefault;
RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry; RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry;
DockedRadioButton.Caption := rsiwpDocked;
CustomPositionRadioButton.Caption := rsiwpCustomPosition; CustomPositionRadioButton.Caption := rsiwpCustomPosition;
end; end;
@ -173,7 +171,6 @@ begin
iwpDefault: Result := DefaultRadioButton; iwpDefault: Result := DefaultRadioButton;
iwpCustomPosition: Result := CustomPositionRadioButton; iwpCustomPosition: Result := CustomPositionRadioButton;
iwpUseWindowManagerSetting: Result := UseWindowManagerSettingRadioButton; iwpUseWindowManagerSetting: Result := UseWindowManagerSettingRadioButton;
iwpDocked: Result := DockedRadioButton;
else else
Result := nil; Result := nil;
end; end;
@ -241,7 +238,7 @@ end;
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject); procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
begin begin
SaveLayout; SaveLayout;
Layout.Apply; Layout.ApplyOld;
end; end;
procedure TWindowOptionsFrame.GetWindowPositionButtonClick(Sender: TObject); procedure TWindowOptionsFrame.GetWindowPositionButtonClick(Sender: TObject);

View File

@ -33,9 +33,9 @@ unit IDEOptionDefs;
interface interface
uses uses
Classes, SysUtils, Laz_XMLCfg, LCLProc, FileUtil, Classes, SysUtils, types, Laz_XMLCfg, LCLProc, FileUtil,
Forms, Controls, StdCtrls, Buttons, BaseIDEIntf, LazConfigStorage, Forms, Controls, StdCtrls, Buttons, BaseIDEIntf, LazConfigStorage,
LazConf, LazarusIDEStrConsts; IDEWindowIntf, LazConf, LazarusIDEStrConsts;
type type
{ TXMLOptionsStorage } { TXMLOptionsStorage }
@ -156,7 +156,6 @@ type
iwpDefault, // set window to the default position iwpDefault, // set window to the default position
iwpRestoreWindowGeometry, // save window geometry at end and restore it iwpRestoreWindowGeometry, // save window geometry at end and restore it
// at start // at start
iwpDocked, // dock into other IDE window
iwpCustomPosition, // set window to custom position iwpCustomPosition, // set window to custom position
iwpRestoreWindowSize // save window size at end and restore it iwpRestoreWindowSize // save window size at end and restore it
// at start // at start
@ -216,7 +215,7 @@ type
constructor Create; constructor Create;
destructor Destroy; override; destructor Destroy; override;
procedure Clear; procedure Clear;
procedure Apply; procedure ApplyOld;
procedure GetCurrentPosition; procedure GetCurrentPosition;
procedure Assign(Layout: TSimpleWindowLayout); procedure Assign(Layout: TSimpleWindowLayout);
procedure ReadCurrentCoordinates; procedure ReadCurrentCoordinates;
@ -265,8 +264,9 @@ type
public public
procedure Clear; override; procedure Clear; override;
procedure Delete(Index: Integer); procedure Delete(Index: Integer);
procedure ApplyAll; procedure ApplyOld(AForm: TCustomForm; const ID: string);
procedure Apply(AForm: TCustomForm; const ID: string); procedure NewApplyAndShow(Sender: TObject; AForm: TCustomForm;
BringToFront: boolean);
procedure StoreWindowPositions; procedure StoreWindowPositions;
procedure Assign(SrcList: TSimpleWindowLayoutList); procedure Assign(SrcList: TSimpleWindowLayoutList);
function IndexOf(const FormID: string): integer; function IndexOf(const FormID: string): integer;
@ -290,7 +290,6 @@ const
'UseWindowManagerSetting', 'UseWindowManagerSetting',
'Default', 'Default',
'RestoreWindowGeometry', 'RestoreWindowGeometry',
'Docked',
'CustomPosition', 'CustomPosition',
'RestoreWindowSize' 'RestoreWindowSize'
); );
@ -651,7 +650,7 @@ begin
fFormID:=AValue; fFormID:=AValue;
end; end;
procedure TSimpleWindowLayout.Apply; procedure TSimpleWindowLayout.ApplyOld;
begin begin
if Assigned(OnApply) then OnApply(Self); if Assigned(OnApply) then OnApply(Self);
end; end;
@ -816,21 +815,147 @@ begin
ALayout.CloseForm; ALayout.CloseForm;
end; end;
procedure TSimpleWindowLayoutList.ApplyAll; procedure TSimpleWindowLayoutList.ApplyOld(AForm: TCustomForm; const ID: string);
var i: integer;
begin
for i:=0 to Count-1 do
Items[i].Apply;
end;
procedure TSimpleWindowLayoutList.Apply(AForm: TCustomForm; const ID: string);
var ALayout: TSimpleWindowLayout; var ALayout: TSimpleWindowLayout;
begin begin
ALayout:=ItemByFormID(ID); ALayout:=ItemByFormID(ID);
if ALayout=nil then if ALayout=nil then
RaiseGDBException(ID); RaiseGDBException(ID);
ALayout.Form:=AForm; ALayout.Form:=AForm;
ALayout.Apply; ALayout.ApplyOld;
end;
procedure TSimpleWindowLayoutList.NewApplyAndShow(Sender: TObject;
AForm: TCustomForm; BringToFront: boolean);
var
ALayout: TSimpleWindowLayout;
SubIndex: Integer;
WindowType: TNonModalIDEWindow;
NewBounds: TRect;
Creator: TIDEWindowCreator;
DockSiblingName: string;
DockAlign: TAlign;
DockSibling: TCustomForm;
DockSiblingBounds: TRect;
Offset: TPoint;
begin
try
ALayout:=ItemByFormID(AForm.Name);
if ALayout<>nil then
begin
ALayout.Form:=AForm;
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormID);
SubIndex := -1;
if WindowType = nmiwNone then begin
WindowType:=NonModalIDEFormIDToEnum(ALayout.FormBaseID(SubIndex));
end;
case ALayout.WindowPlacement of
iwpCustomPosition,iwpRestoreWindowGeometry:
begin
//DebugLn(['TMainIDE.OnApplyWindowLayout ',IDEWindowStateNames[ALayout.WindowState]]);
case ALayout.WindowState of
iwsMinimized: AForm.WindowState:=wsMinimized;
iwsMaximized: AForm.WindowState:=wsMaximized;
end;
if (ALayout.CustomCoordinatesAreValid) then begin
// explicit position
NewBounds:=Bounds(ALayout.Left,ALayout.Top,ALayout.Width,ALayout.Height);
// set minimum size
if NewBounds.Right-NewBounds.Left<20 then
NewBounds.Right:=NewBounds.Left+20;
if NewBounds.Bottom-NewBounds.Top<20 then
NewBounds.Bottom:=NewBounds.Top+20;
// move to visible area
if NewBounds.Right<20 then
OffsetRect(NewBounds,20-NewBounds.Right,0);
if NewBounds.Bottom<20 then
OffsetRect(NewBounds,0,20-NewBounds.Bottom);
if NewBounds.Left>Screen.DesktopWidth-20 then
OffsetRect(NewBounds,NewBounds.Left-(Screen.DesktopWidth-20),0);
if NewBounds.Top>Screen.DesktopHeight-20 then
OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
// set bounds (do not use SetRestoredBounds - that flickers with the current LCL implementation)
AForm.SetBounds(
NewBounds.Left,NewBounds.Top,
NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
exit;
end;
if ALayout.WindowState in [iwsMinimized, iwsMaximized] then
exit;
end;
iwpUseWindowManagerSetting:
begin
exit;
end;
end;
end;
// no layout found => use default
Creator:=IDEWindowCreators.FindWithName(AForm.Name);
if Creator<>nil then
begin
if Creator.OnGetLayout<>nil then
Creator.OnGetLayout(Self,AForm.Name,NewBounds,DockSiblingName,DockAlign)
else begin
Creator.GetDefaultBounds(AForm,NewBounds);
DockSiblingName:=Creator.DockSibling;
DockAlign:=Creator.DockAlign;
end;
if DockSiblingName<>'' then
begin
DockSibling:=Screen.FindForm(DockSiblingName);
if DockSibling<>nil then
begin
DockSiblingBounds:=DockSibling.BoundsRect;
if DockSibling.Parent<>nil then
begin
Offset:=DockSibling.ClientToScreen(Point(0,0));
OffsetRect(DockSiblingBounds,Offset.X,Offset.Y);
end;
case DockAlign of
alLeft:
begin
NewBounds.Top:=DockSiblingBounds.Top;
NewBounds.Bottom:=DockSiblingBounds.Bottom;
OffsetRect(NewBounds,DockSiblingBounds.Left-NewBounds.Right,0);
end;
alRight:
begin
NewBounds.Top:=DockSiblingBounds.Top;
NewBounds.Bottom:=DockSiblingBounds.Bottom;
OffsetRect(NewBounds,DockSiblingBounds.Right-NewBounds.Left,0);
end;
alTop:
begin
NewBounds.Left:=DockSiblingBounds.Left;
NewBounds.Right:=DockSiblingBounds.Right;
OffsetRect(NewBounds,0,DockSiblingBounds.Top-NewBounds.Bottom);
end;
alBottom:
begin
NewBounds.Left:=DockSiblingBounds.Left;
NewBounds.Right:=DockSiblingBounds.Right;
OffsetRect(NewBounds,0,DockSiblingBounds.Bottom-NewBounds.Top);
end;
alClient:
NewBounds:=DockSibling.BoundsRect;
end;
end;
end;
AForm.BoundsRect:=NewBounds;
end;
finally
if (AForm.WindowState in [wsNormal,wsMaximized]) and BringToFront then
AForm.ShowOnTop
else
AForm.Show;
end;
end; end;
procedure TSimpleWindowLayoutList.StoreWindowPositions; procedure TSimpleWindowLayoutList.StoreWindowPositions;

View File

@ -71,19 +71,11 @@ const
{ TJumpHistoryViewWin } { TJumpHistoryViewWin }
procedure TJumpHistoryViewWin.FormCreate(Sender : TObject); procedure TJumpHistoryViewWin.FormCreate(Sender : TObject);
var
ALayout: TSimpleWindowLayout;
begin begin
Caption := lisJHJumpHistory; Caption := lisJHJumpHistory;
Name := NonModalIDEWindowNames[nmiwJumpHistory]; Name := NonModalIDEWindowNames[nmiwJumpHistory];
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
ItemByEnum(nmiwJumpHistory);
ALayout.Form:=TForm(Self);
ALayout.Apply;
Application.AddOnIdleHandler(@OnIdle);
InitDisplay; InitDisplay;
Application.AddOnIdleHandler(@OnIdle);
end; end;
procedure TJumpHistoryViewWin.listHistoryClick(Sender : TObject); procedure TJumpHistoryViewWin.listHistoryClick(Sender : TObject);
begin begin

View File

@ -1225,6 +1225,7 @@ begin
Application.ShowButtonGlyphs := ShowButtonGlyphs; Application.ShowButtonGlyphs := ShowButtonGlyphs;
Application.ShowMenuGlyphs := ShowMenuGlyphs; Application.ShowMenuGlyphs := ShowMenuGlyphs;
end; end;
IDEWindowCreators.OnShowForm:=@EnvironmentOptions.IDEWindowLayoutList.NewApplyAndShow;
UpdateDefaultPascalFileExtensions; UpdateDefaultPascalFileExtensions;
EditorOpts := TEditorOptions.Create; EditorOpts := TEditorOptions.Create;
@ -1312,7 +1313,7 @@ begin
Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName); Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName);
if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then
Layout.WindowState:=iwsNormal; Layout.WindowState:=iwsNormal;
EnvironmentOptions.IDEWindowLayoutList.Apply(MainIDEBar,MainIDEBar.Name); IDEWindowCreators.ShowForm(MainIDEBar);
HiddenWindowsOnRun:=TList.Create; HiddenWindowsOnRun:=TList.Create;
@ -1450,6 +1451,7 @@ begin
FreeThenNil(CodeExplorerOptions); FreeThenNil(CodeExplorerOptions);
FreeThenNil(MiscellaneousOptions); FreeThenNil(MiscellaneousOptions);
FreeThenNil(EditorOpts); FreeThenNil(EditorOpts);
IDEWindowCreators.OnShowForm:=nil;
FreeThenNil(EnvironmentOptions); FreeThenNil(EnvironmentOptions);
FreeThenNil(IDECommandScopes); FreeThenNil(IDECommandScopes);
@ -1470,6 +1472,8 @@ end;
procedure TMainIDE.CreateOftenUsedForms; procedure TMainIDE.CreateOftenUsedForms;
begin begin
MessagesView:=TMessagesView.Create(nil); MessagesView:=TMessagesView.Create(nil);
MessagesView.OnSelectionChanged := @MessagesViewSelectionChanged;
LazFindReplaceDialog:=TLazFindReplaceDialog.Create(nil); LazFindReplaceDialog:=TLazFindReplaceDialog.Create(nil);
end; end;
@ -1936,11 +1940,7 @@ begin
NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft); NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
MakeIDEWindowDockable(ObjectInspector1); MakeIDEWindowDockable(ObjectInspector1);
EnvironmentOptions.IDEWindowLayoutList.Apply(ObjectInspector1, EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
DefaultObjectInspectorName);
with EnvironmentOptions do begin
ObjectInspectorOptions.AssignTo(ObjectInspector1);
end;
ShowAnchorDesigner:=@mnuViewAnchorEditorClicked; ShowAnchorDesigner:=@mnuViewAnchorEditorClicked;
end; end;
@ -2219,7 +2219,6 @@ procedure TMainIDE.RestoreIDEWindows;
var var
i: Integer; i: Integer;
ALayout: TSimpleWindowLayout; ALayout: TSimpleWindowLayout;
Creator: TIDEWindowCreator;
AForm: TCustomForm; AForm: TCustomForm;
begin begin
if IDEDockMaster<>nil then if IDEDockMaster<>nil then
@ -2231,27 +2230,9 @@ begin
for i:=0 to EnvironmentOptions.IDEWindowLayoutList.Count-1 do begin for i:=0 to EnvironmentOptions.IDEWindowLayoutList.Count-1 do begin
ALayout:=EnvironmentOptions.IDEWindowLayoutList[i]; ALayout:=EnvironmentOptions.IDEWindowLayoutList[i];
if not ALayout.Visible then continue; if not ALayout.Visible then continue;
AForm:=Screen.FindForm(ALayout.FormID); AForm:=IDEWindowCreators.GetForm(ALayout.FormID,true);
if AForm=nil then begin if AForm=nil then continue;
Creator:=IDEWindowCreators.FindWithName(ALayout.FormID); IDEWindowCreators.ShowForm(AForm);
if (Creator=nil) then begin
debugln(['TMainIDE.RestoreIDEWindows no creator found for ',ALayout.FormID]);
continue;
end;
if not Assigned(Creator.OnCreateForm) then begin
debugln(['TMainIDE.RestoreIDEWindows no OnCreateForm for ',ALayout.FormID]);
continue;
end;
AForm:=nil;
Creator.OnCreateForm(Self,ALayout.FormID,AForm);
if AForm=nil then begin
debugln(['TMainIDE.RestoreIDEWindows failed to create ',ALayout.FormID]);
continue;
end;
end;
EnvironmentOptions.IDEWindowLayoutList.Apply(AForm,AForm.Name);
AForm.Show;
end; end;
end; end;
@ -3419,7 +3400,7 @@ begin
if AnchorDesigner=nil then if AnchorDesigner=nil then
AnchorDesigner:=TAnchorDesigner.Create(OwningComponent); AnchorDesigner:=TAnchorDesigner.Create(OwningComponent);
if Show then if Show then
AnchorDesigner.EnsureVisible(true); IDEWindowCreators.ShowForm(AnchorDesigner);
end; end;
procedure TMainIDE.DoToggleViewComponentPalette; procedure TMainIDE.DoToggleViewComponentPalette;
@ -3614,12 +3595,12 @@ end;
Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject); Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject);
begin begin
// it was already visible, but user does not see it, try to move in view // it was already visible, but user does not see it, try to move in view
MessagesView.EnsureVisible; DoShowMessagesView;
end; end;
Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject); Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
Begin Begin
SearchResultsView.ShowOnTop; ShowSearchResultView;
End; End;
Procedure TMainIDE.mnuNewProjectClicked(Sender: TObject); Procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
@ -8912,8 +8893,6 @@ begin
end; end;
procedure TMainIDE.DoViewUnitDependencies(Show: boolean); procedure TMainIDE.DoViewUnitDependencies(Show: boolean);
var
WasVisible: boolean;
begin begin
if UnitDependenciesView=nil then begin if UnitDependenciesView=nil then begin
UnitDependenciesView:=TUnitDependenciesView.Create(OwningComponent); UnitDependenciesView:=TUnitDependenciesView.Create(OwningComponent);
@ -8922,9 +8901,7 @@ begin
UnitDependenciesView.OnGetProjectMainFilename:= UnitDependenciesView.OnGetProjectMainFilename:=
@UnitDependenciesViewGetProjectMainFilename; @UnitDependenciesViewGetProjectMainFilename;
UnitDependenciesView.OnOpenFile:=@UnitDependenciesViewOpenFile; UnitDependenciesView.OnOpenFile:=@UnitDependenciesViewOpenFile;
WasVisible:=false; end;
end else
WasVisible:=UnitDependenciesView.Visible;
if not UnitDependenciesView.RootValid then begin if not UnitDependenciesView.RootValid then begin
if Project1.MainUnitID>=0 then begin if Project1.MainUnitID>=0 then begin
@ -8937,12 +8914,7 @@ begin
end; end;
if Show then if Show then
begin IDEWindowCreators.ShowForm(UnitDependenciesView);
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwUnitDependenciesName).Apply;
UnitDependenciesView.Show;
if (not WasVisible) then
UnitDependenciesView.ShowOnTop;
end;
end; end;
procedure TMainIDE.DoViewJumpHistory(Show: boolean); procedure TMainIDE.DoViewJumpHistory(Show: boolean);
@ -8954,7 +8926,7 @@ begin
end; end;
end; end;
if Show then if Show then
JumpHistoryViewWin.ShowOnTop; IDEWindowCreators.ShowForm(JumpHistoryViewWin);
end; end;
procedure TMainIDE.DoViewUnitInfo; procedure TMainIDE.DoViewUnitInfo;
@ -8999,8 +8971,7 @@ begin
if Show then if Show then
begin begin
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwCodeExplorerName).Apply; IDEWindowCreators.ShowForm(CodeExplorerView);
CodeExplorerView.ShowOnTop;
CodeExplorerView.Refresh(true); CodeExplorerView.Refresh(true);
end; end;
end; end;
@ -9009,7 +8980,7 @@ procedure TMainIDE.DoShowCodeBrowser(Show: boolean);
begin begin
CreateCodeBrowser; CreateCodeBrowser;
if Show then if Show then
CodeBrowserView.ShowOnTop; IDEWindowCreators.ShowForm(CodeBrowserView);
end; end;
procedure TMainIDE.DoShowRestrictionBrowser(Show: boolean; procedure TMainIDE.DoShowRestrictionBrowser(Show: boolean;
@ -9020,7 +8991,7 @@ begin
RestrictionBrowserView.SetIssueName(RestrictedName); RestrictionBrowserView.SetIssueName(RestrictedName);
if Show then if Show then
RestrictionBrowserView.ShowOnTop; IDEWindowCreators.ShowForm(RestrictionBrowserView);
end; end;
procedure TMainIDE.DoShowComponentList(Show: boolean); procedure TMainIDE.DoShowComponentList(Show: boolean);
@ -10125,7 +10096,7 @@ begin
ProjInspector.LazProject:=Project1; ProjInspector.LazProject:=Project1;
end; end;
if Show then if Show then
ProjInspector.ShowOnTop; IDEWindowCreators.ShowForm(ProjInspector);
end; end;
function TMainIDE.DoCreateProjectForProgram( function TMainIDE.DoCreateProjectForProgram(
@ -12396,7 +12367,7 @@ procedure TMainIDE.DoBringToFrontFormOrInspector(ForceInspector: boolean);
procedure ShowInspector; procedure ShowInspector;
begin begin
if ObjectInspector1=nil then exit; if ObjectInspector1=nil then exit;
ObjectInspector1.ShowOnTop; IDEWindowCreators.ShowForm(ObjectInspector1);
ObjectInspector1.FocusGrid; ObjectInspector1.FocusGrid;
if FDisplayState <> high(TDisplayState) then if FDisplayState <> high(TDisplayState) then
FDisplayState:= Succ(FDisplayState); FDisplayState:= Succ(FDisplayState);
@ -12738,9 +12709,6 @@ end;
procedure TMainIDE.DoShowMessagesView; procedure TMainIDE.DoShowMessagesView;
var
WasVisible: boolean;
ALayout: TSimpleWindowLayout;
begin begin
//debugln('TMainIDE.DoShowMessagesView'); //debugln('TMainIDE.DoShowMessagesView');
if EnvironmentOptions.HideMessagesIcons then if EnvironmentOptions.HideMessagesIcons then
@ -12748,43 +12716,28 @@ begin
else else
MessagesView.MessageTreeView.Images := IDEImages.Images_12; MessagesView.MessageTreeView.Images := IDEImages.Images_12;
if not MessagesView.IsVisible then begin
WasVisible:=MessagesView.Visible;
MessagesView.Visible:=true;
if not WasVisible then begin
// don't move the messagesview, if it was already visible. // don't move the messagesview, if it was already visible.
ALayout:=EnvironmentOptions.IDEWindowLayoutList. IDEWindowCreators.ShowForm(MessagesView);
ItemByEnum(nmiwMessagesViewName); if IDEDockMaster=nil then
ALayout.Apply;
// the sourcenotebook is more interesting than the messages
// TODO: don't do this when messages content intersect the editor content
SourceEditorManager.ShowActiveWindowOnTop(False);
end;
//set the event here for the selectionchanged event
if not assigned(MessagesView.OnSelectionChanged) then
MessagesView.OnSelectionChanged := @MessagesViewSelectionChanged;
end;
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
var
WasVisible: boolean;
begin
WasVisible := SearchResultsView.Visible;
if Show then
begin
SearchResultsView.Visible:=true;
EnvironmentOptions.IDEWindowLayoutList.
ItemByEnum(nmiwSearchResultsViewName).Apply;
if not WasVisible then
// the sourcenotebook is more interesting than the messages // the sourcenotebook is more interesting than the messages
SourceEditorManager.ShowActiveWindowOnTop(False); SourceEditorManager.ShowActiveWindowOnTop(False);
end; end;
end;
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
begin
//set the event here for the selectionchanged event //set the event here for the selectionchanged event
if not assigned(SearchresultsView.OnSelectionChanged) then if not assigned(SearchresultsView.OnSelectionChanged) then
SearchresultsView.OnSelectionChanged := @SearchresultsViewSelectionChanged; SearchresultsView.OnSelectionChanged := @SearchresultsViewSelectionChanged;
if Show and (not SearchResultsView.IsVisible) then
begin
IDEWindowCreators.ShowForm(SearchResultsView);
if IDEDockMaster=nil then
// the sourcenotebook is more interesting than the messages
SourceEditorManager.ShowActiveWindowOnTop(False);
end;
end; end;
procedure TMainIDE.DoArrangeSourceEditorAndMessageView(PutOnTop: boolean); procedure TMainIDE.DoArrangeSourceEditorAndMessageView(PutOnTop: boolean);
@ -15848,7 +15801,7 @@ end;
Procedure TMainIDE.OnSrcNotebookViewJumpHistory(Sender: TObject); Procedure TMainIDE.OnSrcNotebookViewJumpHistory(Sender: TObject);
begin begin
DoViewUnitDependencies(true); DoViewJumpHistory(true);
end; end;
procedure TMainIDE.OnSrcNoteBookPopupMenu( procedure TMainIDE.OnSrcNoteBookPopupMenu(

View File

@ -338,8 +338,6 @@ begin
MsgCopyAllIDEMenuCommand.OnClick := @CopyAllMenuItemClick; MsgCopyAllIDEMenuCommand.OnClick := @CopyAllMenuItemClick;
MsgCopyAllAndHiddenIDEMenuCommand.OnClick := @CopyAllAndHiddenMenuItemClick; MsgCopyAllAndHiddenIDEMenuCommand.OnClick := @CopyAllAndHiddenMenuItemClick;
MsgSaveAllToFileIDEMenuCommand.OnClick := @SaveAllToFileMenuItemClick; MsgSaveAllToFileIDEMenuCommand.OnClick := @SaveAllToFileMenuItemClick;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
end; end;
destructor TMessagesView.Destroy; destructor TMessagesView.Destroy;

View File

@ -731,8 +731,6 @@ begin
Caption:=lisMenuProjectInspector; Caption:=lisMenuProjectInspector;
KeyPreview:=true; KeyPreview:=true;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
SetupComponents; SetupComponents;
KeyPreview:=true; KeyPreview:=true;
end; end;

View File

@ -76,8 +76,7 @@ begin
Name := NonModalIDEWindowNames[nmiwIssueBrowser]; Name := NonModalIDEWindowNames[nmiwIssueBrowser];
Caption := lisMenuViewRestrictionBrowser; Caption := lisMenuViewRestrictionBrowser;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
IssueFilterGroupBox.Caption := lisFilter; IssueFilterGroupBox.Caption := lisFilter;
NameLabel.Caption := lisCodeToolsDefsName; NameLabel.Caption := lisCodeToolsDefsName;
IssueTreeView.Images := IDEImages.Images_16; IssueTreeView.Images := IDEImages.Images_16;

View File

@ -39,8 +39,8 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs,
ComCtrls, ExtCtrls, StdCtrls, Buttons, LCLType, LCLIntf, Menus, ComCtrls, ExtCtrls, StdCtrls, Buttons, LCLType, LCLIntf, Menus,
IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory, IDEWindowIntf, IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts,
IDEProcs, Project, MainIntf, Clipbrd; InputHistory, IDEProcs, Project, MainIntf, Clipbrd;
type type
{ TLazSearchMatchPos } { TLazSearchMatchPos }
@ -211,6 +211,8 @@ type
function SearchResultsView: TSearchResultsView; function SearchResultsView: TSearchResultsView;
procedure ShowSearchResultView;
var var
OnSearchResultsViewSelectionChanged: TNotifyEvent = nil; OnSearchResultsViewSelectionChanged: TNotifyEvent = nil;
OnSearchAgainClicked: TNotifyEvent = nil; OnSearchAgainClicked: TNotifyEvent = nil;
@ -265,9 +267,12 @@ begin
Result := SearchResultsViewSingleton; Result := SearchResultsViewSingleton;
end; end;
procedure ShowSearchResultView;
begin
IDEWindowCreators.ShowForm(SearchResultsView);
end;
procedure TSearchResultsView.Form1Create(Sender: TObject); procedure TSearchResultsView.Form1Create(Sender: TObject);
var
ALayout: TSimpleWindowLayout;
begin begin
FMaxItems:=50000; FMaxItems:=50000;
@ -284,10 +289,6 @@ begin
SearchInListEdit.Hint:=rsEnterOneOrMorePhrasesThatYouWantToSearchOrFilterIn; SearchInListEdit.Hint:=rsEnterOneOrMorePhrasesThatYouWantToSearchOrFilterIn;
Name := NonModalIDEWindowNames[nmiwSearchResultsViewName]; Name := NonModalIDEWindowNames[nmiwSearchResultsViewName];
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
ItemByEnum(nmiwSearchResultsViewName);
ALayout.Form:=TForm(Self);
ALayout.Apply;
fOnSelectionChanged:= nil; fOnSelectionChanged:= nil;
ShowHint:= True; ShowHint:= True;
fMouseOverIndex:= -1; fMouseOverIndex:= -1;

View File

@ -4823,7 +4823,7 @@ begin
EnvironmentOptions.CreateWindowLayout(self.name); EnvironmentOptions.CreateWindowLayout(self.name);
EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(self.Name).Clear; EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(self.Name).Clear;
end; end;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, self.Name); EnvironmentOptions.IDEWindowLayoutList.ApplyOld(Self, self.Name);
FSourceEditorList := TList.Create; FSourceEditorList := TList.Create;

View File

@ -427,7 +427,6 @@ begin
Name:=NonModalIDEWindowNames[nmiwUnitDependenciesName]; Name:=NonModalIDEWindowNames[nmiwUnitDependenciesName];
Caption := dlgUnitDepCaption; Caption := dlgUnitDepCaption;
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
RefreshHistoryList; RefreshHistoryList;

View File

@ -23,7 +23,7 @@ unit IDEWindowIntf;
interface interface
uses uses
Classes, SysUtils, LazConfigStorage, Forms, Controls; Classes, SysUtils, LCLProc, LazConfigStorage, Forms, Controls;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// layout settings of modal forms (dialogs) in the IDE // layout settings of modal forms (dialogs) in the IDE
@ -115,6 +115,8 @@ type
var AForm: TCustomForm) of object; var AForm: TCustomForm) of object;
TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string; TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string;
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object; out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object;
TShowIDEWindowEvent = procedure(Sender: TObject; AForm: TCustomForm;
BringToFront: boolean) of object;
{ TIDEWindowCreator } { TIDEWindowCreator }
@ -157,6 +159,7 @@ type
property OnGetLayout: TGetDefaultIDEWindowLayoutEvent read FOnGetLayout property OnGetLayout: TGetDefaultIDEWindowLayoutEvent read FOnGetLayout
write FOnGetLayout; write FOnGetLayout;
procedure CheckBoundValue(s: string); procedure CheckBoundValue(s: string);
procedure GetDefaultBounds(AForm: TCustomForm; out DefBounds: TRect);
end; end;
{ TIDEWindowCreatorList } { TIDEWindowCreatorList }
@ -164,6 +167,7 @@ type
TIDEWindowCreatorList = class TIDEWindowCreatorList = class
private private
fItems: TFPList; // list of TIDEWindowCreator fItems: TFPList; // list of TIDEWindowCreator
FOnShowForm: TShowIDEWindowEvent;
function GetItems(Index: integer): TIDEWindowCreator; function GetItems(Index: integer): TIDEWindowCreator;
procedure ErrorIfFormExists(FormName: string); procedure ErrorIfFormExists(FormName: string);
public public
@ -185,6 +189,9 @@ type
procedure Delete(Index: integer); procedure Delete(Index: integer);
function IndexOfName(FormName: string): integer; function IndexOfName(FormName: string): integer;
function FindWithName(FormName: string): TIDEWindowCreator; function FindWithName(FormName: string): TIDEWindowCreator;
function GetForm(aFormName: string; AutoCreate: boolean): TCustomForm;
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean = true);
property OnShowForm: TShowIDEWindowEvent read FOnShowForm write FOnShowForm;
end; end;
var var
@ -200,6 +207,7 @@ type
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract; procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract;
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract; procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract;
procedure LoadDefaultLayout; virtual; abstract; // called before opening the first project procedure LoadDefaultLayout; virtual; abstract; // called before opening the first project
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean = true); virtual; abstract;
end; end;
var var
@ -508,6 +516,44 @@ begin
raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found'); raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found');
end; end;
procedure TIDEWindowCreator.GetDefaultBounds(AForm: TCustomForm; out
DefBounds: TRect);
var
aWidth: LongInt;
aHeight: LongInt;
begin
// left
if Left='' then
DefBounds.Left:=AForm.Left
else if Left[length(Left)]='%' then
DefBounds.Left:=Screen.Width*StrToIntDef(copy(Left,1,length(Left)-1),0) div 100
else
DefBounds.Left:=Screen.Width*StrToIntDef(Left,0);
// top
if Top='' then
DefBounds.Top:=AForm.Top
else if Top[length(Top)]='%' then
DefBounds.Top:=Screen.Height*StrToIntDef(copy(Top,1,length(Top)-1),0) div 100
else
DefBounds.Top:=Screen.Height*StrToIntDef(Top,0);
// width
if Width='' then
aWidth:=AForm.Width
else if Width[length(Width)]='%' then
aWidth:=Screen.Width*StrToIntDef(copy(Width,1,length(Width)-1),0) div 100
else
aWidth:=Screen.Width*StrToIntDef(Width,0);
DefBounds.Right:=DefBounds.Left+aWidth;
// height
if Height='' then
aHeight:=AForm.Height
else if Height[length(Height)]='%' then
aHeight:=Screen.Height*StrToIntDef(copy(Height,1,length(Height)-1),0) div 100
else
aHeight:=Screen.Height*StrToIntDef(Height,0);
DefBounds.Bottom:=DefBounds.Top+aHeight;
end;
constructor TIDEWindowCreator.Create(aFormName: string); constructor TIDEWindowCreator.Create(aFormName: string);
begin begin
FFormName:=aFormName; FFormName:=aFormName;
@ -628,6 +674,50 @@ begin
Result:=nil; Result:=nil;
end; end;
function TIDEWindowCreatorList.GetForm(aFormName: string; AutoCreate: boolean
): TCustomForm;
var
Item: TIDEWindowCreator;
begin
Result:=Screen.FindForm(aFormName);
if Result<>nil then exit;
if AutoCreate then begin
Item:=FindWithName(aFormName);
if Item=nil then begin
debugln(['TIDEWindowCreatorList.GetForm no creator for ',aFormName]);
exit;
end;
if Item.OnCreateForm=nil then begin
debugln(['TIDEWindowCreatorList.GetForm no OnCreateForm for ',aFormName]);
exit;
end;
Item.OnCreateForm(Self,aFormName,Result);
if Result=nil then begin
debugln(['TIDEWindowCreatorList.GetForm create failed for ',aFormName]);
exit;
end;
end;
end;
procedure TIDEWindowCreatorList.ShowForm(AForm: TCustomForm;
BringToFront: boolean);
begin
if AForm.IsVisible then
begin
if BringToFront then
AForm.ShowOnTop;
exit;
end;
if IDEDockMaster<>nil then
IDEDockMaster.ShowForm(AForm,BringToFront)
else if Assigned(OnShowForm) then
OnShowForm(Self,AForm,BringToFront)
else if BringToFront then
AForm.ShowOnTop
else
AForm.Show;
end;
initialization initialization
IDEWindowCreators:=TIDEWindowCreatorList.Create; IDEWindowCreators:=TIDEWindowCreatorList.Create;
finalization finalization

View File

@ -379,8 +379,6 @@ begin
end; end;
constructor TPkgGraphExplorerDlg.Create(TheOwner: TComponent); constructor TPkgGraphExplorerDlg.Create(TheOwner: TComponent);
var
ALayout: TSimpleWindowLayout;
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
FUpdateLock:=PackageGraph.UpdateLock; FUpdateLock:=PackageGraph.UpdateLock;
@ -388,10 +386,6 @@ begin
Name:=NonModalIDEWindowNames[nmiwPkgGraphExplorer]; Name:=NonModalIDEWindowNames[nmiwPkgGraphExplorer];
Caption:=dlgPackageGraph; Caption:=dlgPackageGraph;
ALayout:=EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name);
ALayout.Form:=TForm(Self);
ALayout.Apply;
SetupComponents; SetupComponents;
end; end;

View File

@ -2645,7 +2645,7 @@ begin
PackageGraphExplorer.OnUninstallPackage:=@PackageGraphExplorerUninstallPackage; PackageGraphExplorer.OnUninstallPackage:=@PackageGraphExplorerUninstallPackage;
end; end;
if Show then if Show then
PackageGraphExplorer.ShowOnTop; IDEWindowCreators.ShowForm(PackageGraphExplorer);
end; end;
function TPkgManager.DoCloseAllPackageEditors: TModalResult; function TPkgManager.DoCloseAllPackageEditors: TModalResult;