refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-04 21:21:47 +02:00
parent e888efcf2a
commit 867505c1a8
23 changed files with 172 additions and 173 deletions
+8 -8
View File
@@ -94,7 +94,7 @@ public.search_config = {
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and color.link(count) or count
if own > 0 then
numAuctionsText = numAuctionsText..(' '..color.yellow('('..own..')'))
numAuctionsText = numAuctionsText .. (' ' .. color.yellow('(' .. own .. ')'))
end
cell:SetText(numAuctionsText)
end,
@@ -262,7 +262,7 @@ public.auctions_config = {
width = .06,
align = 'CENTER',
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
local numAuctionsText = expandable and inline_color.link .. count .. FONT_COLOR_CODE_CLOSE or count
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
@@ -396,7 +396,7 @@ public.bids_config = {
width = .06,
align = 'CENTER',
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and inline_color.link..count..FONT_COLOR_CODE_CLOSE or count
local numAuctionsText = expandable and inline_color.link .. count .. FONT_COLOR_CODE_CLOSE or count
cell:SetText(numAuctionsText)
end,
cmp = function(record_a, record_b, desc)
@@ -541,7 +541,7 @@ function percentage_color(pct)
end
function public.percentage_historical(pct, bid)
return (bid and inline_color.gray or percentage_color(pct))..(pct > 10000 and '>10000' or pct)..'%'..FONT_COLOR_CODE_CLOSE
return (bid and inline_color.gray or percentage_color(pct)) .. (pct > 10000 and '>10000' or pct) .. '%' .. FONT_COLOR_CODE_CLOSE
end
function public.time_left(code)
@@ -636,7 +636,7 @@ local methods = {
ChatFrameEditBox:Insert(this.row.data.record.link)
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
tab = 1
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name)..'/exact')
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
else
local selection = this.rt:GetSelection()
@@ -1019,7 +1019,7 @@ function public.CreateAuctionResultsTable(parent, config)
rt.scrollFrame = scrollFrame
FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT)
local scrollBar = _G[scrollFrame:GetName()..'ScrollBar']
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
scrollBar:ClearAllPoints()
scrollBar:SetPoint('BOTTOMRIGHT', rt, -4, 4)
scrollBar:SetPoint('TOPRIGHT', rt, -4, -HEAD_HEIGHT)
@@ -1029,8 +1029,8 @@ function public.CreateAuctionResultsTable(parent, config)
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(150)
thumbTex:SetWidth(scrollBar:GetWidth())
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
-- create the header cells
rt.headCells = t
+14 -14
View File
@@ -33,20 +33,20 @@ function LOAD()
DropDownList1:ClearAllPoints()
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button'..i]
local button = _G['DropDownList1Button' .. i]
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString()
text:SetFont(font, font_size.small2)
text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = _G['DropDownList1Button'..i..'Highlight']
local highlight = _G['DropDownList1Button' .. i..'Highlight']
highlight:ClearAllPoints()
highlight:SetDrawLayer('OVERLAY')
highlight:SetHeight(14)
highlight:SetPoint('LEFT', 5, 0)
highlight:SetPoint('RIGHT', -3, 0)
local check = _G['DropDownList1Button'..i..'Check']
local check = _G['DropDownList1Button' .. i..'Check']
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint('LEFT', 3, -1)
@@ -58,14 +58,14 @@ function LOAD()
aux_border:Hide()
aux_background:Hide()
for i = 1, UIDROPDOWNMENU_MAXBUTTONS do
local button = _G['DropDownList1Button'..i]
local button = _G['DropDownList1Button' .. i]
local text = button:GetFontString()
text:SetFont([[Fonts\FRIZQT__.ttf]], 10)
text:SetShadowOffset(1, -1)
local highlight = _G['DropDownList1Button'..i..'Highlight']
local highlight = _G['DropDownList1Button' .. i..'Highlight']
highlight:SetAllPoints()
highlight:SetDrawLayer('BACKGROUND')
local check = _G['DropDownList1Button'..i..'Check']
local check = _G['DropDownList1Button' .. i..'Check']
check:SetWidth(24)
check:SetHeight(24)
check:SetPoint('LEFT', 0, 0)
@@ -90,7 +90,7 @@ do
local id = 1
function public.name.get()
id = id + 1
return 'aux_frame'..id
return 'aux_frame' .. id
end
end
@@ -454,13 +454,13 @@ function public.item(parent)
btn:SetPoint('LEFT', 2, .5)
btn:SetHighlightTexture(nil)
btn:RegisterForClicks()
item.texture = _G[btn:GetName()..'Icon']
item.texture = _G[btn:GetName() .. 'Icon']
item.texture:SetTexCoord(.06, .94, .06, .94)
item.name = label(btn, 15)
item.name:SetJustifyH('LEFT')
item.name:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, .5)
item.count = _G[btn:GetName()..'Count']
item.count = _G[btn:GetName() .. 'Count']
item.count:SetTextHeight(17)
return item
end
@@ -502,17 +502,17 @@ function public.dropdown(parent)
local dropdown = CreateFrame('Frame', name, parent, 'UIDropDownMenuTemplate')
set_content_style(dropdown, 0, 0, 4, 4)
_G[dropdown:GetName()..'Left']:Hide()
_G[dropdown:GetName()..'Middle']:Hide()
_G[dropdown:GetName()..'Right']:Hide()
_G[dropdown:GetName() .. 'Left']:Hide()
_G[dropdown:GetName() .. 'Middle']:Hide()
_G[dropdown:GetName() .. 'Right']:Hide()
local button = _G[dropdown:GetName()..'Button']
local button = _G[dropdown:GetName() .. 'Button']
button:ClearAllPoints()
button:SetScale(.9)
button:SetPoint('RIGHT', dropdown, 0, 0)
dropdown.button = button
local text = _G[dropdown:GetName()..'Text']
local text = _G[dropdown:GetName() .. 'Text']
text:ClearAllPoints()
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
text:SetPoint('LEFT', 8, 0)
+5 -5
View File
@@ -21,7 +21,7 @@ function public.render(item_listing)
row.highlight:Hide()
end
row.item.texture:SetTexture(item_record.texture)
row.item.name:SetText('['..item_record.name..']')
row.item.name:SetText('[' .. item_record.name .. ']')
local color = ITEM_QUALITY_COLORS[item_record.quality]
row.item.name:SetTextColor(color.r, color.g, color.b)
if item_record.aux_quantity > 1 then
@@ -41,22 +41,22 @@ function public.create(parent, on_click, selected)
content:SetPoint('TOPLEFT', 0, -51)
content:SetPoint('BOTTOMRIGHT', -15, 0)
local scroll_frame = CreateFrame('ScrollFrame', gui.name..'ScrollFrame', parent, 'FauxScrollFrameTemplate')
local scroll_frame = CreateFrame('ScrollFrame', gui.name .. 'ScrollFrame', parent, 'FauxScrollFrameTemplate')
scroll_frame:SetScript('OnVerticalScroll', function(self, offset)
FauxScrollFrame_OnVerticalScroll(ROW_HEIGHT, function() render(this.item_listing) end)
end)
scroll_frame:SetPoint('TOPLEFT', content, 'TOPLEFT', 0, 15)
scroll_frame:SetPoint('BOTTOMRIGHT', content, 'BOTTOMRIGHT', -4, -15)
local scrollBar = _G[scroll_frame:GetName()..'ScrollBar']
local scrollBar = _G[scroll_frame:GetName() .. 'ScrollBar']
scrollBar:SetWidth(12)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
local rows = t
local row_index = 1
+6 -6
View File
@@ -292,7 +292,7 @@ local methods = {
AddColumn = function(st)
local colNum = getn(st.headCols) + 1
local col = CreateFrame('Button', st:GetName()..'HeadCol'..colNum, st.contentFrame)
local col = CreateFrame('Button', st:GetName() .. 'HeadCol' .. colNum, st.contentFrame)
if colNum == 1 then
col:SetPoint('TOPLEFT', 0, -1)
else
@@ -407,7 +407,7 @@ local methods = {
function public.CreateScrollingTable(parent)
-- create the base frame
ST_COUNT = ST_COUNT + 1
local st = CreateFrame('Frame', 'TSMScrollingTable'..ST_COUNT, parent)
local st = CreateFrame('Frame', 'TSMScrollingTable' .. ST_COUNT, parent)
st:SetAllPoints()
-- st:SetScript('OnSizeChanged', function() st:Redraw() end)
@@ -417,14 +417,14 @@ function public.CreateScrollingTable(parent)
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)
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
end)
scrollFrame:SetAllPoints(contentFrame)
st.scrollFrame = scrollFrame
local scrollBar = _G[scrollFrame:GetName()..'ScrollBar']
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
scrollBar:SetWidth(12)
st.scrollBar = scrollBar
local thumbTex = scrollBar:GetThumbTexture()
@@ -432,8 +432,8 @@ function public.CreateScrollingTable(parent)
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
_G[scrollBar:GetName()..'ScrollUpButton']:Hide()
_G[scrollBar:GetName()..'ScrollDownButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
-- create head line at default position
st.headLine = gui.horizontal_line(st, 0)