mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 00:02:03 +02:00
moved componentreg.pas to ideintf
git-svn-id: trunk@5753 -
This commit is contained in:
parent
c30685c57e
commit
d71325aced
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -622,6 +622,7 @@ ideintf/actionseditor.pas svneol=native#text/pascal
|
||||
ideintf/allideintf.pas svneol=native#text/pascal
|
||||
ideintf/columndlg.pp svneol=native#text/pascal
|
||||
ideintf/componenteditors.pas svneol=native#text/pascal
|
||||
ideintf/componentreg.pas svneol=native#text/pascal
|
||||
ideintf/componenttreeview.pas svneol=native#text/pascal
|
||||
ideintf/formeditingintf.pas svneol=native#text/pascal
|
||||
ideintf/graphpropedits.pas svneol=native#text/pascal
|
||||
@ -1437,7 +1438,6 @@ packager/addfiletoapackagedlg.pas svneol=native#text/pascal
|
||||
packager/addtopackagedlg.pas svneol=native#text/pascal
|
||||
packager/basepkgmanager.pas svneol=native#text/pascal
|
||||
packager/brokendependenciesdlg.pas svneol=native#text/pascal
|
||||
packager/componentreg.pas svneol=native#text/pascal
|
||||
packager/openinstalledpkgdlg.pas svneol=native#text/pascal
|
||||
packager/packagedefs.pas svneol=native#text/pascal
|
||||
packager/packageeditor.pas svneol=native#text/pascal
|
||||
|
@ -3448,6 +3448,7 @@ begin
|
||||
// <LazarusSrcDir>/include
|
||||
// (does not need special setup)
|
||||
|
||||
|
||||
// <LazarusSrcDir>/designer
|
||||
DirTempl:=TDefineTemplate.Create('Designer',ctsDesignerDirectory,
|
||||
'','designer',da_Directory);
|
||||
@ -3498,8 +3499,10 @@ begin
|
||||
DirTempl.AddChild(SubDirTempl);
|
||||
MainDir.AddChild(DirTempl);
|
||||
|
||||
|
||||
// <LazarusSrcDir>/images
|
||||
|
||||
|
||||
// <LazarusSrcDir>/debugger
|
||||
DirTempl:=TDefineTemplate.Create('Debugger',ctsDebuggerDirectory,
|
||||
'','debugger',da_Directory);
|
||||
@ -3515,6 +3518,7 @@ begin
|
||||
,da_DefineRecurse));
|
||||
MainDir.AddChild(DirTempl);
|
||||
|
||||
|
||||
// <LazarusSrcDir>/doceditor
|
||||
DirTempl:=TDefineTemplate.Create('Doc Editor',ctsDocEditorDirectory,
|
||||
'','doceditor',da_Directory);
|
||||
@ -3530,6 +3534,7 @@ begin
|
||||
,da_DefineRecurse));
|
||||
MainDir.AddChild(DirTempl);
|
||||
|
||||
|
||||
// <LazarusSrcDir>/packager
|
||||
DirTempl:=TDefineTemplate.Create('Packager',ctsDesignerDirectory,
|
||||
'','packager',da_Directory);
|
||||
@ -3575,6 +3580,7 @@ begin
|
||||
DirTempl.AddChild(SubDirTempl);
|
||||
MainDir.AddChild(DirTempl);
|
||||
|
||||
|
||||
// <LazarusSrcDir>/ideintf
|
||||
IDEIntfDir:=TDefineTemplate.Create('IDEIntf',ctsIDEIntfDirectory,
|
||||
'','ideintf',da_Directory);
|
||||
@ -3582,6 +3588,7 @@ begin
|
||||
Format(ctsAddsDirToSourcePath,['lcl']),
|
||||
SrcPathMacroName,
|
||||
d('../components/codetools'
|
||||
+';../packager/registration'
|
||||
+';../lcl'
|
||||
+';../lcl/interfaces/'+WidgetType)
|
||||
+';'+SrcPath
|
||||
|
@ -220,6 +220,7 @@ type
|
||||
procedure Unbind;
|
||||
function FindParentError: TLFMError;
|
||||
function FindContextNode: TLFMTreeNode;
|
||||
function IsMissingObjectType: boolean;
|
||||
end;
|
||||
|
||||
{ TLFMTree }
|
||||
@ -803,6 +804,14 @@ begin
|
||||
Result:=Result.Parent;
|
||||
end;
|
||||
|
||||
function TLFMError.IsMissingObjectType: boolean;
|
||||
begin
|
||||
Result:=(ErrorType in [lfmeIdentifierNotFound,lfmeMissingRoot])
|
||||
and (Node is TLFMObjectNode)
|
||||
and (TLFMObjectNode(Node).TypeName<>'')
|
||||
and (TLFMObjectNode(Node).TypeNamePosition=Position);
|
||||
end;
|
||||
|
||||
{ TLFMNameParts }
|
||||
|
||||
function TLFMNameParts.GetNamePositions(Index: integer): integer;
|
||||
|
@ -27,10 +27,6 @@
|
||||
|
||||
Abstract:
|
||||
Functions and Dialog to change the class of a designer component.
|
||||
|
||||
ToDo:
|
||||
- add uses and package of new class if needed
|
||||
- test controls with childs
|
||||
}
|
||||
unit ChangeClassDialog;
|
||||
|
||||
|
@ -39,7 +39,8 @@ uses
|
||||
SynHighlighterLFM, SynEdit, BasicCodeTools, CodeCache, CodeToolManager,
|
||||
LFMTrees,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs, EditorOptions;
|
||||
LazarusIDEStrConsts, OutputFilter, IDEProcs, IDEOptionDefs, EditorOptions,
|
||||
ComponentReg;
|
||||
|
||||
type
|
||||
TCheckLFMDialog = class(TForm)
|
||||
@ -118,18 +119,56 @@ var
|
||||
+'('+IntToStr(CurError.Caret.Y)+','+IntToStr(CurError.Caret.X)+')'
|
||||
+' Error: '
|
||||
+CurError.ErrorMessage;
|
||||
writeln('WriteLFMErrors ',Msg);
|
||||
debugln('WriteLFMErrors ',Msg);
|
||||
OnOutput(Msg,Dir);
|
||||
CurError:=CurError.NextError;
|
||||
end;
|
||||
end;
|
||||
|
||||
function FixMissingComponentClasses: boolean;
|
||||
// returns true, if after adding units to uses section all errors are fixed
|
||||
var
|
||||
CurError: TLFMError;
|
||||
MissingObjectTypes: TStringList;
|
||||
TypeName: String;
|
||||
RegComp: TRegisteredComponent;
|
||||
i: Integer;
|
||||
begin
|
||||
Result:=false;
|
||||
// collect all missing object types
|
||||
MissingObjectTypes:=TStringList.Create;
|
||||
CurError:=LFMTree.FirstError;
|
||||
while CurError<>nil do begin
|
||||
if CurError.IsMissingObjectType then begin
|
||||
TypeName:=(CurError.Node as TLFMObjectNode).TypeName;
|
||||
if MissingObjectTypes.IndexOf(TypeName)<0 then
|
||||
MissingObjectTypes.Add(TypeName);
|
||||
end;
|
||||
CurError:=CurError.NextError;
|
||||
end;
|
||||
// keep all object types with a registered component class
|
||||
for i:=MissingObjectTypes.Count-1 downto 0 do begin
|
||||
RegComp:=IDEComponentPalette.FindComponent(MissingObjectTypes[i]);
|
||||
if (RegComp=nil) or (RegComp.GetUnitName='') then
|
||||
MissingObjectTypes.Delete(i);
|
||||
end;
|
||||
if MissingObjectTypes.Count>0 then begin
|
||||
// there are missing object types with registered component classes
|
||||
|
||||
end;
|
||||
MissingObjectTypes.Free;
|
||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
||||
RootMustBeClassInIntf,ObjectsMustExists);
|
||||
end;
|
||||
|
||||
begin
|
||||
LFMTree:=nil;
|
||||
try
|
||||
Result:=CodeToolBoss.CheckLFM(PascalBuffer,LFMBuffer,LFMTree,
|
||||
RootMustBeClassInIntf,ObjectsMustExists);
|
||||
if Result then exit;
|
||||
Result:=FixMissingComponentClasses;
|
||||
if Result then exit;
|
||||
WriteLFMErrors;
|
||||
Result:=ShowRepairLFMWizard(LFMBuffer,LFMTree);
|
||||
finally
|
||||
@ -217,7 +256,7 @@ end;
|
||||
|
||||
procedure TCheckLFMDialog.CheckLFMDialogCREATE(Sender: TObject);
|
||||
begin
|
||||
Caption:='Fix LFM file';
|
||||
Caption:=lisFixLFMFile;
|
||||
Position:=poScreenCenter;
|
||||
IDEDialogLayoutList.ApplyLayout(Self,600,400);
|
||||
SetupComponents;
|
||||
@ -285,7 +324,6 @@ procedure TCheckLFMDialog.AddReplacement(LFMChangeList: TList;
|
||||
var
|
||||
Entry: TLFMChangeEntry;
|
||||
NewEntry: TLFMChangeEntry;
|
||||
NextEntry: TLFMChangeEntry;
|
||||
i: Integer;
|
||||
begin
|
||||
if StartPos>EndPos then
|
||||
|
@ -39,8 +39,11 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls, Dialogs, Graphics, ExtCtrls, Buttons, Menus,
|
||||
LResources, AVL_Tree, LazarusIDEStrConsts, ComponentReg, DesignerProcs,
|
||||
IDEProcs, PackageDefs;
|
||||
LResources, AVL_Tree,
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps,
|
||||
{$ENDIF}
|
||||
LazarusIDEStrConsts, ComponentReg, DesignerProcs, IDEProcs, PackageDefs;
|
||||
|
||||
const
|
||||
ComponentPaletteBtnWidth = 25;
|
||||
@ -89,7 +92,11 @@ type
|
||||
procedure OnGetNonVisualCompIconCanvas(Sender: TObject;
|
||||
AComponent: TComponent; var IconCanvas: TCanvas;
|
||||
var IconWidth, IconHeight: integer);
|
||||
function FindComponent(const CompClassName: string): TRegisteredComponent; override;
|
||||
function FindComponent(const CompClassName: string
|
||||
): TRegisteredComponent; override;
|
||||
procedure RegisterCustomIDEComponents(
|
||||
const RegisterProc: RegisterUnitComponentProc); override;
|
||||
public
|
||||
property NoteBook: TNotebook read FNoteBook write SetNoteBook;
|
||||
property Selected: TRegisteredComponent read FSelected write SetSelected;
|
||||
property OnOpenPackage: TNotifyEvent read FOnOpenPackage write FOnOpenPackage;
|
||||
@ -512,6 +519,15 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
procedure TComponentPalette.RegisterCustomIDEComponents(
|
||||
const RegisterProc: RegisterUnitComponentProc);
|
||||
begin
|
||||
inherited RegisterCustomIDEComponents(RegisterProc);
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps.RegisterCustomComponents(RegisterProc);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
|
||||
|
@ -2394,11 +2394,14 @@ resourcestring
|
||||
lisClDirSimpleSyntaxEGInsteadOf = 'Simple Syntax (e.g. * instead of .*)';
|
||||
lisClDirKeepFilesMatchingFilter = 'Keep files matching filter';
|
||||
lisClDirCleanDirectory = 'Clean Directory';
|
||||
|
||||
// LFM repair wizard
|
||||
lisTheLFMLazarusFormFileContainsInvalidPropertiesThis = 'The LFM (Lazarus '
|
||||
+'form) file contains invalid properties. This means for example it '
|
||||
+'contains some properties/classes, which do not exist in the current '
|
||||
+'LCL. The normal fix is to remove these properties from the lfm and fix '
|
||||
+'the pascal code manually.';
|
||||
lisFixLFMFile = 'Fix LFM file';
|
||||
|
||||
// extract proc dialog
|
||||
lisNoCodeSelected = 'No code selected';
|
||||
|
@ -215,7 +215,9 @@ type
|
||||
itmPkgOpenRecent: TMenuItem;
|
||||
itmPkgAddCurUnitToPkg: TMenuItem;
|
||||
itmPkgPkgGraph: TMenuItem;
|
||||
{$IFDEF CustomIDEComps}
|
||||
itmCompsConfigCustomComps: TMenuItem;
|
||||
{$ENDIF}
|
||||
|
||||
// tools menu
|
||||
itmToolConfigure: TMenuItem;
|
||||
|
@ -649,9 +649,10 @@ begin
|
||||
|
||||
CreateMenuItem(ParentMI,itmPkgPkgGraph,'itmPkgPkgGraph',lisMenuPackageGraph,'pkg_packagegraph');
|
||||
|
||||
{$IFDEF CustomIDEComps}
|
||||
ParentMI.Add(CreateMenuSeparator);
|
||||
|
||||
CreateMenuItem(ParentMI,itmCompsConfigCustomComps,'itmCompsConfigCustomComps',lisMenuConfigCustomComps);
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -838,7 +839,9 @@ begin
|
||||
itmPkgOpenPackageFile.ShortCut:=CommandToShortCut(ecOpenPackageFile);
|
||||
itmPkgAddCurUnitToPkg.ShortCut:=CommandToShortCut(ecAddCurUnitToPkg);
|
||||
itmPkgPkgGraph.ShortCut:=CommandToShortCut(ecPackageGraph);
|
||||
{$IFDEF CustomIDEComps}
|
||||
itmCompsConfigCustomComps.ShortCut:=CommandToShortCut(ecConfigCustomComps);
|
||||
{$ENDIF}
|
||||
|
||||
// tools menu
|
||||
itmToolConfigure.ShortCut:=CommandToShortCut(ecExtToolSettings);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/07/25]
|
||||
# Don't edit, this file is generated by FPCMake Version 1.1 [2004/08/08]
|
||||
#
|
||||
default: all
|
||||
MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom morphos
|
||||
@ -215,10 +215,10 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
|
||||
override PACKAGE_NAME=ideintf
|
||||
override PACKAGE_VERSION=0.9b
|
||||
override TARGET_UNITS+=allideintf
|
||||
override TARGET_IMPLICITUNITS+=actionseditor columndlg componenteditors componenttreeview graphpropedits idecommands imagelisteditor listviewpropedit objectinspector objinspstrconsts propedits helpintf texttools actionseditor
|
||||
override TARGET_IMPLICITUNITS+=actionseditor columndlg componenteditors componenttreeview graphpropedits idecommands imagelisteditor listviewpropedit objectinspector objinspstrconsts propedits helpintf texttools actionseditor formeditingintf srceditorintf componentreg
|
||||
override CLEAN_FILES+=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(OEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(PPUEXT)) $(wildcard $(COMPILER_UNITTARGETDIR)/*$(RSTEXT))
|
||||
override COMPILER_OPTIONS+=-gl
|
||||
override COMPILER_UNITDIR+=../lcl/units/$(CPU_TARGET)/$(OS_TARGET) ../components/units/$(CPU_TARGET)/$(OS_TARGET) .
|
||||
override COMPILER_UNITDIR+=../lcl/units/$(CPU_TARGET)/$(OS_TARGET) ../components/units/$(CPU_TARGET)/$(OS_TARGET) ../packager/units/$(CPU_TARGET)/$(OS_TARGET) .
|
||||
override COMPILER_UNITTARGETDIR+=units/$(CPU_TARGET)/$(OS_TARGET)
|
||||
ifdef REQUIRE_UNITSDIR
|
||||
override UNITSDIR+=$(REQUIRE_UNITSDIR)
|
||||
|
@ -9,7 +9,8 @@ version=0.9b
|
||||
|
||||
[compiler]
|
||||
unitdir=../lcl/units/$(CPU_TARGET)/$(OS_TARGET) \
|
||||
../components/units/$(CPU_TARGET)/$(OS_TARGET) .
|
||||
../components/units/$(CPU_TARGET)/$(OS_TARGET) \
|
||||
../packager/units/$(CPU_TARGET)/$(OS_TARGET) .
|
||||
unittargetdir=units/$(CPU_TARGET)/$(OS_TARGET)
|
||||
options=-gl
|
||||
|
||||
@ -30,7 +31,8 @@ implicitunits=actionseditor \
|
||||
texttools \
|
||||
actionseditor \
|
||||
formeditingintf \
|
||||
srceditorintf
|
||||
srceditorintf \
|
||||
componentreg
|
||||
|
||||
[clean]
|
||||
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) \
|
||||
|
@ -22,7 +22,7 @@ uses
|
||||
IDECommands, PropEdits, ObjInspStrConsts, ObjectInspector, ColumnDlg,
|
||||
ComponentEditors, GraphPropEdits, ListViewPropEdit, ImageListEditor,
|
||||
ComponentTreeView, ActionsEditor, HelpIntf, TextTools, FormEditingIntf,
|
||||
SrcEditorIntf;
|
||||
SrcEditorIntf, ComponentReg;
|
||||
|
||||
implementation
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
componentreg.pas
|
||||
----------------
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
***************************************************************************
|
||||
@ -29,7 +28,7 @@
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
Classes and functions to register components.
|
||||
Interface to the component palette and the registered component classes.
|
||||
}
|
||||
unit ComponentReg;
|
||||
|
||||
@ -38,11 +37,7 @@ unit ComponentReg;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Controls,
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps,
|
||||
{$ENDIF}
|
||||
IDEProcs, LazarusPackageIntf;
|
||||
Classes, SysUtils, Controls, LazarusPackageIntf;
|
||||
|
||||
type
|
||||
TComponentPriorityCategory = (
|
||||
@ -77,6 +72,7 @@ type
|
||||
protected
|
||||
FVisible: boolean;
|
||||
procedure SetVisible(const AValue: boolean); virtual;
|
||||
procedure FreeButton;
|
||||
public
|
||||
constructor Create(TheComponentClass: TComponentClass;
|
||||
const ThePageName: string);
|
||||
@ -95,6 +91,7 @@ type
|
||||
property Button: TComponent read FButton write FButton;
|
||||
property Visible: boolean read FVisible write SetVisible;
|
||||
end;
|
||||
TRegisteredComponentClass = class of TRegisteredComponent;
|
||||
|
||||
|
||||
{ TBaseComponentPage }
|
||||
@ -133,6 +130,7 @@ type
|
||||
property SelectButton: TComponent read FSelectButton write FSelectButton;
|
||||
property Visible: boolean read FVisible write SetVisible;
|
||||
end;
|
||||
TBaseComponentPageClass = class of TBaseComponentPage;
|
||||
|
||||
|
||||
{ TBaseComponentPalette }
|
||||
@ -140,12 +138,16 @@ type
|
||||
TEndUpdatePaletteEvent =
|
||||
procedure(Sender: TObject; PaletteChanged: boolean) of object;
|
||||
TGetComponentClass = procedure(const AClass: TComponentClass) of object;
|
||||
RegisterUnitComponentProc = procedure(const Page, UnitName: ShortString;
|
||||
ComponentClass: TComponentClass);
|
||||
|
||||
TBaseComponentPalette = class
|
||||
private
|
||||
FBaseComponentPageClass: TBaseComponentPageClass;
|
||||
FItems: TList; // list of TBaseComponentPage
|
||||
FOnBeginUpdate: TNotifyEvent;
|
||||
FOnEndUpdate: TEndUpdatePaletteEvent;
|
||||
FRegisteredComponentClass: TRegisteredComponentClass;
|
||||
FUpdateLock: integer;
|
||||
fChanged: boolean;
|
||||
function GetItems(Index: integer): TBaseComponentPage;
|
||||
@ -155,8 +157,13 @@ type
|
||||
procedure OnPageAddedComponent(Component: TRegisteredComponent); virtual;
|
||||
procedure OnPageRemovedComponent(Page: TBaseComponentPage;
|
||||
Component: TRegisteredComponent); virtual;
|
||||
procedure OnComponentVisibleChanged(AComponent: TRegisteredComponent); virtual;
|
||||
procedure OnComponentVisibleChanged(
|
||||
AComponent: TRegisteredComponent); virtual;
|
||||
procedure Update; virtual;
|
||||
procedure SetBaseComponentPageClass(
|
||||
const AValue: TBaseComponentPageClass); virtual;
|
||||
procedure SetRegisteredComponentClass(
|
||||
const AValue: TRegisteredComponentClass); virtual;
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
@ -168,22 +175,31 @@ type
|
||||
procedure ConsistencyCheck;
|
||||
function Count: integer;
|
||||
function GetPage(const APageName: string;
|
||||
CreateIfNotExists: boolean): TBaseComponentPage;
|
||||
CreateIfNotExists: boolean): TBaseComponentPage;
|
||||
function IndexOfPageWithName(const APageName: string): integer;
|
||||
procedure AddComponent(NewComponent: TRegisteredComponent);
|
||||
function CreateNewPage(const NewPageName: string;
|
||||
const Priority: TComponentPriority): TBaseComponentPage;
|
||||
function FindComponent(const CompClassName: string): TRegisteredComponent; virtual;
|
||||
const Priority: TComponentPriority): TBaseComponentPage;
|
||||
function FindComponent(const CompClassName: string
|
||||
): TRegisteredComponent; virtual;
|
||||
function FindButton(Button: TComponent): TRegisteredComponent;
|
||||
function CreateNewClassName(const Prefix: string): string;
|
||||
function IndexOfPageComponent(AComponent: TComponent): integer;
|
||||
procedure ShowHideControls(Show: boolean);
|
||||
procedure IterateRegisteredClasses(Proc: TGetComponentClass);
|
||||
procedure RegisterCustomIDEComponents(
|
||||
const RegisterProc: RegisterUnitComponentProc); virtual;
|
||||
public
|
||||
property Pages[Index: integer]: TBaseComponentPage read GetItems; default;
|
||||
property UpdateLock: integer read FUpdateLock;
|
||||
property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate;
|
||||
property OnEndUpdate: TEndUpdatePaletteEvent read FOnEndUpdate write FOnEndUpdate;
|
||||
property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate
|
||||
write FOnBeginUpdate;
|
||||
property OnEndUpdate: TEndUpdatePaletteEvent read FOnEndUpdate
|
||||
write FOnEndUpdate;
|
||||
property BaseComponentPageClass: TBaseComponentPageClass
|
||||
read FBaseComponentPageClass;
|
||||
property RegisteredComponentClass: TRegisteredComponentClass
|
||||
read FRegisteredComponentClass;
|
||||
end;
|
||||
|
||||
|
||||
@ -193,15 +209,13 @@ var
|
||||
function ComparePriority(const p1,p2: TComponentPriority): integer;
|
||||
function CompareIDEComponentByClassName(Data1, Data2: pointer): integer;
|
||||
|
||||
type
|
||||
RegisterUnitComponentProc = procedure(const Page, UnitName: ShortString;
|
||||
ComponentClass: TComponentClass);
|
||||
|
||||
procedure RegisterCustomIDEComponents(RegisterProc: RegisterUnitComponentProc);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
procedure RaiseException(const Msg: string);
|
||||
begin
|
||||
raise Exception.Create(Msg);
|
||||
end;
|
||||
|
||||
function ComparePriority(const p1, p2: TComponentPriority): integer;
|
||||
begin
|
||||
@ -221,13 +235,6 @@ begin
|
||||
Comp2.ComponentClass.Classname);
|
||||
end;
|
||||
|
||||
procedure RegisterCustomIDEComponents(RegisterProc: RegisterUnitComponentProc);
|
||||
begin
|
||||
{$IFDEF CustomIDEComps}
|
||||
CustomIDEComps.RegisterCustomComponents(RegisterProc);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ TRegisteredComponent }
|
||||
|
||||
procedure TRegisteredComponent.SetVisible(const AValue: boolean);
|
||||
@ -237,6 +244,12 @@ begin
|
||||
if (FPage<>nil) then FPage.OnComponentVisibleChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TRegisteredComponent.FreeButton;
|
||||
begin
|
||||
FButton.Free;
|
||||
FButton:=nil;
|
||||
end;
|
||||
|
||||
constructor TRegisteredComponent.Create(TheComponentClass: TComponentClass;
|
||||
const ThePageName: string);
|
||||
begin
|
||||
@ -248,7 +261,7 @@ end;
|
||||
destructor TRegisteredComponent.Destroy;
|
||||
begin
|
||||
if FPage<>nil then FPage.Remove(Self);
|
||||
FreeThenNil(FButton);
|
||||
FreeButton;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -315,9 +328,12 @@ end;
|
||||
destructor TBaseComponentPage.Destroy;
|
||||
begin
|
||||
Clear;
|
||||
FreeThenNil(FPageComponent);
|
||||
FreeThenNil(FSelectButton);
|
||||
FPageComponent.Free;
|
||||
FPageComponent:=nil;
|
||||
FSelectButton.Free;
|
||||
FSelectButton:=nil;
|
||||
FItems.Free;
|
||||
FItems:=nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -336,8 +352,9 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
Cnt:=Count;
|
||||
for i:=0 to Cnt-1 do FreeThenNil(Items[i].FButton);
|
||||
FreeThenNil(FSelectButton);
|
||||
for i:=0 to Cnt-1 do Items[i].FreeButton;
|
||||
FSelectButton.Free;
|
||||
FSelectButton:=nil;
|
||||
end;
|
||||
|
||||
procedure TBaseComponentPage.ConsistencyCheck;
|
||||
@ -448,6 +465,18 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TBaseComponentPalette.SetBaseComponentPageClass(
|
||||
const AValue: TBaseComponentPageClass);
|
||||
begin
|
||||
FBaseComponentPageClass:=AValue;
|
||||
end;
|
||||
|
||||
procedure TBaseComponentPalette.SetRegisteredComponentClass(
|
||||
const AValue: TRegisteredComponentClass);
|
||||
begin
|
||||
FRegisteredComponentClass:=AValue;
|
||||
end;
|
||||
|
||||
constructor TBaseComponentPalette.Create;
|
||||
begin
|
||||
FItems:=TList.Create;
|
||||
@ -635,6 +664,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBaseComponentPalette.RegisterCustomIDEComponents(
|
||||
const RegisterProc: RegisterUnitComponentProc);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
IDEComponentPalette:=nil;
|
@ -1016,7 +1016,9 @@ begin
|
||||
AddFile('actionseditor.pas','ActionsEditor',pftUnit,[],cpBase);
|
||||
AddFile('columndlg.pp','ColumnDlg',pftUnit,[],cpBase);
|
||||
AddFile('componenteditors.pas','ComponentEditors',pftUnit,[],cpBase);
|
||||
AddFile('componentreg.pas','ComponentReg',pftUnit,[],cpBase);
|
||||
AddFile('componenttreeview.pas','ComponentTreeview',pftUnit,[],cpBase);
|
||||
AddFile('formeditingintf.pas','FormEditingIntf',pftUnit,[],cpBase);
|
||||
AddFile('graphpropedits.pas','GraphPropEdits',pftUnit,[],cpBase);
|
||||
AddFile('idecommands.pas','IDECommands',pftUnit,[],cpBase);
|
||||
AddFile('imagelisteditor.pp','ImageListEditor',pftUnit,[],cpBase);
|
||||
@ -1024,6 +1026,8 @@ begin
|
||||
AddFile('objectinspector.pp','ObjectInspector',pftUnit,[],cpBase);
|
||||
AddFile('objinspstrconsts.pas','ObjInspStrConsts',pftUnit,[],cpBase);
|
||||
AddFile('propedits.pp','PropEdits',pftUnit,[],cpBase);
|
||||
AddFile('srceditorintf.pas','SrcEditorIntf',pftUnit,[],cpBase);
|
||||
AddFile('texttools.pas','TextTools',pftUnit,[],cpBase);
|
||||
|
||||
// add unit paths
|
||||
UsageOptions.UnitPath:=SetDirSeparators(
|
||||
@ -1841,15 +1845,17 @@ end;
|
||||
procedure TLazPackageGraph.RegisterStaticBasePackages;
|
||||
begin
|
||||
BeginUpdate(true);
|
||||
// IDE built-in packages
|
||||
|
||||
// register IDE built-in packages
|
||||
RegisterStaticPackage(FCLPackage,@RegisterFCL.Register);
|
||||
RegisterStaticPackage(LCLPackage,@RegisterLCL.Register);
|
||||
RegisterStaticPackage(SynEditPackage,@RegisterSynEdit.Register);
|
||||
RegisterStaticPackage(IDEIntfPackage,@RegisterIDEIntf.Register);
|
||||
|
||||
// custom IDE components
|
||||
// register custom IDE components
|
||||
RegistrationPackage:=DefaultPackage;
|
||||
ComponentReg.RegisterCustomIDEComponents(@RegisterCustomIDEComponent);
|
||||
if IDEComponentPalette<>nil then
|
||||
IDEComponentPalette.RegisterCustomIDEComponents(@RegisterCustomIDEComponent);
|
||||
if DefaultPackage.FileCount=0 then begin
|
||||
FreeThenNil(FDefaultPackage);
|
||||
end else begin
|
||||
|
@ -1513,7 +1513,9 @@ begin
|
||||
itmPkgOpenPackageFile.OnClick:=@MainIDEitmPkgOpenPackageFileClick;
|
||||
itmPkgAddCurUnitToPkg.OnClick:=@MainIDEitmPkgAddCurUnitToPkgClick;
|
||||
itmPkgPkgGraph.OnClick:=@MainIDEitmPkgPkgGraphClick;
|
||||
{$IFDEF CustomIDEComps}
|
||||
itmCompsConfigCustomComps.OnClick :=@mnuConfigCustomCompsClicked;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
SetRecentPackagesMenu;
|
||||
|
Loading…
Reference in New Issue
Block a user