设计器

优化tfm文件读取,优化设计器中载入窗口闪烁问题
This commit is contained in:
JianjunLiu 2022-11-09 16:43:57 +08:00
parent 0a3bcb40ef
commit 73102c6d46
3 changed files with 49 additions and 10 deletions

View File

@ -1010,7 +1010,7 @@ type TVclDesigner = class(tvcform)
try
prs := array();
obarray := array();
loadtfmtotree(Ptfm,Ptfm.gettree2,FTree.RootItem,FTree,prs,obarray,const inh);
loadtfmtotree(Ptfm,Ptfm.gettree2,FTree.RootItem,FTree,prs,obarray,const inh,1);
for i,v in prs do
begin
va := obarray[v[2]];
@ -1024,7 +1024,7 @@ type TVclDesigner = class(tvcform)
end ;
FTree.Loading := nil;
end
function loadtfmtotree(p,d,node,wr,prs,obarray,inhname);//当如信息
function loadtfmtotree(p,d,node,wr,prs,obarray,inhname,first);//µ±ÈçÐÅÏ¢
begin
{**
@explan(说明) 导入tfm文件 %%
@ -1047,12 +1047,13 @@ type TVclDesigner = class(tvcform)
it.Imgs := fdimagelist.GetImageId("tdcreateform");
end
comp := it.ComponentCreater(node,wr);
//if first then comp.Cwnd.visible := false;
comp.isinherited := d["inherited"];
comp.inheritedparent := d["parent"];
comp.name := d["name"];
obarray[d["name"]] := comp;
FVariableSelecter.additem(comp);
BindCwndMessage(comp.Cwnd);
//BindCwndMessage(comp.Cwnd);
pubs := comp.GetPublishProperties() union comp.GetPublishEvents();
dprop := d["property"];
ddp := array();
@ -1088,7 +1089,11 @@ type TVclDesigner = class(tvcform)
lazy[length(lazy)] := array(n,setddpv,pp);
continue;
end
comp.SetComponentProperties(n,setddpv,pp);
if first and n="visible" then
begin
firstvisible := array(comp,setddpv,pp);
end else
comp.SetComponentProperties(n,setddpv,pp);
end
for i,v in d["object"] do
begin
@ -1097,7 +1102,16 @@ type TVclDesigner = class(tvcform)
for i,v in lazy do
begin
comp.SetComponentProperties(v[0],v[1],v[2]);
end
if firstvisible then
begin
comp.SetComponentProperties("visible",firstvisible[1],firstvisible[2]);
end
if first then
begin
comp.Cwnd.Handle;
end
BindCwndMessage(comp.Cwnd);
//comp.DoControlAlign();
end
function SetFunctionList(v); //设置函数信息

View File

@ -922,6 +922,12 @@ type TDForm = class(TDComponent)
//r[2] := array("type":"menu","caption":"´ò¿ª¹¤³ÌĿ¼","onclick":thisfunction(openProjectDir));
return r;
end
function CheckParent(dcomp,Pwnd);override;
begin
pwnd := 0;//initializeapplication().GetApplicationWindow();;
return 1;
end
function InToolBar();override;
begin
return false;

View File

@ -136,6 +136,23 @@ type TTmfParserToken = class(TTmfParserbase)
{**
@explan(说明) 处理当前字符 %%
**}
if n=TT_STR then
begin
r[len++]:= array(ct,n);
ct := "";
end else
begin
if not(ct) then return ;
if n=TT_NUM then
begin
if pos(".",ct)then ct := strtofloat(ct);
else ct := strtoint(ct);
end else
if n=TT_SYM then ct := lowercase(ct);
r[len++]:= array(ct,n);
ct := "";
end
return ;
if ct or(n=TT_STR)then
begin
if n=TT_NUM then
@ -249,6 +266,7 @@ type TTmfParserToken = class(TTmfParserbase)
pnumber := true;
kb := array(" ":1,"\t":1,"\r":1,"\n":1);
fgf := array(' ':1,'\t':1,"\r":1,"\n":1,";":1,",":1);
sns := array("=":1,":":1,"(":1,")":1,"<":1,">":1,"[":1,"]":1);
while whileok() do
begin
c := cchar();
@ -298,7 +316,7 @@ type TTmfParserToken = class(TTmfParserbase)
// delct(r,c,len,TT_SIG);
// pnumber := true;
// end else
if c in array("=",":","(",")","<",">","[","]")then
if sns[c]then
begin
delct(r,ct,len,TT_SYM);
delct(r,c,len,TT_SIG);
@ -374,7 +392,9 @@ type TTmfParserToken = class(TTmfParserbase)
end
r += c;
end
return eval(&("0x"+r));
if r then
return eval(&("0x"+r));
return 0;
end else
begin
cback();
@ -387,18 +407,17 @@ type TTmfParserToken = class(TTmfParserbase)
@explan(说明) 解析数字 %%
**}
r := "";
its := inttostr(0 -> 9);
its[length(its)]:= ".";
kb := array(" ":1,"\t":1,"\r":1,"\n":1);
while whileok() do
begin
c := cchar();
if(c in array(" ","\t","\r","\n"))then break;
if(kb[c] )then break;
if c="l" or c="L" then
begin
cchar();
break;
end
if not(c in its)then break;
if not(c="." or FNumbers[c])then break;
r += c;
end
cback();