编辑器

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

View File

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

View File

@ -41,6 +41,10 @@ type t_compile_config=class(tdcreateform)
ed_include_f:tedit; ed_include_f:tedit;
label5:tlabel; label5:tlabel;
ed_exclude_f:tedit; ed_exclude_f:tedit;
lb_tsg:tlabel;
ed_tsg:tedit;
bt_tsgadd:tbtn;
bt_cmd:tbtn;
function Create(AOwner);override; //¹¹Ôì function Create(AOwner);override; //¹¹Ôì
begin begin
f_sep := iofileseparator(); f_sep := iofileseparator();
@ -54,7 +58,20 @@ type t_compile_config=class(tdcreateform)
m_list_editor.Visible := false; m_list_editor.Visible := false;
m_list_editor.parent := self; m_list_editor.parent := self;
end 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; function bt_cancel_clk(o;e);virtual;
begin begin
@ -67,7 +84,13 @@ type t_compile_config=class(tdcreateform)
function set_config(r); function set_config(r);
begin begin
clear_config(); 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"]; e_script.text := r["buildfile"];
ed_output.text := r["output"]; ed_output.text := r["output"];
ed_out_f.text := r["exports"] ; ed_out_f.text := r["exports"] ;
@ -79,13 +102,8 @@ type t_compile_config=class(tdcreateform)
ed_include_s.text := r["extresource"]; ed_include_s.text := r["extresource"];
ck_strong.Checked := r["strong"] ; ck_strong.Checked := r["strong"] ;
ck_gui.Checked := r["buildgui"] ; ck_gui.Checked := r["buildgui"] ;
ed_ico.text := r["buildico"]; ed_ico.text := r["buildico"];
case r["build"] of ed_tsg.text := r["pkg"];
"--buildlib":cb_type.ItemIndex := 1;
"--build":cb_type.ItemIndex := 2;
else
cb_type.ItemIndex := 0;
end
//ck_s_rp.Checked := r["resourcekeepdir"]; //ck_s_rp.Checked := r["resourcekeepdir"];
end end
function get_config(); function get_config();
@ -109,6 +127,7 @@ type t_compile_config=class(tdcreateform)
r["buildgui"] := ck_gui.Checked; r["buildgui"] := ck_gui.Checked;
r["buildico"] := ed_ico.text; r["buildico"] := ed_ico.text;
r["resourcekeepdir"] := ck_s_rp.Checked; r["resourcekeepdir"] := ck_s_rp.Checked;
r["pgk"] := ed_tsg.text;
return r; return r;
end end
function clear_config();//ÇåÀí function clear_config();//ÇåÀí
@ -221,11 +240,12 @@ type t_compile_config=class(tdcreateform)
invoke(self,v["name"],nil); invoke(self,v["name"],nil);
end end
end end
function show_dir_list(data); function show_dir_list(data,filetype);
begin begin
dir_list.Left := Left-20; dir_list.Left := Left-20;
dir_list.top := top+50; dir_list.top := top+50;
dir_list.set_dirs(data); dir_list.set_dirs(data);
dir_list.fopentype := filetype;
return dir_list.ShowModal(); return dir_list.ShowModal();
end end
function show_m_editor(data); function show_m_editor(data);
@ -294,7 +314,6 @@ type t_compile_config=class(tdcreateform)
end end
if i>0 then if i>0 then
begin begin
if i=length(fbasedirarray)-1 then return "."+f_sep;
return array2str( da[i:],f_sep); return array2str( da[i:],f_sep);
end end
return d; return d;
@ -378,4 +397,42 @@ type t_compile_config=class(tdcreateform)
fbasedirarray := str2array(v,f_sep); fbasedirarray := str2array(v,f_sep);
end end
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 end

View File

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

View File

@ -2220,7 +2220,7 @@ type TEditer=class(TCustomcontrol) //
{$endif} {$endif}
end end
r["buildfile"] := f; r["buildfile"] := f;
r["resourcepat"] := "*.ini,*.tfm";
fio := ioFileseparator(); fio := ioFileseparator();
plg := pluginpath(); plg := pluginpath();
for i := length(plg)-1 downto 1 do for i := length(plg)-1 downto 1 do
@ -2228,8 +2228,7 @@ type TEditer=class(TCustomcontrol) //
if plg[i]=fio then if plg[i]=fio then
begin begin
ot := plg[1:i]+it.scriptname+hz; ot := plg[1:i]+it.scriptname+hz;
break; break;
end end
end end
ds := getlibpathstr(); ds := getlibpathstr();
@ -5206,8 +5205,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
return true; return true;
end end
function build(dir,d); function build(dir,d);
begin begin
plg := pluginpath(); plg := pluginpath();
fio := ioFileseparator(); fio := ioFileseparator();
for i := length(plg)-1 downto 1 do for i := length(plg)-1 downto 1 do
@ -5308,11 +5306,12 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
r+="-libpath "+d["libpath"]+" "; r+="-libpath "+d["libpath"]+" ";
end else end else
r+="-libpath ."+ioFileseparator()+" "; r+="-libpath ."+ioFileseparator()+" ";
r += f_b_a_param(d,"exports"); r += f_b_a_param(d,"exports");
r += f_b_a_param(d,"dependsdir"); r += f_b_a_param(d,"dependsdir");
r += f_b_a_param(d,"depends"); r += f_b_a_param(d,"depends");
r += f_b_a_param(d,"excludes"); 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,"resourcedir");
r += f_b_a_param(d,"resourcepat"); r += f_b_a_param(d,"resourcepat");
r += f_b_a_param(d,"extresource"); r += f_b_a_param(d,"extresource");
@ -5322,7 +5321,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
if d["strong"] then r+= " -strong"; if d["strong"] then r+= " -strong";
if d["buildgui"] then r+= " -buildgui"; if d["buildgui"] then r+= " -buildgui";
return r; return r;
end end
function f_b_a_param(d,n); function f_b_a_param(d,n);
begin begin
dn := d[n]; dn := d[n];
@ -5336,6 +5335,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) //
end end
return r; return r;
end end
public
end end
type tfincodemap = class(tcustomcontrol) type tfincodemap = class(tcustomcontrol)
function create(AOwner); function create(AOwner);

View File

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