Cataclysm beta fixes

This commit is contained in:
Tercio Jose
2024-04-20 14:03:01 -03:00
parent 96ee6ade46
commit 0f561469f3
3 changed files with 122 additions and 7 deletions
+117 -5
View File
@@ -98,10 +98,18 @@ detailsFramework.OptionsFrameMixin = {
}
local onWidgetSetInUse = function(widget, widgetTable)
if (widgetTable.childrenids) then
widget.childrenids = widgetTable.childrenids
end
widget.children_follow_enabled = widgetTable.children_follow_enabled
end
local setWidgetId = function(parent, widgetTable, widgetObject)
if (widgetTable.id) then
parent.widgetids[widgetTable.id] = widgetObject
end
widgetTable.widget = widgetObject
end
local onEnterHighlight = function(self)
@@ -166,6 +174,7 @@ local setLabelProperties = function(parent, widget, widgetTable, currentXOffset,
end
setWidgetId(parent, widgetTable, widget)
onWidgetSetInUse(widget, widgetTable)
end
local setDropdownProperties = function(parent, widget, widgetTable, currentXOffset, currentYOffset, template, widgetWidth, widgetHeight, bAlignAsPairs, nAlignAsPairsLength, valueChangeHook, maxColumnWidth, maxWidgetWidth)
@@ -224,6 +233,8 @@ local setDropdownProperties = function(parent, widget, widgetTable, currentXOffs
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth
end
@@ -236,7 +247,49 @@ local setToggleProperties = function(parent, widget, widgetTable, currentXOffset
widget:SetAsCheckBox()
end
widget:SetValue(widgetTable.get())
if (widgetTable.children_follow_enabled) then
widget.SetValueOriginal = widget.SetValue
local newSetFunc = function(widget, value)
--look for children ids
local childrenids = widgetTable.childrenids
if (type(childrenids) == "table") then
for i, childId in ipairs(childrenids) do
local childWidget = parent:GetWidgetById(childId)
if (childWidget) then
--if the children_follow_reverse is true, then the children will be enabled when the toogle is disabeld
--this is used when the main toggle is a kind of "Do This Automatically", if is not doing it automatically
--then the children should be enabled to set the options
if (widgetTable.children_follow_reverse) then
if (value) then
childWidget:Disable()
else
childWidget:Enable()
end
else
if (value) then
childWidget:Enable()
else
childWidget:Disable()
end
end
end
end
end
widget.SetValueOriginal(widget, value)
return value
end
widget:SetValue(widgetTable.get())
rawset(widget, "SetValue", newSetFunc)
else
if (widget.SetValueOriginal) then
rawset(widget, "SetValue", widget.SetValueOriginal)
rawset(widget, "SetValueOriginal", nil)
end
widget:SetValue(widgetTable.get())
end
if (widgetWidth) then
PixelUtil.SetWidth(widget.widget, widgetWidth)
@@ -302,6 +355,8 @@ local setToggleProperties = function(parent, widget, widgetTable, currentXOffset
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth, extraPaddingY
end
@@ -378,6 +433,8 @@ local setRangeProperties = function(parent, widget, widgetTable, currentXOffset,
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth
end
@@ -456,6 +513,8 @@ local setColorProperties = function(parent, widget, widgetTable, currentXOffset,
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth, extraPaddingY
end
@@ -522,6 +581,8 @@ local setExecuteProperties = function(parent, widget, widgetTable, currentXOffse
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth, latestInlineWidget
end
@@ -590,9 +651,44 @@ local setTextEntryProperties = function(parent, widget, widgetTable, currentXOff
maxWidgetWidth = widget:GetWidth()
end
onWidgetSetInUse(widget, widgetTable)
return maxColumnWidth, maxWidgetWidth
end
local onMenuBuilt = function(parent)
--refresh the options to find children to disable or enable
if (parent.build_menu_options) then
for index, widgetTable in ipairs(parent.build_menu_options) do
if (widgetTable.children_follow_enabled) then --not found, bug
local widget = widgetTable.widget
local childrenids = widgetTable.childrenids
if (type(childrenids) == "table") then
for i, childId in ipairs(childrenids) do
local childWidget = parent:GetWidgetById(childId)
if (childWidget) then
local value = widget:GetValue()
if (widgetTable.children_follow_reverse) then
if (value) then
childWidget:Disable()
else
childWidget:Enable()
end
else
if (value) then
childWidget:Enable()
else
childWidget:Disable()
end
end
end
end
end
end
end
end
end
local refreshOptions = function(self)
for _, widget in ipairs(self.widget_list) do
if (widget._get) then
@@ -621,6 +717,8 @@ local refreshOptions = function(self)
end
end
end
onMenuBuilt(self)
end
detailsFramework.internalFunctions.RefreshOptionsPanel = refreshOptions
@@ -839,6 +937,12 @@ local getMenuWidgetVolative = function(parent, widgetType, indexTable)
end
end
--clean children ids, children ids are used to disable or enable other widgets when a widget is disabled or enabled
if (widgetObject.childrenids) then
table.wipe(widgetObject.childrenids)
end
widgetObject.children_follow_enabled = nil
return widgetObject
end
@@ -919,10 +1023,13 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse
}
parseOptionsTypes(menuOptions)
local bUseBoxFirstOnAllWidgets, widgetWidth, widgetHeight, bAlignAsPairs, nAlignAsPairsLength, nAlignAsPairsSpacing, bUseScrollFrame, languageAddonId, bAttachSliderButtonsToLeft = parseOptionsTable(menuOptions)
parent, height = parseParent(bUseScrollFrame, parent, height, yOffset)
local languageTable = parseLanguageTable(languageAddonId)
parent.build_menu_options = menuOptions
for index, widgetTable in ipairs(menuOptions) do
if (not widgetTable.hidden) then
local widgetCreated
@@ -956,7 +1063,7 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse
--dropdowns
elseif (widgetTable.type:find("select")) then
assert(widgetTable.get, "DetailsFramework:BuildMenu(): .get() not found in the widget table for 'select'")
assert(widgetTable.get, "DetailsFramework:BuildMenu: .get() not found in the widget table for 'select'")
local dropdown = getMenuWidgetVolative(parent, "dropdown", widgetIndexes)
widgetCreated = dropdown
local defaultHeight = 18
@@ -1117,6 +1224,7 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse
end
detailsFramework.RefreshUnsafeOptionsWidgets()
onMenuBuilt(parent)
end
local getDescripttionPhraseID = function(widgetTable, languageAddonId, languageTable)
@@ -1151,10 +1259,13 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
--parse settings and the options table
parseOptionsTypes(menuOptions)
local bUseBoxFirstOnAllWidgets, widgetWidth, widgetHeight, bAlignAsPairs, nAlignAsPairsLength, nAlignAsPairsSpacing, bUseScrollFrame, languageAddonId, bAttachSliderButtonsToLeft = parseOptionsTable(menuOptions)
parent, height = parseParent(bUseScrollFrame, parent, height, yOffset)
local languageTable = parseLanguageTable(languageAddonId)
parent.build_menu_options = menuOptions
if (not parent.widget_list) then
detailsFramework:SetAsOptionsPanel(parent)
end
@@ -1197,7 +1308,7 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
elseif (widgetTable.type:find("select")) then
---@cast widgetTable df_menu_dropdown
assert(widgetTable.get, "DetailsFramework:BuildMenu(): .get not found in the widget table for 'select'")
assert(widgetTable.get, "DetailsFramework:BuildMenu: .get not found in the widget table for 'select'")
local defaultHeight = 18
local dropdown
@@ -1267,7 +1378,7 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
elseif (widgetTable.type == "range") then
---@cast widgetTable df_menu_range
assert(widgetTable.get, "DetailsFramework:BuildMenu(): .get not found in the widget table for 'range'")
assert(widgetTable.get, "DetailsFramework:BuildMenu: .get not found in the widget table for 'range'")
local bIsDecimals = widgetTable.usedecimals
local slider = detailsFramework:NewSlider(parent, nil, "$parentWidget" .. index, nil, widgetWidth or 140, widgetHeight or 18, widgetTable.min, widgetTable.max, widgetTable.step, widgetTable.get(), bIsDecimals, nil, nil, sliderTemplate)
@@ -1290,7 +1401,7 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
elseif (widgetTable.type == "color") then
---@cast widgetTable df_menu_color
assert(widgetTable.get, "DetailsFramework:BuildMenu(): .get not found in the widget table for 'color'")
assert(widgetTable.get, "DetailsFramework:BuildMenu: .get not found in the widget table for 'color'")
local colorpick = detailsFramework:NewColorPickButton(parent, "$parentWidget" .. index, nil, widgetTable.set, nil, buttonTemplate)
local descPhraseId = getDescripttionPhraseID(widgetTable, languageAddonId, languageTable)
@@ -1404,6 +1515,7 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
end
detailsFramework.RefreshUnsafeOptionsWidgets()
onMenuBuilt(parent)
end
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 528
local dversion = 529
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+4 -1
View File
@@ -158,7 +158,10 @@ function Details222.EJCache.CreateEncounterJournalDump()
--use current tier for dungeons, as the current tier shows the dungeons used for the current season of Mythic+
local startIndex, endIndex
if (bIsRaid) then
if currentTierId == 1 then break end --Cata has only one tier. Looking up tier 0 errors. ~CATA
if (detailsFramework.IsCataWow()) then
if currentTierId == 1 then break end --Cata has only one tier. Looking up tier 0 errors. ~CATA
end
EJ_SelectTier(currentTierId - 1) --print("tier selected:", currentTierId - 1, "raids") --debug
startIndex = raidTierStartIndex
endIndex = 20