📄 rebwform.pas
字号:
unit RebWForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, FileCtrl, ExtCtrls;
type
TRebWizForm = class(TForm)
ListBoxFiles: TListBox;
FileListBox1: TFileListBox;
Panel1: TPanel;
Label1: TLabel;
EditDir: TEdit;
BtnList: TButton;
BtnCompileAll: TButton;
BtnOpen: TButton;
BtnCompOne: TButton;
procedure BtnListClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure BtnOpenClick(Sender: TObject);
procedure BtnCompOneClick(Sender: TObject);
procedure BtnCompileAllClick(Sender: TObject);
procedure EditDirDblClick(Sender: TObject);
private
{ Private declarations }
public
procedure ExamineDir;
procedure DoCompile;
end;
var
RebWizForm: TRebWizForm;
implementation
{$R *.DFM}
uses
ExptIntf, ToolIntf;
procedure TRebWizForm.BtnListClick(Sender: TObject);
begin
ListBoxFiles.Items.Clear;
FileListbox1.Directory := EditDir.Text;
ExamineDir;
// enable all buttons
BtnOpen.Enabled := True;
BtnCompOne.Enabled := True;
BtnCompileAll.Enabled := True;
end;
procedure TRebWizForm.ExamineDir;
var
FileList: TStrings;
I: Integer;
CurrDir: string;
begin
// examining .dpr files
FileListBox1.Mask := '*.dpr';
FileListBox1.FileType := [ftNormal];
FileList := TStringList.Create;
try
FileList.Assign(FileListBox1.Items);
// for each file, add its path to the list
for I := 0 to FileList.Count - 1 do
begin
ListBoxFiles.Items.Add (FileListbox1.Directory +
'\' + FileList[I]);
end;
// examine sub directorties
FileListBox1.Mask := '*.*';
FileListBox1.FileType := [ftDirectory];
FileList.Assign(FileListBox1.Items);
CurrDir := FileListbox1.Directory;
// for each dir re-examine...
for I := 2 to FileList.Count - 1 do
begin
FileListbox1.Directory :=
CurrDir + '\' + Copy (FileList[I], 2, Length (FileList [I]) - 2);
ExamineDir;
end;
FileListbox1.Directory := CurrDir;
finally
FileList.Free;
end;
end;
procedure TRebWizForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
RebWizForm := nil;
end;
procedure TRebWizForm.BtnOpenClick(Sender: TObject);
var
CurrPrj: string;
begin
with ListBoxFiles do
CurrPrj := Items [ItemIndex];
ToolServices.OpenProject (CurrPrj);
end;
procedure TRebWizForm.BtnCompOneClick(Sender: TObject);
var
CurrPrj: string;
begin
with ListBoxFiles do
CurrPrj := Items [ItemIndex];
ToolServices.OpenProject (CurrPrj);
DoCompile;
end;
procedure TRebWizForm.DoCompile;
var
ObjDelphi: TWinControl;
Meth: TMethod;
Evt: TNotifyEvent;
P: Pointer;
begin
ObjDelphi := Application.MainForm;
P := ObjDelphi.MethodAddress ('ProjectBuild');
Meth.Code := P;
Meth.Data := ObjDelphi;
Evt := TNotifyEvent (Meth);
Evt (ObjDelphi);
end;
procedure TRebWizForm.BtnCompileAllClick(Sender: TObject);
var
CurrPrj: string;
I: Integer;
begin
with ListBoxFiles do
for I := 0 to Items.Count - 1 do
begin
CurrPrj := Items [I];
ToolServices.OpenProject (CurrPrj);
DoCompile;
end;
end;
procedure TRebWizForm.EditDirDblClick(Sender: TObject);
var
Dir: string;
begin
if SelectDirectory (Dir, [], 0) then
EditDir.Text := Dir;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -