mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 11:12:34 +02:00
IDE: fixed TUnitInfo.Modified:=false, bug #22096
git-svn-id: trunk@37401 -
This commit is contained in:
parent
a5f8d500a6
commit
fecde4484b
@ -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;
|
||||
|
39
ide/main.pp
39
ide/main.pp
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user