mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 19:39:28 +02:00
added RTTI check for unitname of design components
git-svn-id: trunk@6844 -
This commit is contained in:
parent
74e7dda52e
commit
ab2ebd300a
@ -1676,6 +1676,8 @@ resourcestring
|
|||||||
lisCodeToolsDefsprojectSpecific = '%s, project specific';
|
lisCodeToolsDefsprojectSpecific = '%s, project specific';
|
||||||
lisCodeToolsDefsnoneSelected = 'none selected';
|
lisCodeToolsDefsnoneSelected = 'none selected';
|
||||||
lisCodeToolsDefsInvalidParent = 'Invalid parent';
|
lisCodeToolsDefsInvalidParent = 'Invalid parent';
|
||||||
|
lisACanNotHoldTControlsYouCanOnlyPutNonVisualComponen = 'A %s can not hold '
|
||||||
|
+'TControls.%sYou can only put non visual components on it.';
|
||||||
lisCodeToolsDefsAutoCreatedNodesReadOnly = 'Auto created nodes can not be '
|
lisCodeToolsDefsAutoCreatedNodesReadOnly = 'Auto created nodes can not be '
|
||||||
+'edited,%snor can they have non auto created child nodes.';
|
+'edited,%snor can they have non auto created child nodes.';
|
||||||
lisCodeToolsDefsInvalidParentNode = 'Invalid parent node';
|
lisCodeToolsDefsInvalidParentNode = 'Invalid parent node';
|
||||||
|
@ -10995,9 +10995,9 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
if (not (AParent is TControl))
|
if (not (AParent is TControl))
|
||||||
and (APersistentClass.InheritsFrom(TControl)) then begin
|
and (APersistentClass.InheritsFrom(TControl)) then begin
|
||||||
MessageDlg('Invalid parent',
|
MessageDlg(lisCodeToolsDefsInvalidParent,
|
||||||
'A '+AParent.ClassName+' can not hold TControls.'#13
|
Format(lisACanNotHoldTControlsYouCanOnlyPutNonVisualComponen, [
|
||||||
+'You can only put non visual components on it.',
|
AParent.ClassName, #13]),
|
||||||
mtError,[mbCancel],0);
|
mtError,[mbCancel],0);
|
||||||
UpdateIDEComponentPalette;
|
UpdateIDEComponentPalette;
|
||||||
exit;
|
exit;
|
||||||
@ -11402,6 +11402,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.847 2005/02/25 20:19:46 mattias
|
||||||
|
added RTTI check for unitname of design components
|
||||||
|
|
||||||
Revision 1.846 2005/02/18 18:08:20 mattias
|
Revision 1.846 2005/02/18 18:08:20 mattias
|
||||||
project dependencies are now added/removed/renamed in the project main uses section
|
project dependencies are now added/removed/renamed in the project main uses section
|
||||||
|
|
||||||
|
@ -1384,6 +1384,7 @@ var
|
|||||||
GlobalDesignHook: TPropertyEditorHook;
|
GlobalDesignHook: TPropertyEditorHook;
|
||||||
|
|
||||||
function ClassTypeInfo(Value: TClass): PTypeInfo;
|
function ClassTypeInfo(Value: TClass): PTypeInfo;
|
||||||
|
function GetClassUnitName(Value: TClass): string;
|
||||||
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
||||||
|
|
||||||
|
|
||||||
@ -1410,7 +1411,7 @@ type
|
|||||||
FColumns: TListColumns;
|
FColumns: TListColumns;
|
||||||
FModalResult:TModalResult;
|
FModalResult:TModalResult;
|
||||||
public
|
public
|
||||||
function PTypeInfos(const PropName:shortstring):PTypeInfo;
|
function PTypeInfos(const PropName:shortstring): PTypeInfo;
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
published
|
published
|
||||||
@ -6183,6 +6184,20 @@ begin
|
|||||||
Result:=TComponent(Result).Owner;
|
Result:=TComponent(Result).Owner;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetClassUnitName(Value: TClass): string;
|
||||||
|
var
|
||||||
|
TheTypeInfo: PTypeInfo;
|
||||||
|
TheTypeData: PTypeData;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
TheTypeInfo:=ClassTypeInfo(Value);
|
||||||
|
if TheTypeInfo=nil then exit;
|
||||||
|
TheTypeData:=GetTypeData(TheTypeInfo);
|
||||||
|
if TheTypeData=nil then exit;
|
||||||
|
Result:=TheTypeData^.UnitName;
|
||||||
|
//debugln('GetClassUnitName A Result="',Result,'"');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
procedure CreateComponentEvent(AComponent: TComponent; const EventName: string);
|
||||||
var
|
var
|
||||||
CurDesigner: TIDesigner;
|
CurDesigner: TIDesigner;
|
||||||
|
@ -48,8 +48,9 @@ uses
|
|||||||
Classes, SysUtils, LCLProc, LResources, Graphics,
|
Classes, SysUtils, LCLProc, LResources, Graphics,
|
||||||
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, Laz_XMLCfg,
|
{$IFNDEF VER1_0}AVL_Tree{$ELSE}OldAvLTree{$ENDIF}, Laz_XMLCfg,
|
||||||
DefineTemplates, CodeToolManager, EditDefineTree, CompilerOptions, Forms,
|
DefineTemplates, CodeToolManager, EditDefineTree, CompilerOptions, Forms,
|
||||||
FileUtil, LazarusIDEStrConsts, IDEProcs, ComponentReg, TransferMacros,
|
FileUtil, PropEdits,
|
||||||
FileReferenceList, PublishModule;
|
LazarusIDEStrConsts, IDEProcs, ComponentReg,
|
||||||
|
TransferMacros, FileReferenceList, PublishModule;
|
||||||
|
|
||||||
type
|
type
|
||||||
TLazPackage = class;
|
TLazPackage = class;
|
||||||
@ -2918,8 +2919,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TPkgComponent.GetUnitName: string;
|
function TPkgComponent.GetUnitName: string;
|
||||||
|
var
|
||||||
|
TIUnitName: String;
|
||||||
begin
|
begin
|
||||||
Result:=PkgFile.UnitName;
|
Result:=PkgFile.UnitName;
|
||||||
|
// compare with RTTI unit name
|
||||||
|
if ComponentClass<>nil then begin
|
||||||
|
TIUnitName:=GetClassUnitName(ComponentClass);
|
||||||
|
if CompareText(TIUnitName,Result)<>0 then
|
||||||
|
Result:=TIUnitName;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TPkgComponent.GetPriority: TComponentPriority;
|
function TPkgComponent.GetPriority: TComponentPriority;
|
||||||
|
Loading…
Reference in New Issue
Block a user