Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#2692) [PATCH] gui-gtk: "Center" button in supporte
Home

[Freeciv-Dev] Re: (PR#2692) [PATCH] gui-gtk: "Center" button in supporte

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2692) [PATCH] gui-gtk: "Center" button in supported unit popup
From: "Stepan Roh via RT" <rt@xxxxxxxxxxxxxx>
Date: Sat, 4 Jan 2003 08:21:29 -0800
Reply-to: rt@xxxxxxxxxxxxxx

Attached is updated patch which includes code for gui-gtk-2.0 (untested).

Have a nice day.

Stepan Roh

On Tue, 31 Dec 2002, Stepan Roh via RT wrote:

>
> Features:
>
> - adds "Center" button to supported unit popup (in city dialog) which
> centers map on unit's location without unit activation
> - gui-gtk only
>
> Patch attached (cvs diff -u agains latest CVS HEAD).
>
> Tested with gtk client.
>
> Have a nice day.
>
> Stepan Roh
>
>

Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.150
diff -u -r1.150 citydlg.c
--- client/gui-gtk/citydlg.c    2003/01/01 11:51:32     1.150
+++ client/gui-gtk/citydlg.c    2003/01/04 16:16:52
@@ -269,6 +269,7 @@
 static void unit_homecity_callback(gpointer data);
 static void unit_upgrade_callback(gpointer data);
 static void unit_upgrade_callback_yes(gpointer data);
+static void unit_center_callback(gpointer data);
 
 static void citizens_callback(GtkWidget * w, GdkEventButton * ev,
                              gpointer data);
@@ -2488,6 +2489,7 @@
     popup_message_dialog(pdialog->shell,       /* "supported unit popup" */
                         _("Unit Commands"), unit_description(punit),
                         dummy_close_callback, NULL, 
+                        _("Cen_ter"), unit_center_callback, punit->id,
                         _("_Activate unit"), unit_activate_callback,
                         punit->id, _("Activate unit, _close dialog"),
                         supported_unit_activate_close_callback, punit->id,
@@ -2748,6 +2750,18 @@
   }
 }
 
+/****************************************************************
+...
+*****************************************************************/
+static void unit_center_callback(gpointer data)
+{
+  struct unit *punit;
+
+  if ((punit = player_find_unit_by_id(game.player_ptr, (size_t) data))) {
+    center_tile_mapcanvas(punit->x, punit->y);
+  }
+}
+
 /*** Callbacks for citizen bar, map funcs that are not update ***/
 /****************************************************************
 Somebody clicked our list of citizens. If they clicked a specialist
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.22
diff -u -r1.22 citydlg.c
--- client/gui-gtk-2.0/citydlg.c        2002/12/31 03:57:46     1.22
+++ client/gui-gtk-2.0/citydlg.c        2003/01/04 16:16:56
@@ -264,6 +264,7 @@
 static void unit_homecity_callback(GtkWidget * w, gpointer data);
 static void unit_upgrade_callback(GtkWidget * w, gpointer data);
 static void unit_cancel_callback(GtkWidget * w, gpointer data);
+static void unit_center_callback(GtkWidget * w, gpointer data);
 
 static void citizens_callback(GtkWidget * w, GdkEventButton * ev,
                              gpointer data);
@@ -2415,6 +2416,7 @@
 
     popup_message_dialog(pdialog->shell,       /* "supported unit popup" */
                         _("Unit Commands"), unit_description(punit),
+                        _("Cen_ter"), unit_center_callback, punit->id,
                         _("_Activate unit"), unit_activate_callback,
                         punit->id, _("Activate unit, _close dialog"),
                         supported_unit_activate_close_callback, punit->id,
@@ -2693,6 +2695,18 @@
 static void unit_cancel_callback(GtkWidget * w, gpointer data)
 {
   destroy_message_dialog(w);
+}
+
+/****************************************************************
+...
+*****************************************************************/
+static void unit_center_callback(GtkWidget * w, gpointer data)
+{
+  struct unit *punit;
+
+  if ((punit = player_find_unit_by_id(game.player_ptr, (size_t) data))) {
+    center_tile_mapcanvas(punit->x, punit->y);
+  }
 }
 
 /*** Callbacks for citizen bar, map funcs that are not update ***/

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#2692) [PATCH] gui-gtk: "Center" button in supported unit popup, Stepan Roh via RT <=