IDE: in options dialog show the Build Mode panel only for Compiler Options

git-svn-id: trunk@38599 -
This commit is contained in:
juha 2012-09-09 13:12:19 +00:00
parent 1ea614e177
commit c0a26b09eb
2 changed files with 62 additions and 51 deletions

View File

@ -18,8 +18,8 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
Left = 6
Height = 34
Top = 364
Height = 41
Top = 357
Width = 663
BorderSpacing.Left = 6
BorderSpacing.Right = 6
@ -39,18 +39,18 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
end
object CatTVSplitter: TSplitter[1]
Left = 255
Height = 364
Height = 357
Top = 0
Width = 4
end
object CategoryPanel: TPanel[2]
Left = 0
Height = 364
Height = 357
Top = 0
Width = 255
Align = alLeft
BevelOuter = bvNone
ClientHeight = 364
ClientHeight = 357
ClientWidth = 255
Constraints.MinWidth = 150
TabOrder = 2
@ -62,12 +62,11 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = SettingsPanel
Left = 6
Height = 308
Top = 36
Height = 299
Top = 38
Width = 249
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 5
DefaultItemHeight = 18
ReadOnly = True
TabOrder = 0
OnChange = CategoryTreeChange
@ -80,7 +79,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideLeft.Control = CategoryPanel
AnchorSideRight.Side = asrBottom
Left = 6
Height = 23
Height = 25
Top = 8
Width = 200
OnFilterItem = FilterEditFilterItem
@ -97,7 +96,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
object SettingsPanel: TPanel
Left = 0
Height = 20
Top = 344
Top = 337
Width = 255
Align = alBottom
AutoSize = True
@ -118,12 +117,11 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
ClientHeight = 40
ClientWidth = 413
TabOrder = 3
Visible = False
object BuildModeLabel: TLabel
Left = 12
Height = 15
Top = 13
Width = 63
Height = 17
Top = 10
Width = 70
Caption = 'Build Mode'
ParentColor = False
end
@ -132,9 +130,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModeLabel
AnchorSideTop.Side = asrCenter
Left = 82
Height = 23
Top = 9
Left = 89
Height = 29
Top = 4
Width = 154
BorderSpacing.Left = 7
ItemHeight = 0
@ -150,9 +148,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BuildModeComboBox
AnchorSideTop.Side = asrCenter
Left = 243
Left = 250
Height = 25
Top = 8
Top = 6
Width = 27
BorderSpacing.Left = 7
Caption = '...'
@ -161,9 +159,9 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
end
object Label1: TLabel
Left = 286
Height = 15
Height = 17
Top = 13
Width = 118
Width = 138
Caption = 'Under construction ...'
Color = clFuchsia
ParentColor = False
@ -177,12 +175,12 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel
Left = 259
Height = 324
Height = 317
Top = 40
Width = 413
HorzScrollBar.Page = 407
HorzScrollBar.Page = 409
HorzScrollBar.Tracking = True
VertScrollBar.Page = 318
VertScrollBar.Page = 313
VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 4

View File

@ -34,7 +34,7 @@ uses
Buttons, ButtonPanel, ExtCtrls,
IDEWindowIntf, IDEOptionsIntf, IDECommands, IDEHelpIntf,
EnvironmentOpts, LazarusIDEStrConsts,
EditorOptions, TreeFilterEdit, EditBtn, StdCtrls;
CompOptsIntf, EditorOptions, TreeFilterEdit, EditBtn, StdCtrls;
type
TIDEOptsDlgAction = (
@ -82,6 +82,7 @@ type
SelectNode: TTreeNode;
NewLastSelected: PIDEOptionsEditorRec;
function FindGroupClass(Node: TTreeNode): TAbstractIDEOptionsClass;
procedure TraverseSettings(AOptions: TAbstractIDEOptions; anAction: TIDEOptsDlgAction);
function CheckValues: boolean;
procedure DoOpenEditor(EditorToOpen: TAbstractIDEOptionsEditorClass);
@ -126,6 +127,7 @@ begin
FEditorsCreated := False;
FEditorToOpen := nil;
SettingsPanel.Constraints.MinHeight:=0;
BuildModeSelectPanel.Height:=0;
IDEDialogLayoutList.ApplyLayout(Self, Width, Height);
Caption := dlgIDEOptions;
@ -155,31 +157,33 @@ end;
procedure TIDEOptionsDialog.CategoryTreeChange(Sender: TObject; Node: TTreeNode);
var
GroupClass: TAbstractIDEOptionsClass;
AEditor: TAbstractIDEOptionsEditor;
SelNode: TTreeNode;
begin
if Assigned(Node) then begin
// The GUI filter can hide nodes. Get a visible node.
if not Node.Visible then
Node := Node.GetPrevVisible;
while Assigned(Node) do begin
if Assigned(Node.Data) then
break;
// Group category node Has Data=nil. Get the first sub-item.
while Assigned(Node) and not Assigned(Node.Data) do
Node := Node.GetFirstVisibleChild;
end;
end;
AEditor := nil;
GroupClass := nil;
if Assigned(Node) and Assigned(Node.Data) then begin
Assert(TObject(Node.Data) is TAbstractIDEOptionsEditor, 'Node.Data is not TAbstractIDEOptionsEditor');
SelNode:=CategoryTree.Selected;
if SelNode=nil then
Node.Selected:=True
else begin
//DebugLn('TIDEOptionsDialog.CategoryTreeChange: Selected Node=', SelNode.Text);
end;
Assert(TObject(Node.Data) is TAbstractIDEOptionsEditor,
'TIDEOptionsDialog.CategoryTreeChange: Node.Data is not TAbstractIDEOptionsEditor');
if CategoryTree.Selected = nil then
Node.Selected := True;
AEditor := TAbstractIDEOptionsEditor(Node.Data);
//DebugLn('TIDEOptionsDialog.CategoryTreeChange: Editor=', AEditor.Name);
end
GroupClass := FindGroupClass(Node);
end;
// Show the Build Mode panel for Compiler Options
if (GroupClass <> nil) and (GroupClass.InheritsFrom(TLazCompilerOptions)) then
BuildModeSelectPanel.Height:=40
else
AEditor:=nil;
BuildModeSelectPanel.Height:=0;
// Hide the old and show the new editor frame
if Assigned(AEditor) then
NewLastSelected := AEditor.Rec;
if (AEditor <> PrevEditor) then begin
@ -265,6 +269,21 @@ begin
ModalResult := mrCancel;
end;
function TIDEOptionsDialog.FindGroupClass(Node: TTreeNode): TAbstractIDEOptionsClass;
// Find the group category class where this node belongs to.
begin
while Assigned(Node) do begin
if Assigned(Node.Parent) then
Node := Node.Parent
else
Break;
end;
// GroupRec is stored in the first child editor
Result := nil;
if Assigned(Node) then
Result := TAbstractIDEOptionsEditor(Node.GetFirstChild.Data).GroupRec^.GroupClass;
end;
procedure TIDEOptionsDialog.TraverseSettings(AOptions: TAbstractIDEOptions;
anAction: TIDEOptsDlgAction);
var
@ -474,10 +493,8 @@ begin
Instance.Parent := EditorsPanel;
instance.Rec := Rec^.Items[j];
if Rec^.Items[j]^.Parent = NoParent then
ItemParent := GroupNode
else
begin
ItemParent := GroupNode;
if Rec^.Items[j]^.Parent <> NoParent then begin
ItemParent := SearchNode(GroupNode.GetFirstChild, Rec^.Items[j]^.Parent);
if ItemParent = nil then
ItemParent := GroupNode;
@ -496,7 +513,6 @@ begin
if (GroupNode.GetFirstChild <> nil) and (GroupNode.GetFirstChild.Data <> nil) then
TAbstractIDEOptionsEditor(GroupNode.GetFirstChild.Data).GroupRec := Rec;
GroupNode.Expanded := not Rec^.Collapsed;
//GroupNode.Data := Rec;
end;
end;
if SelectNode <> nil then
@ -528,14 +544,11 @@ var
i: Integer;
begin
if (ARec^.GroupClass = nil) then
if Length(OptionsFilter) <> 0 then
Exit(False)
else
Exit(True);
Exit(Length(OptionsFilter) = 0);
for i := 0 to Length(OptionsFilter) - 1 do
if ARec^.GroupClass.InheritsFrom(OptionsFilter[i]) then
Exit(True);
if ARec^.GroupClass.InheritsFrom(OptionsFilter[i]) then
Exit(True);
Result := False;
end;