Fix issue #73
This commit is contained in:
parent
ac8d6891ca
commit
d1d8b79edc
|
@ -166,14 +166,7 @@ function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
|
||||||
self.movedIndex = nil
|
self.movedIndex = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local parent = self:getParent()
|
self:saveParent(self:getParent())
|
||||||
if parent then
|
|
||||||
if parent:getClassName() == 'UIMiniWindowContainer' then
|
|
||||||
parent:saveChildren()
|
|
||||||
else
|
|
||||||
self:saveParentPosition(parent:getId(), self:getPosition())
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIMiniWindow:onDragMove(mousePos, mouseMoved)
|
function UIMiniWindow:onDragMove(mousePos, mouseMoved)
|
||||||
|
@ -267,6 +260,17 @@ function UIMiniWindow:setSettings(data)
|
||||||
g_settings.setNode('MiniWindows', settings)
|
g_settings.setNode('MiniWindows', settings)
|
||||||
end
|
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)
|
function UIMiniWindow:saveParentPosition(parentId, position)
|
||||||
local selfSettings = {}
|
local selfSettings = {}
|
||||||
selfSettings.parentId = parentId
|
selfSettings.parentId = parentId
|
||||||
|
@ -286,6 +290,12 @@ function UIMiniWindow:disableResize()
|
||||||
self:getChildById('bottomResizeBorder'):disable()
|
self:getChildById('bottomResizeBorder'):disable()
|
||||||
end
|
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)
|
function UIMiniWindow:setContentMinimumHeight(height)
|
||||||
local contentsPanel = self:getChildById('contentsPanel')
|
local contentsPanel = self:getChildById('contentsPanel')
|
||||||
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() + contentsPanel:getPaddingBottom()
|
local minHeight = contentsPanel:getMarginTop() + contentsPanel:getMarginBottom() + contentsPanel:getPaddingTop() + contentsPanel:getPaddingBottom()
|
||||||
|
|
|
@ -93,6 +93,7 @@ function onContainerOpen(container, previousContainer)
|
||||||
local cellSize = layout:getCellSize()
|
local cellSize = layout:getCellSize()
|
||||||
containerWindow:setContentMinimumHeight(cellSize.height*1)
|
containerWindow:setContentMinimumHeight(cellSize.height*1)
|
||||||
containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())
|
containerWindow:setContentMaximumHeight(cellSize.height*layout:getNumLines())
|
||||||
|
containerWindow:setContentHeight(3*cellSize.height/2)
|
||||||
end
|
end
|
||||||
|
|
||||||
function onContainerClose(container)
|
function onContainerClose(container)
|
||||||
|
|
|
@ -486,6 +486,7 @@ function onLeftPanelVisibilityChange(leftPanel, visible)
|
||||||
local children = leftPanel:getChildren()
|
local children = leftPanel:getChildren()
|
||||||
for i=1,#children do
|
for i=1,#children do
|
||||||
children[i]:setParent(gameRightPanel)
|
children[i]:setParent(gameRightPanel)
|
||||||
|
children[i]:saveParent(gameRightPanel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -587,7 +587,7 @@ void Map::saveOtcm(const std::string& fileName)
|
||||||
fin->flush();
|
fin->flush();
|
||||||
|
|
||||||
fin->close();
|
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) {
|
} catch(stdext::exception& e) {
|
||||||
g_logger.error(stdext::format("failed to save OTCM map: %s", e.what()));
|
g_logger.error(stdext::format("failed to save OTCM map: %s", e.what()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue