From c6b8a904be8e920271ee4e197a2488778db960b8 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Sun, 4 Dec 2016 13:26:06 +0100 Subject: [PATCH] consistent table header style --- gui/auction_listing.lua | 3 +-- gui/listing.lua | 50 +++++++++++++---------------------------- tabs/post/frame.lua | 20 ++++++++--------- tabs/search/frame.lua | 2 +- 4 files changed, 27 insertions(+), 48 deletions(-) diff --git a/gui/auction_listing.lua b/gui/auction_listing.lua index e219412..ab2b839 100644 --- a/gui/auction_listing.lua +++ b/gui/auction_listing.lua @@ -1023,7 +1023,7 @@ function M.CreateAuctionResultsTable(parent, config) if i == 1 then cell:SetPoint('TOPLEFT', 0, 0) else - cell:SetPoint('TOPLEFT', rt.headCells[i-1], 'TOPRIGHT') + cell:SetPoint('TOPLEFT', rt.headCells[i - 1], 'TOPRIGHT') end cell.info = column_config cell.rt = rt @@ -1034,7 +1034,6 @@ function M.CreateAuctionResultsTable(parent, config) local text = cell:CreateFontString() text:SetJustifyH('CENTER') - text:SetJustifyV('CENTER') text:SetFont(gui.font, 12) text:SetTextColor(color.label.enabled()) cell:SetFontString(text) diff --git a/gui/listing.lua b/gui/listing.lua index d02f6cb..4ed2b12 100644 --- a/gui/listing.lua +++ b/gui/listing.lua @@ -9,7 +9,7 @@ local ST_COUNT = 0 local ST_ROW_HEIGHT = 15 local ST_ROW_TEXT_SIZE = 14 -local ST_HEAD_HEIGHT = 26.3 +local ST_HEAD_HEIGHT = 27 local ST_HEAD_SPACE = 2 local DEFAULT_COL_INFO = {{width=1}} @@ -143,10 +143,9 @@ local methods = { Redraw = function(st) local width = st:GetWidth() - 14 - local height = st:GetHeight() if getn(st.colInfo) > 1 or st.colInfo[1].name then - st.sizes.headHeight = st.sizes.headFontSize and (st.sizes.headFontSize + 4) or ST_HEAD_HEIGHT + st.sizes.headHeight = ST_HEAD_HEIGHT else st.sizes.headHeight = 0 end @@ -156,15 +155,6 @@ local methods = { st.scrollBar:SetPoint('BOTTOMRIGHT', st, -1, 1) st.scrollBar:SetPoint('TOPRIGHT', st, -1, -st.sizes.headHeight - ST_HEAD_SPACE - 1) - if st.sizes.headHeight > 0 then - st.headLine:Show() - st.headLine:ClearAllPoints() - st.headLine:SetPoint('TOPLEFT', 2, -st.sizes.headHeight) - st.headLine:SetPoint('TOPRIGHT', -2, -st.sizes.headHeight) - else - st.headLine:Hide() - end - if st.rows and st.rows[1] then st.rows[1]:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE)) st.rows[1]:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE)) @@ -179,7 +169,7 @@ local methods = { col:Show() col:SetWidth(st.colInfo[i].width * width) col:SetHeight(st.sizes.headHeight) - col.text:SetText(st.colInfo[i].name or "") + col.text:SetText(st.colInfo[i].name or '') col.text:SetJustifyH(st.colInfo[i].headAlign or 'CENTER') else col:Hide() @@ -218,21 +208,25 @@ local methods = { local colNum = getn(st.headCols) + 1 local col = CreateFrame('Frame', st:GetName() .. 'HeadCol' .. colNum, st.contentFrame) if colNum == 1 then - col:SetPoint('TOPLEFT', 0, -1) + col:SetPoint('TOPLEFT', 0, 0) else col:SetPoint('TOPLEFT', st.headCols[colNum - 1], 'TOPRIGHT') end col.st = st col.colNum = colNum - local text = col:CreateFontString() - text:SetAllPoints() - text:SetJustifyV('CENTER') - text:SetFont(gui.font, 16) - text:SetTextColor(color.text.enabled()) - text:SetAllPoints() + local text = col:CreateFontString() + text:SetAllPoints() + text:SetFont(gui.font, 12) + text:SetTextColor(color.label.enabled()) col.text = text + local tex = col:CreateTexture() + tex:SetAllPoints() + tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]) + tex:SetTexCoord(.017, 1, .083, .909) + tex:SetAlpha(.5) + tinsert(st.headCols, col) -- add new cells to the rows @@ -298,18 +292,6 @@ local methods = { st.handlers[event] = handler end, - SetHeadFontSize = function(st, size) - st.sizes.headFontSize = size - for _, col in st.headCols do - if st.sizes.headFontSize then - col.text:SetFont(gui.font, st.sizes.headFontSize) - else - col.text:SetFont(gui.font, gui.font_size.medium) - end - end - st:Redraw() - end, - SetColInfo = function(st, colInfo) colInfo = colInfo or DEFAULT_COL_INFO st.colInfo = colInfo @@ -328,7 +310,7 @@ function M.CreateScrollingTable(parent) st.contentFrame = contentFrame local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate') - scrollFrame:SetScript('OnVerticalScroll', function(self, offset) + scrollFrame:SetScript('OnVerticalScroll', function() FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end) end) scrollFrame:SetAllPoints(contentFrame) @@ -345,8 +327,6 @@ function M.CreateScrollingTable(parent) _G[scrollBar:GetName() .. 'ScrollUpButton']:Hide() _G[scrollBar:GetName() .. 'ScrollDownButton']:Hide() - st.headLine = gui.horizontal_line(st, 0) - for name, func in methods do st[name] = func end diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index de2cb36..1b1d008 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -69,11 +69,11 @@ inventory_listing = item_listing.create( bid_listing = listing.CreateScrollingTable(frame.bid_listing) bid_listing:SetColInfo{ - {name='#', width=.15, align='CENTER'}, - {name='Left', width=.11, align='CENTER'}, - {name='Qty', width=.11, align='CENTER'}, - {name='Bid/ea', width=.4, align='RIGHT'}, - {name='Pct', width=.23, align='CENTER'}, + {name='Auctions', width=.17, align='CENTER'}, + {name='Time Left', width=.11, align='CENTER'}, + {name='Stack Size', width=.11, align='CENTER'}, + {name='Auction Bid|n (per item)', width=.4, align='RIGHT'}, + {name='% Hist. Value', width=.21, align='CENTER'}, } bid_listing:DisableSelection(true) bid_listing:SetHandler('OnClick', function(table, row_data, column, button) @@ -82,11 +82,11 @@ end) buyout_listing = listing.CreateScrollingTable(frame.buyout_listing) buyout_listing:SetColInfo{ - {name='#', width=.15, align='CENTER'}, - {name='Left', width=.11, align='CENTER'}, - {name='Qty', width=.11, align='CENTER'}, - {name='Buy/ea', width=.4, align='RIGHT'}, - {name='Pct', width=.23, align='CENTER'}, + {name='Auctions', width=.17, align='CENTER'}, + {name='Time Left', width=.11, align='CENTER'}, + {name='Stack Size', width=.12, align='CENTER'}, + {name='Auction Buyout|n (per item)', width=.4, align='RIGHT'}, + {name='% Hist. Value', width=.20, align='CENTER'}, } buyout_listing:DisableSelection(true) buyout_listing:SetHandler('OnClick', function(table, row_data, column, button) diff --git a/tabs/search/frame.lua b/tabs/search/frame.lua index a1c2f1b..e195253 100644 --- a/tabs/search/frame.lua +++ b/tabs/search/frame.lua @@ -535,7 +535,7 @@ for _ = 1, 5 do end favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite) -favorite_searches_listing:SetColInfo{{name='Auto', width=.1, align='CENTER'}, {name='Favorite Searches', width=.9}} +favorite_searches_listing:SetColInfo{{name='Auto Buy', width=.07, align='CENTER'}, {name='Favorite Searches', width=.93}} recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent) recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}