|
|
@ -81,116 +81,147 @@ function ItemSelection:init()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
self:addviews{
|
|
|
|
self:addviews{
|
|
|
|
widgets.Label{
|
|
|
|
widgets.Panel{
|
|
|
|
frame={t=0, l=0, r=16},
|
|
|
|
view_id='header',
|
|
|
|
text={
|
|
|
|
frame={t=0, h=3},
|
|
|
|
self.desc, plural, NEWLINE,
|
|
|
|
subviews={
|
|
|
|
('Select up to %d item%s ('):format(self.quantity, plural),
|
|
|
|
widgets.Label{
|
|
|
|
{text=function() return self.num_selected end},
|
|
|
|
frame={t=0, l=0, r=16},
|
|
|
|
' selected)',
|
|
|
|
text={
|
|
|
|
},
|
|
|
|
self.desc, plural, NEWLINE,
|
|
|
|
},
|
|
|
|
('Select up to %d item%s ('):format(self.quantity, plural),
|
|
|
|
widgets.Label{
|
|
|
|
{text=function() return self.num_selected end},
|
|
|
|
frame={r=0, w=15, t=0, h=3},
|
|
|
|
' selected)',
|
|
|
|
text_pen=BUILD_TEXT_PEN,
|
|
|
|
},
|
|
|
|
text_hpen=BUILD_TEXT_HPEN,
|
|
|
|
},
|
|
|
|
text={
|
|
|
|
widgets.Label{
|
|
|
|
' Use filter ', NEWLINE,
|
|
|
|
frame={r=0, w=15, t=0, h=3},
|
|
|
|
' for remaining ', NEWLINE,
|
|
|
|
text_pen=BUILD_TEXT_PEN,
|
|
|
|
' items ',
|
|
|
|
text_hpen=BUILD_TEXT_HPEN,
|
|
|
|
},
|
|
|
|
text={
|
|
|
|
on_click=self:callback('submit'),
|
|
|
|
' Use filter ', NEWLINE,
|
|
|
|
visible=function() return self.num_selected < self.quantity end,
|
|
|
|
' for remaining ', NEWLINE,
|
|
|
|
},
|
|
|
|
' items ',
|
|
|
|
widgets.Label{
|
|
|
|
},
|
|
|
|
frame={r=0, w=15, t=0, h=3},
|
|
|
|
on_click=self:callback('submit'),
|
|
|
|
text_pen=BUILD_TEXT_PEN,
|
|
|
|
visible=function() return self.num_selected < self.quantity end,
|
|
|
|
text_hpen=BUILD_TEXT_HPEN,
|
|
|
|
},
|
|
|
|
text={
|
|
|
|
widgets.Label{
|
|
|
|
' ', NEWLINE,
|
|
|
|
frame={r=0, w=15, t=0, h=3},
|
|
|
|
' Continue ', NEWLINE,
|
|
|
|
text_pen=BUILD_TEXT_PEN,
|
|
|
|
' ',
|
|
|
|
text_hpen=BUILD_TEXT_HPEN,
|
|
|
|
|
|
|
|
text={
|
|
|
|
|
|
|
|
' ', NEWLINE,
|
|
|
|
|
|
|
|
' Continue ', NEWLINE,
|
|
|
|
|
|
|
|
' ',
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
on_click=self:callback('submit'),
|
|
|
|
|
|
|
|
visible=function() return self.num_selected >= self.quantity end,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
on_click=self:callback('submit'),
|
|
|
|
|
|
|
|
visible=function() return self.num_selected >= self.quantity end,
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
widgets.CycleHotkeyLabel{
|
|
|
|
}
|
|
|
|
frame={l=1, t=3},
|
|
|
|
|
|
|
|
key='CUSTOM_SHIFT_R',
|
|
|
|
self:addviews{
|
|
|
|
label='Sort by:',
|
|
|
|
widgets.Panel{
|
|
|
|
options={
|
|
|
|
view_id='body',
|
|
|
|
{label='Recently used', value=sort_by_recency},
|
|
|
|
frame={t=self.subviews.header.frame.h, b=4},
|
|
|
|
{label='Name', value=sort_by_name},
|
|
|
|
subviews={
|
|
|
|
{label='Amount', value=sort_by_quantity},
|
|
|
|
widgets.EditField{
|
|
|
|
|
|
|
|
view_id='search',
|
|
|
|
|
|
|
|
frame={l=1, t=0},
|
|
|
|
|
|
|
|
label_text='Search: ',
|
|
|
|
|
|
|
|
on_char=function(ch) return ch:match('[%l -]') end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
widgets.CycleHotkeyLabel{
|
|
|
|
|
|
|
|
frame={l=1, t=2},
|
|
|
|
|
|
|
|
key='CUSTOM_SHIFT_R',
|
|
|
|
|
|
|
|
label='Sort by:',
|
|
|
|
|
|
|
|
options={
|
|
|
|
|
|
|
|
{label='Recently used', value=sort_by_recency},
|
|
|
|
|
|
|
|
{label='Name', value=sort_by_name},
|
|
|
|
|
|
|
|
{label='Amount', value=sort_by_quantity},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
on_change=self:callback('on_sort'),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
widgets.Panel{
|
|
|
|
|
|
|
|
frame={l=0, t=3, r=0, b=0},
|
|
|
|
|
|
|
|
frame_style=gui.INTERIOR_FRAME,
|
|
|
|
|
|
|
|
subviews={
|
|
|
|
|
|
|
|
widgets.FilteredList{
|
|
|
|
|
|
|
|
view_id='flist',
|
|
|
|
|
|
|
|
frame={t=0, b=0},
|
|
|
|
|
|
|
|
case_sensitive=false,
|
|
|
|
|
|
|
|
choices=choices,
|
|
|
|
|
|
|
|
icon_width=2,
|
|
|
|
|
|
|
|
on_submit=self:callback('toggle_group'),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
on_change=self:callback('on_sort'),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
widgets.FilteredList{
|
|
|
|
|
|
|
|
view_id='flist',
|
|
|
|
|
|
|
|
frame={t=5, l=1, r=1, b=5},
|
|
|
|
|
|
|
|
case_sensitive=false,
|
|
|
|
|
|
|
|
choices=choices,
|
|
|
|
|
|
|
|
icon_width=2,
|
|
|
|
|
|
|
|
on_submit=self:callback('toggle_group'),
|
|
|
|
|
|
|
|
edit_on_char=function(ch) return ch:match('[%l -]') end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
widgets.Label{
|
|
|
|
|
|
|
|
frame={l=1, t=5},
|
|
|
|
|
|
|
|
text_pen=COLOR_LIGHTCYAN,
|
|
|
|
|
|
|
|
text={">"},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
widgets.Panel{
|
|
|
|
widgets.Panel{
|
|
|
|
frame={l=0, t=6, r=0, b=4},
|
|
|
|
view_id='footer',
|
|
|
|
frame_style=gui.INTERIOR_FRAME,
|
|
|
|
frame={l=1, r=1, b=0, h=3},
|
|
|
|
},
|
|
|
|
subviews={
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
--[[
|
|
|
|
frame={l=0, b=2},
|
|
|
|
add an explanation for this terribleness
|
|
|
|
key='KEYBOARD_CURSOR_RIGHT_FAST',
|
|
|
|
--]]
|
|
|
|
key_sep='ight: ',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
label='Use one',
|
|
|
|
frame={l=0, h=1, t=0},
|
|
|
|
auto_width=true,
|
|
|
|
key='KEYBOARD_CURSOR_RIGHT_FAST',
|
|
|
|
on_activate=function() self:increment_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
key_sep='----: ', --these hypens are overwritten by the next Label
|
|
|
|
},
|
|
|
|
label='Use one',
|
|
|
|
widgets.Label{
|
|
|
|
auto_width=true,
|
|
|
|
frame={l=6, b=2, w=5},
|
|
|
|
on_activate=function() self:increment_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
text_pen=COLOR_LIGHTGREEN,
|
|
|
|
},
|
|
|
|
text='Right',
|
|
|
|
widgets.Label{
|
|
|
|
},
|
|
|
|
frame={l=6, w=5, t=0},
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
text_pen=COLOR_LIGHTGREEN,
|
|
|
|
frame={l=1, b=1},
|
|
|
|
text='Right',
|
|
|
|
key='KEYBOARD_CURSOR_LEFT_FAST',
|
|
|
|
},
|
|
|
|
key_sep='eft: ',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
label='Use one fewer',
|
|
|
|
frame={l=1, h=1, t=1},
|
|
|
|
auto_width=true,
|
|
|
|
key='KEYBOARD_CURSOR_LEFT_FAST',
|
|
|
|
on_activate=function() self:decrement_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
key_sep='---: ', --these hypens are overwritten by the next Label
|
|
|
|
},
|
|
|
|
label='Use one fewer',
|
|
|
|
widgets.Label{
|
|
|
|
auto_width=true,
|
|
|
|
frame={l=7, b=1, w=4},
|
|
|
|
on_activate=function() self:decrement_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
text_pen=COLOR_LIGHTGREEN,
|
|
|
|
},
|
|
|
|
text='Left',
|
|
|
|
widgets.Label{
|
|
|
|
},
|
|
|
|
frame={l=7, w=4, t=1},
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
text_pen=COLOR_LIGHTGREEN,
|
|
|
|
frame={l=6, b=0},
|
|
|
|
text='Left',
|
|
|
|
key='SELECT',
|
|
|
|
},
|
|
|
|
label='Use all/none',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
auto_width=true,
|
|
|
|
frame={l=6, t=2, h=2},
|
|
|
|
on_activate=function() self:toggle_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
key='SELECT',
|
|
|
|
},
|
|
|
|
label='Use all/none',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
auto_width=true,
|
|
|
|
frame={r=5, b=2},
|
|
|
|
on_activate=function() self:toggle_group(self.subviews.flist.list:getSelected()) end,
|
|
|
|
key='LEAVESCREEN',
|
|
|
|
},
|
|
|
|
label='Go back',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
auto_width=true,
|
|
|
|
frame={r=5, t=0},
|
|
|
|
on_activate=self:callback('on_cancel'),
|
|
|
|
key='LEAVESCREEN',
|
|
|
|
},
|
|
|
|
label='Go back',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
auto_width=true,
|
|
|
|
frame={r=4, b=0},
|
|
|
|
on_activate=self:callback('on_cancel'),
|
|
|
|
key='CUSTOM_SHIFT_C',
|
|
|
|
},
|
|
|
|
label='Continue',
|
|
|
|
widgets.HotkeyLabel{
|
|
|
|
auto_width=true,
|
|
|
|
frame={r=4, t=2},
|
|
|
|
on_activate=self:callback('submit'),
|
|
|
|
key='CUSTOM_SHIFT_C',
|
|
|
|
|
|
|
|
label='Continue',
|
|
|
|
|
|
|
|
auto_width=true,
|
|
|
|
|
|
|
|
on_activate=self:callback('submit'),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.subviews.flist.list.frame.t = 0
|
|
|
|
|
|
|
|
self.subviews.flist.edit.visible = false
|
|
|
|
|
|
|
|
self.subviews.flist.edit = self.subviews.search
|
|
|
|
|
|
|
|
self.subviews.search.on_change = self.subviews.flist:callback('onFilterChange')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- resort and restore selection
|
|
|
|
-- resort and restore selection
|
|
|
|