added the last missing ui elements to the tsm style: dropdown and checkbox. also many other style changes and lots of things made larger

This commit is contained in:
Manuel Simon Hirsig
2016-08-07 02:00:49 +02:00
parent b94cabfc08
commit c0db070798
10 changed files with 249 additions and 254 deletions
+10 -12
View File
@@ -3,8 +3,8 @@ local m, public, private = aux.module'cache'
private.MIN_ITEM_ID = 1 private.MIN_ITEM_ID = 1
private.MAX_ITEM_ID = 30000 private.MAX_ITEM_ID = 30000
local items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
local merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
aux_items = {} aux_items = {}
aux_item_ids = {} aux_item_ids = {}
@@ -24,10 +24,8 @@ function m.LOAD()
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update) CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update)
aux.control.event_listener('NEW_AUCTION_UPDATE', function() aux.control.event_listener('NEW_AUCTION_UPDATE', function()
local info = aux.info.auction_sell_item() for _, info in {aux.info.auction_sell_item()} do
if info then for _, item_id in {aux.cache.item_id(info.name)} do
local item_id = aux.cache.item_id(info.name)
if item_id then
aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count) aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count)
end end
end end
@@ -81,7 +79,7 @@ end
function public.merchant_info(item_id) function public.merchant_info(item_id)
local buy_info local buy_info
if aux_merchant_buy[item_id] then if aux_merchant_buy[item_id] then
buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id]) buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
end end
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
@@ -90,7 +88,7 @@ end
function public.item_info(item_id) function public.item_info(item_id)
local data_string = aux_items[item_id] local data_string = aux_items[item_id]
if data_string then if data_string then
local cached_data = aux.persistence.read(items_schema, data_string) local cached_data = aux.persistence.read(m.items_schema, data_string)
return { return {
name = cached_data.name, name = cached_data.name,
itemstring = 'item:'..item_id..':0:0:0', itemstring = 'item:'..item_id..':0:0:0',
@@ -119,7 +117,7 @@ function private.merchant_buy_scan()
local item_id = aux.info.parse_hyperlink(link) local item_id = aux.info.parse_hyperlink(link)
local new_unit_price, new_limited = price / count, stock >= 0 local new_unit_price, new_limited = price / count, stock >= 0
if aux_merchant_buy[item_id] then if aux_merchant_buy[item_id] then
local buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id]) local buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
local unit_price local unit_price
if buy_info.limited and not new_limited then if buy_info.limited and not new_limited then
@@ -130,12 +128,12 @@ function private.merchant_buy_scan()
unit_price = min(buy_info.unit_price, new_unit_price) unit_price = min(buy_info.unit_price, new_unit_price)
end end
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, { aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
unit_price = unit_price, unit_price = unit_price,
limited = buy_info.limited and new_limited, limited = buy_info.limited and new_limited,
}) })
else else
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, { aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
unit_price = new_unit_price, unit_price = new_unit_price,
limited = new_limited, limited = new_limited,
}) })
@@ -166,7 +164,7 @@ function private.scan_wdb(item_id)
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring) local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
if name and not aux_item_ids[strlower(name)] then if name and not aux_item_ids[strlower(name)] then
aux_item_ids[strlower(name)] = item_id aux_item_ids[strlower(name)] = item_id
aux_items[item_id] = aux.persistence.write(items_schema, { aux_items[item_id] = aux.persistence.write(m.items_schema, {
name = name, name = name,
quality = quality, quality = quality,
level = level, level = level,
+1 -1
View File
@@ -151,7 +151,7 @@ function public.index(t, ...)
end end
function public.on_load() function public.on_load()
public.version = '3.7.1' public.version = '3.8.0'
public.bids_loaded = false public.bids_loaded = false
public.current_owner_page = nil public.current_owner_page = nil
public.last_owner_page_requested = nil public.last_owner_page_requested = nil
+139 -158
View File
@@ -8,11 +8,10 @@ public.config = {
window = {backdrop = {24, 24, 24, .93}, border = {30, 30, 30, 1}}, window = {backdrop = {24, 24, 24, .93}, border = {30, 30, 30, 1}},
panel = {backdrop = {24, 24, 24, 1}, border = {255, 255, 255, .03}}, panel = {backdrop = {24, 24, 24, 1}, border = {255, 255, 255, .03}},
content = {backdrop = {42, 42, 42, 1}, border = {0, 0, 0, 0}}, content = {backdrop = {42, 42, 42, 1}, border = {0, 0, 0, 0}},
state = {enabled = {60, 180, 60}, disabled = {180, 60, 60}}, state = {enabled = {70, 165, 70}, disabled = {190, 70, 70}},
}, },
edge_size = 1.5, edge_size = 1.5,
font = [[Fonts\ARIALN.TTF]], font = [[Fonts\ARIALN.TTF]],
tiny_font_size = 12,
small_font_size = 13, small_font_size = 13,
medium_font_size = 15, medium_font_size = 15,
large_font_size = 18, large_font_size = 18,
@@ -44,19 +43,19 @@ public.inline_color = aux.index_function(function(self, key)
end) end)
function m.LOAD() function m.LOAD()
local backdrop = DropDownList1Backdrop:GetBackdrop()
aux.hook('ToggleDropDownMenu', function(...) aux.hook('ToggleDropDownMenu', function(...)
local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))} local ret = {aux.orig.ToggleDropDownMenu(unpack(arg))}
local dropdown = getglobal(arg[4] or '') or this:GetParent() local dropdown = getglobal(arg[4] or '') or this:GetParent()
if strfind(dropdown:GetName() or '', 'aux_frame') then if strfind(dropdown:GetName() or '', 'aux_frame') then
m.set_content_style(DropDownList1Backdrop) m.set_content_style(DropDownList1Backdrop)
DropDownList1:SetWidth(dropdown:GetWidth() * 0.9) DropDownList1:SetWidth(dropdown:GetWidth() * 0.9)
DropDownList1:SetHeight(DropDownList1:GetHeight() - 8) DropDownList1:SetHeight(DropDownList1:GetHeight() - 10)
DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, 0) DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, -2)
for i=1,UIDROPDOWNMENU_MAXBUTTONS do for i=1,UIDROPDOWNMENU_MAXBUTTONS do
local button = getglobal('DropDownList1Button'..i) local button = getglobal('DropDownList1Button'..i)
button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 8) button:SetPoint('TOPLEFT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
button:SetWidth(dropdown:GetWidth() - 30) button:SetPoint('TOPRIGHT', 0, -((button:GetID() - 1) * UIDROPDOWNMENU_BUTTON_HEIGHT) - 7)
local text = button:GetFontString() local text = button:GetFontString()
text:SetFont(m.config.font, m.config.medium_font_size) text:SetFont(m.config.font, m.config.medium_font_size)
text:SetPoint('TOPLEFT', 18, 0) text:SetPoint('TOPLEFT', 18, 0)
@@ -72,34 +71,45 @@ function m.LOAD()
check:SetHeight(16) check:SetHeight(16)
check:SetPoint('LEFT', 3, -1) check:SetPoint('LEFT', 3, -1)
end end
while getn(arg) < 4 do else
tinsert(arg, nil) DropDownList1Backdrop:SetBackdrop(backdrop)
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)
-- text:SetPoint('TOPLEFT', 18, 0)
-- text:SetPoint('BOTTOMRIGHT', -8, 0)
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
tinsert(arg, 0)
tinsert(arg, 10)
end end
return unpack(ret) return unpack(ret)
end) end)
end end
function public.set_frame_style(frame, backdrop_color, border_color) 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=m.config.edge_size, tile=true} frame:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size, tile=true, insets={left=left, right=right, top=top, bottom=bottom}}
frame:SetBackdropColor(unpack(backdrop_color)) frame:SetBackdropColor(unpack(backdrop_color))
frame:SetBackdropBorderColor(unpack(border_color)) frame:SetBackdropBorderColor(unpack(border_color))
end end
function public.set_window_style(frame) function public.set_window_style(frame, left, right, top, bottom)
m.set_frame_style(frame, m.color.window.backdrop, m.color.window.border) m.set_frame_style(frame, m.color.window.backdrop, m.color.window.border, left, right, top, bottom)
end end
function public.set_panel_style(frame) function public.set_panel_style(frame, left, right, top, bottom)
m.set_frame_style(frame, m.color.panel.backdrop, m.color.panel.border) m.set_frame_style(frame, m.color.panel.backdrop, m.color.panel.border, left, right, top, bottom)
end end
function public.set_content_style(frame) function public.set_content_style(frame, left, right, top, bottom)
m.set_frame_style(frame, m.color.content.backdrop, m.color.content.border) m.set_frame_style(frame, m.color.content.backdrop, m.color.content.border, left, right, top, bottom)
end end
function public.panel(parent) function public.panel(parent)
@@ -128,7 +138,7 @@ function public.checkbutton(parent, text_height)
end end
function public.button(parent, text_height) function public.button(parent, text_height)
text_height = text_height or m.config.medium_font_size text_height = text_height or 16
local button = CreateFrame('Button', nil, parent) local button = CreateFrame('Button', nil, parent)
m.set_content_style(button) m.set_content_style(button)
local highlight = button:CreateTexture(nil, 'HIGHLIGHT') local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
@@ -165,128 +175,121 @@ function public.resize_tab(tab, width, padding)
tab:SetWidth(width + padding + 10) tab:SetWidth(width + padding + 10)
end end
function public.update_tab(tab)
end function public.tab_group(parent, orientation)
do local frame = CreateFrame('Frame', nil, parent)
local id = 0 frame:SetHeight(100)
function public.tab_group(parent, orientation) frame:SetWidth(100)
id = id + 1
local frame = CreateFrame('Frame', nil, parent) local self = {
frame:SetHeight(100) id = aux.id(),
frame:SetWidth(100) frame = parent,
tabs = {},
}
local self = { function self:create_tab(text)
id = id, local id = getn(self.tabs) + 1
frame = parent,
tabs = {},
}
function self:create_tab(text) local tab = CreateFrame('Button', 'aux_tab_group'..self.id..'_tab'..id, self.frame)
local id = getn(self.tabs) + 1 tab.id = id
tab.group = self
tab:SetHeight(24)
tab:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size}
tab:SetBackdropBorderColor(unpack(m.color.panel.border))
local dock = tab:CreateTexture(nil, 'OVERLAY')
dock:SetHeight(3)
if orientation == 'UP' then
dock:SetPoint('BOTTOMLEFT', 1, -1)
dock:SetPoint('BOTTOMRIGHT', -1, -1)
elseif orientation == 'DOWN' then
dock:SetPoint('TOPLEFT', 1, 1)
dock:SetPoint('TOPRIGHT', -1, 1)
end
dock:SetTexture(unpack(m.color.panel.backdrop))
tab.dock = dock
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT')
highlight:SetAllPoints()
highlight:SetTexture(1, 1, 1, .2)
highlight:SetBlendMode('BLEND')
tab.highlight = highlight
local tab = CreateFrame('Button', 'aux_tab_group'..self.id..'_tab'..id, self.frame) tab.text = tab:CreateFontString()
tab.id = id tab.text:SetPoint('LEFT', 3, -1)
tab.group = self tab.text:SetPoint('RIGHT', -3, -1)
tab:SetHeight(24) tab.text:SetJustifyH('CENTER')
tab:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size} tab.text:SetJustifyV('CENTER')
tab:SetBackdropBorderColor(unpack(m.color.panel.border)) tab.text:SetFont(m.config.font, m.config.large_font_size)
local dock = tab:CreateTexture(nil, 'OVERLAY') tab:SetFontString(tab.text)
dock:SetHeight(3)
tab:SetText(text)
tab:SetScript('OnClick', function()
if this.id ~= this.group.selected then
PlaySound('igCharacterInfoTab')
this.group:set_tab(this.id)
end
end)
if getn(self.tabs) == 0 then
if orientation == 'UP' then if orientation == 'UP' then
dock:SetPoint('BOTTOMLEFT', 1, -1) tab:SetPoint('BOTTOMLEFT', self.frame, 'TOPLEFT', 4, -1)
dock:SetPoint('BOTTOMRIGHT', -1, -1)
elseif orientation == 'DOWN' then elseif orientation == 'DOWN' then
dock:SetPoint('TOPLEFT', 1, 1) tab:SetPoint('TOPLEFT', self.frame, 'BOTTOMLEFT', 4, 1)
dock:SetPoint('TOPRIGHT', -1, 1)
end end
dock:SetTexture(unpack(m.color.panel.backdrop)) else
tab.dock = dock if orientation == 'UP' then
local highlight = tab:CreateTexture(nil, 'HIGHLIGHT') tab:SetPoint('BOTTOMLEFT', self.tabs[getn(self.tabs)], 'BOTTOMRIGHT', 4, 0)
highlight:SetAllPoints() elseif orientation == 'DOWN' then
highlight:SetTexture(1, 1, 1, .2) tab:SetPoint('TOPLEFT', self.tabs[getn(self.tabs)], 'TOPRIGHT', 4, 0)
highlight:SetBlendMode('BLEND')
tab.highlight = highlight
tab.text = tab:CreateFontString()
tab.text:SetPoint('LEFT', 3, -1)
tab.text:SetPoint('RIGHT', -3, -1)
tab.text:SetJustifyH('CENTER')
tab.text:SetJustifyV('CENTER')
tab.text:SetFont(m.config.font, m.config.large_font_size)
tab:SetFontString(tab.text)
tab:SetText(text)
tab:SetScript('OnClick', function()
if this.id ~= this.group.selected then
-- PlaySound('igCharacterInfoTab')
this.group:set_tab(this.id)
end
end)
if getn(self.tabs) == 0 then
if orientation == 'UP' then
tab:SetPoint('BOTTOMLEFT', self.frame, 'TOPLEFT', 4, -1)
elseif orientation == 'DOWN' then
tab:SetPoint('TOPLEFT', self.frame, 'BOTTOMLEFT', 4, 1)
end
else
if orientation == 'UP' then
tab:SetPoint('BOTTOMLEFT', self.tabs[getn(self.tabs)], 'BOTTOMRIGHT', 4, 0)
elseif orientation == 'DOWN' then
tab:SetPoint('TOPLEFT', self.tabs[getn(self.tabs)], 'TOPRIGHT', 4, 0)
end
end
m.resize_tab(tab, tab:GetFontString():GetStringWidth(), 4)
tinsert(self.tabs, tab)
end
function self:set_tab(id)
self.selected = id
self.update_tabs()
aux.call(self.on_select, id)
end
function self.update_tabs()
for _, tab in self.tabs do
if tab.group.selected == tab.id then
tab.text:SetTextColor(unpack(m.color.label.enabled))
tab:Disable()
tab:SetBackdropColor(unpack(m.color.panel.backdrop))
tab.dock:Show()
tab:SetHeight(29)
else
tab.text:SetTextColor(unpack(m.color.text.enabled))
tab:Enable()
tab:SetBackdropColor(unpack(m.color.content.backdrop))
tab.dock:Hide()
tab:SetHeight(24)
end
end end
end end
return self m.resize_tab(tab, tab:GetFontString():GetStringWidth(), 4)
tinsert(self.tabs, tab)
end end
function self:set_tab(id)
self.selected = id
self.update_tabs()
aux.call(self.on_select, id)
end
function self.update_tabs()
for _, tab in self.tabs do
if tab.group.selected == tab.id then
tab.text:SetTextColor(unpack(m.color.label.enabled))
tab:Disable()
tab:SetBackdropColor(unpack(m.color.panel.backdrop))
tab.dock:Show()
tab:SetHeight(29)
else
tab.text:SetTextColor(unpack(m.color.text.enabled))
tab:Enable()
tab:SetBackdropColor(unpack(m.color.content.backdrop))
tab.dock:Hide()
tab:SetHeight(24)
end
end
end
return self
end end
function public.editbox(parent) function public.editbox(parent)
local editbox = CreateFrame('EditBox', nil, parent) local editbox = CreateFrame('EditBox', nil, parent)
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetTextInsets(0, 0, 3, 3) editbox:SetTextInsets(1, 2, 3, 3)
editbox:SetMaxLetters(256) editbox:SetMaxLetters(256)
editbox:SetHeight(19) editbox:SetHeight(22)
editbox:SetFont(m.config.font, m.config.medium_font_size) editbox:SetFont(m.config.font, m.config.medium_font_size)
editbox:SetShadowColor(0, 0, 0, 0) editbox:SetShadowColor(0, 0, 0, 0)
m.set_content_style(editbox) m.set_content_style(editbox)
editbox:SetScript('OnEditFocusGained', aux._(editbox.HighlightText, editbox)) editbox:SetScript('OnEditFocusGained', aux._(editbox.HighlightText, aux.this))
editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, editbox, 0, 0)) editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, aux.this, 0, 0))
editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, editbox)) editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, aux.this))
do do
local last_time, last_x, last_y local last_time, last_x, last_y
editbox:SetScript('OnMouseUp', function() editbox:SetScript('OnMouseUp', function()
@@ -377,7 +380,7 @@ end
function public.item(parent) function public.item(parent)
local item = CreateFrame('Button', nil, parent) local item = CreateFrame('Button', nil, parent)
item:SetWidth(193) item:SetWidth(260)
item:SetHeight(40) item:SetHeight(40)
local icon = CreateFrame('CheckButton', 'aux_frame'..aux.id(), item, 'ActionButtonTemplate') local icon = CreateFrame('CheckButton', 'aux_frame'..aux.id(), item, 'ActionButtonTemplate')
icon:SetPoint('LEFT', 2, 0.5) icon:SetPoint('LEFT', 2, 0.5)
@@ -393,12 +396,13 @@ function public.item(parent)
item.name:SetPoint('TOP', item, 'TOP', -5, 0) item.name:SetPoint('TOP', item, 'TOP', -5, 0)
item.name:SetPoint('BOTTOM', item, 'BOTTOM', 5, 0) item.name:SetPoint('BOTTOM', item, 'BOTTOM', 5, 0)
item.count = getglobal(icon:GetName()..'Count') item.count = getglobal(icon:GetName()..'Count')
item.count:SetTextHeight(17)
return item return item
end end
function public.label(parent, size) function public.label(parent, size)
local label = parent:CreateFontString() local label = parent:CreateFontString()
label:SetFont(m.config.font, size or m.config.medium_font_size) label:SetFont(m.config.font, size or m.config.small_font_size)
label:SetTextColor(unpack(m.color.label.enabled)) label:SetTextColor(unpack(m.color.label.enabled))
return label return label
end end
@@ -432,49 +436,24 @@ end
function public.dropdown(parent) function public.dropdown(parent)
local dropdown = CreateFrame('Frame', 'aux_frame'..aux.id(), parent, 'UIDropDownMenuTemplate') local dropdown = CreateFrame('Frame', 'aux_frame'..aux.id(), parent, 'UIDropDownMenuTemplate')
m.set_content_style(dropdown, 0, 0, 2, 2)
dropdown:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]], edgeFile=[[Interface\Buttons\WHITE8X8]], edgeSize=m.config.edge_size, insets={top=5,bottom=5}} getglobal(dropdown:GetName()..'Left'):Hide()
dropdown:SetBackdropColor(unpack(m.color.content.backdrop)) getglobal(dropdown:GetName()..'Middle'):Hide()
dropdown:SetBackdropBorderColor(unpack(m.color.content.border)) getglobal(dropdown:GetName()..'Right'):Hide()
local left = getglobal(dropdown:GetName()..'Left'):Hide()
local middle = getglobal(dropdown:GetName()..'Middle'):Hide()
local right = getglobal(dropdown:GetName()..'Right'):Hide()
local button = getglobal(dropdown:GetName()..'Button') local button = getglobal(dropdown:GetName()..'Button')
button:ClearAllPoints() button:ClearAllPoints()
button:SetPoint('RIGHT', dropdown, 0, 0) button:SetPoint('RIGHT', dropdown, -1, 0)
dropdown.button = button
local text = getglobal(dropdown:GetName()..'Text') local text = getglobal(dropdown:GetName()..'Text')
text:ClearAllPoints() text:ClearAllPoints()
text:SetPoint('RIGHT', button, 'LEFT', -2, 0) text:SetPoint('RIGHT', button, 'LEFT', -2, 0)
text:SetPoint('LEFT', dropdown, 'LEFT', 8, 0) text:SetPoint('LEFT', 8, 0)
text:SetFont(m.config.font, m.config.medium_font_size) text:SetFont(m.config.font, m.config.medium_font_size)
text:SetShadowColor(0, 0, 0, 0) text:SetShadowColor(0, 0, 0, 0)
--
-- dropdown:ClearAllPoints()
-- dropdown:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -7, 0)
-- dropdown:SetScript("OnHide", nil)
-- dropdown:SetScript("OnEnter", Control_OnEnter)
-- dropdown:SetScript("OnLeave", Control_OnLeave)
-- dropdown:SetScript("OnMouseUp", function(self, button) Dropdown_TogglePullout(self.obj.button, button) end)
-- TSMAPI.Design:SetContentColor(dropdown)
--
-- middle:ClearAllPoints()
-- right:ClearAllPoints()
--
-- middle:SetPoint("LEFT", left, "RIGHT", 0, 0)
-- middle:SetPoint("RIGHT", right, "LEFT", 0, 0)
-- right:SetPoint("TOPRIGHT", dropdown, "TOPRIGHT", 0, 17)
--
-- local button = _G[dropdown:GetName().."Button"]
-- button:RegisterForClicks("AnyUp")
-- button:SetScript("OnEnter", Control_OnEnter)
-- button:SetScript("OnLeave", Control_OnLeave)
-- button:SetScript("OnClick", Dropdown_TogglePullout)
-- button:ClearAllPoints()
-- button:SetPoint("RIGHT", dropdown, 0, 0)
return dropdown return dropdown
end end
@@ -483,19 +462,20 @@ function public.slider(parent)
local slider = CreateFrame('Slider', nil, parent) local slider = CreateFrame('Slider', nil, parent)
slider:SetOrientation('HORIZONTAL') slider:SetOrientation('HORIZONTAL')
slider:SetHeight(6) slider:SetHeight(6)
slider:SetHitRectInsets(0, 0, -8, -8) slider:SetHitRectInsets(0, 0, -12, -12)
slider:SetValue(0) slider:SetValue(0)
m.set_panel_style(slider) m.set_panel_style(slider)
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK') local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
thumb_texture:SetPoint('CENTER', 0, 0) thumb_texture:SetPoint('CENTER', 0, 0)
thumb_texture:SetTexture(unpack(m.color.content.backdrop)) thumb_texture:SetTexture(unpack(m.color.content.backdrop))
thumb_texture:SetHeight(15) thumb_texture:SetHeight(18)
thumb_texture:SetWidth(8) thumb_texture:SetWidth(8)
slider:SetThumbTexture(thumb_texture) slider:SetThumbTexture(thumb_texture)
local label = slider:CreateFontString(nil, 'OVERLAY') local label = slider:CreateFontString(nil, 'OVERLAY')
label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 6) label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 8)
label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 6) label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 8)
label:SetJustifyH('LEFT') label:SetJustifyH('LEFT')
label:SetHeight(13) label:SetHeight(13)
label:SetFont(m.config.font, m.config.small_font_size) label:SetFont(m.config.font, m.config.small_font_size)
@@ -505,6 +485,7 @@ function public.slider(parent)
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0) editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
editbox:SetWidth(50) editbox:SetWidth(50)
editbox:SetJustifyH('CENTER') editbox:SetJustifyH('CENTER')
editbox:SetFont(m.config.font, 17)
slider.label = label slider.label = label
slider.editbox = editbox slider.editbox = editbox
+1 -3
View File
@@ -1000,7 +1000,6 @@ function public.CreateAuctionResultsTable(parent, config)
RT_COUNT = RT_COUNT + 1 RT_COUNT = RT_COUNT + 1
local rt = CreateFrame('Frame', rtName, parent) local rt = CreateFrame('Frame', rtName, parent)
rt.config = config rt.config = config
-- local numRows = TSM.db.profile.auctionResultRows
local numRows = 16 local numRows = 16
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows
rt.scrollDisabled = nil rt.scrollDisabled = nil
@@ -1039,7 +1038,6 @@ function public.CreateAuctionResultsTable(parent, config)
rt.scrollFrame = scrollFrame rt.scrollFrame = scrollFrame
FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT) FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT)
-- make the scroll bar consistent with the TSM theme
local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar') local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar')
scrollBar:ClearAllPoints() scrollBar:ClearAllPoints()
scrollBar:SetPoint('BOTTOMRIGHT', rt, -4, 4) scrollBar:SetPoint('BOTTOMRIGHT', rt, -4, 4)
@@ -1073,7 +1071,7 @@ function public.CreateAuctionResultsTable(parent, config)
local text = cell:CreateFontString() local text = cell:CreateFontString()
text:SetJustifyH('CENTER') text:SetJustifyH('CENTER')
text:SetJustifyV('CENTER') text:SetJustifyV('CENTER')
text:SetFont(aux.gui.config.font, aux.gui.config.tiny_font_size) text:SetFont(aux.gui.config.font, 12)
text:SetTextColor(unpack(aux.gui.color.label.enabled)) text:SetTextColor(unpack(aux.gui.color.label.enabled))
cell:SetFontString(text) cell:SetFontString(text)
if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO
+2 -3
View File
@@ -3,7 +3,7 @@ local m, public, private = aux.module'listing'
local ST_COUNT = 0 local ST_COUNT = 0
local ST_ROW_HEIGHT = 15 local ST_ROW_HEIGHT = 15
local ST_ROW_TEXT_SIZE = 13 local ST_ROW_TEXT_SIZE = 14
local ST_HEAD_HEIGHT = 27 local ST_HEAD_HEIGHT = 27
local ST_HEAD_SPACE = 2 local ST_HEAD_SPACE = 2
local DEFAULT_COL_INFO = {{width=1}} local DEFAULT_COL_INFO = {{width=1}}
@@ -308,7 +308,7 @@ local methods = {
local text = col:CreateFontString() local text = col:CreateFontString()
text:SetJustifyV('CENTER') text:SetJustifyV('CENTER')
text:SetFont(aux.gui.config.font, aux.gui.config.medium_font_size) text:SetFont(aux.gui.config.font, 16)
text:SetTextColor(unpack(aux.gui.color.text.enabled)) text:SetTextColor(unpack(aux.gui.color.text.enabled))
text:SetAllPoints() text:SetAllPoints()
col.text = text col.text = text
@@ -427,7 +427,6 @@ function public.CreateScrollingTable(parent)
scrollFrame:SetAllPoints(contentFrame) scrollFrame:SetAllPoints(contentFrame)
st.scrollFrame = scrollFrame st.scrollFrame = scrollFrame
-- make the scroll bar consistent with the TSM theme
local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar') local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar')
scrollBar:SetWidth(12) scrollBar:SetWidth(12)
st.scrollBar = scrollBar st.scrollBar = scrollBar
+5 -5
View File
@@ -281,8 +281,8 @@ function private.update_item_configuration()
m.item.name:SetTextColor(unpack(aux.gui.color.label.enabled)) m.item.name:SetTextColor(unpack(aux.gui.color.label.enabled))
m.item.name:SetText('No item selected') m.item.name:SetText('No item selected')
m.unit_start_price:Hide() m.start_price_frame:Hide()
m.unit_buyout_price:Hide() m.buyout_price_frame:Hide()
m.stack_size_slider:Hide() m.stack_size_slider:Hide()
m.stack_count_slider:Hide() m.stack_count_slider:Hide()
m.deposit:Hide() m.deposit:Hide()
@@ -290,8 +290,8 @@ function private.update_item_configuration()
m.historical_value_button:Hide() m.historical_value_button:Hide()
m.hide_checkbox:Hide() m.hide_checkbox:Hide()
else else
m.unit_start_price:Show() m.start_price_frame:Show()
m.unit_buyout_price:Show() m.buyout_price_frame:Show()
m.stack_size_slider:Show() m.stack_size_slider:Show()
m.stack_count_slider:Show() m.stack_count_slider:Show()
m.deposit:Show() m.deposit:Show()
@@ -396,7 +396,7 @@ function private.set_item(item)
m.selected_item = item m.selected_item = item
UIDropDownMenu_Initialize(m.duration_dropdown, m.initialize_duration_dropdown) -- TODO, wtf, why is this needed -- UIDropDownMenu_Initialize(m.duration_dropdown, m.initialize_duration_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.duration_dropdown, settings.duration) UIDropDownMenu_SetSelectedValue(m.duration_dropdown, settings.duration)
m.hide_checkbox:SetChecked(settings.hidden) m.hide_checkbox:SetChecked(settings.hidden)
+53 -38
View File
@@ -65,10 +65,10 @@ aux.post_tab.FRAMES(function(m, public, private)
{ name='Auctions', width=.12, align='CENTER' }, { name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' }, { name='Left', width=.1, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' }, { name='Qty', width=.08, align='CENTER' },
{ name='Bid/ea', width=.23, align='RIGHT' }, { name='Bid/ea', width=.22, align='RIGHT' },
{ name='Bid Pct', width=.12, align='CENTER' }, { name='Bid Pct', width=.13, align='CENTER' },
{ name='Buy/ea', width=.23, align='RIGHT' }, { name='Buy/ea', width=.22, align='RIGHT' },
{ name='Buy Pct', width=.12, align='CENTER' } { name='Buy Pct', width=.13, align='CENTER' }
}) })
m.auction_listing:EnableSorting(false) m.auction_listing:EnableSorting(false)
m.auction_listing:DisableSelection(true) m.auction_listing:DisableSelection(true)
@@ -117,7 +117,7 @@ aux.post_tab.FRAMES(function(m, public, private)
end end
do do
local item = aux.gui.item(m.frame.parameters) local item = aux.gui.item(m.frame.parameters)
item:SetPoint('TOPLEFT', 10, -8) item:SetPoint('TOPLEFT', 6, -6)
item:EnableMouse() item:EnableMouse()
item:SetScript('OnReceiveDrag', function() item:SetScript('OnReceiveDrag', function()
local item_info = aux.cursor_item() local item_info = aux.cursor_item()
@@ -153,7 +153,7 @@ aux.post_tab.FRAMES(function(m, public, private)
do do
local slider = aux.gui.slider(m.frame.parameters) local slider = aux.gui.slider(m.frame.parameters)
slider:SetValueStep(1) slider:SetValueStep(1)
slider:SetPoint('TOPLEFT', 16, -73) slider:SetPoint('TOPLEFT', 13, -73)
slider:SetWidth(190) slider:SetWidth(190)
slider:SetScript('OnValueChanged', function() slider:SetScript('OnValueChanged', function()
m.quantity_update(true) m.quantity_update(true)
@@ -208,9 +208,8 @@ aux.post_tab.FRAMES(function(m, public, private)
local dropdown = aux.gui.dropdown(m.frame.parameters) local dropdown = aux.gui.dropdown(m.frame.parameters)
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21) dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
dropdown:SetWidth(90) dropdown:SetWidth(90)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Duration') label:SetText('Duration')
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
@@ -236,10 +235,16 @@ aux.post_tab.FRAMES(function(m, public, private)
private.hide_checkbox = checkbox private.hide_checkbox = checkbox
end end
do do
local editbox = aux.gui.editbox(m.frame.parameters) local frame = CreateFrame('Frame', nil, m.frame.parameters)
editbox:SetPoint('TOPRIGHT', -65, -66) private.start_price_frame = frame
editbox:SetJustifyH('RIGHT') aux.gui.set_content_style(frame)
editbox:SetWidth(150) frame:SetPoint('TOPRIGHT', -71, -50)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetJustifyH('RIGHT')
editbox:SetFont(aux.gui.config.font, 17)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3)) this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3))
m.refresh = true m.refresh = true
@@ -253,28 +258,29 @@ aux.post_tab.FRAMES(function(m, public, private)
m.unit_buyout_price:SetFocus() m.unit_buyout_price:SetFocus()
end end
end) end)
editbox:SetScript('OnEnterPressed', function()
this:ClearFocus()
end)
editbox:SetScript('OnEditFocusGained', function() editbox:SetScript('OnEditFocusGained', function()
this:HighlightText() this:HighlightText()
this.pretty:Hide() this.pretty:Hide()
this:SetAlpha(1)
end) end)
editbox:SetScript('OnEditFocusLost', function() editbox:SetScript('OnEditFocusLost', function()
this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true)) this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show() this.pretty:Show()
this:SetAlpha(0)
end) end)
editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size) editbox:SetAlpha(0)
editbox.pretty:SetAllPoints() editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH('RIGHT')
do do
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(frame, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText('Unit Starting Price') label:SetText('Unit Starting Price')
end end
do do
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(frame, 14)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0) label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
private.start_price_percentage = label private.start_price_percentage = label
@@ -282,10 +288,16 @@ aux.post_tab.FRAMES(function(m, public, private)
private.unit_start_price = editbox private.unit_start_price = editbox
end end
do do
local editbox = aux.gui.editbox(m.frame.parameters) local frame = CreateFrame('Frame', nil, m.frame.parameters)
editbox:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -18) private.buyout_price_frame = frame
editbox:SetJustifyH('RIGHT') aux.gui.set_content_style(frame)
editbox:SetWidth(150) frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetJustifyH('RIGHT')
editbox:SetFont(aux.gui.config.font, 17)
editbox:SetScript('OnTextChanged', function() editbox:SetScript('OnTextChanged', function()
this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3)) this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3))
m.refresh = true m.refresh = true
@@ -303,22 +315,26 @@ aux.post_tab.FRAMES(function(m, public, private)
editbox:SetScript('OnEditFocusGained', function() editbox:SetScript('OnEditFocusGained', function()
this:HighlightText() this:HighlightText()
this.pretty:Hide() this.pretty:Hide()
this:SetAlpha(1)
end) end)
editbox:SetScript('OnEditFocusLost', function() editbox:SetScript('OnEditFocusLost', function()
this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true)) this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show() this.pretty:Show()
this:SetAlpha(0)
end) end)
editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size) editbox:SetAlpha(0)
editbox.pretty:SetAllPoints() editbox.pretty = aux.gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT') editbox.pretty:SetJustifyH('RIGHT')
do do
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(frame, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
label:SetText('Unit Buyout Price') label:SetText('Unit Buyout Price')
end end
do do
local label = aux.gui.label(editbox, aux.gui.config.small_font_size) local label = aux.gui.label(frame, 14)
label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0) label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
label:SetWidth(50) label:SetWidth(50)
label:SetJustifyH('CENTER') label:SetJustifyH('CENTER')
private.buyout_price_percentage = label private.buyout_price_percentage = label
@@ -326,11 +342,10 @@ aux.post_tab.FRAMES(function(m, public, private)
private.unit_buyout_price = editbox private.unit_buyout_price = editbox
end end
do do
local btn = aux.gui.button(m.frame.parameters, 16) local btn = aux.gui.button(m.frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -15, -143) btn:SetPoint('TOPRIGHT', -14, -146)
btn:SetWidth(150) btn:SetWidth(150)
btn:SetHeight(20) btn:SetHeight(20)
btn:GetFontString():SetTextHeight(15)
btn:GetFontString():SetJustifyH('RIGHT') btn:GetFontString():SetJustifyH('RIGHT')
btn:GetFontString():SetPoint('RIGHT', 0, 0) btn:GetFontString():SetPoint('RIGHT', 0, 0)
btn:SetScript('OnClick', function() btn:SetScript('OnClick', function()
+18 -9
View File
@@ -630,11 +630,14 @@ end
function private.initialize_class_dropdown() function private.initialize_class_dropdown()
local function on_click() local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(m.class_dropdown) then local old_value = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
if this.value ~= old_value then
UIDropDownMenu_ClearAll(m.subclass_dropdown) UIDropDownMenu_ClearAll(m.subclass_dropdown)
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown)
UIDropDownMenu_ClearAll(m.slot_dropdown) UIDropDownMenu_ClearAll(m.slot_dropdown)
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
end end
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
end end
UIDropDownMenu_AddButton{ UIDropDownMenu_AddButton{
@@ -655,15 +658,19 @@ end
function private.initialize_subclass_dropdown() function private.initialize_subclass_dropdown()
local function on_click() local function on_click()
if this.value ~= UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) then local old_value = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
if this.value ~= old_value then
UIDropDownMenu_ClearAll(m.slot_dropdown) UIDropDownMenu_ClearAll(m.slot_dropdown)
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
end end
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
end end
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown) local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
if class_index and GetAuctionItemSubClasses(class_index) then if class_index and GetAuctionItemSubClasses(class_index) then
m.subclass_dropdown.button:Enable()
UIDropDownMenu_AddButton{ UIDropDownMenu_AddButton{
text = ALL, text = ALL,
value = 0, value = 0,
@@ -677,6 +684,8 @@ function private.initialize_subclass_dropdown()
func = on_click, func = on_click,
} }
end end
else
m.subclass_dropdown.button:Disable()
end end
end end
@@ -690,6 +699,8 @@ function private.initialize_slot_dropdown()
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
if class_index and subclass_index and GetAuctionInvTypes(class_index, subclass_index) then if class_index and subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
m.slot_dropdown.button:Enable()
UIDropDownMenu_AddButton{ UIDropDownMenu_AddButton{
text = ALL, text = ALL,
value = 0, value = 0,
@@ -704,6 +715,8 @@ function private.initialize_slot_dropdown()
func = on_click, func = on_click,
} }
end end
else
m.slot_dropdown.button:Disable()
end end
end end
@@ -825,17 +838,13 @@ function private.set_form(components)
m.usable_checkbox:SetChecked(true) m.usable_checkbox:SetChecked(true)
elseif filter[1] == 'class' then elseif filter[1] == 'class' then
class_index = aux.info.item_class_index(filter[2]) class_index = aux.info.item_class_index(filter[2])
UIDropDownMenu_Initialize(m.class_dropdown, m.initialize_class_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index) UIDropDownMenu_SetSelectedValue(m.class_dropdown, class_index)
elseif filter[1] == 'subclass' then elseif filter[1] == 'subclass' then
subclass_index = aux.info.item_subclass_index(class_index, filter[2]) subclass_index = aux.info.item_subclass_index(class_index, filter[2])
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index) UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, subclass_index)
elseif filter[1] == 'slot' then elseif filter[1] == 'slot' then
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, ({GetAuctionInvTypes(class_index, subclass_index)})[aux.info.item_slot_index(class_index, subclass_index, filter[2])]) UIDropDownMenu_SetSelectedValue(m.slot_dropdown, ({GetAuctionInvTypes(class_index, subclass_index)})[aux.info.item_slot_index(class_index, subclass_index, filter[2])])
elseif filter[1] == 'quality' then elseif filter[1] == 'quality' then
UIDropDownMenu_Initialize(m.quality_dropdown, m.initialize_quality_dropdown) -- TODO, wtf, why is this needed
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, aux.info.item_quality_index(filter[2])) UIDropDownMenu_SetSelectedValue(m.quality_dropdown, aux.info.item_quality_index(filter[2]))
end end
end end
@@ -903,7 +912,7 @@ end
function private.update_filter_display() function private.update_filter_display()
local lines = aux.util.size(aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end)) local lines = aux.util.size(aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end))
local width_scale = max(200/m.filter_display:GetStringWidth()) local width_scale = max(260/m.filter_display:GetStringWidth())
local height_scale = min((200 / lines) / 18) local height_scale = min((200 / lines) / 18)
m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale)) m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale))
m.filter_display:SetText(aux.filter.indented_post_query_string(m.post_components)) m.filter_display:SetText(aux.filter.indented_post_query_string(m.post_components))
+16 -21
View File
@@ -84,7 +84,7 @@ aux.search_tab.FRAMES(function(m, public, private)
this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) this:SetBackdropColor(unpack(aux.gui.color.state.disabled))
end end
end) end)
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) local label = aux.gui.label(editbox, 14)
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0) label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
label:SetText('Pages') label:SetText('Pages')
label:SetTextColor(unpack(aux.gui.color.text.enabled)) label:SetTextColor(unpack(aux.gui.color.text.enabled))
@@ -365,7 +365,7 @@ aux.search_tab.FRAMES(function(m, public, private)
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(m.frame.filter)
editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end) editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -26) editbox:SetPoint('TOPLEFT', 14, -25)
editbox:SetWidth(260) editbox:SetWidth(260)
editbox:SetScript('OnChar', function() editbox:SetScript('OnChar', function()
if m.exact_checkbox:GetChecked() then if m.exact_checkbox:GetChecked() then
@@ -395,7 +395,7 @@ aux.search_tab.FRAMES(function(m, public, private)
end end
do do
local editbox = aux.gui.editbox(m.frame.filter) local editbox = aux.gui.editbox(m.frame.filter)
editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -28) editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -26)
editbox:SetWidth(125) editbox:SetWidth(125)
editbox:SetNumeric(true) editbox:SetNumeric(true)
editbox:SetMaxLetters(2) editbox:SetMaxLetters(2)
@@ -441,11 +441,10 @@ aux.search_tab.FRAMES(function(m, public, private)
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -26) dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -24)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Class') label:SetText('Item Class')
UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
@@ -455,52 +454,49 @@ aux.search_tab.FRAMES(function(m, public, private)
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -22) private.subclass_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Subclass') label:SetText('Item Subclass')
UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown) UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown)
end) end)
private.subclass_dropdown = dropdown
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -22) private.slot_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Item Slot') label:SetText('Item Slot')
UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown) UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown)
end) end)
private.slot_dropdown = dropdown
end end
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -22) private.quality_dropdown = dropdown
dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -23)
dropdown:SetWidth(300) dropdown:SetWidth(300)
dropdown:SetHeight(10)
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
label:SetText('Min Rarity') label:SetText('Min Quality')
UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown) UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown)
end) end)
private.quality_dropdown = dropdown
end end
aux.gui.vertical_line(m.frame.filter, 332) aux.gui.vertical_line(m.frame.filter, 332)
do do
local dropdown = aux.gui.dropdown(m.frame.filter) local dropdown = aux.gui.dropdown(m.frame.filter)
dropdown:SetPoint('TOPRIGHT', -177, -10) dropdown:SetPoint('TOPRIGHT', -177, -10)
dropdown:SetWidth(150) dropdown:SetWidth(150)
dropdown:SetHeight(10)
UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown) UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown)
dropdown:SetScript('OnShow', function() dropdown:SetScript('OnShow', function()
UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown) UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown)
@@ -530,7 +526,6 @@ aux.search_tab.FRAMES(function(m, public, private)
local input = aux.gui.editbox(m.frame.filter) local input = aux.gui.editbox(m.frame.filter)
input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0)
input:SetWidth(150) input:SetWidth(150)
input:SetHeight(25)
input:SetScript('OnChar', function() input:SetScript('OnChar', function()
this:complete() this:complete()
end) end)
+4 -4
View File
@@ -262,7 +262,7 @@ function private.blizzard_filter_parser()
if not filters.quality then if not filters.quality then
filter = {'quality', str} filter = {'quality', str}
else else
return nil, 'Erroneous rarity modifier' return nil, 'Erroneous quality modifier'
end end
elseif str == 'usable' then elseif str == 'usable' then
if not filters.usable then if not filters.usable then
@@ -514,7 +514,7 @@ function public.query_string(components)
for _, component in components.post do for _, component in components.post do
if component[1] == 'operator' then if component[1] == 'operator' then
prettified.append(component[2]..(tonumber(component[3]) or '')) prettified.append(component[2]..(component[2] ~= 'not' and tonumber(component[3]) or ''))
elseif component[1] == 'filter' then elseif component[1] == 'filter' then
prettified.append(component[2]) prettified.append(component[2])
if component[3] then if component[3] then
@@ -543,7 +543,7 @@ function public.indented_post_query_string(components)
if component[1] == 'operator' and component[2] then if component[1] == 'operator' and component[2] then
no_line_break = component[2] == 'not' no_line_break = component[2] == 'not'
str = str..'|cffffff00'..component[2]..(tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE str = str..'|cffffff00'..component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE
tinsert(stack, component[3] or '*') tinsert(stack, component[3] or '*')
elseif component[1] == 'filter' then elseif component[1] == 'filter' then
str = str..'|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE str = str..'|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE
@@ -586,7 +586,7 @@ function private.prettified_query_string(components)
for _, component in components.post do for _, component in components.post do
if component[1] == 'operator' then if component[1] == 'operator' then
prettified.append('|cffffff00'..component[2]..(tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE) prettified.append('|cffffff00'..component[2]..(component[2] ~= 'not' and tonumber(component[3]) or '')..FONT_COLOR_CODE_CLOSE)
elseif component[1] == 'filter' then elseif component[1] == 'filter' then
if component[2] ~= 'tooltip' then if component[2] ~= 'tooltip' then
prettified.append('|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE) prettified.append('|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE)