IDE: Fix cancelling BuildMode when done through "Change build mode" tool button. Issue #36736, patch from errno.

git-svn-id: trunk@62679 -
This commit is contained in:
juha 2020-02-27 10:30:37 +00:00
parent 8f44d34808
commit 42beb70c91
2 changed files with 17 additions and 5 deletions

View File

@ -5222,7 +5222,6 @@ begin
//ActiveSrcEdit:=nil;
//BeginCodeTool(ActiveSrcEdit, ActiveUnitInfo, []);
Project1.BackupSession;
Project1.BackupBuildModes;
Project1.UpdateExecutableType;
Project1.UseAsDefault := False;
TProjectIDEOptions(Sender).CheckLclApp;
@ -5236,10 +5235,7 @@ begin
if not (Sender is TProjectIDEOptions) then exit;
Assert(Assigned(TProjectIDEOptions(Sender).Project), 'TMainIDE.ProjectOptionsAfterWrite: Project=Nil.');
if Restore then
begin
Project1.RestoreBuildModes;
Project1.RestoreSession;
end
Project1.RestoreSession
else begin
if Project1.MainUnitID >= 0 then
begin

View File

@ -513,6 +513,8 @@ type
FProject: TProject;
FCompileReasons: TCompileReasons;
procedure InvalidateOptions;
procedure AfterWriteExec(Sender: TObject; Restore: boolean);
procedure BeforeReadExec(Sender: TObject);
protected
procedure SetTargetCPU(const AValue: string); override;
procedure SetTargetOS(const AValue: string); override;
@ -6301,6 +6303,18 @@ begin
//if (LazProject=nil) then exit;
end;
procedure TProjectCompilerOptions.AfterWriteExec(Sender:TObject;Restore:boolean);
begin
if Restore and (LazProject<>nil) then
LazProject.RestoreBuildModes;
end;
procedure TProjectCompilerOptions.BeforeReadExec(Sender:TObject);
begin
if LazProject<>nil then
LazProject.BackupBuildModes;
end;
procedure TProjectCompilerOptions.SetAlternativeCompile(const Command: string;
ScanFPCMsgs: boolean);
begin
@ -6325,6 +6339,8 @@ begin
if AOwner <> nil then
FProject := AOwner as TProject;
ParsedOpts.OnLocalSubstitute:=@SubstituteProjectMacros;
OnAfterWrite:=@AfterWriteExec;
OnBeforeRead:=@BeforeReadExec;
end;
destructor TProjectCompilerOptions.Destroy;