mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-01 06:09:36 +01:00
IDE: using IDEIntf to show dockable windows
git-svn-id: trunk@25604 -
This commit is contained in:
parent
d855825819
commit
f25c0d95e5
@ -275,7 +275,6 @@ end;
|
||||
|
||||
procedure TAnchorDesigner.AnchorDesignerShow(Sender: TObject);
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
Refresh(true);
|
||||
end;
|
||||
|
||||
|
||||
@ -98,7 +98,6 @@ begin
|
||||
|
||||
Name:=NonModalIDEWindowNames[nmiwClipbrdHistoryName];
|
||||
Caption := 'Clipboard History';
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
|
||||
CopyToIDEBitBtn:=TBitBtn.Create(Self);
|
||||
with CopyToIDEBitBtn do begin
|
||||
|
||||
@ -432,8 +432,7 @@ begin
|
||||
|
||||
Name:=NonModalIDEWindowNames[nmiwCodeBrowser];
|
||||
Caption := lisCodeBrowser;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
|
||||
|
||||
ScopeGroupBox.Caption:=dlgScope;
|
||||
ScopeWithRequiredPackagesCheckBox.Caption:=lisWithRequiredPackages;
|
||||
RescanButton.Caption:=lisRescan;
|
||||
|
||||
@ -357,7 +357,6 @@ begin
|
||||
|
||||
Name:=NonModalIDEWindowNames[nmiwCodeExplorerName];
|
||||
Caption := lisMenuViewCodeExplorer;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
|
||||
MainNotebook.ActivePageComponent:=CodePage;
|
||||
|
||||
|
||||
@ -1781,11 +1781,7 @@ begin
|
||||
end;
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(CurDialog,CurDialog.Name);
|
||||
if BringToFront then
|
||||
FDialogs[ADialogType].ShowOnTop
|
||||
else
|
||||
FDialogs[ADialogType].Show;
|
||||
IDEWindowCreators.ShowForm(CurDialog,BringToFront);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -1485,8 +1485,7 @@ begin
|
||||
with NewLayout do begin
|
||||
FormID:=TheFormID;
|
||||
WindowPlacementsAllowed:=[iwpRestoreWindowGeometry,iwpDefault,
|
||||
iwpCustomPosition,iwpUseWindowManagerSetting
|
||||
{$IFDEF IDEDocking},iwpDocked{$ENDIF}];
|
||||
iwpCustomPosition,iwpUseWindowManagerSetting];
|
||||
OnApply:=@Self.InternOnApplyWindowLayout;
|
||||
DefaultWindowPlacement:=iwpRestoreWindowGeometry;
|
||||
end;
|
||||
|
||||
@ -41,7 +41,7 @@ uses
|
||||
BasicCodeTools, FileProcs, CodeAtom, CodeCache, CodeToolManager,
|
||||
Laz_DOM, Laz_XMLRead, Laz_XMLWrite,
|
||||
// IDEIntf
|
||||
ProjectIntf, LazIDEIntf, IDEHelpIntf, LazHelpIntf, Menus,
|
||||
IDEWindowIntf, ProjectIntf, LazIDEIntf, IDEHelpIntf, LazHelpIntf, Menus,
|
||||
SrcEditorIntf,
|
||||
// IDE
|
||||
IDEOptionDefs, EnvironmentOpts, PackageSystem, IDEProcs, LazarusIDEStrConsts,
|
||||
@ -215,11 +215,9 @@ begin
|
||||
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwFPDocEditorName).Apply;
|
||||
FPDocEditor.DoEditorUpdate(SourceEditorManagerIntf.ActiveEditor);
|
||||
FPDocEditor.UpdateButtons;
|
||||
FPDocEditor.Show;
|
||||
FPDocEditor.MakeFullyVisible;
|
||||
IDEWindowCreators.ShowForm(FPDocEditor);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -279,7 +277,6 @@ begin
|
||||
Application.AddOnIdleHandler(@ApplicationIdle);
|
||||
|
||||
Name := NonModalIDEWindowNames[nmiwFPDocEditorName];
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
|
||||
BoldFormatButton.LoadGlyphFromLazarusResource('formatbold');
|
||||
UnderlineFormatButton.LoadGlyphFromLazarusResource('formatunderline');
|
||||
|
||||
@ -14,7 +14,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 196
|
||||
Width = 218
|
||||
Caption = 'SingleTaskBarButtonCheckBox'
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
@ -27,7 +27,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 22
|
||||
Width = 159
|
||||
Width = 178
|
||||
Caption = 'HideIDEOnRunCheckBox'
|
||||
TabOrder = 1
|
||||
end
|
||||
@ -46,7 +46,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'WindowPositionsGroupBox'
|
||||
ClientHeight = 342
|
||||
ClientHeight = 338
|
||||
ClientWidth = 562
|
||||
TabOrder = 2
|
||||
object Bevel1: TBevel
|
||||
@ -55,7 +55,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 3
|
||||
Top = 167
|
||||
Top = 169
|
||||
Width = 50
|
||||
BorderSpacing.Left = 6
|
||||
end
|
||||
@ -66,10 +66,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = WindowPositionsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 195
|
||||
Left = 210
|
||||
Height = 3
|
||||
Top = 167
|
||||
Width = 361
|
||||
Top = 169
|
||||
Width = 346
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Right = 6
|
||||
@ -79,9 +79,9 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = WindowPositionsListBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 70
|
||||
Height = 14
|
||||
Height = 18
|
||||
Top = 161
|
||||
Width = 119
|
||||
Width = 134
|
||||
BorderSpacing.Left = 70
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'lblWindowCaption'
|
||||
@ -93,10 +93,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = LeftEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = LeftEdit
|
||||
Left = 321
|
||||
Height = 14
|
||||
Top = 185
|
||||
Width = 52
|
||||
Left = 314
|
||||
Height = 18
|
||||
Top = 189
|
||||
Width = 59
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 3
|
||||
Caption = 'LeftLabel'
|
||||
@ -106,10 +106,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = TopEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = TopEdit
|
||||
Left = 323
|
||||
Height = 14
|
||||
Top = 214
|
||||
Width = 50
|
||||
Left = 317
|
||||
Height = 18
|
||||
Top = 222
|
||||
Width = 56
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 3
|
||||
Caption = 'TopLabel'
|
||||
@ -119,10 +119,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = WidthEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = WidthEdit
|
||||
Left = 432
|
||||
Height = 14
|
||||
Top = 185
|
||||
Width = 61
|
||||
Left = 423
|
||||
Height = 18
|
||||
Top = 189
|
||||
Width = 70
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 3
|
||||
Caption = 'WidthLabel'
|
||||
@ -132,10 +132,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = HeightEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = HeightEdit
|
||||
Left = 426
|
||||
Height = 14
|
||||
Top = 214
|
||||
Width = 67
|
||||
Left = 416
|
||||
Height = 18
|
||||
Top = 222
|
||||
Width = 77
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 3
|
||||
Caption = 'HeightLabel'
|
||||
@ -163,8 +163,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 181
|
||||
Width = 245
|
||||
Top = 185
|
||||
Width = 276
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'UseWindowManagerSettingRadioButton'
|
||||
Checked = True
|
||||
@ -177,8 +177,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 209
|
||||
Width = 132
|
||||
Top = 213
|
||||
Width = 148
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'DefaultRadioButton'
|
||||
TabOrder = 2
|
||||
@ -190,8 +190,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 237
|
||||
Width = 234
|
||||
Top = 241
|
||||
Width = 261
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'RestoreWindowGeometryRadioButton'
|
||||
TabOrder = 3
|
||||
@ -203,8 +203,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 22
|
||||
Top = 265
|
||||
Width = 181
|
||||
Top = 269
|
||||
Width = 202
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'CustomPositionRadioButton'
|
||||
TabOrder = 4
|
||||
@ -215,8 +215,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = WidthEdit
|
||||
Left = 376
|
||||
Height = 23
|
||||
Top = 181
|
||||
Height = 27
|
||||
Top = 185
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -229,8 +229,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = HeightEdit
|
||||
Left = 376
|
||||
Height = 23
|
||||
Top = 210
|
||||
Height = 27
|
||||
Top = 218
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -244,8 +244,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideRight.Control = WindowPositionsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 496
|
||||
Height = 23
|
||||
Top = 181
|
||||
Height = 27
|
||||
Top = 185
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -259,8 +259,8 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideRight.Control = WindowPositionsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 496
|
||||
Height = 23
|
||||
Top = 210
|
||||
Height = 27
|
||||
Top = 218
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
@ -272,10 +272,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Control = TopEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ApplyButton
|
||||
Left = 315
|
||||
Height = 25
|
||||
Top = 239
|
||||
Width = 156
|
||||
Left = 285
|
||||
Height = 29
|
||||
Top = 251
|
||||
Width = 175
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -289,10 +289,10 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = WindowPositionsGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 477
|
||||
Height = 25
|
||||
Top = 239
|
||||
Width = 79
|
||||
Left = 466
|
||||
Height = 29
|
||||
Top = 251
|
||||
Width = 90
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
@ -301,19 +301,6 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
OnClick = ApplyButtonClick
|
||||
TabOrder = 10
|
||||
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
|
||||
object HideMessagesIconsCheckBox: TCheckBox[3]
|
||||
AnchorSideLeft.Control = Owner
|
||||
@ -322,7 +309,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 44
|
||||
Width = 192
|
||||
Width = 213
|
||||
Caption = 'HideMessagesIconsCheckBox'
|
||||
TabOrder = 3
|
||||
end
|
||||
@ -333,7 +320,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 66
|
||||
Width = 200
|
||||
Width = 223
|
||||
Caption = 'TitleStartsWithProjectCheckBox'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
@ -346,7 +333,7 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 88
|
||||
Width = 200
|
||||
Width = 205
|
||||
Caption = 'ProjectDirInIdeTitleCheckBox'
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
|
||||
@ -38,7 +38,6 @@ type
|
||||
Bevel2: TBevel;
|
||||
CustomPositionRadioButton: TRadioButton;
|
||||
DefaultRadioButton: TRadioButton;
|
||||
DockedRadioButton: TRadioButton;
|
||||
GetWindowPositionButton: TButton;
|
||||
HeightEdit: TSpinEdit;
|
||||
HeightLabel: TLabel;
|
||||
@ -132,7 +131,6 @@ begin
|
||||
UseWindowManagerSettingRadioButton.Caption := rsiwpUseWindowManagerSetting;
|
||||
DefaultRadioButton.Caption := rsiwpDefault;
|
||||
RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry;
|
||||
DockedRadioButton.Caption := rsiwpDocked;
|
||||
CustomPositionRadioButton.Caption := rsiwpCustomPosition;
|
||||
end;
|
||||
|
||||
@ -173,7 +171,6 @@ begin
|
||||
iwpDefault: Result := DefaultRadioButton;
|
||||
iwpCustomPosition: Result := CustomPositionRadioButton;
|
||||
iwpUseWindowManagerSetting: Result := UseWindowManagerSettingRadioButton;
|
||||
iwpDocked: Result := DockedRadioButton;
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
@ -241,7 +238,7 @@ end;
|
||||
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
|
||||
begin
|
||||
SaveLayout;
|
||||
Layout.Apply;
|
||||
Layout.ApplyOld;
|
||||
end;
|
||||
|
||||
procedure TWindowOptionsFrame.GetWindowPositionButtonClick(Sender: TObject);
|
||||
|
||||
@ -33,9 +33,9 @@ unit IDEOptionDefs;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Laz_XMLCfg, LCLProc, FileUtil,
|
||||
Classes, SysUtils, types, Laz_XMLCfg, LCLProc, FileUtil,
|
||||
Forms, Controls, StdCtrls, Buttons, BaseIDEIntf, LazConfigStorage,
|
||||
LazConf, LazarusIDEStrConsts;
|
||||
IDEWindowIntf, LazConf, LazarusIDEStrConsts;
|
||||
|
||||
type
|
||||
{ TXMLOptionsStorage }
|
||||
@ -156,7 +156,6 @@ type
|
||||
iwpDefault, // set window to the default position
|
||||
iwpRestoreWindowGeometry, // save window geometry at end and restore it
|
||||
// at start
|
||||
iwpDocked, // dock into other IDE window
|
||||
iwpCustomPosition, // set window to custom position
|
||||
iwpRestoreWindowSize // save window size at end and restore it
|
||||
// at start
|
||||
@ -216,7 +215,7 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure Apply;
|
||||
procedure ApplyOld;
|
||||
procedure GetCurrentPosition;
|
||||
procedure Assign(Layout: TSimpleWindowLayout);
|
||||
procedure ReadCurrentCoordinates;
|
||||
@ -265,8 +264,9 @@ type
|
||||
public
|
||||
procedure Clear; override;
|
||||
procedure Delete(Index: Integer);
|
||||
procedure ApplyAll;
|
||||
procedure Apply(AForm: TCustomForm; const ID: string);
|
||||
procedure ApplyOld(AForm: TCustomForm; const ID: string);
|
||||
procedure NewApplyAndShow(Sender: TObject; AForm: TCustomForm;
|
||||
BringToFront: boolean);
|
||||
procedure StoreWindowPositions;
|
||||
procedure Assign(SrcList: TSimpleWindowLayoutList);
|
||||
function IndexOf(const FormID: string): integer;
|
||||
@ -290,7 +290,6 @@ const
|
||||
'UseWindowManagerSetting',
|
||||
'Default',
|
||||
'RestoreWindowGeometry',
|
||||
'Docked',
|
||||
'CustomPosition',
|
||||
'RestoreWindowSize'
|
||||
);
|
||||
@ -651,7 +650,7 @@ begin
|
||||
fFormID:=AValue;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayout.Apply;
|
||||
procedure TSimpleWindowLayout.ApplyOld;
|
||||
begin
|
||||
if Assigned(OnApply) then OnApply(Self);
|
||||
end;
|
||||
@ -816,21 +815,147 @@ begin
|
||||
ALayout.CloseForm;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayoutList.ApplyAll;
|
||||
var i: integer;
|
||||
begin
|
||||
for i:=0 to Count-1 do
|
||||
Items[i].Apply;
|
||||
end;
|
||||
|
||||
procedure TSimpleWindowLayoutList.Apply(AForm: TCustomForm; const ID: string);
|
||||
procedure TSimpleWindowLayoutList.ApplyOld(AForm: TCustomForm; const ID: string);
|
||||
var ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
ALayout:=ItemByFormID(ID);
|
||||
if ALayout=nil then
|
||||
RaiseGDBException(ID);
|
||||
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;
|
||||
|
||||
procedure TSimpleWindowLayoutList.StoreWindowPositions;
|
||||
|
||||
@ -71,19 +71,11 @@ const
|
||||
{ TJumpHistoryViewWin }
|
||||
|
||||
procedure TJumpHistoryViewWin.FormCreate(Sender : TObject);
|
||||
var
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
Caption := lisJHJumpHistory;
|
||||
Name := NonModalIDEWindowNames[nmiwJumpHistory];
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwJumpHistory);
|
||||
ALayout.Form:=TForm(Self);
|
||||
ALayout.Apply;
|
||||
|
||||
Application.AddOnIdleHandler(@OnIdle);
|
||||
|
||||
InitDisplay;
|
||||
Application.AddOnIdleHandler(@OnIdle);
|
||||
end;
|
||||
procedure TJumpHistoryViewWin.listHistoryClick(Sender : TObject);
|
||||
begin
|
||||
|
||||
117
ide/main.pp
117
ide/main.pp
@ -1225,6 +1225,7 @@ begin
|
||||
Application.ShowButtonGlyphs := ShowButtonGlyphs;
|
||||
Application.ShowMenuGlyphs := ShowMenuGlyphs;
|
||||
end;
|
||||
IDEWindowCreators.OnShowForm:=@EnvironmentOptions.IDEWindowLayoutList.NewApplyAndShow;
|
||||
UpdateDefaultPascalFileExtensions;
|
||||
|
||||
EditorOpts := TEditorOptions.Create;
|
||||
@ -1312,7 +1313,7 @@ begin
|
||||
Layout:=EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwMainIDEName);
|
||||
if not (Layout.WindowState in [iwsNormal,iwsMaximized]) then
|
||||
Layout.WindowState:=iwsNormal;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(MainIDEBar,MainIDEBar.Name);
|
||||
IDEWindowCreators.ShowForm(MainIDEBar);
|
||||
|
||||
HiddenWindowsOnRun:=TList.Create;
|
||||
|
||||
@ -1450,6 +1451,7 @@ begin
|
||||
FreeThenNil(CodeExplorerOptions);
|
||||
FreeThenNil(MiscellaneousOptions);
|
||||
FreeThenNil(EditorOpts);
|
||||
IDEWindowCreators.OnShowForm:=nil;
|
||||
FreeThenNil(EnvironmentOptions);
|
||||
FreeThenNil(IDECommandScopes);
|
||||
|
||||
@ -1470,6 +1472,8 @@ end;
|
||||
procedure TMainIDE.CreateOftenUsedForms;
|
||||
begin
|
||||
MessagesView:=TMessagesView.Create(nil);
|
||||
MessagesView.OnSelectionChanged := @MessagesViewSelectionChanged;
|
||||
|
||||
LazFindReplaceDialog:=TLazFindReplaceDialog.Create(nil);
|
||||
end;
|
||||
|
||||
@ -1936,11 +1940,7 @@ begin
|
||||
NonModalIDEWindowNames[nmiwSourceNoteBookName],alLeft);
|
||||
MakeIDEWindowDockable(ObjectInspector1);
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(ObjectInspector1,
|
||||
DefaultObjectInspectorName);
|
||||
with EnvironmentOptions do begin
|
||||
ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
||||
end;
|
||||
EnvironmentOptions.ObjectInspectorOptions.AssignTo(ObjectInspector1);
|
||||
|
||||
ShowAnchorDesigner:=@mnuViewAnchorEditorClicked;
|
||||
end;
|
||||
@ -2219,7 +2219,6 @@ procedure TMainIDE.RestoreIDEWindows;
|
||||
var
|
||||
i: Integer;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
Creator: TIDEWindowCreator;
|
||||
AForm: TCustomForm;
|
||||
begin
|
||||
if IDEDockMaster<>nil then
|
||||
@ -2231,27 +2230,9 @@ begin
|
||||
for i:=0 to EnvironmentOptions.IDEWindowLayoutList.Count-1 do begin
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList[i];
|
||||
if not ALayout.Visible then continue;
|
||||
AForm:=Screen.FindForm(ALayout.FormID);
|
||||
if AForm=nil then begin
|
||||
Creator:=IDEWindowCreators.FindWithName(ALayout.FormID);
|
||||
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;
|
||||
AForm:=IDEWindowCreators.GetForm(ALayout.FormID,true);
|
||||
if AForm=nil then continue;
|
||||
IDEWindowCreators.ShowForm(AForm);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -3419,7 +3400,7 @@ begin
|
||||
if AnchorDesigner=nil then
|
||||
AnchorDesigner:=TAnchorDesigner.Create(OwningComponent);
|
||||
if Show then
|
||||
AnchorDesigner.EnsureVisible(true);
|
||||
IDEWindowCreators.ShowForm(AnchorDesigner);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoToggleViewComponentPalette;
|
||||
@ -3614,12 +3595,12 @@ end;
|
||||
Procedure TMainIDE.mnuViewMessagesClick(Sender: TObject);
|
||||
begin
|
||||
// it was already visible, but user does not see it, try to move in view
|
||||
MessagesView.EnsureVisible;
|
||||
DoShowMessagesView;
|
||||
end;
|
||||
|
||||
Procedure TMainIDE.mnuViewSearchResultsClick(Sender: TObject);
|
||||
Begin
|
||||
SearchResultsView.ShowOnTop;
|
||||
ShowSearchResultView;
|
||||
End;
|
||||
|
||||
Procedure TMainIDE.mnuNewProjectClicked(Sender: TObject);
|
||||
@ -8912,8 +8893,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewUnitDependencies(Show: boolean);
|
||||
var
|
||||
WasVisible: boolean;
|
||||
begin
|
||||
if UnitDependenciesView=nil then begin
|
||||
UnitDependenciesView:=TUnitDependenciesView.Create(OwningComponent);
|
||||
@ -8922,9 +8901,7 @@ begin
|
||||
UnitDependenciesView.OnGetProjectMainFilename:=
|
||||
@UnitDependenciesViewGetProjectMainFilename;
|
||||
UnitDependenciesView.OnOpenFile:=@UnitDependenciesViewOpenFile;
|
||||
WasVisible:=false;
|
||||
end else
|
||||
WasVisible:=UnitDependenciesView.Visible;
|
||||
end;
|
||||
|
||||
if not UnitDependenciesView.RootValid then begin
|
||||
if Project1.MainUnitID>=0 then begin
|
||||
@ -8937,12 +8914,7 @@ begin
|
||||
end;
|
||||
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwUnitDependenciesName).Apply;
|
||||
UnitDependenciesView.Show;
|
||||
if (not WasVisible) then
|
||||
UnitDependenciesView.ShowOnTop;
|
||||
end;
|
||||
IDEWindowCreators.ShowForm(UnitDependenciesView);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewJumpHistory(Show: boolean);
|
||||
@ -8954,7 +8926,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
if Show then
|
||||
JumpHistoryViewWin.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(JumpHistoryViewWin);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoViewUnitInfo;
|
||||
@ -8999,8 +8971,7 @@ begin
|
||||
|
||||
if Show then
|
||||
begin
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByEnum(nmiwCodeExplorerName).Apply;
|
||||
CodeExplorerView.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(CodeExplorerView);
|
||||
CodeExplorerView.Refresh(true);
|
||||
end;
|
||||
end;
|
||||
@ -9009,7 +8980,7 @@ procedure TMainIDE.DoShowCodeBrowser(Show: boolean);
|
||||
begin
|
||||
CreateCodeBrowser;
|
||||
if Show then
|
||||
CodeBrowserView.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(CodeBrowserView);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowRestrictionBrowser(Show: boolean;
|
||||
@ -9020,7 +8991,7 @@ begin
|
||||
|
||||
RestrictionBrowserView.SetIssueName(RestrictedName);
|
||||
if Show then
|
||||
RestrictionBrowserView.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(RestrictionBrowserView);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowComponentList(Show: boolean);
|
||||
@ -10125,7 +10096,7 @@ begin
|
||||
ProjInspector.LazProject:=Project1;
|
||||
end;
|
||||
if Show then
|
||||
ProjInspector.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(ProjInspector);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoCreateProjectForProgram(
|
||||
@ -12396,7 +12367,7 @@ procedure TMainIDE.DoBringToFrontFormOrInspector(ForceInspector: boolean);
|
||||
procedure ShowInspector;
|
||||
begin
|
||||
if ObjectInspector1=nil then exit;
|
||||
ObjectInspector1.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(ObjectInspector1);
|
||||
ObjectInspector1.FocusGrid;
|
||||
if FDisplayState <> high(TDisplayState) then
|
||||
FDisplayState:= Succ(FDisplayState);
|
||||
@ -12738,9 +12709,6 @@ end;
|
||||
|
||||
|
||||
procedure TMainIDE.DoShowMessagesView;
|
||||
var
|
||||
WasVisible: boolean;
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
//debugln('TMainIDE.DoShowMessagesView');
|
||||
if EnvironmentOptions.HideMessagesIcons then
|
||||
@ -12748,43 +12716,28 @@ begin
|
||||
else
|
||||
MessagesView.MessageTreeView.Images := IDEImages.Images_12;
|
||||
|
||||
|
||||
WasVisible:=MessagesView.Visible;
|
||||
MessagesView.Visible:=true;
|
||||
if not WasVisible then begin
|
||||
if not MessagesView.IsVisible then begin
|
||||
// don't move the messagesview, if it was already visible.
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwMessagesViewName);
|
||||
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
|
||||
IDEWindowCreators.ShowForm(MessagesView);
|
||||
if IDEDockMaster=nil then
|
||||
// the sourcenotebook is more interesting than the messages
|
||||
SourceEditorManager.ShowActiveWindowOnTop(False);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.DoShowSearchResultsView(Show: boolean);
|
||||
begin
|
||||
//set the event here for the selectionchanged event
|
||||
if not assigned(SearchresultsView.OnSelectionChanged) then
|
||||
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;
|
||||
|
||||
procedure TMainIDE.DoArrangeSourceEditorAndMessageView(PutOnTop: boolean);
|
||||
@ -15848,7 +15801,7 @@ end;
|
||||
|
||||
Procedure TMainIDE.OnSrcNotebookViewJumpHistory(Sender: TObject);
|
||||
begin
|
||||
DoViewUnitDependencies(true);
|
||||
DoViewJumpHistory(true);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnSrcNoteBookPopupMenu(
|
||||
|
||||
@ -338,8 +338,6 @@ begin
|
||||
MsgCopyAllIDEMenuCommand.OnClick := @CopyAllMenuItemClick;
|
||||
MsgCopyAllAndHiddenIDEMenuCommand.OnClick := @CopyAllAndHiddenMenuItemClick;
|
||||
MsgSaveAllToFileIDEMenuCommand.OnClick := @SaveAllToFileMenuItemClick;
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
end;
|
||||
|
||||
destructor TMessagesView.Destroy;
|
||||
|
||||
@ -731,8 +731,6 @@ begin
|
||||
Caption:=lisMenuProjectInspector;
|
||||
KeyPreview:=true;
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
|
||||
SetupComponents;
|
||||
KeyPreview:=true;
|
||||
end;
|
||||
|
||||
@ -76,8 +76,7 @@ begin
|
||||
|
||||
Name := NonModalIDEWindowNames[nmiwIssueBrowser];
|
||||
Caption := lisMenuViewRestrictionBrowser;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
|
||||
|
||||
IssueFilterGroupBox.Caption := lisFilter;
|
||||
NameLabel.Caption := lisCodeToolsDefsName;
|
||||
IssueTreeView.Images := IDEImages.Images_16;
|
||||
|
||||
@ -39,8 +39,8 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs,
|
||||
ComCtrls, ExtCtrls, StdCtrls, Buttons, LCLType, LCLIntf, Menus,
|
||||
IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts, InputHistory,
|
||||
IDEProcs, Project, MainIntf, Clipbrd;
|
||||
IDEWindowIntf, IDEOptionDefs, LazarusIDEStrConsts, EnvironmentOpts,
|
||||
InputHistory, IDEProcs, Project, MainIntf, Clipbrd;
|
||||
|
||||
type
|
||||
{ TLazSearchMatchPos }
|
||||
@ -211,6 +211,8 @@ type
|
||||
|
||||
function SearchResultsView: TSearchResultsView;
|
||||
|
||||
procedure ShowSearchResultView;
|
||||
|
||||
var
|
||||
OnSearchResultsViewSelectionChanged: TNotifyEvent = nil;
|
||||
OnSearchAgainClicked: TNotifyEvent = nil;
|
||||
@ -265,9 +267,12 @@ begin
|
||||
Result := SearchResultsViewSingleton;
|
||||
end;
|
||||
|
||||
procedure ShowSearchResultView;
|
||||
begin
|
||||
IDEWindowCreators.ShowForm(SearchResultsView);
|
||||
end;
|
||||
|
||||
procedure TSearchResultsView.Form1Create(Sender: TObject);
|
||||
var
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
FMaxItems:=50000;
|
||||
|
||||
@ -284,10 +289,6 @@ begin
|
||||
SearchInListEdit.Hint:=rsEnterOneOrMorePhrasesThatYouWantToSearchOrFilterIn;
|
||||
|
||||
Name := NonModalIDEWindowNames[nmiwSearchResultsViewName];
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.
|
||||
ItemByEnum(nmiwSearchResultsViewName);
|
||||
ALayout.Form:=TForm(Self);
|
||||
ALayout.Apply;
|
||||
fOnSelectionChanged:= nil;
|
||||
ShowHint:= True;
|
||||
fMouseOverIndex:= -1;
|
||||
|
||||
@ -4823,7 +4823,7 @@ begin
|
||||
EnvironmentOptions.CreateWindowLayout(self.name);
|
||||
EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(self.Name).Clear;
|
||||
end;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, self.Name);
|
||||
EnvironmentOptions.IDEWindowLayoutList.ApplyOld(Self, self.Name);
|
||||
|
||||
FSourceEditorList := TList.Create;
|
||||
|
||||
|
||||
@ -427,7 +427,6 @@ begin
|
||||
|
||||
Name:=NonModalIDEWindowNames[nmiwUnitDependenciesName];
|
||||
Caption := dlgUnitDepCaption;
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self,Name);
|
||||
|
||||
RefreshHistoryList;
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ unit IDEWindowIntf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LazConfigStorage, Forms, Controls;
|
||||
Classes, SysUtils, LCLProc, LazConfigStorage, Forms, Controls;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// layout settings of modal forms (dialogs) in the IDE
|
||||
@ -115,6 +115,8 @@ type
|
||||
var AForm: TCustomForm) of object;
|
||||
TGetDefaultIDEWindowLayoutEvent = procedure(Sender: TObject; aFormName: string;
|
||||
out aBounds: TRect; out DockSibling: string; out DockAlign: TAlign) of object;
|
||||
TShowIDEWindowEvent = procedure(Sender: TObject; AForm: TCustomForm;
|
||||
BringToFront: boolean) of object;
|
||||
|
||||
{ TIDEWindowCreator }
|
||||
|
||||
@ -157,6 +159,7 @@ type
|
||||
property OnGetLayout: TGetDefaultIDEWindowLayoutEvent read FOnGetLayout
|
||||
write FOnGetLayout;
|
||||
procedure CheckBoundValue(s: string);
|
||||
procedure GetDefaultBounds(AForm: TCustomForm; out DefBounds: TRect);
|
||||
end;
|
||||
|
||||
{ TIDEWindowCreatorList }
|
||||
@ -164,6 +167,7 @@ type
|
||||
TIDEWindowCreatorList = class
|
||||
private
|
||||
fItems: TFPList; // list of TIDEWindowCreator
|
||||
FOnShowForm: TShowIDEWindowEvent;
|
||||
function GetItems(Index: integer): TIDEWindowCreator;
|
||||
procedure ErrorIfFormExists(FormName: string);
|
||||
public
|
||||
@ -185,6 +189,9 @@ type
|
||||
procedure Delete(Index: integer);
|
||||
function IndexOfName(FormName: string): integer;
|
||||
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;
|
||||
|
||||
var
|
||||
@ -200,6 +207,7 @@ type
|
||||
procedure MakeIDEWindowDockable(AControl: TWinControl); virtual; abstract;
|
||||
procedure MakeIDEWindowDockSite(AForm: TCustomForm); virtual; abstract;
|
||||
procedure LoadDefaultLayout; virtual; abstract; // called before opening the first project
|
||||
procedure ShowForm(AForm: TCustomForm; BringToFront: boolean = true); virtual; abstract;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -508,6 +516,44 @@ begin
|
||||
raise Exception.Create('TIDEWindowDefaultLayout.CheckBoundValue: expected number, but '+s+' found');
|
||||
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);
|
||||
begin
|
||||
FFormName:=aFormName;
|
||||
@ -628,6 +674,50 @@ begin
|
||||
Result:=nil;
|
||||
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
|
||||
IDEWindowCreators:=TIDEWindowCreatorList.Create;
|
||||
finalization
|
||||
|
||||
@ -379,8 +379,6 @@ begin
|
||||
end;
|
||||
|
||||
constructor TPkgGraphExplorerDlg.Create(TheOwner: TComponent);
|
||||
var
|
||||
ALayout: TSimpleWindowLayout;
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FUpdateLock:=PackageGraph.UpdateLock;
|
||||
@ -388,10 +386,6 @@ begin
|
||||
Name:=NonModalIDEWindowNames[nmiwPkgGraphExplorer];
|
||||
Caption:=dlgPackageGraph;
|
||||
|
||||
ALayout:=EnvironmentOptions.IDEWindowLayoutList.ItemByFormID(Name);
|
||||
ALayout.Form:=TForm(Self);
|
||||
ALayout.Apply;
|
||||
|
||||
SetupComponents;
|
||||
end;
|
||||
|
||||
|
||||
@ -2645,7 +2645,7 @@ begin
|
||||
PackageGraphExplorer.OnUninstallPackage:=@PackageGraphExplorerUninstallPackage;
|
||||
end;
|
||||
if Show then
|
||||
PackageGraphExplorer.ShowOnTop;
|
||||
IDEWindowCreators.ShowForm(PackageGraphExplorer);
|
||||
end;
|
||||
|
||||
function TPkgManager.DoCloseAllPackageEditors: TModalResult;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user