Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2005:
[Freeciv-Dev] Re: (PR#13724) gui-xaw should use text.c functions
Home

[Freeciv-Dev] Re: (PR#13724) gui-xaw should use text.c functions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13724) gui-xaw should use text.c functions
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Wed, 24 Aug 2005 18:37:22 -0700
Reply-to: bugs@xxxxxxxxxxx

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

On Sat, 20 Aug 2005 19:30:14 -0700
Jason Short <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:

> update_info_label should use get_info_label_text
> 
> main_show_info_popup should use get_info_label_text_popup
 
Sure. Patch attached.

> ...and probably others.

Will look for them.

Thanks, evyscr.

Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.120
diff -u -r1.120 gui_main.c
--- client/gui-xaw/gui_main.c   9 Aug 2005 09:19:04 -0000       1.120
+++ client/gui-xaw/gui_main.c   25 Aug 2005 01:34:15 -0000
@@ -39,11 +39,12 @@
 
 #include "fciconv.h"
 #include "fcintl.h"
+#include "log.h"
+#include "support.h"
+
 #include "game.h"
 #include "government.h"
-#include "log.h"
 #include "map.h"
-#include "support.h"
 #include "version.h"
 
 #include "civclient.h"
@@ -51,6 +52,7 @@
 #include "clinet.h"
 #include "control.h"
 #include "options.h"
+#include "text.h"
 #include "tilespec.h"
 
 #include "actions.h"
@@ -717,53 +719,30 @@
 **************************************************************************/
 void main_show_info_popup(XEvent *event)
 {
-  XButtonEvent *ev=(XButtonEvent *)event;
-  struct player_research* research = get_player_research(game.player_ptr);
-  if(ev->button==Button1) {
+  XButtonEvent *ev = (XButtonEvent *)event;
+
+  if (ev->button == Button1) {
     Widget  p;
     Position x, y;
     Dimension w, h;
-    char buf[512];
 
-    my_snprintf(buf, sizeof(buf),
-               _("%s People\n"
-                 "Year: %s Turn: %d\n"
-                 "Gold: %d\n"
-                 "Net Income: %d\n"
-                 "Tax:%d Lux:%d Sci:%d\n"
-                 "Researching %s: %d/%d\n"
-                 "Government: %s"),
-               population_to_text(civ_population(game.player_ptr)),
-               textyear(game.info.year), game.info.turn,
-               game.player_ptr->economic.gold,
-               player_get_expected_income(game.player_ptr),
-               game.player_ptr->economic.tax,
-               game.player_ptr->economic.luxury,
-               game.player_ptr->economic.science,
-               (research->researching == A_UNSET) ?
-                 advances[A_NONE].name :
-                 advances[research->researching].name,
-               research->bulbs_researched,
-               total_bulbs_required(game.player_ptr),
-               get_government_name(game.player_ptr->government));
-
-    p=XtCreatePopupShell("popupinfo", 
-                        overrideShellWidgetClass, 
-                        info_command, NULL, 0);
+    p = XtCreatePopupShell("popupinfo", 
+                          overrideShellWidgetClass, 
+                          info_command, NULL, 0);
 
-    XtAddCallback(p,XtNpopdownCallback,destroy_me_callback,NULL);
+    XtAddCallback(p, XtNpopdownCallback, destroy_me_callback, NULL);
 
-    XtVaCreateManagedWidget("fullinfopopuplabel", 
+    XtVaCreateManagedWidget("fullinfopopuplabel",
                            labelWidgetClass,
                            p,
-                           XtNlabel, buf,
+                           XtNlabel, get_info_label_text_popup(),
                            NULL);
 
     XtRealizeWidget(p);
 
     XtVaGetValues(p, XtNwidth, &w, XtNheight, &h,  NULL);
     XtTranslateCoords(info_command, ev->x, ev->y, &x, &y);
-    XtVaSetValues(p, XtNx, x-w/2, XtNy, y-h/2, NULL);
+    XtVaSetValues(p, XtNx, x - w / 2, XtNy, y - h / 2, NULL);
     XtPopupSpringLoaded(p);
   }
 }
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.204
diff -u -r1.204 mapview.c
--- client/gui-xaw/mapview.c    28 May 2005 10:47:21 -0000      1.204
+++ client/gui-xaw/mapview.c    25 Aug 2005 01:34:15 -0000
@@ -165,34 +165,23 @@
 **************************************************************************/
 void update_info_label(void)
 {
-  char buffer[512]; int d;
+  int d;
   
-  my_snprintf(buffer, sizeof(buffer),
-             _("%s People\n"
-               "Year: %s\n"
-               "Gold: %d\n"
-               "Tax:%d Lux:%d Sci:%d"),
-         population_to_text(civ_population(game.player_ptr)),
-         textyear(game.info.year),
-         game.player_ptr->economic.gold,
-         game.player_ptr->economic.tax,
-         game.player_ptr->economic.luxury,
-         game.player_ptr->economic.science);
-  xaw_set_label(info_command, buffer);
+  xaw_set_label(info_command, get_info_label_text());
 
   set_indicator_icons(client_research_sprite(),
                      client_warming_sprite(),
                      client_cooling_sprite(),
                      client_government_sprite());
 
-  d=0;
-  for(;d<(game.player_ptr->economic.luxury)/10;d++)
+  d = 0;
+  for(; d < (game.player_ptr->economic.luxury) / 10; d++)
     xaw_set_bitmap(econ_label[d], get_tax_sprite(tileset, O_LUXURY)->pixmap);
  
-  
for(;d<(game.player_ptr->economic.science+game.player_ptr->economic.luxury)/10;d++)
+  for(; d < (game.player_ptr->economic.science + 
game.player_ptr->economic.luxury) / 10; d++)
     xaw_set_bitmap(econ_label[d], get_tax_sprite(tileset, O_SCIENCE)->pixmap);
  
-   for(;d<10;d++)
+   for(; d < 10; d++)
      xaw_set_bitmap(econ_label[d], get_tax_sprite(tileset, O_GOLD)->pixmap);
  
   update_timeout_label();
Index: data/Freeciv.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/Freeciv.in,v
retrieving revision 1.10
diff -u -r1.10 Freeciv.in
--- data/Freeciv.in     24 Aug 2005 19:19:52 -0000      1.10
+++ data/Freeciv.in     25 Aug 2005 01:34:15 -0000
@@ -2565,7 +2565,7 @@
 Freeciv*overviewcanvas.right:                      chainRight
 Freeciv*overviewcanvas.resizable:                  True
 
-Freeciv*infocommand.label:     \n\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
\ 
+Freeciv*infocommand.label:     \n\n\n\n\n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 
\ \ \ \ \ \ 
 Freeciv*infocommand.background:                    gray84
 Freeciv*infocommand.foreground:                    black
 Freeciv*infocommand.justify:                       left

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#13724) gui-xaw should use text.c functions, Egor Vyscrebentsov <=