33 #define ZOOMFACTOR 1.1
36 static char *s_digraph =
"digraph";
37 static char *s_graph =
"graph";
38 static char *s_subgraph =
"subgraph";
39 static char *s_node =
"node";
40 static char *s_edge =
"edge";
41 static char *s_tooltip =
"tooltip";
42 static char *s_href =
"href";
43 static char *s_URL =
"URL";
44 static char *s_tailport =
"tailport";
45 static char *s_headport =
"headport";
46 static char *s_key =
"key";
143 if (strcmp(a->
name,s_tailport) == 0)
145 else if (strcmp(a->
name,s_headport) == 0)
151 else if (strcmp(a->
name,s_key) == 0) {
168 static void gvevent_refresh(
GVJ_t * job)
175 gv_graph_state(job, g);
189 sg = gvevent_find_cluster(
GD_clust(g)[i], b);
215 sg = gvevent_find_cluster(g, b);
223 static void gvevent_leave_obj(
GVJ_t * job)
243 static void gvevent_enter_obj(
GVJ_t * job)
300 #define CLOSEENOUGH 1
302 static void gvevent_find_current_obj(
GVJ_t * job,
pointf pointer)
309 p = pointer2graph (job, pointer);
314 b.
UR.
x = p.
x + closeenough;
315 b.
UR.
y = p.
y + closeenough;
316 b.
LL.
x = p.
x - closeenough;
317 b.
LL.
y = p.
y - closeenough;
319 obj = gvevent_find_obj(job->
gvc->
g, b);
321 gvevent_leave_obj(job);
323 gvevent_enter_obj(job);
328 static void gvevent_select_current_obj(
GVJ_t * job)
360 gv_graph_state(job, (
graph_t*)obj);
364 gv_node_state(job, (
node_t*)obj);
368 gv_edge_state(job, (
edge_t*)obj);
379 fprintf(stderr,
"\n");
383 static void gvevent_button_press(
GVJ_t * job,
int button,
pointf pointer)
387 gvevent_find_current_obj(job, pointer);
388 gvevent_select_current_obj(job);
399 gvevent_find_current_obj(job, pointer);
444 static void gvevent_button_release(
GVJ_t *job,
int button,
pointf pointer)
450 static void gvevent_motion(
GVJ_t * job,
pointf pointer)
461 gvevent_find_current_obj(job, pointer);
483 static int quit_cb(
GVJ_t * job)
488 static int left_cb(
GVJ_t * job)
496 static int right_cb(
GVJ_t * job)
504 static int up_cb(
GVJ_t * job)
512 static int down_cb(
GVJ_t * job)
520 static int zoom_in_cb(
GVJ_t * job)
528 static int zoom_out_cb(
GVJ_t * job)
536 static int toggle_fit_cb(
GVJ_t * job)
547 int dflt_width, dflt_height;
548 dflt_width = job->
width;
549 dflt_height = job->
height;
551 MIN((
double) job->
width / (
double) dflt_width,
552 (
double) job->
height / (
double) dflt_height);
560 static void gvevent_modify (
GVJ_t * job,
const char *name,
const char *value)
565 static void gvevent_delete (
GVJ_t * job)
570 static void gvevent_read (
GVJ_t * job,
const char *filename,
const char *
layout)
582 f = fopen(filename,
"r");
612 static void gvevent_layout (
GVJ_t * job,
const char *layout)
617 static void gvevent_render (
GVJ_t * job,
const char *format,
const char *filename)
647 {
"KP_Left", left_cb},
649 {
"KP_Right", right_cb},
653 {
"KP_Down", down_cb},
654 {
"plus", zoom_in_cb},
655 {
"KP_Add", zoom_in_cb},
656 {
"minus", zoom_out_cb},
657 {
"KP_Subtract", zoom_out_cb},
658 {
"F", toggle_fit_cb},
665 gvevent_button_press,
666 gvevent_button_release,
CGRAPH_API int agobjkind(void *)
#define GUI_STATE_SELECTED
int gvRenderFilename(GVC_t *gvc, graph_t *g, const char *format, const char *filename)
bool layout(Agraph_t *g, const char *engine)
boolean overlap_edge(edge_t *e, boxf b)
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
gvplugin_active_layout_t layout
#define GUI_STATE_VISITED
CGRAPH_API Agnode_t * agprvnode(Agraph_t *g, Agnode_t *n)
CGRAPH_API int agisdirected(Agraph_t *g)
CGRAPH_API Agraph_t * agread(void *chan, Agdisc_t *disc)
int gvevent_key_binding_size
CGRAPH_API Agraph_t * agroot(void *obj)
CGRAPH_API Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
gvlayout_engine_t * engine
char * strdup_and_subst_obj(char *str, void *obj)
void(* cleanup)(graph_t *g)
CGRAPH_API Agraph_t * agraphof(void *obj)
CGRAPH_API Agnode_t * agtail(Agedge_t *e)
gvevent_key_binding_t gvevent_key_binding[]
gv_argvlist_t selected_obj_type_name
CGRAPH_API Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
CGRAPH_API Agnode_t * aghead(Agedge_t *e)
CGRAPH_API int agclose(Agraph_t *g)
CGRAPH_API char * agnameof(void *)
#define agfindedgeattr(g, a)
CGRAPH_API Agnode_t * aglstnode(Agraph_t *g)
gvdevice_callbacks_t gvdevice_callbacks
CGRAPH_API Agnode_t * agfstnode(Agraph_t *g)
CGRAPH_API void aginit(Agraph_t *g, int kind, char *rec_name, int rec_size, int move_to_front)
#define agfindgraphattr(g, a)
gv_argvlist_t selected_obj_attributes
int gvLayout(GVC_t *gvc, graph_t *g, const char *engine)
boolean has_been_rendered
void emit_graph(GVJ_t *job, graph_t *g)
boolean overlap_node(node_t *n, boxf b)
char * agxget(void *obj, Agsym_t *sym)
CGRAPH_API Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
#define agfindnodeattr(g, a)
void gv_argvlist_set_item(gv_argvlist_t *list, int index, char *item)