Update LAM to r16

Scott Yeskie [11-17-14 - 19:28]
Update LAM to r16
Filename
lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
lib/LibAddonMenu-2.0/controls/button.lua
lib/LibAddonMenu-2.0/controls/checkbox.lua
lib/LibAddonMenu-2.0/controls/colorpicker.lua
lib/LibAddonMenu-2.0/controls/dropdown.lua
lib/LibAddonMenu-2.0/controls/editbox.lua
lib/LibAddonMenu-2.0/controls/slider.lua
lib/LibAddonMenu-2.0/controls/submenu.lua
lib/LibAddonMenu-2.0/controls/texture.lua
diff --git a/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
index 9fa5c80..1ab94cf 100644
--- a/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
+++ b/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
@@ -7,7 +7,7 @@


 --Register LAM with LibStub
-local MAJOR, MINOR = "LibAddonMenu-2.0", 14
+local MAJOR, MINOR = "LibAddonMenu-2.0", 16
 local lam, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
 if not lam then return end	--the same or newer version of this lib is already loaded into memory

@@ -57,11 +57,12 @@ function lam:OpenToPanel(panel)
 	zo_callLater(function()
 			ZO_GameMenu_InGame.gameMenu.headerControls[locSettings]:SetOpen(true)
 			SCENE_MANAGER:AddFragment(OPTIONS_WINDOW_FRAGMENT)
-			ZO_OptionsWindow_ChangePanels(lam.panelID)
-			if not lam.panelSubCategoryControl then
-				lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)]
-			end
-			ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true)
+			--ZO_OptionsWindow_ChangePanels(lam.panelID)
+			KEYBOARD_OPTIONS:ChangePanels(lam.panelID)
+			--if not lam.panelSubCategoryControl then
+			--	lam.panelSubCategoryControl = _G["ZO_GameMenu_InGameNavigationContainerScrollChildZO_GameMenu_SubCategory"..(lam.panelID + 1)]
+			--end
+			--ZO_TreeEntry_OnMouseUp(lam.panelSubCategoryControl, true)
 			panel:SetHidden(false)
 		end, 200)
 end
@@ -197,7 +198,7 @@ local dummyFunc = function() end
 local panelWindow = ZO_OptionsWindow
 local bgL = ZO_OptionsWindowBGLeft
 local bgR = ZO_OptionsWindowBGLeftBGRight
-local function HandlePanelSwitching(panel)
+local function HandlePanelSwitching(self, panel)
 	if panel == lam.panelID then	--our addon settings panel
 		oldDefaultButton:SetCallback(dummyFunc)
 		oldDefaultButton:SetHidden(true)
@@ -225,13 +226,21 @@ local function CreateAddonSettingsPanel()
 		local controlPanelID = "LAM_ADDON_SETTINGS_PANEL"
 		--Russian for TERAB1T's RuESO addon, which creates an "ru" locale
 		--game font does not support Cyrillic, so they are using custom fonts + extended latin charset
-		local controlPanelNames = {en = "Addon Settings", fr = "Extensions", de = "Erweiterungen", ru = "Îacòpoéêè äoïoìîeîèé"}
+		--Spanish provided by Luisen75 for their translation project
+		local controlPanelNames = {
+			en = "Addon Settings",
+			fr = "Extensions",
+			de = "Erweiterungen",
+			ru = "Îacòpoéêè äoïoìîeîèé",
+			es = "Configura Addons",
+		}

 		ZO_OptionsWindow_AddUserPanel(controlPanelID, controlPanelNames[GetCVar("Language.2")] or controlPanelName["en"])

 		lam.panelID = _G[controlPanelID]

-		ZO_PreHook("ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
+		--ZO_PreHook("ZO_OptionsWindow_ChangePanels", HandlePanelSwitching)
+		ZO_PreHook(ZO_SharedOptions, "ChangePanels", HandlePanelSwitching)

 		LAMSettingsPanelCreated = true
 	end
@@ -294,12 +303,12 @@ local function CreateAddonList()
 			if self.currentlySelected then self.currentlySelected:SetHidden(false) end
 		end)

-	list.controlType = OPTIONS_CUSTOM
-	list.panel = lam.panelID
-
-	list.data = {}
-    list.data.controlType = OPTIONS_CUSTOM
-    list.data.panel = lam.panelID
+	--list.controlType = OPTIONS_CUSTOM
+	--list.panel = lam.panelID
+	list.data = {
+		controlType = OPTIONS_CUSTOM,
+		panel = lam.panelID,
+	}

 	ZO_OptionsWindow_InitializeControl(list)

diff --git a/lib/LibAddonMenu-2.0/controls/button.lua b/lib/LibAddonMenu-2.0/controls/button.lua
index 090a812..187e901 100644
--- a/lib/LibAddonMenu-2.0/controls/button.lua
+++ b/lib/LibAddonMenu-2.0/controls/button.lua
@@ -11,7 +11,7 @@
 }	]]


-local widgetVersion = 3
+local widgetVersion = 5
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("button", widgetVersion) then return end

@@ -54,7 +54,8 @@ function LAMCreateControl.button(parent, buttonData, controlName)
 	local button = control.button
 	button:SetAnchor(isHalfWidth and CENTER or RIGHT)
 	button:SetClickSound("Click")
-	button.tooltipText = buttonData.tooltip
+	--button.tooltipText = buttonData.tooltip
+	button.data = {tooltipText = buttonData.tooltip}
 	button:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 	button:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
 	button:SetHandler("OnClicked", function(self, ...)
@@ -67,7 +68,8 @@ function LAMCreateControl.button(parent, buttonData, controlName)
 	if buttonData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(RIGHT, button, LEFT, -5, 0)
-		control.warning.tooltipText = buttonData.warning
+		--control.warning.tooltipText = buttonData.warning
+		control.warning.data = {tooltipText = buttonData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is its parent
diff --git a/lib/LibAddonMenu-2.0/controls/checkbox.lua b/lib/LibAddonMenu-2.0/controls/checkbox.lua
index b178043..a777c7d 100644
--- a/lib/LibAddonMenu-2.0/controls/checkbox.lua
+++ b/lib/LibAddonMenu-2.0/controls/checkbox.lua
@@ -12,7 +12,7 @@
 }	]]


-local widgetVersion = 5
+local widgetVersion = 7
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("checkbox", widgetVersion) then return end

@@ -107,7 +107,7 @@ function LAMCreateControl.checkbox(parent, checkboxData, controlName)
 	local control = wm:CreateTopLevelWindow(controlName or checkboxData.reference)
 	control:SetParent(parent.scroll or parent)
 	control:SetMouseEnabled(true)
-	control.tooltipText = checkboxData.tooltip
+	--control.tooltipText = checkboxData.tooltip
 	control:SetHandler("OnMouseEnter", OnMouseEnter)
 	control:SetHandler("OnMouseExit", OnMouseExit)
 	control:SetHandler("OnMouseUp", function(control)
@@ -149,11 +149,13 @@ function LAMCreateControl.checkbox(parent, checkboxData, controlName)
 	if checkboxData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(RIGHT, checkbox, LEFT, -5, 0)
-		control.warning.tooltipText = checkboxData.warning
+		--control.warning.tooltipText = checkboxData.warning
+		control.warning.data = {tooltipText = checkboxData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is its parent
 	control.data = checkboxData
+	control.data.tooltipText = checkboxData.tooltip

 	if checkboxData.disabled then
 		control.UpdateDisabled = UpdateDisabled
diff --git a/lib/LibAddonMenu-2.0/controls/colorpicker.lua b/lib/LibAddonMenu-2.0/controls/colorpicker.lua
index 42e8e25..abd9ba4 100644
--- a/lib/LibAddonMenu-2.0/controls/colorpicker.lua
+++ b/lib/LibAddonMenu-2.0/controls/colorpicker.lua
@@ -7,12 +7,12 @@
 	width = "full",	--or "half" (optional)
 	disabled = function() return db.someBooleanSetting end,	--or boolean (optional)
 	warning = "Will need to reload the UI.",	--(optional)
-	default = {defaults.r, defaults.g, defaults.b, defaults.a},	--(optional) table of default color values
+	default = {r = defaults.r, g = defaults.g, b = defaults.b, a = defaults.a},	--(optional) table of default color values (or default = defaultColor, where defaultColor is a table with keys of r, g, b[, a])
 	reference = "MyAddonColorpicker"	--(optional) unique global reference to control
 }	]]


-local widgetVersion = 3
+local widgetVersion = 5
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("colorpicker", widgetVersion) then return end

@@ -61,7 +61,7 @@ function LAMCreateControl.colorpicker(parent, colorpickerData, controlName)
 	local control = wm:CreateTopLevelWindow(controlName or colorpickerData.reference)
 	control:SetParent(parent.scroll or parent)
 	control:SetMouseEnabled(true)
-	control.tooltipText = colorpickerData.tooltip
+	--control.tooltipText = colorpickerData.tooltip
 	control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 	control:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)

@@ -117,11 +117,13 @@ function LAMCreateControl.colorpicker(parent, colorpickerData, controlName)
 	if colorpickerData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(RIGHT, control.color, LEFT, -5, 0)
-		control.warning.tooltipText = colorpickerData.warning
+		--control.warning.tooltipText = colorpickerData.warning
+		control.warning.data = {tooltipText = colorpickerData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is its parent
 	control.data = colorpickerData
+	control.data.tooltipText = colorpickerData.tooltip

 	if colorpickerData.disabled then
 		control.UpdateDisabled = UpdateDisabled
diff --git a/lib/LibAddonMenu-2.0/controls/dropdown.lua b/lib/LibAddonMenu-2.0/controls/dropdown.lua
index 4ced295..94cd820 100644
--- a/lib/LibAddonMenu-2.0/controls/dropdown.lua
+++ b/lib/LibAddonMenu-2.0/controls/dropdown.lua
@@ -14,7 +14,7 @@
 }	]]


-local widgetVersion = 5
+local widgetVersion = 7
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("dropdown", widgetVersion) then return end

@@ -88,7 +88,7 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
 	local control = wm:CreateTopLevelWindow(controlName or dropdownData.reference)
 	control:SetParent(parent.scroll or parent)
 	control:SetMouseEnabled(true)
-	control.tooltipText = dropdownData.tooltip
+	--control.tooltipText = dropdownData.tooltip
 	control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 	control:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)

@@ -128,11 +128,13 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
 	if dropdownData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(RIGHT, combobox, LEFT, -5, 0)
-		control.warning.tooltipText = dropdownData.warning
+		--control.warning.tooltipText = dropdownData.warning
+		control.warning.data = {tooltipText = dropdownData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is its parent
 	control.data = dropdownData
+	control.data.tooltipText = dropdownData.tooltip

 	if dropdownData.disabled then
 		control.UpdateDisabled = UpdateDisabled
diff --git a/lib/LibAddonMenu-2.0/controls/editbox.lua b/lib/LibAddonMenu-2.0/controls/editbox.lua
index 3b92ea0..0d273d3 100644
--- a/lib/LibAddonMenu-2.0/controls/editbox.lua
+++ b/lib/LibAddonMenu-2.0/controls/editbox.lua
@@ -13,7 +13,7 @@
 }	]]


-local widgetVersion = 4
+local widgetVersion = 6
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("editbox", widgetVersion) then return end

@@ -64,7 +64,7 @@ function LAMCreateControl.editbox(parent, editboxData, controlName)
 	control:SetParent(parent.scroll or parent)
 	control:SetMouseEnabled(true)
 	control:SetResizeToFitDescendents(true)
-	control.tooltipText = editboxData.tooltip
+	--control.tooltipText = editboxData.tooltip
 	control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 	control:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)

@@ -132,11 +132,13 @@ function LAMCreateControl.editbox(parent, editboxData, controlName)
 	if editboxData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(TOPRIGHT, control.bg, TOPLEFT, -5, 0)
-		control.warning.tooltipText = editboxData.warning
+		--control.warning.tooltipText = editboxData.warning
+		control.warning.data = {tooltipText = editboxData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is its parent
 	control.data = editboxData
+	control.data.tooltipText = editboxData.tooltip

 	if editboxData.disabled then
 		control.UpdateDisabled = UpdateDisabled
diff --git a/lib/LibAddonMenu-2.0/controls/slider.lua b/lib/LibAddonMenu-2.0/controls/slider.lua
index d26f314..f7ab0a3 100644
--- a/lib/LibAddonMenu-2.0/controls/slider.lua
+++ b/lib/LibAddonMenu-2.0/controls/slider.lua
@@ -15,7 +15,7 @@
 }	]]


-local widgetVersion = 3
+local widgetVersion = 5
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("slider", widgetVersion) then return end

@@ -77,7 +77,7 @@ function LAMCreateControl.slider(parent, sliderData, controlName)
 		control:SetDimensions(510, 40)
 	end
 	control:SetMouseEnabled(true)
-	control.tooltipText = sliderData.tooltip
+	--control.tooltipText = sliderData.tooltip
 	control:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 	control:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)

@@ -161,11 +161,13 @@ function LAMCreateControl.slider(parent, sliderData, controlName)
 	if sliderData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
 		control.warning:SetAnchor(RIGHT, slider, LEFT, -5, 0)
-		control.warning.tooltipText = sliderData.warning
+		--control.warning.tooltipText = sliderData.warning
+		control.warning.data = {tooltipText = sliderData.warning}
 	end

 	control.panel = parent.panel or parent	--if this is in a submenu, panel is the submenu's parent
 	control.data = sliderData
+	control.data.tooltipText = sliderData.tooltip

 	if sliderData.disabled then
 		control.UpdateDisabled = UpdateDisabled
diff --git a/lib/LibAddonMenu-2.0/controls/submenu.lua b/lib/LibAddonMenu-2.0/controls/submenu.lua
index 41e8402..761dda5 100644
--- a/lib/LibAddonMenu-2.0/controls/submenu.lua
+++ b/lib/LibAddonMenu-2.0/controls/submenu.lua
@@ -6,7 +6,7 @@
 	reference = "MyAddonSubmenu"	--(optional) unique global reference to control
 }	]]

-local widgetVersion = 5
+local widgetVersion = 7
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("submenu", widgetVersion) then return end

@@ -18,7 +18,8 @@ local tinsert = table.insert
 local function UpdateValue(control)
 	control.label:SetText(control.data.name)
 	if control.data.tooltip then
-		control.label.tooltipText = control.data.tooltip
+		--control.label.tooltipText = control.data.tooltip
+		control.label.data = {tooltipText = control.data.tooltip}
 	end
 end

@@ -48,7 +49,8 @@ function LAMCreateControl.submenu(parent, submenuData, controlName)
 	label:SetText(submenuData.name)
 	label:SetMouseEnabled(true)
 	if submenuData.tooltip then
-		label.tooltipText = submenuData.tooltip
+		--label.tooltipText = submenuData.tooltip
+		label.data = {tooltipText = submenuData.tooltip}
 		label:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 		label:SetHandler("OnMouseExit", ZO_Options_OnMouseExit)
 	end
diff --git a/lib/LibAddonMenu-2.0/controls/texture.lua b/lib/LibAddonMenu-2.0/controls/texture.lua
index 8ce85de..928ab82 100644
--- a/lib/LibAddonMenu-2.0/controls/texture.lua
+++ b/lib/LibAddonMenu-2.0/controls/texture.lua
@@ -10,7 +10,7 @@

 --add texture coords support?

-local widgetVersion = 3
+local widgetVersion = 5
 local LAM = LibStub("LibAddonMenu-2.0")
 if not LAM:RegisterWidget("texture", widgetVersion) then return end

@@ -38,7 +38,8 @@ function LAMCreateControl.texture(parent, textureData, controlName)

 	if textureData.tooltip then
 		texture:SetMouseEnabled(true)
-		texture.tooltipText = textureData.tooltip
+		--texture.tooltipText = textureData.tooltip
+		texture.data = {tooltipText = textureData.tooltip}
 		texture:SetHandler("OnMouseEnter", ZO_Options_OnMouseEnter)
 		texture:SetHandler("OnMouseEnter", ZO_Options_OnMouseExit)
 	end