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