big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-07-11 23:23:22 +02:00
parent 8339ba6ee5
commit f24c176157
13 changed files with 1153 additions and 1162 deletions
+16 -4
View File
@@ -26,9 +26,21 @@ item_listing.lua
history.lua
completion.xml
search/core.xml
post/core.xml
auctions/core.xml
bids/core.xml
search\core.xml
search\core.lua
search\frames.lua
post\core.xml
post\core.lua
post\frames.lua
auctions\core.xml
auctions\core.lua
auctions\frames.lua
bids\core.xml
bids\core.lua
bids\frames.lua
+1 -42
View File
@@ -4,48 +4,7 @@ Aux.auctions_frame = public
local auction_records
function public.on_load()
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: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()
end
end)
private.listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
end)
do
local status_bar = Aux.gui.status_bar(AuxAuctionsFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxAuctionsFrame, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Cancel')
btn:Disable()
private.cancel_button = btn
end
do
local btn = Aux.gui.button(AuxAuctionsFrame, 16)
btn:SetPoint('TOPLEFT', private.cancel_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
public.scan_auctions()
end)
end
public.create_frames(private, public)
end
function private.update_listing()
-4
View File
@@ -1,8 +1,4 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="auctions/core.lua"/>
<Script file="auctions/frames.lua"/>
<Frame name="AuxAuctionsFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Scripts>
<OnUpdate>
+42 -1
View File
@@ -1,3 +1,44 @@
Aux.auctions_frame.create_frames = function(private, public)
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: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()
end
end)
private.listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
end)
do
local status_bar = Aux.gui.status_bar(AuxAuctionsFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxAuctionsFrame, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Cancel')
btn:Disable()
private.cancel_button = btn
end
do
local btn = Aux.gui.button(AuxAuctionsFrame, 16)
btn:SetPoint('TOPLEFT', private.cancel_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
public.scan_auctions()
end)
end
end
+1 -55
View File
@@ -4,61 +4,7 @@ Aux.bids_frame = public
local auction_records
function public.on_load()
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: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
private.buyout_button:Click()
elseif button == 'RightButton' and private.bid_button:IsEnabled() then
private.bid_button:Click()
end
end
end)
private.listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
end)
do
local status_bar = Aux.gui.status_bar(AuxBidsFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
public.scan_bids()
end)
end
public.create_frames(private, public)
end
function private.update_listing()
-4
View File
@@ -1,8 +1,4 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="bids/core.lua"/>
<Script file="bids/frames.lua"/>
<Frame name="AuxBidsFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Scripts>
<OnUpdate>
+55 -1
View File
@@ -1,3 +1,57 @@
Aux.bids_frame.create_frames = function(private, public)
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: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
private.buyout_button:Click()
elseif button == 'RightButton' and private.bid_button:IsEnabled() then
private.bid_button:Click()
end
end
end)
private.listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
end)
do
local status_bar = Aux.gui.status_bar(AuxBidsFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 0)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
end
do
local btn = Aux.gui.button(AuxBidsFrame, 16)
btn:SetPoint('TOPLEFT', private.buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
public.scan_bids()
end)
end
end
+49 -357
View File
@@ -1,10 +1,8 @@
local private, public = {}, {}
Aux.post_frame = public
local refresh
local existing_auctions = {}
local inventory_records
local selected_item
local scan_id
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
@@ -22,7 +20,7 @@ function private.default_settings()
end
function private.read_settings(item_key)
item_key = item_key or selected_item.key
item_key = item_key or private.selected_item.key
local dataset = Aux.persistence.load_dataset()
dataset.post = dataset.post or {}
@@ -36,7 +34,7 @@ function private.read_settings(item_key)
end
function private.write_settings(settings, item_key)
item_key = item_key or selected_item.key
item_key = item_key or private.selected_item.key
local dataset = Aux.persistence.load_dataset()
dataset.post = dataset.post or {}
@@ -79,11 +77,11 @@ function private.update_auction_listing()
end
local auction_rows = {}
if selected_item then
if private.selected_item then
local unit_start_price = private.get_unit_start_price()
local unit_buyout_price = private.get_unit_buyout_price()
for i, auction_record in ipairs(existing_auctions[selected_item.key] or {}) do
for i, auction_record in ipairs(existing_auctions[private.selected_item.key] or {}) do
local blizzard_bid_undercut, buyout_price_undercut = private.undercut(auction_record, private.stack_size_slider:GetValue())
blizzard_bid_undercut = Aux.money.from_string(Aux.money.to_string(blizzard_bid_undercut, true, nil, 3))
@@ -94,7 +92,7 @@ function private.update_auction_listing()
stack_buyout_price_undercut = Aux.money.from_string(Aux.money.to_string(stack_buyout_price_undercut, true, nil, 3))
local stack_size = private.stack_size_slider:GetValue()
local historical_value = Aux.history.value(selected_item.key)
local historical_value = Aux.history.value(private.selected_item.key)
local bid_color
if blizzard_bid_undercut < unit_start_price and stack_blizzard_bid_undercut < unit_start_price then
@@ -148,327 +146,21 @@ function public.select_item(item_key)
end
function public.on_load()
Aux.gui.vertical_line(AuxPostFrameContent, 219)
AuxSellParametersItem:EnableMouse()
AuxSellParametersItem:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item()
if item_info then
public.select_item(item_info.item_key)
end
ClearCursor()
end)
-- AuxSellParametersItemIconTexture:SetScript('OnEnter', function()
-- if selected_item then
-- Aux.info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT')
-- end
-- end)
-- AuxSellParametersItemIconTexture:SetScript('OnLeave', function()
-- GameTooltip:Hide()
-- end)
do
local checkbox = CreateFrame('CheckButton', nil, AuxSellInventory, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', 45, -15)
checkbox:SetScript('OnClick', function()
refresh = true
end)
local label = Aux.gui.label(checkbox, 13)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox
end
Aux.gui.horizontal_line(AuxSellInventory, -48)
private.item_listing = Aux.item_listing.create(
AuxSellInventory,
function()
if arg1 == 'LeftButton' then
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')
end
end,
function()
Aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
end,
function()
GameTooltip:Hide()
end,
function(item_record)
return item_record == selected_item
end
)
private.auction_listing = Aux.listing.CreateScrollingTable(AuxSellAuctions)
private.auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' },
{ name='Bid/ea', width=.23, align='RIGHT' },
{ name='Bid Pct', width=.12, align='CENTER' },
{ name='Buy/ea', width=.23, align='RIGHT' },
{ name='Buy Pct', width=.12, align='CENTER' }
})
private.auction_listing:DisableSelection(true)
private.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
local column_index = Aux.util.index_of(column, column.row.cols)
local unit_start_price, unit_buyout_price = private.undercut(row_data.record, private.stack_size_slider:GetValue(), button == 'RightButton')
if column_index == 3 then
private.stack_size_slider:SetValue(row_data.record.stack_size)
elseif column_index == 4 then
private.set_unit_start_price(unit_start_price)
elseif column_index == 6 then
private.set_unit_buyout_price(unit_buyout_price)
end
end)
do
local status_bar = Aux.gui.status_bar(AuxPostFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxSellParameters, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Post')
btn:SetScript('OnClick', private.post_auctions)
private.post_button = btn
end
do
local btn = Aux.gui.button(AuxSellParameters, 16)
btn:SetPoint('TOPLEFT', private.post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', private.refresh)
private.refresh_button = btn
end
do
local slider = Aux.gui.slider(AuxSellParameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 16, -75)
slider:SetWidth(190)
slider:SetScript('OnValueChanged', function()
private.quantity_update(true)
end)
slider.editbox:SetScript('OnTextChanged', function()
slider:SetValue(this:GetNumber())
private.quantity_update(true)
if selected_item then
local settings = private.read_settings()
settings.stack_size = this:GetNumber()
private.write_settings(settings)
end
end)
slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.unit_buyout_price:SetFocus()
elseif private.stack_count_slider.editbox:IsVisible() then
private.stack_count_slider.editbox:SetFocus()
else
private.unit_start_price:SetFocus()
end
end)
slider.editbox:SetWidth(50)
slider.editbox:SetNumeric(true)
slider.editbox:SetMaxLetters(3)
slider.label:SetText('Stack Size')
slider.label:SetTextHeight(13)
private.stack_size_slider = slider
end
do
local slider = Aux.gui.slider(AuxSellParameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', private.stack_size_slider, 'BOTTOMLEFT', 0, -30)
slider:SetWidth(190)
slider:SetScript('OnValueChanged', function()
private.quantity_update()
end)
slider.editbox:SetScript('OnTextChanged', function()
slider:SetValue(this:GetNumber())
private.quantity_update()
end)
slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.stack_size_slider.editbox:SetFocus()
else
private.unit_start_price:SetFocus()
end
end)
slider.editbox:SetWidth(50)
slider.editbox:SetNumeric(true)
slider.label:SetText('Stack Count')
slider.label:SetTextHeight(13)
private.stack_count_slider = slider
end
do
local dropdown = Aux.gui.dropdown(AuxSellParameters)
dropdown:SetPoint('TOPLEFT', private.stack_count_slider, 'BOTTOMLEFT', 0, -19)
dropdown:SetWidth(90)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, private.initialize_duration_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_duration_dropdown)
end)
local label = Aux.gui.label(dropdown, 15)
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
private.deposit = label
private.duration_dropdown = dropdown
end
do
local checkbox = CreateFrame('CheckButton', nil, AuxSellParameters, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPRIGHT', -85, -6)
checkbox:SetScript('OnClick', function()
local settings = private.read_settings()
settings.hidden = this:GetChecked()
private.write_settings(settings)
refresh = true
end)
local label = Aux.gui.label(checkbox, 13)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Hide this item')
private.hide_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(AuxSellParameters)
editbox:SetPoint('TOPRIGHT', -65, -66)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(private.get_unit_start_price(), true, nil, 3))
refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() and private.stack_count_slider.editbox:IsVisible() then
private.stack_count_slider.editbox:SetFocus()
elseif IsShiftKeyDown() then
private.stack_size_slider.editbox:SetFocus()
else
private.unit_buyout_price:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(private.get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price')
end
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.start_price_percentage = label
end
private.unit_start_price = editbox
end
do
local editbox = Aux.gui.editbox(AuxSellParameters)
editbox:SetPoint('TOPRIGHT', private.unit_start_price, 'BOTTOMRIGHT', 0, -18)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(private.get_unit_buyout_price(), true, nil, 3))
refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.unit_start_price:SetFocus()
else
private.stack_size_slider.editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(private.get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price')
end
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.buyout_price_percentage = label
end
private.unit_buyout_price = editbox
end
do
local btn = Aux.gui.button(AuxSellParameters, 16)
btn:SetPoint('TOPRIGHT', -15, -143)
btn:SetWidth(150)
btn:SetHeight(20)
btn:GetFontString():SetTextHeight(15)
btn:GetFontString():SetJustifyH('RIGHT')
btn:GetFontString():SetPoint('RIGHT', 0, 0)
btn:SetScript('OnClick', function()
if this.amount then
private.set_unit_start_price(this.amount)
private.set_unit_buyout_price(this.amount)
end
end)
local label = Aux.gui.label(btn, 13)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
private.historical_value_button = btn
end
public.create_frames(private, public)
end
function private.price_update()
if selected_item then
if private.selected_item then
local settings = private.read_settings()
local start_price_input = private.get_unit_start_price()
settings.start_price = start_price_input
local historical_value = Aux.history.value(selected_item.key)
local historical_value = Aux.history.value(private.selected_item.key)
private.start_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(start_price_input / historical_value * 100)) or '---')
local buyout_price_input = private.get_unit_buyout_price()
settings.buyout_price = buyout_price_input
local historical_value = Aux.history.value(selected_item.key)
local historical_value = Aux.history.value(private.selected_item.key)
private.buyout_price_percentage:SetText(historical_value and Aux.auction_listing.percentage_historical(Aux.round(buyout_price_input / historical_value * 100)) or '---')
private.write_settings(settings)
@@ -483,22 +175,22 @@ function public.on_open()
private.update_inventory_records()
refresh = true
private.refresh = true
end
function public.on_close()
selected_item = nil
private.selected_item = nil
end
function private.post_auctions()
if selected_item then
if private.selected_item then
local unit_start_price = private.get_unit_start_price()
local unit_buyout_price = private.get_unit_buyout_price()
local stack_size = private.stack_size_slider:GetValue()
local stack_count
stack_count = private.stack_count_slider:GetValue()
local duration = UIDropDownMenu_GetSelectedValue(private.duration_dropdown)
local key = selected_item.key
local key = private.selected_item.key
local duration_code
if duration == DURATION_4 then
@@ -523,14 +215,14 @@ function private.post_auctions()
end
private.update_inventory_records()
selected_item = nil
private.selected_item = nil
for _, record in ipairs(inventory_records) do
if record.key == key then
private.set_item(record)
end
end
refresh = true
private.refresh = true
end
)
end
@@ -538,7 +230,7 @@ end
function private.validate_parameters()
if not selected_item then
if not private.selected_item then
private.post_button:Disable()
return
end
@@ -563,13 +255,13 @@ end
function private.update_item_configuration()
if not selected_item then
if not private.selected_item then
private.refresh_button:Disable()
AuxSellParametersItemIconTexture:SetTexture(nil)
AuxSellParametersItemCount:SetText()
AuxSellParametersItemName:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
AuxSellParametersItemName:SetText('No item selected')
AuxPostParametersItemIconTexture:SetTexture(nil)
AuxPostParametersItemCount:SetText()
AuxPostParametersItemName:SetTextColor(unpack(Aux.gui.config.label_color.enabled))
AuxPostParametersItemName:SetText('No item selected')
private.unit_start_price:Hide()
private.unit_buyout_price:Hide()
@@ -589,14 +281,14 @@ function private.update_item_configuration()
private.historical_value_button:Show()
private.hide_checkbox:Show()
AuxSellParametersItemIconTexture:SetTexture(selected_item.texture)
AuxSellParametersItemName:SetText('['..selected_item.name..']')
local color = ITEM_QUALITY_COLORS[selected_item.quality]
AuxSellParametersItemName:SetTextColor(color.r, color.g, color.b)
if selected_item.aux_quantity > 1 then
AuxSellParametersItemCount:SetText(selected_item.aux_quantity)
AuxPostParametersItemIconTexture:SetTexture(private.selected_item.texture)
AuxPostParametersItemName:SetText('['..private.selected_item.name..']')
local color = ITEM_QUALITY_COLORS[private.selected_item.quality]
AuxPostParametersItemName:SetTextColor(color.r, color.g, color.b)
if private.selected_item.aux_quantity > 1 then
AuxPostParametersItemCount:SetText(private.selected_item.aux_quantity)
else
AuxSellParametersItemCount:SetText()
AuxPostParametersItemCount:SetText()
end
private.stack_size_slider.editbox:SetNumber(private.stack_size_slider:GetValue())
@@ -607,7 +299,7 @@ function private.update_item_configuration()
local stack_size = private.stack_size_slider:GetValue()
local stack_count
stack_count = private.stack_count_slider:GetValue()
local deposit = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
local deposit = floor(private.selected_item.unit_vendor_price * deposit_factor * (private.selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(private.duration_dropdown) / 120
private.deposit:SetText('Deposit: '..Aux.money.to_string(deposit, nil, nil, nil, Aux.gui.inline_color({255, 254, 250, 1})))
end
@@ -629,14 +321,14 @@ function private.undercut(record, stack_size, stack)
end
function private.quantity_update(max_count)
if selected_item then
local max_stack_count = selected_item.max_charges and selected_item.availability[private.stack_size_slider:GetValue()] or floor(selected_item.availability[0] / private.stack_size_slider:GetValue())
if private.selected_item then
local max_stack_count = private.selected_item.max_charges and private.selected_item.availability[private.stack_size_slider:GetValue()] or floor(private.selected_item.availability[0] / private.stack_size_slider:GetValue())
private.stack_count_slider:SetMinMaxValues(1, max_stack_count)
if max_count then
private.stack_count_slider:SetValue(max_stack_count)
end
end
refresh = true
private.refresh = true
end
function private.unit_vendor_price(item_key)
@@ -664,8 +356,8 @@ function private.unit_vendor_price(item_key)
end
function private.update_historical_value_button()
if selected_item then
local historical_value = Aux.history.value(selected_item.key)
if private.selected_item then
local historical_value = Aux.history.value(private.selected_item.key)
private.historical_value_button.amount = historical_value
private.historical_value_button:SetText(historical_value and Aux.money.to_string(historical_value, true, nil, 3) or '---')
end
@@ -678,37 +370,37 @@ function private.set_item(item)
if not item.unit_vendor_price then
settings.hidden = 1
private.write_settings(settings, item.key)
refresh = true
private.refresh = true
return
end
Aux.scan.abort(scan_id)
selected_item = item
private.selected_item = item
UIDropDownMenu_Initialize(private.duration_dropdown, private.initialize_duration_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(private.duration_dropdown, settings.duration)
private.hide_checkbox:SetChecked(settings.hidden)
private.stack_size_slider:SetMinMaxValues(1, selected_item.max_charges or selected_item.max_stack)
private.stack_size_slider:SetMinMaxValues(1, private.selected_item.max_charges or private.selected_item.max_stack)
private.stack_size_slider:SetValue(settings.stack_size)
private.quantity_update(true)
private.unit_start_price:SetText(Aux.money.to_string(settings.start_price, true, nil, 3, nil, true))
private.unit_buyout_price:SetText(Aux.money.to_string(settings.buyout_price, true, nil, 3, nil, true))
if not existing_auctions[selected_item.key] then
if not existing_auctions[private.selected_item.key] then
private.refresh_entries()
end
private.write_settings(settings, item.key)
refresh = true
private.refresh = true
end
function private.update_inventory_records()
inventory_records = {}
refresh = true
private.refresh = true
local auction_candidate_map = {}
@@ -756,12 +448,12 @@ function private.update_inventory_records()
tinsert(inventory_records, auction_candidate)
end
sort(inventory_records, function(a, b) return a.name < b.name end)
refresh = true
private.refresh = true
end
function private.refresh_entries()
if selected_item then
local item_id, suffix_id = selected_item.item_id, selected_item.suffix_id
if private.selected_item then
local item_id, suffix_id = private.selected_item.item_id, private.selected_item.suffix_id
local item_key = item_id..':'..suffix_id
existing_auctions[item_key] = nil
@@ -799,7 +491,7 @@ function private.refresh_entries()
end,
on_complete = function()
existing_auctions[item_key] = existing_auctions[item_key] or {}
refresh = true
private.refresh = true
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
end,
@@ -807,10 +499,10 @@ function private.refresh_entries()
end
end
function private.refresh()
function private.private.refresh()
Aux.scan.abort(scan_id)
private.refresh_entries()
refresh = true
private.refresh = true
end
function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner)
@@ -840,8 +532,8 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou
end
function public.on_update()
if refresh then
refresh = false
if private.refresh then
private.refresh = false
private.price_update()
private.update_historical_value_button()
private.update_item_configuration()
@@ -859,7 +551,7 @@ function private.initialize_duration_dropdown()
local settings = private.read_settings()
settings.duration = this.value
private.write_settings(settings)
refresh = true
private.refresh = true
end
UIDropDownMenu_AddButton{
+5 -9
View File
@@ -1,8 +1,4 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="post/core.lua"/>
<Script file="post/frames.lua"/>
<Frame name="AuxPostFrame" parent="AuxFrame" hidden="true">
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
@@ -21,17 +17,17 @@
<Anchor point="BOTTOMRIGHT" relativeTo="AuxFrameContent"></Anchor>
</Anchors>
<Frames>
<Frame name="AuxSellInventory" inherits="AuxFrameBoxTemplate">
<Frame name="AuxPostInventory" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="212"/></Size>
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="4" y="-4"/></Offset></Anchor>
<Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="4" y="4"/></Offset></Anchor>
</Anchors>
</Frame>
<frame name="AuxSellParameters" inherits="AuxFrameBoxTemplate">
<frame name="AuxPostParameters" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension y="177"/></Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="AuxSellInventory"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="AuxPostInventory"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor>
<Anchor point="TOPRIGHT"><Offset><AbsDimension x="-4" y="0"/></Offset></Anchor>
</Anchors>
<frames>
@@ -40,10 +36,10 @@
</Frame>
</frames>
</frame>
<Frame name="AuxSellAuctions" inherits="AuxFrameBoxTemplate">
<Frame name="AuxPostAuctions" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension y="217"/></Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeTo="AuxSellInventory"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor>
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" relativeTo="AuxPostInventory"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor>
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-4" y="0"/></Offset></Anchor>
</Anchors>
</Frame>
+306 -1
View File
@@ -1,3 +1,308 @@
Aux.post_frame.create_frames = function(private, public)
function Aux.post_frame.create_frames(private, public)
Aux.gui.vertical_line(AuxPostFrameContent, 219)
AuxPostParametersItem:EnableMouse()
AuxPostParametersItem:SetScript('OnReceiveDrag', function()
local item_info = Aux.cursor_item()
if item_info then
public.select_item(item_info.item_key)
end
ClearCursor()
end)
-- AuxPostParametersItemIconTexture:SetScript('OnEnter', function()
-- if private.selected_item then
-- Aux.info.set_tooltip(private.selected_item.itemstring, this, 'ANCHOR_RIGHT')
-- end
-- end)
-- AuxPostParametersItemIconTexture:SetScript('OnLeave', function()
-- GameTooltip:Hide()
-- end)
do
local checkbox = CreateFrame('CheckButton', nil, AuxPostInventory, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', 45, -15)
checkbox:SetScript('OnClick', function()
private.refresh = true
end)
local label = Aux.gui.label(checkbox, 13)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Show hidden items')
private.show_hidden_checkbox = checkbox
end
Aux.gui.horizontal_line(AuxPostInventory, -48)
private.item_listing = Aux.item_listing.create(
AuxPostInventory,
function()
if arg1 == 'LeftButton' then
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')
end
end,
function()
Aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
end,
function()
GameTooltip:Hide()
end,
function(item_record)
return item_record == private.selected_item
end
)
private.auction_listing = Aux.listing.CreateScrollingTable(AuxPostAuctions)
private.auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' },
{ name='Bid/ea', width=.23, align='RIGHT' },
{ name='Bid Pct', width=.12, align='CENTER' },
{ name='Buy/ea', width=.23, align='RIGHT' },
{ name='Buy Pct', width=.12, align='CENTER' }
})
private.auction_listing:DisableSelection(true)
private.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
local column_index = Aux.util.index_of(column, column.row.cols)
local unit_start_price, unit_buyout_price = private.undercut(row_data.record, private.stack_size_slider:GetValue(), button == 'RightButton')
if column_index == 3 then
private.stack_size_slider:SetValue(row_data.record.stack_size)
elseif column_index == 4 then
private.set_unit_start_price(unit_start_price)
elseif column_index == 6 then
private.set_unit_buyout_price(unit_buyout_price)
end
end)
do
local status_bar = Aux.gui.status_bar(AuxPostFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxPostParameters, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Post')
btn:SetScript('OnClick', private.post_auctions)
private.post_button = btn
end
do
local btn = Aux.gui.button(AuxPostParameters, 16)
btn:SetPoint('TOPLEFT', private.post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', private.refresh)
private.refresh_button = btn
end
do
local slider = Aux.gui.slider(AuxPostParameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 16, -75)
slider:SetWidth(190)
slider:SetScript('OnValueChanged', function()
private.quantity_update(true)
end)
slider.editbox:SetScript('OnTextChanged', function()
slider:SetValue(this:GetNumber())
private.quantity_update(true)
if private.selected_item then
local settings = private.read_settings()
settings.stack_size = this:GetNumber()
private.write_settings(settings)
end
end)
slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.unit_buyout_price:SetFocus()
elseif private.stack_count_slider.editbox:IsVisible() then
private.stack_count_slider.editbox:SetFocus()
else
private.unit_start_price:SetFocus()
end
end)
slider.editbox:SetWidth(50)
slider.editbox:SetNumeric(true)
slider.editbox:SetMaxLetters(3)
slider.label:SetText('Stack Size')
slider.label:SetTextHeight(13)
private.stack_size_slider = slider
end
do
local slider = Aux.gui.slider(AuxPostParameters)
slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', private.stack_size_slider, 'BOTTOMLEFT', 0, -30)
slider:SetWidth(190)
slider:SetScript('OnValueChanged', function()
private.quantity_update()
end)
slider.editbox:SetScript('OnTextChanged', function()
slider:SetValue(this:GetNumber())
private.quantity_update()
end)
slider.editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.stack_size_slider.editbox:SetFocus()
else
private.unit_start_price:SetFocus()
end
end)
slider.editbox:SetWidth(50)
slider.editbox:SetNumeric(true)
slider.label:SetText('Stack Count')
slider.label:SetTextHeight(13)
private.stack_count_slider = slider
end
do
local dropdown = Aux.gui.dropdown(AuxPostParameters)
dropdown:SetPoint('TOPLEFT', private.stack_count_slider, 'BOTTOMLEFT', 0, -19)
dropdown:SetWidth(90)
dropdown:SetHeight(10)
local label = Aux.gui.label(dropdown, 13)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4)
label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, private.initialize_duration_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.initialize_duration_dropdown)
end)
local label = Aux.gui.label(dropdown, 15)
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
private.deposit = label
private.duration_dropdown = dropdown
end
do
local checkbox = CreateFrame('CheckButton', nil, AuxPostParameters, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPRIGHT', -85, -6)
checkbox:SetScript('OnClick', function()
local settings = private.read_settings()
settings.hidden = this:GetChecked()
private.write_settings(settings)
private.refresh = true
end)
local label = Aux.gui.label(checkbox, 13)
label:SetPoint('LEFT', checkbox, 'RIGHT', 2, 1)
label:SetText('Hide this item')
private.hide_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(AuxPostParameters)
editbox:SetPoint('TOPRIGHT', -65, -66)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(private.get_unit_start_price(), true, nil, 3))
private.refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() and private.stack_count_slider.editbox:IsVisible() then
private.stack_count_slider.editbox:SetFocus()
elseif IsShiftKeyDown() then
private.stack_size_slider.editbox:SetFocus()
else
private.unit_buyout_price:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(private.get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price')
end
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.start_price_percentage = label
end
private.unit_start_price = editbox
end
do
local editbox = Aux.gui.editbox(AuxPostParameters)
editbox:SetPoint('TOPRIGHT', private.unit_start_price, 'BOTTOMRIGHT', 0, -18)
editbox:SetJustifyH('RIGHT')
editbox:SetWidth(150)
editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(Aux.money.to_string(private.get_unit_buyout_price(), true, nil, 3))
private.refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.unit_start_price:SetFocus()
else
private.stack_size_slider.editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function()
this:HighlightText()
this.pretty:Hide()
end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(private.get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
end)
editbox.pretty = Aux.gui.label(editbox, Aux.gui.config.normal_font_size)
editbox.pretty:SetAllPoints()
editbox.pretty:SetJustifyH('RIGHT')
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price')
end
do
local label = Aux.gui.label(editbox, 13)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0)
label:SetWidth(50)
label:SetJustifyH('CENTER')
private.buyout_price_percentage = label
end
private.unit_buyout_price = editbox
end
do
local btn = Aux.gui.button(AuxPostParameters, 16)
btn:SetPoint('TOPRIGHT', -15, -143)
btn:SetWidth(150)
btn:SetHeight(20)
btn:GetFontString():SetTextHeight(15)
btn:GetFontString():SetJustifyH('RIGHT')
btn:GetFontString():SetPoint('RIGHT', 0, 0)
btn:SetScript('OnClick', function()
if this.amount then
private.set_unit_start_price(this.amount)
private.set_unit_buyout_price(this.amount)
end
end)
local label = Aux.gui.label(btn, 13)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
private.historical_value_button = btn
end
end
+11 -679
View File
@@ -48,12 +48,12 @@ StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
hideOnEscape = 1,
}
local RESULTS, SAVED, FILTER = {}, {}, {}
private.RESULTS, private.SAVED, private.FILTER = 1, 2, 3
private.elements = {
[RESULTS] = {},
[SAVED] = {},
[FILTER] = {},
[private.RESULTS] = {},
[private.SAVED] = {},
[private.FILTER] = {},
}
function private.update_search_listings()
@@ -91,13 +91,13 @@ function private.update_tab(tab)
AuxSearchFrameSaved:Hide()
AuxSearchFrameFilter:Hide()
if tab == RESULTS then
if tab == private.RESULTS then
AuxSearchFrameResults:Show()
private.search_results_button:LockHighlight()
elseif tab == SAVED then
elseif tab == private.SAVED then
AuxSearchFrameSaved:Show()
private.saved_searches_button:LockHighlight()
elseif tab == FILTER then
elseif tab == private.FILTER then
AuxSearchFrameFilter:Show()
private.new_filter_button:LockHighlight()
end
@@ -202,677 +202,9 @@ function public.on_close()
end
function public.on_load()
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:SetWidth(30)
btn:SetHeight(25)
btn:SetText('<')
btn:SetScript('OnClick', private.previous_search)
private.previous_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 26)
btn:SetPoint('TOPRIGHT', -5, -8)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText('>')
btn:SetScript('OnClick', private.next_search)
private.next_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:SetHeight(25)
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('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')
end
ClearCursor()
end)
private.search_box = editbox
end
do
Aux.gui.horizontal_line(AuxSearchFrame, -40)
end
do
local btn = Aux.gui.button(AuxSearchFrame, 18)
btn:SetPoint('BOTTOMLEFT', AuxFrameContent, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(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:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(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:SetWidth(243)
btn:SetHeight(22)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(FILTER) end)
private.new_filter_button = btn
end
do
local status_bar = Aux.gui.status_bar(AuxSearchFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.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()
end)
end
do
local btn = Aux.gui.button(AuxSearchFrameSaved, 16)
btn:SetPoint('TOPLEFT', private.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())
if filters then
tinsert(aux_favorite_searches, 1, {
filter_string = private.search_box:GetText(),
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
})
end
private.update_search_listings()
end)
end
do
local btn1 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn1:SetPoint('TOPLEFT', private.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.start_search()
end)
local btn2 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
btn2:SetWidth(80)
btn2:SetHeight(24)
btn2:SetText('Add')
btn2:SetScript('OnClick', function()
private.add_filter()
private.clear_form()
end)
local btn3 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
btn3:SetWidth(80)
btn3:SetHeight(24)
btn3:SetText('Replace')
btn3:SetScript('OnClick', function()
private.add_filter(nil, true)
private.clear_form()
end)
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentNameInputBox')
editbox.complete_item = Aux.completion.completor(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -20)
editbox:SetWidth(260)
editbox:SetScript('OnChar', function()
if AuxSearchFrameFilterExactCheckButton:GetChecked() then
this:complete_item()
end
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.last_page_editbox:SetFocus()
else
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
end
do
local checkbox = CreateFrame('CheckButton', '$parentExactCheckButton', AuxSearchFrameFilter, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', AuxSearchFrameFilterNameInputBox, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(AuxSearchFrameFilterExactCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterExactCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Exact')
private.show_hidden_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentMinLevel')
editbox:SetPoint('TOPLEFT', AuxSearchFrameFilterNameInputBox, 'BOTTOMLEFT', 0, -22)
editbox:SetWidth(125)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
else
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentMaxLevel')
editbox:SetPoint('TOPLEFT', AuxSearchFrameFilterMinLevel, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
else
private.first_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
label:SetText('-')
end
do
local checkbox = CreateFrame('CheckButton', '$parentUsableCheckButton', AuxSearchFrameFilter, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', AuxSearchFrameFilterMaxLevel, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(AuxSearchFrameFilterUsableCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterUsableCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Usable')
private.show_hidden_checkbox = checkbox
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
dropdown:SetPoint('TOPLEFT', AuxSearchFrameFilterMinLevel, '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 Class')
UIDropDownMenu_Initialize(dropdown, private.initialize_class_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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:SetWidth(145)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
private.last_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Page Range')
private.first_page_editbox = editbox
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox:SetPoint('TOPLEFT', private.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()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
label:SetText('-')
private.last_page_editbox = editbox
end
Aux.gui.vertical_line(AuxSearchFrameFilter, 332)
do
local label = Aux.gui.label(AuxSearchFrameFilterUsableCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterUsableCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Usable')
end
local function add_modifier(...)
local current_filter_string = private.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)
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPRIGHT', -362, -10)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('and')
btn:SetScript('OnClick', function()
add_modifier('and')
end)
private.and_operator_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.and_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('or')
btn:SetScript('OnClick', function()
add_modifier('or')
end)
private.or_operator_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.or_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('not')
btn:SetScript('OnClick', function()
add_modifier('not')
end)
private.not_operator_button = btn
end
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
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
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
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
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
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
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
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
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
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
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
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
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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['item'], 'BOTTOMLEFT', 0, -10)
private.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
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
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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['rarity'], 'BOTTOMLEFT', 0, -10)
private.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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['utilizable'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['discard'] = btn
end
for modifier_name, btn in private.modifier_buttons do
local modifier_name = modifier_name
local btn = btn
local filter = Aux.scan_util.filters[modifier_name]
btn:SetWidth(100)
btn:SetHeight(19)
btn:SetText(modifier_name)
btn:SetScript('OnClick', function()
local args = Aux.util.map(btn.inputs, function(input) return input:GetText() end)
if filter.test(unpack(args)) then
add_modifier(modifier_name, unpack(args))
for _, input in btn.inputs do
input:SetText('')
input:ClearFocus()
end
end
end)
btn.inputs = {}
if filter.arity > 0 then
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox.complete = Aux.completion.completor(function() return ({filter.test()})[2] end)
editbox:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
editbox:SetWidth(80)
-- editbox:SetNumeric(true)
-- editbox:SetMaxLetters(2)
editbox:SetScript('OnChar', function()
this:complete()
end)
local on_click = btn:GetScript('OnClick')
editbox:SetScript('OnEnterPressed', function()
on_click()
end)
tinsert(btn.inputs, editbox)
end
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: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()
end
end
end)
private.results_listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.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)
elseif button == 'RightButton' and IsShiftKeyDown() then
private.add_filter(data.search.filter_string)
elseif button == 'LeftButton' and IsAltKeyDown() then
private.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
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()
end
elseif button == 'RightButton' and IsControlKeyDown() then
if st == private.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()
end
elseif button == 'LeftButton' then
private.search_box:SetText(data.search.filter_string)
public.start_search()
elseif button == 'RightButton' then
if st == private.recent_searches_listing then
tinsert(aux_favorite_searches, 1, data.search)
elseif st == private.favorite_searches_listing then
tremove(aux_favorite_searches, data.index)
end
private.update_search_listings()
end
end,
OnEnter = function(st, data, self)
if not data then return end
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine(gsub(data.search.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true)
GameTooltip:Show()
GameTooltip:Show()
end,
OnLeave = function()
GameTooltip:ClearLines()
GameTooltip:Hide()
end
}
private.recent_searches_listing = Aux.listing.CreateScrollingTable(AuxSearchFrameSavedRecent)
private.recent_searches_listing:DisableSelection(true)
private.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
private.recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.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:DisableSelection(true)
private.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
private.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
public.create_frames(private, public)
private.update_search()
private.update_tab(SAVED)
private.update_tab(private.SAVED)
end
function private.stop_search()
@@ -921,7 +253,7 @@ function public.start_search(filter_string, resume)
private.update_search_listings()
end
private.update_tab(RESULTS)
private.update_tab(private.RESULTS)
private.stop_button:Show()
private.resume_button:Hide()
private.search_button:Hide()
@@ -971,7 +303,7 @@ function public.start_search(filter_string, resume)
private.search_button:Show()
if getn(private:current_search().records) == 0 and AuxSearchFrameResults:IsVisible() then
private.update_tab(SAVED)
private.update_tab(private.SAVED)
end
end,
on_abort = function()
-4
View File
@@ -1,8 +1,4 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="search/core.lua"/>
<Script file="search/frames.lua"/>
<Frame name="AuxSearchFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Scripts>
<OnUpdate>
+667 -1
View File
@@ -1,3 +1,669 @@
Aux.search_frame.create_frames = function(private, public)
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:SetWidth(30)
btn:SetHeight(25)
btn:SetText('<')
btn:SetScript('OnClick', private.previous_search)
private.previous_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrame, 26)
btn:SetPoint('TOPRIGHT', -5, -8)
btn:SetWidth(30)
btn:SetHeight(25)
btn:SetText('>')
btn:SetScript('OnClick', private.next_search)
private.next_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:SetHeight(25)
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('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')
end
ClearCursor()
end)
private.search_box = editbox
end
do
Aux.gui.horizontal_line(AuxSearchFrame, -40)
end
do
local btn = Aux.gui.button(AuxSearchFrame, 18)
btn:SetPoint('BOTTOMLEFT', AuxFrameContent, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(private.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:SetWidth(243)
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(private.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:SetWidth(243)
btn:SetHeight(22)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(private.FILTER) end)
private.new_filter_button = btn
end
do
local status_bar = Aux.gui.status_bar(AuxSearchFrame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
private.status_bar = status_bar
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
btn:Disable()
private.bid_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
btn:Disable()
private.buyout_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameResults, 16)
btn:SetPoint('TOPLEFT', private.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()
end)
end
do
local btn = Aux.gui.button(AuxSearchFrameSaved, 16)
btn:SetPoint('TOPLEFT', private.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())
if filters then
tinsert(aux_favorite_searches, 1, {
filter_string = private.search_box:GetText(),
prettified = Aux.util.join(Aux.util.map(filters, function(filter) return filter.prettified end), ';'),
})
end
private.update_search_listings()
end)
end
do
local btn1 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn1:SetPoint('TOPLEFT', private.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.start_search()
end)
local btn2 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
btn2:SetWidth(80)
btn2:SetHeight(24)
btn2:SetText('Add')
btn2:SetScript('OnClick', function()
private.add_filter()
private.clear_form()
end)
local btn3 = Aux.gui.button(AuxSearchFrameFilter, 16)
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
btn3:SetWidth(80)
btn3:SetHeight(24)
btn3:SetText('Replace')
btn3:SetScript('OnClick', function()
private.add_filter(nil, true)
private.clear_form()
end)
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentNameInputBox')
editbox.complete_item = Aux.completion.completor(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -20)
editbox:SetWidth(260)
editbox:SetScript('OnChar', function()
if AuxSearchFrameFilterExactCheckButton:GetChecked() then
this:complete_item()
end
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
private.last_page_editbox:SetFocus()
else
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
end
do
local checkbox = CreateFrame('CheckButton', '$parentExactCheckButton', AuxSearchFrameFilter, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', AuxSearchFrameFilterNameInputBox, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(AuxSearchFrameFilterExactCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterExactCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Exact')
private.show_hidden_checkbox = checkbox
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentMinLevel')
editbox:SetPoint('TOPLEFT', AuxSearchFrameFilterNameInputBox, 'BOTTOMLEFT', 0, -22)
editbox:SetWidth(125)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
else
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Level Range')
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentMaxLevel')
editbox:SetPoint('TOPLEFT', AuxSearchFrameFilterMinLevel, 'TOPRIGHT', 10, 0)
editbox:SetWidth(125)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
else
private.first_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
label:SetText('-')
end
do
local checkbox = CreateFrame('CheckButton', '$parentUsableCheckButton', AuxSearchFrameFilter, 'UICheckButtonTemplate')
checkbox:SetWidth(22)
checkbox:SetHeight(22)
checkbox:SetPoint('TOPLEFT', AuxSearchFrameFilterMaxLevel, 'TOPRIGHT', 10, 0)
local label = Aux.gui.label(AuxSearchFrameFilterUsableCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterUsableCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Usable')
private.show_hidden_checkbox = checkbox
end
do
local dropdown = Aux.gui.dropdown(AuxSearchFrameFilter)
dropdown:SetPoint('TOPLEFT', AuxSearchFrameFilterMinLevel, '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 Class')
UIDropDownMenu_Initialize(dropdown, private.initialize_class_dropdown)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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: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)
dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, private.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:SetWidth(145)
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
private.last_page_editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Page Range')
private.first_page_editbox = editbox
end
do
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox:SetPoint('TOPLEFT', private.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()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
public.start_search()
end)
local label = Aux.gui.label(editbox, 13)
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
label:SetText('-')
private.last_page_editbox = editbox
end
Aux.gui.vertical_line(AuxSearchFrameFilter, 332)
do
local label = Aux.gui.label(AuxSearchFrameFilterUsableCheckButton, 13)
label:SetPoint('BOTTOMLEFT', AuxSearchFrameFilterUsableCheckButton, 'TOPLEFT', 1, -3)
label:SetText('Usable')
end
local function add_modifier(...)
local current_filter_string = private.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)
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPRIGHT', -362, -10)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('and')
btn:SetScript('OnClick', function()
add_modifier('and')
end)
private.and_operator_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.and_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('or')
btn:SetScript('OnClick', function()
add_modifier('or')
end)
private.or_operator_button = btn
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('LEFT', private.or_operator_button, 'RIGHT', 10, 0)
btn:SetWidth(50)
btn:SetHeight(19)
btn:SetText('not')
btn:SetScript('OnClick', function()
add_modifier('not')
end)
private.not_operator_button = btn
end
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
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
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
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
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
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
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
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
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
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
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
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
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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['item'], 'BOTTOMLEFT', 0, -10)
private.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
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
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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['rarity'], 'BOTTOMLEFT', 0, -10)
private.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
end
do
local btn = Aux.gui.button(AuxSearchFrameFilter, 16)
btn:SetPoint('TOPLEFT', private.modifier_buttons['utilizable'], 'BOTTOMLEFT', 0, -10)
private.modifier_buttons['discard'] = btn
end
for modifier_name, btn in private.modifier_buttons do
local modifier_name = modifier_name
local btn = btn
local filter = Aux.scan_util.filters[modifier_name]
btn:SetWidth(100)
btn:SetHeight(19)
btn:SetText(modifier_name)
btn:SetScript('OnClick', function()
local args = Aux.util.map(btn.inputs, function(input) return input:GetText() end)
if filter.test(unpack(args)) then
add_modifier(modifier_name, unpack(args))
for _, input in btn.inputs do
input:SetText('')
input:ClearFocus()
end
end
end)
btn.inputs = {}
if filter.arity > 0 then
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
editbox.complete = Aux.completion.completor(function() return ({filter.test()})[2] end)
editbox:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
editbox:SetWidth(80)
-- editbox:SetNumeric(true)
-- editbox:SetMaxLetters(2)
editbox:SetScript('OnChar', function()
this:complete()
end)
local on_click = btn:GetScript('OnClick')
editbox:SetScript('OnEnterPressed', function()
on_click()
end)
tinsert(btn.inputs, editbox)
end
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: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()
end
end
end)
private.results_listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.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)
elseif button == 'RightButton' and IsShiftKeyDown() then
private.add_filter(data.search.filter_string)
elseif button == 'LeftButton' and IsAltKeyDown() then
private.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
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()
end
elseif button == 'RightButton' and IsControlKeyDown() then
if st == private.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()
end
elseif button == 'LeftButton' then
private.search_box:SetText(data.search.filter_string)
public.start_search()
elseif button == 'RightButton' then
if st == private.recent_searches_listing then
tinsert(aux_favorite_searches, 1, data.search)
elseif st == private.favorite_searches_listing then
tremove(aux_favorite_searches, data.index)
end
private.update_search_listings()
end
end,
OnEnter = function(st, data, self)
if not data then return end
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine(gsub(data.search.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true)
GameTooltip:Show()
GameTooltip:Show()
end,
OnLeave = function()
GameTooltip:ClearLines()
GameTooltip:Hide()
end
}
private.recent_searches_listing = Aux.listing.CreateScrollingTable(AuxSearchFrameSavedRecent)
private.recent_searches_listing:DisableSelection(true)
private.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
private.recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.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:DisableSelection(true)
private.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
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