refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-07-15 20:40:27 +02:00
parent a9290f2885
commit 54eb2a67ef
15 changed files with 724 additions and 725 deletions
+176 -171
View File
@@ -1,10 +1,11 @@
local private, public = {}, {}
Aux.search_frame = public
local m, private, public = Aux.tab(1, 'search_frame')
aux_favorite_searches = {}
aux_recent_searches = {}
private.search_scan_id = 0
private.snipe_auto = nil
private.snipe = nil
private.popup_info = {
rename = {}
@@ -12,8 +13,8 @@ private.popup_info = {
do
local function action()
private.popup_info.rename.name = getglobal(this:GetParent():GetName()..'EditBox'):GetText()
private.update_search_listings()
m.popup_info.rename.name = getglobal(this:GetParent():GetName()..'EditBox'):GetText()
m.update_search_listings()
end
StaticPopupDialogs['AUX_SEARCH_SAVED_RENAME'] = {
@@ -22,7 +23,7 @@ do
button2 = 'Cancel',
hasEditBox = 1,
OnShow = function()
local rename_info = private.popup_info.rename
local rename_info = m.popup_info.rename
local edit_box = getglobal(this:GetName()..'EditBox')
edit_box:SetText(rename_info.name or '')
edit_box:SetFocus()
@@ -52,9 +53,9 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_SNIPING'] = {
button1 = 'Yes',
button2 = 'No',
OnAccept = function()
private.snipe_button.auto = true
m.snipe_button.auto = true
local color = RED_FONT_COLOR
private.snipe_button:GetFontString():SetTextColor(color.r, color.g, color.b)
m.snipe_button:GetFontString():SetTextColor(color.r, color.g, color.b)
end,
timeout = 0,
hideOnEscape = 1,
@@ -63,11 +64,30 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_SNIPING'] = {
private.RESULTS, private.SAVED, private.FILTER = 1, 2, 3
private.elements = {
[private.RESULTS] = {},
[private.SAVED] = {},
[private.FILTER] = {},
[m.RESULTS] = {},
[m.SAVED] = {},
[m.FILTER] = {},
}
function public.FRAMES(f)
private.create_frames = f
end
function public.LOAD()
m.create_frames(m, private, public)
m:disable_sniping()
m.update_search()
m.update_tab(m.SAVED)
end
function public.OPEN()
m.update_search_listings()
end
function public.CLOSE()
m.results_listing:SetSelectedRecord()
end
function private.update_search_listings()
local favorite_search_rows = {}
for i, favorite_search in ipairs(aux_favorite_searches) do
@@ -79,7 +99,7 @@ function private.update_search_listings()
name = name,
})
end
private.favorite_searches_listing:SetData(favorite_search_rows)
m.favorite_searches_listing:SetData(favorite_search_rows)
local recent_search_rows = {}
for i, recent_search in ipairs(aux_recent_searches) do
@@ -91,41 +111,41 @@ function private.update_search_listings()
name = name,
})
end
private.recent_searches_listing:SetData(recent_search_rows)
m.recent_searches_listing:SetData(recent_search_rows)
end
function private.update_tab(tab)
private.search_results_button:UnlockHighlight()
private.saved_searches_button:UnlockHighlight()
private.new_filter_button:UnlockHighlight()
m.search_results_button:UnlockHighlight()
m.saved_searches_button:UnlockHighlight()
m.new_filter_button:UnlockHighlight()
AuxSearchFrameResults:Hide()
AuxSearchFrameSaved:Hide()
AuxSearchFrameFilter:Hide()
if tab == private.RESULTS then
if tab == m.RESULTS then
AuxSearchFrameResults:Show()
private.search_results_button:LockHighlight()
elseif tab == private.SAVED then
m.search_results_button:LockHighlight()
elseif tab == m.SAVED then
AuxSearchFrameSaved:Show()
private.saved_searches_button:LockHighlight()
elseif tab == private.FILTER then
m.saved_searches_button:LockHighlight()
elseif tab == m.FILTER then
AuxSearchFrameFilter:Show()
private.new_filter_button:LockHighlight()
m.new_filter_button:LockHighlight()
end
end
function public.set_filter(filter_string)
private.search_box:SetText(filter_string)
m.search_box:SetText(filter_string)
end
function private.add_filter(filter_string, replace)
filter_string = filter_string or private.get_form_filter()
filter_string = filter_string or m.get_form_filter()
local old_filter_string
if not replace then
old_filter_string = private.search_box:GetText()
old_filter_string = m.search_box:GetText()
old_filter_string = Aux.util.trim(old_filter_string)
if strlen(old_filter_string) > 0 then
@@ -133,7 +153,7 @@ function private.add_filter(filter_string, replace)
end
end
private.search_box:SetText((old_filter_string or '')..filter_string)
m.search_box:SetText((old_filter_string or '')..filter_string)
end
function private.clear_form()
@@ -142,12 +162,12 @@ function private.clear_form()
AuxSearchFrameFilterMinLevel:SetText('')
AuxSearchFrameFilterMaxLevel:SetText('')
AuxSearchFrameFilterUsableCheckButton:SetChecked(nil)
UIDropDownMenu_ClearAll(private.class_dropdown)
UIDropDownMenu_ClearAll(private.subclass_dropdown)
UIDropDownMenu_ClearAll(private.slot_dropdown)
UIDropDownMenu_ClearAll(private.quality_dropdown)
private.first_page_editbox:SetText('')
private.last_page_editbox:SetText('')
UIDropDownMenu_ClearAll(m.class_dropdown)
UIDropDownMenu_ClearAll(m.subclass_dropdown)
UIDropDownMenu_ClearAll(m.slot_dropdown)
UIDropDownMenu_ClearAll(m.quality_dropdown)
m.first_page_editbox:SetText('')
m.last_page_editbox:SetText('')
end
function private.get_form_filter()
@@ -175,27 +195,27 @@ function private.get_form_filter()
add('usable')
end
local class = UIDropDownMenu_GetSelectedValue(private.class_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(private.class_dropdown)
local class = UIDropDownMenu_GetSelectedValue(m.class_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(m.class_dropdown)
if class then
local classes = { GetAuctionItemClasses() }
add(strlower(classes[class]))
local subclass = UIDropDownMenu_GetSelectedValue(private.subclass_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(private.subclass_dropdown)
local subclass = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
if subclass then
local subclasses = {GetAuctionItemSubClasses(class)}
add(strlower(subclasses[subclass]))
local slot = UIDropDownMenu_GetSelectedValue(private.slot_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(private.slot_dropdown)
local slot = UIDropDownMenu_GetSelectedValue(m.slot_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
if slot then
add(strlower(getglobal(slot)))
end
end
end
local quality = UIDropDownMenu_GetSelectedValue(private.quality_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(private.quality_dropdown)
local quality = UIDropDownMenu_GetSelectedValue(m.quality_dropdown) ~= 0 and UIDropDownMenu_GetSelectedValue(m.quality_dropdown)
if quality then
add(strlower(getglobal('ITEM_QUALITY'..quality..'_DESC')))
end
local first_page, last_page = tonumber(private.first_page_editbox:GetText()), tonumber(private.last_page_editbox:GetText())
local first_page, last_page = tonumber(m.first_page_editbox:GetText()), tonumber(m.last_page_editbox:GetText())
first_page = first_page and max(1, first_page)
last_page = last_page and max(1, last_page)
if first_page or last_page then
@@ -205,55 +225,40 @@ function private.get_form_filter()
return filter_term
end
function public.on_open()
private.update_search_listings()
end
function public.on_close()
private.results_listing:SetSelectedRecord()
end
function public.on_load()
public.create_frames(private, public)
public:disable_sniping()
private.update_search()
private.update_tab(private.SAVED)
end
function private.discard_continuation()
Aux.scan.abort(private.search_scan_id)
private.current_search().continuation = nil
private.update_resume()
Aux.scan.abort(m.search_scan_id)
m.current_search().continuation = nil
m.update_resume()
end
function private:enable_stop()
Aux.scan.abort(private.search_scan_id)
private.stop_button:Show()
private.start_button:Hide()
Aux.scan.abort(m.search_scan_id)
m.stop_button:Show()
m.start_button:Hide()
end
function private:enable_start()
private.start_button:Show()
private.stop_button:Hide()
m.start_button:Show()
m.stop_button:Hide()
end
function public.enable_sniping()
Aux.scan.abort(private.search_scan_id)
private.snipe = true
private.snipe_button:LockHighlight()
Aux.scan.abort(m.search_scan_id)
m.snipe = true
m.snipe_button:LockHighlight()
end
function public.disable_sniping()
Aux.scan.abort(private.search_scan_id)
private.snipe = false
private.snipe_button:UnlockHighlight()
Aux.scan.abort(m.search_scan_id)
m.snipe = false
m.snipe_button:UnlockHighlight()
end
function private.start_sniping(query, search)
local ignore_page
if not search then
search = private.current_search()
search = m.current_search()
query.blizzard_query.first_page = 0
query.blizzard_query.last_page = 0
ignore_page = true
@@ -265,12 +270,12 @@ function private.start_sniping(query, search)
end
local next_page
private.search_scan_id = Aux.scan.start{
m.search_scan_id = Aux.scan.start{
type = 'list',
queries = {query},
on_scan_start = function()
private.status_bar:update_status(99.99, 99.99)
private.status_bar:set_text('Sniping ...')
m.status_bar:update_status(99.99, 99.99)
m.status_bar:set_text('Sniping ...')
end,
on_page_loaded = function(_, _, last_page)
next_page = last_page
@@ -280,7 +285,7 @@ function private.start_sniping(query, search)
end,
on_auction = function(auction_record)
if not ignore_page then
if private.snipe_button.auto then
if m.snipe_button.auto then
PlaceAuctionBid('list', auction_record.index, auction_record.buyout_price)
else
sniping_map[auction_record.sniping_signature] = auction_record
@@ -295,23 +300,23 @@ function private.start_sniping(query, search)
for _, record in sniping_map do
tinsert(search.records, record)
end
private.results_listing:SetDatabase(search.records)
m.results_listing:SetDatabase(search.records)
end
query.blizzard_query.first_page = next_page
query.blizzard_query.last_page = next_page
private.start_sniping(query, search)
m.start_sniping(query, search)
end,
on_abort = function()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Sniping')
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Done Sniping')
search.continuation = true
if private.current_search() == search then
private.update_resume()
if m.current_search() == search then
m.update_resume()
end
private:enable_start()
m:enable_start()
end,
}
end
@@ -327,21 +332,21 @@ function private.start_search(queries, continuation)
tremove(queries, 1)
end
queries[1].blizzard_query.first_page = (queries[1].blizzard_query.first_page or 0) + start_page - 1
private.results_listing:SetSelectedRecord()
m.results_listing:SetSelectedRecord()
else
start_query, start_page = 1, 1
end
local search = private.current_search()
private.search_scan_id = Aux.scan.start{
local search = m.current_search()
m.search_scan_id = Aux.scan.start{
type = 'list',
queries = queries,
on_scan_start = function()
private.status_bar:update_status(0,0)
m.status_bar:update_status(0,0)
if resume then
private.status_bar:set_text('Resuming scan...')
m.status_bar:set_text('Resuming scan...')
else
private.status_bar:set_text('Scanning auctions...')
m.status_bar:set_text('Scanning auctions...')
end
end,
on_page_loaded = function(_, total_scan_pages)
@@ -349,11 +354,11 @@ function private.start_search(queries, continuation)
total_scan_pages = total_scan_pages + (start_page - 1)
total_scan_pages = max(total_scan_pages, 1)
current_page = min(current_page, total_scan_pages)
private.status_bar:update_status(100 * (current_query - 1) / getn(queries), 100 * (current_page - 1) / total_scan_pages)
private.status_bar:set_text(format('Scanning %d / %d (Page %d / %d)', current_query, total_queries, current_page, total_scan_pages))
m.status_bar:update_status(100 * (current_query - 1) / getn(queries), 100 * (current_page - 1) / total_scan_pages)
m.status_bar:set_text(format('Scanning %d / %d (Page %d / %d)', current_query, total_queries, current_page, total_scan_pages))
end,
on_page_scanned = function()
private.results_listing:SetDatabase()
m.results_listing:SetDatabase()
end,
on_start_query = function(query)
current_query = current_query and current_query + 1 or start_query
@@ -368,43 +373,43 @@ function private.start_search(queries, continuation)
end
end,
on_complete = function()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Done Scanning')
if private.current_search() == search and AuxSearchFrameResults:IsVisible() and getn(search.records) == 0 then
private.update_tab(private.SAVED)
if m.current_search() == search and AuxSearchFrameResults:IsVisible() and getn(search.records) == 0 then
m.update_tab(m.SAVED)
end
private:enable_start()
m.enable_start()
end,
on_abort = function()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
m.status_bar:update_status(100, 100)
m.status_bar:set_text('Done Scanning')
if current_query then
search.continuation = {current_query, current_page + 1}
else
search.continuation = {start_query, start_page}
end
if private.current_search() == search then
private.update_resume()
if m.current_search() == search then
m.update_resume()
end
private:enable_start()
m.enable_start()
end,
}
end
function public.execute(resume)
if resume then
private.search_box:SetText(private.current_search().filter_string)
m.search_box:SetText(m.current_search().filter_string)
end
local filter_string = private.search_box:GetText()
local filter_string = m.search_box:GetText()
local queries = Aux.scan_util.parse_filter_string(filter_string)
if not queries then
return
elseif private.snipe then
elseif m.snipe then
if getn(queries) > 1 then
Aux.log('Invalid filter: The sniping mode does not support multiple queries')
return
@@ -414,32 +419,32 @@ function public.execute(resume)
end
end
if filter_string ~= private.current_search().filter_string then
private.new_search(filter_string, Aux.util.join(Aux.util.map(queries, function(filter) return filter.prettified end), ';'))
if 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), ';'))
else
private.search_box:ClearFocus()
m.search_box:ClearFocus()
if resume then
private.results_listing:SetSelectedRecord()
m.results_listing:SetSelectedRecord()
else
if private.current_search().snipe ~= private.snipe then
private.results_listing:Reset()
if m.current_search().snipe ~= m.snipe then
m.results_listing:Reset()
end
private.current_search().records = {}
private.results_listing:SetDatabase(private.current_search().records)
m.current_search().records = {}
m.results_listing:SetDatabase(m.current_search().records)
end
end
local continuation = private.current_search().continuation
private.discard_continuation()
private:enable_stop()
local continuation = m.current_search().continuation
m.discard_continuation()
m:enable_stop()
private.update_tab(private.RESULTS)
if private.snipe then
private.current_search().snipe = true
private.start_sniping(queries[1])
m.update_tab(m.RESULTS)
if m.snipe then
m.current_search().snipe = true
m.start_sniping(queries[1])
else
private.current_search().snipe = false
private.start_search(queries, resume and continuation)
m.current_search().snipe = false
m.start_search(queries, resume and continuation)
end
end
@@ -452,7 +457,7 @@ end
function private.record_remover(record)
return function()
private.results_listing:RemoveAuctionRecord(record)
m.results_listing:RemoveAuctionRecord(record)
end
end
@@ -467,7 +472,7 @@ do
local found_index
function private.find_auction(record)
if not private.results_listing:ContainsRecord(record) or Aux.is_player(record.owner) then
if not m.results_listing:ContainsRecord(record) or Aux.is_player(record.owner) then
return
end
@@ -475,37 +480,37 @@ do
state = SEARCHING
scan_id = Aux.scan_util.find(
record,
private.status_bar,
m.status_bar,
function()
state = IDLE
end,
function()
state = IDLE
private.record_remover(record)()
m.record_remover(record)()
end,
function(index)
state = FOUND
found_index = index
if not record.high_bidder then
private.bid_button:SetScript('OnClick', function()
if private.test(record)(index) and private.results_listing:ContainsRecord(record) then
m.bid_button:SetScript('OnClick', function()
if m.test(record)(index) and m.results_listing:ContainsRecord(record) then
Aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
Aux.info.bid_update(record)
private.results_listing:SetDatabase()
end or private.record_remover(record))
m.results_listing:SetDatabase()
end or m.record_remover(record))
end
end)
private.bid_button:Enable()
m.bid_button:Enable()
end
if record.buyout_price > 0 then
private.buyout_button:SetScript('OnClick', function()
if private.test(record)(index) and private.results_listing:ContainsRecord(record) then
Aux.place_bid('list', index, record.buyout_price, private.record_remover(record))
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and m.results_listing:ContainsRecord(record) then
Aux.place_bid('list', index, record.buyout_price, m.record_remover(record))
end
end)
private.buyout_button:Enable()
m.buyout_button:Enable()
end
end
)
@@ -513,22 +518,22 @@ do
function public.on_update()
if state == IDLE or state == SEARCHING then
private.buyout_button:Disable()
private.bid_button:Disable()
m.buyout_button:Disable()
m.bid_button:Disable()
end
if state == SEARCHING then
return
end
local selection = private.results_listing:GetSelection()
local selection = m.results_listing:GetSelection()
if not selection then
state = IDLE
elseif selection and state == IDLE then
private.find_auction(selection.record)
elseif state == FOUND and not private.test(selection.record)(found_index) then
private.buyout_button:Disable()
private.bid_button:Disable()
m.find_auction(selection.record)
elseif state == FOUND and not m.test(selection.record)(found_index) then
m.buyout_button:Disable()
m.bid_button:Disable()
if not Aux.bid_in_progress() then
state = IDLE
end
@@ -537,12 +542,12 @@ do
end
function private.update_resume()
if private.current_search().continuation and private.current_search().snipe == private.snipe then
private.resume_button:Show()
private.search_box:SetPoint('RIGHT', private.resume_button, 'LEFT', -4, 0)
if m.current_search().continuation and m.current_search().snipe == m.snipe then
m.resume_button:Show()
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
else
private.resume_button:Hide()
private.search_box:SetPoint('RIGHT', private.start_button, 'LEFT', -4, 0)
m.resume_button:Hide()
m.search_box:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
end
end
@@ -558,24 +563,24 @@ do
end
function private.update_search()
Aux.scan.abort(private.search_scan_id)
private.search_box:ClearFocus()
private.search_box:SetText(searches[search_index].filter_string)
private.results_listing:Reset()
private.results_listing:SetDatabase(searches[search_index].records)
Aux.scan.abort(m.search_scan_id)
m.search_box:ClearFocus()
m.search_box:SetText(searches[search_index].filter_string)
m.results_listing:Reset()
m.results_listing:SetDatabase(searches[search_index].records)
if search_index == 1 or search_index == 0 then
private.previous_button:Disable()
m.previous_button:Disable()
else
private.previous_button:Enable()
m.previous_button:Enable()
end
if search_index == getn(searches) or search_index == 0 then
private.next_button:Hide()
private.search_box:SetPoint('LEFT', private.previous_button, 'RIGHT', 4, 0)
m.next_button:Hide()
m.search_box:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
else
private.next_button:Show()
private.search_box:SetPoint('LEFT', private.next_button, 'RIGHT', 4, 0)
m.next_button:Show()
m.search_box:SetPoint('LEFT', m.next_button, 'RIGHT', 4, 0)
end
private.update_resume()
m.update_resume()
end
function private.new_search(filter_string, prettified)
@@ -586,7 +591,7 @@ do
while getn(aux_recent_searches) > 50 do
tremove(aux_recent_searches)
end
private.update_search_listings()
m.update_search_listings()
tinsert(searches, search_index + 1, {
filter_string = filter_string,
@@ -599,29 +604,29 @@ do
tremove(searches, 1)
end
search_index = getn(searches)
private.update_search()
m.update_search()
end
function private.previous_search()
search_index = search_index - 1
private.update_search()
private.update_tab(private.RESULTS)
m.update_search()
m.update_tab(m.RESULTS)
end
function private.next_search()
search_index = search_index + 1
private.update_search()
private.update_tab(private.RESULTS)
m.update_search()
m.update_tab(m.RESULTS)
end
end
function private.initialize_class_dropdown()
local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(private.class_dropdown) then
UIDropDownMenu_ClearAll(private.subclass_dropdown)
UIDropDownMenu_ClearAll(private.slot_dropdown)
if this.value ~= UIDropDownMenu_GetSelectedValue(m.class_dropdown) then
UIDropDownMenu_ClearAll(m.subclass_dropdown)
UIDropDownMenu_ClearAll(m.slot_dropdown)
end
UIDropDownMenu_SetSelectedValue(private.class_dropdown, this.value)
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
end
UIDropDownMenu_AddButton{
@@ -642,13 +647,13 @@ end
function private.initialize_subclass_dropdown()
local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(private.subclass_dropdown) then
UIDropDownMenu_ClearAll(private.slot_dropdown)
if this.value ~= UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) then
UIDropDownMenu_ClearAll(m.slot_dropdown)
end
UIDropDownMenu_SetSelectedValue(private.subclass_dropdown, this.value)
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
end
local class_index = UIDropDownMenu_GetSelectedValue(private.class_dropdown)
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
if class_index and GetAuctionItemSubClasses(class_index) then
UIDropDownMenu_AddButton{
@@ -670,11 +675,11 @@ end
function private.initialize_slot_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(private.slot_dropdown, this.value)
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value)
end
local class_index = UIDropDownMenu_GetSelectedValue(private.class_dropdown)
local subclass_index = UIDropDownMenu_GetSelectedValue(private.subclass_dropdown)
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
if class_index and subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
UIDropDownMenu_AddButton{
@@ -697,7 +702,7 @@ end
function private.initialize_quality_dropdown()
local function on_click()
UIDropDownMenu_SetSelectedValue(private.quality_dropdown, this.value)
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value)
end
UIDropDownMenu_AddButton{
+145 -145
View File
@@ -1,4 +1,4 @@
function Aux.search_frame.create_frames(private, public)
Aux.search_frame.FRAMES(function(m, private, public)
do
local btn = Aux.gui.button(AuxSearchFrame, 22)
btn:SetPoint('TOPLEFT', 5, -8)
@@ -8,12 +8,12 @@ function Aux.search_frame.create_frames(private, public)
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
btn:SetScript('OnClick', function()
if arg1 == 'LeftButton' then
if private.snipe then
public.disable_sniping()
if m.snipe then
m.disable_sniping()
else
public.enable_sniping()
m.enable_sniping()
end
private.update_resume()
m.update_resume()
elseif arg1 == 'RightButton' then
if this.auto then
this.auto = false
@@ -29,20 +29,20 @@ function Aux.search_frame.create_frames(private, public)
Aux.gui.vertical_line(AuxSearchFrame, 80, nil, 408)
do
local btn = Aux.gui.button(AuxSearchFrame, 26)
btn:SetPoint('LEFT', private.snipe_button, 'RIGHT', 12, 0)
btn:SetPoint('LEFT', m.snipe_button, 'RIGHT', 12, 0)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText('<')
btn:SetScript('OnClick', private.previous_search)
btn:SetScript('OnClick', m.previous_search)
private.previous_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 26)
btn:SetPoint('LEFT', private.previous_button, 'RIGHT', 4, 0)
btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText('>')
btn:SetScript('OnClick', private.next_search)
btn:SetScript('OnClick', m.next_search)
private.next_button = btn
end
do
@@ -54,9 +54,9 @@ function Aux.search_frame.create_frames(private, public)
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
btn:SetScript('OnClick', function()
if arg1 == 'RightButton' then
public.set_filter(private.current_search().filter_string)
m.set_filter(m.current_search().filter_string)
end
public.execute()
m.execute()
end)
private.start_button = btn
end
@@ -67,19 +67,19 @@ function Aux.search_frame.create_frames(private, public)
btn:SetHeight(25)
btn:SetText('Stop')
btn:SetScript('OnClick', function()
Aux.scan.abort(private.search_scan_id)
Aux.scan.abort(m.search_scan_id)
end)
btn:Hide()
private.stop_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 22)
btn:SetPoint('RIGHT', private.start_button, 'LEFT', -4, 0)
btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
btn:SetWidth(70)
btn:SetHeight(25)
btn:SetText(GREEN_FONT_COLOR_CODE..'Resume'..FONT_COLOR_CODE_CLOSE)
btn:SetScript('OnClick', function()
public.execute(true)
m.execute(true)
end)
private.resume_button = btn
end
@@ -88,7 +88,7 @@ function Aux.search_frame.create_frames(private, public)
editbox:SetMaxLetters(nil)
editbox:EnableMouse(1)
editbox.complete = Aux.completion.complete
editbox:SetPoint('RIGHT', private.start_button, 'LEFT', -4, 0)
editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
editbox:SetHeight(25)
editbox:SetScript('OnChar', function()
this:complete()
@@ -99,14 +99,14 @@ function Aux.search_frame.create_frames(private, public)
editbox:SetScript('OnEnterPressed', function()
this:HighlightText(0, 0)
this:ClearFocus()
public.execute()
m.execute()
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.set_filter(strlower(item_info.name)..'/exact')
public.disable_sniping()
public.execute()
m.set_filter(strlower(item_info.name)..'/exact')
m.disable_sniping()
m.execute()
end
ClearCursor()
end)
@@ -121,25 +121,25 @@ function Aux.search_frame.create_frames(private, public)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(private.RESULTS) end)
btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end)
private.search_results_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(private.SAVED) end)
btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end)
private.saved_searches_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(private.FILTER) end)
btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end)
private.new_filter_button = btn
end
do
@@ -153,7 +153,7 @@ function Aux.search_frame.create_frames(private, public)
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
@@ -162,7 +162,7 @@ function Aux.search_frame.create_frames(private, public)
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.bid_button, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
@@ -171,43 +171,43 @@ function Aux.search_frame.create_frames(private, public)
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Clear')
btn:SetScript('OnClick', function()
while tremove(private:current_search().records) do end
private.results_listing:SetDatabase()
while tremove(m.current_search().records) do end
m.results_listing:SetDatabase()
end)
end
do
local btn = Aux.gui.button(AuxSearchFrameSaved, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Favorite')
btn:SetScript('OnClick', function()
local filters = Aux.scan_util.parse_filter_string(private.search_box:GetText())
local filters = Aux.scan_util.parse_filter_string(m.search_box:GetText())
if filters then
tinsert(aux_favorite_searches, 1, {
filter_string = private.search_box:GetText(),
filter_string = m.search_box:GetText(),
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
})
end
private.update_search_listings()
m.update_search_listings()
end)
end
do
local btn1 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn1:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn1:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
btn1:SetWidth(80)
btn1:SetHeight(24)
btn1:SetText('Search')
btn1:SetScript('OnClick', function()
private.search_box:SetText('')
private.add_filter()
private.clear_form()
public.execute()
m.search_box:SetText('')
m.add_filter()
m.clear_form()
m.execute()
end)
local btn2 = Aux.gui.button(AuxSearchFrameFilter, 16)
@@ -216,8 +216,8 @@ function Aux.search_frame.create_frames(private, public)
btn2:SetHeight(24)
btn2:SetText('Add')
btn2:SetScript('OnClick', function()
private.add_filter()
private.clear_form()
m.add_filter()
m.clear_form()
end)
local btn3 = Aux.gui.button(AuxSearchFrameFilter, 16)
@@ -226,8 +226,8 @@ function Aux.search_frame.create_frames(private, public)
btn3:SetHeight(24)
btn3:SetText('Replace')
btn3:SetScript('OnClick', function()
private.add_filter(nil, true)
private.clear_form()
m.add_filter(nil, true)
m.clear_form()
end)
end
do
@@ -242,14 +242,14 @@ function Aux.search_frame.create_frames(private, public)
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.last_page_editbox:SetFocus()
m.last_page_editbox:SetFocus()
else
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.execute()
m.execute()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
@@ -280,7 +280,7 @@ function Aux.search_frame.create_frames(private, public)
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.execute()
m.execute()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
@@ -296,12 +296,12 @@ function Aux.search_frame.create_frames(private, public)
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
else
private.first_page_editbox:SetFocus()
m.first_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.execute()
m.execute()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
@@ -315,7 +315,7 @@ function Aux.search_frame.create_frames(private, public)
local label = Aux.gui.label(AuxSearchFrameFilterUsableCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterUsableCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Usable')
private.show_hidden_checkbox = checkbox
private.usable_checkbox = checkbox
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
@@ -325,57 +325,57 @@ function Aux.search_frame.create_frames(private, public)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, private.initialize_class_dropdown)
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_class_dropdown)
UIDropDownMenu_Initialize(this, m.initialize_class_dropdown)
end)
private.class_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
dropdown:SetPoint('TOPLEFT', private.class_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, private.initialize_subclass_dropdown)
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_subclass_dropdown)
UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown)
end)
private.subclass_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
dropdown:SetPoint('TOPLEFT', private.subclass_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, private.initialize_slot_dropdown)
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_slot_dropdown)
UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown)
end)
private.slot_dropdown = dropdown
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
dropdown:SetPoint('TOPLEFT', private.slot_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -18)
dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Min Rarity')
UIDropDownMenu_Initialize(dropdown, private.initialize_quality_dropdown)
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_quality_dropdown)
UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown)
end)
private.quality_dropdown = dropdown
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox:SetPoint('TOPLEFT', private.quality_dropdown, 'BOTTOMLEFT', 0, -18)
editbox:SetPoint('TOPLEFT', m.quality_dropdown, 'BOTTOMLEFT', 0, -18)
editbox:SetWidth(145)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
@@ -383,12 +383,12 @@ function Aux.search_frame.create_frames(private, public)
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
private.last_page_editbox:SetFocus()
m.last_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.execute()
m.execute()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
@@ -397,20 +397,20 @@ function Aux.search_frame.create_frames(private, public)
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox:SetPoint('TOPLEFT', private.first_page_editbox, 'TOPRIGHT', 10, 0)
editbox:SetPoint('TOPLEFT', m.first_page_editbox, 'TOPRIGHT', 10, 0)
editbox:SetWidth(145)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.first_page_editbox:SetFocus()
m.first_page_editbox:SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.execute()
m.execute()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
@@ -424,14 +424,14 @@ function Aux.search_frame.create_frames(private, public)
label:SetText('Usable')
end
local function add_modifier(...)
local current_filter_string = private.search_box:GetText()
local current_filter_string = m.search_box:GetText()
for i=1,arg.n do
if current_filter_string ~= '' and strsub(current_filter_string, -1) ~= '/' then
current_filter_string = current_filter_string..'/'
end
current_filter_string = current_filter_string..arg[i]
end
private.search_box:SetText(current_filter_string)
m.search_box:SetText(current_filter_string)
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
@@ -446,7 +446,7 @@ function Aux.search_frame.create_frames(private, public)
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.and_operator_button, 'RIGHT', 10, 0)
btn:SetPoint('LEFT', m.and_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('or')
@@ -457,7 +457,7 @@ function Aux.search_frame.create_frames(private, public)
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.or_operator_button, 'RIGHT', 10, 0)
btn:SetPoint('LEFT', m.or_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('not')
@@ -469,105 +469,105 @@ function Aux.search_frame.create_frames(private, public)
private.modifier_buttons = {}
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.and_operator_button, 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['min-unit-bid'] = btn
btn:SetPoint('TOPLEFT', m.and_operator_button, 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['min-unit-bid'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['min-unit-bid'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['min-unit-buy'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['min-unit-bid'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['min-unit-buy'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['min-unit-buy'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['max-unit-bid'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['min-unit-buy'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['max-unit-bid'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['max-unit-bid'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['max-unit-buy'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['max-unit-bid'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['max-unit-buy'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['max-unit-buy'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['bid-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['max-unit-buy'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['bid-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['bid-profit'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['buy-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['bid-profit'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['buy-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['buy-profit'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['bid-vend-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['buy-profit'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['bid-vend-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['bid-vend-profit'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['buy-vend-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['bid-vend-profit'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['buy-vend-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['buy-vend-profit'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['bid-dis-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['buy-vend-profit'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['bid-dis-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['bid-dis-profit'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['buy-dis-profit'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['bid-dis-profit'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['buy-dis-profit'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.and_operator_button, 'BOTTOMLEFT', 205, -10)
private.modifier_buttons['bid-pct'] = btn
btn:SetPoint('TOPLEFT', m.and_operator_button, 'BOTTOMLEFT', 205, -10)
m.modifier_buttons['bid-pct'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['bid-pct'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['buy-pct'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['bid-pct'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['buy-pct'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['buy-pct'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['item'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['buy-pct'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['item'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['item'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['tooltip'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['item'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['tooltip'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['tooltip'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['min-lvl'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['tooltip'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['min-lvl'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['min-lvl'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['max-lvl'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['min-lvl'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['max-lvl'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['max-lvl'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['rarity'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['max-lvl'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['rarity'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['rarity'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['left'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['rarity'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['left'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['left'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['utilizable'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['left'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['utilizable'] = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['utilizable'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['discard'] = btn
btn:SetPoint('TOPLEFT', m.modifier_buttons['utilizable'], 'BOTTOMLEFT', 0, -10)
m.modifier_buttons['discard'] = btn
end
for modifier_name, btn in private.modifier_buttons do
for modifier_name, btn in m.modifier_buttons do
local modifier_name = modifier_name
local btn = btn
@@ -606,58 +606,58 @@ 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:SetSort(1,2,3,4,5,6,7,8,9)
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
private.buyout_button:Click()
elseif button == 'RightButton' and private.bid_button:IsEnabled() then
private.bid_button:Click()
m.results_listing:SetSort(1,2,3,4,5,6,7,8,9)
m.results_listing:Reset()
m.results_listing:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and m.results_listing:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' and m.buyout_button:IsEnabled() then
m.buyout_button:Click()
elseif button == 'RightButton' and m.bid_button:IsEnabled() then
m.bid_button:Click()
end
end
end)
private.results_listing:SetHandler('OnSelectionChanged', function(rt, datum)
m.results_listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
m.find_auction(datum.record)
end)
local handlers = {
OnClick = function(st, data, _, button)
if not data then return end
if button == 'LeftButton' and IsShiftKeyDown() then
private.search_box:SetText(data.search.filter_string)
m.search_box:SetText(data.search.filter_string)
elseif button == 'RightButton' and IsShiftKeyDown() then
private.add_filter(data.search.filter_string)
m.add_filter(data.search.filter_string)
elseif button == 'LeftButton' and IsAltKeyDown() then
private.popup_info.rename = data.search
m.popup_info.rename = data.search
StaticPopup_Show('AUX_SEARCH_SAVED_RENAME')
elseif button == 'RightButton' and IsAltKeyDown() then
-- unused
elseif button == 'LeftButton' and IsControlKeyDown() then
if st == private.favorite_searches_listing and data.index > 1 then
if st == m.favorite_searches_listing and data.index > 1 then
local temp = aux_favorite_searches[data.index - 1]
aux_favorite_searches[data.index - 1] = data.search
aux_favorite_searches[data.index] = temp
private.update_search_listings()
m.update_search_listings()
end
elseif button == 'RightButton' and IsControlKeyDown() then
if st == private.favorite_searches_listing and data.index < getn(aux_favorite_searches) then
if st == m.favorite_searches_listing and data.index < getn(aux_favorite_searches) then
local temp = aux_favorite_searches[data.index + 1]
aux_favorite_searches[data.index + 1] = data.search
aux_favorite_searches[data.index] = temp
private.update_search_listings()
m.update_search_listings()
end
elseif button == 'LeftButton' then
private.search_box:SetText(data.search.filter_string)
public.execute()
m.search_box:SetText(data.search.filter_string)
m.execute()
elseif button == 'RightButton' then
if st == private.recent_searches_listing then
if st == m.recent_searches_listing then
tinsert(aux_favorite_searches, 1, data.search)
elseif st == private.favorite_searches_listing then
elseif st == m.favorite_searches_listing then
tremove(aux_favorite_searches, data.index)
end
private.update_search_listings()
m.update_search_listings()
end
end,
OnEnter = function(st, data, self)
@@ -674,20 +674,20 @@ function Aux.search_frame.create_frames(private, public)
}
private.recent_searches_listing = Aux.listing.CreateScrollingTable(AuxSearchFrameSavedRecent)
private.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
private.recent_searches_listing:EnableSorting(false)
private.recent_searches_listing:DisableSelection(true)
private.recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
m.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
m.recent_searches_listing:EnableSorting(false)
m.recent_searches_listing:DisableSelection(true)
m.recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
Aux.gui.vertical_line(AuxSearchFrameSaved, 379)
private.favorite_searches_listing = Aux.listing.CreateScrollingTable(AuxSearchFrameSavedFavorite)
private.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
private.favorite_searches_listing:EnableSorting(false)
private.favorite_searches_listing:DisableSelection(true)
private.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
end
m.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
m.favorite_searches_listing:EnableSorting(false)
m.favorite_searches_listing:DisableSelection(true)
m.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
m.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
m.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
end)