Index: apps/action.h
===================================================================
--- apps/action.h (Revision 13451)
+++ apps/action.h (Arbeitskopie)
@@ -119,6 +119,9 @@
ACTION_WPS_ABSETA_PREVDIR, /* these should be safe to put together seen as */
ACTION_WPS_ABSETB_NEXTDIR, /* you shouldnt want to change dir in ab-mode */
ACTION_WPS_ABRESET,
+ ACTION_WPS_USER1, /* optional, for user-settable button */
+ ACTION_WPS_USER2, /* optional, for user-settable button */
+ ACTION_WPS_USER3, /* optional, for user-settable button */
/* list and tree page up/down */
ACTION_LISTTREE_PGUP,/* optional */
@@ -134,6 +137,9 @@
ACTION_TREE_PGRIGHT,/* optional */
ACTION_TREE_STOP,
ACTION_TREE_WPS,
+ ACTION_TREE_USER1, /* optional, for user-settable button */
+ ACTION_TREE_USER2, /* optional, for user-settable button */
+ ACTION_TREE_USER3, /* optional, for user-settable button */
/* radio */
ACTION_FM_MENU,
Index: apps/tree.c
===================================================================
--- apps/tree.c (Revision 13451)
+++ apps/tree.c (Arbeitskopie)
@@ -52,6 +52,7 @@
#include "plugin.h"
#include "power.h"
#include "action.h"
+#include "user_action.h"
#include "talk.h"
#include "filetypes.h"
#include "misc.h"
@@ -616,6 +617,24 @@
return GO_TO_ROOT;
break;
+ /* Rincewind Code */
+ /* user-settable actions, used only for rec-button on irivers Hxx currently */
+ case ACTION_TREE_USER1:
+ case ACTION_TREE_USER2:
+ case ACTION_TREE_USER3:
+ /* break if user has set action for this button == none */
+ if (user_action_none(button))
+ break;
+ static int user_action_ret;
+ if (*tc.dirfilter < NUM_FILTER_MODES)
+ {
+ user_action_ret = user_action(button);
+ if (user_action_ret != GO_TO_PREVIOUS && user_action_ret != GO_TO_FILEBROWSER)
+ return user_action_ret;
+ restore = true;
+ }
+ break;
+
case ACTION_TREE_WPS:
return GO_TO_PREVIOUS_MUSIC;
break;
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (Revision 13451)
+++ apps/lang/english.lang (Arbeitskopie)
@@ -10210,6 +10210,202 @@
+ id: LANG_BUTTON_CONFIG
+ desc: in system menu
+ user:
+
+ *: "Button Config"
+
+
+ *: "Button Config"
+
+
+ *: "Button Config"
+
+
+
+ id: LANG_BUTTON_WPS
+ desc: in button config menu
+ user:
+
+ *: "in While Playing Screen"
+
+
+ *: "in While Playing Screen"
+
+
+ *: "Custom button in While Playing Screen"
+
+
+
+ id: LANG_BUTTON_TREE
+ desc: in button config menu
+ user:
+
+ *: "in File Browser"
+
+
+ *: "in File Browser"
+
+
+ *: "Custom button in File Browser"
+
+
+
+ id: LANG_REC_BUTTON_SHORT
+ desc: in button config menu
+ user:
+
+ *: "on short press REC"
+
+
+ *: "on short press REC"
+
+
+ *: "Action on short press Rec"
+
+
+
+ id: LANG_REC_BUTTON_LONG
+ desc: in button config menu
+ user:
+
+ *: "on long press REC"
+
+
+ *: "on long press REC"
+
+
+ *: "Action on long press Rec"
+
+
+
+ id: LANG_REC_BUTTON_PLAY
+ desc: in button config menu
+ user:
+
+ *: "on PLAY + REC"
+
+
+ *: "on PLAY + REC"
+
+
+ *: "Action on Play and Rec"
+
+
+
+ id: LANG_BT_NONE
+ desc: option for Rec button config
+ user:
+
+ *: "none"
+
+
+ *: "none"
+
+
+ *: "none"
+
+
+
+ id: LANG_BT_PLAYLIST
+ desc: option for Rec button config
+ user:
+
+ *: "Current playlist"
+
+
+ *: "Current playlist"
+
+
+ *: "Current playlist"
+
+
+
+ id: LANG_BT_PLUGINS
+ desc: option for Rec button config
+ user:
+
+ *: "Plugins"
+
+
+ *: "Plugins"
+
+
+ *: "Plugins"
+
+
+
+ id: LANG_BT_THEMES
+ desc: option for Rec button config
+ user:
+
+ *: "Themes"
+
+
+ *: "Themes"
+
+
+ *: "Themes"
+
+
+
+ id: LANG_BT_RECORDING
+ desc: option for Rec button config
+ user:
+
+ *: "Recording Screen"
+
+
+ *: "Recording Screen"
+
+
+ *: "Recording Screen"
+
+
+
+ id: LANG_BT_INSTANT_REC
+ desc: option for Rec button config
+ user:
+
+ *: "Start recording instantly"
+
+
+ *: "Start recording instantly"
+
+
+ *: "Start recording instantly"
+
+
+
+ id: LANG_BT_INSERT
+ desc: option for Rec button config
+ user:
+
+ *: "Insert"
+
+
+ *: "Insert"
+
+
+ *: "Insert"
+
+
+
+ id: LANG_BT_INSERT_NEXT
+ desc: option for Rec button config
+ user:
+
+ *: "Insert Next"
+
+
+ *: "Insert Next"
+
+
+ *: "Insert Next"
+
+
+
id: LANG_BITRATE
desc: bits-kilobits per unit time
user:
Index: apps/onplay.c
===================================================================
--- apps/onplay.c (Revision 13451)
+++ apps/onplay.c (Arbeitskopie)
@@ -63,6 +63,7 @@
#ifdef HAVE_TAGCACHE
#include "tagtree.h"
#endif
+#include "root_menu.h"
#include "cuesheet.h"
#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
@@ -936,6 +937,29 @@
}
return action;
}
+/* Rincewind Code */
+int user_button_insert(char* file, int attr, int from, int which)
+{
+ context = from;
+ selected_file = file;
+ selected_file_attr = attr;
+ onplay_result = ONPLAY_OK;
+ switch (which)
+ {
+ case 1:
+ add_to_playlist(PLAYLIST_INSERT, false);
+ break;
+ case 2:
+ add_to_playlist(PLAYLIST_INSERT_FIRST, false);
+ break;
+ }
+
+ if (onplay_result == ONPLAY_START_PLAY)
+ return GO_TO_WPS;
+ else
+ return GO_TO_PREVIOUS;
+}
+
#ifdef HAVE_TAGCACHE
char *rating_name(int selected_item, void * data, char *buffer)
{
Index: apps/gui/gwps.c
===================================================================
--- apps/gui/gwps.c (Revision 13451)
+++ apps/gui/gwps.c (Arbeitskopie)
@@ -27,6 +27,7 @@
#include "font.h"
#include "backlight.h"
#include "action.h"
+#include "user_action.h"
#include "kernel.h"
#include "filetypes.h"
#include "debug.h"
@@ -261,6 +262,38 @@
restore = true;
break;
+ /* Rincewind Code */
+ /* user-setteble actions, used only for rec-button on irivers Hxx currently */
+ case ACTION_WPS_USER1:
+ case ACTION_WPS_USER2:
+ case ACTION_WPS_USER3:
+ /* break if user has set action for this button == none */
+ if (user_action_none(button))
+ break;
+
+ FOR_NB_SCREENS(i)
+ gui_wps[i].display->stop_scroll();
+#ifdef HAVE_LCD_COLOR
+ show_main_backdrop();
+#endif
+ action_signalscreenchange();
+ static int user_action_ret;
+ user_action_ret = user_action(button);
+ if (user_action_ret != GO_TO_PREVIOUS && user_action_ret != GO_TO_PREVIOUS_MUSIC && user_action_ret != GO_TO_WPS)
+ return user_action_ret;
+
+#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;
+
case ACTION_WPS_BROWSE:
#ifdef HAVE_LCD_CHARCELLS
status_set_record(false);
Index: apps/settings.h
===================================================================
--- apps/settings.h (Revision 13451)
+++ apps/settings.h (Arbeitskopie)
@@ -454,6 +454,19 @@
int peak_meter_max; /* range maximum */
bool car_adapter_mode; /* 0=off 1=on */
+ /* Rincewind Code */
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
+ (CONFIG_KEYPAD == IRIVER_H300_PAD)
+ /* 0=none 1=playlist 2=plugins 3=themes 4=recording screen 5=instant rec */
+ int user_action_wps1;
+ int user_action_wps2;
+ int user_action_wps3;
+ /* 0=none 1=playlist 2=plugins 3=themes 4=recording screen 5=instant rec 6=Insert */
+ int user_action_tree1;
+ int user_action_tree2;
+ int user_action_tree3;
+#endif
+
/* show status bar */
bool statusbar; /* 0=hide, 1=show */
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c (Revision 13451)
+++ apps/menus/settings_menu.c (Arbeitskopie)
@@ -319,6 +319,25 @@
#endif
MENUITEM_SETTING(start_screen, &global_settings.start_in_screen, NULL);
+/* Rincewind Code */
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+MENUITEM_SETTING(user_action_wps1, &global_settings.user_action_wps1, NULL);
+MENUITEM_SETTING(user_action_wps2, &global_settings.user_action_wps2, NULL);
+MENUITEM_SETTING(user_action_wps3, &global_settings.user_action_wps3, NULL);
+
+MENUITEM_SETTING(user_action_tree1, &global_settings.user_action_tree1, NULL);
+MENUITEM_SETTING(user_action_tree2, &global_settings.user_action_tree2, NULL);
+MENUITEM_SETTING(user_action_tree3, &global_settings.user_action_tree3, NULL);
+
+MAKE_MENU(button_wps, ID2P(LANG_BUTTON_WPS), 0, Icon_NOICON,
+ &user_action_wps1, &user_action_wps2, &user_action_wps3);
+MAKE_MENU(button_tree, ID2P(LANG_BUTTON_TREE), 0, Icon_NOICON,
+ &user_action_tree1, &user_action_tree2, &user_action_tree3);
+
+MAKE_MENU(button_config, ID2P(LANG_BUTTON_CONFIG), 0, Icon_NOICON,
+ &button_wps, &button_tree);
+#endif
+
#ifdef HAVE_BUTTON_LIGHT
MENUITEM_SETTING(button_light_timeout, &global_settings.button_light_timeout, NULL);
#endif
@@ -356,6 +375,9 @@
#ifdef HAVE_BUTTON_LIGHT
&button_light_timeout,
#endif
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
+ &button_config,
+#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
&buttonlight_brightness
#endif
Index: apps/onplay.h
===================================================================
--- apps/onplay.h (Revision 13451)
+++ apps/onplay.h (Arbeitskopie)
@@ -20,7 +20,7 @@
#define _ONPLAY_H_
int onplay(char* file, int attr, int from_screen);
-
+int user_button_insert(char* file, int attr, int from, int which);
enum {
ONPLAY_MAINMENU = -1,
ONPLAY_OK = 0,
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (Revision 13451)
+++ apps/settings_list.c (Arbeitskopie)
@@ -1126,6 +1126,43 @@
#endif
#endif
OFFON_SETTING(0,cuesheet,LANG_CUESHEET_ENABLE,false,"cuesheet support", NULL),
+
+ /* Rincewind Code */
+#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
+ (CONFIG_KEYPAD == IRIVER_H300_PAD)
+ CHOICE_SETTING(0, user_action_wps1, LANG_REC_BUTTON_SHORT,1,
+ "user-defined button action wps 1",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording",NULL, 6,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC)),
+ CHOICE_SETTING(0, user_action_wps2, LANG_REC_BUTTON_LONG,4,
+ "user-defined button action wps 2",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording",NULL, 6,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC)),
+ CHOICE_SETTING(0, user_action_wps3, LANG_REC_BUTTON_PLAY,0,
+ "user-defined button action wps 3",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording",NULL, 6,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC)),
+
+ CHOICE_SETTING(0, user_action_tree1, LANG_REC_BUTTON_SHORT,6,
+ "user-defined button action tree 1",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording,Insert,Insert Next",NULL, 8,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC), ID2P(LANG_BT_INSERT), ID2P(LANG_BT_INSERT_NEXT)),
+ CHOICE_SETTING(0, user_action_tree2, LANG_REC_BUTTON_LONG,4,
+ "user-defined button action tree 2",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording,Insert,Insert Next",NULL, 8,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC), ID2P(LANG_BT_INSERT), ID2P(LANG_BT_INSERT_NEXT)),
+ CHOICE_SETTING(0, user_action_tree3, LANG_REC_BUTTON_PLAY,0,
+ "user-defined button action tree 3",
+ "none,Current Playlist,Plugins,Themes,Recording Screen,Instant Recording,Insert,Insert Next",NULL, 8,
+ ID2P(LANG_BT_NONE), ID2P(LANG_BT_PLAYLIST), ID2P(LANG_BT_PLUGINS), ID2P(LANG_BT_THEMES),
+ ID2P(LANG_BT_RECORDING), ID2P(LANG_BT_INSTANT_REC), ID2P(LANG_BT_INSERT), ID2P(LANG_BT_INSERT_NEXT)),
+#endif
+
CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
"start in screen", "previous,root,files,db,wps,menu,"
#ifdef HAVE_RECORDING
Index: apps/user_action.c
===================================================================
--- apps/user_action.c (Revision 0)
+++ apps/user_action.c (Revision 0)
@@ -0,0 +1,151 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2007 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"
+#ifdef HAVE_RECORDING
+#include "recording.h"
+#endif
+#include "main_menu.h"
+#include "lang.h"
+#include "action.h"
+#include "root_menu.h"
+#ifdef HAVE_TAGCACHE
+#include "tagtree.h"
+#endif
+#include "onplay.h"
+#include "sprintf.h"
+#include "filetypes.h"
+
+static int get_user_action(int button)
+{
+ if (button == ACTION_WPS_USER1)
+ return global_settings.user_action_wps1;
+ else if (button == ACTION_TREE_USER1)
+ return global_settings.user_action_tree1;
+ else if (button == ACTION_WPS_USER2)
+ return global_settings.user_action_wps2;
+ else if (button == ACTION_TREE_USER2)
+ return global_settings.user_action_tree2;
+ else if (button == ACTION_WPS_USER3)
+ return global_settings.user_action_wps3;
+ else if (button == ACTION_TREE_USER3)
+ return global_settings.user_action_tree3;
+ else
+ return 0;
+}
+
+static int insert_action(int which)
+{
+ struct tree_context* tc = tree_get_context();
+ char buf[MAX_PATH];
+ int attr = 0;
+ int curr_context;
+ int ret;
+ struct entry *dircache = tc->dircache;
+
+#ifdef HAVE_TAGCACHE
+ if (*(tc->dirfilter) == SHOW_ID3DB)
+ {
+ curr_context = CONTEXT_ID3DB;
+ if (tagtree_get_attr(tc) == FILE_ATTR_AUDIO)
+ {
+ attr = FILE_ATTR_AUDIO;
+ tagtree_get_filename(tc, buf, sizeof(buf));
+ }
+ else
+ attr = ATTR_DIRECTORY;
+ }
+ else
+#endif
+ {
+ curr_context = CONTEXT_TREE;
+ attr = dircache[tc->selected_item].attr;
+
+ if (tc->currdir[1]) /* Not in / */
+ snprintf(buf, sizeof buf, "%s/%s",
+ tc->currdir,
+ dircache[tc->selected_item].name);
+ else /* In / */
+ snprintf(buf, sizeof buf, "/%s",
+ dircache[tc->selected_item].name);
+ }
+
+ ret = user_button_insert(buf, attr, curr_context, which);
+
+ /* not tested with tagcache! */
+ /* move to next track in browser */
+ tc->selected_item++;
+ return ret;
+}
+
+int user_action(int button) {
+ int ret = GO_TO_PREVIOUS;
+ switch (get_user_action(button))
+ {
+ case 0: /* none */
+ ret = GO_TO_PREVIOUS;
+ break;
+ case 1: /* Playlist */
+ gui_syncstatusbar_draw(&statusbars,true);
+ if (playlist_viewer())
+ ret = GO_TO_ROOT;
+ else
+ ret = GO_TO_PREVIOUS;
+ break;
+ case 2: /* plugins */
+ gui_syncstatusbar_draw(&statusbars,true);
+ ret = rockbox_browse(PLUGIN_DIR, SHOW_PLUGINS);
+ action_signalscreenchange();
+ break;
+ case 3: /* themes */
+ gui_syncstatusbar_draw(&statusbars,true);
+ ret = rockbox_browse(THEME_DIR, SHOW_CFG);
+ action_signalscreenchange();
+ break;
+#ifdef HAVE_RECORDING
+ case 4: /* recording screen */
+ ret = GO_TO_RECSCREEN;
+ break;
+ case 5: /* instant recording */
+ recording_start_automatic = true;
+ ret = GO_TO_RECSCREEN;
+ break;
+#endif
+ case 6: /* Insert */
+ ret = insert_action(1);
+ break;
+ case 7:
+ ret = insert_action(2);
+ break;
+ default:
+ ret = GO_TO_PREVIOUS;
+ }
+ return ret;
+}
+
+bool user_action_none(int button)
+{
+ if (get_user_action(button) == 0)
+ return true;
+ else
+ return false;
+}
+
Index: apps/user_action.h
===================================================================
--- apps/user_action.h (Revision 0)
+++ apps/user_action.h (Revision 0)
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2007 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 user action for the button (action is taken from settings) */
+/* returns a GO_TO_xxx number */
+int user_action(int button);
+/* check if user action is "none" */
+bool user_action_none(int button);
+
+#endif
Index: apps/SOURCES
===================================================================
--- apps/SOURCES (Revision 13451)
+++ apps/SOURCES (Arbeitskopie)
@@ -43,6 +43,7 @@
#endif
filetree.c
scrobbler.c
+user_action.c
screen_access.c
gui/buttonbar.c
Index: apps/keymaps/keymap-h1x0_h3x0.c
===================================================================
--- apps/keymaps/keymap-h1x0_h3x0.c (Revision 13451)
+++ apps/keymaps/keymap-h1x0_h3x0.c (Arbeitskopie)
@@ -88,6 +88,9 @@
{ ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_WPS_ABRESET, BUTTON_ON|BUTTON_SELECT, BUTTON_ON },
{ ACTION_WPS_ID3SCREEN, BUTTON_ON|BUTTON_MODE, BUTTON_NONE },
+ { ACTION_WPS_USER1, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_WPS_USER2, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
+ { ACTION_WPS_USER3, BUTTON_ON|BUTTON_REC, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
@@ -107,6 +110,10 @@
{ ACTION_TREE_WPS, BUTTON_ON|BUTTON_REL, BUTTON_ON },
{ ACTION_TREE_STOP, BUTTON_OFF, BUTTON_NONE },
{ ACTION_TREE_STOP, BUTTON_OFF|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_TREE_USER1, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_TREE_USER2, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
+ { ACTION_TREE_USER3, BUTTON_ON|BUTTON_REC, BUTTON_NONE },
+
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */