1
0
mirror of git://projects.qi-hardware.com/fped.git synced 2024-06-24 16:25:27 +03:00

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



git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5758 99fdad57-331a-0410-800a-d7fa5415bdb3
This commit is contained in:
werner 2009-12-16 17:25:13 +00:00
parent b37a8599d9
commit aca443f566
9 changed files with 36 additions and 14 deletions

View File

@ -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 ---------------------------------------------------

View File

@ -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);
}

View File

@ -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);

View File

@ -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),

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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