mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
update Ace3
This commit is contained in:
@@ -81,11 +81,11 @@ local function UpdateButton(button, treeline, selected, canExpand, isExpanded)
|
||||
local line = button.line
|
||||
button.level = level
|
||||
if ( level == 1 ) then
|
||||
button.text:SetFontObject("GameFontNormal")
|
||||
button:SetTextFontObject("GameFontNormal")
|
||||
button:SetHighlightFontObject("GameFontHighlight")
|
||||
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8, 2)
|
||||
else
|
||||
button.text:SetFontObject("GameFontHighlightSmall")
|
||||
button:SetTextFontObject("GameFontHighlightSmall")
|
||||
button:SetHighlightFontObject("GameFontHighlightSmall")
|
||||
button.text:SetPoint("LEFT", (icon and 16 or 0) + 8 * level, 2)
|
||||
end
|
||||
|
||||
@@ -24,29 +24,29 @@ local function lockTooltip()
|
||||
GameTooltip:SetText(" ")
|
||||
GameTooltip:Show()
|
||||
end
|
||||
local function dragdrop_OnMouseDown(...)
|
||||
local function dragdrop_OnMouseDown()
|
||||
if this.obj.dragOnMouseDown then
|
||||
dragdropButton.mouseDownFrame = this
|
||||
dragdropButton:SetText(this.obj.value or "Unknown")
|
||||
dragdropButton:SetWidth(this:GetWidth())
|
||||
dragdropButton:SetHeight(this:SetHeight())
|
||||
this.obj.dragOnMouseDown(this, unpack(arg))
|
||||
this.obj.dragOnMouseDown(this, arg1)
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnMouseUp(...)
|
||||
local function dragdrop_OnMouseUp()
|
||||
if this.obj.dragOnMouseUp then
|
||||
this:SetAlpha(1)
|
||||
GameTooltip:Hide()
|
||||
dragdropButton:Hide()
|
||||
if dragdropButton.enteredFrame and dragdropButton.enteredFrame ~= this and dragdropButton.enteredFrame:IsMouseOver() then
|
||||
this.obj.dragOnMouseUp(this, unpack(arg))
|
||||
this.obj.ActivateMultiControl(this.obj, unpack(arg))
|
||||
this.obj.dragOnMouseUp(this, arg1)
|
||||
this.obj.ActivateMultiControl(this.obj, arg1)
|
||||
end
|
||||
dragdropButton.enteredFrame = nil
|
||||
dragdropButton.mouseDownFrame = nil
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnLeave(...)
|
||||
local function dragdrop_OnLeave()
|
||||
if this.obj.dragOnLeave then
|
||||
if dragdropButton.mouseDownFrame then
|
||||
lockTooltip()
|
||||
@@ -54,15 +54,15 @@ local function dragdrop_OnLeave(...)
|
||||
if this == dragdropButton.mouseDownFrame then
|
||||
this:SetAlpha(0)
|
||||
dragdropButton:Show()
|
||||
this.obj.dragOnLeave(this, unpack(arg))
|
||||
this.obj.dragOnLeave(this)
|
||||
end
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnEnter(...)
|
||||
local function dragdrop_OnEnter()
|
||||
if this.obj.dragOnEnter and dragdropButton:IsShown() then
|
||||
dragdropButton.enteredFrame = this
|
||||
lockTooltip()
|
||||
this.obj.dragOnEnter(this, unpack(arg))
|
||||
this.obj.dragOnEnter(this)
|
||||
end
|
||||
end
|
||||
local function dragdrop_OnClick()
|
||||
|
||||
@@ -228,7 +228,9 @@ local methods = {
|
||||
|
||||
if image:GetTexture() then
|
||||
local n = arg.n
|
||||
if n == 4 or n == 8 then
|
||||
if n == 4 then
|
||||
image:SetTexCoord(arg[1], arg[2], arg[3], arg[4])
|
||||
elseif n == 8 then
|
||||
image:SetTexCoord(unpack(arg))
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
|
||||
-- Lua APIs
|
||||
local assert, unpack = assert, unpack
|
||||
local assert = assert
|
||||
|
||||
-- WoW APIs
|
||||
local PlaySound = PlaySound
|
||||
@@ -107,7 +107,7 @@ end
|
||||
|
||||
-- exported
|
||||
function ItemBase.SetPoint(self, ...)
|
||||
self.frame:SetPoint(unpack(arg))
|
||||
self.frame:SetPoint(arg[1], arg[2], arg[3], arg[4], arg[5])
|
||||
end
|
||||
|
||||
-- exported
|
||||
|
||||
@@ -59,7 +59,9 @@ local methods = {
|
||||
|
||||
if image:GetTexture() then
|
||||
local n = arg.n
|
||||
if n == 4 or n == 8 then
|
||||
if n == 4 then
|
||||
image:SetTexCoord(arg[1], arg[2], arg[3], arg[4])
|
||||
elseif n == 8 then
|
||||
image:SetTexCoord(unpack(arg))
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
|
||||
@@ -45,12 +45,14 @@ local methods = {
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetHighlight"] = function(self, ...)
|
||||
self.highlight:SetTexture(unpack(arg))
|
||||
self.highlight:SetTexture(arg[1], arg[2], arg[3], arg[4])
|
||||
end,
|
||||
|
||||
["SetHighlightTexCoord"] = function(self, ...)
|
||||
local c = arg.n
|
||||
if c == 4 or c == 8 then
|
||||
if c == 4 then
|
||||
self.highlight:SetTexCoord(arg[1], arg[2], arg[3], arg[4])
|
||||
elseif c == 8 then
|
||||
self.highlight:SetTexCoord(unpack(arg))
|
||||
else
|
||||
self.highlight:SetTexCoord(0, 1, 0, 1)
|
||||
|
||||
@@ -12,6 +12,7 @@ local pairs = pairs
|
||||
-- WoW APIs
|
||||
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
local MouseIsOver = MouseIsOver
|
||||
|
||||
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
|
||||
-- List them here for Mikk's FindGlobals script
|
||||
@@ -29,17 +30,8 @@ local function Control_OnLeave()
|
||||
this.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function Keybinding_OnHide()
|
||||
local self = this.obj
|
||||
this:EnableKeyboard(false)
|
||||
this:EnableMouseWheel(false)
|
||||
self.msgframe:Hide()
|
||||
this:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
end
|
||||
|
||||
local function Keybinding_OnClick()
|
||||
if arg1 == "LeftButton" or arg1 == "RightButton" then
|
||||
local function Keybinding_OnMouseUp()
|
||||
if (arg1 == "LeftButton" or arg1 == "RightButton") and MouseIsOver(this) and not this.disabled then
|
||||
local self = this.obj
|
||||
if self.waitingForKey then
|
||||
this:EnableKeyboard(false)
|
||||
@@ -61,13 +53,15 @@ end
|
||||
local ignoreKeys = {
|
||||
["BUTTON1"] = true, ["BUTTON2"] = true,
|
||||
["UNKNOWN"] = true,
|
||||
["LSHIFT"] = true, ["LCTRL"] = true, ["LALT"] = true,
|
||||
["RSHIFT"] = true, ["RCTRL"] = true, ["RALT"] = true,
|
||||
["SHIFT"] = true, ["CTRL"] = true, ["ALT"] = true,
|
||||
}
|
||||
local function Keybinding_OnKeyDown()
|
||||
local self = this.obj
|
||||
local function Keybinding_OnKeyDown(frame, key)
|
||||
local frame = this or frame
|
||||
local key = key or arg1
|
||||
|
||||
local self = frame.obj
|
||||
if self.waitingForKey then
|
||||
local keyPressed = arg1
|
||||
local keyPressed = key
|
||||
if keyPressed == "ESCAPE" then
|
||||
keyPressed = ""
|
||||
else
|
||||
@@ -83,62 +77,41 @@ local function Keybinding_OnKeyDown()
|
||||
end
|
||||
end
|
||||
|
||||
this:EnableKeyboard(false)
|
||||
this:EnableMouseWheel(false)
|
||||
frame:EnableKeyboard(false)
|
||||
frame:EnableMouseWheel(false)
|
||||
self.msgframe:Hide()
|
||||
this:UnlockHighlight()
|
||||
frame:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
|
||||
if not self.disabled then
|
||||
if not frame.disabled then
|
||||
self:SetKey(keyPressed)
|
||||
self:Fire("OnKeyChanged", keyPressed)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function Keybinding_OnMouseUp()
|
||||
if MouseIsOver(this) and not self.disabled then
|
||||
local self = this.obj
|
||||
if self.waitingForKey then
|
||||
if arg1 ~= "LeftButton" and arg1 ~= "RightButton" then
|
||||
Keybinding_OnKeyDown()
|
||||
end
|
||||
this:EnableKeyboard(false)
|
||||
this:EnableMouseWheel(false)
|
||||
self.msgframe:Hide()
|
||||
this:UnlockHighlight()
|
||||
self.waitingForKey = nil
|
||||
else
|
||||
this:EnableKeyboard(true)
|
||||
this:EnableMouseWheel(true)
|
||||
self.msgframe:Show()
|
||||
this:LockHighlight()
|
||||
self.waitingForKey = true
|
||||
end
|
||||
end
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Keybinding_OnMouseDown()
|
||||
if arg1 == "LeftButton" or arg1 == "RightButton" then
|
||||
local button = arg1
|
||||
if button == "LeftButton" or button == "RightButton" then
|
||||
return
|
||||
elseif arg1 == "MiddleButton" then
|
||||
arg1 = "BUTTON3"
|
||||
elseif arg1 == "Button4" then
|
||||
arg1 = "BUTTON4"
|
||||
elseif arg1 == "Button5" then
|
||||
arg1 = "BUTTON5"
|
||||
elseif button == "MiddleButton" then
|
||||
button = "BUTTON3"
|
||||
elseif button == "Button4" then
|
||||
button = "BUTTON4"
|
||||
elseif button == "Button5" then
|
||||
button = "BUTTON5"
|
||||
end
|
||||
Keybinding_OnKeyDown()
|
||||
Keybinding_OnKeyDown(this, button)
|
||||
end
|
||||
|
||||
local function Keybinding_OnMouseWheel()
|
||||
local button
|
||||
if arg1 >= 0 then
|
||||
arg1 = "MOUSEWHEELUP"
|
||||
button = "MOUSEWHEELUP"
|
||||
else
|
||||
arg1 = "MOUSEWHEELDOWN"
|
||||
button = "MOUSEWHEELDOWN"
|
||||
end
|
||||
Keybinding_OnKeyDown()
|
||||
Keybinding_OnKeyDown(this, button)
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
@@ -172,10 +145,10 @@ local methods = {
|
||||
["SetKey"] = function(self, key)
|
||||
if (key or "") == "" then
|
||||
self.button:SetText(NOT_BOUND)
|
||||
self.text:SetFontObject("GameFontNormal")
|
||||
self.button:SetTextFontObject("GameFontNormal")
|
||||
else
|
||||
self.button:SetText(key)
|
||||
self.text:SetFontObject("GameFontHighlight")
|
||||
self.button:SetTextFontObject("GameFontHighlight")
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -226,12 +199,10 @@ local function Constructor()
|
||||
button:RegisterForClicks("AnyDown")
|
||||
button:SetScript("OnEnter", Control_OnEnter)
|
||||
button:SetScript("OnLeave", Control_OnLeave)
|
||||
-- button:SetScript("OnClick", Keybinding_OnClick)
|
||||
button:SetScript("OnMouseUp", Keybinding_OnMouseUp)
|
||||
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
|
||||
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
|
||||
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
|
||||
button:SetScript("OnHide", Keybinding_OnHide)
|
||||
button:SetPoint("BOTTOMLEFT", 0, 0)
|
||||
button:SetPoint("BOTTOMRIGHT", 0, 0)
|
||||
button:SetHeight(24)
|
||||
@@ -269,8 +240,7 @@ local function Constructor()
|
||||
msgframe = msgframe,
|
||||
frame = frame,
|
||||
alignoffset = 30,
|
||||
type = Type,
|
||||
text = text
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
|
||||
@@ -112,7 +112,9 @@ local methods = {
|
||||
if image:GetTexture() then
|
||||
self.imageshown = true
|
||||
local n = arg.n
|
||||
if n == 4 or n == 8 then
|
||||
if n == 4 then
|
||||
image:SetTexCoord(arg[1], arg[2], arg[3], arg[4])
|
||||
elseif n == 8 then
|
||||
image:SetTexCoord(unpack(arg))
|
||||
else
|
||||
image:SetTexCoord(0, 1, 0, 1)
|
||||
|
||||
Reference in New Issue
Block a user