mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 22:15:55 +02:00
IDE: using new unitname instead of default unitname
git-svn-id: trunk@9975 -
This commit is contained in:
parent
ceedffb52a
commit
8416ec2b2d
@ -1452,8 +1452,8 @@ var
|
||||
|
||||
// create component and component interface
|
||||
NewCI := TComponentInterface(TheFormEditor.CreateComponent(
|
||||
ParentCI,SelectedCompClass.ComponentClass
|
||||
,NewLeft,NewTop,NewWidth,NewHeight));
|
||||
ParentCI,SelectedCompClass.ComponentClass,'',
|
||||
NewLeft,NewTop,NewWidth,NewHeight));
|
||||
if NewCI=nil then exit;
|
||||
NewComponent:=NewCI.Component;
|
||||
|
||||
|
@ -239,7 +239,7 @@ begin
|
||||
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
||||
then exit;
|
||||
//debugln('TComponentPalette.ComponentBtnDblClick ',dbgsName(Sender),' ',dbgs(X),',',dbgs(Y));
|
||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,X,Y,0,0);
|
||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0);
|
||||
if CompIntf<>nil then begin
|
||||
GlobalDesignHook.PersistentAdded(CompIntf.Component,true);
|
||||
end;
|
||||
|
@ -198,9 +198,10 @@ each control that's dropped onto the form
|
||||
Function GetDefaultComponentPosition(TypeClass: TComponentClass;
|
||||
ParentCI: TIComponentInterface;
|
||||
var X,Y: integer): boolean; override;
|
||||
Function CreateComponent(ParentCI : TIComponentInterface;
|
||||
function CreateComponent(ParentCI: TIComponentInterface;
|
||||
TypeClass: TComponentClass;
|
||||
X,Y,W,H : Integer): TIComponentInterface; override;
|
||||
const AUnitName: shortstring;
|
||||
X,Y,W,H: Integer): TIComponentInterface; override;
|
||||
Function CreateComponentFromStream(BinStream: TStream;
|
||||
AncestorType: TComponentClass;
|
||||
const NewUnitName: ShortString;
|
||||
@ -210,7 +211,7 @@ each control that's dropped onto the form
|
||||
ParentControl: TWinControl): TIComponentInterface; override;
|
||||
Procedure SetComponentNameAndClass(CI: TIComponentInterface;
|
||||
const NewName, NewClassName: shortstring);
|
||||
|
||||
|
||||
// define properties
|
||||
procedure FindDefineProperty(const APersistentClassName,
|
||||
AncestorClassName, Identifier: string;
|
||||
@ -1210,7 +1211,8 @@ begin
|
||||
end;
|
||||
|
||||
Function TCustomFormEditor.CreateComponent(ParentCI: TIComponentInterface;
|
||||
TypeClass: TComponentClass; X,Y,W,H: Integer): TIComponentInterface;
|
||||
TypeClass: TComponentClass; const AUnitName: shortstring; X,Y,W,H: Integer
|
||||
): TIComponentInterface;
|
||||
Var
|
||||
Temp: TComponentInterface;
|
||||
NewJITIndex: Integer;
|
||||
@ -1223,6 +1225,7 @@ Var
|
||||
AParent: TWinControl;
|
||||
NewComponentName: String;
|
||||
DesignForm: TCustomForm;
|
||||
NewUnitName: String;
|
||||
Begin
|
||||
Result:=nil;
|
||||
Temp:=nil;
|
||||
@ -1281,10 +1284,14 @@ Begin
|
||||
end else begin
|
||||
// create a toplevel component
|
||||
// -> a form or a datamodule or a custom component
|
||||
if AUnitName='' then
|
||||
NewUnitName:=DefaultJITUnitName
|
||||
else
|
||||
NewUnitName:=AUnitName;
|
||||
JITList:=GetJITListOfType(TypeClass);
|
||||
if JITList=nil then
|
||||
RaiseException('TCustomFormEditor.CreateComponent '+TypeClass.ClassName);
|
||||
NewJITIndex := JITList.AddNewJITComponent(DefaultJITUnitName,TypeClass);
|
||||
NewJITIndex := JITList.AddNewJITComponent(NewUnitName,TypeClass);
|
||||
if NewJITIndex >= 0 then
|
||||
// create component interface
|
||||
Temp := TComponentInterface.Create(JITList[NewJITIndex])
|
||||
|
@ -3770,7 +3770,7 @@ begin
|
||||
// create jit component
|
||||
CInterface := TComponentInterface(
|
||||
FormEditor1.CreateComponent(nil,TComponentClass(AncestorType),
|
||||
new_x, new_y, 400,300));
|
||||
NewUnitInfo.CreateUnitName, new_x, new_y, 400,300));
|
||||
FormEditor1.SetComponentNameAndClass(CInterface,
|
||||
NewUnitInfo.ComponentName,'T'+NewUnitInfo.ComponentName);
|
||||
NewComponent:=CInterface.Component;
|
||||
|
@ -102,6 +102,7 @@ type
|
||||
var X,Y: integer): boolean; virtual; abstract;
|
||||
function CreateComponent(ParentCI: TIComponentInterface;
|
||||
TypeClass: TComponentClass;
|
||||
const AUnitName: shortstring;
|
||||
X,Y,W,H: Integer): TIComponentInterface; virtual; abstract;
|
||||
function CreateComponentFromStream(BinStream: TStream;
|
||||
AncestorType: TComponentClass;
|
||||
|
Loading…
Reference in New Issue
Block a user