mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 21:18:01 +02:00
IDE: implemented SaveClosedSourcesOnCodeToolChange
git-svn-id: trunk@22137 -
This commit is contained in:
parent
3b14fe2074
commit
6ae9e55963
10
ide/main.pp
10
ide/main.pp
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user