vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Functions to implement slash commands for FlexBar
3 Last Modified
4 12/26/2004 Initial version
5 08/12/2005 Changed calls for FB_ReformGroups to either FB_ReformGroup or FB_DisbandAllGroups - Sherkhan
6 08/12/2005 Added Text3, ShadeText3, JustifyText3 Fields - Sherkhan
7 --]]
8  
9 local util = Utility_Class:New()
10 local nextcommand = 0;
11 local currentconfig = nil
12 local REQUIRED = true
13 local STRICT = true
14 local OPTIONAL = false
15 local NON_STRICT = false
16 local NO_DEFAULT = nil;
17  
18 function FB_Command_AddCommands(scmd)
19 -- Populate the command object, scmd, with the commands we want available
20 -- args are command, function, group, usage
21 scmd:AddCommand("info", FB_Command_ToggleButtonInfo, "misc",
22 "/Flexbar Info")
23  
24 scmd:AddCommand("scripts", FB_Command_Scripts, "misc",
25 "/Flexbar Scripts")
26  
27 scmd:AddCommand("events", FB_DisplayEventEditor, "misc",
28 "/Flexbar Events")
29  
30 scmd:AddCommand("perf", FB_Show_PerformanceOptions, "misc",
31 "/Flexbar Perf")
32  
33 scmd:AddCommand("autoitems", FB_DisplayAutoItems, "misc",
34 "/Flexbar AutoItems")
35  
36 scmd:AddCommand("options", FB_ShowGlobalOptions, "misc",
37 "/Flexbar Options")
38  
39 scmd:AddCommand("safeload", FB_Command_SafeLoad, "misc",
40 "/Flexbar SafeLoad State=<'on' | 'off'>")
41 scmd:AddParam("safeload","state",REQUIRED,STRICT,{"string"},{"on","On","off","Off"},NO_DEFAULT)
42  
43 scmd:AddCommand("loadprofile", FB_Command_LoadProfile, "misc",
44 "/Flexbar LoadProfile Profile='profile'")
45 scmd:AddParam("loadprofile","profile",REQUIRED,NON_STRICT,{"string"},nil,NO_DEFAULT)
46  
47 scmd:AddCommand("deleteprofile", FB_Command_DeleteProfile, "misc",
48 "/Flexbar DeleteProfile Profile='profile' confirm='yes'")
49 scmd:AddParam("deleteprofile","profile",REQUIRED,NON_STRICT,{"string"},nil,NO_DEFAULT)
50 scmd:AddParam("deleteprofile","confirm",REQUIRED,STRICT,{"string"},{"yes","Yes"}, nil)
51  
52 scmd:AddCommand("saveprofile", FB_Command_SaveProfile, "misc",
53 "/Flexbar SaveProfile Profile='profile'")
54 scmd:AddParam("saveprofile","profile",REQUIRED,NON_STRICT,{"string"},nil,NO_DEFAULT)
55  
56 scmd:AddCommand("listprofiles", FB_Command_ListProfiles, "misc",
57 "/FlexBar ListProfiles")
58  
59 scmd:AddCommand("remap", FB_Command_ReMap, "misc",
60 "/FlexBar ReMap Button=<buttons> Base=<id> [Reset='True']")
61 -- populate the parameter list for this command
62 -- arguments are: command, parameter name, required, strict, types, allowed, default
63 scmd:AddParam("remap","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
64 scmd:AddParam("remap","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
65 scmd:AddParam("remap","base" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=120}, nil)
66 scmd:AddParam("remap","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
67 scmd:AddParam("remap","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
68 scmd:AddParam("remap","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
69 scmd:AddParam("remap","target",OPTIONAL,NON_STRICT,nil,nil,nil)
70 scmd:AddParam("remap","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
71 scmd:AddParam("remap","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
72 scmd:AddParam("remap","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
73 scmd:AddParam("remap","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
74  
75 scmd:AddCommand("echo", FB_Command_Echo, "misc",
76 "/FlexBar Echo Button=<buttons> Base=<id> [Reset='True']")
77 -- populate the parameter list for this command
78 -- arguments are: command, parameter name, required, strict, types, allowed, default
79 scmd:AddParam("echo","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
80 scmd:AddParam("echo","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
81 scmd:AddParam("echo","base" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
82 scmd:AddParam("echo","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
83 scmd:AddParam("echo","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
84 scmd:AddParam("echo","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
85 scmd:AddParam("echo","target",OPTIONAL,NON_STRICT,nil,nil,nil)
86 scmd:AddParam("echo","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
87 scmd:AddParam("echo","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
88 scmd:AddParam("echo","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
89 scmd:AddParam("echo","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
90  
91 scmd:AddCommand("advanced", FB_Command_Advanced, "misc",
92 "/FlexBar Advanced Button=<buttons> state=<'on' | 'off'>")
93 -- populate the parameter list for this command
94 -- arguments are: command, parameter name, required, strict, types, allowed, default
95 scmd:AddParam("advanced","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
96 scmd:AddParam("advanced","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
97 scmd:AddParam("advanced","state" ,REQUIRED,NON_STRICT,{"string"},{"on","On","off","Off"}, nil)
98  
99 scmd:AddCommand("use", FB_Command_Use, "misc",
100 "/FlexBar Use Button=<buttons>")
101 -- populate the parameter list for this command
102 -- arguments are: command, parameter name, required, strict, types, allowed, default
103 scmd:AddParam("use","button",REQUIRED,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
104 scmd:AddParam("use","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
105 scmd:AddParam("use","target",OPTIONAL,NON_STRICT,nil,nil,nil)
106 scmd:AddParam("use","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
107 scmd:AddParam("use","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
108 scmd:AddParam("use","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
109 scmd:AddParam("use","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
110  
111 scmd:AddCommand("runscript", FB_Command_RunScript, "misc",
112 "/FlexBar RunScript Script='scriptname'")
113 -- populate the parameter list for this command
114 -- arguments are: command, parameter name, required, strict, types, allowed, default
115 scmd:AddParam("runscript","script",REQUIRED,NON_STRICT,{"string"},nil, nil)
116 scmd:AddParam("runscript","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
117 scmd:AddParam("runscript","target",OPTIONAL,NON_STRICT,nil,nil,nil)
118 scmd:AddParam("runscript","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
119 scmd:AddParam("runscript","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
120 scmd:AddParam("runscript","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
121 scmd:AddParam("runscript","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
122  
123 scmd:AddCommand("runmacro", FB_Command_RunMacro, "misc",
124 "/FlexBar RunMacro Macro='macroname'")
125 -- populate the parameter list for this command
126 -- arguments are: command, parameter name, required, strict, types, allowed, default
127 scmd:AddParam("runmacro","macro",REQUIRED,NON_STRICT,{"string","table"},nil, nil)
128 scmd:AddParam("runmacro","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
129 scmd:AddParam("runmacro","target",OPTIONAL,NON_STRICT,nil,nil,nil)
130 scmd:AddParam("runmacro","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
131 scmd:AddParam("runmacro","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
132 scmd:AddParam("runmacro","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
133 scmd:AddParam("runmacro","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
134  
135 scmd:AddCommand("resetall", FB_Command_ResetAll, "misc",
136 "/FlexBar ResetAll Confirm='yes'")
137 -- populate the parameter list for this command
138 -- arguments are: command, parameter name, required, strict, types, allowed, default
139 scmd:AddParam("resetall","confirm",REQUIRED,STRICT,{"string"},{"yes","Yes"}, nil)
140  
141 scmd:AddCommand("restore", FB_Command_Restore, "misc",
142 "/FlexBar Restore Confirm='yes'")
143 -- populate the parameter list for this command
144 -- arguments are: command, parameter name, required, strict, types, allowed, default
145 scmd:AddParam("restore","confirm",REQUIRED,STRICT,{"string"},{"yes","Yes"}, nil)
146  
147 scmd:AddCommand("loadconfig", FB_Command_LoadConfig, "misc",
148 "/FlexBar LoadConfig Config='ConfigName'")
149 -- populate the parameter list for this command
150 -- arguments are: command, parameter name, required, strict, types, allowed, default
151 scmd:AddParam("loadconfig","config",REQUIRED,NON_STRICT,{"string"},nil, nil)
152  
153 scmd:AddCommand("hidegrid", FB_Command_HideGrid, "misc",
154 "/FlexBar HideGrid Button=<buttons>")
155 scmd:AddParam("hidegrid","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
156 scmd:AddParam("hidegrid","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
157 scmd:AddParam("hidegrid","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
158  
159 scmd:AddCommand("showgrid", FB_Command_ShowGrid, "misc",
160 "/FlexBar ShowGrid Button=<buttons>")
161 scmd:AddParam("showgrid","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
162 scmd:AddParam("showgrid","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
163 scmd:AddParam("showgrid","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
164  
165 scmd:AddCommand("lockicon", FB_Command_LockIcon, "misc",
166 "/FlexBar LockIcon Button=<buttons> [Off='true']")
167 scmd:AddParam("lockicon","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
168 scmd:AddParam("lockicon","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
169 scmd:AddParam("lockicon","off" ,OPTIONAL,STRICT,{"string"},{"true", "True"},nil)
170  
171 scmd:AddCommand("text", FB_Command_Text, "misc",
172 "/FlexBar Text Button=<buttons> Text=<text>")
173 scmd:AddParam("text","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
174 scmd:AddParam("text","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
175 scmd:AddParam("text","text" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
176 scmd:AddParam("text","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
177 scmd:AddParam("text","target",OPTIONAL,NON_STRICT,nil,nil,nil)
178 scmd:AddParam("text","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
179 scmd:AddParam("text","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
180 scmd:AddParam("text","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
181 scmd:AddParam("text","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
182  
183 scmd:AddCommand("text2", FB_Command_Text2, "misc",
184 "/FlexBar Text2 Button=<buttons> Text=<text>")
185 scmd:AddParam("text2","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
186 scmd:AddParam("text2","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
187 scmd:AddParam("text2","text" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
188 scmd:AddParam("text2","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
189 scmd:AddParam("text2","target",OPTIONAL,NON_STRICT,nil,nil,nil)
190 scmd:AddParam("text2","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
191 scmd:AddParam("text2","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
192 scmd:AddParam("text2","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
193 scmd:AddParam("text2","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
194  
195 scmd:AddCommand("text3", FB_Command_Text3, "misc",
196 "/FlexBar Text3 Button=<buttons> Text=<text>")
197 scmd:AddParam("text3","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
198 scmd:AddParam("text3","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
199 scmd:AddParam("text3","text" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
200 scmd:AddParam("text3","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
201 scmd:AddParam("text3","target",OPTIONAL,NON_STRICT,nil,nil,nil)
202 scmd:AddParam("text3","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
203 scmd:AddParam("text3","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
204 scmd:AddParam("text3","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
205 scmd:AddParam("text3","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
206  
207 scmd:AddCommand("justifytext", FB_Command_JustifyText, "misc",
208 "/FlexBar JustifyText Button=<buttons> Pos=<position>")
209 scmd:AddParam("justifytext","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
210 scmd:AddParam("justifytext","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
211 scmd:AddParam("justifytext","pos" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
212 scmd:AddParam("justifytext","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
213 scmd:AddParam("justifytext","target",OPTIONAL,NON_STRICT,nil,nil,nil)
214 scmd:AddParam("justifytext","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
215 scmd:AddParam("justifytext","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
216 scmd:AddParam("justifytext","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
217 scmd:AddParam("justifytext","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
218  
219 scmd:AddCommand("justifytext2", FB_Command_JustifyText2, "misc",
220 "/FlexBar Justifytext2 Button=<buttons> Pos=<position>")
221 scmd:AddParam("justifytext2","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
222 scmd:AddParam("justifytext2","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
223 scmd:AddParam("justifytext2","pos" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
224 scmd:AddParam("justifytext2","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
225 scmd:AddParam("justifytext2","target",OPTIONAL,NON_STRICT,nil,nil,nil)
226 scmd:AddParam("justifytext2","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
227 scmd:AddParam("justifytext2","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
228 scmd:AddParam("justifytext2","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
229 scmd:AddParam("justifytext2","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
230  
231 scmd:AddCommand("justifytext3", FB_Command_JustifyText3, "misc",
232 "/FlexBar Justifytext3 Button=<buttons> Pos=<position>")
233 scmd:AddParam("justifytext3","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
234 scmd:AddParam("justifytext3","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
235 scmd:AddParam("justifytext3","pos" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
236 scmd:AddParam("justifytext3","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
237 scmd:AddParam("justifytext3","target",OPTIONAL,NON_STRICT,nil,nil,nil)
238 scmd:AddParam("justifytext3","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
239 scmd:AddParam("justifytext3","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
240 scmd:AddParam("justifytext3","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
241 scmd:AddParam("justifytext3","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
242  
243 scmd:AddCommand("verbose", FB_Command_Verbose, "misc",
244 "/FlexBar Verbose State=<'on' | 'off'>")
245 scmd:AddParam("verbose","state",REQUIRED,STRICT,{"string"},{"on","On","Off","off"},"on")
246  
247 scmd:AddCommand("tooltip", FB_Command_Tooltip, "misc",
248 "/FlexBar Tooltip State=<'on' | 'off'>")
249 scmd:AddParam("tooltip","state",REQUIRED,STRICT,{"string"},{"on","On","Off","off"},"on")
250  
251 scmd:AddCommand("raise", FB_Command_Raise, "misc",
252 "/FlexBar Raise Event=<event> Source=<source> In=<seconds>")
253 -- populate the parameter list for this command
254 -- arguments are: command, parameter name, required, strict, types, allowed, default
255 scmd:AddParam("raise","event" ,REQUIRED,NON_STRICT,{"string"},NO_BOUNDS,NO_DEFAULT)
256 scmd:AddParam("raise","source",OPTIONAL,NON_STRICT,NO_TYPES,NO_BOUNDS,NO_DEFAULT)
257 scmd:AddParam("raise","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
258 scmd:AddParam("raise","target",OPTIONAL,NON_STRICT,nil,nil,nil)
259 scmd:AddParam("raise","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
260 scmd:AddParam("raise","in" ,OPTIONAL,STRICT,{"number"},{lowerbound=0},0)
261 scmd:AddParam("raise","name" ,REQUIRED,NON_STRICT,{"string"},nil,NO_DEFAULT)
262 scmd:AddParam("raise","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
263 scmd:AddParam("raise","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
264 scmd:AddParam("raise","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
265  
266 scmd:AddCommand("flexscript", FB_Command_FlexScript, "appearance",
267 "/FlexBar FlexScript ID=<ID> Texture='texture' Script='script' Name='Name' [Reset='true'] [Toggle='true']")
268 -- populate the parameter list for this command
269 -- arguments are: command, parameter name, required, strict, types, allowed, default
270 scmd:AddParam("flexscript","id" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
271 scmd:AddParam("flexscript","texture" ,REQUIRED,STRICT,{"string"},nil, "")
272 scmd:AddParam("flexscript","toggle" ,OPTIONAL,STRICT,{"string"},{"true"},nil)
273 scmd:AddParam("flexscript","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
274 scmd:AddParam("flexscript","name" ,REQUIRED,NON_STRICT,{"string"},nil,nil)
275 scmd:AddParam("flexscript","script",REQUIRED,NON_STRICT,{"string"},nil, nil)
276  
277 scmd:AddCommand("flexmacro", FB_Command_FlexMacro, "appearance",
278 "/FlexBar FlexMacro ID=<ID> Texture='texture' Macro='macro' Name='Name' [Reset='true'] [Toggle='true']")
279 -- populate the parameter list for this command
280 -- arguments are: command, parameter name, required, strict, types, allowed, default
281 scmd:AddParam("flexmacro","id" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
282 scmd:AddParam("flexmacro","texture" ,REQUIRED,STRICT,{"string"},nil, "")
283 scmd:AddParam("flexmacro","toggle" ,OPTIONAL,STRICT,{"string"},{"true"},nil)
284 scmd:AddParam("flexmacro","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
285 scmd:AddParam("flexmacro","name" ,REQUIRED,NON_STRICT,{"string"},nil,nil)
286 scmd:AddParam("flexmacro","macro",REQUIRED,NON_STRICT,{"string","table"},nil, nil)
287  
288 scmd:AddCommand("flexpet", FB_Command_FlexPet, "appearance",
289 "/FlexBar FlexPet ID=<ID> PetID=<petid> [Reset='true'] [Toggle='true']")
290 -- populate the parameter list for this command
291 -- arguments are: command, parameter name, required, strict, types, allowed, default
292 scmd:AddParam("flexpet","id" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
293 scmd:AddParam("flexpet","toggle" ,OPTIONAL,STRICT,{"string"},{"true"},nil)
294 scmd:AddParam("flexpet","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
295 scmd:AddParam("flexpet","petid" ,REQUIRED,NON_STRICT,{"number"},nil, nil)
296  
297 scmd:AddCommand("clearflex", FB_Command_ClearFlex, "appearance",
298 "/FlexBar ClearFlex ID=<ID>")
299 -- populate the parameter list for this command
300 -- arguments are: command, parameter name, required, strict, types, allowed, default
301 scmd:AddParam("clearflex","id" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
302  
303 scmd:AddCommand("disable", FB_Command_Disable, "misc",
304 "/FlexBar Disable Button=<buttons> state=<'on' | 'off'>")
305 -- populate the parameter list for this command
306 -- arguments are: command, parameter name, required, strict, types, allowed, default
307 scmd:AddParam("disable","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, NO_DEFAULT)
308 scmd:AddParam("disable","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, NO_DEFAULT)
309 scmd:AddParam("disable","state" ,REQUIRED,NON_STRICT,{"string"},{"on","On","off","Off"}, NO_DEFAULT)
310 scmd:AddParam("disable","toggle",OPTIONAL,STRICT,{"string"},{"true"},NO_DEFAULT)
311 scmd:AddParam("disable","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
312 scmd:AddParam("disable","target",OPTIONAL,NON_STRICT,nil,nil,nil)
313 scmd:AddParam("disable","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
314 scmd:AddParam("disable","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
315 scmd:AddParam("disable","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
316 scmd:AddParam("disable","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
317  
318 scmd:AddCommand("hide", FB_Command_Hide, "appearance",
319 "/FlexBar Hide Button=<buttons>")
320 -- arguments are: command, parameter name, required, strict, types, allowed, default
321 scmd:AddParam("hide","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
322 scmd:AddParam("hide","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
323 scmd:AddParam("hide","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
324 scmd:AddParam("hide","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
325 scmd:AddParam("hide","target",OPTIONAL,NON_STRICT,nil,nil,nil)
326 scmd:AddParam("hide","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
327 scmd:AddParam("hide","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
328 scmd:AddParam("hide","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
329 scmd:AddParam("hide","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
330  
331 scmd:AddCommand("show", FB_Command_Show, "appearance",
332 "/FlexBar Show Button=<buttons>")
333 scmd:AddParam("show","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
334 scmd:AddParam("show","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
335 scmd:AddParam("show","toggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
336 scmd:AddParam("show","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
337 scmd:AddParam("show","target",OPTIONAL,NON_STRICT,nil,nil,nil)
338 scmd:AddParam("show","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
339 scmd:AddParam("show","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
340 scmd:AddParam("show","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
341 scmd:AddParam("show","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
342  
343 scmd:AddCommand("fade", FB_Command_Fade, "appearance",
344 "/FlexBar Fade Button=<buttons> Alpha=<alpha>")
345 scmd:AddParam("fade","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
346 scmd:AddParam("fade","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
347 scmd:AddParam("fade","alpha" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=10},nil)
348 scmd:AddParam("fade","toggle",OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=10},nil)
349 scmd:AddParam("fade","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
350 scmd:AddParam("fade","target",OPTIONAL,NON_STRICT,nil,nil,nil)
351 scmd:AddParam("fade","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
352 scmd:AddParam("fade","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
353 scmd:AddParam("fade","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
354 scmd:AddParam("fade","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
355  
356 scmd:AddCommand("scale", FB_Command_Scale, "appearance",
357 "/FlexBar Scale Button=<buttons> Scale=<scale>")
358 scmd:AddParam("scale","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
359 scmd:AddParam("scale","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
360 scmd:AddParam("scale","scale" ,REQUIRED,STRICT,{"number"},{lowerbound=5,upperbound=50},nil)
361 scmd:AddParam("scale","toggle",OPTIONAL,STRICT,{"number"},{lowerbound=5,upperbound=50},nil)
362 scmd:AddParam("scale","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
363 scmd:AddParam("scale","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
364 scmd:AddParam("scale","target",OPTIONAL,NON_STRICT,nil,nil,nil)
365 scmd:AddParam("scale","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
366 scmd:AddParam("scale","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
367 scmd:AddParam("scale","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
368 scmd:AddParam("scale","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
369  
370 scmd:AddCommand("shade", FB_Command_Shade, "appearance",
371 "/FlexBar Shade Button=<buttons> Color=<[r g b]>")
372 scmd:AddParam("shade","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
373 scmd:AddParam("shade","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
374 scmd:AddParam("shade","color" ,REQUIRED,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
375 scmd:AddParam("shade","toggle",OPTIONAL,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
376 scmd:AddParam("shade","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
377 scmd:AddParam("shade","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
378 scmd:AddParam("shade","target",OPTIONAL,NON_STRICT,nil,nil,nil)
379 scmd:AddParam("shade","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
380 scmd:AddParam("shade","iftarg",OPTIONAL,NON_STRICT,nil,nil,nil)
381 scmd:AddParam("shade","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
382 scmd:AddParam("shade","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
383 scmd:AddParam("shade","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
384  
385 scmd:AddCommand("shadetext", FB_Command_ShadeText, "appearance",
386 "/FlexBar ShadeText Button=<buttons> Color=<[r g b]>")
387 scmd:AddParam("shadetext","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
388 scmd:AddParam("shadetext","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
389 scmd:AddParam("shadetext","color" ,REQUIRED,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
390 scmd:AddParam("shadetext","toggle",OPTIONAL,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
391 scmd:AddParam("shadetext","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
392 scmd:AddParam("shadetext","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
393 scmd:AddParam("shadetext","target",OPTIONAL,NON_STRICT,nil,nil,nil)
394 scmd:AddParam("shadetext","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
395 scmd:AddParam("shadetext","iftarg",OPTIONAL,NON_STRICT,nil,nil,nil)
396 scmd:AddParam("shadetext","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
397 scmd:AddParam("shadetext","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
398 scmd:AddParam("shadetext","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
399  
400 scmd:AddCommand("shadetext2", FB_Command_ShadeText2, "appearance",
401 "/FlexBar ShadeText2 Button=<buttons> Color=<[r g b]>")
402 scmd:AddParam("shadetext2","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
403 scmd:AddParam("shadetext2","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
404 scmd:AddParam("shadetext2","color" ,REQUIRED,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
405 scmd:AddParam("shadetext2","toggle",OPTIONAL,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
406 scmd:AddParam("shadetext2","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
407 scmd:AddParam("shadetext2","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
408 scmd:AddParam("shadetext2","target",OPTIONAL,NON_STRICT,nil,nil,nil)
409 scmd:AddParam("shadetext2","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
410 scmd:AddParam("shadetext2","iftarg",OPTIONAL,NON_STRICT,nil,nil,nil)
411 scmd:AddParam("shadetext2","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
412 scmd:AddParam("shadetext2","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
413 scmd:AddParam("shadetext2","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
414  
415 scmd:AddCommand("shadetext3", FB_Command_ShadeText3, "appearance",
416 "/FlexBar ShadeText3 Button=<buttons> Color=<[r g b]>")
417 scmd:AddParam("shadetext3","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
418 scmd:AddParam("shadetext3","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
419 scmd:AddParam("shadetext3","color" ,REQUIRED,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
420 scmd:AddParam("shadetext3","toggle",OPTIONAL,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
421 scmd:AddParam("shadetext3","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
422 scmd:AddParam("shadetext3","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
423 scmd:AddParam("shadetext3","target",OPTIONAL,NON_STRICT,nil,nil,nil)
424 scmd:AddParam("shadetext3","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
425 scmd:AddParam("shadetext3","iftarg",OPTIONAL,NON_STRICT,nil,nil,nil)
426 scmd:AddParam("shadetext3","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
427 scmd:AddParam("shadetext3","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
428 scmd:AddParam("shadetext3","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
429  
430 scmd:AddCommand("shadetooltip", FB_Command_ShadeToolTip, "appearance",
431 "/FlexBar ShadeToolTip Color=<[r g b]>")
432 scmd:AddParam("shadetext","color" ,REQUIRED,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
433 scmd:AddParam("shadetext","toggle",OPTIONAL,STRICT,{"number","table"},{lowerbound=0,upperbound=10},nil)
434 scmd:AddParam("shadetext","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
435 scmd:AddParam("shadetext","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
436 scmd:AddParam("shadetext","target",OPTIONAL,NON_STRICT,nil,nil,nil)
437 scmd:AddParam("shadetext","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
438 scmd:AddParam("shadetext","iftarg",OPTIONAL,NON_STRICT,nil,nil,nil)
439 scmd:AddParam("shadetext","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
440 scmd:AddParam("shadetext","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
441 scmd:AddParam("shadetext","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
442  
443  
444 scmd:AddCommand("settexture", FB_Command_SetTexture, "appearance",
445 "/FlexBar SetTexture Button=<button> Texture='texture' [Reset='True']")
446 -- populate the parameter list for this command
447 -- arguments are: command, parameter name, required, strict, types, allowed, default
448 scmd:AddParam("settexture","id" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
449 scmd:AddParam("settexture","texture" ,OPTIONAL,STRICT,{"string"},nil, "")
450 scmd:AddParam("settexture","toggle" ,OPTIONAL,STRICT,{"string"},{"true"},nil)
451 scmd:AddParam("settexture","reset" ,OPTIONAL,NON_STRICT,{"string"},{"true"},nil)
452 scmd:AddParam("settexture","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
453 scmd:AddParam("settexture","target" ,OPTIONAL,NON_STRICT,nil,nil,nil)
454 scmd:AddParam("settexture","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
455 scmd:AddParam("settexture","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
456 scmd:AddParam("settexture","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
457 scmd:AddParam("settexture","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
458  
459 scmd:AddCommand("lock", FB_Command_Lock, "movement",
460 "/FlexBar Lock Button=<buttons>")
461 scmd:AddParam("lock","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons},nil)
462 scmd:AddParam("lock","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons},nil)
463  
464 scmd:AddCommand("unlock", FB_Command_Unlock, "movement",
465 "/FlexBar Unlock Button=<buttons>")
466 scmd:AddParam("unlock","button",OPTIONAL,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons},nil)
467 scmd:AddParam("unlock","group" ,OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons},nil)
468  
469 scmd:AddCommand("moveabs", FB_Command_MoveABS, "movement",
470 "/FlexBar MoveABS Button=<button> XX=<x-coord> YY=<y-coord>")
471 scmd:AddParam("moveabs","button",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
472 scmd:AddParam("moveabs","xx" ,REQUIRED,STRICT,{"number"},nil,nil)
473 scmd:AddParam("moveabs","yy" ,REQUIRED,STRICT,{"number"},nil,nil)
474 scmd:AddParam("moveabs","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
475 scmd:AddParam("moveabs","target",OPTIONAL,NON_STRICT,nil,nil,nil)
476 scmd:AddParam("moveabs","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
477 scmd:AddParam("moveabs","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
478 scmd:AddParam("moveabs","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
479 scmd:AddParam("moveabs","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
480  
481 scmd:AddCommand("moverel", FB_Command_MoveRel, "movement",
482 "/FlexBar MoveRel Button=<button> trgBtn=<button> dX=<x-coord> dY=<y-coord>")
483 scmd:AddParam("moverel","button",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
484 scmd:AddParam("moverel","trgbtn",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
485 scmd:AddParam("moverel","dx" ,REQUIRED,STRICT,{"number"},nil,nil)
486 scmd:AddParam("moverel","dy" ,REQUIRED,STRICT,{"number"},nil,nil)
487 scmd:AddParam("moverel","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
488 scmd:AddParam("moverel","target",OPTIONAL,NON_STRICT,nil,nil,nil)
489 scmd:AddParam("moverel","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
490 scmd:AddParam("moverel","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
491 scmd:AddParam("moverel","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
492 scmd:AddParam("moverel","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
493  
494 scmd:AddCommand("movetomouse", FB_Command_MoveToMouse, "movement",
495 "/FlexBar MoveRel Button=<button> target=<button> dX=<x-coord> dY=<y-coord>")
496 scmd:AddParam("movetomouse","button",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
497 scmd:AddParam("movetomouse","dx" ,REQUIRED,STRICT,{"number"},nil,nil)
498 scmd:AddParam("movetomouse","dy" ,REQUIRED,STRICT,{"number"},nil,nil)
499 scmd:AddParam("movetomouse","on" ,OPTIONAL,NON_STRICT,{"string"},FBEventList,nil)
500 scmd:AddParam("movetomouse","target",OPTIONAL,NON_STRICT,nil,nil,nil)
501 scmd:AddParam("movetomouse","if" ,OPTIONAL,NON_STRICT,{"string"},FBConditionList,nil)
502 scmd:AddParam("movetomouse","in" ,OPTIONAL,NON_STRICT,{"number"},nil,nil)
503 scmd:AddParam("movetomouse","tname" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
504 scmd:AddParam("movetomouse","ttoggle",OPTIONAL,STRICT,{"string"},{"true"},nil)
505  
506 scmd:AddCommand("group", FB_Command_Group, "group",
507 "/FlexBar Group Button=<buttons> Anchor=<button>")
508 scmd:AddParam("group","button",REQUIRED,STRICT,{"number","table"},{lowerbound=1,upperbound=FBNumButtons}, nil)
509 scmd:AddParam("group","anchor",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons},nil)
510  
511 scmd:AddCommand("ungroup", FB_Command_Ungroup, "group",
512 "/FlexBar Ungroup Group=<group>")
513 scmd:AddParam("ungroup","group",REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
514  
515 scmd:AddCommand("circlegroup", FB_Command_CircleGroup, "group",
516 "/FlexBar CircleGroup Group=<group>")
517 scmd:AddParam("circlegroup","group" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
518 scmd:AddParam("circlegroup","padding",OPTIONAL,STRICT,{"number"},{lowerbound=0},0)
519  
520 scmd:AddCommand("horizontalgroup", FB_Command_HorizontalGroup, "group",
521 "/FlexBar HorizontalGroup Group=<group> Height=<height> Padding=<pixels>")
522 scmd:AddParam("horizontalgroup","group" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
523 scmd:AddParam("horizontalgroup","padding",OPTIONAL,STRICT,{"number"},{lowerbound=0},0)
524 scmd:AddParam("horizontalgroup","height" ,OPTIONAL,STRICT,{"number"},{lowerbound=1},1)
525  
526 scmd:AddCommand("verticalgroup", FB_Command_VerticalGroup, "group",
527 "/FlexBar VerticalGroup Group=<group> Width=<width> Padding=<pixels>")
528 scmd:AddParam("verticalgroup","group" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
529 scmd:AddParam("verticalgroup","padding",OPTIONAL,STRICT,{"number"},{lowerbound=0},0)
530 scmd:AddParam("verticalgroup","width" ,OPTIONAL,STRICT,{"number"},{lowerbound=1},1)
531  
532 scmd:AddCommand("menupopup", FB_Command_MenuPopUp, "group",
533 "/FlexBar MenuPopUp Group=<group> Trigger=<button> Align=<alignment> Texture=<texture> Height=<height> Width=<width> Padding=<pixels>")
534 scmd:AddParam("menupopup","group" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
535 scmd:AddParam("menupopup","trigger" ,REQUIRED,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons}, nil)
536 scmd:AddParam("menupopup","align" ,OPTIONAL,NON_STRICT,{"string"},nil,nil)
537 scmd:AddParam("menupopup","padding",OPTIONAL,STRICT,{"number"},{lowerbound=0},0)
538 scmd:AddParam("menupopup","height" ,OPTIONAL,STRICT,{"number"},{lowerbound=1},1)
539 scmd:AddParam("menupopup","width" ,OPTIONAL,STRICT,{"number"},{lowerbound=1},1)
540 scmd:AddParam("menupopup","texture" ,OPTIONAL,STRICT,{"string"},nil, "")
541  
542 scmd:AddCommand("listgroups", FB_Command_ListGroups, "group",
543 "/FlexBar ListGroups [Group=<groups>]")
544 scmd:AddParam("listgroups","group",OPTIONAL,STRICT,{"number"},{lowerbound=1,upperbound=FBNumButtons},nil)
545  
546 scmd:AddCommand("listevents", FB_Command_ListEvents, "events",
547 "/FlexBar ListEvents")
548  
549 scmd:AddCommand("deleteevent", FB_Command_DeleteEvent, "events",
550 "/FlexBar DeleteEvent event=<event number>")
551 scmd:AddParam("deleteevent","event",REQUIRED,STRICT,{"number"},{lowerbound=1},nil)
552  
553 scmd:AddCommand("mischelp", FB_Command_DisplayMisc, "main",
554 "/FlexBar MiscHelp - for miscellaneous options")
555 scmd:AddCommand("eventhelp", FB_Command_DisplayEvents, "main",
556 "/FlexBar EventHelp - for options on events")
557 scmd:AddCommand("grouphelp", FB_Command_DisplayGroup, "main",
558 "/FlexBar GroupHelp - for options on grouping buttons")
559 scmd:AddCommand("appearance", FB_Command_DisplayAppearance, "main",
560 "/FlexBar Appearance - for options on button appearance")
561 scmd:AddCommand("movement", FB_Command_DisplayMovement, "main",
562 "/FlexBar Movement - for options on moving buttons")
563  
564 scmd:AddCommand("test", FB_Command_Test, "test",
565 "/Flexbar Test arg1=<string> arg2=<number> arg3=<optional> arg4=<required>")
566 scmd:AddParam("test","arg1",true,nil,{"string"},nil, nil)
567 scmd:AddParam("test","arg2",true,nil,{"number"},{lowerbound=5, upperbound=10}, nil)
568 scmd:AddParam("test","arg3",false,nil,{"number", "table"},{1,3,5}, 10)
569 scmd:AddParam("test","arg4",true,true,{"string", "table"},{"true", "false"}, nil)
570 end
571  
572 function FB_Command_Test(msg)
573 local args = FBcmd:GetParameters(msg)
574 if not FBcmd:CheckParams("test", args) then
575 util:Print("not valid")
576 else
577 util:Print("valid")
578 end
579 end
580  
581 -- Usage display functions
582 function FB_Command_DisplayMisc()
583 FBcmd:DisplayUsage("misc")
584 util:Print(FB_DISPLAY_MISCHELP_ADD)
585 end
586  
587 function FB_Command_DisplayAppearance()
588 FBcmd:DisplayUsage("appearance")
589 util:Print(FB_DISPLAY_APPHELP_ADD)
590 end
591  
592 function FB_Command_DisplayGroup()
593 FBcmd:DisplayUsage("group")
594 util:Print(FB_DISPLAY_GROUPHELP_ADD)
595 end
596  
597 function FB_Command_DisplayMovement()
598 FBcmd:DisplayUsage("movement")
599 util:Print(FB_DISPLAY_MOVEHELP_ADD)
600 end
601  
602 function FB_Command_DisplayEvents()
603 FBcmd:DisplayUsage("events")
604 end
605  
606 -- Appearance command handlers
607  
608 function FB_Command_Hide(msg)
609 -- Hide the buttons specified in Button=<buttons>
610 local args
611 if FBEventArgs then
612 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
613 args = FBEventArgs
614 else
615 -- otherwise this is from the command line and regular checking needs to occur
616 args = FBcmd:GetParameters(msg)
617 -- basic usage test
618 if not FBcmd:CheckParameters("hide", args) then return end
619 -- In order to allow group= and button= interchangeably they had to both be optional
620 -- check here for one or the other
621 if (args["group"]==nil) and (args["button"]==nil) then
622 util:Print("Error: You must specify a group or button")
623 end
624 -- check for event here - return if specified. FBEvents will be updated
625 if FB_GetEventMsg("hide", args) then return end
626 end
627  
628 if FB_SetCommandTimer("hide", args) then return end
629  
630 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
631  
632 -- get button list
633 local buttons = FB_GetButtonList(args["button"])
634 if (args["group"] and (type(args["group"]) == "number")) then
635 buttons= FB_GetGroupMembers(args["group"])
636 end
637  
638 local index
639 for index = 1,buttons.n do
640 local button, frame = FB_GetWidgets(buttons[index])
641 -- Toggle code - if hidden and toggle exists then unhide
642 if args["toggle"] and FBState[buttons[index]]["hidden"] then
643 FBState[buttons[index]]["hidden"] = nil
644 else
645 FBState[buttons[index]]["hidden"] = true
646 end
647 -- Originally called ApplySettings at the end of the function - but the fact that
648 -- On events go through here too requires that it not do potentially expensive operations
649 -- So the call to apply the specific setting for only the buttons that are affected goes here
650 FB_ApplyHidden(buttons[index])
651 -- And we only save the changed setting
652 FBSavedProfile[FBProfileName][buttons[index]].State["hidden"] = FBState[buttons[index]]["hidden"]
653 FB_Report(button:GetName() .. " hidden")
654 end
655 end
656  
657 function FB_Command_Show(msg)
658 -- Show the buttons specified in Button=<buttons>
659 local args
660 if FBEventArgs then
661 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
662 args=FBEventArgs
663 else
664 -- otherwise this is from the command line and regular checking needs to occur
665 args = FBcmd:GetParameters(msg)
666 -- basic usage test
667 if not FBcmd:CheckParameters("show", args) then return end
668 -- In order to allow group= and button= interchangeably they had to both be optional
669 -- check here for one or the other
670 if (args["group"]==nil) and (args["button"]==nil) then
671 util:Print("Error: You must specify a group or button")
672 end
673 -- check for event here - return if specified. FBEvents will be updated
674 if FB_GetEventMsg("show", args) then return end
675 end
676  
677 if FB_SetCommandTimer("show", args) then return end
678  
679 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
680 -- get button list
681 local buttons = FB_GetButtonList(args["button"])
682 if (args["group"] and (type(args["group"]) == "number")) then
683 buttons= FB_GetGroupMembers(args["group"])
684 end
685  
686 local index
687 for index = 1,buttons.n do
688 local button, frame = FB_GetWidgets(buttons[index])
689 -- Toggle code - if not hidden and toggle exists then hide
690 if args["toggle"] and not FBState[buttons[index]]["hidden"] then
691 FBState[buttons[index]]["hidden"] = true
692 else
693 FBState[buttons[index]]["hidden"] = nil
694 end
695 -- Originally called ApplySettings at the end of the function - but the fact that
696 -- On events go through here too requires that it not do potentially expensive operations
697 -- So the call to apply the specific setting for only the buttons that are affected goes here
698 FB_ApplyHidden(buttons[index])
699 -- And we only save the changed setting
700 FBSavedProfile[FBProfileName][buttons[index]].State["hidden"] = FBState[buttons[index]]["hidden"]
701 FB_Report(button:GetName() .. " unhidden")
702 end
703 end
704  
705 function FB_Command_Fade(msg)
706 -- Change the alpah for the buttons specified in Button=<buttons>
707 local args
708 if FBEventArgs then
709 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
710 args=FBEventArgs
711 else
712 -- otherwise this is from the command line and regular checking needs to occur
713 args = FBcmd:GetParameters(msg)
714 -- basic usage test
715 if not FBcmd:CheckParameters("fade", args) then return end
716 -- In order to allow group= and button= interchangeably they had to both be optional
717 -- check here for one or the other
718 if (args["group"]==nil) and (args["button"]==nil) then
719 util:Print("Error: You must specify a group or button")
720 end
721 -- check for event here - return if specified. FBEvents will be updated
722 if FB_GetEventMsg("fade", args) then return end
723 end
724  
725 if FB_SetCommandTimer("fade", args) then return end
726  
727 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
728  
729 local buttons = FB_GetButtonList(args["button"])
730 if (args["group"] and (type(args["group"]) == "number")) then
731 buttons= FB_GetGroupMembers(args["group"])
732 end
733 local index
734 for index = 1,buttons.n do
735 local button, frame = FB_GetWidgets(buttons[index])
736 -- Toggle code - if toggle, and button already has the set alpha, then toggle to toggle alpha
737 if FBState[buttons[index]]["alpha"] == nil then FBState[buttons[index]]["alpha"] = 1 end
738 if args["toggle"] and (FBState[buttons[index]]["alpha"]*10) == args["alpha"] then
739 FBState[buttons[index]]["alpha"] = args["toggle"] / 10
740 else
741 FBState[buttons[index]]["alpha"] = args["alpha"] / 10
742 end
743 -- Originally called ApplySettings at the end of the function - but the fact that
744 -- On events go through here too requires that it not do potentially expensive operations
745 -- So the call to apply the specific setting for only the buttons that are affected goes here
746 FB_ApplyAlpha(buttons[index])
747 -- And we only save the changed setting
748 FBSavedProfile[FBProfileName][buttons[index]].State["alpha"] = FBState[buttons[index]]["alpha"]
749 FB_Report(button:GetName() .. format(" alpha set to %.2f",args["alpha"]/10))
750 end
751 end
752  
753 function FB_Command_Scale(msg)
754 -- Show the buttons specified in Button=<buttons>
755 local args
756 if FBEventArgs then
757 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
758 args=FBEventArgs
759 else
760 -- otherwise this is from the command line and regular checking needs to occur
761 args = FBcmd:GetParameters(msg)
762 -- basic usage test
763 if not FBcmd:CheckParameters("scale", args) then return end
764 -- In order to allow group= and button= interchangeably they had to both be optional
765 -- check here for one or the other
766 if (args["group"]==nil) and (args["button"]==nil) then
767 util:Print("Error: You must specify a group or button")
768 end
769 -- check for event here - return if specified. FBEvents will be updated
770 if FB_GetEventMsg("scale", args) then return end
771 end
772  
773 if FB_SetCommandTimer("scale", args) then return end
774  
775 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
776  
777 local buttons = FB_GetButtonList(args["button"])
778 if (args["group"] and (type(args["group"]) == "number")) then
779 buttons= FB_GetGroupMembers(args["group"])
780 end
781  
782 local index
783 for index = 1,buttons.n do
784 local button, frame = FB_GetWidgets(buttons[index])
785 -- Toggle code - if toggle, and button already has the set alpha, then toggle to toggle alpha
786 if FBState[buttons[index]]["scale"] == nil then FBState[buttons[index]]["scale"] = 1 end
787 if args["toggle"] and (FBState[buttons[index]]["scale"]*10) == args["scale"] then
788 FBState[buttons[index]]["scale"] = args["toggle"] / 10
789 else
790 FBState[buttons[index]]["scale"] = args["scale"] / 10
791 end
792 if args["reset"] then
793 FBState[buttons[index]]["scale"] = nil
794 end
795 -- Originally called ApplySettings at the end of the function - but the fact that
796 -- On events go through here too requires that it not do potentially expensive operations
797 -- So the call to apply the specific setting for only the buttons that are affected goes here
798 FB_ApplyScale(buttons[index])
799 -- And we only save the changed setting
800 FBSavedProfile[FBProfileName][buttons[index]].State["scale"] = FBState[buttons[index]]["scale"]
801 if FBState[buttons[index]]["scale"] then
802 FB_Report(button:GetName() .. format(" scale set to %.2f",args["scale"]/10))
803 else
804 FB_Report(button:GetName() .. format(" scale is reset"))
805 end
806 end
807 end
808  
809 local colortable = {1,1,1}
810 local colortable2 = {1,1,1}
811 function FB_Command_Shade(msg)
812 local index
813 -- Shade the buttons specified in Button=<buttons> with the color in Color=
814 local args
815 if FBEventArgs then
816 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
817 args=FBEventArgs
818 else
819 -- otherwise this is from the command line and regular checking needs to occur
820 args = FBcmd:GetParameters(msg)
821 -- basic usage test
822 if not FBcmd:CheckParameters("shade", args) then return end
823 -- In order to allow group= and button= interchangeably they had to both be optional
824 -- check here for one or the other
825 if (args["group"]==nil) and (args["button"]==nil) then
826 util:Print("Error: You must specify a group or button")
827 end
828 -- advanced checks that aren't automatic
829 if type(args["color"]) ~= "table" or args["color"][3] == nil or
830 (args["toggle"] and (type(args["toggle"]) ~= "table" or args["toggle"][3] == nil)) then
831 util:Print("Error: Color not in correct format")
832 return
833 end
834 -- check for event here - return if specified. FBEvents will be updated
835 if FB_GetEventMsg("shade", args) then return end
836 end
837  
838 if FB_SetCommandTimer("shade", args) then return end
839  
840 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
841  
842 local buttons = FB_GetButtonList(args["button"])
843 if (args["group"] and (type(args["group"]) == "number")) then
844 buttons= FB_GetGroupMembers(args["group"])
845 end
846 local index
847 for index = 1,3 do
848 colortable[index] = args["color"][index] / 10
849 if args["toggle"] then colortable2[index] = args["toggle"][index] / 10 end
850 end
851 for index = 1,buttons.n do
852 local button, frame = FB_GetWidgets(buttons[index])
853 -- Toggle code - if toggle, and button already the color specified, then toggle then go to toggle color
854 if FBState[buttons[index]]["icon"] == nil then FBState[buttons[index]]["icon"] = {1, 1, 1} end
855 if args["toggle"] and
856 colortable[1] == FBState[buttons[index]]["icon"][1] and
857 colortable[2] == FBState[buttons[index]]["icon"][2] and
858 colortable[3] == FBState[buttons[index]]["icon"][3] then
859 colortable[1] = colortable2[1]
860 colortable[2] = colortable2[2]
861 colortable[3] = colortable2[3]
862 elseif args["reset"] then
863 colortable[1] = nil
864 colortable[2] = nil
865 colortable[3] = nil
866 FBState[buttons[index]]["coloring"] = "resetting"
867 FB_Report(button:GetName() .. " has had its color reset")
868 end
869 if colortable[1] then
870 FBState[buttons[index]]["icon"][1] = colortable[1]
871 FBState[buttons[index]]["icon"][2] = colortable[2]
872 FBState[buttons[index]]["icon"][3] = colortable[3]
873 FB_Report(button:GetName() .. format(" color set to %.2f, %.2f, %.2f",
874 colortable[1],colortable[1],colortable[1]))
875 else
876 FBState[buttons[index]]["icon"] = nil
877 end
878 -- Simply having the state in effect will change the color, but save the changed setting
879 -- and avoid a call to apply settings
880 if FBState[buttons[index]]["icon"] then
881 if not FBSavedProfile[FBProfileName][buttons[index]].State["icon"] then
882 FBSavedProfile[FBProfileName][buttons[index]].State["icon"] = {}
883 end
884 FBSavedProfile[FBProfileName][buttons[index]].State["icon"][1] = colortable[1]
885 FBSavedProfile[FBProfileName][buttons[index]].State["icon"][2] = colortable[2]
886 FBSavedProfile[FBProfileName][buttons[index]].State["icon"][3] = colortable[3]
887 else
888 FBSavedProfile[FBProfileName][buttons[index]].State["icon"] = FBState[buttons[index]]["icon"]
889 end
890 end
891 end
892  
893 function FB_Command_ShadeText(msg)
894 -- Shade the buttons specified in Button=<buttons> with the color in Color=
895 local args
896 if FBEventArgs then
897 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
898 args=FBEventArgs
899 else
900 -- otherwise this is from the command line and regular checking needs to occur
901 args = FBcmd:GetParameters(msg)
902 -- basic usage test
903 if not FBcmd:CheckParameters("shadetext", args) then return end
904 -- In order to allow group= and button= interchangeably they had to both be optional
905 -- check here for one or the other
906 if (args["group"]==nil) and (args["button"]==nil) then
907 util:Print("Error: You must specify a group or button")
908 end
909 -- advanced checks that aren't automatic
910 if type(args["color"]) ~= "table" or args["color"][3] == nil or
911 (args["toggle"] and (type(args["toggle"]) ~= "table" or args["toggle"][3] == nil)) then
912 util:Print("Error: Color not in correct format")
913 return
914 end
915 -- check for event here - return if specified. FBEvents will be updated
916 if FB_GetEventMsg("shadetext", args) then return end
917 end
918  
919 if FB_SetCommandTimer("shadetext", args) then return end
920  
921 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
922  
923 local buttons = FB_GetButtonList(args["button"])
924 if (args["group"] and (type(args["group"]) == "number")) then
925 buttons= FB_GetGroupMembers(args["group"])
926 end
927 local index
928 for index = 1,3 do
929 colortable[index] = args["color"][index] / 10
930 if args["toggle"] then colortable2[index] = args["toggle"][index] / 10 end
931 end
932 for index = 1,buttons.n do
933 local button, frame = FB_GetWidgets(buttons[index])
934 -- Toggle code - if toggle, and button already the color specified, then toggle then go to toggle color
935 if FBState[buttons[index]]["hotkeycolor"] == nil then FBState[buttons[index]]["hotkeycolor"] = {1, 1, 1} end
936 if args["toggle"] and
937 colortable[1] == FBState[buttons[index]]["hotkeycolor"][1] and
938 colortable[2] == FBState[buttons[index]]["hotkeycolor"][2] and
939 colortable[3] == FBState[buttons[index]]["hotkeycolor"][3] then
940 colortable[1] = colortable2[1]
941 colortable[2] = colortable2[2]
942 colortable[3] = colortable2[3]
943 elseif args["reset"] then
944 colortable[1] = nil
945 colortable[2] = nil
946 colortable[3] = nil
947 FB_Report("text 1 has had its color reset")
948 getglobal(button:GetName() .. "HotKey"):SetVertexColor(.6,.6,.6)
949 end
950 if colortable[1] then
951 FBState[buttons[index]]["hotkeycolor"][1] = colortable[1]
952 FBState[buttons[index]]["hotkeycolor"][2] = colortable[2]
953 FBState[buttons[index]]["hotkeycolor"][3] = colortable[3]
954 FB_Report(button:GetName() .. format(" color set to %.2f, %.2f, %.2f",
955 colortable[1],colortable[2],colortable[3]))
956 else
957 FBState[buttons[index]]["hotkeycolor"] = nil
958 end
959 -- Simply having the state in effect will change the color, but save the changed setting
960 -- and avoid a call to apply settings
961 if FBState[buttons[index]]["hotkeycolor"] then
962 if not FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"] then
963 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"] = {}
964 end
965 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"][1] = colortable[1]
966 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"][2] = colortable[2]
967 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"][3] = colortable[3]
968 else
969 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeycolor"] = FBState[buttons[index]]["hotkeycolor"]
970 end
971 FB_TextSub(buttons[index])
972 end
973 end
974  
975 function FB_Command_ShadeText2(msg)
976 -- Shade the buttons specified in Button=<buttons> with the color in Color=
977 local args
978 if FBEventArgs then
979 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
980 args=FBEventArgs
981 else
982 -- otherwise this is from the command line and regular checking needs to occur
983 args = FBcmd:GetParameters(msg)
984 -- basic usage test
985 if not FBcmd:CheckParameters("shadetext2", args) then return end
986 -- In order to allow group= and button= interchangeably they had to both be optional
987 -- check here for one or the other
988 if (args["group"]==nil) and (args["button"]==nil) then
989 util:Print("Error: You must specify a group or button")
990 end
991 -- advanced checks that aren't automatic
992 if type(args["color"]) ~= "table" or args["color"][3] == nil or
993 (args["toggle"] and (type(args["toggle"]) ~= "table" or args["toggle"][3] == nil)) then
994 util:Print("Error: Color not in correct format")
995 return
996 end
997 -- check for event here - return if specified. FBEvents will be updated
998 if FB_GetEventMsg("shadetext2", args) then return end
999 end
1000  
1001 if FB_SetCommandTimer("shadetext2", args) then return end
1002  
1003 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1004  
1005 local buttons = FB_GetButtonList(args["button"])
1006 if (args["group"] and (type(args["group"]) == "number")) then
1007 buttons= FB_GetGroupMembers(args["group"])
1008 end
1009 local index
1010 for index = 1,3 do
1011 colortable[index] = args["color"][index] / 10
1012 if args["toggle"] then colortable2[index] = args["toggle"][index] / 10 end
1013 end
1014 for index = 1,buttons.n do
1015 local button, frame = FB_GetWidgets(buttons[index])
1016 -- Toggle code - if toggle, and button already the color specified, then toggle then go to toggle color
1017 if FBState[buttons[index]]["text2color"] == nil then FBState[buttons[index]]["text2color"] = {1, 1, 1} end
1018 if args["toggle"] and
1019 colortable[1] == FBState[buttons[index]]["text2color"][1] and
1020 colortable[2] == FBState[buttons[index]]["text2color"][2] and
1021 colortable[3] == FBState[buttons[index]]["text2color"][3] then
1022 colortable[1] = colortable2[1]
1023 colortable[2] = colortable2[2]
1024 colortable[3] = colortable2[3]
1025 elseif args["reset"] then
1026 colortable[1] = nil
1027 colortable[2] = nil
1028 colortable[3] = nil
1029 FB_Report("text 1 has had its color reset")
1030 getglobal(button:GetName() .. "Text2"):SetVertexColor(.6,.6,.6)
1031 end
1032 if colortable[1] then
1033 FBState[buttons[index]]["text2color"][1] = colortable[1]
1034 FBState[buttons[index]]["text2color"][2] = colortable[2]
1035 FBState[buttons[index]]["text2color"][3] = colortable[3]
1036 FB_Report(button:GetName() .. format(" color set to %.2f, %.2f, %.2f",
1037 colortable[1],colortable[2],colortable[3]))
1038 else
1039 FBState[buttons[index]]["text2color"] = nil
1040 end
1041 -- Simply having the state in effect will change the color, but save the changed setting
1042 -- and avoid a call to apply settings
1043 if FBState[buttons[index]]["text2color"] then
1044 if not FBSavedProfile[FBProfileName][buttons[index]].State["text2color"] then
1045 FBSavedProfile[FBProfileName][buttons[index]].State["text2color"] = {}
1046 end
1047 FBSavedProfile[FBProfileName][buttons[index]].State["text2color"][1] = colortable[1]
1048 FBSavedProfile[FBProfileName][buttons[index]].State["text2color"][2] = colortable[2]
1049 FBSavedProfile[FBProfileName][buttons[index]].State["text2color"][3] = colortable[3]
1050 else
1051 FBSavedProfile[FBProfileName][buttons[index]].State["text2color"] = FBState[buttons[index]]["text2color"]
1052 end
1053 FB_TextSub(buttons[index])
1054 end
1055 end
1056  
1057 function FB_Command_ShadeText3(msg)
1058 -- Shade the buttons specified in Button=<buttons> with the color in Color=
1059 local args
1060 if FBEventArgs then
1061 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1062 args=FBEventArgs
1063 else
1064 -- otherwise this is from the command line and regular checking needs to occur
1065 args = FBcmd:GetParameters(msg)
1066 -- basic usage test
1067 if not FBcmd:CheckParameters("shadetext3", args) then return end
1068 -- In order to allow group= and button= interchangeably they had to both be optional
1069 -- check here for one or the other
1070 if (args["group"]==nil) and (args["button"]==nil) then
1071 util:Print("Error: You must specify a group or button")
1072 end
1073 -- advanced checks that aren't automatic
1074 if type(args["color"]) ~= "table" or args["color"][3] == nil or
1075 (args["toggle"] and (type(args["toggle"]) ~= "table" or args["toggle"][3] == nil)) then
1076 util:Print("Error: Color not in correct format")
1077 return
1078 end
1079 -- check for event here - return if specified. FBEvents will be updated
1080 if FB_GetEventMsg("shadetext3", args) then return end
1081 end
1082  
1083 if FB_SetCommandTimer("shadetext3", args) then return end
1084  
1085 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1086  
1087 local buttons = FB_GetButtonList(args["button"])
1088 if (args["group"] and (type(args["group"]) == "number")) then
1089 buttons= FB_GetGroupMembers(args["group"])
1090 end
1091 local index
1092 for index = 1,3 do
1093 colortable[index] = args["color"][index] / 10
1094 if args["toggle"] then colortable2[index] = args["toggle"][index] / 10 end
1095 end
1096 for index = 1,buttons.n do
1097 local button, frame = FB_GetWidgets(buttons[index])
1098 -- Toggle code - if toggle, and button already the color specified, then toggle then go to toggle color
1099 if FBState[buttons[index]]["text3color"] == nil then FBState[buttons[index]]["text3color"] = {1, 1, 1} end
1100 if args["toggle"] and
1101 colortable[1] == FBState[buttons[index]]["text3color"][1] and
1102 colortable[2] == FBState[buttons[index]]["text3color"][2] and
1103 colortable[3] == FBState[buttons[index]]["text3color"][3] then
1104 colortable[1] = colortable2[1]
1105 colortable[2] = colortable2[2]
1106 colortable[3] = colortable2[3]
1107 elseif args["reset"] then
1108 colortable[1] = nil
1109 colortable[2] = nil
1110 colortable[3] = nil
1111 FB_Report("text 1 has had its color reset")
1112 getglobal(button:GetName() .. "Text3"):SetVertexColor(.6,.6,.6)
1113 end
1114 if colortable[1] then
1115 FBState[buttons[index]]["text3color"][1] = colortable[1]
1116 FBState[buttons[index]]["text3color"][2] = colortable[2]
1117 FBState[buttons[index]]["text3color"][3] = colortable[3]
1118 FB_Report(button:GetName() .. format(" color set to %.2f, %.2f, %.2f",
1119 colortable[1],colortable[2],colortable[3]))
1120 else
1121 FBState[buttons[index]]["text3color"] = nil
1122 end
1123 -- Simply having the state in effect will change the color, but save the changed setting
1124 -- and avoid a call to apply settings
1125 if FBState[buttons[index]]["text3color"] then
1126 if not FBSavedProfile[FBProfileName][buttons[index]].State["text3color"] then
1127 FBSavedProfile[FBProfileName][buttons[index]].State["text3color"] = {}
1128 end
1129 FBSavedProfile[FBProfileName][buttons[index]].State["text3color"][1] = colortable[1]
1130 FBSavedProfile[FBProfileName][buttons[index]].State["text3color"][2] = colortable[2]
1131 FBSavedProfile[FBProfileName][buttons[index]].State["text3color"][3] = colortable[3]
1132 else
1133 FBSavedProfile[FBProfileName][buttons[index]].State["text3color"] = FBState[buttons[index]]["text3color"]
1134 end
1135 FB_TextSub(buttons[index])
1136 end
1137 end
1138  
1139 function FB_Command_ShadeToolTip(msg)
1140 local index
1141 -- Shade the buttons specified in Button=<buttons> with the color in Color=
1142 local args
1143 if FBEventArgs then
1144 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1145 args=FBEventArgs
1146 else
1147 -- otherwise this is from the command line and regular checking needs to occur
1148 args = FBcmd:GetParameters(msg)
1149 -- basic usage test
1150 if not FBcmd:CheckParameters("shadetooltip", args) then return end
1151 -- advanced checks that aren't automatic
1152 if type(args["color"]) ~= "table" or args["color"][3] == nil or
1153 (args["toggle"] and (type(args["toggle"]) ~= "table" or args["toggle"][3] == nil)) then
1154 util:Print("Error: Color not in correct format")
1155 return
1156 end
1157 -- check for event here - return if specified. FBEvents will be updated
1158 if FB_GetEventMsg("shadetooltip", args) then return end
1159 end
1160  
1161 if FB_SetCommandTimer("shadetooltip", args) then return end
1162  
1163 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1164  
1165 local index
1166 for index = 1,3 do
1167 colortable[index] = args["color"][index] / 10
1168 if args["toggle"] then colortable2[index] = args["toggle"][index] / 10 end
1169 end
1170 -- Toggle code - if toggle, and button already the color specified, then toggle then go to toggle color
1171 if args["toggle"] and
1172 colortable[1] == FBToggles["tooltipinfocolor"].r and
1173 colortable[2] == FBToggles["tooltipinfocolor"].g and
1174 colortable[3] == FBToggles["tooltipinfocolor"].b then
1175 colortable[1] = colortable2[1]
1176 colortable[2] = colortable2[2]
1177 colortable[3] = colortable2[3]
1178 elseif args["reset"] then
1179 colortable[1] = nil
1180 colortable[2] = nil
1181 colortable[3] = nil
1182 FB_Report("Tooltip info has had its color reset")
1183 end
1184 if colortable[1] then
1185 FBToggles["tooltipinfocolor"].r = colortable[1]
1186 FBToggles["tooltipinfocolor"].g = colortable[2]
1187 FBToggles["tooltipinfocolor"].b = colortable[3]
1188 FB_Report(format("Tooltip color set to %.2f, %.2f, %.2f",
1189 colortable[1],colortable[1],colortable[1]))
1190 end
1191 end
1192 function FB_Command_JustifyText(msg)
1193 -- Justify Text
1194 local args
1195 if FBEventArgs then
1196 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1197 args=FBEventArgs
1198 else
1199 -- otherwise this is from the command line and regular checking needs to occur
1200 args = FBcmd:GetParameters(msg)
1201 -- basic usage test
1202 if not FBcmd:CheckParameters("justifytext", args) then return end
1203 -- Place advanced bounds checking here
1204 if args["pos"] and not FBAnchors[string.upper(args["pos"])] then
1205 util:Print("Error: pos must be one of : TOPLEFT, TOPRIGHT, TOP, BOTTOMLEFT, BOTTOMRIGHT, BOTTOM, CENTER, LEFT, RIGHT")
1206 return
1207 end
1208 -- check for event here - return if specified. FBEvents will be updated
1209 if FB_GetEventMsg("justifytext", args) then return end
1210 end
1211  
1212 if FB_SetCommandTimer("justifytext", args) then return end
1213  
1214 -- check for conditional here
1215 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1216  
1217 local buttons = FB_GetButtonList(args["button"])
1218 if (args["group"] and (type(args["group"]) == "number")) then
1219 buttons= FB_GetGroupMembers(args["group"])
1220 end
1221 local index
1222 for index = 1,buttons.n do
1223 local button, frame = FB_GetWidgets(buttons[index])
1224 FBState[buttons[index]]["justifytext"] = args["pos"]
1225 if args["pos"] then
1226 FB_Report(button:GetName() .. "text now in " .. args["pos"])
1227 else
1228 FB_Report(button:GetName() .. "text position reset")
1229 end
1230 FBSavedProfile[FBProfileName][buttons[index]].State["justifytext"] = args["pos"]
1231 FB_ApplyTextPosition(buttons[index])
1232 end
1233 end
1234  
1235 function FB_Command_JustifyText2(msg)
1236 -- Justify Text
1237 local args
1238 if FBEventArgs then
1239 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1240 args=FBEventArgs
1241 else
1242 -- otherwise this is from the command line and regular checking needs to occur
1243 args = FBcmd:GetParameters(msg)
1244 -- basic usage test
1245 if not FBcmd:CheckParameters("justifytext", args) then return end
1246 if args["pos"] and not FBAnchors[string.upper(args["pos"])] then
1247 util:Print("Error: pos must be one of : TOPLEFT, TOPRIGHT, TOP, BOTTOMLEFT, BOTTOMRIGHT, BOTTOM, CENTER, LEFT, RIGHT")
1248 return
1249 end
1250 -- check for event here - return if specified. FBEvents will be updated
1251 if FB_GetEventMsg("justifytext2", args) then return end
1252 end
1253  
1254 if FB_SetCommandTimer("justifytext2", args) then return end
1255  
1256 -- check for conditional here
1257 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1258  
1259 local buttons = FB_GetButtonList(args["button"])
1260 if (args["group"] and (type(args["group"]) == "number")) then
1261 buttons= FB_GetGroupMembers(args["group"])
1262 end
1263 local index
1264 for index = 1,buttons.n do
1265 local button, frame = FB_GetWidgets(buttons[index])
1266 FBState[buttons[index]]["justifytext2"] = args["pos"]
1267 if args["pos"] then
1268 FB_Report(button:GetName() .. "text2 now in " .. args["pos"])
1269 else
1270 FB_Report(button:GetName() .. "text2 position reset")
1271 end
1272 FBSavedProfile[FBProfileName][buttons[index]].State["justifytext2"] = args["pos"]
1273 FB_ApplyTextPosition(buttons[index])
1274 end
1275 end
1276  
1277 function FB_Command_JustifyText3(msg)
1278 -- Justify Text
1279 local args
1280 if FBEventArgs then
1281 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1282 args=FBEventArgs
1283 else
1284 -- otherwise this is from the command line and regular checking needs to occur
1285 args = FBcmd:GetParameters(msg)
1286 -- basic usage test
1287 if not FBcmd:CheckParameters("justifytext", args) then return end
1288 if args["pos"] and not FBAnchors[string.upper(args["pos"])] then
1289 util:Print("Error: pos must be one of : TOPLEFT, TOPRIGHT, TOP, BOTTOMLEFT, BOTTOMRIGHT, BOTTOM, CENTER, LEFT, RIGHT")
1290 return
1291 end
1292 -- check for event here - return if specified. FBEvents will be updated
1293 if FB_GetEventMsg("justifytext3", args) then return end
1294 end
1295  
1296 if FB_SetCommandTimer("justifytext3", args) then return end
1297  
1298 -- check for conditional here
1299 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1300  
1301 local buttons = FB_GetButtonList(args["button"])
1302 if (args["group"] and (type(args["group"]) == "number")) then
1303 buttons= FB_GetGroupMembers(args["group"])
1304 end
1305 local index
1306 for index = 1,buttons.n do
1307 local button, frame = FB_GetWidgets(buttons[index])
1308 FBState[buttons[index]]["justifytext3"] = args["pos"]
1309 if args["pos"] then
1310 FB_Report(button:GetName() .. "text3 now in " .. args["pos"])
1311 else
1312 FB_Report(button:GetName() .. "text3 position reset")
1313 end
1314 FBSavedProfile[FBProfileName][buttons[index]].State["justifytext3"] = args["pos"]
1315 FB_ApplyTextPosition(buttons[index])
1316 end
1317 end
1318  
1319 -- Movement command handlers
1320  
1321 function FB_Command_Lock(msg)
1322 -- Lock the buttons specified in Button=<buttons>
1323 local args = FBcmd:GetParameters(msg)
1324 -- Check basic usage
1325 if not FBcmd:CheckParameters("lock",args) then return end
1326 -- check here for one or the other
1327 if (args["group"]==nil) and (args["button"]==nil) then
1328 util:Print("Error: You must specify a group or button")
1329 end
1330 local buttons = FB_GetButtonList(args["button"])
1331 if (args["group"] and (type(args["group"]) == "number")) then
1332 buttons= FB_GetGroupMembers(args["group"])
1333 end
1334  
1335 local index
1336 for index = 1,buttons.n do
1337 local button, frame = FB_GetWidgets(buttons[index])
1338 FBState[buttons[index]]["locked"] = true
1339 FB_Report(button:GetName() .. " locked")
1340 end
1341  
1342 FB_ApplySettings()
1343 end
1344  
1345 function FB_Command_Unlock(msg)
1346 -- Unlock the buttons specified in Button=<buttons>
1347 local args = FBcmd:GetParameters(msg)
1348 -- Check basic usage
1349 if not FBcmd:CheckParameters("lock",args) then return end
1350 -- check here for one or the other
1351 if (args["group"]==nil) and (args["button"]==nil) then
1352 util:Print("Error: You must specify a group or button")
1353 end
1354 local buttons = FB_GetButtonList(args["button"])
1355 if (args["group"] and (type(args["group"]) == "number")) then
1356 buttons= FB_GetGroupMembers(args["group"])
1357 end
1358 local index
1359 for index = 1,buttons.n do
1360 local button, frame = FB_GetWidgets(buttons[index])
1361 FBState[buttons[index]]["locked"] = nil
1362 FB_Report(button:GetName() .. " unlocked")
1363 end
1364  
1365 FB_ApplySettings()
1366 end
1367  
1368 function FB_Command_MoveABS(msg)
1369 -- Move the specified button to a point relative to the bottom left of the screen
1370 local args
1371 if FBEventArgs then
1372 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1373 args=FBEventArgs
1374 else
1375 -- otherwise this is from the command line and regular checking needs to occur
1376 args = FBcmd:GetParameters(msg)
1377 -- basic usage test
1378 if not FBcmd:CheckParameters("moveabs", args) then return end
1379 -- check for event here - return if specified. FBEvents will be updated
1380 if FB_GetEventMsg("moveabs", args) then return end
1381 end
1382  
1383 if FB_SetCommandTimer("moveabs", args) then return end
1384  
1385 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1386  
1387 local button, frame = FB_GetWidgets(args["button"])
1388  
1389 -- if the button is in a group, but not the anchor, return
1390 if FBState[args["button"]]["group"] and FBState[args["button"]]["group"] ~= args["button"] then return end
1391  
1392 if FBState[args["button"]]["group"] then
1393 FB_StoreGroupOffsetForMove(FBState[args["button"]]["group"])
1394 end
1395  
1396 FB_MoveButtonABS(args["button"], args["xx"], args["yy"])
1397 FB_Report(button:GetName() .. format(" moved to x=%d, y=%d", args["xx"], args["yy"]))
1398 if FBState[args["button"]]["group"] then
1399 -- A group anchor was moved. Update Group coordinates and then Group Bounding Data
1400 FB_RestoreGroupOffsetAfterMove(FBState[args["button"]]["group"])
1401 FBGroupData[FBState[args["button"]]["group"]] = FB_GetBoundingButtons(FBState[args["button"]]["group"])
1402 FB_CheckGroups()
1403 end
1404 end
1405  
1406 function FB_Command_MoveRel(msg)
1407 -- Move the specified button to the location relative to target
1408 local args
1409 if FBEventArgs then
1410 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1411 args=FBEventArgs
1412 else
1413 -- otherwise this is from the command line and regular checking needs to occur
1414 args = FBcmd:GetParameters(msg)
1415 -- basic usage test
1416 if not FBcmd:CheckParameters("moverel", args) then return end
1417 -- check for event here - return if specified. FBEvents will be updated
1418 if FB_GetEventMsg("moverel", args) then return end
1419 end
1420  
1421 if FB_SetCommandTimer("moverel", args) then return end
1422  
1423 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1424  
1425 local button, frame = FB_GetWidgets(args["button"])
1426  
1427 -- if the button is in a group, but not the anchor, return
1428 if FBState[args["button"]]["group"] and FBState[args["button"]]["group"] ~= args["button"] then return end
1429  
1430 if FBState[args["button"]]["group"] then
1431 FB_StoreGroupOffsetForMove(FBState[args["button"]]["group"])
1432 end
1433  
1434 local target, frame = FB_GetWidgets(args["trgbtn"])
1435 local dx = args["dx"] / UIParent:GetScale()
1436 local dy = args["dy"] / UIParent:GetScale()
1437 FB_MoveButtonRel(args["button"],args["trgbtn"], dx, dy)
1438 FB_Report(button:GetName() .. format(" moved to x=%d, y=%d", args["dx"], args["dy"]) .. " with respect to " .. target:GetName())
1439 if FBState[args["button"]]["group"] then
1440 -- A group anchor was moved. Update Group coordinates and then Group Bounding Data
1441 FB_RestoreGroupOffsetAfterMove(FBState[args["button"]]["group"])
1442 FBGroupData[FBState[args["button"]]["group"]] = FB_GetBoundingButtons(FBState[args["button"]]["group"])
1443 FB_CheckGroups()
1444 end
1445 end
1446  
1447 function FB_Command_MoveToMouse(msg)
1448 -- Move the specified button to the location relative to mouse
1449 local args
1450 if FBEventArgs then
1451 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1452 args=FBEventArgs
1453 else
1454 -- otherwise this is from the command line and regular checking needs to occur
1455 args = FBcmd:GetParameters(msg)
1456 -- basic usage test
1457 if not FBcmd:CheckParameters("movetomouse", args) then return end
1458 -- check for event here - return if specified. FBEvents will be updated
1459 if FB_GetEventMsg("movetomouse", args) then return end
1460 end
1461  
1462 if FB_SetCommandTimer("movetomouse", args) then return end
1463  
1464 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1465  
1466 local button, frame = FB_GetWidgets(args["button"])
1467  
1468 -- if the button is in a group, but not the anchor, return
1469 if FBState[args["button"]]["group"] and FBState[args["button"]]["group"] ~= args["button"] then return end
1470  
1471 if FBState[args["button"]]["group"] then
1472 FB_StoreGroupOffsetForMove(FBState[args["button"]]["group"])
1473 end
1474  
1475 local x,y = GetCursorPosition(UIParent)
1476 x = x / UIParent:GetScale()
1477 y = y / UIParent:GetScale()
1478 local dx = args["dx"] / UIParent:GetScale()
1479 local dy = args["dy"] / UIParent:GetScale()
1480 FB_MoveButtonABS(args["button"], x+dx, y+dy)
1481 FB_Report(button:GetName() .. format(" moved to x=%d, y=%d", x+args["dx"], y+args["dy"]))
1482 if FBState[args["button"]]["group"] then
1483 -- A group anchor was moved. Update Group coordinates and then Group Bounding Data
1484 FB_RestoreGroupOffsetAfterMove(FBState[args["button"]]["group"])
1485 FBGroupData[FBState[args["button"]]["group"]] = FB_GetBoundingButtons(FBState[args["button"]]["group"])
1486 FB_CheckGroups()
1487 end
1488 end
1489  
1490 -- All group related slash command handlers here
1491  
1492 function FB_Command_CircleGroup(msg)
1493 -- Arrange the specified group into a circular formation
1494 local args = FBcmd:GetParameters(msg)
1495 -- Check basic usage
1496 if not FBcmd:CheckParameters("circlegroup",args) then return end
1497 local buttonnum=args["group"]
1498 local button, frame = FB_GetWidgets(args["group"])
1499 if FBState[buttonnum]["group"] ~= FB_GetButtonNum(button) then
1500 util:Echo(FB_NOGROUP_ERR, "green")
1501 return
1502 end
1503 FB_CircularGroup(args["group"], args["padding"])
1504 FB_Report(string.format(FB_AUTOARRANGE_RPT, args["group"]))
1505 end
1506  
1507 function FB_Command_VerticalGroup(msg)
1508 -- Arrange the specified group into a vertical formation
1509 local args = FBcmd:GetParameters(msg)
1510 -- Check basic usage
1511 if not FBcmd:CheckParameters("verticalgroup",args) then return end
1512 local buttonnum=args["group"]
1513 local button, frame = FB_GetWidgets(args["group"])
1514 if FBState[buttonnum]["group"] ~= FB_GetButtonNum(button) then
1515 util:Echo(FB_NOGROUP_ERR, "green")
1516 return
1517 end
1518 FB_VerticalGroup(args["group"], args["width"], args["padding"])
1519 FB_Report(string.format(FB_AUTOARRANGE_RPT, args["group"]))
1520 end
1521  
1522 function FB_Command_HorizontalGroup(msg)
1523 -- Arrange the specified group into a horizontal formation
1524 local args = FBcmd:GetParameters(msg)
1525 -- Check basic usage
1526 if not FBcmd:CheckParameters("horizontalgroup",args) then return end
1527 local buttonnum=args["group"]
1528 local button, frame = FB_GetWidgets(args["group"])
1529 if FBState[buttonnum]["group"] ~= FB_GetButtonNum(button) then
1530 util:Echo(FB_NOGROUP_ERR, "green")
1531 return
1532 end
1533 FB_HorizontalGroup(args["group"], args["height"], args["padding"])
1534 FB_Report(string.format(FB_AUTOARRANGE_RPT, args["group"]))
1535 end
1536 function FB_Command_MenuPopUp(msg)
1537 -- Arrange the specified group into a popout menu
1538 local args = FBcmd:GetParameters(msg)
1539 -- Check basic usage
1540 if not FBcmd:CheckParameters("menupopup",args) then return end
1541 local buttonnum=args["group"]
1542 local alignment=string.upper(args["align"])
1543 local trigger=args["trigger"]
1544 local button, frame = FB_GetWidgets(args["group"])
1545 if FBState[buttonnum]["group"] ~= FB_GetButtonNum(button) then
1546 util:Echo(FB_NOGROUP_ERR, "green")
1547 return
1548 end
1549 if FBState[trigger]["group"] ~= FB_GetButtonNum(button) then
1550 util:Echo(string.format(FB_MENUPOPUP_TRIGGER_ERR, FB_GetButtonNum(button)), "green")
1551 return
1552 end
1553 if alignment == "HORIZONTAL" then
1554 FB_HorizontalGroup(args["group"], args["height"], args["padding"])
1555 elseif alignment == "VERTICAL" then
1556 FB_VerticalGroup(args["group"], args["width"], args["padding"])
1557 elseif alignment == "CIRCULAR" then
1558 FB_CircularGroup(args["group"], args["padding"])
1559 else
1560 util:Echo(string.format(FB_MENUPOPUP_ALIGN_ERR, args["align"]), "green")
1561 return
1562 end
1563 local buttonlist = FB_GetGroupMembers(buttonnum)
1564 local i, j, buttontext="[ "
1565 for i, j in pairs(buttonlist) do
1566 if j ~= trigger then
1567 buttontext = buttontext..j.." "
1568 end
1569 end
1570 buttontext = buttontext.."]"
1571 FB_Command_Show("show button="..buttontext.." on='mouseenterbutton' target="..trigger)
1572 FB_Command_Hide("hide button="..buttontext.." on='mouseleavegroup' target="..buttonnum)
1573 if args["texture"] ~= "" then
1574 FB_Command_SetTexture("settexture id="..trigger.." texture="..args["texture"])
1575 end
1576 end
1577 function FB_Command_Group(msg)
1578 -- Set a group for the buttons specified in Button=<buttons>
1579 -- Group is anchored on button specified in Anchor=<button>
1580 local args = FBcmd:GetParameters(msg)
1581 -- Check basic usage
1582 if not FBcmd:CheckParameters("group",args) then return end
1583 local buttons = FB_GetButtonList(args["button"])
1584 -- extended checks
1585 -- Groups must have more than one members
1586 if buttons.n < 2 then
1587 util:Echo(FB_GROUP_MEMBERS_ERR)
1588 return
1589 end
1590 -- Anchor must also be a member of the set of buttons being made into a group
1591 local index
1592 local goodanchor = false
1593 for index = 1,buttons.n do
1594 if args["anchor"] == buttons[index] then goodanchor = true end
1595 end
1596  
1597 if not goodanchor then
1598 util:Echo(FB_GROUP_ANCHOR_ERR)
1599 return
1600 end
1601  
1602 -- Good parameters - set the group
1603 for index = 1,buttons.n do
1604 local button, frame = FB_GetWidgets(buttons[index])
1605 FBState[buttons[index]]["group"] = args["anchor"]
1606 end
1607  
1608 -- Reform group
1609 FB_ReformGroup(args["anchor"])
1610 if FBVerbose then FB_Command_ListGroups("group="..args["anchor"]) end
1611 end
1612  
1613 function FB_Command_Ungroup(msg)
1614 -- Ungroup the buttons specified in Button=<buttons>, and their groupmates
1615 local args = FBcmd:GetParameters(msg)
1616 -- Check basic usage
1617 if not FBcmd:CheckParameters("ungroup",args) then return end
1618 local buttons = FB_GetButtonList(args["group"])
1619 local index
1620 for index = 1,buttons.n do
1621 if FBState[buttons[index]]["group"] == buttons[index] then
1622 FB_Report(string.format(FB_UNGROUP_DISBAND_RPT, buttons[index]))
1623 local members = FB_GetGroupMembers(FBState[buttons[index]]["group"])
1624 local index2
1625 for index2 = 1, members.n do
1626 FBState[members[index2]]["group"] = nil
1627 FBState[members[index2]]["locked"] = nil
1628 end
1629 end
1630 end
1631 FB_ReformAllGroups()
1632 end
1633  
1634 function FB_Command_ListGroups(msg)
1635 -- Show buttons in the groups in Group=
1636 -- show all groups if group= ommitted
1637 local args = FBcmd:GetParameters(msg)
1638 -- Check basic usage
1639 if not FBcmd:CheckParameters("listgroups",args) then return end
1640  
1641 if (args["group"] == nil) then
1642 local index, value
1643 local groups = {}
1644 for index = 1, FBNumButtons do
1645 local button, frame = FB_GetWidgets(index)
1646 if FBState[index]["group"] == index then groups[index] = true end
1647 end
1648 local text = FB_LISTGROUPS_RPT
1649 for index = 1, FBNumButtons do
1650 if groups[index] then text = text .. " " .. index end
1651 end
1652 util:Print(text)
1653 return
1654 end
1655  
1656 if type(args["group"]) == "number" then
1657 buttons= FB_GetGroupMembers(args["group"])
1658 else
1659 FBcmd:DisplayUsage("group")
1660 return
1661 end
1662  
1663 local index
1664 local text = string.format(FB_LISTGROUPS_BUTTON_RPT, args["group"])
1665 for index = 1, buttons.n do
1666 text = text .. " " .. buttons[index]
1667 end
1668 util:Print(text)
1669 end
1670  
1671 -- Event functions
1672  
1673 function FB_Command_ListEvents(msg)
1674 -- Show events
1675 local args = FBcmd:GetParameters(msg)
1676 -- Check basic usage
1677 if not FBcmd:CheckParameters("listevents",args) then return end
1678  
1679 local index, event
1680 for index, event in ipairs(FBEvents) do
1681 util:Print(index .. ") On " .. event["on"] .. " " .. event["targettext"] .. " : " .. event["command"])
1682 end
1683 end
1684  
1685 function FB_Command_DeleteEvent(msg)
1686 -- Delete specified event
1687 local args = FBcmd:GetParameters(msg)
1688 -- Check basic usage
1689 if not FBcmd:CheckParameters("deleteevent",args) then return end
1690 table.remove(FBEvents,args["event"])
1691 FB_Report("Event " .. args["event"] .. " deleted")
1692 FB_CreateQuickDispatch()
1693 FBSavedProfile[FBProfileName].Events = util:TableCopy(FBEvents)
1694 end
1695  
1696 -- Miscellaneous command handlers
1697  
1698 function FB_Command_Verbose(msg)
1699 -- Set the feedback verbosity level
1700 local args = FBcmd:GetParameters(msg)
1701 -- Check basic usage
1702 if not FBcmd:CheckParameters("verbose",args) then return end
1703 if args["state"] ~= nil then
1704 if string.lower(args["state"]) == "on" then
1705 FBVerbose = true
1706 util:Print("Verbose mode Active", "green")
1707 else
1708 FBVerbose = nil;
1709 util:Print("Verbose mode Inactive", "yellow")
1710 end
1711 else
1712 FBcmd:DisplayUsage("misc")
1713 end
1714 end
1715  
1716 function FB_Command_Tooltip(msg)
1717 -- Set the feedback verbosity level
1718 local args = FBcmd:GetParameters(msg)
1719 -- Check basic usage
1720 if not FBcmd:CheckParameters("verbose",args) then return end
1721 if args["state"] ~= nil then
1722 if string.lower(args["state"]) == "on" then
1723 FBNoTooltips = nil
1724 util:Print("Tooltips will now show", "green")
1725 else
1726 FBNoTooltips = true
1727 util:Print("Tooltips will not show", "yellow")
1728 end
1729 else
1730 FBcmd:DisplayUsage("misc")
1731 end
1732 end
1733  
1734 function FB_Command_LockIcon(msg)
1735 -- Lock the icon to the buttons specified in Button=<buttons>
1736 local args = FBcmd:GetParameters(msg)
1737 -- Check basic usage
1738 if not FBcmd:CheckParameters("lockicon",args) then return end
1739 local buttons = FB_GetButtonList(args["button"])
1740 if (args["group"] and (type(args["group"]) == "number")) then
1741 buttons= FB_GetGroupMembers(args["group"])
1742 end
1743  
1744 local index
1745 for index = 1,buttons.n do
1746 local button, frame = FB_GetWidgets(buttons[index])
1747 if args["off"] then
1748 FBState[buttons[index]]["lockedicon"] = nil
1749 FB_Report(button:GetName() .. " has it's Icon unlocked click and drag to remove")
1750 else
1751 FBState[buttons[index]]["lockedicon"] = true
1752 FB_Report(button:GetName() .. " has it's Icon locked - shift click to remove")
1753 end
1754 end
1755  
1756 FB_ApplySettings()
1757 end
1758  
1759 function FB_Command_Text(msg)
1760 -- template for new commands
1761 local args
1762 if FBEventArgs then
1763 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1764 args=FBEventArgs
1765 else
1766 -- otherwise this is from the command line and regular checking needs to occur
1767 args = FBcmd:GetParameters(msg)
1768 -- basic usage test
1769 if not FBcmd:CheckParameters("text", args) then return end
1770 -- Place advanced bounds checking here
1771 if (args["group"]==nil) and (args["button"]==nil) then
1772 util:Print("Error: You must specify a group or button")
1773 end
1774 if (args["text"]==nil) then
1775 args["text"] = ""
1776 end
1777  
1778 -- check for event here - return if specified. FBEvents will be updated
1779 if FB_GetEventMsg("text", args) then return end
1780 end
1781  
1782 if FB_SetCommandTimer("text", args) then return end
1783  
1784 -- check for conditional here
1785 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1786  
1787 local buttons = FB_GetButtonList(args["button"])
1788 if (args["group"] and (type(args["group"]) == "number")) then
1789 buttons= FB_GetGroupMembers(args["group"])
1790 end
1791 local index
1792 for index = 1,buttons.n do
1793 local button, frame = FB_GetWidgets(buttons[index])
1794 FBState[buttons[index]]["hotkeytext"] = args["text"]
1795 FB_TextSub(buttons[index])
1796 FlexBarButton_UpdateUsable(button)
1797 FlexBarButton_UpdateHotkeys(button)
1798 FB_Report(button:GetName() .. " now has " .. args["text"] .. " as it's hotkey")
1799 FBSavedProfile[FBProfileName][buttons[index]].State["hotkeytext"] = args["text"]
1800 end
1801 end
1802  
1803 function FB_Command_Text2(msg)
1804 -- template for new commands
1805 local args
1806 if FBEventArgs then
1807 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1808 args=FBEventArgs
1809 else
1810 -- otherwise this is from the command line and regular checking needs to occur
1811 args = FBcmd:GetParameters(msg)
1812 -- basic usage test
1813 if not FBcmd:CheckParameters("text2", args) then return end
1814 -- Place advanced bounds checking here
1815 if (args["group"]==nil) and (args["button"]==nil) then
1816 util:Print("Error: You must specify a group or button")
1817 end
1818 if (args["text"]==nil) then
1819 args["text"] = ""
1820 end
1821  
1822 -- check for event here - return if specified. FBEvents will be updated
1823 if FB_GetEventMsg("text2", args) then return end
1824 end
1825 if FB_SetCommandTimer("text2", args) then return end
1826  
1827 -- check for conditional here
1828 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1829 local buttons = FB_GetButtonList(args["button"])
1830 if (args["group"] and (type(args["group"]) == "number")) then
1831 buttons= FB_GetGroupMembers(args["group"])
1832 end
1833 local index
1834 for index = 1,buttons.n do
1835 local button, frame = FB_GetWidgets(buttons[index])
1836 FBState[buttons[index]]["text2"] = args["text"]
1837 FB_TextSub(buttons[index])
1838 FlexBarButton_UpdateUsable(button)
1839 FlexBarButton_UpdateHotkeys(button)
1840 FB_Report(button:GetName() .. " now has " .. args["text"] .. " as it's hotkey")
1841 FBSavedProfile[FBProfileName][buttons[index]].State["text2"] = args["text"]
1842 end
1843 end
1844  
1845 function FB_Command_Text3(msg)
1846 -- template for new commands
1847 local args
1848 if FBEventArgs then
1849 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1850 args=FBEventArgs
1851 else
1852 -- otherwise this is from the command line and regular checking needs to occur
1853 args = FBcmd:GetParameters(msg)
1854 -- basic usage test
1855 if not FBcmd:CheckParameters("text3", args) then return end
1856 -- Place advanced bounds checking here
1857 if (args["group"]==nil) and (args["button"]==nil) then
1858 util:Print("Error: You must specify a group or button")
1859 end
1860 if (args["text"]==nil) then
1861 args["text"] = ""
1862 end
1863  
1864 -- check for event here - return if specified. FBEvents will be updated
1865 if FB_GetEventMsg("text3", args) then return end
1866 end
1867 if FB_SetCommandTimer("text3", args) then return end
1868  
1869 -- check for conditional here
1870 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1871 local buttons = FB_GetButtonList(args["button"])
1872 if (args["group"] and (type(args["group"]) == "number")) then
1873 buttons= FB_GetGroupMembers(args["group"])
1874 end
1875 local index
1876 for index = 1,buttons.n do
1877 local button, frame = FB_GetWidgets(buttons[index])
1878 FBState[buttons[index]]["text3"] = args["text"]
1879 FB_TextSub(buttons[index])
1880 FlexBarButton_UpdateUsable(button)
1881 FlexBarButton_UpdateHotkeys(button)
1882 FB_Report(button:GetName() .. " now has " .. args["text"] .. " as it's hotkey")
1883 FBSavedProfile[FBProfileName][buttons[index]].State["text3"] = args["text"]
1884 end
1885 end
1886  
1887 function FB_Command_ReMap(msg)
1888 -- Remap the bonus buttons to the specified base
1889 local args
1890 if FBEventArgs then
1891 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1892 args=FBEventArgs
1893 else
1894 -- otherwise this is from the command line and regular checking needs to occur
1895 args = FBcmd:GetParameters(msg)
1896 -- basic usage test
1897 if not FBcmd:CheckParameters("remap", args) then return end
1898 -- Get button list
1899 local buttons = FB_GetButtonList(args["button"])
1900 if (args["group"]) then
1901 buttons= FB_GetGroupMembers(args["group"])
1902 end
1903 -- Another check that can't be automated
1904 if args["base"] + buttons.n - 1 > 120 then
1905 util:Print("Error: Remap would make a button ID out of bounds")
1906 return
1907 end
1908 -- check for event here - return if specified. FBEvents will be updated
1909 if FB_GetEventMsg("remap", args) then return end
1910 end
1911  
1912 if FB_SetCommandTimer("remap", args) then return end
1913  
1914 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1915  
1916 local buttons = FB_GetButtonList(args["button"])
1917 if (args["group"]) then
1918 buttons= FB_GetGroupMembers(args["group"])
1919 end
1920 local index
1921 for index = 1, buttons.n do
1922 local button, frame = FB_GetWidgets(buttons[index])
1923 local id = button:GetID()
1924 local waspet = FBSavedProfile[FBProfileName].FlexActions[id] and FBSavedProfile[FBProfileName].FlexActions[id]["action"] == "pet"
1925 -- if toggle is present AND button are already mapped to anything but default OR Reset is true
1926 -- then map them to the default, otherwise map them to base + index - 1.
1927 if (args["toggle"] and FBState[buttons[index]]["remap"]) or args["reset"] then
1928 FBState[buttons[index]]["remap"] = nil
1929 button:SetID(FBState[buttons[index]]["oldid"])
1930 else
1931 FBState[buttons[index]]["remap"] = index + args["base"] - 1
1932 button:SetID(FBState[buttons[index]]["remap"])
1933 end
1934 local id = button:GetID()
1935 local ispet = FBSavedProfile[FBProfileName].FlexActions[id] and FBSavedProfile[FBProfileName].FlexActions[id]["action"] == "pet"
1936 if waspet then FB_ResetPetItems(button) end
1937 if ispet then FBPetActions[buttons[index]] = true end
1938 FlexBarButton_Update(button)
1939 FlexBarButton_UpdateCooldown(button)
1940 FlexBarButton_UpdateState(button)
1941 FB_MimicPetButtons()
1942 FBSavedProfile[FBProfileName][buttons[index]].State["remap"] = FBState[buttons[index]]["remap"]
1943 FB_Report(button:GetName() .. " remapped to " .. button:GetID())
1944 end
1945 end
1946  
1947 function FB_Command_Echo(msg)
1948 -- Have the specified buttons echo a second buttondown/up/click events
1949 local args
1950 if FBEventArgs then
1951 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
1952 args=FBEventArgs
1953 else
1954 -- otherwise this is from the command line and regular checking needs to occur
1955 args = FBcmd:GetParameters(msg)
1956 -- basic usage test
1957 if not FBcmd:CheckParameters("echo", args) then return end
1958 -- Get button list
1959 local buttons = FB_GetButtonList(args["button"])
1960 if (args["group"]) then
1961 buttons= FB_GetGroupMembers(args["group"])
1962 end
1963 -- Another check that can't be automated
1964 if args["base"] + buttons.n - 1 > FBNumButtons then
1965 util:Print("Error: echo would make a button # out of bounds")
1966 return
1967 end
1968 -- check for event here - return if specified. FBEvents will be updated
1969 if FB_GetEventMsg("echo", args) then return end
1970 end
1971  
1972 if FB_SetCommandTimer("echo", args) then return end
1973  
1974 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
1975  
1976 local buttons = FB_GetButtonList(args["button"])
1977 if (args["group"]) then
1978 buttons= FB_GetGroupMembers(args["group"])
1979 end
1980 local index
1981 for index = 1, buttons.n do
1982 local button, frame = FB_GetWidgets(buttons[index])
1983 -- if toggle is present AND button are already echoing anything but default OR Reset is true
1984 -- then map them to the default, otherwise map them to base + index - 1.
1985 if (args["toggle"] and FBState[buttons[index]]["echo"]) or args["reset"] then
1986 FBState[buttons[index]]["echo"] = nil
1987 else
1988 FBState[buttons[index]]["echo"] = args["base"] + index - 1
1989 end
1990  
1991 FBSavedProfile[FBProfileName][buttons[index]].State["echo"] = FBState[buttons[index]]["echo"]
1992 if FBState[buttons[index]]["echo"] then
1993 FB_Report(button:GetName() .. " echoing " .. FBState[buttons[index]]["echo"])
1994 else
1995 FB_Report(button:GetName() .. " no longer echoing")
1996 end
1997 end
1998 end
1999  
2000 function FB_Command_HideGrid(msg)
2001 -- Hide the button background if it doesn't have an action
2002 local args = FBcmd:GetParameters(msg)
2003 -- Check basic usage
2004 if not FBcmd:CheckParameters("hidegrid",args) then return end
2005 -- check here for one or the other
2006 if (args["group"]==nil) and (args["button"]==nil) then
2007 util:Print("Error: You must specify a group or button")
2008 end
2009 local buttons = FB_GetButtonList(args["button"])
2010 if (args["group"] and (type(args["group"]) == "number")) then
2011 buttons= FB_GetGroupMembers(args["group"])
2012 end
2013  
2014 local index
2015 for index = 1,buttons.n do
2016 local button, frame = FB_GetWidgets(buttons[index])
2017 if args["toggle"] and (FBState[buttons[index]]["hidegrid"] or FBState[buttons[index]]["savedgrid"] )then
2018 FBState[buttons[index]]["hidegrid"] = nil
2019 FBState[buttons[index]]["savedgrid"] = nil
2020 elseif not FBSavedProfile[FBProfileName].FlexActions[button:GetID()] then
2021 FBState[buttons[index]]["hidegrid"] = true
2022 else
2023 FBState[buttons[index]]["savedgrid"] = true
2024 end
2025 if FBState[buttons[index]]["hidegrid"] then
2026 button.showgrid=0
2027 frame:DisableDrawLayer()
2028 else
2029 button.showgrid=1
2030 button:Show()
2031 frame:EnableDrawLayer()
2032 end
2033 FlexBarButton_Update(button)
2034 FlexBarButton_UpdateState(button)
2035 FB_Report(button:GetName() .. " has it's background hidden. It will show when you drag an item")
2036 end
2037  
2038 FB_ApplySettings()
2039 end
2040  
2041 function FB_Command_ShowGrid(msg)
2042 -- Hide the button background if it doesn't have an action
2043 local args = FBcmd:GetParameters(msg)
2044 -- Check basic usage
2045 if not FBcmd:CheckParameters("showgrid",args) then return end
2046 -- check here for one or the other
2047 if (args["group"]==nil) and (args["button"]==nil) then
2048 util:Print("Error: You must specify a group or button")
2049 end
2050 local buttons = FB_GetButtonList(args["button"])
2051 if (args["group"] and (type(args["group"]) == "number")) then
2052 buttons= FB_GetGroupMembers(args["group"])
2053 end
2054  
2055 local index
2056 for index = 1,buttons.n do
2057 local button, frame = FB_GetWidgets(buttons[index])
2058 if args["toggle"] and not FBState[buttons[index]]["hidegrid"] and not FBSavedProfile[FBProfileName].FlexActions[button:GetID()] then
2059 FBState[buttons[index]]["hidegrid"] = true
2060 elseif args["toggle"] and not FBState[buttons[index]]["savedgrid"] and FBSavedProfile[FBProfileName].FlexActions[button:GetID()] then
2061 FBState[buttons[index]]["savedgrid"] = true
2062 else
2063 FBState[buttons[index]]["hidegrid"] = nil
2064 FBState[buttons[index]]["savedgrid"] = nil
2065 end
2066 if FBState[buttons[index]]["hidegrid"] then
2067 button.showgrid=0
2068 frame:DisableDrawLayer()
2069 else
2070 button.showgrid=1
2071 button:Show()
2072 frame:EnableDrawLayer()
2073 end
2074 FlexBarButton_Update(button)
2075 FlexBarButton_UpdateState(button)
2076 FB_Report(button:GetName() .. " has it's background hidden. It will show when you drag an item")
2077 end
2078  
2079 FB_ApplySettings()
2080 end
2081  
2082 function FB_Command_Advanced(msg)
2083 -- Set it so that only a left click on this button will trigger it
2084 local args = FBcmd:GetParameters(msg)
2085 if not FBcmd:CheckParameters("advanced", args) then return end
2086 -- check here for one or the other
2087 if (args["group"]==nil) and (args["button"]==nil) then
2088 util:Print("Error: You must specify a group or button")
2089 end
2090 local buttons = FB_GetButtonList(args["button"])
2091 if (args["group"] and (type(args["group"]) == "number")) then
2092 buttons= FB_GetGroupMembers(args["group"])
2093 end
2094  
2095 local index
2096 for index = 1,buttons.n do
2097 local button, frame = FB_GetWidgets(buttons[index])
2098 if string.lower(args["state"]) == "on" then
2099 FBState[buttons[index]]["advanced"] = true
2100 FB_Report(button:GetName() .. " will now only fire on a left click")
2101 else
2102 FBState[buttons[index]]["advanced"] = nil;
2103 FB_Report(button:GetName() .. " will now treat all clicks the same")
2104 end
2105 end
2106 FB_ApplySettings()
2107 end
2108  
2109 function FB_Command_Use(msg)
2110 -- Use the buttons specified in Button=<buttons>
2111 -- NOTE - this appears to ONLY work on clicks (right/left)
2112 local args
2113 if FBEventArgs then
2114 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2115 args=FBEventArgs
2116 else
2117 -- otherwise this is from the command line and regular checking needs to occur
2118 args = FBcmd:GetParameters(msg)
2119 -- basic usage test
2120 if not FBcmd:CheckParameters("use", args) then return end
2121 -- check for event here - return if specified. FBEvents will be updated
2122 if FB_GetEventMsg("use", args) then return end
2123 end
2124  
2125 if FB_SetCommandTimer("use", args) then return end
2126  
2127 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2128  
2129 -- get button list
2130 local buttons = FB_GetButtonList(args["button"])
2131 if (args["group"] and (type(args["group"]) == "number")) then
2132 buttons= FB_GetGroupMembers(args["group"])
2133 end
2134 local index
2135 for index = 1,buttons.n do
2136 local button, frame = FB_GetWidgets(buttons[index])
2137 local id = button:GetID()
2138 if(MacroFrame_SaveMacro) then
2139 MacroFrame_SaveMacro()
2140 end
2141 UseAction(id, 1)
2142 end
2143 end
2144  
2145 function FB_Command_ResetAll(msg)
2146 -- Reset entire profile for character
2147 local args = FBcmd:GetParameters(msg)
2148 if not FBcmd:CheckParameters("resetall", args) then return end
2149  
2150 FBSavedProfile[FBProfileName] = nil
2151 -- Also get rid of old (pre 1.32) profile saved by name only
2152 FBSavedProfile[UnitName("player")] = nil
2153 ReloadUI()
2154 end
2155  
2156 function FB_Command_Restore(msg)
2157 -- Reset entire profile for character
2158 local args = FBcmd:GetParameters(msg)
2159 if not FBcmd:CheckParameters("restore", args) then return end
2160 if not FBProfileBackup then
2161 util:Echo("No previous profile available", "yellow")
2162 return
2163 end
2164  
2165 local index
2166 for index = 1, FBNumButtons do
2167 local button = FB_GetWidgets(index)
2168 button:SetID(index)
2169 end
2170 FBSavedProfile[FBProfileName] = util:TableCopy(FBProfileBackup)
2171 ReloadUI()
2172 end
2173  
2174 function FB_Command_LoadConfig(msg)
2175 -- Load a named config from the config file
2176 -- the naive way to do this is a simple for loop - however that cause a small
2177 -- problem by executing group commands to fast.
2178 -- altered to do one command per second.
2179 local args = FBcmd:GetParameters(msg)
2180 if not FBcmd:CheckParameters("loadconfig", args) then return end
2181 -- un auto-matable checks
2182 if type(getglobal(args["config"])) ~= "table" and not FBScripts[args["config"]] then
2183 util:Print("Error: " .. args["config"] .. " not a valid config file")
2184 return
2185 end
2186  
2187 if nextcommand ~= 0 then
2188 util:Echo("Error: Still processing last config file")
2189 return
2190 end
2191  
2192 FBProfileBackup = util:TableCopy(FBSavedProfile[FBProfileName])
2193 currentconfig = getglobal(args["config"])
2194  
2195 if not currentconfig then
2196 FB_Execute_ConfigString(FBScripts[args["config"]])
2197 return
2198 end
2199  
2200 local index, value
2201 local count = 0
2202 for index, value in ipairs(currentconfig) do
2203 count=count+1
2204 end
2205 currentconfig.n = count
2206 FBTimers["loadconfig"] = Timer_Class:New(2, nil, nil, nil, FB_Config)
2207 end
2208  
2209 function FB_Config()
2210 nextcommand = nextcommand + 1
2211 if nextcommand > currentconfig.n then
2212 nextcommand = 0
2213 currentconfig = nil
2214 return
2215 end
2216  
2217 util:Echo(currentconfig[nextcommand], "green")
2218 FBcmd:Dispatch(currentconfig[nextcommand])
2219 FBTimers["loadconfig"] = Timer_Class:New(2, nil, nil, nil, FB_Config)
2220 end
2221  
2222 function FB_Command_Disable(msg)
2223 -- Disable the regular action on a key
2224 local args
2225 if FBEventArgs then
2226 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2227 args=FBEventArgs
2228 else
2229 -- otherwise this is from the command line and regular checking needs to occur
2230 args = FBcmd:GetParameters(msg)
2231 -- basic usage test
2232 if not FBcmd:CheckParameters("disable", args) then return end
2233 -- check for event here - return if specified. FBEvents will be updated
2234 if (args["group"]==nil) and (args["button"]==nil) then
2235 util:Print("Error: You must specify a group or button")
2236 end
2237 if FB_GetEventMsg("disable", args) then return end
2238 end
2239  
2240 if FB_SetCommandTimer("disable", args) then return end
2241  
2242 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2243  
2244 local buttons = FB_GetButtonList(args["button"])
2245 if (args["group"] and (type(args["group"]) == "number")) then
2246 buttons= FB_GetGroupMembers(args["group"])
2247 end
2248  
2249 local index
2250 for index = 1,buttons.n do
2251 local button, frame = FB_GetWidgets(buttons[index])
2252 -- Toggle code - if disabled and toggle exists then enable
2253 if (args["toggle"] and FBState[buttons[index]]["disabled"]) or string.lower(args["state"]) == 'off' then
2254 FBState[buttons[index]]["disabled"] = nil
2255 FB_Report(button:GetName() .. " enabled")
2256 elseif (args["toggle"] and not FBState[buttons[index]]["disabled"]) or string.lower(args["state"]) == 'on' then
2257 FBState[buttons[index]]["disabled"] = true
2258 FB_Report(button:GetName() .. " disabled")
2259 end
2260 -- And we only save the changed setting
2261 FBSavedProfile[FBProfileName][buttons[index]].State["disabled"] = FBState[buttons[index]]["disabled"]
2262 end
2263 end
2264  
2265 function FB_Command_Raise(msg)
2266 -- Raise an event
2267 local args
2268 if FBEventArgs then
2269 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2270 args=FBEventArgs
2271 else
2272 -- otherwise this is from the command line and regular checking needs to occur
2273 args = FBcmd:GetParameters(msg)
2274 -- basic usage test
2275 if not FBcmd:CheckParameters("raise", args) then return end
2276 if args["ttoggle"] then args["toggle"] = args["ttoggle"] end
2277 if args["tname"] then args["name"] = args["tname"] end
2278 -- check for event here - return if specified. FBEvents will be updated
2279 if FB_GetEventMsg("raise", args) then return end
2280 end
2281  
2282 -- check for conditional here
2283  
2284 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2285  
2286 if args["in"] then
2287 -- if toggle is specified and timer already exists - cancel timer
2288 if (args["toggle"] and FBTimers[args["name"]] and FBTimers[args["name"]]:GetRunning()) then
2289 FBTimers[args["name"]] = nil
2290 else
2291 -- otherwise set timer
2292 FBTimers[args["name"]] = Timer_Class:New(args["in"],false,nil,nil,function() FB_RaiseEvent(args["event"],args["source"]) end)
2293 FB_Report("Raising " .. args["event"] .. " in " .. args["in"] .. " seconds");
2294 end
2295 else
2296 FB_RaiseEvent(args["event"],args["source"])
2297 FB_Report("Raised " .. args["event"])
2298 end
2299 end
2300  
2301 function FB_Command_SafeLoad(msg)
2302 -- Enable Safeload
2303 local args = FBcmd:GetParameters(msg)
2304 -- basic usage test
2305 if not FBcmd:CheckParameters("safeload", args) then return end
2306  
2307 if string.lower(args["state"]) == "on" then
2308 FBSafeLoad = true
2309 util:Echo("SAFE LOAD ENGAGED -- you will need to manually load your profile now", "green")
2310 else
2311 FBSafeLoad = nil
2312 util:Echo("SAFE LOAD DIS-ENGAGED -- profile will autoload now, if you experience lost configurations, re-enable safe load", "green")
2313 end
2314 end
2315  
2316 function FB_Command_LoadProfile(msg)
2317 -- load a profile and make current
2318 local args = FBcmd:GetParameters(msg)
2319 -- basic usage test
2320 if not FBcmd:CheckParameters("loadprofile", args) then return end
2321  
2322 if not FBSavedProfile[args["profile"]] then
2323 util:Echo("No such profile: " .. args["profile"], "yellow")
2324 else
2325 FBSavedProfile[FBProfileName] = util:TableCopy(FBSavedProfile[args["profile"]])
2326 util:Echo("Making " .. args["profile"] .. " the current profile and reloading", "green")
2327 FB_LoadProfile()
2328 end
2329 end
2330  
2331 function FB_Command_SaveProfile(msg)
2332 -- Save the current profile
2333 local args = FBcmd:GetParameters(msg)
2334 -- basic usage test
2335 if not FBcmd:CheckParameters("saveprofile", args) then return end
2336  
2337 FBSavedProfile[args["profile"]] = util:TableCopy(FBSavedProfile[FBProfileName])
2338 util:Echo("Profile: " .. args["profile"] .. " saved" )
2339 end
2340 function FB_Command_DeleteProfile(msg)
2341 -- load a profile and make current
2342 local args = FBcmd:GetParameters(msg)
2343 -- basic usage test
2344 if not FBcmd:CheckParameters("deleteprofile", args) then return end
2345  
2346 if not FBSavedProfile[args["profile"]] then
2347 util:Echo("No such profile: " .. args["profile"], "yellow")
2348 else
2349 FBSavedProfile[args["profile"]] = nil
2350 util:Echo("Profile " .. args["profile"] .. " deleted.", "green")
2351 end
2352 end
2353 function FB_Command_ListProfiles()
2354 -- list all profiles
2355 local name, profile
2356 util:Print("FlexBar Profiles:")
2357 for name, profile in ipairs(FBSavedProfile) do
2358 util:Print("'"..name.."'")
2359 end
2360 end
2361 function FB_Command_ToggleButtonInfo()
2362 if FBButtonInfoShown then
2363 FB_RestoreButtonText()
2364 else
2365 FB_ShowButtonInfo()
2366 end
2367 end
2368  
2369 function FB_Command_Scripts()
2370 -- toggle script editor window
2371 if FBScriptsFrame:IsVisible() then
2372 FBScriptsEditBox:ClearFocus()
2373 FBScriptsFrame:Hide()
2374 else
2375 FB_ShowScripts()
2376 end
2377 end
2378 function FB_Command_Events()
2379 -- toggle script editor window
2380  
2381 if FBEventEditorFrame:IsVisible() then
2382 FBEventEditorFrame:Hide()
2383 else
2384 FB_DisplayEventEditor()
2385 end
2386 end
2387 function FB_Command_Performance()
2388 -- toggle script editor window
2389 if FBPerformanceFrame:IsVisible() then
2390 FBPerformanceFrame:Hide()
2391 else
2392 FB_Show_PerformanceOptions()
2393 end
2394 end
2395 function FB_Command_AutoItems()
2396 -- toggle script editor window
2397 if FBAutoItemsFrame:IsVisible() then
2398 FBAutoItemsFrame:Hide()
2399 else
2400 FB_DisplayAutoItems()
2401 end
2402 end
2403 function FB_Command_Options()
2404 -- toggle script editor window
2405 if FBOptionsFrame:IsVisible() then
2406 FBOptionsFrame:Hide()
2407 else
2408 FB_ShowGlobalOptions()
2409 end
2410 end
2411  
2412 function FB_Command_RunScript(msg)
2413 -- Run a script from FBScripts
2414 local args
2415 if FBEventArgs then
2416 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2417 args=FBEventArgs
2418 else
2419 -- otherwise this is from the command line and regular checking needs to occur
2420 args = FBcmd:GetParameters(msg)
2421 -- basic usage test
2422 if not FBcmd:CheckParameters("runscript", args) then return end
2423 -- check for event here - return if specified. FBEvents will be updated
2424 if FB_GetEventMsg("runscript", args) then return end
2425 end
2426 -- check for conditional here
2427  
2428 if FB_SetCommandTimer("runscript", args) then return end
2429  
2430 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2431  
2432 if FBScripts[args["script"]] then
2433 -- if script is in FBScripts then run from there
2434 RunScript(FBScripts[args["script"]])
2435 else
2436 -- otherwise assume string contains script
2437 RunScript(args["script"])
2438 end
2439 end
2440  
2441 function FB_Command_RunMacro(msg)
2442 -- Run a script from FBScripts
2443 local args
2444 if FBEventArgs then
2445 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2446 args=FBEventArgs
2447 else
2448 -- otherwise this is from the command line and regular checking needs to occur
2449 args = FBcmd:GetParameters(msg)
2450 -- basic usage test
2451 if not FBcmd:CheckParameters("runmacro", args) then return end
2452 -- check for event here - return if specified. FBEvents will be updated
2453 if FB_GetEventMsg("runmacro", args) then return end
2454 end
2455  
2456 -- check for conditional here
2457  
2458 if FB_SetCommandTimer("runmacro", args) then return end
2459  
2460 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2461  
2462 if type(args["macro"]) == "table" then
2463 local index,command, longmacro
2464 longmacro = "\n"
2465 for index,command in ipairs(args["macro"]) do
2466 longmacro=longmacro..command.."\n"
2467 end
2468 FB_Execute_MultilineMacro(longmacro,"InLineMacro"..GetTime())
2469 elseif FBScripts[args["macro"]] then
2470 -- if macro is in FBScripts, run from there
2471 FB_Execute_MultilineMacro(FBScripts[args["macro"]],args["macro"])
2472 else
2473 -- otherwise assume macro is contained in the string
2474 FB_Execute_Command(args["macro"])
2475 end
2476 end
2477  
2478 function FB_Command_SetTexture(msg)
2479 -- Set a texture for an empty button.
2480 local args
2481 if FBEventArgs then
2482 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2483 args=FBEventArgs
2484 else
2485 -- otherwise this is from the command line and regular checking needs to occur
2486 args = FBcmd:GetParameters(msg)
2487 -- basic usage test
2488 if not FBcmd:CheckParameters("settexture", args) then return end
2489 -- Place advanced bounds checking here
2490 if string.lower(args["texture"]) == "%backpack" then
2491 args["texture"] = "Interface\\Buttons\\Button-BackPack-Up"
2492 end
2493 local _,_,bnum = string.find(string.lower(args["texture"]),"%%button(%d+)")
2494 if bnum then
2495 bnum = bnum + 0
2496 local button = FB_GetWidgets(bnum)
2497 if GetActionTexture(button:GetID()) then
2498 args["texture"] = GetActionTexture(button:GetID())
2499 else
2500 args["texture"] = ""
2501 end
2502 end
2503 local _,_,mnum = string.find(string.lower(args["texture"]),"%%macro(%d+)")
2504 if mnum then
2505 mnum = mnum + 0
2506 if mnum > GetNumMacroIcons() then
2507 util:Print("Error: No such icon")
2508 return
2509 else
2510 args["texture"] = GetMacroIconInfo(mnum)
2511 end
2512 end
2513 if args["texture"] == "" then args["reset"] = "true" end
2514 -- check for event here - return if specified. FBEvents will be updated
2515 if FB_GetEventMsg("settexture", args) then return end
2516 end
2517  
2518 -- check for conditional here
2519  
2520 if FB_SetCommandTimer("settexture", args) then return end
2521  
2522 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2523  
2524 if (FBSavedProfile[FBProfileName].FlexActions[args["id"]] and
2525 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] == "settexture" and
2526 args["toggle"]) or
2527 args["reset"] == "true" then
2528 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = nil
2529 else
2530 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = {}
2531 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] = "settexture"
2532 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["texture"] = args["texture"]
2533 end
2534  
2535 local index
2536 for index = 1,120 do
2537 local button = FB_GetWidgets(index)
2538 if button:GetID() == args["id"] then
2539 FlexBarButton_Update(button)
2540 FlexBarButton_UpdateUsable(button)
2541 end
2542 end
2543 end
2544  
2545 function FB_Command_FlexScript(msg)
2546 -- Set a texture for an empty button.
2547 local args
2548 if FBEventArgs then
2549 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2550 args=FBEventArgs
2551 else
2552 -- otherwise this is from the command line and regular checking needs to occur
2553 args = FBcmd:GetParameters(msg)
2554 -- basic usage test
2555 if not FBcmd:CheckParameters("flexscript", args) then return end
2556 -- Place advanced bounds checking here
2557 if HasAction(args["id"]) then
2558 util:Print("Error: Cannot place flexscript on ID with regular action")
2559 end
2560 if string.lower(args["texture"]) == "%backpack" then
2561 args["texture"] = "Interface\\Buttons\\Button-BackPack-Up"
2562 end
2563 local _,_,bnum = string.find(string.lower(args["texture"]),"%%button(%d+)")
2564 if bnum then
2565 bnum = bnum + 0
2566 local button = FB_GetWidgets(bnum)
2567 if GetActionTexture(button:GetID()) then
2568 args["texture"] = GetActionTexture(button:GetID())
2569 else
2570 args["texture"] = ""
2571 end
2572 end
2573 local _,_,mnum = string.find(string.lower(args["texture"]),"%%macro(%d+)")
2574 if mnum then
2575 mnum = mnum + 0
2576 if mnum > GetNumMacroIcons() then
2577 util:Print("Error: No such icon")
2578 return
2579 else
2580 args["texture"] = GetMacroIconInfo(mnum)
2581 end
2582 end
2583 if args["texture"] == "" then args["reset"] = "true" end
2584 end
2585  
2586  
2587 if (FBSavedProfile[FBProfileName].FlexActions[args["id"]] and
2588 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] == "script" and
2589 args["toggle"]) or
2590 args["reset"] == "true" then
2591 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = nil
2592 else
2593 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = {}
2594 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] = "script"
2595 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["texture"] = args["texture"]
2596 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["script"] = args["script"]
2597 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["name"] = args["name"]
2598 end
2599  
2600 local index
2601 for index = 1,120 do
2602 local button = FB_GetWidgets(index)
2603 if button:GetID() == args["id"] then
2604 local profile = FBSavedProfile[FBProfileName]
2605 local action = profile.FlexActions[args["id"]]
2606 local state = profile[index].State
2607 if action then
2608 state["savedgrid"] = state["hidegrid"]
2609 state["hidegrid"] = nil
2610 else
2611 state["hidegrid"] = state["savedgrid"]
2612 state["savedgrid"] = nil
2613 end
2614 FBState[index]["savedgrid"] = state["savedgrid"]
2615 FBState[index]["hidegrid"] = state["hidegrid"]
2616 FB_ApplyGrid(index)
2617 FlexBarButton_Update(button)
2618 FlexBarButton_UpdateUsable(button)
2619 FB_ResetPetItems(button)
2620 end
2621 end
2622 FB_GeneratePetIDList()
2623 FB_MimicPetButtons()
2624 end
2625  
2626 function FB_Command_FlexMacro(msg)
2627 -- Set a texture for an empty button.
2628 local args
2629 if FBEventArgs then
2630 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2631 args=FBEventArgs
2632 else
2633 -- otherwise this is from the command line and regular checking needs to occur
2634 args = FBcmd:GetParameters(msg)
2635 -- basic usage test
2636 if not FBcmd:CheckParameters("flexmacro", args) then return end
2637 -- Place advanced bounds checking here
2638 if HasAction(args["id"]) then
2639 util:Print("Error: Cannot place flexmacro on ID with regular action")
2640 end
2641 if string.lower(args["texture"]) == "%backpack" then
2642 args["texture"] = "Interface\\Buttons\\Button-BackPack-Up"
2643 end
2644 local _,_,bnum = string.find(string.lower(args["texture"]),"%%button(%d+)")
2645 if bnum then
2646 bnum = bnum + 0
2647 local button = FB_GetWidgets(bnum)
2648 if GetActionTexture(button:GetID()) then
2649 args["texture"] = GetActionTexture(button:GetID())
2650 else
2651 args["texture"] = ""
2652 end
2653 end
2654 local _,_,mnum = string.find(string.lower(args["texture"]),"%%macro(%d+)")
2655 if mnum then
2656 mnum = mnum + 0
2657 if mnum > GetNumMacroIcons() then
2658 util:Print("Error: No such icon")
2659 return
2660 else
2661 args["texture"] = GetMacroIconInfo(mnum)
2662 end
2663 end
2664 if args["texture"] == "" then args["reset"] = "true" end
2665 end
2666  
2667  
2668 if (FBSavedProfile[FBProfileName].FlexActions[args["id"]] and
2669 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] == "macro" and
2670 args["toggle"]) or
2671 args["reset"] == "true" then
2672 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = nil
2673 else
2674 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = {}
2675 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] = "macro"
2676 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["texture"] = args["texture"]
2677 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["macro"] = args["macro"]
2678 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["name"] = args["name"]
2679 end
2680  
2681 local index
2682 for index = 1,120 do
2683 local button = FB_GetWidgets(index)
2684 if button:GetID() == args["id"] then
2685 local profile = FBSavedProfile[FBProfileName]
2686 local action = profile.FlexActions[args["id"]]
2687 local state = profile[index].State
2688 if action then
2689 state["savedgrid"] = state["hidegrid"]
2690 state["hidegrid"] = nil
2691 else
2692 state["hidegrid"] = state["savedgrid"]
2693 state["savedgrid"] = nil
2694 end
2695 FBState[index]["savedgrid"] = state["savedgrid"]
2696 FBState[index]["hidegrid"] = state["hidegrid"]
2697 FB_ApplyGrid(index)
2698 FlexBarButton_Update(button)
2699 FlexBarButton_UpdateUsable(button)
2700 FB_ResetPetItems(button)
2701 end
2702 end
2703 FB_GeneratePetIDList()
2704 FB_MimicPetButtons()
2705 end
2706  
2707 function FB_Command_FlexPet(msg)
2708 -- Set a texture for an empty button.
2709 local args
2710 if FBEventArgs then
2711 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2712 args=FBEventArgs
2713 else
2714 -- otherwise this is from the command line and regular checking needs to occur
2715 args = FBcmd:GetParameters(msg)
2716 -- basic usage test
2717 if not FBcmd:CheckParameters("flexpet", args) then return end
2718 -- Place advanced bounds checking here
2719 if HasAction(args["id"]) then
2720 util:Print("Error: Cannot place flexpet on ID with regular action")
2721 return
2722 end
2723 end
2724  
2725  
2726 if (FBSavedProfile[FBProfileName].FlexActions[args["id"]] and
2727 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] == "pet" and
2728 args["toggle"]) or
2729 args["reset"] == "true" then
2730 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = nil
2731 else
2732 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = {}
2733 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["action"] = "pet"
2734 FBSavedProfile[FBProfileName].FlexActions[args["id"]]["id"] = args["petid"]
2735 end
2736  
2737 local index
2738 for index = 1,120 do
2739 local button = FB_GetWidgets(index)
2740 if button:GetID() == args["id"] then
2741 local profile = FBSavedProfile[FBProfileName]
2742 local action = profile.FlexActions[args["id"]]
2743 local state = profile[index].State
2744 if action then
2745 state["savedgrid"] = state["hidegrid"]
2746 state["hidegrid"] = nil
2747 else
2748 state["hidegrid"] = state["savedgrid"]
2749 state["savedgrid"] = nil
2750 end
2751 FBState[index]["savedgrid"] = state["savedgrid"]
2752 FBState[index]["hidegrid"] = state["hidegrid"]
2753 FB_ApplyGrid(index)
2754 FB_ResetPetItems(button)
2755 FlexBarButton_Update(button)
2756 FlexBarButton_UpdateUsable(button)
2757 end
2758 end
2759 FB_GeneratePetIDList()
2760 FB_MimicPetButtons()
2761 end
2762  
2763 function FB_Command_ClearFlex(msg)
2764 -- Set a texture for an empty button.
2765 local args
2766 if FBEventArgs then
2767 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2768 args=FBEventArgs
2769 else
2770 -- otherwise this is from the command line and regular checking needs to occur
2771 args = FBcmd:GetParameters(msg)
2772 -- basic usage test
2773 if not FBcmd:CheckParameters("clearflex", args) then return end
2774 -- Place advanced bounds checking here
2775 end
2776  
2777  
2778 FBSavedProfile[FBProfileName].FlexActions[args["id"]] = nil
2779  
2780 local index
2781 for index = 1,120 do
2782 local button = FB_GetWidgets(index)
2783 if button:GetID() == args["id"] then
2784 local profile = FBSavedProfile[FBProfileName]
2785 local action = profile.FlexActions[args["id"]]
2786 local state = profile[index].State
2787 if action then
2788 state["savedgrid"] = state["hidegrid"]
2789 state["hidegrid"] = nil
2790 else
2791 state["hidegrid"] = state["savedgrid"]
2792 state["savedgrid"] = nil
2793 end
2794 FBState[index]["savedgrid"] = state["savedgrid"]
2795 FBState[index]["hidegrid"] = state["hidegrid"]
2796 FB_ApplyGrid(index)
2797 FB_ResetPetItems(button)
2798 FlexBarButton_Update(button)
2799 FlexBarButton_UpdateUsable(button)
2800 end
2801 end
2802 end
2803  
2804 function FB_Command_Template(msg)
2805 -- template for new commands
2806 local args
2807 if FBEventArgs then
2808 -- if FBEventArgs is non-nil, then we are coming from raise event, and quick dispatch is in effect
2809 args=FBEventArgs
2810 else
2811 -- otherwise this is from the command line and regular checking needs to occur
2812 args = FBcmd:GetParameters(msg)
2813 -- basic usage test
2814 if not FBcmd:CheckParameters("template", args) then return end
2815 -- Place advanced bounds checking here
2816 -- check for event here - return if specified. FBEvents will be updated
2817 if FB_GetEventMsg("template", args) then return end
2818 end
2819  
2820 -- check for conditional here
2821 if args["if"] then if not FB_CheckConditional(args["if"]) then return end end
2822  
2823 -- perform action here
2824 end