1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
unit fradelphioptions;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, StdCtrls,
// LazUtils
LazFileCache, LazFileUtils, LazStringUtils, FileUtil,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEDialogs,
DelphiOptions;
type
{ TDelphiOptionsFrame }
TDelphiOptionsFrame = class(TAbstractIDEOptionsEditor)
cbConfigFileExtension: TComboBox;
cbAdditionalOptions: TComboBox;
cbConvertDosToUnix: TCheckBox;
lblConfigFileExtension: TLabel;
lblAdditionalOptions: TLabel;
DelphiPathBrowseButton: TButton;
cbDelphiPath: TComboBox;
lblDelphiPath: TLabel;
procedure DelphiPathBrowseButtonClick(Sender: TObject);
private
public
function GetTitle: String; override;
procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
procedure ReadSettings({%H-}AOptions: TAbstractIDEOptions); override;
procedure WriteSettings({%H-}AOptions: TAbstractIDEOptions); override;
class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
end;
implementation
uses dialogs, strdelphitool;
{$R *.lfm}
{ TDelphiOptionsFrame }
procedure TDelphiOptionsFrame.DelphiPathBrowseButtonClick(Sender: TObject);
var
OpenDialog: TOpenDialog;
AFilename: String;
begin
OpenDialog:=TOpenDialog.Create(nil);
try
//InputHistories.ApplyFileDialogSettings(OpenDialog);
OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
OpenDialog.Title:=SSelectDelphiExecutable;
OpenDialog.FileName:=cbDelphiPath.Text;
if OpenDialog.Execute then begin
AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
SetComboBoxText(cbDelphiPath,AFilename,cstFilename,30);
end;
finally
OpenDialog.Free;
end;
end;
function TDelphiOptionsFrame.GetTitle: String;
begin
Result:=SDelphiLocalizedParserName;
end;
procedure TDelphiOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
lblDelphiPath.Caption:=SDelphiCompilerFileNameCaption;
lblConfigFileExtension.Caption:=SConfigFileExtensionCaption;
cbConvertDosToUnix.Caption:=SConvertDosToUnixCaption;
cbConvertDosToUnix.Enabled:={$IFDEF UNIX}True{$ELSE}False{$ENDIF};
lblAdditionalOptions.Caption:=SDelphiCompilerArgs;
end;
procedure TDelphiOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
Opts : TDelphiToolOptions;
begin
Opts:=DelphiToolOptions;
cbConvertDosToUnix.Checked:=Opts.ConvertPathsToUnix;
cbDelphiPath.Text:=Opts.CompilerFileName;
cbConfigFileExtension.Text:=Opts.ConfigFileExtension;
cbAdditionalOptions.Text:=Opts.AdditionalOptions;
end;
procedure TDelphiOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
var
Opts : TDelphiToolOptions;
begin
Opts:=DelphiToolOptions;
Opts.ConvertPathsToUnix:=cbConvertDosToUnix.Checked;
Opts.CompilerFileName:=cbDelphiPath.Text;
Opts.ConfigFileExtension:=cbConfigFileExtension.Text;
Opts.AdditionalOptions:=cbAdditionalOptions.Text;
Opts.Save;
end;
class function TDelphiOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
begin
Result:=IDEEditorGroups.GetByIndex(GroupEnvironment)^.GroupClass;
end;
end.
|