Merge branch 'develop' into myk_default_search_key

develop
Myk 2022-11-29 15:07:12 -08:00 committed by GitHub
commit aac89d4942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

@ -34,7 +34,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
# Future # Future
## New Plugins ## New Plugins
- `overlay`: plugin is transformed from a single line of text that runs `gui/launcher` on click to a fully-featured overlay injection framework. See `overlay-dev-guide` for details. - `overlay`: plugin is transformed from a single line of text that runs `gui/launcher` on click to a fully-featured overlay injection framework. It now houses a popup menu for active keybindings, all the widgets provided by `dwarfmonitor` (e.g. the current date and number of happy/unhappy dwarves), the overlay that highlights suspended buildings when you pause, and others. See `overlay-dev-guide` for details.
## Fixes ## Fixes
- `automaterial`: fix the cursor jumping up a z level when clicking quickly after box select - `automaterial`: fix the cursor jumping up a z level when clicking quickly after box select
@ -117,6 +117,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- ``widgets.Panel``: new ``frame_style`` and ``frame_title`` attributes for drawing frames around groups of widgets - ``widgets.Panel``: new ``frame_style`` and ``frame_title`` attributes for drawing frames around groups of widgets
- ``widgets.EditField``: now allows other widgets to process characters that the ``on_char`` callback rejects. - ``widgets.EditField``: now allows other widgets to process characters that the ``on_char`` callback rejects.
- ``widgets.FilteredList``: now provides a useful default search key for list items made up of text tokens instead of plain text - ``widgets.FilteredList``: now provides a useful default search key for list items made up of text tokens instead of plain text
- ``widgets.ResizingPanel``: now accounts for frame inset when calculating frame size
- ``widgets.HotkeyLabel``: now ignores mouse clicks when ``on_activate`` is not defined
- ``gui.Screen.show()`` now returns ``self`` as a convenience - ``gui.Screen.show()`` now returns ``self`` as a convenience
- ``gui.View.getMousePos()`` now takes an optional ``ViewRect`` parameter in case the caller wants to get the mouse pos relative to a rect that is not the frame_body (such as the frame_rect) - ``gui.View.getMousePos()`` now takes an optional ``ViewRect`` parameter in case the caller wants to get the mouse pos relative to a rect that is not the frame_body (such as the frame_rect)
- Lua mouse events now conform to documented behavior in `lua-api` -- ``_MOUSE_L_DOWN`` will be sent exactly once per mouse click and ``_MOUSE_L`` will be sent repeatedly as long as the button is held down. Similarly for right mouse button events. - Lua mouse events now conform to documented behavior in `lua-api` -- ``_MOUSE_L_DOWN`` will be sent exactly once per mouse click and ``_MOUSE_L`` will be sent repeatedly as long as the button is held down. Similarly for right mouse button events.

@ -711,7 +711,9 @@ function paint_frame(x1,y1,x2,y2,style,title)
dscreen.fillRect(style.b_frame_pen or style.h_frame_pen or pen,x1+1,y2,x2-1,y2) dscreen.fillRect(style.b_frame_pen or style.h_frame_pen or pen,x1+1,y2,x2-1,y2)
dscreen.fillRect(style.l_frame_pen or style.v_frame_pen or pen,x1,y1+1,x1,y2-1) dscreen.fillRect(style.l_frame_pen or style.v_frame_pen or pen,x1,y1+1,x1,y2-1)
dscreen.fillRect(style.r_frame_pen or style.v_frame_pen or pen,x2,y1+1,x2,y2-1) dscreen.fillRect(style.r_frame_pen or style.v_frame_pen or pen,x2,y1+1,x2,y2-1)
if style.signature_pen ~= false then
dscreen.paintString(style.signature_pen or style.title_pen or pen,x2-7,y2,"DFHack") dscreen.paintString(style.signature_pen or style.title_pen or pen,x2-7,y2,"DFHack")
end
if title then if title then
local x = math.max(0,math.floor((x2-x1-3-#title)/2)) + x1 local x = math.max(0,math.floor((x2-x1-3-#title)/2)) + x1

@ -144,6 +144,9 @@ function ResizingPanel:postUpdateLayout(frame_body)
(s.frame and s.frame.h or frame_body.height)) (s.frame and s.frame.h or frame_body.height))
end end
end end
local l,t,r,b = gui.parse_inset(self.frame_inset)
w = w + l + r
h = h + t + b
if self.frame_style then if self.frame_style then
w = w + 2 w = w + 2
h = h + 2 h = h + 2
@ -827,7 +830,8 @@ function Label:scroll(nlines)
end end
end end
local n = self.start_line_num + nlines local n = self.start_line_num + nlines
n = math.min(n, self:getTextHeight() - self.frame_body.height + 1) local text_height = math.max(1, self:getTextHeight())
n = math.min(n, text_height - self.frame_body.height + 1)
n = math.max(n, 1) n = math.max(n, 1)
nlines = n - self.start_line_num nlines = n - self.start_line_num
self.start_line_num = n self.start_line_num = n
@ -928,7 +932,7 @@ end
function HotkeyLabel:onInput(keys) function HotkeyLabel:onInput(keys)
if HotkeyLabel.super.onInput(self, keys) then if HotkeyLabel.super.onInput(self, keys) then
return true return true
elseif keys._MOUSE_L_DOWN and self:getMousePos() then elseif keys._MOUSE_L_DOWN and self:getMousePos() and self.on_activate then
self.on_activate() self.on_activate()
return true return true
end end

@ -84,7 +84,7 @@ static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) {
valid_keys.push_back(string(&c, 1)); valid_keys.push_back(string(&c, 1));
} }
for (int i = 1; i < 13; i++) { for (int i = 1; i <= 12; i++) {
valid_keys.push_back("F" + int_to_string(i)); valid_keys.push_back("F" + int_to_string(i));
} }