Index: trunk/apps/bookmark.c =================================================================== --- trunk.orig/apps/bookmark.c +++ trunk/apps/bookmark.c @@ -69,6 +69,7 @@ struct bookmark_list int count; int total_count; bool show_dont_resume; + bool is_mrb; bool reload; char* items[]; }; @@ -79,7 +80,7 @@ static bool check_bookmark(const char* static char* create_bookmark(void); static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id); static void say_bookmark(const char* bookmark, - int bookmark_id); + int bookmark_id, bool is_mrb); static bool play_bookmark(const char* bookmark); static bool generate_bookmark_file_name(const char *in); static const char* skip_token(const char* s); @@ -99,7 +100,7 @@ static bool parse_bookmark(const char * char* file_name); static int buffer_bookmarks(struct bookmark_list* bookmarks, int first_line); static char* get_bookmark_info(int list_index, void* data, char *buffer); -static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume); +static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume, bool is_mrb); static bool system_check(void); static bool write_bookmark(bool create_bookmark_file); static int get_bookmark_count(const char* bookmark_file_name); @@ -136,7 +137,7 @@ bool bookmark_load_menu(void) sizeof(global_temp_buffer)); if (generate_bookmark_file_name(name)) { - char* bookmark = select_bookmark(global_bookmark_file_name, false); + char* bookmark = select_bookmark(global_bookmark_file_name, false, false); if (bookmark != NULL) { @@ -154,7 +155,7 @@ bool bookmark_load_menu(void) /* ----------------------------------------------------------------------- */ bool bookmark_mrb_load() { - char* bookmark = select_bookmark(RECENT_BOOKMARK_FILE, false); + char* bookmark = select_bookmark(RECENT_BOOKMARK_FILE, false, true); if (bookmark != NULL) { @@ -399,7 +400,7 @@ bool bookmark_autoload(const char* file) } else { - char* bookmark = select_bookmark(global_bookmark_file_name, true); + char* bookmark = select_bookmark(global_bookmark_file_name, true, false); if (bookmark != NULL) { @@ -432,7 +433,7 @@ bool bookmark_load(const char* file, boo else { /* This is not an auto-load, so list the bookmarks */ - bookmark = select_bookmark(file, false); + bookmark = select_bookmark(file, false, false); } if (bookmark != NULL) @@ -596,15 +597,30 @@ static char* get_bookmark_info(int list_ } } +static int bookmark_list_voice_cb(int list_index, void* data) +{ + struct bookmark_list* bookmarks = (struct bookmark_list*) data; + int index = list_index / 2; + + if (bookmarks->show_dont_resume) + { + if (index == 0) + return talk_id(LANG_BOOKMARK_DONT_RESUME, false); + index--; + } + say_bookmark(bookmarks->items[index - bookmarks->start], index, + bookmarks->is_mrb); + return 0; +} + /* ----------------------------------------------------------------------- */ /* This displays a the bookmarks in a file and allows the user to */ /* select one to play. */ /* ------------------------------------------------------------------------*/ -static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume) +static char* select_bookmark(const char* bookmark_file_name, bool show_dont_resume, bool is_mrb) { struct bookmark_list* bookmarks; struct gui_synclist list; - int last_item = -2; int item = 0; int action; size_t size; @@ -614,9 +630,12 @@ static char* select_bookmark(const char* bookmarks = plugin_get_buffer(&size); bookmarks->buffer_size = size; bookmarks->show_dont_resume = show_dont_resume; + bookmarks->is_mrb = is_mrb; bookmarks->filename = bookmark_file_name; bookmarks->start = 0; gui_synclist_init(&list, &get_bookmark_info, (void*) bookmarks, false, 2); + if(talk_menus_enabled()) + gui_synclist_set_voice_callback(&list, bookmark_list_voice_cb); gui_synclist_set_title(&list, str(LANG_BOOKMARK_SELECT_BOOKMARK), Icon_Bookmark); gui_syncstatusbar_draw(&statusbars, true); @@ -655,11 +674,13 @@ static char* select_bookmark(const char* buffer_bookmarks(bookmarks, bookmarks->start); gui_synclist_draw(&list); + cond_talk_ids_fq(VOICE_EXT_BMARK); + gui_synclist_speak_item(&list); refresh = false; } - action = get_action(CONTEXT_BOOKMARKSCREEN, HZ / 2); - gui_synclist_do_button(&list, &action, LIST_WRAP_UNLESS_HELD); + list_do_action(CONTEXT_BOOKMARKSCREEN, HZ / 2, + &list, &action, LIST_WRAP_UNLESS_HELD); item = gui_synclist_get_sel_pos(&list) / 2; if (bookmarks->show_dont_resume) @@ -667,20 +688,6 @@ static char* select_bookmark(const char* item--; } - if (item != last_item && talk_menus_enabled()) - { - last_item = item; - - if (item == -1) - { - talk_id(LANG_BOOKMARK_DONT_RESUME, true); - } - else - { - say_bookmark(bookmarks->items[item - bookmarks->start], item); - } - } - if (action == ACTION_STD_CONTEXT) { MENUITEM_STRINGLIST(menu_items, ID2P(LANG_BOOKMARK_CONTEXT_MENU), @@ -722,7 +729,6 @@ static char* select_bookmark(const char* delete_bookmark(bookmark_file_name, item); bookmarks->reload = true; refresh = true; - last_item = -2; } break; @@ -787,41 +793,54 @@ static bool delete_bookmark(const char* /* This function parses a bookmark, says the voice UI part of it. */ /* ------------------------------------------------------------------------*/ static void say_bookmark(const char* bookmark, - int bookmark_id) + int bookmark_id, bool is_mrb) { int resume_index; long ms; - char dir[MAX_PATH]; - bool enqueue = false; /* only the first voice is not queued */ - - if (!parse_bookmark(bookmark, &resume_index, NULL, NULL, NULL, - dir, sizeof(dir), &ms, NULL, NULL, NULL)) + char playlist_dir[MAX_PATH]; + bool playlist_shuffle = false; + bool is_dir; + + if (!parse_bookmark(bookmark, &resume_index, NULL, NULL, NULL, + playlist_dir, sizeof(playlist_dir), + &ms, NULL, &playlist_shuffle, + global_filename)) { - talk_id(LANG_BOOKMARK_INVALID, true); + talk_id(LANG_BOOKMARK_INVALID, false); return; } -/* disabled, because transition between talkbox and voice UI clip is not nice */ -#if 0 - if (global_settings.talk_dir >= 3) - { /* "talkbox" enabled */ - char* last = strrchr(dir, '/'); - if (last) - { /* compose filename for talkbox */ - strncpy(last + 1, dir_thumbnail_name, sizeof(dir)-(last-dir)-1); - talk_file(dir, enqueue); - enqueue = true; - } + talk_number(bookmark_id + 1, false); + + is_dir = (playlist_dir[strlen(playlist_dir)-1] == '/'); + if(is_mrb) + { /* It's useful to know which playlist this is */ + if(is_dir) + talk_dir_or_spell(playlist_dir, + TALK_IDARRAY(VOICE_DIR), true); + else talk_file_or_spell(NULL, playlist_dir, + TALK_IDARRAY(LANG_PLAYLIST), true); } -#endif - talk_id(VOICE_EXT_BMARK, enqueue); - talk_number(bookmark_id + 1, true); + + if(playlist_shuffle) + talk_id(LANG_SHUFFLE, true); + talk_id(VOICE_BOOKMARK_SELECT_INDEX_TEXT, true); talk_number(resume_index + 1, true); talk_id(LANG_TIME, true); - if (ms / 60000) - talk_value(ms / 60000, UNIT_MIN, true); - talk_value((ms % 60000) / 1000, UNIT_SEC, true); + talk_value(ms / 1000, UNIT_TIME, true); + + /* Track filename */ + if(is_dir) + talk_file_or_spell(playlist_dir, global_filename, + TALK_IDARRAY(VOICE_FILE), true); + else + { /* Unfortunately if this is a playlist, we do not know in which + directory the file is and therefore cannot find the track's + .talk file. */ + talk_id(VOICE_FILE, true); + talk_spell(global_filename, true); + } } /* ----------------------------------------------------------------------- */ Index: trunk/apps/tree.c =================================================================== --- trunk.orig/apps/tree.c +++ trunk/apps/tree.c @@ -1099,6 +1099,9 @@ void bookmark_play(char *resume_file, in int i; char* suffix = strrchr(resume_file, '.'); + /* Nicely shuts up the voice while acknowledging the key press */ + gui_syncsplash(0, ID2P(LANG_WAIT)); + if (suffix != NULL && (!strcasecmp(suffix, ".m3u") || !strcasecmp(suffix, ".m3u8"))) {