mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 13:30:37 +02:00
IDE: designer forms are now created with delayed autosize
git-svn-id: trunk@24423 -
This commit is contained in:
parent
ad982bfee9
commit
e77e383461
@ -1871,6 +1871,7 @@ var
|
|||||||
NewComponent: TComponent;
|
NewComponent: TComponent;
|
||||||
NewComponentClass: TComponentClass;
|
NewComponentClass: TComponentClass;
|
||||||
NewName: String;
|
NewName: String;
|
||||||
|
DisableAutoSize: Boolean;
|
||||||
begin
|
begin
|
||||||
if MouseDownComponent=nil then exit;
|
if MouseDownComponent=nil then exit;
|
||||||
|
|
||||||
@ -1958,11 +1959,14 @@ var
|
|||||||
|
|
||||||
// create component and component interface
|
// create component and component interface
|
||||||
DebugLn(['AddComponent ',DbgSName(NewComponentClass),' Parent=',DbgSName(NewParent),' ',NewLeft,',',NewTop,',',NewWidth,',',NewHeight]);
|
DebugLn(['AddComponent ',DbgSName(NewComponentClass),' Parent=',DbgSName(NewParent),' ',NewLeft,',',NewTop,',',NewWidth,',',NewHeight]);
|
||||||
|
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||||
NewCI := TComponentInterface(TheFormEditor.CreateComponent(
|
NewCI := TComponentInterface(TheFormEditor.CreateComponent(
|
||||||
ParentCI,NewComponentClass,'',
|
ParentCI,NewComponentClass,'',
|
||||||
NewLeft,NewTop,NewWidth,NewHeight));
|
NewLeft,NewTop,NewWidth,NewHeight,DisableAutoSize));
|
||||||
if NewCI=nil then exit;
|
if NewCI=nil then exit;
|
||||||
NewComponent:=NewCI.Component;
|
NewComponent:=NewCI.Component;
|
||||||
|
if DisableAutoSize and (NewComponent is TControl) then
|
||||||
|
TControl(NewComponent).EnableAutoSizing;
|
||||||
TheFormEditor.FixupReferences(NewComponent); // e.g. frame references a datamodule
|
TheFormEditor.FixupReferences(NewComponent); // e.g. frame references a datamodule
|
||||||
|
|
||||||
// modified
|
// modified
|
||||||
|
@ -148,7 +148,7 @@ type
|
|||||||
DestroyDriver: Boolean); virtual;
|
DestroyDriver: Boolean); virtual;
|
||||||
function DoCreateJITComponent(const NewComponentName, NewClassName,
|
function DoCreateJITComponent(const NewComponentName, NewClassName,
|
||||||
NewUnitName: shortstring; AncestorClass: TClass;
|
NewUnitName: shortstring; AncestorClass: TClass;
|
||||||
Visible: boolean):integer;
|
Visible, DisableAutoSize: boolean):integer;
|
||||||
procedure ReadInlineComponent(var Component: TComponent;
|
procedure ReadInlineComponent(var Component: TComponent;
|
||||||
ComponentClass: TComponentClass; NewOwner: TComponent);
|
ComponentClass: TComponentClass; NewOwner: TComponent);
|
||||||
procedure DoFinishReading; virtual;
|
procedure DoFinishReading; virtual;
|
||||||
@ -160,11 +160,12 @@ type
|
|||||||
property Items[Index: integer]: TComponent read GetItem; default;
|
property Items[Index: integer]: TComponent read GetItem; default;
|
||||||
function Count: integer;
|
function Count: integer;
|
||||||
function AddNewJITComponent(const NewUnitName: shortstring;
|
function AddNewJITComponent(const NewUnitName: shortstring;
|
||||||
AncestorClass: TClass): integer;
|
AncestorClass: TClass;
|
||||||
|
DisableAutoSize: boolean): integer;
|
||||||
function AddJITComponentFromStream(BinStream: TStream;
|
function AddJITComponentFromStream(BinStream: TStream;
|
||||||
AncestorClass: TClass;
|
AncestorClass: TClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive, Visible: Boolean;
|
Interactive, Visible, DisableAutoSize: Boolean;
|
||||||
ContextObj: TObject): integer;
|
ContextObj: TObject): integer;
|
||||||
procedure DestroyJITComponent(JITComponent: TComponent);
|
procedure DestroyJITComponent(JITComponent: TComponent);
|
||||||
procedure DestroyJITComponent(Index: integer);
|
procedure DestroyJITComponent(Index: integer);
|
||||||
@ -796,7 +797,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TJITComponentList.AddNewJITComponent(const NewUnitName: shortstring;
|
function TJITComponentList.AddNewJITComponent(const NewUnitName: shortstring;
|
||||||
AncestorClass: TClass): integer;
|
AncestorClass: TClass; DisableAutoSize: boolean): integer;
|
||||||
var
|
var
|
||||||
NewComponentName, NewClassName: shortstring;
|
NewComponentName, NewClassName: shortstring;
|
||||||
begin
|
begin
|
||||||
@ -810,13 +811,13 @@ begin
|
|||||||
' NewUnitName=',NewUnitName,' AncestorClass=',AncestorClass.ClassName);
|
' NewUnitName=',NewUnitName,' AncestorClass=',AncestorClass.ClassName);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Result:=DoCreateJITComponent(NewComponentName,NewClassName,NewUnitName,
|
Result:=DoCreateJITComponent(NewComponentName,NewClassName,NewUnitName,
|
||||||
AncestorClass,true);
|
AncestorClass,true,DisableAutoSize);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
|
function TJITComponentList.AddJITComponentFromStream(BinStream: TStream;
|
||||||
AncestorClass: TClass;
|
AncestorClass: TClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive, Visible: Boolean;
|
Interactive, Visible, DisableAutoSize: Boolean;
|
||||||
ContextObj: TObject): integer;
|
ContextObj: TObject): integer;
|
||||||
// returns new index
|
// returns new index
|
||||||
// -1 = invalid stream
|
// -1 = invalid stream
|
||||||
@ -904,7 +905,7 @@ begin
|
|||||||
debugln('[TJITComponentList.AddJITComponentFromStream] Create ...');
|
debugln('[TJITComponentList.AddJITComponentFromStream] Create ...');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
try
|
try
|
||||||
Result:=DoCreateJITComponent('',NewClassName,NewUnitName,AncestorClass,Visible);
|
Result:=DoCreateJITComponent('',NewClassName,NewUnitName,AncestorClass,Visible,DisableAutoSize);
|
||||||
if Result<0 then exit;
|
if Result<0 then exit;
|
||||||
ReadAncestorStreams;
|
ReadAncestorStreams;
|
||||||
ReadStream(BinStream, FCurReadJITComponent.ClassType);
|
ReadStream(BinStream, FCurReadJITComponent.ClassType);
|
||||||
@ -994,7 +995,7 @@ end;
|
|||||||
|
|
||||||
function TJITComponentList.DoCreateJITComponent(
|
function TJITComponentList.DoCreateJITComponent(
|
||||||
const NewComponentName, NewClassName, NewUnitName: shortstring;
|
const NewComponentName, NewClassName, NewUnitName: shortstring;
|
||||||
AncestorClass: TClass; Visible: boolean):integer;
|
AncestorClass: TClass; Visible, DisableAutoSize: boolean):integer;
|
||||||
var
|
var
|
||||||
Instance:TComponent;
|
Instance:TComponent;
|
||||||
ok: boolean;
|
ok: boolean;
|
||||||
@ -1015,6 +1016,8 @@ begin
|
|||||||
NewUnitName);
|
NewUnitName);
|
||||||
//debugln('[TJITForms.DoCreateJITComponent] Creating an instance of JIT class "'+NewClassName+'" = class('+AncestorClass.ClassName+') ...');
|
//debugln('[TJITForms.DoCreateJITComponent] Creating an instance of JIT class "'+NewClassName+'" = class('+AncestorClass.ClassName+') ...');
|
||||||
Instance:=TComponent(FCurReadClass.NewInstance);
|
Instance:=TComponent(FCurReadClass.NewInstance);
|
||||||
|
if DisableAutoSize and (Instance is TControl) then
|
||||||
|
TControl(Instance).DisableAutoSizing;
|
||||||
//debugln('[TJITForms.DoCreateJITComponent] Initializing new instance ... ',DbgS(Instance));
|
//debugln('[TJITForms.DoCreateJITComponent] Initializing new instance ... ',DbgS(Instance));
|
||||||
TComponent(FCurReadJITComponent):=Instance;
|
TComponent(FCurReadJITComponent):=Instance;
|
||||||
try
|
try
|
||||||
|
@ -284,6 +284,7 @@ var
|
|||||||
CompIntf, ParentCI: TIComponentInterface;
|
CompIntf, ParentCI: TIComponentInterface;
|
||||||
TypeClass: TComponentClass;
|
TypeClass: TComponentClass;
|
||||||
X, Y: integer;
|
X, Y: integer;
|
||||||
|
DisableAutoSize: Boolean;
|
||||||
begin
|
begin
|
||||||
if not Assigned(AComponent)
|
if not Assigned(AComponent)
|
||||||
then Exit;
|
then Exit;
|
||||||
@ -301,9 +302,14 @@ begin
|
|||||||
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
||||||
then exit;
|
then exit;
|
||||||
|
|
||||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0);
|
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||||
if Assigned(CompIntf)
|
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0,
|
||||||
then GlobalDesignHook.PersistentAdded(CompIntf.Component,true);
|
DisableAutoSize);
|
||||||
|
if Assigned(CompIntf) then begin
|
||||||
|
if DisableAutoSize and (CompIntf.Component is TControl) then
|
||||||
|
TControl(CompIntf.Component).EnableAutoSizing;
|
||||||
|
GlobalDesignHook.PersistentAdded(CompIntf.Component,true);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TComponentListForm.ListboxComponentsDblClick(Sender: TObject);
|
procedure TComponentListForm.ListboxComponentsDblClick(Sender: TObject);
|
||||||
|
@ -250,6 +250,7 @@ var
|
|||||||
ParentCI: TIComponentInterface;
|
ParentCI: TIComponentInterface;
|
||||||
X, Y: integer;
|
X, Y: integer;
|
||||||
CompIntf: TIComponentInterface;
|
CompIntf: TIComponentInterface;
|
||||||
|
DisableAutoSize: Boolean;
|
||||||
begin
|
begin
|
||||||
//debugln('TComponentPalette.ComponentBtnDblClick ',TComponent(Sender).Name);
|
//debugln('TComponentPalette.ComponentBtnDblClick ',TComponent(Sender).Name);
|
||||||
if SelectButton(TComponent(Sender)) and (FSelected<>nil) then begin
|
if SelectButton(TComponent(Sender)) and (FSelected<>nil) then begin
|
||||||
@ -265,8 +266,12 @@ begin
|
|||||||
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
if not FormEditingHook.GetDefaultComponentPosition(TypeClass,ParentCI,X,Y)
|
||||||
then exit;
|
then exit;
|
||||||
//debugln('TComponentPalette.ComponentBtnDblClick ',dbgsName(Sender),' ',dbgs(X),',',dbgs(Y));
|
//debugln('TComponentPalette.ComponentBtnDblClick ',dbgsName(Sender),' ',dbgs(X),',',dbgs(Y));
|
||||||
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0);
|
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||||
|
CompIntf:=FormEditingHook.CreateComponent(ParentCI,TypeClass,'',X,Y,0,0,
|
||||||
|
DisableAutoSize);
|
||||||
if CompIntf<>nil then begin
|
if CompIntf<>nil then begin
|
||||||
|
if DisableAutoSize and (CompIntf.Component is TControl) then
|
||||||
|
TControl(CompIntf.Component).EnableAutoSizing;
|
||||||
GlobalDesignHook.PersistentAdded(CompIntf.Component,true);
|
GlobalDesignHook.PersistentAdded(CompIntf.Component,true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -254,18 +254,21 @@ each control that's dropped onto the form
|
|||||||
function CreateComponent(ParentCI: TIComponentInterface;
|
function CreateComponent(ParentCI: TIComponentInterface;
|
||||||
TypeClass: TComponentClass;
|
TypeClass: TComponentClass;
|
||||||
const AUnitName: shortstring;
|
const AUnitName: shortstring;
|
||||||
NewLeft,NewTop,NewWidth,NewHeight: Integer): TIComponentInterface; override;
|
NewLeft,NewTop,NewWidth,NewHeight: Integer;
|
||||||
|
DisableAutoSize: boolean): TIComponentInterface; override;
|
||||||
function CreateComponentFromStream(BinStream: TStream;
|
function CreateComponentFromStream(BinStream: TStream;
|
||||||
AncestorType: TComponentClass;
|
AncestorType: TComponentClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive: boolean;
|
Interactive: boolean;
|
||||||
Visible: boolean = true;
|
Visible: boolean = true;
|
||||||
|
DisableAutoSize: boolean = false;
|
||||||
ContextObj: TObject = nil): TIComponentInterface; override;
|
ContextObj: TObject = nil): TIComponentInterface; override;
|
||||||
function CreateRawComponentFromStream(BinStream: TStream;
|
function CreateRawComponentFromStream(BinStream: TStream;
|
||||||
AncestorType: TComponentClass;
|
AncestorType: TComponentClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive: boolean;
|
Interactive: boolean;
|
||||||
Visible: boolean = true;
|
Visible: boolean = true;
|
||||||
|
DisableAutoSize: boolean = false;
|
||||||
ContextObj: TObject = nil): TComponent;
|
ContextObj: TObject = nil): TComponent;
|
||||||
function CreateChildComponentFromStream(BinStream: TStream;
|
function CreateChildComponentFromStream(BinStream: TStream;
|
||||||
ComponentClass: TComponentClass; Root: TComponent;
|
ComponentClass: TComponentClass; Root: TComponent;
|
||||||
@ -1578,8 +1581,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomFormEditor.CreateComponent(ParentCI: TIComponentInterface;
|
function TCustomFormEditor.CreateComponent(ParentCI: TIComponentInterface;
|
||||||
TypeClass: TComponentClass; const AUnitName: shortstring; NewLeft, NewTop, NewWidth, NewHeight: Integer
|
TypeClass: TComponentClass; const AUnitName: shortstring;
|
||||||
): TIComponentInterface;
|
NewLeft, NewTop, NewWidth, NewHeight: Integer;
|
||||||
|
DisableAutoSize: boolean): TIComponentInterface;
|
||||||
const
|
const
|
||||||
PreferredDistanceMin = 30;
|
PreferredDistanceMin = 30;
|
||||||
PreferredDistanceMax = 250;
|
PreferredDistanceMax = 250;
|
||||||
@ -1636,6 +1640,8 @@ begin
|
|||||||
OwnerComponent := OwnerComponent.Owner;
|
OwnerComponent := OwnerComponent.Owner;
|
||||||
try
|
try
|
||||||
NewComponent := TComponent(TypeClass.newinstance);
|
NewComponent := TComponent(TypeClass.newinstance);
|
||||||
|
if DisableAutoSize and (NewComponent is TControl) then
|
||||||
|
TControl(NewComponent).DisableAutoSizing;
|
||||||
SetComponentDesignMode(NewComponent,true);
|
SetComponentDesignMode(NewComponent,true);
|
||||||
if DescendFromDesignerBaseClass(TypeClass)>=0 then begin
|
if DescendFromDesignerBaseClass(TypeClass)>=0 then begin
|
||||||
// this class can have its own lfm streams (e.g. a TFrame)
|
// this class can have its own lfm streams (e.g. a TFrame)
|
||||||
@ -1699,7 +1705,7 @@ begin
|
|||||||
JITList:=GetJITListOfType(TypeClass);
|
JITList:=GetJITListOfType(TypeClass);
|
||||||
if JITList=nil then
|
if JITList=nil then
|
||||||
RaiseException('TCustomFormEditor.CreateComponent '+TypeClass.ClassName);
|
RaiseException('TCustomFormEditor.CreateComponent '+TypeClass.ClassName);
|
||||||
NewJITIndex := JITList.AddNewJITComponent(NewUnitName,TypeClass);
|
NewJITIndex := JITList.AddNewJITComponent(NewUnitName,TypeClass,DisableAutoSize);
|
||||||
if NewJITIndex < 0 then
|
if NewJITIndex < 0 then
|
||||||
exit;
|
exit;
|
||||||
// create component interface
|
// create component interface
|
||||||
@ -1881,20 +1887,20 @@ function TCustomFormEditor.CreateComponentFromStream(
|
|||||||
BinStream: TStream;
|
BinStream: TStream;
|
||||||
AncestorType: TComponentClass;
|
AncestorType: TComponentClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive: boolean; Visible: boolean;
|
Interactive: boolean; Visible: boolean; DisableAutoSize: boolean;
|
||||||
ContextObj: TObject): TIComponentInterface;
|
ContextObj: TObject): TIComponentInterface;
|
||||||
var
|
var
|
||||||
NewComponent: TComponent;
|
NewComponent: TComponent;
|
||||||
begin
|
begin
|
||||||
NewComponent:=CreateRawComponentFromStream(BinStream,
|
NewComponent:=CreateRawComponentFromStream(BinStream,
|
||||||
AncestorType,NewUnitName,Interactive,Visible,ContextObj);
|
AncestorType,NewUnitName,Interactive,Visible,DisableAutoSize,ContextObj);
|
||||||
Result:=CreateComponentInterface(NewComponent,true);
|
Result:=CreateComponentInterface(NewComponent,true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomFormEditor.CreateRawComponentFromStream(BinStream: TStream;
|
function TCustomFormEditor.CreateRawComponentFromStream(BinStream: TStream;
|
||||||
AncestorType: TComponentClass;
|
AncestorType: TComponentClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive: boolean; Visible: boolean;
|
Interactive: boolean; Visible: boolean; DisableAutoSize: boolean;
|
||||||
ContextObj: TObject): TComponent;
|
ContextObj: TObject): TComponent;
|
||||||
var
|
var
|
||||||
NewJITIndex: integer;
|
NewJITIndex: integer;
|
||||||
@ -1906,7 +1912,8 @@ begin
|
|||||||
RaiseException('TCustomFormEditor.CreateComponentFromStream ClassName='+
|
RaiseException('TCustomFormEditor.CreateComponentFromStream ClassName='+
|
||||||
AncestorType.ClassName);
|
AncestorType.ClassName);
|
||||||
NewJITIndex := JITList.AddJITComponentFromStream(BinStream,
|
NewJITIndex := JITList.AddJITComponentFromStream(BinStream,
|
||||||
AncestorType,NewUnitName,Interactive,Visible,ContextObj);
|
AncestorType,NewUnitName,Interactive,Visible,DisableAutoSize,
|
||||||
|
ContextObj);
|
||||||
if NewJITIndex < 0 then begin
|
if NewJITIndex < 0 then begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
exit;
|
exit;
|
||||||
|
22
ide/main.pp
22
ide/main.pp
@ -648,7 +648,8 @@ type
|
|||||||
NewOwner: TObject; NewFilename: string; var NewCodeBuffer: TCodeBuffer;
|
NewOwner: TObject; NewFilename: string; var NewCodeBuffer: TCodeBuffer;
|
||||||
var NewUnitName: string; AskForFilename: boolean): TModalResult;
|
var NewUnitName: string; AskForFilename: boolean): TModalResult;
|
||||||
function CreateNewForm(NewUnitInfo: TUnitInfo;
|
function CreateNewForm(NewUnitInfo: TUnitInfo;
|
||||||
AncestorType: TPersistentClass; ResourceCode: TCodeBuffer; UseCreateFormStatements: Boolean): TModalResult;
|
AncestorType: TPersistentClass; ResourceCode: TCodeBuffer;
|
||||||
|
UseCreateFormStatements, DisableAutoSize: Boolean): TModalResult;
|
||||||
|
|
||||||
// methods for 'save unit'
|
// methods for 'save unit'
|
||||||
function DoShowSaveFileAsDialog(var AFilename: string; AnUnitInfo: TUnitInfo;
|
function DoShowSaveFileAsDialog(var AFilename: string; AnUnitInfo: TUnitInfo;
|
||||||
@ -4662,7 +4663,7 @@ end;
|
|||||||
|
|
||||||
function TMainIDE.CreateNewForm(NewUnitInfo: TUnitInfo;
|
function TMainIDE.CreateNewForm(NewUnitInfo: TUnitInfo;
|
||||||
AncestorType: TPersistentClass; ResourceCode: TCodeBuffer;
|
AncestorType: TPersistentClass; ResourceCode: TCodeBuffer;
|
||||||
UseCreateFormStatements: Boolean): TModalResult;
|
UseCreateFormStatements, DisableAutoSize: Boolean): TModalResult;
|
||||||
var
|
var
|
||||||
CInterface: TComponentInterface;
|
CInterface: TComponentInterface;
|
||||||
NewComponent: TComponent;
|
NewComponent: TComponent;
|
||||||
@ -4695,7 +4696,7 @@ begin
|
|||||||
// create jit component
|
// create jit component
|
||||||
CInterface := TComponentInterface(
|
CInterface := TComponentInterface(
|
||||||
FormEditor1.CreateComponent(nil,TComponentClass(AncestorType),
|
FormEditor1.CreateComponent(nil,TComponentClass(AncestorType),
|
||||||
NewUnitInfo.CreateUnitName, new_x, new_y, 0,0));
|
NewUnitInfo.CreateUnitName, new_x, new_y, 0,0,DisableAutoSize));
|
||||||
if CInterface=nil then begin
|
if CInterface=nil then begin
|
||||||
DebugLn(['TMainIDE.CreateNewForm FormEditor1.CreateComponent failed ',dbgsName(TComponentClass(AncestorType))]);
|
DebugLn(['TMainIDE.CreateNewForm FormEditor1.CreateComponent failed ',dbgsName(TComponentClass(AncestorType))]);
|
||||||
exit(mrCancel);
|
exit(mrCancel);
|
||||||
@ -5938,6 +5939,7 @@ var
|
|||||||
NestedClassName: string;
|
NestedClassName: string;
|
||||||
NestedClass: TComponentClass;
|
NestedClass: TComponentClass;
|
||||||
NestedUnitInfo: TUnitInfo;
|
NestedUnitInfo: TUnitInfo;
|
||||||
|
DisableAutoSize: Boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF IDE_DEBUG}
|
{$IFDEF IDE_DEBUG}
|
||||||
debugln('TMainIDE.DoLoadLFM A ',AnUnitInfo.Filename,' IsPartOfProject=',dbgs(AnUnitInfo.IsPartOfProject),' ');
|
debugln('TMainIDE.DoLoadLFM A ',AnUnitInfo.Filename,' IsPartOfProject=',dbgs(AnUnitInfo.IsPartOfProject),' ');
|
||||||
@ -5945,6 +5947,7 @@ begin
|
|||||||
|
|
||||||
ReferencesLocked:=false;
|
ReferencesLocked:=false;
|
||||||
MissingClasses:=nil;
|
MissingClasses:=nil;
|
||||||
|
NewComponent:=nil;
|
||||||
try
|
try
|
||||||
if (ofRevert in OpenFlags) and (AnUnitInfo.Component<>nil) then begin
|
if (ofRevert in OpenFlags) and (AnUnitInfo.Component<>nil) then begin
|
||||||
// the component must be destroyed and recreated
|
// the component must be destroyed and recreated
|
||||||
@ -6083,8 +6086,11 @@ begin
|
|||||||
if NewUnitName='' then
|
if NewUnitName='' then
|
||||||
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
NewUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
|
||||||
// ToDo: create AncestorBinStream(s) via hook, not via parameters
|
// ToDo: create AncestorBinStream(s) via hook, not via parameters
|
||||||
|
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||||
NewComponent:=FormEditor1.CreateRawComponentFromStream(BinStream,
|
NewComponent:=FormEditor1.CreateRawComponentFromStream(BinStream,
|
||||||
AncestorType,copy(NewUnitName,1,255),true,true,AnUnitInfo);
|
AncestorType,copy(NewUnitName,1,255),true,true,DisableAutoSize,AnUnitInfo);
|
||||||
|
if DisableAutoSize and (NewComponent is TControl) then
|
||||||
|
TControl(NewComponent).EnableAutoSizing;
|
||||||
Project1.InvalidateUnitComponentDesignerDependencies;
|
Project1.InvalidateUnitComponentDesignerDependencies;
|
||||||
AnUnitInfo.Component:=NewComponent;
|
AnUnitInfo.Component:=NewComponent;
|
||||||
if (AncestorUnitInfo<>nil) then
|
if (AncestorUnitInfo<>nil) then
|
||||||
@ -7739,6 +7745,7 @@ var
|
|||||||
ResType: TResourceType;
|
ResType: TResourceType;
|
||||||
SrcNoteBook: TSourceNotebook;
|
SrcNoteBook: TSourceNotebook;
|
||||||
AShareEditor: TSourceEditor;
|
AShareEditor: TSourceEditor;
|
||||||
|
DisableAutoSize: Boolean;
|
||||||
begin
|
begin
|
||||||
//debugln('TMainIDE.DoNewEditorFile A NewFilename=',NewFilename);
|
//debugln('TMainIDE.DoNewEditorFile A NewFilename=',NewFilename);
|
||||||
// empty NewFilename is ok, it will be auto generated
|
// empty NewFilename is ok, it will be auto generated
|
||||||
@ -7859,8 +7866,13 @@ begin
|
|||||||
end else begin
|
end else begin
|
||||||
// create a designer form for a form/datamodule/frame
|
// create a designer form for a form/datamodule/frame
|
||||||
//DebugLn(['TMainIDE.DoNewFile Name=',NewFileDescriptor.Name,' Class=',NewFileDescriptor.ClassName]);
|
//DebugLn(['TMainIDE.DoNewFile Name=',NewFileDescriptor.Name,' Class=',NewFileDescriptor.ClassName]);
|
||||||
|
DisableAutoSize:={$IFDEF OldAutoSize}false{$ELSE}true{$ENDIF};
|
||||||
Result := CreateNewForm(NewUnitInfo, AncestorType, nil,
|
Result := CreateNewForm(NewUnitInfo, AncestorType, nil,
|
||||||
NewFileDescriptor.UseCreateFormStatements);
|
NewFileDescriptor.UseCreateFormStatements,
|
||||||
|
DisableAutoSize);
|
||||||
|
if DisableAutoSize and (NewUnitInfo.Component<>nil)
|
||||||
|
and (NewUnitInfo.Component is TControl) then
|
||||||
|
TControl(NewUnitInfo.Component).EnableAutoSizing;
|
||||||
end;
|
end;
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end;
|
end;
|
||||||
|
@ -169,12 +169,14 @@ type
|
|||||||
function CreateComponent(ParentCI: TIComponentInterface;
|
function CreateComponent(ParentCI: TIComponentInterface;
|
||||||
TypeClass: TComponentClass;
|
TypeClass: TComponentClass;
|
||||||
const AUnitName: shortstring;
|
const AUnitName: shortstring;
|
||||||
X,Y,W,H: Integer): TIComponentInterface; virtual; abstract;
|
X,Y,W,H: Integer;
|
||||||
|
DisableAutoSize: boolean): TIComponentInterface; virtual; abstract;
|
||||||
function CreateComponentFromStream(BinStream: TStream;
|
function CreateComponentFromStream(BinStream: TStream;
|
||||||
AncestorType: TComponentClass;
|
AncestorType: TComponentClass;
|
||||||
const NewUnitName: ShortString;
|
const NewUnitName: ShortString;
|
||||||
Interactive: boolean;
|
Interactive: boolean;
|
||||||
Visible: boolean = true;
|
Visible: boolean = true;
|
||||||
|
DisableAutoSize: boolean = false;
|
||||||
ContextObj: TObject = nil): TIComponentInterface; virtual; abstract;
|
ContextObj: TObject = nil): TIComponentInterface; virtual; abstract;
|
||||||
function CreateChildComponentFromStream(BinStream: TStream;
|
function CreateChildComponentFromStream(BinStream: TStream;
|
||||||
ComponentClass: TComponentClass;
|
ComponentClass: TComponentClass;
|
||||||
|
Loading…
Reference in New Issue
Block a user