diff --git a/library/lua/gui/dwarfmode.lua b/library/lua/gui/dwarfmode.lua index 5f23053d8..27649bc6e 100644 --- a/library/lua/gui/dwarfmode.lua +++ b/library/lua/gui/dwarfmode.lua @@ -15,33 +15,30 @@ AREA_MAP_WIDTH = 23 MENU_WIDTH = 30 function getPanelLayout() - local sw, sh = dscreen.getWindowSize() - 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 dims = dfhack.gui.getDwarfmodeViewDims() local area_pos = df.global.ui_area_map_width local menu_pos = df.global.ui_menu_width - local rv = {} - if area_pos < 3 then - rv.area_map = gui.mkdims_xy(area_x2+1,1,view_rb-1,view_height) - view_rb = area_x2 + if dims.menu_forced then + menu_pos = area_pos - 1 end - if menu_pos < area_pos or df.global.ui.main.mode ~= 0 then - if menu_pos >= area_pos then - rv.menu_forced = true - menu_pos = area_pos-1 - end - local menu_x = menu_x2 - if menu_pos < 2 then menu_x = menu_x1 end - rv.menu = gui.mkdims_xy(menu_x+1,1,view_rb-1,view_height) - view_rb = menu_x + + 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 + end + if dims.menu_on then + rv.menu = gui.mkdims_xy(dims.menu_x1, dims.y1, dims.menu_x2, dims.y2) end - rv.area_pos = area_pos - rv.menu_pos = menu_pos - rv.map = gui.mkdims_xy(1,1,view_rb-1,view_height) + if dims.area_on then + rv.area_map = gui.mkdims_xy(dims.area_x1, dims.y1, dims.area_x2, dims.y2) + end + return rv end @@ -476,7 +473,7 @@ function WorkshopOverlay:render(dc) if is_slated_for_remove(self.workshop) then return end - + WorkshopOverlay.super.render(self, dc) end return _ENV