界面库

优化代码
This commit is contained in:
JianjunLiu 2022-04-22 15:27:57 +08:00
parent f6c6342cef
commit 517a052205
4 changed files with 387 additions and 418 deletions

View File

@ -314,7 +314,11 @@ type TGdiplusflat=class
class function GlobalSize(menm:pointer):integer;stdcall;external "Kernel32.dll" name "GlobalSize"; class function GlobalSize(menm:pointer):integer;stdcall;external "Kernel32.dll" name "GlobalSize";
class function memcpy(dst:pointer;src:string;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy"; class function memcpy(dst:pointer;src:string;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
class function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy"; class function memcpy2(var dst:string;src:pointer;size_t:integer):pointer;cdecl;external "msvcrt.dll" name "memcpy";
class function tuicloseistream(sm:pointer):integer;cdecl;external "TSLUIL.dll" name "tuicloseistream"; class function tuicloseistream(sm:pointer);
begin
r := tslvclcloseistream(sm);
return r;
end
class function GlobalAlloc(uFlags :integer;dwBytes:integer):pointer;stdcall;external "Kernel32.dll" name "GlobalAlloc"; class function GlobalAlloc(uFlags :integer;dwBytes:integer):pointer;stdcall;external "Kernel32.dll" name "GlobalAlloc";
class Function GdipCreatePath(brushMode:integer;var path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePath"; class Function GdipCreatePath(brushMode:integer;var path:pointer):integer;stdcall;external "gdiplus.dll" name "GdipCreatePath";

View File

@ -954,7 +954,6 @@ end
end end
end end
class function MultiByteToWideChar_a(CodePage:integer;dwFlags:integer;lpMultiByteStr:string;cbMultiByte:integer;var lpWideCharStr:string;cchWideChar:integer):integer; class function MultiByteToWideChar_a(CodePage:integer;dwFlags:integer;lpMultiByteStr:string;cbMultiByte:integer;var lpWideCharStr:string;cchWideChar:integer):integer;
class function tuicloseistream(sm:pointer):integer;
class function GetEncoderClsid(n:String;ed:pointer):integer; class function GetEncoderClsid(n:String;ed:pointer):integer;
begin begin
WriteStringToPtr(ed,n); //保存 WriteStringToPtr(ed,n); //保存
@ -2770,7 +2769,7 @@ end
gtk_widget_destroy(cdlg); gtk_widget_destroy(cdlg);
return r=-5; return r=-5;
end end
function tsl_gtk_color_selection_property(w:pointer):pointer;cdecl;external "./plugin/libTSLUIL.so";
type TBrowseinfoA_ = class(tslcstructureobj) type TBrowseinfoA_ = class(tslcstructureobj)
{** {**
@explan(说明)文件夹选择结构 %% @explan(说明)文件夹选择结构 %%
@ -3066,8 +3065,11 @@ end
MultiByteToWideChar_a(0, 0, c , -1, pwszUnicode , iSize-1); MultiByteToWideChar_a(0, 0, c , -1, pwszUnicode , iSize-1);
return pwszUnicode; return pwszUnicode;
end end
class function GetEncoderClsid(n:String;ed:pointer):integer;cdecl;external "TSLUIL.dll" name "GetEncoderClsid"; class function GetEncoderClsid(n:String;ed:pointer);
class function tuicloseistream(sm:pointer):integer;cdecl;external "TSLUIL.dll" name "tuicloseistream"; begin
r := tslvclgetencoderclsid(n,ed);
return r;
end;
//*********** //***********
function GetDpiForMonitor(hmonitor:pointer; dpiType:integer;var dpiX:integer;var dpiY:integer):pointer;stdcall;external "Shcore.dll" name "GetDpiForMonitor"; function GetDpiForMonitor(hmonitor:pointer; dpiType:integer;var dpiX:integer;var dpiY:integer):pointer;stdcall;external "Shcore.dll" name "GetDpiForMonitor";
//Kernel32.dll //Kernel32.dll
@ -25745,16 +25747,6 @@ type TImage=class(TSLUIBASE)
vp := GetFileType(t); vp := GetFileType(t);
s := gdi.imagetostring(FHandle,vp); s := gdi.imagetostring(FHandle,vp);
return s; return s;
/////////////////
st := ImageToStream(t);
_wapi.GetHGlobalFromStream(st,memo);
len := _wapi.GlobalSize(memo);
s := "";
lm := _wapi.GlobalLock(memo);
setlength(s,len);
_wapi.memcpy2(s,lm,len);
_wapi.tuicloseistream(st);
return s;
end end
function StringToImage(b); function StringToImage(b);
begin begin
@ -25771,24 +25763,6 @@ type TImage=class(TSLUIBASE)
FHandle := hd; FHandle := hd;
end end
return r; return r;
////////////////////////////////////
len := length(b);
hm := _wapi.GlobalAlloc(2,len+1); //分配内容
lm := _wapi.GlobalLock(hm); //枷锁
if lm <> 0 then
begin
_wapi.memcpy(lm,b,len); //内存拷贝
_wapi.GlobalUnlock(hm); //解锁
end
_wapi.CreateStreamOnHGlobal(hm,true,st);
r := gdi.GdipLoadImageFromStream(st,hd);
if hd then
begin
DestroyHandle();
FHandle := hd;
end
_wapi.tuicloseistream(st);
return r;
end end
function ToHbitmap(); function ToHbitmap();
begin begin
@ -28221,7 +28195,8 @@ type TBasicAction=class(TComponent)
begin begin
if FOnExecute then if FOnExecute then
begin begin
calldatafunction(FOnExecute,self); e := new tuieventbase(0,0,0,0);
calldatafunction(FOnExecute,self(true),e);
return true; return true;
end end
return false; return false;
@ -31809,7 +31784,6 @@ type TArrayTreeClass = class
FSubName := sub; FSubName := sub;
end end
end end
function create(v); function create(v);
begin begin
{** {**
@ -31865,7 +31839,6 @@ type TArrayTreeClass = class
end end
return ret; return ret;
end end
class function SetColumnName(info); class function SetColumnName(info);
begin begin
if not ifarray(info)then info := array("id":"id","pid":"pid","sub":"sub"); if not ifarray(info)then info := array("id":"id","pid":"pid","sub":"sub");
@ -31909,7 +31882,6 @@ type TArrayTreeClass = class
pdo := oarray[-inf]; pdo := oarray[-inf];
ifcycle := false; ifcycle := false;
end end
pdo.addcomponent(ido); pdo.addcomponent(ido);
end end
if ifcycle and oarray then if ifcycle and oarray then
@ -32029,7 +32001,6 @@ type TArrayTreeClass = class
FTStringa.Clear(); FTStringa.Clear();
return r; return r;
end end
function STNV(); function STNV();
begin begin
{** {**
@ -32077,8 +32048,7 @@ type TArrayTreeClass = class
{** {**
@explan(说明) 读取section 下面key %% @explan(说明) 读取section 下面key %%
**} **}
if ifstring(sn) and sn then if ifstring(sn)and sn then Fini.readSection(sn,FTStringa);
Fini.readSection(sn,FTStringa);
return STA(); return STA();
end end
function ReadSections();virtual; function ReadSections();virtual;
@ -32094,8 +32064,7 @@ type TArrayTreeClass = class
{** {**
@explan(说明) 读取section下面的所有key:value %% @explan(说明) 读取section下面的所有key:value %%
**} **}
if ifstring(sn) and sn then if ifstring(sn)and sn then FIni.ReadSectionValues(sn,FTStringa);
FIni.ReadSectionValues(sn,FTStringa);
return STNV(); return STNV();
end end
function RenameSection(sn1,sn2);virtual; function RenameSection(sn1,sn2);virtual;
@ -32131,8 +32100,7 @@ type TArrayTreeClass = class
{** {**
@explan(说明) 获得section 数据,二维表,name,value 列 @explan(说明) 获得section 数据,二维表,name,value 列
**} **}
if ifstring(sn) and sn then if ifstring(sn)and sn then FIni.ReadSectionValues(sn,FTStringa);
FIni.ReadSectionValues(sn,FTStringa);
return STNVA(); return STNVA();
end end
function ReadSectionValues3(sn); function ReadSectionValues3(sn);
@ -32153,8 +32121,7 @@ type TArrayTreeClass = class
{** {**
@explan(说明) 读取key %% @explan(说明) 读取key %%
**} **}
if CheckSK(sn,key) then if CheckSK(sn,key)then return FIni.ReadString(sn,key,ifstring(def)?def:"");
return FIni.ReadString(sn,key,ifstring(def)?def:"");
return nil; return nil;
end end
function WriteKey(sn,key,v);virtual; function WriteKey(sn,key,v);virtual;
@ -32162,24 +32129,20 @@ type TArrayTreeClass = class
{** {**
@explan(说明) 写入key %% @explan(说明) 写入key %%
**} **}
if ifnil(v)then v := ""; if ifnil(v)then v := "";
if CheckSK(sn,key) then if CheckSK(sn,key)then return FIni.WriteString(sn,key,ifstring(v)?v:tostn(v));
return FIni.WriteString(sn,key,ifstring(v)?v:tostn(v));
return 0; return 0;
end end
function DeleteKey(sn,key);virtual; function DeleteKey(sn,key);virtual;
begin begin
if CheckSK(sn,key) then if CheckSK(sn,key)then return FIni.DeleteKey(sn,key);
return FIni.DeleteKey(sn,key);
end end
function EraseSection(sn);virtual; function EraseSection(sn);virtual;
begin begin
{** {**
@explan(说明)删除section %% @explan(说明)删除section %%
**} **}
if ifstring(sn) and sn then if ifstring(sn)and sn then return FIni.EraseSection(sn);
return FIni.EraseSection(sn);
end end
function Destroy();virtual; function Destroy();virtual;
begin begin
@ -32191,6 +32154,7 @@ type TArrayTreeClass = class
property LowerValue read FLowerValue write FLowerValue; property LowerValue read FLowerValue write FLowerValue;
_tag; _tag;
end end
type TCreateProcessA = class() type TCreateProcessA = class()
{** {**
@explan(说明) 进程构造对象 %% @explan(说明) 进程构造对象 %%

View File

@ -453,6 +453,7 @@ type tgtkapis = class() //gtk
function gtk_main_iteration():integer ;cdecl;external 'libgtk-3.so'; function gtk_main_iteration():integer ;cdecl;external 'libgtk-3.so';
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
function tsl_gtk_idle_interface(p:pointer):integer;cdecl;external "./plugin/libTSLUIL.so"; function tsl_gtk_idle_interface(p:pointer):integer;cdecl;external "./plugin/libTSLUIL.so";
function tsl_gtk_color_selection_property(w:pointer):pointer;cdecl;external "./plugin/libTSLUIL.so";
function g_idle_remove_by_data(p:pointer):integer;cdecl;external 'libgtk-3.so'; function g_idle_remove_by_data(p:pointer):integer;cdecl;external 'libgtk-3.so';
//////////////// ////////////////
@ -2867,7 +2868,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
FConnectNameIds := array(); FConnectNameIds := array();
FConnectHandlers := array(); FConnectHandlers := array();
end end
function getsingalmap();virtual; function getsignalmap();virtual;
begin begin
return array( return array(
"wm-user":'tsl_gtk_wmuser_event', //Óû§ "wm-user":'tsl_gtk_wmuser_event', //Óû§
@ -2898,7 +2899,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
end end
//echo "\r\nconnect ===========================",FHandle,"=====",n; //echo "\r\nconnect ===========================",FHandle,"=====",n;
eid := GetGtkEventNameOrId(ln); eid := GetGtkEventNameOrId(ln);
fn := (getsingalmap())[ln]; fn := (getsignalmap())[ln];
if not(fn and ifstring(fn)) then fn := "tsl_gtk_normal_event_cb"; if not(fn and ifstring(fn)) then fn := "tsl_gtk_normal_event_cb";
lnid := g_signal_connect_data(FHandle, ln, gettslvcleventhandler(fn), eid,nil,0); lnid := g_signal_connect_data(FHandle, ln, gettslvcleventhandler(fn), eid,nil,0);
FConnectNameIds[ln] := lnid; FConnectNameIds[ln] := lnid;
@ -3143,7 +3144,7 @@ type tgtk_im_object = class(tgtk_ctl_object)
Connect(v,f); Connect(v,f);
end end
end end
function getsingalmap();override; function getsignalmap();override;
begin begin
return array( return array(
"preedit-start":"dodeleteevents" , "preedit-start":"dodeleteevents" ,

Binary file not shown.