comparison Editor.lua @ 269:c27596828276

Editor layout cleanup
author Flick
date Tue, 10 May 2011 17:23:21 -0700
parents 5694618cef7f
children 36a29870bf34
comparison
equal deleted inserted replaced
267:fc79c85ab7a5 269:c27596828276
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,
265 }, 283 },
266 anchor = { 284 anchor = {
267 type = "group", 285 type = "group",
268 name = L["Anchor"], 286 name = L["Anchor"],
269 inline = true, 287 inline = true,
270 order = 4, 288 order = 6,
271 args = { 289 args = {
272 frame = { 290 frame = {
273 type = "input", 291 type = "input",
274 name = L["Frame"], 292 name = L["Frame"],
275 desc = L["The frame that the bar is anchored to"], 293 desc = L["The frame that the bar is anchored to"],
329 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end, 347 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
330 order = 5 348 order = 5
331 }, 349 },
332 }, 350 },
333 }, 351 },
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 }, 352 },
347 }, 353 },
348 buttonOpts = self:CreateButtonOptions(bar), 354 buttonOpts = self:CreateButtonOptions(bar),
349 stateOpts = self:CreateStateOptions(bar) 355 stateOpts = self:CreateStateOptions(bar)
350 } 356 }
422 428
423 do 429 do
424 local ActionHandler = { 430 local ActionHandler = {
425 buttonClass = ReAction.Button.Action, 431 buttonClass = ReAction.Button.Action,
426 options = { 432 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 = { 433 pages = {
453 name = L["# Pages"], 434 name = L["# Pages"],
454 desc = L["Use the Dynamic State tab to specify page transitions"], 435 desc = L["Use the Dynamic State tab to specify page transitions"],
455 order = 4, 436 order = 1,
456 type = "range", 437 type = "range",
457 min = 1, 438 min = 1,
458 max = 10, 439 max = 10,
459 step = 1, 440 step = 1,
460 get = "GetNumPages", 441 get = "GetNumPages",
461 set = "SetNumPages", 442 set = "SetNumPages",
462 }, 443 },
463 mindcontrol = { 444 mindcontrol = {
464 name = L["Mind Control Support"], 445 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."], 446 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, 447 order = 2,
467 type = "toggle", 448 type = "toggle",
468 width = "double",
469 set = "SetMindControl", 449 set = "SetMindControl",
470 get = "GetMindControl", 450 get = "GetMindControl",
471 }, 451 },
472 vehicle = { 452 vehicle = {
473 name = L["Vehicle Support"], 453 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."], 454 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, 455 order = 3,
476 type = "toggle", 456 type = "toggle",
477 width = "double",
478 get = "GetVehicle", 457 get = "GetVehicle",
479 set = "SetVehicle", 458 set = "SetVehicle",
459 },
460 hideEmpty = {
461 name = L["Hide Empty Buttons"],
462 order = 4,
463 type = "toggle",
464 width = "full",
465 get = "GetHideEmpty",
466 set = "SetHideEmpty",
467 },
468 lockButtons = {
469 name = L["Lock Buttons"],
470 desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
471 order = 5,
472 width = "full",
473 type = "toggle",
474 get = "GetLockButtons",
475 set = "SetLockButtons",
476 },
477 lockOnlyCombat = {
478 name = L["Only in Combat"],
479 desc = L["Only lock the buttons when in combat"],
480 order = 6,
481 width = "full",
482 type = "toggle",
483 disabled = "LockButtonsCombatDisabled",
484 get = "GetLockButtonsCombat",
485 set = "SetLockButtonsCombat",
480 }, 486 },
481 actions = { 487 actions = {
482 name = L["Edit Action IDs"], 488 name = L["Edit Action IDs"],
483 order = 7, 489 order = 7,
484 type = "group", 490 type = "group",
486 args = { 492 args = {
487 method = { 493 method = {
488 name = L["Assign"], 494 name = L["Assign"],
489 order = 1, 495 order = 1,
490 type = "select", 496 type = "select",
491 width = "double", 497 width = "full",
492 values = { [0] = L["Choose Method..."], 498 values = { [0] = L["Choose Method..."],
493 [1] = L["Individually"], 499 [1] = L["Individually"],
494 [2] = L["All at Once"], }, 500 [2] = L["All at Once"], },
495 get = "GetActionEditMethod", 501 get = "GetActionEditMethod",
496 set = "SetActionEditMethod", 502 set = "SetActionEditMethod",
1004 ordering = { 1010 ordering = {
1005 name = L["Info"], 1011 name = L["Info"],
1006 order = 1, 1012 order = 1,
1007 type = "group", 1013 type = "group",
1008 args = { 1014 args = {
1009 delete = {
1010 name = L["Delete this State"],
1011 order = -1,
1012 type = "execute",
1013 func = "DeleteState",
1014 },
1015 rename = { 1015 rename = {
1016 name = L["Name"], 1016 name = L["Name"],
1017 order = 1, 1017 order = 1,
1018 type = "input", 1018 type = "input",
1019 get = "GetName", 1019 get = "GetName",
1020 set = "SetStateName", 1020 set = "SetStateName",
1021 pattern = "^%w*$", 1021 pattern = "^%w*$",
1022 usage = L["State names must be alphanumeric without spaces"], 1022 usage = L["State names must be alphanumeric without spaces"],
1023 }, 1023 },
1024 delete = {
1025 name = L["Delete this State"],
1026 order = 2,
1027 type = "execute",
1028 func = "DeleteState",
1029 confirm = true,
1030 },
1024 ordering = { 1031 ordering = {
1025 name = L["Evaluation Order"], 1032 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"], 1033 desc = L["State transitions are evaluated in the order listed: Move a state up or down to change the order"],
1027 order = 2, 1034 order = 3,
1028 type = "group", 1035 type = "group",
1029 inline = true, 1036 inline = true,
1030 args = { 1037 args = {
1031 up = { 1038 up = {
1032 name = L["Up"], 1039 name = L["Up"],
1068 get = "GetPage", 1075 get = "GetPage",
1069 }, 1076 },
1070 hide = { 1077 hide = {
1071 name = L["Hide Bar"], 1078 name = L["Hide Bar"],
1072 order = 90, 1079 order = 90,
1080 width = "full",
1073 type = "toggle", 1081 type = "toggle",
1074 set = "SetProp", 1082 set = "SetProp",
1075 get = "GetProp", 1083 get = "GetProp",
1076 }, 1084 },
1077 --[[ BROKEN 1085 --[[ BROKEN
1081 order = 91, 1089 order = 91,
1082 type = "toggle", 1090 type = "toggle",
1083 set = "SetProp", 1091 set = "SetProp",
1084 get = "GetProp", 1092 get = "GetProp",
1085 }, ]] 1093 }, ]]
1086 position = { 1094
1095 anchorEnable = {
1096 name = L["Reposition"],
1097 order = 111,
1098 type = "toggle",
1099 set = "SetProp",
1100 get = "GetProp",
1101 },
1102 anchorGroup = {
1087 name = L["Position"], 1103 name = L["Position"],
1088 order = 92, 1104 order = 112,
1089 type = "group", 1105 type = "group",
1090 inline = true, 1106 inline = true,
1107 disabled = "GetAnchorDisabled",
1091 args = { 1108 args = {
1092 anchorEnable = {
1093 name = L["Reposition"],
1094 order = 1,
1095 type = "toggle",
1096 set = "SetProp",
1097 get = "GetProp",
1098 },
1099 anchorFrame = { 1109 anchorFrame = {
1100 name = L["Anchor Frame"], 1110 name = L["Anchor Frame"],
1101 order = 2, 1111 order = 1,
1102 type = "select", 1112 type = "select",
1103 values = "GetAnchorFrames", 1113 values = "GetAnchorFrames",
1104 set = "SetAnchorFrame", 1114 set = "SetAnchorFrame",
1105 get = "GetAnchorFrame", 1115 get = "GetAnchorFrame",
1106 disabled = "GetAnchorDisabled",
1107 hidden = "GetAnchorDisabled",
1108 }, 1116 },
1109 anchorPoint = { 1117 anchorPoint = {
1110 name = L["Point"], 1118 name = L["Point"],
1119 order = 2,
1120 type = "select",
1121 values = pointTable,
1122 set = "SetAnchorPointProp",
1123 get = "GetAnchorPointProp",
1124 },
1125 anchorRelPoint = {
1126 name = L["Relative Point"],
1111 order = 3, 1127 order = 3,
1112 type = "select", 1128 type = "select",
1113 values = pointTable, 1129 values = pointTable,
1114 set = "SetAnchorPointProp", 1130 set = "SetAnchorPointProp",
1115 get = "GetAnchorPointProp", 1131 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 }, 1132 },
1129 anchorX = { 1133 anchorX = {
1130 name = L["X Offset"], 1134 name = L["X Offset"],
1135 order = 4,
1136 type = "range",
1137 min = -100,
1138 max = 100,
1139 step = 1,
1140 set = "SetProp",
1141 get = "GetProp",
1142 },
1143 anchorY = {
1144 name = L["Y Offset"],
1131 order = 5, 1145 order = 5,
1132 type = "range", 1146 type = "range",
1133 min = -100, 1147 min = -100,
1134 max = 100, 1148 max = 100,
1135 step = 1, 1149 step = 1,
1136 set = "SetProp", 1150 set = "SetProp",
1137 get = "GetProp", 1151 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 }, 1152 },
1153 }, 1153 },
1154 }, 1154 },
1155 scale = { 1155
1156 enableScale = {
1157 name = L["Set New Scale"],
1158 order = 121,
1159 type = "toggle",
1160 set = "SetProp",
1161 get = "GetProp",
1162 },
1163 scaleGroup = {
1156 name = L["Scale"], 1164 name = L["Scale"],
1157 order = 93, 1165 order = 122,
1158 type = "group", 1166 type = "group",
1159 inline = true, 1167 inline = true,
1168 disabled = "GetScaleDisabled",
1160 args = { 1169 args = {
1161 enableScale = {
1162 name = L["Set New Scale"],
1163 order = 1,
1164 type = "toggle",
1165 set = "SetProp",
1166 get = "GetProp",
1167 },
1168 scale = { 1170 scale = {
1169 name = L["Scale"], 1171 name = L["Scale"],
1170 order = 2, 1172 order = 1,
1171 type = "range", 1173 type = "range",
1172 min = 0.25, 1174 min = 0.25,
1173 max = 2.5, 1175 max = 2.5,
1174 step = 0.05, 1176 step = 0.05,
1175 isPercent = true, 1177 isPercent = true,
1176 set = "SetProp", 1178 set = "SetProp",
1177 get = "GetScale", 1179 get = "GetScale",
1178 disabled = "GetScaleDisabled",
1179 hidden = "GetScaleDisabled",
1180 }, 1180 },
1181 }, 1181 },
1182 }, 1182 },
1183 alpha = { 1183
1184 enableAlpha = {
1185 name = L["Set Transparency"],
1186 order = 131,
1187 type = "toggle",
1188 set = "SetProp",
1189 get = "GetProp",
1190 },
1191 alphaGroup = {
1184 name = L["Transparency"], 1192 name = L["Transparency"],
1185 order = 94, 1193 order = 132,
1186 type = "group", 1194 type = "group",
1187 inline = true, 1195 inline = true,
1196 disabled = "GetAlphaDisabled",
1188 args = { 1197 args = {
1189 enableAlpha = {
1190 name = L["Set Transparency"],
1191 order = 1,
1192 type = "toggle",
1193 set = "SetProp",
1194 get = "GetProp",
1195 },
1196 alpha = { 1198 alpha = {
1197 name = L["Transparency"], 1199 name = L["Transparency"],
1198 order = 2, 1200 order = 1,
1199 type = "range", 1201 type = "range",
1200 min = 0, 1202 min = 0,
1201 max = 1, 1203 max = 1,
1202 step = 0.01, 1204 step = 0.01,
1203 bigStep = 0.05, 1205 bigStep = 0.05,
1204 isPercent = true, 1206 isPercent = true,
1205 set = "SetProp", 1207 set = "SetProp",
1206 get = "GetAlpha", 1208 get = "GetAlpha",
1207 disabled = "GetAlphaDisabled",
1208 hidden = "GetAlphaDisabled",
1209 }, 1209 },
1210 }, 1210 },
1211 }, 1211 },
1212 }, 1212 },
1213 plugins = { } 1213 plugins = { }
1219 args = { 1219 args = {
1220 mode = { 1220 mode = {
1221 name = L["Select this state"], 1221 name = L["Select this state"],
1222 order = 2, 1222 order = 2,
1223 type = "select", 1223 type = "select",
1224 style = "radio", 1224 style = "dropdown",
1225 values = { 1225 values = {
1226 default = L["by default"], 1226 default = L["by default"],
1227 any = L["when ANY of these"], 1227 any = L["when ANY of these"],
1228 all = L["when ALL of these"], 1228 all = L["when ALL of these"],
1229 custom = L["via custom rule"], 1229 custom = L["via custom rule"],
1679 ReAction:UserError(format(L["State named '%s' already exists"],name)) 1679 ReAction:UserError(format(L["State named '%s' already exists"],name))
1680 else 1680 else
1681 -- TODO: select default state options and pass as final argument 1681 -- TODO: select default state options and pass as final argument
1682 states[name] = { } 1682 states[name] = { }
1683 optionMap[bar].args[name] = CreateStateOptions(bar,name) 1683 optionMap[bar].args[name] = CreateStateOptions(bar,name)
1684 ReAction:ShowEditor(bar, moduleID, name) 1684 ReAction:ShowEditor(bar, "stateOpts", name)
1685 private.newstatename = "" 1685 private.newstatename = ""
1686 end 1686 end
1687 end, 1687 end,
1688 disabled = function() 1688 disabled = function()
1689 local name = private.newstatename or "" 1689 local name = private.newstatename or ""