annotate Modules/TalkingHead.lua @ 123:b3c0258b419d v7.3.0-1

ArtifactPower: - XP progress bar fixes Currency: - More argus stuff - Block dimensions are calculated more consistently TalkingHead - Aesthetic changes - Default right-click behaviour restored (hides the text box)
author Nenue
date Tue, 05 Sep 2017 02:56:33 -0400
parents ea2c616a3b4f
children
rev   line source
Nenue@90 1 -- Veneer
Nenue@90 2 -- TalkingHead.lua
Nenue@90 3 -- Created: 10/23/2016 5:18 AM
Nenue@90 4 -- %file-revision%
Nenue@90 5 --
Nenue@90 6
Nenue@122 7 local FRAME_PADDING = 2
Nenue@122 8
Nenue@90 9 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
Nenue@123 10 local thf
Nenue@121 11 local m = {
Nenue@90 12
Nenue@122 13 anchorPoint = 'TOPLEFT',
Nenue@90 14 anchorFrom = 'TOPLEFT',
Nenue@122 15 anchorX = 0,
Nenue@122 16 anchorY = 0,
Nenue@90 17 anchorFrame = 'ChatFrame1',
Nenue@90 18
Nenue@90 19 }
Nenue@121 20 VeneerTalkingHeadMixin = m
Nenue@93 21
Nenue@93 22 local qf = {}
Nenue@93 23
Nenue@93 24
Nenue@121 25 function m:OnLoad()
Nenue@90 26 Veneer:AddHandler(self, self.anchorPoint)
Nenue@121 27 LoadAddOn('Blizzard_TalkingHeadUI')
Nenue@121 28 thf = TalkingHeadFrame
Nenue@90 29 end
Nenue@90 30
Nenue@121 31 function m:Setup()
Nenue@121 32 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
Nenue@90 33
Nenue@90 34
Nenue@122 35 --hooksecurefunc(thf, 'SetPoint', function(...)
Nenue@122 36 -- print('SetPoint', ...)
Nenue@122 37 -- print(debugstack())
Nenue@122 38 --end)
Nenue@122 39
Nenue@122 40 self.Name:SetAllPoints(thf.NameFrame.Name)
Nenue@122 41 self.Text:SetAllPoints(thf.TextFrame.Text)
Nenue@122 42 self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait)
Nenue@123 43 self:SetSize(thf:GetSize())
Nenue@122 44
Nenue@122 45 self:ApplySettings()
Nenue@90 46
Nenue@90 47 self:SetShown(true)
Nenue@90 48 self:ClearAnchor()
Nenue@90 49 end
Nenue@90 50
Nenue@122 51 function m:ApplySettings()
Nenue@123 52 if not thf then
Nenue@123 53 return
Nenue@123 54 end
Nenue@122 55
Nenue@122 56 thf.NameFrame.Name:ClearAllPoints()
Nenue@122 57 thf.TextFrame.Text:ClearAllPoints()
Nenue@122 58 thf.PortraitFrame.Portrait:ClearAllPoints()
Nenue@122 59
Nenue@122 60 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@122 61 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.5)
Nenue@122 62
Nenue@122 63 thf.NameFrame.Name:SetPoint('TOPLEFT', thf.PortraitFrame.Portrait, 'TOPRIGHT', FRAME_PADDING, 0)
Nenue@122 64 thf.NameFrame.Name:SetPoint('RIGHT', thf, 'RIGHT', -FRAME_PADDING, 0)
Nenue@122 65 thf.PortraitFrame.Portrait:SetPoint('TOPLEFT', thf, 'TOPLEFT', FRAME_PADDING, -FRAME_PADDING)
Nenue@122 66
Nenue@122 67
Nenue@122 68 thf.TextFrame.Text:SetPoint('TOPLEFT', thf.NameFrame.Name, 'BOTTOMLEFT', 0, -FRAME_PADDING)
Nenue@122 69 thf.TextFrame.Text:SetPoint('BOTTOMRIGHT', thf, 'BOTTOMRIGHT', -FRAME_PADDING, FRAME_PADDING)
Nenue@122 70
Nenue@122 71 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.75)
Nenue@122 72
Nenue@122 73 thf.MainFrame.CloseButton:SetPoint('TOPRIGHT', thf, 'TOPRIGHT', 0, 0)
Nenue@122 74
Nenue@122 75 --thf:EnableMouse(false)
Nenue@122 76 thf:ClearAllPoints()
Nenue@122 77 thf:SetAllPoints(self)
Nenue@122 78
Nenue@122 79 end
Nenue@122 80
Nenue@121 81 function m:ClearAnchor()
Nenue@123 82 if not thf then
Nenue@123 83 return
Nenue@123 84 end
Nenue@90 85
Nenue@90 86 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
Nenue@90 87 for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
Nenue@121 88 if alertSubSystem.anchorFrame == thf then
Nenue@90 89 tremove(AlertFrame.alertFrameSubSystems, i)
Nenue@90 90 return
Nenue@90 91 end
Nenue@90 92 end
Nenue@90 93 end
Nenue@90 94
Nenue@121 95 function m:OnShow()
Nenue@121 96 if thf then
Nenue@121 97 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@90 98 print(debugstack())
Nenue@90 99 self:Update()
Nenue@90 100 end
Nenue@90 101 end
Nenue@90 102
Nenue@121 103 function m:Reanchor()
Nenue@90 104 self:ClearAllPoints()
Nenue@122 105 self:SetPoint(self.anchorPoint, _G[self.anchorFrame], self.anchorFrom, self.anchorX, self.anchorY)
Nenue@90 106 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0)
Nenue@90 107 -- independent module,
Nenue@90 108 end
Nenue@90 109
Nenue@121 110 function m:OnHide()
Nenue@121 111 if thf then
Nenue@121 112 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown())
Nenue@90 113 end
Nenue@90 114 Veneer:Reanchor()
Nenue@90 115 end
Nenue@90 116
Nenue@121 117 function m:Update()
Nenue@123 118 if not thf then
Nenue@123 119 return
Nenue@123 120 end
Nenue@90 121
Nenue@90 122 Veneer:InternalReanchor(self)
Nenue@90 123 end