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

View File

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

View File

@ -108,6 +108,7 @@ type
public
constructor Create(aOwnerGroup: TCompilerOptGroup);
destructor Destroy; override;
function CalcLeft(aDefaultLeft, aLimit: integer): integer;
public
property Id: integer read fId;
property Option: string read fOption;
@ -457,6 +458,17 @@ begin
}
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 }
constructor TCompilerOptGroup.Create(aOwnerGroup: TCompilerOptGroup);
@ -722,7 +734,9 @@ begin
Opt1 := '';
end;
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
NewSetElem(Opt2);
end;

View File

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