More fixes for the "Report to Discord" bugs; Implementations to show plugins in the breakdown window;
This commit is contained in:
+94
-88
@@ -3,7 +3,7 @@ if (true) then
|
||||
end
|
||||
|
||||
local Details = _G.Details
|
||||
local DF = _G.DetailsFramework
|
||||
local detailsFramework = _G.DetailsFramework
|
||||
local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details")
|
||||
|
||||
--options panel namespace
|
||||
@@ -18,12 +18,12 @@ local preset_version = 3
|
||||
Details.preset_version = preset_version
|
||||
|
||||
--templates
|
||||
local options_text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")
|
||||
local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
|
||||
local options_switch_template = DF:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE")
|
||||
local options_slider_template = DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE")
|
||||
local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")
|
||||
local options_button_template_selected = DF.table.copy({}, DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
|
||||
local options_text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")
|
||||
local options_dropdown_template = detailsFramework:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE")
|
||||
local options_switch_template = detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE")
|
||||
local options_slider_template = detailsFramework:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE")
|
||||
local options_button_template = detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")
|
||||
local options_button_template_selected = detailsFramework.table.copy({}, detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE"))
|
||||
options_button_template_selected.backdropbordercolor = {1, .8, .2}
|
||||
|
||||
--options
|
||||
@@ -36,25 +36,25 @@ function Details:InitializeOptionsWindow(instance)
|
||||
end
|
||||
|
||||
function Details.options.InitializeOptionsWindow(instance)
|
||||
local DetailsOptionsWindow = DF:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592)
|
||||
local f = DetailsOptionsWindow.frame
|
||||
local DetailsOptionsWindow = detailsFramework:NewPanel(UIParent, _, "DetailsOptionsWindow", _, 897, 592)
|
||||
local optionsFrame = DetailsOptionsWindow.frame
|
||||
|
||||
f.Frame = f
|
||||
f.__name = "Options"
|
||||
f.real_name = "DETAILS_OPTIONS"
|
||||
f.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]]
|
||||
_G.DetailsPluginContainerWindow.EmbedPlugin(f, f, true)
|
||||
optionsFrame.Frame = optionsFrame
|
||||
optionsFrame.__name = "Options"
|
||||
optionsFrame.real_name = "DETAILS_OPTIONS"
|
||||
optionsFrame.__icon = [[Interface\Scenarios\ScenarioIcon-Interact]]
|
||||
_G.DetailsPluginContainerWindow.EmbedPlugin(optionsFrame, optionsFrame, true)
|
||||
|
||||
f.sectionFramesContainer = {}
|
||||
optionsFrame.sectionFramesContainer = {}
|
||||
|
||||
DF:ApplyStandardBackdrop(f)
|
||||
local titleBar = DF:CreateTitleBar(f, "Options Panel")
|
||||
detailsFramework:ApplyStandardBackdrop(optionsFrame)
|
||||
local titleBar = detailsFramework:CreateTitleBar(optionsFrame, "Options Panel")
|
||||
titleBar.Text:Hide()
|
||||
|
||||
local titleText = DF:NewLabel(titleBar, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
|
||||
local titleText = detailsFramework:NewLabel(titleBar, nil, "$parentTitleLabel", "title", "Details! " .. Loc ["STRING_OPTIONS_WINDOW"], "GameFontHighlightLeft", 12, {227/255, 186/255, 4/255})
|
||||
titleText:SetPoint("center", titleBar, "center")
|
||||
|
||||
f:Hide()
|
||||
optionsFrame:Hide()
|
||||
|
||||
local formatFooterText = function(object)
|
||||
object.fontface = "GameFontNormal"
|
||||
@@ -63,80 +63,82 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
end
|
||||
|
||||
--create a floating frame to hold footer frames
|
||||
local footerFrame = CreateFrame("frame", "$parentFooterFrame", f, "BackdropTemplate")
|
||||
footerFrame:SetPoint("bottomleft", f, "bottomleft", 0, 0)
|
||||
footerFrame:SetPoint("bottomright", f, "bottomright", 0, 0)
|
||||
local footerFrame = CreateFrame("frame", "$parentFooterFrame", optionsFrame, "BackdropTemplate")
|
||||
footerFrame:SetPoint("bottomleft", optionsFrame, "bottomleft", 0, 0)
|
||||
footerFrame:SetPoint("bottomright", optionsFrame, "bottomright", 0, 0)
|
||||
footerFrame:SetHeight(50)
|
||||
footerFrame:SetFrameLevel(f:GetFrameLevel() + 10)
|
||||
DF:ApplyStandardBackdrop(footerFrame)
|
||||
footerFrame:SetFrameLevel(optionsFrame:GetFrameLevel() + 10)
|
||||
detailsFramework:ApplyStandardBackdrop(footerFrame)
|
||||
|
||||
local gradientBelowTheLine = DetailsFramework:CreateTexture(footerFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.25}, toColor = "transparent"}, 1, 90, "artwork", {0, 1, 0, 1}, "dogGradient")
|
||||
gradientBelowTheLine:SetPoint("bottoms")
|
||||
|
||||
--select the instance to edit
|
||||
local onSelectInstance = function(_, _, instanceId)
|
||||
local instance = Details.tabela_instancias[instanceId]
|
||||
if (not instance:IsEnabled() or not instance:IsStarted()) then
|
||||
Details.CriarInstancia (_, _, instance.meu_id)
|
||||
---@type instance
|
||||
local instanceObject = Details.tabela_instancias[instanceId]
|
||||
if (not instanceObject:IsEnabled() or not instanceObject:IsStarted()) then
|
||||
Details.CriarInstancia (_, _, instanceObject.meu_id)
|
||||
end
|
||||
Details.options.SetCurrentInstanceAndRefresh(instance)
|
||||
f.updateMicroFrames()
|
||||
|
||||
Details.options.SetCurrentInstanceAndRefresh(instanceObject)
|
||||
optionsFrame.updateMicroFrames()
|
||||
end
|
||||
|
||||
local buildInstanceMenu = function()
|
||||
local instanceList = {}
|
||||
for index = 1, math.min (#Details.tabela_instancias, Details.instances_amount) do
|
||||
local instance = Details.tabela_instancias[index]
|
||||
local instanceObject = Details.tabela_instancias[index]
|
||||
|
||||
--what the window is showing
|
||||
local atributo = instance.atributo
|
||||
local sub_atributo = instance.sub_atributo
|
||||
local atributo = instanceObject.atributo
|
||||
local sub_atributo = instanceObject.sub_atributo
|
||||
|
||||
if (atributo == 5) then --custom
|
||||
local CustomObject = Details.custom [sub_atributo]
|
||||
local CustomObject = Details.custom[sub_atributo]
|
||||
if (not CustomObject) then
|
||||
instance:ResetAttribute()
|
||||
atributo = instance.atributo
|
||||
sub_atributo = instance.sub_atributo
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista [atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]}
|
||||
instanceObject:ResetAttribute()
|
||||
atributo = instanceObject.atributo
|
||||
sub_atributo = instanceObject.sub_atributo
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. Details.sub_atributos[atributo].lista[sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos[atributo].icones[sub_atributo][1], texcoord = Details.sub_atributos[atributo].icones[sub_atributo][2]}
|
||||
else
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. CustomObject.name, onclick = onSelectInstance, icon = CustomObject.icon}
|
||||
end
|
||||
else
|
||||
local modo = instance.modo
|
||||
local modo = instanceObject.modo
|
||||
|
||||
if (modo == 1) then --solo plugin
|
||||
atributo = Details.SoloTables.Mode or 1
|
||||
local SoloInfo = Details.SoloTables.Menu [atributo]
|
||||
local SoloInfo = Details.SoloTables.Menu[atributo]
|
||||
if (SoloInfo) then
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. SoloInfo [1], onclick = onSelectInstance, icon = SoloInfo [2]}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. SoloInfo[1], onclick = onSelectInstance, icon = SoloInfo [2]}
|
||||
else
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
end
|
||||
|
||||
elseif (modo == 4) then --raid plugin
|
||||
local plugin_name = instance.current_raid_plugin or instance.last_raid_plugin
|
||||
local plugin_name = instanceObject.current_raid_plugin or instanceObject.last_raid_plugin
|
||||
if (plugin_name) then
|
||||
local plugin_object = Details:GetPlugin (plugin_name)
|
||||
local plugin_object = Details:GetPlugin(plugin_name)
|
||||
if (plugin_object) then
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. plugin_object.__name, onclick = onSelectInstance, icon = plugin_object.__icon}
|
||||
else
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
end
|
||||
else
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " unknown", onclick = onSelectInstance, icon = ""}
|
||||
end
|
||||
else
|
||||
instanceList [#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista [atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]}
|
||||
instanceList[#instanceList+1] = {value = index, label = "#".. index .. " " .. Details.atributos.lista[atributo] .. " - " .. Details.sub_atributos [atributo].lista [sub_atributo], onclick = onSelectInstance, icon = Details.sub_atributos [atributo].icones[sub_atributo] [1], texcoord = Details.sub_atributos [atributo].icones[sub_atributo] [2]}
|
||||
end
|
||||
end
|
||||
end
|
||||
return instanceList
|
||||
end
|
||||
|
||||
local instanceSelection = DF:NewDropDown (footerFrame, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu) --, nil, options_dropdown_template
|
||||
f.instanceDropdown = instanceSelection
|
||||
instanceSelection:SetPoint("bottomright", f, "bottomright", -7, 09)
|
||||
local instanceSelection = detailsFramework:NewDropDown(footerFrame, _, "$parentInstanceSelectDropdown", "instanceDropdown", 200, 18, buildInstanceMenu) --, nil, options_dropdown_template
|
||||
optionsFrame.instanceDropdown = instanceSelection
|
||||
instanceSelection:SetPoint("bottomright", optionsFrame, "bottomright", -7, 09)
|
||||
instanceSelection:SetTemplate(options_dropdown_template)
|
||||
instanceSelection:SetHook("OnEnter", function()
|
||||
GameCooltip:Reset()
|
||||
@@ -148,11 +150,11 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
GameCooltip:Hide()
|
||||
end)
|
||||
|
||||
local instances_string = DF:NewLabel(footerFrame, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12)
|
||||
local instances_string = detailsFramework:NewLabel(footerFrame, nil, "$parentInstanceDropdownLabel", "instancetext", Loc ["STRING_OPTIONS_EDITINSTANCE"], "GameFontNormal", 12)
|
||||
instances_string:SetPoint("right", instanceSelection, "left", -2, 1)
|
||||
formatFooterText(instances_string)
|
||||
|
||||
local bigdogImage = DF:NewImage(footerFrame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.9, 200*0.9, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog")
|
||||
local bigdogImage = detailsFramework:NewImage(footerFrame, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.9, 200*0.9, nil, {1, 0, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog")
|
||||
bigdogImage:SetPoint("bottomright", footerFrame, "topright", 0, 0)
|
||||
bigdogImage:SetAlpha(.25)
|
||||
|
||||
@@ -160,17 +162,17 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
local onToggleEditingGroup = function(self, fixparam, value)
|
||||
Details.options_group_edit = value
|
||||
end
|
||||
local editingGroupCheckBox = DF:CreateSwitch(footerFrame, onToggleEditingGroup, Details.options_group_edit, _, _, _, _, _, "$parentEditGroupCheckbox", _, _, _, _, DF:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
local editingGroupCheckBox = detailsFramework:CreateSwitch(footerFrame, onToggleEditingGroup, Details.options_group_edit, _, _, _, _, _, "$parentEditGroupCheckbox", _, _, _, _, detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"))
|
||||
editingGroupCheckBox:SetAsCheckBox()
|
||||
editingGroupCheckBox.tooltip = Loc ["STRING_MINITUTORIAL_OPTIONS_PANEL2"]
|
||||
|
||||
local editingGroupLabel = DF:NewLabel(footerFrame, nil, "$parentEditingGroupLabel", "editingGroupLabel", "Editing Group:", "GameFontNormal", 12) --localize-me
|
||||
local editingGroupLabel = detailsFramework:NewLabel(footerFrame, nil, "$parentEditingGroupLabel", "editingGroupLabel", "Editing Group:", "GameFontNormal", 12) --localize-me
|
||||
editingGroupLabel:SetPoint("bottomleft", instances_string, "topleft", 0, 5)
|
||||
editingGroupCheckBox:SetPoint("left", editingGroupLabel, "right", 2, 0)
|
||||
formatFooterText(editingGroupLabel)
|
||||
|
||||
--create test bars
|
||||
DF:NewColor("C_OptionsButtonOrange", 0.9999, 0.8196, 0, 1)
|
||||
detailsFramework:NewColor("C_OptionsButtonOrange", 0.9999, 0.8196, 0, 1)
|
||||
local create_test_bars_func = function()
|
||||
Details.CreateTestBars()
|
||||
if (not Details.test_bar_update) then
|
||||
@@ -179,33 +181,33 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
Details:StopTestBarUpdate()
|
||||
end
|
||||
end
|
||||
local fillbars = DF:NewButton(footerFrame, _, "$parentCreateExampleBarsButton", nil, 140, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1)
|
||||
fillbars:SetPoint("bottomleft", f.widget, "bottomleft", 10, 10)
|
||||
local fillbars = detailsFramework:NewButton(footerFrame, _, "$parentCreateExampleBarsButton", nil, 140, 20, create_test_bars_func, nil, nil, nil, Loc ["STRING_OPTIONS_TESTBARS"], 1)
|
||||
fillbars:SetPoint("bottomleft", optionsFrame.widget, "bottomleft", 10, 10)
|
||||
fillbars:SetTemplate(options_button_template)
|
||||
fillbars:SetIcon ("Interface\\AddOns\\Details\\images\\icons", nil, nil, nil, {323/512, 365/512, 42/512, 78/512}, {1, 1, 1, 0.6}, 4, 2)
|
||||
|
||||
--change log
|
||||
local changelog = DF:NewButton(footerFrame, _, "$parentOpenChangeLogButton", nil, 140, 20, Details.OpenNewsWindow, "change_log", nil, nil, Loc ["STRING_OPTIONS_CHANGELOG"], 1)
|
||||
local changelog = detailsFramework:NewButton(footerFrame, _, "$parentOpenChangeLogButton", nil, 140, 20, Details.OpenNewsWindow, "change_log", nil, nil, Loc ["STRING_OPTIONS_CHANGELOG"], 1)
|
||||
changelog:SetPoint("left", fillbars, "right", 10, 0)
|
||||
changelog:SetTemplate(options_button_template)
|
||||
changelog:SetIcon ("Interface\\AddOns\\Details\\images\\icons", nil, nil, nil, {367/512, 399/512, 43/512, 76/512}, {1, 1, 1, 0.8}, 4, 2)
|
||||
|
||||
--search field
|
||||
local searchBox = DF:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template)
|
||||
local searchBox = detailsFramework:CreateTextEntry(footerFrame, function()end, 140, 20, _, _, _, options_dropdown_template)
|
||||
searchBox:SetPoint("left", changelog, "right", 10, 0)
|
||||
|
||||
local searchLabel = DF:CreateLabel(footerFrame, "Search:") --localize-me
|
||||
local searchLabel = detailsFramework:CreateLabel(footerFrame, "Search:") --localize-me
|
||||
searchLabel:SetPoint("bottomleft", searchBox, "topleft", 0, 2)
|
||||
formatFooterText(searchLabel)
|
||||
|
||||
searchBox:SetHook("OnChar", function()
|
||||
if (searchBox.text ~= "") then
|
||||
local searchSection = f.sectionFramesContainer[19]
|
||||
local searchSection = optionsFrame.sectionFramesContainer[19]
|
||||
searchSection.sectionButton:Enable()
|
||||
searchSection.sectionButton:Click()
|
||||
|
||||
local searchingFor = searchBox.text
|
||||
local allSectionFrames = f.sectionFramesContainer
|
||||
local allSectionFrames = optionsFrame.sectionFramesContainer
|
||||
|
||||
local allSectionNames = {}
|
||||
local allSectionOptions = {}
|
||||
@@ -249,9 +251,9 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
if (optionName:find(searchingText)) then
|
||||
if optionData.header ~= lastTab then
|
||||
if lastTab ~= nil then
|
||||
options[#options+1] = {type = "label", get = function() return "" end, text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")} -- blank
|
||||
options[#options+1] = {type = "label", get = function() return "" end, text_template = detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")} -- blank
|
||||
end
|
||||
options[#options+1] = {type = "label", get = function() return optionData.header end, text_template = {color = "silver", size = 14, font = DF:GetBestFontForLanguage()}}
|
||||
options[#options+1] = {type = "label", get = function() return optionData.header end, text_template = {color = "silver", size = 14, font = detailsFramework:GetBestFontForLanguage()}}
|
||||
lastTab = optionData.header
|
||||
lastLabel = nil
|
||||
end
|
||||
@@ -266,10 +268,10 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
local startX = 200
|
||||
local startY = -60
|
||||
|
||||
DF:BuildMenuVolatile(searchSection, options, startX, startY, 560, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, globalCallback)
|
||||
detailsFramework:BuildMenuVolatile(searchSection, options, startX, startY, 560, true, options_text_template, options_dropdown_template, options_switch_template, true, options_slider_template, options_button_template, globalCallback)
|
||||
|
||||
else
|
||||
f.sectionFramesContainer[19].sectionButton:Disable()
|
||||
optionsFrame.sectionFramesContainer[19].sectionButton:Disable()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -314,17 +316,17 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
|
||||
function Details.options.SelectOptionsSection(sectionId)
|
||||
for i = 1, maxSectionIds do
|
||||
f.sectionFramesContainer[i]:Hide()
|
||||
if (f.sectionFramesContainer[i].sectionButton) then
|
||||
f.sectionFramesContainer[i].sectionButton:SetTemplate(options_button_template)
|
||||
f.sectionFramesContainer[i].sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay")
|
||||
optionsFrame.sectionFramesContainer[i]:Hide()
|
||||
if (optionsFrame.sectionFramesContainer[i].sectionButton) then
|
||||
optionsFrame.sectionFramesContainer[i].sectionButton:SetTemplate(options_button_template)
|
||||
optionsFrame.sectionFramesContainer[i].sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay")
|
||||
end
|
||||
end
|
||||
|
||||
f.sectionFramesContainer[sectionId]:Show()
|
||||
optionsFrame.sectionFramesContainer[sectionId]:Show()
|
||||
--hightlight the option button
|
||||
f.sectionFramesContainer[sectionId].sectionButton:SetTemplate(options_button_template_selected)
|
||||
f.sectionFramesContainer[sectionId].sectionButton:SetIcon({1, 1, 0}, 4, section_menu_button_height -4, "overlay")
|
||||
optionsFrame.sectionFramesContainer[sectionId].sectionButton:SetTemplate(options_button_template_selected)
|
||||
optionsFrame.sectionFramesContainer[sectionId].sectionButton:SetIcon({1, 1, 0}, 4, section_menu_button_height -4, "overlay")
|
||||
end
|
||||
|
||||
Details.options.SetCurrentInstance(instance)
|
||||
@@ -332,17 +334,17 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
--create frames for sections
|
||||
for index, sectionId in ipairs(optionsSectionsOrder) do
|
||||
if (type(sectionId) == "number") then
|
||||
local sectionFrame = CreateFrame("frame", "$parentTab" .. sectionId, f, "BackdropTemplate")
|
||||
sectionFrame:SetPoint("topleft", f, "topleft", -40, 22)
|
||||
sectionFrame:SetSize(f:GetSize())
|
||||
local sectionFrame = CreateFrame("frame", "$parentTab" .. sectionId, optionsFrame, "BackdropTemplate")
|
||||
sectionFrame:SetPoint("topleft", optionsFrame, "topleft", -40, 22)
|
||||
sectionFrame:SetSize(optionsFrame:GetSize())
|
||||
sectionFrame:EnableMouse(false)
|
||||
|
||||
local realBackdropAreaFrame = CreateFrame("frame", "$parentTab" .. sectionId .. "BackdropArea", f, "BackdropTemplate")
|
||||
realBackdropAreaFrame:SetFrameLevel(f:GetFrameLevel()-1)
|
||||
local realBackdropAreaFrame = CreateFrame("frame", "$parentTab" .. sectionId .. "BackdropArea", optionsFrame, "BackdropTemplate")
|
||||
realBackdropAreaFrame:SetFrameLevel(optionsFrame:GetFrameLevel()-1)
|
||||
realBackdropAreaFrame:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true})
|
||||
realBackdropAreaFrame:SetBackdropColor(0.1215, 0.1176, 0.1294, .1)
|
||||
realBackdropAreaFrame:SetBackdropBorderColor(0.2, 0.2, 0.2, .05)
|
||||
realBackdropAreaFrame:SetPoint("topleft", f, "topleft", 150, -27)
|
||||
realBackdropAreaFrame:SetPoint("topleft", optionsFrame, "topleft", 150, -27)
|
||||
realBackdropAreaFrame:SetSize(775, 570)
|
||||
|
||||
local leftGradient = DetailsFramework:CreateTexture(sectionFrame, {gradient = "horizontal", fromColor = {0, 0, 0, 0}, toColor = {0, 0, 0, 0.3}}, 10, 1, "artwork", {0, 1, 0, 1}, "leftGradient")
|
||||
@@ -357,7 +359,7 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
bottomGradient:SetPoint("bottoms")
|
||||
|
||||
sectionFrame.name = sectionsName[sectionId]
|
||||
f.sectionFramesContainer[sectionId] = sectionFrame
|
||||
optionsFrame.sectionFramesContainer[sectionId] = sectionFrame
|
||||
|
||||
local buildOptionSectionFunc = Details.optionsSection[sectionId]
|
||||
if (buildOptionSectionFunc) then
|
||||
@@ -365,9 +367,9 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
buildOptionSectionFunc(sectionFrame)
|
||||
|
||||
--create a button for the section
|
||||
local sectionButton = DF:CreateButton(f, function() Details.options.SelectOptionsSection(sectionId) end, section_menu_button_width, section_menu_button_height, sectionsName[sectionId], sectionId, nil, nil, nil, "$parentButtonSection" .. sectionId, nil, options_button_template, options_text_template)
|
||||
local sectionButton = detailsFramework:CreateButton(optionsFrame, function() Details.options.SelectOptionsSection(sectionId) end, section_menu_button_width, section_menu_button_height, sectionsName[sectionId], sectionId, nil, nil, nil, "$parentButtonSection" .. sectionId, nil, options_button_template, options_text_template)
|
||||
sectionButton:SetIcon({.4, .4, .4}, 4, section_menu_button_height -4, "overlay")
|
||||
sectionButton:SetPoint("topleft", f, "topleft", 10, buttonYPosition)
|
||||
sectionButton:SetPoint("topleft", optionsFrame, "topleft", 10, buttonYPosition)
|
||||
buttonYPosition = buttonYPosition - (section_menu_button_height + 1)
|
||||
sectionFrame.sectionButton = sectionButton
|
||||
|
||||
@@ -384,10 +386,10 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
end
|
||||
|
||||
function Details.options.GetOptionsSection(sectionId)
|
||||
return f.sectionFramesContainer[sectionId]
|
||||
return optionsFrame.sectionFramesContainer[sectionId]
|
||||
end
|
||||
|
||||
function f.RefreshWindow()
|
||||
function optionsFrame.RefreshWindow()
|
||||
if (not _G.DetailsOptionsWindow.instance) then
|
||||
local lowerInstance = Details:GetLowerInstanceNumber()
|
||||
if (not lowerInstance) then
|
||||
@@ -406,12 +408,16 @@ function Details.options.InitializeOptionsWindow(instance)
|
||||
end
|
||||
|
||||
-- ~options
|
||||
function Details:OpenOptionsWindow(instance, no_reopen, section)
|
||||
---open the options window
|
||||
---@param instance instance
|
||||
---@param bNoReopen boolean|nil
|
||||
---@param section any
|
||||
function Details:OpenOptionsWindow(instance, bNoReopen, section)
|
||||
if (not instance.GetId or not instance:GetId()) then
|
||||
instance, no_reopen, section = unpack(instance)
|
||||
instance, bNoReopen, section = unpack(instance)
|
||||
end
|
||||
|
||||
if (not no_reopen and not instance:IsEnabled() or not instance:IsStarted()) then
|
||||
if (not bNoReopen and not instance:IsEnabled() or not instance:IsStarted()) then
|
||||
Details:CreateInstance(instance:GetId())
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user