diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 74c922bc..41f06ca7 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 52 +local dversion = 53 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 946395d0..a667a987 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -517,9 +517,15 @@ end local button_on_enter = function (self) self.MyObject._icon:SetBlendMode ("ADD") + if (self.MyObject.onenter_func) then + pcall (self.MyObject.onenter_func, self.MyObject) + end end local button_on_leave = function (self) self.MyObject._icon:SetBlendMode ("BLEND") + if (self.MyObject.onleave_func) then + pcall (self.MyObject.onleave_func, self.MyObject) + end end local add_row = function (self, t, need_update) @@ -537,6 +543,9 @@ local add_row = function (self, t, need_update) thisrow.hidden = t.hidden or false + thisrow.onenter = t.onenter + thisrow.onleave = t.onleave + local text = DF:NewLabel (thisrow, nil, self._name .. "$parentLabel" .. index, "text") text:SetPoint ("left", thisrow, "left", 2, 0) text:SetText (t.name) @@ -618,6 +627,16 @@ local align_rows = function (self) entry:SetWidth (row.width) end entry.func = row.func + + entry.onenter_func = nil + entry.onleave_func = nil + + if (row.onenter) then + entry.onenter_func = row.onenter + end + if (row.onleave) then + entry.onleave_func = row.onleave + end end elseif (type == "button") then for i = 1, #self.scrollframe.lines do @@ -652,7 +671,17 @@ local align_rows = function (self) if (row.name and not row.notext) then button._text:SetPoint ("left", button._icon, "right", 2, 0) button._text.text = row.name - end + end + + button.onenter_func = nil + button.onleave_func = nil + + if (row.onenter) then + button.onenter_func = row.onenter + end + if (row.onleave) then + button.onleave_func = row.onleave + end end elseif (type == "icon") then @@ -667,6 +696,19 @@ local align_rows = function (self) icon:SetPoint ("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) icon.func = row.func end + + elseif (type == "texture") then + for i = 1, #self.scrollframe.lines do + local line = self.scrollframe.lines [i] + local texture = tremove (line.texture_available) + if (not texture) then + self:CreateRowTexture (line) + texture = tremove (line.texture_available) + end + tinsert (line.texture_inuse, texture) + texture:SetPoint ("left", line, "left", self._anchors [#self._anchors] + ( ((row.width or 22) - 22) / 2), 0) + end + end sindex = sindex + 1 @@ -687,6 +729,7 @@ local align_rows = function (self) end local update_rows = function (self, updated_rows) + for i = 1, #updated_rows do local t = updated_rows [i] local raw = self._raw_rows [i] @@ -705,6 +748,11 @@ local update_rows = function (self, updated_rows) widget.textalign = t.textalign widget.hidden = t.hidden or false + -- + widget.onenter = t.onenter + widget.onleave = t.onleave + -- + widget.text:SetText (t.name) DF:SetFontSize (widget.text, raw.textsize or 10) widget.text:SetJustifyH (raw.textalign or "left") @@ -747,6 +795,13 @@ local update_rows = function (self, updated_rows) for i = 1, #row.icon_available do row.icon_available[i]:Hide() end + + for i = #row.texture_inuse, 1, -1 do + tinsert (row.texture_available, tremove (row.texture_inuse, i)) + end + for i = 1, #row.texture_available do + row.texture_available[i]:Hide() + end end self.current_header = updated_rows @@ -771,7 +826,18 @@ local create_panel_entry = function (self, row) editbox:ClearFocus() editbox.func (editbox.index, editbox.text) return true - end) + end) + + editbox:SetHook ("OnEnter", function() + if (editbox.onenter_func) then + pcall (editbox.onenter_func, editbox) + end + end) + editbox:SetHook ("OnLeave", function() + if (editbox.onleave_func) then + pcall (editbox.onleave_func, editbox) + end + end) editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = 1}) editbox:SetBackdropColor (1, 1, 1, 0.1) @@ -784,8 +850,6 @@ end local create_panel_button = function (self, row) row.button_total = row.button_total + 1 local button = DF:NewButton (row, nil, "$parentButton" .. row.button_total, "button" .. row.button_total, 120, 20) - --, nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") - --button:InstallCustomTexture() --> create icon and the text local icon = DF:NewImage (button, nil, 20, 20) @@ -826,6 +890,12 @@ local create_panel_icon = function (self, row) tinsert (row.icon_available, iconbutton) end +local create_panel_texture = function (self, row) + row.texture_total = row.texture_total + 1 + local texture = DF:NewImage (row, nil, 20, 20, "artwork", nil, "_icon" .. row.texture_total, "$parentIcon" .. row.texture_total) + tinsert (row.texture_available, texture) +end + local set_fill_function = function (self, func) self._fillfunc = func end @@ -872,6 +942,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro panel.CreateRowEntry = create_panel_entry panel.CreateRowButton = create_panel_button panel.CreateRowIcon = create_panel_icon + panel.CreateRowTexture = create_panel_texture panel.SetFillFunction = set_fill_function panel.SetTotalFunction = set_total_function panel.DropHeader = drop_header_function @@ -909,7 +980,7 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro if (results [1]) then row:Show() - local text, entry, button, icon = 1, 1, 1, 1 + local text, entry, button, icon, texture = 1, 1, 1, 1, 1 for index, t in ipairs (panel.rows) do if (not t.hidden) then @@ -919,25 +990,30 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro fontstring:SetText (results [index]) fontstring.index = real_index fontstring:Show() - - if (true) then - --print (t.hello) - end elseif (t.type == "entry") then local entrywidget = row.entry_inuse [entry] entry = entry + 1 - entrywidget:SetText (results [index]) entrywidget.index = real_index + + if (type (results [index]) == "table") then + entrywidget:SetText (results [index].text) + entrywidget.id = results [index].id + entrywidget.data1 = results [index].data1 + entrywidget.data2 = results [index].data2 + else + entrywidget:SetText (results [index]) + end + + entrywidget:SetCursorPosition(0) + entrywidget:Show() elseif (t.type == "button") then local buttonwidget = row.button_inuse [button] button = button + 1 buttonwidget.index = real_index - - if (type (results [index]) == "table") then if (results [index].text) then buttonwidget:SetText (results [index].text) @@ -960,6 +1036,11 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro end buttonwidget:SetClickFunction (func) end + + buttonwidget.id = results [index].id + buttonwidget.data1 = results [index].data1 + buttonwidget.data2 = results [index].data2 + else local func = function() t.func (real_index, index) @@ -987,6 +1068,22 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro end iconwidget:Show() + + elseif (t.type == "texture") then + local texturewidget = row.texture_inuse [texture] + texture = texture + 1 + + texturewidget.line = index + texturewidget.index = real_index + + if (type (results [index]) == "string") then + local result = results [index]:gsub (".-%\\", "") + texturewidget.texture = results [index] + else + texturewidget:SetTexture (results [index]) + end + + texturewidget:Show() end end end @@ -1059,6 +1156,10 @@ function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_ro row.icon_available = {} row.icon_inuse = {} row.icon_total = 0 + + row.texture_available = {} + row.texture_inuse = {} + row.texture_total = 0 end end panel:UpdateRowAmount() diff --git a/boot.lua b/boot.lua index 3030934a..fe1ee2a6 100644 --- a/boot.lua +++ b/boot.lua @@ -3,7 +3,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.build_counter = 4102 + _detalhes.build_counter = 4132 _detalhes.userversion = "v7.2.5." .. _detalhes.build_counter _detalhes.realversion = 121 --core version _detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" diff --git a/core/meta.lua b/core/meta.lua index 343dd2c3..4a0dfe02 100644 --- a/core/meta.lua +++ b/core/meta.lua @@ -731,6 +731,7 @@ end end + --desativado 7.2.5 veio com algum bug e a checagem de memoria esta sendo feita durante o combate function _detalhes:CheckMemoryAfterCombat() if (_detalhes.next_memory_check < time() and not InCombatLockdown() and not UnitAffectingCombat ("player")) then _detalhes.next_memory_check = time()+_detalhes.intervalo_memoria @@ -741,6 +742,7 @@ end end end + function _detalhes:CheckMemoryPeriodically() if (_detalhes.next_memory_check <= time() and not _InCombatLockdown() and not _detalhes.in_combat and not UnitAffectingCombat ("player")) then _detalhes.next_memory_check = time() + _detalhes.intervalo_memoria - 3 diff --git a/functions/link.lua b/functions/link.lua index 0041e954..bfdf7cf5 100644 --- a/functions/link.lua +++ b/functions/link.lua @@ -76,8 +76,7 @@ ["use_message"] = true, ["subeventPrefix"] = "SPELL", ["use_unit"] = true, - ["names"] = { - }, + ["names"] = {}, }, ["justify"] = "LEFT", ["selfPoint"] = "BOTTOM", @@ -168,8 +167,7 @@ ["subeventPrefix"] = "SPELL", ["unit"] = "player", ["debuffType"] = "HELPFUL", - ["names"] = { - }, + ["names"] = {}, ["use_addon"] = false, ["use_unit"] = true, ["subeventSuffix"] = "_CAST_SUCCESS", @@ -271,8 +269,7 @@ ["type"] = "aura", ["spellIds"] = { }, - ["names"] = { - }, + ["names"] = {}, ["debuffType"] = "HELPFUL", ["unit"] = "player", }, @@ -524,8 +521,7 @@ ["custom_hide"] = "timed", ["check"] = "update", ["subeventPrefix"] = "SPELL", - ["names"] = { - }, + ["names"] = {}, ["debuffType"] = "HELPFUL", }, ["text"] = true, @@ -631,8 +627,7 @@ ["custom_type"] = "status", ["check"] = "update", ["subeventPrefix"] = "SPELL", - ["names"] = { - }, + ["names"] = {}, ["debuffType"] = "HELPFUL", }, ["desaturate"] = false, @@ -880,9 +875,7 @@ ["name_operator"] = "==", ["fullscan"] = true, ["unit"] = "player", - ["names"] = { - "", - }, + ["names"] = {}, ["debuffType"] = "HARMFUL", }, ["untrigger"] = { @@ -1022,9 +1015,7 @@ ["name_operator"] = "==", ["fullscan"] = true, ["unit"] = "player", - ["names"] = { - "", - }, + ["names"] = {}, ["debuffType"] = "HARMFUL", }, ["text"] = true, @@ -1120,9 +1111,7 @@ ["name_operator"] = "==", ["fullscan"] = true, ["unit"] = "player", - ["names"] = { - "", - }, + ["names"] = {}, ["debuffType"] = "HARMFUL", }, ["desaturate"] = false, @@ -1183,7 +1172,7 @@ ["unit"] = "", ["spellIds"] = {}, ["debuffType"] = "HARMFUL", - ["names"] = {""}, + ["names"] = {}, }, } local buff_prototype = { @@ -1193,7 +1182,7 @@ ["unit"] = "", ["spellIds"] = {}, ["debuffType"] = "HELPFUL", - ["names"] = {""}, + ["names"] = {}, }, } local cast_prototype = { @@ -1547,12 +1536,12 @@ tinsert (new_aura.trigger.spellIds, spellid) end - --> if is a regular auras withour using spells ids + --> if is a regular auras without using spells ids if (not use_spellid) then new_aura.trigger.use_spellId = false new_aura.trigger.fullscan = false new_aura.trigger.spellId = nil - new_aura.trigger.spellIds = {} + --new_aura.trigger.spellIds = {} end --> check stack size @@ -2599,6 +2588,7 @@ f:SetFrameStrata ("HIGH") f:SetToplevel (true) f:SetMovable (true) + f.Title:SetTextColor (1, .8, .2) local have_plugins_enabled @@ -2960,11 +2950,12 @@ end, header = { {name = L["STRING_FORGE_HEADER_INDEX"], width = 40, type = "text", func = no_func}, - {name = L["STRING_FORGE_HEADER_NAME"], width = 150, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_ICON"], width = 40, type = "texture"}, + {name = L["STRING_FORGE_HEADER_NAME"], width = 150, type = "entry", func = no_func, onenter = function(self) GameTooltip:SetOwner (self.widget, "ANCHOR_TOPLEFT"); _detalhes:GameTooltipSetSpellByID (self.id); GameTooltip:Show() end, onleave = function(self) GameTooltip:Hide() end}, {name = L["STRING_FORGE_HEADER_SPELLID"], width = 60, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_SCHOOL"], width = 60, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_CASTER"], width = 80, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_EVENT"], width = 260, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_CASTER"], width = 120, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_EVENT"], width = 180, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_CREATEAURA"], width = 86, type = "button", func = spell_open_aura_creator, icon = [[Interface\AddOns\WeakAuras\Media\Textures\icon]], notext = true, iconalign = "center"}, }, fill_panel = false, @@ -2980,11 +2971,12 @@ end events = events:sub (1, #events - 3) end - local spellName = GetSpellInfo (data[1]) + local spellName, _, spellIcon = GetSpellInfo (data[1]) local classColor = RAID_CLASS_COLORS [data[2]] and RAID_CLASS_COLORS [data[2]].colorStr or "FFFFFFFF" return { index, - spellName or "", + spellIcon, + {text = spellName or "", id = data[1] or 1}, data[1] or "", _detalhes:GetSpellSchoolFormatedName (_detalhes.spell_school_cache [spellName]) or "", "|c" .. classColor .. data[2] .. "|r", @@ -3094,16 +3086,19 @@ return t end, + header = { {name = L["STRING_FORGE_HEADER_INDEX"], width = 40, type = "text", func = no_func}, - {name = L["STRING_FORGE_HEADER_NAME"], width = 150, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_SPELLID"], width = 60, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_ICON"], width = 40, type = "texture"}, + {name = L["STRING_FORGE_HEADER_NAME"], width = 151, type = "entry", func = no_func, onenter = function(self) GameTooltip:SetOwner (self.widget, "ANCHOR_TOPLEFT"); _detalhes:GameTooltipSetSpellByID (self.id); GameTooltip:Show() end, onleave = function(self) GameTooltip:Hide() end}, + {name = L["STRING_FORGE_HEADER_SPELLID"], width = 55, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_SCHOOL"], width = 60, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_CASTER"], width = 80, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_EVENT"], width = 160, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_ENCOUNTERNAME"], width = 120, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_EVENT"], width = 150, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_ENCOUNTERNAME"], width = 95, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_CREATEAURA"], width = 86, type = "button", func = spell_encounter_open_aura_creator, icon = [[Interface\AddOns\WeakAuras\Media\Textures\icon]], notext = true, iconalign = "center"}, }, + fill_panel = false, fill_gettotal = function (self) return #self.module.data end, fill_fillrows = function (index, self) @@ -3119,11 +3114,12 @@ events = events:sub (1, #events - 3) end - local spellName = GetSpellInfo (data[1]) + local spellName, _, spellIcon = GetSpellInfo (data[1]) return { index, - spellName or "", + spellIcon, + {text = spellName or "", id = data[1] or 1}, data[1] or "", _detalhes:GetSpellSchoolFormatedName (_detalhes.spell_school_cache [spellName]) or "", data[3] .. "|r", @@ -3141,7 +3137,7 @@ ----------------------------------------------- local dbm_open_aura_creator = function (row) - local data = all_modules [2].data [row] + local data = all_modules [3].data [row] local spellname, spellicon, _ if (type (data [7]) == "number") then @@ -3223,13 +3219,14 @@ end, header = { {name = L["STRING_FORGE_HEADER_INDEX"], width = 40, type = "text", func = no_func}, - {name = L["STRING_FORGE_HEADER_BARTEXT"], width = 160, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_ID"], width = 140, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_ICON"], width = 40, type = "texture"}, + {name = L["STRING_FORGE_HEADER_BARTEXT"], width = 150, type = "entry", func = no_func, onenter = function(self) GameTooltip:SetOwner (self.widget, "ANCHOR_TOPLEFT"); _detalhes:GameTooltipSetSpellByID (self.id); GameTooltip:Show() end, onleave = function(self) GameTooltip:Hide() end}, + {name = L["STRING_FORGE_HEADER_ID"], width = 130, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_SPELLID"], width = 50, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_TIMER"], width = 40, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_ENCOUNTERID"], width = 80, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_ENCOUNTERNAME"], width = 120, type = "entry", func = no_func}, - {name = L["STRING_FORGE_HEADER_CREATEAURA"], width = 120, type = "button", func = dbm_open_aura_creator, icon = [[Interface\AddOns\WeakAuras\Media\Textures\icon]], notext = true, iconalign = "center"}, + {name = L["STRING_FORGE_HEADER_ENCOUNTERNAME"], width = 110, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_CREATEAURA"], width = 80, type = "button", func = dbm_open_aura_creator, icon = [[Interface\AddOns\WeakAuras\Media\Textures\icon]], notext = true, iconalign = "center"}, }, fill_panel = false, @@ -3240,10 +3237,19 @@ local encounter_id = data.id local bossDetails, bossIndex = _detalhes:GetBossEncounterDetailsFromEncounterId (nil, data.id) local bossName = bossDetails and bossDetails.boss or "--x--x--" + + local abilityID = tonumber (data [7]) + local spellName, _, spellIcon + if (abilityID) then + if (abilityID > 0) then + spellName, _, spellIcon = GetSpellInfo (abilityID) + end + end return { index, - data[3] or "", + spellIcon, + {text = data[3] or "", id = abilityID and abilityID > 0 and abilityID or 0}, data[2] or "", data[7] or "", data[4] or "0", @@ -3262,7 +3268,7 @@ local bw_open_aura_creator = function (row) - local data = all_modules [3].data [row] + local data = all_modules [4].data [row] local spellname, spellicon, _ local spellid = tonumber (data [2]) @@ -3347,7 +3353,8 @@ end, header = { {name = L["STRING_FORGE_HEADER_INDEX"], width = 40, type = "text", func = no_func}, - {name = L["STRING_FORGE_HEADER_BARTEXT"], width = 160, type = "entry", func = no_func}, + {name = L["STRING_FORGE_HEADER_ICON"], width = 40, type = "texture"}, + {name = L["STRING_FORGE_HEADER_BARTEXT"], width = 200, type = "entry", func = no_func, onenter = function(self) GameTooltip:SetOwner (self.widget, "ANCHOR_TOPLEFT"); _detalhes:GameTooltipSetSpellByID (self.id); GameTooltip:Show() end, onleave = function(self) GameTooltip:Hide() end}, {name = L["STRING_FORGE_HEADER_SPELLID"], width = 50, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_TIMER"], width = 40, type = "entry", func = no_func}, {name = L["STRING_FORGE_HEADER_ENCOUNTERID"], width = 80, type = "entry", func = no_func}, @@ -3363,9 +3370,18 @@ local bossDetails, bossIndex = _detalhes:GetBossEncounterDetailsFromEncounterId (nil, data.id) local bossName = bossDetails and bossDetails.boss or "--x--x--" + local abilityID = tonumber (data[2]) + local spellName, _, spellIcon + if (abilityID) then + if (abilityID > 0) then + spellName, _, spellIcon = GetSpellInfo (abilityID) + end + end + return { index, - data[3] or "", + spellIcon, + {text = data[3] or "", id = abilityID and abilityID > 0 and abilityID or 0}, data[2] or "", data[4] or "", tostring (encounter_id) or "0", @@ -3409,7 +3425,7 @@ local background = fillpanel:CreateTexture (nil, "background") background:SetAllPoints() - background:SetColorTexture (0, 0, 0, 0.6) + background:SetColorTexture (0, 0, 0, 0.8) module.fill_panel = fillpanel end diff --git a/startup.lua b/startup.lua index 0b4647cc..4af90a47 100644 --- a/startup.lua +++ b/startup.lua @@ -222,7 +222,10 @@ function _G._detalhes:Start() self.intervalo_memoria = 180 --self.intervalo_memoria = 20 self.garbagecollect = self:ScheduleRepeatingTimer ("IniciarColetaDeLixo", self.intervalo_coleta) - self.memorycleanup = self:ScheduleRepeatingTimer ("CheckMemoryPeriodically", self.intervalo_memoria) + + --desativado, algo bugou no 7.2.5 + --self.memorycleanup = self:ScheduleRepeatingTimer ("CheckMemoryPeriodically", self.intervalo_memoria) + self.next_memory_check = time()+self.intervalo_memoria --> role