📄 projoptions.pas
字号:
unit ProjOptions;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, {MainUnit, }StdCtrls, Buttons, INIFiles;
type
TProjOptionsFrm = class(TForm)
Label1: TLabel;
GroupBox3: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
Label4: TLabel;
CompileCommand: TEdit;
Button1: TButton;
OpenDialog1: TOpenDialog;
Label5: TLabel;
CompileFile: TEdit;
Button2: TButton;
Label6: TLabel;
Params: TEdit;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ProjOptionsFrm: TProjOptionsFrm;
Path: String;
implementation
uses MainUnit;
{$R *.dfm}
function GetShortPath(Path : String): String; //Used to find the 8.3 equiv of a 32 bit name
var strFileName: String; lngRes : Double;
begin
lngRes := Length(Path);
lngRes := GetShortPathName(PChar(Path), PChar(Path), 164);
Result := Path;
end;
procedure TProjOptionsFrm.FormShow(Sender: TObject);
var
INIFile : TINIFile;
begin
INIFile := TINIFile.Create(MainUnit.ProjectName);
ProjOptionsFrm.Caption := 'Project options for ' + ExtractFileName(MainUnit.ProjectName) + '...';
CompileCommand.Text := INIFile.ReadString('Project', 'CompileCommand-Long', '');
CompileFile.Text := INIFile.ReadString('Project', 'CompileFile-Long', '');
Params.Text := INIFile.ReadString('Project', 'ParamsToPass', '');
INIFile.Free;
end;
procedure TProjOptionsFrm.BitBtn1Click(Sender: TObject);
var
INIFile : TINIFile;
begin
INIFile := TINIFile.Create(MainUnit.ProjectName);
INIFile.WriteString('Project', 'CompileCommand-Long', CompileCommand.Text);
INIFile.WriteString('Project', 'CompileFile-Long', CompileFile.Text);
INIFile.WriteString('Project', 'CompileCommand-8.3', GetShortPath(CompileCommand.Text));
INIFile.WriteString('Project', 'CompileFile-8.3', GetShortPath(CompileFile.Text));
INIFile.WriteString('Project', 'ParamsToPass', Params.Text);
ProjOptionsFrm.Close;
INIFile.Free;
end;
procedure TProjOptionsFrm.Button1Click(Sender: TObject);
begin
OpenDialog1.FileName := '';
OpenDialog1.Title := 'Choose compiler...';
OpenDialog1.Filter := 'Program files (*.exe, *.com)|*.exe;*.com|Batch files (*.bat)|*.bat|All Files (*.*)|*.*';
OpenDialog1.DefaultExt := '.EXE';
IF OpenDialog1.Execute then
CompileCommand.Text := OpenDialog1.FileName+' "%s"'
else
exit;;
end;
procedure TProjOptionsFrm.Button2Click(Sender: TObject);
begin
OpenDialog1.Title := 'Choose file to compile...';
OpenDialog1.FileName := '';
OpenDialog1.Filter := 'BASIC Files (*.BAS, *.KB*, *.RQ*)|*.BAS;*.kb*;*.rq*|KoolBASIC Source Files (*.KB*)|*.KB*|Rapid-Q Source File (*.RQ*)|*.RQ*|BASIC Project Compiled|*.BPC|All Files (*.*)|*.*';
OpenDialog1.DefaultExt := 'BAS';
IF OpenDialog1.Execute then
CompileFile.Text := OpenDialog1.FileName
else //the use clicked cancle
exit;;
end;
procedure TProjOptionsFrm.BitBtn2Click(Sender: TObject);
begin
ProjOptionsFrm.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -