更新动态库,更新界面库,更新编辑器

This commit is contained in:
2025-04-29 11:02:16 +08:00
parent ef1986a030
commit 5a31db348a
34 changed files with 224 additions and 341 deletions
+7
View File
@@ -5596,6 +5596,13 @@ type TInPutQuerys = class(TcustomInPutQuerys)
inherited;
end
end
type tgraphicsctl =class(tg_WinControl) ///////绘图控件
uses utvclgraphics;
function create(AOwner);
begin
inherited;
end
end
implementation
///////////////tmf文件转换///////////////////////
type Ttfm2Component = class(TTmfParser)
+14 -254
View File
@@ -1,11 +1,14 @@
unit utslvclcef;
//20230410
//20250410
{**
@explan(说明)封装cef到vcl控件,提供cef窗口的宿主控件,加入了,cookie,download,等功能 %%
@explan(说明)封装cef到vcl控件,提供cef窗口的宿主控件 %%
**}
interface
uses utslvclcefinterface,tslvcl;
type tcefowner = class(tcustomcontrol)
{**
@explan(说明)窗口的宿主控件
**}
protected
static fargs; //命令行参数
static fcefapp; //app
@@ -13,8 +16,6 @@ type tcefowner = class(tcustomcontrol)
static finitcef; //初始化标记
static finitcefobj;//初始化标记
static fcefloop; //消息循环
static fcookiemgr;
static fcookiewills;
static fcefwindows;
class function initcef(); //初始化cef
begin
@@ -27,29 +28,11 @@ type tcefowner = class(tcustomcontrol)
fcefapp.on_before_command_line_processing := function(o,u,cmd)
begin
//cmd.set_program(%% D:\Program Files\Tinysoft\AnalyseNG.NET\tsl_cef_main.exe%%);
cmd.append_argument("single-process");
//cmd.Append_Switch("single-process");
end
app := initializeapplication();
app.addExitMessageLoopdo(thisfunction(cef_shutdown));
cef_initialize(fargs._getptr_(), fappsetting._getptr_(), fcefapp._getptr_(),0);
fcookiemgr := new cef_cookie_manager_global_t();
if fcookiewills then
begin
for i,v in fcookiewills do
begin
if ifnil(v[1]) then
begin
fcookiemgr.delete_cookies(v[2],v[0],fcookiemgr.callback);
end else
begin
c := new cef_cookie_t();
c.name := v[0];
c.value := v[1];
fcookiemgr.set_cookie(v[2],c,fcookiemgr.callback);
end
end
fcookiewills := array();
end
end
end
class function sinit();override; //初始化
@@ -62,10 +45,9 @@ type tcefowner = class(tcustomcontrol)
fcefapp := new cef_app_t();
fappsetting := new cef_settings_t();
tp := unit(utslvclauxiliary).gettemppath();
fappsetting.log_file := tp+"-ceflogfile-"+datetostr(date())+".log";
//fappsetting.browser_subprocess_path := %% F:\cef_105.3.39\AnalyseNG.NET\cefclient.exe%%;
fappsetting.browser_subprocess_path := tslpath()+"tsl_cef_main.exe";
fappsetting.cache_path := tp+"-cefcatche-";// %% F:\cef_105.3.39\tslcache%%;
fappsetting.log_file := tp+"-cefownerlogfile-"+datetostr(date())+".log";
fappsetting.browser_subprocess_path := tslpath()+"tsl_cef_main";
fappsetting.cache_path := tp+"-cefownercatche-";
fappsetting.log_severity :=99;//0;
end
end
@@ -76,71 +58,14 @@ type tcefowner = class(tcustomcontrol)
width := 300;
height := 300;
fwinfo := new cef_window_info_t();
fclient := new cef_client_t();
{frm := new cef_life_span_handler_t();
frm.on_after_created := function(o,b)begin
echo "\r\n craeteted:",b.get_main_frame().get_url(),"<<";
end
frm.on_before_close := function(o,b)begin
echo "\r\n====doclose:",b.get_main_frame().get_url();
end
fclient.on_process_message_received := function()begin
echo "\r\n>>>>:messagesabed:",params[4];
//return 1;
end
fclient.life_span_handler := frm; }
d := new cef_download_handler_t();
fdownloader := d;
d.can_download := function(o,b,u,m)begin
return docandownload(o,b,u,m);
//return true;
end
d.on_before_download := function(o,b,it,s,c)begin
c.cont(s,1);
end
d.on_download_updated := function(o,b,it,c) begin
return dodownloadupdate(o,b,it,c);
end
{fOndownloadupdate := function(o,e)begin
echo "\r\n",e.get_id(),e.is_complete(),"=====",e.is_in_progress(),"===",e.is_complete(),"===",e.get_percent_complete(),"====",e.get_suggested_file_name();
end
foncandownload := function(o,e)begin
echo "\r\n",e.method,"==>>=",e.url;
//e.skip := true;
end}
muh := new cef_context_menu_handler_t();
muh.on_before_context_menu := function(o,b,f,pms,d)begin
ppm := PopupMenu;
if d then d.remove(0x84);
if ppm then
begin
fpopupmenushine := array();
createusrmenu(ppm,d,27500);
end
end
muh.on_context_menu_dismissed := function(o,b,f)begin
fpopupmenushine := array();
end
muh.on_context_menu_command := function(o,b,f,pms,id,flg)begin
oi := fpopupmenushine[id];
if oi then
begin
e := new tuieventbase(0,0,0,0);
CallMessgeFunction(oi.onclick,oi,e);
return 1;
end
end
//fclient.context_menu_handler := muh;
//fclient.download_handler := d;
fclient := new cef_client_t();
fbrssetting := new cef_browser_settings_t();
ftimer := new TTimer(self);
ftimer := new TTimer(self);
end
function checknewchild(c);override;
begin
return false;
end
function WMSize(o,e);override;
begin
if not HandleAllocated() then return ;//
@@ -205,55 +130,13 @@ type tcefowner = class(tcustomcontrol)
end
end
end
////////////////cookie///////////////////
function setcookie(n,v,ur);//设置cookie值
begin
if not( n and ifstring(n)) then return 0;
if not( v and ifstring(v)) then return 0;
if not(ur and ifstring(ur)) then
begin
cur := furl;
end else
begin
cur := ur;
end
cookie := new cef_cookie_t();
cookie.name := n;
cookie.value := v;
if fcookiemgr then
begin
return fcookiemgr.set_cookie(cur,cookie,fcookiemgr.callback);
end else
begin
if not(ifarray( fcookiewills)) then fcookiewills := array();
fcookiewills[length(fcookiewills)] := array(n,v,cur);
end
end
function delcookie(n,ur); //根据名字删除cookie
begin
if not( n and ifstring(n)) then return 0;
if not(ur and ifstring(ur)) then
begin
cur := furl;
end else
begin
cur := ur;
end
if fcookiemgr then
begin
fcookiemgr.delete_cookies(cur,n,fcookiemgr.callback);
end else
begin
if not(ifarray( fcookiewills)) then fcookiewills := array();
fcookiewills[length(fcookiewills)] := array(n,nil,cur);
end
end
published
property client read fclient;
property appsetting read getappsetting;
property url:string read furl write seturl;
property oncandownload:eventhandler read FOncandownload write FOncandownload;
property Ondownloadupdate:eventhandler read FOndownloadupdate write fOndownloadupdate;
{**
@param(url)(string)网址 %%
**}
private
function seturl(u); //设置url
begin
@@ -305,65 +188,8 @@ type tcefowner = class(tcustomcontrol)
fneedload := true;
ftimer.timeout(thisfunction(lazy_load()),60);
end
function createusrmenu(mu,d,idx); //构造菜单映射
begin
if not mu then return ;//
for i,v in mu.items do
begin
idx++;
fpopupmenushine[idx] := v;
smu := v.ItemCount;
if smu>0 then //存在子节点
begin
nd := d.add_sub_menu(idx,v.Caption);
if not(v.Enabled) then //处理是否有效
begin
d.set_enabled(idx,false);
end else
createusrmenu(v,nd,idx); //处理子菜单
end else //单个菜单
begin
if v.TSeparator then //分割类型
begin
d.add_separator();
end else //添加菜单
begin
d.add_item(idx,v.Caption);
if not(v.Enabled) then d.set_enabled(idx,false); //设置是否enabled
end
end
end
end
function docandownload(o,b,u,m);//是否可以下载处理
begin
if FOncandownload then
begin
e := new tcandownevent(0,0,0,0);
e.url := u;
e.method := m;
CallMessgeFunction(FOncandownload,self(true),e);
return not(e.skip);
end else
begin
return 1;
end
end
function dodownloadupdate(o,b,it,c);//下载过程处理
begin
if FOndownloadupdate and it and c then
begin
e := new tdownupdateevent(0,0,0,0);
e.FDownitem := it;
e.fcallback := c;
CallMessgeFunction(FOndownloadupdate,self(true),e);
end
end
private
[weakref]fbrower;
[weakref]FOncandownload;
[weakref]FOndownloadupdate;
[weakref]fdownloader;
[weakref]fpopupmenushine;
[weakref]fclient;
furl;
fwinfo;
@@ -386,72 +212,6 @@ type tcefowner = class(tcustomcontrol)
return fappsetting;
end
end
type tcandownevent = class(tuieventbase) //是否可以下载
function create(m,w,l,h);override;
begin
inherited;
end
url; //url
method; //post or get
end
type tdownupdateevent=class(tuieventbase)
function create(m,w,l,h);override;
begin
inherited;
end
//call--back;
function cancel();
begin
fcallback.cancel();
end
function pause();
begin
fcallback.pause();
end
function resume();
begin
fcallback.resume();
end
//down ----
function is_complete();//是否完成
begin
return FDownitem.is_complete();
end
function is_in_progress();//正在进行
begin
return FDownitem.is_in_progress();
end
function get_current_speed();//当前速度
begin
return FDownitem.get_current_speed();
end
function get_percent_complete();//完成进度
begin
return FDownitem.get_percent_complete();
end
function get_full_path();//路径
begin
return FDownitem.get_full_path();
end
function get_original_url();//原始路径
begin
return FDownitem.get_original_url();
end
function get_suggested_file_name();//建议文件名
begin
return FDownitem.get_suggested_file_name();
end
function get_total_bytes(); //大小
begin
return FDownitem.get_total_bytes();
end
function get_id(); //序号
begin
return FDownitem.get_id();
end
FDownitem;
fcallback;
end
implementation
initialization
+26 -3
View File
@@ -575,9 +575,30 @@ type cef_main_args_t=class(t_cef_stc_base)
function create(ptr);override;
begin
inherited create(getstruct(),ptr);
fargv := Create_argv(nt);
argv := fargv._getptr_();
argc := nt;
end
property argc index "argc" read _getvalue_ write _setvalue_;
property argv index "argv" read _getvalue_ write _setvalue_;
property argv index "argv" read _getvalue_ write _setvalue_;
private
function Create_argv(nt); //¹¹Ôìargv
begin
uses cstructurelib;
data := array();
nt := 0;
for i := 0 to sysparamcount() do
begin
data[nt][0] := nt;
data[nt][1] := "char*";
data[nt][2] := sysparamstr(i);
nt++;
end
stc := MemoryAlignmentCalculate(data);
obj := new tslcstructureobj(stc,nil);
return obj;
end
fargv;
end
{$else}
type cef_main_args_t=class(t_cef_stc_base)
@@ -592,9 +613,11 @@ type cef_main_args_t=class(t_cef_stc_base)
function create(ptr)
begin
inherited create(getstruct(),ptr);
instance := GetModuleHandleA();
end
property instance index "instance" read _getvalue_ write _setvalue_;
private
function GetModuleHandleA(name:pointer):pointer;stdcall;external "Kernel32.dll" name "GetModuleHandleA";
end
{$endif}
type cef_basetime_t = class(t_cef_stc_base) //32bit ¿ÉÄÜÓÐÎÊÌâÐèÒªÐÞÕý
@@ -7569,7 +7592,7 @@ type cef_const_value = class
static const CT_DND_COPY = 48;
static const CT_DND_LINK = 49;
end
implementation
implementation
type cef_in_out_recoder = class
function create(s,id);
begin
+15 -4
View File
@@ -2654,7 +2654,7 @@ type tcustomedit=class(TCustomControl)
begin
if host then host.DoChanged();
end
end
end
public
function Create(AOwner);override;
begin
@@ -4463,11 +4463,11 @@ type TCustomComboBoxbase=class(TCustomControl)
begin
return 20;
end
function GetItemIndex();virtual;//获得选中的序号
function GetItemIndex(idx);virtual;//获得选中的序号
begin
return -1;
end
function SetItemIndex();virtual;//设置选中的序号
function SetItemIndex(idx);virtual;//设置选中的序号
begin
end
end
@@ -4498,9 +4498,11 @@ type TcustomComboBox=class(TCustomComboBoxbase)
function create(AOwner);override;
begin
inherited;
caption := "combobox";
fmultisel := false;
fcheckbox := false;
FEdit := new TcustomEdit(self);
FEdit.Text := caption;
FEdit.OnKeyDown := function(o,e)
begin
if FMultisel then return ;
@@ -4520,7 +4522,7 @@ type TcustomComboBox=class(TCustomComboBoxbase)
FEdit.onchange := function(o,e);
begin
if feditischanging then return feditischanging := false;
if not(o.Readonly) then
if {not(o.Readonly)} true then
begin
feditischanging := true;
if Foneditchanged then
@@ -4691,12 +4693,21 @@ type TcustomComboBox=class(TCustomComboBoxbase)
property onEditUpdate:eventhandler read FoneditUpdate write FoneditUpdate;
property onkillfocus read Fonkillfocus write Fonkillfocus;
property onsetfocus read Fonsetfocus write Fonsetfocus;
property text:string read getedttext write setedttext;
property Editer read FEdit;
{**
@param(oneditchanged)(function[tcomboBox,tuieventbase])文本被改变回调,文本显示后调用%%
**}
private
function getedttext();
begin
return fedit.text;
end
function setedttext(s);
begin
FEdit.Text := s;
end
function setMultisel(v);
begin
nv := v?true:false;
+38 -24
View File
@@ -104,7 +104,7 @@ uses utslvclauxiliary;
bar_width 柱状图类型时候的宽度
tg_legend 图例
location 位置 tgc_in_upper_left tgc_in_lower_left ..... tgc_by_coordinates
postion 定位为tgc_by_coordinates,设置具体位置 array(x,y)
position 定位为tgc_by_coordinates,设置具体位置 array(x,y)
line_mode 边框线
links 关联的绘图,tg_graph 数组
text 文本内容,字符串数组
@@ -639,6 +639,8 @@ type tg_WinControl = class(tcustomcontrol,tg_figure_container) //
function create(AOwner);
begin
class(tcustomcontrol).create(AOwner);
width := 300;
height := 300;
class(tg_figure_container).create();
fg_timer := new unit(utslvclstdctl).tcustomtimer(self);
fg_timer.Interval := 300;
@@ -1181,7 +1183,7 @@ type tg_axes = class(tg_base) //
begin
v.paint_pre(cvs);
end
modify_label_postion();
modify_label_position();
ftitle.paint_pre(cvs);
if fbox = tgc_on then
begin
@@ -1603,7 +1605,7 @@ type tg_axes = class(tg_base) //
b1 := a1+len;
return true;
end
function modify_label_postion(); //修正标签位置
function modify_label_position(); //修正标签位置
begin
if ftitle and (ftitle.visible=tgc_on) and (ftitle.auto_position=tgc_on) then
begin
@@ -1745,7 +1747,7 @@ type tg_axes = class(tg_base) //
end
end ;
end
function modify_y_postion(loc);
function modify_y_position(loc);
begin
get_duan_dian(x0,y0,z0,x1,y1,z1,x2,y2,z2);
//////left
@@ -1835,7 +1837,7 @@ type tg_axes = class(tg_base) //
end
else
begin
return modify_y_postion(tgc_left);
return modify_y_position(tgc_left);
//axy.ytics_coord := array(fzoom_box[0,(faxes_reverse[0] = tgc_on)],"y",0);
end
axy.tics_direction := tgc_direct_asc;
@@ -1889,7 +1891,7 @@ type tg_axes = class(tg_base) //
begin
////////////////y轴///////////////////////////////////
modify_y_postion(fy_location);
modify_y_position(fy_location);
///////////////x///////////////////////////////
modify_x_position(fx_location);
//////z-axis
@@ -3264,7 +3266,7 @@ type tg_label =class(tg_base) //
published
property textalign read ftextalign write set_textalign;
property text read ftext write set_text;//= ""
property position read fposition write set_positon;//[-27.697388,-1.7130177]
property position read fposition write set_position;//[-27.697388,-1.7130177]
property location read flocation write Set_location;
property auto_position read fauto_position write set_auto_position;//"on"
//property auto_position_value read fauto_position_value write fauto_position_value;//"on"
@@ -3310,7 +3312,7 @@ type tg_label =class(tg_base) //
if nv<>fauto_position then
begin
fauto_position := nv;
prop_changed("auto_postion",nil);
prop_changed("auto_position",nil);
end
end
function set_font_angle(v);
@@ -3329,14 +3331,14 @@ type tg_label =class(tg_base) //
prop_changed("text",nil);
end
end
function set_positon(v);
function set_position(v);
begin
if ifarray(v) and ifnumber(v[0]) and ifnumber(v[1]) and v[0]<>fposition[0] and v[1]<>fposition[1] then
begin
fposition[0] :=v[0];
fposition[1] :=v[1];
fauto_position := tgc_off;
prop_changed("postion",v);
prop_changed("position",v);
end
end
function set_auto_rotation(v);
@@ -3750,7 +3752,7 @@ type tg_legend = class(tg_base) //ͼ
end
published
property location read flocation write set_location; //相对位置类型
property postion read fposition write set_postion; //位置
property position read fposition write set_position; //位置
property links read flinks write set_links; //图形
property text read FText write set_text; //图例字符串
protected
@@ -3818,12 +3820,12 @@ type tg_legend = class(tg_base) //ͼ
lw := ws[0]+ws[1];
lh := sum(hs);
end
function set_postion(v); //位置
function set_position(v); //位置
begin
if fposition<>v and ifarray(v) and ifnumber(v[0]) and ifnumber(v[1]) then
begin
fposition := array(v[0],v[1]);
prop_changed("postion",v);
prop_changed("position",v);
end
end
function set_text(s); //图例字符串设置
@@ -3982,7 +3984,7 @@ type tg_Polyline = class(tg_graph) //
end
xys[i] := array(integer(x),integer(y));
case fpolyline_style of
tgc_LS_bar,tgc_LS_barplot,tgc_LS_filled:
tgc_LS_bar,tgc_ls_Bar2,tgc_LS_barplot,tgc_LS_filled:
begin
zoom_to_xyz(v[0],0,0,x,y) ;
ys[i] := array(x,y);
@@ -4008,7 +4010,7 @@ type tg_Polyline = class(tg_graph) //
begin
if not(fface_rgn and point_in_rgn(p,fface_rgn)) then return -1;
case fpolyline_style of
tgc_LS_bar:
tgc_LS_bar,tgc_ls_Bar2:
begin
for i,v in fline_bar_rgn do
begin
@@ -4043,11 +4045,21 @@ type tg_Polyline = class(tg_graph) //
end
function paint_legend(cvs,rec);override; //绘制图例
begin
y0 := ceil(rec[1]+(rec[3]-rec[1])/2);
dis := ceil((rec[2]-rec[0])/5);
xys := array((rec[0]+dis,y0),(rec[0]+4*dis,y0));
set_lineinfo_to_canvas(cvs);
paint_lines(cvs,tgc_LS_interpolated,xys,0,array("line_mode":line_mode,"bar_width":array(get_abs_barwidth(),0),"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
dh := (rec[3]-rec[1]);
y0 := ceil(rec[1]+dh/2);
dis := ceil((rec[2]-rec[0])/5);
case fpolyline_style of
tgc_LS_bar,tgc_LS_bar2,tgc_LS_barplot,tgc_LS_filled:
begin
xys := array((rec[0]+dis,y0-dh/4),(rec[0]+4*dis,y0-dh/4),(rec[0]+4*dis,y0+dh/4),(rec[0]+dis,y0+dh/4));
paint_lines(cvs,tgc_LS_filled,xys,tgc_on,array("line_mode":line_mode,"bar_width":array(get_abs_barwidth(),0),"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
end else
begin
xys := array((rec[0]+dis,y0),(rec[0]+4*dis,y0));
paint_lines(cvs,tgc_LS_interpolated,xys,0,array("line_mode":line_mode,"bar_width":array(get_abs_barwidth(),0),"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
end
end ;
mk := markinfo.clone();
if mark_mode=tgc_on and mk.size>2 then
begin
@@ -4462,9 +4474,9 @@ type tg_base = class(TNode,tg_evet_conainter) //
if not p then return 0;
return p.dispatchEvent(evt,tg);
end
function invalidate(); //刷新
function invalidate(n); //刷新
begin
if tgc_off=fvisibe then return ;
if (n<>"visible") and (tgc_off=fvisibe) then return ;
if fchange_locked then return ;
axs := get_axes();
if axs then
@@ -4509,7 +4521,7 @@ type tg_base = class(TNode,tg_evet_conainter) //
end
function prop_changed(n,v);virtual; //改变通知
begin
invalidate();
invalidate(n);
end
function SetParent(V);virtual;
begin
@@ -4660,6 +4672,7 @@ type tg_const = class()
static const tgc_LS_barplot="barplot";
static const tgc_LS_filled="filled";
static const tgc_LS_bar="bar";
static const tgc_LS_bar2="bar2";
/////////////////相对位置////////////////////////////
static const tgc_in_upper_right = "in_upper_right";
@@ -4957,7 +4970,7 @@ begin
end
paint_lines(cvs,o.tgc_LS_interpolated,xys,cls,ifo);
end
o.tgc_LS_bar:
o.tgc_LS_bar,o.tgc_ls_bar2:
begin
b_w_x := integer(ifo["bar_width"][0]/2);
b_w_y := integer(ifo["bar_width"][1]/2);
@@ -4982,7 +4995,8 @@ begin
end
end
ifo["bar_rgns"] := bar_rgns;
paint_lines(cvs,o.tgc_LS_interpolated,xys,cls,ifo);
if o.tgc_ls_bar=pls then
paint_lines(cvs,o.tgc_LS_interpolated,xys,cls,ifo);
end
o.tgc_LS_arrowed:
begin