Skip to content

Commit

Permalink
show nil, search. 0.3.3 candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
x2605 committed Sep 22, 2020
1 parent 9e9cb04 commit c41e79d
Show file tree
Hide file tree
Showing 10 changed files with 467 additions and 4 deletions.
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 0.3.3
Date: 2020-09-23

Changes:
- Added search UI for tree viewers.
- Added "show/hide nil"

---------------------------------------------------------------------------------------------------
Version: 0.3.2
Date: 2020-09-14
Expand Down
13 changes: 13 additions & 0 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,19 @@ default_gui['vflow'..suffix] = {
vertical_spacing = 0,
horizontal_spacing = 0,
}
default_gui['transparent-frame'..suffix] = {
type = "frame_style",
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
horizontal_flow_style = {type = 'horizontal_flow_style', parent = 'hflow'..suffix},
vertical_flow_style = {type = 'vertical_flow_style', parent = 'vflow'..suffix},
graphical_set = {base = {center = {position = {25, 8}, size = {1, 1}}}},
}

c = copytbl('highlighted-frame'..suffix, default_gui['transparent-frame'..suffix])
c.graphical_set.base.center = {position = {287, 79}, size = {1, 1}}

c = copytbl('output'..suffix, default_gui.label)
c.single_line = false
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gvv",
"version": "0.3.2",
"version": "0.3.3",
"title": "Lua API global Variable Viewer (gvv)",
"author": "x2605",
"contact": "",
Expand Down
6 changes: 6 additions & 0 deletions locale/en/gvv.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ check-process-btn=- Left-click : Invert selection\n- Right-click : Uncheck all /
export-import-btn=- Left-click : Export list\n- Right-click : Import list
check-for-remove=- Check this and click __1__ button at top side to remove\n- Check this and click __2__ buttons at top side to adjust order\n- You can also wheel-click the body of an entry to check/uncheck.
show_na=Show n/a
show_nil=Show nil
show_func=Show method
obj-list-tooltip=Right-click to remove
right-to-select-all=Right-click to select all
Expand All @@ -30,6 +31,11 @@ export-code-title=Export variable trace list
import-code-title=Import variable trace list
import-code-comment=Separate with [color=yellow]<newline_char>[/color](optional) .. [color=yellow]--[[]]--[/color] .. [color=yellow]<newline_char>[/color](optional), 8 ~ 10 characters.
import-code-btn=Import
search-btn=Tree entry string search
search-key=Search key
search-value=Search value
search-regexp=Use Lua pattern expression
search-case=Case sensitive

[gvv-mod-command-help]
only-admin=Only admins or player in singleplay can use this command.
Expand Down
6 changes: 6 additions & 0 deletions locale/ko/gvv.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ check-process-btn=- 좌클릭 : 선택 반전\n- 우클릭 : 모두 선택 해
export-import-btn=- 좌클릭 : 목록 내보내기\n- 우클릭 : 목록 가져오기
check-for-remove=- 삭제하려면 선택하고 상단 __1__ 버튼 클릭\n- 순서를 조절하려면 선택하고 상단 __2__ 버튼 클릭\n- 항목 자체를 휠클릭해서 이것을 선택할 수도 있음.
show_na=n/a 보이기
show_nil=nil 보이기
show_func=method 보이기
obj-list-tooltip=삭제하려면 우클릭
right-to-select-all=모두 선택하려면 우클릭
Expand All @@ -30,6 +31,11 @@ export-code-title=변수 추적 목록 내보내기
import-code-title=변수 추적 목록 가져오기
import-code-comment=[color=yellow]<newline_문자>[/color](선택) .. [color=yellow]--[[]]--[/color] .. [color=yellow]<newline_문자>[/color](선택)으로 구분, 8 ~ 10 문자.
import-code-btn=가져오기
search-btn=트리 항목 문자열 검색
search-key=key 검색
search-value=value 검색
search-regexp=Lua 패턴식 사용
search-case=대소문자 구분

[gvv-mod-command-help]
only-admin=싱글플레이의 플레이어나 관리자만 이 커맨드를 사용할 수 있습니다.
Expand Down
90 changes: 90 additions & 0 deletions modules/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,28 @@ Gui.open_main = function(player_index)
if not g.last_width then g.last_width = 900 end
if not g.last_height then g.last_height = 600 end
if g.show_na == nil then g.show_na = true end
if g.show_nil == nil then g.show_nil = true end
if g.show_func == nil then g.show_func = false end
if not g.search_settings then g.search_settings = {} end
if not g.search_settings.glob then g.search_settings.glob = {} end
if not g.search_settings.prop then g.search_settings.prop = {} end
if not g.search_settings.gobj then g.search_settings.gobj = {} end
for k, v in pairs(g.search_settings) do
if not v.text then v.text = '' end
if v.key == nil then v.key = true end
if v.value == nil then v.value = false end
if v.regexp == nil then v.regexp = false end
if v.case == nil then v.case = false end
end
if g.show_search == nil then g.show_search = false end

if not g.data then g.data = {} end
if not g.data.docked_luaobj then g.data.docked_luaobj = {} end
if not g.data.tracking_list then g.data.tracking_list = {} end
if not g.data.search then g.data.search = {} end
if not g.data.search.glob then g.data.search.glob = {} end
if not g.data.search.prop then g.data.search.prop = {} end
if not g.data.search.gobj then g.data.search.gobj = {} end

frame.location = {0,0}
frame.style.width = g.last_width
Expand Down Expand Up @@ -173,8 +191,17 @@ Gui.open_main = function(player_index)
topspace.export_import_btn.style.height = 20


topspace.add{type = 'sprite-button', name = 'search_btn', sprite = 'utility/search_white',
style = 'frame_action_button', mouse_button_filter = {'left'}, tooltip = {"gvv-mod.search-btn"},
}
topspace.search_btn.style.right_margin = 8
topspace.search_btn.style.width = 20
topspace.search_btn.style.height = 20
topspace.search_btn.visible = false
topspace.add{type = 'checkbox', name = 'chk_show_na', state = g.show_na, caption = 'n/a', tooltip = {"gvv-mod.show_na"}}
topspace.chk_show_na.visible = false
topspace.add{type = 'checkbox', name = 'chk_show_nil', state = g.show_nil, caption = 'nil', tooltip = {"gvv-mod.show_nil"}}
topspace.chk_show_nil.visible = false
topspace.add{type = 'checkbox', name = 'chk_show_func', state = g.show_func, caption = 'method', tooltip = {"gvv-mod.show_func"}}
topspace.chk_show_func.visible = false

Expand All @@ -192,7 +219,9 @@ Gui.open_main = function(player_index)
g.gui.move_down_checked_btn = topspace.move_down_checked_btn -- 사용자 개체 등록
g.gui.check_process_btn = topspace.check_process_btn -- 사용자 개체 등록
g.gui.export_import_btn = topspace.export_import_btn -- 사용자 개체 등록
g.gui.search_btn = topspace.search_btn -- 사용자 개체 등록
g.gui.chk_show_na = topspace.chk_show_na -- 사용자 개체 등록
g.gui.chk_show_nil = topspace.chk_show_nil -- 사용자 개체 등록
g.gui.chk_show_func = topspace.chk_show_func -- 사용자 개체 등록

local vdiv, hdiv
Expand Down Expand Up @@ -291,6 +320,60 @@ Gui.open_main = function(player_index)
g.gui.sub_gobjlist = sub_gobjlist -- 사용자 개체 등록
g.gui.sub_gobjtree = sub_gobjtree -- 사용자 개체 등록

local search_panels = {}
search_panels[1] = panel2.add{type = 'flow', name = 'search_glob_wrap', direction = 'horizontal', style = 'hflow_gvv-mod'}
search_panels[2] = panel3.add{type = 'flow', name = 'search_prop_wrap', direction = 'horizontal', style = 'hflow_gvv-mod'}
search_panels[3] = panel4.add{type = 'flow', name = 'search_gobj_wrap', direction = 'horizontal', style = 'hflow_gvv-mod'}
local searchinput = {}
local searchfilter_key = {}
local searchfilter_value = {}
local searchfilter_regexp = {}
local searchfilter_case= {}
local searchresult = {}
local tree_names = {'glob', 'prop', 'gobj'}
for i = 1, 3 do
local spanel = search_panels[i]
spanel.style.width = 180
spanel.style.horizontally_stretchable = false
if not g.show_search then
spanel.visible = false
end
vdiv = spanel.add{type = 'empty-widget', style = 'vertical-divider_gvv-mod'}
vdiv.style.width = 6
local vwrap = spanel.add{type = 'flow', name = 'vwrap', direction = 'vertical', style = 'vflow_gvv-mod'}
local swrap = vwrap.add{type = 'flow', name = 'swrap', direction = 'horizontal', style = 'hflow_gvv-mod'}
searchinput[i] = swrap.add{type = 'textfield',
text = g.search_settings[tree_names[i] ].text, name = 'searchinput',
}
searchinput[i].style.minimal_width = 50
searchinput[i].style.maximal_width = 9999
searchinput[i].style.horizontally_stretchable = true
local filter_wrap = swrap.add{type = 'table', column_count = 2}
filter_wrap.style.horizontal_spacing = 0
filter_wrap.style.vertical_spacing = 0
searchfilter_key[i] = filter_wrap.add{type = 'checkbox', tooltip = {"gvv-mod.search-key"},
state = g.search_settings[tree_names[i] ].key, name = 'searchfilter_key',
}
searchfilter_value[i] = filter_wrap.add{type = 'checkbox', tooltip = {"gvv-mod.search-value"},
state = g.search_settings[tree_names[i] ].value, name = 'searchfilter_value',
}
searchfilter_regexp[i] = filter_wrap.add{type = 'checkbox', tooltip = {"gvv-mod.search-regexp"},
state = g.search_settings[tree_names[i] ].regexp, name = 'searchfilter_regexp',
}
searchfilter_case[i] = filter_wrap.add{type = 'checkbox', tooltip = {"gvv-mod.search-case"},
state = g.search_settings[tree_names[i] ].case, name = 'searchfilter_case',
}
searchresult[i] = vwrap.add{type = 'list-box', name = 'sresult', style = 'list_box-transparent_gvv-mod'}
searchresult[i].style.horizontally_stretchable = true
g.gui['search_'..tree_names[i]..'_wrap'] = search_panels[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_input'] = searchinput[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_fkey'] = searchfilter_key[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_fvalue'] = searchfilter_value[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_fregexp'] = searchfilter_regexp[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_fcase'] = searchfilter_case[i] -- 사용자 개체 등록
g.gui['search_'..tree_names[i]..'_result'] = searchresult[i] -- 사용자 개체 등록
end

local tab5 = tabpane.add{type = 'tab', name = 'tab5', caption = {"gvv-mod.help-tab"}}
local cwrap5 = tabpane.add{type = 'flow', direction = 'vertical'}
cwrap5.style.horizontally_stretchable = true
Expand Down Expand Up @@ -480,11 +563,18 @@ Gui.change_tab = function(g, index)
end
if tab == 3 or tab == 4 then
g.gui.chk_show_na.visible = true
g.gui.chk_show_nil.visible = true
g.gui.chk_show_func.visible = true
else
g.gui.chk_show_na.visible = false
g.gui.chk_show_nil.visible = false
g.gui.chk_show_func.visible = false
end
if tab > 1 and tab < 5 then
g.gui.search_btn.visible = true
else
g.gui.search_btn.visible = false
end
end

-- 내용을 복사할 수 있는 미니 윈도우2
Expand Down
Loading

0 comments on commit c41e79d

Please sign in to comment.