vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --The Options Page functions |
2 | |||
3 | ------------------------------ |
||
4 | --Copy values from table that are nil in another. |
||
5 | --Taken from AceDB. Using till AceDB support character to character |
||
6 | local function inheritDefaults(t, defaults) |
||
7 | for k,v in pairs(defaults) do |
||
8 | if type(v) == "table" then |
||
9 | if type(t[k]) ~= "table" then |
||
10 | t[k] = {} |
||
11 | end |
||
12 | inheritDefaults(t[k], v) |
||
13 | elseif t[k] == nil then |
||
14 | t[k] = v |
||
15 | end |
||
16 | end |
||
17 | return t |
||
18 | end |
||
19 | |||
20 | ------------------------------ |
||
21 | --Copy table to table |
||
22 | --Taken from AceDB. Using till AceDB support character to character |
||
23 | local function copyTable(to, from) |
||
24 | setmetatable(to, nil) |
||
25 | for k,v in pairs(from) do |
||
26 | if type(k) == "table" then |
||
27 | k = copyTable({}, k) |
||
28 | end |
||
29 | if type(v) == "table" then |
||
30 | v = copyTable({}, v) |
||
31 | end |
||
32 | to[k] = v |
||
33 | end |
||
34 | table.setn(to, table.getn(from)) |
||
35 | setmetatable(to, from) |
||
36 | return to |
||
37 | end |
||
38 | |||
39 | ---------------------- |
||
40 | --Called when option page loads |
||
41 | function SCT:OptionsFrame_OnShow() |
||
42 | local option1, option2, option3, option4, option5, string, getvalue; |
||
43 | --Misc Options |
||
44 | for key, value in SCT.OPTIONS.FrameMisc do |
||
45 | string = getglobal("SCTOptionsFrame_Misc"..value.index); |
||
46 | if (string) then |
||
47 | string:SetText(key); |
||
48 | if (value.tooltipText) then |
||
49 | string.tooltipText = value.tooltipText; |
||
50 | end |
||
51 | end |
||
52 | end |
||
53 | |||
54 | local frame, swatch, sColor; |
||
55 | -- Set Options values |
||
56 | for key, value in SCT.OPTIONS.FrameEventFrames do |
||
57 | option1 = getglobal("SCTOptionsFrame"..value.index.."_CheckButton"); |
||
58 | option2 = getglobal("SCTOptionsFrame"..value.index.."_CritCheckButton"); |
||
59 | option3 = getglobal("SCTOptionsFrame"..value.index.."_RadioMsgButton"); |
||
60 | option4 = getglobal("SCTOptionsFrame"..value.index.."_RadioFrame1Button"); |
||
61 | option5 = getglobal("SCTOptionsFrame"..value.index.."_RadioFrame2Button"); |
||
62 | string = getglobal("SCTOptionsFrame"..value.index.."_CheckButtonText"); |
||
63 | |||
64 | --main check |
||
65 | option1.SCTVar = value.SCTVar; |
||
66 | option1:SetChecked(self.db.profile[value.SCTVar]); |
||
67 | option1.tooltipText = value.tooltipText; |
||
68 | string:SetText(key); |
||
69 | |||
70 | --crit check |
||
71 | option2.SCTVar = value.SCTVar; |
||
72 | option2:SetChecked(self.db.profile[self.CRITS_TABLE][value.SCTVar]); |
||
73 | option2.tooltipText = SCT.LOCALS.Option_Crit_Tip; |
||
74 | |||
75 | --radios |
||
76 | option3.tooltipText = SCT.LOCALS.Option_Msg_Tip; |
||
77 | option4.tooltipText = SCT.LOCALS.Frame1_Tip; |
||
78 | option5.tooltipText = SCT.LOCALS.Frame2_Tip; |
||
79 | self:OptionsRadioButtonOnClick(self.db.profile[self.FRAMES_TABLE][value.SCTVar],"SCTOptionsFrame"..value.index) |
||
80 | --set vars after setting up radios, so no redundant saving. |
||
81 | option3.SCTVar = value.SCTVar; |
||
82 | option4.SCTVar = value.SCTVar; |
||
83 | option5.SCTVar = value.SCTVar; |
||
84 | |||
85 | --Color Swatch |
||
86 | frame = getglobal("SCTOptionsFrame"..value.index); |
||
87 | swatch = getglobal("SCTOptionsFrame"..value.index.."_ColorSwatchNormalTexture"); |
||
88 | sColor = self.db.profile[self.COLORS_TABLE][value.SCTVar]; |
||
89 | frame.r = sColor.r; |
||
90 | frame.g = sColor.g; |
||
91 | frame.b = sColor.b; |
||
92 | local index = value.index; |
||
93 | local key = value.SCTVar; |
||
94 | frame.swatchFunc = function() self:OptionsFrame_SetColor(index, key) end; |
||
95 | frame.cancelFunc = function(x) self:OptionsFrame_CancelColor(index, key, x) end; |
||
96 | swatch:SetVertexColor(sColor.r,sColor.g,sColor.b); |
||
97 | end |
||
98 | |||
99 | -- Set CheckButton states |
||
100 | for key, value in SCT.OPTIONS.FrameCheckButtons do |
||
101 | option1 = getglobal("SCTOptionsFrame_CheckButton"..value.index); |
||
102 | string = getglobal("SCTOptionsFrame_CheckButton"..value.index.."Text"); |
||
103 | option1.SCTVar = value.SCTVar; |
||
104 | option1.SCTTable = value.SCTTable; |
||
105 | if (option1.SCTTable) then |
||
106 | option1:SetChecked(self.db.profile[SCT.FRAMES_DATA_TABLE][option1.SCTTable][value.SCTVar]); |
||
107 | else |
||
108 | option1:SetChecked(self.db.profile[value.SCTVar]); |
||
109 | end |
||
110 | option1.tooltipText = value.tooltipText; |
||
111 | string:SetText(key); |
||
112 | end |
||
113 | |||
114 | --Set Sliders |
||
115 | for key, value in SCT.OPTIONS.FrameSliders do |
||
116 | option1 = getglobal("SCTOptionsFrame_Slider"..value.index.."Slider"); |
||
117 | string = getglobal("SCTOptionsFrame_Slider"..value.index.."SliderText"); |
||
118 | option2 = getglobal("SCTOptionsFrame_Slider"..value.index.."SliderLow"); |
||
119 | option3 = getglobal("SCTOptionsFrame_Slider"..value.index.."SliderHigh"); |
||
120 | option4 = getglobal("SCTOptionsFrame_Slider"..value.index.."EditBox"); |
||
121 | option1.SCTVar = value.SCTVar; |
||
122 | option1.SCTTable = value.SCTTable; |
||
123 | if (option1.SCTTable) then |
||
124 | getvalue = self.db.profile[SCT.FRAMES_DATA_TABLE][option1.SCTTable][value.SCTVar]; |
||
125 | else |
||
126 | getvalue = self.db.profile[value.SCTVar]; |
||
127 | end |
||
128 | option1.SCTLabel = key; |
||
129 | option1:SetMinMaxValues(value.minValue, value.maxValue); |
||
130 | option1:SetValueStep(value.valueStep); |
||
131 | option1.tooltipText = value.tooltipText; |
||
132 | option1:SetValue(getvalue); |
||
133 | string:SetText(key); |
||
134 | option4:SetText(getvalue) |
||
135 | option2:SetText(value.minText); |
||
136 | option3:SetText(value.maxText); |
||
137 | end |
||
138 | |||
139 | --Dropdowns |
||
140 | for key, value in SCT.OPTIONS.FrameSelections do |
||
141 | option1 = getglobal("SCTOptionsFrame_Selection"..value.index); |
||
142 | option2 = getglobal("SCTOptionsFrame_Selection"..value.index.."Label"); |
||
143 | option1.SCTVar = value.SCTVar; |
||
144 | option1.SCTTable = value.SCTTable; |
||
145 | --lookup table cause of WoW's crappy dropdown UI. |
||
146 | option1.lookup = value.table; |
||
147 | if (option1.SCTTable) then |
||
148 | getvalue = self.db.profile[SCT.FRAMES_DATA_TABLE][option1.SCTTable][value.SCTVar]; |
||
149 | else |
||
150 | getvalue = self.db.profile[value.SCTVar]; |
||
151 | end |
||
152 | UIDropDownMenu_SetSelectedID(option1, getvalue); |
||
153 | --not sure why I have to do this, but only way to make it show correctly cause of WoW's crappy dropdown UI. |
||
154 | UIDropDownMenu_SetText(value.table[getvalue], option1); |
||
155 | option1.tooltipText = value.tooltipText; |
||
156 | option2:SetText(key); |
||
157 | end |
||
158 | |||
159 | --simulate click on tab1, so its always correct |
||
160 | PanelTemplates_SelectTab(SCTOptionsFrame_Misc14); |
||
161 | PanelTemplates_DeselectTab(SCTOptionsFrame_Misc15); |
||
162 | PanelTemplates_DeselectTab(SCTOptionsFrame_Misc20); |
||
163 | SCTOptions_MessageFrame:Hide(); |
||
164 | SCTOptions_TextFrame:Show(); |
||
165 | self:ChangeFrameTab(1) |
||
166 | --set light mode |
||
167 | self:ChangeLightMode(SCT.db.profile["LIGHTMODE"]); |
||
168 | --set sticky mode |
||
169 | self:ChangeStickyMode(SCT.db.profile["STICKYCRIT"]); |
||
170 | --Update Profiles |
||
171 | self:ScrollBar_Update(); |
||
172 | end |
||
173 | |||
174 | ---------------------- |
||
175 | --Sets the colors of the config from a color swatch |
||
176 | function SCT:OptionsFrame_SetColor(index,key) |
||
177 | local r,g,b = ColorPickerFrame:GetColorRGB(); |
||
178 | local color={}; |
||
179 | local swatch = getglobal("SCTOptionsFrame"..index.."_ColorSwatchNormalTexture"); |
||
180 | local frame = getglobal("SCTOptionsFrame"..index); |
||
181 | swatch:SetVertexColor(r,g,b); |
||
182 | frame.r, frame.g, frame.b = r,g,b; |
||
183 | color.r, color.g, color.b = r,g,b; |
||
184 | --update back to config |
||
185 | self.db.profile[SCT.COLORS_TABLE][key] = color; |
||
186 | end |
||
187 | |||
188 | ---------------------- |
||
189 | -- Cancels the color selection |
||
190 | function SCT:OptionsFrame_CancelColor(index, key, prev) |
||
191 | local r,g,b = prev.r, prev.g, prev.b; |
||
192 | local color={}; |
||
193 | local swatch = getglobal("SCTOptionsFrame"..index.."_ColorSwatchNormalTexture"); |
||
194 | local frame = getglobal("SCTOptionsFrame"..index); |
||
195 | swatch:SetVertexColor(r, g, b); |
||
196 | frame.r, frame.g, frame.b = r,g,b; |
||
197 | color.r, color.g, color.b = r,g,b; |
||
198 | -- Update back to config |
||
199 | self.db.profile[SCT.COLORS_TABLE][key] = color; |
||
200 | end |
||
201 | |||
202 | ---------------------- |
||
203 | --Sets the silder values in the config |
||
204 | function SCT:OptionsSliderOnValueChanged() |
||
205 | local string, editbox; |
||
206 | string = getglobal(this:GetName().."Text"); |
||
207 | editbox = getglobal(this:GetParent():GetName().."EditBox"); |
||
208 | string:SetText(this.SCTLabel); |
||
209 | editbox:SetText(this:GetValue()) |
||
210 | if (this.SCTTable) then |
||
211 | self.db.profile[SCT.FRAMES_DATA_TABLE][this.SCTTable][this.SCTVar] = this:GetValue(); |
||
212 | else |
||
213 | self.db.profile[this.SCTVar] = this:GetValue(); |
||
214 | end |
||
215 | --update Example |
||
216 | self:ShowExample(); |
||
217 | end |
||
218 | |||
219 | ---------------------- |
||
220 | --Sets the silder values in the config |
||
221 | function SCT:OptionsEditBoxOnValueChanged() |
||
222 | local slider = getglobal(this:GetParent():GetName().."Slider"); |
||
223 | local getvalue = tonumber(this:GetText()); |
||
224 | if (slider.SCTTable) then |
||
225 | self.db.profile[SCT.FRAMES_DATA_TABLE][slider.SCTTable][slider.SCTVar] = getvalue; |
||
226 | else |
||
227 | self.db.profile[this.SCTVar] = getvalue; |
||
228 | end |
||
229 | -- disable update change,set slider,setonchance back |
||
230 | slider:SetScript("OnValueChanged", nil); |
||
231 | slider:SetValue(getvalue); |
||
232 | slider:SetScript("OnValueChanged", function() SCT:OptionsSliderOnValueChanged() end); |
||
233 | --update Example |
||
234 | self:ShowExample(); |
||
235 | end |
||
236 | |||
237 | ---------------------- |
||
238 | --Sets the checkbox values in the config |
||
239 | function SCT:OptionsCheckButtonOnClick() |
||
240 | if (string.find(this:GetName(), "_CritCheckButton")) then |
||
241 | self.db.profile[self.CRITS_TABLE][this.SCTVar] = this:GetChecked() or false; |
||
242 | else |
||
243 | if (this.SCTTable) then |
||
244 | self.db.profile[SCT.FRAMES_DATA_TABLE][this.SCTTable][this.SCTVar] = this:GetChecked() or false; |
||
245 | else |
||
246 | self.db.profile[this.SCTVar] = this:GetChecked() or false; |
||
247 | end |
||
248 | end |
||
249 | --update Example |
||
250 | self:ShowExample(); |
||
251 | end |
||
252 | |||
253 | ---------------------- |
||
254 | --Sets the checkbox values in the config |
||
255 | function SCT:OptionsRadioButtonOnClick(id,parent) |
||
256 | local frame1 = getglobal(parent.."_RadioFrame1Button"); |
||
257 | local frame2 = getglobal(parent.."_RadioFrame2Button"); |
||
258 | local msg = getglobal(parent.."_RadioMsgButton"); |
||
259 | --set radio button options based on what was clicked. |
||
260 | if (id==SCT.FRAME1) then |
||
261 | frame1:SetButtonState("NORMAL", true); |
||
262 | frame1:SetChecked(true); |
||
263 | frame2:SetChecked(nil); |
||
264 | frame2:SetButtonState("NORMAL", false); |
||
265 | msg:SetChecked(nil); |
||
266 | msg:SetButtonState("NORMAL", false); |
||
267 | elseif (id==SCT.FRAME2) then |
||
268 | frame2:SetButtonState("NORMAL", true); |
||
269 | frame2:SetChecked(true); |
||
270 | frame1:SetChecked(nil); |
||
271 | frame1:SetButtonState("NORMAL", false); |
||
272 | msg:SetChecked(nil); |
||
273 | msg:SetButtonState("NORMAL", false); |
||
274 | elseif (id==SCT.MSG ) then |
||
275 | msg:SetButtonState("NORMAL", true); |
||
276 | msg:SetChecked(true); |
||
277 | frame1:SetChecked(nil); |
||
278 | frame1:SetButtonState("NORMAL", false); |
||
279 | frame2:SetChecked(nil); |
||
280 | frame2:SetButtonState("NORMAL", false); |
||
281 | end |
||
282 | --if it has a var, save it (some don't) |
||
283 | if (this.SCTVar) then |
||
284 | self.db.profile[self.FRAMES_TABLE][this.SCTVar] = id; |
||
285 | end |
||
286 | --update Example |
||
287 | self:ShowExample(); |
||
288 | end |
||
289 | |||
290 | --------------------- |
||
291 | --Init a Dropdown |
||
292 | function SCT:DropDown_Initialize() |
||
293 | local info = {}; |
||
294 | for index, value in SCT.OPTIONS.FrameSelections do |
||
295 | if (this:GetName() == "SCTOptionsFrame_Selection"..value.index.."Button") then |
||
296 | for key, name in value.table do |
||
297 | info = {}; |
||
298 | info.text = name; |
||
299 | info.func = function(x) self:DropDown_OnClick(x) end; |
||
300 | info.arg1 = value.index; |
||
301 | UIDropDownMenu_AddButton(info); |
||
302 | end |
||
303 | break; |
||
304 | end |
||
305 | end |
||
306 | end |
||
307 | |||
308 | --------------------- |
||
309 | -- Dropdown Onclick |
||
310 | function SCT:DropDown_OnClick(list) |
||
311 | local ddl = getglobal("SCTOptionsFrame_Selection"..list); |
||
312 | UIDropDownMenu_SetSelectedID(ddl, this:GetID()); |
||
313 | if (ddl.SCTTable) then |
||
314 | self.db.profile[SCT.FRAMES_DATA_TABLE][ddl.SCTTable][ddl.SCTVar] = this:GetID(); |
||
315 | else |
||
316 | self.db.profile[ddl.SCTVar] = this:GetID(); |
||
317 | end |
||
318 | --update Example |
||
319 | self:ShowExample(); |
||
320 | end |
||
321 | |||
322 | ---------------------- |
||
323 | --Open the color selector using show/hide |
||
324 | function SCT:SaveList_OnClick() |
||
325 | local text = getglobal(this:GetName().."_Name"):GetText(); |
||
326 | if (text ~= nil) then |
||
327 | getglobal("SCTOptionsProfileEditBox"):SetText(text); |
||
328 | SCTOptions_SaveLoadFrame:Hide(); |
||
329 | end |
||
330 | end |
||
331 | |||
332 | ------------------------------ |
||
333 | --Copy one profile to another, any type |
||
334 | function SCT:CopyProfile(to, from) |
||
335 | copyTable(to,inheritDefaults(copyTable({}, from), SCT:GetDefaultConfig())); |
||
336 | self:HideMenu(); |
||
337 | self:ShowMenu(); |
||
338 | end |
||
339 | |||
340 | ----------------------- |
||
341 | --Load a profile |
||
342 | function SCT:LoadProfile() |
||
343 | local editbox = getglobal("SCTOptionsProfileEditBox"); |
||
344 | local profile = editbox:GetText(); |
||
345 | if (profile ~= "" ) then |
||
346 | --hack until AceDB gets SetProfile working right on copies. |
||
347 | --copyTable(self.db.profile,inheritDefaults(copyTable({}, self.db.raw.profiles[profile]), SCT:GetDefaultConfig())); |
||
348 | self:CopyProfile(self.db.profile, self.db.raw.profiles[profile]); |
||
349 | editbox:SetText(""); |
||
350 | self:Print(SCT.LOCALS.PROFILE..profile); |
||
351 | end |
||
352 | end |
||
353 | |||
354 | ----------------------- |
||
355 | --Delete a profile |
||
356 | function SCT:DeleteProfile() |
||
357 | local editbox = getglobal("SCTOptionsProfileEditBox"); |
||
358 | local profile = editbox:GetText(); |
||
359 | |||
360 | if (profile ~= "") then |
||
361 | if (profile == AceLibrary("AceDB-2.0").CHAR_ID) then |
||
362 | SCT:Reset(); |
||
363 | else |
||
364 | self.db.raw.profiles[profile] = nil; |
||
365 | self:Print(SCT.LOCALS.PROFILE_DELETE..profile); |
||
366 | end |
||
367 | editbox:SetText(""); |
||
368 | self:ScrollBar_Update() |
||
369 | self:HideMenu(); |
||
370 | self:ShowMenu(); |
||
371 | end |
||
372 | end |
||
373 | |||
374 | ---------------------- |
||
375 | --Open the color selector using show/hide |
||
376 | function SCT:OpenColorPicker(button) |
||
377 | CloseMenus(); |
||
378 | if ( not button ) then |
||
379 | button = this; |
||
380 | end |
||
381 | ColorPickerFrame.func = button.swatchFunc; |
||
382 | ColorPickerFrame:SetColorRGB(button.r, button.g, button.b); |
||
383 | ColorPickerFrame.previousValues = {r = button.r, g = button.g, b = button.b, opacity = button.opacity}; |
||
384 | ColorPickerFrame.cancelFunc = button.cancelFunc; |
||
385 | ColorPickerFrame:Show(); |
||
386 | end |
||
387 | |||
388 | ---------------------- |
||
389 | -- display ddl or chxbox based on type |
||
390 | function SCT:UpdateAnimationOptions() |
||
391 | --get scroll down checkbox |
||
392 | local chkbox = getglobal("SCTOptionsFrame_CheckButton4"); |
||
393 | --get anime type dropdown |
||
394 | local ddl1 = getglobal("SCTOptionsFrame_Selection1"); |
||
395 | --get animside type dropdown |
||
396 | local ddl2 = getglobal("SCTOptionsFrame_Selection2"); |
||
397 | --get item |
||
398 | local id = UIDropDownMenu_GetSelectedID(ddl1) |
||
399 | if (id == 1 or id == 6) then |
||
400 | chkbox:Show(); |
||
401 | ddl2:Hide(); |
||
402 | else |
||
403 | chkbox:Hide(); |
||
404 | ddl2:Show(); |
||
405 | end |
||
406 | end |
||
407 | |||
408 | ---------------------- |
||
409 | -- update scroll bar settings |
||
410 | function SCT:ScrollBar_Update() |
||
411 | local i, idx, item, key, value |
||
412 | local offset = FauxScrollFrame_GetOffset(SCTScrollBar) |
||
413 | --get table size, getn doesn't work cause not an array |
||
414 | local size = 0; |
||
415 | local profiles = {} |
||
416 | for key, value in SCT:PairsByKeys(SCT.db.raw.profiles) do |
||
417 | tinsert(profiles, key); |
||
418 | end |
||
419 | for key in profiles do |
||
420 | size = size + 1; |
||
421 | end |
||
422 | --get update |
||
423 | FauxScrollFrame_Update(SCTScrollBar, size, 10, 20) |
||
424 | --loop thru each display item |
||
425 | for i=1,10 do |
||
426 | item = getglobal("SCTList"..i.."_Name") |
||
427 | idx = offset+i |
||
428 | if idx<=size then |
||
429 | key, value = next(profiles) |
||
430 | for j=2,idx do |
||
431 | key, value = next(profiles, key) |
||
432 | end |
||
433 | item:SetText(value); |
||
434 | item:Show() |
||
435 | else |
||
436 | item:Hide() |
||
437 | end |
||
438 | end |
||
439 | end |
||
440 | |||
441 | ---------------------- |
||
442 | --change which frame is being used |
||
443 | function SCT:ChangeFrameTab(frame) |
||
444 | local tab = self.db.profile[SCT.FRAMES_DATA_TABLE][frame]; |
||
445 | --set label |
||
446 | if (frame == SCT.FRAME1) then |
||
447 | SCTOptionsFrame_Misc3:SetText(SCT.LOCALS.OPTION_MISC3["name"]); |
||
448 | else |
||
449 | SCTOptionsFrame_Misc3:SetText(SCT.LOCALS.OPTION_MISC21["name"]); |
||
450 | end; |
||
451 | --set all tables to selected frame |
||
452 | SCTOptionsFrame_CheckButton4.SCTTable = frame; |
||
453 | SCTOptionsFrame_Slider2Slider.SCTTable = frame; |
||
454 | SCTOptionsFrame_Slider5Slider.SCTTable = frame; |
||
455 | SCTOptionsFrame_Slider7Slider.SCTTable = frame; |
||
456 | SCTOptionsFrame_Slider8Slider.SCTTable = frame; |
||
457 | SCTOptionsFrame_Selection1.SCTTable = frame; |
||
458 | SCTOptionsFrame_Selection2.SCTTable = frame; |
||
459 | SCTOptionsFrame_Selection3.SCTTable = frame; |
||
460 | SCTOptionsFrame_Selection4.SCTTable = frame; |
||
461 | --update all frame options |
||
462 | SCTOptionsFrame_CheckButton4:SetChecked(tab[SCTOptionsFrame_CheckButton4.SCTVar]); |
||
463 | --text slider |
||
464 | SCTOptionsFrame_Slider2SliderText:SetText(SCTOptionsFrame_Slider2Slider.SCTLabel); |
||
465 | SCTOptionsFrame_Slider2EditBox:SetText(tab[SCTOptionsFrame_Slider2Slider.SCTVar]); |
||
466 | SCTOptionsFrame_Slider2Slider:SetValue(tab[SCTOptionsFrame_Slider2Slider.SCTVar]); |
||
467 | --alpha slider |
||
468 | SCTOptionsFrame_Slider5SliderText:SetText(SCTOptionsFrame_Slider5Slider.SCTLabel); |
||
469 | SCTOptionsFrame_Slider5EditBox:SetText(tab[SCTOptionsFrame_Slider5Slider.SCTVar]); |
||
470 | SCTOptionsFrame_Slider5Slider:SetValue(tab[SCTOptionsFrame_Slider5Slider.SCTVar]); |
||
471 | --x slider |
||
472 | SCTOptionsFrame_Slider7SliderText:SetText(SCTOptionsFrame_Slider7Slider.SCTLabel); |
||
473 | SCTOptionsFrame_Slider7EditBox:SetText(tab[SCTOptionsFrame_Slider7Slider.SCTVar]); |
||
474 | SCTOptionsFrame_Slider7Slider:SetScript("OnValueChanged", nil); |
||
475 | SCTOptionsFrame_Slider7Slider:SetValue(tab[SCTOptionsFrame_Slider7Slider.SCTVar]); |
||
476 | SCTOptionsFrame_Slider7Slider:SetScript("OnValueChanged", function() SCT:OptionsSliderOnValueChanged() end); |
||
477 | --y slider |
||
478 | SCTOptionsFrame_Slider8SliderText:SetText(SCTOptionsFrame_Slider8Slider.SCTLabel); |
||
479 | SCTOptionsFrame_Slider8EditBox:SetText(tab[SCTOptionsFrame_Slider8Slider.SCTVar]); |
||
480 | SCTOptionsFrame_Slider8Slider:SetScript("OnValueChanged", nil); |
||
481 | SCTOptionsFrame_Slider8Slider:SetValue(tab[SCTOptionsFrame_Slider8Slider.SCTVar]); |
||
482 | SCTOptionsFrame_Slider8Slider:SetScript("OnValueChanged", function() SCT:OptionsSliderOnValueChanged() end); |
||
483 | --Selection |
||
484 | UIDropDownMenu_SetSelectedID(SCTOptionsFrame_Selection1, tab[SCTOptionsFrame_Selection1.SCTVar]); |
||
485 | UIDropDownMenu_SetText(SCTOptionsFrame_Selection1.lookup[tab[SCTOptionsFrame_Selection1.SCTVar]], SCTOptionsFrame_Selection1); |
||
486 | UIDropDownMenu_SetSelectedID(SCTOptionsFrame_Selection2, tab[SCTOptionsFrame_Selection2.SCTVar]); |
||
487 | UIDropDownMenu_SetText(SCTOptionsFrame_Selection2.lookup[tab[SCTOptionsFrame_Selection2.SCTVar]], SCTOptionsFrame_Selection2); |
||
488 | UIDropDownMenu_SetSelectedID(SCTOptionsFrame_Selection3, tab[SCTOptionsFrame_Selection3.SCTVar]); |
||
489 | UIDropDownMenu_SetText(SCTOptionsFrame_Selection3.lookup[tab[SCTOptionsFrame_Selection3.SCTVar]], SCTOptionsFrame_Selection3); |
||
490 | UIDropDownMenu_SetSelectedID(SCTOptionsFrame_Selection4, tab[SCTOptionsFrame_Selection4.SCTVar]); |
||
491 | UIDropDownMenu_SetText(SCTOptionsFrame_Selection4.lookup[tab[SCTOptionsFrame_Selection4.SCTVar]], SCTOptionsFrame_Selection4); |
||
492 | --update what is visible |
||
493 | self:UpdateAnimationOptions(); |
||
494 | end |
||
495 | |||
496 | ---------------------- |
||
497 | --change Light Mode |
||
498 | function SCT:ChangeLightMode(lightOn, reset) |
||
499 | if (lightOn) then |
||
500 | OptionsFrame_DisableCheckBox(SCTOptionsFrame_CheckButton13); |
||
501 | OptionsFrame_DisableCheckBox(SCTOptionsFrame_CheckButton12); |
||
502 | OptionsFrame_DisableCheckBox(SCTOptionsFrame_CheckButton6); |
||
503 | else |
||
504 | OptionsFrame_EnableCheckBox(SCTOptionsFrame_CheckButton13); |
||
505 | OptionsFrame_EnableCheckBox(SCTOptionsFrame_CheckButton12); |
||
506 | OptionsFrame_EnableCheckBox(SCTOptionsFrame_CheckButton6); |
||
507 | end |
||
508 | if (reset) then |
||
509 | SCT:DisableAll(); |
||
510 | SCT:RegisterSelfEvents(); |
||
511 | end |
||
512 | end |
||
513 | |||
514 | ---------------------- |
||
515 | --change Sticky Mode |
||
516 | function SCT:ChangeStickyMode(stickyOn) |
||
517 | if (stickyOn) then |
||
518 | OptionsFrame_EnableCheckBox(SCTOptionsFrame_CheckButton15); |
||
519 | else |
||
520 | OptionsFrame_DisableCheckBox(SCTOptionsFrame_CheckButton15); |
||
521 | end |
||
522 | end |
||
523 | |||
524 | --------------------- |
||
525 | --Show SCT Example |
||
526 | function SCT:ShowExample() |
||
527 | local example; |
||
528 | SCT:AniInit(); |
||
529 | SCT_EXAMPLETEXT:Show(); |
||
530 | |||
531 | --animated example for options that may need it |
||
532 | local option = this.SCTVar or "SHOWHIT"; |
||
533 | if (string.find(option,"SHOW") == 1) then |
||
534 | SCT:Display_Event(option, SCT.LOCALS.EXAMPLE); |
||
535 | end |
||
536 | |||
537 | --show example FRAME1 |
||
538 | --get object |
||
539 | example = getglobal("SCTaniExampleData1"); |
||
540 | --set text size |
||
541 | SCT:SetFontSize(example, |
||
542 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["FONT"], |
||
543 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["TEXTSIZE"], |
||
544 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["FONTSHADOW"]); |
||
545 | --set the color |
||
546 | example:SetTextColor(1, 1, 1); |
||
547 | --set alpha |
||
548 | example:SetAlpha(SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["ALPHA"]/100); |
||
549 | --Position |
||
550 | example:SetPoint("CENTER", "UIParent", "CENTER", |
||
551 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["XOFFSET"], |
||
552 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME1]["YOFFSET"]); |
||
553 | --Set the text to display |
||
554 | example:SetText(SCT.LOCALS.EXAMPLE); |
||
555 | |||
556 | |||
557 | --show example FRAME2 |
||
558 | --get object |
||
559 | example = getglobal("SCTaniExampleData2"); |
||
560 | --set text size |
||
561 | SCT:SetFontSize(example, |
||
562 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["FONT"], |
||
563 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["TEXTSIZE"], |
||
564 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["FONTSHADOW"]); |
||
565 | --set the color |
||
566 | example:SetTextColor(1, 1, 1); |
||
567 | --set alpha |
||
568 | example:SetAlpha(SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["ALPHA"]/100); |
||
569 | --Position |
||
570 | example:SetPoint("CENTER", "UIParent", "CENTER", |
||
571 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["XOFFSET"], |
||
572 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.FRAME2]["YOFFSET"]); |
||
573 | --Set the text to display |
||
574 | example:SetText(SCT.LOCALS.EXAMPLE2); |
||
575 | |||
576 | |||
577 | --show msg frame |
||
578 | SCT_EXAMPLEMSG:Show(); |
||
579 | --get object |
||
580 | example = getglobal("SCTMsgExample1"); |
||
581 | --set text size |
||
582 | SCT:SetMsgFont(example); |
||
583 | --set the color |
||
584 | example:SetTextColor(1, 1, 1); |
||
585 | --set alpha |
||
586 | example:SetAlpha(1); |
||
587 | --Position |
||
588 | example:SetPoint("CENTER", "UIParent", "CENTER", |
||
589 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.MSG]["MSGXOFFSET"], |
||
590 | SCT.db.profile[SCT.FRAMES_DATA_TABLE][SCT.MSG]["MSGYOFFSET"]-30); |
||
591 | --Set the text to display |
||
592 | example:SetText(SCT.LOCALS.MSG_EXAMPLE); |
||
593 | |||
594 | --update animation options |
||
595 | SCT:UpdateAnimationOptions() |
||
596 | end |