编辑器

优化编译选项
This commit is contained in:
JianjunLiu 2023-11-06 11:21:11 +08:00
parent d39d4ded83
commit ac764151ff
6 changed files with 179 additions and 59 deletions

View File

@ -10,18 +10,18 @@ object ed_script:t_compile_config
object bt_ok:tbtn
caption="确定"
height=31
left=365
left=408
onclick=bt_ok_clk
parentcolor=false
top=551
width=98
width=55
end
object gp_dir:tgroupbox
caption="输入目录"
height=94
height=87
left=24
parentcolor=true
top=186
top=181
width=442
object bt_f_dir:tbtn
caption=".."
@ -70,10 +70,10 @@ object ed_script:t_compile_config
end
object gp_filter:tgroupbox
caption="筛选"
height=145
height=164
left=27
parentcolor=true
top=288
top=269
width=437
object lb_s_type:tlabel
left=11
@ -92,7 +92,7 @@ object ed_script:t_compile_config
end
object bt_i_f:tbtn
caption="..."
height=24
height=22
left=408
onclick=bt_i_f_clk
top=83
@ -100,18 +100,18 @@ object ed_script:t_compile_config
end
object bt_d_f:tbtn
caption="..."
height=24
height=21
left=408
onclick=bt_d_f_clk
top=114
top=136
width=21
end
object bt_i_s:tbtn
caption="..."
height=25
height=22
left=408
onclick=bt_i_s_clk
top=52
top=54
width=21
end
object label3:tlabel
@ -137,25 +137,47 @@ object ed_script:t_compile_config
end
object ed_include_f:tedit
caption=""
height=25
height=23
left=84
top=83
width=317
end
object label5:tlabel
left=13
top=113
left=12
top=133
width=61
height=25
caption="排除函数"
end
object ed_exclude_f:tedit
caption=""
height=25
height=22
left=84
top=114
top=136
width=317
end
object lb_tsg:tlabel
left=11
top=106
width=63
height=25
caption="tsg¿â"
end
object ed_tsg:tedit
caption="edit1"
height=22
left=84
top=111
width=318
end
object bt_tsgadd:tbtn
caption="..."
height=21
left=408
onclick=bt_tsgadd_clk
top=111
width=21
end
end
object gp_out:tgroupbox
caption="输出"
@ -231,10 +253,10 @@ object ed_script:t_compile_config
object bt_cancel:tbtn
caption="取消"
height=31
left=247
left=335
onclick=bt_cancel_clk
top=551
width=94
width=55
end
object gp_other:tgroupbox
caption="其他"
@ -290,8 +312,8 @@ object ed_script:t_compile_config
end
end
object f_op:topenfileadlg
left=124
top=556
left=68
top=553
height=30
width=30
caption="openfileadlg1"
@ -321,4 +343,12 @@ object ed_script:t_compile_config
top=16
width=22
end
object bt_cmd:tbtn
caption="ÃüÁîÐÐ"
height=31
left=202
onclick=bt_cmd_clk
top=551
width=92
end
end

View File

@ -45,4 +45,11 @@ object dir_list:t_dir_list
width=30
caption="folderchooseadlg1"
end
object f_f:topenfileadlg
left=549
top=95
height=30
width=30
caption="openfileadlg1"
end
end

View File

@ -41,6 +41,10 @@ type t_compile_config=class(tdcreateform)
ed_include_f:tedit;
label5:tlabel;
ed_exclude_f:tedit;
lb_tsg:tlabel;
ed_tsg:tedit;
bt_tsgadd:tbtn;
bt_cmd:tbtn;
function Create(AOwner);override; //¹¹Ôì
begin
f_sep := iofileseparator();
@ -55,6 +59,19 @@ type t_compile_config=class(tdcreateform)
m_list_editor.parent := self;
end
function bt_cmd_clk(o;e);
begin
s := format_build_params(get_config());
MessageBoxA(s,"±àÒëÃüÁîÐÐ",0,o);
end
function bt_tsgadd_clk(o;e);virtual;
begin
tp := array("tsg¿â":"*.tsg");
if show_dir_list(s_to_array(ed_tsg.text,true),tp)then
begin
ed_tsg.text := array_to_s(dir_list.get_dirs(),true);
end
end
function bt_cancel_clk(o;e);virtual;
begin
@ -68,6 +85,12 @@ type t_compile_config=class(tdcreateform)
begin
clear_config();
if not ifarray(r) then return ;
case r["build"] of
"--buildlib":cb_type.ItemIndex := 1;
"--build":cb_type.ItemIndex := 2;
else
cb_type.ItemIndex := 0;
end
e_script.text := r["buildfile"];
ed_output.text := r["output"];
ed_out_f.text := r["exports"] ;
@ -80,12 +103,7 @@ type t_compile_config=class(tdcreateform)
ck_strong.Checked := r["strong"] ;
ck_gui.Checked := r["buildgui"] ;
ed_ico.text := r["buildico"];
case r["build"] of
"--buildlib":cb_type.ItemIndex := 1;
"--build":cb_type.ItemIndex := 2;
else
cb_type.ItemIndex := 0;
end
ed_tsg.text := r["pkg"];
//ck_s_rp.Checked := r["resourcekeepdir"];
end
function get_config();
@ -109,6 +127,7 @@ type t_compile_config=class(tdcreateform)
r["buildgui"] := ck_gui.Checked;
r["buildico"] := ed_ico.text;
r["resourcekeepdir"] := ck_s_rp.Checked;
r["pgk"] := ed_tsg.text;
return r;
end
function clear_config();//ÇåÀí
@ -221,11 +240,12 @@ type t_compile_config=class(tdcreateform)
invoke(self,v["name"],nil);
end
end
function show_dir_list(data);
function show_dir_list(data,filetype);
begin
dir_list.Left := Left-20;
dir_list.top := top+50;
dir_list.set_dirs(data);
dir_list.fopentype := filetype;
return dir_list.ShowModal();
end
function show_m_editor(data);
@ -294,7 +314,6 @@ type t_compile_config=class(tdcreateform)
end
if i>0 then
begin
if i=length(fbasedirarray)-1 then return "."+f_sep;
return array2str( da[i:],f_sep);
end
return d;
@ -378,4 +397,42 @@ type t_compile_config=class(tdcreateform)
fbasedirarray := str2array(v,f_sep);
end
end
function format_build_params(d);
begin
r := d["build"]+="="+format('"%s" ',d["buildfile"]);
if d["libpath"] and ifstring(d["libpath"]) then
begin
r+="-libpath "+d["libpath"]+" ";
end else
r+="-libpath ."+ioFileseparator()+" ";
r += f_b_a_param(d,"exports");
r += f_b_a_param(d,"dependsdir");
r += f_b_a_param(d,"depends");
r += f_b_a_param(d,"excludes");
r += f_b_a_param(d,"pkg");
r += f_b_a_param(d,"resourcedir");
r += f_b_a_param(d,"resourcepat");
r += f_b_a_param(d,"extresource");
r += f_b_a_param(d,"buildico");
r += f_b_a_param(d,"output");
if d["strong"] then r+= " -strong";
if d["buildgui"] then r+= " -buildgui";
return r;
end
function f_b_a_param(d,n);
begin
dn := d[n];
if not ifstring(dn) then return "";
v :=trim( dn);
r :="";
if v then
begin
if v[length(v)]="\\" then v+=",";
r :=format( "--%s=",n)+format('"%s" ',v);
r+="\r\n";
end
return r;
end
end

View File

@ -5,6 +5,7 @@ type t_dir_list=class(tdcreateform)
btn_del:tbtn;
btn_ok:tbtn;
f_d:tfolderchooseadlg;
f_f:topenfileadlg;
function Create(AOwner);override; //¹¹Ôì
begin
inherited;
@ -24,10 +25,19 @@ type t_dir_list=class(tdcreateform)
end
function btn_add_clk(o;e);virtual;
begin
if fopentype then
begin
f_f.filter := fopentype ;
if f_f.OpenDlg() then
begin
r := f_f.filename;
lst_dir.AppendItem(r);
end
return ;
end
if f_d.OpenDlg() then
begin
r := f_d.Folder;
if r[length(r)]<>iofileseparator() then r+=iofileseparator();
lst_dir.AppendItem(r);
end
end
@ -44,6 +54,7 @@ type t_dir_list=class(tdcreateform)
e.skip := true;
EndModal(0);
end
fopentype;
function Recycling();override; //»ØÊÕ±äÁ¿
begin
inherited;

View File

@ -2220,7 +2220,7 @@ type TEditer=class(TCustomcontrol) //
{$endif}
end
r["buildfile"] := f;
r["resourcepat"] := "*.ini,*.tfm";
fio := ioFileseparator();
plg := pluginpath();
for i := length(plg)-1 downto 1 do
@ -2229,7 +2229,6 @@ type TEditer=class(TCustomcontrol) //
begin
ot := plg[1:i]+it.scriptname+hz;
break;
end
end
ds := getlibpathstr();
@ -5207,7 +5206,6 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
end
function build(dir,d);
begin
plg := pluginpath();
fio := ioFileseparator();
for i := length(plg)-1 downto 1 do
@ -5313,6 +5311,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
r += f_b_a_param(d,"dependsdir");
r += f_b_a_param(d,"depends");
r += f_b_a_param(d,"excludes");
r += f_b_a_param(d,"pkg");
r += f_b_a_param(d,"resourcedir");
r += f_b_a_param(d,"resourcepat");
r += f_b_a_param(d,"extresource");
@ -5336,6 +5335,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
end
return r;
end
public
end
type tfincodemap = class(tcustomcontrol)
function create(AOwner);

View File

@ -6,6 +6,21 @@ type TDComponent = class()
{**
@explan(说明) 设计控件基类
**}
protected
static const cst_m_opentsf = "打开tsf文件";
static const cst_m_opentfm = "打开tfm文件";
static const cst_m_delete = "删除";
static const cst_m_copy = "复制";
static const cst_m_cut = "剪切";
static const cst_m_paste = "粘贴";
static const cst_m_moveup = "上移";
static const cst_m_movedown = "下移";
static const cst_m_closewindow = "关闭窗口";
static const cst_m_addmenu = "添加子菜单";
static const cst_m_addaction = "add action";
static const cst_m_savewindow = "保存窗口";
static const cst_tip_willcut = "即将剪切:";
static const cst_tip_willdelete = "即将删除:";
public //注册设计控件
class function GetClassItem(n);
begin
@ -315,8 +330,8 @@ type TDComponent = class()
begin
if f then
begin
dm := MessageBoxA("即将剪切:"+nd.Caption,"删除",(0x1 .| 0x30),nd.owner);//
end else dm := MessageBoxA("即将删除:"+nd.Caption,"删除",(0x1 .| 0x30),nd.owner);//
dm := MessageBoxA(cst_tip_willcut+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
end else dm := MessageBoxA(cst_tip_willdelete+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
if dm<>1 then exit;
if not nd.owner then exit;
d := nd.owner.Designer;
@ -429,16 +444,16 @@ type TDComponent = class()
function menus();virtual; //菜单项
begin
r := array(
("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass)),
("type":"menu","caption":"打开tfm文件","onclick":thisfunction(opentfm)),
("type":"menu","caption":"删除","id":"delete","onclick":thisfunction(deleteclick)),
("type":"menu","caption":"复制","id":"copy","onclick":thisfunction(copyclick)),
("type":"menu","caption":"剪切","id":"cut","onclick":thisfunction(cutclick)),
("type":"menu","caption":"粘贴","id":"paste","onclick":thisfunction(pasteclick)),
("type":"menu","caption":"上移","onclick":thisfunction(MoveComponentUp)),
("type":"menu","caption":"下移","onclick":thisfunction(MoveComponentDown))
("type":"menu","caption":cst_m_opentsf,"onclick":thisfunction(OpenClass)),
("type":"menu","caption":cst_m_opentfm,"onclick":thisfunction(opentfm)),
("type":"menu","caption":cst_m_delete,"id":"delete","onclick":thisfunction(deleteclick)),
("type":"menu","caption":cst_m_copy,"id":"copy","onclick":thisfunction(copyclick)),
("type":"menu","caption":cst_m_cut,"id":"cut","onclick":thisfunction(cutclick)),
("type":"menu","caption":cst_m_paste,"id":"paste","onclick":thisfunction(pasteclick)),
("type":"menu","caption":cst_m_moveup,"onclick":thisfunction(MoveComponentUp)),
("type":"menu","caption":cst_m_movedown,"onclick":thisfunction(MoveComponentDown))
);
if not IsContainer() then r := select * from r where ["caption"]<>"粘贴" end;
if not IsContainer() then r := select * from r where ["caption"]<>cst_m_paste end;
return r;
end
function CreateNode(tnode,owner,tree,Pwnd);virtual;
@ -1146,11 +1161,11 @@ type TDForm = class(TDComponent)
begin
r := array();
r := inherited;
r := select * from r where ["caption"] in array("打开tfm文件","打开tsf文件","粘贴") end;
r := select * from r where ["caption"] in array(cst_m_opentfm,cst_m_opentsf,cst_m_paste) end;
idx := length(r);
//r[idx++] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass));
r[idx++] := array("type":"menu","caption":"关闭窗口","onclick":thisfunction(closecurrentform));
r[idx++] := array("type":"menu","caption":"保存窗口","onclick":thisfunction(savecurrentform));
//r[idx++] := array("type":"menu","caption":cst_m_opentsf,"onclick":thisfunction(OpenClass));
r[idx++] := array("type":"menu","caption":cst_m_closewindow,"onclick":thisfunction(closecurrentform));
r[idx++] := array("type":"menu","caption":cst_m_savewindow,"onclick":thisfunction(savecurrentform));
//r[2] := array("type":"menu","caption":"打开工程目录","onclick":thisfunction(openProjectDir));
return r;
end
@ -2232,7 +2247,7 @@ type TDMenuBase = class(TDRootComponent)
function menus();override;
begin
r := inherited;
r[length(r)] := array("type":"menu","caption":"添加子菜单","onclick":thisfunction(addmenu));
r[length(r)] := array("type":"menu","caption":cst_m_addmenu,"onclick":thisfunction(addmenu));
return r;
end
function Create(AOwner);override;
@ -2343,7 +2358,7 @@ type TDActionList = class(TDRootComponent)
function menus();override;
begin
r := inherited;
r[length(r)] := array("type":"menu","caption":"add action","onclick":thisfunction(addaction));
r[length(r)] := array("type":"menu","caption":cst_m_addaction,"onclick":thisfunction(addaction));
return r;
end
function ComponentClass();override;
@ -3496,7 +3511,7 @@ type TDBtn = class(TDComponent)
function menus();override;
begin
r := inherited;
return select * from r where ["caption"] <> "粘贴" end ;
return select * from r where ["caption"] <> cst_m_paste end ;
end
function Create(AOwner);override;
begin
@ -3535,7 +3550,7 @@ type TDPairSplitterSide = class(TDComponent)
function menus();override;
begin
r := inherited;
return select * from r where ["caption"] in array("删除","粘贴","剪切","打开tsf文件","打开tfm文件") end ;
return select * from r where ["caption"] in array(cst_m_delete,cst_m_paste,cst_m_cut,cst_m_opentsf,cst_m_opentfm) end ;
end
function InToolBar();override;
begin
@ -3663,7 +3678,7 @@ type TDTabSheet = class(TDComponent)
begin
r := inherited;
return r;
//return select * from r where ["caption"] in array("删除","粘贴","剪切") end ;
//return select * from r where ["caption"] in array(cst_m_delete,cst_m_paste,cst_m_cut) end ;
end
function InToolBar();override;
begin