Graphviz 14.1.1~dev.20251212.0508
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#include "windows.h"
15#endif
16
17#include <stdbool.h>
18#include <stddef.h>
19#include <xdot/xdot.h>
20#include <gtk/gtk.h>
21#include <glcomp/opengl.h>
22#include <gtk/gtkgl.h>
23#include <cgraph/cgraph.h>
24#include <glcomp/glcompset.h>
25#include "hier.h"
26#include <glcomp/glutils.h>
27#include <util/list.h>
28
29#ifdef _MSC_VER // this is needed on MSVC to get libglade see the callback
30#define _BB __declspec(dllexport)
31#else
32#define _BB
33#endif
34
35typedef struct _ArcBall_t ArcBall_t;
36
37#define GL_VIEWPORT_FACTOR 100
38//mouse modes
39#define MM_PAN 0
40#define MM_ZOOM 1
41#define MM_ROTATE 2
42#define MM_SINGLE_SELECT 3
43#define MM_RECTANGULAR_SELECT 4
44#define MM_RECTANGULAR_X_SELECT 5
45#define MM_MOVE 10
46#define MM_MAGNIFIER 20
47#define MM_FISHEYE_MAGNIFIER 21
48#define MM_FISHEYE_PICK 22 /*fisheye select foci point*/
49#define MM_POLYGON_SELECT 30
50
51#define MAX_ZOOM 500.0f
52#define MIN_ZOOM 0.005f
53
54#define DEG2RAD G_PI/180
55
56#define MAX_FILTERED_ATTR_COUNT 50
57
60
61typedef struct {
62 char* name;
63 char* value;
64 char* defValG;
65 char* defValN;
66 char* defValE;
68 int objType[3];
70}attr_t;
71
72typedef LIST(attr_t *) attrs_t;
73
74typedef struct
75{
76 attrs_t attributes;
79
80 typedef struct
81 {
83 void *obj;
85 int layer;
87 } sdot_op;
88
89 typedef struct {
90 float perc;
92
94
95enum {SCHEMACOUNT = 4}; // number of colors
96
97 typedef struct {
100
108
109 typedef struct
110 {
111 unsigned node_id;
112 unsigned edge_id;
113 unsigned selnode_id;
114 unsigned seledge_id;
115 unsigned nodelabel_id;
116 unsigned edgelabel_id;
118
128
129 typedef struct {
130 double targetx;
131 double targety;
132
133 double r;
135
136 typedef struct {
139 } graph_data;
140
141
142
143 typedef struct{
146 double size;
150 int TVref;
151 }nodeRec;
152#define NREC(n) ((nodeRec*)(aggetrec(n,"nodeRec",0)))
153#define ND_visible(n) (NREC(n)->visible)
154#define ND_selected(n) (NREC(n)->selected)
155#define ND_printLabel(n) (NREC(n)->printLabel)
156#define ND_A(n) (NREC(n)->A)
157#define ND_size(n) (NREC(n)->size)
158#define ND_TVref(n) (NREC(n)->TVref)
159
166#define EREC(e) ((edgeRec*)(aggetrec(e,"edgeRec",0)))
167#define ED_selected(e) (EREC(e)->selected)
168#define ED_posTail(e) (EREC(e)->posTail)
169#define ED_posHead(e) (EREC(e)->posHead)
170
187#define GREC(g) ((graphRec*)(AGDATA(g)))
188#define GN_pos(g) (GREC(g)->N_pos)
189#define GN_size(g) (GREC(g)->N_size)
190#define GN_visible(g) (GREC(g)->N_visible)
191#define GN_selected(g) (GREC(g)->N_selected)
192#define GG_nodelabelcolor(g) (GREC(g)->G_nodelabelcolor)
193#define GN_labelattribute(g) (GREC(g)->N_labelattribute)
194#define GG_labelattribute(g) (GREC(g)->GN_labelattribute)
195#define GE_pos(g) (GREC(g)->E_pos)
196#define GE_visible(g) (GREC(g)->E_visible)
197#define GE_selected(g) (GREC(g)->E_selected)
198#define GG_edgelabelcolor(g) (GREC(g)->G_edgelabelcolor)
199#define GE_labelattribute(g) (GREC(g)->E_labelattribute)
200#define GG_elabelattribute(g) (GREC(g)->GE_labelattribute)
201
202#define GUI_WINDOWED 0
203#define GUI_FULLSCREEN 1
204
205 typedef struct _selection {
206 glCompPoly_t selPoly;
210
211 typedef struct {
212 size_t Nodecount;
213 struct {
214 int active; //1 draw hierarchy 0 draw regular topview
222 glCompColor srcColor; //fine node colors of topfisheye
223 glCompColor tarColor; //supernode colors of fisheye
225 } fisheyeParams;
226
231 double global_z;
232 attr_list* attributes;/*attribute list*/
233
236
237 } topview;
238
243
244
245 typedef struct _ViewInfo {
247 /*view variables */
248 double panx;
249 double pany;
250 double zoom;
251
252 /*clipping coordinates, to avoid unnecesarry rendering */
254
255 /*background color */
257 /*default pen color */
259 /*default fill color */
261 /*grid color */
262 glCompColor gridColor; //grid color
263 /*border color */
265 /*selected node color */
267 /*default node alpha */
269
270 /*default line width */
272
273 /*grid is drawn if this variable is 1 */
275 /*grid cell size in gl coords system */
276 float gridSize; //grid cell size
277
278 /*draws a border in border colors if it is 1 */
279 int bdVisible; //if borders are visible (boundries of the drawing,
280 /*border coordinates, needs to be calculated for each graph */
281
284
285 /*screen window size in 2d */
286 int w, h;
287 /*graph pointer to hold loaded graphs */
289 /*number of graphs loaded */
291 /*active graph */
293
294 /*stores the info about status of mouse,pressed? what button ? where? */
296
300
302 GtkWidget *drawing_area;
303
304 /*Topview data structure, refer topview.h for more info */
306 /*timer for animations */
307 GTimer *timer;
308 /*this timer is session timer and always active */
309 GTimer *timer2;
310 /*general purpose timer */
311 GTimer *timer3;
314 /*lately added */
319
320 /*labelling properties */
321 void *glutfont;
323
324 glCompSet *widgets; //for novice user open gl menu
325 char *initFileName; //file name from command line
330 GtkComboBox *graphComboBox; /*pointer to graph combo box at top right */
332 int keyVal;
335 double nodeScale;
337 char* optArg;
338
340
341 extern ViewInfo *view;
342 extern char *smyrnaPath(char *suffix);
343
344 extern void glexpose(void);
char * suffix
Definition bcomps.c:66
abstract graph C library, Cgraph API
glMouseButtonType
Definition glcompdefs.h:67
type-generic dynamically expanding list
#define LIST(type)
Definition list.h:55
ViewInfo * view
Definition viewport.c:37
char * smyrnaPath(char *suffix)
Definition main.c:51
struct _selection selection
attr_data_type
Definition smyrnadefs.h:58
@ attr_alpha
Definition smyrnadefs.h:58
@ attr_int
Definition smyrnadefs.h:58
@ attr_float
Definition smyrnadefs.h:58
@ attr_bool
Definition smyrnadefs.h:58
smyrna_view_mode
Definition smyrnadefs.h:59
@ smyrna_2D
Definition smyrnadefs.h:59
@ smyrna_all
Definition smyrnadefs.h:59
@ smyrna_fisheye
Definition smyrnadefs.h:59
@ smyrna_all_but_fisheye
Definition smyrnadefs.h:59
@ smyrna_3D
Definition smyrnadefs.h:59
@ SCHEMACOUNT
Definition smyrnadefs.h:95
#define MAX_FILTERED_ATTR_COUNT
Definition smyrnadefs.h:56
struct _ViewInfo ViewInfo
void glexpose(void)
Definition viewport.c:520
gvk_layout
Definition smyrnadefs.h:101
@ GVK_DOT
Definition smyrnadefs.h:102
@ GVK_NEATO
Definition smyrnadefs.h:103
@ GVK_CIRCO
Definition smyrnadefs.h:105
@ GVK_FDP
Definition smyrnadefs.h:106
@ GVK_TWOPI
Definition smyrnadefs.h:104
graph or subgraph
Definition cgraph.h:424
implementation of Agrec_t
Definition cgraph.h:172
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:640
int active_frame
Definition smyrnadefs.h:312
ArcBall_t * arcball
Definition smyrnadefs.h:331
topview * Topview
Definition smyrnadefs.h:305
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:332
int drawnodes
Definition smyrnadefs.h:315
Agraph_t ** g
Definition smyrnadefs.h:288
double bdxRight
Definition smyrnadefs.h:283
int total_frames
Definition smyrnadefs.h:313
float LineWidth
Definition smyrnadefs.h:271
int drawnodelabels
Definition smyrnadefs.h:317
char * template_file
Definition smyrnadefs.h:329
int labelnumberofnodes
Definition smyrnadefs.h:322
float clipX2
Definition smyrnadefs.h:253
double bdyBottom
Definition smyrnadefs.h:283
double zoom
Definition smyrnadefs.h:250
double bdyTop
Definition smyrnadefs.h:282
char * optArg
Definition smyrnadefs.h:337
int drawedges
Definition smyrnadefs.h:316
GtkComboBox * graphComboBox
Definition smyrnadefs.h:330
GTimer * timer
Definition smyrnadefs.h:307
glCompSet * widgets
Definition smyrnadefs.h:324
size_t camera_count
Definition smyrnadefs.h:298
size_t graphCount
Definition smyrnadefs.h:290
mouse_action_t * mouse_actions
customizable mouse interaction list
Definition smyrnadefs.h:333
glCompColor fillColor
Definition smyrnadefs.h:260
glCompColor borderColor
Definition smyrnadefs.h:264
colorschemaset colschms
Definition smyrnadefs.h:328
float gridSize
Definition smyrnadefs.h:276
char * initFileName
Definition smyrnadefs.h:325
double defaultnodealpha
Definition smyrnadefs.h:268
GTimer * timer2
Definition smyrnadefs.h:309
int activeGraph
Definition smyrnadefs.h:292
glCompColor selectedNodeColor
Definition smyrnadefs.h:266
glCompColor bgColor
Definition smyrnadefs.h:256
double nodeScale
Definition smyrnadefs.h:335
viewport_camera ** cameras
Definition smyrnadefs.h:297
int drawSplines
Definition smyrnadefs.h:327
double bdxLeft
Definition smyrnadefs.h:282
size_t mouse_action_count
Definition smyrnadefs.h:334
GtkWidget * drawing_area
open gl canvas
Definition smyrnadefs.h:302
systemgraphs systemGraphs
Definition smyrnadefs.h:246
int gridVisible
Definition smyrnadefs.h:274
double panx
Definition smyrnadefs.h:248
double pany
Definition smyrnadefs.h:249
int bdVisible
Definition smyrnadefs.h:279
int drawedgelabels
Definition smyrnadefs.h:318
glCompMouse mouse
Definition smyrnadefs.h:295
float clipY1
Definition smyrnadefs.h:253
GTimer * timer3
Definition smyrnadefs.h:311
float clipX1
Definition smyrnadefs.h:253
glCompColor gridColor
Definition smyrnadefs.h:262
float clipY2
Definition smyrnadefs.h:253
glCompColor penColor
Definition smyrnadefs.h:258
size_t active_camera
<number of cameras
Definition smyrnadefs.h:299
void * glutfont
Definition smyrnadefs.h:321
glCompPoly_t selPoly
Definition smyrnadefs.h:206
bool selectEdges
Definition smyrnadefs.h:208
bool selectNodes
Definition smyrnadefs.h:207
attrs_t attributes
Definition smyrnadefs.h:76
char * defValN
Definition smyrnadefs.h:65
char * name
Definition smyrnadefs.h:62
int propagate
Definition smyrnadefs.h:69
char * defValG
Definition smyrnadefs.h:64
char * value
Definition smyrnadefs.h:63
attr_data_type type
Definition smyrnadefs.h:67
char * defValE
Definition smyrnadefs.h:66
glCompColor c
Definition smyrnadefs.h:91
glCompPoint posTail
Definition smyrnadefs.h:162
Agrec_t h
Definition smyrnadefs.h:161
int selected
Definition smyrnadefs.h:164
glCompPoint posHead
Definition smyrnadefs.h:163
Definition hier.h:16
Agsym_t * N_labelattribute
Definition smyrnadefs.h:179
Agsym_t * N_pos
Definition smyrnadefs.h:173
Agsym_t * G_nodelabelcolor
Definition smyrnadefs.h:177
Agsym_t * N_selected
Definition smyrnadefs.h:176
Agsym_t * G_edgelabelcolor
Definition smyrnadefs.h:183
Agrec_t h
Definition smyrnadefs.h:172
Agsym_t * E_visible
Definition smyrnadefs.h:180
Agsym_t * E_selected
Definition smyrnadefs.h:181
Agsym_t * N_size
Definition smyrnadefs.h:174
Agsym_t * N_visible
Definition smyrnadefs.h:175
Agsym_t * GN_labelattribute
Definition smyrnadefs.h:178
Agsym_t * E_pos
Definition smyrnadefs.h:182
Agsym_t * GE_labelattribute
Definition smyrnadefs.h:185
Agsym_t * E_labelattribute
Definition smyrnadefs.h:184
Agrec_t h
Definition smyrnadefs.h:137
char * GraphFileName
Definition smyrnadefs.h:138
smyrna_view_mode mode
Definition smyrnadefs.h:126
glMouseButtonType type
Definition smyrnadefs.h:124
glCompPoint A
Definition smyrnadefs.h:145
double size
Definition smyrnadefs.h:146
int TVref
Definition smyrnadefs.h:150
int printLabel
Definition smyrnadefs.h:149
Agrec_t h
Definition smyrnadefs.h:144
int visible
Definition smyrnadefs.h:148
int selected
Definition smyrnadefs.h:147
xdot_op op
Definition smyrnadefs.h:82
glCompImage * img
Definition smyrnadefs.h:86
void * obj
Definition smyrnadefs.h:83
int layer
Definition smyrnadefs.h:85
glCompFont font
Definition smyrnadefs.h:84
Agraph_t * attrs_widgets
Definition smyrnadefs.h:241
Agraph_t * def_attrs
Definition smyrnadefs.h:240
graph_data Graphdata
Definition smyrnadefs.h:227
double global_z
Definition smyrnadefs.h:231
int animate
Definition smyrnadefs.h:221
Hierarchy * h
Definition smyrnadefs.h:220
double fitin_zoom
Definition smyrnadefs.h:229
topviewcache cache
Definition smyrnadefs.h:234
glCompColor srcColor
Definition smyrnadefs.h:222
reposition_t repos
Definition smyrnadefs.h:215
xdot * xDot
Definition smyrnadefs.h:230
focus_t * fs
Definition smyrnadefs.h:224
int active
Definition smyrnadefs.h:214
bool dist2_limit
Definition smyrnadefs.h:219
size_t Nodecount
Definition smyrnadefs.h:212
attr_list * attributes
Definition smyrnadefs.h:232
levelparms_t level
Definition smyrnadefs.h:216
selection sel
Definition smyrnadefs.h:235
glCompColor tarColor
Definition smyrnadefs.h:223
float maxedgelen
Definition smyrnadefs.h:228
unsigned selnode_id
Definition smyrnadefs.h:113
unsigned nodelabel_id
Definition smyrnadefs.h:115
unsigned node_id
Definition smyrnadefs.h:111
unsigned edge_id
Definition smyrnadefs.h:112
unsigned seledge_id
Definition smyrnadefs.h:114
unsigned edgelabel_id
Definition smyrnadefs.h:116
Definition xdot.h:166
Definition grammar.c:90
parsing and deparsing of xdot operations