diff 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
line wrap: on
line diff
--- a/Options.lua	Tue Mar 20 21:20:20 2007 +0000
+++ b/Options.lua	Tue Mar 20 21:25:29 2007 +0000
@@ -1,4 +1,19 @@
--- Ace2 Options table for ReAction
+-- Ace2 global options tables for ReAction
+
+
+-- autogenerate the NewBar sub-types table
+local function GenerateNewBarArgs()
+  local args = { }
+  for _, name in pairs(ReAction:GetButtonTypeList() ) do
+    args[name] = {
+      type="execute",
+      name=name,
+      desc=name,
+    }
+  end
+  return args
+end
+
 
 ReActionConsoleOptions = {
   type="group",
@@ -21,7 +36,7 @@
       type = "execute",
       name = "bindings",
       desc = "Launches keybinding setup mode",
-      func = function() ReBinder:Enable() end,
+      func = function() ReBound:Enable() end,
     },
 
     hideart = {
@@ -31,27 +46,29 @@
       get  = "IsArtHidden",
       set  = "ToggleHideArt",
     },
-    
-    new = {
-      type = "execute",
-      name = "new",
-      desc = "Create a new bar with default settings",
-      func = "NewBar"
-    },
-    
+
     showid = {
       type = "toggle",
       name = "showid",
       desc = "Show ActionIDs on buttons",
-      get  = "IsActionIDVisible",
-      set  = "ToggleActionID",
+      get  = "AreIdsVisible",
+      set  = "ToggleIds",
+    },
+
+    create = {
+      type = "group",
+      name = "create",
+      pass = true,
+      func = "NewBar",
+      args = GenerateNewBarArgs(),
+      desc = "Create a new bar",
     },
 
     resetall = {
       type = "execute",
       name = "resetall",
       desc = "Resets to single bar in the default position",
-      func = "ResetBars"
+      func = "ResetBars",
     },
     
     --[[
@@ -59,7 +76,8 @@
       type = "execute",
       name = "resync",
       desc = "Re-orders action IDs sequentially amongst bars",
-      func = "ResyncActionIDs"
+      func = "ResyncActionIDs",
+      disabled = true -- not yet implemented
     },
     ]]
   }
@@ -67,213 +85,320 @@
 
 
 ReActionGlobalMenuOptions = {
-  type="group",
+  type = "group",
+  -- handler = nil, -- NOTE: this variable isn't defined yet, must be added later
   args={ 
     lockbars = {
       type = "toggle",
       name = "Lock Bars",
       desc = "Locks action bars and disables rearrangement",
-      get = function() return ReAction:IsLocked() end,
-      set = function() ReAction:ToggleLocked() end,
+      get = "IsLocked",
+      set = "ToggleLocked",
       order = 1,
     },
 
     lockbtns = {
       type = "toggle",
       name = "Lock Buttons",
-      desc = "Locks action bars and disables rearrangement",
+      desc = "Prevents buttons from being dragged off accidentally. Shift-drag instead.",
       get = function() return LOCK_ACTIONBAR == "1" end,
       set = function() LOCK_ACTIONBAR = (LOCK_ACTIONBAR == "1" and "0" or "1") end,
       order = 2,
     },
 
+    new = {
+      type = "group",
+      name = "New bar",
+      pass = true,
+      func = "NewBar",
+      args = GenerateNewBarArgs(),
+      desc = "Create a new bar",
+      order = 3,
+    },
+
     bindings = {
       type = "execute",
       name = "Set Key Bindings",
       desc = "Launches keybinding setup mode",
-      func = function() ReBinder:Enable() end,
-      order = 3,
+      func = function() ReBound:Enable() end,
+      order = 4,
     },
 
-    new = {
-      type = "execute",
-      name = "New Bar",
-      desc = "Create a new bar with default settings",
-      func = function() ReAction:NewBar() end,
-      order = 4,
-    },
-    
     showid = {
       type = "toggle",
       name = "Show Action IDs",
       desc = "Show ActionIDs on buttons",
-      get  = function() return ReAction:IsActionIDVisible() end,
-      set  = function() ReAction:ToggleActionID() end,
+      get  = "AreIdsVisible",
+      set  = "ToggleIds",
       order = 5,
     },
 
+    hidedefault = {
+      type = "toggle",
+      name = "Hide Default Main Menu Bar",
+      desc = "Hides default Blizzard main menu bar, including bag bar, micro menu bar, shapeshift bar, lag meter, and XP bar",
+      get  = "IsArtHidden",
+      set  = "ToggleHideArt",
+      order = 6,
+    },
+    
     --[[
     resync = {
       type = "execute",
       name = "Re-sync Action IDs",
       desc = "Re-orders action IDs sequentially amongst bars",
-      func = function() ReAction:ResyncActionIDs() end,
-      order = 6,
+      func = "ResyncActionIDs",
+      disabled = true, -- not yet implemented
     },
     ]]
 
-    hideart = {
-      type = "toggle",
-      name = "Hide Default Art",
-      desc = "Hide default Blizzard action bar artwork and XP bar",
-      get  = function() return ReAction:IsArtHidden() end,
-      set  = function() return ReAction:ToggleHideArt() end,
-      order = 7,
-    },
-    
-    --[[
-    reset = {
-      type = "execute",
-      name = "Reset Bars",
-      desc = "Resets to single bar in the default position",
-      func = function() ReAction:ResetBars() end,
-      order = 8,
-    },
-   ]]
-    
   }
 }
 
-function GenerateReActionBarOptions( bar )
-  return {
+
+
+  
+
+function GenerateReActionBarOptions( bar, main )
+  local opts = {
     type = "group",
+    handler = bar,
     args = { 
     
       sep1 = {
         type = "header",
         name = " ",
         desc = " ",
-        order = 9,
+        order = 1,
       },
       
       hdr1 = {
         type = "header",
-        name = "Bar Options",
-        des = "Bar Options",
-        order = 10,
+        name = "Options for Bar #"..bar.barID,
+        desc = "Options for Bar #"..bar.barID,
+        order = 2,
+      },
+
+      layout = {
+        type = "group",
+        name = "Layout",
+        desc = "Button ordering options",
+        order = 3,
+        args = {
+          growLeft = {
+            type = "toggle",
+            name = "Right to Left",
+            desc = "Lay out buttons right-to-left rather than left-to-right",
+            get  = "GetGrowLeft",
+            set  = "SetGrowLeft",
+            order = 3,
+          },
+
+          growUp = {
+            type = "toggle",
+            name = "Bottom to Top",
+            desc = "Lay out buttons bottom-to-top rather than top-to-bottom",
+            get  = "GetGrowUp",
+            set  = "SetGrowUp",
+            order = 4,
+          },
+
+          columnMajor = {
+            type = "toggle",
+            name = "Arrange in Columns",
+            desc = "Lay out buttons sequentially in columns, rather than in rows",
+            get  = "GetColumnMajor",
+            set  = "SetColumnMajor",
+            order = 5,
+          },
+
+          flip = {
+            type = "execute",
+            name = "Flip rows/columns",
+            desc = "Swaps the number of rows and columns, and inverts the button numbering",
+            func = "FlipRowsColumns",
+            order = 6,
+          },
+        },
       },
       
-      --[[
-      hidden = {
-        type = "toggle",
-        name = "Hidden",
-        desc = "Hides the bar except when rearranging bars",
-        get = function() return not bar:GetVisibility() end,
-        set = function() bar:ToggleVisibility() end,
-        order = 11,
+      paging = {
+        type = "group",
+        name = "Paging",
+        desc = "Multi-page options",
+        order = 4,
+        args = {
+          pages = {
+            type = "range",
+            name = "Number of Pages",
+            desc = "Sets the number of pages",
+            get = "GetPages",
+            set = "SetPages",
+            min = 1,
+            max = 10,
+            step = 1,
+            order = 1,
+          },
+
+          autostance = {
+            type = "toggle",
+            name = "Auto Stance Switch",
+            desc = "Automatically switch pages when changing stance or shapeshift form.",
+            get  = "GetAutoStanceSwitch",
+            set  = "ToggleAutoStanceSwitch",
+            order = 2,
+          },
+
+          autostealth = {
+            type = "toggle",
+            name = "Auto Stealth Switch",
+            desc = "Automatically switch pages when stealthing/unstealthing.",
+            get  = "GetAutoStealthSwitch",
+            set  = "ToggleAutoStealthSwitch",
+            order = 3,
+          },
+
+          hidecontrols = {
+            type = "toggle",
+            name = "Hide Paging Controls",
+            desc = "Hide the page up/down controls",
+            get  = "ArePageControlsHidden",
+            set  = "TogglePageControlsHidden",
+            order = 4,
+            disabled = "IsPagingDisabled",
+          },
+
+          controlsloc = {
+            type = "text",
+            name = "Control location",
+            desc = "Location of the page up/down controls",
+            get  = function() return bar:GetPageControlsLoc() or "Blizzard" end,
+            set  = function(loc) bar:SetPageControlsLoc(loc) end,
+            order = 5,
+            disabled = function() return bar:IsPagingDisabled() or bar:ArePageControlsHidden() end,
+            validate = { "Blizzard", "LEFT", "RIGHT", "TOP", "BOTTOM" }
+          },
+        },
       },
-      ]]
+
+      visibility = {
+        type = "group",
+        name = "Visibility",
+        desc = "Set bar visibility options",
+        order = 5,
+        args = {
+          visible = {
+            type = "toggle",
+            name = "Always Visible",
+            desc = "The bar will always be visible.|n This setting overrides conditional settings below.",
+            get = "GetVisibility",
+            set = function() bar:SetVisibility(true) end,
+            order = 1,
+          },
+
+          hidden = {
+            type = "toggle",
+            name = "Always Hidden",
+            desc = "The bar will always be hidden, except when bars are unlocked.|n This setting overrides conditional settings below.",
+            get  = function() return not bar:GetVisibility() end,
+            set  = function() bar:SetVisibility(false) end,
+            order = 2,
+          },
+
+          spring = {
+            type = "toggle",
+            name = "Spring Bar Mode",
+            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.",
+            get  = function() end,
+            set  = function() end,
+            hidden = true,
+            disabled = true, -- not yet implemented
+            order = 3,
+          },
+
+          conditional = {
+            type = "group",
+            name = "Auto Show",
+            desc = "Dynamically hide and show the entire bar based on certain conditions.",
+            hidden = true,
+            disabled = true, -- not yet implemented
+            order = 4,
+            args = {
+
+              mouseover = {
+                type = "toggle",
+                name = "Show On Mouseover",
+                desc = "Show the bar only when the mouse is over it.",
+                disabled = true, -- not yet implemented
+                get  = function() end,
+                set  = function() end,
+                order = 1,
+              },
+
+              combat = {
+                type = "toggle",
+                name = "Show In Combat",
+                desc = "Show the bar only when in combat.",
+                disabled = true, -- not yet implemented
+                get  = function() end,
+                set  = function() end,
+                order = 2,
+              },
+
+              nocombat = {
+                type = "toggle",
+                name = "Hide in Combat",
+                desc = "Show the bar only when not in combat.",
+                disabled = true, -- not yet implemented
+                get = function() end,
+                set = function() end,
+                order = 3,
+              }
+            }
+          },
+
+        }
+      },
       
       opacity = {
         type = "range",
         name = "Opacity",
-        desc = "Set bar opacity",
-        get = function() return bar:GetOpacity() end,
-        set = function(o) bar:SetOpacity(o) end,
+        desc = "Set the bar alpha value, from fully transparent (0) to fully opaque (100).",
+        get = "GetOpacity",
+        set = "SetOpacity",
         min = 0,
         max = 100,
         step = 1,
-        order = 12
+        order = 6,
       },
       
       delete = {
         type = "execute",
-        name = "Delete Bar",
-        desc = "Deletes the bar",
-        func = function() ReAction:DeleteBar(bar.barID) end,
-        order = 13,
+        name = "Delete Bar #"..bar.barID,
+        desc = "Deletes bar #"..bar.barID,
+        func = function() main:DeleteBar(bar.barID) end,
+        order = 7
       },
     }
   }
+
+  -- generate the auto-hide options for shapeshift forms. Note that this will 
+  -- only show forms that the character has learned, and the ordering may (? did this get fixed?)
+  -- vary from character to character of the same class
+  local args = opts.args.visibility.args.conditional.args
+  for i = 1, GetNumShapeshiftForms() do
+    local _, name = GetShapeshiftFormInfo(i)
+    args["stance"..i] = {
+      type = "toggle",
+      name = "Show In "..name,
+      desc = "Show the bar when in "..name.."." ,
+      get = function() end,
+      set = function() end,
+      order = #args + 1,
+      disabled = true,
+    }
+  end
+
+  return opts
 end
 
-
-local function setButtonConfig( bar, field, value )
-  if bar and bar.config and bar.config.btnConfig then
-    bar.config.btnConfig[field] = value
-    for _, b in ipairs(bar.buttons) do
-      b:ApplyLayout()
-      b:UpdateDisplay()
-    end
-  end
-end
-
-local function getButtonConfig( bar, field )
-  if bar and bar.config and bar.config.btnConfig then
-    return bar.config.btnConfig[field]
-  end
-end
-
-local function toggleButtonConfig( bar, field )
-  if bar and bar.config and bar.config.btnConfig then
-    bar.config.btnConfig[field] = not bar.config.btnConfig[field]
-    for _, b in ipairs(bar.buttons) do
-      b:ApplyLayout()
-      b:UpdateDisplay()
-    end
-  end
-end
-
-
-function GenerateReActionButtonOptions( bar )
-  return {
-    type = "group",
-    args = { 
-        
-      sep2 = {
-        type = "header",
-        name = "  ",
-        desc = "  ",
-        order = 14,
-      },
-      
-      hdr2 = {
-        type = "header",
-        name = "Button Options",
-        desc = "Button Options",
-        order = 15,
-      },
-      
-      showgrid = {
-        type = "toggle",
-        name = "Always Show Buttons",
-        desc = "Show button placeholders when no action is assigned or on the cursor. Note that buttons are always shown when bars are unlocked.",
-        get  = function() return getButtonConfig(bar, "showGrid") end,
-        set  = function() toggleButtonConfig(bar, "showGrid") end,
-        order = 16,
-      },
-      
-      colorkeys = {
-        type = "toggle",
-        name = "Color Hotkeys",
-        desc = "Enables/disables colorizing hotkeys by key modifier",
-        get  = function() return getButtonConfig(bar, "keyBindColorCode") end,
-        set  = function() toggleButtonConfig(bar, "keyBindColorCode", c) end,
-        order = 17,
-      },
-  
-      keyloc = {
-        type = "text",
-        name = "Hotkey Location",
-        desc = "Sets hotkey location",
-        get  = function() return getButtonConfig(bar, "keyBindLoc") end,
-        set  = function(loc) setButtonConfig(bar, "keyBindLoc", loc) end,
-        validate = { "TOP", "BOTTOM", "TOPLEFT", "TOPRIGHT", "BOTTOMLEFT", "BOTTOMRIGHT" },
-        order = 18,
-      },
-      
-    }    
-  }
-end
-
-