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