Author: ayoung
Date: Fri Sep 24 07:20:19 2010
New Revision: 9133

URL: http://svn.slimdevices.com/jive?rev=9133&view=rev
Log:
When looking for an menu item by index, jump directly there rather than 
scrolling, which is liable to be mucked about by acceleration.
Add macroSelectMenuId() to use a menu-item id to select it.

Modified:
    
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/MacroPlay/MacroPlayApplet.lua

Modified: 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/MacroPlay/MacroPlayApplet.lua
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/applets/MacroPlay/MacroPlayApplet.lua?rev=9133&r1=9132&r2=9133&view=diff
==============================================================================
--- 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/MacroPlay/MacroPlayApplet.lua
 (original)
+++ 
7.6/trunk/squeezeplay/src/squeezeplay/share/applets/MacroPlay/MacroPlayApplet.lua
 Fri Sep 24 07:20:19 2010
@@ -398,11 +398,32 @@
        if index > len then
                return false
        end
+       
+       menu:setSelectedIndex(index)
+       macroDelay(100)
 
        while menu:getSelectedIndex() ~= index do
                macroEvent(100, EVENT_SCROLL, 1)
        end
 
+       macroDelay(interval)
+       return true
+end
+
+
+-- select the menu item, using id
+function macroSelectMenuId(interval, id)
+       local menu = _macroFindWidget(Menu)
+       if not menu then
+               return
+       end
+       
+       local index = menu:getIdIndex(id)
+       
+       if index == nil then return false end
+       
+       menu:setSelectedIndex(index)
+               
        macroDelay(interval)
        return true
 end
@@ -474,13 +495,13 @@
 
 
 -- force return to the home menu
-function macroHome(interval)
+function macroHome(interval, initialInterval)
        log:info("macroHome")
        if #Framework.windowStack > 1 then
                Framework.windowStack[#Framework.windowStack - 1]:hideToTop()
        end
 
-       macroDelay(50)
+       macroDelay(initialInterval or 50)
        local menu = _macroFindWidget(Menu)
        menu:setSelectedIndex(1)
 

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

Reply via email to