mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-11-04 10:39:53 +01:00 
			
		
		
		
	ide: compiler options: fix logic of loading from the configuration file (issue #0015625)
git-svn-id: trunk@23975 -
This commit is contained in:
		
							parent
							
								
									393b9de9d9
								
							
						
					
					
						commit
						6990c213d3
					
				@ -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;
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user