/branches
NEEDTOKNOW.BARMENU_BARCOLOR = "Bar color"; |
NEEDTOKNOW.BARMENU_CLEARSETTINGS = "Clear settings"; |
NEEDTOKNOW.UIPANEL_SUBTEXT1 = "These options allow you to customize NeedToKnow's timer bars."; |
NEEDTOKNOW.UIPANEL_SUBTEXT1 = "These options allow you to customize NeedToKnow's timer bar groups."; |
-- NEEDTOKNOW.UIPANEL_SUBTEXT2 = "Bars work when locked. When unlocked, you can move/size bar groups and right click individual bars for more settings. You can also type '/needtoknow' or '/ntk' to lock/unlock."; |
NEEDTOKNOW.UIPANEL_BARGROUP = "Group "; |
NEEDTOKNOW.UIPANEL_NUMBERBARS = "Number of bars"; |
NEEDTOKNOW.UIPANEL_PLAYMODE = "Play mode"; |
NEEDTOKNOW.UIPANEL_PLAYMODE_TOOLTIP = "Lock and enable timer bars, making them click-through"; |
NEEDTOKNOW.UIPANEL_APPEARANCE_SUBTEXT1 = "These options allow you to customize NeedToKnow's timer bars."; |
NEEDTOKNOW.UIPANEL_APPEARANCE = "Appearance"; |
NEEDTOKNOW.UIPANEL_BACKGROUNDCOLOR = "Background color"; |
NEEDTOKNOW.UIPANEL_BARSPACING = "Bar spacing"; |
NEEDTOKNOW.UIPANEL_BARTEXTURE = "Bar texture"; |
NEEDTOKNOW.UIPANEL_BARFONT = "Bar font"; |
NEEDTOKNOW.UIPANEL_FONT = "Font"; |
NEEDTOKNOW.UIPANEL_PROFILES_SUBTEXT1 = "These options allow you to manage profiles. Each profile is a complete NeedToKnow configuration for one talent spec.\nBy default, profiles are per-character (and have character: in front of their name.) Per-character profiles are only available to this character. Profiles can be switched between per-character and per-account so that the same profile can be used by multiple characters on the same account."; |
NEEDTOKNOW.UIPANEL_CURRENTPRIMARY = "Current Primary Profile:"; |
NEEDTOKNOW.UIPANEL_CURRENTSECONDARY = "Current Secondary Profile:"; |
NEEDTOKNOW.UIPANEL_PROFILE = "Profile"; |
NEEDTOKNOW.UIPANEL_SWITCHPROFILE_TOOLTIP = "Switch to using the currently selected profile"; |
NEEDTOKNOW.UIPANEL_DELETEPROFILE_TOOLTIP = "Permanently delete the currently selected profile"; |
NEEDTOKNOW.UIPANEL_PRIVATEPROFILE_TOOLTIP = "Make the selected profile accessible only to the current character"; |
NEEDTOKNOW.UIPANEL_PUBLICPROFILE_TOOLTIP = "Make the selected profile accessible to all the characters on the same account"; |
NEEDTOKNOW.UIPANEL_RENAMEPROFILE_TOOLTIP = "Change the name of this profile"; |
NEEDTOKNOW.UIPANEL_PROFILE_SWITCHTO = "Switch To"; |
NEEDTOKNOW.UIPANEL_PROFILE_DELETE = "Delete"; |
NEEDTOKNOW.UIPANEL_PROFILE_DUPLICATE = "Duplicate"; |
NEEDTOKNOW.UIPANEL_PROFILE_NAMELABEL = "New profile name:"; |
NEEDTOKNOW.UIPANEL_PROFILE_RENAME = "Rename"; |
NEEDTOKNOW.UIPANEL_PROFILE_MAKEPUBLIC = "To Account"; |
NEEDTOKNOW.UIPANEL_PROFILE_MAKEPRIVATE = "Only This Char"; |
NEEDTOKNOW.BARMENU_TOTEM = "Totem"; |
NEEDTOKNOW.BARMENU_CASTCD = "Spell Cooldown"; |
</Anchor> |
</Anchors> |
</FontString> |
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP"> |
<FontString name="$parentSubText1" inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="5" justifyH="LEFT" justifyV="TOP"> |
<Size> |
<AbsDimension y="24" x="0"/> |
<AbsDimension y="48" x="0"/> |
</Size> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT"> |
</Layer> |
</Layers> |
<Frames> |
<Button name="$parentSwitchToBtn" text="Switch To" inherits="UIPanelButtonTemplate" parentKey="SwitchToBtn"> |
<Button name="$parentSwitchToBtn" inherits="UIPanelButtonTemplate" parentKey="SwitchToBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchor point="RIGHT" x ="-10" /> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_SWITCHTO); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_SwitchToSelected(self:GetParent()); |
</OnClick> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<Button name="$parentDeleteBtn" text="Delete" inherits="UIPanelButtonTemplate" parentKey="DeleteBtn"> |
<Button name="$parentDeleteBtn" inherits="UIPanelButtonTemplate" parentKey="DeleteBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchor point="TOPRIGHT" relativeTo="$parentSwitchToBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_DELETE); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_DeleteSelected(self:GetParent()); |
</OnClick> |
<NormalFont style="GameFontNormalSmall"/> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<Button name="$parentPublicBtn" inherits="UIPanelButtonTemplate" parentKey="PublicBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="$parentDeleteBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_MAKEPUBLIC); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(self:GetParent(), true); |
</OnClick> |
<OnEnter> |
GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); |
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PUBLICPROFILE_TOOLTIP, nil, nil, nil, nil, 1); |
</OnEnter> |
<OnLeave function="GameTooltip_Hide"/> |
</Scripts> |
<NormalFont style="GameFontNormalSmall"/> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<Button name="$parentPrivateBtn" inherits="UIPanelButtonTemplate" parentKey="PrivateBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="$parentDeleteBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_MAKEPRIVATE); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(self:GetParent(), false); |
</OnClick> |
<OnEnter> |
GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); |
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PRIVATEPROFILE_TOOLTIP, nil, nil, nil, nil, 1); |
</OnEnter> |
<OnLeave function="GameTooltip_Hide"/> |
</Scripts> |
<NormalFont style="GameFontNormalSmall"/> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
</Frames> |
<Layers> |
<Layer level="ARTWORK"> |
<FontString name="$parentEditLabel" inherits="GameFontNormalSmall" text="New profile name:" nonspacewrap="true" maxLines="1" justifyH="LEFT" justifyV="TOP"> |
<FontString name="$parentEditLabel" inherits="GameFontNormalSmall" nonspacewrap="true" maxLines="1" justifyH="LEFT" justifyV="TOP"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentDeleteBtn" relativePoint="BOTTOMLEFT" y="-20"/> |
<Anchor point="TOPLEFT" relativeTo="$parentPublicBtn" relativePoint="BOTTOMLEFT" y="-30"/> |
</Anchors> |
</FontString> |
</Layer> |
<OnTabPressed> |
self:ClearFocus() |
</OnTabPressed> |
<OnChar> |
<OnTextChanged> |
NeedToKnowOptions.UpdateProfileList() |
</OnChar> |
</OnTextChanged> |
<OnLoad> |
_G[self:GetParent():GetName().."EditLabel"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_NAMELABEL); |
self:SetTextColor(1,1,1) |
</OnLoad> |
</Scripts> |
</EditBox> |
<Button name="$parentCopyBtn" text="Duplicate" inherits="UIPanelButtonTemplate" parentKey="CopyBtn"> |
<Button name="$parentCopyBtn" inherits="UIPanelButtonTemplate" parentKey="CopyBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchor point="RIGHT" relativeTo="$parentDeleteBtn" relativePoint="RIGHT" x="-2"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_DUPLICATE); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_CopySelected(self:GetParent()); |
</OnClick> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<Button name="$parentRenameBtn" text="Rename" inherits="UIPanelButtonTemplate" parentKey="RenameBtn"> |
<Button name="$parentRenameBtn" inherits="UIPanelButtonTemplate" parentKey="RenameBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchor point="TOPRIGHT" relativeTo="$parentCopyBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnLoad> |
_G[self:GetName().."Text"]:SetText(NEEDTOKNOW.UIPANEL_PROFILE_RENAME); |
</OnLoad> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_RenameSelected(self:GetParent()); |
</OnClick> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<!--Button name="$parentPublicBtn" text="Make Public" inherits="UIPanelButtonTemplate" parentKey="PublicBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="$parentRenameBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(self:GetParent(), true); |
</OnClick> |
<OnEnter> |
GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); |
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PUBLICPROFILE_TOOLTIP, nil, nil, nil, nil, 1); |
</OnEnter> |
<OnLeave function="GameTooltip_Hide"/> |
</Scripts> |
<NormalFont style="GameFontNormalSmall"/> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button> |
<Button name="$parentPrivateBtn" text="Make Private" inherits="UIPanelButtonTemplate" parentKey="PrivateBtn"> |
<Size> |
<AbsDimension x="128" y="22"/> |
</Size> |
<Anchors> |
<Anchor point="TOPRIGHT" relativeTo="$parentRenameBtn" relativePoint="BOTTOMRIGHT" y="-16"/> |
</Anchors> |
<Scripts> |
<OnClick> |
NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(self:GetParent(), false); |
</OnClick> |
<OnEnter> |
GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); |
GameTooltip:SetText(NEEDTOKNOW.UIPANEL_PRIVATEPROFILE_TOOLTIP, nil, nil, nil, nil, 1); |
</OnEnter> |
<OnLeave function="GameTooltip_Hide"/> |
</Scripts> |
<NormalFont style="GameFontNormalSmall"/> |
<HighlightFont style="GameFontHighlightSmall"/> |
</Button--> |
<Frame name="$parentProfiles" inherits="NeedToKnowScrollFrameTemplate" parentKey="Profiles"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parentSubText1" relativePoint="BOTTOMLEFT" y="-16"/> |
end |
if key then |
NeedToKnow.ChangeProfile(key) |
NeedToKnowOptions.UIPanel_Profile_Update() |
else |
print("Could not find a profile named '",profileName,"'"); |
end |
local panelName = self:GetName() |
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION) |
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1) |
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_APPEARANCE_SUBTEXT1) |
self.Textures.fnClick = NeedToKnowOptions.OnClickTextureItem |
self.Textures.configure = function(i, btn, label) |
local panelName = self:GetName(); |
_G[panelName.."Version"]:SetText(NEEDTOKNOW.VERSION); |
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_SUBTEXT1); |
_G[panelName.."ProfilesTitle"]:SetText("Current Profile:") -- FIXME localization |
_G[panelName.."SubText1"]:SetText(NEEDTOKNOW.UIPANEL_PROFILES_SUBTEXT1); |
self.Profiles.configure = function(i, btn, label) |
btn.Bg:SetTexture(NeedToKnow.LSM:Fetch("statusbar","Minimalist")) |
self.Profiles.fnClick = function(self) |
local scrollPanel = self:GetParent():GetParent():GetParent() |
scrollPanel.curSel = self.text:GetText() |
NeedToKnowOptions.UpdateProfileList(scrollPanel) |
NeedToKnowOptions.UpdateProfileList() |
end |
end |
function NeedToKnowOptions.UIPanel_Profile_Update() |
local panelName = "InterfaceOptionsNeedToKnowProfilePanel"; |
local title |
if ( GetActiveTalentGroup() == 1 ) then |
_G[panelName.."ProfilesTitle"]:SetText(NEEDTOKNOW.UIPANEL_CURRENTPRIMARY) |
else |
_G[panelName.."ProfilesTitle"]:SetText(NEEDTOKNOW.UIPANEL_CURRENTSECONDARY) |
end |
local self = _G[panelName] |
if not self:IsVisible() then return end |
NeedToKnowOptions.UpdateProfileList() |
function NeedToKnowOptions.RebuildProfileList(profilePanel) |
local scrollPanel = profilePanel.Profiles |
local oldKey |
if ( scrollPanel.curSel and scrollPanel.profileMap ) then |
oldKey = scrollPanel.profileMap[scrollPanel.curSel].key |
end |
if not scrollPanel.profileNames then |
scrollPanel.profileNames = { } |
end |
if not scrollPanel.profileMap then |
scrollPanel.profileMap = { } |
end |
scrollPanel.profileMap = { } |
local allNames = scrollPanel.profileNames |
local allRefs = scrollPanel.profileMap |
local n = 0 |
local subList = NeedToKnow_Profiles |
if subList then |
for profKey, rProfile in pairs(subList) do |
n = n + 1 |
local profName |
if profKey:byte(1) == 71 then -- G |
profName = 'Account:'..rProfile.name -- FIXME: Localization |
if NeedToKnow_Globals.Profiles[profKey] == rProfile then |
profName = 'Account: '..rProfile.name -- FIXME: Localization |
else |
profName = 'Character:'..rProfile.name -- Fixme: Character-Server: |
profName = 'Character: '..rProfile.name -- Fixme: Character-Server: |
end |
allNames[n] = profName |
allRefs[profName] = { ref = rProfile, global=true, key=profKey } |
if ( profKey == oldKey ) then |
scrollPanel.curSel = profName; |
end |
end |
end |
while n < #allNames do |
end |
table.sort(allNames, function(lhs,rhs) return string.upper(lhs)<string.upper(rhs) end ) |
NeedToKnowOptions.UpdateProfileList(scrollPanel) |
NeedToKnowOptions.UpdateProfileList() |
end |
function NeedToKnowOptions.IsProfileNameAvailable(newName) |
optionsPanel.RenameBtn:Disable() |
optionsPanel.CopyBtn:Disable() |
end |
--local btnScope |
--if scrollPanel.profileMap[curSel].global then |
--optionsPanel.PublicBtn:Hide() |
--optionsPanel.PrivateBtn:Show() |
--btnScope = optionsPanel.PrivateBtn |
--else |
--optionsPanel.PublicBtn:Show() |
--optionsPanel.PrivateBtn:Hide() |
--btnScope = optionsPanel.PublicBtn |
--end |
-- |
--local profileName = scrollPanel.profileMap[curSel].name |
--if scrollPanel.profileMap[ profileName ] == 2 then |
--btnScope:Disable() |
--else |
--btnScope:Enable() |
--end |
local rSelectedProfile = scrollPanel.profileMap[curSel].ref; |
local rSelectedKey = scrollPanel.profileMap[curSel].key; |
if ( rSelectedProfile and rSelectedKey and NeedToKnow_Globals.Profiles[rSelectedKey] == rSelectedProfile ) then |
optionsPanel.PrivateBtn:Show(); |
optionsPanel.PublicBtn:Hide(); |
else |
optionsPanel.PrivateBtn:Hide(); |
optionsPanel.PublicBtn:Show(); |
end |
end |
end |
print("NeedToKnow: Won't delete the active profile!") |
else |
NeedToKnow_Profiles[k] = nil; |
if (k:byte(1) == 71) and NeedToKnow_Globals.Profiles[k] then -- G |
if NeedToKnow_Globals.Profiles[k] then |
print("NeedToKnow: deleted account-wide profile", NeedToKnow_Globals.Profiles[k].name) -- FIXME: Localization |
NeedToKnow_Globals.Profiles[k] = nil; |
elseif NeedToKnow_CharSettings.Profiles[k] then -- C |
elseif NeedToKnow_CharSettings.Profiles[k] then |
print("NeedToKnow: deleted character profile", NeedToKnow_CharSettings.Profiles[k].name) -- FIXME: Localization |
NeedToKnow_CharSettings.Profiles[k] = nil; |
end |
local keyNew = NeedToKnow.CreateProfile(CopyTable(scrollPanel.profileMap[curSel].ref), nil, newName) |
NeedToKnow.ChangeProfile(NeedToKnow_Globals[keyNew]) |
NeedToKnowOptions.RebuildProfileList(panel) |
edit:SetText(""); |
print("NeedToKnow: Copied",curSel,"to",newName,"and made it the active profile") |
end |
end |
local key = scrollPanel.profileMap[scrollPanel.curSel].key |
print("NeedToKnow: Renaming profile",NeedToKnow_Profiles[key].name,"to",newName) |
NeedToKnow_Profiles[key].name = newName; |
edit:SetText(""); |
NeedToKnowOptions.RebuildProfileList(panel) |
end |
end |
--function NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(panel) |
--local scrollPanel = panel.Profiles |
--if scrollPanel.curSel then |
--local profileName = scrollPanel.profileMap[scrollPanel.curSel].name |
--local ref = NeedToKnow_Settings.Profiles[profileName] |
--NeedToKnow_Globals.Profiles[profileName] = ref |
--NeedToKnow_Settings.Profiles[profileName] = nil |
--NeedToKnowOptions.RebuildProfileList(scrollPanel) |
--end |
--end |
-- |
--function NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(panel) |
--local scrollPanel = panel.Profiles |
--if scrollPanel.curSel then |
--local profileName = scrollPanel.profileMap[scrollPanel.curSel].name |
--local ref = NeedToKnow_Globals.Profiles[profileName] |
--NeedToKnow_Settings.Profiles[profileName] = ref |
--NeedToKnow_Globals.Profiles[profileName] = nil |
--NeedToKnowOptions.RebuildProfileList(scrollPanel) |
--end |
--end |
-- |
-- ----- |
function NeedToKnowOptions.UIPanel_Profile_PublicizeSelected(panel) |
local scrollPanel = panel.Profiles |
if scrollPanel.curSel then |
local ref = scrollPanel.profileMap[scrollPanel.curSel].ref |
local key = scrollPanel.profileMap[scrollPanel.curSel].key |
NeedToKnow_Globals.Profiles[key] = ref |
NeedToKnow_CharSettings.Profiles[key] = nil |
NeedToKnowOptions.RebuildProfileList(panel) |
end |
end |
function NeedToKnowOptions.UIPanel_Profile_PrivatizeSelected(panel) |
local scrollPanel = panel.Profiles |
if scrollPanel.curSel then |
local ref = scrollPanel.profileMap[scrollPanel.curSel].ref |
local key = scrollPanel.profileMap[scrollPanel.curSel].key |
NeedToKnow_Globals.Profiles[key] = nil |
NeedToKnow_CharSettings.Profiles[key] = ref |
NeedToKnowOptions.RebuildProfileList(panel) |
end |
end |
----- |
function NeedToKnowOptions.OnClickTextureItem(self) |
NeedToKnow.ProfileSettings["BarTexture"] = self.text:GetText() |
NeedToKnow.Update() |
if NeedToKnow.CharSettings then |
local spec = GetActiveTalentGroup() |
local profile = NeedToKnow.CharSettings.Specs[spec] |
if not profile then |
trace("NeedToKnow: Switching to spec",spec,"for the first time") |
profile = NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec) |
local profile_key = NeedToKnow.CharSettings.Specs[spec] |
if not profile_key then |
print("NeedToKnow: Switching to spec",spec,"for the first time") |
profile_key = NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec) |
end |
NeedToKnow.ChangeProfile(profile); |
NeedToKnow.ChangeProfile(profile_key); |
end |
end |
end |
function NeedToKnow.CompressProfile(profileSettings) |
trace("Compressing",profileSettings) |
-- Remove unused bars/groups |
for iG,vG in ipairs(profileSettings["Groups"]) do |
if iG > profileSettings.nGroups then |
end |
end |
trace("Uncompressing",profileSettings.name) |
NeedToKnow.AddDefaultsToTable(profileSettings, NEEDTOKNOW.PROFILE_DEFAULTS) |
profileSettings.bUncompressed = true |
end |
function NeedToKnow.ChangeProfile(profile) |
if NeedToKnow_Profiles[profile] and |
NeedToKnow.ProfileSettings ~= NeedToKnow_Profiles[profile] then |
function NeedToKnow.ChangeProfile(profile_key) |
if NeedToKnow_Profiles[profile_key] and |
NeedToKnow.ProfileSettings ~= NeedToKnow_Profiles[profile_key] 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_Profiles[profile] |
NeedToKnow.ProfileSettings = NeedToKnow_Profiles[profile_key] |
local spec = GetActiveTalentGroup() |
NeedToKnow.CharSettings.Specs[spec] = profile |
NeedToKnow.CharSettings.Specs[spec] = profile_key |
-- fill in any missing defaults |
NeedToKnow.UncompressProfile(NeedToKnow.ProfileSettings) |
-- Update the bars and options panel (if it's open) |
NeedToKnow.Update() |
NeedToKnowOptions.UIPanel_Update() |
elseif not NeedToKnow_Profiles[profile] then |
print("NeedToKnow profile",profile,"does not exist!") -- FIXME: Localization! |
elseif not NeedToKnow_Profiles[profile_key] then |
print("NeedToKnow profile",profile_key,"does not exist!") -- FIXME: Localization! |
end |
end |
if not keyProfile then |
local n=NeedToKnow_Globals.NextProfile or 1 |
while NeedToKnow_Globals.Profiles["G"..n] do |
while NeedToKnow_Profiles["G"..n] do |
n = n+1 |
end |
NeedToKnow_Globals.NextProfile = n+1 |
keyProfile = "G"..n |
end |
if NeedToKnow_Globals.Profiles[keyProfile] then |
if NeedToKnow_CharSettings.Profiles[keyProfile] then |
print("NeedToKnow: Clearing profile ",nameProfile); -- FIXME - Localization |
else |
print("NeedToKnow: Adding profile",nameProfile) -- FIXME - Localization |
if idxSpec then |
NeedToKnow.CharSettings.Specs[idxSpec] = keyProfile |
end |
NeedToKnow_Globals.Profiles[keyProfile] = settings |
NeedToKnow_CharSettings.Profiles[keyProfile] = settings |
NeedToKnow_Profiles[keyProfile] = settings |
return keyProfile |
end |
end |
for iS,vS in pairs(NeedToKnow_Globals.Profiles) do |
-- DEBUG: This is just to debug the uncompress/compress code by forcing it to happen |
NeedToKnow.UncompressProfile(vS) |
if vS.bUncompressed then |
NeedToKnow.CompressProfile(vS) |
end |
bar:SetPoint("TOPLEFT", "NeedToKnow_Group"..groupID, "TOPLEFT") |
end |
bar:SetPoint("RIGHT", group, "RIGHT", 0, 0) |
trace("Creating bar for", groupID, barID) |
--trace("Creating bar for", groupID, barID) |
end |
local background = _G[barName.."Background"] |
local barSettings = groupSettings["Bars"][barID] |
if not barSettings then |
trace("Adding bar settings for", groupID, barID) |
--trace("Adding bar settings for", groupID, barID) |
barSettings = CopyTable(NEEDTOKNOW.BAR_DEFAULTS) |
groupSettings.Bars[barID] = CopyTable(NEEDTOKNOW.BAR_DEFAULTS) |
end |