refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-30 22:21:28 +02:00
parent 0fb920834c
commit dae00759cf
4 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -26,9 +26,9 @@ StaticPopupDialogs.AUX_SEARCH_AUTO_BUY = {
hideOnEscape = 1, hideOnEscape = 1,
} }
private.RESULTS = 1 public.RESULTS = 1
private.SAVED = 2 public.SAVED = 2
private.FILTER = 3 public.FILTER = 3
function LOAD() function LOAD()
aux_search_tab_frame.create() aux_search_tab_frame.create()
+3 -3
View File
@@ -249,7 +249,7 @@ end
private.post_filter = t private.post_filter = t
private.filter_builder_state = T('selected', 0) private.filter_builder_state = T('selected', 0)
function private.data_link_click() function public.data_link_click()
local button = arg3 local button = arg3
local index = tonumber(arg1) local index = tonumber(arg1)
if button == 'LeftButton' then if button == 'LeftButton' then
@@ -274,7 +274,7 @@ function private.add_component(component)
tinsert(post_filter, filter_builder_state.selected, component) tinsert(post_filter, filter_builder_state.selected, component)
end end
function private.add_post_filter() function public.add_post_filter()
for str in present(filter_input:GetText()) do for str in present(filter_input:GetText()) do
for filter in present(filter_util.filters[str]) do for filter in present(filter_util.filters[str]) do
if filter.input_type ~= '' then if filter.input_type ~= '' then
@@ -316,7 +316,7 @@ do
end end
end end
function private.set_filter_display_offset(x_offset, y_offset) function public.set_filter_display_offset(x_offset, y_offset)
local scroll_frame = 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() x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll()
local width, height = filter_display_size() local width, height = filter_display_size()
+6 -6
View File
@@ -177,7 +177,7 @@ function public.create()
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('<') btn:SetText('<')
btn:SetScript('OnClick', previous_search) btn:SetScript('OnClick', aux_search_tab_results.previous_search)
public.previous_button = btn public.previous_button = btn
end end
do do
@@ -186,7 +186,7 @@ function public.create()
btn:SetWidth(30) btn:SetWidth(30)
btn:SetHeight(25) btn:SetHeight(25)
btn:SetText('>') btn:SetText('>')
btn:SetScript('OnClick', next_search) btn:SetScript('OnClick', aux_search_tab_results.next_search)
public.next_button = btn public.next_button = btn
end end
do do
@@ -525,7 +525,7 @@ function public.create()
if filter_parameter_input:IsVisible() then if filter_parameter_input:IsVisible() then
filter_parameter_input:SetFocus() filter_parameter_input:SetFocus()
else else
add_post_filter() aux_search_tab_filter.add_post_filter()
end end
end end
public.filter_input = input public.filter_input = input
@@ -538,7 +538,7 @@ function public.create()
filter_input:SetFocus() filter_input:SetFocus()
end) end)
input.char = function() this:complete() end input.char = function() this:complete() end
input.enter = add_post_filter input.enter = aux_search_tab_filter.add_post_filter
input:Hide() input:Hide()
public.filter_parameter_input = input public.filter_parameter_input = input
end end
@@ -564,7 +564,7 @@ function public.create()
local new_x_offset = this.x_offset + x - this.x local new_x_offset = this.x_offset + x - this.x
local new_y_offset = this.y_offset + y - this.y local new_y_offset = this.y_offset + y - this.y
set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra) aux_search_tab_filter.set_filter_display_offset(new_x_offset - this.x_extra, new_y_offset - this.y_extra)
this.x_extra = max(this.x_extra, new_x_offset) this.x_extra = max(this.x_extra, new_x_offset)
this.y_extra = min(this.y_extra, new_y_offset) this.y_extra = min(this.y_extra, new_y_offset)
@@ -580,7 +580,7 @@ function public.create()
scroll_child:SetTextColor('p', color.label.enabled()) scroll_child:SetTextColor('p', color.label.enabled())
scroll_child:SetWidth(1) scroll_child:SetWidth(1)
scroll_child:SetHeight(1) scroll_child:SetHeight(1)
scroll_child:SetScript('OnHyperlinkClick', data_link_click) scroll_child:SetScript('OnHyperlinkClick', aux_search_tab_filter.data_link_click)
-- scroll_child:SetHyperlinkFormat("format") TODO -- scroll_child:SetHyperlinkFormat("format") TODO
scroll_child.measure = scroll_child:CreateFontString() scroll_child.measure = scroll_child:CreateFontString()
public.filter_display = scroll_child public.filter_display = scroll_child
+2 -2
View File
@@ -118,13 +118,13 @@ do
update_search(getn(searches)) update_search(getn(searches))
end end
function private.previous_search() function public.previous_search()
search_box:ClearFocus() search_box:ClearFocus()
update_search(search_index - 1) update_search(search_index - 1)
subtab = RESULTS subtab = RESULTS
end end
function private.next_search() function public.next_search()
search_box:ClearFocus() search_box:ClearFocus()
update_search(search_index + 1) update_search(search_index + 1)
subtab = RESULTS subtab = RESULTS