editbox changes
This commit is contained in:
@@ -112,10 +112,10 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
|
||||
local value = aux.history.value(item_key)
|
||||
if auctionable then
|
||||
if aux_tooltip_value then
|
||||
if g.aux_tooltip_value then
|
||||
tooltip:AddLine('Value: '..(value and aux.money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
if aux_tooltip_daily then
|
||||
if g.aux_tooltip_daily then
|
||||
local market_value = aux.history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and aux.money.to_string2(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
|
||||
@@ -153,7 +153,7 @@ do
|
||||
text:SetPoint('BOTTOMRIGHT', -8, 0)
|
||||
local highlight = getglobal('DropDownList1Button'..i..'Highlight')
|
||||
highlight:ClearAllPoints()
|
||||
highlight:SetDrawLayer('OVERLAY')
|
||||
highlight:SetDrawLayer 'OVERLAY'
|
||||
highlight:SetHeight(14)
|
||||
highlight:SetPoint('LEFT', 5, 0)
|
||||
highlight:SetPoint('RIGHT', -3, 0)
|
||||
@@ -175,7 +175,7 @@ do
|
||||
text:SetShadowOffset(1, -1)
|
||||
local highlight = getglobal('DropDownList1Button'..i..'Highlight')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetDrawLayer('BACKGROUND')
|
||||
highlight:SetDrawLayer 'BACKGROUND'
|
||||
local check = getglobal('DropDownList1Button'..i..'Check')
|
||||
check:SetWidth(24)
|
||||
check:SetHeight(24)
|
||||
@@ -239,14 +239,14 @@ function public.button(parent, text_height)
|
||||
local highlight = button:CreateTexture(nil, 'HIGHLIGHT')
|
||||
highlight:SetAllPoints()
|
||||
highlight:SetTexture(1, 1, 1, .2)
|
||||
highlight:SetBlendMode('BLEND')
|
||||
highlight:SetBlendMode 'BLEND'
|
||||
button.highlight = highlight
|
||||
do
|
||||
local label = button:CreateFontString()
|
||||
label:SetFont(config.font, text_height)
|
||||
label:SetPoint('CENTER', 0, 0)
|
||||
label:SetJustifyH('CENTER')
|
||||
label:SetJustifyV('CENTER')
|
||||
label:SetJustifyH 'CENTER'
|
||||
label:SetJustifyV 'CENTER'
|
||||
label:SetHeight(text_height)
|
||||
label:SetTextColor(color.text.enabled())
|
||||
button:SetFontString(label)
|
||||
@@ -368,30 +368,48 @@ end
|
||||
function public.editbox(parent)
|
||||
local editbox = CreateFrame('EditBox', nil, parent)
|
||||
editbox:SetAutoFocus(false)
|
||||
editbox:SetTextInsets(1, 2, 3, 3)
|
||||
editbox:SetMaxLetters(256)
|
||||
editbox:SetTextInsets(1.5, 1.5, 3, 3)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetHeight(24)
|
||||
editbox:SetFont(config.font, config.medium_font_size)
|
||||
editbox:SetTextColor(0, 0, 0, 0)
|
||||
set_content_style(editbox)
|
||||
editbox:SetScript('OnEscapePressed', aux.C(editbox.ClearFocus, aux._this))
|
||||
local function colorize() this.display:SetText(call(this.colorizer, this:GetText()) or this:GetText()) end
|
||||
local function format() this.display:SetText(call(this.formatter or this.colorizer, this:GetText()) or this:GetText()) end
|
||||
editbox:SetScript('OnEscapePressed', function()
|
||||
this:ClearFocus()
|
||||
call(this.escape)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function() call(this.enter) end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this.last_change = GetTime()
|
||||
colorize()
|
||||
this.focused = true
|
||||
this:HighlightText()
|
||||
this:SetScript('OnUpdate', function()
|
||||
this.cursor:SetAlpha(mod(floor((GetTime()-this.last_change) * 2 + 1), 2))
|
||||
this.cursor:SetAlpha(mod(floor((GetTime()-this.cursor.last_change) * 2 + 1), 2))
|
||||
end)
|
||||
call(this.focus_gain)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
format()
|
||||
this.focused = false
|
||||
this.cursor:SetAlpha(0)
|
||||
this:HighlightText(0, 0)
|
||||
this:SetScript('OnUpdate', nil)
|
||||
call(this.focus_loss)
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
this.last_change = GetTime()
|
||||
this.text:SetText(call(this.formatter, this:GetText()) or this:GetText())
|
||||
this.cursor:SetPoint('LEFT', this.text, 'LEFT', max(0, this.text:GetStringWidth() - 2), 1)
|
||||
if this.focused then
|
||||
colorize()
|
||||
else
|
||||
format()
|
||||
end
|
||||
call(this.change)
|
||||
end)
|
||||
editbox:SetScript('OnCursorChanged', function()
|
||||
this.cursor.last_change = GetTime()
|
||||
this.cursor:SetPoint(this:GetJustifyH(), this, this:GetJustifyH(), call(arg1 > 0 and max or min, 0, arg1 - 1.5), 1.5)
|
||||
end)
|
||||
editbox:SetScript('OnChar', function() call(this.char) end)
|
||||
do
|
||||
local last_click
|
||||
editbox:SetScript('OnMouseDown', function()
|
||||
@@ -414,18 +432,26 @@ function public.editbox(parent)
|
||||
editbox:SetTextColor(color.text.disabled())
|
||||
editbox:ClearFocus()
|
||||
end
|
||||
local text = aux.gui.label(editbox, config.medium_font_size)
|
||||
text:SetPoint('LEFT', 1, 0)
|
||||
text:SetPoint('RIGHT', -2, 0)
|
||||
text:SetJustifyH 'LEFT'
|
||||
text:SetTextColor(color.text.enabled())
|
||||
editbox.text = text
|
||||
function editbox:SetAlignment(alignment)
|
||||
self:SetJustifyH(alignment)
|
||||
self.display:SetJustifyH(alignment)
|
||||
end
|
||||
function editbox:SetFontSize(size)
|
||||
self:SetFont(config.font, size)
|
||||
self.display:SetFont(config.font, size)
|
||||
end
|
||||
local display = aux.gui.label(editbox)
|
||||
display:SetPoint('LEFT', 1.5, 0)
|
||||
display:SetPoint('RIGHT', -1.5, 0)
|
||||
display:SetTextColor(color.text.enabled())
|
||||
editbox.display = display
|
||||
local cursor = aux.gui.label(editbox, config.large_font_size)
|
||||
cursor:SetJustifyH 'LEFT'
|
||||
cursor:SetText '|'
|
||||
cursor:SetTextColor(color.text.enabled())
|
||||
cursor:SetAlpha(0)
|
||||
editbox.cursor = cursor
|
||||
editbox:SetAlignment 'LEFT'
|
||||
editbox:SetFontSize(config.medium_font_size)
|
||||
return editbox
|
||||
end
|
||||
|
||||
@@ -512,7 +538,7 @@ function public.item(parent)
|
||||
item.texture = getglobal(btn:GetName()..'Icon')
|
||||
item.texture:SetTexCoord(.06, .94, .06, .94)
|
||||
item.name = aux.gui.label(btn, 15)
|
||||
item.name:SetJustifyH('LEFT')
|
||||
item.name:SetJustifyH 'LEFT'
|
||||
item.name:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
||||
item.name:SetPoint('RIGHT', item, 'RIGHT', -10, .5)
|
||||
item.count = getglobal(btn:GetName()..'Count')
|
||||
@@ -591,6 +617,7 @@ function public.slider(parent)
|
||||
thumb_texture:SetTexture(color.content.background())
|
||||
thumb_texture:SetHeight(18)
|
||||
thumb_texture:SetWidth(8)
|
||||
set_size(thumb_texture, 8, 18)
|
||||
slider:SetThumbTexture(thumb_texture)
|
||||
|
||||
local label = slider:CreateFontString(nil, 'OVERLAY')
|
||||
@@ -603,10 +630,9 @@ function public.slider(parent)
|
||||
|
||||
local editbox = editbox(slider)
|
||||
editbox:SetPoint('LEFT', slider, 'RIGHT', 5, 0)
|
||||
editbox:SetWidth(45)
|
||||
editbox:SetHeight(18)
|
||||
editbox:SetJustifyH 'CENTER'
|
||||
editbox:SetFont(config.font, 17)
|
||||
set_size(editbox, 45, 18)
|
||||
editbox:SetAlignment 'CENTER'
|
||||
editbox:SetFontSize(17)
|
||||
|
||||
slider.label = label
|
||||
slider.editbox = editbox
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ local tinsert, setfenv, rawget, rawset, setmetatable, mask, g = tinsert, setfenv
|
||||
local DECLARED, ACCESSOR, MUTABLE, PUBLIC = 1, 2, 4, 8
|
||||
local ACCESSOR_KEY, MUTABLE_KEY, PUBLIC_KEY = 'accessor', 'mutable', 'public'
|
||||
local PROPERTY = {[ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=MUTABLE, [PUBLIC_KEY]=PUBLIC}
|
||||
local _data, _metadata, _modifier_properties, _imports, _interfaces = {}, {}, {}, {}, {}
|
||||
local _data, _metadata, _modifier_properties, _imports, _envs, _interfaces = {}, {}, {}, {}, {}, {}
|
||||
local metadata_mt = {
|
||||
__index=function() return 0 end,
|
||||
__newindex=function(self, key, value)
|
||||
@@ -83,7 +83,7 @@ function g.aux_module(name)
|
||||
metadata = setmetatable({g=DECLARED, m=DECLARED, import=DECLARED, [ACCESSOR_KEY]=ACCESSOR, [MUTABLE_KEY]=ACCESSOR, [PUBLIC_KEY]=ACCESSOR}, metadata_mt)
|
||||
imports = {}
|
||||
|
||||
_interfaces[name] = interface
|
||||
_envs[name], _interfaces[name] = env, interface
|
||||
_data[modifier], _data[env], _data[interface] = data, data, data
|
||||
_metadata[modifier], _metadata[env], _metadata[interface] = metadata, metadata, metadata
|
||||
_imports[importer], _imports[env] = imports, imports
|
||||
|
||||
+33
-32
@@ -130,7 +130,7 @@ function create_frames()
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
quantity_update(true)
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider.editbox.change = function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
quantity_update(true)
|
||||
if selected_item then
|
||||
@@ -138,7 +138,7 @@ function create_frames()
|
||||
settings.stack_size = this:GetNumber()
|
||||
write_settings(settings)
|
||||
end
|
||||
end)
|
||||
end
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
unit_buyout_price:SetFocus()
|
||||
@@ -150,7 +150,7 @@ function create_frames()
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.editbox:SetMaxLetters(3)
|
||||
slider.label:SetText('Stack Size')
|
||||
slider.label:SetText 'Stack Size'
|
||||
stack_size_slider = slider
|
||||
end
|
||||
do
|
||||
@@ -161,10 +161,10 @@ function create_frames()
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
quantity_update()
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider.editbox.change = function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
quantity_update()
|
||||
end)
|
||||
end
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
stack_size_slider.editbox:SetFocus()
|
||||
@@ -173,7 +173,7 @@ function create_frames()
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.label:SetText('Stack Count')
|
||||
slider.label:SetText 'Stack Count'
|
||||
stack_count_slider = slider
|
||||
end
|
||||
do
|
||||
@@ -207,6 +207,10 @@ function create_frames()
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText 'Hide this item'
|
||||
hide_checkbox = checkbox
|
||||
end
|
||||
local function money_input()
|
||||
|
||||
|
||||
end
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, frame.parameters)
|
||||
@@ -217,12 +221,8 @@ function create_frames()
|
||||
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(get_unit_start_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end)
|
||||
editbox:SetAlignment 'RIGHT'
|
||||
editbox:SetFontSize(17)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() and stack_count_slider.editbox:IsVisible() then
|
||||
stack_count_slider.editbox:SetFocus()
|
||||
@@ -232,22 +232,26 @@ function create_frames()
|
||||
unit_buyout_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
editbox.change = function()
|
||||
this.pretty:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
editbox.focus_gain = function()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
end
|
||||
editbox.focus_loss = function()
|
||||
this:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
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'
|
||||
editbox.pretty:SetTextColor(unpack(aux.gui.color.text.enabled))
|
||||
editbox.pretty:SetTextColor(aux.gui.color.text.enabled())
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
@@ -271,12 +275,8 @@ function create_frames()
|
||||
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(get_unit_buyout_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end)
|
||||
editbox:SetAlignment 'RIGHT'
|
||||
editbox:SetFontSize(17)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
unit_start_price:SetFocus()
|
||||
@@ -284,19 +284,20 @@ function create_frames()
|
||||
stack_size_slider.editbox:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
editbox.change = function()
|
||||
this.pretty:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3))
|
||||
refresh = true
|
||||
end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
editbox.focus_gain = function()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
end
|
||||
editbox.focus_loss = function()
|
||||
this:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
end
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
|
||||
+40
-40
@@ -13,7 +13,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
button1 = 'Yes',
|
||||
button2 = 'No',
|
||||
OnAccept = function()
|
||||
m.auto_buy_button:SetChecked(true)
|
||||
auto_buy_button:SetChecked(true)
|
||||
end,
|
||||
timeout = 0,
|
||||
hideOnEscape = 1,
|
||||
@@ -21,7 +21,7 @@ StaticPopupDialogs['AUX_SEARCH_AUTO_BUY'] = {
|
||||
do
|
||||
local function action()
|
||||
g.aux_auto_buy_filter = getglobal(this:GetParent():GetName()..'EditBox'):GetText()
|
||||
m.update_auto_buy_filter()
|
||||
update_auto_buy_filter()
|
||||
end
|
||||
|
||||
StaticPopupDialogs['AUX_SEARCH_AUTO_BUY_FILTER'] = {
|
||||
@@ -50,69 +50,69 @@ end
|
||||
|
||||
RESULTS, SAVED, FILTER = 1, 2, 3
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames()
|
||||
m.update_tab(m.SAVED)
|
||||
m.update_auto_buy_filter()
|
||||
m.new_search ''
|
||||
m.current_search().placeholder = true
|
||||
function LOAD()
|
||||
create_frames()
|
||||
set_tab(SAVED)
|
||||
update_auto_buy_filter()
|
||||
new_search ''
|
||||
current_search.placeholder = true
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
m.update_search_listings()
|
||||
function OPEN()
|
||||
frame:Show()
|
||||
update_search_listings()
|
||||
end
|
||||
|
||||
function m.CLOSE()
|
||||
m.close_settings()
|
||||
m.current_search().table:SetSelectedRecord()
|
||||
m.frame:Hide()
|
||||
function CLOSE()
|
||||
close_settings()
|
||||
current_search.table:SetSelectedRecord()
|
||||
frame:Hide()
|
||||
end
|
||||
|
||||
function m.CLICK_LINK(item_info)
|
||||
m.set_filter(strlower(item_info.name)..'/exact')
|
||||
m.execute(nil, false)
|
||||
function CLICK_LINK(item_info)
|
||||
set_filter(strlower(item_info.name)..'/exact')
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function m.USE_ITEM(item_info)
|
||||
m.set_filter(strlower(item_info.name)..'/exact')
|
||||
m.execute(nil, false)
|
||||
function USE_ITEM(item_info)
|
||||
set_filter(strlower(item_info.name)..'/exact')
|
||||
execute(nil, false)
|
||||
end
|
||||
|
||||
function update_tab(tab)
|
||||
function set_tab(tab)
|
||||
|
||||
m.search_results_button:UnlockHighlight()
|
||||
m.saved_searches_button:UnlockHighlight()
|
||||
m.new_filter_button:UnlockHighlight()
|
||||
m.frame.results:Hide()
|
||||
m.frame.saved:Hide()
|
||||
m.frame.filter:Hide()
|
||||
search_results_button:UnlockHighlight()
|
||||
saved_searches_button:UnlockHighlight()
|
||||
new_filter_button:UnlockHighlight()
|
||||
frame.results:Hide()
|
||||
frame.saved:Hide()
|
||||
frame.filter:Hide()
|
||||
|
||||
if tab == m.RESULTS then
|
||||
m.frame.results:Show()
|
||||
m.search_results_button:LockHighlight()
|
||||
elseif tab == m.SAVED then
|
||||
m.frame.saved:Show()
|
||||
m.saved_searches_button:LockHighlight()
|
||||
elseif tab == m.FILTER then
|
||||
m.frame.filter:Show()
|
||||
m.new_filter_button:LockHighlight()
|
||||
if tab == RESULTS then
|
||||
frame.results:Show()
|
||||
search_results_button:LockHighlight()
|
||||
elseif tab == SAVED then
|
||||
frame.saved:Show()
|
||||
saved_searches_button:LockHighlight()
|
||||
elseif tab == FILTER then
|
||||
frame.filter:Show()
|
||||
new_filter_button:LockHighlight()
|
||||
end
|
||||
end
|
||||
|
||||
function public.set_filter(filter_string)
|
||||
m.search_box:SetText(filter_string)
|
||||
search_box:SetText(filter_string)
|
||||
end
|
||||
|
||||
function public.add_filter(filter_string)
|
||||
local old_filter_string = m.search_box:GetText()
|
||||
local old_filter_string = search_box:GetText()
|
||||
old_filter_string = trim(old_filter_string)
|
||||
|
||||
if old_filter_string ~= '' then
|
||||
old_filter_string = old_filter_string..';'
|
||||
end
|
||||
|
||||
m.search_box:SetText(old_filter_string..filter_string)
|
||||
search_box:SetText(old_filter_string..filter_string)
|
||||
end
|
||||
|
||||
function blizzard_page_index(str)
|
||||
|
||||
+126
-126
@@ -8,94 +8,94 @@ end
|
||||
blizzard_query = setmetatable({}, {
|
||||
__newindex = function(_, key, value)
|
||||
if key == 'name' then
|
||||
m.name_input:SetText(value)
|
||||
name_input:SetText(value)
|
||||
elseif key == 'exact' then
|
||||
m.exact_checkbox:SetChecked(value)
|
||||
exact_checkbox:SetChecked(value)
|
||||
elseif key == 'min_level' then
|
||||
m.min_level_input:SetText(value)
|
||||
min_level_input:SetText(value)
|
||||
elseif key == 'max_level' then
|
||||
m.max_level_input:SetText(value)
|
||||
max_level_input:SetText(value)
|
||||
elseif key == 'usable' then
|
||||
m.usable_checkbox:SetChecked(value)
|
||||
usable_checkbox:SetChecked(value)
|
||||
elseif key == 'class' then
|
||||
UIDropDownMenu_Initialize(m.class_dropdown, m.initialize_class_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(m.class_dropdown, value)
|
||||
UIDropDownMenu_Initialize(class_dropdown, initialize_class_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(class_dropdown, value)
|
||||
elseif key == 'subclass' then
|
||||
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, value)
|
||||
UIDropDownMenu_Initialize(subclass_dropdown, initialize_subclass_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(subclass_dropdown, value)
|
||||
elseif key == 'slot' then
|
||||
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, value)
|
||||
UIDropDownMenu_Initialize(slot_dropdown, initialize_slot_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(slot_dropdown, value)
|
||||
elseif key == 'quality' then
|
||||
UIDropDownMenu_Initialize(m.quality_dropdown, m.initialize_quality_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, value)
|
||||
UIDropDownMenu_Initialize(quality_dropdown, initialize_quality_dropdown)
|
||||
UIDropDownMenu_SetSelectedValue(quality_dropdown, value)
|
||||
end
|
||||
end,
|
||||
__index = function(_, key)
|
||||
if key == 'name' then
|
||||
return m.name_input:GetText()
|
||||
return name_input:GetText()
|
||||
elseif key == 'exact' then
|
||||
return m.exact_checkbox:GetChecked()
|
||||
return exact_checkbox:GetChecked()
|
||||
elseif key == 'min_level' then
|
||||
return tonumber(m.min_level_input:GetText())
|
||||
return tonumber(min_level_input:GetText())
|
||||
elseif key == 'max_level' then
|
||||
return tonumber(m.max_level_input:GetText())
|
||||
return tonumber(max_level_input:GetText())
|
||||
elseif key == 'usable' then
|
||||
return m.usable_checkbox:GetChecked()
|
||||
return usable_checkbox:GetChecked()
|
||||
elseif key == 'class' then
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
return (class_index or 0) > 0 and class_index or nil
|
||||
elseif key == 'subclass' then
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(subclass_dropdown)
|
||||
return (subclass_index or 0) > 0 and subclass_index or nil
|
||||
elseif key == 'slot' then
|
||||
local slot_token = UIDropDownMenu_GetSelectedValue(m.slot_dropdown)
|
||||
local slot_token = UIDropDownMenu_GetSelectedValue(slot_dropdown)
|
||||
return slot_token ~= '' and slot_token or nil
|
||||
elseif key == 'quality' then
|
||||
local quality_code = UIDropDownMenu_GetSelectedValue(m.quality_dropdown)
|
||||
local quality_code = UIDropDownMenu_GetSelectedValue(quality_dropdown)
|
||||
return (quality_code or -1) >= 0 and quality_code or nil
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function update_form()
|
||||
if m.blizzard_query.class and GetAuctionItemSubClasses(m.blizzard_query.class) then
|
||||
m.subclass_dropdown.button:Enable()
|
||||
if blizzard_query.class and GetAuctionItemSubClasses(blizzard_query.class) then
|
||||
subclass_dropdown.button:Enable()
|
||||
else
|
||||
m.subclass_dropdown.button:Disable()
|
||||
subclass_dropdown.button:Disable()
|
||||
end
|
||||
|
||||
if m.blizzard_query.subclass and GetAuctionInvTypes(m.blizzard_query.class, m.blizzard_query.subclass) then
|
||||
m.slot_dropdown.button:Enable()
|
||||
if blizzard_query.subclass and GetAuctionInvTypes(blizzard_query.class, blizzard_query.subclass) then
|
||||
slot_dropdown.button:Enable()
|
||||
else
|
||||
m.slot_dropdown.button:Disable()
|
||||
slot_dropdown.button:Disable()
|
||||
end
|
||||
|
||||
if m.blizzard_query.exact then
|
||||
if blizzard_query.exact then
|
||||
for _, key in {'class', 'subclass', 'slot', 'quality'} do
|
||||
m[key..'_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
m.class_dropdown.button:Enable()
|
||||
m.quality_dropdown.button:Enable()
|
||||
class_dropdown.button:Enable()
|
||||
quality_dropdown.button:Enable()
|
||||
end
|
||||
for _, key in {'min_level', 'max_level'} do
|
||||
if m.blizzard_query.exact then
|
||||
if blizzard_query.exact then
|
||||
m[key..'_input']:Disable()
|
||||
else
|
||||
m[key..'_input']:Enable()
|
||||
end
|
||||
end
|
||||
if m.blizzard_query.exact then
|
||||
m.usable_checkbox:Disable()
|
||||
if blizzard_query.exact then
|
||||
usable_checkbox:Disable()
|
||||
else
|
||||
m.usable_checkbox:Enable()
|
||||
usable_checkbox:Enable()
|
||||
end
|
||||
|
||||
if any({'min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'}, function(key) return m.blizzard_query[key] end) then
|
||||
m.exact_checkbox:Disable()
|
||||
if any({'min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'}, function(key) return blizzard_query[key] end) then
|
||||
exact_checkbox:Disable()
|
||||
else
|
||||
m.exact_checkbox:Enable()
|
||||
exact_checkbox:Enable()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,80 +108,80 @@ function get_filter_builder_query()
|
||||
end
|
||||
end
|
||||
|
||||
local name = m.blizzard_query.name
|
||||
local name = blizzard_query.name
|
||||
if not index(aux.filter.parse_query_string(name), 'blizzard', 'name') then
|
||||
name = aux.filter.quote(name)
|
||||
end
|
||||
add((name ~= '' or m.blizzard_query.exact) and name)
|
||||
add((name ~= '' or blizzard_query.exact) and name)
|
||||
|
||||
add(m.blizzard_query.exact and 'exact')
|
||||
add(m.blizzard_query.min_level or m.blizzard_query.max_level and 1)
|
||||
add(m.blizzard_query.max_level)
|
||||
add(m.blizzard_query.usable and 'usable')
|
||||
add(blizzard_query.exact and 'exact')
|
||||
add(blizzard_query.min_level or blizzard_query.max_level and 1)
|
||||
add(blizzard_query.max_level)
|
||||
add(blizzard_query.usable and 'usable')
|
||||
|
||||
for _, class in {m.blizzard_query.class} do
|
||||
for _, class in {blizzard_query.class} do
|
||||
local classes = {GetAuctionItemClasses()}
|
||||
add(strlower(classes[class]))
|
||||
for _, subclass in {m.blizzard_query.subclass} do
|
||||
for _, subclass in {blizzard_query.subclass} do
|
||||
local subclasses = {GetAuctionItemSubClasses(class)}
|
||||
add(strlower(subclasses[subclass]))
|
||||
add(m.blizzard_query.slot and strlower(getglobal(m.blizzard_query.slot)))
|
||||
add(blizzard_query.slot and strlower(getglobal(blizzard_query.slot)))
|
||||
end
|
||||
end
|
||||
|
||||
local quality = m.blizzard_query.quality
|
||||
local quality = blizzard_query.quality
|
||||
if quality and quality >= 0 then
|
||||
add(strlower(getglobal('ITEM_QUALITY'..quality..'_DESC')))
|
||||
end
|
||||
|
||||
local post_filter_string = aux.filter.query_string{blizzard={}, post=m.post_filter}
|
||||
local post_filter_string = aux.filter.query_string{blizzard={}, post=post_filter}
|
||||
add(post_filter_string ~= '' and post_filter_string)
|
||||
|
||||
return query_string or ''
|
||||
end
|
||||
|
||||
function set_form(components)
|
||||
m.clear_form()
|
||||
clear_form()
|
||||
for key, filter in components.blizzard do
|
||||
m.blizzard_query[key] = filter[2]
|
||||
blizzard_query[key] = filter[2]
|
||||
end
|
||||
for _, component in components.post do
|
||||
m.add_component(component)
|
||||
add_component(component)
|
||||
end
|
||||
m.update_filter_display()
|
||||
update_filter_display()
|
||||
end
|
||||
|
||||
function clear_form()
|
||||
m.blizzard_query.name = ''
|
||||
m.name_input:ClearFocus()
|
||||
m.blizzard_query.exact = false
|
||||
m.blizzard_query.min_level = ''
|
||||
m.min_level_input:ClearFocus()
|
||||
m.blizzard_query.max_level = ''
|
||||
m.max_level_input:ClearFocus()
|
||||
m.blizzard_query.usable = false
|
||||
UIDropDownMenu_ClearAll(m.class_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.subclass_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.slot_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.quality_dropdown)
|
||||
m.filter_parameter_input:ClearFocus()
|
||||
m.post_filter = {}
|
||||
m.filter_builder_state = {selected=0}
|
||||
m.update_filter_display()
|
||||
blizzard_query.name = ''
|
||||
name_input:ClearFocus()
|
||||
blizzard_query.exact = false
|
||||
blizzard_query.min_level = ''
|
||||
min_level_input:ClearFocus()
|
||||
blizzard_query.max_level = ''
|
||||
max_level_input:ClearFocus()
|
||||
blizzard_query.usable = false
|
||||
UIDropDownMenu_ClearAll(class_dropdown)
|
||||
UIDropDownMenu_ClearAll(subclass_dropdown)
|
||||
UIDropDownMenu_ClearAll(slot_dropdown)
|
||||
UIDropDownMenu_ClearAll(quality_dropdown)
|
||||
filter_parameter_input:ClearFocus()
|
||||
post_filter = {}
|
||||
filter_builder_state = {selected=0}
|
||||
update_filter_display()
|
||||
end
|
||||
|
||||
function import_query_string()
|
||||
local components, error = aux.filter.parse_query_string(select(3, strfind(m.search_box:GetText(), '^([^;]*)')))
|
||||
local components, error = aux.filter.parse_query_string(select(3, strfind(search_box:GetText(), '^([^;]*)')))
|
||||
if components then
|
||||
m.set_form(components)
|
||||
set_form(components)
|
||||
else
|
||||
log(error)
|
||||
end
|
||||
end
|
||||
|
||||
function export_query_string()
|
||||
m.search_box:SetText(m.get_filter_builder_query())
|
||||
m.filter_parameter_input:ClearFocus()
|
||||
search_box:SetText(get_filter_builder_query())
|
||||
filter_parameter_input:ClearFocus()
|
||||
end
|
||||
|
||||
function public.formatted_post_filter(components)
|
||||
@@ -200,7 +200,7 @@ function public.formatted_post_filter(components)
|
||||
end
|
||||
no_line_break = component[1] == 'operator' and component[2] == 'not'
|
||||
|
||||
local filter_color = (m.filter_builder_state.selected == i and aux.gui.color.orange or aux.gui.color.aux)
|
||||
local filter_color = (filter_builder_state.selected == i and aux.gui.color.orange or aux.gui.color.aux)
|
||||
local component_text = filter_color(component[2])
|
||||
if component[1] == 'operator' and component[2] ~= 'not' then
|
||||
component_text = component_text..filter_color(tonumber(component[3]) or '')
|
||||
@@ -222,7 +222,7 @@ function public.formatted_post_filter(components)
|
||||
end
|
||||
end
|
||||
end
|
||||
str = str..m.data_link(i, component_text)
|
||||
str = str..data_link(i, component_text)
|
||||
end
|
||||
|
||||
return '<html><body><p>'..str..'</p></body></html>'
|
||||
@@ -239,43 +239,43 @@ function data_link_click()
|
||||
local button = arg3
|
||||
local index = tonumber(arg1)
|
||||
if button == 'LeftButton' then
|
||||
m.filter_builder_state.selected = index
|
||||
filter_builder_state.selected = index
|
||||
elseif button == 'RightButton' then
|
||||
m.remove_component(index)
|
||||
remove_component(index)
|
||||
end
|
||||
m.update_filter_display()
|
||||
update_filter_display()
|
||||
end
|
||||
|
||||
function remove_component(index)
|
||||
index = index or m.filter_builder_state.selected
|
||||
if m.filter_builder_state.selected >= index then
|
||||
m.filter_builder_state.selected = max(m.filter_builder_state.selected - 1, min(1, getn(m.post_filter)))
|
||||
index = index or filter_builder_state.selected
|
||||
if filter_builder_state.selected >= index then
|
||||
filter_builder_state.selected = max(filter_builder_state.selected - 1, min(1, getn(post_filter)))
|
||||
end
|
||||
m.filter_builder_state[m.post_filter[index]] = nil
|
||||
tremove(m.post_filter, index)
|
||||
filter_builder_state[post_filter[index]] = nil
|
||||
tremove(post_filter, index)
|
||||
end
|
||||
|
||||
function add_component(component)
|
||||
m.filter_builder_state.selected = m.filter_builder_state.selected + 1
|
||||
tinsert(m.post_filter, m.filter_builder_state.selected, component)
|
||||
filter_builder_state.selected = filter_builder_state.selected + 1
|
||||
tinsert(post_filter, filter_builder_state.selected, component)
|
||||
end
|
||||
|
||||
function add_post_filter()
|
||||
for str in present(m.filter_input:GetText()) do
|
||||
for str in present(filter_input:GetText()) do
|
||||
for filter in present(aux.filter.filters[str]) do
|
||||
if filter.input_type ~= '' then
|
||||
str = str..'/'..m.filter_parameter_input:GetText()
|
||||
str = str..'/'..filter_parameter_input:GetText()
|
||||
end
|
||||
end
|
||||
|
||||
local components, error, suggestions = aux.filter.parse_query_string(str)
|
||||
|
||||
if components and getn(components.blizzard) == 0 and getn(components.post) == 1 then
|
||||
m.add_component(components.post[1])
|
||||
m.update_filter_display()
|
||||
m.filter_parameter_input:SetText('')
|
||||
m.filter_input:HighlightText()
|
||||
m.filter_input:SetFocus()
|
||||
add_component(components.post[1])
|
||||
update_filter_display()
|
||||
filter_parameter_input:SetText('')
|
||||
filter_input:HighlightText()
|
||||
filter_input:SetFocus()
|
||||
elseif error then
|
||||
log(error)
|
||||
end
|
||||
@@ -286,30 +286,30 @@ do
|
||||
local text = ''
|
||||
|
||||
function update_filter_display()
|
||||
text = m.formatted_post_filter(m.post_filter)
|
||||
m.filter_display:SetWidth(m.filter_display_size())
|
||||
m.set_filter_display_offset()
|
||||
m.filter_display:SetText(text)
|
||||
text = formatted_post_filter(post_filter)
|
||||
filter_display:SetWidth(filter_display_size())
|
||||
set_filter_display_offset()
|
||||
filter_display:SetText(text)
|
||||
end
|
||||
|
||||
function filter_display_size()
|
||||
local font, font_size = m.filter_display:GetFont()
|
||||
m.filter_display.measure:SetFont(font, font_size)
|
||||
local font, font_size = filter_display:GetFont()
|
||||
filter_display.measure:SetFont(font, font_size)
|
||||
local lines = 0
|
||||
local width = 0
|
||||
for line in string.gfind(text, '<p>(.-)</p>') do
|
||||
lines = lines + 1
|
||||
m.filter_display.measure:SetText(line)
|
||||
width = max(width, m.filter_display.measure:GetStringWidth())
|
||||
filter_display.measure:SetText(line)
|
||||
width = max(width, filter_display.measure:GetStringWidth())
|
||||
end
|
||||
return width, lines * (font_size + .5)
|
||||
end
|
||||
end
|
||||
|
||||
function set_filter_display_offset(x_offset, y_offset)
|
||||
local scroll_frame = m.filter_display:GetParent()
|
||||
local scroll_frame = filter_display:GetParent()
|
||||
x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
|
||||
local width, height = m.filter_display_size()
|
||||
local width, height = filter_display_size()
|
||||
local x_lower_bound = min(0, scroll_frame:GetWidth() - width - 10)
|
||||
local x_upper_bound = 0
|
||||
local y_lower_bound = 0
|
||||
@@ -324,14 +324,14 @@ function initialize_filter_dropdown()
|
||||
text = filter,
|
||||
value = filter,
|
||||
func = function()
|
||||
m.filter_input:SetText(this.value)
|
||||
filter_input:SetText(this.value)
|
||||
if index(aux.filter.filters[this.value], 'input_type') == '' or this.value == 'not' then
|
||||
m.add_post_filter()
|
||||
add_post_filter()
|
||||
elseif aux.filter.filters[this.value] then
|
||||
m.filter_parameter_input:Show()
|
||||
m.filter_parameter_input:SetFocus()
|
||||
filter_parameter_input:Show()
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
m.filter_input:SetFocus()
|
||||
filter_input:SetFocus()
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -340,13 +340,13 @@ end
|
||||
|
||||
function initialize_class_dropdown()
|
||||
local function on_click()
|
||||
if this.value ~= m.blizzard_query.class then
|
||||
UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value)
|
||||
UIDropDownMenu_ClearAll(m.subclass_dropdown)
|
||||
UIDropDownMenu_Initialize(m.subclass_dropdown, m.initialize_subclass_dropdown)
|
||||
UIDropDownMenu_ClearAll(m.slot_dropdown)
|
||||
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
|
||||
m.update_form()
|
||||
if this.value ~= blizzard_query.class then
|
||||
UIDropDownMenu_SetSelectedValue(class_dropdown, this.value)
|
||||
UIDropDownMenu_ClearAll(subclass_dropdown)
|
||||
UIDropDownMenu_Initialize(subclass_dropdown, initialize_subclass_dropdown)
|
||||
UIDropDownMenu_ClearAll(slot_dropdown)
|
||||
UIDropDownMenu_Initialize(slot_dropdown, initialize_slot_dropdown)
|
||||
update_form()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -367,15 +367,15 @@ end
|
||||
|
||||
function initialize_subclass_dropdown()
|
||||
local function on_click()
|
||||
if this.value ~= m.blizzard_query.subclass then
|
||||
UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value)
|
||||
UIDropDownMenu_ClearAll(m.slot_dropdown)
|
||||
UIDropDownMenu_Initialize(m.slot_dropdown, m.initialize_slot_dropdown)
|
||||
m.update_form()
|
||||
if this.value ~= blizzard_query.subclass then
|
||||
UIDropDownMenu_SetSelectedValue(subclass_dropdown, this.value)
|
||||
UIDropDownMenu_ClearAll(slot_dropdown)
|
||||
UIDropDownMenu_Initialize(slot_dropdown, initialize_slot_dropdown)
|
||||
update_form()
|
||||
end
|
||||
end
|
||||
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
|
||||
if class_index and GetAuctionItemSubClasses(class_index) then
|
||||
UIDropDownMenu_AddButton{
|
||||
@@ -396,12 +396,12 @@ end
|
||||
|
||||
function initialize_slot_dropdown()
|
||||
local function on_click()
|
||||
UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value)
|
||||
m.update_form()
|
||||
UIDropDownMenu_SetSelectedValue(slot_dropdown, this.value)
|
||||
update_form()
|
||||
end
|
||||
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(m.class_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(m.subclass_dropdown)
|
||||
local class_index = UIDropDownMenu_GetSelectedValue(class_dropdown)
|
||||
local subclass_index = UIDropDownMenu_GetSelectedValue(subclass_dropdown)
|
||||
|
||||
if subclass_index and GetAuctionInvTypes(class_index, subclass_index) then
|
||||
UIDropDownMenu_AddButton{
|
||||
@@ -422,8 +422,8 @@ end
|
||||
|
||||
function initialize_quality_dropdown()
|
||||
local function on_click()
|
||||
UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value)
|
||||
m.update_form()
|
||||
UIDropDownMenu_SetSelectedValue(quality_dropdown, this.value)
|
||||
update_form()
|
||||
end
|
||||
|
||||
UIDropDownMenu_AddButton{
|
||||
|
||||
+85
-115
@@ -69,66 +69,46 @@ function create_frames()
|
||||
controls = panel
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', 75, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
last_page_input:SetFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
execute()
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
local page = tonumber(this:GetText())
|
||||
local valid_input = page and tostring(max(1, page)) or ''
|
||||
if this:GetText() ~= valid_input then
|
||||
this:SetText(valid_input)
|
||||
end
|
||||
if blizzard_page_index(this:GetText()) and not 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))
|
||||
first_page_input = editbox
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
first_page_input:SetFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
execute()
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
local page = tonumber(this:GetText())
|
||||
local valid_input = page and tostring(max(1, page)) or ''
|
||||
if this:GetText() ~= valid_input then
|
||||
this:SetText(valid_input)
|
||||
end
|
||||
if blizzard_page_index(this:GetText()) and not 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))
|
||||
last_page_input = editbox
|
||||
local function change()
|
||||
local page = tonumber(this:GetText())
|
||||
local valid_input = page and tostring(max(1, page)) or ''
|
||||
if this:GetText() ~= valid_input then
|
||||
this:SetText(valid_input)
|
||||
end
|
||||
if blizzard_page_index(this:GetText()) and not real_time_button:GetChecked() then
|
||||
this:SetBackdropColor(aux.gui.color.state.enabled())
|
||||
else
|
||||
this:SetBackdropColor(aux.gui.color.state.disabled())
|
||||
end
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', 75, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
|
||||
editbox.enter = execute
|
||||
editbox.change = change
|
||||
local label = aux.gui.label(editbox, 16)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0)
|
||||
label:SetText('Pages')
|
||||
label:SetTextColor(aux.gui.color.text.enabled())
|
||||
first_page_input = editbox
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(settings)
|
||||
editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 10, 0)
|
||||
editbox:SetWidth(50)
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
|
||||
editbox.enter = execute
|
||||
editbox.change = change
|
||||
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0)
|
||||
label:SetText('-')
|
||||
label:SetTextColor(aux.gui.color.text.enabled())
|
||||
last_page_input = editbox
|
||||
end
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.checkbutton(settings)
|
||||
@@ -138,9 +118,9 @@ function create_frames()
|
||||
btn:SetText('Real Time Mode')
|
||||
btn:SetScript('OnClick', function()
|
||||
this:SetChecked(not this:GetChecked())
|
||||
this = first_page_input
|
||||
g.this = first_page_input
|
||||
first_page_input:GetScript('OnTextChanged')()
|
||||
this = last_page_input
|
||||
g.this = last_page_input
|
||||
last_page_input:GetScript('OnTextChanged')()
|
||||
end)
|
||||
public.real_time_button = btn
|
||||
@@ -215,7 +195,7 @@ function create_frames()
|
||||
btn:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
|
||||
btn:SetScript('OnClick', function()
|
||||
if arg1 == 'RightButton' then
|
||||
set_filter(current_search().filter_string)
|
||||
set_filter(current_search.filter_string)
|
||||
end
|
||||
execute()
|
||||
end)
|
||||
@@ -245,18 +225,17 @@ function create_frames()
|
||||
end
|
||||
do
|
||||
local editbox = aux.gui.editbox(controls)
|
||||
editbox:SetMaxLetters(nil)
|
||||
editbox:EnableMouse(1)
|
||||
editbox.complete = aux.completion.complete_filter
|
||||
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||
editbox:SetHeight(25)
|
||||
editbox:SetScript('OnChar', function()
|
||||
editbox.char = function()
|
||||
this:complete()
|
||||
end)
|
||||
end
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
this:HighlightText(0, 0)
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', execute)
|
||||
editbox.enter = execute
|
||||
search_box = editbox
|
||||
end
|
||||
do
|
||||
@@ -267,8 +246,8 @@ function create_frames()
|
||||
btn:SetPoint('BOTTOMLEFT', aux.frame.content, 'TOPLEFT', 10, 8)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText('Search Results')
|
||||
btn:SetScript('OnClick', function() update_tab(RESULTS) end)
|
||||
btn:SetText 'Search Results'
|
||||
btn:SetScript('OnClick', function() set_tab(RESULTS) end)
|
||||
search_results_button = btn
|
||||
end
|
||||
do
|
||||
@@ -276,8 +255,8 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', search_results_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText('Saved Searches')
|
||||
btn:SetScript('OnClick', function() update_tab(SAVED) end)
|
||||
btn:SetText 'Saved Searches'
|
||||
btn:SetScript('OnClick', function() set_tab(SAVED) end)
|
||||
saved_searches_button = btn
|
||||
end
|
||||
do
|
||||
@@ -285,8 +264,8 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', saved_searches_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(243)
|
||||
btn:SetHeight(22)
|
||||
btn:SetText('Filter Builder')
|
||||
btn:SetScript('OnClick', function() update_tab(FILTER) end)
|
||||
btn:SetText 'Filter Builder'
|
||||
btn:SetScript('OnClick', function() set_tab(FILTER) end)
|
||||
new_filter_button = btn
|
||||
end
|
||||
do
|
||||
@@ -301,7 +280,7 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Bid')
|
||||
btn:SetText 'Bid'
|
||||
btn:Disable()
|
||||
bid_button = btn
|
||||
end
|
||||
@@ -310,7 +289,7 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Buyout')
|
||||
btn:SetText 'Buyout'
|
||||
btn:Disable()
|
||||
buyout_button = btn
|
||||
end
|
||||
@@ -319,10 +298,10 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Clear')
|
||||
btn:SetText 'Clear'
|
||||
btn:SetScript('OnClick', function()
|
||||
while tremove(current_search().records) do end
|
||||
current_search().table:SetDatabase()
|
||||
while tremove(current_search.records) do end
|
||||
current_search.table:SetDatabase()
|
||||
end)
|
||||
end
|
||||
do
|
||||
@@ -330,7 +309,7 @@ function create_frames()
|
||||
btn:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Favorite')
|
||||
btn:SetText 'Favorite'
|
||||
btn:SetScript('OnClick', function()
|
||||
local filters = aux.filter.queries(search_box:GetText())
|
||||
if filters then
|
||||
@@ -345,9 +324,8 @@ function create_frames()
|
||||
do
|
||||
local btn1 = aux.gui.button(frame.filter, 16)
|
||||
btn1:SetPoint('TOPLEFT', status_bar_frame, 'TOPRIGHT', 5, 0)
|
||||
btn1:SetWidth(80)
|
||||
btn1:SetHeight(24)
|
||||
btn1:SetText('Search')
|
||||
aux.gui.set_size(btn1, 80, 24)
|
||||
btn1:SetText 'Search'
|
||||
btn1:SetScript('OnClick', function()
|
||||
export_query_string()
|
||||
execute()
|
||||
@@ -355,16 +333,14 @@ function create_frames()
|
||||
|
||||
local btn2 = aux.gui.button(frame.filter, 16)
|
||||
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
|
||||
btn2:SetWidth(80)
|
||||
btn2:SetHeight(24)
|
||||
btn2:SetText('Export')
|
||||
aux.gui.set_size(btn2, 80, 24)
|
||||
btn2:SetText 'Export'
|
||||
btn2:SetScript('OnClick', export_query_string)
|
||||
|
||||
local btn3 = aux.gui.button(frame.filter, 16)
|
||||
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
|
||||
btn3:SetWidth(80)
|
||||
btn3:SetHeight(24)
|
||||
btn3:SetText('Import')
|
||||
aux.gui.set_size(btn3, 80, 24)
|
||||
btn3:SetText 'Import'
|
||||
btn3:SetScript('OnClick', import_query_string)
|
||||
end
|
||||
do
|
||||
@@ -372,11 +348,11 @@ function create_frames()
|
||||
editbox.complete_item = aux.completion.complete(function() return g.aux_auctionable_items end)
|
||||
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
|
||||
editbox:SetWidth(260)
|
||||
editbox:SetScript('OnChar', function()
|
||||
editbox.char = function()
|
||||
if blizzard_query.exact then
|
||||
this:complete_item()
|
||||
end
|
||||
end)
|
||||
end
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if blizzard_query.exact then
|
||||
return
|
||||
@@ -387,11 +363,11 @@ function create_frames()
|
||||
min_level_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnTextChanged', update_form)
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
editbox.change = update_form
|
||||
editbox.enter = aux.C(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')
|
||||
label:SetText 'Name'
|
||||
name_input = editbox
|
||||
end
|
||||
do
|
||||
@@ -415,17 +391,17 @@ function create_frames()
|
||||
max_level_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
editbox.enter = aux.C(editbox.ClearFocus, editbox)
|
||||
editbox.change = function()
|
||||
local valid_level = valid_level(this:GetText())
|
||||
if tostring(valid_level) ~= this:GetText() then
|
||||
this:SetText(valid_level or '')
|
||||
end
|
||||
update_form()
|
||||
end)
|
||||
end
|
||||
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Level Range')
|
||||
label:SetText 'Level Range'
|
||||
min_level_input = editbox
|
||||
end
|
||||
do
|
||||
@@ -440,14 +416,14 @@ function create_frames()
|
||||
name_input:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
editbox.enter = aux.C(editbox.ClearFocus, editbox)
|
||||
editbox.change = function()
|
||||
local valid_level = valid_level(this:GetText())
|
||||
if tostring(valid_level) ~= this:GetText() then
|
||||
this:SetText(valid_level or '')
|
||||
end
|
||||
update_form()
|
||||
end)
|
||||
end
|
||||
local label = aux.gui.label(editbox, aux.gui.config.medium_font_size)
|
||||
label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0)
|
||||
label:SetText('-')
|
||||
@@ -533,14 +509,10 @@ function create_frames()
|
||||
local input = aux.gui.editbox(frame.filter)
|
||||
input:SetPoint('CENTER', filter_dropdown, 'CENTER', 0, 0)
|
||||
input:SetWidth(150)
|
||||
input:SetScript('OnTabPressed', function()
|
||||
filter_parameter_input:SetFocus()
|
||||
end)
|
||||
input:SetScript('OnTabPressed', function() filter_parameter_input:SetFocus() end)
|
||||
input.complete = aux.completion.complete(function() return {'and', 'or', 'not', unpack(keys(aux.filter.filters))} end)
|
||||
input:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
end)
|
||||
input:SetScript('OnTextChanged', function()
|
||||
input.char = function() this:complete() end
|
||||
input.change = function()
|
||||
local filter = this:GetText()
|
||||
if aux.filter.filters[filter] and aux.filter.filters[filter].input_type ~= '' then
|
||||
local _, _, suggestions = aux.filter.parse_query_string(filter..'/')
|
||||
@@ -550,14 +522,14 @@ function create_frames()
|
||||
else
|
||||
filter_parameter_input:Hide()
|
||||
end
|
||||
end)
|
||||
input:SetScript('OnEnterPressed', function()
|
||||
end
|
||||
input.enter = function()
|
||||
if filter_parameter_input:IsVisible() then
|
||||
filter_parameter_input:SetFocus()
|
||||
else
|
||||
add_post_filter()
|
||||
end
|
||||
end)
|
||||
end
|
||||
filter_input = input
|
||||
end
|
||||
do
|
||||
@@ -567,10 +539,8 @@ function create_frames()
|
||||
input:SetScript('OnTabPressed', function()
|
||||
filter_input:SetFocus()
|
||||
end)
|
||||
input:SetScript('OnChar', function()
|
||||
this:complete()
|
||||
end)
|
||||
input:SetScript('OnEnterPressed', add_post_filter)
|
||||
input.char = function() this:complete() end
|
||||
input.enter = add_post_filter
|
||||
input:Hide()
|
||||
filter_parameter_input = input
|
||||
end
|
||||
@@ -628,7 +598,7 @@ function create_frames()
|
||||
|
||||
local table = aux.auction_listing.CreateAuctionResultsTable(frame.results, aux.auction_listing.search_config)
|
||||
table:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and current_search().table:GetSelection().record == cell.row.data.record then
|
||||
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and buyout_button:IsEnabled() then
|
||||
buyout_button:Click()
|
||||
elseif button == 'RightButton' and bid_button:IsEnabled() then
|
||||
|
||||
+96
-96
@@ -9,7 +9,7 @@ do
|
||||
local searches = {}
|
||||
local search_index = 1
|
||||
|
||||
function current_search()
|
||||
function accessor.current_search()
|
||||
return searches[search_index]
|
||||
end
|
||||
|
||||
@@ -23,21 +23,21 @@ do
|
||||
searches[search_index].status_bar:Show()
|
||||
searches[search_index].table:Show()
|
||||
|
||||
m.search_box:SetText(searches[search_index].filter_string)
|
||||
search_box:SetText(searches[search_index].filter_string)
|
||||
if search_index == 1 then
|
||||
m.previous_button:Disable()
|
||||
previous_button:Disable()
|
||||
else
|
||||
m.previous_button:Enable()
|
||||
previous_button:Enable()
|
||||
end
|
||||
if search_index == getn(searches) then
|
||||
m.next_button:Hide()
|
||||
m.search_box:SetPoint('LEFT', m.previous_button, 'RIGHT', 4, 0)
|
||||
next_button:Hide()
|
||||
search_box:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
|
||||
else
|
||||
m.next_button:Show()
|
||||
m.search_box:SetPoint('LEFT', m.next_button, 'RIGHT', 4, 0)
|
||||
next_button:Show()
|
||||
search_box:SetPoint('LEFT', next_button, 'RIGHT', 4, 0)
|
||||
end
|
||||
m.update_start_stop()
|
||||
m.update_continuation()
|
||||
update_start_stop()
|
||||
update_continuation()
|
||||
end
|
||||
|
||||
function new_search(filter_string)
|
||||
@@ -51,65 +51,65 @@ do
|
||||
tinsert(searches, search)
|
||||
if getn(searches) > 5 then
|
||||
tremove(searches, 1)
|
||||
tinsert(m.status_bars, tremove(m.status_bars, 1))
|
||||
tinsert(m.tables, tremove(m.tables, 1))
|
||||
tinsert(status_bars, tremove(status_bars, 1))
|
||||
tinsert(tables, tremove(tables, 1))
|
||||
search_index = 4
|
||||
end
|
||||
|
||||
search.status_bar = m.status_bars[getn(searches)]
|
||||
search.status_bar = status_bars[getn(searches)]
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text('')
|
||||
|
||||
search.table = m.tables[getn(searches)]
|
||||
search.table = tables[getn(searches)]
|
||||
search.table:SetSort(1,2,3,4,5,6,7,8,9)
|
||||
search.table:Reset()
|
||||
search.table:SetDatabase(search.records)
|
||||
|
||||
m.update_search(getn(searches))
|
||||
update_search(getn(searches))
|
||||
end
|
||||
|
||||
function previous_search()
|
||||
m.search_box:ClearFocus()
|
||||
m.update_search(search_index - 1)
|
||||
m.update_tab(m.RESULTS)
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index - 1)
|
||||
set_tab(RESULTS)
|
||||
end
|
||||
|
||||
function next_search()
|
||||
m.search_box:ClearFocus()
|
||||
m.update_search(search_index + 1)
|
||||
m.update_tab(m.RESULTS)
|
||||
search_box:ClearFocus()
|
||||
update_search(search_index + 1)
|
||||
set_tab(RESULTS)
|
||||
end
|
||||
end
|
||||
|
||||
function close_settings()
|
||||
if m.settings_button.open then
|
||||
m.settings_button:Click()
|
||||
if settings_button.open then
|
||||
settings_button:Click()
|
||||
end
|
||||
end
|
||||
|
||||
function update_continuation()
|
||||
if m.current_search().continuation then
|
||||
m.resume_button:Show()
|
||||
m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0)
|
||||
if current_search.continuation then
|
||||
resume_button:Show()
|
||||
search_box:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
|
||||
else
|
||||
m.resume_button:Hide()
|
||||
m.search_box:SetPoint('RIGHT', m.start_button, 'LEFT', -4, 0)
|
||||
resume_button:Hide()
|
||||
search_box:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
|
||||
end
|
||||
end
|
||||
|
||||
function discard_continuation()
|
||||
aux.scan.abort(m.search_scan_id)
|
||||
m.current_search().continuation = nil
|
||||
m.update_continuation()
|
||||
aux.scan.abort(search_scan_id)
|
||||
current_search.continuation = nil
|
||||
update_continuation()
|
||||
end
|
||||
|
||||
function update_start_stop()
|
||||
if m.current_search().active then
|
||||
m.stop_button:Show()
|
||||
m.start_button:Hide()
|
||||
if current_search.active then
|
||||
stop_button:Show()
|
||||
start_button:Hide()
|
||||
else
|
||||
m.start_button:Show()
|
||||
m.stop_button:Hide()
|
||||
start_button:Show()
|
||||
stop_button:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,9 +122,9 @@ function update_auto_buy_filter()
|
||||
elseif size(queries[1].blizzard_query) > 0 then
|
||||
log('Error: The automatic buyout filter does not support Blizzard filters')
|
||||
else
|
||||
m.auto_buy_validator = queries[1].validator
|
||||
m.auto_buy_filter_button.prettified = queries[1].prettified
|
||||
m.auto_buy_filter_button:SetChecked(true)
|
||||
auto_buy_validator = queries[1].validator
|
||||
auto_buy_filter_button.prettified = queries[1].prettified
|
||||
auto_buy_filter_button:SetChecked(true)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -136,7 +136,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
|
||||
local ignore_page
|
||||
if not search then
|
||||
search = m.current_search()
|
||||
search = current_search
|
||||
query.blizzard_query.first_page = tonumber(continuation) or 0
|
||||
query.blizzard_query.last_page = tonumber(continuation) or 0
|
||||
ignore_page = not tonumber(continuation)
|
||||
@@ -144,7 +144,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
|
||||
local next_page
|
||||
local new_records = {}
|
||||
m.search_scan_id = aux.scan.start{
|
||||
search_scan_id = aux.scan.start{
|
||||
type = 'list',
|
||||
queries = {query},
|
||||
auto_buy_validator = search.auto_buy_validator,
|
||||
@@ -191,7 +191,7 @@ function start_real_time_scan(query, search, continuation)
|
||||
|
||||
query.blizzard_query.first_page = next_page
|
||||
query.blizzard_query.last_page = next_page
|
||||
m.start_real_time_scan(query, search)
|
||||
start_real_time_scan(query, search)
|
||||
end,
|
||||
on_abort = function()
|
||||
search.status_bar:update_status(100, 100)
|
||||
@@ -199,12 +199,12 @@ function start_real_time_scan(query, search, continuation)
|
||||
|
||||
search.continuation = next_page or not ignore_page and query.blizzard_query.first_page or true
|
||||
|
||||
if m.current_search() == search then
|
||||
m.update_continuation()
|
||||
if current_search == search then
|
||||
update_continuation()
|
||||
end
|
||||
|
||||
search.active = false
|
||||
m.update_start_stop()
|
||||
update_start_stop()
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -212,7 +212,7 @@ end
|
||||
function start_search(queries, continuation)
|
||||
local current_query, current_page, total_queries, start_query, start_page
|
||||
|
||||
local search = m.current_search()
|
||||
local search = current_search
|
||||
|
||||
total_queries = getn(queries)
|
||||
|
||||
@@ -228,7 +228,7 @@ function start_search(queries, continuation)
|
||||
end
|
||||
|
||||
|
||||
m.search_scan_id = aux.scan.start{
|
||||
search_scan_id = aux.scan.start{
|
||||
type = 'list',
|
||||
queries = queries,
|
||||
auto_buy_validator = search.auto_buy_validator,
|
||||
@@ -271,12 +271,12 @@ function start_search(queries, continuation)
|
||||
search.status_bar:update_status(100, 100)
|
||||
search.status_bar:set_text('Scan complete')
|
||||
|
||||
if m.current_search() == search and m.frame.results:IsVisible() and getn(search.records) == 0 then
|
||||
m.update_tab(m.SAVED)
|
||||
if current_search == search and frame.results:IsVisible() and getn(search.records) == 0 then
|
||||
set_tab(SAVED)
|
||||
end
|
||||
|
||||
search.active = false
|
||||
m.update_start_stop()
|
||||
update_start_stop()
|
||||
end,
|
||||
on_abort = function()
|
||||
search.status_bar:update_status(100, 100)
|
||||
@@ -287,12 +287,12 @@ function start_search(queries, continuation)
|
||||
else
|
||||
search.continuation = {start_query, start_page}
|
||||
end
|
||||
if m.current_search() == search then
|
||||
m.update_continuation()
|
||||
if current_search == search then
|
||||
update_continuation()
|
||||
end
|
||||
|
||||
search.active = false
|
||||
m.update_start_stop()
|
||||
update_start_stop()
|
||||
end,
|
||||
}
|
||||
end
|
||||
@@ -300,15 +300,15 @@ end
|
||||
function public.execute(resume, real_time)
|
||||
|
||||
if resume then
|
||||
real_time = m.current_search().real_time
|
||||
real_time = current_search.real_time
|
||||
elseif real_time == nil then
|
||||
real_time = m.real_time_button:GetChecked()
|
||||
real_time = real_time_button:GetChecked()
|
||||
end
|
||||
|
||||
if resume then
|
||||
m.search_box:SetText(m.current_search().filter_string)
|
||||
search_box:SetText(current_search.filter_string)
|
||||
end
|
||||
local filter_string = m.search_box:GetText()
|
||||
local filter_string = search_box:GetText()
|
||||
|
||||
local queries = aux.filter.queries(filter_string)
|
||||
if not queries then
|
||||
@@ -323,45 +323,45 @@ function public.execute(resume, real_time)
|
||||
end
|
||||
end
|
||||
|
||||
m.search_box:ClearFocus()
|
||||
search_box:ClearFocus()
|
||||
|
||||
if resume then
|
||||
m.current_search().table:SetSelectedRecord()
|
||||
current_search.table:SetSelectedRecord()
|
||||
else
|
||||
if filter_string ~= m.current_search().filter_string or m.current_search().placeholder then
|
||||
if m.current_search().placeholder then
|
||||
m.current_search().filter_string = filter_string
|
||||
m.current_search().placeholder = false
|
||||
if filter_string ~= current_search.filter_string or current_search.placeholder then
|
||||
if current_search.placeholder then
|
||||
current_search.filter_string = filter_string
|
||||
current_search.placeholder = false
|
||||
else
|
||||
m.new_search(filter_string)
|
||||
new_search(filter_string)
|
||||
end
|
||||
m.new_recent_search(filter_string, table.concat(map(queries, function(filter) return filter.prettified end), ';'))
|
||||
new_recent_search(filter_string, table.concat(map(queries, function(filter) return filter.prettified end), ';'))
|
||||
else
|
||||
m.current_search().records = {}
|
||||
m.current_search().table:SetDatabase(m.current_search().records)
|
||||
if m.current_search().real_time ~= real_time then
|
||||
m.current_search().table:Reset()
|
||||
current_search.records = {}
|
||||
current_search.table:SetDatabase(current_search.records)
|
||||
if current_search.real_time ~= real_time then
|
||||
current_search.table:Reset()
|
||||
end
|
||||
end
|
||||
m.current_search().real_time = m.real_time_button:GetChecked()
|
||||
m.current_search().auto_buy = m.auto_buy_button:GetChecked()
|
||||
m.current_search().auto_buy_validator = m.auto_buy_validator
|
||||
current_search.real_time = real_time_button:GetChecked()
|
||||
current_search.auto_buy = auto_buy_button:GetChecked()
|
||||
current_search.auto_buy_validator = auto_buy_validator
|
||||
end
|
||||
|
||||
local continuation = resume and m.current_search().continuation
|
||||
m.discard_continuation()
|
||||
m.current_search().active = true
|
||||
m.update_start_stop()
|
||||
local continuation = resume and current_search.continuation
|
||||
discard_continuation()
|
||||
current_search.active = true
|
||||
update_start_stop()
|
||||
|
||||
m.update_tab(m.RESULTS)
|
||||
set_tab(RESULTS)
|
||||
if real_time then
|
||||
m.start_real_time_scan(queries[1], nil, continuation)
|
||||
start_real_time_scan(queries[1], nil, continuation)
|
||||
else
|
||||
for _, query in queries do
|
||||
query.blizzard_query.first_page = m.blizzard_page_index(m.first_page_input:GetText())
|
||||
query.blizzard_query.last_page = m.blizzard_page_index(m.last_page_input:GetText())
|
||||
query.blizzard_query.first_page = blizzard_page_index(first_page_input:GetText())
|
||||
query.blizzard_query.last_page = blizzard_page_index(last_page_input:GetText())
|
||||
end
|
||||
m.start_search(queries, continuation)
|
||||
start_search(queries, continuation)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -379,7 +379,7 @@ do
|
||||
local found_index
|
||||
|
||||
function find_auction(record)
|
||||
local search = m.current_search()
|
||||
local search = current_search
|
||||
|
||||
if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then
|
||||
return
|
||||
@@ -389,7 +389,7 @@ do
|
||||
state = SEARCHING
|
||||
scan_id = aux.scan_util.find(
|
||||
record,
|
||||
m.current_search().status_bar,
|
||||
current_search.status_bar,
|
||||
function()
|
||||
state = IDLE
|
||||
end,
|
||||
@@ -406,24 +406,24 @@ do
|
||||
found_index = index
|
||||
|
||||
if not record.high_bidder then
|
||||
m.bid_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and search.table:ContainsRecord(record) then
|
||||
bid_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and search.table:ContainsRecord(record) then
|
||||
aux.place_bid('list', index, record.bid_price, record.bid_price < record.buyout_price and function()
|
||||
aux.info.bid_update(record)
|
||||
search.table:SetDatabase()
|
||||
end or aux.C(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
end)
|
||||
m.bid_button:Enable()
|
||||
bid_button:Enable()
|
||||
end
|
||||
|
||||
if record.buyout_price > 0 then
|
||||
m.buyout_button:SetScript('OnClick', function()
|
||||
if m.test(record)(index) and search.table:ContainsRecord(record) then
|
||||
buyout_button:SetScript('OnClick', function()
|
||||
if test(record)(index) and search.table:ContainsRecord(record) then
|
||||
aux.place_bid('list', index, record.buyout_price, aux.C(search.table.RemoveAuctionRecord, search.table, record))
|
||||
end
|
||||
end)
|
||||
m.buyout_button:Enable()
|
||||
buyout_button:Enable()
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -431,22 +431,22 @@ do
|
||||
|
||||
function on_update()
|
||||
if state == IDLE or state == SEARCHING then
|
||||
m.buyout_button:Disable()
|
||||
m.bid_button:Disable()
|
||||
buyout_button:Disable()
|
||||
bid_button:Disable()
|
||||
end
|
||||
|
||||
if state == SEARCHING then
|
||||
return
|
||||
end
|
||||
|
||||
local selection = m.current_search().table:GetSelection()
|
||||
local selection = current_search.table:GetSelection()
|
||||
if not selection then
|
||||
state = IDLE
|
||||
elseif selection and state == IDLE then
|
||||
m.find_auction(selection.record)
|
||||
elseif state == FOUND and not m.test(selection.record)(found_index) then
|
||||
m.buyout_button:Disable()
|
||||
m.bid_button:Disable()
|
||||
find_auction(selection.record)
|
||||
elseif state == FOUND and not test(selection.record)(found_index) then
|
||||
buyout_button:Disable()
|
||||
bid_button:Disable()
|
||||
if not aux.bid_in_progress() then
|
||||
state = IDLE
|
||||
end
|
||||
|
||||
@@ -39,6 +39,18 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local _state = setmetatable({}, {__mode='kv'})
|
||||
local __index = function(self, key)
|
||||
return _state[self].handler({public=self, private=_state[self].state}, key)
|
||||
end
|
||||
function public.index_function(state, handler)
|
||||
local state, self = {handler=handler, state=state}, {}
|
||||
_state[self] = state
|
||||
return setmetatable(self, {__metatable=false, __index=__index, state=state})
|
||||
end
|
||||
end
|
||||
|
||||
function public.temp(object)
|
||||
getfenv(2).__ = object
|
||||
return object
|
||||
|
||||
Reference in New Issue
Block a user