table refactoring finished
This commit is contained in:
+17
-12
@@ -48,7 +48,6 @@ function private.item_column_init(rt, cell)
|
|||||||
end
|
end
|
||||||
|
|
||||||
public.search_config = {
|
public.search_config = {
|
||||||
rows = 16,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = 0.35,
|
width = 0.35,
|
||||||
@@ -135,7 +134,15 @@ public.search_config = {
|
|||||||
cell:SetText(Aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') or (record.owner or '---'))
|
cell:SetText(Aux.is_player(record.owner) and ('|cffffff00'..record.owner..'|r') or (record.owner or '---'))
|
||||||
end,
|
end,
|
||||||
cmp = function(record_a, record_b, desc)
|
cmp = function(record_a, record_b, desc)
|
||||||
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
|
if not record_a.owner and not record_b.owner then
|
||||||
|
return Aux.sort.EQ
|
||||||
|
elseif not record_a.owner then
|
||||||
|
return Aux.sort.GT
|
||||||
|
elseif not record_b.owner then
|
||||||
|
return Aux.sort.LT
|
||||||
|
else
|
||||||
|
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -209,7 +216,6 @@ public.search_config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public.auctions_config = {
|
public.auctions_config = {
|
||||||
rows = 16,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = 0.35,
|
width = 0.35,
|
||||||
@@ -343,10 +349,10 @@ public.auctions_config = {
|
|||||||
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
|
||||||
return Aux.sort.EQ
|
return Aux.sort.EQ
|
||||||
elseif record_a.high_bidder then
|
elseif not record_a.high_bidder then
|
||||||
return Aux.sort.LT
|
|
||||||
elseif record_b.high_bidder then
|
|
||||||
return Aux.sort.GT
|
return Aux.sort.GT
|
||||||
|
elseif not record_b.high_bidder then
|
||||||
|
return Aux.sort.LT
|
||||||
else
|
else
|
||||||
return Aux.sort.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
return Aux.sort.compare(record_a.high_bidder, record_b.high_bidder, desc)
|
||||||
end
|
end
|
||||||
@@ -355,7 +361,6 @@ public.auctions_config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public.bids_config = {
|
public.bids_config = {
|
||||||
rows = 16,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = 0.35,
|
width = 0.35,
|
||||||
@@ -430,10 +435,10 @@ public.bids_config = {
|
|||||||
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
|
||||||
return Aux.sort.EQ
|
return Aux.sort.EQ
|
||||||
elseif record_a.owner then
|
elseif not record_a.owner then
|
||||||
return Aux.sort.LT
|
|
||||||
elseif record_b.owner then
|
|
||||||
return Aux.sort.GT
|
return Aux.sort.GT
|
||||||
|
elseif not record_b.owner then
|
||||||
|
return Aux.sort.LT
|
||||||
else
|
else
|
||||||
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
|
return Aux.sort.compare(record_a.owner, record_b.owner, desc)
|
||||||
end
|
end
|
||||||
@@ -644,7 +649,7 @@ local methods = {
|
|||||||
DressUpItemLink(this.row.data.record.hyperlink)
|
DressUpItemLink(this.row.data.record.hyperlink)
|
||||||
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
|
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
|
||||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||||
elseif button == 'RightButton' then -- TODO not when alt (how?)
|
elseif Aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||||
Aux.search_frame.start_search(strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
Aux.search_frame.start_search(strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||||
else
|
else
|
||||||
local selection = this.rt:GetSelection()
|
local selection = this.rt:GetSelection()
|
||||||
@@ -1002,7 +1007,7 @@ function public.CreateAuctionResultsTable(parent, config)
|
|||||||
local rt = CreateFrame('Frame', rtName, parent)
|
local rt = CreateFrame('Frame', rtName, parent)
|
||||||
rt.config = config
|
rt.config = config
|
||||||
-- local numRows = TSM.db.profile.auctionResultRows
|
-- local numRows = TSM.db.profile.auctionResultRows
|
||||||
local numRows = config.rows
|
local numRows = 16
|
||||||
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows
|
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows
|
||||||
rt.scrollDisabled = nil
|
rt.scrollDisabled = nil
|
||||||
rt.expanded = {}
|
rt.expanded = {}
|
||||||
|
|||||||
@@ -390,6 +390,10 @@ function Aux.is_player(name)
|
|||||||
return UnitName('player') == name -- TODO support multiple chars
|
return UnitName('player') == name -- TODO support multiple chars
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Aux.unmodified()
|
||||||
|
return not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown()
|
||||||
|
end
|
||||||
|
|
||||||
Aux.orig = {}
|
Aux.orig = {}
|
||||||
function Aux.hook(name, handler, object)
|
function Aux.hook(name, handler, object)
|
||||||
local orig
|
local orig
|
||||||
|
|||||||
Reference in New Issue
Block a user