summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/pictureflow.c58
1 files changed, 45 insertions, 13 deletions
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;