--- ./apps/gui/gwps.c.orig	2006-05-25 15:29:19.000000000 +0200
+++ ./apps/gui/gwps.c	2006-06-22 13:17:30.000000000 +0200
@@ -56,6 +56,10 @@
 #ifdef HAVE_LCD_COLOR
 #include "backdrop.h"
 #endif
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+#include "recording.h"
+#include "rec_button.h"
+#endif
 
 #define WPS_DEFAULTCFG WPS_DIR "/rockbox_default.wps"
 #define RWPS_DEFAULTCFG WPS_DIR "/rockbox_default.rwps"
@@ -247,6 +251,100 @@
                 break;
 #endif
 
+/* Action on rec short */
+#ifdef WPS_REC_SHORT
+            case WPS_REC_SHORT:
+#ifdef WPS_REC_SHORT_PRE
+                if (lastbutton != WPS_REC_SHORT_PRE)
+                    break;
+#endif
+#ifdef WPS_RC_REC_SHORT
+            case WPS_RC_REC_SHORT:
+#ifdef WPS_RC_REC_SHORT_PRE
+                if ((button == WPS_RC_REC_SHORT) && (lastbutton != WPS_RC_REC_SHORT_PRE))
+                    break;
+#endif
+#endif
+                if (global_settings.rec_button_short == 0)
+                    break;
+                
+                FOR_NB_SCREENS(i)
+                    gui_wps[i].display->stop_scroll();
+#ifdef HAVE_LCD_COLOR
+                show_main_backdrop();
+#endif
+                if (rec_button_action(1))
+                    return true;
+#ifdef HAVE_LCD_COLOR
+                show_wps_backdrop();
+#endif
+#ifdef HAVE_LCD_BITMAP
+                FOR_NB_SCREENS(i)
+                {
+                    gui_wps_set_margin(&gui_wps[i]);
+                }
+#endif
+                restore = true;
+                break;
+#endif
+
+/* Action on rec long */
+#ifdef WPS_REC_LONG
+            case WPS_REC_LONG:
+#ifdef WPS_RC_REC_LONG
+            case WPS_RC_REC_LONG:
+#endif
+                if (global_settings.rec_button_short == 0)
+                    break;
+
+                FOR_NB_SCREENS(i)
+                    gui_wps[i].display->stop_scroll();
+#ifdef HAVE_LCD_COLOR
+                show_main_backdrop();
+#endif
+                if (rec_button_action(2))
+                    return true;
+#ifdef HAVE_LCD_COLOR
+                show_wps_backdrop();
+#endif
+#ifdef HAVE_LCD_BITMAP
+                FOR_NB_SCREENS(i)
+                {
+                    gui_wps_set_margin(&gui_wps[i]);
+                }
+#endif
+                restore = true;
+                break;
+#endif
+
+/* Recording screen */
+#ifdef WPS_REC
+            case WPS_REC:
+
+                FOR_NB_SCREENS(i)
+                    gui_wps[i].display->stop_scroll();
+
+#ifdef HAVE_LCD_COLOR
+                show_main_backdrop();
+#endif
+                recording_screen();
+                /* Fake menu exit */
+                rec_menu();
+                if (main_menu())
+                    return true;
+#ifdef HAVE_LCD_COLOR
+                show_wps_backdrop();
+#endif
+#ifdef HAVE_LCD_BITMAP
+                FOR_NB_SCREENS(i)
+                {
+                    gui_wps_set_margin(&gui_wps[i]);
+                }
+#endif
+                restore = true;
+                break;               
+#endif
+
 #ifdef WPS_RC_BROWSE
             case WPS_RC_BROWSE:
 #endif
--- ./apps/gui/gwps.h.orig	2006-05-25 15:29:19.000000000 +0200
+++ ./apps/gui/gwps.h	2006-06-22 13:17:30.000000000 +0200
@@ -49,6 +49,10 @@
 #define WPS_QUICK      (BUTTON_MODE | BUTTON_REPEAT)
 #define WPS_NEXT_DIR   (BUTTON_RIGHT | BUTTON_ON)
 #define WPS_PREV_DIR   (BUTTON_LEFT | BUTTON_ON)
+#define WPS_REC_SHORT  (BUTTON_REC | BUTTON_REL)
+#define WPS_REC_SHORT_PRE  BUTTON_REC
+#define WPS_REC_LONG   (BUTTON_REC | BUTTON_REPEAT) /* Not used yet */
+#define WPS_REC        (BUTTON_REC | BUTTON_ON)
 
 #define WPS_RC_NEXT_DIR   BUTTON_RC_BITRATE
 #define WPS_RC_PREV_DIR   BUTTON_RC_SOURCE
@@ -69,6 +73,9 @@
 #define WPS_RC_BROWSE_PRE BUTTON_RC_MENU
 #define WPS_RC_CONTEXT    (BUTTON_RC_MENU | BUTTON_REPEAT)
 #define WPS_RC_QUICK      (BUTTON_RC_MODE | BUTTON_REPEAT)
+#define WPS_RC_REC_SHORT  (BUTTON_RC_REC | BUTTON_REL)
+#define WPS_RC_REC_SHORT_PRE  BUTTON_RC_REC
+#define WPS_RC_REC_LONG   (BUTTON_RC_REC | BUTTON_REPEAT) /* Not used yet */
 
 #ifdef AB_REPEAT_ENABLE
 #define WPS_AB_SHARE_DIR_BUTTONS
--- ./apps/lang/english.lang.orig	2006-06-03 16:09:26.000000000 +0200
+++ ./apps/lang/english.lang	2006-06-22 13:18:11.000000000 +0200
@@ -8529,3 +8529,101 @@
     *: "Remote Scrolling Options"
   </voice>
 </phrase>   
+<phrase>
+  id: LANG_BUTTON_CONFIG
+  desc: in system menu
+  user:
+  <source>
+    *: "Button Config"
+  </source>
+  <dest>
+    *: "Button Config"
+  </dest>
+  <voice>
+    *: ""
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_REC_BUTTON_SHORT
+  desc: in button config menu
+  user:
+  <source>
+    *: "Action on short press REC"
+  </source>
+  <dest>
+    *: "Action on short press REC"
+  </dest>
+  <voice>
+    *: "Action on short press Rec"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_REC_BUTTON_LONG
+  desc: in button config menu
+  user:
+  <source>
+    *: "Action on long press REC"
+  </source>
+  <dest>
+    *: "Action on long press REC"
+  </dest>
+  <voice>
+    *: "Action on long press Rec"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_BT_NONE
+  desc: option for Rec button config
+  user:
+  <source>
+    *: "none"
+  </source>
+  <dest>
+    *: "none"
+  </dest>
+  <voice>
+    *: "none"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_BT_PLAYLIST
+  desc: option for Rec button config
+  user:
+  <source>
+    *: "current playlist"
+  </source>
+  <dest>
+    *: "current playlist"
+  </dest>
+  <voice>
+    *: "current playlist"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_BT_PLUGINS
+  desc: option for Rec button config
+  user:
+  <source>
+    *: "Plugins"
+  </source>
+  <dest>
+    *: "Plugins"
+  </dest>
+  <voice>
+    *: "Plugins"
+  </voice>
+</phrase>
+<phrase>
+  id: LANG_BT_THEMES
+  desc: option for Rec button config
+  user:
+  <source>
+    *: "Themes"
+  </source>
+  <dest>
+    *: "Themes"
+  </dest>
+  <voice>
+    *: "Themes"
+  </voice>
+</phrase>
--- ./apps/SOURCES.orig	2006-04-03 16:06:39.000000000 +0200
+++ ./apps/SOURCES	2006-06-22 13:17:30.000000000 +0200
@@ -16,6 +16,7 @@
 playlist_menu.c
 playlist_viewer.c
 plugin.c
+rec_button.c
 screens.c
 settings.c
 settings_menu.c
--- ./apps/settings.c.orig	2006-06-07 01:40:16.000000000 +0200
+++ ./apps/settings.c	2006-06-22 13:17:30.000000000 +0200
@@ -566,6 +566,14 @@
     /* If values are just added to the end, no need to bump the version. */
     /* new stuff to be added at the end */
 
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
+    (CONFIG_KEYPAD == IRIVER_H300_PAD)    
+    {3, S_O(rec_button_short), 0, "Rec button short",
+     "none,Current Playlist,Plugins,Themes" },
+    {3, S_O(rec_button_long), 0, "Rec button long",
+     "none,Current Playlist,Plugins,Themes" },
+#endif
+
     /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */
 };
 
--- ./apps/settings.h.orig	2006-06-03 16:09:25.000000000 +0200
+++ ./apps/settings.h	2006-06-22 13:17:30.000000000 +0200
@@ -318,6 +318,12 @@
     int peak_meter_max; /* range maximum */
     bool car_adapter_mode; /* 0=off 1=on */
 
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) ||       \
+  (CONFIG_KEYPAD == IRIVER_H300_PAD)
+    int rec_button_short;  /* 0=none 1=playlist 2=plugins 3=themes */
+    int rec_button_long;  /* 0=none 1=playlist 2=plugins 3=thems */
+#endif
+
     /* show status bar */
     bool statusbar;    /* 0=hide, 1=show */
 
--- ./apps/settings_menu.c.orig	2006-06-07 01:40:16.000000000 +0200
+++ ./apps/settings_menu.c	2006-06-22 13:17:30.000000000 +0200
@@ -1950,6 +1950,56 @@
     return result;
 }
 
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+static bool rec_button_short(void)
+{
+    static const struct opt_items names[] = {
+        { STR(LANG_BT_NONE) },
+        { STR(LANG_BT_PLAYLIST) },
+        { STR(LANG_BT_PLUGINS) },
+        { STR(LANG_BT_THEMES) },
+
+    };
+    bool ret;
+    ret=set_option( str(LANG_REC_BUTTON_SHORT),
+                    &global_settings.rec_button_short, INT, names, 4, NULL);
+
+    return ret;
+}
+
+static bool rec_button_long(void)
+{
+    static const struct opt_items names[] = {
+        { STR(LANG_BT_NONE) },
+        { STR(LANG_BT_PLAYLIST) },
+        { STR(LANG_BT_PLUGINS) },
+        { STR(LANG_BT_THEMES) },
+
+    };
+    bool ret;
+    ret=set_option( str(LANG_REC_BUTTON_LONG),
+                    &global_settings.rec_button_long, INT, names, 4, NULL);
+
+    return ret;
+}
+
+static bool button_config_menu(void)
+{
+    int m;
+    bool result;
+
+    static const struct menu_item items[] = {
+        { ID2P(LANG_REC_BUTTON_SHORT), rec_button_short },
+        { ID2P(LANG_REC_BUTTON_LONG),  rec_button_long  },
+    };
+
+     m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
+                 NULL, NULL, NULL);
+    result = menu_run(m);
+    menu_exit(m);
+    return result;
+}
+#endif
 
 static bool system_settings_menu(void)
 {
@@ -1976,6 +2026,10 @@
 #ifdef CONFIG_CHARGING
         { ID2P(LANG_CAR_ADAPTER_MODE), car_adapter_mode       },
 #endif
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) ||       \
+    (CONFIG_KEYPAD == IRIVER_H300_PAD)
+        { ID2P(LANG_BUTTON_CONFIG), button_config_menu        },
+#endif
     };
 
     m=menu_init( items, sizeof(items) / sizeof(*items), NULL,
--- ./apps/rec_button.c.orig	2006-06-22 13:17:30.000000000 +0200
+++ ./apps/rec_button.c	2006-06-22 13:17:30.000000000 +0200
@@ -0,0 +1,58 @@
+/***************************************************************************
+ *             __________               __   ___.                  
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___  
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /  
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <   
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \  
+ *                     \/            \/     \/    \/            \/ 
+ * $Id:$
+ *
+ * Copyright (C) 2006 by Simon Menzel
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "settings.h"
+#include "playlist_viewer.h"
+#include "tree.h"
+#include "statusbar.h"
+
+bool rec_button_action(int which_button) {
+    int action;
+    bool ret;
+    ret= false;
+    if (which_button ==  1)
+        action = global_settings.rec_button_short;
+    else if (which_button == 2)
+        action = global_settings.rec_button_long;
+    else
+        return true;
+    
+    switch (action) {
+        case 0:
+            ret= true;
+            break;
+        case 1: 
+            gui_syncstatusbar_draw(&statusbars,true);
+            if (playlist_viewer())
+                ret=true;
+            break;
+        case 2:
+            gui_syncstatusbar_draw(&statusbars,true);
+            if (rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS))
+                ret= true;
+            break;
+        case 3:
+            gui_syncstatusbar_draw(&statusbars,true);
+            if (rockbox_browse(THEME_DIR, SHOW_CFG))
+                ret= true;
+            break;
+        default:
+            ret= true;
+    }
+    return ret;
+}
--- ./apps/rec_button.h.orig	2006-06-22 13:17:30.000000000 +0200
+++ ./apps/rec_button.h	2006-06-22 13:17:30.000000000 +0200
@@ -0,0 +1,26 @@
+/***************************************************************************
+ *             __________               __   ___.                  
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___  
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /  
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <   
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \  
+ *                     \/            \/     \/    \/            \/ 
+ * $Id:$
+ *
+ * Copyright (C) 2006 by Simon Menzel
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef REC_BUTTON_H
+#define REC_BUTTON_H
+
+/* Calls the action for the specified button (action is taken from settings)
+   1=RECshort 2=REClong */
+bool rec_button_action(int which_button);
+
+#endif
