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

View File

@ -14,9 +14,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 17 Top = 15
Width = 200 Width = 181
Caption = 'SingleTaskBarButtonCheckBox' Caption = 'SingleTaskBarButtonCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -28,375 +28,22 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 39 Top = 34
Width = 166 Width = 151
Caption = 'HideIDEOnRunCheckBox' Caption = 'HideIDEOnRunCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
TabOrder = 1 TabOrder = 1
end 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 object TitleStartsWithProjectCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = HideIDEOnRunCheckBox AnchorSideTop.Control = HideIDEOnRunCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 61 Top = 53
Width = 204 Width = 186
Caption = 'TitleStartsWithProjectCheckBox' Caption = 'TitleStartsWithProjectCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -407,9 +54,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TitleStartsWithProjectCheckBox AnchorSideTop.Control = TitleStartsWithProjectCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 83 Top = 72
Width = 192 Width = 173
Caption = 'ProjectDirInIdeTitleCheckBox' Caption = 'ProjectDirInIdeTitleCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -420,9 +67,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = ProjectDirInIdeTitleCheckBox AnchorSideTop.Control = ProjectDirInIdeTitleCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 105 Top = 91
Width = 158 Width = 145
Caption = 'TitleIncludesBuildMode' Caption = 'TitleIncludesBuildMode'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -433,9 +80,9 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = TitleIncludesBuildMode AnchorSideTop.Control = TitleIncludesBuildMode
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 127 Top = 110
Width = 181 Width = 164
Caption = 'NameForDesignedFormList' Caption = 'NameForDesignedFormList'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -447,7 +94,7 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 17 Height = 15
Top = 0 Top = 0
Width = 573 Width = 573
Caption = 'lblShowingWindows' Caption = 'lblShowingWindows'
@ -455,30 +102,14 @@ object WindowOptionsFrame: TWindowOptionsFrame
Font.Style = [fsBold] Font.Style = [fsBold]
ParentFont = False ParentFont = False
end 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 object AutoAdjustIDEHeightCheckBox: TCheckBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = NameForDesignedFormList AnchorSideTop.Control = NameForDesignedFormList
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 22 Height = 19
Top = 149 Top = 129
Width = 201 Width = 185
Caption = 'AutoAdjustIDEHeightCheckBox' Caption = 'AutoAdjustIDEHeightCheckBox'
ParentShowHint = False ParentShowHint = False
ShowHint = True ShowHint = True
@ -488,10 +119,10 @@ object WindowOptionsFrame: TWindowOptionsFrame
AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox AnchorSideLeft.Control = AutoAdjustIDEHeightCheckBox
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox AnchorSideTop.Control = AutoAdjustIDEHeightCheckBox
Left = 221 Left = 205
Height = 22 Height = 19
Top = 149 Top = 129
Width = 272 Width = 253
BorderSpacing.Left = 20 BorderSpacing.Left = 20
Caption = 'AutoAdjustIDEHeightFullCompPalCheckBox' Caption = 'AutoAdjustIDEHeightFullCompPalCheckBox'
ParentShowHint = False ParentShowHint = False

View File

@ -34,62 +34,16 @@ type
{ TWindowOptionsFrame } { TWindowOptionsFrame }
TWindowOptionsFrame = class(TAbstractIDEOptionsEditor) TWindowOptionsFrame = class(TAbstractIDEOptionsEditor)
ApplyButton: TButton;
AutoAdjustIDEHeightFullCompPalCheckBox: TCheckBox; AutoAdjustIDEHeightFullCompPalCheckBox: TCheckBox;
lblWindowPosition: TDividerBevel;
lblShowingWindows: TDividerBevel; lblShowingWindows: TDividerBevel;
lblWindowCaption: TDividerBevel;
NameForDesignedFormList: TCheckBox; NameForDesignedFormList: TCheckBox;
AutoAdjustIDEHeightCheckBox: TCheckBox; AutoAdjustIDEHeightCheckBox: TCheckBox;
TitleIncludesBuildMode: TCheckBox; TitleIncludesBuildMode: TCheckBox;
dropSplitterPlacement: TComboBox;
CustomGeometryRadioButton: TRadioButton;
FixedDefaultRadioButton: TRadioButton;
GetWindowPositionButton: TButton;
HeightEdit: TSpinEdit;
HeightLabel: TLabel;
HideIDEOnRunCheckBox: TCheckBox; HideIDEOnRunCheckBox: TCheckBox;
SplitLabel: TLabel;
LeftEdit: TSpinEdit;
LeftLabel: TLabel;
SplitterList: TListBox;
SplitterPanel: TPanel;
SingleTaskBarButtonCheckBox: TCheckBox; SingleTaskBarButtonCheckBox: TCheckBox;
RestoreWindowGeometryRadioButton: TRadioButton;
SplitEdit: TSpinEdit;
TitleStartsWithProjectCheckBox: TCheckBox; TitleStartsWithProjectCheckBox: TCheckBox;
ProjectDirInIdeTitleCheckBox: 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 public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
function GetTitle: String; override; function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override; procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings(AOptions: TAbstractIDEOptions); override; procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
@ -133,9 +87,6 @@ begin
end; end;
procedure TWindowOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions); procedure TWindowOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
Creator: TIDEWindowCreator;
i, j: Integer;
begin begin
with (AOptions as TEnvironmentOptions).Desktop do with (AOptions as TEnvironmentOptions).Desktop do
begin begin
@ -149,76 +100,10 @@ begin
AutoAdjustIDEHeightFullCompPalCheckBox.Checked:=AutoAdjustIDEHeightFullCompPal; AutoAdjustIDEHeightFullCompPalCheckBox.Checked:=AutoAdjustIDEHeightFullCompPal;
ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle; ProjectDirInIdeTitleCheckBox.Checked:=IDEProjectDirectoryInIdeTitle;
end; 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; end;
procedure TWindowOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions); procedure TWindowOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
begin begin
SaveLayout;
IDEWindowCreators.SimpleLayoutStorage.CopyItemsFrom(FLayouts);
with (AOptions as TEnvironmentOptions).Desktop do with (AOptions as TEnvironmentOptions).Desktop do
begin begin
// window minimizing // window minimizing
@ -233,266 +118,6 @@ begin
end; end;
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; class function TWindowOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin begin
Result := TEnvironmentOptions; Result := TEnvironmentOptions;

View File

@ -2017,19 +2017,9 @@ begin
end; end;
procedure TLazSourceFileManager.ArrangeSourceEditorAndMessageView(PutOnTop: boolean); procedure TLazSourceFileManager.ArrangeSourceEditorAndMessageView(PutOnTop: boolean);
var
SrcNoteBook: TSourceNotebook;
Layout: TSimpleWindowLayout;
begin begin
if SourceEditorManager.SourceWindowCount > 0 then if SourceEditorManager.SourceWindowCount > 0 then
begin 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 if PutOnTop then
begin begin
IDEWindowCreators.ShowForm(MessagesView,true); IDEWindowCreators.ShowForm(MessagesView,true);