big refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-22 23:00:40 +02:00
parent 7faab39013
commit 2e89efe0af
5 changed files with 52 additions and 53 deletions
+2 -2
View File
@@ -1064,7 +1064,7 @@ function public.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString()
text:SetJustifyH 'CENTER'
text:SetJustifyV 'CENTER'
text:SetFont(gui.config.font, 12)
text:SetFont(gui.font, 12)
text:SetTextColor(color.label.enabled())
cell:SetFontString(text)
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
@@ -1110,7 +1110,7 @@ function public.CreateAuctionResultsTable(parent, config)
for j=1, getn(rt.config) do
local cell = CreateFrame('Button', nil, row)
local text = cell:CreateFontString()
text:SetFont(gui.config.font, min(14, rt.ROW_HEIGHT))
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
text:SetJustifyH(rt.config[j].align or 'LEFT')
text:SetJustifyV 'CENTER'
text:SetPoint('TOPLEFT', 1, -1)
+22 -23
View File
@@ -1,15 +1,15 @@
module 'gui'
public.config = {
edge_size = 1.5,
font = [[Fonts\ARIALN.TTF]],
small_font_size = 13,
small_font_size2 = 14,
medium_font_size = 15,
medium_font_size2 = 16,
large_font_size = 17,
large_font_size2 = 18,
huge_font_size = 23,
public.font = [[Fonts\ARIALN.TTF]]
public.font_size = {
small = 13,
small2 = 14,
medium = 15,
medium2 = 16,
large = 17,
large2 = 18,
huge = 23,
}
do
@@ -79,7 +79,7 @@ do
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(config.font, config.small_font_size2)
text:SetFont(font, font_size.small2)
text:SetPoint('TOPLEFT', 18, 0)
text:SetPoint('BOTTOMRIGHT', -8, 0)
local highlight = getglobal('DropDownList1Button'..i..'Highlight')
@@ -121,7 +121,7 @@ function public.set_size(frame, width, height)
end
function public.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom)
frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=config.edge_size, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=1.5, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
frame:SetBackdropColor(backdrop_color())
frame:SetBackdropBorderColor(border_color())
end
@@ -174,7 +174,7 @@ function public.button(parent, text_height)
button.highlight = highlight
do
local label = button:CreateFontString()
label:SetFont(config.font, text_height)
label:SetFont(font, text_height)
label:SetPoint('CENTER', 0, 0)
label:SetJustifyH 'CENTER'
label:SetJustifyV 'CENTER'
@@ -210,8 +210,7 @@ do
tab.id = id
tab.group = self
tab:SetHeight(24)
tab:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=config.edge_size}
tab:SetBackdropBorderColor(color.panel.border())
set_panel_style(tab)
local dock = tab:CreateTexture(nil, 'OVERLAY')
dock:SetHeight(3)
if self._orientation == 'UP' then
@@ -234,7 +233,7 @@ do
tab.text:SetPoint('RIGHT', -3, -1)
tab.text:SetJustifyH 'CENTER'
tab.text:SetJustifyV 'CENTER'
tab.text:SetFont(config.font, config.large_font_size2)
tab.text:SetFont(font, font_size.large2)
tab:SetFontString(tab.text)
tab:SetText(text)
@@ -368,21 +367,21 @@ function public.editbox(parent)
self.display:SetJustifyH(alignment)
end
function editbox:SetFontSize(size)
self:SetFont(config.font, size)
self.display:SetFont(config.font, size)
self:SetFont(font, size)
self.display:SetFont(font, size)
end
local display = label(editbox)
display:SetPoint('LEFT', 1.5, 0)
display:SetPoint('RIGHT', -1.5, 0)
display:SetTextColor(color.text.enabled())
editbox.display = display
local cursor = label(editbox, config.large_font_size)
local cursor = label(editbox, font_size.large)
cursor:SetText '|'
cursor:SetTextColor(color.text.enabled())
cursor:SetAlpha(0)
editbox.cursor = cursor
editbox:SetAlignment 'LEFT'
editbox:SetFontSize(config.medium_font_size)
editbox:SetFontSize(font_size.medium)
return editbox
end
@@ -478,7 +477,7 @@ end
function public.label(parent, size)
local label = parent:CreateFontString()
label:SetFont(config.font, size or config.small_font_size)
label:SetFont(font, size or font_size.small)
label:SetTextColor(color.label.enabled())
return label
end
@@ -527,7 +526,7 @@ function public.dropdown(parent)
text:ClearAllPoints()
text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
text:SetPoint('LEFT', 8, 0)
text:SetFont(config.font, config.medium_font_size)
text:SetFont(font, font_size.medium)
text:SetShadowColor(0, 0, 0, 0)
return dropdown
@@ -555,7 +554,7 @@ function public.slider(parent)
label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 8)
label:SetJustifyH 'LEFT'
label:SetHeight(13)
label:SetFont(config.font, config.small_font_size)
label:SetFont(font, font_size.small)
label:SetTextColor(color.label.enabled())
local editbox = editbox(slider)
+4 -4
View File
@@ -305,7 +305,7 @@ local methods = {
local text = col:CreateFontString()
text:SetJustifyV('CENTER')
text:SetFont(gui.config.font, 16)
text:SetFont(gui.font, 16)
text:SetTextColor(color.text.enabled())
text:SetAllPoints()
col.text = text
@@ -333,7 +333,7 @@ local methods = {
local colNum = getn(row.cols) + 1
local col = CreateFrame('Button', nil, row)
local text = col:CreateFontString()
text:SetFont(gui.config.font, ST_ROW_TEXT_SIZE)
text:SetFont(gui.font, ST_ROW_TEXT_SIZE)
text:SetJustifyV 'CENTER'
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
@@ -389,9 +389,9 @@ local methods = {
-- update the text size of the head cols
for _, col in st.headCols do
if st.sizes.headFontSize then
col.text:SetFont(gui.config.font, st.sizes.headFontSize)
col.text:SetFont(gui.font, st.sizes.headFontSize)
else
col.text:SetFont(gui.config.font, gui.config.medium_font_size)
col.text:SetFont(gui.font, gui.font_size.medium)
end
end
st:Redraw()
+7 -7
View File
@@ -32,7 +32,7 @@ function create_frames()
checkbox:SetScript('OnClick', function()
refresh = true
end)
local label = gui.label(checkbox, gui.config.small_font_size)
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Show hidden items')
show_hidden_checkbox = checkbox
@@ -180,7 +180,7 @@ function create_frames()
local dropdown = gui.dropdown(frame.parameters)
dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, -19)
dropdown:SetWidth(90)
local label = gui.label(dropdown, gui.config.small_font_size)
local label = gui.label(dropdown, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown)
@@ -190,7 +190,7 @@ function create_frames()
duration_dropdown = dropdown
end
do
local label = gui.label(frame.parameters, gui.config.medium_font_size)
local label = gui.label(frame.parameters, gui.font_size.medium)
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
deposit = label
end
@@ -203,7 +203,7 @@ function create_frames()
write_settings(settings)
refresh = true
end)
local label = gui.label(checkbox, gui.config.small_font_size)
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText 'Hide this item'
hide_checkbox = checkbox
@@ -253,7 +253,7 @@ function create_frames()
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.config.small_font_size)
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText 'Unit Starting Price'
end
@@ -305,7 +305,7 @@ function create_frames()
editbox.pretty:SetJustifyH 'RIGHT'
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.config.small_font_size)
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText 'Unit Buyout Price'
end
@@ -330,7 +330,7 @@ function create_frames()
set_unit_buyout_price(this.amount)
end
end)
local label = gui.label(btn, gui.config.small_font_size)
local label = gui.label(btn, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText 'Historical Value'
historical_value_button = btn
+17 -17
View File
@@ -103,7 +103,7 @@ function create_frames()
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
local label = gui.label(editbox, gui.config.medium_font_size)
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
label:SetText('-')
label:SetTextColor(color.text.enabled())
@@ -187,7 +187,7 @@ function create_frames()
next_button = btn
end
do
local btn = gui.button(controls, gui.config.huge_font_size)
local btn = gui.button(controls, gui.font_size.huge)
btn:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -202,7 +202,7 @@ function create_frames()
start_button = btn
end
do
local btn = gui.button(controls, gui.config.huge_font_size)
local btn = gui.button(controls, gui.font_size.huge)
btn:SetPoint('RIGHT', -5, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -213,7 +213,7 @@ function create_frames()
stop_button = btn
end
do
local btn = gui.button(controls, gui.config.huge_font_size)
local btn = gui.button(controls, gui.font_size.huge)
btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
btn:SetWidth(70)
btn:SetHeight(25)
@@ -242,7 +242,7 @@ function create_frames()
gui.horizontal_line(frame, -40)
end
do
local btn = gui.button(frame, gui.config.large_font_size2)
local btn = gui.button(frame, gui.font_size.large2)
btn:SetPoint('BOTTOMLEFT', frame.content, 'TOPLEFT', 10, 8)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -251,7 +251,7 @@ function create_frames()
search_results_button = btn
end
do
local btn = gui.button(frame, gui.config.large_font_size2)
local btn = gui.button(frame, gui.font_size.large2)
btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -260,7 +260,7 @@ function create_frames()
saved_searches_button = btn
end
do
local btn = gui.button(frame, gui.config.large_font_size2)
local btn = gui.button(frame, gui.font_size.large2)
btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(243)
btn:SetHeight(22)
@@ -365,7 +365,7 @@ function create_frames()
end)
editbox.change = update_form
editbox.enter = L(editbox.ClearFocus, editbox)
local label = gui.label(editbox, gui.config.small_font_size)
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText 'Name'
name_input = editbox
@@ -374,7 +374,7 @@ function create_frames()
local checkbox = gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', update_form)
local label = gui.label(checkbox, gui.config.small_font_size)
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact')
exact_checkbox = checkbox
@@ -399,7 +399,7 @@ function create_frames()
end
update_form()
end
local label = gui.label(editbox, gui.config.small_font_size)
local label = gui.label(editbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
label:SetText 'Level Range'
min_level_input = editbox
@@ -424,7 +424,7 @@ function create_frames()
end
update_form()
end
local label = gui.label(editbox, gui.config.medium_font_size)
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
label:SetText('-')
max_level_input = editbox
@@ -433,7 +433,7 @@ function create_frames()
local checkbox = gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', update_form)
local label = gui.label(checkbox, gui.config.small_font_size)
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Usable')
usable_checkbox = checkbox
@@ -443,7 +443,7 @@ function create_frames()
class_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.config.small_font_size)
local label = gui.label(dropdown, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown)
@@ -456,7 +456,7 @@ function create_frames()
subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.config.small_font_size)
local label = gui.label(dropdown, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown)
@@ -469,7 +469,7 @@ function create_frames()
slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.config.small_font_size)
local label = gui.label(dropdown, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown)
@@ -482,7 +482,7 @@ function create_frames()
quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING)
dropdown:SetWidth(300)
local label = gui.label(dropdown, gui.config.small_font_size)
local label = gui.label(dropdown, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3)
label:SetText('Min Quality')
UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown)
@@ -500,7 +500,7 @@ function create_frames()
UIDropDownMenu_Initialize(this, initialize_filter_dropdown)
end)
getglobal(dropdown:GetName()..'Text'):Hide()
local label = gui.label(dropdown, gui.config.medium_font_size)
local label = gui.label(dropdown, gui.font_size.medium)
label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0)
label:SetText('Post Filter')
filter_dropdown = dropdown