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