diff --git a/docs/changelog.txt b/docs/changelog.txt index f9829c382..35bafccf7 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -34,7 +34,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: # Future ## 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 - `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.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.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.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. diff --git a/library/lua/gui.lua b/library/lua/gui.lua index e69237003..d817a7a0e 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -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.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.paintString(style.signature_pen or style.title_pen or pen,x2-7,y2,"DFHack") + if style.signature_pen ~= false then + dscreen.paintString(style.signature_pen or style.title_pen or pen,x2-7,y2,"DFHack") + end if title then local x = math.max(0,math.floor((x2-x1-3-#title)/2)) + x1 diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index 973fe8339..9d42edd45 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -144,6 +144,9 @@ function ResizingPanel:postUpdateLayout(frame_body) (s.frame and s.frame.h or frame_body.height)) 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 w = w + 2 h = h + 2 @@ -827,7 +830,8 @@ function Label:scroll(nlines) end end 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) nlines = n - self.start_line_num self.start_line_num = n @@ -928,7 +932,7 @@ end function HotkeyLabel:onInput(keys) if HotkeyLabel.super.onInput(self, keys) then 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() return true end diff --git a/plugins/hotkeys.cpp b/plugins/hotkeys.cpp index 0e9e0953c..6bb6a1600 100644 --- a/plugins/hotkeys.cpp +++ b/plugins/hotkeys.cpp @@ -84,7 +84,7 @@ static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) { 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)); }