45
46
HeightLabel: TLabel;
46
47
HideIDEOnRunCheckBox: TCheckBox;
47
48
HideMessagesIconsCheckBox: TCheckBox;
48
50
lblWindowCaption: TLabel;
49
51
LeftEdit: TSpinEdit;
53
SplitterList: TListBox;
54
SplitterPanel: TPanel;
51
55
SingleTaskBarButtonCheckBox: TCheckBox;
52
56
RestoreWindowGeometryRadioButton: TRadioButton;
53
58
TitleStartsWithProjectCheckBox: TCheckBox;
54
59
ProjectDirInIdeTitleCheckBox: TCheckBox;
55
60
TopEdit: TSpinEdit;
61
66
WindowPositionsListBox: TListBox;
62
67
procedure ApplyButtonClick(Sender: TObject);
63
68
procedure GetWindowPositionButtonClick(Sender: TObject);
69
procedure SplitterListSelectionChange(Sender: TObject; User: boolean);
64
70
procedure WindowPositionsListBoxSelectionChange(Sender: TObject; User: boolean);
66
72
FLayouts: TSimpleWindowLayoutList;
67
73
FLayout: TSimpleWindowLayout;
74
FDivider: TSimpleWindowLayoutDividerPos;
75
FShowSimpleLayout: boolean;
68
76
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
69
77
procedure SetLayout(const AValue: TSimpleWindowLayout);
78
procedure SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
70
79
procedure SetWindowPositionsItem(Index: integer);
80
procedure SaveCurrentSplitterLayout;
71
81
procedure SaveLayout;
72
82
function GetLayoutCaption(ALayout: TSimpleWindowLayout): String;
73
83
property Layout: TSimpleWindowLayout read FLayout write SetLayout;
84
property Divider: TSimpleWindowLayoutDividerPos read FDivider write SetDivider;
75
86
constructor Create(TheOwner: TComponent); override;
76
87
destructor Destroy; override;
122
133
HideMessagesIconsCheckBox.Checked := HideMessagesIcons;
123
134
TitleStartsWithProjectCheckBox.Checked:=IDETitleStartsWithProject;
124
135
ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
128
138
FLayouts.Assign(IDEWindowCreators.SimpleLayoutStorage);
130
if IDEDockMaster=nil then begin
140
if FShowSimpleLayout then begin
131
141
// Window Positions
132
FLayouts.Assign(IDEWindowCreators.SimpleLayoutStorage);
133
142
WindowPositionsGroupBox.Parent:=Self;
134
143
WindowPositionsGroupBox.Caption := dlgWinPos;
135
144
WindowPositionsListBox.Items.BeginUpdate;
144
153
WindowPositionsListBox.Items.AddObject(GetLayoutCaption(FLayouts[j]),FLayouts[j]);
156
//WindowPositionsListBox.Sorted := True;
147
157
WindowPositionsListBox.Items.EndUpdate;
149
159
LeftLabel.Caption := dlgLeftPos;
152
162
HeightLabel.Caption := DlgHeightPos;
153
163
ApplyButton.Caption := dlgButApply;
154
164
GetWindowPositionButton.Caption := dlgGetPosition;
165
SplitLabel.Caption := dlgWidthPos;
156
167
UseWindowManagerSettingRadioButton.Caption := rsiwpUseWindowManagerSetting;
157
168
DefaultRadioButton.Caption := rsiwpDefault;
158
169
RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry;
159
170
CustomPositionRadioButton.Caption := rsiwpCustomPosition;
172
dropSplitterPlacement.Clear;
173
dropSplitterPlacement.Items.Add(rsiwpSplitterFollowWindow);
174
dropSplitterPlacement.Items.Add(rsiwpSplitterDefault);
175
dropSplitterPlacement.Items.Add(rsiwpSplitterRestoreWindowGeometry);
176
dropSplitterPlacement.Items.Add(rsiwpSplitterCustomPosition);
161
178
SetWindowPositionsItem(0);
163
180
WindowPositionsGroupBox.Parent:=nil;
198
215
APlacement: TIDEWindowPlacement;
199
216
RadioButton: TRadioButton;
202
220
FLayout := AValue;
203
if Layout=nil then Exit;
222
if Layout=nil then begin
223
SplitterPanel.Visible := False;
204
226
//debugln(['TWindowOptionsFrame.SetLayout ',Layout.FormID,' ',IDEWindowPlacementNames[Layout.WindowPlacement]]);
206
228
for APlacement := Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
244
266
GetWindowPositionButton.Enabled := (Layout.Form <> nil);
268
SplitterPanel.Visible := Layout.Dividers.NamedCount > 0;
270
for i := 0 to Layout.Dividers.NamedCount - 1 do
271
SplitterList.AddItem(Layout.Dividers.NamedItems[i].DisplayName, Layout.Dividers.NamedItems[i]);
272
if Layout.Dividers.NamedCount > 0 then
273
SplitterList.ItemIndex := 0;
276
procedure TWindowOptionsFrame.SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
279
if FDivider=nil then exit;
281
SplitEdit.Value := FDivider.Size;
282
case FDivider.Placement of
283
iwpdUseWindowSetting: dropSplitterPlacement.ItemIndex := 0;
284
iwpdDefault: dropSplitterPlacement.ItemIndex := 1;
285
iwpdRestore: dropSplitterPlacement.ItemIndex := 2;
286
iwpdCustomSize: dropSplitterPlacement.ItemIndex := 3;
247
290
procedure TWindowOptionsFrame.WindowPositionsListBoxSelectionChange(
254
297
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
259
if (Layout<>nil) and (Layout.Form<>nil) and (Layout.Form.Parent=nil)
260
and (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry])
262
if (Layout.CustomCoordinatesAreValid) then begin
264
NewBounds:=Bounds(Layout.Left,Layout.Top,Layout.Width,Layout.Height);
266
if NewBounds.Right-NewBounds.Left<20 then
267
NewBounds.Right:=NewBounds.Left+20;
268
if NewBounds.Bottom-NewBounds.Top<20 then
269
NewBounds.Bottom:=NewBounds.Top+20;
270
// move to visible area
271
if NewBounds.Right<20 then
272
OffsetRect(NewBounds,20-NewBounds.Right,0);
273
if NewBounds.Bottom<20 then
274
OffsetRect(NewBounds,0,20-NewBounds.Bottom);
275
if NewBounds.Left>Screen.DesktopWidth-20 then
276
OffsetRect(NewBounds,NewBounds.Left-(Screen.DesktopWidth-20),0);
277
if NewBounds.Top>Screen.DesktopHeight-20 then
278
OffsetRect(NewBounds,NewBounds.Top-(Screen.DesktopHeight-20),0);
279
Layout.Form.SetBounds(
280
NewBounds.Left,NewBounds.Top,
281
NewBounds.Right-NewBounds.Left,NewBounds.Bottom-NewBounds.Top);
300
if (Layout<>nil) and (Layout.Form<>nil) and (Layout.Form.Parent=nil) then begin
301
if (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry]) then begin
302
Layout.ValidateAndSetCoordinates; // Adjust bounds to screen area and apply them.
303
Layout.Applied := True;
305
Layout.ApplyDivider(True);
292
315
WidthEdit.Value := Layout.Form.Width;
293
316
HeightEdit.Value := Layout.Form.Height;
318
Layout.ReadCurrentDividers(True);
319
SplitterListSelectionChange(nil, False);
322
procedure TWindowOptionsFrame.SplitterListSelectionChange(Sender: TObject; User: boolean);
324
if User then SaveCurrentSplitterLayout;
326
if (SplitterList.Count = 0) or (SplitterList.ItemIndex < 0) then exit;
327
SetDivider(TSimpleWindowLayoutDividerPos(SplitterList.Items.Objects[SplitterList.ItemIndex]));
297
330
procedure TWindowOptionsFrame.SetWindowPositionsItem(Index: integer);
308
341
lblWindowCaption.Caption := WindowPositionsListBox.Items[Index];
344
procedure TWindowOptionsFrame.SaveCurrentSplitterLayout;
346
if FDivider = nil then exit;
347
case dropSplitterPlacement.ItemIndex of
348
0: FDivider.Placement := iwpdUseWindowSetting;
349
1: FDivider.Placement := iwpdDefault;
350
2: FDivider.Placement := iwpdRestore;
351
3: FDivider.Placement := iwpdCustomSize;
353
FDivider.Size := SplitEdit.Value;
311
356
procedure TWindowOptionsFrame.SaveLayout;
313
358
APlacement: TIDEWindowPlacement;
356
402
if Fits('UnitDependencies',dlgUnitDepCaption) then exit;
357
403
if Fits('CodeExplorerView',lisCodeExplorer) then exit;
358
404
if Fits('FPDocEditor',lisCodeHelpMainFormCaption) then exit;
359
if Fits('PkgGraphExplorer',dlgPackageGraph) then exit;
405
if Fits('PkgGraphExplorer',lisMenuPackageGraph) then exit;
360
406
if Fits('ProjectInspector',lisMenuProjectInspector) then exit;
361
407
if Fits('DbgOutput',lisMenuViewDebugOutput) then exit;
362
408
if Fits('DbgEvents',lisMenuViewDebugEvents) then exit;
370
416
if Fits('Inspect',lisInspectDialog) then exit;
371
417
if Fits('SearchResults',lisMenuViewSearchResults) then exit;
372
418
if Fits('AnchorEditor',lisMenuViewAnchorEditor) then exit;
419
if Fits('TabOrderEditor',lisMenuViewTabOrder) then exit;
373
420
if Fits('CodeBrowser',lisCodeBrowser) then exit;
374
421
if Fits('IssueBrowser',lisMenuViewRestrictionBrowser) then exit;
375
422
if Fits('JumpHistory',lisJHJumpHistory) then exit;
423
if Fits('PseudoTerminal', lisMenuViewPseudoTerminal) then exit;
424
if Fits('Threads', lisMenuViewThreads) then exit;
425
if Fits('DbgHistory', lisMenuViewHistory) then exit;
426
if Fits('ComponentList', lisFPComponents) then exit;
376
427
Result:=ALayout.FormCaption;