money input changes

This commit is contained in:
Manuel Simon Hirsig
2016-08-29 18:41:48 +02:00
parent fc347ed4cd
commit 542162439f
6 changed files with 38 additions and 75 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ local current_owner_page
function public.current_owner_page.get() return current_owner_page end
--do
-- local mt = {__call=function(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20) return self.f(unpack(self)) end}
-- local mt = {__call=function(self,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20) return self.f(unpack(self)) end} -- TODO
-- function public.F.get(arg) arg.f = tremove(arg, 1) return setmetatable(arg, mt) end
--end
+1 -1
View File
@@ -334,7 +334,7 @@ function public.editbox(parent)
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)
this.cursor:SetPoint(this:GetJustifyH(), this, this:GetJustifyH(), call(arg1 > 0 and max or min, 0, arg1 - 1), 1.5)
end)
editbox:SetScript('OnChar', function() call(this.char) end)
do
+7 -7
View File
@@ -62,13 +62,13 @@ do
end
end
local env_mt = {__metatable=false}
function env_mt:__index(key) self=state[self]
local environment_mt = {__metatable=false}
function environment_mt:__index(key) self=state[self]
local getter = self[INDEX][key]
if getter then return getter() end
return self[CALL][key] or _G[key] or self.declarator[key]
end
function env_mt:__newindex(key, value) self=state[self]
function environment_mt:__newindex(key, value) self=state[self]
if self.access[key] then
local setter = self[NEWINDEX][key] or collision_error(key)
setter(value)
@@ -100,15 +100,15 @@ local function import(self, ...)
end
function module(...)
local declarator, env, interface = setmetatable({}, declarator_mt), setmetatable({}, env_mt), setmetatable({}, interface_mt)
local declarator, environment, interface = setmetatable({}, declarator_mt), setmetatable({}, environment_mt), setmetatable({}, interface_mt)
local self; self = {
access = {_=PRIVATE, error=PRIVATE, nop=PRIVATE, _G=PRIVATE, M=PRIVATE, I=PRIVATE, public=PRIVATE, private=PRIVATE},
[CALL] = {import=function(...) import(self, unpack(arg)) end, error=error, nop=nop},
[INDEX] = {_G=const(_G), M=const(env), I=const(interface), public=function() return declarator.public end, private=function() return declarator.private end},
[INDEX] = {_G=const(_G), M=const(environment), I=const(interface), public=function() return declarator.public end, private=function() return declarator.private end},
[NEWINDEX] = {_=nop},
declarator = declarator,
default_access = PRIVATE,
}
state[declarator], state[env], state[interface] = self, self, self
setfenv(2, env)
state[declarator], state[environment], state[interface] = self, self, self
setfenv(2, environment)
end
+4 -4
View File
@@ -267,8 +267,8 @@ function update_item_configuration()
item.name:SetTextColor(color.label.enabled())
item.name:SetText('No item selected')
start_price_frame:Hide()
buyout_price_frame:Hide()
unit_start_price:Hide()
unit_buyout_price:Hide()
stack_size_slider:Hide()
stack_count_slider:Hide()
deposit:Hide()
@@ -280,8 +280,8 @@ function update_item_configuration()
-- set_unit_start_price(0)
-- set_unit_buyout_price(0)
else
start_price_frame:Show()
buyout_price_frame:Show()
unit_start_price:Show()
unit_buyout_price:Show()
stack_size_slider:Show()
stack_count_slider:Show()
deposit:Show()
+19 -57
View File
@@ -213,45 +213,25 @@ function create_frames()
end
do
local frame = CreateFrame('Frame', nil, frame.parameters)
start_price_frame = frame
gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', M.frame.parameters, 'TOPRIGHT', -71, -60)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = gui.editbox(frame)
editbox:SetAllPoints()
local editbox = gui.editbox(frame.parameters)
editbox:SetPoint('TOPRIGHT', -71, -60)
editbox:SetWidth(180)
editbox:SetHeight(22)
editbox:SetAlignment('RIGHT')
editbox:SetFontSize(17)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() and stack_count_slider.editbox:IsVisible() then
stack_count_slider.editbox:SetFocus()
elseif IsShiftKeyDown() then
stack_size_slider.editbox:SetFocus()
else
unit_buyout_price:SetFocus()
end
if IsShiftKeyDown() then
stack_count_slider.editbox:SetFocus()
else
unit_buyout_price:SetFocus()
end
end)
editbox.change = function()
this.pretty:SetText(money.to_string(get_unit_start_price(), true, nil, 3))
refresh = true
end
editbox.formatter = function() return money.to_string(get_unit_start_price(), true, nil, 3) end
editbox.change = function() refresh = true end
editbox.enter = function() this:ClearFocus() end
editbox.focus_gain = function()
this.pretty:Hide()
this:SetAlpha(1)
end
editbox.focus_loss = function()
this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
this:SetText(money.to_string(get_unit_start_price(), true, nil, 3, nil, true))
end
editbox:SetAlpha(0)
editbox.pretty = gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT')
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
@@ -267,14 +247,10 @@ function create_frames()
unit_start_price = editbox
end
do
local frame = CreateFrame('Frame', nil, frame.parameters)
buyout_price_frame = frame
gui.set_content_style(frame)
frame:SetPoint('TOPRIGHT', unit_start_price, 'BOTTOMRIGHT', 0, -19)
frame:SetWidth(180)
frame:SetHeight(22)
local editbox = gui.editbox(frame)
editbox:SetAllPoints()
local editbox = gui.editbox(frame.parameters)
editbox:SetPoint('TOPRIGHT', unit_start_price, 'BOTTOMRIGHT', 0, -19)
editbox:SetWidth(180)
editbox:SetHeight(22)
editbox:SetAlignment('RIGHT')
editbox:SetFontSize(17)
editbox:SetScript('OnTabPressed', function()
@@ -284,26 +260,12 @@ function create_frames()
stack_size_slider.editbox:SetFocus()
end
end)
editbox.change = function()
this.pretty:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3))
refresh = true
end
editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true, nil, 3) end
editbox.change = function() refresh = true end
editbox.enter = function() this:ClearFocus() end
editbox.focus_gain = function()
this.pretty:Hide()
this:SetAlpha(1)
end
editbox.focus_loss = function()
this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
this.pretty:Show()
this:SetAlpha(0)
this:SetText(money.to_string(get_unit_buyout_price(), true, nil, 3, nil, true))
end
editbox:SetAlpha(0)
editbox.pretty = gui.label(frame, 17)
editbox.pretty:SetPoint('LEFT', 1, 0)
editbox.pretty:SetPoint('RIGHT', -2, 0)
editbox.pretty:SetJustifyH('RIGHT')
editbox.pretty:SetTextColor(color.text.enabled())
do
local label = gui.label(frame, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
+6 -5
View File
@@ -464,7 +464,7 @@ function prettified_query_string(components)
prettified.append(info.display_name(aux.cache.item_id(parameter)) or color.label.enabled('['..parameter..']'))
else
if filters[component[2]].input_type == 'money' then
prettified.append(aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, gui.inline_color.label.enabled))
prettified.append(aux.money.to_string(aux.money.from_string(parameter), nil, true, nil, inline_color.label.enabled))
else
prettified.append(color.label.enabled(parameter))
end
@@ -493,7 +493,7 @@ function blizzard_query(components)
local query = T('name', filters.name and filters.name[2])
local item_info, class_index, subclass_index, slot_index
local item_id = aux.cache.item_id(filters.name[2])
local item_id = filters.name and aux.cache.item_id(filters.name[2])
item_info = item_id and info.item(item_id)
if filters.exact and item_info then
item_info = info.item(item_id)
@@ -520,10 +520,11 @@ end
function validator(components)
local validators = tt
local validators = t
for i, component in components.post do
if component[1] == 'filter' then
validators[i] = filters[component[2]].validator(parse_parameter(filters[component[2]].input_type, component[3]))
local type, name, param = unpack(component)
if type == 'filter' then
validators[i] = filters[name].validator(parse_parameter(filters[name].input_type, param))
end
end