comparison Editor.lua @ 286:77609bfa804e stable

Merge 1.1 beta 8 to stable
author Flick
date Sat, 11 Jun 2011 10:57:00 -0700
parents f2ed8a8e2320
children 0cb6a9944497
comparison
equal deleted inserted replaced
272:71d1a5e47e72 286:77609bfa804e
1 local addonName, addonTable = ... 1 local _, ns = ...
2 local ReAction = addonTable.ReAction 2 local ReAction = ns.ReAction
3 local L = ReAction.L 3 local L = ReAction.L
4 local _G = _G 4 local _G = _G
5 local wipe = wipe 5 local wipe = wipe
6 local format = string.format 6 local format = string.format
7 local InCombatLockdown = InCombatLockdown 7 local InCombatLockdown = InCombatLockdown
8 local tfetch = addonTable.tfetch 8 local tfetch = ns.tfetch
9 local tbuild = addonTable.tbuild 9 local tbuild = ns.tbuild
10 10
11 local AceConfigReg = LibStub("AceConfigRegistry-3.0") 11 local AceConfigReg = LibStub("AceConfigRegistry-3.0")
12 local AceConfigDialog = LibStub("AceConfigDialog-3.0") 12 local AceConfigDialog = LibStub("AceConfigDialog-3.0")
13 13
14 14
129 rows = { 129 rows = {
130 type = "range", 130 type = "range",
131 name = L["Rows"], 131 name = L["Rows"],
132 get = function() return self.tmp.barRows or 1 end, 132 get = function() return self.tmp.barRows or 1 end,
133 set = function(info, val) self.tmp.barRows = val end, 133 set = function(info, val) self.tmp.barRows = val end,
134 width = "full", 134 width = "double",
135 min = 1, 135 min = 1,
136 max = 32, 136 max = 32,
137 step = 1, 137 step = 1,
138 order = 2, 138 order = 2,
139 }, 139 },
140 cols = { 140 cols = {
141 type = "range", 141 type = "range",
142 name = L["Columns"], 142 name = L["Columns"],
143 get = function() return self.tmp.barCols or 12 end, 143 get = function() return self.tmp.barCols or 12 end,
144 set = function(info, val) self.tmp.barCols = val end, 144 set = function(info, val) self.tmp.barCols = val end,
145 width = "full", 145 width = "double",
146 min = 1, 146 min = 1,
147 max = 32, 147 max = 32,
148 step = 1, 148 step = 1,
149 order = 3, 149 order = 3,
150 }, 150 },
151 sz = { 151 sz = {
152 type = "range", 152 type = "range",
153 name = L["Size"], 153 name = L["Size"],
154 get = function() return self.tmp.barSize or 36 end, 154 get = function() return self.tmp.barSize or 36 end,
155 set = function(info, val) self.tmp.barSize = val end, 155 set = function(info, val) self.tmp.barSize = val end,
156 width = "full", 156 width = "double",
157 min = 10, 157 min = 10,
158 max = 72, 158 max = 72,
159 step = 1, 159 step = 1,
160 order = 4, 160 order = 4,
161 }, 161 },
162 spacing = { 162 spacing = {
163 type = "range", 163 type = "range",
164 name = L["Spacing"], 164 name = L["Spacing"],
165 get = function() return self.tmp.barSpacing or 3 end, 165 get = function() return self.tmp.barSpacing or 3 end,
166 set = function(info, val) self.tmp.barSpacing = val end, 166 set = function(info, val) self.tmp.barSpacing = val end,
167 width = "full", 167 width = "double",
168 min = 0, 168 min = 0,
169 max = 24, 169 max = 24,
170 step = 1, 170 step = 1,
171 order = 5, 171 order = 5,
172 } 172 }
253 desc = function() return bar:GetName() end, 253 desc = function() return bar:GetName() end,
254 confirm = true, 254 confirm = true,
255 func = function() ReAction:EraseBar(bar) end, 255 func = function() ReAction:EraseBar(bar) end,
256 order = 2 256 order = 2
257 }, 257 },
258 optionsHdr = {
259 type = "header",
260 name = "",
261 order = 3,
262 },
258 clickDown = { 263 clickDown = {
259 type = "toggle", 264 type = "toggle",
260 name = L["Activate on Down"], 265 name = L["Activate on Down"],
261 desc = L["Activate the button when the key or mouse button is pressed down instead of when it is released"], 266 desc = L["Activate the button when the key or mouse button is pressed down instead of when it is released"],
262 order = 3, 267 order = 4,
268 width = "full",
263 set = function(info, value) bar:GetConfig().clickDown = value; ReAction:RebuildAll() end, 269 set = function(info, value) bar:GetConfig().clickDown = value; ReAction:RebuildAll() end,
264 get = function() return bar:GetConfig().clickDown end, 270 get = function() return bar:GetConfig().clickDown end,
271 },
272 alpha = {
273 type = "range",
274 name = L["Transparency"],
275 get = function() return bar:GetAlpha() end,
276 set = function(info, val) bar:SetAlpha(val) end,
277 min = 0,
278 max = 1,
279 isPercent = true,
280 step = 0.01,
281 bigStep = 0.05,
282 order = 5,
283 },
284 grid = {
285 type = "group",
286 name = L["Button Grid"],
287 inline = true,
288 order = 6,
289 args = {
290 rows = {
291 type = "range",
292 name = L["Rows"],
293 get = function() return select(1,bar:GetButtonGrid()) end,
294 set = function(info, val) bar:SetButtonGrid(val) end,
295 width = "double",
296 min = 1,
297 max = 32,
298 step = 1,
299 order = 2,
300 },
301 cols = {
302 type = "range",
303 name = L["Columns"],
304 get = function() return select(2,bar:GetButtonGrid()) end,
305 set = function(info, val) bar:SetButtonGrid(nil,val) end,
306 width = "double",
307 min = 1,
308 max = 32,
309 step = 1,
310 order = 3,
311 },
312 sz = {
313 type = "range",
314 name = L["Size"],
315 get = function() return select(1,bar:GetButtonSize()) end,
316 set = function(info, val) bar:SetButtonSize(val,val) end,
317 width = "double",
318 min = 10,
319 max = 72,
320 step = 1,
321 order = 4,
322 },
323 spacing = {
324 type = "range",
325 name = L["Spacing"],
326 get = function() return select(3,bar:GetButtonGrid()) end,
327 set = function(info, val) bar:SetButtonGrid(nil,nil,val) end,
328 width = "double",
329 min = 0,
330 max = 24,
331 step = 1,
332 order = 5,
333 }
334 }
265 }, 335 },
266 anchor = { 336 anchor = {
267 type = "group", 337 type = "group",
268 name = L["Anchor"], 338 name = L["Anchor"],
269 inline = true, 339 inline = true,
270 order = 4, 340 order = 7,
271 args = { 341 args = {
272 frame = { 342 frame = {
273 type = "input", 343 type = "input",
274 name = L["Frame"], 344 name = L["Frame"],
275 desc = L["The frame that the bar is anchored to"], 345 desc = L["The frame that the bar is anchored to"],
329 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end, 399 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
330 order = 5 400 order = 5
331 }, 401 },
332 }, 402 },
333 }, 403 },
334 alpha = {
335 type = "range",
336 name = L["Transparency"],
337 get = function() return bar:GetAlpha() end,
338 set = function(info, val) bar:SetAlpha(val) end,
339 min = 0,
340 max = 1,
341 isPercent = true,
342 step = 0.01,
343 bigStep = 0.05,
344 order = 4,
345 },
346 }, 404 },
347 }, 405 },
348 buttonOpts = self:CreateButtonOptions(bar), 406 buttonOpts = self:CreateButtonOptions(bar),
349 stateOpts = self:CreateStateOptions(bar) 407 stateOpts = self:CreateStateOptions(bar)
350 } 408 }
422 480
423 do 481 do
424 local ActionHandler = { 482 local ActionHandler = {
425 buttonClass = ReAction.Button.Action, 483 buttonClass = ReAction.Button.Action,
426 options = { 484 options = {
427 hideEmpty = {
428 name = L["Hide Empty Buttons"],
429 order = 1,
430 type = "toggle",
431 width = "double",
432 get = "GetHideEmpty",
433 set = "SetHideEmpty",
434 },
435 lockButtons = {
436 name = L["Lock Buttons"],
437 desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
438 order = 2,
439 type = "toggle",
440 get = "GetLockButtons",
441 set = "SetLockButtons",
442 },
443 lockOnlyCombat = {
444 name = L["Only in Combat"],
445 desc = L["Only lock the buttons when in combat"],
446 order = 3,
447 type = "toggle",
448 disabled = "LockButtonsCombatDisabled",
449 get = "GetLockButtonsCombat",
450 set = "SetLockButtonsCombat",
451 },
452 pages = { 485 pages = {
453 name = L["# Pages"], 486 name = L["# Pages"],
454 desc = L["Use the Dynamic State tab to specify page transitions"], 487 desc = L["Use the Dynamic State tab to specify page transitions"],
455 order = 4, 488 order = 1,
456 type = "range", 489 type = "range",
457 min = 1, 490 min = 1,
458 max = 10, 491 max = 10,
459 step = 1, 492 step = 1,
460 get = "GetNumPages", 493 get = "GetNumPages",
461 set = "SetNumPages", 494 set = "SetNumPages",
462 }, 495 },
463 mindcontrol = { 496 mindcontrol = {
464 name = L["Mind Control Support"], 497 name = L["Mind Control Support"],
465 desc = L["When possessing a target (e.g. via Mind Control), map the first 12 buttons of this bar to the possessed target's actions."], 498 desc = L["When possessing a target (e.g. via Mind Control), map the first 12 buttons of this bar to the possessed target's actions."],
466 order = 5, 499 order = 2,
467 type = "toggle", 500 type = "toggle",
468 width = "double",
469 set = "SetMindControl", 501 set = "SetMindControl",
470 get = "GetMindControl", 502 get = "GetMindControl",
471 }, 503 },
472 vehicle = { 504 vehicle = {
473 name = L["Vehicle Support"], 505 name = L["Vehicle Support"],
474 desc = L["When on a vehicle, map the first 6 buttons of this bar to the vehicle actions. The vehicle-exit button is mapped to the 7th button. Pitch controls are not supported."], 506 desc = L["When on a vehicle, map the first 6 buttons of this bar to the vehicle actions. The vehicle-exit button is mapped to the 7th button. Pitch controls are not supported."],
475 order = 6, 507 order = 3,
476 type = "toggle", 508 type = "toggle",
477 width = "double",
478 get = "GetVehicle", 509 get = "GetVehicle",
479 set = "SetVehicle", 510 set = "SetVehicle",
511 },
512 hideEmpty = {
513 name = L["Hide Empty Buttons"],
514 order = 4,
515 type = "toggle",
516 width = "full",
517 get = "GetHideEmpty",
518 set = "SetHideEmpty",
519 },
520 lockButtons = {
521 name = L["Lock Buttons"],
522 desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
523 order = 5,
524 width = "full",
525 type = "toggle",
526 get = "GetLockButtons",
527 set = "SetLockButtons",
528 },
529 lockOnlyCombat = {
530 name = L["Only in Combat"],
531 desc = L["Only lock the buttons when in combat"],
532 order = 6,
533 width = "full",
534 type = "toggle",
535 disabled = "LockButtonsCombatDisabled",
536 get = "GetLockButtonsCombat",
537 set = "SetLockButtonsCombat",
480 }, 538 },
481 actions = { 539 actions = {
482 name = L["Edit Action IDs"], 540 name = L["Edit Action IDs"],
483 order = 7, 541 order = 7,
484 type = "group", 542 type = "group",
486 args = { 544 args = {
487 method = { 545 method = {
488 name = L["Assign"], 546 name = L["Assign"],
489 order = 1, 547 order = 1,
490 type = "select", 548 type = "select",
491 width = "double", 549 width = "full",
492 values = { [0] = L["Choose Method..."], 550 values = { [0] = L["Choose Method..."],
493 [1] = L["Individually"], 551 [1] = L["Individually"],
494 [2] = L["All at Once"], }, 552 [2] = L["All at Once"], },
495 get = "GetActionEditMethod", 553 get = "GetActionEditMethod",
496 set = "SetActionEditMethod", 554 set = "SetActionEditMethod",
1004 ordering = { 1062 ordering = {
1005 name = L["Info"], 1063 name = L["Info"],
1006 order = 1, 1064 order = 1,
1007 type = "group", 1065 type = "group",
1008 args = { 1066 args = {
1009 delete = {
1010 name = L["Delete this State"],
1011 order = -1,
1012 type = "execute",
1013 func = "DeleteState",
1014 },
1015 rename = { 1067 rename = {
1016 name = L["Name"], 1068 name = L["Name"],
1017 order = 1, 1069 order = 1,
1018 type = "input", 1070 type = "input",
1019 get = "GetName", 1071 get = "GetName",
1020 set = "SetStateName", 1072 set = "SetStateName",
1021 pattern = "^%w*$", 1073 pattern = "^%w*$",
1022 usage = L["State names must be alphanumeric without spaces"], 1074 usage = L["State names must be alphanumeric without spaces"],
1023 }, 1075 },
1076 delete = {
1077 name = L["Delete this State"],
1078 order = 2,
1079 type = "execute",
1080 func = "DeleteState",
1081 confirm = true,
1082 },
1024 ordering = { 1083 ordering = {
1025 name = L["Evaluation Order"], 1084 name = L["Evaluation Order"],
1026 desc = L["State transitions are evaluated in the order listed: Move a state up or down to change the order"], 1085 desc = L["State transitions are evaluated in the order listed: Move a state up or down to change the order"],
1027 order = 2, 1086 order = 3,
1028 type = "group", 1087 type = "group",
1029 inline = true, 1088 inline = true,
1030 args = { 1089 args = {
1031 up = { 1090 up = {
1032 name = L["Up"], 1091 name = L["Up"],
1068 get = "GetPage", 1127 get = "GetPage",
1069 }, 1128 },
1070 hide = { 1129 hide = {
1071 name = L["Hide Bar"], 1130 name = L["Hide Bar"],
1072 order = 90, 1131 order = 90,
1132 width = "full",
1073 type = "toggle", 1133 type = "toggle",
1074 set = "SetProp", 1134 set = "SetProp",
1075 get = "GetProp", 1135 get = "GetProp",
1076 }, 1136 },
1077 --[[ BROKEN 1137 --[[ BROKEN
1081 order = 91, 1141 order = 91,
1082 type = "toggle", 1142 type = "toggle",
1083 set = "SetProp", 1143 set = "SetProp",
1084 get = "GetProp", 1144 get = "GetProp",
1085 }, ]] 1145 }, ]]
1086 position = { 1146
1147 anchorEnable = {
1148 name = L["Reposition"],
1149 order = 111,
1150 type = "toggle",
1151 set = "SetProp",
1152 get = "GetProp",
1153 },
1154 anchorGroup = {
1087 name = L["Position"], 1155 name = L["Position"],
1088 order = 92, 1156 order = 112,
1089 type = "group", 1157 type = "group",
1090 inline = true, 1158 inline = true,
1159 disabled = "GetAnchorDisabled",
1091 args = { 1160 args = {
1092 anchorEnable = {
1093 name = L["Reposition"],
1094 order = 1,
1095 type = "toggle",
1096 set = "SetProp",
1097 get = "GetProp",
1098 },
1099 anchorFrame = { 1161 anchorFrame = {
1100 name = L["Anchor Frame"], 1162 name = L["Anchor Frame"],
1101 order = 2, 1163 order = 1,
1102 type = "select", 1164 type = "select",
1103 values = "GetAnchorFrames", 1165 values = "GetAnchorFrames",
1104 set = "SetAnchorFrame", 1166 set = "SetAnchorFrame",
1105 get = "GetAnchorFrame", 1167 get = "GetAnchorFrame",
1106 disabled = "GetAnchorDisabled",
1107 hidden = "GetAnchorDisabled",
1108 }, 1168 },
1109 anchorPoint = { 1169 anchorPoint = {
1110 name = L["Point"], 1170 name = L["Point"],
1171 order = 2,
1172 type = "select",
1173 values = pointTable,
1174 set = "SetAnchorPointProp",
1175 get = "GetAnchorPointProp",
1176 },
1177 anchorRelPoint = {
1178 name = L["Relative Point"],
1111 order = 3, 1179 order = 3,
1112 type = "select", 1180 type = "select",
1113 values = pointTable, 1181 values = pointTable,
1114 set = "SetAnchorPointProp", 1182 set = "SetAnchorPointProp",
1115 get = "GetAnchorPointProp", 1183 get = "GetAnchorPointProp",
1116 disabled = "GetAnchorDisabled",
1117 hidden = "GetAnchorDisabled",
1118 },
1119 anchorRelPoint = {
1120 name = L["Relative Point"],
1121 order = 4,
1122 type = "select",
1123 values = pointTable,
1124 set = "SetAnchorPointProp",
1125 get = "GetAnchorPointProp",
1126 disabled = "GetAnchorDisabled",
1127 hidden = "GetAnchorDisabled",
1128 }, 1184 },
1129 anchorX = { 1185 anchorX = {
1130 name = L["X Offset"], 1186 name = L["X Offset"],
1187 order = 4,
1188 type = "range",
1189 min = -100,
1190 max = 100,
1191 step = 1,
1192 set = "SetProp",
1193 get = "GetProp",
1194 },
1195 anchorY = {
1196 name = L["Y Offset"],
1131 order = 5, 1197 order = 5,
1132 type = "range", 1198 type = "range",
1133 min = -100, 1199 min = -100,
1134 max = 100, 1200 max = 100,
1135 step = 1, 1201 step = 1,
1136 set = "SetProp", 1202 set = "SetProp",
1137 get = "GetProp", 1203 get = "GetProp",
1138 disabled = "GetAnchorDisabled",
1139 hidden = "GetAnchorDisabled",
1140 },
1141 anchorY = {
1142 name = L["Y Offset"],
1143 order = 6,
1144 type = "range",
1145 min = -100,
1146 max = 100,
1147 step = 1,
1148 set = "SetProp",
1149 get = "GetProp",
1150 disabled = "GetAnchorDisabled",
1151 hidden = "GetAnchorDisabled",
1152 }, 1204 },
1153 }, 1205 },
1154 }, 1206 },
1155 scale = { 1207
1208 enableScale = {
1209 name = L["Set New Scale"],
1210 order = 121,
1211 type = "toggle",
1212 set = "SetProp",
1213 get = "GetProp",
1214 },
1215 scaleGroup = {
1156 name = L["Scale"], 1216 name = L["Scale"],
1157 order = 93, 1217 order = 122,
1158 type = "group", 1218 type = "group",
1159 inline = true, 1219 inline = true,
1220 disabled = "GetScaleDisabled",
1160 args = { 1221 args = {
1161 enableScale = {
1162 name = L["Set New Scale"],
1163 order = 1,
1164 type = "toggle",
1165 set = "SetProp",
1166 get = "GetProp",
1167 },
1168 scale = { 1222 scale = {
1169 name = L["Scale"], 1223 name = L["Scale"],
1170 order = 2, 1224 order = 1,
1171 type = "range", 1225 type = "range",
1172 min = 0.25, 1226 min = 0.25,
1173 max = 2.5, 1227 max = 2.5,
1174 step = 0.05, 1228 step = 0.05,
1175 isPercent = true, 1229 isPercent = true,
1176 set = "SetProp", 1230 set = "SetProp",
1177 get = "GetScale", 1231 get = "GetScale",
1178 disabled = "GetScaleDisabled",
1179 hidden = "GetScaleDisabled",
1180 }, 1232 },
1181 }, 1233 },
1182 }, 1234 },
1183 alpha = { 1235
1236 enableAlpha = {
1237 name = L["Set Transparency"],
1238 order = 131,
1239 type = "toggle",
1240 set = "SetProp",
1241 get = "GetProp",
1242 },
1243 alphaGroup = {
1184 name = L["Transparency"], 1244 name = L["Transparency"],
1185 order = 94, 1245 order = 132,
1186 type = "group", 1246 type = "group",
1187 inline = true, 1247 inline = true,
1248 disabled = "GetAlphaDisabled",
1188 args = { 1249 args = {
1189 enableAlpha = {
1190 name = L["Set Transparency"],
1191 order = 1,
1192 type = "toggle",
1193 set = "SetProp",
1194 get = "GetProp",
1195 },
1196 alpha = { 1250 alpha = {
1197 name = L["Transparency"], 1251 name = L["Transparency"],
1198 order = 2, 1252 order = 1,
1199 type = "range", 1253 type = "range",
1200 min = 0, 1254 min = 0,
1201 max = 1, 1255 max = 1,
1202 step = 0.01, 1256 step = 0.01,
1203 bigStep = 0.05, 1257 bigStep = 0.05,
1204 isPercent = true, 1258 isPercent = true,
1205 set = "SetProp", 1259 set = "SetProp",
1206 get = "GetAlpha", 1260 get = "GetAlpha",
1207 disabled = "GetAlphaDisabled",
1208 hidden = "GetAlphaDisabled",
1209 }, 1261 },
1210 }, 1262 },
1211 }, 1263 },
1212 }, 1264 },
1213 plugins = { } 1265 plugins = { }
1219 args = { 1271 args = {
1220 mode = { 1272 mode = {
1221 name = L["Select this state"], 1273 name = L["Select this state"],
1222 order = 2, 1274 order = 2,
1223 type = "select", 1275 type = "select",
1224 style = "radio", 1276 style = "dropdown",
1225 values = { 1277 values = {
1226 default = L["by default"], 1278 default = L["by default"],
1227 any = L["when ANY of these"], 1279 any = L["when ANY of these"],
1228 all = L["when ALL of these"], 1280 all = L["when ALL of these"],
1229 custom = L["via custom rule"], 1281 custom = L["via custom rule"],
1679 ReAction:UserError(format(L["State named '%s' already exists"],name)) 1731 ReAction:UserError(format(L["State named '%s' already exists"],name))
1680 else 1732 else
1681 -- TODO: select default state options and pass as final argument 1733 -- TODO: select default state options and pass as final argument
1682 states[name] = { } 1734 states[name] = { }
1683 optionMap[bar].args[name] = CreateStateOptions(bar,name) 1735 optionMap[bar].args[name] = CreateStateOptions(bar,name)
1684 ReAction:ShowEditor(bar, moduleID, name) 1736 ReAction:ShowEditor(bar, "stateOpts", name)
1685 private.newstatename = "" 1737 private.newstatename = ""
1686 end 1738 end
1687 end, 1739 end,
1688 disabled = function() 1740 disabled = function()
1689 local name = private.newstatename or "" 1741 local name = private.newstatename or ""