diff -ru -x CVS -x Makefile -x build -x simulator -x tools orig/apps/lang/english.lang dev/apps/lang/english.lang --- orig/apps/lang/english.lang 2004-04-13 21:17:08.000000000 +0200 +++ dev/apps/lang/english.lang 2004-04-13 21:15:11.000000000 +0200 @@ -2654,3 +2654,16 @@ eng: "" voice: "Current time:" new: + +id: LANG_PLAY_BEHAVIOUR +desc: Settings menu Play button +eng: "Play button" +voice: "Play button" +new: + +id: LANG_RIGHT_BEHAVIOUR +desc: Settings menu Right button +eng: "Right button" +voice: "Right button" +new: + diff -ru -x CVS -x Makefile -x build -x simulator -x tools orig/apps/settings.c dev/apps/settings.c --- orig/apps/settings.c 2004-04-13 21:17:08.000000000 +0200 +++ dev/apps/settings.c 2004-04-15 13:50:29.000000000 +0200 @@ -163,7 +163,9 @@ 0xCC (char[20]) Lang file 0xE0 (char[20]) Font file 0xF4 Prerecording time (bit 0-4), Recording directory option (bit 5-6) -0xF5-0xFF +0xF5 Talk options +0xF6 Play (bit 0-3) & Right (bit 4-7) button behaviour +0xF7-0xFF *************************************/ @@ -460,6 +462,10 @@ ((global_settings.talk_file & 3) << 3) | ((global_settings.talk_menu & 1) << 5); + config_block[0xf6]=(unsigned char) + ((global_settings.play_button & 0xf) | + ((global_settings.right_button & 0xf) << 4)); + if(save_config_buffer()) { lcd_clear_display(); @@ -802,7 +808,12 @@ global_settings.talk_file = (config_block[0xf5] >> 3) & 3; global_settings.talk_menu = (config_block[0xf5] >> 5) & 1; } - + + if (config_block[0xf6] != 0xff) { + global_settings.play_button = (config_block[0xf6]) & 0xf; + global_settings.right_button = (config_block[0xf6] >> 4) & 0xf; + } + #ifdef HAVE_LCD_CHARCELLS if (config_block[0xa8] != 0xff) global_settings.jump_scroll = config_block[0xa8]; @@ -1219,6 +1230,24 @@ { set_cfg_bool(&global_settings.talk_menu, value); } + else if (!strcasecmp(name, "play button")) + { + static char* options[] = {"play", + "insert", "insert next", "insert last", + "insert next and play", + "queue", "queue next", "queue last", + "queue next and play"}; + set_cfg_option(&global_settings.play_button, value, options, 9); + } + else if (!strcasecmp(name, "right button")) + { + static char* options[] = {"play", + "insert", "insert next", "insert last", + "insert next and play", + "queue", "queue next", "queue last", + "queue next and play"}; + set_cfg_option(&global_settings.right_button, value, options, 9); + } } close(fd); @@ -1352,6 +1381,17 @@ global_settings.ff_rewind_accel, global_settings.buffer_margin); fprintf(fd, "volume fade: %s\r\n", boolopt[global_settings.fade_on_stop]); + + { + static char* options[] = {"play", + "insert", "insert next", "insert last", + "insert next and play", + "queue", "queue next", "queue last", + "queue next and play"}; + fprintf(fd, "play button: %s\r\n", options[global_settings.play_button]); + fprintf(fd, "right button: %s\r\n", options[global_settings.right_button]); + } + fprintf(fd, "#\r\n# File View\r\n#\r\n"); fprintf(fd, "sort case: %s\r\n", boolopt[global_settings.sort_case]); @@ -1682,6 +1722,8 @@ global_settings.playlist_viewer_icons = true; global_settings.playlist_viewer_indices = true; global_settings.playlist_viewer_track_display = 0; + global_settings.play_button = PLAY_PLAY ; + global_settings.right_button = PLAY_PLAY ; /* talking menu on by default, to help the blind (if voice file present) */ global_settings.talk_menu = 1; global_settings.talk_dir = 0; diff -ru -x CVS -x Makefile -x build -x simulator -x tools orig/apps/settings.h dev/apps/settings.h --- orig/apps/settings.h 2004-04-13 21:17:08.000000000 +0200 +++ dev/apps/settings.h 2004-04-15 13:18:09.000000000 +0200 @@ -197,6 +197,8 @@ int recursive_dir_insert; /* should directories be inserted recursively */ bool line_in; /* false=off, true=active */ + int play_button; /* play button behaviour for audio files */ + int right_button; /* right button behaviour for audio files */ /* playlist viewer settings */ bool playlist_viewer_icons; /* display icons on viewer */ @@ -286,4 +288,11 @@ /* recursive dir insert options */ enum { RECURSE_OFF, RECURSE_ON, RECURSE_ASK }; +/* play and right button behaviour for audio and playlist files */ +enum { PLAY_PLAY, + PLAY_INSERT, PLAY_INSERT_NEXT, PLAY_INSERT_LAST, + PLAY_INSERT_NEXT_AND_PLAY, + PLAY_QUEUE, PLAY_QUEUE_NEXT, PLAY_QUEUE_LAST, + PLAY_QUEUE_NEXT_AND_PLAY }; + #endif /* __SETTINGS_H__ */ diff -ru -x CVS -x Makefile -x build -x simulator -x tools orig/apps/settings_menu.c dev/apps/settings_menu.c --- orig/apps/settings_menu.c 2004-04-13 21:17:08.000000000 +0200 +++ dev/apps/settings_menu.c 2004-04-15 13:28:51.000000000 +0200 @@ -835,6 +835,40 @@ } +static bool set_play_button(void) +{ + struct opt_items names[] = { + {"Play",-1}, + {"Insert",-1}, + {"Insert Next",-1}, + {"Insert Last",-1}, + {"Insert Next and Play",-1}, + {"Queue",-1}, + {"Queue Next",-1}, + {"Queue Last",-1}, + {"Queue Next and Play",-1}, + }; + return set_option(str(LANG_PLAY_BEHAVIOUR), &global_settings.play_button, + INT, names, 9, NULL ); +} + +static bool set_right_button(void) +{ + struct opt_items names[] = { + {"Play",-1}, + {"Insert",-1}, + {"Insert Next",-1}, + {"Insert Last",-1}, + {"Insert Next and Play",-1}, + {"Queue",-1}, + {"Queue Next",-1}, + {"Queue Last",-1}, + {"Queue Next and Play",-1}, + }; + return set_option(str(LANG_RIGHT_BEHAVIOUR), &global_settings.right_button, + INT, names, 9, NULL ); +} + static bool ff_rewind_accel(void) { struct opt_items names[] = { @@ -986,6 +1020,8 @@ { STR(LANG_WIND_MENU), ff_rewind_settings_menu }, { STR(LANG_MP3BUFFER_MARGIN), buffer_margin }, { STR(LANG_FADE_ON_STOP), set_fade_on_stop }, + { STR(LANG_PLAY_BEHAVIOUR), set_play_button }, + { STR(LANG_RIGHT_BEHAVIOUR), set_right_button }, }; bool old_shuffle = global_settings.playlist_shuffle; diff -ru -x CVS -x Makefile -x build -x simulator -x tools orig/apps/tree.c dev/apps/tree.c --- orig/apps/tree.c 2004-04-13 21:17:08.000000000 +0200 +++ dev/apps/tree.c 2004-04-15 13:26:06.000000000 +0200 @@ -1086,10 +1086,78 @@ int seed = current_tick; bool play = false; int start_index=0; + int play_action; lcd_stop_scroll(); switch ( file->attr & TREE_ATTR_MASK ) { case TREE_ATTR_M3U: + /* which button got us here? */ + if ((button & TREE_ENTER) == TREE_ENTER) + play_action = global_settings.right_button; + else + play_action = global_settings.play_button; + + if ((mpeg_status() & MPEG_STATUS_PLAY) && + play_action != PLAY_PLAY) + { + switch (play_action) + { + case PLAY_INSERT: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT, false); + break; + + case PLAY_INSERT_NEXT: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_FIRST, false); + break; + + case PLAY_INSERT_LAST: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_LAST, false); + break; + + case PLAY_INSERT_NEXT_AND_PLAY: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_FIRST, false); + mpeg_next(); + break; + + case PLAY_QUEUE: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT, true); + break; + + case PLAY_QUEUE_NEXT: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_FIRST, true); + break; + + case PLAY_QUEUE_LAST: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_LAST, true); + break; + + case PLAY_QUEUE_NEXT_AND_PLAY: + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT_FIRST, true); + mpeg_next(); + break; + } + break; + } + + if (play_action != PLAY_PLAY) + { + playlist_create(NULL, NULL); + playlist_insert_playlist(NULL, buf, + PLAYLIST_INSERT, false); + if (global_settings.playlist_shuffle) + playlist_shuffle(current_tick, -1); + playlist_start(0,0); + break; + } + if (bookmark_autoload(buf)) { restore = true; @@ -1107,6 +1175,72 @@ break; case TREE_ATTR_MPA: + if ((button & TREE_ENTER) == TREE_ENTER) + play_action = global_settings.right_button; + else + play_action = global_settings.play_button; + + if ((mpeg_status() & MPEG_STATUS_PLAY) && + play_action != PLAY_PLAY) + { + switch (play_action) + { + case PLAY_INSERT: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT, false); + break; + + case PLAY_INSERT_NEXT: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_FIRST, false); + break; + + case PLAY_INSERT_LAST: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_LAST, false); + break; + + case PLAY_INSERT_NEXT_AND_PLAY: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_FIRST, false); + mpeg_next(); + break; + + case PLAY_QUEUE: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT, true); + break; + + case PLAY_QUEUE_NEXT: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_FIRST, true); + break; + + case PLAY_QUEUE_LAST: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_LAST, true); + break; + + case PLAY_QUEUE_NEXT_AND_PLAY: + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT_FIRST, true); + mpeg_next(); + break; + } + break; + } + + if (play_action != PLAY_PLAY) + { + playlist_create(NULL, NULL); + playlist_insert_track(NULL, buf, + PLAYLIST_INSERT, false); + if (global_settings.playlist_shuffle) + playlist_shuffle(current_tick, -1); + playlist_start(0,0); + break; + } + if (bookmark_autoload(currdir)) { restore = true;