forked from len0rd/rockbox
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
This commit is contained in:
parent
e0b957fd51
commit
8358dffd11
3 changed files with 53 additions and 16 deletions
|
@ -601,8 +601,10 @@ static const struct plugin_api rockbox_api = {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
#ifdef HAVE_TAGCACHE
|
||||||
|
tagcache_get_numeric,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
int plugin_load(const char* plugin, const void* parameter)
|
int plugin_load(const char* plugin, const void* parameter)
|
||||||
|
|
|
@ -124,7 +124,7 @@ void* plugin_get_buffer(size_t *buffer_size);
|
||||||
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
||||||
|
|
||||||
/* increase this every time the api struct changes */
|
/* increase this every time the api struct changes */
|
||||||
#define PLUGIN_API_VERSION 117
|
#define PLUGIN_API_VERSION 118
|
||||||
|
|
||||||
/* update this to latest version if a change to the api struct breaks
|
/* update this to latest version if a change to the api struct breaks
|
||||||
backwards compatibility (and please take the opportunity to sort in any
|
backwards compatibility (and please take the opportunity to sort in any
|
||||||
|
@ -753,6 +753,9 @@ struct plugin_api {
|
||||||
|
|
||||||
/* new stuff at the end, sort into place next time
|
/* new stuff at the end, sort into place next time
|
||||||
the API gets incompatible */
|
the API gets incompatible */
|
||||||
|
#ifdef HAVE_TAGCACHE
|
||||||
|
long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -419,33 +419,57 @@ int create_track_index(const int slide_index)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
char temp_titles[MAX_TRACKS][AVG_TRACK_NAME_LENGTH*4];
|
||||||
|
int temp_seeks[MAX_TRACKS];
|
||||||
|
|
||||||
rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek);
|
rb->tagcache_search_add_filter(&tcs, tag_album, album[slide_index].seek);
|
||||||
track_count=0;
|
track_count=0;
|
||||||
int l, old_l = 0;
|
int string_index = 0;
|
||||||
tracks[0].name_idx = 0;
|
int l, track_num, heighest_index = 0;
|
||||||
|
|
||||||
|
for(l=0;l<MAX_TRACKS;l++)
|
||||||
|
temp_titles[l][0] = '\0';
|
||||||
while (rb->tagcache_get_next(&tcs) && track_count < MAX_TRACKS)
|
while (rb->tagcache_get_next(&tcs) && track_count < MAX_TRACKS)
|
||||||
{
|
{
|
||||||
l = rb->strlen(tcs.result) + 1;
|
track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1;
|
||||||
if ( track_count > 0 )
|
if (track_num >= 0)
|
||||||
tracks[track_count].name_idx = tracks[track_count-1].name_idx + old_l;
|
|
||||||
|
|
||||||
if ( (tracks[track_count].name_idx + l) > MAX_TRACKS * AVG_TRACK_NAME_LENGTH )
|
|
||||||
{
|
{
|
||||||
/* not enough memory */
|
rb->snprintf(temp_titles[track_num],sizeof(temp_titles[track_num]), "%d: %s",
|
||||||
ret = ERROR_BUFFER_FULL;
|
track_num+1, tcs.result);
|
||||||
break;
|
temp_seeks[track_num] = tcs.result_seek;
|
||||||
}
|
}
|
||||||
rb->strcpy(track_names + tracks[track_count].name_idx, tcs.result);
|
else
|
||||||
tracks[track_count].seek = tcs.result_seek;
|
{
|
||||||
old_l = l;
|
track_num = 0;
|
||||||
|
while (temp_titles[track_num][0] != '\0')
|
||||||
|
track_num++;
|
||||||
|
rb->strcpy(temp_titles[track_num], tcs.result);
|
||||||
|
temp_seeks[track_num] = tcs.result_seek;
|
||||||
|
}
|
||||||
|
if (track_num > heighest_index)
|
||||||
|
heighest_index = track_num;
|
||||||
track_count++;
|
track_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
rb->tagcache_search_finish(&tcs);
|
rb->tagcache_search_finish(&tcs);
|
||||||
track_index = slide_index;
|
track_index = slide_index;
|
||||||
|
|
||||||
|
/* now fix the track list order */
|
||||||
|
l = 0;
|
||||||
|
track_count = 0;
|
||||||
|
while (l < heighest_index &&
|
||||||
|
string_index < MAX_TRACKS*AVG_TRACK_NAME_LENGTH)
|
||||||
|
{
|
||||||
|
if (temp_titles[l][0] != '\0')
|
||||||
|
{
|
||||||
|
rb->strcpy(track_names + string_index, temp_titles[l]);
|
||||||
|
tracks[track_count].name_idx = string_index;
|
||||||
|
tracks[track_count].seek = temp_seeks[l];
|
||||||
|
string_index += rb->strlen(temp_titles[l]) + 1;
|
||||||
|
track_count++;
|
||||||
|
}
|
||||||
|
l++;
|
||||||
|
}
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
else
|
else
|
||||||
|
@ -1759,6 +1783,14 @@ void show_track_list(void)
|
||||||
}
|
}
|
||||||
static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color;
|
static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color;
|
||||||
titletxt_y = 0;
|
titletxt_y = 0;
|
||||||
|
if (track_list_visible_entries >= track_count)
|
||||||
|
{
|
||||||
|
int albumtxt_h;
|
||||||
|
const char* albumtxt = get_album_name(center_index);
|
||||||
|
rb->lcd_getstringsize(albumtxt, NULL, &albumtxt_h);
|
||||||
|
titletxt_y = ((LCD_HEIGHT-albumtxt_h-10)-(track_count*albumtxt_h))/2;
|
||||||
|
}
|
||||||
|
|
||||||
int track_i;
|
int track_i;
|
||||||
for (i=0; i < track_list_visible_entries; i++) {
|
for (i=0; i < track_list_visible_entries; i++) {
|
||||||
track_i = i+start_index_track_list;
|
track_i = i+start_index_track_list;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue