Quantcast

misc fixes

Steven Jackson [11-16-14 - 22:57]
misc fixes
Filename
Interface/AddOns/SVUI/framework/docks/docks.lua
Interface/AddOns/SVUI/packages/bag/SVBag.lua
Interface/AddOns/SVUI/packages/map/SVMap.lua
Interface/AddOns/SVUI/packages/tip/SVTip.lua
Interface/AddOns/SVUI/scripts/misc.lua
Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua
Interface/AddOns/SVUI_StyleOMatic/components/addons/Recount.lua
Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua
diff --git a/Interface/AddOns/SVUI/framework/docks/docks.lua b/Interface/AddOns/SVUI/framework/docks/docks.lua
index 1e8b865..fcf6a8c 100644
--- a/Interface/AddOns/SVUI/framework/docks/docks.lua
+++ b/Interface/AddOns/SVUI/framework/docks/docks.lua
@@ -146,6 +146,24 @@ end
 SET DOCKBAR FUNCTIONS
 ##########################################################
 ]]--
+local RefreshDockWindows = function(self)
+	-- print(table.dump(self.Data.Windows))
+	for name,window in pairs(self.Data.Windows) do
+		if(window) then
+			if(not InCombatLockdown() or (InCombatLockdown() and (window.IsProtected and not window:IsProtected()))) then
+				if(window.DockButton) then
+					window.DockButton:Deactivate()
+				end
+				if window.Hide then
+					window:Hide()
+				end
+			end
+		else
+			print("Error: No Window Found (" .. name .. ")")
+		end
+	end
+end
+
 local RefreshDockButtons = function(self)
 	for name,docklet in pairs(Dock.Registration) do
 		if(docklet) then
@@ -199,13 +217,8 @@ local ToggleDockletWindow = function(self, button)
 		if(not self.Parent.Window:IsShown()) then
 			self.Parent.Window:Show()
 		end
-
-		if(not frame:IsShown()) then
-			self:Refresh()
-		end
-
+		self:Cycle()
 		frame:Show()
-
 		button:Activate()
 	else
 		button:Deactivate()
@@ -381,8 +394,14 @@ local GetDockablePositions = function(self)
 	local button = self;
 	local name = button:GetName();
 	local currentLocation = Dock.Locations[name];
+	local t;

-	local t = {{ title = "Move This", divider = true }};
+	if(self.GetPreMenuList) then
+		t = self:GetPreMenuList();
+		tinsert(t, { title = "Move This", divider = true })
+	else
+		t = {{ title = "Move This", divider = true }};
+	end

 	for location,option in pairs(DOCK_DROPDOWN_OPTIONS) do
 		if(currentLocation ~= location) then
@@ -529,11 +548,15 @@ local AddToDock = function(self, button)
 	button:SetParent(self.ToolBar);

 	if(button.FrameLink) then
-		local frameName = button.FrameLink:GetName()
+		local frame = button.FrameLink
+		local frameName = frame:GetName()
+		self.Data.Windows[frameName] = frame;
 		Dock.Locations[frameName] = currentLocation;
-		button.FrameLink:ClearAllPoints()
-		button.FrameLink:SetParent(self.Parent.Window)
-		button.FrameLink:FillInner(self.Parent.Window)
+		frame:ClearAllPoints()
+		frame:SetParent(self.Parent.Window)
+		frame:FillInner(self.Parent.Window)
+
+		frame.Parent = self.Parent
 	end

 	-- self:UpdateOrder()
@@ -565,6 +588,7 @@ local RemoveFromDock = function(self, button)
 		local frameName = button.FrameLink:GetName()
 		Dock.Locations[frameName] = nil;
 		button.FrameLink:Hide()
+		self.Data.Windows[frameName] = nil;
 	end

 	button.OrderIndex = 0;
@@ -639,6 +663,7 @@ for location, settings in pairs(DOCK_LOCATIONS) do

 	Dock[location].Bar.Parent = Dock[location];
 	Dock[location].Bar.Refresh = RefreshDockButtons;
+	Dock[location].Bar.Cycle = RefreshDockWindows;
 	Dock[location].Bar.GetDefault = GetDefault;
 	Dock[location].Bar.UnsetDefault = OldDefault;
 	Dock[location].Bar.Toggle = ToggleDockletWindow;
@@ -657,6 +682,7 @@ for location, settings in pairs(DOCK_LOCATIONS) do
 		TipAnchor = settings[4],
 		Default = "",
 		Buttons = {},
+		Windows = {},
 		Order = {},
 	};
 end
@@ -795,6 +821,8 @@ function Dock:NewDocklet(location, globalName, readableName, texture, onclick)
 	frame.Relocate = DockletRelocate;
 	frame.GetButtonSize = DockletButtonSize;

+	newParent.Bar.Data.Windows[globalName] = frame;
+
 	local buttonName = ("%sButton"):format(globalName)
 	frame.DockButton = newParent.Bar:Create(readableName, texture, onclick, buttonName);
 	frame.DockButton.FrameLink = frame
@@ -826,6 +854,8 @@ function Dock:NewAdvancedDocklet(location, globalName)
 	frame.Relocate = DockletRelocate;
 	frame.GetButtonSize = DockletButtonSize;

+	newParent.Bar.Data.Windows[globalName] = frame;
+
 	local height = newParent.Bar.ToolBar:GetHeight();
 	local mod = newParent.Bar.Data.Modifier;
 	local barAnchor = newParent.Bar.Data.Anchor;
diff --git a/Interface/AddOns/SVUI/packages/bag/SVBag.lua b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
index 16e4cbf..841f31f 100644
--- a/Interface/AddOns/SVUI/packages/bag/SVBag.lua
+++ b/Interface/AddOns/SVUI/packages/bag/SVBag.lua
@@ -340,7 +340,8 @@ local SlotUpdate = function(self, slotID)
 			slot:SetBackdropColor(0, 0, 0, 0.6)
 			slot:SetBackdropBorderColor(0, 0, 0, 1)
 		end
-	else
+	end
+	if(not texture) then
 		GameTooltip:Hide()
 	end

@@ -350,9 +351,12 @@ local SlotUpdate = function(self, slotID)
 		slot:SetBackdropBorderColor(r, g, b, 1)
 	end

-	if(C_NewItems.IsNewItem(bag, slotID)) then
-		ActionButton_HideOverlayGlow(slot)
-	end
+	-- if(C_NewItems.IsNewItem(bag, slotID)) then
+	-- 	ActionButton_HideOverlayGlow(slot)
+	-- end
+	if(slot.NewItemTexture) then slot.NewItemTexture:Hide() end;
+	if(slot.flashAnim) then slot.flashAnim:Stop() end;
+    if(slot.newitemglowAnim) then slot.newitemglowAnim:Stop() end;

 	SetItemButtonTexture(slot, texture)
 	SetItemButtonCount(slot, count)
@@ -1729,7 +1733,7 @@ end

 local function _toggleBags(id)
 	if id and GetContainerNumSlots(id)==0 then return end
-	if MOD.BagFrame:IsShown()then
+	if MOD.BagFrame:IsShown() then
 		_closeBags()
 	else
 		_openBags()
@@ -1737,7 +1741,7 @@ local function _toggleBags(id)
 end

 local function _toggleBackpack()
-	if IsOptionFrameOpen()then return end
+	if IsOptionFrameOpen() then return end
 	if IsBagOpen(0) then
 		_openBags()
 	else
diff --git a/Interface/AddOns/SVUI/packages/map/SVMap.lua b/Interface/AddOns/SVUI/packages/map/SVMap.lua
index e2b6dcc..2aef419 100644
--- a/Interface/AddOns/SVUI/packages/map/SVMap.lua
+++ b/Interface/AddOns/SVUI/packages/map/SVMap.lua
@@ -420,14 +420,6 @@ local function AdjustMapSize()
 end

 local function UpdateWorldMapConfig()
-	if InCombatLockdown()then return end
-
-	if(not MOD.WorldMapHooked) then
-		NewHook("WorldMap_ToggleSizeUp", AdjustMapSize)
-		NewHook("WorldMap_ToggleSizeDown", SetSmallWorldMap)
-		MOD.WorldMapHooked = true
-	end
-
 	if(not MM_XY_COORD or MM_XY_COORD == "HIDE") then
 		if MOD.CoordTimer then
 			SV.Timers:RemoveLoop(MOD.CoordTimer)
@@ -435,12 +427,18 @@ local function UpdateWorldMapConfig()
 		end
 		SVUI_MiniMapCoords.playerXCoords:SetText("")
 		SVUI_MiniMapCoords.playerYCoords:SetText("")
-		SVUI_MiniMapCoords:Hide()
 	else
-		SVUI_MiniMapCoords:Show()
+		if((not InCombatLockdown()) and (not SVUI_MiniMapCoords:IsShown())) then SVUI_MiniMapCoords:Show() end
 		UpdateMapCoords()
 		MOD.CoordTimer = SV.Timers:ExecuteLoop(UpdateMapCoords, 0.2)
 	end
+
+	if InCombatLockdown()then return end
+	if(not MOD.WorldMapHooked) then
+		NewHook("WorldMap_ToggleSizeUp", AdjustMapSize)
+		NewHook("WorldMap_ToggleSizeDown", SetSmallWorldMap)
+		MOD.WorldMapHooked = true
+	end
 	AdjustMapSize()
 end
 --[[
diff --git a/Interface/AddOns/SVUI/packages/tip/SVTip.lua b/Interface/AddOns/SVUI/packages/tip/SVTip.lua
index 0f64426..eb5f6c3 100644
--- a/Interface/AddOns/SVUI/packages/tip/SVTip.lua
+++ b/Interface/AddOns/SVUI/packages/tip/SVTip.lua
@@ -489,7 +489,11 @@ local _hook_GameTooltip_OnTooltipSetItem = function(self)
 		if left ~= "" or right ~= "" then
 			self:AddLine(" ")
 			self:AddDoubleLine(left,right)
-		end
+		end
+		if(self.InjectedDouble[8]) then
+			self:AddLine(" ");
+			self:AddDoubleLine(unpack(self.InjectedDouble));
+		end
 		self.itemCleared = true
 	end
 end
@@ -624,7 +628,7 @@ local _hook_BNToastOnShow = function(self,anchor,parent,relative,x,y)
 end

 local _hook_OnTipCleared = function(self)
-	self.itemCleared = nil
+	self.itemCleared = nil
 end

 local _hook_OnItemRef = function(link, text, button, chatFrame)
@@ -700,6 +704,7 @@ end

 local _hook_OnTipHide = function(self)
 	self.SuperBorder:ClearMaskColors()
+	wipe(self.InjectedDouble)
 end

 local function ApplyTooltipSkins()
@@ -707,6 +712,9 @@ local function ApplyTooltipSkins()

 	for i, tooltip in pairs(tooltips) do
 		if(not tooltip) then return end
+		if(not tooltip.InjectedDouble) then
+			tooltip.InjectedDouble = {}
+		end
 		if(not tooltip.SuperBorder) then
 			local barOffset = 0
 			local alpha = 0.2
diff --git a/Interface/AddOns/SVUI/scripts/misc.lua b/Interface/AddOns/SVUI/scripts/misc.lua
index 6efb957..68c5e60 100644
--- a/Interface/AddOns/SVUI/scripts/misc.lua
+++ b/Interface/AddOns/SVUI/scripts/misc.lua
@@ -59,9 +59,22 @@ local BuyMaxStack = function(self, ...)
 end

 local MaxStackTooltip = function(self)
-    GameTooltip:AddDoubleLine("[Alt + Click]", "Buy a full stack.", 0, 0.5, 1, 0.5, 1, 0.5)
+	wipe(GameTooltip.InjectedDouble)
+	local itemLink = GetMerchantItemLink(self:GetID())
+	if not itemLink then return end
+	local maxStack = select(8, GetItemInfo(itemLink))
+	if(not (maxStack > 1)) then return end
+    GameTooltip.InjectedDouble[1] = "[Alt + Click]"
+    GameTooltip.InjectedDouble[2] = "Buy a full stack."
+    GameTooltip.InjectedDouble[3] = 0
+    GameTooltip.InjectedDouble[4] = 0.5
+    GameTooltip.InjectedDouble[5] = 1
+    GameTooltip.InjectedDouble[6] = 0.5
+    GameTooltip.InjectedDouble[7] = 1
+    GameTooltip.InjectedDouble[8] = 0.5
 end

+-- hooksecurefunc(GameTooltip, "SetMerchantItem", MaxStackTooltip);
 hooksecurefunc("MerchantItemButton_OnEnter", MaxStackTooltip);
 hooksecurefunc("MerchantItemButton_OnModifiedClick", BuyMaxStack);
 --[[
diff --git a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua
index 1f629b2..7b29516 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/SVUI_StyleOMatic.lua
@@ -402,7 +402,12 @@ end

 local function GetDockableAddons()
 	local test = PLUGIN.cache.Docks[1];
-	local t = {{text = "None", func = function() PLUGIN.cache.Docks[1] = "None"; PLUGIN:RegisterAddonDocklets() end}};
+
+	local t = {
+		{ title = "Docked Addon", divider = true },
+		{text = "Remove All", func = function() PLUGIN.cache.Docks[1] = "None"; PLUGIN:RegisterAddonDocklets() end}
+	};
+
 	for n,l in pairs(DockableAddons) do
 		if (not test or (test and not test:find(n))) then
 			if(n:find("Skada") and _G.Skada) then
@@ -526,7 +531,7 @@ function PLUGIN:Load()

 	self.Docklet = SV.Dock:NewDocklet("BottomRight", "SVUI_StyleOMaticDock", self.TitleID, [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-ADDON]], AddonDockletToggle);
 	SV.Dock.BottomRight.Bar.Button.GetMenuList = GetDockableAddons;
-	self.Docklet.DockButton.GetMenuList = GetDockableAddons;
+	self.Docklet.DockButton.GetPreMenuList = GetDockableAddons;
 	self.Docklet.DockButton:SetAttribute("hasDropDown", true);

 	local dockWidth = self.Docklet:GetWidth()
diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Recount.lua b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Recount.lua
index 8b3eb95..6a06593 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/components/addons/Recount.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/components/addons/Recount.lua
@@ -51,6 +51,40 @@ local function NoColor(a)
   end
 end

+local function StyleFrame(frame)
+  if(not frame) then return end
+  PLUGIN:ApplyFrameStyle(frame,"Transparent")
+  frame.Panel:SetAllPoints()
+  frame.Panel:SetPoint('TOPLEFT', frame, 'TOPLEFT', 0, -6)
+  frame.CloseButton:SetPoint('TOPRIGHT', frame, 'TOPRIGHT', -1, -9)
+  frame:SetBackdrop(nil)
+
+  frame.TitleBackground = CreateFrame('Frame', nil, frame)
+  frame.TitleBackground:SetFixedPanelTemplate("Default")
+  frame.TitleBackground:SetPanelColor("class")
+  frame.TitleBackground:SetPoint('TOP', frame, 'TOP', 0, -8)
+  frame.TitleBackground.timeLapse = 0
+  frame.TitleBackground:SetScript('OnUpdate', function(self,elapsed)
+    self.timeLapse = self.timeLapse + elapsed
+    if(self.timeLapse < 0.2) then
+      return
+    else
+      self.timeLapse = 0
+    end
+    self:SetSize(frame:GetWidth() - 4, 22)
+  end)
+  frame.TitleBackground:SetFrameLevel(frame:GetFrameLevel())
+  frame.Title:SetPoint('TOPLEFT', frame, 'TOPLEFT', 6, -12)
+  NoColor(frame.CloseButton)
+  if frame.ConfigButton then NoColor(frame.ConfigButton) end
+  if frame.FileButton then NoColor(frame.FileButton) end
+  if frame.LeftButton then NoColor(frame.LeftButton) end
+  if frame.ResetButton then NoColor(frame.ResetButton) end
+  if frame.RightButton then NoColor(frame.RightButton) end
+  if frame.ReportButton then NoColor(frame.ReportButton) end
+  if frame.SummaryButton then NoColor(frame.SummaryButton) end
+end
+
 local function StyleRecount()
   assert(Recount, "AddOn Not Loaded")

@@ -58,39 +92,6 @@ local function StyleRecount()
     PLUGIN:LoadAlert(L['Reset Recount?'], function(self) Recount:ResetData() self:GetParent():Hide() end)
   end

-  local function StyleFrame(frame)
-    PLUGIN:ApplyFrameStyle(frame,"Transparent")
-    frame.Panel:SetAllPoints()
-    frame.Panel:SetPoint('TOPLEFT', frame, 'TOPLEFT', 0, -6)
-    frame.CloseButton:SetPoint('TOPRIGHT', frame, 'TOPRIGHT', -1, -9)
-    frame:SetBackdrop(nil)
-
-    frame.TitleBackground = CreateFrame('Frame', nil, frame)
-    frame.TitleBackground:SetFixedPanelTemplate("Default")
-    frame.TitleBackground:SetPanelColor("class")
-    frame.TitleBackground:SetPoint('TOP', frame, 'TOP', 0, -8)
-    frame.TitleBackground.timeLapse = 0
-    frame.TitleBackground:SetScript('OnUpdate', function(self,elapsed)
-      self.timeLapse = self.timeLapse + elapsed
-      if(self.timeLapse < 0.2) then
-        return
-      else
-        self.timeLapse = 0
-      end
-      self:SetSize(frame:GetWidth() - 4, 22)
-    end)
-    frame.TitleBackground:SetFrameLevel(frame:GetFrameLevel())
-    frame.Title:SetPoint('TOPLEFT', frame, 'TOPLEFT', 6, -12)
-    NoColor(frame.CloseButton)
-    if frame.ConfigButton then NoColor(frame.ConfigButton) end
-    if frame.FileButton then NoColor(frame.FileButton) end
-    if frame.LeftButton then NoColor(frame.LeftButton) end
-    if frame.ResetButton then NoColor(frame.ResetButton) end
-    if frame.RightButton then NoColor(frame.RightButton) end
-    if frame.ReportButton then NoColor(frame.ReportButton) end
-    if frame.SummaryButton then NoColor(frame.SummaryButton) end
-  end
-
   local RecountFrames = {
     Recount.MainWindow,
     Recount.ConfigWindow,
@@ -98,15 +99,11 @@ local function StyleRecount()
     Recount.DetailWindow,
   }

-  for _, frame in pairs(RecountFrames) do
-    if frame then
-      StyleFrame(frame)
-    end
-  end
+  for _, frame in pairs(RecountFrames) do StyleFrame(frame) end

   PLUGIN:ApplyScrollFrameStyle(Recount_MainWindow_ScrollBarScrollBar)

-  Recount_MainWindow:HookScript('OnShow', function(self) if InCombatLockdown() then return end if PLUGIN:ValidateDocklet("Recount") then PLUGIN.Docklet:Show() end end)
+  Recount.MainWindow:HookScript('OnShow', function(self) if InCombatLockdown() then return end if PLUGIN:ValidateDocklet("Recount") then PLUGIN.Docklet:Show() end end)
   Recount.MainWindow.FileButton:HookScript('OnClick', function(self) if LibDropdownFrame0 then PLUGIN:ApplyFrameStyle(LibDropdownFrame0) end end)

   hooksecurefunc(Recount, 'ShowScrollbarElements', function(self, name) Recount_MainWindow_ScrollBarScrollBar:Show() end)
@@ -127,10 +124,10 @@ PLUGIN:SaveAddonStyle("Recount", StyleRecount)
 function PLUGIN:Docklet_Recount(parent)
   if not Recount then return end

-  Recount.db.profile.Locked=true;
-  Recount.db.profile.Scaling=1;
-  Recount.db.profile.ClampToScreen=true;
-  Recount.db.profile.FrameStrata='2-LOW'
+  Recount.db.profile.Locked = true;
+  Recount.db.profile.Scaling = 1;
+  Recount.db.profile.ClampToScreen = true;
+  Recount.db.profile.FrameStrata = '2-LOW'
   Recount.MainWindow:ClearAllPoints()
   Recount.MainWindow:SetAllPoints(parent)
   Recount.MainWindow:SetParent(parent)
@@ -139,5 +136,7 @@ function PLUGIN:Docklet_Recount(parent)
   Recount:ResizeMainWindow()
   Recount_MainWindow_ScrollBar:Hide()

+  Recount.MainWindow:Show()
+
   parent.Framelink = Recount.MainWindow
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua
index 4d26725..1879780 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/dressup.lua
@@ -32,7 +32,7 @@ local function DressUpStyle()
 		 return
 	end

-	DressUpFrame:Size(400, 500)
+	DressUpFrame:Size(600, 500)
 	PLUGIN:ApplyWindowStyle(DressUpFrame, true, true)

 	DressUpModel:ClearAllPoints()