[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: [PATCH 3/4][PCB] Cross color update



Make color of "cross-color" a global variable and update its value
immediately when it is changed.  Original code only updated the
cross color when pcb was restarted.

Signed-off-by: Peter Tyser <ptyser@xxxxxxxxx>
---
 src/hid/gtk/gtkhid-main.c       |    4 ++++
 src/hid/gtk/gui-output-events.c |    5 ++---
 src/hid/gtk/gui.h               |    2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/hid/gtk/gtkhid-main.c b/src/hid/gtk/gtkhid-main.c
index 61e114e..93a1eab 100644
--- a/src/hid/gtk/gtkhid-main.c
+++ b/src/hid/gtk/gtkhid-main.c
@@ -714,6 +714,10 @@ ghid_set_special_colors (HID_Attribute * ha)
       ghid_map_color_string (*(char **) ha->value, &gport->grid_color);
       set_special_grid_color ();
     }
+  else if (!strcmp (ha->name, "cross-color"))
+    {
+      ghid_map_color_string (*(char **) ha->value, &gport->cross_color);
+    }
 }
 
 void
diff --git a/src/hid/gtk/gui-output-events.c b/src/hid/gtk/gui-output-events.c
index 1a62dd8..6077607 100644
--- a/src/hid/gtk/gui-output-events.c
+++ b/src/hid/gtk/gui-output-events.c
@@ -398,7 +398,6 @@ ghid_show_crosshair (gboolean show)
   gint x, y;
   static gint x_prev = -1, y_prev = -1;
   static GdkGC *xor_gc;
-  static GdkColor cross_color;
 
   if (gport->x_crosshair < 0 || ghidgui->creating || !gport->has_entered)
     return;
@@ -409,12 +408,12 @@ ghid_show_crosshair (gboolean show)
       gdk_gc_copy (xor_gc, ghid_port.drawing_area->style->white_gc);
       gdk_gc_set_function (xor_gc, GDK_XOR);
       /* FIXME: when CrossColor changed from config */
-      ghid_map_color_string (Settings.CrossColor, &cross_color);
+      ghid_map_color_string (Settings.CrossColor, &gport->cross_color);
     }
   x = DRAW_X (gport->x_crosshair);
   y = DRAW_Y (gport->y_crosshair);
 
-  gdk_gc_set_foreground (xor_gc, &cross_color);
+  gdk_gc_set_foreground (xor_gc, &gport->cross_color);
 
   if (x_prev >= 0)
     {
diff --git a/src/hid/gtk/gui.h b/src/hid/gtk/gui.h
index f0b0618..b6373e0 100644
--- a/src/hid/gtk/gui.h
+++ b/src/hid/gtk/gui.h
@@ -199,7 +199,7 @@ typedef struct
 
   GdkGC *bg_gc, *offlimits_gc, *mask_gc, *u_gc, *grid_gc;
 
-  GdkColor bg_color, offlimits_color, grid_color;
+  GdkColor bg_color, offlimits_color, grid_color, cross_color;
 
   GdkColormap *colormap;
 
-- 
1.6.2-rc2.GIT



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user