Index: apps/onplay.c =================================================================== RCS file: /cvsroot/rockbox/apps/onplay.c,v retrieving revision 1.58 diff -u -r1.58 onplay.c --- apps/onplay.c 31 Oct 2005 18:38:48 -0000 1.58 +++ apps/onplay.c 1 Nov 2005 20:47:25 -0000 @@ -54,6 +54,7 @@ #include "main_menu.h" #include "sound_menu.h" #include "database.h" +#include "filetree.h" static int context; static char* selected_file = NULL; @@ -634,3 +635,24 @@ return onplay_result; } +/*one click insert modification*/ + +int onplay_one_click(char* file, int attr, int from,struct tree_context* c){ + int ret=1; + context=from; + selected_file = file; + selected_file_attr = attr; + if(global_settings.click_insert==0) + ret=ft_enter(c); + else if(global_settings.click_insert==1) + add_to_playlist(PLAYLIST_INSERT, false); + else if(global_settings.click_insert==2) + add_to_playlist(PLAYLIST_INSERT_LAST, false); + else if(global_settings.click_insert==3) + add_to_playlist(PLAYLIST_INSERT_SHUFFLED, false); + else if(global_settings.click_insert==4) + add_to_playlist(PLAYLIST_INSERT, true); + else + add_to_playlist(PLAYLIST_INSERT_LAST, true); + return ret; +} Index: apps/onplay.h =================================================================== RCS file: /cvsroot/rockbox/apps/onplay.h,v retrieving revision 1.3 diff -u -r1.3 onplay.h --- apps/onplay.h 23 Jun 2005 01:31:25 -0000 1.3 +++ apps/onplay.h 1 Nov 2005 20:47:26 -0000 @@ -20,6 +20,7 @@ #define _ONPLAY_H_ int onplay(char* file, int attr, int from_screen); +int onplay_one_click(char* file, int attr, int from,struct tree_context* c); enum { ONPLAY_OK, Index: apps/playlist_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/playlist_menu.c,v retrieving revision 1.12 diff -u -r1.12 playlist_menu.c --- apps/playlist_menu.c 24 Jun 2005 16:32:30 -0000 1.12 +++ apps/playlist_menu.c 1 Nov 2005 20:47:27 -0000 @@ -60,6 +60,22 @@ NULL ); } +static bool click_insert(void) +{ + static const struct opt_items names[] = { + { STR(LANG_CLICK_DEFAULT)}, + { STR(LANG_INSERT)}, + { STR(LANG_INSERT_LAST)}, + { STR(LANG_INSERT_SHUFFLED)}, + { STR(LANG_QUEUE) }, + { STR(LANG_QUEUE_LAST) }, + }; + + return set_option( str(LANG_CLICK_INSERT), + &global_settings.click_insert, INT, names, 6, + NULL ); +} + bool playlist_menu(void) { int m; @@ -70,6 +86,7 @@ { ID2P(LANG_VIEW_DYNAMIC_PLAYLIST), playlist_viewer }, { ID2P(LANG_SAVE_DYNAMIC_PLAYLIST), save_playlist }, { ID2P(LANG_RECURSE_DIRECTORY), recurse_directory }, + { ID2P(LANG_CLICK_INSERT), click_insert }, }; m = menu_init( items, sizeof items / sizeof(struct menu_item), NULL, @@ -78,3 +95,5 @@ menu_exit(m); return result; } + + Index: apps/settings.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings.c,v retrieving revision 1.309 diff -u -r1.309 settings.c --- apps/settings.c 16 Oct 2005 11:15:51 -0000 1.309 +++ apps/settings.c 1 Nov 2005 20:47:37 -0000 @@ -445,7 +445,7 @@ {1, S_O(dircache), false, "dircache", off_on }, {22, S_O(dircache_size), 0, NULL, NULL }, #endif - + {3, S_O(click_insert), 0, "click insert setting", "original,insert,insert last,insert shuffled,queue,queue last"}, /* If values are just added to the end, no need to bump the version. */ /* new stuff to be added at the end */ Index: apps/settings.h =================================================================== RCS file: /cvsroot/rockbox/apps/settings.h,v retrieving revision 1.163 diff -u -r1.163 settings.h --- apps/settings.h 7 Oct 2005 17:38:04 -0000 1.163 +++ apps/settings.h 1 Nov 2005 20:47:41 -0000 @@ -344,6 +344,9 @@ bool dircache; /* enable directory cache */ int dircache_size; /* directory cache structure last size, 22 bits */ #endif + int click_insert; /*setting for click behaviour in file tree: + 0:insert, 1:insert last,2:queue, + 3:queue last,4:insert shuffled*/ }; enum optiontype { INT, BOOL }; Index: apps/tree.c =================================================================== RCS file: /cvsroot/rockbox/apps/tree.c,v retrieving revision 1.366 diff -u -r1.366 tree.c --- apps/tree.c 31 Oct 2005 20:56:29 -0000 1.366 +++ apps/tree.c 1 Nov 2005 20:47:44 -0000 @@ -604,14 +604,9 @@ #ifdef TREE_RC_RUN case TREE_RC_RUN: #endif - case TREE_RUN: -#ifdef TREE_RUN_PRE - if (((button == TREE_RUN) #ifdef TREE_RC_RUN_PRE - || (button == TREE_RC_RUN)) - && ((lastbutton != TREE_RC_RUN_PRE) -#endif - && (lastbutton != TREE_RUN_PRE))) + if((button == TREE_RC_RUN) + && (lastbutton != TREE_RC_RUN_PRE)) break; #endif /* nothing to do if no files to display */ @@ -627,7 +622,41 @@ } restore = true; break; + case TREE_RUN: /*modification to allow 1 button insert*/ +#ifdef TREE_RUN_PRE + if ((button == TREE_RUN) + && (lastbutton != TREE_RUN_PRE)) + break; +#endif + /* nothing to do if no files to display */ + if ( numentries == 0 ) + break; + + int i; + if (id3db) + i = db_enter(&tc); + else + { + if (currdir[1]) + snprintf(buf, sizeof buf, "%s/%s", + currdir, dircache[tc.selected_item].name); + else + snprintf(buf, sizeof buf, "/%s", + dircache[tc.selected_item].name); + i=onplay_one_click(buf, dircache[tc.selected_item].attr, curr_context,&tc); + } + + switch (i) + { + case 1: reload_dir = true; break; + case 2: start_wps = true; break; + case 3: exit_func = true; break; + default: break; + } + + restore = true; + break; case TREE_EXIT: case TREE_EXIT | BUTTON_REPEAT: #ifdef TREE_RC_EXIT Index: apps/lang/english.lang =================================================================== RCS file: /cvsroot/rockbox/apps/lang/english.lang,v retrieving revision 1.187 diff -u -r1.187 english.lang --- apps/lang/english.lang 8 Oct 2005 22:01:42 -0000 1.187 +++ apps/lang/english.lang 1 Nov 2005 20:47:49 -0000 @@ -1551,6 +1551,19 @@ voice: "Playlist Options" new: +id: LANG_CLICK_INSERT +desc: in playlist menu +eng: "Click Insert Options" +voice: "" +new: + +id: LANG_CLICK_DEFAULT +desc: in click insert menu +eng: "Original Behaviour" +voice: "" +new: + + id: LANG_PLAYLIST_INSERT_COUNT desc: splash number of tracks inserted eng: "Inserted %d tracks (%s)"