From 952772df28aa95b05349ecfc021af2662f994bb5 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 8 May 2023 16:43:03 +0300 Subject: [PATCH 16/16] sdl2: Prefix SMALL_SCREEN with GUI_SDL2_ See osdn #47702 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/cma_fe.c | 8 +++--- client/gui-sdl2/connectdlg.c | 2 +- client/gui-sdl2/graphics.h | 2 +- client/gui-sdl2/gui_main.c | 2 +- client/gui-sdl2/gui_main.h | 4 +-- client/gui-sdl2/gui_string.c | 4 +-- client/gui-sdl2/gui_string.h | 2 +- client/gui-sdl2/mapctrl.c | 50 ++++++++++++++++++------------------ client/gui-sdl2/mapctrl.h | 6 ++--- client/gui-sdl2/mapview.c | 10 ++++---- client/gui-sdl2/messagewin.c | 2 +- client/gui-sdl2/optiondlg.c | 2 +- client/gui-sdl2/repodlgs.c | 6 ++--- client/gui-sdl2/widget.h | 2 +- 14 files changed, 51 insertions(+), 51 deletions(-) diff --git a/client/gui-sdl2/cma_fe.c b/client/gui-sdl2/cma_fe.c index 58053a7bbf..207b6e15ba 100644 --- a/client/gui-sdl2/cma_fe.c +++ b/client/gui-sdl2/cma_fe.c @@ -1079,17 +1079,17 @@ void popup_city_cma_dialog(struct city *pcity) /* -------------------------------- */ cma->dlg->begin_widget_list = buf; -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN area.w = MAX(pcity_map->w + adj_size(220) + text_w + adj_size(10) + (pwindow->prev->prev->size.w + adj_size(5 + 70 + 5) + pwindow->prev->prev->size.w + adj_size(5 + 55 + 15)), area.w); area.h = adj_size(390) - (pwindow->size.w - pwindow->area.w); -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ area.w = MAX(pcity_map->w + adj_size(150) + text_w + adj_size(10) + (pwindow->prev->prev->size.w + adj_size(5 + 70 + 5) + pwindow->prev->prev->size.w + adj_size(5 + 55 + 15)), area.w); area.h = adj_size(360) - (pwindow->size.w - pwindow->area.w); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ logo = theme_get_background(active_theme, BACKGROUND_CITYGOVDLG); if (resize_window(pwindow, logo, NULL, @@ -1121,7 +1121,7 @@ void popup_city_cma_dialog(struct city *pcity) (text_w + adj_size(10) + pwindow->prev->prev->size.w + adj_size(5 + 70 + 5) + pwindow->prev->prev->size.w + adj_size(5 + 55))) / 2; -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN dst.x += 22; #endif diff --git a/client/gui-sdl2/connectdlg.c b/client/gui-sdl2/connectdlg.c index a38e6ba94d..631dd4a29c 100644 --- a/client/gui-sdl2/connectdlg.c +++ b/client/gui-sdl2/connectdlg.c @@ -639,7 +639,7 @@ void popup_join_game_dialog(void) dialog_w = MAX(adj_size(40) + buf->size.w * 2, adj_size(210)) + adj_size(80); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN dialog_h = area.h + (pwindow->size.h - pwindow->area.h); #else dialog_h = area.h + (pwindow->size.h - pwindow->area.h); diff --git a/client/gui-sdl2/graphics.h b/client/gui-sdl2/graphics.h index 6423d64207..9cc21ddbff 100644 --- a/client/gui-sdl2/graphics.h +++ b/client/gui-sdl2/graphics.h @@ -191,7 +191,7 @@ #endif /* USE_DUFFS_LOOP */ /* shrink surface on 320x240 screen*/ -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN #define DEFAULT_ZOOM 0.5 #define adj_surf(surf) zoomSurface((surf), DEFAULT_ZOOM, DEFAULT_ZOOM, 0) #else diff --git a/client/gui-sdl2/gui_main.c b/client/gui-sdl2/gui_main.c index 8def3d168d..a49538aa47 100644 --- a/client/gui-sdl2/gui_main.c +++ b/client/gui-sdl2/gui_main.c @@ -1080,7 +1080,7 @@ int ui_main(int argc, char *argv[]) void ui_exit(void) { -#if defined UNDER_CE && defined SMALL_SCREEN +#if defined UNDER_CE && defined GUI_SDL2_SMALL_SCREEN /* change back to window mode to restore the title bar */ set_video_mode(320, 240, SDL_SWSURFACE | SDL_ANYFORMAT); #endif diff --git a/client/gui-sdl2/gui_main.h b/client/gui-sdl2/gui_main.h index ecf8e4e49b..f7be12da7f 100644 --- a/client/gui-sdl2/gui_main.h +++ b/client/gui-sdl2/gui_main.h @@ -33,7 +33,7 @@ #include "gui_main_g.h" /* Enable this to adjust sizes for 320x240 resolution */ -/* #define SMALL_SCREEN */ +/* #define GUI_SDL2_SMALL_SCREEN */ /* SDL2 client Flags */ #define CF_NONE 0 @@ -127,7 +127,7 @@ Uint16 gui_event_loop(void *data, void (*loop_action)(void *data), void update_font_from_theme(int theme_font_size); /* Shrink sizes for 320x240 screen */ -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN #define adj_size(size) ((size) / 2) #else #define adj_size(size) (size) diff --git a/client/gui-sdl2/gui_string.c b/client/gui-sdl2/gui_string.c index 9ae5c7bcc9..57d93e8e8b 100644 --- a/client/gui-sdl2/gui_string.c +++ b/client/gui-sdl2/gui_string.c @@ -63,7 +63,7 @@ static SDL_Surface *create_utf8_multi_surf(utf8_str *pstr); /**********************************************************************//** Adjust font sizes for small screen. **************************************************************************/ -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN int adj_font(int size) { switch (size) { @@ -89,7 +89,7 @@ int adj_font(int size) return size; } } -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /**********************************************************************//** Calculate display size of string. diff --git a/client/gui-sdl2/gui_string.h b/client/gui-sdl2/gui_string.h index a0de02911f..5a56875de4 100644 --- a/client/gui-sdl2/gui_string.h +++ b/client/gui-sdl2/gui_string.h @@ -82,7 +82,7 @@ void unload_font(Uint16 ptsize); void free_font_system(void); /* Adjust font sizes on 320x240 screen */ -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN int adj_font(int size); #else #define adj_font(size) size diff --git a/client/gui-sdl2/mapctrl.c b/client/gui-sdl2/mapctrl.c index 3c8c589852..544de97edf 100644 --- a/client/gui-sdl2/mapctrl.c +++ b/client/gui-sdl2/mapctrl.c @@ -466,11 +466,11 @@ static int toggle_map_window_callback(struct widget *map_button) pwidget = pwidget->prev; widget_redraw(pwidget); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options */ pwidget = pwidget->prev; widget_redraw(pwidget); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* ID_TOGGLE_MAP_WINDOW_BUTTON */ pwidget = pwidget->prev; @@ -1430,14 +1430,14 @@ void set_new_minimap_window_pos(void) area.x + adj_size(2), area.y + pwidget->size.h + 2); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* ID_TOGGLE_MAP_WINDOW_BUTTON */ pwidget = pwidget->prev; widget_set_area(pwidget, area); widget_set_position(pwidget, area.x + adj_size(2), area.y + area.h - pwidget->size.h - 2); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* ID_TOGGLE_MAP_WINDOW_BUTTON */ pwidget = pwidget->prev; @@ -1745,7 +1745,7 @@ void popup_minimap_window(void) add_to_gui_list(ID_CHATLINE_TOGGLE_LOG_WINDOW_BUTTON, pwidget); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ options_button = create_themeicon(current_theme->options_icon, minimap_window->dst, @@ -1758,7 +1758,7 @@ void popup_minimap_window(void) options_button->key = SDLK_ESCAPE; add_to_gui_list(ID_CLIENT_OPTIONS, options_button); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ @@ -1816,11 +1816,11 @@ void show_minimap_window_buttons(void) pwidget = pwidget->prev; clear_wflag(pwidget, WF_HIDDEN); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ pwidget = pwidget->prev; clear_wflag(pwidget, WF_HIDDEN); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ pwidget = pwidget->prev; @@ -1854,11 +1854,11 @@ void hide_minimap_window_buttons(void) pwidget = pwidget->prev; set_wflag(pwidget, WF_HIDDEN); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ pwidget = pwidget->prev; set_wflag(pwidget, WF_HIDDEN); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ pwidget = pwidget->prev; @@ -1891,11 +1891,11 @@ void redraw_minimap_window_buttons(void) pwidget = pwidget->prev; widget_redraw(pwidget); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ pwidget = pwidget->prev; widget_redraw(pwidget); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ pwidget = pwidget->prev; @@ -1929,11 +1929,11 @@ void disable_minimap_window_buttons(void) pwidget = pwidget->prev; set_wstate(pwidget, FC_WS_DISABLED); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ pwidget = pwidget->prev; set_wstate(pwidget, FC_WS_DISABLED); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ } /**********************************************************************//** @@ -1965,7 +1965,7 @@ void show_game_page(void) popup_unitinfo_window(); sdl2_client_flags |= CF_MAP_UNIT_W_CREATED; -#ifndef SMALL_SCREEN +#ifndef GUI_SDL2_SMALL_SCREEN init_options_button(); #endif @@ -1974,15 +1974,15 @@ void show_game_page(void) fc_assert(icon_theme != NULL); pwidget = create_iconlabel(icon_theme, main_data.gui, NULL, WF_FREE_THEME); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN widget_set_position(pwidget, pwidget->dst->surface->w - pwidget->size.w - adj_size(10), 0); -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ widget_set_position(pwidget, pwidget->dst->surface->w - pwidget->size.w - adj_size(10), adj_size(10)); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ add_to_gui_list(ID_COOLING_ICON, pwidget); @@ -1992,15 +1992,15 @@ void show_game_page(void) pwidget = create_iconlabel(icon_theme, main_data.gui, NULL, WF_FREE_THEME); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN widget_set_position(pwidget, pwidget->dst->surface->w - pwidget->size.w * 2 - adj_size(10), 0); -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ widget_set_position(pwidget, pwidget->dst->surface->w - pwidget->size.w * 2 - adj_size(10), adj_size(10)); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ add_to_gui_list(ID_WARMING_ICON, pwidget); @@ -2066,11 +2066,11 @@ static void disable_minimap_widgets(void) buf = buf->prev; set_wstate(buf, FC_WS_DISABLED); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ buf = buf->prev; set_wstate(buf, FC_WS_DISABLED); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ buf = buf->prev; @@ -2140,11 +2140,11 @@ static void enable_minimap_widgets(void) buf = buf->prev; set_wstate(buf, FC_WS_NORMAL); -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN /* options button */ buf = buf->prev; set_wstate(buf, FC_WS_NORMAL); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* show/hide minimap button */ buf = buf->prev; diff --git a/client/gui-sdl2/mapctrl.h b/client/gui-sdl2/mapctrl.h index 1597b19f74..5fb88dfd3e 100644 --- a/client/gui-sdl2/mapctrl.h +++ b/client/gui-sdl2/mapctrl.h @@ -37,7 +37,7 @@ #include "mapctrl_g.h" -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN #define BLOCKM_W 28 #define BLOCKU_W 15 @@ -46,7 +46,7 @@ #define DEFAULT_UNITS_W (78 + BLOCKU_W) #define DEFAULT_UNITS_H 52 -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ #define BLOCKM_W 52 #define BLOCKU_W 28 @@ -55,7 +55,7 @@ #define DEFAULT_UNITS_W (158 + BLOCKU_W) #define DEFAULT_UNITS_H 104 -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ extern int overview_w; extern int overview_h; diff --git a/client/gui-sdl2/mapview.c b/client/gui-sdl2/mapview.c index 9b69285306..c45855710d 100644 --- a/client/gui-sdl2/mapview.c +++ b/client/gui-sdl2/mapview.c @@ -404,7 +404,7 @@ void update_info_label(void) SDL_Color bg_color = {0, 0, 0, 80}; SDL_Surface *tmp = NULL; char buffer[512]; -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN SDL_Rect area = {0, 0, 0, 0}; #else SDL_Rect area = {0, 3, 0, 0}; @@ -415,7 +415,7 @@ void update_info_label(void) return; } -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN ptext = create_utf8_str(NULL, 0, 8); #else ptext = create_utf8_str(NULL, 0, 10); @@ -427,7 +427,7 @@ void update_info_label(void) ptext->bgcol = (SDL_Color) {0, 0, 0, 0}; if (NULL != client.conn.playing) { -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN fc_snprintf(buffer, sizeof(buffer), _("%s Population: %s Year: %s " "Gold %d "), @@ -435,7 +435,7 @@ void update_info_label(void) population_to_text(civ_population(client.conn.playing)), calendar_text(), client.conn.playing->economic.gold); -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ fc_snprintf(buffer, sizeof(buffer), _("%s Population: %s Year: %s " "Gold %d Tax: %d Lux: %d Sci: %d "), @@ -446,7 +446,7 @@ void update_info_label(void) client.conn.playing->economic.tax, client.conn.playing->economic.luxury, client.conn.playing->economic.science); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ /* convert to utf8_str and create text surface */ copy_chars_to_utf8_str(ptext, buffer); tmp = create_text_surf_from_utf8(ptext); diff --git a/client/gui-sdl2/messagewin.c b/client/gui-sdl2/messagewin.c index 6dcaea7316..94f0cecc8d 100644 --- a/client/gui-sdl2/messagewin.c +++ b/client/gui-sdl2/messagewin.c @@ -52,7 +52,7 @@ #include "messagewin.h" -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN #define N_MSG_VIEW 3 /* max before scrolling happens */ #else #define N_MSG_VIEW 6 diff --git a/client/gui-sdl2/optiondlg.c b/client/gui-sdl2/optiondlg.c index f8fa0aed83..c253955782 100644 --- a/client/gui-sdl2/optiondlg.c +++ b/client/gui-sdl2/optiondlg.c @@ -1377,7 +1377,7 @@ void init_options_button(void) set_wflag(options_button, WF_HIDDEN); widget_set_position(options_button, adj_size(5), adj_size(5)); -#ifndef SMALL_SCREEN +#ifndef GUI_SDL2_SMALL_SCREEN add_to_gui_list(ID_CLIENT_OPTIONS, options_button); #endif diff --git a/client/gui-sdl2/repodlgs.c b/client/gui-sdl2/repodlgs.c index c75f3debde..764ea32df0 100644 --- a/client/gui-sdl2/repodlgs.c +++ b/client/gui-sdl2/repodlgs.c @@ -3382,11 +3382,11 @@ void science_report_dialog_popup(bool raise) pstr = create_utf8_from_char(_("Research"), adj_font(12)); pstr->style |= TTF_STYLE_BOLD; -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN pwindow = create_window(NULL, pstr, 200, 132, 0); -#else /* SMALL_SCREEN */ +#else /* GUI_SDL2_SMALL_SCREEN */ pwindow = create_window(NULL, pstr, adj_size(400), adj_size(246), 0); -#endif /* SMALL_SCREEN */ +#endif /* GUI_SDL2_SMALL_SCREEN */ set_wstate(pwindow, FC_WS_NORMAL); pwindow->action = science_dialog_callback; diff --git a/client/gui-sdl2/widget.h b/client/gui-sdl2/widget.h index 4e6a2b5a33..3e8ff94d46 100644 --- a/client/gui-sdl2/widget.h +++ b/client/gui-sdl2/widget.h @@ -29,7 +29,7 @@ #include "gui_main.h" #include "gui_string.h" -#ifdef SMALL_SCREEN +#ifdef GUI_SDL2_SMALL_SCREEN #define WINDOW_TITLE_HEIGHT 10 #else #define WINDOW_TITLE_HEIGHT 20 -- 2.39.2