Use getDwarfmodeViewDims() in getPanelLayout()

Allows C++ hooks to affect Lua scripts as well
develop
lethosor 2017-06-01 23:36:02 -04:00
parent 05f322ca30
commit 346e8b91a9
1 changed files with 20 additions and 23 deletions

@ -15,33 +15,30 @@ AREA_MAP_WIDTH = 23
MENU_WIDTH = 30 MENU_WIDTH = 30
function getPanelLayout() function getPanelLayout()
local sw, sh = dscreen.getWindowSize() local dims = dfhack.gui.getDwarfmodeViewDims()
local view_height = sh-2
local view_rb = sw-1
local area_x2 = sw-AREA_MAP_WIDTH-2
local menu_x2 = sw-MENU_WIDTH-2
local menu_x1 = area_x2-MENU_WIDTH-1
local area_pos = df.global.ui_area_map_width local area_pos = df.global.ui_area_map_width
local menu_pos = df.global.ui_menu_width local menu_pos = df.global.ui_menu_width
local rv = {}
if area_pos < 3 then if dims.menu_forced then
rv.area_map = gui.mkdims_xy(area_x2+1,1,view_rb-1,view_height) menu_pos = area_pos - 1
view_rb = area_x2
end end
if menu_pos < area_pos or df.global.ui.main.mode ~= 0 then
if menu_pos >= area_pos then local rv = {
menu_pos = menu_pos,
area_pos = area_pos,
map = gui.mkdims_xy(dims.map_x1, dims.map_y1, dims.map_x2, dims.map_y2),
}
if dims.menu_forced then
rv.menu_forced = true rv.menu_forced = true
menu_pos = area_pos-1
end end
local menu_x = menu_x2 if dims.menu_on then
if menu_pos < 2 then menu_x = menu_x1 end rv.menu = gui.mkdims_xy(dims.menu_x1, dims.y1, dims.menu_x2, dims.y2)
rv.menu = gui.mkdims_xy(menu_x+1,1,view_rb-1,view_height)
view_rb = menu_x
end end
rv.area_pos = area_pos if dims.area_on then
rv.menu_pos = menu_pos rv.area_map = gui.mkdims_xy(dims.area_x1, dims.y1, dims.area_x2, dims.y2)
rv.map = gui.mkdims_xy(1,1,view_rb-1,view_height) end
return rv return rv
end end