diff --git a/docs/changelog.txt b/docs/changelog.txt index bf0171b318..f9ac8f662e 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -58,6 +58,7 @@ Template for new versions: ## New Tools ## New Features +- `stocks`: add button/hotkey for expanding all categories on stocks interface ## Fixes diff --git a/plugins/lua/stocks.lua b/plugins/lua/stocks.lua index 2bfd4bb052..21df5c59e1 100644 --- a/plugins/lua/stocks.lua +++ b/plugins/lua/stocks.lua @@ -14,6 +14,14 @@ local function collapse_all() stocks.i_height = num_sections * 3 end +local function expand_all() + local num_sections = #stocks.current_type_a_expanded + for idx=0,num_sections-1 do + stocks.current_type_a_expanded[idx] = true + end + stocks.i_height = num_sections * 3 +end + local function remove_empty() local empties = {} for itype,v in ipairs(stocks.storeamount) do @@ -52,6 +60,12 @@ function StocksOverlay:init() key='CUSTOM_CTRL_X', on_activate=collapse_all, }, + widgets.HotkeyLabel{ + frame={t=1, l=0}, + label='expand all', + key='CUSTOM_CTRL_Z', + on_activate=expand_all, + }, widgets.HotkeyLabel{ frame={t=2, l=0}, label='remove empties',