d76a52e - Change width/height to global setting
[wowui.git] / OmaRF / RaidFrame.lua
index 015ce88..783cdeb 100644 (file)
@@ -22,9 +22,9 @@ local shieldColor = Settings.ShieldColor;
 local shieldhlColor = Settings.ShieldhlColor;
 local healpredColor = Settings.HealpredColor;
 local healabsorbColor = Settings.HealabsorbColor;
 local shieldhlColor = Settings.ShieldhlColor;
 local healpredColor = Settings.HealpredColor;
 local healabsorbColor = Settings.HealabsorbColor;
+local width, height = Settings.Width, Settings.Height;
 -- placeholders with visible values when error happens
 local positions = {};
 -- placeholders with visible values when error happens
 local positions = {};
-local width, height = 10, 10;
 local anchorX, anchorY = 10, 10;
 local attributes = {};
 
 local anchorX, anchorY = 10, 10;
 local attributes = {};
 
@@ -109,7 +109,7 @@ local function frameHide(frame)
 end
 
 local function showTooltip(frame)
 end
 
 local function showTooltip(frame)
-    GameTooltip_SetDefaultAnchor(GameTooltip, PlayerFrame);
+    GameTooltip_SetDefaultAnchor(GameTooltip, frame);
     GameTooltip:SetUnit(frame:GetAttribute("unit"));
 end
 
     GameTooltip:SetUnit(frame:GetAttribute("unit"));
 end
 
@@ -322,7 +322,14 @@ local function initializeFocus(parent)
     secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
 end
 
     secure:SetAttribute("_onstate-vehicleui", vehicletoggle);
 end
 
+local function loadCharSettings()
+    anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
+    attributes = Settings.Character.Clickheal;
+    positions = Settings.Character.Positions;
+end
+
 local function initialize()
 local function initialize()
+    loadCharSettings();
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5+1);
     CFrame:SetPoint("CENTER", nil, "CENTER", anchorX, anchorY);
     CFrame:SetHeight((height+2)*8);
     CFrame:SetWidth((width+2)*5+1);
@@ -331,13 +338,6 @@ local function initialize()
     initializeFocus(CFrame);
 end
 
     initializeFocus(CFrame);
 end
 
-local function loadCharSettings()
-    width, height = Settings.Character.Width, Settings.Character.Height;
-    anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY;
-    attributes = Settings.Character.Clickheal;
-    positions = Settings.Character.Positions;
-end
-
 -- hiding Blizzard frames somewhat based on ShadowedUF
 local function hideBlizzardRaidButton()
     if InCombatLockdown() then return end
 -- hiding Blizzard frames somewhat based on ShadowedUF
 local function hideBlizzardRaidButton()
     if InCombatLockdown() then return end
@@ -384,24 +384,17 @@ local function hideBlizzardRaid()
     end
 end
 
     end
 end
 
-CFrame:RegisterEvent("ADDON_LOADED");
 CFrame:RegisterEvent("PLAYER_LOGIN");
 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
 CFrame:SetScript("OnEvent", function(self, event, addon)
     if event == "PLAYER_LOGIN" then
 CFrame:RegisterEvent("PLAYER_LOGIN");
 CFrame:RegisterEvent("PLAYER_REGEN_ENABLED");
 CFrame:SetScript("OnEvent", function(self, event, addon)
     if event == "PLAYER_LOGIN" then
+        OmaRFLoadChar();
+        OmaRFIndicators.LoadChar();
         hideBlizzardRaid();
         initialize();
         hideBlizzardRaid();
         initialize();
-    elseif event == "ADDON_LOADED" and addon == "Blizzard_CompactRaidFrames" then
-        -- never really happening unless load order changes
-        hideBlizzardRaid();
     elseif event == "PLAYER_REGEN_ENABLED" then
         -- if CompactRaidFrameManager_UpdateOptionsFlowContainer was called in combat
         -- couldn't hide the button
         hideBlizzardRaidButton();
     elseif event == "PLAYER_REGEN_ENABLED" then
         -- if CompactRaidFrameManager_UpdateOptionsFlowContainer was called in combat
         -- couldn't hide the button
         hideBlizzardRaidButton();
-    elseif event == "ADDON_LOADED" and addon == "OmaRF" then
-        OmaRFLoadChar();
-        loadCharSettings();
-        OmaRFEvents.LoadChar();
-        OmaRFIndicators.LoadChar();
     end
 end);
     end
 end);