优化编辑器,ctrol+j 弹出函数查找

This commit is contained in:
2025-01-22 15:39:37 +08:00
parent 1e37d94f22
commit b140a942df
14 changed files with 602 additions and 57 deletions
@@ -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
+126
View File
@@ -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
+51 -11
View File
@@ -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)\""
)