fixed ultimate keybind display showing extra buttons

Kith [03-10-16 - 02:10]
fixed ultimate keybind display showing extra buttons
updated LibAddonMenu to r19
Filename
ActionBar.lua
Azurah.txt
Core.lua
Lib/LibAddonMenu-2.0/LICENSE
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/description.lua
Lib/LibAddonMenu-2.0/controls/dropdown.lua
Lib/LibAddonMenu-2.0/controls/editbox.lua
Lib/LibAddonMenu-2.0/controls/iconpicker.lua
Lib/LibAddonMenu-2.0/controls/slider.lua
diff --git a/ActionBar.lua b/ActionBar.lua
index a70c4ee..e3a9200 100644
--- a/ActionBar.lua
+++ b/ActionBar.lua
@@ -97,12 +97,22 @@ function Azurah:ConfigureActionBarElements()

 	ZO_ActionBar1KeybindBG:SetAlpha(db.hideBindBG and 0 or 1)

-	for x = 3, 9 do
+	for x = 3, 7 do
 		_G['ActionButton' .. x .. 'ButtonText']:SetAlpha(db.hideBindText and 0 or 1)
 		_G['ActionButton' .. x .. 'ButtonText']:SetHidden(db.hideBindText)
 	end
-end

+	if (IsInGamepadPreferredMode()) then -- special case to handle changes to ultimate button in Gamepad mode
+		_G['ActionButton8LBkey']:SetAlpha(db.hideBindText and 0 or 1)
+		_G['ActionButton8LBkey']:SetHidden(db.hideBindText)
+
+		_G['ActionButton8RBkey']:SetAlpha(db.hideBindText and 0 or 1)
+		_G['ActionButton8RBkey']:SetHidden(db.hideBindText)
+	else
+		_G['ActionButton8ButtonText']:SetAlpha(db.hideBindText and 0 or 1)
+		_G['ActionButton8ButtonText']:SetHidden(db.hideBindText)
+	end
+end

 -- ------------------------
 -- INITIALIZATION
diff --git a/Azurah.txt b/Azurah.txt
index f2adfa2..84d7ed8 100644
--- a/Azurah.txt
+++ b/Azurah.txt
@@ -1,6 +1,6 @@
 ## Title: |c67b1e9A|c4779cezurah|r
 ## Description: Enhances the default interface with additional overlay details and customization options while retaining the stock theme.
-## Version: 2.2.2
+## Version: 2.2.3
 ## Author: Kith, |cEFEBBEGarkin|r, |c66ccffPhinix|r, |c68D2E8Sounomi|r
 ## APIVersion: 100014
 ## SavedVariables: AzurahDB
diff --git a/Core.lua b/Core.lua
index e20254b..3080bc9 100644
--- a/Core.lua
+++ b/Core.lua
@@ -5,7 +5,7 @@
 	* stock interface with optional components to provide
 	* additional information while maintaining the stock feel.
 	*
-	* Version 2.2.2
+	* Version 2.2.3
 	* Kith, Garkin, Phinix, Sounomi
 	*
 	*
@@ -15,7 +15,7 @@ local L				= Azurah:GetLocale()

 Azurah.name			= 'Azurah'
 Azurah.slash		= '/azurah'
-Azurah.version		= '2.2.2'
+Azurah.version		= '2.2.3'
 Azurah.versionDB	= 2

 Azurah.movers		= {}
@@ -85,6 +85,7 @@ function Azurah.OnPreferredModeChanged(evt, gamepadPreferred)

 	Azurah:InitializeUnlock()
 	Azurah:ConfigureTargetIcons()
+	Azurah:ConfigureActionBarElements()
 	Azurah:ConfigureExperienceBarOverlay()

 	if (gamepadPreferred) then
diff --git a/Lib/LibAddonMenu-2.0/LICENSE b/Lib/LibAddonMenu-2.0/LICENSE
index 82fcf2f..f69cbd4 100644
--- a/Lib/LibAddonMenu-2.0/LICENSE
+++ b/Lib/LibAddonMenu-2.0/LICENSE
@@ -1,6 +1,6 @@
                The Artistic License 2.0

-           Copyright (c) 2015 Ryan Lakanen (Seerah)
+           Copyright (c) 2016 Ryan Lakanen (Seerah)

      Everyone is permitted to copy and distribute verbatim copies
       of this license document, but changing it is not allowed.
diff --git a/Lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/Lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
index dcbf151..568b95d 100644
--- a/Lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
+++ b/Lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua
@@ -4,7 +4,7 @@


 --Register LAM with LibStub
-local MAJOR, MINOR = "LibAddonMenu-2.0", 18
+local MAJOR, MINOR = "LibAddonMenu-2.0", 19
 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

@@ -61,7 +61,9 @@ local function CreateBaseControl(parent, controlData, controlName)
 	control.data = controlData

 	control.isHalfWidth = controlData.width == "half"
-	control:SetWidth(control.panel:GetWidth() - 60)
+	local width = 510 -- set default width in case a custom parent object is passed
+	if control.panel.GetWidth ~= nil then width = control.panel:GetWidth() - 60 end
+	control:SetWidth(width)
 	return control
 end

@@ -282,6 +284,30 @@ function lam:OpenToPanel(panel)
 	end
 end

+local TwinOptionsContainer_Index = 0
+local function TwinOptionsContainer(parent, leftWidget, rightWidget)
+	TwinOptionsContainer_Index = TwinOptionsContainer_Index + 1
+	local cParent = parent.scroll or parent
+	local panel = parent.panel or cParent
+	local container = wm:CreateControl("$(parent)TwinContainer" .. tostring(TwinOptionsContainer_Index),
+										cParent, CT_CONTROL)
+	container:SetResizeToFitDescendents(true)
+	container:SetAnchor(select(2, leftWidget:GetAnchor(0) ))
+
+	leftWidget:ClearAnchors()
+	leftWidget:SetAnchor(TOPLEFT, container, TOPLEFT)
+	rightWidget:SetAnchor(TOPLEFT, leftWidget, TOPRIGHT, 5, 0)
+
+	leftWidget:SetWidth( leftWidget:GetWidth() - 2.5 ) -- fixes bad alignment with 'full' controls
+	rightWidget:SetWidth( rightWidget:GetWidth() - 2.5 )
+
+	leftWidget:SetParent(container)
+	rightWidget:SetParent(container)
+
+	container.data = {type = "container"}
+	container.panel = panel
+	return container
+end

 --INTERNAL FUNCTION
 --creates controls when options panel is first shown
@@ -302,12 +328,12 @@ local function CreateOptionsControls(panel)
 					widget:SetAnchor(TOPLEFT)
 					anchorTarget = widget
 				elseif wasHalf and isHalf then -- when the previous widget was only half width and this one is too, we place it on the right side
-					widget:SetAnchor(TOPLEFT, anchorTarget, TOPRIGHT, 5 + (offsetX or 0), 0)
 					widget.lineControl = anchorTarget
-					offsetY = zo_max(0, widget:GetHeight() - anchorTarget:GetHeight()) -- we need to get the common height of both widgets to know where the next row starts
 					isHalf = false
+					offsetY = 0
+					anchorTarget = TwinOptionsContainer(parent, anchorTarget, widget)
 				else -- otherwise we just put it below the previous one normally
-					widget:SetAnchor(TOPLEFT, anchorTarget, BOTTOMLEFT, 0, 15 + offsetY)
+					widget:SetAnchor(TOPLEFT, anchorTarget, BOTTOMLEFT, 0, 15)
 					offsetY = 0
 					anchorTarget = widget
 				end
diff --git a/Lib/LibAddonMenu-2.0/controls/button.lua b/Lib/LibAddonMenu-2.0/controls/button.lua
index 1c92003..7489872 100644
--- a/Lib/LibAddonMenu-2.0/controls/button.lua
+++ b/Lib/LibAddonMenu-2.0/controls/button.lua
@@ -11,7 +11,7 @@
 }	]]


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

@@ -75,7 +75,7 @@ function LAMCreateControl.button(parent, buttonData, controlName)
 		control.warning.data = {tooltipText = buttonData.warning}
 	end

-	if buttonData.disabled then
+	if buttonData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()

@@ -86,4 +86,4 @@ function LAMCreateControl.button(parent, buttonData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end
diff --git a/Lib/LibAddonMenu-2.0/controls/checkbox.lua b/Lib/LibAddonMenu-2.0/controls/checkbox.lua
index 07f3746..46fe069 100644
--- a/Lib/LibAddonMenu-2.0/controls/checkbox.lua
+++ b/Lib/LibAddonMenu-2.0/controls/checkbox.lua
@@ -12,7 +12,7 @@
 }	]]


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

@@ -129,7 +129,7 @@ function LAMCreateControl.checkbox(parent, checkboxData, controlName)

 	control.data.tooltipText = LAM.util.GetTooltipText(checkboxData.tooltip)

-	if checkboxData.disabled then
+	if checkboxData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
@@ -141,4 +141,4 @@ function LAMCreateControl.checkbox(parent, checkboxData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end
diff --git a/Lib/LibAddonMenu-2.0/controls/colorpicker.lua b/Lib/LibAddonMenu-2.0/controls/colorpicker.lua
index 489f462..184a2e4 100644
--- a/Lib/LibAddonMenu-2.0/controls/colorpicker.lua
+++ b/Lib/LibAddonMenu-2.0/controls/colorpicker.lua
@@ -12,7 +12,7 @@
 }	]]


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

@@ -95,7 +95,7 @@ function LAMCreateControl.colorpicker(parent, colorpickerData, controlName)

 	control.data.tooltipText = LAM.util.GetTooltipText(colorpickerData.tooltip)

-	if colorpickerData.disabled then
+	if colorpickerData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
@@ -107,4 +107,4 @@ function LAMCreateControl.colorpicker(parent, colorpickerData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end
diff --git a/Lib/LibAddonMenu-2.0/controls/description.lua b/Lib/LibAddonMenu-2.0/controls/description.lua
index 7fa983f..233d525 100644
--- a/Lib/LibAddonMenu-2.0/controls/description.lua
+++ b/Lib/LibAddonMenu-2.0/controls/description.lua
@@ -7,7 +7,7 @@
 }	]]


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

@@ -21,7 +21,6 @@ local function UpdateValue(control)
 	control.desc:SetText(control.data.text)
 end

-local MIN_HEIGHT = 26
 function LAMCreateControl.description(parent, descriptionData, controlName)
 	local control = LAM.util.CreateBaseControl(parent, descriptionData, controlName)
 	local isHalfWidth = control.isHalfWidth
@@ -29,9 +28,9 @@ function LAMCreateControl.description(parent, descriptionData, controlName)
 	control:SetResizeToFitDescendents(true)

 	if isHalfWidth then
-		control:SetDimensionConstraints(width / 2, MIN_HEIGHT, width / 2, MIN_HEIGHT * 4)
+		control:SetDimensionConstraints(width / 2, 0, width / 2, 0)
 	else
-		control:SetDimensionConstraints(width, MIN_HEIGHT, width, MIN_HEIGHT * 4)
+		control:SetDimensionConstraints(width, 0, width, 0)
 	end

 	control.desc = wm:CreateControl(nil, control, CT_LABEL)
diff --git a/Lib/LibAddonMenu-2.0/controls/dropdown.lua b/Lib/LibAddonMenu-2.0/controls/dropdown.lua
index 6ce11b4..5bdd546 100644
--- a/Lib/LibAddonMenu-2.0/controls/dropdown.lua
+++ b/Lib/LibAddonMenu-2.0/controls/dropdown.lua
@@ -14,7 +14,7 @@
 }	]]


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

@@ -114,7 +114,7 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
 		control.warning.data = {tooltipText = dropdownData.warning}
 	end

-	if dropdownData.disabled then
+	if dropdownData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
@@ -128,4 +128,4 @@ function LAMCreateControl.dropdown(parent, dropdownData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end
diff --git a/Lib/LibAddonMenu-2.0/controls/editbox.lua b/Lib/LibAddonMenu-2.0/controls/editbox.lua
index 676bd8d..1f9bb47 100644
--- a/Lib/LibAddonMenu-2.0/controls/editbox.lua
+++ b/Lib/LibAddonMenu-2.0/controls/editbox.lua
@@ -4,7 +4,8 @@
 	tooltip = "Editbox's tooltip text.",
 	getFunc = function() return db.text end,
 	setFunc = function(text) db.text = text doStuff() end,
-	isMultiline = true,	--boolean
+	isMultiline = true,	--boolean (optional)
+	isExtraWide = true,	--boolean (optional)
 	width = "full",	--or "half" (optional)
 	disabled = function() return db.someBooleanSetting end,	--or boolean (optional)
 	warning = "Will need to reload the UI.",	--(optional)
@@ -13,7 +14,7 @@
 }	]]


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

@@ -58,7 +59,7 @@ local function UpdateValue(control, forceDefault, value)
 	end
 end

-local MIN_HEIGHT = 26
+local MIN_HEIGHT = 24
 local HALF_WIDTH_LINE_SPACING = 2
 function LAMCreateControl.editbox(parent, editboxData, controlName)
 	local control = LAM.util.CreateLabelAndContainerControl(parent, editboxData, controlName)
@@ -100,28 +101,51 @@ function LAMCreateControl.editbox(parent, editboxData, controlName)
 	editbox:SetHandler("OnMouseEnter", function() ZO_Options_OnMouseEnter(control) end)
 	editbox:SetHandler("OnMouseExit", function() ZO_Options_OnMouseExit(control) end)

-	if not editboxData.isMultiline then
-		container:SetHeight(24)
+	local MIN_WIDTH = (parent.GetWidth and (parent:GetWidth() / 10)) or (parent.panel.GetWidth and (parent.panel:GetWidth() / 10)) or 0
+
+	control.label:ClearAnchors()
+	container:ClearAnchors()
+
+	control.label:SetAnchor(TOPLEFT, control, TOPLEFT, 0, 0)
+	container:SetAnchor(BOTTOMRIGHT, control, BOTTOMRIGHT, 0, 0)
+
+	if control.isHalfWidth then
+		container:SetAnchor(BOTTOMRIGHT, control, BOTTOMRIGHT, 0, 0)
+	end
+
+	if editboxData.isExtraWide then
+		container:SetAnchor(BOTTOMLEFT, control, BOTTOMLEFT, 0, 0)
 	else
-		local width = container:GetWidth()
-		local height = control.isHalfWidth and 74 or 100
-		container:SetHeight(height)
-		editbox:SetDimensionConstraints(width, height, width, 500)
+		container:SetWidth(MIN_WIDTH * 3.2)
+	end

-		if control.lineControl then
-			control.lineControl:SetHeight(MIN_HEIGHT + height + HALF_WIDTH_LINE_SPACING)
-		else
-			control:SetHeight(height)
-		end
+	if editboxData.isMultiline then
+		container:SetHeight(MIN_HEIGHT * 3)
+	else
+		container:SetHeight(MIN_HEIGHT)
+	end
+
+	if control.isHalfWidth ~= true and editboxData.isExtraWide ~= true then
+		control:SetHeight(container:GetHeight())
+	else
+		control:SetHeight(container:GetHeight() + control.label:GetHeight())
 	end

+	editbox:ClearAnchors()
+	editbox:SetAnchor(TOPLEFT, container, TOPLEFT, 2, 2)
+	editbox:SetAnchor(BOTTOMRIGHT, container, BOTTOMRIGHT, -2, -2)
+
 	if editboxData.warning then
 		control.warning = wm:CreateControlFromVirtual(nil, control, "ZO_Options_WarningIcon")
-		control.warning:SetAnchor(TOPRIGHT, control.bg, TOPLEFT, -5, 0)
+		if editboxData.isExtraWide then
+			control.warning:SetAnchor(BOTTOMRIGHT, control.bg, TOPRIGHT, 2, 0)
+		else
+			control.warning:SetAnchor(TOPRIGHT, control.bg, TOPLEFT, -5, 0)
+		end
 		control.warning.data = {tooltipText = editboxData.warning}
 	end

-	if editboxData.disabled then
+	if editboxData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
@@ -133,4 +157,4 @@ function LAMCreateControl.editbox(parent, editboxData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end
diff --git a/Lib/LibAddonMenu-2.0/controls/iconpicker.lua b/Lib/LibAddonMenu-2.0/controls/iconpicker.lua
index b8737c2..93c47f3 100644
--- a/Lib/LibAddonMenu-2.0/controls/iconpicker.lua
+++ b/Lib/LibAddonMenu-2.0/controls/iconpicker.lua
@@ -18,7 +18,7 @@
 	reference = "MyAddonIconPicker"	--(optional) unique global reference to control
 }	]]

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

@@ -32,7 +32,7 @@ LAM.util.GetIconPickerMenu = function()
 	if not iconPicker then
 		iconPicker = IconPickerMenu:New("LAMIconPicker")
 		local sceneFragment = LAM:GetAddonSettingsFragment()
-		ZO_PreHook(sceneFragment, "OnHidden", function()
+		ZO_PreHook(sceneFragment, "OnHidden", function()
 			if not iconPicker.control:IsHidden() then
 				iconPicker:Clear()
 			end
@@ -253,7 +253,7 @@ end
 local function UpdateChoices(control, choices, choicesTooltips)
 	local data = control.data
 	if not choices then
-		choices, choicesTooltips = data.choices, data.choicesTooltips
+		choices, choicesTooltips = data.choices, data.choicesTooltips or {}
 	end
 	local addedChoices = {}

@@ -420,7 +420,7 @@ function LAMCreateControl.iconpicker(parent, iconpickerData, controlName)
 		control.warning.data = {tooltipText = iconpickerData.warning}
 	end

-	if iconpickerData.disabled then
+	if iconpickerData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
diff --git a/Lib/LibAddonMenu-2.0/controls/slider.lua b/Lib/LibAddonMenu-2.0/controls/slider.lua
index 5a2cb66..fa16686 100644
--- a/Lib/LibAddonMenu-2.0/controls/slider.lua
+++ b/Lib/LibAddonMenu-2.0/controls/slider.lua
@@ -5,6 +5,7 @@
 	min = 0,
 	max = 20,
 	step = 1,	--(optional)
+	decimals = 0, --(optional)
 	getFunc = function() return db.var end,
 	setFunc = function(value) db.var = value doStuff() end,
 	width = "full",	--or "half" (optional)
@@ -15,7 +16,7 @@
 }	]]


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

@@ -123,17 +124,25 @@ function LAMCreateControl.slider(parent, sliderData, controlName)
 			self:LoseFocus()
 			control:UpdateValue(false, tonumber(self:GetText()))
 		end)
-
+	local function RoundDecimalToPlace(d, place)
+		return tonumber(string.format("%." .. tostring(place) .. "f", d))
+	end
 	local range = maxValue - minValue
 	slider:SetValueStep(sliderData.step or 1)
 	slider:SetHandler("OnValueChanged", function(self, value, eventReason)
 			if eventReason == EVENT_REASON_SOFTWARE then return end
-			self:SetValue(value)	--do we actually need this line?
-			slidervalue:SetText(value)
+			local new_value = sliderData.decimals and RoundDecimalToPlace(value, sliderData.decimals) or value
+			self:SetValue(new_value)	--do we actually need this line?
+			slidervalue:SetText(new_value)
 		end)
 	slider:SetHandler("OnSliderReleased", function(self, value)
 			--sliderData.setFunc(value)
-			control:UpdateValue(false, value)	--does this work here instead?
+			local new_value = sliderData.decimals and RoundDecimalToPlace(value, sliderData.decimals) or value
+			control:UpdateValue(false, new_value)	--does this work here instead?
+		end)
+	slider:SetHandler("OnMouseWheel", function(self, value)
+			local new_value = (tonumber(slidervalue:GetText()) or sliderData.min or 0) + ((sliderData.step or 1) * value)
+			control:UpdateValue(false, new_value)
 		end)

 	if sliderData.warning then
@@ -142,7 +151,7 @@ function LAMCreateControl.slider(parent, sliderData, controlName)
 		control.warning.data = {tooltipText = sliderData.warning}
 	end

-	if sliderData.disabled then
+	if sliderData.disabled ~= nil then
 		control.UpdateDisabled = UpdateDisabled
 		control:UpdateDisabled()
 	end
@@ -154,4 +163,4 @@ function LAMCreateControl.slider(parent, sliderData, controlName)
 	end

 	return control
-end
\ No newline at end of file
+end