Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12529) xaw client compoilation breakeage by #12513
Home

[Freeciv-Dev] Re: (PR#12529) xaw client compoilation breakeage by #12513

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: infyquest@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12529) xaw client compoilation breakeage by #12513
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 19 Mar 2005 14:34:21 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12529 >

This patch allows gui-xaw to compile.  I will commit immediately.

-jason


Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.132
diff -u -r1.132 citydlg.c
--- client/gui-xaw/citydlg.c    8 Feb 2005 22:14:17 -0000       1.132
+++ client/gui-xaw/citydlg.c    19 Mar 2005 22:33:22 -0000
@@ -73,8 +73,6 @@
 #include "text.h"
 #include "tilespec.h"
 
-#include "cityicon.ico"
-
 #define MIN_NUM_CITIZENS       22
 #define MAX_NUM_CITIZENS       50
 #define DEFAULT_NUM_CITIZENS   38
@@ -480,7 +478,6 @@
     "9",
     0
   };
-  static Pixmap icon_pixmap = 0;
 
   int i, itemWidth;
   struct city_dialog *pdialog;
@@ -508,15 +505,6 @@
   pdialog->present_unit_base=0;
   pdialog->worklist_shell = NULL;
 
-  if (!icon_pixmap) {
-    icon_pixmap =
-       XCreateBitmapFromData(display,
-                             RootWindowOfScreen(XtScreen(toplevel)),
-                             cityicon_bits,
-                             cityicon_width, cityicon_height);
-  }
-
-
   pdialog->shell=
     XtVaCreatePopupShell(pcity->name,
                         make_modal ? transientShellWidgetClass :
@@ -1008,8 +996,9 @@
                XtNfromHoriz, (XtArgVal)relative,
                NULL);
 
-  
-  XtVaSetValues(pdialog->shell, XtNiconPixmap, icon_pixmap, NULL);
+  /* FIXME: this ignores the mask. */
+  XtVaSetValues(pdialog->shell, XtNiconPixmap,
+               get_icon_sprite(tileset, ICON_CITYDLG), NULL);
 
 
   XtAddCallback(pdialog->sell_command, XtNcallback, sell_callback,
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.107
diff -u -r1.107 gui_main.c
--- client/gui-xaw/gui_main.c   16 Mar 2005 19:30:38 -0000      1.107
+++ client/gui-xaw/gui_main.c   19 Mar 2005 22:33:23 -0000
@@ -738,10 +738,10 @@
                game.player_ptr->economic.tax,
                game.player_ptr->economic.luxury,
                game.player_ptr->economic.science,
-               (game.player_ptr->research.researching == A_UNSET) ?
+               (game.player_ptr->research->researching == A_UNSET) ?
                  advances[A_NONE].name :
-                 advances[game.player_ptr->research.researching].name,
-               game.player_ptr->research.bulbs_researched,
+                 advances[game.player_ptr->research->researching].name,
+               game.player_ptr->research->bulbs_researched,
                total_bulbs_required(game.player_ptr),
                get_government_name(game.player_ptr->government));
 
Index: client/gui-xaw/inteldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/inteldlg.c,v
retrieving revision 1.25
diff -u -r1.25 inteldlg.c
--- client/gui-xaw/inteldlg.c   22 Jan 2005 19:45:41 -0000      1.25
+++ client/gui-xaw/inteldlg.c   19 Mar 2005 22:33:24 -0000
@@ -239,16 +239,16 @@
                          XtNlabel, buf,
                          NULL);
 
-  if (pdialog->pplayer->research.researching == A_UNSET) {
+  if (pdialog->pplayer->research->researching == A_UNSET) {
     my_snprintf(buf, sizeof(buf), _("Researching: %s(%d/%d)"),
                advances[A_NONE].name,
-               pdialog->pplayer->research.bulbs_researched,
+               pdialog->pplayer->research->bulbs_researched,
                total_bulbs_required(pdialog->pplayer));
   } else {
     my_snprintf(buf, sizeof(buf), _("Researching: %s(%d/%d)"),
                get_tech_name(pdialog->pplayer,
-                             pdialog->pplayer->research.researching),
-               pdialog->pplayer->research.bulbs_researched,
+                             pdialog->pplayer->research->researching),
+               pdialog->pplayer->research->bulbs_researched,
                total_bulbs_required(pdialog->pplayer));
   }
 
Index: client/gui-xaw/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/spaceshipdlg.c,v
retrieving revision 1.24
diff -u -r1.24 spaceshipdlg.c
--- client/gui-xaw/spaceshipdlg.c       22 Jan 2005 19:45:41 -0000      1.24
+++ client/gui-xaw/spaceshipdlg.c       19 Mar 2005 22:33:24 -0000
@@ -182,6 +182,7 @@
 struct spaceship_dialog *create_spaceship_dialog(struct player *pplayer)
 {
   struct spaceship_dialog *pdialog;
+  int ss_w, ss_h;
 
   pdialog=fc_malloc(sizeof(struct spaceship_dialog));
   pdialog->pplayer=pplayer;
@@ -205,14 +206,15 @@
 
   XtVaSetValues(pdialog->player_label, XtNlabel, (XtArgVal)pplayer->name, 
NULL);
 
+  get_spaceship_dimensions(&ss_w, &ss_h);
   pdialog->image_canvas=
     XtVaCreateManagedWidget("spaceshipimagecanvas",
                            xfwfcanvasWidgetClass,
                            pdialog->main_form,
                            "exposeProc", 
(XtArgVal)spaceship_image_canvas_expose,
                            "exposeProcData", (XtArgVal)pdialog,
-                           XtNwidth,  sprites.spaceship.habitation->width * 7,
-                           XtNheight, sprites.spaceship.habitation->height * 7,
+                           XtNwidth, ss_w,
+                           XtNheight, ss_h,
                            NULL);
 
   pdialog->info_label=
@@ -267,74 +269,9 @@
 *****************************************************************/
 void spaceship_dialog_update_image(struct spaceship_dialog *pdialog)
 {
-  int i, j, k, x, y;  
-  struct Sprite *sprite = sprites.spaceship.habitation;   /* for size */
-  struct player_spaceship *ship = &pdialog->pplayer->spaceship;
-
-  XSetForeground(display, fill_bg_gc, colors_standard[COLOR_STD_BLACK]);
-  XFillRectangle(display, XtWindow(pdialog->image_canvas), fill_bg_gc, 0, 0,
-                sprite->width * 7, sprite->height * 7);
-
-  for (i=0; i < NUM_SS_MODULES; i++) {
-    j = i/3;
-    k = i%3;
-    if ((k==0 && j >= ship->habitation)
-       || (k==1 && j >= ship->life_support)
-       || (k==2 && j >= ship->solar_panels)) {
-      continue;
-    }
-    x = modules_info[i].x * sprite->width  / 4 - sprite->width / 2;
-    y = modules_info[i].y * sprite->height / 4 - sprite->height / 2;
-
-    sprite = (k==0 ? sprites.spaceship.habitation :
-             k==1 ? sprites.spaceship.life_support :
-                    sprites.spaceship.solar_panels);
-    XSetClipOrigin(display, civ_gc, x, y);
-    XSetClipMask(display, civ_gc, sprite->mask);
-    XCopyArea(display, sprite->pixmap, XtWindow(pdialog->image_canvas), 
-             civ_gc, 
-             0, 0,
-             sprite->width, sprite->height, x, y);
-    XSetClipMask(display,civ_gc,None);
-  }
-
-  for (i=0; i < NUM_SS_COMPONENTS; i++) {
-    j = i/2;
-    k = i%2;
-    if ((k==0 && j >= ship->fuel)
-       || (k==1 && j >= ship->propulsion)) {
-      continue;
-    }
-    x = components_info[i].x * sprite->width  / 4 - sprite->width / 2;
-    y = components_info[i].y * sprite->height / 4 - sprite->height / 2;
-
-    sprite = (k==0) ? sprites.spaceship.fuel : sprites.spaceship.propulsion;
+  struct canvas canvas = {.pixmap = XtWindow(pdialog->image_canvas)};
 
-    XSetClipOrigin(display, civ_gc, x, y);
-    XSetClipMask(display, civ_gc, sprite->mask);
-    XCopyArea(display, sprite->pixmap, XtWindow(pdialog->image_canvas), 
-             civ_gc, 
-             0, 0,
-             sprite->width, sprite->height, x, y);
-    XSetClipMask(display,civ_gc,None);
-  }
-
-  sprite = sprites.spaceship.structural;
-
-  for (i=0; i < NUM_SS_STRUCTURALS; i++) {
-    if (!ship->structure[i])
-      continue;
-    x = structurals_info[i].x * sprite->width  / 4 - sprite->width / 2;
-    y = structurals_info[i].y * sprite->height / 4 - sprite->height / 2;
-
-    XSetClipOrigin(display, civ_gc, x, y);
-    XSetClipMask(display, civ_gc, sprite->mask);
-    XCopyArea(display, sprite->pixmap, XtWindow(pdialog->image_canvas), 
-             civ_gc, 
-             0, 0,
-             sprite->width, sprite->height, x, y);
-    XSetClipMask(display,civ_gc,None);
-  }
+  put_spaceship(&canvas, 0, 0, pdialog->pplayer);
 }
 
 

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