diff --git a/SVUI_!Core/system/api.lua b/SVUI_!Core/system/api.lua index 4be9d3f..5676448 100644 --- a/SVUI_!Core/system/api.lua +++ b/SVUI_!Core/system/api.lua @@ -250,23 +250,10 @@ local FadeEventManager_OnEvent = function(self, event) self:UnregisterEvent("PLAYER_REGEN_ENABLED") for frame in pairs(FRAMES_TO_HIDE) do frame:Hide() - if(frame.___forcehidefunc) then - local _, catch = pcall(frame.___forcehidefunc, frame) - if(catch) then - frame.___forcehidefunc = nil - end - end end wipe(FRAMES_TO_HIDE) - --print("removed frames") for frame in pairs(FRAMES_TO_SHOW) do frame:Show() - if(frame.___forceshowfunc) then - local _, catch = pcall(frame.___forceshowfunc, frame) - if(catch) then - frame.___forceshowfunc = nil - end - end end wipe(FRAMES_TO_SHOW) end @@ -347,7 +334,7 @@ local SecureFadeIn = function(self, duration, alphaStart, alphaEnd) self.___fademode = "IN"; self.___fadehide = nil; - self.___fadefunc = nil; + self.___fadefunc = self.___fadeshowfunc; if(not self.___fadeset) then self.___fadeset = {}; @@ -381,7 +368,7 @@ local SecureFadeOut = function(self, duration, alphaStart, alphaEnd, hideOnFinis self.___fademode = "OUT"; self.___fadehide = hideOnFinished; - self.___fadefunc = nil; + self.___fadefunc = self.___fadehidefunc; if(not self.___fadeset) then self.___fadeset = {}; @@ -399,14 +386,13 @@ local SecureFadeOut = function(self, duration, alphaStart, alphaEnd, hideOnFinis end end -local SecureFadeCallback = function(self, callback, onForceHide, onForceShow) - if(onForceHide) then - self.___forcehidefunc = callback; - elseif(onForceShow) then - self.___forceshowfunc = callback; - else - self.___fadefunc = callback; +local SecureFadeCallback = function(self, callback, alwaysOnHide, alwaysOnShow) + if(alwaysOnHide) then + self.___fadehidefunc = callback; + elseif(alwaysOnShow) then + self.___fadeshowfunc = callback; end + self.___fadefunc = callback; end --[[ ########################################################## diff --git a/SVUI_!Core/system/dock.lua b/SVUI_!Core/system/dock.lua index ff1c26d..981d1f4 100644 --- a/SVUI_!Core/system/dock.lua +++ b/SVUI_!Core/system/dock.lua @@ -393,74 +393,116 @@ end DOCKBAR FUNCTIONS ########################################################## ]]-- -local DockBar_ResetDocklets = function(self) - local location = self.Data.Location; - local default = "" - if(MOD.private.DefaultDocklets[location] and _G[MOD.private.DefaultDocklets[location]]) then - default = _G[MOD.private.DefaultDocklets[location]]:GetAttribute("ownerFrame") +local function DeactivateDockletButton(button) + button:SetAttribute("isActive", false) + button:SetPanelColor("default") + if(button.Icon) then + button.Icon:SetGradient(unpack(SV.media.gradient.icon)); + end +end + +local function DeactivateAllDockletButtons(dockbar) + local location = dockbar.Data.Location; + local buttonList = dockbar.Data.Buttons; + for nextName,nextButton in pairs(buttonList) do + DeactivateDockletButton(nextButton) + end +end + +local function ActivateDockletButton(button) + DeactivateAllDockletButtons(button.Parent); + button:SetAttribute("isActive", true); + button:SetPanelColor("default"); + if(button.Icon) then + button.Icon:SetGradient(unpack(SV.media.gradient.checked)); end +end + +local function ShowDockletWindow(holder, window) + if((not holder) or (not window)) then return end + holder.FrameLink = window; + holder:Show(); + holder:FadeIn(); + if(not InCombatLockdown()) then + window:SetFrameLevel(10) + window:Show() + end + window:FadeIn() +end + +local function HideDockletWindow(window) + if(not window) then return end + if(not InCombatLockdown()) then + window:SetFrameLevel(0) + window:Hide() + else + window:FadeOut(0.2, 1, 0, true) + end +end + +local DockBar_ResetDocklets = function(self) + self.Parent.backdrop:Hide(); for name,window in pairs(self.Data.Windows) do - if(name ~= default and window.DockButton) then - window.DockButton:Deactivate() - end + HideDockletWindow(window) end end -local DockBar_GetDefault = function(self) - local default = MOD.private.DefaultDocklets[self.Data.Location] - local button = _G[default] - if(button and button.Activate) then - local window = button:GetAttribute("ownerFrame") - if window and _G[window] then - DockBar_ResetDocklets(self) - self.Parent.Window.FrameLink = _G[window] - self.Parent.Window:FadeIn() - _G[window]:Show() - button:Activate() +local DockBar_RefreshDocklets = function(self) + local location = self.Data.Location; + local ownerFrame = "" + local defaultButton = MOD.private.DefaultDocklets[location]; + if(_G[defaultButton]) then + ownerFrame = _G[defaultButton]:GetAttribute("ownerFrame") + end + for name,window in pairs(self.Data.Windows) do + if(name ~= ownerFrame) then + HideDockletWindow(window) end end end local DockBar_SetDefault = function(self, button) - if((not button) or (not button.FrameLink) or (not button.Activate)) then return end - MOD.private.DefaultDocklets[self.Data.Location] = button:GetName(); - local window = button:GetAttribute("ownerFrame") - if window and _G[window] then - DockBar_ResetDocklets(self) - self.Parent.Window.FrameLink = _G[window] - self.Parent.Window:FadeIn() - _G[window]:Show() - button:Activate() + local location = self.Data.Location; + local defaultFrame,thisIsShowing; + if(button) then + local ownerFrame = button:GetAttribute("ownerFrame"); + defaultFrame = _G[ownerFrame]; + if(defaultFrame) then + MOD.private.DefaultDocklets[location] = button:GetName(); + thisIsShowing = true + end end -end -local DockBar_GetNextDefault = function(self) - for i = 1, #self.Data.Order do - local nextName = self.Data.Order[i]; - local nextButton = self.Data.Buttons[nextName]; - local button = _G[nextButton] - if(button and button.Activate) then - local window = button:GetAttribute("ownerFrame") - if window and _G[window] then - MOD.private.DefaultDocklets[self.Data.Location] = nextName; - DockBar_ResetDocklets(self) - self.Parent.Window.FrameLink = _G[window] - self.Parent.Window:FadeIn() - _G[window]:Show() - _G[window]:FadeIn() - button:Activate() - return - end + if((not button) or (not defaultFrame)) then + local defaultButton = MOD.private.DefaultDocklets[location]; + button = _G[defaultButton]; + if(button) then + local ownerFrame = button:GetAttribute("ownerFrame"); + defaultFrame = _G[ownerFrame]; end end + + if(button and defaultFrame) then + DockBar_ResetDocklets(self); + ShowDockletWindow(self.Parent.Window, defaultFrame); + ActivateDockletButton(button); + end + + return thisIsShowing end -local DockBar_ToggleDocklet = function(self, button) - if(button.FrameLink) then - DockBar_SetDefault(self, button) - else - button:Deactivate() - DockBar_GetDefault(self) +local DockBar_NextDefault = function(self) + local location = self.Data.Location; + local buttonList = self.Data.Buttons; + for nextName,nextButton in pairs(buttonList) do + local ownerFrame = nextButton:GetAttribute("ownerFrame"); + if(_G[ownerFrame]) then + MOD.private.DefaultDocklets[location] = nextName; + DockBar_ResetDocklets(self) + ShowDockletWindow(self.Parent.Window, _G[ownerFrame]); + ActivateDockletButton(nextButton); + break; + end end end @@ -607,7 +649,7 @@ local DockBar_AddButton = function(self, button) if(#self.Data.Order > 0) then self.Parent.backdrop:Show() end - DockBar_GetDefault(self) + self:SetDefault() self:Update() end @@ -645,12 +687,15 @@ local DockBar_RemoveButton = function(self, button, isMoving) if(#self.Data.Order == 0) then MOD.private.DefaultDocklets[currentLocation] = nil; self.Parent.backdrop:Hide() - elseif(MOD.private.DefaultDocklets[currentLocation] == name or (not MOD.private.DefaultDocklets[currentLocation]) or (MOD.private.DefaultDocklets[currentLocation] == "")) then - DockBar_GetNextDefault(self) 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() + end self:Update() end --[[ @@ -658,34 +703,6 @@ end DOCKBUTTON FUNCTIONS ########################################################## ]]-- -local DockButton_Activate = function(self) - self:SetAttribute("isActive", true) - self:SetPanelColor("default") - self.Icon:SetGradient(unpack(SV.media.gradient.checked)) - if(self.FrameLink) then - if(not InCombatLockdown()) then - self.FrameLink:SetFrameLevel(10) - self.FrameLink:Show() - end - self.FrameLink:FadeIn() - self.Parent.Parent.backdrop:Show() - end -end - -local DockButton_Deactivate = function(self) - self:SetAttribute("isActive", false) - self:SetPanelColor("default") - self.Icon:SetGradient(unpack(SV.media.gradient.icon)) - if(self.FrameLink) then - if(not InCombatLockdown()) then - self.FrameLink:SetFrameLevel(0) - self.FrameLink:Hide() - else - self.FrameLink:FadeOut(0.2, 1, 0, true) - end - end -end - local DockButton_OnEnter = function(self, ...) MOD:EnterFade() self:SetPanelColor("highlight") @@ -731,10 +748,9 @@ local DockButton_OnClick = function(self, button) local list = self:GetMenuList(); SV.Dropdown:Open(self, list, "Dock Options"); else - if self.PostClickFunction then + local thisIsShowing = DockBar_SetDefault(self, button) + if(self.PostClickFunction and thisIsShowing) then self:PostClickFunction(button) - else - self.Parent:Toggle(self) end end end @@ -832,8 +848,6 @@ local DockBar_CreateButton = function(self, displayName, texture, onclick, globa button.Parent = self; button.OrderIndex = 0; - button.Activate = DockButton_Activate - button.Deactivate = DockButton_Deactivate button.GetMenuList = DockButton_GetMenuList button.SetDocked = DockButton_SetDocked @@ -847,8 +861,6 @@ local DockBar_CreateButton = function(self, displayName, texture, onclick, globa if(frameLink) then button.FrameLink = frameLink button:SetAttribute("ownerFrame", frameLink:GetName()) - else - button:SetAttribute("ownerFrame", globalName) end self:Add(button) @@ -902,10 +914,8 @@ for location, settings in pairs(DOCK_LOCATIONS) do MOD[location].Alert.Deactivate = DockAlert_Deactivate; MOD[location].Bar.Parent = MOD[location]; - MOD[location].Bar.GetDefault = DockBar_GetDefault; MOD[location].Bar.SetDefault = DockBar_SetDefault; - MOD[location].Bar.NextDefault = DockBar_GetNextDefault; - MOD[location].Bar.Toggle = DockBar_ToggleDocklet; + MOD[location].Bar.NextDefault = DockBar_NextDefault; MOD[location].Bar.Update = DockBar_UpdateLayout; MOD[location].Bar.Add = DockBar_AddButton; MOD[location].Bar.Remove = DockBar_RemoveButton; @@ -1004,7 +1014,6 @@ function MOD:NewDocklet(location, globalName, readableName, texture, onclick) frame.Enable = Docklet_Enable; frame.Relocate = Docklet_Relocate; frame.GetButtonSize = Docklet_ButtonSize; - frame:FadeCallback(function() DockBar_GetDefault(newParent.Bar) end, false, true) newParent.Bar.Data.Windows[globalName] = frame; @@ -1334,7 +1343,7 @@ end local function UpdateAllDocks() for location, settings in pairs(DOCK_LOCATIONS) do local dock = MOD[location]; - DockBar_GetDefault(dock.Bar) + DockBar_SetDefault(dock.Bar) end MOD:UpdateDockBackdrops() diff --git a/SVUI_!Core/system/misc.lua b/SVUI_!Core/system/misc.lua index 0b75a31..5d9d728 100644 --- a/SVUI_!Core/system/misc.lua +++ b/SVUI_!Core/system/misc.lua @@ -829,6 +829,17 @@ local function InitializeMisc() ThreatMeter:SetScript("OnEvent", ThreatBar_OnEvent); SV:NewAnchor(ThreatMeter, L["Threat-O-Meter"]) end + + local cfg = CreateFrame("Button", "GameMenuButtonSVUI", GameMenuFrame, "GameMenuButtonTemplate") + cfg:Size(GameMenuButtonUIOptions:GetWidth(), GameMenuButtonUIOptions:GetHeight()) + cfg:Point("TOP", GameMenuButtonUIOptions, "BOTTOM", 0 , -1) + cfg:SetScript("OnClick", function() SV:ToggleConfig() HideUIPanel(GameMenuFrame) end) + cfg:SetText("|cffFFFF00SuperVillain|r") + GameMenuFrame:HookScript("OnShow", function() + GameMenuFrame:Height(GameMenuFrame:GetHeight() + GameMenuButtonUIOptions:GetHeight()) + end) + GameMenuButtonKeybindings:ClearAllPoints() + GameMenuButtonKeybindings:Point("TOP", cfg, "BOTTOM", 0, -1) end SV.Events:On("CORE_INITIALIZED", InitializeMisc); diff --git a/SVUI_!Core/system/overrides.lua b/SVUI_!Core/system/overrides.lua index 88a93cb..3e33a8b 100644 --- a/SVUI_!Core/system/overrides.lua +++ b/SVUI_!Core/system/overrides.lua @@ -885,7 +885,7 @@ local Vehicle_OnSetPoint = function(self, _, parent) end local Dura_OnSetPoint = function(self, _, parent) - if((parent == "MinimapCluster") or (parent == _G["MinimapCluster"])) then + if(parent ~= Minimap) then self:ClearAllPoints() self:SetPoint("RIGHT", Minimap, "RIGHT") self:SetScale(0.6) diff --git a/SVUI_QuestTracker/components/quests.lua b/SVUI_QuestTracker/components/quests.lua index 4abeff6..b651cac 100644 --- a/SVUI_QuestTracker/components/quests.lua +++ b/SVUI_QuestTracker/components/quests.lua @@ -1111,20 +1111,17 @@ local function UpdateQuestLocals(...) QUEST_ROW_HEIGHT = ROW_HEIGHT + 2; end -local ticker; local _hook_QuestDock_OnShow = function(self) - if(not self.DockButton:GetAttribute("isActive")) then return end - if(not ticker) then - ticker = SV.Timers:ExecuteTimer(ShowItemBarButtons, 1) - end + MOD.QuestItemTimer = SV.Timers:ExecuteTimer(ShowItemBarButtons, 1.2); + ShowItemBarButtons(); end local _hook_QuestDock_OnHide = function(self) - if(ticker) then - SV.Timers:RemoveTimer(ticker) - ticker = nil + if(MOD.QuestItemTimer) then + SV.Timers:RemoveTimer(MOD.QuestItemTimer) + MOD.QuestItemTimer = nil end - HideItemBarButtons() + HideItemBarButtons(); end function MOD:InitializeQuests() @@ -1141,13 +1138,13 @@ function MOD:InitializeQuests() end SV:NewAnchor(ItemBar, L["Quest Items"]); - + for i = 1, 5 do ItemBar.Buttons[i] = CreateQuestItemButton(i) end - self.Docklet:HookScript("OnShow", _hook_QuestDock_OnShow) - self.Docklet:HookScript("OnHide", _hook_QuestDock_OnHide) + self.Docklet:FadeCallback(_hook_QuestDock_OnShow, false, true) + self.Docklet:FadeCallback(_hook_QuestDock_OnHide, true) local scrollChild = self.Docklet.ScrollFrame.ScrollChild; local quests = CreateFrame("Frame", nil, scrollChild) diff --git a/SVUI_Skins/SVUI_Skins.lua b/SVUI_Skins/SVUI_Skins.lua index 10e7c25..eda493e 100644 --- a/SVUI_Skins/SVUI_Skins.lua +++ b/SVUI_Skins/SVUI_Skins.lua @@ -232,27 +232,15 @@ CUSTOM HANDLERS ########################################################## ]]-- local AddonDockletToggle = function(self) - if(not InCombatLockdown()) then - self.Parent:Refresh() - - if(not self.Parent.Parent.Window:IsShown()) then - self.Parent.Parent.Window:Show() - end - end - if(not MOD.Docklet:IsShown()) then MOD.Docklet:Show() end - if(not MOD.Docklet.Dock1:IsShown()) then MOD.Docklet.Dock1:Show() end - if(not MOD.Docklet.Dock2:IsShown()) then MOD.Docklet.Dock2:Show() end - - self:Activate() end local ShowSubDocklet = function(self) diff --git a/SVUI_Skins/components/blizzard/system.lua b/SVUI_Skins/components/blizzard/system.lua index 8e44bca..287e1de 100644 --- a/SVUI_Skins/components/blizzard/system.lua +++ b/SVUI_Skins/components/blizzard/system.lua @@ -13,8 +13,8 @@ local L = SV.L; local MOD = SV.Skins; local Schema = MOD.Schema; local ceil = math.ceil ---[[ -########################################################## +--[[ +########################################################## MASSIVE LIST OF LISTS ########################################################## ]]-- @@ -44,36 +44,37 @@ local SystemFrameList1 = { local SystemFrameList4 = { "Options", "Store", - "SoundOptions", - "UIOptions", - "Keybindings", + "SoundOptions", + "UIOptions", + "Keybindings", "Macros", "Ratings", - "AddOns", - "Logout", - "Quit", - "Continue", + "AddOns", + "Logout", + "Quit", + "Continue", "MacOptions", "Help", "WhatsNew", - "Addons" + "Addons", + "SVUI" }; local SystemFrameList5 = { - "GameMenuFrame", - "InterfaceOptionsFrame", - "AudioOptionsFrame", + "GameMenuFrame", + "InterfaceOptionsFrame", + "AudioOptionsFrame", "VideoOptionsFrame", }; local SystemFrameList6 = { - "VideoOptionsFrameOkay", - "VideoOptionsFrameCancel", - "VideoOptionsFrameDefaults", - "VideoOptionsFrameApply", - "AudioOptionsFrameOkay", - "AudioOptionsFrameCancel", - "AudioOptionsFrameDefaults", - "InterfaceOptionsFrameDefaults", - "InterfaceOptionsFrameOkay", + "VideoOptionsFrameOkay", + "VideoOptionsFrameCancel", + "VideoOptionsFrameDefaults", + "VideoOptionsFrameApply", + "AudioOptionsFrameOkay", + "AudioOptionsFrameCancel", + "AudioOptionsFrameDefaults", + "InterfaceOptionsFrameDefaults", + "InterfaceOptionsFrameOkay", "InterfaceOptionsFrameCancel", "ReadyCheckFrameYesButton", "ReadyCheckFrameNoButton", @@ -394,8 +395,8 @@ local SystemFrameList21 = { "AddonListScrollFrameScrollBar", "OpacityFrameSlider", }; ---[[ -########################################################## +--[[ +########################################################## HELPER FUNCTIONS ########################################################## ]]-- @@ -405,8 +406,8 @@ local _hook_GhostFrameBackdropColor = function(self, r, g, b, a) self:SetBackdropBorderColor(0,0,0,0) end end ---[[ -########################################################## +--[[ +########################################################## SYSTEM WIDGET MODRS ########################################################## ]]-- @@ -442,7 +443,7 @@ local function SystemPanelQue() SV.API:Set("Window", this) end end - + LFDRoleCheckPopup:RemoveTextures() LFDRoleCheckPopup:SetStyle("!_Frame") LFDRoleCheckPopupAcceptButton:SetStyle("Button") @@ -502,7 +503,7 @@ local function SystemPanelQue() tex:InsetPoints() end for i = 1, #SystemFrameList5 do - local this = _G[SystemFrameList5[i].."Header"] + local this = _G[SystemFrameList5[i].."Header"] if(this) then this:SetTexture("") this:ClearAllPoints() @@ -520,18 +521,18 @@ local function SystemPanelQue() end end VideoOptionsFrameCancel:ClearAllPoints() - VideoOptionsFrameCancel:SetPoint("RIGHT",VideoOptionsFrameApply,"LEFT",-4,0) + VideoOptionsFrameCancel:SetPoint("RIGHT",VideoOptionsFrameApply,"LEFT",-4,0) VideoOptionsFrameOkay:ClearAllPoints() - VideoOptionsFrameOkay:SetPoint("RIGHT",VideoOptionsFrameCancel,"LEFT",-4,0) + VideoOptionsFrameOkay:SetPoint("RIGHT",VideoOptionsFrameCancel,"LEFT",-4,0) AudioOptionsFrameOkay:ClearAllPoints() AudioOptionsFrameOkay:SetPoint("RIGHT",AudioOptionsFrameCancel,"LEFT",-4,0) InterfaceOptionsFrameOkay:ClearAllPoints() InterfaceOptionsFrameOkay:SetPoint("RIGHT",InterfaceOptionsFrameCancel,"LEFT", -4,0) ReadyCheckFrameYesButton:SetParent(ReadyCheckFrame) - ReadyCheckFrameNoButton:SetParent(ReadyCheckFrame) + ReadyCheckFrameNoButton:SetParent(ReadyCheckFrame) ReadyCheckFrameYesButton:SetPoint("RIGHT", ReadyCheckFrame, "CENTER", -1, 0) ReadyCheckFrameNoButton:SetPoint("LEFT", ReadyCheckFrameYesButton, "RIGHT", 3, 0) - ReadyCheckFrameText:SetParent(ReadyCheckFrame) + ReadyCheckFrameText:SetParent(ReadyCheckFrame) ReadyCheckFrameText:ClearAllPoints() ReadyCheckFrameText:SetPoint("TOP", 0, -12) ReadyCheckListenerFrame:SetAlpha(0) @@ -542,13 +543,13 @@ local function SystemPanelQue() InterfaceOptionsFrame:SetMovable(true) InterfaceOptionsFrame:EnableMouse(true) InterfaceOptionsFrame:RegisterForDrag("LeftButton", "RightButton") - InterfaceOptionsFrame:SetScript("OnDragStart", function(self) + InterfaceOptionsFrame:SetScript("OnDragStart", function(self) if InCombatLockdown() then return end if IsShiftKeyDown() then - self:StartMoving() + self:StartMoving() end end) - InterfaceOptionsFrame:SetScript("OnDragStop", function(self) + InterfaceOptionsFrame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end) if IsMacClient() then @@ -711,7 +712,7 @@ local function SystemPanelQue() MacOptionsFrameCancel:SetPoint("LEFT", MacOptionsFrameOkay, "RIGHT", 2, 0) MacOptionsFrameCancel:SetWidth(MacOptionsFrameCancel:GetWidth() - 6) end - + ReportCheatingDialog:RemoveTextures() ReportCheatingDialogCommentFrame:RemoveTextures() ReportCheatingDialogReportButton:SetStyle("Button") @@ -733,12 +734,12 @@ local function SystemPanelQue() SideDressUpModel:SetStyle("!_Frame", "Model") SideDressUpModelResetButton:SetStyle("Button") SideDressUpModelResetButton:SetPoint("BOTTOM", SideDressUpModel, "BOTTOM", 0, 20) - SV.API:Set("CloseButton", SideDressUpModelCloseButton) + SV.API:Set("CloseButton", SideDressUpModelCloseButton) SV.API:Set("CloseButton", SideDressUpModelCloseButton) end ---[[ -########################################################## +--[[ +########################################################## MOD LOADING ########################################################## ]]-- -MOD:SaveCustomStyle(SystemPanelQue) \ No newline at end of file +MOD:SaveCustomStyle(SystemPanelQue)