Quantcast

reskin bigwigs

rawoil [09-26-21 - 09:42]
reskin bigwigs
Filename
rSkin/modules/BigWigs.lua
rSkin/rSkin.toc
diff --git a/rSkin/modules/BigWigs.lua b/rSkin/modules/BigWigs.lua
index 4be539e..5d4fc08 100644
--- a/rSkin/modules/BigWigs.lua
+++ b/rSkin/modules/BigWigs.lua
@@ -1 +1,110 @@
-local A, L = ...
\ No newline at end of file
+local A, L = ...
+
+local styleName = "ZorkUI"
+
+local backdropBorder = oUF_SimpleConfig.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(backdropBorder)
+    bd:SetBackdropColor(unpack(backdropBorder.bgColor))
+    bd:SetBackdropBorderColor(unpack(backdropBorder.edgeColor))
+
+    bd:ClearAllPoints()
+    bd:SetPoint("TOPLEFT", bar, "TOPLEFT", -backdropBorder.inset, backdropBorder.inset)
+    bd:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", backdropBorder.inset, -backdropBorder.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(backdropBorder)
+        iconBd:SetBackdropColor(unpack(backdropBorder.bgColor))
+        iconBd:SetBackdropBorderColor(unpack(backdropBorder.edgeColor))
+
+        iconBd:ClearAllPoints()
+        iconBd:SetPoint("TOPLEFT", icon, -backdropBorder.inset, backdropBorder.inset)
+        iconBd:SetPoint("BOTTOMRIGHT", icon, backdropBorder.inset, -backdropBorder.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(oUF_SimpleConfig.fonts.expressway, 10, "OUTLINE")
+end
+
+local w, h = unpack(oUF_SimpleConfig.target.size)
+local styleData = {
+    apiVersion = 1,
+    version = 10,
+    barHeight = h,
+    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
+
+	BigWigsAPI:RegisterBarStyle(styleName, styleData)
+
+	-- 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)
\ No newline at end of file
diff --git a/rSkin/rSkin.toc b/rSkin/rSkin.toc
index 5caf73a..7ce098b 100644
--- a/rSkin/rSkin.toc
+++ b/rSkin/rSkin.toc
@@ -3,7 +3,7 @@
 ## Title: rSkin |cff1a9fc0BCC|r
 ## Notes: Reskin other addons to fit zorkui's L&F
 ## RequiredDeps: rLib, rButtonTemplate_Zork, oUF_SimpleConfig
-## OptionalDeps: DBM, WeakAuras, ls_Toasts, Details, BigWigs
+## OptionalDeps: DBM, WeakAuras, ls_Toasts, Details, BigWigs_Plugins

 init.lua
 modules\ls_Toasts.lua