mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 02:28:04 +02:00
IDE: Import / export compiler options, remove Options parameter. Prepare working with BuildModes.
git-svn-id: trunk@45607 -
This commit is contained in:
parent
eef99cf9b7
commit
750993ff2d
@ -251,7 +251,7 @@ var
|
||||
ImportExportResult: TImportExportOptionsResult;
|
||||
begin
|
||||
DoSaveSettings(FCompilerOpts);
|
||||
if (MainIDEInterface.DoImExportCompilerOptions(FCompilerOpts, ImportExportResult) = mrOK)
|
||||
if (MainIDEInterface.DoImExportCompilerOptions(ImportExportResult) = mrOK)
|
||||
and (ImportExportResult = ieorImport)
|
||||
and Assigned(OnLoadIDEOptions) then
|
||||
OnLoadIDEOptions(Self, FCompilerOpts);
|
||||
|
@ -34,7 +34,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Buttons, IDEProcs, FileUtil, Laz2_XMLCfg, LazFileCache, LCLType, MainIntf,
|
||||
LazarusIDEStrConsts, InputHistory, CompilerOptions;
|
||||
LazarusIDEStrConsts, InputHistory, Project, CompilerOptions;
|
||||
|
||||
type
|
||||
{ TImExportCompOptsDlg }
|
||||
@ -71,11 +71,10 @@ type
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
end;
|
||||
|
||||
function ShowImExportCompilerOptionsDialog(
|
||||
CompOpts: TBaseCompilerOptions; var Filename: string): TImportExportOptionsResult;
|
||||
function ShowImExportCompilerOptionsDialog(var Filename: string): TImportExportOptionsResult;
|
||||
|
||||
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoImportCompilerOptions(const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(const Filename: string): TModalResult;
|
||||
|
||||
implementation
|
||||
|
||||
@ -127,8 +126,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function ShowImExportCompilerOptionsDialog(
|
||||
CompOpts: TBaseCompilerOptions; var Filename: string): TImportExportOptionsResult;
|
||||
function ShowImExportCompilerOptionsDialog(var Filename: string): TImportExportOptionsResult;
|
||||
var
|
||||
ImExportCompOptsDlg: TImExportCompOptsDlg;
|
||||
begin
|
||||
@ -142,7 +140,7 @@ begin
|
||||
ImExportCompOptsDlg.Free;
|
||||
end;
|
||||
|
||||
function DoImportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoImportCompilerOptions(const Filename: string): TModalResult;
|
||||
var
|
||||
XMLConfig: TXMLConfig;
|
||||
Path: String;
|
||||
@ -160,13 +158,13 @@ begin
|
||||
end;
|
||||
try
|
||||
Path:=GetXMLPathForCompilerOptions(XMLConfig);
|
||||
CompilerOpts.LoadFromXMLConfig(XMLConfig,Path);
|
||||
Project1.CompilerOptions.LoadFromXMLConfig(XMLConfig,Path);
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function DoExportCompilerOptions(CompilerOpts: TBaseCompilerOptions; const Filename: string): TModalResult;
|
||||
function DoExportCompilerOptions(const Filename: string): TModalResult;
|
||||
var
|
||||
XMLConfig: TXMLConfig;
|
||||
Path: String;
|
||||
@ -176,8 +174,8 @@ begin
|
||||
InvalidateFileStateCache;
|
||||
XMLConfig:=TXMLConfig.Create(Filename);
|
||||
try
|
||||
Path:=DefaultCompilerOptPath; // GetXMLPathForCompilerOptions(XMLConfig);
|
||||
CompilerOpts.SaveToXMLConfig(XMLConfig,Path);
|
||||
Path:=DefaultCompilerOptPath;
|
||||
Project1.CompilerOptions.SaveToXMLConfig(XMLConfig,Path);
|
||||
XMLConfig.Flush;
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
|
16
ide/main.pp
16
ide/main.pp
@ -818,7 +818,7 @@ type
|
||||
Flags: TOpenFlags): TModalResult; override;
|
||||
function DoPublishProject(Flags: TSaveFlags;
|
||||
ShowDialog: boolean): TModalResult; override;
|
||||
function DoImExportCompilerOptions(Sender: TObject;
|
||||
function DoImExportCompilerOptions(
|
||||
out ImportExportResult: TImportExportOptionsResult): TModalResult; override;
|
||||
procedure DoShowProjectInspector(Show: boolean); override;
|
||||
function DoAddActiveUnitToProject: TModalResult;
|
||||
@ -6403,22 +6403,18 @@ begin
|
||||
Project1.ProjectDirectory, MainBuildBoss.GetProjectPublishDir);
|
||||
end;
|
||||
|
||||
function TMainIDE.DoImExportCompilerOptions(Sender: TObject;
|
||||
function TMainIDE.DoImExportCompilerOptions(
|
||||
out ImportExportResult: TImportExportOptionsResult): TModalResult;
|
||||
var
|
||||
Options: TCompilerOptions;
|
||||
//Options: TCompilerOptions;
|
||||
Filename: string;
|
||||
begin
|
||||
Result := mrOk;
|
||||
if Sender is TCompilerOptions then
|
||||
Options := TCompilerOptions(Sender)
|
||||
else
|
||||
RaiseException('TMainIDE.OnCompilerOptionsImExport');
|
||||
ImportExportResult := ShowImExportCompilerOptionsDialog(Options, Filename);
|
||||
ImportExportResult := ShowImExportCompilerOptionsDialog(Filename);
|
||||
if Filename='' then Exit(mrCancel);
|
||||
case ImportExportResult of
|
||||
ieorImport: Result := DoImportCompilerOptions(Options, Filename);
|
||||
ieorExport: Result := DoExportCompilerOptions(Options, Filename);
|
||||
ieorImport: Result := DoImportCompilerOptions(Filename);
|
||||
ieorExport: Result := DoExportCompilerOptions(Filename);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -166,7 +166,7 @@ type
|
||||
const AFilename: string): TModalResult; virtual; abstract;
|
||||
|
||||
procedure DoShowProjectInspector(Show: boolean); virtual; abstract;
|
||||
function DoImExportCompilerOptions(Sender: TObject; out ImportExportResult: TImportExportOptionsResult): TModalResult; virtual; abstract;
|
||||
function DoImExportCompilerOptions(out ImportExportResult: TImportExportOptionsResult): TModalResult; virtual; abstract;
|
||||
|
||||
function PrepareForCompile: TModalResult; virtual; abstract; // stop things that interfere with compilation, like debugging
|
||||
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; virtual; abstract;
|
||||
|
Loading…
Reference in New Issue
Block a user