Index: apps/onplay.c =================================================================== --- apps/onplay.c.orig +++ apps/onplay.c @@ -1156,3 +1156,41 @@ int onplay(char* file, int attr, int fro return context == CONTEXT_WPS ? ONPLAY_OK : ONPLAY_RELOAD_DIR; } } +/*one click insert modification*/ + +int onplay_one_click(char* file, int attr, int from){ + int ret=1; + context=from; + selected_file = file; + selected_file_attr = attr; + bool empty_playlist=true; + + if (audio_status() & AUDIO_STATUS_PLAY) + { + // MWE if playlist is empty PLAYLIST_INSERT_FIRST is doing + // the wrong thing in id3 mode -( + empty_playlist=false; + } + + if(global_settings.click_insert==0) + return ret; + + if(global_settings.click_insert==1) + add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT, false); + else if(global_settings.click_insert==2) + add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT_FIRST, false); + else if(global_settings.click_insert==3) + add_to_playlist(PLAYLIST_INSERT_LAST, false); + else if(global_settings.click_insert==4) + add_to_playlist(PLAYLIST_INSERT_SHUFFLED, false); + else if(global_settings.click_insert==5) + add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT, true); + else if(global_settings.click_insert==6) + add_to_playlist(empty_playlist?PLAYLIST_INSERT_LAST:PLAYLIST_INSERT_FIRST, true); + else if(global_settings.click_insert==7) + add_to_playlist(PLAYLIST_INSERT_LAST, true); + else if(global_settings.click_insert==8) + add_to_playlist(PLAYLIST_INSERT_SHUFFLED, true); + return onplay_result; +} + Index: apps/onplay.h =================================================================== --- apps/onplay.h.orig +++ apps/onplay.h @@ -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); enum { ONPLAY_MAINMENU = -1, Index: apps/settings.h =================================================================== --- apps/settings.h.orig +++ apps/settings.h @@ -600,6 +600,9 @@ struct user_settings #ifdef HAVE_REMOTE_LCD unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */ #endif + int click_insert; /*setting for click behaviour in file tree: + 0:insert, 1:insert last,2:queue, + 3:queue last,4:insert shuffled*/ #ifdef HAVE_BACKLIGHT_BRIGHTNESS int brightness; /* iriver h300: backlight PWM value: 2..15 (0 and 1 are black) */ Index: apps/tree.c =================================================================== --- apps/tree.c.orig +++ apps/tree.c @@ -581,7 +581,74 @@ static int dirbrowse() } restore = true; break; + case ACTION_TREE_INSERT: + /* nothing to do if no files to display */ + if ( numentries == 0 ) + break; + /* behave like ok if not enabled */ + if(global_settings.click_insert==0){ +#ifdef HAVE_TAGCACHE + switch (id3db?tagtree_enter(&tc):ft_enter(&tc)) +#else + switch (ft_enter(&tc)) +#endif + { + case 1: reload_dir = true; break; + case 2: start_wps = true; break; + case 3: exit_func = true; break; + default: break; + } + restore = true; + break; + } + + // tree insert + int onplay_result; + int attr = 0; +#ifdef HAVE_TAGCACHE + if (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 + { + attr = dircache[tc.selected_item].attr; + + 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); + } + onplay_result=onplay_one_click(buf, attr, curr_context); + + switch (onplay_result) + { + case ONPLAY_MAINMENU: + return GO_TO_ROOT; + + case ONPLAY_OK: + restore = true; + break; + + case ONPLAY_RELOAD_DIR: + reload_dir = true; + break; + + case ONPLAY_START_PLAY: + return GO_TO_WPS; + break; + } + break; case ACTION_STD_CANCEL: if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) { exit_func = true; Index: apps/keymaps/keymap-h1x0_h3x0.c =================================================================== --- apps/keymaps/keymap-h1x0_h3x0.c.orig +++ apps/keymaps/keymap-h1x0_h3x0.c @@ -107,6 +107,7 @@ static const struct button_mapping butto { 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_INSERT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) }; /* button_context_tree */ @@ -372,6 +373,7 @@ static const struct button_mapping *butt static const struct button_mapping button_context_tree_h100remote[] = { { ACTION_TREE_WPS, BUTTON_RC_ON, BUTTON_NONE }, + { ACTION_TREE_INSERT, BUTTON_RC_REC, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE) }; /* button_context_tree_h100remote */ @@ -379,6 +381,7 @@ static const struct button_mapping butto static const struct button_mapping button_context_tree_h300lcdremote[] = { { ACTION_TREE_STOP, BUTTON_RC_STOP, BUTTON_NONE }, { ACTION_TREE_WPS, BUTTON_RC_ON, BUTTON_NONE }, + { ACTION_TREE_INSERT, BUTTON_RC_MENU|BUTTON_REL, BUTTON_RC_MENU }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST|CONTEXT_REMOTE) }; /* button_context_tree_h300lcdremote */ Index: apps/lang/english.lang =================================================================== --- apps/lang/english.lang.orig +++ apps/lang/english.lang @@ -324,6 +324,34 @@ + id: LANG_CLICK_DEFAULT + desc: in click insert menu + user: + + *: "Original Behaviour" + + + *: "Original Behaviour" + + + *: "" + + + + id: LANG_CLICK_INSERT + desc: in playlist menu + user: + + *: "Click Insert Options" + + + *: "Click Insert Options" + + + *: "" + + + id: LANG_PLUGINS desc: in the main menu user: Index: apps/settings_list.c =================================================================== --- apps/settings_list.c.orig +++ apps/settings_list.c @@ -1165,7 +1165,15 @@ const struct settings_list settings[] = "ignore_the", "no, browser", NULL, 4, ID2P(LANG_IGNORE_THE_NO), ID2P(LANG_IGNORE_THE_BROWSE)), #endif - + + CHOICE_SETTING(0, click_insert, LANG_CLICK_INSERT, 0 , + "click insert", NULL, NULL, 9, + ID2P(LANG_CLICK_DEFAULT), ID2P(LANG_INSERT), + ID2P(LANG_INSERT_FIRST) , ID2P(LANG_INSERT_LAST), + ID2P(LANG_INSERT_SHUFFLED) , ID2P(LANG_QUEUE), + ID2P(LANG_QUEUE_FIRST) , ID2P(LANG_QUEUE_LAST), + ID2P(LANG_QUEUE_SHUFFLED)), + CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files,db,wps,menu," #ifdef HAVE_RECORDING Index: apps/menus/playlist_menu.c =================================================================== --- apps/menus/playlist_menu.c.orig +++ apps/menus/playlist_menu.c @@ -74,10 +74,11 @@ MENUITEM_FUNCTION(catalog, 0, ID2P(LANG_ NULL, NULL, Icon_NOICON); MENUITEM_SETTING(recursive_dir_insert, &global_settings.recursive_dir_insert, NULL); MENUITEM_SETTING(warn_on_erase, &global_settings.warnon_erase_dynplaylist, NULL); +MENUITEM_SETTING(click_insert, &global_settings.click_insert, NULL); MAKE_MENU(playlist_settings, ID2P(LANG_PLAYLIST_MENU), NULL, Icon_Playlist, - &recursive_dir_insert, &warn_on_erase); + &recursive_dir_insert, &warn_on_erase, &click_insert); MAKE_MENU(playlist_options, ID2P(LANG_PLAYLIST_MENU), NULL, Icon_Playlist, &create_playlist_item, &view_playlist, &save_playlist, &catalog); Index: apps/action.h =================================================================== --- apps/action.h.orig +++ apps/action.h @@ -134,6 +134,7 @@ enum { ACTION_TREE_PGRIGHT,/* optional */ ACTION_TREE_STOP, ACTION_TREE_WPS, + ACTION_TREE_INSERT, /* radio */ ACTION_FM_MENU, Index: apps/keymaps/keymap-x5.c =================================================================== --- apps/keymaps/keymap-x5.c.orig +++ apps/keymaps/keymap-x5.c @@ -266,7 +266,8 @@ static const struct button_mapping butto { ACTION_NONE, BUTTON_PLAY, BUTTON_NONE }, { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, - + { ACTION_TREE_INSERT, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_tree */ Index: apps/menu.c =================================================================== --- apps/menu.c.orig +++ apps/menu.c @@ -487,7 +487,7 @@ int do_menu(const struct menu_item_ex *s done = true; } } - else if (action == ACTION_STD_OK) + else if (action == ACTION_STD_OK || action == ACTION_TREE_INSERT) { int type; #ifdef HAS_BUTTONBAR