diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc
index 6e6df39..a282cbd 100644
--- a/Aux-AddOn.toc
+++ b/Aux-AddOn.toc
@@ -2,7 +2,7 @@
## Title: Aux
## Notes: A lightweight addon designed to help manage auctions
## SavedVariablesPerCharacter: aux_recently_searched, aux_view, AUX_AUCTION_DURATION
-## SavedVariables: aux_database, aux_auctionable_items
+## SavedVariables: aux_groups, aux_database, aux_auctionable_items
slash.lua
core.xml
diff --git a/gui.lua b/gui.lua
index d5f331b..5bde5f8 100644
--- a/gui.lua
+++ b/gui.lua
@@ -10,6 +10,7 @@ m.config = {
content_font = [[Fonts\ARIALN.TTF]],
-- content_font = [[Interface\AddOns\Aux-Addon\ARIALN.TTF]],
normal_font_size = 15,
+ normal_button_font_size = 16, -- 15 not working for some clients
text_color = { enabled = { 255/255, 254/255, 250/255, 1 }, disabled = { 147/255, 151/255, 139/255, 1 } },
label_color = { enabled = { 216/255, 225/255, 211/255, 1 }, disabled = { 150/255, 148/255, 140/255, 1 } },
@@ -437,4 +438,93 @@ function m.dropdown()
button.obj = widget
return AceGUI:RegisterAsWidget(widget)
+end
+
+function m.slider(frame, name)
+-- local frame = CreateFrame('Frame', nil, UIParent)
+--
+-- frame:EnableMouse(true)
+-- frame:SetScript("OnMouseDown", Frame_OnMouseDown)
+-- frame:SetScript("OnEnter", Control_OnEnter)
+-- frame:SetScript("OnLeave", Control_OnLeave)
+--
+
+ local slider = CreateFrame('Slider', name, frame)
+ slider:SetOrientation('HORIZONTAL')
+ slider:SetHeight(6)
+-- slider:SetHitRectInsets(0, 0, -10, 0)
+-- slider:SetPoint('TOPLEFT', label, 'BOTTOMLEFT', 3, -4)
+-- slider:SetPoint('TOPRIGHT', label, 'BOTTOMRIGHT', -6, -4)
+ slider:SetValue(0)
+ 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')
+ thumb_texture:SetPoint('CENTER', 0, 0)
+ thumb_texture:SetTexture(unpack(m.config.content_color))
+ thumb_texture:SetHeight(15)
+ thumb_texture:SetWidth(8)
+ slider:SetThumbTexture(thumb_texture)
+
+ local label = slider:CreateFontString(nil, 'OVERLAY')
+ label:SetPoint('BOTTOMLEFT', slider, 'TOPLEFT', -3, 4)
+ label:SetPoint('BOTTOMRIGHT', slider, 'TOPRIGHT', 6, 4)
+ label:SetJustifyH('CENTER')
+ label:SetHeight(15)
+ label:SetFont(m.config.content_font, m.config.normal_font_size)
+
+-- local lowtext = slider:CreateFontString(nil, 'ARTWORK')
+-- lowtext:SetFont(TSMAPI.Design:GetContentFont('small'))
+-- lowtext:SetPoint('TOPLEFT', slider, 'BOTTOMLEFT', 2, -4)
+--
+-- local hightext = slider:CreateFontString(nil, 'ARTWORK')
+-- hightext:SetFont(TSMAPI.Design:GetContentFont('small'))
+-- hightext:SetPoint('TOPRIGHT', slider, 'BOTTOMRIGHT', -2, -4)
+--
+ local editbox = CreateFrame('EditBox', nil, frame)
+ editbox:SetAutoFocus(false)
+ editbox:SetPoint('TOP', slider, 'BOTTOM', 0, -6)
+ editbox:SetHeight(15)
+ 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:SetBackdropColor(unpack(m.config.content_color))
+ editbox:SetBackdropBorderColor(unpack(m.config.content_border_color))
+-- editbox:SetScript('OnEnterPressed', EditBox_OnEnterPressed)
+-- editbox:SetScript('OnEscapePressed', EditBox_OnEscapePressed)
+-- editbox:SetScript('OnTextChanged', EditBox_OnTextChanged)
+-- editbox:SetScript('OnEnter', Control_OnEnter)
+-- editbox:SetScript('OnLeave', Control_OnLeave)
+ editbox:SetFont(m.config.content_font, m.config.normal_font_size)
+ editbox:SetShadowColor(0, 0, 0, 0)
+--
+-- local button = CreateFrame('Button', nil, editbox, 'UIPanelButtonTemplate')
+-- button:SetWidth(40)
+-- button:SetHeight(20)
+-- button:SetPoint('LEFT', editbox, 'RIGHT', 2, 0)
+-- button:SetText(OKAY)
+-- button:SetScript('OnClick', Button_OnClick)
+-- button:Hide()
+--
+-- local widget = {
+-- label = label,
+-- slider = slider,
+-- lowtext = lowtext,
+-- hightext = hightext,
+-- editbox = editbox,
+-- button = button,
+-- alignoffset = 25,
+-- frame = frame,
+-- type = Type
+-- }
+-- for method, func in pairs(methods) do
+-- widget[method] = func
+-- end
+-- slider.obj, editbox.obj, button.obj, frame.obj = widget, widget, widget, widget
+
+
+ slider.label = label
+ slider.editbox = editbox
+ return slider
end
\ No newline at end of file
diff --git a/post_frame.lua b/post_frame.lua
index 2fdc352..2018fc2 100644
--- a/post_frame.lua
+++ b/post_frame.lua
@@ -201,6 +201,78 @@ function public.on_load()
btn:SetScript('OnClick', private.refresh)
private.refresh_button = btn
end
+ do
+ local slider = Aux.gui.slider(AuxSellParameters)
+ slider:SetValueStep(1)
+ slider:SetPoint('TOPLEFT', 16, -70)
+ slider:SetWidth(170)
+ slider:SetScript('OnValueChanged', function()
+ private.quantity_update()
+ end)
+ slider.editbox:SetScript('OnTextChanged', function()
+ if slider.charge_classes then
+ local charge_slider_value = Aux.util.index_of(this:GetNumber(), slider.charge_classes)
+ if charge_slider_value then
+ slider:SetValue(charge_slider_value)
+ end
+ else
+ slider:SetValue(this:GetNumber())
+ end
+ private.quantity_update()
+ end)
+ slider.editbox:SetScript('OnEscapePressed', function()
+ this:ClearFocus()
+ end)
+ slider.editbox:SetScript('OnEditFocusGained', function()
+ this:HighlightText()
+ end)
+ slider.editbox:SetScript('OnEditFocusLost', function()
+ this:HighlightText(0, 0)
+ end)
+ slider.editbox:SetWidth(50)
+ slider.editbox:SetNumeric(true)
+ slider.editbox:SetMaxLetters(3)
+ slider.label:SetText('Stack Size')
+ private.stack_size_slider = slider
+ end
+ do
+ local slider = Aux.gui.slider(AuxSellParameters)
+ slider:SetValueStep(1)
+ slider:SetPoint('TOPLEFT', 16, -120)
+ slider:SetWidth(170)
+ slider:SetScript('OnValueChanged', function()
+ private.quantity_update()
+ end)
+ slider.editbox:SetScript('OnTextChanged', function()
+ if slider.charge_classes then
+ local index = Aux.util.index_of(this:GetNumber(), slider.charge_classes)
+ if index then
+ slider:SetValue(index)
+ end
+ else
+ slider:SetValue(this:GetNumber())
+ end
+ private.quantity_update()
+ end)
+ slider.editbox:SetScript('OnEscapePressed', function()
+ this:ClearFocus()
+ end)
+ slider.editbox:SetScript('OnEditFocusGained', function()
+ this:HighlightText()
+ end)
+ slider.editbox:SetScript('OnEditFocusLost', function()
+ this:HighlightText(0, 0)
+ end)
+ slider.editbox:SetWidth(50)
+ slider.editbox:SetNumeric(true)
+ slider.label:SetText('Stack Count')
+ private.stack_count_slider = slider
+ end
+ do
+ local label = Aux.gui.label(AuxSellParametersShortDurationRadio, 13)
+ label:SetPoint('BOTTOMLEFT', AuxSellParametersShortDurationRadio, 'TOPLEFT', 1, -2)
+ label:SetText('Duration')
+ end
do
local editbox = Aux.gui.editbox(AuxSellParameters)
editbox:SetPoint('TOPLEFT', 16, -215)
@@ -218,6 +290,9 @@ function public.on_load()
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
+ editbox:SetScript('OnEditFocusGained', function()
+ this:HighlightText()
+ end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText())))
end)
@@ -243,6 +318,9 @@ function public.on_load()
editbox:SetScript('OnEscapePressed', function()
this:ClearFocus()
end)
+ editbox:SetScript('OnEditFocusGained', function()
+ this:HighlightText()
+ end)
editbox:SetScript('OnEditFocusLost', function()
this:SetText(Aux.money.to_string(Aux.money.from_string(this:GetText())))
end)
@@ -267,12 +345,6 @@ function public.on_open()
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, LIVE)
private.set_auction_duration(AUX_AUCTION_DURATION)
- AuxSellStackSizeSlider:SetValueStep(1)
- AuxSellStackSizeSliderText:SetText('Stack Size')
-
- AuxSellStackCountSlider:SetValueStep(1)
- AuxSellStackCountSliderText:SetText('Stack Count')
-
-- so that it's initialized with zeroes, not sometimes zero, sometimes empty
private.start_price:SetText(Aux.money.to_string(0))
private.buyout_price:SetText(Aux.money.to_string(0))
@@ -323,7 +395,7 @@ end
function private.post_auctions()
local auction = selected_item
if auction then
- local key, hyperlink, stack_size, buyout_price, stack_count = auction.key, auction.hyperlink, private.get_stack_size_slider_value(), Aux.money.from_string(private.buyout_price:GetText()), AuxSellStackCountSlider:GetValue()
+ local key, hyperlink, stack_size, buyout_price, stack_count = auction.key, auction.hyperlink, private.get_stack_size_slider_value(), Aux.money.from_string(private.buyout_price:GetText()), private.stack_count_slider:GetValue()
local duration
if AuctionFrameAuctions.duration == 120 then
duration = 2
@@ -393,9 +465,9 @@ end
function private.get_stack_size_slider_value()
if selected_item.charges then
- return AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]
+ return private.stack_size_slider.charge_classes[private.stack_size_slider:GetValue()]
else
- return AuxSellStackSizeSlider:GetValue()
+ return private.stack_size_slider:GetValue()
end
end
@@ -430,15 +502,15 @@ function private.update_recommendation()
private.start_price:SetText(Aux.money.to_string(0))
private.buyout_price:SetText(Aux.money.to_string(0))
- AuxSellStackSizeSlider:SetMinMaxValues(0, 0)
- AuxSellStackSize:SetNumber(0)
- AuxSellStackCountSlider:SetMinMaxValues(0, 0)
- AuxSellStackCount:SetNumber(0)
+ private.stack_size_slider:SetMinMaxValues(0, 0)
+ private.stack_size_slider.editbox:SetNumber(0)
+ private.stack_count_slider:SetMinMaxValues(0, 0)
+ private.stack_count_slider.editbox:SetNumber(0)
private.deposit:SetText('Deposit: '..Aux.money.to_string(0))
else
- AuxSellStackSize:SetNumber(selected_item.charges and AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()] or AuxSellStackSizeSlider:GetValue())
- AuxSellStackCount:SetNumber(AuxSellStackCountSlider:GetValue())
+ private.stack_size_slider.editbox:SetNumber(selected_item.charges and private.stack_size_slider.charge_classes[private.stack_size_slider:GetValue()] or private.stack_size_slider:GetValue())
+ private.stack_count_slider.editbox:SetNumber(private.stack_count_slider:GetValue())
AuxSellParametersItemIconTexture:SetTexture(selected_item.texture)
AuxSellParametersItemName:SetText(selected_item.name)
@@ -453,7 +525,7 @@ function private.update_recommendation()
private.refresh_button:Enable()
-- TODO neutral AH deposit formula
- private.deposit:SetText('Deposit: '..Aux.money.to_string(floor(selected_item.unit_vendor_price * 0.05 * (selected_item.charges and 1 or private.get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120))
+ private.deposit:SetText('Deposit: '..Aux.money.to_string(floor(selected_item.unit_vendor_price * 0.05 * (selected_item.charges and 1 or private.get_stack_size_slider_value())) * private.stack_count_slider:GetValue() * AuctionFrameAuctions.duration / 120))
if existing_auctions[selected_item.key] then
private.select_auction()
@@ -487,9 +559,9 @@ function private.update_recommendation()
end
end
-function public.quantity_update()
+function private.quantity_update()
if selected_item then
- AuxSellStackCountSlider:SetMinMaxValues(1, selected_item.charges and selected_item.availability[AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]] or floor(selected_item.availability[0] / private.get_stack_size_slider_value()))
+ private.stack_count_slider:SetMinMaxValues(1, selected_item.charges and selected_item.availability[private.stack_size_slider.charge_classes[private.stack_size_slider:GetValue()]] or floor(selected_item.availability[0] / private.get_stack_size_slider_value()))
end
private.update_recommendation()
refresh = true
@@ -505,13 +577,13 @@ function private.set_item(item)
Aux.scan.abort(function()
local charge_classes = private.charge_classes(selected_item.availability)
- AuxSellStackSizeSlider.charge_classes = selected_item.charges and charge_classes
+ private.stack_size_slider.charge_classes = selected_item.charges and charge_classes
local stack_size_slider_max = selected_item.charges and getn(charge_classes) or min(selected_item.max_stack, selected_item.availability[0])
- AuxSellStackSizeSlider:SetMinMaxValues(1, stack_size_slider_max)
+ private.stack_size_slider:SetMinMaxValues(1, stack_size_slider_max)
- AuxSellStackSizeSlider:SetValue(stack_size_slider_max)
- public.quantity_update()
- AuxSellStackCountSlider:SetValue(selected_item.aux_quantity) -- reduced to max possible
+ private.stack_size_slider:SetValue(stack_size_slider_max)
+ private.quantity_update()
+ private.stack_count_slider:SetValue(selected_item.aux_quantity) -- reduced to max possible
if not existing_auctions[selected_item.key] then
private.refresh_entries()
diff --git a/post_frame.xml b/post_frame.xml
index 11ce0e5..bd13779 100644
--- a/post_frame.xml
+++ b/post_frame.xml
@@ -19,11 +19,6 @@
-
-
-
-
-
@@ -36,107 +31,72 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.post_frame.quantity_update()
-
-
-
-
-
-
-
- Aux.post_frame.quantity_update()
-
-
-
-
-
-
-
-
- if AuxSellStackSizeSlider.charge_classes then
- local charge_slider_value = Aux.util.index_of(this:GetNumber(), AuxSellStackSizeSlider.charge_classes)
- if charge_slider_value then
- AuxSellStackSizeSlider:SetValue(charge_slider_value)
- end
- else
- AuxSellStackSizeSlider:SetValue(this:GetNumber())
- end
- Aux.post_frame.quantity_update()
-
-
-
-
-
- this:HighlightText(0, 0)
-
-
- this:HighlightText()
-
-
-
-
-
-
-
-
- if AuxSellStackCountSlider.charge_classes then
- local index = Aux.util.index_of(this:GetNumber(), AuxSellStackCountSlider.charge_classes)
- if index then
- AuxSellStackCountSlider:SetValue(index)
- end
- else
- AuxSellStackCountSlider:SetValue(this:GetNumber())
- end
- Aux.post_frame.quantity_update()
-
-
-
-
-
- this:HighlightText(0, 0)
-
-
- this:HighlightText()
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
getglobal(this:GetName().."Text"):SetText("2h")
@@ -189,54 +149,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-