filter tab improvement

This commit is contained in:
Manuel Simon Hirsig
2016-08-02 07:00:34 +02:00
parent acd2a2f446
commit 3ad26bb378
3 changed files with 25 additions and 12 deletions
+12 -4
View File
@@ -836,7 +836,7 @@ function private.import_query_string()
if components then
m.set_form(components.blizzard)
m.post_components = components.post
m.filter_display:SetText(Aux.filter.indented_post_query_string(Aux.util.take(20, m.post_components)))
m.update_filter_display()
else
Aux.log(error)
end
@@ -849,7 +849,7 @@ function private.export_query_string()
m.clear_form()
m.filter_input:ClearFocus()
m.post_components = {}
m.filter_display:SetText('')
m.update_filter_display()
else
Aux.log(error)
end
@@ -876,7 +876,7 @@ function private.add_post_filter()
if components then
tinsert(m.post_components, components.post[1])
m.filter_display:SetText(Aux.filter.indented_post_query_string(Aux.util.take(20, m.post_components)))
m.update_filter_display()
m.filter_input:SetText('')
m.filter_input:ClearFocus()
else
@@ -887,6 +887,14 @@ end
function private.remove_post_filter()
tremove(m.post_components)
m.filter_display:SetText(Aux.filter.indented_post_query_string(Aux.util.take(20, m.post_components)))
m.update_filter_display()
end
function private.update_filter_display()
local lines = getn(Aux.util.filter(m.post_components, function(component) return component[1] == 'operator' and component[2] ~= 'not' end))
local width_scale = max(200/m.filter_display:GetStringWidth())
local height_scale = min((200 / lines) / 18)
m.filter_display_scale:SetScale(min(1, width_scale, height_scale))
m.filter_display:SetText(Aux.filter.indented_post_query_string(m.post_components))
end
+11 -6
View File
@@ -551,13 +551,18 @@ Aux.search_tab.FRAMES(function(m, public, private)
private.filter_input = input
end
do
local display = CreateFrame('SimpleHTML', nil, m.frame.filter)
display:SetPoint('TOPLEFT', 348, -50)
display:SetWidth(395)
display:SetHeight(270)
display:SetFont('p', Aux.gui.config.font, 13)
local frame = CreateFrame('Frame', nil, m.frame.filter)
frame:SetWidth(395)
frame:SetHeight(270)
frame:SetPoint('TOPLEFT', 348, -50)
Aux.gui.set_content_style(frame)
local scale_frame = CreateFrame('Frame', nil, frame)
scale_frame:SetAllPoints()
local display = Aux.gui.label(scale_frame, 18)
display:SetAllPoints()
display:SetJustifyH('LEFT')
Aux.gui.set_content_style(display)
display:SetJustifyV('TOP')
private.filter_display_scale = scale_frame
private.filter_display = display
end
+2 -2
View File
@@ -545,7 +545,7 @@ function public.indented_post_query_string(components)
if no_line_break then
str = str..' '
elseif i > 1 then
str = str..'</p><p>'
str = str..'|n'
str = str..Aux.gui.inline_color({42, 42, 42, 1})
for _=1,getn(stack) do
str = str..'----'
@@ -577,7 +577,7 @@ function public.indented_post_query_string(components)
end
end
return '<html><body><p>'..str..'</p></body></html>'
return str
end
function private.prettified_query_string(components)