mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
Ace gui tab and mover
This commit is contained in:
@@ -239,7 +239,7 @@ function E:CreateMoverPopup()
|
||||
desc:SetText(L["DESC_MOVERCONFIG"])
|
||||
|
||||
local snapping = CreateFrame("CheckButton", f:GetName().."CheckButton", f, "OptionsCheckButtonTemplate")
|
||||
_G[snapping:GetName() .. "Text"]:SetText(L["Sticky Frames"])
|
||||
_G[snapping:GetName().."Text"]:SetText(L["Sticky Frames"])
|
||||
|
||||
snapping:SetScript("OnShow", function()
|
||||
this:SetChecked(E.db.general.stickyFrames)
|
||||
@@ -250,7 +250,7 @@ function E:CreateMoverPopup()
|
||||
end)
|
||||
|
||||
local lock = CreateFrame("Button", f:GetName().."CloseButton", f, "OptionsButtonTemplate")
|
||||
_G[lock:GetName() .. "Text"]:SetText(L["Lock"])
|
||||
_G[lock:GetName().."Text"]:SetText(L["Lock"])
|
||||
|
||||
lock:SetScript("OnClick", function()
|
||||
E:ToggleConfigMode(true)
|
||||
@@ -269,7 +269,7 @@ function E:CreateMoverPopup()
|
||||
align:SetAutoFocus(false)
|
||||
align:SetScript("OnEscapePressed", function()
|
||||
this:SetText(E.db.gridSize)
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
align:SetScript("OnEnterPressed", function()
|
||||
local text = this:GetText()
|
||||
@@ -283,14 +283,14 @@ function E:CreateMoverPopup()
|
||||
this:SetText(E.db.gridSize)
|
||||
end
|
||||
E:Grid_Show()
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
align:SetScript("OnEditFocusLost", function()
|
||||
this:SetText(E.db.gridSize)
|
||||
end)
|
||||
align:SetScript("OnEditFocusGained", align.HighlightText)
|
||||
align:SetScript("OnShow", function()
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
this:SetText(E.db.gridSize)
|
||||
end)
|
||||
|
||||
@@ -356,7 +356,7 @@ function E:CreateMoverPopup()
|
||||
xOffset.currentValue = 0
|
||||
xOffset:SetScript("OnEscapePressed", function()
|
||||
this:SetText(E:Round(xOffset.currentValue))
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
xOffset:SetScript("OnEnterPressed", function()
|
||||
local num = this:GetText()
|
||||
@@ -366,14 +366,14 @@ function E:CreateMoverPopup()
|
||||
E:NudgeMover(diff)
|
||||
end
|
||||
this:SetText(E:Round(xOffset.currentValue))
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
xOffset:SetScript("OnEditFocusLost", function()
|
||||
this:SetText(E:Round(xOffset.currentValue))
|
||||
end)
|
||||
xOffset:SetScript("OnEditFocusGained", xOffset.HighlightText)
|
||||
xOffset:SetScript("OnShow", function()
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
this:SetText(E:Round(xOffset.currentValue))
|
||||
end)
|
||||
|
||||
@@ -391,7 +391,7 @@ function E:CreateMoverPopup()
|
||||
yOffset.currentValue = 0
|
||||
yOffset:SetScript("OnEscapePressed", function()
|
||||
this:SetText(E:Round(yOffset.currentValue))
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
yOffset:SetScript("OnEnterPressed", function()
|
||||
local num = this:GetText()
|
||||
@@ -401,14 +401,14 @@ function E:CreateMoverPopup()
|
||||
E:NudgeMover(nil, diff)
|
||||
end
|
||||
this:SetText(E:Round(yOffset.currentValue))
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
end)
|
||||
yOffset:SetScript("OnEditFocusLost", function()
|
||||
this:SetText(E:Round(yOffset.currentValue))
|
||||
end)
|
||||
yOffset:SetScript("OnEditFocusGained", yOffset.HighlightText)
|
||||
yOffset:SetScript("OnShow", function()
|
||||
EditBox_ClearFocus(this)
|
||||
this:ClearFocus()
|
||||
this:SetText(E:Round(yOffset.currentValue))
|
||||
end)
|
||||
|
||||
|
||||
@@ -24,19 +24,19 @@ local function GetPoint(obj)
|
||||
return format("%s,%s,%s,%d,%d", point, anchor:GetName(), secondaryPoint, E:Round(x), E:Round(y))
|
||||
end
|
||||
|
||||
local function UpdateCoords()
|
||||
local mover = this.child
|
||||
local x, y, _, nudgePoint, nudgeInversePoint = E:CalculateMoverPoints(mover)
|
||||
local function UpdateCoords(self)
|
||||
local mover = self.child;
|
||||
local x, y, _, nudgePoint, nudgeInversePoint = E:CalculateMoverPoints(mover);
|
||||
|
||||
local coordX, coordY = E:GetXYOffset(nudgeInversePoint, 1)
|
||||
ElvUIMoverNudgeWindow:ClearAllPoints()
|
||||
ElvUIMoverNudgeWindow:SetPoint(nudgePoint, mover, nudgeInversePoint, coordX, coordY)
|
||||
E:UpdateNudgeFrame(mover, x, y)
|
||||
local coordX, coordY = E:GetXYOffset(nudgeInversePoint, 1);
|
||||
ElvUIMoverNudgeWindow:ClearAllPoints();
|
||||
ElvUIMoverNudgeWindow:SetPoint(nudgePoint, mover, nudgeInversePoint, coordX, coordY);
|
||||
E:UpdateNudgeFrame(mover, x, y);
|
||||
end
|
||||
|
||||
local isDragging = false
|
||||
local coordFrame = CreateFrame("Frame")
|
||||
coordFrame:SetScript("OnUpdate", UpdateCoords)
|
||||
coordFrame:SetScript("OnUpdate", function() UpdateCoords(this) end)
|
||||
coordFrame:Hide()
|
||||
|
||||
local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, shouldDisable)
|
||||
@@ -164,7 +164,8 @@ local function CreateMover(parent, name, text, overlay, snapOffset, postdrag, sh
|
||||
ElvUIMoverNudgeWindow:Show()
|
||||
E.AssignFrameToNudge(this)
|
||||
coordFrame.child = this
|
||||
coordFrame:GetScript("OnUpdate")(coordFrame)
|
||||
UpdateCoords(coordFrame)
|
||||
--coordFrame:GetScript("OnUpdate")(coordFrame)
|
||||
end
|
||||
|
||||
local function OnMouseDown(button)
|
||||
@@ -332,7 +333,7 @@ function E:CreateMover(parent, name, text, overlay, snapoffset, postdrag, moverT
|
||||
E.CreatedMovers[name]["text"] = text
|
||||
E.CreatedMovers[name]["overlay"] = overlay
|
||||
E.CreatedMovers[name]["postdrag"] = postdrag
|
||||
E.CreatedMovers[name]["snapoffset"] = snapOffset
|
||||
E.CreatedMovers[name]["snapoffset"] = snapoffset
|
||||
E.CreatedMovers[name]["point"] = GetPoint(parent)
|
||||
E.CreatedMovers[name]["shouldDisable"] = shouldDisable
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@ local Callbacks = {["onplay"] = {}, ["onpause"] = {}, ["onresume"] = {}, ["onsto
|
||||
|
||||
-- Update all current animations
|
||||
local AnimationOnUpdate = function()
|
||||
local elapsed = arg1
|
||||
for i = 1, getn(this) do
|
||||
if this[i] then -- Double check the the index still exists, due to pauses/stops removing them on the fly
|
||||
this[i]:Update(elapsed, i)
|
||||
this[i]:Update(arg1, i)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ local ToggleDropDownMenu = ToggleDropDownMenu
|
||||
local Minimap_OnClick = Minimap_OnClick
|
||||
local GetMinimapZoneText = GetMinimapZoneText
|
||||
|
||||
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", E.UIParent, "UIDropDownMenuTemplate")
|
||||
local menuFrame = CreateFrame("Frame", "MinimapRightClickMenu", E.UIParent, "L_UIDropDownMenuTemplate")
|
||||
local menuList = {
|
||||
{text = "CHARACTER_BUTTON",
|
||||
func = function() ToggleCharacter("PaperDollFrame") end},
|
||||
|
||||
@@ -321,7 +321,7 @@ function S:SkinAce3()
|
||||
if TYPE == "ScrollFrame" then
|
||||
local frame = widget.scrollbar
|
||||
SkinScrollBar(frame)
|
||||
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
|
||||
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup-ElvUI" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
|
||||
local frame = widget.content:GetParent()
|
||||
if TYPE == "Frame" then
|
||||
E:StripTextures(frame)
|
||||
@@ -379,7 +379,7 @@ function S:SkinAce3()
|
||||
end
|
||||
end
|
||||
|
||||
if TYPE == "TabGroup" then
|
||||
if TYPE == "TabGroup-ElvUI" then
|
||||
local oldCreateTab = widget.CreateTab
|
||||
widget.CreateTab = function(self, id)
|
||||
local tab = oldCreateTab(self, id)
|
||||
|
||||
@@ -9,4 +9,7 @@
|
||||
Libraries\Load_Libraries.xml
|
||||
locales\load_locales.xml
|
||||
core.lua
|
||||
actionbars.lua
|
||||
General.lua
|
||||
DataBars.lua
|
||||
UnitFrames.lua
|
||||
+4
-4
@@ -369,7 +369,7 @@ local function CleanUserData(widget, event)
|
||||
end
|
||||
end
|
||||
|
||||
if widget.type == "TabGroup" then
|
||||
if widget.type == "TabGroup-ElvUI" then
|
||||
widget:SetTabs(nil)
|
||||
if user.tablist then
|
||||
del(user.tablist)
|
||||
@@ -1440,7 +1440,7 @@ local function TreeOnButtonEnter(widget, event, _, uniquevalue, button)
|
||||
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
|
||||
|
||||
GameTooltip:SetOwner(button, "ANCHOR_NONE")
|
||||
if widget.type == "TabGroup" then
|
||||
if widget.type == "TabGroup-ElvUI" then
|
||||
GameTooltip:SetPoint("BOTTOM",button,"TOP")
|
||||
else
|
||||
GameTooltip:SetPoint("LEFT",button,"RIGHT")
|
||||
@@ -1604,7 +1604,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
||||
local name = GetOptionsMemberValue("name", group, options, path, appName)
|
||||
if grouptype == "tab" then
|
||||
|
||||
local tab = gui:Create("TabGroup")
|
||||
local tab = gui:Create("TabGroup-ElvUI")
|
||||
InjectInfo(tab, options, group, path, rootframe, appName)
|
||||
tab:SetCallback("OnGroupSelected", GroupSelected)
|
||||
tab:SetCallback("OnTabEnter", TreeOnButtonEnter)
|
||||
@@ -1650,7 +1650,7 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
|
||||
|
||||
local firstgroup = orderlist[1]
|
||||
if firstgroup then
|
||||
select:SetGroup((GroupExists(appName, options, path, status.groups.selected) and status.groups.selected) or firstgroup)
|
||||
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
|
||||
end
|
||||
|
||||
select.width = "fill"
|
||||
|
||||
+29
-54
@@ -2,22 +2,19 @@
|
||||
TabGroup Container
|
||||
Container that uses tabs on top to switch between groups.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "TabGroup", 35
|
||||
local Type, Version = "TabGroup-ElvUI", 31
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
local AceCore = LibStub("AceCore-3.0")
|
||||
local wipe = AceCore.wipe
|
||||
|
||||
-- Lua APIs
|
||||
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
|
||||
local tgetn = table.getn
|
||||
local strfmt = string.format
|
||||
local getn = table.getn
|
||||
local format = string.format
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local _G = AceCore._G
|
||||
local _G = _G
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
@@ -34,30 +31,27 @@ Support functions
|
||||
local function UpdateTabLook(frame)
|
||||
if frame.disabled then
|
||||
PanelTemplates_SetDisabledTabState(frame)
|
||||
frame:SetAlpha(0.5)
|
||||
elseif frame.selected then
|
||||
PanelTemplates_SelectTab(frame)
|
||||
frame:SetAlpha(1)
|
||||
else
|
||||
PanelTemplates_DeselectTab(frame)
|
||||
frame:SetAlpha(0.5)
|
||||
end
|
||||
end
|
||||
|
||||
local function Tab_SetText(tab, text)
|
||||
tab:_SetText(text)
|
||||
local width = tab.obj.frame.width or tab.obj.frame:GetWidth() or 0
|
||||
PanelTemplates_TabResize(0, tab, nil, width)
|
||||
local function Tab_SetText(frame, text)
|
||||
frame:_SetText(text)
|
||||
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
|
||||
PanelTemplates_TabResize(0, frame, nil, width)
|
||||
end
|
||||
|
||||
local function Tab_SetSelected(tab, selected)
|
||||
tab.selected = selected
|
||||
UpdateTabLook(tab)
|
||||
local function Tab_SetSelected(frame, selected)
|
||||
frame.selected = selected
|
||||
UpdateTabLook(frame)
|
||||
end
|
||||
|
||||
local function Tab_SetDisabled(tab, disabled)
|
||||
tab.disabled = disabled
|
||||
UpdateTabLook(tab)
|
||||
local function Tab_SetDisabled(frame, disabled)
|
||||
frame.disabled = disabled
|
||||
UpdateTabLook(frame)
|
||||
end
|
||||
|
||||
local function BuildTabsOnUpdate()
|
||||
@@ -110,30 +104,16 @@ local methods = {
|
||||
end,
|
||||
|
||||
["CreateTab"] = function(self, id)
|
||||
local tabname = strfmt("AceGUITabGroup%dTab%d", self.num, id)
|
||||
local tabname = format("AceGUITabGroup%dTab%d", self.num, id)
|
||||
local tab = CreateFrame("Button", tabname, self.border, "TabButtonTemplate")
|
||||
-- Normal texture
|
||||
local texture = getglobal(tabname.."Left")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
texture:ClearAllPoints()
|
||||
texture:SetPoint("BOTTOMLEFT", tab,"BOTTOMLEFT")
|
||||
texture:SetPoint("TOPLEFT", tab,"TOPLEFT")
|
||||
texture = getglobal(tabname.."Middle")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
texture = getglobal(tabname.."Right")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
-- Disabled texture
|
||||
texture = getglobal(tabname.."LeftDisabled")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
texture:SetPoint("BOTTOMLEFT", tab,"BOTTOMLEFT")
|
||||
texture:SetPoint("TOPLEFT", tab,"TOPLEFT")
|
||||
texture = getglobal(tabname.."MiddleDisabled")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
texture = getglobal(tabname.."RightDisabled")
|
||||
texture:SetTexture("Interface\\ChatFrame\\ChatFrameTab")
|
||||
|
||||
tab.obj = self
|
||||
tab.id = id
|
||||
tab:SetHeight(24)
|
||||
|
||||
tab.text = _G[tabname .. "Text"]
|
||||
tab.text:ClearAllPoints()
|
||||
tab.text:SetPoint("LEFT", 14, -3)
|
||||
tab.text:SetPoint("RIGHT", -12, -3)
|
||||
|
||||
tab:SetScript("OnClick", Tab_OnClick)
|
||||
tab:SetScript("OnEnter", Tab_OnEnter)
|
||||
@@ -209,28 +189,23 @@ local methods = {
|
||||
end
|
||||
|
||||
tab:Show()
|
||||
if type(v) == "table" then
|
||||
tab:SetText(v.text)
|
||||
tab:SetDisabled(v.disabled)
|
||||
tab.value = v.value
|
||||
elseif type(v) == "string" then
|
||||
tab:SetText(v)
|
||||
tab.value = v
|
||||
end
|
||||
tab:SetText(v.text)
|
||||
tab:SetDisabled(v.disabled)
|
||||
tab.value = v.value
|
||||
|
||||
widths[i] = tab:GetWidth() - 6 --tabs are anchored 10 pixels from the right side of the previous one to reduce spacing, but add a fixed 4px padding for the text
|
||||
end
|
||||
|
||||
for i = tgetn(tablist)+1, tgetn(tabs), 1 do
|
||||
local numtabs = getn(tablist)
|
||||
for i = numtabs+1, numtabs, 1 do
|
||||
tabs[i]:Hide()
|
||||
end
|
||||
|
||||
--First pass, find the minimum number of rows needed to hold all tabs and the initial tab layout
|
||||
local numtabs = tgetn(tablist)
|
||||
local numrows = 1
|
||||
local usedwidth = 0
|
||||
|
||||
for i = 1, tgetn(tablist) do
|
||||
for i = 1, numtabs do
|
||||
--If this is not the first tab of a row and there isn't room for it
|
||||
if usedwidth ~= 0 and (width - usedwidth - widths[i]) < 0 then
|
||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||
@@ -241,7 +216,7 @@ local methods = {
|
||||
usedwidth = usedwidth + widths[i]
|
||||
end
|
||||
rowwidths[numrows] = usedwidth + 10 --first tab in each row takes up an extra 10px
|
||||
rowends[numrows] = tgetn(tablist)
|
||||
rowends[numrows] = numtabs
|
||||
|
||||
--Fix for single tabs being left on the last row, move a tab from the row above if applicable
|
||||
if numrows > 1 then
|
||||
@@ -289,7 +264,7 @@ local methods = {
|
||||
starttab = endtab + 1
|
||||
end
|
||||
|
||||
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)+7
|
||||
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20)
|
||||
self.border:SetPoint("TOPLEFT", 1, -self.borderoffset)
|
||||
end,
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
|
||||
local AB = E:GetModule("ActionBars");
|
||||
local ACD = LibStub("AceConfigDialog-3.0-ElvUI");
|
||||
local ACD = LibStub("AceConfigDialog-3.0");
|
||||
local group
|
||||
|
||||
--Cache global variables
|
||||
|
||||
Reference in New Issue
Block a user