Graphviz 13.1.2~dev.20250726.0945
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 size_t index;
63 char* name;
64 char* value;
65 char* defValG;
66 char* defValN;
67 char* defValE;
69 int objType[3];
70 GtkWidget* widget;
72}attr_t;
73
74DEFINE_LIST(attrs, attr_t*)
75
76typedef struct
77{
78 attrs_t attributes;
79 GtkLabel* fLabels[MAX_FILTERED_ATTR_COUNT];
81
82 typedef struct
83 {
85 void *obj;
87 int layer;
89 } sdot_op;
90
91 typedef struct {
92 float perc;
94
96
97enum {SCHEMACOUNT = 4}; // number of colors
98
99 typedef struct {
102
110
111 typedef struct
112 {
113 unsigned node_id;
114 unsigned edge_id;
115 unsigned selnode_id;
116 unsigned seledge_id;
117 unsigned nodelabel_id;
118 unsigned edgelabel_id;
120
130
131 typedef struct {
132 float targetx;
133 float targety;
134
135 float r;
137
138 typedef struct {
141 } graph_data;
142
143
144
145 typedef struct{
148 float size;
152 int TVref;
153 }nodeRec;
154#define NREC(n) ((nodeRec*)(aggetrec(n,"nodeRec",0)))
155#define ND_visible(n) (NREC(n)->visible)
156#define ND_selected(n) (NREC(n)->selected)
157#define ND_printLabel(n) (NREC(n)->printLabel)
158#define ND_A(n) (NREC(n)->A)
159#define ND_size(n) (NREC(n)->size)
160#define ND_TVref(n) (NREC(n)->TVref)
161
168#define EREC(e) ((edgeRec*)(aggetrec(e,"edgeRec",0)))
169#define ED_selected(e) (EREC(e)->selected)
170#define ED_posTail(e) (EREC(e)->posTail)
171#define ED_posHead(e) (EREC(e)->posHead)
172
189#define GREC(g) ((graphRec*)(AGDATA(g)))
190#define GN_pos(g) (GREC(g)->N_pos)
191#define GN_size(g) (GREC(g)->N_size)
192#define GN_visible(g) (GREC(g)->N_visible)
193#define GN_selected(g) (GREC(g)->N_selected)
194#define GG_nodelabelcolor(g) (GREC(g)->G_nodelabelcolor)
195#define GN_labelattribute(g) (GREC(g)->N_labelattribute)
196#define GG_labelattribute(g) (GREC(g)->GN_labelattribute)
197#define GE_pos(g) (GREC(g)->E_pos)
198#define GE_visible(g) (GREC(g)->E_visible)
199#define GE_selected(g) (GREC(g)->E_selected)
200#define GG_edgelabelcolor(g) (GREC(g)->G_edgelabelcolor)
201#define GE_labelattribute(g) (GREC(g)->E_labelattribute)
202#define GG_elabelattribute(g) (GREC(g)->GE_labelattribute)
203
204#define GUI_WINDOWED 0
205#define GUI_FULLSCREEN 1
206
207 typedef struct _selection {
208 glCompPoly_t selPoly;
212
213 typedef struct {
214 size_t Nodecount;
215 struct {
216 int active; //1 draw hierarchy 0 draw regular topview
224 glCompColor srcColor; //fine node colors of topfisheye
225 glCompColor tarColor; //supernode colors of fisheye
227 } fisheyeParams;
228
233 double global_z;
234 attr_list* attributes;/*attribute list*/
235
238
239 } topview;
240
245
246
247 typedef struct _ViewInfo {
249 /*view variables */
250 float panx;
251 float pany;
252 float zoom;
253
254 /*clipping coordinates, to avoid unnecesarry rendering */
256
257 /*background color */
259 /*default pen color */
261 /*default fill color */
263 /*grid color */
264 glCompColor gridColor; //grid color
265 /*border color */
267 /*selected node color */
269 /*default node alpha */
271
272 /*default line width */
274
275 /*grid is drawn if this variable is 1 */
277 /*grid cell size in gl coords system */
278 float gridSize; //grid cell size
279
280 /*draws a border in border colors if it is 1 */
281 int bdVisible; //if borders are visible (boundries of the drawing,
282 /*border coordinates, needs to be calculated for each graph */
283
286
287 /*screen window size in 2d */
288 int w, h;
289 /*graph pointer to hold loaded graphs */
291 /*number of graphs loaded */
293 /*active graph */
295
296 /*stores the info about status of mouse,pressed? what button ? where? */
298
302
304 GtkWidget *drawing_area;
305
306 /*Topview data structure, refer topview.h for more info */
308 /*timer for animations */
309 GTimer *timer;
310 /*this timer is session timer and always active */
311 GTimer *timer2;
312 /*general purpose timer */
313 GTimer *timer3;
316 /*lately added */
321
322 /*labelling properties */
323 void *glutfont;
325
326 glCompSet *widgets; //for novice user open gl menu
327 char *initFileName; //file name from command line
332 GtkComboBox *graphComboBox; /*pointer to graph combo box at top right */
334 int keyVal;
339 char* optArg;
340
342
343 extern ViewInfo *view;
344 extern char *smyrnaPath(char *suffix);
345
346 extern void glexpose(void);
char * suffix
Definition bcomps.c:66
abstract graph C library, Cgraph API
glMouseButtonType
Definition glcompdefs.h:67
#define DEFINE_LIST(name, type)
Definition list.h:22
ViewInfo * view
Definition viewport.c:37
@ SCHEMACOUNT
Definition smyrnadefs.h:97
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
#define MAX_FILTERED_ATTR_COUNT
Definition smyrnadefs.h:56
struct _ViewInfo ViewInfo
void glexpose(void)
Definition viewport.c:522
gvk_layout
Definition smyrnadefs.h:103
@ GVK_DOT
Definition smyrnadefs.h:104
@ GVK_NEATO
Definition smyrnadefs.h:105
@ GVK_CIRCO
Definition smyrnadefs.h:107
@ GVK_FDP
Definition smyrnadefs.h:108
@ GVK_TWOPI
Definition smyrnadefs.h:106
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:651
float bdxLeft
Definition smyrnadefs.h:284
int active_frame
Definition smyrnadefs.h:314
ArcBall_t * arcball
Definition smyrnadefs.h:333
topview * Topview
Definition smyrnadefs.h:307
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:334
int drawnodes
Definition smyrnadefs.h:317
Agraph_t ** g
Definition smyrnadefs.h:290
float pany
Definition smyrnadefs.h:251
int total_frames
Definition smyrnadefs.h:315
float LineWidth
Definition smyrnadefs.h:273
int drawnodelabels
Definition smyrnadefs.h:319
char * template_file
Definition smyrnadefs.h:331
int labelnumberofnodes
Definition smyrnadefs.h:324
float clipX2
Definition smyrnadefs.h:255
float bdyTop
Definition smyrnadefs.h:284
char * optArg
Definition smyrnadefs.h:339
int drawedges
Definition smyrnadefs.h:318
float nodeScale
Definition smyrnadefs.h:337
GtkComboBox * graphComboBox
Definition smyrnadefs.h:332
GTimer * timer
Definition smyrnadefs.h:309
glCompSet * widgets
Definition smyrnadefs.h:326
size_t camera_count
Definition smyrnadefs.h:300
size_t graphCount
Definition smyrnadefs.h:292
mouse_action_t * mouse_actions
customizable mouse interaction list
Definition smyrnadefs.h:335
glCompColor fillColor
Definition smyrnadefs.h:262
glCompColor borderColor
Definition smyrnadefs.h:266
colorschemaset colschms
Definition smyrnadefs.h:330
float gridSize
Definition smyrnadefs.h:278
char * initFileName
Definition smyrnadefs.h:327
float panx
Definition smyrnadefs.h:250
GTimer * timer2
Definition smyrnadefs.h:311
int activeGraph
Definition smyrnadefs.h:294
glCompColor selectedNodeColor
Definition smyrnadefs.h:268
glCompColor bgColor
Definition smyrnadefs.h:258
viewport_camera ** cameras
Definition smyrnadefs.h:299
int drawSplines
Definition smyrnadefs.h:329
size_t mouse_action_count
Definition smyrnadefs.h:336
GtkWidget * drawing_area
open gl canvas
Definition smyrnadefs.h:304
float bdxRight
Definition smyrnadefs.h:285
float bdyBottom
Definition smyrnadefs.h:285
systemgraphs systemGraphs
Definition smyrnadefs.h:248
int gridVisible
Definition smyrnadefs.h:276
float zoom
Definition smyrnadefs.h:252
int bdVisible
Definition smyrnadefs.h:281
int drawedgelabels
Definition smyrnadefs.h:320
glCompMouse mouse
Definition smyrnadefs.h:297
float clipY1
Definition smyrnadefs.h:255
GTimer * timer3
Definition smyrnadefs.h:313
float clipX1
Definition smyrnadefs.h:255
glCompColor gridColor
Definition smyrnadefs.h:264
float clipY2
Definition smyrnadefs.h:255
glCompColor penColor
Definition smyrnadefs.h:260
size_t active_camera
<number of cameras
Definition smyrnadefs.h:301
float defaultnodealpha
Definition smyrnadefs.h:270
void * glutfont
Definition smyrnadefs.h:323
glCompPoly_t selPoly
Definition smyrnadefs.h:208
bool selectEdges
Definition smyrnadefs.h:210
bool selectNodes
Definition smyrnadefs.h:209
attrs_t attributes
Definition smyrnadefs.h:78
char * defValN
Definition smyrnadefs.h:66
char * name
Definition smyrnadefs.h:63
int propagate
Definition smyrnadefs.h:71
size_t index
Definition smyrnadefs.h:62
GtkWidget * widget
Definition smyrnadefs.h:70
char * defValG
Definition smyrnadefs.h:65
char * value
Definition smyrnadefs.h:64
attr_data_type type
Definition smyrnadefs.h:68
char * defValE
Definition smyrnadefs.h:67
glCompColor c
Definition smyrnadefs.h:93
glCompPoint posTail
Definition smyrnadefs.h:164
Agrec_t h
Definition smyrnadefs.h:163
int selected
Definition smyrnadefs.h:166
glCompPoint posHead
Definition smyrnadefs.h:165
Definition hier.h:16
Agsym_t * N_labelattribute
Definition smyrnadefs.h:181
Agsym_t * N_pos
Definition smyrnadefs.h:175
Agsym_t * G_nodelabelcolor
Definition smyrnadefs.h:179
Agsym_t * N_selected
Definition smyrnadefs.h:178
Agsym_t * G_edgelabelcolor
Definition smyrnadefs.h:185
Agrec_t h
Definition smyrnadefs.h:174
Agsym_t * E_visible
Definition smyrnadefs.h:182
Agsym_t * E_selected
Definition smyrnadefs.h:183
Agsym_t * N_size
Definition smyrnadefs.h:176
Agsym_t * N_visible
Definition smyrnadefs.h:177
Agsym_t * GN_labelattribute
Definition smyrnadefs.h:180
Agsym_t * E_pos
Definition smyrnadefs.h:184
Agsym_t * GE_labelattribute
Definition smyrnadefs.h:187
Agsym_t * E_labelattribute
Definition smyrnadefs.h:186
Agrec_t h
Definition smyrnadefs.h:139
char * GraphFileName
Definition smyrnadefs.h:140
smyrna_view_mode mode
Definition smyrnadefs.h:128
glMouseButtonType type
Definition smyrnadefs.h:126
glCompPoint A
Definition smyrnadefs.h:147
float size
Definition smyrnadefs.h:148
int TVref
Definition smyrnadefs.h:152
int printLabel
Definition smyrnadefs.h:151
Agrec_t h
Definition smyrnadefs.h:146
int visible
Definition smyrnadefs.h:150
int selected
Definition smyrnadefs.h:149
xdot_op op
Definition smyrnadefs.h:84
glCompImage * img
Definition smyrnadefs.h:88
void * obj
Definition smyrnadefs.h:85
int layer
Definition smyrnadefs.h:87
glCompFont font
Definition smyrnadefs.h:86
Agraph_t * attrs_widgets
Definition smyrnadefs.h:243
Agraph_t * def_attrs
Definition smyrnadefs.h:242
graph_data Graphdata
Definition smyrnadefs.h:229
double global_z
Definition smyrnadefs.h:233
int animate
Definition smyrnadefs.h:223
Hierarchy * h
Definition smyrnadefs.h:222
topviewcache cache
Definition smyrnadefs.h:236
glCompColor srcColor
Definition smyrnadefs.h:224
reposition_t repos
Definition smyrnadefs.h:217
xdot * xDot
Definition smyrnadefs.h:232
focus_t * fs
Definition smyrnadefs.h:226
int active
Definition smyrnadefs.h:216
bool dist2_limit
Definition smyrnadefs.h:221
size_t Nodecount
Definition smyrnadefs.h:214
attr_list * attributes
Definition smyrnadefs.h:234
float fitin_zoom
Definition smyrnadefs.h:231
levelparms_t level
Definition smyrnadefs.h:218
selection sel
Definition smyrnadefs.h:237
glCompColor tarColor
Definition smyrnadefs.h:225
float maxedgelen
Definition smyrnadefs.h:230
unsigned selnode_id
Definition smyrnadefs.h:115
unsigned nodelabel_id
Definition smyrnadefs.h:117
unsigned node_id
Definition smyrnadefs.h:113
unsigned edge_id
Definition smyrnadefs.h:114
unsigned seledge_id
Definition smyrnadefs.h:116
unsigned edgelabel_id
Definition smyrnadefs.h:118
Definition xdot.h:166
Definition grammar.c:89
parsing and deparsing of xdot operations