changeset 127:29dacbecdb52

Fixed handling for making new bars with the same name
author Flick <flickerstreak@gmail.com>
date Wed, 04 Mar 2009 21:19:32 +0000
parents 6a4b4d3c5fad
children 729232aeeb5e
files ReAction.lua locale/enUS.lua modules/ConfigUI.lua
diffstat 3 files changed, 26 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ReAction.lua	Tue Mar 03 23:18:35 2009 +0000
+++ b/ReAction.lua	Wed Mar 04 21:19:32 2009 +0000
@@ -306,7 +306,12 @@
 function ReAction:CreateBar(name, config, ...)
   local profile = self.db.profile
 
-  if not name then
+  if name then
+    if bars[name] then
+      self:UserError(format(L["ReAction: name '%s' already in use"],name))
+      return nil
+    end
+  else
     local prefix = L["Bar "]
     local i = 1
     repeat
@@ -371,8 +376,11 @@
     error("ReAction:RenameBar() - second argument must be a string")
   end
   if bar and name and #newname > 0 then
+    if newname == name then
+      return
+    end
     if bars[newname] then
-      self:UserError(("%s ('%s')"):format(L["ReAction: name already in use"],newname))
+      self:UserError(format(L["ReAction: name '%s' already in use"],newname))
     else
       bars[newname], bars[name] = bars[name], nil
       bar:SetName(newname or "")
--- a/locale/enUS.lua	Tue Mar 03 23:18:35 2009 +0000
+++ b/locale/enUS.lua	Wed Mar 04 21:19:32 2009 +0000
@@ -9,7 +9,7 @@
 
 -- ReAction.lua
 "Bar ",
-"ReAction: name already in use",
+"ReAction: name '%s' already in use",
 "ReAction config mode disabled during combat.",
 "Customizable replacement for Blizzard's Action Bars",
 "Global Settings",
@@ -23,6 +23,16 @@
 "Default",
 "ReAction profile changed: check your keybinds, they may need to be updated.",
 "OK",
+"ReAction: can't configure in combat",
+"Click",
+"Right-click",
+"Shift-click",
+"Alt-click",
+"for global configuration",
+"for bar editor dialog",
+"to unlock bars",
+"for keybind mode",
+
 
 -- Overlay.lua
 "Hold Shift",
@@ -120,18 +130,6 @@
 "Create State",
 "State named '%s' already exists",
 
--- LDB.lua
-"ReAction: can't configure in combat",
-"Click",
-"Right-click",
-"Shift-click",
-"Alt-click",
-"for global configuration",
-"for bar editor dialog",
-"to unlock bars",
-"for keybind mode",
-
-
 -- HideBlizzard
 "Hide Blizzard Action Bars",
 "Hide the default main bar and extra action bars",
--- a/modules/ConfigUI.lua	Tue Mar 03 23:18:35 2009 +0000
+++ b/modules/ConfigUI.lua	Wed Mar 04 21:19:32 2009 +0000
@@ -494,9 +494,11 @@
     if tmp.barName and tmp.barName ~= "" then
       tmp.creating = true
       local bar = ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing)
-      self:CreateBarTree(bar)
-      AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName])
-      tmp.barName = nil
+      if bar then
+        self:CreateBarTree(bar)
+        AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName])
+        tmp.barName = nil
+      end
       tmp.creating = false
     end
   end