some minor search mode behavior changes

This commit is contained in:
Manuel Simon Hirsig
2016-07-29 02:01:35 +02:00
parent 31be7a7c94
commit 6e48220ebc
5 changed files with 35 additions and 39 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ Furthermore
#### New Filter #### New Filter
![Alt text](http://i.imgur.com/YSQbSC1.png) ![Alt text](http://i.imgur.com/YSQbSC1.png)
While it is faster to type filters directly into the search box this subtab serves as a tutorial to learn how to formulate queries. While it is faster to type filters directly into the search box this sub-tab serves as a tutorial to learn how to formulate queries.
The filters on the left side are Blizzard filters which may reduce the number of pages to be scanned and those on the right side are post filters which do not affect the scan time but can be combined with logical operators to formulate very complex filters. The filters on the left side are Blizzard filters which may reduce the number of pages to be scanned and those on the right side are post filters which do not affect the scan time but can be combined with logical operators to formulate very complex filters.
### Post ### Post
![Alt text](http://i.imgur.com/eydxjoH.png) ![Alt text](http://i.imgur.com/eydxjoH.png)
+1 -1
View File
@@ -39,7 +39,7 @@ do
end end
function public.on_load() function public.on_load()
public.version = '3.4.0' public.version = '3.4.1'
public.blizzard_ui_shown = false public.blizzard_ui_shown = false
public.bids_loaded = false public.bids_loaded = false
public.current_owner_page = nil public.current_owner_page = nil
+29 -18
View File
@@ -269,7 +269,7 @@ function private.start_real_time_scan(query, search, continuation)
m.search_scan_id = Aux.scan.start{ m.search_scan_id = Aux.scan.start{
type = 'list', type = 'list',
queries = {query}, queries = {query},
auto_buy_validator = m.auto_buy_filter_button:GetChecked() and aux_auto_buy_filter and m.auto_buy_validator, -- some redundancy but why not to be save auto_buy_validator = search.auto_buy_validator,
on_scan_start = function() on_scan_start = function()
m.status_bar:update_status(99.99, 99.99) m.status_bar:update_status(99.99, 99.99)
m.status_bar:set_text('Scanning last page ...') m.status_bar:set_text('Scanning last page ...')
@@ -282,7 +282,7 @@ function private.start_real_time_scan(query, search, continuation)
end, end,
on_auction = function(auction_record, ctrl) on_auction = function(auction_record, ctrl)
if not ignore_page then if not ignore_page then
if m.auto_buy_button:GetChecked() then if search.auto_buy then
ctrl.suspend() ctrl.suspend()
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, function() ctrl.resume(true) end) Aux.place_bid('list', auction_record.index, auction_record.buyout_price, function() ctrl.resume(true) end)
else else
@@ -349,7 +349,7 @@ function private.start_search(queries, continuation)
m.search_scan_id = Aux.scan.start{ m.search_scan_id = Aux.scan.start{
type = 'list', type = 'list',
queries = queries, queries = queries,
auto_buy_validator = m.auto_buy_validator, auto_buy_validator = search.auto_buy_validator,
on_scan_start = function() on_scan_start = function()
m.status_bar:update_status(0,0) m.status_bar:update_status(0,0)
if continuation then if continuation then
@@ -374,7 +374,7 @@ function private.start_search(queries, continuation)
current_page = current_page and 0 or start_page - 1 current_page = current_page and 0 or start_page - 1
end, end,
on_auction = function(auction_record, ctrl) on_auction = function(auction_record, ctrl)
if m.auto_buy_button:GetChecked() then if search.auto_buy then
ctrl.suspend() ctrl.suspend()
Aux.place_bid('list', auction_record.index, auction_record.buyout_price, function() ctrl.resume(true) end) Aux.place_bid('list', auction_record.index, auction_record.buyout_price, function() ctrl.resume(true) end)
elseif getn(search.records) < 1000 then elseif getn(search.records) < 1000 then
@@ -413,7 +413,10 @@ function private.start_search(queries, continuation)
end end
function public.execute(resume, real_time) function public.execute(resume, real_time)
if real_time == nil then
if resume then
real_time = m.current_search().real_time
elseif real_time == nil then
real_time = m.real_time_button:GetChecked() real_time = m.real_time_button:GetChecked()
end end
@@ -435,19 +438,22 @@ function public.execute(resume, real_time)
end end
end end
if filter_string ~= m.current_search().filter_string then m.search_box:HighlightText(0, 0)
m.search_box:ClearFocus()
if resume then
m.results_listing:SetSelectedRecord()
elseif filter_string ~= m.current_search().filter_string then
m.new_search(filter_string, Aux.util.join(Aux.util.map(queries, function(filter) return filter.prettified end), ';')) m.new_search(filter_string, Aux.util.join(Aux.util.map(queries, function(filter) return filter.prettified end), ';'))
else else
m.search_box:ClearFocus() if m.current_search().real_time ~= real_time then
if resume then m.results_listing:Reset()
m.results_listing:SetSelectedRecord()
else
if m.current_search().real_time ~= real_time then
m.results_listing:Reset()
end
m.current_search().records = {}
m.results_listing:SetDatabase(m.current_search().records)
end end
m.current_search().records = {}
m.current_search().real_time = m.real_time_button:GetChecked()
m.current_search().auto_buy = m.auto_buy_button:GetChecked()
m.current_search().auto_buy_validator = m.auto_buy_filter_button:GetChecked() and m.auto_buy_validator -- some redundancy but why not to be save
m.results_listing:SetDatabase(m.current_search().records)
end end
local continuation = resume and m.current_search().continuation local continuation = resume and m.current_search().continuation
@@ -456,7 +462,6 @@ function public.execute(resume, real_time)
m.close_settings() m.close_settings()
m.update_tab(m.RESULTS) m.update_tab(m.RESULTS)
m.current_search().real_time = real_time
if real_time then if real_time then
m.start_real_time_scan(queries[1], nil, continuation) m.start_real_time_scan(queries[1], nil, continuation)
else else
@@ -574,7 +579,7 @@ do
end end
function private.update_continuation() function private.update_continuation()
if m.current_search().continuation and m.current_search().real_time == m.real_time_button:GetChecked() then if m.current_search().continuation then
m.resume_button:Show() m.resume_button:Show()
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0) m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
else else
@@ -596,7 +601,6 @@ do
function private.update_search() function private.update_search()
Aux.scan.abort(m.search_scan_id) Aux.scan.abort(m.search_scan_id)
m.search_box:ClearFocus()
m.search_box:SetText(searches[search_index].filter_string) m.search_box:SetText(searches[search_index].filter_string)
m.results_listing:Reset() m.results_listing:Reset()
m.results_listing:SetDatabase(searches[search_index].records) m.results_listing:SetDatabase(searches[search_index].records)
@@ -628,6 +632,9 @@ do
tinsert(searches, search_index + 1, { tinsert(searches, search_index + 1, {
filter_string = filter_string, filter_string = filter_string,
records = {}, records = {},
real_time = m.real_time_button:GetChecked(),
auto_buy = m.auto_buy_button:GetChecked(),
auto_buy_validator = m.auto_buy_filter_button:GetChecked() and m.auto_buy_validator, -- some redundancy but why not to be save
}) })
while getn(searches) > search_index + 1 do while getn(searches) > search_index + 1 do
tremove(searches) tremove(searches)
@@ -640,12 +647,16 @@ do
end end
function private.previous_search() function private.previous_search()
m.search_box:HighlightText(0, 0)
m.search_box:ClearFocus()
search_index = search_index - 1 search_index = search_index - 1
m.update_search() m.update_search()
m.update_tab(m.RESULTS) m.update_tab(m.RESULTS)
end end
function private.next_search() function private.next_search()
m.search_box:HighlightText(0, 0)
m.search_box:ClearFocus()
search_index = search_index + 1 search_index = search_index + 1
m.update_search() m.update_search()
m.update_tab(m.RESULTS) m.update_tab(m.RESULTS)
+1 -7
View File
@@ -32,7 +32,6 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.settings:Hide() m.settings:Hide()
m.controls:Show() m.controls:Show()
else else
Aux.scan.abort(m.search_scan_id)
m.settings:Show() m.settings:Show()
m.controls:Hide() m.controls:Hide()
end end
@@ -129,7 +128,6 @@ Aux.search_tab.FRAMES(function(m, public, private)
m.first_page_input:GetScript('OnTextChanged')() m.first_page_input:GetScript('OnTextChanged')()
this = m.last_page_input this = m.last_page_input
m.last_page_input:GetScript('OnTextChanged')() m.last_page_input:GetScript('OnTextChanged')()
m.update_continuation()
end) end)
public.real_time_button = btn public.real_time_button = btn
end end
@@ -245,11 +243,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
editbox:SetScript('OnTabPressed', function() editbox:SetScript('OnTabPressed', function()
this:HighlightText(0, 0) this:HighlightText(0, 0)
end) end)
editbox:SetScript('OnEnterPressed', function() editbox:SetScript('OnEnterPressed', m.execute)
this:HighlightText(0, 0)
this:ClearFocus()
m.execute()
end)
editbox:SetScript('OnReceiveDrag', function() editbox:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id) local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
if item_info then if item_info then
+2 -11
View File
@@ -285,10 +285,6 @@ function public.auctionable(tooltip, quality, lootable)
end end
function public.tooltip(setter) function public.tooltip(setter)
for i = 1, TOOLTIP_LENGTH do
getglobal('AuxTooltipTextLeft'..i):SetText()
getglobal('AuxTooltipTextRight'..i):SetText()
end
AuxTooltip:SetOwner(UIParent, 'ANCHOR_NONE') AuxTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
AuxTooltip.money = 0 AuxTooltip.money = 0
@@ -298,10 +294,10 @@ function public.tooltip(setter)
local tooltip = { money=AuxTooltip.money } local tooltip = { money=AuxTooltip.money }
for i = 1, TOOLTIP_LENGTH do for i = 1, TOOLTIP_LENGTH do
local left_text = getglobal('AuxTooltipTextLeft'..i):GetText() local left_text = getglobal('AuxTooltipTextLeft'..i):GetText() or ''
local left_color = { getglobal('AuxTooltipTextLeft'..i):GetTextColor() } local left_color = { getglobal('AuxTooltipTextLeft'..i):GetTextColor() }
local right_text = getglobal('AuxTooltipTextRight'..i):GetText() local right_text = getglobal('AuxTooltipTextRight'..i):IsVisible() and getglobal('AuxTooltipTextRight'..i):GetText() or '' -- the right text is only hidden, not cleared
local right_color = { getglobal('AuxTooltipTextRight'..i):GetTextColor() } local right_color = { getglobal('AuxTooltipTextRight'..i):GetTextColor() }
if left_text or right_text then if left_text or right_text then
@@ -314,11 +310,6 @@ function public.tooltip(setter)
end end
end end
for i = 1, TOOLTIP_LENGTH do
getglobal('AuxTooltipTextLeft'..i):SetText()
getglobal('AuxTooltipTextRight'..i):SetText()
end
return tooltip return tooltip
end end