File: ggobi.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 (634 lines) | stat: -rw-r--r-- 16,554 bytes parent folder | download | duplicates (4)
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
/*-- ggobi.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 GGOBI_H
#define GGOBI_H

#ifdef WIN32
#define GGOBI_EXPORT __declspec(dllexport)
#else
#define GGOBI_EXPORT 
#endif


#ifdef __cplusplus
extern "C" {
#endif

struct _ggobid;

#include <libxml/parser.h>
#include "defines.h"
#include "types.h"
#include "brushing.h"
#include "display.h"
#include "display_tree.h"
#include "read_init.h"

#include "fileio.h"

#include "colorscheme.h"

/*
 These are hooks for other applications (e.g. R) to 
 facilitate callbacks at a higher level that GTK events/signals.
 This one is used for responding to identifying points.
 */
typedef void (*IdentifyProc) (void *user_data, gint id, splotd * sp,
                              GtkWidget * w, ggobid * gg);

typedef struct {
  IdentifyProc handler;
  void *user_data;
} IdentifyHandler;


/*
 This is a typedef that is used for registering a routine for handling
 presses of the numbered keys 0, 1, ..., 9.
 It gets the events from the regular event handler and also the key identifier.
 See scatterplot_event_handled() in splot.c.
 The idea is that people can register routines in a programming
 language interface to ggobi such as Rggobi, or the Perl or Python
 interfaces, and provide customized callbacks/handlers for the
 numbered keys.
 Note that if you register a handler for any of these keys, you have to handle
 them all (i.e. 0, ..., 9).  You can discard the ones you are not interested in.
 In the future, we may set it up so that one can refuse to handle an event
 and return false and have the scatterplot_event_handled() then process it
 in the default way. Also, one can register an intermediate handler which 
 looks up a table for key-specific handlers for each the 0, .., 9 keys.
 Then one could register that function with the general ggobi mechanism
 and provide an interface
 */
typedef gboolean(*KeyEventHandlerFunc) (guint keyval, GtkWidget * w,
                                        GdkEventKey * event,
                                        cpaneld * cpanel, splotd * sp,
                                        ggobid * gg, void *userData);

typedef void (*ReleaseData) (void *userData);
  /* This is the variable that stores the registered handler */
typedef struct {
  KeyEventHandlerFunc handlerRoutine;
  void *userData;
  char *description;
  ReleaseData *releaseData;
  ProgrammingLanguage language;
} KeyEventHandler;


typedef struct {
/*-- ggobi --*/

  struct _ggobid *thisGG;

  GtkAccelGroup *sp_accel_group; /*-- sp = scatterplot here --*/

} GGobiMenus;

typedef struct _PrintOptions PrintOptions;



GType ggobi_ggobi_get_type(void);

#define   GGOBI_TYPE_GGOBI ggobi_ggobi_get_type()
#define GGOBI_GGOBI(obj)	 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GGOBI_TYPE_GGOBI, ggobid))
#define GGOBI_GGOBI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GGOBI_TYPE_GGOBI, GGobiGGobiClass))
#define GGOBI_IS_GGOBI(obj)	 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GGOBI_TYPE_GGOBI))
#define GGOBI_IS_GGOBI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GGOBI_TYPE_GGOBI))
#define GGOBI_GGOBI_GET_CLASS(obj)  		(G_TYPE_INSTANCE_GET_CLASS ((obj), GGOBI_TYPE_GGOBI, GGobiGGobiClass))

typedef struct _GGobiGGobiClass {
  GObjectClass parent_class;
} GGobiGGobiClass;


/**
  @defgroup ggobid the ggobid instance structure.
  @brief This is the top-level structure representing a 
  ggobi instance.
 */
struct _ggobid {

  GObject object;

    /** 
       A tree 
     */
  DisplayTree display_tree;
  GList *displays;
  displayd *current_display;
  splotd *current_splot;
  gint buttondown;/*-- can be 0, 1, 2, or 3; could be useful in drawing --*/

  GGobiMenus app;

  GSList *d;                    /* Datasets (datad elements) */
            /*-- first is default: cases, nodes; second might be edges --*/

  /* main_ui */
  GtkWidget *current_control_panel;

  GList *control_panels;

  GtkWidget *main_window, *main_menubar;
  GtkUIManager *main_menu_manager;
  GtkWidget *display_menu; /*-- menu labelled 'Window' --*/
  GtkAccelGroup *main_accel_group, *pmode_accel_group, *imode_accel_group;
  GtkWidget *pmode_item, *imode_item;
  GtkWidget *imode_frame;  /* this should be cpanel_frame, actually */
  GtkTooltips *tips;
  gboolean firsttime;
  guint mode_merge_id;

  /* status bar in main console window */
  void (*status_message_func) (gchar *, ggobid *);
  gboolean statusbar_p;

  gboolean close_pending;
#ifdef EXPLICIT_IDENTIFY_HANDLER 
  IdentifyHandler identify_handler;
#endif

/*--------------------------------------------------------------------*/
/*                      reading in the data                           */
/*--------------------------------------------------------------------*/

  InputDescription *input;      /* Information about input files for the default
                                   data source, such as the name of the
                                   file, directory, data mode, extension, etc.
                                 */

/*----------------------- pipeline ---------------------------------*/

  ProjectionMode pmode, pmode_prev;
  InteractionMode imode, imode_prev;

  struct _VarTableUI {
    GtkWidget *window;
    GtkWidget *notebook;
  } vartable_ui;
  gboolean lims_use_visible;


/*--------------- clusters: hiding, excluding ----------------------*/

  struct _ClusterUI {
    GtkWidget *window;
    GtkWidget *notebook;
  } cluster_ui;

/*---------------- brushing by categorical variable ----------------*/

  gboolean linkby_cv;

/*--------------------------------------------------------------------*/
/*                         color                                      */
/*--------------------------------------------------------------------*/
  GdkGC *rectangle_GC;
  GdkColor mediumgray, lightgray, darkgray;  /* for 3d rectangles */
  GdkColor vcirc_freeze_color, vcirc_manip_color; /* for variable circles */
  gshort color_id, color_0;     /* 0:ncolors-1 */
  gboolean mono_p;

  struct _Color_UI {
    GtkWidget *symbol_window;
    GtkWidget *symbol_display, *line_display;

    GtkWidget *colorseldlg;
    GtkWidget *bg_da, *accent_da, *hidden_da, *fg_da[MAXNCOLORS], *current_da;

    gint spacing;
    gint margin;                /* between glyphs in the symbol_display */
  } color_ui;

/*---------------------- graphics contexts -----------------------------*/

  GdkGC *plot_GC;
  GdkGC *selvarfg_GC, *selvarbg_GC;     /* white background, thick lines */
  GdkGC *unselvarfg_GC, *unselvarbg_GC; /* grey background, thin lines */
  GdkGC *manipvarfg_GC;         /* white background, thin purple line */

/*--------------------------- jittering --------------------------------*/

  struct _JitterUI {
    GtkWidget *window;
  } jitter_ui;

/*------------------------- writing out data ---------------------------*/

  struct _Save {
    GtkWidget *tree_view;
    gint format, stage, row_ind, column_ind, missing_ind;
    gboolean jitter_p, edges_p;
  } save;

/*---------------------- 1d plotting -----------------------------------*/

  struct _P1D {
   /*-- cycling --*/
    gint cycle_id;
    GtkAdjustment *cycle_delay_adj;
   /*-- texture --*/
    gfloat *gy;
  } p1d;

/*-------------------- 2d plotting -----------------------------------*/

  struct _XYPlot {
   /*-- cycling --*/
    gint cycle_id;
    GtkAdjustment *cycle_delay_adj;
  } xyplot;

/*---------------------- touring -------------------------------------*/

#ifndef NEW_TOUR_CLASSES
  struct _Tour2d3 {
    gint idled;
  } tour2d3;

  struct _Tour2d {
    gint idled;
    gboolean fade_vars;
    gboolean all_vars;
  } tour2d;

  struct _Tour1d {
    gint idled;
    gboolean fade_vars;
    gboolean all_vars;
  } tour1d;

  struct _TourCorr {
    gint idled;
    gboolean fade_vars;
  } tourcorr;
#else

#endif
/*-------------------- parallel coordinates --------------------------*/

  struct _Parcoords {
    GtkAccelGroup *accel_group;
    GtkWidget *arrangement_box;
  } parcoords;

/*---------------------time series------------------------------------*/

/*XX */
  struct _TSPLOT {
    GtkAccelGroup *accel_group;
    GtkWidget *arrangement_box;
  } tsplot;



/*------------------------ brushing ----------------------------------*/

  glyphd glyph_id, glyph_0;

  struct _Brush_UI {
    gboolean firsttime;
  } brush;

  struct _Plot {
    /*
     * Part of binning: the corners of the bin to be copied from
     * pixmap0 to pixmap1.
     * They're defined in splot_draw_to_pixmap0_binned and used in
     * splot_pixmap0_to_pixmap1 when binned == true.
     */
    icoords bin0, bin1;
    icoords loc0, loc1;
  } plot;

/*---------------------- identification ------------------------------*/

/*---------------------- edge editing --------------------------------*/

  struct _EdgeEdit {
    gint a;
  } edgeedit;

/*--------------------- submenu management ---------------------------*/

  struct _Main_MiscMenu {
    GtkWidget *options_item, *options_menu;
  } menus;

/*-------------------- transformation --------------------------------*/

  struct _Transformation {
    GtkWidget *window;
    GtkAdjustment *boxcox_adj;
  } tform_ui;

  struct _Sphere {
    GtkWidget *window;
    GtkWidget *scree_da;
    GdkPixmap *scree_pixmap;

    GtkObject *npcs_adj;
    GtkWidget *stdized_entry, *variance_entry, *condnum_entry;
    GtkWidget *apply_btn, *restore_btn;
    GtkWidget *tree_view;

   /*-- a pointer to be compared with current_display->d --*/
    GGobiData *d;
  } sphere_ui;

/*-------------------- subsetting ------------------------------------*/

  struct _SubsetUI {
    GtkWidget *window;
    GtkWidget *notebook;
  } subset_ui;

/*---------------- color scheme selection -------------------------------*/

  struct _SchemeChooser {
    GtkWidget *window, *entry_preview, *entry_applied, *da;
    GdkPixmap *pix;
    colorschemed *scheme; /*-- current color scheme --*/
    GdkGC *GC;
    gfloat *pct;
    gint npct;
  } svis;

/*---------------- brushing by weights -------------------------------*/

  struct _WeightedVis {
    GtkWidget *window, *da;
    GdkPixmap *pix;
    GdkGC *GC;

    gfloat *pct;
    gint npct;
    gint *n;   /*-- number of points that will take on each color --*/
    gint nearest_color;

    gint motion_notify_id;
    icoords mousepos;
    gint binning_method;
    gint update_method;
  } wvis;

/*-------------------- scaling ---------------------------------------*/

// Delete
  struct _Scale {
    rectd click_rect;
  } scale;

/*-------------------- imputation ------------------------------------*/

  struct _Impute {
    gboolean bgroup_p;
    gint whichvars;
    GtkWidget *window;
    ImputeType type;
    /*
    GtkWidget *notebook;
    GtkWidget *entry_above, *entry_below, *entry_val;
    */
  } impute;

/*-------------------- moving points ---------------------------------*/

  struct _MovePts {
    gboolean cluster_p;
    enum directiond direction;
    gcoords eps;
  } movepts;


/*----------------- variable selection panel -------------------------*/

  struct _Varpanel_ui {
    GtkWidget *notebook;
    gboolean layoutByRow;
  } varpanel_ui;

  KeyEventHandler *NumberedKeyEventHandler;

  PrintOptions *printOptions;
  GList *pluginInstances;

  GList *colorSchemes;
  colorschemed *activeColorScheme;

  GSList *pmodeRadioGroup;
  GSList *imodeRadioGroup;

  void *userData;/** A place to hang data for a host application, plugin, etc. 
                     Since plugins, etc. may also use this, we might want 
                     a hashtable here similar to pthread's thread-specific data. */

};                              /*  ggobid; */

#include "read_init.h"

typedef enum { GGOBI_SILENT, GGOBI_CHATTY, GGOBI_VERBOSE } GGobiOutputLevel;

/**
  @defgroup SessionOptions Session Options
  @brief This is used to store store values from the
   command line arguments which can be used in subsequent
   code.
 */
typedef struct {

  /**
    @ingroup SessionOptions
    Controls whether messages explaining what is being done internally
    are displayed.
    */
  GGobiOutputLevel verbose;

    /**
       @ingroup SessionOptions
       The default format for the data being read.
     */
  DataMode data_mode;

  gchar *data_type;

  /**
    @ingroup SessionOptions
    The name of the data file containing the data.
    */
  gchar *data_in;
    /**
       @ingroup SessionOptions
       The command line arguments used to start ggobi.
     */
  gchar **cmdArgs;
    /**
      @ingroup SessionOptions
      The number of command line arguments used to start ggobi.
     */
  gint numArgs;


    /**
       @ingroup SessionOptions
       A logical value controlling whether the control window
       of a ggobi instance is displayed. This can be used to hide
       the control window when ggobi is embedded in other applications.
     */
  gboolean showControlPanel;

    /**
      @ingroup SessionOptions
      Data for the initialization settings.
     */
  struct _GGobiInitInfo *info;
    /**
      @ingroup SessionOptions
      The name of the initialization file from which to read any
      session parameters not specified on the command line.
     */
  gchar *initializationFile;

    /**
      @ingroup SessionOptions
      The collection of color schemes read
       available to ggobi, typically specified in the
       initialization file.
      
     */
  GList *colorSchemes;
    /**
     @ingroup SessionOptions
     The name of the active color scheme, indexing the 
     list of colorSchemes.
     */
  gchar *activeColorScheme;

  gchar *restoreFile;

  GSList *pluginFiles;

    /** Directory in which the GGobi files are located.
      */
  gchar *ggobiHome;

  gfloat defaultTourSpeed;
  gfloat defaultTour1dSpeed;

  gboolean useRadioMenuItems;

} GGobiOptions;


/**
  Information about move and identify events in ggobi reported
  to listeners.
 */
typedef struct {
  GGobiData *d;
  int id;
} GGobiPointMoveEvent;



GSList* read_input(InputDescription * desc, ggobid * gg);
void start_ggobi(ggobid * gg, gboolean init_data, gboolean createPlot);
void process_initialization_files();

extern GGobiOptions *sessionOptions;

/**
  Identifiers for the different signal types generated by ggobi
 */
typedef enum { DATAD_ADDED_SIGNAL,
  VARIABLE_ADDED_SIGNAL,         /*-- not using this one presently --*/
  VARIABLE_LIST_CHANGED_SIGNAL,  /*-- this works for variable lists --*/
  SPLOT_NEW_SIGNAL,
  BRUSH_MOTION_SIGNAL, POINT_MOVE_SIGNAL, IDENTIFY_POINT_SIGNAL,
  VARIABLE_SELECTION_SIGNAL,
  STICKY_POINT_ADDED_SIGNAL, STICKY_POINT_REMOVED_SIGNAL,
  CLUSTERS_CHANGED_SIGNAL,       /*-- ggvis wants this --*/
  DISPLAY_NEW_SIGNAL,
  DISPLAY_SELECTED_SIGNAL,
  MAX_GGOBI_SIGNALS
} GGobiSignalType;

/**
  Registered signal identifiers for the ggobi signals.
  Indexed by the enum above.
 */
extern guint GGobiSignals[MAX_GGOBI_SIGNALS];


/**
  Should be in edges.h, if there were one.
 */
GGobiData *setDisplayEdge(displayd * dpy, GGobiData * e);


gchar *getOptValue(const char *const name, const char *const value);
const char *getCommandLineArgValue(const char *name);
void showHelp();

#ifdef __cplusplus
extern "C" {
#endif
void globals_init(ggobid * gg);

guint getGGobiSignal(GGobiSignalType);

GSList *GGOBI(getExtendedDisplayTypes)();
#ifdef __cplusplus
}
#endif

void gtk_marshal_NONE__INT_POINTER_POINTER_POINTER(GtkObject * object,
                                                   GtkSignalFunc func,
                                                   gpointer func_data,
                                                   GtkArg * args);


extern GSList *ExtendedDisplayTypes;
typedef GType(*GTypeLoad) (void);

gchar* ggobi_find_data_file(const gchar *name);
gchar* ggobi_find_config_file(const gchar *name);

GList *getInputPluginSelections(ggobid *gg);

extern const gchar *DefaultUnknownInputModeName;
	

InputDescription *
fileset_generate(const gchar * fileName,
		 const gchar *modeName, 
		 GGobiPluginInfo *plugin, 
		 ggobid * gg);


#include "GGobiEvents.h"

#include "GGobiApp.h"
GGobiApp *getGGobiApp();

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

#endif