Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2692) [PATCH] gui-gtk: "Center" button in supported un
Home

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2692) [PATCH] gui-gtk: "Center" button in supported unit popup
From: "Stepan Roh via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 31 Dec 2002 09:21:47 -0800
Reply-to: rt@xxxxxxxxxxxxxx

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.149
diff -u -r1.149 citydlg.c
--- client/gui-gtk/citydlg.c    2002/12/15 22:43:46     1.149
+++ client/gui-gtk/citydlg.c    2002/12/31 17:16:47
@@ -268,6 +268,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);
@@ -2478,6 +2479,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,
@@ -2737,6 +2739,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

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