Omen now generates the config tables on demand. Omen now provides better error feedback if AceGUI-3.0-SharedMediaWidgets is not found and will continue to function (but without any config).
This commit is contained in:
@@ -191,6 +191,7 @@ local bars = {} -- Format: bars[i] = frame containing the i-th bar f
|
|||||||
local inRaid, inParty -- boolean variables indicating if the player is in a raid and/or party
|
local inRaid, inParty -- boolean variables indicating if the player is in a raid and/or party
|
||||||
local testMode = false -- boolean: Are we in test mode?
|
local testMode = false -- boolean: Are we in test mode?
|
||||||
local manualToggle = false -- boolean: Did we manually toggle Omen?
|
local manualToggle = false -- boolean: Did we manually toggle Omen?
|
||||||
|
local moduleOptions = {} -- Table for LoD module options registration
|
||||||
|
|
||||||
Omen.GuidNameLookup = guidNameLookup
|
Omen.GuidNameLookup = guidNameLookup
|
||||||
Omen.GuidClassLookup = guidClassLookup
|
Omen.GuidClassLookup = guidClassLookup
|
||||||
@@ -220,6 +221,20 @@ for i = 1, 40 do
|
|||||||
rpID[i] = format("raidpet%d", i)
|
rpID[i] = format("raidpet%d", i)
|
||||||
rptID[i] = format("raidpet%dtarget", i)
|
rptID[i] = format("raidpet%dtarget", i)
|
||||||
end
|
end
|
||||||
|
local showClassesOptionTable = {
|
||||||
|
DEATHKNIGHT = L["DEATHKNIGHT"],
|
||||||
|
DRUID = L["DRUID"],
|
||||||
|
HUNTER = L["HUNTER"],
|
||||||
|
MAGE = L["MAGE"],
|
||||||
|
PALADIN = L["PALADIN"],
|
||||||
|
PET = L["PET"],
|
||||||
|
PRIEST = L["PRIEST"],
|
||||||
|
ROGUE = L["ROGUE"],
|
||||||
|
SHAMAN = L["SHAMAN"],
|
||||||
|
WARLOCK = L["WARLOCK"],
|
||||||
|
WARRIOR = L["WARRIOR"],
|
||||||
|
["*NOTINPARTY*"] = L["*Not in Party*"],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
----------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------
|
||||||
@@ -790,7 +805,9 @@ function Omen:UpdateBackdrop()
|
|||||||
else
|
else
|
||||||
self.Title:SetHeight(db.TitleBar.Height)
|
self.Title:SetHeight(db.TitleBar.Height)
|
||||||
end
|
end
|
||||||
self.Options.args.TitleBar.args.Height.min = h
|
if self.Options then
|
||||||
|
self.Options.args.TitleBar.args.Height.min = h
|
||||||
|
end
|
||||||
|
|
||||||
--self.FocusButton:SetPoint("TOPRIGHT", -inset, -inset)
|
--self.FocusButton:SetPoint("TOPRIGHT", -inset, -inset)
|
||||||
|
|
||||||
@@ -1402,16 +1419,15 @@ function Omen:UpdateBarsReal()
|
|||||||
|
|
||||||
if testMode then
|
if testMode then
|
||||||
threatTable = newTable()
|
threatTable = newTable()
|
||||||
local classes = self.Options.args.ShowClasses.args.Classes.values
|
local key = next(showClassesOptionTable)
|
||||||
local key = next(classes)
|
|
||||||
for i = 1, 25 do
|
for i = 1, 25 do
|
||||||
if i == 22 and myGUID then -- Because I've got myGUID == nil before
|
if i == 22 and myGUID then -- Because I've got myGUID == nil before
|
||||||
threatTable[myGUID] = i*5000
|
threatTable[myGUID] = i*5000
|
||||||
else
|
else
|
||||||
threatTable[i] = i*5000
|
threatTable[i] = i*5000
|
||||||
guidNameLookup[i] = classes[key]
|
guidNameLookup[i] = showClassesOptionTable[key]
|
||||||
if key ~= "*NOTINPARTY*" then guidClassLookup[i] = key end
|
if key ~= "*NOTINPARTY*" then guidClassLookup[i] = key end
|
||||||
key = next(classes, key) or next(classes)
|
key = next(showClassesOptionTable, key) or next(showClassesOptionTable)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
tankGUID = 25
|
tankGUID = 25
|
||||||
@@ -1813,18 +1829,110 @@ end
|
|||||||
-----------------------------------------------------------------------------
|
-----------------------------------------------------------------------------
|
||||||
-- Omen config stuff
|
-- Omen config stuff
|
||||||
|
|
||||||
local outlines = {
|
function Omen:SetupOptions()
|
||||||
[""] = L["None"],
|
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("Omen", self.GenerateOptions)
|
||||||
["OUTLINE"] = L["Outline"],
|
LibStub("AceConfig-3.0"):RegisterOptionsTable("OmenSlashCommand", self.OptionsSlash, "omen")
|
||||||
["THICKOUTLINE"] = L["Thick Outline"],
|
|
||||||
}
|
|
||||||
|
|
||||||
local function GetFuBarMinimapAttachedStatus(info)
|
-- The ordering here matters, it determines the order in the Blizzard Interface Options
|
||||||
return Omen:IsFuBarMinimapAttached() or db.FuBar.HideMinimapButton
|
local ACD3 = LibStub("AceConfigDialog-3.0")
|
||||||
|
self.optionsFrames = {}
|
||||||
|
self.optionsFrames.Omen = ACD3:AddToBlizOptions("Omen", self.versionstring, nil, "General")
|
||||||
|
self.optionsFrames.ShowWhen = ACD3:AddToBlizOptions("Omen", L["Show When..."], self.versionstring, "ShowWhen")
|
||||||
|
self.optionsFrames.ShowClasses = ACD3:AddToBlizOptions("Omen", L["Show Classes..."], self.versionstring, "ShowClasses")
|
||||||
|
self.optionsFrames.TitleBar = ACD3:AddToBlizOptions("Omen", L["Title Bar Settings"], self.versionstring, "TitleBar")
|
||||||
|
self.optionsFrames.Bars = ACD3:AddToBlizOptions("Omen", L["Bar Settings"], self.versionstring, "Bars")
|
||||||
|
self.optionsFrames.Warnings = ACD3:AddToBlizOptions("Omen", L["Warning Settings"], self.versionstring, "Warnings")
|
||||||
|
self:RegisterModuleOptions("OmenSlashCommand", self.OptionsSlash, L["Slash Command"])
|
||||||
|
self:RegisterModuleOptions("Profiles", function() return LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) end, L["Profiles"])
|
||||||
|
self.optionsFrames.Help = ACD3:AddToBlizOptions("Omen", L["Help File"], self.versionstring, "Help")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Omen:RegisterModuleOptions(name, optionTbl, displayName)
|
||||||
|
if moduleOptions then
|
||||||
|
moduleOptions[name] = optionTbl
|
||||||
|
else
|
||||||
|
self.Options.args[name] = (type(optionTbl) == "function") and optionTbl() or optionTbl
|
||||||
|
end
|
||||||
|
self.optionsFrames[name] = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Omen", displayName, self.versionstring, name)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Omen:ShowConfig()
|
||||||
|
-- Open the profiles tab before, so the menu expands
|
||||||
|
InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Profiles)
|
||||||
|
InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Omen)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Omen.GenerateOptions()
|
||||||
|
if Omen.noconfig then assert(false, Omen.noconfig) end
|
||||||
|
if not Omen.Options then
|
||||||
|
Omen.GenerateOptionsInternal()
|
||||||
|
Omen.GenerateOptionsInternal = nil
|
||||||
|
moduleOptions = nil
|
||||||
|
end
|
||||||
|
return Omen.Options
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
-- Omen config tables
|
||||||
|
|
||||||
|
-- Option table for the slash command only
|
||||||
|
Omen.OptionsSlash = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Slash Command"],
|
||||||
|
order = -3,
|
||||||
|
args = {
|
||||||
|
intro = {
|
||||||
|
order = 1,
|
||||||
|
type = "description",
|
||||||
|
name = L["OMEN_SLASH_DESC"],
|
||||||
|
cmdHidden = true,
|
||||||
|
},
|
||||||
|
toggle = {
|
||||||
|
type = "execute",
|
||||||
|
name = L["Toggle Omen"],
|
||||||
|
desc = L["Toggle Omen"].." ( /omen toggle )",
|
||||||
|
func = function() Omen:Toggle() end,
|
||||||
|
},
|
||||||
|
center = {
|
||||||
|
type = "execute",
|
||||||
|
name = L["Center Omen"],
|
||||||
|
desc = L["Center Omen"].." ( /omen center )",
|
||||||
|
func = function()
|
||||||
|
Omen.Anchor:ClearAllPoints()
|
||||||
|
Omen.Anchor:SetPoint("CENTER", UIParent, "CENTER")
|
||||||
|
Omen:SetAnchors()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
config = {
|
||||||
|
type = "execute",
|
||||||
|
name = L["Configure"],
|
||||||
|
desc = L["Open the configuration dialog"].." ( /omen config )",
|
||||||
|
func = function() Omen:ShowConfig() end,
|
||||||
|
guiHidden = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- This is to provide better error reporting feedback, and stop loading the rest of the file.
|
||||||
|
if not AceGUIWidgetLSMlists then
|
||||||
|
Omen.noconfig = 'Cannot find a library instance of "AceGUI-3.0-SharedMediaWidgets". Omen configuration will not be available.'
|
||||||
|
assert(AceGUIWidgetLSMlists, Omen.noconfig)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Omen.GenerateOptionsInternal()
|
||||||
|
local outlines = {
|
||||||
|
[""] = L["None"],
|
||||||
|
["OUTLINE"] = L["Outline"],
|
||||||
|
["THICKOUTLINE"] = L["Thick Outline"],
|
||||||
|
}
|
||||||
|
|
||||||
|
local function GetFuBarMinimapAttachedStatus(info)
|
||||||
|
return Omen:IsFuBarMinimapAttached() or db.FuBar.HideMinimapButton
|
||||||
|
end
|
||||||
|
|
||||||
-- Option table for the AceGUI config only
|
-- Option table for the AceGUI config only
|
||||||
local options = {
|
Omen.Options = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = "Omen",
|
name = "Omen",
|
||||||
get = function(info) return db[ info[#info] ] end,
|
get = function(info) return db[ info[#info] ] end,
|
||||||
@@ -2220,20 +2328,7 @@ local options = {
|
|||||||
type = "multiselect",
|
type = "multiselect",
|
||||||
order = 30,
|
order = 30,
|
||||||
name = L["Show bars for these classes"],
|
name = L["Show bars for these classes"],
|
||||||
values = {
|
values = showClassesOptionTable,
|
||||||
DEATHKNIGHT = L["DEATHKNIGHT"],
|
|
||||||
DRUID = L["DRUID"],
|
|
||||||
HUNTER = L["HUNTER"],
|
|
||||||
MAGE = L["MAGE"],
|
|
||||||
PALADIN = L["PALADIN"],
|
|
||||||
PET = L["PET"],
|
|
||||||
PRIEST = L["PRIEST"],
|
|
||||||
ROGUE = L["ROGUE"],
|
|
||||||
SHAMAN = L["SHAMAN"],
|
|
||||||
WARLOCK = L["WARLOCK"],
|
|
||||||
WARRIOR = L["WARRIOR"],
|
|
||||||
["*NOTINPARTY*"] = L["*Not in Party*"],
|
|
||||||
},
|
|
||||||
get = function(info, k) return db.Bar.Classes[k] end,
|
get = function(info, k) return db.Bar.Classes[k] end,
|
||||||
set = function(info, k, v)
|
set = function(info, k, v)
|
||||||
db.Bar.Classes[k] = v
|
db.Bar.Classes[k] = v
|
||||||
@@ -2961,80 +3056,19 @@ local options = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
Omen.Options = options
|
Omen.Options.args.Warnings.args.Output.order = 6
|
||||||
options.args.Warnings.args.Output.order = 6
|
Omen.Options.args.Warnings.args.Output.inline = true
|
||||||
options.args.Warnings.args.Output.inline = true
|
Omen.Options.args.Warnings.args.Output.disabled = function() return not db.Warnings.Message end
|
||||||
options.args.Warnings.args.Output.disabled = function() return not db.Warnings.Message end
|
|
||||||
|
|
||||||
-- Option table for the slash command only
|
for k, v in pairs(moduleOptions) do
|
||||||
local optionsSlash = {
|
Omen.Options.args[k] = (type(v) == "function") and v() or v
|
||||||
type = "group",
|
end
|
||||||
name = L["Slash Command"],
|
|
||||||
order = -3,
|
|
||||||
args = {
|
|
||||||
intro = {
|
|
||||||
order = 1,
|
|
||||||
type = "description",
|
|
||||||
name = L["OMEN_SLASH_DESC"],
|
|
||||||
cmdHidden = true,
|
|
||||||
},
|
|
||||||
toggle = {
|
|
||||||
type = "execute",
|
|
||||||
name = L["Toggle Omen"],
|
|
||||||
desc = L["Toggle Omen"].." ( /omen toggle )",
|
|
||||||
func = function() Omen:Toggle() end,
|
|
||||||
},
|
|
||||||
center = {
|
|
||||||
type = "execute",
|
|
||||||
name = L["Center Omen"],
|
|
||||||
desc = L["Center Omen"].." ( /omen center )",
|
|
||||||
func = function()
|
|
||||||
Omen.Anchor:ClearAllPoints()
|
|
||||||
Omen.Anchor:SetPoint("CENTER", UIParent, "CENTER")
|
|
||||||
Omen:SetAnchors()
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
config = {
|
|
||||||
type = "execute",
|
|
||||||
name = L["Configure"],
|
|
||||||
desc = L["Open the configuration dialog"].." ( /omen config )",
|
|
||||||
func = function() Omen:ShowConfig() end,
|
|
||||||
guiHidden = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
Omen.OptionsSlash = optionsSlash
|
|
||||||
|
|
||||||
function Omen:SetupOptions()
|
|
||||||
self.optionsFrames = {}
|
|
||||||
|
|
||||||
-- setup options table
|
|
||||||
LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable("Omen", options)
|
|
||||||
LibStub("AceConfig-3.0"):RegisterOptionsTable("OmenSlashCommand", optionsSlash, "omen")
|
|
||||||
local ACD3 = LibStub("AceConfigDialog-3.0")
|
|
||||||
|
|
||||||
-- The ordering here matters, it determines the order in the Blizzard Interface Options
|
|
||||||
self.optionsFrames.Omen = ACD3:AddToBlizOptions("Omen", self.versionstring, nil, "General")
|
|
||||||
self.optionsFrames.ShowWhen = ACD3:AddToBlizOptions("Omen", L["Show When..."], self.versionstring, "ShowWhen")
|
|
||||||
self.optionsFrames.ShowClasses = ACD3:AddToBlizOptions("Omen", L["Show Classes..."], self.versionstring, "ShowClasses")
|
|
||||||
self.optionsFrames.TitleBar = ACD3:AddToBlizOptions("Omen", L["Title Bar Settings"], self.versionstring, "TitleBar")
|
|
||||||
self.optionsFrames.Bars = ACD3:AddToBlizOptions("Omen", L["Bar Settings"], self.versionstring, "Bars")
|
|
||||||
self.optionsFrames.Warnings = ACD3:AddToBlizOptions("Omen", L["Warning Settings"], self.versionstring, "Warnings")
|
|
||||||
self:RegisterModuleOptions("OmenSlashCommand", optionsSlash, L["Slash Command"])
|
|
||||||
self:RegisterModuleOptions("Profiles", LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db), L["Profiles"])
|
|
||||||
self.optionsFrames.Help = ACD3:AddToBlizOptions("Omen", L["Help File"], self.versionstring, "Help")
|
|
||||||
|
|
||||||
-- Add ordering data to the option table generated by AceDBOptions-3.0
|
-- Add ordering data to the option table generated by AceDBOptions-3.0
|
||||||
options.args.Profiles.order = -2
|
Omen.Options.args.Profiles.order = -2
|
||||||
|
|
||||||
|
local h = db.Background.EdgeSize * 2
|
||||||
|
if not db.TitleBar.UseSameBG then h = db.TitleBar.EdgeSize * 2 end
|
||||||
|
Omen.Options.args.TitleBar.args.Height.min = h
|
||||||
end
|
end
|
||||||
|
|
||||||
function Omen:RegisterModuleOptions(name, optionTbl, displayName)
|
|
||||||
options.args[name] = (type(optionTbl) == "function") and optionTbl() or optionTbl
|
|
||||||
self.optionsFrames[name] = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Omen", displayName, self.versionstring, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Omen:ShowConfig()
|
|
||||||
-- Open the profiles tab before, so the menu expands
|
|
||||||
InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Profiles)
|
|
||||||
InterfaceOptionsFrame_OpenToCategory(self.optionsFrames.Omen)
|
|
||||||
end
|
|
||||||
|
|||||||
Reference in New Issue
Block a user