IDE: fixed not adding CreateForm statement if main project file does not support it

git-svn-id: trunk@10537 -
This commit is contained in:
mattias 2007-01-30 10:02:18 +00:00
parent 40a100496d
commit a4579a8ef6
6 changed files with 33 additions and 12 deletions

View File

@ -442,7 +442,7 @@ begin
Result:=Result+' UnitName="'+TypeData^.UnitName+'"';
// skip unitname
PropInfo:=PPropInfo(@TypeData^.UnitName+Length(TypeData^.UnitName)+1);
PropInfo:=PPropInfo(PByte(@TypeData^.UnitName)+Length(TypeData^.UnitName)+1);
// read property count
CurCount:=PWord(PropInfo)^;
Result:=Result+' CurPropCnt='+IntToStr(CurCount);
@ -490,7 +490,7 @@ begin
Result := Result + IntToStr(i)
+ ':Name="' + FieldInfo^.Name + '"'
+ ':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}
FieldInfo := Align(FieldInfo, SizeOf(Pointer));
{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
@ -512,7 +512,7 @@ end;
function GetTypeDataPropCountAddr(TypeData: PTypeData): PWord;
begin
Result:=PWord(@(TypeData^.UnitName)+Length(TypeData^.UnitName)+1);
Result:=PWord(PByte(@(TypeData^.UnitName)+Length(TypeData^.UnitName)+1));
{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
Result := Align(Result, SizeOf(Pointer));
{$endif}

View File

@ -1096,9 +1096,9 @@ const
// dsNone, dsIdle, dsStop, dsPause, dsInit, dsRun, dsError
itNone, itNone, itNone, itDebugger, itDebugger, itDebugger, itDebugger
);
STATENAME: array[TDBGState] of string = (
'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
);
//STATENAME: array[TDBGState] of string = (
// 'dsNone', 'dsIdle', 'dsStop', 'dsPause', 'dsInit', 'dsRun', 'dsError'
//);
var
Editor: TSourceEditor;
begin

View File

@ -3854,7 +3854,8 @@ begin
NewUnitInfo.ComponentName:=NewComponent.Name;
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,
NewComponent.Name);
end;

View File

@ -2578,11 +2578,15 @@ end;
function TProject.AddCreateFormToProjectFile(
const AClassName, AName: string):boolean;
begin
Result:=CodeToolBoss.AddCreateFormStatement(MainUnitInfo.Source,
AClassName,AName);
if Result then begin
Modified:=true;
MainUnitInfo.Modified:=true;
if (pfMainUnitHasCreateFormStatements in Project1.Flags) then begin
Result:=CodeToolBoss.AddCreateFormStatement(MainUnitInfo.Source,
AClassName,AName);
if Result then begin
Modified:=true;
MainUnitInfo.Modified:=true;
end;
end else begin
Result:=false;
end;
end;

View File

@ -1960,6 +1960,8 @@ type
function GetLastSubNode: TTreeNode; // absolute last node
function GetLastExpandedSubNode: TTreeNode; // absolute last node
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 InsertObject(NextNode: TTreeNode; const S: string;
Data: Pointer): TTreeNode;

View File

@ -1942,6 +1942,20 @@ begin
Result:=Result.GetNextSibling;
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;
// find node with absolute index in ALL nodes (even collapsed)