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