vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 distance
3 Author: dan
4 ]]
5 ---------------------------------------------------------------------------------------------------------------------------------
6 ---------------------------------------------------------------------------------------------------------------------------------
7 --------------------------------------------------------- OPTION FRAME ---------------------------------------------------------
8  
9 function distance_options_OnClick()
10 distance_options_frame:Hide();
11  
12 distance_frame_width = distance_frame:GetWidth();
13 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance width:" ..distance_frame_width);
14 distance_frame_alpha = distance_frame:GetAlpha();
15 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance alpha:" ..distance_frame_alpha);
16 distance_frame_height = distance_frame:GetHeight();
17 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance height:" ..distance_frame_height);
18  
19  
20 end
21  
22 function distance_frame_lock_OnClick()
23  
24 --lock frame
25 if distance_options_frame_lock_button:GetChecked(false)
26  
27 then distance_options_frame_lock_button:SetChecked(true);
28 distance_frame_Y = distance_frame:GetBottom();
29 distance_frame_X = distance_frame:GetLeft();
30 distance_frame:SetMovable(false);
31 distance_frame:EnableMouse(false);
32 distance_frame:ClearAllPoints();
33 distance_frame:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", distance_frame_X, distance_frame_Y);
34 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance: |cFFFF0000locked");
35 --DEFAULT_CHAT_FRAME:AddMessage("X: " .. distance_frame_X );
36 --DEFAULT_CHAT_FRAME:AddMessage("Y: " .. distance_frame_Y );
37  
38 --unlock frame
39 else distance_options_frame_lock_button:SetChecked(false);
40 distance_frame_Y = distance_frame:GetBottom();
41 distance_frame_X = distance_frame:GetLeft();
42 distance_frame:GetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", distance_frame_X, distance_frame_Y);
43 distance_frame:SetMovable(true);
44 distance_frame:EnableMouse(true);
45 distance_frame:Show();
46 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance: |cFFFF0000unlocked");
47 --DEFAULT_CHAT_FRAME:AddMessage("X: " .. distance_frame_X );
48 --DEFAULT_CHAT_FRAME:AddMessage("Y: " .. distance_frame_Y );
49  
50 end
51 end
52 ---------------------------------------------------------------------------------------------------------------------------------
53 function distance_frame_rotate_OnClick()
54 --distance_options_frame_rotate_button
55 if distance_options_frame_rotate_button:GetChecked(false)
56 then distance_options_frame_rotate_button:SetChecked(true)
57 distance_layout=true
58 distance_text_offset();
59 distance_frame:SetWidth(41 * height_value +6);
60 distance_frame:SetHeight(distance_options_slider_width:GetValue());
61  
62 distance_range1:SetHeight(distance_frame:GetHeight()-5);
63 distance_range2:SetHeight(distance_frame:GetHeight()-5);
64 distance_range3:SetHeight(distance_frame:GetHeight()-5);
65 distance_range4:SetHeight(distance_frame:GetHeight()-5);
66  
67 distance_range1:ClearAllPoints()
68 distance_range1:SetPoint("LEFT",distance_frame ,"LEFT",3,0)
69 distance_range2:ClearAllPoints()
70 distance_range2:SetPoint("LEFT",distance_frame ,"LEFT",3,0)
71 distance_range3:ClearAllPoints()
72 distance_range3:SetPoint("LEFT",distance_frame ,"LEFT",3,0)
73 distance_range4:ClearAllPoints()
74 distance_range4:SetPoint("LEFT",distance_frame ,"LEFT",3,0)
75  
76 else distance_options_frame_rotate_button:SetChecked(false)
77 distance_layout=false
78 distance_text_offset();
79 distance_frame:SetHeight(41 * height_value +5);
80 distance_frame:SetWidth(distance_options_slider_width:GetValue());
81  
82 distance_range1:SetWidth(distance_frame:GetWidth()-5);
83 distance_range2:SetWidth(distance_frame:GetWidth()-5);
84 distance_range3:SetWidth(distance_frame:GetWidth()-5);
85 distance_range4:SetWidth(distance_frame:GetWidth()-5);
86  
87 distance_range1:ClearAllPoints()
88 distance_range1:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
89 distance_range2:ClearAllPoints()
90 distance_range2:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
91 distance_range3:ClearAllPoints()
92 distance_range3:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
93 distance_range4:ClearAllPoints()
94 distance_range4:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
95  
96 end
97 end
98 ---------------------------------------------------------------------------------------------------------------------------------
99 function distance_frame_reset_OnClick()
100  
101 --frame reset
102  
103 distance_text_position = "BR"
104 distance_frame_X = 0;
105 distance_frame_Y = 0;
106 distance_layout=false;
107  
108 distance_options_frame_rotate_button:SetChecked(false)
109  
110 distance_frame:ClearAllPoints();
111 distance_frame:SetPoint("CENTER", "UIParent", "CENTER", distance_frame_X, distance_frame_Y);
112  
113 distance_options_slider_width:SetMinMaxValues(14, 200);
114 distance_options_slider_width:SetOrientation("HORIZONTAL");
115 distance_options_slider_width:SetValue(distance_frame_width);
116 distance_options_slider_width:SetValueStep(1);
117  
118 distance_frame:SetWidth(28);
119 distance_range1:SetWidth(distance_frame:GetWidth()-5);
120 distance_range2:SetWidth(distance_frame:GetWidth()-5);
121 distance_range3:SetWidth(distance_frame:GetWidth()-5);
122 distance_range4:SetWidth(distance_frame:GetWidth()-5);
123  
124 distance_range1:ClearAllPoints()
125 distance_range1:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
126 distance_range2:ClearAllPoints()
127 distance_range2:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
128 distance_range3:ClearAllPoints()
129 distance_range3:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
130 distance_range4:ClearAllPoints()
131 distance_range4:SetPoint("BOTTOM",distance_frame ,"BOTTOM",0,2)
132  
133 distance_options_slider_height:SetMinMaxValues(100, 1000);
134 distance_options_slider_height:SetOrientation("HORIZONTAL");
135 distance_options_slider_height:SetValue(height_value*100);
136 distance_options_slider_height:SetValueStep(1);
137  
138 distance_frame:SetHeight(41 * height_value +5);
139  
140 distance_options_slider_alpha:SetMinMaxValues(0, 100);
141 distance_options_slider_alpha:SetOrientation("HORIZONTAL");
142 distance_options_slider_alpha:SetValue(distance_frame_alpha*100);
143 distance_options_slider_alpha:SetValueStep(1);
144  
145 distance_frame:SetAlpha(distance_frame_alpha);
146  
147 distance_frame_Y = distance_frame:GetBottom();
148 distance_frame_X = distance_frame:GetLeft();
149 distance_frame:ClearAllPoints();
150 distance_frame:SetPoint("BOTTOMLEFT", "UIParent", "BOTTOMLEFT", distance_frame_X, distance_frame_Y);
151  
152 --DEFAULT_CHAT_FRAME:AddMessage("X: " .. distance_frame_X );
153 --DEFAULT_CHAT_FRAME:AddMessage("Y: " .. distance_frame_Y );
154  
155 distance_text_offset();
156 distance_text:ClearAllPoints();
157 distance_text1:ClearAllPoints();
158 distance_text:SetPoint("CENTER", "distance_range2", "TOP", offset_X_1, -offset_Y_1);
159 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", offset_X_2, -offset_Y_2);
160  
161 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance: |cFFFF0000reseted");
162 end
163 ---------------------------------------------------------------------------------------------------------------------------------
164 function distance_frame_BR_OnClick()
165  
166 if distance_options_frame_BR_button:GetButtonState(PUSHED)
167 then if (distance_layout==false)
168 then distance_text_position = "BR";
169 distance_text:ClearAllPoints();
170 distance_text1:ClearAllPoints();
171 distance_text:SetPoint("CENTER", "distance_range2", "TOP", offset_X_1, -offset_Y_1);
172 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", offset_X_2, -offset_Y_2);
173 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomRight");
174 else distance_text_position = "BR";
175 distance_text:ClearAllPoints();
176 distance_text1:ClearAllPoints();
177 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, -offset_X_1);
178 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, -offset_X_1);
179 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomRight");
180 end
181  
182 end
183 end
184  
185 function distance_frame_BL_OnClick()
186  
187 if distance_options_frame_BL_button:GetButtonState("PUSHED")
188 then if (distance_layout==false)
189 then distance_text_position = "BL";
190 distance_text:ClearAllPoints();
191 distance_text1:ClearAllPoints();
192 distance_text:SetPoint("CENTER", "distance_range2", "TOP", -offset_X_1, -offset_Y_1);
193 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", -offset_X_2, -offset_Y_2);
194 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomLeft");
195 else distance_text_position = "BL";
196 distance_text:ClearAllPoints();
197 distance_text1:ClearAllPoints();
198 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, -offset_X_1);
199 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, -offset_X_1);
200 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomLeft");
201 end
202 end
203 end
204  
205 function distance_frame_TL_OnClick()
206  
207 if distance_options_frame_TL_button:GetButtonState("PUSHED")
208 then if (distance_layout==false)
209 then distance_text_position = "TL";
210 distance_text:ClearAllPoints();
211 distance_text1:ClearAllPoints();
212 distance_text:SetPoint("CENTER", "distance_range2", "TOP", -offset_X_1, offset_Y_1);
213 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", -offset_X_2, offset_Y_2);
214 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopLeft");
215 else distance_text_position = "TL";
216 distance_text:ClearAllPoints();
217 distance_text1:ClearAllPoints();
218 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, offset_X_1);
219 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, offset_X_1);
220 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopLeft");
221 end
222 end
223 end
224  
225 function distance_frame_TR_OnClick()
226  
227 if distance_options_frame_TR_button:GetButtonState("PUSHED")
228 then if (distance_layout==false)
229 then distance_text_position = "TR";
230 distance_text:ClearAllPoints();
231 distance_text1:ClearAllPoints();
232 distance_text:SetPoint("CENTER", "distance_range2", "TOP", offset_X_1, offset_Y_1);
233 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", offset_X_2, offset_Y_2);
234 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopRight");
235 else distance_text_position = "TR";
236 distance_text:ClearAllPoints();
237 distance_text1:ClearAllPoints();
238 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, offset_X_1);
239 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, offset_X_1);
240 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopRight");
241 end
242 end
243 end
244  
245 function distance_frame_TC_OnClick()
246  
247 if distance_options_frame_TC_button:GetButtonState("PUSHED")
248 then if (distance_layout==false)
249 then distance_text_position = "TC";
250 distance_text:ClearAllPoints();
251 distance_text1:ClearAllPoints();
252 distance_text:SetPoint("CENTER", "distance_range2", "TOP", 0, offset_Y_1);
253 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", 0, offset_Y_2);
254 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopCenter");
255 else distance_text_position = "TC";
256 distance_text:ClearAllPoints();
257 distance_text1:ClearAllPoints();
258 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, 0);
259 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, 0);
260 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000TopCenter");
261 end
262 end
263 end
264  
265 function distance_frame_BC_OnClick()
266  
267 if distance_options_frame_BC_button:GetButtonState("PUSHED")
268 then if (distance_layout==false)
269 then distance_text_position = "BC";
270 distance_text:ClearAllPoints();
271 distance_text1:ClearAllPoints();
272 distance_text:SetPoint("CENTER", "distance_range2", "TOP", 0, -offset_Y_1);
273 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", 0, -offset_Y_2);
274 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomCenter");
275 else distance_text_position = "BC";
276 distance_text:ClearAllPoints();
277 distance_text1:ClearAllPoints();
278 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, 0);
279 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, 0);
280 DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance Anchor: |cFFFF0000BottomCenter");
281 end
282 end
283 end
284 ---------------------------------------------------------------------------------------------------------------------------------
285 function distance_text_offset()
286 if (distance_layout==false) then
287 offset_X_1 = ((distance_frame_width/2)+(distance_text:GetWidth()/2));
288 offset_Y_1 = ((distance_text:GetHeight()/2));
289 offset_X_2 = ((distance_frame_width/2)+(distance_text1:GetWidth()/2));
290 offset_Y_2 = ((distance_text1:GetHeight()/2));
291 elseif(distance_layout==true) then
292 offset_X_1 = ((distance_frame_height/2)+(distance_text:GetHeight()/2));
293 offset_Y_1 = (distance_text:GetWidth()/2);
294 offset_X_2 = ((distance_frame_height/2)+(distance_text1:GetHeight()/2));
295 offset_Y_2 = (distance_text1:GetWidth()/2);
296 end
297 end
298 ---------------------------------------------------------------------------------------------------------------------------------
299 function distance_slider_width()
300  
301 distance_options_slider_width:SetMinMaxValues(14, 200);
302 distance_options_slider_width:SetOrientation("HORIZONTAL");
303 distance_options_slider_width:SetValueStep(1);
304  
305 if distance_options_slider_width:GetValue()
306 then if (distance_layout==false) then
307 distance_options_slider_width:SetValue(distance_options_slider_width:GetValue());
308 distance_frame:SetWidth(distance_options_slider_width:GetValue());
309 distance_range1:SetWidth(distance_frame:GetWidth()-5);
310 distance_range2:SetWidth(distance_frame:GetWidth()-5);
311 distance_range3:SetWidth(distance_frame:GetWidth()-5);
312 distance_range4:SetWidth(distance_frame:GetWidth()-5);
313 distance_frame_width = distance_frame:GetWidth();
314  
315 offset_X_1 = ((distance_frame_width/2)+(distance_text:GetWidth()/2));
316 offset_Y_1 = ((distance_text:GetHeight()/2));
317 offset_X_2 = ((distance_frame_width/2)+(distance_text1:GetWidth()/2));
318 offset_Y_2 = ((distance_text1:GetHeight()/2));
319  
320  
321 if distance_text_position == "BR"
322 then distance_text:ClearAllPoints();
323 distance_text1:ClearAllPoints();
324 distance_text:SetPoint("CENTER", "distance_range2", "TOP", offset_X_1, -offset_Y_1);
325 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", offset_X_2, -offset_Y_2);
326  
327 elseif distance_text_position == "BL"
328 then distance_text:ClearAllPoints();
329 distance_text1:ClearAllPoints();
330 distance_text:SetPoint("CENTER", "distance_range2", "TOP", -offset_X_1, -offset_Y_1);
331 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", -offset_X_2, -offset_Y_2);
332  
333 elseif distance_text_position == "TL"
334 then distance_text:ClearAllPoints();
335 distance_text1:ClearAllPoints();
336 distance_text:SetPoint("CENTER", "distance_range2", "TOP", -offset_X_1, offset_Y_1);
337 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", -offset_X_2, offset_Y_2);
338  
339 elseif distance_text_position == "TR"
340 then distance_text:ClearAllPoints();
341 distance_text1:ClearAllPoints();
342 distance_text:SetPoint("CENTER", "distance_range2", "TOP", offset_X_1, offset_Y_1);
343 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", offset_X_2, offset_Y_2);
344  
345 elseif distance_text_position == "TC"
346 then distance_text:ClearAllPoints();
347 distance_text1:ClearAllPoints();
348 distance_text:SetPoint("CENTER", "distance_range2", "TOP", 0, offset_Y_1);
349 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", 0, offset_Y_2);
350  
351 elseif distance_text_position == "BC"
352 then distance_text:ClearAllPoints();
353 distance_text1:ClearAllPoints();
354 distance_text:SetPoint("CENTER", "distance_range2", "TOP", 0, -offset_Y_1);
355 distance_text1:SetPoint("CENTER", "distance_range4", "TOP", 0, -offset_Y_2);
356 end
357  
358 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance width:" ..distance_options_slider_width:GetValue());
359 else
360 if (distance_layout==true) then
361 distance_options_slider_width:SetValue(distance_options_slider_width:GetValue());
362 distance_frame:SetHeight(distance_options_slider_width:GetValue());
363 distance_range1:SetHeight(distance_frame:GetHeight()-5);
364 distance_range2:SetHeight(distance_frame:GetHeight()-5);
365 distance_range3:SetHeight(distance_frame:GetHeight()-5);
366 distance_range4:SetHeight(distance_frame:GetHeight()-5);
367 distance_frame_height = distance_frame:GetHeight();
368  
369 offset_X_1 = ((distance_frame_height/2)+(distance_text:GetHeight()/2));
370 offset_Y_1 = (distance_text:GetWidth()/2);
371 offset_X_2 = ((distance_frame_height/2)+(distance_text1:GetHeight()/2));
372 offset_Y_2 = (distance_text1:GetWidth()/2);
373  
374 if distance_text_position == "BR"
375 then distance_text:ClearAllPoints();
376 distance_text1:ClearAllPoints();
377 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, -offset_X_1);
378 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, -offset_X_1);
379  
380 elseif distance_text_position == "BL"
381 then distance_text:ClearAllPoints();
382 distance_text1:ClearAllPoints();
383 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, -offset_X_1);
384 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, -offset_X_1);
385  
386 elseif distance_text_position == "TL"
387 then distance_text:ClearAllPoints();
388 distance_text1:ClearAllPoints();
389 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, offset_X_1);
390 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, offset_X_1);
391  
392 elseif distance_text_position == "TR"
393 then distance_text:ClearAllPoints();
394 distance_text1:ClearAllPoints();
395 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, offset_X_1);
396 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, offset_X_1);
397  
398 elseif distance_text_position == "TC"
399 then distance_text:ClearAllPoints();
400 distance_text1:ClearAllPoints();
401 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", offset_Y_1, 0);
402 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", offset_Y_1, 0);
403  
404 elseif distance_text_position == "BC"
405 then distance_text:ClearAllPoints();
406 distance_text1:ClearAllPoints();
407 distance_text:SetPoint("CENTER", "distance_range2", "RIGHT", -offset_Y_1, 0);
408 distance_text1:SetPoint("CENTER", "distance_range4", "RIGHT", -offset_Y_1, 0);
409 end
410 end
411 end
412 end
413  
414 end
415 --------------------------------------------------------------------------------------------------------------------------------
416 function distance_slider_height()
417  
418 distance_options_slider_height:SetMinMaxValues(100, 1000);
419 distance_options_slider_height:SetOrientation("HORIZONTAL");
420 distance_options_slider_height:SetValueStep(1);
421  
422 if distance_options_slider_height:GetValue()
423 then
424 if (distance_layout==false) then
425 distance_options_slider_height:SetValue(distance_options_slider_height:GetValue());
426 height_value = (distance_options_slider_height:GetValue()/100);
427 distance_frame:SetHeight(41 * height_value +5);
428 distance_frame_height = distance_frame:GetHeight();
429  
430 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance height:" ..distance_options_slider_height:GetValue());
431 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance multi:" ..height_value);
432 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance height:" ..distance_frame_height);
433 else
434 if (distance_layout==true) then
435 distance_options_slider_height:SetValue(distance_options_slider_height:GetValue());
436 height_value = (distance_options_slider_height:GetValue()/100);
437 distance_frame:SetWidth(41 * height_value +6);
438 distance_frame_width = distance_frame:GetWidth();
439 end
440 end
441 end
442 end
443 ---------------------------------------------------------------------------------------------------------------------------------
444 --alpha slider
445 function distance_slider_alpha()
446  
447 distance_options_slider_alpha:SetMinMaxValues(0, 100);
448 distance_options_slider_alpha:SetOrientation("HORIZONTAL");
449 distance_options_slider_alpha:SetValueStep(1);
450  
451 if distance_options_slider_alpha:GetValue()
452 then distance_options_slider_alpha:SetValue(distance_options_slider_alpha:GetValue());
453 distance_frame:SetAlpha(distance_options_slider_alpha:GetValue()/100);
454 distance_frame_alpha = distance_frame:GetAlpha();
455 --DEFAULT_CHAT_FRAME:AddMessage("|cFF00FF00Distance alpha:" ..distance_options_slider_alpha:GetValue());
456 end
457  
458 end
459 ---------------------------------------------------------------------------------------------------------------------------------
460 --mouse up
461 function distance_options_OnMouseUp()
462 if (distance_options_frame.isMoving) then
463 distance_options_frame:StopMovingOrSizing();
464 distance_options_frame.isMoving = false;
465 end
466 end
467 ---------------------------------------------------------------------------------------------------------------------------------
468 --mouse down
469 function distance_options_OnMouseDown()
470 if (distance_options_frame:IsMovable()) then
471 if (( not distance_options_frame.isLocked ) or ( distance_options_frame.isLocked == 0 ) and ( arg1 == "LeftButton" )) then
472 distance_options_frame:StartMoving();
473 distance_options_frame.isMoving = true;
474 end
475 end
476 end
477 ---------------------------------------------------------------------------------------------------------------------------------
478 ---------------------------------------------------------------------------------------------------------------------------------
479 --textures onload
480 function distance_textures_OnLoad()
481 distance_background_texture_editbox:SetText("Background");
482 distance_background_texture_editbox:SetAutoFocus(false);
483  
484 distance_border_texture_editbox:SetText("Border");
485 distance_border_texture_editbox:SetAutoFocus(false);
486  
487 --distance_bar_height_texture_editbox:SetText(distance_bar_texture_h);
488 --distance_bar_height_texture_editbox:SetAutoFocus(false);
489  
490 --distance_bar_width_texture_editbox:SetText(distance_bar_texture_w);
491 --distance_bar_width_texture_editbox:SetAutoFocus(false);
492 end
493 ---------------------------------------------------------------------------------------------------------------------------------
494 --ok button background texture
495 function distance_enter_background_texture()
496 if distance_background_texture_ok:GetButtonState(PUSHED)
497 then distance_background_texture_editbox:SetText("Background");
498 distance_background_texture_editbox:ClearFocus(true);
499 end
500 end
501 ---------------------------------------------------------------------------------------------------------------------------------
502 --ok button border texture
503 function distance_enter_border_texture()
504 if distance_border_texture_ok:GetButtonState(PUSHED)
505 then distance_border_texture_editbox:SetText("Border");
506 distance_border_texture_editbox:ClearFocus(true);
507 end
508 end
509 ---------------------------------------------------------------------------------------------------------------------------------
510 --ok button height texture
511 function distance_enter_bar_height_texture()
512 if distance_bar_height_texture_ok:GetButtonState(PUSHED)
513 then distance_bar_texture_h=distance_bar_height_texture_editbox:GetText();
514 distance_bar_height_texture_editbox:SetText(distance_bar_texture_h);
515 distance_bar_height_texture_editbox:ClearFocus(true);
516 end
517 end
518 ---------------------------------------------------------------------------------------------------------------------------------
519 --default button height texture
520 function distance_default_bar_height_texture()
521 if distance_bar_height_texture_default:GetButtonState(PUSHED)
522 then distance_bar_texture_h="Interface\\AddOns\\Distance\\texture\\bar_h";
523 distance_bar_height_texture_editbox:SetText(distance_bar_texture_h);
524 distance_bar_height_texture_editbox:ClearFocus(true);
525 end
526 end
527 ---------------------------------------------------------------------------------------------------------------------------------
528 --ok button width texture
529 function distance_enter_bar_width_texture()
530 if distance_bar_width_texture_ok:GetButtonState(PUSHED)
531 then distance_bar_texture_w=distance_bar_width_texture_editbox:GetText();
532 distance_bar_width_texture_editbox:SetText(distance_bar_texture_w);
533 distance_bar_width_texture_editbox:ClearFocus(true);
534 end
535 end
536 ---------------------------------------------------------------------------------------------------------------------------------
537 --default button width texture
538 function distance_default_bar_width_texture()
539 if distance_bar_width_texture_default:GetButtonState(PUSHED)
540 then distance_bar_texture_w="Interface\\AddOns\\Distance\\texture\\bar_w";
541 distance_bar_width_texture_editbox:SetText(distance_bar_texture_w);
542 distance_bar_width_texture_editbox:ClearFocus(true);
543 end
544 end
545 ---------------------------------------------------------------------------------------------------------------------------------
546 function distance_options_color_bar1_OnClick()
547 distance_options_color_tab1:SetTextHeight(14);
548 distance_options_color_bar1:SetHeight(25);
549 distance_options_color_bar1:SetWidth(60);
550  
551 distance_options_color_tab2:SetTextHeight(12);
552 distance_options_color_bar2:SetHeight(20);
553 distance_options_color_bar2:SetWidth(50);
554  
555 distance_options_color_tab3:SetTextHeight(12);
556 distance_options_color_bar3:SetHeight(20);
557 distance_options_color_bar3:SetWidth(50);
558  
559 distance_options_color_tab4:SetTextHeight(12);
560 distance_options_color_bar4:SetHeight(20);
561 distance_options_color_bar4:SetWidth(50);
562  
563 distance_options_color_tab5:SetTextHeight(12);
564 distance_options_color_bar5:SetHeight(20);
565 distance_options_color_bar5:SetWidth(50);
566  
567 distance_color_tab1=true
568 distance_color_tab2=false
569 distance_color_tab3=false
570 distance_color_tab4=false
571 distance_color_tab5=false
572  
573 distance_options_slider_red:SetValue(barcolor.b1_color_w_r*100);
574 distance_options_slider_green:SetValue(barcolor.b1_color_w_g*100);
575 distance_options_slider_blue:SetValue(barcolor.b1_color_w_b*100);
576  
577 end
578 ---------------------------------------------------------------------------------------------------------------------------------
579 function distance_options_color_bar2_OnClick()
580 distance_options_color_tab1:SetTextHeight(12);
581 distance_options_color_bar1:SetHeight(20);
582 distance_options_color_bar1:SetWidth(50);
583  
584 distance_options_color_tab2:SetTextHeight(14);
585 distance_options_color_bar2:SetHeight(25);
586 distance_options_color_bar2:SetWidth(60);
587  
588 distance_options_color_tab3:SetTextHeight(12);
589 distance_options_color_bar3:SetHeight(20);
590 distance_options_color_bar3:SetWidth(50);
591  
592 distance_options_color_tab4:SetTextHeight(12);
593 distance_options_color_bar4:SetHeight(20);
594 distance_options_color_bar4:SetWidth(50);
595  
596 distance_options_color_tab5:SetTextHeight(12);
597 distance_options_color_bar5:SetHeight(20);
598 distance_options_color_bar5:SetWidth(50);
599  
600 distance_color_tab1=false
601 distance_color_tab2=true
602 distance_color_tab3=false
603 distance_color_tab4=false
604 distance_color_tab5=false
605  
606 distance_options_slider_red:SetValue(barcolor.b2_color_w_r*100);
607 distance_options_slider_green:SetValue(barcolor.b2_color_w_g*100);
608 distance_options_slider_blue:SetValue(barcolor.b2_color_w_b*100);
609 end
610 ---------------------------------------------------------------------------------------------------------------------------------
611 function distance_options_color_bar3_OnClick()
612 distance_options_color_tab1:SetTextHeight(12);
613 distance_options_color_bar1:SetHeight(20);
614 distance_options_color_bar1:SetWidth(50);
615  
616 distance_options_color_tab2:SetTextHeight(12);
617 distance_options_color_bar2:SetHeight(20);
618 distance_options_color_bar2:SetWidth(50);
619  
620 distance_options_color_tab3:SetTextHeight(14);
621 distance_options_color_bar3:SetHeight(25);
622 distance_options_color_bar3:SetWidth(60);
623  
624 distance_options_color_tab4:SetTextHeight(12);
625 distance_options_color_bar4:SetHeight(20);
626 distance_options_color_bar4:SetWidth(50);
627  
628 distance_options_color_tab5:SetTextHeight(12);
629 distance_options_color_bar5:SetHeight(20);
630 distance_options_color_bar5:SetWidth(50);
631  
632 distance_color_tab1=false
633 distance_color_tab2=false
634 distance_color_tab3=true
635 distance_color_tab4=false
636 distance_color_tab5=false
637  
638 distance_options_slider_red:SetValue(barcolor.b3_color_w_r*100);
639 distance_options_slider_green:SetValue(barcolor.b3_color_w_g*100);
640 distance_options_slider_blue:SetValue(barcolor.b3_color_w_b*100);
641 end
642 ---------------------------------------------------------------------------------------------------------------------------------
643 function distance_options_color_bar4_OnClick()
644 distance_options_color_tab1:SetTextHeight(12);
645 distance_options_color_bar1:SetHeight(20);
646 distance_options_color_bar1:SetWidth(50);
647  
648 distance_options_color_tab2:SetTextHeight(12);
649 distance_options_color_bar2:SetHeight(20);
650 distance_options_color_bar2:SetWidth(50);
651  
652 distance_options_color_tab3:SetTextHeight(12);
653 distance_options_color_bar3:SetHeight(20);
654 distance_options_color_bar3:SetWidth(50);
655  
656 distance_options_color_tab4:SetTextHeight(14);
657 distance_options_color_bar4:SetHeight(25);
658 distance_options_color_bar4:SetWidth(60);
659  
660 distance_options_color_tab5:SetTextHeight(12);
661 distance_options_color_bar5:SetHeight(20);
662 distance_options_color_bar5:SetWidth(50);
663  
664 distance_color_tab1=false
665 distance_color_tab2=false
666 distance_color_tab3=false
667 distance_color_tab4=true
668 distance_color_tab5=false
669  
670 distance_options_slider_red:SetValue(barcolor.b4_color_w_r*100);
671 distance_options_slider_green:SetValue(barcolor.b4_color_w_g*100);
672 distance_options_slider_blue:SetValue(barcolor.b4_color_w_b*100);
673 end
674 ---------------------------------------------------------------------------------------------------------------------------------
675 function distance_options_color_bar5_OnClick()
676 distance_options_color_tab1:SetTextHeight(12);
677 distance_options_color_bar1:SetHeight(20);
678 distance_options_color_bar1:SetWidth(50);
679  
680 distance_options_color_tab2:SetTextHeight(12);
681 distance_options_color_bar2:SetHeight(20);
682 distance_options_color_bar2:SetWidth(50);
683  
684 distance_options_color_tab3:SetTextHeight(12);
685 distance_options_color_bar3:SetHeight(20);
686 distance_options_color_bar3:SetWidth(50);
687  
688 distance_options_color_tab4:SetTextHeight(12);
689 distance_options_color_bar4:SetHeight(20);
690 distance_options_color_bar4:SetWidth(50);
691  
692 distance_options_color_tab5:SetTextHeight(14);
693 distance_options_color_bar5:SetHeight(25);
694 distance_options_color_bar5:SetWidth(60);
695  
696 distance_color_tab1=false
697 distance_color_tab2=false
698 distance_color_tab3=false
699 distance_color_tab4=false
700 distance_color_tab5=true
701 end
702 ---------------------------------------------------------------------------------------------------------------------------------
703 function distance_slider_red()
704 distance_options_slider_red:SetMinMaxValues(0, 100);
705 distance_options_slider_red:SetOrientation("HORIZONTAL");
706 distance_options_slider_red:SetValueStep(1);
707  
708 if distance_options_slider_red:GetValue()
709 then distance_options_slider_red:SetValue(distance_options_slider_red:GetValue());
710  
711 if distance_color_tab1==true
712 then distance_range_color1:SetVertexColor((distance_options_slider_red:GetValue()/100), 1,1);
713 barcolor.b1_color_w_r = (distance_options_slider_red:GetValue()/100)
714 barcolor.b1_color_h_r = (distance_options_slider_red:GetValue()/100)
715 end
716 if distance_color_tab2==true
717 then distance_range_color2:SetVertexColor((distance_options_slider_red:GetValue()/100), 1,1);
718 barcolor.b2_color_w_r = (distance_options_slider_red:GetValue()/100)
719 barcolor.b2_color_h_r = (distance_options_slider_red:GetValue()/100)
720 end
721 if distance_color_tab3==true
722 then distance_range_color3:SetVertexColor((distance_options_slider_red:GetValue()/100), 1,1);
723 barcolor.b3_color_w_r = (distance_options_slider_red:GetValue()/100)
724 barcolor.b3_color_h_r = (distance_options_slider_red:GetValue()/100)
725 end
726 if distance_color_tab4==true
727 then distance_range_color4:SetVertexColor((distance_options_slider_red:GetValue()/100), 1,1);
728 barcolor.b4_color_w_r = (distance_options_slider_red:GetValue()/100)
729 barcolor.b4_color_h_r = (distance_options_slider_red:GetValue()/100)
730 end
731 end
732 end
733 ---------------------------------------------------------------------------------------------------------------------------------
734 function distance_slider_green()
735 distance_options_slider_green:SetMinMaxValues(0, 100);
736 distance_options_slider_green:SetOrientation("HORIZONTAL");
737 distance_options_slider_green:SetValueStep(1);
738  
739 if distance_options_slider_green:GetValue()
740 then distance_options_slider_green:SetValue(distance_options_slider_green:GetValue());
741  
742 if distance_color_tab1==true
743 then distance_range_color1:SetVertexColor(1, (distance_options_slider_green:GetValue()/100), 1);
744 barcolor.b1_color_w_g = (distance_options_slider_green:GetValue()/100)
745 barcolor.b1_color_h_g = (distance_options_slider_green:GetValue()/100)
746 end
747 if distance_color_tab2==true
748 then distance_range_color2:SetVertexColor(1, (distance_options_slider_green:GetValue()/100), 1);
749 barcolor.b2_color_w_g = (distance_options_slider_green:GetValue()/100)
750 barcolor.b2_color_h_g = (distance_options_slider_green:GetValue()/100)
751 end
752 if distance_color_tab3==true
753 then distance_range_color3:SetVertexColor(1, (distance_options_slider_green:GetValue()/100), 1);
754 barcolor.b3_color_w_g = (distance_options_slider_green:GetValue()/100)
755 barcolor.b3_color_h_g = (distance_options_slider_green:GetValue()/100)
756 end
757 if distance_color_tab4==true
758 then distance_range_color4:SetVertexColor(1, (distance_options_slider_green:GetValue()/100), 1);
759 barcolor.b4_color_w_g = (distance_options_slider_green:GetValue()/100)
760 barcolor.b4_color_h_g = (distance_options_slider_green:GetValue()/100)
761 end
762  
763 end
764 end
765 ---------------------------------------------------------------------------------------------------------------------------------
766 function distance_slider_blue()
767 distance_options_slider_blue:SetMinMaxValues(0, 100);
768 distance_options_slider_blue:SetOrientation("HORIZONTAL");
769 distance_options_slider_blue:SetValueStep(1);
770  
771 if distance_options_slider_blue:GetValue()
772 then distance_options_slider_blue:SetValue(distance_options_slider_blue:GetValue());
773  
774 if distance_color_tab1==true
775 then distance_range_color1:SetVertexColor(1, 1, (distance_options_slider_blue:GetValue()/100));
776 barcolor.b1_color_w_b = (distance_options_slider_blue:GetValue()/100)
777 barcolor.b1_color_h_b = (distance_options_slider_blue:GetValue()/100)
778 end
779 if distance_color_tab2==true
780 then distance_range_color2:SetVertexColor(1, 1, (distance_options_slider_blue:GetValue()/100));
781 barcolor.b2_color_w_b = (distance_options_slider_blue:GetValue()/100)
782 barcolor.b2_color_h_b = (distance_options_slider_blue:GetValue()/100)
783 end
784 if distance_color_tab3==true
785 then distance_range_color3:SetVertexColor(1, 1, (distance_options_slider_blue:GetValue()/100));
786 barcolor.b3_color_w_b = (distance_options_slider_blue:GetValue()/100)
787 barcolor.b3_color_h_b = (distance_options_slider_blue:GetValue()/100)
788 end
789 if distance_color_tab4==true
790 then distance_range_color1:SetVertexColor(1, 1, (distance_options_slider_blue:GetValue()/100));
791 barcolor.b4_color_w_b = (distance_options_slider_blue:GetValue()/100)
792 barcolor.b4_color_h_b = (distance_options_slider_blue:GetValue()/100)
793 end
794 end
795 end