big module refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-19 11:18:31 +02:00
parent 337bc19578
commit 667990f7d8
19 changed files with 157 additions and 192 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ do
m.cancel_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
aux.cancel_auction(index, aux._(m.listing.RemoveAuctionRecord, m.listing, record))
aux.cancel_auction(index, aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.cancel_button:Enable()
+2 -2
View File
@@ -93,7 +93,7 @@ do
aux.place_bid('bidder', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record)
m.listing:SetDatabase()
end or aux._(m.listing.RemoveAuctionRecord, m.listing, record))
end or aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.bid_button:Enable()
@@ -102,7 +102,7 @@ do
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and m.listing:ContainsRecord(record) then
aux.place_bid('bidder', index, record.buyout_price, aux._(m.listing.RemoveAuctionRecord, m.listing, record))
aux.place_bid('bidder', index, record.buyout_price, aux.C(m.listing.RemoveAuctionRecord, m.listing, record))
end
end)
m.buyout_button:Enable()
+1 -1
View File
@@ -153,7 +153,7 @@ function private.update_auction_listing()
})
end
sort(auction_rows, function(a, b)
return aux.sort.multi_lt(
return aux.sorting.multi_lt(
{
a.record.unit_buyout_price == 0 and aux.huge or a.record.unit_buyout_price,
a.record.unit_blizzard_bid,
+4 -5
View File
@@ -49,8 +49,8 @@ private.blizzard_query = setmetatable({}, {
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
return (subclass_index or 0) > 0 and subclass_index or nil
elseif key == 'slot' then
local slot_index = UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
return (slot_index or 0) > 0 and slot_index or nil
local slot_token = UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
return slot_token ~= '' and slot_token or nil
elseif key == 'quality' then
local quality_code = UIDropDownMenu_GetSelectedValue(m.quality_dropdown)
return (quality_code or -1) >= 0 and quality_code or nil
@@ -406,14 +406,13 @@ function private.initialize_slot_dropdown()
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
UIDropDownMenu_AddButton{
text = ALL,
value = 0,
value = '',
func = on_click,
}
for _, slot in {GetAuctionInvTypes(class_index, subclass_index)} do
local slot_name = getglobal(slot)
UIDropDownMenu_AddButton{
text = slot_name,
text = getglobal(slot),
value = slot,
func = on_click,
}
+3 -3
View File
@@ -388,7 +388,7 @@ function private.create_frames()
end
end)
editbox:SetScript('OnTextChanged', m.update_form)
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText('Name')
@@ -415,7 +415,7 @@ function private.create_frames()
m.max_level_input:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
editbox:SetScript('OnTextChanged', function()
local valid_level = m.valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then
@@ -440,7 +440,7 @@ function private.create_frames()
m.name_input:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox))
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
editbox:SetScript('OnTextChanged', function()
local valid_level = m.valid_level(this:GetText())
if tostring(valid_level) ~= this:GetText() then
+6 -6
View File
@@ -162,8 +162,8 @@ function private.start_real_time_scan(query, search, continuation)
if not ignore_page then
if search.auto_buy then
ctrl.suspend()
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux._(ctrl.resume, true))
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(ctrl.resume, false))
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.C(ctrl.resume, true))
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(ctrl.resume, false))
else
tinsert(new_records, auction_record)
end
@@ -258,8 +258,8 @@ function private.start_search(queries, continuation)
on_auction = function(auction_record, ctrl)
if search.auto_buy then
ctrl.suspend()
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux._(ctrl.resume, true))
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(ctrl.resume, false))
aux.place_bid('list', auction_record.index, auction_record.buyout_price, aux.C(ctrl.resume, true))
aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(ctrl.resume, false))
elseif getn(search.records) < 1000 then
tinsert(search.records, auction_record)
if getn(search.records) == 1000 then
@@ -411,7 +411,7 @@ do
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
aux.info.bid_update(record)
search.table:SetDatabase()
end or aux._(search.table.RemoveAuctionRecord, search.table, record))
end or aux.C(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.bid_button:Enable()
@@ -420,7 +420,7 @@ do
if record.buyout_price > 0 then
m.buyout_button:SetScript('OnClick', function()
if m.test(record)(index) and search.table:ContainsRecord(record) then
aux.place_bid('list', index, record.buyout_price, aux._(search.table.RemoveAuctionRecord, search.table, record))
aux.place_bid('list', index, record.buyout_price, aux.C(search.table.RemoveAuctionRecord, search.table, record))
end
end)
m.buyout_button:Enable()