编辑器

优化编译选项
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
@@ -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
@@ -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
+68 -11
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();
@@ -54,7 +58,20 @@ type t_compile_config=class(tdcreateform)
m_list_editor.Visible := false;
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
@@ -67,7 +84,13 @@ type t_compile_config=class(tdcreateform)
function set_config(r);
begin
clear_config();
if not ifarray(r) then return ;
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"] ;
@@ -79,13 +102,8 @@ type t_compile_config=class(tdcreateform)
ed_include_s.text := r["extresource"];
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_ico.text := r["buildico"];
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
+12 -1
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;