编辑器

修正新建文件夹可能出现的问题
This commit is contained in:
tslediter 2024-06-27 14:51:47 +08:00
parent d46e01f8fb
commit 7b9c9ae25e
5 changed files with 153 additions and 109 deletions

View File

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

View File

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

View File

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

View File

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

Binary file not shown.