parent
1dac8f9a56
commit
9f6742851d
|
|
@ -3,7 +3,9 @@ unit tslvclDesigner;
|
||||||
@explan(说明)设计器库 %%
|
@explan(说明)设计器库 %%
|
||||||
**}
|
**}
|
||||||
interface
|
interface
|
||||||
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclbase,utslvclgdi,utslvcldcomponents,utslvcldpropertytypes,tslvcl,UVCPropertyTypesPersistence,utslmemo,UDesignerProject;
|
uses utslvcldesignerresource,cstructurelib,utslvclauxiliary,utslvclbase,
|
||||||
|
utslvclgdi,utslvcldcomponents,utslvcldpropertytypes,tslvcl,
|
||||||
|
UVCPropertyTypesPersistence,utslmemo,UDesignerProject;
|
||||||
//*******设计控件基类**********************
|
//*******设计控件基类**********************
|
||||||
//**********设计控件类************
|
//**********设计控件类************
|
||||||
|
|
||||||
|
|
@ -12,28 +14,23 @@ type TVclDesigner = class(tvcform)
|
||||||
@explan(说明) 控件设计器 对象 %%
|
@explan(说明) 控件设计器 对象 %%
|
||||||
**}
|
**}
|
||||||
private
|
private
|
||||||
fcwindowinfo;
|
fcwindowinfo; //当前窗口文件对象
|
||||||
fwindowinfos;
|
fwindowinfos; //窗口文件节点存储对象
|
||||||
fcutcopyinfo;//复制的信息
|
fcutcopyinfo;//复制的信息
|
||||||
FChmHelper; //帮助文档
|
FChmHelper; //帮助文档
|
||||||
FImageList; //图标
|
FImageList; //图标
|
||||||
FViewBitmap;
|
FViewBitmap; //图片管理器
|
||||||
FCTrans;
|
FVariableSelecter; //当前控件树的变量
|
||||||
FVariableSelecter;
|
FFunctionSelecter; //当前控件树的函数
|
||||||
FFunctionSelecter;
|
|
||||||
Ftvclform;
|
|
||||||
//**********菜单***************
|
//**********菜单***************
|
||||||
FMenu0;
|
FMenu0; //主菜单
|
||||||
FParser;
|
|
||||||
//********************************
|
//********************************
|
||||||
FToolBars;
|
FToolBars; //控件工具栏
|
||||||
FTree; //当前的树
|
FTree; //当前的树
|
||||||
FObjInspector;
|
FObjInspector; //控件树展示器
|
||||||
FPropGrid;
|
FPropGrid; //控件属性grid
|
||||||
FEventGrid;
|
FEventGrid; //控件事件grid
|
||||||
|
|
||||||
FTempCanvas;
|
|
||||||
static FClassItems;
|
|
||||||
//************************************
|
//************************************
|
||||||
FCurrentNode;
|
FCurrentNode;
|
||||||
FCurrentClikPos;
|
FCurrentClikPos;
|
||||||
|
|
@ -43,7 +40,7 @@ type TVclDesigner = class(tvcform)
|
||||||
FProjectsManager;
|
FProjectsManager;
|
||||||
FProjectManager;
|
FProjectManager;
|
||||||
//***************************
|
//***************************
|
||||||
function WrapProjectTo();
|
function WrapProjectTo(); //打包当前
|
||||||
begin
|
begin
|
||||||
FProjectManager.WrapTo();
|
FProjectManager.WrapTo();
|
||||||
end
|
end
|
||||||
|
|
@ -89,20 +86,16 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
//extheight := CaptionHeight()+MenuBarHeight();
|
//extheight := CaptionHeight()+MenuBarHeight();
|
||||||
clc := array();
|
clc := array();
|
||||||
//if FClassItems and ifarray(FClassItems) then
|
for i,v in class(TDComponent).GetClassItem() do
|
||||||
//begin
|
begin
|
||||||
for i,v in class(TDComponent).GetClassItem() do
|
cli := v.classification;
|
||||||
begin
|
if not(cli and ifstring(cli)) then cli := "常用";
|
||||||
cli := v.classification;
|
if ifnil(clc[cli]) then clc[cli] := 0;
|
||||||
if not(cli and ifstring(cli)) then cli := "常用";
|
clc[cli]+=1;
|
||||||
if ifnil(clc[cli]) then clc[cli] := 0;
|
end
|
||||||
clc[cli]+=1;
|
mx := 0;
|
||||||
end
|
for i,v in clc do mx := max(mx,v);
|
||||||
mx := 0;
|
height := (integer(mx*32/twidth)+1)*32+60+30{+24}+5;
|
||||||
for i,v in clc do mx := max(mx,v);
|
|
||||||
height := (integer(mx*32/twidth)+1)*32+60+30{+24}+5;
|
|
||||||
//end else
|
|
||||||
// height := 90+32{+24}+5;
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function TreeNode2tfmsub(lib,node,itemnames,nd);//tmf文件字符串
|
function TreeNode2tfmsub(lib,node,itemnames,nd);//tmf文件字符串
|
||||||
|
|
@ -165,21 +158,15 @@ type TVclDesigner = class(tvcform)
|
||||||
if node Is class(TComponentTreeNode) then
|
if node Is class(TComponentTreeNode) then
|
||||||
begin
|
begin
|
||||||
comp := node.Component;
|
comp := node.Component;
|
||||||
tree := Node.owner;
|
node.Recycling(); //销毁节点
|
||||||
node.Recycling();
|
if comp is class(TDComponent) then //销毁节点对应控件
|
||||||
if tree is class(TComponentTree) then
|
|
||||||
begin
|
|
||||||
tree.deleteitem(node);
|
|
||||||
node.Recycling();
|
|
||||||
end
|
|
||||||
if comp is class(TDComponent) then
|
|
||||||
begin
|
begin
|
||||||
wd := comp.Cwnd;
|
wd := comp.Cwnd;
|
||||||
if wd is class(TComponent) then wd.Recycling();
|
if wd is class(TComponent) then wd.Recycling();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function createmainmenubyarray(ms,pm,oer);
|
function createmainmenubyarray(ms,pm,oer); //构造菜单
|
||||||
begin
|
begin
|
||||||
if not(ifarray(ms) and ms) then exit;
|
if not(ifarray(ms) and ms) then exit;
|
||||||
if ms["type"]="menu" then
|
if ms["type"]="menu" then
|
||||||
|
|
@ -231,23 +218,23 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
public //复制粘贴
|
public //复制粘贴
|
||||||
function copynode(node);
|
function copynode(node); //复制
|
||||||
begin
|
begin
|
||||||
fcutcopyinfo := getnodeinfodata(node);
|
fcutcopyinfo := getnodeinfodata(node);
|
||||||
end
|
end
|
||||||
function cutnode(node);
|
function cutnode(node); //剪切节点
|
||||||
begin
|
begin
|
||||||
fcutcopyinfo := getnodeinfodata(node,1);
|
fcutcopyinfo := getnodeinfodata(node);
|
||||||
fcutcopyinfo[2] := true;
|
fcutcopyinfo[2] := true;
|
||||||
end
|
end
|
||||||
function pasttonode(nd);
|
function pasttonode(nd);//粘贴节点
|
||||||
begin
|
begin
|
||||||
if not fcutcopyinfo then return ;
|
if not fcutcopyinfo then return ;
|
||||||
ifc := fcutcopyinfo[2];
|
ifc := fcutcopyinfo[2];
|
||||||
r := pastinfotonode(nd,fcutcopyinfo,1,not(ifc));
|
r := pastinfotonode(nd,fcutcopyinfo,1,not(ifc));
|
||||||
if ifc and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容
|
if ifc and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容
|
||||||
end
|
end
|
||||||
function pastinfotonode(nd,data,fst,notcute);
|
function pastinfotonode(nd,data,fst,notcute); //粘贴节点
|
||||||
begin
|
begin
|
||||||
tc := data[0];
|
tc := data[0];
|
||||||
if ifstring(tc) then tc := class(TDComponent).GetClassItem(tc);
|
if ifstring(tc) then tc := class(TDComponent).GetClassItem(tc);
|
||||||
|
|
@ -279,7 +266,7 @@ type TVclDesigner = class(tvcform)
|
||||||
if i = "top" then pidx := 3 ; //位置判断
|
if i = "top" then pidx := 3 ; //位置判断
|
||||||
if vi>pclt[pidx] then
|
if vi>pclt[pidx] then
|
||||||
begin
|
begin
|
||||||
vi := integer(pclt[pidx]+(pclt[pidx-2]/2)-5); //位置处理
|
vi := integer(pclt[pidx]+(pclt[pidx-2]/2)-10); //位置处理
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
nnd.SetComponentProperties(i,vi);
|
nnd.SetComponentProperties(i,vi);
|
||||||
|
|
@ -289,24 +276,22 @@ type TVclDesigner = class(tvcform)
|
||||||
pastinfotonode(nnd.TreeNode,v);
|
pastinfotonode(nnd.TreeNode,v);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function getnodeinfodata(node,f);
|
function getnodeinfodata(node); //复制节点信息
|
||||||
begin
|
begin
|
||||||
tc := node.Component;
|
tc := node.Component;
|
||||||
r := array();
|
r := array();
|
||||||
if tc is class(TDComponent) then
|
if tc is class(TDComponent) then
|
||||||
begin
|
begin
|
||||||
r[0] := tc.dclassname() ;
|
r[0] := tc.dclassname() ;
|
||||||
//if f then r["name"] := tc.name;
|
|
||||||
cr := tc.GetChangedPublish(2);
|
cr := tc.GetChangedPublish(2);
|
||||||
for i,v in cr do
|
for i,v in cr do
|
||||||
begin
|
begin
|
||||||
//if ifobj(v) then continue; //对象就忽略
|
|
||||||
if not(v and ifstring(i) ) then continue; //严格判断
|
if not(v and ifstring(i) ) then continue; //严格判断
|
||||||
r[i] := v;
|
r[i] := v;
|
||||||
end
|
end
|
||||||
for i := 0 to node.ItemCount-1 do
|
for i := 0 to node.ItemCount-1 do
|
||||||
begin
|
begin
|
||||||
r[1,i] := getnodeinfodata((node.items)[i],f);//
|
r[1,i] := getnodeinfodata((node.items)[i]);//
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
|
|
@ -330,7 +315,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function OpenExaple();
|
function OpenExaple();
|
||||||
begin
|
begin
|
||||||
FProjectFileOpener.caption := "打开范例....";
|
FProjectFileOpener.caption := "打开范例....";
|
||||||
f := 0;// tslfilename();
|
f := 0;// tslfilename();
|
||||||
|
|
@ -397,21 +382,6 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
FProjectManager.ShowCurrentFormCode();//ShowEditor();
|
FProjectManager.ShowCurrentFormCode();//ShowEditor();
|
||||||
end
|
end
|
||||||
|
|
||||||
Function EnabledDesigner(f);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 设置designer是否可用 %%
|
|
||||||
@param(f)(bool)
|
|
||||||
**}
|
|
||||||
FObjInspector.Visible := F;
|
|
||||||
self.Enabled := f;
|
|
||||||
rt := FTree.RootItem;
|
|
||||||
if rt and rt.ItemCount>0 then
|
|
||||||
it := (rt.items)[0];
|
|
||||||
if it then itt := it.Component;
|
|
||||||
if itt then itt.Cwnd.Enabled := f;
|
|
||||||
end
|
|
||||||
function TreeNode2tfm(lib,itemnames,nd); //转换文件
|
function TreeNode2tfm(lib,itemnames,nd); //转换文件
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -426,7 +396,7 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
FProjectManager.saveCurrentEdit();
|
FProjectManager.saveCurrentEdit();
|
||||||
end
|
end
|
||||||
function mainmenus();virtual;
|
function mainmenus(); //设计器菜单
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 菜单
|
@explan(说明) 菜单
|
||||||
|
|
@ -479,17 +449,17 @@ type TVclDesigner = class(tvcform)
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
function DeleFiledFromEdit(n,nn);
|
function DeleFiledFromEdit(n,nn); //删除变量
|
||||||
begin
|
begin
|
||||||
if FTree.Loading then return ;
|
if FTree.Loading then return ;
|
||||||
FProjectManager.DeleteAFiled(n,nn);
|
FProjectManager.DeleteAFiled(n,nn);
|
||||||
end
|
end
|
||||||
function AddFiledFromEdit(n);
|
function AddFiledFromEdit(n); //添加变量
|
||||||
begin
|
begin
|
||||||
if FTree.Loading then return ;
|
if FTree.Loading then return ;
|
||||||
FProjectManager.AddAFiled(n);
|
FProjectManager.AddAFiled(n);
|
||||||
end
|
end
|
||||||
function AddusesFromEdit(lbs);
|
function AddusesFromEdit(lbs); //添加uses
|
||||||
begin
|
begin
|
||||||
if FTree.Loading then return ;
|
if FTree.Loading then return ;
|
||||||
FProjectManager.adduses(lbs);
|
FProjectManager.adduses(lbs);
|
||||||
|
|
@ -504,7 +474,7 @@ type TVclDesigner = class(tvcform)
|
||||||
SetFunctionList(classinfo["funcs"]);
|
SetFunctionList(classinfo["funcs"]);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function LoadProject(n);
|
function LoadProject(n); //当如工程
|
||||||
begin
|
begin
|
||||||
FProjectManager.SetProjectInfo(n);
|
FProjectManager.SetProjectInfo(n);
|
||||||
end
|
end
|
||||||
|
|
@ -522,7 +492,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function OpenHelp(o,e);
|
function OpenHelp(o,e); //打开帮助
|
||||||
begin
|
begin
|
||||||
if not FChmHelper then
|
if not FChmHelper then
|
||||||
begin
|
begin
|
||||||
|
|
@ -545,15 +515,13 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
"控件详情":
|
"控件详情":
|
||||||
begin
|
begin
|
||||||
FChmHelper.ChmName := "help\\tslvclhelp.chm";
|
FChmHelper.ChmName := "help\\tslvclhelp.chm";
|
||||||
|
end
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
FChmHelper.ShowTslLangChm();
|
FChmHelper.ShowTslLangChm();
|
||||||
//_wapi.WinExec('cmd.exe /C start http://bzjj.sinaapp.com/tslvclhelp/index.html',0);
|
//_wapi.WinExec('cmd.exe /C start http://bzjj.sinaapp.com/tslvclhelp/index.html',0);
|
||||||
end
|
end
|
||||||
function ComponentMove(o,e); //移动
|
function ComponentMove(o,e); //控件移动
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 移动 控件 %%
|
@explan(说明) 移动 控件 %%
|
||||||
|
|
@ -572,7 +540,7 @@ type TVclDesigner = class(tvcform)
|
||||||
FPropGrid.SetGridValue("height",o.height,O);
|
FPropGrid.SetGridValue("height",o.height,O);
|
||||||
//setcomponentfocus(o,false);
|
//setcomponentfocus(o,false);
|
||||||
end
|
end
|
||||||
function DesignerClose(o,e) //关闭
|
function DesignerClose(o,e) //控件窗口关闭
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)保存 %%
|
@explan(说明)保存 %%
|
||||||
|
|
@ -607,7 +575,7 @@ type TVclDesigner = class(tvcform)
|
||||||
|
|
||||||
public
|
public
|
||||||
//****************************************
|
//****************************************
|
||||||
function CreateComponent(); //构造句柄
|
function CreateComponent(); //构造控件
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 构造组件 %%
|
@explan(说明) 构造组件 %%
|
||||||
|
|
@ -646,27 +614,16 @@ type TVclDesigner = class(tvcform)
|
||||||
//echo "\r\n 添加控件";
|
//echo "\r\n 添加控件";
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function RectToPoints(rc);
|
function setcomponentfocus(cwnd,fk); //设置获得选中
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明)辅助函数
|
|
||||||
**}
|
|
||||||
r := array();
|
|
||||||
r := array((rc[0],rc[1]),(rc[2],rc[1]),(rc[2],rc[3]),(rc[0],rc[3]),(rc[0],rc[1]));
|
|
||||||
return r;
|
|
||||||
end
|
|
||||||
function setcomponentfocus(cwnd,fk);
|
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 设计控件获得焦点 %%
|
@explan(说明) 设计控件获得焦点 %%
|
||||||
**}
|
**}
|
||||||
if not(cwnd is class(TWincontrol)) then exit ;
|
if not(cwnd is class(TWincontrol)) then exit ;
|
||||||
if not cwnd.HandleAllocated() then exit;
|
if not cwnd.HandleAllocated() then exit;
|
||||||
//if cwnd is class(tvcform) then exit;
|
|
||||||
//if cwnd.WsPopUp then exit;
|
|
||||||
return cwnd.DesigningSelect(fk);
|
return cwnd.DesigningSelect(fk);
|
||||||
end
|
end
|
||||||
function TreeNodeSelected(n);
|
function TreeNodeSelected(n); //控件树选中节点
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 节点被选择 %%
|
@explan(说明) 节点被选择 %%
|
||||||
|
|
@ -686,7 +643,7 @@ type TVclDesigner = class(tvcform)
|
||||||
return t.SelectedNode();
|
return t.SelectedNode();
|
||||||
end
|
end
|
||||||
private
|
private
|
||||||
function RClickComponent(o,e);
|
function RClickComponent(o,e); //右键控件窗口
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)右键菜单 %%
|
@explan(说明)右键菜单 %%
|
||||||
|
|
@ -696,7 +653,7 @@ type TVclDesigner = class(tvcform)
|
||||||
if not(tr.visible) then
|
if not(tr.visible) then
|
||||||
begin
|
begin
|
||||||
wnd := fwindowinfos.getnodebytree(tr);
|
wnd := fwindowinfos.getnodebytree(tr);
|
||||||
FProjectManager.senodesel(wnd);
|
FProjectManager.setnodesel(wnd);
|
||||||
return ;//
|
return ;//
|
||||||
end
|
end
|
||||||
if FCurrentNode<>nd then
|
if FCurrentNode<>nd then
|
||||||
|
|
@ -723,7 +680,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
//FClickTime;
|
//FClickTime;
|
||||||
public
|
public
|
||||||
function addandopeneventbyname(nd,n);
|
function addandopeneventbyname(nd,n); //打开事件函数位置
|
||||||
begin
|
begin
|
||||||
if nd then
|
if nd then
|
||||||
begin
|
begin
|
||||||
|
|
@ -764,7 +721,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
FProjectManager.ShowEditor();
|
FProjectManager.ShowEditor();
|
||||||
end
|
end
|
||||||
function AddAndOPenEvent(nd);
|
function AddAndOPenEvent(nd); //打开事件函数
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)通过节点打开函数编辑器 %%
|
@explan(说明)通过节点打开函数编辑器 %%
|
||||||
|
|
@ -790,7 +747,7 @@ type TVclDesigner = class(tvcform)
|
||||||
if not(tr.visible) then
|
if not(tr.visible) then
|
||||||
begin
|
begin
|
||||||
wnd := fwindowinfos.getnodebytree(tr);
|
wnd := fwindowinfos.getnodebytree(tr);
|
||||||
FProjectManager.senodesel(wnd);
|
FProjectManager.setnodesel(wnd);
|
||||||
return ;//
|
return ;//
|
||||||
end
|
end
|
||||||
if FCurrentNode<> nd then
|
if FCurrentNode<> nd then
|
||||||
|
|
@ -847,7 +804,7 @@ type TVclDesigner = class(tvcform)
|
||||||
if o._Tag is class(tmenu) then o._tag.Checked := false;
|
if o._Tag is class(tmenu) then o._tag.Checked := false;
|
||||||
end
|
end
|
||||||
|
|
||||||
function OnToolButtonCick(o,e); //工具栏
|
function OnToolButtonCick(o,e); //工具按钮被点击
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 选择工具按钮 %%
|
@explan(说明) 选择工具按钮 %%
|
||||||
|
|
@ -865,7 +822,7 @@ type TVclDesigner = class(tvcform)
|
||||||
FProjectManager.CloseCurrentEdit(nil,true);
|
FProjectManager.CloseCurrentEdit(nil,true);
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
function BindCwndMessage(wnd);
|
function BindCwndMessage(wnd); //给控件绑定处理函数
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 为控件添加事件 %%
|
@explan(说明) 为控件添加事件 %%
|
||||||
|
|
@ -891,21 +848,11 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function UnLoadTreeNode(wndnode);
|
function UnLoadTreeNode(wndnode); //卸载控件树
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 卸载tree的节点%%
|
@explan(说明) 卸载tree的节点%%
|
||||||
**}
|
**}
|
||||||
//fcutcopyinfo := nil;
|
|
||||||
if wndnode = "all" then
|
|
||||||
begin
|
|
||||||
for i,v in fwindowinfos.fdata.data do
|
|
||||||
begin
|
|
||||||
FProjectManager.saveCurrentEdit(v.fnode);
|
|
||||||
UnLoadTreeNode(v.fnode);
|
|
||||||
end
|
|
||||||
return ;
|
|
||||||
end
|
|
||||||
nd := fwindowinfos.getdata(wndnode);
|
nd := fwindowinfos.getdata(wndnode);
|
||||||
if not nd then return ;
|
if not nd then return ;
|
||||||
hidenatree(nd);
|
hidenatree(nd);
|
||||||
|
|
@ -919,7 +866,7 @@ type TVclDesigner = class(tvcform)
|
||||||
tr.Recycling();
|
tr.Recycling();
|
||||||
end
|
end
|
||||||
private
|
private
|
||||||
function hidenatree(nd);
|
function hidenatree(nd);//隐藏控件树
|
||||||
begin
|
begin
|
||||||
FCurrentNode := nil;
|
FCurrentNode := nil;
|
||||||
if nd then
|
if nd then
|
||||||
|
|
@ -927,6 +874,7 @@ type TVclDesigner = class(tvcform)
|
||||||
tr := nd.ftree;
|
tr := nd.ftree;
|
||||||
tr.visible := false;
|
tr.visible := false;
|
||||||
nd.fvars := FVariableSelecter.getlistds();
|
nd.fvars := FVariableSelecter.getlistds();
|
||||||
|
nd.fcomp := FEventGrid.Component;
|
||||||
FEventGrid.Component := array();
|
FEventGrid.Component := array();
|
||||||
FPropGrid.Component := array();
|
FPropGrid.Component := array();
|
||||||
nd.ffuncs := FFunctionSelecter.List.data;
|
nd.ffuncs := FFunctionSelecter.List.data;
|
||||||
|
|
@ -934,7 +882,7 @@ type TVclDesigner = class(tvcform)
|
||||||
class(TDComponent).TemporaryNotName:= array();
|
class(TDComponent).TemporaryNotName:= array();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function showtree(nd);
|
function showtree(nd); //显示控件树
|
||||||
begin
|
begin
|
||||||
FCurrentNode := nil;
|
FCurrentNode := nil;
|
||||||
tr := nd.ftree;
|
tr := nd.ftree;
|
||||||
|
|
@ -943,8 +891,10 @@ type TVclDesigner = class(tvcform)
|
||||||
FVariableSelecter.setlistds(nd.fvars);
|
FVariableSelecter.setlistds(nd.fvars);
|
||||||
FFunctionSelecter.additems(nd.ffuncs);
|
FFunctionSelecter.additems(nd.ffuncs);
|
||||||
class(TDComponent).TemporaryNotName := nd.fnames;
|
class(TDComponent).TemporaryNotName := nd.fnames;
|
||||||
|
FPropGrid.Component := nd.fcomp ;
|
||||||
|
FEventGrid.Component := nd.fcomp ;
|
||||||
end
|
end
|
||||||
function switchtree(nd);
|
function switchtree(nd); //切换控件树
|
||||||
begin
|
begin
|
||||||
FCurrentNode := nil;
|
FCurrentNode := nil;
|
||||||
if nd<>fcwindowinfo then
|
if nd<>fcwindowinfo then
|
||||||
|
|
@ -954,24 +904,28 @@ type TVclDesigner = class(tvcform)
|
||||||
hidenatree(fcwindowinfo);
|
hidenatree(fcwindowinfo);
|
||||||
end
|
end
|
||||||
fcwindowinfo := nd;
|
fcwindowinfo := nd;
|
||||||
FTree := fcwindowinfo.ftree;
|
if nd then
|
||||||
showtree(fcwindowinfo);
|
|
||||||
//rnd := FTree.RootItem;
|
|
||||||
//nnd := rnd.GetNodeByIndex(0);
|
|
||||||
nnd := ftree.CurrentNode;
|
|
||||||
if nnd then
|
|
||||||
begin
|
begin
|
||||||
cp := nnd.Component;
|
FTree := fcwindowinfo.ftree;
|
||||||
if not cp then return ;
|
showtree(fcwindowinfo);
|
||||||
wd := cp.Cwnd;
|
if not(nd.fclk) then //不在最上层处理一下
|
||||||
if wd.visible then
|
begin
|
||||||
begin
|
nnd := FTree.RootItem.GetNodeByIndex(0);
|
||||||
wd.visible := false;
|
if nnd then
|
||||||
wd.visible := true;
|
begin
|
||||||
|
cp := nnd.Component;
|
||||||
|
if cp then
|
||||||
|
begin
|
||||||
|
wd := cp.Cwnd;
|
||||||
|
if wd.visible then
|
||||||
|
begin
|
||||||
|
wd.visible := false;
|
||||||
|
wd.visible := true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
FPropGrid.Component := cp;
|
nd.fclk := false;
|
||||||
FEventGrid.Component := cp;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1012,12 +966,11 @@ type TVclDesigner = class(tvcform)
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
end
|
end
|
||||||
function LoadTreeNode(Ptfm,inh,wndnode);
|
function LoadTreeNode(Ptfm,inh,wndnode);//加载控件树
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 加载tree节点 %%
|
@explan(说明) 加载tree节点 %%
|
||||||
**}
|
**}
|
||||||
//UnLoadTreeNode();
|
|
||||||
if FTree and FTree.Loading then return ;
|
if FTree and FTree.Loading then return ;
|
||||||
cwindowinfo := fwindowinfos.getorcreate(wndnode,ifold);
|
cwindowinfo := fwindowinfos.getorcreate(wndnode,ifold);
|
||||||
if cwindowinfo = fcwindowinfo then
|
if cwindowinfo = fcwindowinfo then
|
||||||
|
|
@ -1030,14 +983,14 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
return ;//
|
return ;//
|
||||||
end
|
end
|
||||||
FTree.Loading := true;
|
FTree.Loading := true;
|
||||||
try
|
try
|
||||||
prs := array();
|
prs := array();
|
||||||
obarray := array();
|
obarray := array();
|
||||||
loadtfmtotree(Ptfm,Ptfm.gettree,FTree.RootItem,FTree,prs,obarray,const inh);
|
loadtfmtotree(Ptfm,Ptfm.gettree,FTree.RootItem,FTree,prs,obarray,const inh);
|
||||||
for i,v in prs do
|
for i,v in prs do
|
||||||
begin
|
begin
|
||||||
va := obarray[v[2]];
|
va := obarray[v[2]];
|
||||||
if va then
|
if va then
|
||||||
begin
|
begin
|
||||||
v[0].SetComponentProperties(v[1],va.GetTrueComponent());
|
v[0].SetComponentProperties(v[1],va.GetTrueComponent());
|
||||||
|
|
@ -1048,7 +1001,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);//当如信息
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 导入tfm文件 %%
|
@explan(说明) 导入tfm文件 %%
|
||||||
|
|
@ -1089,7 +1042,7 @@ type TVclDesigner = class(tvcform)
|
||||||
comp.Cwnd.align := alnone;
|
comp.Cwnd.align := alnone;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
lazy := array();
|
lazy := array();
|
||||||
for i,v in pubs do
|
for i,v in pubs do
|
||||||
begin
|
begin
|
||||||
n := i;
|
n := i;
|
||||||
|
|
@ -1121,7 +1074,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
//comp.DoControlAlign();
|
//comp.DoControlAlign();
|
||||||
end
|
end
|
||||||
function SetFunctionList(v);
|
function SetFunctionList(v); //设置函数信息
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明) 设置当前类使用的函数名称 %%
|
@explan(说明) 设置当前类使用的函数名称 %%
|
||||||
|
|
@ -1253,7 +1206,7 @@ type TVclDesigner = class(tvcform)
|
||||||
FProjectManager.FTslEditer.setdbugruncall(thisfunction(debugproject)); //设置调试回调
|
FProjectManager.FTslEditer.setdbugruncall(thisfunction(debugproject)); //设置调试回调
|
||||||
|
|
||||||
end
|
end
|
||||||
property VariableSelecter read FVariableSelecter;
|
property VariableSelecter read FVariableSelecter; //当前控件树的变量对象
|
||||||
private
|
private
|
||||||
function ViewBitmap(o,e);
|
function ViewBitmap(o,e);
|
||||||
begin
|
begin
|
||||||
|
|
@ -1271,7 +1224,7 @@ type TVclDesigner = class(tvcform)
|
||||||
FViewBitmap.visible := not FViewBitmap.visible;
|
FViewBitmap.visible := not FViewBitmap.visible;
|
||||||
if o then o.Checked := FViewBitmap.visible;
|
if o then o.Checked := FViewBitmap.visible;
|
||||||
end
|
end
|
||||||
function StopProject(o,e);
|
function StopProject(o,e); //停止运行,目前没用
|
||||||
begin
|
begin
|
||||||
//FRounMenu.Enabled := true;
|
//FRounMenu.Enabled := true;
|
||||||
//FStopMenu.Enabled := false;
|
//FStopMenu.Enabled := false;
|
||||||
|
|
@ -1285,11 +1238,11 @@ type TVclDesigner = class(tvcform)
|
||||||
FRounMenu.Enabled := true;
|
FRounMenu.Enabled := true;
|
||||||
FStopMenu.Enabled := false;
|
FStopMenu.Enabled := false;
|
||||||
end
|
end
|
||||||
function editcommandline();
|
function editcommandline();//执行命令行
|
||||||
begin
|
begin
|
||||||
FProjectManager.ShowExeEditer();
|
FProjectManager.ShowExeEditer();
|
||||||
end
|
end
|
||||||
function debugproject(o,e);
|
function debugproject(o,e); //调试运行
|
||||||
begin
|
begin
|
||||||
FProjectManager.debugproject();
|
FProjectManager.debugproject();
|
||||||
end
|
end
|
||||||
|
|
@ -1310,7 +1263,7 @@ type TVclDesigner = class(tvcform)
|
||||||
o.Checked := FObjInspector.Visible
|
o.Checked := FObjInspector.Visible
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function initobjinspector();
|
function initobjinspector(); //初始化
|
||||||
begin
|
begin
|
||||||
project := new TPairSplitter(self);
|
project := new TPairSplitter(self);
|
||||||
project.visible := false;
|
project.visible := false;
|
||||||
|
|
@ -1353,13 +1306,15 @@ end
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
type tfileinfonode = class()
|
type tfileinfonode = class()
|
||||||
fnode;
|
fnode; //文件节点
|
||||||
ftree;
|
ftree; //窗口对应树
|
||||||
ffuncs;
|
ffuncs; //函数名
|
||||||
fvars;
|
fvars; //变量
|
||||||
fnames;
|
fnames; //可用的变量名
|
||||||
|
fcomp; //选中的控件
|
||||||
|
fclk; //是否点击选择
|
||||||
end
|
end
|
||||||
type tfilesinfo = class()
|
type tfilesinfo = class() //控件树存储对象
|
||||||
private
|
private
|
||||||
fdesginer;
|
fdesginer;
|
||||||
fcompclick;
|
fcompclick;
|
||||||
|
|
@ -1375,7 +1330,7 @@ type tfilesinfo = class()
|
||||||
fparent := fp;
|
fparent := fp;
|
||||||
|
|
||||||
end
|
end
|
||||||
function getdata(id); //获得节点信息
|
function getdata(id); //通文件节点获得信息
|
||||||
begin
|
begin
|
||||||
if not id then return fdata;
|
if not id then return fdata;
|
||||||
for i,v in fdata.data do
|
for i,v in fdata.data do
|
||||||
|
|
@ -1383,7 +1338,7 @@ type tfilesinfo = class()
|
||||||
if v.fnode = id then return v;
|
if v.fnode = id then return v;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function gettreebyid(id);
|
function gettreebyid(id); //通过文件节点树获得树
|
||||||
begin
|
begin
|
||||||
if not id then return fdata;
|
if not id then return fdata;
|
||||||
for i,v in fdata.data do
|
for i,v in fdata.data do
|
||||||
|
|
@ -1391,14 +1346,18 @@ type tfilesinfo = class()
|
||||||
if v.fnode = id then return v.FTree;
|
if v.fnode = id then return v.FTree;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function getnodebytree(tr);
|
function getnodebytree(tr); //通过树获得文件节点
|
||||||
begin
|
begin
|
||||||
for i,v in fdata.data do
|
for i,v in fdata.data do
|
||||||
begin
|
begin
|
||||||
if v.ftree = tr then return v.fnode;
|
if v.ftree = tr then
|
||||||
|
begin
|
||||||
|
v.fclk := true;
|
||||||
|
return v.fnode;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function getorcreate(id,ifold);
|
function getorcreate(id,ifold); //如果存在返回,不存在构造并返回
|
||||||
begin
|
begin
|
||||||
nd := getdata(id);
|
nd := getdata(id);
|
||||||
ifold := true ;
|
ifold := true ;
|
||||||
|
|
@ -1414,7 +1373,7 @@ type tfilesinfo = class()
|
||||||
end
|
end
|
||||||
return nd;
|
return nd;
|
||||||
end
|
end
|
||||||
function add(nd,tr,fcs,vs);
|
function add(nd,tr,fcs,vs);//添加一个
|
||||||
begin
|
begin
|
||||||
for i,v in FData.data do
|
for i,v in FData.data do
|
||||||
begin
|
begin
|
||||||
|
|
@ -1443,7 +1402,7 @@ type tfilesinfo = class()
|
||||||
ftreeparnet;
|
ftreeparnet;
|
||||||
fdata;
|
fdata;
|
||||||
end
|
end
|
||||||
type TPropEditGrid = class(TPropGrid)
|
type TPropEditGrid = class(TPropGrid) //属性编辑
|
||||||
{**
|
{**
|
||||||
@explan(说明) 属性编辑 %%
|
@explan(说明) 属性编辑 %%
|
||||||
**}
|
**}
|
||||||
|
|
@ -1467,7 +1426,7 @@ type TPropEditGrid = class(TPropGrid)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
type TEventEditGrid = class(TPropGrid)
|
type TEventEditGrid = class(TPropGrid) //事件编辑器
|
||||||
{**
|
{**
|
||||||
@explan(说明) 事件编辑 %%
|
@explan(说明) 事件编辑 %%
|
||||||
**}
|
**}
|
||||||
|
|
@ -1492,7 +1451,7 @@ type TEventEditGrid = class(TPropGrid)
|
||||||
inherited;
|
inherited;
|
||||||
OndblClick := thisfunction(GridCellDblClick);
|
OndblClick := thisfunction(GridCellDblClick);
|
||||||
end
|
end
|
||||||
function GridCellDblClick(o,e);override;
|
function GridCellDblClick(o,e);override;//双击处理
|
||||||
begin
|
begin
|
||||||
i := e.iitem;
|
i := e.iitem;
|
||||||
j := e.isubitem;
|
j := e.isubitem;
|
||||||
|
|
@ -1569,7 +1528,7 @@ type TDesigImageList = class(TControlImageList)
|
||||||
return r?r:0;
|
return r?r:0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
type TDesignertoolbars = class(TPageControl)
|
type TDesignertoolbars = class(TPageControl) //设计器控件按钮
|
||||||
private
|
private
|
||||||
FToolbars;
|
FToolbars;
|
||||||
FLabels ;
|
FLabels ;
|
||||||
|
|
@ -1621,7 +1580,7 @@ type TDesignertoolbars = class(TPageControl)
|
||||||
else v.Cursor := OCR_NORMAL;
|
else v.Cursor := OCR_NORMAL;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function addbtn(btn,t);
|
function addbtn(btn,t); //加入按钮
|
||||||
begin
|
begin
|
||||||
if not(t and ifstring(t)) then
|
if not(t and ifstring(t)) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -1649,10 +1608,6 @@ type TDesignertoolbars = class(TPageControl)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type TViewBitmap = class(TvcForm)
|
type TViewBitmap = class(TvcForm)
|
||||||
{**
|
{**
|
||||||
@explan(说明) 图片信息采集%%
|
@explan(说明) 图片信息采集%%
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ type TProjectView = class(TVCForm) //
|
||||||
FWrapFolder.Caption := "打包工程到目录";
|
FWrapFolder.Caption := "打包工程到目录";
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
function senodesel(nd);
|
function setnodesel(nd);
|
||||||
begin
|
begin
|
||||||
ftree.setsel(nd);
|
ftree.setsel(nd);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4389,6 +4389,7 @@ type TTslCodeMap=class(TTreeView) //tsl
|
||||||
//Ë«»÷
|
//Ë«»÷
|
||||||
if not FTreeEditer then return;
|
if not FTreeEditer then return;
|
||||||
nd := CurrentNode;
|
nd := CurrentNode;
|
||||||
|
if not nd then return ;
|
||||||
line := nd._tag;
|
line := nd._tag;
|
||||||
if line>0 then
|
if line>0 then
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -2661,7 +2661,7 @@ type TTreeNode=class(TTreeCtlNode)
|
||||||
begin
|
begin
|
||||||
DeleteChildren();
|
DeleteChildren();
|
||||||
end
|
end
|
||||||
function HandleAllocated();
|
(*function HandleAllocated();
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)是否句柄有效%%
|
@explan(说明)是否句柄有效%%
|
||||||
|
|
@ -2674,7 +2674,7 @@ type TTreeNode=class(TTreeCtlNode)
|
||||||
{**
|
{**
|
||||||
@explan(说明) 构建句柄 %%
|
@explan(说明) 构建句柄 %%
|
||||||
**}
|
**}
|
||||||
end
|
end *)
|
||||||
function InsertNode(node,bnode);override;
|
function InsertNode(node,bnode);override;
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -2874,6 +2874,7 @@ type TTreeView=class(TTreeCtl)
|
||||||
@explan(说明) 删除 节点,但是节点不会销毁,请用node.recycling 销毁 %%
|
@explan(说明) 删除 节点,但是节点不会销毁,请用node.recycling 销毁 %%
|
||||||
@param(node)(TTreeNode)
|
@param(node)(TTreeNode)
|
||||||
**}
|
**}
|
||||||
|
return deletenode(node);
|
||||||
if node is class(TTreeNode)then
|
if node is class(TTreeNode)then
|
||||||
begin
|
begin
|
||||||
end else
|
end else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue