IDE: Register EnvironmentOptions editor group in IdeInstances. Remove registration through IDEOptionsIntf.

This commit is contained in:
Juha 2023-06-19 02:38:07 +03:00
parent 20bb97cbc0
commit 6c09197c78
5 changed files with 4 additions and 71 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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;

View File

@ -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,

View File

@ -1714,8 +1714,5 @@ begin
SetParseValue(eopFppkgConfigFile,UTF8Trim(AValue));
end;
initialization
//RegisterIDEOptionsGroup(GroupEnvironment, TEnvironmentOptions);
RegisterOptionsGroup(GroupEnvironment, TEnvironmentOptions);
end.