From 1ea4a114fa6ee4fb578fba16dc0a824cd840d2ea Mon Sep 17 00:00:00 2001 From: OldManAlpha <60587722+OldManAlpha@users.noreply.github.com> Date: Wed, 25 Jun 2025 20:37:21 -0700 Subject: [PATCH] Allow for theme to be toggleable in-game Refactored UI code to run after variables are loaded so that this information can be retrieved before the UI is constructed --- aux-addon.lua | 19 +- core/slash.lua | 12 + frame.lua | 106 ++-- gui/core.lua | 8 +- tabs/auctions/frame.lua | 102 ++-- tabs/bids/frame.lua | 120 ++--- tabs/post/frame.lua | 608 +++++++++++----------- tabs/search/frame.lua | 1088 ++++++++++++++++++++------------------- 8 files changed, 1048 insertions(+), 1015 deletions(-) diff --git a/aux-addon.lua b/aux-addon.lua index 3df115c..b3fd43b 100644 --- a/aux-addon.lua +++ b/aux-addon.lua @@ -2,8 +2,7 @@ module 'aux' local T = require 'T' local post = require 'aux.tabs.post' - -M.USE_BLIZZARD_THEME = true +local gui = require 'aux.gui' M.print = T.vararg-function(arg) DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE .. ' ' .. join(map(arg, tostring), ' ')) @@ -24,12 +23,15 @@ local set_handler = {} M.handle = setmetatable({}, {__metatable=false, __newindex=function(_, k, v) set_handler[k](v) end}) do - local handlers, handlers2 = {}, {} + local handlers_INIT_UI, handlers_LOAD, handlers_LOAD2 = {}, {}, {} + function set_handler.INIT_UI(f) + tinsert(handlers_INIT_UI, f) + end function set_handler.LOAD(f) - tinsert(handlers, f) + tinsert(handlers_LOAD, f) end function set_handler.LOAD2(f) - tinsert(handlers2, f) + tinsert(handlers_LOAD2, f) end event_frame:SetScript('OnEvent', function() if event == 'ADDON_LOADED' then @@ -37,9 +39,11 @@ do auction_ui_loaded() end elseif event == 'VARIABLES_LOADED' then - for _, f in handlers do f() end + gui.set_global_theme(aux and aux.account.theme) + for _, f in handlers_INIT_UI do f() end + for _, f in handlers_LOAD do f() end elseif event == 'PLAYER_LOGIN' then - for _, f in handlers2 do f() end + for _, f in handlers_LOAD2 do f() end print('loaded - /aux') else _M[event]() @@ -68,6 +72,7 @@ function handle.LOAD() merchant_buy = {}, merchant_sell = {}, sharing = true, + theme = 'blizzard', }) do local key = format('%s|%s', GetCVar'realmName', UnitName'player') diff --git a/core/slash.lua b/core/slash.lua index 5b951ad..27559fa 100644 --- a/core/slash.lua +++ b/core/slash.lua @@ -4,11 +4,16 @@ local T = require 'T' local aux = require 'aux' local info = require 'aux.util.info' local post = require 'aux.tabs.post' +local gui = require 'aux.gui' function status(enabled) return (enabled and aux.color.green'on' or aux.color.red'off') end +function warn_reload() + aux.print(aux.color.orange('A relog or reload is required for this change to take effect.')) +end + _G.SLASH_AUX1 = '/aux' function SlashCmdList.AUX(command) if not command then return end @@ -27,6 +32,7 @@ function SlashCmdList.AUX(command) elseif arguments[1] == 'post' and arguments[2] == 'bid' then aux.account_data.post_bid = not aux.account_data.post_bid aux.print('post bid ' .. status(aux.account_data.post_bid)) + warn_reload() elseif arguments[1] == 'post' and arguments[2] == 'duration' and T.map('6', post.DURATION_2, '24', post.DURATION_8, '72', post.DURATION_24)[arguments[3]] then aux.account_data.post_duration = T.map('6', post.DURATION_2, '24', post.DURATION_8, '72', post.DURATION_24)[arguments[3]] aux.print('post duration ' .. aux.color.blue(aux.account_data.post_duration / 60 * 3 .. 'h')) @@ -61,6 +67,10 @@ function SlashCmdList.AUX(command) elseif arguments[1] == 'sharing' then aux.account_data.sharing = not aux.account_data.sharing aux.print('sharing ' .. status(aux.account_data.sharing)) + elseif arguments[1] == 'theme' and (arguments[2] == 'default' or arguments[2] == 'blizzard') then + aux.account_data.theme = arguments[2] + aux.print('theme ' .. aux.color.blue(aux.account_data.theme)) + warn_reload() elseif arguments[1] == 'show' and arguments[2] == 'hidden' then aux.account_data.showhidden = not aux.account_data.showhidden aux.print('show hidden ' .. status(aux.account_data.showhidden)) @@ -81,6 +91,8 @@ function SlashCmdList.AUX(command) aux.print('- clear item cache') aux.print('- populate wdb') aux.print('- sharing [' .. status(aux.account_data.sharing) .. ']') + aux.print('- theme [' .. aux.color[gui.is_blizzard() and 'red' or 'green']('default') .. ' | ' .. + aux.color[gui.is_blizzard() and 'green' or 'red']('blizzard') .. ']') aux.print('- show hidden [' .. status(aux.account_data.showhidden) .. ']') end end \ No newline at end of file diff --git a/frame.lua b/frame.lua index cdf9ab3..bc063ed 100644 --- a/frame.lua +++ b/frame.lua @@ -8,58 +8,60 @@ function handle.LOAD() end end -do - local frame = CreateFrame('Frame', 'aux_frame', UIParent) - tinsert(UISpecialFrames, 'aux_frame') - if not gui.is_blizzard() then - gui.set_window_style(frame) +function handle.INIT_UI() + do + local frame = CreateFrame('Frame', 'aux_frame', UIParent) + tinsert(UISpecialFrames, 'aux_frame') + if not gui.is_blizzard() then + gui.set_window_style(frame) + end + gui.set_size(frame, 768, 447) + if gui.is_blizzard() then + local frameBorder = CreateFrame('Frame', '$parentBorder', frame) + frameBorder:SetWidth(frame:GetWidth() + 24) + frameBorder:SetHeight(frame:GetHeight() + 24) + frameBorder:SetPoint('CENTER', frame, 'CENTER') + frameBorder:SetBackdrop({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 24, + tile = true, tileSize = 24, bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], + insets = { + left = 6, right = 6, top = 6, bottom = 6 }}) + end + frame:SetPoint('LEFT', 100, 0) + frame:SetToplevel(true) + frame:SetMovable(true) + frame:EnableMouse(true) + frame:SetClampedToScreen(true) + frame:CreateTitleRegion():SetAllPoints() + frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end) + frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end) + frame.content = CreateFrame('Frame', nil, frame) + frame.content:SetPoint('TOPLEFT', 4, -80) + frame.content:SetPoint('BOTTOMRIGHT', -4, 35) + frame:Hide() + M.frame = frame end - gui.set_size(frame, 768, 447) - if gui.is_blizzard() then - local frameBorder = CreateFrame('Frame', '$parentBorder', frame) - frameBorder:SetWidth(frame:GetWidth() + 24) - frameBorder:SetHeight(frame:GetHeight() + 24) - frameBorder:SetPoint('CENTER', frame, 'CENTER') - frameBorder:SetBackdrop({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 24, - tile = true, tileSize = 24, bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], - insets = { - left = 6, right = 6, top = 6, bottom = 6 }}) + do + tabs = gui.tabs(frame, 'DOWN') + tabs._on_select = on_tab_click + function M.set_tab(id) tabs:select(id) end + end + do + local btn = gui.button(frame) + btn:SetPoint('BOTTOMRIGHT', -5, 5) + gui.set_size(btn, 60, 24) + btn:SetText('Close') + btn:SetScript('OnClick', function() frame:Hide() end) + btn:SetFrameLevel(btn:GetFrameLevel() + 2) + close_button = btn + end + do + local btn = gui.button(frame, gui.font_size.small) + btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0) + gui.set_size(btn, gui.is_blizzard() and 80 or 60, 24) + btn:SetText(color.blizzard'Blizzard UI') + btn:SetFrameLevel(btn:GetFrameLevel() + 2) + btn:SetScript('OnClick',function() + if AuctionFrame:IsVisible() then HideUIPanel(AuctionFrame) else ShowUIPanel(AuctionFrame) end + end) end - frame:SetPoint('LEFT', 100, 0) - frame:SetToplevel(true) - frame:SetMovable(true) - frame:EnableMouse(true) - frame:SetClampedToScreen(true) - frame:CreateTitleRegion():SetAllPoints() - frame:SetScript('OnShow', function() PlaySound('AuctionWindowOpen') end) - frame:SetScript('OnHide', function() PlaySound('AuctionWindowClose'); CloseAuctionHouse() end) - frame.content = CreateFrame('Frame', nil, frame) - frame.content:SetPoint('TOPLEFT', 4, -80) - frame.content:SetPoint('BOTTOMRIGHT', -4, 35) - frame:Hide() - M.frame = frame -end -do - tabs = gui.tabs(frame, 'DOWN') - tabs._on_select = on_tab_click - function M.set_tab(id) tabs:select(id) end -end -do - local btn = gui.button(frame) - btn:SetPoint('BOTTOMRIGHT', -5, 5) - gui.set_size(btn, 60, 24) - btn:SetText('Close') - btn:SetScript('OnClick', function() frame:Hide() end) - btn:SetFrameLevel(btn:GetFrameLevel() + 2) - close_button = btn -end -do - local btn = gui.button(frame, gui.font_size.small) - btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0) - gui.set_size(btn, gui.is_blizzard() and 80 or 60, 24) - btn:SetText(color.blizzard'Blizzard UI') - btn:SetFrameLevel(btn:GetFrameLevel() + 2) - btn:SetScript('OnClick',function() - if AuctionFrame:IsVisible() then HideUIPanel(AuctionFrame) else ShowUIPanel(AuctionFrame) end - end) end \ No newline at end of file diff --git a/gui/core.lua b/gui/core.lua index dd6d077..8236d3c 100644 --- a/gui/core.lua +++ b/gui/core.lua @@ -107,8 +107,14 @@ do end end +local using_blizzard_theme = false + +function M.set_global_theme(theme) + using_blizzard_theme = theme == 'blizzard' +end + function M.is_blizzard() - return aux.USE_BLIZZARD_THEME + return using_blizzard_theme end function M.set_size(frame, width, height) diff --git a/tabs/auctions/frame.lua b/tabs/auctions/frame.lua index 689663e..024838c 100644 --- a/tabs/auctions/frame.lua +++ b/tabs/auctions/frame.lua @@ -6,57 +6,59 @@ local gui = require 'aux.gui' local auction_listing = require 'aux.gui.auction_listing' local search_tab = require 'aux.tabs.search' -frame = CreateFrame('Frame', nil, aux.frame) -frame:SetAllPoints() -frame:SetScript('OnUpdate', on_update) -frame:Hide() +function aux.handle.INIT_UI() + frame = CreateFrame('Frame', nil, aux.frame) + frame:SetAllPoints() + frame:SetScript('OnUpdate', on_update) + frame:Hide() -frame.listing = gui.panel(frame) -frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) -frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) -frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) + frame.listing = gui.panel(frame) + frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) + frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_columns) -listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8) -listing:Reset() -listing:SetHandler('OnClick', function(row, button) - if IsAltKeyDown() then - if listing:GetSelection().record == row.record then - if IsAltKeyDown() and listing:GetSelection().record == row.record then - cancel_button:Click() - end - end - elseif button == 'RightButton' then - aux.set_tab(1) - search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') - search_tab.execute(nil, false) - end -end) -listing:SetHandler('OnSelectionChanged', function(rt, datum) - if not datum then return end - find_auction(datum.record) -end) - -do - status_bar = gui.status_bar(frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(1, 1) - status_bar:set_text('') -end -do - local btn = gui.button(frame) - btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) - btn:SetText('Cancel') - btn:Disable() - cancel_button = btn -end -do - local btn = gui.button(frame) - btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0) - btn:SetText('Refresh') - btn:SetScript('OnClick', function() - scan_auctions() + listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_columns) + listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8) + listing:Reset() + listing:SetHandler('OnClick', function(row, button) + if IsAltKeyDown() then + if listing:GetSelection().record == row.record then + if IsAltKeyDown() and listing:GetSelection().record == row.record then + cancel_button:Click() + end + end + elseif button == 'RightButton' then + aux.set_tab(1) + search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') + search_tab.execute(nil, false) + end end) + listing:SetHandler('OnSelectionChanged', function(rt, datum) + if not datum then return end + find_auction(datum.record) + end) + + do + status_bar = gui.status_bar(frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(1, 1) + status_bar:set_text('') + end + do + local btn = gui.button(frame) + btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) + btn:SetText('Cancel') + btn:Disable() + cancel_button = btn + end + do + local btn = gui.button(frame) + btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0) + btn:SetText('Refresh') + btn:SetScript('OnClick', function() + scan_auctions() + end) + end end \ No newline at end of file diff --git a/tabs/bids/frame.lua b/tabs/bids/frame.lua index c7f3b47..0ceabde 100644 --- a/tabs/bids/frame.lua +++ b/tabs/bids/frame.lua @@ -6,66 +6,68 @@ local gui = require 'aux.gui' local auction_listing = require 'aux.gui.auction_listing' local search_tab = require 'aux.tabs.search' -frame = CreateFrame('Frame', nil, aux.frame) -frame:SetAllPoints() -frame:SetScript('OnUpdate', on_update) -frame:Hide() +function aux.handle.INIT_UI() + frame = CreateFrame('Frame', nil, aux.frame) + frame:SetAllPoints() + frame:SetScript('OnUpdate', on_update) + frame:Hide() -frame.listing = gui.panel(frame) -frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) -frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) -frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) + frame.listing = gui.panel(frame) + frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8) + frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -listing = auction_listing.new(frame.listing, 20, auction_listing.bids_columns) -listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8) -listing:Reset() -listing:SetHandler('OnClick', function(row, button) - if IsAltKeyDown() then - if listing:GetSelection().record == row.record then - if button == 'LeftButton' then - buyout_button:Click() - elseif button == 'RightButton' then - bid_button:Click() - end - end - elseif button == 'RightButton' then - aux.set_tab(1) - search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') - search_tab.execute(nil, false) - end -end) -listing:SetHandler('OnSelectionChanged', function(rt, datum) - if not datum then return end - find_auction(datum.record) -end) - -do - status_bar = gui.status_bar(frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(1, 0) - status_bar:set_text('') -end -do - local btn = gui.button(frame) - btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) - btn:SetText('Bid') - btn:Disable() - bid_button = btn -end -do - local btn = gui.button(frame) - btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0) - btn:SetText('Buyout') - btn:Disable() - buyout_button = btn -end -do - local btn = gui.button(frame) - btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0) - btn:SetText('Refresh') - btn:SetScript('OnClick', function() - scan_bids() + listing = auction_listing.new(frame.listing, 20, auction_listing.bids_columns) + listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8) + listing:Reset() + listing:SetHandler('OnClick', function(row, button) + if IsAltKeyDown() then + if listing:GetSelection().record == row.record then + if button == 'LeftButton' then + buyout_button:Click() + elseif button == 'RightButton' then + bid_button:Click() + end + end + elseif button == 'RightButton' then + aux.set_tab(1) + search_tab.set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') + search_tab.execute(nil, false) + end end) + listing:SetHandler('OnSelectionChanged', function(rt, datum) + if not datum then return end + find_auction(datum.record) + end) + + do + status_bar = gui.status_bar(frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(1, 0) + status_bar:set_text('') + end + do + local btn = gui.button(frame) + btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) + btn:SetText('Bid') + btn:Disable() + bid_button = btn + end + do + local btn = gui.button(frame) + btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0) + btn:SetText('Buyout') + btn:Disable() + buyout_button = btn + end + do + local btn = gui.button(frame) + btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0) + btn:SetText('Refresh') + btn:SetScript('OnClick', function() + scan_bids() + end) + end end \ No newline at end of file diff --git a/tabs/post/frame.lua b/tabs/post/frame.lua index 8d7257b..1c2983b 100644 --- a/tabs/post/frame.lua +++ b/tabs/post/frame.lua @@ -8,332 +8,334 @@ local listing = require 'aux.gui.listing' local item_listing = require 'aux.gui.item_listing' local search_tab = require 'aux.tabs.search' -local THEME_PADDING = gui.is_blizzard() and 6.5 or 2.5 +function aux.handle.INIT_UI() + local THEME_PADDING = gui.is_blizzard() and 6.5 or 2.5 -frame = CreateFrame('Frame', nil, aux.frame) -frame:SetAllPoints() -frame:SetScript('OnUpdate', on_update) -frame:Hide() + frame = CreateFrame('Frame', nil, aux.frame) + frame:SetAllPoints() + frame:SetScript('OnUpdate', on_update) + frame:Hide() -frame.content = CreateFrame('Frame', nil, frame) -frame.content:SetPoint('TOP', frame, 'TOP', 0, -8) -frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) -frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) + frame.content = CreateFrame('Frame', nil, frame) + frame.content:SetPoint('TOP', frame, 'TOP', 0, -8) + frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -frame.inventory = gui.panel(frame.content) -frame.inventory:SetWidth(212) -frame.inventory:SetPoint('TOPLEFT', 0, 0) -frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) + frame.inventory = gui.panel(frame.content) + frame.inventory:SetWidth(212) + frame.inventory:SetPoint('TOPLEFT', 0, 0) + frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) -frame.parameters = gui.panel(frame.content) -frame.parameters:SetHeight(173) -frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', THEME_PADDING, 0) -frame.parameters:SetPoint('TOPRIGHT', 0, 0) + frame.parameters = gui.panel(frame.content) + frame.parameters:SetHeight(173) + frame.parameters:SetPoint('TOPLEFT', frame.inventory, 'TOPRIGHT', THEME_PADDING, 0) + frame.parameters:SetPoint('TOPRIGHT', 0, 0) -frame.bid_listing = gui.panel(frame.content) -frame.bid_listing:SetHeight(228) -frame.bid_listing:SetWidth(271.5) -frame.bid_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', THEME_PADDING, 0) + frame.bid_listing = gui.panel(frame.content) + frame.bid_listing:SetHeight(228) + frame.bid_listing:SetWidth(271.5) + frame.bid_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', THEME_PADDING, 0) -frame.buyout_listing = gui.panel(frame.content) -frame.buyout_listing:SetPoint('TOPLEFT', frame.parameters, 'BOTTOMLEFT', 0, -THEME_PADDING) -frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) + frame.buyout_listing = gui.panel(frame.content) + frame.buyout_listing:SetPoint('TOPLEFT', frame.parameters, 'BOTTOMLEFT', 0, -THEME_PADDING) + frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) -do - local checkbox = gui.checkbox(frame.inventory) - checkbox:SetPoint('TOPLEFT', 49, -15) - checkbox:SetScript('OnClick', function() + do + local checkbox = gui.checkbox(frame.inventory) + checkbox:SetPoint('TOPLEFT', 49, -15) + checkbox:SetScript('OnClick', function() + refresh = true + end) + local label = gui.label(checkbox, gui.font_size.small) + label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) + label:SetText('Show hidden items') + show_hidden_checkbox = checkbox + end + + gui.horizontal_line(frame.inventory, -45) + + do + local f = CreateFrame('Frame', nil, frame.inventory) + f:SetPoint('TOPLEFT', 0, -51) + f:SetPoint('BOTTOMRIGHT', 0, 0) + inventory_listing = item_listing.new( + f, + function() + if arg1 == 'LeftButton' then + update_item(this.item_record) + elseif arg1 == 'RightButton' then + aux.set_tab(1) + search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact') + search_tab.execute(nil, false) + end + end, + function(item_record) + return item_record == selected_item + end + ) + end + + bid_listing = listing.new(frame.bid_listing) + bid_listing:SetColInfo{ + {name='Auctions', width=.17, align='CENTER'}, + {name='Time\nLeft', width=.11, align='CENTER'}, + {name='Stack\nSize', width=.11, align='CENTER'}, + {name='Auction Bid\n(per item)', width=.4, align='RIGHT'}, + {name='% Hist.\nValue', width=.21, align='CENTER'}, + } + bid_listing:SetSelection(function(data) + return data.record == get_bid_selection() or data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value + end) + bid_listing:SetHandler('OnClick', function(table, row_data, column, button) + if button == 'RightButton' and row_data.record == get_bid_selection() or row_data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value then + set_bid_selection() + else + set_bid_selection(row_data.record) + end + refresh = true + end) + bid_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) + stack_size_slider:SetValue(row_data.record.stack_size) refresh = true end) - local label = gui.label(checkbox, gui.font_size.small) - label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) - label:SetText('Show hidden items') - show_hidden_checkbox = checkbox -end -gui.horizontal_line(frame.inventory, -45) - -do - local f = CreateFrame('Frame', nil, frame.inventory) - f:SetPoint('TOPLEFT', 0, -51) - f:SetPoint('BOTTOMRIGHT', 0, 0) - inventory_listing = item_listing.new( - f, - function() - if arg1 == 'LeftButton' then - update_item(this.item_record) - elseif arg1 == 'RightButton' then - aux.set_tab(1) - search_tab.set_filter(strlower(info.item(this.item_record.item_id).name) .. '/exact') - search_tab.execute(nil, false) - end - end, - function(item_record) - return item_record == selected_item - end - ) -end - -bid_listing = listing.new(frame.bid_listing) -bid_listing:SetColInfo{ - {name='Auctions', width=.17, align='CENTER'}, - {name='Time\nLeft', width=.11, align='CENTER'}, - {name='Stack\nSize', width=.11, align='CENTER'}, - {name='Auction Bid\n(per item)', width=.4, align='RIGHT'}, - {name='% Hist.\nValue', width=.21, align='CENTER'}, -} -bid_listing:SetSelection(function(data) - return data.record == get_bid_selection() or data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value -end) -bid_listing:SetHandler('OnClick', function(table, row_data, column, button) - if button == 'RightButton' and row_data.record == get_bid_selection() or row_data.record.historical_value and get_bid_selection() and get_bid_selection().historical_value then - set_bid_selection() - else - set_bid_selection(row_data.record) - end - refresh = true -end) -bid_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) - stack_size_slider:SetValue(row_data.record.stack_size) - refresh = true -end) - -buyout_listing = listing.new(frame.buyout_listing) -buyout_listing:SetColInfo{ - {name='Auctions', width=.17, align='CENTER'}, - {name='Time\nLeft', width=.11, align='CENTER'}, - {name='Stack\nSize', width=.12, align='CENTER'}, - {name='Auction Buyout\n(per item)', width=.4, align='RIGHT'}, - {name='% Hist.\nValue', width=.20, align='CENTER'}, -} -buyout_listing:SetSelection(function(data) - return data.record == get_buyout_selection() or data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value -end) -buyout_listing:SetHandler('OnClick', function(table, row_data, column, button) - if button == 'RightButton' and row_data.record == get_buyout_selection() or row_data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value then - set_buyout_selection() - else - set_buyout_selection(row_data.record) - end - refresh = true -end) -buyout_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) - stack_size_slider:SetValue(row_data.record.stack_size) - refresh = true -end) - -do - status_bar = gui.status_bar(frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(1, 1) - status_bar:set_text('') -end -do - local btn = gui.button(frame.parameters) - btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) - btn:SetText('Post') - btn:SetScript('OnClick', post_auctions) - post_button = btn -end -do - local btn = gui.button(frame.parameters) - btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0) - btn:SetText('Refresh') - btn:SetScript('OnClick', refresh_button_click) - refresh_button = btn -end -do - item = gui.item(frame.parameters) - item:SetPoint('TOPLEFT', 10, -6) - item.button:SetScript('OnEnter', function() - if selected_item then - info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT') + buyout_listing = listing.new(frame.buyout_listing) + buyout_listing:SetColInfo{ + {name='Auctions', width=.17, align='CENTER'}, + {name='Time\nLeft', width=.11, align='CENTER'}, + {name='Stack\nSize', width=.12, align='CENTER'}, + {name='Auction Buyout\n(per item)', width=.4, align='RIGHT'}, + {name='% Hist.\nValue', width=.20, align='CENTER'}, + } + buyout_listing:SetSelection(function(data) + return data.record == get_buyout_selection() or data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value + end) + buyout_listing:SetHandler('OnClick', function(table, row_data, column, button) + if button == 'RightButton' and row_data.record == get_buyout_selection() or row_data.record.historical_value and get_buyout_selection() and get_buyout_selection().historical_value then + set_buyout_selection() + else + set_buyout_selection(row_data.record) end + refresh = true end) - item.button:SetScript('OnLeave', function() - GameTooltip:Hide() + buyout_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button) + stack_size_slider:SetValue(row_data.record.stack_size) + refresh = true end) -end -do - local slider = gui.slider(frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', 13, -73) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function() - quantity_update(true) - end) - slider.editbox.change = function() - slider:SetValue(this:GetNumber()) - quantity_update(true) - if selected_item then + + do + status_bar = gui.status_bar(frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(1, 1) + status_bar:set_text('') + end + do + local btn = gui.button(frame.parameters) + btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0) + btn:SetText('Post') + btn:SetScript('OnClick', post_auctions) + post_button = btn + end + do + local btn = gui.button(frame.parameters) + btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0) + btn:SetText('Refresh') + btn:SetScript('OnClick', refresh_button_click) + refresh_button = btn + end + do + item = gui.item(frame.parameters) + item:SetPoint('TOPLEFT', 10, -6) + item.button:SetScript('OnEnter', function() + if selected_item then + info.set_tooltip(selected_item.itemstring, this, 'ANCHOR_RIGHT') + end + end) + item.button:SetScript('OnLeave', function() + GameTooltip:Hide() + end) + end + do + local slider = gui.slider(frame.parameters) + slider:SetValueStep(1) + slider:SetPoint('TOPLEFT', 13, -73) + slider:SetWidth(190) + slider:SetScript('OnValueChanged', function() + quantity_update(true) + end) + slider.editbox.change = function() + slider:SetValue(this:GetNumber()) + quantity_update(true) + if selected_item then + local settings = read_settings() + write_settings(settings) + end + end + slider.editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + unit_buyout_price_input:SetFocus() + elseif stack_count_slider.editbox:IsVisible() then + stack_count_slider.editbox:SetFocus() + else + unit_start_price_input:SetFocus() + end + end) + slider.editbox:SetNumeric(true) + slider.editbox:SetMaxLetters(3) + slider.label:SetText('Stack Size') + stack_size_slider = slider + end + do + local slider = gui.slider(frame.parameters) + slider:SetValueStep(1) + slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, gui.is_blizzard() and -25 or -32) + slider:SetWidth(190) + slider:SetScript('OnValueChanged', function() + quantity_update() + end) + slider.editbox.change = function() + slider:SetValue(this:GetNumber()) + quantity_update() + end + slider.editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + stack_size_slider.editbox:SetFocus() + else + unit_start_price_input:SetFocus() + end + end) + slider.editbox:SetNumeric(true) + slider.label:SetText('Stack Count') + stack_count_slider = slider + end + do + local dropdown = gui.dropdown(frame.parameters) + dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, gui.is_blizzard() and -10 or -22) + dropdown:SetWidth(90) + local label = gui.label(dropdown, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) + label:SetText('Duration') + UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_duration_dropdown) + end) + duration_dropdown = dropdown + end + do + local checkbox = gui.checkbox(frame.parameters) + checkbox:SetPoint('TOPRIGHT', -83, -6) + checkbox:SetScript('OnClick', function() local settings = read_settings() + settings.hidden = this:GetChecked() write_settings(settings) - end - end - slider.editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - unit_buyout_price_input:SetFocus() - elseif stack_count_slider.editbox:IsVisible() then - stack_count_slider.editbox:SetFocus() - else - unit_start_price_input:SetFocus() - end - end) - slider.editbox:SetNumeric(true) - slider.editbox:SetMaxLetters(3) - slider.label:SetText('Stack Size') - stack_size_slider = slider -end -do - local slider = gui.slider(frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', stack_size_slider, 'BOTTOMLEFT', 0, gui.is_blizzard() and -25 or -32) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function() - quantity_update() - end) - slider.editbox.change = function() - slider:SetValue(this:GetNumber()) - quantity_update() - end - slider.editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - stack_size_slider.editbox:SetFocus() - else - unit_start_price_input:SetFocus() - end - end) - slider.editbox:SetNumeric(true) - slider.label:SetText('Stack Count') - stack_count_slider = slider -end -do - local dropdown = gui.dropdown(frame.parameters) - dropdown:SetPoint('TOPLEFT', stack_count_slider, 'BOTTOMLEFT', 0, gui.is_blizzard() and -10 or -22) - dropdown:SetWidth(90) - local label = gui.label(dropdown, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) - label:SetText('Duration') - UIDropDownMenu_Initialize(dropdown, initialize_duration_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_duration_dropdown) - end) - duration_dropdown = dropdown -end -do - local checkbox = gui.checkbox(frame.parameters) - checkbox:SetPoint('TOPRIGHT', -83, -6) - checkbox:SetScript('OnClick', function() - local settings = read_settings() - settings.hidden = this:GetChecked() - write_settings(settings) - refresh = true - end) - local label = gui.label(checkbox, gui.font_size.small) - label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) - label:SetText('Hide this item') - hide_checkbox = checkbox -end -do - local editbox = gui.editbox(frame.parameters) - editbox:SetPoint('TOPRIGHT', -71, -60) - editbox:SetWidth(180) - editbox:SetHeight(22) - editbox:SetAlignment('RIGHT') - editbox:SetFontSize(17) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - stack_count_slider.editbox:SetFocus() - else - unit_buyout_price_input:SetFocus() - end - end) - editbox.formatter = function() return money.to_string(get_unit_start_price(), true) end - editbox.char = function() set_bid_selection(); set_buyout_selection(); set_unit_start_price(money.from_string(this:GetText())) end - editbox.change = function() refresh = true end - editbox.enter = function() this:ClearFocus() end - editbox.focus_loss = function() - this:SetText(money.to_string(get_unit_start_price(), true, nil, nil, true)) + refresh = true + end) + local label = gui.label(checkbox, gui.font_size.small) + label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) + label:SetText('Hide this item') + hide_checkbox = checkbox end do - local label = gui.label(editbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Unit Starting Price') - end - do - local label = gui.label(editbox, 14) - label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) - label:SetWidth(50) - label:SetJustifyH('CENTER') - start_price_percentage = label - end - unit_start_price_input = editbox -end -do - local editbox = gui.editbox(frame.parameters) - editbox:SetPoint('TOPRIGHT', unit_start_price_input, 'BOTTOMRIGHT', 0, -19) - editbox:SetWidth(180) - editbox:SetHeight(22) - editbox:SetAlignment('RIGHT') - editbox:SetFontSize(17) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - unit_start_price_input:SetFocus() - else - stack_size_slider.editbox:SetFocus() + local editbox = gui.editbox(frame.parameters) + editbox:SetPoint('TOPRIGHT', -71, -60) + editbox:SetWidth(180) + editbox:SetHeight(22) + editbox:SetAlignment('RIGHT') + editbox:SetFontSize(17) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + stack_count_slider.editbox:SetFocus() + else + unit_buyout_price_input:SetFocus() + end + end) + editbox.formatter = function() return money.to_string(get_unit_start_price(), true) end + editbox.char = function() set_bid_selection(); set_buyout_selection(); set_unit_start_price(money.from_string(this:GetText())) end + editbox.change = function() refresh = true end + editbox.enter = function() this:ClearFocus() end + editbox.focus_loss = function() + this:SetText(money.to_string(get_unit_start_price(), true, nil, nil, true)) end - end) - editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true) end - editbox.char = function() set_buyout_selection(); set_unit_buyout_price(money.from_string(this:GetText())) end - editbox.change = function() refresh = true end - editbox.enter = function() this:ClearFocus() end - editbox.focus_loss = function() - this:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true)) + do + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Unit Starting Price') + end + do + local label = gui.label(editbox, 14) + label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) + label:SetWidth(50) + label:SetJustifyH('CENTER') + start_price_percentage = label + end + unit_start_price_input = editbox end do - local label = gui.label(editbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Unit Buyout Price') + local editbox = gui.editbox(frame.parameters) + editbox:SetPoint('TOPRIGHT', unit_start_price_input, 'BOTTOMRIGHT', 0, -19) + editbox:SetWidth(180) + editbox:SetHeight(22) + editbox:SetAlignment('RIGHT') + editbox:SetFontSize(17) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + unit_start_price_input:SetFocus() + else + stack_size_slider.editbox:SetFocus() + end + end) + editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true) end + editbox.char = function() set_buyout_selection(); set_unit_buyout_price(money.from_string(this:GetText())) end + editbox.change = function() refresh = true end + editbox.enter = function() this:ClearFocus() end + editbox.focus_loss = function() + this:SetText(money.to_string(get_unit_buyout_price(), true, nil, nil, true)) + end + do + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Unit Buyout Price') + end + do + local label = gui.label(editbox, 14) + label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) + label:SetWidth(50) + label:SetJustifyH('CENTER') + buyout_price_percentage = label + end + unit_buyout_price_input = editbox end do - local label = gui.label(editbox, 14) - label:SetPoint('LEFT', editbox, 'RIGHT', 8, 0) - label:SetWidth(50) - label:SetJustifyH('CENTER') - buyout_price_percentage = label + local label = gui.label(frame.parameters, gui.font_size.medium) + label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', -180, -24) + deposit = label + end + do + local label = gui.label(frame.parameters, gui.font_size.medium) + label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', 0, -24) + vendor_price_label = label end - unit_buyout_price_input = editbox -end -do - local label = gui.label(frame.parameters, gui.font_size.medium) - label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', -180, -24) - deposit = label -end -do - local label = gui.label(frame.parameters, gui.font_size.medium) - label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', 0, -24) - vendor_price_label = label -end -function aux.handle.LOAD() - if aux.account_data.post_bid then - frame.bid_listing:SetPoint('TOPLEFT', frame.parameters, 'BOTTOMLEFT', 0, -THEME_PADDING) - frame.bid_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', THEME_PADDING, 0) - frame.bid_listing:SetWidth(271.5 - (THEME_PADDING / 2)) + function aux.handle.LOAD() + if aux.account_data.post_bid then + frame.bid_listing:SetPoint('TOPLEFT', frame.parameters, 'BOTTOMLEFT', 0, -THEME_PADDING) + frame.bid_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', THEME_PADDING, 0) + frame.bid_listing:SetWidth(271.5 - (THEME_PADDING / 2)) - frame.buyout_listing:ClearAllPoints() - frame.buyout_listing:SetPoint('TOPLEFT', frame.bid_listing, 'TOPRIGHT', THEME_PADDING, 0) - frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) - else - frame.bid_listing:Hide() - buyout_listing:SetColInfo{ - {name='Auctions', width=.15, align='CENTER'}, - {name='Time Left', width=.15, align='CENTER'}, - {name='Stack Size', width=.15, align='CENTER'}, - {name='Auction Buyout (per item)', width=.4, align='RIGHT'}, - {name='% Hist. Value', width=.15, align='CENTER'}, - } - end + frame.buyout_listing:ClearAllPoints() + frame.buyout_listing:SetPoint('TOPLEFT', frame.bid_listing, 'TOPRIGHT', THEME_PADDING, 0) + frame.buyout_listing:SetPoint('BOTTOMRIGHT', 0, 0) + else + frame.bid_listing:Hide() + buyout_listing:SetColInfo{ + {name='Auctions', width=.15, align='CENTER'}, + {name='Time Left', width=.15, align='CENTER'}, + {name='Stack Size', width=.15, align='CENTER'}, + {name='Auction Buyout (per item)', width=.4, align='RIGHT'}, + {name='% Hist. Value', width=.15, align='CENTER'}, + } + end + end end \ No newline at end of file diff --git a/tabs/search/frame.lua b/tabs/search/frame.lua index 8bed88e..a9ece54 100644 --- a/tabs/search/frame.lua +++ b/tabs/search/frame.lua @@ -10,562 +10,564 @@ local gui = require 'aux.gui' local listing = require 'aux.gui.listing' local auction_listing = require 'aux.gui.auction_listing' -local FILTER_SPACING = 28.5 -local THEME_PADDING = gui.is_blizzard() and 4 or 0 +function aux.handle.INIT_UI() + local FILTER_SPACING = 28.5 + local THEME_PADDING = gui.is_blizzard() and 4 or 0 -frame = CreateFrame('Frame', nil, aux.frame) -frame:SetAllPoints() -frame:SetScript('OnUpdate', on_update) -frame:Hide() + frame = CreateFrame('Frame', nil, aux.frame) + frame:SetAllPoints() + frame:SetScript('OnUpdate', on_update) + frame:Hide() -frame.filter = gui.panel(frame) -frame.filter:SetAllPoints(aux.frame.content) + frame.filter = gui.panel(frame) + frame.filter:SetAllPoints(aux.frame.content) -frame.results = gui.panel(frame) -frame.results:SetAllPoints(aux.frame.content) + frame.results = gui.panel(frame) + frame.results:SetAllPoints(aux.frame.content) -frame.saved = CreateFrame('Frame', nil, frame) -frame.saved:SetAllPoints(aux.frame.content) + frame.saved = CreateFrame('Frame', nil, frame) + frame.saved:SetAllPoints(aux.frame.content) -frame.saved.favorite = gui.panel(frame.saved) -frame.saved.favorite:SetWidth(393 - THEME_PADDING) -frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) -frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0) + frame.saved.favorite = gui.panel(frame.saved) + frame.saved.favorite:SetWidth(393 - THEME_PADDING) + frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) + frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0) -frame.saved.recent = gui.panel(frame.saved) -frame.saved.recent:SetWidth(364.5) -frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) -frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) -do - local btn = gui.button(frame, 25) - btn:SetPoint('TOPLEFT', 5, -8) - btn:SetWidth(30) - btn:SetHeight(25) - btn:SetText('<') - btn:SetScript('OnClick', previous_search) - previous_button = btn -end -do - local btn = gui.button(frame, 25) - btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0) - btn:SetWidth(30) - btn:SetHeight(25) - btn:SetText('>') - btn:SetScript('OnClick', next_search) - next_button = btn -end -do - local btn = gui.button(frame, gui.font_size.small) - btn:SetHeight(25) - btn:SetWidth(60) - btn:SetText(aux.color.label.enabled'Range:') - btn:SetScript('OnClick', function() - update_real_time(true) - end) - range_button = btn -end -do - local btn = gui.button(frame, gui.font_size.small) - btn:SetHeight(25) - btn:SetWidth(gui.is_blizzard() and 70 or 60) - btn:Hide() - btn:SetText(aux.color.label.enabled'Real Time') - btn:SetScript('OnClick', function() - update_real_time(false) - end) - real_time_button = btn -end -do - local function change() - local page = tonumber(this:GetText()) - local valid_input = page and tostring(max(1, page)) or '' - if this:GetText() ~= valid_input then - this:SetText(valid_input) - end - end - do - local editbox = gui.editbox(range_button) - editbox:SetPoint('LEFT', range_button, 'RIGHT', gui.is_blizzard() and 8 or 4, 0) - editbox:SetWidth(40) - editbox:SetHeight(25) - editbox:SetAlignment('CENTER') - editbox:SetNumeric(true) - editbox:SetScript('OnTabPressed', function() - if not IsShiftKeyDown() then - last_page_input:SetFocus() - end + frame.saved.recent = gui.panel(frame.saved) + frame.saved.recent:SetWidth(364.5) + frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) + frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) + do + local btn = gui.button(frame, 25) + btn:SetPoint('TOPLEFT', 5, -8) + btn:SetWidth(30) + btn:SetHeight(25) + btn:SetText('<') + btn:SetScript('OnClick', previous_search) + previous_button = btn + end + do + local btn = gui.button(frame, 25) + btn:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0) + btn:SetWidth(30) + btn:SetHeight(25) + btn:SetText('>') + btn:SetScript('OnClick', next_search) + next_button = btn + end + do + local btn = gui.button(frame, gui.font_size.small) + btn:SetHeight(25) + btn:SetWidth(60) + btn:SetText(aux.color.label.enabled'Range:') + btn:SetScript('OnClick', function() + update_real_time(true) end) - editbox.enter = execute - editbox.change = change - local label = gui.label(editbox, gui.font_size.medium) - label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0) - label:SetTextColor(aux.color.label.enabled()) - label:SetText('-') - first_page_input = editbox - end - do - local editbox = gui.editbox(range_button) - editbox:SetPoint('LEFT', first_page_input, 'RIGHT', gui.is_blizzard() and 11 or 5.8, 0) - editbox:SetWidth(40) - editbox:SetHeight(25) - editbox:SetAlignment('CENTER') - editbox:SetNumeric(true) - editbox:SetScript('OnTabPressed', function() + range_button = btn + end + do + local btn = gui.button(frame, gui.font_size.small) + btn:SetHeight(25) + btn:SetWidth(gui.is_blizzard() and 70 or 60) + btn:Hide() + btn:SetText(aux.color.label.enabled'Real Time') + btn:SetScript('OnClick', function() + update_real_time(false) + end) + real_time_button = btn + end + do + local function change() + local page = tonumber(this:GetText()) + local valid_input = page and tostring(max(1, page)) or '' + if this:GetText() ~= valid_input then + this:SetText(valid_input) + end + end + do + local editbox = gui.editbox(range_button) + editbox:SetPoint('LEFT', range_button, 'RIGHT', gui.is_blizzard() and 8 or 4, 0) + editbox:SetWidth(40) + editbox:SetHeight(25) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox:SetScript('OnTabPressed', function() + if not IsShiftKeyDown() then + last_page_input:SetFocus() + end + end) + editbox.enter = execute + editbox.change = change + local label = gui.label(editbox, gui.font_size.medium) + label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0) + label:SetTextColor(aux.color.label.enabled()) + label:SetText('-') + first_page_input = editbox + end + do + local editbox = gui.editbox(range_button) + editbox:SetPoint('LEFT', first_page_input, 'RIGHT', gui.is_blizzard() and 11 or 5.8, 0) + editbox:SetWidth(40) + editbox:SetHeight(25) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + first_page_input:SetFocus() + else + search_box:SetFocus() + end + end) + editbox.enter = execute + editbox.change = change + last_page_input = editbox + end + end + do + local btn = gui.button(frame) + btn:SetHeight(25) + btn:SetPoint('TOPRIGHT', -5, -8) + btn:SetText('Search') + btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') + btn:SetScript('OnClick', function() + if arg1 == 'RightButton' then + set_filter(current_search().filter_string) + end + execute() + end) + start_button = btn + end + do + local btn = gui.button(frame) + btn:SetHeight(25) + btn:SetPoint('TOPRIGHT', -5, -8) + btn:SetText('Pause') + btn:SetScript('OnClick', function() + scan.abort(search_scan_id) + end) + stop_button = btn + end + do + local btn = gui.button(frame) + btn:SetHeight(25) + btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0) + btn:SetBackdropColor(aux.color.state.enabled()) + btn:SetText('Resume') + btn:SetScript('OnClick', function() + execute(true) + end) + resume_button = btn + end + do + local editbox = gui.editbox(frame) + editbox:EnableMouse(1) + editbox.formatter = function(str) + local queries = filter_util.queries(str) + return queries and aux.join(aux.map(aux.copy(queries), function(query) return query.prettified end), ';') or aux.color.red(str) + end + editbox.complete = completion.complete_filter + editbox.escape = function() this:SetText(current_search().filter_string or '') end + editbox:SetHeight(25) + editbox.char = function() + this:complete() + end + editbox:SetScript('OnTabPressed', function() if IsShiftKeyDown() then - first_page_input:SetFocus() + last_page_input:SetFocus() else - search_box:SetFocus() + this:HighlightText(0, 0) end end) - editbox.enter = execute - editbox.change = change - last_page_input = editbox - end -end -do - local btn = gui.button(frame) - btn:SetHeight(25) - btn:SetPoint('TOPRIGHT', -5, -8) - btn:SetText('Search') - btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') - btn:SetScript('OnClick', function() - if arg1 == 'RightButton' then - set_filter(current_search().filter_string) - end - execute() - end) - start_button = btn -end -do - local btn = gui.button(frame) - btn:SetHeight(25) - btn:SetPoint('TOPRIGHT', -5, -8) - btn:SetText('Pause') - btn:SetScript('OnClick', function() - scan.abort(search_scan_id) - end) - stop_button = btn -end -do - local btn = gui.button(frame) - btn:SetHeight(25) - btn:SetPoint('RIGHT', start_button, 'LEFT', -4, 0) - btn:SetBackdropColor(aux.color.state.enabled()) - btn:SetText('Resume') - btn:SetScript('OnClick', function() - execute(true) - end) - resume_button = btn -end -do - local editbox = gui.editbox(frame) - editbox:EnableMouse(1) - editbox.formatter = function(str) - local queries = filter_util.queries(str) - return queries and aux.join(aux.map(aux.copy(queries), function(query) return query.prettified end), ';') or aux.color.red(str) - end - editbox.complete = completion.complete_filter - editbox.escape = function() this:SetText(current_search().filter_string or '') end - editbox:SetHeight(25) - editbox.char = function() - this:complete() - end - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - last_page_input:SetFocus() - else - this:HighlightText(0, 0) - end - end) - editbox.enter = execute - search_box = editbox -end -do - gui.horizontal_line(frame, -40) -end -do - local btn = gui.button(frame, gui.font_size.large) - btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('Search Results') - btn:SetScript('OnClick', function() set_subtab(RESULTS) end) - search_results_button = btn -end -do - local btn = gui.button(frame, gui.font_size.large) - btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('Saved Searches') - btn:SetScript('OnClick', function() set_subtab(SAVED) end) - saved_searches_button = btn -end -do - local btn = gui.button(frame, gui.font_size.large) - btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('Filter Builder') - btn:SetScript('OnClick', function() set_subtab(FILTER) end) - new_filter_button = btn -end -do - local frame = CreateFrame('Frame', nil, frame) - frame:SetWidth(265) - frame:SetHeight(25) - frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) - status_bar_frame = frame -end -do - local btn = gui.button(frame.results) - btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) - btn:SetText('Bid') - btn:Disable() - bid_button = btn -end -do - local btn = gui.button(frame.results) - btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0) - btn:SetText('Buyout') - btn:Disable() - buyout_button = btn -end -do - local btn = gui.button(frame.results) - btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0) - btn:SetText('Clear') - btn:SetScript('OnClick', function() - while tremove(current_search().records) do end - current_search().table:SetDatabase() - end) -end -do - local btn = gui.button(frame.saved) - btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) - btn:SetText('Favorite') - btn:SetScript('OnClick', function() - add_favorite(search_box:GetText()) - end) -end -do - local btn1 = gui.button(frame.filter) - btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) - btn1:SetText('Search') - btn1:SetScript('OnClick', function() - export_filter_string() - execute() - end) + editbox.enter = execute + search_box = editbox + end + do + gui.horizontal_line(frame, -40) + end + do + local btn = gui.button(frame, gui.font_size.large) + btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('Search Results') + btn:SetScript('OnClick', function() set_subtab(RESULTS) end) + search_results_button = btn + end + do + local btn = gui.button(frame, gui.font_size.large) + btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('Saved Searches') + btn:SetScript('OnClick', function() set_subtab(SAVED) end) + saved_searches_button = btn + end + do + local btn = gui.button(frame, gui.font_size.large) + btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('Filter Builder') + btn:SetScript('OnClick', function() set_subtab(FILTER) end) + new_filter_button = btn + end + do + local frame = CreateFrame('Frame', nil, frame) + frame:SetWidth(265) + frame:SetHeight(25) + frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar_frame = frame + end + do + local btn = gui.button(frame.results) + btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) + btn:SetText('Bid') + btn:Disable() + bid_button = btn + end + do + local btn = gui.button(frame.results) + btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0) + btn:SetText('Buyout') + btn:Disable() + buyout_button = btn + end + do + local btn = gui.button(frame.results) + btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0) + btn:SetText('Clear') + btn:SetScript('OnClick', function() + while tremove(current_search().records) do end + current_search().table:SetDatabase() + end) + end + do + local btn = gui.button(frame.saved) + btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) + btn:SetText('Favorite') + btn:SetScript('OnClick', function() + add_favorite(search_box:GetText()) + end) + end + do + local btn1 = gui.button(frame.filter) + btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0) + btn1:SetText('Search') + btn1:SetScript('OnClick', function() + export_filter_string() + execute() + end) - local btn2 = gui.button(frame.filter) - btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0) - btn2:SetText('Export') - btn2:SetScript('OnClick', export_filter_string) + local btn2 = gui.button(frame.filter) + btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0) + btn2:SetText('Export') + btn2:SetScript('OnClick', export_filter_string) - local btn3 = gui.button(frame.filter) - btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0) - btn3:SetText('Import') - btn3:SetScript('OnClick', import_filter_string) -end -do - local editbox = gui.editbox(frame.filter) - editbox.complete_item = completion.complete(function() return aux.account_data.auctionable_items end) - editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING) - editbox:SetWidth(260) - editbox.char = function() - if blizzard_query.exact then - this:complete_item() + local btn3 = gui.button(frame.filter) + btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0) + btn3:SetText('Import') + btn3:SetScript('OnClick', import_filter_string) + end + do + local editbox = gui.editbox(frame.filter) + editbox.complete_item = completion.complete(function() return aux.account_data.auctionable_items end) + editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING) + editbox:SetWidth(260) + editbox.char = function() + if blizzard_query.exact then + this:complete_item() + end + end + editbox:SetScript('OnTabPressed', function() + if blizzard_query.exact then + return + end + if IsShiftKeyDown() then + max_level_input:SetFocus() + else + min_level_input:SetFocus() + end + end) + editbox.change = update_form + editbox.enter = function() editbox:ClearFocus() end + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Name') + name_input = editbox + end + do + local checkbox = gui.checkbox(frame.filter) + checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0) + checkbox:SetScript('OnClick', update_form) + local label = gui.label(checkbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) + label:SetText('Exact') + exact_checkbox = checkbox + end + do + local editbox = gui.editbox(frame.filter) + editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING) + editbox:SetWidth(gui.is_blizzard() and 123 or 125) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + name_input:SetFocus() + else + max_level_input:SetFocus() + end + end) + editbox.enter = function() editbox:ClearFocus() end + editbox.change = function() + local valid_level = valid_level(this:GetText()) + if tostring(valid_level) ~= this:GetText() then + this:SetText(valid_level or '') + end + update_form() + end + local label = gui.label(editbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Level Range') + min_level_input = editbox + end + do + local editbox = gui.editbox(frame.filter) + editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', gui.is_blizzard() and 14 or 10, 0) + editbox:SetWidth(gui.is_blizzard() and 123 or 125) + editbox:SetAlignment('CENTER') + editbox:SetNumeric(true) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + min_level_input:SetFocus() + else + name_input:SetFocus() + end + end) + editbox.enter = function() editbox:ClearFocus() end + editbox.change = function() + local valid_level = valid_level(this:GetText()) + if tostring(valid_level) ~= this:GetText() then + this:SetText(valid_level or '') + end + update_form() + end + local label = gui.label(editbox, gui.font_size.medium) + label:SetPoint('RIGHT', editbox, 'LEFT', gui.is_blizzard() and -7 or -3, 0) + label:SetText('-') + max_level_input = editbox + end + do + local checkbox = gui.checkbox(frame.filter) + checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0) + checkbox:SetScript('OnClick', update_form) + local label = gui.label(checkbox, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) + label:SetText('Usable') + usable_checkbox = checkbox + end + do + local dropdown = gui.dropdown(frame.filter) + class_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING) + dropdown:SetWidth(300) + local label = gui.label(dropdown, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) + label:SetText('Item Class') + UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_class_dropdown) + end) + end + do + local dropdown = gui.dropdown(frame.filter) + subclass_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) + dropdown:SetWidth(300) + local label = gui.label(dropdown, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) + label:SetText('Item Subclass') + UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_subclass_dropdown) + end) + end + do + local dropdown = gui.dropdown(frame.filter) + slot_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) + dropdown:SetWidth(300) + local label = gui.label(dropdown, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) + label:SetText('Item Slot') + UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_slot_dropdown) + end) + end + do + local dropdown = gui.dropdown(frame.filter) + quality_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) + dropdown:SetWidth(300) + local label = gui.label(dropdown, gui.font_size.small) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) + label:SetText('Min Quality') + UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_quality_dropdown) + end) + end + gui.vertical_line(frame.filter, 332) + do + local dropdown = gui.dropdown(frame.filter) + if gui.is_blizzard() then + local button = _G[dropdown:GetName() .. 'Button'] + button:ClearAllPoints() + button:SetScale(.9) + button:SetPoint('RIGHT', dropdown, 0, 0) + end + dropdown:SetPoint('TOPRIGHT', -174.5, -10) + dropdown:SetWidth(150) + UIDropDownMenu_Initialize(dropdown, initialize_filter_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, initialize_filter_dropdown) + end) + _G[dropdown:GetName() .. 'Text']:Hide() + if gui.is_blizzard() then + _G[dropdown:GetName() .. 'Left']:Hide() + _G[dropdown:GetName() .. 'Middle']:Hide() + _G[dropdown:GetName() .. 'Right']:Hide() + end + local label = gui.label(dropdown, gui.font_size.medium) + label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) + label:SetText('Component') + filter_dropdown = dropdown + end + do + local input = gui.editbox(frame.filter) + input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0) + input:SetWidth(150) + input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end) + input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(aux.keys(filter_util.filters))) end) + input.char = function() this:complete() end + input.change = function() + local text = this:GetText() + if filter_util.filters[text] and filter_util.filters[text].input_type ~= '' then + local _, _, suggestions = filter_util.parse_filter_string(text .. '/') + filter_parameter_input:SetNumeric(filter_util.filters[text].input_type == 'number') + filter_parameter_input.complete = completion.complete(function() return suggestions or T.empty end) + filter_parameter_input:Show() + else + filter_parameter_input:Hide() + end + end + input.enter = function() + if filter_parameter_input:IsVisible() then + filter_parameter_input:SetFocus() + else + add_form_component() + end + end + filter_input = input + end + do + local input = gui.editbox(frame.filter) + input:SetPoint('LEFT', filter_dropdown, 'RIGHT', 10, 0) + input:SetWidth(150) + input:SetScript('OnTabPressed', function() + filter_input:SetFocus() + end) + input.char = function() this:complete() end + input.enter = add_form_component + input:Hide() + filter_parameter_input = input + end + do + local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter) + scroll_frame:SetWidth(395) + scroll_frame:SetHeight(270) + scroll_frame:SetPoint('TOPLEFT', 348.5, -50) + scroll_frame:EnableMouse(true) + scroll_frame:EnableMouseWheel(true) + scroll_frame:SetScript('OnMouseWheel', function() + local child = this:GetScrollChild() + child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.bounded(gui.font_size.small, gui.font_size.large, aux.select(2, child:GetFont()) + arg1*2)) + update_filter_display() + end) + scroll_frame:RegisterForDrag('LeftButton') + scroll_frame:SetScript('OnDragStart', function() + this.x, this.y = GetCursorPosition() + this.x_offset, this.y_offset = this:GetHorizontalScroll(), this:GetVerticalScroll() + this.x_extra, this.y_extra = 0, 0 + this:SetScript('OnUpdate', function() + local x, y = GetCursorPosition() + local new_x_offset = this.x_offset + x - this.x + local new_y_offset = this.y_offset + y - this.y + + set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra) + + this.x_extra = max(this.x_extra, new_x_offset) + this.y_extra = min(this.y_extra, new_y_offset) + end) + end) + scroll_frame:SetScript('OnDragStop', function() + this:SetScript('OnUpdate', nil) + end) + gui.set_content_style(scroll_frame, -2, -2, -2, -2) + local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame) + scroll_frame:SetScrollChild(scroll_child) + scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], gui.font_size.large) + scroll_child:SetTextColor('p', aux.color.label.enabled()) + scroll_child:SetWidth(1) + scroll_child:SetHeight(1) + scroll_child:SetScript('OnHyperlinkClick', data_link_click) + scroll_child.measure = scroll_child:CreateFontString() + filter_display = scroll_child + end + + status_bars = {} + tables = {} + for _ = 1, 5 do + local status_bar = gui.status_bar(frame) + status_bar:SetAllPoints(status_bar_frame) + status_bar:Hide() + tinsert(status_bars, status_bar) + + local table = auction_listing.new(frame.results, 16, auction_listing.search_columns) + table:SetHandler('OnClick', function(row, button) + if IsAltKeyDown() then + if current_search().table:GetSelection().record == row.record then + if button == 'LeftButton' then + buyout_button:Click() + elseif button == 'RightButton' then + bid_button:Click() + end + end + elseif button == 'RightButton' then + aux.set_tab(1) + set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') + execute(nil, false) + end + end) + table:SetHandler('OnSelectionChanged', function(rt, datum) + bid_button:Disable() + buyout_button:Disable() + if not datum then return end + find_auction(datum.record) + end) + table:Hide() + tinsert(tables, table) + end + + favorite_searches_listing = listing.new(frame.saved.favorite) + favorite_searches_listing:SetColInfo{{name='Auto', width=.07, align='CENTER'}, {name='Favorite Searches', width=.93}} + + recent_searches_listing = listing.new(frame.saved.recent) + recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}} + + for listing in T.temp-T.set(favorite_searches_listing, recent_searches_listing) do + for k, v in handlers do + listing:SetHandler(k, v) end end - editbox:SetScript('OnTabPressed', function() - if blizzard_query.exact then - return - end - if IsShiftKeyDown() then - max_level_input:SetFocus() - else - min_level_input:SetFocus() - end - end) - editbox.change = update_form - editbox.enter = function() editbox:ClearFocus() end - local label = gui.label(editbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Name') - name_input = editbox -end -do - local checkbox = gui.checkbox(frame.filter) - checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0) - checkbox:SetScript('OnClick', update_form) - local label = gui.label(checkbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) - label:SetText('Exact') - exact_checkbox = checkbox -end -do - local editbox = gui.editbox(frame.filter) - editbox:SetPoint('TOPLEFT', name_input, 'BOTTOMLEFT', 0, -FILTER_SPACING) - editbox:SetWidth(gui.is_blizzard() and 123 or 125) - editbox:SetAlignment('CENTER') - editbox:SetNumeric(true) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - name_input:SetFocus() - else - max_level_input:SetFocus() - end - end) - editbox.enter = function() editbox:ClearFocus() end - editbox.change = function() - local valid_level = valid_level(this:GetText()) - if tostring(valid_level) ~= this:GetText() then - this:SetText(valid_level or '') - end - update_form() - end - local label = gui.label(editbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Level Range') - min_level_input = editbox -end -do - local editbox = gui.editbox(frame.filter) - editbox:SetPoint('TOPLEFT', min_level_input, 'TOPRIGHT', gui.is_blizzard() and 14 or 10, 0) - editbox:SetWidth(gui.is_blizzard() and 123 or 125) - editbox:SetAlignment('CENTER') - editbox:SetNumeric(true) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - min_level_input:SetFocus() - else - name_input:SetFocus() - end - end) - editbox.enter = function() editbox:ClearFocus() end - editbox.change = function() - local valid_level = valid_level(this:GetText()) - if tostring(valid_level) ~= this:GetText() then - this:SetText(valid_level or '') - end - update_form() - end - local label = gui.label(editbox, gui.font_size.medium) - label:SetPoint('RIGHT', editbox, 'LEFT', gui.is_blizzard() and -7 or -3, 0) - label:SetText('-') - max_level_input = editbox -end -do - local checkbox = gui.checkbox(frame.filter) - checkbox:SetPoint('TOPLEFT', max_level_input, 'TOPRIGHT', 16, 0) - checkbox:SetScript('OnClick', update_form) - local label = gui.label(checkbox, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) - label:SetText('Usable') - usable_checkbox = checkbox -end -do - local dropdown = gui.dropdown(frame.filter) - class_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', min_level_input, 'BOTTOMLEFT', 0, 5 - FILTER_SPACING) - dropdown:SetWidth(300) - local label = gui.label(dropdown, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) - label:SetText('Item Class') - UIDropDownMenu_Initialize(dropdown, initialize_class_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_class_dropdown) - end) -end -do - local dropdown = gui.dropdown(frame.filter) - subclass_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', class_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) - dropdown:SetWidth(300) - local label = gui.label(dropdown, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) - label:SetText('Item Subclass') - UIDropDownMenu_Initialize(dropdown, initialize_subclass_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_subclass_dropdown) - end) -end -do - local dropdown = gui.dropdown(frame.filter) - slot_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', subclass_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) - dropdown:SetWidth(300) - local label = gui.label(dropdown, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) - label:SetText('Item Slot') - UIDropDownMenu_Initialize(dropdown, initialize_slot_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_slot_dropdown) - end) -end -do - local dropdown = gui.dropdown(frame.filter) - quality_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', slot_dropdown, 'BOTTOMLEFT', 0, 10 - FILTER_SPACING) - dropdown:SetWidth(300) - local label = gui.label(dropdown, gui.font_size.small) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -3) - label:SetText('Min Quality') - UIDropDownMenu_Initialize(dropdown, initialize_quality_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_quality_dropdown) - end) -end -gui.vertical_line(frame.filter, 332) -do - local dropdown = gui.dropdown(frame.filter) - if gui.is_blizzard() then - local button = _G[dropdown:GetName() .. 'Button'] - button:ClearAllPoints() - button:SetScale(.9) - button:SetPoint('RIGHT', dropdown, 0, 0) - end - dropdown:SetPoint('TOPRIGHT', -174.5, -10) - dropdown:SetWidth(150) - UIDropDownMenu_Initialize(dropdown, initialize_filter_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, initialize_filter_dropdown) - end) - _G[dropdown:GetName() .. 'Text']:Hide() - if gui.is_blizzard() then - _G[dropdown:GetName() .. 'Left']:Hide() - _G[dropdown:GetName() .. 'Middle']:Hide() - _G[dropdown:GetName() .. 'Right']:Hide() - end - local label = gui.label(dropdown, gui.font_size.medium) - label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) - label:SetText('Component') - filter_dropdown = dropdown -end -do - local input = gui.editbox(frame.filter) - input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0) - input:SetWidth(150) - input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end) - input.complete = completion.complete(function() return T.temp-T.list('and', 'or', 'not', unpack(aux.keys(filter_util.filters))) end) - input.char = function() this:complete() end - input.change = function() - local text = this:GetText() - if filter_util.filters[text] and filter_util.filters[text].input_type ~= '' then - local _, _, suggestions = filter_util.parse_filter_string(text .. '/') - filter_parameter_input:SetNumeric(filter_util.filters[text].input_type == 'number') - filter_parameter_input.complete = completion.complete(function() return suggestions or T.empty end) - filter_parameter_input:Show() - else - filter_parameter_input:Hide() - end - end - input.enter = function() - if filter_parameter_input:IsVisible() then - filter_parameter_input:SetFocus() - else - add_form_component() - end - end - filter_input = input -end -do - local input = gui.editbox(frame.filter) - input:SetPoint('LEFT', filter_dropdown, 'RIGHT', 10, 0) - input:SetWidth(150) - input:SetScript('OnTabPressed', function() - filter_input:SetFocus() - end) - input.char = function() this:complete() end - input.enter = add_form_component - input:Hide() - filter_parameter_input = input -end -do - local scroll_frame = CreateFrame('ScrollFrame', nil, frame.filter) - scroll_frame:SetWidth(395) - scroll_frame:SetHeight(270) - scroll_frame:SetPoint('TOPLEFT', 348.5, -50) - scroll_frame:EnableMouse(true) - scroll_frame:EnableMouseWheel(true) - scroll_frame:SetScript('OnMouseWheel', function() - local child = this:GetScrollChild() - child:SetFont('p', [[Fonts\ARIALN.TTF]], aux.bounded(gui.font_size.small, gui.font_size.large, aux.select(2, child:GetFont()) + arg1*2)) - update_filter_display() - end) - scroll_frame:RegisterForDrag('LeftButton') - scroll_frame:SetScript('OnDragStart', function() - this.x, this.y = GetCursorPosition() - this.x_offset, this.y_offset = this:GetHorizontalScroll(), this:GetVerticalScroll() - this.x_extra, this.y_extra = 0, 0 - this:SetScript('OnUpdate', function() - local x, y = GetCursorPosition() - local new_x_offset = this.x_offset + x - this.x - local new_y_offset = this.y_offset + y - this.y - - set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra) - - this.x_extra = max(this.x_extra, new_x_offset) - this.y_extra = min(this.y_extra, new_y_offset) - end) - end) - scroll_frame:SetScript('OnDragStop', function() - this:SetScript('OnUpdate', nil) - end) - gui.set_content_style(scroll_frame, -2, -2, -2, -2) - local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame) - scroll_frame:SetScrollChild(scroll_child) - scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], gui.font_size.large) - scroll_child:SetTextColor('p', aux.color.label.enabled()) - scroll_child:SetWidth(1) - scroll_child:SetHeight(1) - scroll_child:SetScript('OnHyperlinkClick', data_link_click) - scroll_child.measure = scroll_child:CreateFontString() - filter_display = scroll_child -end - -status_bars = {} -tables = {} -for _ = 1, 5 do - local status_bar = gui.status_bar(frame) - status_bar:SetAllPoints(status_bar_frame) - status_bar:Hide() - tinsert(status_bars, status_bar) - - local table = auction_listing.new(frame.results, 16, auction_listing.search_columns) - table:SetHandler('OnClick', function(row, button) - if IsAltKeyDown() then - if current_search().table:GetSelection().record == row.record then - if button == 'LeftButton' then - buyout_button:Click() - elseif button == 'RightButton' then - bid_button:Click() - end - end - elseif button == 'RightButton' then - aux.set_tab(1) - set_filter(strlower(info.item(this.record.item_id).name) .. '/exact') - execute(nil, false) - end - end) - table:SetHandler('OnSelectionChanged', function(rt, datum) - bid_button:Disable() - buyout_button:Disable() - if not datum then return end - find_auction(datum.record) - end) - table:Hide() - tinsert(tables, table) -end - -favorite_searches_listing = listing.new(frame.saved.favorite) -favorite_searches_listing:SetColInfo{{name='Auto', width=.07, align='CENTER'}, {name='Favorite Searches', width=.93}} - -recent_searches_listing = listing.new(frame.saved.recent) -recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}} - -for listing in T.temp-T.set(favorite_searches_listing, recent_searches_listing) do - for k, v in handlers do - listing:SetHandler(k, v) - end end \ No newline at end of file