Merge pull request #3393 from TaxiService/rename_frames

rename window frame constants
develop
Myk 2023-05-18 11:00:10 -07:00 committed by GitHub
commit b0f77951ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 18 deletions

@ -62,6 +62,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Lua
- ``overlay.reload()``: has been renamed to ``overlay.rescan()`` so as not to conflict with the global ``reload()`` function. If you are developing an overlay, please take note of the new function name for reloading your overlay during development.
- ``gui``: changed frame naming scheme to ``FRAME_X`` rather than ``X_FRAME``, and added aliases for backwards compatibility. (for example ``BOLD_FRAME`` is now called ``FRAME_BOLD``)
## Removed
- `orders`: ``library/military_include_artifact_materials`` library file removed since recent research indicates that platinum blunt weapons and silver crossbows are not more effective than standard steel. the alternate military orders file was also causing unneeded confusion.

@ -4347,32 +4347,32 @@ A framed screen has the following attributes:
There are the following predefined frame style tables:
* ``WINDOW_FRAME``
* ``FRAME_WINDOW``
A frame suitable for a draggable, optionally resizable window.
* ``PANEL_FRAME``
* ``FRAME_PANEL``
A frame suitable for a static (non-draggable, non-resizable) panel.
* ``MEDIUM_FRAME``
* ``FRAME_MEDIUM``
A frame suitable for overlay widget panels.
* ``BOLD_FRAME``
* ``FRAME_BOLD``
A frame suitable for a non-draggable panel meant to capture the user's focus,
like an important notification, confirmation dialog or error message.
* ``INTERIOR_FRAME``
* ``FRAME_INTERIOR``
A frame suitable for light interior accent elements. This frame does *not*
have a visible ``DFHack`` signature on it, so it must not be used as the most
external frame for a DFHack-owned UI.
* ``INTERIOR_MEDIUM_FRAME``
* ``FRAME_INTERIOR_MEDIUM``
A copy of ``MEDIUM_FRAME`` that lacks the ``DFHack`` signature. Suitable for
A copy of ``FRAME_MEDIUM`` that lacks the ``DFHack`` signature. Suitable for
panels that are part of a larger widget cluster. Must *not* be used as the
most external frame for a DFHack-owned UI.

@ -923,17 +923,26 @@ local function make_frame(name, double_line)
return frame
end
WINDOW_FRAME = make_frame('Window', true)
PANEL_FRAME = make_frame('Panel', false)
MEDIUM_FRAME = make_frame('Medium', false)
BOLD_FRAME = make_frame('Bold', true)
INTERIOR_FRAME = make_frame('Thin', false)
INTERIOR_FRAME.signature_pen = false
INTERIOR_MEDIUM_FRAME = copyall(MEDIUM_FRAME)
INTERIOR_MEDIUM_FRAME.signature_pen = false
FRAME_WINDOW = make_frame('Window', true)
FRAME_PANEL = make_frame('Panel', false)
FRAME_MEDIUM = make_frame('Medium', false)
FRAME_BOLD = make_frame('Bold', true)
FRAME_INTERIOR = make_frame('Thin', false)
FRAME_INTERIOR.signature_pen = false
FRAME_INTERIOR_MEDIUM = copyall(FRAME_MEDIUM)
FRAME_INTERIOR_MEDIUM.signature_pen = false
-- for compatibility with pre-steam code
GREY_LINE_FRAME = WINDOW_FRAME
GREY_LINE_FRAME = FRAME_PANEL
-- for compatibility with deprecated frame naming scheme
WINDOW_FRAME = FRAME_WINDOW
PANEL_FRAME = FRAME_PANEL
MEDIUM_FRAME = FRAME_MEDIUM
BOLD_FRAME = FRAME_BOLD
INTERIOR_FRAME = FRAME_INTERIOR
INTERIOR_MEDIUM_FRAME = FRAME_INTERIOR_MEDIUM
function paint_frame(dc,rect,style,title,inactive,pause_forced,resizable)
local pen = style.frame_pen
@ -942,8 +951,8 @@ function paint_frame(dc,rect,style,title,inactive,pause_forced,resizable)
dscreen.paintTile(style.rt_frame_pen or pen, x2, y1)
dscreen.paintTile(style.lb_frame_pen or pen, x1, y2)
local rb_frame_pen = style.rb_frame_pen
if rb_frame_pen == WINDOW_FRAME.rb_frame_pen and not resizable then
rb_frame_pen = PANEL_FRAME.rb_frame_pen
if rb_frame_pen == FRAME_WINDOW.rb_frame_pen and not resizable then
rb_frame_pen = FRAME_PANEL.rb_frame_pen
end
dscreen.paintTile(rb_frame_pen or pen, x2, y2)
dscreen.fillRect(style.t_frame_pen or style.h_frame_pen or pen,x1+1,y1,x2-1,y1)