设计器

优化细节
This commit is contained in:
JianjunLiu
2023-01-10 11:27:05 +08:00
parent 8ed3ce6baa
commit 12f73f17d6
8 changed files with 185 additions and 26 deletions
+38 -7
View File
@@ -309,6 +309,7 @@ type TVclDesigner = class(tvcform)
end
public //设计器工程
ffilemenu;
fviewmenu;
function OpenFileFromTpjFile(); //从文件打开工程
begin
FProjectFileOpener.caption := "打开";
@@ -468,7 +469,7 @@ type TVclDesigner = class(tvcform)
("type":"menu","caption":"代码编辑","onclick":thisfunction(openclassfile),
"bitmap":geteditcodebitmapinfo())
)),
("type":"menu","caption":"视图","items":(
("type":"menu","caption":"视图","filed":"fviewmenu","items":(
("type":"menu","caption":"工程文件管理","checked":1,"bitmap":GetWindowMgrBmp(),"onclick":thisfunction(ShowProjectView)),
("type":"menu","caption":"对象浏览","checked":true,"onclick":thisfunction(Mobjinspect),
"bitmap":getdefaultbmpinfo())
@@ -587,17 +588,21 @@ type TVclDesigner = class(tvcform)
@explan(说明) 移动 控件 %%
**}
//setcomponentfocus(o,false);
FPropGrid.SetGridValue("left",O.left,O) ;
FPropGrid.SetGridValue("top",o.top,O);
l := O.left;
r := o.top;
if not FPropGrid.SetGridValue("left",l,O) then o.setpublish("left",l);
if not FPropGrid.SetGridValue("top",r,O) then o.setpublish("top",r);
end
function ComponentSize(o,e);//大小改变
begin
{**
@explan(说明) 调整控件大小 %%
**}
FPropGrid.SetGridValue("width",o.width,O);
FPropGrid.SetGridValue("height",o.height,O);
w := o.width;
h := o.height;
if not FPropGrid.SetGridValue("width",w,O) then o.setpublish("width",w);
if not FPropGrid.SetGridValue("height",h,O) then o.setpublish("height",h);
//setcomponentfocus(o,false);
end
function DesignerClose(o,e) //控件窗口关闭
@@ -984,6 +989,27 @@ type TVclDesigner = class(tvcform)
FPropGrid.Component := nd.fcomp ;
FEventGrid.Component := nd.fcomp ;
end
function showcurrent();
begin
nd := fcwindowinfo;
if nd then
begin
FTree := fcwindowinfo.ftree;
nnd := FTree.RootItem.GetNodeByIndex(0);
if nnd then
begin
cp := nnd.Component;
if cp then
begin
wd := cp.Cwnd;
if wd.visible then
begin
_wapi.SetActiveWindow(wd.Handle);
end
end
end
end
end
function switchtree(nd); //切换控件树
begin
FCurrentNode := nil;
@@ -1037,6 +1063,10 @@ type TVclDesigner = class(tvcform)
end
return r;
end
"shownode":
begin
showcurrent();
end
"hiddrennode":
begin
hidenatree(fcwindowinfo);
@@ -1316,7 +1346,8 @@ type TVclDesigner = class(tvcform)
FProjectFileOpener.filter := array("tvcl工程":"*.tpj");
FProjectFileOpener.parent := self;
FProjectManager.FTslEditer.setdbugruncall(thisfunction(debugproject)); //设置调试回调
FProjectManager.newmenu.parent := ffilemenu;//
FProjectManager.newmenu.parent := ffilemenu;//
FProjectManager.goformmenu.parent := fviewmenu;//
//fnewmenu
end
+48 -2
View File
@@ -14,7 +14,6 @@ type TProjectManagerForm = class(TVCForm) //
Border := false;
FProjectCoder := new TDesignerProjectsRecoder();
FDesigner := AOwner;
//FileOpen.filter := array("tvcl工程":"*.tpj");
visible := false;
WsSizeBox := true;
caption := "历史工程";
@@ -478,7 +477,12 @@ type TProjectView = class(TVCForm) //
FWrapFolder.Caption := "打包工程到目录";
fnewmenu := new TMenu(self);
fgoformmenu := new TMenu(self);
fgoformmenu.caption := "回到设计器";
fgoformmenu.ShortCut := "f12";
fgoformmenu.OnClick := thisfunction(filetoform);
fnewmenu.Enabled := false;
fgoformmenu.Enabled := false;
fnewmenu.caption := "新建";
for i,v in array("form","panel","script","tsf") do
begin
@@ -638,6 +642,7 @@ type TProjectView = class(TVCForm) //
function Add_form();
begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
return AddFormToCurrentDir(createnamea("form"));
if FInput.ShowModal()then
begin
AddFormToCurrentDir(FInput.GetEditV(1));
@@ -646,6 +651,7 @@ type TProjectView = class(TVCForm) //
function Add_panel();
begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
return AddPanelToCurrentDir(createnamea("pal"));
if FInput.ShowModal()then
begin
AddPanelToCurrentDir(FInput.GetEditV(1));
@@ -654,6 +660,7 @@ type TProjectView = class(TVCForm) //
function Add_tsf();
begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
return AddTsfToCurrentDir(createnamea("func"),"tsf");
if FInput.ShowModal()then
begin
AddTsfToCurrentDir(FInput.GetEditV(1),"tsf");
@@ -662,6 +669,7 @@ type TProjectView = class(TVCForm) //
function add_tsl();
begin
if not FCProjectPath then return Messageboxa("工程没打开","提示",0,self);
return AddTsfToCurrentDir(createnamea("tsl"),"tsl");
if FInput.ShowModal()then
begin
AddTsfToCurrentDir(FInput.GetEditV(1),"tsl");
@@ -729,6 +737,21 @@ type TProjectView = class(TVCForm) //
end
return FTslEditer.GetClassInfo();
end
function filetoform();
begin
it := FTslEditer.GetCurrentItem();
if not it then return ;
f := it.ScriptPath;
r := getnodebyfilename(f,FTree.RootNode) ;
if not r then return ;
if r=FTree.CurrentNode then
begin
OpenFileByName(r.Fname);
FDesigner.ExecuteCommand("shownode",nil);
end else
setnodesel(r);
end
function ShowEditor(); //显示函数编辑
begin
FTslEditer.Show(SW_SHOWNOACTIVATE); //
@@ -954,12 +977,14 @@ type TProjectView = class(TVCForm) //
FTree.ProjectNode.Expand();
FTree.PopUpMenu := FTreePopUpMenu;
fnewmenu.Enabled := true;
fgoformmenu.Enabled := true;
end else
begin
FTree.PopUpMenu := nil;
FOpenProjectFile := "";
messageboxa("打开工程文件错误:"+f,"提示",0,self);
fnewmenu.Enabled := false;
fgoformmenu.Enabled := false;
return;
end
FTslEditer.TslSearchDir := array(p,Getfuncextdir());
@@ -1514,9 +1539,28 @@ end
end
end
end
function Recycling();override;
begin
inherited;
FMoveMnus := nil;
FMoveMenu := nil;
FOpenMenu := nil;
fnewmenu := nil;
fgoformmenu := nil;
end
private
FMoveMnus;
FMoveMenu;
function getnodebyfilename(f,nd);//获得编辑器对应节点
begin
if not nd then return 0;
if (nd.gettsfname()=f) or (nd.gettmfname()=f) then return nd;
for i:=0 to nd.ItemCount-1 do
begin
r := getnodebyfilename(f,nd.GetNodeByIndex(i));
if r then return r;
end
end
function getdefaultdir();
begin
cnd := FTree.CurrentNode;
@@ -1775,8 +1819,10 @@ end
FAddMenuTsl;
FOpenMenu;
fnewmenu;
fgoformmenu;
public
property newmenu read fnewmenu;
property goformmenu read fgoformmenu;
FTslEditer;
property tree read ftree;
private
@@ -1856,7 +1902,7 @@ BD141CA912494F502D48D224F45050274A21E03806FF2C7CA7516022D7D000000
caption := "代码编辑器";
WsDlgModalFrame := true;
visible := false;
Left := 50;
Left := 300;
Top := 120;
Width := 1000;
height := 900;
-1
View File
@@ -1832,7 +1832,6 @@ type TEditer=class(TCustomcontrol) //
FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;");
FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;");
FSynClasses["None"]:= array(nil,nil,"");
//FSynClasses["tsf"] := FSynClasses["tsl"];
FTslChmHelp := new TTslChmHelp();
FCodeFormatInfo := array("wordct":80,"charct":200,"syn":true,"sel":false,"arraytype":0);
FPageEditer.OnDblClick := function(o,e)