vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- Thanks Flaye for teaching me how to use xml
2  
3 UIPanelWindows["BGInviteUI"] = { area = "left", pushable = 3 };
4  
5 function BGInviteUI_OnLoad()
6 tinsert(UISpecialFrames,"BGInviteUI");
7 end
8  
9 function BGInviteUI_OnShow()
10 UIDropDownMenu_SetSelectedID(BGInviteOptionsFrameChannelDropDown, BGInvite_Config.MsgChannelId, BGINVITE_CHANNELS);
11 UIDropDownMenu_SetText(BGINVITE_CHANNELS[BGInvite_Config.MsgChannelId].name, BGInviteOptionsFrameChannelDropDown);
12 end
13  
14 function BGInviteOptionsFrame_AutoInvite_CheckBt_Update(whatValue)
15 if (whatValue == nil ) then
16 whatValue = 0;
17 end
18 BGInvite_Config.AutoInvite = whatValue;
19 end
20 function BGInviteOptionsFrame_AutoPurge_CheckBt_Update(whatValue)
21 if (whatValue == nil ) then
22 whatValue = 0;
23 end
24 BGInvite_Config.AutoPurge = whatValue;
25 end
26 function BGInviteOptionsFrame_SendWhisper_CheckBt_Update(whatValue)
27 if (whatValue == nil ) then
28 whatValue = 0;
29 end
30 BGInvite_Config.SendWhisper = whatValue;
31 end
32 function BGInviteOptionsFrame_Disable_CheckBt_Update(whatValue)
33 if (whatValue == nil ) then
34 whatValue = 0;
35 end
36 BGInvite_Config.Disable = whatValue;
37 end
38  
39 function BGInvite_CheckBoxCommand (command)
40 if (command == nil) then
41 return;
42 end
43 if (command == "autoinvite") then
44 if (BGvar_save.auto == "enabled") then
45 BGvar_save.auto = "disabled"
46 BGinvite_print(BGlocal_NOT_AUTO_INVITING)
47 else
48 BGvar_save.auto = "enabled"
49 BGinvite_print(BGlocal_AUTO_INVITING)
50 end
51 elseif (command == "autopurge") then
52 if (BGvar_save.purge == "enabled") then
53 BGvar_save.purge = "disabled"
54 BGinvite_print(BGlocal_NOT_PURGING)
55 else
56 BGvar_save.purge = "enabled"
57 BGinvite_print(BGlocal_NOW_PURGING)
58 end
59 end
60 end
61  
62 function BGInvite_GetNumber (boolean)
63 if (boolean == "enabled") then
64 return 1;
65 else
66 return 0;
67 end
68 end
69  
70 function BGinvite_CopyBlacklist()
71 BGvar_CopiedBlacklist = {}
72 table.foreach(BGvar_blacklist, BGinvite_CheckBlacklistNames)
73 end
74  
75 function BGinvite_CheckBlacklistNames(name)
76 if BGvar_blacklist[name] == 1 then
77 table.insert(BGvar_CopiedBlacklist, name)
78 end
79 end
80  
81  
82  
83 function BGinviteScrollBar_Update()
84 BGinvite_CopyBlacklist()
85 local line; -- 1 through 5 of our window to scroll
86 local lineplusoffset; -- an index into our data calculated from the scroll offset
87 FauxScrollFrame_Update(BGInviteScrollBar,table.getn(BGvar_CopiedBlacklist),7,40);
88 for line=1,7 do
89 local lineplusoffset = line + FauxScrollFrame_GetOffset(BGInviteScrollBar);
90 if lineplusoffset <= table.getn(BGvar_CopiedBlacklist) then
91 getglobal("BGInviteEntry"..line.."Text"):SetText(BGvar_CopiedBlacklist[lineplusoffset])
92 getglobal("BGInviteEntry"..line):Show()
93 else
94 getglobal("BGInviteEntry"..line):Hide()
95 end
96 end
97 end
98  
99 function BGInvite_RetryCooldown_Slider_Update(value)
100 BGInvite_Config.RetryTimeout = value;
101 end
102 function BGInvite_PurgeCooldown_Slider_Update(value)
103 BGInvite_Config.PurgeTimeout = value;
104 end
105 function BGInvite_MaxInvites_Slider_Update(value)
106 BGInvite_Config.MaxRetries = value;
107 end
108 function BGInvite_AutoInviteTimeout_Slider_Update(value)
109 BGInvite_Config.AutoInviteTimeout = value;
110 end
111  
112 --[[
113 =============================================================================
114 Callback methods for the DropDown Menu
115 =============================================================================
116 ]]
117 local function BGInviteOptionsFrameChannelDropDown_Initialize()
118 local info;
119 for i = 1, getn(BGINVITE_CHANNELS), 1 do
120 info = { };
121 info.text = BGINVITE_CHANNELS[i].name;
122 info.func = BGInvite_ChannelDropDownButton_OnClick;
123 UIDropDownMenu_AddButton(info);
124 end
125 end
126  
127 function BGInvite_ChannelDropDown_OnLoad()
128 UIDropDownMenu_Initialize(BGInviteOptionsFrameChannelDropDown, BGInviteOptionsFrameChannelDropDown_Initialize);
129 UIDropDownMenu_SetWidth(150);
130 UIDropDownMenu_SetButtonWidth(48);
131 UIDropDownMenu_JustifyText("RIGHT", BGInviteOptionsFrameChannelDropDown)
132 end
133  
134 function BGInvite_ChannelDropDownButton_OnClick()
135 UIDropDownMenu_SetSelectedID(BGInviteOptionsFrameChannelDropDown, this:GetID());
136 BGInvite_Config.MsgChannelId = UIDropDownMenu_GetSelectedID(BGInviteOptionsFrameChannelDropDown);
137 end