mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 18:39:52 +02:00
IDE: fixed not adding CreateForm statement if main project file does not support it
git-svn-id: trunk@10537 -
This commit is contained in:
parent
40a100496d
commit
a4579a8ef6
@ -442,7 +442,7 @@ begin
|
|||||||
Result:=Result+' UnitName="'+TypeData^.UnitName+'"';
|
Result:=Result+' UnitName="'+TypeData^.UnitName+'"';
|
||||||
|
|
||||||
// skip unitname
|
// skip unitname
|
||||||
PropInfo:=PPropInfo(@TypeData^.UnitName+Length(TypeData^.UnitName)+1);
|
PropInfo:=PPropInfo(PByte(@TypeData^.UnitName)+Length(TypeData^.UnitName)+1);
|
||||||
// read property count
|
// read property count
|
||||||
CurCount:=PWord(PropInfo)^;
|
CurCount:=PWord(PropInfo)^;
|
||||||
Result:=Result+' CurPropCnt='+IntToStr(CurCount);
|
Result:=Result+' CurPropCnt='+IntToStr(CurCount);
|
||||||
@ -490,7 +490,7 @@ begin
|
|||||||
Result := Result + IntToStr(i)
|
Result := Result + IntToStr(i)
|
||||||
+ ':Name="' + FieldInfo^.Name + '"'
|
+ ':Name="' + FieldInfo^.Name + '"'
|
||||||
+ ':Offset=' +IntToStr(FieldInfo^.FieldOffset);
|
+ ':Offset=' +IntToStr(FieldInfo^.FieldOffset);
|
||||||
FieldInfo := PFieldInfo(@FieldInfo^.Name + 1 + Length(FieldInfo^.Name));
|
FieldInfo := PFieldInfo(PByte(@FieldInfo^.Name) + 1 + Length(FieldInfo^.Name));
|
||||||
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
FieldInfo := Align(FieldInfo, SizeOf(Pointer));
|
FieldInfo := Align(FieldInfo, SizeOf(Pointer));
|
||||||
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
@ -512,7 +512,7 @@ end;
|
|||||||
|
|
||||||
function GetTypeDataPropCountAddr(TypeData: PTypeData): PWord;
|
function GetTypeDataPropCountAddr(TypeData: PTypeData): PWord;
|
||||||
begin
|
begin
|
||||||
Result:=PWord(@(TypeData^.UnitName)+Length(TypeData^.UnitName)+1);
|
Result:=PWord(PByte(@(TypeData^.UnitName)+Length(TypeData^.UnitName)+1));
|
||||||
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
|
||||||
Result := Align(Result, SizeOf(Pointer));
|
Result := Align(Result, SizeOf(Pointer));
|
||||||
{$endif}
|
{$endif}
|
||||||
|
@ -1096,9 +1096,9 @@ const
|
|||||||
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
|
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
|
||||||
itNone, itNone, itNone, itDebugger, itDebugger, itDebugger, itDebugger
|
itNone, itNone, itNone, itDebugger, itDebugger, itDebugger, itDebugger
|
||||||
);
|
);
|
||||||
STATENAME: array[TDBGState] of string = (
|
//STATENAME: array[TDBGState] of string = (
|
||||||
'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
|
// 'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
|
||||||
);
|
//);
|
||||||
var
|
var
|
||||||
Editor: TSourceEditor;
|
Editor: TSourceEditor;
|
||||||
begin
|
begin
|
||||||
|
@ -3854,7 +3854,8 @@ begin
|
|||||||
|
|
||||||
NewUnitInfo.ComponentName:=NewComponent.Name;
|
NewUnitInfo.ComponentName:=NewComponent.Name;
|
||||||
NewUnitInfo.ComponentResourceName:=NewUnitInfo.ComponentName;
|
NewUnitInfo.ComponentResourceName:=NewUnitInfo.ComponentName;
|
||||||
if NewUnitInfo.IsPartOfProject and Project1.AutoCreateForms then begin
|
if NewUnitInfo.IsPartOfProject and Project1.AutoCreateForms
|
||||||
|
and (pfMainUnitHasCreateFormStatements in Project1.Flags) then begin
|
||||||
Project1.AddCreateFormToProjectFile(NewComponent.ClassName,
|
Project1.AddCreateFormToProjectFile(NewComponent.ClassName,
|
||||||
NewComponent.Name);
|
NewComponent.Name);
|
||||||
end;
|
end;
|
||||||
|
@ -2578,12 +2578,16 @@ end;
|
|||||||
function TProject.AddCreateFormToProjectFile(
|
function TProject.AddCreateFormToProjectFile(
|
||||||
const AClassName, AName: string):boolean;
|
const AClassName, AName: string):boolean;
|
||||||
begin
|
begin
|
||||||
|
if (pfMainUnitHasCreateFormStatements in Project1.Flags) then begin
|
||||||
Result:=CodeToolBoss.AddCreateFormStatement(MainUnitInfo.Source,
|
Result:=CodeToolBoss.AddCreateFormStatement(MainUnitInfo.Source,
|
||||||
AClassName,AName);
|
AClassName,AName);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
Modified:=true;
|
Modified:=true;
|
||||||
MainUnitInfo.Modified:=true;
|
MainUnitInfo.Modified:=true;
|
||||||
end;
|
end;
|
||||||
|
end else begin
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TProject.RemoveCreateFormFromProjectFile(
|
function TProject.RemoveCreateFormFromProjectFile(
|
||||||
|
@ -1960,6 +1960,8 @@ type
|
|||||||
function GetLastSubNode: TTreeNode; // absolute last node
|
function GetLastSubNode: TTreeNode; // absolute last node
|
||||||
function GetLastExpandedSubNode: TTreeNode; // absolute last node
|
function GetLastExpandedSubNode: TTreeNode; // absolute last node
|
||||||
function FindTopLvlNode(const NodeText: string): TTreeNode;
|
function FindTopLvlNode(const NodeText: string): TTreeNode;
|
||||||
|
function FindNodeWithText(const NodeText: string): TTreeNode;
|
||||||
|
function FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
||||||
function Insert(NextNode: TTreeNode; const S: string): TTreeNode;
|
function Insert(NextNode: TTreeNode; const S: string): TTreeNode;
|
||||||
function InsertObject(NextNode: TTreeNode; const S: string;
|
function InsertObject(NextNode: TTreeNode; const S: string;
|
||||||
Data: Pointer): TTreeNode;
|
Data: Pointer): TTreeNode;
|
||||||
|
@ -1942,6 +1942,20 @@ begin
|
|||||||
Result:=Result.GetNextSibling;
|
Result:=Result.GetNextSibling;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TTreeNodes.FindNodeWithText(const NodeText: string): TTreeNode;
|
||||||
|
begin
|
||||||
|
Result:=GetFirstNode;
|
||||||
|
while (Result<>nil) and (Result.Text<>NodeText) do
|
||||||
|
Result:=Result.GetNext;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TTreeNodes.FindNodeWithData(const NodeData: Pointer): TTreeNode;
|
||||||
|
begin
|
||||||
|
Result:=GetFirstNode;
|
||||||
|
while (Result<>nil) and (Result.Data<>NodeData) do
|
||||||
|
Result:=Result.GetNext;
|
||||||
|
end;
|
||||||
|
|
||||||
function TTreeNodes.GetNodeFromIndex(Index: Integer): TTreeNode;
|
function TTreeNodes.GetNodeFromIndex(Index: Integer): TTreeNode;
|
||||||
// find node with absolute index in ALL nodes (even collapsed)
|
// find node with absolute index in ALL nodes (even collapsed)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user