add help button to squad panel

develop
Myk Taylor 2023-10-09 03:45:53 -07:00
parent e7c07a2494
commit 3ee059317f
No known key found for this signature in database
2 changed files with 30 additions and 5 deletions

@ -64,6 +64,7 @@ Template for new versions:
## Misc Improvements ## Misc Improvements
- `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates - `overlay`: allow ``overlay_onupdate_max_freq_seconds`` to be dynamically set to 0 for a burst of high-frequency updates
- `orders`: ``recheck`` command now only resets orders that have conditions that can be rechecked - `orders`: ``recheck`` command now only resets orders that have conditions that can be rechecked
- `sort`: added help button for squad assignment search/filter/sort
## Documentation ## Documentation

@ -4,6 +4,7 @@ local info = require('plugins.sort.info')
local gui = require('gui') local gui = require('gui')
local overlay = require('plugins.overlay') local overlay = require('plugins.overlay')
local setbelief = reqscript('modtools/set-belief') local setbelief = reqscript('modtools/set-belief')
local textures = require('gui.textures')
local utils = require('utils') local utils = require('utils')
local widgets = require('gui.widgets') local widgets = require('gui.widgets')
@ -631,10 +632,6 @@ SquadAssignmentOverlay.ATTRS{
viewscreens='dwarfmode/UnitSelector/SQUAD_FILL_POSITION', viewscreens='dwarfmode/UnitSelector/SQUAD_FILL_POSITION',
version='2', version='2',
frame={w=38, h=31}, frame={w=38, h=31},
frame_style=gui.FRAME_PANEL,
frame_background=gui.CLEAR_PEN,
autoarrange_subviews=true,
autoarrange_gap=1,
} }
-- allow initial spacebar or two successive spacebars to fall through and -- allow initial spacebar or two successive spacebars to fall through and
@ -661,7 +658,14 @@ function SquadAssignmentOverlay:init()
}) })
end end
self:addviews{ local main_panel = widgets.Panel{
frame={l=0, r=0, t=0, b=0},
frame_style=gui.FRAME_PANEL,
frame_background=gui.CLEAR_PEN,
autoarrange_subviews=true,
autoarrange_gap=1,
}
main_panel:addviews{
widgets.EditField{ widgets.EditField{
view_id='search', view_id='search',
frame={l=0}, frame={l=0},
@ -940,6 +944,26 @@ function SquadAssignmentOverlay:init()
on_change=function() self:refresh_list() end, on_change=function() self:refresh_list() end,
}, },
} }
local button_pen_left = dfhack.pen.parse{fg=COLOR_CYAN,
tile=curry(textures.tp_control_panel, 7) or nil, ch=string.byte('[')}
local button_pen_right = dfhack.pen.parse{fg=COLOR_CYAN,
tile=curry(textures.tp_control_panel, 8) or nil, ch=string.byte(']')}
local help_pen_center = dfhack.pen.parse{
tile=curry(textures.tp_control_panel, 9) or nil, ch=string.byte('?')}
self:addviews{
main_panel,
widgets.Label{
frame={t=0, r=1, w=3},
text={
{tile=button_pen_left},
{tile=help_pen_center},
{tile=button_pen_right},
},
on_click=function() dfhack.run_command('gui/launcher', 'sort ') end,
},
}
end end
local function normalize_search_key(search_key) local function normalize_search_key(search_key)