mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:39:13 +02:00
IDE: Register EnvironmentOptions editor group in IdeInstances. Remove registration through IDEOptionsIntf.
This commit is contained in:
parent
20bb97cbc0
commit
6c09197c78
@ -106,23 +106,6 @@ type
|
|||||||
TAbstractIDEEnvironmentOptions = class(TAbstractIDEOptions);
|
TAbstractIDEEnvironmentOptions = class(TAbstractIDEOptions);
|
||||||
TAbstractIDEHelpOptions = class(TAbstractIDEEnvironmentOptions);
|
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;
|
TOnLoadIDEOptions = procedure(Sender: TObject; AOptions: TAbstractIDEOptions) of object;
|
||||||
TOnSaveIDEOptions = procedure(Sender: TObject; AOptions: TAbstractIDEOptions) of object;
|
TOnSaveIDEOptions = procedure(Sender: TObject; AOptions: TAbstractIDEOptions) of object;
|
||||||
|
|
||||||
@ -133,7 +116,6 @@ type
|
|||||||
|
|
||||||
TIDEEnvironmentOptions = class(TAbstractIDEEnvironmentOptions)
|
TIDEEnvironmentOptions = class(TAbstractIDEEnvironmentOptions)
|
||||||
private
|
private
|
||||||
fExtraOptionList: TExtraEnvOptionList;
|
|
||||||
fRecentHandlers: array[TIDERecentHandler] of TMethodList;
|
fRecentHandlers: array[TIDERecentHandler] of TMethodList;
|
||||||
procedure DoCallRecentHandlers(AHandler: TIDERecentHandler;
|
procedure DoCallRecentHandlers(AHandler: TIDERecentHandler;
|
||||||
const AFileName: string; var AAllow: Boolean);
|
const AFileName: string; var AAllow: Boolean);
|
||||||
@ -163,18 +145,11 @@ type
|
|||||||
procedure RemoveHandlerAddToRecentProjectFiles(Handler: TOnAddToRecent);
|
procedure RemoveHandlerAddToRecentProjectFiles(Handler: TOnAddToRecent);
|
||||||
procedure AddHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent; const AsFirst: boolean = true); // AsFirst means: first to call
|
procedure AddHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent; const AsFirst: boolean = true); // AsFirst means: first to call
|
||||||
procedure RemoveHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent);
|
procedure RemoveHandlerAddToRecentPackageFiles(Handler: TOnAddToRecent);
|
||||||
|
|
||||||
procedure RegisterExtraOptions(AExtraOptions: TExtraEnvOptions);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
RegisterOptionsGroupEvent = procedure(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass);
|
|
||||||
|
|
||||||
procedure RegisterOptionsGroup(AGroupIndex: Integer; AGroupClass: TAbstractIDEOptionsClass);
|
|
||||||
|
|
||||||
var
|
var
|
||||||
IDEEnvironmentOptions: TIDEEnvironmentOptions;
|
IDEEnvironmentOptions: TIDEEnvironmentOptions;
|
||||||
HasGUI: boolean = true; // lazbuild sets this to false
|
HasGUI: boolean = true; // lazbuild sets this to false
|
||||||
OnRegisterGroup: RegisterOptionsGroupEvent;
|
|
||||||
|
|
||||||
const
|
const
|
||||||
// predefined environment options groups
|
// predefined environment options groups
|
||||||
@ -278,13 +253,6 @@ const
|
|||||||
|
|
||||||
implementation
|
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 }
|
{ TIDEEnvironmentOptions }
|
||||||
|
|
||||||
constructor TIDEEnvironmentOptions.Create;
|
constructor TIDEEnvironmentOptions.Create;
|
||||||
@ -292,7 +260,6 @@ var
|
|||||||
I: TIDERecentHandler;
|
I: TIDERecentHandler;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
fExtraOptionList := TExtraEnvOptionList.Create;
|
|
||||||
for I := Low(fRecentHandlers) to High(fRecentHandlers) do
|
for I := Low(fRecentHandlers) to High(fRecentHandlers) do
|
||||||
fRecentHandlers[I] := TMethodList.Create;
|
fRecentHandlers[I] := TMethodList.Create;
|
||||||
end;
|
end;
|
||||||
@ -303,7 +270,6 @@ var
|
|||||||
begin
|
begin
|
||||||
for I := Low(fRecentHandlers) to High(fRecentHandlers) do
|
for I := Low(fRecentHandlers) to High(fRecentHandlers) do
|
||||||
fRecentHandlers[I].Free;
|
fRecentHandlers[I].Free;
|
||||||
fExtraOptionList.Free;
|
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -374,11 +340,6 @@ begin
|
|||||||
fRecentHandlers[irhProjectFiles].Remove(TMethod(Handler));
|
fRecentHandlers[irhProjectFiles].Remove(TMethod(Handler));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TIDEEnvironmentOptions.RegisterExtraOptions(AExtraOptions: TExtraEnvOptions);
|
|
||||||
begin
|
|
||||||
fExtraOptionList.FList.Add(AExtraOptions);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TAbstractDesktopDockingOpt }
|
{ TAbstractDesktopDockingOpt }
|
||||||
|
|
||||||
constructor TAbstractDesktopDockingOpt.Create;
|
constructor TAbstractDesktopDockingOpt.Create;
|
||||||
@ -505,22 +466,4 @@ begin
|
|||||||
fHandlers[iohDestroy].Remove(TMethod(Handler));
|
fHandlers[iohDestroy].Remove(TMethod(Handler));
|
||||||
end;
|
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.
|
end.
|
||||||
|
@ -167,8 +167,6 @@ function GetFreeIDEOptionsIndex(AGroupIndex: Integer; AStartIndex: Integer): Int
|
|||||||
function RegisterIDEOptionsGroup(AGroupIndex: Integer;
|
function RegisterIDEOptionsGroup(AGroupIndex: Integer;
|
||||||
AGroupClass: TAbstractIDEOptionsClass;
|
AGroupClass: TAbstractIDEOptionsClass;
|
||||||
FindFreeIndex: boolean = true): PIDEOptionsGroupRec;
|
FindFreeIndex: boolean = true): PIDEOptionsGroupRec;
|
||||||
procedure RegisterOptionsGroupProc(AGroupIndex: Integer;
|
|
||||||
AGroupClass: TAbstractIDEOptionsClass);
|
|
||||||
function RegisterIDEOptionsEditor(AGroupIndex: Integer;
|
function RegisterIDEOptionsEditor(AGroupIndex: Integer;
|
||||||
AEditorClass: TAbstractIDEOptionsEditorClass;
|
AEditorClass: TAbstractIDEOptionsEditorClass;
|
||||||
AIndex: Integer; AParent: Integer = NoParent;
|
AIndex: Integer; AParent: Integer = NoParent;
|
||||||
@ -206,13 +204,6 @@ begin
|
|||||||
Result:=IDEEditorGroups.Add(AGroupIndex, AGroupClass);
|
Result:=IDEEditorGroups.Add(AGroupIndex, AGroupClass);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterOptionsGroupProc(AGroupIndex: Integer;
|
|
||||||
AGroupClass: TAbstractIDEOptionsClass);
|
|
||||||
// Called from an event in IDEOptionsIntf (BuildIde).
|
|
||||||
begin
|
|
||||||
RegisterIDEOptionsGroup(AGroupIndex, AGroupClass);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function RegisterIDEOptionsEditor(AGroupIndex: Integer;
|
function RegisterIDEOptionsEditor(AGroupIndex: Integer;
|
||||||
AEditorClass: TAbstractIDEOptionsEditorClass; AIndex: Integer;
|
AEditorClass: TAbstractIDEOptionsEditorClass; AIndex: Integer;
|
||||||
AParent: Integer; AutoCreateGroup: boolean): PIDEOptionsEditorRec;
|
AParent: Integer; AutoCreateGroup: boolean): PIDEOptionsEditorRec;
|
||||||
@ -635,7 +626,6 @@ end;
|
|||||||
|
|
||||||
initialization
|
initialization
|
||||||
FIDEEditorGroups := nil;
|
FIDEEditorGroups := nil;
|
||||||
IDEOptionsIntf.OnRegisterGroup := @RegisterOptionsGroupProc;
|
|
||||||
|
|
||||||
finalization
|
finalization
|
||||||
FreeAndNil(FIDEEditorGroups);
|
FreeAndNil(FIDEEditorGroups);
|
||||||
|
@ -46,6 +46,7 @@ uses
|
|||||||
Controls, Dialogs, ExtCtrls, LCLIntf, LCLType,
|
Controls, Dialogs, ExtCtrls, LCLIntf, LCLType,
|
||||||
LazFileUtils, FileUtil, Laz2_XMLRead, Laz2_XMLWrite, Laz2_DOM, LazUTF8,
|
LazFileUtils, FileUtil, Laz2_XMLRead, Laz2_XMLWrite, Laz2_DOM, LazUTF8,
|
||||||
UTF8Process, LazLoggerBase,
|
UTF8Process, LazLoggerBase,
|
||||||
|
EnvironmentOpts, IDEOptionsIntf, IDEOptEditorIntf,
|
||||||
LazarusIDEStrConsts, IDECmdLine, LazConf;
|
LazarusIDEStrConsts, IDECmdLine, LazConf;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -992,6 +993,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
// Editor group for EnvironmentOptions must be registered early.
|
||||||
|
RegisterIDEOptionsGroup(GroupEnvironment, TEnvironmentOptions);
|
||||||
FLazIDEInstances := TIDEInstances.Create(nil);
|
FLazIDEInstances := TIDEInstances.Create(nil);
|
||||||
FLazIDEInstances.InitIDEInstances;
|
FLazIDEInstances.InitIDEInstances;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ uses
|
|||||||
Interfaces,
|
Interfaces,
|
||||||
IDEInstances,//keep IDEInstances up so that it will be initialized soon
|
IDEInstances,//keep IDEInstances up so that it will be initialized soon
|
||||||
Forms, LazUtilities, LazLoggerBase,
|
Forms, LazUtilities, LazLoggerBase,
|
||||||
IDEOptEditorIntf, IDEOptionsIntf,
|
IDEOptionsIntf,
|
||||||
LazConf, IDEGuiCmdLine,
|
LazConf, IDEGuiCmdLine,
|
||||||
Splash,
|
Splash,
|
||||||
Main,
|
Main,
|
||||||
|
@ -1714,8 +1714,5 @@ begin
|
|||||||
SetParseValue(eopFppkgConfigFile,UTF8Trim(AValue));
|
SetParseValue(eopFppkgConfigFile,UTF8Trim(AValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
|
||||||
//RegisterIDEOptionsGroup(GroupEnvironment, TEnvironmentOptions);
|
|
||||||
RegisterOptionsGroup(GroupEnvironment, TEnvironmentOptions);
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user