Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
smyrnadefs.h
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (c) 2011 AT&T Intellectual Property
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * https://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors: Details at https://graphviz.org
9 *************************************************************************/
10
11#pragma once
12
13#ifdef _WIN32
14#ifndef NO_WIN_HEADER
15#include "windows.h"
16#endif
17#endif
18
19#include <stdbool.h>
20#include <stddef.h>
21#include <xdot/xdot.h>
22#include <gtk/gtk.h>
23#include <glcomp/opengl.h>
24#include <gtk/gtkgl.h>
25#include <cgraph/cgraph.h>
26#include <cgraph/list.h>
27#include <glcomp/glcompset.h>
28#include "hier.h"
29#include <glcomp/glutils.h>
30
31#ifdef _MSC_VER // this is needed on MSVC to get libglade see the callback
32#define _BB __declspec(dllexport)
33#else
34#define _BB
35#endif
36
37typedef struct _ArcBall_t ArcBall_t;
38
39#define GL_VIEWPORT_FACTOR 100
40//mouse modes
41#define MM_PAN 0
42#define MM_ZOOM 1
43#define MM_ROTATE 2
44#define MM_SINGLE_SELECT 3
45#define MM_RECTANGULAR_SELECT 4
46#define MM_RECTANGULAR_X_SELECT 5
47#define MM_MOVE 10
48#define MM_MAGNIFIER 20
49#define MM_FISHEYE_MAGNIFIER 21
50#define MM_FISHEYE_PICK 22 /*fisheye select foci point*/
51#define MM_POLYGON_SELECT 30
52
53#define MAX_ZOOM 500.0f
54#define MIN_ZOOM 0.005f
55
56#define DEG2RAD G_PI/180
57
58#define MAX_FILTERED_ATTR_COUNT 50
59
62
63
64typedef struct{
65 int keyVal;
66 int down;
68
69
70
71typedef struct {
72 size_t index;
73 char* name;
74 char* value;
75 char* defValG;
76 char* defValN;
77 char* defValE;
79 int objType[3];
80 GtkWidget* widget;
82}attr_t;
83
84DEFINE_LIST(attrs, attr_t*)
85
86typedef struct
87{
88 attrs_t attributes;
89 GtkLabel* fLabels[MAX_FILTERED_ATTR_COUNT];
92
93 typedef struct
94 {
96 void *obj;
98 int layer;
100 } sdot_op;
101
102 typedef struct {
103 float perc;
105
106 } colorschema;
107
108 typedef struct {
109 size_t schemacount; // number of colors
110 int smooth; /* if true, interpolate */
113
121
122 typedef struct
123 {
124 unsigned node_id;
125 unsigned edge_id;
126 unsigned selnode_id;
127 unsigned seledge_id;
128 unsigned nodelabel_id;
129 unsigned edgelabel_id;
131
132 typedef struct {
133 int color;
134 int pos;
137
138
148
149 typedef struct _viewport_camera {
150 float x;
151 float y;
152 float z;
153
154 float targetx;
155 float targety;
156 float targetz;
157
158 float r;
160
165
166
167
168 typedef struct{
171 float size;
175 int TVref;
176 }nodeRec;
177#define NREC(n) ((nodeRec*)(aggetrec(n,"nodeRec",0)))
178#define ND_visible(n) (NREC(n)->visible)
179#define ND_selected(n) (NREC(n)->selected)
180#define ND_printLabel(n) (NREC(n)->printLabel)
181#define ND_A(n) (NREC(n)->A)
182#define ND_size(n) (NREC(n)->size)
183#define ND_TVref(n) (NREC(n)->TVref)
184
191#define EREC(e) ((edgeRec*)(aggetrec(e,"edgeRec",0)))
192#define ED_selected(e) (EREC(e)->selected)
193#define ED_posTail(e) (EREC(e)->posTail)
194#define ED_posHead(e) (EREC(e)->posHead)
195
212#define GREC(g) ((graphRec*)(AGDATA(g)))
213#define GN_pos(g) (GREC(g)->N_pos)
214#define GN_size(g) (GREC(g)->N_size)
215#define GN_visible(g) (GREC(g)->N_visible)
216#define GN_selected(g) (GREC(g)->N_selected)
217#define GG_nodelabelcolor(g) (GREC(g)->G_nodelabelcolor)
218#define GN_labelattribute(g) (GREC(g)->N_labelattribute)
219#define GG_labelattribute(g) (GREC(g)->GN_labelattribute)
220#define GE_pos(g) (GREC(g)->E_pos)
221#define GE_visible(g) (GREC(g)->E_visible)
222#define GE_selected(g) (GREC(g)->E_selected)
223#define GG_edgelabelcolor(g) (GREC(g)->G_edgelabelcolor)
224#define GE_labelattribute(g) (GREC(g)->E_labelattribute)
225#define GG_elabelattribute(g) (GREC(g)->GE_labelattribute)
226
227#define GUI_WINDOWED 0
228#define GUI_FULLSCREEN 1
229
235
236 typedef struct {
237 size_t Nodecount;
238 struct {
239 int active; //1 draw hierarchy 0 draw regular topview
245 glCompColor srcColor; //fine node colors of topfisheye
246 glCompColor tarColor; //supernode colors of fisheye
248 } fisheyeParams;
249
255 double global_z;
256 attr_list* attributes;/*attribute list*/
257
260
261 } topview;
262
267
268
269 typedef struct _ViewInfo {
271 /*view variables */
272 float panx;
273 float pany;
274 float panz;
275 float zoom;
276
277 /*clipping coordinates, to avoid unnecesarry rendering */
279
280 /*background color */
282 /*default pen color */
284 /*default fill color */
286 /*grid color */
287 glCompColor gridColor; //grid color
288 /*border color */
290 /*selected node color */
292 /*default node alpha */
294
295 /*default line width */
297
298 /*grid is drawn if this variable is 1 */
300 /*grid cell size in gl coords system */
301 float gridSize; //grid cell size
302
303 /*draws a border in border colors if it is 1 */
304 int bdVisible; //if borders are visible (boundries of the drawing,
305 /*border coordinates, needs to be calculated for each graph */
306
309
310 /*screen window size in 2d */
311 int w, h;
312 /*graph pointer to hold loaded graphs */
314 /*number of graphs loaded */
316 /*active graph */
318
319 /*stores the info about status of mouse,pressed? what button ? where? */
320// mouse_attr mouse;
322
323 /*selection object,refer to smyrnadefs.h for more info */
324// selection Selection;
325
329
330 /*open gl canvas, used to be a globa variable before looks better wrapped in viewinfo */
331 GtkWidget *drawing_area;
332
333 /*Topview data structure, refer topview.h for more info */
335 /*timer for animations */
336 GTimer *timer;
337 /*this timer is session timer and always active */
338 GTimer *timer2;
339 /*general purpose timer */
340 GTimer *timer3;
343 /*lately added */
348
349 /*labelling properties */
350 void *glutfont;
357
358 glCompSet *widgets; //for novice user open gl menu
359 char *initFileName; //file name from command line
364 GtkComboBox *graphComboBox; /*pointer to graph combo box at top right */
367 mouse_action_t* mouse_actions; /*customizable moouse interraction list*/
372 char* optArg;
373
375/*rotation steps*/
376
377 extern ViewInfo *view;
378 extern GtkMessageDialog *Dlg;
379 extern char *smyrnaPath(char *suffix);
380
381 extern void glexpose(void);
char * suffix
Definition bcomps.c:66
abstract graph C library, Cgraph API
glMouseButtonType
Definition glcompdefs.h:89
#define DEFINE_LIST(name, type)
Definition list.h:26
ViewInfo * view
Definition viewport.c:38
struct _graph_data graph_data
char * smyrnaPath(char *suffix)
Definition main.c:68
struct _viewport_camera viewport_camera
struct _selection selection
GtkMessageDialog * Dlg
Definition viewport.c:40
attr_data_type
Definition smyrnadefs.h:60
@ attr_alpha
Definition smyrnadefs.h:60
@ attr_int
Definition smyrnadefs.h:60
@ attr_float
Definition smyrnadefs.h:60
@ attr_bool
Definition smyrnadefs.h:60
smyrna_view_mode
Definition smyrnadefs.h:61
@ smyrna_2D
Definition smyrnadefs.h:61
@ smyrna_all
Definition smyrnadefs.h:61
@ smyrna_fisheye
Definition smyrnadefs.h:61
@ smyrna_all_but_fisheye
Definition smyrnadefs.h:61
@ smyrna_3D
Definition smyrnadefs.h:61
#define MAX_FILTERED_ATTR_COUNT
Definition smyrnadefs.h:58
struct _ViewInfo ViewInfo
void glexpose(void)
Definition viewport.c:543
gvk_layout
Definition smyrnadefs.h:114
@ GVK_DOT
Definition smyrnadefs.h:115
@ GVK_NEATO
Definition smyrnadefs.h:116
@ GVK_CIRCO
Definition smyrnadefs.h:118
@ GVK_FDP
Definition smyrnadefs.h:119
@ GVK_TWOPI
Definition smyrnadefs.h:117
graph or subgraph
Definition cgraph.h:425
implementation of Agrec_t
Definition cgraph.h:172
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:639
float bdxLeft
Definition smyrnadefs.h:307
int active_frame
Definition smyrnadefs.h:341
ArcBall_t * arcball
Definition smyrnadefs.h:365
topview * Topview
Definition smyrnadefs.h:334
int drawnodes
Definition smyrnadefs.h:344
Agraph_t ** g
Definition smyrnadefs.h:313
float pany
Definition smyrnadefs.h:273
int total_frames
Definition smyrnadefs.h:342
float LineWidth
Definition smyrnadefs.h:296
int drawnodelabels
Definition smyrnadefs.h:346
char * template_file
Definition smyrnadefs.h:363
int labelnumberofnodes
Definition smyrnadefs.h:354
float clipX2
Definition smyrnadefs.h:278
float bdyTop
Definition smyrnadefs.h:307
char * optArg
Definition smyrnadefs.h:372
colorschemaset * colschms
Definition smyrnadefs.h:362
int drawedges
Definition smyrnadefs.h:345
float nodeScale
Definition smyrnadefs.h:370
GtkComboBox * graphComboBox
Definition smyrnadefs.h:364
GTimer * timer
Definition smyrnadefs.h:336
glCompSet * widgets
Definition smyrnadefs.h:358
keymap_t keymap
Definition smyrnadefs.h:366
size_t camera_count
Definition smyrnadefs.h:327
size_t graphCount
Definition smyrnadefs.h:315
mouse_action_t * mouse_actions
Definition smyrnadefs.h:367
glCompColor nodelabelcolor
Definition smyrnadefs.h:351
glCompColor fillColor
Definition smyrnadefs.h:285
glCompColor borderColor
Definition smyrnadefs.h:289
int labelshowedges
Definition smyrnadefs.h:356
float gridSize
Definition smyrnadefs.h:301
char * initFileName
Definition smyrnadefs.h:359
glCompColor edgelabelcolor
Definition smyrnadefs.h:352
float panx
Definition smyrnadefs.h:272
GTimer * timer2
Definition smyrnadefs.h:338
int activeGraph
Definition smyrnadefs.h:317
glCompColor selectedNodeColor
Definition smyrnadefs.h:291
glCompColor bgColor
Definition smyrnadefs.h:281
viewport_camera ** cameras
Definition smyrnadefs.h:326
int drawSplines
Definition smyrnadefs.h:361
int labelshownodes
Definition smyrnadefs.h:355
size_t mouse_action_count
Definition smyrnadefs.h:368
GtkWidget * drawing_area
Definition smyrnadefs.h:331
float bdxRight
Definition smyrnadefs.h:308
float bdyBottom
Definition smyrnadefs.h:308
systemgraphs systemGraphs
Definition smyrnadefs.h:270
int labelwithdegree
Definition smyrnadefs.h:353
int gridVisible
Definition smyrnadefs.h:299
float zoom
Definition smyrnadefs.h:275
float panz
Definition smyrnadefs.h:274
int bdVisible
Definition smyrnadefs.h:304
int drawedgelabels
Definition smyrnadefs.h:347
glCompMouse mouse
Definition smyrnadefs.h:321
float clipY1
Definition smyrnadefs.h:278
GTimer * timer3
Definition smyrnadefs.h:340
refresh_filter refresh
Definition smyrnadefs.h:369
float clipX1
Definition smyrnadefs.h:278
glCompColor gridColor
Definition smyrnadefs.h:287
float clipY2
Definition smyrnadefs.h:278
glCompColor penColor
Definition smyrnadefs.h:283
size_t active_camera
<number of cameras
Definition smyrnadefs.h:328
float defaultnodealpha
Definition smyrnadefs.h:293
void * glutfont
Definition smyrnadefs.h:350
char * GraphFileName
Definition smyrnadefs.h:163
Agrec_t h
Definition smyrnadefs.h:162
glCompPoly selPoly
Definition smyrnadefs.h:231
bool selectEdges
Definition smyrnadefs.h:233
bool selectNodes
Definition smyrnadefs.h:232
bool with_widgets
Definition smyrnadefs.h:90
attrs_t attributes
Definition smyrnadefs.h:88
char * defValN
Definition smyrnadefs.h:76
char * name
Definition smyrnadefs.h:73
int propagate
Definition smyrnadefs.h:81
size_t index
Definition smyrnadefs.h:72
GtkWidget * widget
Definition smyrnadefs.h:80
char * defValG
Definition smyrnadefs.h:75
char * value
Definition smyrnadefs.h:74
attr_data_type type
Definition smyrnadefs.h:78
char * defValE
Definition smyrnadefs.h:77
glCompColor c
Definition smyrnadefs.h:104
colorschema * s
Definition smyrnadefs.h:111
size_t schemacount
Definition smyrnadefs.h:109
glCompPoint posTail
Definition smyrnadefs.h:187
Agrec_t h
Definition smyrnadefs.h:186
int selected
Definition smyrnadefs.h:189
glCompPoint posHead
Definition smyrnadefs.h:188
Definition hier.h:15
Agsym_t * N_labelattribute
Definition smyrnadefs.h:204
Agsym_t * N_pos
Definition smyrnadefs.h:198
Agsym_t * G_nodelabelcolor
Definition smyrnadefs.h:202
Agsym_t * N_selected
Definition smyrnadefs.h:201
Agsym_t * G_edgelabelcolor
Definition smyrnadefs.h:208
Agrec_t h
Definition smyrnadefs.h:197
Agsym_t * E_visible
Definition smyrnadefs.h:205
Agsym_t * E_selected
Definition smyrnadefs.h:206
Agsym_t * N_size
Definition smyrnadefs.h:199
Agsym_t * N_visible
Definition smyrnadefs.h:200
Agsym_t * GN_labelattribute
Definition smyrnadefs.h:203
Agsym_t * E_pos
Definition smyrnadefs.h:207
Agsym_t * GE_labelattribute
Definition smyrnadefs.h:210
Agsym_t * E_labelattribute
Definition smyrnadefs.h:209
int keyVal
Definition smyrnadefs.h:65
smyrna_view_mode mode
Definition smyrnadefs.h:146
glMouseButtonType type
Definition smyrnadefs.h:144
glCompPoint A
Definition smyrnadefs.h:170
float size
Definition smyrnadefs.h:171
int TVref
Definition smyrnadefs.h:175
int printLabel
Definition smyrnadefs.h:174
Agrec_t h
Definition smyrnadefs.h:169
int visible
Definition smyrnadefs.h:173
int selected
Definition smyrnadefs.h:172
xdot_op op
Definition smyrnadefs.h:95
glCompFont * font
Definition smyrnadefs.h:97
glCompImage * img
Definition smyrnadefs.h:99
void * obj
Definition smyrnadefs.h:96
int layer
Definition smyrnadefs.h:98
Agraph_t * attrs_widgets
Definition smyrnadefs.h:265
Agraph_t * def_attrs
Definition smyrnadefs.h:264
graph_data Graphdata
Definition smyrnadefs.h:250
double global_z
Definition smyrnadefs.h:255
hierparms_t hier
Definition smyrnadefs.h:242
int animate
Definition smyrnadefs.h:244
Hierarchy * h
Definition smyrnadefs.h:243
topviewcache cache
Definition smyrnadefs.h:258
glCompColor srcColor
Definition smyrnadefs.h:245
reposition_t repos
Definition smyrnadefs.h:240
xdot * xDot
Definition smyrnadefs.h:254
focus_t * fs
Definition smyrnadefs.h:247
int active
Definition smyrnadefs.h:239
size_t Nodecount
Definition smyrnadefs.h:237
float minedgelen
Definition smyrnadefs.h:252
attr_list * attributes
Definition smyrnadefs.h:256
float fitin_zoom
Definition smyrnadefs.h:253
levelparms_t level
Definition smyrnadefs.h:241
selection sel
Definition smyrnadefs.h:259
glCompColor tarColor
Definition smyrnadefs.h:246
float maxedgelen
Definition smyrnadefs.h:251
unsigned selnode_id
Definition smyrnadefs.h:126
unsigned nodelabel_id
Definition smyrnadefs.h:128
unsigned node_id
Definition smyrnadefs.h:124
unsigned edge_id
Definition smyrnadefs.h:125
unsigned seledge_id
Definition smyrnadefs.h:127
unsigned edgelabel_id
Definition smyrnadefs.h:129
Definition xdot.h:155
parsing and deparsing of xdot operations