From d1d8b79edc7bc80c37a280fa302148319ed428b7 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Mon, 20 Aug 2012 19:50:18 -0300 Subject: [PATCH] Fix issue #73 --- modules/corelib/ui/uiminiwindow.lua | 26 ++++++++++++++++-------- modules/game_containers/containers.lua | 1 + modules/game_interface/gameinterface.lua | 1 + src/otclient/mapio.cpp | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/modules/corelib/ui/uiminiwindow.lua b/modules/corelib/ui/uiminiwindow.lua index d64c1b05..61591d83 100644 --- a/modules/corelib/ui/uiminiwindow.lua +++ b/modules/corelib/ui/uiminiwindow.lua @@ -166,14 +166,7 @@ function UIMiniWindow:onDragLeave(droppedWidget, mousePos) self.movedIndex = nil end - local parent = self:getParent() - if parent then - if parent:getClassName() == 'UIMiniWindowContainer' then - parent:saveChildren() - else - self:saveParentPosition(parent:getId(), self:getPosition()) - end - end + self:saveParent(self:getParent()) end function UIMiniWindow:onDragMove(mousePos, mouseMoved) @@ -267,6 +260,17 @@ function UIMiniWindow:setSettings(data) g_settings.setNode('MiniWindows', settings) end +function UIMiniWindow:saveParent(parent) + local parent = self:getParent() + if parent then + if parent:getClassName() == 'UIMiniWindowContainer' then + parent:saveChildren() + else + self:saveParentPosition(parent:getId(), self:getPosition()) + end + end +end + function UIMiniWindow:saveParentPosition(parentId, position) local selfSettings = {} selfSettings.parentId = parentId @@ -286,6 +290,12 @@ function UIMiniWindow:disableResize() self:getChildById('bottomResizeBorder'):disable() end +function UIMiniWindow:setContentHeight(height) + local contentsPanel = self:getChildById('contentsPanel') + local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() + contentsPanel:getPaddingBottom() + self:setHeight(minHeight + height) +end + function UIMiniWindow:setContentMinimumHeight(height) local contentsPanel = self:getChildById('contentsPanel') local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() + contentsPanel:getPaddingBottom() diff --git a/modules/game_containers/containers.lua b/modules/game_containers/containers.lua index e7dabd82..950a3458 100644 --- a/modules/game_containers/containers.lua +++ b/modules/game_containers/containers.lua @@ -93,6 +93,7 @@ function onContainerOpen(container, previousContainer) local cellSize = layout:getCellSize() containerWindow:setContentMinimumHeight(cellSize.height*1) containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines()) + containerWindow:setContentHeight(3*cellSize.height/2) end function onContainerClose(container) diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 7af75deb..e2fc546d 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -486,6 +486,7 @@ function onLeftPanelVisibilityChange(leftPanel, visible) local children = leftPanel:getChildren() for i=1,#children do children[i]:setParent(gameRightPanel) + children[i]:saveParent(gameRightPanel) end end end diff --git a/src/otclient/mapio.cpp b/src/otclient/mapio.cpp index 535ef047..48ab8937 100644 --- a/src/otclient/mapio.cpp +++ b/src/otclient/mapio.cpp @@ -587,7 +587,7 @@ void Map::saveOtcm(const std::string& fileName) fin->flush(); fin->close(); - g_logger.debug(stdext::format("Otcm save time: %.2f seconds", saveTimer.elapsed_seconds())); + //g_logger.debug(stdext::format("Otcm save time: %.2f seconds", saveTimer.elapsed_seconds())); } catch(stdext::exception& e) { g_logger.error(stdext::format("failed to save OTCM map: %s", e.what())); }