diff --git a/PerfectRaid_Buffs.lua b/PerfectRaid_Buffs.lua index 735e943..952d7a0 100644 --- a/PerfectRaid_Buffs.lua +++ b/PerfectRaid_Buffs.lua @@ -39,6 +39,7 @@ function Buffs:Initialize() frames = PerfectRaid.frames self:RegisterEvent("DONGLE_PROFILE_CREATED") + self:RegisterEvent("PERFECTRAID_TAB_CHANGED") end function Buffs:Enable() @@ -60,6 +61,12 @@ function Buffs:DONGLE_PROFILE_CREATED(event, db, addon, svname, profileKey) end end +function Buffs:PERFECTRAID_TAB_CHANGED(old,new) + if PROptions_Buffs_Edit and PROptions_Buffs_Edit:IsVisible() then + self:CancelEntry() + end +end + function Buffs:ConfigureButton(button) local font = button:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") font:SetPoint("LEFT", button.rightbox, "LEFT", 3, 0) @@ -138,10 +145,11 @@ Buffs.conditions = { } function Buffs:CreateOptions(opt) + self.options = opt local options = CreateFrame("Frame", "PROptions_Buffs", PROptions) opt:AddOptionsTab(L["Buffs/Debuffs"], options) - self:CreateListFrame(options, 10) + self:CreateListFrame(options, 15) local delete = CreateFrame("Button", "PRBuffs_Delete", options, "PRButtonTemplate") delete:SetText(L["Delete"]) @@ -183,7 +191,7 @@ function Buffs:CreateListFrame(parent, num) local entry = CreateFrame("CheckButton", name, parent) entry:SetScript("OnClick", OnClick) entry:SetHeight(20) - entry:SetWidth(400) + entry:SetWidth(545) entry:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") entry:SetCheckedTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") entry:GetHighlightTexture():SetBlendMode("ADD") @@ -404,27 +412,37 @@ function Buffs:CreateEditFrame(parent) checks[1]:SetPoint("TOPLEFT", disptext, "BOTTOMLEFT", 0, -20) checks[1]:Show() - for i=2,5 do + for i=2,6 do + checks[i] = makeCheck(self.conditions[i]) + checks[i]:SetPoint("TOPLEFT", checks[i-1], "TOPRIGHT", 60, 0) + checks[i]:Show() + end + + checks[7] = makeCheck(self.conditions[7]) + checks[7]:SetPoint("TOPLEFT", checks[1], "BOTTOMLEFT", 0, -10) + checks[7]:Show() + + for i=8,12 do checks[i] = makeCheck(self.conditions[i]) checks[i]:SetPoint("TOPLEFT", checks[i-1], "TOPRIGHT", 60, 0) checks[i]:Show() end - checks[6] = makeCheck(self.conditions[6]) - checks[6]:SetPoint("TOPLEFT", checks[1], "BOTTOMLEFT", 0, -20) - checks[6]:Show() + checks[13] = makeCheck(self.conditions[13]) + checks[13]:SetPoint("TOPLEFT", checks[7], "BOTTOMLEFT", 0, -10) + checks[13]:Show() - for i=7,10 do + for i=14,18 do checks[i] = makeCheck(self.conditions[i]) checks[i]:SetPoint("TOPLEFT", checks[i-1], "TOPRIGHT", 60, 0) checks[i]:Show() end - checks[11] = makeCheck(self.conditions[11]) - checks[11]:SetPoint("TOPLEFT", checks[6], "BOTTOMLEFT", 0, -20) - checks[11]:Show() + checks[19] = makeCheck(self.conditions[19]) + checks[19]:SetPoint("TOPLEFT", checks[13], "BOTTOMLEFT", 0, -10) + checks[19]:Show() - for i=12,12 do + for i=20,20 do checks[i] = makeCheck(self.conditions[i]) checks[i]:SetPoint("TOPLEFT", checks[i-1], "TOPRIGHT", 60, 0) checks[i]:Show() @@ -464,8 +482,8 @@ function Buffs:EditEntry() local options = PROptions_Buffs_Edit options.editEntry = entry - PROptions_Buffs:Hide() - options:Show() + self.options:FadeOut(PROptions_Buffs) + self.options:FadeIn(options) options.buffname:SetText(entry.buffname) options.groupname:SetText(entry.groupname or "") options.disptext:SetText(entry.disptext) @@ -490,7 +508,8 @@ end function Buffs:AddEntry() local options = PROptions_Buffs_Edit - options:Show() + self.options:FadeOut(PROptions_Buffs) + self.options:FadeIn(options) options.buffname:SetText("") options.groupname:SetText("") options.disptext:SetText("") @@ -591,9 +610,9 @@ end function Buffs:CancelEntry() local options = PROptions_Buffs_Edit - options:Hide() + self.options:FadeOut(options) options.editEntry = nil - PROptions_Buffs:Show() + self.options:FadeIn(PROptions_Buffs) end function Buffs:EnableButtons() @@ -608,18 +627,26 @@ function Buffs:EnableButtons() end Buffs.conditions = { - ["All"] = function(u,c) return true end, - ["Warrior"] = function(u,c) return c == "WARRIOR" end, - ["Priest"] = function(u,c) return c == "PRIEST" end, - ["Druid"] = function(u,c) return c == "DRUID" end, - ["Paladin"] = function(u,c) return c == "PALADIN" end, - ["Shaman"] = function(u,c) return c == "SHAMAN" end, - ["Hunter"] = function(u,c) return c == "HUNTER" end, - ["Rogue"] = function(u,c) return c == "ROGUE" end, - ["Warlock"] = function(u,c) return c == "WARLOCK" end, - ["Mage"] = function(u,c) return c == "MAGE" end, - ["Mana"] = function(u,c) return c == "DRUID" or c == "PRIEST" or c == "PALADIN" or c == "SHAMAN" or c == "MAGE" or c == "WARLOCK" or c == "HUNTER" end, - ["Healer"] = function(u,c) return c == "PRIEST" or c == "SHAMAN" or c == "DRUID" or c == "PALADIN" end, + ["All"] = function(u,c,g) return true end, + ["Warrior"] = function(u,c,g) return c == "WARRIOR" end, + ["Priest"] = function(u,c,g) return c == "PRIEST" end, + ["Druid"] = function(u,c,g) return c == "DRUID" end, + ["Paladin"] = function(u,c,g) return c == "PALADIN" end, + ["Shaman"] = function(u,c,g) return c == "SHAMAN" end, + ["Hunter"] = function(u,c,g) return c == "HUNTER" end, + ["Rogue"] = function(u,c,g) return c == "ROGUE" end, + ["Warlock"] = function(u,c,g) return c == "WARLOCK" end, + ["Mage"] = function(u,c,g) return c == "MAGE" end, + ["Mana"] = function(u,c,g) return c == "DRUID" or c == "PRIEST" or c == "PALADIN" or c == "SHAMAN" or c == "MAGE" or c == "WARLOCK" or c == "HUNTER" end, + ["Healer"] = function(u,c,g) return c == "PRIEST" or c == "SHAMAN" or c == "DRUID" or c == "PALADIN" end, + ["Group 1"] = function(u,c,g) return g == 1 end, + ["Group 2"] = function(u,c,g) return g == 2 end, + ["Group 3"] = function(u,c,g) return g == 3 end, + ["Group 4"] = function(u,c,g) return g == 4 end, + ["Group 5"] = function(u,c,g) return g == 5 end, + ["Group 6"] = function(u,c,g) return g == 6 end, + ["Group 7"] = function(u,c,g) return g == 7 end, + ["Group 8"] = function(u,c,g) return g == 8 end, } local work = {} diff --git a/PerfectRaid_Options.lua b/PerfectRaid_Options.lua index 510b1ef..704b003 100644 --- a/PerfectRaid_Options.lua +++ b/PerfectRaid_Options.lua @@ -94,14 +94,55 @@ function Options:AddOptionsTab(title, frame) self:TabOnClick(PROptionsTab1) end +local FADE_IN_LEN = 0.5 +local FADE_OUT_LEN = 0.2 + +local fadeTime = 0 +FadeIn = function(frame, elapsed) + fadeTime = fadeTime + elapsed + if fadeTime > FADE_IN_LEN then + frame:SetAlpha(1.0) + frame:SetScript("OnUpdate", nil) + frame:Show() + fadeTime = 0 + else + frame:SetAlpha(fadeTime / FADE_IN_LEN) + end +end + +local fadeTime = 0 +FadeOut = function(frame, elapsed) + fadeTime = fadeTime + elapsed + if fadeTime > FADE_OUT_LEN then + frame:SetAlpha(0) + frame:SetScript("OnUpdate", nil) + frame:Hide() + fadeTime = 0 + else + frame:SetAlpha(1 - (fadeTime / FADE_OUT_LEN)) + end +end + +function Options:FadeIn(frame) + frame:Show() + frame:SetScript("OnUpdate", FadeIn) +end + +function Options:FadeOut(frame) + frame:SetScript("OnUpdate", FadeOut) +end + local tabselected function Options:TabOnClick(tab) + local old = tabselected + if tabselected then - tabselected.frame:Hide() + self:FadeOut(tabselected.frame) end - tab.frame:Show() + self:FadeIn(tab.frame) tabselected = tab PanelTemplates_SetTab(PROptions, tab.idx) + self:TriggerEvent("PERFECTRAID_TAB_CHANGED", old, tab) end --[[