3 * sushivision copyright (C) 2005-2007 Monty <monty@xiph.org>
5 * sushivision is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * sushivision is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with sushivision; see the file COPYING. If not, write to the
17 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <glib-object.h>
26 #include <sys/types.h>
31 #define PLOT_TYPE (_sv_plot_get_type ())
32 #define PLOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLOT_TYPE, _sv_plot_t))
33 #define PLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLOT_TYPE, _sv_plot_class_t))
34 #define IS_PLOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLOT_TYPE))
35 #define IS_PLOT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLOT_TYPE))
37 typedef struct _sv_plot _sv_plot_t
;
38 typedef struct _sv_plot_class _sv_plot_class_t
;
43 cairo_surface_t
*back
;
44 cairo_surface_t
*fore
;
45 cairo_surface_t
*stage
;
70 void (*box_callback
)(void *,int);
75 void (*recompute_callback
)(void *);
77 void (*crosshairs_callback
)(void *);
80 u_int32_t
*legend_colors
;
86 struct _sv_plot_class
{
87 GtkWidgetClass parent_class
;
88 void (*plot
) (_sv_plot_t
*m
);
91 GType
_sv_plot_get_type (void);
92 _sv_plot_t
*_sv_plot_new (void (*callback
)(void *),void *app_data
,
93 void (*cross_callback
)(void *),void *cross_data
,
94 void (*box_callback
)(void *,int),void *box_data
,
99 // the widget subclass half
100 int _sv_plot_print(_sv_plot_t
*p
, cairo_t
*c
, double page_h
, void (*datarender
)(void *data
,cairo_t
*c
), void *data
);
101 void _sv_plot_set_bg_invert(_sv_plot_t
*p
, int setp
);
102 void _sv_plot_expose_request(_sv_plot_t
*p
);
103 void _sv_plot_expose_request_partial(_sv_plot_t
*p
,int x
, int y
, int w
, int h
);
104 void _sv_plot_set_x_scale(_sv_plot_t
*p
, _sv_scalespace_t x
);
105 void _sv_plot_set_y_scale(_sv_plot_t
*p
, _sv_scalespace_t y
);
106 void _sv_plot_set_x_name(_sv_plot_t
*p
, char *name
);
107 void _sv_plot_set_y_name(_sv_plot_t
*p
, char *name
);
108 u_int32_t
* _sv_plot_get_background_line(_sv_plot_t
*p
, int num
);
109 cairo_t
*_sv_plot_get_background_cairo(_sv_plot_t
*p
);
110 void _sv_plot_set_crosshairs(_sv_plot_t
*p
, double x
, double y
);
111 void _sv_plot_set_crosshairs_snap(_sv_plot_t
*p
, double x
, double y
);
112 void _sv_plot_snap_crosshairs(_sv_plot_t
*p
);
113 void _sv_plot_draw_scales(_sv_plot_t
*p
);
114 void _sv_plot_unset_box(_sv_plot_t
*p
);
115 void _sv_plot_box_vals(_sv_plot_t
*p
, double ret
[4]);
116 void _sv_plot_box_set(_sv_plot_t
*p
, double vals
[4]);
117 void _sv_plot_legend_add(_sv_plot_t
*p
, char *entry
);
118 void _sv_plot_legend_add_with_color(_sv_plot_t
*p
, char *entry
, u_int32_t color
);
119 void _sv_plot_legend_clear(_sv_plot_t
*p
);
120 int _sv_plot_get_crosshair_xpixel(_sv_plot_t
*p
);
121 int _sv_plot_get_crosshair_ypixel(_sv_plot_t
*p
);
122 void _sv_plot_set_grid(_sv_plot_t
*p
, int mode
);
124 void _sv_plot_do_enter(_sv_plot_t
*p
);
125 void _sv_plot_set_crossactive(_sv_plot_t
*p
, int active
);
126 void _sv_plot_toggle_legend(_sv_plot_t
*p
);
127 void _sv_plot_set_legendactive(_sv_plot_t
*p
, int active
);
129 void _sv_plot_resizable(_sv_plot_t
*p
, int rp
);
131 #define _SV_PLOT_NO_X_CROSS 1
132 #define _SV_PLOT_NO_Y_CROSS 2
134 #define _SV_PLOT_GRID_NONE 0
135 #define _SV_PLOT_GRID_NORMAL 4
136 #define _SV_PLOT_GRID_TICS 8
137 #define _SV_PLOT_GRID_LIGHT (256+4)
138 #define _SV_PLOT_GRID_DARK (512+4)
140 #define _SV_PLOT_GRID_MODEMASK 0x00fc
141 #define _SV_PLOT_GRID_COLORMASK 0x0f00
143 #define _SV_PLOT_TEXT_DARK 0
144 #define _SV_PLOT_TEXT_LIGHT 1
146 #define _SV_PLOT_LEGEND_NONE 0
147 #define _SV_PLOT_LEGEND_SHADOW 1
148 #define _SV_PLOT_LEGEND_BOX 2