IDE: implemented SaveClosedSourcesOnCodeToolChange

git-svn-id: trunk@22137 -
This commit is contained in:
mattias 2009-10-13 09:24:06 +00:00
parent 3b14fe2074
commit 6ae9e55963
2 changed files with 13 additions and 0 deletions

View File

@ -12358,12 +12358,22 @@ var
i: Integer;
SrcBuf: TCodeBuffer;
AnUnitInfo: TUnitInfo;
MsgResult: TModalResult;
begin
for i:=0 to CodeToolBoss.SourceChangeCache.BuffersToModifyCount-1 do begin
SrcBuf:=CodeToolBoss.SourceChangeCache.BuffersToModify[i];
AnUnitInfo:=Project1.UnitInfoWithFilename(SrcBuf.Filename);
if AnUnitInfo<>nil then
AnUnitInfo.Modified:=true;
if SaveClosedSourcesOnCodeToolChange
and (not SrcBuf.IsVirtual)
and ((AnUnitInfo=nil) or (AnUnitInfo.EditorIndex<0)) then
begin
// save closed file (closed = not open in editor)
MsgResult:=SaveCodeBuffer(SrcBuf);
if MsgResult=mrAbort then break;
end;
end;
SourceNoteBook.UnlockAllEditorsInSourceChangeCache;
end;

View File

@ -141,6 +141,7 @@ type
FMainBarSubTitle: string;
FOpenEditorsOnCodeToolChange: boolean;
FOpenMainSourceOnCodeToolChange: boolean;
FSaveClosedSourcesOnCodeToolChange: boolean;
procedure AddHandler(HandlerType: TLazarusIDEHandlerType;
const AMethod: TMethod; AsLast: boolean = false);
procedure RemoveHandler(HandlerType: TLazarusIDEHandlerType;
@ -226,6 +227,8 @@ type
function SaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract; // true if something was saved
property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
write FOpenEditorsOnCodeToolChange;
property SaveClosedSourcesOnCodeToolChange: boolean read FSaveClosedSourcesOnCodeToolChange
write FSaveClosedSourcesOnCodeToolChange;
property OpenMainSourceOnCodeToolChange: boolean read FOpenMainSourceOnCodeToolChange
write FOpenMainSourceOnCodeToolChange;