界面库

升级
This commit is contained in:
JianjunLiu 2023-10-13 15:35:39 +08:00
parent 9dc53b0d08
commit e47352f843
5 changed files with 367 additions and 26 deletions

View File

@ -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

View File

@ -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

View File

@ -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_));

View File

@ -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 do
begin
factidx++;
vi := fscript[factidx];
if vi="\r" or vi="\n" then
begin
v.fe := factidx-1;
ffirstchar := true;
return v;
end
end
v.fe := factidx;
return v;
end
function parser_ini();
begin
if factidx>=fscriptlen then return ;
k := new tobjv(type_skey,factidx+1);
while factidx<fscriptlen do
begin
factidx++;
vi := fscript[factidx];
if ffirstchar then
begin
case vi of
"[":
begin
if fcsection.fv or fcsection.fdata then
begin
fdata[length(fdata)] := fcsection;
fcsection.fe := factidx-1;
end
fcsection := new tobjv(type_section,factidx);
parser_section();
end
"=":
begin
k.fe := factidx-1;
fcsection.add(k,parser_v());
k := new tobjv(type_skey,factidx);
end
";","#": //走到下一行
begin
gotonextline();
end
"\r","\n":
begin
end else
begin
ffirstchar := false;
k.fb := factidx;
end
end ;
end else
begin
case vi of
"\r","\n":
begin
ffirstchar := true;
parser_ini();
end
"=":
begin
k.fe := factidx-1;
fcsection.add(k,parser_v());
k := new tobjv(type_skey,factidx);
end
end
end
end
if fdata[length(fdata)-1]<>fcsection then
fdata[length(fdata)] := fcsection;
fcsection.fe := fscriptlen;
end
function parser_section();
begin
sn := "";
while factidx<fscriptlen do
begin
factidx++;
vi := fscript[factidx];
if vi="\r" or vi="\n" then
begin
ffirstchar := true;
break;
end
if vi="]" then //section 关闭
begin
fcsection.fv := trim(sn);
fcsection.fe2 := factidx;
ffirstchar := false;
return parser_ini();
end
sn+=vi;
end
end
function gotonextline(); //到达下一行
begin
while factidx<fscriptlen do
begin
factidx++;
vi := fscript[factidx] ;
if vi="\n" then
begin
ffirstchar := true;
break;
end
end
end
function setscript(s);
begin
if ifstring(s) and s<>fscript 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

View File

@ -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",