From 11ea55b1a5c54883ed4f42bdbe110d05ba26ffc8 Mon Sep 17 00:00:00 2001 From: Pinya <800pin.ru@gmail.com> Date: Tue, 24 Jul 2018 18:46:37 +0300 Subject: [PATCH] update Ace3 --- .../AceConsole-3.0/AceConsole-3.0.lua | 1 - .../AceConfigCmd-3.0/AceConfigCmd-3.0.lua | 2 +- .../Libraries/AceGUI-3.0/AceGUI-3.0.lua | 4 +- .../widgets/AceGUIContainer-TreeGroup.lua | 4 +- .../widgets/AceGUIWidget-Button-ElvUI.lua | 18 ++-- .../widgets/AceGUIWidget-CheckBox.lua | 4 +- .../widgets/AceGUIWidget-DropDown-Items.lua | 4 +- .../AceGUI-3.0/widgets/AceGUIWidget-Icon.lua | 4 +- .../widgets/AceGUIWidget-InteractiveLabel.lua | 6 +- .../widgets/AceGUIWidget-Keybinding.lua | 90 +++++++------------ .../AceGUI-3.0/widgets/AceGUIWidget-Label.lua | 4 +- 11 files changed, 59 insertions(+), 82 deletions(-) diff --git a/ElvUI/Libraries/AceConsole-3.0/AceConsole-3.0.lua b/ElvUI/Libraries/AceConsole-3.0/AceConsole-3.0.lua index 3288bbf..377f528 100644 --- a/ElvUI/Libraries/AceConsole-3.0/AceConsole-3.0.lua +++ b/ElvUI/Libraries/AceConsole-3.0/AceConsole-3.0.lua @@ -114,7 +114,6 @@ function AceConsole:UnregisterChatCommand( command ) if name then SlashCmdList[name] = nil _G["SLASH_" .. name .. "1"] = nil - hash_SlashCmdList["/" .. upper(command)] = nil AceConsole.commands[command] = nil end end diff --git a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua index 8a24a3e..13c3a13 100644 --- a/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua +++ b/ElvUI_Config/Libraries/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua @@ -561,7 +561,7 @@ local function handle(info, inputpos, tab, depth, retfalse) --parse for =on =off =default in the process --table will be key = true for options that should toggle, key = [on|off|default] for options to be set local sels = {} - for v in strgfind(str, "[^ ]+") do + for v in strgmatch(str, "[^ ]+") do --parse option=on etc local _, _, opt, val = strfind(v, '(.+)=(.+)') --get option if toggling diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/AceGUI-3.0.lua b/ElvUI_Config/Libraries/AceGUI-3.0/AceGUI-3.0.lua index 041a67c..d2c0ffb 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/AceGUI-3.0.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/AceGUI-3.0.lua @@ -377,7 +377,7 @@ do end WidgetBase.SetPoint = function(self, ...) - return self.frame:SetPoint(unpack(arg)) + return self.frame:SetPoint(arg[1], arg[2], arg[3], arg[4], arg[5]) end WidgetBase.ClearAllPoints = function(self) @@ -389,7 +389,7 @@ do end WidgetBase.GetPoint = function(self, ...) - return self.frame:GetPoint(unpack(arg)) + return self.frame:GetPoint(arg[1]) end WidgetBase.GetUserDataTable = function(self) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua index cccfd1a..e4996b0 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua @@ -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 diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button-ElvUI.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button-ElvUI.lua index 918172a..a8e4705 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button-ElvUI.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button-ElvUI.lua @@ -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() diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua index fb0cee6..60712ab 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua @@ -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) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua index bff5765..632f126 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua @@ -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 diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua index 2828662..28d08ac 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua @@ -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) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua index bd46675..d5ccb17 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua @@ -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) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua index 78e9623..ff061d1 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua @@ -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 diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Label.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Label.lua index beab82c..657ae4d 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Label.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Label.lua @@ -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)