From 4f4029a83564c752b8e54fc3032f32a4457b7a5b Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Tue, 28 Mar 2023 16:37:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化代码树快捷键,添加动态库函数句柄获取方法 --- designer/utslcodeeditor.tsf | 19 +++++++++++++++++-- funcext/tvclib/getdlsymaddress.tsf | 12 ++++++++++++ funcext/tvclib/utslvclcef.tsf | 10 ++++++++-- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 funcext/tvclib/getdlsymaddress.tsf diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 0809347..8b6af93 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -3372,7 +3372,7 @@ type TEditer=class(TCustomcontrol) // begin //InitShowWndPos(FCodeMap,"cm",250,100); //FCodeMap.ShowMap(); - if FinCodemap and not(FinCodemap.Visible) then + if FinCodemap then begin FinCodemap.doshow(1); end @@ -4896,6 +4896,17 @@ type tfincodemap = class(tcustomcontrol) FTree := new TTreeView(self); FTree.OnSelChanged := thisfunction(SynNodeSelected); FTree.Parent := self; + FTree.onsyskeydown := function(o,e)begin + if e.char="M" then doshow(false); + end + ftree.OnKeyDown := function(o,e)begin + if e.charcode=13 then + begin + et := geteditor(); + echo ">>>enter\r\n"; + if et then et.SetFocus(); + end + end end function caretchanged(y); begin @@ -4935,7 +4946,11 @@ type tfincodemap = class(tcustomcontrol) if st then begin ontimerdo(); - //FTree.SetFocus(); + FTree.SetFocus(); + end else + begin + et := geteditor(); + if et then et.SetFocus(); end end function SynNodeSelected(o,e); diff --git a/funcext/tvclib/getdlsymaddress.tsf b/funcext/tvclib/getdlsymaddress.tsf new file mode 100644 index 0000000..e52eced --- /dev/null +++ b/funcext/tvclib/getdlsymaddress.tsf @@ -0,0 +1,12 @@ +function getdlsymaddress(lib,n); //ȡ̬еĺ +begin + if not(ifstring(lib) and lib and n and ifstring(n)) then return 0; +{$ifdef linux} + Return dlsym(dlopen(lib,0x101) ,n); +{$endif} + Return GetProcAddress(LoadLibraryA(lib),n); +end +function dlopen(dl:string;flg:integer):pointer;cdecl ;external "libdl.so.2"; +function dlsym(handle:pointer;symbol:string):pointer;cdecl ;external "libdl.so.2"; +function LoadLibraryA(txt:string):POINTER;stdcall;external "Kernel32.dll" name "LoadLibraryA"; +function GetProcAddress(h:pointer;n:string):pointer;stdcall;external "Kernel32.dll" name "GetProcAddress"; \ No newline at end of file diff --git a/funcext/tvclib/utslvclcef.tsf b/funcext/tvclib/utslvclcef.tsf index 00c23b0..4703520 100644 --- a/funcext/tvclib/utslvclcef.tsf +++ b/funcext/tvclib/utslvclcef.tsf @@ -6,6 +6,7 @@ function cef_object_del(ptr); function cef_dictionary_value_create(); function cef_request_context_get_global_context(); function cef_initialize(args:pointer;sett:pointer;app:pointer;info:pointer):integer; +function cef_initialize_tsl(args:pointer;sett:pointer;app:pointer;info:pointer); function cef_browser_host_create_browser_sync(winfo:pointer;client:pointer;url:pointer;bs:pointer;ef:pointer;ef2:pointer):pointer; function cef_browser_host_create_browser_sync_tsl(winfo;client;url;bs;ef;ef2); function cef_browser_host_create_browser_tsl(winfo;client;url;bs;ef;ef2); @@ -696,6 +697,7 @@ type cef_contain_base = class(tslcstructureobj) end function getinstance(fn); begin + if not fn then return 0; if not ifobj(fn) then return 0; r := makeweakref(fn,ok); if ok then return makeinstance(r); @@ -1281,7 +1283,7 @@ type cef_display_handler_t=class(cef_contain_base) ); end end - property on_title_change index "on_title_change" read getcallpropertybyindex write setcallpropertybyindex; + property on_title_change index "on_title_change" read getcallpropertybyindex write setcallpropertybyindex; procedure on_title_change_i(sf:pointer;browser:pointer;title:pointer);stdcall; begin c := getcallback(functionname()); @@ -1293,7 +1295,7 @@ type cef_display_handler_t=class(cef_contain_base) ); end end - property on_favicon_urlchange index "on_favicon_urlchange" read getcallpropertybyindex write setcallpropertybyindex; + property on_favicon_urlchange index "on_favicon_urlchange" read getcallpropertybyindex write setcallpropertybyindex; procedure on_favicon_urlchange_i(sf:pointer;browser:pointer;icon_urls:pointer);stdcall; begin c := getcallback(functionname()); @@ -5371,6 +5373,10 @@ function cef_string_ascii_to_utf16(uf8:string;len:pointer;o:pointer):integer;cde function cef_initialize(args:pointer;sett:pointer;app:pointer;info:pointer):integer;cdecl;external "libcef.dll" name "cef_initialize"; function cef_browser_host_create_browser_sync(winfo:pointer;client:pointer;url:pointer;bs:pointer;ef:pointer;ef2:pointer):pointer;cdecl;external "libcef.dll" name "cef_browser_host_create_browser_sync"; function cef_browser_host_create_browser(winfo:pointer;client:pointer;url:pointer;bs:pointer;ef:pointer;ef2:pointer):pointer;cdecl;external "libcef.dll" name "cef_browser_host_create_browser"; +function cef_initialize_tsl(args:pointer;sett:pointer;app:pointer;info:pointer); +begin + return cef_initialize(args?args._getptr_():0,sett?sett._getptr_():0,app?app._getptr_():0,info?info._getptr_():0); +end function cef_browser_host_create_browser_tsl(winfo;client;url;bs;ef;ef2); begin s := new cef_string_t();