? build-h300
? plugin_wps.patch
? sim-h300
Index: apps/action.h
===================================================================
RCS file: /cvsroot/rockbox/apps/action.h,v
retrieving revision 1.3
diff -u -3 -r1.3 action.h
--- apps/action.h	23 Jun 2005 01:31:25 -0000	1.3
+++ apps/action.h	9 Jun 2006 17:12:09 -0000
@@ -25,5 +25,6 @@
 #define CONTEXT_RECORD                                  3
 #define CONTEXT_MAINMENU                                4
 #define CONTEXT_ID3DB                                   5
+#define CONTEXT_WPS_PLUGIN                              6
 
 #endif
Index: apps/onplay.c
===================================================================
RCS file: /cvsroot/rockbox/apps/onplay.c,v
retrieving revision 1.80
diff -u -3 -r1.80 onplay.c
--- apps/onplay.c	21 May 2006 11:00:01 -0000	1.80
+++ apps/onplay.c	9 Jun 2006 17:12:11 -0000
@@ -788,7 +788,8 @@
     selected_file = file;
     selected_file_attr = attr;
 
-    if (context == CONTEXT_WPS)
+    if (context == CONTEXT_WPS ||
+        context == CONTEXT_WPS_PLUGIN)
     {
         items[i].desc = ID2P(LANG_SOUND_SETTINGS);
         items[i].function = sound_menu;
@@ -805,7 +806,8 @@
         i++;
     }
 
-    if (context == CONTEXT_WPS)
+    if (context == CONTEXT_WPS ||
+        context == CONTEXT_WPS_PLUGIN)
     {
         items[i].desc = ID2P(LANG_BOOKMARK_MENU);
         items[i].function = bookmark_menu;
@@ -814,7 +816,8 @@
 
     if (file)
     {
-        if (context == CONTEXT_WPS)
+        if (context == CONTEXT_WPS ||
+            context == CONTEXT_WPS_PLUGIN)
         {
             items[i].desc = ID2P(LANG_MENU_SHOW_ID3_INFO);
             items[i].function = browse_id3;
@@ -853,7 +856,7 @@
                 }
             }
 
-            if (!(attr & ATTR_DIRECTORY) && context == CONTEXT_TREE)
+            if (!(attr & ATTR_DIRECTORY) && context == CONTEXT_TREE)
             {
                 items[i].desc = ID2P(LANG_DELETE);
                 items[i].function = delete_file;
@@ -906,7 +909,8 @@
         items[i].function = create_dir;
         i++;
     }
-    if (context == CONTEXT_WPS)
+    if (context == CONTEXT_WPS ||
+        context == CONTEXT_WPS_PLUGIN)
     {
 #if (CONFIG_KEYPAD != PLAYER_PAD)
         /* Pitch screen access */
Index: apps/plugin.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugin.c,v
retrieving revision 1.172
diff -u -3 -r1.172 plugin.c
--- apps/plugin.c	6 Jun 2006 22:23:40 -0000	1.172
+++ apps/plugin.c	9 Jun 2006 17:12:12 -0000
@@ -71,6 +71,7 @@
 #ifdef HAVE_REMOTE_LCD
 #include "lcd-remote.h"
 #endif
+#include "gwps.h"
 
 #ifdef SIMULATOR
 static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
@@ -442,6 +443,8 @@
     
     set_int,
     reload_directory,
+
+    gui_wps_show,
 };
 
 int plugin_load(const char* plugin, void* parameter)
Index: apps/plugin.h
===================================================================
RCS file: /cvsroot/rockbox/apps/plugin.h,v
retrieving revision 1.179
diff -u -3 -r1.179 plugin.h
--- apps/plugin.h	6 Jun 2006 22:23:40 -0000	1.179
+++ apps/plugin.h	9 Jun 2006 17:12:14 -0000
@@ -73,6 +73,7 @@
 #ifdef HAVE_REMOTE_LCD
 #include "lcd-remote.h"
 #endif
+#include "gwps.h"
 
 #ifdef PLUGIN
 
@@ -104,7 +105,7 @@
 #define PLUGIN_MAGIC 0x526F634B /* RocK */
 
 /* increase this every time the api struct changes */
-#define PLUGIN_API_VERSION 22
+#define PLUGIN_API_VERSION 23
 
 /* update this to latest version if a change to the api struct breaks
    backwards compatibility (and please take the opportunity to sort in any
@@ -521,6 +522,7 @@
                     int* variable, void (*function)(int), int step, int min,
                     int max, void (*formatter)(char*, int, int, const char*) );
     void (*reload_directory)(void);
+    long (*gui_wps_show) (bool plugin);
 };
 
 /* plugin header */
Index: apps/tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.408
diff -u -3 -r1.408 tree.c
--- apps/tree.c	7 Jun 2006 20:42:42 -0000	1.408
+++ apps/tree.c	9 Jun 2006 17:12:17 -0000
@@ -886,7 +886,7 @@
             FOR_NB_SCREENS(i)
                 screens[i].stop_scroll();
 
-            if (gui_wps_show() == SYS_USB_CONNECTED)
+            if (gui_wps_show(false) == SYS_USB_CONNECTED)
                 reload_dir = true;
 #ifdef HAVE_HOTSWAP
             else
Index: apps/gui/gwps.c
===================================================================
RCS file: /cvsroot/rockbox/apps/gui/gwps.c,v
retrieving revision 1.44
diff -u -3 -r1.44 gwps.c
--- apps/gui/gwps.c	21 May 2006 11:00:02 -0000	1.44
+++ apps/gui/gwps.c	9 Jun 2006 17:12:21 -0000
@@ -82,7 +82,7 @@
 }
 #endif
 
-long gui_wps_show(void)
+long gui_wps_show(bool plugin)
 {
     long button = 0, lastbutton = 0;
     bool ignore_keyup = true;
@@ -220,8 +220,13 @@
         /* Exit if audio has stopped playing. This can happen if using the
            sleep timer with the charger plugged or if starting a recording
            from F1 */
-        if (!audio_status())
+        if (!audio_status()) {
+#ifdef HAVE_LCD_COLOR
+            if (plugin)
+                lcd_set_backdrop(NULL);
+#endif
             exit = true;
+        }
 
         switch(button)
         {
@@ -233,7 +238,12 @@
 #ifdef HAVE_LCD_COLOR
                 show_main_backdrop();
 #endif
-                onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
+                if (!plugin)
+                    onplay(wps_state.id3->path, TREE_ATTR_MPA, CONTEXT_WPS);
+                else
+                    onplay(wps_state.id3->path, TREE_ATTR_MPA,
+                           CONTEXT_WPS_PLUGIN);
+                           
 #ifdef HAVE_LCD_COLOR
                 show_wps_backdrop();
 #endif
@@ -270,7 +280,10 @@
                 if (global_settings.browse_current &&
                     wps_state.current_track_path[0] != '\0')
                     set_current_file(wps_state.current_track_path);
-
+#ifdef HAVE_LCD_COLOR
+                if (plugin)
+                    lcd_set_backdrop(NULL);
+#endif
                 return 0;
                 break;
 
@@ -545,21 +558,28 @@
                 FOR_NB_SCREENS(i)
                     gui_wps[i].display->stop_scroll();
 
+                if (!plugin) {
 #ifdef HAVE_LCD_COLOR
-                show_main_backdrop();
+                    show_main_backdrop();
 #endif
-                if (main_menu())
-                    return true;
+                    if (main_menu())
+                        return true;
 #ifdef HAVE_LCD_COLOR
-                show_wps_backdrop();
+                    show_wps_backdrop();
 #endif
 #ifdef HAVE_LCD_BITMAP
-                FOR_NB_SCREENS(i)
-                {
-                    gui_wps_set_margin(&gui_wps[i]);
-                }
+                    FOR_NB_SCREENS(i)
+                    {
+                        gui_wps_set_margin(&gui_wps[i]);
+                    }
 #endif
-                restore = true;
+                    restore = true;
+                } else {
+#ifdef HAVE_LCD_COLOR
+                    lcd_set_backdrop(NULL);
+#endif
+                    return 0;
+                }
                 break;
 #endif /* WPS_MENU */
 
@@ -690,12 +710,16 @@
                 /* stop and exit wps */
 #ifdef WPS_EXIT
             case WPS_EXIT:
-# ifdef WPS_EXIT_PRE
+#ifdef WPS_EXIT_PRE
                 if (lastbutton != WPS_EXIT_PRE)
                     break;
-# endif
+#endif
                 if (global_settings.party_mode)
                     break;
+#ifdef HAVE_LCD_COLOR
+                if (plugin)
+                    lcd_set_backdrop(NULL);
+#endif
                 exit = true;
 #ifdef WPS_RC_EXIT
             case WPS_RC_EXIT:
@@ -705,6 +729,10 @@
 #endif
                 if (global_settings.party_mode)
                     break;
+#ifdef HAVE_LCD_COLOR
+                if (plugin)
+                    lcd_set_backdrop(NULL);
+#endif
                 exit = true;
 #endif
                 break;
Index: apps/gui/gwps.h
===================================================================
RCS file: /cvsroot/rockbox/apps/gui/gwps.h,v
retrieving revision 1.35
diff -u -3 -r1.35 gwps.h
--- apps/gui/gwps.h	21 May 2006 11:00:02 -0000	1.35
+++ apps/gui/gwps.h	9 Jun 2006 17:12:23 -0000
@@ -432,7 +432,7 @@
 void gui_wps_set_statusbar(struct gui_wps *gui_wps, struct gui_statusbar *statusbar);
 /* gui_wps end */
 
-long gui_wps_show(void);
+long gui_wps_show(bool plugin);
 
 /* currently only on wps_state is needed */
 extern struct wps_state wps_state;
Index: apps/plugins/brickmania.c
===================================================================
RCS file: /cvsroot/rockbox/apps/plugins/brickmania.c,v
retrieving revision 1.22
diff -u -3 -r1.22 brickmania.c
--- apps/plugins/brickmania.c	5 Jun 2006 20:41:48 -0000	1.22
+++ apps/plugins/brickmania.c	9 Jun 2006 17:12:28 -0000
@@ -31,6 +31,7 @@
 #define SELECT BUTTON_SELECT
 #define UP BUTTON_UP
 #define DOWN BUTTON_DOWN
+#define WPS BUTTON_MODE
 
 /* Only iPod have scroll events */
 #define SCROLL_FWD(x) (0)
@@ -41,9 +42,10 @@
 #define QUIT BUTTON_OFF
 #define LEFT BUTTON_LEFT
 #define RIGHT BUTTON_RIGHT
-#define SELECT BUTTON_MENU
+#define SELECT (BUTTON_MENU | BUTTON_REL)
 #define UP BUTTON_UP
 #define DOWN BUTTON_DOWN
+#define WPS (BUTTON_MENU | BUTTON_REPEAT)
 
 /* Only iPod have scroll events */
 #define SCROLL_FWD(x) (0)
@@ -57,6 +59,7 @@
 #define SELECT BUTTON_PLAY
 #define UP BUTTON_UP
 #define DOWN BUTTON_DOWN
+#define WPS BUTTON_F1
 
 /* Only iPod have scroll events */
 #define SCROLL_FWD(x) (0)
@@ -68,9 +71,10 @@
 #define QUIT BUTTON_MENU
 #define LEFT BUTTON_LEFT
 #define RIGHT BUTTON_RIGHT
-#define SELECT BUTTON_SELECT
+#define SELECT (BUTTON_SELECT | BUTTON_REL)
 #define UP BUTTON_SCROLL_BACK
 #define DOWN BUTTON_SCROLL_FWD
+#define WPS (BUTTON_SELECT | BUTTON_REPEAT)
 
 #define SCROLL_FWD(x) ((x) & BUTTON_SCROLL_FWD)
 #define SCROLL_BACK(x) ((x) & BUTTON_SCROLL_BACK)
@@ -92,9 +96,10 @@
 #define QUIT BUTTON_POWER
 #define LEFT BUTTON_LEFT
 #define RIGHT BUTTON_RIGHT
-#define SELECT BUTTON_PLAY
+#define SELECT BUTTON_SELECT
 #define UP BUTTON_UP
 #define DOWN BUTTON_DOWN
+#define WPS BUTTON_PLAY
 
 /* Only iPod have scroll events */
 #define SCROLL_FWD(x) (0)
@@ -974,7 +979,19 @@
             case QUIT:
                 return 3;
                 break;
-
+#ifdef WPS
+            case WPS:
+                rb->lcd_set_background(rb->global_settings->bg_color);
+                rb->lcd_set_foreground(rb->global_settings->fg_color);
+                rb->lcd_setfont(FONT_UI);
+                rb->gui_wps_show(true);
+                rb->lcd_setfont(FONT_SYSFIXED);
+                rb->lcd_clear_display();
+#if (LCD_WIDTH != 112) && (LCD_HEIGHT != 64)
+                rb->lcd_bitmap(brickmania_menu_bg, 0, 0, BMPWIDTH_menu, BMPHEIGHT_menu);
+#endif
+                break;
+#endif
             default:
                 if(rb->default_event_handler(button) == SYS_USB_CONNECTED)
                     return 3;
