|
|
@ -6,6 +6,7 @@ local gui = require('gui')
|
|
|
|
local utils = require('utils')
|
|
|
|
local utils = require('utils')
|
|
|
|
|
|
|
|
|
|
|
|
local dscreen = dfhack.screen
|
|
|
|
local dscreen = dfhack.screen
|
|
|
|
|
|
|
|
local getval = utils.getval
|
|
|
|
|
|
|
|
|
|
|
|
local function show_view(view,vis)
|
|
|
|
local function show_view(view,vis)
|
|
|
|
if view then
|
|
|
|
if view then
|
|
|
@ -13,14 +14,6 @@ local function show_view(view,vis)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function getval(obj)
|
|
|
|
|
|
|
|
if type(obj) == 'function' then
|
|
|
|
|
|
|
|
return obj()
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return obj
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function map_opttab(tab,idx)
|
|
|
|
local function map_opttab(tab,idx)
|
|
|
|
if tab then
|
|
|
|
if tab then
|
|
|
|
return tab[idx]
|
|
|
|
return tab[idx]
|
|
|
@ -109,7 +102,7 @@ function Panel:postUpdateLayout()
|
|
|
|
for _,subview in ipairs(self.subviews) do
|
|
|
|
for _,subview in ipairs(self.subviews) do
|
|
|
|
if not subview.frame then goto continue end
|
|
|
|
if not subview.frame then goto continue end
|
|
|
|
subview.frame.t = y
|
|
|
|
subview.frame.t = y
|
|
|
|
if subview.visible then
|
|
|
|
if getval(subview.visible) then
|
|
|
|
y = y + (subview.frame.h or 0) + gap
|
|
|
|
y = y + (subview.frame.h or 0) + gap
|
|
|
|
end
|
|
|
|
end
|
|
|
|
::continue::
|
|
|
|
::continue::
|
|
|
@ -137,7 +130,7 @@ ResizingPanel = defclass(ResizingPanel, Panel)
|
|
|
|
function ResizingPanel:postUpdateLayout(frame_body)
|
|
|
|
function ResizingPanel:postUpdateLayout(frame_body)
|
|
|
|
local w, h = 0, 0
|
|
|
|
local w, h = 0, 0
|
|
|
|
for _,s in ipairs(self.subviews) do
|
|
|
|
for _,s in ipairs(self.subviews) do
|
|
|
|
if s.visible then
|
|
|
|
if getval(s.visible) then
|
|
|
|
w = math.max(w, (s.frame and s.frame.l or 0) +
|
|
|
|
w = math.max(w, (s.frame and s.frame.l or 0) +
|
|
|
|
(s.frame and s.frame.w or frame_body.width))
|
|
|
|
(s.frame and s.frame.w or frame_body.width))
|
|
|
|
h = math.max(h, (s.frame and s.frame.t or 0) +
|
|
|
|
h = math.max(h, (s.frame and s.frame.t or 0) +
|
|
|
@ -265,7 +258,7 @@ function EditField:onRenderBody(dc)
|
|
|
|
dc:pen(self.text_pen or COLOR_LIGHTCYAN):fill(0,0,dc.width-1,0)
|
|
|
|
dc:pen(self.text_pen or COLOR_LIGHTCYAN):fill(0,0,dc.width-1,0)
|
|
|
|
|
|
|
|
|
|
|
|
local cursor_char = '_'
|
|
|
|
local cursor_char = '_'
|
|
|
|
if not self.active or not self.focus or gui.blink_visible(300) then
|
|
|
|
if not getval(self.active) or not self.focus or gui.blink_visible(300) then
|
|
|
|
cursor_char = (self.cursor > #self.text) and ' ' or
|
|
|
|
cursor_char = (self.cursor > #self.text) and ' ' or
|
|
|
|
self.text:sub(self.cursor, self.cursor)
|
|
|
|
self.text:sub(self.cursor, self.cursor)
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -907,8 +900,8 @@ TooltipLabel.ATTRS{
|
|
|
|
text_pen=COLOR_GREY,
|
|
|
|
text_pen=COLOR_GREY,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function TooltipLabel:preUpdateLayout()
|
|
|
|
function TooltipLabel:init()
|
|
|
|
self.visible = getval(self.show_tooltip)
|
|
|
|
self.visible = self.show_tooltip
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-----------------
|
|
|
|
-----------------
|
|
|
@ -1217,7 +1210,7 @@ function List:onRenderBody(dc)
|
|
|
|
local cur_dpen = self.text_pen
|
|
|
|
local cur_dpen = self.text_pen
|
|
|
|
local active_pen = current and cur_pen or cur_dpen
|
|
|
|
local active_pen = current and cur_pen or cur_dpen
|
|
|
|
|
|
|
|
|
|
|
|
if not self.active then
|
|
|
|
if not getval(self.active) then
|
|
|
|
cur_pen = self.inactive_pen or self.cursor_pen
|
|
|
|
cur_pen = self.inactive_pen or self.cursor_pen
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|