add hotkey for launching the quickstart guide from the hover menu

develop
Myk Taylor 2023-01-15 20:17:23 -08:00
parent 65ceb565f8
commit 86ddf43230
No known key found for this signature in database
1 changed files with 19 additions and 3 deletions

@ -140,12 +140,18 @@ function Menu:init()
local choices,list_width = get_choices(hotkeys, bindings, is_inverted) local choices,list_width = get_choices(hotkeys, bindings, is_inverted)
local list_frame = copyall(self.hotspot_frame) local list_frame = copyall(self.hotspot_frame)
local list_widget_frame = {h=math.min(#choices, MAX_LIST_HEIGHT)}
local quickstart_frame = {}
list_frame.w = list_width + 2 list_frame.w = list_width + 2
list_frame.h = math.min(#choices, MAX_LIST_HEIGHT) + 2 list_frame.h = list_widget_frame.h + 4
if list_frame.t then if list_frame.t then
list_frame.t = math.max(0, list_frame.t - 1) list_frame.t = math.max(0, list_frame.t - 1)
list_widget_frame.t = 0
quickstart_frame.b = 0
else else
list_frame.b = math.max(0, list_frame.b - 1) list_frame.b = math.max(0, list_frame.b - 1)
list_widget_frame.b = 0
quickstart_frame.t = 0
end end
if list_frame.l then if list_frame.l then
list_frame.l = math.max(0, list_frame.l + 5) list_frame.l = math.max(0, list_frame.l + 5)
@ -161,21 +167,30 @@ function Menu:init()
end end
self:addviews{ self:addviews{
widgets.ResizingPanel{ widgets.Panel{
view_id='list_panel', view_id='list_panel',
autoarrange_subviews=true,
frame=list_frame, frame=list_frame,
frame_style=gui.GREY_LINE_FRAME, frame_style=gui.GREY_LINE_FRAME,
frame_background=gui.CLEAR_PEN, frame_background=gui.CLEAR_PEN,
subviews={ subviews={
widgets.List{ widgets.List{
view_id='list', view_id='list',
frame=list_widget_frame,
choices=choices, choices=choices,
icon_width=2, icon_width=2,
on_select=self:callback('onSelect'), on_select=self:callback('onSelect'),
on_submit=self:callback('onSubmit'), on_submit=self:callback('onSubmit'),
on_submit2=self:callback('onSubmit2'), on_submit2=self:callback('onSubmit2'),
}, },
widgets.Panel{frame={h=1}},
widgets.HotkeyLabel{
frame=quickstart_frame,
label='Quickstart guide',
key='STRING_A063',
on_activate=function()
self:onSubmit(nil, {command='quickstart-guide'})
end,
},
}, },
}, },
widgets.ResizingPanel{ widgets.ResizingPanel{
@ -247,6 +262,7 @@ function Menu:onRenderFrame(dc, rect)
self.initialize() self.initialize()
self.initialize = nil self.initialize = nil
end end
Menu.super.onRenderFrame(dc, rect)
end end
function Menu:getMouseFramePos() function Menu:getMouseFramePos()