Author: bklaas
Date: Wed Feb 20 13:35:48 2008
New Revision: 1989

URL: http://svn.slimdevices.com?rev=1989&root=Jive&view=rev
Log:
Bug: 6942
Description: add Menu method for getCurrentIndex, used by SlimBrowser to 
determine which index number represents the currently playing track
Stop violating encapsulation when setting the correct menu item for selection 
in the current playlist

Modified:
    trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
    trunk/jive/src/pkg/jive/share/jive/ui/Menu.lua

Modified: 
trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1989&root=Jive&r1=1988&r2=1989&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
(original)
+++ trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua Wed 
Feb 20 13:35:48 2008
@@ -1901,20 +1901,9 @@
 
 
                if playlistSize == nil or (playlistSize and playlistSize <= 1) 
then
-                       _statusStep.menu["_lastSelectedIndex"] = 1
-                       _statusStep.menu["_lastSelectedOffset"] = 1 
-                       _statusStep.menu.selected = 1 
-                       _statusStep.menu:_updateWidgets()
-               -- otherwise bring the currently playing item to the screen 
with offset of 2
-               elseif _statusStep.menu.list.currentIndex then
-                       _statusStep.menu.selected = 
_statusStep.menu.list.currentIndex
-                       if _statusStep.menu["_lastSelectedIndex"] then
-                               _statusStep.menu["_lastSelectedIndex"] = 
_statusStep.menu.selected
-                               _statusStep.menu["_lastSelectedOffset"] = 2
-                       end
-                       -- since we've hacked the _lastSelectedIndex, it's 
necessary to 
-                       -- _updateWidgets to display correctly selected item
-                       _statusStep.menu:_updateWidgets()
+                       _statusStep.menu:setSelectedIndex(1)
+               elseif _statusStep.menu:getCurrentIndex() then
+                       
_statusStep.menu:setSelectedIndex(_statusStep.menu:getCurrentIndex())
                end
 
                _statusStep.window:addListener(EVENT_KEY_PRESS,

Modified: trunk/jive/src/pkg/jive/share/jive/ui/Menu.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/jive/ui/Menu.lua?rev=1989&root=Jive&r1=1988&r2=1989&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/jive/ui/Menu.lua (original)
+++ trunk/jive/src/pkg/jive/share/jive/ui/Menu.lua Wed Feb 20 13:35:48 2008
@@ -380,6 +380,23 @@
 --]]
 function getSelectedItem(self)
        return _selectedItem(self)
+end
+
+--[[
+
+=head2 jive.ui.Menu:getCurrentIndex()
+
+Returns the index of the item that is marked as the currentIndex
+Used primarily in the current playlist
+
+=cut
+--]]
+function getCurrentIndex(self)
+       if self.list and self.list.currentIndex then
+               return self.list.currentIndex
+       else
+               return false
+       end
 end
 
 

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins

Reply via email to