Mercurial > hg > openttd
changeset 15495:9cffefe9d5db draft
(svn r20144) -Feature: Allow to configure the delay of hover events, or to disable them completely.
author | terkhen <terkhen@openttd.org> |
---|---|
date | Wed, 14 Jul 2010 15:08:31 +0000 |
parents | 7c46b98e54b6 |
children | 9df3018e209b |
files | src/lang/english.txt src/settings_gui.cpp src/settings_type.h src/table/settings.h src/window.cpp |
diffstat | 5 files changed, 18 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1145,6 +1145,8 @@ STR_CONFIG_SETTING_AUTORENEW_MONTHS :{LTBLUE}Autorenew when vehicle is {ORANGE}{STRING1}{LTBLUE} months before/after max age STR_CONFIG_SETTING_AUTORENEW_MONEY :{LTBLUE}Autorenew minimum needed money for renew: {ORANGE}{STRING1} STR_CONFIG_SETTING_ERRMSG_DURATION :{LTBLUE}Duration of error message: {ORANGE}{STRING1} +STR_CONFIG_SETTING_HOVER_DELAY :{LTBLUE}Delay of hover events: {ORANGE}{STRING1} +STR_CONFIG_SETTING_HOVER_DELAY_DISABLED :{LTBLUE}Delay of hover events: {ORANGE}disabled STR_CONFIG_SETTING_POPULATION_IN_LABEL :{LTBLUE}Show town population in the town name label: {ORANGE}{STRING1} STR_CONFIG_SETTING_LAND_GENERATOR :{LTBLUE}Land generator: {ORANGE}{STRING1}
--- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1291,6 +1291,7 @@ SettingEntry(&_settings_ui_interaction_page, STR_CONFIG_SETTING_INTERACTION), SettingEntry("gui.show_finances"), SettingEntry("gui.errmsg_duration"), + SettingEntry("gui.hover_delay"), SettingEntry("gui.toolbar_pos"), SettingEntry("gui.pause_on_newgame"), SettingEntry("gui.advanced_vehicle_list"),
--- a/src/settings_type.h +++ b/src/settings_type.h @@ -53,6 +53,7 @@ uint8 stop_location; ///< what is the default stop location of trains? bool autoscroll; ///< scroll when moving mouse to the edge byte errmsg_duration; ///< duration of error message + byte hover_delay; ///< time required to activate a hover event, in seconds bool link_terraform_toolbar; ///< display terraform toolbar when displaying rail, road, water and airport toolbars uint8 smallmap_land_colour; ///< colour used for land and heightmap at the smallmap bool reverse_scroll; ///< right-Click-Scrolling scrolls in the opposite direction
--- a/src/table/settings.h +++ b/src/table/settings.h @@ -558,6 +558,7 @@ SDTC_BOOL(gui.left_mouse_btn_scrolling, S, 0, false, STR_CONFIG_SETTING_LEFT_MOUSE_BTN_SCROLLING, NULL), SDTC_BOOL(gui.measure_tooltip, S, 0, true, STR_CONFIG_SETTING_MEASURE_TOOLTIP, NULL), SDTC_VAR(gui.errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_SETTING_ERRMSG_DURATION, NULL), + SDTC_VAR(gui.hover_delay, SLE_UINT8, S, D0, 2, 1, 5, 0, STR_CONFIG_SETTING_HOVER_DELAY, NULL), SDTC_VAR(gui.toolbar_pos, SLE_UINT8, S, MS, 1, 0, 2, 0, STR_CONFIG_SETTING_TOOLBAR_POS, v_PositionMainToolbar), SDTC_VAR(gui.window_snap_radius, SLE_UINT8, S, D0, 10, 1, 32, 0, STR_CONFIG_SETTING_SNAP_RADIUS, NULL), SDTC_VAR(gui.window_soft_limit, SLE_UINT8, S, D0, 20, 5, 255, 1, STR_CONFIG_SETTING_SOFT_LIMIT, NULL),
--- a/src/window.cpp +++ b/src/window.cpp @@ -2043,7 +2043,6 @@ MAX_OFFSET_DOUBLE_CLICK = 5, ///< How much the mouse is allowed to move to call it a double click TIME_BETWEEN_DOUBLE_CLICK = 500, ///< Time between 2 left clicks before it becoming a double click, in ms MAX_OFFSET_HOVER = 5, ///< Maximum mouse movement before stopping a hover event. - TIME_HOVER = 1000, ///< Time required to activate a hover event, in ms. }; extern EventState VpHandlePlaceSizingDrag(); @@ -2242,17 +2241,19 @@ static int hover_time = 0; static Point hover_pos = {0, 0}; - if (click != MC_NONE || mousewheel != 0 || _left_button_down || _right_button_down || - hover_pos.x == 0 || abs(_cursor.pos.x - hover_pos.x) >= MAX_OFFSET_HOVER || - hover_pos.y == 0 || abs(_cursor.pos.y - hover_pos.y) >= MAX_OFFSET_HOVER) { - hover_pos = _cursor.pos; - hover_time = _realtime_tick; - _mouse_hovering = false; - } else { - if (hover_time != 0 && _realtime_tick - hover_time > TIME_HOVER) { - click = MC_HOVER; - _input_events_this_tick++; - _mouse_hovering = true; + if (_settings_client.gui.hover_delay > 0) { + if (click != MC_NONE || mousewheel != 0 || _left_button_down || _right_button_down || + hover_pos.x == 0 || abs(_cursor.pos.x - hover_pos.x) >= MAX_OFFSET_HOVER || + hover_pos.y == 0 || abs(_cursor.pos.y - hover_pos.y) >= MAX_OFFSET_HOVER) { + hover_pos = _cursor.pos; + hover_time = _realtime_tick; + _mouse_hovering = false; + } else { + if (hover_time != 0 && _realtime_tick - hover_time > _settings_client.gui.hover_delay * 1000) { + click = MC_HOVER; + _input_events_this_tick++; + _mouse_hovering = true; + } } }