界面库

更新
This commit is contained in:
2024-06-03 09:44:43 +08:00
parent 9084557760
commit 1ed266f959
27 changed files with 1226 additions and 129 deletions
+10 -8
View File
@@ -281,7 +281,7 @@ type ctslctrans = class(tmemoryclass)
ret := 1;
end
end
"short":
"short","word":
begin
if ifnumber(v)then
begin
@@ -289,7 +289,7 @@ type ctslctrans = class(tmemoryclass)
ret := 1;
end
end
"shortarray":
"shortarray","wordarray":
begin
if arraynumberchek(v)and length(v)<= l then
begin
@@ -570,14 +570,14 @@ type ctslctrans = class(tmemoryclass)
o := _objs[i];
o._setcptr_(tptr);
end else
if v1="userarray" then
if v="userarray" then
begin
tptr := ptr+v3;
o := _objs[i];
o._setcptr_(tptr);
end else
begin
_objs[v0]:= ptr+v3;
_objs[i]:= ptr+v3;
end
end
end
@@ -657,11 +657,11 @@ type ctslctrans = class(tmemoryclass)
begin
ret := _tool.readbyte(p);
end
"short":
"short","word":
begin
ret := _tool.readshort(p);
end
"shortarray":
"shortarray","wordarray":
begin
ret := _tool.readshorts(p,l);
end
@@ -2143,7 +2143,7 @@ begin
end
function is_validate_type(tp);
begin
return array("uint":1,"char":1,"float":1,"double":1,"int":1,"intptr":1,"pointer":1,"int64":1,"byte":1,"short":1,"char*":1,"user*":1,"long":1)[tp];
return array("uint":1,"char":1,"float":1,"double":1,"int":1,"intptr":1,"pointer":1,"int64":1,"byte":1,"short":1,"char*":1,"user*":1,"long":1,"word":1,"dword":1)[tp];
end
function tslarraytocstructcalc(data,alim,bsi,ssize); //计算对其长度
begin
@@ -2265,7 +2265,9 @@ begin
ret1 := tslarraytocstructcalc(v,alim,npoint,sz);
ret[i,2]:= ret1;
end else
raise "类型错误";
begin
raise ("类型错误:" $ tp1);
end
ret[i,3]:= npoint; //元素开始的地址
ret[i,4]:= sz; //元素占用空间
ret[i,6]:= size; //元素个数
+1 -1
View File
@@ -61,7 +61,7 @@ uses utslvclauxiliary,UVCPropertyTypesPersistence,utslvclbase;
begin
if not(o is class(tcomponent))then return array();
t := o.classinfo;
idx := getmsgd_Crc32(tostm(t))+"&&";
idx := getmsgd_Crc32(tostm(t,0,1))+"&&";
r := GetClassDigestB(idx);
if ifarray(r)then return r;
r := array();
+1 -1
View File
@@ -297,7 +297,7 @@ type tcontrol = class(tcomponent)
}
if not(o is class(tcontrol))then return array();
t := o.classinfo;
idx := getmsgd_Crc32(tostm(t))+"%%";
idx := getmsgd_Crc32(tostm(t,0,1))+"%%";
r := CtlInfoAndDigest(idx);
if ifarray(r)then return r;
r := array();
File diff suppressed because it is too large Load Diff
+27 -1
View File
@@ -51,6 +51,7 @@ function TS_ExecPath():string;
function TS_GetAppPath():string;
function TS_GetIniPath(t:integer;iname:string):string;
function gettslexefullpath();
function int_to_binary(d,n); //整数转换成字符串
//function tsl_str_head_at(s,n);
function get_tsl_mem_ptr(s,n);
type tuiglobaldata=class() //全局对象存储
@@ -3626,7 +3627,7 @@ begin
@return(string) 16进制字符串 %%
**}
r := "";
str := tostm(t);
str := tostm(t,0,1);
ky := static(inttostr(0 -> 9)union array("A","B","C","D","E","F"));
idx := 1;
setlength(r,length(str)* 2);
@@ -3994,6 +3995,31 @@ function TS_ModulePath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$
function TS_ExecPath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_ExecPath";
function TS_GetAppPath():string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_GetAppPath";
function TS_GetIniPath(t:integer;iname:string):string;cdecl;external {$ifdef linux}"libTSSVRAPI.so"{$else}"TSSVRAPI.dll"{$endif} name "TS_GetIniPath";
function int_to_binary(d,n); //整数转换成字符串
begin
r := "";
x := d;
ct := 0;
if not(n>1)then n := 8;
while x>0 do
begin
divmod(x,2,a,b);
r := inttostr(b)+r;
x := a;
ct++;
if ct >= n then break;
end
if ct=0 then
begin
ct := 1;
r := "0";
end
for i := ct to n-1 do
begin
r := "0"+r;
end
return r;
end
function istextascii(s); //ansi编码
begin
len := length(s);
+141 -8
View File
@@ -1480,9 +1480,10 @@ type tg_axes = class(tg_base) //
begin
return ;
end
function gs_auto_ticks(idx,v);//自动更新坐标标签
function gs_auto_ticks(vidx,v);//自动更新坐标标签
begin
tg_boolen_value(v,nv);
idx := tg_get_true_idx(vidx);
if nv=tgc_on or nv=tgc_off then
begin
if idx in array(0,1,2) then
@@ -1501,8 +1502,9 @@ type tg_axes = class(tg_base) //
return fauto_ticks;
end
end
function get_axises(idx);
function get_axises(vidx);
begin
idx := tg_get_true_idx(vidx);
if idx in array(0,1,2) then
begin
return faxes_objects[idx];
@@ -1524,8 +1526,9 @@ type tg_axes = class(tg_base) //
return faxes_bounds;
end
end
function gs_data_bounds(idx,v);
function gs_data_bounds(vidx,v);
begin
idx := tg_get_true_idx(vidx);
if v=-1 then
begin
if idx in array(0,1,2) then
@@ -1547,8 +1550,9 @@ type tg_axes = class(tg_base) //
return fdata_bounds;
end
end
function gs_zoom_box(idx,v);
function gs_zoom_box(vidx,v);
begin
idx := tg_get_true_idx(vidx);
if ifarray(v) and ifnumber(v[0]) and ifnumber(v[1]) then
begin
if idx in array(0,1,2) then
@@ -1562,9 +1566,10 @@ type tg_axes = class(tg_base) //
return fzoom_box;
end
end
function gs_axes_reverse(idx,v); //反向
function gs_axes_reverse(vidx,v); //反向
begin
if not tg_boolen_value(v,nv) then return ;
idx := tg_get_true_idx(vidx);
if nv=tgc_off or nv=tgc_on then
begin
if idx in array(0,1) then
@@ -1594,8 +1599,9 @@ type tg_axes = class(tg_base) //
return fmargins;
end
end
function gs_sub_ticks(idx,v); //小刻度线
function gs_sub_ticks(vidx,v); //小刻度线
begin
idx := tg_get_true_idx(vidx);
if ifnumber(v) and (v>=0) then
begin
if idx in array(0,1,2) then
@@ -3449,6 +3455,10 @@ type tg_base = class(TNode,tg_const) //
vi := GetNodeByIndex(i);
vi.paint(cvs);
end
end
function hit_at(xy);virtual;
begin
return false;
end
function set_lineinfo_to_canvas(cvs,info);
begin
@@ -3485,7 +3495,19 @@ type tg_base = class(TNode,tg_const) //
cvs.font.bkcolor := fi.bkcolor;
cvs.font.width := fi.size;
cvs.font.height := fi.size*2;
end
function addEventListener(evtype,fn,ifCapture);
begin
end
function removeEventListener(evtype,fn,ifCapture);
begin
end
function dispatchEvent(evt); //分发
begin
end
published
property line_mode read fline_mode write set_line_mode;
property mark_mode read fmark_mode write set_mark_mode;
@@ -3657,9 +3679,110 @@ type tg_const = class()
//static const tgc_out_lower_left = "out_lower_left";
//////////////
end
type tg_evt =class() //消息
function create(etype,pms);
begin
feventtype := etype;
ftimeStamp := mtic;
fisTrusted := false;
feventPhase := 0;
freturnValue := true;
fdefaultPrevented := false;
fbubbles := true;
FstopImmediatePropagationed := false;
if not ifarray(pms) then return ;
fiparams := pms;
fisTrusted := pms["istrusted"]?true:false;
ftarget := pms["target"];
fcurrentTarget := pms["currenttarget"];
fbubbles := pms["bubbles"]?true:false;
feventPhase := (pms["eventphase"]>0)?pms["eventphase"]:0;
end
function preventdefault();
begin
fdefaultPrevented := true;
end
function stoppropagation();
begin
fstoppropagationed := true;
end
function composedPath();//从触发元素到最外层Window
begin
return array();
end
function stopImmediatePropagation();
begin
FstopImmediatePropagationed := true;
end
published
property bubbles read fbubbles; //是否冒泡,只读
property currentTarget read fcurrentTarget;//当前绑定的对象,只读
property target read ftarget;//目标对象,只读
property stoppropagationed read fstoppropagationed;//是否已经调用 stoppropagation,只读
property defaultPrevented read fdefaultPrevented;//是否已经调用 preventdefault,只读
property returnValue read freturnValue write freturnValue;//true表示正常执行,false表示阻止默认行为
property eventPhase read feventPhase;//只读,0,1,捕获,2到达目标,3,冒泡
property timeStamp read ftimeStamp;//只读,加载完成到现在的时间
property eventtype read feventtype;//只读类型
property isTrusted read fisTrusted;//true表示用户触发,false表示代码触发
property init_params read fiparams; //初始化参数
private
feventtype;
ftimeStamp;
fisTrusted;
feventPhase;
freturnValue;
fdefaultPrevented;
fstoppropagationed;
ftarget;
fbubbles;
fcurrentTarget;
FstopImmediatePropagationed;
fiparams;
end
type tg_evt_mouse = class(tg_evt) //鼠标消息
function create(etyp,pms);
begin
inherited;
if ifarray(pms) then
begin
fcvsx := pms["cvsx"];
fcvsy := pms["cvsy"];
end
end
property cvsx read fcvsx;
property cvsy read fcvsy;
private
fcvsx;
fcvsy;
end
type tg_evt_custom = class(tg_evt) //自定义消息
function create(etyp,pms);
begin
inherited;
fdetail := array();
if ifarray(pms) then fdetail := pms["detail"];
end
property detail read fdetail;
private
fdetail;
end
implementation
function node_hit_at(nd,info); //命中处理
begin
if not(nd.visible) then return 0;
nct := nd.NodeCount;
if nct>0 then
begin
for i := nd.NodeCount-1 downto 0 do
begin
hnod := node_hit_at(nd.GetNodeByIndex(i),info) ;
if hnod then return hnod;
end
end
if nd.hit_at(info) then return nd;
return 0;
end
function mg_bds(bds,d); //合并数据上下界
begin
d[0,0] := min(bds[0,0],d[0,0]);
@@ -4091,6 +4214,16 @@ function rec_to_points(rec);
begin
return array(rec[array(0,1)],rec[array(2,1)],rec[array(2,3)],rec[array(0,3)],rec[array(0,1)]);
end
function tg_get_true_idx(idx);
begin
nidx := idx;
case idx of
"x","X": nidx := 0;
"y","Y": nidx := 1;
"z","Z": nidx := 2;
end ;
return nidx;
end
////////////////////////////////////////
initialization
finalization
+3 -3
View File
@@ -666,9 +666,9 @@ type twindowsapi = class()
function ImageList_ReplaceIcon(himl:pointer;i:integer;hicon:pointer):integer;stdcall;external "Comctl32.dll" name "ImageList_ReplaceIcon";
function ImageList_SetIconSize(himl:pointer;cx:integer;cy:integer):integer;stdcall;external "Comctl32.dll" name "ImageList_SetIconSize";
function ImageList_GetIconSize(himl:pointer;var cx:integer;var cy:integer):integer;stdcall;external "Comctl32.dll" name "ImageList_GetIconSize";
function ImageList_GetIcon(himl:pointer;i:integer;flags:integer):pointer;stdcall;external "Comctl32.dll" name "ImageList_GetIcon";
function ImageList_DrawIndirect(pimldp:pointer):pointer;stdcall;external "Comctl32.dll" name "ImageList_DrawIndirect";
function ImageList_DragShowNolock(fShow:integer):integer;stdcall;external "Comctl32.dll" name "ImageList_DragShowNolock";
function ImageList_GetIcon(himl:pointer;i:integer;flags:integer):pointer;stdcall;external "Comctl32.dll" name "ImageList_GetIcon";
function ImageList_DrawIndirect(pimldp:pointer):pointer;stdcall;external "Comctl32.dll" name "ImageList_DrawIndirect";
function ImageList_DragShowNolock(fShow:integer):integer;stdcall;external "Comctl32.dll" name "ImageList_DragShowNolock";
function InitCommonControlsEx(it:pointer):integer;stdcall;external "Comctl32.dll" name "InitCommonControlsEx";
function Comctl32DllGetVersion(it:pointer):pointer;stdcall;external "Comctl32.dll" name "DllGetVersion";
function GetOpenFileNameA(LPOPENFILENAMEA:pointer):integer;stdcall;external "Comdlg32.dll" name "GetOpenFileNameA" keepresident;