diff --git a/Bindings.xml b/Bindings.xml deleted file mode 100755 index adea7a2..0000000 --- a/Bindings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - zzCoords_MinimapToggle() - diff --git a/locale_enUS.lua b/locale_enUS.lua index b177803..10bf4c7 100644 --- a/locale_enUS.lua +++ b/locale_enUS.lua @@ -2,5 +2,6 @@ local addonname, addon = ... local childName = addon['childName'] local L = LibStub("AceLocale-3.0"):NewLocale(childName, "enUS", true) if L then - L[childName] = childName + L['Toggle Minimap-Icons'] = true + L['Show or Hide all Icons of childs'] = true end \ No newline at end of file diff --git a/prefs.lua b/prefs.lua index 6be94df..bb614b4 100644 --- a/prefs.lua +++ b/prefs.lua @@ -1,12 +1,40 @@ local addonName, addon = ... local childName = addon['childName'] local child = addon[childName] + +local ldbicon = LibStub:GetLibrary("LibDBIcon-1.0") +local L = LibStub("AceLocale-3.0"):GetLocale(childName, true) +local function toggleChilds() + local childs = child['children'] + if(#childs > 0) then + print("Found parent", child['specs']['name'],"with childs",#childs) + local sb = addon['db']['global']['ldbicons'] + for i = 1, #childs do + local cName = childs[i]['specs']['name'] + if(cName) then + sb[cName] = sb[cName] or { + ['hide'] = true + } + sb[cName]['hide'] = not sb[cName]['hide'] + if(ldbicon) then + if(sb[cName]['hide']) then + ldbicon:Hide(cName) + else + ldbicon:Show(cName) + end + end + end + end + end +end + + local init = { Setup = function() local config = LibStub:GetLibrary("zzConfig") local options = child['options'] local main = options['args'][childName] + config:AddConfigEntry(main, "toggleChilds", "execute", L['Toggle Minimap-Icons'], L['Show or Hide all Icons of childs'], 3, toggleChilds) end } ---print('reg', format("Init%s", childName)) ---addon.RegisterCallback(init, format("Init%s", childName), 'Setup') \ No newline at end of file +addon.RegisterCallback(init, format("Init%s", childName), 'Setup') \ No newline at end of file