Quantcast

optimize addon load order

rawoil [07-09-21 - 08:02]
optimize addon load order
Filename
rBag/core.lua
rBag/init.lua
rBag/rBag.toc
rButtonTemplate_Zork/rButtonTemplate_Zork.toc
diff --git a/rBag/core.lua b/rBag/core.lua
index d4b749b..d422a7f 100644
--- a/rBag/core.lua
+++ b/rBag/core.lua
@@ -123,8 +123,8 @@ function Bags:CreateContainer(storagetype, ...)
 	Container:SetScale(1)
 	Container:SetWidth(((ButtonSize + ButtonSpacing) * ItemsPerRow) + 22 - ButtonSpacing)
 	Container:SetPoint(...)
-	Container:SetFrameStrata("MEDIUM")
-	Container:SetFrameLevel(1)
+	-- Container:SetFrameStrata("HIGH")
+	-- Container:SetFrameLevel(1)
 	Container:Hide()
     L.F.CreateBackdrop(Container)
 	Container:EnableMouse(true)
@@ -487,8 +487,8 @@ function Bags:UpdateAllBags()
 			LastButton = Button

             rButtonTemplate:StyleItemButton(Button, L.C.button)
-            Button:SetFrameLevel(0)
-            Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())
+            -- Button:SetFrameLevel(0)
+            -- Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())

 			if not Money.IsMoved then
 				Money:ClearAllPoints()
@@ -557,8 +557,8 @@ function Bags:UpdateAllBankBags()
 		end

         rButtonTemplate:StyleItemButton(Button, L.C.button)
-        Button:SetFrameLevel(0)
-        Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())
+        -- Button:SetFrameLevel(0)
+        -- Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())
 		Bags.SlotUpdate(self, -1, Button)

 		LastButton = Button
@@ -591,8 +591,8 @@ function Bags:UpdateAllBankBags()
 			end

             rButtonTemplate:StyleItemButton(Button, L.C.button)
-            Button:SetFrameLevel(0)
-            Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())
+            -- Button:SetFrameLevel(0)
+            -- Button.Backdrop:SetFrameLevel(Button:GetFrameLevel())
 			Bags.SlotUpdate(self, Bag - 1, Button)

 			LastButton = Button
diff --git a/rBag/init.lua b/rBag/init.lua
index ffb191a..1178fca 100644
--- a/rBag/init.lua
+++ b/rBag/init.lua
@@ -1,10 +1,33 @@
 local A, L = ...

+--check if the button template addon and the action button config theme is available
+if not rButtonTemplate_Zork_ActionButtonConfig then
+  print(A,"rButtonTemplate_Zork_ActionButtonConfig not found","styling not possible")
+  return
+else
+  print(A,"styling buttons using rButtonTemplate_Zork_ActionButtonConfig")
+end
+
+local copyTable = rLib.CopyTable
+
+-----------------------------
+-- Solt Button Style Config
+-----------------------------
+
+--load the default button theme
+local soltButtonConfig = copyTable(rButtonTemplate_Zork_ActionButtonConfig)
+soltButtonConfig.backdrop.edgeSize = 1
+soltButtonConfig.backdrop.insets = {left=0,right=0,top=0,bottom=0}
+soltButtonConfig.backdrop.points = {{"TOPLEFT",0,0},{"BOTTOMRIGHT",0,0}}
+soltButtonConfig.border.alpha = 0
+soltButtonConfig.normalTexture.file = ""
+
 L.dragFrames        = {}
 L.addonName         = A
 L.addonColor        = "ff1a9fc0"
 L.addonShortcut     = "rbag"
 L.F                 = {}
+L.C                 = {}

 -----------------------------
 -- rBag Global
@@ -18,26 +41,23 @@ local mediapath = rLib.mediapath
 -----------------------------
 -- Configs
 -----------------------------
-
-local cfg = {}
-
-cfg.icon = {
+L.C.icon = {
     size = 36,
     spacing = 4,
     columns = 12,
 }

-cfg.sort     = {
+L.C.sort     = {
     enabled = true,
     sortToBottom = false,
 }

-cfg.font     = mediapath .. "expressway.ttf"
-cfg.showQuest = true
-cfg.flashNew  = true
-cfg.showItemLevel = true
+L.C.font     = mediapath .. "expressway.ttf"
+L.C.showQuest = true
+L.C.flashNew  = true
+L.C.showItemLevel = true

-cfg.backdrop = {
+L.C.backdrop = {
     bgFile               = "Interface\\Buttons\\WHITE8x8",
     bgColor              = {0.08, 0.08, 0.1, 0.92},
     edgeFile             = "Interface\\Tooltips\\UI-Tooltip-Border",
@@ -45,68 +65,19 @@ cfg.backdrop = {
     tile                 = false,
     tileEdge             = false,
     tileSize             = 16,
-    edgeSize             = 16,
+    edgeSize             = 3,
     inset                = 3,
     insets               = {left = 3, right = 3, top = 3, bottom = 3}
 }

-cfg.bag = {
+L.C.bag = {
     point        = {"BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", -34, 48},
     extraHeight  = 26,
 }

-cfg.bank = {
+L.C.bank = {
     point        = {"BOTTOMLEFT", UIParent, "BOTTOMLEFT", 34, 48},
     extraHeight  = 40,
 }

-cfg.button = {
-    --backdrop
-    backdrop = {
-        bgFile = "Interface\\AddOns\\rButtonTemplate_Zork\\media\\backdrop",
-        edgeFile = "Interface\\AddOns\\rButtonTemplate_Zork\\media\\backdropBorder",
-        tile = false,
-        tileSize = 1,
-        edgeSize = 1,
-        insets = {left=0,right=0,top=0,bottom=0},
-        backgroundColor = {0.1,0.1,0.1,0.8},
-        borderColor = {0,0,0,1},
-        points = {
-            {"TOPLEFT",0,0},
-            {"BOTTOMRIGHT",0,0}
-        },
-    },
-    --icon
-    icon = {
-        texCoord = {0.1,0.9,0.1,0.9},
-        points = {
-            {"TOPLEFT",1,-1},
-            {"BOTTOMRIGHT",-1,1},
-        },
-    },
-    --border
-    border = {
-        file = _G["ActionButton1Border"]:GetTexture(),
-        blendMode = "ADD",
-        sizeFactor = 1.8,
-        texCoord = {0,1,0,1},
-        alpha = 0
-    },
-    --normalTexture
-    normalTexture = {file=""},
-    --pushedTexture
-    pushedTexture = {file=""},
-    --highlightTexture
-    highlightTexture = {file=""},
-    --checkedTexture
-    checkedTexture = {file=""},
-    --count
-    count = {
-        font = { cfg.font,11,"OUTLINE"},
-        points = {
-            {"BOTTOMRIGHT",0,0},
-        },
-    }
-}
-
-L.C = cfg
\ No newline at end of file
+L.C.button = soltButtonConfig
\ No newline at end of file
diff --git a/rBag/rBag.toc b/rBag/rBag.toc
index bb14fa0..f8d5279 100644
--- a/rBag/rBag.toc
+++ b/rBag/rBag.toc
@@ -2,7 +2,7 @@
 ## Author: rawoil
 ## Title: rBag |cff1a9fc0BCC|r
 ## Notes: Inventory enhancements
-## RequiredDeps: rLib, rButtonTemplate
+## RequiredDeps: rLib, rButtonTemplate_Zork

 libs/SortBags.lua

diff --git a/rButtonTemplate_Zork/rButtonTemplate_Zork.toc b/rButtonTemplate_Zork/rButtonTemplate_Zork.toc
index fe167f5..5372861 100644
--- a/rButtonTemplate_Zork/rButtonTemplate_Zork.toc
+++ b/rButtonTemplate_Zork/rButtonTemplate_Zork.toc
@@ -3,5 +3,6 @@
 ## Title: rButtonTemplate_Zork |cff1a9fc0BCC|r
 ## Notes: Zork's button theme for rButtonTemplate
 ## RequiredDeps: rLib, rButtonTemplate
+## OptionalDeps: rBuffFrame_Zork, rActionBar_Zork

 theme.lua