Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
gvevent.c File Reference
#include "config.h"
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
#include <gvc/gvplugin_layout.h>
#include <gvc/gvcint.h>
#include <gvc/gvcproc.h>
#include <common/utils.h>
Include dependency graph for gvevent.c:

Go to the source code of this file.

Macros

#define PANFACTOR   10
 
#define ZOOMFACTOR   1.1
 
#define EPSILON   .0001
 
#define CLOSEENOUGH   1
 

Functions

void emit_graph (GVJ_t *job, graph_t *g)
 
int gvLayout (GVC_t *gvc, graph_t *g, const char *engine)
 
int gvRenderFilename (GVC_t *gvc, graph_t *g, const char *format, const char *filename)
 
void graph_cleanup (graph_t *g)
 
static void gv_graph_state (GVJ_t *job, graph_t *g)
 
static void gv_node_state (GVJ_t *job, node_t *n)
 
static void gv_edge_state (GVJ_t *job, edge_t *e)
 
static void gvevent_refresh (GVJ_t *job)
 
static graph_tgvevent_find_cluster (graph_t *g, boxf b)
 
static void * gvevent_find_obj (graph_t *g, boxf b)
 
static void gvevent_leave_obj (GVJ_t *job)
 
static void gvevent_enter_obj (GVJ_t *job)
 
static pointf pointer2graph (GVJ_t *job, pointf pointer)
 
static void gvevent_find_current_obj (GVJ_t *job, pointf pointer)
 
static void gvevent_select_current_obj (GVJ_t *job)
 
static void gvevent_button_press (GVJ_t *job, int button, pointf pointer)
 
static void gvevent_button_release (GVJ_t *job, int button, pointf pointer)
 
static void gvevent_motion (GVJ_t *job, pointf pointer)
 
static int quit_cb (GVJ_t *job)
 
static int left_cb (GVJ_t *job)
 
static int right_cb (GVJ_t *job)
 
static int up_cb (GVJ_t *job)
 
static int down_cb (GVJ_t *job)
 
static int zoom_in_cb (GVJ_t *job)
 
static int zoom_out_cb (GVJ_t *job)
 
static int toggle_fit_cb (GVJ_t *job)
 
static void gvevent_read (GVJ_t *job, const char *filename, const char *layout)
 
static void gvevent_layout (GVJ_t *job, const char *layout)
 
static void gvevent_render (GVJ_t *job, const char *format, const char *filename)
 

Variables

static char * s_tooltip = "tooltip"
 
static char * s_href = "href"
 
static char * s_URL = "URL"
 
gvevent_key_binding_t gvevent_key_binding []
 
const size_t gvevent_key_binding_size
 
gvdevice_callbacks_t gvdevice_callbacks
 

Macro Definition Documentation

◆ CLOSEENOUGH

#define CLOSEENOUGH   1

Definition at line 193 of file gvevent.c.

◆ EPSILON

#define EPSILON   .0001

Definition at line 30 of file gvevent.c.

◆ PANFACTOR

#define PANFACTOR   10

Definition at line 28 of file gvevent.c.

◆ ZOOMFACTOR

#define ZOOMFACTOR   1.1

Definition at line 29 of file gvevent.c.

Function Documentation

◆ down_cb()

static int down_cb ( GVJ_t job)
static

◆ emit_graph()

void emit_graph ( GVJ_t job,
graph_t g 
)
extern

Definition at line 3390 of file emit.c.

References agattr(), agfstnode(), agnxtnode(), AGRAPH, GVJ_s::devscale, GVJ_s::dpi, emit_begin_graph(), emit_colors(), EMIT_COLORS, emit_end_graph(), emit_page(), firstlayer(), firstpage(), flags, GVJ_s::flags, gvrender_begin_layer(), gvrender_comment(), gvrender_end_layer(), GVRENDER_Y_GOES_DOWN, GVJ_s::height, late_string(), GVJ_s::layerNum, ND_state, nextlayer(), nextpage(), numPhysicalLayers(), POINTS_PER_INCH, GVJ_s::rotation, GVJ_s::scale, validlayer(), validpage(), GVJ_s::view, GVJ_s::width, pointf_s::x, pointf_s::y, Y_invert, and GVJ_s::zoom.

Referenced by gvevent_refresh(), and gvRenderJobs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ graph_cleanup()

void graph_cleanup ( graph_t g)
extern

Definition at line 798 of file input.c.

Referenced by gvevent_read().

Here is the caller graph for this function:

◆ gv_edge_state()

static void gv_edge_state ( GVJ_t job,
edge_t e 
)
static

Definition at line 54 of file gvevent.c.

References agfindedgeattr, aghead, agraphof(), agxget(), s_href, s_URL, GVJ_s::selected_href, and strdup_and_subst_obj().

Referenced by gvevent_select_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gv_graph_state()

static void gv_graph_state ( GVJ_t job,
graph_t g 
)
static

Definition at line 36 of file gvevent.c.

References agfindgraphattr, agxget(), s_href, s_URL, GVJ_s::selected_href, and strdup_and_subst_obj().

Referenced by gvevent_refresh(), and gvevent_select_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gv_node_state()

static void gv_node_state ( GVJ_t job,
node_t n 
)
static

Definition at line 45 of file gvevent.c.

References agfindnodeattr, agraphof(), agxget(), s_href, s_URL, GVJ_s::selected_href, and strdup_and_subst_obj().

Referenced by gvevent_select_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_button_press()

static void gvevent_button_press ( GVJ_t job,
int  button,
pointf  pointer 
)
static

Definition at line 265 of file gvevent.c.

References GVJ_s::button, GVJ_s::click, GVJ_s::devscale, GVJ_s::fit_mode, GVJ_s::focus, gvevent_find_current_obj(), gvevent_select_current_obj(), GVJ_s::height, GVJ_s::needs_refresh, GVJ_s::oldpointer, GVJ_s::rotation, GVJ_s::width, pointf_s::x, pointf_s::y, GVJ_s::zoom, and ZOOMFACTOR.

Here is the call graph for this function:

◆ gvevent_button_release()

static void gvevent_button_release ( GVJ_t job,
int  button,
pointf  pointer 
)
static

Definition at line 326 of file gvevent.c.

References GVJ_s::button, and GVJ_s::click.

◆ gvevent_enter_obj()

static void gvevent_enter_obj ( GVJ_t job)
static

Definition at line 138 of file gvevent.c.

References GVJ_s::active_tooltip, AGEDGE, agfindedgeattr, agfindgraphattr, agfindnodeattr, aghead, AGNODE, agobjkind(), AGRAPH, agraphof(), agxget(), GVJ_s::current_obj, ED_gui_state, free(), GD_gui_state, GUI_STATE_ACTIVE, ND_gui_state, NULL, s_tooltip, and strdup_and_subst_obj().

Referenced by gvevent_find_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_find_cluster()

static graph_t * gvevent_find_cluster ( graph_t g,
boxf  b 
)
static

Definition at line 77 of file gvevent.c.

References B2BF, GD_bb, GD_clust, GD_n_cluster, gvevent_find_cluster(), NULL, and OVERLAP.

Referenced by gvevent_find_cluster(), and gvevent_find_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_find_current_obj()

static void gvevent_find_current_obj ( GVJ_t job,
pointf  pointer 
)
static

Definition at line 195 of file gvevent.c.

References CLOSEENOUGH, GVJ_s::current_obj, GVC_s::g, GVJ_s::gvc, gvevent_enter_obj(), gvevent_find_obj(), gvevent_leave_obj(), boxf::LL, GVJ_s::needs_refresh, pointer2graph(), boxf::UR, pointf_s::x, pointf_s::y, and GVJ_s::zoom.

Referenced by gvevent_button_press(), and gvevent_motion().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_find_obj()

static void * gvevent_find_obj ( graph_t g,
boxf  b 
)
static

Definition at line 94 of file gvevent.c.

References agfstnode(), agfstout(), aglstnode(), agnxtnode(), agnxtout(), agprvnode(), gvevent_find_cluster(), overlap_edge(), and overlap_node().

Referenced by gvevent_find_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_layout()

static void gvevent_layout ( GVJ_t job,
const char *  layout 
)
static

Definition at line 488 of file gvevent.c.

References GVC_s::g, GVJ_s::gvc, gvLayout(), and layout().

Here is the call graph for this function:

◆ gvevent_leave_obj()

static void gvevent_leave_obj ( GVJ_t job)
static

Definition at line 118 of file gvevent.c.

References GVJ_s::active_tooltip, AGEDGE, AGNODE, agobjkind(), AGRAPH, GVJ_s::current_obj, ED_gui_state, GD_gui_state, GUI_STATE_ACTIVE, ND_gui_state, and NULL.

Referenced by gvevent_find_current_obj().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gvevent_motion()

static void gvevent_motion ( GVJ_t job,
pointf  pointer 
)
static

Definition at line 335 of file gvevent.c.

References GVJ_s::button, GVJ_s::devscale, dx, dy, EPSILON, GVJ_s::focus, gvevent_find_current_obj(), GVJ_s::needs_refresh, GVJ_s::oldpointer, GVJ_s::rotation, pointf_s::x, pointf_s::y, and GVJ_s::zoom.

Here is the call graph for this function:

◆ gvevent_read()

static void gvevent_read ( GVJ_t job,
const char *  filename,
const char *  layout 
)
static

Definition at line 446 of file gvevent.c.

References agclose(), AGEDGE, aginit(), AGNODE, AGRAPH, agread(), gvlayout_engine_s::cleanup, GVJ_s::current_obj, gvplugin_active_layout_s::engine, GVC_s::g, GD_gvc, graph_cleanup(), gvc, GVJ_s::gvc, gvLayout(), layout(), GVC_s::layout, GVJ_s::needs_refresh, NULL, and GVJ_s::selected_obj.

Here is the call graph for this function:

◆ gvevent_refresh()

static void gvevent_refresh ( GVJ_t job)
static

Definition at line 63 of file gvevent.c.

References emit_graph(), GVC_s::g, GD_gui_state, GUI_STATE_SELECTED, gv_graph_state(), GVJ_s::gvc, GVJ_s::has_been_rendered, and GVJ_s::selected_obj.

Here is the call graph for this function:

◆ gvevent_render()

static void gvevent_render ( GVJ_t job,
const char *  format,
const char *  filename 
)
static

Definition at line 493 of file gvevent.c.

References GVC_s::active_jobs, format, GVC_s::g, GVJ_s::gvc, gvRenderFilename(), GVC_s::job, GVC_s::jobs, and NULL.

Here is the call graph for this function:

◆ gvevent_select_current_obj()

static void gvevent_select_current_obj ( GVJ_t job)
static

Definition at line 221 of file gvevent.c.

References AGEDGE, AGNODE, agobjkind(), AGRAPH, GVJ_s::current_obj, ED_gui_state, free(), GD_gui_state, GUI_STATE_SELECTED, GUI_STATE_VISITED, gv_edge_state(), gv_graph_state(), gv_node_state(), ND_gui_state, NULL, GVJ_s::selected_href, and GVJ_s::selected_obj.

Referenced by gvevent_button_press().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ left_cb()

static int left_cb ( GVJ_t job)
static

◆ pointer2graph()

static pointf pointer2graph ( GVJ_t job,
pointf  pointer 
)
static

Definition at line 176 of file gvevent.c.

References GVJ_s::devscale, GVJ_s::rotation, GVJ_s::translation, pointf_s::x, pointf_s::y, and GVJ_s::zoom.

Referenced by gvevent_find_current_obj().

Here is the caller graph for this function:

◆ quit_cb()

static int quit_cb ( GVJ_t job)
static

Definition at line 368 of file gvevent.c.

◆ right_cb()

static int right_cb ( GVJ_t job)
static

◆ toggle_fit_cb()

static int toggle_fit_cb ( GVJ_t job)
static

◆ up_cb()

static int up_cb ( GVJ_t job)
static

◆ zoom_in_cb()

static int zoom_in_cb ( GVJ_t job)
static

Definition at line 407 of file gvevent.c.

References GVJ_s::fit_mode, GVJ_s::needs_refresh, GVJ_s::zoom, and ZOOMFACTOR.

◆ zoom_out_cb()

static int zoom_out_cb ( GVJ_t job)
static

Definition at line 415 of file gvevent.c.

References GVJ_s::fit_mode, GVJ_s::needs_refresh, GVJ_s::zoom, and ZOOMFACTOR.

Variable Documentation

◆ gvdevice_callbacks

gvdevice_callbacks_t gvdevice_callbacks
Initial value:
= {
NULL,
NULL,
}
node NULL
Definition grammar.y:149
static void gvevent_render(GVJ_t *job, const char *format, const char *filename)
Definition gvevent.c:493
static void gvevent_read(GVJ_t *job, const char *filename, const char *layout)
Definition gvevent.c:446
static void gvevent_button_press(GVJ_t *job, int button, pointf pointer)
Definition gvevent.c:265
static void gvevent_motion(GVJ_t *job, pointf pointer)
Definition gvevent.c:335
static void gvevent_refresh(GVJ_t *job)
Definition gvevent.c:63
static void gvevent_layout(GVJ_t *job, const char *layout)
Definition gvevent.c:488
static void gvevent_button_release(GVJ_t *job, int button, pointf pointer)
Definition gvevent.c:326

Definition at line 540 of file gvevent.c.

Referenced by gvRenderJobs().

◆ gvevent_key_binding

gvevent_key_binding_t gvevent_key_binding[]
Initial value:
= {
{"Q", quit_cb},
{"Left", left_cb},
{"KP_Left", left_cb},
{"Right", right_cb},
{"KP_Right", right_cb},
{"Up", up_cb},
{"KP_Up", up_cb},
{"Down", down_cb},
{"KP_Down", down_cb},
{"plus", zoom_in_cb},
{"KP_Add", zoom_in_cb},
{"minus", zoom_out_cb},
{"KP_Subtract", zoom_out_cb},
{"F", toggle_fit_cb},
}
static int quit_cb(GVJ_t *job)
Definition gvevent.c:368
static int up_cb(GVJ_t *job)
Definition gvevent.c:391
static int toggle_fit_cb(GVJ_t *job)
Definition gvevent.c:423
static int right_cb(GVJ_t *job)
Definition gvevent.c:383
static int zoom_out_cb(GVJ_t *job)
Definition gvevent.c:415
static int down_cb(GVJ_t *job)
Definition gvevent.c:399
static int left_cb(GVJ_t *job)
Definition gvevent.c:375
static int zoom_in_cb(GVJ_t *job)
Definition gvevent.c:407

Definition at line 520 of file gvevent.c.

Referenced by gvRenderJobs().

◆ gvevent_key_binding_size

const size_t gvevent_key_binding_size
Initial value:
=
gvevent_key_binding_t gvevent_key_binding[]
Definition gvevent.c:520

Definition at line 537 of file gvevent.c.

Referenced by gvRenderJobs().

◆ s_href

char* s_href = "href"
static

Definition at line 33 of file gvevent.c.

Referenced by gv_edge_state(), gv_graph_state(), and gv_node_state().

◆ s_tooltip

char* s_tooltip = "tooltip"
static

Definition at line 32 of file gvevent.c.

Referenced by gvevent_enter_obj().

◆ s_URL

char* s_URL = "URL"
static

Definition at line 34 of file gvevent.c.

Referenced by gv_edge_state(), gv_graph_state(), and gv_node_state().