Author: tom
Date: Tue Oct 14 12:12:12 2008
New Revision: 3125
URL: http://svn.slimdevices.com?rev=3125&root=Jive&view=rev
Log:
Bug: 9715
Description:
Support Page Up/ Page Down
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua
7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Textarea.lua
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/lua_jiveui.c
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua?rev=3125&root=Jive&r1=3124&r2=3125&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Menu.lua Tue Oct 14
12:12:12 2008
@@ -80,6 +80,8 @@
local KEY_LEFT = jive.ui.KEY_LEFT
local KEY_RIGHT = jive.ui.KEY_RIGHT
local KEY_PLAY = jive.ui.KEY_PLAY
+local KEY_PAGE_UP = jive.ui.KEY_PAGE_UP
+local KEY_PAGE_DOWN = jive.ui.KEY_PAGE_DOWN
-- our class
@@ -165,6 +167,14 @@
elseif keycode == KEY_DOWN then
self:scrollBy( 1 )
+ return EVENT_CONSUME
+
+ elseif keycode == KEY_PAGE_UP then
+ self:scrollBy( -( self.numWidgets - 1 ), true);
+ return EVENT_CONSUME
+
+ elseif keycode == KEY_PAGE_DOWN then
+ self:scrollBy( self.numWidgets - 1 , true);
return EVENT_CONSUME
elseif keycode == KEY_GO or
@@ -504,13 +514,15 @@
--[[
-=head2 jive.ui.Menu:scrollBy(scroll)
-
-Scroll the menu by I<scroll> items. If I<scroll> is negative the menu scrolls
up, otherwise the menu scrolls down.
-
-=cut
---]]
-function scrollBy(self, scroll)
+=head2 jive.ui.Menu:scrollBy(scroll, allowMultiple)
+
+Scroll the menu by I<scroll> items. If I<scroll> is negative the menu scrolls
up, otherwise the menu scrolls down. By
+ default, restricts to scrolling one item unless at the edge of the visible
list. If I<allowMultiple> is non-nil,
+ ignore that behavior and scroll the requested scroll amount.
+
+=cut
+--]]
+function scrollBy(self, scroll, allowMultiple)
_assert(type(scroll) == "number")
local selected = (self.selected or 1)
@@ -545,12 +557,12 @@
self.scrollLastT = now
-- restrict to scrolling one item unless at the edge of the
- -- visible list
+ -- visible list, to stop it from visibly missing items when using the
controller scroll wheel.
if scroll > 0 then
self.dir = 1
self.accel = scroll > 1
- if selected < self.topItem + self.numWidgets - 2 then
+ if not allowMultiple and selected < self.topItem +
self.numWidgets - 2 then
scroll = 1
end
@@ -558,7 +570,7 @@
self.dir = -1
self.accel = scroll < -1
- if selected > self.topItem + 1 then
+ if not allowMultiple and selected > self.topItem + 1 then
scroll = -1
end
else
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Textarea.lua
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Textarea.lua?rev=3125&root=Jive&r1=3124&r2=3125&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Textarea.lua (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/share/jive/ui/Textarea.lua Tue Oct 14
12:12:12 2008
@@ -70,6 +70,8 @@
local KEY_DOWN = jive.ui.KEY_DOWN
local KEY_LEFT = jive.ui.KEY_LEFT
local KEY_RIGHT = jive.ui.KEY_RIGHT
+local KEY_PAGE_UP = jive.ui.KEY_PAGE_UP
+local KEY_PAGE_DOWN = jive.ui.KEY_PAGE_DOWN
-- our class
@@ -199,7 +201,15 @@
elseif keycode == KEY_DOWN then
self:scrollBy( self.visibleLines - 1 )
return EVENT_CONSUME
-
+
+ elseif keycode == KEY_PAGE_UP then
+ self:scrollBy( -(self.visibleLines - 1) )
+ return EVENT_CONSUME
+
+ elseif keycode == KEY_PAGE_DOWN then
+ self:scrollBy( self.visibleLines - 1 )
+ return EVENT_CONSUME
+
elseif keycode == KEY_GO or
keycode == KEY_RIGHT then
self:playSound("BUMP")
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h?rev=3125&root=Jive&r1=3124&r2=3125&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h Tue Oct 14 12:12:12 2008
@@ -133,6 +133,8 @@
JIVE_KEY_FWD = 0x0800,
JIVE_KEY_VOLUME_UP = 0x1000,
JIVE_KEY_VOLUME_DOWN = 0x2000,
+ JIVE_KEY_PAGE_UP = 0x4000,
+ JIVE_KEY_PAGE_DOWN = 0x8000,
} JiveKey;
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=3125&root=Jive&r1=3124&r2=3125&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Tue Oct 14
12:12:12 2008
@@ -82,6 +82,8 @@
{ SDLK_AudioNext, JIVE_KEY_FWD },
{ SDLK_AudioRaiseVolume,JIVE_KEY_VOLUME_UP },
{ SDLK_AudioLowerVolume,JIVE_KEY_VOLUME_DOWN },
+ { SDLK_PAGEUP, JIVE_KEY_PAGE_UP },
+ { SDLK_PAGEDOWN, JIVE_KEY_PAGE_DOWN },
{ SDLK_UNKNOWN, JIVE_KEY_NONE },
};
@@ -1118,6 +1120,20 @@
return 0;
}
+ /* handle pgup/upgn as repeatable keys */
+ if (entry->keysym == SDLK_PAGEUP || entry->keysym ==
SDLK_PAGEDOWN) {
+ if (event->type == SDL_KEYDOWN) {
+ JiveEvent keypress;
+
+ memset(&keypress, 0, sizeof(JiveEvent));
+ keypress.type = JIVE_EVENT_KEY_PRESS;
+ keypress.ticks = SDL_GetTicks();
+ keypress.u.key.code = entry->keycode;
+ jive_queue_event(&keypress);
+ }
+ return 0;
+ }
+
if (event->type == SDL_KEYDOWN) {
if (key_mask & entry->keycode) {
// ignore key repeats
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/lua_jiveui.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/lua_jiveui.c?rev=3125&root=Jive&r1=3124&r2=3125&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/lua_jiveui.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/lua_jiveui.c Tue Oct 14
12:12:12 2008
@@ -2225,6 +2225,8 @@
tolua_constant(tolua_S,"KEY_FWD",JIVE_KEY_FWD);
tolua_constant(tolua_S,"KEY_VOLUME_UP",JIVE_KEY_VOLUME_UP);
tolua_constant(tolua_S,"KEY_VOLUME_DOWN",JIVE_KEY_VOLUME_DOWN);
+ tolua_constant(tolua_S,"KEY_PAGE_UP",JIVE_KEY_PAGE_UP);
+ tolua_constant(tolua_S,"KEY_PAGE_DOWN",JIVE_KEY_PAGE_DOWN);
tolua_cclass(tolua_S,"Surface","Surface","",tolua_jive_jive_ui_Surface_free00);
tolua_beginmodule(tolua_S,"Surface");
tolua_function(tolua_S,"newRGB",tolua_jive_jive_ui_Surface_newRGB00);
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins