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.
This commit is contained in:
BeniS 2013-02-01 14:47:15 +13:00
parent b34cc18f98
commit 35e5dd8af8
15 changed files with 8 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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()

View File

@ -14,12 +14,15 @@ 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 not button then
button = g_ui.createWidget(class)
if front then if front then
panel:insertChild(1, button) panel:insertChild(1, button)
else else
panel:addChild(button) panel:addChild(button)
end end
end
button:setId(id) button:setId(id)
button:setTooltip(description) button:setTooltip(description)
button:setIcon(resolvepath(icon, 3)) button:setIcon(resolvepath(icon, 3))

View File

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

View File

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

View File

@ -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

View File

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

View File

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

View File

@ -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()

View File

@ -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

View File

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

View File

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

View File

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