vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 WIM_Options_CurrentSwatch = nil;
2 WIM_Options_AlreadyShown = false;
3  
4 WIM_Alias_Selected = "";
5 WIM_Filter_Selected = "";
6 WIM_History_Selected = "";
7  
8 function WIM_Options_OnShow()
9 local tRGB;
10  
11 WIM_OptionsEnableWIM:SetChecked(WIM_Data.enableWIM);
12  
13 --[ Initialize Minimap Icon Frame
14 WIM_OptionsMiniMapIconPosition:SetValue(WIM_Data.iconPosition);
15 WIM_OptionsMiniMapIconPositionTitle:SetText("Icon Position");
16 WIM_OptionsMiniMapEnabled:SetChecked(WIM_Data.showMiniMap);
17 WIM_OptionsMiniMapFreeMoving:SetChecked(WIM_Data.miniFreeMoving.enabled);
18  
19 --[ Initialize Display Settings Frame
20 --[Swatches
21 WIM_Options_CurrentSwatch = "WIM_OptionsDisplayIncomingWisp";
22 tRGB = WIM_Data.displayColors.wispIn;
23 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
24 WIM_Options_CurrentSwatch = "WIM_OptionsDisplayOutgoingWisp";
25 tRGB = WIM_Data.displayColors.wispOut;
26 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
27 WIM_Options_CurrentSwatch = "WIM_OptionsDisplaySystemMessage";
28 tRGB = WIM_Data.displayColors.sysMsg;
29 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
30 WIM_Options_CurrentSwatch = "WIM_OptionsDisplayErrorMessage";
31 tRGB = WIM_Data.displayColors.errorMsg;
32 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
33 WIM_Options_CurrentSwatch = "WIM_OptionsDisplayWebAddress";
34 tRGB = WIM_Data.displayColors.webAddress;
35 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
36 WIM_OptionsDisplayShowTimeStamps:SetChecked(WIM_Data.showTimeStamps);
37 WIM_OptionsDisplayShowShortcutBar:SetChecked(WIM_Data.showShortcutBar);
38 --[Character Info
39 WIM_OptionsDisplayShowCharacterInfo:SetChecked(WIM_Data.characterInfo.show);
40 WIM_OptionsDisplayShowCharacterInfoClassIcon:SetChecked(WIM_Data.characterInfo.classIcon);
41 WIM_OptionsDisplayShowCharacterInfoClassColor:SetChecked(WIM_Data.characterInfo.classColor);
42 WIM_OptionsDisplayShowCharacterInfoDetails:SetChecked(WIM_Data.characterInfo.details);
43  
44 --[Sliders
45 WIM_OptionsDisplayFontSize:SetValue(WIM_Data.fontSize);
46 WIM_OptionsDisplayFontSizeTitle:SetText("Font Size");
47 WIM_OptionsDisplayWindowSize:SetValue(WIM_Data.windowSize * 100);
48 WIM_OptionsDisplayWindowSizeTitle:SetText("Window Size (Percent)");
49 WIM_OptionsDisplayWindowAlpha:SetValue(WIM_Data.windowAlpha * 100);
50 WIM_OptionsDisplayWindowAlphaTitle:SetText("Transparency (Percent)");
51 --[ Initialize General Settings
52 WIM_OptionsTabbedFrameGeneralKeepFocus:SetChecked(WIM_Data.keepFocus);
53 WIM_OptionsTabbedFrameGeneralAutoFocus:SetChecked(WIM_Data.autoFocus);
54 WIM_OptionsTabbedFrameGeneralShowToolTips:SetChecked(WIM_Data.showToolTips);
55 WIM_OptionsTabbedFrameGeneralSupress:SetChecked(WIM_Data.supressWisps);
56 WIM_OptionsTabbedFrameGeneralPopNew:SetChecked(WIM_Data.popNew);
57 WIM_OptionsTabbedFrameGeneralPopUpdate:SetChecked(WIM_Data.popUpdate);
58 WIM_Options_PopNewClicked();
59 WIM_OptionsTabbedFrameGeneralPlaySoundWisp:SetChecked(WIM_Data.playSoundWisp);
60 WIM_OptionsTabbedFrameGeneralSortOrderAlpha:SetChecked(WIM_Data.sortAlpha);
61 WIM_OptionsTabbedFrameGeneralPopCombat:SetChecked(WIM_Data.popCombat);
62 WIM_OptionsTabbedFrameGeneralPopOnSend:SetChecked(WIM_Data.popOnSend);
63  
64 --[ Window Settings
65 WIM_OptionsTabbedFrameWindowWindowWidthTitle:SetText("Window Width");
66 WIM_OptionsTabbedFrameWindowWindowWidth:SetValue(WIM_Data.winSize.width);
67 WIM_OptionsTabbedFrameWindowWindowHeightTitle:SetText("Window Height");
68 WIM_OptionsTabbedFrameWindowWindowHeight:SetValue(WIM_Data.winSize.height);
69 WIM_OptionsTabbedFrameWindowWindowCascade:SetChecked(WIM_Data.winCascade.enabled);
70  
71 --[ Filter Settings
72 WIM_OptionsTabbedFrameFilterAliasEnabled:SetChecked(WIM_Data.enableAlias);
73 WIM_OptionsTabbedFrameFilterFilteringEnabled:SetChecked(WIM_Data.enableFilter);
74 WIM_OptionsTabbedFrameFilterAliasShowAsComment:SetChecked(WIM_Data.aliasAsComment);
75  
76 --[ History
77 WIM_OptionsTabbedFrameHistoryEnabled:SetChecked(WIM_Data.enableHistory);
78 WIM_OptionsTabbedFrameHistoryRecordEveryone:SetChecked(WIM_Data.historySettings.recordEveryone);
79 WIM_OptionsTabbedFrameHistoryRecordFriends:SetChecked(WIM_Data.historySettings.recordFriends);
80 WIM_OptionsTabbedFrameHistoryRecordGuild:SetChecked(WIM_Data.historySettings.recordGuild);
81 WIM_Options_HistoryRecordEveryoneClicked();
82 WIM_Options_CurrentSwatch = "WIM_OptionsTabbedFrameHistoryColorIn";
83 tRGB = WIM_Data.historySettings.colorIn;
84 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
85 WIM_Options_CurrentSwatch = "WIM_OptionsTabbedFrameHistoryColorOut";
86 tRGB = WIM_Data.historySettings.colorOut;
87 WIM_Options_UpdateSwatchColor(tRGB.r, tRGB.g, tRGB.b);
88 WIM_OptionsTabbedFrameHistoryShowInMessage:SetChecked(WIM_Data.historySettings.popWin.enabled);
89 WIM_OptionsTabbedFrameHistorySetMaxToStore:SetChecked(WIM_Data.historySettings.maxMsg.enabled);
90 WIM_OptionsTabbedFrameHistorySetAutoDelete:SetChecked(WIM_Data.historySettings.autoDelete.enabled);
91 --[ Other
92  
93 WIM_Options_ShowShortcutBarClicked();
94 WIM_HistoryScrollBar_Update();
95  
96 if(not WIM_Options_AlreadyShown) then
97 WIM_Options_General_Click();
98 WIM_Options_AlreadyShown = true;
99 end
100 end
101  
102  
103 function WIM_Options_ShowMiniMapClick()
104 if(WIM_OptionsMiniMapEnabled:GetChecked()) then
105 WIM_Data.showMiniMap = true;
106 if(WIM_Data.miniFreeMoving.enabled) then
107 WIM_IconFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT",WIM_Data.miniFreeMoving.left,WIM_Data.miniFreeMoving.top);
108 WIM_IconFrame:Show();
109 return;
110 end
111 else
112 WIM_Data.showMiniMap = false;
113 end
114 WIM_Icon_UpdatePosition();
115 end
116  
117 function WIM_Options_OpenColorPicker(button)
118 CloseMenus();
119 WIM_Options_CurrentSwatch = button:GetName();
120 ColorPickerFrame.hasOpacity = false;
121 ColorPickerFrame.func = WIM_Options_ColorPickerChanged;
122 ColorPickerFrame:SetColorRGB(button.r, button.g, button.b);
123 ColorPickerFrame.previousValues = {button.r, button.g, button.b};
124 ColorPickerFrame.cancelFunc = WIM_Options_ColorPickerCanceled;
125 ColorPickerFrame:SetFrameStrata("DIALOG");
126 ColorPickerFrame:Show();
127 end
128  
129 function WIM_Options_ColorPickerChanged()
130 local r,g,b = ColorPickerFrame:GetColorRGB();
131 WIM_Options_UpdateSwatchColor(r,g,b);
132 end
133  
134 function WIM_Options_ColorPickerCanceled(prevvals)
135 local r,g,b = unpack(prevvals)
136 WIM_Options_UpdateSwatchColor(r,g,b);
137 end
138  
139  
140 function WIM_Options_UpdateSwatchColor(r,g,b)
141 if(WIM_Options_CurrentSwatch == "WIM_OptionsDisplayIncomingWisp") then
142 WIM_Data.displayColors.wispIn.r = r;
143 WIM_Data.displayColors.wispIn.g = g;
144 WIM_Data.displayColors.wispIn.b = b;
145 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsDisplayOutgoingWisp") then
146 WIM_Data.displayColors.wispOut.r = r;
147 WIM_Data.displayColors.wispOut.g = g;
148 WIM_Data.displayColors.wispOut.b = b;
149 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsDisplaySystemMessage") then
150 WIM_Data.displayColors.sysMsg.r = r;
151 WIM_Data.displayColors.sysMsg.g = g;
152 WIM_Data.displayColors.sysMsg.b = b;
153 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsDisplayErrorMessage") then
154 WIM_Data.displayColors.errorMsg.r = r;
155 WIM_Data.displayColors.errorMsg.g = g;
156 WIM_Data.displayColors.errorMsg.b = b;
157 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsDisplayWebAddress") then
158 WIM_Data.displayColors.webAddress.r = r;
159 WIM_Data.displayColors.webAddress.g = g;
160 WIM_Data.displayColors.webAddress.b = b;
161 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsTabbedFrameHistoryColorIn") then
162 WIM_Data.historySettings.colorIn.r = r;
163 WIM_Data.historySettings.colorIn.g = g;
164 WIM_Data.historySettings.colorIn.b = b;
165 elseif(WIM_Options_CurrentSwatch == "WIM_OptionsTabbedFrameHistoryColorOut") then
166 WIM_Data.historySettings.colorOut.r = r;
167 WIM_Data.historySettings.colorOut.g = g;
168 WIM_Data.historySettings.colorOut.b = b;
169 end
170  
171 getglobal(WIM_Options_CurrentSwatch).r = r;
172 getglobal(WIM_Options_CurrentSwatch).g = g;
173 getglobal(WIM_Options_CurrentSwatch).b = b;
174 getglobal(WIM_Options_CurrentSwatch.."_ColorSwatchNormalTexture"):SetVertexColor(r,g,b);
175 end
176  
177 function WIM_Options_General_Click()
178 PanelTemplates_SelectTab(WIM_OptionsOptionTab1);
179 PanelTemplates_DeselectTab(WIM_OptionsOptionTab2);
180 PanelTemplates_DeselectTab(WIM_OptionsOptionTab3);
181 PanelTemplates_DeselectTab(WIM_OptionsOptionTab4);
182 WIM_OptionsTabbedFrameGeneral:Show();
183 WIM_OptionsTabbedFrameWindow:Hide();
184 WIM_OptionsTabbedFrameFilter:Hide();
185 WIM_OptionsTabbedFrameHistory:Hide();
186 end
187  
188 function WIM_Options_Windows_Click()
189 PanelTemplates_SelectTab(WIM_OptionsOptionTab2);
190 PanelTemplates_DeselectTab(WIM_OptionsOptionTab1);
191 PanelTemplates_DeselectTab(WIM_OptionsOptionTab3);
192 PanelTemplates_DeselectTab(WIM_OptionsOptionTab4);
193 WIM_OptionsTabbedFrameGeneral:Hide();
194 WIM_OptionsTabbedFrameFilter:Hide();
195 WIM_OptionsTabbedFrameHistory:Hide();
196 WIM_OptionsTabbedFrameWindow:Show();
197 end
198  
199 function WIM_Options_Filter_Click()
200 PanelTemplates_SelectTab(WIM_OptionsOptionTab3);
201 PanelTemplates_DeselectTab(WIM_OptionsOptionTab1);
202 PanelTemplates_DeselectTab(WIM_OptionsOptionTab2);
203 PanelTemplates_DeselectTab(WIM_OptionsOptionTab4);
204 WIM_OptionsTabbedFrameGeneral:Hide();
205 WIM_OptionsTabbedFrameWindow:Hide();
206 WIM_OptionsTabbedFrameHistory:Hide();
207 WIM_OptionsTabbedFrameFilter:Show();
208 end
209  
210 function WIM_Options_History_Click()
211 PanelTemplates_SelectTab(WIM_OptionsOptionTab4);
212 PanelTemplates_DeselectTab(WIM_OptionsOptionTab1);
213 PanelTemplates_DeselectTab(WIM_OptionsOptionTab2);
214 PanelTemplates_DeselectTab(WIM_OptionsOptionTab3);
215 WIM_OptionsTabbedFrameGeneral:Hide();
216 WIM_OptionsTabbedFrameWindow:Hide();
217 WIM_OptionsTabbedFrameFilter:Hide();
218 WIM_OptionsTabbedFrameHistory:Show();
219 end
220  
221 function WIM_Options_SupressWispsClicked()
222 if(WIM_OptionsTabbedFrameGeneralSupress:GetChecked()) then
223 WIM_Data.supressWisps = true;
224 else
225 WIM_Data.supressWisps = false;
226 end
227 end
228  
229 function WIM_Options_KeepFocusClicked()
230 if(WIM_OptionsTabbedFrameGeneralKeepFocus:GetChecked()) then
231 WIM_Data.keepFocus = true;
232 else
233 WIM_Data.keepFocus = false;
234 end
235 end
236  
237 function WIM_Options_AutoFocusClicked()
238 if(WIM_OptionsTabbedFrameGeneralAutoFocus:GetChecked()) then
239 WIM_Data.autoFocus = true;
240 else
241 WIM_Data.autoFocus = false;
242 end
243 end
244  
245 function WIM_Options_PopNewClicked()
246 if(WIM_OptionsTabbedFrameGeneralPopNew:GetChecked()) then
247 WIM_Data.popNew = true;
248 WIM_OptionsTabbedFrameGeneralPopUpdate:Enable();
249 WIM_OptionsTabbedFrameGeneralPopCombat:Enable();
250 else
251 WIM_Data.popNew = false;
252 WIM_OptionsTabbedFrameGeneralPopUpdate:Disable();
253 WIM_OptionsTabbedFrameGeneralPopCombat:Disable();
254 end
255 end
256  
257 function WIM_Options_PopUpdateClicked()
258 if(WIM_OptionsTabbedFrameGeneralPopUpdate:GetChecked()) then
259 WIM_Data.popUpdate = true;
260 else
261 WIM_Data.popUpdate = false;
262 end
263 end
264  
265 function WIM_Options_PopOnSendClicked()
266 if(WIM_OptionsTabbedFrameGeneralPopOnSend:GetChecked()) then
267 WIM_Data.popOnSend = true;
268 else
269 WIM_Data.popOnSend = false;
270 end
271 end
272  
273 function WIM_Options_PlaySoundWispClicked()
274 if(WIM_OptionsTabbedFrameGeneralPlaySoundWisp:GetChecked()) then
275 WIM_Data.playSoundWisp = true;
276 else
277 WIM_Data.playSoundWisp = false;
278 end
279 end
280  
281 function WIM_Options_ShowToolTipsClicked()
282 if(WIM_OptionsTabbedFrameGeneralShowToolTips:GetChecked()) then
283 WIM_Data.showToolTips = true;
284 else
285 WIM_Data.showToolTips = false;
286 end
287 end
288  
289 function WIM_Options_SortOrderAlphaClicked()
290 if(WIM_OptionsTabbedFrameGeneralSortOrderAlpha:GetChecked()) then
291 WIM_Data.sortAlpha = true;
292 else
293 WIM_Data.sortAlpha = false;
294 end
295 WIM_Icon_DropDown_Update();
296 end
297  
298 function WIM_Options_FreeMoving_Clicked()
299 if(WIM_OptionsMiniMapFreeMoving:GetChecked()) then
300 WIM_Data.miniFreeMoving.enabled = true;
301 WIM_Data.miniFreeMoving.left = WIM_IconFrame:GetLeft();
302 WIM_Data.miniFreeMoving.top = WIM_IconFrame:GetTop();
303 WIM_IconFrame:ClearAllPoints();
304 WIM_IconFrame:SetFrameStrata("HIGH");
305 WIM_IconFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", WIM_Data.miniFreeMoving.left, WIM_Data.miniFreeMoving.top);
306 else
307 WIM_IconFrame:SetFrameStrata("LOW");
308 WIM_Data.miniFreeMoving.enabled = false;
309 WIM_Icon_UpdatePosition();
310 end
311 end
312  
313 function WIM_Options_PopCombatClicked()
314 if(WIM_OptionsTabbedFrameGeneralPopCombat:GetChecked()) then
315 WIM_Data.popCombat = true;
316 else
317 WIM_Data.popCombat = false;
318 end
319 end
320  
321 function WIM_Options_CharacerInfoClicked()
322 if(WIM_OptionsDisplayShowCharacterInfo:GetChecked()) then
323 WIM_Data.characterInfo.show = true;
324 WIM_OptionsDisplayShowCharacterInfoClassIcon:Enable();
325 WIM_OptionsDisplayShowCharacterInfoClassColor:Enable();
326 else
327 WIM_Data.characterInfo.show = false;
328 WIM_OptionsDisplayShowCharacterInfoClassIcon:Disable();
329 WIM_OptionsDisplayShowCharacterInfoClassColor:Disable();
330 end
331 end
332  
333 function WIM_Options_CharacerInfoClassIconClicked()
334 if(WIM_OptionsDisplayShowCharacterInfoClassIcon:GetChecked()) then
335 WIM_Data.characterInfo.classIcon = true;
336 else
337 WIM_Data.characterInfo.classIcon = false;
338 end
339 end
340  
341 function WIM_Options_CharacerInfoClassColorClicked()
342 if(WIM_OptionsDisplayShowCharacterInfoClassColor:GetChecked()) then
343 WIM_Data.characterInfo.classColor = true;
344 else
345 WIM_Data.characterInfo.classColor = false;
346 end
347 end
348  
349 function WIM_Options_CharacerInfoDetailsClicked()
350 if(WIM_OptionsDisplayShowCharacterInfoDetails:GetChecked()) then
351 WIM_Data.characterInfo.details = true;
352 else
353 WIM_Data.characterInfo.details = false;
354 end
355 end
356  
357 function WIM_Options_ShowTimeStampsClicked()
358 if(WIM_OptionsDisplayShowTimeStamps:GetChecked()) then
359 WIM_Data.showTimeStamps = true;
360 else
361 WIM_Data.showTimeStamps = false;
362 end
363 end
364  
365 function WIM_Options_EnableWIMClicked()
366 if(WIM_OptionsEnableWIM:GetChecked()) then
367 WIM_Data.enableWIM = true;
368 else
369 WIM_Data.enableWIM = false;
370 end
371 WIM_SetWIM_Enabled(WIM_Data.enableWIM);
372 end
373  
374 function WIM_Options_ShowShortcutBarClicked()
375 if(WIM_OptionsDisplayShowShortcutBar:GetChecked()) then
376 WIM_Data.showShortcutBar = true;
377 WIM_OptionsTabbedFrameWindowWindowHeightTitle:SetText("Window Height |cffffffff(Limited by shortcut bar)|r");
378 else
379 WIM_Data.showShortcutBar = false;
380 WIM_OptionsTabbedFrameWindowWindowHeightTitle:SetText("Window Height");
381 end
382 WIM_SetAllWindowProps();
383 end
384  
385 function WIM_AliasScrollBar_Update()
386 local line;
387 local lineplusoffset;
388 local AliasNames = {};
389  
390 for key in WIM_Alias do
391 table.insert(AliasNames, key);
392 end
393  
394 FauxScrollFrame_Update(WIM_OptionsTabbedFrameFilterAliasPanelScrollBar,table.getn(AliasNames),5,16);
395 for line=1,5 do
396 lineplusoffset = line + FauxScrollFrame_GetOffset(WIM_OptionsTabbedFrameFilterAliasPanelScrollBar);
397 if (lineplusoffset <= table.getn(AliasNames)) then
398 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line.."Name"):SetText(AliasNames[lineplusoffset]);
399 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line.."Alias"):SetText(WIM_Alias[AliasNames[lineplusoffset]]);
400 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line).theAliasName = AliasNames[lineplusoffset];
401 if ( WIM_Alias_Selected == AliasNames[lineplusoffset] ) then
402 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line):LockHighlight();
403 else
404 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line):UnlockHighlight();
405 end
406 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line):Show();
407 else
408 getglobal("WIM_OptionsTabbedFrameFilterAliasPanelButton"..line):Hide();
409 end
410 end
411  
412 end
413  
414 function WIM_Options_AliasWindow_Click()
415 local name = WIM_Options_AliasWindow_Name:GetText();
416 local alias = WIM_Options_AliasWindow_Alias:GetText();
417  
418 name = string.gsub(name, " ", "");
419 name = string.gsub(name, "^%l", string.upper)
420 alias = string.gsub(alias, " ", "");
421  
422 if(name == "") then
423 WIM_Options_AliasWindow_Error:SetText("ERROR: Invalid name!");
424 return;
425 end
426 if(alias == "") then
427 WIM_Options_AliasWindow_Error:SetText("ERROR: Invalid alias!");
428 return;
429 end
430 if(WIM_Options_AliasWindow.theMode == "add" and WIM_Alias[name] ~= nil) then
431 WIM_Options_AliasWindow_Error:SetText("ERROR: Name is already used!");
432 return;
433 end
434  
435 WIM_Alias[name] = alias;
436  
437 if(WIM_Options_AliasWindow.theMode == "edit" and name ~= WIM_Options_AliasWindow.prevName)then
438 WIM_Alias[WIM_Options_AliasWindow.prevName] = nil;
439 end
440  
441  
442 WIM_AliasScrollBar_Update();
443 PlaySound("igMainMenuClose");
444 WIM_Options_AliasWindow:Hide();
445 end
446  
447  
448 function WIM_Options_AliasEnabledClicked()
449 if(WIM_OptionsTabbedFrameFilterAliasEnabled:GetChecked()) then
450 WIM_Data.enableAlias = true;
451 else
452 WIM_Data.enableAlias = false;
453 end
454 end
455  
456 function WIM_Options_FilteringEnabledClicked()
457 if(WIM_OptionsTabbedFrameFilterFilteringEnabled:GetChecked()) then
458 WIM_Data.enableFilter = true;
459 else
460 WIM_Data.enableFilter = false;
461 end
462 end
463  
464 function WIM_FilteringScrollBar_Update()
465 local line;
466 local lineplusoffset;
467 local FilteringNames = {};
468  
469 for key in WIM_Filters do
470 table.insert(FilteringNames, key);
471 end
472  
473 FauxScrollFrame_Update(WIM_OptionsTabbedFrameFilterFilteringPanelScrollBar,table.getn(FilteringNames),5,16);
474 for line=1,5 do
475 lineplusoffset = line + FauxScrollFrame_GetOffset(WIM_OptionsTabbedFrameFilterFilteringPanelScrollBar);
476 if lineplusoffset <= table.getn(FilteringNames) then
477 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line.."Name"):SetText(FilteringNames[lineplusoffset]);
478 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line.."Action"):SetText(WIM_Filters[FilteringNames[lineplusoffset]]);
479 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line).theFilterName = FilteringNames[lineplusoffset];
480 if ( WIM_Filter_Selected == FilteringNames[lineplusoffset] ) then
481 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line):LockHighlight();
482 else
483 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line):UnlockHighlight();
484 end
485 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line):Show();
486 else
487 getglobal("WIM_OptionsTabbedFrameFilterFilteringPanelButton"..line):Hide();
488 end
489 end
490  
491 end
492  
493  
494 function WIM_Options_FilteringIgnoreClicked()
495 if(WIM_Options_FilterWindow_ActionIgnore:GetChecked()) then
496 WIM_Options_FilterWindow.theAction = "Ignore";
497 WIM_Options_FilterWindow_ActionBlock:SetChecked(false);
498 else
499 WIM_Options_FilterWindow_ActionBlock:SetChecked(true);
500 end
501 end
502  
503 function WIM_Options_FilteringBlockClicked()
504 if(WIM_Options_FilterWindow_ActionBlock:GetChecked()) then
505 WIM_Options_FilterWindow.theAction = "Block";
506 WIM_Options_FilterWindow_ActionIgnore:SetChecked(false);
507 else
508 WIM_Options_FilterWindow_ActionIgnore:SetChecked(true);
509 end
510 end
511  
512 function WIM_Options_FilterWindow_Click()
513 local name = WIM_Options_FilterWindow_Name:GetText();
514 local action = WIM_Options_FilterWindow.theAction;
515  
516 local tname = string.gsub(name, " ", "");
517  
518 if(tname == "") then
519 WIM_Options_FilterWindow_Error:SetText("ERROR: Invalid Keyword/Phrase!");
520 return;
521 end
522 if(WIM_Options_FilterWindow.theMode == "add" and WIM_Filters[name] ~= nil) then
523 WIM_Options_FilterWindow_Error:SetText("ERROR: Keyword/Phrase is already used!");
524 return;
525 end
526  
527 WIM_Filters[name] = action;
528  
529 if(WIM_Options_FilterWindow.theMode == "edit" and name ~= WIM_Options_FilterWindow.prevName)then
530 WIM_Filters[WIM_Options_FilterWindow.prevName] = nil;
531 end
532  
533 WIM_FilteringScrollBar_Update();
534 PlaySound("igMainMenuClose");
535 WIM_Options_FilterWindow:Hide();
536 end
537  
538 function WIM_Options_AliasShowAsCommentClicked()
539 if(WIM_OptionsTabbedFrameFilterAliasShowAsComment:GetChecked()) then
540 WIM_Data.aliasAsComment = true;
541 else
542 WIM_Data.aliasAsComment = false;
543 end
544 end
545  
546 function WIM_Options_HistoryEnabledClicked()
547 if(WIM_OptionsTabbedFrameHistoryEnabled:GetChecked()) then
548 WIM_Data.enableHistory = true;
549 else
550 WIM_Data.enableHistory = false;
551 end
552 end
553  
554 function WIM_Options_HistoryRecordEveryoneClicked()
555 if(WIM_OptionsTabbedFrameHistoryRecordEveryone:GetChecked()) then
556 WIM_Data.historySettings.recordEveryone = true;
557 WIM_OptionsTabbedFrameHistoryRecordFriends:Disable();
558 WIM_OptionsTabbedFrameHistoryRecordGuild:Disable();
559 else
560 WIM_Data.historySettings.recordEveryone = false;
561 WIM_OptionsTabbedFrameHistoryRecordFriends:Enable();
562 WIM_OptionsTabbedFrameHistoryRecordGuild:Enable();
563 end
564 end
565  
566 function WIM_Options_HistoryRecordFriendsClicked()
567 if(WIM_OptionsTabbedFrameHistoryRecordFriends:GetChecked()) then
568 WIM_Data.historySettings.recordFriends = true;
569 else
570 WIM_Data.historySettings.recordFriends = false;
571 end
572 end
573  
574 function WIM_Options_HistoryRecordGuildClicked()
575 if(WIM_OptionsTabbedFrameHistoryRecordGuild:GetChecked()) then
576 WIM_Data.historySettings.recordGuild = true;
577 else
578 WIM_Data.historySettings.recordGuild = false;
579 end
580 end
581  
582 function WIM_Options_HistoryShowInMessageClicked()
583 if(WIM_OptionsTabbedFrameHistoryShowInMessage:GetChecked()) then
584 WIM_Data.historySettings.popWin.enabled = true;
585 else
586 WIM_Data.historySettings.popWin.enabled = false;
587 end
588 end
589  
590 function WIM_Options_HistorySetMaxToStoreClicked()
591 if(WIM_OptionsTabbedFrameHistorySetMaxToStore:GetChecked()) then
592 WIM_Data.historySettings.maxMsg.enabled = true;
593 else
594 WIM_Data.historySettings.maxMsg.enabled = false;
595 end
596 end
597  
598 function WIM_Options_HistorySetAutoDeleteClicked()
599 if(WIM_OptionsTabbedFrameHistorySetAutoDelete:GetChecked()) then
600 WIM_Data.historySettings.autoDelete.enabled = true;
601 else
602 WIM_Data.historySettings.autoDelete.enabled = false;
603 end
604 end
605  
606 function WIM_Options_HistoryMessageCount_OnShow()
607 UIDropDownMenu_Initialize(this, WIM_Options_HistoryMessageCount_Initialize);
608 UIDropDownMenu_SetSelectedValue(this, WIM_Data.historySettings.popWin.count);
609 UIDropDownMenu_SetWidth(60, WIM_OptionsTabbedFrameHistoryMessageCount);
610 end
611  
612 function WIM_Options_HistoryMessageCount_Initialize()
613 local info = {};
614 info = { };
615 info.text = "1";--.." "; --[spaces for quick width fix
616 info.value = 1;
617 info.justifyH = "LEFT";
618 info.func = WIM_Options_HistoryMessageClick;
619 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
620  
621 info = { };
622 info.text = "5";
623 info.value = 5;
624 info.justifyH = "LEFT";
625 info.func = WIM_Options_HistoryMessageClick;
626 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
627  
628 info = { };
629 info.text = "10";
630 info.value = 10;
631 info.justifyH = "LEFT";
632 info.func = WIM_Options_HistoryMessageClick;
633 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
634  
635 info = { };
636 info.text = "25";
637 info.value = 25;
638 info.justifyH = "LEFT";
639 info.func = WIM_Options_HistoryMessageClick;
640 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
641  
642 info = { };
643 info.text = "50";
644 info.value = 50;
645 info.justifyH = "LEFT";
646 info.func = WIM_Options_HistoryMessageClick;
647 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
648 end
649  
650 function WIM_Options_HistoryMessageClick()
651 WIM_Data.historySettings.popWin.count = this.value;
652 UIDropDownMenu_SetSelectedValue(WIM_OptionsTabbedFrameHistoryMessageCount, WIM_Data.historySettings.popWin.count);
653 end
654  
655 function WIM_Options_HistoryMaxCount_OnShow()
656 UIDropDownMenu_Initialize(this, WIM_Options_HistoryMaxCount_Initialize);
657 UIDropDownMenu_SetSelectedValue(this, WIM_Data.historySettings.maxMsg.count);
658 UIDropDownMenu_SetWidth(60, WIM_OptionsTabbedFrameHistoryMaxCount);
659 end
660  
661 function WIM_Options_HistoryMaxCount_Initialize()
662 local info = {};
663 info = { };
664 info.text = "50";--.." "; --[spaces for quick width fix
665 info.value = 50;
666 info.justifyH = "LEFT";
667 info.func = WIM_Options_HistoryMaxClick;
668 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
669  
670 info = { };
671 info.text = "100";
672 info.value = 100;
673 info.justifyH = "LEFT";
674 info.func = WIM_Options_HistoryMaxClick;
675 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
676  
677 info = { };
678 info.text = "200";
679 info.value = 200;
680 info.justifyH = "LEFT";
681 info.func = WIM_Options_HistoryMaxClick;
682 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
683  
684 info = { };
685 info.text = "300";
686 info.value = 300;
687 info.justifyH = "LEFT";
688 info.func = WIM_Options_HistoryMaxClick;
689 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
690  
691 info = { };
692 info.text = "400";
693 info.value = 400;
694 info.justifyH = "LEFT";
695 info.func = WIM_Options_HistoryMaxClick;
696 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
697  
698 info = { };
699 info.text = "500";
700 info.value = 500;
701 info.justifyH = "LEFT";
702 info.func = WIM_Options_HistoryMaxClick;
703 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
704 end
705  
706 function WIM_Options_HistoryMaxClick()
707 WIM_Data.historySettings.maxMsg.count = this.value;
708 UIDropDownMenu_SetSelectedValue(WIM_OptionsTabbedFrameHistoryMaxCount, WIM_Data.historySettings.maxMsg.count);
709 end
710  
711 function WIM_Options_HistoryAutoDeleteTime_OnShow()
712 UIDropDownMenu_Initialize(this, WIM_Options_HistoryAutoDeleteTime_Initialize);
713 UIDropDownMenu_SetSelectedValue(this, WIM_Data.historySettings.autoDelete.days);
714 UIDropDownMenu_SetWidth(75, WIM_OptionsTabbedFrameHistoryAutoDeleteTime);
715 end
716  
717 function WIM_Options_HistoryAutoDeleteTime_Initialize()
718 local info = {};
719 info = { };
720 info.text = "Day";--.." "; --[spaces for quick width fix
721 info.value = 1;
722 info.justifyH = "LEFT";
723 info.func = WIM_Options_HistoryAutoDeleteTimeClick;
724 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
725  
726 info = { };
727 info.text = "Week";
728 info.value = 7;
729 info.justifyH = "LEFT";
730 info.func = WIM_Options_HistoryAutoDeleteTimeClick;
731 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
732  
733 info = { };
734 info.text = "Month";
735 info.value = 30;
736 info.justifyH = "LEFT";
737 info.func = WIM_Options_HistoryAutoDeleteTimeClick;
738 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
739 end
740  
741 function WIM_Options_HistoryAutoDeleteTimeClick()
742 WIM_Data.historySettings.autoDelete.days = this.value;
743 UIDropDownMenu_SetSelectedValue(WIM_OptionsTabbedFrameHistoryAutoDeleteTime, WIM_Data.historySettings.autoDelete.days);
744 end
745  
746 function WIM_HistoryScrollBar_Update()
747 local line;
748 local lineplusoffset;
749 local HistoryNames = {};
750  
751 for key in WIM_History do
752 table.insert(HistoryNames, key);
753 end
754 table.sort(HistoryNames);
755  
756 FauxScrollFrame_Update(WIM_OptionsTabbedFrameHistoryPanelScrollBar,table.getn(HistoryNames),5,16);
757 for line=1,5 do
758 lineplusoffset = line + FauxScrollFrame_GetOffset(WIM_OptionsTabbedFrameHistoryPanelScrollBar);
759 if lineplusoffset <= table.getn(HistoryNames) then
760 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line.."Name"):SetText(HistoryNames[lineplusoffset]);
761 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line.."MessageCount"):SetText(table.getn(WIM_History[HistoryNames[lineplusoffset]]));
762 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line).theName = HistoryNames[lineplusoffset];
763 if ( WIM_History_Selected == HistoryNames[lineplusoffset] ) then
764 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line):LockHighlight();
765 else
766 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line):UnlockHighlight();
767 end
768 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line):Show();
769 else
770 getglobal("WIM_OptionsTabbedFrameHistoryPanelButton"..line):Hide();
771 end
772 end
773 end
774  
775 function WIM_Options_WindowAnchorToggle_Click()
776 if(WIM_WindowAnchor:IsVisible()) then
777 WIM_WindowAnchor:Hide();
778 GameTooltip:Hide();
779 else
780 WIM_WindowAnchor:SetPoint(
781 "TOPLEFT",
782 "UIParent",
783 "BOTTOMLEFT",
784 WIM_Data.winLoc.left,
785 WIM_Data.winLoc.top
786 );
787 WIM_WindowAnchor:Show();
788 GameTooltip:SetOwner(WIM_WindowAnchor, "ANCHOR_RIGHT");
789 GameTooltip:SetText("Drag to set default spawn\nposition for message windows.");
790 end
791 end
792  
793 function WIM_Options_WindowCascadeClicked()
794 if(WIM_OptionsTabbedFrameWindowWindowCascade:GetChecked()) then
795 WIM_Data.winCascade.enabled = true;
796 else
797 WIM_Data.winCascade.enabled = false;
798 end
799 end
800  
801 function WIM_Options_CascadeDirection_OnShow()
802 UIDropDownMenu_Initialize(this, WIM_Options_CascadeDirection_Initialize);
803 UIDropDownMenu_SetSelectedValue(this, WIM_Data.winCascade.direction);
804 UIDropDownMenu_SetWidth(100, WIM_OptionsTabbedFrameWindowCascadeDirection);
805 end
806  
807 function WIM_Options_CascadeDirection_Initialize()
808 local info = {};
809 info = { };
810 info.text = "Up";
811 info.value = "up";
812 info.justifyH = "LEFT";
813 info.func = WIM_Options_CascadeDirectionClick;
814 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
815  
816 info = { };
817 info.text = "Down";
818 info.value = "down";
819 info.justifyH = "LEFT";
820 info.func = WIM_Options_CascadeDirectionClick;
821 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
822  
823 info = { };
824 info.text = "Left";
825 info.value = "left";
826 info.justifyH = "LEFT";
827 info.func = WIM_Options_CascadeDirectionClick;
828 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
829  
830 info = { };
831 info.text = "Right";
832 info.value = "right";
833 info.justifyH = "LEFT";
834 info.func = WIM_Options_CascadeDirectionClick;
835 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
836  
837 info = { };
838 info.text = "Up & Left";
839 info.value = "upleft";
840 info.justifyH = "LEFT";
841 info.func = WIM_Options_CascadeDirectionClick;
842 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
843  
844 info = { };
845 info.text = "Up & Right";
846 info.value = "upright";
847 info.justifyH = "LEFT";
848 info.func = WIM_Options_CascadeDirectionClick;
849 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
850  
851 info = { };
852 info.text = "Down & Left";
853 info.value = "downleft";
854 info.justifyH = "LEFT";
855 info.func = WIM_Options_CascadeDirectionClick;
856 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
857  
858 info = { };
859 info.text = "Down & Right";
860 info.value = "downright";
861 info.justifyH = "LEFT";
862 info.func = WIM_Options_CascadeDirectionClick;
863 UIDropDownMenu_AddButton(info, UIDROPDOWNMENU_MENU_LEVEL);
864 end
865  
866 function WIM_Options_CascadeDirectionClick()
867 WIM_Data.winCascade.direction = this.value;
868 WIM_CascadeStep = 0;
869 UIDropDownMenu_SetSelectedValue(WIM_OptionsTabbedFrameWindowCascadeDirection, WIM_Data.winCascade.direction);
870 end
871  
872 function WIM_Help_Description_Click()
873 PanelTemplates_SelectTab(WIM_HelpTab1);
874 PanelTemplates_DeselectTab(WIM_HelpTab2);
875  
876 WIM_HelpScrollFrameScrollChildText:SetText(WIM_DESCRIPTION);
877 WIM_HelpScrollFrameScrollBar:SetValue(0);
878 WIM_HelpScrollFrame:UpdateScrollChildRect();
879 end
880  
881 function WIM_Help_ChangeLog_Click()
882 PanelTemplates_SelectTab(WIM_HelpTab2);
883 PanelTemplates_DeselectTab(WIM_HelpTab1);
884  
885 WIM_HelpScrollFrameScrollChildText:SetText(WIM_CHANGE_LOG);
886 WIM_HelpScrollFrameScrollBar:SetValue(0);
887 WIM_HelpScrollFrame:UpdateScrollChildRect();
888 end
889  
890