ide: IDE options

- don't show shortcut dialog on every single click on keymapping tree but show on double click
  - move TIDEWindowSetupLayoutComponent from IDEOptionsDefs to windows_options frame where it is only used

git-svn-id: trunk@19865 -
This commit is contained in:
paul 2009-05-09 09:45:23 +00:00
parent e3c48b9278
commit 07e509a88a
7 changed files with 372 additions and 381 deletions

View File

@ -3,6 +3,7 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
Width = 461
ClientHeight = 510
ClientWidth = 461
TabOrder = 0
Visible = False
DesignLeft = 110
DesignTop = 145
@ -54,7 +55,7 @@ inherited EditorKeymappingOptionsFrame: TEditorKeymappingOptionsFrame
RowSelect = True
ScrollBars = ssAutoBoth
TabOrder = 1
OnMouseUp = KeyMappingTreeViewMouseUp
OnDblClick = KeyMappingTreeViewDblClick
Options = [tvoAutoItemHeight, tvoHideSelection, tvoKeepCollapsedNodes, tvoReadOnly, tvoRowSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips]
end
object KeyMappingFindKeyButton: TButton[3]

View File

@ -1,46 +1,44 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TEditorKeymappingOptionsFrame','FORMDATA',[
'TPF0'#241#29'TEditorKeymappingOptionsFrame'#28'EditorKeymappingOptionsFrame'
+#6'Height'#3#254#1#5'Width'#3#205#1#12'ClientHeight'#3#254#1#11'ClientWidth'
+#3#205#1#7'Visible'#8#10'DesignLeft'#2'n'#9'DesignTop'#3#145#0#0#242#2#0#6'T'
+'Label'#19'KeyMappingHelpLabel'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anc'
+'horSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'Height'#2#14#3'Top'#2#0#5'Widt'
+'h'#2'i'#7'Caption'#6#19'KeyMappingHelpLabel'#11'ParentColor'#8#0#0#242#2#1#5
+'TEdit'#20'KeyMappingFilterEdit'#22'AnchorSideLeft.Control'#7#5'Owner'#21'An'
+'chorSideTop.Control'#7#19'KeyMappingHelpLabel'#18'AnchorSideTop.Side'#7#9'a'
+'srBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+#9'asrBottom'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#20#5'Width'#3#205#1#7'Anch'
+'ors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'
+#2#6#8'OnChange'#7#26'KeyMappingFilterEditChange'#7'OnEnter'#7#25'KeyMapping'
+'FilterEditEnter'#6'OnExit'#7#24'KeyMappingFilterEditExit'#8'TabOrder'#2#0#4
+'Text'#6#20'KeyMappingFilterEdit'#0#0#242#2#2#9'TTreeView'#18'KeyMappingTree'
+'View'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#20
+'KeyMappingFilterEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRi'
+'ght.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSi'
+'deBottom.Control'#7#23'KeyMappingFindKeyButton'#4'Left'#2#0#6'Height'#3#147
+#1#3'Top'#2'1'#5'Width'#3#205#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
+'akBottom'#0#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Bottom'#2#6#17'Defau'
+'ltItemHeight'#2#15#8'ReadOnly'#9#9'RowSelect'#9#10'ScrollBars'#7#10'ssAutoB'
+'oth'#8'TabOrder'#2#1#9'OnMouseUp'#7#25'KeyMappingTreeViewMouseUp'#7'Options'
+#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepCollapsedNodes'#11
+'tvoReadOnly'#12'tvoRowSelect'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoSho'
+'wRoot'#11'tvoToolTips'#0#0#0#242#2#3#7'TButton'#23'KeyMappingFindKeyButton'
+#22'AnchorSideLeft.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBotto'
+'m'#24'AnchorSideBottom.Control'#7#28'KeyMappingChooseSchemeButton'#4'Left'#2
+#0#6'Height'#2#23#3'Top'#3#202#1#5'Width'#3#154#0#7'Anchors'#11#6'akLeft'#8
+'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Bottom'#2#6#7'Caption'#6#23'KeyM'
+'appingFindKeyButton'#7'OnClick'#7#28'KeyMappingFindKeyButtonClick'#8'TabOrd'
+'er'#2#2#0#0#242#2#4#7'TButton'#28'KeyMappingChooseSchemeButton'#22'AnchorSi'
+'deLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7#5'Owner'#21'Ancho'
+'rSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#231#1#5
+'Width'#3#191#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#7'Captio'
+'n'#6#28'KeyMappingChooseSchemeButton'#7'OnClick'#7'!KeyMappingChooseSchemeB'
+'uttonClick'#8'TabOrder'#2#3#0#0#242#2#5#7'TButton KeyMappingConsistencyChec'
+'kButton'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'
+#7#9'asrBottom'#4'Left'#3#1#1#6'Height'#2#23#3'Top'#3#231#1#5'Width'#3#204#0
+#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6' KeyMappi'
+'ngConsistencyCheckButton'#7'OnClick'#7'%KeyMappingConsistencyCheckButtonCli'
+'ck'#8'TabOrder'#2#4#0#0#0
+#3#205#1#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#2'n'#9'DesignTop'#3#145
+#0#0#242#2#0#6'TLabel'#19'KeyMappingHelpLabel'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#4'Left'#2#0#6'Height'#2#14#3'To'
+'p'#2#0#5'Width'#2'i'#7'Caption'#6#19'KeyMappingHelpLabel'#11'ParentColor'#8
+#0#0#242#2#1#5'TEdit'#20'KeyMappingFilterEdit'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#19'KeyMappingHelpLabel'#18'AnchorSideTop'
+'.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideR'
+'ight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#23#3'Top'#2#20#5'Width'#3
+#205#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'Border'
+'Spacing.Top'#2#6#8'OnChange'#7#26'KeyMappingFilterEditChange'#7'OnEnter'#7
+#25'KeyMappingFilterEditEnter'#6'OnExit'#7#24'KeyMappingFilterEditExit'#8'Ta'
+'bOrder'#2#0#4'Text'#6#20'KeyMappingFilterEdit'#0#0#242#2#2#9'TTreeView'#18
+'KeyMappingTreeView'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.'
+'Control'#7#20'KeyMappingFilterEdit'#18'AnchorSideTop.Side'#7#9'asrBottom'#23
+'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'
+#24'AnchorSideBottom.Control'#7#23'KeyMappingFindKeyButton'#4'Left'#2#0#6'He'
+'ight'#3#147#1#3'Top'#2'1'#5'Width'#3#205#1#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#8'akBottom'#0#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Bottom'
+#2#6#17'DefaultItemHeight'#2#15#8'ReadOnly'#9#9'RowSelect'#9#10'ScrollBars'#7
+#10'ssAutoBoth'#8'TabOrder'#2#1#10'OnDblClick'#7#26'KeyMappingTreeViewDblCli'
+'ck'#7'Options'#11#17'tvoAutoItemHeight'#16'tvoHideSelection'#21'tvoKeepColl'
+'apsedNodes'#11'tvoReadOnly'#12'tvoRowSelect'#14'tvoShowButtons'#12'tvoShowL'
+'ines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#242#2#3#7'TButton'#23'KeyMappin'
+'gFindKeyButton'#22'AnchorSideLeft.Control'#7#5'Owner'#20'AnchorSideRight.Si'
+'de'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#28'KeyMappingChooseScheme'
+'Button'#4'Left'#2#0#6'Height'#2#23#3'Top'#3#202#1#5'Width'#3#154#0#7'Anchor'
+'s'#11#6'akLeft'#8'akBottom'#0#8'AutoSize'#9#20'BorderSpacing.Bottom'#2#6#7
+'Caption'#6#23'KeyMappingFindKeyButton'#7'OnClick'#7#28'KeyMappingFindKeyBut'
+'tonClick'#8'TabOrder'#2#2#0#0#242#2#4#7'TButton'#28'KeyMappingChooseSchemeB'
+'utton'#22'AnchorSideLeft.Control'#7#5'Owner'#24'AnchorSideBottom.Control'#7
+#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#23
+#3'Top'#3#231#1#5'Width'#3#191#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'Aut'
+'oSize'#9#7'Caption'#6#28'KeyMappingChooseSchemeButton'#7'OnClick'#7'!KeyMap'
+'pingChooseSchemeButtonClick'#8'TabOrder'#2#3#0#0#242#2#5#7'TButton KeyMappi'
+'ngConsistencyCheckButton'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorS'
+'ideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#5'Owner'#21'An'
+'chorSideBottom.Side'#7#9'asrBottom'#4'Left'#3#1#1#6'Height'#2#23#3'Top'#3
+#231#1#5'Width'#3#204#0#7'Anchors'#11#7'akRight'#8'akBottom'#0#8'AutoSize'#9
+#7'Caption'#6' KeyMappingConsistencyCheckButton'#7'OnClick'#7'%KeyMappingCon'
+'sistencyCheckButtonClick'#8'TabOrder'#2#4#0#0#0
]);

View File

@ -48,8 +48,7 @@ type
procedure KeyMappingFilterEditEnter(Sender: TObject);
procedure KeyMappingFilterEditExit(Sender: TObject);
procedure KeyMappingFindKeyButtonClick(Sender: TObject);
procedure KeyMappingTreeViewMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure KeyMappingTreeViewDblClick(Sender: TObject);
private
FDialog: TAbstractOptionsEditorDialog;
KeyMapNameFilter: string;
@ -204,16 +203,18 @@ begin
FillKeyMappingTreeView;
end;
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewMouseUp(
Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TEditorKeymappingOptionsFrame.KeyMappingTreeViewDblClick(
Sender: TObject);
var
P: TPoint;
i: integer;
ARelation: TKeyCommandRelation;
ANode: TTreeNode;
begin
ANode := KeyMappingTreeView.GetNodeAt(X, Y);
P := KeyMappingTreeView.ScreenToClient(Mouse.CursorPos);
ANode := KeyMappingTreeView.GetNodeAt(P.X, P.Y);
if (ANode <> nil) and (ANode.Data <> nil) and
(TObject(ANode.Data) is TKeyCommandRelation) then
(TObject(ANode.Data) is TKeyCommandRelation) then
begin
ARelation := TKeyCommandRelation(ANode.Data);
i := EditingKeyMap.IndexOf(ARelation);

View File

@ -1,20 +1,20 @@
inherited WindowOptionsFrame: TWindowOptionsFrame
Height = 396
Width = 463
ClientHeight = 392
ClientWidth = 459
ClientHeight = 396
ClientWidth = 463
TabOrder = 0
Visible = False
DesignLeft = 413
DesignTop = 210
DesignLeft = 66
DesignTop = 87
object MinimizeAllOnMinimizeMainCheckBox: TCheckBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 22
Height = 17
Top = 0
Width = 276
Width = 195
Caption = 'MinimizeAllOnMinimizeMainCheckBox'
Enabled = False
TabOrder = 0
@ -25,9 +25,9 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 0
Height = 22
Top = 22
Width = 183
Height = 17
Top = 17
Width = 141
Caption = 'HideIDEOnRunCheckBox'
TabOrder = 1
end
@ -40,13 +40,13 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 326
Top = 66
Width = 459
Height = 345
Top = 51
Width = 463
Anchors = [akTop, akLeft, akRight, akBottom]
Caption = 'WindowPositionsGroupBox'
ClientHeight = 307
ClientWidth = 455
ClientHeight = 327
ClientWidth = 459
TabOrder = 2
object WindowPositionsListBox: TListBox
AnchorSideLeft.Control = WindowPositionsGroupBox
@ -56,13 +56,12 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
Left = 6
Height = 100
Top = 6
Width = 443
Width = 447
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 0
OnSelectionChange = WindowPositionsListBoxSelectionChange
TabOrder = 0
TopIndex = -1
end
end
object HideMessagesIconsCheckBox: TCheckBox[3]
@ -70,9 +69,9 @@ inherited WindowOptionsFrame: TWindowOptionsFrame
AnchorSideTop.Control = HideIDEOnRunCheckBox
AnchorSideTop.Side = asrBottom
Left = 0
Height = 22
Top = 44
Width = 218
Height = 17
Top = 34
Width = 163
Caption = 'HideMessagesIconsCheckBox'
TabOrder = 3
end

View File

@ -1,34 +1,32 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TWindowOptionsFrame','FORMDATA',[
'TPF0'#241#19'TWindowOptionsFrame'#18'WindowOptionsFrame'#6'Height'#3#140#1#5
+'Width'#3#207#1#12'ClientHeight'#3#136#1#11'ClientWidth'#3#203#1#8'TabOrder'
+#2#0#7'Visible'#8#10'DesignLeft'#3#157#1#9'DesignTop'#3#210#0#0#242#2#0#9'TC'
+'heckBox!MinimizeAllOnMinimizeMainCheckBox'#22'AnchorSideLeft.Control'#7#5'O'
+'wner'#21'AnchorSideTop.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asr'
+'Bottom'#4'Left'#2#0#6'Height'#2#22#3'Top'#2#0#5'Width'#3#20#1#7'Caption'#6
+'!MinimizeAllOnMinimizeMainCheckBox'#7'Enabled'#8#8'TabOrder'#2#0#0#0#242#2#1
+#9'TCheckBox'#20'HideIDEOnRunCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7'!MinimizeAllOnMinimizeMainCheckBox'#18'AnchorSi'
+'deTop.Side'#7#9'asrBottom'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2
+#0#6'Height'#2#22#3'Top'#2#22#5'Width'#3#183#0#7'Caption'#6#20'HideIDEOnRunC'
+'heckBox'#8'TabOrder'#2#1#0#0#242#2#2#9'TGroupBox'#23'WindowPositionsGroupBo'
+'x'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#25'Hid'
+'eMessagesIconsCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSide'
+'Right.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'Anchor'
+'SideBottom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'L'
+'eft'#2#0#6'Height'#3'F'#1#3'Top'#2'B'#5'Width'#3#203#1#7'Anchors'#11#5'akTo'
+'p'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6#23'WindowPositionsGroupB'
+'ox'#12'ClientHeight'#3'3'#1#11'ClientWidth'#3#199#1#8'TabOrder'#2#2#0#8'TLi'
+'stBox'#22'WindowPositionsListBox'#22'AnchorSideLeft.Control'#7#23'WindowPos'
+'itionsGroupBox'#21'AnchorSideTop.Control'#7#23'WindowPositionsGroupBox'#23
+'AnchorSideRight.Control'#7#23'WindowPositionsGroupBox'#20'AnchorSideRight.S'
+'ide'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2'd'#3'Top'#2#6#5'Width'#3#187#1#7
+'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#20'BorderSpacing.Around'#2#6#10
+'ItemHeight'#2#0#17'OnSelectionChange'#7'%WindowPositionsListBoxSelectionCha'
+'nge'#8'TabOrder'#2#0#8'TopIndex'#2#255#0#0#0#242#2#3#9'TCheckBox'#25'HideMe'
+'ssagesIconsCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop'
+'.Control'#7#20'HideIDEOnRunCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4
+'Left'#2#0#6'Height'#2#22#3'Top'#2','#5'Width'#3#218#0#7'Caption'#6#25'HideM'
+'essagesIconsCheckBox'#8'TabOrder'#2#3#0#0#0
+'Width'#3#207#1#12'ClientHeight'#3#140#1#11'ClientWidth'#3#207#1#8'TabOrder'
+#2#0#7'Visible'#8#10'DesignLeft'#2'B'#9'DesignTop'#2'W'#0#242#2#0#9'TCheckBo'
+'x!MinimizeAllOnMinimizeMainCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'
+#4'Left'#2#0#6'Height'#2#17#3'Top'#2#0#5'Width'#3#195#0#7'Caption'#6'!Minimi'
+'zeAllOnMinimizeMainCheckBox'#7'Enabled'#8#8'TabOrder'#2#0#0#0#242#2#1#9'TCh'
+'eckBox'#20'HideIDEOnRunCheckBox'#22'AnchorSideLeft.Control'#7#5'Owner'#21'A'
+'nchorSideTop.Control'#7'!MinimizeAllOnMinimizeMainCheckBox'#18'AnchorSideTo'
+'p.Side'#7#9'asrBottom'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6
+'Height'#2#17#3'Top'#2#17#5'Width'#3#141#0#7'Caption'#6#20'HideIDEOnRunCheck'
+'Box'#8'TabOrder'#2#1#0#0#242#2#2#9'TGroupBox'#23'WindowPositionsGroupBox'#22
+'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#25'HideMessa'
+'gesIconsCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.'
+'Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBo'
+'ttom.Control'#7#5'Owner'#21'AnchorSideBottom.Side'#7#9'asrBottom'#4'Left'#2
+#0#6'Height'#3'Y'#1#3'Top'#2'3'#5'Width'#3#207#1#7'Anchors'#11#5'akTop'#6'ak'
+'Left'#7'akRight'#8'akBottom'#0#7'Caption'#6#23'WindowPositionsGroupBox'#12
+'ClientHeight'#3'G'#1#11'ClientWidth'#3#203#1#8'TabOrder'#2#2#0#8'TListBox'
+#22'WindowPositionsListBox'#22'AnchorSideLeft.Control'#7#23'WindowPositionsG'
+'roupBox'#21'AnchorSideTop.Control'#7#23'WindowPositionsGroupBox'#23'AnchorS'
+'ideRight.Control'#7#23'WindowPositionsGroupBox'#20'AnchorSideRight.Side'#7#9
+'asrBottom'#4'Left'#2#6#6'Height'#2'd'#3'Top'#2#6#5'Width'#3#191#1#7'Anchors'
+#11#5'akTop'#6'akLeft'#7'akRight'#0#20'BorderSpacing.Around'#2#6#10'ItemHeig'
+'ht'#2#0#17'OnSelectionChange'#7'%WindowPositionsListBoxSelectionChange'#8'T'
+'abOrder'#2#0#0#0#0#242#2#3#9'TCheckBox'#25'HideMessagesIconsCheckBox'#22'An'
+'chorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#20'HideIDEOnRu'
+'nCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2#17
+#3'Top'#2'"'#5'Width'#3#163#0#7'Caption'#6#25'HideMessagesIconsCheckBox'#8'T'
+'abOrder'#2#3#0#0#0
]);

View File

@ -29,6 +29,48 @@ uses
EnvironmentOpts, LazarusIDEStrConsts, IDEOptionDefs, ObjectInspector, IDEOptionsIntf;
type
TOnApplyWindowPos = procedure(Layout: TIDEWindowLayout) of object;
TIDEWindowSetupLayoutComponent = class(TGroupBox)
RestoreWindowGeometryRadioButton: TRadioButton;
DefaultRadioButton: TRadioButton;
CustomPositionRadioButton: TRadioButton;
LeftLabel: TLabel;
LeftEdit: TEdit;
TopLabel: TLabel;
TopEdit: TEdit;
WidthLabel: TLabel;
WidthEdit: TEdit;
HeightLabel: TLabel;
HeightEdit: TEdit;
UseWindowManagerSettingRadioButton: TRadioButton;
DockedRadioButton: TRadioButton;
ApplyButton: TButton;
GetWindowPositionButton: TButton;
procedure ApplyButtonClick(Sender: TObject);
procedure GetWindowPositionButtonClick(Sender: TObject);
private
fOnApplyWindowPos: TOnApplyWindowPos;
fLayout: TIDEWindowLayout;
fUpdateRadioButtons: boolean;
protected
function GetLayout: TIDEWindowLayout;
procedure SetLayout(const AValue: TIDEWindowLayout);
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement): TRadioButton;
procedure SetPlacementRadioButtons(APlacement: TIDEWindowPlacement;
const AValue: TRadioButton);
procedure LoadFrom(ALayout: TIDEWindowLayout);
procedure BoundsChanged; override;
public
constructor Create(TheOwner: TComponent); override;
procedure Save;
procedure SaveTo(AnLayout: TIDEWindowLayout);
property Layout: TIDEWindowLayout read GetLayout write SetLayout;
property PlacementRadioButtons[APlacement: TIDEWindowPlacement]: TRadioButton
read GetPlacementRadioButtons write SetPlacementRadioButtons;
property OnApplyWindowPos: TOnApplyWindowPos
read fOnApplyWindowPos write fOnApplyWindowPos;
end;
{ TWindowOptionsFrame }
@ -175,6 +217,239 @@ begin
Result := TEnvironmentOptions;
end;
{ TIDEWindowSetupLayoutComponent }
procedure TIDEWindowSetupLayoutComponent.BoundsChanged;
begin
inherited BoundsChanged;
LoadFrom(fLayout);
end;
procedure TIDEWindowSetupLayoutComponent.LoadFrom(ALayout: TIDEWindowLayout);
var
APlacement: TIDEWindowPlacement;
CurY: LongInt;
Col2X: Integer;
PreviousButton: TRadioButton;
procedure SetLabelAndEdit(var ALabel: TLabel;
var AnEdit: TEdit; const ACaption: string; x, y: integer);
begin
if iwpCustomPosition in ALayout.WindowPlacementsAllowed then begin
if ALabel=nil then ALabel:=TLabel.Create(Self);
with ALabel do begin
Parent:=Self;
SetBounds(x,y,45,Height);
Caption:=ACaption;
end;
if AnEdit=nil then AnEdit:=TEdit.Create(Self);
with AnEdit do begin
Parent:=Self;
SetBounds(x+ALabel.Width+3,y,40,Height);
Text:='';
end;
end else begin
FreeAndNil(ALabel);
FreeAndNil(AnEdit);
end;
end;
function GetRadioBtnCaptions(aPos : TIDEWindowPlacement) : String;
begin
Result:='?';
Case aPos of
iwpUseWindowManagerSetting : Result:= rsiwpUseWindowManagerSetting;
iwpDefault : Result:= rsiwpDefault;
iwpRestoreWindowGeometry : Result:= rsiwpRestoreWindowGeometry;
iwpDocked : Result:= rsiwpDocked;
iwpCustomPosition : Result:= rsiwpCustomPosition;
iwpRestoreWindowSize : Result:= rsiwpRestoreWindowSize;
end;
end;
begin
if ALayout=nil then exit;
CurY:=5;
Col2X:=300;
PreviousButton:= nil;
for APlacement:=Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
if APlacement in ALayout.WindowPlacementsAllowed then
begin
if PlacementRadioButtons[APlacement]=nil then
PlacementRadioButtons[APlacement]:=TRadioButton.Create(Self);
with PlacementRadioButtons[APlacement] do
begin
Parent:=Self;
Left := 6;
if PreviousButton=nil then
Top := 6
else
AnchorToNeighbour(akTop,6,PreviousButton);
Caption:=GetRadioBtnCaptions(APlacement);
Checked:=(APlacement=ALayout.WindowPlacement);
end;
PreviousButton := PlacementRadioButtons[APlacement];
case APlacement of
iwpCustomPosition:
begin
// custom window position
SetLabelAndEdit(LeftLabel,LeftEdit,dlgLeftPos,Col2X,CurY);
SetLabelAndEdit(TopLabel,TopEdit,dlgTopPos,
LeftEdit.Left+LeftEdit.Width+15,CurY);
inc(CurY,LeftEdit.Height+6);
SetLabelAndEdit(WidthLabel,WidthEdit,dlgWidthPos,LeftLabel.Left,CurY);
SetLabelAndEdit(HeightLabel,HeightEdit,DlgHeightPos,
WidthEdit.Left+WidthEdit.Width+15,CurY);
inc(CurY,WidthEdit.Height+6);
if ALayout.CustomCoordinatesAreValid then begin
LeftEdit.Text:=IntToStr(ALayout.Left);
TopEdit.Text:=IntToStr(ALayout.Top);
WidthEdit.Text:=IntToStr(ALayout.Width);
HeightEdit.Text:=IntToStr(ALayout.Height);
end else if ALayout.Form<>nil then begin
LeftEdit.Text:=IntToStr(ALayout.Form.Left);
TopEdit.Text:=IntToStr(ALayout.Form.Top);
WidthEdit.Text:=IntToStr(ALayout.Form.Width);
HeightEdit.Text:=IntToStr(ALayout.Form.Height);
end;
end;
end;
end else begin
// window placement not allowed
if PlacementRadioButtons[APlacement]<>nil then
begin
PlacementRadioButtons[APlacement].Free;
PlacementRadioButtons[APlacement]:=nil;
end;
end;
end;
if ApplyButton=nil then
ApplyButton:=TButton.Create(Self);
with ApplyButton do
begin
Parent:=Self;
SetBounds(Col2X,CurY,Width,Height);
OnClick:=@ApplyButtonClick;
Caption:=dlgButApply;
AutoSize:=true;
end;
if iwpCustomPosition in ALayout.WindowPlacementsAllowed then
begin
if GetWindowPositionButton=nil then
GetWindowPositionButton:=TButton.Create(Self);
with GetWindowPositionButton do
begin
Parent:=Self;
OnClick:=@GetWindowPositionButtonClick;
Caption:=dlgGetPosition;
AutoSize:=true;
AnchorToNeighbour(akLeft,6,ApplyButton);
AnchorParallel(akTop,0,ApplyButton);
Enabled := ALayout.Form <> nil;
end;
end;
//inc(CurY,ApplyButton.Height+7);
end;
procedure TIDEWindowSetupLayoutComponent.SaveTo(AnLayout: TIDEWindowLayout);
var
APlacement: TIDEWindowPlacement;
ARadioButton: TRadioButton;
begin
if AnLayout=nil then exit;
if LeftEdit<>nil then
AnLayout.Left:=StrToIntDef(LeftEdit.Text,0);
if TopEdit<>nil then
AnLayout.Top:=StrToIntDef(TopEdit.Text,0);
if WidthEdit<>nil then
AnLayout.Width:=StrToIntDef(WidthEdit.Text,0);
if HeightEdit<>nil then
AnLayout.Height:=StrToIntDef(HeightEdit.Text,0);
for APlacement:=Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
ARadioButton:=GetPlacementRadioButtons(APlacement);
if (ARadioButton<>nil) and ARadioButton.Checked then
AnLayout.WindowPlacement:=APlacement;
end;
end;
constructor TIDEWindowSetupLayoutComponent.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
fUpdateRadioButtons:=false;
end;
function TIDEWindowSetupLayoutComponent.GetPlacementRadioButtons(
APlacement: TIDEWindowPlacement): TRadioButton;
begin
case APlacement of
iwpRestoreWindowGeometry: Result:=RestoreWindowGeometryRadioButton;
iwpDefault: Result:=DefaultRadioButton;
iwpCustomPosition: Result:=CustomPositionRadioButton;
iwpUseWindowManagerSetting: Result:=UseWindowManagerSettingRadioButton;
iwpDocked: Result:=DockedRadioButton;
else
Result:=nil;
end;
end;
procedure TIDEWindowSetupLayoutComponent.SetPlacementRadioButtons(
APlacement: TIDEWindowPlacement; const AValue: TRadioButton);
begin
case APlacement of
iwpRestoreWindowGeometry: RestoreWindowGeometryRadioButton:=AValue;
iwpDefault: DefaultRadioButton:=AValue;
iwpCustomPosition: CustomPositionRadioButton:=AValue;
iwpUseWindowManagerSetting: UseWindowManagerSettingRadioButton:=AValue;
iwpDocked: DockedRadioButton:=AValue;
end;
end;
procedure TIDEWindowSetupLayoutComponent.ApplyButtonClick(Sender: TObject);
begin
Save;
if Assigned(OnApplyWindowPos) then OnApplyWindowPos(Layout);
Layout.Apply;
end;
procedure TIDEWindowSetupLayoutComponent.GetWindowPositionButtonClick(
Sender: TObject);
begin
if Layout.Form<>nil then begin
if LeftEdit<>nil then
LeftEdit.Text:=IntToStr(Layout.Form.Left);
if TopEdit<>nil then
TopEdit.Text:=IntToStr(Layout.Form.Top);
if WidthEdit<>nil then
WidthEdit.Text:=IntToStr(Layout.Form.Width);
if HeightEdit<>nil then
HeightEdit.Text:=IntToStr(Layout.Form.Height);
end;
end;
function TIDEWindowSetupLayoutComponent.GetLayout: TIDEWindowLayout;
begin
Result:=fLayout;
end;
procedure TIDEWindowSetupLayoutComponent.SetLayout(
const AValue: TIDEWindowLayout);
begin
fLayout:=AValue;
LoadFrom(fLayout);
end;
procedure TIDEWindowSetupLayoutComponent.Save;
begin
SaveTo(Layout);
end;
initialization
{$I window_options.lrs}
RegisterIDEOptionsEditor(GroupEnvironment, TWindowOptionsFrame, EnvOptionsWindow);

View File

@ -274,52 +274,6 @@ type
read GetItems write SetItems; default;
end;
// ---------------------------------------------------------------------------
TOnApplyWindowPos = procedure(Layout: TIDEWindowLayout) of object;
TIDEWindowSetupLayoutComponent = class(TGroupBox)
RestoreWindowGeometryRadioButton: TRadioButton;
DefaultRadioButton: TRadioButton;
CustomPositionRadioButton: TRadioButton;
LeftLabel: TLabel;
LeftEdit: TEdit;
TopLabel: TLabel;
TopEdit: TEdit;
WidthLabel: TLabel;
WidthEdit: TEdit;
HeightLabel: TLabel;
HeightEdit: TEdit;
UseWindowManagerSettingRadioButton: TRadioButton;
DockedRadioButton: TRadioButton;
ApplyButton: TButton;
GetWindowPositionButton: TButton;
procedure ApplyButtonClick(Sender: TObject);
procedure GetWindowPositionButtonClick(Sender: TObject);
private
fOnApplyWindowPos: TOnApplyWindowPos;
fLayout: TIDEWindowLayout;
fUpdateRadioButtons: boolean;
protected
function GetLayout: TIDEWindowLayout;
procedure SetLayout(const AValue: TIDEWindowLayout);
function GetPlacementRadioButtons(APlacement: TIDEWindowPlacement
): TRadioButton;
procedure SetPlacementRadioButtons(APlacement: TIDEWindowPlacement;
const AValue: TRadioButton);
procedure LoadFrom(ALayout: TIDEWindowLayout);
procedure BoundsChanged; override;
public
constructor Create(TheOwner: TComponent); override;
procedure Save;
procedure SaveTo(AnLayout: TIDEWindowLayout);
property Layout: TIDEWindowLayout read GetLayout write SetLayout;
property PlacementRadioButtons[APlacement: TIDEWindowPlacement]: TRadioButton
read GetPlacementRadioButtons write SetPlacementRadioButtons;
property OnApplyWindowPos: TOnApplyWindowPos
read fOnApplyWindowPos write fOnApplyWindowPos;
end;
const
IDEWindowDockModeNames: array[TIDEWindowDockMode] of string = (
'Default', 'Left', 'Right', 'Top', 'Bottom'
@ -856,244 +810,9 @@ begin
end;
end;
{ TIDEWindowSetupLayoutComponent }
procedure TIDEWindowSetupLayoutComponent.BoundsChanged;
begin
inherited BoundsChanged;
LoadFrom(fLayout);
end;
procedure TIDEWindowSetupLayoutComponent.LoadFrom(ALayout: TIDEWindowLayout);
var
APlacement: TIDEWindowPlacement;
CurY: LongInt;
Col2X: Integer;
PreviousButton: TRadioButton;
procedure SetLabelAndEdit(var ALabel: TLabel;
var AnEdit: TEdit; const ACaption: string; x, y: integer);
begin
if iwpCustomPosition in ALayout.WindowPlacementsAllowed then begin
if ALabel=nil then ALabel:=TLabel.Create(Self);
with ALabel do begin
Parent:=Self;
SetBounds(x,y,45,Height);
Caption:=ACaption;
end;
if AnEdit=nil then AnEdit:=TEdit.Create(Self);
with AnEdit do begin
Parent:=Self;
SetBounds(x+ALabel.Width+3,y,40,Height);
Text:='';
end;
end else begin
FreeAndNil(ALabel);
FreeAndNil(AnEdit);
end;
end;
function GetRadioBtnCaptions(aPos : TIDEWindowPlacement) : String;
begin
Result:='?';
Case aPos of
iwpUseWindowManagerSetting : Result:= rsiwpUseWindowManagerSetting;
iwpDefault : Result:= rsiwpDefault;
iwpRestoreWindowGeometry : Result:= rsiwpRestoreWindowGeometry;
iwpDocked : Result:= rsiwpDocked;
iwpCustomPosition : Result:= rsiwpCustomPosition;
iwpRestoreWindowSize : Result:= rsiwpRestoreWindowSize;
end;
end;
begin
if ALayout=nil then exit;
CurY:=5;
Col2X:=300;
PreviousButton:= nil;
for APlacement:=Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
if APlacement in ALayout.WindowPlacementsAllowed then
begin
if PlacementRadioButtons[APlacement]=nil then
PlacementRadioButtons[APlacement]:=TRadioButton.Create(Self);
with PlacementRadioButtons[APlacement] do
begin
Parent:=Self;
Left := 6;
if PreviousButton=nil then
Top := 6
else
AnchorToNeighbour(akTop,6,PreviousButton);
Caption:=GetRadioBtnCaptions(APlacement);
Checked:=(APlacement=ALayout.WindowPlacement);
end;
PreviousButton := PlacementRadioButtons[APlacement];
case APlacement of
iwpCustomPosition:
begin
// custom window position
SetLabelAndEdit(LeftLabel,LeftEdit,dlgLeftPos,Col2X,CurY);
SetLabelAndEdit(TopLabel,TopEdit,dlgTopPos,
LeftEdit.Left+LeftEdit.Width+15,CurY);
inc(CurY,LeftEdit.Height+6);
SetLabelAndEdit(WidthLabel,WidthEdit,dlgWidthPos,LeftLabel.Left,CurY);
SetLabelAndEdit(HeightLabel,HeightEdit,DlgHeightPos,
WidthEdit.Left+WidthEdit.Width+15,CurY);
inc(CurY,WidthEdit.Height+6);
if ALayout.CustomCoordinatesAreValid then begin
LeftEdit.Text:=IntToStr(ALayout.Left);
TopEdit.Text:=IntToStr(ALayout.Top);
WidthEdit.Text:=IntToStr(ALayout.Width);
HeightEdit.Text:=IntToStr(ALayout.Height);
end else if ALayout.Form<>nil then begin
LeftEdit.Text:=IntToStr(ALayout.Form.Left);
TopEdit.Text:=IntToStr(ALayout.Form.Top);
WidthEdit.Text:=IntToStr(ALayout.Form.Width);
HeightEdit.Text:=IntToStr(ALayout.Form.Height);
end;
end;
end;
end else begin
// window placement not allowed
if PlacementRadioButtons[APlacement]<>nil then
begin
PlacementRadioButtons[APlacement].Free;
PlacementRadioButtons[APlacement]:=nil;
end;
end;
end;
if ApplyButton=nil then
ApplyButton:=TButton.Create(Self);
with ApplyButton do
begin
Parent:=Self;
SetBounds(Col2X,CurY,Width,Height);
OnClick:=@ApplyButtonClick;
Caption:=dlgButApply;
AutoSize:=true;
end;
if iwpCustomPosition in ALayout.WindowPlacementsAllowed then
begin
if GetWindowPositionButton=nil then
GetWindowPositionButton:=TButton.Create(Self);
with GetWindowPositionButton do
begin
Parent:=Self;
OnClick:=@GetWindowPositionButtonClick;
Caption:=dlgGetPosition;
AutoSize:=true;
AnchorToNeighbour(akLeft,6,ApplyButton);
AnchorParallel(akTop,0,ApplyButton);
Enabled := ALayout.Form <> nil;
end;
end;
//inc(CurY,ApplyButton.Height+7);
end;
procedure TIDEWindowSetupLayoutComponent.SaveTo(AnLayout: TIDEWindowLayout);
var
APlacement: TIDEWindowPlacement;
ARadioButton: TRadioButton;
begin
if AnLayout=nil then exit;
if LeftEdit<>nil then
AnLayout.Left:=StrToIntDef(LeftEdit.Text,0);
if TopEdit<>nil then
AnLayout.Top:=StrToIntDef(TopEdit.Text,0);
if WidthEdit<>nil then
AnLayout.Width:=StrToIntDef(WidthEdit.Text,0);
if HeightEdit<>nil then
AnLayout.Height:=StrToIntDef(HeightEdit.Text,0);
for APlacement:=Low(TIDEWindowPlacement) to High(TIDEWindowPlacement) do
begin
ARadioButton:=GetPlacementRadioButtons(APlacement);
if (ARadioButton<>nil) and ARadioButton.Checked then
AnLayout.WindowPlacement:=APlacement;
end;
end;
constructor TIDEWindowSetupLayoutComponent.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
fUpdateRadioButtons:=false;
end;
function TIDEWindowSetupLayoutComponent.GetPlacementRadioButtons(
APlacement: TIDEWindowPlacement): TRadioButton;
begin
case APlacement of
iwpRestoreWindowGeometry: Result:=RestoreWindowGeometryRadioButton;
iwpDefault: Result:=DefaultRadioButton;
iwpCustomPosition: Result:=CustomPositionRadioButton;
iwpUseWindowManagerSetting: Result:=UseWindowManagerSettingRadioButton;
iwpDocked: Result:=DockedRadioButton;
else
Result:=nil;
end;
end;
procedure TIDEWindowSetupLayoutComponent.SetPlacementRadioButtons(
APlacement: TIDEWindowPlacement; const AValue: TRadioButton);
begin
case APlacement of
iwpRestoreWindowGeometry: RestoreWindowGeometryRadioButton:=AValue;
iwpDefault: DefaultRadioButton:=AValue;
iwpCustomPosition: CustomPositionRadioButton:=AValue;
iwpUseWindowManagerSetting: UseWindowManagerSettingRadioButton:=AValue;
iwpDocked: DockedRadioButton:=AValue;
end;
end;
procedure TIDEWindowSetupLayoutComponent.ApplyButtonClick(Sender: TObject);
begin
Save;
if Assigned(OnApplyWindowPos) then OnApplyWindowPos(Layout);
Layout.Apply;
end;
procedure TIDEWindowSetupLayoutComponent.GetWindowPositionButtonClick(
Sender: TObject);
begin
if Layout.Form<>nil then begin
if LeftEdit<>nil then
LeftEdit.Text:=IntToStr(Layout.Form.Left);
if TopEdit<>nil then
TopEdit.Text:=IntToStr(Layout.Form.Top);
if WidthEdit<>nil then
WidthEdit.Text:=IntToStr(Layout.Form.Width);
if HeightEdit<>nil then
HeightEdit.Text:=IntToStr(Layout.Form.Height);
end;
end;
function TIDEWindowSetupLayoutComponent.GetLayout: TIDEWindowLayout;
begin
Result:=fLayout;
end;
procedure TIDEWindowSetupLayoutComponent.SetLayout(
const AValue: TIDEWindowLayout);
begin
fLayout:=AValue;
LoadFrom(fLayout);
end;
procedure TIDEWindowSetupLayoutComponent.Save;
begin
SaveTo(Layout);
end;
{ TXMLOptionsStorage }
function TXMLOptionsStorage.GetFullPathValue(const APath, ADefault: String
): String;
function TXMLOptionsStorage.GetFullPathValue(const APath, ADefault: String): String;
begin
Result:=XMLConfig.GetValue(APath, ADefault);
end;