[Freeciv-Dev] Re: (PR#2328) get_mapview_dimensions
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients:; |
Subject: |
[Freeciv-Dev] Re: (PR#2328) get_mapview_dimensions |
From: |
"Jason Short via RT" <rt@xxxxxxxxxxxxxx> |
Date: |
Wed, 13 Nov 2002 16:27:37 -0800 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
Jason Short via RT wrote:
> The attached patch...
That would be this patch.
jason
? client/gui-gtk/diff
? client/gui-stub/stub-update.diff
? client/gui-xaw/diff
Index: client//gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.127
diff -u -r1.127 mapview.c
--- client//gui-gtk/mapview.c 2002/08/25 11:20:56 1.127
+++ client//gui-gtk/mapview.c 2002/11/14 00:09:08
@@ -120,6 +120,22 @@
static GtkObject *map_hadj, *map_vadj;
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ gdk_window_get_size(map_canvas->window,
+ map_view_pixel_width,
+ map_view_pixel_height);
+}
+
/**************************************************************************
...
**************************************************************************/
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.14
diff -u -r1.14 mapview.c
--- client//gui-gtk-2.0/mapview.c 2002/11/02 21:27:44 1.14
+++ client//gui-gtk-2.0/mapview.c 2002/11/14 00:09:09
@@ -120,6 +120,21 @@
static GtkObject *map_hadj, *map_vadj;
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ gdk_window_get_size(map_canvas->window,
+ map_view_pixel_width, map_view_pixel_height);
+}
+
/**************************************************************************
...
**************************************************************************/
Index: client//gui-mui/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapview.c,v
retrieving revision 1.41
diff -u -r1.41 mapview.c
--- client//gui-mui/mapview.c 2002/08/24 14:37:44 1.41
+++ client//gui-mui/mapview.c 2002/11/14 00:09:09
@@ -77,6 +77,21 @@
return xget(main_map_area, MUIA_Map_VertVisible);
}
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = xget(main_map_area, MUIA_Map_HorizFirst);
+ *map_view_topleft_map_y = xget(main_map_area, MUIA_Map_VertFirst);
+ *map_view_pixel_width = _mwidth(main_map_area); /* !! */
+ *map_view_pixel_height = _mheight(main_map_area); /* !! */
+}
+
/**************************************************************************
This function is called to decrease a unit's HP smoothly in battle
when combat_animation is turned on.
Index: client//gui-stub/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/mapview.c,v
retrieving revision 1.12
diff -u -r1.12 mapview.c
--- client//gui-stub/mapview.c 2002/08/24 14:37:46 1.12
+++ client//gui-stub/mapview.c 2002/11/14 00:09:09
@@ -2,6 +2,21 @@
#include "mapview.h"
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ /* PORTME */
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ *map_view_pixel_width = canvas_width;
+ *map_view_pixel_height = canvas_height;
+}
bool tile_visible_mapcanvas(int x, int y)
{
Index: client//gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.29
diff -u -r1.29 mapview.c
--- client//gui-win32/mapview.c 2002/08/24 14:37:47 1.29
+++ client//gui-win32/mapview.c 2002/11/14 00:09:10
@@ -109,6 +109,22 @@
static void put_line(HDC hdc, int x, int y,
int dir, bool write_to_screen);
static void draw_rates(HDC hdc);
+
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ *map_view_pixel_width = map_win_width;
+ *map_view_pixel_height = map_win_height;
+}
+
/**************************************************************************
**************************************************************************/
Index: client//gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.99
diff -u -r1.99 mapview.c
--- client//gui-xaw/mapview.c 2002/08/24 14:37:48 1.99
+++ client//gui-xaw/mapview.c 2002/11/14 00:09:11
@@ -62,6 +62,24 @@
Pixmap scaled_intro_pixmap;
int scaled_intro_pixmap_width, scaled_intro_pixmap_height;
+
+/***********************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+***********************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ XtVaGetValues(map_canvas,
+ XtNwidth, map_view_pixel_width,
+ XtNheight, map_view_pixel_height,
+ NULL);
+}
+
/**************************************************************************
Finds the pixel coordinates of a tile. Beside setting the results in
canvas_x,canvas_y it returns whether the tile is inside the visible map.
Index: client//include/mapview_g.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/include/mapview_g.h,v
retrieving revision 1.19
diff -u -r1.19 mapview_g.h
--- client//include/mapview_g.h 2002/08/24 14:37:50 1.19
+++ client//include/mapview_g.h 2002/11/14 00:09:11
@@ -19,6 +19,11 @@
struct unit;
struct city;
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height);
+
bool tile_visible_mapcanvas(int x, int y);
bool tile_visible_and_not_on_border_mapcanvas(int x, int y);
|
|