summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-03-08 17:18:18 +0000
committerThomas Martitz <kugel@rockbox.org>2009-03-08 17:18:18 +0000
commit87d1744e91e016b650a3c7826a93cd6afcaf0383 (patch)
treeca45fdd389f8e58cd35f55ce08b64d7ac1a03027
parent99cb21f7aaa9e4ba661053828cc9c030fdc72467 (diff)
downloadrockbox-87d1744e91e016b650a3c7826a93cd6afcaf0383.tar.gz
rockbox-87d1744e91e016b650a3c7826a93cd6afcaf0383.zip
Fix playlist "Insert" a bit.
If insert was used to create a new playlist (e.g. inserting without audio playing), the insert position wasn't updated. Thus, the playlist created was in reversed order (except for the first song). This was the reason "Insert last" was actually used as Insert in this case. BUT, this one doesn't update the insert position eiterh, but the order of the songs is fine, at least (due to appending). Now, insert always updates the insert position properly, so that the aforementioned bugs are fixed. Insert is always used now. Other impact: If you create a playlist using insert, every subsequent insert will append songs at the end of the playlist,if you start playback pressing select on songs, every subsequent insert will insert after the current track. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20241 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/onplay.c18
-rw-r--r--apps/playlist.c3
2 files changed, 4 insertions, 17 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index ead372d4e6..9a308730ad 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -197,7 +197,7 @@ static bool add_to_playlist(int position, bool queue)
197 /* Ask if user wants to recurse directory */ 197 /* Ask if user wants to recurse directory */
198 recurse = (gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES); 198 recurse = (gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES);
199 } 199 }
200 200
201 playlist_insert_directory(NULL, selected_file, position, queue, 201 playlist_insert_directory(NULL, selected_file, position, queue,
202 recurse); 202 recurse);
203 } 203 }
@@ -342,12 +342,9 @@ static int treeplaylist_callback(int action,
342 const struct menu_item_ex *this_item); 342 const struct menu_item_ex *this_item);
343 343
344/* insert items */ 344/* insert items */
345MENUITEM_FUNCTION(i_pl_item_no_play, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
346 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_LAST,
347 treeplaylist_callback, Icon_Playlist);
348MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT), 345MENUITEM_FUNCTION(i_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT),
349 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT, 346 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT,
350 treeplaylist_wplayback_callback, Icon_Playlist); 347 treeplaylist_callback, Icon_Playlist);
351MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST), 348MENUITEM_FUNCTION(i_first_pl_item, MENU_FUNC_USEPARAM, ID2P(LANG_INSERT_FIRST),
352 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST, 349 playlist_insert_func, (intptr_t*)PLAYLIST_INSERT_FIRST,
353 treeplaylist_wplayback_callback, Icon_Playlist); 350 treeplaylist_wplayback_callback, Icon_Playlist);
@@ -389,7 +386,7 @@ MAKE_ONPLAYMENU( tree_playlist_menu, ID2P(LANG_PLAYLIST),
389 &view_playlist_item, 386 &view_playlist_item,
390 387
391 /* insert */ 388 /* insert */
392 &i_pl_item_no_play, &i_pl_item, &i_first_pl_item, 389 &i_pl_item, &i_first_pl_item,
393 &i_last_pl_item, &i_shuf_pl_item, 390 &i_last_pl_item, &i_shuf_pl_item,
394 391
395 /* queue */ 392 /* queue */
@@ -426,15 +423,6 @@ static int treeplaylist_callback(int action,
426 else 423 else
427 return ACTION_EXIT_MENUITEM; 424 return ACTION_EXIT_MENUITEM;
428 } 425 }
429 else if (this_item == &i_pl_item_no_play)
430 {
431 if (!(audio_status() & AUDIO_STATUS_PLAY))
432 {
433 return action;
434 }
435 else
436 return ACTION_EXIT_MENUITEM;
437 }
438 else if (this_item == &i_shuf_pl_item) 426 else if (this_item == &i_shuf_pl_item)
439 { 427 {
440 428
diff --git a/apps/playlist.c b/apps/playlist.c
index 4107af3af9..acbadf982c 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -712,8 +712,7 @@ static int add_track_to_playlist(struct playlist_info* playlist,
712 else 712 else
713 position = insert_position = 0; 713 position = insert_position = 0;
714 714
715 if (playlist->started) 715 playlist->last_insert_pos = position;
716 playlist->last_insert_pos = position;
717 break; 716 break;
718 case PLAYLIST_INSERT_FIRST: 717 case PLAYLIST_INSERT_FIRST:
719 if (playlist->amount > 0) 718 if (playlist->amount > 0)