Complete.Org: Mailing Lists: Archives: freeciv-dev: February 1999:
[Freeciv-Dev] consistent/optional popup city centering
Home

[Freeciv-Dev] consistent/optional popup city centering

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] consistent/optional popup city centering
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Fri, 19 Feb 1999 23:11:21 +1100

It was previously pointed out that the current behaviour of 
"Popup City" is inconsistent between the messages window and 
the city report, in that one centers the map and the other 
does not.  The attached patch fixes this inconsistency, and 
makes the centering behaviour for both cases a (single) client 
option.

-- David
diff -u -r --exclude-from exclude freeciv-cvs/client/Freeciv.h 
freeciv-mod/client/Freeciv.h
--- freeciv-cvs/client/Freeciv.h        Tue Feb 16 22:38:06 1999
+++ freeciv-mod/client/Freeciv.h        Fri Feb 19 22:30:26 1999
@@ -741,8 +741,15 @@
 "Freeciv*optiondiagonalroadstoggle.fromVert:   optionwakeupfocustoggle",
 "Freeciv*optiondiagonalroadstoggle.fromHoriz:  optiondiagonalroadslabel",
 "Freeciv*optiondiagonalroadstoggle.internalHeight: 0",
+"Freeciv*optioncenpoplabel.label:            Center map when Popup city\\ ",
+"Freeciv*optioncenpoplabel.borderWidth: 0",
+"Freeciv*optioncenpoplabel.fromVert:    optiondiagonalroadstoggle",
+"Freeciv*optioncenpoptoggle.label:     Yes",
+"Freeciv*optioncenpoptoggle.fromVert:  optiondiagonalroadstoggle",
+"Freeciv*optioncenpoptoggle.fromHoriz: optioncenpoplabel",
+"Freeciv*optioncenpoptoggle.internalHeight: 0",
 "Freeciv*optionokcommand.label:          Close",
-"Freeciv*optionokcommand.fromVert:       optiondiagonalroadslabel",
+"Freeciv*optionokcommand.fromVert:       optioncenpoplabel",
 "Freeciv*messageoptpopup.title:        Message Options",
 "Freeciv*messageoptpopup*Label.background:  lightblue",
 "Freeciv*messageoptpopup*Label.borderWidth: 0",
diff -u -r --exclude-from exclude freeciv-cvs/client/cityrep.c 
freeciv-mod/client/cityrep.c
--- freeciv-cvs/client/cityrep.c        Thu Feb 18 14:36:16 1999
+++ freeciv-mod/client/cityrep.c        Fri Feb 19 22:15:38 1999
@@ -46,6 +46,7 @@
 
 extern struct connection aconnection;
 extern int delay_report_update;
+extern int center_when_popup_city;
 
 /* abbreviate long city names to this length in the city report: */
 #define REPORT_CITYNAME_ABBREV 15 
@@ -672,7 +673,9 @@
   if(ret->list_index!=XAW_LIST_NONE) {
     struct city *pcity;
     if((pcity=cities_in_list[ret->list_index])) {
-      center_tile_mapcanvas(pcity->x, pcity->y);
+      if (center_when_popup_city) {
+       center_tile_mapcanvas(pcity->x, pcity->y);
+      }
       popup_city_dialog(pcity, 0);
     }
   }
diff -u -r --exclude-from exclude freeciv-cvs/client/civclient.c 
freeciv-mod/client/civclient.c
--- freeciv-cvs/client/civclient.c      Tue Feb 16 21:50:55 1999
+++ freeciv-mod/client/civclient.c      Fri Feb 19 22:09:11 1999
@@ -55,6 +55,7 @@
 int auto_center_on_unit=1;
 int wakeup_focus=1;
 int draw_diagonal_roads=1;
+int center_when_popup_city=1;
 
 int seconds_to_turndone;
 
diff -u -r --exclude-from exclude freeciv-cvs/client/messagewin.c 
freeciv-mod/client/messagewin.c
--- freeciv-cvs/client/messagewin.c     Thu Nov 12 18:22:05 1998
+++ freeciv-mod/client/messagewin.c     Fri Feb 19 22:14:56 1999
@@ -39,6 +39,7 @@
 
 extern Widget toplevel;
 extern int ai_popup_windows;
+extern int center_when_popup_city;
 
 Widget meswin_dialog_shell;
 Widget meswin_form;
@@ -407,8 +408,9 @@
     y = ypos[ret->list_index];
     if((x || y) && (pcity=map_get_city(x,y))
        && (pcity->owner == game.player_idx)) {
-      /* should we move the map? */
-      /* center_tile_mapcanvas(x,y); */
+      if (center_when_popup_city) {
+       center_tile_mapcanvas(x,y);
+      }
       popup_city_dialog(pcity, 0);
     }
   }
diff -u -r --exclude-from exclude freeciv-cvs/client/optiondlg.c 
freeciv-mod/client/optiondlg.c
--- freeciv-cvs/client/optiondlg.c      Thu Feb 18 18:39:19 1999
+++ freeciv-mod/client/optiondlg.c      Fri Feb 19 22:24:51 1999
@@ -55,6 +55,7 @@
 extern int auto_center_on_unit;
 extern int wakeup_focus;
 extern int draw_diagonal_roads;
+extern int center_when_popup_city;
 
 /******************************************************************/
 
@@ -77,6 +78,7 @@
   GEN_OPT(auto_center_on_unit),
   GEN_OPT(wakeup_focus),
   GEN_OPT(draw_diagonal_roads),
+  GEN_OPT(center_when_popup_city),
   { NULL, NULL }
 };
 
@@ -91,6 +93,7 @@
 Widget option_autocenter_toggle;
 Widget option_wakeup_focus_toggle;
 Widget option_diagonal_roads_toggle;
+Widget option_cenpop_toggle;
 
 /******************************************************************/
 void create_option_dialog(void);
@@ -122,6 +125,8 @@
                 XtNlabel, wakeup_focus?"Yes":"No", NULL);
   XtVaSetValues(option_diagonal_roads_toggle, XtNstate, draw_diagonal_roads,
                 XtNlabel, draw_diagonal_roads?"Yes":"No", NULL);
+  XtVaSetValues(option_cenpop_toggle, XtNstate, center_when_popup_city,
+                XtNlabel, center_when_popup_city?"Yes":"No", NULL);
 
   xaw_set_relative_position(toplevel, option_dialog_shell, 25, 25);
   XtPopup(option_dialog_shell, XtGrabNone);
@@ -218,6 +223,15 @@
                                                         option_form,
                                                         NULL);
 
+  XtVaCreateManagedWidget("optioncenpoplabel",
+                          labelWidgetClass,
+                         option_form, NULL);
+  option_cenpop_toggle =
+    XtVaCreateManagedWidget("optioncenpoptoggle",
+                           toggleWidgetClass,
+                           option_form,
+                           NULL);
+
   option_ok_command = XtVaCreateManagedWidget("optionokcommand", 
                                              commandWidgetClass,
                                              option_form,
@@ -235,6 +249,7 @@
   XtAddCallback(option_autocenter_toggle, XtNcallback, toggle_callback, NULL);
   XtAddCallback(option_wakeup_focus_toggle, XtNcallback, toggle_callback, 
NULL);
   XtAddCallback(option_diagonal_roads_toggle, XtNcallback, toggle_callback, 
NULL);
+  XtAddCallback(option_cenpop_toggle, XtNcallback, toggle_callback, NULL);
   
 
   XtRealizeWidget(option_dialog_shell);
@@ -284,6 +299,8 @@
   wakeup_focus=b;
   XtVaGetValues(option_diagonal_roads_toggle, XtNstate, &b, NULL);
   draw_diagonal_roads=b;
+  XtVaGetValues(option_cenpop_toggle, XtNstate, &b, NULL);
+  center_when_popup_city=b;
 }
 
 /****************************************************************
diff -u -r --exclude-from exclude freeciv-cvs/data/Freeciv 
freeciv-mod/data/Freeciv
--- freeciv-cvs/data/Freeciv    Tue Feb 16 22:37:21 1999
+++ freeciv-mod/data/Freeciv    Fri Feb 19 22:30:20 1999
@@ -974,8 +974,17 @@
 Freeciv*optiondiagonalroadstoggle.fromHoriz:   optiondiagonalroadslabel
 Freeciv*optiondiagonalroadstoggle.internalHeight: 0
 
+Freeciv*optioncenpoplabel.label:             Center map when Popup city\ 
+Freeciv*optioncenpoplabel.borderWidth: 0
+Freeciv*optioncenpoplabel.fromVert:    optiondiagonalroadstoggle
+
+Freeciv*optioncenpoptoggle.label:      Yes
+Freeciv*optioncenpoptoggle.fromVert:   optiondiagonalroadstoggle
+Freeciv*optioncenpoptoggle.fromHoriz:  optioncenpoplabel
+Freeciv*optioncenpoptoggle.internalHeight: 0
+
 Freeciv*optionokcommand.label:          Close
-Freeciv*optionokcommand.fromVert:       optiondiagonalroadslabel
+Freeciv*optionokcommand.fromVert:       optioncenpoplabel
 
 !
 ! The message options dialog

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] consistent/optional popup city centering, David Pfitzner <=