vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 if (not Nurfed_Options) then
3  
4 local framelib = Nurfed_Frames:New();
5  
6 Nurfed_Options = {};
7  
8 function Nurfed_Options:New ()
9 local object = {};
10 setmetatable(object, self);
11 self.__index = self;
12 return object;
13 end
14  
15 function Nurfed_Options:GetMenu(addon)
16 if (not UIPanelWindows["Nurfed_OptionsFrame"]) then
17 UIPanelWindows["Nurfed_OptionsFrame"] = { area = "center", pushable = 0, whileDead = 1 };
18 end
19 if (Nurfed_OptionsFrame:IsShown() and Nurfed_OptionsFrame.shown == addon) then
20 HideUIPanel(Nurfed_OptionsFrame);
21 else
22 local title = string.gsub(addon, "_", " ");
23 local version = getglobal(string.upper(addon).."_VERS");
24 Nurfed_OptionsFrametitle:SetText(title);
25 Nurfed_OptionsFrameversion:SetText(version);
26 Nurfed_OptionsFrame.shown = addon;
27 Nurfed_OptionsFrame.addon = string.gsub(addon, "Nurfed_", "");
28 ShowUIPanel(Nurfed_OptionsFrame);
29 UIFrameFadeIn(Nurfed_OptionsFrame, COMBOFRAME_FADE_IN);
30  
31 local menus = { Nurfed_OptionsFrame:GetChildren() };
32 for _, menu in ipairs(menus) do
33 if (menu:GetName()) then
34 if (string.find(menu:GetName(), "^"..addon)) then
35 menu:Show();
36 Nurfed_OptionsFrame:SetWidth(menu.width);
37 Nurfed_OptionsFrame:SetHeight(menu.height);
38 Nurfed_OptionsFrameclose:Show();
39 menu:SetWidth(menu.width - 12);
40 menu:SetHeight(menu.height - 31);
41 if (menu.page) then
42 self:GetMenuPage(menu);
43 end
44 else
45 menu:Hide();
46 end
47 end
48 end
49 end
50 end
51  
52 function Nurfed_Options:GetMenuPage(menu)
53 local i = 1;
54 local page = getglobal(menu:GetName().."page"..i);
55 while (page) do
56 if (i == menu.page) then
57 UIFrameFadeIn(page, COMBOFRAME_FADE_IN);
58 else
59 page:Hide();
60 end
61 i = i + 1;
62 page = getglobal(menu:GetName().."page"..i);
63 end
64 end
65  
66 function Nurfed_Options:GetOption(addon, option)
67 addon = string.upper("NURFED_"..addon);
68 local player = UnitName("player").." - "..GetRealmName();
69 if (not player or not getglobal(addon.."_SAVED")) then
70 return;
71 end
72 local tbl = getglobal(addon.."_SAVED")[player];
73 if (not tbl[option]) then
74 local value = getglobal(addon.."_DEFAULT")[option];
75 tbl[option] = value;
76 end
77 return tbl[option];
78 end
79  
80 function Nurfed_Options:SetOption(addon, option, value, name, id)
81 addon = string.upper("NURFED_"..addon);
82 local player = UnitName("player").." - "..GetRealmName();
83 local tbl = getglobal(addon.."_SAVED")[player];
84 if (name and id) then
85 tbl[option][name][id] = value;
86 else
87 tbl[option] = value;
88 end
89 end
90  
91 function Nurfed_Options:SetMultiOption(addon, option, name, value)
92 addon = string.upper("NURFED_"..addon);
93 local player = UnitName("player").." - "..GetRealmName();
94 local tbl = getglobal(addon.."_SAVED")[player][option];
95 tbl[name] = value;
96 end
97  
98 -- Display
99 local function optionInit()
100 local text = getglobal(this:GetName().."text");
101 text:SetText(this.text);
102 if (this.right) then
103 text:ClearAllPoints()
104 text:SetPoint("RIGHT", this:GetName(), "LEFT", -1, 1);
105 end
106 if (this.color) then
107 text:SetTextColor(this.color[1], this.color[2], this.color[3]);
108 end
109 if (this.option) then
110 return Nurfed_Options:GetOption(Nurfed_OptionsFrame.addon, this.option);
111 end
112 end
113  
114 --Generic Button
115 local function buttonOnEnter()
116 this:SetBackdropColor(0, 0.75, 1, 0.75)
117 getglobal(this:GetName().."text"):SetTextColor(1, 1, 1)
118 end
119  
120 local function buttonOnLeave()
121 this:SetBackdropColor(0, 0, 0, 0.75)
122 getglobal(this:GetName().."text"):SetTextColor(0.65, 0.65, 0.65)
123 end
124  
125 local function buttonOnShow()
126 optionInit();
127 local width = string.len(this.text);
128 this:SetWidth(width*6 + 5);
129 end
130  
131 local function buttonOnMouseDown()
132 this:SetBackdropColor(1, 0, 0, 0.75);
133 end
134  
135 local function buttonOnMouseUp()
136 this:SetBackdropColor(0, 0.75, 1, 0.75);
137 end
138  
139 -- Tabs
140 local function tabOnShow()
141 buttonOnShow();
142 if (this.page == this:GetParent().page) then
143 this.selected = true;
144 this:SetBackdropColor(0, 0.85, 1, 0.75);
145 getglobal(this:GetName().."text"):SetTextColor(1, 1, 1);
146 else
147 this.selected = nil;
148 this:SetBackdropColor(0, 0, 0, 0.75);
149 getglobal(this:GetName().."text"):SetTextColor(0.65, 0.65, 0.65);
150 end
151 end
152  
153 local function tabOnEnter()
154 if (not this.selected) then
155 this:SetBackdropColor(0, 0.75, 1, 0.75);
156 getglobal(this:GetName().."text"):SetTextColor(1, 1, 1);
157 end
158 end
159  
160 local function tabOnLeave()
161 if (not this.selected) then
162 this:SetBackdropColor(0, 0, 0, 0.75);
163 getglobal(this:GetName().."text"):SetTextColor(0.65, 0.65, 0.65);
164 end
165 end
166  
167 local function tabOnClick()
168 local parent = this:GetParent();
169 parent.page = this.page;
170  
171 local i = 1;
172 local tab = getglobal(parent:GetName().."tab"..i);
173 while(tab) do
174 if (parent.page ~= tab.page) then
175 tab.selected = nil;
176 tab:SetBackdropColor(0, 0, 0, 0.75);
177 getglobal(tab:GetName().."text"):SetTextColor(0.65, 0.65, 0.65);
178 else
179 tab.selected = true;
180 tab:SetBackdropColor(0, 0.85, 1, 0.75);
181 getglobal(tab:GetName().."text"):SetTextColor(1, 1, 1);
182 Nurfed_Options:GetMenuPage(parent);
183 end
184 i = i + 1;
185 tab = getglobal(parent:GetName().."tab"..i);
186 end
187 end
188  
189 -- Check Boxes
190 local function checkText()
191 if (not this.color) then
192 local text = getglobal(this:GetName().."text");
193 if (this:GetChecked()) then
194 text:SetTextColor(1, 1, 1);
195 else
196 text:SetTextColor(0.65, 0.65, 0.65);
197 end
198 end
199 end
200  
201 local function checkOnShow()
202 if (this:IsShown()) then
203 local option = optionInit();
204 if (this.init) then
205 this:SetChecked(this.init);
206 else
207 this:SetChecked(option);
208 end
209 checkText();
210 end
211 end
212  
213 local function checkOnClick()
214 local value;
215 if (this:GetChecked()) then
216 value = 1;
217 PlaySound("igMainMenuOptionCheckBoxOn");
218 else
219 value = 0;
220 PlaySound("igMainMenuOptionCheckBoxOff");
221 end
222 if (this.option) then
223 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, this.option, value);
224 if (this.func) then
225 this.func();
226 end
227 elseif (this.id and this:GetParent().selected) then
228 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, this:GetParent().option, value, this:GetParent().selected, this.id);
229 if (this:GetParent().func) then
230 this:GetParent().func();
231 end
232 end
233 checkText();
234 end
235  
236 --Sliders
237 local function sliderOnShow()
238 if (this:IsShown()) then
239 local option = optionInit();
240 local max = getglobal(this:GetName().."high");
241 local min = getglobal(this:GetName().."low");
242 max:SetText(this.max);
243 min:SetText(this.min);
244 this:SetMinMaxValues(this.min, this.max);
245 this:SetValueStep(this.step);
246 if (this.init) then
247 this:SetValue(this.init);
248 elseif (option) then
249 this:SetValue(option);
250 end
251 end
252 end
253  
254 local function sliderOnValueChanged()
255 local value = this:GetValue();
256 local text = getglobal(this:GetName().."value");
257  
258 text:ClearAllPoints();
259 if (value > (this.max / 2)) then
260 text:SetPoint("LEFT", this:GetName(), "LEFT", 1, 1);
261 else
262 text:SetPoint("RIGHT", this:GetName(), "RIGHT", -1, 1);
263 end
264 text:SetText("("..format(this.format, value)..")");
265 end
266  
267 local function sliderOnMouseUp()
268 local value = this:GetValue();
269 if (this.option) then
270 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, this.option, value);
271 if (this.func) then
272 this.func();
273 end
274 elseif (this.id and this:GetParent().selected) then
275 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, this:GetParent().option, value, this:GetParent().selected, this.id);
276 if (this:GetParent().func) then
277 this:GetParent().func();
278 end
279 end
280 end
281  
282 -- Color Swatches
283 local function swatchSetColor(frame)
284 local option = frame.option;
285 local r,g,b = ColorPickerFrame:GetColorRGB();
286 local a = OpacitySliderFrame:GetValue();
287 local swatch = getglobal(frame:GetName().."bg");
288 swatch:SetVertexColor(r, g, b);
289 frame.r = r;
290 frame.g = g;
291 frame.b = b;
292 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, frame.option, { r, g, b, a });
293 if (frame.func) then
294 frame.func();
295 end
296 end
297  
298 local function swatchCancelColor(frame, prev)
299 local option = frame.option;
300 local r = prev.r;
301 local g = prev.g;
302 local b = prev.b;
303 local a = prev.a;
304 local swatch = getglobal(frame:GetName().."bg");
305 swatch:SetVertexColor(r, g, b);
306 frame.r = r;
307 frame.g = g;
308 frame.b = b;
309 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, frame.option, { r, g, b, a });
310 if (frame.func) then
311 frame.func();
312 end
313 end
314  
315 local function swatchOnShow()
316 if (this:IsShown()) then
317 local option = optionInit();
318 if (not option) then
319 return;
320 end
321 local frame = this;
322 local swatch = getglobal(this:GetName().."bg");
323 swatch:SetVertexColor(option[1], option[2], option[3]);
324  
325 this.r = option[1];
326 this.g = option[2];
327 this.b = option[3];
328 this.swatchFunc = function() swatchSetColor(frame) end;
329 this.cancelFunc = function(x) swatchCancelColor(frame, x) end;
330 if (frame.opacity) then
331 this.hasOpacity = frame.opacity;
332 this.opacityFunc = function() swatchSetColor(frame) end;
333 this.opacity = option[4];
334 end
335 end
336 end
337  
338 local function swatchOpenColorPicker()
339 CloseMenus();
340 ColorPickerFrame.func = this.swatchFunc;
341 ColorPickerFrame.hasOpacity = this.hasOpacity;
342 ColorPickerFrame.opacityFunc = this.opacityFunc;
343 ColorPickerFrame.opacity = this.opacity;
344 ColorPickerFrame:SetColorRGB(this.r, this.g, this.b);
345 ColorPickerFrame.previousValues = {r = this.r, g = this.g, b = this.b, a = this.opacity};
346 ColorPickerFrame.cancelFunc = this.cancelFunc;
347 ColorPickerFrame:Show();
348 end
349  
350 -- Input
351 local function inputOnShow()
352 local option = optionInit();
353 if (not option) then
354 return;
355 end
356 local inputtext = getglobal(this:GetName().."input");
357 inputtext:SetText(option);
358 end
359  
360 local function inputOnClick()
361 local inputtext = getglobal(this:GetParent():GetName().."input");
362 if (not inputtext:GetText() or inputtext:GetText() == "") then
363 return;
364 end
365 Nurfed_Options:SetOption(Nurfed_OptionsFrame.addon, this:GetParent().option, inputtext:GetText());
366 inputtext:ClearFocus();
367 end
368  
369 --Input Select
370 local function inputselectSetOptions(opt, frame)
371 if (not frame) then
372 frame = this:GetParent();
373 end
374 local option = Nurfed_Options:GetOption(Nurfed_OptionsFrame.addon, frame.option);
375 local children = { frame:GetChildren() };
376 for _, child in ipairs(children) do
377 local objtype, value;
378 if (child.id) then
379 objtype = child:GetObjectType();
380 if (objtype == "Slider") then
381 child:SetValue(option[opt][child.id]);
382 elseif (objtype == "CheckButton") then
383 child:SetChecked(option[opt][child.id]);
384 end
385 end
386 end
387 end
388  
389 local function inputselectUpdate(frame, pre)
390 local option = Nurfed_Options:GetOption(Nurfed_OptionsFrame.addon, frame.option);
391 local i = 1;
392 local button = getglobal(frame:GetName().."button"..i);
393 local text = getglobal(frame:GetName().."button"..i.."text");
394 for opt in option do
395 if (text) then
396 if (pre) then
397 text:SetText(pre..opt);
398 button.pre = pre;
399 else
400 text:SetText(opt);
401 end
402 if (button.selected) then
403 inputselectSetOptions(opt, frame);
404 end
405 end
406 i = i + 1;
407 text = getglobal(frame:GetName().."button"..i.."text");
408 button = getglobal(frame:GetName().."button"..i);
409 end
410 while (i <= 10) do
411 text = getglobal(frame:GetName().."button"..i.."text");
412 text:SetText(nil);
413 i = i + 1;
414 end
415 end
416  
417 local function inputselectOnShow()
418 local option = optionInit();
419 if (not option) then
420 return;
421 end
422 inputselectUpdate(this, this.pre);
423 end
424  
425 local function inputselectGetOptions()
426 local tbl = {};
427 local children = { this:GetParent():GetChildren() };
428 for _, child in ipairs(children) do
429 local objtype, value;
430 if (child.id) then
431 objtype = child:GetObjectType();
432 if (objtype == "Slider") then
433 tbl[child.id] = child:GetValue();
434 elseif (objtype == "CheckButton") then
435 if (child:GetChecked()) then
436 tbl[child.id] = 1;
437 else
438 tbl[child.id] = 0;
439 end
440 end
441 end
442 end
443 return tbl;
444 end
445  
446 local function inputselectOnEnterPressed()
447 if (not this:GetText() or this:GetText() == "") then
448 return;
449 end
450 local value = inputselectGetOptions();
451 Nurfed_Options:SetMultiOption(Nurfed_OptionsFrame.addon, this:GetParent().option, this:GetText(), value);
452 inputselectUpdate(this:GetParent());
453 this:SetText("");
454 if (this:GetParent().func) then
455 this:GetParent().func();
456 end
457 end
458  
459 local function inputremoveOnClick()
460 for i = 1, 10 do
461 local button = getglobal(this:GetParent():GetName().."button"..i);
462 local highlight = getglobal(button:GetName().."highlight");
463 local text = getglobal(button:GetName().."text");
464 local option = text:GetText();
465 if (option) then
466 if (this:GetParent().pre) then
467 option = string.gsub(option, this:GetParent().pre, "");
468 option = tonumber(option);
469 end
470 if (button.selected) then
471 Nurfed_Options:SetMultiOption(Nurfed_OptionsFrame.addon, this:GetParent().option, option, nil);
472 button.selected = nil;
473 highlight:Hide();
474 end
475 end
476 end
477 inputselectUpdate(this:GetParent(), this:GetParent().pre);
478 if (this:GetParent().func) then
479 this:GetParent().func();
480 end
481 end
482  
483 local function inputupdateOnClick()
484 local value = inputselectGetOptions();
485 for i = 1, 10 do
486 local button = getglobal(this:GetParent():GetName().."button"..i);
487 local text = getglobal(button:GetName().."text");
488 local option = text:GetText();
489 if (option) then
490 if (this:GetParent().pre) then
491 option = string.gsub(option, this:GetParent().pre, "");
492 option = tonumber(option);
493 end
494 if (button.selected) then
495 Nurfed_Options:SetMultiOption(Nurfed_OptionsFrame.addon, this:GetParent().option, option, value);
496 end
497 end
498 end
499 if (this:GetParent().func) then
500 this:GetParent().func();
501 end
502 end
503  
504 local function inputaddOnClick()
505 local value = inputselectGetOptions();
506 local option = Nurfed_Options:GetOption(Nurfed_OptionsFrame.addon, this:GetParent().option);
507 if (option) then
508 local nextopt = table.getn(option) + 1;
509 Nurfed_Options:SetMultiOption(Nurfed_OptionsFrame.addon, this:GetParent().option, nextopt, value);
510 inputselectUpdate(this:GetParent(), this:GetParent().pre);
511 if (this:GetParent().func) then
512 this:GetParent().func();
513 end
514 end
515 end
516  
517 local function inputselectbuttonOnClick()
518 local text = getglobal(this:GetName().."text");
519 local option = text:GetText();
520 if (not option) then
521 return;
522 end
523 for i = 1, 10 do
524 local button = getglobal(this:GetParent():GetName().."button"..i);
525 if (this:GetName() ~= button:GetName()) then
526 local highlight = getglobal(button:GetName().."highlight");
527 button.selected = nil;
528 highlight:Hide();
529 end
530 end
531 if (this.pre) then
532 option = string.gsub(option, this.pre, "");
533 option = tonumber(option);
534 end
535 this:GetParent().selected = nil;
536 if (option) then
537 local highlight = getglobal(this:GetName().."highlight");
538 if (highlight:IsVisible()) then
539 highlight:Hide();
540 this.selected = nil;
541 else
542 highlight:Show();
543 this.selected = true;
544 this:GetParent().selected = option;
545 inputselectSetOptions(option);
546 end
547 end
548 end
549  
550 local tbl = {
551 Nurfed_OptionButton = {
552 type = "Button",
553 size = { 30, 18 },
554 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 8, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
555 BackdropColor = { 0, 0, 0, 0.75 },
556 children = {
557 text = {
558 type = "FontString",
559 layer = "ARTWORK",
560 Anchor = "all",
561 Font = { NRF_FONT.."framd.ttf", 9, "OUTLINE" },
562 JustifyH = "CENTER",
563 TextColor = { 0.65, 0.65, 0.65 },
564 },
565 },
566 OnMouseDown = function() buttonOnMouseDown() end,
567 OnMouseUp = function() buttonOnMouseUp() end,
568 OnEnter = function() buttonOnEnter() end,
569 OnLeave = function() buttonOnLeave() end,
570 OnShow = function() buttonOnShow() end,
571 },
572 Nurfed_OptionTab = {
573 type = "Button",
574 size = { 75, 18 },
575 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 8, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
576 BackdropColor = { 0, 0, 0, 0 },
577 children = {
578 text = {
579 type = "FontString",
580 layer = "ARTWORK",
581 Anchor = "all",
582 Font = { NRF_FONT.."framd.ttf", 9, "OUTLINE" },
583 JustifyH = "CENTER",
584 TextColor = { 0.5, 0.5, 0.5 },
585 },
586 },
587 OnShow = function() tabOnShow() end,
588 OnMouseDown = function() buttonOnMouseDown() end,
589 OnMouseUp = function() buttonOnMouseUp() end,
590 OnClick = function() tabOnClick() end,
591 OnEnter = function() tabOnEnter() end,
592 OnLeave = function() tabOnLeave() end,
593 },
594 Nurfed_OptionCheck = {
595 type = "CheckButton",
596 size = { 18, 18 },
597 NormalTexture = "Interface\\Buttons\\UI-CheckBox-Up",
598 PushedTexture = "Interface\\Buttons\\UI-CheckBox-Down",
599 HighlightTexture = "Interface\\Buttons\\UI-CheckBox-Highlight",
600 CheckedTexture = "Interface\\Buttons\\UI-CheckBox-Check",
601 DisabledCheckedTexture = "Interface\\Buttons\\UI-CheckBox-Check-Disabled",
602 children = {
603 text = {
604 type = "FontString",
605 layer = "ARTWORK",
606 Anchor = { "LEFT", "$parent", "RIGHT", 1, 1 },
607 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
608 JustifyH = "LEFT",
609 TextColor = { 0.5, 0.5, 0.5 },
610 },
611 },
612 OnShow = function() checkOnShow() end,
613 OnClick = function() checkOnClick() end,
614 },
615 Nurfed_OptionSlider = {
616 type = "Slider",
617 size = { 128, 17 },
618 Backdrop = { bgFile = "Interface\\Buttons\\UI-SliderBar-Background", edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", tile = true, tileSize = 8, edgeSize = 8, insets = { left = 3, right = 3, top = 6, bottom = 6 }, },
619 ThumbTexture = "Interface\\Buttons\\UI-SliderBar-Button-Horizontal",
620 Orientation = "HORIZONTAL",
621 children = {
622 text = {
623 type = "FontString",
624 layer = "ARTWORK",
625 Anchor = { "BOTTOM", "$parent", "TOP", 0, 1 },
626 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
627 JustifyH = "CENTER",
628 TextColor = { 1, 1, 1 },
629 },
630 high = {
631 type = "FontString",
632 layer = "ARTWORK",
633 Anchor = { "TOPRIGHT", "$parent", "BOTTOMRIGHT", 0, 1 },
634 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
635 JustifyH = "CENTER",
636 TextColor = { 1, 1, 0 },
637 },
638 low = {
639 type = "FontString",
640 layer = "ARTWORK",
641 Anchor = { "TOPLEFT", "$parent", "BOTTOMLEFT", 0, 1 },
642 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
643 JustifyH = "CENTER",
644 TextColor = { 1, 1, 0 },
645 },
646 value = {
647 type = "FontString",
648 layer = "ARTWORK",
649 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
650 JustifyH = "CENTER",
651 TextColor = { 0, 1, 0 },
652 },
653 },
654 OnShow = function() sliderOnShow() end,
655 OnMouseUp = function() sliderOnMouseUp() end,
656 OnValueChanged = function() sliderOnValueChanged() end,
657 },
658 Nurfed_OptionColorSwatch= {
659 type = "Button",
660 size = { 16, 16 },
661 children = {
662 bg = {
663 type = "Texture",
664 Texture = "Interface\\ChatFrame\\ChatFrameColorSwatch",
665 size = { 16, 16 },
666 layer = "BACKGROUND",
667 Anchor = { "CENTER", "$parent", "CENTER", 0, 0 },
668 VertexColor = { 1, 1, 1 },
669 },
670 text = {
671 type = "FontString",
672 layer = "ARTWORK",
673 Anchor = { "LEFT", "$parent", "RIGHT", 1, 0 },
674 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
675 JustifyH = "LEFT",
676 TextColor = { 1, 1, 1 },
677 },
678 },
679 OnShow = function() swatchOnShow() end,
680 OnClick = function() swatchOpenColorPicker() end,
681 },
682 Nurfed_OptionInput = {
683 type = "Frame",
684 size = { 130, 30 },
685 children = {
686 text = {
687 type = "FontString",
688 layer = "ARTWORK",
689 Anchor = { "TOPLEFT", "$parent", "TOPLEFT", 3, 0 },
690 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
691 JustifyH = "LEFT",
692 TextColor = { 1, 1, 1 },
693 },
694 input = {
695 type = "EditBox",
696 size = { 100, 18 },
697 AutoFocus = false,
698 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 8, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
699 BackdropColor = { 0, 0.2, 0.2, 0.75 },
700 Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, 0 },
701 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
702 TextInsets = { 3, 9, 0, 0 },
703 OnEnterPressed = function() inputOnClick() end,
704 OnEscapePressed = function() this:ClearFocus() end,
705 },
706 set = {
707 template = "Nurfed_OptionButton",
708 properties = {
709 Anchor = { "LEFT", "$parentinput", "RIGHT", 1, 0 },
710 OnClick = function() inputOnClick() end,
711 vars = {
712 text = "Set",
713 },
714 },
715 },
716 },
717 OnShow = function() inputOnShow() end,
718 },
719 Nurfed_OptionInputSelectButton = {
720 type = "Button",
721 size = { 80, 10 },
722 children = {
723 highlight = {
724 type = "Texture",
725 layer = "BACKGROUND",
726 Texture = "Interface\\QuestFrame\\UI-QuestTitleHighlight",
727 BlendMode = "ADD",
728 Anchor = "all",
729 Alpha = 0.75;
730 Hide = true;
731 },
732 text = {
733 type = "FontString",
734 layer = "ARTWORK",
735 Anchor = "all",
736 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
737 JustifyH = "LEFT",
738 TextColor = { 1, 1, 1 },
739 },
740 },
741 OnClick = function() inputselectbuttonOnClick() end,
742 },
743 Nurfed_OptionNumSelect = {
744 type = "Frame",
745 size = { 106, 158 },
746 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 12, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
747 BackdropColor = { 0, 0, 0, 0 },
748 children = {
749 text = {
750 type = "FontString",
751 layer = "ARTWORK",
752 Anchor = { "TOP", "$parent", "TOP", 0, -4 },
753 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
754 JustifyH = "CENTER",
755 TextColor = { 1, 1, 1 },
756 },
757 button1 = {
758 template = "Nurfed_OptionInputSelectButton",
759 properties = {
760 Anchor = { "TOPLEFT", "$parent", "TOPLEFT", 3, -15 },
761 },
762 },
763 button2 = {
764 template = "Nurfed_OptionInputSelectButton",
765 properties = {
766 Anchor = { "TOPLEFT", "$parentbutton1", "BOTTOMLEFT", 0, -1 },
767 },
768 },
769 button3 = {
770 template = "Nurfed_OptionInputSelectButton",
771 properties = {
772 Anchor = { "TOPLEFT", "$parentbutton2", "BOTTOMLEFT", 0, -1 },
773 },
774 },
775 button4 = {
776 template = "Nurfed_OptionInputSelectButton",
777 properties = {
778 Anchor = { "TOPLEFT", "$parentbutton3", "BOTTOMLEFT", 0, -1 },
779 },
780 },
781 button5 = {
782 template = "Nurfed_OptionInputSelectButton",
783 properties = {
784 Anchor = { "TOPLEFT", "$parentbutton4", "BOTTOMLEFT", 0, -1 },
785 },
786 },
787 button6 = {
788 template = "Nurfed_OptionInputSelectButton",
789 properties = {
790 Anchor = { "TOPLEFT", "$parentbutton5", "BOTTOMLEFT", 0, -1 },
791 },
792 },
793 button7 = {
794 template = "Nurfed_OptionInputSelectButton",
795 properties = {
796 Anchor = { "TOPLEFT", "$parentbutton6", "BOTTOMLEFT", 0, -1 },
797 },
798 },
799 button8 = {
800 template = "Nurfed_OptionInputSelectButton",
801 properties = {
802 Anchor = { "TOPLEFT", "$parentbutton7", "BOTTOMLEFT", 0, -1 },
803 },
804 },
805 button9 = {
806 template = "Nurfed_OptionInputSelectButton",
807 properties = {
808 Anchor = { "TOPLEFT", "$parentbutton8", "BOTTOMLEFT", 0, -1 },
809 },
810 },
811 button10 = {
812 template = "Nurfed_OptionInputSelectButton",
813 properties = {
814 Anchor = { "TOPLEFT", "$parentbutton9", "BOTTOMLEFT", 0, -1 },
815 },
816 },
817 --[[
818 update = {
819 template = "Nurfed_OptionButton",
820 properties = {
821 FrameStrata = "MEDIUM",
822 Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 2, 2 },
823 vars = {
824 text = "Update",
825 },
826 OnClick = function() inputupdateOnClick() end,
827 },
828 },
829 ]]
830 add = {
831 template = "Nurfed_OptionButton",
832 properties = {
833 FrameStrata = "MEDIUM",
834 Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 2, 2 },
835 --Anchor = { "BOTTOM", "$parent", "BOTTOM", 0, 2 },
836 vars = {
837 text = "Add",
838 },
839 OnClick = function() inputaddOnClick() end,
840 },
841 },
842 remove = {
843 template = "Nurfed_OptionButton",
844 properties = {
845 FrameStrata = "MEDIUM",
846 Anchor = { "BOTTOMRIGHT", "$parent", "BOTTOMRIGHT", -2, 2 },
847 vars = {
848 text = REMOVE,
849 },
850 OnClick = function() inputremoveOnClick() end,
851 },
852 },
853 },
854 OnShow = function() inputselectOnShow() end,
855 },
856 Nurfed_OptionInputSelect = {
857 type = "Frame",
858 size = { 106, 170 },
859 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 12, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
860 BackdropColor = { 0, 0, 0, 0 },
861 children = {
862 text = {
863 type = "FontString",
864 layer = "ARTWORK",
865 Anchor = { "TOP", "$parent", "TOP", 0, -4 },
866 Font = { NRF_FONT.."framd.ttf", 11, "NONE" },
867 JustifyH = "CENTER",
868 TextColor = { 1, 1, 1 },
869 },
870 input = {
871 type = "EditBox",
872 size = { 100, 18 },
873 AutoFocus = false,
874 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 8, insets = { left = 2, right = 2, top = 2, bottom = 2 }, },
875 BackdropColor = { 0, 0.2, 0.2, 0.75 },
876 Anchor = { "TOPLEFT", "$parent", "TOPLEFT", 3, -15 },
877 Font = { NRF_FONT.."framd.ttf", 10, "NONE" },
878 TextInsets = { 3, 9, 0, 0 },
879 OnEnterPressed = function() inputselectOnEnterPressed() end,
880 OnEscapePressed = function() this:ClearFocus() end,
881 },
882 button1 = {
883 template = "Nurfed_OptionInputSelectButton",
884 properties = {
885 Anchor = { "TOPLEFT", "$parentinput", "BOTTOMLEFT", 3, -2 },
886 },
887 },
888 button2 = {
889 template = "Nurfed_OptionInputSelectButton",
890 properties = {
891 Anchor = { "TOPLEFT", "$parentbutton1", "BOTTOMLEFT", 0, -1 },
892 },
893 },
894 button3 = {
895 template = "Nurfed_OptionInputSelectButton",
896 properties = {
897 Anchor = { "TOPLEFT", "$parentbutton2", "BOTTOMLEFT", 0, -1 },
898 },
899 },
900 button4 = {
901 template = "Nurfed_OptionInputSelectButton",
902 properties = {
903 Anchor = { "TOPLEFT", "$parentbutton3", "BOTTOMLEFT", 0, -1 },
904 },
905 },
906 button5 = {
907 template = "Nurfed_OptionInputSelectButton",
908 properties = {
909 Anchor = { "TOPLEFT", "$parentbutton4", "BOTTOMLEFT", 0, -1 },
910 },
911 },
912 button6 = {
913 template = "Nurfed_OptionInputSelectButton",
914 properties = {
915 Anchor = { "TOPLEFT", "$parentbutton5", "BOTTOMLEFT", 0, -1 },
916 },
917 },
918 button7 = {
919 template = "Nurfed_OptionInputSelectButton",
920 properties = {
921 Anchor = { "TOPLEFT", "$parentbutton6", "BOTTOMLEFT", 0, -1 },
922 },
923 },
924 button8 = {
925 template = "Nurfed_OptionInputSelectButton",
926 properties = {
927 Anchor = { "TOPLEFT", "$parentbutton7", "BOTTOMLEFT", 0, -1 },
928 },
929 },
930 button9 = {
931 template = "Nurfed_OptionInputSelectButton",
932 properties = {
933 Anchor = { "TOPLEFT", "$parentbutton8", "BOTTOMLEFT", 0, -1 },
934 },
935 },
936 button10 = {
937 template = "Nurfed_OptionInputSelectButton",
938 properties = {
939 Anchor = { "TOPLEFT", "$parentbutton9", "BOTTOMLEFT", 0, -1 },
940 },
941 },
942 --[[
943 update = {
944 template = "Nurfed_OptionButton",
945 properties = {
946 FrameStrata = "MEDIUM",
947 Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 2, 2 },
948 vars = {
949 text = "Update",
950 },
951 OnClick = function() inputupdateOnClick() end,
952 },
953 },
954 ]]
955 remove = {
956 template = "Nurfed_OptionButton",
957 properties = {
958 FrameStrata = "MEDIUM",
959 Anchor = { "BOTTOMRIGHT", "$parent", "BOTTOMRIGHT", -2, 2 },
960 vars = {
961 text = REMOVE,
962 },
963 OnClick = function() inputremoveOnClick() end,
964 },
965 },
966 },
967 OnShow = function() inputselectOnShow() end,
968 },
969 };
970  
971 local menutbl = {
972 type = "Frame",
973 FrameStrata = "LOW",
974 Anchor = { "CENTER", "$parent", "CENTER", 150, 0 },
975 Backdrop = { bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 5, right = 5, top = 5, bottom = 5 }, },
976 BackdropColor = { 0, 0, 0, 0.75 },
977 children = {
978 titlebg = {
979 type = "Texture",
980 size = { 340, 20 },
981 layer = "BACKGROUND",
982 Anchor = { "TOPLEFT", "$parent", "TOPLEFT", 5, -5 },
983 Texture = NRF_IMG.."statusbar6.tga",
984 Gradient = { "HORIZONTAL", 0, 0.75, 1, 0, 0, 0.2 },
985 },
986 title = {
987 type = "FontString",
988 size = { 150, 12 },
989 layer = "ARTWORK",
990 Anchor = { "TOPLEFT", "$parent", "TOPLEFT", 6, -8 },
991 Font = { NRF_FONT.."framd.ttf", 12, "OUTLINE" },
992 JustifyH = "LEFT",
993 TextColor = { 1, 1, 1 },
994 },
995 version = {
996 type = "FontString",
997 size = { 150, 12 },
998 layer = "ARTWORK",
999 Anchor = { "TOPRIGHT", "$parent", "TOPRIGHT", -6, -8 },
1000 Font = { NRF_FONT.."framd.ttf", 12, "OUTLINE" },
1001 JustifyH = "RIGHT",
1002 TextColor = { 1, 1, 1 },
1003 },
1004 close = {
1005 template = "Nurfed_OptionButton",
1006 properties = {
1007 FrameStrata = "MEDIUM",
1008 Anchor = { "BOTTOMRIGHT", "$parent", "BOTTOMRIGHT", -4, 4 },
1009 vars = {
1010 text = CLOSE,
1011 },
1012 OnClick = function() HideUIPanel(Nurfed_OptionsFrame) end,
1013 },
1014 },
1015 },
1016 Hide = true,
1017 };
1018  
1019 for temp, spec in pairs(tbl) do
1020 framelib:CreateTemplate(temp, spec);
1021 end
1022 framelib:ObjectInit("Nurfed_OptionsFrame", menutbl, UIParent);
1023 tbl = nil;
1024 menutbl = nil;
1025 end