vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- frame to show |
2 | local currentFrame = "General" |
||
3 | |||
4 | |||
5 | function eCastingBar_CloseConfig() |
||
6 | eCastingBarConfigFrame:Hide() |
||
7 | hideFrames() |
||
8 | end |
||
9 | |||
10 | function hideFrames() |
||
11 | eCastingBarGeneralFrame:Hide() |
||
12 | eCastingBarColorsFrame:Hide() |
||
13 | end |
||
14 | |||
15 | function eCastingBarConfig_OnShow() |
||
16 | hideFrames() |
||
17 | getglobal("eCastingBar"..currentFrame.."Frame"):Show() |
||
18 | end |
||
19 | |||
20 | function eCastingBar_Defaults() |
||
21 | eCastingBar_ResetSettings() |
||
22 | eCastingBar_LoadVariables() |
||
23 | end |
||
24 | |||
25 | function eCastingBar_ColorPicker_OnClick() |
||
26 | if (ColorPickerFrame:IsShown()) then |
||
27 | eCastingBar_ColorPicker_Cancelled(ColorPickerFrame.previousValues) |
||
28 | ColorPickerFrame:Hide() |
||
29 | else |
||
30 | local Red, Green, Blue, Alpha |
||
31 | |||
32 | Red, Green, Blue, Alpha = unpack(eCastingBar_Saved[eCastingBar_Player][this.objindex]) |
||
33 | ColorPickerFrame.previousValues = {Red, Green, Blue, Alpha} |
||
34 | ColorPickerFrame.cancelFunc = eCastingBar_ColorPicker_Cancelled |
||
35 | ColorPickerFrame.opacityFunc = eCastingBar_ColorPicker_OpacityChanged |
||
36 | ColorPickerFrame.func = eCastingBar_ColorPicker_ColorChanged |
||
37 | ColorPickerFrame.index = this:GetName().."Texture" |
||
38 | ColorPickerFrame.objindex = this.objindex |
||
39 | ColorPickerFrame.whenindex = this.whenindex |
||
40 | ColorPickerFrame.hasOpacity = true |
||
41 | ColorPickerFrame.opacity = Alpha |
||
42 | ColorPickerFrame:SetColorRGB(Red, Green, Blue) |
||
43 | ColorPickerFrame:ClearAllPoints() |
||
44 | local x = eCastingBarConfigFrame:GetCenter() |
||
45 | if (x < UIParent:GetWidth() / 2) then |
||
46 | ColorPickerFrame:SetPoint("LEFT", "eCastingBarConfigFrame", "RIGHT", 0, 0) |
||
47 | else |
||
48 | ColorPickerFrame:SetPoint("RIGHT", "eCastingBarConfigFrame", "LEFT", 0, 0) |
||
49 | end |
||
50 | |||
51 | ColorPickerFrame:Show() |
||
52 | end |
||
53 | end |
||
54 | |||
55 | function eCastingBar_ColorPicker_Cancelled(color) |
||
56 | eCastingBar_Saved[eCastingBar_Player][ColorPickerFrame.objindex] = color |
||
57 | |||
58 | getglobal(ColorPickerFrame.index):SetVertexColor(unpack(color)) |
||
59 | if (ColorPickerFrame.objindex == "FlashBorderColor" or ColorPickerFrame.objindex == "MirrorFlashBorderColor") then |
||
60 | eCastingBar_checkFlashBorderColors() |
||
61 | end |
||
62 | end |
||
63 | |||
64 | function eCastingBar_ColorPicker_OpacityChanged() |
||
65 | local r, g, b = ColorPickerFrame:GetColorRGB() |
||
66 | local a = OpacitySliderFrame:GetValue() |
||
67 | getglobal(ColorPickerFrame.index):SetVertexColor(r, g, b, a) |
||
68 | end |
||
69 | |||
70 | function eCastingBar_ColorPicker_ColorChanged() |
||
71 | local r, g, b = ColorPickerFrame:GetColorRGB() |
||
72 | local a = OpacitySliderFrame:GetValue() |
||
73 | getglobal(ColorPickerFrame.index):SetVertexColor(r,g,b,a) |
||
74 | if (not ColorPickerFrame:IsShown()) then |
||
75 | eCastingBar_Saved[eCastingBar_Player][ColorPickerFrame.objindex] = {r,g,b,a} |
||
76 | |||
77 | if (ColorPickerFrame.objindex == "FlashBorderColor" or ColorPickerFrame.objindex == "MirrorFlashBorderColor") then |
||
78 | eCastingBar_checkFlashBorderColors() |
||
79 | elseif (ColorPickerFrame.objindex == "TimeColor" or ColorPickerFrame.objindex == "MirrorTimeColor") then |
||
80 | eCastingBar_checkTimeColors() |
||
81 | elseif (ColorPickerFrame.objindex == "DelayColor") then |
||
82 | eCastingBar_setDelayColor() |
||
83 | end |
||
84 | end |
||
85 | end |
||
86 | |||
87 | function eCastingBar_SelectFrame() |
||
88 | local frames = {"eCastingBarGeneralFrame", "eCastingBarMirrorFrame", "eCastingBarColorsFrame"} |
||
89 | for _,v in frames do |
||
90 | getglobal(v):Hide() |
||
91 | end |
||
92 | currentFrame = this.index |
||
93 | getglobal("eCastingBar"..this.index.."Frame"):Show() |
||
94 | end |
||
95 | |||
96 | function eCastingBar_CheckButton_OnClick() |
||
97 | eCastingBar_Saved[eCastingBar_Player][this.index] = convertBooleanToInt(this:GetChecked()) |
||
98 | |||
99 | if (string.find(this.index, "Locked")) then |
||
100 | eCastingBar_checkLocked() |
||
101 | elseif (string.find(this.index, "Enabled")) then |
||
102 | if (string.find(this.index, "Mirror")) then |
||
103 | if (convertBooleanToInt(this:GetChecked()) == 0) then |
||
104 | showAllBlizzardMirrorFrames() |
||
105 | else |
||
106 | hideAllBlizzardMirrorFrames() |
||
107 | end |
||
108 | else |
||
109 | if (convertBooleanToInt(this:GetChecked()) == 0) then |
||
110 | if (eCastingBar.casting) then |
||
111 | eCastingBar_SpellcastStop( "") |
||
112 | elseif (eCastingBar.channeling) then |
||
113 | eCastingBar_SpellcastChannelUpdate( "", 0) |
||
114 | eCastingBar_SpellcastStop( "") |
||
115 | end |
||
116 | end |
||
117 | end |
||
118 | |||
119 | eCastingBar_checkEnabled() |
||
120 | elseif (string.find(this.index, "UsePerlTexture")) then |
||
121 | eCastingBar_checkTextures() |
||
122 | elseif (string.find(this.index, "HideBorder")) then |
||
123 | eCastingBar_checkBorders() |
||
124 | end |
||
125 | |||
126 | --setup() |
||
127 | end |
||
128 | |||
129 | function convertBooleanToInt(val) |
||
130 | if (val) then |
||
131 | return 1 |
||
132 | else |
||
133 | return 0 |
||
134 | end |
||
135 | end |
||
136 | |||
137 | function eCastingBarSlider_OnValueChanged() |
||
138 | eCastingBar_Saved[eCastingBar_Player][this.index] = this:GetValue() |
||
139 | if (getglobal("eCastingBar"..this.index.."EditBox")) then |
||
140 | getglobal("eCastingBar"..this.index.."EditBox"):SetNumber(this:GetValue()) |
||
141 | end |
||
142 | |||
143 | -- set the tool tip text |
||
144 | if (this:GetValue() == floor(this:GetValue())) then |
||
145 | GameTooltip:SetText(format("%d", this:GetValue())) |
||
146 | else |
||
147 | GameTooltip:SetText(format("%.2f", this:GetValue())) |
||
148 | end |
||
149 | |||
150 | eCastingBar_SetSize() |
||
151 | end |
||
152 | |||
153 | function eCastingBarSlider_OnEnter() |
||
154 | -- put the tool tip in the default position |
||
155 | GameTooltip:SetOwner(this, "ANCHOR_CURSOR") |
||
156 | |||
157 | -- set the tool tip text |
||
158 | if (this:GetValue() == floor(this:GetValue())) then |
||
159 | GameTooltip:SetText(format("%d", this:GetValue())) |
||
160 | else |
||
161 | GameTooltip:SetText(format("%.2f", this:GetValue())) |
||
162 | end |
||
163 | |||
164 | GameTooltip:Show() |
||
165 | end |
||
166 | |||
167 | function eCastingBarSlider_OnLeave() |
||
168 | GameTooltip:Hide() |
||
169 | end |
||
170 | |||
171 | function eCastingBar_setAnchor(subframe, xoffset, yoffset) |
||
172 | xoffset = getglobal(this:GetName().."_Label"):GetWidth() + xoffset + 5 |
||
173 | this:SetPoint("TOPLEFT", this:GetParent():GetName()..subframe, "BOTTOMLEFT", xoffset, yoffset) |
||
174 | end |
||
175 | |||
176 | function eCastingBar_Menu_TimeOut(elapsed) |
||
177 | if (this.timer) then |
||
178 | this.timer = this.timer - elapsed |
||
179 | if (this.timer < 0) then |
||
180 | this.timer = nil |
||
181 | this:Hide() |
||
182 | end |
||
183 | end |
||
184 | end |
||
185 | |||
186 | function eCastingBar_Menu_Show(menu, index, controlbox) |
||
187 | if (not menu) then return end |
||
188 | if (eCastingBar_DropMenu:IsVisible()) then |
||
189 | eCastingBar_DropMenu:Hide() |
||
190 | return |
||
191 | end |
||
192 | |||
193 | if (menu == "SavedSettings") then |
||
194 | menu = eCastingBar_MENU_SAVEDSETTINGS |
||
195 | end |
||
196 | |||
197 | eCastingBar_DropMenu.index = index |
||
198 | eCastingBar_DropMenu.controlbox = controlbox |
||
199 | |||
200 | local width = 0 |
||
201 | local count = 1 |
||
202 | local textwidth |
||
203 | local frame |
||
204 | |||
205 | for _,v in menu do |
||
206 | frame = getglobal("eCastingBar_DropMenu_Option"..count) |
||
207 | frame:SetFrameLevel(getglobal(controlbox):GetFrameLevel()) |
||
208 | frame:Show() |
||
209 | getglobal("eCastingBar_DropMenu_Option"..count.."_Text"):SetText(v.text) |
||
210 | frame.value =v.value |
||
211 | textwidth = getglobal("eCastingBar_DropMenu_Option"..count.."_Text"):GetWidth() |
||
212 | if (textwidth > width) then |
||
213 | width = textwidth |
||
214 | end |
||
215 | count = count + 1 |
||
216 | end |
||
217 | for i=1, 40 do |
||
218 | if (i < count) then |
||
219 | getglobal("eCastingBar_DropMenu_Option"..i):SetWidth(width) |
||
220 | else |
||
221 | getglobal("eCastingBar_DropMenu_Option"..i):Hide() |
||
222 | end |
||
223 | end |
||
224 | count = count - 1 |
||
225 | eCastingBar_DropMenu:SetWidth(width + 20) |
||
226 | eCastingBar_DropMenu:SetHeight(count * 15 + 20) |
||
227 | eCastingBar_DropMenu:ClearAllPoints() |
||
228 | eCastingBar_DropMenu:SetPoint("TOPRIGHT", controlbox, "BOTTOMRIGHT", 0, 0) |
||
229 | if (eCastingBar_DropMenu:GetBottom() < UIParent:GetBottom()) then |
||
230 | local yoffset = UIParent:GetBottom() - eCastingBar_DropMenu:GetBottom() |
||
231 | eCastingBar_DropMenu:ClearAllPoints() |
||
232 | eCastingBar_DropMenu:SetPoint("TOPRIGHT", controlbox, "BOTTOMRIGHT", 0, yoffset) |
||
233 | end |
||
234 | |||
235 | eCastingBar_DropMenu:Show() |
||
236 | end |
||
237 | |||
238 | function eCastingBar_Menu_OnClick() |
||
239 | this:GetParent():Hide() |
||
240 | getglobal(eCastingBar_DropMenu.controlbox.."_Setting"):SetText(getglobal(this:GetName().."_Text"):GetText()) |
||
241 | if (eCastingBar_DropMenu.index == "SpellJustify") then |
||
242 | eCastingBar_Saved[eCastingBar_Player].SpellJustify = this.value |
||
243 | eCastingBarText:SetJustifyH(this.value) |
||
244 | return |
||
245 | elseif (eCastingBar_DropMenu.index == "MirrorSpellJustify") then |
||
246 | eCastingBar_Saved[eCastingBar_Player].MirrorSpellJustify = this.value |
||
247 | for index = 1, MIRRORTIMER_NUMTIMERS, 1 do |
||
248 | getglobal("eCastingBarMirror"..index.."StatusBarText"):SetJustifyH(this.value) |
||
249 | end |
||
250 | return |
||
251 | elseif (eCastingBar_DropMenu.index == "SavedSettings") then |
||
252 | eCastingBar_SETTINGS_INDEX = this.value |
||
253 | return |
||
254 | end |
||
255 | end |