[Freeciv-Dev] (PR#15663) SDL client: unusual map dimensions and the mini
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15663 >
> [dmarks - Mi 22. Feb 2006, 09:15:18]:
>
> Running a rather small uranus map, the minimap is aligned to the left as
> seen in this screenshot. Centered would IMHO be more aesthetic.
>
> -Daniel
>
The patch is almost finished, but I'm not sure if the unit info window
should be resized when the minimap is higher than the default height of
the minimap area or if it should keep its default size.
Here are two screenshots showing the difference:
http://rt.freeciv.org/Ticket/Attachment/113521/74097/pr15663-screen1.jpg
http://rt.freeciv.org/Ticket/Attachment/113521/74094/pr15663-screen2.jpg
What dou you think?
Index: client/gui-sdl/mapview.c
===================================================================
--- client/gui-sdl/mapview.c (Revision 11634)
+++ client/gui-sdl/mapview.c (Arbeitskopie)
@@ -386,10 +386,9 @@
canvas_free(overview_canvas);
}
- overview_canvas = canvas_create(MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH,
- MINI_MAP_H - DOUBLE_FRAME_WH);
+ overview_canvas = canvas_create(overview.width, overview.height);
- center_minimap_on_minimap_window();
+ resize_minimap();
}
/**************************************************************************
@@ -1069,9 +1068,11 @@
**************************************************************************/
void center_minimap_on_minimap_window(void)
{
- /* FIXME: really center */
- OVERVIEW_START_X = FRAME_WH;
- OVERVIEW_START_Y = FRAME_WH;
+ int width, height;
+ get_overview_area_dimensions(&width, &height);
+
+ OVERVIEW_START_X = FRAME_WH + (width - overview.width)/2;
+ OVERVIEW_START_Y = FRAME_WH + (height - overview.height)/2;
}
/**************************************************************************
Index: client/gui-sdl/mapctrl.c
===================================================================
--- client/gui-sdl/mapctrl.c (Revision 11634)
+++ client/gui-sdl/mapctrl.c (Arbeitskopie)
@@ -498,6 +498,26 @@
return -1;
}
+int resize_minimap(void)
+{
+ int w = OVERVIEW_TILE_WIDTH * map.xsize;
+ int h = OVERVIEW_TILE_HEIGHT * map.ysize;
+ int current_w = pMiniMap_Window->size.w - BLOCKM_W - DOUBLE_FRAME_WH;
+ int current_h = pMiniMap_Window->size.h - DOUBLE_FRAME_WH;
+
+ if ((((current_w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)
+ || (w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)) && (current_w !=
w)) ||
+ (((current_h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)
+ || (h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)) && (current_h != h))) {
+ Remake_MiniMap(w, h);
+ }
+ center_minimap_on_minimap_window();
+ refresh_overview();
+ update_menus();
+
+ return 0;
+}
+
#ifdef SCALE_MINIMAP
/* ============================================================== */
static int move_scale_minmap_dlg_callback(struct GUI *pWindow)
@@ -519,26 +539,6 @@
return -1;
}
-static int resize_minimap(void)
-{
- int w = OVERVIEW_TILE_WIDTH * map.xsize;
- int h = OVERVIEW_TILE_HEIGHT * map.ysize;
- int current_w = pMiniMap_Window->size.w - BLOCKM_W - DOUBLE_FRAME_WH;
- int current_h = pMiniMap_Window->size.h - DOUBLE_FRAME_WH;
-
- if ((((current_w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)
- || (w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)) && (current_w !=
w)) ||
- (((current_h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)
- || (h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)) && (current_h != h))) {
- Remake_MiniMap(w, h);
- }
- center_minimap_on_minimap_window();
- refresh_overview();
- update_menus();
-
- return 0;
-}
-
static int up_width_callback(struct GUI *pWidget)
{
redraw_widget(pWidget);
@@ -806,7 +806,7 @@
return -1;
}
-static int resize_unit_info(void)
+int resize_unit_info(void)
{
int w = INFO_WIDTH * map.xsize;
int h = INFO_HEIGHT * map.ysize;
@@ -1225,11 +1225,7 @@
SDL_Surface *pSurf;
struct GUI *pWidget = pMiniMap_Window;
- if(w < DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH) {
- w = DEFAULT_MINI_MAP_W;
- } else {
- w += BLOCKM_W + DOUBLE_FRAME_WH;
- }
+ w += BLOCKM_W + DOUBLE_FRAME_WH;
if(h < DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH) {
h = DEFAULT_MINI_MAP_H;
Index: client/gui-sdl/mapctrl.h
===================================================================
--- client/gui-sdl/mapctrl.h (Revision 11634)
+++ client/gui-sdl/mapctrl.h (Arbeitskopie)
@@ -63,6 +63,8 @@
void reset_main_widget_dest_buffer(void);
void set_new_units_window_pos(void);
void set_new_mini_map_window_pos(void);
+int resize_minimap(void);
+int resize_unit_info(void);
struct GUI * get_unit_info_window_widget(void);
struct GUI * get_minimap_window_widget(void);
struct GUI * get_tax_rates_widget(void);
Index: client/gui-sdl/mapview.c
===================================================================
--- client/gui-sdl/mapview.c (Revision 11634)
+++ client/gui-sdl/mapview.c (Arbeitskopie)
@@ -386,10 +386,10 @@
canvas_free(overview_canvas);
}
- overview_canvas = canvas_create(MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH,
- MINI_MAP_H - DOUBLE_FRAME_WH);
+ overview_canvas = canvas_create(overview.width, overview.height);
- center_minimap_on_minimap_window();
+ resize_minimap();
+ resize_unit_info();
}
/**************************************************************************
@@ -1069,9 +1069,11 @@
**************************************************************************/
void center_minimap_on_minimap_window(void)
{
- /* FIXME: really center */
- OVERVIEW_START_X = FRAME_WH;
- OVERVIEW_START_Y = FRAME_WH;
+ int width, height;
+ get_overview_area_dimensions(&width, &height);
+
+ OVERVIEW_START_X = FRAME_WH + (width - overview.width)/2;
+ OVERVIEW_START_Y = FRAME_WH + (height - overview.height)/2;
}
/**************************************************************************
Index: client/gui-sdl/mapctrl.c
===================================================================
--- client/gui-sdl/mapctrl.c (Revision 11634)
+++ client/gui-sdl/mapctrl.c (Arbeitskopie)
@@ -498,6 +498,26 @@
return -1;
}
+int resize_minimap(void)
+{
+ int w = OVERVIEW_TILE_WIDTH * map.xsize;
+ int h = OVERVIEW_TILE_HEIGHT * map.ysize;
+ int current_w = pMiniMap_Window->size.w - BLOCKM_W - DOUBLE_FRAME_WH;
+ int current_h = pMiniMap_Window->size.h - DOUBLE_FRAME_WH;
+
+ if ((((current_w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)
+ || (w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)) && (current_w !=
w)) ||
+ (((current_h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)
+ || (h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)) && (current_h != h))) {
+ Remake_MiniMap(w, h);
+ }
+ center_minimap_on_minimap_window();
+ refresh_overview();
+ update_menus();
+
+ return 0;
+}
+
#ifdef SCALE_MINIMAP
/* ============================================================== */
static int move_scale_minmap_dlg_callback(struct GUI *pWindow)
@@ -519,26 +539,6 @@
return -1;
}
-static int resize_minimap(void)
-{
- int w = OVERVIEW_TILE_WIDTH * map.xsize;
- int h = OVERVIEW_TILE_HEIGHT * map.ysize;
- int current_w = pMiniMap_Window->size.w - BLOCKM_W - DOUBLE_FRAME_WH;
- int current_h = pMiniMap_Window->size.h - DOUBLE_FRAME_WH;
-
- if ((((current_w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)
- || (w > DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH)) && (current_w !=
w)) ||
- (((current_h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)
- || (h > DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH)) && (current_h != h))) {
- Remake_MiniMap(w, h);
- }
- center_minimap_on_minimap_window();
- refresh_overview();
- update_menus();
-
- return 0;
-}
-
static int up_width_callback(struct GUI *pWidget)
{
redraw_widget(pWidget);
@@ -806,10 +806,11 @@
return -1;
}
-static int resize_unit_info(void)
+int resize_unit_info(void)
{
int w = INFO_WIDTH * map.xsize;
- int h = INFO_HEIGHT * map.ysize;
+ int h = MAX(INFO_HEIGHT * map.ysize,
+ get_minimap_window_widget()->size.h - DOUBLE_FRAME_WH);
int current_w = pUnits_Info_Window->size.w - BLOCKU_W - DOUBLE_FRAME_WH;
int current_h = pUnits_Info_Window->size.h - DOUBLE_FRAME_WH;
@@ -1225,11 +1226,7 @@
SDL_Surface *pSurf;
struct GUI *pWidget = pMiniMap_Window;
- if(w < DEFAULT_MINI_MAP_W - BLOCKM_W - DOUBLE_FRAME_WH) {
- w = DEFAULT_MINI_MAP_W;
- } else {
- w += BLOCKM_W + DOUBLE_FRAME_WH;
- }
+ w += BLOCKM_W + DOUBLE_FRAME_WH;
if(h < DEFAULT_MINI_MAP_H - DOUBLE_FRAME_WH) {
h = DEFAULT_MINI_MAP_H;
Index: client/gui-sdl/mapctrl.h
===================================================================
--- client/gui-sdl/mapctrl.h (Revision 11634)
+++ client/gui-sdl/mapctrl.h (Arbeitskopie)
@@ -63,6 +63,8 @@
void reset_main_widget_dest_buffer(void);
void set_new_units_window_pos(void);
void set_new_mini_map_window_pos(void);
+int resize_minimap(void);
+int resize_unit_info(void);
struct GUI * get_unit_info_window_widget(void);
struct GUI * get_minimap_window_widget(void);
struct GUI * get_tax_rates_widget(void);
|
|