more progress on the filter tab

This commit is contained in:
Manuel Simon Hirsig
2016-01-30 19:11:19 +01:00
parent 5fb208f5ae
commit 22e94ea73f
8 changed files with 84311 additions and 78989 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ function generate_suggestions(input)
end
end
return Aux.util.map(best, function(match) return { text=match.name, display_text='|c'..Aux_QualityColor(Aux.static.item_info(match.id).quality)..'['..match.name..']'..'|r', value=match.id } end)
return Aux.util.map(best, function(match) return { text=match.name, display_text='|c'..Aux.quality_color(Aux.static.item_info(match.id).quality)..'['..match.name..']'..'|r', value=match.id } end)
end
function public.completor(edit_box)
+26 -22
View File
@@ -7,7 +7,6 @@ Aux = {
blizzard_ui_shown = false,
loaded = false,
orig = {},
last_picked_up = {},
view = {
BUYOUT = 1,
BID = 2,
@@ -54,11 +53,11 @@ function Aux_OnLoad()
do
local tab_group = Aux.gui.tab_group(AuxFrame, 'BOTTOM')
tab_group:create_tab('Item Search')
tab_group:create_tab('Filter Search')
tab_group:create_tab('Search')
tab_group:create_tab('Post')
tab_group:create_tab('Auctions')
tab_group:create_tab('Bids')
-- tab_group:create_tab('Scan')
tab_group.on_select = Aux.on_tab_click
Aux.tab_group = tab_group
end
@@ -242,11 +241,8 @@ function Aux.AuctionFrameAuctions_OnEvent()
end
function Aux_OnAuctionHouseShow()
AuxFrame:Show()
Aux.tab_group:set_tab(1)
end
function Aux_OnAuctionHouseClosed()
@@ -254,7 +250,7 @@ function Aux_OnAuctionHouseClosed()
Aux.stack.stop()
Aux.scan.abort()
Aux.item_search_frame.on_close()
-- Aux.item_search_frame.on_close()
Aux.filter_search_frame.on_close()
Aux.post_frame.on_close()
Aux.auctions_frame.on_close()
@@ -268,14 +264,14 @@ function Aux.on_tab_click(index)
Aux.post.stop()
Aux.stack.stop()
Aux.scan.abort(function()
Aux.item_search_frame.on_close()
-- Aux.item_search_frame.on_close()
Aux.filter_search_frame.on_close()
Aux.post_frame.on_close()
Aux.auctions_frame.on_close()
Aux.bids_frame.on_close()
Aux.history_frame.on_close()
AuxItemSearchFrame:Hide()
-- AuxItemSearchFrame:Hide()
AuxFilterSearchFrame:Hide()
AuxPostFrame:Hide()
AuxAuctionsFrame:Hide()
@@ -283,20 +279,20 @@ function Aux.on_tab_click(index)
AuxHistoryFrame:Hide()
if index == 1 then
AuxItemSearchFrame:Show()
Aux.item_search_frame.on_open()
elseif index == 2 then
AuxFilterSearchFrame:Show()
Aux.filter_search_frame.on_open()
elseif index == 3 then
elseif index == 2 then
AuxPostFrame:Show()
Aux.post_frame.on_open()
elseif index == 4 then
elseif index == 3 then
AuxAuctionsFrame:Show()
Aux.auctions_frame.on_open()
elseif index == 5 then
elseif index == 4 then
AuxBidsFrame:Show()
Aux.bids_frame.on_open()
-- elseif index == 5 then
-- AuxItemSearchFrame:Show()
-- Aux.item_search_frame.on_open()
end
Aux.active_panel = index
@@ -340,16 +336,24 @@ function Aux_AuctionsButton_OnMouseDown()
end
end
function Aux.PickupContainerItem(bag, item)
Aux.last_picked_up = { bag=bag, slot=item }
return Aux.orig.PickupContainerItem(bag, item)
do
local last_picked_up
function Aux.PickupContainerItem(bag, slot)
last_picked_up = { bag, slot }
return Aux.orig.PickupContainerItem(bag, slot)
end
function Aux.cursor_item()
if last_picked_up and CursorHasItem() then
return Aux.info.container_item(unpack(last_picked_up))
end
end
end
function Aux_ContainerFrameItemButton_OnClick(button)
local bag, slot = this:GetParent():GetID(), this:GetID()
local container_item_info = Aux.info.container_item(bag, slot)
local item_info = Aux.info.container_item(bag, slot)
if AuxFrame:IsVisible() and button == "LeftButton" and container_item_info then
if AuxFrame:IsVisible() and button == "LeftButton" and item_info then
if IsAltKeyDown() then
if Aux.active_panel ~= 1 then
Aux.on_tab_click(1)
@@ -357,7 +361,7 @@ function Aux_ContainerFrameItemButton_OnClick(button)
Aux.control.as_soon_as(function() return Aux.active_panel == 1 end, function()
AuxItemSearchFrameItemItemInputBox:Hide()
Aux.item_search_frame.set_item(container_item_info.item_id)
Aux.item_search_frame.set_item(item_info.item_id)
end)
return
@@ -367,7 +371,7 @@ function Aux_ContainerFrameItemButton_OnClick(button)
return Aux.orig.ContainerFrameItemButton_OnClick(button)
end
function Aux_QualityColor(code)
function Aux.quality_color(code)
if code == 0 then
return "ff9d9d9d" -- poor, gray
elseif code == 1 then
+53 -20
View File
@@ -94,7 +94,6 @@ end
function public.on_open()
private.update_search_listings()
private.update_tab(SAVED)
AuxFilterSearchFrameResults:SetWidth(985)
AuxFrame:SetWidth(991)
@@ -117,13 +116,23 @@ function public.on_load()
private.update_search_listings()
end
end,
on_row_enter = function(sheet, row_index)
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine(gsub(sheet.rows[row_index].cells[1].text:GetText(), ';', '\n'), 255/255, 254/255, 250/255)
GameTooltip:Show()
end,
on_row_leave = function(sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
GameTooltip:ClearLines()
GameTooltip:Hide()
end,
columns = {
{
width = 900,
width = 440,
comparator = function(filter_string1, filter_string2) return Aux.util.compare(filter_string1, filter_string2, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
cell_setter = function(cell, filter_string)
cell.text:SetText(filter_string)
cell.text:SetText(Aux.test.prettify_search(filter_string))
end,
},
},
@@ -145,13 +154,23 @@ function public.on_load()
private.update_search_listings()
end
end,
on_row_enter = function(sheet, row_index)
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine(gsub(sheet.rows[row_index].cells[1].text:GetText(), ';', '\n'), 255/255, 254/255, 250/255)
GameTooltip:Show()
end,
on_row_leave = function(sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
GameTooltip:ClearLines()
GameTooltip:Hide()
end,
columns = {
{
width = 900,
width = 440,
comparator = function(filter_string1, filter_string2) return Aux.util.compare(filter_string1, filter_string2, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
cell_setter = function(cell, filter_string)
cell.text:SetText(filter_string)
cell.text:SetText(Aux.test.prettify_search(filter_string))
end,
},
},
@@ -323,24 +342,37 @@ function public.on_load()
end
do
local editbox = Aux.gui.editbox(AuxFilterSearchFrame)
editbox:EnableMouse(1)
editbox.complete = Aux.test.complete
editbox:SetPoint('TOPLEFT', 5, -6)
editbox:SetPoint('RIGHT', private.search_button, 'LEFT', -4, 0)
editbox:SetWidth(400)
editbox:SetHeight(25)
-- editbox:SetScript('OnTabPressed', function()
-- if IsShiftKeyDown() then
-- getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
-- else
-- getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
-- end
-- end)
editbox:SetScript('OnChar', function()
this:complete()
end)
editbox:SetScript('OnTabPressed', function()
this:HighlightText(0, 0)
end)
editbox:SetScript('OnEnterPressed', function()
this:HighlightText(0, 0)
this:ClearFocus()
public.start_search()
end)
editbox:SetScript('OnEscapePressed', function()
this:HighlightText(0, 0)
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
end)
editbox:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item() and Aux.static.item_info(Aux.cursor_item().item_id)
if item_info then
this:SetText(item_info.name..'/exact')
end
ClearCursor()
end)
private.search_box = editbox
end
do
@@ -349,7 +381,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', 10, -49)
btn:SetWidth(310)
btn:SetWidth(320)
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(RESULTS) end)
@@ -358,7 +390,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(310)
btn:SetWidth(320)
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(SAVED) end)
@@ -367,21 +399,21 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(310)
btn:SetWidth(320)
btn:SetHeight(22)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(FILTER) end)
private.new_filter_button = btn
end
do
local line = Aux.gui.horizontal_line(AuxFilterSearchFrameSavedRecent, -25)
local label = Aux.gui.label(AuxFilterSearchFrameSavedRecent, 13)
local line = Aux.gui.horizontal_line(AuxFilterSearchFrameSavedRecent, -30)
local label = Aux.gui.label(AuxFilterSearchFrameSavedRecent, 15)
label:SetPoint('BOTTOM', line, 'TOP', 0, 5)
label:SetText('Recent Searches')
end
do
local line = Aux.gui.horizontal_line(AuxFilterSearchFrameSavedFavorite, -25)
local label = Aux.gui.label(AuxFilterSearchFrameSavedFavorite, 13)
local line = Aux.gui.horizontal_line(AuxFilterSearchFrameSavedFavorite, -30)
local label = Aux.gui.label(AuxFilterSearchFrameSavedFavorite, 15)
label:SetPoint('BOTTOM', line, 'TOP', 0, 5)
label:SetText('Favorite Searches')
end
@@ -514,7 +546,7 @@ function public.on_load()
private.category_dropdown = dropdown
UIDropDownMenu_Initialize(dropdown, AuxFilterSearchFrameFiltersCategoryDropDown_Initialize)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, AuxFilterSearchFrameFiltersQualityDropDown_Initialize)
UIDropDownMenu_Initialize(this, AuxFilterSearchFrameFiltersCategoryDropDown_Initialize)
end)
end
do
@@ -690,6 +722,7 @@ function public.on_load()
-- text:SetFont(Aux.gui.config.content_font, 13)
-- text:SetShadowColor(0, 0, 0, 0)
-- end
private.update_tab(SAVED)
end
function public.stop_search()
+9 -9
View File
@@ -44,24 +44,24 @@
<Size><AbsDimension x="900" y="380"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="3" y="-82"/></Offset></Anchor></Anchors>
<Frames>
<Frame name="$parentRecent" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="950" y="134"/></Size>
<Frame name="$parentFavorite" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="488" y="280"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Anchors><Anchor point="TOPRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Frames>
<Frame name="$parentListing">
<Size><AbsDimension x="0" y="130"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-10" y="-20"/></Offset></Anchor></Anchors>
<Size><AbsDimension x="0" y="250"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-10" y="-25"/></Offset></Anchor></Anchors>
</Frame>
</Frames>
</Frame>
<Frame name="$parentFavorite" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="950" y="134"/></Size>
<Anchors><Anchor point="TOP" relativeTo="$parentRecent" relativePoint="BOTTOM"><Offset><AbsDimension x="0" y="-5"/></Offset></Anchor></Anchors>
<Frame name="$parentRecent" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="488" y="280"/></Size>
<Anchors><Anchor point="TOPLEFT" relativeTo="$parentFavorite" relativePoint="TOPRIGHT"><Offset><AbsDimension x="5" y="0"/></Offset></Anchor></Anchors>
<Frames>
<Frame name="$parentListing">
<Size><AbsDimension x="0" y="130"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-10" y="-20"/></Offset></Anchor></Anchors>
<Size><AbsDimension x="0" y="250"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-10" y="-25"/></Offset></Anchor></Anchors>
</Frame>
</Frames>
</Frame>
+40 -21
View File
@@ -1,27 +1,9 @@
local m = {}
Aux.groups = m
Aux.test = m
function m.parse_group(datastring)
return Aux.persistence.deserialize(datastring, ',')
end
function m.parse_item_key(item_key)
local _, _, item_id, suffix_id = strfind(item_key, '(%d+):?(%d*)')
return tonumber(item_id), suffix_id == '' and 0 or tonumber(suffix_id)
end
m.test_group = '13127;9510;4438;16254;12006;13131;13012;4413;1482'
function m.test()
local array = Aux.persistence.deserialize(';', ';')
snipe.log(getn(array))
end
function on_char()
function m.on_char()
for _, data in ipairs(TSM.db.global.savedSearches) do
if data.searchMode == "normal" then
if data.searchMode == 'normal' then
local prevSearch = strlower(data.filter)
if strsub(prevSearch, 1, textLen) == text then
self:SetText(prevSearch)
@@ -30,4 +12,41 @@ function on_char()
end
end
end
end
function m.prettify_search(search)
local item_pattern = '([^/;]+)([^;]*)/exact'
while true do
local _, _, name, in_between = strfind(search, item_pattern)
if name then
search = gsub(search, item_pattern, m.display_name(Aux.static.auctionable_items[strupper(name)])..in_between, 1)
else
return search
end
end
end
function m.display_name(item_id)
local item_info = Aux.static.item_info(item_id)
return '|c'..Aux.quality_color(item_info.quality)..'['..item_info.name..']'..'|r'
end
function m:complete()
local options = {'exact', 'even', 'discard' }
for _, class in ipairs({ GetAuctionItemClasses() }) do
tinsert(options, class)
end
local filter_string = this:GetText()
local start_index, _, current_modifier = strfind(filter_string, '([^/;]*)$')
current_modifier = current_modifier or ''
for _, option in ipairs(options) do
if strfind(strupper(option), '^'..strupper(current_modifier)) then
this:SetText(string.sub(filter_string, 1, start_index - 1)..option)
this:HighlightText(strlen(filter_string), -1)
return
end
end
end
+22 -15
View File
@@ -51,17 +51,14 @@ function m.create_item_filter(item_id)
local item_info = Aux.static.item_info(item_id)
if item_info then
local class_index = Aux.item_class_index(item_info.class)
local subclass_index = class_index and Aux.item_subclass_index(class_index, item_info.subclass)
return {
exact_only = true,
name = item_info.name,
min_level = item_info.level,
min_level = item_info.level,
slot = item_info.slot,
class = class_index,
subclass = subclass_index,
class = item_info.class,
subclass = item_info.subclass,
quality = item_info.quality,
usable = item_info.usable,
}
@@ -69,16 +66,17 @@ function m.create_item_filter(item_id)
end
function m.create_item_query(item_id)
local item_info = Aux.static.item_info(item_id)
local filter = m.create_item_filter(item_id)
return item_info and {
if filter then
return {
type = 'list',
start_page = 0,
validator = m.validator(filter),
blizzard_query = m.blizzard_query(filter),
}
}
end
end
function m.parse_filter_string(filter_string)
@@ -154,6 +152,12 @@ function m.filter_from_string(filter_term)
else
return false, 'Invalid Even Only Filter'
end
elseif strlower(str) == 'discard' then
if not filter.discard then
filter.discard = true
else
return false, 'Invalid Even Only Filter'
end
elseif Aux.money.from_string(str) > 0 then
if not filter.max_price then
filter.max_price = Aux.money.from_string(str)
@@ -171,12 +175,12 @@ function m.filter_from_string(filter_term)
if filter.min_level or filter.max_level or filter.class or filter.subclass or filter.quality or filter.usable_only then
return false, 'Invalid Exact Only Filter'
end
for id, info in pairs(Aux.static.auctionable_items) do
if info.name == filter.name then
local item_filter = m.create_item_filter(id)
item_filter.even_only = filter.even_only
return item_filter
end
local id = Aux.static.auctionable_items[strupper(filter.name)]
if id then
local item_filter = m.create_item_filter(id)
item_filter.even_only = filter.even_only
item_filter.discard = filter.discard
return item_filter
end
return false, 'Invalid Exact Only Filter'
end
@@ -188,7 +192,7 @@ function m.filter_from_string(filter_term)
return filter
end
function m.filter_to_string(filter)
function m.filter_to_string(filter) -- TODO belongs in filter search
local filter_term = filter.name or ''
@@ -238,6 +242,9 @@ end
function m.validator(filter)
return function(record)
if filter.discard then
return
end
if filter.exact_only and record.name ~= filter.name then
return
end
+7 -7
View File
@@ -148,13 +148,13 @@ function public.create(params)
sort_texture:Hide()
button.sort_texture = sort_texture
local background = content:CreateTexture(nil, 'ARTWORK')
background:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
-- background:SetTextCoord(0.2, 0.9, 0, 0.9)
background:SetPoint('TOPLEFT', button, 'BOTTOMLEFT', 0, 0)
background:SetPoint('TOPRIGHT', button, 'BOTTOMRIGHT', 0, 0)
background:SetPoint('BOTTOM', content, 'BOTTOM', 0, 0)
background:SetAlpha(0.2)
-- local background = content:CreateTexture(nil, 'ARTWORK')
-- background:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
-- -- background:SetTextCoord(0.2, 0.9, 0, 0.9)
-- background:SetPoint('TOPLEFT', button, 'BOTTOMLEFT', 0, 0)
-- background:SetPoint('TOPRIGHT', button, 'BOTTOMRIGHT', 0, 0)
-- background:SetPoint('BOTTOM', content, 'BOTTOM', 0, 0)
-- background:SetAlpha(0.2)
label:SetPoint('TOPLEFT', button, 'TOPLEFT', 0, 0)
label:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', 0, 0)
+84153 -78894
View File
File diff suppressed because it is too large Load Diff