From abba5890927511bd2be1b95dadfb7451028be707 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 26 Jul 2016 03:02:23 +0200 Subject: [PATCH] gui refactoring and restyling of post --- core.lua | 8 ++- core.xml | 43 +------------- gui.lua | 112 +++++++++++-------------------------- tables/auction_listing.lua | 6 +- tabs/auctions/frames.lua | 2 +- tabs/bids/frames.lua | 2 +- tabs/post/frames.lua | 25 ++++----- tabs/search/frames.lua | 15 ++--- 8 files changed, 67 insertions(+), 146 deletions(-) diff --git a/core.lua b/core.lua index ec207e9..06087a2 100644 --- a/core.lua +++ b/core.lua @@ -39,7 +39,7 @@ do end function public.on_load() - public.version = '3.2.0' + public.version = '3.3.0' public.blizzard_ui_shown = false public.bids_loaded = false public.current_owner_page = nil @@ -47,8 +47,14 @@ function public.on_load() m.log('Aux v'..m.version..' loaded.') + Aux.gui.set_window_style(AuxFrame) tinsert(UISpecialFrames, 'AuxFrame') + CreateFrame('GameTooltip', 'AuxTooltip', nil, 'GameTooltipTemplate') + AuxTooltip:SetScript('OnTooltipAddMoney', function() + this.money = arg1 + end) + do local tab_group = m.gui.tab_group(AuxFrame, 'BOTTOM') tab_group:create_tab('Search') diff --git a/core.xml b/core.xml index 2f68645..70214b1 100644 --- a/core.xml +++ b/core.xml @@ -18,38 +18,6 @@ - - - - this.money = arg1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -80,7 +48,7 @@ - + @@ -115,14 +83,5 @@ - - - - - - - - - diff --git a/gui.lua b/gui.lua index e93c909..9b7a307 100644 --- a/gui.lua +++ b/gui.lua @@ -1,64 +1,47 @@ local m, public, private = Aux.module'gui' ---TSM.designDefaults = { --- frameColors = { --- frameBG = { backdrop = { 24, 24, 24, .93 }, border = { 30, 30, 30, 1 } }, --- frame = { backdrop = { 24, 24, 24, 1 }, border = { 255, 255, 255, 0.03 } }, --- content = { backdrop = { 42, 42, 42, 1 }, border = { 0, 0, 0, 0 } }, --- }, --- textColors = { --- iconRegion = { enabled = { 249, 255, 247, 1 } }, --- text = { enabled = { 255, 254, 250, 1 }, disabled = { 147, 151, 139, 1 } }, --- label = { enabled = { 216, 225, 211, 1 }, disabled = { 150, 148, 140, 1 } }, --- title = { enabled = { 132, 219, 9, 1 } }, --- link = { enabled = { 49, 56, 133, 1 } }, --- }, --- inlineColors = { --- link = { 153, 255, 255, 1 }, --- link2 = { 153, 255, 255, 1 }, --- category = { 36, 106, 36, 1 }, --- category2 = { 85, 180, 8, 1 }, --- tooltip = { 130, 130, 250, 1 }, --- }, --- edgeSize = 1.5, --- fonts = { --- content = "Fonts\\ARIALN.TTF", --- bold = "Interface\\Addons\\TradeSkillMaster\\Media\\DroidSans-Bold.ttf", --- }, --- fontSizes = { --- normal = 15, --- medium = 13, --- small = 12, --- }, ---} - public.config = { - link_color = { 153, 255, 255, 1 }, - link_color2 = { 153, 255, 255, 1 }, -- TODO inline color needs 255, others need /255 + link_color = { 153, 255, 255, 1 }, -- TODO inline color needs 255, others need /255 edge_size = 1.5, + window_color = { backdrop = { 24/255, 24/255, 24/255, .93 }, border = { 30/255, 30/255, 30/255, 1 } }, frame_color = {24/255, 24/255, 24/255, 1}, frame_border_color = {1, 1, 1, .03}, content_color = {42/255, 42/255, 42/255, 1}, content_border_color = {0, 0, 0, 0}, content_font = [[Fonts\ARIALN.TTF]], --- content_font = [[Interface\AddOns\Aux-Addon\ARIALN.TTF]], normal_font_size = 15, - normal_button_font_size = 16, -- 15 not working for some clients text_color = { enabled = { 255/255, 254/255, 250/255, 1 }, disabled = { 147/255, 151/255, 139/255, 1 } }, label_color = { enabled = { 216/255, 225/255, 211/255, 1 }, disabled = { 150/255, 148/255, 140/255, 1 } }, on_color = {0.3, 0.7, 0.3}, - off_color = {0.7, 0.3, 0.3 }, + off_color = {0.7, 0.3, 0.3}, } function public.inline_color(color) local r, g, b, a = unpack(color) - return format("|c%02X%02X%02X%02X", a, r, g, b) + return format('|c%02X%02X%02X%02X', a, r, g, b) +end + +function public.set_frame_style(frame, backdrop_color, border_color) + frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size, tile=true} + frame:SetBackdropColor(unpack(backdrop_color)) + frame:SetBackdropBorderColor(unpack(border_color)) +end + +function public.set_window_style(frame) + m.set_frame_style(frame, m.config.window_color.backdrop, m.config.window_color.border) +end + +function public.set_panel_style(frame) + m.set_frame_style(frame, m.config.frame_color, m.config.frame_border_color) +end + +function public.set_content_style(frame) + m.set_frame_style(frame, m.config.content_color, m.config.content_border_color) end function public.panel(parent) local panel = CreateFrame('Frame', nil, parent) - panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} - panel:SetBackdropColor(unpack(m.config.content_color)) + m.set_panel_style(panel) return panel end @@ -83,9 +66,7 @@ end function public.button(parent, text_height) local button = CreateFrame('Button', nil, parent) - button:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size} - button:SetBackdropColor(unpack(m.config.content_color)) - button:SetBackdropBorderColor(unpack(m.config.content_border_color)) + m.set_content_style(button) local highlight = button:CreateTexture(nil, 'HIGHLIGHT') highlight:SetAllPoints() highlight:SetTexture(1, 1, 1, .2) @@ -148,12 +129,7 @@ do tab.group = self tab:SetHeight(24) tab:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size} - tab:SetBackdropColor(0, 0, 0, 0) tab:SetBackdropBorderColor(unpack(m.config.frame_border_color)) - local image = tab:CreateTexture(nil, 'BACKGROUND') - image:SetAllPoints() - image:SetTexture(unpack(m.config.content_color)) - tab.image = image local dock = tab:CreateTexture(nil, 'OVERLAY') dock:SetHeight(3) if position == 'TOP' then @@ -217,17 +193,15 @@ do function self.update_tabs() for _, tab in ipairs(self.tabs) do if tab.group.selected == tab.id then --- TSMAPI.Design:SetWidgetLabelColor(tab.text) - tab.text:SetTextColor(216/255, 225/255, 211/255) -- TODO + tab.text:SetTextColor(unpack(m.config.label_color.enabled)) tab:Disable() - tab.image:SetTexture(unpack(m.config.frame_color)) + tab:SetBackdropColor(unpack(m.config.frame_color)) tab.dock:Show() tab:SetHeight(29) else --- TSMAPI.Design:SetWidgetTextColor(tab.text) - tab.text:SetTextColor(255/255, 254/255, 250/255) -- TODO + tab.text:SetTextColor(unpack(m.config.text_color.enabled)) tab:Enable() - tab.image:SetTexture(unpack(m.config.content_color)) + tab:SetBackdropColor(unpack(m.config.content_color)) tab.dock:Hide() tab:SetHeight(24) end @@ -238,21 +212,16 @@ do end end -function public.editbox(parent, name) +function public.editbox(parent) --- local frame = CreateFrame('Frame', name, parent) --- frame:Hide() - - local editbox = CreateFrame('EditBox', name, parent) + local editbox = CreateFrame('EditBox', nil, parent) editbox:SetAutoFocus(false) editbox:SetTextInsets(0, 0, 3, 3) editbox:SetMaxLetters(256) editbox:SetHeight(19) editbox:SetFont(m.config.content_font, m.config.normal_font_size) editbox:SetShadowColor(0, 0, 0, 0) - editbox:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size} - editbox:SetBackdropColor(unpack(m.config.content_color)) - editbox:SetBackdropBorderColor(unpack(m.config.content_border_color)) + m.set_content_style(editbox) editbox:SetScript('OnEditFocusLost', function() this:HighlightText(0, 0) @@ -281,15 +250,6 @@ function public.editbox(parent, name) end) end --- local label = frame:CreateFontString(nil, 'OVERLAY') --- label:SetPoint('TOPLEFT', 0, -2) --- label:SetPoint('TOPRIGHT', 0, -2) --- label:SetJustifyH('LEFT') --- label:SetJustifyV('CENTER') --- label:SetHeight(18) --- label:SetFont(m.config.content_font, m.config.normal_font_size) --- label:SetShadowColor(0, 0, 0, 0) - return editbox end @@ -499,9 +459,7 @@ function public.slider(frame, name) slider:SetHeight(6) slider:SetHitRectInsets(0, 0, -8, -8) slider:SetValue(0) - slider:SetBackdrop{ bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size } - slider:SetBackdropColor(unpack(m.config.frame_color)) - slider:SetBackdropBorderColor(unpack(m.config.frame_border_color)) + m.set_panel_style(slider) local thumb_texture = slider:CreateTexture(nil, 'ARTWORK') thumb_texture:SetPoint('CENTER', 0, 0) thumb_texture:SetTexture(unpack(m.config.content_color)) @@ -524,11 +482,9 @@ function public.slider(frame, name) editbox:SetWidth(70) editbox:SetJustifyH('CENTER') editbox:EnableMouse(true) - editbox:SetBackdrop{ bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size } - editbox:SetBackdropColor(unpack(m.config.content_color)) - editbox:SetBackdropBorderColor(unpack(m.config.content_border_color)) + m.set_content_style(editbox) -- editbox:SetFont(m.config.content_font, m.config.normal_font_size) - editbox:SetFont(m.config.content_font, m.config.normal_button_font_size) + editbox:SetFont(m.config.content_font, m.config.normal_font_size) editbox:SetShadowColor(0, 0, 0, 0) -- -- local button = CreateFrame('Button', nil, editbox, 'UIPanelButtonTemplate') diff --git a/tables/auction_listing.lua b/tables/auction_listing.lua index 6fe73ee..dc146c3 100644 --- a/tables/auction_listing.lua +++ b/tables/auction_listing.lua @@ -86,7 +86,7 @@ public.search_config = { width = 0.06, align = 'CENTER', set = function(cell, record, count, own, expandable) - local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color2)..count..'|r') or count + local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count if own > 0 then numAuctionsText = numAuctionsText..(' |cffffff00('..own..')|r') end @@ -256,7 +256,7 @@ public.auctions_config = { width = 0.06, align = 'CENTER', set = function(cell, record, count, own, expandable) - local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color2)..count..'|r') or count + local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count cell:SetText(numAuctionsText) end, cmp = function(record_a, record_b, desc) @@ -390,7 +390,7 @@ public.bids_config = { width = 0.06, align = 'CENTER', set = function(cell, record, count, own, expandable) - local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color2)..count..'|r') or count + local numAuctionsText = expandable and (Aux.gui.inline_color(Aux.gui.config.link_color)..count..'|r') or count cell:SetText(numAuctionsText) end, cmp = function(record_a, record_b, desc) diff --git a/tabs/auctions/frames.lua b/tabs/auctions/frames.lua index ebd179a..9af8181 100644 --- a/tabs/auctions/frames.lua +++ b/tabs/auctions/frames.lua @@ -4,7 +4,7 @@ Aux.auctions_tab.FRAMES(function(m, public, private) m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() - m.frame.listing = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.listing = Aux.gui.panel(m.frame) m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) diff --git a/tabs/bids/frames.lua b/tabs/bids/frames.lua index cf52bf7..dd784e8 100644 --- a/tabs/bids/frames.lua +++ b/tabs/bids/frames.lua @@ -4,7 +4,7 @@ Aux.bids_tab.FRAMES(function(m, public, private) m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() - m.frame.listing = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.listing = Aux.gui.panel(m.frame) m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) diff --git a/tabs/post/frames.lua b/tabs/post/frames.lua index 327b79b..80b6f7e 100644 --- a/tabs/post/frames.lua +++ b/tabs/post/frames.lua @@ -4,30 +4,29 @@ Aux.post_tab.FRAMES(function(m, public, private) m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() - m.frame.content = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.content = CreateFrame('Frame', nil, m.frame) m.frame.content:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) m.frame.content:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) - m.frame.inventory = CreateFrame('Frame', nil, m.frame.content, 'AuxFrameBoxTemplate') + m.frame.inventory = Aux.gui.panel(m.frame.content) m.frame.inventory:SetWidth(212) - m.frame.inventory:SetPoint('TOPLEFT', 4, -4) - m.frame.inventory:SetPoint('BOTTOMLEFT', 4, 4) + m.frame.inventory:SetPoint('TOPLEFT', 0, 0) + m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) - m.frame.parameters = CreateFrame('Frame', nil, m.frame.content, 'AuxFrameBoxTemplate') - m.frame.parameters:SetHeight(177) - m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 8, 0) - m.frame.parameters:SetPoint('TOPRIGHT', -4, 0) + m.frame.parameters = Aux.gui.panel(m.frame.content) + m.frame.parameters:SetHeight(171) + m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0) + m.frame.parameters:SetPoint('TOPRIGHT', 0, 0) m.frame.parameters.item = CreateFrame('Button', 'AuxPostItem', m.frame.parameters, 'AuxItemTemplate') m.frame.parameters.item:SetPoint('TOPLEFT', 10, -10) - m.frame.auctions = CreateFrame('Frame', nil, m.frame.content, 'AuxFrameBoxTemplate') - m.frame.auctions:SetHeight(217) - m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 8, 0) - m.frame.auctions:SetPoint('BOTTOMRIGHT', -4, 0) + m.frame.auctions = Aux.gui.panel(m.frame.content) + m.frame.auctions:SetHeight(230) + m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0) + m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0) - Aux.gui.vertical_line(m.frame.content, 219) m.frame.parameters.item:EnableMouse() m.frame.parameters.item:SetScript('OnReceiveDrag', function() local item_info = Aux.cursor_item() diff --git a/tabs/search/frames.lua b/tabs/search/frames.lua index 83695be..6635aed 100644 --- a/tabs/search/frames.lua +++ b/tabs/search/frames.lua @@ -4,21 +4,21 @@ Aux.search_tab.FRAMES(function(m, public, private) m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() - m.frame.filter = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.filter = Aux.gui.panel(m.frame) m.frame.filter:SetAllPoints(AuxFrameContent) - m.frame.results = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.results = Aux.gui.panel(m.frame) m.frame.results:SetAllPoints(AuxFrameContent) - m.frame.saved = CreateFrame('Frame', nil, m.frame, 'AuxFrameBoxTemplate') + m.frame.saved = Aux.gui.panel(m.frame) m.frame.saved:SetAllPoints(AuxFrameContent) - m.frame.saved.favorite = CreateFrame('Frame', nil, m.frame.saved, 'AuxFrameBoxTemplate') + m.frame.saved.favorite = Aux.gui.panel(m.frame.saved) m.frame.saved.favorite:SetWidth(373) m.frame.saved.favorite:SetPoint('TOPLEFT', 4, -4) m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 4, 4) - m.frame.saved.recent = CreateFrame('Frame', nil, m.frame.saved, 'AuxFrameBoxTemplate') + m.frame.saved.recent = Aux.gui.panel(m.frame.saved) m.frame.saved.recent:SetWidth(373) m.frame.saved.recent:SetPoint('TOPRIGHT', -4, -4) m.frame.saved.recent:SetPoint('BOTTOMRIGHT', -4, 4) @@ -44,13 +44,14 @@ Aux.search_tab.FRAMES(function(m, public, private) fake_icon_part:SetFont([[Fonts\FRIZQT__.TTF]], 23) fake_icon_part:SetPoint('CENTER', 0, offset) fake_icon_part:SetText('_') --- fake_icon:SetTextHeight(28) end private.settings_button = btn end do - local panel = Aux.gui.panel(m.frame) + local panel = CreateFrame('Frame', nil, m.frame) + panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} + panel:SetBackdropColor(unpack(Aux.gui.config.content_color)) panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) panel:SetPoint('RIGHT', 0, 0) panel:SetHeight(42)