Full Revamp on Auto Hide Settings

This commit is contained in:
Tercio Jose
2020-06-21 18:56:17 -03:00
parent fe702cf97f
commit 2d40243d25
14 changed files with 481 additions and 202 deletions
-4
View File
@@ -54,10 +54,6 @@ side = number, 1 = left, 2 = right, set the anchor point for buttons on window's
instance:SetFrameStrata (strata)
strata = string, "BACKGROUND", "LOW", "MEDIUM", "HIGH" or "DIALOG".
instance:SetCombatAlpha (modify_type, alpha_amount)
modify_type = number, 1 = none, 2 = While In Combat, 3 = "While Out of Combat", 4 = "While Out of a Group" (can be only one type)
alpha_amount = number, the amount of alpha.
instance:ChangeSkin (skin_name)
skin_name = string, the name of the skin to apply.
if skin name is nil, it reaply all config based on the window's config table.
+35 -13
View File
@@ -1,5 +1,5 @@
local dversion = 184
local dversion = 187
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -1057,7 +1057,7 @@ end
--volatile menu can be called several times, each time all settings are reset and a new menu is built using the same widgets
function DF:BuildMenuVolatile (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template, value_change_hook)
if (not parent.widget_list) then
DF:SetAsOptionsPanel (parent)
end
@@ -1093,15 +1093,20 @@ end
local label = getMenuWidgetVolative(parent, "label", widgetIndexes)
widget_created = label
label.text = widget_table.get() or widget_table.text or ""
label.color = widget_table.color
label.fontface = widget_table.font
if (widget_table.text_template or text_template) then
label:SetTemplate(widget_table.text_template or text_template)
else
label.fontsize = widget_table.size or 10
end
if (label.fontface) then
label.fontface = widget_table.font or "GameFontHighlightSmall"
end
if (widget_table.color) then
label.fontcolor = widget_table.color
end
label.text = widget_table.get() or widget_table.text or ""
label._get = widget_table.get
label.widget_type = "label"
@@ -1211,15 +1216,16 @@ end
local slider = getMenuWidgetVolative(parent, "slider", widgetIndexes)
widget_created = slider
slider.slider:SetMinMaxValues (widget_table.min, widget_table.max)
slider.slider:SetValue (widget_table.get())
slider.ivalue = slider.slider:GetValue()
if (widget_table.usedecimals) then
slider.slider:SetValueStep (0.01)
else
slider.slider:SetValueStep (widget_table.step)
end
slider.useDecimals = widget_table.usedecimals
slider.slider:SetMinMaxValues (widget_table.min, widget_table.max)
slider.slider:SetValue (widget_table.get())
slider.ivalue = slider.slider:GetValue()
slider:SetTemplate(slider_template)
@@ -1366,7 +1372,10 @@ end
textentry:SetPoint ("left", textentry.hasLabel, "right", 2)
textentry.hasLabel:SetPoint (cur_x, cur_y)
--> text entry doesn't trigger global callback
if (value_change_hook) then
textentry:SetHook("OnEnterPressed", value_change_hook)
textentry:SetHook("OnEditFocusLost", value_change_hook)
end
--> hook list
if (widget_table.hooks) then
@@ -2040,8 +2049,6 @@ function DF:GetBestFontForLanguage (language, western, cyrillic, china, korean,
end
end
--DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
--DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = DF:GetBestFontForLanguage()}
DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = DF:GetBestFontForLanguage()}
@@ -3311,6 +3318,21 @@ function DF_CALC_PERFORMANCE()
end)
end
DF.ClassIndexToFileName = {
[6] = "DEATHKNIGHT",
[1] = "WARRIOR",
[4] = "ROGUE",
[8] = "MAGE",
[5] = "PRIEST",
[3] = "HUNTER",
[9] = "WARLOCK",
[12] = "DEMONHUNTER",
[7] = "SHAMAN",
[11] = "DRUID",
[10] = "MONK",
[2] = "PALADIN",
}
DF.ClassFileNameToIndex = {
["DEATHKNIGHT"] = 6,
["WARRIOR"] = 1,
+1 -1
View File
@@ -4228,7 +4228,7 @@ DF.ScrollBoxFunctions.Refresh = function (self)
local offset = 0
if (self.IsFauxScroll) then
FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight+1)
FauxScrollFrame_Update (self, #self.data, self.LineAmount, self.LineHeight)
offset = FauxScrollFrame_GetOffset (self)
end
+1
View File
@@ -904,6 +904,7 @@ local set_switch_func = function (self, newFunction)
end
local set_as_checkbok = function (self)
if self.is_checkbox and self.checked_texture then return end
local checked = self:CreateTexture (self:GetName() .. "CheckTexture", "overlay")
checked:SetTexture ([[Interface\Buttons\UI-CheckBox-Check]])
checked:SetPoint ("center", self.button, "center", -1, -1)
+4 -4
View File
@@ -609,7 +609,7 @@ end
end
end
if (type (self.hide_in_combat_type) == "number" and self.hide_in_combat_type > 1 and _detalhes.LastShowCommand and _detalhes.LastShowCommand+10 > GetTime()) then
if (_detalhes.LastShowCommand and _detalhes.LastShowCommand+10 > GetTime()) then
self:ToolbarMenuButtons()
self:ToolbarSide()
self:AttributeMenu()
@@ -621,16 +621,16 @@ end
_detalhes.WindowAutoHideTick [self.meu_id] = C_Timer.NewTicker (10, function()
if (self.last_interaction) then
if (self.last_interaction + 10 < _detalhes._tempo) then
self:SetCombatAlpha (nil, nil, true)
self:AdjustAlphaByContext(true)
_detalhes.WindowAutoHideTick [self.meu_id]:Cancel()
end
else
self:SetCombatAlpha (nil, nil, true)
self:AdjustAlphaByContext(true)
_detalhes.WindowAutoHideTick [self.meu_id]:Cancel()
end
end)
else
self:SetCombatAlpha (nil, nil, true)
self:AdjustAlphaByContext(true)
end
self:DesaturateMenu()
+82 -2
View File
@@ -276,8 +276,88 @@ _detalhes.instance_defaults = {
hide_in_combat = false,
hide_out_of_combat = false,
hide_in_combat_type = 1,
hide_in_combat_alpha = 0,
hide_in_combat_type = 1, --deprecated
hide_in_combat_alpha = 0, --deprecated
--hide or show the window by context
hide_on_context = {
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
{
enabled = false,
inverse = false,
value = 100,
},
},
--switches
switch_all_roles_in_combat = false,
switch_all_roles_after_wipe = false,
+5
View File
@@ -473,6 +473,11 @@
end
end
--english alias
function container_combatentes:GetOrCreateActor (serial, nome, flag, criar)
return self:PegarCombatente (serial, nome, flag, criar)
end
function container_combatentes:PegarCombatente (serial, nome, flag, criar)
--[[statistics]]-- _detalhes.statistics.container_calls = _detalhes.statistics.container_calls + 1
-2
View File
@@ -412,7 +412,6 @@
--> hide / alpha / switch in combat
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa) then
--instancia:SetCombatAlpha (nil, nil, true) --passado para o regen disable
instancia:CheckSwitchOnCombatStart (true)
end
end
@@ -884,7 +883,6 @@
--> hide / alpha in combat
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa) then
--instancia:SetCombatAlpha (nil, nil, true) --passado para o regen enabled
if (instancia.auto_switch_to_old) then
instancia:CheckSwitchOnCombatEnd()
end
+10 -9
View File
@@ -4379,8 +4379,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes.last_zone_type = zoneType
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa and instancia.hide_in_combat_type ~= 1) then --> 1 = none, we doesn't need to call
instancia:SetCombatAlpha (nil, nil, true)
if (instancia.ativa) then
instancia:AdjustAlphaByContext(true)
end
end
end
@@ -4672,8 +4672,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa and instancia.hide_in_combat_type ~= 1) then --> 1 = none, we doesn't need to call
instancia:SetCombatAlpha (nil, nil, true)
if (instancia.ativa) then --> 1 = none, we doesn't need to call
instancia:AdjustAlphaByContext(true)
end
end
@@ -4757,8 +4757,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
for index, instancia in ipairs (_detalhes.tabela_instancias) do
if (instancia.ativa and instancia.hide_in_combat_type ~= 1) then --> 1 = none, we doesn't need to call
instancia:SetCombatAlpha (nil, nil, true)
if (instancia.ativa) then --> 1 = none, we doesn't need to call
instancia:AdjustAlphaByContext(true)
end
end
@@ -5033,7 +5033,8 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:IniciarColetaDeLixo (true)
_detalhes:WipePets()
_detalhes:SchedulePetUpdate (1)
_detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
_detalhes:InstanceCall (_detalhes.AdjustAlphaByContext)
_detalhes:CheckSwitchOnLogon()
_detalhes:CheckVersion()
_detalhes:SendEvent ("GROUP_ONENTER")
@@ -5053,7 +5054,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
_detalhes:WipePets()
_detalhes:SchedulePetUpdate (1)
_table_wipe (_detalhes.details_users)
_detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
_detalhes:InstanceCall (_detalhes.AdjustAlphaByContext)
_detalhes:CheckSwitchOnLogon()
_detalhes:SendEvent ("GROUP_ONLEAVE")
@@ -5202,7 +5203,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
if (_detalhes.debug) then
_detalhes:Msg ("(debug 2) restoring windows after Pet Battle.")
end
instance:SetCombatAlpha (nil, nil, true)
instance:AdjustAlphaByContext(true)
end
end
end
+1 -4
View File
@@ -1209,10 +1209,6 @@ end
function gump:Fade (frame, tipo, velocidade, parametros)
--if (frame.GetObjectType and frame:GetObjectType() == "Frame" and frame.GetName and type (frame:GetName()) == "string" and frame:GetName():find ("DetailsBaseFrame")) then
-- print (debugstack())
--end
if (_type (frame) == "table") then
if (frame.meu_id) then --> ups, uma instncia
@@ -1281,6 +1277,7 @@ end
frame.fadeInfo.finishedArg1 = frame
elseif (_upper (tipo) == "OUT") then --> aparecer
if (frame:GetAlpha() == 1 and not frame.hidden and not frame.fading_in) then --> ja esta na tela
return
elseif (frame.fading_out) then --> j ta com fading out
+2 -2
View File
@@ -1134,7 +1134,7 @@ local default_profile = {
border_color = {0, 0, 0, 1},
border_size = 14,
tooltip_max_abilities = 7,
tooltip_max_abilities = 6,
tooltip_max_targets = 2,
tooltip_max_pets = 2,
@@ -1339,7 +1339,7 @@ local default_global_data = {
--> mythic plus config
mythic_plus = {
always_in_combat = false, --
merge_boss_trash = true, --
merge_boss_trash = false, --
delete_trash_after_merge = true, --
--merge_boss_with_trash = false, --this won't be used
boss_dedicated_segment = true, --
-4
View File
@@ -725,10 +725,6 @@ function SlashCmdList.DETAILS (msg, editbox)
print (serial)
--tonumber((UnitGUID("target")):sub(-12, -9), 16))
elseif (command == "callfunction") then
_detalhes:InstanceCall (_detalhes.SetCombatAlpha, nil, nil, true)
elseif (command == "guid") then --> localize-me
+139 -57
View File
@@ -2552,70 +2552,142 @@ function window:CreateFrame17()
--anchor
g:NewLabel (frame17, _, "$parentHideInCombatAnchor", "hideInCombatAnchor", Loc ["STRING_OPTIONS_ALPHAMOD_ANCHOR"], "GameFontNormal")
frame17.hideInCombatAnchor:SetPoint("topleft", frame17, "topleft", window.right_start_at, window.top_start_at)
--> hide in combat
g:NewLabel (frame17, _, "$parentCombatAlphaLabel", "combatAlphaLabel", Loc ["STRING_OPTIONS_COMBAT_ALPHA"], "GameFontHighlightLeft")
local onSelectCombatAlpha = function (_, _, combat_alpha)
local instance = _G.DetailsOptionsWindow.instance
instance:SetCombatAlpha (combat_alpha)
if (_detalhes.options_group_edit and not DetailsOptionsWindow.loading_settings) then
for _, this_instance in ipairs (instance:GetInstanceGroup()) do
if (this_instance ~= instance) then
this_instance:SetCombatAlpha (combat_alpha)
end
end
end
_detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance)
end
local texCoords = {.9, 0.1, 0.1, .9}
local typeCombatAlpha = {
{value = 1, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_1"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_03", texcoord = texCoords, color = "gray"},
{value = 2, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_2"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
{value = 3, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
{value = 4, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_4"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
{value = 5, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_5"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
{value = 6, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
{value = 7, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_7"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords, desc = Loc ["STRING_OPTIONS_COMBAT_ALPHA_6"] .. " + " .. Loc ["STRING_OPTIONS_COMBAT_ALPHA_3"]},
{value = 8, label = Loc ["STRING_OPTIONS_COMBAT_ALPHA_8"], onclick = onSelectCombatAlpha, icon = "Interface\\Icons\\INV_Misc_Spyglass_02", texcoord = texCoords},
Loc["STRING_OPTIONS_COMBAT_ALPHA_2"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_3"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_4"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_5"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_6"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_7"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_8"],
Loc["STRING_OPTIONS_COMBAT_ALPHA_9"],
}
local buildTypeCombatAlpha = function()
return typeCombatAlpha
end
local d = g:NewDropDown (frame17, _, "$parentCombatAlphaDropdown", "combatAlphaDropdown", 160, dropdown_height, buildTypeCombatAlpha, nil, options_dropdown_template)
frame17.combatAlphaDropdown:SetPoint ("left", frame17.combatAlphaLabel, "right", 2, 0)
window:CreateLineBackground2 (frame17, "combatAlphaDropdown", "combatAlphaLabel", Loc ["STRING_OPTIONS_COMBAT_ALPHA_DESC"])
g:NewLabel (frame17, _, "$parentHideOnCombatAlphaLabel", "hideOnCombatAlphaLabel", Loc ["STRING_ALPHA"], "GameFontHighlightLeft")
local s = g:NewSlider (frame17, _, "$parentHideOnCombatAlphaSlider", "hideOnCombatAlphaSlider", SLIDER_WIDTH, SLIDER_HEIGHT, 0, 100, 1, _G.DetailsOptionsWindow.instance.hide_in_combat_alpha, nil, nil, nil, options_slider_template)
--config_slider (s)
frame17.hideOnCombatAlphaSlider:SetPoint ("left", frame17.hideOnCombatAlphaLabel, "right", 2, 0)
frame17.hideOnCombatAlphaSlider:SetHook ("OnValueChange", function (self, instance, amount) --> slider, fixedValue, sliderValue
instance.hide_in_combat_alpha = amount
instance:SetCombatAlpha (nil, nil, true)
local optionsOrder = {3, 4, 5, 6, 7, 8, 1, 2}
local header1Label = _G.DetailsFramework:CreateLabel(frame17, Loc["STRING_CONTEXT"])
local header2Label = _G.DetailsFramework:CreateLabel(frame17, Loc["STRING_ENABLED"])
local header3Label = _G.DetailsFramework:CreateLabel(frame17, Loc["STRING_INVERT_RULE"])
local header4Label = _G.DetailsFramework:CreateLabel(frame17, Loc["STRING_ALPHA"])
local yyy = window.top_start_at - 20
header1Label:SetPoint("topleft", frame17, "topleft", window.right_start_at, yyy)
header2Label:SetPoint("topleft", frame17, "topleft", window.right_start_at + 96, yyy)
header3Label:SetPoint("topleft", frame17, "topleft", window.right_start_at + 140, yyy)
header4Label:SetPoint("topleft", frame17, "topleft", window.right_start_at + 270, yyy)
local onEnableHideContext = function(self, contextId, value)
local instance = _G.DetailsOptionsWindow.instance
instance.hide_on_context[contextId].enabled = value
instance:AdjustAlphaByContext()
--instance:SetCombatAlpha(combat_alpha)
if (_detalhes.options_group_edit and not DetailsOptionsWindow.loading_settings) then
for _, this_instance in ipairs (instance:GetInstanceGroup()) do
if (this_instance ~= instance) then
this_instance.hide_in_combat_alpha = amount
this_instance:SetCombatAlpha (nil, nil, true)
this_instance.hide_on_context[contextId].enabled = value
--this_instance:SetCombatAlpha (combat_alpha)
this_instance:AdjustAlphaByContext()
end
end
end
_detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance)
end)
window:CreateLineBackground2 (frame17, "hideOnCombatAlphaSlider", "hideOnCombatAlphaLabel", Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"])
_detalhes:SendOptionsModifiedEvent (instance)
end
local onInverseValue = function(self, contextId, value)
local instance = _G.DetailsOptionsWindow.instance
instance.hide_on_context[contextId].inverse = value
--instance:SetCombatAlpha(combat_alpha)
instance:AdjustAlphaByContext()
if (_detalhes.options_group_edit and not DetailsOptionsWindow.loading_settings) then
for _, this_instance in ipairs (instance:GetInstanceGroup()) do
if (this_instance ~= instance) then
this_instance.hide_on_context[contextId].inverse = value
--this_instance:SetCombatAlpha (combat_alpha)
this_instance:AdjustAlphaByContext()
end
end
end
_detalhes:SendOptionsModifiedEvent (instance)
end
local onAlphaChanged = function(self, contextId, value)
value = floor(value)
local instance = _G.DetailsOptionsWindow.instance
instance.hide_on_context[contextId].value = value
--instance:SetCombatAlpha(combat_alpha)
instance:AdjustAlphaByContext()
if (_detalhes.options_group_edit and not DetailsOptionsWindow.loading_settings) then
for _, this_instance in ipairs (instance:GetInstanceGroup()) do
if (this_instance ~= instance) then
this_instance.hide_on_context[contextId].value = value
--this_instance:SetCombatAlpha (combat_alpha)
this_instance:AdjustAlphaByContext()
end
end
end
_detalhes:SendOptionsModifiedEvent (instance)
end
frame17.AutoHideOptions = {}
for id, i in ipairs(optionsOrder) do
local line = _G.CreateFrame("frame", nil, frame17)
line:SetSize(300, 22)
line:SetPoint("topleft", frame17, "topleft", window.right_start_at, yyy + ((id) * -23) + 4)
_G.DetailsFramework:ApplyStandardBackdrop(line)
local contextLabel = _G.DetailsFramework:CreateLabel(line, typeCombatAlpha[i])
contextLabel:SetPoint("left", line, "left", 2, 0)
local enabledCheckbox = _G.DetailsFramework:NewSwitch(line, nil, nil, nil, 20, 20, nil, nil, false, nil, nil, nil, nil, options_switch_template)
enabledCheckbox:SetPoint("left", line, "left", 118, 0)
enabledCheckbox:SetAsCheckBox()
enabledCheckbox.OnSwitch = onEnableHideContext
enabledCheckbox:SetFixedParameter(i)
local reverseCheckbox = _G.DetailsFramework:NewSwitch(line, nil, nil, nil, 20, 20, nil, nil, false, nil, nil, nil, nil, options_switch_template)
reverseCheckbox:SetPoint("left", line, "left", 140, 0)
reverseCheckbox:SetAsCheckBox()
reverseCheckbox.OnSwitch = onInverseValue
reverseCheckbox:SetFixedParameter(i)
local alphaSlider = _G.DetailsFramework:CreateSlider(line, 138, 20, 0, 100, 1, 100, false, nil, nil, nil, options_slider_template)
alphaSlider:SetPoint("left", line, "left", 162, 0)
alphaSlider:SetHook("OnValueChanged", onAlphaChanged)
alphaSlider:SetFixedParameter(i)
line.contextLabel = contextLabel
line.enabledCheckbox = enabledCheckbox
line.reverseCheckbox = reverseCheckbox
line.alphaSlider = alphaSlider
frame17.AutoHideOptions[i] = line
end
--hide_on_context
--old alpha handle only allowed 1 context to be operational
--the new allows all context to be active
--old instruction
--instance:SetCombatAlpha (combat_alpha_id, ?, alpha value)
--Loc ["STRING_OPTIONS_HIDECOMBATALPHA_DESC"]
--> auto transparency
--> alpha onenter onleave auto transparency
@@ -3033,9 +3105,9 @@ function window:CreateFrame17()
window:arrange_menu (frame17, left_side, x, window.top_start_at)
local right_side = {
{"hideInCombatAnchor", 1, true},
{"combatAlphaLabel", 2},
{"hideOnCombatAlphaLabel", 3},
--{"hideInCombatAnchor", 1, true}, --deprecated
--{"combatAlphaLabel", 2},
--{"hideOnCombatAlphaLabel", 3},
{"menuAlphaAnchorLabel", 4, true},
{"alphaSwitchLabel", 5},
@@ -3044,7 +3116,7 @@ function window:CreateFrame17()
{"menuOnLeaveLabel", 8},
}
window:arrange_menu (frame17, right_side, window.right_start_at, window.top_start_at)
window:arrange_menu (frame17, right_side, window.right_start_at, window.top_start_at - 235)
@@ -11930,10 +12002,20 @@ end --> if not window
--_G.DetailsOptionsWindow18AdvancedAnimationsSlider.MyObject:SetValue (_detalhes.streamer_config.use_animation_accel)
--> window 17
_G.DetailsOptionsWindow17CombatAlphaDropdown.MyObject:Select (editing_instance.hide_in_combat_type, true)
_G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetValue (editing_instance.hide_in_combat_alpha)
-- _G.DetailsOptionsWindow17CombatAlphaDropdown.MyObject:Select (editing_instance.hide_in_combat_type, true) --deprecated, lines are now used
-- _G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetFixedParameter (editing_instance)
-- _G.DetailsOptionsWindow17HideOnCombatAlphaSlider.MyObject:SetValue (editing_instance.hide_in_combat_alpha)
--hide_on_context
local autoHideLines = _G.DetailsOptionsWindow17.AutoHideOptions
--for id, i in ipairs(autoHideLines) do
for i = 1, #autoHideLines do
local line = autoHideLines[i]
line.enabledCheckbox:SetValue(editing_instance.hide_on_context[i].enabled)
line.reverseCheckbox:SetValue(editing_instance.hide_on_context[i].inverse)
line.alphaSlider:SetValue(editing_instance.hide_on_context[i].value)
end
_G.DetailsOptionsWindow17MenuOnEnterLeaveAlphaSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow17MenuOnEnterAlphaSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow17MenuOnLeaveAlphaSlider.MyObject:SetFixedParameter (editing_instance)
+201 -100
View File
@@ -18,6 +18,7 @@ local _math_floor = math.floor
local _math_max = math.max
local _ipairs = ipairs
local _pairs = pairs
local abs = _G.abs
local _string_lower = string.lower
local _unpack = unpack
--api locals
@@ -35,6 +36,7 @@ local modo_raid = _detalhes._detalhes_props["MODO_RAID"]
local modo_alone = _detalhes._detalhes_props["MODO_ALONE"]
local modo_grupo = _detalhes._detalhes_props["MODO_GROUP"]
local modo_all = _detalhes._detalhes_props["MODO_ALL"]
local IsInInstance = _G.IsInInstance
local tok_functions = _detalhes.ToKFunctions
@@ -1045,6 +1047,7 @@ local BGFrame_scripts_onleave = function (self)
end
local BGFrame_scripts_onmousedown = function (self, button)
-- /run Details.disable_stretch_from_toolbar = true
if (self.is_toolbar and self._instance.baseframe.isLocked and button == "LeftButton" and not _detalhes.disable_stretch_from_toolbar) then
return self._instance.baseframe.button_stretch:GetScript ("OnMouseDown") (self._instance.baseframe.button_stretch, "LeftButton")
@@ -3471,8 +3474,8 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
--> background holds the wallpaper, alert strings ans textures, have setallpoints on baseframe
--> backgrounddisplay is a scrollschild of backgroundframe
local backgroundframe = CreateFrame ("scrollframe", "Details_WindowFrame"..ID, baseframe)
local backgrounddisplay = CreateFrame ("frame", "Details_GumpFrame"..ID, backgroundframe)
local backgroundframe = CreateFrame ("scrollframe", "Details_WindowFrame"..ID, baseframe) --window frame
local backgrounddisplay = CreateFrame ("frame", "Details_GumpFrame"..ID, backgroundframe) --gump frame
backgroundframe:SetFrameLevel (3)
backgrounddisplay:SetFrameLevel (3)
backgroundframe.instance = instancia
@@ -3480,20 +3483,18 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
instancia.windowBackgroundDisplay = backgrounddisplay
--> row frame is the parent of rows, it have setallpoints on baseframe
local rowframe = CreateFrame ("frame", "DetailsRowFrame"..ID, _UIParent)
local rowframe = CreateFrame ("frame", "DetailsRowFrame"..ID, _UIParent) --row frame
rowframe:SetAllPoints (baseframe)
rowframe:SetFrameStrata (baseframe_strata)
rowframe:SetFrameLevel (2)
rowframe:SetFrameLevel (3)
rowframe:EnableMouse(false)
instancia.rowframe = rowframe
--> right click bookmark
local switchbutton = gump:NewDetailsButton (backgrounddisplay, baseframe, nil, function() end, nil, nil, 1, 1, "", "", "", "",
{rightFunc = {func = function() _detalhes.switch:ShowMe (instancia) end, param1 = nil, param2 = nil}}, "Details_SwitchButtonFrame" .. ID)
switchbutton:SetPoint ("topleft", backgrounddisplay, "topleft")
switchbutton:SetPoint ("bottomright", backgrounddisplay, "bottomright")
switchbutton:SetFrameLevel (backgrounddisplay:GetFrameLevel()+1)
local switchbutton = CreateFrame("button", "Details_SwitchButtonFrame" .. ID, UIParent)
switchbutton:SetAllPoints (baseframe)
switchbutton:SetFrameStrata (baseframe_strata)
switchbutton:SetFrameLevel (4)
instancia.windowSwitchButton = switchbutton
--> avoid mouse hover over a high window when the menu is open for a lower instance.
@@ -3744,9 +3745,8 @@ function gump:CriaJanelaPrincipal (ID, instancia, criando)
-- scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------
BFrame_scripts (baseframe, instancia)
BGFrame_scripts (switchbutton, baseframe, instancia)
BFrame_scripts (baseframe, instancia) --baseframe
BGFrame_scripts (switchbutton, baseframe, instancia) --backgroundframe
BGFrame_scripts (backgrounddisplay, baseframe, instancia)
iterate_scroll_scripts (backgrounddisplay, backgroundframe, baseframe, scrollbar, instancia)
@@ -4982,11 +4982,12 @@ function _detalhes:SetWindowAlphaForInteract (alpha)
end
else
--> saiu
if (self.combat_changes_alpha) then --> combat alpha
if (self.combat_changes_alpha and self.combat_changes_alpha ~= 1) then --> combat alpha
self:InstanceAlpha (self.combat_changes_alpha)
self:SetIconAlpha (self.combat_changes_alpha, nil, true)
self.rowframe:SetAlpha (self.combat_changes_alpha) --alpha do combate absoluta
self.baseframe:SetAlpha (self.combat_changes_alpha) --alpha do combate absoluta
else
self:InstanceAlpha (alpha)
self:SetIconAlpha (alpha, nil, true)
@@ -5008,13 +5009,13 @@ function _detalhes:SetWindowAlphaForInteract (alpha)
end
-- ~autohide utohide
function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alphaAmount)
local amount, rowsamount, menuamount
--get the values
if (entering_in_combat) then
amount = self.hide_in_combat_alpha / 100
amount = alphaAmount / 100
self.combat_changes_alpha = amount
rowsamount = amount
menuamount = amount
@@ -5054,6 +5055,7 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
--apply
if (true_hide and amount == 0) then
--
gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_in))
gump:Fade (self.rowframe, _unpack (_detalhes.windows_fade_in))
self:SetIconAlpha (nil, true)
@@ -5061,8 +5063,9 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) hiding window SetWindowAlphaForCombat()", amount, rowsamount, menuamount)
end
--]]
else
--
self.baseframe:Show()
self.baseframe:SetAlpha (1)
@@ -5074,6 +5077,7 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide)
if (_detalhes.debug) then
_detalhes:Msg ("(debug) showing window SetWindowAlphaForCombat()", amount, rowsamount, menuamount)
end
--]]
end
if (self.show_statusbar) then
@@ -7168,7 +7172,7 @@ function _detalhes:ChangeSkin (skin_name)
self:SetFrameStrata()
--> update the combat alphas
self:SetCombatAlpha (nil, nil, true)
self:AdjustAlphaByContext()
--> update icons
_detalhes.ToolBar:ReorganizeIcons (true) --call self:SetMenuAlpha()
@@ -7398,103 +7402,201 @@ end
--endd
function _detalhes:DelayedCheckCombatAlpha (instance)
if (UnitAffectingCombat ("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (true, true) --> hida a janela
function _detalhes:DelayedCheckCombatAlpha (instance, alpha)
if ((UnitAffectingCombat("player") or InCombatLockdown())) then
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
else
instance:SetWindowAlphaForCombat (false) --> deshida a janela
instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela
end
end
function _detalhes:DelayedCheckOutOfCombatAlpha (instance)
if (UnitAffectingCombat ("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (false) --> deshida a janela
function _detalhes:DelayedCheckOutOfCombatAlpha (instance, alpha)
if (UnitAffectingCombat("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela
else
instance:SetWindowAlphaForCombat (true, true) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
end
end
function _detalhes:DelayedCheckOutOfCombatAndGroupAlpha (instance)
function _detalhes:DelayedCheckOutOfCombatAndGroupAlpha (instance, alpha, invert)
if ((_detalhes.zone_type == "raid" or _detalhes.zone_type == "party") and IsInInstance()) then
if (UnitAffectingCombat ("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (true, true) --> hida a janela
if (invert) then
if (UnitAffectingCombat("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
else
instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela
end
else
instance:SetWindowAlphaForCombat (false) --> deshida a janela
if (UnitAffectingCombat("player") or InCombatLockdown()) then
instance:SetWindowAlphaForCombat (false, false, alpha) --> deshida a janela
else
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
end
end
else
instance:SetWindowAlphaForCombat (true, true) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
instance:SetWindowAlphaForCombat (true, true, alpha) --> hida a janela
end
end
function _detalhes:SetCombatAlpha (modify_type, alpha_amount, interacting)
if (interacting) then
if (self.hide_in_combat_type == 1) then --None
return
elseif (self.hide_in_combat_type == 2) then --While In Combat
_detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self)
elseif (self.hide_in_combat_type == 3) then --"While Out of Combat"
_detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self)
elseif (self.hide_in_combat_type == 4) then --"While Out of a Group"
if (_detalhes.in_group) then
self:SetWindowAlphaForCombat (false) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true) --> hida a janela
end
elseif (self.hide_in_combat_type == 5) then --"While Not Inside Instance"
local isInInstance = IsInInstance()
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (false) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true) --> hida a janela
end
elseif (self.hide_in_combat_type == 6) then --"While Inside Instance"
local isInInstance = IsInInstance()
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (true, true) --> hida a janela
else
self:SetWindowAlphaForCombat (false) --> deshida a janela
end
elseif (self.hide_in_combat_type == 7) then --"Raid Debug" = Out of Combat and Inside Raid or Dungeon
_detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self)
elseif (self.hide_in_combat_type == 8) then --"In Battlegrounds"
local isInInstance = IsInInstance()
if (isInInstance and _detalhes.zone_type == "pvp") then
self:SetWindowAlphaForCombat (true, true) --> hida a janela
else
self:SetWindowAlphaForCombat (false) --> deshida a janela
end
end
return
local getAlphaByContext = function(instance, contextIndex, invert)
local alpha = instance.hide_on_context[contextIndex].value
if (invert) then
alpha = abs(alpha - 100)
end
if (not modify_type) then
modify_type = self.hide_in_combat_type
else
if (modify_type == 1) then --> changed to none
self:SetWindowAlphaForCombat (false)
end
end
if (not alpha_amount) then
alpha_amount = self.hide_in_combat_alpha
end
self.hide_in_combat_type = modify_type
self.hide_in_combat_alpha = alpha_amount
self:SetCombatAlpha (nil, nil, true)
return alpha
end
function _detalhes:AdjustAlphaByContext(interacting)
--in combat
if (not self.meu_id) then
print("error Details! AdjustAlphaByContext()", debugstack())
end
local hasRuleEnabled = false
--not in group
if (self.hide_on_context[3].enabled) then
hasRuleEnabled = true
if (_detalhes.in_group) then
if (self.hide_on_context[3].inverse) then
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela
else
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 3)) --> deshida a janela
end
else
if (self.hide_on_context[3].inverse) then
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 3)) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 3)) --> hida a janela
end
end
end
--while not inside instance
if (self.hide_on_context[4].enabled) then
hasRuleEnabled = true
local isInInstance = IsInInstance()
if (not self.hide_on_context[4].inverse) then
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 4)) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela
end
else
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 4)) --> hida a janela
else
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 4)) --> deshida a janela
end
end
end
--while inside instance
if (self.hide_on_context[5].enabled) then
hasRuleEnabled = true
local isInInstance = IsInInstance()
if (not self.hide_on_context[5].inverse) then
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela
else
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 5)) --> deshida a janela
end
else
if (isInInstance or _detalhes.zone_type == "raid" or _detalhes.zone_type == "party") then
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 5)) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 5)) --> hida a janela
end
end
end
--raid debug (inside instance + out of combat)
if (self.hide_on_context[6].enabled) then
hasRuleEnabled = true
_detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAndGroupAlpha", 0.3, self, getAlphaByContext(self, 6), self.hide_on_context[6].inverse)
end
--in battleground
if (self.hide_on_context[7].enabled) then
hasRuleEnabled = true
local isInInstance = IsInInstance()
if (isInInstance and _detalhes.zone_type == "pvp") then
if (not self.hide_on_context[7].inverse) then
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela
else
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 7)) --> deshida a janela
end
else
if (not self.hide_on_context[7].inverse) then
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 7)) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 7)) --> hida a janela
end
end
end
--mythic+
if (self.hide_on_context[8].enabled) then
hasRuleEnabled = true
if (_G.DetailsMythicPlusFrame.IsDoingMythicDungeon) then
if (not self.hide_on_context[8].inverse) then
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela
else
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 8)) --> deshida a janela
end
else
if (not self.hide_on_context[8].inverse) then
self:SetWindowAlphaForCombat (false, false, getAlphaByContext(self, 8)) --> deshida a janela
else
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela
self:SetWindowAlphaForCombat (true, true, getAlphaByContext(self, 8)) --> hida a janela
end
end
end
--in combat
if (self.hide_on_context[1].enabled) then
if (self.hide_on_context[1].inverse) then
_detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 1))
else
_detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 1))
end
hasRuleEnabled = true
end
--out of combat
if (self.hide_on_context[2].enabled) then
hasRuleEnabled = true
if (self.hide_on_context[2].inverse) then
_detalhes:ScheduleTimer ("DelayedCheckCombatAlpha", 0.3, self, getAlphaByContext(self, 2))
else
_detalhes:ScheduleTimer ("DelayedCheckOutOfCombatAlpha", 0.3, self, getAlphaByContext(self, 2))
end
end
--if no rule is enabled, show the window
if (not hasRuleEnabled) then
self:SetWindowAlphaForCombat (true, true, 100)
self:SetWindowAlphaForCombat (true, true, 100)
end
end
function _detalhes:SetFrameStrata (strata)
if (not strata) then
@@ -7504,6 +7606,7 @@ function _detalhes:SetFrameStrata (strata)
self.strata = strata
self.rowframe:SetFrameStrata (strata)
self.windowSwitchButton:SetFrameStrata (strata)
self.baseframe:SetFrameStrata (strata)
if (strata == "BACKGROUND") then
@@ -7535,11 +7638,9 @@ function _detalhes:SetFrameStrata (strata)
self.baseframe.resize_esquerda:SetFrameStrata ("FULLSCREEN")
self.baseframe.resize_direita:SetFrameStrata ("FULLSCREEN")
self.baseframe.lock_button:SetFrameStrata ("FULLSCREEN")
end
self:StretchButtonAlwaysOnTop()
end
function _detalhes:LeftMenuAnchorSide (side)