some auction listing changes
This commit is contained in:
+31
-51
@@ -53,10 +53,9 @@ function item_column_init(rt, cell)
|
|||||||
cell.iconBtn = iconBtn
|
cell.iconBtn = iconBtn
|
||||||
cell.icon = icon
|
cell.icon = icon
|
||||||
|
|
||||||
local text = cell:GetFontString()
|
cell.text:ClearAllPoints()
|
||||||
text:ClearAllPoints()
|
cell.text:SetPoint('TOPLEFT', iconBtn, 'TOPRIGHT', 2, 0)
|
||||||
text:SetPoint('TOPLEFT', iconBtn, 'TOPRIGHT', 2, 0)
|
cell.text:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||||
text:SetPoint('BOTTOMRIGHT', 0, 0)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
M.search_config = {
|
M.search_config = {
|
||||||
@@ -69,13 +68,13 @@ M.search_config = {
|
|||||||
if indented then
|
if indented then
|
||||||
cell.spacer:SetWidth(10)
|
cell.spacer:SetWidth(10)
|
||||||
cell.icon:SetAlpha(.5)
|
cell.icon:SetAlpha(.5)
|
||||||
cell:GetFontString():SetAlpha(.7)
|
cell.text:SetAlpha(.7)
|
||||||
else
|
else
|
||||||
cell.spacer:SetWidth(1)
|
cell.spacer:SetWidth(1)
|
||||||
cell.icon:SetAlpha(1)
|
cell.icon:SetAlpha(1)
|
||||||
cell:GetFontString():SetAlpha(1)
|
cell.text:SetAlpha(1)
|
||||||
end
|
end
|
||||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
cell.text:SetText(gsub(record.link, '[%[%]]', ''))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.name, record_b.name, desc)
|
return sort_util.compare(record_a.name, record_b.name, desc)
|
||||||
@@ -88,7 +87,7 @@ M.search_config = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local display_level = max(record.level, 1)
|
local display_level = max(record.level, 1)
|
||||||
display_level = UnitLevel'player' < record.level and color.red(display_level) or display_level
|
display_level = UnitLevel'player' < record.level and color.red(display_level) or display_level
|
||||||
cell:SetText(display_level)
|
cell.text:SetText(display_level)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.level, record_b.level, desc)
|
return sort_util.compare(record_a.level, record_b.level, desc)
|
||||||
@@ -103,7 +102,7 @@ M.search_config = {
|
|||||||
if own > 0 then
|
if own > 0 then
|
||||||
numAuctionsText = numAuctionsText .. (' ' .. color.yellow('(' .. own .. ')'))
|
numAuctionsText = numAuctionsText .. (' ' .. color.yellow('(' .. own .. ')'))
|
||||||
end
|
end
|
||||||
cell:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.EQ
|
return sort_util.EQ
|
||||||
@@ -123,7 +122,7 @@ M.search_config = {
|
|||||||
width = .055,
|
width = .055,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(record.aux_quantity)
|
cell.text:SetText(record.aux_quantity)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||||
@@ -134,7 +133,7 @@ M.search_config = {
|
|||||||
width = .04,
|
width = .04,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
cell.text:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
||||||
@@ -145,7 +144,7 @@ M.search_config = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
|
cell.text:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -177,7 +176,7 @@ M.search_config = {
|
|||||||
else
|
else
|
||||||
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price, true, false, nil, price_color))
|
cell.text:SetText(money.to_string(price, true, false, nil, price_color))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
@@ -202,7 +201,7 @@ M.search_config = {
|
|||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
@@ -219,7 +218,7 @@ M.search_config = {
|
|||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local pct, bidPct = record_percentage(record)
|
local pct, bidPct = record_percentage(record)
|
||||||
cell:SetText((pct or bidPct) and percentage_historical(pct or bidPct, not pct) or '---')
|
cell.text:SetText((pct or bidPct) and percentage_historical(pct or bidPct, not pct) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local pct_a = record_percentage(record_a) or (desc and -huge or huge)
|
local pct_a = record_percentage(record_a) or (desc and -huge or huge)
|
||||||
@@ -245,7 +244,7 @@ M.auctions_config = {
|
|||||||
cell.icon:SetAlpha(1)
|
cell.icon:SetAlpha(1)
|
||||||
cell:GetFontString():SetAlpha(1)
|
cell:GetFontString():SetAlpha(1)
|
||||||
end
|
end
|
||||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
cell.text:SetText(gsub(record.link, '[%[%]]', ''))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.name, record_b.name, desc)
|
return sort_util.compare(record_a.name, record_b.name, desc)
|
||||||
@@ -258,7 +257,7 @@ M.auctions_config = {
|
|||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local display_level = max(record.level, 1)
|
local display_level = max(record.level, 1)
|
||||||
display_level = UnitLevel('player') < record.level and color.red(display_level) or display_level
|
display_level = UnitLevel('player') < record.level and color.red(display_level) or display_level
|
||||||
cell:SetText(display_level)
|
cell.text:SetText(display_level)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.level, record_b.level, desc)
|
return sort_util.compare(record_a.level, record_b.level, desc)
|
||||||
@@ -270,7 +269,7 @@ M.auctions_config = {
|
|||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record, count, own, expandable)
|
fill = function(cell, record, count, own, expandable)
|
||||||
local numAuctionsText = expandable and color.link(count) or count
|
local numAuctionsText = expandable and color.link(count) or count
|
||||||
cell:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.EQ
|
return sort_util.EQ
|
||||||
@@ -290,7 +289,7 @@ M.auctions_config = {
|
|||||||
width = .055,
|
width = .055,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(record.aux_quantity)
|
cell.text:SetText(record.aux_quantity)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||||
@@ -301,7 +300,7 @@ M.auctions_config = {
|
|||||||
width = .04,
|
width = .04,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
cell.text:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
||||||
@@ -319,7 +318,7 @@ M.auctions_config = {
|
|||||||
else
|
else
|
||||||
price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
price = aux_price_per_unit and ceil(record.start_price / record.aux_quantity) or record.start_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price, true, false))
|
cell.text:SetText(money.to_string(price, true, false))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
@@ -344,7 +343,7 @@ M.auctions_config = {
|
|||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
@@ -360,7 +359,7 @@ M.auctions_config = {
|
|||||||
width = .21,
|
width = .21,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(record.high_bidder or color.red 'No Bids')
|
cell.text:SetText(record.high_bidder or color.red 'No Bids')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.high_bidder and not record_b.high_bidder then
|
if not record_a.high_bidder and not record_b.high_bidder then
|
||||||
@@ -392,7 +391,7 @@ M.bids_config = {
|
|||||||
cell.icon:SetAlpha(1)
|
cell.icon:SetAlpha(1)
|
||||||
cell:GetFontString():SetAlpha(1)
|
cell:GetFontString():SetAlpha(1)
|
||||||
end
|
end
|
||||||
cell:SetText(gsub(record.link, '[%[%]]', ''))
|
cell.text:SetText(gsub(record.link, '[%[%]]', ''))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.name, record_b.name, desc)
|
return sort_util.compare(record_a.name, record_b.name, desc)
|
||||||
@@ -404,7 +403,7 @@ M.bids_config = {
|
|||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record, count, own, expandable)
|
fill = function(cell, record, count, own, expandable)
|
||||||
local numAuctionsText = expandable and color.link(count) or count
|
local numAuctionsText = expandable and color.link(count) or count
|
||||||
cell:SetText(numAuctionsText)
|
cell.text:SetText(numAuctionsText)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.EQ
|
return sort_util.EQ
|
||||||
@@ -424,7 +423,7 @@ M.bids_config = {
|
|||||||
width = .055,
|
width = .055,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(record.aux_quantity)
|
cell.text:SetText(record.aux_quantity)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
return sort_util.compare(record_a.aux_quantity, record_b.aux_quantity, desc)
|
||||||
@@ -435,7 +434,7 @@ M.bids_config = {
|
|||||||
width = .04,
|
width = .04,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
cell.text:SetText(TIME_LEFT_STRINGS[record.duration or 0] or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
return sort_util.compare(record_a.duration, record_b.duration, desc)
|
||||||
@@ -446,7 +445,7 @@ M.bids_config = {
|
|||||||
width = .13,
|
width = .13,
|
||||||
align = 'CENTER',
|
align = 'CENTER',
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
cell:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
|
cell.text:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
if not record_a.owner and not record_b.owner then
|
if not record_a.owner and not record_b.owner then
|
||||||
@@ -472,7 +471,7 @@ M.bids_config = {
|
|||||||
else
|
else
|
||||||
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
price = aux_price_per_unit and ceil(record.unit_bid_price) or record.bid_price
|
||||||
end
|
end
|
||||||
cell:SetText(money.to_string(price))
|
cell.text:SetText(money.to_string(price))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a
|
local price_a
|
||||||
@@ -497,7 +496,7 @@ M.bids_config = {
|
|||||||
isPrice = true,
|
isPrice = true,
|
||||||
fill = function(cell, record)
|
fill = function(cell, record)
|
||||||
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
local price = aux_price_per_unit and ceil(record.unit_buyout_price) or record.buyout_price
|
||||||
cell:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
cell.text:SetText(price > 0 and money.to_string(price, true, false) or '---')
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
local price_a = aux_price_per_unit and record_a.unit_buyout_price or record_a.buyout_price
|
||||||
@@ -519,7 +518,7 @@ M.bids_config = {
|
|||||||
else
|
else
|
||||||
status = color.red'Outbid'
|
status = color.red'Outbid'
|
||||||
end
|
end
|
||||||
cell:SetText(status)
|
cell.text:SetText(status)
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return sort_util.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
return sort_util.compare(record_a.high_bidder and 1 or 0, record_b.high_bidder and 1 or 0, desc)
|
||||||
@@ -622,13 +621,11 @@ local methods = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- show highlight for this row
|
|
||||||
this.row.highlight:Show()
|
this.row.highlight:Show()
|
||||||
end,
|
end,
|
||||||
|
|
||||||
OnCellLeave = function()
|
OnCellLeave = function()
|
||||||
GameTooltip:Hide()
|
GameTooltip:Hide()
|
||||||
-- hide highlight if it's not selected
|
|
||||||
if not this.rt.selected or this.rt.selected.search_signature ~= this.row.data.record.search_signature then
|
if not this.rt.selected or this.rt.selected.search_signature ~= this.row.data.record.search_signature then
|
||||||
this.row.highlight:Hide()
|
this.row.highlight:Hide()
|
||||||
end
|
end
|
||||||
@@ -664,7 +661,6 @@ local methods = {
|
|||||||
rt.expanded[rowData.expandKey] = expand
|
rt.expanded[rowData.expandKey] = expand
|
||||||
rt:UpdateRowInfo()
|
rt:UpdateRowInfo()
|
||||||
rt:UpdateRows()
|
rt:UpdateRows()
|
||||||
-- select this row if it's not indented
|
|
||||||
if not rowData.indented then
|
if not rowData.indented then
|
||||||
rt:SetSelectedRecord(this.row.data.record)
|
rt:SetSelectedRecord(this.row.data.record)
|
||||||
end
|
end
|
||||||
@@ -687,8 +683,6 @@ local methods = {
|
|||||||
if getn(records) == 0 then return end
|
if getn(records) == 0 then return end
|
||||||
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
sort(records, function(a, b) return a.search_signature < b.search_signature or a.search_signature == b.search_signature and tostring(a) < tostring(b) end)
|
||||||
|
|
||||||
-- Populate the row info from the database by combining identical auctions and auctions
|
|
||||||
-- of the same base item. Also, get the number of rows which will be shown.
|
|
||||||
for i = 1, getn(records) do
|
for i = 1, getn(records) do
|
||||||
local record = records[i]
|
local record = records[i]
|
||||||
local prevRecord = records[i - 1]
|
local prevRecord = records[i - 1]
|
||||||
@@ -723,10 +717,8 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
UpdateRows = function(self)
|
UpdateRows = function(self)
|
||||||
-- hide all the rows
|
|
||||||
for _, row in self.rows do row:Hide() end
|
for _, row in self.rows do row:Hide() end
|
||||||
|
|
||||||
-- update sort_util highlights
|
|
||||||
for _, cell in self.headCells do
|
for _, cell in self.headCells do
|
||||||
local tex = cell:GetNormalTexture()
|
local tex = cell:GetNormalTexture()
|
||||||
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
|
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
|
||||||
@@ -745,7 +737,6 @@ local methods = {
|
|||||||
|
|
||||||
FauxScrollFrame_Update(self.scrollFrame, self.rowInfo.numDisplayRows, getn(self.rows), self.ROW_HEIGHT)
|
FauxScrollFrame_Update(self.scrollFrame, self.rowInfo.numDisplayRows, getn(self.rows), self.ROW_HEIGHT)
|
||||||
|
|
||||||
-- make sure the offset is not too high
|
|
||||||
local maxOffset = max(self.rowInfo.numDisplayRows - getn(self.rows), 0)
|
local maxOffset = max(self.rowInfo.numDisplayRows - getn(self.rows), 0)
|
||||||
if FauxScrollFrame_GetOffset(self.scrollFrame) > maxOffset then
|
if FauxScrollFrame_GetOffset(self.scrollFrame) > maxOffset then
|
||||||
FauxScrollFrame_SetOffset(self.scrollFrame, maxOffset)
|
FauxScrollFrame_SetOffset(self.scrollFrame, maxOffset)
|
||||||
@@ -783,19 +774,16 @@ local methods = {
|
|||||||
self.isSorted = true
|
self.isSorted = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update all the rows
|
|
||||||
local rowIndex = 1 - FauxScrollFrame_GetOffset(self.scrollFrame)
|
local rowIndex = 1 - FauxScrollFrame_GetOffset(self.scrollFrame)
|
||||||
for i = 1, getn(self.rowInfo) do
|
for i = 1, getn(self.rowInfo) do
|
||||||
local info = self.rowInfo[i]
|
local info = self.rowInfo[i]
|
||||||
if self.expanded[info.expandKey] then
|
if self.expanded[info.expandKey] then
|
||||||
-- show each of the rows for this base item since it's expanded
|
|
||||||
for j = 1, getn(info.children) do
|
for j = 1, getn(info.children) do
|
||||||
local childInfo = info.children[j]
|
local childInfo = info.children[j]
|
||||||
self:SetRowInfo(rowIndex, childInfo.record, childInfo.numAuctions, 0, j > 1, false, info.expandKey, childInfo.numAuctions)
|
self:SetRowInfo(rowIndex, childInfo.record, childInfo.numAuctions, 0, j > 1, false, info.expandKey, childInfo.numAuctions)
|
||||||
rowIndex = rowIndex + 1
|
rowIndex = rowIndex + 1
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- just show one row for this base item since it's not expanded
|
|
||||||
self:SetRowInfo(rowIndex, info.children[1].record, info.totalAuctions, getn(info.children) > 1 and info.totalPlayerAuctions or 0, false, getn(info.children) > 1, info.expandKey, info.children[1].numAuctions)
|
self:SetRowInfo(rowIndex, info.children[1].record, info.totalAuctions, getn(info.children) > 1 and info.totalPlayerAuctions or 0, false, getn(info.children) > 1, info.expandKey, info.children[1].numAuctions)
|
||||||
rowIndex = rowIndex + 1
|
rowIndex = rowIndex + 1
|
||||||
end
|
end
|
||||||
@@ -805,7 +793,6 @@ local methods = {
|
|||||||
SetRowInfo = function(self, rowIndex, record, displayNumAuctions, numPlayerAuctions, indented, expandable, expandKey, numAuctions)
|
SetRowInfo = function(self, rowIndex, record, displayNumAuctions, numPlayerAuctions, indented, expandable, expandKey, numAuctions)
|
||||||
if rowIndex <= 0 or rowIndex > getn(self.rows) then return end
|
if rowIndex <= 0 or rowIndex > getn(self.rows) then return end
|
||||||
local row = self.rows[rowIndex]
|
local row = self.rows[rowIndex]
|
||||||
-- show this row
|
|
||||||
row:Show()
|
row:Show()
|
||||||
if self.selected and record.search_signature == self.selected.search_signature then
|
if self.selected and record.search_signature == self.selected.search_signature then
|
||||||
row.highlight:Show()
|
row.highlight:Show()
|
||||||
@@ -822,12 +809,10 @@ local methods = {
|
|||||||
SetSelectedRecord = function(self, record, silent)
|
SetSelectedRecord = function(self, record, silent)
|
||||||
if self.disabled then return end
|
if self.disabled then return end
|
||||||
|
|
||||||
-- make sure the selected record still exists and get the data for the callback
|
|
||||||
self.selected = record
|
self.selected = record
|
||||||
local selectedData = self:GetSelection()
|
local selectedData = self:GetSelection()
|
||||||
self.selected = selectedData and self.selected or nil
|
self.selected = selectedData and self.selected or nil
|
||||||
|
|
||||||
-- show / hide highlight accordingly
|
|
||||||
for _, row in self.rows do
|
for _, row in self.rows do
|
||||||
if self.selected and row.data and row.data.record.search_signature == self.selected.search_signature then
|
if self.selected and row.data and row.data.record.search_signature == self.selected.search_signature then
|
||||||
row.highlight:Show()
|
row.highlight:Show()
|
||||||
@@ -1007,7 +992,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
contentFrame:SetPoint('BOTTOMRIGHT', -15, 0)
|
contentFrame:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||||
rt.contentFrame = contentFrame
|
rt.contentFrame = contentFrame
|
||||||
|
|
||||||
-- frame to hold the header columns and the rows
|
|
||||||
local scrollFrame = CreateFrame('ScrollFrame', gui.unique_name, rt, 'FauxScrollFrameTemplate')
|
local scrollFrame = CreateFrame('ScrollFrame', gui.unique_name, rt, 'FauxScrollFrameTemplate')
|
||||||
scrollFrame:SetScript('OnVerticalScroll', function()
|
scrollFrame:SetScript('OnVerticalScroll', function()
|
||||||
if not rt.scrollDisabled then
|
if not rt.scrollDisabled then
|
||||||
@@ -1031,7 +1015,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||||
|
|
||||||
-- create the header cells
|
|
||||||
rt.headCells = T
|
rt.headCells = T
|
||||||
for i = 1, getn(rt.config) do
|
for i = 1, getn(rt.config) do
|
||||||
local column_config = rt.config[i]
|
local column_config = rt.config[i]
|
||||||
@@ -1075,7 +1058,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
tinsert(rt.headCells, cell)
|
tinsert(rt.headCells, cell)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create the rows
|
|
||||||
rt.rows = T
|
rt.rows = T
|
||||||
for i = 1, numRows do
|
for i = 1, numRows do
|
||||||
local row = CreateFrame('Frame', nil, rt.contentFrame)
|
local row = CreateFrame('Frame', nil, rt.contentFrame)
|
||||||
@@ -1098,12 +1080,12 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
for j = 1, getn(rt.config) do
|
for j = 1, getn(rt.config) do
|
||||||
local cell = CreateFrame('Button', nil, row)
|
local cell = CreateFrame('Button', nil, row)
|
||||||
local text = cell:CreateFontString()
|
local text = cell:CreateFontString()
|
||||||
|
cell.text = text
|
||||||
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
|
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
|
||||||
text:SetJustifyH(rt.config[j].align or 'LEFT')
|
text:SetJustifyH(rt.config[j].align or 'LEFT')
|
||||||
text:SetJustifyV('CENTER')
|
text:SetJustifyV('CENTER')
|
||||||
text:SetPoint('TOPLEFT', 1, -1)
|
text:SetPoint('TOPLEFT', 1, -1)
|
||||||
text:SetPoint('BOTTOMRIGHT', -1, 1)
|
text:SetPoint('BOTTOMRIGHT', -1, 1)
|
||||||
cell:SetFontString(text)
|
|
||||||
cell:SetHeight(rt.ROW_HEIGHT)
|
cell:SetHeight(rt.ROW_HEIGHT)
|
||||||
cell:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
cell:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||||
cell:SetScript('OnEnter', rt.OnCellEnter)
|
cell:SetScript('OnEnter', rt.OnCellEnter)
|
||||||
@@ -1119,7 +1101,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
cell:SetPoint('TOPLEFT', row.cells[j-1], 'TOPRIGHT')
|
cell:SetPoint('TOPLEFT', row.cells[j-1], 'TOPRIGHT')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- slightly different color for every alternating column
|
|
||||||
if mod(j, 2) == 1 then
|
if mod(j, 2) == 1 then
|
||||||
local tex = cell:CreateTexture()
|
local tex = cell:CreateTexture()
|
||||||
tex:SetAllPoints()
|
tex:SetAllPoints()
|
||||||
@@ -1134,7 +1115,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
tinsert(row.cells, cell)
|
tinsert(row.cells, cell)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- slightly different color for every alternating
|
|
||||||
if mod(i, 2) == 0 then
|
if mod(i, 2) == 0 then
|
||||||
local tex = row:CreateTexture()
|
local tex = row:CreateTexture()
|
||||||
tex:SetAllPoints()
|
tex:SetAllPoints()
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ function M.render(item_listing)
|
|||||||
|
|
||||||
if item_record then
|
if item_record then
|
||||||
row.item_record = item_record
|
row.item_record = item_record
|
||||||
if item_listing.selected and item_listing.selected(item_record) then
|
if item_listing.selected and item_listing.selected(item_record) or row.mouseover then
|
||||||
row.highlight:Show()
|
row.highlight:Show()
|
||||||
elseif not row.mouse_over then
|
elseif not row.mouse_over then
|
||||||
row.highlight:Hide()
|
row.highlight:Hide()
|
||||||
@@ -75,9 +75,11 @@ function M.create(parent, on_click, selected)
|
|||||||
row:EnableMouse(true)
|
row:EnableMouse(true)
|
||||||
row:SetScript('OnMouseDown', on_click)
|
row:SetScript('OnMouseDown', on_click)
|
||||||
row:SetScript('OnEnter', function()
|
row:SetScript('OnEnter', function()
|
||||||
|
row.mouseover = true
|
||||||
row.highlight:Show()
|
row.highlight:Show()
|
||||||
end)
|
end)
|
||||||
row:SetScript('OnLeave', function()
|
row:SetScript('OnLeave', function()
|
||||||
|
row.mouseover = false
|
||||||
if not selected(row.item_record) then
|
if not selected(row.item_record) then
|
||||||
row.highlight:Hide()
|
row.highlight:Hide()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -60,22 +60,6 @@ local methods = {
|
|||||||
local offset = FauxScrollFrame_GetOffset(st.scrollFrame)
|
local offset = FauxScrollFrame_GetOffset(st.scrollFrame)
|
||||||
st.offset = offset
|
st.offset = offset
|
||||||
|
|
||||||
-- do sorting if enabled
|
|
||||||
if st.sortInfo.enabled and st.sortInfo.col and st.updateSort then
|
|
||||||
local function SortHelper(rowA, rowB)
|
|
||||||
local sortArgA = rowA.cols[st.sortInfo.col].sortArg
|
|
||||||
local sortArgB = rowB.cols[st.sortInfo.col].sortArg
|
|
||||||
|
|
||||||
if st.sortInfo.ascending then
|
|
||||||
return sortArgA < sortArgB
|
|
||||||
else
|
|
||||||
return sortArgA > sortArgB
|
|
||||||
end
|
|
||||||
end
|
|
||||||
sort(st.rowData, SortHelper)
|
|
||||||
st.updateSort = nil
|
|
||||||
end
|
|
||||||
|
|
||||||
for i = 1, st.sizes.numRows do
|
for i = 1, st.sizes.numRows do
|
||||||
st.rows[i].data = nil
|
st.rows[i].data = nil
|
||||||
if i > getn(st.rowData) then
|
if i > getn(st.rowData) then
|
||||||
@@ -144,21 +128,6 @@ local methods = {
|
|||||||
st.selectionDisabled = value
|
st.selectionDisabled = value
|
||||||
end,
|
end,
|
||||||
|
|
||||||
EnableSorting = function(st, value, defaultCol)
|
|
||||||
st.sortInfo.enabled = value
|
|
||||||
st.sortInfo.col = abs(defaultCol or 1)
|
|
||||||
st.sortInfo.ascending = not defaultCol or defaultCol > 0
|
|
||||||
st.updateSort = true
|
|
||||||
for _, headCol in st.headCols do
|
|
||||||
if value then
|
|
||||||
headCol:EnableMouse(true)
|
|
||||||
else
|
|
||||||
headCol:EnableMouse(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
st:RefreshRows()
|
|
||||||
end,
|
|
||||||
|
|
||||||
DisableHighlight = function(st, value)
|
DisableHighlight = function(st, value)
|
||||||
st.highlightDisabled = value
|
st.highlightDisabled = value
|
||||||
end,
|
end,
|
||||||
@@ -177,15 +146,12 @@ local methods = {
|
|||||||
local height = st:GetHeight()
|
local height = st:GetHeight()
|
||||||
|
|
||||||
if getn(st.colInfo) > 1 or st.colInfo[1].name then
|
if getn(st.colInfo) > 1 or st.colInfo[1].name then
|
||||||
-- there is a header row
|
|
||||||
st.sizes.headHeight = st.sizes.headFontSize and (st.sizes.headFontSize + 4) or ST_HEAD_HEIGHT
|
st.sizes.headHeight = st.sizes.headFontSize and (st.sizes.headFontSize + 4) or ST_HEAD_HEIGHT
|
||||||
else
|
else
|
||||||
-- no header row
|
|
||||||
st.sizes.headHeight = 0
|
st.sizes.headHeight = 0
|
||||||
end
|
end
|
||||||
st.sizes.numRows = max(floor((st:GetParent():GetHeight() - st.sizes.headHeight - ST_HEAD_SPACE) / ST_ROW_HEIGHT), 0)
|
st.sizes.numRows = max(floor((st:GetParent():GetHeight() - st.sizes.headHeight - ST_HEAD_SPACE) / ST_ROW_HEIGHT), 0)
|
||||||
|
|
||||||
-- update the frame
|
|
||||||
st.scrollBar:ClearAllPoints()
|
st.scrollBar:ClearAllPoints()
|
||||||
st.scrollBar:SetPoint('BOTTOMRIGHT', st, -1, 1)
|
st.scrollBar:SetPoint('BOTTOMRIGHT', st, -1, 1)
|
||||||
st.scrollBar:SetPoint('TOPRIGHT', st, -1, -st.sizes.headHeight - ST_HEAD_SPACE - 1)
|
st.scrollBar:SetPoint('TOPRIGHT', st, -1, -st.sizes.headHeight - ST_HEAD_SPACE - 1)
|
||||||
@@ -199,18 +165,15 @@ local methods = {
|
|||||||
st.headLine:Hide()
|
st.headLine:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- update the first row
|
|
||||||
if st.rows and st.rows[1] then
|
if st.rows and st.rows[1] then
|
||||||
st.rows[1]:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
st.rows[1]:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
||||||
st.rows[1]:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
st.rows[1]:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add header columns if necessary
|
|
||||||
while getn(st.headCols) < getn(st.colInfo) do
|
while getn(st.headCols) < getn(st.colInfo) do
|
||||||
st:AddColumn()
|
st:AddColumn()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adjust head col widths
|
|
||||||
for i, col in st.headCols do
|
for i, col in st.headCols do
|
||||||
if st.colInfo[i] then
|
if st.colInfo[i] then
|
||||||
col:Show()
|
col:Show()
|
||||||
@@ -223,19 +186,16 @@ local methods = {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- add more rows if necessary
|
|
||||||
while getn(st.rows) < st.sizes.numRows do
|
while getn(st.rows) < st.sizes.numRows do
|
||||||
st:AddRow()
|
st:AddRow()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- adjust rows widths
|
|
||||||
for i, row in st.rows do
|
for i, row in st.rows do
|
||||||
if i > st.sizes.numRows then
|
if i > st.sizes.numRows then
|
||||||
row.data = nil
|
row.data = nil
|
||||||
row:Hide()
|
row:Hide()
|
||||||
else
|
else
|
||||||
row:Show()
|
row:Show()
|
||||||
-- add any missing cols
|
|
||||||
while getn(row.cols) < getn(st.colInfo) do
|
while getn(row.cols) < getn(st.colInfo) do
|
||||||
st:AddRowCol(i)
|
st:AddRowCol(i)
|
||||||
end
|
end
|
||||||
@@ -340,7 +300,6 @@ local methods = {
|
|||||||
|
|
||||||
SetHeadFontSize = function(st, size)
|
SetHeadFontSize = function(st, size)
|
||||||
st.sizes.headFontSize = size
|
st.sizes.headFontSize = size
|
||||||
-- update the text size of the head cols
|
|
||||||
for _, col in st.headCols do
|
for _, col in st.headCols do
|
||||||
if st.sizes.headFontSize then
|
if st.sizes.headFontSize then
|
||||||
col.text:SetFont(gui.font, st.sizes.headFontSize)
|
col.text:SetFont(gui.font, st.sizes.headFontSize)
|
||||||
@@ -359,18 +318,15 @@ local methods = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function M.CreateScrollingTable(parent)
|
function M.CreateScrollingTable(parent)
|
||||||
-- create the base frame
|
|
||||||
ST_COUNT = ST_COUNT + 1
|
ST_COUNT = ST_COUNT + 1
|
||||||
local st = CreateFrame('Frame', 'TSMScrollingTable' .. ST_COUNT, parent)
|
local st = CreateFrame('Frame', 'TSMScrollingTable' .. ST_COUNT, parent)
|
||||||
st:SetAllPoints()
|
st:SetAllPoints()
|
||||||
-- st:SetScript('OnSizeChanged', function() st:Redraw() end)
|
|
||||||
|
|
||||||
local contentFrame = CreateFrame('Frame', nil, st)
|
local contentFrame = CreateFrame('Frame', nil, st)
|
||||||
contentFrame:SetPoint('TOPLEFT', 0, 0)
|
contentFrame:SetPoint('TOPLEFT', 0, 0)
|
||||||
contentFrame:SetPoint('BOTTOMRIGHT', -15, 0)
|
contentFrame:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||||
st.contentFrame = contentFrame
|
st.contentFrame = contentFrame
|
||||||
|
|
||||||
-- frame to hold the header columns and the rows
|
|
||||||
local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
||||||
scrollFrame:SetScript('OnVerticalScroll', function(self, offset)
|
scrollFrame:SetScript('OnVerticalScroll', function(self, offset)
|
||||||
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
|
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
|
||||||
@@ -389,21 +345,17 @@ function M.CreateScrollingTable(parent)
|
|||||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||||
|
|
||||||
-- create head line at default position
|
|
||||||
st.headLine = gui.horizontal_line(st, 0)
|
st.headLine = gui.horizontal_line(st, 0)
|
||||||
|
|
||||||
-- add all the methods
|
|
||||||
for name, func in methods do
|
for name, func in methods do
|
||||||
st[name] = func
|
st[name] = func
|
||||||
end
|
end
|
||||||
|
|
||||||
-- setup default values
|
|
||||||
st.isTSMScrollingTable = true
|
st.isTSMScrollingTable = true
|
||||||
st.sizes = T
|
st.sizes = T
|
||||||
st.headCols = T
|
st.headCols = T
|
||||||
st.rows = T
|
st.rows = T
|
||||||
st.handlers = T
|
st.handlers = T
|
||||||
st.sortInfo = T
|
|
||||||
st.colInfo = DEFAULT_COL_INFO
|
st.colInfo = DEFAULT_COL_INFO
|
||||||
|
|
||||||
return st
|
return st
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ bid_listing:SetColInfo{
|
|||||||
{name='Bid/ea', width=.4, align='RIGHT'},
|
{name='Bid/ea', width=.4, align='RIGHT'},
|
||||||
{name='Pct', width=.23, align='CENTER'},
|
{name='Pct', width=.23, align='CENTER'},
|
||||||
}
|
}
|
||||||
bid_listing:EnableSorting(false)
|
|
||||||
bid_listing:DisableSelection(true)
|
bid_listing:DisableSelection(true)
|
||||||
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||||
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
|
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
|
||||||
@@ -89,7 +88,6 @@ buyout_listing:SetColInfo{
|
|||||||
{name='Buy/ea', width=.4, align='RIGHT'},
|
{name='Buy/ea', width=.4, align='RIGHT'},
|
||||||
{name='Pct', width=.23, align='CENTER'},
|
{name='Pct', width=.23, align='CENTER'},
|
||||||
}
|
}
|
||||||
buyout_listing:EnableSorting(false)
|
|
||||||
buyout_listing:DisableSelection(true)
|
buyout_listing:DisableSelection(true)
|
||||||
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||||
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
|
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
|
||||||
|
|||||||
@@ -541,7 +541,6 @@ recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
|||||||
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
||||||
|
|
||||||
for listing in temp-S(favorite_searches_listing, recent_searches_listing) do
|
for listing in temp-S(favorite_searches_listing, recent_searches_listing) do
|
||||||
listing:EnableSorting(false)
|
|
||||||
listing:DisableSelection(true)
|
listing:DisableSelection(true)
|
||||||
for k, v in handlers do
|
for k, v in handlers do
|
||||||
listing:SetHandler(k, v)
|
listing:SetHandler(k, v)
|
||||||
|
|||||||
Reference in New Issue
Block a user