display PAUSE FORCED instead of a pause icon

if the window is forcing the game to pause. the icon looked too
clickable
develop
Myk Taylor 2023-02-01 14:01:29 -08:00
parent 0ff7ad0cc4
commit 6ae771ecb4
No known key found for this signature in database
GPG Key ID: 8A39CA0FA0C16E78
3 changed files with 4 additions and 34 deletions

@ -55,6 +55,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
## Documentation ## Documentation
-@ Quickstart guide has been updated with info on new window behavior and how to use the control panel -@ Quickstart guide has been updated with info on new window behavior and how to use the control panel

@ -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