diff --git a/modules/actionbar.lua b/modules/actionbar.lua index c7ced822..827f13cd 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -414,11 +414,7 @@ pfUI:RegisterModule("actionbar", function () end -- equipped item - if IsEquippedAction(sid) and C.bars.showequipped == "1" then - self.equipped:Show() - else - self.equipped:Hide() - end + self.equipped:SetShown(IsEquippedAction(sid) and C.bars.showequipped == "1") end local start, duration, enable, castable, autocast, token @@ -506,11 +502,7 @@ pfUI:RegisterModule("actionbar", function () self.autocast:Hide() end - if castable and C.bars.showcastable == "1" then - self.autocastable:Show() - else - self.autocastable:Hide() - end + self.autocastable:SetShown(castable and C.bars.showcastable == "1") end -- keybinds @@ -1116,7 +1108,7 @@ pfUI:RegisterModule("actionbar", function () end -- macro options - if showmacro == "1" then f.macro:Show() else f.macro:Hide() end + f.macro:SetShown(showmacro == "1") SetAllPointsOffset(f.macro, f, font_offset, -font_offset) f.macro:SetFont(font, macro_size, "OUTLINE") f.macro:SetTextColor(unpack(macro_color)) @@ -1124,7 +1116,7 @@ pfUI:RegisterModule("actionbar", function () f.macro:SetJustifyV("BOTTOM") -- keybind options - if showkybind == "1" then f.keybind:Show() else f.keybind:Hide() end + f.keybind:SetShown(showkybind == "1") SetAllPointsOffset(f.keybind, f, font_offset, -font_offset) f.keybind:SetFont(font, bind_size, "OUTLINE") f.keybind:SetTextColor(unpack(bind_color)) @@ -1133,7 +1125,7 @@ pfUI:RegisterModule("actionbar", function () f.keybind:SetNonSpaceWrap(false) -- item count options - if showcount == "1" then f.count:Show() else f.count:Hide() end + f.count:SetShown(showcount == "1") SetAllPointsOffset(f.count, f, font_offset, -font_offset) f.count:SetFont(font, count_size, "OUTLINE") f.count:SetTextColor(unpack(count_color)) @@ -1232,11 +1224,7 @@ pfUI:RegisterModule("actionbar", function () -- handle pet bar if i == 12 then -- only show when pet actions exists - if PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown() then - bars[i]:Show() - else - bars[i]:Hide() - end + bars[i]:SetShown(PetHasActionBar() or pfUI.unlock and pfUI.unlock:IsShown()) -- show/hide petbar on petbar updates if init then @@ -1256,11 +1244,7 @@ pfUI:RegisterModule("actionbar", function () -- handle shapeshift bar elseif i == 11 then -- only show when shapeshifts exist - if GetNumShapeshiftForms() > 0 then - bars[i]:Show() - else - bars[i]:Hide() - end + bars[i]:SetShown(GetNumShapeshiftForms() > 0) -- update shapeshift bar when amount of spells changes if init then diff --git a/modules/addonbuttons.lua b/modules/addonbuttons.lua index 57e670a8..c0e77d60 100644 --- a/modules/addonbuttons.lua +++ b/modules/addonbuttons.lua @@ -402,11 +402,7 @@ pfUI:RegisterModule("addonbuttons", function () -- rescan before deciding whether the panel should be shown by default pfUI.addonbuttons:ProcessButtons() - if C.abuttons.showdefault == "1" and GetNumButtons() > 0 then - pfUI.addonbuttons:Show() - else - pfUI.addonbuttons:Hide() - end + pfUI.addonbuttons:SetShown(C.abuttons.showdefault == "1" and GetNumButtons() > 0) -- apply workarounds for k, v in pairs(pfUI.addonbuttons.overrides) do diff --git a/modules/autovendor.lua b/modules/autovendor.lua index 64ff7e4f..53596361 100644 --- a/modules/autovendor.lua +++ b/modules/autovendor.lua @@ -86,11 +86,7 @@ pfUI:RegisterModule("autovendor", function () if not pfMerchantFrame_Update then local pfMerchantFrame_Update = MerchantFrame_Update function _G.MerchantFrame_Update() - if MerchantFrame.selectedTab == 1 and C["global"]["autosell"] ~= "1" then - autovendor.button:Show() - else - autovendor.button:Hide() - end + autovendor.button:SetShown(MerchantFrame.selectedTab == 1 and C["global"]["autosell"] ~= "1") pfMerchantFrame_Update() end end diff --git a/modules/bags.lua b/modules/bags.lua index 6457c167..8018bcc4 100644 --- a/modules/bags.lua +++ b/modules/bags.lua @@ -40,11 +40,7 @@ pfUI:RegisterModule("bags", function () -- overwrite some bag functions function _G.OpenAllBags() - if pfUI.bag.right:IsShown() then - pfUI.bag.right:Hide() - else - pfUI.bag.right:Show() - end + pfUI.bag.right:SetShown(not pfUI.bag.right:IsShown()) end function _G.CloseAllBags() @@ -52,11 +48,7 @@ pfUI:RegisterModule("bags", function () end function _G.ToggleBackpack() - if pfUI.bag.right:IsShown() then - pfUI.bag.right:Hide() - else - pfUI.bag.right:Show() - end + pfUI.bag.right:SetShown(not pfUI.bag.right:IsShown()) end function _G.OpenBackpack() @@ -1140,11 +1132,7 @@ pfUI:RegisterModule("bags", function () end) frame.bags:SetScript("OnClick", function() - if pfUI.bag.left.bagslots:IsShown() then - pfUI.bag.left.bagslots:Hide() - else - pfUI.bag.left.bagslots:Show() - end + pfUI.bag.left.bagslots:SetShown(not pfUI.bag.left.bagslots:IsShown()) end) end diff --git a/modules/equipmentmanager.lua b/modules/equipmentmanager.lua index bb5baf85..224b2754 100644 --- a/modules/equipmentmanager.lua +++ b/modules/equipmentmanager.lua @@ -778,7 +778,7 @@ pfUI:RegisterModule("equipmentmanager", function() function UpdatePopouts() local show = PopoutsActive() for _, b in ipairs(popoutButtons) do - if show then b:Show() else b:Hide() end + b:SetShown(show) end if not show then flyout:Hide() end end @@ -831,7 +831,7 @@ pfUI:RegisterModule("equipmentmanager", function() -- uncommitted user changes show immediately. local setIgnored = selectedSetID and GetEffectiveIgnored(selectedSetID) or {} for slotID, overlay in pairs(slotOverlays) do - if frame:IsShown() and selectedSetID and setIgnored[slotID] then overlay:Show() else overlay:Hide() end + overlay:SetShown(frame:IsShown() and selectedSetID and setIgnored[slotID]) end local hasSelection = selectedSetID and true or false @@ -1170,7 +1170,7 @@ pfUI:RegisterModule("equipmentmanager", function() unusedGrid.ScrollBox:SetDataProvider(CreateDataProvider(list), ScrollBoxConstants.RetainScrollPosition) - if total == 0 then unusedPanel.empty:Show() else unusedPanel.empty:Hide() end + unusedPanel.empty:SetShown(total == 0) bagHighlight.active = true bagHighlight.locs = {} diff --git a/modules/farmmode.lua b/modules/farmmode.lua index a158a3c9..1e42ce8d 100644 --- a/modules/farmmode.lua +++ b/modules/farmmode.lua @@ -1,10 +1,6 @@ pfUI:RegisterModule("farmmode", function () local function ToggleFarmMode() - if pfUI.farmmap:IsShown() then - pfUI.farmmap:Hide() - else - pfUI.farmmap:Show() - end + pfUI.farmmap:SetShown(not pfUI.farmmap:IsShown()) end local function MoveNodes(layer) diff --git a/modules/gryphons.lua b/modules/gryphons.lua index 992f3c61..a326e943 100644 --- a/modules/gryphons.lua +++ b/modules/gryphons.lua @@ -37,11 +37,7 @@ pfUI:RegisterModule("gryphons", function () frame.texture:SetTexCoord(1, 0, 0, 1) end - if texture then - frame:Show() - else - frame:Hide() - end + frame:SetShown(texture) end end diff --git a/modules/loothistory.lua b/modules/loothistory.lua index f471339d..3e276b17 100644 --- a/modules/loothistory.lua +++ b/modules/loothistory.lua @@ -266,7 +266,7 @@ pfUI:RegisterModule("loothistory", function () pf.rollicon:SetTexture(ROLL_TEX[rollType] or ROLL_TEX[ROLL_PASS]) if roll and roll > 0 then pf.rolltext:SetText(roll) else pf.rolltext:SetText("") end - if isWinner then pf.winmark:Show() else pf.winmark:Hide() end + pf.winmark:SetShown(isWinner) end local view = CreateScrollBoxListLinearView(2, 2, 4, 4, 2) diff --git a/modules/thirdparty.lua b/modules/thirdparty.lua index 821cd665..5e3cd3fe 100644 --- a/modules/thirdparty.lua +++ b/modules/thirdparty.lua @@ -74,11 +74,7 @@ pfUI:RegisterModule("thirdparty", function() -- show/hide right chatframe if pfUI.chat and C.chat.right.enable == "1" then -- make sure the panel header stays hidden - if self.state then - pfUI.chat.right.panelTop:Show() - else - pfUI.chat.right.panelTop:Hide() - end + pfUI.chat.right.panelTop:SetShown(self.state) -- set chat visibility pfUI.chat.right:SetAlpha(self.state and 1 or 0) diff --git a/modules/unitxp.lua b/modules/unitxp.lua index f6682778..b9af919a 100644 --- a/modules/unitxp.lua +++ b/modules/unitxp.lua @@ -42,11 +42,7 @@ pfUI:RegisterModule("unitxp", function () end local success, behind = pcall(UnitXP, "behind", "player", "target") - if success and behind then - this.text:Show() - else - this.text:Hide() - end + this.text:SetShown(success and behind) end) pfUI.uf.target.behindIndicator = behindFrame @@ -76,11 +72,7 @@ pfUI:RegisterModule("unitxp", function () end local success, inSight = pcall(UnitXP, "inSight", "player", "target") - if success and inSight == false then - this.text:Show() - else - this.text:Hide() - end + this.text:SetShown(success and inSight == false) end) pfUI.uf.target.losIndicator = losFrame