view Options.lua @ 2:8e0ff8ae4c08

Version 0.2
author Flick <flickerstreak@gmail.com>
date Tue, 20 Mar 2007 21:08:31 +0000
parents c11ca1d8ed91
children f920db5fc6b1
line wrap: on
line source
-- Ace2 Options table for ReAction

ReActionConsoleOptions = {
  type="group",
  args={ 
    lock = {
      type = "execute",
      name = "lock",
      desc = "Locks action bars and disables rearrangement",
      func = "Lock",
    },

    unlock = {
      type = "execute",
      name = "unlock",
      desc = "Unlocks action bars and enables rearrangement",
      func = "Unlock",
    },

    bindings = {
      type = "execute",
      name = "bindings",
      desc = "Launches keybinding setup mode",
      func = function() ReBinder:Enable() end,
    },

    hideart = {
      type = "toggle",
      name = "hideart",
      desc = "Hide default Blizzard action bar artwork and XP bar",
      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",
    },

    resetall = {
      type = "execute",
      name = "resetall",
      desc = "Resets to single bar in the default position",
      func = "ResetBars"
    },
    
    --[[
    resync = {
      type = "execute",
      name = "resync",
      desc = "Re-orders action IDs sequentially amongst bars",
      func = "ResyncActionIDs"
    },
    ]]
  }
}


ReActionGlobalMenuOptions = {
  type="group",
  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,
      order = 1,
    },

    lockbtns = {
      type = "toggle",
      name = "Lock Buttons",
      desc = "Locks action bars and disables rearrangement",
      get = function() return LOCK_ACTIONBAR == "1" end,
      set = function() LOCK_ACTIONBAR = (LOCK_ACTIONBAR == "1" and "0" or "1") end,
      order = 2,
    },

    bindings = {
      type = "execute",
      name = "Set Key Bindings",
      desc = "Launches keybinding setup mode",
      func = function() ReBinder:Enable() end,
      order = 3,
    },

    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,
      order = 5,
    },

    --[[
    resync = {
      type = "execute",
      name = "Re-sync Action IDs",
      desc = "Re-orders action IDs sequentially amongst bars",
      func = function() ReAction:ResyncActionIDs() end,
      order = 6,
    },
    ]]

    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 {
    type = "group",
    args = { 
    
      sep1 = {
        type = "header",
        name = " ",
        desc = " ",
        order = 9,
      },
      
      hdr1 = {
        type = "header",
        name = "Bar Options",
        des = "Bar Options",
        order = 10,
      },
      
      --[[
      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,
      },
      ]]
      
      opacity = {
        type = "range",
        name = "Opacity",
        desc = "Set bar opacity",
        get = function() return bar:GetOpacity() end,
        set = function(o) bar:SetOpacity(o) end,
        min = 0,
        max = 100,
        step = 1,
        order = 12
      },
      
      delete = {
        type = "execute",
        name = "Delete Bar",
        desc = "Deletes the bar",
        func = function() ReAction:DeleteBar(bar.barID) end,
        order = 13,
      },
    }
  }
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