vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Handle all the option settings |
2 | |||
3 | FishingBuddy.OptionsFrame = {}; |
||
4 | |||
5 | FishingBuddy.CheckButton_OnShow = function() |
||
6 | this:SetChecked(FishingBuddy.GetSetting(this.name)); |
||
7 | getglobal(this:GetName().."Text"):SetText(this.text); |
||
8 | end |
||
9 | |||
10 | FishingBuddy.CheckButton_OnClick = function() |
||
11 | local value = 0; |
||
12 | if ( this:GetChecked() ) then |
||
13 | PlaySound("igMainMenuOptionCheckBoxOff"); |
||
14 | value = 1; |
||
15 | else |
||
16 | PlaySound("igMainMenuOptionCheckBoxOn"); |
||
17 | end |
||
18 | FishingBuddy.SetSetting(this.name, value); |
||
19 | end |
||
20 | |||
21 | FishingBuddy.CheckButton_OnEnter = function() |
||
22 | local tooltip = this.tooltip; |
||
23 | if ( tooltip ) then |
||
24 | GameTooltip:SetOwner(this, "ANCHOR_RIGHT"); |
||
25 | GameTooltip:SetText(tooltip, nil, nil, nil, nil, 1); |
||
26 | GameTooltip:Show(); |
||
27 | end |
||
28 | end |
||
29 | |||
30 | FishingBuddy.CheckButton_OnLeave = function() |
||
31 | GameTooltip:Hide(); |
||
32 | end |
||
33 | |||
34 | FishingBuddy.OptionsFrame.Setup = function() |
||
35 | for _, option in FishingBuddy.OPTIONS do |
||
36 | local button = getglobal("FishingBuddyOption_"..option.name); |
||
37 | if (button) then |
||
38 | local showthis = true; |
||
39 | if ( option.check ) then |
||
40 | showthis = option.check(); |
||
41 | end |
||
42 | if ( showthis ) then |
||
43 | button:Show(); |
||
44 | button.name = option.name; |
||
45 | button.text = option.text; |
||
46 | button.tooltip = option.tooltip; |
||
47 | else |
||
48 | button:Hide(); |
||
49 | end |
||
50 | end |
||
51 | end |
||
52 | |||
53 | if ( FishingBuddy.UseButtonHole() ) then |
||
54 | FishingBuddyMinimapPosSlider:Hide(); |
||
55 | end |
||
56 | local gs = FishingBuddy.GetSetting; |
||
57 | FishingBuddy.OptionsFrame.SetKeyValue("EasyCastKeys", gs("EasyCastKeys")); |
||
58 | end |
||
59 | |||
60 | FishingBuddy.OptionsFrame.SetKeyValue = function(what, value) |
||
61 | local show = FishingBuddy.Keys[value]; |
||
62 | FishingBuddy.SetSetting(what, value); |
||
63 | local menu = getglobal("FishingBuddyOption_"..what); |
||
64 | if ( menu ) then |
||
65 | local label = getglobal("FishingBuddyOption_"..what.."Label"); |
||
66 | UIDropDownMenu_SetWidth(90, menu); |
||
67 | UIDropDownMenu_SetSelectedValue(menu, show); |
||
68 | UIDropDownMenu_SetText(show, menu); |
||
69 | label:SetText(FishingBuddy.KEYS_LABEL_TEXT); |
||
70 | end |
||
71 | end |
||
72 | |||
73 | FishingBuddy.OptionsFrame.LoadKeyMenu = function(what) |
||
74 | local info = {}; |
||
75 | local setting = FishingBuddy.GetSetting(what); |
||
76 | for value,label in FishingBuddy.Keys do |
||
77 | local v = value; |
||
78 | local w = what; |
||
79 | info.text = label; |
||
80 | info.func = function() FishingBuddy.OptionsFrame.SetKeyValue(w, v); end; |
||
81 | if ( setting == value ) then |
||
82 | info.checked = true; |
||
83 | else |
||
84 | info.checked = false; |
||
85 | end |
||
86 | UIDropDownMenu_AddButton(info); |
||
87 | end |
||
88 | end |
||
89 | |||
90 | FishingBuddy.OptionsFrame.MenuSetup = function(what) |
||
91 | UIDropDownMenu_Initialize(this, |
||
92 | function() |
||
93 | local w = what; |
||
94 | FishingBuddy.OptionsFrame.LoadKeyMenu(what); |
||
95 | end); |
||
96 | end |