# HG changeset patch
# User Flick
# Date 1300997490 25200
# Node ID 704f4a05a1d7ce2990e563ef0f2f98ad6bda26c9
# Parent dcdc0235d489ab43acd36733fc7bb3e9f5c6556e
Demodulificate all bar options (except state options)
diff -r dcdc0235d489 -r 704f4a05a1d7 Editor.lua
--- a/Editor.lua Thu Mar 24 13:09:44 2011 -0700
+++ b/Editor.lua Thu Mar 24 13:11:30 2011 -0700
@@ -20,7 +20,9 @@
BOTTOMRIGHT = L["Bottom Right"],
}
-local Editor = { }
+local Editor = {
+ buttonHandlers = { }
+}
function Editor:New()
-- create new self
@@ -323,6 +325,7 @@
},
},
},
+ buttonOpts = self:CreateButtonOptions(bar)
},
plugins = { }
}
@@ -347,6 +350,17 @@
end
end
+function Editor:CreateButtonOptions(bar)
+ local buttonClass = bar:GetButtonClass()
+ local classID = buttonClass:GetButtonTypeID()
+ local handler = self.buttonHandlers[classID]
+
+ if handler then
+ local h = handler:New(bar)
+ return h:GetOptions()
+ end
+end
+
function Editor:RefreshBarOptions()
for name, key in pairs(self.barOptMap) do
if not ReAction:GetBar(name) then
@@ -399,6 +413,548 @@
end
end
+-------------------------------
+---- Action button handler ----
+-------------------------------
+
+do
+ local ActionHandler = {
+ buttonClass = ReAction.Button.Action,
+ options = {
+ hideEmpty = {
+ name = L["Hide Empty Buttons"],
+ order = 1,
+ type = "toggle",
+ width = "double",
+ get = "GetHideEmpty",
+ set = "SetHideEmpty",
+ },
+ lockButtons = {
+ name = L["Lock Buttons"],
+ desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
+ order = 2,
+ type = "toggle",
+ get = "GetLockButtons",
+ set = "SetLockButtons",
+ },
+ lockOnlyCombat = {
+ name = L["Only in Combat"],
+ desc = L["Only lock the buttons when in combat"],
+ order = 3,
+ type = "toggle",
+ disabled = "LockButtonsCombatDisabled",
+ get = "GetLockButtonsCombat",
+ set = "SetLockButtonsCombat",
+ },
+ pages = {
+ name = L["# Pages"],
+ desc = L["Use the Dynamic State tab to specify page transitions"],
+ order = 4,
+ type = "range",
+ min = 1,
+ max = 10,
+ step = 1,
+ get = "GetNumPages",
+ set = "SetNumPages",
+ },
+ mindcontrol = {
+ name = L["Mind Control Support"],
+ 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."],
+ order = 5,
+ type = "toggle",
+ width = "double",
+ set = "SetMindControl",
+ get = "GetMindControl",
+ },
+ vehicle = {
+ name = L["Vehicle Support"],
+ 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."],
+ order = 6,
+ type = "toggle",
+ width = "double",
+ get = "GetVehicle",
+ set = "SetVehicle",
+ },
+ actions = {
+ name = L["Edit Action IDs"],
+ order = 7,
+ type = "group",
+ inline = true,
+ args = {
+ method = {
+ name = L["Assign"],
+ order = 1,
+ type = "select",
+ width = "double",
+ values = { [0] = L["Choose Method..."],
+ [1] = L["Individually"],
+ [2] = L["All at Once"], },
+ get = "GetActionEditMethod",
+ set = "SetActionEditMethod",
+ },
+ rowSelect = {
+ name = L["Row"],
+ desc = L["Rows are numbered top to bottom"],
+ order = 2,
+ type = "select",
+ width = "half",
+ hidden = "IsButtonSelectHidden",
+ values = "GetRowList",
+ get = "GetSelectedRow",
+ set = "SetSelectedRow",
+ },
+ colSelect = {
+ name = L["Col"],
+ desc = L["Columns are numbered left to right"],
+ order = 3,
+ type = "select",
+ width = "half",
+ hidden = "IsButtonSelectHidden",
+ values = "GetColumnList",
+ get = "GetSelectedColumn",
+ set = "SetSelectedColumn",
+ },
+ pageSelect = {
+ name = L["Page"],
+ order = 4,
+ type = "select",
+ width = "half",
+ hidden = "IsPageSelectHidden",
+ values = "GetPageList",
+ get = "GetSelectedPage",
+ set = "SetSelectedPage",
+ },
+ single = {
+ name = L["Action ID"],
+ usage = L["Specify ID 1-120"],
+ order = 5,
+ type = "input",
+ width = "half",
+ hidden = "IsButtonSelectHidden",
+ get = "GetActionID",
+ set = "SetActionID",
+ validate = "ValidateActionID",
+ },
+ multi = {
+ name = L["ID List"],
+ usage = L["Specify a comma-separated list of IDs for each button in the bar (in order). Separate multiple pages with semicolons (;)"],
+ order = 6,
+ type = "input",
+ multiline = true,
+ width = "double",
+ hidden = "IsMultiIDHidden",
+ get = "GetMultiID",
+ set = "SetMultiID",
+ validate = "ValidateMultiID",
+ },
+ },
+ },
+ }
+ }
+
+ Editor.buttonHandlers[ActionHandler.buttonClass:GetButtonTypeID()] = ActionHandler
+
+ local meta = { __index = ActionHandler }
+
+ function ActionHandler:New( bar )
+ return setmetatable(
+ {
+ bar = bar,
+ config = bar:GetConfig(),
+ },
+ meta)
+ end
+
+ function ActionHandler:Refresh()
+ self.buttonClass:SetupBar(self.bar)
+ end
+
+ function ActionHandler:UpdateButtonLock()
+ self.buttonClass:SetButtonLock(self.bar, self.config.lockButtons, self.config.lockButtonsCombat)
+ end
+
+ function ActionHandler:GetLastButton()
+ return self.bar:GetButton(self.bar:GetNumButtons())
+ end
+
+ -- options handlers
+ function ActionHandler:GetOptions()
+ return {
+ type = "group",
+ name = L["Action Buttons"],
+ handler = self,
+ order = 2,
+ args = self.options
+ }
+ end
+
+ function ActionHandler:SetHideEmpty(info, value)
+ if value ~= self.config.hideEmpty then
+ self.config.hideEmpty = value
+ for _, b in self.bar:IterateButtons() do
+ b:ShowGrid(not value)
+ end
+ end
+ end
+
+ function ActionHandler:GetHideEmpty()
+ return self.config.hideEmpty
+ end
+
+ function ActionHandler:GetLockButtons()
+ return self.config.lockButtons
+ end
+
+ function ActionHandler:SetLockButtons(info, value)
+ self.config.lockButtons = value
+ self:UpdateButtonLock()
+ end
+
+ function ActionHandler:GetLockButtonsCombat()
+ return self.config.lockButtonsCombat
+ end
+
+ function ActionHandler:SetLockButtonsCombat(info, value)
+ self.config.lockButtonsCombat = value
+ self:UpdateButtonLock()
+ end
+
+ function ActionHandler:LockButtonsCombatDisabled()
+ return not self.config.lockButtons
+ end
+
+ function ActionHandler:GetNumPages()
+ return self.config.nPages
+ end
+
+ function ActionHandler:SetNumPages(info, value)
+ self.config.nPages = value
+ self:Refresh()
+ end
+
+ function ActionHandler:GetMindControl()
+ return self.config.mindcontrol
+ end
+
+ function ActionHandler:SetMindControl(info, value)
+ self.config.mindcontrol = value
+ self:Refresh()
+ end
+
+ function ActionHandler:GetVehicle()
+ return self.config.vehicle
+ end
+
+ function ActionHandler:SetVehicle(info, value)
+ self.config.vehicle = value
+ self:Refresh()
+ end
+
+ function ActionHandler:GetActionEditMethod()
+ return self.editMethod or 0
+ end
+
+ function ActionHandler:SetActionEditMethod(info, value)
+ self.editMethod = value
+ end
+
+ function ActionHandler:IsButtonSelectHidden()
+ return self.editMethod ~= 1
+ end
+
+ function ActionHandler:GetRowList()
+ local r,c = self.bar:GetButtonGrid()
+ if self.rowList == nil or #self.rowList ~= r then
+ local list = { }
+ for i = 1, r do
+ table.insert(list,i)
+ end
+ self.rowList = list
+ end
+ return self.rowList
+ end
+
+ function ActionHandler:GetSelectedRow()
+ local r, c = self.bar:GetButtonGrid()
+ local row = self.selectedRow or 1
+ if row > r then
+ row = 1
+ end
+ self.selectedRow = row
+ return row
+ end
+
+ function ActionHandler:SetSelectedRow(info, value)
+ self.selectedRow = value
+ end
+
+ function ActionHandler:GetColumnList()
+ local r,c = self.bar:GetButtonGrid()
+ if self.columnList == nil or #self.columnList ~= c then
+ local list = { }
+ for i = 1, c do
+ table.insert(list,i)
+ end
+ self.columnList = list
+ end
+ return self.columnList
+ end
+
+ function ActionHandler:GetSelectedColumn()
+ local r, c = self.bar:GetButtonGrid()
+ local col = self.selectedColumn or 1
+ if col > c then
+ col = 1
+ end
+ self.selectedColumn = col
+ return col
+ end
+
+ function ActionHandler:SetSelectedColumn(info, value)
+ self.selectedColumn = value
+ end
+
+ function ActionHandler:IsPageSelectHidden()
+ return self.editMethod ~= 1 or (self.config.nPages or 1) < 2
+ end
+
+ function ActionHandler:GetPageList()
+ local n = self.config.nPages or 1
+ if self.pageList == nil or #self.pageList ~= n then
+ local p = { }
+ for i = 1, n do
+ table.insert(p,i)
+ end
+ self.pageList = p
+ end
+ return self.pageList
+ end
+
+ function ActionHandler:GetSelectedPage()
+ local p = self.selectedPage or 1
+ if p > (self.config.nPages or 1) then
+ p = 1
+ end
+ self.selectedPage = p
+ return p
+ end
+
+ function ActionHandler:SetSelectedPage(info, value)
+ self.selectedPage = value
+ end
+
+ function ActionHandler:GetActionID()
+ local row = self.selectedRow or 1
+ local col = self.selectedColumn or 1
+ local r, c = self.bar:GetButtonGrid()
+ local n = (row-1) * c + col
+ local btn = self.bar:GetButton(n)
+ if btn then
+ return tostring(btn:GetActionID(self.selectedPage or 1))
+ end
+ end
+
+ function ActionHandler:SetActionID(info, value)
+ local row = self.selectedRow or 1
+ local col = self.selectedColumn or 1
+ local r, c = self.bar:GetButtonGrid()
+ local n = (row-1) * c + col
+ local btn = self.bar:GetButton(n)
+ if btn then
+ btn:SetActionID(tonumber(value), self.selectedPage or 1)
+ end
+ end
+
+ function ActionHandler:ValidateActionID(info, value)
+ value = tonumber(value)
+ if value == nil or value < 1 or value > 120 then
+ return L["Specify ID 1-120"]
+ end
+ return true
+ end
+
+ function ActionHandler:IsMultiIDHidden()
+ return self.editMethod ~= 2
+ end
+
+ function ActionHandler:GetMultiID()
+ local p = { }
+ for i = 1, self.config.nPages or 1 do
+ local b = { }
+ for _, btn in self.bar:IterateButtons() do
+ table.insert(b, btn:GetActionID(i))
+ end
+ table.insert(p, table.concat(b,","))
+ end
+ return table.concat(p,";\n")
+ end
+
+
+ local function ParseMultiID(nBtns, nPages, s)
+ if s:match("[^%d%s,;]") then
+ return nil
+ end
+ local p = { }
+ for list in s:gmatch("[^;]+") do
+ local pattern = ("^%s?$"):format(("%s*(%d+)%s*,"):rep(nBtns))
+ local ids = { list:match(pattern) }
+ if #ids ~= nBtns then
+ return nil
+ end
+ table.insert(p,ids)
+ end
+ if #p ~= nPages then
+ return nil
+ end
+ return p
+ end
+
+ function ActionHandler:SetMultiID(info, value)
+ local p = ParseMultiID(self.bar:GetNumButtons(), self.config.nPages or 1, value)
+ for page, b in ipairs(p) do
+ for button, id in ipairs(b) do
+ self.bar:GetButton(button):SetActionID(id, page)
+ end
+ end
+ end
+
+ function ActionHandler:ValidateMultiID(info, value)
+ local bad = L["Invalid action ID list string"]
+ if value == nil or ParseMultiID(self.bar:GetNumButtons(), self.config.nPages or 1, value) == nil then
+ return bad
+ end
+ return true
+ end
+end
+
+
+----------------------------------
+---- PetAction button handler ----
+----------------------------------
+
+do
+ local PetHandler = {
+ buttonClass = ReAction.Button.PetAction,
+ }
+
+ Editor.buttonHandlers[PetHandler.buttonClass:GetButtonTypeID()] = PetHandler
+
+ local meta = { __index = PetHandler }
+
+ function PetHandler:New(bar)
+ return setmetatable(
+ {
+ bar = bar,
+ config = bar.config
+ }, meta)
+ end
+
+ function PetHandler:GetLockButtons()
+ return self.config.lockButtons
+ end
+
+ function PetHandler:SetLockButtons(info, value)
+ self.config.lockButtons = value
+ self.buttonClass:UpdateButtonLock(self.bar)
+ end
+
+ function PetHandler:GetLockButtonsCombat()
+ return self.config.lockButtonsCombat
+ end
+
+ function PetHandler:SetLockButtonsCombat(info, value)
+ self.config.lockButtonsCombat = value
+ self.buttonClass:UpdateButtonLock(self.bar)
+ end
+
+ function PetHandler:LockButtonsCombatDisabled()
+ return not self.config.lockButtons
+ end
+
+ function PetHandler:GetOptions()
+ return {
+ type = "group",
+ name = L["Pet Buttons"],
+ handler = self,
+ order = 2,
+ args = {
+ lockButtons = {
+ name = L["Lock Buttons"],
+ desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
+ order = 2,
+ type = "toggle",
+ get = "GetLockButtons",
+ set = "SetLockButtons",
+ },
+ lockOnlyCombat = {
+ name = L["Only in Combat"],
+ desc = L["Only lock the buttons when in combat"],
+ order = 3,
+ type = "toggle",
+ disabled = "LockButtonsCombatDisabled",
+ get = "GetLockButtonsCombat",
+ set = "SetLockButtonsCombat",
+ },
+ }
+ }
+ end
+end
+
+
+-------------------------------------
+---- Vehicle Exit button handler ----
+-------------------------------------
+
+do
+ local VExitHandler = {
+ buttonClass = ReAction.Button.VehicleExit,
+ }
+
+ Editor.buttonHandlers[VExitHandler.buttonClass:GetButtonTypeID()] = VExitHandler
+
+ local meta = { __index = VExitHandler }
+
+ function VExitHandler:New(bar)
+ return setmetatable(
+ {
+ bar = bar,
+ }, meta)
+ end
+
+ function VExitHandler:GetConfig()
+ return self.bar:GetConfig()
+ end
+
+ function VExitHandler:GetPassengerOnly()
+ return not self:GetConfig().withControls
+ end
+
+ function VExitHandler:SetPassengerOnly(info, value)
+ self:GetConfig().withControls = not value
+ self.buttonClass:UpdateRegistration(self.bar)
+ end
+
+
+ function VExitHandler:GetOptions()
+ return {
+ type = "group",
+ name = L["Exit Vehicle"],
+ handler = self,
+ args = {
+ passengerOnly = {
+ name = L["Show only when passenger"],
+ desc = L["Only show the button when riding as a passenger in a vehicle (no vehicle controls)"],
+ order = 2,
+ width = "double",
+ type = "toggle",
+ get = "GetPassengerOnly",
+ set = "SetPassengerOnly",
+ },
+ }
+ }
+ end
+end
+
---- Export to ReAction ----
diff -r dcdc0235d489 -r 704f4a05a1d7 ReAction.lua
--- a/ReAction.lua Thu Mar 24 13:09:44 2011 -0700
+++ b/ReAction.lua Thu Mar 24 13:11:30 2011 -0700
@@ -310,7 +310,6 @@
if isDefault then
self.defaultBarType = name
end
- self:RefreshEditor()
end
function ReAction:IterateBarTypes()
diff -r dcdc0235d489 -r 704f4a05a1d7 ReAction.xml
--- a/ReAction.xml Thu Mar 24 13:09:44 2011 -0700
+++ b/ReAction.xml Thu Mar 24 13:11:30 2011 -0700
@@ -6,11 +6,11 @@
-
-
+
+
diff -r dcdc0235d489 -r 704f4a05a1d7 classes/ActionButton.lua
--- a/classes/ActionButton.lua Thu Mar 24 13:09:44 2011 -0700
+++ b/classes/ActionButton.lua Thu Mar 24 13:11:30 2011 -0700
@@ -655,7 +655,7 @@
end
-function Action.SetButtonLock( bar, lock, lockCombat ) -- call this as a static method
+function Action:SetButtonLock( bar, lock, lockCombat )
local f = bar:GetFrame()
f:SetAttribute("lockbuttons",lock)
f:SetAttribute("lockbuttonscombat",lockCombat)
diff -r dcdc0235d489 -r 704f4a05a1d7 classes/Bar.lua
--- a/classes/Bar.lua Thu Mar 24 13:09:44 2011 -0700
+++ b/classes/Bar.lua Thu Mar 24 13:11:30 2011 -0700
@@ -331,6 +331,10 @@
return self.buttons[idx]
end
+function Bar:GetButtonClass()
+ return self.buttonClass
+end
+
function Bar:GetConfig()
return self.config
end
diff -r dcdc0235d489 -r 704f4a05a1d7 modules/Action.lua
--- a/modules/Action.lua Thu Mar 24 13:09:44 2011 -0700
+++ b/modules/Action.lua Thu Mar 24 13:11:30 2011 -0700
@@ -12,15 +12,11 @@
local module = ReAction:NewModule( moduleID )
-- Class declarations
-local Button = ReAction.Button.Action -- see /classes/ActionButton.lua
-local Handle = { }
local PropHandler = { }
-- Event handlers
function module:OnInitialize()
self.handles = setmetatable({ }, weak)
-
- ReAction:RegisterBarOptionGenerator(self, "GetBarOptions")
end
function module:OnEnable()
@@ -31,422 +27,6 @@
ReAction:GetModule("State"):UnregisterStateProperty("page")
end
-
-
----- Interface ----
-function module:GetBarOptions(bar)
- self.handles[bar] = self.handles[bar] or Handle:New(bar)
- return self.handles[bar]:GetOptions()
-end
-
-
----- Bar Handle ----
-
-do
- local options = {
- hideEmpty = {
- name = L["Hide Empty Buttons"],
- order = 1,
- type = "toggle",
- width = "double",
- get = "GetHideEmpty",
- set = "SetHideEmpty",
- },
- lockButtons = {
- name = L["Lock Buttons"],
- desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
- order = 2,
- type = "toggle",
- get = "GetLockButtons",
- set = "SetLockButtons",
- },
- lockOnlyCombat = {
- name = L["Only in Combat"],
- desc = L["Only lock the buttons when in combat"],
- order = 3,
- type = "toggle",
- disabled = "LockButtonsCombatDisabled",
- get = "GetLockButtonsCombat",
- set = "SetLockButtonsCombat",
- },
- pages = {
- name = L["# Pages"],
- desc = L["Use the Dynamic State tab to specify page transitions"],
- order = 4,
- type = "range",
- min = 1,
- max = 10,
- step = 1,
- get = "GetNumPages",
- set = "SetNumPages",
- },
- mindcontrol = {
- name = L["Mind Control Support"],
- 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."],
- order = 5,
- type = "toggle",
- width = "double",
- set = "SetMindControl",
- get = "GetMindControl",
- },
- vehicle = {
- name = L["Vehicle Support"],
- 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."],
- order = 6,
- type = "toggle",
- width = "double",
- get = "GetVehicle",
- set = "SetVehicle",
- },
- actions = {
- name = L["Edit Action IDs"],
- order = 7,
- type = "group",
- inline = true,
- args = {
- method = {
- name = L["Assign"],
- order = 1,
- type = "select",
- width = "double",
- values = { [0] = L["Choose Method..."],
- [1] = L["Individually"],
- [2] = L["All at Once"], },
- get = "GetActionEditMethod",
- set = "SetActionEditMethod",
- },
- rowSelect = {
- name = L["Row"],
- desc = L["Rows are numbered top to bottom"],
- order = 2,
- type = "select",
- width = "half",
- hidden = "IsButtonSelectHidden",
- values = "GetRowList",
- get = "GetSelectedRow",
- set = "SetSelectedRow",
- },
- colSelect = {
- name = L["Col"],
- desc = L["Columns are numbered left to right"],
- order = 3,
- type = "select",
- width = "half",
- hidden = "IsButtonSelectHidden",
- values = "GetColumnList",
- get = "GetSelectedColumn",
- set = "SetSelectedColumn",
- },
- pageSelect = {
- name = L["Page"],
- order = 4,
- type = "select",
- width = "half",
- hidden = "IsPageSelectHidden",
- values = "GetPageList",
- get = "GetSelectedPage",
- set = "SetSelectedPage",
- },
- single = {
- name = L["Action ID"],
- usage = L["Specify ID 1-120"],
- order = 5,
- type = "input",
- width = "half",
- hidden = "IsButtonSelectHidden",
- get = "GetActionID",
- set = "SetActionID",
- validate = "ValidateActionID",
- },
- multi = {
- name = L["ID List"],
- usage = L["Specify a comma-separated list of IDs for each button in the bar (in order). Separate multiple pages with semicolons (;)"],
- order = 6,
- type = "input",
- multiline = true,
- width = "double",
- hidden = "IsMultiIDHidden",
- get = "GetMultiID",
- set = "SetMultiID",
- validate = "ValidateMultiID",
- },
- },
- },
- }
-
- local meta = { __index = Handle }
-
- function Handle:New( bar )
- return setmetatable(
- {
- bar = bar,
- config = bar:GetConfig(),
- },
- meta)
- end
-
- function Handle:Refresh()
- Button:SetupBar(bar)
- end
-
- function Handle:UpdateButtonLock()
- Button.SetButtonLock(self.bar, self.config.lockButtons, self.config.lockButtonsCombat)
- end
-
- function Handle:GetLastButton()
- return self.bar:GetButton(self.bar:GetNumButtons())
- end
-
- -- options handlers
- function Handle:GetOptions()
- return {
- type = "group",
- name = L["Action Buttons"],
- handler = self,
- args = options
- }
- end
-
- function Handle:SetHideEmpty(info, value)
- if value ~= self.config.hideEmpty then
- self.config.hideEmpty = value
- for _, b in self.bar:IterateButtons() do
- b:ShowGrid(not value)
- end
- end
- end
-
- function Handle:GetHideEmpty()
- return self.config.hideEmpty
- end
-
- function Handle:GetLockButtons()
- return self.config.lockButtons
- end
-
- function Handle:SetLockButtons(info, value)
- self.config.lockButtons = value
- self:UpdateButtonLock()
- end
-
- function Handle:GetLockButtonsCombat()
- return self.config.lockButtonsCombat
- end
-
- function Handle:SetLockButtonsCombat(info, value)
- self.config.lockButtonsCombat = value
- self:UpdateButtonLock()
- end
-
- function Handle:LockButtonsCombatDisabled()
- return not self.config.lockButtons
- end
-
- function Handle:GetNumPages()
- return self.config.nPages
- end
-
- function Handle:SetNumPages(info, value)
- self.config.nPages = value
- self:Refresh()
- end
-
- function Handle:GetMindControl()
- return self.config.mindcontrol
- end
-
- function Handle:SetMindControl(info, value)
- self.config.mindcontrol = value
- self:Refresh()
- end
-
- function Handle:GetVehicle()
- return self.config.vehicle
- end
-
- function Handle:SetVehicle(info, value)
- self.config.vehicle = value
- self:Refresh()
- end
-
- function Handle:GetActionEditMethod()
- return self.editMethod or 0
- end
-
- function Handle:SetActionEditMethod(info, value)
- self.editMethod = value
- end
-
- function Handle:IsButtonSelectHidden()
- return self.editMethod ~= 1
- end
-
- function Handle:GetRowList()
- local r,c = self.bar:GetButtonGrid()
- if self.rowList == nil or #self.rowList ~= r then
- local list = { }
- for i = 1, r do
- table.insert(list,i)
- end
- self.rowList = list
- end
- return self.rowList
- end
-
- function Handle:GetSelectedRow()
- local r, c = self.bar:GetButtonGrid()
- local row = self.selectedRow or 1
- if row > r then
- row = 1
- end
- self.selectedRow = row
- return row
- end
-
- function Handle:SetSelectedRow(info, value)
- self.selectedRow = value
- end
-
- function Handle:GetColumnList()
- local r,c = self.bar:GetButtonGrid()
- if self.columnList == nil or #self.columnList ~= c then
- local list = { }
- for i = 1, c do
- table.insert(list,i)
- end
- self.columnList = list
- end
- return self.columnList
- end
-
- function Handle:GetSelectedColumn()
- local r, c = self.bar:GetButtonGrid()
- local col = self.selectedColumn or 1
- if col > c then
- col = 1
- end
- self.selectedColumn = col
- return col
- end
-
- function Handle:SetSelectedColumn(info, value)
- self.selectedColumn = value
- end
-
- function Handle:IsPageSelectHidden()
- return self.editMethod ~= 1 or (self.config.nPages or 1) < 2
- end
-
- function Handle:GetPageList()
- local n = self.config.nPages or 1
- if self.pageList == nil or #self.pageList ~= n then
- local p = { }
- for i = 1, n do
- table.insert(p,i)
- end
- self.pageList = p
- end
- return self.pageList
- end
-
- function Handle:GetSelectedPage()
- local p = self.selectedPage or 1
- if p > (self.config.nPages or 1) then
- p = 1
- end
- self.selectedPage = p
- return p
- end
-
- function Handle:SetSelectedPage(info, value)
- self.selectedPage = value
- end
-
- function Handle:GetActionID()
- local row = self.selectedRow or 1
- local col = self.selectedColumn or 1
- local r, c = self.bar:GetButtonGrid()
- local n = (row-1) * c + col
- local btn = self.bar:GetButton(n)
- if btn then
- return tostring(btn:GetActionID(self.selectedPage or 1))
- end
- end
-
- function Handle:SetActionID(info, value)
- local row = self.selectedRow or 1
- local col = self.selectedColumn or 1
- local r, c = self.bar:GetButtonGrid()
- local n = (row-1) * c + col
- local btn = self.bar:GetButton(n)
- if btn then
- btn:SetActionID(tonumber(value), self.selectedPage or 1)
- end
- end
-
- function Handle:ValidateActionID(info, value)
- value = tonumber(value)
- if value == nil or value < 1 or value > 120 then
- return L["Specify ID 1-120"]
- end
- return true
- end
-
- function Handle:IsMultiIDHidden()
- return self.editMethod ~= 2
- end
-
- function Handle:GetMultiID()
- local p = { }
- for i = 1, self.config.nPages or 1 do
- local b = { }
- for _, btn in self.bar:IterateButtons() do
- table.insert(b, btn:GetActionID(i))
- end
- table.insert(p, table.concat(b,","))
- end
- return table.concat(p,";\n")
- end
-
-
- local function ParseMultiID(nBtns, nPages, s)
- if s:match("[^%d%s,;]") then
- return nil
- end
- local p = { }
- for list in s:gmatch("[^;]+") do
- local pattern = ("^%s?$"):format(("%s*(%d+)%s*,"):rep(nBtns))
- local ids = { list:match(pattern) }
- if #ids ~= nBtns then
- return nil
- end
- table.insert(p,ids)
- end
- if #p ~= nPages then
- return nil
- end
- return p
- end
-
- function Handle:SetMultiID(info, value)
- local p = ParseMultiID(self.bar:GetNumButtons(), self.config.nPages or 1, value)
- for page, b in ipairs(p) do
- for button, id in ipairs(b) do
- self.bar:GetButton(button):SetActionID(id, page)
- end
- end
- end
-
- function Handle:ValidateMultiID(info, value)
- local bad = L["Invalid action ID list string"]
- if value == nil or ParseMultiID(self.bar:GetNumButtons(), self.config.nPages or 1, value) == nil then
- return bad
- end
- return true
- end
-end
-
-
------ State property options ------
do
local pageOptions = {
diff -r dcdc0235d489 -r 704f4a05a1d7 modules/PetAction.lua
--- a/modules/PetAction.lua Thu Mar 24 13:09:44 2011 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
---[[
- ReAction Pet Action button options module
---]]
-
--- local imports
-local addonName, addonTable = ...
-local ReAction = addonTable.ReAction
-local L = ReAction.L
-local _G = _G
-local CreateFrame = CreateFrame
-local format = string.format
-
--- module declaration
-local moduleID = "PetAction"
-local module = ReAction:NewModule( moduleID )
-
--- Button class
-local Button = ReAction.Button.PetAction
-
-
--- module methods
-function module:OnInitialize()
- ReAction:RegisterBarOptionGenerator(self, "GetBarOptions")
-end
-
-
-
-
----- Options ----
-local Handler = { }
-local meta = { __index = Handler }
-
-function Handler:New(bar)
- return setmetatable(
- {
- bar = bar,
- config = bar.config
- }, meta)
-end
-
-function Handler:GetLockButtons()
- return self.config.lockButtons
-end
-
-function Handler:SetLockButtons(info, value)
- self.config.lockButtons = value
- Button:UpdateButtonLock(self.bar)
-end
-
-function Handler:GetLockButtonsCombat()
- return self.config.lockButtonsCombat
-end
-
-function Handler:SetLockButtonsCombat(info, value)
- self.config.lockButtonsCombat = value
- Button:UpdateButtonLock(self.bar)
-end
-
-function Handler:LockButtonsCombatDisabled()
- return not self.config.lockButtons
-end
-
-
-function module:GetBarOptions(bar)
- if bar.config.type == moduleID then
- return {
- type = "group",
- name = L["Pet Buttons"],
- handler = Handler:New(bar),
- args = {
- lockButtons = {
- name = L["Lock Buttons"],
- desc = L["Prevents picking up/dragging actions (use SHIFT to override this behavior)"],
- order = 2,
- type = "toggle",
- get = "GetLockButtons",
- set = "SetLockButtons",
- },
- lockOnlyCombat = {
- name = L["Only in Combat"],
- desc = L["Only lock the buttons when in combat"],
- order = 3,
- type = "toggle",
- disabled = "LockButtonsCombatDisabled",
- get = "GetLockButtonsCombat",
- set = "SetLockButtonsCombat",
- },
- }
- }
- end
-end
-
-
diff -r dcdc0235d489 -r 704f4a05a1d7 modules/VehicleExit.lua
--- a/modules/VehicleExit.lua Thu Mar 24 13:09:44 2011 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
---[[
- ReAction Vehicle Exit button options module
---]]
-
--- local imports
-local addonName, addonTable = ...
-local ReAction = addonTable.ReAction
-local L = ReAction.L
-
--- module declaration
-local moduleID = "VehicleExit"
-local module = ReAction:NewModule( moduleID )
-
--- Button class
-local Button = ReAction.Button.VehicleExit
-
--- module methods
-function module:OnInitialize()
- self.registered = { }
- self.buttons = { }
-
- ReAction:RegisterBarOptionGenerator(self, "GetBarOptions")
-end
-
----- Options ----
-local Handler = { }
-local meta = { __index = Handler }
-
-function Handler:New(bar)
- return setmetatable(
- {
- bar = bar
- }, meta)
-end
-
-function Handler:GetConfig()
- return self.bar:GetConfig()
-end
-
-function Handler:GetPassengerOnly()
- return not self:GetConfig().withControls
-end
-
-function Handler:SetPassengerOnly(info, value)
- self:GetConfig().withControls = not value
- Button:UpdateRegistration(self.bar)
-end
-
-
-function module:GetBarOptions(bar)
- if bar.config.type == moduleID then
- return {
- type = "group",
- name = L["Exit Vehicle"],
- handler = Handler:New(bar),
- args = {
- passengerOnly = {
- name = L["Show only when passenger"],
- desc = L["Only show the button when riding as a passenger in a vehicle (no vehicle controls)"],
- order = 2,
- width = "double",
- type = "toggle",
- get = "GetPassengerOnly",
- set = "SetPassengerOnly",
- },
- }
- }
- end
-end
-
-
diff -r dcdc0235d489 -r 704f4a05a1d7 modules/modules.xml
--- a/modules/modules.xml Thu Mar 24 13:09:44 2011 -0700
+++ b/modules/modules.xml Thu Mar 24 13:11:30 2011 -0700
@@ -4,10 +4,5 @@
-
-
-
-
-
\ No newline at end of file