IDE: fixed TUnitInfo.Modified:=false, bug #22096

git-svn-id: trunk@37401 -
This commit is contained in:
mattias 2012-05-23 12:07:03 +00:00
parent a5f8d500a6
commit fecde4484b
3 changed files with 43 additions and 20 deletions

View File

@ -58,6 +58,7 @@ type
// modified
procedure GatherModifiedProject(AProject: TProject; sl: TStrings);
procedure GatherModifiedPackages(sl: TStrings);
procedure GatherModifiedSourceEditor(sl: TStrings);
// help
procedure GatherHelpDatabases(sl: TStrings);
procedure GatherHelpViewers(sl: TStrings);
@ -311,6 +312,26 @@ begin
sl.Add('');
end;
procedure TIDEInfoDialog.GatherModifiedSourceEditor(sl: TStrings);
var
HeaderWritten: Boolean;
i: Integer;
SrcEdit: TSourceEditor;
begin
HeaderWritten:=false;
if SourceEditorManager.SomethingModified(false) then begin
sl.Add('Source Editor:');
for i:=0 to SourceEditorManager.SourceEditorCount-1 do
begin
SrcEdit:=SourceEditorManager.SourceEditors[i];
if not SrcEdit.Modified then continue;
sl.Add(' '+SrcEdit.Filename+' Component='+dbgs(SrcEdit.EditorComponent.Modified));
end;
end;
if HeaderWritten then
sl.Add('');
end;
procedure TIDEInfoDialog.GatherHelpDatabases(sl: TStrings);
var
i: Integer;
@ -358,6 +379,7 @@ begin
try
GatherModifiedProject(Project1,sl);
GatherModifiedPackages(sl);
GatherModifiedSourceEditor(sl);
ModifiedMemo.Lines.Assign(sl);
finally
sl.Free;

View File

@ -9234,7 +9234,7 @@ begin
AnUnitInfo := Project1.UnitWithEditorComponent(AEditor);
if AnUnitInfo=nil then exit(mrCancel);
// check if the unit is currently reverting
// do not save a unit which is currently reverting
if AnUnitInfo.IsReverting then
exit(mrOk);
WasVirtual:=AnUnitInfo.IsVirtual;
@ -9405,7 +9405,7 @@ begin
end;
{$IFDEF IDE_VERBOSE}
writeln('TMainIDE.DoSaveEditorFile END');
debugln(['TMainIDE.DoSaveEditorFile END ',NewFilename,' AnUnitInfo.Modified=',AnUnitInfo.Modified,' AEditor.Modified=',AEditor.Modified]);
{$ENDIF}
Result:=mrOk;
end;
@ -11236,26 +11236,27 @@ begin
// save all editor files
for i:=0 to SourceEditorManager.SourceEditorCount-1 do begin
AnUnitInfo:=Project1.UnitWithEditorComponent(SourceEditorManager.SourceEditors[i]);
if (Project1.MainUnitID<0) or (Project1.MainUnitInfo <> AnUnitInfo) then begin
SaveFileFlags:=[sfProjectSaving]
+Flags*[sfCheckAmbiguousFiles];
if AnUnitInfo = nil
if (Project1.MainUnitID>=0) and (Project1.MainUnitInfo = AnUnitInfo) then
continue;
SaveFileFlags:=[sfProjectSaving]
+Flags*[sfCheckAmbiguousFiles];
if AnUnitInfo = nil
then begin
// consistency check
DebugLn('TMainIDE.DoSaveProject - unit not found for page %d', [i]);
DumpStack;
end else begin
if AnUnitInfo.IsVirtual
then begin
DebugLn('TMainIDE.DoSaveProject - unit not found for page %d', [i]);
DumpStack;
end else begin
if AnUnitInfo.IsVirtual
then begin
if (sfSaveToTestDir in Flags) then
Include(SaveFileFlags,sfSaveToTestDir)
else
continue;
end;
if (sfSaveToTestDir in Flags) then
Include(SaveFileFlags,sfSaveToTestDir)
else
continue;
end;
Result:=DoSaveEditorFile(SourceEditorManager.SourceEditors[i], SaveFileFlags);
if Result=mrAbort then exit;
// mrCancel: continue saving other files
end;
Result:=DoSaveEditorFile(SourceEditorManager.SourceEditors[i], SaveFileFlags);
if Result=mrAbort then exit;
// mrCancel: continue saving other files
end;
// update all lrs files

View File

@ -2489,7 +2489,7 @@ end;
procedure TUnitInfo.SetModified(const AValue: boolean);
begin
if fModified=AValue then exit;
if Modified=AValue then exit;
fModified:=AValue;
if not fModified then begin
if Source<>nil then