添加绘图扩展库

This commit is contained in:
2025-02-12 17:45:12 +08:00
parent 314869d09c
commit a0717b7cd3
21 changed files with 2851 additions and 213 deletions
-5
View File
@@ -49,11 +49,6 @@ array(
"type":"form",
"dir":""
),
"t_searchdir_mgr":(
"name":"t_searchdir_mgr",
"type":"form",
"dir":""
),
"tsl1":(
"name":"tsl1",
"type":"tsl",
+3 -3
View File
@@ -190,13 +190,13 @@ type teditorform = class(TVCform) //
FTslFormatMenu := new tmenu(self);
FTslFormatMenu.Caption := c_m_tsl_style_config;
FTslFormatMenu.OnClick := function(o,e)begin
move_popwnd_to_center2(FFormatInfoWnd);
class(UtslCodeEditor).move_popwnd_to_center2(FFormatInfoWnd);
FFormatInfoWnd.show();
end
FCodeBlockMenu := new TMenu(self);
FCodeBlockMenu.caption := c_m_tsl_block;
FCodeBlockMenu.OnClick := function(o,e)begin
move_popwnd_to_center2(fBlockManager);
class(UtslCodeEditor).move_popwnd_to_center2(fBlockManager);
fBlockManager.ShowModal();
end
@@ -1145,7 +1145,7 @@ type TBlockManager=class(TVCForm)
FEditer.caption := "添加代码块..."
end
FEditer.SetData(FList.SelectedValue);
move_popwnd_to_center2(FEditer);
class(UtslCodeEditor).move_popwnd_to_center2(FEditer);
FEditer.showmodal();
end
+2 -1
View File
@@ -1010,7 +1010,8 @@ type TProjectView = class(TVCForm) //
//FTfmComponets := array();
//FTmfParser.GetAllSubObjects(nil,FTfmComponets);
FDesigner.LoadTreeNode(FTmfParser,inh,FCurrentOpend);
FDesigner.EditerCodeChanged();
xx := FTslEditer.OpenAndGotoFileByName(FCurrentOpend.gettsfname());
FDesigner.EditerCodeChanged(FCurrentOpend);
end
fopenbuzy := false;
end else
+1
View File
@@ -4558,6 +4558,7 @@ type TEditList=class(TComboBox)
begin
inherited;
width := 280;
Height := 26;
dropdowncount := 30;
FMaxCoder := 20;
ReadONly := false;
+47 -5
View File
@@ -378,6 +378,7 @@ type TDComponent = class()
end
o.Component := nil;
ndp.Owner.SetSel(ndp);
return true;
end
end
function cutclick(o,e);virtual; //剪切节点
@@ -389,11 +390,34 @@ type TDComponent = class()
function pasteclick(o,e);virtual; //粘贴节点
begin
cp:=o.Component;
if not cp then exit;
if not cp then
begin
MessageBoxA("容器节点错误!","粘贴",0,nd.owner);
exit;
end
nd := cp.TreeNode;
If not nd then exit;
If not nd then
begin
MessageBoxA("容器节点错误!","粘贴",0,nd.owner);
exit;
end
global g_script_can_set_not_focus := true;
d := nd.owner.Designer;
d.pasttonode(nd);
case d.pasttonode(nd) of
-1:
begin
MessageBoxA("粘贴内容为空!","粘贴",0,nd.owner);
end
1:
begin
MessageBoxA(("粘贴控件到"$nd.Caption$"成功"),"粘贴",0,nd.owner);
end
else
begin
MessageBoxA(("粘贴控件到"$nd.Caption$"失败!\r\n请注意该节点是否能容纳粘贴控件"),"粘贴",0,nd.owner);
end
end ;
g_script_can_set_not_focus := false;
end
function deleteclick(o,e);virtual; //控件删除操作
begin
@@ -717,7 +741,23 @@ type TDComponent = class()
**}
inherited;"
);
SetDefalutEvent(ev,true);
SetDefalutEvent(ev,true);
ev :=array(
"event":"ongetpreferredsize",
"name":"gprefsize",
"param":array("o","e"),
"virtual":true,
"body":
" {**
@explan(说明) 获取最佳的尺寸 %%
@param(o)(tcontrol)控件 %%
@param(e)(tmmeasuresize) 消息对象 %%
**}
e.width := 50; //宽度
e.height := 300; //高度
"
);
SetDefalutEvent(ev,true);
if not(AOwner is class(TComponent)) then exit;
c := WndClass();
if c is class(TComponent) then
@@ -737,7 +777,7 @@ type TDComponent = class()
{**
@explan(说明)获得改变的属性%%
**}
if FCwnd then return FCwnd.GetChangedPublish(f);
if FCwnd then return FCwnd.GetChangedPublish(f);
return array();
end
function GetPublishProperties();virtual;
@@ -2210,6 +2250,7 @@ type TDToolBar = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
end
function ComponentCreater(tnode,owner);override;
begin
@@ -2253,6 +2294,7 @@ type TDcoolBar = class(TDComponent)
function Create(AOwner);override;
begin
inherited;
excludepropertys := array("childsizing");
end
function ComponentCreater(tnode,owner);override;
begin
+64 -19
View File
@@ -266,21 +266,33 @@ type TVclDesigner = class(tvcform)
end
function pasttonode(nd);//粘贴节点
begin
if not fcutcopyinfo then return ;
if not fcutcopyinfo then return -1;
ifc := fcutcopyinfo[2];
r := pastinfotonode2(nd,fcutcopyinfo,1,not(ifc));
if ifc and not(r<>1) then
begin
if ifc and ifstring(r) then
begin
fcutcopyinfo := nil; //如果失败就不清除内容
end
if ifstring(r) and r then return true;
end
function pastinfotonode2(nd,data,fst,notcute);
begin
r := pastinfotonode(nd,data,fst,notcute);
ndobjs := array();
r := pastinfotonode(nd,data,fst,notcute,ndobjs);
needadjust := array();
for i,v in ndobjs do
begin
v.set_loadstate(false);
if v is class(TWinControl) then
begin
if v.ControlCount<1 then needadjust[length(needadjust)] := v;
end else needadjust[length(needadjust)] := v;
end
for i,v in needadjust do v.AdjustSize();
if ifstring(r) then fdolist.add(nd.Component.name,"paste",r);
return r;
end
function pastinfotonode(nd,data,fst,notcute); //粘贴节点
function pastinfotonode(nd,data,fst,notcute,ndobjs); //粘贴节点
begin
tc := data[0];
if ifstring(tc) then tc := class(TDComponent).GetClassItem(tc);
@@ -292,9 +304,17 @@ type TVclDesigner = class(tvcform)
pwnd := nd.Component.Cwnd;
nnd := tc.ComponentCreater(nd,pwnd);
if not nnd then return 1; //加入失败处理
nn := nnd.CreateName();
FVariableSelecter.additem(nnd);
BindCwndMessage(nnd.Cwnd);
nndw := nnd.Cwnd;
if nndw is class(tcontrol) then
begin
nndw.set_loadstate(true);
ndobjs[length(ndobjs)] := nndw;
end
if fst and (pwnd is class(TWinControl)) then
pclt := pwnd.ClientRect; //获得父节点区域
for i,v in data do
@@ -317,9 +337,14 @@ type TVclDesigner = class(tvcform)
end
nnd.SetComponentProperties(i,vi);
end
for i,v in data[1] do
for i,v in data[1] do //构造子对象
begin
pastinfotonode(nnd.TreeNode,v);
pastinfotonode(nnd.TreeNode,v,nil,nil,ndobjs);
end
for i,v in data[3] do //设置lazy属性
begin
nnd.SetComponentProperties(i,v);
end
return nnd.name;
end
@@ -334,20 +359,17 @@ type TVclDesigner = class(tvcform)
lzs := array();
for i,v in cr do
begin
if not(v and ifstring(i) ) then continue; //严格判断
if not(ifstring(i) ) then continue; //严格判断
if i in array("cursel","itemindex","autosize","align","childsizing","font","anchor") then lzs[i] := v;
else
r[i] := v;
end
for i,v in lzs do
begin
r[i] := v;
end
r["name"] := tc.name;
for i := 0 to node.ItemCount-1 do
begin
r[1,i] := getnodeinfodata((node.items)[i]);//
end
r[3] := lzs;
end
return r;
end
@@ -1318,10 +1340,11 @@ type TVclDesigner = class(tvcform)
return ;//
end
FTree.Loading := true;
outobjs := array();
try
prs := array();
obarray := array();
loadtfmtotree(Ptfm,Ptfm.gettree2,FTree.RootItem,FTree,prs,obarray,const inh,1);
loadtfmtotree(Ptfm,Ptfm.gettree2,FTree.RootItem,FTree,prs,obarray,const inh,1,outobjs);
for i,v in prs do
begin
va := obarray[v[2]];
@@ -1333,9 +1356,27 @@ type TVclDesigner = class(tvcform)
except
end ;
needadjust := array();
for i,voj in outobjs do
begin
voj.set_loadstate(false);
if voj is class(TWinControl) then
begin
if voj.ControlCount<1 then
begin
needadjust[length(needadjust)] := voj;
end
end else
needadjust[length(needadjust)] := voj;
end
for i,voj in needadjust do
begin
voj.AdjustSize();
end
FTree.Loading := nil;
end
function loadtfmtotree(p,d,node,wr,prs,obarray,inhname,first);//当如信息
function loadtfmtotree(p,d,node,wr,prs,obarray,inhname,first,outobjs);//当如信息
begin
{**
@explan(说明) 导入tfm文件 %%
@@ -1360,15 +1401,19 @@ type TVclDesigner = class(tvcform)
it.Imgs := fdimagelist.GetImageId("tdcreateform");
end
comp := it.ComponentCreater(node,wr);
compcwnd := comp.Cwnd;
if compcwnd is class(tcontrol) then
outobjs[length(outobjs)] := compcwnd;
compcwnd.set_loadstate(true);
if first then
begin
{$ifdef linux}
if setflg then
begin
comp.Cwnd.parent := self;
compcwnd.parent := self;
end
{$endif}
comp.Cwnd.Handle;
compcwnd.Handle;
end
comp.isinherited := d["inherited"];
comp.inheritedparent := d["parent"];
@@ -1387,7 +1432,7 @@ type TVclDesigner = class(tvcform)
begin
if ifarray(ddp["align"]) and (ddp["align"]["value"]="alnone") then
begin
comp.Cwnd.align := alnone;
compcwnd.align := alnone;
end
end
lazy := array();
@@ -1415,13 +1460,13 @@ type TVclDesigner = class(tvcform)
end
for i,v in d["object"] do
begin
call(thisfunction,p,v,comp.TreeNode,comp.Cwnd,prs,obarray,inhname);
call(thisfunction,p,v,comp.TreeNode,compcwnd,prs,obarray,inhname,nil,outobjs);
end
for i,v in lazy do
begin
comp.SetComponentProperties(v[0],v[1],v[2]);
end
BindCwndMessage(comp.Cwnd);
BindCwndMessage(compcwnd);
//comp.DoControlAlign();
end