IDE: Remove IDE Options -> Environment -> Windows -> Window Positons. Issue #29742

git-svn-id: trunk@56907 -
This commit is contained in:
ondrej 2018-01-01 20:26:46 +00:00
parent 089d2c7493
commit c038b06190
4 changed files with 49 additions and 898 deletions

View File

@ -110,27 +110,9 @@ type
and similar things for an IDE window or dialog, like the source editor,
the object inspector, the main bar or the message view.
}
TIDEWindowPlacement = (
iwpUseWindowManagerSetting, // leave window position, where window manager
// creates the window
iwpDefault, // set window to the default position
iwpRestoreWindowGeometry, // save window geometry at end and restore it
// at start
iwpCustomPosition, // set window to custom position
iwpRestoreWindowSize // save window size at end and restore it
// at start
);
TIDEWindowPlacements = set of TIDEWindowPlacement;
TIDEWindowState = (iwsNormal, iwsMaximized, iwsMinimized, iwsHidden);
TIDEWindowStates = set of TIDEWindowState;
TSimpleWindowLayoutDividerPosPlacement = (
iwpdDefault, // set column/row/splitter to the default size
iwpdCustomSize, // set column/row/splitter to the custom size
iwpdRestore, // save column/row/splitter size on exit, and restore
iwpdUseWindowSetting
);
TSimpleWindowLayoutDividerPosSizeGetter =
function(AForm: TCustomForm; AColId: Integer; var ASize: Integer): Boolean;
@ -145,7 +127,6 @@ type
FDisplayName: PString;
FId: Integer;
FIdString: String;
FPlacement: TSimpleWindowLayoutDividerPosPlacement;
FSize: integer;
function GetDisplayName: String;
protected
@ -161,7 +142,6 @@ type
property IdString: String read FIdString;
property Id: Integer read FId;
property DisplayName: String read GetDisplayName;
property Placement: TSimpleWindowLayoutDividerPosPlacement read FPlacement write FPlacement;
property Size: integer read FSize write FSize;
property DefaultSize: integer read FDefaultSize write FDefaultSize;
end;
@ -203,7 +183,6 @@ type
FApplied: boolean;
FFormCaption: string;
FVisible: boolean;
FWindowPlacement: TIDEWindowPlacement;
FLeft: integer;
FTop: integer;
FWidth: integer;
@ -215,7 +194,6 @@ type
FWindowState: TIDEWindowState;
FForm: TCustomForm;
FFormID: string;
FDefaultWindowPlacement: TIDEWindowPlacement;
FDividers: TSimpleWindowLayoutDividerPosList;
procedure SetForm(const AForm: TCustomForm);
function GetFormCaption: string;
@ -228,9 +206,9 @@ type
procedure Clear;
procedure GetCurrentPosition;
function Apply(const aForce: Boolean = False): Boolean;
procedure ApplyDivider(AForce: Boolean = False);
procedure ApplyDivider;
procedure Assign(Layout: TSimpleWindowLayout); reintroduce;
procedure ReadCurrentDividers(AForce: Boolean = False);
procedure ReadCurrentDividers;
procedure ReadCurrentCoordinates;
procedure ReadCurrentState;
procedure LoadFromConfig(Config: TConfigStorage; const Path: string; FileVersion: integer);
@ -244,9 +222,6 @@ type
property FormID: string read FFormID write FFormID;
function FormBaseID(out SubIndex: Integer): String; // split FormID into name+number
property FormCaption: string read GetFormCaption;
property WindowPlacement: TIDEWindowPlacement read fWindowPlacement write FWindowPlacement;
property DefaultWindowPlacement: TIDEWindowPlacement
read FDefaultWindowPlacement write FDefaultWindowPlacement;
property Left: integer read FLeft write FLeft;
property Top: integer read FTop write FTop;
property Width: integer read FWidth write FWidth;
@ -303,18 +278,10 @@ type
end;
const
IDEWindowPlacementNames: array[TIDEWindowPlacement] of string = (
'UseWindowManagerSetting',
'Default',
'RestoreWindowGeometry',
'CustomPosition',
'RestoreWindowSize'
);
IDEWindowStateNames: array[TIDEWindowState] of string = (
'Normal', 'Maximized', 'Minimized', 'Hidden'
);
function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement;
function StrToIDEWindowState(const s: string): TIDEWindowState;
type
@ -525,13 +492,6 @@ begin
AEditorDlg.PopupMode:=pmNone;
end;
function StrToIDEWindowPlacement(const s: string): TIDEWindowPlacement;
begin
for Result:=Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
if UTF8CompareText(s,IDEWindowPlacementNames[Result])=0 then exit;
Result:=iwpDefault;
end;
function StrToIDEWindowState(const s: string): TIDEWindowState;
begin
for Result:=Low(TIDEWindowState) to High(TIDEWindowState) do
@ -883,44 +843,30 @@ begin
FDisplayName := ADividerPos.FDisplayName;
FId := ADividerPos.FId;
FIdString := ADividerPos.FIdString;
FPlacement := ADividerPos.FPlacement;
FSize := ADividerPos.FSize;
end;
procedure TSimpleWindowLayoutDividerPos.LoadFromConfig(Config: TConfigStorage;
const Path: string);
var
s: String;
begin
Clear;
FIdString := Config.GetValue(Path+'ID', '');
FSize := Config.GetValue(Path+'Size', -1);
s := Config.GetValue(Path+'Placement', 'iwpdUseWindowSetting');
try
ReadStr(s, FPlacement);
except
FPlacement := iwpdUseWindowSetting;
end;
end;
function TSimpleWindowLayoutDividerPos.SaveToConfig(Config: TConfigStorage;
const Path: string): Boolean;
var
s: String;
begin
Result := (FSize <> -1) or (FPlacement <> iwpdUseWindowSetting);
Result := (FSize <> -1);
if not Result then
exit;
WriteStr(s, FPlacement);
Config.SetDeleteValue(Path+'ID', FIdString, '');
Config.SetDeleteValue(Path+'Size', FSize, -1);
Config.SetDeleteValue(Path+'Placement', s, 'iwpdUseWindowSetting');
end;
procedure TSimpleWindowLayoutDividerPos.Clear;
begin
FSize := FDefaultSize;
FPlacement := iwpdUseWindowSetting;
end;
{ TIDEDialogLayout }
@ -1186,7 +1132,6 @@ begin
inherited Create(nil);
FDividers := TSimpleWindowLayoutDividerPosList.Create;
FormID := AFormID;
fDefaultWindowPlacement := iwpRestoreWindowGeometry;
Clear;
Creator := IDEWindowCreators.FindWithName(AFormID);
if Creator <> nil then
@ -1204,7 +1149,6 @@ procedure TSimpleWindowLayout.LoadFromConfig(Config: TConfigStorage;
const Path: string; FileVersion: integer);
var
P: string;
DefaultValue: TIDEWindowPlacement;
begin
// set all values to default
Clear;
@ -1214,13 +1158,6 @@ begin
if P='' then exit;
P:=Path+P+'/';
FFormCaption := Config.GetValue(P+'Caption/Value', fFormID);
// placement
if FileVersion=1 then
DefaultValue:=iwpRestoreWindowSize
else
DefaultValue:=iwpRestoreWindowGeometry;
fWindowPlacement:=StrToIDEWindowPlacement(Config.GetValue(
P+'WindowPlacement/Value',IDEWindowPlacementNames[DefaultValue]));
// custom position
Left := Config.GetValue(P+'CustomPosition/Left', Left);
Top := Config.GetValue(P+'CustomPosition/Top', Top);
@ -1257,9 +1194,7 @@ begin
P:=Path+P+'/';
Config.SetDeleteValue(P+'Caption/Value',FFormCaption,'');
// placement
Config.SetDeleteValue(P+'WindowPlacement/Value',
IDEWindowPlacementNames[fWindowPlacement],
IDEWindowPlacementNames[iwpRestoreWindowGeometry]);
Config.DeleteValue(P+'WindowPlacement/Value');
// custom position
Config.SetDeleteValue(P+'CustomPosition/Left', Left, 0);
Config.SetDeleteValue(P+'CustomPosition/Top', Top, 0);
@ -1410,7 +1345,6 @@ begin
//debugln(['TSimpleWindowLayout.Clear ',FormID]);
fApplied := False;
fVisible := False;
fWindowPlacement:=fDefaultWindowPlacement;
fLeft:=0;
fTop:=0;
fWidth:=0;
@ -1466,20 +1400,17 @@ begin
Assert(FFormID = Layout.FFormID);
//IMPORTANT: do not assign FForm and FFormID!
FVisible:=Layout.FVisible;
FWindowPlacement:=Layout.FWindowPlacement;
FLeft:=Layout.FLeft;
FTop:=Layout.FTop;
FWidth:=Layout.FWidth;
FHeight:=Layout.FHeight;
FWindowState:=Layout.FWindowState;
FDefaultWindowPlacement:=Layout.FDefaultWindowPlacement;
FDividers.Assign(Layout.FDividers);
end;
procedure TSimpleWindowLayout.ReadCurrentDividers(AForce: Boolean = False);
procedure TSimpleWindowLayout.ReadCurrentDividers;
var
i, j: Integer;
f: Boolean;
Creator: TIDEWindowCreator;
xForm: TCustomForm;
begin
@ -1489,30 +1420,19 @@ begin
if xForm = nil then exit;
for i := 0 to FDividers.Count - 1 do begin
if FDividers[i].FId < 0 then continue;
f := AForce;
case FDividers[i].Placement of
iwpdRestore:
f := true;
iwpdUseWindowSetting:
f := WindowPlacement in [iwpRestoreWindowGeometry, iwpRestoreWindowSize];
end;
if f then begin
j:=-1;
if Creator.OnGetDividerSize(xForm, FDividers[i].Id, j) then
FDividers[i].Size := j
else
FDividers[i].Size := -1; // Default / Not Changed / Unavailable
end;
j:=-1;
if Creator.OnGetDividerSize(xForm, FDividers[i].Id, j) then
FDividers[i].Size := j
else
FDividers[i].Size := -1; // Default / Not Changed / Unavailable
end;
end;
procedure TSimpleWindowLayout.GetCurrentPosition;
begin
//debugln('TSimpleWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' ',IDEWindowPlacementNames[WindowPlacement]);
case WindowPlacement of
iwpRestoreWindowGeometry, iwpRestoreWindowSize:
ReadCurrentCoordinates;
end;
ReadCurrentCoordinates;
ReadCurrentDividers;
ReadCurrentState;
//debugln('TSimpleWindowLayout.GetCurrentPosition ',DbgSName(Self),' ',FormID,' Width=',dbgs(Width));
@ -1532,44 +1452,29 @@ begin
' ',Left,',',Top,',',Width,',',Height]);
{$ENDIF}
case WindowPlacement of
iwpCustomPosition,iwpRestoreWindowGeometry:
begin
//DebugLn(['TMainIDE.OnApplyWindowLayout ',IDEWindowStateNames[WindowState]]);
case WindowState of
iwsMinimized: xForm.WindowState:=wsMinimized;
iwsMaximized: xForm.WindowState:=wsMaximized;
end;
Result := ValidateAndSetCoordinates(aForce); // Adjust bounds to screen area and apply them.
if WindowState in [iwsMinimized, iwsMaximized] then
Result := True;
end;
iwpUseWindowManagerSetting:
Result := True;
//DebugLn(['TMainIDE.OnApplyWindowLayout ',IDEWindowStateNames[WindowState]]);
case WindowState of
iwsMinimized: xForm.WindowState:=wsMinimized;
iwsMaximized: xForm.WindowState:=wsMaximized;
end;
Result := ValidateAndSetCoordinates(aForce); // Adjust bounds to screen area and apply them.
if WindowState in [iwsMinimized, iwsMaximized] then
Result := True;
ApplyDivider(aForce);
ApplyDivider;
end;
procedure TSimpleWindowLayout.ApplyDivider(AForce: Boolean = False);
procedure TSimpleWindowLayout.ApplyDivider;
var
i: Integer;
f: Boolean;
Creator: TIDEWindowCreator;
begin
Creator:=IDEWindowCreators.FindWithName(FormID);
if (Creator <> nil) and (Creator.OnSetDividerSize <> nil) then begin
for i := 0 to FDividers.Count - 1 do begin
if (FDividers[i].FId < 0) or (FDividers[i].Size < 0) then continue;
f := AForce;
case FDividers[i].Placement of
iwpdRestore, iwpdCustomSize:
f := true;
iwpdUseWindowSetting:
f := WindowPlacement in [iwpRestoreWindowGeometry, iwpRestoreWindowSize];
end;
if f then
Creator.OnSetDividerSize(Form, FDividers[i].Id, FDividers[i].Size);
Creator.OnSetDividerSize(Form, FDividers[i].Id, FDividers[i].Size);
end;
end;
end;

View File

@ -14,9 +14,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 22
Top = 17
Width = 200
Height = 19
Top = 15
Width = 181
Caption = 'SingleTaskBarButtonCheckBox'
ParentShowHint = False
ShowHint = True
@ -28,375 +28,22 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 22
Top = 39
Width = 166
Height = 19
Top = 34
Width = 151
Caption = 'HideIDEOnRunCheckBox'
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object WindowPositionsPanel: TPanel
AnchorSideTop.Control = lblWindowPosition
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 383
Top = 197
Width = 570
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 3
Caption = 'WindowPositionsPanel'
ClientHeight = 383
ClientWidth = 570
TabOrder = 8
object LeftLabel: TLabel
AnchorSideTop.Control = LeftEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = LeftEdit
Left = 297
Height = 17
Top = 234
Width = 53
Anchors = [akTop, akRight]
BorderSpacing.Right = 3
Caption = 'LeftLabel'
ParentColor = False
end
object TopLabel: TLabel
AnchorSideTop.Control = TopEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = TopEdit
Left = 297
Height = 17
Top = 263
Width = 53
Anchors = [akTop, akRight]
BorderSpacing.Right = 3
Caption = 'TopLabel'
ParentColor = False
end
object WidthLabel: TLabel
AnchorSideTop.Control = WidthEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = WidthEdit
Left = 420
Height = 17
Top = 234
Width = 65
Anchors = [akTop, akRight]
BorderSpacing.Right = 3
Caption = 'WidthLabel'
ParentColor = False
end
object HeightLabel: TLabel
AnchorSideTop.Control = HeightEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = HeightEdit
Left = 415
Height = 17
Top = 263
Width = 70
Anchors = [akTop, akRight]
BorderSpacing.Right = 3
Caption = 'HeightLabel'
ParentColor = False
end
object WindowPositionsListBox: TListBox
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = WindowPositionsPanel
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
Left = 7
Height = 120
Top = 3
Width = 556
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 2
BorderSpacing.Right = 6
ItemHeight = 0
OnSelectionChange = WindowPositionsListBoxSelectionChange
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object LetWindowManagerDecideRadioButton: TRadioButton
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = RestoreWindowGeometryRadioButton
AnchorSideTop.Side = asrBottom
Left = 7
Height = 23
Top = 257
Width = 248
BorderSpacing.Left = 6
BorderSpacing.Top = 3
Caption = 'LetWindowManagerDecideRadioButton'
OnClick = WindowGeometryRadioButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object FixedDefaultRadioButton: TRadioButton
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = LetWindowManagerDecideRadioButton
AnchorSideTop.Side = asrBottom
Left = 7
Height = 23
Top = 283
Width = 167
BorderSpacing.Left = 6
BorderSpacing.Top = 3
Caption = 'FixedDefaultRadioButton'
OnClick = WindowGeometryRadioButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
object RestoreWindowGeometryRadioButton: TRadioButton
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = SplitterPanel
AnchorSideTop.Side = asrBottom
Left = 7
Height = 23
Top = 231
Width = 241
BorderSpacing.Left = 6
BorderSpacing.Top = 4
Caption = 'RestoreWindowGeometryRadioButton'
Checked = True
OnClick = CustomGeometryRadioButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 2
TabStop = True
end
object CustomGeometryRadioButton: TRadioButton
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = FixedDefaultRadioButton
AnchorSideTop.Side = asrBottom
Left = 7
Height = 23
Top = 309
Width = 196
BorderSpacing.Left = 6
BorderSpacing.Top = 3
Caption = 'CustomGeometryRadioButton'
OnClick = CustomGeometryRadioButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 5
end
object LeftEdit: TSpinEdit
AnchorSideTop.Control = RestoreWindowGeometryRadioButton
AnchorSideRight.Control = WidthEdit
Left = 353
Height = 23
Top = 231
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.Right = 60
MaxValue = 4096
MinValue = -5000
ParentShowHint = False
ShowHint = True
TabOrder = 6
end
object TopEdit: TSpinEdit
AnchorSideTop.Control = LeftEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = HeightEdit
Left = 353
Height = 23
Top = 260
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 60
MaxValue = 4096
MinValue = -5000
ParentShowHint = False
ShowHint = True
TabOrder = 7
end
object WidthEdit: TSpinEdit
AnchorSideTop.Control = LeftEdit
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
Left = 488
Height = 23
Top = 231
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.Right = 6
MaxValue = 4096
ParentShowHint = False
ShowHint = True
TabOrder = 8
end
object HeightEdit: TSpinEdit
AnchorSideTop.Control = WidthEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
Left = 488
Height = 23
Top = 260
Width = 75
Anchors = [akTop, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 6
MaxValue = 4096
ParentShowHint = False
ShowHint = True
TabOrder = 9
end
object GetWindowPositionButton: TButton
AnchorSideTop.Control = ApplyButton
AnchorSideRight.Control = ApplyButton
Left = 314
Height = 29
Top = 295
Width = 161
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Right = 6
Caption = 'GetWindowPositionButton'
Constraints.MinWidth = 75
OnClick = GetWindowPositionButtonClick
TabOrder = 10
end
object ApplyButton: TButton
AnchorSideTop.Control = HeightEdit
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
Left = 481
Height = 29
Top = 295
Width = 82
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 12
BorderSpacing.Right = 6
Caption = 'ApplyButton'
Constraints.MinWidth = 75
OnClick = ApplyButtonClick
TabOrder = 11
end
object SplitterPanel: TPanel
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = lblWindowCaption
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = WindowPositionsPanel
AnchorSideBottom.Side = asrBottom
Left = 5
Height = 78
Top = 149
Width = 564
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 4
BorderSpacing.Top = 3
BevelOuter = bvNone
BorderWidth = 1
BorderStyle = bsSingle
Caption = ' '
ClientHeight = 74
ClientWidth = 560
TabOrder = 1
Visible = False
object SplitterList: TListBox
AnchorSideLeft.Control = SplitterPanel
AnchorSideTop.Control = SplitterPanel
AnchorSideBottom.Control = SplitterPanel
AnchorSideBottom.Side = asrBottom
Left = 1
Height = 72
Top = 1
Width = 275
Anchors = [akTop, akLeft, akBottom]
ItemHeight = 0
OnSelectionChange = SplitterListSelectionChange
ParentShowHint = False
ShowHint = True
TabOrder = 0
end
object SplitLabel: TLabel
AnchorSideTop.Control = SplitEdit
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = SplitEdit
Left = 425
Height = 17
Top = 44
Width = 56
Anchors = [akTop, akRight]
BorderSpacing.Right = 3
Caption = 'SplitLabel'
ParentColor = False
end
object SplitEdit: TSpinEdit
AnchorSideRight.Control = SplitterPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SplitterPanel
AnchorSideBottom.Side = asrBottom
Left = 484
Height = 23
Top = 41
Width = 75
Anchors = [akRight, akBottom]
BorderSpacing.Bottom = 9
MaxValue = 5000
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object dropSplitterPlacement: TComboBox
AnchorSideLeft.Control = SplitterList
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = SplitterPanel
AnchorSideRight.Control = SplitterPanel
AnchorSideRight.Side = asrBottom
Left = 282
Height = 23
Top = 1
Width = 277
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
ItemHeight = 17
ParentShowHint = False
ShowHint = True
Style = csDropDownList
TabOrder = 1
end
end
object lblWindowCaption: TDividerBevel
AnchorSideLeft.Control = WindowPositionsPanel
AnchorSideTop.Control = WindowPositionsListBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = WindowPositionsPanel
AnchorSideRight.Side = asrBottom
Left = 1
Height = 17
Top = 129
Width = 568
Caption = 'lblWindowCaption'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Font.Style = [fsUnderline]
ParentColor = False
ParentFont = False
end
end
object TitleStartsWithProjectCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = HideIDEOnRunCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 61
Width = 204
Height = 19
Top = 53
Width = 186
Caption = 'TitleStartsWithProjectCheckBox'
ParentShowHint = False
ShowHint = True
@ -407,9 +54,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TitleStartsWithProjectCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 83
Width = 192
Height = 19
Top = 72
Width = 173
Caption = 'ProjectDirInIdeTitleCheckBox'
ParentShowHint = False
ShowHint = True
@ -420,9 +67,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = ProjectDirInIdeTitleCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 105
Width = 158
Height = 19
Top = 91
Width = 145
Caption = 'TitleIncludesBuildMode'
ParentShowHint = False
ShowHint = True
@ -433,9 +80,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TitleIncludesBuildMode
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 127
Width = 181
Height = 19
Top = 110
Width = 164
Caption = 'NameForDesignedFormList'
ParentShowHint = False
ShowHint = True
@ -447,7 +94,7 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 17
Height = 15
Top = 0
Width = 573
Caption = 'lblShowingWindows'
@ -455,30 +102,14 @@ object WindowOptionsFrame: TWindowOptionsFrame
Font.Style = [fsBold]
ParentFont = False
end
object lblWindowPosition: TDividerBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = AutoAdjustIDEHeightFullCompPalCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 17
Top = 177
Width = 573
Caption = 'lblWindowPosition'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Font.Style = [fsBold]
ParentFont = False
end
object AutoAdjustIDEHeightCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = NameForDesignedFormList
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 149
Width = 201
Height = 19
Top = 129
Width = 185
Caption = 'AutoAdjustIDEHeightCheckBox'
ParentShowHint = False
ShowHint = True
@ -488,10 +119,10 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
Left = 221
Height = 22
Top = 149
Width = 272
Left = 205
Height = 19
Top = 129
Width = 253
BorderSpacing.Left = 20
Caption = 'AutoAdjustIDEHeightFullCompPalCheckBox'
ParentShowHint = False

View File

@ -34,62 +34,16 @@ type
{ TWindowOptionsFrame }
TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
ApplyButton: TButton;
AutoAdjustIDEHeightFullCompPalCheckBox: TCheckBox;
lblWindowPosition: TDividerBevel;
lblShowingWindows: TDividerBevel;
lblWindowCaption: TDividerBevel;
NameForDesignedFormList: TCheckBox;
AutoAdjustIDEHeightCheckBox: TCheckBox;
TitleIncludesBuildMode: TCheckBox;
dropSplitterPlacement: TComboBox;
CustomGeometryRadioButton: TRadioButton;
FixedDefaultRadioButton: TRadioButton;
GetWindowPositionButton: TButton;
HeightEdit: TSpinEdit;
HeightLabel: TLabel;
HideIDEOnRunCheckBox: TCheckBox;
SplitLabel: TLabel;
LeftEdit: TSpinEdit;
LeftLabel: TLabel;
SplitterList: TListBox;
SplitterPanel: TPanel;
SingleTaskBarButtonCheckBox: TCheckBox;
RestoreWindowGeometryRadioButton: TRadioButton;
SplitEdit: TSpinEdit;
TitleStartsWithProjectCheckBox: TCheckBox;
ProjectDirInIdeTitleCheckBox: TCheckBox;
TopEdit: TSpinEdit;
TopLabel: TLabel;
LetWindowManagerDecideRadioButton: TRadioButton;
WidthEdit: TSpinEdit;
WidthLabel: TLabel;
WindowPositionsPanel: TPanel;
WindowPositionsListBox: TListBox;
procedure ApplyButtonClick(Sender: TObject);
procedure CustomGeometryRadioButtonClick(Sender: TObject);
procedure GetWindowPositionButtonClick(Sender: TObject);
procedure WindowGeometryRadioButtonClick(Sender: TObject);
procedure SplitterListSelectionChange(Sender: TObject; User: boolean);
procedure WindowPositionsListBoxSelectionChange(Sender: TObject; User: boolean);
private
FLayouts: TSimpleWindowLayoutList;
FLayout: TSimpleWindowLayout;
FDivider: TSimpleWindowLayoutDividerPos;
FShowSimpleLayout: boolean;
procedure EnableGeometryEdits(aEnable: Boolean);
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
procedure SetLayout(const AValue: TSimpleWindowLayout);
procedure SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
procedure SetWindowPositionsItem(Index: integer);
procedure SaveCurrentSplitterLayout;
procedure SaveLayout;
function GetLayoutCaption(ALayout: TSimpleWindowLayout): String;
property Layout: TSimpleWindowLayout read FLayout write SetLayout;
property Divider: TSimpleWindowLayoutDividerPos read FDivider write SetDivider;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
@ -133,9 +87,6 @@ begin
end;
procedure TWindowOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
Creator: TIDEWindowCreator;
i, j: Integer;
begin
with (AOptions as TEnvironmentOptions).Desktop do
begin
@ -149,76 +100,10 @@ begin
AutoAdjustIDEHeightFullCompPalCheckBox.Checked:=AutoAdjustIDEHeightFullCompPal;
ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
end;
FLayouts.CopyItemsFrom(IDEWindowCreators.SimpleLayoutStorage);
if FShowSimpleLayout then begin
// Window Positions
lblWindowPosition.Parent:=Self;
lblWindowPosition.Caption := dlgWinPos;
WindowPositionsPanel.Parent:=Self;
WindowPositionsPanel.Caption:='';
WindowPositionsListBox.Items.BeginUpdate;
WindowPositionsListBox.Items.Clear;
// show all registered windows
// Note: the layouts also contain forms, that were once registered and may be
// registered in the future again
for i:=0 to IDEWindowCreators.Count-1 do begin
Creator:=IDEWindowCreators[i];
for j:=0 to FLayouts.Count-1 do begin
if Creator.NameFits(FLayouts[j].FormID) then
WindowPositionsListBox.Items.AddObject(GetLayoutCaption(FLayouts[j]),FLayouts[j]);
end;
end;
WindowPositionsListBox.Sorted := True;
WindowPositionsListBox.Items.EndUpdate;
WindowPositionsListBox.Hint := rsiwpPositionWindowListHint;
SplitterList.Hint := rsiwpColumnNamesHint;
dropSplitterPlacement.Hint := rsiwpColumnStrategyHint;
SplitEdit.Hint := rsiwpColumnWidthHint;
LeftLabel.Caption := dlgLeftPos;
TopLabel.Caption := dlgTopPos;
WidthLabel.Caption := dlgWidthPos;
HeightLabel.Caption := DlgHeightPos;
ApplyButton.Caption := lisApply;
GetWindowPositionButton.Caption := dlgGetPosition;
SplitLabel.Caption := dlgWidthPos;
LeftEdit.Hint := rsiwpSplitterCustomPosition;
TopEdit.Hint := rsiwpSplitterCustomPosition;
WidthEdit.Hint := rsiwpSplitterCustomPosition;
HeightEdit.Hint := rsiwpSplitterCustomPosition;
RestoreWindowGeometryRadioButton.Caption := rsiwpRestoreWindowGeometry;
LetWindowManagerDecideRadioButton.Caption := rsiwpLetWindowManagerDecide;
FixedDefaultRadioButton.Caption := rsiwpFixedDefaultGeometry;
CustomGeometryRadioButton.Caption := rsiwpCustomGeometry;
RestoreWindowGeometryRadioButton.Hint := rsiwpRestoreWindowGeometryHint;
LetWindowManagerDecideRadioButton.Hint := rsiwpLetWindowManagerDecideHint;
FixedDefaultRadioButton.Hint := rsiwpFixedDefaultGeometryHint;
CustomGeometryRadioButton.Hint := rsiwpCustomGeometryHint;
dropSplitterPlacement.Clear;
dropSplitterPlacement.Items.Add(rsiwpSplitterFollowWindow);
dropSplitterPlacement.Items.Add(rsiwpSplitterRestoreWindowGeometry);
dropSplitterPlacement.Items.Add(rsiwpSplitterDefault);
dropSplitterPlacement.Items.Add(rsiwpSplitterCustomPosition);
SetWindowPositionsItem(0);
end else begin
lblWindowPosition.Parent:=nil;
WindowPositionsPanel.Parent:=nil;
end;
end;
procedure TWindowOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin
SaveLayout;
IDEWindowCreators.SimpleLayoutStorage.CopyItemsFrom(FLayouts);
with (AOptions as TEnvironmentOptions).Desktop do
begin
// window minimizing
@ -233,266 +118,6 @@ begin
end;
end;
function TWindowOptionsFrame.GetPlacementRadioButtons(
APlacement: TIDEWindowPlacement): TRadioButton;
begin
case APlacement of
iwpRestoreWindowGeometry: Result := RestoreWindowGeometryRadioButton;
iwpDefault: Result := FixedDefaultRadioButton;
iwpCustomPosition: Result := CustomGeometryRadioButton;
iwpUseWindowManagerSetting: Result := LetWindowManagerDecideRadioButton;
else
Result := nil;
end;
end;
procedure TWindowOptionsFrame.SetLayout(const AValue: TSimpleWindowLayout);
var
APlacement: TIDEWindowPlacement;
RadioButton: TRadioButton;
p: TPoint;
i: Integer;
begin
FLayout := AValue;
Divider := nil;
if Layout=nil then begin
SplitterPanel.Visible := False;
Exit;
end;
//debugln(['TWindowOptionsFrame.SetLayout ',Layout.FormID,' ',IDEWindowPlacementNames[Layout.WindowPlacement]]);
for APlacement := Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
RadioButton := GetPlacementRadioButtons(APlacement);
if RadioButton=nil then continue;
RadioButton.Enabled := True;
RadioButton.Checked := (APlacement = Layout.WindowPlacement);
end;
// custom window position
if Layout.CustomCoordinatesAreValid then
begin
LeftEdit.Value := Layout.Left;
TopEdit.Value := Layout.Top;
WidthEdit.Value := Layout.Width;
HeightEdit.Value := Layout.Height;
end
else
if Layout.Form <> nil then
begin
if Layout.Form.Parent<>nil then begin
p:=Layout.Form.ClientOrigin;
LeftEdit.Value := p.X;
TopEdit.Value := p.Y;
end else begin
LeftEdit.Value := Layout.Form.Left;
TopEdit.Value := Layout.Form.Top;
end;
WidthEdit.Value := Layout.Form.Width;
HeightEdit.Value := Layout.Form.Height;
end
else
begin
LeftEdit.Value := 0;
TopEdit.Value := 0;
WidthEdit.Value := 0;
HeightEdit.Value := 0;
end;
GetWindowPositionButton.Enabled := (Layout.Form <> nil);
SplitterPanel.Visible := Layout.Dividers.NamedCount > 0;
SplitterList.Clear;
for i := 0 to Layout.Dividers.NamedCount - 1 do
SplitterList.AddItem(Layout.Dividers.NamedItems[i].DisplayName, Layout.Dividers.NamedItems[i]);
if Layout.Dividers.NamedCount > 0 then
SplitterList.ItemIndex := 0;
end;
procedure TWindowOptionsFrame.SetDivider(const AValue: TSimpleWindowLayoutDividerPos);
begin
FDivider := AValue;
if FDivider=nil then exit;
SplitEdit.Value := FDivider.Size;
case FDivider.Placement of
iwpdUseWindowSetting: dropSplitterPlacement.ItemIndex := 0;
iwpdRestore: dropSplitterPlacement.ItemIndex := 1;
iwpdDefault: dropSplitterPlacement.ItemIndex := 2;
iwpdCustomSize: dropSplitterPlacement.ItemIndex := 3;
end;
end;
procedure TWindowOptionsFrame.WindowPositionsListBoxSelectionChange(
Sender: TObject; User: boolean);
begin
if User then
SetWindowPositionsItem(WindowPositionsListBox.ItemIndex);
end;
procedure TWindowOptionsFrame.ApplyButtonClick(Sender: TObject);
begin
SaveLayout;
if (Layout<>nil) and (Layout.Form<>nil) and (Layout.Form.Parent=nil) then begin
if (Layout.WindowPlacement in [iwpCustomPosition,iwpRestoreWindowGeometry]) then begin
Layout.ValidateAndSetCoordinates; // Adjust bounds to screen area and apply them.
Layout.Applied := True;
end;
Layout.ApplyDivider(True);
end;
end;
procedure TWindowOptionsFrame.EnableGeometryEdits(aEnable: Boolean);
begin
LeftEdit.Enabled := aEnable;
TopEdit.Enabled := aEnable;
WidthEdit.Enabled := aEnable;
HeightEdit.Enabled := aEnable;
end;
procedure TWindowOptionsFrame.WindowGeometryRadioButtonClick(Sender: TObject);
begin
EnableGeometryEdits(False);
end;
procedure TWindowOptionsFrame.CustomGeometryRadioButtonClick(Sender: TObject);
begin
EnableGeometryEdits(True);
end;
procedure TWindowOptionsFrame.GetWindowPositionButtonClick(Sender: TObject);
begin
if (Layout<>nil) and (Layout.Form <> nil) then
begin
LeftEdit.Value := Layout.Form.Left;
TopEdit.Value := Layout.Form.Top;
WidthEdit.Value := Layout.Form.Width;
HeightEdit.Value := Layout.Form.Height;
end;
Layout.ReadCurrentDividers(True);
SplitterListSelectionChange(nil, False);
end;
procedure TWindowOptionsFrame.SplitterListSelectionChange(Sender: TObject; User: boolean);
begin
if User then SaveCurrentSplitterLayout;
if (SplitterList.Count = 0) or (SplitterList.ItemIndex < 0) then exit;
SetDivider(TSimpleWindowLayoutDividerPos(SplitterList.Items.Objects[SplitterList.ItemIndex]));
end;
procedure TWindowOptionsFrame.SetWindowPositionsItem(Index: integer);
begin
SaveLayout;
WindowPositionsListBox.ItemIndex := Index;
if Index>=0 then
Layout:=TSimpleWindowLayout(WindowPositionsListBox.Items.Objects[Index])
else
Layout:=nil;
if Index >= 0 then
lblWindowCaption.Caption := WindowPositionsListBox.Items[Index];
end;
procedure TWindowOptionsFrame.SaveCurrentSplitterLayout;
begin
if FDivider = nil then exit;
case dropSplitterPlacement.ItemIndex of
0: FDivider.Placement := iwpdUseWindowSetting;
1: FDivider.Placement := iwpdRestore;
2: FDivider.Placement := iwpdDefault;
3: FDivider.Placement := iwpdCustomSize;
end;
FDivider.Size := SplitEdit.Value;
end;
procedure TWindowOptionsFrame.SaveLayout;
var
APlacement: TIDEWindowPlacement;
ARadioButton: TRadioButton;
begin
if Layout = nil then
Exit;
//debugln(['TWindowOptionsFrame.SaveLayout ',Layout.FormID]);
for APlacement := Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
ARadioButton := GetPlacementRadioButtons(APlacement);
if (ARadioButton <> nil) and ARadioButton.Enabled and ARadioButton.Checked then
Layout.WindowPlacement := APlacement;
if APlacement = iwpCustomPosition then
begin
Layout.Left := LeftEdit.Value;
Layout.Top := TopEdit.Value;
Layout.Width := WidthEdit.Value;
Layout.Height := HeightEdit.Value;
end;
end;
SaveCurrentSplitterLayout;
end;
function TWindowOptionsFrame.GetLayoutCaption(ALayout: TSimpleWindowLayout): String;
function Fits(FormName, aCaption: string): boolean;
var
SubIndex: LongInt;
begin
Result:=CompareText(FormName,copy(ALayout.FormID,1,length(FormName)))=0;
if not Result then exit;
SubIndex:=StrToIntDef(copy(ALayout.FormID,length(FormName)+1,10),-1);
if SubIndex<0 then
GetLayoutCaption:=aCaption // Set Result of the main function.
else
GetLayoutCaption:=aCaption+' '+IntToStr(SubIndex);
end;
begin
// use the known resourcestrings
if Fits('MainIDE',dlgMainMenu) then exit;
if Fits('SourceNotebook',dlgSrcEdit) then exit;
if Fits('MessagesView',dlgMsgs) then exit;
if Fits('ObjectInspectorDlg',oisObjectInspector) then exit;
if Fits('UnitDependencies',dlgUnitDepCaption) then exit;
if Fits('CodeExplorerView',lisMenuViewCodeExplorer) then exit;
if Fits('FPDocEditor',lisCodeHelpMainFormCaption) then exit;
if Fits('PkgGraphExplorer',lisMenuPackageGraph) then exit;
if Fits('ProjectInspector',lisMenuProjectInspector) then exit;
if Fits('DbgOutput',lisMenuViewDebugOutput) then exit;
if Fits('DbgEvents',lisMenuViewDebugEvents) then exit;
if Fits('BreakPoints',lisMenuViewBreakPoints) then exit;
if Fits('Watches',liswlWatchList) then exit;
if Fits('Locals',lisLocals) then exit;
if Fits('CallStack',lisMenuViewCallStack) then exit;
if Fits('EvaluateModify',lisKMEvaluateModify) then exit;
if Fits('Registers',lisRegisters) then exit;
if Fits('Assembler',lisMenuViewAssembler) then exit;
if Fits('Inspect',lisInspectDialog) then exit;
if Fits('SearchResults',lisMenuViewSearchResults) then exit;
if Fits('AnchorEditor',lisMenuViewAnchorEditor) then exit;
if Fits('TabOrderEditor',lisMenuViewTabOrder) then exit;
if Fits('CodeBrowser',lisCodeBrowser) then exit;
if Fits('IssueBrowser',lisMenuViewRestrictionBrowser) then exit;
if Fits('JumpHistory',lisJHJumpHistory) then exit;
if Fits('PseudoTerminal', lisMenuViewPseudoTerminal) then exit;
if Fits('Threads', lisMenuViewThreads) then exit;
if Fits('DbgHistory', lisMenuViewHistory) then exit;
if Fits('ComponentList', lisCmpLstComponents) then exit;
Result:=ALayout.FormCaption;
end;
constructor TWindowOptionsFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FLayouts:=TSimpleWindowLayoutList.Create(False);
FShowSimpleLayout:=(IDEDockMaster=nil) or (not IDEDockMaster.HideSimpleLayoutOptions);
end;
destructor TWindowOptionsFrame.Destroy;
begin
FreeAndNil(FLayouts);
inherited Destroy;
end;
class function TWindowOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result := TEnvironmentOptions;

View File

@ -2017,19 +2017,9 @@ begin
end;
procedure TLazSourceFileManager.ArrangeSourceEditorAndMessageView(PutOnTop: boolean);
var
SrcNoteBook: TSourceNotebook;
Layout: TSimpleWindowLayout;
begin
if SourceEditorManager.SourceWindowCount > 0 then
begin
SrcNoteBook := SourceEditorManager.SourceWindows[0];
Layout:=IDEWindowCreators.SimpleLayoutStorage.ItemByFormID(SrcNoteBook.Name);
if (Layout<>nil) and (Layout.WindowPlacement=iwpDefault)
and ((SrcNoteBook.Top + SrcNoteBook.Height) > MessagesView.Top)
and (MessagesView.Parent = nil) then
SrcNoteBook.Height := Max(50,Min(SrcNoteBook.Height,MessagesView.Top-SrcNoteBook.Top));
if PutOnTop then
begin
IDEWindowCreators.ShowForm(MessagesView,true);