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
This commit is contained in:
OldManAlpha
2025-06-25 20:37:21 -07:00
parent f412bad657
commit 1ea4a114fa
8 changed files with 1048 additions and 1015 deletions
+12 -7
View File
@@ -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 .. '<aux> ' .. 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')
+12
View File
@@ -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
+54 -52
View File
@@ -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
+7 -1
View File
@@ -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)
+52 -50
View File
@@ -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
+61 -59
View File
@@ -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
+305 -303
View File
@@ -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
+545 -543
View File
File diff suppressed because it is too large Load Diff