- Attempt to fix Embed AddonSkins position using LibWindow-1.1

- Attempt to fix positioning after reopen a window previously closed on last logon.
This commit is contained in:
Tercio
2015-01-24 20:17:00 -02:00
parent 18907c43dc
commit 1add7af405
9 changed files with 150 additions and 58 deletions
+5 -3
View File
File diff suppressed because one or more lines are too long
+2 -8
View File
@@ -459,10 +459,6 @@ end
end
_detalhes:TrocaTabela (self, nil, nil, nil, true)
--gump:Fade (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_out))
--gump:Fade (self.baseframe.cabecalho.ball, _unpack (_detalhes.windows_fade_out))
--gump:Fade (self.baseframe, _unpack (_detalhes.windows_fade_out))
if (self.hide_icon) then
gump:Fade (self.baseframe.cabecalho.atributo_icon, 1)
@@ -492,13 +488,10 @@ end
self:SetCombatAlpha (nil, nil, true)
self:DesaturateMenu()
--if (self.hide_out_of_combat and not UnitAffectingCombat ("player")) then
-- self:SetWindowAlphaForCombat (true, true)
--end
if (not temp and not _detalhes.initializing) then
_detalhes:SendEvent ("DETAILS_INSTANCE_OPEN", nil, self)
end
end
------------------------------------------------------------------------------------------------------------------------
@@ -1404,6 +1397,7 @@ function _detalhes:RestauraJanela (index, temp, load_only)
--> internal stuff
self.oldwith = self.baseframe:GetWidth()
self:RestoreMainWindowPosition()
self:ReajustaGump()
--self:SaveMainWindowPosition()
+23 -17
View File
@@ -211,7 +211,6 @@
--------------------------------------------------------------------------------------------------------
--> LibWindow-1.1
--this is the restore function from Libs\LibWindow-1.1\LibWindow-1.1.lua we can't schedule and we save it inside the instance without frame references.
function _detalhes:RestoreLibWindow()
local frame = self.baseframe
if (frame) then
@@ -239,15 +238,17 @@
if not point and y==0 then -- errr why did i do this check again? must have been a reason, but i can't remember it =/
point="CENTER"
end
--> Details: using UIParent always in order to not break the positioning when using AddonSkin with ElvUI.
if not point then -- we have position, but no point, which probably means we're going from data stored by the addon itself before LibWindow was added to it. It was PROBABLY topleft->bottomleft anchored. Most do it that way.
frame:SetPoint("TOPLEFT", frame:GetParent(), "BOTTOMLEFT", x, y)
--frame:SetPoint("TOPLEFT", frame:GetParent(), "BOTTOMLEFT", x, y)
frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", x, y)
-- make it compute a better attachpoint (on next update)
--_detalhes:ScheduleTimer ("SaveLibWindow", 0.05, self)
return
end
frame:SetPoint(point, frame:GetParent(), point, x, y)
frame:SetPoint(point, UIParent, point, x, y)
end
end
@@ -255,7 +256,6 @@
--> LibWindow-1.1
--this is the save function from Libs\LibWindow-1.1\LibWindow-1.1.lua, we save it inside the instance without frame references.
function _detalhes:SaveLibWindow()
local frame = self.baseframe
if (frame) then
@@ -267,7 +267,9 @@
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "SAVING 1: " .. (self.libwindow.x or 0))
--> LibWindow-1.1 ----------------
local parent = frame:GetParent() or nilParent
--local parent = frame:GetParent() or nilParent
--> Details: we are always using UIParent here or the addon is broken when using AddonSkins for ElvUI.
local parent = UIParent
-- No, this won't work very well with frames that aren't parented to nil or UIParent
local s = frame:GetScale()
local left,top = frame:GetLeft()*s, frame:GetTop()*s
@@ -315,6 +317,7 @@
--------------------------------------------------------------------------------------------------------
function _detalhes:SaveMainWindowSize()
local baseframe_width = self.baseframe:GetWidth()
if (not baseframe_width) then
return _detalhes:ScheduleTimer ("SaveMainWindowSize", 1, self)
@@ -370,8 +373,6 @@
function _detalhes:SaveMainWindowPosition (instance)
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "SaveMainWindowPosition: " .. debugstack())
if (instance) then
self = instance
end
@@ -391,7 +392,7 @@
end
self:SaveLibWindow()
--> save the position
local _w = baseframe_width
local _h = baseframe_height
@@ -427,18 +428,17 @@
end
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement --> espaço para o final da janela
return {altura = self.baseframe:GetHeight(), largura = self.baseframe:GetWidth(), x = _x, y = _y}
end
function _detalhes:RestoreMainWindowPosition (pre_defined)
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "Restoring " .. ( self.libwindow.x or "NONE") .. " " .. (self.libwindow.point or "NONE"))
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "")
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, debugstack())
--tinsert (_detalhes.resize_debug, #_detalhes.resize_debug+1, "")
if (not pre_defined and self.libwindow.x and self.mostrando == "normal") then
local s = self.window_scale
self.baseframe:SetScale (s)
self.rowframe:SetScale (s)
self.baseframe:SetWidth (self.posicao[self.mostrando].w)
self.baseframe:SetHeight (self.posicao[self.mostrando].h)
@@ -447,6 +447,10 @@
return
end
local s = self.window_scale
self.baseframe:SetScale (s)
self.rowframe:SetScale (s)
local _scale = self.baseframe:GetEffectiveScale()
local _UIscale = _UIParent:GetScale()
@@ -469,7 +473,7 @@
end
function _detalhes:RestoreMainWindowPositionNoResize (pre_defined, x, y)
x = x or 0
y = y or 0
@@ -572,7 +576,7 @@
end
-- -4 difere a precisão de quando a barra será adicionada ou apagada da barra
self.baseframe.BoxBarrasAltura = self.baseframe:GetHeight() - end_window_spacement
self.baseframe.BoxBarrasAltura = (self.baseframe:GetHeight()) - end_window_spacement
local T = self.rows_fit_in_window
if (not T) then --> primeira vez que o gump esta sendo reajustado
@@ -603,6 +607,8 @@
self.barras [index]:SetWidth (self.baseframe:GetWidth()+self.row_info.space.right)
end
end
--> verifica se precisa esconder ou mostrar alguma barra
local A = self.barraS[1]
+56 -6
View File
@@ -1343,6 +1343,7 @@ local chart_panel_enable_line = function (f, thisbox)
f.Graphic.max_value = 0
local max = 0
local max_time = 0
for index, box in ipairs (f.BoxLabels) do
if (box.type == type and box.showing and box.enabled) then
@@ -1351,10 +1352,14 @@ local chart_panel_enable_line = function (f, thisbox)
if (data[4] > max) then
max = data[4]
end
if (data [5] > max_time) then
max_time = data [5]
end
end
end
f:SetScale (max)
f:SetTime (max_time)
elseif (type == "overlay") then
@@ -1497,8 +1502,7 @@ local chart_panel_add_overlay = function (self, overlayData, color, name, icon)
self.OverlaysAmount = self.OverlaysAmount + 1
end
local chart_panel_add_data = function (self, graphicData, color, name, lineTexture, smoothLevel)
local chart_panel_add_data = function (self, graphicData, color, name, elapsed_time, lineTexture, smoothLevel, firstIndex)
local f = self
self = self.Graphic
@@ -1524,7 +1528,21 @@ local chart_panel_add_data = function (self, graphicData, color, name, lineTextu
_data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --> x and y coords
_i = _i + 1
end
elseif (smoothLevel == -1) then
while (_i <= #content-2) do
local current = content[_i]
local minus_2 = content[_i-2] * 0.6
local minus_1 = content[_i-1] * 0.8
local plus_1 = content[_i+1] * 0.8
local plus_2 = content[_i+2] * 0.6
local v = (current + minus_2 + minus_1 + plus_1 + plus_2)/5 --> normalize
_data [#_data+1] = {scaleW*(_i-2), v/graphMaxDps} --> x and y coords
_i = _i + 1
end
elseif (smoothLevel == 1) then
_i = 2
while (_i <= #content-1) do
@@ -1561,15 +1579,42 @@ local chart_panel_add_data = function (self, graphicData, color, name, lineTextu
end
self.max_value = max_value
f:SetScale (max_value)
end
tinsert (f.GData, {_data, color or line_default_color, lineTexture, graphicData.max_value})
tinsert (f.GData, {_data, color or line_default_color, lineTexture, graphicData.max_value, elapsed_time})
if (name) then
f:AddLabel (color or line_default_color, name, "graphic", #f.GData)
end
self:AddDataSeries (_data, color or line_default_color, nil, lineTexture)
if (firstIndex) then
if (lineTexture) then
if (not lineTexture:find ("\\") and not lineTexture:find ("//")) then
local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)LibGraph%-2%.0%.lua")
if path then
lineTexture = "Interface\\AddOns\\" .. path .. lineTexture
else
lineTexture = nil
end
end
end
table.insert (self.Data, 1, {Points = _data, Color = color or line_default_color, lineTexture = lineTexture, ElapsedTime = elapsed_time})
self.NeedsUpdate = true
else
self:AddDataSeries (_data, color or line_default_color, nil, lineTexture)
self.Data [#self.Data].ElapsedTime = elapsed_time
end
local max_time = 0
for _, data in ipairs (self.Data) do
if (data.ElapsedTime > max_time) then
max_time = data.ElapsedTime
end
end
f:SetTime (max_time)
end
local chart_panel_onresize = function (self)
@@ -1630,6 +1675,10 @@ local chart_panel_mouseup = function (self, button)
end
end
local chart_panel_hide_close_button = function (self)
self.CloseButton:Hide()
end
function gump:CreateChartPanel (parent, w, h, name)
if (not name) then
@@ -1735,6 +1784,7 @@ function gump:CreateChartPanel (parent, w, h, name)
f.CanMove = chart_panel_can_move
f.AddLabel = chart_panel_add_label
f.AddOverlay = chart_panel_add_overlay
f.HideCloseButton = chart_panel_hide_close_button
f:SetScript ("OnSizeChanged", chart_panel_onresize)
chart_panel_onresize (f)
+34
View File
@@ -181,6 +181,40 @@ do
end
end
end
if (Actor.classe == "HUNTER") then
local container_misc = _detalhes.tabela_vigente[4]
local index = container_misc._NameIndexTable [Actor.nome]
if (index) then
local misc_actor = container_misc._ActorTable [index]
local buffs = misc_actor.buff_uptime_spells and misc_actor.buff_uptime_spells._ActorTable
if (buffs) then
for spellid, spell in _pairs (buffs) do
local spec = SpecSpellList [spellid]
if (spec) then
if (spec ~= Actor.spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor.spec = spec
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type (Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
end
return spec
else
break
end
end
end
end
end
end
end
end
+5 -10
View File
@@ -1,8 +1,3 @@
--File Revision: 1
--Last Modification: 05/12/07/2013
-- Change Log:
-- 05/12/07/2013: This file has been introduced.
local _detalhes = _G._detalhes
local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
@@ -1031,11 +1026,6 @@ local _
local statusbar_enabled1 = instance1.show_statusbar
local statusbar_enabled2 = instance2.show_statusbar
_detalhes.move_janela_func (instance1.baseframe, true, instance1)
_detalhes.move_janela_func (instance1.baseframe, false, instance1)
_detalhes.move_janela_func (instance2.baseframe, true, instance2)
_detalhes.move_janela_func (instance2.baseframe, false, instance2)
instance1.baseframe:SetSize (wight/2 - 4, height-20-21-8 - (statusbar_enabled1 and 14 or 0))
instance2.baseframe:SetSize (wight/2 - 4, height-20-21-8 - (statusbar_enabled2 and 14 or 0))
@@ -1052,6 +1042,11 @@ local _
instance1:SaveMainWindowPosition()
instance2:SaveMainWindowPosition()
_detalhes.move_janela_func (instance1.baseframe, true, instance1)
_detalhes.move_janela_func (instance1.baseframe, false, instance1)
_detalhes.move_janela_func (instance2.baseframe, true, instance2)
_detalhes.move_janela_func (instance2.baseframe, false, instance2)
end
+14 -4
View File
@@ -4,7 +4,7 @@ local Loc = LibStub ("AceLocale-3.0"):GetLocale ( "Details" )
local g = _detalhes.gump
local _
function _detalhes:OpenNewsWindow (text_to_show, dumpvalues)
function _detalhes:OpenNewsWindow (text_to_show, dumpvalues, keeptext)
local news_window = _detalhes:CreateOrOpenNewsWindow()
news_window:Title (Loc ["STRING_NEWS_TITLE"])
@@ -12,7 +12,7 @@ function _detalhes:OpenNewsWindow (text_to_show, dumpvalues)
if (text_to_show and type (text_to_show) == "table") then
local s = ""
for _, text in ipairs (text_to_show) do
if (type (text) == "string") then
if (type (text) == "string" or type (text) == "number") then
s = s .. text .. "\n"
end
end
@@ -27,9 +27,19 @@ function _detalhes:OpenNewsWindow (text_to_show, dumpvalues)
end
end
news_window:Text (s)
if (keeptext) then
news_window:Text ((DetailsNewsWindowText:GetText() or "") .. "\n\n" .. s)
else
news_window:Text (s)
end
else
news_window:Text (text_to_show or Loc ["STRING_VERSION_LOG"])
if (keeptext) then
news_window:Text ((DetailsNewsWindowText:GetText() or "") .. "\n\n" .. (text_to_show or Loc ["STRING_VERSION_LOG"]))
else
news_window:Text (text_to_show or Loc ["STRING_VERSION_LOG"])
end
end
news_window:Icon ([[Interface\AddOns\Details\images\icons2]], {108/512, 189/512, 319/512, 400/512})
+3 -3
View File
@@ -721,7 +721,7 @@ local movement_onupdate = function (self, elapsed)
end
end
local function move_janela (baseframe, iniciando, instancia)
local function move_janela (baseframe, iniciando, instancia, just_updating)
instancia_alvo = _detalhes.tabela_instancias [instancia.meu_id-1]
if (_detalhes.disable_window_groups) then
@@ -750,7 +750,7 @@ local function move_janela (baseframe, iniciando, instancia)
baseframe:SetClampRectInsets (-ClampLeft, ClampRight, ClampTop, -ClampBottom)
if (instancia_alvo) then
if (instancia_alvo and (instancia_alvo.ativa or not just_updating)) then
tempo_fades = 1.0
nao_anexados = {true, true, true, true}
@@ -960,7 +960,7 @@ local function move_janela (baseframe, iniciando, instancia)
_detalhes.snap_alert.animOut:Play()
_detalhes.MicroButtonAlert:Hide()
if (instancia_alvo) then
if (instancia_alvo and instancia_alvo.ativa and instancia_alvo.baseframe) then
instancia_alvo.h_esquerda:Stop()
instancia_alvo.h_baixo:Stop()
instancia_alvo.h_direita:Stop()
+8 -7
View File
@@ -179,8 +179,8 @@ function _G._detalhes:Start()
--print ("===============")
instance.do_not_snap = true
self.move_janela_func (instance.baseframe, true, instance)
self.move_janela_func (instance.baseframe, false, instance)
self.move_janela_func (instance.baseframe, true, instance, true)
self.move_janela_func (instance.baseframe, false, instance, true)
instance.do_not_snap = false
end
@@ -498,10 +498,11 @@ function _G._detalhes:Start()
DBM:RegisterCallback ("pull", dbm_callback_pull)
end
--function _detalhes:TestResize()
-- _detalhes:OpenNewsWindow (_detalhes.resize_debug)
--end
--_detalhes:ScheduleTimer ("TestResize", 3)
--[[
function _detalhes:TestResize()
_detalhes:OpenNewsWindow (_detalhes.resize_debug)
end
_detalhes:ScheduleTimer ("TestResize", 3)
--]]
end