- Added an option to show a stopwatch on the title text showing the elapsed time of an encounter.

- Window title text now shrinks correctly when isn't enough space for it.
This commit is contained in:
Tercio
2015-07-14 17:24:17 -03:00
parent b2698005fb
commit e8b0b5687a
8 changed files with 150 additions and 28 deletions
+6 -3
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -134,7 +134,7 @@ _detalhes.instance_defaults = {
--blackwhiite icons
desaturated_menu = false, --mode segment attribute report
--icons on menu
menu_icons = {true, true, true, true, true, false, space = -4, shadow = false}, --mode segment attribute report reset close
menu_icons = {true, true, true, true, true, false, space = -3, shadow = false}, --mode segment attribute report reset close
--menu icons size multiplicator factor
menu_icons_size = 1.0, --mode segment attribute report
--auto hide menu buttons
@@ -149,7 +149,8 @@ _detalhes.instance_defaults = {
side = 1,
shadow = false,
enable_custom_text = false,
custom_text = "{name}"
custom_text = "{name}",
show_timer = {true, true, true}, --raid encounter, battleground, arena
},
--auto hide window borders statusbar main menu
menu_alpha = {enabled = false, iconstoo = true, onenter = 1, onleave = 1, ignorebars = false},
+3
View File
@@ -379,6 +379,7 @@
_detalhes:SendEvent ("COMBAT_PLAYER_ENTER", nil, _detalhes.tabela_vigente, _detalhes.encounter_table and _detalhes.encounter_table.id)
_detalhes:CheckSwitchToCurrent()
_detalhes:CheckForTextTimeCounter (true)
end
function _detalhes:DelayedSyncAlert()
@@ -727,6 +728,8 @@
_detalhes:SendEvent ("COMBAT_PLAYER_LEAVE", nil, _detalhes.tabela_vigente)
end
_detalhes:CheckForTextTimeCounter()
end
function _detalhes:GetPlayersInArena()
+1 -1
View File
@@ -206,7 +206,7 @@
if (is_in_instance and _detalhes.remove_realm_from_name) then
esta_classe.displayName = nome:gsub (("%-.*"), "")
elseif (_detalhes.remove_realm_from_name) then
esta_classe.displayName = nome:gsub (("%-.*"), "%*")
esta_classe.displayName = nome:gsub (("%-.*"), "") --%*
else
esta_classe.displayName = nome
end
-2
View File
@@ -3145,8 +3145,6 @@
_detalhes.encounter_table.index = boss_index
end
--print ("Combat Start 2")
end
function _detalhes.parser_functions:ENCOUNTER_END (...)
+10 -14
View File
@@ -62,9 +62,6 @@
self.proximo_update = 0
end
-- /run print( _detalhes:GetInstance(1).rowframe:GetParent():GetName())
-- /run print (DetailsBarra_1_1:GetParent():GetName())
function _detalhes:fazer_animacoes (amt_barras)
--aqui
@@ -1259,7 +1256,6 @@
if (not boss_repeated [encounterId]) then
local encounter, instance = _detalhes:GetBossEncounterDetailsFromEncounterId (_, encounterId)
if (encounter) then
--print ("encounter found", encounter.boss, encounter.name, instance)
tinsert (boss_list, {value = encounterId, label = encounter.boss, icon = icon, onclick = on_boss_select})
boss_repeated [encounterId] = true
@@ -2501,19 +2497,19 @@
local text = panel.editbox:GetText()
--text = text:gsub ("\n", "")
local test = text
--local test = text
local function errorhandler(err)
return geterrorhandler()(err)
end
--local function errorhandler(err)
-- return geterrorhandler()(err)
--end
local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]]
code = code:gsub ("STR", test)
--local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]]
--code = code:gsub ("STR", test)
local f = loadstring (code)
if (not f) then
print (f)
end
--local f = loadstring (code)
--if (not f) then
-- print ("loadstring failed:", f)
--end
--local err, two = xpcall (f, errorhandler)
--if (not err) then
-- return
+28 -5
View File
@@ -3588,6 +3588,26 @@ function window:CreateFrame14()
--frame14.attributeSideSwitch:SetThumbSize (50)
window:CreateLineBackground2 (frame14, "attributeSideSwitch", "attributeSideLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_SIDE_DESC"])
--show timer
--for encounters
g:NewLabel (frame14, _, "$parentAttributeEncounterTimerLabel", "AttributeEncounterTimerLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENCOUNTERTIMER"], "GameFontHighlightLeft")
g:NewSwitch (frame14, _, "$parentAttributeEncounterTimerSwitch", "AttributeEncounterTimerSwitch", 60, 20, nil, nil, instance.attribute_text.show_timer [1])
frame14.AttributeEncounterTimerSwitch:SetPoint ("left", frame14.AttributeEncounterTimerLabel, "right", 2)
frame14.AttributeEncounterTimerSwitch.OnSwitch = function (self, instance, value)
instance:AttributeMenu (nil, nil, nil, nil, nil, nil, nil, nil, value)
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:AttributeMenu (nil, nil, nil, nil, nil, nil, nil, nil, value)
end
end
end
_detalhes:SendOptionsModifiedEvent (DetailsOptionsWindow.instance)
end
window:CreateLineBackground2 (frame14, "AttributeEncounterTimerSwitch", "AttributeEncounterTimerLabel", Loc ["STRING_OPTIONS_MENU_ATTRIBUTE_ENCOUNTERTIMER_DESC"])
--frame14.attributeLabel:SetPoint (10, -205)
--general anchor
@@ -3600,16 +3620,17 @@ function window:CreateFrame14()
titulo_attributetext_desc:SetPoint (x, -50)
local left_side = {
{"TextAnchorLabel", 6, true},
{"attributeTextColorLabel", 7},
{"attributeTextSizeLabel", 8},
{"attributeFontLabel", 9},
{"attributeShadowLabel", 10},
{"SettingsAnchorLabel", 1, true},
{"attributeEnabledLabel", 2},
{"attributeAnchorXLabel", 3},
{"attributeAnchorYLabel", 4},
{"attributeSideLabel", 5},
{"AttributeEncounterTimerLabel", 6},
{"TextAnchorLabel", 7, true},
{"attributeTextColorLabel", 8},
{"attributeTextSizeLabel", 9},
{"attributeFontLabel", 10},
{"attributeShadowLabel", 11},
}
window:arrange_menu (frame14, left_side, x, -90)
@@ -10400,6 +10421,7 @@ end --> if not window
_G.DetailsOptionsWindow14AttributeFontDropdown.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeTextSizeSlider.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeShadowSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeEncounterTimerSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeEnabledSwitch.MyObject:SetValue (editing_instance.attribute_text.enabled)
_G.DetailsOptionsWindow14AttributeAnchorXSlider.MyObject:SetValue (editing_instance.attribute_text.anchor [1])
@@ -10408,6 +10430,7 @@ end --> if not window
_G.DetailsOptionsWindow14AttributeTextSizeSlider.MyObject:SetValue (tonumber (editing_instance.attribute_text.text_size))
_G.DetailsOptionsWindow14AttributeTextColorPick.MyObject:SetColor (unpack (editing_instance.attribute_text.text_color))
_G.DetailsOptionsWindow14AttributeShadowSwitch.MyObject:SetValue (editing_instance.attribute_text.shadow)
_G.DetailsOptionsWindow14AttributeEncounterTimerSwitch.MyObject:SetValue (editing_instance.attribute_text.show_timer [1])
_G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetFixedParameter (editing_instance)
_G.DetailsOptionsWindow14AttributeSideSwitch.MyObject:SetValue (editing_instance.attribute_text.side)
+99 -1
View File
@@ -1087,6 +1087,7 @@ local BFrame_scripts_onsizechange = function (self)
self._instance:ReajustaGump()
self._instance.oldwith = self:GetWidth()
_detalhes:SendEvent ("DETAILS_INSTANCE_SIZECHANGED", nil, self._instance)
self._instance:RefreshAttributeTextSize()
end
local BFrame_scripts_onenter = function (self)
@@ -5031,6 +5032,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report,
local space = self.menu_icons.space
local shadow = self.menu_icons.shadow
local total_buttons_shown = 0
--> normal buttons
if (self.menu_anchor.side == 1) then
@@ -5060,6 +5063,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report,
button:SetHighlightTexture ([[Interface\AddOns\Details\images\toolbar_icons]])
button:SetPushedTexture ([[Interface\AddOns\Details\images\toolbar_icons]])
end
total_buttons_shown = total_buttons_shown + 1
else
button:Hide()
end
@@ -5094,6 +5099,8 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report,
button:SetHighlightTexture ([[Interface\AddOns\Details\images\toolbar_icons]])
button:SetPushedTexture ([[Interface\AddOns\Details\images\toolbar_icons]])
end
total_buttons_shown = total_buttons_shown + 1
else
button:Hide()
end
@@ -5147,10 +5154,15 @@ function _detalhes:ToolbarMenuSetButtons (_mode, _segment, _attributes, _report,
button:SetPushedTexture (button.__icon)
button:SetHighlightTexture (button.__icon, "ADD")
end
total_buttons_shown = total_buttons_shown + 1
end
end
end
self.total_buttons_shown = total_buttons_shown
self:RefreshAttributeTextSize()
return true
end
@@ -6246,7 +6258,78 @@ function _detalhes:LeftMenuAnchorSide (side)
end
-- ~attributemenu (text with attribute name)
function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow)
function _detalhes:RefreshAttributeTextSize()
if (self.attribute_text.enabled and self.total_buttons_shown and self.baseframe and self.menu_attribute_string) then
local window_width = self:GetSize()
local buttons_shown = self.total_buttons_shown
local buttons_width, buttons_spacement = self.menu_icons_size * 16, self.menu_icons.space
local width_by_buttons = (buttons_shown * buttons_width) + (buttons_spacement * (buttons_shown - 1))
local text_size = window_width - width_by_buttons - 6
self.menu_attribute_string:SetWidth (text_size)
self.menu_attribute_string:SetHeight (self.attribute_text.text_size + 2)
end
end
function _detalhes:CheckForTextTimeCounter (combat_start)
if (combat_start) then
local combat = _detalhes.tabela_vigente
if (combat.is_boss) then
local lower = _detalhes:GetLowerInstanceNumber()
if (lower) then
local instance = _detalhes:GetInstance (lower)
if (instance.baseframe and instance:IsEnabled()) then
if (instance.attribute_text.show_timer [1]) then
if (_detalhes.instance_title_text_timer [instance.meu_id]) then
_detalhes:CancelTimer (_detalhes.instance_title_text_timer [instance.meu_id])
end
_detalhes.instance_title_text_timer [instance.meu_id] = _detalhes:ScheduleRepeatingTimer ("TitleTextTickTimer", 1, instance)
end
end
else
return
end
end
else
for _, instance in ipairs (_detalhes.tabela_instancias) do
if (_detalhes.instance_title_text_timer [instance.meu_id]) then
_detalhes:CancelTimer (_detalhes.instance_title_text_timer [instance.meu_id])
local current_text = instance.menu_attribute_string:GetText()
current_text = current_text:gsub ("%[.*%] ", "")
instance.menu_attribute_string:SetText (current_text)
end
end
end
end
local format_timer = function (t)
local m, s = _math_floor (t/60), _math_floor (t%60)
if (m < 1) then
m = "00"
elseif (m < 10) then
m = "0" .. m
end
if (s < 10) then
s = "0" .. s
end
return "[" .. m .. ":" .. s .. "]"
end
function _detalhes:TitleTextTickTimer (instance)
if (instance.attribute_text.enabled) then
local current_text = instance.menu_attribute_string:GetText()
if (not current_text:find ("%[.*%]")) then
instance.menu_attribute_string:SetText ("[00:01] " .. current_text)
else
local timer = format_timer (_detalhes.tabela_vigente:GetCombatTime())
current_text = current_text:gsub ("%[.*%]", timer)
instance.menu_attribute_string:SetText (current_text)
end
end
end
function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow, timer_encounter, timer_bg, timer_arena)
if (type (enabled) ~= "boolean") then
enabled = self.attribute_text.enabled
@@ -6279,6 +6362,16 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side
shadow = self.attribute_text.shadow
end
if (type (timer_encounter) ~= "boolean") then
timer_encounter = self.attribute_text.show_timer [1]
end
if (type (timer_bg) ~= "boolean") then
timer_bg = self.attribute_text.show_timer [2]
end
if (type (timer_arena) ~= "boolean") then
timer_arena = self.attribute_text.show_timer [3]
end
self.attribute_text.enabled = enabled
self.attribute_text.anchor [1] = pos_x
self.attribute_text.anchor [2] = pos_y
@@ -6287,6 +6380,9 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side
self.attribute_text.text_color = color
self.attribute_text.side = side
self.attribute_text.shadow = shadow
self.attribute_text.show_timer [1] = timer_encounter
self.attribute_text.show_timer [2] = timer_bg
self.attribute_text.show_timer [3] = timer_arena
--> enabled
if (not enabled and self.menu_attribute_string) then
@@ -6360,6 +6456,8 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side
--shadow
_detalhes:SetFontOutline (self.menu_attribute_string, shadow)
--refresh size
self:RefreshAttributeTextSize()
end
-- ~backdrop