diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-24 10:20:22 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-24 10:20:22 +0000 |
commit | 8358dffd11c45fc9bc30413f5559986c77083efc (patch) | |
tree | 756cb923a4a14741cf32571d8fe29305979cb6df /apps | |
parent | e0b957fd5185bd957a6bd78c8d897255c1dc87e8 (diff) | |
download | rockbox-8358dffd11c45fc9bc30413f5559986c77083efc.tar.gz rockbox-8358dffd11c45fc9bc30413f5559986c77083efc.zip |
pictureflow update:
fix FS#8347 and FS#8425 - track order is incorrrect
also:
center the track list in the screen, and show the track number if its available
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17781 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugin.c | 6 | ||||
-rw-r--r-- | apps/plugin.h | 5 | ||||
-rw-r--r-- | apps/plugins/pictureflow.c | 58 |
3 files changed, 53 insertions, 16 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 21f6d178ea..bc1e8cbb7a 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -601,8 +601,10 @@ static const struct plugin_api rockbox_api = { | |||
601 | #endif | 601 | #endif |
602 | 602 | ||
603 | /* new stuff at the end, sort into place next time | 603 | /* new stuff at the end, sort into place next time |
604 | the API gets incompatible */ | 604 | the API gets incompatible */ |
605 | 605 | #ifdef HAVE_TAGCACHE | |
606 | tagcache_get_numeric, | ||
607 | #endif | ||
606 | }; | 608 | }; |
607 | 609 | ||
608 | int plugin_load(const char* plugin, const void* parameter) | 610 | int plugin_load(const char* plugin, const void* parameter) |
diff --git a/apps/plugin.h b/apps/plugin.h index 4be76adfd1..9bc009962c 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -124,7 +124,7 @@ void* plugin_get_buffer(size_t *buffer_size); | |||
124 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 124 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
125 | 125 | ||
126 | /* increase this every time the api struct changes */ | 126 | /* increase this every time the api struct changes */ |
127 | #define PLUGIN_API_VERSION 117 | 127 | #define PLUGIN_API_VERSION 118 |
128 | 128 | ||
129 | /* update this to latest version if a change to the api struct breaks | 129 | /* update this to latest version if a change to the api struct breaks |
130 | backwards compatibility (and please take the opportunity to sort in any | 130 | backwards compatibility (and please take the opportunity to sort in any |
@@ -753,6 +753,9 @@ struct plugin_api { | |||
753 | 753 | ||
754 | /* new stuff at the end, sort into place next time | 754 | /* new stuff at the end, sort into place next time |
755 | the API gets incompatible */ | 755 | the API gets incompatible */ |
756 | #ifdef HAVE_TAGCACHE | ||
757 | long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag); | ||
758 | #endif | ||
756 | 759 | ||
757 | }; | 760 | }; |
758 | 761 | ||
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index bea028eadc..53bcaa416b 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -419,33 +419,57 @@ int create_track_index(const int slide_index) | |||
419 | return -1; | 419 | return -1; |
420 | 420 | ||
421 | int ret = 0; | 421 | int ret = 0; |
422 | char temp_titles[MAX_TRACKS][AVG_TRACK_NAME_LENGTH*4]; | ||
423 | int temp_seeks[MAX_TRACKS]; | ||
422 | 424 | ||
423 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); | 425 | rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek); |
424 | track_count=0; | 426 | track_count=0; |
425 | int l, old_l = 0; | 427 | int string_index = 0; |
426 | tracks[0].name_idx = 0; | 428 | int l, track_num, heighest_index = 0; |
427 | 429 | ||
430 | for(l=0;l<MAX_TRACKS;l++) | ||
431 | temp_titles[l][0] = '\0'; | ||
428 | while (rb->tagcache_get_next(&tcs) && track_count < MAX_TRACKS) | 432 | while (rb->tagcache_get_next(&tcs) && track_count < MAX_TRACKS) |
429 | { | 433 | { |
430 | l = rb->strlen(tcs.result) + 1; | 434 | track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1; |
431 | if ( track_count > 0 ) | 435 | if (track_num >= 0) |
432 | tracks[track_count].name_idx = tracks[track_count-1].name_idx + old_l; | ||
433 | |||
434 | if ( (tracks[track_count].name_idx + l) > MAX_TRACKS * AVG_TRACK_NAME_LENGTH ) | ||
435 | { | 436 | { |
436 | /* not enough memory */ | 437 | rb->snprintf(temp_titles[track_num],sizeof(temp_titles[track_num]), "%d: %s", |
437 | ret = ERROR_BUFFER_FULL; | 438 | track_num+1, tcs.result); |
438 | break; | 439 | temp_seeks[track_num] = tcs.result_seek; |
439 | } | 440 | } |
440 | rb->strcpy(track_names + tracks[track_count].name_idx, tcs.result); | 441 | else |
441 | tracks[track_count].seek = tcs.result_seek; | 442 | { |
442 | old_l = l; | 443 | track_num = 0; |
444 | while (temp_titles[track_num][0] != '\0') | ||
445 | track_num++; | ||
446 | rb->strcpy(temp_titles[track_num], tcs.result); | ||
447 | temp_seeks[track_num] = tcs.result_seek; | ||
448 | } | ||
449 | if (track_num > heighest_index) | ||
450 | heighest_index = track_num; | ||
443 | track_count++; | 451 | track_count++; |
444 | } | 452 | } |
445 | 453 | ||
446 | rb->tagcache_search_finish(&tcs); | 454 | rb->tagcache_search_finish(&tcs); |
447 | track_index = slide_index; | 455 | track_index = slide_index; |
448 | 456 | ||
457 | /* now fix the track list order */ | ||
458 | l = 0; | ||
459 | track_count = 0; | ||
460 | while (l < heighest_index && | ||
461 | string_index < MAX_TRACKS*AVG_TRACK_NAME_LENGTH) | ||
462 | { | ||
463 | if (temp_titles[l][0] != '\0') | ||
464 | { | ||
465 | rb->strcpy(track_names + string_index, temp_titles[l]); | ||
466 | tracks[track_count].name_idx = string_index; | ||
467 | tracks[track_count].seek = temp_seeks[l]; | ||
468 | string_index += rb->strlen(temp_titles[l]) + 1; | ||
469 | track_count++; | ||
470 | } | ||
471 | l++; | ||
472 | } | ||
449 | if (ret != 0) | 473 | if (ret != 0) |
450 | return ret; | 474 | return ret; |
451 | else | 475 | else |
@@ -1759,6 +1783,14 @@ void show_track_list(void) | |||
1759 | } | 1783 | } |
1760 | static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color; | 1784 | static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color; |
1761 | titletxt_y = 0; | 1785 | titletxt_y = 0; |
1786 | if (track_list_visible_entries >= track_count) | ||
1787 | { | ||
1788 | int albumtxt_h; | ||
1789 | const char* albumtxt = get_album_name(center_index); | ||
1790 | rb->lcd_getstringsize(albumtxt, NULL, &albumtxt_h); | ||
1791 | titletxt_y = ((LCD_HEIGHT-albumtxt_h-10)-(track_count*albumtxt_h))/2; | ||
1792 | } | ||
1793 | |||
1762 | int track_i; | 1794 | int track_i; |
1763 | for (i=0; i < track_list_visible_entries; i++) { | 1795 | for (i=0; i < track_list_visible_entries; i++) { |
1764 | track_i = i+start_index_track_list; | 1796 | track_i = i+start_index_track_list; |