[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: pcb.git: branch: master updated (94f89cd66dfe9057f1dd44f98ed85a9696c9bdb6)
The branch, master has been updated
via 94f89cd66dfe9057f1dd44f98ed85a9696c9bdb6 (commit)
via 6f57d3afe66cffe900f547635ca8d332ff04d964 (commit)
from 35b137c3e193471e07f0873dfb149cebd059dca2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
src/Makefile.am | 1 -
src/hid/gtk/gtkhid-gdk.c | 300 ++++++++++++++++++++++++++++++++++----
src/hid/gtk/gui-output-events.c | 33 +----
src/hid/gtk/gui-pinout-preview.c | 60 --------
src/hid/gtk/gui-render-pixmap.c | 99 -------------
src/hid/gtk/gui-top-window.c | 4 +-
src/hid/gtk/gui.h | 23 ++--
7 files changed, 285 insertions(+), 235 deletions(-)
delete mode 100644 src/hid/gtk/gui-render-pixmap.c
=================
Commit Messages
=================
commit 94f89cd66dfe9057f1dd44f98ed85a9696c9bdb6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Create a private structure for the gdk render backend
This is in an effort to isolate some of its internals from the rest
of the GTK hid.
Also create a hook for configure events on the main drawing area to
allow the renderer to reconfigure its-self as necessary as the area
changes in size.
:100644 100644 5988a58... c8bac31... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 6929c8a... 10dd85b... M src/hid/gtk/gui-output-events.c
:100644 100644 36f8f43... dbc9808... M src/hid/gtk/gui-top-window.c
:100644 100644 cf45adf... 332239b... M src/hid/gtk/gui.h
commit 6f57d3afe66cffe900f547635ca8d332ff04d964
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Move more GDK specific routines to gtkhid-gdk.c
:100644 100644 34c672d... 1e4cf58... M src/Makefile.am
:100644 100644 6ea9f9b... 5988a58... M src/hid/gtk/gtkhid-gdk.c
:100644 100644 349f91b... 6929c8a... M src/hid/gtk/gui-output-events.c
:100644 100644 fc69639... 5b8d20a... M src/hid/gtk/gui-pinout-preview.c
:100644 000000 b24e6c9... 0000000... D src/hid/gtk/gui-render-pixmap.c
:100644 100644 1fbba95... 36f8f43... M src/hid/gtk/gui-top-window.c
:100644 100644 df30955... cf45adf... M src/hid/gtk/gui.h
=========
Changes
=========
commit 94f89cd66dfe9057f1dd44f98ed85a9696c9bdb6
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Create a private structure for the gdk render backend
This is in an effort to isolate some of its internals from the rest
of the GTK hid.
Also create a hook for configure events on the main drawing area to
allow the renderer to reconfigure its-self as necessary as the area
changes in size.
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 5988a58..c8bac31 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -21,13 +21,21 @@ RCSID ("$Id$");
extern HID ghid_hid;
-/* Sets gport->u_gc to the "right" GC to use (wrt mask or window)
+/* Sets priv->u_gc to the "right" GC to use (wrt mask or window)
*/
#define USE_GC(gc) if (!use_gc(gc)) return
static int cur_mask = -1;
static int mask_seq = 0;
+typedef struct render_priv {
+ GdkGC *bg_gc;
+ GdkGC *offlimits_gc;
+ GdkGC *mask_gc;
+ GdkGC *u_gc;
+ GdkGC *grid_gc;
+} render_priv;
+
typedef struct hid_gc_struct
{
@@ -70,12 +78,13 @@ ghid_draw_grid (void)
static int npoints = 0;
int x1, y1, x2, y2, n, i;
double x, y;
+ render_priv *priv = gport->render_priv;
if (!Settings.DrawGrid)
return;
if (Vz (PCB->Grid) < MIN_GRID_DISTANCE)
return;
- if (!gport->grid_gc)
+ if (!priv->grid_gc)
{
if (gdk_color_parse (Settings.GridColor, &gport->grid_color))
{
@@ -84,9 +93,9 @@ ghid_draw_grid (void)
gport->grid_color.blue ^= gport->bg_color.blue;
gdk_color_alloc (gport->colormap, &gport->grid_color);
}
- gport->grid_gc = gdk_gc_new (gport->drawable);
- gdk_gc_set_function (gport->grid_gc, GDK_XOR);
- gdk_gc_set_foreground (gport->grid_gc, &gport->grid_color);
+ priv->grid_gc = gdk_gc_new (gport->drawable);
+ gdk_gc_set_function (priv->grid_gc, GDK_XOR);
+ gdk_gc_set_foreground (priv->grid_gc, &gport->grid_color);
}
x1 = GRIDFIT_X (SIDE_X (gport->view_x0), PCB->Grid);
y1 = GRIDFIT_Y (SIDE_Y (gport->view_y0), PCB->Grid);
@@ -132,7 +141,7 @@ ghid_draw_grid (void)
int vy = Vy (y);
for (i = 0; i < n; i++)
points[i].y = vy;
- gdk_draw_points (gport->drawable, gport->grid_gc, points, n);
+ gdk_draw_points (gport->drawable, priv->grid_gc, points, n);
}
}
@@ -144,6 +153,7 @@ ghid_draw_bg_image (void)
GdkInterpType interp_type;
gint x, y, w, h, w_src, h_src;
static gint w_scaled, h_scaled;
+ render_priv *priv = gport->render_priv;
if (!ghidgui->bg_pixbuf)
return;
@@ -171,12 +181,12 @@ ghid_draw_bg_image (void)
h_scaled = h;
}
if (pixbuf)
- gdk_pixbuf_render_to_drawable (pixbuf, gport->drawable, gport->bg_gc,
+ gdk_pixbuf_render_to_drawable (pixbuf, gport->drawable, priv->bg_gc,
x, y, 0, 0,
w - x, h - y, GDK_RGB_DITHER_NORMAL, 0, 0);
}
-#define WHICH_GC(gc) (cur_mask == HID_MASK_CLEAR ? gport->mask_gc : (gc)->gc)
+#define WHICH_GC(gc) (cur_mask == HID_MASK_CLEAR ? priv->mask_gc : (gc)->gc)
void
ghid_use_mask (int use_it)
@@ -184,6 +194,7 @@ ghid_use_mask (int use_it)
static int mask_seq_id = 0;
static GdkDrawable *old;
GdkColor color;
+ render_priv *priv = gport->render_priv;
if (use_it == HID_FLUSH_DRAW_Q)
{
@@ -222,16 +233,16 @@ ghid_use_mask (int use_it)
gport->mask = gdk_pixmap_new (0, gport->width, gport->height, 1);
gport->drawable = gport->mask;
mask_seq = 0;
- if (!gport->mask_gc)
+ if (!priv->mask_gc)
{
- gport->mask_gc = gdk_gc_new (gport->drawable);
+ priv->mask_gc = gdk_gc_new (gport->drawable);
}
color.pixel = 1;
- gdk_gc_set_foreground (gport->mask_gc, &color);
- gdk_draw_rectangle (gport->drawable, gport->mask_gc, TRUE, 0, 0,
+ gdk_gc_set_foreground (priv->mask_gc, &color);
+ gdk_draw_rectangle (gport->drawable, priv->mask_gc, TRUE, 0, 0,
gport->width, gport->height);
color.pixel = 0;
- gdk_gc_set_foreground (gport->mask_gc, &color);
+ gdk_gc_set_foreground (priv->mask_gc, &color);
break;
case HID_MASK_AFTER:
@@ -263,33 +274,37 @@ typedef struct
static void
set_special_grid_color (void)
{
+ render_priv *priv = gport->render_priv;
+
if (!gport->colormap)
return;
gport->grid_color.red ^= gport->bg_color.red;
gport->grid_color.green ^= gport->bg_color.green;
gport->grid_color.blue ^= gport->bg_color.blue;
gdk_color_alloc (gport->colormap, &gport->grid_color);
- if (gport->grid_gc)
- gdk_gc_set_foreground (gport->grid_gc, &gport->grid_color);
+ if (priv->grid_gc)
+ gdk_gc_set_foreground (priv->grid_gc, &gport->grid_color);
}
void
ghid_set_special_colors (HID_Attribute * ha)
{
+ render_priv *priv = gport->render_priv;
+
if (!ha->name || !ha->value)
return;
- if (!strcmp (ha->name, "background-color") && gport->bg_gc)
+ if (!strcmp (ha->name, "background-color") && priv->bg_gc)
{
ghid_map_color_string (*(char **) ha->value, &gport->bg_color);
- gdk_gc_set_foreground (gport->bg_gc, &gport->bg_color);
+ gdk_gc_set_foreground (priv->bg_gc, &gport->bg_color);
set_special_grid_color ();
}
- else if (!strcmp (ha->name, "off-limit-color") && gport->offlimits_gc)
+ else if (!strcmp (ha->name, "off-limit-color") && priv->offlimits_gc)
{
ghid_map_color_string (*(char **) ha->value, &gport->offlimits_color);
- gdk_gc_set_foreground (gport->offlimits_gc, &gport->offlimits_color);
+ gdk_gc_set_foreground (priv->offlimits_gc, &gport->offlimits_color);
}
- else if (!strcmp (ha->name, "grid-color") && gport->grid_gc)
+ else if (!strcmp (ha->name, "grid-color") && priv->grid_gc)
{
ghid_map_color_string (*(char **) ha->value, &gport->grid_color);
set_special_grid_color ();
@@ -370,6 +385,7 @@ ghid_set_color (hidGC gc, const char *name)
void
ghid_set_line_cap (hidGC gc, EndCapStyle style)
{
+ render_priv *priv = gport->render_priv;
switch (style)
{
@@ -393,6 +409,7 @@ ghid_set_line_cap (hidGC gc, EndCapStyle style)
void
ghid_set_line_width (hidGC gc, int width)
{
+ render_priv *priv = gport->render_priv;
gc->width = width;
if (gc->gc)
@@ -426,6 +443,7 @@ ghid_set_line_cap_angle (hidGC gc, int x1, int y1, int x2, int y2)
static int
use_gc (hidGC gc)
{
+ render_priv *priv = gport->render_priv;
if (gc->me_pointer != &ghid_hid)
{
@@ -451,7 +469,7 @@ use_gc (hidGC gc)
gdk_gc_set_clip_mask (gc->gc, NULL);
gc->mask_seq = mask_seq;
}
- gport->u_gc = WHICH_GC (gc);
+ priv->u_gc = WHICH_GC (gc);
return 1;
}
@@ -459,6 +477,7 @@ void
ghid_draw_line (hidGC gc, int x1, int y1, int x2, int y2)
{
double dx1, dy1, dx2, dy2;
+ render_priv *priv = gport->render_priv;
dx1 = Vx ((double) x1);
dy1 = Vy ((double) y1);
@@ -470,7 +489,7 @@ ghid_draw_line (hidGC gc, int x1, int y1, int x2, int y2)
return;
USE_GC (gc);
- gdk_draw_line (gport->drawable, gport->u_gc, dx1, dy1, dx2, dy2);
+ gdk_draw_line (gport->drawable, priv->u_gc, dx1, dy1, dx2, dy2);
}
void
@@ -479,6 +498,7 @@ ghid_draw_arc (hidGC gc, int cx, int cy,
{
gint vrx, vry;
gint w, h, radius;
+ render_priv *priv = gport->render_priv;
w = gport->width * gport->zoom;
h = gport->height * gport->zoom;
@@ -506,7 +526,7 @@ ghid_draw_arc (hidGC gc, int cx, int cy,
/* make sure we fall in the -180 to +180 range */
start_angle = (start_angle + 360 + 180) % 360 - 180;
- gdk_draw_arc (gport->drawable, gport->u_gc, 0,
+ gdk_draw_arc (gport->drawable, priv->u_gc, 0,
Vx (cx) - vrx, Vy (cy) - vry,
vrx * 2, vry * 2, (start_angle + 180) * 64, delta_angle * 64);
}
@@ -515,6 +535,7 @@ void
ghid_draw_rect (hidGC gc, int x1, int y1, int x2, int y2)
{
gint w, h, lw;
+ render_priv *priv = gport->render_priv;
lw = gc->width;
w = gport->width * gport->zoom;
@@ -549,7 +570,7 @@ ghid_draw_rect (hidGC gc, int x1, int y1, int x2, int y2)
}
USE_GC (gc);
- gdk_draw_rectangle (gport->drawable, gport->u_gc, FALSE,
+ gdk_draw_rectangle (gport->drawable, priv->u_gc, FALSE,
x1, y1, x2 - x1 + 1, y2 - y1 + 1);
}
@@ -558,6 +579,7 @@ void
ghid_fill_circle (hidGC gc, int cx, int cy, int radius)
{
gint w, h, vr;
+ render_priv *priv = gport->render_priv;
w = gport->width * gport->zoom;
h = gport->height * gport->zoom;
@@ -569,7 +591,7 @@ ghid_fill_circle (hidGC gc, int cx, int cy, int radius)
USE_GC (gc);
vr = Vz (radius);
- gdk_draw_arc (gport->drawable, gport->u_gc, TRUE,
+ gdk_draw_arc (gport->drawable, priv->u_gc, TRUE,
Vx (cx) - vr, Vy (cy) - vr, vr * 2, vr * 2, 0, 360 * 64);
}
@@ -579,6 +601,7 @@ ghid_fill_polygon (hidGC gc, int n_coords, int *x, int *y)
static GdkPoint *points = 0;
static int npoints = 0;
int i;
+ render_priv *priv = gport->render_priv;
USE_GC (gc);
if (npoints < n_coords)
@@ -591,13 +614,14 @@ ghid_fill_polygon (hidGC gc, int n_coords, int *x, int *y)
points[i].x = Vx (x[i]);
points[i].y = Vy (y[i]);
}
- gdk_draw_polygon (gport->drawable, gport->u_gc, 1, points, n_coords);
+ gdk_draw_polygon (gport->drawable, priv->u_gc, 1, points, n_coords);
}
void
ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2)
{
gint w, h, lw, xx, yy;
+ render_priv *priv = gport->render_priv;
lw = gc->width;
w = gport->width * gport->zoom;
@@ -630,7 +654,7 @@ ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2)
y2 = yy;
}
USE_GC (gc);
- gdk_draw_rectangle (gport->drawable, gport->u_gc, TRUE,
+ gdk_draw_rectangle (gport->drawable, priv->u_gc, TRUE,
x1, y1, x2 - x1 + 1, y2 - y1 + 1);
}
@@ -645,6 +669,7 @@ ghid_invalidate_all ()
{
int eleft, eright, etop, ebottom;
BoxType region;
+ render_priv *priv = gport->render_priv;
if (!gport->pixmap)
return;
@@ -672,28 +697,28 @@ ghid_invalidate_all ()
}
if (eleft > 0)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
1, 0, 0, eleft, gport->height);
else
eleft = 0;
if (eright < gport->width)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
1, eright, 0, gport->width - eright, gport->height);
else
eright = gport->width;
if (etop > 0)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
1, eleft, 0, eright - eleft + 1, etop);
else
etop = 0;
if (ebottom < gport->height)
- gdk_draw_rectangle (gport->drawable, gport->offlimits_gc,
+ gdk_draw_rectangle (gport->drawable, priv->offlimits_gc,
1, eleft, ebottom, eright - eleft + 1,
gport->height - ebottom);
else
ebottom = gport->height;
- gdk_draw_rectangle (gport->drawable, gport->bg_gc, 1,
+ gdk_draw_rectangle (gport->drawable, priv->bg_gc, 1,
eleft, etop, eright - eleft + 1, ebottom - etop + 1);
ghid_draw_bg_image();
@@ -870,10 +895,42 @@ ghid_show_crosshair (gboolean show)
}
void
+ghid_init_renderer (int *argc, char ***argv, GHidPort *port)
+{
+ /* Init any GC's required */
+ port->render_priv = g_new0 (render_priv, 1);
+}
+
+void
+ghid_drawing_area_configure_hook (GHidPort *port)
+{
+ static int done_once = 0;
+ render_priv *priv = port->render_priv;
+
+ if (!done_once)
+ {
+ priv->bg_gc = gdk_gc_new (port->drawable);
+ gdk_gc_set_foreground (priv->bg_gc, &port->bg_color);
+
+ priv->offlimits_gc = gdk_gc_new (port->drawable);
+ gdk_gc_set_foreground (priv->offlimits_gc, &port->offlimits_color);
+ done_once = 1;
+ }
+
+ if (port->mask)
+ {
+ gdk_pixmap_unref (port->mask);
+ port->mask = gdk_pixmap_new (0, port->width, port->height, 1);
+ }
+}
+
+void
ghid_screen_update (void)
{
+ render_priv *priv = gport->render_priv;
+
ghid_show_crosshair (FALSE);
- gdk_draw_drawable (gport->drawing_area->window, gport->bg_gc, gport->pixmap,
+ gdk_draw_drawable (gport->drawing_area->window, priv->bg_gc, gport->pixmap,
0, 0, 0, 0, gport->width, gport->height);
ghid_show_crosshair (TRUE);
}
@@ -883,8 +940,10 @@ ghid_drawing_area_expose_cb (GtkWidget *widget,
GdkEventExpose *ev,
GHidPort *port)
{
+ render_priv *priv = port->render_priv;
+
ghid_show_crosshair (FALSE);
- gdk_draw_drawable (widget->window, port->bg_gc, port->pixmap,
+ gdk_draw_drawable (widget->window, priv->bg_gc, port->pixmap,
ev->area.x, ev->area.y, ev->area.x, ev->area.y,
ev->area.width, ev->area.height);
ghid_show_crosshair (TRUE);
@@ -903,6 +962,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
int save_width, save_height;
int save_view_width, save_view_height;
double xz, yz;
+ render_priv *priv = gport->render_priv;
save_zoom = gport->zoom;
save_width = gport->width;
@@ -933,7 +993,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
/* clear background */
- gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h);
+ gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE, 0, 0, da_w, da_h);
/* call the drawing routine */
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
@@ -969,7 +1029,7 @@ ghid_pinout_preview_expose (GtkWidget *widget,
gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
/* clear background */
- gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h);
+ gdk_draw_rectangle (widget->window, priv->bg_gc, TRUE, 0, 0, da_w, da_h);
/* call the drawing routine */
hid_expose_callback (&ghid_hid, NULL, &pinout->element);
@@ -996,6 +1056,7 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
int save_width, save_height;
int save_view_width, save_view_height;
BoxType region;
+ render_priv *priv = gport->render_priv;
save_drawable = gport->drawable;
save_zoom = gport->zoom;
@@ -1023,7 +1084,7 @@ ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int dept
gport->view_y0 -= gport->view_width / 2;
/* clear background */
- gdk_draw_rectangle (pixmap, gport->bg_gc, TRUE, 0, 0, width, height);
+ gdk_draw_rectangle (pixmap, priv->bg_gc, TRUE, 0, 0, width, height);
/* call the drawing routine */
region.X1 = MIN(Px(0), Px(gport->width + 1));
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 6929c8a..10dd85b 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -516,27 +516,24 @@ ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
if (!first_time_done)
{
gport->colormap = gtk_widget_get_colormap (gport->top_window);
- gport->bg_gc = gdk_gc_new (gport->drawable);
if (gdk_color_parse (Settings.BackgroundColor, &gport->bg_color))
gdk_color_alloc (gport->colormap, &gport->bg_color);
else
gdk_color_white (gport->colormap, &gport->bg_color);
- gdk_gc_set_foreground (gport->bg_gc, &gport->bg_color);
- gport->offlimits_gc = gdk_gc_new (gport->drawable);
if (gdk_color_parse (Settings.OffLimitColor, &gport->offlimits_color))
gdk_color_alloc (gport->colormap, &gport->offlimits_color);
else
gdk_color_white (gport->colormap, &gport->offlimits_color);
- gdk_gc_set_foreground (gport->offlimits_gc, &gport->offlimits_color);
first_time_done = TRUE;
+ ghid_drawing_area_configure_hook (out);
PCBChanged (0, NULL, 0, 0);
}
- if (gport->mask)
+ else
{
- gdk_pixmap_unref (gport->mask);
- gport->mask = gdk_pixmap_new (0, gport->width, gport->height, 1);
+ ghid_drawing_area_configure_hook (out);
}
+
ghid_port_ranges_scale (FALSE);
ghid_invalidate_all ();
RestoreCrosshair (TRUE);
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 36f8f43..dbc9808 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -2693,6 +2693,8 @@ ghid_parse_arguments (int *argc, char ***argv)
gport->zoom = 300.0;
pixel_slop = 300;
+ ghid_init_renderer (argc, argv, gport);
+
ghid_config_files_read (argc, argv);
Settings.AutoPlace = 0;
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index cf45adf..332239b 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -162,7 +162,7 @@ typedef struct
GdkDrawable *drawable; /* Current drawable for drawing routines */
gint width, height;
- GdkGC *bg_gc, *offlimits_gc, *mask_gc, *u_gc, *grid_gc;
+ struct render_priv *render_priv;
GdkColor bg_color, offlimits_color, grid_color;
@@ -494,6 +494,8 @@ void ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_invalidate_lr (int left, int right, int top, int bottom);
void ghid_invalidate_all ();
void ghid_show_crosshair (gboolean show);
+void ghid_init_renderer (int *, char ***, GHidPort *);
+void ghid_drawing_area_configure_hook (GHidPort *port);
void ghid_screen_update (void);
gboolean ghid_drawing_area_expose_cb (GtkWidget *, GdkEventExpose *,
GHidPort *);
commit 6f57d3afe66cffe900f547635ca8d332ff04d964
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>
hid/gtk: Move more GDK specific routines to gtkhid-gdk.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 34c672d..1e4cf58 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -270,7 +270,6 @@ LIBGTK_SRCS = \
hid/gtk/gui-pinout-preview.c \
hid/gtk/gui-pinout-preview.h \
hid/gtk/gui-pinout-window.c \
- hid/gtk/gui-render-pixmap.c \
hid/gtk/gui-top-window.c \
hid/gtk/gui-utils.c
libgtk_a_SOURCES = ${LIBGTK_SRCS} hid/gtk/gtk_lists.h
diff --git a/src/hid/gtk/gtkhid-gdk.c b/src/hid/gtk/gtkhid-gdk.c
index 6ea9f9b..5988a58 100644
--- a/src/hid/gtk/gtkhid-gdk.c
+++ b/src/hid/gtk/gtkhid-gdk.c
@@ -868,3 +868,178 @@ ghid_show_crosshair (gboolean show)
draw_markers_prev = FALSE;
}
}
+
+void
+ghid_screen_update (void)
+{
+ ghid_show_crosshair (FALSE);
+ gdk_draw_drawable (gport->drawing_area->window, gport->bg_gc, gport->pixmap,
+ 0, 0, 0, 0, gport->width, gport->height);
+ ghid_show_crosshair (TRUE);
+}
+
+gboolean
+ghid_drawing_area_expose_cb (GtkWidget *widget,
+ GdkEventExpose *ev,
+ GHidPort *port)
+{
+ ghid_show_crosshair (FALSE);
+ gdk_draw_drawable (widget->window, port->bg_gc, port->pixmap,
+ ev->area.x, ev->area.y, ev->area.x, ev->area.y,
+ ev->area.width, ev->area.height);
+ ghid_show_crosshair (TRUE);
+ return FALSE;
+}
+
+gboolean
+ghid_pinout_preview_expose (GtkWidget *widget,
+ GdkEventExpose *ev)
+{
+ GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
+ GdkDrawable *save_drawable;
+ double save_zoom;
+ int da_w, da_h;
+ int save_left, save_top;
+ int save_width, save_height;
+ int save_view_width, save_view_height;
+ double xz, yz;
+
+ save_zoom = gport->zoom;
+ save_width = gport->width;
+ save_height = gport->height;
+ save_left = gport->view_x0;
+ save_top = gport->view_y0;
+ save_view_width = gport->view_width;
+ save_view_height = gport->view_height;
+
+ /* Setup drawable and zoom factor for drawing routines
+ */
+ save_drawable = gport->drawable;
+
+ gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
+ xz = (double) pinout->x_max / da_w;
+ yz = (double) pinout->y_max / da_h;
+ if (xz > yz)
+ gport->zoom = xz;
+ else
+ gport->zoom = yz;
+
+ gport->drawable = widget->window;
+ gport->width = da_w;
+ gport->height = da_h;
+ gport->view_width = da_w * gport->zoom;
+ gport->view_height = da_h * gport->zoom;
+ gport->view_x0 = (pinout->x_max - gport->view_width) / 2;
+ gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
+
+ /* clear background */
+ gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h);
+
+ /* call the drawing routine */
+ hid_expose_callback (&ghid_hid, NULL, &pinout->element);
+
+ gport->drawable = save_drawable;
+ gport->zoom = save_zoom;
+ gport->width = save_width;
+ gport->height = save_height;
+ gport->view_x0 = save_left;
+ gport->view_y0 = save_top;
+ save_top = gport->view_y0;
+ save_view_width = gport->view_width;
+ save_view_height = gport->view_height;
+
+ /* Setup drawable and zoom factor for drawing routines
+ */
+ save_drawable = gport->drawable;
+
+ gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
+ xz = (double) pinout->x_max / da_w;
+ yz = (double) pinout->y_max / da_h;
+ if (xz > yz)
+ gport->zoom = xz;
+ else
+ gport->zoom = yz;
+
+ gport->drawable = widget->window;
+ gport->width = da_w;
+ gport->height = da_h;
+ gport->view_width = da_w * gport->zoom;
+ gport->view_height = da_h * gport->zoom;
+ gport->view_x0 = (pinout->x_max - gport->view_width) / 2;
+ gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
+
+ /* clear background */
+ gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h);
+
+ /* call the drawing routine */
+ hid_expose_callback (&ghid_hid, NULL, &pinout->element);
+
+ gport->drawable = save_drawable;
+ gport->zoom = save_zoom;
+ gport->width = save_width;
+ gport->height = save_height;
+ gport->view_x0 = save_left;
+ gport->view_y0 = save_top;
+ gport->view_width = save_view_width;
+ gport->view_height = save_view_height;
+
+ return FALSE;
+}
+
+GdkPixmap *
+ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int depth)
+{
+ GdkPixmap *pixmap;
+ GdkDrawable *save_drawable;
+ double save_zoom;
+ int save_left, save_top;
+ int save_width, save_height;
+ int save_view_width, save_view_height;
+ BoxType region;
+
+ save_drawable = gport->drawable;
+ save_zoom = gport->zoom;
+ save_width = gport->width;
+ save_height = gport->height;
+ save_left = gport->view_x0;
+ save_top = gport->view_y0;
+ save_view_width = gport->view_width;
+ save_view_height = gport->view_height;
+
+ pixmap = gdk_pixmap_new (NULL, width, height, depth);
+
+ /* Setup drawable and zoom factor for drawing routines
+ */
+
+ gport->drawable = pixmap;
+ gport->zoom = zoom;
+ gport->width = width;
+ gport->height = height;
+ gport->view_width = width * gport->zoom;
+ gport->view_height = height * gport->zoom;
+ gport->view_x0 = ghid_flip_x ? PCB->MaxWidth - cx : cx;
+ gport->view_x0 -= gport->view_height / 2;
+ gport->view_y0 = ghid_flip_y ? PCB->MaxHeight - cy : cy;
+ gport->view_y0 -= gport->view_width / 2;
+
+ /* clear background */
+ gdk_draw_rectangle (pixmap, gport->bg_gc, TRUE, 0, 0, width, height);
+
+ /* call the drawing routine */
+ region.X1 = MIN(Px(0), Px(gport->width + 1));
+ region.Y1 = MIN(Py(0), Py(gport->height + 1));
+ region.X2 = MAX(Px(0), Px(gport->width + 1));
+ region.Y2 = MAX(Py(0), Py(gport->height + 1));
+ hid_expose_callback (&ghid_hid, ®ion, NULL);
+
+ gport->drawable = save_drawable;
+ gport->zoom = save_zoom;
+ gport->width = save_width;
+ gport->height = save_height;
+ gport->view_x0 = save_left;
+ gport->view_y0 = save_top;
+ gport->view_width = save_view_width;
+ gport->view_height = save_view_height;
+
+ return pixmap;
+}
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 349f91b..6929c8a 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -544,28 +544,6 @@ ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
}
-void
-ghid_screen_update (void)
-{
-
- ghid_show_crosshair (FALSE);
- gdk_draw_drawable (gport->drawing_area->window, gport->bg_gc, gport->pixmap,
- 0, 0, 0, 0, gport->width, gport->height);
- ghid_show_crosshair (TRUE);
-}
-
-gboolean
-ghid_port_drawing_area_expose_event_cb (GtkWidget * widget,
- GdkEventExpose * ev, GHidPort * port)
-{
- ghid_show_crosshair (FALSE);
- gdk_draw_drawable (widget->window, port->bg_gc, port->pixmap,
- ev->area.x, ev->area.y, ev->area.x, ev->area.y,
- ev->area.width, ev->area.height);
- ghid_show_crosshair (TRUE);
- return FALSE;
-}
-
#if GTK_CHECK_VERSION(2,12,0)
# define ENABLE_TOOLTIPS 1
#else
diff --git a/src/hid/gtk/gui-pinout-preview.c b/src/hid/gtk/gui-pinout-preview.c
index fc69639..5b8d20a 100644
--- a/src/hid/gtk/gui-pinout-preview.c
+++ b/src/hid/gtk/gui-pinout-preview.c
@@ -150,66 +150,6 @@ pinout_set_data (GhidPinoutPreview * pinout, ElementType * element)
}
-static gboolean
-ghid_pinout_preview_expose (GtkWidget * widget, GdkEventExpose * event)
-{
- extern HID ghid_hid;
- GhidPinoutPreview *pinout = GHID_PINOUT_PREVIEW (widget);
- GdkDrawable *save_drawable;
- double save_zoom;
- int da_w, da_h;
- int save_left, save_top;
- int save_width, save_height;
- int save_view_width, save_view_height;
- double xz, yz;
-
- save_zoom = gport->zoom;
- save_width = gport->width;
- save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
-
- /* Setup drawable and zoom factor for drawing routines
- */
- save_drawable = gport->drawable;
-
- gdk_window_get_geometry (widget->window, 0, 0, &da_w, &da_h, 0);
- xz = (double) pinout->x_max / da_w;
- yz = (double) pinout->y_max / da_h;
- if (xz > yz)
- gport->zoom = xz;
- else
- gport->zoom = yz;
-
- gport->drawable = widget->window;
- gport->width = da_w;
- gport->height = da_h;
- gport->view_width = da_w * gport->zoom;
- gport->view_height = da_h * gport->zoom;
- gport->view_x0 = (pinout->x_max - gport->view_width) / 2;
- gport->view_y0 = (pinout->y_max - gport->view_height) / 2;
-
- /* clear background */
- gdk_draw_rectangle (widget->window, gport->bg_gc, TRUE, 0, 0, da_w, da_h);
-
- /* call the drawing routine */
- hid_expose_callback (&ghid_hid, NULL, &pinout->element);
-
- gport->drawable = save_drawable;
- gport->zoom = save_zoom;
- gport->width = save_width;
- gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
-
- return FALSE;
-}
-
-
enum
{
PROP_ELEMENT_DATA = 1,
diff --git a/src/hid/gtk/gui-render-pixmap.c b/src/hid/gtk/gui-render-pixmap.c
deleted file mode 100644
index b24e6c9..0000000
--- a/src/hid/gtk/gui-render-pixmap.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* $Id$ */
-
-/*
- * COPYRIGHT
- *
- * PCB, interactive printed circuit board design
- * Copyright (C) 1994,1995,1996 Thomas Nau
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Contact addresses for paper mail and Email:
- * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
- * Thomas.Nau@xxxxxxxxxxxxx
- *
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "gui.h"
-
-#ifdef HAVE_LIBDMALLOC
-#include <dmalloc.h>
-#endif
-
-RCSID ("$Id$");
-
-
-GdkPixmap *
-ghid_render_pixmap (int cx, int cy, double zoom, int width, int height, int depth)
-{
- extern HID ghid_hid;
- GdkPixmap *pixmap;
- GdkDrawable *save_drawable;
- double save_zoom;
- int save_left, save_top;
- int save_width, save_height;
- int save_view_width, save_view_height;
- BoxType region;
-
- save_drawable = gport->drawable;
- save_zoom = gport->zoom;
- save_width = gport->width;
- save_height = gport->height;
- save_left = gport->view_x0;
- save_top = gport->view_y0;
- save_view_width = gport->view_width;
- save_view_height = gport->view_height;
-
- pixmap = gdk_pixmap_new (NULL, width, height, depth);
-
- /* Setup drawable and zoom factor for drawing routines
- */
-
- gport->drawable = pixmap;
- gport->zoom = zoom;
- gport->width = width;
- gport->height = height;
- gport->view_width = width * gport->zoom;
- gport->view_height = height * gport->zoom;
- gport->view_x0 = ghid_flip_x ? PCB->MaxWidth - cx : cx;
- gport->view_x0 -= gport->view_height / 2;
- gport->view_y0 = ghid_flip_y ? PCB->MaxHeight - cy : cy;
- gport->view_y0 -= gport->view_width / 2;
-
- /* clear background */
- gdk_draw_rectangle (pixmap, gport->bg_gc, TRUE, 0, 0, width, height);
-
- /* call the drawing routine */
- region.X1 = MIN(Px(0), Px(gport->width + 1));
- region.Y1 = MIN(Py(0), Py(gport->height + 1));
- region.X2 = MAX(Px(0), Px(gport->width + 1));
- region.Y2 = MAX(Py(0), Py(gport->height + 1));
- hid_expose_callback (&ghid_hid, ®ion, NULL);
-
- gport->drawable = save_drawable;
- gport->zoom = save_zoom;
- gport->width = save_width;
- gport->height = save_height;
- gport->view_x0 = save_left;
- gport->view_y0 = save_top;
- gport->view_width = save_view_width;
- gport->view_height = save_view_height;
-
- return pixmap;
-}
diff --git a/src/hid/gtk/gui-top-window.c b/src/hid/gtk/gui-top-window.c
index 1fbba95..36f8f43 100644
--- a/src/hid/gtk/gui-top-window.c
+++ b/src/hid/gtk/gui-top-window.c
@@ -2370,7 +2370,7 @@ ghid_build_pcb_top_window (void)
*/
g_signal_connect (G_OBJECT (gport->drawing_area), "expose_event",
- G_CALLBACK (ghid_port_drawing_area_expose_event_cb),
+ G_CALLBACK (ghid_drawing_area_expose_cb),
port);
g_signal_connect (G_OBJECT (gport->top_window), "configure_event",
G_CALLBACK (top_window_configure_event_cb), port);
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index df30955..cf45adf 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -36,7 +36,7 @@
#include <sys/stat.h>
#include <gtk/gtk.h>
-
+#include "gui-pinout-preview.h"
/* Silk and rats lines are the two additional selectable to draw on.
@@ -306,9 +306,6 @@ gint ghid_port_window_mouse_scroll_cb (GtkWidget * widget,
GdkEventScroll * ev, GHidPort * out);
-gint ghid_port_drawing_area_expose_event_cb (GtkWidget * widget,
- GdkEventExpose * ev,
- GHidPort * out);
gint ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
GdkEventConfigure * ev,
GHidPort * out);
@@ -477,14 +474,6 @@ void ghid_logv (const char *fmt, va_list args);
/* gui-pinout-window.c */
void ghid_pinout_window_show (GHidPort * out, ElementTypePtr Element);
-/* gui-render-pixmap.c */
-GdkPixmap *ghid_render_pixmap (int cx,
- int cy,
- double zoom,
- int width,
- int height,
- int depth);
-
/* gtkhid-gdk.c */
hidGC ghid_make_gc (void);
void ghid_destroy_gc (hidGC);
@@ -505,6 +494,12 @@ void ghid_fill_rect (hidGC gc, int x1, int y1, int x2, int y2);
void ghid_invalidate_lr (int left, int right, int top, int bottom);
void ghid_invalidate_all ();
void ghid_show_crosshair (gboolean show);
+void ghid_screen_update (void);
+gboolean ghid_drawing_area_expose_cb (GtkWidget *, GdkEventExpose *,
+ GHidPort *);
+gboolean ghid_pinout_preview_expose (GtkWidget * widget, GdkEventExpose * ev);
+GdkPixmap *ghid_render_pixmap (int cx, int cy, double zoom,
+ int width, int height, int depth);
/* gtkhid-main.c */
void ghid_pan_fixup (void);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs