Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2362) get_center_tile_mapcanvas unification
Home

[Freeciv-Dev] (PR#2362) get_center_tile_mapcanvas unification

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2362) get_center_tile_mapcanvas unification
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 19 Nov 2002 11:28:34 -0800
Reply-to: rt@xxxxxxxxxxxxxx

This patch moves get_center_tile_mapcanvas into mapview_common.  It is 
quite straightforward.

jason

? client/gui-gtk/diff
? client/gui-stub/stub-update.diff
? client/gui-xaw/diff
Index: client//mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.14
diff -u -r1.14 mapview_common.c
--- client//mapview_common.c    2002/11/19 16:11:41     1.14
+++ client//mapview_common.c    2002/11/19 19:27:43
@@ -253,6 +253,20 @@
 }
 
 /**************************************************************************
+  Finds the current center tile of the mapcanvas.
+**************************************************************************/
+void get_center_tile_mapcanvas(int *map_x, int *map_y)
+{
+  int map_view_x0, map_view_y0, map_win_width, map_win_height;
+
+  get_mapview_dimensions(&map_view_x0, &map_view_y0,
+                        &map_win_width, &map_win_height);
+
+  /* This sets the pointers map_x and map_y */
+  get_map_xy(map_win_width / 2, map_win_height / 2, map_x, map_y);
+}
+
+/**************************************************************************
   Centers the mapview around (map_x, map_y).  (map_view_x0,
   map_view_y0) is the upper-left coordinates of the mapview; these
   should be (but aren't) stored globally - each GUI has separate
Index: client//mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.9
diff -u -r1.9 mapview_common.h
--- client//mapview_common.h    2002/11/19 16:11:41     1.9
+++ client//mapview_common.h    2002/11/19 19:27:43
@@ -47,6 +47,7 @@
 bool get_canvas_xy(int map_x, int map_y, int *canvas_x, int *canvas_y);
 void get_map_xy(int canvas_x, int canvas_y, int *map_x, int *map_y);
 
+void get_center_tile_mapcanvas(int *map_x, int *map_y);
 void base_center_tile_mapcanvas(int map_x, int map_y,
                                int *map_view_topleft_map_x,
                                int *map_view_topleft_map_y,
Index: client//gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.132
diff -u -r1.132 mapview.c
--- client//gui-gtk/mapview.c   2002/11/19 16:11:41     1.132
+++ client//gui-gtk/mapview.c   2002/11/19 19:27:44
@@ -691,18 +691,6 @@
 }
 
 /**************************************************************************
-...
-**************************************************************************/
-void get_center_tile_mapcanvas(int *x, int *y)
-{
-  int width, height;
-  gdk_window_get_size(map_canvas->window, &width, &height);
-
-  /* This sets the pointers x and y */
-  get_map_xy(width/2, height/2, x, y);
-}
-
-/**************************************************************************
 Centers the mapview around (x, y).
 
 This function is almost identical between all GUI's.
Index: client//gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.20
diff -u -r1.20 mapview.c
--- client//gui-gtk-2.0/mapview.c       2002/11/19 16:11:41     1.20
+++ client//gui-gtk-2.0/mapview.c       2002/11/19 19:27:45
@@ -693,18 +693,6 @@
 }
 
 /**************************************************************************
-...
-**************************************************************************/
-void get_center_tile_mapcanvas(int *x, int *y)
-{
-  int width, height;
-  gdk_window_get_size(map_canvas->window, &width, &height);
-
-  /* This sets the pointers x and y */
-  get_map_xy(width/2, height/2, x, y);
-}
-
-/**************************************************************************
 Centers the mapview around (x, y).
 
 This function is almost identical between all GUI's.
Index: client//gui-mui/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapview.c,v
retrieving revision 1.46
diff -u -r1.46 mapview.c
--- client//gui-mui/mapview.c   2002/11/19 16:11:41     1.46
+++ client//gui-mui/mapview.c   2002/11/19 19:27:45
@@ -448,19 +448,6 @@
 /**************************************************************************
 ...
 **************************************************************************/
-void get_center_tile_mapcanvas(int *x, int *y)
-{
-  int width, height;
-  width = _mwidth(main_map_area);
-  height = _mheight(main_map_area);
-
-  /* This sets the pointers x and y */
-  get_map_xy(width/2, height/2, x, y);
-}
-
-/**************************************************************************
-...
-**************************************************************************/
 void set_map_xy_start(int new_map_view_x0, int new_map_view_y0)
 {
   SetAttrs(main_map_area,
Index: client//gui-stub/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/mapview.c,v
retrieving revision 1.16
diff -u -r1.16 mapview.c
--- client//gui-stub/mapview.c  2002/11/19 16:11:41     1.16
+++ client//gui-stub/mapview.c  2002/11/19 19:27:46
@@ -82,12 +82,6 @@
        /* PORTME */
 }
 
-void
-get_center_tile_mapcanvas(int *x, int *y)
-{
-       /* PORTME */
-}
-
 /**************************************************************************
   Show descriptions for all cities visible on the map canvas.
 **************************************************************************/
Index: client//gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.35
diff -u -r1.35 mapview.c
--- client//gui-win32/mapview.c 2002/11/19 16:11:41     1.35
+++ client//gui-win32/mapview.c 2002/11/19 19:27:46
@@ -719,15 +719,6 @@
 
 **************************************************************************/
 void
-get_center_tile_mapcanvas(int *x, int *y)
-{
-  get_map_xy(map_win_width/2,map_win_height/2,x,y);    
-}
-
-/**************************************************************************
-
-**************************************************************************/
-void
 update_map_canvas(int x, int y, int width, int height,
                  bool write_to_screen)
 {
Index: client//gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.105
diff -u -r1.105 mapview.c
--- client//gui-xaw/mapview.c   2002/11/19 16:11:42     1.105
+++ client//gui-xaw/mapview.c   2002/11/19 19:27:47
@@ -437,18 +437,6 @@
 }
 
 /**************************************************************************
-...
-**************************************************************************/
-void get_center_tile_mapcanvas(int *x, int *y)
-{
-  Dimension width, height;
-  XtVaGetValues(map_canvas, XtNwidth, &width, XtNheight, &height, NULL);
-
-  /* This sets the pointers x and y */
-  get_map_xy(width/2, height/2, x, y);
-}
-
-/**************************************************************************
 Centers the mapview around (x, y).
 
 This function is almost identical between all GUI's.
Index: client//include/mapview_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/mapview_g.h,v
retrieving revision 1.22
diff -u -r1.22 mapview_g.h
--- client//include/mapview_g.h 2002/11/19 16:11:42     1.22
+++ client//include/mapview_g.h 2002/11/19 19:27:47
@@ -38,7 +38,6 @@
 void overview_update_tile(int x, int y);
 
 void center_tile_mapcanvas(int x, int y);
-void get_center_tile_mapcanvas(int *x, int *y);
 
 void show_city_descriptions(void);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2362) get_center_tile_mapcanvas unification, Jason Short via RT <=