From 2c408342d9a39206de29ab9f86ea92df6b3fe272 Mon Sep 17 00:00:00 2001 From: Umdlye Date: Mon, 1 Feb 2021 17:27:40 +0100 Subject: [PATCH] Create toggle for zoom toolbar button --- data/language/en-GB.txt | 2 ++ src/openrct2-ui/windows/Options.cpp | 14 ++++++++++++-- src/openrct2-ui/windows/TopToolbar.cpp | 6 ++++++ src/openrct2/config/Config.cpp | 2 ++ src/openrct2/config/Config.h | 1 + src/openrct2/localisation/StringIds.h | 3 +++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index d21a345a05..da0857b634 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3663,6 +3663,8 @@ STR_6406 :GOG RollerCoaster Tycoon 2 Installer STR_6407 :This may take a few minutes. STR_6408 :Please install “innoextract” to extract GOG Installer, then restart OpenRCT2. STR_6409 :The selected file is not the offline GOG Installer for RollerCoaster Tycoon 2. You may have downloaded the GOG Galaxy downloader stub or selected the wrong file. +STR_6410 :Zoom in/out +STR_6411 :Show buttons for zooming in and out in the toolbar ############# # Scenarios # diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 9314de143b..b512f5e54d 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -154,6 +154,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_TOOLBAR_SHOW_NEWS, WIDX_TOOLBAR_SHOW_MUTE, WIDX_TOOLBAR_SHOW_CHAT, + WIDX_TOOLBAR_SHOW_ZOOM, // Misc WIDX_TITLE_SEQUENCE_GROUP = WIDX_PAGE_START, @@ -302,13 +303,14 @@ static rct_widget window_options_controls_and_interface_widgets[] = { MakeWidget({155, THEMES_GROUP_START + 30}, {145, 13}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_THEMES_BUTTON, STR_EDIT_THEMES_BUTTON_TIP), // Themes button #undef THEMES_GROUP_START #define TOOLBAR_GROUP_START 200 - MakeWidget({ 5, TOOLBAR_GROUP_START + 0}, {300, 76}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group + MakeWidget({ 5, TOOLBAR_GROUP_START + 0}, {300, 92}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_TOOLBAR_BUTTONS_GROUP ), // Toolbar buttons group MakeWidget({ 24, TOOLBAR_GROUP_START + 31}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_FINANCES_BUTTON_ON_TOOLBAR, STR_FINANCES_BUTTON_ON_TOOLBAR_TIP ), // Finances MakeWidget({ 24, TOOLBAR_GROUP_START + 46}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_RESEARCH_BUTTON_ON_TOOLBAR, STR_RESEARCH_BUTTON_ON_TOOLBAR_TIP ), // Research MakeWidget({155, TOOLBAR_GROUP_START + 31}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHEATS_BUTTON_ON_TOOLBAR, STR_CHEATS_BUTTON_ON_TOOLBAR_TIP ), // Cheats MakeWidget({155, TOOLBAR_GROUP_START + 46}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR, STR_SHOW_RECENT_MESSAGES_ON_TOOLBAR_TIP), // Recent messages MakeWidget({ 24, TOOLBAR_GROUP_START + 61}, {162, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_MUTE_BUTTON_ON_TOOLBAR, STR_MUTE_BUTTON_ON_TOOLBAR_TIP ), // Mute MakeWidget({155, TOOLBAR_GROUP_START + 61}, {145, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_CHAT_BUTTON_ON_TOOLBAR, STR_CHAT_BUTTON_ON_TOOLBAR_TIP ), // Chat + MakeWidget({ 24, TOOLBAR_GROUP_START + 76}, {122, 12}, WindowWidgetType::Checkbox, WindowColour::Tertiary , STR_ZOOM_BUTTON_ON_TOOLBAR, STR_ZOOM_BUTTON_ON_TOOLBAR_TIP ), // Zoom { WIDGETS_END }, #undef TOOLBAR_GROUP_START }; @@ -511,7 +513,8 @@ static uint64_t window_options_page_enabled_widgets[] = { (1 << WIDX_THEMES_DROPDOWN) | (1 << WIDX_THEMES_BUTTON) | (1 << WIDX_TOOLBAR_SHOW_MUTE) | - (1 << WIDX_TOOLBAR_SHOW_CHAT), + (1 << WIDX_TOOLBAR_SHOW_CHAT) | + (1 << WIDX_TOOLBAR_SHOW_ZOOM), MAIN_OPTIONS_ENABLED_WIDGETS | (1 << WIDX_REAL_NAME_CHECKBOX) | @@ -1652,6 +1655,12 @@ static void window_options_controls_mouseup(rct_window* w, rct_widgetindex widge w->Invalidate(); window_invalidate_by_class(WC_TOP_TOOLBAR); break; + case WIDX_TOOLBAR_SHOW_ZOOM: + gConfigInterface.toolbar_show_zoom ^= 1; + config_save_default(); + w->Invalidate(); + window_invalidate_by_class(WC_TOP_TOOLBAR); + break; case WIDX_INVERT_DRAG: gConfigGeneral.invert_viewport_drag ^= 1; config_save_default(); @@ -1720,6 +1729,7 @@ static void window_options_controls_invalidate(rct_window* w) WidgetSetCheckboxValue(w, WIDX_TOOLBAR_SHOW_NEWS, gConfigInterface.toolbar_show_news); WidgetSetCheckboxValue(w, WIDX_TOOLBAR_SHOW_MUTE, gConfigInterface.toolbar_show_mute); WidgetSetCheckboxValue(w, WIDX_TOOLBAR_SHOW_CHAT, gConfigInterface.toolbar_show_chat); + WidgetSetCheckboxValue(w, WIDX_TOOLBAR_SHOW_ZOOM, gConfigInterface.toolbar_show_zoom); size_t activeAvailableThemeIndex = ThemeManagerGetAvailableThemeIndex(); const utf8* activeThemeName = ThemeManagerGetAvailableThemeName(activeAvailableThemeIndex); diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index 90bb43ef05..c8632fccf8 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -723,6 +723,12 @@ static void window_top_toolbar_invalidate(rct_window* w) if (!gConfigInterface.toolbar_show_news) window_top_toolbar_widgets[WIDX_NEWS].type = WindowWidgetType::Empty; + if (!gConfigInterface.toolbar_show_zoom) + { + window_top_toolbar_widgets[WIDX_ZOOM_IN].type = WindowWidgetType::Empty; + window_top_toolbar_widgets[WIDX_ZOOM_OUT].type = WindowWidgetType::Empty; + } + switch (network_get_mode()) { case NETWORK_MODE_NONE: diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 81fa4f7194..fda925b638 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -318,6 +318,7 @@ namespace Config model->toolbar_show_news = reader->GetBoolean("toolbar_show_news", false); model->toolbar_show_mute = reader->GetBoolean("toolbar_show_mute", false); model->toolbar_show_chat = reader->GetBoolean("toolbar_show_chat", false); + model->toolbar_show_zoom = reader->GetBoolean("toolbar_show_zoom", true); model->console_small_font = reader->GetBoolean("console_small_font", false); model->current_theme_preset = reader->GetCString("current_theme", "*RCT2"); model->current_title_sequence_preset = reader->GetCString("current_title_sequence", "*OPENRCT2"); @@ -337,6 +338,7 @@ namespace Config writer->WriteBoolean("toolbar_show_news", model->toolbar_show_news); writer->WriteBoolean("toolbar_show_mute", model->toolbar_show_mute); writer->WriteBoolean("toolbar_show_chat", model->toolbar_show_chat); + writer->WriteBoolean("toolbar_show_zoom", model->toolbar_show_zoom); writer->WriteBoolean("console_small_font", model->console_small_font); writer->WriteString("current_theme", model->current_theme_preset); writer->WriteString("current_title_sequence", model->current_title_sequence_preset); diff --git a/src/openrct2/config/Config.h b/src/openrct2/config/Config.h index 3766743c30..d2b3667118 100644 --- a/src/openrct2/config/Config.h +++ b/src/openrct2/config/Config.h @@ -117,6 +117,7 @@ struct InterfaceConfiguration bool toolbar_show_news; bool toolbar_show_mute; bool toolbar_show_chat; + bool toolbar_show_zoom; bool console_small_font; bool random_title_sequence; utf8* current_theme_preset; diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index a445f8fb93..64a1003e09 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3918,6 +3918,9 @@ enum STR_INSTALL_INNOEXTRACT = 6408, STR_NOT_THE_GOG_INSTALLER = 6409, + STR_ZOOM_BUTTON_ON_TOOLBAR = 6410, + STR_ZOOM_BUTTON_ON_TOOLBAR_TIP = 6411, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings };