From 33f86eb0123bebff92479a567f976db891da4168 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Thu, 26 Oct 2023 10:34:02 +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 | 324 +++++++++++++++ designer/ctl_mgr/resource.tfm/t_dir_list.tfm | 48 +++ .../ctl_mgr/resource.tfm/t_m_list_editor.tfm | 40 ++ designer/ctl_mgr/t_compile_config.tsf | 381 ++++++++++++++++++ designer/ctl_mgr/t_dir_list.tsf | 58 +++ designer/ctl_mgr/t_m_list_editor.tsf | 59 +++ designer/gettsleditorstart.tsf | 8 +- designer/teditorform.tsf | 27 +- designer/udesignerproject.tsf | 64 ++- designer/utslcodeeditor.tsf | 175 +++++++- designer/utslvcldebuger.tsf | 10 +- designer/utslvcldesigner.tsf | 2 +- funcext/tvclib/utslvclstdctl.tsf | 25 +- 13 files changed, 1204 insertions(+), 17 deletions(-) create mode 100644 designer/ctl_mgr/resource.tfm/t_compile_config.tfm create mode 100644 designer/ctl_mgr/resource.tfm/t_dir_list.tfm create mode 100644 designer/ctl_mgr/resource.tfm/t_m_list_editor.tfm create mode 100644 designer/ctl_mgr/t_compile_config.tsf create mode 100644 designer/ctl_mgr/t_dir_list.tsf create mode 100644 designer/ctl_mgr/t_m_list_editor.tsf diff --git a/designer/ctl_mgr/resource.tfm/t_compile_config.tfm b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm new file mode 100644 index 0000000..4e1aa6b --- /dev/null +++ b/designer/ctl_mgr/resource.tfm/t_compile_config.tfm @@ -0,0 +1,324 @@ +object ed_script:t_compile_config + caption="±àÒëÑ¡ÏîÉèÖÃ" + height=631 + left=618 + minmaxbox=false + onclose=compile_config_close + top=180 + width=502 + wssizebox=false + object bt_ok:tbtn + caption="È·¶¨" + height=31 + left=365 + onclick=bt_ok_clk + parentcolor=false + top=551 + width=98 + end + object gp_dir:tgroupbox + caption="ÊäÈëĿ¼" + height=94 + left=24 + parentcolor=true + top=186 + width=442 + object bt_f_dir:tbtn + caption=".." + height=23 + left=408 + onclick=bt_f_dir_clk + top=20 + width=24 + end + object bt_s_dir:tbtn + caption="..." + height=23 + left=408 + onclick=bt_s_dir_clk + top=51 + width=24 + end + object label1:tlabel + left=14 + top=20 + width=68 + height=23 + caption="º¯ÊýĿ¼" + end + object ed_f_dirs:tedit + caption="edit1" + height=22 + left=87 + top=21 + width=312 + end + object label2:tlabel + left=13 + top=51 + width=60 + height=23 + caption="×ÊԴĿ¼" + end + object ed_s_dirs:tedit + caption="edit2" + height=23 + left=87 + top=51 + width=311 + end + end + object gp_filter:tgroupbox + caption="ɸѡ" + height=145 + left=27 + parentcolor=true + top=288 + width=437 + object lb_s_type:tlabel + left=11 + top=20 + width=92 + height=25 + caption="×ÊÔ´Îļþºó׺" + end + object ed_s_type:tedit + caption="edit2" + height=27 + left=112 + text="*.tfm,*.ini" + top=20 + width=290 + end + object bt_i_f:tbtn + caption="..." + height=24 + left=408 + onclick=bt_i_f_clk + top=83 + width=21 + end + object bt_d_f:tbtn + caption="..." + height=24 + left=408 + onclick=bt_d_f_clk + top=114 + width=21 + end + object bt_i_s:tbtn + caption="..." + height=25 + left=408 + onclick=bt_i_s_clk + top=52 + width=21 + end + object label3:tlabel + left=13 + top=51 + width=61 + height=25 + caption="Ö¸¶¨×ÊÔ´" + end + object ed_include_s:tedit + caption="edit1" + height=25 + left=84 + top=52 + width=317 + end + object label4:tlabel + left=11 + top=83 + width=63 + height=25 + caption="Ö¸¶¨º¯Êý" + end + object ed_include_f:tedit + caption="" + height=25 + left=84 + top=83 + width=317 + end + object label5:tlabel + left=13 + top=113 + width=61 + height=25 + caption="Åųýº¯Êý" + end + object ed_exclude_f:tedit + caption="" + height=25 + left=84 + top=114 + width=317 + end + end + object gp_out:tgroupbox + caption="Êä³ö" + height=123 + left=27 + parentcolor=true + top=48 + width=433 + object lb_ype:tlabel + left=14 + top=17 + width=53 + height=25 + caption="ÀàÐÍ" + end + object cb_type:tcombobox + caption="combobox1" + height=23 + itemindex=0 + items=["Ö´ÐгÌÐò" "¶¯Ì¬¿â" tsg ] + left=79 + onselchanged=cb_type_sel + top=18 + width=131 + end + object lb_output:tlabel + left=13 + top=45 + width=46 + height=25 + caption="Êä³ö" + end + object ed_output:tedit + caption="edit1" + height=25 + left=79 + placeholder="Êä³öÎļþ" + top=48 + width=320 + end + object bt_output:tbtn + caption="..." + enabled=false + height=23 + left=404 + onclick=bt_output_clk + top=86 + width=22 + end + object bt_outputname:tbtn + caption="..." + height=25 + left=404 + onclick=bt_outputname_clk + top=48 + width=22 + end + object lb_output_f:tlabel + left=14 + top=83 + width=60 + height=25 + caption="Êä³öº¯Êý" + end + object ed_out_f:tedit + caption="edit1" + height=25 + left=79 + top=86 + width=320 + end + end + object bt_cancel:tbtn + caption="È¡Ïû" + height=31 + left=247 + onclick=bt_cancel_clk + top=551 + width=94 + end + object gp_other:tgroupbox + caption="ÆäËû" + height=100 + left=28 + parentcolor=true + top=442 + width=437 + object ck_gui:tcheckbtn + caption="gui" + height=25 + left=17 + top=25 + width=75 + end + object ck_strong:tcheckbtn + caption="Ç¿ÒýÓú¯Êý" + height=25 + left=122 + onclick=checkbtn2_clk + top=25 + width=98 + end + object ck_s_rp:tcheckbtn + caption="×ÊÔ´Îļþ±£ÁôÏà¶Ô·¾¶" + enabled=false + height=25 + left=253 + top=25 + width=173 + end + object lb_ico:tlabel + left=17 + top=64 + width=39 + height=25 + caption="ͼ±ê" + end + object ed_ico:tedit + caption="edit3" + height=25 + left=63 + top=64 + width=249 + end + object bt_ico:tbtn + caption="..." + height=25 + left=319 + onclick=bt_ico_clk + top=64 + width=22 + end + end + object f_op:topenfileadlg + left=124 + top=556 + height=30 + width=30 + caption="openfileadlg1" + filter=< + "icoͼ±ê"="*.ico" + > + end + object lb_input:tlabel + left=32 + top=16 + width=63 + height=25 + caption="Ö÷³ÌÐò" + end + object e_script:tedit + caption="edit1" + height=25 + left=98 + top=16 + width=331 + end + object bt_script:tbtn + caption="..." + height=25 + left=437 + onclick=bt_script_clk + top=16 + width=22 + 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 new file mode 100644 index 0000000..092d19c --- /dev/null +++ b/designer/ctl_mgr/resource.tfm/t_dir_list.tfm @@ -0,0 +1,48 @@ +object dir_list:t_dir_list + caption="Ŀ¼¹ÜÀí" + height=228 + left=513 + minmaxbox=false + onclose=dir_list_close + top=475 + visible=false + width=615 + object lst_dir:tlistbox + caption="listbox1" + height=176 + left=10 + top=2 + width=474 + end + object btn_add:tbtn + caption="Ìí¼Ó" + height=31 + left=496 + onclick=btn_add_clk + top=5 + width=86 + end + object btn_del:tbtn + caption="ɾ³ý" + height=31 + left=496 + onclick=btn_del_clk + top=50 + width=86 + end + object btn_ok:tbtn + caption="Íê³É" + height=31 + left=496 + onclick=btn_ok_clk + top=146 + width=86 + end + object f_d:tfolderchooseadlg + left=508 + top=95 + height=30 + width=30 + caption="folderchooseadlg1" + end +end \ No newline at end of file diff --git a/designer/ctl_mgr/resource.tfm/t_m_list_editor.tfm b/designer/ctl_mgr/resource.tfm/t_m_list_editor.tfm new file mode 100644 index 0000000..b6a87e8 --- /dev/null +++ b/designer/ctl_mgr/resource.tfm/t_m_list_editor.tfm @@ -0,0 +1,40 @@ +object m_list_editor:t_m_list_editor + caption="±à¼­" + height=506 + left=572 + minmaxbox=false + onclose=m_list_editor_close + top=275 + width=366 + wssizebox=false + object lb_tip:tlabel + left=7 + top=2 + width=325 + height=25 + caption="²ÉÓû»Ðзָî" + end + object m_list:tmemo + caption="memo1" + height=378 + left=9 + top=31 + width=328 + end + object bt_cancel:tbtn + caption="È¡Ïû" + height=31 + left=126 + onclick=bt_cancel_clk + top=420 + width=94 + end + object bt_ok:tbtn + caption="È·¶¨" + height=31 + left=240 + onclick=bt_ok_clk + top=419 + width=94 + 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 new file mode 100644 index 0000000..0ecfac4 --- /dev/null +++ b/designer/ctl_mgr/t_compile_config.tsf @@ -0,0 +1,381 @@ +type t_compile_config=class(tdcreateform) + uses tslvcl; + bt_ok:tbtn; + gp_dir:tgroupbox; + bt_f_dir:tbtn; + bt_s_dir:tbtn; + gp_filter:tgroupbox; + lb_s_type:tlabel; + ed_s_type:tedit; + bt_i_f:tbtn; + bt_d_f:tbtn; + gp_out:tgroupbox; + lb_ype:tlabel; + cb_type:tcombobox; + lb_output:tlabel; + ed_output:tedit; + bt_cancel:tbtn; + gp_other:tgroupbox; + ck_gui:tcheckbtn; + ck_strong:tcheckbtn; + ck_s_rp:tcheckbtn; + bt_i_s:tbtn; + lb_ico:tlabel; + ed_ico:tedit; + bt_ico:tbtn; + bt_output:tbtn; + f_op:topenfileadlg; + lb_input:tlabel; + e_script:tedit; + bt_script:tbtn; + bt_outputname:tbtn; + lb_output_f:tlabel; + ed_out_f:tedit; + label1:tlabel; + ed_f_dirs:tedit; + label2:tlabel; + ed_s_dirs:tedit; + label3:tlabel; + ed_include_s:tedit; + label4:tlabel; + ed_include_f:tedit; + label5:tlabel; + ed_exclude_f:tedit; + function Create(AOwner);override; //¹¹Ôì + begin + f_sep := iofileseparator(); + fbasedirarray := array(); + inherited; + //set_base_dir(%% E:\TSUIGROUP\designer\ctl_mgr\%%); + dir_list := new t_dir_list(self); + dir_list.Visible := false; + dir_list.parent := self; + m_list_editor := new t_m_list_editor(self); + m_list_editor.Visible := false; + m_list_editor.parent := self; + end + + + function bt_cancel_clk(o;e);virtual; + begin + EndModal(0); + end + function bt_ok_clk(o;e);virtual; + begin + EndModal(1); + end + function set_config(r); + begin + clear_config(); + if not ifarray(r) then return ; + e_script.text := r["buildfile"]; + ed_output.text := r["output"]; + ed_out_f.text := r["exports"] ; + ed_f_dirs.text := r["dependsdir"]; + ed_include_f.text := r["depends"]; + ed_exclude_f.text := r["excludes"]; + ed_s_dirs.text := r["resourcedir"]; + ed_s_type.text := r["resourcepat"]; + 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 + //ck_s_rp.Checked := r["resourcekeepdir"]; + end + function get_config(); + begin + r := array(); + case cb_type.ItemIndex of + 0: r["build"] := "--buildexe"; + 1: r["build"] := "--buildlib"; + 2: r["build"] := "--build"; + end + r["buildfile"] := e_script.text; + r["output"] := ed_output.text; + r["exports"] := ed_out_f.text; + r["dependsdir"]:=ed_f_dirs.text; + r["depends"]:=ed_include_f.text; + r["excludes"] := ed_exclude_f.text; + r["resourcedir"] := ed_s_dirs.text; + r["resourcepat"] := ed_s_type.text; + r["extresource"]:=ed_include_s.text; + r["strong"] := ck_strong.Checked; + r["buildgui"] := ck_gui.Checked; + r["buildico"] := ed_ico.text; + r["resourcekeepdir"] := ck_s_rp.Checked; + return r; + end + function clear_config();//ÇåÀí + begin + e_script.text := ""; + ed_output.text := ""; + ed_out_f.text := ""; + ed_f_dirs.text := ""; + ed_include_f.text := ""; + ed_exclude_f.text := ""; + ed_s_dirs.text := ""; + ed_s_type.text := ""; + ed_include_s.text := ""; + ck_strong.Checked := ""; + ck_gui.Checked := ""; + ed_ico.text := ""; + ck_s_rp.Checked := ""; + end + function bt_outputname_clk(o;e);virtual; + begin + f_op.filter := array(get_type():"*"+get_type()); + if f_op.OpenDlg()then + begin + ed_output.text :=relative_path( f_op.filename); + end + end + function cb_type_sel(o;e);virtual; + begin + ab := 0 = o.ItemIndex; + bt_ico.Enabled := ab; + ed_ico.Enabled := ab; + bt_output.Enabled := not ab; + ed_out_f.Enabled := not ab; + lb_output_f.Enabled := not ab; + ed_output.text := createoutputname(ed_output.text); + end + function bt_script_clk(o;e);virtual; + begin + f_op.filter := array("tsl½Å±¾":"*.tsf;*.tsl"); + if f_op.OpenDlg()then + begin + e_script.text := relative_path( f_op.filename); + end + end + + function bt_ico_clk(o;e);virtual; + begin + f_op.filter := array("icoͼ±ê":"*.ico"); + if f_op.OpenDlg()then + begin + ed_ico.text := relative_path( f_op.filename); + end + end + function bt_d_f_clk(o;e);virtual; + begin + if show_m_editor(s_to_array(ed_exclude_f.text))then + begin + ed_exclude_f.text := array_to_s(m_list_editor.get_data()); + end + end + function bt_i_f_clk(o;e);virtual; + begin + if show_m_editor(s_to_array(ed_include_f.text))then + begin + ed_include_f.text := array_to_s(m_list_editor.get_data()); + end + end + function bt_i_s_clk(o;e);virtual; + begin + if show_m_editor(s_to_array(ed_include_s.text))then + begin + ed_include_s.text := array_to_s(m_list_editor.get_data()); + end + end + function bt_output_clk(o;e); + begin + if show_m_editor(s_to_array(ed_out_f.text))then + begin + ed_out_f.text := array_to_s(m_list_editor.get_data()); + end + end + + function bt_s_dir_clk(o;e); + begin + if show_dir_list(s_to_array(ed_s_dirs.text,true))then + begin + ed_s_dirs.text := array_to_s(dir_list.get_dirs(),true); + end + end + function bt_f_dir_clk(o;e); + begin + if show_dir_list(s_to_array(ed_f_dirs.text,true))then + begin + ed_f_dirs.text := array_to_s(dir_list.get_dirs(),true); + end + end + function compile_config_close(o;e);virtual; + begin + e.skip := true; + EndModal(0); + end + function Recycling();override; //»ØÊÕ±äÁ¿ + begin + inherited; + ci := self.classinfo(); //½«³ÉÔ±±äÁ¿¸³ÖµÎªnil±ÜÃâÑ­»·ÒýÓà + for i,v in ci["members"] do + begin + if v["const"]then continue; + if v["static"]then continue; + invoke(self,v["name"],nil); + end + end + function show_dir_list(data); + begin + dir_list.Left := Left-20; + dir_list.top := top+50; + dir_list.set_dirs(data); + return dir_list.ShowModal(); + end + function show_m_editor(data); + begin + m_list_editor.Left := Left-20; + m_list_editor.top := top+50; + m_list_editor.set_data(data); + return m_list_editor.ShowModal(); + end + function enabled_script_input(f); + begin + e_script.Enabled := f; + bt_script.Enabled := f; + end + function set_data(d); + begin + if ifarray(d) then + begin + f_data := d; + end + end + published + property base_dir read fbasedir write set_base_dir; + dir_list; + m_list_editor; + private + fbasedir; + fbasedirarray; + f_data; + f_sep; + function s_to_array(s,ph); + begin + data := array(); + for i,v in str2array( s,",") do + begin + vi := trim(v); + if vi then data[length(data)] := ph? abstruct_path(v):v; + end + return data; + end + function array_to_s(data,ph); + begin + r := ""; + for i,v in data do + begin + r+= (ph?relative_path(v):v)+","; + end + return r; + end + function relative_path(d); + begin + if not(fbasedirarray) then return d; + da := str2array(d, f_sep); + for i := 0 to min(length(da),length(fbasedirarray))-1 do + begin + if dirnequ(da[i],fbasedirarray[i]) then + begin + if i>0 then + begin + return createpdir(length(fbasedirarray)-i-1)+ array2str( da[i:],f_sep); + end else + begin + return d; + end + end + end + if i>0 then + begin + if i=length(fbasedirarray)-1 then return "."+f_sep; + return array2str( da[i:],f_sep); + end + return d; + end + function abstruct_path(d);//¾ø¶Ô·¾¶ + begin + if not(fbasedirarray) then return d; + da := str2array(d,f_sep); + for i := 0 to length(da)-1 do + begin + if i=0 and da[i]="." then + begin + return array2str((fbasedirarray[0:(length(fbasedirarray)-2)] union da[1:]),f_sep); + end + if da[i]<>".."then + begin + if i>0 then + return array2str( fbasedirarray[0:(length(fbasedirarray)-i-2)] union da[i:],f_sep); + else return d; + end + end + return d; + end + function createpdir(n); + begin + r :=""; + if n<1 then return "."+f_sep; + for i:=1 to n do + begin + r+=".."+f_sep; + end + return r; + end + function dirnequ(v1,v2); + begin + {$ifdef linux} + return v1<>v2; + {$else} + return lowercase(v1)<>lowercase(v2); + {$endif} + + end + function get_type(); + begin + idx := cb_type.ItemIndex; + {$ifdef linux} + case idx of + 0:tp:=".out"; + 1:tp:=".so"; + 2:tp:=".tsg"; + end; + {$else} + + case idx of + 0:tp:=".exe"; + 1:tp:=".dll"; + 2:tp:=".tsg"; + end; + {$endif} + return tp; + end + function createoutputname(n); + begin + tp := get_type(); + for i:= length(n) downto 1 do + begin + if n[i]="." and i>1 then + begin + nv := n[1:(i-1)]; + break; + end + end + if not nv then nv := "."+iofileseparator()+"default"; + return nv+tp; + end + function set_base_dir(v); + begin + if fbasedir<>v then + begin + fbasedir := v; + fbasedirarray := str2array(v,f_sep); + end + end +end diff --git a/designer/ctl_mgr/t_dir_list.tsf b/designer/ctl_mgr/t_dir_list.tsf new file mode 100644 index 0000000..ed77b68 --- /dev/null +++ b/designer/ctl_mgr/t_dir_list.tsf @@ -0,0 +1,58 @@ +type t_dir_list=class(tdcreateform) + uses tslvcl; + lst_dir:tlistbox; + btn_add:tbtn; + btn_del:tbtn; + btn_ok:tbtn; + f_d:tfolderchooseadlg; + function Create(AOwner);override; //¹¹Ôì + begin + inherited; + end + function btn_ok_clk(o;e);virtual; + begin + //Visible := false; + EndModal(1); + end + function btn_del_clk(o;e);virtual; + begin + idx := lst_dir.ItemIndex; + if idx>=0 then + begin + lst_dir.DeleteItem(idx); + end + end + function btn_add_clk(o;e);virtual; + begin + if f_d.OpenDlg() then + begin + r := f_d.Folder; + if r[length(r)]<>iofileseparator() then r+=iofileseparator(); + lst_dir.AppendItem(r); + end + end + function get_dirs(); + begin + return lst_dir.Items; + end + function set_dirs(ls); + begin + lst_dir.Items := ls; + end + function dir_list_close(o;e);virtual; + begin + e.skip := true; + EndModal(0); + end + function Recycling();override; //»ØÊÕ±äÁ¿ + begin + inherited; + ci := self.classinfo(); //½«³ÉÔ±±äÁ¿¸³ÖµÎªnil±ÜÃâÑ­»·ÒýÓà + for i,v in ci["members"] do + begin + if v["const"] then continue; + if v["static"] then continue; + invoke(self,v["name"],nil); + end + end +end diff --git a/designer/ctl_mgr/t_m_list_editor.tsf b/designer/ctl_mgr/t_m_list_editor.tsf new file mode 100644 index 0000000..5996f6c --- /dev/null +++ b/designer/ctl_mgr/t_m_list_editor.tsf @@ -0,0 +1,59 @@ +type t_m_list_editor=class(tdcreateform) + uses tslvcl; + lb_tip:tlabel; + m_list:tmemo; + bt_cancel:tbtn; + bt_ok:tbtn; + function Create(AOwner);override; //¹¹Ôì + begin + inherited; + end + + function set_data(d); + begin + m_list.text := ""; + s :=""; + for i,v in d do + begin + s+=v; + s+="\r\n"; + end + m_list.text := s; + end + function get_data(); + begin + s := m_list.text; + r := array(); + for i,v in str2array(s,"\r\n") do + begin + vi := trim(v); + if vi then r[length(r)] := vi; + end + return r; + end + function bt_ok_clk(o;e);virtual; + begin + EndModal(1); + end + + function bt_cancel_clk(o;e);virtual; + begin + EndModal(0); + end + function m_list_editor_close(o;e);virtual; + begin + e.skip := true; + EndModal(0); + end + function Recycling();override; //»ØÊÕ±äÁ¿ + begin + inherited; + ci := self.classinfo(); //½«³ÉÔ±±äÁ¿¸³ÖµÎªnil±ÜÃâÑ­»·ÒýÓà + for i,v in ci["members"] do + begin + if v["const"] then continue; + if v["static"] then continue; + invoke(self,v["name"],nil); + end + end +end diff --git a/designer/gettsleditorstart.tsf b/designer/gettsleditorstart.tsf index 67bf5ff..83eec70 100644 --- a/designer/gettsleditorstart.tsf +++ b/designer/gettsleditorstart.tsf @@ -33,21 +33,23 @@ begin if (i<=sysparamcount())and ("-install" = sysparamstr(i) ) then //×¢²áÓÒ¼ü´ò¿ª begin InStallToMenu(); - //return sleep(5000); //Í£Áô8Ãë + //return sleep(5000); //Í£Áô5Ãë echo "\r\n press enter exit"; + sleep(5000); return readln(); end else if (i<=sysparamcount())and ("-uninstall" = sysparamstr(i) ) then //Ð¶ÔØÓÒ¼ü´ò¿ª begin UnInStallToMenu(); echo "\r\n press enter exit"; + sleep(5000); //Í£Áô5Ãë return readln(); end end -if sysparamcount()=0 then //´¦Àíµ¥¶ÀÒ»¸öÎļþ +if (sysparamcount()=0) or (sysparamcount()=1) then //´¦Àíµ¥¶ÀÒ»¸öÎļþ begin - ops := sysparamstr(0); + ops := sysparamstr(sysparamcount()); if lowercase(SysExecName())=lowercase(ops) then //´¦Àí±àÒë³Éexe µ¼Ö²ÎÊý´ÎÐòÎÊÌâ begin ops := nil; diff --git a/designer/teditorform.tsf b/designer/teditorform.tsf index 1116b00..0f7cb52 100644 --- a/designer/teditorform.tsf +++ b/designer/teditorform.tsf @@ -317,12 +317,33 @@ type teditorform = class(TVCform) // begin FEdter.ExecutePageItem(FEdter.GetCurrentItem()); end - for i,v in array("ÃüÁîÐÐÅäÖÃ","tslº¯ÊýĿ¼","Ö´ÐÐ","µ÷ÊÔÔËÐÐ","Ô¶³Ìµ÷ÊÔ","Ô¶³Ìµ÷ÊÔ(waitattach)") do + for i,v in array("ÃüÁîÐÐÅäÖÃ","µ÷ÊÔÆ÷","tslº¯ÊýĿ¼","Ö´ÐÐ","µ÷ÊÔÔËÐÐ","Ô¶³Ìµ÷ÊÔ","Ô¶³Ìµ÷ÊÔ(waitattach)","±àÒ뵱ǰ½Å±¾") do begin it := new TMenu(self); if v = "Ö´ÐÐ" then begin it.Action := FExeaction; + end + if v="µ÷ÊÔÆ÷" then + begin + it.caption := v; + ite := new TMenu(self); + ite.caption := "±à¼­Æ÷"; + ite.Checked := true; + ite.Parent := it; + itb := new TMenu(self); + itb.caption := "µ±Ç°Ö´ÐгÌÐò"; + itb.Parent := it; + itb._tag := ite; + ite._tag := itb; + f := function(o,e)begin + o.Checked := true; + o._tag.Checked := false; + global g_debug_chooser; + g_debug_chooser := o.caption; + end + ite.OnClick := f; + itb.OnClick := f; end else begin it.caption := v; @@ -650,6 +671,10 @@ type teditorform = class(TVCform) // function clickRun(o,e); begin case o.caption of + "±àÒ뵱ǰ½Å±¾": + begin + FEdter.buildpageitem(FEdter.GetCurrentItem()); + end "ÃüÁîÐÐÅäÖÃ": begin FEdter.ShowExeEditer(); diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index b06870a..c5e6860 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -1528,7 +1528,57 @@ end if it then FTslEditer.DebugPageItem(it); return; end - + compile_config; + fcompier; + function get_config_info(); + begin + f := FCProjectPath+"!buildconfig.stm"; + if importfile(ftstream(),"",f,r) =1 then + begin + + end + if not ifarray(r) then + begin + r := array(); + r["build"] := "--buildexe"; + r["buildfile"] := "."+"\\"+FExecEntry+".tsl"; + r["output"] := "."+"\\"+FExecEntry+".exe"; + r["exports"] := ""; + r["dependsdir"]:=".\\"; + r["depends"]:=""; + r["excludes"] := ""; + r["resourcedir"] := ".\\"; + r["resourcepat"] := "*.tfm"; + r["extresource"]:=""; + r["strong"] := true; + r["buildgui"] := true; + r["buildico"] := ""; + end + iof := ioFileseparator(); + if iof<>"\\" then + begin + for i,v in mrows(r,1) do + begin + if ifstring(r[v]) then + r[v] := replacetext(r[v],"\\",iof); + end + end + return r; + end + function save_config_info(d); + begin + if not ifarray(d) then return ; + f := FCProjectPath+"!buildconfig.stm"; + iof := ioFileseparator(); + if iof<>"\\" then + begin + for i,v in mrows(d,1) do + begin + if ifstring(d[v]) then d[v] := replacetext(d[v],iof,"\\") ; + end + end + exportfile(ftstream(),"",f,d); + end function WrapTo(); begin if not FMainForm then @@ -1536,10 +1586,14 @@ end messageboxa("¹¤³Ìδ´ò¿ª","Ìáʾ",0,self); exit; end - {$ifdef linux} - messageboxa("linuxϵͳ²»Ö§³Ö´ò°ü","Ìáʾ",0,self); - exit; - {$endif} + d := get_config_info(); + ShowEditor(); + d := FTslEditer.build_with_data(FCProjectPath,d); + if d then + begin + save_config_info(d); + end + return ; fio := ioFileseparator(); if FWrapFolder.opendlg() then begin diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index ceb1ed4..a5de95b 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -1150,6 +1150,7 @@ type TPageEditerItem=class(TPageItem) published property scripttype read Fscripttype write setFscripttype; property ScriptPath read FScriptPath write SetScriptPath; //ÎļþÃû + property scriptname read fscriptname; property OrigScriptPath read FOrgScriptPath; property TslSynText read FTslSynText write FTslSynText; property LastText read FLastVersion; //×îеİ汾 @@ -1546,6 +1547,7 @@ type TPageEditerItem=class(TPageItem) return ftslparser2.gettslfunctions(); end private + fscriptname; ftslparser2; FEnCode; FLastFileTime; @@ -1601,17 +1603,26 @@ type TPageEditerItem=class(TPageItem) function SetScriptPath(v); begin sp := ioFileseparator(); + ddex := 0; if ifstring(v)then begin - for i := length(v)downto 1 do + for i := length(v) downto 1 do begin if v[i]=sp then - begin - Caption := v[i+1:]; + begin + if ddex>i then + begin + fscriptname := v[(i+1):(ddex-1)]; + end else + begin + fscriptname := v[i+1:]; + end + Caption := fscriptname; break; end if v[i]="." then begin + ddex := i; if lowercase(v[i:])in array(".tsl",".tsf")then FTslSynText := true; end end @@ -2183,6 +2194,90 @@ type TEditer=class(TCustomcontrol) // s := FExecuteEditer.GetCurrentExuteString(it.Scriptpath); FEchoWnd.Exec("",s,h); end + compile_config; + function buildpageitem(it); + begin + if not it then return; + ShowEchoWnd(); + if FEchoWnd.Exeing()then return FEchoWnd.Endexe(); + r := array(); + f := it.ScriptPath; + if 1=parseregexpr("\\.tsf$",f,"i",m,mp,ml) then + begin + r["build"] := "--buildlib"; +{$ifdef linux} + hz := ".so" ; +{$else} + hz := ".dll"; +{$endif} + end else + begin + r["build"] := "--buildexe"; +{$ifdef linux} + hz := ".out" ; +{$else} + hz := ".exe"; +{$endif} + end + r["buildfile"] := f; + + fio := ioFileseparator(); + plg := pluginpath(); + for i := length(plg)-1 downto 1 do + begin + if plg[i]=fio then + begin + ot := plg[1:i]+it.scriptname+hz; + break; + + end + end + ds := getlibpathstr(); + + r["libpath"] := ds; + if ot then r["output"] := ot; + r["dependsdir"] := replacetext(ds,";",","); + build_with_data(nil,r); + end + function get_local_pos(x,y); + begin + o := self; + x := 0; + y := 0; + while o and not(o.WSpOPUp) do + begin + o := o.Parent; + end + if o then + begin + x := o.left+100; + y := o.top+20; + end + end + function build_with_data(dir,data); + begin + if not compile_config then + begin + compile_config := new t_compile_config(self); + compile_config.visible := false; + compile_config.parent := self; + fcompier :=1; + end + compile_config.base_dir := dir; + compile_config.set_config(data); + get_local_pos(x,y); + compile_config.left := x; + compile_config.top := y; + if compile_config.ShowModal() then + begin + ndata := compile_config.get_config(); + ShowEchoWnd(); + if FEchoWnd.Exeing()then return FEchoWnd.Endexe(); + FEchoWnd.build(dir,ndata); + return ndata; + end + return false ; + end function SavePageItem(it,f); begin if not it then return -1; @@ -5110,10 +5205,47 @@ type TEditerEchoWnd=class(TSynMemoNorm) // AppendString(s); return true; end + function build(dir,d); + begin + + plg := pluginpath(); + fio := ioFileseparator(); + for i := length(plg)-1 downto 1 do + begin + if plg[i]=fio then + begin +{$ifdef linux} + exe := plg[1:i]+"TSL" ; +{$else} + exe := plg[1:i]+"tsl.exe"; +{$endif} + break; + + end + end + if fileexists("",exe) then + begin + AppendString("build:\r\n"); + cmd := "tsl "+format_build_params(d); + FProcess.StartupDirectory := dir; + FProcess.execstr := true; + self.HighLighter := nil; + AppendString(format('%s %s\r\n',exe,cmd)); + r := FProcess.CreateProcess(exe,cmd); + h := r; + if r=0 then AppendString("±àÒëʧ°Ü!"); + self.HighLighter := F_Highlighter; + return r; + end + + //AppendString(format('%s %s\r\n',exe,cmd)); + end function Exec(exe,cmd,h); begin self.HighLighter := nil; AppendString(format('%s %s\r\n',exe,cmd)); + FProcess.StartupDirectory := ""; + FProcess.execstr := false; r := FProcess.CreateProcess(exe,cmd); h := r; if r=0 then AppendString("Ö´ÐÐʧ°Ü!"); @@ -5167,6 +5299,43 @@ type TEditerEchoWnd=class(TSynMemoNorm) // FIsLocked; FDoLockTime; F_Highlighter; + private + 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,"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); + end + return r; + end end type tfincodemap = class(tcustomcontrol) function create(AOwner); diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index 8b6b7ef..1061b8a 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -1330,7 +1330,15 @@ type TTslDebuga=class(TCustomControl) function getdebuger(pms); //»ñµÃµ÷ÊÔ³ÌÐò begin p := static pluginpath(); - FDebugExe := inireadstring("",p+"localediter.ini","debug","debuger",""); + //FDebugExe := inireadstring("",p+"localediter.ini","debug","debuger",""); + global g_debug_chooser; + if g_debug_chooser="µ±Ç°Ö´ÐгÌÐò" then + begin + FDebugExe := "1"; + end else + begin + + end pms := " "; //if FDebugExe="1" then //ĬÈÏ»ñÈ¡²ÎÊý // begin diff --git a/designer/utslvcldesigner.tsf b/designer/utslvcldesigner.tsf index bbb965a..e4d2944 100644 --- a/designer/utslvcldesigner.tsf +++ b/designer/utslvcldesigner.tsf @@ -490,7 +490,7 @@ type TVclDesigner = class(tvcform) "bitmap":getcreateprojectbmpinfo()), ("type":"menu","caption":"´ò¿ªÀúÊ·","onclick":thisfunction(OpenProjectFromtpj), "bitmap":GetHostroyBimp()), - //("type":"menu","caption":"´ò°üµ½","onclick":thisfunction(WrapProjectTo),"bitmap":getwrapprojectbmpinfo()) + ("type":"menu","caption":"±àÒ빤³Ì","onclick":thisfunction(WrapProjectTo),"bitmap":getwrapprojectbmpinfo()) ) ), ("type":"menu","caption":"ÔËÐÐ","items":( diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index a4d21df..9619d03 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -6802,8 +6802,25 @@ type tcustomprocess = class(tcomponent) // {$endif} ///////////////////////////´¦Àí¹ÜµÀ//////////////////////// Sysexecnewpipe(0); - ferrinfo := nil; - hd := sysexec(e,arg,nil,false,code); + ferrinfo := nil; + sdir :=nil; + if ifstring(fStartupDirectory) and fStartupDirectory then + begin + if fStartupDirectory[length(fStartupDirectory)]=iofileseparator() then + begin + if filelist("",fStartupDirectory+"*") then + begin + sdir := fStartupDirectory; + end + end else + begin + if filelist("",fStartupDirectory) then + begin + sdir := fStartupDirectory+iofileseparator(); + end + end + end + hd := sysexec(e,arg,sdir,false,code); if hd=0 then begin return 0; @@ -6849,7 +6866,8 @@ type tcustomprocess = class(tcomponent) // fonprcstart := nil; fonprocended := nil; end - published + published + property StartupDirectory read fStartupDirectory write fStartupDirectory; property handle read fprocesshandle; property errinfo read ferrinfo; property exename read fexestring; @@ -6865,6 +6883,7 @@ type tcustomprocess = class(tcomponent) // @param(handle)(pointer) ½ø³Ì¾ä±ú %% **} private //³ÉÔ±±äÁ¿ + fStartupDirectory; fexecstr; ferrinfo; fprocesshandle;