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