From 88ed97da4af7ea777ae77e2366bab6077c97da0e Mon Sep 17 00:00:00 2001 From: Crum <7307335+Crumdidlyumshis@users.noreply.github.com> Date: Sun, 18 Nov 2018 14:17:38 -0600 Subject: [PATCH 1/4] Update README.md --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index 0143c59..2d3f141 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) @@ -42,9 +38,6 @@ This UI will arrange your interface to be more flexible and practical. /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 +56,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 1304e00629e9acff74d7f7e1501e4826bdf9b80c Mon Sep 17 00:00:00 2001 From: Pinya <800pin.ru@gmail.com> Date: Thu, 22 Nov 2018 13:58:06 +0300 Subject: [PATCH 2/4] update? --- .../widgets/AceGUIWidget-EditBox.lua | 60 +++++++----------- .../widgets/AceGUIWidget-MultiLineEditBox.lua | 62 ++++++++----------- 2 files changed, 49 insertions(+), 73 deletions(-) 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..78c47c8 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @@ -38,36 +38,31 @@ 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) @@ -78,52 +73,45 @@ if not AceGUIEditBoxInsertLink then 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) @@ -135,7 +123,7 @@ if not AceGUIEditBoxInsertLink then 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..1ff4b1a 100644 --- a/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua +++ b/ElvUI_Config/Libraries/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua @@ -35,39 +35,34 @@ 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) + local name = sub(link,8) if name and name ~= "" then return _G.AceGUIMultiLineEditBoxInsertLink(name) end @@ -75,52 +70,45 @@ if not AceGUIMultiLineEditBoxInsertLink then 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) @@ -132,7 +120,7 @@ if not AceGUIMultiLineEditBoxInsertLink then end end end - end + end) end function _G.AceGUIMultiLineEditBoxInsertLink(text) From f0a249958528254d191cff73808187acc6446b40 Mon Sep 17 00:00:00 2001 From: Pinya <800pin.ru@gmail.com> Date: Thu, 22 Nov 2018 13:58:17 +0300 Subject: [PATCH 3/4] update ColorPicker --- ElvUI/Modules/Blizzard/ColorPicker.lua | 169 +++++++++++++++++++------ 1 file changed, 128 insertions(+), 41 deletions(-) diff --git a/ElvUI/Modules/Blizzard/ColorPicker.lua b/ElvUI/Modules/Blizzard/ColorPicker.lua index f339fad..7eabc71 100644 --- a/ElvUI/Modules/Blizzard/ColorPicker.lua +++ b/ElvUI/Modules/Blizzard/ColorPicker.lua @@ -1,27 +1,23 @@ --[[ 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 = tonumber 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,35 +25,105 @@ 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(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 + 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() @@ -69,21 +135,40 @@ 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) + + hooksecurefunc(ColorPickerFrame, "SetFrameLevel", function(self, level) + for _, child in ipairs({self:GetChildren()}) do + child:SetFrameLevel(level + 1) + + if child:GetFrameType() == "EditBox" then + for _, child in ipairs({child:GetChildren()}) do + child:SetFrameLevel(level + 1) + end + end end 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) - ColorSwatch:SetTexture(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() + ColorSwatch:SetTexture(arg1, arg2, arg3) if not editingText then - UpdateColorTexts(r, g, b) + UpdateColorTexts(arg1, arg2, arg3) + end + if this.allowUpdate then + this.func() + this.timeSinceUpdate = 0 end end) @@ -107,25 +192,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() @@ -227,8 +312,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, 17, 0, 0) + box:SetJustifyH("RIGHT") E:Height(box, 24) if i == 4 then @@ -241,7 +326,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") @@ -257,13 +342,15 @@ function B:EnhanceColorPicker() if i == 5 then 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("OnEnterPressed", function() this:ClearFocus() UpdateColorTexts() end) + box:SetScript("OnTextChanged", UpdateColor) 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 +370,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 f0a534c098c90128bdc56e0370db1988148f1943 Mon Sep 17 00:00:00 2001 From: Pinya <800pin.ru@gmail.com> Date: Thu, 22 Nov 2018 14:01:14 +0300 Subject: [PATCH 4/4] fix EditBox Get/SetCursorPosition workaround for Numeric and with character limits --- !Compatibility/api/wowAPI.lua | 38 +++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/!Compatibility/api/wowAPI.lua b/!Compatibility/api/wowAPI.lua index ffe6190..e4cdb02 100644 --- a/!Compatibility/api/wowAPI.lua +++ b/!Compatibility/api/wowAPI.lua @@ -430,6 +430,18 @@ function EditBoxGetCursorPosition(self) local otc = removeScript(self, "OnTextChanged") local ots = removeScript(self, "OnTextSet") + local charsChanged, numeric + + local maxChars = self:GetMaxLetters() + if maxChars == self:GetNumLetters() then + self:SetMaxLetters(maxChars + 1) + charsChanged = true + end + if self:IsNumeric() then + self:SetNumeric(false) + numeric = true + end + self:Insert(nbsp) local pos = find(self:GetText(), nbsp) @@ -441,6 +453,13 @@ function EditBoxGetCursorPosition(self) self:Insert("") end + if charsChanged then + self:SetMaxLetters(maxChars) + end + if numeric then + self:SetNumeric(true) + end + if occ then self:SetScript("OnCursorChanged", occ) end if otc then self:SetScript("OnTextChanged", otc) end if ots then self:SetScript("OnTextSet", ots) end @@ -467,12 +486,31 @@ function EditBoxSetCursorPosition(self, pos) end if pos == 0 then + local charsChanged, numeric + + local maxChars = self:GetMaxLetters() + if maxChars == self:GetNumLetters() then + self:SetMaxLetters(maxChars + 1) + charsChanged = true + end + if self:IsNumeric() then + self:SetNumeric(false) + numeric = true + end + text = sub(text, 0, 1) self:HighlightText(0, 1) self:Insert(nbsp) self:Insert(text) self:HighlightText(0, 1) self:Insert("") + + if charsChanged then + self:SetMaxLetters(maxChars) + end + if numeric then + self:SetNumeric(true) + end else text = sub(text, pos, pos) self:HighlightText(pos - 1, pos)