WoWInterface SVN NeedToKnow-Updated

Compare Revisions

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

Rev 81 → Rev 83

Kitjan/NeedToKnow/NeedToKnow.xml
31,7 → 31,7
</Layer>
</Layers>
<Frames>
<Button name="$parentResizeButton" frameStrata="HIGH">
<Button name="$parentResizeButton">
<Size>
<AbsDimension x="20" y="20"/>
</Size>
49,8 → 49,8
</Layers>
<Scripts>
<OnLoad>
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLoad>
getglobal(self:GetName().."Texture"):SetVertexColor(0.6, 0.6, 0.6);
</OnLoad>
<OnMouseDown>
NeedToKnow.StartSizing(self, button);
</OnMouseDown>
Kitjan/NeedToKnow/NeedToKnow.lua
11,6 → 11,7
-- -------------
 
NeedToKnow = {}
NeedToKnowLoader = {}
 
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file
 
66,24 → 67,29
append_usable = false,
}
NEEDTOKNOW.GROUP_DEFAULTS = {
Enabled = false,
Enabled = true,
NumberBars = 3,
Scale = 1.0,
Width = 270,
Bars = {},
Bars = { NEEDTOKNOW.BAR_DEFAULTS, NEEDTOKNOW.BAR_DEFAULTS, NEEDTOKNOW.BAR_DEFAULTS },
Position = { "TOPLEFT", "TOPLEFT", 100, -100 },
FixedDuration = nil,
}
NEEDTOKNOW.DEFAULTS = {
Version = NEEDTOKNOW.VERSION,
Locked = false,
OldVersion = NEEDTOKNOW.VERSION,
Profiles = {},
Chars = {},
}
NEEDTOKNOW.CHARACTER_DEFAULTS = {
Specs = {},
Locked = false,
}
NEEDTOKNOW.PROFILE_DEFAULTS = {
nGroups = 1,
Groups = NEEDTOKNOW.GROUP_DEFAULTS,
Groups = { NEEDTOKNOW.GROUP_DEFAULTS },
BarTexture = "BantoBar",
BarFont = "DEFAULT",
BarFont = GameFontHighlight:GetFont(),
BkgdColor = { 0, 0, 0, 0.8 },
BarSpacing = 3,
BarPadding = 3,
115,33 → 121,10
-- ---------------
 
function NeedToKnow.ExecutiveFrame_OnEvent(self, event, ...)
if ( event == "ADDON_LOADED" and select(1,...) == "NeedToKnow") then
if ( not NeedToKnow_Settings ) then
NeedToKnow.Reset()
else
NeedToKnow.SafeUpgrade()
end
if not NeedToKnow.ProfileSettings then
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[ NeedToKnow_Settings.Profiles[1] ]
end
 
if ( not NeedToKnow_Visible ) then
NeedToKnow_Visible = true
end
 
NeedToKnow.last_cast = {} -- [spell][guidTarget] = { time, dur }
NeedToKnow.nSent = 0
NeedToKnow.totem_drops = {} -- array 1-4 of precise times the totems appeared
 
SlashCmdList["NEEDTOKNOW"] = NeedToKnow.SlashCommand
SLASH_NEEDTOKNOW1 = "/needtoknow"
SLASH_NEEDTOKNOW2 = "/ntk"
else
local fnName = "ExecutiveFrame_"..event
local fn = NeedToKnow[fnName]
if ( fn ) then
fn(...)
end
local fnName = "ExecutiveFrame_"..event
local fn = NeedToKnow[fnName]
if ( fn ) then
fn(...)
end
end
 
207,62 → 190,198
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, 4 do -- Prior to 3.2, there were always 4 groups
NeedToKnow.SavePosition(_G["NeedToKnow_Group"..groupID], groupID)
function NeedToKnow.ExecutiveFrame_ADDON_LOADED(addon)
if ( addon == "NeedToKnow") then
if ( not NeedToKnow_Visible ) then
NeedToKnow_Visible = true
end
end
 
NeedToKnow.last_cast = {} -- [spell][guidTarget] = { time, dur }
NeedToKnow.nSent = 0
NeedToKnow.totem_drops = {} -- array 1-4 of precise times the totems appeared
 
SlashCmdList["NEEDTOKNOW"] = NeedToKnow.SlashCommand
SLASH_NEEDTOKNOW1 = "/needtoknow"
SLASH_NEEDTOKNOW2 = "/ntk"
end
end
 
function NeedToKnow.ExecutiveFrame_PLAYER_LOGIN()
NeedToKnowLoader.SafeUpgrade()
NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
NeedToKnow.guidPlayer = UnitGUID("player")
 
local _, player_CLASS = UnitClass("player")
if player_CLASS == "DEATHKNIGHT" then
NeedToKnow.is_DK = 1
NeedToKnow.is_DK = 1
end
 
NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
NeedToKnow_ExecutiveFrame:RegisterEvent("PLAYER_TALENT_UPDATE")
NeedToKnow.Update()
 
NeedToKnow_ExecutiveFrame:UnregisterEvent("PLAYER_LOGIN")
NeedToKnow_ExecutiveFrame:UnregisterEvent("ADDON_LOADED")
NeedToKnow.ExecutiveFrame_ADDON_LOADED = nil
NeedToKnow.ExecutiveFrame_PLAYER_LOGIN = nil
NeedToKnowLoader = nil
end
 
 
function NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
local spec = GetActiveTalentGroup()
 
local profile = NeedToKnow_Settings.Profiles[spec]
 
local profile = NeedToKnow.CharSettings.Specs[spec]
if not profile then
NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec)
profile = NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec)
end
 
 
NeedToKnow.ChangeProfile(profile);
end
 
function NeedToKnow.RemoveDefaultValues(t, def, k)
if not k then k = "" end
if not def then
-- Some obsolete setting, or perhaps bUncompressed
return true
end
if type(t) ~= "table" then
return t == def
end
 
if #t > 0 then
-- An array, like Groups or Bars. Compare each element against def[1]
for i,v in ipairs(t)do
local rhs = def[i]
if not rhs then rhs = def[1] end
if NeedToKnow.RemoveDefaultValues(v, rhs, k .. " " .. i) then
t[i] = nil
end
end
else
for kT, vT in pairs(t) do
if NeedToKnow.RemoveDefaultValues(t[kT], def[kT], k .. " " .. kT) then
t[kT] = nil
end
end
end
local fn = pairs(t)
return fn(t) == nil
end
 
function NeedToKnow.ChangeProfile(profile)
if NeedToKnow_Globals.Profiles[profile] then
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[profile]
function NeedToKnow.CompressProfile(profileSettings)
-- Remove unused bars/groups
for iG,vG in ipairs(profileSettings["Groups"]) do
if iG > profileSettings.nGroups then
profileSettings["Groups"][iG] = nil
elseif vG.NumberBars then
for iB, vB in ipairs(vG["Bars"]) do
if iB > vG.NumberBars then
vG["Bars"][iB] = nil
end
end
end
end
NeedToKnow.RemoveDefaultValues(profileSettings, NEEDTOKNOW.PROFILE_DEFAULTS);
end
 
 
function NeedToKnow.AddDefaultsToTable(t, def, k)
if type(t) ~= "table" then return end
if not def then
return
end
if not k then k = "" end
local n = table.maxn(t)
if n > 0 then
for i=1,n do
local rhs = def[i]
if not rhs then rhs = def[1] end
if not t[i] then
t[i] = NeedToKnow.deepcopy(rhs)
else
NeedToKnow.AddDefaultsToTable(t[i], rhs, k .. " " .. i)
end
end
else
for kD,vD in pairs(def) do
if not t[kD] then
t[kD] = NeedToKnow.deepcopy(vD)
else
NeedToKnow.AddDefaultsToTable(t[kD], vD, k .. " " .. kD)
end
end
end
end
 
function NeedToKnow.UncompressProfile(profileSettings)
-- Make sure the arrays have the right number of elements so that
-- AddDefaultsToTable will find them and fill them in
if profileSettings.nGroups then
if not profileSettings.Groups then
profileSettings.Groups = {}
end
if not profileSettings.Groups[profileSettings.nGroups] then
profileSettings.Groups[profileSettings.nGroups] = {}
end
end
if profileSettings.Groups then
for i,g in ipairs(profileSettings.Groups) do
if g.NumberBars then
if not g.Bars then
g.Bars = {}
end
if not g.Bars[g.NumberBars] then
g.Bars[g.NumberBars] = {}
end
end
end
end
 
NeedToKnow.AddDefaultsToTable(profileSettings, NEEDTOKNOW.PROFILE_DEFAULTS)
if ( not profileSettings["BarFont"] or profileSettings["BarFont"] == "DEFAULT" ) then
profileSettings["BarFont"] = GameFontHighlight:GetFont()
end
 
profileSettings.bUncompressed = true
end
 
 
function NeedToKnow.ChangeProfile(profile)
if NeedToKnow_Globals.Profiles[profile] and
NeedToKnow.ProfileSettings ~= NeedToKnow_Globals.Profiles[profile] then
-- Compress the old profile by removing defaults
if NeedToKnow.ProfileSettings and NeedToKnow.ProfileSettings.bUncompressed then
NeedToKnow.CompressProfile(NeedToKnow.ProfileSettings)
end
 
-- Switch to the new profile
NeedToKnow.ProfileSettings = NeedToKnow_Globals.Profiles[profile]
local spec = GetActiveTalentGroup()
NeedToKnow_Settings.Profiles[spec] = profile
NeedToKnow.CharSettings.Specs[spec] = profile
 
if ( not NeedToKnow.ProfileSettings["BarFont"] or NeedToKnow.ProfileSettings["BarFont"] == "DEFAULT" ) then
NeedToKnow.ProfileSettings["BarFont"] = GameFontHighlight:GetFont()
-- fill in any missing defaults
NeedToKnow.UncompressProfile(NeedToKnow.ProfileSettings)
 
-- Hide any groups not in use
local iGroup = NeedToKnow.ProfileSettings.nGroups + 1
while true do
local group = _G["NeedToKnow_Group"..iGroup]
if not group then
break
end
group:Hide()
iGroup = iGroup + 1
end
 
 
-- Update the bars and options panel (if it's open)
NeedToKnow.Update()
NeedToKnow.UIPanel_Update()
else
elseif not NeedToKnow_Globals.Profiles[profile] then
print("NeedToKnow profile",profile,"does not exist!") -- FIXME: Localization!
end
end
 
 
function NeedToKnow.ExecutiveFrame_COMMENTATOR_ENTER_WORLD()
NeedToKnow.Update()
end
 
 
local function SetStatusBarValue(bar,texture,value,value0)
local pct0 = 0
if value0 then
284,128 → 403,159
end
 
 
function NeedToKnow.Reset()
trace("NeedToKnow.Reset!")
NeedToKnow_Settings = nil
NeedToKnow_Globals = nil
function NeedToKnowLoader.Reset(bResetCharacter)
NeedToKnow_Globals = CopyTable( NEEDTOKNOW.DEFAULTS )
 
if bResetCharacter == nil or bResetCharacter then
NeedToKnow.ResetCharacter()
end
end
 
 
function NeedToKnow.ResetCharacter(bCreateSpecProfile)
local charKey = UnitName("player") .. ' - ' .. GetRealmName();
NeedToKnow_Globals.Chars[charKey] = CopyTable(NEEDTOKNOW.CHARACTER_DEFAULTS)
NeedToKnow.CharSettings = NeedToKnow_Globals.Chars[charKey]
if bCreateSpecProfile == nil or bCreateSpecProfile then
NeedToKnow.ExecutiveFrame_PLAYER_TALENT_UPDATE()
end
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
nameProfile = UnitName("player") .. "-"..GetRealmName() .. "." .. idxSpec
end
trace("Adding profile",nameProfile)
MemberDump(settings)
NeedToKnow_Settings.Profiles[idxSpec] = nameProfile
if NeedToKnow_Globals.Profiles[nameProfile] then
print("NeedToKnow: Clearing profile ",nameProfile); -- FIXME - Localization
else
print("NeedToKnow: Adding profile",nameProfile) -- FIXME - Localization
end
 
NeedToKnow.CharSettings.Specs[idxSpec] = nameProfile
NeedToKnow_Globals.Profiles[nameProfile] = settings
MemberDump(NeedToKnow_Globals.Profiles)
return nameProfile
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 -- 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 = {} }
function NeedToKnowLoader.RoundSettings(t)
for k,v in pairs(t) do
local typ = type(v)
if typ == "number" then
t[k] = tonumber(string.format("%0.4f",v))
elseif typ == "table" then
NeedToKnowLoader.RoundSettings(v)
end
end
end
 
 
function NeedToKnowLoader.MigrateSpec(specSettings, 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
return false
end
 
-- Round floats to 0.00001, since old versions left really stange values of
-- BarSpacing and BarPadding around
NeedToKnowLoader.RoundSettings(specSettings)
specSettings.Spec = nil
specSettings.Locked = nil
specSettings.nGroups = 4
NeedToKnow.CreateProfile(specSettings, idxSpec)
return true
end
 
 
function NeedToKnowLoader.MigrateCharacterSettings()
print("NeedToKnow: Migrating settings from", NeedToKnow_Settings["Version"]);
local oldSettings = NeedToKnow_Settings
NeedToKnow.ResetCharacter(false)
 
-- Blink was controlled purely by the alpha of MissingBlink for awhile,
-- But then I introduced an explicit blink_enabled variable. Fill that in
-- if it's missing
for kS,vS in pairs(oldSettings["Spec"]) do
for kG,vG in pairs(vS["Groups"]) do
for kB,vB in pairs(vG["Bars"]) do
if nil == vB.blink_enabled and vB.MissingBlink then
vB.blink_enabled = vB.MissingBlink.a > 0
end
end
local oldSettings = NeedToKnow_Settings
NeedToKnow_Settings =
{
Version = oldSettings.Version,
Locked = oldSettings.Locked,
Profiles = {},
}
oldSettings.Version = nil
oldSettings.OldVersion = nil
end
end
 
NeedToKnow.CharSettings["Locked"] = oldSettings["Locked"]
 
local bOK
if ( oldSettings["Spec"] ) then -- The Spec member existed from versions 2.4 to 3.1.7
for idxSpec = 1,2 do
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
local newprofile = oldSettings.Spec[idxSpec]
for kD,_ in pairs(NEEDTOKNOW.PROFILE_DEFAULTS) do
if oldSettings[kD] then
newprofile[kD] = oldSettings[kD]
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
bOK = NeedToKnowLoader.MigrateSpec(newprofile, idxSpec)
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 or settings corrupted/lost
print("Old NeedToKnow settings not compatible with current version... starting from scratch")
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"]
tempSettings["Locked"] = nil
NeedToKnow_Settings["Version"] = tempSettings["Version"]
tempSettings["Version"] = nil
tempSettings["nGroups"] = 4
NeedToKnow.CreateProfile(tempSettings, 1);
NeedToKnow.CreateProfile(CopyTable(tempSettings), 2);
elseif oldSettings["Version"] >= "2.0" and oldSettings["Groups"] then
bOK = NeedToKnowLoader.MigrateSpec(oldSettings, 1) and
NeedToKnowLoader.MigrateSpec(CopyTable(oldSettings), 2)
 
-- save group positions if upgrading from version that used layout-local.txt
if ( bOK and NeedToKnow_Settings.Version < "2.1" ) then
for groupID = 1, 4 do -- Prior to 3.2, there were always 4 groups
NeedToKnow.SavePosition(_G["NeedToKnow_Group"..groupID], groupID)
end
end
end
 
NeedToKnow_Settings.OldVersion = NeedToKnow_Settings["Version"]
NeedToKnow_Settings["Version"] = NEEDTOKNOW.VERSION
 
-- Add any new settings
 
if not bOK then
print("Old NeedToKnow character settings corrupted or not compatible with current version... starting from scratch")
NeedToKnow.ResetCharacter()
end
NeedToKnow_Settings = nil
end
 
 
function NeedToKnowLoader.SafeUpgrade()
-- If there had been an error during the previous upgrade, NeedToKnow_Settings
-- may be in an inconsistent, halfway state.
if not NeedToKnow_Globals then
NeedToKnowLoader.Reset(false)
end
 
if NeedToKnow_Settings then -- prior to 3.2
NeedToKnowLoader.MigrateCharacterSettings()
end
-- 3.2 settings sanity check
if not NeedToKnow_Globals or
not NeedToKnow_Globals["Version"] or
not NeedToKnow_Globals.Profiles or
not NeedToKnow_Globals.Chars then
print("NeedToKnow settings corrupted, resetting")
NeedToKnowLoader.Reset()
end
 
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
NeedToKnow.UncompressProfile(vS)
if vS.bUncompressed then
NeedToKnow.CompressProfile(vS)
end
for iG,vG in ipairs(vS["Groups"]) do
for kD, vD in pairs(NEEDTOKNOW.GROUP_DEFAULTS) do
if nil == vG[kD] then
vG[kD] = NeedToKnow.deepcopy(vD)
end
end
for iB, vB in ipairs(vG["Bars"]) do
if nil == vB.blink_enabled and vB.MissingBlink then
vB.blink_enabled = vB.MissingBlink.a > 0
end
for kD, vD in pairs(NEEDTOKNOW.BAR_DEFAULTS) do
if nil == vB[kD] then
vB[kD] = NeedToKnow.deepcopy(vD)
end
end
end
end
end
 
 
 
local charKey = UnitName("player") .. ' - ' .. GetRealmName();
NeedToKnow.CharSettings = NeedToKnow_Globals.Chars[charKey]
if not NeedToKnow.CharSettings then
NeedToKnow.ResetCharacter(false)
end
 
-- TODO: check the required members for existence and delete any corrupted profiles
end
 
 
 
-- Copies anything (int, table, whatever). Unlike CopyTable, deepcopy can
-- recreate a recursive reference structure (CopyTable will stack overflow.)
-- Copied from http://lua-users.org/wiki/CopyTable
455,8 → 605,6
executiveFrame:SetScript("OnEvent", NeedToKnow.ExecutiveFrame_OnEvent)
executiveFrame:RegisterEvent("ADDON_LOADED")
executiveFrame:RegisterEvent("PLAYER_LOGIN")
executiveFrame:RegisterEvent("PLAYER_TALENT_UPDATE")
executiveFrame:RegisterEvent("COMMENTATOR_ENTER_WORLD")
end
 
 
470,9 → 618,10
local group = _G[groupName]
local groupSettings = NeedToKnow.ProfileSettings.Groups[groupID]
 
local bar
for barID = 1, groupSettings.NumberBars do
local barName = groupName.."Bar"..barID
local bar = _G[barName] or CreateFrame("Frame", barName, group, "NeedToKnow_BarTemplate")
bar = _G[barName] or CreateFrame("Frame", barName, group, "NeedToKnow_BarTemplate")
bar:SetID(barID)
 
if ( barID > 1 ) then
487,9 → 636,12
NeedToKnow.ClearScripts(bar)
end
end
local resizeButton = _G[groupName.."ResizeButton"]
resizeButton:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", 8, -8)
 
local barID = groupSettings.NumberBars+1
while true do
local bar = _G[groupName.."Bar"..barID]
bar = _G[groupName.."Bar"..barID]
if bar then
bar:Hide()
NeedToKnow.ClearScripts(bar)
499,9 → 651,7
end
end
 
local resizeButton = _G[groupName.."ResizeButton"]
resizeButton:SetPoint("BOTTOMRIGHT", groupName.."Bar"..groupSettings.NumberBars, "BOTTOMRIGHT", 8, -8)
if ( NeedToKnow_Settings["Locked"] ) then
if ( NeedToKnow.CharSettings["Locked"] ) then
resizeButton:Hide()
else
resizeButton:Show()
540,7 → 690,11
-- 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)
if barID > 1 then
bar:SetPoint("TOPLEFT", "NeedToKnow_Group"..groupID.."Bar"..(barID-1), "BOTTOMLEFT", 0, 0)
else
bar:SetPoint("TOPLEFT", "NeedToKnow_Group"..groupID, "TOPLEFT")
end
bar:SetPoint("RIGHT", group, "RIGHT", 0, 0)
trace("Creating bar for", groupID, barID)
end
648,7 → 802,7
bar.icon:Hide()
end
 
if ( NeedToKnow_Settings["Locked"] ) then
if ( NeedToKnow.CharSettings["Locked"] ) then
-- Set up the bar to be functional
bar:EnableMouse(0)
local enabled = barSettings.Enabled
Kitjan/NeedToKnow/NeedToKnow_Options.lua
12,6 → 12,8
end
 
cmd = args[1]
table.remove(args,1)
 
if not cmd then
NeedToKnow.LockToggle();
elseif ( cmd == NEEDTOKNOW.CMD_RESET ) then
21,11 → 23,11
elseif ( cmd == NEEDTOKNOW.CMD_HIDE ) then
NeedToKnow.Show(false);
elseif ( cmd == NEEDTOKNOW.CMD_PROFILE ) then
if args[2] then
NeedToKnow.ChangeProfile(args[2])
if args[1] then
NeedToKnow.ChangeProfile(table.concat(args, " "))
else
local spec = GetActiveTalentGroup()
local profile = NeedToKnow_Settings.Profiles[spec]
local profile = NeedToKnow.CharSettings.Specs[spec]
print("Current NeedToKnow profile is \""..profile.."\"") -- FIXME: localization!
end
else
34,10 → 36,10
end
 
function NeedToKnow.LockToggle()
if ( NeedToKnow_Settings["Locked"] ) then
NeedToKnow_Settings["Locked"] = false;
if ( NeedToKnow.CharSettings["Locked"] ) then
NeedToKnow.CharSettings["Locked"] = false;
else
NeedToKnow_Settings["Locked"] = true;
NeedToKnow.CharSettings["Locked"] = true;
end
NeedToKnow.Show(true);
PlaySound("UChatScrollButton");
868,6 → 870,7
-- group:ClearAllPoints();
-- group:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", group.oldX, group.oldY);
self.oldCursorX, self.oldCursorY = GetCursorPosition(UIParent);
trace(self, self:GetName(), group, group:GetName())
self.oldWidth = _G[group:GetName().."Bar1"]:GetWidth();
self:SetScript("OnUpdate", NeedToKnow.Sizing_OnUpdate);
end