search interface upgrade, search history
This commit is contained in:
+2
-3
@@ -655,7 +655,7 @@ local methods = {
|
||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||
elseif Aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
Aux.tab_group:set_tab(1)
|
||||
Aux.search_frame.start_search(strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
Aux.search_frame.execute('search', strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
else
|
||||
local selection = this.rt:GetSelection()
|
||||
if not selection or selection.record ~= this.row.data.record then
|
||||
@@ -854,9 +854,8 @@ local methods = {
|
||||
-- General Results Table Methods
|
||||
-- ============================================================================
|
||||
|
||||
Clear = function(rt)
|
||||
Reset = function(rt)
|
||||
Aux.util.wipe(rt.expanded)
|
||||
Aux.util.wipe(rt.records)
|
||||
rt:UpdateRowInfo()
|
||||
rt:UpdateRows()
|
||||
rt:SetSelectedRecord()
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
function Aux.auctions_frame.create_frames(private, public)
|
||||
private.listing = Aux.auction_listing.CreateAuctionResultsTable(AuxAuctionsFrameListing, Aux.auction_listing.auctions_config)
|
||||
private.listing:Show()
|
||||
private.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
private.listing:Clear()
|
||||
private.listing:Reset()
|
||||
private.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and private.listing:GetSelection().record == cell.row.data.record and private.cancel_button:IsEnabled() then
|
||||
private.cancel_button:Click()
|
||||
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
function Aux.bids_frame.create_frames(private, public)
|
||||
private.listing = Aux.auction_listing.CreateAuctionResultsTable(AuxBidsFrameListing, Aux.auction_listing.bids_config)
|
||||
private.listing:Show()
|
||||
private.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
private.listing:Clear()
|
||||
private.listing:Reset()
|
||||
private.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and private.listing:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and private.buyout_button:IsEnabled() then
|
||||
|
||||
@@ -344,7 +344,7 @@ function Aux.SetItemRef(...)
|
||||
local item_info = Aux.info.item(tonumber(({strfind(itemstring, '^item:(%d+)')})[3]))
|
||||
if item_info then
|
||||
Aux.search_frame.set_filter(item_info.name..'/exact')
|
||||
Aux.search_frame.start_search()
|
||||
Aux.search_frame.execute('search')
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -361,7 +361,7 @@ function Aux.UseContainerItem(...)
|
||||
local item_info = Aux.info.container_item(bag, slot)
|
||||
item_info = item_info and Aux.info.item(item_info.item_id)
|
||||
if item_info then
|
||||
Aux.search_frame.start_search(strlower(item_info.name)..'/exact')
|
||||
Aux.search_frame.execute('search', strlower(item_info.name)..'/exact')
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ function Aux.post_frame.create_frames(private, public)
|
||||
private.set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
Aux.tab_group:set_tab(1)
|
||||
Aux.search_frame.start_search(strlower(Aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
Aux.search_frame.execute('search', strlower(Aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
end
|
||||
end,
|
||||
function()
|
||||
|
||||
+51
-55
@@ -207,30 +207,17 @@ function public.on_load()
|
||||
private.update_tab(private.SAVED)
|
||||
end
|
||||
|
||||
function private.stop_search()
|
||||
Aux.scan.abort(search_scan_id)
|
||||
end
|
||||
|
||||
function private.discard_search_continuation()
|
||||
private:current_search().continuation = nil
|
||||
private.resume_button:Hide()
|
||||
private.search_button:Show()
|
||||
end
|
||||
|
||||
function public.start_search(filter_string, resume)
|
||||
if resume and not private:current_search().continuation then
|
||||
return
|
||||
end
|
||||
|
||||
local queries = private:current_search().continuation
|
||||
Aux.scan.abort(search_scan_id)
|
||||
private.discard_search_continuation()
|
||||
|
||||
function public.execute(mode, filter_string)
|
||||
if filter_string then
|
||||
private.search_box:SetText(filter_string)
|
||||
end
|
||||
|
||||
if not resume then
|
||||
local queries
|
||||
if mode == 'search' or mode == 'refresh' then
|
||||
if mode == 'refresh' then
|
||||
private.search_box:SetText(private.current_search().filter_string)
|
||||
end
|
||||
|
||||
local filters = Aux.scan_util.parse_filter_string(private.search_box:GetText())
|
||||
if not filters then
|
||||
return
|
||||
@@ -243,37 +230,40 @@ function public.start_search(filter_string, resume)
|
||||
}
|
||||
end)
|
||||
|
||||
tinsert(aux_recent_searches, 1, {
|
||||
filter_string = private.search_box:GetText(),
|
||||
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
|
||||
})
|
||||
while getn(aux_recent_searches) > 50 do
|
||||
tremove(aux_recent_searches)
|
||||
if mode == 'search' then
|
||||
tinsert(aux_recent_searches, 1, {
|
||||
filter_string = private.search_box:GetText(),
|
||||
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
|
||||
})
|
||||
while getn(aux_recent_searches) > 50 do
|
||||
tremove(aux_recent_searches)
|
||||
end
|
||||
private.update_search_listings()
|
||||
private.new_search()
|
||||
end
|
||||
private.update_search_listings()
|
||||
elseif mode == 'resume' then
|
||||
queries = private.current_search().continuation
|
||||
Aux.scan.abort(search_scan_id)
|
||||
private.current_search().continuation = nil
|
||||
private.resume_button:Disable()
|
||||
private.results_listing:SetSelectedRecord()
|
||||
end
|
||||
|
||||
private.update_tab(private.RESULTS)
|
||||
private.stop_button:Show()
|
||||
private.resume_button:Hide()
|
||||
private.search_button:Hide()
|
||||
|
||||
if resume then
|
||||
private.results_listing:SetSelectedRecord(nil)
|
||||
else
|
||||
private.new_search()
|
||||
end
|
||||
|
||||
local search = private.current_search()
|
||||
local current_query, current_page
|
||||
search_scan_id = Aux.scan.start{
|
||||
type = 'list',
|
||||
queries = queries,
|
||||
on_scan_start = function()
|
||||
private.status_bar:update_status(0,0)
|
||||
if resume then
|
||||
private.status_bar:set_text('Resuming scan...')
|
||||
else
|
||||
if mode == 'search' then
|
||||
private.status_bar:set_text('Scanning auctions...')
|
||||
elseif mode == 'refresh' then
|
||||
private.status_bar:set_text('Rescanning auctions...')
|
||||
elseif mode == 'resume' then
|
||||
private.status_bar:set_text('Resuming scan...')
|
||||
end
|
||||
end,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
@@ -288,9 +278,9 @@ function public.start_search(filter_string, resume)
|
||||
current_query = query_index
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
if getn(private:current_search().records) < 1000 then
|
||||
tinsert(private:current_search().records, auction_record)
|
||||
if getn(private:current_search().records) == 1000 then
|
||||
if getn(search.records) < 1000 then
|
||||
tinsert(search.records, auction_record)
|
||||
if getn(search.records) == 1000 then
|
||||
StaticPopup_Show('AUX_SEARCH_TABLE_FULL')
|
||||
end
|
||||
end
|
||||
@@ -299,10 +289,7 @@ function public.start_search(filter_string, resume)
|
||||
private.status_bar:update_status(100, 100)
|
||||
private.status_bar:set_text('Done Scanning')
|
||||
|
||||
private.stop_button:Hide()
|
||||
private.search_button:Show()
|
||||
|
||||
if getn(private:current_search().records) == 0 and AuxSearchFrameResults:IsVisible() then
|
||||
if private.current_search() == search and AuxSearchFrameResults:IsVisible() and getn(search.records) == 0 then
|
||||
private.update_tab(private.SAVED)
|
||||
end
|
||||
end,
|
||||
@@ -310,19 +297,16 @@ function public.start_search(filter_string, resume)
|
||||
private.status_bar:update_status(100, 100)
|
||||
private.status_bar:set_text('Done Scanning')
|
||||
|
||||
private.stop_button:Hide()
|
||||
if not resume then
|
||||
private.search_button:Hide()
|
||||
end
|
||||
private.resume_button:Show()
|
||||
|
||||
for i=1,(current_query or 1)-1 do
|
||||
tremove(queries, 1)
|
||||
end
|
||||
if queries[1].blizzard_query then
|
||||
queries[1].blizzard_query.first_page = (current_page and (queries[1].blizzard_query.first_page or 0) + current_page or queries[1].blizzard_query.first_page)
|
||||
end
|
||||
private:current_search().continuation = queries
|
||||
search.continuation = queries
|
||||
if private.current_search() == search then
|
||||
private.resume_button:Enable()
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -432,7 +416,9 @@ do
|
||||
end
|
||||
|
||||
function private.update_search()
|
||||
Aux.scan.abort(search_scan_id)
|
||||
private.search_box:SetText(searches[search_index].filter_string)
|
||||
private.results_listing:Reset()
|
||||
private.results_listing:SetDatabase(searches[search_index].records)
|
||||
if search_index == 1 or search_index == 0 then
|
||||
private.previous_button:Disable()
|
||||
@@ -440,9 +426,19 @@ do
|
||||
private.previous_button:Enable()
|
||||
end
|
||||
if search_index == getn(searches) or search_index == 0 then
|
||||
private.next_button:Disable()
|
||||
private.next_button:Hide()
|
||||
private.search_box:SetPoint('LEFT', private.previous_button, 'RIGHT', 4, 0)
|
||||
else
|
||||
private.next_button:Enable()
|
||||
private.next_button:Show()
|
||||
private.search_box:SetPoint('LEFT', private.next_button, 'RIGHT', 4, 0)
|
||||
end
|
||||
if search_index > 0 then
|
||||
private.refresh_button:Enable()
|
||||
end
|
||||
if searches[search_index].continuation then
|
||||
private.resume_button:Enable()
|
||||
else
|
||||
private.resume_button:Disable()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+37
-59
@@ -1,50 +1,7 @@
|
||||
function Aux.search_frame.create_frames(private, public)
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 22)
|
||||
btn:SetPoint('TOPRIGHT', -75, -8)
|
||||
btn:SetWidth(60)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Search')
|
||||
btn:SetScript('OnClick', public.start_search)
|
||||
private.search_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 22)
|
||||
btn:SetPoint('TOPRIGHT', -75, -8)
|
||||
btn:SetWidth(60)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Cont.')
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
private.search_box:ClearFocus()
|
||||
if arg1 == 'RightButton' then
|
||||
private.discard_search_continuation()
|
||||
else
|
||||
public.start_search(nil, true)
|
||||
end
|
||||
end)
|
||||
btn:Hide()
|
||||
private.resume_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 22)
|
||||
btn:SetPoint('TOPRIGHT', -75, -8)
|
||||
btn:SetWidth(60)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Stop')
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
private.stop_search()
|
||||
if arg1 == 'RightButton' then
|
||||
private.discard_search_continuation()
|
||||
end
|
||||
end)
|
||||
btn:Hide()
|
||||
private.stop_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 26)
|
||||
btn:SetPoint('TOPRIGHT', -40, -8)
|
||||
btn:SetPoint('TOPLEFT', 5, -8)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('<')
|
||||
@@ -53,21 +10,43 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 26)
|
||||
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||
btn:SetPoint('LEFT', private.previous_button, 'RIGHT', 4, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('>')
|
||||
btn:SetScript('OnClick', private.next_search)
|
||||
private.next_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 22)
|
||||
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||
btn:SetWidth(69)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Resume')
|
||||
btn:SetScript('OnClick', function()
|
||||
private.search_box:ClearFocus()
|
||||
public.execute('resume')
|
||||
end)
|
||||
private.resume_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSearchFrame, 22)
|
||||
btn:SetPoint('RIGHT', private.resume_button, 'LEFT', -4, 0)
|
||||
btn:SetWidth(72)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
public.execute('refresh')
|
||||
end)
|
||||
btn:Disable()
|
||||
private.refresh_button = btn
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxSearchFrame)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = Aux.completion.complete
|
||||
editbox:SetPoint('TOPLEFT', 5, -8)
|
||||
editbox:SetPoint('RIGHT', private.search_button, 'LEFT', -4, 0)
|
||||
editbox:SetWidth(400)
|
||||
editbox:SetPoint('RIGHT', private.refresh_button, 'LEFT', -4, 0)
|
||||
editbox:SetHeight(25)
|
||||
editbox:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
@@ -78,12 +57,12 @@ function Aux.search_frame.create_frames(private, public)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:HighlightText(0, 0)
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
editbox:SetScript('OnReceiveDrag', function()
|
||||
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
|
||||
if item_info then
|
||||
public.start_search(strlower(item_info.name)..'/exact')
|
||||
public.execute('search', strlower(item_info.name)..'/exact')
|
||||
end
|
||||
ClearCursor()
|
||||
end)
|
||||
@@ -184,7 +163,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
private.search_box:SetText('')
|
||||
private.add_filter()
|
||||
private.clear_form()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
|
||||
local btn2 = Aux.gui.button(AuxSearchFrameFilter, 16)
|
||||
@@ -226,7 +205,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
@@ -257,7 +236,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
@@ -278,7 +257,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
@@ -365,7 +344,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
@@ -387,7 +366,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
@@ -583,9 +562,8 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end
|
||||
|
||||
private.results_listing = Aux.auction_listing.CreateAuctionResultsTable(AuxSearchFrameResults, Aux.auction_listing.search_config)
|
||||
private.results_listing:Show()
|
||||
private.results_listing:SetSort(1,2,3,4,5,6,7,8,9)
|
||||
private.results_listing:Clear()
|
||||
private.results_listing:Reset()
|
||||
private.results_listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and private.results_listing:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and private.buyout_button:IsEnabled() then
|
||||
@@ -628,7 +606,7 @@ function Aux.search_frame.create_frames(private, public)
|
||||
end
|
||||
elseif button == 'LeftButton' then
|
||||
private.search_box:SetText(data.search.filter_string)
|
||||
public.start_search()
|
||||
public.execute('search')
|
||||
elseif button == 'RightButton' then
|
||||
if st == private.recent_searches_listing then
|
||||
tinsert(aux_favorite_searches, 1, data.search)
|
||||
|
||||
Reference in New Issue
Block a user