vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function oCB:CreateFramework(b, n, s) |
2 | self.frames[b] = CreateFrame("Frame", n, UIParent) |
||
3 | self.frames[b]:Hide() |
||
4 | self.frames[b].name = b |
||
5 | |||
6 | if(s =="MirrorBar") then |
||
7 | self.frames[b]:SetScript("OnUpdate", self.OnMirror) |
||
8 | else |
||
9 | self.frames[b]:SetScript("OnUpdate", self.OnCasting) |
||
10 | end |
||
11 | self.frames[b]:SetMovable(true) |
||
12 | self.frames[b]:EnableMouse(true) |
||
13 | self.frames[b]:RegisterForDrag("LeftButton") |
||
14 | self.frames[b]:SetScript("OnDragStart", function() if not self.db.profile.lock then this:StartMoving() end end) |
||
15 | self.frames[b]:SetScript("OnDragStop", function() this:StopMovingOrSizing() self:savePosition() end) |
||
16 | |||
17 | self.frames[b].Bar = CreateFrame("StatusBar", nil, self.frames[b]) |
||
18 | self.frames[b].Spark = self.frames[b].Bar:CreateTexture(nil, "OVERLAY") |
||
19 | self.frames[b].Time = self.frames[b].Bar:CreateFontString(nil, "OVERLAY") |
||
20 | self.frames[b].Spell = self.frames[b].Bar:CreateFontString(nil, "OVERLAY") |
||
21 | if(s ~="MirrorBar") then |
||
22 | self.frames[b].Delay = self.frames[b].Bar:CreateFontString(nil, "OVERLAY") |
||
23 | end |
||
24 | |||
25 | self:Layout(b, s) |
||
26 | end |
||
27 | |||
28 | function oCB:Layout(b, s) |
||
29 | local db = self.db.profile[s or b] |
||
30 | local f, _ = GameFontHighlightSmall:GetFont() |
||
31 | |||
32 | self.frames[b]:SetWidth(db.width+9) |
||
33 | self.frames[b]:SetHeight(db.height+10) |
||
34 | self.frames[b]:SetBackdrop({ |
||
35 | bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, |
||
36 | edgeFile = self.Borders[db.edgeFile], edgeSize = 16, |
||
37 | insets = {left = 5, right = 5, top = 5, bottom = 5}, |
||
38 | }) |
||
39 | self.frames[b]:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, TOOLTIP_DEFAULT_COLOR.b) |
||
40 | self.frames[b]:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) |
||
41 | |||
42 | self.frames[b].Bar:ClearAllPoints() |
||
43 | self.frames[b].Bar:SetPoint("CENTER", self.frames[b], "CENTER", 0, 0) |
||
44 | self.frames[b].Bar:SetWidth(db.width) |
||
45 | self.frames[b].Bar:SetHeight(db.height) |
||
46 | self.frames[b].Bar:SetStatusBarTexture(self.Textures[db.texture]) |
||
47 | |||
48 | self.frames[b].Spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark") |
||
49 | self.frames[b].Spark:SetWidth(16) |
||
50 | self.frames[b].Spark:SetHeight(db.height*2.44) |
||
51 | self.frames[b].Spark:SetBlendMode("ADD") |
||
52 | |||
53 | self.frames[b].Time:SetJustifyH("RIGHT") |
||
54 | self.frames[b].Time:SetFont(f,db.timeSize) |
||
55 | self.frames[b].Time:SetText("X.Y") |
||
56 | self.frames[b].Time:ClearAllPoints() |
||
57 | self.frames[b].Time:SetPoint("RIGHT", self.frames[b].Bar, "RIGHT",-10,0) |
||
58 | |||
59 | self.frames[b].Spell:SetJustifyH("CENTER") |
||
60 | self.frames[b].Spell:SetWidth(db.width-self.frames[b].Time:GetWidth()) |
||
61 | self.frames[b].Spell:SetFont(f,db.spellSize) |
||
62 | self.frames[b].Spell:ClearAllPoints() |
||
63 | self.frames[b].Spell:SetPoint("LEFT", self.frames[b], "LEFT",10,0) |
||
64 | |||
65 | if(s ~="MirrorBar") then |
||
66 | self.frames[b].Delay:SetTextColor(1,0,0,1) |
||
67 | self.frames[b].Delay:SetJustifyH("RIGHT") |
||
68 | self.frames[b].Delay:SetFont(f,db.delaySize) |
||
69 | self.frames[b].Delay:SetText("X.Y") |
||
70 | self.frames[b].Delay:ClearAllPoints() |
||
71 | self.frames[b].Delay:SetPoint("TOPRIGHT", self.frames[b], "TOPRIGHT",-10,20) |
||
72 | end |
||
73 | |||
74 | self:updatePositions(b) |
||
75 | end |
||
76 | |||
77 | function oCB:ShowBlizzCB() |
||
78 | CastingBarFrame:RegisterEvent("SPELLCAST_START") |
||
79 | CastingBarFrame:RegisterEvent("SPELLCAST_STOP") |
||
80 | CastingBarFrame:RegisterEvent("SPELLCAST_INTERRUPTED") |
||
81 | CastingBarFrame:RegisterEvent("SPELLCAST_FAILED") |
||
82 | CastingBarFrame:RegisterEvent("SPELLCAST_DELAYED") |
||
83 | CastingBarFrame:RegisterEvent("SPELLCAST_CHANNEL_START") |
||
84 | CastingBarFrame:RegisterEvent("SPELLCAST_CHANNEL_STOP") |
||
85 | end |
||
86 | |||
87 | function oCB:HideBlizzCB() |
||
88 | CastingBarFrame:UnregisterEvent("SPELLCAST_START") |
||
89 | CastingBarFrame:UnregisterEvent("SPELLCAST_STOP") |
||
90 | CastingBarFrame:UnregisterEvent("SPELLCAST_INTERRUPTED") |
||
91 | CastingBarFrame:UnregisterEvent("SPELLCAST_FAILED") |
||
92 | CastingBarFrame:UnregisterEvent("SPELLCAST_DELAYED") |
||
93 | CastingBarFrame:UnregisterEvent("SPELLCAST_CHANNEL_START") |
||
94 | CastingBarFrame:UnregisterEvent("SPELLCAST_CHANNEL_STOP") |
||
95 | end |