Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#11114) units should have transparent backgrounds
Home

[Freeciv-Dev] (PR#11114) units should have transparent backgrounds

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#11114) units should have transparent backgrounds
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Sat, 20 Nov 2004 17:03:40 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=11114 >

> [kauf - Sun Nov 21 00:46:12 2004]:
> 
> for gtk2, there should be a client option to remove the ugly-looking color
> backgrounds from things like the production dialog.

Here's the patch.

Index: client/gui-gtk-2.0/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/graphics.c,v
retrieving revision 1.27
diff -u -u -r1.27 graphics.c
--- client/gui-gtk-2.0/graphics.c       20 Nov 2004 08:17:37 -0000      1.27
+++ client/gui-gtk-2.0/graphics.c       21 Nov 2004 01:03:13 -0000
@@ -391,21 +391,28 @@
   if (pcanvas->type == CANVAS_PIXBUF) {
     width = gdk_pixbuf_get_width(pcanvas->v.pixbuf);
     height = gdk_pixbuf_get_height(pcanvas->v.pixbuf);
+    gdk_pixbuf_fill(pcanvas->v.pixbuf, 0x00000000);
   } else {
+    if (pcanvas->type == CANVAS_PIXCOMM) {
+      gtk_pixcomm_clear(pcanvas->v.pixcomm);
+    }
+
     /* Guess */
     width = UNIT_TILE_WIDTH;
     height = UNIT_TILE_HEIGHT;
   }
 
-  /* Give tile a background color, based on the type of unit */
-  switch (type->move_type) {
-    case LAND_MOVING: bg_color = COLOR_STD_GROUND; break;
-    case SEA_MOVING:  bg_color = COLOR_STD_OCEAN;  break;
-    case HELI_MOVING: bg_color = COLOR_STD_YELLOW; break;
-    case AIR_MOVING:  bg_color = COLOR_STD_CYAN;   break;
-    default:         bg_color = COLOR_STD_BLACK;  break;
+  if (solid_unit_icon_bg) {
+    /* Give tile a background color, based on the type of unit */
+    switch (type->move_type) {
+      case LAND_MOVING: bg_color = COLOR_STD_GROUND; break;
+      case SEA_MOVING:  bg_color = COLOR_STD_OCEAN;  break;
+      case HELI_MOVING: bg_color = COLOR_STD_YELLOW; break;
+      case AIR_MOVING:  bg_color = COLOR_STD_CYAN;   break;
+      default:       bg_color = COLOR_STD_BLACK;  break;
+    }
+    canvas_put_rectangle(pcanvas, bg_color, 0, 0, width, height);
   }
-  canvas_put_rectangle(pcanvas, bg_color, 0, 0, width, height);
 
   /* Finally, put a picture of the unit in the tile */
   canvas_put_sprite(pcanvas, 0, 0, type->sprite, 
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.92
diff -u -u -r1.92 gui_main.c
--- client/gui-gtk-2.0/gui_main.c       17 Nov 2004 18:04:40 -0000      1.92
+++ client/gui-gtk-2.0/gui_main.c       21 Nov 2004 01:03:13 -0000
@@ -85,6 +85,7 @@
 
 bool fullscreen_mode = TRUE;
 bool enable_tabs = TRUE;
+bool solid_unit_icon_bg = FALSE;
 
 GtkWidget *toplevel;
 GdkWindow *root_window;
@@ -139,6 +140,7 @@
   GEN_BOOL_OPTION(show_task_icons,     N_("Show worklist task icons")),
   GEN_BOOL_OPTION(fullscreen_mode,     N_("Fullscreen Mode")),
   GEN_BOOL_OPTION(enable_tabs,         N_("Enable status report tabs")),
+  GEN_BOOL_OPTION(solid_unit_icon_bg,  N_("Solid unit icon background color"))
 };
 const int num_gui_options = ARRAY_SIZE(gui_options);
 
Index: client/gui-gtk-2.0/gui_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.h,v
retrieving revision 1.17
diff -u -u -r1.17 gui_main.h
--- client/gui-gtk-2.0/gui_main.h       8 Nov 2004 00:14:29 -0000       1.17
+++ client/gui-gtk-2.0/gui_main.h       21 Nov 2004 01:03:13 -0000
@@ -43,6 +43,7 @@
 
 extern bool fullscreen_mode;
 extern bool enable_tabs;
+extern bool solid_unit_icon_bg;
 
 extern GdkGC *          civ_gc;
 extern GdkGC *          mask_fg_gc;

[Prev in Thread] Current Thread [Next in Thread]