mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 20:50:39 +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;
|
i: Integer;
|
||||||
SrcBuf: TCodeBuffer;
|
SrcBuf: TCodeBuffer;
|
||||||
AnUnitInfo: TUnitInfo;
|
AnUnitInfo: TUnitInfo;
|
||||||
|
MsgResult: TModalResult;
|
||||||
begin
|
begin
|
||||||
for i:=0 to CodeToolBoss.SourceChangeCache.BuffersToModifyCount-1 do begin
|
for i:=0 to CodeToolBoss.SourceChangeCache.BuffersToModifyCount-1 do begin
|
||||||
SrcBuf:=CodeToolBoss.SourceChangeCache.BuffersToModify[i];
|
SrcBuf:=CodeToolBoss.SourceChangeCache.BuffersToModify[i];
|
||||||
AnUnitInfo:=Project1.UnitInfoWithFilename(SrcBuf.Filename);
|
AnUnitInfo:=Project1.UnitInfoWithFilename(SrcBuf.Filename);
|
||||||
if AnUnitInfo<>nil then
|
if AnUnitInfo<>nil then
|
||||||
AnUnitInfo.Modified:=true;
|
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;
|
end;
|
||||||
SourceNoteBook.UnlockAllEditorsInSourceChangeCache;
|
SourceNoteBook.UnlockAllEditorsInSourceChangeCache;
|
||||||
end;
|
end;
|
||||||
|
@ -141,6 +141,7 @@ type
|
|||||||
FMainBarSubTitle: string;
|
FMainBarSubTitle: string;
|
||||||
FOpenEditorsOnCodeToolChange: boolean;
|
FOpenEditorsOnCodeToolChange: boolean;
|
||||||
FOpenMainSourceOnCodeToolChange: boolean;
|
FOpenMainSourceOnCodeToolChange: boolean;
|
||||||
|
FSaveClosedSourcesOnCodeToolChange: boolean;
|
||||||
procedure AddHandler(HandlerType: TLazarusIDEHandlerType;
|
procedure AddHandler(HandlerType: TLazarusIDEHandlerType;
|
||||||
const AMethod: TMethod; AsLast: boolean = false);
|
const AMethod: TMethod; AsLast: boolean = false);
|
||||||
procedure RemoveHandler(HandlerType: TLazarusIDEHandlerType;
|
procedure RemoveHandler(HandlerType: TLazarusIDEHandlerType;
|
||||||
@ -226,6 +227,8 @@ type
|
|||||||
function SaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract; // true if something was saved
|
function SaveSourceEditorChangesToCodeCache(PageIndex: integer): boolean; virtual; abstract; // true if something was saved
|
||||||
property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
|
property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
|
||||||
write FOpenEditorsOnCodeToolChange;
|
write FOpenEditorsOnCodeToolChange;
|
||||||
|
property SaveClosedSourcesOnCodeToolChange: boolean read FSaveClosedSourcesOnCodeToolChange
|
||||||
|
write FSaveClosedSourcesOnCodeToolChange;
|
||||||
property OpenMainSourceOnCodeToolChange: boolean read FOpenMainSourceOnCodeToolChange
|
property OpenMainSourceOnCodeToolChange: boolean read FOpenMainSourceOnCodeToolChange
|
||||||
write FOpenMainSourceOnCodeToolChange;
|
write FOpenMainSourceOnCodeToolChange;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user