Compare commits

..

No commits in common. "59b47c712229f83fffc4ce164809cc970650e357" and "d46e01f8fbc7d0ffdb6f6e70df8a07ef97269709" have entirely different histories.

7 changed files with 122 additions and 179 deletions

View File

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

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_set_data(cr,nil); _Wapi.g_object_get_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,9 +8576,6 @@ 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,16 +3961,13 @@ begin
end end
end end
if not ffname then exit; if not ffname then exit;
ffL := length(ffname); nct := 4;
{$ifdef linux} {$ifdef linux}
nct := 1; nct := 1;
if ffL<1 then exit;
{$else}
nct := 4;
if ffL<4 then exit;
{$endif} {$endif}
if length(ffname)<1 then exit;
ph := ffname[1:nct]; ph := ffname[1:nct];
for i := nct+1 to ffL do for i := nct+1 to length(ffname) do
begin begin
vi := ffname[i]; vi := ffname[i];
if vi=iofp then if vi=iofp then

View File

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

View File

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

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,evt_mouse_up); d := e_2_array(e);
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,evt_mouse_down); d := e_2_array(e);
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,21 +584,16 @@ 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,evt_mouse_move); d := e_2_array(e);
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
p := ScreenToClient(e.xpos,e.ypos); ffigure.executecommand(cmd_zoom_inc,array("delta":e.delta,"x":p[0],"y":p[1]));
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;
@ -620,14 +615,13 @@ 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,tp); function e_2_array(e);
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,
@ -643,7 +637,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;
@ -665,23 +659,12 @@ type tg_figure = class(tg_evet_conainter) //
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
if 1 = v.executecommand(cmd_zoom_inc,p) then continue; v.executecommand(cmd_zoom_inc,p);
else r := true; //经过了默认
end end
return r;
end end
evt_mouse_move: evt_mouse_move:
begin begin
@ -862,7 +845,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 or evt.defaultPrevented; //是否停止 return evt.stoppropagationed;
end end
private private
[weakref] frect_getter; [weakref] frect_getter;
@ -892,25 +875,24 @@ 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:
begin begin
if not ifarray(pm) then return ; if not ifarray(pm) then return ;
p0 := pm["cvsx"]; p0 := pm["x"];
p1 := pm["cvsy"]; p1 := pm["y"];
for i := 0 to 2 do for i := 0 to 2 do
begin begin
a0 := fzoom_box[i,0]; a0 := fzoom_box[i,0];
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
return true; continue;
//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));
@ -968,7 +950,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); //视图到xyz function zoom_to_xyz(x,y,z,_x,_y,_z); //----------
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];
@ -984,7 +966,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); //xyz到视图 function xyz_to_zoom(x,y,z,_x,_y,_z);
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;
@ -1230,25 +1212,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;
//在窗口中的区域 //在窗口中的区域
//网格线 //网格线
@ -2084,8 +2066,9 @@ type tg_axes = class(tg_base) //
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
@ -2102,13 +2085,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
@ -2167,7 +2150,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
@ -2252,8 +2235,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" :
@ -2299,15 +2282,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;
@ -2769,6 +2752,7 @@ 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);
@ -2815,14 +2799,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; //位置 x.y property data read fdata write set_data;
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;
@ -2934,7 +2918,10 @@ type tg_label =class(tg_base) //
fauto_position_value := p; fauto_position_value := p;
return ; return ;
end end
"label_rgn": return (visible=tgc_on)?flabel_rgn:nil; //标签的区域 "label_rgn":
begin
return (visible=tgc_on)?flabel_rgn:nil;
end
end; end;
return inherited; return inherited;
end end
@ -3059,7 +3046,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;
@ -3121,13 +3108,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;
@ -3393,16 +3380,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
@ -3468,7 +3455,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
@ -3492,7 +3479,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
@ -3500,7 +3487,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,
@ -3541,7 +3528,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;
@ -3554,11 +3541,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":
@ -3597,14 +3584,13 @@ 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 ;
tempbarw := 0;
if clip_state=tgc_on then if clip_state=tgc_on then
begin begin
//cvs.axesclip(); //cvs.axesclip();
@ -3620,21 +3606,13 @@ type tg_Polyline = class(tg_graph) //
begin begin
cvs.axesunclip(); cvs.axesunclip();
end end
//echo tostn(bx);
xys := array(); xys := array();
set_lineinfo_to_canvas(cvs); set_lineinfo_to_canvas(cvs);
ys := array(); ys := array();
for i,v in fgraph_data do for i,v in fgraph_data do
begin begin
if not zoom_to_xyz(v[0],v[1],bx[2,0],x,y) then return ; 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)); xys[i] := array(integer(x),integer(y));
case fpolyline_style of case fpolyline_style of
tgc_LS_bar,tgc_LS_barplot,tgc_LS_filled: tgc_LS_bar,tgc_LS_barplot,tgc_LS_filled:
@ -3646,7 +3624,7 @@ type tg_Polyline = class(tg_graph) //
end end
fline_points_in_canvas := xys; fline_points_in_canvas := xys;
//zoom_to_xyz(0,0,0,x,y); //zoom_to_xyz(0,0,0,x,y);
paint_lines(cvs,fpolyline_style,xys,fclosed,array("line_mode":line_mode,"bar_width":tempbarw,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor,"xy0":ys)); paint_lines(cvs,fpolyline_style,xys,fclosed,array("line_mode":line_mode,"bar_width":fbar_width,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor,"xy0":ys));
mk := markinfo.clone(); mk := markinfo.clone();
if mark_mode=tgc_on and mk.size>2 then if mark_mode=tgc_on and mk.size>2 then
begin begin
@ -3657,11 +3635,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;
@ -3678,7 +3656,7 @@ type tg_Polyline = class(tg_graph) //
dis := ceil((rec[2]-rec[0])/5); dis := ceil((rec[2]-rec[0])/5);
xys := array((rec[0]+dis,y0),(rec[0]+4*dis,y0)); xys := array((rec[0]+dis,y0),(rec[0]+4*dis,y0));
set_lineinfo_to_canvas(cvs); set_lineinfo_to_canvas(cvs);
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)); paint_lines(cvs,tgc_LS_interpolated,xys,0,array("line_mode":line_mode,"bar_width":fbar_width,"color":lineinfo.color,"bkcolor":lineinfo.bkcolor));
mk := markinfo.clone(); mk := markinfo.clone();
if mark_mode=tgc_on and mk.size>2 then if mark_mode=tgc_on and mk.size>2 then
begin begin
@ -3686,9 +3664,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;
@ -3747,7 +3725,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;
@ -3835,7 +3813,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();
@ -3869,14 +3847,13 @@ 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);
@ -3888,19 +3865,19 @@ type tg_base = class(TNode,tg_evet_conainter) //
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
@ -3913,12 +3890,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
@ -3944,7 +3921,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
@ -3971,27 +3948,12 @@ type tg_base = class(TNode,tg_evet_conainter) //
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;
@ -4015,7 +3977,17 @@ type tg_base = class(TNode,tg_evet_conainter) //
end end
function prop_changed(n,v);virtual; //改变通知 function prop_changed(n,v);virtual; //改变通知
begin begin
invalidate(); 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 end
function SetParent(V);virtual; function SetParent(V);virtual;
begin begin
@ -4036,7 +4008,6 @@ 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;
@ -4065,14 +4036,6 @@ type tg_base = class(TNode,tg_evet_conainter) //
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
@ -4158,7 +4121,6 @@ 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";
@ -4258,28 +4220,21 @@ 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 ctrl read fctrl;
property delta read fdelta;
property double read fdouble; property double read fdouble;
property button read fbutton; property ctrl read fctrl;
private private
fdelta;
fcvsx; fcvsx;
fcvsy; fcvsy;
fshift; fshift;
fdouble; fdouble;
fctrl; fctrl;
fbutton;
end end
implementation implementation
@ -4361,7 +4316,6 @@ 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
@ -4421,17 +4375,16 @@ begin
end end
o.tgc_LS_bar: o.tgc_LS_bar:
begin begin
b_w_x := integer(ifo["bar_width"][0]/2); b_w := integer(ifo["bar_width"]/2);
b_w_y := integer(ifo["bar_width"][1]/2);
cvs.brush.color := ifo["bkcolor"]; cvs.brush.color := ifo["bkcolor"];
for i,v in xys do for i,v in xys do
begin begin
if b_w_x>=1 or b_w_y>1 then if b_w>=1 then
begin begin
v1 := array(v[0]-b_w_x,v[1]-b_w_y); v1 := array(v[0]-b_w,v[1]);
v2 := array(v[0]+b_w_x,v[1]+b_w_y); v2 := array(v[0]+b_w,v[1]);
v3 := array(ifo["xy0",i,0]+b_w_x,ifo["xy0",i,1]+b_w_y); v3 := array(ifo["xy0",i,0]+b_w,ifo["xy0",i,1]);
v4 := array(ifo["xy0",i,0]-b_w_x,ifo["xy0",i,1]-b_w_y); v4 := array(ifo["xy0",i,0]-b_w,ifo["xy0",i,1]);
cvs.draw_polygon().points(array(v1,v2,v3,v4)).draw(); cvs.draw_polygon().points(array(v1,v2,v3,v4)).draw();
end else end else
begin begin

Binary file not shown.