WoWInterface SVN NeedToKnow-Updated

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches
    from Rev 80 to Rev 81
    Reverse comparison

Rev 80 → Rev 81

Kitjan/NeedToKnow/NeedToKnow.xml
1,5 → 1,5
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
..\..\..\Blizza~1\FrameXML\UI.xsd">
 
<Script file="NeedToKnow_Localization.lua"/>
<Script file="NeedToKnow.lua"/>
70,12 → 70,10
</Frames>
</Frame>
 
<Frame name="NeedToKnow_BarTemplate" drawLayer="BORDER" toplevel="true" enableMouse="true" virtual="true">
<Frame name="NeedToKnow_BarTemplate" toplevel="true" enableMouse="true" virtual="true">
<Size>
<AbsDimension x="271" y="18"/>
</Size>
<BarTexture file="Interface\PaperDollInfoFrame\UI-Character-Skills-Bar"/>
<BarColor r="1.0" g="0.7" b="0.0" a="1.0"/>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" setAllPoints="true">
96,10 → 94,14
<Texture name="$parentTexture">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<AbsDimension x="0" y="-0"/>
<Offset>
<AbsDimension x="0" y="-0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOM" relativeTo="$parent" relativePoint="BOTTOM">
<AbsDimension x="-0" y="0"/>
<Offset>
<AbsDimension x="-0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
Kitjan/NeedToKnow/NeedToKnow.lua
1,4 → 1,4
-- ----------------------
-- ----------------------
-- NeedToKnow
-- by Kitjan, lieandswell
-- ----------------------
14,11 → 14,9
 
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file
 
NEEDTOKNOW.VERSION = "3.1.7"
NEEDTOKNOW.MAXGROUPS = 4
NEEDTOKNOW.MAXBARS = 6
NEEDTOKNOW.VERSION = "3.2.0"
NEEDTOKNOW.UPDATE_INTERVAL = 0.05
NEEDTOKNOW.CURRENTSPEC = 1
NEEDTOKNOW.MAXBARS = 20
 
-- Get the localized name of spell 75, which is "Auto Shot" in US English
NEEDTOKNOW.AUTO_SHOT = GetSpellInfo(75)
77,77 → 75,54
FixedDuration = nil,
}
NEEDTOKNOW.DEFAULTS = {
Version = NEEDTOKNOW.VERSION,
Locked = false,
BarTexture = "BantoBar",
BarFont = "DEFAULT",
BkgdColor = { 0, 0, 0, 0.8 },
BarSpacing = 3,
BarPadding = 3,
Spec = {},
Version = NEEDTOKNOW.VERSION,
Locked = false,
Profiles = {},
}
NEEDTOKNOW.SPEC_DEFAULTS = {
Groups = {},
NEEDTOKNOW.PROFILE_DEFAULTS = {
nGroups = 1,
Groups = NEEDTOKNOW.GROUP_DEFAULTS,
BarTexture = "BantoBar",
BarFont = "DEFAULT",
BkgdColor = { 0, 0, 0, 0.8 },
BarSpacing = 3,
BarPadding = 3,
}
 
for barID = 1, NEEDTOKNOW.MAXBARS do
NEEDTOKNOW.GROUP_DEFAULTS["Bars"][barID] = NEEDTOKNOW.BAR_DEFAULTS
end
 
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
NEEDTOKNOW.SPEC_DEFAULTS["Groups"][groupID] = NEEDTOKNOW.GROUP_DEFAULTS
end
 
for specID = 1, 2 do
NEEDTOKNOW.DEFAULTS["Spec"][specID] = NEEDTOKNOW.SPEC_DEFAULTS
end
 
function NeedToKnow.Test(stuff)
if ( stuff ) then
DEFAULT_CHAT_FRAME:AddMessage("NeedToKnow test: "..stuff)
else
DEFAULT_CHAT_FRAME:AddMessage("NeedToKnow test: "..self:GetName())
end
end
 
-- -------------------
-- SharedMedia Support
-- -------------------
 
NeedToKnow.LSM = LibStub("LibSharedMedia-3.0", true)
 
if not NeedToKnow.LSM:Fetch("statusbar", "Aluminum", true) then NeedToKnow.LSM:Register("statusbar", "Aluminum", [[Interface\Addons\NeedToKnow\Textures\Aluminum.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Armory", true) then NeedToKnow.LSM:Register("statusbar", "Armory", [[Interface\Addons\NeedToKnow\Textures\Armory.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "BantoBar", true) then NeedToKnow.LSM:Register("statusbar", "BantoBar", [[Interface\Addons\NeedToKnow\Textures\BantoBar.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "DarkBottom", true) then NeedToKnow.LSM:Register("statusbar", "DarkBottom", [[Interface\Addons\NeedToKnow\Textures\Darkbottom.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Default", true) then NeedToKnow.LSM:Register("statusbar", "Default", [[Interface\Addons\NeedToKnow\Textures\Default.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Flat", true) then NeedToKnow.LSM:Register("statusbar", "Flat", [[Interface\Addons\NeedToKnow\Textures\Flat.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Glaze", true) then NeedToKnow.LSM:Register("statusbar", "Glaze", [[Interface\Addons\NeedToKnow\Textures\Glaze.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Gloss", true) then NeedToKnow.LSM:Register("statusbar", "Gloss", [[Interface\Addons\NeedToKnow\Textures\Gloss.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Graphite", true) then NeedToKnow.LSM:Register("statusbar", "Graphite", [[Interface\Addons\NeedToKnow\Textures\Graphite.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Minimalist", true) then NeedToKnow.LSM:Register("statusbar", "Minimalist", [[Interface\Addons\NeedToKnow\Textures\Minimalist.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Otravi", true) then NeedToKnow.LSM:Register("statusbar", "Otravi", [[Interface\Addons\NeedToKnow\Textures\Otravi.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Smooth", true) then NeedToKnow.LSM:Register("statusbar", "Smooth", [[Interface\Addons\NeedToKnow\Textures\Smooth.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Smooth v2", true) then NeedToKnow.LSM:Register("statusbar", "Smooth v2", [[Interface\Addons\NeedToKnow\Textures\Smoothv2.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Striped", true) then NeedToKnow.LSM:Register("statusbar", "Striped", [[Interface\Addons\NeedToKnow\Textures\Striped.tga]]) end
NeedToKnow.LSM = LibStub("LibSharedMedia-3.0", true)
 
if not NeedToKnow.LSM:Fetch("statusbar", "Aluminum", true) then NeedToKnow.LSM:Register("statusbar", "Aluminum", [[Interface\Addons\NeedToKnow\Textures\Aluminum.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Armory", true) then NeedToKnow.LSM:Register("statusbar", "Armory", [[Interface\Addons\NeedToKnow\Textures\Armory.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "BantoBar", true) then NeedToKnow.LSM:Register("statusbar", "BantoBar", [[Interface\Addons\NeedToKnow\Textures\BantoBar.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "DarkBottom", true) then NeedToKnow.LSM:Register("statusbar", "DarkBottom", [[Interface\Addons\NeedToKnow\Textures\Darkbottom.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Default", true) then NeedToKnow.LSM:Register("statusbar", "Default", [[Interface\Addons\NeedToKnow\Textures\Default.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Flat", true) then NeedToKnow.LSM:Register("statusbar", "Flat", [[Interface\Addons\NeedToKnow\Textures\Flat.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Glaze", true) then NeedToKnow.LSM:Register("statusbar", "Glaze", [[Interface\Addons\NeedToKnow\Textures\Glaze.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Gloss", true) then NeedToKnow.LSM:Register("statusbar", "Gloss", [[Interface\Addons\NeedToKnow\Textures\Gloss.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Graphite", true) then NeedToKnow.LSM:Register("statusbar", "Graphite", [[Interface\Addons\NeedToKnow\Textures\Graphite.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Minimalist", true) then NeedToKnow.LSM:Register("statusbar", "Minimalist", [[Interface\Addons\NeedToKnow\Textures\Minimalist.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Otravi", true) then NeedToKnow.LSM:Register("statusbar", "Otravi", [[Interface\Addons\NeedToKnow\Textures\Otravi.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Smooth", true) then NeedToKnow.LSM:Register("statusbar", "Smooth", [[Interface\Addons\NeedToKnow\Textures\Smooth.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Smooth v2", true) then NeedToKnow.LSM:Register("statusbar", "Smooth v2", [[Interface\Addons\NeedToKnow\Textures\Smoothv2.tga]]) end
if not NeedToKnow.LSM:Fetch("statusbar", "Striped", true) then NeedToKnow.LSM:Register("statusbar", "Striped", [[Interface\Addons\NeedToKnow\Textures\Striped.tga]]) end
 
-- ---------------
-- EXECUTIVE FRAME
-- ---------------
 
function NeedToKnow.ExecutiveFrame_OnEvent(self, event, ...)
if ( event == "ADDON_LOADED" and select(1,...) == "NeedToKnow") then
 
if ( not NeedToKnow_Settings ) then
NeedToKnow_Settings = CopyTable(NEEDTOKNOW.DEFAULTS)
NeedToKnow_Settings["Spec"][1]["Groups"][1]["Enabled"] = true
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true
NeedToKnow.Reset()
else
NeedToKnow.SafeUpgrade()
end
 
if ( not NeedToKnow_Settings.BarFont or NeedToKnow_Settings["BarFont"] == "DEFAULT" ) then
NeedToKnow_Settings["BarFont"] = GameFontHighlight:GetFont()
if not NeedToKnow.ProfileSettings then
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[ NeedToKnow_Settings.Profiles[1] ]
end
 
if ( not NeedToKnow_Visible ) then
161,9 → 136,6
SlashCmdList["NEEDTOKNOW"] = NeedToKnow.SlashCommand
SLASH_NEEDTOKNOW1 = "/needtoknow"
SLASH_NEEDTOKNOW2 = "/ntk"
 
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
else
local fnName = "ExecutiveFrame_"..event
local fn = NeedToKnow[fnName]
173,6 → 145,7
end
end
 
 
function NeedToKnow.ExecutiveFrame_UNIT_SPELLCAST_SUCCEEDED(unit, spell, rank)
if unit == "player" then
local r = NeedToKnow.last_cast[spell]
199,9 → 172,10
end
end
 
function NeedToKnow.ExecutiveFrame_COMBAT_LOG_EVENT_UNFILTERED(time, event, guidCaster, ...)
 
function NeedToKnow.ExecutiveFrame_COMBAT_LOG_EVENT_UNFILTERED(tod, event, guidCaster, ...)
-- the time that's passed in appears to be time of day, not game time like everything else.
time = GetTime()
local time = GetTime()
-- TODO: Is checking r.state sufficient or must event be checked instead?
if ( guidCaster == NeedToKnow.guidPlayer ) then
local guidTarget, _, _, _, spell = select(3, ...)
232,36 → 206,58
end
end
 
 
function NeedToKnow.ExecutiveFrame_PLAYER_LOGIN()
-- save group positions if upgrading from version that used layout-local.txt
if ( not NeedToKnow_Settings.OldVersion or
NeedToKnow_Settings.OldVersion < "2.1" ) then
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
for groupID = 1, 4 do -- Prior to 3.2, there were always 4 groups
NeedToKnow.SavePosition(_G["NeedToKnow_Group"..groupID], groupID)
end
 
elseif (NeedToKnow_Settings["Version"] < "2.4") then
NeedToKnow.UIPanel_Update()
end
 
NeedToKnow.guidPlayer = UnitGUID("player")
NEEDTOKNOW.CURRENTSPEC = GetActiveTalentGroup()
 
local _, player_CLASS = UnitClass("player")
if player_CLASS == "DEATHKNIGHT" then
NeedToKnow.is_DK = 1
end
 
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
end
 
 
function NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
NEEDTOKNOW.CURRENTSPEC = GetActiveTalentGroup()
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
local spec = GetActiveTalentGroup()
 
local profile = NeedToKnow_Settings.Profiles[spec]
if not profile then
NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec)
end
 
NeedToKnow.ChangeProfile(profile);
end
 
 
function NeedToKnow.ChangeProfile(profile)
if NeedToKnow_Globals.Profiles[profile] then
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[profile]
 
local spec = GetActiveTalentGroup()
NeedToKnow_Settings.Profiles[spec] = profile
 
if ( not NeedToKnow.ProfileSettings["BarFont"] or NeedToKnow.ProfileSettings["BarFont"] == "DEFAULT" ) then
NeedToKnow.ProfileSettings["BarFont"] = GameFontHighlight:GetFont()
end
 
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
else
print("NeedToKnow profile",profile,"does not exist!") -- FIXME: Localization!
end
end
 
 
function NeedToKnow.ExecutiveFrame_COMMENTATOR_ENTER_WORLD()
NeedToKnow.Update()
end
288,58 → 284,102
end
 
 
function NeedToKnow.Reset()
trace("NeedToKnow.Reset!")
NeedToKnow_Settings = nil
NeedToKnow_Globals = nil
end
 
 
function NeedToKnow.CreateProfile(settings, idxSpec, nameProfile)
if not nameProfile then
nameProfile = UnitName("player") .. "_" .. idxSpec
if NeedToKnow_Globals.Profiles[nameProfile] then
nameProfile = GetRealmName() .. "_" .. nameProfile
end
end
trace("Adding profile",nameProfile)
MemberDump(settings)
NeedToKnow_Settings.Profiles[idxSpec] = nameProfile
NeedToKnow_Globals.Profiles[nameProfile] = settings
MemberDump(NeedToKnow_Globals.Profiles)
end
 
 
function NeedToKnow.SafeUpgrade()
-- If there had been an error during the previous upgrade, NeedToKnow_Settings
-- may be in an inconsistent, halfway state.
local bCorruptUpgrade = false
if ( NeedToKnow_Settings["Spec"] ) then
if ( NeedToKnow_Settings["Spec"] ) then -- The Spec member existed from versions 2.4 to 3.1.7
if not NeedToKnow_Globals then
trace("Creating a new globals ugrading from", NeedToKnow_Settings.Version)
NeedToKnow_Globals = { Profiles = {} }
end
local oldSettings = NeedToKnow_Settings
NeedToKnow_Settings =
{
Version = oldSettings.Version,
Locked = oldSettings.Locked,
Profiles = {},
}
oldSettings.Version = nil
oldSettings.OldVersion = nil
for idxSpec = 1,2 do
local specSettings = NeedToKnow_Settings.Spec[idxSpec]
if ( not specSettings or not specSettings.Groups ) then
local specSettings = oldSettings.Spec[idxSpec]
if not specSettings or not specSettings.Groups or not specSettings.Groups[1] or not
specSettings.Groups[2] or not specSettings.Groups[3] or not specSettings.Groups[4] then
bCorruptUpgrade = true
else
for idxGroup = 1,NEEDTOKNOW.MAXGROUPS do
local groupSettings = specSettings.Groups[idxGroup]
if not groupSettings then
bCorruptUpgrade = true
end
end
 
if not bCorruptUpgrade then
for ik, iv in pairs(oldSettings) do
specSettings[ik] = iv
end
specSettings.Spec = nil
specSettings.Locked = nil
NeedToKnow.CreateProfile(specSettings, idxSpec)
specSettings.nGroups = 4
end
end
if ( not bCorruptUpgrade and NeedToKnow_Settings["Version"] < "2.4" ) then
NeedToKnow_Settings.OldVersion = NeedToKnow_Settings["Version"]
NeedToKnow_Settings["Version"] = NEEDTOKNOW.VERSION
end
else -- 3.2 settings sanity check
if not NeedToKnow_Settings["Version"] or not NeedToKnow_Settings.Profiles or not NeedToKnow_Settings.Profiles[1] then
bCorruptUpgrade = true
end
if not NeedToKnow_Globals or not NeedToKnow_Globals.Profiles then
bCorruptUpgrade = true
end
if not bCorruptUpgrade then
-- TODO: check the required members for existence and delete any corrupted profiles
end
end
 
if ( bCorruptUpgrade or NeedToKnow_Settings["Version"] < "2.0" ) then -- total settings clear if v1.x
 
if ( bCorruptUpgrade or NeedToKnow_Settings["Version"] < "2.0" ) then
-- total settings clear if v1.x or settings corrupted/lost
print("Old NeedToKnow settings not compatible with current version... starting from scratch")
NeedToKnow_Settings = CopyTable(NEEDTOKNOW.DEFAULTS)
NeedToKnow_Settings["Spec"][1]["Groups"][1]["Enabled"] = true
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true
 
NeedToKnow.Reset()
-- if before dual spec support, copy old settings to both specs
elseif (NeedToKnow_Settings["Version"] < "2.4") then
local tempSettings = CopyTable(NeedToKnow_Settings)
NeedToKnow.Reset()
NeedToKnow_Settings["Locked"] = tempSettings["Locked"]
NeedToKnow_Settings["BarTexture"] = tempSettings["BarTexture"]
NeedToKnow_Settings["BkgdColor"] = tempSettings["BkgdColor"]
NeedToKnow_Settings["BarSpacing"] = tempSettings["BarSpacing"]
NeedToKnow_Settings["BarPadding"] = tempSettings["BarPadding"]
tempSettings["Locked"] = nil
NeedToKnow_Settings["Version"] = tempSettings["Version"]
 
for i = 1, NEEDTOKNOW.MAXGROUPS do
NeedToKnow_Settings["Spec"][1]["Groups"][i] = tempSettings["Groups"][i]
NeedToKnow_Settings["Spec"][2]["Groups"][i] = tempSettings["Groups"][i]
end
tempSettings["Version"] = nil
tempSettings["nGroups"] = 4
NeedToKnow.CreateProfile(tempSettings, 1);
NeedToKnow.CreateProfile(CopyTable(tempSettings), 2);
end
 
NeedToKnow_Settings.OldVersion = NeedToKnow_Settings["Version"]
NeedToKnow_Settings["Version"] = NEEDTOKNOW.VERSION
 
-- Add any new settings
for iS,vS in ipairs(NeedToKnow_Settings["Spec"]) do
for kD, vD in pairs(NEEDTOKNOW.SPEC_DEFAULTS) do
for iS,vS in pairs(NeedToKnow_Globals.Profiles) do
for kD, vD in pairs(NEEDTOKNOW.PROFILE_DEFAULTS) do
if nil == vS[kD] then
vS[kD] = NeedToKnow.deepcopy(vD)
end
362,6 → 402,8
end
end
end
 
 
end
 
-- Copies anything (int, table, whatever). Unlike CopyTable, deepcopy can
386,8 → 428,8
end
 
function NeedToKnow.Update()
if (UnitExists("player")) then
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
if UnitExists("player") and NeedToKnow.ProfileSettings then
for groupID = 1, NeedToKnow.ProfileSettings.nGroups do
NeedToKnow.Group_Update(groupID)
end
end
395,10 → 437,10
 
function NeedToKnow.Show(bShow)
NeedToKnow_Visible = bShow
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
for groupID = 1, NeedToKnow.ProfileSettings.nGroups do
local groupName = "NeedToKnow_Group"..groupID
local group = _G[groupName]
local groupSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]
local groupSettings = NeedToKnow.ProfileSettings.Groups[groupID]
 
if (NeedToKnow_Visible and groupSettings.Enabled) then
group:Show()
426,7 → 468,7
function NeedToKnow.Group_Update(groupID)
local groupName = "NeedToKnow_Group"..groupID
local group = _G[groupName]
local groupSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]
local groupSettings = NeedToKnow.ProfileSettings.Groups[groupID]
 
for barID = 1, groupSettings.NumberBars do
local barName = groupName.."Bar"..barID
434,7 → 476,7
bar:SetID(barID)
 
if ( barID > 1 ) then
bar:SetPoint("TOP", _G[groupName.."Bar"..(barID-1)], "BOTTOM", 0, -NeedToKnow_Settings.BarSpacing)
bar:SetPoint("TOP", _G[groupName.."Bar"..(barID-1)], "BOTTOM", 0, -NeedToKnow.ProfileSettings.BarSpacing)
else
bar:SetPoint("TOPLEFT", group, "TOPLEFT")
end
445,14 → 487,18
NeedToKnow.ClearScripts(bar)
end
end
for barID = groupSettings.NumberBars+1, NEEDTOKNOW.MAXBARS do
local barID = groupSettings.NumberBars+1
while true do
local bar = _G[groupName.."Bar"..barID]
if ( bar ) then
if bar then
bar:Hide()
NeedToKnow.ClearScripts(bar)
barID = barID + 1
else
break
end
end
 
 
local resizeButton = _G[groupName.."ResizeButton"]
resizeButton:SetPoint("BOTTOMRIGHT", groupName.."Bar"..groupSettings.NumberBars, "BOTTOMRIGHT", 8, -8)
if ( NeedToKnow_Settings["Locked"] ) then
486,16 → 532,30
-- Called when the configuration of the bar has changed, when the addon
-- is loaded or when ntk is locked and unlocked
function NeedToKnow.Bar_Update(groupID, barID)
local groupSettings = NeedToKnow.ProfileSettings.Groups[groupID]
 
local barName = "NeedToKnow_Group"..groupID.."Bar"..barID
local bar = _G[barName]
if not bar then
-- New bar added in the UI; need to create it!
local group = _G["NeedToKnow_Group"..groupID]
bar = CreateFrame("Button", barName, group, "NeedToKnow_BarTemplate")
bar:SetPoint("TOPLEFT", "NeedToKnow_Group"..groupID.."Bar"..(barID-1), "BOTTOMLEFT", 0, 0)
bar:SetPoint("RIGHT", group, "RIGHT", 0, 0)
trace("Creating bar for", groupID, barID)
end
local background = _G[barName.."Background"]
bar.spark = _G[barName.."Spark"]
bar.text = _G[barName.."Text"]
bar.time = _G[barName.."Time"]
bar.bar1 = _G[barName.."Texture"]
 
local groupSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]
local barSettings = groupSettings["Bars"][barID]
if not barSettings then
trace("Adding bar settings for", groupID, barID)
barSettings = CopyTable(NEEDTOKNOW.BAR_DEFAULTS)
groupSettings.Bars[barID] = CopyTable(NEEDTOKNOW.BAR_DEFAULTS)
end
bar.auraName = barSettings.AuraName
if ( barSettings.BuffOrDebuff == "BUFFCD" or
barSettings.BuffOrDebuff == "TOTEM" or
507,14 → 567,14
 
-- Split the spell names
bar.spells = {}
for barSpell in bar.auraName:gmatch("([^,]+),*") do
for barSpell in bar.auraName:gmatch("([^,]+)") do
barSpell = strtrim(barSpell)
table.insert(bar.spells, barSpell)
end
 
-- split the user name overrides
bar.spell_names = {}
for un in barSettings.show_text_user:gmatch("([^,]+),*") do
for un in barSettings.show_text_user:gmatch("([^,]+)") do
un = strtrim(un)
table.insert(bar.spell_names, un)
end
540,11 → 600,11
 
bar.max_value = 1
SetStatusBarValue(bar,bar.bar1,1)
bar.bar1:SetTexture(NeedToKnow.LSM:Fetch("statusbar", NeedToKnow_Settings["BarTexture"]))
bar.bar1:SetTexture(NeedToKnow.LSM:Fetch("statusbar", NeedToKnow.ProfileSettings["BarTexture"]))
if ( bar.bar2 ) then
bar.bar2:SetTexture(NeedToKnow.LSM:Fetch("statusbar", NeedToKnow_Settings["BarTexture"]))
bar.bar2:SetTexture(NeedToKnow.LSM:Fetch("statusbar", NeedToKnow.ProfileSettings["BarTexture"]))
end
local fontPath = NeedToKnow_Settings["BarFont"]
local fontPath = NeedToKnow.ProfileSettings["BarFont"]
if ( fontPath ) then
-- TODO: I'd like to get that 12 from something rather than hard-code it
bar.text:SetFont(fontPath, 12)
555,8 → 615,8
bar.text:SetWidth(groupSettings.Width-60)
NeedToKnow.SizeBackground(bar, barSettings.show_icon)
 
background:SetHeight(bar:GetHeight() + 2*NeedToKnow_Settings["BarPadding"])
background:SetVertexColor(unpack(NeedToKnow_Settings["BkgdColor"]))
background:SetHeight(bar:GetHeight() + 2*NeedToKnow.ProfileSettings["BarPadding"])
background:SetVertexColor(unpack(NeedToKnow.ProfileSettings["BkgdColor"]))
 
-- Set up the Visual Cast Time overlay. It isn't a part of the template
-- because most bars won't use it and thus don't need to pay the cost of
582,7 → 642,7
bar.icon:SetWidth(size)
bar.icon:SetHeight(size)
bar.icon:ClearAllPoints()
bar.icon:SetPoint("TOPRIGHT", bar, "TOPLEFT", -NeedToKnow_Settings["BarPadding"], 0)
bar.icon:SetPoint("TOPRIGHT", bar, "TOPLEFT", -NeedToKnow.ProfileSettings["BarPadding"], 0)
bar.icon:Show()
elseif (bar.icon) then
bar.icon:Hide()
859,13 → 919,13
 
function NeedToKnow.SizeBackground(bar, i_show_icon)
local background = _G[bar:GetName() .. "Background"]
local bgWidth = bar:GetWidth() + 2*NeedToKnow_Settings["BarPadding"]
local y = NeedToKnow_Settings["BarPadding"]
local bgWidth = bar:GetWidth() + 2*NeedToKnow.ProfileSettings["BarPadding"]
local y = NeedToKnow.ProfileSettings["BarPadding"]
local x = -y
background:ClearAllPoints()
 
if ( i_show_icon ) then
local iconExtra = bar:GetHeight() + NeedToKnow_Settings["BarPadding"]
local iconExtra = bar:GetHeight() + NeedToKnow.ProfileSettings["BarPadding"]
bgWidth = bgWidth + iconExtra
x = x - iconExtra
end
Kitjan/NeedToKnow/NeedToKnow.toc
1,16 → 1,19
## Interface: 30300
## X-Compatible-With: 40000
## Title: NeedToKnow
## Author: Kitjan, lieandswell
## Version: 3.1.7
## Notes: Timer bars for buffs, debuffs, cooldowns, etc.
## Notes: Timer bars for buffs, debuffs, cooldowns, etc.
## X-Compatible-With: 40000
## X-Credits: Bilt, Fxfighter EU-Echsenkessel, metalchoir, sp00n, Vlakarados, wowui.cn
## X-Category: Buffs, Combat
## OptionalDeps: LibStub,LibSharedMedia-3.0
## DefaultState: enabled
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariablesPerCharacter: NeedToKnow_Settings
## SavedVariables: NeedToKnow_Globals
libs\LibStub\LibStub.lua
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
libs\LibSharedMedia-3.0\lib.xml
NeedToKnow.xml
NeedToKnow_GroupOptionsTemplate.xml
NeedToKnow_Options.xml
Kitjan/NeedToKnow/NeedToKnow_Localization.lua
57,12 → 57,14
NEEDTOKNOW.UIPANEL_BARTEXTURE = "Bar texture";
NEEDTOKNOW.UIPANEL_BARFONT = "Bar font";
NEEDTOKNOW.UIPANEL_FONT = "Font";
NEEDTOKNOW.UIPANEL_PROFILE = "Profile";
 
NEEDTOKNOW.BARMENU_TOTEM = "Totem";
NEEDTOKNOW.BARMENU_CASTCD = "Spell Cooldown";
NEEDTOKNOW.BARMENU_BUFFCD = "Internal Cooldown";
NEEDTOKNOW.BARMENU_USABLE = "Spell Usable";
NEEDTOKNOW.CMD_HIDE = "hide";
NEEDTOKNOW.CMD_PROFILE = "profile";
NEEDTOKNOW.CMD_SHOW = "show";
NEEDTOKNOW.BARMENU_TIMEFORMAT = "Time Format";
NEEDTOKNOW.FMT_SINGLEUNIT = "Single unit (2 m)";
Kitjan/NeedToKnow/NeedToKnow_Options.xml
1,6 → 1,5
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
 
..\..\..\Blizza~1\FrameXML\UI.xsd">
<Frame name="NeedToKnow_GroupOptionsTemplate" virtual="true">
<Size>
<AbsDimension x="128" y="26"/>
345,8 → 344,8
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont inherits="GameFontNormalSmall"/>
<HighlightFont inherits="GameFontHighlightSmall"/>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
374,12 → 373,13
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont inherits="GameFontNormalSmall"/>
<HighlightFont inherits="GameFontHighlightSmall"/>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
</Frame>
 
 
<Frame name="InterfaceOptionsNeedToKnowAppearancePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
577,8 → 577,8
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont inherits="GameFontNormalSmall"/>
<HighlightFont inherits="GameFontHighlightSmall"/>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
<Button name="$parentPlayModeButton" inherits="UIPanelButtonTemplate">
<Size>
606,10 → 606,86
</OnEnter>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
<NormalFont inherits="GameFontNormalSmall"/>
<HighlightFont inherits="GameFontHighlightSmall"/>
<NormalFont style="GameFontNormalSmall"/>
<HighlightFont style="GameFontHighlightSmall"/>
</Button>
</Frames>
</Frame>
 
<Frame name="InterfaceOptionsNeedToKnowProfilePanel" hidden="true" parent="InterfaceOptionsFramePanelContainer">
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentTitle" text="NeedToKnow" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentVersion" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTitle" relativePoint="RIGHT">
<Offset>
<AbsDimension x="4" y="-0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="24" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-24" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentCurrentProfileLabel" inherits="GameFontNormalSmall">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentCurrentProfile" inherits="GameFontHightlightSmall">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentCurrentProfileLabel" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnLoad>
self.name = NEEDTOKNOW.UIPANEL_PROFILE;
self.parent = "NeedToKnow";
self.default = NeedToKnow.Reset;
-- self.cancel = NeedToKnow.Cancel;
-- need different way to handle cancel? users might open appearance panel without opening main panel
InterfaceOptions_AddCategory(self);
NeedToKnow.UIPanel_Profile_OnLoad(self)
</OnLoad>
<OnShow>
NeedToKnow.UIPanel_Profile_OnShow();
</OnShow>
<OnHide>
</OnHide>
</Scripts>
</Frame>
 
</Ui>
Kitjan/NeedToKnow/NeedToKnow_Options.lua
1,4 → 1,4
NEEDTOKNOW.MAXBARSPACING = 24;
NEEDTOKNOW.MAXBARSPACING = 24;
NEEDTOKNOW.MAXBARPADDING = 12;
 
local LSM = LibStub("LibSharedMedia-3.0", true);
6,15 → 6,31
local fontList = LSM:List("font");
 
function NeedToKnow.SlashCommand(cmd)
if ( cmd == NEEDTOKNOW.CMD_RESET ) then
local args = {}
for arg in cmd:gmatch("(%S+)") do
table.insert(args, arg)
end
 
cmd = args[1]
if not cmd then
NeedToKnow.LockToggle();
elseif ( cmd == NEEDTOKNOW.CMD_RESET ) then
NeedToKnow.Reset();
elseif ( cmd == NEEDTOKNOW.CMD_SHOW ) then
NeedToKnow.Show(true);
elseif ( cmd == NEEDTOKNOW.CMD_HIDE ) then
NeedToKnow.Show(false);
else
NeedToKnow.LockToggle();
end
elseif ( cmd == NEEDTOKNOW.CMD_PROFILE ) then
if args[2] then
NeedToKnow.ChangeProfile(args[2])
else
local spec = GetActiveTalentGroup()
local profile = NeedToKnow_Settings.Profiles[spec]
print("Current NeedToKnow profile is \""..profile.."\"") -- FIXME: localization!
end
else
print("Unknown NeedToKnow command",cmd)
end
end
 
function NeedToKnow.LockToggle()
47,7 → 63,7
end
 
function NeedToKnow.UIPanel_OnShow()
NeedToKnow_OldSettings = CopyTable(NeedToKnow_Settings);
NeedToKnow_OldSettings = CopyTable(NeedToKnow.ProfileSettings);
NeedToKnow.UIPanel_Update();
end
 
55,26 → 71,26
local panelName = "InterfaceOptionsNeedToKnowPanel";
if not _G[panelName]:IsVisible() then return end
 
local settings = NeedToKnow_Settings;
local settings = NeedToKnow.ProfileSettings;
 
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
for groupID = 1, settings.nGroups do
NeedToKnow.GroupEnableButton_Update(groupID);
NeedToKnow.NumberbarsWidget_Update(groupID);
_G[panelName.."Group"..groupID.."FixedDurationBox"]:SetText(settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["FixedDuration"] or "");
_G[panelName.."Group"..groupID.."FixedDurationBox"]:SetText(settings.Groups[groupID]["FixedDuration"] or "");
end
end
 
function NeedToKnow.GroupEnableButton_Update(groupID)
local button = _G["InterfaceOptionsNeedToKnowPanelGroup"..groupID.."EnableButton"];
button:SetChecked(NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Enabled"]);
button:SetChecked(NeedToKnow.ProfileSettings.Groups[groupID]["Enabled"]);
end
 
function NeedToKnow.GroupEnableButton_OnClick(self)
local groupID = self:GetParent():GetID();
if ( self:GetChecked() ) then
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Enabled"] = true;
NeedToKnow.ProfileSettings.Groups[groupID]["Enabled"] = true;
else
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Enabled"] = false;
NeedToKnow.ProfileSettings.Groups[groupID]["Enabled"] = false;
end
NeedToKnow.Update();
end
84,7 → 100,7
local text = _G[widgetName.."Text"];
local leftButton = _G[widgetName.."LeftButton"];
local rightButton = _G[widgetName.."RightButton"];
local numberBars = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["NumberBars"];
local numberBars = NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"];
text:SetText(numberBars);
leftButton:Enable();
rightButton:Enable();
97,13 → 113,13
 
function NeedToKnow.NumberbarsButton_OnClick(self, increment)
local groupID = self:GetParent():GetParent():GetID();
local oldNumber = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["NumberBars"];
local oldNumber = NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"];
if ( oldNumber == 1 ) and ( increment < 0 ) then
return;
elseif ( oldNumber == NEEDTOKNOW.MAXBARS ) and ( increment > 0 ) then
return;
end
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["NumberBars"] = oldNumber + increment;
NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"] = oldNumber + increment;
NeedToKnow.Group_Update(groupID);
NeedToKnow.NumberbarsWidget_Update(groupID);
end
111,29 → 127,16
function NeedToKnow.FixedDurationEditBox_OnTextChanged(self)
local enteredText = self:GetText();
if enteredText == "" then
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][self:GetParent():GetID()]["FixedDuration"] = nil;
NeedToKnow.ProfileSettings.Groups[self:GetParent():GetID()]["FixedDuration"] = nil;
else
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][self:GetParent():GetID()]["FixedDuration"] = enteredText;
NeedToKnow.ProfileSettings.Groups[self:GetParent():GetID()]["FixedDuration"] = enteredText;
end
NeedToKnow.Update();
end
 
function NeedToKnow.Reset()
NeedToKnow_Settings = CopyTable(NEEDTOKNOW.DEFAULTS);
NeedToKnow_Settings["Spec"][1]["Groups"][1]["Enabled"] = true;
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true;
for groupID = 1, NEEDTOKNOW.MAXGROUPS do
local group = _G["NeedToKnow_Group"..groupID];
group:ClearAllPoints();
group:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", 100, -100 - 100*groupID);
end
NeedToKnow.Update();
NeedToKnow.UIPanel_Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
function NeedToKnow.Cancel()
NeedToKnow_Settings = CopyTable(NeedToKnow_OldSettings);
NeedToKnow.ProfileSettings = CopyTable(NeedToKnow_OldSettings);
-- FIXME: Close context menu if it's open; it may be referring to bar that doesn't exist
NeedToKnow.Update();
end
 
156,7 → 159,7
local panelName = "InterfaceOptionsNeedToKnowAppearancePanel";
if not _G[panelName]:IsVisible() then return end
 
local settings = NeedToKnow_Settings;
local settings = NeedToKnow.ProfileSettings;
local barSpacingSlider = _G[panelName.."BarSpacingSlider"];
local barPaddingSlider = _G[panelName.."BarPaddingSlider"];
 
173,10 → 176,34
NeedToKnow.UpdateBarFontDropDown(panelName);
end
 
-- -----------------------------------
-- INTERFACE OPTIONS PANEL: PROFILE
-- -----------------------------------
 
function NeedToKnow.UIPanel_Profile_OnLoad(self)
local panelName = self:GetName();
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION);
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1);
 
local CurProfileLabel = _G[panelName.."CurrentProfileLabel"];
CurProfileLabel:SetText("Current Profile:"); -- FIXME: Localization
CurProfileLabel:SetWidth(50);
end
 
function NeedToKnow.UIPanel_Profile_OnShow()
NeedToKnow.UIPanel_Profile_Update();
end
 
function NeedToKnow.UIPanel_Profile_Update()
local panelName = "InterfaceOptionsNeedToKnowProfilePanel";
if not _G[panelName]:IsVisible() then return end
end
 
-- -----
 
function NeedToKnow.UpdateBarTextureSlider(info, value)
getglobal(info:GetName().."Label"):SetText(textureList[value]);
NeedToKnow_Settings["BarTexture"] = textureList[value];
NeedToKnow.ProfileSettings["BarTexture"] = textureList[value];
NeedToKnow.Update();
end
 
184,7 → 211,7
local fontName = fontList[value];
local fontPath = LSM:Fetch("font", fontName);
getglobal(info:GetName().."Label"):SetText(fontName);
NeedToKnow_Settings["BarFont"] = fontPath;
NeedToKnow.ProfileSettings["BarFont"] = fontPath;
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
end
192,7 → 219,7
 
function NeedToKnow.ChooseColor(variable)
info = UIDropDownMenu_CreateInfo();
info.r, info.g, info.b, info.opacity = unpack(NeedToKnow_Settings[variable]);
info.r, info.g, info.b, info.opacity = unpack(NeedToKnow.ProfileSettings[variable]);
info.opacity = 1 - info.opacity;
info.hasOpacity = true;
info.opacityFunc = NeedToKnow.SetOpacity;
208,16 → 235,16
function NeedToKnow.SetColor()
local variable = ColorPickerFrame.extraInfo;
local r,g,b = ColorPickerFrame:GetColorRGB();
NeedToKnow_Settings[variable][1] = r;
NeedToKnow_Settings[variable][2] = g;
NeedToKnow_Settings[variable][3] = b;
NeedToKnow.ProfileSettings[variable][1] = r;
NeedToKnow.ProfileSettings[variable][2] = g;
NeedToKnow.ProfileSettings[variable][3] = b;
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
end
 
function NeedToKnow.SetOpacity()
local variable = ColorPickerFrame.extraInfo;
NeedToKnow_Settings[variable][4] = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.ProfileSettings[variable][4] = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
end
225,7 → 252,7
function NeedToKnow.CancelColor(previousValues)
if ( previousValues ) then
local variable = ColorPickerFrame.extraInfo;
NeedToKnow_Settings[variable] = {previousValues.r, previousValues.g, previousValues.b, previousValues.opacity};
NeedToKnow.ProfileSettings[variable] = {previousValues.r, previousValues.g, previousValues.b, previousValues.opacity};
NeedToKnow.Update();
NeedToKnow.UIPanel_Appearance_Update();
end
238,12 → 265,12
getglobal(panelName.."BarTextureSliderLow"):SetText('');
getglobal(panelName.."BarTextureSliderHigh"):SetText('');
local textureLabel = getglobal(panelName.."BarTextureSliderLabel");
textureLabel:SetText(NeedToKnow_Settings["BarTexture"]);
textureLabel:SetText(NeedToKnow.ProfileSettings["BarTexture"]);
local fn = textureLabel:GetFont();
textureLabel:SetFont(fn, 10); -- There's got to be some way to say this in the xml
getglobal(panelName.."BarTextureSliderText"):SetText(NEEDTOKNOW.UIPANEL_BARTEXTURE);
for i=1, #(textureList) do
if textureList[i] == NeedToKnow_Settings.BarTexture then
if textureList[i] == NeedToKnow.ProfileSettings.BarTexture then
barTextureSlider:SetValue(i);
end
end
258,11 → 285,11
getglobal(panelName.."BarFontSliderText"):SetText(NEEDTOKNOW.UIPANEL_BARFONT);
 
for i=1, #(fontList) do
if ( LSM:Fetch("font", fontList[i]) == NeedToKnow_Settings.BarFont ) then
if ( LSM:Fetch("font", fontList[i]) == NeedToKnow.ProfileSettings.BarFont ) then
barFontSlider:SetValue(i);
local lbl = getglobal(panelName.."BarFontSliderLabel");
lbl:SetText(fontList[i]);
lbl:SetFont(NeedToKnow_Settings.BarFont, 10);
lbl:SetFont(NeedToKnow.ProfileSettings.BarFont, 10);
end
end
end
496,7 → 523,7
function NeedToKnow.BarMenu_Initialize()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local barSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
 
if ( barSettings.MissingBlink.a == 0 ) then
barSettings.blink_enabled = false;
573,7 → 600,7
function NeedToKnow.BarMenu_ToggleSetting(self, a1, a2, checked)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local barSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
barSettings[self.value] = self.checked;
local level = NeedToKnow.BarMenu_GetItemLevel(self);
 
672,7 → 699,7
function NeedToKnow.BarMenu_ChooseSetting(self, a1, a2, checked)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local barSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID]
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID]
barSettings[UIDROPDOWNMENU_MENU_VALUE] = self.value;
NeedToKnow.Bar_Update(groupID, barID);
 
710,7 → 737,7
local edit = _G[dialog:GetName().."EditBox"];
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local barSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
local curval;
if ( dialog.variable ~= "ImportExport" ) then
curval = barSettings[dialog.variable];
736,7 → 763,7
function NeedToKnow.BarMenu_ChooseName(text, variable)
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local barSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID];
local barSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID];
if ( variable ~= "ImportExport" ) then
barSettings[variable] = text;
-- else
783,7 → 810,7
function NeedToKnow.BarMenu_SetColor()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local varSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.r,varSettings.g,varSettings.b = ColorPickerFrame:GetColorRGB();
NeedToKnow.Bar_Update(groupID, barID);
792,7 → 819,7
function NeedToKnow.BarMenu_SetOpacity()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local varSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.a = 1 - OpacitySliderFrame:GetValue();
NeedToKnow.Bar_Update(groupID, barID);
802,7 → 829,7
if ( previousValues.r ) then
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
local varSettings = NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
local varSettings = NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID][ColorPickerFrame.extraInfo];
 
varSettings.r = previousValues.r;
varSettings.g = previousValues.g;
815,7 → 842,7
function NeedToKnow.BarMenu_ClearSettings()
local groupID = NeedToKnow.CurrentBar["groupID"];
local barID = NeedToKnow.CurrentBar["barID"];
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Bars"][barID] = CopyTable(NEEDTOKNOW.BAR_DEFAULTS);
NeedToKnow.ProfileSettings.Groups[groupID]["Bars"][barID] = CopyTable(NEEDTOKNOW.BAR_DEFAULTS);
NeedToKnow.Bar_Update(groupID, barID);
CloseDropDownMenus();
end
875,7 → 902,7
end
 
function NeedToKnow.SetWidth(groupID, width)
for barID = 1, NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["NumberBars"] do
for barID = 1, NeedToKnow.ProfileSettings.Groups[groupID]["NumberBars"] do
local bar = _G["NeedToKnow_Group"..groupID.."Bar"..barID];
local background = _G[bar:GetName().."Background"];
local text = _G[bar:GetName().."Text"];
883,18 → 910,18
text:SetWidth(width-60);
NeedToKnow.SizeBackground(bar, bar.settings.show_icon);
end
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Width"] = width; -- move this to StopSizing?
NeedToKnow.ProfileSettings.Groups[groupID]["Width"] = width; -- move this to StopSizing?
end
 
function NeedToKnow.StopSizing(self, button)
self:SetScript("OnUpdate", nil)
local groupID = self:GetParent():GetID();
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Scale"] = self:GetParent():GetScale();
NeedToKnow.ProfileSettings.Groups[groupID]["Scale"] = self:GetParent():GetScale();
NeedToKnow.SavePosition(self:GetParent(), groupID);
end
 
function NeedToKnow.SavePosition(group, groupID)
groupID = groupID or group:GetID();
local point, _, relativePoint, xOfs, yOfs = group:GetPoint();
NeedToKnow_Settings["Spec"][NEEDTOKNOW.CURRENTSPEC]["Groups"][groupID]["Position"] = {point, relativePoint, xOfs, yOfs};
NeedToKnow.ProfileSettings.Groups[groupID]["Position"] = {point, relativePoint, xOfs, yOfs};
end