IDE: Show IDE macros in IDEInfoDlg (View -> IDE internals -> About IDE). Add time to AboutFrm. Issue #40360, patch by Bruno K.

This commit is contained in:
Juha 2023-07-04 10:55:13 +03:00
parent 1f41c47dde
commit 5472c6d536
3 changed files with 106 additions and 36 deletions

View File

@ -157,17 +157,19 @@ const
function GetLocalizedBuildDate(): string;
var
BuildDate: string;
BuildTime: string;
SlashPos1, SlashPos2: integer;
Date: TDateTime;
begin
BuildDate := {$I %date%};
BuildTime := {$I %time%};
SlashPos1 := Pos('/',BuildDate);
SlashPos2 := SlashPos1 +
Pos('/', Copy(BuildDate, SlashPos1+1, Length(BuildDate)-SlashPos1));
Date := EncodeDate(StrToWord(Copy(BuildDate,1,SlashPos1-1)),
StrToWord(Copy(BuildDate,SlashPos1+1,SlashPos2-SlashPos1-1)),
StrToWord(Copy(BuildDate,SlashPos2+1,Length(BuildDate)-SlashPos2)));
Result := FormatDateTime('yyyy-mm-dd', Date);
Result := FormatDateTime('yyyy-mm-dd', Date)+' '+BuildTime;
end;
begin

View File

@ -1,35 +1,35 @@
object IDEInfoDialog: TIDEInfoDialog
Left = 490
Height = 450
Top = 207
Left = 431
Height = 516
Top = 212
Width = 700
BorderIcons = [biSystemMenu, biMaximize]
Caption = 'IDEInfoDialog'
ClientHeight = 450
ClientHeight = 516
ClientWidth = 700
OnClose = FormClose
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '1.7'
LCLVersion = '3.99.0.0'
object PageControl1: TPageControl
Left = 6
Height = 404
Height = 464
Top = 6
Width = 688
ActivePage = ExtToolTabSheet
ActivePage = GeneralTabSheet
Align = alClient
BorderSpacing.Around = 6
TabIndex = 3
TabIndex = 0
TabOrder = 0
object GeneralTabSheet: TTabSheet
Caption = 'General'
ClientHeight = 375
ClientWidth = 684
ClientHeight = 433
ClientWidth = 678
object GeneralMemo: TMemo
Left = 0
Height = 361
Height = 433
Top = 0
Width = 727
Width = 678
Align = alClient
Lines.Strings = (
'Memo1'
@ -39,15 +39,33 @@ object IDEInfoDialog: TIDEInfoDialog
TabOrder = 0
end
end
object MacroTabSheet: TTabSheet
Caption = 'IDE macros'
ClientHeight = 433
ClientWidth = 678
object MacrosMemo: TMemo
Left = 0
Height = 433
Top = 0
Width = 678
Align = alClient
Lines.Strings = (
'MacrosMemo'
)
ReadOnly = True
ScrollBars = ssAutoBoth
TabOrder = 0
end
end
object ModifiedTabSheet: TTabSheet
Caption = 'Modified'
ClientHeight = 375
ClientWidth = 684
ClientHeight = 433
ClientWidth = 678
object ModifiedMemo: TMemo
Left = 0
Height = 361
Height = 433
Top = 0
Width = 727
Width = 678
Align = alClient
Lines.Strings = (
'ModifiedMemo'
@ -58,13 +76,13 @@ object IDEInfoDialog: TIDEInfoDialog
end
object HelpTabSheet: TTabSheet
Caption = 'Help'
ClientHeight = 375
ClientWidth = 684
ClientHeight = 433
ClientWidth = 678
object HelpMemo: TMemo
Left = 0
Height = 375
Height = 433
Top = 0
Width = 684
Width = 678
Align = alClient
Lines.Strings = (
'HelpMemo'
@ -75,13 +93,13 @@ object IDEInfoDialog: TIDEInfoDialog
end
object ExtToolTabSheet: TTabSheet
Caption = 'External Tools'
ClientHeight = 375
ClientWidth = 684
ClientHeight = 433
ClientWidth = 678
object ExtToolMemo: TMemo
Left = 0
Height = 375
Height = 433
Top = 0
Width = 684
Width = 678
Align = alClient
Lines.Strings = (
'ExtToolMemo'
@ -92,8 +110,8 @@ object IDEInfoDialog: TIDEInfoDialog
end
object ButtonPanel1: TButtonPanel
Left = 6
Height = 28
Top = 416
Height = 34
Top = 476
Width = 688
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True

View File

@ -31,13 +31,22 @@ interface
uses
Classes, SysUtils,
LazFileUtils, LazUTF8, FPCAdds, LazLoggerBase,
// LazUtils
LazFileUtils, LazUTF8, FPCAdds, LazLoggerBase, Translations,
// LCL
Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, ButtonPanel, LazHelpHTML,
LazHelpIntf,
// CodeTools
CodeToolManager, DefineTemplates, LinkScanner,
Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
ButtonPanel, LazHelpHTML, LazHelpIntf,
IDEHelpIntf, IDEWindowIntf, LazIDEIntf, IDEExternToolIntf,
EnvironmentOpts, AboutFrm, LazConf, LazarusIDEStrConsts, Project,
SourceEditor, InitialSetupProc, PackageSystem, PackageDefs;
// IdeConfig
TransferMacros, EnvironmentOpts, LazConf,
// BuildIntf
MacroDefIntf, IDEExternToolIntf,
// IdeIntf
IDEHelpIntf, IDEWindowIntf, LazIDEIntf,
// IDE
AboutFrm, LazarusIDEStrConsts, Project, SourceEditor, InitialSetupProc,
PackageSystem, PackageDefs;
type
@ -47,6 +56,7 @@ type
ButtonPanel1: TButtonPanel;
ExtToolMemo: TMemo;
GeneralMemo: TMemo;
MacrosMemo: TMemo;
HelpMemo: TMemo;
ModifiedMemo: TMemo;
PageControl1: TPageControl;
@ -54,6 +64,7 @@ type
ModifiedTabSheet: TTabSheet;
HelpTabSheet: TTabSheet;
ExtToolTabSheet: TTabSheet;
MacroTabSheet: TTabSheet;
procedure FormClose(Sender: TObject; var {%H-}CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
private
@ -76,6 +87,7 @@ type
procedure GatherExternalTools(sl: TStrings);
public
procedure UpdateGeneralMemo;
procedure UpdateMacrosMemo;
procedure UpdateModifiedMemo;
procedure UpdateHelpMemo;
procedure UpdateExternalTools;
@ -89,9 +101,6 @@ function ShowIDEInfo: TModalResult;
implementation
uses
Translations;
function ShowIDEInfo: TModalResult;
var
Dlg: TIDEInfoDialog;
@ -113,6 +122,7 @@ begin
Caption:=lisIDEInfoInformationAboutTheIDE;
UpdateGeneralMemo;
UpdateMacrosMemo;
UpdateModifiedMemo;
UpdateHelpMemo;
UpdateExternalTools;
@ -256,9 +266,13 @@ end;
procedure TIDEInfoDialog.GatherParameters(sl: TStrings);
var
i: Integer;
loFileDateTime: TDateTime;
begin
sl.Add('Working directory='+GetCurrentDirUTF8);
sl.Add('Application.ExeName='+Application.ExeName);
if FileAge(Application.ExeName, loFileDateTime) then
sl.Add(FormatDateTime('yyyy/mm/dd hh:nn:ss',loFileDateTime));
sl.Add('');
sl.add('Parameters:');
for i:=0 to Paramcount do
@ -489,6 +503,42 @@ begin
end;
end;
procedure TIDEInfoDialog.UpdateMacrosMemo;
var
i: integer;
lTransferMacro: TTransferMacro;
lMacroFunctionStr: String;
lStr : string = '???';
lData: PtrInt = 0;
lAbort: boolean;
begin
MacrosMemo.Lines.Clear;
try
for i := 0 to GlobalMacroList.Count - 1 do begin
lTransferMacro := GlobalMacroList.Items[i];
lStr := lTransferMacro.Name;
{ Skip user interactive method calls }
if tmfInteractive in lTransferMacro.Flags then begin
Str(tmfInteractive, lStr);
lMacroFunctionStr := '['+lstr+'] function';
end
{ Dont know exactly what's that, protect access }
else try
lAbort := False;
lData := 0;
if Assigned(lTransferMacro.MacroFunction) then
lMacroFunctionStr := lTransferMacro.MacroFunction(lStr, lData, lAbort);
except
lMacroFunctionStr := '??? MacroFunction ???';
lAbort := True;
end;
MacrosMemo.Lines.Add('$('+lTransferMacro.Name+')='+lMacroFunctionStr);
end;
finally
ModifiedMemo.Lines.EndUpdate;
end;
end;
procedure TIDEInfoDialog.UpdateModifiedMemo;
var
sl: TStringList;