Converter: Search package and unit for missing component class only for project and package conversion. Issue #24527

git-svn-id: trunk@41730 -
This commit is contained in:
juha 2013-06-16 13:30:54 +00:00
parent 51a7ea5e7a
commit 0f05e34b89
2 changed files with 7 additions and 1 deletions

View File

@ -674,6 +674,8 @@ begin
LfmFixer.RootMustBeClassInUnit:=true; LfmFixer.RootMustBeClassInUnit:=true;
LfmFixer.RootMustBeClassInIntf:=true; LfmFixer.RootMustBeClassInIntf:=true;
LfmFixer.ObjectsMustExist:=true; LfmFixer.ObjectsMustExist:=true;
// Package dependencies will be there only for projects and packages.
LfmFixer.TryAddingUsedUnits:=fOwnerConverter is TConvertDelphiProjPack;
if LfmFixer.ConvertAndRepair<>mrOK then begin if LfmFixer.ConvertAndRepair<>mrOK then begin
LazarusIDE.DoJumpToCompilerMessage(-1,true); LazarusIDE.DoJumpToCompilerMessage(-1,true);
fOwnerConverter.fErrorMsg:='Problems when repairing form file ' fOwnerConverter.fErrorMsg:='Problems when repairing form file '

View File

@ -73,6 +73,7 @@ type
fCTLink: TCodeToolLink; fCTLink: TCodeToolLink;
fSettings: TConvertSettings; fSettings: TConvertSettings;
fUsedUnitsTool: TUsedUnitsTool; fUsedUnitsTool: TUsedUnitsTool;
fTryAddingUsedUnits: Boolean;
// List of property values which need to be adjusted. // List of property values which need to be adjusted.
fHasMissingProperties: Boolean; // LFM file has unknown properties. fHasMissingProperties: Boolean; // LFM file has unknown properties.
fHasMissingObjectTypes: Boolean; // LFM file has unknown object types. fHasMissingObjectTypes: Boolean; // LFM file has unknown object types.
@ -96,6 +97,7 @@ type
public public
property Settings: TConvertSettings read fSettings write fSettings; property Settings: TConvertSettings read fSettings write fSettings;
property UsedUnitsTool: TUsedUnitsTool read fUsedUnitsTool write fUsedUnitsTool; property UsedUnitsTool: TUsedUnitsTool read fUsedUnitsTool write fUsedUnitsTool;
property TryAddingUsedUnits: Boolean read fTryAddingUsedUnits write fTryAddingUsedUnits;
end; end;
@ -541,7 +543,9 @@ begin
if not fLFMTree.ParseIfNeeded then if not fLFMTree.ParseIfNeeded then
Exit(mrCancel); Exit(mrCancel);
if CodeToolBoss.CheckLFM(fPascalBuffer, fLFMBuffer, fLFMTree, if CodeToolBoss.CheckLFM(fPascalBuffer, fLFMBuffer, fLFMTree,
fRootMustBeClassInUnit, fRootMustBeClassInIntf, fObjectsMustExist) then fRootMustBeClassInUnit, fRootMustBeClassInIntf, fObjectsMustExist)
or not fTryAddingUsedUnits
then
Result:=mrOk Result:=mrOk
else begin else begin
Result:=FindAndFixMissingComponentClasses; // Can return mrRetry. Result:=FindAndFixMissingComponentClasses; // Can return mrRetry.