Compare commits

...

2 Commits

Author SHA1 Message Date
JianjunLiu 533f6fef61 设计器
打开多个
2022-09-28 17:48:31 +08:00
JianjunLiu c33057b131 设计器
修正bug
2022-09-26 09:59:29 +08:00
5 changed files with 578 additions and 231 deletions

View File

@ -12,9 +12,10 @@ type TVclDesigner = class(tvcform)
@explan(说明) 控件设计器 对象 %% @explan(说明) 控件设计器 对象 %%
**} **}
private private
fcwindowinfo;
fwindowinfos;
fcutcopyinfo;//复制的信息 fcutcopyinfo;//复制的信息
FChmHelper; //帮助文档 FChmHelper; //帮助文档
tmpcanvas; //canvas
FImageList; //图标 FImageList; //图标
FViewBitmap; FViewBitmap;
FCTrans; FCTrans;
@ -26,8 +27,7 @@ type TVclDesigner = class(tvcform)
FParser; FParser;
//******************************** //********************************
FToolBars; FToolBars;
FTree; FTree; //当前的树
FCurrentTreeNode;
FObjInspector; FObjInspector;
FPropGrid; FPropGrid;
FEventGrid; FEventGrid;
@ -105,11 +105,17 @@ type TVclDesigner = class(tvcform)
// height := 90+32{+24}+5; // height := 90+32{+24}+5;
end end
function TreeNode2tfmsub(lib,node,itemnames);//tmf文件字符串 function TreeNode2tfmsub(lib,node,itemnames,nd);//tmf文件字符串
begin begin
if not(node) then if not(node) then
begin begin
it := FTree.RootItem; tr := ftree;
if nd then
begin
tr := fwindowinfos.gettreebyid(nd);
end
if not tr then return ;
it := tr.RootItem;
node := (it.items)[0]; node := (it.items)[0];
end end
if not ifarray(itemnames) then itemnames := array(); if not ifarray(itemnames) then itemnames := array();
@ -232,35 +238,51 @@ type TVclDesigner = class(tvcform)
function cutnode(node); function cutnode(node);
begin begin
fcutcopyinfo := getnodeinfodata(node,1); fcutcopyinfo := getnodeinfodata(node,1);
fcutcopyinfo[2] := true;
end end
function pasttonode(nd); function pasttonode(nd);
begin begin
if fcutcopyinfo then if not fcutcopyinfo then return ;
begin ifc := fcutcopyinfo[2];
r := pastinfotonode(nd,fcutcopyinfo); r := pastinfotonode(nd,fcutcopyinfo,1,not(ifc));
if fcutcopyinfo["name"] and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容 if ifc and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容
end
end end
function pastinfotonode(nd,data); function pastinfotonode(nd,data,fst,notcute);
begin begin
tc := data[0]; tc := data[0];
if ifstring(tc) then tc := class(TDComponent).GetClassItem(tc);
if (tc is class(TDRootComponent)) and not( tc is class(TDMenu)) then if (tc is class(TDRootComponent)) and not( tc is class(TDMenu)) then
begin begin
nd := (FTree.RootItem.items)[0]; tr := nd.owner;
nd := (tr.RootItem.items)[0];
end end
pwnd := nd.Component.Cwnd;
nnd := tc.ComponentCreater(nd,nd.Component.Cwnd); nnd := tc.ComponentCreater(nd,pwnd);
if not nnd then return 1; //加入失败处理 if not nnd then return 1; //加入失败处理
nnd.CreateName(); nnd.CreateName();
FVariableSelecter.additem(nnd); FVariableSelecter.additem(nnd);
BindCwndMessage(nnd.Cwnd); BindCwndMessage(nnd.Cwnd);
if fst and (pwnd is class(TWinControl)) then
pclt := pwnd.ClientRect; //获得父节点区域
for i,v in data do for i,v in data do
begin begin
if ifstring(i) then vi := v;
if not ifstring(i) then continue;
///////////////////////
if pclt and ( (i = "left") or (i= "top") ) then //特殊位置处理
begin begin
//if i in array("left","top") then continue; if notcute then //复制
nnd.SetComponentProperties(i,v); begin
vi+=6;
end
pidx := 2;
if i = "top" then pidx := 3 ; //位置判断
if vi>pclt[pidx] then
begin
vi := integer(pclt[pidx]+(pclt[pidx-2]/2)-5); //位置处理
end
end end
nnd.SetComponentProperties(i,vi);
end end
for i,v in data[1] do for i,v in data[1] do
begin begin
@ -273,8 +295,8 @@ type TVclDesigner = class(tvcform)
r := array(); r := array();
if tc is class(TDComponent) then if tc is class(TDComponent) then
begin begin
r[0] := tc; r[0] := tc.dclassname() ;
if f then r["name"] := tc.name; //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
@ -390,12 +412,12 @@ type TVclDesigner = class(tvcform)
if it then itt := it.Component; if it then itt := it.Component;
if itt then itt.Cwnd.Enabled := f; if itt then itt.Cwnd.Enabled := f;
end end
function TreeNode2tfm(lib,itemnames); //转换文件 function TreeNode2tfm(lib,itemnames,nd); //转换文件
begin begin
{** {**
@explan(说明) 将结构转换为文件格式 %% @explan(说明) 将结构转换为文件格式 %%
**} **}
r := TreeNode2tfmsub(lib,nil,itemnames); r := TreeNode2tfmsub(lib,nil,itemnames,nd);
if itemnames then itemnames := itemnames[1:]; if itemnames then itemnames := itemnames[1:];
return r; return r;
end end
@ -562,7 +584,7 @@ type TVclDesigner = class(tvcform)
else else
begin //工程处理 begin //工程处理
FProjectManager.StopProject(); FProjectManager.StopProject();
FProjectManager.CloseCurrentEdit(); FProjectManager.CloseCurrentEdit("all");
end end
end end
function CompClose(o,e); //隐藏控件 function CompClose(o,e); //隐藏控件
@ -656,7 +678,7 @@ type TVclDesigner = class(tvcform)
t := n.Component; t := n.Component;
if not t then exit; if not t then exit;
mu := t.CreateMenu(); mu := t.CreateMenu();
FTree.PopupMenu := mu; n.owner.PopupMenu := mu;
FPropGrid.Component := t; FPropGrid.Component := t;
FEventGrid.Component := t; FEventGrid.Component := t;
wd := t.cwnd ; wd := t.cwnd ;
@ -670,9 +692,16 @@ type TVclDesigner = class(tvcform)
@explan(说明)右键菜单 %% @explan(说明)右键菜单 %%
**} **}
nd := o._tag; nd := o._tag;
tr := nd.owner;
if not(tr.visible) then
begin
wnd := fwindowinfos.getnodebytree(tr);
FProjectManager.senodesel(wnd);
return ;//
end
if FCurrentNode<>nd then if FCurrentNode<>nd then
begin begin
FTree.SetSel(nd); nd.owner.SetSel(nd);
TreeNodeSelected(nd); TreeNodeSelected(nd);
end end
cp := nd.Component; cp := nd.Component;
@ -757,11 +786,18 @@ type TVclDesigner = class(tvcform)
@explan(说明) 组件被点击 %% @explan(说明) 组件被点击 %%
**} **}
nd := o._tag; nd := o._tag;
tr := nd.owner;
if not(tr.visible) then
begin
wnd := fwindowinfos.getnodebytree(tr);
FProjectManager.senodesel(wnd);
return ;//
end
if FCurrentNode<> nd then if FCurrentNode<> nd then
begin begin
wd := o;//nd.Component.Cwnd; wd := o;//nd.Component.Cwnd;
//if wd is class(TWincontrol) then _wapi.BringWindowToTop(wd.Handle); //if wd is class(TWincontrol) then _wapi.BringWindowToTop(wd.Handle);
FTree.SetSel(nd); tr.SetSel(nd);
TreeNodeSelected(nd); TreeNodeSelected(nd);
end; end;
setcomponentfocus(o,true); setcomponentfocus(o,true);
@ -770,7 +806,7 @@ type TVclDesigner = class(tvcform)
//SetSysParam("cpos_screan",array(e.lolparam,e.hilparam)); //SetSysParam("cpos_screan",array(e.lolparam,e.hilparam));
if FComponentCreater is class(TDRootComponent) then if FComponentCreater is class(TDRootComponent) then
begin begin
FCurrentNode := (FTree.RootItem.items)[0]; FCurrentNode := (tr.RootItem.items)[0];
if not FCurrentNode then exit; if not FCurrentNode then exit;
O1 := FCurrentNode.Component.Cwnd; O1 := FCurrentNode.Component.Cwnd;
if not o1 then exit; if not o1 then exit;
@ -818,13 +854,7 @@ type TVclDesigner = class(tvcform)
**} **}
cct := o._tag; cct := o._tag;
//if FComponentCreater=cct then exit; //if FComponentCreater=cct then exit;
FComponentCreater := cct; FComponentCreater := cct;
return ;
fm := (FTree.RootItem.items)[0];
if not fm then exit;
O1 := fm.Component.Cwnd;
o1.show();
end end
function CloseShowForm(); //主窗口关闭 function CloseShowForm(); //主窗口关闭
@ -832,7 +862,7 @@ type TVclDesigner = class(tvcform)
{** {**
@explan(说明)关闭当前工程窗口%% @explan(说明)关闭当前工程窗口%%
**} **}
FProjectManager.CloseCurrentEdit(); FProjectManager.CloseCurrentEdit(nil,true);
end end
public public
function BindCwndMessage(wnd); function BindCwndMessage(wnd);
@ -857,46 +887,152 @@ type TVclDesigner = class(tvcform)
//WM_NCLBUTTONUP wnd. //WM_NCLBUTTONUP wnd.
if (wnd is class(TVCForm)) then if (wnd is class(TVCForm)) then
begin begin
{wnd.Onclose := function(o,e)begin
e.skip := true;
CloseShowForm();
end ;}
wnd.OnMinimize := thisfunction(CompClose); wnd.OnMinimize := thisfunction(CompClose);
end end
end end
end end
function UnLoadTreeNode(); function UnLoadTreeNode(wndnode);
begin begin
{** {**
@explan(说明) 卸载tree的节点%% @explan(说明) 卸载tree的节点%%
**} **}
fcutcopyinfo := nil; //fcutcopyinfo := nil;
node := FTree.RootItem; 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);
if not nd then return ;
hidenatree(nd);
tr := nd.ftree;
node := tr.RootItem;
if node.ItemCount>0 then if node.ItemCount>0 then
begin begin
DeleteNode((Node.items)[0]); DeleteNode((Node.items)[0]);
end end
FVariableSelecter.clean(); fwindowinfos.deletedata(wndnode);
FEventGrid.Component := array(); tr.Recycling();
FPropGrid.Component := array();
//清除TemporaryNotName
class(TDComponent).TemporaryNotName := array();
end end
private private
FLoadInheritedName; function hidenatree(nd);
begin
FCurrentNode := nil;
if nd then
begin
tr := nd.ftree;
tr.visible := false;
nd.fvars := FVariableSelecter.getlistds();
FEventGrid.Component := array();
FPropGrid.Component := array();
nd.ffuncs := FFunctionSelecter.List.data;
nd.fnames := class(TDComponent).TemporaryNotName;
class(TDComponent).TemporaryNotName:= array();
end
end
function showtree(nd);
begin
FCurrentNode := nil;
tr := nd.ftree;
tr.visible := false;
FTree.visible := true;
FVariableSelecter.setlistds(nd.fvars);
FFunctionSelecter.additems(nd.ffuncs);
class(TDComponent).TemporaryNotName := nd.fnames;
end
function switchtree(nd);
begin
FCurrentNode := nil;
if nd<>fcwindowinfo then
begin
if fcwindowinfo then //处理就有的
begin
hidenatree(fcwindowinfo);
end
fcwindowinfo := nd;
FTree := fcwindowinfo.ftree;
showtree(fcwindowinfo);
rnd := FTree.RootItem;
nnd := rnd.GetNodeByIndex(0);
if nnd then
begin
cp := nnd.Component;
if not cp then return ;
wd := cp.Cwnd;
if wd.visible then
begin
wd.visible := false;
wd.visible := true;
FPropGrid.Component := cp;
FEventGrid.Component := cp;
end
end
end
end
public public
function LoadTreeNode(Ptfm,inh); function ExecuteCommand(cmd,p);override;
begin
case cmd of
"allopendnod":
begin
r := array();
for i,v in fwindowinfos.fdata.data do
begin
r[i] := v.fnode;
end
return r;
end
"hiddrennode":
begin
hidenatree(fcwindowinfo);
fcwindowinfo := nil;
end
"renamefile": //修改名字
begin
node := FTree.RootItem;
nnd := node.GetNodeByIndex(0);
if nnd then
begin
nnd.Component.dclassname(p);
cp := nnd.caption;
pidx := pos(":",cp);
if pidx then cp[pidx:] := ":"+p;
nnd.caption := cp;
end
end
else
return inherited;
end ;
end
function LoadTreeNode(Ptfm,inh,wndnode);
begin begin
{** {**
@explan(说明) 加载tree节点 %% @explan(说明) 加载tree节点 %%
**} **}
FLoadInheritedName := inh; //UnLoadTreeNode();
UnLoadTreeNode(); if FTree and FTree.Loading then return ;
cwindowinfo := fwindowinfos.getorcreate(wndnode,ifold);
if cwindowinfo = fcwindowinfo then
begin
return ;//重复导入
end
switchtree(cwindowinfo);
//处理新的
if ifold then
begin
return ;//
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); 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]];
@ -910,7 +1046,7 @@ type TVclDesigner = class(tvcform)
end ; end ;
FTree.Loading := nil; FTree.Loading := nil;
end end
function loadtfmtotree(p,d,node,wr,prs,obarray); function loadtfmtotree(p,d,node,wr,prs,obarray,inhname);
begin begin
{** {**
@explan(说明) 导入tfm文件 %% @explan(说明) 导入tfm文件 %%
@ -921,17 +1057,16 @@ type TVclDesigner = class(tvcform)
it := class(TDComponent).GetClassItem(dcls); it := class(TDComponent).GetClassItem(dcls);
if not it then if not it then
begin begin
if ("tdcreateform" in FLoadInheritedName) then if ("tdcreateform" in inhname) then
begin begin
it := NEW TDForm(); it := NEW TDForm();
end else end else
if "tdcreatepanel" in FLoadInheritedName then if "tdcreatepanel" in inhname then
begin begin
it := new TDPanelForm(); it := new TDPanelForm();
end else return ; end else return ;
it.dclassname(d["class"]); it.dclassname(d["class"]);
it.Imgs := FImageList.GetImageId("tdcreateform"); it.Imgs := FImageList.GetImageId("tdcreateform");
FLoadInheritedName := array();
end end
comp := it.ComponentCreater(node,wr); comp := it.ComponentCreater(node,wr);
comp.name := d["name"]; comp.name := d["name"];
@ -976,7 +1111,7 @@ type TVclDesigner = class(tvcform)
end end
for i,v in d["object"] do for i,v in d["object"] do
begin begin
call(thisfunction,p,v,comp.TreeNode,comp.Cwnd,prs,obarray); call(thisfunction,p,v,comp.TreeNode,comp.Cwnd,prs,obarray,inhname);
end end
for i,v in lazy do for i,v in lazy do
begin begin
@ -993,15 +1128,15 @@ type TVclDesigner = class(tvcform)
FFunctionSelecter.additem("(none)"); FFunctionSelecter.additem("(none)");
for i,vi in v do for i,vi in v do
begin begin
if vi in array("create","destroy","recycling","loadfromtfm") then continue; if vi in array("(none)","create","destroy","recycling","loadfromtfm") then continue;
FFunctionSelecter.additem(vi); FFunctionSelecter.additem(vi);
end end
end end
function create(AOwner); function create(AOwner);
begin begin
inherited; inherited;
tmpcanvas := new tcanvas(AOwner);
top := 10; top := 10;
left := 10; left := 10;
rect := _wapi.GetScreenRect(); rect := _wapi.GetScreenRect();
@ -1031,9 +1166,9 @@ type TVclDesigner = class(tvcform)
tparent.border := false; tparent.border := false;
pparent := new TPairSplitterSide(self); pparent := new TPairSplitterSide(self);
//**********树************************ //**********树************************
FTree := new TComponentTree(self); //FTree := new TComponentTree(self);
FTree.onselchanged := thisfunction(ClickTreeNode); //FTree.onselchanged := thisfunction(ClickTreeNode);
FTree.align := alClient; //FTree.align := alClient;
//*************属性修改器********************** //*************属性修改器**********************
pedits := new TPageControl(self); pedits := new TPageControl(self);
pedits.align := alclient; pedits.align := alclient;
@ -1057,7 +1192,7 @@ type TVclDesigner = class(tvcform)
FObjInspector.parent := self; FObjInspector.parent := self;
tparent.parent := FObjInspector; tparent.parent := FObjInspector;
pparent.parent := FObjInspector; pparent.parent := FObjInspector;
FTree.parent := tparent; //FTree.parent := tparent;
pedits.parent := pparent ; pedits.parent := pparent ;
FProp.parent := pedits; FProp.parent := pedits;
FEvent.parent := pedits; FEvent.parent := pedits;
@ -1071,7 +1206,8 @@ type TVclDesigner = class(tvcform)
onactivate := thisfunction(OnDesignerActivate); onactivate := thisfunction(OnDesignerActivate);
FImageList := new TDesigImageList(self); FImageList := new TDesigImageList(self);
FTree.Imagelist := FImageList; //FTree.Imagelist := FImageList;
fwindowinfos := new tfilesinfo(self,thisfunction(ClickTreeNode),FImageList,tparent);
//******************toolbar *************** //******************toolbar ***************
tlbar := FProjectManager.FTslEditer.gettoolbar(); tlbar := FProjectManager.FTslEditer.gettoolbar();
savebtn := FProjectManager.FTslEditer.gettoolbarbtn(); savebtn := FProjectManager.FTslEditer.gettoolbarbtn();
@ -1214,6 +1350,97 @@ end
implementation implementation
type tfileinfonode = class()
fnode;
ftree;
ffuncs;
fvars;
fnames;
end
type tfilesinfo = class()
private
fdesginer;
fcompclick;
fimg;
fparent;
public
function create(dser,clk,img,fp);
begin
FData := new tnumindexarray();
fimg := img;
fcompclick := clk;
fdesginer := dser;
fparent := fp;
end
function getdata(id); //获得节点信息
begin
if not id then return fdata;
for i,v in fdata.data do
begin
if v.fnode = id then return v;
end
end
function gettreebyid(id);
begin
if not id then return fdata;
for i,v in fdata.data do
begin
if v.fnode = id then return v.FTree;
end
end
function getnodebytree(tr);
begin
for i,v in fdata.data do
begin
if v.ftree = tr then return v.fnode;
end
end
function getorcreate(id,ifold);
begin
nd := getdata(id);
ifold := true ;
if not nd then
begin
tr := new TComponentTree(fdesginer);
tr.visible := false;
tr.Align := tr.alClient;
tr.parent := fparent;
tr.onselchanged := fcompclick;
nd := add(id,tr,array(),array());
ifold := false;
end
return nd;
end
function add(nd,tr,fcs,vs);
begin
for i,v in FData.data do
begin
if v.fnode=nd then return 0;
end
nnd := new tfileinfonode();
FData.Push(nnd);
nnd.fnode := nd;
nnd.ftree := tr;
nnd.ffuncs := fcs;
nnd.fvars := vs;
return nnd;
end
function deletedata(id); //删除
begin
for i,v in FData.data do
begin
if v.fnode = id then
begin
r := v;
FData.splice(i,1);
return r;
end
end
end
ftreeparnet;
fdata;
end
type TPropEditGrid = class(TPropGrid) type TPropEditGrid = class(TPropGrid)
{** {**
@explan(说明) 属性编辑 %% @explan(说明) 属性编辑 %%
@ -1559,7 +1786,7 @@ begin
o := class(TDComponent); o := class(TDComponent);
o.RegestorClassItems(its); o.RegestorClassItems(its);
its := array(); its := array();
o.class(TPropGrid); o.class(TPropGrid);
for i,v in ini.ReadSectionValues("properties") do //属性 for i,v in ini.ReadSectionValues("properties") do //属性
begin begin
if v then if v then

View File

@ -361,7 +361,7 @@ type TProjectView = class(TVCForm) //
end end
FTslEditer.OnFormCodeSave := function(o,e) FTslEditer.OnFormCodeSave := function(o,e)
begin begin
if FOpendFormTSFfilename then FDesigner.EditerCodeChanged(); if FCurrentOpend and (FCurrentOpend["type"] in array("panel","form")) then FDesigner.EditerCodeChanged();
end end
//FTslEditer.Parent := AOwner; //FTslEditer.Parent := AOwner;
FTmfParser := new TTmfParser(); FTmfParser := new TTmfParser();
@ -476,8 +476,11 @@ type TProjectView = class(TVCForm) //
FWrapFolder.Caption := "打包工程到目录"; FWrapFolder.Caption := "打包工程到目录";
return; return;
end end
function senodesel(nd);
function OpenTreeNode(); begin
ftree.setsel(nd);
end
function OpenTreeNode(); //打开当前节点
begin begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self); if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
cn := FTree.CurrentNode; cn := FTree.CurrentNode;
@ -495,45 +498,50 @@ type TProjectView = class(TVCForm) //
end end
function TreeNodeChanged(o,e); //节点切换 function TreeNodeChanged(o,e); //节点切换
begin begin
if not FTree.PopUpMenu then return; if FTree.PopUpMenu then
it := e.itemnew; begin
if it then it := e.itemnew;
begin if it then
if it.FType="dir" then
begin begin
FDelMenu.Enabled := true; if it.FType="dir" then
FAddMenu.Enabled := true; begin
end else FDelMenu.Enabled := true;
begin FAddMenu.Enabled := true;
FDelMenu.Enabled := true; end else
FAddMenu.Enabled := false; begin
FDelMenu.Enabled := true;
FAddMenu.Enabled := false;
end
if((it.FType="form")and(it.FName <> FMainForm)and(it.FPath()=""))then
begin
FSetMainMenu.parent := FTreePopUpMenu;
end else
begin
FSetMainMenu.parent := nil;
//FAddMenu.visible := false;
end
if(it.FType="tsl")and(it.FName <> FExecEntry)and(it.FPath()="")then
begin
FSetEntryMenu.parent := FTreePopUpMenu;
end else
FSetEntryMenu.parent := nil;
if((it.FType="form")and(it.FName <> FMainForm))or(it.FType="tsl")and(it.FName <> FExecEntry)or(it.FType="tsf")or(it.FType="panel") {or((it.FType = "dir") and it.parent<>FTree.RootNode)}then
begin
FRenameMenu.parent := FTreePopUpMenu;
if CreateMoveDirMenus()then FMoveMenu.parent := FTreePopUpMenu;
else FMoveMenu.parent := nil;
end else
begin
FRenameMenu.parent := nil;
FMoveMenu.parent := nil;
end
cn := FTree.CurrentNode;
OpenFileByName(cn.FName);
end end
if((it.FType="form")and(it.FName <> FMainForm)and(it.FPath()=""))then end
begin //OpenTreeNode();
FSetMainMenu.parent := FTreePopUpMenu;
end else
begin
FSetMainMenu.parent := nil;
//FAddMenu.visible := false;
end
if(it.FType="tsl")and(it.FName <> FExecEntry)and(it.FPath()="")then
begin
FSetEntryMenu.parent := FTreePopUpMenu;
end else
FSetEntryMenu.parent := nil;
if((it.FType="form")and(it.FName <> FMainForm))or(it.FType="tsl")and(it.FName <> FExecEntry)or(it.FType="tsf")or(it.FType="panel") {or((it.FType = "dir") and it.parent<>FTree.RootNode)}then
begin
FRenameMenu.parent := FTreePopUpMenu;
if CreateMoveDirMenus()then FMoveMenu.parent := FTreePopUpMenu;
else FMoveMenu.parent := nil;
end else
begin
FRenameMenu.parent := nil;
FMoveMenu.parent := nil;
end
end
end end
function Add_dir(); function Add_dir(); //添加目录
begin begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self); if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
if FInput.ShowModal()then if FInput.ShowModal()then
@ -643,21 +651,24 @@ type TProjectView = class(TVCForm) //
end end
function ShowCurrentFormCode(); function ShowCurrentFormCode();
begin begin
if FOpendFormTSFfilename then FTslEditer.OpenAndGotoFileByName(FOpendFormTSFfilename); if FCurrentOpend then r := FCurrentOpend.gettsfname();
if r then FTslEditer.OpenAndGotoFileByName(r);
ShowEditor(); ShowEditor();
end end
function AddAFiled(n); //添加成员 function AddAFiled(n); //添加成员
begin begin
if ifstring(n)and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then if ifstring(n)and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then
begin begin
FTslEditer.Addfiled(FOpendFormTSFfilename,n); r := FCurrentOpend.gettsfname();
FTslEditer.Addfiled(r,n);
end end
end end
function adduses(lbs); //添加成员 function adduses(lbs); //添加成员
begin begin
if (lbs) and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then if (lbs) and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then
begin begin
FTslEditer.adduses(FOpendFormTSFfilename,lbs); r := FCurrentOpend.gettsfname();
FTslEditer.adduses(r,lbs);
end end
end end
@ -665,7 +676,8 @@ type TProjectView = class(TVCForm) //
begin begin
if ifstring(n) and FCurrentOpend and (FCurrentOpend["type"]in array("form","panel"))then if ifstring(n) and FCurrentOpend and (FCurrentOpend["type"]in array("form","panel"))then
begin begin
FTslEditer.Delfiled(FOpendFormTSFfilename,n,nn); r := FCurrentOpend.gettsfname();
FTslEditer.Delfiled(r,n,nn);
end end
end end
function AddAFunction(ff); //添加函数 function AddAFunction(ff); //添加函数
@ -673,55 +685,55 @@ type TProjectView = class(TVCForm) //
if ifarray(ff) and ifstring(ff["name"])and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then if ifarray(ff) and ifstring(ff["name"])and FCurrentOpend and(FCurrentOpend["type"] in array("form","panel"))then
begin begin
s := createtslfunction(ff); s := createtslfunction(ff);
r := FTslEditer.AddFunction(FOpendFormTSFfilename,ff["name"],s); fn := FCurrentOpend.gettsfname();
r := FTslEditer.AddFunction(fn,ff["name"],s);
ShowEditor(); ShowEditor();
return r; return r;
end end
end end
function GoToAFunction(n); //跳转到函数 function GoToAFunction(n); //跳转到函数
begin begin
r := FTslEditer.GoToFunction(FOpendFormTSFfilename,n); r := FTslEditer.GoToFunction(FCurrentOpend.gettsfname(),n);
ShowEditor(); ShowEditor();
return r; return r;
end end
function OpenFileByName(n); //打开文件 function OpenFileByName(n); //打开文件
begin begin
fio := ioFileseparator(); fio := ioFileseparator();
nopend := FTree.NameInTree(lowercase(n),nil,true); if not(n and ifstring(n)) then return 0;
if nopend then nopend := nopend.FFileInfo; nopend := FTree.NameInTree(n,nil,true);
if not nopend then return 0; if not nopend then
begin
FDesigner.ExecuteCommand("hiddrennode",nil);
return ;
end
if nopend=FCurrentOpend then if nopend=FCurrentOpend then
begin begin
if FCurrentOpend["type"]in array("tsf","tsl","form","panel")then {if FCurrentOpend["type"]in array("tsf","tsl","form","panel")then
begin begin
dir := FCurrentOpend["dir"]; fn := FCurrentOpend.geteditfilename();
if dir then dir += fio; FTslEditer.OpenAndGotoFileByName(fn);
else dir := "";
FTslEditer.OpenAndGotoFileByName(FCProjectPath+dir+FCurrentOpend["name"]+"."+((FCurrentOpend["type"]in array("tsf","tsl"))?(FCurrentOpend["type"]):("tsf")));
ShowEditor(); //FTslEditer.Show(); ShowEditor(); //FTslEditer.Show();
end end}
return 0; return 0;
end end
CloseCurrentEdit();
FCurrentOpend := nopend; FCurrentOpend := nopend;
case FCurrentOpend["type"]of case FCurrentOpend["type"]of
"tsl","tsf": "tsl","tsf":
begin begin
dir := FCurrentOpend["dir"]; FDesigner.ExecuteCommand("hiddrennode",nil);
if dir then dir += fio; fn := FCurrentOpend.geteditfilename();
else dir := ""; it := FTslEditer.OpenAndGotoFileByName(fn);
it := FTslEditer.OpenAndGotoFileByName(FCProjectPath+dir+FCurrentOpend["name"]+"."+FCurrentOpend["type"]);
if not it then return FCurrentOpend := nil; if not it then return FCurrentOpend := nil;
FOpendScriptFileName := FCProjectPath+dir+FCurrentOpend["name"]+"."+FCurrentOpend["type"];
ShowEditor(); //FTslEditer.Show(); ShowEditor(); //FTslEditer.Show();
end end
"form","panel": "form","panel":
begin begin
//打开class //打开class
dir := FCurrentOpend["dir"]; fn := FCurrentOpend.gettsfname();
if dir then dir += fio; it := FTslEditer.OpenAndGotoFileByName(fn);
else dir := "";
it := FTslEditer.OpenAndGotoFileByName(FCProjectPath+dir+FCurrentOpend["name"]+".tsf");
if not it then if not it then
begin begin
FCurrentOpend := nil; FCurrentOpend := nil;
@ -740,20 +752,18 @@ type TProjectView = class(TVCForm) //
return messageboxa("非窗口类,或者该文件已经损坏","错误",0,self); return messageboxa("非窗口类,或者该文件已经损坏","错误",0,self);
end end
//打开界面 //打开界面
FOpendFormTSFfilename := FCProjectPath+dir+FCurrentOpend["name"]+".tsf";
FOpendScriptFileName := FOpendFormTSFfilename;
FDesigner.caption := "TVCL界面设计器 "+FprojName+"->"+FCurrentOpend["name"]; FDesigner.caption := "TVCL界面设计器 "+FprojName+"->"+FCurrentOpend["name"];
FCurrentTfmName := FCProjectPath+"resource.tfm"+fio+FCurrentOpend["name"]+".tfm"; FTmfParser.ScriptPath := FCurrentOpend.gettmfname();
FTmfParser.ScriptPath := FCurrentTfmName;
FTfmComponets := array(); FTfmComponets := array();
FTmfParser.GetAllSubObjects(nil,FTfmComponets); FTmfParser.GetAllSubObjects(nil,FTfmComponets);
FDesigner.LoadTreeNode(FTmfParser,inh); FDesigner.LoadTreeNode(FTmfParser,inh,FCurrentOpend);
FDesigner.EditerCodeChanged(); FDesigner.EditerCodeChanged();
//FTslEditer.Show();
end else end else
begin begin
FDesigner.ExecuteCommand("hiddrennode",nil);
messageboxa("目前不支持打开该文件格式","提示",0,self); messageboxa("目前不支持打开该文件格式","提示",0,self);
FCurrentOpend := nil; FCurrentOpend := nil;
return; return;
end end
end end
@ -770,7 +780,7 @@ type TProjectView = class(TVCForm) //
return false; // return false; //
end end
fio := ioFileseparator(); fio := ioFileseparator();
CloseCurrentEdit(); //保存当前信息 CloseCurrentEdit("all",true); //保存当前信息
FTslEditer.SaveAndClose(); FTslEditer.SaveAndClose();
FTree.ClearTree(); FTree.ClearTree();
p := GetPathFromFullName(F,n,t); p := GetPathFromFullName(F,n,t);
@ -789,6 +799,7 @@ type TProjectView = class(TVCForm) //
FTree.InitDirs(d["dir"]); FTree.InitDirs(d["dir"]);
FTree.RootDir := n; FTree.RootDir := n;
FCProjectPath := p+fio; FCProjectPath := p+fio;
FTree.fprojectpath := FCProjectPath;
FprojName := n; FprojName := n;
FDesigner.caption := "TVCL界面设计器 "+FprojName; FDesigner.caption := "TVCL界面设计器 "+FprojName;
FTree.ProjectNode.Expand(); FTree.ProjectNode.Expand();
@ -809,7 +820,7 @@ type TProjectView = class(TVCForm) //
FTslEditer.setExecuteEditerSetcmdline(d["commandline"]); FTslEditer.setExecuteEditerSetcmdline(d["commandline"]);
OpenMainForm(); //打开主窗口2 OpenMainForm(); //打开主窗口2
//设置选中节点 20210413 添加 //设置选中节点 20210413 添加
mnode := FTree.NameInTree(lowercase(FMainForm),nil,true); mnode := FTree.NameInTree((FMainForm),nil,true);
if FTree.CurrentNode <> mnode then if FTree.CurrentNode <> mnode then
begin begin
FTree.SetSel(mnode); FTree.SetSel(mnode);
@ -840,6 +851,7 @@ type TProjectView = class(TVCForm) //
cn := FTree.CurrentNode; cn := FTree.CurrentNode;
if cn.FType="dir" then DeleteCurrentDir(); if cn.FType="dir" then DeleteCurrentDir();
else DeleteCurrentFile(); else DeleteCurrentFile();
FCurrentOpend := nil;
end end
function DeleteCurrentDir(); //删除当前目录; function DeleteCurrentDir(); //删除当前目录;
begin begin
@ -850,7 +862,7 @@ type TProjectView = class(TVCForm) //
begin begin
if FCurrentOpend and FTree.FileNameInCurrentNode(FCurrentOpend["name"])then if FCurrentOpend and FTree.FileNameInCurrentNode(FCurrentOpend["name"])then
begin begin
CloseCurrentEdit(); CloseCurrentEdit(nil,true);
end end
if IDOK=Messageboxa("是否删除文件夹及其类容:"+cn.Caption,"提示",1,self)then if IDOK=Messageboxa("是否删除文件夹及其类容:"+cn.Caption,"提示",1,self)then
begin begin
@ -864,14 +876,13 @@ type TProjectView = class(TVCForm) //
function DeleteCurrentFile(); //删除当前的文件 function DeleteCurrentFile(); //删除当前的文件
begin begin
nd := FTree.CurrentNode; nd := FTree.CurrentNode;
if nd then d := nd.FFileInfo; d := nd;
if not ifarray(d)then return;
fio := ioFileseparator(); fio := ioFileseparator();
if lowercase(d["name"]+".tsf")=lowercase(FMainForm+".tsf")then return Messageboxa("主窗口不能删除","提示",0,self); if lowercase(d["name"]+".tsf")=lowercase(FMainForm+".tsf")then return Messageboxa("主窗口不能删除","提示",0,self);
if lowercase(d["name"]+".tsl")=lowercase(FExecEntry+".tsl")then return Messageboxa("执行入口文件不能删除","提示",0,self); if lowercase(d["name"]+".tsl")=lowercase(FExecEntry+".tsl")then return Messageboxa("执行入口文件不能删除","提示",0,self);
if IDOK=Messageboxa("即将从工程中移除:"+d["name"],"提示",1,self)then if IDOK=Messageboxa("即将从工程中移除:"+d["name"],"提示",1,self)then
begin begin
if FCurrentOpend and FCurrentOpend["name"]=d["name"]then CloseCurrentEdit(); CloseCurrentEdit(nd,true);
ml := d["dir"]; ml := d["dir"];
if ifstring(ml)and ml then ml := ml+fio; if ifstring(ml)and ml then ml := ml+fio;
else ml := ""; else ml := "";
@ -892,7 +903,6 @@ type TProjectView = class(TVCForm) //
end end
"tsf": "tsf":
begin begin
//echo FCProjectPath+ml+d["name"]+"."+d["type"]+"\r\n";
FileDelete("",FCProjectPath+ml+d["name"]+"."+d["type"]); FileDelete("",FCProjectPath+ml+d["name"]+"."+d["type"]);
end end
end; end;
@ -1014,7 +1024,7 @@ type TProjectView = class(TVCForm) //
begin begin
if not LegalVariableName(n)then return MessageboxA("名字不合法,请重试","提示",0,self); if not LegalVariableName(n)then return MessageboxA("名字不合法,请重试","提示",0,self);
if FTree.NameInTree(lowercase(n),nil,false)then return MessageboxA("重复的文件名","提示",0,self); if FTree.NameInTree(lowercase(n),nil,false)then return MessageboxA("重复的文件名","提示",0,self);
CloseCurrentEdit(); //CloseCurrentEdit();
cn := FTree.CurrentNode; cn := FTree.CurrentNode;
if cn.FType="dir" then return; if cn.FType="dir" then return;
fio := ioFileseparator(); fio := ioFileseparator();
@ -1080,6 +1090,7 @@ type TProjectView = class(TVCForm) //
cn.FFileInfo := cnifno; cn.FFileInfo := cnifno;
cn.caption := n; cn.caption := n;
SaveProjInfo(); SaveProjInfo();
FDesigner.ExecuteCommand("renamefile",lowercase(n));
end else end else
return MessageboxA("更名错误","提示",0,self); return MessageboxA("更名错误","提示",0,self);
end end
@ -1228,36 +1239,51 @@ type TProjectView = class(TVCForm) //
//FTslEditer.Show(); //FTslEditer.Show();
ShowEditor(); ShowEditor();
end end
function saveCurrentEdit(); //保存正在编辑 function saveCurrentEdit(nd); //编辑的节点,不送入保存当前节点
begin begin
if FCurrentOpend then if not nd then nd := FCurrentOpend;
if nd then
begin begin
case FCurrentOpend["type"]of case nd["type"]of
"form","panel": "form","panel":
begin begin
//保存tfm //保存tfm
if FCurrentTfmName then fn := nd.gettmfname();
if fn then
begin begin
tfm := FDesigner.TreeNode2tfm(lib,items); tfm := FDesigner.TreeNode2tfm(lib,items,nd);
ReWriteString(FCurrentTfmName,tfm); ReWriteString(fn,tfm);
end end
end end
end; end;
FTslEditer.SaveFileByName(FOpendScriptFileName); FTslEditer.SaveFileByName(nd.geteditfilename());
end end
end end
function CloseCurrentEdit(); //关闭当前的编辑 function CloseCurrentEdit(nd,st); //关闭当前的编辑
begin begin
if FCurrentOpend then if nd="all" then
begin begin
saveCurrentEdit(); r := FDesigner.ExecuteCommand("allopendnod",nil);
for i,v in r do
begin
CloseCurrentEdit(v,true);
end
return ;
end
if not nd then
begin
nd := FCurrentOpend;
end
if nd then
begin
saveCurrentEdit(nd);
//FTslEditer.CloseEditor(); //FTslEditer.CloseEditor();
FDesigner.caption := "TVCL界面设计器 "+FprojName; FDesigner.caption := "TVCL界面设计器 "+FprojName;
FDesigner.UnLoadTreeNode(); if st then
//class(TDComponent).TemporaryNotName := array(); begin
FCurrentOpend := nil; FDesigner.UnLoadTreeNode(nd);
FOpendFormTSFfilename := nil; if nd = FCurrentOpend then FCurrentOpend := nil;
FOpendScriptFileName := nil; end
end end
end end
private private
@ -1268,7 +1294,7 @@ type TProjectView = class(TVCForm) //
begin begin
nd := FTree.CurrentNode; nd := FTree.CurrentNode;
if nd then if nd then
d := nd.FFileInfo; d := nd.FFileInfo;
cp := nd.caption; cp := nd.caption;
fio := ioFileseparator(); fio := ioFileseparator();
if not ifarray(d) then return ; if not ifarray(d) then return ;
@ -1277,7 +1303,10 @@ type TProjectView = class(TVCForm) //
ndr := (o.caption="<主目录>")?"":(o.caption+fio); ndr := (o.caption="<主目录>")?"":(o.caption+fio);
if IDOK=Messageboxa("即将移动文件:"+d["name"]+" 到目录 "+ (ndr?ndr:"主目录"),"提示",1,self) then if IDOK=Messageboxa("即将移动文件:"+d["name"]+" 到目录 "+ (ndr?ndr:"主目录"),"提示",1,self) then
begin begin
if FCurrentOpend and FCurrentOpend["name"] = d["name"] then CloseCurrentEdit(); if FCurrentOpend and FCurrentOpend["name"] = d["name"] then
begin
CloseCurrentEdit(nil,true);
end
ml := d["dir"]; ml := d["dir"];
if ifstring(ml) and ml then ml := ml+fio; if ifstring(ml) and ml then ml := ml+fio;
else ml := ""; else ml := "";
@ -1451,8 +1480,6 @@ type TProjectView = class(TVCForm) //
end end
private //私有成员变量 private //私有成员变量
FWrapFolder; FWrapFolder;
FOpendFormTSFfilename;
FOpendScriptFileName;
FDesigner; FDesigner;
FCurrentOpend; FCurrentOpend;
FOpenProjectFile; FOpenProjectFile;
@ -1489,7 +1516,8 @@ type TProjectView = class(TVCForm) //
FAddMenuTsl; FAddMenuTsl;
FOpenMenu; FOpenMenu;
public public
FTslEditer; FTslEditer;
private
end end
type TTslEditer = class(TEditer) type TTslEditer = class(TEditer)
@ -1675,7 +1703,13 @@ type TFileTree = class(TTreeCtl)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
fio := AOwner.fio;
end end
function operator[](idx);
begin
if ifarray(FFFileInfo) then
return FFFileInfo[idx];
end
property FType read FFType write SetFtype; //类型 property FType read FFType write SetFtype; //类型
function SetFtype(v); function SetFtype(v);
begin begin
@ -1689,17 +1723,74 @@ type TFileTree = class(TTreeCtl)
ml := Owner.GetNodePath(self); ml := Owner.GetNodePath(self);
if FFType="dir" then if FFType="dir" then
begin begin
if FName and ml then return ml+"\\"+FName; if FName and ml then return ml+fio+FName;
return FName; return FName;
//return FName?():ml; //return FName?():ml;
end else end else
return ml; return ml;
end end
function FPath2();
begin
ml := Owner.GetNodePath(self);
if FFType="dir" then
begin
if FName and ml then return ml+fio+FName;
return FName;
//return FName?():ml;
end else
if ml then return ml+fio;
return ml;
end
function geteditfilename(nn);//获得编辑的文件名
begin
r := gettsfname(nn);
if r then return r;
r := gettslname(nn);
return r;
end
function gettsfname(nn); //获得tsf
begin
if FFType in array( "tsf","form","panel") then
begin
if not(ifstring(nn) and nn) then nn := Fname;
return Owner.fprojectpath+FPath2()+nn+".tsf";
end
end
function gettslname(nn); //获得tsl
begin
if FFType in array( "tsl") then
begin
if not(ifstring(nn) and nn) then nn := Fname;
return Owner.fprojectpath+FPath2()+nn+".tsl";
end
end
function gettmfname(nn);//tfm文件名
begin
if FFType in array( "form","panel") then
begin
if not(ifstring(nn) and nn) then nn := Fname;
return Owner.fprojectpath+"resource.tfm"+fio+nn+".tfm";
end
end
property FFileInfo read FFFileInfo write setfileinfo;
fio;
fdtree;
//function SetType() //function SetType()
FName; // a FName; // a
FFType; //dir FFType; //dir
FFileInfo; private
function setfileinfo(v);
begin
FFFileInfo := v;
if ifarray(v) then
begin
FName := v["name"];
end
end
FFFileInfo;
end end
fprojectpath;
fio;
function CreateTreeNode();override; function CreateTreeNode();override;
begin begin
return New TTNode(self); return New TTNode(self);
@ -1710,7 +1801,7 @@ type TFileTree = class(TTreeCtl)
dir := array(); dir := array();
files := array(); files := array();
GetNodeLeafs(FPNode,leafs); GetNodeLeafs(FPNode,leafs);
fio := ioFileseparator(); //fio := ioFileseparator();
for i,v in leafs do for i,v in leafs do
begin begin
ph := GetNodePath(v); ph := GetNodePath(v);
@ -1765,9 +1856,18 @@ type TFileTree = class(TTreeCtl)
end end
end end
end end
function treefilename(n);
begin
{$ifdef linux}
return n;
{$endif}
return lowercase(n);
end
function NameInTree(n,nd,iffile); //名字是否在数上面 function NameInTree(n,nd,iffile); //名字是否在数上面
begin begin
//n为小写 //n为小写
if not ifstring(n)then return nil; if not ifstring(n)then return nil;
if not nd then nd := FPNode; if not nd then nd := FPNode;
for i := 0 to nd.ItemCount-1 do for i := 0 to nd.ItemCount-1 do
@ -1775,9 +1875,9 @@ type TFileTree = class(TTreeCtl)
ind := nd.GetNodeByIndex(i); ind := nd.GetNodeByIndex(i);
if(iffile)then if(iffile)then
begin begin
if ind.FType <> "dir" and ind.FName=n then return ind; if ind.FType <> "dir" and treefilename(ind.FName)=treefilename(n) then return ind;
end else end else
if ind.FName=n then return ind; if treefilename(ind.FName) = treefilename(n) then return ind;
if ind.FType="dir" then if ind.FType="dir" then
begin begin
r := NameInTree(n,ind,iffile); r := NameInTree(n,ind,iffile);
@ -1788,6 +1888,8 @@ type TFileTree = class(TTreeCtl)
function Create(AOwner);override; function Create(AOwner);override;
begin begin
inherited; inherited;
fprojectpath := "";
fio := ioFileseparator();
ImageList := CreateaImageList(self,FImageIdName); ImageList := CreateaImageList(self,FImageIdName);
hasline := true; hasline := true;
FPNode := CreateTreeNode(); FPNode := CreateTreeNode();

View File

@ -824,6 +824,7 @@ type TComponentTree = class(TTreeView) //
function create(AOwner);override; function create(AOwner);override;
begin begin
inherited; inherited;
asdomain := true;
FDesigner := AOwner; FDesigner := AOwner;
end end
function GetRootNode();override; //根节点 function GetRootNode();override; //根节点
@ -854,7 +855,12 @@ type TDForm = class(TDComponent)
private private
static FClassName; static FClassName;
static FParser; static FParser;
function savecurrentform(o,e); function closecurrentform(o,e); //关闭当前窗口
begin
cp := o.Component;
cp.Cwnd._send_(o.WM_CLOSE,0,0,1);
end
function savecurrentform(o,e);//保存当前窗口
begin begin
cp:=o.Component; cp:=o.Component;
if not cp then exit; if not cp then exit;
@ -863,7 +869,6 @@ type TDForm = class(TDComponent)
if d then if d then
begin begin
d.saveCurrentForm(); d.saveCurrentForm();
//d.openclassfile();
end end
end end
function OpenClass(o,e); function OpenClass(o,e);
@ -882,9 +887,11 @@ type TDForm = class(TDComponent)
begin begin
r := array(); r := array();
//r[0] := array("type":"menu","caption":"保存窗口"); //r[0] := array("type":"menu","caption":"保存窗口");
r[0] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass)); idx := 0;
r[1] := array("type":"menu","caption":"保存当前窗口","onclick":thisfunction(savecurrentform)); r[idx++] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass));
r[2] := array("type":"menu","caption":"粘贴","onclick":thisfunction(pasteclick)); r[idx++] := array("type":"menu","caption":"关闭窗口","onclick":thisfunction(closecurrentform));
r[idx++] := array("type":"menu","caption":"保存窗口","onclick":thisfunction(savecurrentform));
r[idx++] := array("type":"menu","caption":"粘贴","onclick":thisfunction(pasteclick));
//r[2] := array("type":"menu","caption":"打开工程目录","onclick":thisfunction(openProjectDir)); //r[2] := array("type":"menu","caption":"打开工程目录","onclick":thisfunction(openProjectDir));
return r; return r;
end end
@ -958,6 +965,63 @@ type TDPanelForm = class(TDForm)
inherited; inherited;
end end
end end
type TDMenu = class(TDMenuBase)
{**
@explan(说明) 普通菜单设计器控件 %%
**}
function HitTip();override;
begin
return inherited;
return "menu通过右键添加";
end
function classification();override;
begin
return "非点击添加控件" ;
end
function InToolBar();override;
begin
return false;
end
function WndClass();override;
begin
return class(tmenu);
end
function Create(AOwner);override;
begin
inherited;
end
function CheckParent(p,pwnd);override;
begin
r := (p is class(TDMenu)) or
(p is class(TDMainMenu)) or
(p is class(TDPopUpMenu));
Pwnd := p.GetTrueComponent;
return r;
end
private
function ifmainmenunode(pwnd);
begin
if pwnd is class(tmainmenu) then return true;
if pwnd is class(tmenu) then
begin
return ifmainmenunode(pwnd.parent);
end
return false;
end
public
function SetViewParent(wnd,pwnd);override;
begin
if ifmainmenunode(pwnd) then wnd.parent := pwnd;
end
function ComponentCreater(node,owner);override;
begin
r := inherited;
node.owner.expand(node);
return r;
end
end
implementation implementation
type TComponentMenu= class(tmenu) //设计器右键菜单 type TComponentMenu= class(tmenu) //设计器右键菜单
@ -1935,63 +1999,7 @@ type TDMainMenu = class(TDMenuBase)
end end
type TDMenu = class(TDMenuBase)
{**
@explan(说明) 普通菜单设计器控件 %%
**}
function HitTip();override;
begin
return inherited;
return "menu通过右键添加";
end
function classification();override;
begin
return "非点击添加控件" ;
end
function InToolBar();override;
begin
return false;
end
function WndClass();override;
begin
return class(tmenu);
end
function Create(AOwner);override;
begin
inherited;
end
function CheckParent(p,pwnd);override;
begin
r := (p is class(TDMenu)) or
(p is class(TDMainMenu)) or
(p is class(TDPopUpMenu));
Pwnd := p.GetTrueComponent;
return r;
end
private
function ifmainmenunode(pwnd);
begin
if pwnd is class(tmainmenu) then return true;
if pwnd is class(tmenu) then
begin
return ifmainmenunode(pwnd.parent);
end
return false;
end
public
function SetViewParent(wnd,pwnd);override;
begin
if ifmainmenunode(pwnd) then wnd.parent := pwnd;
end
function ComponentCreater(node,owner);override;
begin
r := inherited;
node.owner.expand(node);
return r;
end
end
type TDAction = class(TDComponent) type TDAction = class(TDComponent)
{** {**
@explan(说明) action设计器控件 %% @explan(说明) action设计器控件 %%

View File

@ -723,6 +723,7 @@ type TTslDebuga=class(TCustomControl)
if n then if n then
begin begin
//echo "\r\n====add:",usr,"====",n,"===",idx; //echo "\r\n====add:",usr,"====",n,"===",idx;
//echo "\r\n>>",(idx+1)," ",item.ScriptPath;
dbgsetbreak(FConnectchannel,usr,n,idx+1); dbgsetbreak(FConnectchannel,usr,n,idx+1);
end end
end end

View File

@ -573,10 +573,19 @@ type TListVariableFilter = class(TListVariable)
FDesigner.AddusesFromEdit(v.libs()); FDesigner.AddusesFromEdit(v.libs());
FDesigner.AddFiledFromEdit(v.name+":"+v.dclassname); FDesigner.AddFiledFromEdit(v.name+":"+v.dclassname);
FDesigner.EditerCodeChanged(); FDesigner.EditerCodeChanged();
//echo "\r\nadd:",v.name;
//echo "\r\n variable count:",FVlist.Count;
end end
property Filter Write SetFilter; property Filter Write SetFilter;
function getlistds();
begin
r := array();
for i := 0 to FVlist.Count-1 do r[i] := FVlist[i];
return r;
end
function setlistds(d);
begin
FVlist.clean();
for i,v in d do FVlist.add(v);
end
private private
FDesigner; FDesigner;
end end