From 7db8cb887aceb1965410279d9aa7f8b8b7fcb262 Mon Sep 17 00:00:00 2001 From: Crum <7307335+Crumdidlyumshis@users.noreply.github.com> Date: Sun, 18 Nov 2018 14:19:19 -0600 Subject: [PATCH 1/6] Update README.md --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 0143c59..bff734d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,3 @@ -# NOTE: STILL UNDER DEVELOPMENT -### IF YOU WANT TO TEST AND HELP SUBMIT FEEDBACK OR PULL REQUESTS, PLEASE DO SO IN OUR "DEV" BRANCH: -https://github.com/ElvUI-Vanilla/ElvUI/commits/dev - # ElvUI - Vanilla (1.12.1) This is the backported version of ElvUI for World of Warcraft - Vanilla (1.12.1) @@ -41,10 +37,6 @@ This UI will arrange your interface to be more flexible and practical. /ec or /elvui Toggle the configuration GUI. /rl or /reloadui Reload the whole UI. /moveui Open the movable frames options. - /bgstats Toggles Battleground datatexts to display info when inside a battleground. - /hellokitty Enables the Hello Kitty theme (can be reverted by repeating the command). - /hellokittyfix Fixes any colors or borders to default after using /hellokitty. Optional Use. - /harlemshake Enables Harlem Shake april fools joke. (DO THE HARLEM SHAKE!) /egrid Toggles visibility of the grid for helping placement of thirdparty addons. /farmmode Toggles the Minimap Farmmode. /in The input of how many seconds you want a command to fire. @@ -63,8 +55,6 @@ This UI will arrange your interface to be more flexible and practical. /etrace Toggles events window. /luaerror on Enable luaerrors. /luaerror off Disable luaerrors. - /cpuimpact Toggles calculations of CPU Impact. Type /cpuimpact to get results when you are ready. - /cpuusage Calculates and dumps CPU usage differences (module: all, showall: false, minCalls: 15, delay: 5). /frame Command to grab frame information when mouseing over a frame or when inputting the name. usage: /frame (when mousing over frame) or /frame example: /frame WorldFrame From 7d622f3a3436f55a5b1eb1763c6529cc851c07a5 Mon Sep 17 00:00:00 2001 From: Crum Date: Mon, 19 Nov 2018 22:36:22 -0600 Subject: [PATCH 2/6] update --- ElvUI/Modules/Skins/Addons/Ace3.lua | 155 ++++++++++-------- .../widgets/AceGUIWidget-Button.lua | 2 +- .../widgets/AceGUIWidget-DropDown.lua | 2 +- .../widgets/AceGUIWidget-Keybinding.lua | 2 +- .../widgets/AceGUIWidget-Slider.lua | 2 + 5 files changed, 92 insertions(+), 71 deletions(-) diff --git a/ElvUI/Modules/Skins/Addons/Ace3.lua b/ElvUI/Modules/Skins/Addons/Ace3.lua index 51cef67..263566c 100644 --- a/ElvUI/Modules/Skins/Addons/Ace3.lua +++ b/ElvUI/Modules/Skins/Addons/Ace3.lua @@ -42,20 +42,48 @@ local function SkinButton(f, strip, noTemplate) end local function SkinDropdownPullout(self) - if self.obj.pullout.frame.template and self.obj.pullout.slider.template then return end + if self and self.obj then + local pullout = self.obj.pullout + local dropdown = self.obj.dropdown - if not self.obj.pullout.frame.template then - E:SetTemplate(self.obj.pullout.frame, "Default", true) - end + if pullout and pullout.frame then + if pullout.frame.template and pullout.slider.template then return end - if not self.obj.pullout.slider.template then - E:SetTemplate(self.obj.pullout.slider, "Default") - E:Point(self.obj.pullout.slider, "TOPRIGHT", self.obj.pullout.frame, "TOPRIGHT", -10, -10) - E:Point(self.obj.pullout.slider, "BOTTOMRIGHT", self.obj.pullout.frame, "BOTTOMRIGHT", -10, 10) - if self.obj.pullout.slider:GetThumbTexture() then - self.obj.pullout.slider:SetThumbTexture(E.media.normTex) - self.obj.pullout.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor)) - E:Size(self.obj.pullout.slider:GetThumbTexture(), 10, 14) + if not pullout.frame.template then + E:SetTemplate(pullout.frame, "Default", true) + end + + if not pullout.slider.template then + E:SetTemplate(pullout.slider, "Default") + E:Point(pullout.slider, "TOPRIGHT", pullout.frame, "TOPRIGHT", -10, -10) + E:Point(pullout.slider, "BOTTOMRIGHT", pullout.frame, "BOTTOMRIGHT", -10, 10) + if pullout.slider:GetThumbTexture() then + pullout.slider:SetThumbTexture(E.media.normTex) + pullout.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor)) + E:Size(pullout.slider:GetThumbTexture(), 10, 14) + end + end + elseif dropdown then + E:SetTemplate(dropdown, "Default", true) + + if dropdown.slider then + E:SetTemplate(dropdown.slider, "Default") + E:Point(dropdown.slider, "TOPRIGHT", dropdown, "TOPRIGHT", -10, -10) + E:Point(dropdown.slider, "BOTTOMRIGHT", dropdown, "BOTTOMRIGHT", -10, 10) + + if dropdown.slider:GetThumbTexture() then + dropdown.slider:SetThumbTexture(E.media.normTex) + dropdown.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor)) + E:Size(dropdown.slider:GetThumbTexture(), 10, 14) + end + end + + if TYPE == "LSM30_Sound" then + local frame = self.obj.frame + local width = frame:GetWidth() + E:Point(dropdown, "TOPLEFT", frame, "BOTTOMLEFT") + E:Point(dropdown, "TOPRIGHT", frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 30, 0) + end end end end @@ -81,6 +109,7 @@ function S:SkinAce3() SkinButton(widget.button) S:HandleScrollBar(widget.scrollBar) E:Point(widget.scrollBar, "RIGHT", frame, "RIGHT", 0 -4) + E:Point(scrollBG, "TOPRIGHT", widget.scrollBar, "TOPLEFT", -2, 19) E:Point(scrollBG, "BOTTOMLEFT", widget.button, "TOPLEFT") E:Point(widget.scrollFrame, "BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 8) @@ -117,7 +146,7 @@ function S:SkinAce3() E:CreateBackdrop(frame, "Default") end - E:Point(frame.backdrop, "TOPLEFT", 15, -2) + E:Point(frame.backdrop, "TOPLEFT", 17, -2) E:Point(frame.backdrop, "BOTTOMRIGHT", -21, 0) widget.label:ClearAllPoints() @@ -128,6 +157,9 @@ function S:SkinAce3() E:Point(button, "RIGHT", frame.backdrop, "RIGHT", -2, 0) button:SetParent(frame.backdrop) + text:ClearAllPoints() + E:Point(text, "RIGHT", frame.backdrop, "RIGHT", -26, 2) + E:Point(text, "LEFT", frame.backdrop, "LEFT", 2, 0) text:SetParent(frame.backdrop) HookScript(button, "OnClick", SkinDropdownPullout) @@ -176,30 +208,7 @@ function S:SkinAce3() button:SetParent(frame.backdrop) text:SetParent(frame.backdrop) - HookScript(button, "OnClick", function(self) - local dropdown = self.obj.dropdown - if dropdown then - E:SetTemplate(dropdown, "Default", true) - if dropdown.slider then - E:SetTemplate(dropdown.slider, "Transparent") - E:Point(dropdown.slider, "TOPRIGHT", dropdown, "TOPRIGHT", -10, -10) - E:Point(dropdown.slider, "BOTTOMRIGHT", dropdown, "BOTTOMRIGHT", -10, 10) - - if dropdown.slider:GetThumbTexture() then - dropdown.slider:SetThumbTexture(E.media.normTex) - dropdown.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor)) - E:Size(dropdown.slider:GetThumbTexture(), 10, 14) - end - end - - if TYPE == "LSM30_Sound" then - local frame = self.obj.frame - local width = frame:GetWidth() - E:Point(dropdown, "TOPLEFT", frame, "BOTTOMLEFT") - E:Point(dropdown, "TOPRIGHT", frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 30, 0) - end - end - end) + HookScript(button, "OnClick", SkinDropdownPullout) elseif TYPE == "EditBox" then local frame = widget.editbox local button = widget.button @@ -235,23 +244,6 @@ function S:SkinAce3() E:SetInside(frame.backdrop) widget.text:SetParent(frame.backdrop) - elseif TYPE == "Keybinding" then - local button = widget.button - local msgframe = widget.msgframe - local msg = widget.msgframe.msg - - SkinButton(button) - - E:StripTextures(msgframe) - E:CreateBackdrop(msgframe, "Default", true) - E:SetInside(msgframe.backdrop) - msgframe:SetToplevel(true) - - msg:ClearAllPoints() - E:Point(msg, "LEFT", 10, 0) - E:Point(msg, "RIGHT", -10, 0) - msg:SetJustifyV("MIDDLE") - E:Width(msg, msg:GetWidth() + 10) elseif TYPE == "Slider" then local frame = widget.slider local editbox = widget.editbox @@ -273,6 +265,23 @@ function S:SkinAce3() E:Point(lowtext, "TOPLEFT", frame, "BOTTOMLEFT", 2, -2) E:Point(hightext, "TOPRIGHT", frame, "BOTTOMRIGHT", -2, -2) + elseif TYPE == "Keybinding" then + local button = widget.button + local msgframe = widget.msgframe + local msg = widget.msgframe.msg + + SkinButton(button) + + E:StripTextures(msgframe) + E:CreateBackdrop(msgframe, "Default", true) + E:SetInside(msgframe.backdrop) + msgframe:SetToplevel(true) + + msg:ClearAllPoints() + E:Point(msg, "LEFT", 10, 0) + E:Point(msg, "RIGHT", -10, 0) + msg:SetJustifyV("MIDDLE") + E:Width(msg, msg:GetWidth() + 10) elseif (TYPE == "ColorPicker" or TYPE == "ColorPicker-ElvUI") then local frame = widget.frame local colorSwatch = widget.colorSwatch @@ -286,6 +295,8 @@ function S:SkinAce3() E:Point(frame.backdrop, "LEFT", frame, "LEFT", 4, 0) frame.backdrop:SetBackdropColor(0, 0, 0, 0) frame.backdrop.SetBackdropColor = E.noop + frame.backdrop:SetBackdropBorderColor(1, 1, 1) + frame.backdrop.SetBackdropBorderColor = E.noop colorSwatch:SetTexture(E.media.blankTex) colorSwatch:ClearAllPoints() @@ -370,20 +381,28 @@ function S:SkinAce3() end end - if TYPE == "TabGroup" then - local oldCreateTab = widget.CreateTab - widget.CreateTab = function(self, id) - local tab = oldCreateTab(self, id) - E:StripTextures(tab) - --[[tab.backdrop = CreateFrame("Frame", nil, tab) - E:SetTemplate(tab.backdrop, "Transparent") - tab.backdrop:SetFrameLevel(tab:GetFrameLevel() - 1) - E:Point(tab.backdrop, "TOPLEFT", 10, -3) - E:Point(tab.backdrop, "BOTTOMRIGHT", -10, 0)--]] + if TYPE == "TabGroup" then + local oldCreateTab = widget.CreateTab + widget.CreateTab = function(self, id) + local tab = oldCreateTab(self, id) + E:StripTextures(tab) + tab.backdrop = CreateFrame("Frame", nil, tab) + E:SetTemplate(tab.backdrop, "Transparent") + E:Point(tab.backdrop, "TOPLEFT", 10, -3) + E:Point(tab.backdrop, "BOTTOMRIGHT", -10, 0) - return tab - end - end + HookScript(tab, "OnShow", function(self) + local tabFrame = tab:GetFrameLevel() + local tabBackdrop = tab.backdrop:GetFrameLevel() + + if tabFrame <= tabBackdrop then + tab.backdrop:SetFrameLevel(tabFrame - 1) + end + end) + + return tab + end + end if widget.scrollbar then S:HandleScrollBar(widget.scrollbar) @@ -410,4 +429,4 @@ local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", attemptSkin) -S:AddCallback("Ace3", attemptSkin) \ No newline at end of file +S:AddCallback("Ace3", attemptSkin) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button.lua index 8d1eca9..97d379e 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Button.lua @@ -74,7 +74,7 @@ Constructor -------------------------------------------------------------------------------]] local function Constructor() local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) - local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2") + local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate") frame:Hide() frame:EnableMouse(true) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua index 098068b..912d6b8 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua @@ -722,7 +722,7 @@ do self.text = text text.obj = self text:ClearAllPoints() - text:SetPoint("RIGHT", right, "RIGHT" ,-46, 2) + text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2) text:SetPoint("LEFT", left, "LEFT", 25, 2) local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") 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 ff061d1..72f4536 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua @@ -192,7 +192,7 @@ local function Constructor() local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type) local frame = CreateFrame("Frame", nil, UIParent) - local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2") + local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate") button:EnableMouse(true) button:EnableMouseWheel(false) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua index 52a5ed4..3e1d3a7 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua @@ -139,6 +139,7 @@ local methods = { self.disabled = disabled if disabled then self.slider:EnableMouse(false) + self.slider:GetThumbTexture():SetDesaturated(true) -- ElvUI self.label:SetTextColor(.5, .5, .5) self.hightext:SetTextColor(.5, .5, .5) self.lowtext:SetTextColor(.5, .5, .5) @@ -148,6 +149,7 @@ local methods = { self.editbox:ClearFocus() else self.slider:EnableMouse(true) + self.slider:GetThumbTexture():SetDesaturated(false) -- ElvUI self.label:SetTextColor(1, .82, 0) self.hightext:SetTextColor(1, 1, 1) self.lowtext:SetTextColor(1, 1, 1) From e60d190f6adec1ba250cc8dd8a3c4a3c68b092f9 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 21 Nov 2018 02:55:26 -0600 Subject: [PATCH 3/6] cleanup --- ElvUI/Developer/ReloadUI.lua | 4 ++-- ElvUI/Developer/Table.lua | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ElvUI/Developer/ReloadUI.lua b/ElvUI/Developer/ReloadUI.lua index 2b41cdc..c104557 100644 --- a/ElvUI/Developer/ReloadUI.lua +++ b/ElvUI/Developer/ReloadUI.lua @@ -3,6 +3,6 @@ ]] SLASH_RELOADUI1 = "/rl" -SLASH_RELOADUI2 = "/reload" -SLASH_RELOADUI3 = "/reloadui" +SLASH_RELOADUI2 = "/reloadui" +SLASH_RELOADUI3 = "/reload" SlashCmdList.RELOADUI = ReloadUI \ No newline at end of file diff --git a/ElvUI/Developer/Table.lua b/ElvUI/Developer/Table.lua index 6400d86..a8dcaca 100644 --- a/ElvUI/Developer/Table.lua +++ b/ElvUI/Developer/Table.lua @@ -1,5 +1,3 @@ ---Cache global variables ---Lua functions local setmetatable, getmetatable = setmetatable, getmetatable local pairs, type = pairs, type local table = table From 8a909794ce07283a9df4a0c660bdbb56fa23ad17 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 21 Nov 2018 02:57:10 -0600 Subject: [PATCH 4/6] update --- ElvUI/Modules/Bags/Bags.lua | 59 ---------------- .../widgets/AceGUIWidget-EditBox.lua | 68 ++++++++----------- .../widgets/AceGUIWidget-MultiLineEditBox.lua | 68 ++++++++----------- 3 files changed, 56 insertions(+), 139 deletions(-) diff --git a/ElvUI/Modules/Bags/Bags.lua b/ElvUI/Modules/Bags/Bags.lua index 4dd8ada..eed321d 100644 --- a/ElvUI/Modules/Bags/Bags.lua +++ b/ElvUI/Modules/Bags/Bags.lua @@ -413,61 +413,6 @@ function B:ResetSlotAlphaForBags(f) end end -local function buttonOnClick(button, ignoreModifiers) - if not button then button = arg1 end - - --KeyRing special case code - if this:GetParent():GetID() == KEYRING_CONTAINER then - KeyRingItemButton_OnClick(button, ignoreModifiers) - return - end - - if button == "LeftButton" then - if IsControlKeyDown() and not ignoreModifiers then - DressUpItemLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) - elseif IsShiftKeyDown() and not ignoreModifiers then - if ChatFrameEditBox:IsShown() then - ChatFrameEditBox:Insert(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) - else - local texture, itemCount, locked = GetContainerItemInfo(this:GetParent():GetID(), this:GetID()) - if not locked then - this.SplitStack = function(button, split) - SplitContainerItem(button:GetParent():GetID(), button:GetID(), split) - end - OpenStackSplitFrame(this.count, this, "BOTTOMRIGHT", "TOPRIGHT") - end - end - else - PickupContainerItem(this:GetParent():GetID(), this:GetID()) - StackSplitFrame:Hide() - end - else - if IsControlKeyDown() and not ignoreModifiers then - return - elseif IsShiftKeyDown() and MerchantFrame:IsShown() and not ignoreModifiers then - this.SplitStack = function(button, split) - SplitContainerItem(button:GetParent():GetID(), button:GetID(), split) - MerchantItemButton_OnClick("LeftButton") - end - OpenStackSplitFrame(this.count, this, "BOTTOMRIGHT", "TOPRIGHT") - elseif MerchantFrame:IsShown() and MerchantFrame.selectedTab == 2 then - -- Don't sell the item if the buyback tab is selected - return - else - UseContainerItem(this:GetParent():GetID(), this:GetID()) - StackSplitFrame:Hide() - end - end -end - -local function buttonOnDragStart() - buttonOnClick("LeftButton", 1) -end - -local function buttonOnReceiveDrag() - buttonOnClick("LeftButton", 1) -end - function B:Layout(isBank) if E.private.bags.enable ~= true then return end local f = self:GetContainerFrame(isBank) @@ -585,10 +530,6 @@ function B:Layout(isBank) f.Bags[bagID][slotID]:SetNormalTexture("") f.Bags[bagID][slotID]:SetCheckedTexture("") - f.Bags[bagID][slotID]:SetScript("OnClick", buttonOnClick) - f.Bags[bagID][slotID]:SetScript("OnDragStart", buttonOnDragStart) - f.Bags[bagID][slotID]:SetScript("OnReceiveDrag", buttonOnReceiveDrag) - f.Bags[bagID][slotID].Count = _G[f.Bags[bagID][slotID]:GetName().."Count"] f.Bags[bagID][slotID].Count:ClearAllPoints() E:Point(f.Bags[bagID][slotID].Count, "BOTTOMRIGHT", 0, 2) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua index e2acd12..d94dc74 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -38,104 +38,92 @@ Support functions -------------------------------------------------------------------------------]] if not AceGUIEditBoxInsertLink then -- upgradeable hook - local orig_BankFrameItemButtonGeneric_OnClick = BankFrameItemButtonGeneric_OnClick - function BankFrameItemButtonGeneric_OnClick(button) + hooksecurefunc("BankFrameItemButtonGeneric_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID())) end - end + end) - local orig_ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick - function ContainerFrameItemButton_OnClick(button, ignoreModifiers) + hooksecurefunc("ContainerFrameItemButton_OnClick", function(button, ignoreModifiers) if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) end - end + end) - local orig_KeyRingItemButton_OnClick = KeyRingItemButton_OnClick - function KeyRingItemButton_OnClick(button) + hooksecurefunc("KeyRingItemButton_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then return _G.AceGUIEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID())) end - end + end) - local orig_LootFrameItem_OnClick = LootFrameItem_OnClick - function LootFrameItem_OnClick(button) + hooksecurefunc("LootFrameItem_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() then return _G.AceGUIEditBoxInsertLink(GetLootSlotLink(this.slot)) end - end + end) - local orig_SetItemRef = SetItemRef - function SetItemRef(link, text, button) + hooksecurefunc("SetItemRef", function(link, text, button) if IsShiftKeyDown() then - if sub(link, 1, 6) == "player" then - local name = sub(link, 8) - if name and name ~= "" then + if strsub(link,1,6) == "player" then + local name = strsub(link,8) + if name and (strlen(name) > 0) then return _G.AceGUIEditBoxInsertLink(name) end else return _G.AceGUIEditBoxInsertLink(text) end end - end + end) - local orig_MerchantItemButton_OnClick = MerchantItemButton_OnClick - function MerchantItemButton_OnClick(button, ignoreModifiers) + hooksecurefunc("MerchantItemButton_OnClick", function(button, ignoreModifiers) if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIEditBoxInsertLink(GetMerchantItemLink(this:GetID())) end - end + end) - local orig_PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick - function PaperDollItemSlotButton_OnClick(button, ignoreModifiers) + hooksecurefunc("PaperDollItemSlotButton_OnClick", function(button, ignoreModifiers) if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIEditBoxInsertLink(GetInventoryItemLink("player", this:GetID())) end - end + end) - local orig_QuestItem_OnClick = QuestItem_OnClick - function QuestItem_OnClick() + hooksecurefunc("QuestItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) end - end + end) - local orig_QuestRewardItem_OnClick = QuestRewardItem_OnClick - function QuestRewardItem_OnClick() + hooksecurefunc("QuestRewardItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) end - end + end) - local orig_QuestLogTitleButton_OnClick = QuestLogTitleButton_OnClick - function QuestLogTitleButton_OnClick(button) + hooksecurefunc("QuestLogTitleButton_OnClick", function(button) if IsShiftKeyDown() and (not this.isHeader) then return _G.AceGUIEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1")) end - end + end) - local orig_QuestLogRewardItem_OnClick = QuestLogRewardItem_OnClick - function QuestLogRewardItem_OnClick() + hooksecurefunc("QuestLogRewardItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID())) end - end + end) - local orig_SpellButton_OnClick = SpellButton_OnClick - function SpellButton_OnClick(drag) + hooksecurefunc("SpellButton_OnClick", function(drag) local id = SpellBook_GetSpellID(this:GetID()) if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType) if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then - if subSpellName and subSpellName ~= "" then + if subSpellName and (strlen(subSpellName) > 0) then _G.AceGUIEditBoxInsertLink(spellName.."("..subSpellName..")") else _G.AceGUIEditBoxInsertLink(spellName) end end end - end + end) end function _G.AceGUIEditBoxInsertLink(text) diff --git a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua index a6dc095..aa18e17 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua @@ -35,104 +35,92 @@ Support functions if not AceGUIMultiLineEditBoxInsertLink then -- upgradeable hook - local orig_BankFrameItemButtonGeneric_OnClick = BankFrameItemButtonGeneric_OnClick - function BankFrameItemButtonGeneric_OnClick(button) + hooksecurefunc("BankFrameItemButtonGeneric_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(BANK_CONTAINER, this:GetID())) end - end + end) - local orig_ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick - function ContainerFrameItemButton_OnClick(button, ignoreModifiers) + hooksecurefunc("ContainerFrameItemButton_OnClick", function(button, ignoreModifiers) if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(this:GetParent():GetID(), this:GetID())) end - end + end) - local orig_KeyRingItemButton_OnClick = KeyRingItemButton_OnClick - function KeyRingItemButton_OnClick(button) + hooksecurefunc("KeyRingItemButton_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() and not this.isBag then return _G.AceGUIMultiLineEditBoxInsertLink(GetContainerItemLink(KEYRING_CONTAINER, this:GetID())) end - end + end) - local orig_LootFrameItem_OnClick = LootFrameItem_OnClick - function LootFrameItem_OnClick(button) + hooksecurefunc("LootFrameItem_OnClick", function(button) if button == "LeftButton" and IsShiftKeyDown() then return _G.AceGUIMultiLineEditBoxInsertLink(GetLootSlotLink(this.slot)) end - end + end) - local orig_SetItemRef = SetItemRef - function SetItemRef(link, text, button) + hooksecurefunc("SetItemRef", function(link, text, button) if IsShiftKeyDown() then - if sub(link, 1, 6) == "player" then - local name = sub(link, 8) - if name and name ~= "" then + if strsub(link,1,6) == "player" then + local name = strsub(link,8) + if name and (strlen(name) > 0) then return _G.AceGUIMultiLineEditBoxInsertLink(name) end else return _G.AceGUIMultiLineEditBoxInsertLink(text) end end - end + end) - local orig_MerchantItemButton_OnClick = MerchantItemButton_OnClick - function MerchantItemButton_OnClick(button, ignoreModifiers) + hooksecurefunc("MerchantItemButton_OnClick", function(button, ignoreModifiers) if MerchantFrame.selectedTab == 1 and button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIMultiLineEditBoxInsertLink(GetMerchantItemLink(this:GetID())) end - end + end) - local orig_PaperDollItemSlotButton_OnClick = PaperDollItemSlotButton_OnClick - function PaperDollItemSlotButton_OnClick(button, ignoreModifiers) + hooksecurefunc("PaperDollItemSlotButton_OnClick", function(button, ignoreModifiers) if button == "LeftButton" and IsShiftKeyDown() and not ignoreModifiers then return _G.AceGUIMultiLineEditBoxInsertLink(GetInventoryItemLink("player", this:GetID())) end - end + end) - local orig_QuestItem_OnClick = QuestItem_OnClick - function QuestItem_OnClick() + hooksecurefunc("QuestItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) end - end + end) - local orig_QuestRewardItem_OnClick = QuestRewardItem_OnClick - function QuestRewardItem_OnClick() + hooksecurefunc("QuestRewardItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestItemLink(this.type, this:GetID())) end - end + end) - local orig_QuestLogTitleButton_OnClick = QuestLogTitleButton_OnClick - function QuestLogTitleButton_OnClick(button) + hooksecurefunc("QuestLogTitleButton_OnClick", function(button) if IsShiftKeyDown() and (not this.isHeader) then return _G.AceGUIMultiLineEditBoxInsertLink(gsub(this:GetText(), " *(.*)", "%1")) end - end + end) - local orig_QuestLogRewardItem_OnClick = QuestLogRewardItem_OnClick - function QuestLogRewardItem_OnClick() + hooksecurefunc("QuestLogRewardItem_OnClick", function() if IsShiftKeyDown() and this.rewardType ~= "spell" then return _G.AceGUIMultiLineEditBoxInsertLink(GetQuestLogItemLink(this.type, this:GetID())) end - end + end) - local orig_SpellButton_OnClick = SpellButton_OnClick - function SpellButton_OnClick(drag) + hooksecurefunc("SpellButton_OnClick", function(drag) local id = SpellBook_GetSpellID(this:GetID()) if id <= MAX_SPELLS and (not drag) and IsShiftKeyDown() then local spellName, subSpellName = GetSpellName(id, SpellBookFrame.bookType) if spellName and not IsSpellPassive(id, SpellBookFrame.bookType) then - if subSpellName and subSpellName ~= "" then + if subSpellName and (strlen(subSpellName) > 0) then _G.AceGUIMultiLineEditBoxInsertLink(spellName.."("..subSpellName..")") else _G.AceGUIMultiLineEditBoxInsertLink(spellName) end end end - end + end) end function _G.AceGUIMultiLineEditBoxInsertLink(text) From 3325d379d072826d9cf73f27117ef3fc7eb141b9 Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 21 Nov 2018 03:16:14 -0600 Subject: [PATCH 5/6] update ColorPicker --- ElvUI/Modules/Blizzard/ColorPicker.lua | 171 ++++++++++++++++++------- 1 file changed, 125 insertions(+), 46 deletions(-) diff --git a/ElvUI/Modules/Blizzard/ColorPicker.lua b/ElvUI/Modules/Blizzard/ColorPicker.lua index f339fad..d27c2e1 100644 --- a/ElvUI/Modules/Blizzard/ColorPicker.lua +++ b/ElvUI/Modules/Blizzard/ColorPicker.lua @@ -1,27 +1,22 @@ --[[ Credit to Jaslm, most of this code is his from the addon ColorPickerPlus ]] -local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB -local B = E:GetModule("Blizzard"); -local S = E:GetModule("Skins"); +local E, L, DF = unpack(ElvUI) +local B = E:GetModule("Blizzard") +local S = E:GetModule("Skins") ---Cache global variables ---Lua functions -local collectgarbage = collectgarbage +local tonumber, collectgarbage = tonumber, collectgarbage local floor = math.floor -local format = string.format ---WoW API / Variables +local format, strsub = string.format, strsub +local getn = table.getn + local CreateFrame = CreateFrame local RAID_CLASS_COLORS = RAID_CLASS_COLORS -local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS local CLASS, DEFAULTS = CLASS, DEFAULTS local colorBuffer = {} local editingText -local RAID_CLASS_COLORS = RAID_CLASS_COLORS -local CUSTOM_CLASS_COLORS = CUSTOM_CLASS_COLORS - local function UpdateAlphaText() local a = OpacitySliderFrame:GetValue() a = (1 - a) * 100 @@ -29,39 +24,109 @@ local function UpdateAlphaText() ColorPPBoxA:SetText(format("%d", a)) end +local function UpdateAlpha() + local a = this:GetNumber() + if a > 100 then + a = 100 + ColorPPBoxA:SetText(format("%d", a)) + end + a = 1 - (a / 100) + editingText = true + OpacitySliderFrame:SetValue(a) + editingText = nil +end + local function UpdateColorTexts(r, g, b) if not r then r, g, b = ColorPickerFrame:GetColorRGB() end - r = r*255 - g = g*255 - b = b*255 + r = r * 255 + g = g * 255 + b = b * 255 ColorPPBoxR:SetText(format("%d", r)) ColorPPBoxG:SetText(format("%d", g)) ColorPPBoxB:SetText(format("%d", b)) ColorPPBoxH:SetText(format("%.2x%.2x%.2x", r, g, b)) end +local function UpdateColor() + local r, g, b = ColorPickerFrame:GetColorRGB() + local id = this:GetID() + + if id == 1 then + r = format("%d", this:GetNumber()) + if not r then r = 0 end + r = r / 255 + elseif id == 2 then + g = format("%d", this:GetNumber()) + if not g then g = 0 end + g = g / 255 + elseif id == 3 then + b = format("%d", this:GetNumber()) + if not b then b = 0 end + b = b / 255 + elseif id == 4 then + -- hex values + if this:GetNumLetters() == 6 then + local rgb = this:GetText() + r, g, b = tonumber("0x"..strsub(rgb, 0, 2)), tonumber("0x"..strsub(rgb, 3, 4)), tonumber("0x"..strsub(rgb, 5, 6)) + if not r then r = 0 else r = r / 255 end + if not g then g = 0 else g = g / 255 end + if not b then b = 0 else b = b / 255 end + else + return + end + end + + -- This takes care of updating the hex entry when changing rgb fields and vice versa + UpdateColorTexts(r, g, b) + + editingText = true + ColorPickerFrame:SetColorRGB(r, g, b) + ColorSwatch:SetTexture(r, g, b) + editingText = nil +end + +local function HandleUpdateLimiter() + this.timeSinceUpdate = (this.timeSinceUpdate or 0) + arg1 + if this.timeSinceUpdate > 0.15 then + this.allowUpdate = true + else + this.allowUpdate = false + end +end + function B:EnhanceColorPicker() if IsAddOnLoaded("ColorPickerPlus") then return end - ColorPickerFrame:SetClampedToScreen(true) --Skin the default frame, move default buttons into place + ColorPickerFrame:SetClampedToScreen(true) E:SetTemplate(ColorPickerFrame, "Transparent") + ColorPickerFrameHeader:SetTexture("") ColorPickerFrameHeader:ClearAllPoints() ColorPickerFrameHeader:SetPoint("TOP", ColorPickerFrame, 0, 0) - S:HandleButton(ColorPickerOkayButton) + S:HandleButton(ColorPickerCancelButton) ColorPickerCancelButton:ClearAllPoints() + E:Point(ColorPickerCancelButton, "BOTTOMRIGHT", ColorPickerFrame, "BOTTOMRIGHT", -6, 6) + E:Point(ColorPickerCancelButton, "BOTTOMLEFT", ColorPickerFrame, "BOTTOM", 0, 6) + + S:HandleButton(ColorPickerOkayButton) ColorPickerOkayButton:ClearAllPoints() - ColorPickerCancelButton:SetPoint("BOTTOMRIGHT", ColorPickerFrame, "BOTTOMRIGHT", -6, 6) - ColorPickerCancelButton:SetPoint("BOTTOMLEFT", ColorPickerFrame, "BOTTOM", 0, 6) - ColorPickerOkayButton:SetPoint("BOTTOMLEFT", ColorPickerFrame,"BOTTOMLEFT", 6,6) - ColorPickerOkayButton:SetPoint("RIGHT", ColorPickerCancelButton,"LEFT", -4,0) + E:Point(ColorPickerOkayButton, "BOTTOMLEFT", ColorPickerFrame,"BOTTOMLEFT", 6, 6) + E:Point(ColorPickerOkayButton, "RIGHT", ColorPickerCancelButton,"LEFT", -4, 0) + S:HandleSliderFrame(OpacitySliderFrame) + + if OpacitySliderFrame:GetThumbTexture() then + OpacitySliderFrame:SetThumbTexture(E.media.normTex) + OpacitySliderFrame:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor)) + E:Size(OpacitySliderFrame:GetThumbTexture(), 10) + end + HookScript(ColorPickerFrame, "OnShow", function() -- get color that will be replaced local r, g, b = ColorPickerFrame:GetColorRGB() - ColorPPOldColorSwatch:SetTexture(r, g, b) + ColorPPOldColorSwatch:SetTexture(r,g,b) -- show/hide the alpha box if ColorPickerFrame.hasOpacity then @@ -69,22 +134,30 @@ function B:EnhanceColorPicker() ColorPPBoxLabelA:Show() ColorPPBoxH:SetScript("OnTabPressed", function() ColorPPBoxA:SetFocus() end) UpdateAlphaText() - E:Width(this, 405) + this:SetWidth(405) else ColorPPBoxA:Hide() ColorPPBoxLabelA:Hide() ColorPPBoxH:SetScript("OnTabPressed", function() ColorPPBoxR:SetFocus() end) - E:Width(this, 345) + this:SetWidth(345) end + + --Set OnUpdate script to handle update limiter + this:SetScript("OnUpdate", HandleUpdateLimiter) end) - --Memory Fix, Colorpicker will call the self.func() 100x per second, causing fps/memory issues, - --this little script will make you have to press ok for you to notice any changes. - ColorPickerFrame:SetScript("OnColorSelect", function(_, r, g, b) + --Memory Fix, Colorpicker will call the this.func() 100x per second, causing fps/memory issues, + --We overwrite the OnColorSelect script and set a limit on how often we allow a call to this.func + ColorPickerFrame:SetScript("OnColorSelect", function() + local r, g, b = arg1, arg2, arg3 ColorSwatch:SetTexture(r, g, b) if not editingText then UpdateColorTexts(r, g, b) end + if this.allowUpdate then + this.func() + this.timeSinceUpdate = 0 + end end) HookScript(ColorPickerOkayButton, "OnClick", function() @@ -107,25 +180,25 @@ function B:EnhanceColorPicker() -- add Color Swatch for original color local t = ColorPickerFrame:CreateTexture("ColorPPOldColorSwatch") local w, h = ColorSwatch:GetWidth(), ColorSwatch:GetHeight() - E:Width(t, w*0.75) - E:Height(t, h*0.75) - t:SetTexture(0,0,0) + E:Size(t, w * 0.75, h * 0.75) + t:SetTexture(0, 0, 0) -- OldColorSwatch to appear beneath ColorSwatch t:SetDrawLayer("BORDER") - E:Point(t, "BOTTOMLEFT", "ColorSwatch", "TOPRIGHT", -(w/2), -(h/3)) + E:Point(t, "BOTTOMLEFT", "ColorSwatch", "TOPRIGHT", -(w / 2), -(h / 3)) -- add Color Swatch for the copied color t = ColorPickerFrame:CreateTexture("ColorPPCopyColorSwatch") E:Size(t, w, h) - t:SetTexture(0,0,0) + t:SetTexture(0, 0, 0) t:Hide() -- add copy button to the ColorPickerFrame local b = CreateFrame("Button", "ColorPPCopy", ColorPickerFrame, "UIPanelButtonTemplate") S:HandleButton(b) b:SetText(L["Copy"]) - E:Size(b, 60, 22) - E:Point(b, "TOPLEFT", "ColorSwatch", "BOTTOMLEFT", 0, -5) + b:SetWidth(60) + b:SetHeight(22) + b:SetPoint("TOPLEFT", "ColorSwatch", "BOTTOMLEFT", 0, -5) -- copy color into buffer on button click b:SetScript("OnClick", function() @@ -148,7 +221,8 @@ function B:EnhanceColorPicker() b = CreateFrame("Button", "ColorPPClass", ColorPickerFrame, "UIPanelButtonTemplate") b:SetText(CLASS) S:HandleButton(b) - E:Size(b, 80, 22) + E:Width(b, 80) + E:Height(b, 22) E:Point(b, "TOP", "ColorPPCopy", "BOTTOMRIGHT", 0, -7) b:SetScript("OnClick", function() @@ -164,7 +238,8 @@ function B:EnhanceColorPicker() b = CreateFrame("Button", "ColorPPPaste", ColorPickerFrame, "UIPanelButtonTemplate") b:SetText(L["Paste"]) S:HandleButton(b) - E:Size(b, 60, 22) + E:Width(b, 60) + E:Height(b, 22) E:Point(b, "TOPLEFT", "ColorPPCopy", "TOPRIGHT", 2, 0) b:Disable() -- enable when something has been copied @@ -183,13 +258,15 @@ function B:EnhanceColorPicker() b = CreateFrame("Button", "ColorPPDefault", ColorPickerFrame, "UIPanelButtonTemplate") b:SetText(DEFAULTS) S:HandleButton(b) - E:Size(b, 80, 22) + E:Width(b, 80) + E:Height(b, 22) E:Point(b, "TOPLEFT", "ColorPPClass", "BOTTOMLEFT", 0, -7) b:Disable() -- enable when something has been copied b:SetScript("OnHide", function() this.colors = nil end) b:SetScript("OnShow", function() + print(this.colors) if this.colors then this:Enable() else @@ -227,8 +304,8 @@ function B:EnhanceColorPicker() box:SetID(i) box:SetFrameStrata("DIALOG") box:SetAutoFocus(false) - box:SetTextInsets(0,14,0,0) - box:SetJustifyH("CENTER") + box:SetTextInsets(0, 14, 0, 0) + box:SetJustifyH("RIGHT") E:Height(box, 24) if i == 4 then @@ -241,7 +318,7 @@ function B:EnhanceColorPicker() E:Width(box, 40) box:SetNumeric(true) end - E:Point(box, "TOP", "ColorPickerWheel", "BOTTOM", 0, -15) + box:SetPoint("TOP", "ColorPickerWheel", "BOTTOM", 0, -15) -- label local label = box:CreateFontString("ColorPPBoxLabel"..rgb, "ARTWORK", "GameFontNormalSmall") @@ -255,15 +332,17 @@ function B:EnhanceColorPicker() -- set up scripts to handle event appropriately if i == 5 then - box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateAlphaText() end) + box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateAlphaText() end) box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateAlphaText() end) + box:SetScript("OnTextChanged", UpdateAlpha) else - box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateColorTexts() end) + box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateColorTexts() end) box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateColorTexts() end) + -- box:SetScript("OnTextChanged", UpdateColor) -- TODO end - box:SetScript("OnEditFocusGained", function() this:HighlightText() end) - box:SetScript("OnEditFocusLost", function() this:HighlightText(0,0) end) + box:SetScript("OnEditFocusGained", function() EditBoxSetCursorPosition(this, 0) this:HighlightText() end) + box:SetScript("OnEditFocusLost", function() this:HighlightText(0, 0) end) box:SetScript("OnTextSet", function() this:ClearFocus() end) box:Show() end @@ -283,8 +362,8 @@ function B:EnhanceColorPicker() -- make the color picker movable. local mover = CreateFrame("Frame", nil, ColorPickerFrame) - E:Point(mover, "TOPLEFT", ColorPickerFrame, "TOP", -60, 0) - E:Point(mover, "BOTTOMRIGHT", ColorPickerFrame, "TOP", 60, -15) + mover:SetPoint("TOPLEFT", ColorPickerFrame, "TOP", -60, 0) + mover:SetPoint("BOTTOMRIGHT", ColorPickerFrame, "TOP", 60, -15) mover:EnableMouse(true) mover:SetScript("OnMouseDown", function() ColorPickerFrame:StartMoving() end) mover:SetScript("OnMouseUp", function() ColorPickerFrame:StopMovingOrSizing() end) From a304f36f79d8a45037f159a41b1abdd4ca51d2fe Mon Sep 17 00:00:00 2001 From: Crum Date: Wed, 21 Nov 2018 19:49:59 -0600 Subject: [PATCH 6/6] update wowAPI, ColorPicker --- !Compatibility/api/wowAPI.lua | 3 --- ElvUI/Modules/Blizzard/ColorPicker.lua | 27 +++++++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index ffe6190..052d438 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -469,10 +469,7 @@ function EditBoxSetCursorPosition(self, pos) if pos == 0 then text = sub(text, 0, 1) self:HighlightText(0, 1) - self:Insert(nbsp) self:Insert(text) - self:HighlightText(0, 1) - self:Insert("") else text = sub(text, pos, pos) self:HighlightText(pos - 1, pos) diff --git a/ElvUI/Modules/Blizzard/ColorPicker.lua b/ElvUI/Modules/Blizzard/ColorPicker.lua index d27c2e1..45c8561 100644 --- a/ElvUI/Modules/Blizzard/ColorPicker.lua +++ b/ElvUI/Modules/Blizzard/ColorPicker.lua @@ -5,7 +5,8 @@ local E, L, DF = unpack(ElvUI) local B = E:GetModule("Blizzard") local S = E:GetModule("Skins") -local tonumber, collectgarbage = tonumber, collectgarbage +local collectgarbage = collectgarbage +local tonumber = tonumber local floor = math.floor local format, strsub = string.format, strsub local getn = table.getn @@ -67,7 +68,7 @@ local function UpdateColor() -- hex values if this:GetNumLetters() == 6 then local rgb = this:GetText() - r, g, b = tonumber("0x"..strsub(rgb, 0, 2)), tonumber("0x"..strsub(rgb, 3, 4)), tonumber("0x"..strsub(rgb, 5, 6)) + r, g, b = tonumber(strsub(rgb, 0, 2), 16), tonumber(strsub(rgb, 3, 4), 16), tonumber(strsub(rgb, 5, 6), 16) if not r then r = 0 else r = r / 255 end if not g then g = 0 else g = g / 255 end if not b then b = 0 else b = b / 255 end @@ -126,7 +127,7 @@ function B:EnhanceColorPicker() HookScript(ColorPickerFrame, "OnShow", function() -- get color that will be replaced local r, g, b = ColorPickerFrame:GetColorRGB() - ColorPPOldColorSwatch:SetTexture(r,g,b) + ColorPPOldColorSwatch:SetTexture(r, g, b) -- show/hide the alpha box if ColorPickerFrame.hasOpacity then @@ -146,13 +147,18 @@ function B:EnhanceColorPicker() this:SetScript("OnUpdate", HandleUpdateLimiter) end) + hooksecurefunc(ColorPickerFrame, "SetFrameLevel", function(self, level) + for _, child in ipairs({self:GetChildren()}) do + child:SetFrameLevel(level + 1) + end + end) + --Memory Fix, Colorpicker will call the this.func() 100x per second, causing fps/memory issues, --We overwrite the OnColorSelect script and set a limit on how often we allow a call to this.func ColorPickerFrame:SetScript("OnColorSelect", function() - local r, g, b = arg1, arg2, arg3 - ColorSwatch:SetTexture(r, g, b) + ColorSwatch:SetTexture(arg1, arg2, arg3) if not editingText then - UpdateColorTexts(r, g, b) + UpdateColorTexts(arg1, arg2, arg3) end if this.allowUpdate then this.func() @@ -266,7 +272,6 @@ function B:EnhanceColorPicker() this.colors = nil end) b:SetScript("OnShow", function() - print(this.colors) if this.colors then this:Enable() else @@ -304,7 +309,7 @@ function B:EnhanceColorPicker() box:SetID(i) box:SetFrameStrata("DIALOG") box:SetAutoFocus(false) - box:SetTextInsets(0, 14, 0, 0) + box:SetTextInsets(0, 17, 0, 0) box:SetJustifyH("RIGHT") E:Height(box, 24) @@ -332,13 +337,13 @@ function B:EnhanceColorPicker() -- set up scripts to handle event appropriately if i == 5 then - box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateAlphaText() end) + box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateAlphaText() end) box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateAlphaText() end) box:SetScript("OnTextChanged", UpdateAlpha) else - box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateColorTexts() end) + box:SetScript("OnEscapePressed", function() this:ClearFocus() UpdateColorTexts() end) box:SetScript("OnEnterPressed", function() this:ClearFocus() UpdateColorTexts() end) - -- box:SetScript("OnTextChanged", UpdateColor) -- TODO + box:SetScript("OnTextChanged", UpdateColor) end box:SetScript("OnEditFocusGained", function() EditBoxSetCursorPosition(this, 0) this:HighlightText() end)