more refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-19 13:42:05 +02:00
parent b37e91b739
commit 829483900e
7 changed files with 222 additions and 218 deletions
+26 -26
View File
@@ -2,34 +2,34 @@ aux.module 'bids_tab'
function create_frames()
frame = CreateFrame('Frame', nil, aux.frame)
m.frame:SetAllPoints()
m.frame:SetScript('OnUpdate', m.on_update)
m.frame:Hide()
frame:SetAllPoints()
frame:SetScript('OnUpdate', on_update)
frame:Hide()
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)
frame.listing = aux.gui.panel(frame)
frame.listing:SetPoint('TOP', aux.frame, 'TOP', 0, -8)
frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0)
frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0)
listing = 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()
listing = aux.auction_listing.CreateAuctionResultsTable(frame.listing, aux.auction_listing.bids_config)
listing:SetSort(1,2,3,4,5,6,7,8)
listing:Reset()
listing:SetHandler('OnCellClick', function(cell, button)
if IsAltKeyDown() and listing: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
bid_button:Click()
end
end
end)
m.listing:SetHandler('OnSelectionChanged', function(rt, datum)
listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
m.find_auction(datum.record)
find_auction(datum.record)
end)
do
status_bar = aux.gui.status_bar(m.frame)
status_bar = aux.gui.status_bar(frame)
status_bar:SetWidth(265)
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6)
@@ -37,8 +37,8 @@ function create_frames()
status_bar:set_text('')
end
do
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
local btn = aux.gui.button(frame, 16)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Bid')
@@ -46,8 +46,8 @@ function create_frames()
bid_button = btn
end
do
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
local btn = aux.gui.button(frame, 16)
btn:SetPoint('TOPLEFT', bid_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Buyout')
@@ -55,13 +55,13 @@ function create_frames()
buyout_button = btn
end
do
local btn = aux.gui.button(m.frame, 16)
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
local btn = aux.gui.button(frame, 16)
btn:SetPoint('TOPLEFT', buyout_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetScript('OnClick', function()
m.scan_bids()
scan_bids()
end)
end
end
+25 -26
View File
@@ -209,27 +209,27 @@ function create_frames()
hide_checkbox = checkbox
end
do
local frame = CreateFrame('Frame', nil, m.frame.parameters)
local frame = CreateFrame('Frame', nil, frame.parameters)
start_price_frame = frame
aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetPoint('TOPRIGHT', frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetJustifyH('RIGHT')
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
this.pretty:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3))
refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() and m.stack_count_slider.editbox:IsVisible() then
m.stack_count_slider.editbox:SetFocus()
if IsShiftKeyDown() and stack_count_slider.editbox:IsVisible() then
stack_count_slider.editbox:SetFocus()
elseif IsShiftKeyDown() then
m.stack_size_slider.editbox:SetFocus()
stack_size_slider.editbox:SetFocus()
else
m.unit_buyout_price:SetFocus()
unit_buyout_price:SetFocus()
end
end)
editbox:SetScript('OnEditFocusGained', function()
@@ -238,7 +238,7 @@ function create_frames()
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:SetText(aux.money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
end)
@@ -263,25 +263,25 @@ function create_frames()
unit_start_price = editbox
end
do
local frame = CreateFrame('Frame', nil, m.frame.parameters)
local frame = CreateFrame('Frame', nil, frame.parameters)
buyout_price_frame = frame
aux.gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetPoint('TOPRIGHT', unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = aux.gui.editbox(frame)
editbox:SetAllPoints()
editbox:SetJustifyH('RIGHT')
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
this.pretty:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3))
refresh = true
end)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
m.unit_start_price:SetFocus()
unit_start_price:SetFocus()
else
m.stack_size_slider.editbox:SetFocus()
stack_size_slider.editbox:SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -293,7 +293,7 @@ function create_frames()
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:SetText(aux.money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
end)
@@ -306,33 +306,32 @@ function create_frames()
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')
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')
label:SetJustifyH 'CENTER'
buyout_price_percentage = label
end
unit_buyout_price = editbox
end
do
local btn = aux.gui.button(m.frame.parameters, 14)
local btn = aux.gui.button(frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -10, -146)
btn:SetWidth(150)
btn:SetHeight(20)
aux.gui.set_size(btn, 150, 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)
set_unit_start_price(this.amount)
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')
label:SetText 'Historical Value'
historical_value_button = btn
end
end
+14 -14
View File
@@ -353,41 +353,41 @@ function create_frames()
m.execute()
end)
local btn2 = aux.gui.button(m.frame.filter, 16)
local btn2 = aux.gui.button(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)
btn2:SetScript('OnClick', export_query_string)
local btn3 = aux.gui.button(m.frame.filter, 16)
local btn3 = aux.gui.button(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)
btn3:SetScript('OnClick', import_query_string)
end
do
local editbox = aux.gui.editbox(m.frame.filter)
local editbox = aux.gui.editbox(frame.filter)
editbox.complete_item = aux.completion.complete(function() return _G.aux_auctionable_items end)
editbox:SetPoint('TOPLEFT', 14, -m.FILTER_SPACING)
editbox:SetPoint('TOPLEFT', 14, -FILTER_SPACING)
editbox:SetWidth(260)
editbox:SetScript('OnChar', function()
if m.blizzard_query.exact then
if blizzard_query.exact then
this:complete_item()
end
end)
editbox:SetScript('OnTabPressed', function()
if m.blizzard_query.exact then
if blizzard_query.exact then
return
end
if IsShiftKeyDown() then
m.max_level_input:SetFocus()
max_level_input:SetFocus()
else
m.min_level_input:SetFocus()
min_level_input:SetFocus()
end
end)
editbox:SetScript('OnTextChanged', m.update_form)
editbox:SetScript('OnTextChanged', update_form)
editbox:SetScript('OnEnterPressed', aux.C(editbox.ClearFocus, editbox))
local label = aux.gui.label(editbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1)
@@ -395,9 +395,9 @@ function create_frames()
name_input = editbox
end
do
local checkbox = aux.gui.checkbox(m.frame.filter)
checkbox:SetPoint('TOPLEFT', m.name_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', m.update_form)
local checkbox = aux.gui.checkbox(frame.filter)
checkbox:SetPoint('TOPLEFT', name_input, 'TOPRIGHT', 16, 0)
checkbox:SetScript('OnClick', update_form)
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1)
label:SetText('Exact')