设计器

优化体验
This commit is contained in:
JianjunLiu 2022-09-30 11:37:37 +08:00
parent 7b404b5ed0
commit 1dac8f9a56
4 changed files with 58 additions and 20 deletions

View File

@ -956,8 +956,9 @@ type TVclDesigner = class(tvcform)
fcwindowinfo := nd; fcwindowinfo := nd;
FTree := fcwindowinfo.ftree; FTree := fcwindowinfo.ftree;
showtree(fcwindowinfo); showtree(fcwindowinfo);
rnd := FTree.RootItem; //rnd := FTree.RootItem;
nnd := rnd.GetNodeByIndex(0); //nnd := rnd.GetNodeByIndex(0);
nnd := ftree.CurrentNode;
if nnd then if nnd then
begin begin
cp := nnd.Component; cp := nnd.Component;
@ -967,9 +968,10 @@ type TVclDesigner = class(tvcform)
begin begin
wd.visible := false; wd.visible := false;
wd.visible := true; wd.visible := true;
FPropGrid.Component := cp;
FEventGrid.Component := cp;
end end
FPropGrid.Component := cp;
FEventGrid.Component := cp;
end end
end end
end end

View File

@ -506,6 +506,7 @@ type TProjectView = class(TVCForm) //
if FTree.PopUpMenu then if FTree.PopUpMenu then
begin begin
it := e.itemnew; it := e.itemnew;
if it=ftree.RootNode then return FDesigner.ExecuteCommand("hiddrennode",nil);
if it then if it then
begin begin
if it.FType="dir" then if it.FType="dir" then
@ -743,10 +744,11 @@ type TProjectView = class(TVCForm) //
FDesigner.ExecuteCommand("hiddrennode",nil); FDesigner.ExecuteCommand("hiddrennode",nil);
fn := FCurrentOpend.geteditfilename(); fn := FCurrentOpend.geteditfilename();
it := FTslEditer.OpenAndGotoFileByName(fn); it := FTslEditer.OpenAndGotoFileByName(fn);
if not it then return FCurrentOpend := nil; if not it then
begin
return FCurrentOpend := nil;
end
ShowEditor(); //FTslEditer.Show(); ShowEditor(); //FTslEditer.Show();
end end
"form","panel": "form","panel":
begin begin
@ -921,7 +923,8 @@ type TProjectView = class(TVCForm) //
end; end;
end end
//FTree.DeleteNode(nd); //FTree.DeleteNode(nd);
nd.Recycling(); FTree.DeleteCurrentNode();
//nd.Recycling();
SaveProjInfo(); SaveProjInfo();
end end
end end
@ -1903,7 +1906,7 @@ type TFileTree = class(TTreeCtl)
FPNode.Caption := "当前工程"; FPNode.Caption := "当前工程";
FPNode.FType := "dir"; FPNode.FType := "dir";
FPNode.parent := RootNode; FPNode.parent := RootNode;
SetSel(FPNode); //SetSel(FPNode);
end end
function GetNodesByName(nds,n); function GetNodesByName(nds,n);
begin begin
@ -1968,10 +1971,10 @@ type TFileTree = class(TTreeCtl)
C := CurrentNode; C := CurrentNode;
if not c then return false; if not c then return false;
if FPNode=c then return false; if FPNode=c then return false;
pc := c.parent; //pc := c.parent;
DeleteNode(c); //DeleteNode(c);
if pc.ItemCount<1 then setsel(pc); //if pc.ItemCount<1 then setsel(pc);
else setsel(pc.GetNodeByIndex(0)); //else setsel(pc.GetNodeByIndex(0));
c.Recycling(); c.Recycling();
end end
function GetNodePath(nd); //获得目录节点的path function GetNodePath(nd); //获得目录节点的path

View File

@ -3199,11 +3199,35 @@ type TPairSplitter=class(tcustomcontrol) //
end end
function MouseMove(o,e);override; function MouseMove(o,e);override;
begin begin
if (csDesigning in ComponentState) then return ;
if FIs_Draging then if FIs_Draging then
begin begin
nxy := clienttowindow(e.xpos,e.ypos); nxy := clienttowindow(e.xpos,e.ypos);
_wapi.ImageList_DragMove(nxy[0],nxy[1]); _wapi.ImageList_DragMove(nxy[0],nxy[1]);
end end else
begin
idx := 0;
for i:= 0 to FSides.count-1 do
begin
vi := FSides[i];
if vi.Enabled and vi.Visible then idx++;
if idx>1 then break;
end
if idx>1 then
begin
if FSplitterType=pstHorizontal then
begin
cursor := OCR_SIZEWE;
end else
if FSplitterType=pstVertical then
begin
cursor := OCR_SIZENS ;
end
end else
begin
cursor := OCR_NORMAL;
end
end
inherited; inherited;
end end
function RemoveSide(ASide); function RemoveSide(ASide);

View File

@ -465,6 +465,10 @@ type TcustomTreeCtlNode = class(TVirtualListItem)
CurrentDeleteNode := nd; CurrentDeleteNode := nd;
nd.parent := self(true); nd.parent := self(true);
CurrentDeleteNode := nil; CurrentDeleteNode := nil;
if nd = Owner.CurrentNode then
begin
Owner.SetSel(nil);
end
finally finally
Owner.DecPaintLock(); Owner.DecPaintLock();
end end
@ -1696,7 +1700,11 @@ type TcustomTreeCtl = class(TVirtualList)
@explan(说明) 设置选中节点 %% @explan(说明) 设置选中节点 %%
@param(it)(TcustomTreeCtlNode) 节点 %% @param(it)(TcustomTreeCtlNode) 节点 %%
**} **}
if(it is class(TcustomTreeCtlNode))and it.Owner=self then if flockchangedcall then
begin
return ;//
end
if ifnil(it) or ( (it is class(TcustomTreeCtlNode))and (it.Owner=self)) then
begin begin
r := CallSelChange(it); r := CallSelChange(it);
if r then return; if r then return;
@ -1711,6 +1719,7 @@ type TcustomTreeCtl = class(TVirtualList)
end end
function GoToNode(it); function GoToNode(it);
begin begin
if not((it is class(TcustomTreeCtlNode))and (it.Owner=self)) then return ;
if NodeInList(it)then if NodeInList(it)then
begin begin
//return SetTopLine(GetItemIndex(it)); //滚动 //return SetTopLine(GetItemIndex(it)); //滚动
@ -1756,15 +1765,12 @@ type TcustomTreeCtl = class(TVirtualList)
end end
inherited; inherited;
end end
function CreateNode();virtual; {function CreateNode();virtual;
begin begin
{**
@ignore(ºöÂÔ) %%
**}
return CreateTreeNode(); return CreateTreeNode();
r := new TcustomTreeCtlNode(self(true)); r := new TcustomTreeCtlNode(self(true));
return r; return r;
end end}
function CreateTreeNode();virtual; function CreateTreeNode();virtual;
begin begin
r := new TcustomTreeCtlNode(self(true)); r := new TcustomTreeCtlNode(self(true));
@ -1827,7 +1833,9 @@ type TcustomTreeCtl = class(TVirtualList)
begin begin
//setprofiler(1+2+4); //setprofiler(1+2+4);
//exportfile(ftstream(),"","d:\\tst\\abc.stm",getprofilerinfo(true)); //exportfile(ftstream(),"","d:\\tst\\abc.stm",getprofilerinfo(true));
flockchangedcall := true;
if FRootItem then FRootItem.Recycling(); if FRootItem then FRootItem.Recycling();
flockchangedcall := false;
FRootItem := nil; FRootItem := nil;
FCurrentNode := nil; FCurrentNode := nil;
FOnSelChanging := nil; FOnSelChanging := nil;
@ -1879,6 +1887,7 @@ type TcustomTreeCtl = class(TVirtualList)
return FRootItem; return FRootItem;
end end
private private
flockchangedcall;//
FOnlyLeafNodeCheckMark; FOnlyLeafNodeCheckMark;
FNodeHierarchyWidth; FNodeHierarchyWidth;
FMulSelected; FMulSelected;