diff --git a/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua b/lib/LibAddonMenu-2.0/LibAddonMenu-2.0.lua index 35b4830..ce2f2e5 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", 2 +local MAJOR, MINOR = "LibAddonMenu-2.0", 4 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 @@ -48,8 +48,9 @@ end --opens to a specific addon's option panel --Usage: -- panel = userdata; the panel returned by the :RegisterOptionsPanel method -local settings = {en = "Settings", de = "Einstellungen", fr = "Réglages"} -local locSettings = settings[GetCVar("Language.2")] +--local settings = {en = "Settings", de = "Einstellungen", fr = "Réglages"} +--local locSettings = settings[GetCVar("Language.2")] +local locSettings = GetString(SI_GAME_MENU_SETTINGS) function lam:OpenToPanel(panel) SCENE_MANAGER:Show("gameMenuInGame") zo_callLater(function() @@ -248,13 +249,15 @@ end --INTERNAL FUNCTION --creates the right-hand menu in LAM's panel local function CreateAddonList() - local list = wm:CreateControlFromVirtual("LAMAddonPanelsMenu", optionsWindow, "ZO_ScrollContainer") + local list + --check if an earlier loaded copy of LAM created it already + list = LAMAddonPanelsMenu or wm:CreateControlFromVirtual("LAMAddonPanelsMenu", optionsWindow, "ZO_ScrollContainer") list:ClearAnchors() list:SetAnchor(TOPLEFT) list:SetHeight(675) list:SetWidth(200) - list.bg = wm:CreateControl(nil, list, CT_BACKDROP) + list.bg = list.bg or wm:CreateControl(nil, list, CT_BACKDROP) local bg = list.bg bg:SetAnchorFill() --offsets of 8? bg:SetEdgeTexture("EsoUI\\Art\\Tooltips\\UI-Border.dds", 128, 16) @@ -262,7 +265,7 @@ local function CreateAddonList() local generatedButtons list:SetHandler("OnShow", function(self) - if not generatedButtons then + if not generatedButtons and #addonsForList > 0 then --we're about to show our list for the first time - let's sort the buttons before creating them table.sort(addonsForList, function(a, b) return a.name < b.name diff --git a/lib/LibAddonMenu-2.0/controls/checkbox.lua b/lib/LibAddonMenu-2.0/controls/checkbox.lua index 734e180..fb48f56 100644 --- a/lib/LibAddonMenu-2.0/controls/checkbox.lua +++ b/lib/LibAddonMenu-2.0/controls/checkbox.lua @@ -12,7 +12,7 @@ } ]] -local widgetVersion = 2 +local widgetVersion = 3 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("checkbox", widgetVersion) then return end @@ -45,9 +45,7 @@ local function UpdateDisabled(control) control.isDisabled = disable end -local function ToggleCheckbox(control) - PlaySound(SOUNDS.DEFAULT_CLICK) - +local function ToggleCheckbox(control) if control.value then control.label:SetColor(ZO_DEFAULT_ENABLED_COLOR:UnpackRGBA()) control.checkbox:SetText(control.checkedText) @@ -114,6 +112,7 @@ function LAMCreateControl.checkbox(parent, checkboxData, controlName) control:SetHandler("OnMouseExit", OnMouseExit) control:SetHandler("OnMouseUp", function(control) if control.isDisabled then return end + PlaySound(SOUNDS.DEFAULT_CLICK) control.value = not control.value control:UpdateValue(false, control.value) end)