diff --git a/ElvUIDev/.gitattributes b/ElvUI_CPU/.gitattributes similarity index 100% rename from ElvUIDev/.gitattributes rename to ElvUI_CPU/.gitattributes diff --git a/ElvUIDev/ElvUIDev.toc b/ElvUI_CPU/ElvUI_CPU-Classic.toc similarity index 62% rename from ElvUIDev/ElvUIDev.toc rename to ElvUI_CPU/ElvUI_CPU-Classic.toc index ccab040..d9b4af9 100644 --- a/ElvUIDev/ElvUIDev.toc +++ b/ElvUI_CPU/ElvUI_CPU-Classic.toc @@ -1,13 +1,12 @@ -## Interface: 90005 -## Title: ElvUI Dev -## Version: 0.1.3 +## Interface: 11401 +## Title: |cff1784d1ElvUI|r |cfffe7b2cCPU Analyzer|r +## Version: 0.1.4 ## Author: Resike -## Notes: Development tools for ElvUI. ## DefaultState: Enabled ## Dependencies: ElvUI ## LoadOnDemand: 1 -ElvUIDev.lua +ElvUI_CPU.lua Widgets\Button.lua Widgets\CheckButton.lua diff --git a/ElvUI_CPU/ElvUI_CPU-Mainline.toc b/ElvUI_CPU/ElvUI_CPU-Mainline.toc new file mode 100644 index 0000000..31fd130 --- /dev/null +++ b/ElvUI_CPU/ElvUI_CPU-Mainline.toc @@ -0,0 +1,15 @@ +## Interface: 90105 +## Title: |cff1784d1ElvUI|r |cfffe7b2cCPU Analyzer|r +## Version: 0.1.4 +## Author: Resike +## DefaultState: Enabled +## Dependencies: ElvUI +## LoadOnDemand: 1 + +ElvUI_CPU.lua + +Widgets\Button.lua +Widgets\CheckButton.lua +Widgets\EditBox.lua +Widgets\Table.lua +Widgets\Window.lua diff --git a/ElvUI_CPU/ElvUI_CPU-TBC.toc b/ElvUI_CPU/ElvUI_CPU-TBC.toc new file mode 100644 index 0000000..96eede9 --- /dev/null +++ b/ElvUI_CPU/ElvUI_CPU-TBC.toc @@ -0,0 +1,15 @@ +## Interface: 20503 +## Title: |cff1784d1ElvUI|r |cfffe7b2cCPU Analyzer|r +## Version: 0.1.4 +## Author: Resike +## DefaultState: Enabled +## Dependencies: ElvUI +## LoadOnDemand: 1 + +ElvUI_CPU.lua + +Widgets\Button.lua +Widgets\CheckButton.lua +Widgets\EditBox.lua +Widgets\Table.lua +Widgets\Window.lua diff --git a/ElvUIDev/ElvUIDev.lua b/ElvUI_CPU/ElvUI_CPU.lua similarity index 60% rename from ElvUIDev/ElvUIDev.lua rename to ElvUI_CPU/ElvUI_CPU.lua index 61d6850..33935fd 100644 --- a/ElvUIDev/ElvUIDev.lua +++ b/ElvUI_CPU/ElvUI_CPU.lua @@ -3,13 +3,15 @@ local AddonName, Addon = ... local ElvUI = LibStub("AceAddon-3.0"):GetAddon("ElvUI") Addon.ElvUI = ElvUI -local ElvUIDev = { } -Addon.ElvUIDev = ElvUIDev +local ElvUI_CPU = { } +Addon.ElvUI_CPU = ElvUI_CPU local getmetatable, setmetatable = getmetatable, setmetatable -local math, print, type, pairs, tonumber = math, print, type, pairs, tonumber +local print, type, pairs, tonumber = print, type, pairs, tonumber +local max, floor = max, floor local CreateFrame = CreateFrame +local ResetCPUUsage = ResetCPUUsage local GetAddOnCPUUsage = GetAddOnCPUUsage local GetAddOnMetadata = GetAddOnMetadata local GetCursorPosition = GetCursorPosition @@ -18,35 +20,37 @@ local UpdateAddOnCPUUsage = UpdateAddOnCPUUsage local PlaySound = PlaySound local GetTime = GetTime --- GLOBALS: GameFontHighlightSmall, UIParent, GameFontNormal +local UIParent = UIParent +local GameFontHighlightSmall = GameFontHighlightSmall +local GameFontNormal = GameFontNormal -_G.ElvUIDev = ElvUIDev +_G.ElvUI_CPU = ElvUI_CPU -math.round = function(num, decimals) +local round = function(num, decimals) local mult = 10^(decimals or 0) - return math.floor(num * mult + 0.5) / mult + return floor(num * mult + 0.5) / mult end -local L = Addon.L +math.round = round -ElvUIDev.events = CreateFrame("Frame") -ElvUIDev.events:RegisterEvent("ADDON_LOADED") +ElvUI_CPU.events = CreateFrame("Frame") +ElvUI_CPU.events:RegisterEvent("ADDON_LOADED") -ElvUIDev.events:SetScript("OnEvent", function(self, event, ...) - ElvUIDev[event](ElvUIDev, ...) +ElvUI_CPU.events:SetScript("OnEvent", function(self, event, ...) + ElvUI_CPU[event](ElvUI_CPU, ...) end) -ElvUIDev.widgets = { } +ElvUI_CPU.widgets = { } -function ElvUIDev:Print(msg, ...) - print("|cFF50C0FFElvUIDev|r: "..msg, ...) +function ElvUI_CPU:Print(msg, ...) + print("|cff1784d1ElvUI|r |cfffe7b2cCPU Analyzer|r: "..msg, ...) end -- Widgets -function ElvUIDev:RegisterWidget(name) +function ElvUI_CPU:RegisterWidget(name) if self.widgets[name] then - ElvUIDev:Print("Widget is already registered with this name:", name) + ElvUI_CPU:Print("Widget is already registered with this name:", name) end local class = { } @@ -57,11 +61,11 @@ function ElvUIDev:RegisterWidget(name) return class end -function ElvUIDev:CreateWidget(name, ...) +function ElvUI_CPU:CreateWidget(name, ...) local class = self.widgets[name] if not class then - ElvUIDev:Print("Widget is not registered:", name) + ElvUI_CPU:Print("Widget is not registered:", name) return end @@ -81,17 +85,21 @@ function ElvUIDev:CreateWidget(name, ...) return frame end -function ElvUIDev:GetWidget(name) +function ElvUI_CPU:GetWidget(name) return self.widgets[name] end -function ElvUIDev:HasWidget(name) +function ElvUI_CPU:HasWidget(name) return not not self.widgets[name] end -function ElvUIDev:ADDON_LOADED(addon) +function ElvUI_CPU:GetLoadedTime() + return floor(GetTime() - ElvUI.loadedtime or self.loadedtime) +end + +function ElvUI_CPU:ADDON_LOADED(addon) if addon == AddonName then - ElvUIDev.loadedtime = GetTime() + ElvUI_CPU.loadedtime = GetTime() self:CreateOptions() @@ -102,12 +110,12 @@ function ElvUIDev:ADDON_LOADED(addon) self.frame.main.devtools.table.loaded = true end - ElvUIDev:Print("Addon loaded into the memory.") + ElvUI_CPU:Print("Addon loaded into the memory.") end end -function ElvUIDev:CreateOptions() - self.frame = self:CreateWidget("Window", "ElvUIDevOptions", UIParent) +function ElvUI_CPU:CreateOptions() + self.frame = self:CreateWidget("Window", "ElvUI_CPUOptions", UIParent) self.frame:SetFrameStrata("High") self.frame:SetSize(800, 600) self.frame:SetPoint("TopLeft", UIParent, "TopLeft", (UIParent:GetWidth() / 2) - 400, (-UIParent:GetHeight() / 2) + 300) @@ -121,13 +129,13 @@ function ElvUIDev:CreateOptions() if InterfaceOptionsFrame then InterfaceOptionsFrame:HookScript("OnShow", function(self) for i, v in pairs(UISpecialFrames) do - if v == "ElvUIDevOptions" then + if v == "ElvUI_CPUOptions" then tremove(UISpecialFrames, i) end end end) InterfaceOptionsFrame:HookScript("OnHide", function(self) - tinsert(UISpecialFrames, "ElvUIDevOptions") + tinsert(UISpecialFrames, "ElvUI_CPUOptions") end) end]] @@ -144,11 +152,11 @@ function ElvUIDev:CreateOptions() local left, bottom = self:GetLeft(), self:GetBottom() - --local x = math.round((left + (self:GetWidth() / 2)) - (UIParent:GetWidth() / 2)) - --local y = math.round((bottom + (self:GetHeight() / 2)) - (UIParent:GetHeight() / 2)) + --local x = round((left + (self:GetWidth() / 2)) - (UIParent:GetWidth() / 2)) + --local y = round((bottom + (self:GetHeight() / 2)) - (UIParent:GetHeight() / 2)) - local x = math.round(left) - local y = math.round(-UIParent:GetHeight() + bottom + self:GetHeight()) + local x = round(left) + local y = round(-UIParent:GetHeight() + bottom + self:GetHeight()) self:ClearAllPoints() self:SetPoint("TopLeft", UIParent, "TopLeft", x, y) @@ -160,7 +168,7 @@ function ElvUIDev:CreateOptions() self.Bg:SetAlpha(self.Bg:GetAlpha() - (delta / 200)) end)]] - self.frame.title:SetText("ElvUI Dev") + self.frame.title:SetText("|cff1784d1ElvUI|r |cfffe7b2cCPU Analyzer|r") self.frame.version = self.frame:CreateFontString(nil, "Overlay") self.frame.version:SetFontObject(GameFontNormal) @@ -170,7 +178,7 @@ function ElvUIDev:CreateOptions() self.frame.version:SetHeight(20) self.frame.version:SetJustifyV("Middle") self.frame.version:SetJustifyH("Right") - self.frame.version:SetText(GetAddOnMetadata("ElvUIDev", "Version")) + self.frame.version:SetText(GetAddOnMetadata("ElvUI_CPU", "Version")) self.frame.version:SetWordWrap(false) self.frame.main = { } @@ -189,52 +197,55 @@ function ElvUIDev:CreateOptions() self.frame.main.devtools.table:AddColumn("Overall usage", 0.15, "%.2f%%", true) self.frame.main.devtools.table:SetScript("OnShow", function(frame) - ElvUIDev:UpdateFunctions() + ElvUI_CPU:UpdateFunctions() end) - --[[self.frame.main.devtools.table.refresh = self:CreateWidget("CheckButtonIcon", self.frame.main.devtools.table) - self.frame.main.devtools.table.refresh:SetPoint("TopRight", self.frame.main.devtools.table, "BottomRight", 0, 0) - self.frame.main.devtools.table.refresh.text:SetText("Refresh") - self.frame.main.devtools.table.refresh.text:SetWordWrap(false) - self.frame.main.devtools.table.refresh:SetScript("OnClick", function(self, button) - ElvUIDev:UpdateFunctions() - end)]] - self.frame.main.devtools.table.toggle = self:CreateWidget("CheckButtonSquare", self.frame.main.devtools.table) self.frame.main.devtools.table.toggle:SetPoint("TopLeft", self.frame.main.devtools.table, "BottomLeft", -2, 0) self.frame.main.devtools.table.toggle.texture:SetSize(7, 13) - self.frame.main.devtools.table.toggle.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\Play") + self.frame.main.devtools.table.toggle.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\Play") self.frame.main.devtools.table.toggle.texture:SetTexCoord(0.3125, 0.75, 0.0625, 0.875) self.frame.main.devtools.table.toggle:SetScript("OnClick", function(self, button) if self:GetChecked() then - self:GetParent():SetScript("OnUpdate", ElvUIDev.FunctionsOnUpdate) + self:GetParent():SetScript("OnUpdate", ElvUI_CPU.FunctionsOnUpdate) self.texture:SetSize(9, 13) - self.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\Stop") + self.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\Stop") self.texture:SetTexCoord(0.1875, 0.75, 0.0625, 0.875) else self:GetParent():SetScript("OnUpdate", nil) self.texture:SetSize(7, 13) - self.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\Play") + self.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\Play") self.texture:SetTexCoord(0.3125, 0.75, 0.0625, 0.875) end end) self.frame.main.devtools.table.refresh = self:CreateWidget("ButtonSquare", self.frame.main.devtools.table) self.frame.main.devtools.table.refresh:SetPoint("TopLeft", self.frame.main.devtools.table.toggle, "TopRight", 0, 0) - self.frame.main.devtools.table.refresh.texture:SetTexture("Interface\\Buttons\\UI-RefreshButton") - self.frame.main.devtools.table.refresh:SetScript("OnClick", function(self, button) - ElvUIDev:UpdateFunctions() + ElvUI_CPU:UpdateFunctions() + end) + + self.frame.main.devtools.table.clear = self:CreateWidget("ButtonSquare", self.frame.main.devtools.table) + self.frame.main.devtools.table.clear:SetPoint("TopLeft", self.frame.main.devtools.table.refresh, "TopRight", 0, 0) + self.frame.main.devtools.table.clear.texture:SetTexture("Interface\\Buttons\\UI-OptionsButton") + self.frame.main.devtools.table.clear:SetScript("OnClick", function(self, button) + ElvUI_CPU.allow_reset = true + + ResetCPUUsage() + ElvUI_CPU.loadedtime = GetTime() + ElvUI_CPU:UpdateFunctions() + + ElvUI_CPU.allow_reset = nil end) self.frame.main.devtools.table.edit = self:CreateWidget("EditBox", self.frame.main.devtools.table) self.frame.main.devtools.table.edit:SetSize(300, 26) - self.frame.main.devtools.table.edit:SetPoint("Left", self.frame.main.devtools.table.refresh, "Right", 3, 0) + self.frame.main.devtools.table.edit:SetPoint("Left", self.frame.main.devtools.table.clear, "Right", 3, 0) self.frame.main.devtools.table.edit.clear = CreateFrame("Button", nil, self.frame.main.devtools.table.edit) self.frame.main.devtools.table.edit.clear:SetSize(12, 12) @@ -289,12 +300,12 @@ function ElvUIDev:CreateOptions() self:SetSize(12, 12) - ElvUIDev.frame.main.devtools.table.edit:SetText("") - ElvUIDev.frame.main.devtools.table.edit:ClearFocus() + ElvUI_CPU.frame.main.devtools.table.edit:SetText("") + ElvUI_CPU.frame.main.devtools.table.edit:ClearFocus() end) self.frame.main.devtools.table.edit.clear.texture = self.frame.main.devtools.table.edit.clear:CreateTexture(nil, "Overlay") - self.frame.main.devtools.table.edit.clear.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\Close") + self.frame.main.devtools.table.edit.clear.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\Close") self.frame.main.devtools.table.edit.clear.texture:SetAllPoints(self.frame.main.devtools.table.edit.clear) self.frame.main.devtools.table.edit.number = self.frame.main.devtools.table:CreateFontString(nil, "Background") @@ -315,12 +326,12 @@ function ElvUIDev:CreateOptions() self.clear:Show() end - ElvUIDev.frame.main.devtools.table:SetFilter(text) + ElvUI_CPU.frame.main.devtools.table:SetFilter(text) if text == "" then - ElvUIDev.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUIDev.frame.main.devtools.table.sorted, ElvUIDev:GetTotal(5)) + ElvUI_CPU.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUI_CPU.frame.main.devtools.table.sorted, ElvUI_CPU:GetTotal(5)) else - ElvUIDev.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUIDev.frame.main.devtools.table.filtered, ElvUIDev:GetFiltered(5)) + ElvUI_CPU.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUI_CPU.frame.main.devtools.table.filtered, ElvUI_CPU:GetFiltered(5)) end end) @@ -333,7 +344,7 @@ function ElvUIDev:CreateOptions() PlaySound(841) end -function ElvUIDev:ToggleFrame() +function ElvUI_CPU:ToggleFrame() if not self.frame:IsShown() then self.frame:Show() else @@ -341,14 +352,14 @@ function ElvUIDev:ToggleFrame() end end -function ElvUIDev:RegisterPlugin(pluginName) +function ElvUI_CPU:RegisterPlugin(pluginName) if (not self.plugins) then self.plugins = {}; end self.plugins[pluginName] = true; end -function ElvUIDev:RegisterPluginModule(pluginName, moduleName, module) +function ElvUI_CPU:RegisterPluginModule(pluginName, moduleName, module) if (not self.pluginModules) then self.pluginModules = {}; end @@ -361,14 +372,14 @@ function ElvUIDev:RegisterPluginModule(pluginName, moduleName, module) end end -function ElvUIDev:AddFunction(key, func) +function ElvUI_CPU:AddFunction(key, func) local subs = false local usage, calls = GetFunctionCPUUsage(func, subs) - usage, calls = math.max(0, usage), calls - self.frame.main.devtools.table:AddRow(key, calls, (calls / math.floor(GetTime() - (ElvUI.loadedtime or ElvUIDev.loadedtime))), (usage / math.max(1, calls)), usage, (usage / math.max(1, GetAddOnCPUUsage("ElvUI"))) * 100) + usage, calls = max(0, usage), calls + self.frame.main.devtools.table:AddRow(key, calls, calls / self:GetLoadedTime(), (usage / max(1, calls)), usage, (usage / max(1, GetAddOnCPUUsage("ElvUI"))) * 100) end -function ElvUIDev:AddFunctions() +function ElvUI_CPU:AddFunctions() for key, func in pairs(ElvUI) do if type(func) == "function" then self:AddFunction("ElvUI:"..key, func) @@ -386,33 +397,33 @@ function ElvUIDev:AddFunctions() self.frame.main.devtools.table:ApplyFilter() end -function ElvUIDev:UpdateFunction(key, func) +function ElvUI_CPU:UpdateFunction(key, func) local subs = false local usage, calls = GetFunctionCPUUsage(func, subs) - usage, calls = math.max(0, usage), calls + usage, calls = max(0, usage), calls - local callspersec = (calls / math.floor(GetTime() - (ElvUI.loadedtime or ElvUIDev.loadedtime))) - local timepercall = (usage / math.max(1, calls)) - local overallusage = (usage / math.max(1, GetAddOnCPUUsage("ElvUI"))) * 100 + local callspersec = calls / self:GetLoadedTime() + local timepercall = usage / max(1, calls) + local overallusage = (usage / max(1, GetAddOnCPUUsage("ElvUI"))) * 100 - if calls == 0 and callspersec == 0 and timepercall == 0 and usage == 0 and overallusage == 0 then + if not ElvUI_CPU.allow_reset and (calls == 0 and callspersec == 0 and timepercall == 0 and usage == 0 and overallusage == 0) then return end self.frame.main.devtools.table:UpdateRow(key, calls, callspersec, timepercall, usage, overallusage) end -function ElvUIDev:FunctionsOnUpdate(elapsed) +function ElvUI_CPU:FunctionsOnUpdate(elapsed) self.time = (self.time or 0) + elapsed if self.time < 1 then return end self.time = 0 - ElvUIDev:UpdateFunctions() + ElvUI_CPU:UpdateFunctions() end -function ElvUIDev:UpdateFunctions() +function ElvUI_CPU:UpdateFunctions() UpdateAddOnCPUUsage("ElvUI") if (self.plugins) then for plugin, _ in pairs(self.plugins) do @@ -448,14 +459,14 @@ function ElvUIDev:UpdateFunctions() self.frame.main.devtools.table:Update() - if ElvUIDev.frame.main.devtools.table.edit:GetText() == "" then - ElvUIDev.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUIDev.frame.main.devtools.table.sorted, ElvUIDev:GetTotal(5)) + if ElvUI_CPU.frame.main.devtools.table.edit:GetText() == "" then + ElvUI_CPU.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUI_CPU.frame.main.devtools.table.sorted, ElvUI_CPU:GetTotal(5)) else - ElvUIDev.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUIDev.frame.main.devtools.table.filtered, ElvUIDev:GetFiltered(5)) + ElvUI_CPU.frame.main.devtools.table.edit.number:SetFormattedText("%d functions: %0.3f ms", #ElvUI_CPU.frame.main.devtools.table.filtered, ElvUI_CPU:GetFiltered(5)) end end -function ElvUIDev:GetTotal(row) +function ElvUI_CPU:GetTotal(row) local x = 0 for i = 1, #self.frame.main.devtools.table.sorted do @@ -465,7 +476,7 @@ function ElvUIDev:GetTotal(row) return x end -function ElvUIDev:GetFiltered(row) +function ElvUI_CPU:GetFiltered(row) local x = 0 for i = 1, #self.frame.main.devtools.table.filtered do @@ -475,7 +486,7 @@ function ElvUIDev:GetFiltered(row) return x end -function ElvUIDev:MakeScaleable(frame) +function ElvUI_CPU:MakeScaleable(frame) if not frame then return end @@ -496,8 +507,8 @@ function ElvUIDev:MakeScaleable(frame) end frame:SetMovable(true) - frame:SetMaxResize(math.round(frame.width * 1.50375), math.round(frame.height * 1.50375)) - frame:SetMinResize(math.round(frame.width * 0.66125), math.round(frame.height * 0.66125)) + frame:SetMaxResize(round(frame.width * 1.50375), round(frame.height * 1.50375)) + frame:SetMinResize(round(frame.width * 0.66125), round(frame.height * 0.66125)) frame:SetUserPlaced(true) frame.br = CreateFrame("Frame", nil, frame) @@ -512,17 +523,17 @@ function ElvUIDev:MakeScaleable(frame) frame.br.texture:SetPoint("TopLeft", frame.br, "TopLeft", 0, 0) frame.br.texture:SetWidth(16) frame.br.texture:SetHeight(16) - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") frame.br:SetScript("OnEnter", function(self) - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") end) frame.br:SetScript("OnLeave", function(self) - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end) frame.br:SetScript("OnMouseDown", function(self, button) if button == "LeftButton" then @@ -531,30 +542,30 @@ function ElvUIDev:MakeScaleable(frame) frame:StartSizing("Right") end - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") frame.version:SetFormattedText("%.3f", frame.scale) end) frame.br:SetScript("OnMouseUp", function(self, button) if button == "MiddleButton" then - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end local x, y = GetCursorPosition() local fx = self:GetLeft() * self:GetEffectiveScale() local fy = self:GetBottom() * self:GetEffectiveScale() if x >= fx and x <= (fx + self:GetWidth()) and y >= fy and y <= (fy + self:GetHeight()) then - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") else - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end frame.resizing = nil @@ -562,7 +573,7 @@ function ElvUIDev:MakeScaleable(frame) frame:StopMovingOrSizing() frame:SetResizable(false) - frame.version:SetText(GetAddOnMetadata("ElvUIDev", "Version")) + frame.version:SetText(GetAddOnMetadata("ElvUI_CPU", "Version")) end) frame.bl = CreateFrame("Frame", nil, frame) @@ -579,17 +590,17 @@ function ElvUIDev:MakeScaleable(frame) frame.bl.texture:SetPoint("TopLeft", frame.bl, "TopLeft", 0, 0) frame.bl.texture:SetWidth(16) frame.bl.texture:SetHeight(16) - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") frame.bl:SetScript("OnEnter", function(self) - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") end) frame.bl:SetScript("OnLeave", function(self) - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end) frame.bl:SetScript("OnMouseDown", function(self, button) if button == "LeftButton" then @@ -598,30 +609,30 @@ function ElvUIDev:MakeScaleable(frame) frame:StartSizing("Left") end - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") frame.version:SetFormattedText("%.3f", frame.scale) end) frame.bl:SetScript("OnMouseUp", function(self, button) if button == "MiddleButton" then - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end local x, y = GetCursorPosition() local fx = self:GetLeft() * self:GetEffectiveScale() local fy = self:GetBottom() * self:GetEffectiveScale() if x >= fx and x <= (fx + self:GetWidth()) and y >= fy and y <= (fy + self:GetHeight()) then - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") else - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end frame.resizing = nil @@ -629,7 +640,7 @@ function ElvUIDev:MakeScaleable(frame) frame:StopMovingOrSizing() frame:SetResizable(false) - frame.version:SetText(GetAddOnMetadata("ElvUIDev", "Version")) + frame.version:SetText(GetAddOnMetadata("ElvUI_CPU", "Version")) end) frame.tl = CreateFrame("Frame", nil, frame) @@ -646,17 +657,17 @@ function ElvUIDev:MakeScaleable(frame) frame.tl.texture:SetPoint("TopLeft", frame.tl, "TopLeft", 0, 0) frame.tl.texture:SetWidth(16) frame.tl.texture:SetHeight(16) - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") frame.tl:SetScript("OnEnter", function(self) - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") end) frame.tl:SetScript("OnLeave", function(self) - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end) frame.tl:SetScript("OnMouseDown", function(self, button) if button == "LeftButton" then @@ -666,30 +677,30 @@ function ElvUIDev:MakeScaleable(frame) frame:StartSizing("Top") end - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") frame.version:SetFormattedText("%.3f", frame.scale) end) frame.tl:SetScript("OnMouseUp", function(self, button) if button == "MiddleButton" then - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end local x, y = GetCursorPosition() local fx = self:GetLeft() * self:GetEffectiveScale() local fy = self:GetBottom() * self:GetEffectiveScale() if x >= fx and x <= (fx + self:GetWidth()) and y >= fy and y <= (fy + self:GetHeight()) then - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") else - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.bl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end frame.resizing = nil @@ -697,7 +708,7 @@ function ElvUIDev:MakeScaleable(frame) frame:StopMovingOrSizing() frame:SetResizable(false) - frame.version:SetText(GetAddOnMetadata("ElvUIDev", "Version")) + frame.version:SetText(GetAddOnMetadata("ElvUI_CPU", "Version")) end) frame.tr = CreateFrame("Frame", nil, frame) @@ -714,17 +725,17 @@ function ElvUIDev:MakeScaleable(frame) frame.tr.texture:SetPoint("TopLeft", frame.tr, "TopLeft", 0, 0) frame.tr.texture:SetWidth(16) frame.tr.texture:SetHeight(16) - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") frame.tr:SetScript("OnEnter", function(self) - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") end) frame.tr:SetScript("OnLeave", function(self) - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end) frame.tr:SetScript("OnMouseDown", function(self, button) if button == "LeftButton" then @@ -734,30 +745,30 @@ function ElvUIDev:MakeScaleable(frame) frame:StartSizing("Top") end - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberDown") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberDown") frame.version:SetFormattedText("%.3f", frame.scale) end) frame.tr:SetScript("OnMouseUp", function(self, button) if button == "MiddleButton" then - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end local x, y = GetCursorPosition() local fx = self:GetLeft() * self:GetEffectiveScale() local fy = self:GetBottom() * self:GetEffectiveScale() if x >= fx and x <= (fx + self:GetWidth()) and y >= fy and y <= (fy + self:GetHeight()) then - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberHighlight") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberHighlight") else - frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") - frame.br.texture:SetTexture("Interface\\AddOns\\ElvUIDev\\Textures\\SizeGrabberUp") + frame.tr.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.tl.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") + frame.br.texture:SetTexture("Interface\\AddOns\\ElvUI_CPU\\Textures\\SizeGrabberUp") end frame.resizing = nil @@ -765,7 +776,7 @@ function ElvUIDev:MakeScaleable(frame) frame:StopMovingOrSizing() frame:SetResizable(false) - frame.version:SetText(GetAddOnMetadata("ElvUIDev", "Version")) + frame.version:SetText(GetAddOnMetadata("ElvUI_CPU", "Version")) end) frame:SetScript("OnSizeChanged", function(self) @@ -778,13 +789,13 @@ function ElvUIDev:MakeScaleable(frame) if self.direction == "TopLeft" or self.direction == "TopRight" then self:ClearAllPoints() if self.direction == "TopLeft" then - local x = math.round(-UIParent:GetWidth() + self:GetRight()) - local y = math.round(bottom) + local x = round(-UIParent:GetWidth() + self:GetRight()) + local y = round(bottom) self:SetPoint("BottomRight", UIParent, "BottomRight", x, y) else - local x = math.round(left) - local y = math.round(bottom) + local x = round(left) + local y = round(bottom) self:SetPoint("BottomLeft", UIParent, "BottomLeft", x, y) end @@ -793,13 +804,13 @@ function ElvUIDev:MakeScaleable(frame) self.scale = scale --local modifier = ((1 - scale) / 1.8) -- Figure out why the hell do we need this. --local xy = modifier / (scale + 1.5) - self:SetWidth(math.round(frame.width * scale)) + self:SetWidth(round(frame.width * scale)) --frame.overlay:SetScale(scale) self.overlay:SetScale(scale) - --self.main.menu:SetPoint("TopLeft", self.main, "TopLeft", 50, math.round(-43 / scale)) + --self.main.menu:SetPoint("TopLeft", self.main, "TopLeft", 50, round(-43 / scale)) - self.shadow.upper:SetPoint("TopLeft", 0, math.round(-21 / self.scale)) - self.shadow.upper:SetPoint("TopRight", math.round(-2 / self.scale), math.round(-21 / self.scale)) + self.shadow.upper:SetPoint("TopLeft", 0, round(-21 / self.scale)) + self.shadow.upper:SetPoint("TopRight", round(-2 / self.scale), round(-21 / self.scale)) self.shadow.upper:SetScale(scale) for i = 1, #self.main.devtools.table.frame.columns do @@ -809,34 +820,34 @@ function ElvUIDev:MakeScaleable(frame) local column = self.main.devtools.table.frame.columns[i][1] - column:SetWidth(math.round(self.main.devtools.table.frame:GetWidth() * self.main.devtools.table.frame.columns[i][6])) - column:SetMaxResize(math.round(column:GetWidth() * 2), math.round(column:GetHeight() * 2)) - column:SetMinResize(math.round(column:GetWidth() / 1.4), math.round(column:GetHeight() / 1.4)) + column:SetWidth(round(self.main.devtools.table.frame:GetWidth() * self.main.devtools.table.frame.columns[i][6])) + column:SetMaxResize(round(column:GetWidth() * 2), round(column:GetHeight() * 2)) + column:SetMinResize(round(column:GetWidth() / 1.4), round(column:GetHeight() / 1.4)) end - local y = math.round(self:GetHeight() - (self.overlay:GetHeight() * scale) + 5) + local y = round(self:GetHeight() - (self.overlay:GetHeight() * scale) + 5) self.main.devtools.table:SetPoint("TopLeft", self, "TopLeft", 2 + 20, -y) self.version:SetFormattedText("%.3f", self.scale) - --ElvUIDev:ScaleChildrens(self, scale) + --ElvUI_CPU:ScaleChildrens(self, scale) else self:ClearAllPoints() - local x = math.round(left) - local y = math.round(-UIParent:GetHeight() + bottom + self:GetHeight()) + local x = round(left) + local y = round(-UIParent:GetHeight() + bottom + self:GetHeight()) self:SetPoint("TopLeft", UIParent, "TopLeft", x, y) local scale = self:GetWidth() / frame.width self.scale = scale --local modifier = ((1 - scale) / 1.8) -- Figure out why the hell do we need this. --local xy = modifier / (scale + 1.5) - self:SetHeight(math.round(frame.height * scale)) + self:SetHeight(round(frame.height * scale)) --frame.overlay:SetScale(scale) self.overlay:SetScale(scale) - --self.main.menu:SetPoint("TopLeft", self.main, "TopLeft", 50, math.round(-43 / scale)) + --self.main.menu:SetPoint("TopLeft", self.main, "TopLeft", 50, round(-43 / scale)) - self.shadow.upper:SetPoint("TopLeft", 0, math.round(-21 / self.scale)) - self.shadow.upper:SetPoint("TopRight", math.round(-2 / self.scale), math.round(-21 / self.scale)) + self.shadow.upper:SetPoint("TopLeft", 0, round(-21 / self.scale)) + self.shadow.upper:SetPoint("TopRight", round(-2 / self.scale), round(-21 / self.scale)) self.shadow.upper:SetScale(scale) for i = 1, #self.main.devtools.table.frame.columns do @@ -846,22 +857,22 @@ function ElvUIDev:MakeScaleable(frame) local column = self.main.devtools.table.frame.columns[i][1] - column:SetWidth(math.round(self.main.devtools.table.frame:GetWidth() * self.main.devtools.table.frame.columns[i][6])) - column:SetMaxResize(math.round(column:GetWidth() * 2), math.round(column:GetHeight() * 2)) - column:SetMinResize(math.round(column:GetWidth() / 1.4), math.round(column:GetHeight() / 1.4)) + column:SetWidth(round(self.main.devtools.table.frame:GetWidth() * self.main.devtools.table.frame.columns[i][6])) + column:SetMaxResize(round(column:GetWidth() * 2), round(column:GetHeight() * 2)) + column:SetMinResize(round(column:GetWidth() / 1.4), round(column:GetHeight() / 1.4)) end - local y = math.round(self:GetHeight() - (self.overlay:GetHeight() * scale) + 5) + local y = round(self:GetHeight() - (self.overlay:GetHeight() * scale) + 5) self.main.devtools.table:SetPoint("TopLeft", self, "TopLeft", 2 + 20, -y) self.version:SetFormattedText("%.3f", self.scale) - --ElvUIDev:ScaleChildrens(self, scale) + --ElvUI_CPU:ScaleChildrens(self, scale) end end) end -function ElvUIDev:ScaleChildrens(frame, scale) +function ElvUI_CPU:ScaleChildrens(frame, scale) --local childrens = {frame:GetChildren()} --for _, child in ipairs(childrens) do for i = 1, #self.frame.childrens do diff --git a/ElvUIDev/Textures/Close.tga b/ElvUI_CPU/Textures/Close.tga similarity index 100% rename from ElvUIDev/Textures/Close.tga rename to ElvUI_CPU/Textures/Close.tga diff --git a/ElvUIDev/Textures/Play.tga b/ElvUI_CPU/Textures/Play.tga similarity index 100% rename from ElvUIDev/Textures/Play.tga rename to ElvUI_CPU/Textures/Play.tga diff --git a/ElvUIDev/Textures/SizeGrabberDown.tga b/ElvUI_CPU/Textures/SizeGrabberDown.tga similarity index 100% rename from ElvUIDev/Textures/SizeGrabberDown.tga rename to ElvUI_CPU/Textures/SizeGrabberDown.tga diff --git a/ElvUIDev/Textures/SizeGrabberHighlight.tga b/ElvUI_CPU/Textures/SizeGrabberHighlight.tga similarity index 100% rename from ElvUIDev/Textures/SizeGrabberHighlight.tga rename to ElvUI_CPU/Textures/SizeGrabberHighlight.tga diff --git a/ElvUIDev/Textures/SizeGrabberUp.tga b/ElvUI_CPU/Textures/SizeGrabberUp.tga similarity index 100% rename from ElvUIDev/Textures/SizeGrabberUp.tga rename to ElvUI_CPU/Textures/SizeGrabberUp.tga diff --git a/ElvUIDev/Textures/Stop.tga b/ElvUI_CPU/Textures/Stop.tga similarity index 100% rename from ElvUIDev/Textures/Stop.tga rename to ElvUI_CPU/Textures/Stop.tga diff --git a/ElvUIDev/Widgets/Button.lua b/ElvUI_CPU/Widgets/Button.lua similarity index 92% rename from ElvUIDev/Widgets/Button.lua rename to ElvUI_CPU/Widgets/Button.lua index 26e3c5a..d39193a 100644 --- a/ElvUIDev/Widgets/Button.lua +++ b/ElvUI_CPU/Widgets/Button.lua @@ -1,12 +1,12 @@ -local AddonName, Addon = ... +local _, Addon = ... -local ElvUIDev = Addon.ElvUIDev +local ElvUI_CPU = Addon.ElvUI_CPU local CreateFrame = CreateFrame local GameFontDisableSmall = GameFontDisableSmall local GameFontHighlightSmall = GameFontHighlightSmall -local Button = ElvUIDev:RegisterWidget("Button") +local Button = ElvUI_CPU:RegisterWidget("Button") function Button:Create(parent) local frame = CreateFrame("Button", nil, parent) @@ -28,7 +28,7 @@ function Button:Create(parent) return frame end -local ButtonSquare = ElvUIDev:RegisterWidget("ButtonSquare") +local ButtonSquare = ElvUI_CPU:RegisterWidget("ButtonSquare") function ButtonSquare:Create(parent) local frame = CreateFrame("Button", nil, parent) diff --git a/ElvUIDev/Widgets/CheckButton.lua b/ElvUI_CPU/Widgets/CheckButton.lua similarity index 92% rename from ElvUIDev/Widgets/CheckButton.lua rename to ElvUI_CPU/Widgets/CheckButton.lua index a863b88..31087cd 100644 --- a/ElvUIDev/Widgets/CheckButton.lua +++ b/ElvUI_CPU/Widgets/CheckButton.lua @@ -1,16 +1,16 @@ -local AddonName, Addon = ... +local _, Addon = ... -local ElvUIDev = Addon.ElvUIDev +local ElvUI_CPU = Addon.ElvUI_CPU -local hooksecurefunc = hooksecurefunc +--local hooksecurefunc = hooksecurefunc local CreateFrame = CreateFrame local GameFontNomal = GameFontNomal -local GameFontHighlightl = GameFontHighlight +local GameFontHighlight = GameFontHighlight local GameFontDisable = GameFontDisable -local CheckButton = ElvUIDev:RegisterWidget("CheckButton") +local CheckButton = ElvUI_CPU:RegisterWidget("CheckButton") function CheckButton:Create(parent) local frame = CreateFrame("CheckButton", nil, parent) @@ -47,7 +47,7 @@ function CheckButton:Create(parent) return frame end -local CheckButtonIcon = ElvUIDev:RegisterWidget("CheckButtonIcon") +local CheckButtonIcon = ElvUI_CPU:RegisterWidget("CheckButtonIcon") function CheckButtonIcon:Create(parent) local frame = CreateFrame("CheckButton", nil, parent) @@ -84,7 +84,7 @@ function CheckButtonIcon:Create(parent) return frame end -local CheckButtonSquare = ElvUIDev:RegisterWidget("CheckButtonSquare") +local CheckButtonSquare = ElvUI_CPU:RegisterWidget("CheckButtonSquare") function CheckButtonSquare:Create(parent) local frame = CreateFrame("CheckButton", nil, parent) diff --git a/ElvUIDev/Widgets/EditBox.lua b/ElvUI_CPU/Widgets/EditBox.lua similarity index 93% rename from ElvUIDev/Widgets/EditBox.lua rename to ElvUI_CPU/Widgets/EditBox.lua index 8ca170b..ed6bb89 100644 --- a/ElvUIDev/Widgets/EditBox.lua +++ b/ElvUI_CPU/Widgets/EditBox.lua @@ -1,13 +1,13 @@ -local AddonName, Addon = ... +local _, Addon = ... -local ElvUIDev = Addon.ElvUIDev +local ElvUI_CPU = Addon.ElvUI_CPU local CreateFrame = CreateFrame local BackdropTemplateMixin = BackdropTemplateMixin local GameFontHighlight = GameFontHighlight local GameFontNormal = GameFontNormal -local EditBox = ElvUIDev:RegisterWidget("EditBox") +local EditBox = ElvUI_CPU:RegisterWidget("EditBox") function EditBox:Create(parent) local frame = CreateFrame("EditBox", nil, parent, BackdropTemplateMixin and "BackdropTemplate" or nil) diff --git a/ElvUIDev/Widgets/Table.lua b/ElvUI_CPU/Widgets/Table.lua similarity index 93% rename from ElvUIDev/Widgets/Table.lua rename to ElvUI_CPU/Widgets/Table.lua index f4e2365..5e65e5b 100644 --- a/ElvUIDev/Widgets/Table.lua +++ b/ElvUI_CPU/Widgets/Table.lua @@ -1,11 +1,20 @@ -local AddonName, Addon = ... +local _, Addon = ... -local ElvUIDev = Addon.ElvUIDev +local ElvUI_CPU = Addon.ElvUI_CPU +local assert, strfind, tostring = assert, strfind, tostring +local type, select, sort = type, select, sort + +local min, max, round = min, max, math.round + +local UIParent = UIParent +local PlaySound = PlaySound local CreateFrame = CreateFrame local BackdropTemplateMixin = BackdropTemplateMixin +local GameFontHighlightSmall = GameFontHighlightSmall +local GameFontNormalSmall = GameFontNormalSmall -local Table = ElvUIDev:RegisterWidget("Table") +local Table = ElvUI_CPU:RegisterWidget("Table") function Table:Create(parent) self.frame = CreateFrame("Frame", nil, parent or UIParent, BackdropTemplateMixin and "BackdropTemplate" or nil) @@ -164,7 +173,7 @@ function Table:GetSortedColumn() end function Table:SetSortedColumn(id, desc) - self.frame.sortedheader = math.max(1, math.min(#(self.frame.columns), id)) + self.frame.sortedheader = max(1, min(#(self.frame.columns), id)) self.frame.descending = not not desc self:SortColumn() end @@ -177,7 +186,7 @@ function Table:SortColumn() items = self.frame.sorted end - table.sort(items, self.frame.columns[self.frame.sortedheader][5]) + sort(items, self.frame.columns[self.frame.sortedheader][5]) self:UpdateItems() end @@ -220,9 +229,9 @@ function Table:CreateColumn(parent, text, width, format, last) end]] --frame:SetSize((self.frame:GetWidth() - x) * width, 24) - frame:SetSize(math.round(self.frame:GetWidth() * width), 24) - frame:SetMaxResize(math.round(frame:GetWidth() * 2), math.round(frame:GetHeight() * 2)) - frame:SetMinResize(math.round(frame:GetWidth() / 1.4), math.round(frame:GetHeight() / 1.4)) + frame:SetSize(round(self.frame:GetWidth() * width), 24) + frame:SetMaxResize(round(frame:GetWidth() * 2), round(frame:GetHeight() * 2)) + frame:SetMinResize(round(frame:GetWidth() / 1.4), round(frame:GetHeight() / 1.4)) frame.text = frame:CreateFontString(nil, "Overlay") if frame:GetID() == 1 then @@ -335,7 +344,7 @@ function Table:CreateColumn(parent, text, width, format, last) return end - self:SetWidth(math.round(self:GetWidth())) + self:SetWidth(round(self:GetWidth())) -- This should be recursive --for i = #Table.frame.columns, self:GetID() + 1, -1 do @@ -345,27 +354,27 @@ function Table:CreateColumn(parent, text, width, format, last) if (Table.frame.columns[i - 1][1]:GetWidth() - diff) > (Table.frame:GetWidth() * Table.frame.columns[i - 1][3] / 1.4) then Table.frame.columns[i - 1][1].noSizing = true - Table.frame.columns[i - 1][1]:SetWidth(math.round(Table.frame.columns[i - 1][1]:GetWidth() - diff)) + Table.frame.columns[i - 1][1]:SetWidth(round(Table.frame.columns[i - 1][1]:GetWidth() - diff)) Table.frame.columns[i - 1][1].noSizing = nil else if (Table.frame.columns[i - 2][1]:GetWidth() - diff) > (Table.frame:GetWidth() * Table.frame.columns[i - 2][3] / 1.4) then Table.frame.columns[i - 2][1].noSizing = true - Table.frame.columns[i - 2][1]:SetWidth(math.round(Table.frame.columns[i - 2][1]:GetWidth() - diff)) + Table.frame.columns[i - 2][1]:SetWidth(round(Table.frame.columns[i - 2][1]:GetWidth() - diff)) Table.frame.columns[i - 2][1].noSizing = nil else if (Table.frame.columns[i - 3][1]:GetWidth() - diff) > (Table.frame:GetWidth() * Table.frame.columns[i - 3][3] / 1.4) then Table.frame.columns[i - 3][1].noSizing = true - Table.frame.columns[i - 3][1]:SetWidth(math.round(Table.frame.columns[i - 3][1]:GetWidth() - diff)) + Table.frame.columns[i - 3][1]:SetWidth(round(Table.frame.columns[i - 3][1]:GetWidth() - diff)) Table.frame.columns[i - 3][1].noSizing = nil else if (Table.frame.columns[i - 4][1]:GetWidth() - diff) > (Table.frame:GetWidth() * Table.frame.columns[i - 4][3] / 1.4) then Table.frame.columns[i - 4][1].noSizing = true - Table.frame.columns[i - 4][1]:SetWidth(math.round(Table.frame.columns[i - 4][1]:GetWidth() - diff)) + Table.frame.columns[i - 4][1]:SetWidth(round(Table.frame.columns[i - 4][1]:GetWidth() - diff)) Table.frame.columns[i - 4][1].noSizing = nil else if (Table.frame.columns[i - 5][1]:GetWidth() - diff) > (Table.frame:GetWidth() * Table.frame.columns[i - 5][3] / 1.4) then Table.frame.columns[i - 5][1].noSizing = true - Table.frame.columns[i - 5][1]:SetWidth(math.round(Table.frame.columns[i - 5][1]:GetWidth() - diff)) + Table.frame.columns[i - 5][1]:SetWidth(round(Table.frame.columns[i - 5][1]:GetWidth() - diff)) Table.frame.columns[i - 5][1].noSizing = nil end end @@ -476,7 +485,7 @@ function Table:AddRow(...) --[[self.frame.filtered[#self.frame.filtered + 1] = { } for i = 1, (select("#", ...)) do local text = (select(i, ...)) - if i == 1 and string.find(text, self.frame.filter) then + if i == 1 and strfind(text, self.frame.filter) then --self.frame.rows[#self.frame.rows][i] = { } --self.frame.rows[#self.frame.rows][i].text = text self.frame.filtered[#self.frame.filtered][i] = { } @@ -569,7 +578,7 @@ function Table:ApplyFilter() self.frame.filtered = { } for i = 1, #self.frame.sorted do - if string.find(self.frame.sorted[i][1].text, self.frame.filter) then + if strfind(self.frame.sorted[i][1].text, self.frame.filter) then self.frame.filtered[#self.frame.filtered + 1] = { } for j = 1, #self.frame.sorted[i] do self.frame.filtered[#self.frame.filtered][j] = self.frame.sorted[i][j] @@ -706,9 +715,9 @@ function Table:UpdateItems() else for i = 1, #self.frame.columns do if i == #self.frame.columns then - self.frame.columns[i][1]:SetSize(math.round(((self.frame:GetWidth() - x) * self.frame.columns[i][3])) + 2, 24) + self.frame.columns[i][1]:SetSize(round(((self.frame:GetWidth() - x) * self.frame.columns[i][3])) + 2, 24) else - self.frame.columns[i][1]:SetSize(math.round(((self.frame:GetWidth() - x) * self.frame.columns[i][3])) + 1, 24) + self.frame.columns[i][1]:SetSize(round(((self.frame:GetWidth() - x) * self.frame.columns[i][3])) + 1, 24) end --self.frame.columns[i][1]:SetID(i) end diff --git a/ElvUIDev/Widgets/Window.lua b/ElvUI_CPU/Widgets/Window.lua similarity index 97% rename from ElvUIDev/Widgets/Window.lua rename to ElvUI_CPU/Widgets/Window.lua index d13540a..abc630d 100644 --- a/ElvUIDev/Widgets/Window.lua +++ b/ElvUI_CPU/Widgets/Window.lua @@ -1,6 +1,6 @@ -local AddonName, Addon = ... +local _, Addon = ... -local ElvUIDev = Addon.ElvUIDev +local ElvUI_CPU = Addon.ElvUI_CPU local CreateFrame = CreateFrame local PlaySound = PlaySound @@ -8,7 +8,7 @@ local PlaySound = PlaySound local UIParent = UIParent local GameFontHighlight = GameFontHighlight -local Window = ElvUIDev:RegisterWidget("Window") +local Window = ElvUI_CPU:RegisterWidget("Window") function Window:Create(name, parent) local frame = CreateFrame("Frame", name, parent or UIParent, "BasicFrameTemplate")