diff modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 48:7b7d178dec52

Implemented bar-type selection, extended CreateBar functionality
author Flick <flickerstreak@gmail.com>
date Sat, 12 Apr 2008 00:15:09 +0000
parents e12b736c23c3
children c3c64e2def50
line wrap: on
line diff
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua	Fri Apr 11 22:21:28 2008 +0000
+++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua	Sat Apr 12 00:15:09 2008 +0000
@@ -48,7 +48,8 @@
 end
 
 function module:OnOptionsRefreshed(evt)
-  -- TODO: refresh options frame (just OpenConfig again?)
+  AceConfigReg:NotifyChange("ReAction")
+  AceConfigReg:NotifyChange("ReAction-Layout")
 end
 
 function module:OnCreateBar(evt, bar)
@@ -156,7 +157,7 @@
           ReAction:SetConfigMode(false)
         end )
       self.editor = ed
-      AceConfigDialog:SetDefaultSize("ReAction-Layout", 600, 450)
+      AceConfigDialog:SetDefaultSize("ReAction-Layout", 640, 420)
     end
 
     AceConfigDialog:Open("ReAction-Layout", self.editor)
@@ -173,24 +174,21 @@
 
 function module:GetBarTypes()
   local opts = self.optBarTypes or { }
-  self.optBarTypes = opts
-
-  -- TODO: get these from module registration somehow
-  opts[1] = "foo"
-  
+  self.optBarTypes = { }
+  for k,v in pairs(opts) do
+    opts[k] = nil
+  end
+  for k in pairs(ReAction.defaultBarConfig) do
+    opts[k] = k
+  end
   return opts
 end
 
 function module:CreateBar()
-  local name = self.tmpBarName
-  local type = self.tmpBarType
-
-  self.tmpBarName = nil
-  self.tmpBarType = nil
-
-  -- TODO: get from module registration
-  -- TODO: use rows/cols info
-  ReAction:CreateBar(name)
+  if self.tmpBarType and self.tmpBarType ~= "" then
+    ReAction:CreateBar(self.tmpBarName, self.tmpBarType, self.tmpBarRows, self.tmpBarCols, self.tmpBarSize, self.tmpBarSpacing)
+    self.tmpBarName = nil
+  end
 end
 
 function module:InitializeOptions()
@@ -305,14 +303,14 @@
             self:OpenConfig()
             -- you can't close a dialog in response to an options click, because the end of the 
             -- handler for all the button events calls lib:Open()
-            -- So, schedule a close on the next appropriate event
+            -- So, schedule a close on the next OnUpdate
             if self.db.profile.editorCloseOnLaunch then
               self.editor.selfClosePending = true
             end
           end,
         order = 2
       },
-      closThis = {
+      closeThis = {
         type = "toggle",
         name = L["Close on Launch"],
         desc = L["Close the Layout Editor when opening the ReAction global Interface Options"],
@@ -341,7 +339,7 @@
           type = {
             type = "select",
             name = L["Button Type"],
-            get  = function() return self.tmpBarType or "" end,
+            get  = function() return self.tmpBarType or ReAction.defaultBarConfigChoice or "" end,
             set  = function(info, val) self.tmpBarType = val end,
             values = "GetBarTypes",
             order = 3,