Converter: Improved messages, added Application.ProcessMessages to show them in real time.

git-svn-id: trunk@24544 -
This commit is contained in:
juha 2010-04-09 22:03:46 +00:00
parent 2a9ed589ac
commit cc4e4f5b3b
2 changed files with 13 additions and 1 deletions

View File

@ -490,6 +490,8 @@ begin
fUnitsToRemove:=TStringList.Create; fUnitsToRemove:=TStringList.Create;
fUnitsToRename:=TStringToStringTree.Create(false); fUnitsToRename:=TStringToStringTree.Create(false);
fUnitsToComment:=TStringList.Create; fUnitsToComment:=TStringList.Create;
IDEMessagesWindow.AddMsg('Converting unit file '+fOrigUnitFilename,'',-1);
Application.ProcessMessages;
ConvTool:=TConvDelphiCodeTool.Create(fPascalBuffer); ConvTool:=TConvDelphiCodeTool.Create(fPascalBuffer);
try try
fLFMBuffer:=nil; fLFMBuffer:=nil;
@ -521,7 +523,6 @@ begin
LfmFilename:=DfmFilename; } LfmFilename:=DfmFilename; }
// convert .dfm file to .lfm file (without context type checking) // convert .dfm file to .lfm file (without context type checking)
if FileExistsUTF8(LfmFilename) then begin if FileExistsUTF8(LfmFilename) then begin
IDEMessagesWindow.AddMsg('Converting DFM to LFM file '+LfmFilename,'',-1);
DFMConverter:=TDFMConverter.Create; DFMConverter:=TDFMConverter.Create;
try try
// Result:=ConvertDfmToLfm(LfmFilename); // Result:=ConvertDfmToLfm(LfmFilename);
@ -575,6 +576,8 @@ begin
if fLFMBuffer<>nil then begin if fLFMBuffer<>nil then begin
//!!! Result:=LoadCodeBuffer(fPascalBuffer,fLazUnitFilename, //!!! Result:=LoadCodeBuffer(fPascalBuffer,fLazUnitFilename,
//!!! [lbfCheckIfText,lbfUpdateFromDisk],true); //!!! [lbfCheckIfText,lbfUpdateFromDisk],true);
IDEMessagesWindow.AddMsg('Repairing form file '+fLFMBuffer.Filename,'',-1);
Application.ProcessMessages;
LfmFixer:=TLFMFixer.Create(fPascalBuffer,fLFMBuffer,@IDEMessagesWindow.AddMsg); LfmFixer:=TLFMFixer.Create(fPascalBuffer,fLFMBuffer,@IDEMessagesWindow.AddMsg);
try try
LfmFixer.Settings:=fSettings; LfmFixer.Settings:=fSettings;
@ -702,6 +705,7 @@ begin
end; end;
end; end;
IDEMessagesWindow.AddMsg('Error="'+CodeToolBoss.ErrorMessage+'"', '', -1); IDEMessagesWindow.AddMsg('Error="'+CodeToolBoss.ErrorMessage+'"', '', -1);
Application.ProcessMessages;
exit; exit;
end; end;
finally finally
@ -722,6 +726,7 @@ begin
CTResult:=CodeToolBoss.FindMissingUnits(fPascalBuffer,fMissingUnits,true); CTResult:=CodeToolBoss.FindMissingUnits(fPascalBuffer,fMissingUnits,true);
if not CTResult then begin if not CTResult then begin
IDEMessagesWindow.AddMsg('Error="'+CodeToolBoss.ErrorMessage+'"','',-1); IDEMessagesWindow.AddMsg('Error="'+CodeToolBoss.ErrorMessage+'"','',-1);
Application.ProcessMessages;
exit; exit;
end; end;
// no missing units -> good // no missing units -> good
@ -755,6 +760,7 @@ begin
// add error messages, so the user can click on them // add error messages, so the user can click on them
for i:=0 to fMissingUnits.Count-1 do for i:=0 to fMissingUnits.Count-1 do
IDEMessagesWindow.AddMsg(MissingUnitToMsg(fMissingUnits[i]),'',-1); IDEMessagesWindow.AddMsg(MissingUnitToMsg(fMissingUnits[i]),'',-1);
Application.ProcessMessages;
finally finally
fMissingUnits.Free; fMissingUnits.Free;
end; end;
@ -868,6 +874,7 @@ var
i: Integer; i: Integer;
begin begin
IDEMessagesWindow.AddMsg('Converting form files...','',-1); IDEMessagesWindow.AddMsg('Converting form files...','',-1);
Application.ProcessMessages;
Screen.Cursor:=crHourGlass; Screen.Cursor:=crHourGlass;
try try
for i:=0 to ConverterList.Count-1 do begin for i:=0 to ConverterList.Count-1 do begin
@ -1246,6 +1253,7 @@ begin
NormalUnits:=nil; NormalUnits:=nil;
try try
IDEMessagesWindow.AddMsg('Find all unit files...','',-1); IDEMessagesWindow.AddMsg('Find all unit files...','',-1);
Application.ProcessMessages;
if not CodeToolBoss.FindDelphiProjectUnits(fMainUnitConverter.fPascalBuffer, if not CodeToolBoss.FindDelphiProjectUnits(fMainUnitConverter.fPascalBuffer,
FoundInUnits, MissingInUnits, NormalUnits) then FoundInUnits, MissingInUnits, NormalUnits) then
begin begin
@ -1352,6 +1360,7 @@ begin
try try
// convert all units and fix .lfm files // convert all units and fix .lfm files
IDEMessagesWindow.AddMsg('Converting unit files...','',-1); IDEMessagesWindow.AddMsg('Converting unit files...','',-1);
Application.ProcessMessages;
for i:=0 to LazProject.UnitCount-1 do begin for i:=0 to LazProject.UnitCount-1 do begin
CurUnitInfo:=LazProject.Units[i]; CurUnitInfo:=LazProject.Units[i];
// Main LPR file was converted earlier. // Main LPR file was converted earlier.
@ -1507,6 +1516,7 @@ begin
try try
// convert all units and fix .lfm files // convert all units and fix .lfm files
IDEMessagesWindow.AddMsg('Converting unit files...','',-1); IDEMessagesWindow.AddMsg('Converting unit files...','',-1);
Application.ProcessMessages;
for i:=0 to LazPackage.FileCount-1 do begin for i:=0 to LazPackage.FileCount-1 do begin
PkgFile:=LazPackage.Files[i]; PkgFile:=LazPackage.Files[i];
Converter:=TConvertDelphiUnit.Create(Self, PkgFile.Filename, Converter:=TConvertDelphiUnit.Create(Self, PkgFile.Filename,

View File

@ -440,6 +440,7 @@ begin
+' Error: ' +' Error: '
+ErrorMessage; +ErrorMessage;
fOnOutput(Msg,Dir,-1,nil); fOnOutput(Msg,Dir,-1,nil);
Application.ProcessMessages;
end; end;
procedure TLFMChecker.WriteCodeToolsError; procedure TLFMChecker.WriteCodeToolsError;
@ -467,6 +468,7 @@ begin
fOnOutput(Msg,Dir,-1,nil); fOnOutput(Msg,Dir,-1,nil);
CurError:=CurError.NextError; CurError:=CurError.NextError;
end; end;
Application.ProcessMessages;
end; end;
function TLFMChecker.FixMissingComponentClasses: TModalResult; function TLFMChecker.FixMissingComponentClasses: TModalResult;