From 6c09197c78fb6b0fc6f249876bc557a983e2b4a0 Mon Sep 17 00:00:00 2001 From: Juha Date: Mon, 19 Jun 2023 02:38:07 +0300 Subject: [PATCH] IDE: Register EnvironmentOptions editor group in IdeInstances. Remove registration through IDEOptionsIntf. --- components/buildintf/ideoptionsintf.pas | 57 ----------------------- components/ideintf/ideopteditorintf.pas | 10 ---- ide/ideinstances.pas | 3 ++ ide/lazarus.pp | 2 +- ide/packages/ideconfig/environmentopts.pp | 3 -- 5 files changed, 4 insertions(+), 71 deletions(-) diff --git a/components/buildintf/ideoptionsintf.pas b/components/buildintf/ideoptionsintf.pas index 10f571cd95..f93ddf28c0 100644 --- a/components/buildintf/ideoptionsintf.pas +++ b/components/buildintf/ideoptionsintf.pas @@ -106,23 +106,6 @@ type TAbstractIDEEnvironmentOptions = class(TAbstractIDEOptions); TAbstractIDEHelpOptions = class(TAbstractIDEEnvironmentOptions); - TExtraEnvOptions = class - private - - end; - - { TExtraEnvOptionList } - - TExtraEnvOptionList = class - private - FList: TFPList; - function GetItems(Index: integer): TExtraEnvOptions; - public - constructor Create; - destructor Destroy; override; - property Items[Index: integer]: TExtraEnvOptions read GetItems; - end; - TOnLoadIDEOptions = procedure(Sender: TObject; AOptions: TAbstractIDEOptions) of object; TOnSaveIDEOptions = procedure(Sender: TObject; AOptions: TAbstractIDEOptions) of object; @@ -133,7 +116,6 @@ type TIDEEnvironmentOptions = class(TAbstractIDEEnvironmentOptions) private - fExtraOptionList: TExtraEnvOptionList; fRecentHandlers: array[TIDERecentHandler] of TMethodList; procedure DoCallRecentHandlers(AHandler: TIDERecentHandler; const AFileName: string; var AAllow: Boolean); @@ -163,18 +145,11 @@ type procedure RemoveHandlerAddToRecentProjectFiles(Handler: TOnAddToRecent); procedure AddHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent; const AsFirst: boolean = true); // AsFirst means: first to call procedure RemoveHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent); - - procedure RegisterExtraOptions(AExtraOptions: TExtraEnvOptions); end; - RegisterOptionsGroupEvent = procedure(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass); - - procedure RegisterOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass); - var IDEEnvironmentOptions: TIDEEnvironmentOptions; HasGUI: boolean = true; // lazbuild sets this to false - OnRegisterGroup: RegisterOptionsGroupEvent; const // predefined environment options groups @@ -278,13 +253,6 @@ const implementation -procedure RegisterOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass); -// Like function RegisterIDEOptionsGroup in IDEOptEditorIntf (IdeIntf) but does not return anything. -begin - if Assigned(OnRegisterGroup) then - OnRegisterGroup(AGroupIndex, AGroupClass); -end; - { TIDEEnvironmentOptions } constructor TIDEEnvironmentOptions.Create; @@ -292,7 +260,6 @@ var I: TIDERecentHandler; begin inherited Create; - fExtraOptionList := TExtraEnvOptionList.Create; for I := Low(fRecentHandlers) to High(fRecentHandlers) do fRecentHandlers[I] := TMethodList.Create; end; @@ -303,7 +270,6 @@ var begin for I := Low(fRecentHandlers) to High(fRecentHandlers) do fRecentHandlers[I].Free; - fExtraOptionList.Free; inherited Destroy; end; @@ -374,11 +340,6 @@ begin fRecentHandlers[irhProjectFiles].Remove(TMethod(Handler)); end; -procedure TIDEEnvironmentOptions.RegisterExtraOptions(AExtraOptions: TExtraEnvOptions); -begin - fExtraOptionList.FList.Add(AExtraOptions); -end; - { TAbstractDesktopDockingOpt } constructor TAbstractDesktopDockingOpt.Create; @@ -505,22 +466,4 @@ begin fHandlers[iohDestroy].Remove(TMethod(Handler)); end; -{ TExtraEnvOptionList } - -constructor TExtraEnvOptionList.Create; -begin - FList:=TFPList.Create; -end; - -destructor TExtraEnvOptionList.Destroy; -begin - FList.Free; - inherited Destroy; -end; - -function TExtraEnvOptionList.GetItems(Index: integer): TExtraEnvOptions; -begin - Result:=TExtraEnvOptions(FList[Index]); -end; - end. diff --git a/components/ideintf/ideopteditorintf.pas b/components/ideintf/ideopteditorintf.pas index 6cb363e93d..d2538c8b9e 100644 --- a/components/ideintf/ideopteditorintf.pas +++ b/components/ideintf/ideopteditorintf.pas @@ -167,8 +167,6 @@ function GetFreeIDEOptionsIndex(AGroupIndex: Integer; AStartIndex: Integer): Int function RegisterIDEOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass; FindFreeIndex: boolean = true): PIDEOptionsGroupRec; -procedure RegisterOptionsGroupProc(AGroupIndex: Integer; - AGroupClass: TAbstractIDEOptionsClass); function RegisterIDEOptionsEditor(AGroupIndex: Integer; AEditorClass: TAbstractIDEOptionsEditorClass; AIndex: Integer; AParent: Integer = NoParent; @@ -206,13 +204,6 @@ begin Result:=IDEEditorGroups.Add(AGroupIndex, AGroupClass); end; -procedure RegisterOptionsGroupProc(AGroupIndex: Integer; - AGroupClass: TAbstractIDEOptionsClass); -// Called from an event in IDEOptionsIntf (BuildIde). -begin - RegisterIDEOptionsGroup(AGroupIndex, AGroupClass); -end; - function RegisterIDEOptionsEditor(AGroupIndex: Integer; AEditorClass: TAbstractIDEOptionsEditorClass; AIndex: Integer; AParent: Integer; AutoCreateGroup: boolean): PIDEOptionsEditorRec; @@ -635,7 +626,6 @@ end; initialization FIDEEditorGroups := nil; - IDEOptionsIntf.OnRegisterGroup := @RegisterOptionsGroupProc; finalization FreeAndNil(FIDEEditorGroups); diff --git a/ide/ideinstances.pas b/ide/ideinstances.pas index d1ec27d241..53af2ac013 100644 --- a/ide/ideinstances.pas +++ b/ide/ideinstances.pas @@ -46,6 +46,7 @@ uses Controls, Dialogs, ExtCtrls, LCLIntf, LCLType, LazFileUtils, FileUtil, Laz2_XMLRead, Laz2_XMLWrite, Laz2_DOM, LazUTF8, UTF8Process, LazLoggerBase, + EnvironmentOpts, IDEOptionsIntf, IDEOptEditorIntf, LazarusIDEStrConsts, IDECmdLine, LazConf; type @@ -992,6 +993,8 @@ begin end; initialization + // Editor group for EnvironmentOptions must be registered early. + RegisterIDEOptionsGroup(GroupEnvironment, TEnvironmentOptions); FLazIDEInstances := TIDEInstances.Create(nil); FLazIDEInstances.InitIDEInstances; diff --git a/ide/lazarus.pp b/ide/lazarus.pp index bc24958cd7..1cf92860b5 100644 --- a/ide/lazarus.pp +++ b/ide/lazarus.pp @@ -57,7 +57,7 @@ uses Interfaces, IDEInstances,//keep IDEInstances up so that it will be initialized soon Forms, LazUtilities, LazLoggerBase, - IDEOptEditorIntf, IDEOptionsIntf, + IDEOptionsIntf, LazConf, IDEGuiCmdLine, Splash, Main, diff --git a/ide/packages/ideconfig/environmentopts.pp b/ide/packages/ideconfig/environmentopts.pp index 8e95132f45..d8e9db8f26 100644 --- a/ide/packages/ideconfig/environmentopts.pp +++ b/ide/packages/ideconfig/environmentopts.pp @@ -1714,8 +1714,5 @@ begin SetParseValue(eopFppkgConfigFile,UTF8Trim(AValue)); end; -initialization - //RegisterIDEOptionsGroup(GroupEnvironment, TEnvironmentOptions); - RegisterOptionsGroup(GroupEnvironment, TEnvironmentOptions); end.