ide: compiler options: fix logic of loading from the configuration file (issue #0015625)

git-svn-id: trunk@23975 -
This commit is contained in:
paul 2010-03-13 16:43:44 +00:00
parent 393b9de9d9
commit 6990c213d3
2 changed files with 20 additions and 7 deletions

View File

@ -23,6 +23,7 @@ type
private
FOptions: TBaseCompilerOptions;
public
constructor Create(TheOwner: TComponent); override;
function Check: Boolean; override;
function GetTitle: string; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -42,6 +43,12 @@ begin
edtConfigPath.Enabled := chkCustomConfigFile.Checked;
end;
constructor TCompilerOtherOptionsFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FOptions := nil;
end;
function TCompilerOtherOptionsFrame.Check: Boolean;
var
NewDontUseConfigFile: Boolean;
@ -94,8 +101,9 @@ end;
procedure TCompilerOtherOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
begin
FOptions := AOptions as TBaseCompilerOptions;
with FOptions do
if FOptions = nil then
FOptions := AOptions as TBaseCompilerOptions;
with AOptions as TBaseCompilerOptions do
begin
chkConfigFile.Checked := not DontUseConfigFile;
chkCustomConfigFile.Checked := CustomConfigFile;

View File

@ -52,6 +52,7 @@ type
protected
procedure DoSaveSettings(AOptions: TAbstractIDEOptions);
public
constructor Create(TheOwner: TComponent); override;
function Check: boolean; override;
function GetTitle: string; override;
procedure Setup(ADialog: TAbstractOptionsEditorDialog); override;
@ -160,11 +161,9 @@ end;
procedure TCompilerPathOptionsFrame.DoLoadSave(Sender: TObject);
var
OldOptions: TBaseCompilerOptions;
Options: TBaseCompilerOptions;
ImportExportResult: TImportExportOptionsResult;
begin
OldOptions := FCompilerOpts;
Options := TBaseCompilerOptionsClass(FCompilerOpts.ClassType).Create(FCompilerOpts.Owner);
try
DoSaveSettings(Options);
@ -174,7 +173,6 @@ begin
if Assigned(OnLoadIDEOptions) then
OnLoadIDEOptions(Self, Options);
end;
Options := OldOptions;
finally
Options.Free;
end;
@ -186,6 +184,12 @@ begin
OnSaveIDEOptions(Self, AOptions);
end;
constructor TCompilerPathOptionsFrame.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FCompilerOpts := nil;
end;
function TCompilerPathOptionsFrame.CheckSearchPath(const Context, ExpandedPath: string;
Level: TCheckCompileOptionsMsgLvl): boolean;
var
@ -562,8 +566,9 @@ procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
LCLPlatform: TLCLPlatform;
begin
FCompilerOpts := AOptions as TBaseCompilerOptions;
with FCompilerOpts do
if FCompilerOpts = nil then
FCompilerOpts := AOptions as TBaseCompilerOptions;
with AOptions as TBaseCompilerOptions do
begin
edtOtherUnits.Text := OtherUnitFiles;
edtIncludeFiles.Text := IncludePath;