Nenue@90: -- Veneer Nenue@90: -- TalkingHead.lua Nenue@90: -- Created: 10/23/2016 5:18 AM Nenue@90: -- %file-revision% Nenue@90: -- Nenue@90: Nenue@122: local FRAME_PADDING = 2 Nenue@122: Nenue@90: local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop Nenue@121: local thf = TalkingHeadFrame Nenue@121: local m = { Nenue@90: Nenue@122: anchorPoint = 'TOPLEFT', Nenue@90: anchorFrom = 'TOPLEFT', Nenue@122: anchorX = 0, Nenue@122: anchorY = 0, Nenue@90: anchorFrame = 'ChatFrame1', Nenue@90: Nenue@90: } Nenue@121: VeneerTalkingHeadMixin = m Nenue@93: Nenue@93: local qf = {} Nenue@93: Nenue@93: Nenue@121: function m:OnLoad() Nenue@90: Veneer:AddHandler(self, self.anchorPoint) Nenue@121: -- force this so we can implant Nenue@121: LoadAddOn('Blizzard_TalkingHeadUI') Nenue@121: thf = TalkingHeadFrame Nenue@90: end Nenue@90: Nenue@121: function m:Setup() Nenue@121: print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown()) Nenue@90: Nenue@121: self:SetSize(thf:GetSize()) Nenue@90: Nenue@122: --hooksecurefunc(thf, 'SetPoint', function(...) Nenue@122: -- print('SetPoint', ...) Nenue@122: -- print(debugstack()) Nenue@122: --end) Nenue@122: Nenue@122: Nenue@122: self.Name:SetAllPoints(thf.NameFrame.Name) Nenue@122: self.Text:SetAllPoints(thf.TextFrame.Text) Nenue@122: self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait) Nenue@122: Nenue@122: self:ApplySettings() Nenue@90: Nenue@90: self:SetShown(true) Nenue@90: self:ClearAnchor() Nenue@90: end Nenue@90: Nenue@122: function m:ApplySettings() Nenue@122: Nenue@122: thf.NameFrame.Name:ClearAllPoints() Nenue@122: thf.TextFrame.Text:ClearAllPoints() Nenue@122: thf.PortraitFrame.Portrait:ClearAllPoints() Nenue@122: Nenue@122: print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) Nenue@122: thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.5) Nenue@122: Nenue@122: thf.NameFrame.Name:SetPoint('TOPLEFT', thf.PortraitFrame.Portrait, 'TOPRIGHT', FRAME_PADDING, 0) Nenue@122: thf.NameFrame.Name:SetPoint('RIGHT', thf, 'RIGHT', -FRAME_PADDING, 0) Nenue@122: thf.PortraitFrame.Portrait:SetPoint('TOPLEFT', thf, 'TOPLEFT', FRAME_PADDING, -FRAME_PADDING) Nenue@122: Nenue@122: Nenue@122: thf.TextFrame.Text:SetPoint('TOPLEFT', thf.NameFrame.Name, 'BOTTOMLEFT', 0, -FRAME_PADDING) Nenue@122: thf.TextFrame.Text:SetPoint('BOTTOMRIGHT', thf, 'BOTTOMRIGHT', -FRAME_PADDING, FRAME_PADDING) Nenue@122: Nenue@122: thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.75) Nenue@122: Nenue@122: thf.MainFrame.CloseButton:SetPoint('TOPRIGHT', thf, 'TOPRIGHT', 0, 0) Nenue@122: Nenue@122: --thf:EnableMouse(false) Nenue@122: thf:ClearAllPoints() Nenue@122: thf:SetAllPoints(self) Nenue@122: Nenue@122: end Nenue@122: Nenue@121: function m:ClearAnchor() Nenue@90: Nenue@90: UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil Nenue@90: for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do Nenue@121: if alertSubSystem.anchorFrame == thf then Nenue@90: tremove(AlertFrame.alertFrameSubSystems, i) Nenue@90: return Nenue@90: end Nenue@90: end Nenue@90: end Nenue@90: Nenue@121: function m:OnShow() Nenue@121: if thf then Nenue@121: print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) Nenue@90: print(debugstack()) Nenue@90: self:Update() Nenue@90: end Nenue@90: end Nenue@90: Nenue@121: function m:Reanchor() Nenue@90: self:ClearAllPoints() Nenue@122: self:SetPoint(self.anchorPoint, _G[self.anchorFrame], self.anchorFrom, self.anchorX, self.anchorY) Nenue@90: self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0) Nenue@90: -- independent module, Nenue@90: end Nenue@90: Nenue@121: function m:OnHide() Nenue@121: if thf then Nenue@121: print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown()) Nenue@90: end Nenue@90: Veneer:Reanchor() Nenue@90: end Nenue@90: Nenue@121: function m:Update() Nenue@90: Nenue@90: Veneer:InternalReanchor(self) Nenue@90: end