Compare with Previous | Blame | View Log
local RW = LibStub("AceAddon-3.0"):GetAddon("Raid Watch") local plugin = RW:Plugin("Options") ---------------------------- -- Locals local ACD = LibStub("AceConfigDialog-3.0") local LoD = RW:GetPlugin("LoD") local AceGUI = LibStub("AceGUI-3.0") local L = LibStub("AceLocale-3.0"):GetLocale("RW2-Options") local LB = LibStub("AceLocale-3.0"):GetLocale("RW2-Plugin-Base") local LSM = LibStub("LibSharedMedia-3.0") local UIF = LibStub("LibGUIFactory-1.0"):GetFactory("RW") local LBB UIF:SetValuesChangedCallback(function() RW.Callbacks:Fire("RefreshOptions") end) local Utils = RW.Utils local OptionsFrame local DetailsFrame local OptionsTree local AceOptionData = {} local GUIOptionsData = {} local GUIBossMods = {} local GUIBossSubGroups = {} local defaults = { profile = { VersionSort = "name", TestOpt = true, Color = {1, 0, 0, 1}, WindowButtonSize = 20, WindowTitleColor = {0/255, 79/255, 173/255, 1}, WindowFont = "accid", WindowFontSize = 18, WindowFontFlags = "NONE", WindowFontColor = {1, 1, 1, 1}, } } ---------------------------- -- Init function plugin:OnRegister() self.db = RW.db:RegisterNamespace("Options", defaults) self.BossOptions = {BossMods = {}} self.PluginOptions = {Plugins = {}} self.db.RegisterCallback(self, "OnProfileChanged", "Reset") self.db.RegisterCallback(self, "OnProfileCopied", "Reset") self.db.RegisterCallback(self, "OnProfileReset", "Reset") self:RegisterCallback("RefreshOptions") self.options = { type = "group", name = "Raid Watch 2", handler = self, args = { } } end function plugin:PluginEnable() LBB = RW.LBB self.NextConfigMode = true LibStub("AceConfig-3.0"):RegisterOptionsTable("RW", self.options) self:RegisterCallback("BossModLoaded") end function plugin:PluginDisable() end function plugin:Reset() Utils:ApplyWindowSettings() end function plugin:ToggleConfigMode() RW.Callbacks:Fire("ConfigMode", self.NextConfigMode) self.NextConfigMode = not self.NextConfigMode end ---------------------- -- Message handlers -- ---------------------- function plugin:BossModLoaded(message, modName) GUIBossMods[Utils:GetIndexForvalue(GUIBossMods, modName)] = nil plugin:InsertBossOptions(modName) RW.Callbacks:Fire("RefreshOptions") end ---------------------- do local treeSelectPath = {} local treeStatusTable = {} local treeLastSelected local bossList = {} local bossListLastSelected = {} local bossHeaders = {} local addedOptions = {} ------------------------------ -- Option Details local function showDetailTab(tabs, event, group) tabs:ReleaseChildren() local baseObj = tabs:GetUserData("baseObj") local scroll = AceGUI:Create("ScrollFrame") scroll:SetLayout("Flow") local added = false for i, obj in pairs(baseObj.mod.AlertObjects[group]) do if obj.base == baseObj then added = true scroll:AddChildren(obj:GetOption()) end end tabs:AddChild(scroll) end -- Returns the tabs for the details about the selected option local tabs = {} local function getOptionTabs(baseObj) wipe(tabs) for i, data in pairs(baseObj.mod.AlertObjects) do local c = false for _, obj in pairs(data) do if obj.base == baseObj then c = true break end end if c then tinsert(tabs, {value = i, text = LB[i]}) end end return tabs end local function showHideDetails(baseObj) if DetailsFrame then DetailsFrame:Release() DetailsFrame = nil end local optText = type(baseObj.id) == "number" and Utils.SpellName[baseObj.id] or baseObj.id DetailsFrame = UIF:Frame(optText) DetailsFrame:SetLayout("Fill") DetailsFrame.frame:ClearAllPoints() if OptionsFrame then DetailsFrame.frame:SetPoint("LEFT", OptionsFrame.frame, "RIGHT", 5, 0) DetailsFrame.frame:SetFrameLevel(OptionsFrame.frame:GetFrameLevel() + 1) else DetailsFrame.frame:SetPoint("CENTER") DetailsFrame.frame:SetFrameLevel(50) end DetailsFrame:SetWidth(500) DetailsFrame:SetHeight(450) DetailsFrame:SetCallback("OnClose", function(widget) widget:ReleaseChildren() widget:Release() DetailsFrame = nil end) local t = getOptionTabs(baseObj) local tab = UIF:TabGroup() tab:SetLayout("Fill") tab:SetTabs(t) tab:SetUserData("baseObj", baseObj) tab:SetCallback("OnGroupSelected", showDetailTab) tab:SelectTab(t[1] and t[1].value or nil) tab:SetCallback("OnTabEnter", function(widget, event, key, tab) GameTooltip:SetOwner(widget.frame) GameTooltip:AddLine(LB[key]) GameTooltip:AddLine(LB[key.."_DESC"]) GameTooltip:Show() end) tab:SetCallback("OnTabLeave", function() GameTooltip:Hide() end) DetailsFrame:AddChild(tab) DetailsFrame:Show() end ------------------------------ -- Boss Detials local function getMasterValue(baseObj) if baseObj.type == "bool" then return baseObj.mod.DB[baseObj.var] else return baseObj.mod.DB[baseObj.id].enabled end end local function toggleMaster(check, event, value) local baseObj = check:GetUserData("baseObj") if baseObj.type == "bool" then baseObj.mod.DB[baseObj.var] = not baseObj.mod.DB[baseObj.var] else baseObj.mod.DB[baseObj.id].enabled = not baseObj.mod.DB[baseObj.id].enabled end if DetailsFrame then showHideDetails(baseObj) end end local function GetOptionGroup(opt, boss) local baseObj = boss:GetBaseAlertObject(opt) --[===[@debug@ if not baseObj then --error(("%s: No option connected to %q"):format(boss:GetName(), opt)) end --@end-debug@]===] local optText = (baseObj and baseObj.displayText) or (type(opt) == "number" and Utils.SpellName[opt] or opt) local group = AceGUI:Create("SimpleGroup") -- UIF:InlineGroup2() -- group:SetLayout("Flow") group:SetFullWidth(true) --group:SetRelativeWidth(0.5) --group:SetAutoAdjustHeight(false) --group:SetHeight(80) if baseObj then local check = AceGUI:Create("CheckBox") check:SetLabel("") check:SetUserData("baseObj", baseObj) check:SetValue(getMasterValue(baseObj)) check:SetCallback("OnValueChanged", toggleMaster) check:SetRelativeWidth(0.08) group:AddChild(check) local label = UIF:NormalText("", nil, nil, nil, nil, true) label:SetImage(baseObj.icon, 0.08, 0.92, 0.08, 0.92) label:SetImageSize(25, 25) label:SetFullWidth(false) label:SetRelativeWidth(0.12) label:SetUserData("baseObj", baseObj) if baseObj.type ~= "bool" then label:SetCallback("OnClick", function(self, event, button) local baseObj = self:GetUserData("baseObj") if not baseObj.spell then return end local spell = baseObj.spell if button == "LeftButton" then if IsShiftKeyDown() then local ChatEdit = ChatEdit_GetActiveWindow() if not ChatEdit then ChatEdit = ChatEdit_GetLastActiveWindow() end if not ChatEdit then ChatEdit = ChatFrame1EditBox end ChatEdit:Show() ChatEdit_FocusActiveWindow() ChatEdit:Insert("\124cff71d5ff\124Hspell:"..spell.."\124h["..Utils.SpellName[spell].."]\124h\124r") end end end) end if baseObj.spell then label:SetCallback("OnEnter", function(self) GameTooltip:SetOwner(self.frame) GameTooltip:SetHyperlink("spell:"..baseObj.spell) GameTooltip:AddLine(" ") GameTooltip:AddLine("["..L.SHIFT_CLICK_LINK_DESC.."]") GameTooltip:Show() end) label:SetCallback("OnLeave", function() GameTooltip:Hide() end) end group:AddChild(label) label = UIF:NormalText(optText) label:SetFullWidth(false) label:SetRelativeWidth(0.29) group:AddChild(label) local iconGroup = AceGUI:Create("SimpleGroup") iconGroup:SetLayout("Flow") iconGroup:SetFullWidth(false) iconGroup:SetRelativeWidth(0.3) group:AddChild(iconGroup) local iconObj = boss:GetIconObject(opt) if iconObj then for i,icn in ipairs(iconObj.orderedMarks) do local icon = AceGUI:Create("Icon") icon:SetImage("Interface\\TargetingFrame\\UI-RaidTargetingIcons.blp", unpack(Utils.Constants.IconCoords[icn])) icon:SetImageSize(18, 18) icon:SetHeight(20) icon:SetWidth(25) iconGroup:AddChild(icon) end end local c = false for _, objType in pairs(baseObj.mod.AlertObjects) do for _, obj in pairs(objType) do if obj.base == baseObj then c = true break end end if c then break end end if c then local button = UIF:Button("Details", function(widget, event) local baseObj = widget:GetUserData("baseObj") showHideDetails(baseObj) end) button:SetRelativeWidth(0.2) button:SetUserData("baseObj", baseObj) group:AddChild(button) end end return group end local sortCat = {} function plugin.SelectBoss(drop, event, group) local boss if drop.ReleaseChildren then drop:ReleaseChildren() boss = drop:GetUserData("bosses")[group] bossListLastSelected[drop:GetUserData("bosses")] = group drop:SetUserData("boss", boss) else boss = RW:GetBoss(drop:GetName()) if not OptionsFrame then OptionsFrame = event end end local scroll = AceGUI:Create("ScrollFrame") if drop.ReleaseChildren then drop:AddChild(scroll) end local sgroup = UIF:InlineGroup(" ") scroll:AddChild(sgroup) --[===[@debug@ if not LBB[boss:GetName()] then print("Could not find in Babble-Boss", boss:GetName()) end --@end-debug@]===] local label = UIF:MainTitleLabel(LBB[boss:GetName()] or boss:GetName()) label:SetImage(boss.BossIcon) sgroup:AddChild(label) if rawget(boss.L, "info") then label = UIF:NormalText(rawget(boss.L, "info")) sgroup:AddChild(label) end local enableCheck = UIF:CheckBox(LB.ENABLED, boss.db.profile, "enabled") enableCheck:SetFullWidth(false) enableCheck:SetHeight(35) sgroup:AddChild(enableCheck) local check = UIF:CheckBox(L.SORT_OPTIONS, boss.db.profile, "SortBossCategories") check:SetFullWidth(false) check:SetUserData("TriggerGlobalUpdate", true) sgroup:AddChild(check) if not boss.SupressGlobalHealthFrames then check = UIF:CheckBox(L.SHOW_BOSS_HEALTHFRAMES, boss.db.profile, "AutoHealthFrames") check:SetFullWidth(false) sgroup:AddChild(check) end if boss.Options then -- Build options titles if boss.Options.Categories then for i, cat in pairs(boss.Options.Categories) do local group = UIF:InlineGroup(cat.text) group:SetLayout("Flow") scroll:AddChild(group) label = UIF:NormalText(LB.ENABLED, nil, nil, nil, "OUTLINE") label:SetRelativeWidth(0.1) group:AddChild(label) label = UIF:NormalText(LB.ICON, nil, nil, nil, "OUTLINE") label:SetRelativeWidth(0.1) group:AddChild(label) label = UIF:NormalText(LB.NAME, nil, nil, nil, "OUTLINE") label:SetRelativeWidth(0.29) group:AddChild(label) label = UIF:NormalText(LB.RAID_ICON, nil, nil, nil, "OUTLINE") label:SetRelativeWidth(0.3) group:AddChild(label) label = UIF:NormalText(L.DETAILS, nil, nil, nil, "OUTLINE") label:SetRelativeWidth(0.2) group:AddChild(label) wipe(sortCat) for j, opt in pairs(cat) do tinsert(sortCat, opt) end if boss.db.profile.SortBossCategories then table.sort(sortCat, function(a, b) local sa, sb = a, b if type(sa) == "number" then sa = Utils.SpellName[sa] end if type(sb) == "number" then sb = Utils.SpellName[sb] end return a < b end) end for j, opt in ipairs(sortCat) do local optGroup = GetOptionGroup(opt, boss) if optGroup then group:AddChildren(optGroup) end end wipe(sortCat) end end end scroll:FixScroll() if not drop.ReleaseChildren then return scroll end end ------------------------------ -- Boss Selection local function selectTreeOption(tree, event, group) treeLastSelected = group tree:ReleaseChildren() tree:PauseLayout() if AceOptionData[group] then local subGroups for _, child in pairs(AceOptionData[group].args) do if child.type == "group" and not child.guiInline then subGroups = true break end end if subGroups then addFrame = AceGUI:Create("SimpleGroup") addFrame:SetLayout("Fill") addFrame.width = "fill" addFrame.height = "fill" ACD:Open("RW", addFrame, string.split("\001", group)) tree:AddChild(addFrame) else local scroll = AceGUI:Create("ScrollFrame") scroll:SetLayout("flow") scroll.width = "fill" scroll.height = "fill" local addFrame = AceGUI:Create("SimpleGroup") addFrame:SetLayout("Fill") addFrame.width = "fill" addFrame.height = "fill" ACD:Open("RW", addFrame, string.split("\001", group)) scroll:AddChild(addFrame) tree:AddChild(scroll) end elseif GUIOptionsData[group] then tree:AddChildren(GUIOptionsData[group]()) elseif GUIBossMods[group] then if type(GUIBossMods[group]) == "table" then local nameList for i, boss in pairs(GUIBossMods[group]) do nameList = nameList or {} nameList[i] = {value=i, text=(LBB[boss:GetName()] or boss:GetName()), icon = boss.BossIcon} end local dropdown = UIF:DropdownGroup("test") dropdown:SetDropdownWidth(300) dropdown:SetLayout("Fill") dropdown:SetUserData("bosses", GUIBossMods[group]) dropdown:SetFullHeight(true) dropdown:SetGroupList(nameList) dropdown:SetCallback("OnGroupSelected", plugin.SelectBoss) if bossListLastSelected[GUIBossMods[group]] and nameList[bossListLastSelected[GUIBossMods[group]]] then dropdown:SetGroup(bossListLastSelected[GUIBossMods[group]]) else dropdown:SetGroup(1) end tree:AddChild(dropdown) else local modID = GUIBossMods[group] local sgroup = AceGUI:Create("SimpleGroup") sgroup:SetLayout("Flow") local button = UIF:Button(LB.LOAD.." "..modID, function(widget, event) RWL:LoadByName(widget:GetUserData("modID")) end) button:SetUserData("modID", modID) sgroup:AddChild(button) tree:AddChild(sgroup) end elseif GUIBossSubGroups[group] then local sgroup = AceGUI:Create("ScrollFrame") sgroup:SetLayout("Flow") tree:AddChild(sgroup) for i, data in pairs(GUIBossSubGroups[group]) do local label = UIF:MainTitleLabel(data.name, nil, nil, nil, nil, true) label:SetCallback("OnClick", function(widget) OptionsTree:SetSelected(data.id) end) label:SetImage(data.icon) sgroup:AddChild(label) end sgroup:FixScroll() else --print(string.split("\001", group)) end tree:ResumeLayout() tree:DoLayout() end ----------------------------- -- Main window function plugin:Toggle() if OptionsFrame then OptionsFrame:Release() OptionsFrame = nil else OptionsFrame = UIF:Frame("Raid Watch 2") OptionsFrame:SetLayout("Flow") OptionsFrame:SetWidth(810) OptionsFrame:SetHeight(620) OptionsFrame:SetCallback("OnClose", function(widget) widget:ReleaseChildren() widget:Release() if DetailsFrame then DetailsFrame:Release() DetailsFrame = nil end OptionsFrame = nil end) OptionsFrame.statustext:SetText(" v"..RWVERSION.." (r"..RWREVISION.. ") "..RWRELEASETPYE) OptionsTree = UIF:TreeGroup() OptionsTree:SetFullHeight(true) OptionsTree:SetFullWidth(true) OptionsTree:SetLayout("Fill") OptionsTree:SetFullHeight(true) OptionsTree:SetTree(self:BuildOptionsTree()) OptionsTree:SetCallback("OnGroupSelected", selectTreeOption) OptionsTree:SetSelected(treeLastSelected or "0Main") OptionsTree:SetStatusTable(treeStatusTable) OptionsFrame:AddChild(OptionsTree) OptionsFrame:Show() AceGUI:ClearFocus() end end function plugin:RefreshOptions(event) if OptionsFrame then OptionsTree:SetTree(self:BuildOptionsTree()) local last = treeLastSelected OptionsTree:SetSelected("0Main") OptionsTree:SetSelected(last or "0Main") end end end do local Tree local catIcons2 = { [LB.ALERT_PLUGINS] = [[Interface\Icons\INV_Sigil_UlduarAll]], [LB.BOSS_PLUGINS] = [[Interface\Icons\Ability_Druid_ForceofNature]], } local predefinedOrders = { [LB.PLUGINS] = 3 } local function BuildAceOptions(data, insertPoint, ...) local nextOpt = ... --if not nextOpt then return insertPoint end if select(2, ...) then insertPoint[nextOpt] = insertPoint[nextOpt] or { type = "group", name = nextOpt, args = {}, } BuildAceOptions(data, insertPoint[nextOpt].args, select(2, ...)) else insertPoint[nextOpt] = data end end function plugin:BuildPluginOptions(insertPoint, module) local optionID local ordered local order for i, data in pairs(module) do insertPoint.children = insertPoint.children or {} if type(data) == "number" and not ordered then order = data ordered = true end if type(data) == "string" then if not Utils:InTable2(insertPoint.children, "text", data) then local newCat = {text = data, value = data, icon = catIcons2[data]} tinsert(insertPoint.children, newCat) if order then newCat.value = order..newCat.value order = nil end if predefinedOrders[data] then newCat.value = predefinedOrders[data]..newCat.value end table.sort(insertPoint.children or insertPoint, function(a, b) return a.value < b.value end) insertPoint = newCat optionID = (optionID and optionID.."\001" or "")..newCat.value else local id = data if order then id = order..id order = nil end if predefinedOrders[data] then id = predefinedOrders[data]..id end optionID = (optionID and optionID.."\001" or "")..id insertPoint = Utils:GetTableData(insertPoint.children, "text", data) end end if type(data) == "table" then insertPoint.icon = insertPoint.icon or data.icon if #insertPoint.children == 0 then insertPoint.children = nil end AceOptionData[optionID] = data BuildAceOptions(data, self.options.args, string.split("\001", optionID)) end if type(data) == "function" then if #insertPoint.children == 0 then insertPoint.children = nil end insertPoint.icon = insertPoint.icon or module[i + 1] GUIOptionsData[optionID] = data table.sort(insertPoint.children or insertPoint, function(a, b) return a.value < b.value end) break end table.sort(insertPoint.children or insertPoint, function(a, b) return a.value < b.value end) end end local function BuildBossModOptions(insertPoint, modName) local optionID = "1Boss Mods\001"..modName local newCat -- Is this boss mod allready in? Else create it. if not Utils:InTable2(insertPoint, "text", modName) then local modInfo = RWL:GetModInfo(modName) newCat = {value = modName, text = modName, icon = modInfo and modInfo.icon or nil} tinsert(insertPoint, newCat) -- Else fetch is as insert point else newCat = Utils:GetTableData(insertPoint, "text", modName) end local modLoaded = false for i, boss in RW:IterateBossesByPack(modName) do modLoaded = true newCat.icon = newCat.icon or boss.PackIcon if boss.subGroup then newCat.children = newCat.children or {} if not Utils:InTable2(newCat.children, "text", boss.subGroup) then local child = {value = boss.subGroup, text = boss.subGroup, icon = boss.SubCatIcon} tinsert(newCat.children, child) GUIBossSubGroups[optionID] = GUIBossSubGroups[optionID] or {} tinsert(GUIBossSubGroups[optionID], {name = boss.subGroup, icon = boss.SubCatIcon, id = optionID.."\001"..boss.subGroup}) end local oldID = optionID optionID = optionID.."\001"..boss.subGroup GUIBossMods[optionID] = GUIBossMods[optionID] or {} tinsert(GUIBossMods[optionID] , boss) optionID = oldID else GUIBossMods[optionID] = GUIBossMods[optionID] or {} tinsert(GUIBossMods[optionID] , boss) end end if not modLoaded then GUIBossMods[optionID] = modName end end function plugin:BuildOptionsTree(rebuild) if not Tree then Tree = {} for _, module in RW:IteratePlugins() do if module.GetOptions then local mOpts = {module:GetOptions()} if type(mOpts[1]) == "table" then for i, opts in pairs(mOpts[1]) do self:BuildPluginOptions(Tree, opts) end else self:BuildPluginOptions(Tree, mOpts) end end end Tree.children = Tree.children or {} local BossModGroup -- Is the main Boss Mods group created? Create it if not if not Utils:InTable2(Tree.children, "text", "Boss Mods") then BossModGroup = {value = "1Boss Mods", text = "Boss Mods"} tinsert(Tree.children, BossModGroup) -- Else fetch it else BossModGroup = Utils:GetTableData(Tree.children, "text", "Boss Mods") end BossModGroup.children = {} for modName in RW:IterateBossPacks() do BuildBossModOptions(BossModGroup.children, modName) end for modName in RWL:IterateBossMods() do BuildBossModOptions(BossModGroup.children, modName) end end table.sort(Tree.children, function(a, b) return a.value < b.value end) return Tree.children end function plugin:InsertBossOptions(modName) local bossTree = Utils:GetTableData(Tree.children, "text", "Boss Mods") local modTree = Utils:GetTableData(bossTree.children, "text", modName) BuildBossModOptions(bossTree.children, modName) end end -- GUI function plugin:GetOptions() return { {0, "Main", self.GetGUI1}, {LB.PLUGINS, self.GetGUI2}, {8, "Profiles", function() return UIF:AceProfileOption(RW.db) end}, {LB.PLUGINS, LB.ALERT_PLUGINS, self.GetAlertDesc}, {LB.PLUGINS, LB.BOSS_PLUGINS, self.GetBossDesc}, } end function plugin:GetGUI1() local self = self or plugin local group, button, label group = AceGUI:Create("ScrollFrame") group:SetLayout("Flow") group:PauseLayout() group:AddChild(UIF:Title1("Raid Watch 2")) igroup = UIF:InlineGroup("") group:AddChild(igroup) igroup:AddChild(UIF:NormalText(L.WELCOME_MESSAGE, nil, nil, nil, nil, nil, 0.8)) label = UIF:ListText(" ") igroup:AddChild(label) igroup:AddChild(UIF:Title2(L.FEATURES)) igroup:AddChild(UIF:ListText(L.FEATURE_LIST, nil, nil, nil, nil, nil, 1)) igroup:AddChild(UIF:Title2(L.HOW_TO_CONFIG)) igroup:AddChild(UIF:NormalText(L.HOW_TO_CONFIG_DESC, nil, nil, nil, nil, nil, 0.8)) button = UIF:Button(L.TO_PLUGINS, function() OptionsTree:SetSelected("3"..LB.PLUGINS) end) button:SetFullWidth(false) button:SetWidth(200) igroup:AddChild(button) button = UIF:Button(L.TOGGLE_CONFIG_MODE, function() RW.Callbacks:Fire("ConfigMode", self.NextConfigMode) plugin.NextConfigMode = not plugin.NextConfigMode end) group:AddChild(button) igroup:AddChild(UIF:CheckBox(L.HIDE_MINIMAP_ICON, RW.db.profile.minimap, "hide", function() if RW.db.profile.minimap.hide then LibStub("LibDBIcon-1.0"):Hide("RW2") else LibStub("LibDBIcon-1.0"):Show("RW2") end end)) group:ResumeLayout() group:DoLayout() group:FixScroll() return group end function plugin:GetGUI2() local self = self or plugin rdb = RW.db.profile local group, button, label, check local function WindowCallback() Utils:ApplyWindowSettings() end group = AceGUI:Create("ScrollFrame") group:SetLayout("Flow") button = UIF:Button(L.TOGGLE_CONFIG_MODE, function() RW.Callbacks:Fire("ConfigMode", self.NextConfigMode) plugin.NextConfigMode = not plugin.NextConfigMode end) group:AddChild(button) group:AddChild(UIF:CheckBox(L.GLOBAL_BOSS_HEALTH_FRAMES, rdb, "GlobalBossHealthFrames", nil, L.GLOBAL_BOSS_HEALTH_FRAME_DESC)) group:AddChild(UIF:CheckBox(L.USE_CLEAN_MESSAGES, rdb, "UseCleanMessages", nil, L.USE_CLEAN_MESSAGES_DESC)) local ig = UIF:InlineGroup1(L.WINDOW_SETTINGS) group:AddChild(ig) ig:AddChild(UIF:Text1(L.WINDOW_SETTINGS_DESC, nil, nil, nil, nil, nil, 0.6)) ig:AddChild(UIF:NewLine(10)) local ig2 = UIF:InlineGroup2(L.TITLE) ig:AddChild(ig2) ig2:AddChild(UIF:CheckBox(L.GRADIENT, rdb, "WindowUseGradient", WindowCallback, L.GRADIENT_DESC, 0.33)) ig2:AddChild(UIF:Spacer(20)) ig2:AddChild(UIF:ColorSelect(LB.COLOR, rdb, "WindowTitleColor", WindowCallback, true, 0.20)) ig2:AddChild(UIF:Slider(LB.HEIGHT, rdb, "WindowTitleHeight", 5, 200, 1, WindowCallback, 0.33)) ig2:AddChild(UIF:LSMDropdown("font", LB.FONT, rdb, "WindowFont", WindowCallback, 0.4)) ig2:AddChild(UIF:Spacer(20)) ig2:AddChild(UIF:Dropdown(LB.FONT_OUTLINE, rdb, "WindowFontFlags", WindowCallback, Utils.Constants.FontFlagList, 0.4)) ig2:AddChild(UIF:Slider(LB.FONT_SIZE, rdb, "WindowFontSize", 1, 50, 1, WindowCallback, 0.4)) ig2:AddChild(UIF:Spacer(20)) ig2:AddChild(UIF:ColorSelect(LB.FONT_COLOR, rdb, "WindowFontColor", WindowCallback, nil, 0.4)) local ig2 = UIF:InlineGroup2(L.BUTTONS) ig:AddChild(ig2) ig2:AddChild(UIF:ColorSelect("Button color", rdb, "WindowButtonColor", WindowCallback, true)) ig2:AddChild(UIF:Slider("Button size", rdb, "WindowButtonSize", 5, 100, 1, WindowCallback)) return group end function plugin:GetAlertDesc() local self = self or plugin local group, button, label group = AceGUI:Create("ScrollFrame") group:SetLayout("Flow") label = UIF:NormalText(LB.ALERT_PLUGINS_DESC) label:SetImage([[Interface\Icons\INV_Sigil_UlduarAll]]) group:AddChild(label) return group end function plugin:GetBossDesc() local self = self or plugin local group, button, label group = AceGUI:Create("ScrollFrame") group:SetLayout("Flow") label = UIF:NormalText(LB.BOSS_PLUGINS_DESC) label:SetImage([[Interface\Icons\Ability_Druid_ForceofNature]]) group:AddChild(label) return group end -------------------------- -- Option helpers plugin.OptionHelpers = {} function plugin.OptionHelpers.OnOptionEnter(self, event) local obj = self:GetUserData("obj") GameTooltip:SetOwner(self.frame) GameTooltip:AddLine(LB[obj.mainType.."_"..obj.type]) GameTooltip:AddLine(LB[obj.mainType.."_"..obj.type.."_DESC"]:format(obj.base.id)) GameTooltip:Show() end function plugin.OptionHelpers.OnOptionLeave(self, event) GameTooltip:Hide() end function plugin.OptionHelpers.OnColorSelected(self, event, r, g, b, a) local obj = self:GetUserData("obj") local db = obj.base.mod.DB db[obj.base.id][obj.mainType][obj.optText or obj.type].color = {r, g, b, a} end function plugin.OptionHelpers.OnValueChanged(self, event, value) local obj = self:GetUserData("obj") local db = obj.base.mod.DB db[obj.base.id][obj.mainType][obj.optText or obj.type].enabled = value end function plugin.OptionHelpers.OnKeyValueChanged(self, event, value) local obj, key = self:GetUserData("obj"), self:GetUserData("key") local db = obj.base.mod.DB db[obj.base.id][obj.mainType][obj.optText or obj.type][key] = value end