优化编辑器,ctrol+j 弹出函数查找
This commit is contained in:
parent
1e37d94f22
commit
b140a942df
|
|
@ -0,0 +1,103 @@
|
|||
object functionfinder:t_function_finder
|
||||
caption="函数查找"
|
||||
font=<
|
||||
height=19
|
||||
width=9
|
||||
escapement=0
|
||||
orientation=0
|
||||
weight=400
|
||||
italic=0
|
||||
underline=0
|
||||
strikeout=0
|
||||
charset=134
|
||||
outprecision=3
|
||||
clipprecision=2
|
||||
quality=1
|
||||
pitchandfamily=49
|
||||
facename="新宋体"
|
||||
color=0
|
||||
>
|
||||
|
||||
height=671
|
||||
left=604
|
||||
onclose=functionfinder_close
|
||||
parentfont=false
|
||||
top=306
|
||||
visible=false
|
||||
width=820
|
||||
object findpal:tpanel
|
||||
align=altop
|
||||
autosize=true
|
||||
caption="panel1"
|
||||
height=35
|
||||
left=0
|
||||
top=0
|
||||
width=804
|
||||
object edfind:tedit
|
||||
autosize=true
|
||||
caption="edit1"
|
||||
height=24
|
||||
left=8
|
||||
onkeydown=edfind_keydown
|
||||
placeholder="筛选"
|
||||
top=5
|
||||
width=259
|
||||
end
|
||||
object btfind:tbtn
|
||||
autosize=true
|
||||
caption="筛选"
|
||||
height=21
|
||||
left=281
|
||||
onclick=btfind_clk
|
||||
top=7
|
||||
width=38
|
||||
end
|
||||
object ck_prev:tcheckbtn
|
||||
autosize=true
|
||||
caption="从头匹配"
|
||||
height=21
|
||||
left=370
|
||||
top=7
|
||||
visible=true
|
||||
width=95
|
||||
end
|
||||
end
|
||||
object sbfind:tstatusbar
|
||||
caption="statusbar1"
|
||||
height=25
|
||||
items= [<
|
||||
width=1000
|
||||
text=" "
|
||||
>
|
||||
]
|
||||
left=0
|
||||
top=607
|
||||
width=804
|
||||
end
|
||||
object listfunc:tlistview
|
||||
align=alclient
|
||||
caption="listview1"
|
||||
columns= [<
|
||||
width=800
|
||||
text="函数"
|
||||
>
|
||||
]
|
||||
height=572
|
||||
left=0
|
||||
ondblclick=listfunc_ondblclick
|
||||
popupmenu=popupmenu1
|
||||
top=35
|
||||
width=804
|
||||
end
|
||||
object popupmenu1:tpopupmenu
|
||||
left=455
|
||||
top=22
|
||||
height=30
|
||||
width=30
|
||||
caption="popupmenu1"
|
||||
object mufind:tmenu
|
||||
caption="打开"
|
||||
onclick=mufind_clk
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
type t_function_finder=class(tdcreateform)
|
||||
uses tslvcl;
|
||||
findpal:tpanel;
|
||||
edfind:tedit;
|
||||
btfind:tbtn;
|
||||
listfunc:tlistview;
|
||||
popupmenu1:tpopupmenu;
|
||||
mufind:tmenu;
|
||||
sbfind:tstatusbar;
|
||||
ck_prev:tcheckbtn;
|
||||
function Create(AOwner);override; //构造
|
||||
begin
|
||||
fformatdata := array();
|
||||
inherited;
|
||||
ActiveControl := edfind;
|
||||
p := AOwner;
|
||||
parent := p;
|
||||
d := p.GetFreeSynObjectByName("tsl");
|
||||
if d then ffcomp := d[1];
|
||||
end
|
||||
function listfunc_ondblclick(o;e);
|
||||
begin
|
||||
openthefile();
|
||||
end
|
||||
function functionfinder_close(o;e);
|
||||
begin
|
||||
e.skip := true;
|
||||
o.Visible := false;
|
||||
end
|
||||
function mufind_clk(o;e); //打开文件夹
|
||||
begin
|
||||
openthefile();
|
||||
//echo dak
|
||||
end
|
||||
function openthefile();
|
||||
begin
|
||||
d := listfunc.SelectedValue;
|
||||
if not d then return ;
|
||||
f := ffcomp.GetFileFullPath(d[1]);
|
||||
Owner.OpenAndGotoFileByName(f,d[3]);
|
||||
end
|
||||
function show_finder();
|
||||
begin
|
||||
if Visible then return ;
|
||||
if ffcomp then setdata(ffcomp.getjumpinfo());
|
||||
show();
|
||||
end
|
||||
function btfind_clk(o;e);
|
||||
begin
|
||||
dofind();
|
||||
end
|
||||
function edfind_keydown(o;e);
|
||||
begin
|
||||
if e.charcode=13 then
|
||||
begin
|
||||
dofind();
|
||||
end
|
||||
end
|
||||
function dofind();
|
||||
begin
|
||||
s := lowercase(trim(edfind.text));
|
||||
if not s then return setlists(fformatdata);
|
||||
r := array();
|
||||
cp := ck_prev.Checked;
|
||||
for i,v in fformatdata do
|
||||
begin
|
||||
if cp then
|
||||
begin
|
||||
if 1=pos(s,v[2]) then r[idx++]:= v;
|
||||
end else
|
||||
begin
|
||||
if pos(s,v[2]) then r[idx++]:= v;
|
||||
end
|
||||
end
|
||||
setlists(r);
|
||||
end
|
||||
function setdata(d);
|
||||
begin
|
||||
if ifarray(d) and (ffuncdata<>d) then //设置数据
|
||||
begin
|
||||
ffuncdata := d;
|
||||
formatdata(d);
|
||||
setlists(fformatdata);
|
||||
end
|
||||
end
|
||||
function setlists(d);
|
||||
begin
|
||||
if fcurrentdata=d then return ;
|
||||
listfunc.DeleteAllItems();
|
||||
listfunc.AppendItems(d);
|
||||
fcurrentdata := d;
|
||||
listfunc.SelectedId := 0;
|
||||
sbfind.SetItemText(("总共:"$length(d)$" 处"),0);
|
||||
end
|
||||
function Recycling();override; //回收变量
|
||||
begin
|
||||
inherited;
|
||||
ci := self.classinfo(); //将成员变量赋值为nil避免循环引用
|
||||
for i,v in ci["members"] do
|
||||
begin
|
||||
if v["const"] then continue;
|
||||
if v["static"] then continue;
|
||||
invoke(self,v["name"],nil);
|
||||
end
|
||||
end
|
||||
private
|
||||
function formatdata(d);
|
||||
begin
|
||||
fformatdata := array();
|
||||
idx := 0;
|
||||
for i,v in d do
|
||||
begin
|
||||
if not ifarray(d) then continue;
|
||||
if not v["file"] then continue;
|
||||
fformatdata[idx,0] := v["caption"];
|
||||
fformatdata[idx,1] := v["file"];
|
||||
fformatdata[idx,2] := v["lvalue"];
|
||||
fformatdata[idx,3] := v["line"];
|
||||
idx++;
|
||||
end
|
||||
end
|
||||
[weakref]ffcomp;
|
||||
fformatdata;
|
||||
ffuncdata;
|
||||
fcurrentdata;
|
||||
end
|
||||
|
|
@ -1,11 +1,51 @@
|
|||
|
||||
array("name":"vcldesginer","version":"1.1.2","dir":
|
||||
(),"files":
|
||||
("textcompclassadder":
|
||||
("name":"textcompclassadder","type":"form","dir":""),"textcompclassmgr":
|
||||
("name":"textcompclassmgr","type":"form","dir":""),"tfm_inheritedwnd":
|
||||
("name":"tfm_inheritedwnd","type":"form","dir":""),"t_bconfig_cmd_shower":
|
||||
("name":"t_bconfig_cmd_shower","type":"form","dir":""),"t_compile_config":
|
||||
("name":"t_compile_config","type":"form","dir":""),"t_dir_list":
|
||||
("name":"t_dir_list","type":"form","dir":""),"t_m_list_editor":
|
||||
("name":"t_m_list_editor","type":"form","dir":"")),"mainform":"textcompclassmgr")
|
||||
array(
|
||||
"name":"vcldesginer",
|
||||
"version":"1.1.2",
|
||||
"dir":(
|
||||
),
|
||||
"files":(
|
||||
"textcompclassadder":(
|
||||
"name":"textcompclassadder",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"textcompclassmgr":(
|
||||
"name":"textcompclassmgr",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"tfm_inheritedwnd":(
|
||||
"name":"tfm_inheritedwnd",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"t_bconfig_cmd_shower":(
|
||||
"name":"t_bconfig_cmd_shower",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"t_compile_config":(
|
||||
"name":"t_compile_config",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"t_dir_list":(
|
||||
"name":"t_dir_list",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"t_m_list_editor":(
|
||||
"name":"t_m_list_editor",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
),
|
||||
"t_function_finder":(
|
||||
"name":"t_function_finder",
|
||||
"type":"form",
|
||||
"dir":""
|
||||
)
|
||||
),
|
||||
"mainform":"textcompclassmgr",
|
||||
"entryscript":"vcldesginer",
|
||||
"commandline":"\"$(TSL_EXE)\" \"$(FULL_CURRENT_PATH)\" -libpath \"$(SEARCH_PATH)\""
|
||||
)
|
||||
|
|
@ -1852,6 +1852,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
end
|
||||
DeletePageItem(it);
|
||||
end;
|
||||
|
||||
FFindWnd := new TFindWnd(self); //²éÕÒ
|
||||
FGotoLineWnd := new TGoToLineWnd(self); //¹²Í¬
|
||||
FListPages := new TListPages(self); //tab Ìø×ªÒ³Ãæ
|
||||
|
|
@ -1994,7 +1995,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
begin
|
||||
CreateAFile();
|
||||
end
|
||||
|
||||
ffuncfind := new t_function_finder(self);
|
||||
end
|
||||
function PopUpAuxiliary();
|
||||
begin
|
||||
|
|
@ -3591,6 +3592,12 @@ type TEditer=class(TCustomcontrol) //
|
|||
ed.ExecuteCommand(ed.ecString,"\r\n"+s);
|
||||
return;
|
||||
end
|
||||
ord("J"):
|
||||
begin
|
||||
InitShowWndPos(ffuncfind,"ff",200,150);
|
||||
ffuncfind.show_finder();
|
||||
return true;
|
||||
end
|
||||
ord("R"):
|
||||
begin
|
||||
InitShowWndPos(FFindWnd,"fr",200,150);
|
||||
|
|
@ -4174,6 +4181,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
//bit.FEditer.SetFocus();
|
||||
end
|
||||
end
|
||||
public
|
||||
function GetFreeSynObjectByName(n);
|
||||
begin
|
||||
if not ifstring(n)then return;
|
||||
|
|
@ -4254,6 +4262,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
FinCodemap;
|
||||
FListPages;
|
||||
FFindWnd;
|
||||
ffuncfind;
|
||||
FFindListWnd;
|
||||
FEchoWnd;
|
||||
FGotoLineWnd;
|
||||
|
|
@ -4912,13 +4921,28 @@ type TEditList=class(TComboBox)
|
|||
end
|
||||
function Pushitem(s);
|
||||
begin
|
||||
if not ifstring(s)and s then return;
|
||||
if s in Items then return 0;
|
||||
if not(ifstring(s) and s) then return;
|
||||
its := Items;
|
||||
idx := -1;
|
||||
for i,v in its do
|
||||
begin
|
||||
if v=s then
|
||||
begin
|
||||
idx := i;
|
||||
break;
|
||||
end
|
||||
end
|
||||
if idx=0 then return ;
|
||||
if idx>0 then
|
||||
begin
|
||||
DeleteItem(idx);
|
||||
end
|
||||
insertItem(s,0);
|
||||
if getItemCount()>FMaxCoder then
|
||||
if (idx<0) and getItemCount()>FMaxCoder then
|
||||
begin
|
||||
deleteItem(FMaxCoder);
|
||||
end
|
||||
ItemIndex := 0;
|
||||
end
|
||||
property OnEnterUp read FOnEnterUp write FOnEnterUp;
|
||||
property MaxCoder read FMaxCoder write FMaxCoder;
|
||||
|
|
|
|||
|
|
@ -248,6 +248,10 @@ type TTSLCompletion= class(TSynCompletion)
|
|||
inherited;
|
||||
GetTslParser();
|
||||
end
|
||||
function getallfunctions();
|
||||
begin
|
||||
return FTslParser.DispatchMethod(0,array("method":"allfunctions"));
|
||||
end
|
||||
function GetFileFullPath(f);//»ñµÃÈ«Ãû
|
||||
begin
|
||||
return FTslParser.DispatchMethod(0,array("method":"getfullpath","value":f));
|
||||
|
|
@ -298,6 +302,10 @@ type TTSLCompletion= class(TSynCompletion)
|
|||
end
|
||||
return r;
|
||||
end
|
||||
function getjumpinfo();
|
||||
begin
|
||||
return FTslParser.DispatchMethod(0,array("method":"allfunctions"));
|
||||
end
|
||||
function PrepareCompletion(m);override;
|
||||
begin
|
||||
//½âÎö
|
||||
|
|
@ -1798,6 +1806,10 @@ type TTsfFileParser = class() //
|
|||
begin
|
||||
return getprojecttsfs();
|
||||
end
|
||||
"allfunctions":
|
||||
begin
|
||||
return getallfunctions();
|
||||
end
|
||||
"parserstring":
|
||||
begin
|
||||
r := parserstring(o,d);
|
||||
|
|
@ -1918,7 +1930,23 @@ type TTsfFileParser = class() //
|
|||
//FormatFile(rti,FCacheS,rt,3,m);
|
||||
return rt;
|
||||
//return o.postmessage(r);
|
||||
end
|
||||
end
|
||||
function getallfunctions();
|
||||
begin
|
||||
filechanged();
|
||||
if not ifarray(FCacheS) then return array();
|
||||
rti :=0;
|
||||
rt := array();
|
||||
ext := array();
|
||||
for i,v in FCacheS do
|
||||
begin
|
||||
vfn := v["name"];
|
||||
FormatFunction(rti,v["functions"],rt,vfn,v["lines"],ext);
|
||||
FormatBlocks(rti,v["blcks"],rt,vfn,nil,ext);
|
||||
|
||||
end
|
||||
return rt;
|
||||
end
|
||||
function checknamespacename(v);
|
||||
begin
|
||||
for ii in FCacheS do
|
||||
|
|
@ -2182,7 +2210,7 @@ type TTsfFileParser = class() //
|
|||
r := array();
|
||||
rdd :="";
|
||||
end
|
||||
r["fullpath"] := pfn;
|
||||
//r["fullpath"] := pfn;
|
||||
r["name"] := fn;
|
||||
if (aid := pos("@",fn)) then
|
||||
begin
|
||||
|
|
@ -2192,7 +2220,11 @@ type TTsfFileParser = class() //
|
|||
r["name"] := nn;
|
||||
FNsCaches[nn][nns] := 1;
|
||||
//echo "\r\nfn:",fn[aid:];
|
||||
end else r["nspace"] := "";
|
||||
end else
|
||||
begin
|
||||
r["nspace"] := "";
|
||||
r["name"] := fn[1:length(fn)-4];
|
||||
end
|
||||
r["msg"] := getmsgd_Crc32(rdd);//GetMsgdigest(rdd,0);
|
||||
cls := array();
|
||||
ScriptDelBlocks(r["blcks"],str2array(rdd,"\n"),cls);
|
||||
|
|
|
|||
|
|
@ -346,15 +346,21 @@ type TDComponent = class()
|
|||
ndp := nd.parent;
|
||||
if ndp then
|
||||
begin
|
||||
if f then
|
||||
|
||||
if f=1 then
|
||||
begin
|
||||
dm := MessageBoxA(cst_tip_willcut+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
|
||||
end else dm := MessageBoxA(cst_tip_willdelete+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
|
||||
end else
|
||||
if f=2 then
|
||||
begin
|
||||
dm := 1;
|
||||
end
|
||||
else dm := MessageBoxA(cst_tip_willdelete+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
|
||||
if dm<>1 then exit;
|
||||
if not nd.owner then exit;
|
||||
d := nd.owner.Designer;
|
||||
if f then
|
||||
d.cutnode(nd);
|
||||
if f then d.cutnode(nd);
|
||||
else d.delnode(nd);
|
||||
wd := nd.Component.Cwnd;
|
||||
ds := nd.owner.Designer;
|
||||
ndp.deletenode(nd);
|
||||
|
|
@ -392,7 +398,7 @@ type TDComponent = class()
|
|||
function deleteclick(o,e);virtual; //控件删除操作
|
||||
begin
|
||||
global g_script_can_set_not_focus := true;
|
||||
deleteorcut(o,0);
|
||||
deleteorcut(o,(e=2)?2:0);
|
||||
g_script_can_set_not_focus := false;
|
||||
end
|
||||
function GetDeleteNames(nd,ns,wds);
|
||||
|
|
@ -1161,6 +1167,17 @@ type TComponentTree = class(TTreeView) //
|
|||
end
|
||||
return r;
|
||||
end
|
||||
function getndbyname(n,nd);
|
||||
begin
|
||||
if not nd then nd := GetRootNode();
|
||||
if n=nd.Component.name then return nd;
|
||||
for i := 0 to nd.ItemCount-1 do
|
||||
begin
|
||||
r := getndbyname(n,nd.GetNodeByIndex(i));
|
||||
if r then return r;
|
||||
end
|
||||
return nil;
|
||||
end
|
||||
//ContextMenu(o,e)
|
||||
property EventGrid read FEventGrid write FEventGrid; //事件控件
|
||||
property ProGrid read FProGrid write FProGrid; //属性控件
|
||||
|
|
|
|||
|
|
@ -46,6 +46,14 @@ type TVclDesigner = class(tvcform)
|
|||
begin
|
||||
FProjectManager.WrapTo();
|
||||
end
|
||||
function designerondo();
|
||||
begin
|
||||
if fdolist then fdolist.undo();
|
||||
end
|
||||
function designerredo();
|
||||
begin
|
||||
if fdolist then fdolist.redo();
|
||||
end
|
||||
function OpenProjectFromtpj(); //工程选择
|
||||
begin
|
||||
SetWndPostWithMouse(FProjectsManager);
|
||||
|
|
@ -241,18 +249,37 @@ type TVclDesigner = class(tvcform)
|
|||
begin
|
||||
fcutcopyinfo := getnodeinfodata(node);
|
||||
end
|
||||
function cutnode(node); //剪切节点
|
||||
function set_prop(n,ps);
|
||||
begin
|
||||
fcutcopyinfo := getnodeinfodata(node);
|
||||
if fdolist then fdolist.add(n,"prop",ps);
|
||||
end
|
||||
function delnode(nd);
|
||||
begin
|
||||
d := getnodeinfodata(nd);
|
||||
if fdolist then fdolist.add(nd.parent.Component.name,"del",d);
|
||||
end
|
||||
function cutnode(nd); //剪切节点
|
||||
begin
|
||||
fcutcopyinfo := getnodeinfodata(nd);
|
||||
fcutcopyinfo[2] := true;
|
||||
if fdolist then fdolist.add(nd.parent.Component.name,"cut",fcutcopyinfo);
|
||||
end
|
||||
function pasttonode(nd);//粘贴节点
|
||||
begin
|
||||
if not fcutcopyinfo then return ;
|
||||
ifc := fcutcopyinfo[2];
|
||||
r := pastinfotonode(nd,fcutcopyinfo,1,not(ifc));
|
||||
if ifc and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容
|
||||
end
|
||||
r := pastinfotonode2(nd,fcutcopyinfo,1,not(ifc));
|
||||
if ifc and not(r<>1) then
|
||||
begin
|
||||
fcutcopyinfo := nil; //如果失败就不清除内容
|
||||
end
|
||||
end
|
||||
function pastinfotonode2(nd,data,fst,notcute);
|
||||
begin
|
||||
r := pastinfotonode(nd,data,fst,notcute);
|
||||
if ifstring(r) then fdolist.add(nd.Component.name,"paste",r);
|
||||
return r;
|
||||
end
|
||||
function pastinfotonode(nd,data,fst,notcute); //粘贴节点
|
||||
begin
|
||||
tc := data[0];
|
||||
|
|
@ -265,7 +292,7 @@ type TVclDesigner = class(tvcform)
|
|||
pwnd := nd.Component.Cwnd;
|
||||
nnd := tc.ComponentCreater(nd,pwnd);
|
||||
if not nnd then return 1; //加入失败处理
|
||||
nnd.CreateName();
|
||||
nn := nnd.CreateName();
|
||||
FVariableSelecter.additem(nnd);
|
||||
BindCwndMessage(nnd.Cwnd);
|
||||
if fst and (pwnd is class(TWinControl)) then
|
||||
|
|
@ -294,6 +321,7 @@ type TVclDesigner = class(tvcform)
|
|||
begin
|
||||
pastinfotonode(nnd.TreeNode,v);
|
||||
end
|
||||
return nnd.name;
|
||||
end
|
||||
function getnodeinfodata(node); //复制节点信息
|
||||
begin
|
||||
|
|
@ -303,11 +331,19 @@ type TVclDesigner = class(tvcform)
|
|||
begin
|
||||
r[0] := tc.dclassname() ;
|
||||
cr := tc.GetChangedPublish(2);
|
||||
lzs := array();
|
||||
for i,v in cr do
|
||||
begin
|
||||
if not(v and 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]);//
|
||||
|
|
@ -316,12 +352,15 @@ type TVclDesigner = class(tvcform)
|
|||
return r;
|
||||
end
|
||||
public //设计器工程
|
||||
fdolist;
|
||||
ffilemenu;
|
||||
fviewmenu;
|
||||
feditmenu;//编辑
|
||||
fundomenu;
|
||||
fredomenu;
|
||||
function OpenFileFromTpjFile(f,e); //从文件打开工程
|
||||
begin
|
||||
FProjectFileOpener.caption := "打开";
|
||||
|
||||
if not(ifstring(f)) and FProjectFileOpener.OpenDlg() then
|
||||
begin
|
||||
f := FProjectFileOpener.FileName;
|
||||
|
|
@ -486,6 +525,11 @@ type TVclDesigner = class(tvcform)
|
|||
("type":"menu","caption":"对象浏览","checked":true,"onclick":thisfunction(Mobjinspect),
|
||||
"bitmap":getdefaultbmpinfo())
|
||||
)),
|
||||
("type":"menu","caption":"编辑","filed":"feditmenu","items":(
|
||||
("type":"menu","caption":"撤销","enabled":0,"filed":"fundomenu","onclick":thisfunction(designerondo)),
|
||||
("type":"menu","caption":"反撤销","enabled":0,"filed":"fredomenu","onclick":thisfunction(designerredo),
|
||||
"bitmap":getdefaultbmpinfo())
|
||||
)),
|
||||
("type":"menu","caption":"工程","items":(
|
||||
("type":"menu","caption":"打开工程","onclick":thisfunction(OpenFileFromTpjFile),
|
||||
"bitmap":GetOpenFileBitmapInfo()),
|
||||
|
|
@ -691,8 +735,9 @@ type TVclDesigner = class(tvcform)
|
|||
**}
|
||||
if FComponentCreater and fselctlnode and FCurrentClikPos then
|
||||
begin
|
||||
par := fselctlnode.Component.Cwnd;
|
||||
r := FComponentCreater.ComponentCreater(fselctlnode,par);
|
||||
tsnode := fselctlnode;
|
||||
par := tsnode.Component.Cwnd;
|
||||
r := FComponentCreater.ComponentCreater(tsnode,par);
|
||||
if not r then exit;
|
||||
//////////////////////////////////////////
|
||||
//npar := par;
|
||||
|
|
@ -704,7 +749,7 @@ type TVclDesigner = class(tvcform)
|
|||
////////////////////////////////////////////////
|
||||
global g_script_can_set_not_focus;
|
||||
g_script_can_set_not_focus := true;
|
||||
r.CreateName();
|
||||
nn := r.CreateName();
|
||||
FVariableSelecter.additem(r);
|
||||
BindCwndMessage(r.Cwnd);
|
||||
if ifarray(FCurrentClikPos) and (r.Cwnd is class(TControl)) then
|
||||
|
|
@ -723,7 +768,8 @@ type TVclDesigner = class(tvcform)
|
|||
end
|
||||
end
|
||||
end
|
||||
FTree.SetSel(r.TreeNode);
|
||||
if fdolist then fdolist.add(tsnode.Component.name,"create",nn);
|
||||
FTree.SetSel(r.TreeNode);
|
||||
end
|
||||
FCurrentClikPos := nil;
|
||||
FComponentCreater := nil;
|
||||
|
|
@ -997,11 +1043,15 @@ type TVclDesigner = class(tvcform)
|
|||
//wnd.bindmessage(wnd.WM_NCLBUTTONDOWN,thisfunction(ClickComponent));
|
||||
wnd.bindmessage(wnd.WM_ACTIVATE,thisfunction(windowactive));
|
||||
//WM_NCLBUTTONUP wnd.
|
||||
if (wnd is class(TVCForm)) then
|
||||
begin
|
||||
if (wnd is class(tdcreateform)) then
|
||||
begin
|
||||
wnd.OnMinimize := thisfunction(CompClose);
|
||||
wnd.onkeydown := thisfunction(toplevelwndkeydown);
|
||||
end
|
||||
if (wnd is class(TDCreatePanel)) then
|
||||
begin
|
||||
wnd.onkeydown := thisfunction(toplevelwndkeydown);
|
||||
end
|
||||
end
|
||||
end
|
||||
function get_mu_id(mus,id);
|
||||
|
|
@ -1019,7 +1069,11 @@ type TVclDesigner = class(tvcform)
|
|||
cd := e.CharCode;
|
||||
if cd = VK_ESCAPE then return select_parent();
|
||||
c := e.char;
|
||||
if not((c in array("X","V","C")) or cd=VK_DELETE) then return ;
|
||||
if not((c in array("X","V","C","Z")) or cd=VK_DELETE) then return ;
|
||||
if c="Z" and (ssCtrl in e.shiftstate()) then
|
||||
begin
|
||||
if fundomenu.Enabled then designerondo();
|
||||
end
|
||||
if not ((nd := fselctlnode) and (ndc := nd.Component) and (mus := ndc.menus())) then return ;
|
||||
if cd = VK_DELETE then
|
||||
begin
|
||||
|
|
@ -1108,6 +1162,7 @@ type TVclDesigner = class(tvcform)
|
|||
class(TDComponent).TemporaryNotName := nd.fnames;
|
||||
FPropGrid.Component := nd.fcomp ;
|
||||
FEventGrid.Component := nd.fcomp ;
|
||||
nd.fdolist.active();
|
||||
end
|
||||
function showcurrent();
|
||||
begin
|
||||
|
|
@ -1289,6 +1344,7 @@ type TVclDesigner = class(tvcform)
|
|||
if not d["type"]=p.TT_COMP then exit;
|
||||
dcls := d["class"];
|
||||
it := class(TDComponent).GetClassItem(dcls);
|
||||
setflg := 0;
|
||||
if not it then
|
||||
begin
|
||||
if ("tdcreateform" in inhname) then
|
||||
|
|
@ -1298,12 +1354,22 @@ type TVclDesigner = class(tvcform)
|
|||
if "tdcreatepanel" in inhname then
|
||||
begin
|
||||
it := new TDPanelForm();
|
||||
setflg := true;
|
||||
end else return ;
|
||||
it.dclassname(d["class"]);
|
||||
it.Imgs := fdimagelist.GetImageId("tdcreateform");
|
||||
end
|
||||
comp := it.ComponentCreater(node,wr);
|
||||
if first then comp.Cwnd.Handle;
|
||||
if first then
|
||||
begin
|
||||
{$ifdef linux}
|
||||
if setflg then
|
||||
begin
|
||||
comp.Cwnd.parent := self;
|
||||
end
|
||||
{$endif}
|
||||
comp.Cwnd.Handle;
|
||||
end
|
||||
comp.isinherited := d["inherited"];
|
||||
comp.inheritedparent := d["parent"];
|
||||
comp.name := d["name"];
|
||||
|
|
@ -1356,6 +1422,7 @@ type TVclDesigner = class(tvcform)
|
|||
comp.SetComponentProperties(v[0],v[1],v[2]);
|
||||
end
|
||||
BindCwndMessage(comp.Cwnd);
|
||||
|
||||
//comp.DoControlAlign();
|
||||
end
|
||||
function SetFunctionList(v); //设置函数信息
|
||||
|
|
@ -1502,7 +1569,6 @@ type TVclDesigner = class(tvcform)
|
|||
FProjectManager.newmenu.parent := ffilemenu;//
|
||||
FProjectManager.goformmenu.parent := fviewmenu;//
|
||||
//fnewmenu
|
||||
|
||||
end
|
||||
property VariableSelecter read FVariableSelecter; //当前控件树的变量对象
|
||||
private //其他资源函数
|
||||
|
|
@ -1619,6 +1685,115 @@ end
|
|||
|
||||
|
||||
implementation
|
||||
type tnodecmditem = class()
|
||||
function create(p,c,cp);
|
||||
begin
|
||||
pname := p;
|
||||
cmd := c;
|
||||
cmdparam := cp;
|
||||
end
|
||||
pname; //父节点
|
||||
cmd; //操作类型
|
||||
cmdparam;//操作参数
|
||||
end
|
||||
type tnodecmdlist = class()
|
||||
function create(d,tr);
|
||||
begin
|
||||
ftree := tr;
|
||||
fdesigner := d;
|
||||
fundoaction := d.fundomenu;
|
||||
fredoaction := d.fredomenu;
|
||||
fdoundolist := new tnumindexarray();
|
||||
fredolist := new tnumindexarray();
|
||||
fsate := 0;
|
||||
end
|
||||
function add(p,c,cp);
|
||||
begin
|
||||
it := new tnodecmditem(p,c,cp);
|
||||
if fsate=1 then
|
||||
begin
|
||||
fredolist.Push(it);
|
||||
//echo "\r\nadd redo";
|
||||
if fredoaction then fredoaction.Enabled := true;
|
||||
end else
|
||||
begin
|
||||
fdoundolist.Push(it);
|
||||
//echo "\r\nadd undo";
|
||||
if fundoaction then fundoaction.Enabled := true;
|
||||
end
|
||||
end
|
||||
function active();
|
||||
begin
|
||||
if fredoaction then fredoaction.Enabled := fredolist.length()>0;
|
||||
if fundoaction then fundoaction.Enabled := fdoundolist.length()>0;
|
||||
if fdesigner then fdesigner.fdolist := self;
|
||||
end
|
||||
function undo();//撤销
|
||||
begin
|
||||
it := fdoundolist.pop();
|
||||
if fundoaction and fdoundolist.length()<1 then fundoaction.Enabled := false;
|
||||
if not it then return ;
|
||||
fsate := 1;
|
||||
///////////////////////////撤销处理
|
||||
//echo "\r\n 处理撤销",it.pname," ",it.cmd," ",tostn(it.cmdparam);
|
||||
doitem(it);
|
||||
fsate := 0;
|
||||
end
|
||||
function redo();//反撤销
|
||||
begin
|
||||
it := fredolist.pop();
|
||||
if fredoaction and fredolist.length()<1 then fredoaction.Enabled := false;
|
||||
if not it then return ;
|
||||
fsate := 2;
|
||||
//echo "\r\n 反撤销",it.pname," ",it.cmd," ",tostn(it.cmdparam);
|
||||
doitem(it);
|
||||
fsate := 0;
|
||||
end
|
||||
function doitem(it);
|
||||
begin
|
||||
if not ftree then return ;
|
||||
pnd := ftree.getndbyname(it.pname);
|
||||
if not pnd then return ;
|
||||
case it.cmd of
|
||||
"prop":
|
||||
begin
|
||||
ndc := pnd.Component;
|
||||
if ndc then
|
||||
begin
|
||||
pms := it.cmdparam;
|
||||
ndc.SetComponentProperties(pms[0],pms[1]);
|
||||
add(it.pname,"prop",array(pms[0],pms[2],pms[1]));
|
||||
end
|
||||
end
|
||||
"del","cut":
|
||||
begin
|
||||
if fdesigner then fdesigner.pastinfotonode2(pnd,it.cmdparam,true,false);
|
||||
end
|
||||
"paste","create":
|
||||
begin
|
||||
nd := ftree.getndbyname(it.cmdparam);
|
||||
if nd then ndc := nd.Component;
|
||||
if ndc then ndc.deleteclick(nd,2);
|
||||
end
|
||||
end
|
||||
end
|
||||
function destroy()
|
||||
begin
|
||||
if fundoaction then fundoaction.Enabled := false;
|
||||
if fredoaction then fredoaction.Enabled := false;
|
||||
end
|
||||
//property undoaction read fundoaction write fundoaction;
|
||||
//property redoaction read fredoaction write fredoaction;
|
||||
private
|
||||
fdoundolist;
|
||||
fredolist;
|
||||
fsate;
|
||||
[weakref]fundoaction;
|
||||
[weakref]fredoaction;
|
||||
[weakref]fdesigner;
|
||||
[weakref]ftree;
|
||||
|
||||
end
|
||||
type tfileinfonode = class()
|
||||
fnode; //文件节点
|
||||
ftree; //窗口对应树
|
||||
|
|
@ -1627,10 +1802,11 @@ type tfileinfonode = class()
|
|||
fnames; //可用的变量名
|
||||
fcomp; //选中的控件
|
||||
fclk; //是否点击选择
|
||||
fdolist;//
|
||||
end
|
||||
type tfilesinfo = class() //控件树存储对象
|
||||
private
|
||||
fdesginer;
|
||||
[weakref]fdesginer;
|
||||
[weakref]fcompclick;
|
||||
fimg;
|
||||
fparent;
|
||||
|
|
@ -1684,12 +1860,13 @@ type tfilesinfo = class() //
|
|||
tr.Align := tr.alClient;
|
||||
tr.parent := fparent;
|
||||
tr.onselchanged := fcompclick;
|
||||
nd := add(id,tr,array(),array());
|
||||
lst := new tnodecmdlist(fdesginer,tr);
|
||||
nd := add(id,tr,array(),array(),lst);
|
||||
ifold := false;
|
||||
end
|
||||
return nd;
|
||||
end
|
||||
function add(nd,tr,fcs,vs);//添加一个
|
||||
function add(nd,tr,fcs,vs,ls);//添加一个
|
||||
begin
|
||||
for i,v in FData.data do
|
||||
begin
|
||||
|
|
@ -1701,6 +1878,7 @@ type tfilesinfo = class() //
|
|||
nnd.ftree := tr;
|
||||
nnd.ffuncs := fcs;
|
||||
nnd.fvars := vs;
|
||||
nnd.fdolist := ls;
|
||||
return nnd;
|
||||
end
|
||||
function deletedata(id); //删除
|
||||
|
|
|
|||
|
|
@ -680,6 +680,13 @@ type TPropGrid = class(TTSLDataGrid)
|
|||
if not ifarray(od) then exit;
|
||||
if od[index]<>d then
|
||||
begin
|
||||
pv := indexs[0];
|
||||
if FComponent and not(pv in array("width","height","left","top","name")) then
|
||||
begin
|
||||
ds := Designer;
|
||||
if ds then ds.set_prop(FComponent.name,array(pv,od[index],d));
|
||||
//echo "\r\n",FComponent.name," ",pv,"===",tostn(od[index])," ",tostn(d);
|
||||
end
|
||||
SetValue(indexs union array(index),d);
|
||||
rec := GetSubItemRect(i,j);
|
||||
InvalidateRect(rec,true);
|
||||
|
|
@ -719,7 +726,7 @@ type TPropGrid = class(TTSLDataGrid)
|
|||
end
|
||||
end }
|
||||
if FComponent.SetComponentProperties(n,d) then
|
||||
begin
|
||||
begin
|
||||
//echo "\r\ntrue";
|
||||
inherited;
|
||||
end
|
||||
|
|
@ -4624,7 +4631,7 @@ type tcszinfo = class(tcustomcontrol)
|
|||
if i = 0 then
|
||||
begin
|
||||
btn := new TcustomComboBox(self);
|
||||
btn.Items := array("none","LeftToRightThenTopToBottom");
|
||||
btn.Items := array("none","LeftToRightThenTopToBottom","TopToBottomThenLeftToRight");
|
||||
btn.ItemIndex := 0;
|
||||
end else
|
||||
begin
|
||||
|
|
@ -4670,7 +4677,8 @@ type tcszinfo = class(tcustomcontrol)
|
|||
vi := r[v];
|
||||
if i=0 then
|
||||
begin
|
||||
if vi in array(0,1) then fctls[1].ItemIndex := vi;
|
||||
if vi in array(0,1,2) then fctls[1].ItemIndex := vi;
|
||||
else fctls[1].ItemIndex := 0;
|
||||
end else
|
||||
begin
|
||||
if vi>=0 then
|
||||
|
|
@ -4703,6 +4711,15 @@ type tancelok = class(tcustomcontrol)
|
|||
fcancel.parent := self;
|
||||
autosize := true;
|
||||
end
|
||||
function GetPreferredSize(w,h);override;
|
||||
begin
|
||||
ft := font;
|
||||
if ft then
|
||||
begin
|
||||
w := ft.Width*18;
|
||||
h := fok.Height;
|
||||
end
|
||||
end
|
||||
function doControlALign();
|
||||
begin
|
||||
r := ClientRect;
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -28,6 +28,7 @@ type t_children_sizer = class()
|
|||
if flayout=0 then return ;
|
||||
if fautosizing then return ;
|
||||
fautosizing := true;
|
||||
if not fowner then return ;
|
||||
faownercls := fowner.ClientRect;
|
||||
dolayoutctls(w,h);
|
||||
if fowner.autosize then
|
||||
|
|
@ -62,7 +63,7 @@ type t_children_sizer = class()
|
|||
case i of
|
||||
"layout" :
|
||||
begin
|
||||
if vi<>flayout and(vi=0 or vi=1) then
|
||||
if vi<>flayout and(vi=0 or vi=1 or vi=2) then
|
||||
begin
|
||||
flayout := vi;
|
||||
if vi then flg := true;
|
||||
|
|
@ -130,6 +131,7 @@ type t_children_sizer = class()
|
|||
end
|
||||
function dolayoutctls(w,h);
|
||||
begin
|
||||
if not fowner then return ;
|
||||
ctls := fowner.Controls;
|
||||
r := array();
|
||||
ridx := 0;
|
||||
|
|
@ -141,6 +143,7 @@ type t_children_sizer = class()
|
|||
if not ctl then continue;
|
||||
if not ctl.Visible then continue;
|
||||
if (ctl is getwndclass()) and ctl.WsPopUp then continue;
|
||||
|
||||
if cidx>=fcontrolsperline then
|
||||
begin
|
||||
ccount := fcontrolsperline;
|
||||
|
|
@ -148,12 +151,17 @@ type t_children_sizer = class()
|
|||
ridx++;
|
||||
end
|
||||
ctl.GetPreferredSize(wi,hi);
|
||||
r[ridx,cidx] := array(ctl,0,0,wi,hi);
|
||||
if flayout=1 then
|
||||
r[ridx,cidx] := array(ctl,0,0,wi,hi);
|
||||
else r[cidx,ridx] := array(ctl,0,0,wi,hi);
|
||||
cidx++;
|
||||
end
|
||||
ccount := max(ccount,cidx);
|
||||
end
|
||||
ccount := mcols(r);
|
||||
ridx := mrows(r);
|
||||
//ccount := max(ccount,cidx);
|
||||
wsz := zeros(ccount);
|
||||
hsz := zeros(ridx+1);
|
||||
//hsz := zeros(ridx+1);
|
||||
hsz := zeros(ridx);
|
||||
for i := 0 to length(r)-1 do
|
||||
begin
|
||||
for j := 0 to length(r[i])-1 do
|
||||
|
|
@ -240,10 +248,10 @@ type t_children_sizer = class()
|
|||
end
|
||||
function setlayout(v);
|
||||
begin
|
||||
if v<>flayout and v in array(0,1) then
|
||||
if v<>flayout and v in array(0,1,2) then
|
||||
begin
|
||||
flayout := v;
|
||||
if v<>0 then
|
||||
if v>0 then
|
||||
begin
|
||||
dolayout();
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1014,7 +1014,7 @@ type tcontrol = class(tcomponent)
|
|||
if (Align=alNone) then
|
||||
begin
|
||||
p := Parent ;
|
||||
if p and p.childsizing.layout=1 then return p.AdjustSize();
|
||||
if p and p.childsizing.layout>0 then return p.AdjustSize();
|
||||
AdjustSize();
|
||||
end
|
||||
end
|
||||
|
|
@ -1027,7 +1027,7 @@ type tcontrol = class(tcomponent)
|
|||
CallMessgeFunction(OnSize,o,e);
|
||||
DoWMSIZE(o,e);
|
||||
p := Parent ;
|
||||
if p and p.childsizing.layout=1 then return p.AdjustSize();
|
||||
if p and p.childsizing.layout>0 then return p.AdjustSize();
|
||||
AdjustSize();
|
||||
end
|
||||
function CMCursorChanged(o,e):CM_CURSORCHANGED;virtual;
|
||||
|
|
|
|||
|
|
@ -2598,7 +2598,7 @@ type TWinControl = class(tcontrol)
|
|||
return ;
|
||||
end
|
||||
cs := childsizing;
|
||||
if cs and cs.layout=1 then return cs.AdjustSize();
|
||||
if cs and cs.layout>0 then return cs.AdjustSize();
|
||||
if autosize then
|
||||
begin
|
||||
a := Align ;
|
||||
|
|
@ -2683,7 +2683,7 @@ type TWinControl = class(tcontrol)
|
|||
**}
|
||||
if not HandleAllocated()then exit;
|
||||
cs := childsizing;
|
||||
if cs and cs.layout=1 then return ;
|
||||
if cs and cs.layout>0 then return ;
|
||||
if not ifarray(rect)then
|
||||
begin
|
||||
rect := ClientRect;
|
||||
|
|
@ -2711,7 +2711,7 @@ type TWinControl = class(tcontrol)
|
|||
**}
|
||||
if not HandleAllocated()then exit;
|
||||
cs := childsizing;
|
||||
if cs and cs.layout=1 then return ;
|
||||
if cs and cs.layout>0 then return ;
|
||||
e := new TMANCHOR(CN_ANCHOR,0,0,0);
|
||||
c := ClientRect;
|
||||
for i := 0 to ControlCount-1 do
|
||||
|
|
|
|||
BIN
tsleditor.exe
BIN
tsleditor.exe
Binary file not shown.
BIN
tslvcltool.exe
BIN
tslvcltool.exe
Binary file not shown.
Loading…
Reference in New Issue