C99 `bool` instead of a Graphviz-specific `boolean`.
- **Breaking**: The `must_inline` and `nocache` fields of the `usershape_t`
struct are now C99 `bool`s instead of Graphviz-specific `boolean`s.
-- **Breaking**: The `device_sets_dpi` and `external_context` fields of the
+- **Breaking**: The `device_sets_dpi`, `external_context`, `fit_mode`,
+ `needs_refresh`, `click`, `has_grown`, and `has_been_rendered` fields of the
`GVJ_t` struct are now C99 `bool`s instead of Graphviz-specific `boolean`s.
- **Breaking**: 1-bit fields of the `obj_state_s` struct are now unsigned
instead of signed.
pointf translation; /* composite translation */
pointf devscale; /* composite device to points: dpi, y_goes_down */
- boolean fit_mode,
+ bool fit_mode,
needs_refresh,
click,
has_grown,
#include "config.h"
#include <string.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <math.h>
gv_graph_state(job, g);
}
emit_graph(job, g);
- job->has_been_rendered = TRUE;
+ job->has_been_rendered = true;
}
/* recursively find innermost cluster containing the point */
gvevent_leave_obj(job);
job->current_obj = obj;
gvevent_enter_obj(job);
- job->needs_refresh = 1;
+ job->needs_refresh = true;
}
}
case 1: /* select / create in edit mode */
gvevent_find_current_obj(job, pointer);
gvevent_select_current_obj(job);
- job->click = 1;
+ job->click = true;
job->button = button;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
case 2: /* pan */
- job->click = 1;
+ job->click = true;
job->button = button;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
case 3: /* insert node or edge */
gvevent_find_current_obj(job, pointer);
- job->click = 1;
+ job->click = true;
job->button = button;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
case 4:
/* scrollwheel zoom in at current mouse x,y */
/* FIXME - should code window 0,0 point as feature with Y_GOES_DOWN */
- job->fit_mode = 0;
+ job->fit_mode = false;
if (job->rotation) {
job->focus.x -= (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
}
job->zoom *= ZOOMFACTOR;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
case 5: /* scrollwheel zoom out at current mouse x,y */
- job->fit_mode = 0;
+ job->fit_mode = false;
job->zoom /= ZOOMFACTOR;
if (job->rotation) {
job->focus.x += (pointer.y - job->height / 2.)
job->focus.y -= (pointer.y - job->height / 2.)
* (ZOOMFACTOR - 1.) / (job->zoom * job->devscale.y);
}
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
}
job->oldpointer = pointer;
static void gvevent_button_release(GVJ_t *job, int button, pointf pointer)
{
- job->click = 0;
- job->button = 0;
+ job->click = false;
+ job->button = false;
}
static void gvevent_motion(GVJ_t * job, pointf pointer)
job->focus.x -= dx / job->zoom;
job->focus.y -= dy / job->zoom;
}
- job->needs_refresh = 1;
+ job->needs_refresh = true;
break;
case 3: /* drag with button 3 - drag inserted node or uncompleted edge */
break;
static int left_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->focus.x += PANFACTOR / job->zoom;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
static int right_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->focus.x -= PANFACTOR / job->zoom;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
static int up_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->focus.y += -(PANFACTOR / job->zoom);
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
static int down_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->focus.y -= -(PANFACTOR / job->zoom);
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
static int zoom_in_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->zoom *= ZOOMFACTOR;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
static int zoom_out_cb(GVJ_t * job)
{
- job->fit_mode = 0;
+ job->fit_mode = false;
job->zoom /= ZOOMFACTOR;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
return 0;
}
(double) job->height / (double) dflt_height);
job->focus.x = 0.0;
job->focus.y = 0.0;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
}
return 0;
}
return; /* FIXME - need some error handling */
job->selected_obj = NULL;
job->current_obj = NULL;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
}
static void gvevent_layout (GVJ_t * job, const char *layout)
job->zoom *= zoom_to_fit;
}
if (event->width > job->width || event->height > job->height)
- job->has_grown = TRUE;
+ job->has_grown = true;
job->width = event->width;
job->height = event->height;
- job->needs_refresh = TRUE;
+ job->needs_refresh = true;
return FALSE;
}
job->zoom = MIN((double) cev->width / (double) job->width,
(double) cev->height / (double) job->height);
if (cev->width > job->width || cev->height > job->height)
- job->has_grown = 1;
+ job->has_grown = true;
job->width = cev->width;
job->height = cev->height;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
}
static void handle_expose(GVJ_t * job, XExposeEvent * eev)
XFreePixmap(dpy, window->pix);
window->pix = XCreatePixmap(dpy, window->win,
job->width, job->height, window->depth);
- job->has_grown = 0;
- job->needs_refresh = 1;
+ job->has_grown = false;
+ job->needs_refresh = true;
}
if (job->needs_refresh) {
XFillRectangle(dpy, window->pix, window->gc, 0, 0,
cairo_surface_destroy(surface);
XCopyArea(dpy, window->pix, window->win, window->gc,
0, 0, job->width, job->height, 0, 0);
- job->needs_refresh = 0;
+ job->needs_refresh = false;
}
}
return;
}
job->window = (void *)window;
- job->fit_mode = 0;
- job->needs_refresh = 1;
+ job->fit_mode = false;
+ job->needs_refresh = true;
if (argb && (window->visual = find_argb_visual(dpy, scr))) {
window->cmap = XCreateColormap(dpy, RootWindow(dpy, scr),
job->zoom *= zoom_to_fit;
}
if (event->width > job->width || event->height > job->height)
- job->has_grown = TRUE;
+ job->has_grown = true;
job->width = event->width;
job->height = event->height;
- job->needs_refresh = TRUE;
+ job->needs_refresh = true;
return FALSE;
}
((double) cev->width - (double) job->width) / (double) job->width,
((double) cev->height - (double) job->height) / (double) job->height);
if (cev->width > job->width || cev->height > job->height)
- job->has_grown = 1;
+ job->has_grown = true;
job->width = cev->width;
job->height = cev->height;
- job->needs_refresh = 1;
+ job->needs_refresh = true;
}
static void handle_expose(GVJ_t * job, XExposeEvent * eev)
XFreePixmap(dpy, window->pix);
window->pix = XCreatePixmap(dpy, window->win,
job->width, job->height, window->depth);
- job->has_grown = 0;
- job->needs_refresh = 1;
+ job->has_grown = false;
+ job->needs_refresh = true;
}
if (job->needs_refresh) {
XFillRectangle(dpy, window->pix, window->gc, 0, 0,
cairo_surface_destroy(surface);
XCopyArea(dpy, window->pix, window->win, window->gc,
0, 0, job->width, job->height, 0, 0);
- job->needs_refresh = 0;
+ job->needs_refresh = false;
}
}
job->height = h;
job->window = window;
- job->fit_mode = 0;
- job->needs_refresh = 1;
+ job->fit_mode = false;
+ job->needs_refresh = true;
if (argb && (window->visual = find_argb_visual(dpy, scr))) {
window->cmap = XCreateColormap(dpy, RootWindow(dpy, scr),