diff --git a/components/cache.lua b/components/cache.lua index ceea720..a879228 100644 --- a/components/cache.lua +++ b/components/cache.lua @@ -3,8 +3,8 @@ local m, public, private = aux.module'cache' private.MIN_ITEM_ID = 1 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'}} -local merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } +private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} +private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } aux_items = {} aux_item_ids = {} @@ -24,10 +24,8 @@ function m.LOAD() CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update) aux.control.event_listener('NEW_AUCTION_UPDATE', function() - local info = aux.info.auction_sell_item() - if info then - local item_id = aux.cache.item_id(info.name) - if item_id then + for _, info in {aux.info.auction_sell_item()} do + for _, item_id in {aux.cache.item_id(info.name)} do aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count) end end @@ -81,7 +79,7 @@ end function public.merchant_info(item_id) local buy_info 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 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) local data_string = aux_items[item_id] 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 { name = cached_data.name, 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 new_unit_price, new_limited = price / count, stock >= 0 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 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) 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, limited = buy_info.limited and new_limited, }) 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, 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) if name and not aux_item_ids[strlower(name)] then 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, quality = quality, level = level, diff --git a/core.lua b/core.lua index 5b9f204..76d065f 100644 --- a/core.lua +++ b/core.lua @@ -151,7 +151,7 @@ function public.index(t, ...) end function public.on_load() - public.version = '3.7.1' + public.version = '3.8.0' public.bids_loaded = false public.current_owner_page = nil public.last_owner_page_requested = nil diff --git a/gui.lua b/gui.lua index a4beb92..134283a 100644 --- a/gui.lua +++ b/gui.lua @@ -8,11 +8,10 @@ public.config = { window = {backdrop = {24, 24, 24, .93}, border = {30, 30, 30, 1}}, panel = {backdrop = {24, 24, 24, 1}, border = {255, 255, 255, .03}}, 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, font = [[Fonts\ARIALN.TTF]], - tiny_font_size = 12, small_font_size = 13, medium_font_size = 15, large_font_size = 18, @@ -44,19 +43,19 @@ public.inline_color = aux.index_function(function(self, key) end) function m.LOAD() - + local 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_content_style(DropDownList1Backdrop) DropDownList1:SetWidth(dropdown:GetWidth() * 0.9) - DropDownList1:SetHeight(DropDownList1:GetHeight() - 8) - DropDownList1:SetPoint('TOPLEFT', dropdown, 'BOTTOMLEFT', -2, 0) + DropDownList1:SetHeight(DropDownList1:GetHeight() - 10) + 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) - 8) - button:SetWidth(dropdown:GetWidth() - 30) + 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.medium_font_size) text:SetPoint('TOPLEFT', 18, 0) @@ -72,34 +71,45 @@ function m.LOAD() check:SetHeight(16) check:SetPoint('LEFT', 3, -1) end - while getn(arg) < 4 do - tinsert(arg, nil) + else + 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 - tinsert(arg, 0) - tinsert(arg, 10) - end return unpack(ret) end) 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} +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, insets={left=left, right=right, top=top, bottom=bottom}} frame:SetBackdropColor(unpack(backdrop_color)) frame:SetBackdropBorderColor(unpack(border_color)) end -function public.set_window_style(frame) - m.set_frame_style(frame, m.color.window.backdrop, m.color.window.border) +function public.set_window_style(frame, left, right, top, bottom) + m.set_frame_style(frame, m.color.window.backdrop, m.color.window.border, left, right, top, bottom) end -function public.set_panel_style(frame) - m.set_frame_style(frame, m.color.panel.backdrop, m.color.panel.border) +function public.set_panel_style(frame, left, right, top, bottom) + m.set_frame_style(frame, m.color.panel.backdrop, m.color.panel.border, left, right, top, bottom) end -function public.set_content_style(frame) - m.set_frame_style(frame, m.color.content.backdrop, m.color.content.border) +function public.set_content_style(frame, left, right, top, bottom) + m.set_frame_style(frame, m.color.content.backdrop, m.color.content.border, left, right, top, bottom) end function public.panel(parent) @@ -128,7 +138,7 @@ function public.checkbutton(parent, text_height) end 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) m.set_content_style(button) local highlight = button:CreateTexture(nil, 'HIGHLIGHT') @@ -165,128 +175,121 @@ function public.resize_tab(tab, width, padding) tab:SetWidth(width + padding + 10) end -function public.update_tab(tab) -end +function public.tab_group(parent, orientation) -do - local id = 0 - function public.tab_group(parent, orientation) - id = id + 1 + local frame = CreateFrame('Frame', nil, parent) + frame:SetHeight(100) + frame:SetWidth(100) - local frame = CreateFrame('Frame', nil, parent) - frame:SetHeight(100) - frame:SetWidth(100) + local self = { + id = aux.id(), + frame = parent, + tabs = {}, + } - local self = { - id = id, - frame = parent, - tabs = {}, - } + function self:create_tab(text) + local id = getn(self.tabs) + 1 - function self:create_tab(text) - local id = getn(self.tabs) + 1 + local tab = CreateFrame('Button', 'aux_tab_group'..self.id..'_tab'..id, self.frame) + 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.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) + 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 - dock:SetPoint('BOTTOMLEFT', 1, -1) - dock:SetPoint('BOTTOMRIGHT', -1, -1) + tab:SetPoint('BOTTOMLEFT', self.frame, 'TOPLEFT', 4, -1) elseif orientation == 'DOWN' then - dock:SetPoint('TOPLEFT', 1, 1) - dock:SetPoint('TOPRIGHT', -1, 1) + tab:SetPoint('TOPLEFT', self.frame, 'BOTTOMLEFT', 4, 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 - - 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 + 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 - return self + 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 + + return self end function public.editbox(parent) local editbox = CreateFrame('EditBox', nil, parent) editbox:SetAutoFocus(false) - editbox:SetTextInsets(0, 0, 3, 3) + editbox:SetTextInsets(1, 2, 3, 3) editbox:SetMaxLetters(256) - editbox:SetHeight(19) + editbox:SetHeight(22) editbox:SetFont(m.config.font, m.config.medium_font_size) editbox:SetShadowColor(0, 0, 0, 0) m.set_content_style(editbox) - editbox:SetScript('OnEditFocusGained', aux._(editbox.HighlightText, editbox)) - editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, editbox, 0, 0)) - editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, editbox)) + editbox:SetScript('OnEditFocusGained', aux._(editbox.HighlightText, aux.this)) + editbox:SetScript('OnEditFocusLost', aux._(editbox.HighlightText, aux.this, 0, 0)) + editbox:SetScript('OnEscapePressed', aux._(editbox.ClearFocus, aux.this)) do local last_time, last_x, last_y editbox:SetScript('OnMouseUp', function() @@ -377,7 +380,7 @@ end function public.item(parent) local item = CreateFrame('Button', nil, parent) - item:SetWidth(193) + item:SetWidth(260) item:SetHeight(40) local icon = CreateFrame('CheckButton', 'aux_frame'..aux.id(), item, 'ActionButtonTemplate') 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('BOTTOM', item, 'BOTTOM', 5, 0) item.count = getglobal(icon:GetName()..'Count') + item.count:SetTextHeight(17) return item end function public.label(parent, size) 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)) return label end @@ -432,49 +436,24 @@ end function public.dropdown(parent) 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}} - dropdown:SetBackdropColor(unpack(m.color.content.backdrop)) - dropdown:SetBackdropBorderColor(unpack(m.color.content.border)) - local left = getglobal(dropdown:GetName()..'Left'):Hide() - local middle = getglobal(dropdown:GetName()..'Middle'):Hide() - local right = getglobal(dropdown:GetName()..'Right'):Hide() + getglobal(dropdown:GetName()..'Left'):Hide() + getglobal(dropdown:GetName()..'Middle'):Hide() + getglobal(dropdown:GetName()..'Right'):Hide() local button = getglobal(dropdown:GetName()..'Button') button:ClearAllPoints() - button:SetPoint('RIGHT', dropdown, 0, 0) + button:SetPoint('RIGHT', dropdown, -1, 0) + dropdown.button = button local text = getglobal(dropdown:GetName()..'Text') text:ClearAllPoints() 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: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 end @@ -483,19 +462,20 @@ function public.slider(parent) local slider = CreateFrame('Slider', nil, parent) slider:SetOrientation('HORIZONTAL') slider:SetHeight(6) - slider:SetHitRectInsets(0, 0, -8, -8) + slider:SetHitRectInsets(0, 0, -12, -12) slider:SetValue(0) + m.set_panel_style(slider) local thumb_texture = slider:CreateTexture(nil, 'ARTWORK') thumb_texture:SetPoint('CENTER', 0, 0) thumb_texture:SetTexture(unpack(m.color.content.backdrop)) - thumb_texture:SetHeight(15) + thumb_texture:SetHeight(18) thumb_texture:SetWidth(8) slider:SetThumbTexture(thumb_texture) local label = slider:CreateFontString(nil, 'OVERLAY') - label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 6) - label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 6) + label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 8) + label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 8) label:SetJustifyH('LEFT') label:SetHeight(13) 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:SetWidth(50) editbox:SetJustifyH('CENTER') + editbox:SetFont(m.config.font, 17) slider.label = label slider.editbox = editbox diff --git a/tables/auction_listing.lua b/tables/auction_listing.lua index 1c0a323..7194c4c 100644 --- a/tables/auction_listing.lua +++ b/tables/auction_listing.lua @@ -1000,7 +1000,6 @@ function public.CreateAuctionResultsTable(parent, config) RT_COUNT = RT_COUNT + 1 local rt = CreateFrame('Frame', rtName, parent) rt.config = config --- local numRows = TSM.db.profile.auctionResultRows local numRows = 16 rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows rt.scrollDisabled = nil @@ -1039,7 +1038,6 @@ function public.CreateAuctionResultsTable(parent, config) rt.scrollFrame = scrollFrame FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT) - -- make the scroll bar consistent with the TSM theme local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar') scrollBar:ClearAllPoints() scrollBar:SetPoint('BOTTOMRIGHT', rt, -4, 4) @@ -1073,7 +1071,7 @@ function public.CreateAuctionResultsTable(parent, config) local text = cell:CreateFontString() text:SetJustifyH('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)) cell:SetFontString(text) if not column_config.isPrice then cell:SetText(column_config.title or '') end -- TODO diff --git a/tables/listing.lua b/tables/listing.lua index 4f7b379..d7bd352 100644 --- a/tables/listing.lua +++ b/tables/listing.lua @@ -3,7 +3,7 @@ local m, public, private = aux.module'listing' local ST_COUNT = 0 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_SPACE = 2 local DEFAULT_COL_INFO = {{width=1}} @@ -308,7 +308,7 @@ local methods = { local text = col:CreateFontString() 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:SetAllPoints() col.text = text @@ -427,7 +427,6 @@ function public.CreateScrollingTable(parent) scrollFrame:SetAllPoints(contentFrame) st.scrollFrame = scrollFrame - -- make the scroll bar consistent with the TSM theme local scrollBar = getglobal(scrollFrame:GetName()..'ScrollBar') scrollBar:SetWidth(12) st.scrollBar = scrollBar diff --git a/tabs/post/core.lua b/tabs/post/core.lua index fd55226..616680f 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -281,8 +281,8 @@ function private.update_item_configuration() m.item.name:SetTextColor(unpack(aux.gui.color.label.enabled)) m.item.name:SetText('No item selected') - m.unit_start_price:Hide() - m.unit_buyout_price:Hide() + m.start_price_frame:Hide() + m.buyout_price_frame:Hide() m.stack_size_slider:Hide() m.stack_count_slider:Hide() m.deposit:Hide() @@ -290,8 +290,8 @@ function private.update_item_configuration() m.historical_value_button:Hide() m.hide_checkbox:Hide() else - m.unit_start_price:Show() - m.unit_buyout_price:Show() + m.start_price_frame:Show() + m.buyout_price_frame:Show() m.stack_size_slider:Show() m.stack_count_slider:Show() m.deposit:Show() @@ -396,7 +396,7 @@ function private.set_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) m.hide_checkbox:SetChecked(settings.hidden) diff --git a/tabs/post/frames.lua b/tabs/post/frames.lua index 607b148..ccdb4d4 100644 --- a/tabs/post/frames.lua +++ b/tabs/post/frames.lua @@ -65,10 +65,10 @@ aux.post_tab.FRAMES(function(m, public, private) { name='Auctions', width=.12, align='CENTER' }, { name='Left', width=.1, align='CENTER' }, { name='Qty', width=.08, align='CENTER' }, - { name='Bid/ea', width=.23, align='RIGHT' }, - { name='Bid Pct', width=.12, align='CENTER' }, - { name='Buy/ea', width=.23, align='RIGHT' }, - { name='Buy Pct', width=.12, align='CENTER' } + { name='Bid/ea', width=.22, align='RIGHT' }, + { name='Bid Pct', width=.13, align='CENTER' }, + { name='Buy/ea', width=.22, align='RIGHT' }, + { name='Buy Pct', width=.13, align='CENTER' } }) m.auction_listing:EnableSorting(false) m.auction_listing:DisableSelection(true) @@ -117,7 +117,7 @@ aux.post_tab.FRAMES(function(m, public, private) end do local item = aux.gui.item(m.frame.parameters) - item:SetPoint('TOPLEFT', 10, -8) + item:SetPoint('TOPLEFT', 6, -6) item:EnableMouse() item:SetScript('OnReceiveDrag', function() local item_info = aux.cursor_item() @@ -153,7 +153,7 @@ aux.post_tab.FRAMES(function(m, public, private) do local slider = aux.gui.slider(m.frame.parameters) slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', 16, -73) + slider:SetPoint('TOPLEFT', 13, -73) slider:SetWidth(190) slider:SetScript('OnValueChanged', function() m.quantity_update(true) @@ -208,9 +208,8 @@ aux.post_tab.FRAMES(function(m, public, private) local dropdown = aux.gui.dropdown(m.frame.parameters) dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21) dropdown:SetWidth(90) - dropdown:SetHeight(10) 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') UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) dropdown:SetScript('OnShow', function() @@ -236,10 +235,16 @@ aux.post_tab.FRAMES(function(m, public, private) private.hide_checkbox = checkbox end do - local editbox = aux.gui.editbox(m.frame.parameters) - editbox:SetPoint('TOPRIGHT', -65, -66) - editbox:SetJustifyH('RIGHT') - editbox:SetWidth(150) + local frame = CreateFrame('Frame', nil, m.frame.parameters) + private.start_price_frame = frame + aux.gui.set_content_style(frame) + 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() this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3)) m.refresh = true @@ -253,28 +258,29 @@ aux.post_tab.FRAMES(function(m, public, private) m.unit_buyout_price:SetFocus() end end) - editbox:SetScript('OnEnterPressed', function() - this:ClearFocus() - end) editbox:SetScript('OnEditFocusGained', function() - this:HighlightText() - this.pretty:Hide() + this:HighlightText() + this.pretty:Hide() + this:SetAlpha(1) end) editbox:SetScript('OnEditFocusLost', function() - this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true)) - this.pretty:Show() + this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true)) + this.pretty:Show() + this:SetAlpha(0) end) - editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size) - editbox.pretty:SetAllPoints() + editbox:SetAlpha(0) + editbox.pretty = aux.gui.label(frame, 17) + editbox.pretty:SetPoint('LEFT', 1, 0) + editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetJustifyH('RIGHT') do - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + local label = aux.gui.label(frame, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) label:SetText('Unit Starting Price') end do - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0) + local label = aux.gui.label(frame, 14) + label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') private.start_price_percentage = label @@ -282,10 +288,16 @@ aux.post_tab.FRAMES(function(m, public, private) private.unit_start_price = editbox end do - local editbox = aux.gui.editbox(m.frame.parameters) - editbox:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -18) - editbox:SetJustifyH('RIGHT') - editbox:SetWidth(150) + local frame = CreateFrame('Frame', nil, m.frame.parameters) + private.buyout_price_frame = frame + aux.gui.set_content_style(frame) + 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() this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3)) m.refresh = true @@ -303,22 +315,26 @@ aux.post_tab.FRAMES(function(m, public, private) editbox:SetScript('OnEditFocusGained', function() this:HighlightText() this.pretty:Hide() + this:SetAlpha(1) end) editbox:SetScript('OnEditFocusLost', function() this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true)) this.pretty:Show() + this:SetAlpha(0) end) - editbox.pretty = aux.gui.label(editbox, aux.gui.config.medium_font_size) - editbox.pretty:SetAllPoints() + editbox:SetAlpha(0) + editbox.pretty = aux.gui.label(frame, 17) + editbox.pretty:SetPoint('LEFT', 1, 0) + editbox.pretty:SetPoint('RIGHT', -2, 0) editbox.pretty:SetJustifyH('RIGHT') do - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + local label = aux.gui.label(frame, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) label:SetText('Unit Buyout Price') end do - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('LEFT', editbox, 'RIGHT', 3, 0) + local label = aux.gui.label(frame, 14) + label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') private.buyout_price_percentage = label @@ -326,11 +342,10 @@ aux.post_tab.FRAMES(function(m, public, private) private.unit_buyout_price = editbox end do - local btn = aux.gui.button(m.frame.parameters, 16) - btn:SetPoint('TOPRIGHT', -15, -143) + local btn = aux.gui.button(m.frame.parameters, 14) + btn:SetPoint('TOPRIGHT', -14, -146) btn:SetWidth(150) btn:SetHeight(20) - btn:GetFontString():SetTextHeight(15) btn:GetFontString():SetJustifyH('RIGHT') btn:GetFontString():SetPoint('RIGHT', 0, 0) btn:SetScript('OnClick', function() diff --git a/tabs/search/core.lua b/tabs/search/core.lua index 8a89270..97180ed 100644 --- a/tabs/search/core.lua +++ b/tabs/search/core.lua @@ -630,11 +630,14 @@ end function private.initialize_class_dropdown() 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_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown) UIDropDownMenu_ClearAll(m.slot_dropdown) + UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) end - UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value) end UIDropDownMenu_AddButton{ @@ -655,15 +658,19 @@ end function private.initialize_subclass_dropdown() 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_Initialize(m.slot_dropdown, m.initialize_slot_dropdown) end - UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value) end local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown) if class_index and GetAuctionItemSubClasses(class_index) then + m.subclass_dropdown.button:Enable() + UIDropDownMenu_AddButton{ text = ALL, value = 0, @@ -677,6 +684,8 @@ function private.initialize_subclass_dropdown() func = on_click, } end + else + m.subclass_dropdown.button:Disable() end end @@ -690,6 +699,8 @@ function private.initialize_slot_dropdown() local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown) if class_index and subclass_index and GetAuctionInvTypes(class_index, subclass_index) then + m.slot_dropdown.button:Enable() + UIDropDownMenu_AddButton{ text = ALL, value = 0, @@ -704,6 +715,8 @@ function private.initialize_slot_dropdown() func = on_click, } end + else + m.slot_dropdown.button:Disable() end end @@ -825,17 +838,13 @@ function private.set_form(components) m.usable_checkbox:SetChecked(true) elseif filter[1] == 'class' then 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) elseif filter[1] == 'subclass' then 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) 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])]) 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])) end end @@ -903,7 +912,7 @@ end 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 width_scale = max(200/m.filter_display:GetStringWidth()) + local width_scale = max(260/m.filter_display:GetStringWidth()) local height_scale = min((200 / lines) / 18) 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)) diff --git a/tabs/search/frames.lua b/tabs/search/frames.lua index cac12ae..a4c07d5 100644 --- a/tabs/search/frames.lua +++ b/tabs/search/frames.lua @@ -84,7 +84,7 @@ aux.search_tab.FRAMES(function(m, public, private) this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) 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:SetText('Pages') label:SetTextColor(unpack(aux.gui.color.text.enabled)) @@ -365,7 +365,7 @@ aux.search_tab.FRAMES(function(m, public, private) 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, -26) + editbox:SetPoint('TOPLEFT', 14, -25) editbox:SetWidth(260) editbox:SetScript('OnChar', function() if m.exact_checkbox:GetChecked() then @@ -395,7 +395,7 @@ aux.search_tab.FRAMES(function(m, public, private) end do 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:SetNumeric(true) editbox:SetMaxLetters(2) @@ -441,11 +441,10 @@ aux.search_tab.FRAMES(function(m, public, private) end do 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:SetHeight(10) 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') UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) dropdown:SetScript('OnShow', function() @@ -455,52 +454,49 @@ aux.search_tab.FRAMES(function(m, public, private) end do 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:SetHeight(10) 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') UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) dropdown:SetScript('OnShow', function() UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown) end) - private.subclass_dropdown = dropdown end do 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:SetHeight(10) 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') UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) dropdown:SetScript('OnShow', function() UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown) end) - private.slot_dropdown = dropdown + end do 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:SetHeight(10) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -4) - label:SetText('Min Rarity') + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Min Quality') UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) dropdown:SetScript('OnShow', function() UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown) end) - private.quality_dropdown = dropdown end aux.gui.vertical_line(m.frame.filter, 332) do local dropdown = aux.gui.dropdown(m.frame.filter) dropdown:SetPoint('TOPRIGHT', -177, -10) dropdown:SetWidth(150) - dropdown:SetHeight(10) UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown) dropdown:SetScript('OnShow', function() 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) input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) input:SetWidth(150) - input:SetHeight(25) input:SetScript('OnChar', function() this:complete() end) diff --git a/util/filter.lua b/util/filter.lua index cc45a07..7b7d963 100644 --- a/util/filter.lua +++ b/util/filter.lua @@ -262,7 +262,7 @@ function private.blizzard_filter_parser() if not filters.quality then filter = {'quality', str} else - return nil, 'Erroneous rarity modifier' + return nil, 'Erroneous quality modifier' end elseif str == 'usable' then if not filters.usable then @@ -514,7 +514,7 @@ function public.query_string(components) for _, component in components.post do 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 prettified.append(component[2]) if component[3] then @@ -543,7 +543,7 @@ function public.indented_post_query_string(components) if component[1] == 'operator' and component[2] then 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 '*') elseif component[1] == 'filter' then 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 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 if component[2] ~= 'tooltip' then prettified.append('|cffffff00'..component[2]..FONT_COLOR_CODE_CLOSE)