Index: industry_gui.cpp =================================================================== --- industry_gui.cpp (revision 27096) +++ industry_gui.cpp (working copy) @@ -41,6 +41,7 @@ #include "widgets/industry_widget.h" #include "table/strings.h" +#include "hotkeys.h" #include "safeguards.h" @@ -188,14 +189,6 @@ EndContainer(), }; -/** Window definition of the dynamic place industries gui */ -static WindowDesc _build_industry_desc( - WDP_AUTO, "build_industry", 170, 212, - WC_BUILD_INDUSTRY, WC_NONE, - WDF_CONSTRUCTION, - _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets) -); - /** Build (fund or prospect) a new industry, */ class BuildIndustryWindow : public Window { int selected_index; ///< index of the element in the matrix @@ -267,7 +260,7 @@ } public: - BuildIndustryWindow() : Window(&_build_industry_desc) + BuildIndustryWindow(WindowDesc *desc) : Window(desc) { this->timer_enabled = _loaded_newgrf_features.has_newindustries; @@ -625,13 +618,38 @@ if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.industry_density != ID_FUND_ONLY; this->SetButtons(); } + + virtual EventState OnHotkey(int hotkey) + { + return Window::OnHotkey(hotkey); + } + + static HotkeyList hotkeys; }; +static Hotkey build_industry_hotkeys[] = { + Hotkey((uint16)0, "display_chain", WID_DPI_DISPLAY_WIDGET), + Hotkey((uint16)0, "build_button", WID_DPI_FUND_WIDGET), + HOTKEY_LIST_END +}; + +HotkeyList BuildIndustryWindow::hotkeys("industry_fund_gui", build_industry_hotkeys); + +/** Window definition of the dynamic place industries gui */ +static WindowDesc _build_industry_desc( + WDP_AUTO, "build_industry", 170, 212, + WC_BUILD_INDUSTRY, WC_NONE, + WDF_CONSTRUCTION, + _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets), + &BuildIndustryWindow::hotkeys +); + + void ShowBuildIndustryWindow() { if (_game_mode != GM_EDITOR && !Company::IsValidID(_local_company)) return; if (BringWindowToFrontById(WC_BUILD_INDUSTRY, 0)) return; - new BuildIndustryWindow(); + new BuildIndustryWindow(&_build_industry_desc); } static void UpdateIndustryProduction(Industry *i);