annotate Modules/TalkingHead.lua @ 122:ea2c616a3b4f

Standardize anchor variables - anchorGroup sets general position, defers to anchorPoint - anchorPoint and anchorFrom are used in SetPoint, deferring to anchorGroup and its inverse Artifact Power: - scan and update triggers trimmed down BuffFrame: - extra values can be right clicked to hide for particular auras LFG: - Desolate Host link placed above Sisters when searching for best cheevos TalkingHead - Re-enable TalkingHeadFrame click behaviour
author Nenue
date Mon, 21 Aug 2017 22:15:46 -0400
parents 1f68c46bc4de
children b3c0258b419d
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@121 10 local thf = TalkingHeadFrame
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 -- force this so we can implant
Nenue@121 28 LoadAddOn('Blizzard_TalkingHeadUI')
Nenue@121 29 thf = TalkingHeadFrame
Nenue@90 30 end
Nenue@90 31
Nenue@121 32 function m:Setup()
Nenue@121 33 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
Nenue@90 34
Nenue@121 35 self:SetSize(thf:GetSize())
Nenue@90 36
Nenue@122 37 --hooksecurefunc(thf, 'SetPoint', function(...)
Nenue@122 38 -- print('SetPoint', ...)
Nenue@122 39 -- print(debugstack())
Nenue@122 40 --end)
Nenue@122 41
Nenue@122 42
Nenue@122 43 self.Name:SetAllPoints(thf.NameFrame.Name)
Nenue@122 44 self.Text:SetAllPoints(thf.TextFrame.Text)
Nenue@122 45 self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait)
Nenue@122 46
Nenue@122 47 self:ApplySettings()
Nenue@90 48
Nenue@90 49 self:SetShown(true)
Nenue@90 50 self:ClearAnchor()
Nenue@90 51 end
Nenue@90 52
Nenue@122 53 function m:ApplySettings()
Nenue@122 54
Nenue@122 55 thf.NameFrame.Name:ClearAllPoints()
Nenue@122 56 thf.TextFrame.Text:ClearAllPoints()
Nenue@122 57 thf.PortraitFrame.Portrait:ClearAllPoints()
Nenue@122 58
Nenue@122 59 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@122 60 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.5)
Nenue@122 61
Nenue@122 62 thf.NameFrame.Name:SetPoint('TOPLEFT', thf.PortraitFrame.Portrait, 'TOPRIGHT', FRAME_PADDING, 0)
Nenue@122 63 thf.NameFrame.Name:SetPoint('RIGHT', thf, 'RIGHT', -FRAME_PADDING, 0)
Nenue@122 64 thf.PortraitFrame.Portrait:SetPoint('TOPLEFT', thf, 'TOPLEFT', FRAME_PADDING, -FRAME_PADDING)
Nenue@122 65
Nenue@122 66
Nenue@122 67 thf.TextFrame.Text:SetPoint('TOPLEFT', thf.NameFrame.Name, 'BOTTOMLEFT', 0, -FRAME_PADDING)
Nenue@122 68 thf.TextFrame.Text:SetPoint('BOTTOMRIGHT', thf, 'BOTTOMRIGHT', -FRAME_PADDING, FRAME_PADDING)
Nenue@122 69
Nenue@122 70 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.75)
Nenue@122 71
Nenue@122 72 thf.MainFrame.CloseButton:SetPoint('TOPRIGHT', thf, 'TOPRIGHT', 0, 0)
Nenue@122 73
Nenue@122 74 --thf:EnableMouse(false)
Nenue@122 75 thf:ClearAllPoints()
Nenue@122 76 thf:SetAllPoints(self)
Nenue@122 77
Nenue@122 78 end
Nenue@122 79
Nenue@121 80 function m:ClearAnchor()
Nenue@90 81
Nenue@90 82 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
Nenue@90 83 for i, alertSubSystem in pairs(AlertFrame.alertFrameSubSystems) do
Nenue@121 84 if alertSubSystem.anchorFrame == thf then
Nenue@90 85 tremove(AlertFrame.alertFrameSubSystems, i)
Nenue@90 86 return
Nenue@90 87 end
Nenue@90 88 end
Nenue@90 89 end
Nenue@90 90
Nenue@121 91 function m:OnShow()
Nenue@121 92 if thf then
Nenue@121 93 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
Nenue@90 94 print(debugstack())
Nenue@90 95 self:Update()
Nenue@90 96 end
Nenue@90 97 end
Nenue@90 98
Nenue@121 99 function m:Reanchor()
Nenue@90 100 self:ClearAllPoints()
Nenue@122 101 self:SetPoint(self.anchorPoint, _G[self.anchorFrame], self.anchorFrom, self.anchorX, self.anchorY)
Nenue@90 102 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0)
Nenue@90 103 -- independent module,
Nenue@90 104 end
Nenue@90 105
Nenue@121 106 function m:OnHide()
Nenue@121 107 if thf then
Nenue@121 108 print('|cFF00AAFF'..self:GetName()..'|r:OnHide()', thf:IsShown(), self:IsShown())
Nenue@90 109 end
Nenue@90 110 Veneer:Reanchor()
Nenue@90 111 end
Nenue@90 112
Nenue@121 113 function m:Update()
Nenue@90 114
Nenue@90 115 Veneer:InternalReanchor(self)
Nenue@90 116 end