summaryrefslogtreecommitdiff
path: root/snd-axis.c
diff options
context:
space:
mode:
authorAlessio Treglia <alessio@debian.org>2011-03-24 09:13:51 +0100
committerAlessio Treglia <alessio@debian.org>2011-03-24 09:13:51 +0100
commite5328e59987b90c4e98959510b810510e384650d (patch)
tree0f140b79d942c4654701d8fb4cfe2f1dd904f9f0 /snd-axis.c
parent36cf8384e5699cda3f1ca607753fe4d4a8515b01 (diff)
Imported Upstream version 12.0
Diffstat (limited to 'snd-axis.c')
-rw-r--r--snd-axis.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/snd-axis.c b/snd-axis.c
index 78e5a81..8ff8b98 100644
--- a/snd-axis.c
+++ b/snd-axis.c
@@ -1,6 +1,5 @@
#include "snd.h"
-
bool x_axis_style_p(int n)
{
switch (n)
@@ -286,7 +285,7 @@ axis_info *free_axis_info(axis_info *ap)
if (!ap) return(NULL);
if (ap->x_ticks) ap->x_ticks = free_tick_descriptor(ap->x_ticks);
if (ap->y_ticks) ap->y_ticks = free_tick_descriptor(ap->y_ticks);
- /* leave ap->ax alone -- it actually belongs to cp->cgx */
+ /* leave ap->ax alone -- it actually belongs to cp */
if (ap->xlabel)
{
free(ap->xlabel);
@@ -452,9 +451,9 @@ static void draw_horizontal_grid_line(int y, axis_info *ap, graphics_context *ax
{
color_t old_color;
old_color = get_foreground_color(ax);
- if (ap->cp->cgx->selected)
- set_foreground_color(ax, ss->sgx->selected_grid_color);
- else set_foreground_color(ax, ss->sgx->grid_color);
+ if (ap->cp->selected)
+ set_foreground_color(ax, ss->selected_grid_color);
+ else set_foreground_color(ax, ss->grid_color);
draw_line(ax, ap->y_axis_x0, y, ap->x_axis_x1, y);
set_foreground_color(ax, old_color);
}
@@ -464,9 +463,9 @@ static void draw_vertical_grid_line(int x, axis_info *ap, graphics_context *ax)
{
color_t old_color;
old_color = get_foreground_color(ax);
- if (ap->cp->cgx->selected)
- set_foreground_color(ax, ss->sgx->selected_grid_color);
- else set_foreground_color(ax, ss->sgx->grid_color);
+ if (ap->cp->selected)
+ set_foreground_color(ax, ss->selected_grid_color);
+ else set_foreground_color(ax, ss->grid_color);
draw_line(ax, x, ap->x_axis_y0, x, ap->y_axis_y1);
set_foreground_color(ax, old_color);
}
@@ -563,7 +562,7 @@ static void use_tiny(graphics_context *ax, printing_t printing)
}
-static void set_numbers_font(graphics_context *ax, printing_t printing, bool use_tiny_font)
+void set_numbers_font(graphics_context *ax, printing_t printing, bool use_tiny_font)
{
if (use_tiny_font)
use_tiny(ax, printing);
@@ -1630,7 +1629,6 @@ Returns actual (pixel) axis bounds -- a list (x0 y0 x1 y1)."
#if USE_GTK
GtkWidget *w;
gc_t *gc;
- cairo_t *cr = NULL;
#endif
XEN val, xwid, xgc, xx0, xx1, xy0, xy1, xstyle, xaxes, label_ref;
@@ -1704,23 +1702,25 @@ Returns actual (pixel) axis bounds -- a list (x0 y0 x1 y1)."
axes = (show_axes_t)XEN_TO_C_INT(xaxes);
#if USE_GTK
if (len > 9)
- cr = (cairo_t *)XEN_UNWRAP_C_POINTER(XEN_CADR(XEN_LIST_REF(args, 9)));
+ ss->cr = (cairo_t *)XEN_UNWRAP_C_POINTER(XEN_CADR(XEN_LIST_REF(args, 9)));
#endif
}}}}}}
ap = (axis_info *)calloc(1, sizeof(axis_info));
ax = (graphics_context *)calloc(1, sizeof(graphics_context));
ap->ax = ax;
+
#if USE_MOTIF
ax->dp = XtDisplay(w);
ax->wn = XtWindow(w);
#endif
+
#if USE_GTK
ax->wn = WIDGET_TO_WINDOW(w);
ax->w = w;
- if (cr)
- ax->cr = cr;
- else ax->cr = gdk_cairo_create(ax->wn);
+ if (!ss->cr)
+ XEN_ERROR(XEN_ERROR_TYPE("no-cairo-t"),
+ XEN_LIST_1(C_TO_XEN_STRING(S_draw_axes ": in Gtk, the trailing cairo_t argument is not optional")));
#endif
ap->xmin = x0;
@@ -1751,11 +1751,7 @@ Returns actual (pixel) axis bounds -- a list (x0 y0 x1 y1)."
XEN_CONS(C_TO_XEN_INT(ap->y_axis_y1),
XEN_EMPTY_LIST))));
-#if USE_GTK
- if (!cr) cairo_destroy(ax->cr);
-#endif
free_axis_info(ap);
-
return(val);
}