From ac45449f21695361ccfe3ef5da1f66178c873bd4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 23 May 2023 22:58:32 +0300 Subject: [PATCH 8/8] gtk4x: Reserve options Go by name the "gtk5" namespace for now. See osdn #48065 Signed-off-by: Marko Lindqvist --- client/options.c | 275 ++++++++++++++++++++++++++++++++++++++++++++-- client/options.h | 53 +++++++++ client/tilespec.c | 4 + common/fc_types.h | 2 + 4 files changed, 327 insertions(+), 7 deletions(-) diff --git a/client/options.c b/client/options.c index 3b59963b14..0402ef8923 100644 --- a/client/options.c +++ b/client/options.c @@ -339,6 +339,41 @@ struct client_options gui_options = { .gui_gtk4_font_city_productions = "Serif 10", .gui_gtk4_font_reqtree_text = "Serif 10", +/* gui-gtk-5.0 client specific options. */ + .gui_gtk5_default_theme_name = FC_GTK5_DEFAULT_THEME_NAME, + .gui_gtk5_fullscreen = FALSE, + .gui_gtk5_map_scrollbars = FALSE, + .gui_gtk5_dialogs_on_top = TRUE, + .gui_gtk5_show_task_icons = TRUE, + .gui_gtk5_enable_tabs = TRUE, + .gui_gtk5_show_chat_message_time = FALSE, + .gui_gtk5_new_messages_go_to_top = FALSE, + .gui_gtk5_show_message_window_buttons = TRUE, + .gui_gtk5_metaserver_tab_first = FALSE, + .gui_gtk5_allied_chat_only = FALSE, + .gui_gtk5_message_chat_location = GUI_GTK_MSGCHAT_SEPARATE, + .gui_gtk5_small_display_layout = FALSE, + .gui_gtk5_mouse_over_map_focus = FALSE, + .gui_gtk5_chatline_autocompletion = TRUE, + .gui_gtk5_citydlg_xsize = GUI_GTK5_CITYDLG_DEFAULT_XSIZE, + .gui_gtk5_citydlg_ysize = GUI_GTK5_CITYDLG_DEFAULT_YSIZE, + .gui_gtk5_popup_tech_help = GUI_POPUP_TECH_HELP_RULESET, + .gui_gtk5_governor_range_min = -20, + .gui_gtk5_governor_range_max = 20, + .gui_gtk5_font_city_label = "Monospace 8", + .gui_gtk5_font_notify_label = "Monospace Bold 9", + .gui_gtk5_font_spaceship_label = "Monospace 8", + .gui_gtk5_font_help_label = "Sans Bold 10", + .gui_gtk5_font_help_link = "Sans 9", + .gui_gtk5_font_help_text = "Monospace 8", + .gui_gtk5_font_chatline = "Monospace 8", + .gui_gtk5_font_beta_label = "Sans Italic 10", + .gui_gtk5_font_small = "Sans 9", + .gui_gtk5_font_comment_label = "Sans Italic 9", + .gui_gtk5_font_city_names = "Sans Bold 10", + .gui_gtk5_font_city_productions = "Serif 10", + .gui_gtk5_font_reqtree_text = "Serif 10", + /* gui-sdl client specific options. */ .gui_sdl_fullscreen = FALSE, .gui_sdl_screen = VIDEO_MODE(640, 480), @@ -1818,11 +1853,11 @@ static const struct copt_val_name { /* Order must match enum GUI_GTK_MSGCHAT_* */ static const struct copt_val_name names[] = { - /* TRANS: enum value for 'gui_gtk2/gtk3/gtk4_message_chat_location' */ + /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */ { "SPLIT", N_("Split") }, - /* TRANS: enum value for 'gui_gtk2/gtk3/gtk4_message_chat_location' */ + /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */ { "SEPARATE", N_("Separate") }, - /* TRANS: enum value for 'gui_gtk2/gtk3/gtk4_message_chat_location' */ + /* TRANS: enum value for 'gtk3_22/gtk4/gtk5_message_chat_location' */ { "MERGED", N_("Merged") } }; @@ -1937,9 +1972,9 @@ static struct client_option client_options[] = { N_("The chat log file"), N_("The name of the chat log file."), COC_INTERFACE, GUI_STUB, GUI_DEFAULT_CHAT_LOGFILE, NULL, 0), - /* gui_gtk3_22/4_default_theme_name and gui_sdl2_default_theme_name are + /* gui_gtk3_22/4/5_default_theme_name and gui_sdl2_default_theme_name are * different settings to avoid client crash after loading the - * style for the other gui. Keeps 5 different options! */ + * style for the other gui. Keeps 5 different options! */ GEN_STR_LIST_OPTION(gui_gtk3_22_default_theme_name, N_("Theme"), N_("By changing this option you change the " "active theme."), @@ -1950,6 +1985,11 @@ static struct client_option client_options[] = { "active theme."), COC_GRAPHICS, GUI_GTK4, FC_GTK4_DEFAULT_THEME_NAME, get_themes_list, theme_reread_callback, 0), + GEN_STR_LIST_OPTION(gui_gtk5_default_theme_name, N_("Theme"), + N_("By changing this option you change the " + "active theme."), + COC_GRAPHICS, GUI_GTK5, FC_GTK5_DEFAULT_THEME_NAME, + get_themes_list, theme_reread_callback, 0), GEN_STR_LIST_OPTION(gui_sdl2_default_theme_name, N_("Theme"), N_("By changing this option you change the " "active theme."), @@ -2722,7 +2762,7 @@ static struct client_option client_options[] = { GEN_ENUM_OPTION(gui_gtk3_22_message_chat_location, N_("Messages and Chat reports location"), /* TRANS: The strings used in the UI for 'Split' etc are - * tagged 'gui_gtk2/gtk3/gtk4_message_chat_location' */ + * tagged 'gui_gtk3_22/gtk4/gtk4_message_chat_location' */ N_("Controls where the Messages and Chat reports " "appear relative to the main view containing the map.\n" "'Split' allows all three to be seen simultaneously, " @@ -2943,7 +2983,7 @@ static struct client_option client_options[] = { GEN_ENUM_OPTION(gui_gtk4_message_chat_location, N_("Messages and Chat reports location"), /* TRANS: The strings used in the UI for 'Split' etc are - * tagged 'gui_gtk2/gtk3/gtk4_message_chat_location' */ + * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */ N_("Controls where the Messages and Chat reports " "appear relative to the main view containing the map.\n" "'Split' allows all three to be seen simultaneously, " @@ -3095,6 +3135,227 @@ static struct client_option client_options[] = { COC_FONT, GUI_GTK4, "Serif 10", NULL), + /* gui-gtk-5.0 client specific options. */ + GEN_BOOL_OPTION(gui_gtk5_fullscreen, N_("Fullscreen"), + N_("If this option is set the client will use the " + "whole screen area for drawing."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_map_scrollbars, N_("Show map scrollbars"), + N_("Disable this option to hide the scrollbars on the " + "map view."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_dialogs_on_top, N_("Keep dialogs on top"), + N_("If this option is set then dialog windows will always " + "remain in front of the main Freeciv window. " + "Disabling this has no effect in fullscreen mode."), + COC_INTERFACE, GUI_GTK5, TRUE, NULL), + GEN_BOOL_OPTION(gui_gtk5_show_task_icons, N_("Show worklist task icons"), + N_("Disabling this will turn off the unit and building " + "icons in the worklist dialog and the production " + "tab of the city dialog."), + COC_GRAPHICS, GUI_GTK5, TRUE, NULL), + GEN_BOOL_OPTION(gui_gtk5_enable_tabs, N_("Enable status report tabs"), + N_("If this option is enabled then report dialogs will " + "be shown as separate tabs rather than in popup " + "dialogs."), + COC_INTERFACE, GUI_GTK5, TRUE, NULL), + GEN_BOOL_OPTION(gui_gtk5_show_chat_message_time, + N_("Show time for each chat message"), + N_("If this option is enabled then all chat messages " + "will be prefixed by a time string of the form " + "[hour:minute:second]."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_new_messages_go_to_top, + N_("New message events go to top of list"), + N_("If this option is enabled, new events in the " + "message window will appear at the top of the list, " + "rather than being appended at the bottom."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_show_message_window_buttons, + N_("Show extra message window buttons"), + N_("If this option is enabled, there will be two " + "buttons displayed in the message window for " + "inspecting a city and going to a location. If this " + "option is disabled, these buttons will not appear " + "(you can still double-click with the left mouse " + "button or right-click on a row to inspect or goto " + "respectively). This option will only take effect " + "once the message window is closed and reopened."), + COC_INTERFACE, GUI_GTK5, TRUE, NULL), + GEN_BOOL_OPTION(gui_gtk5_metaserver_tab_first, + N_("Metaserver tab first in network page"), + N_("If this option is enabled, the metaserver tab will " + "be the first notebook tab in the network page. This " + "option requires a restart in order to take effect."), + COC_NETWORK, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_allied_chat_only, + N_("Plain chat messages are sent to allies only"), + N_("If this option is enabled, then plain messages " + "typed into the chat entry while the game is " + "running will only be sent to your allies. " + "Otherwise plain messages will be sent as " + "public chat messages. To send a public chat " + "message with this option enabled, prefix the " + "message with a single colon ':'. This option " + "can also be set using a toggle button beside " + "the chat entry (only visible in multiplayer " + "games)."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_ENUM_OPTION(gui_gtk5_message_chat_location, + N_("Messages and Chat reports location"), + /* TRANS: The strings used in the UI for 'Split' etc are + * tagged 'gui_gtk3_22/gtk4/gtk5_message_chat_location' */ + N_("Controls where the Messages and Chat reports " + "appear relative to the main view containing the map.\n" + "'Split' allows all three to be seen simultaneously, " + "which is best for multiplayer, but requires a large " + "window to be usable.\n" + "'Separate' puts Messages and Chat in a notebook " + "separate from the main view, so that one of them " + "can always be seen alongside the main view.\n" + "'Merged' makes the Messages and Chat reports into " + "tabs alongside the map and other reports; this " + "allows a larger map view on small screens.\n" + "This option requires a restart in order to take " + "effect."), COC_INTERFACE, GUI_GTK5, + GUI_GTK_MSGCHAT_SEPARATE, + gui_gtk_message_chat_location_name, NULL), + GEN_BOOL_OPTION(gui_gtk5_small_display_layout, + N_("Arrange widgets for small displays"), + N_("If this option is enabled, widgets in the main " + "window will be arranged so that they take up the " + "least amount of total screen space. Specifically, " + "the left panel containing the overview, player " + "status, and the unit information box will be " + "extended over the entire left side of the window. " + "This option requires a restart in order to take " + "effect."), COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_mouse_over_map_focus, + N_("Mouse over the map widget selects it automatically"), + N_("If this option is enabled, then the map will be " + "focused when the mouse hovers over it."), + COC_INTERFACE, GUI_GTK5, FALSE, NULL), + GEN_BOOL_OPTION(gui_gtk5_chatline_autocompletion, + N_("Player or user name autocompletion"), + N_("If this option is turned on, the tabulation key " + "will be used in the chatline to complete the word you " + "are typing with the name of a player or a user."), + COC_INTERFACE, GUI_GTK5, TRUE, NULL), + GEN_INT_OPTION(gui_gtk5_citydlg_xsize, + N_("Width of the city dialog"), + N_("This value is only used if the width of the city " + "dialog is saved."), + COC_INTERFACE, GUI_GTK5, GUI_GTK5_CITYDLG_DEFAULT_XSIZE, + GUI_GTK5_CITYDLG_MIN_XSIZE, GUI_GTK5_CITYDLG_MAX_XSIZE, + NULL), + GEN_INT_OPTION(gui_gtk5_citydlg_ysize, + N_("Height of the city dialog"), + N_("This value is only used if the height of the city " + "dialog is saved."), + COC_INTERFACE, GUI_GTK5, GUI_GTK5_CITYDLG_DEFAULT_YSIZE, + GUI_GTK5_CITYDLG_MIN_YSIZE, GUI_GTK5_CITYDLG_MAX_YSIZE, + NULL), + GEN_ENUM_OPTION(gui_gtk5_popup_tech_help, + N_("Popup tech help when gained"), + N_("Controls if tech help should be opened when " + "new tech has been gained.\n" + "'Ruleset' means that behavior suggested by " + "current ruleset is used."), COC_INTERFACE, GUI_GTK5, + GUI_POPUP_TECH_HELP_RULESET, + gui_popup_tech_help_name, NULL), + GEN_INT_OPTION(gui_gtk5_governor_range_min, + N_("Minimum surplus for a governor"), + N_("The lower limit of the range for requesting surpluses " + "from the governor."), + COC_INTERFACE, GUI_GTK5, GUI_GTK5_GOV_RANGE_MIN_DEFAULT, + GUI_GTK5_GOV_RANGE_MIN_MIN, GUI_GTK5_GOV_RANGE_MIN_MAX, + NULL), + GEN_INT_OPTION(gui_gtk5_governor_range_max, + N_("Maximum surplus for a governor"), + N_("The higher limit of the range for requesting surpluses " + "from the governor."), + COC_INTERFACE, GUI_GTK5, GUI_GTK5_GOV_RANGE_MAX_DEFAULT, + GUI_GTK5_GOV_RANGE_MAX_MIN, GUI_GTK5_GOV_RANGE_MAX_MAX, + NULL), + GEN_FONT_OPTION(gui_gtk5_font_city_label, "city_label", + N_("City Label"), + N_("This font is used to display the city labels on city " + "dialogs."), + COC_FONT, GUI_GTK5, + "Monospace 8", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_notify_label, "notify_label", + N_("Notify Label"), + N_("This font is used to display server reports such " + "as the demographic report or historian publications."), + COC_FONT, GUI_GTK5, + "Monospace Bold 9", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_spaceship_label, "spaceship_label", + N_("Spaceship Label"), + N_("This font is used to display the spaceship widgets."), + COC_FONT, GUI_GTK5, + "Monospace 8", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_help_label, "help_label", + N_("Help Label"), + N_("This font is used to display the help headers in the " + "help window."), + COC_FONT, GUI_GTK5, + "Sans Bold 10", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_help_link, "help_link", + N_("Help Link"), + N_("This font is used to display the help links in the " + "help window."), + COC_FONT, GUI_GTK5, + "Sans 9", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_help_text, "help_text", + N_("Help Text"), + N_("This font is used to display the help body text in " + "the help window."), + COC_FONT, GUI_GTK5, + "Monospace 8", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_chatline, "chatline", + N_("Chatline Area"), + N_("This font is used to display the text in the " + "chatline area."), + COC_FONT, GUI_GTK5, + "Monospace 8", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_beta_label, "beta_label", + N_("Beta Label"), + N_("This font is used to display the beta label."), + COC_FONT, GUI_GTK5, + "Sans Italic 10", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_small, "small_font", + N_("Small Font"), + N_("This font is used for any small font request. For " + "example, it is used for display the building lists " + "in the city dialog, the Economy report or the Units " + "report."), + COC_FONT, GUI_GTK5, + "Sans 9", NULL), + GEN_FONT_OPTION(gui_gtk5_font_comment_label, "comment_label", + N_("Comment Label"), + N_("This font is used to display comment labels, such as " + "in the governor page of the city dialogs."), + COC_FONT, GUI_GTK5, + "Sans Italic 9", font_changed_callback), + GEN_FONT_OPTION(gui_gtk5_font_city_names, "city_names", + N_("City Names"), + N_("This font is used to the display the city names " + "on the map."), + COC_FONT, GUI_GTK5, + "Sans Bold 10", NULL), + GEN_FONT_OPTION(gui_gtk5_font_city_productions, "city_productions", + N_("City Productions"), + N_("This font is used to display the city production " + "on the map."), + COC_FONT, GUI_GTK5, + "Serif 10", NULL), + GEN_FONT_OPTION(gui_gtk5_font_reqtree_text, "reqtree_text", + N_("Requirement Tree"), + N_("This font is used to the display the requirement tree " + "in the Research report."), + COC_FONT, GUI_GTK5, + "Serif 10", NULL), + /* gui-sdl client specific options. * These are still kept just so users can migrate them to sdl2-client */ GEN_BOOL_OPTION(gui_sdl_fullscreen, NULL, NULL, diff --git a/client/options.h b/client/options.h index f667a71cae..3615962629 100644 --- a/client/options.h +++ b/client/options.h @@ -360,6 +360,42 @@ struct client_options char gui_gtk4_font_city_productions[512]; char gui_gtk4_font_reqtree_text[512]; +/* gui-gtk-5.0 client specific options. */ +#define FC_GTK5_DEFAULT_THEME_NAME "Freeciv" + char gui_gtk5_default_theme_name[512]; + bool gui_gtk5_fullscreen; + bool gui_gtk5_map_scrollbars; + bool gui_gtk5_dialogs_on_top; + bool gui_gtk5_show_task_icons; + bool gui_gtk5_enable_tabs; + bool gui_gtk5_show_chat_message_time; + bool gui_gtk5_new_messages_go_to_top; + bool gui_gtk5_show_message_window_buttons; + bool gui_gtk5_metaserver_tab_first; + bool gui_gtk5_allied_chat_only; + int gui_gtk5_message_chat_location; /* enum GUI_GTK_MSGCHAT_* */ + bool gui_gtk5_small_display_layout; + bool gui_gtk5_mouse_over_map_focus; + bool gui_gtk5_chatline_autocompletion; + int gui_gtk5_citydlg_xsize; + int gui_gtk5_citydlg_ysize; + int gui_gtk5_popup_tech_help; + int gui_gtk5_governor_range_min; + int gui_gtk5_governor_range_max; + char gui_gtk5_font_city_label[512]; + char gui_gtk5_font_notify_label[512]; + char gui_gtk5_font_spaceship_label[512]; + char gui_gtk5_font_help_label[512]; + char gui_gtk5_font_help_link[512]; + char gui_gtk5_font_help_text[512]; + char gui_gtk5_font_chatline[512]; + char gui_gtk5_font_beta_label[512]; + char gui_gtk5_font_small[512]; + char gui_gtk5_font_comment_label[512]; + char gui_gtk5_font_city_names[512]; + char gui_gtk5_font_city_productions[512]; + char gui_gtk5_font_reqtree_text[512]; + /* gui-sdl client specific options. * These are still kept just so users can migrate them to sdl2-client */ bool gui_sdl_fullscreen; @@ -625,6 +661,23 @@ extern int messages_where[]; /* OR-ed MW_ values [E_COUNT] */ #define GUI_GTK4_GOV_RANGE_MAX_MIN 0 #define GUI_GTK4_GOV_RANGE_MAX_MAX 100 +/* gui-gtk-5.0: [xy]size of the city dialog */ +#define GUI_GTK5_CITYDLG_DEFAULT_XSIZE 770 +#define GUI_GTK5_CITYDLG_MIN_XSIZE 256 +#define GUI_GTK5_CITYDLG_MAX_XSIZE 4096 + +#define GUI_GTK5_CITYDLG_DEFAULT_YSIZE 512 +#define GUI_GTK5_CITYDLG_MIN_YSIZE 128 +#define GUI_GTK5_CITYDLG_MAX_YSIZE 4096 + +#define GUI_GTK5_GOV_RANGE_MIN_DEFAULT -20 +#define GUI_GTK5_GOV_RANGE_MIN_MIN -100 +#define GUI_GTK5_GOV_RANGE_MIN_MAX 0 + +#define GUI_GTK5_GOV_RANGE_MAX_DEFAULT 20 +#define GUI_GTK5_GOV_RANGE_MAX_MIN 0 +#define GUI_GTK5_GOV_RANGE_MAX_MAX 100 + #define GUI_DEFAULT_MAPIMG_FILENAME "freeciv" bool video_mode_to_string(char *buf, size_t buf_len, struct video_mode *mode); diff --git a/client/tilespec.c b/client/tilespec.c index ed81cab2fa..05ddb22831 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -7068,6 +7068,10 @@ void tileset_use_preferred_theme(const struct tileset *t) default_theme_name = gui_options.gui_gtk4_default_theme_name; default_theme_name_sz = sizeof(gui_options.gui_gtk4_default_theme_name); break; + case GUI_GTK5: + default_theme_name = gui_options.gui_gtk5_default_theme_name; + default_theme_name_sz = sizeof(gui_options.gui_gtk5_default_theme_name); + break; case GUI_SDL2: default_theme_name = gui_options.gui_sdl2_default_theme_name; default_theme_name_sz = sizeof(gui_options.gui_sdl2_default_theme_name); diff --git a/common/fc_types.h b/common/fc_types.h index df362b457c..cd00b1bcd7 100644 --- a/common/fc_types.h +++ b/common/fc_types.h @@ -902,6 +902,8 @@ BV_DEFINE(bv_startpos_nations, MAX_NUM_STARTPOS_NATIONS); #define SPECENUM_VALUE7NAME "web" #define SPECENUM_VALUE8 GUI_GTK4 #define SPECENUM_VALUE8NAME "gtk4" +#define SPECENUM_VALUE9 GUI_GTK5 +#define SPECENUM_VALUE9NAME "gtk4x" #include "specenum_gen.h" /* Used in the network protocol. */ -- 2.39.2