Compare with Previous | Blame | View Log
-- Map of Azeroth -- Copyright 2010 -- BINDINGs labels BINDING_HEADER_MAPOFAZEROTH ="Map of Azeroth" BINDING_NAME_MARKER_TOGGLE ="Toggle Markers" BINDING_NAME_OPTION_TOGGLE ="Toggle Options" -- local gui = LibStub("AceGUI-3.0") local reg = LibStub("AceConfigRegistry-3.0") local dialog = LibStub("AceConfigDialog-3.0") MapofAzeroth = LibStub("AceAddon-3.0"):NewAddon("MapofAzeroth", "AceConsole-3.0") local Ace3 = MapofAzeroth local selectedgroup local frame local select local status = {} local configs = {} local function frameOnClose() gui:Release(frame) frame = nil end local function RefreshConfigs() for name in reg:IterateOptionsTables() do configs[name] = name end end local function ConfigSelected(widget, event, value) selectedgroup = value dialog:Open(value, widget) end local old_CloseSpecialWindows function Ace3:Open() if not old_CloseSpecialWindows then old_CloseSpecialWindows = CloseSpecialWindows CloseSpecialWindows = function() local found = old_CloseSpecialWindows() if frame then frame:Hide() return true end return found end end RefreshConfigs() if next(configs) == nil then self:Print("No Configs are Registered") return end if not frame then frame = gui:Create("Frame") frame:ReleaseChildren() frame:SetTitle("Ace3 Options") frame:SetLayout("FILL") frame:SetCallback("OnClose", frameOnClose) select = gui:Create("DropdownGroup") select:SetGroupList(configs) select:SetCallback("OnGroupSelected", ConfigSelected) frame:AddChild(select) end if not selectedgroup then selectedgroup = next(configs) end select:SetGroup(selectedgroup) frame:Show() end local function RefreshOnUpdate(this) select:SetGroup(selectedgroup) this:SetScript("OnUpdate", nil) end function Ace3:ConfigTableChanged(event, appName) if selectedgroup == appName and frame then frame.frame:SetScript("OnUpdate", RefreshOnUpdate) end end reg.RegisterCallback(Ace3, "ConfigTableChange", "ConfigTableChanged") function Ace3:PrintCmd(input) input = input:trim():match("^(.-);*$") local func, err = loadstring("LibStub(\"AceConsole-3.0\"):Print(" .. input .. ")") if not func then LibStub("AceConsole-3.0"):Print("Error: " .. err) else func() end end function Ace3:OnInitialize() self:RegisterChatCommand("ace3", function() self:Open() end) self:RegisterChatCommand("rl", function() ReloadUI() end) self:RegisterChatCommand("print", "PrintCmd") end