diff --git a/gui.lua b/gui.lua index fa0b8ff..728055e 100644 --- a/gui.lua +++ b/gui.lua @@ -80,68 +80,81 @@ end function m.LOAD() m.initialize_menu() + m.initialize_dropdown() +end - local backdrop = DropDownList1Backdrop:GetBackdrop() +do + local blizzard_backdrop, aux_background, aux_border - DropDownList1.border = DropDownList1:CreateTexture() - DropDownList1.border:SetTexture(1,1,1,0.02) - DropDownList1.border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -1.5, 1.5) - DropDownList1.border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5) - DropDownList1.border:SetBlendMode('ADD') - DropDownList1.backdrop = DropDownList1:CreateTexture(nil, 'OVERLAY') - DropDownList1.backdrop:SetTexture(unpack(m.color.content.backdrop)) - DropDownList1.backdrop:SetAllPoints(DropDownList1Backdrop) - - aux.hook('ToggleDropDownMenu', function(...) - local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))} - local dropdown = getglobal(arg[4] or '') or this:GetParent() - if strfind(dropdown:GetName() or '', 'aux_frame') then - DropDownList1Backdrop:SetBackdrop({}) - DropDownList1.border:Show() - DropDownList1.backdrop:Show() - DropDownList1:SetWidth(dropdown:GetWidth() * 0.9) - DropDownList1:SetHeight(DropDownList1:GetHeight() - 10) - DropDownList1:ClearAllPoints() - DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2) - for i=1,UIDROPDOWNMENU_MAXBUTTONS do - local button = getglobal('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(m.config.font, m.config.small_font_size2) - text:SetPoint('TOPLEFT', 18, 0) - text:SetPoint('BOTTOMRIGHT', -8, 0) - local highlight = getglobal('DropDownList1Button'..i..'Highlight') - highlight:ClearAllPoints() - highlight:SetDrawLayer('OVERLAY') - highlight:SetHeight(14) - highlight:SetPoint('LEFT', 5, 0) - highlight:SetPoint('RIGHT', -3, 0) - local check = getglobal('DropDownList1Button'..i..'Check') - check:SetWidth(16) - check:SetHeight(16) - check:SetPoint('LEFT', 3, -1) - end - else - DropDownList1Backdrop:SetBackdrop(backdrop) - DropDownList1.border:Hide() - DropDownList1.backdrop:Hide() - for i=1,UIDROPDOWNMENU_MAXBUTTONS do - local button = getglobal('DropDownList1Button'..i) - local text = button:GetFontString() - text:SetFont([[Fonts\FRIZQT__.ttf]], 10) - text:SetShadowOffset(1, -1) - local highlight = getglobal('DropDownList1Button'..i..'Highlight') - highlight:SetAllPoints() - highlight:SetDrawLayer('BACKGROUND') - local check = getglobal('DropDownList1Button'..i..'Check') - check:SetWidth(24) - check:SetHeight(24) - check:SetPoint('LEFT', 0, 0) + function private.initialize_dropdown() + aux_border = DropDownList1:CreateTexture() + aux_border:SetTexture(1, 1, 1, .02) + aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2) + aux_border:SetPoint('BOTTOMRIGHT', DropDownList1Backdrop, 'BOTTOMRIGHT', 1.5, -1.5) + aux_border:SetBlendMode('ADD') + aux_background = DropDownList1:CreateTexture(nil, 'OVERLAY') + aux_background:SetTexture(unpack(m.color.content.backdrop)) + aux_background:SetAllPoints(DropDownList1Backdrop) + blizzard_backdrop = DropDownList1Backdrop:GetBackdrop() + aux.hook('ToggleDropDownMenu', function(...) + local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))} + local dropdown = getglobal(arg[4] or '') or this:GetParent() + if strfind(dropdown:GetName() or '', 'aux_frame') then + m.set_aux_dropdown_style(dropdown) + else + m.set_blizzard_dropdown_style() end + return unpack(ret) + end) + end + + function private.set_aux_dropdown_style(dropdown) + DropDownList1Backdrop:SetBackdrop({}) + aux_border:Show() + aux_background:Show() + DropDownList1:SetWidth(dropdown:GetWidth() * 0.9) + DropDownList1:SetHeight(DropDownList1:GetHeight() - 10) + DropDownList1:ClearAllPoints() + DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2) + for i=1,UIDROPDOWNMENU_MAXBUTTONS do + local button = getglobal('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(m.config.font, m.config.small_font_size2) + text:SetPoint('TOPLEFT', 18, 0) + text:SetPoint('BOTTOMRIGHT', -8, 0) + local highlight = getglobal('DropDownList1Button'..i..'Highlight') + highlight:ClearAllPoints() + highlight:SetDrawLayer('OVERLAY') + highlight:SetHeight(14) + highlight:SetPoint('LEFT', 5, 0) + highlight:SetPoint('RIGHT', -3, 0) + local check = getglobal('DropDownList1Button'..i..'Check') + check:SetWidth(16) + check:SetHeight(16) + check:SetPoint('LEFT', 3, -1) end - return unpack(ret) - end) + end + + function private.set_blizzard_dropdown_style() + DropDownList1Backdrop:SetBackdrop(blizzard_backdrop) + aux_border:Hide() + aux_background:Hide() + for i=1,UIDROPDOWNMENU_MAXBUTTONS do + local button = getglobal('DropDownList1Button'..i) + local text = button:GetFontString() + text:SetFont([[Fonts\FRIZQT__.ttf]], 10) + text:SetShadowOffset(1, -1) + local highlight = getglobal('DropDownList1Button'..i..'Highlight') + highlight:SetAllPoints() + highlight:SetDrawLayer('BACKGROUND') + local check = getglobal('DropDownList1Button'..i..'Check') + check:SetWidth(24) + check:SetHeight(24) + check:SetPoint('LEFT', 0, 0) + end + end end function public.set_frame_style(frame, backdrop_color, border_color, left, right, top, bottom) @@ -327,7 +340,6 @@ function public.tab_group(parent, orientation) end function public.editbox(parent) - local editbox = CreateFrame('EditBox', nil, parent) editbox:SetAutoFocus(false) editbox:SetTextInsets(1, 2, 3, 3) @@ -349,18 +361,15 @@ function public.editbox(parent) last_click = {t=GetTime(), x=x, y=y} end) end - function editbox:Enable() editbox:EnableMouse(true) editbox:SetTextColor(unpack(m.color.text.enabled)) end - function editbox:Disable() editbox:EnableMouse(false) editbox:SetTextColor(unpack(m.color.text.disabled)) editbox:ClearFocus() end - return editbox end @@ -488,10 +497,9 @@ function public.vertical_line(parent, x_offset, top_offset, bottom_offset, inver return texture end - function public.dropdown(parent) local dropdown = CreateFrame('Frame', m.name(), parent, 'UIDropDownMenuTemplate') - m.set_content_style(dropdown, 0, 0, 2, 2) + m.set_content_style(dropdown, 0, 0, 5, 5) getglobal(dropdown:GetName()..'Left'):Hide() getglobal(dropdown:GetName()..'Middle'):Hide() @@ -499,7 +507,7 @@ function public.dropdown(parent) local button = getglobal(dropdown:GetName()..'Button') button:ClearAllPoints() - button:SetPoint('RIGHT', dropdown, -1, 0) + button:SetPoint('RIGHT', dropdown, 1, 0) dropdown.button = button local text = getglobal(dropdown:GetName()..'Text') @@ -538,7 +546,7 @@ function public.slider(parent) local editbox = m.editbox(slider) editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0) - editbox:SetWidth(50) + editbox:SetWidth(45) editbox:SetHeight(18) editbox:SetJustifyH('CENTER') editbox:SetFont(m.config.font, 17) diff --git a/tabs/post/frames.lua b/tabs/post/frames.lua index 563ea17..37be9d5 100644 --- a/tabs/post/frames.lua +++ b/tabs/post/frames.lua @@ -127,7 +127,7 @@ function private.create_frames() do local slider = aux.gui.slider(m.frame.parameters) slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', 13, -73) + slider:SetPoint('TOPLEFT', 13, -74) slider:SetWidth(190) slider:SetScript('OnValueChanged', function() m.quantity_update(true) @@ -158,7 +158,7 @@ function private.create_frames() do local slider = aux.gui.slider(m.frame.parameters) slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30) + slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -32) slider:SetWidth(190) slider:SetScript('OnValueChanged', function() m.quantity_update() @@ -183,17 +183,19 @@ function private.create_frames() dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21) dropdown:SetWidth(90) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetText('Duration') UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) dropdown:SetScript('OnShow', function() UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) end) - local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) - label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0) - private.deposit = label private.duration_dropdown = dropdown end + do + local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size) + label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0) + private.deposit = label + end do local checkbox = aux.gui.checkbox(m.frame.parameters) checkbox:SetPoint('TOPRIGHT', -83, -6) @@ -212,7 +214,7 @@ function private.create_frames() local frame = CreateFrame('Frame', nil, m.frame.parameters) private.start_price_frame = frame aux.gui.set_content_style(frame) - frame:SetPoint('TOPRIGHT', -71, -58) + frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60) frame:SetWidth(180) frame:SetHeight(22) local editbox = aux.gui.editbox(frame) @@ -247,6 +249,7 @@ function private.create_frames() editbox.pretty:SetPoint('LEFT', 1, 0) editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetJustifyH('RIGHT') + editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled)) do local label = aux.gui.label(frame, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) @@ -301,6 +304,7 @@ function private.create_frames() editbox.pretty:SetPoint('LEFT', 1, 0) editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetJustifyH('RIGHT') + editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled)) do local label = aux.gui.label(frame, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) @@ -317,7 +321,7 @@ function private.create_frames() end do local btn = aux.gui.button(m.frame.parameters, 14) - btn:SetPoint('TOPRIGHT', -14, -146) + btn:SetPoint('TOPRIGHT', -10, -146) btn:SetWidth(150) btn:SetHeight(20) btn:GetFontString():SetJustifyH('RIGHT') diff --git a/tabs/search/frames.lua b/tabs/search/frames.lua index b423665..9ec6df3 100644 --- a/tabs/search/frames.lua +++ b/tabs/search/frames.lua @@ -1,5 +1,7 @@ local m, public, private = aux.module'search_tab' +private.FILTER_SPACING = 29.5 + function private.create_frames() private.frame = CreateFrame('Frame', nil, aux.frame) m.frame:SetAllPoints() @@ -249,7 +251,6 @@ function private.create_frames() editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) editbox:SetHeight(25) editbox:SetScript('OnChar', function() - m.import_query_string() this:complete() end) editbox:SetScript('OnTabPressed', function() @@ -369,7 +370,7 @@ function private.create_frames() do local editbox = aux.gui.editbox(m.frame.filter) editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end) - editbox:SetPoint('TOPLEFT', 14, -25) + editbox:SetPoint('TOPLEFT', 14, -m.FILTER_SPACING) editbox:SetWidth(260) editbox:SetScript('OnChar', function() if m.blizzard_query.exact then @@ -404,7 +405,7 @@ function private.create_frames() end do local editbox = aux.gui.editbox(m.frame.filter) - editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -26) + editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -m.FILTER_SPACING) editbox:SetWidth(125) editbox:SetNumeric(true) editbox:SetScript('OnTabPressed', function() @@ -464,10 +465,10 @@ function private.create_frames() do local dropdown = aux.gui.dropdown(m.frame.filter) private.class_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -24) + dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, 5 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetText('Item Class') UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) dropdown:SetScript('OnShow', function() @@ -477,10 +478,10 @@ function private.create_frames() do local dropdown = aux.gui.dropdown(m.frame.filter) private.subclass_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetText('Item Subclass') UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) dropdown:SetScript('OnShow', function() @@ -490,10 +491,10 @@ function private.create_frames() do local dropdown = aux.gui.dropdown(m.frame.filter) private.slot_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetText('Item Slot') UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) dropdown:SetScript('OnShow', function() @@ -504,10 +505,10 @@ function private.create_frames() do local dropdown = aux.gui.dropdown(m.frame.filter) private.quality_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetText('Min Quality') UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) dropdown:SetScript('OnShow', function() @@ -548,6 +549,7 @@ function private.create_frames() local input = aux.gui.editbox(m.frame.filter) input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) input:SetWidth(150) + input:SetHeight(25) input:SetScript('OnChar', function() this:complete() end)