diff -ru -x CVS -x Makefile -x '_*' -x '.#*' -x simulator -x tools original/apps/lang/english.lang patch_935682/apps/lang/english.lang --- original/apps/lang/english.lang 2004-07-16 17:01:32.000000000 +0200 +++ patch_935682/apps/lang/english.lang 2004-07-16 17:13:05.000000000 +0200 @@ -2722,6 +2722,18 @@ voice: "by type" 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: + id: LANG_FM_EDIT_PRESET desc: in radio screen eng: "Edit preset" diff -ru -x CVS -x Makefile -x '_*' -x '.#*' -x simulator -x tools original/apps/settings.c patch_935682/apps/settings.c --- original/apps/settings.c 2004-07-16 17:01:32.000000000 +0200 +++ patch_935682/apps/settings.c 2004-07-16 17:16:06.000000000 +0200 @@ -149,6 +149,7 @@ static const char off_on[] = "off,on"; static const char off_on_ask[] = "off,on,ask"; static const char graphic_numeric[] = "graphic,numeric"; +static const char play_button_choices[] = "play,insert,insert next,insert last,insert next and play,queue,queue next,queue last,queue next and play"; /* the part of the settings which ends up in the RTC RAM, where available (those we either need early, save frequently, or without spinup) */ @@ -332,6 +333,9 @@ {9, S_O(mdb_shape), 0, "mdb shape", NULL}, {1, S_O(mdb_enable), 0, "mdb enable", off_on}, + {4, S_O(play_button), 0, "play button", play_button_choices }, + {4, S_O(right_button), 0, "right button", play_button_choices }, + /* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */ }; diff -ru -x CVS -x Makefile -x '_*' -x '.#*' -x simulator -x tools original/apps/settings.h patch_935682/apps/settings.h --- original/apps/settings.h 2004-07-16 17:01:32.000000000 +0200 +++ patch_935682/apps/settings.h 2004-07-16 17:02:49.000000000 +0200 @@ -205,6 +205,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 */ @@ -297,4 +299,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 '_*' -x '.#*' -x simulator -x tools original/apps/settings_menu.c patch_935682/apps/settings_menu.c --- original/apps/settings_menu.c 2004-07-16 17:01:32.000000000 +0200 +++ patch_935682/apps/settings_menu.c 2004-07-16 17:02:50.000000000 +0200 @@ -841,6 +841,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[] = { @@ -992,6 +1026,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 '_*' -x '.#*' -x simulator -x tools original/apps/tree.c patch_935682/apps/tree.c --- original/apps/tree.c 2004-07-16 17:01:32.000000000 +0200 +++ patch_935682/apps/tree.c 2004-07-16 17:02:50.000000000 +0200 @@ -1077,10 +1077,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: + /* did RIGHT or PLAY button get 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; @@ -1098,6 +1166,73 @@ break; case TREE_ATTR_MPA: + /* did RIGHT or PLAY button get 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_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; @@ -1333,15 +1468,14 @@ } else { - if (mpeg_status() & MPEG_STATUS_PLAY) - { - start_wps=true; - } - else + /* start playing if we're stopped */ + if (!(mpeg_status() & MPEG_STATUS_PLAY)) { - start_resume(false); + playlist_start(global_settings.resume_index, + global_settings.resume_offset); restore = true; } + start_wps = true; } break; #endif