IDE: moved build modes to project compiler options

git-svn-id: trunk@21570 -
This commit is contained in:
mattias 2009-09-04 14:18:02 +00:00
parent 907df92e81
commit b7b017b15f
6 changed files with 40 additions and 40 deletions

View File

@ -285,16 +285,16 @@ type
procedure SetCompilerMessages;
public
CompilerOpts: TBaseCompilerOptions;
OldCompOpts: TBaseCompilerOptions;
OldCompOpts: TBaseCompilerOptions; // set on loading, used for revert
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure GetCompilerOptions; // options to dialog
procedure GetCompilerOptions(SrcCompilerOptions: TBaseCompilerOptions);
function PutCompilerOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl): boolean; // dlg to options
function PutCompilerOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl;
DestCompilerOptions: TBaseCompilerOptions): boolean;
procedure LoadOptionsToForm;
procedure LoadOptionsToForm(SrcCompilerOptions: TBaseCompilerOptions);
function SaveFormToOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl): boolean;
function SaveFormToOptions(CheckAndWarn: TCheckCompileOptionsMsgLvl;
DestCompilerOptions: TBaseCompilerOptions): boolean;
public
property ReadOnly: boolean read FReadOnly write SetReadOnly;
property OnImExportCompilerOptions: TNotifyEvent
@ -478,9 +478,9 @@ begin
inherited Destroy;
end;
procedure TfrmCompilerOptions.GetCompilerOptions;
procedure TfrmCompilerOptions.LoadOptionsToForm;
begin
GetCompilerOptions(nil);
LoadOptionsToForm(nil);
end;
{------------------------------------------------------------------------------
@ -492,7 +492,7 @@ begin
Assert(False, 'Trace:Accept compiler options changes');
{ Save the options and hide the dialog }
if not PutCompilerOptions(ccomlErrors) then exit;
if not SaveFormToOptions(ccomlErrors) then exit;
ModalResult:=mrOk;
end;
@ -502,7 +502,7 @@ end;
procedure TfrmCompilerOptions.btnTestClicked(Sender: TObject);
begin
// Apply any changes and test
if not PutCompilerOptions(ccomlHints) then exit;
if not SaveFormToOptions(ccomlHints) then exit;
if Assigned(TestCompilerOptions) then begin
btnCheck.Enabled:=false;
try
@ -521,7 +521,7 @@ end;
procedure TfrmCompilerOptions.ButtonShowOptionsClicked(Sender: TObject);
begin
// Test MakeOptionsString function
if PutCompilerOptions(ccomlWarning) then
if SaveFormToOptions(ccomlWarning) then
ShowCompilerOptionsDialog(Self, CompilerOpts);
end;
@ -612,7 +612,7 @@ end;
{------------------------------------------------------------------------------
TfrmCompilerOptions GetCompilerOptions
------------------------------------------------------------------------------}
procedure TfrmCompilerOptions.GetCompilerOptions(
procedure TfrmCompilerOptions.LoadOptionsToForm(
SrcCompilerOptions: TBaseCompilerOptions);
var
i: integer;
@ -867,7 +867,7 @@ end;
{------------------------------------------------------------------------------
TfrmCompilerOptions PutCompilerOptions
------------------------------------------------------------------------------}
function TfrmCompilerOptions.PutCompilerOptions(
function TfrmCompilerOptions.SaveFormToOptions(
CheckAndWarn: TCheckCompileOptionsMsgLvl;
DestCompilerOptions: TBaseCompilerOptions): boolean;
@ -1148,10 +1148,10 @@ begin
end;
end;
function TfrmCompilerOptions.PutCompilerOptions(
function TfrmCompilerOptions.SaveFormToOptions(
CheckAndWarn: TCheckCompileOptionsMsgLvl): boolean;
begin
Result:=PutCompilerOptions(CheckAndWarn,nil);
Result:=SaveFormToOptions(CheckAndWarn,nil);
end;
procedure TfrmCompilerOptions.UpdateInheritedTab;

View File

@ -28,6 +28,8 @@ uses
Classes, SysUtils, FileUtil, LResources, Forms;
type
TBuildModesEditorFrame = class(TFrame)
private
public

View File

@ -132,7 +132,7 @@ begin
Path:=GetXMLPathForCompilerOptions(XMLConfig);
CompilerOpts.LoadFromXMLConfig(XMLConfig,Path);
if CompOptsDialog<>nil then
CompOptsDialog.GetCompilerOptions(CompilerOpts);
CompOptsDialog.LoadOptionsToForm(CompilerOpts);
finally
if FreeCompilerOpts then
CompilerOpts.Free;
@ -151,7 +151,7 @@ begin
if (CompOptsDialog<>nil) then begin
CompilerOpts:=TBaseCompilerOptions.Create(nil);
FreeCompilerOpts:=true;
CompOptsDialog.PutCompilerOptions(ccomlNone,CompilerOpts);
CompOptsDialog.SaveFormToOptions(ccomlNone,CompilerOpts);
end;
try
Result:=mrCancel;

View File

@ -3739,7 +3739,7 @@ begin
frmCompilerOptions.Caption:=Format(lisCompilerOptionsForProject, [NewCaption
]);
frmCompilerOptions.CompilerOpts:=Project1.CompilerOptions;
frmCompilerOptions.GetCompilerOptions;
frmCompilerOptions.LoadOptionsToForm;
frmCompilerOptions.OnImExportCompilerOptions:=@OnCompilerOptionsImExport;
if frmCompilerOptions.ShowModal=mrOk then begin
MainBuildBoss.RescanCompilerDefines(true,true);

View File

@ -386,6 +386,7 @@ type
TProjectCompilerOptions = class(TBaseCompilerOptions)
private
FBuildModes: TBuildModeGraph;
FGlobals: TGlobalCompilerOptions;
FOwnerProject: TProject;
FCompileReasons: TCompileReasons;
@ -407,6 +408,7 @@ type
public
constructor Create(const AOwner: TObject); override;
destructor Destroy; override;
procedure Clear; override;
function GetOwnerName: string; override;
function GetDefaultMainSourceFileName: string; override;
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
@ -418,6 +420,7 @@ type
property OwnerProject: TProject read FOwnerProject;
property Project: TProject read FOwnerProject;
property Globals: TGlobalCompilerOptions read FGlobals;
property BuildModes: TBuildModeGraph read FBuildModes;
published
property CompileReasons: TCompileReasons read FCompileReasons write FCompileReasons;
end;
@ -568,7 +571,6 @@ type
FAutoCreateForms: boolean;
FAutoOpenDesignerFormsDisabled: boolean;
FBookmarks: TProjectBookmarkList;
FBuildModes: TBuildModeGraph;
fChanged: boolean;
FCompilerOptions: TProjectCompilerOptions;
fCurStorePathDelim: TPathDelimSwitch; // used by OnLoadSaveFilename
@ -630,7 +632,6 @@ type
const OldUnitName, NewUnitName: string;
CheckIfAllowed: boolean; var Allowed: boolean);
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
procedure SetBuildModes(const AValue: TBuildModeGraph);
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
procedure SetMainProject(const AValue: boolean);
procedure SetSkipCheckLCLInterfaces(const AValue: boolean);
@ -829,7 +830,6 @@ type
read FAutoOpenDesignerFormsDisabled
write SetAutoOpenDesignerFormsDisabled;
property Bookmarks: TProjectBookmarkList read FBookmarks write FBookmarks;
property BuildModes: TBuildModeGraph read FBuildModes write SetBuildModes;
property SkipCheckLCLInterfaces: boolean read FSkipCheckLCLInterfaces
write SetSkipCheckLCLInterfaces;
property CompilerOptions: TProjectCompilerOptions
@ -1882,7 +1882,6 @@ begin
inherited Create(ProjectDescription);
fActiveEditorIndexAtStart := -1;
FBuildModes:=TBuildModeGraph.Create;
FSkipCheckLCLInterfaces:=false;
FAutoCreateForms := true;
FBookmarks := TProjectBookmarkList.Create;
@ -1928,7 +1927,6 @@ begin
FreeThenNil(FRunParameterOptions);
FreeThenNil(FCompilerOptions);
FreeThenNil(FDefineTemplates);
FreeThenNil(FBuildModes);
inherited Destroy;
end;
@ -2127,8 +2125,8 @@ begin
FFirstRequiredDependency,pdlRequires,fCurStorePathDelim);
// save build modes
BuildModes.SaveToXMLConfig(xmlconfig,Path+'BuildModes/',true,SaveSessionInfoInLPI,
fCurStorePathDelim);
CompilerOptions.BuildModes.SaveToXMLConfig(xmlconfig,Path+'BuildModes/',
true,SaveSessionInfoInLPI,fCurStorePathDelim);
// save units
SaveUnits(XMLConfig,Path,true,SaveSessionInfoInLPI);
@ -2206,8 +2204,8 @@ begin
SaveUnits(XMLConfig,Path,true,true);
// build modes
FBuildModes.SaveToXMLConfig(xmlconfig,Path+'BuildModes/',false,true,
fCurStorePathDelim);
CompilerOptions.BuildModes.SaveToXMLConfig(xmlconfig,Path+'BuildModes/',
false,true,fCurStorePathDelim);
// save session
SaveSessionInfo(XMLConfig,Path);
@ -2489,8 +2487,8 @@ begin
//DebugLn('TProject.ReadProject SessionStorage=',dbgs(ord(SessionStorage)),' ProjectSessionFile=',ProjectSessionFile);
// build modes
FBuildModes.LoadFromXMLConfig(xmlconfig,Path+'BuildModes/',false,
fPathDelimChanged);
CompilerOptions.BuildModes.LoadFromXMLConfig(xmlconfig,Path+'BuildModes/',
false,fPathDelimChanged);
NewMainUnitID := xmlconfig.GetValue(Path+'General/MainUnit/Value', -1);
AutoCreateForms := xmlconfig.GetValue(
@ -2574,8 +2572,8 @@ begin
FileVersion:=XMLConfig.GetValue(Path+'Version/Value',0);
// load user sepcific build modes
FBuildModes.LoadFromXMLConfig(xmlconfig,Path+'BuildModes/',true,
fPathDelimChanged);
CompilerOptions.BuildModes.LoadFromXMLConfig(xmlconfig,Path+'BuildModes/',
true,fPathDelimChanged);
// load session info
LoadSessionInfo(XMLConfig,Path,true);
@ -2737,8 +2735,6 @@ var i:integer;
begin
BeginUpdate(true);
FBuildModes.ClearModes;
// break and free removed dependencies
while FFirstRemovedDependency<>nil do
DeleteRemovedDependency(FFirstRemovedDependency);
@ -4243,12 +4239,6 @@ begin
FAutoOpenDesignerFormsDisabled:=AValue;
end;
procedure TProject.SetBuildModes(const AValue: TBuildModeGraph);
begin
if FBuildModes=AValue then exit;
FBuildModes:=AValue;
end;
procedure TProject.SetCompilerOptions(const AValue: TProjectCompilerOptions);
begin
if FCompilerOptions=AValue then exit;
@ -4889,6 +4879,7 @@ end;
constructor TProjectCompilerOptions.Create(const AOwner: TObject);
begin
FGlobals := TGlobalCompilerOptions.Create;
FBuildModes:=TBuildModeGraph.Create;
FCompileReasons := [crCompile, crBuild, crRun];
inherited Create(AOwner, TProjectCompilationToolOptions);
with TProjectCompilationToolOptions(ExecuteBefore) do begin
@ -4908,6 +4899,13 @@ destructor TProjectCompilerOptions.Destroy;
begin
inherited Destroy;
FreeAndNil(FGlobals);
FreeAndNil(FBuildModes);
end;
procedure TProjectCompilerOptions.Clear;
begin
inherited Clear;
FBuildModes.ClearModes;
end;
function TProjectCompilerOptions.GetOwnerName: string;

View File

@ -1226,7 +1226,7 @@ begin
CompilerOptsDlg.OnImExportCompilerOptions:=
PackageEditors.OnImExportCompilerOptions;
with CompilerOptsDlg do begin
GetCompilerOptions;
LoadOptionsToForm();
Caption:=Format(lisPckEditCompilerOptionsForPackage,[LazPackage.IDAsString]);
ReadOnly:=LazPackage.ReadOnly;
if ShowModal=mrOk then begin