ui changes

This commit is contained in:
Manuel Simon Hirsig
2016-10-12 22:15:45 +02:00
parent 119edb5ae5
commit 881002ad49
2 changed files with 55 additions and 57 deletions
+51 -53
View File
@@ -68,42 +68,6 @@ do
btn:SetScript('OnClick', next_search)
private.next_button = btn
end
do
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
end
do
local editbox = gui.editbox(frame)
editbox:SetWidth(40)
editbox:SetHeight(25)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
private.first_page_input = editbox
end
do
local editbox = gui.editbox(frame)
editbox:SetPoint('LEFT', first_page_input, 'RIGHT', 6, 0)
editbox:SetWidth(40)
editbox:SetHeight(25)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('LEFT', first_page_input, 'RIGHT', 0, 0)
label:SetPoint('RIGHT', editbox, 'LEFT', -1, 0)
label:SetJustifyH'CENTER'
label:SetText'-'
label:SetTextColor(color.label.enabled())
private.last_page_input = editbox
end
end
do
local btn = gui.button(frame, gui.font_size.huge)
btn:SetPoint('TOPRIGHT', -5, -9)
@@ -142,24 +106,58 @@ do
private.resume_button = btn
end
do
local editbox = gui.editbox(frame)
editbox:EnableMouse(1)
editbox.formatter = function(str)
local queries = filter_util.queries(str)
return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str)
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
end
editbox.complete = completion.complete_filter
editbox:SetPoint('LEFT', last_page_input, 'RIGHT', 4, 0)
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
editbox:SetHeight(25)
editbox.char = function()
this:complete()
end
editbox:SetScript('OnTabPressed', function()
this:HighlightText(0, 0)
end)
editbox.enter = execute
private.search_box = editbox
do
local editbox = gui.editbox(frame)
editbox:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
editbox:SetWidth(40)
editbox:SetHeight(25)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() first_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
private.last_page_input = editbox
end
do
local editbox = gui.editbox(frame)
editbox:SetPoint('RIGHT', last_page_input, 'LEFT', -5.5, 0)
editbox:SetWidth(40)
editbox:SetHeight(25)
editbox:SetNumeric(true)
editbox:SetScript('OnTabPressed', function() last_page_input:SetFocus() end)
editbox.enter = execute
editbox.change = change
local label = gui.label(editbox, gui.font_size.medium)
label:SetPoint('LEFT', editbox, 'RIGHT', 0, 0)
label:SetTextColor(color.label.enabled())
label:SetText'-'
private.first_page_input = editbox
end
end
do
local editbox = gui.editbox(frame)
editbox:EnableMouse(1)
editbox.formatter = function(str)
local queries = filter_util.queries(str)
return queries and join(map(copy(queries), function(query) return query.prettified end), ';') or color.red(str)
end
editbox.complete = completion.complete_filter
editbox:SetPoint('RIGHT', first_page_input, 'LEFT', -4, 0)
editbox:SetHeight(25)
editbox.char = function()
this:complete()
end
editbox:SetScript('OnTabPressed', function()
this:HighlightText(0, 0)
end)
editbox.enter = execute
private.search_box = editbox
end
do
gui.horizontal_line(frame, -40)
+4 -4
View File
@@ -37,10 +37,10 @@ do
end
if search_index == getn(searches) then
next_button:Hide()
first_page_input:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
search_box:SetPoint('LEFT', previous_button, 'RIGHT', 4, 0)
else
next_button:Show()
first_page_input:SetPoint('LEFT', next_button, 'RIGHT', 4, 0)
search_box:SetPoint('LEFT', next_button, 'RIGHT', 4, 0)
end
update_start_stop()
update_continuation()
@@ -93,10 +93,10 @@ end
function private.update_continuation()
if current_search.continuation then
resume_button:Show()
search_box:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
last_page_input:SetPoint('RIGHT', resume_button, 'LEFT', -4, 0)
else
resume_button:Hide()
search_box:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
last_page_input:SetPoint('RIGHT', start_button, 'LEFT', -4, 0)
end
end