IDE: Tweaking the GUI for all compiler options.

git-svn-id: trunk@42353 -
This commit is contained in:
juha 2013-08-05 14:26:38 +00:00
parent 37ac5d3c1f
commit 97c2de6fb3
4 changed files with 66 additions and 49 deletions

View File

@ -11,7 +11,7 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
object edOptionsFilter: TEdit object edOptionsFilter: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 0 Left = 0
Height = 25 Height = 26
Top = 0 Top = 0
Width = 98 Width = 98
OnChange = edOptionsFilterChange OnChange = edOptionsFilterChange
@ -40,15 +40,15 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1 AnchorSideBottom.Control = ButtonPanel1
Left = 0 Left = 0
Height = 424 Height = 419
Top = 25 Top = 26
Width = 616 Width = 616
HorzScrollBar.Increment = 61 HorzScrollBar.Increment = 61
HorzScrollBar.Page = 614 HorzScrollBar.Page = 612
HorzScrollBar.Smooth = True HorzScrollBar.Smooth = True
HorzScrollBar.Tracking = True HorzScrollBar.Tracking = True
VertScrollBar.Increment = 42 VertScrollBar.Increment = 41
VertScrollBar.Page = 422 VertScrollBar.Page = 415
VertScrollBar.Smooth = True VertScrollBar.Smooth = True
VertScrollBar.Tracking = True VertScrollBar.Tracking = True
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
@ -58,8 +58,8 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
end end
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 36 Height = 40
Top = 455 Top = 451
Width = 610 Width = 610
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
@ -78,9 +78,9 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
AnchorSideTop.Control = btnResetOptionsFilter AnchorSideTop.Control = btnResetOptionsFilter
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 156 Left = 156
Height = 24 Height = 22
Top = 0 Top = 1
Width = 133 Width = 166
BorderSpacing.Left = 29 BorderSpacing.Left = 29
Caption = 'Show only modified' Caption = 'Show only modified'
OnClick = cbShowModifiedClick OnClick = cbShowModifiedClick
@ -90,10 +90,10 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
AnchorSideLeft.Control = cbShowModified AnchorSideLeft.Control = cbShowModified
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbShowModified AnchorSideTop.Control = cbShowModified
Left = 318 Left = 351
Height = 24 Height = 22
Top = 0 Top = 1
Width = 206 Width = 270
BorderSpacing.Left = 29 BorderSpacing.Left = 29
Caption = 'Use comments in custom options' Caption = 'Use comments in custom options'
TabOrder = 4 TabOrder = 4

View File

@ -184,8 +184,8 @@ procedure TfrmAllCompilerOptions.RenderAndFilterOptions;
const const
LeftEdit = 120; LeftEdit = 120;
LeftDescrEdit = 250; LeftDescrEdit = 250;
LeftDescrBoolean = 120; LeftDescrBoolean = 140;
LeftDescrGroup = 100; LeftDescrGroup = 110;
var var
Opt: TCompilerOpt; Opt: TCompilerOpt;
yLoc: Integer; yLoc: Integer;
@ -249,26 +249,22 @@ var
var var
Cntrl, Lbl: TControl; Cntrl, Lbl: TControl;
cb: TComboBox; cb: TComboBox;
i, NewLeft: Integer; i: Integer;
begin begin
for i := 0 to aParentGroup.CompilerOpts.Count-1 do begin for i := 0 to aParentGroup.CompilerOpts.Count-1 do begin
Opt := TCompilerOpt(aParentGroup.CompilerOpts[i]); Opt := TCompilerOpt(aParentGroup.CompilerOpts[i]);
if Opt.Ignored or not Opt.Visible then Continue; // Maybe filtered out if Opt.Ignored or not Opt.Visible then Continue; // Maybe filtered out
case Opt.EditKind of case Opt.EditKind of
oeGroup, oeSet: begin // Label for group or set oeGroup, oeSet: begin // Label for group or set
Cntrl := MakeOptionCntrl(TLabel, Opt.Option+Opt.Suffix{+#9#9+Opt.Description}); Cntrl := MakeOptionCntrl(TLabel, Opt.Option+Opt.Suffix);
MakeDescrLabel(Cntrl, LeftDescrGroup); MakeDescrLabel(Cntrl, Opt.CalcLeft(LeftDescrGroup, 7));
end; end;
oeBoolean: begin // CheckBox oeBoolean: begin // CheckBox
Cntrl := MakeOptionCntrl(TCheckBox, Opt.Option); Cntrl := MakeOptionCntrl(TCheckBox, Opt.Option);
Assert((Opt.Value='') or (Opt.Value='True'), 'Wrong value in Boolean option '+Opt.Option); Assert((Opt.Value='') or (Opt.Value='True'), 'Wrong value in Boolean option '+Opt.Option);
TCheckBox(Cntrl).Checked := Opt.Value<>''; TCheckBox(Cntrl).Checked := Opt.Value<>'';
if Length(Opt.Option) > 9 then
NewLeft := LeftDescrBoolean + (Length(Opt.Option)-9)*8
else
NewLeft := LeftDescrBoolean;
Cntrl.OnClick := @CheckBoxClick; Cntrl.OnClick := @CheckBoxClick;
MakeDescrLabel(Cntrl, NewLeft); MakeDescrLabel(Cntrl, Opt.CalcLeft(LeftDescrBoolean, 11));
end; end;
oeSetElem: begin // Sub-item for set, CheckBox oeSetElem: begin // Sub-item for set, CheckBox
Cntrl := MakeOptionCntrl(TCheckBox, Opt.Option+Opt.Description); Cntrl := MakeOptionCntrl(TCheckBox, Opt.Option+Opt.Description);

View File

@ -108,6 +108,7 @@ type
public public
constructor Create(aOwnerGroup: TCompilerOptGroup); constructor Create(aOwnerGroup: TCompilerOptGroup);
destructor Destroy; override; destructor Destroy; override;
function CalcLeft(aDefaultLeft, aLimit: integer): integer;
public public
property Id: integer read fId; property Id: integer read fId;
property Option: string read fOption; property Option: string read fOption;
@ -457,6 +458,17 @@ begin
} }
end; end;
function TCompilerOpt.CalcLeft(aDefaultLeft, aLimit: integer): integer;
var
Len: Integer;
begin
Len := (fIndentation div 2) + Length(fOption); // Approximation
if Len > aLimit then
Result := aDefaultLeft + (Len-aLimit)*8
else
Result := aDefaultLeft;
end;
{ TCompilerOptGroup } { TCompilerOptGroup }
constructor TCompilerOptGroup.Create(aOwnerGroup: TCompilerOptGroup); constructor TCompilerOptGroup.Create(aOwnerGroup: TCompilerOptGroup);
@ -722,7 +734,9 @@ begin
Opt1 := ''; Opt1 := '';
end; end;
if Opt1 <> '' then // Can be empty when line in help output is split. if Opt1 <> '' then // Can be empty when line in help output is split.
NewSetElem(Opt1); NewSetElem(Opt1)
else if fCompilerOpts.Count > 0 then
aIndent := TCompilerOpt(fCompilerOpts[0]).Indentation;
if Opt2 <> '' then if Opt2 <> '' then
NewSetElem(Opt2); NewSetElem(Opt2);
end; end;

View File

@ -18,13 +18,13 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
Align = alClient Align = alClient
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
Caption = 'grpConditionals' Caption = 'grpConditionals'
ClientHeight = 147 ClientHeight = 146
ClientWidth = 476 ClientWidth = 476
TabOrder = 0 TabOrder = 0
inline CondSynEdit: TSynEdit inline CondSynEdit: TSynEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 0 Left = 0
Height = 127 Height = 124
Top = 0 Top = 0
Width = 476 Width = 476
Align = alClient Align = alClient
@ -663,8 +663,8 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
end end
object CondStatusbar: TStatusBar object CondStatusbar: TStatusBar
Left = 0 Left = 0
Height = 20 Height = 22
Top = 127 Top = 124
Width = 476 Width = 476
Panels = < Panels = <
item item
@ -697,17 +697,18 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
Width = 480 Width = 480
Align = alBottom Align = alBottom
Caption = 'grpCustomOptions' Caption = 'grpCustomOptions'
ClientHeight = 183 ClientHeight = 182
ClientWidth = 476 ClientWidth = 476
TabOrder = 2 TabOrder = 2
object memoCustomOptions: TMemo object memoCustomOptions: TMemo
AnchorSideLeft.Control = grpCustomOptions AnchorSideLeft.Control = grpCustomOptions
AnchorSideRight.Control = btnAllOptions
AnchorSideBottom.Control = grpCustomOptions AnchorSideBottom.Control = grpCustomOptions
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 179 Height = 178
Top = 4 Top = 4
Width = 375 Width = 366
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Right = 6 BorderSpacing.Right = 6
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
@ -715,13 +716,16 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
WordWrap = False WordWrap = False
end end
object Label1: TLabel object Label1: TLabel
AnchorSideTop.Control = btnAllOptions
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = grpCustomOptions AnchorSideRight.Control = grpCustomOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 417 Left = 411
Height = 15 Height = 18
Top = 30 Top = 33
Width = 38 Width = 44
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 1
BorderSpacing.Right = 21 BorderSpacing.Right = 21
Caption = 'Under' Caption = 'Under'
Font.Color = clMaroon Font.Color = clMaroon
@ -729,12 +733,14 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
ParentFont = False ParentFont = False
end end
object Label2: TLabel object Label2: TLabel
AnchorSideTop.Control = Label1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = grpCustomOptions AnchorSideRight.Control = grpCustomOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 385 Left = 371
Height = 15 Height = 18
Top = 45 Top = 51
Width = 91 Width = 105
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'construction...' Caption = 'construction...'
Font.Color = clMaroon Font.Color = clMaroon
@ -744,10 +750,10 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
object btnAllOptions: TBitBtn object btnAllOptions: TBitBtn
AnchorSideRight.Control = grpCustomOptions AnchorSideRight.Control = grpCustomOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 381 Left = 372
Height = 26 Height = 28
Top = 4 Top = 4
Width = 95 Width = 104
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = True AutoSize = True
Caption = 'All options ...' Caption = 'All options ...'
@ -755,15 +761,16 @@ object CompilerOtherOptionsFrame: TCompilerOtherOptionsFrame
TabOrder = 1 TabOrder = 1
end end
object btnDefines: TBitBtn object btnDefines: TBitBtn
AnchorSideLeft.Control = btnAllOptions
AnchorSideTop.Control = btnAllOptions AnchorSideTop.Control = btnAllOptions
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = btnAllOptions AnchorSideRight.Control = btnAllOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 399 Left = 372
Height = 26 Height = 28
Top = 70 Top = 72
Width = 77 Width = 104
Anchors = [akTop, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 40 BorderSpacing.Top = 40
Caption = 'Defines ...' Caption = 'Defines ...'