Adjustments for PR #556

Setting text/condition, tooltip condition
pull/564/head
Jonathan G Rennison 11 months ago
parent 4fae774cb5
commit 9a5df29648

@ -2122,5 +2122,5 @@ STR_TOWN_DIRECTORY_INFO :{BLACK}{STRING1
STR_GAME_OPTIONS_GUI_SCALE_MAIN_TOOLBAR :{BLACK}Bigger main toolbar
STR_GAME_OPTIONS_GUI_SCALE_MAIN_TOOLBAR_TOOLTIP :{BLACK}Check this box to increase the scale of the main toolbar
STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP :Show tooltips for tiles without a right-click: {STRING2}
STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP_HELPTEXT :Allow tooltips for tiles, such as industries, to show without the need for a right-click, if latter is set to be necessary for all tooltips.
STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP :Show viewport tooltips for tiles without a right-click: {STRING2}
STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP_HELPTEXT :Show viewport tooltips for tile types such as industries without requiring a right-click, when the show tooltips setting is set to right-click.

@ -528,8 +528,7 @@ struct MainWindow : Window
virtual void OnMouseOver(Point pt, int widget) override
{
if (pt.x != -1 && _game_mode != GM_MENU &&
(_settings_client.gui.hover_delay_ms == 0 && (_right_button_down || _settings_client.gui.instant_tile_tooltip) || _mouse_hovering)) {
if (pt.x != -1 && _game_mode != GM_MENU && IsViewportMouseHoverActive()) {
/* Show tooltip with last month production or town name */
const Point p = GetTileBelowCursor();
const TileIndex tile = TileVirtXY(p.x, p.y);

@ -1924,7 +1924,7 @@ static SettingsContainer &GetSettingsTree()
{
general->Add(new SettingEntry("gui.osk_activation"));
general->Add(new SettingEntry("gui.hover_delay_ms"));
general->Add(new SettingEntry("gui.instant_tile_tooltip"));
general->Add(new ConditionallyHiddenSettingEntry("gui.instant_tile_tooltip", []() -> bool { return _settings_client.gui.hover_delay_ms != 0; }));
general->Add(new SettingEntry("gui.errmsg_duration"));
general->Add(new SettingEntry("gui.window_snap_radius"));
general->Add(new SettingEntry("gui.window_soft_limit"));

@ -4543,11 +4543,12 @@ interval = 50
str = STR_CONFIG_SETTING_HOVER_DELAY
strhelp = STR_CONFIG_SETTING_HOVER_DELAY_HELPTEXT
strval = STR_CONFIG_SETTING_HOVER_DELAY_VALUE
post_cb = [](auto) { InvalidateWindowClassesData(WC_GAME_OPTIONS); }
[SDTC_BOOL]
var = gui.instant_tile_tooltip
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC
def = true
def = false
str = STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP
strhelp = STR_CONFIG_SETTING_INSTANT_TILE_TOOLTIP_HELPTEXT

@ -6703,3 +6703,14 @@ int GetSlopeTreeBrightnessAdjust(Slope slope)
return 0;
}
}
bool IsViewportMouseHoverActive()
{
if (_settings_client.gui.hover_delay_ms == 0) {
/* right click mode */
return _right_button_down || _settings_client.gui.instant_tile_tooltip;
} else {
/* normal mode */
return _mouse_hovering;
}
}

@ -170,4 +170,6 @@ void MarkBridgeDirty(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
void MarkBridgeOrTunnelDirty(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
void MarkBridgeOrTunnelDirtyOnReservationChange(TileIndex tile, ViewportMarkDirtyFlags flags = VMDF_NONE);
bool IsViewportMouseHoverActive();
#endif /* VIEWPORT_FUNC_H */

@ -158,7 +158,7 @@ public:
virtual void OnMouseOver(Point pt, int widget) override
{
if (pt.x != -1 && (_settings_client.gui.hover_delay_ms == 0 && (_right_button_down || _settings_client.gui.instant_tile_tooltip) || _mouse_hovering)) {
if (pt.x != -1 && IsViewportMouseHoverActive()) {
/* Show tooltip with last month production or town name */
const Point p = GetTileBelowCursor();
const TileIndex tile = TileVirtXY(p.x, p.y);

Loading…
Cancel
Save