Compare commits

...

2 Commits

Author SHA1 Message Date
tslediter 59b47c7122 界面库
更新
2024-07-02 14:44:15 +08:00
tslediter 7b9c9ae25e 编辑器
修正新建文件夹可能出现的问题
2024-06-27 14:51:47 +08:00
7 changed files with 179 additions and 122 deletions

View File

@ -2075,7 +2075,7 @@ begin
dcmpdir := getdesignerpath()+"dcmps"+ioFileseparator();
CreateDirWithFileName(dcmpdir+"1.txt");
osysdir := trim(sysgettsllibpath());
if osysdir[length(osysdir)]<>";" then osysdir+=";";
if osysdir and osysdir[length(osysdir)]<>";" then osysdir+=";";
g_orig_lib_path := osysdir+Getfuncextdir()+ioFileseparator()+";";
syssettsllibpath( dcmpdir+";"+g_orig_lib_path);
ini := static getdesginerini();

View File

@ -8562,13 +8562,13 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
end
function scrollwindowdraw(a,b,c,d);
begin
hd := a.handle;
r := zeros(4);
_wapi.gtk_widget_get_allocation(hd,r);
//hd := a.handle;
//r := zeros(4);
//_wapi.gtk_widget_get_allocation(hd,r);
//cr := _wapi.gdk_cairo_create(_wapi.gtk_widget_get_window(hd));
cr :=c;//rec := r;
rec := zeros(4); _wapi.gdk_cairo_get_clip_rectangle(cr,rec);
_Wapi.g_object_get_data(cr,nil);
_Wapi.g_object_set_data(cr,nil);
//_wapi.cairo_clip_extents(cr,x,y,w,h);
hwd := handle;
_wapi.g_object_set_data(hwd,"paint_dc",cr);
@ -8576,6 +8576,9 @@ type tgtk_ctl_scroll_window = class(tgtk_ctl_object)
CallTslVclProc(_const.WM_PAINT,0,0); //»æÖÆ
if not(self(true) is class(tgtk_ctl_window_PoPup)) then
begin
hd := a.handle;
r := zeros(4);
_wapi.gtk_widget_get_allocation(hd,r);
if (r[2]<=(rec[0]+rec[2])) or (r[3]<=(rec[1]+rec[3])) then
begin
_wapi.cairo_set_dash(cr,array(4.0,0.0),2,0);

View File

@ -3961,13 +3961,16 @@ begin
end
end
if not ffname then exit;
nct := 4;
ffL := length(ffname);
{$ifdef linux}
nct := 1;
{$endif}
if length(ffname)<1 then exit;
if ffL<1 then exit;
{$else}
nct := 4;
if ffL<4 then exit;
{$endif}
ph := ffname[1:nct];
for i := nct+1 to length(ffname) do
for i := nct+1 to ffL do
begin
vi := ffname[i];
if vi=iofp then

View File

@ -17,7 +17,8 @@ type TGdi = class(TSLUIBASE)
FCanvas := c;
Onchange();
end
protected FHandle; //gdi¾ä±ú
protected
FHandle; //gdi¾ä±ú
FGdistate;
FGDIstruct;
class function sinit();override;

View File

@ -2611,7 +2611,10 @@ type tcustomedit=class(TCustomControl)
private
function geteditrect();virtual;
begin
return ClientRect;
r := ClientRect;
r[2]-=1;
r[3]-=1;
return r;
end
function getBorder();
begin

View File

@ -564,7 +564,7 @@ type tg_WinControl = class(tcustomcontrol,tg_const) //
begin
if ffigure then
begin
d := e_2_array(e);
d := e_2_array(e,evt_mouse_up);
if ffigure.executecommand(evt_mouse_up,d)=1 then e.skip := true;
end
end
@ -572,7 +572,7 @@ type tg_WinControl = class(tcustomcontrol,tg_const) //
begin
if ffigure then
begin
d := e_2_array(e);
d := e_2_array(e,evt_mouse_down);
if ffigure.executecommand(evt_mouse_down,d)=1 then e.skip := true;
end
//echo "\r\n",functionname(),tostn(array(xy,bt,sh));
@ -584,16 +584,21 @@ type tg_WinControl = class(tcustomcontrol,tg_const) //
fmovecnt++;
if fmovecnt>4 then fmovecnt := 0;
if fmovecnt<>2 then return ;
d := e_2_array(e);
d := e_2_array(e,evt_mouse_move);
if ffigure.executecommand(evt_mouse_move,d)=1 then e.skip := true;
end
end
function DoMouseWheel(o,e);override;
begin
p := ScreenToClient(e.xpos,e.ypos);
begin
if ffigure then
begin
ffigure.executecommand(cmd_zoom_inc,array("delta":e.delta,"x":p[0],"y":p[1]));
p := ScreenToClient(e.xpos,e.ypos);
st := e.shiftstate();
sft := 0x0 in st;
sctl := 0x2 in st;
d := array("type":evt_mouse_wheel,"cvsx":p[0],"cvsy":p[1],"delta":e.delta,"shift":sft,"ctrl":sctl,);
ffigure.executecommand(evt_mouse_wheel,d);
e.skip := true;
end
end
function DoWMSIZE(o,e);override;
@ -615,13 +620,14 @@ type tg_WinControl = class(tcustomcontrol,tg_const) //
InvalidateRect(nil,false);
Fneed_invaliate := false;
end
function e_2_array(e);
function e_2_array(e,tp);
begin
d := array();
st := e.shiftstate();
sft := 0x0 in st;
sctl := 0x2 in st;
d := array(
"type":tp,
"cvsx":e.xpos,
"cvsy":e.ypos,
"shift":sft,
@ -637,7 +643,7 @@ type tg_WinControl = class(tcustomcontrol,tg_const) //
Fneed_invaliate;
ffigureprepared;
end
type tg_figure = class(tg_evet_conainter) /////////
type tg_figure = class(tg_evet_conainter) //绘图容器
function create();
begin
inherited;
@ -658,13 +664,24 @@ type tg_figure = class(tg_evet_conainter) /////////
begin
fresh();
return ;
end
end
evt_mouse_wheel:
begin
r := cmd_mouse_event(evt_mouse_wheel,p);
if not r then
begin
r := executecommand(cmd_zoom_inc,p);
end
return r;
end
cmd_zoom_inc:
begin
for i,v in faxeses.data do
begin
v.executecommand(cmd_zoom_inc,p);
end
if 1 = v.executecommand(cmd_zoom_inc,p) then continue;
else r := true; //经过了默认
end
return r;
end
evt_mouse_move:
begin
@ -845,7 +862,7 @@ type tg_figure = class(tg_evet_conainter) /////////
end
evt := new tg_evt_mouse(evtname,d);
dispatchEvent(evt,nds);
return evt.stoppropagationed;
return evt.stoppropagationed or evt.defaultPrevented; //是否停止
end
private
[weakref] frect_getter;
@ -875,24 +892,25 @@ type tg_axes = class(tg_base) //
ochanged := f_changed;
case cmd of
"title_rgn": return ftitle.executecommand("label_rgn");
"x_label_rgn": return (fx_label.visible=tgc_on)?faxes_objects[0].executecommand("label_rgn"):nil;
"x_label_rgn": return (fx_label.visible=tgc_on)?faxes_objects[0].executecommand("label_rgn"):nil; //标签区域
"y_label_rgn": return (fy_label.visible=tgc_on)?faxes_objects[1].executecommand("label_rgn"):nil;
"z_label_rgn": return (fz_label.visible=tgc_on)?faxes_objects[2].executecommand("label_rgn"):nil;
"x_tics_recs": return (fx_label.visible=tgc_on)?faxes_objects[0].executecommand("tics_recs"):nil;
"x_tics_recs": return (fx_label.visible=tgc_on)?faxes_objects[0].executecommand("tics_recs"):nil; //哭的标签区域
"y_tics_recs": return (fy_label.visible=tgc_on)?faxes_objects[1].executecommand("tics_recs"):nil;
"z_tics_recs": return (fz_label.visible=tgc_on)?faxes_objects[2].executecommand("tics_recs"):nil;
cmd_zoom_inc:
begin
if not ifarray(pm) then return ;
p0 := pm["x"];
p1 := pm["y"];
p0 := pm["cvsx"];
p1 := pm["cvsy"];
for i := 0 to 2 do
begin
a0 := fzoom_box[i,0];
b0 := fzoom_box[i,1];
if not xy_in_paint_rect(p0,p1) then
begin
continue;
return true;
//continue;
end
if not xyz_to_zoom(p0,p1,fzoom_box[2,0],x,y,z) then continue ;
dx := ((pm["delta"]>0)?(1.05):(1/1.05));
@ -950,7 +968,7 @@ type tg_axes = class(tg_base) //
_y := (y-p_top)/p_height;
return true;
end
function zoom_to_xyz(x,y,z,_x,_y,_z); //----------
function zoom_to_xyz(x,y,z,_x,_y,_z); //视图到xyz
begin
if not(fFigure ) then return false;
if faxes_reverse[0]=tgc_on then x0 := fcoordinate_sizes[0]/2-(x-fzoom_bounds[0,0])/fzoom_coordinate_rates[0];
@ -966,7 +984,7 @@ type tg_axes = class(tg_base) //
_z +=fbounds_center[2];
return true;
end
function xyz_to_zoom(x,y,z,_x,_y,_z);
function xyz_to_zoom(x,y,z,_x,_y,_z); //xyz到视图
begin
if not(fFigure ) then return false;
x1 := x;y1 := y;z1 := z;
@ -1212,25 +1230,25 @@ type tg_axes = class(tg_base) //
//grayplot_properties, surface_properties, fec_properties, text_properties, legend_properties)
end
published
property figure read fFigure write SetFigure; //´°¿Ú
property figure read fFigure write SetFigure; //图容器
property axises read get_axises;//axes_visible ;//= ["on","on","on"]
property axes_reverse read gs_axes_reverse write gs_axes_reverse;//axes_reverse ;//= ["off","off","off"]
property x_location read fx_location write set_x_location;//'bottom
property y_location read fy_location write set_y_location;//'left
property z_location read fz_location write set_z_location;//'left
property title read ftitle;
property x_label read fx_label;
property title read ftitle; //标题
property x_label read fx_label; //标签
property y_label read fy_label;
property z_label read fz_label;
property auto_ticks read gs_auto_ticks write gs_auto_ticks;
property box read fbox write set_box;
property z_label read fz_label; //标签
property auto_ticks read gs_auto_ticks write gs_auto_ticks; //自动刻度线
property box read fbox write set_box; //边框
property filled read ffilled write set_filled;
property sub_ticks read gs_sub_ticks write gs_sub_ticks;
//上下左右空白
property margins read gs_margins write gs_margins;
property axes_bounds read gs_axes_bounds write gs_axes_bounds;
property data_bounds read gs_data_bounds write gs_data_bounds;
property zoom_box read gs_zoom_box write gs_zoom_box;
property margins read gs_margins write gs_margins; //空白区域
property axes_bounds read gs_axes_bounds write gs_axes_bounds; //坐标轴边界
property data_bounds read gs_data_bounds write gs_data_bounds; //数据边界
property zoom_box read gs_zoom_box write gs_zoom_box; //视图范围
//在窗口中的区域
//网格线
@ -2065,10 +2083,9 @@ type tg_axes = class(tg_base) //
end
r := sselect thisrowindex from r order by thisrow desc end;
return fface_v_indexs[r[0:2]];
end
end
end
type tg_canvas = class(TcustomCanvas)
type tg_canvas = class(TcustomCanvas) //画布对象
uses utslvclgdi;
function create(h);
begin
@ -2085,13 +2102,13 @@ type tg_canvas = class(TcustomCanvas)
_wapi.SelectClipRgn(FCvsHandle,faxesrgn.Handle); //裁剪区域
end
end
function clip_rgn(pts);
function clip_rgn(pts);//裁剪区域
begin
faxesrgntemp.points := pts;
h := faxesrgntemp.Handle;
if h then _wapi.SelectClipRgn(FCvsHandle,faxesrgntemp.Handle);
end
function axesunclip();
function axesunclip();//取消裁剪
begin
_wapi.SelectClipRgn(FCvsHandle,0);
end
@ -2150,7 +2167,7 @@ type tg_axis_main = class(tg_axis) //
private
[weakref] faxes;
end
type tg_label_axis = class(tg_label)
type tg_label_axis = class(tg_label) //坐标轴标签
public
function create(pms);
begin
@ -2160,7 +2177,7 @@ type tg_label_axis = class(tg_label)
end
published
property font_angle read ffont_angle write set_font_angle;//90
property text read ftext write set_text;
property text read ftext write set_text;
protected
function SetParent(V);override;
begin
@ -2235,8 +2252,8 @@ type tg_axis = class(tg_base) //
function executecommand(cmd,pm);override;
begin
case cmd of
"tics_recs" : return (visible=tgc_on)?ftics_recs:nil;
"label_rgn": return (flabel.visible=tgc_on)?flabel_rgn:nil;
"tics_recs" : return (visible=tgc_on)?ftics_recs:nil; //标签区域
"label_rgn": return (flabel.visible=tgc_on)?flabel_rgn:nil; //标题区域
"get_tics_value":return fxtics_coord_v;
"set_bounds": return set_zoom_bounds(pm);
"get_angleofhoriz" :
@ -2282,15 +2299,15 @@ type tg_axis = class(tg_base) //
end
published
/////////////////////////////////////
property tics_direction read ftics_direction write set_tics_direction;//= "top"
property tics_coord read fxtics_coord write set_xtics_coord ;//= [2,3,4,5,6,7]
property tics_direction read ftics_direction write set_tics_direction;//= "top" 方向
property tics_coord read fxtics_coord write set_xtics_coord ;//= [2,3,4,5,6,7] 刻度值
property ytics_coord read fytics_coord write set_ytics_coord ;//= 4
property tics_segment read ftics_segment write set_tics_segment; // true,false
property tics_color read ftics_color write set_tics_color; // -1
property tics_segment read ftics_segment write set_tics_segment; // true,false 刻度线
property tics_color read ftics_color write set_tics_color; // -1
property tics_style read ftics_style write set_tics_style; // = "v"
property sub_tics read fsub_tics write set_sub_tics; // = 2
property tics_labels read ftics_labels write set_tics_labels; // = ["2","3","4","5","6","7"]
property axis_label read flabel write flabel;
property sub_tics read fsub_tics write set_sub_tics; // = 2 子刻度数量
property tics_labels read ftics_labels write set_tics_labels; // 刻度标签 = ["2","3","4","5","6","7"]
property axis_label read flabel write flabel; //轴标签
private
flabel_rgn;
ftics_recs;
@ -2752,7 +2769,6 @@ type tg_axis = class(tg_base) //
end
end
end
type tg_text = class(tg_base)
public
function create(pms);
@ -2799,14 +2815,14 @@ type tg_text = class(tg_base)
begin
case cmd of
"text_rec": return (visible=tgc_on)? FPaintrect:nil;
"text_rgn": return (visible=tgc_on)? Frgnpoints:nil;
"text_rgn": return (visible=tgc_on)? Frgnpoints:nil; //区域
end ;
return inherited;
end
published
property text read ftext write set_text;
property data read fdata write set_data;
property font_angle read ffont_angle write set_font_angle;
property text read ftext write set_text; //一维字符串数组
property data read fdata write set_data; //位置 x.y
property font_angle read ffont_angle write set_font_angle; //角度
private
FPaintrect;
Frgnpoints;
@ -2918,10 +2934,7 @@ type tg_label =class(tg_base) //
fauto_position_value := p;
return ;
end
"label_rgn":
begin
return (visible=tgc_on)?flabel_rgn:nil;
end
"label_rgn": return (visible=tgc_on)?flabel_rgn:nil; //标签的区域
end;
return inherited;
end
@ -3046,7 +3059,7 @@ type tg_tips = class(tg_base) //
f_ps := nil;
prop_changed("fdata_idx",pm);
end
"tips_rec": return (visible=tgc_on)?FPaintrect:nil;
"tips_rec": return (visible=tgc_on)?FPaintrect:nil; //区域
end
end
function paint(cvs);override;
@ -3108,13 +3121,13 @@ type tg_tips = class(tg_base) //
end
published
//property interp_mode read finterp_mode write finterp_mode; //"on"
property location read flocation write set_location;
property location read flocation write set_location; //对应位置
property box_mode read fbox_mode write set_box_mode; //"on"
property display_components read fdisplay_components write set_display_components; //"xy"
property data_idx read fdata_idx write set_data_idx;
property data_idx read fdata_idx write set_data_idx; //对应数据序号
property display_function read fdisplay_function write fdisplay_function;
property text read get_text write set_text;
property data read get_data;
property data read get_data; //数据
private
[weakref]fdisplay_function;
flocation;
@ -3380,16 +3393,16 @@ type tg_legend = class(tg_base) //ͼ
function executecommand(cmd,p);override;
begin
case cmd of
"legend_rec":return (visible=tgc_on)? flegend_rec:nil;
"legend_sub_recs":return (visible=tgc_on)? flegend_sub_recs:nil;
"legend_rec":return (visible=tgc_on)? flegend_rec:nil; //整个图例区域
"legend_sub_recs":return (visible=tgc_on)? flegend_sub_recs:nil; //各个图像的区域
end
return inherited;
end
published
property location read flocation write set_location;
property postion read fposition write set_postion;
property links read flinks write set_links;
property text read FText write set_text;
property location read flocation write set_location; //相对位置类型
property postion read fposition write set_postion; //位置
property links read flinks write set_links; //图形
property text read FText write set_text; //图例字符串
protected
function check_parent(p);override;
begin
@ -3455,7 +3468,7 @@ type tg_legend = class(tg_base) //ͼ
lw := ws[0]+ws[1];
lh := sum(hs);
end
function set_postion(v);
function set_postion(v); //位置
begin
if fposition<>v and ifarray(v) and ifnumber(v[0]) and ifnumber(v[1]) then
begin
@ -3479,7 +3492,7 @@ type tg_legend = class(tg_base) //ͼ
end
if flg then prop_changed("text",s);
end
function set_links(vs);
function set_links(vs); //关联图
begin
if ifarray(vs) and vs<>flinks then
begin
@ -3487,7 +3500,7 @@ type tg_legend = class(tg_base) //ͼ
prop_changed("links_changed",vs);
end
end
function set_location(v);
function set_location(v); //位置类型
begin
vs := static array(tgc_in_upper_right:true,tgc_in_upper_left:true,tgc_in_lower_right:true,tgc_in_lower_left:true,
//tgc_out_upper_right,tgc_out_upper_left,tgc_out_lower_right,tgc_out_lower_left,
@ -3528,7 +3541,7 @@ type tg_graph = class(tg_graph_base) //
end
return r;
end
function get_legend_size(w,h);virtual;
function get_legend_size(w,h);virtual; //图例大小
begin
h := fontinfo.size+4;
w := 100;
@ -3541,11 +3554,11 @@ type tg_graph = class(tg_graph_base) //
begin
return fgraph_data[idx];
end
property graph_data read fgraph_data write set_graph_data;
property graph_data read fgraph_data write set_graph_data; //数据
protected
fgraph_data;//数据
protected
function prop_changed(n,v);override;
function prop_changed(n,v);override; //属性改变处理
begin
case n of
"data":
@ -3584,13 +3597,14 @@ type tg_Polyline = class(tg_graph) //
fbar_width := 0;
fdata_bounds := array((0,1),(0,1),(0,1));
end
function get_data_bounds();override;
function get_data_bounds();override; //数据边界
begin
return fdata_bounds;
end
function paint(cvs);override;
function paint(cvs);override; //绘图
begin
if tgc_on<> visible then return ;
tempbarw := 0;
if clip_state=tgc_on then
begin
//cvs.axesclip();
@ -3606,13 +3620,21 @@ type tg_Polyline = class(tg_graph) //
begin
cvs.axesunclip();
end
//echo tostn(bx);
xys := array();
set_lineinfo_to_canvas(cvs);
ys := array();
for i,v in fgraph_data do
begin
if not zoom_to_xyz(v[0],v[1],bx[2,0],x,y) then return ;
if not(tempbarw) and fbar_width>0 then ////////处理bar的宽度///////
begin
zoom_to_xyz((v[0]+fbar_width/2),v[1],bx[2,0],xtemp,ytemp);
xtemp-=x;
ytemp-=y;
tempbarw := array();
tempbarw[0] := fbar_width*(xtemp)/(abs(xtemp)+abs(ytemp));
tempbarw[1] := fbar_width*(ytemp)/(abs(xtemp)+abs(ytemp));
end
xys[i] := array(integer(x),integer(y));
case fpolyline_style of
tgc_LS_bar,tgc_LS_barplot,tgc_LS_filled:
@ -3624,7 +3646,7 @@ type tg_Polyline = class(tg_graph) //
end
fline_points_in_canvas := xys;
//zoom_to_xyz(0,0,0,x,y);
paint_lines(cvs,fpolyline_style,xys,fclosed,array("line_mode":line_mode,"bar_width":fbar_width,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor,"xy0":ys));
paint_lines(cvs,fpolyline_style,xys,fclosed,array("line_mode":line_mode,"bar_width":tempbarw,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor,"xy0":ys));
mk := markinfo.clone();
if mark_mode=tgc_on and mk.size>2 then
begin
@ -3635,11 +3657,11 @@ type tg_Polyline = class(tg_graph) //
function executecommand(cmd,p);override;
begin
case cmd of
"points_in_canvas":return (visible=tgc_on)? fline_points_in_canvas:nil;
"points_in_canvas":return (visible=tgc_on)? fline_points_in_canvas:nil; //数据散点
end;
return inherited;
end
function get_legend_size(w,h);virtual;
function get_legend_size(w,h);virtual; //获取图例大小
begin
mk := markinfo;
h := fontinfo.size+4;
@ -3656,7 +3678,7 @@ type tg_Polyline = class(tg_graph) //
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":fbar_width,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
paint_lines(cvs,tgc_LS_interpolated,xys,0,array("line_mode":line_mode,"bar_width":array(fbar_width,0),"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
mk := markinfo.clone();
if mark_mode=tgc_on and mk.size>2 then
begin
@ -3664,9 +3686,9 @@ type tg_Polyline = class(tg_graph) //
paint_marks(mk,cvs,xys);
end
end
property closed read fclosed write set_line_closed;//= "off"
property polyline_style read fpolyline_style write set_polyline_style;//= "0"
property bar_width read fbar_width write fbar_width;//= "0"
property closed read fclosed write set_line_closed;//= "off" 封闭
property polyline_style read fpolyline_style write set_polyline_style;//= "0" 线型
property bar_width read fbar_width write fbar_width;//= "0" 柱状宽度
private
fline_points_in_canvas;
fdata_bounds;
@ -3725,7 +3747,7 @@ type tg_Polyline = class(tg_graph) //
end
end
end
type tg_line_info = class(tg_const)
type tg_line_info = class(tg_const) //线型信息
function create();
begin
fcolor := 0;
@ -3813,7 +3835,7 @@ type tg_mark_info = class(tg_const) //
fforeground;
fbackground;
end
type tg_evet_conainter = class(tg_const)
type tg_evet_conainter = class(tg_const) //带消息的绘图基类
function create();
begin
fCapturelist := new tevent_list();
@ -3847,37 +3869,38 @@ type tg_base = class(TNode,tg_evet_conainter) //
fchange_locked := false;
fclip_state := tgc_on;
fvisibe := tgc_on;
fenabled := tgc_on;
fline_mode := tgc_off;
fmark_mode := tgc_off;
flineinfo := new tg_line_info();
fmarkinfo := new tg_mark_info();
ffontinfo := new tg_font_info();
end
function axes_mapping(x,y,z,_x,_y);virtual;
function axes_mapping(x,y,z,_x,_y);virtual; //
begin
p := get_axes();
if p then return p.axes_mapping(x,y,z,_x,_y);
return false;
end
function axes_unmapping(x,y,z,_x,_y);virtual;
function axes_unmapping(x,y,z,_x,_y);virtual;
begin
p := get_axes();
if p then return p.axes_unmapping(x,y,z,_x,_y);
return false;
end
function zoom_to_xyz(x,y,z,_x,_y,_z);virtual;
function zoom_to_xyz(x,y,z,_x,_y,_z);virtual; //视图坐标到数据坐标
begin
p := get_axes();
if p then return p.zoom_to_xyz(x,y,z,_x,_y,_z);
return false;
end
function xyz_to_zoom(x,y,z,x_,y_,z_);virtual;
function xyz_to_zoom(x,y,z,x_,y_,z_);virtual; //数据坐标到视图坐标
begin
p := get_axes();
if p then return p.xyz_to_zoom(x,y,z,x_,y_,z_);
return false;
end
function executecommand(cmd,pm);virtual;
function executecommand(cmd,pm);virtual; //执行操作
begin
end
@ -3890,12 +3913,12 @@ type tg_base = class(TNode,tg_evet_conainter) //
vi.paint(cvs);
end
end
function hit_at(info):bool;
function hit_at(info):bool; //命中处理,鼠标信息
begin
if fonhit_at then return call(fonhit_at,self(true),info) ;
return false;
end
function set_lineinfo_to_canvas(cvs,info);
function set_lineinfo_to_canvas(cvs,info); //设置线条信息到画布
begin
if info is class(tg_line_info) then li := info;
else
@ -3921,7 +3944,7 @@ type tg_base = class(TNode,tg_evet_conainter) //
cvs.brush.Style := tgc_BS_NULL;
end
end
function set_fontinfo_to_canvas(cvs,info);
function set_fontinfo_to_canvas(cvs,info); //设置字体信息到画布
begin
if info is class(tg_font_info) then fi := info;
else
@ -3947,13 +3970,28 @@ type tg_base = class(TNode,tg_evet_conainter) //
end
if not p then return 0;
return p.dispatchEvent(evt,tg);
end
end
function invalidate(); //刷新
begin
if fchange_locked then return ;
axs := get_axes();
if axs then
begin
if axs.change_locked then return ;
fg := axs.figure;
end
if fg then
begin
fg.executecommand("figure_need_fresh",p);
end
end
published
property line_mode read fline_mode write set_line_mode;
property mark_mode read fmark_mode write set_mark_mode;
property clip_state read fclip_state write set_clip_state;
property axes read get_axes write set_axes;
property visible read fvisibe write setvisible;
property enabled read fenabled write setenabled;
property lineinfo read flineinfo;
property markinfo read fmarkinfo;
property fontinfo read ffontinfo;
@ -3977,17 +4015,7 @@ type tg_base = class(TNode,tg_evet_conainter) //
end
function prop_changed(n,v);virtual; //改变通知
begin
if fchange_locked then return ;
axs := get_axes();
if axs then
begin
if axs.change_locked then return ;
fg := axs.figure;
end
if fg then
begin
fg.executecommand("figure_need_fresh",p);
end
invalidate();
end
function SetParent(V);virtual;
begin
@ -4008,6 +4036,7 @@ type tg_base = class(TNode,tg_evet_conainter) //
fline_mode;
fmark_mode;
fvisibe;
fenabled;
flineinfo;
fmarkinfo;
ffontinfo;
@ -4035,7 +4064,15 @@ type tg_base = class(TNode,tg_evet_conainter) //
fmark_mode := nv;
prop_changed("mark_mode",nv);
end
end
end
function setenabled(v);
begin
if tg_boolen_value(v,nv) and (nv<>fenabled) then
begin
fenabled := nv;
//prop_changed("enabled",fvisibe);
end
end
function setvisible(v);//设置可见
begin
if tg_boolen_value(v,nv) and (nv<>fvisibe) then
@ -4121,6 +4158,7 @@ type tg_const = class()
//static const tgc_out_lower_left = "out_lower_left";
//////////////
static evt_mouse_down = "mouse_down";
static evt_mouse_wheel = "mouse_wheel";
static evt_mouse_move = "mouse_move";
static evt_mouse_in = "mouse_in";
static evt_mouse_out = "mouse_out";
@ -4220,21 +4258,28 @@ type tg_evt_mouse = class(tg_evt_custom) //
fcvsx := pms["cvsx"];
fcvsy := pms["cvsy"];
fdouble := pms["double"];
fbutton := pms["button"];
fshift := pms["shift"];
fctl := pms["ctrl"];
fctl := pms["fdelta"];
end
end
property cvsx read fcvsx;
property cvsy read fcvsy;
property shift read fshift;
property double read fdouble;
property shift read fshift;
property ctrl read fctrl;
property delta read fdelta;
property double read fdouble;
property button read fbutton;
private
fdelta;
fcvsx;
fcvsy;
fshift;
fdouble;
fctrl;
fbutton;
end
implementation
@ -4316,6 +4361,7 @@ end
function node_hit_at(nd,info); //命中处理
begin
if (nd.visible=nd.tgc_off) then return 0;
if (nd.enabled=nd.tgc_off) then return 0;
nct := nd.NodeCount;
if nct>0 then
begin
@ -4375,16 +4421,17 @@ begin
end
o.tgc_LS_bar:
begin
b_w := integer(ifo["bar_width"]/2);
b_w_x := integer(ifo["bar_width"][0]/2);
b_w_y := integer(ifo["bar_width"][1]/2);
cvs.brush.color := ifo["bkcolor"];
for i,v in xys do
begin
if b_w>=1 then
if b_w_x>=1 or b_w_y>1 then
begin
v1 := array(v[0]-b_w,v[1]);
v2 := array(v[0]+b_w,v[1]);
v3 := array(ifo["xy0",i,0]+b_w,ifo["xy0",i,1]);
v4 := array(ifo["xy0",i,0]-b_w,ifo["xy0",i,1]);
v1 := array(v[0]-b_w_x,v[1]-b_w_y);
v2 := array(v[0]+b_w_x,v[1]+b_w_y);
v3 := array(ifo["xy0",i,0]+b_w_x,ifo["xy0",i,1]+b_w_y);
v4 := array(ifo["xy0",i,0]-b_w_x,ifo["xy0",i,1]-b_w_y);
cvs.draw_polygon().points(array(v1,v2,v3,v4)).draw();
end else
begin

Binary file not shown.