From ac764151ffdfa1e3568d788b01b0e227b7f13670 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Mon, 6 Nov 2023 11:21:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化编译选项 --- .../ctl_mgr/resource.tfm/t_compile_config.tfm | 70 +++++++++++----- designer/ctl_mgr/resource.tfm/t_dir_list.tfm | 7 ++ designer/ctl_mgr/t_compile_config.tsf | 79 ++++++++++++++++--- designer/ctl_mgr/t_dir_list.tsf | 13 ++- designer/utslcodeeditor.tsf | 14 ++-- designer/utslvcldcomponents.tsf | 55 ++++++++----- 6 files changed, 179 insertions(+), 59 deletions(-) diff --git a/designer/ctl_mgr/resource.tfm/t_compile_config.tfm b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm index 4e1aa6b..e779696 100644 --- a/designer/ctl_mgr/resource.tfm/t_compile_config.tfm +++ b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm @@ -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 \ No newline at end of file diff --git a/designer/ctl_mgr/resource.tfm/t_dir_list.tfm b/designer/ctl_mgr/resource.tfm/t_dir_list.tfm index 092d19c..1c34b23 100644 --- a/designer/ctl_mgr/resource.tfm/t_dir_list.tfm +++ b/designer/ctl_mgr/resource.tfm/t_dir_list.tfm @@ -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 \ No newline at end of file diff --git a/designer/ctl_mgr/t_compile_config.tsf b/designer/ctl_mgr/t_compile_config.tsf index 0ecfac4..908c3cf 100644 --- a/designer/ctl_mgr/t_compile_config.tsf +++ b/designer/ctl_mgr/t_compile_config.tsf @@ -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 diff --git a/designer/ctl_mgr/t_dir_list.tsf b/designer/ctl_mgr/t_dir_list.tsf index ed77b68..f4b4282 100644 --- a/designer/ctl_mgr/t_dir_list.tsf +++ b/designer/ctl_mgr/t_dir_list.tsf @@ -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; diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index fb83214..2fff8ae 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -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 @@ -2228,8 +2228,7 @@ type TEditer=class(TCustomcontrol) // if plg[i]=fio then begin ot := plg[1:i]+it.scriptname+hz; - break; - + break; end end ds := getlibpathstr(); @@ -5206,8 +5205,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) // return true; end function build(dir,d); - begin - + begin plg := pluginpath(); fio := ioFileseparator(); for i := length(plg)-1 downto 1 do @@ -5308,11 +5306,12 @@ type TEditerEchoWnd=class(TSynMemoNorm) // r+="-libpath "+d["libpath"]+" "; end else - r+="-libpath ."+ioFileseparator()+" "; + 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"); @@ -5322,7 +5321,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) // if d["strong"] then r+= " -strong"; if d["buildgui"] then r+= " -buildgui"; return r; - end + end function f_b_a_param(d,n); begin dn := d[n]; @@ -5336,6 +5335,7 @@ type TEditerEchoWnd=class(TSynMemoNorm) // end return r; end + public end type tfincodemap = class(tcustomcontrol) function create(AOwner); diff --git a/designer/utslvcldcomponents.tsf b/designer/utslvcldcomponents.tsf index bd39010..6f68198 100644 --- a/designer/utslvcldcomponents.tsf +++ b/designer/utslvcldcomponents.tsf @@ -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