From d3a0425beb8d57348e6a25e60ea6a844ac0b1233 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 2 Feb 2016 23:27:08 +0100 Subject: [PATCH] less cumbersome multi tooltip filter, added tooltips to search --- auction_listing.lua | 29 +++++++++++++---------------- core.lua | 2 +- info.lua | 4 ++-- scan_util.lua | 15 +++++---------- util.lua | 4 ++++ 5 files changed, 25 insertions(+), 29 deletions(-) diff --git a/auction_listing.lua b/auction_listing.lua index 43dd1b5..7e5d7a6 100644 --- a/auction_listing.lua +++ b/auction_listing.lua @@ -82,22 +82,19 @@ local methods = { rt:SetSort((descending and -1 or 1) * this.columnIndex) end, --- OnIconEnter = function() --- local rt = this:GetParent().row.rt --- local rowData = this:GetParent().row.data --- if rowData and rowData.record then --- GameTooltip:SetOwner(this, "ANCHOR_RIGHT") --- TSMAPI.Util:SafeTooltipLink(rowData.record.rawItemLink) --- GameTooltip:Show() --- rt.isShowingItemTooltip = true --- end --- end, --- --- OnIconLeave = function() --- GameTooltip:ClearLines() --- GameTooltip:Hide() --- this:GetParent().row.rt.isShowingItemTooltip = nil --- end, + OnIconEnter = function() + local rt = this:GetParent().row.rt + local rowData = this:GetParent().row.data + if rowData and rowData.record then + Aux.info.set_tooltip(rowData.record.itemstring, rowData.record.EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0) + rt.isShowingItemTooltip = true + end + end, + + OnIconLeave = function() + AuxTooltip:Hide() + this:GetParent().row.rt.isShowingItemTooltip = nil + end, -- OnIconClick = function(self, ...) -- if IsModifiedClick() then diff --git a/core.lua b/core.lua index b0ef0fa..0358759 100644 --- a/core.lua +++ b/core.lua @@ -141,7 +141,7 @@ do end function Aux.log(msg) - DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0) + DEFAULT_CHAT_FRAME:AddMessage('[aux] '..msg, 1, 1, 0) end function Aux.setup_hooks() diff --git a/info.lua b/info.lua index 0b03d5a..fa299e0 100644 --- a/info.lua +++ b/info.lua @@ -152,8 +152,8 @@ function public.set_tooltip(itemstring, EnhTooltip_info, owner, anchor, x_offset else private.anchor_cursor = false end - GameTooltip_SetDefaultAnchor(AuxTooltip, UIParent) --- AuxTooltip:SetOwner(owner, anchor) +-- GameTooltip_SetDefaultAnchor(AuxTooltip, UIParent) + AuxTooltip:SetOwner(owner, anchor) AuxTooltip:SetHyperlink(itemstring) diff --git a/scan_util.lua b/scan_util.lua index 743b858..8e31f04 100644 --- a/scan_util.lua +++ b/scan_util.lua @@ -96,9 +96,6 @@ function m.filter_from_string(filter_term) filter.tooltip = filter.tooltip or {} tinsert(filter.tooltip, str) tooltip_counter = tooltip_counter == 0 and tooltip_counter + 1 or tooltip_counter - for j=i,getn(parts) do - tinsert(filter.tooltip, parts[j]) - end if strupper(str) == 'AND' or strupper(str) == 'OR' then tooltip_counter = tooltip_counter + 1 elseif not (strupper(str) == 'NOT' or strupper(str) == 'TT' or str == '') then @@ -291,25 +288,23 @@ function m.validator(filter) then return end - - local TRUE, FALSE = 1, 0 if filter.tooltip then local stack = {} for i=getn(filter.tooltip),1,-1 do local op = strupper(filter.tooltip[i]) if op == 'AND' then - tinsert(stack, tremove(stack) * tremove(stack)) + tinsert(stack, tremove(stack) and tremove(stack)) elseif op == 'OR' then - tinsert(stack, max(1, tremove(stack) + tremove(stack))) + tinsert(stack, tremove(stack) or tremove(stack)) elseif op == 'NOT' then - tinsert(stack, mod(tremove(stack), 2)) + tinsert(stack, not tremove(stack)) elseif op ~= 'TT' then tinsert(stack, Aux.util.any(record.tooltip, function(entry) return strfind(strupper(entry[1].text or ''), strupper(op), 1, true) or strfind(strupper(entry[2].text or ''), strupper(op), 1, true) - end) and TRUE or FALSE) + end) and true or false) end end - return Aux.util.all(stack, function(x) return x == TRUE end) + return Aux.util.all(stack, Aux.util.id) end return true end diff --git a/util.lua b/util.lua index 217e8c9..818b2e8 100644 --- a/util.lua +++ b/util.lua @@ -6,6 +6,10 @@ local merge, copy_array function Aux.util.pass() end +function public.id(object) + return object +end + function public.wipe(table) while getn(table) > 0 do tremove(table)