diff --git a/converter/convertsettings.pas b/converter/convertsettings.pas index 134819647f..fed4c90c0e 100644 --- a/converter/convertsettings.pas +++ b/converter/convertsettings.pas @@ -433,7 +433,7 @@ begin MapReplacement('TApplicationEvents','TApplicationProperties'); MapReplacement('TPNGObject', 'TPortableNetworkGraphic'); MapReplacement('TTabbedNotebook', 'TPageControl'); - MapReplacement('TTabPage', 'ts$autoinc:TTabSheet'); + MapReplacement('TTabPage', 'ts$autoinc: TTabSheet'); MapReplacement('TQuery', 'TSQLQuery'); MapReplacement('TADOQuery', 'TSQLQuery'); // DevExpress components. diff --git a/converter/missingpropertiesdlg.pas b/converter/missingpropertiesdlg.pas index 7dbe78d4b8..66ccbcc551 100644 --- a/converter/missingpropertiesdlg.pas +++ b/converter/missingpropertiesdlg.pas @@ -260,6 +260,20 @@ function TLFMFixer.ReplaceAndRemoveAll: TModalResult; // Replace or remove properties and types based on values in grid. // Returns mrRetry if some types were changed and a new scan is needed, // mrOK if no types were changed, and mrCancel if there was an error. +var + AutoInc: integer; + + function SolveAutoInc(AIdent: string): string; + begin + if Pos('$autoinc', AIdent)>0 then begin + Inc(AutoInc); + Result:=StringReplace(AIdent, '$autoinc', IntToStr(AutoInc), [rfReplaceAll]); +// IDEMessagesWindow.AddMsg(Format('-- New Ident = "%s" --', [AIdent]),'',-1); + end + else + Result:=AIdent; + end; + var CurError: TLFMError; TheNode: TLFMTreeNode; @@ -273,6 +287,7 @@ var StartPos, EndPos: integer; begin Result:=mrOK; + AutoInc:=0; ChgEntryRepl:=TObjectList.Create; PropReplacements:=TStringToStringTree.Create(false); TypeReplacements:=TStringToStringTree.Create(false); @@ -289,7 +304,7 @@ begin // Object type ObjNode:=CurError.Node as TLFMObjectNode; OldIdent:=ObjNode.TypeName; - NewIdent:=TypeReplacements[OldIdent]; + NewIdent:=SolveAutoInc(TypeReplacements[OldIdent]); // Keep the old class name if no replacement. if NewIdent<>'' then begin StartPos:=ObjNode.TypeNamePosition; @@ -310,7 +325,7 @@ begin TheNode.FindIdentifier(StartPos,EndPos); if StartPos>0 then begin OldIdent:=copy(fLFMBuffer.Source,StartPos,EndPos-StartPos); - NewIdent:=PropReplacements[OldIdent]; + NewIdent:=SolveAutoInc(PropReplacements[OldIdent]); // Delete the whole property line if no replacement. if NewIdent='' then begin FindNiceNodeBounds(TheNode,StartPos,EndPos); @@ -326,10 +341,8 @@ begin CurError:=CurError.PrevError; end; // Apply replacements to LFM. - if not ApplyReplacements(ChgEntryRepl) then begin - Result:=mrCancel; - exit; - end; + if not ApplyReplacements(ChgEntryRepl) then + exit(mrCancel); // Apply replacement types also to pascal source. if TypeReplacements.Tree.Count>0 then if not CodeToolBoss.RetypeClassVariables(fPascalBuffer,