refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-12-10 18:35:04 +01:00
parent ab343b6094
commit 20c6b7b37e
5 changed files with 17 additions and 22 deletions
+9 -11
View File
@@ -17,21 +17,19 @@ function C(r, g, b, a)
return setmetatable(T, mt)
end
W = wrapper
M.color = W-{
text = W-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
label = W-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
M.color = immutable-{
text = immutable-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
label = immutable-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
link = C(153, 255, 255, 1),
window = W-{background = C(24, 24, 24, .93), border = C(30, 30, 30, 1)},
panel = W-{background = C(24, 24, 24, 1), border = C(255, 255, 255, .03)},
content = W-{background = C(42, 42, 42, 1), border = C(0, 0, 0, 0)},
state = W-{enabled = C(70, 140, 70, 1), disabled = C(140, 70, 70, 1)},
window = immutable-{background = C(24, 24, 24, .93), border = C(30, 30, 30, 1)},
panel = immutable-{background = C(24, 24, 24, 1), border = C(255, 255, 255, .03)},
content = immutable-{background = C(42, 42, 42, 1), border = C(0, 0, 0, 0)},
state = immutable-{enabled = C(70, 140, 70, 1), disabled = C(140, 70, 70, 1)},
tooltip = W-{
tooltip = immutable-{
value = C(255, 255, 154, 1),
merchant = C(204, 127, 25, 1),
disenchant = W-{
disenchant = immutable-{
value = C(25, 153, 153, 1),
distribution = C(204, 204, 51, 1),
source = C(178, 178, 178, 1),
+5 -8
View File
@@ -73,7 +73,6 @@ function item_column_fill(cell, record, _, _, _, indented)
end
M.search_config = {
rows = 16,
{
title = 'Item',
width = .35,
@@ -244,7 +243,6 @@ M.search_config = {
}
M.auctions_config = {
rows = 20,
{
title = 'Item',
width = .35,
@@ -380,7 +378,6 @@ M.auctions_config = {
}
M.bids_config = {
rows = 20,
{
title = 'Item',
width = .35,
@@ -799,7 +796,7 @@ local methods = {
end
row.data = {record=record, expandable=expandable, indented=indented, numAuctions=numAuctions, expandKey=expandKey}
for i, column_config in ipairs(self.config) do
for i, column_config in self.config do
column_config.fill(row.cells[i], record, displayNumAuctions, numPlayerAuctions, expandable, indented)
end
end,
@@ -911,10 +908,10 @@ local methods = {
end,
}
function M.new(parent, config)
function M.new(parent, rows, config)
local rt = CreateFrame('Frame', nil, parent)
rt.config = config
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / config.rows
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / rows
rt.expanded = T
rt.handlers = T
rt.sorts = T
@@ -944,7 +941,7 @@ function M.new(parent, config)
end)
scrollFrame:SetAllPoints(contentFrame)
rt.scrollFrame = scrollFrame
FauxScrollFrame_Update(rt.scrollFrame, 0, config.rows, rt.ROW_HEIGHT)
FauxScrollFrame_Update(rt.scrollFrame, 0, rows, rt.ROW_HEIGHT)
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
scrollBar:ClearAllPoints()
@@ -1002,7 +999,7 @@ function M.new(parent, config)
end
rt.rows = T
for i = 1, config.rows do
for i = 1, rows do
local row = CreateFrame('Frame', nil, rt.contentFrame)
row:SetHeight(rt.ROW_HEIGHT)
if i == 1 then
+1 -1
View File
@@ -13,7 +13,7 @@ frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.new(frame.listing, auction_listing.auctions_config)
listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_config)
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button)
+1 -1
View File
@@ -13,7 +13,7 @@ frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
listing = auction_listing.new(frame.listing, auction_listing.bids_config)
listing = auction_listing.new(frame.listing, 20, auction_listing.bids_config)
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button)
+1 -1
View File
@@ -516,7 +516,7 @@ for _ = 1, 5 do
status_bar:Hide()
tinsert(status_bars, status_bar)
local table = auction_listing.new(frame.results, auction_listing.search_config)
local table = auction_listing.new(frame.results, 16, auction_listing.search_config)
table:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
if button == 'LeftButton' then