int alloc;
} gv_argvlist_t;
+ typedef struct gvdevice_callbacks_s {
+ void (*refresh) (GVJ_t * job);
+ void (*button_press) (GVJ_t * job, int button, pointf pointer);
+ void (*button_release) (GVJ_t * job, int button, pointf pointer);
+ void (*motion) (GVJ_t * job, pointf pointer);
+ void (*modify) (GVJ_t * job, char *name, char *value);
+ } gvdevice_callbacks_t;
+
struct GVJ_s {
GVJ_t *next; /* linked list of jobs */
GVJ_t *next_active; /* linked list of active jobs (e.g. multiple windows) */
FILE *output_file;
int output_lang;
- gvplugin_active_device_t device;
gvplugin_active_render_t render;
+ gvplugin_active_device_t device;
+ gvdevice_callbacks_t *callbacks;
#ifndef DISABLE_CODEGENS
codegen_t *codegen; /* current codegen */
return features;
}
+extern gvdevice_callbacks_t gvdevice_callbacks;
+
void gvdevice_finalize(GVC_t * gvc)
{
GVJ_t *job = gvc->active_jobs;
gvdevice_engine_t *gvde = job->device.engine;
if (gvde) {
- if (gvde->finalize)
+ if (gvde->finalize) {
+ job->callbacks = &gvdevice_callbacks;
gvde->finalize(gvc);
+ }
}
#ifndef DISABLE_CODEGENS
else {
#define ZOOMFACTOR 1.1
#define EPSILON .0001
-void gvevent_refresh(GVJ_t * job)
+static void gvevent_refresh(GVJ_t * job)
{
emit_graph(job, job->g);
}
}
}
-#if 0
+#if 1
for (i = 0; i < job->selected_obj_type_name.argc; i++)
fprintf(stderr,"%s%s", job->selected_obj_type_name.argv[i],
(i==(job->selected_obj_type_name.argc - 1))?"\n":" ");
#endif
}
-void gvevent_button_press(GVJ_t * job, int button, pointf pointer)
+static void gvevent_button_press(GVJ_t * job, int button, pointf pointer)
{
switch (button) {
case 1: /* select / create in edit mode */
job->oldpointer = pointer;
}
-void gvevent_motion(GVJ_t * job, pointf pointer)
+static void gvevent_button_release(GVJ_t *job, int button, pointf pointer)
+{
+ job->click = 0;
+ job->active = 0;
+}
+
+static void gvevent_motion(GVJ_t * job, pointf pointer)
{
double dx = pointer.x - job->oldpointer.x;
double dy = pointer.y - job->oldpointer.y;
job->oldpointer = pointer;
}
-void gvevent_button_release(GVJ_t *job, int button, pointf pointer)
-{
- job->click = 0;
- job->active = 0;
-}
-
static int quit_cb(GVJ_t * job)
{
return 1;
};
int gvevent_key_binding_size = ARRAY_SIZE(gvevent_key_binding);
+
+gvdevice_callbacks_t gvdevice_callbacks = {
+ gvevent_refresh,
+ gvevent_button_press,
+ gvevent_button_release,
+ gvevent_motion,
+ NULL,
+};
void (*finalize) (GVC_t * gvc);
};
-/* callbacks */
- extern void gvevent_refresh(GVJ_t * job);
- extern void gvevent_button_press(GVJ_t * job, int button, pointf pointer);
- extern void gvevent_button_release(GVJ_t * job, int button, pointf pointer);
- extern void gvevent_motion(GVJ_t * job, pointf pointer);
-
-
#ifdef __cplusplus
}
#endif