diff -u -r rockbox_svn.orig/apps/SOURCES rockbox_svn/apps/SOURCES
--- rockbox_svn.orig/apps/SOURCES 2007-07-19 18:40:32.562500000 -0500
+++ rockbox_svn/apps/SOURCES 2007-07-20 12:03:47.171875000 -0500
@@ -43,6 +43,9 @@
#endif
filetree.c
scrobbler.c
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ipod_scroll_wheel_gui.c
+#endif
screen_access.c
gui/buttonbar.c
diff -u -r rockbox_svn.orig/apps/gui/list.c rockbox_svn/apps/gui/list.c
--- rockbox_svn.orig/apps/gui/list.c 2007-07-19 18:38:26.109375000 -0500
+++ rockbox_svn/apps/gui/list.c 2007-07-20 12:03:47.265625000 -0500
@@ -37,6 +37,10 @@
#include "sound.h"
#include "misc.h"
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+#include "ipod_scroll_wheel_gui.h"
+#endif
+
#ifdef HAVE_LCD_CHARCELLS
#define SCROLL_LIMIT 1
#else
@@ -58,7 +62,7 @@
#define SHOW_LIST_TITLE ((gui_list->title != NULL) && \
(gui_list->display->nb_lines > 2))
-static void gui_list_select_at_offset(struct gui_list * gui_list, int offset);
+void gui_list_select_at_offset(struct gui_list * gui_list, int offset);
/*
* Initializes a scrolling list
@@ -626,7 +630,7 @@
else gui_list->start_item = 0;
}
-static void gui_list_select_at_offset(struct gui_list * gui_list, int offset)
+void gui_list_select_at_offset(struct gui_list * gui_list, int offset)
{
/* do this here instead of in both select_above and select_below */
int nb_lines = gui_list->display->nb_lines;
@@ -817,7 +821,7 @@
gui_list_select_item(&(lists->gui_list[i]), item_number);
}
-static void gui_synclist_select_next_page(struct gui_synclist * lists,
+void gui_synclist_select_next_page(struct gui_synclist * lists,
enum screen_type screen)
{
int i;
@@ -826,7 +830,7 @@
screens[screen].nb_lines);
}
-static void gui_synclist_select_previous_page(struct gui_synclist * lists,
+void gui_synclist_select_previous_page(struct gui_synclist * lists,
enum screen_type screen)
{
int i;
@@ -895,8 +899,7 @@
#endif
static int next_item_modifier = 1;
static int last_accel_tick = 0;
- int i;
-
+
if (global_settings.list_accel_start_delay)
{
int start_delay = global_settings.list_accel_start_delay * (HZ/2);
@@ -951,8 +954,13 @@
#endif
case ACTION_STD_PREV:
case ACTION_STD_PREVREPEAT:
+ #if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ gui_synclist_handle_accel( lists, SCREEN_MAIN, BACKWARD, -next_item_modifier);
+ #else
+ int i;
FOR_NB_SCREENS(i)
gui_list_select_at_offset(&(lists->gui_list[i]), -next_item_modifier);
+ #endif
if (queue_count(&button_queue) < FRAMEDROP_TRIGGER)
gui_synclist_draw(lists);
yield();
@@ -960,8 +968,12 @@
case ACTION_STD_NEXT:
case ACTION_STD_NEXTREPEAT:
+ #if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ gui_synclist_handle_accel( lists, SCREEN_MAIN, FORWARD, next_item_modifier );
+ #else
FOR_NB_SCREENS(i)
gui_list_select_at_offset(&(lists->gui_list[i]), next_item_modifier);
+ #endif
if (queue_count(&button_queue) < FRAMEDROP_TRIGGER)
gui_synclist_draw(lists);
yield();
diff -u -r rockbox_svn.orig/apps/gui/list.h rockbox_svn/apps/gui/list.h
--- rockbox_svn.orig/apps/gui/list.h 2007-07-19 18:38:26.328125000 -0500
+++ rockbox_svn/apps/gui/list.h 2007-07-20 12:03:47.296875000 -0500
@@ -116,7 +116,6 @@
list_get_color *callback_get_item_color;
#endif
};
-
/*
* Sets the numbers of items the list can currently display
* note that the list's context like the currently pointed item is resetted
@@ -177,6 +176,22 @@
*/
#define gui_list_limit_scroll(gui_list, scroll) \
(gui_list)->limit_scroll=scroll
+struct gui_synclist * lists;
+extern void gui_list_select_at_offset(struct gui_list * gui_list, int offset);
+extern void gui_synclist_select_next_page(struct gui_synclist * lists, enum screen_type screen);
+extern void gui_synclist_select_previous_page(struct gui_synclist * lists, enum screen_type screen);
+
+ /*
+ * Advance/retreat in the list by n percent of the total list elements,
+ * by at least one line if percent_lines != 0
+ * - gui_list : the list structure
+ * - percent_lines : the percent of the total number of lines to try to move the cursor
+ * postive adavnces forward, negative retreats back, 0 has no effect
+ */
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+extern void gui_list_select_relative_percent( struct gui_list * gui_list,
+ int percent_lines );
+#endif
/*
* This part handles as many lists as there are connected screens
Only in rockbox_svn/apps: ipod_scroll_wheel_gui.c
Only in rockbox_svn/apps: ipod_scroll_wheel_gui.h
diff -u -r rockbox_svn.orig/apps/lang/english.lang rockbox_svn/apps/lang/english.lang
--- rockbox_svn.orig/apps/lang/english.lang 2007-07-19 18:36:17.453125000 -0500
+++ rockbox_svn/apps/lang/english.lang 2007-07-20 12:03:47.390625000 -0500
@@ -11048,3 +11048,59 @@
*: "Can't write to recording directory"
+
+ id: LANG_IPOD_SCROLL_WHEEL_SPEED
+ desc: "Ipod Scroll Wheel Acceleration By Speed" Submenu in "System" menu
+ user:
+
+ *: "Ipod Scroll Wheel Acceleration"
+
+
+ *: "Ipod Scroll Wheel Acceleration"
+
+
+ *: "Ipod Scroll Wheel Acceleration"
+
+
+
+ id: LANG_IPOD_SCROLL_WHEEL_FAST
+ desc: "Ipod Scroll Wheel By Speed Fast Threshold" Submenu in "Ipod Scroll Wheel Acceleration By Speed" menu
+ user:
+
+ *: "Minimum speed for 'fast' acceleration"
+
+
+ *: "Minimum speed for 'fast' acceleration"
+
+
+ *: "Minimum speed for 'fast' acceleration"
+
+
+
+ id: LANG_IPOD_SCROLL_WHEEL_FASTER
+ desc: "Ipod Scroll Wheel By Speed Faster Threshold" Submenu in "Ipod Scroll Wheel Acceleration By Speed" menu
+ user:
+
+ *: "Minimum speed for 'faster' acceleration"
+
+
+ *: "Minimum speed for 'faster' acceleration"
+
+
+ *: "Minimum speed for 'faster' acceleration"
+
+
+
+ id: LANG_IPOD_SCROLL_WHEEL_FASTEST
+ desc: "Ipod Scroll Wheel By Speed Fastest Threshold" Submenu in "Ipod Scroll Wheel Acceleration By Speed" menu
+ user:
+
+ *: "Minimum speed for 'fastest' acceleration"
+
+
+ *: "Minimum speed for 'fastest' acceleration"
+
+
+ *: "Minimum speed for 'fastest' acceleration"
+
+
diff -u -r rockbox_svn.orig/apps/menus/settings_menu.c rockbox_svn/apps/menus/settings_menu.c
--- rockbox_svn.orig/apps/menus/settings_menu.c 2007-07-19 18:38:28.203125000 -0500
+++ rockbox_svn/apps/menus/settings_menu.c 2007-07-20 12:03:47.421875000 -0500
@@ -333,6 +333,18 @@
MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL);
#endif
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+MENUITEM_SETTING(ipod_scroll_wheel_acceleration_fast, &global_settings.ipod_scroll_wheel_acceleration_fast, NULL);
+MENUITEM_SETTING(ipod_scroll_wheel_acceleration_faster, &global_settings.ipod_scroll_wheel_acceleration_faster, NULL);
+MENUITEM_SETTING(ipod_scroll_wheel_acceleration_fastest, &global_settings.ipod_scroll_wheel_acceleration_fastest, NULL);
+
+MAKE_MENU(ipod_scroll_wheel_acceleration_menu, ID2P(LANG_IPOD_SCROLL_WHEEL_SPEED), 0, Icon_NOICON,
+ &ipod_scroll_wheel_acceleration_fast,
+ &ipod_scroll_wheel_acceleration_faster,
+ &ipod_scroll_wheel_acceleration_fastest,
+ );
+#endif
+
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
0, Icon_System_menu,
&start_screen,
@@ -365,6 +377,9 @@
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
&buttonlight_brightness
#endif
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ &ipod_scroll_wheel_acceleration_menu,
+#endif
);
/* SYSTEM MENU */
diff -u -r rockbox_svn.orig/apps/settings.h rockbox_svn/apps/settings.h
--- rockbox_svn.orig/apps/settings.h 2007-07-19 18:40:31.671875000 -0500
+++ rockbox_svn/apps/settings.h 2007-07-20 12:03:47.437500000 -0500
@@ -712,6 +712,11 @@
#if defined(HAVE_RTC_ALARM) && \
(defined(HAVE_RECORDING) || CONFIG_TUNER)
int alarm_wake_up_screen;
+ #if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI)
+ unsigned int ipod_scroll_wheel_acceleration_fast;
+ unsigned int ipod_scroll_wheel_acceleration_faster;
+ unsigned int ipod_scroll_wheel_acceleration_fastest;
+ #endif
#endif
/* customizable icons */
#ifdef HAVE_LCD_BITMAP
diff -u -r rockbox_svn.orig/apps/settings_list.c rockbox_svn/apps/settings_list.c
--- rockbox_svn.orig/apps/settings_list.c 2007-07-19 18:40:31.953125000 -0500
+++ rockbox_svn/apps/settings_list.c 2007-07-20 12:03:47.484375000 -0500
@@ -737,6 +737,21 @@
"id3 tag priority", "v2-v1,v1-v2",
LANG_ID3_V1_FIRST, LANG_ID3_V2_FIRST, mpeg_id3_options),
+#if (CONFIG_KEYPAD == IPOD_4G_PAD) && !defined(IPOD_MINI)
+ INT_SETTING(0, ipod_scroll_wheel_acceleration_fast, LANG_IPOD_SCROLL_WHEEL_FAST, 135,
+ "ipod scroll wheel fast threshold in clicks/sec", UNIT_SEC,
+ 5, 500, 5,
+ NULL, NULL, NULL),
+ INT_SETTING(0, ipod_scroll_wheel_acceleration_faster, LANG_IPOD_SCROLL_WHEEL_FASTER, 235,
+ "ipod scroll wheel faster threshold in clicks/sec", UNIT_SEC,
+ 5, 500, 5,
+ NULL, NULL, NULL),
+ INT_SETTING(0, ipod_scroll_wheel_acceleration_fastest, LANG_IPOD_SCROLL_WHEEL_FASTEST, 400,
+ "ipod scroll wheel fastest threshold in clicks/sec", UNIT_SEC,
+ 5, 500, 5,
+ NULL, NULL, NULL),
+#endif
+
#ifdef HAVE_RECORDING
/* recording */
STRINGCHOICE_SETTING(F_RECSETTING, rec_timesplit, LANG_SPLIT_TIME, 0,
diff -u -r rockbox_svn.orig/firmware/target/arm/ipod/button-clickwheel.c rockbox_svn/firmware/target/arm/ipod/button-clickwheel.c
--- rockbox_svn.orig/firmware/target/arm/ipod/button-clickwheel.c 2007-07-19 18:43:59.921875000 -0500
+++ rockbox_svn/firmware/target/arm/ipod/button-clickwheel.c 2007-07-20 12:03:47.562500000 -0500
@@ -40,6 +40,10 @@
#include "system.h"
#include "powermgmt.h"
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+#include "logf.h"
+#endif
+
/* Variable to use for setting button status in interrupt handler */
int int_btn = BUTTON_NONE;
#ifdef HAVE_WHEEL_POSITION
@@ -47,6 +51,35 @@
static bool send_events = true;
#endif
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+void ipod_4g_button_int( void );
+
+static int accumulated_wheel_scroll_delta = 0;
+unsigned long wheel_scroll_down_microsecond_tick = 0;
+unsigned long wheel_scroll_key_microsecond_tick = 0;
+unsigned long wheel_scroll_key_microsecond_tick_elapsed = 0;
+const unsigned long ONE_MILLION = 1000000;
+
+int get_accumulated_wheel_scroll_delta( void ) {
+ return accumulated_wheel_scroll_delta;
+}
+
+int get_ipod_scroll_wheel_clicks_per_second( void ) {
+ unsigned long wst = wheel_scroll_key_microsecond_tick;
+ int accum = accumulated_wheel_scroll_delta;
+ unsigned int abs_accum = accum < 0 ? -accum : accum;
+ unsigned long wste = wheel_scroll_key_microsecond_tick_elapsed;
+ if( wste == wst ) wst = wheel_scroll_down_microsecond_tick;
+ unsigned long diff = wste - wst;
+ unsigned int r = diff ? ( ( abs_accum * ONE_MILLION ) / diff ) : 0;
+#ifdef ROCKBOX_HAS_LOGF
+ logf( "d1,%d,%d", wst, wste );
+ logf( "d2,%d,%d,%d", diff, accum, r );
+#endif
+ return accum < 0 ? -r : r;
+}
+#endif
+
static void opto_i2c_init(void)
{
int i, curr_value;
@@ -115,6 +148,21 @@
whl = new_wheel_value;
backlight_on();
reset_poweroff_timer();
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ if( old_wheel_value == -1 ) {
+ /* -1 is a sentinal value, meaning there is no old value
+ * because the finger was lifted and thus, no key to emit
+ */
+ old_wheel_value = new_wheel_value;
+ accumulated_wheel_scroll_delta = 0;
+ wheel_scroll_down_microsecond_tick = USEC_TIMER;
+ } else {
+ /* calculate the delta regardless of whether we'll add a key
+ * for the use of the acceleration fucntion
+ */
+ /* This is for later = BUTTON_SCROLL_TOUCH;*/
+ int wheel_delta = new_wheel_value - old_wheel_value;
+#else
/* The queue should have no other events when scrolling */
if (queue_empty(&button_queue) && old_wheel_value >= 0) {
@@ -122,31 +170,55 @@
int wheel_delta = new_wheel_value - old_wheel_value;
unsigned long data;
int wheel_keycode;
+#endif
if (wheel_delta < -48)
wheel_delta += 96; /* Forward wrapping case */
else if (wheel_delta > 48)
wheel_delta -= 96; /* Backward wrapping case */
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ if( wheel_delta > 4 || wheel_delta < -4 ) {
+ /* ignore anything less than a jiggle factor */
+#else
if (wheel_delta > 4) {
wheel_keycode = BUTTON_SCROLL_FWD;
} else if (wheel_delta < -4) {
wheel_keycode = BUTTON_SCROLL_BACK;
} else goto wheel_end;
+#endif
#ifdef HAVE_WHEEL_POSITION
if (send_events)
#endif
{
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ if ( queue_empty(&button_queue) ) {
+ /* only post a scroll button if the queue is empty */
+ int wheel_keycode = wheel_delta > 0 ? BUTTON_SCROLL_FWD : BUTTON_SCROLL_BACK;
+ unsigned long data = (wheel_delta << 16) | new_wheel_value;
+ wheel_scroll_key_microsecond_tick = wheel_scroll_key_microsecond_tick_elapsed;
+ accumulated_wheel_scroll_delta = 0;
+ queue_post(&button_queue, wheel_keycode | wheel_repeat, data);
+#else
data = (wheel_delta << 16) | new_wheel_value;
queue_post(&button_queue, wheel_keycode | wheel_repeat,
data);
+#endif
}
if (!wheel_repeat) wheel_repeat = BUTTON_REPEAT;
}
-
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+ accumulated_wheel_scroll_delta += wheel_delta ;
+ old_wheel_value = new_wheel_value ;
+ wheel_scroll_key_microsecond_tick_elapsed = USEC_TIMER ;
+
+ } else goto wheel_end ; /* not clear this is still needed, basically skips call to opto_i2c_init() */
+ }
+#else
old_wheel_value = new_wheel_value;
+#endif
} else if (old_wheel_value >= 0) {
/* scroll wheel up */
old_wheel_value = -1;
diff -u -r rockbox_svn.orig/firmware/target/arm/ipod/button-target.h rockbox_svn/firmware/target/arm/ipod/button-target.h
--- rockbox_svn.orig/firmware/target/arm/ipod/button-target.h 2007-07-19 18:43:59.937500000 -0500
+++ rockbox_svn/firmware/target/arm/ipod/button-target.h 2007-07-20 12:03:47.578125000 -0500
@@ -32,6 +32,21 @@
void ipod_mini_button_int(void);
void ipod_4g_button_int(void);
+#if CONFIG_KEYPAD == IPOD_4G_PAD && !defined(IPOD_MINI)
+extern unsigned long wheel_scroll_tick ;
+extern int get_accumulated_wheel_scroll_delta( void ) ;
+extern int get_ipod_scroll_wheel_clicks_per_second( void ) ;
+#endif
+
+/* warning to clients calling get_ipod_scroll_wheel_acceration:
+ * Calling this function may have side-effects;
+ * this function should be called once per call to button_get
+ * or button_get_w_tmo, and results locally cached as needed.
+ * In particular, some acceleration implementations
+ * may need to reset a calculated delta when
+ * get_ipod_scroll_wheel_acceration is called.
+ */
+
/* iPod specific button codes */
#define BUTTON_SELECT 0x00000001