diff --git a/Makefile b/Makefile index 3147a7f..99cf13e 100644 --- a/Makefile +++ b/Makefile @@ -80,15 +80,22 @@ endif .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 @@ -134,7 +141,7 @@ endif # ----- 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 --------------------------------------------------- diff --git a/gui_tool.c b/gui_tool.c index c3d16ff..1fb4f5f 100644 --- a/gui_tool.c +++ b/gui_tool.c @@ -1030,7 +1030,7 @@ GtkWidget *get_icon_by_inst(const struct inst *inst) default: abort(); } - return make_image(DA, image); + return make_transparent_image(DA, image); } diff --git a/gui_util.c b/gui_util.c index 2466f93..936ad57 100644 --- a/gui_util.c +++ b/gui_util.c @@ -176,14 +176,28 @@ GtkWidget *make_image(GdkDrawable *drawable, char **xpm) { 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); diff --git a/gui_util.h b/gui_util.h index 3ae73d4..3a630fb 100644 --- a/gui_util.h +++ b/gui_util.h @@ -60,6 +60,7 @@ void label_in_box_bg(GtkWidget *box, const char *color); 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), diff --git a/icons/arc.fig b/icons/arc.fig index b55155d..dca9d7e 100644 --- a/icons/arc.fig +++ b/icons/arc.fig @@ -7,7 +7,7 @@ A4 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 diff --git a/icons/circ.fig b/icons/circ.fig index 09101c5..2656168 100644 --- a/icons/circ.fig +++ b/icons/circ.fig @@ -7,6 +7,6 @@ A4 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 diff --git a/icons/line.fig b/icons/line.fig index 1d07543..0bba78e 100644 --- a/icons/line.fig +++ b/icons/line.fig @@ -9,5 +9,5 @@ Single 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 diff --git a/icons/rect.fig b/icons/rect.fig index e417cf9..04723b5 100644 --- a/icons/rect.fig +++ b/icons/rect.fig @@ -9,5 +9,5 @@ Single 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 diff --git a/icons/vec.fig b/icons/vec.fig index 9187915..2e2e58b 100644 --- a/icons/vec.fig +++ b/icons/vec.fig @@ -7,7 +7,7 @@ A4 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