vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local RangeColorOptions_SetColorFunc = { |
2 | [1] = function(x) RangeColorOptions_SetColor(1) end, |
||
3 | [2] = function(x) RangeColorOptions_SetColor(2) end, |
||
4 | [3] = function(x) RangeColorOptions_SetColor(3) end, |
||
5 | [4] = function(x) RangeColorOptions_SetColor(4) end, |
||
6 | [5] = function(x) RangeColorOptions_SetColor(5) end, |
||
7 | [6] = function(x) RangeColorOptions_SetColor(6) end, |
||
8 | [7] = function(x) RangeColorOptions_SetColor(7) end, |
||
9 | [8] = function(x) RangeColorOptions_SetColor(8) end, |
||
10 | [9] = function(x) RangeColorOptions_SetColor(9) end, |
||
11 | [10] = function(x) RangeColorOptions_SetColor(10) end, |
||
12 | [11] = function(x) RangeColorOptions_SetColor(11) end, |
||
13 | [12] = function(x) RangeColorOptions_SetColor(12) end, |
||
14 | }; |
||
15 | |||
16 | local RangeColorOptions_CancelColorFunc = { |
||
17 | [1] = function(x) RangeColorOptions_CancelColor(1,x) end, |
||
18 | [2] = function(x) RangeColorOptions_CancelColor(2,x) end, |
||
19 | [3] = function(x) RangeColorOptions_CancelColor(3,x) end, |
||
20 | [4] = function(x) RangeColorOptions_CancelColor(4,x) end, |
||
21 | [5] = function(x) RangeColorOptions_CancelColor(5,x) end, |
||
22 | [6] = function(x) RangeColorOptions_CancelColor(6,x) end, |
||
23 | [7] = function(x) RangeColorOptions_CancelColor(7,x) end, |
||
24 | [8] = function(x) RangeColorOptions_CancelColor(8,x) end, |
||
25 | [9] = function(x) RangeColorOptions_CancelColor(9,x) end, |
||
26 | [10] = function(x) RangeColorOptions_CancelColor(10,x) end, |
||
27 | [11] = function(x) RangeColorOptions_CancelColor(11,x) end, |
||
28 | [12] = function(x) RangeColorOptions_CancelColor(12,x) end, |
||
29 | }; |
||
30 | |||
31 | RangeColorOptionsFrameColorSwatch = { }; |
||
32 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH1.name] = { index = 1, text = RANGECOLOROPTIONS_COLORWATCH1.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH1.tooltipText}; |
||
33 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH2.name] = { index = 2, text = RANGECOLOROPTIONS_COLORWATCH2.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH2.tooltipText}; |
||
34 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH3.name] = { index = 3, text = RANGECOLOROPTIONS_COLORWATCH3.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH3.tooltipText}; |
||
35 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH4.name] = { index = 4, text = RANGECOLOROPTIONS_COLORWATCH4.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH4.tooltipText}; |
||
36 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH5.name] = { index = 5, text = RANGECOLOROPTIONS_COLORWATCH5.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH5.tooltipText}; |
||
37 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH6.name] = { index = 6, text = RANGECOLOROPTIONS_COLORWATCH6.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH6.tooltipText}; |
||
38 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH7.name] = { index = 7, text = RANGECOLOROPTIONS_COLORWATCH7.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH7.tooltipText}; |
||
39 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH8.name] = { index = 8, text = RANGECOLOROPTIONS_COLORWATCH8.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH8.tooltipText}; |
||
40 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH9.name] = { index = 9, text = RANGECOLOROPTIONS_COLORWATCH9.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH9.tooltipText}; |
||
41 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH10.name] = { index = 10, text = RANGECOLOROPTIONS_COLORWATCH10.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH10.tooltipText}; |
||
42 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH11.name] = { index = 11, text = RANGECOLOROPTIONS_COLORWATCH11.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH11.tooltipText}; |
||
43 | RangeColorOptionsFrameColorSwatch [RANGECOLOROPTIONS_COLORWATCH12.name] = { index = 12, text = RANGECOLOROPTIONS_COLORWATCH12.text, tooltipText = RANGECOLOROPTIONS_COLORWATCH12.tooltipText}; |
||
44 | |||
45 | RangeColorOptionsFrameSliders = { }; |
||
46 | RangeColorOptionsFrameSliders [RANGECOLOROPTIONS_SLIDER1.name] = { index = 1, RangeColorVar = "Mode", minValue = 1, maxValue = 3, valueStep = 1, minText=RANGECOLOROPTIONS_SLIDER1.minText, maxText=RANGECOLOROPTIONS_SLIDER1.maxText, tooltipText = RANGECOLOROPTIONS_SLIDER1.tooltipText}; |
||
47 | |||
48 | RangeColorOptionsFrameEvents = { }; |
||
49 | RangeColorOptionsFrameEvents [RANGECOLOROPTIONS_CHECK1.name] = { index = 1, tooltipText = RANGECOLOROPTIONS_CHECK1.tooltipText, RangeColorVar = "Filter"}; |
||
50 | RangeColorOptionsFrameEvents [RANGECOLOROPTIONS_CHECK2.name] = { index = 2, tooltipText = RANGECOLOROPTIONS_CHECK2.tooltipText, RangeColorVar = "Dash"}; |
||
51 | |||
52 | |||
53 | function RangeColorOptions_OnLoad() |
||
54 | UIPanelWindows["RangeColorOptionsFrame"] = {area = "center", pushable = 0}; |
||
55 | end |
||
56 | |||
57 | function RangeColorOptions_OnShow() |
||
58 | local button, string, checked; |
||
59 | |||
60 | for key, value in RangeColorOptionsFrameEvents do |
||
61 | local string = getglobal("RangeColorOptionsFrame_CheckButton"..value.index.."Text"); |
||
62 | local button = getglobal("RangeColorOptionsFrame_CheckButton"..value.index); |
||
63 | checked = nil; |
||
64 | button.disabled = nil; |
||
65 | if ( value.RangeColorVar ) then |
||
66 | if ( RangeColor_Get(value.RangeColorVar) == 1 ) then |
||
67 | checked = 1; |
||
68 | else |
||
69 | checked = 0; |
||
70 | end |
||
71 | else |
||
72 | checked = 0; |
||
73 | end |
||
74 | OptionsFrame_EnableCheckBox(button); |
||
75 | button:SetChecked(checked); |
||
76 | string:SetText(key); |
||
77 | button.tooltipText = value.tooltipText; |
||
78 | end |
||
79 | |||
80 | if ( not RangeColorOptionsFrame_CheckButton1:GetChecked() ) then |
||
81 | OptionsFrame_DisableCheckBox(RangeColorOptionsFrame_CheckButton2); |
||
82 | else |
||
83 | OptionsFrame_EnableCheckBox(RangeColorOptionsFrame_CheckButton2, RangeColor_Get("Dash")); |
||
84 | end |
||
85 | |||
86 | for key, value in RangeColorOptionsFrameColorSwatch do |
||
87 | string = getglobal("RangeColorSwatchFrame"..value.index.."_ColorSwatchText"); |
||
88 | |||
89 | string:SetText(value.text); |
||
90 | |||
91 | local frame,swatch,sRed,sGreen,sBlue,sColor; |
||
92 | |||
93 | frame = getglobal("RangeColorSwatchFrame"..value.index); |
||
94 | swatch = getglobal("RangeColorSwatchFrame"..value.index.."_ColorSwatchNormalTexture"); |
||
95 | |||
96 | frame.tooltipText = value.tooltipText; |
||
97 | |||
98 | sColor = RangeColor_GetColor(value.index); |
||
99 | sRed = sColor.r; |
||
100 | sGreen = sColor.g; |
||
101 | sBlue = sColor.b; |
||
102 | |||
103 | frame.r = sRed; |
||
104 | frame.g = sGreen; |
||
105 | frame.b = sBlue; |
||
106 | frame.swatchFunc = RangeColorOptions_SetColorFunc[value.index]; |
||
107 | frame.cancelFunc = RangeColorOptions_CancelColorFunc[value.index]; |
||
108 | swatch:SetVertexColor(sRed,sGreen,sBlue); |
||
109 | end |
||
110 | |||
111 | local slider, low, high, getvalue |
||
112 | for key, value in RangeColorOptionsFrameSliders do |
||
113 | slider = getglobal("RangeColorOptionsFrame_Slider"..value.index); |
||
114 | string = getglobal("RangeColorOptionsFrame_Slider"..value.index.."Text"); |
||
115 | low = getglobal("RangeColorOptionsFrame_Slider"..value.index.."Low"); |
||
116 | high = getglobal("RangeColorOptionsFrame_Slider"..value.index.."High"); |
||
117 | getvalue = RangeColor_Get(value.RangeColorVar); |
||
118 | OptionsFrame_EnableSlider(slider); |
||
119 | slider:SetMinMaxValues(value.minValue, value.maxValue); |
||
120 | slider:SetValueStep(value.valueStep); |
||
121 | slider:SetValue(getvalue); |
||
122 | string:SetText(key); |
||
123 | low:SetText(value.minText); |
||
124 | high:SetText(value.maxText); |
||
125 | slider.tooltipText = value.tooltipText; |
||
126 | end |
||
127 | end |
||
128 | |||
129 | function RangeColorOptions_CheckButtonOnClick() |
||
130 | local button; |
||
131 | for key, value in RangeColorOptionsFrameEvents do |
||
132 | if (this:GetName() == "RangeColorOptionsFrame_CheckButton"..value.index) then |
||
133 | local enable = nil; |
||
134 | button = getglobal("RangeColorOptionsFrame_CheckButton"..value.index); |
||
135 | if ( button:GetChecked() ) then |
||
136 | enable = 1; |
||
137 | else |
||
138 | enable = 0; |
||
139 | end |
||
140 | if ( value.RangeColorVar ) then |
||
141 | RangeColor_Set(value.RangeColorVar, enable); |
||
142 | end |
||
143 | end |
||
144 | end |
||
145 | if ( not RangeColorOptionsFrame_CheckButton1:GetChecked() ) then |
||
146 | OptionsFrame_DisableCheckBox(RangeColorOptionsFrame_CheckButton2); |
||
147 | else |
||
148 | OptionsFrame_EnableCheckBox(RangeColorOptionsFrame_CheckButton2, RangeColor_Get("Dash")); |
||
149 | end |
||
150 | end |
||
151 | |||
152 | function RangeColorOptions_SliderOnValueChanged() |
||
153 | local slider; |
||
154 | for key, value in RangeColorOptionsFrameSliders do |
||
155 | if (this:GetName() == "RangeColorOptionsFrame_Slider"..value.index) then |
||
156 | if ( value.RangeColorVar ) then |
||
157 | RangeColor_Set(value.RangeColorVar,this:GetValue()); |
||
158 | end |
||
159 | end |
||
160 | end |
||
161 | end |
||
162 | |||
163 | function RangeColorOptions_SetColor(key) |
||
164 | local r,g,b = ColorPickerFrame:GetColorRGB(); |
||
165 | local swatch,frame; |
||
166 | swatch = getglobal("RangeColorSwatchFrame"..key.."_ColorSwatchNormalTexture"); |
||
167 | frame = getglobal("RangeColorSwatchFrame"..key); |
||
168 | swatch:SetVertexColor(r,g,b); |
||
169 | frame.r = r; |
||
170 | frame.g = g; |
||
171 | frame.b = b; |
||
172 | RangeColor_SetColor(key, r, g, b) |
||
173 | end |
||
174 | |||
175 | function RangeColorOptions_CancelColor(key, prev) |
||
176 | local r = prev.r; |
||
177 | local g = prev.g; |
||
178 | local b = prev.b; |
||
179 | local swatch, frame; |
||
180 | swatch = getglobal("RangeColorSwatchFrame"..key.."_ColorSwatchNormalTexture"); |
||
181 | frame = getglobal("RangeColorSwatchFrame"..key); |
||
182 | swatch:SetVertexColor(r, g, b); |
||
183 | frame.r = r; |
||
184 | frame.g = g; |
||
185 | frame.b = b; |
||
186 | RangeColor_SetColor(key, r, g, b) |
||
187 | end |
||
188 | |||
189 | function RangeColorOptions_OpenColorPicker(button) |
||
190 | CloseMenus(); |
||
191 | if ( not button ) then |
||
192 | button = this; |
||
193 | end |
||
194 | ColorPickerFrame.func = button.swatchFunc; |
||
195 | ColorPickerFrame:SetColorRGB(button.r, button.g, button.b); |
||
196 | ColorPickerFrame.previousValues = {r = button.r, g = button.g, b = button.b, opacity = button.opacity}; |
||
197 | ColorPickerFrame.cancelFunc = button.cancelFunc; |
||
198 | ColorPickerFrame:Show(); |
||
199 | end |