From 4ebff963e34a1fb5da81dfc3a60e42f7c237c34f Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 9 Aug 2016 02:37:20 +0200 Subject: [PATCH] last traces of disgusting xml removed --- aux-addon.toc | 1 - core.lua | 57 +- core.xml | 38 -- init.lua | 3 + tabs/auctions/core.lua | 4 + tabs/auctions/frames.lua | 96 +-- tabs/bids/core.lua | 4 + tabs/bids/frames.lua | 122 ++-- tabs/post/core.lua | 4 + tabs/post/frames.lua | 646 +++++++++---------- tabs/search/core.lua | 1 + tabs/search/frames.lua | 1288 +++++++++++++++++++------------------- 12 files changed, 1137 insertions(+), 1127 deletions(-) delete mode 100644 core.xml diff --git a/aux-addon.toc b/aux-addon.toc index fa68def..2caf186 100644 --- a/aux-addon.toc +++ b/aux-addon.toc @@ -5,7 +5,6 @@ module.lua init.lua -core.xml core.lua control.lua gui.lua diff --git a/core.lua b/core.lua index a59d3be..4f73a51 100644 --- a/core.lua +++ b/core.lua @@ -1,7 +1,5 @@ local m, public, private = aux.module'aux' -public.version = '3.9.0' - public.bids_loaded = false public.current_owner_page = nil public.last_owner_page_requested = nil @@ -56,23 +54,50 @@ do end) function private.on_tab_click(index) if active_tab_index then - aux.call(m.active_tab.module[1].CLOSE) + m.call(m.active_tab.module[1].CLOSE) end active_tab_index = index if active_tab_index then - aux.call(m.active_tab.module[1].OPEN) + m.call(m.active_tab.module[1].OPEN) end end end function public.VARIABLES_LOADED() - m.log('v'..m.version..' loaded.') - - aux.gui.set_window_style(AuxFrame) - tinsert(UISpecialFrames, 'AuxFrame') + do + local frame = CreateFrame('Frame', nil, UIParent) + tinsert(UISpecialFrames, frame) + m.gui.set_window_style(frame) + frame:SetWidth(768) + frame:SetHeight(447) + frame:SetPoint('LEFT', 100, 0) + frame:SetToplevel(true) + frame:SetMovable(true) + frame:EnableMouse(true) + frame:SetClampedToScreen(true) + frame:RegisterForDrag('LeftButton') + frame:SetScript('OnDragStart', function() + this:StartMoving() + end) + frame:SetScript('OnDragStop', function() + this:StopMovingOrSizing() + end) + 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() + public.frame = frame + end do - local tab_group = m.gui.tab_group(AuxFrame, 'DOWN') + local tab_group = m.gui.tab_group(m.frame, 'DOWN') for _, tab in m.tabs do tab_group:create_tab(tab.title) end @@ -81,17 +106,17 @@ function public.VARIABLES_LOADED() end do - local btn = m.gui.button(AuxFrame, 16) + local btn = m.gui.button(m.frame, 16) btn:SetPoint('BOTTOMRIGHT', -6, 6) btn:SetWidth(65) btn:SetHeight(24) btn:SetText('Close') - btn:SetScript('OnClick', m._(HideUIPanel, AuxFrame)) + btn:SetScript('OnClick', m._(HideUIPanel, m.frame)) public.close_button = btn end do - local btn = m.gui.button(AuxFrame, 16) + local btn = m.gui.button(m.frame, 16) btn:SetPoint('RIGHT', m.close_button, 'LEFT' , -5, 0) btn:SetWidth(65) btn:SetHeight(24) @@ -110,7 +135,7 @@ function private.AUCTION_HOUSE_SHOW() if AuctionFrame:IsVisible() then AuctionFrame:Hide() end - AuxFrame:Show() + m.frame:Show() m.tab_group:set_tab(1) end @@ -121,7 +146,7 @@ function private.AUCTION_HOUSE_CLOSED() m.stack.stop() m.scan.abort() m.tab_group:set_tab() - AuxFrame:Hide() + m.frame:Hide() end function private.AUCTION_BIDDER_LIST_UPDATE() @@ -301,7 +326,7 @@ do m.control.event_listener('CHAT_MSG_SYSTEM', function(kill) if arg1 == ERR_AUCTION_BID_PLACED then - aux.call(on_success) + m.call(on_success) locked = false kill() end @@ -400,7 +425,7 @@ end function public.is_player(name, current) local realm = GetCVar('realmName') - return not current and aux.index(aux_characters, realm, name) or UnitName('player') == name + return not current and m.index(aux_characters, realm, name) or UnitName('player') == name end function public.modified() diff --git a/core.xml b/core.xml deleted file mode 100644 index 97205c5..0000000 --- a/core.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - this:RegisterForDrag('LeftButton') - - - PlaySound('AuctionWindowOpen') - - - PlaySound('AuctionWindowClose') - CloseAuctionHouse() - - - this:StartMoving() - - - this:StopMovingOrSizing() - - - - - - - - - - - - diff --git a/init.lua b/init.lua index 1bb3013..132ebe7 100644 --- a/init.lua +++ b/init.lua @@ -2,6 +2,8 @@ local module = aux_module() aux = tremove(module, 1) local m, public, private = unpack(module) +public.version = '3.9.0' + local function initialize_module(private_declarator) private_declarator.LOAD = nil end @@ -34,6 +36,7 @@ event_frame:SetScript('OnEvent', function() module[1].LOAD() end end + m.log('v'..m.version..' loaded.') end end end) diff --git a/tabs/auctions/core.lua b/tabs/auctions/core.lua index 6b7b430..a0f4973 100644 --- a/tabs/auctions/core.lua +++ b/tabs/auctions/core.lua @@ -2,6 +2,10 @@ local m, public, private = aux.tab(3, 'Auctions', 'auctions_tab') private.auction_records = nil +function m.LOAD() + m.create_frames() +end + function m.OPEN() m.frame:Show() m.scan_auctions() diff --git a/tabs/auctions/frames.lua b/tabs/auctions/frames.lua index 98ed706..d20d575 100644 --- a/tabs/auctions/frames.lua +++ b/tabs/auctions/frames.lua @@ -1,53 +1,55 @@ local m, public, private = aux.module'auctions_tab' -private.frame = CreateFrame('Frame', nil, AuxFrame) -m.frame:SetAllPoints() -m.frame:SetScript('OnUpdate', m.on_update) -m.frame:Hide() +function private.create_frames() + private.frame = CreateFrame('Frame', nil, aux.frame) + m.frame:SetAllPoints() + m.frame:SetScript('OnUpdate', m.on_update) + m.frame:Hide() -m.frame.listing = aux.gui.panel(m.frame) -m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) -m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) -m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) + m.frame.listing = aux.gui.panel(m.frame) + m.frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8) + m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config) -m.listing:SetSort(1,2,3,4,5,6,7,8) -m.listing:Reset() -m.listing:SetHandler('OnCellClick', function(cell, button) - if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record and m.cancel_button:IsEnabled() then - m.cancel_button:Click() - end -end) -m.listing:SetHandler('OnSelectionChanged', function(rt, datum) - if not datum then return end - m.find_auction(datum.record) -end) + private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config) + m.listing:SetSort(1,2,3,4,5,6,7,8) + m.listing:Reset() + m.listing:SetHandler('OnCellClick', function(cell, button) + if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record and m.cancel_button:IsEnabled() then + m.cancel_button:Click() + end + end) + m.listing:SetHandler('OnSelectionChanged', function(rt, datum) + if not datum then return end + m.find_auction(datum.record) + end) -do - local status_bar = aux.gui.status_bar(m.frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(100, 100) - status_bar:set_text('') - private.status_bar = status_bar -end -do - local btn = aux.gui.button(m.frame, 16) - btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Cancel') - btn:Disable() - private.cancel_button = btn -end -do - local btn = aux.gui.button(m.frame, 16) - btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Refresh') - btn:SetScript('OnClick', function() - m.scan_auctions() - end) + do + local status_bar = aux.gui.status_bar(m.frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(100, 100) + status_bar:set_text('') + private.status_bar = status_bar + end + do + local btn = aux.gui.button(m.frame, 16) + btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Cancel') + btn:Disable() + private.cancel_button = btn + end + do + local btn = aux.gui.button(m.frame, 16) + btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Refresh') + btn:SetScript('OnClick', function() + m.scan_auctions() + end) + end end \ No newline at end of file diff --git a/tabs/bids/core.lua b/tabs/bids/core.lua index 4a75a29..10817b5 100644 --- a/tabs/bids/core.lua +++ b/tabs/bids/core.lua @@ -2,6 +2,10 @@ local m, public, private = aux.tab(4, 'Bids', 'bids_tab') private.auction_records = nil +function m.LOAD() + m.create_frames() +end + function m.OPEN() m.frame:Show() m.scan_bids() diff --git a/tabs/bids/frames.lua b/tabs/bids/frames.lua index 28e4448..6b25138 100644 --- a/tabs/bids/frames.lua +++ b/tabs/bids/frames.lua @@ -1,66 +1,68 @@ local m, public, private = aux.module'bids_tab' -private.frame = CreateFrame('Frame', nil, AuxFrame) -m.frame:SetAllPoints() -m.frame:SetScript('OnUpdate', m.on_update) -m.frame:Hide() +function private.create_frames() + private.frame = CreateFrame('Frame', nil, aux.frame) + m.frame:SetAllPoints() + m.frame:SetScript('OnUpdate', m.on_update) + m.frame:Hide() -m.frame.listing = aux.gui.panel(m.frame) -m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) -m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) -m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) + m.frame.listing = aux.gui.panel(m.frame) + m.frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8) + m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config) -m.listing:SetSort(1,2,3,4,5,6,7,8) -m.listing:Reset() -m.listing:SetHandler('OnCellClick', function(cell, button) - if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record then - if button == 'LeftButton' and m.buyout_button:IsEnabled() then - m.buyout_button:Click() - elseif button == 'RightButton' and m.bid_button:IsEnabled() then - m.bid_button:Click() - end - end -end) -m.listing:SetHandler('OnSelectionChanged', function(rt, datum) - if not datum then return end - m.find_auction(datum.record) -end) + private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config) + m.listing:SetSort(1,2,3,4,5,6,7,8) + m.listing:Reset() + m.listing:SetHandler('OnCellClick', function(cell, button) + if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record then + if button == 'LeftButton' and m.buyout_button:IsEnabled() then + m.buyout_button:Click() + elseif button == 'RightButton' and m.bid_button:IsEnabled() then + m.bid_button:Click() + end + end + end) + m.listing:SetHandler('OnSelectionChanged', function(rt, datum) + if not datum then return end + m.find_auction(datum.record) + end) -do - local status_bar = aux.gui.status_bar(m.frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(100, 0) - status_bar:set_text('') - private.status_bar = status_bar -end -do - local btn = aux.gui.button(m.frame, 16) - btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Bid') - btn:Disable() - private.bid_button = btn -end -do - local btn = aux.gui.button(m.frame, 16) - btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Buyout') - btn:Disable() - private.buyout_button = btn -end -do - local btn = aux.gui.button(m.frame, 16) - btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Refresh') - btn:SetScript('OnClick', function() - m.scan_bids() - end) + do + local status_bar = aux.gui.status_bar(m.frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(100, 0) + status_bar:set_text('') + private.status_bar = status_bar + end + do + local btn = aux.gui.button(m.frame, 16) + btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Bid') + btn:Disable() + private.bid_button = btn + end + do + local btn = aux.gui.button(m.frame, 16) + btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Buyout') + btn:Disable() + private.buyout_button = btn + end + do + local btn = aux.gui.button(m.frame, 16) + btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Refresh') + btn:SetScript('OnClick', function() + m.scan_bids() + end) + end end \ No newline at end of file diff --git a/tabs/post/core.lua b/tabs/post/core.lua index ebb0773..1a98061 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -9,6 +9,10 @@ private.scan_id = 0 private.selected_item = nil private.refresh = nil +function m.LOAD() + m.create_frames() +end + function m.OPEN() m.frame:Show() diff --git a/tabs/post/frames.lua b/tabs/post/frames.lua index 34403b6..e1ff452 100644 --- a/tabs/post/frames.lua +++ b/tabs/post/frames.lua @@ -1,334 +1,336 @@ local m, public, private = aux.module'post_tab' -private.frame = CreateFrame('Frame', nil, AuxFrame) -m.frame:SetAllPoints() -m.frame:SetScript('OnUpdate', m.on_update) -m.frame:Hide() +function private.create_frames() + private.frame = CreateFrame('Frame', nil, aux.frame) + m.frame:SetAllPoints() + m.frame:SetScript('OnUpdate', m.on_update) + m.frame:Hide() -m.frame.content = CreateFrame('Frame', nil, m.frame) -m.frame.content:SetPoint('TOP', AuxFrame, 'TOP', 0, -8) -m.frame.content:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0) -m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0) + m.frame.content = CreateFrame('Frame', nil, m.frame) + m.frame.content:SetPoint('TOP', aux.frame, 'TOP', 0, -8) + m.frame.content:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) + m.frame.content:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) -m.frame.inventory = aux.gui.panel(m.frame.content) -m.frame.inventory:SetWidth(212) -m.frame.inventory:SetPoint('TOPLEFT', 0, 0) -m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) + m.frame.inventory = aux.gui.panel(m.frame.content) + m.frame.inventory:SetWidth(212) + m.frame.inventory:SetPoint('TOPLEFT', 0, 0) + m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0) -m.frame.parameters = aux.gui.panel(m.frame.content) -m.frame.parameters:SetHeight(173) -m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0) -m.frame.parameters:SetPoint('TOPRIGHT', 0, 0) + m.frame.parameters = aux.gui.panel(m.frame.content) + m.frame.parameters:SetHeight(173) + m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0) + m.frame.parameters:SetPoint('TOPRIGHT', 0, 0) -m.frame.auctions = aux.gui.panel(m.frame.content) -m.frame.auctions:SetHeight(228) -m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0) -m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0) + m.frame.auctions = aux.gui.panel(m.frame.content) + m.frame.auctions:SetHeight(228) + m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0) + m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0) -do - local checkbox = aux.gui.checkbox(m.frame.inventory) - checkbox:SetPoint('TOPLEFT', 49, -16) - checkbox:SetScript('OnClick', function() - m.refresh = true - end) - local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) - label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) - label:SetText('Show hidden items') - private.show_hidden_checkbox = checkbox -end + do + local checkbox = aux.gui.checkbox(m.frame.inventory) + checkbox:SetPoint('TOPLEFT', 49, -16) + checkbox:SetScript('OnClick', function() + m.refresh = true + end) + local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) + label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) + label:SetText('Show hidden items') + private.show_hidden_checkbox = checkbox + end -aux.gui.horizontal_line(m.frame.inventory, -48) + aux.gui.horizontal_line(m.frame.inventory, -48) -private.item_listing = aux.item_listing.create( - m.frame.inventory, - function() - if arg1 == 'LeftButton' then - m.set_item(this.item_record) - elseif arg1 == 'RightButton' then - aux.tab_group:set_tab(1) - aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact') - aux.search_tab.execute(nil, false) - end - end, - function(item_record) - return item_record == m.selected_item - end -) + private.item_listing = aux.item_listing.create( + m.frame.inventory, + function() + if arg1 == 'LeftButton' then + m.set_item(this.item_record) + elseif arg1 == 'RightButton' then + aux.tab_group:set_tab(1) + aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact') + aux.search_tab.execute(nil, false) + end + end, + function(item_record) + return item_record == m.selected_item + end + ) -private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions) -m.auction_listing:SetColInfo({ - { name='Auctions', width=.12, align='CENTER' }, - { name='Left', width=.1, align='CENTER' }, - { name='Qty', width=.08, align='CENTER' }, - { name='Bid/ea', width=.22, align='RIGHT' }, - { name='Bid Pct', width=.13, align='CENTER' }, - { name='Buy/ea', width=.22, align='RIGHT' }, - { name='Buy Pct', width=.13, align='CENTER' } -}) -m.auction_listing:EnableSorting(false) -m.auction_listing:DisableSelection(true) -m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button) - local column_index = aux.util.key(column, column.row.cols) - local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton') - if column_index == 3 then - m.stack_size_slider:SetValue(row_data.record.stack_size) - elseif column_index == 4 then - m.set_unit_start_price(unit_start_price) - elseif column_index == 6 then - m.set_unit_buyout_price(unit_buyout_price) - end -end) + private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions) + m.auction_listing:SetColInfo({ + { name='Auctions', width=.12, align='CENTER' }, + { name='Left', width=.1, align='CENTER' }, + { name='Qty', width=.08, align='CENTER' }, + { name='Bid/ea', width=.22, align='RIGHT' }, + { name='Bid Pct', width=.13, align='CENTER' }, + { name='Buy/ea', width=.22, align='RIGHT' }, + { name='Buy Pct', width=.13, align='CENTER' } + }) + m.auction_listing:EnableSorting(false) + m.auction_listing:DisableSelection(true) + m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button) + local column_index = aux.util.key(column, column.row.cols) + local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton') + if column_index == 3 then + m.stack_size_slider:SetValue(row_data.record.stack_size) + elseif column_index == 4 then + m.set_unit_start_price(unit_start_price) + elseif column_index == 6 then + m.set_unit_buyout_price(unit_buyout_price) + end + end) -do - local status_bar = aux.gui.status_bar(m.frame) - status_bar:SetWidth(265) - status_bar:SetHeight(25) - status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) - status_bar:update_status(100, 100) - status_bar:set_text('') - private.status_bar = status_bar -end -do - local btn = aux.gui.button(m.frame.parameters, 16) - btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Post') - btn:SetScript('OnClick', m.post_auctions) - private.post_button = btn -end -do - local btn = aux.gui.button(m.frame.parameters, 16) - btn:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Refresh') - btn:SetScript('OnClick', function() - aux.scan.abort(m.scan_id) - m.refresh_entries() - m.refresh = true - end) - private.refresh_button = btn -end -do - local item = aux.gui.item(m.frame.parameters) - item:SetPoint('TOPLEFT', 6, -6) - item.button:SetScript('OnEnter', function() - if m.selected_item then - aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT') - end - end) - item.button:SetScript('OnLeave', function() - GameTooltip:Hide() - end) - private.item = item -end -do - local slider = aux.gui.slider(m.frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', 13, -73) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function() - m.quantity_update(true) - end) - slider.editbox:SetScript('OnTextChanged', function() - slider:SetValue(this:GetNumber()) - m.quantity_update(true) - if m.selected_item then - local settings = m.read_settings() - settings.stack_size = this:GetNumber() - m.write_settings(settings) - end - end) - slider.editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.unit_buyout_price:SetFocus() - elseif m.stack_count_slider.editbox:IsVisible() then - m.stack_count_slider.editbox:SetFocus() - else - m.unit_start_price:SetFocus() - end - end) - slider.editbox:SetNumeric(true) - slider.editbox:SetMaxLetters(3) - slider.label:SetText('Stack Size') - private.stack_size_slider = slider -end -do - local slider = aux.gui.slider(m.frame.parameters) - slider:SetValueStep(1) - slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30) - slider:SetWidth(190) - slider:SetScript('OnValueChanged', function() - m.quantity_update() - end) - slider.editbox:SetScript('OnTextChanged', function() - slider:SetValue(this:GetNumber()) - m.quantity_update() - end) - slider.editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.stack_size_slider.editbox:SetFocus() - else - m.unit_start_price:SetFocus() - end - end) - slider.editbox:SetNumeric(true) - slider.label:SetText('Stack Count') - private.stack_count_slider = slider -end -do - local dropdown = aux.gui.dropdown(m.frame.parameters) - dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21) - dropdown:SetWidth(90) - local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) - label:SetText('Duration') - UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) - end) - local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) - label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0) - private.deposit = label - private.duration_dropdown = dropdown -end -do - local checkbox = aux.gui.checkbox(m.frame.parameters) - checkbox:SetPoint('TOPRIGHT', -83, -6) - checkbox:SetScript('OnClick', function() - local settings = m.read_settings() - settings.hidden = this:GetChecked() - m.write_settings(settings) - m.refresh = true - end) - local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) - label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) - label:SetText('Hide this item') - private.hide_checkbox = checkbox -end -do - local frame = CreateFrame('Frame', nil, m.frame.parameters) - private.start_price_frame = frame - aux.gui.set_content_style(frame) - frame:SetPoint('TOPRIGHT', -71, -50) - frame:SetWidth(180) - frame:SetHeight(22) - local editbox = aux.gui.editbox(frame) - editbox:SetAllPoints() - editbox:SetJustifyH('RIGHT') - editbox:SetFont(aux.gui.config.font, 17) - editbox:SetScript('OnTextChanged', function() - this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3)) - m.refresh = true - end) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() and m.stack_count_slider.editbox:IsVisible() then - m.stack_count_slider.editbox:SetFocus() - elseif IsShiftKeyDown() then - m.stack_size_slider.editbox:SetFocus() - else - m.unit_buyout_price:SetFocus() - end - end) - editbox:SetScript('OnEditFocusGained', function() - this:HighlightText() - this.pretty:Hide() - this:SetAlpha(1) - end) - editbox:SetScript('OnEditFocusLost', function() - this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true)) - this.pretty:Show() - this:SetAlpha(0) - end) - editbox:SetAlpha(0) - editbox.pretty = aux.gui.label(frame, 17) - editbox.pretty:SetPoint('LEFT', 1, 0) - editbox.pretty:SetPoint('RIGHT', -2, 0) - editbox.pretty:SetJustifyH('RIGHT') - do - local label = aux.gui.label(frame, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) - label:SetText('Unit Starting Price') - end - do - local label = aux.gui.label(frame, 14) - label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) - label:SetWidth(50) - label:SetJustifyH('CENTER') - private.start_price_percentage = label - end - private.unit_start_price = editbox -end -do - local frame = CreateFrame('Frame', nil, m.frame.parameters) - private.buyout_price_frame = frame - aux.gui.set_content_style(frame) - frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19) - frame:SetWidth(180) - frame:SetHeight(22) - local editbox = aux.gui.editbox(frame) - editbox:SetAllPoints() - editbox:SetJustifyH('RIGHT') - editbox:SetFont(aux.gui.config.font, 17) - editbox:SetScript('OnTextChanged', function() - this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3)) - m.refresh = true - end) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.unit_start_price:SetFocus() - else - m.stack_size_slider.editbox:SetFocus() - end - end) - editbox:SetScript('OnEnterPressed', function() - this:ClearFocus() - end) - editbox:SetScript('OnEditFocusGained', function() - this:HighlightText() - this.pretty:Hide() - this:SetAlpha(1) - end) - editbox:SetScript('OnEditFocusLost', function() - this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true)) - this.pretty:Show() - this:SetAlpha(0) - end) - editbox:SetAlpha(0) - editbox.pretty = aux.gui.label(frame, 17) - editbox.pretty:SetPoint('LEFT', 1, 0) - editbox.pretty:SetPoint('RIGHT', -2, 0) - editbox.pretty:SetJustifyH('RIGHT') - do - local label = aux.gui.label(frame, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) - label:SetText('Unit Buyout Price') - end - do - local label = aux.gui.label(frame, 14) - label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) - label:SetWidth(50) - label:SetJustifyH('CENTER') - private.buyout_price_percentage = label - end - private.unit_buyout_price = editbox -end -do - local btn = aux.gui.button(m.frame.parameters, 14) - btn:SetPoint('TOPRIGHT', -14, -146) - btn:SetWidth(150) - btn:SetHeight(20) - btn:GetFontString():SetJustifyH('RIGHT') - btn:GetFontString():SetPoint('RIGHT', -2, 0) - btn:SetScript('OnClick', function() - if this.amount then - m.set_unit_start_price(this.amount) - m.set_unit_buyout_price(this.amount) - end - end) - local label = aux.gui.label(btn, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1) - label:SetText('Historical Value') - private.historical_value_button = btn + do + local status_bar = aux.gui.status_bar(m.frame) + status_bar:SetWidth(265) + status_bar:SetHeight(25) + status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + status_bar:update_status(100, 100) + status_bar:set_text('') + private.status_bar = status_bar + end + do + local btn = aux.gui.button(m.frame.parameters, 16) + btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Post') + btn:SetScript('OnClick', m.post_auctions) + private.post_button = btn + end + do + local btn = aux.gui.button(m.frame.parameters, 16) + btn:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Refresh') + btn:SetScript('OnClick', function() + aux.scan.abort(m.scan_id) + m.refresh_entries() + m.refresh = true + end) + private.refresh_button = btn + end + do + local item = aux.gui.item(m.frame.parameters) + item:SetPoint('TOPLEFT', 6, -6) + item.button:SetScript('OnEnter', function() + if m.selected_item then + aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT') + end + end) + item.button:SetScript('OnLeave', function() + GameTooltip:Hide() + end) + private.item = item + end + do + local slider = aux.gui.slider(m.frame.parameters) + slider:SetValueStep(1) + slider:SetPoint('TOPLEFT', 13, -73) + slider:SetWidth(190) + slider:SetScript('OnValueChanged', function() + m.quantity_update(true) + end) + slider.editbox:SetScript('OnTextChanged', function() + slider:SetValue(this:GetNumber()) + m.quantity_update(true) + if m.selected_item then + local settings = m.read_settings() + settings.stack_size = this:GetNumber() + m.write_settings(settings) + end + end) + slider.editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.unit_buyout_price:SetFocus() + elseif m.stack_count_slider.editbox:IsVisible() then + m.stack_count_slider.editbox:SetFocus() + else + m.unit_start_price:SetFocus() + end + end) + slider.editbox:SetNumeric(true) + slider.editbox:SetMaxLetters(3) + slider.label:SetText('Stack Size') + private.stack_size_slider = slider + end + do + local slider = aux.gui.slider(m.frame.parameters) + slider:SetValueStep(1) + slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30) + slider:SetWidth(190) + slider:SetScript('OnValueChanged', function() + m.quantity_update() + end) + slider.editbox:SetScript('OnTextChanged', function() + slider:SetValue(this:GetNumber()) + m.quantity_update() + end) + slider.editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.stack_size_slider.editbox:SetFocus() + else + m.unit_start_price:SetFocus() + end + end) + slider.editbox:SetNumeric(true) + slider.label:SetText('Stack Count') + private.stack_count_slider = slider + end + do + local dropdown = aux.gui.dropdown(m.frame.parameters) + dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21) + dropdown:SetWidth(90) + local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Duration') + UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) + end) + local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) + label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0) + private.deposit = label + private.duration_dropdown = dropdown + end + do + local checkbox = aux.gui.checkbox(m.frame.parameters) + checkbox:SetPoint('TOPRIGHT', -83, -6) + checkbox:SetScript('OnClick', function() + local settings = m.read_settings() + settings.hidden = this:GetChecked() + m.write_settings(settings) + m.refresh = true + end) + local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) + label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1) + label:SetText('Hide this item') + private.hide_checkbox = checkbox + end + do + local frame = CreateFrame('Frame', nil, m.frame.parameters) + private.start_price_frame = frame + aux.gui.set_content_style(frame) + frame:SetPoint('TOPRIGHT', -71, -50) + frame:SetWidth(180) + frame:SetHeight(22) + local editbox = aux.gui.editbox(frame) + editbox:SetAllPoints() + editbox:SetJustifyH('RIGHT') + editbox:SetFont(aux.gui.config.font, 17) + editbox:SetScript('OnTextChanged', function() + this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3)) + m.refresh = true + end) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() and m.stack_count_slider.editbox:IsVisible() then + m.stack_count_slider.editbox:SetFocus() + elseif IsShiftKeyDown() then + m.stack_size_slider.editbox:SetFocus() + else + m.unit_buyout_price:SetFocus() + end + end) + editbox:SetScript('OnEditFocusGained', function() + this:HighlightText() + this.pretty:Hide() + this:SetAlpha(1) + end) + editbox:SetScript('OnEditFocusLost', function() + this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true)) + this.pretty:Show() + this:SetAlpha(0) + end) + editbox:SetAlpha(0) + editbox.pretty = aux.gui.label(frame, 17) + editbox.pretty:SetPoint('LEFT', 1, 0) + editbox.pretty:SetPoint('RIGHT', -2, 0) + editbox.pretty:SetJustifyH('RIGHT') + do + local label = aux.gui.label(frame, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) + label:SetText('Unit Starting Price') + end + do + local label = aux.gui.label(frame, 14) + label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) + label:SetWidth(50) + label:SetJustifyH('CENTER') + private.start_price_percentage = label + end + private.unit_start_price = editbox + end + do + local frame = CreateFrame('Frame', nil, m.frame.parameters) + private.buyout_price_frame = frame + aux.gui.set_content_style(frame) + frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19) + frame:SetWidth(180) + frame:SetHeight(22) + local editbox = aux.gui.editbox(frame) + editbox:SetAllPoints() + editbox:SetJustifyH('RIGHT') + editbox:SetFont(aux.gui.config.font, 17) + editbox:SetScript('OnTextChanged', function() + this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3)) + m.refresh = true + end) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.unit_start_price:SetFocus() + else + m.stack_size_slider.editbox:SetFocus() + end + end) + editbox:SetScript('OnEnterPressed', function() + this:ClearFocus() + end) + editbox:SetScript('OnEditFocusGained', function() + this:HighlightText() + this.pretty:Hide() + this:SetAlpha(1) + end) + editbox:SetScript('OnEditFocusLost', function() + this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true)) + this.pretty:Show() + this:SetAlpha(0) + end) + editbox:SetAlpha(0) + editbox.pretty = aux.gui.label(frame, 17) + editbox.pretty:SetPoint('LEFT', 1, 0) + editbox.pretty:SetPoint('RIGHT', -2, 0) + editbox.pretty:SetJustifyH('RIGHT') + do + local label = aux.gui.label(frame, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1) + label:SetText('Unit Buyout Price') + end + do + local label = aux.gui.label(frame, 14) + label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) + label:SetWidth(50) + label:SetJustifyH('CENTER') + private.buyout_price_percentage = label + end + private.unit_buyout_price = editbox + end + do + local btn = aux.gui.button(m.frame.parameters, 14) + btn:SetPoint('TOPRIGHT', -14, -146) + btn:SetWidth(150) + btn:SetHeight(20) + btn:GetFontString():SetJustifyH('RIGHT') + btn:GetFontString():SetPoint('RIGHT', -2, 0) + btn:SetScript('OnClick', function() + if this.amount then + m.set_unit_start_price(this.amount) + m.set_unit_buyout_price(this.amount) + end + end) + local label = aux.gui.label(btn, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1) + label:SetText('Historical Value') + private.historical_value_button = btn + end end \ No newline at end of file diff --git a/tabs/search/core.lua b/tabs/search/core.lua index 6fe50c6..9850f93 100644 --- a/tabs/search/core.lua +++ b/tabs/search/core.lua @@ -133,6 +133,7 @@ do end function m.LOAD() + m.create_frames() m.update_tab(m.SAVED) m.update_auto_buy_filter() m.new_search('') diff --git a/tabs/search/frames.lua b/tabs/search/frames.lua index 04599c8..0d528b1 100644 --- a/tabs/search/frames.lua +++ b/tabs/search/frames.lua @@ -1,656 +1,658 @@ local m, public, private = aux.module'search_tab' -private.frame = CreateFrame('Frame', nil, AuxFrame) -m.frame:SetAllPoints() -m.frame:SetScript('OnUpdate', m.on_update) -m.frame:Hide() +function private.create_frames() + private.frame = CreateFrame('Frame', nil, aux.frame) + m.frame:SetAllPoints() + m.frame:SetScript('OnUpdate', m.on_update) + m.frame:Hide() -m.frame.filter = aux.gui.panel(m.frame) -m.frame.filter:SetAllPoints(AuxFrameContent) + m.frame.filter = aux.gui.panel(m.frame) + m.frame.filter:SetAllPoints(aux.frame.content) -m.frame.results = aux.gui.panel(m.frame) -m.frame.results:SetAllPoints(AuxFrameContent) + m.frame.results = aux.gui.panel(m.frame) + m.frame.results:SetAllPoints(aux.frame.content) -m.frame.saved = CreateFrame('Frame', nil, m.frame) -m.frame.saved:SetAllPoints(AuxFrameContent) + m.frame.saved = CreateFrame('Frame', nil, m.frame) + m.frame.saved:SetAllPoints(aux.frame.content) -m.frame.saved.favorite = aux.gui.panel(m.frame.saved) -m.frame.saved.favorite:SetWidth(378.5) -m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) -m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0) + m.frame.saved.favorite = aux.gui.panel(m.frame.saved) + m.frame.saved.favorite:SetWidth(378.5) + m.frame.saved.favorite:SetPoint('TOPLEFT', 0, 0) + m.frame.saved.favorite:SetPoint('BOTTOMLEFT', 0, 0) -m.frame.saved.recent = aux.gui.panel(m.frame.saved) -m.frame.saved.recent:SetWidth(378.5) -m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) -m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) -do - local btn = aux.gui.button(m.frame) - btn:SetPoint('TOPLEFT', 0, 0) - btn:SetWidth(42) - btn:SetHeight(42) - btn:SetScript('OnClick', function() - if this.open then - m.settings:Hide() - m.controls:Show() - else - m.settings:Show() - m.controls:Hide() - end - this.open = not this.open - end) - - for _, offset in {14, 10, 6} do - local fake_icon_part = btn:CreateFontString() - fake_icon_part:SetFont([[Fonts\FRIZQT__.TTF]], 23) - fake_icon_part:SetPoint('CENTER', 0, offset) - fake_icon_part:SetText('_') - end - - private.settings_button = btn -end -do - local panel = CreateFrame('Frame', nil, m.frame) - panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} - panel:SetBackdropColor(unpack(aux.gui.color.content.backdrop)) - panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) - panel:SetPoint('RIGHT', 0, 0) - panel:SetHeight(42) - panel:Hide() - private.settings = panel -end -do - local panel = CreateFrame('Frame', nil, m.frame) - panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) - panel:SetPoint('RIGHT', 0, 1) - panel:SetHeight(40) - private.controls = panel -end -do - local editbox = aux.gui.editbox(m.settings) - editbox:SetPoint('LEFT', 75, 0) - editbox:SetWidth(50) - editbox:SetNumeric(true) - editbox:SetMaxLetters(nil) - editbox:SetScript('OnTabPressed', function() - m.last_page_input:SetFocus() - end) - editbox:SetScript('OnEnterPressed', function() - this:ClearFocus() - m.execute() - end) - editbox:SetScript('OnTextChanged', function() - if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then - this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) - else - this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) - end - end) - local label = aux.gui.label(editbox, 16) - label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0) - label:SetText('Pages') - label:SetTextColor(unpack(aux.gui.color.text.enabled)) - private.first_page_input = editbox -end -do - local editbox = aux.gui.editbox(m.settings) - editbox:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0) - editbox:SetWidth(50) - editbox:SetNumeric(true) - editbox:SetMaxLetters(nil) - editbox:SetScript('OnTabPressed', function() - m.first_page_input:SetFocus() - end) - editbox:SetScript('OnEnterPressed', function() - this:ClearFocus() - m.execute() - end) - editbox:SetScript('OnTextChanged', function() - if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then - this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) - else - this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) - end - end) - local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) - label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0) - label:SetText('-') - label:SetTextColor(unpack(aux.gui.color.text.enabled)) - private.last_page_input = editbox -end -do - local btn = aux.gui.checkbutton(m.settings) - btn:SetPoint('LEFT', 230, 0) - btn:SetWidth(140) - btn:SetHeight(25) - btn:SetText('Real Time Mode') - btn:SetScript('OnClick', function() - this:SetChecked(not this:GetChecked()) - this = m.first_page_input - m.first_page_input:GetScript('OnTextChanged')() - this = m.last_page_input - m.last_page_input:GetScript('OnTextChanged')() - end) - public.real_time_button = btn -end -do - local btn = aux.gui.checkbutton(m.settings) - btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 15, 0) - btn:SetWidth(140) - btn:SetHeight(25) - btn:SetText('Auto Buyout Mode') - btn:SetScript('OnClick', function() - if this:GetChecked() then - this:SetChecked(false) - else - StaticPopup_Show('AUX_SEARCH_AUTO_BUY') - end - end) - private.auto_buy_button = btn -end -do - local btn = aux.gui.checkbutton(m.settings) - btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 15, 0) - btn:SetWidth(140) - btn:SetHeight(25) - btn:SetText('Auto Buyout Filter') - btn:SetScript('OnClick', function() - if this:GetChecked() then - this:SetChecked(false) - aux_auto_buy_filter = nil - this.prettified = nil - m.auto_buy_validator = nil - else - StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER') - end - end) - btn:SetScript('OnEnter', function() - if this.prettified then - GameTooltip_SetDefaultAnchor(GameTooltip, UIParent) - GameTooltip:AddLine(gsub(this.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true) - GameTooltip:Show() - end - end) - btn:SetScript('OnLeave', function() - GameTooltip:Hide() - end) - private.auto_buy_filter_button = btn -end -do - local btn = aux.gui.button(m.controls, 25) - btn:SetPoint('LEFT', 5, 0) - btn:SetWidth(30) - btn:SetHeight(25) - btn:SetText('<') - btn:SetScript('OnClick', m.previous_search) - private.previous_button = btn -end -do - local btn = aux.gui.button(m.controls, 25) - btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0) - btn:SetWidth(30) - btn:SetHeight(25) - btn:SetText('>') - btn:SetScript('OnClick', m.next_search) - private.next_button = btn -end -do - local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) - btn:SetPoint('RIGHT', -5, 0) - btn:SetWidth(70) - btn:SetHeight(25) - btn:SetText('Start') - btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') - btn:SetScript('OnClick', function() - if arg1 == 'RightButton' then - m.set_filter(m.current_search().filter_string) - end - m.execute() - end) - private.start_button = btn -end -do - local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) - btn:SetPoint('RIGHT', -5, 0) - btn:SetWidth(70) - btn:SetHeight(25) - btn:SetText('Stop') - btn:SetScript('OnClick', function() - aux.scan.abort(m.search_scan_id) - end) - private.stop_button = btn -end -do - local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) - btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) - btn:SetWidth(70) - btn:SetHeight(25) - btn:SetText(GREEN_FONT_COLOR_CODE..'Resume'..FONT_COLOR_CODE_CLOSE) - btn:SetScript('OnClick', function() - m.execute(true) - end) - private.resume_button = btn -end -do - local editbox = aux.gui.editbox(m.controls) - editbox:SetMaxLetters(nil) - editbox:EnableMouse(1) - editbox.complete = aux.completion.complete_filter - editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) - editbox:SetHeight(25) - editbox:SetScript('OnChar', function() - this:complete() - end) - editbox:SetScript('OnTabPressed', function() - this:HighlightText(0, 0) - end) - editbox:SetScript('OnEnterPressed', m.execute) - private.search_box = editbox -end -do - aux.gui.horizontal_line(m.frame, -40) -end -do - local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) - btn:SetPoint('BOTTOMLEFT', AuxFrameContent, 'TOPLEFT', 10, 8) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('Search Results') - btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end) - private.search_results_button = btn -end -do - local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) - btn:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('Saved Searches') - btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end) - private.saved_searches_button = btn -end -do - local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) - btn:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(243) - btn:SetHeight(22) - btn:SetText('New Filter') - btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end) - private.new_filter_button = btn -end -do - local frame = CreateFrame('Frame', nil, m.frame) - frame:SetWidth(265) - frame:SetHeight(25) - frame:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6) - private.status_bar_frame = frame -end -do - local btn = aux.gui.button(m.frame.results, 16) - btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Bid') - btn:Disable() - private.bid_button = btn -end -do - local btn = aux.gui.button(m.frame.results, 16) - btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Buyout') - btn:Disable() - private.buyout_button = btn -end -do - local btn = aux.gui.button(m.frame.results, 16) - btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Clear') - btn:SetScript('OnClick', function() - while tremove(m.current_search().records) do end - m.current_search().table:SetDatabase() - end) -end -do - local btn = aux.gui.button(m.frame.saved, 16) - btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) - btn:SetWidth(80) - btn:SetHeight(24) - btn:SetText('Favorite') - btn:SetScript('OnClick', function() - local filters = aux.filter.queries(m.search_box:GetText()) - if filters then - tinsert(aux_favorite_searches, 1, { - filter_string = m.search_box:GetText(), - prettified = aux.util.join(aux.util.map(filters, function(filter) return filter.prettified end), ';'), - }) - end - m.update_search_listings() - end) -end -do - local btn1 = aux.gui.button(m.frame.filter, 16) - btn1:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) - btn1:SetWidth(80) - btn1:SetHeight(24) - btn1:SetText('Search') - btn1:SetScript('OnClick', function() - m.export_query_string() - m.execute() - end) - - local btn2 = aux.gui.button(m.frame.filter, 16) - btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0) - btn2:SetWidth(80) - btn2:SetHeight(24) - btn2:SetText('Export') - btn2:SetScript('OnClick', m.export_query_string) - - local btn3 = aux.gui.button(m.frame.filter, 16) - btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0) - btn3:SetWidth(80) - btn3:SetHeight(24) - btn3:SetText('Import') - btn3:SetScript('OnClick', m.import_query_string) -end -do - local editbox = aux.gui.editbox(m.frame.filter) - editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end) - editbox:SetPoint('TOPLEFT', 14, -25) - editbox:SetWidth(260) - editbox:SetScript('OnChar', function() - if m.exact_checkbox:GetChecked() then - this:complete_item() - end - end) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.max_level_input:SetFocus() - else - m.min_level_input:SetFocus() - end - end) - editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Name') - private.name_input = editbox -end -do - local checkbox = aux.gui.checkbox(m.frame.filter) - checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 16, 0) - local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) - label:SetText('Exact') - private.exact_checkbox = checkbox -end -do - local editbox = aux.gui.editbox(m.frame.filter) - editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -26) - editbox:SetWidth(125) - editbox:SetNumeric(true) - editbox:SetMaxLetters(2) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.name_input:SetFocus() - else - m.max_level_input:SetFocus() - end - end) - editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) - local label = aux.gui.label(editbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) - label:SetText('Level Range') - private.min_level_input = editbox -end -do - local editbox = aux.gui.editbox(m.frame.filter) - editbox:SetPoint('TOPLEFT', m.min_level_input, 'TOPRIGHT', 10, 0) - editbox:SetWidth(125) - editbox:SetNumeric(true) - editbox:SetMaxLetters(2) - editbox:SetScript('OnTabPressed', function() - if IsShiftKeyDown() then - m.min_level_input:SetFocus() - else - m.name_input:SetFocus() - end - end) - editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) - local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) - label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0) - label:SetText('-') - private.max_level_input = editbox -end -do - local checkbox = aux.gui.checkbox(m.frame.filter) - checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 16, 0) - local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) - label:SetText('Usable') - private.usable_checkbox = checkbox -end -do - local dropdown = aux.gui.dropdown(m.frame.filter) - dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -24) - dropdown:SetWidth(300) - local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) - label:SetText('Item Class') - UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_class_dropdown) - end) - private.class_dropdown = dropdown -end -do - local dropdown = aux.gui.dropdown(m.frame.filter) - private.subclass_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -23) - dropdown:SetWidth(300) - local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) - label:SetText('Item Subclass') - UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown) - end) -end -do - local dropdown = aux.gui.dropdown(m.frame.filter) - private.slot_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -23) - dropdown:SetWidth(300) - local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) - label:SetText('Item Slot') - UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown) - end) - -end -do - local dropdown = aux.gui.dropdown(m.frame.filter) - private.quality_dropdown = dropdown - dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -23) - dropdown:SetWidth(300) - local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) - label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) - label:SetText('Min Quality') - UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown) - end) -end -aux.gui.vertical_line(m.frame.filter, 332) -do - local dropdown = aux.gui.dropdown(m.frame.filter) - dropdown:SetPoint('TOPRIGHT', -177, -10) - dropdown:SetWidth(150) - UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown) - dropdown:SetScript('OnShow', function() - UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown) - end) - getglobal(dropdown:GetName()..'Text'):Hide() - local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) - label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) - label:SetText('Post Filter') - private.filter_dropdown = dropdown -end -do - local btn = aux.gui.button(m.frame.filter, 16) - btn:SetWidth(150) - btn:SetHeight(25) - btn:SetPoint('CENTER', m.filter_dropdown, 'CENTER', 0, 0) - btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') - btn:SetScript('OnClick', function() - if arg1 == 'LeftButton' then - m.add_post_component() - elseif arg1 == 'RightButton' then - m.remove_post_filter() - end - end) - private.filter_button = btn -end -do - local input = aux.gui.editbox(m.frame.filter) - input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) - input:SetWidth(150) - input:SetScript('OnChar', function() - this:complete() - end) - input:SetScript('OnEnterPressed', m.add_post_component) - input:Hide() - private.filter_input = input -end -do - local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter) - scroll_frame:SetWidth(395) - scroll_frame:SetHeight(270) - scroll_frame:SetPoint('TOPLEFT', 348, -50) - scroll_frame:EnableMouse(true) - scroll_frame:EnableMouseWheel(true) - scroll_frame:SetScript('OnMouseWheel', function() - local child = this:GetScrollChild() - child:SetFont('p', [[Fonts\ARIALN.TTF]], max(10, min(26, aux.util.select(2, child:GetFont()) + arg1*2))) - m.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 - - this:SetHorizontalScroll(min(0, max((this:GetWidth() - m.filter_display_width())*m.filter_display:GetScale() - 2, new_x_offset - this.x_extra))) - this:SetVerticalScroll(max(0, 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) + m.frame.saved.recent = aux.gui.panel(m.frame.saved) + m.frame.saved.recent:SetWidth(378.5) + m.frame.saved.recent:SetPoint('TOPRIGHT', 0, 0) + m.frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0) + do + local btn = aux.gui.button(m.frame) + btn:SetPoint('TOPLEFT', 0, 0) + btn:SetWidth(42) + btn:SetHeight(42) + btn:SetScript('OnClick', function() + if this.open then + m.settings:Hide() + m.controls:Show() + else + m.settings:Show() + m.controls:Hide() + end + this.open = not this.open end) - end) - scroll_frame:SetScript('OnDragStop', function() - this:SetScript('OnUpdate', nil) - end) - aux.gui.set_content_style(scroll_frame) - local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame) - scroll_frame:SetScrollChild(scroll_child) - scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], 26) - scroll_child:SetWidth(1) - scroll_child:SetHeight(1) - scroll_child:SetScript('OnHyperlinkClick', function() - end) - scroll_child.measure = scroll_child:CreateFontString() - private.filter_display = scroll_child -end -private.status_bars = {} -private.tables = {} -for _=1,5 do - local status_bar = aux.gui.status_bar(m.frame) - status_bar:SetAllPoints(m.status_bar_frame) - status_bar:Hide() - tinsert(m.status_bars, status_bar) + for _, offset in {14, 10, 6} do + local fake_icon_part = btn:CreateFontString() + fake_icon_part:SetFont([[Fonts\FRIZQT__.TTF]], 23) + fake_icon_part:SetPoint('CENTER', 0, offset) + fake_icon_part:SetText('_') + end - local table = aux.auction_listing.CreateAuctionResultsTable(m.frame.results, aux.auction_listing.search_config) - table:SetHandler('OnCellClick', function(cell, button) - if IsAltKeyDown() and m.current_search().table:GetSelection().record == cell.row.data.record then - if button == 'LeftButton' and m.buyout_button:IsEnabled() then - m.buyout_button:Click() - elseif button == 'RightButton' and m.bid_button:IsEnabled() then - m.bid_button:Click() - end - end - end) - table:SetHandler('OnSelectionChanged', function(rt, datum) - if not datum then return end - m.find_auction(datum.record) - end) - table:Hide() - tinsert(m.tables, table) -end + private.settings_button = btn + end + do + local panel = CreateFrame('Frame', nil, m.frame) + panel:SetBackdrop{bgFile=[[Interface\Buttons\WHITE8X8]]} + panel:SetBackdropColor(unpack(aux.gui.color.content.backdrop)) + panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) + panel:SetPoint('RIGHT', 0, 0) + panel:SetHeight(42) + panel:Hide() + private.settings = panel + end + do + local panel = CreateFrame('Frame', nil, m.frame) + panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) + panel:SetPoint('RIGHT', 0, 1) + panel:SetHeight(40) + private.controls = panel + end + do + local editbox = aux.gui.editbox(m.settings) + editbox:SetPoint('LEFT', 75, 0) + editbox:SetWidth(50) + editbox:SetNumeric(true) + editbox:SetMaxLetters(nil) + editbox:SetScript('OnTabPressed', function() + m.last_page_input:SetFocus() + end) + editbox:SetScript('OnEnterPressed', function() + this:ClearFocus() + m.execute() + end) + editbox:SetScript('OnTextChanged', function() + if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then + this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) + else + this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) + end + end) + local label = aux.gui.label(editbox, 16) + label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0) + label:SetText('Pages') + label:SetTextColor(unpack(aux.gui.color.text.enabled)) + private.first_page_input = editbox + end + do + local editbox = aux.gui.editbox(m.settings) + editbox:SetPoint('LEFT', m.first_page_input, 'RIGHT', 10, 0) + editbox:SetWidth(50) + editbox:SetNumeric(true) + editbox:SetMaxLetters(nil) + editbox:SetScript('OnTabPressed', function() + m.first_page_input:SetFocus() + end) + editbox:SetScript('OnEnterPressed', function() + this:ClearFocus() + m.execute() + end) + editbox:SetScript('OnTextChanged', function() + if m.blizzard_page_index(this:GetText()) and not m.real_time_button:GetChecked() then + this:SetBackdropColor(unpack(aux.gui.color.state.enabled)) + else + this:SetBackdropColor(unpack(aux.gui.color.state.disabled)) + end + end) + local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) + label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0) + label:SetText('-') + label:SetTextColor(unpack(aux.gui.color.text.enabled)) + private.last_page_input = editbox + end + do + local btn = aux.gui.checkbutton(m.settings) + btn:SetPoint('LEFT', 230, 0) + btn:SetWidth(140) + btn:SetHeight(25) + btn:SetText('Real Time Mode') + btn:SetScript('OnClick', function() + this:SetChecked(not this:GetChecked()) + this = m.first_page_input + m.first_page_input:GetScript('OnTextChanged')() + this = m.last_page_input + m.last_page_input:GetScript('OnTextChanged')() + end) + public.real_time_button = btn + end + do + local btn = aux.gui.checkbutton(m.settings) + btn:SetPoint('LEFT', m.real_time_button, 'RIGHT', 15, 0) + btn:SetWidth(140) + btn:SetHeight(25) + btn:SetText('Auto Buyout Mode') + btn:SetScript('OnClick', function() + if this:GetChecked() then + this:SetChecked(false) + else + StaticPopup_Show('AUX_SEARCH_AUTO_BUY') + end + end) + private.auto_buy_button = btn + end + do + local btn = aux.gui.checkbutton(m.settings) + btn:SetPoint('LEFT', m.auto_buy_button, 'RIGHT', 15, 0) + btn:SetWidth(140) + btn:SetHeight(25) + btn:SetText('Auto Buyout Filter') + btn:SetScript('OnClick', function() + if this:GetChecked() then + this:SetChecked(false) + aux_auto_buy_filter = nil + this.prettified = nil + m.auto_buy_validator = nil + else + StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER') + end + end) + btn:SetScript('OnEnter', function() + if this.prettified then + GameTooltip_SetDefaultAnchor(GameTooltip, UIParent) + GameTooltip:AddLine(gsub(this.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true) + GameTooltip:Show() + end + end) + btn:SetScript('OnLeave', function() + GameTooltip:Hide() + end) + private.auto_buy_filter_button = btn + end + do + local btn = aux.gui.button(m.controls, 25) + btn:SetPoint('LEFT', 5, 0) + btn:SetWidth(30) + btn:SetHeight(25) + btn:SetText('<') + btn:SetScript('OnClick', m.previous_search) + private.previous_button = btn + end + do + local btn = aux.gui.button(m.controls, 25) + btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0) + btn:SetWidth(30) + btn:SetHeight(25) + btn:SetText('>') + btn:SetScript('OnClick', m.next_search) + private.next_button = btn + end + do + local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) + btn:SetPoint('RIGHT', -5, 0) + btn:SetWidth(70) + btn:SetHeight(25) + btn:SetText('Start') + btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') + btn:SetScript('OnClick', function() + if arg1 == 'RightButton' then + m.set_filter(m.current_search().filter_string) + end + m.execute() + end) + private.start_button = btn + end + do + local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) + btn:SetPoint('RIGHT', -5, 0) + btn:SetWidth(70) + btn:SetHeight(25) + btn:SetText('Stop') + btn:SetScript('OnClick', function() + aux.scan.abort(m.search_scan_id) + end) + private.stop_button = btn + end + do + local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) + btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) + btn:SetWidth(70) + btn:SetHeight(25) + btn:SetText(GREEN_FONT_COLOR_CODE..'Resume'..FONT_COLOR_CODE_CLOSE) + btn:SetScript('OnClick', function() + m.execute(true) + end) + private.resume_button = btn + end + do + local editbox = aux.gui.editbox(m.controls) + editbox:SetMaxLetters(nil) + editbox:EnableMouse(1) + editbox.complete = aux.completion.complete_filter + editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0) + editbox:SetHeight(25) + editbox:SetScript('OnChar', function() + this:complete() + end) + editbox:SetScript('OnTabPressed', function() + this:HighlightText(0, 0) + end) + editbox:SetScript('OnEnterPressed', m.execute) + private.search_box = editbox + end + do + aux.gui.horizontal_line(m.frame, -40) + end + do + local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) + btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('Search Results') + btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end) + private.search_results_button = btn + end + do + local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) + btn:SetPoint('TOPLEFT', m.search_results_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('Saved Searches') + btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end) + private.saved_searches_button = btn + end + do + local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) + btn:SetPoint('TOPLEFT', m.saved_searches_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(243) + btn:SetHeight(22) + btn:SetText('New Filter') + btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end) + private.new_filter_button = btn + end + do + local frame = CreateFrame('Frame', nil, m.frame) + frame:SetWidth(265) + frame:SetHeight(25) + frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) + private.status_bar_frame = frame + end + do + local btn = aux.gui.button(m.frame.results, 16) + btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Bid') + btn:Disable() + private.bid_button = btn + end + do + local btn = aux.gui.button(m.frame.results, 16) + btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Buyout') + btn:Disable() + private.buyout_button = btn + end + do + local btn = aux.gui.button(m.frame.results, 16) + btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Clear') + btn:SetScript('OnClick', function() + while tremove(m.current_search().records) do end + m.current_search().table:SetDatabase() + end) + end + do + local btn = aux.gui.button(m.frame.saved, 16) + btn:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) + btn:SetWidth(80) + btn:SetHeight(24) + btn:SetText('Favorite') + btn:SetScript('OnClick', function() + local filters = aux.filter.queries(m.search_box:GetText()) + if filters then + tinsert(aux_favorite_searches, 1, { + filter_string = m.search_box:GetText(), + prettified = aux.util.join(aux.util.map(filters, function(filter) return filter.prettified end), ';'), + }) + end + m.update_search_listings() + end) + end + do + local btn1 = aux.gui.button(m.frame.filter, 16) + btn1:SetPoint('TOPLEFT', m.status_bar_frame, 'TOPRIGHT', 5, 0) + btn1:SetWidth(80) + btn1:SetHeight(24) + btn1:SetText('Search') + btn1:SetScript('OnClick', function() + m.export_query_string() + m.execute() + end) -local handlers = { - OnClick = function(st, data, _, button) - if not data then return end - if button == 'LeftButton' and IsShiftKeyDown() then - m.search_box:SetText(data.search.filter_string) - elseif button == 'RightButton' and IsShiftKeyDown() then - m.add_filter(data.search.filter_string) - elseif button == 'LeftButton' and IsControlKeyDown() then - if st == m.favorite_searches_listing and data.index > 1 then - local temp = aux_favorite_searches[data.index - 1] - aux_favorite_searches[data.index - 1] = data.search - aux_favorite_searches[data.index] = temp - m.update_search_listings() - end - elseif button == 'RightButton' and IsControlKeyDown() then - if st == m.favorite_searches_listing and data.index < getn(aux_favorite_searches) then - local temp = aux_favorite_searches[data.index + 1] - aux_favorite_searches[data.index + 1] = data.search - aux_favorite_searches[data.index] = temp - m.update_search_listings() - end - elseif button == 'LeftButton' then - m.search_box:SetText(data.search.filter_string) - m.execute() - elseif button == 'RightButton' then - if st == m.recent_searches_listing then - tinsert(aux_favorite_searches, 1, data.search) - elseif st == m.favorite_searches_listing then - tremove(aux_favorite_searches, data.index) - end - m.update_search_listings() - end - end, - OnEnter = function(st, data, self) - if not data then return end - GameTooltip_SetDefaultAnchor(GameTooltip, UIParent) - GameTooltip:AddLine(gsub(data.search.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true) - GameTooltip:Show() - end, - OnLeave = function() - GameTooltip:ClearLines() - GameTooltip:Hide() - end -} + local btn2 = aux.gui.button(m.frame.filter, 16) + btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0) + btn2:SetWidth(80) + btn2:SetHeight(24) + btn2:SetText('Export') + btn2:SetScript('OnClick', m.export_query_string) -private.recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) -m.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}}) -m.recent_searches_listing:EnableSorting(false) -m.recent_searches_listing:DisableSelection(true) -m.recent_searches_listing:SetHandler('OnClick', handlers.OnClick) -m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter) -m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) + local btn3 = aux.gui.button(m.frame.filter, 16) + btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0) + btn3:SetWidth(80) + btn3:SetHeight(24) + btn3:SetText('Import') + btn3:SetScript('OnClick', m.import_query_string) + end + do + local editbox = aux.gui.editbox(m.frame.filter) + editbox.complete_item = aux.completion.complete(function() return aux_auctionable_items end) + editbox:SetPoint('TOPLEFT', 14, -25) + editbox:SetWidth(260) + editbox:SetScript('OnChar', function() + if m.exact_checkbox:GetChecked() then + this:complete_item() + end + end) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.max_level_input:SetFocus() + else + m.min_level_input:SetFocus() + end + end) + editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) + local label = aux.gui.label(editbox, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Name') + private.name_input = editbox + end + do + local checkbox = aux.gui.checkbox(m.frame.filter) + checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 16, 0) + local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) + label:SetText('Exact') + private.exact_checkbox = checkbox + end + do + local editbox = aux.gui.editbox(m.frame.filter) + editbox:SetPoint('TOPLEFT', m.name_input, 'BOTTOMLEFT', 0, -26) + editbox:SetWidth(125) + editbox:SetNumeric(true) + editbox:SetMaxLetters(2) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.name_input:SetFocus() + else + m.max_level_input:SetFocus() + end + end) + editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) + local label = aux.gui.label(editbox, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) + label:SetText('Level Range') + private.min_level_input = editbox + end + do + local editbox = aux.gui.editbox(m.frame.filter) + editbox:SetPoint('TOPLEFT', m.min_level_input, 'TOPRIGHT', 10, 0) + editbox:SetWidth(125) + editbox:SetNumeric(true) + editbox:SetMaxLetters(2) + editbox:SetScript('OnTabPressed', function() + if IsShiftKeyDown() then + m.min_level_input:SetFocus() + else + m.name_input:SetFocus() + end + end) + editbox:SetScript('OnEnterPressed', aux._(editbox.ClearFocus, editbox)) + local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) + label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0) + label:SetText('-') + private.max_level_input = editbox + end + do + local checkbox = aux.gui.checkbox(m.frame.filter) + checkbox:SetPoint('TOPLEFT', m.max_level_input, 'TOPRIGHT', 16, 0) + local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) + label:SetText('Usable') + private.usable_checkbox = checkbox + end + do + local dropdown = aux.gui.dropdown(m.frame.filter) + dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, -24) + dropdown:SetWidth(300) + local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Item Class') + UIDropDownMenu_Initialize(dropdown, m.initialize_class_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_class_dropdown) + end) + private.class_dropdown = dropdown + end + do + local dropdown = aux.gui.dropdown(m.frame.filter) + private.subclass_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetWidth(300) + local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Item Subclass') + UIDropDownMenu_Initialize(dropdown, m.initialize_subclass_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_subclass_dropdown) + end) + end + do + local dropdown = aux.gui.dropdown(m.frame.filter) + private.slot_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetWidth(300) + local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Item Slot') + UIDropDownMenu_Initialize(dropdown, m.initialize_slot_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_slot_dropdown) + end) -private.favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) -m.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}}) -m.favorite_searches_listing:EnableSorting(false) -m.favorite_searches_listing:DisableSelection(true) -m.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick) -m.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter) -m.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave) \ No newline at end of file + end + do + local dropdown = aux.gui.dropdown(m.frame.filter) + private.quality_dropdown = dropdown + dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, -23) + dropdown:SetWidth(300) + local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) + label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1) + label:SetText('Min Quality') + UIDropDownMenu_Initialize(dropdown, m.initialize_quality_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_quality_dropdown) + end) + end + aux.gui.vertical_line(m.frame.filter, 332) + do + local dropdown = aux.gui.dropdown(m.frame.filter) + dropdown:SetPoint('TOPRIGHT', -177, -10) + dropdown:SetWidth(150) + UIDropDownMenu_Initialize(dropdown, m.initialize_filter_dropdown) + dropdown:SetScript('OnShow', function() + UIDropDownMenu_Initialize(this, m.initialize_filter_dropdown) + end) + getglobal(dropdown:GetName()..'Text'):Hide() + local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) + label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) + label:SetText('Post Filter') + private.filter_dropdown = dropdown + end + do + local btn = aux.gui.button(m.frame.filter, 16) + btn:SetWidth(150) + btn:SetHeight(25) + btn:SetPoint('CENTER', m.filter_dropdown, 'CENTER', 0, 0) + btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp') + btn:SetScript('OnClick', function() + if arg1 == 'LeftButton' then + m.add_post_component() + elseif arg1 == 'RightButton' then + m.remove_post_filter() + end + end) + private.filter_button = btn + end + do + local input = aux.gui.editbox(m.frame.filter) + input:SetPoint('LEFT', m.filter_dropdown, 'RIGHT', 10, 0) + input:SetWidth(150) + input:SetScript('OnChar', function() + this:complete() + end) + input:SetScript('OnEnterPressed', m.add_post_component) + input:Hide() + private.filter_input = input + end + do + local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter) + scroll_frame:SetWidth(395) + scroll_frame:SetHeight(270) + scroll_frame:SetPoint('TOPLEFT', 348, -50) + scroll_frame:EnableMouse(true) + scroll_frame:EnableMouseWheel(true) + scroll_frame:SetScript('OnMouseWheel', function() + local child = this:GetScrollChild() + child:SetFont('p', [[Fonts\ARIALN.TTF]], max(10, min(26, aux.util.select(2, child:GetFont()) + arg1*2))) + m.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 + + this:SetHorizontalScroll(min(0, max((this:GetWidth() - m.filter_display_width())*m.filter_display:GetScale() - 2, new_x_offset - this.x_extra))) + this:SetVerticalScroll(max(0, 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) + aux.gui.set_content_style(scroll_frame) + local scroll_child = CreateFrame('SimpleHTML', nil, scroll_frame) + scroll_frame:SetScrollChild(scroll_child) + scroll_child:SetFont('p', [[Fonts\ARIALN.TTF]], 26) + scroll_child:SetWidth(1) + scroll_child:SetHeight(1) + scroll_child:SetScript('OnHyperlinkClick', function() + end) + scroll_child.measure = scroll_child:CreateFontString() + private.filter_display = scroll_child + end + + private.status_bars = {} + private.tables = {} + for _=1,5 do + local status_bar = aux.gui.status_bar(m.frame) + status_bar:SetAllPoints(m.status_bar_frame) + status_bar:Hide() + tinsert(m.status_bars, status_bar) + + local table = aux.auction_listing.CreateAuctionResultsTable(m.frame.results, aux.auction_listing.search_config) + table:SetHandler('OnCellClick', function(cell, button) + if IsAltKeyDown() and m.current_search().table:GetSelection().record == cell.row.data.record then + if button == 'LeftButton' and m.buyout_button:IsEnabled() then + m.buyout_button:Click() + elseif button == 'RightButton' and m.bid_button:IsEnabled() then + m.bid_button:Click() + end + end + end) + table:SetHandler('OnSelectionChanged', function(rt, datum) + if not datum then return end + m.find_auction(datum.record) + end) + table:Hide() + tinsert(m.tables, table) + end + + local handlers = { + OnClick = function(st, data, _, button) + if not data then return end + if button == 'LeftButton' and IsShiftKeyDown() then + m.search_box:SetText(data.search.filter_string) + elseif button == 'RightButton' and IsShiftKeyDown() then + m.add_filter(data.search.filter_string) + elseif button == 'LeftButton' and IsControlKeyDown() then + if st == m.favorite_searches_listing and data.index > 1 then + local temp = aux_favorite_searches[data.index - 1] + aux_favorite_searches[data.index - 1] = data.search + aux_favorite_searches[data.index] = temp + m.update_search_listings() + end + elseif button == 'RightButton' and IsControlKeyDown() then + if st == m.favorite_searches_listing and data.index < getn(aux_favorite_searches) then + local temp = aux_favorite_searches[data.index + 1] + aux_favorite_searches[data.index + 1] = data.search + aux_favorite_searches[data.index] = temp + m.update_search_listings() + end + elseif button == 'LeftButton' then + m.search_box:SetText(data.search.filter_string) + m.execute() + elseif button == 'RightButton' then + if st == m.recent_searches_listing then + tinsert(aux_favorite_searches, 1, data.search) + elseif st == m.favorite_searches_listing then + tremove(aux_favorite_searches, data.index) + end + m.update_search_listings() + end + end, + OnEnter = function(st, data, self) + if not data then return end + GameTooltip_SetDefaultAnchor(GameTooltip, UIParent) + GameTooltip:AddLine(gsub(data.search.prettified, ';', '\n\n'), 255/255, 254/255, 250/255, true) + GameTooltip:Show() + end, + OnLeave = function() + GameTooltip:ClearLines() + GameTooltip:Hide() + end + } + + private.recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) + m.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}}) + m.recent_searches_listing:EnableSorting(false) + m.recent_searches_listing:DisableSelection(true) + m.recent_searches_listing:SetHandler('OnClick', handlers.OnClick) + m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter) + m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) + + private.favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) + m.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}}) + m.favorite_searches_listing:EnableSorting(false) + m.favorite_searches_listing:DisableSelection(true) + m.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick) + m.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter) + m.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave) +end \ No newline at end of file