local A, L = ... local styleName = L.C.style local backdrop = L.C.backdrop local function RemoveStyle(bar) bar.candyBarBackdrop:Hide() local height = bar:Get("bigwigs:restoreheight") if height then bar:SetHeight(height) end local tex = bar:Get("bigwigs:restoreicon") if tex then bar:SetIcon(tex) bar:Set("bigwigs:restoreicon", nil) bar.candyBarIconFrameBackdrop:Hide() end bar.candyBarDuration:ClearAllPoints() bar.candyBarDuration:SetPoint("TOPLEFT", bar.candyBarBar, "TOPLEFT", 2, 0) bar.candyBarDuration:SetPoint("BOTTOMRIGHT", bar.candyBarBar, "BOTTOMRIGHT", -2, 0) bar.candyBarLabel:ClearAllPoints() bar.candyBarLabel:SetPoint("TOPLEFT", bar.candyBarBar, "TOPLEFT", 2, 0) bar.candyBarLabel:SetPoint("BOTTOMRIGHT", bar.candyBarBar, "BOTTOMRIGHT", -2, 0) end local function StyleBar(bar) local height = bar:GetHeight() bar:Set("bigwigs:restoreheight", height) bar:SetHeight(height/2) local bd = bar.candyBarBackdrop bd:SetBackdrop(backdrop) bd:SetBackdropColor(unpack(backdrop.bgColor)) bd:SetBackdropBorderColor(unpack(backdrop.edgeColor)) bd:ClearAllPoints() bd:SetPoint("TOPLEFT", bar, "TOPLEFT", -backdrop.inset, backdrop.inset) bd:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", backdrop.inset, -backdrop.inset) bd:Show() local tex = bar:GetIcon() if tex then local icon = bar.candyBarIconFrame bar:SetIcon(nil) icon:SetTexture(tex) icon:Show() if bar.iconPosition == "RIGHT" then icon:SetPoint("BOTTOMLEFT", bar, "BOTTOMRIGHT", 5, 0) else icon:SetPoint("BOTTOMRIGHT", bar, "BOTTOMLEFT", -5, 0) end icon:SetSize(height, height) bar:Set("bigwigs:restoreicon", tex) local iconBd = bar.candyBarIconFrameBackdrop iconBd:SetBackdrop(backdrop) iconBd:SetBackdropColor(unpack(backdrop.bgColor)) iconBd:SetBackdropBorderColor(unpack(backdrop.edgeColor)) iconBd:ClearAllPoints() iconBd:SetPoint("TOPLEFT", icon, -backdrop.inset, backdrop.inset) iconBd:SetPoint("BOTTOMRIGHT", icon, backdrop.inset, -backdrop.inset) iconBd:Show() end bar.candyBarLabel:ClearAllPoints() bar.candyBarLabel:SetPoint("BOTTOMLEFT", bar.candyBarBar, "TOPLEFT", 2, 2) bar.candyBarDuration:SetFont(STANDARD_TEXT_FONT, 10, "OUTLINE") bar.candyBarDuration:ClearAllPoints() bar.candyBarDuration:SetPoint("BOTTOMRIGHT", bar.candyBarBar, "TOPRIGHT", -2, 2) bar.candyBarDuration:SetFont(L.C.font, 10, "OUTLINE") end local w, h = unpack(L.C.bar.big) local styleData = { apiVersion = 1, version = 10, barHeight = h*L.C.scale, fontSizeNormal = 10, fontSizeEmphasized = 11, GetSpacing = function(bar) return bar:GetHeight()+6 end, ApplyStyle = StyleBar, BarStopped = RemoveStyle, GetStyleName = function() return styleName end, } local function SkinBigWigsPlugins() if not IsAddOnLoaded("BigWigs_Plugins") then return end if not BigWigsAPI then return end if rSkinDB.resets.bigwigs then BigWigsAPI:RegisterBarStyle(styleName, styleData) rSkinDB.resets.bigwigs = false end -- Force to use style local pending = true hooksecurefunc(BigWigsAPI, "GetBarStyle", function() if pending then BigWigsAPI.GetBarStyle = function() return styleData end pending = nil end end) end -- rSkin:RegisterSkin("BigWigs", SkinBigWigs) rSkin:RegisterSkin("BigWigs_Plugins", SkinBigWigsPlugins)