fixed issue of auctions not showing after posting, setting of view is now shared between the search panels as well as persisted between sessions, tab/shift-tab can now be used to switch between all input fields

This commit is contained in:
Manuel Simon Hirsig
2015-11-16 10:31:16 +01:00
parent d477427247
commit 4f907f9c9e
12 changed files with 272 additions and 128 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
## Interface: 11200
## Title: Aux
## Notes: A lightweight addon designed to help manage auctions
## SavedVariablesPerCharacter: AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
## SavedVariablesPerCharacter: aux_view, AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
## SavedVariables: aux_database, aux_recently_searched, aux_auctionable_items
core.xml
@@ -12,7 +12,7 @@ util.lua
scan.lua
stack.lua
post.lua
list.lua
sheet.lua
info.xml
completion.xml
+10 -2
View File
@@ -1,5 +1,5 @@
AuxVersion = "2.1.0"
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
AuxVersion = '2.1.1'
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
local lastRightClickAction = GetTime()
@@ -17,8 +17,16 @@ Aux = {
},
},
last_picked_up = {},
view = {
BUYOUT = 1,
BID = 2,
FULL = 3,
},
last_owner_page_requested = 0,
}
aux_view = Aux.view.BUYOUT
function Aux_OnLoad()
Aux.log('Aux v'..AuxVersion..' loaded.')
Aux.loaded = true
+11 -13
View File
@@ -18,10 +18,8 @@ function group_alpha_setter(cell, group)
cell:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
end
local BUYOUT, BID, FULL = 1, 2, 3
public.views = {
[BUYOUT] = {
[Aux.view.BUYOUT] = {
name = 'Buyout',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -135,7 +133,7 @@ public.views = {
},
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending'}},
},
[BID] = {
[Aux.view.BID] = {
name = 'Bid',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -279,7 +277,7 @@ public.views = {
},
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending' }, {column = 6, order = 'ascending'}},
},
[FULL] = {
[Aux.view.FULL] = {
name = 'Full',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -470,7 +468,7 @@ function public.on_close()
end
function public.on_open()
public.set_view(1)
public.set_view(aux_view)
update_sheet()
end
@@ -491,21 +489,21 @@ function update_sheet()
AuxFilterSearchFrameResultsBidListing:Hide()
AuxFilterSearchFrameResultsFullListing:Hide()
if private.view == BUYOUT then
if aux_view == Aux.view.BUYOUT then
AuxFilterSearchFrameResultsBuyListing:Show()
local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
Aux.list.populate(AuxFilterSearchFrameResultsBuyListing.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
Aux.sheet.populate(AuxFilterSearchFrameResultsBuyListing.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBuyListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
elseif private.view == BID then
elseif aux_view == Aux.view.BID then
AuxFilterSearchFrameResultsBidListing:Show()
local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
Aux.list.populate(AuxFilterSearchFrameResultsBidListing.sheet, bid_auctions)
Aux.sheet.populate(AuxFilterSearchFrameResultsBidListing.sheet, bid_auctions)
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBidListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
elseif private.view == FULL then
elseif aux_view == Aux.view.FULL then
AuxFilterSearchFrameResultsFullListing:Show()
Aux.list.populate(AuxFilterSearchFrameResultsFullListing.sheet, auctions or {})
Aux.sheet.populate(AuxFilterSearchFrameResultsFullListing.sheet, auctions or {})
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsFullListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
end
@@ -521,7 +519,7 @@ function public.set_view(view)
for i=1,3 do
getglobal('AuxFilterSearchFrameResultsTab'..i):SetAlpha(i == view and 1 or 0.5)
end
private.view = view
aux_view = view
update_sheet()
end
+100 -9
View File
@@ -37,6 +37,13 @@
<OnEscapePressed>
this:ClearFocus()
</OnEscapePressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
else
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
@@ -110,7 +117,15 @@
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
else
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
<EditBox name="$parentMaxLevel" letters="2" numeric="true" autoFocus="false" inherits="AuxInputBoxTemplate">
@@ -123,7 +138,15 @@
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
<CheckButton name="$parentUsableCheckButton" inherits="UICheckButtonTemplate">
@@ -145,6 +168,17 @@
getglobal(this:GetName()..'Label'):SetText('Tooltip')
this:SetWidth(150)
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
@@ -154,6 +188,17 @@
<OnLoad>
this:SetWidth(150)
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
@@ -163,6 +208,17 @@
<OnLoad>
this:SetWidth(150)
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
@@ -172,6 +228,17 @@
<OnLoad>
this:SetWidth(150)
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
Aux.filter_search_frame.start_search()
</OnEnterPressed>
<OnTabPressed>
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
</OnTabPressed>
</Scripts>
</EditBox>
@@ -250,7 +317,7 @@
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText('Buy')
getglobal(this:GetName()..'Text'):SetText('Buy')
</OnLoad>
<OnClick>
Aux.filter_search_frame.set_view(this:GetID())
@@ -267,7 +334,7 @@
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText('Bid')
getglobal(this:GetName()..'Text'):SetText('Bid')
</OnLoad>
<OnClick>
Aux.filter_search_frame.set_view(this:GetID())
@@ -284,7 +351,7 @@
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText('Full')
getglobal(this:GetName()..'Text'):SetText('Full')
</OnLoad>
<OnClick>
Aux.filter_search_frame.set_view(this:GetID())
@@ -299,8 +366,16 @@
<Scripts>
<OnLoad>
local config = Aux.filter_search_frame.views[1]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
@@ -312,8 +387,16 @@
<Scripts>
<OnLoad>
local config = Aux.filter_search_frame.views[2]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
@@ -325,8 +408,16 @@
<Scripts>
<OnLoad>
local config = Aux.filter_search_frame.views[3]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
+12 -14
View File
@@ -17,8 +17,6 @@ function group_alpha_setter(cell, group)
cell:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
end
local BUYOUT, BID, FULL = 1, 2, 3
public.recently_searched_config = {
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -81,7 +79,7 @@ public.recently_searched_config = {
sort_order = {},
}
public.views = {
[BUYOUT] = {
[Aux.view.BUYOUT] = {
name = 'Buyout',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -153,7 +151,7 @@ public.views = {
},
sort_order = {{column = 3, order = 'ascending' }},
},
[BID] = {
[Aux.view.BID] = {
name = 'Bid',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -255,7 +253,7 @@ public.views = {
},
sort_order = {{column = 3, order = 'ascending'}, {column = 5, order = 'ascending'}},
},
[FULL] = {
[Aux.view.FULL] = {
name = 'Full',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
@@ -414,7 +412,7 @@ function public.on_close()
end
function public.on_open()
public.set_view(1)
public.set_view(aux_view)
public.update_item()
private.update_recently_searched()
update_listing()
@@ -440,21 +438,21 @@ function update_listing()
AuxItemSearchFrameAuctionsBidListing:Hide()
AuxItemSearchFrameAuctionsFullListing:Hide()
if private.view == BUYOUT then
if aux_view == Aux.view.BUYOUT then
AuxItemSearchFrameAuctionsBuyListing:Show()
local buy_records = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
Aux.list.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
Aux.sheet.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsBuyListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
elseif private.view == BID then
elseif aux_view == Aux.view.BID then
AuxItemSearchFrameAuctionsBidListing:Show()
local bid_records = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
Aux.list.populate(AuxItemSearchFrameAuctionsBidListing.sheet, bid_records)
Aux.sheet.populate(AuxItemSearchFrameAuctionsBidListing.sheet, bid_records)
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsBidListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
elseif private.view == FULL then
elseif aux_view == Aux.view.FULL then
AuxItemSearchFrameAuctionsFullListing:Show()
Aux.list.populate(AuxItemSearchFrameAuctionsFullListing.sheet, auctions or {})
Aux.sheet.populate(AuxItemSearchFrameAuctionsFullListing.sheet, auctions or {})
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsFullListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
end
@@ -470,12 +468,12 @@ function public.set_view(view)
for i=1,3 do
getglobal('AuxItemSearchFrameAuctionsTab'..i):SetAlpha(i == view and 1 or 0.5)
end
private.view = view
aux_view = view
update_listing()
end
function private.update_recently_searched()
Aux.list.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, aux_recently_searched)
Aux.sheet.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, aux_recently_searched)
end
function public.set_item(item_id)
+39 -8
View File
@@ -152,8 +152,15 @@
<Scripts>
<OnLoad>
local config = Aux.item_search_frame.recently_searched_config
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
}
</OnLoad>
</Scripts>
</Frame>
@@ -231,8 +238,16 @@
<Scripts>
<OnLoad>
local config = Aux.item_search_frame.views[1]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
@@ -244,8 +259,16 @@
<Scripts>
<OnLoad>
local config = Aux.item_search_frame.views[2]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
@@ -257,8 +280,16 @@
<Scripts>
<OnLoad>
local config = Aux.item_search_frame.views[3]
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
+2 -2
View File
@@ -351,12 +351,12 @@ function public.update_listing()
if public.listing == BIDS then
AuxManageFrameListingBidListing:Show()
Aux.list.populate(AuxManageFrameListingBidListing.sheet, bid_records)
Aux.sheet.populate(AuxManageFrameListingBidListing.sheet, bid_records)
AuxManageFrameListing:SetWidth(AuxManageFrameListingBidListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxManageFrameListing:GetWidth() + 15)
elseif public.listing == AUCTIONS then
AuxManageFrameListingAuctionListing:Show()
Aux.list.populate(AuxManageFrameListingAuctionListing.sheet, auction_records)
Aux.sheet.populate(AuxManageFrameListingAuctionListing.sheet, auction_records)
AuxManageFrameListing:SetWidth(AuxManageFrameListingAuctionListing:GetWidth() + 40)
AuxFrame:SetWidth(AuxManageFrameListing:GetWidth() + 15)
end
+20 -4
View File
@@ -62,8 +62,16 @@
<Scripts>
<OnLoad>
local config = Aux.manage_frame.bid_listing_config
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
@@ -75,8 +83,16 @@
<Scripts>
<OnLoad>
local config = Aux.manage_frame.auction_listing_config
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
on_row_update = config.on_row_update,
}
</OnLoad>
</Scripts>
</Frame>
+6 -6
View File
@@ -89,16 +89,16 @@ Aux.sell.inventory_listing_config = {
}
Aux.sell.auction_listing_config = {
on_cell_click = function (sheet, row_index, column_index)
on_row_click = function (sheet, row_index, column_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
AuxSellEntry_OnClick(sheet.data[data_index])
end,
on_cell_enter = function (sheet, row_index, column_index)
on_row_enter = function (sheet, row_index, column_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
end,
on_cell_leave = function (sheet, row_index, column_index)
on_row_leave = function (sheet, row_index, column_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
local datum = sheet.data[data_index]
if not (datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key) then
@@ -175,11 +175,11 @@ Aux.sell.auction_listing_config = {
}
function update_inventory_listing()
Aux.list.populate(AuxSellInventoryListing.sheet, inventory_data)
Aux.sheet.populate(AuxSellInventoryListing.sheet, inventory_data)
end
function update_auction_listing()
Aux.list.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
Aux.sheet.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
end
function Aux.sell.on_open()
@@ -604,7 +604,7 @@ function AuxSellEntry_OnClick(entry)
update_auction_listing()
update_recommendation()
PlaySound("igMainMenuOptionCheckBoxOn")
PlaySound('igMainMenuOptionCheckBoxOn')
end
function AuxSellParametersRefreshButton_OnClick()
+22 -4
View File
@@ -27,8 +27,15 @@
<Scripts>
<OnLoad>
local config = Aux.sell.inventory_listing_config
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
}
</OnLoad>
</Scripts>
</Frame>
@@ -222,6 +229,10 @@
</layers>
<Scripts>
<OnLoad>
MoneyInputFrame_SetPreviousFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Copper'))
MoneyInputFrame_SetNextFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Gold'))
MoneyInputFrame_SetPreviousFocus(this, getglobal(this:GetParent():GetName()..'StartPriceCopper'))
MoneyInputFrame_SetNextFocus(this, getglobal(this:GetParent():GetName()..'StartPriceGold'))
MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters)
</OnLoad>
</Scripts>
@@ -274,8 +285,15 @@
<Scripts>
<OnLoad>
local config = Aux.sell.auction_listing_config
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_cell_click, config.on_cell_enter, config.on_cell_leave)
this.sheet = Aux.sheet.create{
frame = this,
columns = config.columns,
sort_order = config.sort_order,
row_setter = config.row_setter,
on_row_click = config.on_row_click,
on_row_enter = config.on_row_enter,
on_row_leave = config.on_row_leave,
}
</OnLoad>
</Scripts>
</Frame>
+47 -63
View File
@@ -1,8 +1,9 @@
Aux.sheet = {}
local private, public = {}, {}
Aux.sheet = public
Aux.list = {}
MoneyTypeInfo["AUX_LIST"] = {
MoneyTypeInfo['AUX_LIST'] = {
UpdateFunc = function()
return this.staticMoney
end,
@@ -11,13 +12,13 @@ MoneyTypeInfo["AUX_LIST"] = {
showSmallerCoins = 1,
}
function Aux.sheet.render(sheet)
function public.render(sheet)
for i, column in ipairs(sheet.columns) do
local sort_info = sheet.sort_order[1]
if sort_info and sort_info.column == column then
if sort_info.sort_ascending then
if sort_info and sort_info.column == i then
if sort_info.order == 'ascending' then
sheet.labels[i].sort_texture:SetTexCoord(0,0.55,0.2,0.9)
sheet.labels[i].sort_texture:SetVertexColor(0.2,1,0)
sheet.labels[i].sort_texture:Show()
@@ -42,7 +43,7 @@ function Aux.sheet.render(sheet)
local data = sheet.data
for i, row in ipairs(rows) do
local direction, rowR, rowG, rowB, rowA1, rowA2 = "Horizontal", 1, 1, 1, 0, 0 --row level coloring used for gradients
local direction, rowR, rowG, rowB, rowA1, rowA2 = 'Horizontal', 1, 1, 1, 0, 0 --row level coloring used for gradients
local datum = data[i + offset]
if datum then
@@ -66,9 +67,9 @@ function Aux.sheet.render(sheet)
end
end
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click, on_row_enter, on_row_leave, on_row_update)
function public.create(params)
local sheet
local name = (frame:GetName() or '')..'ScrollSheet'
local name = (params.frame:GetName() or '')..'ScrollSheet'
local id = 1
while getglobal(name..id) do
@@ -76,22 +77,22 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
end
name = name..id
local scroll_frame = CreateFrame("ScrollFrame", name..'ScrollFrame', frame, "FauxScrollFrameTemplate")
scroll_frame:SetScript("OnVerticalScroll", function()
FauxScrollFrame_OnVerticalScroll(16, function() Aux.sheet.render(this.sheet) end)
local scroll_frame = CreateFrame('ScrollFrame', name..'ScrollFrame', params.frame, 'FauxScrollFrameTemplate')
scroll_frame:SetScript('OnVerticalScroll', function()
FauxScrollFrame_OnVerticalScroll(16, function() public.render(this.sheet) end)
end)
scroll_frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -10)
scroll_frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 5, 19)
scroll_frame:SetPoint('TOPLEFT', params.frame, 'TOPLEFT', 5, -10)
scroll_frame:SetPoint('BOTTOMRIGHT', params.frame, 'BOTTOMRIGHT', 5, 19)
local parent_height = frame:GetHeight()
local content = CreateFrame('Frame', name..'Content', frame)
local parent_height = params.frame:GetHeight()
local content = CreateFrame('Frame', name..'Content', params.frame)
content:SetHeight(parent_height - 30)
content:SetPoint("TOPLEFT", scroll_frame, "TOPLEFT", 5, 0)
content:SetPoint('TOPLEFT', scroll_frame, 'TOPLEFT', 5, 0)
local total_width = 0
local labels = {}
for i = 1,getn(columns) do
for i = 1,getn(params.columns) do
local button = CreateFrame('Button', nil, content)
if i == 1 then
button:SetPoint('TOPLEFT', content, 'TOPLEFT', 5, 0)
@@ -101,15 +102,15 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
total_width = total_width + 3
end
local label = content:CreateFontString(nil, 'OVERLAY', 'GameFontHighlight')
label:SetText(columns[i].title)
local column_width = columns[i].width or 30
label:SetText(params.columns[i].title)
local column_width = params.columns[i].width or 30
total_width = total_width + column_width
button:SetWidth(column_width)
button:SetHeight(16)
button:SetID(i)
button:SetHighlightTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight')
button:SetScript("OnMouseDown", function() Aux.list.sort(sheet, this:GetID()) end)
button:SetScript("OnMouseDown", function() Aux.sheet.sort(sheet, this:GetID()) end)
button:RegisterForClicks("LeftButtonDown", "RightButtonDown")
local texture = content:CreateTexture(nil, 'ARTWORK')
@@ -147,17 +148,17 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
labels[i] = label
end
total_width = total_width + 5
frame:SetWidth(total_width)
params.frame:SetWidth(total_width)
local rows = {}
local row_index = 1
local max_height = content:GetHeight()
local total_height = 16
while total_height + 14 < max_height do
if getn(columns) > 0 then
if getn(params.columns) > 0 then
local row = CreateFrame('Button', nil, content)
row:SetPoint('TOPLEFT', labels[1], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
row:SetPoint('TOPRIGHT', labels[getn(columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
row:SetPoint('TOPRIGHT', labels[getn(params.columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
row:SetHeight(14)
@@ -168,14 +169,14 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
row:SetScript('OnUpdate', function() if sheet.on_row_update then sheet.on_row_update(sheet, row_idx) end end)
row.cells = {}
for i = 1,getn(columns) do
for i = 1,getn(params.columns) do
local cell = CreateFrame('Button', nil, content)
cell:SetPoint('TOPLEFT', labels[i], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
cell:SetPoint('TOPRIGHT', labels[i], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
cell:SetHeight(14)
columns[i].cell_initializer(cell)
params.columns[i].cell_initializer(cell)
row.cells[i] = cell
end
@@ -207,28 +208,28 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
scroll_frame = scroll_frame,
labels = labels,
rows = rows,
columns = columns,
columns = params.columns,
data = {},
sort_order = sort_order,
row_setter = row_setter,
on_row_click = on_row_click,
on_row_enter = on_row_enter,
on_row_leave = on_row_leave,
on_row_update = on_row_update,
sort_order = params.sort_order,
row_setter = params.row_setter,
on_row_click = params.on_row_click,
on_row_enter = params.on_row_enter,
on_row_leave = params.on_row_leave,
on_row_update = params.on_row_update,
}
scroll_frame.sheet = sheet
return sheet
end
function Aux.list.row_comparator(sheet)
function private.row_comparator(sheet)
return function(row1, row2)
for _, sort_info in ipairs(sheet.sort_order) do
local column = sort_info.column
local column = sheet.columns[sort_info.column]
if column.comparator then
local ordering = column.comparator(row1, row2)
if ordering ~= Aux.util.EQ then
return sort_info.sort_ascending and ordering or Aux.util.invert_order(ordering)
return sort_info.order == 'ascending' and ordering or Aux.util.invert_order(ordering)
end
end
end
@@ -236,7 +237,7 @@ function Aux.list.row_comparator(sheet)
end
end
function Aux.sheet.default_cell_initializer(alignment)
function public.default_cell_initializer(alignment)
return function(cell)
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
text:SetAllPoints(cell)
@@ -247,41 +248,24 @@ function Aux.sheet.default_cell_initializer(alignment)
end
end
function Aux.sheet.initialize(frame)
local sort_order = {}
for i, column in columns do
if i ~= BUYOUT_UNIT and i ~= NAME then
tinsert(sort_order, { column = column, sort_ascending = true })
end
end
tinsert(sort_order, 1, { column = columns[BUYOUT_UNIT], sort_ascending = true })
tinsert(sort_order, 1, { column = columns[NAME], sort_ascending = true })
end
function Aux.list.populate(sheet, data)
function public.populate(sheet, data)
sheet.data = data
-- Perform the sort.
Aux.util.merge_sort(sheet.data, Aux.list.row_comparator(sheet))
Aux.util.merge_sort(sheet.data, private.row_comparator(sheet))
-- Update the scroll pane.
Aux.sheet.render(sheet)
public.render(sheet)
end
function Aux.list.sort(sheet, column_index)
local column = sheet.columns[column_index]
function Aux.sheet.sort(sheet, column_index)
if sheet.sort_order[1] and sheet.sort_order[1].column == column then
sheet.sort_order[1].sort_ascending = not sheet.sort_order[1].sort_ascending
if sheet.sort_order[1] and sheet.sort_order[1].column == column_index then
sheet.sort_order[1].order = sheet.sort_order[1].order == 'ascending' and 'descending' or 'ascending'
else
sheet.sort_order = Aux.util.filter(sheet.sort_order, function(sort_info) return not sort_info.column == column end)
tinsert(sheet.sort_order, 1, {column=column, sort_ascending=true})
sheet.sort_order = Aux.util.filter(sheet.sort_order, function(sort_info) return not sort_info.column == column_index end)
tinsert(sheet.sort_order, 1, {column=column_index, order = 'ascending'})
end
Aux.util.merge_sort(sheet.data, Aux.list.row_comparator(sheet))
Aux.util.merge_sort(sheet.data, private.row_comparator(sheet))
Aux.sheet.render(sheet)
public.render(sheet)
end
+1 -1
View File
@@ -1,4 +1,4 @@
private, public = {}, {}
local private, public = {}, {}
Aux.static = public
aux_auctionable_items = {}