mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 14:38:01 +02:00
IDE: Improve "All options" window, show compiler version in caption. Issue #40968, patch by n7800.
This commit is contained in:
parent
520eccce1a
commit
a3ac0ccd82
@ -6,12 +6,13 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
|
||||
Caption = 'frmAllCompilerOptions'
|
||||
ClientHeight = 497
|
||||
ClientWidth = 622
|
||||
Position = poWorkAreaCenter
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.3'
|
||||
object sbAllOptions: TScrollBox
|
||||
Left = 0
|
||||
Height = 411
|
||||
Top = 34
|
||||
Height = 418
|
||||
Top = 33
|
||||
Width = 622
|
||||
HorzScrollBar.Increment = 61
|
||||
HorzScrollBar.Page = 618
|
||||
@ -29,8 +30,8 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
|
||||
end
|
||||
object ButtonPanel1: TButtonPanel
|
||||
Left = 6
|
||||
Height = 40
|
||||
Top = 451
|
||||
Height = 34
|
||||
Top = 457
|
||||
Width = 610
|
||||
OKButton.Name = 'OKButton'
|
||||
OKButton.DefaultCaption = True
|
||||
@ -45,34 +46,37 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
|
||||
end
|
||||
object pnlFilter: TPanel
|
||||
Left = 0
|
||||
Height = 34
|
||||
Height = 33
|
||||
Top = 0
|
||||
Width = 622
|
||||
Align = alTop
|
||||
ClientHeight = 34
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 33
|
||||
ClientWidth = 622
|
||||
TabOrder = 2
|
||||
object edOptionsFilter: TEdit
|
||||
Left = 3
|
||||
Height = 24
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 98
|
||||
Width = 120
|
||||
Align = alLeft
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
OnChange = edOptionsFilterChange
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnResetOptionsFilter: TSpeedButton
|
||||
AnchorSideLeft.Control = edOptionsFilter
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edOptionsFilter
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 101
|
||||
Height = 25
|
||||
Top = 3
|
||||
Width = 29
|
||||
Left = 126
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 23
|
||||
Align = alLeft
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
OnClick = btnResetOptionsFilterClick
|
||||
ShowHint = True
|
||||
ParentShowHint = False
|
||||
@ -80,13 +84,13 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
|
||||
object cbShowModified: TCheckBox
|
||||
AnchorSideLeft.Control = btnResetOptionsFilter
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = btnResetOptionsFilter
|
||||
AnchorSideTop.Control = edOptionsFilter
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 159
|
||||
Height = 21
|
||||
Top = 5
|
||||
Width = 135
|
||||
BorderSpacing.Left = 29
|
||||
Left = 155
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 112
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Show only modified'
|
||||
OnClick = cbShowModifiedClick
|
||||
TabOrder = 1
|
||||
@ -94,14 +98,32 @@ object frmAllCompilerOptions: TfrmAllCompilerOptions
|
||||
object cbUseComments: TCheckBox
|
||||
AnchorSideLeft.Control = cbShowModified
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = cbShowModified
|
||||
Left = 323
|
||||
Height = 21
|
||||
Top = 5
|
||||
Width = 218
|
||||
BorderSpacing.Left = 29
|
||||
AnchorSideTop.Control = edOptionsFilter
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 273
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 175
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Use comments in custom options'
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object txtErrorMsg: TStaticText
|
||||
AnchorSideLeft.Control = sbAllOptions
|
||||
AnchorSideTop.Control = sbAllOptions
|
||||
AnchorSideRight.Control = sbAllOptions
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 14
|
||||
Top = 39
|
||||
Width = 610
|
||||
Alignment = taCenter
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Error'
|
||||
TabOrder = 3
|
||||
Visible = False
|
||||
end
|
||||
end
|
||||
|
@ -34,7 +34,7 @@ uses
|
||||
// LazUtils
|
||||
LazUTF8, LazLoggerBase,
|
||||
// IdeIntf
|
||||
IDEImagesIntf,
|
||||
IDEImagesIntf, IDEWindowIntf,
|
||||
// IDE
|
||||
Compiler, LazarusIDEStrConsts;
|
||||
|
||||
@ -50,6 +50,7 @@ type
|
||||
edOptionsFilter: TEdit;
|
||||
pnlFilter: TPanel;
|
||||
sbAllOptions: TScrollBox;
|
||||
txtErrorMsg: TStaticText;
|
||||
procedure btnResetOptionsFilterClick(Sender: TObject);
|
||||
procedure cbShowModifiedClick(Sender: TObject);
|
||||
procedure sbMouseWheel(Sender: TObject; {%H-}Shift: TShiftState;
|
||||
@ -63,7 +64,7 @@ type
|
||||
FGeneratedControls: TComponentList;
|
||||
FEffectiveFilter: string;
|
||||
FEffectiveShowModified: Boolean;
|
||||
FRenderedOnce: Boolean;
|
||||
FInitialRender: Boolean;
|
||||
procedure SetIdleConnected(AValue: Boolean);
|
||||
procedure OnIdle(Sender: TObject; var {%H-}Done: Boolean);
|
||||
procedure CheckBoxClick(Sender: TObject);
|
||||
@ -99,6 +100,7 @@ end;
|
||||
|
||||
destructor TfrmAllCompilerOptions.Destroy;
|
||||
begin
|
||||
IDEDialogLayoutList.SaveLayout(self);
|
||||
IdleConnected:=false;
|
||||
FGeneratedControls.Clear;
|
||||
FreeAndNil(FGeneratedControls);
|
||||
@ -112,7 +114,7 @@ end;
|
||||
|
||||
procedure TfrmAllCompilerOptions.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Caption:=lisAllOptions;
|
||||
Caption:=Format(lisAllOptions, ['', 'fpc']);
|
||||
edOptionsFilter.Hint := lisFilterTheAvailableOptionsList;
|
||||
IDEImages.AssignImage(btnResetOptionsFilter, ResBtnListFilter);
|
||||
btnResetOptionsFilter.Enabled := False;
|
||||
@ -121,8 +123,9 @@ begin
|
||||
cbUseComments.Caption:=lisUseCommentsInCustomOptions;
|
||||
FEffectiveFilter:=#1; // Set an impossible value first, makes sure options are filtered.
|
||||
ButtonPanel1.ShowBevel := False;
|
||||
FRenderedOnce := False;
|
||||
FInitialRender := True;
|
||||
IdleConnected := True;
|
||||
IDEDialogLayoutList.ApplyLayout(self, 600, 500);
|
||||
end;
|
||||
|
||||
procedure TfrmAllCompilerOptions.edOptionsFilterChange(Sender: TObject);
|
||||
@ -172,20 +175,35 @@ begin
|
||||
if FOptionsThread=nil then exit;
|
||||
Screen.BeginWaitCursor;
|
||||
try
|
||||
FOptionsThread.EndParsing; // Make sure the options are read.
|
||||
FOptionsThread.EndParsing; // make sure the options are read
|
||||
|
||||
with FOptionsReader do
|
||||
if FOptionsReader.CompilerVersion = '' then
|
||||
Caption := Format(lisAllOptions, ['', CompilerExecutable])
|
||||
else
|
||||
Caption := Format(lisAllOptions, [' ' + CompilerVersion, CompilerExecutable]);
|
||||
|
||||
txtErrorMsg.Visible := FOptionsReader.ErrorMsg <> '';
|
||||
if FOptionsReader.ErrorMsg <> '' then
|
||||
DebugLn(FOptionsReader.ErrorMsg)
|
||||
txtErrorMsg.Caption := FOptionsReader.ErrorMsg
|
||||
else begin
|
||||
StartTime := Now;
|
||||
RenderAndFilterOptions;
|
||||
DebugLn(Format('AllCompilerOptions: Time for reading options: %s, rendering GUI: %s',
|
||||
[FormatTimeWithMs(FOptionsThread.ReadTime),
|
||||
FormatTimeWithMs(Now-StartTime)]));
|
||||
|
||||
if FInitialRender then
|
||||
begin
|
||||
txtErrorMsg.Caption := lisCheckCompilerPath;
|
||||
txtErrorMsg.Visible := FOptionsReader.RootOptGroup.CompilerOpts.Count <= 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
Screen.EndWaitCursor;
|
||||
end;
|
||||
FRenderedOnce := True;
|
||||
FInitialRender := False;
|
||||
end;
|
||||
|
||||
procedure TfrmAllCompilerOptions.sbMouseWheel(Sender: TObject;
|
||||
|
@ -187,8 +187,10 @@ type
|
||||
fSupportedCategories: TStringListUTF8Fast;
|
||||
// Hierarchy of options parsed from "fpc -h".
|
||||
fRootOptGroup: TCompilerOptGroup;
|
||||
fCompilerExecutable: string; // Compiler path must be set by caller.
|
||||
fFpcVersion: string; // Parsed from "fpc -h".
|
||||
// Compiler path must be set by caller
|
||||
fCompilerExecutable: string;
|
||||
// Parsed from "fpc -h"
|
||||
fCompilerVersion: string;
|
||||
fIsNewFpc: Boolean;
|
||||
fParsedTarget: String;
|
||||
fErrorMsg: String;
|
||||
@ -221,6 +223,7 @@ type
|
||||
//property SupportedCategories: TStringList read fSupportedCategories;
|
||||
property RootOptGroup: TCompilerOptGroup read fRootOptGroup;
|
||||
property CompilerExecutable: string read fCompilerExecutable write fCompilerExecutable;
|
||||
property CompilerVersion: string read fCompilerVersion;
|
||||
property ParsedTarget: String read fParsedTarget write fParsedTarget;
|
||||
property ErrorMsg: String read fErrorMsg write fErrorMsg;
|
||||
end;
|
||||
@ -920,6 +923,8 @@ end;
|
||||
constructor TCompilerOptReader.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
fCompilerExecutable := '';
|
||||
fCompilerVersion := '';
|
||||
fDefines := TStringList.Create;
|
||||
fInvalidOptions := TStringList.Create;
|
||||
fSupportedCategories := TStringListUTF8Fast.Create;
|
||||
@ -1068,10 +1073,10 @@ begin
|
||||
V1 := PosEx(' ', s, Start);
|
||||
if V1 > 0 then
|
||||
begin
|
||||
fFpcVersion := Copy(s, Start, V1-Start);
|
||||
if (Length(fFpcVersion)>2) then begin
|
||||
V1 := StrToIntDef(fFpcVersion[1], 0);
|
||||
V2 := StrToIntDef(fFpcVersion[3], 0);
|
||||
fCompilerVersion := Copy(s, Start, V1-Start);
|
||||
if (Length(fCompilerVersion)>2) then begin
|
||||
V1 := StrToIntDef(fCompilerVersion[1], 0);
|
||||
V2 := StrToIntDef(fCompilerVersion[3], 0);
|
||||
fIsNewFpc := ((V1=2) and (V2>=7)) or (V1>2);
|
||||
end;
|
||||
// The rest 2 fields are date and target CPU.
|
||||
@ -1137,7 +1142,7 @@ begin
|
||||
ThisInd := OptSetInd;
|
||||
end;
|
||||
// Top header line for compiler version, check only once.
|
||||
if (fFpcVersion = '') and ReadVersion(ThisLine) then Continue;
|
||||
if (fCompilerVersion = '') and ReadVersion(ThisLine) then Continue;
|
||||
if ThisInd < 2 then Continue;
|
||||
if (ThisLine = '') or (ThisInd > 30)
|
||||
or (ThisLine[1] = '@')
|
||||
|
@ -2380,7 +2380,8 @@ resourcestring
|
||||
lisWriteConfigInsteadOfCommandLineParameters = 'Write config instead of '
|
||||
+'command line parameters';
|
||||
dlgUseCustomConfig = 'Use additional compiler config file';
|
||||
lisAllOptions = 'All Options';
|
||||
lisAllOptions = 'All options of FPC%s ("%s")';
|
||||
lisCheckCompilerPath = 'Please make sure that the path to the compiler in the IDE options is correct';
|
||||
lisFilterTheAvailableOptionsList = 'Filter the available options list';
|
||||
lisClearTheFilterForOptions = 'Clear the filter for options';
|
||||
lisShowOnlyModified = 'Show only modified';
|
||||
|
Loading…
Reference in New Issue
Block a user