# HG changeset patch
# User Flick
# Date 1301095705 25200
# Node ID 2669f737d9d789f4680a811b1e3ccb28ae0b581a
# Parent 8bde290d300c64f8083337995a8a6915f3e9e1ef
Fold Action page state options into state.lua
diff -r 8bde290d300c -r 2669f737d9d7 modules/Action.lua
--- a/modules/Action.lua Thu Mar 24 14:27:56 2011 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-local addonName, addonTable = ...
-local ReAction = addonTable.ReAction
-local L = ReAction.L
-local _G = _G
-local format = string.format
-local wipe = wipe
-
-local weak = { __mode="k" }
-
--- module declaration
-local moduleID = "Action"
-local module = ReAction:NewModule( moduleID )
-
--- Class declarations
-local PropHandler = { }
-
--- Event handlers
-function module:OnInitialize()
- self.handles = setmetatable({ }, weak)
-end
-
-function module:OnEnable()
- ReAction:GetModule("State"):RegisterStateProperty("page", nil, PropHandler.GetOptions(), PropHandler)
-end
-
-function module:OnDisable()
- ReAction:GetModule("State"):UnregisterStateProperty("page")
-end
-
------- State property options ------
-do
- local pageOptions = {
- page = {
- name = L["Show Page #"],
- order = 11,
- type = "select",
- width = "half",
- disabled = "IsPageDisabled",
- hidden = "IsPageHidden",
- values = "GetPageValues",
- set = "SetProp",
- get = "GetPage",
- },
- }
-
- function PropHandler.GetOptions()
- return pageOptions
- end
-
- function PropHandler:IsPageDisabled()
- local c = self.bar:GetConfig()
- local n = c and c.nPages or 1
- return not (n > 1)
- end
-
- function PropHandler:IsPageHidden()
- return not self.bar:GetConfig()
- end
-
- function PropHandler:GetPageValues()
- if not self._pagevalues then
- self._pagevalues = { }
- end
- local c = self.bar:GetConfig()
- if c then
- local n = c.nPages
- -- cache the results
- if self._npages ~= n then
- self._npages = n
- wipe(self._pagevalues)
- for i = 1, n do
- self._pagevalues["page"..i] = i
- end
- end
- end
- return self._pagevalues
- end
-
- function PropHandler:GetPage(info)
- return self:GetProp(info) or 1
- end
-
-end
-
diff -r 8bde290d300c -r 2669f737d9d7 modules/State.lua
--- a/modules/State.lua Thu Mar 24 14:27:56 2011 -0700
+++ b/modules/State.lua Fri Mar 25 16:28:25 2011 -0700
@@ -238,6 +238,17 @@
order = 1,
type = "description"
},
+ page = {
+ name = L["Show Page #"],
+ order = 11,
+ type = "select",
+ width = "half",
+ disabled = "IsPageDisabled",
+ hidden = "IsPageHidden",
+ values = "GetPageValues",
+ set = "SetProp",
+ get = "GetPage",
+ },
hide = {
name = L["Hide Bar"],
order = 90,
@@ -649,6 +660,35 @@
return not GetProperty(self.bar, self:GetName(), "anchorEnable")
end
+ function StateHandler:IsPageDisabled()
+ local n = self.bar:GetConfig().nPages or 1
+ return not (n > 1)
+ end
+
+ function StateHandler:IsPageHidden()
+ return not self.bar:GetConfig().nPages
+ end
+
+ function StateHandler:GetPageValues()
+ if not self._pagevalues then
+ self._pagevalues = { }
+ end
+ local n = self.bar:GetConfig().nPages
+ -- cache the results
+ if self._npages ~= n then
+ self._npages = n
+ wipe(self._pagevalues)
+ for i = 1, n do
+ self._pagevalues["page"..i] = i
+ end
+ end
+ return self._pagevalues
+ end
+
+ function StateHandler:GetPage(info)
+ return self:GetProp(info) or 1
+ end
+
function StateHandler:GetAnchorFrames(info)
self._anchorframes = self._anchorframes or { }
table.wipe(self._anchorframes)
diff -r 8bde290d300c -r 2669f737d9d7 modules/modules.xml
--- a/modules/modules.xml Thu Mar 24 14:27:56 2011 -0700
+++ b/modules/modules.xml Fri Mar 25 16:28:25 2011 -0700
@@ -3,6 +3,5 @@
xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd">
-
\ No newline at end of file