r5758 - in trunk/eda/fped: . icons

werner at docs.openmoko.org werner at docs.openmoko.org
Wed Dec 16 18:25:14 CET 2009


Author: werner
Date: 2009-12-16 18:25:13 +0100 (Wed, 16 Dec 2009)
New Revision: 5758

Modified:
   trunk/eda/fped/Makefile
   trunk/eda/fped/gui_tool.c
   trunk/eda/fped/gui_util.c
   trunk/eda/fped/gui_util.h
   trunk/eda/fped/icons/arc.fig
   trunk/eda/fped/icons/circ.fig
   trunk/eda/fped/icons/line.fig
   trunk/eda/fped/icons/rect.fig
   trunk/eda/fped/icons/vec.fig
Log:
Make the icon for the currently selected instance transparent so that it better
blends in and won't be mistaken for a button.

- Makefile: generate icon XPMs with transparent background
- gui_util.c (make_image): set transparency color to white
- gui_util.c (make_transparent_image): new function to return a transparent
  image created from an XPM
- gui_tool.c (get_icon_by_inst): make the returned image transparent instead of
  opaque
- icons/vec.fig, icons/arc.fig, icons/line.fig, icons/rect.fig, icons/circ.fig:
  darkened to increase contrast on grey background



Modified: trunk/eda/fped/Makefile
===================================================================
--- trunk/eda/fped/Makefile	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/Makefile	2009-12-16 17:25:13 UTC (rev 5758)
@@ -80,16 +80,23 @@
 .PHONY:		all dep depend clean install uninstall manual upload-manual
 .PHONY:		update
 
-.SUFFIXES:	.fig .xpm
+.SUFFIXES:	.fig .xpm .ppm
 
 # generate 26x26 pixels icons, then drop the 1-pixel frame
 
-.fig.xpm:
-		$(GEN) fig2dev -L xpm -Z 0.32 -S 4 $< | \
-		  convert -crop 24x24+1+1 - - | \
-		  sed "s/*.*\[]/*xpm_`basename $@ .xpm`[]/" >$@; \
-		  [ "$${PIPESTATUS[*]}" = "0 0 0" ] || { rm -f $@; exit 1; }
+.fig.ppm:
+		$(GEN) fig2dev -L ppm -Z 0.32 -S 4 $< | \
+		  convert -crop 24x24+1+1 - - >$@; \
+		  [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $@; exit 1; }
 
+# ppmtoxpm is very chatty, so we suppress its stderr
+
+.ppm.xpm:
+		$(GEN) ppmcolormask white $< >_tmp && \
+		  ppmtoxpm -name xpm_`basename $@ .xpm` -alphamask _tmp \
+		  $< >$@ 2>/dev/null && rm -f _tmp || \
+		  { rm -f $@ _tmp; exit 1; }
+
 all:		fped
 
 fped:		$(OBJS)
@@ -134,7 +141,7 @@
 # ----- Cleanup ---------------------------------------------------------------
 
 clean:
-		rm -f $(OBJS) $(XPMS:%=icons/%)
+		rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm)
 		rm -f lex.yy.c y.tab.c y.tab.h y.output .depend
 
 # ----- Install / uninstall ---------------------------------------------------

Modified: trunk/eda/fped/gui_tool.c
===================================================================
--- trunk/eda/fped/gui_tool.c	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/gui_tool.c	2009-12-16 17:25:13 UTC (rev 5758)
@@ -1030,7 +1030,7 @@
 	default:
 		abort();
 	}
-	return make_image(DA, image);
+	return make_transparent_image(DA, image);
 }
 
 

Modified: trunk/eda/fped/gui_util.c
===================================================================
--- trunk/eda/fped/gui_util.c	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/gui_util.c	2009-12-16 17:25:13 UTC (rev 5758)
@@ -176,14 +176,28 @@
 {
 	GdkPixmap *pixmap;
 	GtkWidget *image;
+	GdkColor white = get_color("white");
 
-	pixmap = gdk_pixmap_create_from_xpm_d(drawable, NULL, NULL, xpm);
+	pixmap = gdk_pixmap_create_from_xpm_d(drawable, NULL, &white, xpm);
 	image = gtk_image_new_from_pixmap(pixmap, NULL);
 	gtk_misc_set_padding(GTK_MISC(image), 1, 1);
 	return image;
 }
 
 
+GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm)
+{
+	GdkPixmap *pixmap;
+	GdkBitmap *mask;
+	GtkWidget *image;
+
+	pixmap = gdk_pixmap_create_from_xpm_d(drawable, &mask, NULL, xpm);
+	image = gtk_image_new_from_pixmap(pixmap, mask);
+	gtk_misc_set_padding(GTK_MISC(image), 1, 1);
+	return image;
+}
+
+
 static void remove_child(GtkWidget *widget, gpointer data)
 {
 	gtk_container_remove(GTK_CONTAINER(data), widget);

Modified: trunk/eda/fped/gui_util.h
===================================================================
--- trunk/eda/fped/gui_util.h	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/gui_util.h	2009-12-16 17:25:13 UTC (rev 5758)
@@ -60,6 +60,7 @@
 void vacate_widget(GtkWidget *widget);
 
 GtkWidget *make_image(GdkDrawable *drawable, char **xpm);
+GtkWidget *make_transparent_image(GdkDrawable *drawable, char **xpm);
 void set_image(GtkWidget *widget, GtkWidget *image);
 GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable, char **xpm,
     gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data),

Modified: trunk/eda/fped/icons/arc.fig
===================================================================
--- trunk/eda/fped/icons/arc.fig	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/icons/arc.fig	2009-12-16 17:25:13 UTC (rev 5758)
@@ -7,7 +7,7 @@
 Single
 -2
 1200 2
-5 1 0 10 3 7 50 -1 -1 0.000 0 1 1 0 4005.000 4395.000 5550 4500 5100 3300 3900 2850
+5 1 0 10 16 7 50 -1 -1 0.000 0 1 1 0 4005.000 4395.000 5550 4500 5100 3300 3900 2850
 	0 0 10.00 450.00 600.00
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400

Modified: trunk/eda/fped/icons/circ.fig
===================================================================
--- trunk/eda/fped/icons/circ.fig	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/icons/circ.fig	2009-12-16 17:25:13 UTC (rev 5758)
@@ -7,6 +7,6 @@
 Single
 -2
 1200 2
-1 3 0 10 3 7 50 -1 -1 0.000 1 0.0000 4800 3600 900 900 4800 3600 5700 3600
+1 3 0 10 16 7 50 -1 -1 0.000 1 0.0000 4800 3600 900 900 4800 3600 5700 3600
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400

Modified: trunk/eda/fped/icons/line.fig
===================================================================
--- trunk/eda/fped/icons/line.fig	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/icons/line.fig	2009-12-16 17:25:13 UTC (rev 5758)
@@ -9,5 +9,5 @@
 1200 2
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
-2 1 0 10 3 7 50 -1 -1 0.000 0 0 -1 0 0 2
+2 1 0 10 16 7 50 -1 -1 0.000 0 0 -1 0 0 2
 	 3900 4200 5700 3000

Modified: trunk/eda/fped/icons/rect.fig
===================================================================
--- trunk/eda/fped/icons/rect.fig	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/icons/rect.fig	2009-12-16 17:25:13 UTC (rev 5758)
@@ -9,5 +9,5 @@
 1200 2
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
-2 2 0 10 3 7 50 -1 -1 0.000 0 0 -1 0 0 5
+2 2 0 10 16 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3900 3000 5700 3000 5700 4200 3900 4200 3900 3000

Modified: trunk/eda/fped/icons/vec.fig
===================================================================
--- trunk/eda/fped/icons/vec.fig	2009-12-15 21:24:30 UTC (rev 5757)
+++ trunk/eda/fped/icons/vec.fig	2009-12-16 17:25:13 UTC (rev 5758)
@@ -7,7 +7,7 @@
 Single
 -2
 1200 2
-0 32 #c0c000
+0 32 #a0a000
 2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
 	 3600 2400 6000 2400 6000 4800 3600 4800 3600 2400
 2 1 0 10 32 7 50 -1 -1 0.000 0 0 -1 1 0 2




More information about the commitlog mailing list