changeset 68:1687ae1c6162

fixed :ToFront not remembering the current channel
author Nenue
date Sat, 12 Mar 2016 02:31:55 -0500
parents 137b8c55a593
children e89244da507b
files Devian.toc UI.lua
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Devian.toc	Wed Mar 09 19:29:23 2016 -0500
+++ b/Devian.toc	Sat Mar 12 02:31:55 2016 -0500
@@ -3,7 +3,7 @@
 ## Notes: AddOn Development Workspace
 ## Author: Krakyn
 ## Version: 2.0 @project-revision@
-## SavedVariables: DevianDB
+## SavedVariables: DevianDB, DevianLoadMessage
 ## OptionalDeps: Ace3
 Devian.xml
 Devian.lua
--- a/UI.lua	Wed Mar 09 19:29:23 2016 -0500
+++ b/UI.lua	Sat Mar 12 02:31:55 2016 -0500
@@ -91,6 +91,7 @@
 -- Frame method used to bring a console frame to the front of the display stack.
 local function Console_ToFront(c)
   local db = D.db
+  local profile = D.currentProfile
   c:Raise()
   c:SetAlpha(db.frontalpha)
   c.out.backdrop:SetTexture(unpack(db.frontdrop))
@@ -100,7 +101,7 @@
   c.title:SetTextColor(unpack(db.frontborder))
 
   --oldprint('changing current toplevel from', db.current_channel, 'to', c.index)
-  db.current_channel = c.index
+  profile.current_channel = c.index
 
   --oldprint('toplevel is now', db.current_channel)
   c:Save()
@@ -247,7 +248,8 @@
   else
     f:Maximize()
   end
-  if db.enabled and f.enabled then
+  if db.enabled then
+    f.enabled = true
     f:Show()
   end
 
@@ -268,7 +270,7 @@
   local t_info = {}
   local channel, isNew, id, sig, t_id
   --@debug@
-  print('setchan(0) cinfo, key', cinfo, key)--@end-debug@
+  --print('setchan(0) cinfo, key', cinfo, key)--@end-debug@
   -- obtain source data
   if tonumber(key) ~= nil and  D.channels[key] then
     id = tonumber(key)
@@ -282,7 +284,7 @@
   t_id = id           -- overridden later if new
   t_info.index = t_id --
   --@debug@
-  print('setchan(1) cinfo, key, id=', cinfo, key, id)--@end-debug@
+  --print('setchan(1) cinfo, key, id=', cinfo, key, id)--@end-debug@
 
 
   -- obtain config info
@@ -300,7 +302,7 @@
   end
   t_info.signature = sig
   --@debug@
-  print('setchan(2) sig,id,isNew=', sig, id, isNew)--@end-debug@
+  --print('setchan(2) sig,id,isNew=', sig, id, isNew)--@end-debug@
 
   for k,v in pairs(cinfo) do -- allow all cinfo to pass
   t_info[k] = v
@@ -328,10 +330,10 @@
     t_id = self.max_channel + 1
     t_info.index = t_id
     --@debug@
-    print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
+    --print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
   else
     --@debug@
-    print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
+    --print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@
   end
 
   local channel
@@ -342,7 +344,7 @@
       t_info.y = t_info.y - 20
       profile.channels[t_id] = t_info
       --@debug@
-      print('setchan(4a)', 't_id, x, y=', t_id, t_info.x, t_info.y)--@end-debug@
+      --print('setchan(4a)', 't_id, x, y=', t_id, t_info.x, t_info.y)--@end-debug@
     end
     channel = CreateConsole(t_id, t_info)
     self.console[t_id] = channel
@@ -358,15 +360,15 @@
   end
 
   if channel.enabled then -- hide or show last since Min/Max mess with visibility
-  print('setchan(5a) enable')
+  --print('setchan(5a) enable')
     channel:Show()
     --channel:ToFront()
   else
-    print('setchan(5a) disable')
+    --print('setchan(5a) disable')
     channel:Hide()
   end
   --@debug@
-  print('setchan(end); c:IsVisible(), c.enabled, db.enabled=', channel:IsVisible(), channel.enabled, profile.enabled)--@end-debug@
+  --print('setchan(end); c:IsVisible(), c.enabled, db.enabled=', channel:IsVisible(), channel.enabled, profile.enabled)--@end-debug@
   return channel
 end
 
@@ -406,7 +408,7 @@
   end
 
   for i, id in pairs(search) do
-    --oldprint(i, id)
+    oldprint(i, id)
     local c = self.console[id]
     if setAll then
       c.enabled = profile.enabled and profile.enabled or nil
@@ -417,7 +419,7 @@
       if force == 0 then
         c.enabled = nil
       end
-      --oldprint(id, '  ', force, c.enabled, db.enabled)
+      oldprint(id, '  ', force, c.enabled, profile.enabled)
     end
 
     if c.enabled or (setAll and profile.enabled) then