Merge pull request #2776 from myk002/myk_pause_forced

display PAUSE FORCED instead of a pause icon
develop
Myk 2023-02-01 17:53:11 -08:00 committed by GitHub
commit 79d5ade02d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 34 deletions

@ -56,6 +56,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- `getplants`: ID values will now be accepted regardless of case - `getplants`: ID values will now be accepted regardless of case
-@ New borders for DFHack tool windows -- tell us what you think! -@ New borders for DFHack tool windows -- tell us what you think!
- `gui/control-panel`: new global hotkey: tilde (Shift-backtick on most keyboards) - `gui/control-panel`: new global hotkey: tilde (Shift-backtick on most keyboards)
- Windows now display "PAUSE FORCED" on the lower border if the tool is forcing the game to pause
- `seedwatch`: now persists enabled state in the savegame, automatically loads useful defaults, and respects reachability when counting available seeds - `seedwatch`: now persists enabled state in the savegame, automatically loads useful defaults, and respects reachability when counting available seeds
## Documentation ## Documentation

@ -886,7 +886,7 @@ local BASE_FRAME = {
title_pen = to_pen{ fg=COLOR_BLACK, bg=COLOR_GREY }, title_pen = to_pen{ fg=COLOR_BLACK, bg=COLOR_GREY },
inactive_title_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK }, inactive_title_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK },
signature_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK }, signature_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK },
paused_pen = to_pen{tile=782, ch=216, fg=COLOR_GREY, bg=COLOR_BLACK}, paused_pen = to_pen{fg=COLOR_RED, bg=COLOR_BLACK},
} }
local function make_frame(name, double_line) local function make_frame(name, double_line)
@ -946,19 +946,8 @@ function paint_frame(dc,rect,style,title,inactive,pause_forced,resizable)
end end
if pause_forced then if pause_forced then
-- get the tiles for the activated pause symbol dscreen.paintString(style.paused_pen or style.title_pen or pen,
local pause_texpos_ul = dfhack.screen.findGraphicsTile('INTERFACE_BITS', 18, 28) x1+2, y2, ' PAUSE FORCED ')
local pause_texpos_ur = dfhack.screen.findGraphicsTile('INTERFACE_BITS', 19, 28)
local pause_texpos_ll = dfhack.screen.findGraphicsTile('INTERFACE_BITS', 18, 29)
local pause_texpos_lr = dfhack.screen.findGraphicsTile('INTERFACE_BITS', 19, 29)
if not pause_texpos_ul then
dscreen.paintTile(style.paused_pen, x2-1, y1)
else
dscreen.paintTile(style.paused_pen, x2-2, y1-1, nil, pause_texpos_ul)
dscreen.paintTile(style.paused_pen, x2-1, y1-1, nil, pause_texpos_ur)
dscreen.paintTile(style.paused_pen, x2-2, y1, nil, pause_texpos_ll)
dscreen.paintTile(style.paused_pen, x2-1, y1, nil, pause_texpos_lr)
end
end end
end end

@ -271,26 +271,6 @@ local function Panel_on_double_click(self)
Panel_update_frame(self, frame, true) Panel_update_frame(self, frame, true)
end end
local function panel_mouse_is_on_pause_icon(self)
local frame_rect = self.frame_rect
local x,y = dscreen.getMousePos()
return (x == frame_rect.x2-2 or x == frame_rect.x2-1)
and (y == frame_rect.y1-1 or y == frame_rect.y1)
end
local function panel_has_pause_icon(self)
return self.parent_view and self.parent_view.force_pause
end
function Panel:getMouseFramePos()
local x,y = Panel.super.getMouseFramePos(self)
if x then return x, y end
if panel_has_pause_icon(self) and panel_mouse_is_on_pause_icon(self) then
local frame_rect = self.frame_rect
return frame_rect.width - 3, 0
end
end
function Panel:onInput(keys) function Panel:onInput(keys)
if self.kbd_get_pos then if self.kbd_get_pos then
if keys.SELECT or keys.LEAVESCREEN or keys._MOUSE_R_DOWN then if keys.SELECT or keys.LEAVESCREEN or keys._MOUSE_R_DOWN then