summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2008-06-24 10:20:22 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2008-06-24 10:20:22 +0000
commit8358dffd11c45fc9bc30413f5559986c77083efc (patch)
tree756cb923a4a14741cf32571d8fe29305979cb6df /apps
parente0b957fd5185bd957a6bd78c8d897255c1dc87e8 (diff)
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.c6
-rw-r--r--apps/plugin.h5
-rw-r--r--apps/plugins/pictureflow.c58
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 = {
#endif
/* 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)
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);
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* 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
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
the API gets incompatible */
+#ifdef HAVE_TAGCACHE
+ long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
+#endif
};
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)
return -1;
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);
track_count=0;
- int l, old_l = 0;
- tracks[0].name_idx = 0;
+ int string_index = 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)
{
- l = rb->strlen(tcs.result) + 1;
- if ( track_count > 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 )
+ track_num = rb->tagcache_get_numeric(&tcs, tag_tracknumber) - 1;
+ if (track_num >= 0)
{
- /* not enough memory */
- ret = ERROR_BUFFER_FULL;
- break;
+ rb->snprintf(temp_titles[track_num],sizeof(temp_titles[track_num]), "%d: %s",
+ track_num+1, tcs.result);
+ temp_seeks[track_num] = tcs.result_seek;
}
- rb->strcpy(track_names + tracks[track_count].name_idx, tcs.result);
- tracks[track_count].seek = tcs.result_seek;
- old_l = l;
+ else
+ {
+ 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++;
}
rb->tagcache_search_finish(&tcs);
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)
return ret;
else
@@ -1759,6 +1783,14 @@ void show_track_list(void)
}
static int titletxt_w, titletxt_h, titletxt_y, titletxt_x, i, color;
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;
for (i=0; i < track_list_visible_entries; i++) {
track_i = i+start_index_track_list;