设计器

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

View File

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

View File

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