comparison 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
comparison
equal deleted inserted replaced
121:1f68c46bc4de 122:ea2c616a3b4f
2 -- TalkingHead.lua 2 -- TalkingHead.lua
3 -- Created: 10/23/2016 5:18 AM 3 -- Created: 10/23/2016 5:18 AM
4 -- %file-revision% 4 -- %file-revision%
5 -- 5 --
6 6
7 local FRAME_PADDING = 2
8
7 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop 9 local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop
8 local thf = TalkingHeadFrame 10 local thf = TalkingHeadFrame
9 local m = { 11 local m = {
10 12
11 anchorPoint = 'BOTTOMLEFT', 13 anchorPoint = 'TOPLEFT',
12 anchorFrom = 'TOPLEFT', 14 anchorFrom = 'TOPLEFT',
13 anchorX = -4, 15 anchorX = 0,
14 anchorY = 96, 16 anchorY = 0,
15 anchorFrame = 'ChatFrame1', 17 anchorFrame = 'ChatFrame1',
16 18
17 } 19 }
18 VeneerTalkingHeadMixin = m 20 VeneerTalkingHeadMixin = m
19 21
30 function m:Setup() 32 function m:Setup()
31 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown()) 33 print('|cFF00AAFF'..self:GetName()..'|r:Setup()', thf:IsShown(), self:IsShown())
32 34
33 self:SetSize(thf:GetSize()) 35 self:SetSize(thf:GetSize())
34 36
35 hooksecurefunc(thf, 'SetPoint', function(...) 37 --hooksecurefunc(thf, 'SetPoint', function(...)
36 print('SetPoint', ...) 38 -- print('SetPoint', ...)
37 print(debugstack()) 39 -- print(debugstack())
38 end) 40 --end)
41
42
43 self.Name:SetAllPoints(thf.NameFrame.Name)
44 self.Text:SetAllPoints(thf.TextFrame.Text)
45 self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait)
46
47 self:ApplySettings()
39 48
40 self:SetShown(true) 49 self:SetShown(true)
41 self:ClearAnchor() 50 self:ClearAnchor()
51 end
52
53 function m:ApplySettings()
54
55 thf.NameFrame.Name:ClearAllPoints()
56 thf.TextFrame.Text:ClearAllPoints()
57 thf.PortraitFrame.Portrait:ClearAllPoints()
58
59 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
60 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.5)
61
62 thf.NameFrame.Name:SetPoint('TOPLEFT', thf.PortraitFrame.Portrait, 'TOPRIGHT', FRAME_PADDING, 0)
63 thf.NameFrame.Name:SetPoint('RIGHT', thf, 'RIGHT', -FRAME_PADDING, 0)
64 thf.PortraitFrame.Portrait:SetPoint('TOPLEFT', thf, 'TOPLEFT', FRAME_PADDING, -FRAME_PADDING)
65
66
67 thf.TextFrame.Text:SetPoint('TOPLEFT', thf.NameFrame.Name, 'BOTTOMLEFT', 0, -FRAME_PADDING)
68 thf.TextFrame.Text:SetPoint('BOTTOMRIGHT', thf, 'BOTTOMRIGHT', -FRAME_PADDING, FRAME_PADDING)
69
70 thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.75)
71
72 thf.MainFrame.CloseButton:SetPoint('TOPRIGHT', thf, 'TOPRIGHT', 0, 0)
73
74 --thf:EnableMouse(false)
75 thf:ClearAllPoints()
76 thf:SetAllPoints(self)
77
42 end 78 end
43 79
44 function m:ClearAnchor() 80 function m:ClearAnchor()
45 81
46 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil 82 UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil
60 end 96 end
61 end 97 end
62 98
63 function m:Reanchor() 99 function m:Reanchor()
64 self:ClearAllPoints() 100 self:ClearAllPoints()
65 self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24) 101 self:SetPoint(self.anchorPoint, _G[self.anchorFrame], self.anchorFrom, self.anchorX, self.anchorY)
66 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0) 102 self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0)
67 -- independent module, 103 -- independent module,
68 end 104 end
69 105
70 function m:OnHide() 106 function m:OnHide()
74 Veneer:Reanchor() 110 Veneer:Reanchor()
75 end 111 end
76 112
77 function m:Update() 113 function m:Update()
78 114
79 print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown())
80 thf:ClearAllPoints()
81 thf:SetAllPoints(self)
82
83 Veneer:InternalReanchor(self) 115 Veneer:InternalReanchor(self)
84 end 116 end