diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 541d951285..e31dbf1ea2 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -434,7 +434,7 @@ struct MainWindow : Window void OnMouseWheel(int wheel) override { - if (_settings_client.gui.scrollwheel_scrolling != 2) { + if (_settings_client.gui.scrollwheel_scrolling != SWS_OFF) { ZoomInOrOutToCursorWindow(wheel < 0, this); } } diff --git a/src/settings_type.h b/src/settings_type.h index 639d1d8060..9b1a7b6000 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -126,6 +126,13 @@ enum ViewportScrollMode { VSM_END, ///< Number of scroll mode settings. }; +/** Settings related to scroll wheel behavior. */ +enum ScrollWheelScrollingSetting { + SWS_ZOOM_MAP = 0, ///< Scroll wheel zooms the map. + SWS_SCROLL_MAP = 1, ///< Scroll wheel scrolls the map. + SWS_OFF = 2 ///< Scroll wheel has no effect. +}; + /** Settings related to the GUI and other stuff that is not saved in the savegame. */ struct GUISettings { bool sg_full_load_any; ///< new full load calculation, any cargo must be full read from pre v93 savegames diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index f818bc7b72..cdd6b071ae 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1790,7 +1790,7 @@ public: void OnMouseWheel(int wheel) override { - if (_settings_client.gui.scrollwheel_scrolling != 2) { + if (_settings_client.gui.scrollwheel_scrolling != SWS_OFF) { const NWidgetBase *wid = this->GetWidget(WID_SM_MAP); int cursor_x = _cursor.pos.x - this->left - wid->pos_x; int cursor_y = _cursor.pos.y - this->top - wid->pos_y; diff --git a/src/table/settings/gui_settings.ini b/src/table/settings/gui_settings.ini index ae01f9feb5..34b7c5eb1a 100644 --- a/src/table/settings/gui_settings.ini +++ b/src/table/settings/gui_settings.ini @@ -387,9 +387,9 @@ cat = SC_BASIC var = gui.scrollwheel_scrolling type = SLE_UINT8 flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_DROPDOWN -def = 0 -min = 0 -max = 2 +def = SWS_ZOOM_MAP +min = SWS_ZOOM_MAP +max = SWS_OFF str = STR_CONFIG_SETTING_SCROLLWHEEL_SCROLLING strhelp = STR_CONFIG_SETTING_SCROLLWHEEL_SCROLLING_HELPTEXT strval = STR_CONFIG_SETTING_SCROLLWHEEL_ZOOM diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index 4f8e550c83..dd3d6fb59f 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -124,7 +124,7 @@ public: void OnMouseWheel(int wheel) override { - if (_settings_client.gui.scrollwheel_scrolling != 2) { + if (_settings_client.gui.scrollwheel_scrolling != SWS_OFF) { ZoomInOrOutToCursorWindow(wheel < 0, this); } } diff --git a/src/window.cpp b/src/window.cpp index 14edb146ef..75d02ee713 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -2352,7 +2352,7 @@ static EventState HandleActiveWidget() */ static EventState HandleViewportScroll() { - bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); + bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == SWS_SCROLL_MAP && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); if (!_scrolling_viewport) return ES_NOT_HANDLED; @@ -2776,7 +2776,7 @@ static void MouseLoop(MouseClick click, int mousewheel) HandleMouseOver(); - bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); + bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == SWS_SCROLL_MAP && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return; int x = _cursor.pos.x;