Mercurial > wow > reaction
comparison Options.lua @ 7:f920db5fc6b1
version 0.3
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Tue, 20 Mar 2007 21:25:29 +0000 |
| parents | 8e0ff8ae4c08 |
| children | c05fd3e18b4f |
comparison
equal
deleted
inserted
replaced
| 6:2da5089ab7ff | 7:f920db5fc6b1 |
|---|---|
| 1 -- Ace2 Options table for ReAction | 1 -- Ace2 global options tables for ReAction |
| 2 | |
| 3 | |
| 4 -- autogenerate the NewBar sub-types table | |
| 5 local function GenerateNewBarArgs() | |
| 6 local args = { } | |
| 7 for _, name in pairs(ReAction:GetButtonTypeList() ) do | |
| 8 args[name] = { | |
| 9 type="execute", | |
| 10 name=name, | |
| 11 desc=name, | |
| 12 } | |
| 13 end | |
| 14 return args | |
| 15 end | |
| 16 | |
| 2 | 17 |
| 3 ReActionConsoleOptions = { | 18 ReActionConsoleOptions = { |
| 4 type="group", | 19 type="group", |
| 5 args={ | 20 args={ |
| 6 lock = { | 21 lock = { |
| 19 | 34 |
| 20 bindings = { | 35 bindings = { |
| 21 type = "execute", | 36 type = "execute", |
| 22 name = "bindings", | 37 name = "bindings", |
| 23 desc = "Launches keybinding setup mode", | 38 desc = "Launches keybinding setup mode", |
| 24 func = function() ReBinder:Enable() end, | 39 func = function() ReBound:Enable() end, |
| 25 }, | 40 }, |
| 26 | 41 |
| 27 hideart = { | 42 hideart = { |
| 28 type = "toggle", | 43 type = "toggle", |
| 29 name = "hideart", | 44 name = "hideart", |
| 30 desc = "Hide default Blizzard action bar artwork and XP bar", | 45 desc = "Hide default Blizzard action bar artwork and XP bar", |
| 31 get = "IsArtHidden", | 46 get = "IsArtHidden", |
| 32 set = "ToggleHideArt", | 47 set = "ToggleHideArt", |
| 33 }, | 48 }, |
| 34 | 49 |
| 35 new = { | |
| 36 type = "execute", | |
| 37 name = "new", | |
| 38 desc = "Create a new bar with default settings", | |
| 39 func = "NewBar" | |
| 40 }, | |
| 41 | |
| 42 showid = { | 50 showid = { |
| 43 type = "toggle", | 51 type = "toggle", |
| 44 name = "showid", | 52 name = "showid", |
| 45 desc = "Show ActionIDs on buttons", | 53 desc = "Show ActionIDs on buttons", |
| 46 get = "IsActionIDVisible", | 54 get = "AreIdsVisible", |
| 47 set = "ToggleActionID", | 55 set = "ToggleIds", |
| 56 }, | |
| 57 | |
| 58 create = { | |
| 59 type = "group", | |
| 60 name = "create", | |
| 61 pass = true, | |
| 62 func = "NewBar", | |
| 63 args = GenerateNewBarArgs(), | |
| 64 desc = "Create a new bar", | |
| 48 }, | 65 }, |
| 49 | 66 |
| 50 resetall = { | 67 resetall = { |
| 51 type = "execute", | 68 type = "execute", |
| 52 name = "resetall", | 69 name = "resetall", |
| 53 desc = "Resets to single bar in the default position", | 70 desc = "Resets to single bar in the default position", |
| 54 func = "ResetBars" | 71 func = "ResetBars", |
| 55 }, | 72 }, |
| 56 | 73 |
| 57 --[[ | 74 --[[ |
| 58 resync = { | 75 resync = { |
| 59 type = "execute", | 76 type = "execute", |
| 60 name = "resync", | 77 name = "resync", |
| 61 desc = "Re-orders action IDs sequentially amongst bars", | 78 desc = "Re-orders action IDs sequentially amongst bars", |
| 62 func = "ResyncActionIDs" | 79 func = "ResyncActionIDs", |
| 80 disabled = true -- not yet implemented | |
| 63 }, | 81 }, |
| 64 ]] | 82 ]] |
| 65 } | 83 } |
| 66 } | 84 } |
| 67 | 85 |
| 68 | 86 |
| 69 ReActionGlobalMenuOptions = { | 87 ReActionGlobalMenuOptions = { |
| 70 type="group", | 88 type = "group", |
| 89 -- handler = nil, -- NOTE: this variable isn't defined yet, must be added later | |
| 71 args={ | 90 args={ |
| 72 lockbars = { | 91 lockbars = { |
| 73 type = "toggle", | 92 type = "toggle", |
| 74 name = "Lock Bars", | 93 name = "Lock Bars", |
| 75 desc = "Locks action bars and disables rearrangement", | 94 desc = "Locks action bars and disables rearrangement", |
| 76 get = function() return ReAction:IsLocked() end, | 95 get = "IsLocked", |
| 77 set = function() ReAction:ToggleLocked() end, | 96 set = "ToggleLocked", |
| 78 order = 1, | 97 order = 1, |
| 79 }, | 98 }, |
| 80 | 99 |
| 81 lockbtns = { | 100 lockbtns = { |
| 82 type = "toggle", | 101 type = "toggle", |
| 83 name = "Lock Buttons", | 102 name = "Lock Buttons", |
| 84 desc = "Locks action bars and disables rearrangement", | 103 desc = "Prevents buttons from being dragged off accidentally. Shift-drag instead.", |
| 85 get = function() return LOCK_ACTIONBAR == "1" end, | 104 get = function() return LOCK_ACTIONBAR == "1" end, |
| 86 set = function() LOCK_ACTIONBAR = (LOCK_ACTIONBAR == "1" and "0" or "1") end, | 105 set = function() LOCK_ACTIONBAR = (LOCK_ACTIONBAR == "1" and "0" or "1") end, |
| 87 order = 2, | 106 order = 2, |
| 88 }, | 107 }, |
| 89 | 108 |
| 109 new = { | |
| 110 type = "group", | |
| 111 name = "New bar", | |
| 112 pass = true, | |
| 113 func = "NewBar", | |
| 114 args = GenerateNewBarArgs(), | |
| 115 desc = "Create a new bar", | |
| 116 order = 3, | |
| 117 }, | |
| 118 | |
| 90 bindings = { | 119 bindings = { |
| 91 type = "execute", | 120 type = "execute", |
| 92 name = "Set Key Bindings", | 121 name = "Set Key Bindings", |
| 93 desc = "Launches keybinding setup mode", | 122 desc = "Launches keybinding setup mode", |
| 94 func = function() ReBinder:Enable() end, | 123 func = function() ReBound:Enable() end, |
| 95 order = 3, | |
| 96 }, | |
| 97 | |
| 98 new = { | |
| 99 type = "execute", | |
| 100 name = "New Bar", | |
| 101 desc = "Create a new bar with default settings", | |
| 102 func = function() ReAction:NewBar() end, | |
| 103 order = 4, | 124 order = 4, |
| 104 }, | 125 }, |
| 105 | 126 |
| 106 showid = { | 127 showid = { |
| 107 type = "toggle", | 128 type = "toggle", |
| 108 name = "Show Action IDs", | 129 name = "Show Action IDs", |
| 109 desc = "Show ActionIDs on buttons", | 130 desc = "Show ActionIDs on buttons", |
| 110 get = function() return ReAction:IsActionIDVisible() end, | 131 get = "AreIdsVisible", |
| 111 set = function() ReAction:ToggleActionID() end, | 132 set = "ToggleIds", |
| 112 order = 5, | 133 order = 5, |
| 113 }, | 134 }, |
| 114 | 135 |
| 136 hidedefault = { | |
| 137 type = "toggle", | |
| 138 name = "Hide Default Main Menu Bar", | |
| 139 desc = "Hides default Blizzard main menu bar, including bag bar, micro menu bar, shapeshift bar, lag meter, and XP bar", | |
| 140 get = "IsArtHidden", | |
| 141 set = "ToggleHideArt", | |
| 142 order = 6, | |
| 143 }, | |
| 144 | |
| 115 --[[ | 145 --[[ |
| 116 resync = { | 146 resync = { |
| 117 type = "execute", | 147 type = "execute", |
| 118 name = "Re-sync Action IDs", | 148 name = "Re-sync Action IDs", |
| 119 desc = "Re-orders action IDs sequentially amongst bars", | 149 desc = "Re-orders action IDs sequentially amongst bars", |
| 120 func = function() ReAction:ResyncActionIDs() end, | 150 func = "ResyncActionIDs", |
| 121 order = 6, | 151 disabled = true, -- not yet implemented |
| 122 }, | 152 }, |
| 123 ]] | 153 ]] |
| 124 | 154 |
| 125 hideart = { | |
| 126 type = "toggle", | |
| 127 name = "Hide Default Art", | |
| 128 desc = "Hide default Blizzard action bar artwork and XP bar", | |
| 129 get = function() return ReAction:IsArtHidden() end, | |
| 130 set = function() return ReAction:ToggleHideArt() end, | |
| 131 order = 7, | |
| 132 }, | |
| 133 | |
| 134 --[[ | |
| 135 reset = { | |
| 136 type = "execute", | |
| 137 name = "Reset Bars", | |
| 138 desc = "Resets to single bar in the default position", | |
| 139 func = function() ReAction:ResetBars() end, | |
| 140 order = 8, | |
| 141 }, | |
| 142 ]] | |
| 143 | |
| 144 } | 155 } |
| 145 } | 156 } |
| 146 | 157 |
| 147 function GenerateReActionBarOptions( bar ) | 158 |
| 148 return { | 159 |
| 160 | |
| 161 | |
| 162 function GenerateReActionBarOptions( bar, main ) | |
| 163 local opts = { | |
| 149 type = "group", | 164 type = "group", |
| 165 handler = bar, | |
| 150 args = { | 166 args = { |
| 151 | 167 |
| 152 sep1 = { | 168 sep1 = { |
| 153 type = "header", | 169 type = "header", |
| 154 name = " ", | 170 name = " ", |
| 155 desc = " ", | 171 desc = " ", |
| 156 order = 9, | 172 order = 1, |
| 157 }, | 173 }, |
| 158 | 174 |
| 159 hdr1 = { | 175 hdr1 = { |
| 160 type = "header", | 176 type = "header", |
| 161 name = "Bar Options", | 177 name = "Options for Bar #"..bar.barID, |
| 162 des = "Bar Options", | 178 desc = "Options for Bar #"..bar.barID, |
| 163 order = 10, | 179 order = 2, |
| 180 }, | |
| 181 | |
| 182 layout = { | |
| 183 type = "group", | |
| 184 name = "Layout", | |
| 185 desc = "Button ordering options", | |
| 186 order = 3, | |
| 187 args = { | |
| 188 growLeft = { | |
| 189 type = "toggle", | |
| 190 name = "Right to Left", | |
| 191 desc = "Lay out buttons right-to-left rather than left-to-right", | |
| 192 get = "GetGrowLeft", | |
| 193 set = "SetGrowLeft", | |
| 194 order = 3, | |
| 195 }, | |
| 196 | |
| 197 growUp = { | |
| 198 type = "toggle", | |
| 199 name = "Bottom to Top", | |
| 200 desc = "Lay out buttons bottom-to-top rather than top-to-bottom", | |
| 201 get = "GetGrowUp", | |
| 202 set = "SetGrowUp", | |
| 203 order = 4, | |
| 204 }, | |
| 205 | |
| 206 columnMajor = { | |
| 207 type = "toggle", | |
| 208 name = "Arrange in Columns", | |
| 209 desc = "Lay out buttons sequentially in columns, rather than in rows", | |
| 210 get = "GetColumnMajor", | |
| 211 set = "SetColumnMajor", | |
| 212 order = 5, | |
| 213 }, | |
| 214 | |
| 215 flip = { | |
| 216 type = "execute", | |
| 217 name = "Flip rows/columns", | |
| 218 desc = "Swaps the number of rows and columns, and inverts the button numbering", | |
| 219 func = "FlipRowsColumns", | |
| 220 order = 6, | |
| 221 }, | |
| 222 }, | |
| 164 }, | 223 }, |
| 165 | 224 |
| 166 --[[ | 225 paging = { |
| 167 hidden = { | 226 type = "group", |
| 168 type = "toggle", | 227 name = "Paging", |
| 169 name = "Hidden", | 228 desc = "Multi-page options", |
| 170 desc = "Hides the bar except when rearranging bars", | 229 order = 4, |
| 171 get = function() return not bar:GetVisibility() end, | 230 args = { |
| 172 set = function() bar:ToggleVisibility() end, | 231 pages = { |
| 173 order = 11, | 232 type = "range", |
| 174 }, | 233 name = "Number of Pages", |
| 175 ]] | 234 desc = "Sets the number of pages", |
| 235 get = "GetPages", | |
| 236 set = "SetPages", | |
| 237 min = 1, | |
| 238 max = 10, | |
| 239 step = 1, | |
| 240 order = 1, | |
| 241 }, | |
| 242 | |
| 243 autostance = { | |
| 244 type = "toggle", | |
| 245 name = "Auto Stance Switch", | |
| 246 desc = "Automatically switch pages when changing stance or shapeshift form.", | |
| 247 get = "GetAutoStanceSwitch", | |
| 248 set = "ToggleAutoStanceSwitch", | |
| 249 order = 2, | |
| 250 }, | |
| 251 | |
| 252 autostealth = { | |
| 253 type = "toggle", | |
| 254 name = "Auto Stealth Switch", | |
| 255 desc = "Automatically switch pages when stealthing/unstealthing.", | |
| 256 get = "GetAutoStealthSwitch", | |
| 257 set = "ToggleAutoStealthSwitch", | |
| 258 order = 3, | |
| 259 }, | |
| 260 | |
| 261 hidecontrols = { | |
| 262 type = "toggle", | |
| 263 name = "Hide Paging Controls", | |
| 264 desc = "Hide the page up/down controls", | |
| 265 get = "ArePageControlsHidden", | |
| 266 set = "TogglePageControlsHidden", | |
| 267 order = 4, | |
| 268 disabled = "IsPagingDisabled", | |
| 269 }, | |
| 270 | |
| 271 controlsloc = { | |
| 272 type = "text", | |
| 273 name = "Control location", | |
| 274 desc = "Location of the page up/down controls", | |
| 275 get = function() return bar:GetPageControlsLoc() or "Blizzard" end, | |
| 276 set = function(loc) bar:SetPageControlsLoc(loc) end, | |
| 277 order = 5, | |
| 278 disabled = function() return bar:IsPagingDisabled() or bar:ArePageControlsHidden() end, | |
| 279 validate = { "Blizzard", "LEFT", "RIGHT", "TOP", "BOTTOM" } | |
| 280 }, | |
| 281 }, | |
| 282 }, | |
| 283 | |
| 284 visibility = { | |
| 285 type = "group", | |
| 286 name = "Visibility", | |
| 287 desc = "Set bar visibility options", | |
| 288 order = 5, | |
| 289 args = { | |
| 290 visible = { | |
| 291 type = "toggle", | |
| 292 name = "Always Visible", | |
| 293 desc = "The bar will always be visible.|n This setting overrides conditional settings below.", | |
| 294 get = "GetVisibility", | |
| 295 set = function() bar:SetVisibility(true) end, | |
| 296 order = 1, | |
| 297 }, | |
| 298 | |
| 299 hidden = { | |
| 300 type = "toggle", | |
| 301 name = "Always Hidden", | |
| 302 desc = "The bar will always be hidden, except when bars are unlocked.|n This setting overrides conditional settings below.", | |
| 303 get = function() return not bar:GetVisibility() end, | |
| 304 set = function() bar:SetVisibility(false) end, | |
| 305 order = 2, | |
| 306 }, | |
| 307 | |
| 308 spring = { | |
| 309 type = "toggle", | |
| 310 name = "Spring Bar Mode", | |
| 311 desc = "The bar is collapsed to a single button, which displays the last action used. Mousing over the button shows the entire bar.|n This setting overrides conditional settings below.", | |
| 312 get = function() end, | |
| 313 set = function() end, | |
| 314 hidden = true, | |
| 315 disabled = true, -- not yet implemented | |
| 316 order = 3, | |
| 317 }, | |
| 318 | |
| 319 conditional = { | |
| 320 type = "group", | |
| 321 name = "Auto Show", | |
| 322 desc = "Dynamically hide and show the entire bar based on certain conditions.", | |
| 323 hidden = true, | |
| 324 disabled = true, -- not yet implemented | |
| 325 order = 4, | |
| 326 args = { | |
| 327 | |
| 328 mouseover = { | |
| 329 type = "toggle", | |
| 330 name = "Show On Mouseover", | |
| 331 desc = "Show the bar only when the mouse is over it.", | |
| 332 disabled = true, -- not yet implemented | |
| 333 get = function() end, | |
| 334 set = function() end, | |
| 335 order = 1, | |
| 336 }, | |
| 337 | |
| 338 combat = { | |
| 339 type = "toggle", | |
| 340 name = "Show In Combat", | |
| 341 desc = "Show the bar only when in combat.", | |
| 342 disabled = true, -- not yet implemented | |
| 343 get = function() end, | |
| 344 set = function() end, | |
| 345 order = 2, | |
| 346 }, | |
| 347 | |
| 348 nocombat = { | |
| 349 type = "toggle", | |
| 350 name = "Hide in Combat", | |
| 351 desc = "Show the bar only when not in combat.", | |
| 352 disabled = true, -- not yet implemented | |
| 353 get = function() end, | |
| 354 set = function() end, | |
| 355 order = 3, | |
| 356 } | |
| 357 } | |
| 358 }, | |
| 359 | |
| 360 } | |
| 361 }, | |
| 176 | 362 |
| 177 opacity = { | 363 opacity = { |
| 178 type = "range", | 364 type = "range", |
| 179 name = "Opacity", | 365 name = "Opacity", |
| 180 desc = "Set bar opacity", | 366 desc = "Set the bar alpha value, from fully transparent (0) to fully opaque (100).", |
| 181 get = function() return bar:GetOpacity() end, | 367 get = "GetOpacity", |
| 182 set = function(o) bar:SetOpacity(o) end, | 368 set = "SetOpacity", |
| 183 min = 0, | 369 min = 0, |
| 184 max = 100, | 370 max = 100, |
| 185 step = 1, | 371 step = 1, |
| 186 order = 12 | 372 order = 6, |
| 187 }, | 373 }, |
| 188 | 374 |
| 189 delete = { | 375 delete = { |
| 190 type = "execute", | 376 type = "execute", |
| 191 name = "Delete Bar", | 377 name = "Delete Bar #"..bar.barID, |
| 192 desc = "Deletes the bar", | 378 desc = "Deletes bar #"..bar.barID, |
| 193 func = function() ReAction:DeleteBar(bar.barID) end, | 379 func = function() main:DeleteBar(bar.barID) end, |
| 194 order = 13, | 380 order = 7 |
| 195 }, | 381 }, |
| 196 } | 382 } |
| 197 } | 383 } |
| 384 | |
| 385 -- generate the auto-hide options for shapeshift forms. Note that this will | |
| 386 -- only show forms that the character has learned, and the ordering may (? did this get fixed?) | |
| 387 -- vary from character to character of the same class | |
| 388 local args = opts.args.visibility.args.conditional.args | |
| 389 for i = 1, GetNumShapeshiftForms() do | |
| 390 local _, name = GetShapeshiftFormInfo(i) | |
| 391 args["stance"..i] = { | |
| 392 type = "toggle", | |
| 393 name = "Show In "..name, | |
| 394 desc = "Show the bar when in "..name.."." , | |
| 395 get = function() end, | |
| 396 set = function() end, | |
| 397 order = #args + 1, | |
| 398 disabled = true, | |
| 399 } | |
| 400 end | |
| 401 | |
| 402 return opts | |
| 198 end | 403 end |
| 199 | 404 |
| 200 | |
| 201 local function setButtonConfig( bar, field, value ) | |
| 202 if bar and bar.config and bar.config.btnConfig then | |
| 203 bar.config.btnConfig[field] = value | |
| 204 for _, b in ipairs(bar.buttons) do | |
| 205 b:ApplyLayout() | |
| 206 b:UpdateDisplay() | |
| 207 end | |
| 208 end | |
| 209 end | |
| 210 | |
| 211 local function getButtonConfig( bar, field ) | |
| 212 if bar and bar.config and bar.config.btnConfig then | |
| 213 return bar.config.btnConfig[field] | |
| 214 end | |
| 215 end | |
| 216 | |
| 217 local function toggleButtonConfig( bar, field ) | |
| 218 if bar and bar.config and bar.config.btnConfig then | |
| 219 bar.config.btnConfig[field] = not bar.config.btnConfig[field] | |
| 220 for _, b in ipairs(bar.buttons) do | |
| 221 b:ApplyLayout() | |
| 222 b:UpdateDisplay() | |
| 223 end | |
| 224 end | |
| 225 end | |
| 226 | |
| 227 | |
| 228 function GenerateReActionButtonOptions( bar ) | |
| 229 return { | |
| 230 type = "group", | |
| 231 args = { | |
| 232 | |
| 233 sep2 = { | |
| 234 type = "header", | |
| 235 name = " ", | |
| 236 desc = " ", | |
| 237 order = 14, | |
| 238 }, | |
| 239 | |
| 240 hdr2 = { | |
| 241 type = "header", | |
| 242 name = "Button Options", | |
| 243 desc = "Button Options", | |
| 244 order = 15, | |
| 245 }, | |
| 246 | |
| 247 showgrid = { | |
| 248 type = "toggle", | |
| 249 name = "Always Show Buttons", | |
| 250 desc = "Show button placeholders when no action is assigned or on the cursor. Note that buttons are always shown when bars are unlocked.", | |
| 251 get = function() return getButtonConfig(bar, "showGrid") end, | |
| 252 set = function() toggleButtonConfig(bar, "showGrid") end, | |
| 253 order = 16, | |
| 254 }, | |
| 255 | |
| 256 colorkeys = { | |
| 257 type = "toggle", | |
| 258 name = "Color Hotkeys", | |
| 259 desc = "Enables/disables colorizing hotkeys by key modifier", | |
| 260 get = function() return getButtonConfig(bar, "keyBindColorCode") end, | |
| 261 set = function() toggleButtonConfig(bar, "keyBindColorCode", c) end, | |
| 262 order = 17, | |
| 263 }, | |
| 264 | |
| 265 keyloc = { | |
| 266 type = "text", | |
| 267 name = "Hotkey Location", | |
| 268 desc = "Sets hotkey location", | |
| 269 get = function() return getButtonConfig(bar, "keyBindLoc") end, | |
| 270 set = function(loc) setButtonConfig(bar, "keyBindLoc", loc) end, | |
| 271 validate = { "TOP", "BOTTOM", "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT" }, | |
| 272 order = 18, | |
| 273 }, | |
| 274 | |
| 275 } | |
| 276 } | |
| 277 end | |
| 278 | |
| 279 |
