Graphviz 13.0.0~dev.20250121.0651
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
99 typedef struct {
100 size_t schemacount; // number of colors
103
111
112 typedef struct
113 {
114 unsigned node_id;
115 unsigned edge_id;
116 unsigned selnode_id;
117 unsigned seledge_id;
118 unsigned nodelabel_id;
119 unsigned edgelabel_id;
121
131
132 typedef struct _viewport_camera {
133 float x;
134 float y;
135
136 float targetx;
137 float targety;
138
139 float r;
141
146
147
148
149 typedef struct{
152 float size;
156 int TVref;
157 }nodeRec;
158#define NREC(n) ((nodeRec*)(aggetrec(n,"nodeRec",0)))
159#define ND_visible(n) (NREC(n)->visible)
160#define ND_selected(n) (NREC(n)->selected)
161#define ND_printLabel(n) (NREC(n)->printLabel)
162#define ND_A(n) (NREC(n)->A)
163#define ND_size(n) (NREC(n)->size)
164#define ND_TVref(n) (NREC(n)->TVref)
165
172#define EREC(e) ((edgeRec*)(aggetrec(e,"edgeRec",0)))
173#define ED_selected(e) (EREC(e)->selected)
174#define ED_posTail(e) (EREC(e)->posTail)
175#define ED_posHead(e) (EREC(e)->posHead)
176
193#define GREC(g) ((graphRec*)(AGDATA(g)))
194#define GN_pos(g) (GREC(g)->N_pos)
195#define GN_size(g) (GREC(g)->N_size)
196#define GN_visible(g) (GREC(g)->N_visible)
197#define GN_selected(g) (GREC(g)->N_selected)
198#define GG_nodelabelcolor(g) (GREC(g)->G_nodelabelcolor)
199#define GN_labelattribute(g) (GREC(g)->N_labelattribute)
200#define GG_labelattribute(g) (GREC(g)->GN_labelattribute)
201#define GE_pos(g) (GREC(g)->E_pos)
202#define GE_visible(g) (GREC(g)->E_visible)
203#define GE_selected(g) (GREC(g)->E_selected)
204#define GG_edgelabelcolor(g) (GREC(g)->G_edgelabelcolor)
205#define GE_labelattribute(g) (GREC(g)->E_labelattribute)
206#define GG_elabelattribute(g) (GREC(g)->GE_labelattribute)
207
208#define GUI_WINDOWED 0
209#define GUI_FULLSCREEN 1
210
211 typedef struct _selection {
212 glCompPoly_t selPoly;
216
217 typedef struct {
218 size_t Nodecount;
219 struct {
220 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
236 double global_z;
237 attr_list* attributes;/*attribute list*/
238
241
242 } topview;
243
248
249
250 typedef struct _ViewInfo {
252 /*view variables */
253 float panx;
254 float pany;
255 float zoom;
256
257 /*clipping coordinates, to avoid unnecesarry rendering */
259
260 /*background color */
262 /*default pen color */
264 /*default fill color */
266 /*grid color */
267 glCompColor gridColor; //grid color
268 /*border color */
270 /*selected node color */
272 /*default node alpha */
274
275 /*default line width */
277
278 /*grid is drawn if this variable is 1 */
280 /*grid cell size in gl coords system */
281 float gridSize; //grid cell size
282
283 /*draws a border in border colors if it is 1 */
284 int bdVisible; //if borders are visible (boundries of the drawing,
285 /*border coordinates, needs to be calculated for each graph */
286
289
290 /*screen window size in 2d */
291 int w, h;
292 /*graph pointer to hold loaded graphs */
294 /*number of graphs loaded */
296 /*active graph */
298
299 /*stores the info about status of mouse,pressed? what button ? where? */
301
305
307 GtkWidget *drawing_area;
308
309 /*Topview data structure, refer topview.h for more info */
311 /*timer for animations */
312 GTimer *timer;
313 /*this timer is session timer and always active */
314 GTimer *timer2;
315 /*general purpose timer */
316 GTimer *timer3;
319 /*lately added */
324
325 /*labelling properties */
326 void *glutfont;
332
333 glCompSet *widgets; //for novice user open gl menu
334 char *initFileName; //file name from command line
339 GtkComboBox *graphComboBox; /*pointer to graph combo box at top right */
341 int keyVal;
346 char* optArg;
347
349
350 extern ViewInfo *view;
351 extern char *smyrnaPath(char *suffix);
352
353 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:21
ViewInfo * view
Definition viewport.c:37
struct _graph_data graph_data
char * smyrnaPath(char *suffix)
Definition main.c:54
struct _viewport_camera viewport_camera
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:539
gvk_layout
Definition smyrnadefs.h:104
@ GVK_DOT
Definition smyrnadefs.h:105
@ GVK_NEATO
Definition smyrnadefs.h:106
@ GVK_CIRCO
Definition smyrnadefs.h:108
@ GVK_FDP
Definition smyrnadefs.h:109
@ GVK_TWOPI
Definition smyrnadefs.h:107
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:641
float bdxLeft
Definition smyrnadefs.h:287
int active_frame
Definition smyrnadefs.h:317
ArcBall_t * arcball
Definition smyrnadefs.h:340
topview * Topview
Definition smyrnadefs.h:310
int keyVal
depressed key or 0 if none
Definition smyrnadefs.h:341
int drawnodes
Definition smyrnadefs.h:320
Agraph_t ** g
Definition smyrnadefs.h:293
float pany
Definition smyrnadefs.h:254
int total_frames
Definition smyrnadefs.h:318
float LineWidth
Definition smyrnadefs.h:276
int drawnodelabels
Definition smyrnadefs.h:322
char * template_file
Definition smyrnadefs.h:338
int labelnumberofnodes
Definition smyrnadefs.h:329
float clipX2
Definition smyrnadefs.h:258
float bdyTop
Definition smyrnadefs.h:287
char * optArg
Definition smyrnadefs.h:346
int drawedges
Definition smyrnadefs.h:321
float nodeScale
Definition smyrnadefs.h:344
GtkComboBox * graphComboBox
Definition smyrnadefs.h:339
GTimer * timer
Definition smyrnadefs.h:312
glCompSet * widgets
Definition smyrnadefs.h:333
size_t camera_count
Definition smyrnadefs.h:303
size_t graphCount
Definition smyrnadefs.h:295
mouse_action_t * mouse_actions
customizable mouse interaction list
Definition smyrnadefs.h:342
glCompColor nodelabelcolor
Definition smyrnadefs.h:327
glCompColor fillColor
Definition smyrnadefs.h:265
glCompColor borderColor
Definition smyrnadefs.h:269
int labelshowedges
Definition smyrnadefs.h:331
colorschemaset colschms
Definition smyrnadefs.h:337
float gridSize
Definition smyrnadefs.h:281
char * initFileName
Definition smyrnadefs.h:334
glCompColor edgelabelcolor
Definition smyrnadefs.h:328
float panx
Definition smyrnadefs.h:253
GTimer * timer2
Definition smyrnadefs.h:314
int activeGraph
Definition smyrnadefs.h:297
glCompColor selectedNodeColor
Definition smyrnadefs.h:271
glCompColor bgColor
Definition smyrnadefs.h:261
viewport_camera ** cameras
Definition smyrnadefs.h:302
int drawSplines
Definition smyrnadefs.h:336
int labelshownodes
Definition smyrnadefs.h:330
size_t mouse_action_count
Definition smyrnadefs.h:343
GtkWidget * drawing_area
open gl canvas
Definition smyrnadefs.h:307
float bdxRight
Definition smyrnadefs.h:288
float bdyBottom
Definition smyrnadefs.h:288
systemgraphs systemGraphs
Definition smyrnadefs.h:251
int gridVisible
Definition smyrnadefs.h:279
float zoom
Definition smyrnadefs.h:255
int bdVisible
Definition smyrnadefs.h:284
int drawedgelabels
Definition smyrnadefs.h:323
glCompMouse mouse
Definition smyrnadefs.h:300
float clipY1
Definition smyrnadefs.h:258
GTimer * timer3
Definition smyrnadefs.h:316
float clipX1
Definition smyrnadefs.h:258
glCompColor gridColor
Definition smyrnadefs.h:267
float clipY2
Definition smyrnadefs.h:258
glCompColor penColor
Definition smyrnadefs.h:263
size_t active_camera
<number of cameras
Definition smyrnadefs.h:304
float defaultnodealpha
Definition smyrnadefs.h:273
void * glutfont
Definition smyrnadefs.h:326
char * GraphFileName
Definition smyrnadefs.h:144
Agrec_t h
Definition smyrnadefs.h:143
glCompPoly_t selPoly
Definition smyrnadefs.h:212
bool selectEdges
Definition smyrnadefs.h:214
bool selectNodes
Definition smyrnadefs.h:213
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
colorschema * s
Definition smyrnadefs.h:101
size_t schemacount
Definition smyrnadefs.h:100
glCompPoint posTail
Definition smyrnadefs.h:168
Agrec_t h
Definition smyrnadefs.h:167
int selected
Definition smyrnadefs.h:170
glCompPoint posHead
Definition smyrnadefs.h:169
Definition hier.h:15
Agsym_t * N_labelattribute
Definition smyrnadefs.h:185
Agsym_t * N_pos
Definition smyrnadefs.h:179
Agsym_t * G_nodelabelcolor
Definition smyrnadefs.h:183
Agsym_t * N_selected
Definition smyrnadefs.h:182
Agsym_t * G_edgelabelcolor
Definition smyrnadefs.h:189
Agrec_t h
Definition smyrnadefs.h:178
Agsym_t * E_visible
Definition smyrnadefs.h:186
Agsym_t * E_selected
Definition smyrnadefs.h:187
Agsym_t * N_size
Definition smyrnadefs.h:180
Agsym_t * N_visible
Definition smyrnadefs.h:181
Agsym_t * GN_labelattribute
Definition smyrnadefs.h:184
Agsym_t * E_pos
Definition smyrnadefs.h:188
Agsym_t * GE_labelattribute
Definition smyrnadefs.h:191
Agsym_t * E_labelattribute
Definition smyrnadefs.h:190
smyrna_view_mode mode
Definition smyrnadefs.h:129
glMouseButtonType type
Definition smyrnadefs.h:127
glCompPoint A
Definition smyrnadefs.h:151
float size
Definition smyrnadefs.h:152
int TVref
Definition smyrnadefs.h:156
int printLabel
Definition smyrnadefs.h:155
Agrec_t h
Definition smyrnadefs.h:150
int visible
Definition smyrnadefs.h:154
int selected
Definition smyrnadefs.h:153
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:246
Agraph_t * def_attrs
Definition smyrnadefs.h:245
graph_data Graphdata
Definition smyrnadefs.h:231
double global_z
Definition smyrnadefs.h:236
hierparms_t hier
Definition smyrnadefs.h:223
int animate
Definition smyrnadefs.h:225
Hierarchy * h
Definition smyrnadefs.h:224
topviewcache cache
Definition smyrnadefs.h:239
glCompColor srcColor
Definition smyrnadefs.h:226
reposition_t repos
Definition smyrnadefs.h:221
xdot * xDot
Definition smyrnadefs.h:235
focus_t * fs
Definition smyrnadefs.h:228
int active
Definition smyrnadefs.h:220
size_t Nodecount
Definition smyrnadefs.h:218
float minedgelen
Definition smyrnadefs.h:233
attr_list * attributes
Definition smyrnadefs.h:237
float fitin_zoom
Definition smyrnadefs.h:234
levelparms_t level
Definition smyrnadefs.h:222
selection sel
Definition smyrnadefs.h:240
glCompColor tarColor
Definition smyrnadefs.h:227
float maxedgelen
Definition smyrnadefs.h:232
unsigned selnode_id
Definition smyrnadefs.h:116
unsigned nodelabel_id
Definition smyrnadefs.h:118
unsigned node_id
Definition smyrnadefs.h:114
unsigned edge_id
Definition smyrnadefs.h:115
unsigned seledge_id
Definition smyrnadefs.h:117
unsigned edgelabel_id
Definition smyrnadefs.h:119
Definition xdot.h:166
parsing and deparsing of xdot operations