From e47352f843d39c7abd3c849554986a4ba63d6a65 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 13 Oct 2023 15:35:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 鍗囩骇 --- designer/gettsleditorstart.tsf | 6 +- designer/udesignerproject.tsf | 2 +- funcext/tvclib/tslvcl.tsf | 13 - funcext/tvclib/utslvclauxiliary.tsf | 321 ++++++++++++++++++ .../tvclib/uvcpropertytypespersistence.tsf | 51 ++- 5 files changed, 367 insertions(+), 26 deletions(-) diff --git a/designer/gettsleditorstart.tsf b/designer/gettsleditorstart.tsf index 3125a3f..67bf5ff 100644 --- a/designer/gettsleditorstart.tsf +++ b/designer/gettsleditorstart.tsf @@ -47,7 +47,11 @@ end if sysparamcount()=0 then //处理单独一个文件 begin - ops := sysparamstr(0); + ops := sysparamstr(0); + if lowercase(SysExecName())=lowercase(ops) then //处理编译成exe 导致参数次序问题 + begin + ops := nil; + end end if ops and ifstring(ops) then begin diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index 8b6436d..b06870a 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -570,7 +570,7 @@ type TProjectView = class(TVCForm) // end else FDelMenu.Enabled := true; FAddMenu.Enabled := false; end - if((it.FType="form")and(it.FName <> FMainForm)and(it.FPath()=""))then + if((it.FType="form")and(it.FName <> FMainForm){and(it.FPath()="")})then begin FSetMainMenu.parent := FTreePopUpMenu; end else diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index 7302181..a9ccd3f 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -6521,19 +6521,6 @@ end /////////////////////////初始化//////////////////////////////////// function initallib(); begin - global g_w_tfm_resource; - g_w_tfm_resource := array(); - try - getglobalcache("@@tsl-resource@@",rs); - for i,v in rs do - begin - if ifstring(i) and ifstring(v) then - begin - g_w_tfm_resource[lowercase(i)] := v; - end - end - except - end class(tUIglobalData).uisetdata("G_F_CONTROL_IS_CUSTOMPAINT",thisfunction(controlisCustomPaint)); class(tUIglobalData).uisetdata("G_F_TWIN_PROC_",thisfunction(_twinproc_)); class(tUIglobalData).uisetdata("G_F_TIME_PROC_",thisfunction(_timeproc_)); diff --git a/funcext/tvclib/utslvclauxiliary.tsf b/funcext/tvclib/utslvclauxiliary.tsf index a0ab439..0ae91ca 100644 --- a/funcext/tvclib/utslvclauxiliary.tsf +++ b/funcext/tvclib/utslvclauxiliary.tsf @@ -2423,6 +2423,327 @@ type tstr_step_match=class() fcacheslen; private end +type t_ini_format_operator=class() + static const type_section=1; + static const type_skey=2; + static const type_value=3; + function create(); + begin + fscript := ""; + factidx := 0; + fscriptlen := 0; + fdata := array(); + ffirstchar := true; + fformatdata := array(); + end + function read_sections(); + begin + formatini(); + r := array(); + idx := 0; + for i,v in fformatdata do + begin + r[idx++] := v['n']; + end + return r; + end + function read_section_values(sn); + begin + formatini(); + d := fformatdata[lowercase(sn),"d"]; + r := array(); + if d then + begin + idx := 0; + for i,v in d do + begin + r[idx++] := v[array('k',"v")];//array("name":v['k'],"value":v["v"]); + end + end + return r; + end + function read_key(sn,key); + begin + formatini(); + d := fformatdata[lowercase(sn),"d",lowercase(key),"v"]; + return d; + end + function write_key(sn,key,v); + begin + formatini(); + d := fformatdata[lowercase(sn)]; + if d then + begin + info := fformatdata[lowercase(sn),"d",lowercase(key)] ; + if info then + begin + s := fscript; + s[info["b"]:info["e"]] := formatkv(key,v); + //script := s; + setscript(s); + end else + begin + s := fscript; + s[d["e"]:-1] := "\r\n"+formatkv(key,v); + //script := s; + setscript(s); + end + end else + begin + s := "["+sn+"]\r\n"+formatkv(key,v)+"\r\n"+fscript; + //script := s; + setscript(s); + end + end + function delete_key(sn,key); + begin + formatini(); + info := fformatdata[lowercase(sn),"d",lowercase(key)] ; + if info then + begin + s := fscript; + s[info["b"]:info["e"]] := ""; + setscript(s); + end + end + function delete_section(sn); //移除 + begin + formatini(); + d := fformatdata[lowercase(sn)]; + if d then + begin + b := d["b"]; + e := d["e"]; + s := fscript; + s[b:e]:=""; + setscript(s); + end + end + function rename_section(sn1,sn2); + begin + formatini(); + d := fformatdata[lowercase(sn1)]; + if d then + begin + s := fscript; + s[d["b"]:d["e2"]]:= "["+sn2+"]"; + setscript(s); + end + end + function rename_key(sn,key,nkey); + begin + formatini(); + info := fformatdata[lowercase(sn),"d",lowercase(key)] ; + if info then + begin + s := fscript; + s[info["b"]:info["e"]] := formatkv(nkey,info["v"]); + setscript(s); + end + end + published + property script read fscript write setscript; + private + function formatkv(key,v); + begin + return formatstr(key)+"="+formatstr(v); + end + function formatstr(s); + begin + if ifstring(s) then s1 := s; + else s1 := tostn(s); + s1 := replacetext(s1,"\r",""); + return replacetext(s1,"\n",""); + end + function formatini();//获取格式数据 + begin + parser_ini(); + if not fdata then return ; + fformatdata := array(); + for i,v in fdata do + begin + d := array(); + for k,kv in v.fdata do + begin + kk := kv[0]; + kkv := kv[1]; + if kk.fb<=kk.fe then + begin + ks := trim(fscript[kk.fb:kk.fe]); + + end else ks := ""; + if kkv.fb<=kkv.fe then + begin + ksv := trim(fscript[kkv.fb:kkv.fe]); + end else ksv := ""; + d[lowercase(ks)] := array("k":ks,"v":ksv,"b":kk.fb,"e":kkv.fe); + end + + fformatdata[lowercase(v.fv)] := array("n":v.fv,"d":d,"b":v.fb,"e":v.fe,"e2":v.fe2); + end + fdata := array(); + + end + function parser_v(); + begin + v := new tobjv(type_value,factidx+1); + while factidx=fscriptlen then return ; + k := new tobjv(type_skey,factidx+1); + while factidxfscript then + begin + fscript := s; + script_init(); + end + end + function script_init(); + begin + fscriptlen := length(fscript); + factidx := 0; + fdata := array(); + ffirstchar := true; + fcsection := new tobjv(type_section,1); + end + fscript; + fscriptlen; + factidx; + fcsection; + fdata; + fformatdata; + ffirstchar; + type tobjv = class() + function create(t,b); + begin + fb := b; + fe := -1; + fv := ""; + ft := t; + fdata := array(); + end + function add(k,v); + begin + fdata[length(fdata)] := array(k,v); + end + fdata; + fb; + fe; + fe2; + fv; + ft; + end +end implementation function iffuncptr(fn); begin diff --git a/funcext/tvclib/uvcpropertytypespersistence.tsf b/funcext/tvclib/uvcpropertytypespersistence.tsf index bdbdb15..fb8de34 100644 --- a/funcext/tvclib/uvcpropertytypespersistence.tsf +++ b/funcext/tvclib/uvcpropertytypespersistence.tsf @@ -2138,27 +2138,42 @@ type ttfmnode = class() fobjects := new tstrindexarray(); finheritedpaths := array(); end + function get_inherited(data); + begin + oa := new TTmfParser(); + oa.Script := data; + nd := oa.gettreeasobject(); + if ifobj(nd) then + begin + nd.setinhertedpaths(finheritedpaths); + nd.initinherited(); + end + finheritednode := nd; + addinheritednode(nd); + end function initinherited(); begin s := finheritedname; + global g_w_tfm_resource; if s and ifstring(s) then begin + data := g_w_tfm_resource[s+".tfm"]; + if data then + begin + return get_inherited(data); + end + for i,v in finheritedpaths do begin fv := v+s+".tfm"; if fileexists("",fv) then begin - oa := new TTmfParser(); - oa.ScriptPath := fv; - nd := oa.gettreeasobject(); - - if ifobj(nd) then - begin - nd.setinhertedpaths(finheritedpaths); - nd.initinherited(); - end - finheritednode := nd; - addinheritednode(nd); + size := filesize("",fv); //获取文件大小 + if readFile(rwraw(),"",fv,0,size,data)<>1 then + begin + data := ""; + end + get_inherited(data); return ; end end @@ -2338,6 +2353,20 @@ begin end function Sinitlib(); begin + global g_w_tfm_resource; + g_w_tfm_resource := array(); + try + getglobalcache("@@tsl-resource@@",rs); + for i,v in rs do + begin + if ifstring(i) and ifstring(v) then + begin + g_w_tfm_resource[lowercase(i)] := v; + end + end + except + end + types := array( //"tpropertytype", "tpropertynatural", "tpropertyinteger",