working on refactoring of search options
This commit is contained in:
@@ -54,17 +54,16 @@ function public.inline_color(color)
|
||||
return format("|c%02X%02X%02X%02X", a, r, g, b)
|
||||
end
|
||||
|
||||
function public.panel(parent, name)
|
||||
local panel = CreateFrame('Frame', name, parent)
|
||||
panel:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
|
||||
panel:SetBackdropColor(unpack(m.config.frame_color))
|
||||
panel:SetBackdropBorderColor(unpack(m.config.frame_border_color))
|
||||
function public.panel(parent)
|
||||
local panel = CreateFrame('Frame', nil, parent)
|
||||
panel:SetBackdrop{bgFile='Interface\\Buttons\\WHITE8X8'}
|
||||
panel:SetBackdropColor(unpack(m.config.content_color))
|
||||
return panel
|
||||
end
|
||||
|
||||
function public.button(parent, text_height, name)
|
||||
local button = CreateFrame('Button', name, parent)
|
||||
button:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
|
||||
button:SetBackdrop{bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size}
|
||||
button:SetBackdropColor(unpack(m.config.content_color))
|
||||
button:SetBackdropBorderColor(unpack(m.config.content_border_color))
|
||||
local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
|
||||
@@ -128,7 +127,7 @@ do
|
||||
tab.id = id
|
||||
tab.group = self
|
||||
tab:SetHeight(24)
|
||||
tab:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
|
||||
tab:SetBackdrop{bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size}
|
||||
tab:SetBackdropColor(0, 0, 0, 0)
|
||||
tab:SetBackdropBorderColor(unpack(m.config.frame_border_color))
|
||||
local image = tab:CreateTexture(nil, 'BACKGROUND')
|
||||
@@ -231,7 +230,7 @@ function public.editbox(parent, name)
|
||||
editbox:SetHeight(19)
|
||||
editbox:SetFont(m.config.content_font, m.config.normal_font_size)
|
||||
editbox:SetShadowColor(0, 0, 0, 0)
|
||||
editbox:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
|
||||
editbox:SetBackdrop{bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size}
|
||||
editbox:SetBackdropColor(unpack(m.config.content_color))
|
||||
editbox:SetBackdropBorderColor(unpack(m.config.content_border_color))
|
||||
|
||||
@@ -385,7 +384,7 @@ do
|
||||
|
||||
local dropdown = CreateFrame('Frame', 'aux_dropdown'..id, parent, 'UIDropDownMenuTemplate')
|
||||
|
||||
dropdown:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size, insets={top=5,bottom=5}})
|
||||
dropdown:SetBackdrop{bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size, insets={top=5,bottom=5}}
|
||||
dropdown:SetBackdropColor(unpack(m.config.content_color))
|
||||
dropdown:SetBackdropBorderColor(unpack(m.config.content_border_color))
|
||||
local left = getglobal(dropdown:GetName()..'Left'):Hide()
|
||||
@@ -480,7 +479,7 @@ function public.slider(frame, name)
|
||||
slider:SetHeight(6)
|
||||
slider:SetHitRectInsets(0, 0, -8, -8)
|
||||
slider:SetValue(0)
|
||||
slider:SetBackdrop({ bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size })
|
||||
slider:SetBackdrop{ bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size }
|
||||
slider:SetBackdropColor(unpack(m.config.frame_color))
|
||||
slider:SetBackdropBorderColor(unpack(m.config.frame_border_color))
|
||||
local thumb_texture = slider:CreateTexture(nil, 'ARTWORK')
|
||||
@@ -505,7 +504,7 @@ function public.slider(frame, name)
|
||||
editbox:SetWidth(70)
|
||||
editbox:SetJustifyH('CENTER')
|
||||
editbox:EnableMouse(true)
|
||||
editbox:SetBackdrop({ bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size })
|
||||
editbox:SetBackdrop{ bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size }
|
||||
editbox:SetBackdropColor(unpack(m.config.content_color))
|
||||
editbox:SetBackdropBorderColor(unpack(m.config.content_border_color))
|
||||
-- editbox:SetFont(m.config.content_font, m.config.normal_font_size)
|
||||
|
||||
+16
-8
@@ -48,14 +48,22 @@ StaticPopupDialogs['AUX_SEARCH_TABLE_FULL'] = {
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_SNIPING'] = {
|
||||
text = 'Do you want to activate automatic buyout for sniping?',
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
text = 'Do you want to activate automatic buyout?',
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
OnAccept = function()
|
||||
m.snipe_button.auto = true
|
||||
local color = RED_FONT_COLOR
|
||||
m.snipe_button:GetFontString():SetTextColor(color.r, color.g, color.b)
|
||||
m.auto_buy_checkbox:SetChecked(1)
|
||||
end,
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
}
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY_FILTER'] = {
|
||||
text = 'Do you want to activate the automatic buyout filter?',
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
OnAccept = function()
|
||||
m.auto_buy_filter_checkbox:SetChecked(1)
|
||||
end,
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
@@ -247,13 +255,13 @@ end
|
||||
function public.enable_sniping()
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.snipe = true
|
||||
m.snipe_button:LockHighlight()
|
||||
m.settings_button:LockHighlight()
|
||||
end
|
||||
|
||||
function public.disable_sniping()
|
||||
Aux.scan.abort(m.search_scan_id)
|
||||
m.snipe = false
|
||||
m.snipe_button:UnlockHighlight()
|
||||
m.settings_button:UnlockHighlight()
|
||||
end
|
||||
|
||||
function private.start_sniping(query, search, continuation)
|
||||
@@ -283,7 +291,7 @@ function private.start_sniping(query, search, continuation)
|
||||
end,
|
||||
on_auction = function(auction_record)
|
||||
if not ignore_page then
|
||||
if m.snipe_button.auto then
|
||||
if m.settings_button.auto then
|
||||
PlaceAuctionBid('list', auction_record.index, auction_record.buyout_price)
|
||||
else
|
||||
tinsert(new_records, auction_record)
|
||||
|
||||
+157
-74
@@ -24,35 +24,162 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
m.frame.saved.recent:SetPoint('BOTTOMRIGHT', -4, 4)
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 22)
|
||||
btn:SetPoint('TOPLEFT', 5, -8)
|
||||
btn:SetPoint('TOPLEFT', 0, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('Snipe')
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetHeight(40)
|
||||
btn:SetText('_\n_\n_')
|
||||
-- btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
if arg1 == 'LeftButton' then
|
||||
if m.snipe then
|
||||
m.disable_sniping()
|
||||
else
|
||||
m.enable_sniping()
|
||||
end
|
||||
m.update_resume()
|
||||
elseif arg1 == 'RightButton' then
|
||||
if this.auto then
|
||||
this.auto = false
|
||||
this:GetFontString():SetTextColor(unpack(Aux.gui.config.text_color.enabled))
|
||||
else
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_SNIPING')
|
||||
this.open = not this.open
|
||||
if this.open then
|
||||
m.settings:Show()
|
||||
m.controls:Hide()
|
||||
else
|
||||
m.settings:Hide()
|
||||
m.controls:Show()
|
||||
end
|
||||
end)
|
||||
btn.open = false
|
||||
private.settings_button = btn
|
||||
end
|
||||
do
|
||||
local panel = Aux.gui.panel(m.frame)
|
||||
panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0)
|
||||
panel:SetPoint('RIGHT', 0, 0)
|
||||
panel:SetHeight(40)
|
||||
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, 0)
|
||||
panel:SetHeight(40)
|
||||
private.controls = panel
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.settings)
|
||||
editbox:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||
editbox:SetPoint('LEFT', 60, 0)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.max_level_input:SetFocus()
|
||||
else
|
||||
m.last_page_editbox:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 15)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -10, 0)
|
||||
label:SetText('Pages')
|
||||
private.first_page_editbox = editbox
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.settings)
|
||||
editbox:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||
editbox:SetPoint('LEFT', m.first_page_editbox, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.first_page_editbox:SetFocus()
|
||||
else
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 15)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
label:SetText('-')
|
||||
private.last_page_editbox = editbox
|
||||
end
|
||||
do
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('LEFT', 210, 0)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
if m.snipe then
|
||||
m.disable_sniping()
|
||||
else
|
||||
m.enable_sniping()
|
||||
end
|
||||
m.update_resume()
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -10, 0)
|
||||
label:SetText('Sniping')
|
||||
private.snipe_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('LEFT', 300, 0)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
if this:GetChecked() then
|
||||
this:SetChecked(nil)
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY')
|
||||
end
|
||||
end)
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -10, 0)
|
||||
label:SetText('Auto Buy')
|
||||
private.auto_buy_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local checkbox = CreateFrame('CheckButton', nil, m.settings, 'UICheckButtonTemplate')
|
||||
checkbox:SetWidth(22)
|
||||
checkbox:SetHeight(22)
|
||||
checkbox:SetPoint('LEFT', 460, 0)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
if this:GetChecked() then
|
||||
this:SetChecked(nil)
|
||||
if Aux.scan_util.parse_filter_string(m.auto_buy_filter_editbox:GetText()) then
|
||||
StaticPopup_Show('AUX_SEARCH_AUTO_BUY_FILTER')
|
||||
end
|
||||
end
|
||||
end)
|
||||
btn.auto = false
|
||||
private.snipe_button = btn
|
||||
local label = Aux.gui.label(checkbox, 15)
|
||||
label:SetPoint('RIGHT', checkbox, 'LEFT', -10, 0)
|
||||
label:SetText('Auto Buy Filter')
|
||||
private.auto_buy_filter_checkbox = checkbox
|
||||
end
|
||||
Aux.gui.vertical_line(m.frame, 80, nil, 408)
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 26)
|
||||
btn:SetPoint('LEFT', m.snipe_button, 'RIGHT', 12, 0)
|
||||
local editbox = Aux.gui.editbox(m.settings)
|
||||
editbox:SetBackdropColor(unpack(Aux.gui.config.frame_color))
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = Aux.completion.complete_filter
|
||||
editbox:SetPoint('LEFT', 500, 0)
|
||||
editbox:SetWidth(200)
|
||||
editbox:SetHeight(25)
|
||||
editbox:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
this:HighlightText(0, 0)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:HighlightText(0, 0)
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
private.auto_buy_filter_editbox = editbox
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.controls, 26)
|
||||
btn:SetPoint('LEFT', 12, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
btn:SetText('<')
|
||||
@@ -60,7 +187,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.previous_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 26)
|
||||
local btn = Aux.gui.button(m.controls, 26)
|
||||
btn:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
|
||||
btn:SetWidth(30)
|
||||
btn:SetHeight(25)
|
||||
@@ -69,7 +196,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.next_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 22)
|
||||
local btn = Aux.gui.button(m.controls, 22)
|
||||
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
@@ -84,7 +211,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.start_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 22)
|
||||
local btn = Aux.gui.button(m.controls, 22)
|
||||
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
@@ -96,7 +223,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.stop_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(m.frame, 22)
|
||||
local btn = Aux.gui.button(m.controls, 22)
|
||||
btn:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
|
||||
btn:SetWidth(70)
|
||||
btn:SetHeight(25)
|
||||
@@ -107,10 +234,10 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
private.resume_button = btn
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame)
|
||||
local editbox = Aux.gui.editbox(m.controls)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = Aux.completion.complete
|
||||
editbox.complete = Aux.completion.complete_filter
|
||||
editbox:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
|
||||
editbox:SetHeight(25)
|
||||
editbox:SetScript('OnChar', function()
|
||||
@@ -255,7 +382,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox.complete_item = Aux.completion.completor(function() return aux_auctionable_items end)
|
||||
editbox.complete_item = Aux.completion.complete(function() return aux_auctionable_items end)
|
||||
editbox:SetPoint('TOPLEFT', 14, -20)
|
||||
editbox:SetWidth(260)
|
||||
editbox:SetScript('OnChar', function()
|
||||
@@ -399,50 +526,6 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
end)
|
||||
private.quality_dropdown = dropdown
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox:SetPoint('TOPLEFT', m.quality_dropdown, 'BOTTOMLEFT', 0, -18)
|
||||
editbox:SetWidth(145)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(2)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.max_level_input:SetFocus()
|
||||
else
|
||||
m.last_page_editbox:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Page Range')
|
||||
private.first_page_editbox = editbox
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox:SetPoint('TOPLEFT', m.first_page_editbox, 'TOPRIGHT', 10, 0)
|
||||
editbox:SetWidth(145)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(2)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.first_page_editbox:SetFocus()
|
||||
else
|
||||
m.name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
m.execute()
|
||||
end)
|
||||
local label = Aux.gui.label(editbox, 13)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -4, 0)
|
||||
label:SetText('-')
|
||||
private.last_page_editbox = editbox
|
||||
end
|
||||
Aux.gui.vertical_line(m.frame.filter, 332)
|
||||
do
|
||||
local label = Aux.gui.label(m.usable_checkbox, 13)
|
||||
@@ -615,7 +698,7 @@ Aux.search_tab.FRAMES(function(m, public, private)
|
||||
btn.inputs = {}
|
||||
if filter.arity > 0 then
|
||||
local editbox = Aux.gui.editbox(m.frame.filter)
|
||||
editbox.complete = Aux.completion.completor(function() return ({filter.test()})[2] end)
|
||||
editbox.complete = Aux.completion.complete(function() return ({filter.test()})[2] end)
|
||||
editbox:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(80)
|
||||
-- editbox:SetNumeric(true)
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
local m, public, private = Aux.module'completion'
|
||||
|
||||
function public:complete()
|
||||
function public:complete_filter()
|
||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||
return
|
||||
end
|
||||
@@ -22,7 +22,7 @@ function public:complete()
|
||||
end
|
||||
end
|
||||
|
||||
function public.completor(options)
|
||||
function public.complete(options)
|
||||
return function(self)
|
||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user