summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorplanetmaker <planetmaker@openttd.org>2014-09-13 13:30:31 +0000
committerplanetmaker <planetmaker@openttd.org>2014-09-13 13:30:31 +0000
commit61e129cc22d1eab769d368d9e68a257a19db743d (patch)
tree55f8e3fe36ff59a5506e377aa27e06d87f4958c7 /src
parentdb06971ded17cba0b29801925103cd0f4ffe772e (diff)
downloadopenttd-61e129cc22d1eab769d368d9e68a257a19db743d.tar.xz
(svn r26815) -Change: Allow to set the granularity of the tooltip hover time in milliseconds instead of seconds. New default value is 250ms
Diffstat (limited to 'src')
-rw-r--r--src/lang/english.txt4
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/settings_type.h2
-rw-r--r--src/table/settings.ini11
-rw-r--r--src/window.cpp6
5 files changed, 13 insertions, 12 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 6998276fa..8a8b013b8 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1271,8 +1271,8 @@ STR_CONFIG_SETTING_ERRMSG_DURATION :Duration of err
STR_CONFIG_SETTING_ERRMSG_DURATION_HELPTEXT :Duration for displaying error messages in a red window. Note that some (critical) error messages are not closed automatically after this time, but must be closed manually
STR_CONFIG_SETTING_ERRMSG_DURATION_VALUE :{COMMA} second{P 0 "" s}
STR_CONFIG_SETTING_HOVER_DELAY :Show tooltips: {STRING2}
-STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT :Delay before tooltips are displayed when hovering the mouse over some interface element. Alternatively tooltips can be bound to the right mouse button
-STR_CONFIG_SETTING_HOVER_DELAY_VALUE :Hover for {COMMA} second{P 0 "" s}
+STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT :Delay before tooltips are displayed when hovering the mouse over some interface element. Alternatively tooltips are bound to the right mouse button when this value is set to 0.
+STR_CONFIG_SETTING_HOVER_DELAY_VALUE :Hover for {COMMA} millisecond{P 0 "" s}
STR_CONFIG_SETTING_HOVER_DELAY_DISABLED :Right click
STR_CONFIG_SETTING_POPULATION_IN_LABEL :Show town population in the town name label: {STRING2}
STR_CONFIG_SETTING_POPULATION_IN_LABEL_HELPTEXT :Display the population of towns in their label on the map
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 958db55ac..4fe95ada4 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1467,7 +1467,7 @@ static SettingsContainer &GetSettingsTree()
SettingsPage *general = interface->Add(new SettingsPage(STR_CONFIG_SETTING_INTERFACE_GENERAL));
{
general->Add(new SettingEntry("gui.osk_activation"));
- general->Add(new SettingEntry("gui.hover_delay"));
+ general->Add(new SettingEntry("gui.hover_delay_ms"));
general->Add(new SettingEntry("gui.errmsg_duration"));
general->Add(new SettingEntry("gui.window_snap_radius"));
general->Add(new SettingEntry("gui.window_soft_limit"));
diff --git a/src/settings_type.h b/src/settings_type.h
index 7731e40c9..c51024c00 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -83,7 +83,7 @@ struct GUISettings {
uint8 stop_location; ///< what is the default stop location of trains?
uint8 auto_scrolling; ///< scroll when moving mouse to the edge (see #ViewportAutoscrolling)
byte errmsg_duration; ///< duration of error message
- byte hover_delay; ///< time required to activate a hover event, in seconds
+ uint16 hover_delay_ms; ///< time required to activate a hover event, in milliseconds
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
diff --git a/src/table/settings.ini b/src/table/settings.ini
index 437c07b17..3e5a222de 100644
--- a/src/table/settings.ini
+++ b/src/table/settings.ini
@@ -2570,13 +2570,14 @@ strhelp = STR_CONFIG_SETTING_ERRMSG_DURATION_HELPTEXT
strval = STR_CONFIG_SETTING_ERRMSG_DURATION_VALUE
[SDTC_VAR]
-var = gui.hover_delay
-type = SLE_UINT8
+var = gui.hover_delay_ms
+type = SLE_UINT16
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_0ISDISABLED
-def = 2
-min = 1
-max = 5
+def = 250
+min = 50
+max = 6000
+interval = 50
str = STR_CONFIG_SETTING_HOVER_DELAY
strhelp = STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT
strval = STR_CONFIG_SETTING_HOVER_DELAY_VALUE
diff --git a/src/window.cpp b/src/window.cpp
index 5b3511573..3b6b08df1 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -752,7 +752,7 @@ static void DispatchRightClickEvent(Window *w, int x, int y)
if (w->OnRightClick(pt, wid->index)) return;
}
- if (_settings_client.gui.hover_delay == 0 && wid->tool_tip != 0) GuiShowTooltips(w, wid->tool_tip, 0, NULL, TCC_RIGHT_CLICK);
+ if (_settings_client.gui.hover_delay_ms == 0 && wid->tool_tip != 0) GuiShowTooltips(w, wid->tool_tip, 0, NULL, TCC_RIGHT_CLICK);
}
/**
@@ -2879,7 +2879,7 @@ void HandleMouseEvents()
static uint32 hover_time = 0;
static Point hover_pos = {0, 0};
- if (_settings_client.gui.hover_delay > 0) {
+ if (_settings_client.gui.hover_delay_ms > 0) {
if (!_cursor.in_window || 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) {
@@ -2887,7 +2887,7 @@ void HandleMouseEvents()
hover_time = _realtime_tick;
_mouse_hovering = false;
} else {
- if (hover_time != 0 && _realtime_tick > hover_time + _settings_client.gui.hover_delay * 1000) {
+ if (hover_time != 0 && _realtime_tick > hover_time + _settings_client.gui.hover_delay_ms) {
click = MC_HOVER;
_input_events_this_tick++;
_mouse_hovering = true;