diff --git a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua index faa017b..f890316 100644 --- a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua +++ b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua @@ -86,7 +86,7 @@ if not lib then return end -- No upgrade needed local CoreName, CoreObject = ... local SchemaFromMeta = "X-SVUISchema"; local HeaderFromMeta = "X-SVUIName"; -local ThemeFromMeta = "X-SVUITheme"; +local ThemeFromMeta = "X-SVUITheme"; local CoreGlobalName = GetAddOnMetadata(..., HeaderFromMeta); local AddonVersion = GetAddOnMetadata(..., "Version"); local InterfaceVersion = select(4, GetBuildInfo()); @@ -106,6 +106,7 @@ local debugHeader = "|cffFF2F00%s|r [|cff992FFF%s|r]|cffFF2F00:|r"; local debugPattern = '|cffFF2F00%s|r [|cff0affff%s|r]|cffFF2F00:|r @|cffFF0000(|r%s|cffFF0000)|r - %s'; local playerClass = select(2,UnitClass("player")); +local playerRealm = GetRealmName(); local playerName = UnitName("player"); local DEFAULT_PROFILE_KEY = ("%s - Default"):format(playerName); local PROFILE_KEY = DEFAULT_PROFILE_KEY; diff --git a/SVUI_!Core/setup/installer.lua b/SVUI_!Core/setup/installer.lua index fe071ab..1248f4a 100644 --- a/SVUI_!Core/setup/installer.lua +++ b/SVUI_!Core/setup/installer.lua @@ -271,18 +271,26 @@ function SV.Setup:ChatConfigs(mungs) forceCVars() local ChatFrame1 = _G.ChatFrame1; - FCF_ResetChatWindows() - FCF_SetLocked(ChatFrame1, 1) - + ChatFrame1.isUninteractable = false; + ChatFrame1:SetMovable(true); local ChatFrame2 = _G.ChatFrame2; - FCF_DockFrame(ChatFrame2) - FCF_SetLocked(ChatFrame2, 2) + if(ChatFrame2) then + ChatFrame2.isUninteractable = false; + ChatFrame2:SetMovable(true); + end + local ChatFrame3 = _G.ChatFrame3; + if(ChatFrame3) then + ChatFrame3.isUninteractable = false; + ChatFrame3:SetMovable(true); + end + FCF_ResetChatWindows() + FCF_SetLocked(ChatFrame1, true) + --FCF_DockFrame(ChatFrame2) + FCF_SetLocked(ChatFrame2, true) FCF_OpenNewWindow(LOOT) - - local ChatFrame3 = _G.ChatFrame3; - FCF_DockFrame(ChatFrame3) - FCF_SetLocked(ChatFrame3, 3) + --FCF_DockFrame(ChatFrame3) + FCF_SetLocked(ChatFrame3, true) for i = 1, NUM_CHAT_WINDOWS do local chat = _G["ChatFrame"..i] diff --git a/SVUI_!Core/system/debug.lua b/SVUI_!Core/system/debug.lua index 5301cc9..48562c6 100644 --- a/SVUI_!Core/system/debug.lua +++ b/SVUI_!Core/system/debug.lua @@ -187,9 +187,34 @@ _G.DebugThisFrame = function(arg) end outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",arg:GetWidth()).."\n" outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",arg:GetHeight()).."\n" - outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..arg:GetFrameStrata().."\n" - outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..arg:GetFrameLevel().."\n" + + if(arg.GetFrameStrata) then + outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..arg:GetFrameStrata().."\n" + end + + if(arg.GetFrameLevel) then + outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..arg:GetFrameLevel().."\n" + end + + if(arg.GetDrawLayer) then + outputString = outputString.."|cff00D1FF".."DrawLayer: |cffFFD100"..arg:GetDrawLayer().."\n" + end + outputString = outputString.."|cff00D1FF".."IsShown: |cffFFD100"..tostring(arg:IsShown()).."\n" + + if(arg.GetAlpha) then + outputString = outputString.."|cff00D1FF".."Alpha: |cffFFD100"..arg:GetAlpha().."\n" + end + + if(arg.GetText) then + outputString = outputString.."|cff00D1FF".."Text: |cffFFD100"..arg:GetText().."\n" + local tr, tg, tb = arg:GetTextColor(); + outputString = outputString.."|cff00D1FF".."Text Color: \n" + outputString = outputString.."|cffFF0000".." Red: |cffFFFFFF "..tr.."\n" + outputString = outputString.."|cff00FF00".." Green: |cffFFFFFF "..tg.."\n" + outputString = outputString.."|cff0000FF".." Blue: |cffFFFFFF "..tb.."\n" + end + if arg.Panel and arg.Panel:GetAttribute("panelPadding") then outputString = outputString.."|cff00D1FF".."Padding: |cffFFD100"..arg.Panel:GetAttribute("panelPadding").."\n" end @@ -208,79 +233,22 @@ _G.DebugThisFrame = function(arg) if relativeTo and relativeTo:GetName() then outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..point.."|r anchored to "..relativeTo:GetName().."'s |cffFFD100"..relativePoint.."\n" end - local bg = arg:GetBackdrop() - if type(bg) == "table" then - outputString = outputString.."|cffFF9900>> BACKDROP --------------------------|r".."\n" - outputString = outputString..tprint(bg, true).."\n" - end - if arg._template then - outputString = outputString.."Template Name: |cff00FF55"..arg._template.."\n" - end - if arg.Panel then - local cpt, crt, crp, cxo, cyo = arg.Panel:GetPoint() - outputString = outputString.."|cffFF8800>> backdropFrame --------------------------|r".."\n" - outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",arg.Panel:GetWidth()).."\n" - outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",arg.Panel:GetHeight()).."\n" - outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..arg.Panel:GetFrameStrata().."\n" - outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..arg.Panel:GetFrameLevel().."\n" - if cxo then - outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" - end - if cyo then - outputString = outputString.."|cff00D1FF".."Y: |cffFFD100"..format("%.2f",cyo).."\n" - end - if crt and crt:GetName() then - outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" - end - bg = arg.Panel:GetBackdrop() + if(arg.GetBackdrop) then + local bg = arg:GetBackdrop() if type(bg) == "table" then outputString = outputString.."|cffFF9900>> BACKDROP --------------------------|r".."\n" outputString = outputString..tprint(bg, true).."\n" end - if arg.Panel.Skin then - local cpt, crt, crp, cxo, cyo = arg.Panel.Skin:GetPoint() - outputString = outputString.."|cffFF7700>> backdropTexture --------------------------|r".."\n" - outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",arg.Panel.Skin:GetWidth()).."\n" - outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",arg.Panel.Skin:GetHeight()).."\n" - if cxo then - outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" - end - if cyo then - outputString = outputString.."|cff00D1FF".."Y: |cffFFD100"..format("%.2f",cyo).."\n" - end - if crt and crt:GetName() then - outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" - end - bg = arg.Panel.Skin:GetTexture() - if bg then - outputString = outputString.."|cff00D1FF".."Texture: |cffFFD100"..bg.."\n" - end + if arg._template then + outputString = outputString.."Template Name: |cff00FF55"..arg._template.."\n" end - end - local childFrames = { arg:GetChildren() } - if #childFrames > 0 then - outputString = outputString.."|cffCC00FF>>>> Child Frames----------------------------".."|r".."\n".."\n" - for _, child in ipairs(childFrames) do - local cpt, crt, crp, cxo, cyo = child:GetPoint() - if child:GetName() then - outputString = outputString.."\n\n|cff00FF55++"..child:GetName().."|r".."\n" - else - outputString = outputString.."\n\n|cff99FF55+!!+".."Anonymous Frame".."|r".."\n" - end - outputString = outputString.."|cffCC00FF----------------------------|r".."\n" - outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child:GetWidth()).."\n" - outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child:GetHeight()).."\n" - outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..child:GetFrameStrata().."\n" - outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..child:GetFrameLevel().."\n" - if child.Panel and child.Panel:GetAttribute("panelID") then - outputString = outputString.."|cff00D1FF".."StyleName: |cffFFD100"..child.Panel:GetAttribute("panelID").."\n" - end - if child.Panel and child.Panel:GetAttribute("panelPadding") then - outputString = outputString.."|cff00D1FF".."Padding: |cffFFD100"..child.Panel:GetAttribute("panelPadding").."\n" - end - if child.Panel and child.Panel:GetAttribute("panelOffset") then - outputString = outputString.."|cff00D1FF".."Offset: |cffFFD100"..child.Panel:GetAttribute("panelOffset").."\n" - end + if arg.Panel then + local cpt, crt, crp, cxo, cyo = arg.Panel:GetPoint() + outputString = outputString.."|cffFF8800>> backdropFrame --------------------------|r".."\n" + outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",arg.Panel:GetWidth()).."\n" + outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",arg.Panel:GetHeight()).."\n" + outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..arg.Panel:GetFrameStrata().."\n" + outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..arg.Panel:GetFrameLevel().."\n" if cxo then outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" end @@ -290,21 +258,55 @@ _G.DebugThisFrame = function(arg) if crt and crt:GetName() then outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" end - bg = child:GetBackdrop() + bg = arg.Panel:GetBackdrop() if type(bg) == "table" then outputString = outputString.."|cffFF9900>> BACKDROP --------------------------|r".."\n" outputString = outputString..tprint(bg, true).."\n" end - if child._template then - outputString = outputString.."Template Name: |cff00FF55"..child._template.."\n" + if arg.Panel.Skin then + local cpt, crt, crp, cxo, cyo = arg.Panel.Skin:GetPoint() + outputString = outputString.."|cffFF7700>> backdropTexture --------------------------|r".."\n" + outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",arg.Panel.Skin:GetWidth()).."\n" + outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",arg.Panel.Skin:GetHeight()).."\n" + if cxo then + outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" + end + if cyo then + outputString = outputString.."|cff00D1FF".."Y: |cffFFD100"..format("%.2f",cyo).."\n" + end + if crt and crt:GetName() then + outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" + end + bg = arg.Panel.Skin:GetTexture() + if bg then + outputString = outputString.."|cff00D1FF".."Texture: |cffFFD100"..bg.."\n" + end end - if child.Panel then - local cpt, crt, crp, cxo, cyo = child.Panel:GetPoint() - outputString = outputString.."|cffFF8800>> backdropFrame --------------------------|r".."\n" - outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child.Panel:GetWidth()).."\n" - outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child.Panel:GetHeight()).."\n" - outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..child.Panel:GetFrameStrata().."\n" - outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..child.Panel:GetFrameLevel().."\n" + end + local childFrames = { arg:GetChildren() } + if #childFrames > 0 then + outputString = outputString.."|cffCC00FF>>>> Child Frames----------------------------".."|r".."\n".."\n" + for _, child in ipairs(childFrames) do + local cpt, crt, crp, cxo, cyo = child:GetPoint() + if child:GetName() then + outputString = outputString.."\n\n|cff00FF55++"..child:GetName().."|r".."\n" + else + outputString = outputString.."\n\n|cff99FF55+!!+".."Anonymous Frame".."|r".."\n" + end + outputString = outputString.."|cffCC00FF----------------------------|r".."\n" + outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child:GetWidth()).."\n" + outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child:GetHeight()).."\n" + outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..child:GetFrameStrata().."\n" + outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..child:GetFrameLevel().."\n" + if child.Panel and child.Panel:GetAttribute("panelID") then + outputString = outputString.."|cff00D1FF".."StyleName: |cffFFD100"..child.Panel:GetAttribute("panelID").."\n" + end + if child.Panel and child.Panel:GetAttribute("panelPadding") then + outputString = outputString.."|cff00D1FF".."Padding: |cffFFD100"..child.Panel:GetAttribute("panelPadding").."\n" + end + if child.Panel and child.Panel:GetAttribute("panelOffset") then + outputString = outputString.."|cff00D1FF".."Offset: |cffFFD100"..child.Panel:GetAttribute("panelOffset").."\n" + end if cxo then outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" end @@ -314,16 +316,21 @@ _G.DebugThisFrame = function(arg) if crt and crt:GetName() then outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" end - bg = child.Panel:GetBackdrop() + bg = child:GetBackdrop() if type(bg) == "table" then outputString = outputString.."|cffFF9900>> BACKDROP --------------------------|r".."\n" outputString = outputString..tprint(bg, true).."\n" end - if child._skin then - local cpt, crt, crp, cxo, cyo = child._skin:GetPoint() - outputString = outputString.."|cffFF7700>> backdropTexture --------------------------|r".."\n" - outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child._skin:GetWidth()).."\n" - outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child._skin:GetHeight()).."\n" + if child._template then + outputString = outputString.."Template Name: |cff00FF55"..child._template.."\n" + end + if child.Panel then + local cpt, crt, crp, cxo, cyo = child.Panel:GetPoint() + outputString = outputString.."|cffFF8800>> backdropFrame --------------------------|r".."\n" + outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child.Panel:GetWidth()).."\n" + outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child.Panel:GetHeight()).."\n" + outputString = outputString.."|cff00D1FF".."Strata: |cffFFD100"..child.Panel:GetFrameStrata().."\n" + outputString = outputString.."|cff00D1FF".."Level: |cffFFD100"..child.Panel:GetFrameLevel().."\n" if cxo then outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" end @@ -333,16 +340,36 @@ _G.DebugThisFrame = function(arg) if crt and crt:GetName() then outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" end - bg = child._skin:GetTexture() - if bg then - outputString = outputString.."|cffFF9900----------------------------|r".."\n" - outputString = outputString..bg.."\n" + bg = child.Panel:GetBackdrop() + if type(bg) == "table" then + outputString = outputString.."|cffFF9900>> BACKDROP --------------------------|r".."\n" + outputString = outputString..tprint(bg, true).."\n" + end + if child._skin then + local cpt, crt, crp, cxo, cyo = child._skin:GetPoint() + outputString = outputString.."|cffFF7700>> backdropTexture --------------------------|r".."\n" + outputString = outputString.."|cff00D1FF".."Width: |cffFFD100"..format("%.2f",child._skin:GetWidth()).."\n" + outputString = outputString.."|cff00D1FF".."Height: |cffFFD100"..format("%.2f",child._skin:GetHeight()).."\n" + if cxo then + outputString = outputString.."|cff00D1FF".."X: |cffFFD100"..format("%.2f",cxo).."\n" + end + if cyo then + outputString = outputString.."|cff00D1FF".."Y: |cffFFD100"..format("%.2f",cyo).."\n" + end + if crt and crt:GetName() then + outputString = outputString.."|cff00D1FF".."Point: |cffFFD100"..cpt.."|r anchored to "..crt:GetName().."'s |cffFFD100"..crp.."\n" + end + bg = child._skin:GetTexture() + if bg then + outputString = outputString.."|cffFF9900----------------------------|r".."\n" + outputString = outputString..bg.."\n" + end + outputString = outputString.."|cffCC0000----------------------------|r".."\n" end - outputString = outputString.."|cffCC0000----------------------------|r".."\n" end end + outputString = outputString.."\n\n" end - outputString = outputString.."\n\n" end elseif arg == nil or arg == "" then outputString = outputString.."Invalid frame name".."\n" diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua index 0326114..5637be7 100644 --- a/SVUI_!Core/system/dock.lua +++ b/SVUI_!Core/system/dock.lua @@ -457,25 +457,34 @@ local HighLight_OnUpdate = function(self) return end if(highlight:IsMouseOver(50, -50, -50, 50)) then - DRAGGING_TARGET = self.Data.Location; highlight:SetAlpha(1) else highlight:SetAlpha(0.2) end end -local function AnchorInsertHighlight(dockbar) - local location = dockbar.Data.Location; - local lastTab = dockbar.Data.Order[#dockbar.Data.Order]; - local isLeft = (location:find('Left')); - local anchor1 = isLeft and 'LEFT' or 'RIGHT'; - local anchor2 = isLeft and 'RIGHT' or 'LEFT'; - local xOff = isLeft and 2 or -2; - dockbar.Highlight:ClearAllPoints(); - if(not lastTab) then - dockbar.Highlight:SetPoint(anchor1, dockbar, anchor1, xOff, 0); - else - dockbar.Highlight:SetPoint(anchor1, _G[lastTab], anchor2, xOff, 0); +-- local function AnchorInsertHighlight(dockbar) +-- local location = dockbar.Data.Location; +-- local lastTab = dockbar.Data.Order[#dockbar.Data.Order]; +-- local isLeft = (location:find('Left')); +-- local anchor1 = isLeft and 'LEFT' or 'RIGHT'; +-- local anchor2 = isLeft and 'RIGHT' or 'LEFT'; +-- local xOff = isLeft and 2 or -2; +-- dockbar.Highlight:ClearAllPoints(); +-- if(not lastTab) then +-- dockbar.Highlight:SetPoint(anchor1, dockbar, anchor1, xOff, 0); +-- else +-- dockbar.Highlight:SetPoint(anchor1, _G[lastTab], anchor2, xOff, 0); +-- end +-- end + +local function GetDragToTarget() + for location, settings in pairs(DOCK_LOCATIONS) do + local dock = MOD[location]; + local dockbar = dock.Bar; + if(dockbar and (dockbar.Highlight:IsMouseOver(50, -50, -50, 50))) then + return dockbar.Data.Location; + end end end @@ -484,14 +493,13 @@ local function ToggleBarHighlights(isShown) local dock = MOD[location]; local dockbar = dock.Bar; if(dockbar) then - --AnchorInsertHighlight(dockbar) if(isShown) then dockbar.Highlight:Show() dockbar.Highlight:SetAlpha(0.2) dockbar:SetScript("OnUpdate", HighLight_OnUpdate) else - DRAGGING_TARGET = nil; dockbar.Highlight:Hide() + dockbar.Highlight:SetAlpha(0) dockbar:SetScript("OnUpdate", nil) end end @@ -567,10 +575,9 @@ local function ResetAllDockletWindows(dockbar, button) local location = dockbar.Data.Location; local buttonList = dockbar.Data.Buttons; local currentButton = ""; + dockbar.Parent.backdrop:Hide(); if(button and button.GetName) then currentButton = button:GetName() - else - dockbar.Parent.backdrop:Hide(); end for nextName,nextButton in pairs(buttonList) do if(nextName ~= currentButton) then @@ -582,19 +589,58 @@ local function ResetAllDockletWindows(dockbar, button) SV.Events:Trigger("DOCKLET_RESET", location); end +local function EnableDockletFloating(button) + if(button and button.FrameLink and button.CanFloat) then + button.isFloating = true; + local location = "Floating"; + local name = button:GetName(); + MOD.private.FloatingDocklets[name] = true; + MOD.private.Locations[name] = location; + button.FrameLink:ClearAllPoints(); + button.FrameLink:SetPoint("BOTTOMLEFT", button, "TOPLEFT", -3, 6); + end +end + +local function DisableDockletFloating(button) + if(button and button.isFloating) then + button.isFloating = nil; + local name = button:GetName(); + MOD.private.FloatingDocklets[name] = nil; + end +end + +local function UpdateDockletFloating(button) + if(button and button.FrameLink and button.isFloating) then + local location = "Floating"; + button:SetDocked(false); + button:Show(); + local name = button:GetName(); + MOD.private.FloatingDocklets[name] = true; + MOD.private.Locations[name] = location; + if(ShowDockletWindow(button, location)) then + ActivateDockletButton(button); + end + end +end + local DockBar_ResetAll = function(self) ResetAllDockletWindows(self); DeactivateAllDockletButtons(self); end -local DockBar_SetDefault = function(self, button, isAdvanced) +local DockBar_SetDefault = function(self, button) local location = self.Data.Location; + if(button) then - if(isAdvanced and button.ShowAdvancedDock) then - DockBar_ResetAll(self) - MOD.private.DefaultDocklets[location] = button:GetName(); + local name = button:GetName() + if(MOD.private.FloatingDocklets[name]) then + EnableDockletFloating(button); + return true; + elseif(button.isFloating) then + UpdateDockletFloating(button); + return true; elseif(button.FrameLink) then - MOD.private.DefaultDocklets[location] = button:GetName(); + MOD.private.DefaultDocklets[location] = name; end end @@ -603,22 +649,17 @@ local DockBar_SetDefault = function(self, button, isAdvanced) button = _G[defaultButton]; end - if(button) then - if(isAdvanced and button.ShowAdvancedDock) then - button:ShowAdvancedDock() + if(button and button.FrameLink) then + ResetAllDockletWindows(self, button); + self.Parent.Window.FrameLink = button.FrameLink; + if(not InCombatLockdown()) then + self.Parent.Window:Show(); + end + self.Parent.Window:FadeIn(); + if(ShowDockletWindow(button, location)) then + self.Parent.backdrop:Show(); + ActivateDockletButton(button); return true; - elseif(button.FrameLink) then - ResetAllDockletWindows(self, button); - self.Parent.Window.FrameLink = button.FrameLink; - if(not InCombatLockdown()) then - self.Parent.Window:Show(); - end - self.Parent.Window:FadeIn(); - if(ShowDockletWindow(button, location)) then - self.Parent.backdrop:Show(); - ActivateDockletButton(button); - return true; - end end end @@ -718,11 +759,12 @@ local DockBar_CheckOrder = function(self, targetName) end local DockBar_UpdateLayout = function(self) - local anchor = upper(self.Data.Location) + local location = self.Data.Location; + local anchor = upper(location) local mod = self.Data.Modifier local size = self.ToolBar:GetHeight(); local count = #self.Data.Order; - local offset = 1; + local offset = 6; local safeIndex = 1; if(count > 0) then @@ -730,11 +772,14 @@ local DockBar_UpdateLayout = function(self) local nextName = self.Data.Order[i]; local nextButton = self.Data.Buttons[nextName]; if(nextButton) then - offset = (safeIndex - 1) * (size + 6) + 6; - local widthMultiplier = nextButton.widthMultiplier or 1; - nextButton:ClearAllPoints(); - nextButton:SetSize(size * widthMultiplier, size); - nextButton:SetPoint(anchor, self.ToolBar, anchor, (offset * mod), 0); + if(not nextButton.isFloating) then + local modW = nextButton.widthMultiplier or 1; + local calcWidth = size * modW + nextButton:ClearAllPoints(); + nextButton:SetSize(calcWidth, size); + nextButton:SetPoint(anchor, self.ToolBar, anchor, (offset * mod), 0); + offset = offset + (calcWidth + 6); + end if(not nextButton:IsShown()) then nextButton:Show(); end @@ -744,6 +789,10 @@ local DockBar_UpdateLayout = function(self) end end + local defaultButton = MOD.private.DefaultDocklets[location]; + if(not self.Data.Buttons[defaultButton]) then + MOD.private.DefaultDocklets[location] = nil + end self.ToolBar:SetWidth(offset + size); end @@ -753,10 +802,10 @@ local DockBar_AddButton = function(self, button, forced) local currentLocation = self.Data.Location if(self.Data.Buttons[name] and (not forced)) then return end - local registeredLocation = MOD.private.Locations[name] + local registeredLocation = MOD.private.Locations[name]; if(registeredLocation) then - if(registeredLocation ~= currentLocation) then + if((registeredLocation ~= currentLocation) and (registeredLocation ~= 'Floating')) then if(MOD[registeredLocation].Bar.Data.Buttons[name]) then MOD[registeredLocation].Bar:Remove(button, true); else @@ -771,7 +820,7 @@ local DockBar_AddButton = function(self, button, forced) MOD.private.Locations[name] = currentLocation; button.Parent = self; - button.isFloating = false; + DisableDockletFloating(button) button:SetParent(self.ToolBar); if(button.FrameLink) then @@ -812,30 +861,30 @@ local DockBar_RemoveButton = function(self, button, isMoving) end end - if(not self.Data.Buttons[name]) then return end + if(self.Data.Buttons[name]) then + button.OrderIndex = 0; - button.OrderIndex = 0; + button:Hide() - button:Hide() - - if(button.FrameLink) then - local frameName = button.FrameLink:GetName() - MOD.private.Locations[frameName] = nil; - button.FrameLink:FadeOut(0.2, 1, 0, true); - self.Data.Windows[frameName] = nil; - end + if(button.FrameLink) then + local frameName = button.FrameLink:GetName() + MOD.private.Locations[frameName] = nil; + button.FrameLink:FadeOut(0.2, 1, 0, true); + self.Data.Windows[frameName] = nil; + end - if(#self.Data.Order == 0) then - MOD.private.DefaultDocklets[currentLocation] = nil; - self.Parent.backdrop:Hide() - end + if(#self.Data.Order == 0) then + MOD.private.DefaultDocklets[currentLocation] = nil; + self.Parent.backdrop:Hide() + end - self.Data.Buttons[name] = nil; - DockBar_UpdateOrder(self); - if(MOD.private.DefaultDocklets[currentLocation] == name or (not MOD.private.DefaultDocklets[currentLocation]) or (MOD.private.DefaultDocklets[currentLocation] == "")) then - self:NextDefault() - else - self:SetDefault() + self.Data.Buttons[name] = nil; + DockBar_UpdateOrder(self); + if(MOD.private.DefaultDocklets[currentLocation] == name or (not MOD.private.DefaultDocklets[currentLocation]) or (MOD.private.DefaultDocklets[currentLocation] == "")) then + self:NextDefault() + else + self:SetDefault() + end end self:Update() end @@ -844,35 +893,30 @@ end DOCKBUTTON FUNCTIONS ########################################################## ]]-- -local DockButton_SetFloating = function(self) - self:SetDocked(false) - self.isFloating = true - if(not self.FrameLink) then return end - self:Show(); - self.FrameLink:Show(); - self.FrameLink:FadeIn() - self.FrameLink:ClearAllPoints(); - self.FrameLink:SetPoint("BOTTOMLEFT", self, "TOPLEFT", -3, 6); -end - local DockButton_OnDragStart = function(self) if(IsShiftKeyDown() and (not InCombatLockdown())) then self:SetMovable(true); self:StartMoving(); ToggleBarHighlights(true); + if(self.CanFloat and (not self.isFloating)) then + EnableDockletFloating(self) + end end end local DockButton_OnDragStop = function(self) self:StopMovingOrSizing(); - self:SetMovable(false); - if(DRAGGING_TARGET) then - self:MoveTo(DRAGGING_TARGET); - elseif(not self.isFloating) then + ToggleBarHighlights(false); + local target = GetDragToTarget() + if(target) then + self:SetMovable(false); + self:MoveTo(target); + elseif(self.isFloating) then + UpdateDockletFloating(self) + else + self:SetMovable(false); self:MoveTo(MOD.private.Locations[self:GetName()]); end - DRAGGING_TARGET = nil; - ToggleBarHighlights(false) end local DockButton_DefaultTip = function(self, ...) @@ -891,13 +935,16 @@ local DockButton_OnEnter = function(self, ...) GameTooltip:ClearLines() if(self.GeneralTip) then self:GeneralTip() + GameTooltip:AddLine(" ", 1, 1, 1) + end + if(self.PostRightClick) then + GameTooltip:AddDoubleLine("Right-Click", "Options", 0, 1, 0, 0.5, 1, 0.5) end - GameTooltip:AddDoubleLine("[Right-Click]", "Hide", 0, 1, 0, 1, 1, 1) - GameTooltip:AddDoubleLine("[SHIFT + Drag]", "Move To Another Dock", 0, 1, 0, 1, 1, 1) + GameTooltip:AddDoubleLine("|cff0099FFSHIFT|r + Drag", "Relocate", 0, 1, 0, 0.5, 1, 0.5) if(self:GetAttribute("hasDropDown") and self.GetMenuList) then - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine("[Alt+Click]", "Docking Options", 0, 0.5, 1, 0.5, 1, 0.5) + GameTooltip:AddDoubleLine("|cff0099FFSHIFT|r + Right-Click", "Docking Menu", 0, 1, 0, 0.5, 1, 0.5) end + GameTooltip:AddDoubleLine("|cff0099FFALT|r + Right-Click", "Hide", 0, 1, 0, 0.5, 1, 0.5) GameTooltip:Show() end @@ -917,31 +964,33 @@ local DockButton_OnClick = function(self, button) self:ClickTheme() end MOD.ButtonSound() - if(button and (button == "RightButton") and (not IsShiftKeyDown())) then - self.Parent.Parent.backdrop:Hide() - self.ActiveDocklet = false; - self:SetPanelColor("default") - if(self.Icon) then - self.Icon:SetGradient(unpack(SV.media.gradient.icon)); - end - if(self.FrameLink) then - local registeredLocation = MOD.private.Locations[self.LocationKey]; - HideDockletWindow(self, registeredLocation) - end - else - if(IsAltKeyDown() and (not InCombatLockdown()) and self:GetAttribute("hasDropDown") and self.GetMenuList) then + if(button and (button == "RightButton")) then + if(IsAltKeyDown()) then + self.Parent.Parent.backdrop:Hide() + self.ActiveDocklet = false; + self:SetPanelColor("default") + if(self.Icon) then + self.Icon:SetGradient(unpack(SV.media.gradient.icon)); + end + if(self.FrameLink) then + local registeredLocation = MOD.private.Locations[self.LocationKey]; + HideDockletWindow(self, registeredLocation) + end + elseif(IsShiftKeyDown() and (not InCombatLockdown()) and self:GetAttribute("hasDropDown") and self.GetMenuList) then local list = self:GetMenuList(); SV.Dropdown:Open(self, list, "Dock Options"); + elseif(self.PostRightClick) then + self:PostRightClick(); + end + else + local clickAllowed = false; + if(self.FrameLink) then + clickAllowed = DockBar_SetDefault(self.Parent, self) else - local clickAllowed = false; - if(self.FrameLink) then - clickAllowed = DockBar_SetDefault(self.Parent, self) - else - clickAllowed = true; - end - if(self.PostClickFunction and clickAllowed) then - self:PostClickFunction(button) - end + clickAllowed = true; + end + if(self.PostClickFunction and clickAllowed) then + self:PostClickFunction(button) end end end @@ -1042,13 +1091,12 @@ local DockBar_CreateButton = function(self, displayName, globalName, texture, cl button:SetScript("PostClick", DockButton_OnPostClick) end - button.Parent = self; - button.OrderIndex = 0; + button.Parent = self; + button.OrderIndex = 0; button.LocationKey = globalName; - button.MoveTo = DockButton_MoveTo + button.MoveTo = DockButton_MoveTo button.GetMenuList = DockButton_GetMenuList - button.SetDocked = DockButton_SetDocked - button.SetFloating = DockButton_SetFloating + button.SetDocked = DockButton_SetDocked if(clickFunction and type(clickFunction) == "function") then button.PostClickFunction = clickFunction @@ -1081,7 +1129,7 @@ function MOD:SetDockButton(location, displayName, globalName, texture, clickFunc return DockBar_CreateButton(parent.Bar, displayName, globalName, texture, clickFunction, tipFunction, primaryTemplate) end -function MOD:SetDockCallbacks(frame, onhide, onshow) +function MOD:SetDockCallbacks(frame, onhide, onshow, onrightclick) if(not frame) then return end if(onhide and (type(onhide) == 'function')) then frame.PostHideCallback = onhide; @@ -1089,6 +1137,9 @@ function MOD:SetDockCallbacks(frame, onhide, onshow) if(onshow and (type(onshow) == 'function')) then frame.PostShowCallback = onshow; end + if(frame.Button and (onrightclick and (type(onrightclick) == 'function'))) then + frame.Button.PostRightClick = onrightclick; + end end --[[ ########################################################## @@ -1101,7 +1152,7 @@ MOD.BottomCenter = _G["SVUI_DockBottomCenter"]; local DockBar_OnEvent = function(self, event) if(event == 'PLAYER_REGEN_ENABLED') then self:UnregisterEvent("PLAYER_REGEN_ENABLED") - DockBar_SetDefault(self) + DockBar_SetDefault(self) end end @@ -1219,47 +1270,6 @@ function MOD:NewDocklet(location, globalName, readableName, texture, onclick, on DOCK_CHECK = true return frame end - -function MOD:NewAdvancedDocklet(location, globalName) - if(DOCK_REGISTRY[globalName]) then return end; - - if(self.private.Locations[globalName]) then - location = self.private.Locations[globalName]; - else - self.private.Locations[globalName] = location; - end - - local newParent = self[location]; - if(not newParent) then return end - newParent.backdrop:Show() - local frame = CreateFrame("Frame", globalName, UIParent); - frame:SetParent(newParent.Window); - frame:SetSize(newParent.Window:GetSize()); - frame:SetAllPoints(newParent.Window); - frame:SetFrameStrata("BACKGROUND"); - frame.Parent = newParent; - frame.Disable = Docklet_Disable; - frame.Enable = Docklet_Enable; - frame.Relocate = Docklet_Relocate; - frame.GetButtonSize = Docklet_ButtonSize; - - newParent.Bar.Data.Windows[globalName] = frame; - - local height = newParent.Bar.ToolBar:GetHeight(); - local mod = newParent.Bar.Data.Modifier; - local barAnchor = newParent.Bar.Data.Anchor; - local barReverse = SV:GetReversePoint(barAnchor); - local spacing = SV.db.Dock.buttonSpacing; - - frame.Bar = CreateFrame("Frame", globalName.."Bar", newParent); - frame.Bar:SetSize(1, height); - frame.Bar:SetPoint(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0) - SV:NewAnchor(frame.Bar, globalName .. " Dock Bar"); - - DOCK_REGISTRY[globalName] = frame; - DOCK_CHECK = true - return frame -end --[[ ########################################################## BUILD/UPDATE @@ -1421,6 +1431,10 @@ function MOD:Load() self.private.DefaultDocklets = {} end + if(not self.private.FloatingDocklets) then + self.private.FloatingDocklets = {} + end + if(not self.private.Locations) then self.private.Locations = {} end @@ -1482,11 +1496,11 @@ function MOD:Load() dock.Bar.ToolBar:ClearAllPoints() if(dock.Bar.Button) then - dock.Bar.Button:SetSize(buttonsize, buttonsize) - self:SetButtonTheme(dock.Bar.Button, buttonsize) - dock.Bar.Button.Icon:SetTexture(SV.media.icon.default) - dock.Bar.ToolBar:SetSize(1, buttonsize) - dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0) + dock.Bar.Button:SetSize(buttonsize, buttonsize) + self:SetButtonTheme(dock.Bar.Button, buttonsize) + dock.Bar.Button.Icon:SetTexture(SV.media.icon.default) + dock.Bar.ToolBar:SetSize(1, buttonsize) + dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0) dock.Bar.Button:SetPanelColor("default") dock.Bar.Button.Icon:SetGradient(unpack(SV.media.gradient.icon)) dock.Bar.Button:SetScript("OnEnter", CornerButton_OnEnter) @@ -1496,25 +1510,25 @@ function MOD:Load() else dock.Bar.Button:SetScript("OnClick", ToggleSuperDockRight) end - else - dock.Bar.ToolBar:SetSize(1, buttonsize) - dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar, barAnchor, 0, 0) - end - - dock:SetParent(SV.Screen) - dock:ClearAllPoints() - dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod)) - dock:SetSize(width, height) - dock:SetAttribute("buttonSize", buttonsize) - dock:SetAttribute("spacingSize", spacing) - - dock.Alert:ClearAllPoints() - dock.Alert:SetSize(width, 1) - dock.Alert:SetPoint(anchor, dock, anchor, 0, 0) - - dock.Window:ClearAllPoints() - dock.Window:SetSize(width, height) - dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4) + else + dock.Bar.ToolBar:SetSize(1, buttonsize) + dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar, barAnchor, 0, 0) + end + + dock:SetParent(SV.Screen) + dock:ClearAllPoints() + dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod)) + dock:SetSize(width, height) + dock:SetAttribute("buttonSize", buttonsize) + dock:SetAttribute("spacingSize", spacing) + + dock.Alert:ClearAllPoints() + dock.Alert:SetSize(width, 1) + dock.Alert:SetPoint(anchor, dock, anchor, 0, 0) + + dock.Window:ClearAllPoints() + dock.Window:SetSize(width, height) + dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4) dock.backdrop = self.SetThemeDockStyle(dock.Window, isBottom) dock.backdrop:Hide() dock.Alert.backdrop = self.SetThemeDockStyle(dock.Alert, isBottom) diff --git a/SVUI_!Core/system/henchmen.lua b/SVUI_!Core/system/henchmen.lua index 7a88d8a..7edcb08 100644 --- a/SVUI_!Core/system/henchmen.lua +++ b/SVUI_!Core/system/henchmen.lua @@ -119,7 +119,8 @@ local Tooltip_Hide = function(self) end local Minion_OnMouseUp = function(self) - if(not self.setting()) then + local current = self.setting() + if(not current) then self.indicator:SetTexCoord(0,1,0.5,1) self.setting(true) else @@ -420,12 +421,14 @@ local function CreateHenchmenFrame() else return baseToggle end - elseif(toggle == true) then - if(baseToggle == 'NONE') then - SV.db.FunStuff.comix = savedToggle; - end else - SV.db.FunStuff.comix = 'NONE'; + if(toggle == true) then + if(baseToggle == 'NONE') then + SV.db.FunStuff.comix = savedToggle; + end + else + SV.db.FunStuff.comix = 'NONE'; + end end end Minion_OnMouseUp(m_option) @@ -571,7 +574,7 @@ function SV:ToggleHenchman() HenchmenCalloutFrame:SetAlpha(1) HenchmenCalloutFrame.anim:Play() UIFrameFadeOut(HenchmenCalloutFrame,5) - for i=1,5 do + for i=0,5 do local option=_G["HenchmenOptionButton"..i] option.anim:Finish() option:Show() @@ -581,6 +584,7 @@ function SV:ToggleHenchman() minion.anim:Finish() minion:Show() minion.anim:Play() + minion:setting() end SV.HenchmenButton.Icon:SetGradient(unpack(SV.media.gradient.green)) else @@ -597,7 +601,7 @@ function SV:ToggleHenchman() HenchmenFrame.anim:Finish() HenchmenFrame:Hide() HenchmenFrameBG:Hide() - for i=1,5 do + for i=0,5 do local option=_G["HenchmenOptionButton"..i] option.anim:Finish() option:Hide() diff --git a/SVUI_!Core/system/layout.lua b/SVUI_!Core/system/layout.lua index 601631e..4a79858 100644 --- a/SVUI_!Core/system/layout.lua +++ b/SVUI_!Core/system/layout.lua @@ -867,44 +867,54 @@ function Graph:UpdateAllReports() local size = 1 local width = GetScreenWidth() - local ratio = width / GetScreenHeight() - local height = GetScreenHeight() * ratio + local baseHeight = GetScreenHeight() + local ratio = width / baseHeight + local height = baseHeight * ratio local wStep = width / cellSize local hStep = height / cellSize + local halfCell = cellSize * 0.5; for i = 0, cellSize do + local xW = i*wStep; + local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') - if(i == cellSize / 2) then + if(i == halfCell) then tx:SetTexture(0, 1, 0, 0.8) else tx:SetTexture(0, 0, 0, 0.8) end - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", i*wStep - (size/2), 0) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', i*wStep + (size/2), 0) + + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", (xW - 0.5), 0) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'BOTTOMLEFT', (xW + 0.5), 0) end height = GetScreenHeight() do + local yW = (height * 0.5) + 0.5; local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') tx:SetTexture(0, 1, 0, 0.8) - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2 + size/2)) + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, (-(height * 0.5) + 0.5)) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -((height * 0.5) + 0.5)) end - for i = 1, floor((height/2)/hStep) do + for i = 1, floor(((height * 0.5) / hStep)) do local tx = self.Grid:CreateTexture(nil, 'BACKGROUND') tx:SetTexture(0, 0, 0, 0.8) - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2+i*hStep) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2+i*hStep + size/2)) + local y1 = -((height * 0.5) + (i * hStep)) + 0.5; + local y2 = -(((height * 0.5) + (i * hStep)) + 0.5); + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, y1) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, y2) tx = self.Grid:CreateTexture(nil, 'BACKGROUND') tx:SetTexture(0, 0, 0, 0.8) - tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, -(height/2-i*hStep) + (size/2)) - tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, -(height/2-i*hStep + size/2)) + y1 = -((height * 0.5) + (i * hStep)) + 0.5; + y2 = -(((height * 0.5) + (i * hStep)) + 0.5); + tx:SetPoint("TOPLEFT", self.Grid, "TOPLEFT", 0, y1) + tx:SetPoint('BOTTOMRIGHT', self.Grid, 'TOPRIGHT', 0, y2) end self.Grid:Hide() diff --git a/SVUI_!Core/xml/widgets.xml b/SVUI_!Core/xml/widgets.xml index 0e8d293..b3b070a 100644 --- a/SVUI_!Core/xml/widgets.xml +++ b/SVUI_!Core/xml/widgets.xml @@ -375,12 +375,18 @@ </Anchors> <Color r="1" g="1" b="1" a="1"/> </FontString> - <FontString parentKey="SubTitle" inherits="SVUI_Font_Caps" justifyH="CENTER" text="Right-click frames to move with precision."> + <FontString name="$parentSubTitle" parentKey="SubTitle" inherits="SVUI_Font_Caps" justifyH="CENTER" text="Right-click frames to move with precision."> <Anchors> <Anchor point="TOP" relativeTo="$parentTitleBG" relativePoint="BOTTOM" x="0" y="5" /> </Anchors> <Color r="1" g="1" b="0" a="0.8"/> </FontString> + <FontString parentKey="SubInfo" inherits="SVUI_Font_Caps" justifyH="CENTER" text="Hold shift to enable snapping."> + <Anchors> + <Anchor point="TOP" relativeTo="$parentSubTitle" relativePoint="BOTTOM" x="0" y="-4" /> + </Anchors> + <Color r="1" g="0.5" b="0" a="0.8"/> + </FontString> <Texture name="$parentPortrait" parentKey="Portrait" file="Interface\AddOns\SVUI_!Core\assets\textures\EMPTY"> <Size x="132" y="132"/> <Anchors> diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua index ab0e76b..e7236dd 100644 --- a/SVUI_Chat/SVUI_Chat.lua +++ b/SVUI_Chat/SVUI_Chat.lua @@ -330,14 +330,15 @@ do end local playerData, playerName = message:match(PLAYER_PATTERN) if(channelID) then - message = message:gsub("(|Hchannel:.-|h): ", "%1", 1) - elseif(playerData and HIDE_REALM) then - if playerName:match("|cff") then + message = message:gsub("(|Hchannel:.-|h): ", "%1 ", 1) + elseif(playerData) then + if(playerName:match("|cff") and HIDE_REALM) then playerName = playerName:gsub("%-[^|]+", "") + message = message:gsub(PLAYER_PATTERN, PLAYER_LINK:format(playerData, playerName)) else playerName = playerName:match("[^%-]+") + message = message:gsub(PLAYER_PATTERN, PLAYER_LINK:format(playerData, playerName .. " ")) end - message = message:gsub(PLAYER_PATTERN, PLAYER_LINK:format(playerData, playerName)) end local bnData, bnName, bnID, bnExtra = message:match(BNPLAYER_PATTERN) @@ -516,15 +517,16 @@ do end local _hook_TabTextColor = function(self, r, g, b, a) - local r2, g2, b2 = 1, 1, 1; - if r ~= r2 or g ~= g2 or b ~= b2 then - self:SetTextColor(r2, g2, b2) + local val = r + g + b; + if(val ~= 3) then + self:SetTextColor(1, 1, 1, 1) self:SetShadowColor(0, 0, 0) self:SetShadowOffset(2, -2) end end local DockTab_OnEnter = function(self) + self = self.link local chatID = self:GetID(); local chatFrame = _G[("ChatFrame%d"):format(chatID)]; local tabText = self.text:GetText() or "Chat "..chatID; @@ -538,6 +540,7 @@ do end local DockTab_OnClick = function(self,button) + self = self.link local chatFrame = _G[("ChatFrame%d"):format(self:GetID())]; FCF_Tab_OnClick(self,button); if(chatFrame:AtBottom() and ScrollIndicator:IsShown()) then @@ -547,13 +550,6 @@ do ScrollIndicator:Show() SV.Animate:Flash(ScrollIndicator,1,true) end - for chatID,frame in pairs(TabsList) do - frame.link.IsOpen = false - frame.link.icon:SetGradient(unpack(SV.media.gradient.icon)) - end - if(chatFrame.isDocked) then - self.IsOpen = true - end end local EditBox_OnKeyUp = function(self, button) @@ -657,13 +653,15 @@ do tab:SetPanelColor("default") holder.Icon:SetGradient(unpack(SV.media.gradient.icon)) end - if(chatID == 1) then - tab.IsOpen = true - holder.Icon:SetGradient(unpack(SV.media.gradient.green)) - end + holder.Icon:SetAlpha(0.5); + holder.Icon:ClearAllPoints() + holder.Icon:InsetPoints(holder, 6, 3) + holder.Icon:SetDrawLayer("BORDER") tab.icon = holder.Icon; + tab:SetAlpha(1); + tab:EnableMouse(false); tab.SetAlpha = SV.fubar tab.SetHeight = SV.fubar @@ -674,15 +672,15 @@ do tab.SetAllPoints = SV.fubar tab.SetPoint = SV.fubar + holder.link = tab tab.Holder = holder - tab.Holder.link = tab end local ChatDock_HideCallback = function(self) local chat = self.Owner; MOD:FadeLines(chat) - chat:ForceHide(true) chat:FadeOut(2, chat:GetAlpha(), 0, true) + chat:ForceHide(true) end local ChatDock_ShowCallback = function(self) @@ -701,15 +699,23 @@ do local tab = _G[tabName]; local editBoxName = chatName.."EditBox"; local editBox = _G[editBoxName]; + local dropdown = _G[tabName.."DropDown"] local tabEnabled = (chat.inUse or chat.isDocked or chat.isTemporary); ------------------------------------------- SV:SetFrameVisibilityLocks(chat); ------------------------------------------- - chat:SetStyle("Frame", "Transparent", true, 1, 3, 6); - chat.Panel:Hide(); + --chat:SetStyle("Frame", "Transparent", true, 1, 3, 6); + --chat.Panel:Hide(); chat.Dock = SV.Dock:NewDocklet("BottomLeft", format("SVUI_ChatFrameDock%d", chatID), chatName, MOD.media.dockIcon, DockTab_OnClick, DockTab_OnEnter); chat.Dock.Owner = chat; - SV.Dock:SetDockCallbacks(chat.Dock, ChatDock_HideCallback, ChatDock_ShowCallback); + + local ChatDock_RightClickCallback = function() + self = tab + CURRENT_CHAT_FRAME_ID = self:GetID(); + ToggleDropDownMenu(1, nil, _G[self:GetName().."DropDown"], self:GetName(), 0, 0); + end + + SV.Dock:SetDockCallbacks(chat.Dock, ChatDock_HideCallback, ChatDock_ShowCallback, ChatDock_RightClickCallback); ------------------------------------------- SV:FontManager(chat, "chatdialog", "LEFT") SV:FontManager(tabText, "chattab") @@ -724,9 +730,16 @@ do chat:SetFrameLevel(4) chat:SetClampRectInsets(0, 0, 0, 0) - chat:SetClampedToScreen(false) + chat:SetClampedToScreen(true) + chat:SetMovable(true) + chat:SetUserPlaced(true); + chat:RemoveTextures(true) + + --chat:SetStyle("!_Frame", "Transparent") chat:SetBackdropColor(0,0,0,0) + chat:SetBackdropBorderColor(0,0,0,0) + --chat.Panel:WrapPoints(chat, 4, 4) _G[chatName.."ButtonFrame"]:Die() ------------------------------------------- @@ -740,13 +753,17 @@ do _G[tabName .."HighlightMiddle"]:SetTexture("") _G[tabName .."HighlightRight"]:SetTexture("") - tab.text = _G[chatName.."TabText"] - tab.text:SetShadowColor(0, 0, 0) - tab.text:SetShadowOffset(2, -2) - tab.text:InsetPoints(tab) - tab.text:SetJustifyH("CENTER") - tab.text:SetJustifyV("MIDDLE") - NewHook(tab.text, "SetTextColor", _hook_TabTextColor) + tabText:SetTextColor(1, 1, 1, 1) + tabText:SetShadowColor(0, 0, 0) + tabText:SetShadowOffset(2, -2) + tabText:ClearAllPoints() + tabText:InsetPoints(tab) + tabText:SetJustifyH("CENTER") + tabText:SetJustifyV("MIDDLE") + NewHook(tabText, "SetTextColor", _hook_TabTextColor) + tabText:Show() + tab.text = tabText + if tab.conversationIcon then tab.conversationIcon:SetAlpha(0) tab.conversationIcon:ClearAllPoints() @@ -826,53 +843,38 @@ do local tabText = _G[name.."TabText"] if(not chat.Dock) then - ConfigChatFrame(chat, tabText) + ConfigChatFrame(chat) end local CHAT_WIDTH, CHAT_HEIGHT = chat.Dock:GetSize(); - if((not chat.isDocked) and chat:IsShown()) then - --print("setting size "..id .. " = " ..CHAT_WIDTH) - chat:SetSize(CHAT_WIDTH, CHAT_HEIGHT) - chat.Panel:Show() + chat.isDocked = nil; + chat.isUninteractable = true; + FCF_SetLocked(chat, false); - if chat:IsMovable() then - chat:SetUserPlaced(true) - end + chat:ClearAllPoints(); + chat:SetPoint("CENTER", chat.Dock, "CENTER", 0, 0); + chat:SetSize(CHAT_WIDTH - 4, CHAT_HEIGHT - 4); - tab.isDocked = false; - tab.Holder.isFloating = true; - tabText:Show() - if tab.CopyButton and GetMouseFocus() ~= tab.CopyButton then - tab.CopyButton:SetAlpha(1) - end - if tab.conversationIcon then - tab.conversationIcon:Show() - end - else + FCF_SavePositionAndDimensions(chat) + + tab.Holder.CanFloat = true; + if(not tab.Holder.isFloating) then chat:SetBackdropColor(0,0,0,0); - chat:ClearAllPoints(); - chat:SetPoint("CENTER", chat.Dock, "CENTER", 0, 0); - chat:SetSize(CHAT_WIDTH - 4, CHAT_HEIGHT - 4); - chat.Panel:Hide(); - - FCF_SavePositionAndDimensions(chat) - - tab.isDocked = true; - tab.Holder.isFloating = false; - tabText:Hide() - if tab.CopyButton and GetMouseFocus() ~= tab.CopyButton then - tab.CopyButton:SetAlpha(1) - end - if tab.conversationIcon then - tab.conversationIcon:Hide() - end + end + --tabText:Hide() + if tab.CopyButton and GetMouseFocus() ~= tab.CopyButton then + tab.CopyButton:SetAlpha(1) + end + if tab.conversationIcon then + tab.conversationIcon:Hide() end if((not chat.TempAddMessage) and (chat:GetID() ~= 2)) then chat.TempAddMessage = chat.AddMessage; chat.AddMessage = AddModifiedMessage end + chat.Dock.Button:SetDocked(chat.isDockable) end refreshLocked = true end @@ -1158,6 +1160,44 @@ do self.WhisperAlert:Hide() end + local _hook_FCF_SetWindowColor = function(self, r, g, b) + local name = self:GetName(); + local chat = _G[name] + local id = chat:GetID() + local tab = _G[name.."Tab"] + if(tab.Holder.isFloating) then + chat:SetBackdropColor(r,g,b,1) + else + chat:SetBackdropColor(0,0,0,0) + end + end + + local _hook_FCF_SetWindowAlpha = function(self, a) + local name = self:GetName(); + local chat = _G[name] + local id = chat:GetID() + local tab = _G[name.."Tab"] + if(tab.Holder.isFloating) then + local r,g,b = chat:GetBackdropColor() + chat:SetBackdropColor(r,g,b,a) + end + end + + local _hook_FCF_Close = function(self) + if(not self) then + self = FCF_GetCurrentChatFrame(); + end + if(not self.Dock) then return end + self.Dock.Button:SetDocked(false) + end + + local _hook_FCF_Tab_OnClick = function(self) + if(not self) then + self = FCF_GetCurrentChatFrame(); + end + print(self:GetName()) + end + function SetAllChatHooks() NewHook('FCF_StartAlertFlash', _hook_FCFStartAlertFlash) NewHook('FCF_StopAlertFlash', _hook_FCFStopAlertFlash) @@ -1169,7 +1209,11 @@ do NewHook('FCF_SetChatWindowFontSize', _hook_ChatFontUpdate) NewHook(GeneralDockManager, 'SetPoint', _hook_GDMFrameSetPoint) NewHook(GeneralDockManagerScrollFrame, 'SetPoint', _hook_GDMScrollSetPoint) + NewHook("FCF_SetWindowColor", _hook_FCF_SetWindowColor) + NewHook("FCF_SetWindowAlpha", _hook_FCF_SetWindowAlpha) + NewHook("FCF_Close", _hook_FCF_Close) + --NewHook("FCF_Tab_OnClick", _hook_FCF_Tab_OnClick) --NewHook("FCF_SetTabPosition", _hook_SetTabPosition) --NewHook("FCF_StopDragging", _hook_TabStopDragging) @@ -1236,7 +1280,7 @@ local function ExpandChatDock(location) local needsUpdate = false; for _, name in pairs(CHAT_FRAMES) do local chat = _G[name]; - if(chat and (location == name.Dock.Parent.Bar.Data.Location)) then + if(chat and (location == chat.Dock.Parent.Bar.Data.Location)) then needsUpdate = true; end end @@ -1245,20 +1289,26 @@ end local function DockFadeInChat(location) if(not location) then return end + --print(location .. " DockFadeInChat") for _, name in pairs(CHAT_FRAMES) do local chat = _G[name]; - if(chat and (location == name.Dock.Parent.Bar.Data.Location)) then - needsUpdate = true; + if(chat and (location == chat.Dock.Parent.Bar.Data.Location)) then + MOD:ShowLines(chat) + chat:FadeIn(0.2, chat:GetAlpha(), 1) + --print(name .. " Fading In") end end end local function DockFadeOutChat(location) if(not location) then return end + --print(location .. " DockFadeOutChat") for _, name in pairs(CHAT_FRAMES) do local chat = _G[name]; - if(chat and (location == name.Dock.Parent.Bar.Data.Location)) then - needsUpdate = true; + if(chat and (location == chat.Dock.Parent.Bar.Data.Location)) then + MOD:FadeLines(chat) + chat:FadeOut(2, chat:GetAlpha(), 0, true) + --print(name .. " Fading Out") end end end @@ -1297,9 +1347,22 @@ function MOD:Load() self:RegisterEvent('PET_BATTLE_CLOSE') self:UpdateLocals() + + for i,name in pairs(CHAT_FRAMES) do + local thisChatFrame = _G[name]; + local usable = thisChatFrame.isDocked or false; + thisChatFrame.isDockable = usable; + thisChatFrame.isDocked = nil; + thisChatFrame.isUninteractable = true; + FCF_SetLocked(thisChatFrame, false); + end + self:RefreshChatFrames(true) SetParseHandlers() + _G.CombatLogQuickButtonFrame_Custom:SetParent(ChatFrame2.Dock) + _G.CombatLogQuickButtonFrame_Custom.SetParent = SV.fubar + _G.GeneralDockManagerOverflowButton:ClearAllPoints() _G.GeneralDockManagerOverflowButton:SetPoint('BOTTOMLEFT', baseDock.Bar, 'BOTTOMRIGHT', 2, 0) _G.GeneralDockManagerOverflowButtonList:SetStyle("!_Frame", 'Transparent')