From 827a298a01698dfca8d72419694c6673305e1981 Mon Sep 17 00:00:00 2001 From: tercio Date: Fri, 2 May 2014 01:39:41 -0300 Subject: [PATCH] - Micro frames should now be less buggy. - Added a reset button for custom spells. --- Libs/LibHotCorners/LibHotCorners.lua | 153 ++++++++++++++++++++----- boot.lua | 4 +- core/plugins_statusbar.lua | 162 +++++++++++++++++++++++---- framework/panel.lua | 16 ++- functions/profiles.lua | 3 + functions/spellcache.lua | 80 +++++++++---- gumps/janela_options.lua | 45 +++++--- startup.lua | 23 +++- 8 files changed, 390 insertions(+), 96 deletions(-) diff --git a/Libs/LibHotCorners/LibHotCorners.lua b/Libs/LibHotCorners/LibHotCorners.lua index b5cc58c8..74ed9609 100644 --- a/Libs/LibHotCorners/LibHotCorners.lua +++ b/Libs/LibHotCorners/LibHotCorners.lua @@ -6,11 +6,12 @@ if (not LibHotCorners) then end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ---> main functions +--> main function LibHotCorners.embeds = LibHotCorners.embeds or {} local embed_functions = { - "RegisterHotCornerButton" + "RegisterHotCornerButton", + "HideHotCornerButton" } function LibHotCorners:Embed (target) for k, v in pairs (embed_functions) do @@ -23,18 +24,81 @@ end local CallbackHandler = LibStub:GetLibrary ("CallbackHandler-1.0") LibHotCorners.callbacks = LibHotCorners.callbacks or CallbackHandler:New (LibHotCorners) - LibHotCorners.topleft = {widgets = {}, fastcorner = false} + LibHotCorners.topleft = {widgets = {}, quickclick = false, is_enabled = false, map = {}} LibHotCorners.bottomleft = {} LibHotCorners.topright = {} LibHotCorners.bottomright = {} - function LibHotCorners:RegisterHotCornerButton (corner, name, icon, tooltip, clickfunc, menus, fastcorner) - corner = string.lower (corner) + local function test (corner) assert (corner == "topleft" or corner == "bottomleft" or corner == "topright" or corner == "bottomright", "LibHotCorners:RegisterAddon expects a corner on #1 argument.") - tinsert (LibHotCorners [corner], {name = name, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus}) - if (fastcorner) then - LibHotCorners [corner].fastcorner = fastcorner + end + + function LibHotCorners:RegisterHotCornerButton (name, corner, savedtable, fname, icon, tooltip, clickfunc, menus, quickfunc) + corner = string.lower (corner) + test (corner) + + tinsert (LibHotCorners [corner], {name = name, fname = fname, savedtable = savedtable, icon = icon, tooltip = tooltip, click = clickfunc, menus = menus, quickfunc = quickclick}) + LibHotCorners [corner].map [name] = #LibHotCorners [corner] + + if (not savedtable.hide) then + LibHotCorners [corner].is_enabled = true end + + if (quickfunc and savedtable [corner .. "_quick_click"]) then + LibHotCorners [corner].quickfunc = quickfunc + end + + return LibHotCorners [corner].map [name] + end + + function LibHotCorners:QuickHotCornerEnable (name, corner, value) + + corner = string.lower (corner) + test (corner) + + local corner_table = LibHotCorners [corner] + local addon_table = corner_table [corner_table.map [name]] + + addon_table.savedtable.quickclick = value + + if (value and addon_table.quickfunc) then + corner_table.quickfunc = addon_table.quickfunc + else + local got = false + for index, button_table in ipairs (corner_table) do + if (button_table.savedtable.quickclick) then + corner_table.quickfunc = button_table.quickfunc + got = true + break + end + end + + if (not got) then + corner_table.quickfunc = nil + end + end + end + + function LibHotCorners:HideHotCornerButton (name, corner, value) + + corner = string.lower (corner) + test (corner) + + local corner_table = LibHotCorners [corner] + local addon_table = corner_table [corner_table.map [name]] + + addon_table.savedtable.hide = value + + LibHotCorners [corner].is_enabled = false + + for index, button_table in ipairs (corner_table) do + if (not button_table.savedtable.hide) then + LibHotCorners [corner].is_enabled = true + break + end + end + + return true end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -42,46 +106,68 @@ end local TopLeftCorner = CreateFrame ("frame", "LibHotCornersTopLeft", UIParent) - TopLeftCorner:SetSize (20, 20) + TopLeftCorner:SetSize (1, 1) TopLeftCorner:SetFrameStrata ("fullscreen") TopLeftCorner:SetPoint ("TopLeft", UIParent, "TopLeft", 0, 0) - local FastCornerButton = CreateFrame ("button", "LibHotCornersTopLeftFastButton", TopLeftCorner) - FastCornerButton:SetPoint ("topleft", TopLeftCorner, "topleft") - FastCornerButton:SetSize (1, 1) - FastCornerButton:SetScript ("OnClick", function (self) - if (LibHotCorners.topleft.fastcorner) then - LibHotCorners.topleft.fastcorner() - end - end) - local TopLeftCornerBackdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], tile = true, tileSize = 40} --> on enter local TopLeftCornerOnEnter = function (self) + + if (not LibHotCorners.topleft.is_enabled) then + return + end + self:SetSize (40, GetScreenHeight()) TopLeftCorner:SetBackdrop (TopLeftCornerBackdrop) + local i = 1 + for index, button_table in ipairs (LibHotCorners.topleft) do - if (button_table.widget) then - button_table.widget:Show() - else + if (not button_table.widget) then LibHotCorners:CreateAddonWidget (TopLeftCorner, button_table, index, "TopLeft") end + + if (not button_table.savedtable.hide) then + button_table.widget:SetPoint ("topleft", self, "topleft", 4, i * 32 * -1) + button_table.widget:Show() + i = i + 1 + else + button_table.widget:Hide() + end + end + end --> on leave local TopLeftCornerOnLeave = function (self) - self:SetSize (20, 20) + self:SetSize (1, 1) TopLeftCorner:SetBackdrop (nil) for index, button_table in ipairs (LibHotCorners.topleft) do button_table.widget:Hide() end end - + TopLeftCorner:SetScript ("OnEnter", TopLeftCornerOnEnter) TopLeftCorner:SetScript ("OnLeave", TopLeftCornerOnLeave) + + --fast corner button + local QuickClickButton = CreateFrame ("button", "LibHotCornersTopLeftFastButton", TopLeftCorner) + QuickClickButton:SetPoint ("topleft", TopLeftCorner, "topleft") + QuickClickButton:SetSize (1, 1) + QuickClickButton:SetScript ("OnClick", function (self, button) + if (LibHotCorners.topleft.quickfunc) then + LibHotCorners.topleft.quickfunc (self, button) + end + end) + + QuickClickButton:SetScript ("OnEnter", function() + TopLeftCornerOnEnter (TopLeftCorner) + end) + + LibHotCorners.topleft.quickbutton = QuickClickButton ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ --> buttons @@ -106,25 +192,36 @@ end local WidgetOnMouseDown = function (self) self:SetPoint ("topleft", self.parent, "topleft", 5, self.index*33*-1) end - local WidgetOnMouseUp = function (self) + local WidgetOnMouseUp = function (self, button) self:SetPoint ("topleft", self.parent, "topleft", 4, self.index*32*-1) - self.table.click() + + --> if the widget have a click function, run it + if (self.table.click) then + self.table.click (self, button) + end end function LibHotCorners:CreateAddonWidget (frame, button_table, index, side) - local button = CreateFrame ("button", "LibHotCorners" .. side .. button_table.name, frame) + + --> create the button + local button = CreateFrame ("button", "LibHotCorners" .. side .. button_table.fname, frame) + button:SetFrameLevel (frame:GetFrameLevel()+1) + --> write some attributes button.index = index button.table = button_table button.parent = frame button_table.widget = button + --> set the icon button:SetNormalTexture (button_table.icon) button:SetHighlightTexture (button_table.icon) - button:SetPoint ("topleft", frame, "topleft", 4, index*32*-1) + --> set the point and size button:SetSize (32, 32) - button:SetFrameLevel (frame:GetFrameLevel()+1) + button:Hide() + + --> set the scripts button:SetScript ("OnEnter", WidgetOnEnter) button:SetScript ("OnLeave", WidgetOnLeave) button:SetScript ("OnMouseDown", WidgetOnMouseDown) diff --git a/boot.lua b/boot.lua index 87260cfe..e47ff3aa 100644 --- a/boot.lua +++ b/boot.lua @@ -2,13 +2,13 @@ --Last Modification: 27/07/2013 -- Change Log: -- 27/07/2013: Finished alpha version. - + ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> global name declaration _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0", "LibHotCorners") - _detalhes.userversion = "v1.13.5" --options iniciando junto + _detalhes.userversion = "v1.13.5a" --options iniciando junto _detalhes.version = "Alpha 017" _detalhes.realversion = 17 diff --git a/core/plugins_statusbar.lua b/core/plugins_statusbar.lua index d750bc22..6db90860 100644 --- a/core/plugins_statusbar.lua +++ b/core/plugins_statusbar.lua @@ -97,6 +97,9 @@ if (fromStartup and childObject.options.isHidden) then childObject.frame.text:Hide() + if (childObject.frame.texture) then + childObject.frame.texture:Hide() + end end return true @@ -128,6 +131,9 @@ if (fromStartup and childObject.options.isHidden) then childObject.frame.text:Hide() + if (childObject.frame.texture) then + childObject.frame.texture:Hide() + end end return true @@ -154,6 +160,9 @@ if (fromStartup and childObject.options.isHidden) then childObject.frame.text:Hide() + if (childObject.frame.texture) then + childObject.frame.texture:Hide() + end end return true @@ -185,13 +194,24 @@ --> select a new plugin in for an instance anchor local ChoosePlugin = function (_, _, index, current_child, anchor) + GameCooltip:Close() + + local byuser = false + + if (type (index) == "table") then + index, current_child, anchor = unpack (index) + byuser = true + end + if (index and index == -1) then --> hide - current_child.frame.text:Hide() _detalhes.StatusBar:ApplyOptions (current_child, "hidden", true) return else _detalhes.StatusBar:ApplyOptions (current_child, "hidden", false) current_child.frame.text:Show() + if (current_child.frame.texture) then + current_child.frame.texture:Show() + end end local pluginMestre = _detalhes.StatusBar.Plugins [index] @@ -209,6 +229,7 @@ local chosenChild = nil + --procura pra ver se ja tem uma criada for _, child_created in _ipairs (instance.StatusBar) do if (child_created.mainPlugin == pluginMestre) then chosenChild = child_created @@ -216,18 +237,29 @@ end end + --se nao tiver cria uma if (not chosenChild) then chosenChild = _detalhes.StatusBar:CreateStatusBarChildForInstance (current_child.instance, pluginMestre.real_name) end instance.StatusBar [anchor] = chosenChild + --> copia os atributos do current para o chosen + local options_current = table_deepcopy (current_child.options) + if (chosenChild.anchor) then + --o widget escolhido ja estava sendo mostrado... + -- copia os atributos do chosen para o current + + current_child.options = table_deepcopy (chosenChild.options) instance.StatusBar [chosenChild.anchor] = current_child end - _detalhes.StatusBar:ReloadAnchors (instance) + chosenChild.options = options_current + + _detalhes.StatusBar:ReloadAnchors (instance) + + _detalhes.StatusBar:UpdateOptions (instance) - _detalhes.popup:ShowMe (false) end --> on enter @@ -295,11 +327,29 @@ frame.child:Setup() else GameCooltip:Reset() + GameCooltip:SetType ("menu") + GameCooltip:AddMenu (1, ChoosePlugin, -1, frame.child, frame.child.anchor, Loc ["STRING_PLUGIN_CLEAN"], [[Interface\Buttons\UI-GroupLoot-Pass-Down]], true) + + local current + for index, _name_and_icon in _ipairs (_detalhes.StatusBar.Menu) do - GameCooltip:AddMenu (1, ChoosePlugin, index, frame.child, frame.child.anchor, _name_and_icon [1], _name_and_icon [2], true) + GameCooltip:AddMenu (1, ChoosePlugin, {index, frame.child, frame.child.anchor}, nil, nil, _name_and_icon [1], _name_and_icon [2], true) + + local pluginMestre = _detalhes.StatusBar.Plugins [index] + + if (pluginMestre and pluginMestre.real_name == frame.child.mainPlugin.real_name) then + current = index+1 + end end - GameCooltip:SetOption ("NoLastSelectedBar", true) + + if (current) then + GameCooltip:SetLastSelected (1, current) + else + GameCooltip:SetOption ("NoLastSelectedBar", true) + end + + GameCooltip:SetOption ("HeightAnchorMod", -12) GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0, 0.64453125}, {1, 1, 1, 0.1}, true) GameCooltip:ShowCooltip (frame, "menu") @@ -330,15 +380,35 @@ end end + function _detalhes.StatusBar:UpdateOptions (instance) + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textcolor") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textsize") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "hidden") + + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textcolor") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textsize") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "hidden") + + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textcolor") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textsize") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "hidden") + end + function _detalhes.StatusBar:UpdateChilds (instance) local left = instance.StatusBarSaved.left local center = instance.StatusBarSaved.center local right = instance.StatusBarSaved.right - --print (instance.StatusBarSaved.options [left].textSize) - --print (instance.StatusBar.options [left].textSize) - local left_index = _detalhes.StatusBar:GetIndexFromAbsoluteName (left) ChoosePlugin (nil, nil, left_index, instance.StatusBar.left, "left") @@ -361,14 +431,23 @@ _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textcolor") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textsize") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.left, "hidden") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textcolor") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textsize") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.center, "hidden") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textcolor") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textsize") _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textface") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textxmod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "textymod") + _detalhes.StatusBar:ApplyOptions (instance.StatusBar.right, "hidden") end @@ -437,33 +516,70 @@ option = string.lower (option) if (option == "textxmod") then - if (value) then - child.options.textXMod = value + + if (value == nil) then + value = child.options.textXMod end + + child.options.textXMod = value _detalhes.StatusBar:ReloadAnchors (child.instance) + elseif (option == "textymod") then - if (value) then - child.options.textYMod = value + + if (value == nil) then + value = child.options.textYMod end + + child.options.textYMod = value _detalhes.StatusBar:ReloadAnchors (child.instance) + elseif (option == "textcolor") then - if (value) then - child.options.textColor = value + + if (value == nil) then + value = child.options.textColor end + + child.options.textColor = value local r, g, b, a = _detalhes.gump:ParseColors (child.options.textColor) child.text:SetTextColor (r, g, b, a) + elseif (option == "textsize") then - if (value) then - child.options.textSize = value + + if (value == nil) then + value = child.options.textSize end + + child.options.textSize = value child:SetFontSize (child.text, child.options.textSize) + elseif (option == "textface") then - if (value) then - child.options.textFace = value + + if (value == nil) then + value = child.options.textFace end + + child.options.textFace = value child:SetFontFace (child.text, SharedMedia:Fetch ("font", child.options.textFace)) + elseif (option == "hidden") then + + if (value == nil) then + value = child.options.isHidden + end + child.options.isHidden = value + + if (value) then + child.frame.text:Hide() + if (child.frame.texture) then + child.frame.texture:Hide() + end + else + child.frame.text:Show() + if (child.frame.texture) then + child.frame.texture:Show() + end + end else if (child [option] and type (child [option]) == "function") then child [option] (nil, child, value) @@ -881,7 +997,6 @@ do child.text:SetText (currentCombatTime .. "s") end end - end end @@ -947,12 +1062,13 @@ do local texture = myframe:CreateTexture (nil, "overlay") texture:SetTexture ("Interface\\AddOns\\Details\\images\\clock") texture:SetPoint ("right", myframe.text.widget, "left") + myframe.texture = texture local new_child = _detalhes.StatusBar:CreateChildTable (instance, Clock, myframe) --> default text new_child.text:SetText ("0m 0s") - + --> some changes from default options if (new_child.options.textXMod == 0) then new_child.options.textXMod = 6 @@ -1076,7 +1192,7 @@ do end function PFps:OnDisable() - self:CancelTimer (self.srt) + self:CancelTimer (self.srt, true) end function PFps:OnEnable() @@ -1115,7 +1231,7 @@ do end function PLatency:OnDisable() - self:CancelTimer (self.srt) + self:CancelTimer (self.srt, true) end function PLatency:OnEnable() @@ -1200,6 +1316,7 @@ do texture:SetWidth (10) texture:SetHeight (10) texture:SetTexCoord (0.216796875, 0.26171875, 0.0078125, 0.052734375) + myframe.texture = texture myframe.widget:SetScript ("OnEvent", function() new_child:UpdateDurability() @@ -1254,6 +1371,7 @@ do texture:SetPoint ("right", myframe.text.widget, "left") texture:SetWidth (12) texture:SetHeight (12) + myframe.texture = texture myframe.widget:RegisterEvent ("PLAYER_MONEY") myframe.widget:RegisterEvent ("PLAYER_ENTERING_WORLD") diff --git a/framework/panel.lua b/framework/panel.lua index 458ad30b..46b1a514 100644 --- a/framework/panel.lua +++ b/framework/panel.lua @@ -755,15 +755,13 @@ function gump:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ elseif (_type == "button") then --> create button - local button = gump:NewButton (row, nil, "$parentButton" .. o, "button", 60, 20) + local button = gump:NewButton (row, nil, "$parentButton" .. o, "button", panel.rows [o].width, 20) - --[ local func = function() panel.rows [o].func (button.index, o) panel:Refresh() end button:SetClickFunction (func) - --]] button:SetPoint ("left", row, "left", anchors [o], 0) @@ -801,11 +799,17 @@ function gump:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ elseif (_type == "icon") then --> create button and icon - local iconbutton = gump:NewButton (row, nil, "$parentIconButton" .. o, "iconbutton", 20, 20) - iconbutton:InstallCustomTexture() + local iconbutton = gump:NewButton (row, nil, "$parentIconButton" .. o, "iconbutton", panel.rows [o].width, 20) + + iconbutton:SetHook ("OnEnter", button_on_enter) + iconbutton:SetHook ("OnLeave", button_on_leave) + + --iconbutton:InstallCustomTexture() local icon = gump:NewImage (iconbutton, nil, 20, 20, "artwork", nil, "icon", "$parentIcon" .. o) + iconbutton._icon = icon + iconbutton:SetPoint ("left", row, "left", anchors [o], 0) - icon:SetPoint ("left", iconbutton, "left", 0, 0) + icon:SetPoint ("center", iconbutton, "center", 0, 0) --> set functions local function iconcallback (texture) diff --git a/functions/profiles.lua b/functions/profiles.lua index 9c6d785a..0f506990 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -494,6 +494,9 @@ local default_profile = { --> minimap minimap = {hide = false, radius = 160, minimapPos = 220}, + --> horcorner + hotcorner_topleft = {hide = false, topleft_quick_click = true}, + --> PvP only_pvp_frags = false, diff --git a/functions/spellcache.lua b/functions/spellcache.lua index a9ef1762..a148c7c5 100644 --- a/functions/spellcache.lua +++ b/functions/spellcache.lua @@ -39,8 +39,8 @@ do end}) --> default overwrites - _rawset (_detalhes.spellcache, 1, {Loc ["STRING_MELEE"], 1, "Interface\\AddOns\\Details\\images\\melee.tga"}) - _rawset (_detalhes.spellcache, 2, {Loc ["STRING_AUTOSHOT"], 1, "Interface\\AddOns\\Details\\images\\autoshot.tga"}) + --_rawset (_detalhes.spellcache, 1, {Loc ["STRING_MELEE"], 1, "Interface\\AddOns\\Details\\images\\melee.tga"}) + --_rawset (_detalhes.spellcache, 2, {Loc ["STRING_AUTOSHOT"], 1, "Interface\\AddOns\\Details\\images\\autoshot.tga"}) --> built-in overwrites for spellId, spellTable in pairs (_detalhes.SpellOverwrite) do @@ -54,6 +54,26 @@ do _rawset (_detalhes.spellcache, spellTable [1], {spellTable [2], 1, spellTable [3]}) end end + + local default_user_spells = { + [1] = {name = Loc ["STRING_MELEE"], icon = [[Interface\AddOns\Details\images\melee.tga]]}, + [2] = {name = Loc ["STRING_AUTOSHOT"], icon = [[Interface\AddOns\Details\images\autoshot.tga]]}, + + [124464] = {name = GetSpellInfo (124464) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> shadow word: pain mastery proc (priest) + [124465] = {name = GetSpellInfo (124465) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> vampiric touch mastery proc (priest) + [124468] = {name = GetSpellInfo (124468) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> mind flay mastery proc (priest) + + [121414] = {name = GetSpellInfo (121414) .. " (Glaive #1)"}, --> glaive toss (hunter) + [120761] = {name = GetSpellInfo (120761) .. " (Glaive #2)"}, --> glaive toss (hunter) + + [77451] = {name = GetSpellInfo (77451) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lava burst (shaman) + [45284] = {name = GetSpellInfo (45284) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lightningbolt (shaman) + [45297] = {name = GetSpellInfo (45297) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> chain lightning (shaman) + + [131079] = {name = GetSpellInfo (131079) .. " (Icy Veins)"}, --> frostbolt with icy veins glyph (mage) + [131080] = {name = GetSpellInfo (131080) .. " (Icy Veins)"}, --> ice lance with icy veins glyph (mage) + [131081] = {name = GetSpellInfo (131081) .. " (Icy Veins)"}, --> frostfire with icy veins glyph (mage) + } function _detalhes:UserCustomSpellUpdate (index, name, icon) local t = _detalhes.savedCustomSpells [index] @@ -65,29 +85,51 @@ do end end - function _detalhes:FillUserCustomSpells() - local spells = { - [124464] = {name = GetSpellInfo (124464) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> shadow word: pain mastery proc (priest) - [124465] = {name = GetSpellInfo (124465) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> vampiric touch mastery proc (priest) - [124468] = {name = GetSpellInfo (124468) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> mind flay mastery proc (priest) + function _detalhes:UserCustomSpellReset (index) + local t = _detalhes.savedCustomSpells [index] + if (t) then + local spellid = t [1] + local name, _, icon = _GetSpellInfo (spellid) - [121414] = {name = GetSpellInfo (121414) .. " (Glaive #1)"}, --> glaive toss (hunter) - [120761] = {name = GetSpellInfo (120761) .. " (Glaive #2)"}, --> glaive toss (hunter) + if (default_user_spells [spellid]) then + name = default_user_spells [spellid].name + icon = default_user_spells [spellid].icon or icon or [[Interface\InventoryItems\WoWUnknownItem01]] + end - [77451] = {name = GetSpellInfo (77451) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lava burst (shaman) - [45284] = {name = GetSpellInfo (45284) .. " (" .. Loc ["STRING_MASTERY"] .. ")"}, --> lightningbolt (shaman) + if (not name) then + name = "Unknown" + end + if (not icon) then + icon = [[Interface\InventoryItems\WoWUnknownItem01]] + end - [131079] = {name = GetSpellInfo (131079) .. " (Icy Veins)"}, --> frostbolt with icy veins glyph (mage) - [131080] = {name = GetSpellInfo (131080) .. " (Icy Veins)"}, --> ice lance with icy veins glyph (mage) - [131081] = {name = GetSpellInfo (131081) .. " (Icy Veins)"}, --> frostfire with icy veins glyph (mage) - } - - for spellid, t in pairs (spells) do - local _, _, icon = GetSpellInfo (spellid) - _detalhes:UserCustomSpellAdd (spellid, t.name, icon) + _rawset (_detalhes.spellcache, spellid, {name, 1, icon}) + + t[2] = name + t[3] = icon end end + function _detalhes:FillUserCustomSpells() + + for spellid, t in pairs (default_user_spells) do + + local already_have + for index, spelltable in ipairs (_detalhes.savedCustomSpells) do + if (spelltable [1] == spellid) then + already_have = spelltable + end + end + + if (not already_have) then + local name, _, icon = GetSpellInfo (spellid) + _detalhes:UserCustomSpellAdd (spellid, t.name or name or "Unknown", t.icon or icon or [[Interface\InventoryItems\WoWUnknownItem01]]) + end + + end + + end + function _detalhes:UserCustomSpellAdd (spellid, name, icon) local is_overwrite = false for index, t in ipairs (_detalhes.savedCustomSpells) do diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 89943539..00351630 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -1027,7 +1027,7 @@ function window:CreateFrame16() {name = "Version", width = 65, type = "entry", func = edit_version}, {name = "Enabled", width = 50, type = "button", func = edit_enabled, icon = [[Interface\COMMON\Indicator-Green]], notext = true, iconalign = "center"}, {name = "Export", width = 50, type = "button", func = export_function, icon = [[Interface\Buttons\UI-GuildButton-PublicNote-Up]], notext = true, iconalign = "center"}, - {name = "Remove", width = 70, type = "button", func = remove_capture, icon = [[Interface\COMMON\VOICECHAT-MUTED]], notext = true, iconalign = "center"}, + {name = "Remove", width = 70, type = "button", func = remove_capture, icon = [[Interface\Glues\LOGIN\Glues-CheckBox-Check]], notext = true, iconalign = "center"}, } local total_lines = function() @@ -1287,6 +1287,9 @@ function window:CreateFrame15() local remove_func = function (index) _detalhes:UserCustomSpellRemove (index) end + local reset_func = function (index) + _detalhes:UserCustomSpellReset (index) + end --> custom spells panel local header = { @@ -1294,7 +1297,8 @@ function window:CreateFrame15() {name = "Name", width = 310, type = "entry", func = name_entry_func}, {name = "Icon", width = 50, type = "icon", func = icon_func}, {name = "Spell ID", width = 100, type = "text"}, - {name = "Remove", width = 125, type = "button", func = remove_func, icon = [[Interface\COMMON\VOICECHAT-MUTED]]}, + {name = "Reset", width = 50, type = "button", func = reset_func, icon = [[Interface\Buttons\UI-RefreshButton]], notext = true, iconalign = "center"}, + {name = "Remove", width = 75, type = "button", func = remove_func, icon = [[Interface\Glues\LOGIN\Glues-CheckBox-Check]], notext = true, iconalign = "center"}, } --local header = {{name = "Index", type = "text"}, {name = "Name", type = "entry"}, {name = "Icon", type = "icon"}, {name = "Author", type = "text"}, {name = "Version", type = "text"}} @@ -2014,7 +2018,7 @@ function window:CreateFrame2() local buildSwitchMenu = function() window.lastSwitchList = {} - local t = {{value = 0, label = "NONE", onclick = onSelectAutoSwitch, icon = [[Interface\COMMON\VOICECHAT-MUTED]]}} + local t = {{value = 0, label = "NONE", onclick = onSelectAutoSwitch, icon = [[Interface\Glues\LOGIN\Glues-CheckBox-Check]]}} local attributes = _detalhes.sub_atributos local i = 1 @@ -2803,7 +2807,7 @@ function window:CreateFrame4() --icon file g:NewLabel (frame4, _, "$parentIconFileLabel", "iconFileLabel", Loc ["STRING_OPTIONS_BAR_ICONFILE"], "GameFontHighlightLeft") - g:NewTextEntry (frame4, _, "$parentIconFileEntry", "iconFileEntry", 240, 20) + g:NewTextEntry (frame4, _, "$parentIconFileEntry", "iconFileEntry", 180, 20) frame4.iconFileEntry:SetPoint ("left", frame4.iconFileLabel, "right", 2, 0) frame4.iconFileEntry.tooltip = "- Press escape to restore default value.\n- Leave empty to hide icons." @@ -2824,7 +2828,7 @@ function window:CreateFrame4() frame4.iconFileEntry.text = instance.row_info.icon_file - g:NewButton (frame4, _, "$parentNoIconButton", "noIconButton", 20, 20, function() + g:NewButton (frame4.iconFileEntry, _, "$parentNoIconButton", "noIconButton", 20, 20, function() if (frame4.iconFileEntry.text == "") then frame4.iconFileEntry.text = [[Interface\AddOns\Details\images\classes_small]] frame4.iconFileEntry:PressEnter() @@ -2833,10 +2837,15 @@ function window:CreateFrame4() frame4.iconFileEntry:PressEnter() end end) - frame4.noIconButton:SetPoint ("left", frame4.iconFileEntry, "right", 2, 1) - frame4.noIconButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]]) - frame4.noIconButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) - frame4.noIconButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]]) + + frame4.noIconButton = frame4.iconFileEntry.noIconButton + frame4.noIconButton:SetPoint ("left", frame4.iconFileEntry, "right", 2, 0) + frame4.noIconButton:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]]) + frame4.noIconButton:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) + frame4.noIconButton:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]]) + frame4.noIconButton:GetNormalTexture():SetDesaturated (true) + --frame4.noIconButton:GetHighlightTexture() + --frame4.noIconButton:GetPushedTexture() frame4.noIconButton.tooltip = "Clear icon file." --bar start at @@ -2876,8 +2885,8 @@ function window:CreateFrame4() frame4.rowBackgroundPickLabel:SetPoint (10, -365) --bar color background frame4.rowIconsLabel:SetPoint (10, -405) - frame4.iconFileLabel:SetPoint (10, -430) - frame4.barStartLabel:SetPoint (10, -455) + frame4.iconFileLabel:SetPoint (10, -455) + frame4.barStartLabel:SetPoint (10, -430) end @@ -3023,7 +3032,7 @@ function window:CreateFrame5() --text entry g:NewLabel (frame5, _, "$parentCutomRightText2Label", "cutomRightTextEntryLabel", Loc ["STRING_OPTIONS_BARRIGHTTEXTCUSTOM2"], "GameFontHighlightLeft") - g:NewTextEntry (frame5, _, "$parentCutomRightTextEntry", "cutomRightTextEntry", 240, 20) + g:NewTextEntry (frame5, _, "$parentCutomRightTextEntry", "cutomRightTextEntry", 180, 20) frame5.cutomRightTextEntry:SetPoint ("left", frame5.cutomRightTextEntryLabel, "right", 2, 0) --frame5.cutomRightTextEntry.tooltip = "type the customized text" @@ -3056,16 +3065,18 @@ function window:CreateFrame5() frame5.cutomRightTextEntry.text = instance.row_info.textR_custom_text - g:NewButton (frame5, _, "$parentResetCustomRightTextButton", "customRightTextButton", 20, 20, function() + g:NewButton (frame5.cutomRightTextEntry, _, "$parentResetCustomRightTextButton", "customRightTextButton", 20, 20, function() frame5.cutomRightTextEntry.text = _detalhes.instance_defaults.row_info.textR_custom_text frame5.cutomRightTextEntry:PressEnter() end) + frame5.customRightTextButton = frame5.cutomRightTextEntry.customRightTextButton frame5.customRightTextButton:SetPoint ("left", frame5.cutomRightTextEntry, "right", 2, 1) - frame5.customRightTextButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]]) - frame5.customRightTextButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) - frame5.customRightTextButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]]) + frame5.customRightTextButton:SetNormalTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Down]]) + frame5.customRightTextButton:SetHighlightTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) + frame5.customRightTextButton:SetPushedTexture ([[Interface\Glues\LOGIN\Glues-CheckBox-Check]] or [[Interface\Buttons\UI-GroupLoot-Pass-Up]]) + frame5.customRightTextButton:GetNormalTexture():SetDesaturated (true) frame5.customRightTextButton.tooltip = "Reset to Default" - + --> show total bar g:NewLabel (frame5, _, "$parentTotalBarLabel", "totalBarLabel", Loc ["STRING_OPTIONS_SHOW_TOTALBAR"], "GameFontHighlightLeft") diff --git a/startup.lua b/startup.lua index e4c461aa..7f94c241 100644 --- a/startup.lua +++ b/startup.lua @@ -600,8 +600,27 @@ function _G._detalhes:Start() end --register lib-hotcorners - local reset_func = function() _detalhes.tabela_historico:resetar() end - _detalhes:RegisterHotCornerButton ("TOPLEFT", "DetailsLeftCornerButton", [[Interface\AddOns\Details\images\minimap]], "|cFFFFFFFFDetails!\n|cFF00FF00Left Click:|r clear all segments.", reset_func, nil, reset_func) + local reset_func = function (frame, button) _detalhes.tabela_historico:resetar() end + + _detalhes:RegisterHotCornerButton ( + --> absolute name + "Details!", + --> corner + "TOPLEFT", + --> config table + self.hotcorner_topleft, + --> frame _G name + "DetailsLeftCornerButton", + --> icon + [[Interface\AddOns\Details\images\minimap]], + --> tooltip + "|cFFFFFFFFDetails!\n|cFF00FF00Left Click:|r clear all segments.", + --> click function + reset_func, + --> menus + nil, + --> quick click + reset_func) --> register time captures --_detalhes:LoadUserTimeCaptures()