Mercurial > wow > inventory
diff Modules/Config.lua @ 205:0ea991d9093c
Config and Summary windows are now toggled rather than always shown.
author | Zerotorescue |
---|---|
date | Sat, 05 Feb 2011 19:36:35 +0100 |
parents | 90e5911a2ff1 |
children | 1959e2b3dfe1 |
line wrap: on
line diff
--- a/Modules/Config.lua Sat Feb 05 19:36:15 2011 +0100 +++ b/Modules/Config.lua Sat Feb 05 19:36:35 2011 +0100 @@ -1306,15 +1306,12 @@ function mod:OnEnable() -- Register our config slash command -- /im config - addon:RegisterSlash(function(this) - -- We don't want any other windows open at this time. - for name, module in this:IterateModules() do - if module.CloseFrame then - module:CloseFrame(); - end + addon:RegisterSlash(function() + if mod:IsFrameOpen() then + mod:CloseFrame(); + else + mod:Show(); end - - this:GetModule("Config"):Show(); end, { "c", "config", "conf", "option", "options", "opt", "setting", "settings" }, "|Hfunction:InventoriumCommandHandler:config|h|cff00fff7/im config|r|h (or /im c) - Open the config window to change the settings and manage groups."); self:Load(false); @@ -1330,6 +1327,27 @@ Widgets:ConfigItemLinkButton(); end +function mod:Show() + -- We don't want any other windows open at this time. + for name, module in addon:IterateModules() do + if module.CloseFrame then + module:CloseFrame(); + end + end + + self:Load(true); + + AceConfigDialog:Open("Inventorium"); +end + +function mod:IsFrameOpen() + return (AceConfigDialog.OpenFrames["Inventorium"] ~= nil); +end + +function mod:CloseFrame() + LibStub("AceConfigDialog-3.0"):Close("Inventorium"); +end + function mod:ExportGroup(groupName) -- We want to include the group name, so we copy the table then set another value local temp = CopyTable(addon.db.profile.groups[groupName]); @@ -1378,12 +1396,6 @@ end end -function mod:Show() - self:Load(true); - - AceConfigDialog:Open("Inventorium"); -end - function mod:FillOptions() options = { type = "group",