优化编辑器,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(
|
||||||
array("name":"vcldesginer","version":"1.1.2","dir":
|
"name":"vcldesginer",
|
||||||
(),"files":
|
"version":"1.1.2",
|
||||||
("textcompclassadder":
|
"dir":(
|
||||||
("name":"textcompclassadder","type":"form","dir":""),"textcompclassmgr":
|
),
|
||||||
("name":"textcompclassmgr","type":"form","dir":""),"tfm_inheritedwnd":
|
"files":(
|
||||||
("name":"tfm_inheritedwnd","type":"form","dir":""),"t_bconfig_cmd_shower":
|
"textcompclassadder":(
|
||||||
("name":"t_bconfig_cmd_shower","type":"form","dir":""),"t_compile_config":
|
"name":"textcompclassadder",
|
||||||
("name":"t_compile_config","type":"form","dir":""),"t_dir_list":
|
"type":"form",
|
||||||
("name":"t_dir_list","type":"form","dir":""),"t_m_list_editor":
|
"dir":""
|
||||||
("name":"t_m_list_editor","type":"form","dir":"")),"mainform":"textcompclassmgr")
|
),
|
||||||
|
"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
|
end
|
||||||
DeletePageItem(it);
|
DeletePageItem(it);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
FFindWnd := new TFindWnd(self); //²éÕÒ
|
FFindWnd := new TFindWnd(self); //²éÕÒ
|
||||||
FGotoLineWnd := new TGoToLineWnd(self); //¹²Í¬
|
FGotoLineWnd := new TGoToLineWnd(self); //¹²Í¬
|
||||||
FListPages := new TListPages(self); //tab Ìø×ªÒ³Ãæ
|
FListPages := new TListPages(self); //tab Ìø×ªÒ³Ãæ
|
||||||
|
|
@ -1994,7 +1995,7 @@ type TEditer=class(TCustomcontrol) //
|
||||||
begin
|
begin
|
||||||
CreateAFile();
|
CreateAFile();
|
||||||
end
|
end
|
||||||
|
ffuncfind := new t_function_finder(self);
|
||||||
end
|
end
|
||||||
function PopUpAuxiliary();
|
function PopUpAuxiliary();
|
||||||
begin
|
begin
|
||||||
|
|
@ -3591,6 +3592,12 @@ type TEditer=class(TCustomcontrol) //
|
||||||
ed.ExecuteCommand(ed.ecString,"\r\n"+s);
|
ed.ExecuteCommand(ed.ecString,"\r\n"+s);
|
||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
ord("J"):
|
||||||
|
begin
|
||||||
|
InitShowWndPos(ffuncfind,"ff",200,150);
|
||||||
|
ffuncfind.show_finder();
|
||||||
|
return true;
|
||||||
|
end
|
||||||
ord("R"):
|
ord("R"):
|
||||||
begin
|
begin
|
||||||
InitShowWndPos(FFindWnd,"fr",200,150);
|
InitShowWndPos(FFindWnd,"fr",200,150);
|
||||||
|
|
@ -4174,6 +4181,7 @@ type TEditer=class(TCustomcontrol) //
|
||||||
//bit.FEditer.SetFocus();
|
//bit.FEditer.SetFocus();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
public
|
||||||
function GetFreeSynObjectByName(n);
|
function GetFreeSynObjectByName(n);
|
||||||
begin
|
begin
|
||||||
if not ifstring(n)then return;
|
if not ifstring(n)then return;
|
||||||
|
|
@ -4254,6 +4262,7 @@ type TEditer=class(TCustomcontrol) //
|
||||||
FinCodemap;
|
FinCodemap;
|
||||||
FListPages;
|
FListPages;
|
||||||
FFindWnd;
|
FFindWnd;
|
||||||
|
ffuncfind;
|
||||||
FFindListWnd;
|
FFindListWnd;
|
||||||
FEchoWnd;
|
FEchoWnd;
|
||||||
FGotoLineWnd;
|
FGotoLineWnd;
|
||||||
|
|
@ -4912,13 +4921,28 @@ type TEditList=class(TComboBox)
|
||||||
end
|
end
|
||||||
function Pushitem(s);
|
function Pushitem(s);
|
||||||
begin
|
begin
|
||||||
if not ifstring(s)and s then return;
|
if not(ifstring(s) and s) then return;
|
||||||
if s in Items then return 0;
|
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);
|
insertItem(s,0);
|
||||||
if getItemCount()>FMaxCoder then
|
if (idx<0) and getItemCount()>FMaxCoder then
|
||||||
begin
|
begin
|
||||||
deleteItem(FMaxCoder);
|
deleteItem(FMaxCoder);
|
||||||
end
|
end
|
||||||
|
ItemIndex := 0;
|
||||||
end
|
end
|
||||||
property OnEnterUp read FOnEnterUp write FOnEnterUp;
|
property OnEnterUp read FOnEnterUp write FOnEnterUp;
|
||||||
property MaxCoder read FMaxCoder write FMaxCoder;
|
property MaxCoder read FMaxCoder write FMaxCoder;
|
||||||
|
|
|
||||||
|
|
@ -248,6 +248,10 @@ type TTSLCompletion= class(TSynCompletion)
|
||||||
inherited;
|
inherited;
|
||||||
GetTslParser();
|
GetTslParser();
|
||||||
end
|
end
|
||||||
|
function getallfunctions();
|
||||||
|
begin
|
||||||
|
return FTslParser.DispatchMethod(0,array("method":"allfunctions"));
|
||||||
|
end
|
||||||
function GetFileFullPath(f);//»ñµÃÈ«Ãû
|
function GetFileFullPath(f);//»ñµÃÈ«Ãû
|
||||||
begin
|
begin
|
||||||
return FTslParser.DispatchMethod(0,array("method":"getfullpath","value":f));
|
return FTslParser.DispatchMethod(0,array("method":"getfullpath","value":f));
|
||||||
|
|
@ -298,6 +302,10 @@ type TTSLCompletion= class(TSynCompletion)
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
|
function getjumpinfo();
|
||||||
|
begin
|
||||||
|
return FTslParser.DispatchMethod(0,array("method":"allfunctions"));
|
||||||
|
end
|
||||||
function PrepareCompletion(m);override;
|
function PrepareCompletion(m);override;
|
||||||
begin
|
begin
|
||||||
//½âÎö
|
//½âÎö
|
||||||
|
|
@ -1798,6 +1806,10 @@ type TTsfFileParser = class() //
|
||||||
begin
|
begin
|
||||||
return getprojecttsfs();
|
return getprojecttsfs();
|
||||||
end
|
end
|
||||||
|
"allfunctions":
|
||||||
|
begin
|
||||||
|
return getallfunctions();
|
||||||
|
end
|
||||||
"parserstring":
|
"parserstring":
|
||||||
begin
|
begin
|
||||||
r := parserstring(o,d);
|
r := parserstring(o,d);
|
||||||
|
|
@ -1919,6 +1931,22 @@ type TTsfFileParser = class() //
|
||||||
return rt;
|
return rt;
|
||||||
//return o.postmessage(r);
|
//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);
|
function checknamespacename(v);
|
||||||
begin
|
begin
|
||||||
for ii in FCacheS do
|
for ii in FCacheS do
|
||||||
|
|
@ -2182,7 +2210,7 @@ type TTsfFileParser = class() //
|
||||||
r := array();
|
r := array();
|
||||||
rdd :="";
|
rdd :="";
|
||||||
end
|
end
|
||||||
r["fullpath"] := pfn;
|
//r["fullpath"] := pfn;
|
||||||
r["name"] := fn;
|
r["name"] := fn;
|
||||||
if (aid := pos("@",fn)) then
|
if (aid := pos("@",fn)) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -2192,7 +2220,11 @@ type TTsfFileParser = class() //
|
||||||
r["name"] := nn;
|
r["name"] := nn;
|
||||||
FNsCaches[nn][nns] := 1;
|
FNsCaches[nn][nns] := 1;
|
||||||
//echo "\r\nfn:",fn[aid:];
|
//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);
|
r["msg"] := getmsgd_Crc32(rdd);//GetMsgdigest(rdd,0);
|
||||||
cls := array();
|
cls := array();
|
||||||
ScriptDelBlocks(r["blcks"],str2array(rdd,"\n"),cls);
|
ScriptDelBlocks(r["blcks"],str2array(rdd,"\n"),cls);
|
||||||
|
|
|
||||||
|
|
@ -346,15 +346,21 @@ type TDComponent = class()
|
||||||
ndp := nd.parent;
|
ndp := nd.parent;
|
||||||
if ndp then
|
if ndp then
|
||||||
begin
|
begin
|
||||||
if f then
|
|
||||||
|
if f=1 then
|
||||||
begin
|
begin
|
||||||
dm := MessageBoxA(cst_tip_willcut+nd.Caption,cst_m_delete,(0x1 .| 0x30),nd.owner);//
|
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 dm<>1 then exit;
|
||||||
if not nd.owner then exit;
|
if not nd.owner then exit;
|
||||||
d := nd.owner.Designer;
|
d := nd.owner.Designer;
|
||||||
if f then
|
if f then d.cutnode(nd);
|
||||||
d.cutnode(nd);
|
else d.delnode(nd);
|
||||||
wd := nd.Component.Cwnd;
|
wd := nd.Component.Cwnd;
|
||||||
ds := nd.owner.Designer;
|
ds := nd.owner.Designer;
|
||||||
ndp.deletenode(nd);
|
ndp.deletenode(nd);
|
||||||
|
|
@ -392,7 +398,7 @@ type TDComponent = class()
|
||||||
function deleteclick(o,e);virtual; //控件删除操作
|
function deleteclick(o,e);virtual; //控件删除操作
|
||||||
begin
|
begin
|
||||||
global g_script_can_set_not_focus := true;
|
global g_script_can_set_not_focus := true;
|
||||||
deleteorcut(o,0);
|
deleteorcut(o,(e=2)?2:0);
|
||||||
g_script_can_set_not_focus := false;
|
g_script_can_set_not_focus := false;
|
||||||
end
|
end
|
||||||
function GetDeleteNames(nd,ns,wds);
|
function GetDeleteNames(nd,ns,wds);
|
||||||
|
|
@ -1161,6 +1167,17 @@ type TComponentTree = class(TTreeView) //
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
end
|
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)
|
//ContextMenu(o,e)
|
||||||
property EventGrid read FEventGrid write FEventGrid; //事件控件
|
property EventGrid read FEventGrid write FEventGrid; //事件控件
|
||||||
property ProGrid read FProGrid write FProGrid; //属性控件
|
property ProGrid read FProGrid write FProGrid; //属性控件
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,14 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
FProjectManager.WrapTo();
|
FProjectManager.WrapTo();
|
||||||
end
|
end
|
||||||
|
function designerondo();
|
||||||
|
begin
|
||||||
|
if fdolist then fdolist.undo();
|
||||||
|
end
|
||||||
|
function designerredo();
|
||||||
|
begin
|
||||||
|
if fdolist then fdolist.redo();
|
||||||
|
end
|
||||||
function OpenProjectFromtpj(); //工程选择
|
function OpenProjectFromtpj(); //工程选择
|
||||||
begin
|
begin
|
||||||
SetWndPostWithMouse(FProjectsManager);
|
SetWndPostWithMouse(FProjectsManager);
|
||||||
|
|
@ -241,17 +249,36 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
fcutcopyinfo := getnodeinfodata(node);
|
fcutcopyinfo := getnodeinfodata(node);
|
||||||
end
|
end
|
||||||
function cutnode(node); //剪切节点
|
function set_prop(n,ps);
|
||||||
begin
|
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;
|
fcutcopyinfo[2] := true;
|
||||||
|
if fdolist then fdolist.add(nd.parent.Component.name,"cut",fcutcopyinfo);
|
||||||
end
|
end
|
||||||
function pasttonode(nd);//粘贴节点
|
function pasttonode(nd);//粘贴节点
|
||||||
begin
|
begin
|
||||||
if not fcutcopyinfo then return ;
|
if not fcutcopyinfo then return ;
|
||||||
ifc := fcutcopyinfo[2];
|
ifc := fcutcopyinfo[2];
|
||||||
r := pastinfotonode(nd,fcutcopyinfo,1,not(ifc));
|
r := pastinfotonode2(nd,fcutcopyinfo,1,not(ifc));
|
||||||
if ifc and not(r) then fcutcopyinfo := nil; //如果失败就不清除内容
|
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
|
end
|
||||||
function pastinfotonode(nd,data,fst,notcute); //粘贴节点
|
function pastinfotonode(nd,data,fst,notcute); //粘贴节点
|
||||||
begin
|
begin
|
||||||
|
|
@ -265,7 +292,7 @@ type TVclDesigner = class(tvcform)
|
||||||
pwnd := nd.Component.Cwnd;
|
pwnd := nd.Component.Cwnd;
|
||||||
nnd := tc.ComponentCreater(nd,pwnd);
|
nnd := tc.ComponentCreater(nd,pwnd);
|
||||||
if not nnd then return 1; //加入失败处理
|
if not nnd then return 1; //加入失败处理
|
||||||
nnd.CreateName();
|
nn := nnd.CreateName();
|
||||||
FVariableSelecter.additem(nnd);
|
FVariableSelecter.additem(nnd);
|
||||||
BindCwndMessage(nnd.Cwnd);
|
BindCwndMessage(nnd.Cwnd);
|
||||||
if fst and (pwnd is class(TWinControl)) then
|
if fst and (pwnd is class(TWinControl)) then
|
||||||
|
|
@ -294,6 +321,7 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
pastinfotonode(nnd.TreeNode,v);
|
pastinfotonode(nnd.TreeNode,v);
|
||||||
end
|
end
|
||||||
|
return nnd.name;
|
||||||
end
|
end
|
||||||
function getnodeinfodata(node); //复制节点信息
|
function getnodeinfodata(node); //复制节点信息
|
||||||
begin
|
begin
|
||||||
|
|
@ -303,11 +331,19 @@ type TVclDesigner = class(tvcform)
|
||||||
begin
|
begin
|
||||||
r[0] := tc.dclassname() ;
|
r[0] := tc.dclassname() ;
|
||||||
cr := tc.GetChangedPublish(2);
|
cr := tc.GetChangedPublish(2);
|
||||||
|
lzs := array();
|
||||||
for i,v in cr do
|
for i,v in cr do
|
||||||
begin
|
begin
|
||||||
if not(v and ifstring(i) ) then continue; //严格判断
|
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;
|
r[i] := v;
|
||||||
end
|
end
|
||||||
|
r["name"] := tc.name;
|
||||||
for i := 0 to node.ItemCount-1 do
|
for i := 0 to node.ItemCount-1 do
|
||||||
begin
|
begin
|
||||||
r[1,i] := getnodeinfodata((node.items)[i]);//
|
r[1,i] := getnodeinfodata((node.items)[i]);//
|
||||||
|
|
@ -316,12 +352,15 @@ type TVclDesigner = class(tvcform)
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
public //设计器工程
|
public //设计器工程
|
||||||
|
fdolist;
|
||||||
ffilemenu;
|
ffilemenu;
|
||||||
fviewmenu;
|
fviewmenu;
|
||||||
|
feditmenu;//编辑
|
||||||
|
fundomenu;
|
||||||
|
fredomenu;
|
||||||
function OpenFileFromTpjFile(f,e); //从文件打开工程
|
function OpenFileFromTpjFile(f,e); //从文件打开工程
|
||||||
begin
|
begin
|
||||||
FProjectFileOpener.caption := "打开";
|
FProjectFileOpener.caption := "打开";
|
||||||
|
|
||||||
if not(ifstring(f)) and FProjectFileOpener.OpenDlg() then
|
if not(ifstring(f)) and FProjectFileOpener.OpenDlg() then
|
||||||
begin
|
begin
|
||||||
f := FProjectFileOpener.FileName;
|
f := FProjectFileOpener.FileName;
|
||||||
|
|
@ -486,6 +525,11 @@ type TVclDesigner = class(tvcform)
|
||||||
("type":"menu","caption":"对象浏览","checked":true,"onclick":thisfunction(Mobjinspect),
|
("type":"menu","caption":"对象浏览","checked":true,"onclick":thisfunction(Mobjinspect),
|
||||||
"bitmap":getdefaultbmpinfo())
|
"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":"工程","items":(
|
||||||
("type":"menu","caption":"打开工程","onclick":thisfunction(OpenFileFromTpjFile),
|
("type":"menu","caption":"打开工程","onclick":thisfunction(OpenFileFromTpjFile),
|
||||||
"bitmap":GetOpenFileBitmapInfo()),
|
"bitmap":GetOpenFileBitmapInfo()),
|
||||||
|
|
@ -691,8 +735,9 @@ type TVclDesigner = class(tvcform)
|
||||||
**}
|
**}
|
||||||
if FComponentCreater and fselctlnode and FCurrentClikPos then
|
if FComponentCreater and fselctlnode and FCurrentClikPos then
|
||||||
begin
|
begin
|
||||||
par := fselctlnode.Component.Cwnd;
|
tsnode := fselctlnode;
|
||||||
r := FComponentCreater.ComponentCreater(fselctlnode,par);
|
par := tsnode.Component.Cwnd;
|
||||||
|
r := FComponentCreater.ComponentCreater(tsnode,par);
|
||||||
if not r then exit;
|
if not r then exit;
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
//npar := par;
|
//npar := par;
|
||||||
|
|
@ -704,7 +749,7 @@ type TVclDesigner = class(tvcform)
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
global g_script_can_set_not_focus;
|
global g_script_can_set_not_focus;
|
||||||
g_script_can_set_not_focus := true;
|
g_script_can_set_not_focus := true;
|
||||||
r.CreateName();
|
nn := r.CreateName();
|
||||||
FVariableSelecter.additem(r);
|
FVariableSelecter.additem(r);
|
||||||
BindCwndMessage(r.Cwnd);
|
BindCwndMessage(r.Cwnd);
|
||||||
if ifarray(FCurrentClikPos) and (r.Cwnd is class(TControl)) then
|
if ifarray(FCurrentClikPos) and (r.Cwnd is class(TControl)) then
|
||||||
|
|
@ -723,6 +768,7 @@ type TVclDesigner = class(tvcform)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if fdolist then fdolist.add(tsnode.Component.name,"create",nn);
|
||||||
FTree.SetSel(r.TreeNode);
|
FTree.SetSel(r.TreeNode);
|
||||||
end
|
end
|
||||||
FCurrentClikPos := nil;
|
FCurrentClikPos := nil;
|
||||||
|
|
@ -997,11 +1043,15 @@ type TVclDesigner = class(tvcform)
|
||||||
//wnd.bindmessage(wnd.WM_NCLBUTTONDOWN,thisfunction(ClickComponent));
|
//wnd.bindmessage(wnd.WM_NCLBUTTONDOWN,thisfunction(ClickComponent));
|
||||||
wnd.bindmessage(wnd.WM_ACTIVATE,thisfunction(windowactive));
|
wnd.bindmessage(wnd.WM_ACTIVATE,thisfunction(windowactive));
|
||||||
//WM_NCLBUTTONUP wnd.
|
//WM_NCLBUTTONUP wnd.
|
||||||
if (wnd is class(TVCForm)) then
|
if (wnd is class(tdcreateform)) then
|
||||||
begin
|
begin
|
||||||
wnd.OnMinimize := thisfunction(CompClose);
|
wnd.OnMinimize := thisfunction(CompClose);
|
||||||
wnd.onkeydown := thisfunction(toplevelwndkeydown);
|
wnd.onkeydown := thisfunction(toplevelwndkeydown);
|
||||||
end
|
end
|
||||||
|
if (wnd is class(TDCreatePanel)) then
|
||||||
|
begin
|
||||||
|
wnd.onkeydown := thisfunction(toplevelwndkeydown);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function get_mu_id(mus,id);
|
function get_mu_id(mus,id);
|
||||||
|
|
@ -1019,7 +1069,11 @@ type TVclDesigner = class(tvcform)
|
||||||
cd := e.CharCode;
|
cd := e.CharCode;
|
||||||
if cd = VK_ESCAPE then return select_parent();
|
if cd = VK_ESCAPE then return select_parent();
|
||||||
c := e.char;
|
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 not ((nd := fselctlnode) and (ndc := nd.Component) and (mus := ndc.menus())) then return ;
|
||||||
if cd = VK_DELETE then
|
if cd = VK_DELETE then
|
||||||
begin
|
begin
|
||||||
|
|
@ -1108,6 +1162,7 @@ type TVclDesigner = class(tvcform)
|
||||||
class(TDComponent).TemporaryNotName := nd.fnames;
|
class(TDComponent).TemporaryNotName := nd.fnames;
|
||||||
FPropGrid.Component := nd.fcomp ;
|
FPropGrid.Component := nd.fcomp ;
|
||||||
FEventGrid.Component := nd.fcomp ;
|
FEventGrid.Component := nd.fcomp ;
|
||||||
|
nd.fdolist.active();
|
||||||
end
|
end
|
||||||
function showcurrent();
|
function showcurrent();
|
||||||
begin
|
begin
|
||||||
|
|
@ -1289,6 +1344,7 @@ type TVclDesigner = class(tvcform)
|
||||||
if not d["type"]=p.TT_COMP then exit;
|
if not d["type"]=p.TT_COMP then exit;
|
||||||
dcls := d["class"];
|
dcls := d["class"];
|
||||||
it := class(TDComponent).GetClassItem(dcls);
|
it := class(TDComponent).GetClassItem(dcls);
|
||||||
|
setflg := 0;
|
||||||
if not it then
|
if not it then
|
||||||
begin
|
begin
|
||||||
if ("tdcreateform" in inhname) then
|
if ("tdcreateform" in inhname) then
|
||||||
|
|
@ -1298,12 +1354,22 @@ type TVclDesigner = class(tvcform)
|
||||||
if "tdcreatepanel" in inhname then
|
if "tdcreatepanel" in inhname then
|
||||||
begin
|
begin
|
||||||
it := new TDPanelForm();
|
it := new TDPanelForm();
|
||||||
|
setflg := true;
|
||||||
end else return ;
|
end else return ;
|
||||||
it.dclassname(d["class"]);
|
it.dclassname(d["class"]);
|
||||||
it.Imgs := fdimagelist.GetImageId("tdcreateform");
|
it.Imgs := fdimagelist.GetImageId("tdcreateform");
|
||||||
end
|
end
|
||||||
comp := it.ComponentCreater(node,wr);
|
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.isinherited := d["inherited"];
|
||||||
comp.inheritedparent := d["parent"];
|
comp.inheritedparent := d["parent"];
|
||||||
comp.name := d["name"];
|
comp.name := d["name"];
|
||||||
|
|
@ -1356,6 +1422,7 @@ type TVclDesigner = class(tvcform)
|
||||||
comp.SetComponentProperties(v[0],v[1],v[2]);
|
comp.SetComponentProperties(v[0],v[1],v[2]);
|
||||||
end
|
end
|
||||||
BindCwndMessage(comp.Cwnd);
|
BindCwndMessage(comp.Cwnd);
|
||||||
|
|
||||||
//comp.DoControlAlign();
|
//comp.DoControlAlign();
|
||||||
end
|
end
|
||||||
function SetFunctionList(v); //设置函数信息
|
function SetFunctionList(v); //设置函数信息
|
||||||
|
|
@ -1502,7 +1569,6 @@ type TVclDesigner = class(tvcform)
|
||||||
FProjectManager.newmenu.parent := ffilemenu;//
|
FProjectManager.newmenu.parent := ffilemenu;//
|
||||||
FProjectManager.goformmenu.parent := fviewmenu;//
|
FProjectManager.goformmenu.parent := fviewmenu;//
|
||||||
//fnewmenu
|
//fnewmenu
|
||||||
|
|
||||||
end
|
end
|
||||||
property VariableSelecter read FVariableSelecter; //当前控件树的变量对象
|
property VariableSelecter read FVariableSelecter; //当前控件树的变量对象
|
||||||
private //其他资源函数
|
private //其他资源函数
|
||||||
|
|
@ -1619,6 +1685,115 @@ end
|
||||||
|
|
||||||
|
|
||||||
implementation
|
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()
|
type tfileinfonode = class()
|
||||||
fnode; //文件节点
|
fnode; //文件节点
|
||||||
ftree; //窗口对应树
|
ftree; //窗口对应树
|
||||||
|
|
@ -1627,10 +1802,11 @@ type tfileinfonode = class()
|
||||||
fnames; //可用的变量名
|
fnames; //可用的变量名
|
||||||
fcomp; //选中的控件
|
fcomp; //选中的控件
|
||||||
fclk; //是否点击选择
|
fclk; //是否点击选择
|
||||||
|
fdolist;//
|
||||||
end
|
end
|
||||||
type tfilesinfo = class() //控件树存储对象
|
type tfilesinfo = class() //控件树存储对象
|
||||||
private
|
private
|
||||||
fdesginer;
|
[weakref]fdesginer;
|
||||||
[weakref]fcompclick;
|
[weakref]fcompclick;
|
||||||
fimg;
|
fimg;
|
||||||
fparent;
|
fparent;
|
||||||
|
|
@ -1684,12 +1860,13 @@ type tfilesinfo = class() //
|
||||||
tr.Align := tr.alClient;
|
tr.Align := tr.alClient;
|
||||||
tr.parent := fparent;
|
tr.parent := fparent;
|
||||||
tr.onselchanged := fcompclick;
|
tr.onselchanged := fcompclick;
|
||||||
nd := add(id,tr,array(),array());
|
lst := new tnodecmdlist(fdesginer,tr);
|
||||||
|
nd := add(id,tr,array(),array(),lst);
|
||||||
ifold := false;
|
ifold := false;
|
||||||
end
|
end
|
||||||
return nd;
|
return nd;
|
||||||
end
|
end
|
||||||
function add(nd,tr,fcs,vs);//添加一个
|
function add(nd,tr,fcs,vs,ls);//添加一个
|
||||||
begin
|
begin
|
||||||
for i,v in FData.data do
|
for i,v in FData.data do
|
||||||
begin
|
begin
|
||||||
|
|
@ -1701,6 +1878,7 @@ type tfilesinfo = class() //
|
||||||
nnd.ftree := tr;
|
nnd.ftree := tr;
|
||||||
nnd.ffuncs := fcs;
|
nnd.ffuncs := fcs;
|
||||||
nnd.fvars := vs;
|
nnd.fvars := vs;
|
||||||
|
nnd.fdolist := ls;
|
||||||
return nnd;
|
return nnd;
|
||||||
end
|
end
|
||||||
function deletedata(id); //删除
|
function deletedata(id); //删除
|
||||||
|
|
|
||||||
|
|
@ -680,6 +680,13 @@ type TPropGrid = class(TTSLDataGrid)
|
||||||
if not ifarray(od) then exit;
|
if not ifarray(od) then exit;
|
||||||
if od[index]<>d then
|
if od[index]<>d then
|
||||||
begin
|
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);
|
SetValue(indexs union array(index),d);
|
||||||
rec := GetSubItemRect(i,j);
|
rec := GetSubItemRect(i,j);
|
||||||
InvalidateRect(rec,true);
|
InvalidateRect(rec,true);
|
||||||
|
|
@ -4624,7 +4631,7 @@ type tcszinfo = class(tcustomcontrol)
|
||||||
if i = 0 then
|
if i = 0 then
|
||||||
begin
|
begin
|
||||||
btn := new TcustomComboBox(self);
|
btn := new TcustomComboBox(self);
|
||||||
btn.Items := array("none","LeftToRightThenTopToBottom");
|
btn.Items := array("none","LeftToRightThenTopToBottom","TopToBottomThenLeftToRight");
|
||||||
btn.ItemIndex := 0;
|
btn.ItemIndex := 0;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
|
@ -4670,7 +4677,8 @@ type tcszinfo = class(tcustomcontrol)
|
||||||
vi := r[v];
|
vi := r[v];
|
||||||
if i=0 then
|
if i=0 then
|
||||||
begin
|
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
|
end else
|
||||||
begin
|
begin
|
||||||
if vi>=0 then
|
if vi>=0 then
|
||||||
|
|
@ -4703,6 +4711,15 @@ type tancelok = class(tcustomcontrol)
|
||||||
fcancel.parent := self;
|
fcancel.parent := self;
|
||||||
autosize := true;
|
autosize := true;
|
||||||
end
|
end
|
||||||
|
function GetPreferredSize(w,h);override;
|
||||||
|
begin
|
||||||
|
ft := font;
|
||||||
|
if ft then
|
||||||
|
begin
|
||||||
|
w := ft.Width*18;
|
||||||
|
h := fok.Height;
|
||||||
|
end
|
||||||
|
end
|
||||||
function doControlALign();
|
function doControlALign();
|
||||||
begin
|
begin
|
||||||
r := ClientRect;
|
r := ClientRect;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -28,6 +28,7 @@ type t_children_sizer = class()
|
||||||
if flayout=0 then return ;
|
if flayout=0 then return ;
|
||||||
if fautosizing then return ;
|
if fautosizing then return ;
|
||||||
fautosizing := true;
|
fautosizing := true;
|
||||||
|
if not fowner then return ;
|
||||||
faownercls := fowner.ClientRect;
|
faownercls := fowner.ClientRect;
|
||||||
dolayoutctls(w,h);
|
dolayoutctls(w,h);
|
||||||
if fowner.autosize then
|
if fowner.autosize then
|
||||||
|
|
@ -62,7 +63,7 @@ type t_children_sizer = class()
|
||||||
case i of
|
case i of
|
||||||
"layout" :
|
"layout" :
|
||||||
begin
|
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
|
begin
|
||||||
flayout := vi;
|
flayout := vi;
|
||||||
if vi then flg := true;
|
if vi then flg := true;
|
||||||
|
|
@ -130,6 +131,7 @@ type t_children_sizer = class()
|
||||||
end
|
end
|
||||||
function dolayoutctls(w,h);
|
function dolayoutctls(w,h);
|
||||||
begin
|
begin
|
||||||
|
if not fowner then return ;
|
||||||
ctls := fowner.Controls;
|
ctls := fowner.Controls;
|
||||||
r := array();
|
r := array();
|
||||||
ridx := 0;
|
ridx := 0;
|
||||||
|
|
@ -141,6 +143,7 @@ type t_children_sizer = class()
|
||||||
if not ctl then continue;
|
if not ctl then continue;
|
||||||
if not ctl.Visible then continue;
|
if not ctl.Visible then continue;
|
||||||
if (ctl is getwndclass()) and ctl.WsPopUp then continue;
|
if (ctl is getwndclass()) and ctl.WsPopUp then continue;
|
||||||
|
|
||||||
if cidx>=fcontrolsperline then
|
if cidx>=fcontrolsperline then
|
||||||
begin
|
begin
|
||||||
ccount := fcontrolsperline;
|
ccount := fcontrolsperline;
|
||||||
|
|
@ -148,12 +151,17 @@ type t_children_sizer = class()
|
||||||
ridx++;
|
ridx++;
|
||||||
end
|
end
|
||||||
ctl.GetPreferredSize(wi,hi);
|
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++;
|
cidx++;
|
||||||
end
|
end
|
||||||
ccount := max(ccount,cidx);
|
ccount := mcols(r);
|
||||||
|
ridx := mrows(r);
|
||||||
|
//ccount := max(ccount,cidx);
|
||||||
wsz := zeros(ccount);
|
wsz := zeros(ccount);
|
||||||
hsz := zeros(ridx+1);
|
//hsz := zeros(ridx+1);
|
||||||
|
hsz := zeros(ridx);
|
||||||
for i := 0 to length(r)-1 do
|
for i := 0 to length(r)-1 do
|
||||||
begin
|
begin
|
||||||
for j := 0 to length(r[i])-1 do
|
for j := 0 to length(r[i])-1 do
|
||||||
|
|
@ -240,10 +248,10 @@ type t_children_sizer = class()
|
||||||
end
|
end
|
||||||
function setlayout(v);
|
function setlayout(v);
|
||||||
begin
|
begin
|
||||||
if v<>flayout and v in array(0,1) then
|
if v<>flayout and v in array(0,1,2) then
|
||||||
begin
|
begin
|
||||||
flayout := v;
|
flayout := v;
|
||||||
if v<>0 then
|
if v>0 then
|
||||||
begin
|
begin
|
||||||
dolayout();
|
dolayout();
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1014,7 +1014,7 @@ type tcontrol = class(tcomponent)
|
||||||
if (Align=alNone) then
|
if (Align=alNone) then
|
||||||
begin
|
begin
|
||||||
p := Parent ;
|
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();
|
AdjustSize();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -1027,7 +1027,7 @@ type tcontrol = class(tcomponent)
|
||||||
CallMessgeFunction(OnSize,o,e);
|
CallMessgeFunction(OnSize,o,e);
|
||||||
DoWMSIZE(o,e);
|
DoWMSIZE(o,e);
|
||||||
p := Parent ;
|
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();
|
AdjustSize();
|
||||||
end
|
end
|
||||||
function CMCursorChanged(o,e):CM_CURSORCHANGED;virtual;
|
function CMCursorChanged(o,e):CM_CURSORCHANGED;virtual;
|
||||||
|
|
|
||||||
|
|
@ -2598,7 +2598,7 @@ type TWinControl = class(tcontrol)
|
||||||
return ;
|
return ;
|
||||||
end
|
end
|
||||||
cs := childsizing;
|
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
|
if autosize then
|
||||||
begin
|
begin
|
||||||
a := Align ;
|
a := Align ;
|
||||||
|
|
@ -2683,7 +2683,7 @@ type TWinControl = class(tcontrol)
|
||||||
**}
|
**}
|
||||||
if not HandleAllocated()then exit;
|
if not HandleAllocated()then exit;
|
||||||
cs := childsizing;
|
cs := childsizing;
|
||||||
if cs and cs.layout=1 then return ;
|
if cs and cs.layout>0 then return ;
|
||||||
if not ifarray(rect)then
|
if not ifarray(rect)then
|
||||||
begin
|
begin
|
||||||
rect := ClientRect;
|
rect := ClientRect;
|
||||||
|
|
@ -2711,7 +2711,7 @@ type TWinControl = class(tcontrol)
|
||||||
**}
|
**}
|
||||||
if not HandleAllocated()then exit;
|
if not HandleAllocated()then exit;
|
||||||
cs := childsizing;
|
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);
|
e := new TMANCHOR(CN_ANCHOR,0,0,0);
|
||||||
c := ClientRect;
|
c := ClientRect;
|
||||||
for i := 0 to ControlCount-1 do
|
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