vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 -- functions that will return a list of appropriate values for the parameters - if they exist
2 --[[
3 PROCEDURE FOR ADDING COMMANDS
4 1. Insert the command in the FBGUICommandList
5 2. Insert a list of paramaters for your command in FBGUIParamList - you can use [ and ] to denote optional parameters
6 3. For any parameters that are not already in FBGUIParamValues do the following:
7 A. Insert a function in FBGUIParamValues to return a list of possible values for the parameter.
8 B. Insert a callback function to insert the chosen value into the editbox - see examples.
9 NOTE - for any paramters for which it is impossible to iterate potential values, put in "No Values Available" and
10 have the callback simply hide.
11  
12 08/12/2005 Added text3 field - Sherkhan
13  
14 --]]
15 -- List of commands available in On=
16 FBGUICommandList = {"show","hide","fade","shade","scale","moveabs","moverel","movetomouse",
17 "remap","echo","use","runscript","runmacro","text","text2", "text3","raise","settexture",
18 "shadetext","shadetext2","shadetext3"}
19 -- for each command, a list of parameters unique to them -- [] mean optional
20 FBGUIParamList = {
21 ["show"] = {"[button]","[group]","[toggle]"},
22 ["hide"] = {"[button]","[group]","[toggle]"},
23 ["fade"] = {"[button]","[group]","alpha","[toggle]"},
24 ["shade"] = {"[button]","[group]","color","[toggle]","[reset]"},
25 ["scale"] = {"[button]","[group]","scale","[toggle]"},
26 ["moveabs"] = {"button","xx","yy"},
27 ["moverel"] = {"button","trgbtn","dx","dy"},
28 ["movetomouse"]={"button","dx","dy"},
29 ["remap"] = {"[button]","[group]","base","[toggle]","[reset]"},
30 ["echo"] = {"[button]","[group]","base","[toggle]","[reset]"},
31 ["use"] = {"button"},
32 ["runscript"]= {"script"},
33 ["runmacro"]= {"macro"},
34 ["text"] = {"[button]","[group]","[text]"},
35 ["text2"] = {"[button]","[group]","[text]"},
36 ["text3"] = {"[button]","[group]","[text]"},
37 ["raise"] = {"event","[source]"},
38 ["settexture"]= {"button","[texture]","[toggle]","[reset]"},
39 ["textshade"]= {"[button]","[group]","color","[toggle]","[reset]"},
40 ["textshade2"]= {"[button]","[group]","color","[toggle]","[reset]"},
41 ["textshade3"]= {"[button]","[group]","color","[toggle]","[reset]"},
42 }
43  
44 FBGUIParamValues = {}
45 FBGUIParamValues["scale"] =
46 function()
47 return FBCompleteScaleList
48 end
49 FBGUIParamValues["base"] =
50 function()
51 return FBCompleteIDList
52 end
53 FBGUIParamValues["alpha"] =
54 function()
55 return FBCompleteAlphaList
56 end
57 FBGUIParamValues["trgbtn"] =
58 function()
59 return FBCompleteButtonList
60 end
61 FBGUIParamValues["button"] =
62 function()
63 return FBCompleteButtonList
64 end
65 FBGUIParamValues["script"] =
66 function()
67 local i,v
68 local returnvalue = {}
69 for i,v in pairs(FBScripts) do
70 table.insert(returnvalue,"'"..i.."'")
71 end
72 table.sort(returnvalue,function(v1,v2) return string.lower(v1)<string.lower(v2) end)
73 return returnvalue
74 end
75 FBGUIParamValues["macro"] =
76 function()
77 local i,v
78 local returnvalue = {}
79 for i,v in pairs(FBScripts) do
80 table.insert(returnvalue,"'"..i.."'")
81 end
82 table.sort(returnvalue,function(v1,v2) return string.lower(v1)<string.lower(v2) end)
83 return returnvalue
84 end
85 FBGUIParamValues["texture"] =
86 function()
87 return FBCompleteTextureList
88 end
89 FBGUIParamValues["group"] =
90 function()
91 local i,v
92 local returnvalue = {}
93 for i,v in pairs(FBGroupData) do
94 table.insert(returnvalue,i)
95 end
96 return returnvalue
97 end
98 FBGUIParamValues["text"] =
99 function()
100 return FBCompleteTextVarList
101 end
102 FBGUIParamValues["color"] =
103 function()
104 return FBColorList
105 end
106 FBGUIParamValues["on"] =
107 function()
108 local returnvalue = {}
109 local i,v
110 for i,v in pairs(FBEventGroups) do
111 table.insert(returnvalue,"'"..i.."'")
112 end
113 table.sort(returnvalue,function(v1,v2) return string.lower(v1)<string.lower(v2) end)
114 return returnvalue
115 end
116 FBGUIParamValues["if"] =
117 function()
118 local returnvalue = {}
119 local i,v
120 for i,v in pairs(FBConditions) do
121 table.insert(returnvalue,i)
122 end
123 table.sort(returnvalue,function(v1,v2) return string.lower(v1)<string.lower(v2) end)
124 return returnvalue
125 end
126 FBGUIParamValues["ifops"] =
127 function()
128 return FBIfOpsList
129 end
130 FBGUIParamValues["target"] =
131 function()
132 return FBGUIEventTargets[string.sub(string.lower(FBEventEditorFrameEventEdit:GetText()),2,-2)]()
133 end
134 FBGUIParamValues["command"] = function() return FBGUICommandList end
135 FBGUIParamValues["reset"] = function() return FBTrueList end
136 FBGUIParamValues["toggle"] = function() return FBTrueList end
137 FBGUIParamValues["ttoggle"] = function() return FBTrueList end
138 FBGUIParamValues["event"] = function() return FBNoValuesList end
139 FBGUIParamValues["source"] = function() return FBNoValuesList end
140 FBGUIParamValues["xx"] = function() return FBNoValuesList end
141 FBGUIParamValues["yy"] = function() return FBNoValuesList end
142 FBGUIParamValues["dx"] = function() return FBNoValuesList end
143 FBGUIParamValues["dy"] = function() return FBNoValuesList end
144  
145  
146 -- Call backs for each parameter menu
147 FBGUIParamCallbacks = {}
148 FBGUIParamCallbacks["if"] =
149 function(value,action,name)
150 if action ~= "click" then return end
151 local text = FBEventEditorFrame.CurrentEdit:GetText()
152 if not FB_InTable(value,{"and","not","or","(",")"}) then value = value.."<>" end
153 if string.sub(text,1,1) == "'" then text = string.sub(text,2) end
154 if string.sub(text,1,1) == " " then text = string.sub(text,2) end
155 if string.sub(text,-1,-1) == "'" then text = string.sub(text,1,-2) end
156 text = "'"..text.." "..value.."'"
157 FBEventEditorFrame.CurrentEdit:SetText(text)
158 FBEventEditorFrame.CurrentEdit:SetFocus()
159 end
160 FBGUIParamCallbacks["target"] =
161 function(value,action,name)
162 if action ~= "click" then return end
163 if value == "No Target Needed" then return end
164 local text = FBEventEditorFrame.CurrentEdit:GetText()
165 if string.sub(text,1,1) == "[" then
166 text = string.sub(text,2,-2)
167 end
168 text = "["..text..value.." ".."]"
169 FBEventEditorFrame.CurrentEdit:SetText(text)
170 FBEventEditorFrame.CurrentEdit:SetFocus()
171 end
172 FBGUIParamCallbacks["alpha"] =
173 function(value,action,name)
174 if action ~= "click" then return end
175 FBEventEditorFrame.CurrentEdit:SetText(value)
176 getglobal(name):GetParent():Hide()
177 FBEventEditorFrame.CurrentEdit:SetFocus()
178 end
179 FBGUIParamCallbacks["base"] =
180 function(value,action,name)
181 if action ~= "click" then return end
182 FBEventEditorFrame.CurrentEdit:SetText(value)
183 getglobal(name):GetParent():Hide()
184 FBEventEditorFrame.CurrentEdit:SetFocus()
185 end
186 FBGUIParamCallbacks["button"] =
187 function(value,action,name)
188 if action ~= "click" then return end
189 local text = FBEventEditorFrame.CurrentEdit:GetText()
190 if string.sub(text,1,1) == "[" then
191 text = string.sub(text,2,-2)
192 end
193 text = "["..text..value.." ".."]"
194 FBEventEditorFrame.CurrentEdit:SetText(text)
195 FBEventEditorFrame.CurrentEdit:SetFocus()
196 end
197 FBGUIParamCallbacks["color"] =
198 function(value,action,name)
199 if action ~= "click" then return end
200 local firsti = string.find(value," %- ")
201 value = string.sub(value,1,firsti - 1)
202 FBEventEditorFrame.CurrentEdit:SetText(value)
203 getglobal(name):GetParent():Hide()
204 FBEventEditorFrame.CurrentEdit:SetFocus()
205 end
206 FBGUIParamCallbacks["command"] =
207 function(value,action,name)
208 if action ~= "click" then return end
209 FBEventEditorFrame.CurrentEdit:SetText(value)
210 getglobal(name):GetParent():Hide()
211 FB_Set_Parameters(value)
212 FBEventEditorFrame.CurrentEdit:SetFocus()
213 end
214 FBGUIParamCallbacks["dx"] =
215 function(value,action,name)
216 if action ~= "click" then return end
217 getglobal(name):GetParent():Hide()
218 FBEventEditorFrame.CurrentEdit:SetFocus()
219 end
220 FBGUIParamCallbacks["dy"] =
221 function(value,action,name)
222 if action ~= "click" then return end
223 getglobal(name):GetParent():Hide()
224 FBEventEditorFrame.CurrentEdit:SetFocus()
225 end
226 FBGUIParamCallbacks["event"] =
227 function(value,action,name)
228 if action ~= "click" then return end
229 FBEventEditorFrame.CurrentEdit:SetText(value)
230 getglobal(name):GetParent():Hide()
231 FBEventEditorFrame.CurrentEdit:SetFocus()
232 end
233 FBGUIParamCallbacks["on"] =
234 function(value,action,name)
235 if action ~= "click" then return end
236 FBEventEditorFrame.CurrentEdit:SetText(value)
237 getglobal(name):GetParent():Hide()
238 FBEventEditorFrameTargetMenu:Show()
239 FBEventEditorFrame.CurrentEdit:SetFocus()
240 end
241 FBGUIParamCallbacks["group"] =
242 function(value,action,name)
243 if action ~= "click" then return end
244 FBEventEditorFrame.CurrentEdit:SetText(value)
245 getglobal(name):GetParent():Hide()
246 FBEventEditorFrame.CurrentEdit:SetFocus()
247 end
248 FBGUIParamCallbacks["macro"] =
249 function(value,action,name)
250 if action ~= "click" then return end
251 FBEventEditorFrame.CurrentEdit:SetText(value)
252 getglobal(name):GetParent():Hide()
253 FBEventEditorFrame.CurrentEdit:SetFocus()
254 end
255 FBGUIParamCallbacks["reset"] =
256 function(value,action,name)
257 if action ~= "click" then return end
258 FBEventEditorFrame.CurrentEdit:SetText(value)
259 getglobal(name):GetParent():Hide()
260 FBEventEditorFrame.CurrentEdit:SetFocus()
261 end
262 FBGUIParamCallbacks["scale"] =
263 function(value,action,name)
264 if action ~= "click" then return end
265 FBEventEditorFrame.CurrentEdit:SetText(value)
266 getglobal(name):GetParent():Hide()
267 FBEventEditorFrame.CurrentEdit:SetFocus()
268 end
269 FBGUIParamCallbacks["script"] =
270 function(value,action,name)
271 if action ~= "click" then return end
272 FBEventEditorFrame.CurrentEdit:SetText(value)
273 getglobal(name):GetParent():Hide()
274 FBEventEditorFrame.CurrentEdit:SetFocus()
275 end
276 FBGUIParamCallbacks["source"] =
277 function(value,action,name)
278 if action ~= "click" then return end
279 getglobal(name):GetParent():Hide()
280 FBEventEditorFrame.CurrentEdit:SetFocus()
281 end
282 FBGUIParamCallbacks["text"] =
283 function(value,action,name)
284 if action ~= "click" then return end
285 FBEventEditorFrame.CurrentEdit:SetText(value)
286 getglobal(name):GetParent():Hide()
287 FBEventEditorFrame.CurrentEdit:SetFocus()
288 end
289 FBGUIParamCallbacks["texture"] =
290 function(value,action,name)
291 if action ~= "click" then return end
292 FBEventEditorFrame.CurrentEdit:SetText(value)
293 getglobal(name):GetParent():Hide()
294 FBEventEditorFrame.CurrentEdit:SetFocus()
295 end
296 FBGUIParamCallbacks["toggle"] =
297 function(value,action,name)
298 if action ~= "click" then return end
299 FBEventEditorFrame.CurrentEdit:SetText(value)
300 getglobal(name):GetParent():Hide()
301 FBEventEditorFrame.CurrentEdit:SetFocus()
302 end
303 FBGUIParamCallbacks["ttoggle"] =
304 function(value,action,name)
305 if action ~= "click" then return end
306 FBEventEditorFrame.CurrentEdit:SetText(value)
307 getglobal(name):GetParent():Hide()
308 util:Print(name)
309 FBEventEditorFrame.CurrentEdit:SetFocus()
310 end
311 FBGUIParamCallbacks["trgbtn"] =
312 function(value,action,name)
313 if action ~= "click" then return end
314 local text = FBEventEditorFrame.CurrentEdit:GetText()
315 if string.sub(text,1,1) == "[" then
316 text = string.sub(text,2,-2)
317 end
318 text = "["..text..value.." ".."]"
319 FBEventEditorFrame.CurrentEdit:SetText(text)
320 FBEventEditorFrame.CurrentEdit:SetFocus()
321 end
322 FBGUIParamCallbacks["xx"] =
323 function(value,action,name)
324 if action ~= "click" then return end
325 getglobal(name):GetParent():Hide()
326 FBEventEditorFrame.CurrentEdit:SetFocus()
327 end
328 FBGUIParamCallbacks["yy"] =
329 function(value,action,name)
330 if action ~= "click" then return end
331 getglobal(name):GetParent():Hide()
332 FBEventEditorFrame.CurrentEdit:SetFocus()
333 end