mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-10 06:52:05 +01:00
Fix 8c58fb1efd: Doubled beep sounds when clicking toolbar buttons.
* ShowDropDownList() now issues a beep, so individual toolbar buttons no longer need to do it. * HandleButtonClick() may be called twice for some buttons, as it is called by automatically for PUSH buttons. This caused some beeps to sound louder than others.
This commit is contained in:
committed by
Peter Nelson
parent
ce166bbbc3
commit
69697a62d3
@@ -117,7 +117,6 @@ public:
|
||||
static void PopupMainToolbarMenu(Window *w, WidgetID widget, DropDownList &&list, int def)
|
||||
{
|
||||
ShowDropDownList(w, std::move(list), def, widget, 0, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +290,6 @@ static CallBackFunction ToolbarOptionsClick(Window *w)
|
||||
list.push_back(MakeDropDownListCheckedItem(IsTransparencySet(TO_SIGNS), STR_SETTINGS_MENU_TRANSPARENT_SIGNS, OME_SHOW_STATIONSIGNS));
|
||||
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_SETTINGS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -684,8 +682,6 @@ static CallBackFunction ToolbarGraphsClick(Window *w)
|
||||
if (_toolbar_mode != TB_NORMAL) AddDropDownLeagueTableOptions(list);
|
||||
|
||||
ShowDropDownList(w, std::move(list), GRMN_OPERATING_PROFIT_GRAPH, WID_TN_GRAPHS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -697,8 +693,6 @@ static CallBackFunction ToolbarLeagueClick(Window *w)
|
||||
|
||||
int selected = list[0]->result;
|
||||
ShowDropDownList(w, std::move(list), selected, WID_TN_LEAGUE, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -876,7 +870,6 @@ static CallBackFunction ToolbarZoomOutClick(Window *w)
|
||||
static CallBackFunction ToolbarBuildRailClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRailTypeDropDownList(), _last_built_railtype, WID_TN_RAILS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -898,7 +891,6 @@ static CallBackFunction MenuClickBuildRail(int index)
|
||||
static CallBackFunction ToolbarBuildRoadClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TN_ROADS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -920,7 +912,6 @@ static CallBackFunction MenuClickBuildRoad(int index)
|
||||
static CallBackFunction ToolbarBuildTramClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TN_TRAMS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -944,7 +935,6 @@ static CallBackFunction ToolbarBuildWaterClick(Window *w)
|
||||
DropDownList list;
|
||||
list.push_back(MakeDropDownListIconItem(SPR_IMG_BUILD_CANAL, PAL_NONE, STR_WATERWAYS_MENU_WATERWAYS_CONSTRUCTION, 0));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_WATER, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -966,7 +956,6 @@ static CallBackFunction ToolbarBuildAirClick(Window *w)
|
||||
DropDownList list;
|
||||
list.push_back(MakeDropDownListIconItem(SPR_IMG_AIRPORT, PAL_NONE, STR_AIRCRAFT_MENU_AIRPORT_CONSTRUCTION, 0));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_AIR, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -990,7 +979,6 @@ static CallBackFunction ToolbarForestClick(Window *w)
|
||||
list.push_back(MakeDropDownListIconItem(SPR_IMG_PLANTTREES, PAL_NONE, STR_LANDSCAPING_MENU_PLANT_TREES, 1));
|
||||
list.push_back(MakeDropDownListIconItem(SPR_IMG_SIGN, PAL_NONE, STR_LANDSCAPING_MENU_PLACE_SIGN, 2));
|
||||
ShowDropDownList(w, std::move(list), 0, WID_TN_LANDSCAPE, 100, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -1260,7 +1248,6 @@ static CallBackFunction ToolbarScenGenIndustry(Window *w)
|
||||
static CallBackFunction ToolbarScenBuildRoadClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_ROAD), _last_built_roadtype, WID_TE_ROADS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
@@ -1280,7 +1267,6 @@ static CallBackFunction ToolbarScenBuildRoad(int index)
|
||||
static CallBackFunction ToolbarScenBuildTramClick(Window *w)
|
||||
{
|
||||
ShowDropDownList(w, GetScenRoadTypeDropDownList(RTTB_TRAM), _last_built_tramtype, WID_TE_TRAMS, 140, _settings_client.gui.toolbar_dropdown_autoselect);
|
||||
SndClickBeep();
|
||||
return CBF_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -594,6 +594,9 @@ EventState Window::OnHotkey(int hotkey)
|
||||
*/
|
||||
void Window::HandleButtonClick(WidgetID widget)
|
||||
{
|
||||
/* Button click for this widget may already have been handled. */
|
||||
if (this->IsWidgetLowered(widget) && this->timeout_timer == TIMEOUT_DURATION) return;
|
||||
|
||||
this->LowerWidget(widget);
|
||||
this->SetTimeout();
|
||||
this->SetWidgetDirty(widget);
|
||||
|
||||
Reference in New Issue
Block a user