Topmenu fix

* Will no longer duplicate topmenu buttons (no need to destroy in the module now)
* Menu items will no longer change position when reloaded.
master
BeniS 11 years ago
parent b34cc18f98
commit 35e5dd8af8

@ -136,17 +136,11 @@ function EnterGame.terminate()
removeEvent(autoLoginEvent) removeEvent(autoLoginEvent)
enterGame:destroy() enterGame:destroy()
enterGame = nil enterGame = nil
enterGameButton:destroy()
enterGameButton = nil
protocolBox = nil protocolBox = nil
if motdWindow then if motdWindow then
motdWindow:destroy() motdWindow:destroy()
motdWindow = nil motdWindow = nil
end end
if motdButton then
motdButton:destroy()
motdButton = nil
end
if loadBox then if loadBox then
loadBox:destroy() loadBox:destroy()
loadBox = nil loadBox = nil

@ -23,8 +23,6 @@ end
function terminate() function terminate()
moduleManagerWindow:destroy() moduleManagerWindow:destroy()
moduleManagerWindow = nil moduleManagerWindow = nil
moduleManagerButton:destroy()
moduleManagerButton = nil
moduleList = nil moduleList = nil
end end

@ -119,15 +119,11 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+Shift+F') g_keyboard.unbindKeyDown('Ctrl+Shift+F')
optionsWindow:destroy() optionsWindow:destroy()
optionsWindow = nil optionsWindow = nil
optionsButton:destroy()
optionsButton = nil
optionsTabBar = nil optionsTabBar = nil
generalPanel = nil generalPanel = nil
consolePanel = nil consolePanel = nil
graphicsPanel = nil graphicsPanel = nil
audioPanel = nil audioPanel = nil
audioButton:destroy()
audioButton = nil
end end
function toggle() function toggle()

@ -150,8 +150,6 @@ function terminate()
g_settings.setList('terminal-history', commandHistory) g_settings.setList('terminal-history', commandHistory)
g_keyboard.unbindKeyDown('Ctrl+T') g_keyboard.unbindKeyDown('Ctrl+T')
g_logger.setOnLog(nil) g_logger.setOnLog(nil)
terminalButton:destroy()
terminalButton = nil
commandTextEdit = nil commandTextEdit = nil
terminalBuffer = nil terminalBuffer = nil
terminalWindow:destroy() terminalWindow:destroy()

@ -14,11 +14,14 @@ local function addButton(id, description, icon, callback, panel, toggle, front)
class = 'TopButton' class = 'TopButton'
end end
local button = g_ui.createWidget(class) local button = panel:getChildById(id)
if front then if not button then
panel:insertChild(1, button) button = g_ui.createWidget(class)
else if front then
panel:addChild(button) panel:insertChild(1, button)
else
panel:addChild(button)
end
end end
button:setId(id) button:setId(id)
button:setTooltip(description) button:setTooltip(description)

@ -50,7 +50,6 @@ function terminate()
end end
fightModeRadioGroup:destroy() fightModeRadioGroup:destroy()
combatControlsButton:destroy()
combatControlsWindow:destroy() combatControlsWindow:destroy()
disconnect(g_game, { disconnect(g_game, {

@ -35,7 +35,6 @@ function terminate()
onSpellGroupCooldown = onSpellGroupCooldown, onSpellGroupCooldown = onSpellGroupCooldown,
onSpellCooldown = onSpellCooldown }) onSpellCooldown = onSpellCooldown })
cooldownButton:destroy()
cooldownWindow:destroy() cooldownWindow:destroy()
end end

@ -70,7 +70,6 @@ function terminate()
disconnect(g_game, { onGameEnd = offline }) disconnect(g_game, { onGameEnd = offline })
healthInfoWindow:destroy() healthInfoWindow:destroy()
healthInfoButton:destroy()
healthInfoWindow = nil healthInfoWindow = nil
healthInfoButton = nil healthInfoButton = nil

@ -88,7 +88,6 @@ function terminate()
unload() unload()
hotkeysWindow:destroy() hotkeysWindow:destroy()
hotkeysButton:destroy()
mouseGrabberWidget:destroy() mouseGrabberWidget:destroy()
end end

@ -123,7 +123,6 @@ function terminate()
disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange }) disconnect(gameLeftPanel, { onVisibilityChange = onLeftPanelVisibilityChange })
logoutButton:destroy()
gameRootPanel:destroy() gameRootPanel:destroy()
end end

@ -39,7 +39,6 @@ function terminate()
g_keyboard.unbindKeyDown('Ctrl+I') g_keyboard.unbindKeyDown('Ctrl+I')
inventoryWindow:destroy() inventoryWindow:destroy()
inventoryButton:destroy()
end end
function refresh() function refresh()

@ -48,7 +48,6 @@ function terminate()
g_keyboard.unbindKeyPress('Alt+Down', gameRootPanel) g_keyboard.unbindKeyPress('Alt+Down', gameRootPanel)
g_keyboard.unbindKeyDown('Ctrl+M') g_keyboard.unbindKeyDown('Ctrl+M')
minimapButton:destroy()
minimapWindow:destroy() minimapWindow:destroy()
end end

@ -17,9 +17,6 @@ function terminate()
onQuestLine = onGameQuestLine, onQuestLine = onGameQuestLine,
onGameEnd = destroyWindows}) onGameEnd = destroyWindows})
if questLogButton then
questLogButton:destroy()
end
destroyWindows() destroyWindows()
end end

@ -60,7 +60,6 @@ function terminate()
}) })
g_keyboard.unbindKeyDown('Ctrl+S') g_keyboard.unbindKeyDown('Ctrl+S')
skillsButton:destroy()
skillsWindow:destroy() skillsWindow:destroy()
end end

@ -172,8 +172,6 @@ function terminate()
updateSpellInformation(focusedChild) updateSpellInformation(focusedChild)
end }) end })
spelllistButton:destroy()
spelllistButton = nil
spelllistWindow:destroy() spelllistWindow:destroy()
spelllistWindow = nil spelllistWindow = nil

Loading…
Cancel
Save