IDE: Rename FindComponentClass -> SearchComponentClass to differentiate from other functions with the same name.

This commit is contained in:
Juha 2021-11-26 21:16:42 +02:00
parent ba91c73a64
commit 1c6662a681

View File

@ -288,7 +288,7 @@ function SaveEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean;
function LoadAncestorDependencyHidden(AnUnitInfo: TUnitInfo; function LoadAncestorDependencyHidden(AnUnitInfo: TUnitInfo;
const aComponentClassName: string; OpenFlags: TOpenFlags; const aComponentClassName: string; OpenFlags: TOpenFlags;
out AncestorClass: TComponentClass; out AncestorUnitInfo: TUnitInfo): TModalResult; out AncestorClass: TComponentClass; out AncestorUnitInfo: TUnitInfo): TModalResult;
// function FindComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string; // function SearchComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
// Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass; // Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass;
// out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult; // out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult;
function LoadComponentDependencyHidden(AnUnitInfo: TUnitInfo; function LoadComponentDependencyHidden(AnUnitInfo: TUnitInfo;
@ -6065,11 +6065,7 @@ begin
NestedUnitInfo:=nil; NestedUnitInfo:=nil;
Result:=LoadComponentDependencyHidden(AnUnitInfo,NestedClassName, Result:=LoadComponentDependencyHidden(AnUnitInfo,NestedClassName,
OpenFlags, OpenFlags,
{$IFDEF EnableNestedComponentsWithoutLFM} {$IFDEF EnableNestedComponentsWithoutLFM}false,{$ELSE}true,{$ENDIF}
false,
{$ELSE}
true,
{$ENDIF}
NestedClass,NestedUnitInfo,AncestorClass); NestedClass,NestedUnitInfo,AncestorClass);
if Result<>mrOk then begin if Result<>mrOk then begin
DebugLn(['LoadLFM DoLoadComponentDependencyHidden NestedClassName=',NestedClassName,' failed for ',AnUnitInfo.Filename]); DebugLn(['LoadLFM DoLoadComponentDependencyHidden NestedClassName=',NestedClassName,' failed for ',AnUnitInfo.Filename]);
@ -6518,7 +6514,7 @@ begin
Result:=mrOk; Result:=mrOk;
end; end;
function FindComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string; function SearchComponentClass(AnUnitInfo: TUnitInfo; const AComponentClassName: string;
Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass; Quiet: boolean; out ComponentUnitInfo: TUnitInfo; out AComponentClass: TComponentClass;
out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult; out LFMFilename: string; out AncestorClass: TComponentClass): TModalResult;
{ Possible results: { Possible results:
@ -6575,7 +6571,7 @@ var
CurUnitInfo:=Project1.UnitInfoWithFilename(UnitFilename); CurUnitInfo:=Project1.UnitInfoWithFilename(UnitFilename);
if (CurUnitInfo=nil) or (CurUnitInfo.Component=nil) then exit; if (CurUnitInfo=nil) or (CurUnitInfo.Component=nil) then exit;
// unit with loaded component found -> check if it is the right one // unit with loaded component found -> check if it is the right one
//DebugLn(['FindComponentClass unit with a component found CurUnitInfo=',CurUnitInfo.Filename,' ',dbgsName(CurUnitInfo.Component)]); //DebugLn(['SearchComponentClass unit with a component found CurUnitInfo=',CurUnitInfo.Filename,' ',dbgsName(CurUnitInfo.Component)]);
if SysUtils.CompareText(CurUnitInfo.Component.ClassName,AComponentClassName)<>0 if SysUtils.CompareText(CurUnitInfo.Component.ClassName,AComponentClassName)<>0
then exit; then exit;
// component found (it was already loaded) // component found (it was already loaded)
@ -6608,7 +6604,7 @@ var
if FoundComponentClass=nil then if FoundComponentClass=nil then
FoundComponentClass:=FormEditor1.FindDesignerBaseClassByName(aClassName,true); FoundComponentClass:=FormEditor1.FindDesignerBaseClassByName(aClassName,true);
if FoundComponentClass<>nil then begin if FoundComponentClass<>nil then begin
DebugLn(['FindComponentClass.TryRegisteredClasses found: ',FoundComponentClass.ClassName]); DebugLn(['SearchComponentClass.TryRegisteredClasses found: ',FoundComponentClass.ClassName]);
TheModalResult:=mrOk; TheModalResult:=mrOk;
Result:=true; Result:=true;
end; end;
@ -6654,7 +6650,7 @@ var
TheModalResult:=LoadCodeBuffer(LFMCode,CurLFMFilename,[lbfCheckIfText],true); TheModalResult:=LoadCodeBuffer(LFMCode,CurLFMFilename,[lbfCheckIfText],true);
if TheModalResult<>mrOk then if TheModalResult<>mrOk then
begin begin
debugln('FindComponentClass Failed loading ',CurLFMFilename); DebugLn('SearchComponentClass Failed loading ',CurLFMFilename);
exit; exit;
end; end;
// read the LFM classname // read the LFM classname
@ -6736,7 +6732,7 @@ var
// parse interface current unit // parse interface current unit
Code:=CodeToolBoss.LoadFile(AnUnitInfo.Filename,false,false); Code:=CodeToolBoss.LoadFile(AnUnitInfo.Filename,false,false);
if Code=nil then begin if Code=nil then begin
debugln(['FindComponentClass unable to load ',AnUnitInfo.Filename]); DebugLn(['SearchComponentClass unable to load ',AnUnitInfo.Filename]);
exit; exit;
end; end;
if not CodeToolBoss.Explore(Code,Tool,false,true) then begin if not CodeToolBoss.Explore(Code,Tool,false,true) then begin
@ -6756,7 +6752,7 @@ var
Node:=Tool.Tree.Root; Node:=Tool.Tree.Root;
Node:=FindTypeNode(Node,0); Node:=FindTypeNode(Node,0);
if Node=nil then begin if Node=nil then begin
debugln('FindComponentClass Failed finding reference of ',AComponentClassName,' in ',Code.Filename); DebugLn('SearchComponentClass Failed finding reference of ',AComponentClassName,' in ',Code.Filename);
exit; exit;
end; end;
if Node.Desc=ctnIdentifier then begin if Node.Desc=ctnIdentifier then begin
@ -6768,7 +6764,7 @@ var
fdfIgnoreCurContextNode]; fdfIgnoreCurContextNode];
Params.SetIdentifier(Tool,@Tool.Src[Node.StartPos],nil); Params.SetIdentifier(Tool,@Tool.Src[Node.StartPos],nil);
if not Tool.FindIdentifierInContext(Params) then begin if not Tool.FindIdentifierInContext(Params) then begin
debugln(['FindComponentClass find declaration failed at ',Tool.CleanPosToStr(Node.StartPos,true)]); DebugLn(['SearchComponentClass find declaration failed at ',Tool.CleanPosToStr(Node.StartPos,true)]);
exit; exit;
end; end;
NewNode:=Params.NewNode; NewNode:=Params.NewNode;
@ -6794,7 +6790,7 @@ var
if (NewNode.Desc<>ctnTypeDefinition) if (NewNode.Desc<>ctnTypeDefinition)
or (ClassNode=nil) or (ClassNode.Desc<>ctnClass) then or (ClassNode=nil) or (ClassNode.Desc<>ctnClass) then
begin begin
debugln(['FindComponentClass ',AComponentClassName,' is not a class at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]); DebugLn(['SearchComponentClass ',AComponentClassName,' is not a class at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
exit; exit;
end; end;
// find inheritance list // find inheritance list
@ -6802,7 +6798,7 @@ var
while (InheritedNode<>nil) and (InheritedNode.Desc<>ctnClassInheritance) do while (InheritedNode<>nil) and (InheritedNode.Desc<>ctnClassInheritance) do
InheritedNode:=InheritedNode.NextBrother; InheritedNode:=InheritedNode.NextBrother;
if (InheritedNode=nil) or (InheritedNode.FirstChild=nil) then begin if (InheritedNode=nil) or (InheritedNode.FirstChild=nil) then begin
debugln(['FindComponentClass ',AComponentClassName,' is not a TComponent at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]); DebugLn(['SearchComponentClass ',AComponentClassName,' is not a TComponent at ',NewTool.CleanPosToStr(NewNode.StartPos,true)]);
exit; exit;
end; end;
StoreComponentClassDeclaration(NewTool.MainFilename); StoreComponentClassDeclaration(NewTool.MainFilename);
@ -6849,7 +6845,7 @@ var
end; end;
Code:=CodeToolBoss.LoadFile(UnitFilename,true,false); Code:=CodeToolBoss.LoadFile(UnitFilename,true,false);
if Code=nil then begin if Code=nil then begin
debugln(['FindComponentClass unable to load ',AnUnitInfo.Filename]); DebugLn(['SearchComponentClass unable to load ',AnUnitInfo.Filename]);
exit; exit;
end; end;
if not CodeToolBoss.FindFormAncestor(Code,AComponentClassName,AncestorClassName,true) then if not CodeToolBoss.FindFormAncestor(Code,AComponentClassName,AncestorClassName,true) then
@ -6887,13 +6883,13 @@ begin
if not IsValidIdent(AComponentClassName) then if not IsValidIdent(AComponentClassName) then
begin begin
DebugLn(['FindComponentClass invalid component class name "',AComponentClassName,'"']); DebugLn(['SearchComponentClass invalid component class name "',AComponentClassName,'"']);
exit(mrCancel); exit(mrCancel);
end; end;
// search component lfm // search component lfm
{$ifdef VerboseFormEditor} {$ifdef VerboseFormEditor}
debugln('FindComponentClass START ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName); DebugLn('SearchComponentClass START ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName);
{$endif} {$endif}
// first search the resource of AnUnitInfo // first search the resource of AnUnitInfo
if AnUnitInfo<>nil then begin if AnUnitInfo<>nil then begin
@ -6914,7 +6910,7 @@ begin
{$IFDEF VerboseLFMSearch} {$IFDEF VerboseLFMSearch}
if (UsedUnitFilenames=nil) or (UsedUnitFilenames.Count=0) then if (UsedUnitFilenames=nil) or (UsedUnitFilenames.Count=0) then
debugln(['FindComponentClass unit has no main uses']); DebugLn(['SearchComponentClass unit has no main uses']);
{$ENDIF} {$ENDIF}
if (UsedUnitFilenames<>nil) then begin if (UsedUnitFilenames<>nil) then begin
@ -7056,7 +7052,7 @@ begin
Quiet:=([ofProjectLoading,ofQuiet]*Flags<>[]); Quiet:=([ofProjectLoading,ofQuiet]*Flags<>[]);
HideAbort:=not (ofProjectLoading in Flags); HideAbort:=not (ofProjectLoading in Flags);
{ Will be checked in FindComponentClass() { Will be checked in SearchComponentClass()
if not IsValidIdent(AComponentClassName) then if not IsValidIdent(AComponentClassName) then
begin begin
DebugLn(['LoadComponentDependencyHidden invalid component class name "',AComponentClassName,'"']); DebugLn(['LoadComponentDependencyHidden invalid component class name "',AComponentClassName,'"']);
@ -7079,7 +7075,7 @@ begin
debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName, debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName,
' AComponentClass=',dbgsName(AComponentClass)); ' AComponentClass=',dbgsName(AComponentClass));
{$endif} {$endif}
Result:=FindComponentClass(AnUnitInfo,AComponentClassName,Quiet, Result:=SearchComponentClass(AnUnitInfo,AComponentClassName,Quiet,
ComponentUnitInfo,AComponentClass,LFMFilename,AncestorClass); ComponentUnitInfo,AComponentClass,LFMFilename,AncestorClass);
{ $if defined(VerboseFormEditor) or defined(VerboseLFMSearch)} { $if defined(VerboseFormEditor) or defined(VerboseLFMSearch)}
debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName, debugln('LoadComponentDependencyHidden ',AnUnitInfo.Filename,' AComponentClassName=',AComponentClassName,