File: display.h

package info (click to toggle)
ggobi 2.1.9~20091212-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 19,340 kB
  • ctags: 5,083
  • sloc: ansic: 57,242; xml: 30,604; cpp: 833; makefile: 355; java: 225; perl: 201; sh: 122; python: 23
file content (354 lines) | stat: -rw-r--r-- 11,669 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
/*-- display.h --*/
/*
 * ggobi
 * Copyright (C) AT&T, Duncan Temple Lang, Dianne Cook 1999-2005
 *
 * ggobi is free software; you may use, redistribute, and/or modify it
 * under the terms of the Common Public License, which is distributed
 * with the source code and displayed on the ggobi web site, 
 * www.ggobi.org.  For more information, contact the authors:
 *
 *   Deborah F. Swayne   dfs@research.att.com
 *   Di Cook             dicook@iastate.edu
 *   Duncan Temple Lang  duncan@wald.ucdavis.edu
 *   Andreas Buja        andreas.buja@wharton.upenn.edu
*/

#ifndef DISPLAY_H
#define DISPLAY_H

#include "defines.h"
#include "cpanel.h"
#include "splot.h"
#include "ggobi-data.h"

#include "ggobi.h"

#ifdef __cplusplus
extern "C" {
#endif

struct _ggobid; 


#define GGOBI_TYPE_DISPLAY	 (ggobi_display_get_type ())
#define GGOBI_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGOBI_TYPE_DISPLAY, displayd))
#define GGOBI_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGOBI_TYPE_DISPLAY, GGobiDisplayClass))
#define GGOBI_IS_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGOBI_TYPE_DISPLAY))
#define GGOBI_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGOBI_TYPE_DISPLAY))
#define GGOBI_DISPLAY_GET_CLASS(obj)  		(G_TYPE_INSTANCE_GET_CLASS ((obj), GGOBI_TYPE_DISPLAY, GGobiDisplayClass))

GType ggobi_display_get_type();

enum { TOUR_STEP_SIGNAL, 
       MAX_GGOBI_DISPLAY_SIGNALS};


typedef struct _GGobiDisplayClass
{
  GtkVBoxClass parent_class;
  guint signals[MAX_GGOBI_DISPLAY_SIGNALS];

} GGobiDisplayClass;

/**

 */
struct _displayd {
  GtkVBox vbox;

/*
 * Used by all displays
*/

 GtkWidget *menubar;
 GtkUIManager *menu_manager;
 guint imode_merge_id, pmode_merge_id;
 
 /*-- for scatterplots, where edge menus need to be rebuilt on the fly --*/
 guint edge_merge, edge_option_merge;
 GtkActionGroup *edgeset_action_group;

 cpaneld cpanel;

 GList *splots;          /*-- doubly linked list of splots --*/
 splotd *current_splot;  /*-- multi-plot displays need this notion --*/

 GGobiData *d;  /*-- pointer to a particular gg->d[] --*/
 GGobiData *e;  /*-- pointer to a particular gg->d[] --*/

 /*-- --*/

/*
 * Actually, this might need to be a pair of vectors
 * or linked lists, corresponding to the number of plots in
 * the display.  But let's be lazy for the moment.
*/
 GtkWidget *hrule, *vrule;

 DisplayOptions options;

/*
 * For an individual scatterplot
*/
  fcoords drag_start;

/*
 * Scatterplot matrix display
*/
 GtkWidget *table;

/*
 * Parallel coordinates display
*/
  gint p1d_orientation;

/*
 * Manipulation Vars
*/
  array_d tc1_manbasis, tc2_manbasis, t1d_manbasis;
  gint tc1_manip_var, tc2_manip_var, t1d_manip_var;
  gint tc1_pos_old, tc1_pos, tc2_pos_old, tc2_pos, t1d_pos_old, t1d_pos;
  /*gint tc_manip_mode;*/
  gboolean tc1_manipvar_inc, tc2_manipvar_inc, t1d_manipvar_inc;
  gfloat tc1_phi, tc2_phi, t1d_phi;

  gint t2d_manip_var, t2d_manipvar_inc;
  gint t2d_pos1_old, t2d_pos1, t2d_pos2_old, t2d_pos2;
  /*gint t2d_manip_mode;*/
  array_d t2d_Rmat1, t2d_Rmat2;
  array_d t2d_manbasis;
  array_d t2d_mvar_3dbasis;
  gboolean t2d_no_dir_flag;
  gfloat t2d_rx, t2d_ry;

/*-- 1d tour --*/
 tour t1d;
 gboolean t1d_axes;
 gboolean t1d_video;

/*-- rotation: 2d tour, constrained to 3 variables --*/
 tour t2d3;
 gboolean t2d3_axes;
 gint t2d3_manip_var;
 array_d t2d3_manbasis, t2d3_mvar_3dbasis;
 array_d t2d3_Rmat1, t2d3_Rmat2;
 gint t2d3_pos1_old, t2d3_pos1, t2d3_pos2_old, t2d3_pos2;
 gfloat t2d3_rx, t2d3_ry;
 gboolean t2d3_no_dir_flag;
 gboolean t2d3_manipvar_inc;

/*-- 2d tour --*/
 tour t2d;
 gboolean t2d_axes;
 gboolean t2d_video;

/*-- corr tour --*/
 tour tcorr1, tcorr2;
 gboolean tcorr_axes;
 gboolean tourcorr_video;

/* projection pursuit */
 GtkWidget *t1d_pplabel, *t2d_pplabel;
 GtkWidget *t1d_ppda, *t2d_ppda;
 GdkPixmap *t1d_pp_pixmap, *t2d_pp_pixmap;
 GtkWidget *t1d_window, *t2d_window;
 GtkWidget *t1d_control_frame, *t2d_control_frame;
 GtkWidget *t1d_mbar, *t2d_mbar;
 GtkAccelGroup *t1d_pp_accel_group, *t2d_pp_accel_group;
 optimize0_param t1d_pp_op, t2d_pp_op;
 pp_param t1d_pp_param, t2d_pp_param;
 gfloat t2d_ppindx_mat[100], t1d_ppindx_mat[100];
 gfloat t2d_indx_min, t2d_indx_max, t1d_indx_min, t1d_indx_max;
 gint t2d_ppindx_count, t1d_ppindx_count;

 struct _ggobid *ggobi;

};  /* displayd; */




#define GGOBI_TYPE_EMBEDDED_DISPLAY	 (ggobi_embedded_display_get_type ())
#define GGOBI_EMBEDDED_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGOBI_TYPE_EMBEDDED_DISPLAY, displayd))
#define GGOBI_EMBEDDED_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGOBI_TYPE_EMBEDDED_DISPLAY, GGobiEmbeddedDisplayClass))
#define GGOBI_IS_EMBEDDED_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGOBI_TYPE_EMBEDDED_DISPLAY))
#define GGOBI_IS_EMBEDDED_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGOBI_TYPE_EMBEDDED_DISPLAY))
#define GGOBI_EMBEDDED_DISPLAY_GET_CLASS(obj)  		(G_TYPE_INSTANCE_GET_CLASS ((obj), GGOBI_TYPE_EMBEDDED_DISPLAY, GGobiEmbeddedDisplayClass))

GType ggobi_embedded_display_get_type();

typedef struct _GGobiEmbeddedDisplayClass
{
    GGobiDisplayClass parent_class;

} GGobiEmbeddedDisplayClass;

typedef struct _embeddedDisplayd {
   displayd display;
} embeddedDisplayd;





#define GGOBI_TYPE_WINDOW_DISPLAY	 (ggobi_window_display_get_type ())
#define GGOBI_WINDOW_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGOBI_TYPE_WINDOW_DISPLAY, windowDisplayd))
#define GGOBI_WINDOW_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGOBI_TYPE_WINDOW_DISPLAY, GGobiWindowDisplayClass))
#define GGOBI_IS_WINDOW_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGOBI_TYPE_WINDOW_DISPLAY))
#define GGOBI_IS_WINDOW_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGOBI_TYPE_WINDOW_DISPLAY))
#define GGOBI_WINDOW_DISPLAY_GET_CLASS(obj)  		(G_TYPE_INSTANCE_GET_CLASS ((obj), GGOBI_TYPE_WINDOW_DISPLAY, GGobiWindowDisplayClass))

GType ggobi_window_display_get_type();
displayd *ggobi_window_display_new(gint type, gboolean missing_p, GGobiData *d, ggobid *gg);

typedef struct 
{
    GGobiDisplayClass parent_class;

} GGobiWindowDisplayClass;


typedef struct _windowDisplayd {
 displayd dpy;

 GtkWidget *window;
 gboolean useWindow;

} windowDisplayd;

gboolean isEmbeddedDisplay(displayd *dpy);



/**
 This is used as a trivial class for its type information so that we
 can detect whether we have one of the new style classes.  We might
 remove it when we are finished the construction.
*/

#define GGOBI_TYPE_EXTENDED_DISPLAY	 (ggobi_extended_display_get_type ())
#define GGOBI_EXTENDED_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGOBI_TYPE_EXTENDED_DISPLAY, extendedDisplayd))
#define GGOBI_EXTENDED_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGOBI_TYPE_EXTENDED_DISPLAY, GGobiExtendedDisplayClass))
#define GGOBI_IS_EXTENDED_DISPLAY(obj)	 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGOBI_TYPE_EXTENDED_DISPLAY))
#define GGOBI_IS_EXTENDED_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGOBI_TYPE_EXTENDED_DISPLAY))
#define GGOBI_EXTENDED_DISPLAY_GET_CLASS(obj)  		(G_TYPE_INSTANCE_GET_CLASS ((obj), GGOBI_TYPE_EXTENDED_DISPLAY, GGobiExtendedDisplayClass))

GType ggobi_extended_display_get_type();

typedef struct 
{
    GGobiWindowDisplayClass parent_class;

    gboolean supports_edges_p;  /* only true for scatterplots? */
    gboolean show_edges_p; /* used in splot_draw_to_pixmap0_unbinned by scatmat and scatterplot (only) */

    gboolean binning_ok; /* see binning_permitted in brush.c */
    gboolean (*binningPermitted)(displayd *dpy);

    gboolean allow_reorientation; /* see p1d_varsel for changing vertical/horizontal orientation */
    gboolean options_menu_p; /* whether this supports an option menu in the control panel. Default is yes! */


    gboolean loop_over_points; 	/* See splot_draw_to_pixmap0_unbinned. */


    gchar * treeLabel;
    gchar const * (*tree_label)(displayd *dpy);

    gchar * titleLabel;
    gchar const *  (*title_label)(displayd *dpy);

    displayd *(*create)(gboolean use_window, gboolean missing_p, splotd *sp, GGobiData *d, ggobid *gg);
    displayd *(*createWithVars)(gboolean use_window, gboolean missing_p, gint nvars, gint *vars, GGobiData *d, ggobid *gg);

    gboolean (*variable_select)(GtkWidget *, displayd *, splotd *, gint jvar, gint toggle, gint mouse, cpaneld *cpanel, ggobid *gg);

    gint  (*variable_plotted_p)(displayd *dpy, gint *cols, gint ncols, GGobiData *d);

    gboolean (*cpanel_set)(displayd *dpy, cpaneld *cp, ggobid *gg);

	const gchar *(*mode_ui_get)(displayd *dpy);
	
    void (*display_unset)(displayd *dpy);
    void (*display_set)(displayd *dpy, ggobid *gg);

    gboolean (*build_symbol_vectors)(cpaneld *, GGobiData *, ggobid *);

    void (*ruler_ranges_set)(gboolean, displayd *, splotd *, ggobid *);

    void (*varpanel_refresh)(displayd *dpy, splotd *sp, GGobiData *d);

  gboolean (*handles_projection)(displayd *dpy, ProjectionMode);
  gboolean (*handles_interaction)(displayd *dpy, InteractionMode);

	/* Probably should arrange for displayd to come first and no need to pass the splots. */
    void (*xml_describe)(xmlNodePtr node, GList *splots, displayd *dpy);

    void (*varpanel_tooltips_set)(displayd *dpy, ggobid *gg, GtkWidget *wx, GtkWidget *wy, GtkWidget *wz, GtkWidget *label);

    gint (*plotted_vars_get)(displayd *display, gint *cols, GGobiData *d, ggobid *gg);

    GtkWidget *(*imode_control_box)(displayd *, gchar **modeName, ggobid *gg);

  GtkWidget *(*menus_make)(displayd *dpy, ggobid *gg);

  gboolean (*event_handlers_toggle)(displayd *dpy, splotd *sp, gboolean state, ProjectionMode, InteractionMode);

    gint (*splot_key_event_handler)(displayd *dpy, splotd *sp, gint keval);
  /* new - dfs */
  gint (*splot_key_event_handled)(GtkWidget *, displayd *, splotd *, GdkEventKey *, ggobid *);

    void (*add_plot_labels)(displayd *dpy, splotd *sp, GdkDrawable *, GGobiData *, ggobid *);

  gboolean (*varpanel_highd)(displayd *dpy);

  void (*move_points_motion_cb)(displayd *, splotd *, GtkWidget *w, GdkEventMotion *event, ggobid *);
  void (*move_points_button_cb)(displayd *, splotd *, GtkWidget *w, GdkEventButton *event, ggobid *);

/* XXX duncan and dfs: you need to sort this out
    void (*world_to_raw)(displayd *, splotd *, gint, GGobiData *, ggobid *);
*/

  /* time will tell which of these we need -- dfs */
  void (*viewmode_set)(displayd *, ggobid *);
  void (*pmode_set)(ProjectionMode, displayd *, ggobid *);
  /* */

  gboolean (*varcircle_draw)(displayd *, gint jvar, GdkPixmap *da_pix, ggobid *gg);
  void (*select_X)(GtkWidget *, displayd *, gint, ggobid *);

  void (*tour1d_realloc)(displayd *, gint, GGobiData *);
  void (*tour2d3_realloc)(displayd *, gint, GGobiData *);
  void (*tour2d_realloc)(displayd *, gint, GGobiData *);
  void (*tourcorr_realloc)(displayd *, gint, GGobiData *);

  void (*set_show_axes_option)(displayd *, gboolean);
  void (*set_show_axes_label_option)(displayd *, gboolean);
  void (*set_show_axes_values_option)(displayd *, gboolean);

} GGobiExtendedDisplayClass;


typedef struct {
   windowDisplayd dpy;
   gchar * titleLabel;
   GtkWidget *cpanelWidget;
} extendedDisplayd;

void display_set_values(displayd *display, GGobiData *d, ggobid *gg);

/* These functions are no longer const, because this is dangerous, given
   that the input is a pointer and the data it points to could change,
   fooling the compiler - mfl */
const gchar * /*const*/ ggobi_display_tree_label(displayd *dpy);
const gchar * /*const*/ ggobi_display_title_label(displayd *dpy);


displayd *ggobi_display_new(gboolean missing_p, GGobiData *d, ggobid *gg);

#ifdef __cplusplus
} /* end of extern "C" */
#endif

#endif