Skip to content

Commit

Permalink
Merge pull request #4857 from chdoc/orders-overlay
Browse files Browse the repository at this point in the history
[orders] compact and properly hide workers tab overlay
  • Loading branch information
myk002 authored Aug 14, 2024
2 parents dcf1fec + 29696df commit 4b3dba6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Template for new versions:
- `exterminate`: don't kill friendly undead (unless ``--include-friendly`` is passed) when specifying ``undead`` as the target

## Misc Improvements
- `orders`: more space efficient workshop overlay

## Documentation
- Lua API document ``dfhack.items.findType(string)`` and ``dfhack.items.findSubtype(string)``
Expand Down
22 changes: 13 additions & 9 deletions plugins/lua/orders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ SkillRestrictionOverlay.ATTRS{
'dwarfmode/ViewSheets/BUILDING/Furnace',
'dwarfmode/ViewSheets/BUILDING/Workshop',
},
frame={w=54, h=7},
frame={w=57, h=7},
}

local function can_set_skill_level()
Expand Down Expand Up @@ -330,7 +330,7 @@ function SkillRestrictionOverlay:init()
panel:addviews{
widgets.CycleHotkeyLabel{
view_id='min_skill',
frame={l=0, t=0, w=16},
frame={l=1, t=0, w=16},
label='Min skill:',
label_below=true,
key_back='CUSTOM_SHIFT_C',
Expand Down Expand Up @@ -365,7 +365,7 @@ function SkillRestrictionOverlay:init()
end,
},
widgets.RangeSlider{
frame={l=0, t=3},
frame={l=1, t=3},
num_stops=#SKILL_OPTIONS,
get_left_idx_fn=function()
return self.subviews.min_skill:getOptionValue()
Expand Down Expand Up @@ -445,7 +445,7 @@ LaborRestrictionsOverlay.ATTRS{
'dwarfmode/ViewSheets/BUILDING/Workshop/Quern/Workers',
'dwarfmode/ViewSheets/BUILDING/Workshop/Still/Workers',
},
frame={w=37, h=17},
frame={w=57, h=15},
}

local function can_set_labors()
Expand Down Expand Up @@ -527,7 +527,7 @@ end

function make_labor_panel(bld_type, bld_subtype, labors)
local list = widgets.List{
frame={t=2, l=0, r=0, b=2},
frame={t=2, l=1, w=28, b=0},
on_double_click=toggle_labor,
}

Expand All @@ -536,7 +536,7 @@ function make_labor_panel(bld_type, bld_subtype, labors)
frame_background=gui.CLEAR_PEN,
-- will get clamped to parent frame and a scrollbar will appear if the list
-- is too long
frame={l=0, r=0, t=0, h=#labors+7},
frame={l=0, r=0, t=0, h=math.max(#labors+5,9)},
visible=function()
local bld = dfhack.gui.getSelectedBuilding(true)
return bld and bld:getType() == bld_type and bld.type == bld_subtype
Expand All @@ -548,7 +548,7 @@ function make_labor_panel(bld_type, bld_subtype, labors)
},
list,
widgets.HotkeyLabel{
frame={l=0, b=1},
frame={l=30, t=2},
key='CUSTOM_CTRL_A',
label='Toggle all',
auto_width=true,
Expand All @@ -563,12 +563,16 @@ function make_labor_panel(bld_type, bld_subtype, labors)
end,
},
widgets.HotkeyLabel{
frame={l=0, b=0},
frame={l=30, t=4},
key='SELECT',
label='Or double click to toggle',
label='Toggle selected',
auto_width=true,
on_activate=function() toggle_labor(list:getSelected()) end,
},
widgets.Label{
frame={l=37, t=5},
text='(or double click)'
}
},
}

Expand Down

0 comments on commit 4b3dba6

Please sign in to comment.