|
|
|
@ -706,6 +706,10 @@ function ZScreen:isOnTop()
|
|
|
|
|
return dfhack.gui.getCurViewscreen(true) == self._native
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ZScreen:toggleLocked()
|
|
|
|
|
self.locked = not self.locked
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ZScreen:onInput(keys)
|
|
|
|
|
if not self:isOnTop() then
|
|
|
|
|
if keys._MOUSE_L_DOWN and self:isMouseOver() then
|
|
|
|
@ -719,7 +723,13 @@ function ZScreen:onInput(keys)
|
|
|
|
|
if ZScreen.super.onInput(self, keys) then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if keys.LEAVESCREEN or keys._MOUSE_R_DOWN then
|
|
|
|
|
|
|
|
|
|
if keys.CUSTOM_ALT_L then
|
|
|
|
|
self:toggleLocked()
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not self.locked and (keys.LEAVESCREEN or keys._MOUSE_R_DOWN) then
|
|
|
|
|
self:dismiss()
|
|
|
|
|
-- ensure underlying DF screens don't also react to the click
|
|
|
|
|
df.global.enabler.mouse_rbut_down = 0
|
|
|
|
@ -732,7 +742,6 @@ function ZScreen:onInput(keys)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- move this viewscreen to the top of the stack (if it's not there already)
|
|
|
|
|
function ZScreen:raise()
|
|
|
|
|
if self:isDismissed() or self:isOnTop() then
|
|
|
|
|
return self
|
|
|
|
@ -741,10 +750,10 @@ function ZScreen:raise()
|
|
|
|
|
return self
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- subclasses should either annotate their viewable panel with view_id='main'
|
|
|
|
|
-- or override this and return whether the mouse is over an owned screen element
|
|
|
|
|
function ZScreen:isMouseOver()
|
|
|
|
|
return self.subviews.main and self.subviews.main:getMouseFramePos() or false
|
|
|
|
|
for _,sv in ipairs(self.subviews) do
|
|
|
|
|
if sv:getMouseFramePos() then return true end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--------------------------
|
|
|
|
@ -777,9 +786,11 @@ GREY_LINE_FRAME = {
|
|
|
|
|
rb_frame_pen = to_pen{ tile=917, ch=188, fg=COLOR_GREY, bg=COLOR_BLACK },
|
|
|
|
|
title_pen = to_pen{ fg=COLOR_BLACK, bg=COLOR_GREY },
|
|
|
|
|
signature_pen = to_pen{ fg=COLOR_GREY, bg=COLOR_BLACK },
|
|
|
|
|
locked_pen = to_pen{tile=779, ch=216, fg=COLOR_GREY, bg=COLOR_GREEN},
|
|
|
|
|
unlocked_pen = to_pen{tile=782, ch=216, fg=COLOR_GREY, bg=COLOR_BLACK},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function paint_frame(dc,rect,style,title)
|
|
|
|
|
function paint_frame(dc,rect,style,title,show_lock,locked)
|
|
|
|
|
local pen = style.frame_pen
|
|
|
|
|
local x1,y1,x2,y2 = dc.x1+rect.x1, dc.y1+rect.y1, dc.x1+rect.x2, dc.y1+rect.y2
|
|
|
|
|
dscreen.paintTile(style.lt_frame_pen or pen, x1, y1)
|
|
|
|
@ -802,6 +813,14 @@ function paint_frame(dc,rect,style,title)
|
|
|
|
|
end
|
|
|
|
|
dscreen.paintString(style.title_pen or pen, x, y1, tstr)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if show_lock then
|
|
|
|
|
if locked and style.locked_pen then
|
|
|
|
|
dscreen.paintTile(style.locked_pen, x2-1, y1)
|
|
|
|
|
elseif not locked and style.unlocked_pen then
|
|
|
|
|
dscreen.paintTile(style.unlocked_pen, x2-1, y1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
FramedScreen = defclass(FramedScreen, Screen)
|
|
|
|
|