big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-22 22:50:37 +02:00
parent f1b7c3ef4a
commit 7faab39013
8 changed files with 48 additions and 48 deletions
+23 -23
View File
@@ -8,18 +8,18 @@ local HEAD_SPACE = 2
function LOAD()
AUCTION_PCT_COLORS = {
{color=gui.inline_color.blue, value=50},
{color=gui.inline_color.green, value=80},
{color=gui.inline_color.yellow, value=110},
{color=gui.inline_color.orange, value=135},
{color=gui.inline_color.red, value=huge},
{color=inline_color.blue, value=50},
{color=inline_color.green, value=80},
{color=inline_color.yellow, value=110},
{color=inline_color.orange, value=135},
{color=inline_color.red, value=huge},
}
TIME_LEFT_STRINGS = {
gui.color.red '30m', -- Short
gui.color.orange '2h', -- Medium
gui.color.yellow '8h', -- Long
gui.color.blue '24h', -- Very Long
color.red '30m', -- Short
color.orange '2h', -- Medium
color.yellow '8h', -- Long
color.blue '24h', -- Very Long
}
end
@@ -80,7 +80,7 @@ public.search_config = {
align = 'CENTER',
fill = function(cell, record)
local display_level = max(record.level, 1)
display_level = UnitLevel('player') < record.level and gui.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)
end,
cmp = function(record_a, record_b, desc)
@@ -92,9 +92,9 @@ public.search_config = {
width = 0.06,
align = 'CENTER',
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and gui.color.link(count) or count
local numAuctionsText = expandable and color.link(count) or count
if own > 0 then
numAuctionsText = numAuctionsText..(' '..gui.color.yellow('('..own..')'))
numAuctionsText = numAuctionsText..(' '..color.yellow('('..own..')'))
end
cell:SetText(numAuctionsText)
end,
@@ -138,7 +138,7 @@ public.search_config = {
width = 0.13,
align = 'CENTER',
fill = function(cell, record)
cell:SetText(is_player(record.owner) and (gui.color.yellow(record.owner)) or (record.owner or '---'))
cell:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
end,
cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then
@@ -250,7 +250,7 @@ public.auctions_config = {
align = 'CENTER',
fill = function(cell, record)
local display_level = max(record.level, 1)
display_level = UnitLevel('player') < record.level and gui.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)
end,
cmp = function(record_a, record_b, desc)
@@ -262,7 +262,7 @@ public.auctions_config = {
width = 0.06,
align = 'CENTER',
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and gui.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)
@@ -353,7 +353,7 @@ public.auctions_config = {
width = 0.21,
align = 'CENTER',
fill = function(cell, record)
cell:SetText(record.high_bidder or gui.color.red 'No Bids')
cell:SetText(record.high_bidder or color.red 'No Bids')
end,
cmp = function(record_a, record_b, desc)
if not record_a.high_bidder and not record_b.high_bidder then
@@ -396,7 +396,7 @@ public.bids_config = {
width = 0.06,
align = 'CENTER',
fill = function(cell, record, count, own, expandable)
local numAuctionsText = expandable and gui.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)
@@ -439,7 +439,7 @@ public.bids_config = {
width = 0.13,
align = 'CENTER',
fill = function(cell, record)
cell:SetText(is_player(record.owner) and (gui.color.yellow(record.owner)) or (record.owner or '---'))
cell:SetText(is_player(record.owner) and (color.yellow(record.owner)) or (record.owner or '---'))
end,
cmp = function(record_a, record_b, desc)
if not record_a.owner and not record_b.owner then
@@ -508,9 +508,9 @@ public.bids_config = {
fill = function(cell, record)
local status
if record.high_bidder then
status = gui.color.yellow 'High Bidder'
status = color.yellow 'High Bidder'
else
status = gui.color.red 'Outbid'
status = color.red 'Outbid'
end
cell:SetText(status)
end,
@@ -541,7 +541,7 @@ function percentage_color(pct)
end
function public.percentage_historical(pct, bid)
return (bid and gui.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)
@@ -1038,7 +1038,7 @@ function public.CreateAuctionResultsTable(parent, config)
scrollBar:SetWidth(10)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(gui.color.content.background))
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(150)
thumbTex:SetWidth(scrollBar:GetWidth())
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -1065,7 +1065,7 @@ function public.CreateAuctionResultsTable(parent, config)
text:SetJustifyH 'CENTER'
text:SetJustifyV 'CENTER'
text:SetFont(gui.config.font, 12)
text:SetTextColor(unpack(gui.color.label.enabled))
text:SetTextColor(color.label.enabled())
cell:SetFontString(text)
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
text:SetAllPoints()
+1 -1
View File
@@ -52,7 +52,7 @@ function public.create(parent, on_click, selected)
scrollBar:SetWidth(12)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(gui.color.content.background())
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
+2 -2
View File
@@ -306,7 +306,7 @@ local methods = {
local text = col:CreateFontString()
text:SetJustifyV('CENTER')
text:SetFont(gui.config.font, 16)
text:SetTextColor(unpack(gui.color.text.enabled))
text:SetTextColor(color.text.enabled())
text:SetAllPoints()
col.text = text
col:SetFontString(text)
@@ -429,7 +429,7 @@ function public.CreateScrollingTable(parent)
st.scrollBar = scrollBar
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
thumbTex:SetTexture(unpack(gui.color.content.background))
thumbTex:SetTexture(color.content.background())
thumbTex:SetHeight(50)
thumbTex:SetWidth(12)
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
+3 -3
View File
@@ -135,9 +135,9 @@ function update_auction_listing()
tinsert(auction_rows, {
cols = {
{value=auction_record.own and gui.color.yellow(auction_record.count) or auction_record.count},
{value=auction_record.own and color.yellow(auction_record.count) or auction_record.count},
{value=auction_listing.time_left(auction_record.duration)},
{value=auction_record.stack_size == stack_size and gui.color.yellow(auction_record.stack_size) or auction_record.stack_size},
{value=auction_record.stack_size == stack_size and color.yellow(auction_record.stack_size) or auction_record.stack_size},
{value=money.to_string(auction_record.unit_blizzard_bid, true, nil, 3, bid_color) },
{value=historical_value and auction_listing.percentage_historical(round(auction_record.unit_blizzard_bid / historical_value * 100)) or '---'},
{value=auction_record.unit_buyout_price > 0 and money.to_string(auction_record.unit_buyout_price, true, nil, 3, buyout_color) or '---'},
@@ -273,7 +273,7 @@ function update_item_configuration()
item.texture:SetTexture(nil)
item.count:SetText()
item.name:SetTextColor(unpack(gui.color.label.enabled))
item.name:SetTextColor(color.label.enabled())
item.name:SetText('No item selected')
start_price_frame:Hide()
+2 -2
View File
@@ -251,7 +251,7 @@ function create_frames()
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(gui.color.text.enabled())
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
@@ -303,7 +303,7 @@ function create_frames()
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(gui.color.text.enabled())
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
+2 -2
View File
@@ -195,12 +195,12 @@ function public.formatted_post_filter(components)
elseif i > 1 then
str = str..'</p><p>'
for _=1,getn(stack) do
str = str..gui.color.content.background('----')
str = str..color.content.background('----')
end
end
no_line_break = component[1] == 'operator' and component[2] == 'not'
local filter_color = (filter_builder_state.selected == i and gui.color.orange or gui.color.aux)
local filter_color = (filter_builder_state.selected == i and color.orange or color.aux)
local component_text = filter_color(component[2])
if component[1] == 'operator' and component[2] ~= 'not' then
component_text = component_text..filter_color(tonumber(component[3]) or '')
+7 -7
View File
@@ -54,7 +54,7 @@ function create_frames()
do
local panel = CreateFrame('Frame', nil, frame)
panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]}
panel:SetBackdropColor(unpack(gui.color.content.background))
panel:SetBackdropColor(color.content.background())
panel:SetPoint('LEFT', settings_button, 'RIGHT', 0, 0)
panel:SetPoint('RIGHT', 0, 0)
panel:SetHeight(42)
@@ -76,9 +76,9 @@ function create_frames()
this:SetText(valid_input)
end
if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
this:SetBackdropColor(gui.color.state.enabled())
this:SetBackdropColor(color.state.enabled())
else
this:SetBackdropColor(gui.color.state.disabled())
this:SetBackdropColor(color.state.disabled())
end
end
do
@@ -92,7 +92,7 @@ function create_frames()
local label = gui.label(editbox, 16)
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages')
label:SetTextColor(gui.color.text.enabled())
label:SetTextColor(color.text.enabled())
first_page_input = editbox
end
do
@@ -106,7 +106,7 @@ function create_frames()
local label = gui.label(editbox, gui.config.medium_font_size)
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(gui.color.text.enabled())
label:SetTextColor(color.text.enabled())
last_page_input = editbox
end
end
@@ -217,7 +217,7 @@ function create_frames()
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
btn:SetWidth(70)
btn:SetHeight(25)
btn:SetText(gui.color.green 'Resume')
btn:SetText(color.green 'Resume')
btn:SetScript('OnClick', function()
execute(true)
end)
@@ -579,7 +579,7 @@ function create_frames()
local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame)
scroll_frame:SetScrollChild(scroll_child)
scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], 23)
scroll_child:SetTextColor('p', gui.color.label.enabled())
scroll_child:SetTextColor('p', color.label.enabled())
scroll_child:SetWidth(1)
scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', data_link_click)
+8 -8
View File
@@ -443,38 +443,38 @@ function prettified_query_string(components)
for key, filter in components.blizzard do
if key == 'exact' then
prettified.prepend(info.display_name(cache.item_id(components.blizzard.name[2])) or gui.color.blizzard('['..components.blizzard.name[2]..']'))
prettified.prepend(info.display_name(cache.item_id(components.blizzard.name[2])) or color.blizzard('['..components.blizzard.name[2]..']'))
elseif key ~= 'name' then
prettified.append(gui.color.blizzard(filter[1]))
prettified.append(color.blizzard(filter[1]))
end
end
if components.blizzard.name and not components.blizzard.exact and components.blizzard.name[2] ~= '' then
prettified.prepend(gui.color.blizzard(components.blizzard.name[2]))
prettified.prepend(color.blizzard(components.blizzard.name[2]))
end
for _, component in components.post do
if component[1] == 'operator' then
prettified.append(gui.color.aux(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')))
prettified.append(color.aux(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')))
elseif component[1] == 'filter' then
if component[2] ~= 'tooltip' then
prettified.append(gui.color.aux(component[2]))
prettified.append(color.aux(component[2]))
end
for parameter in present(component[3]) do
if component[2] == 'item' then
prettified.append(info.display_name(cache.item_id(parameter)) or gui.color.label.enabled('['..parameter..']'))
prettified.append(info.display_name(cache.item_id(parameter)) or color.label.enabled('['..parameter..']'))
else
if filters[component[2]].input_type == 'money' then
prettified.append(money.to_string(money.from_string(parameter), nil, true, nil, gui.inline_color.label.enabled))
else
prettified.append(gui.color.label.enabled(parameter))
prettified.append(color.label.enabled(parameter))
end
end
end
end
end
if prettified.get() == '' then
return gui.color.blizzard'<>'
return color.blizzard'<>'
else
return prettified.get()
end