mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-22 18:22:57 +02:00
IDE, Codetools: Simplify LoadAncestorDependencyHidden. Use "out" parameter when appropriate.
git-svn-id: trunk@64762 -
This commit is contained in:
parent
4ec7483328
commit
2fa9987008
@ -819,7 +819,7 @@ type
|
||||
const OldFormName, OldFormClassName: string;
|
||||
const NewFormName, NewFormClassName: string): boolean;
|
||||
function FindFormAncestor(Code: TCodeBuffer; const FormClassName: string;
|
||||
var AncestorClassName: string; DirtySearch: boolean): boolean;
|
||||
out AncestorClassName: string; DirtySearch: boolean): boolean;
|
||||
|
||||
// form components
|
||||
function CompleteComponent(Code: TCodeBuffer;
|
||||
@ -5698,7 +5698,7 @@ begin
|
||||
end;
|
||||
|
||||
function TCodeToolManager.FindFormAncestor(Code: TCodeBuffer;
|
||||
const FormClassName: string; var AncestorClassName: string;
|
||||
const FormClassName: string; out AncestorClassName: string;
|
||||
DirtySearch: boolean): boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
|
@ -220,7 +220,7 @@ type
|
||||
const NewFormName, NewFormClassName: string;
|
||||
SourceChangeCache: TSourceChangeCache): boolean;
|
||||
function FindFormAncestor(const AClassName: string;
|
||||
var AncestorClassName: string): boolean;
|
||||
out AncestorClassName: string): boolean;
|
||||
|
||||
// published variables
|
||||
function FindPublishedVariable(const AClassName, AVarName: string;
|
||||
@ -3097,7 +3097,7 @@ begin
|
||||
end;
|
||||
|
||||
function TStandardCodeTool.FindFormAncestor(const AClassName: string;
|
||||
var AncestorClassName: string): boolean;
|
||||
out AncestorClassName: string): boolean;
|
||||
var
|
||||
ClassNode: TCodeTreeNode;
|
||||
begin
|
||||
|
@ -6446,29 +6446,28 @@ begin
|
||||
if AComponentClass<>nil then
|
||||
exit(true);
|
||||
end;
|
||||
if AComponentClassName<>'' then begin
|
||||
if (DescendantClassName<>'')
|
||||
and (SysUtils.CompareText(AComponentClassName,'TCustomForm')=0) then begin
|
||||
// this is a common user mistake
|
||||
IDEMessageDialog(lisCodeTemplError,
|
||||
Format(lisTheResourceClassDescendsFromProbablyThisIsATypoFor,
|
||||
[DescendantClassName, AComponentClassName]),
|
||||
mtError,[mbCancel]);
|
||||
Result:=false;
|
||||
exit;
|
||||
end else if (DescendantClassName<>'')
|
||||
and (SysUtils.CompareText(AComponentClassName,'TComponent')=0) then begin
|
||||
// this is not yet implemented
|
||||
IDEMessageDialog(lisCodeTemplError,
|
||||
Format(lisUnableToOpenDesignerTheClassDoesNotDescendFromADes,
|
||||
[LineEnding, DescendantClassName]),
|
||||
mtError,[mbCancel]);
|
||||
Result:=false;
|
||||
exit;
|
||||
end else begin
|
||||
// search in the registered base classes
|
||||
AComponentClass:=FormEditor1.FindDesignerBaseClassByName(AComponentClassName,true);
|
||||
if AComponentClassName<>'' then
|
||||
begin
|
||||
if DescendantClassName<>'' then begin
|
||||
if CompareText(AComponentClassName,'TCustomForm')=0 then begin
|
||||
// this is a common user mistake
|
||||
IDEMessageDialog(lisCodeTemplError,
|
||||
Format(lisTheResourceClassDescendsFromProbablyThisIsATypoFor,
|
||||
[DescendantClassName, AComponentClassName]),
|
||||
mtError,[mbCancel]);
|
||||
exit(false);
|
||||
end
|
||||
else if CompareText(AComponentClassName,'TComponent')=0 then begin
|
||||
// this is not yet implemented
|
||||
IDEMessageDialog(lisCodeTemplError,
|
||||
Format(lisUnableToOpenDesignerTheClassDoesNotDescendFromADes,
|
||||
[LineEnding, DescendantClassName]),
|
||||
mtError,[mbCancel]);
|
||||
exit(false);
|
||||
end;
|
||||
end;
|
||||
// search in the registered base classes
|
||||
AComponentClass:=FormEditor1.FindDesignerBaseClassByName(AComponentClassName,true);
|
||||
end else begin
|
||||
// default is TForm
|
||||
AComponentClass:=BaseFormEditor1.StandardDesignerBaseClasses[DesignerBaseClassId_TForm];
|
||||
@ -6863,7 +6862,6 @@ var
|
||||
{$ENDIF}
|
||||
exit;
|
||||
end;
|
||||
AncestorClassName:='';
|
||||
Code:=CodeToolBoss.LoadFile(UnitFilename,true,false);
|
||||
if Code=nil then begin
|
||||
debugln(['FindComponentClass unable to load ',AnUnitInfo.Filename]);
|
||||
|
@ -2076,14 +2076,14 @@ begin
|
||||
- LFMComponentName is the second word
|
||||
- LFMClassName is the fourth token
|
||||
}
|
||||
|
||||
|
||||
// read first word => LFMType
|
||||
p:=1;
|
||||
while (p<=length(LFMSource))
|
||||
and (LFMSource[p] in ['a'..'z','A'..'Z','0'..'9','_']) do
|
||||
inc(p);
|
||||
LFMType:=copy(LFMSource,1,p-1);
|
||||
|
||||
|
||||
// read second word => LFMComponentName
|
||||
while (p<=length(LFMSource)) and (LFMSource[p] in [' ',#9]) do inc(p);
|
||||
StartPos:=p;
|
||||
|
Loading…
Reference in New Issue
Block a user