1
0
Fork 0
forked from len0rd/rockbox

added support remote support for the id3 infos screen (had to slightly change the list engine to use it here as well), corrected a mistake in the french translation

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10175 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Kevin Ferrare 2006-07-02 12:28:27 +00:00
parent 31c7a453e1
commit f77ac7a6a7
9 changed files with 188 additions and 230 deletions

View file

@ -47,7 +47,9 @@ static bool offset_out_of_view = false;
void gui_list_init(struct gui_list * gui_list, void gui_list_init(struct gui_list * gui_list,
list_get_name callback_get_item_name, list_get_name callback_get_item_name,
void * data void * data,
bool scroll_all,
int selected_size
) )
{ {
gui_list->callback_get_item_icon = NULL; gui_list->callback_get_item_icon = NULL;
@ -62,6 +64,8 @@ void gui_list_init(struct gui_list * gui_list,
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
gui_list->offset_position = 0; gui_list->offset_position = 0;
#endif #endif
gui_list->scroll_all=scroll_all;
gui_list->selected_size=selected_size;
} }
void gui_list_set_display(struct gui_list * gui_list, struct screen * display) void gui_list_set_display(struct gui_list * gui_list, struct screen * display)
@ -212,8 +216,8 @@ void gui_list_draw(struct gui_list * gui_list)
item_offset = gui_list->offset_position; item_offset = gui_list->offset_position;
#endif #endif
if(current_item == gui_list->selected_item) { if(current_item >= gui_list->selected_item && current_item < gui_list->selected_item+gui_list->selected_size)
/* The selected item must be displayed scrolling */ {/* The selected item must be displayed scrolling */
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (global_settings.invert_cursor)/* Display inverted-line-style*/ if (global_settings.invert_cursor)/* Display inverted-line-style*/
/* if text got out of view */ /* if text got out of view */
@ -237,11 +241,22 @@ void gui_list_draw(struct gui_list * gui_list)
} }
else else
{/* normal item */ {/* normal item */
if(gui_list->scroll_all)
{
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
display->puts_offset(0, i, entry_name,item_offset); display->puts_scroll_offset(0, i, entry_name,item_offset);
#else #else
display->puts(text_pos, i, entry_name); display->puts_scroll(text_pos, i, entry_name);
#endif #endif
}
else
{
#ifdef HAVE_LCD_BITMAP
display->puts_offset(0, i, entry_name,item_offset);
#else
display->puts(text_pos, i, entry_name);
#endif
}
} }
/* Icons display */ /* Icons display */
if(draw_icons) if(draw_icons)
@ -280,29 +295,26 @@ void gui_list_select_item(struct gui_list * gui_list, int item_number)
void gui_list_select_next(struct gui_list * gui_list) void gui_list_select_next(struct gui_list * gui_list)
{ {
int item_pos; if( gui_list->selected_item+gui_list->selected_size >= gui_list->nb_items )
int end_item;
if( gui_list->selected_item == gui_list->nb_items-1 )
{ {
if(gui_list->limit_scroll) if(gui_list->limit_scroll)
return; return;
gui_list->selected_item++;
/* we have already reached the bottom of the list */ /* we have already reached the bottom of the list */
gui_list->selected_item = 0; gui_list->selected_item = 0;
gui_list->start_item = 0; gui_list->start_item = 0;
} }
else else
{ {
gui_list->selected_item+=gui_list->selected_size;
int nb_lines = gui_list->display->nb_lines; int nb_lines = gui_list->display->nb_lines;
gui_list->selected_item++; int item_pos = gui_list->selected_item - gui_list->start_item;
item_pos = gui_list->selected_item - gui_list->start_item; int end_item = gui_list->start_item + nb_lines;
end_item = gui_list->start_item + nb_lines;
if (global_settings.scroll_paginated) if (global_settings.scroll_paginated)
{ {
/* When we reach the bottom of the list /* When we reach the bottom of the list
* we jump to a new page if there are more items*/ * we jump to a new page if there are more items*/
if( item_pos > nb_lines-1 && end_item < gui_list->nb_items ) if( item_pos > nb_lines-gui_list->selected_size && end_item < gui_list->nb_items )
{ {
gui_list->start_item = gui_list->selected_item; gui_list->start_item = gui_list->selected_item;
if ( gui_list->start_item > gui_list->nb_items-nb_lines ) if ( gui_list->start_item > gui_list->nb_items-nb_lines )
@ -315,22 +327,21 @@ void gui_list_select_next(struct gui_list * gui_list)
* (nb_lines-SCROLL_LIMIT) * (nb_lines-SCROLL_LIMIT)
* and when we are not in the last part of the list*/ * and when we are not in the last part of the list*/
if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items ) if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items )
gui_list->start_item++; gui_list->start_item+=gui_list->selected_size;
} }
} }
} }
void gui_list_select_previous(struct gui_list * gui_list) void gui_list_select_previous(struct gui_list * gui_list)
{ {
if( gui_list->selected_item == 0 ) if( gui_list->selected_item-gui_list->selected_size < 0 )
{ {
int nb_lines = gui_list->display->nb_lines; int nb_lines = gui_list->display->nb_lines;
if(gui_list->limit_scroll) if(gui_list->limit_scroll)
return; return;
gui_list->selected_item--;
/* we have aleady reached the top of the list */ /* we have aleady reached the top of the list */
int start; int start;
gui_list->selected_item = gui_list->nb_items-1; gui_list->selected_item = gui_list->nb_items-gui_list->selected_size;
start = gui_list->nb_items-nb_lines; start = gui_list->nb_items-nb_lines;
if( start < 0 ) if( start < 0 )
gui_list->start_item = 0; gui_list->start_item = 0;
@ -341,31 +352,31 @@ void gui_list_select_previous(struct gui_list * gui_list)
{ {
int item_pos; int item_pos;
int nb_lines = gui_list->display->nb_lines; int nb_lines = gui_list->display->nb_lines;
gui_list->selected_item--; gui_list->selected_item-=gui_list->selected_size;
item_pos = gui_list->selected_item - gui_list->start_item; item_pos = gui_list->selected_item - gui_list->start_item;
if (global_settings.scroll_paginated) if (global_settings.scroll_paginated)
{ {
/* When we reach the top of the list /* When we reach the top of the list
* we jump to a new page if there are more items*/ * we jump to a new page if there are more items*/
if( item_pos < 0 && gui_list->start_item > 0 ) if( item_pos < 0)
gui_list->start_item = gui_list->selected_item-nb_lines+1; gui_list->start_item = gui_list->selected_item-nb_lines+gui_list->selected_size;
if( gui_list->start_item < 0 )
gui_list->start_item = 0;
} }
else else
{ {
/* we start scrolling vertically when reaching the line /* we start scrolling vertically when reaching the line
* (nb_lines-SCROLL_LIMIT) * (nb_lines-SCROLL_LIMIT)
* and when we are not in the last part of the list*/ * and when we are not in the last part of the list*/
if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) if( item_pos < SCROLL_LIMIT-1)
gui_list->start_item--; gui_list->start_item-=gui_list->selected_size;
} }
if( gui_list->start_item < 0 )
gui_list->start_item = 0;
} }
} }
void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines) void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
{ {
if(gui_list->selected_item == gui_list->nb_items-1) if(gui_list->selected_item == gui_list->nb_items-gui_list->selected_size)
{ {
if(gui_list->limit_scroll) if(gui_list->limit_scroll)
return; return;
@ -373,6 +384,7 @@ void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
} }
else else
{ {
nb_lines-=nb_lines%gui_list->selected_size;
gui_list->selected_item += nb_lines; gui_list->selected_item += nb_lines;
if(gui_list->selected_item > gui_list->nb_items-1) if(gui_list->selected_item > gui_list->nb_items-1)
gui_list->selected_item = gui_list->nb_items-1; gui_list->selected_item = gui_list->nb_items-1;
@ -386,10 +398,11 @@ void gui_list_select_previous_page(struct gui_list * gui_list, int nb_lines)
{ {
if(gui_list->limit_scroll) if(gui_list->limit_scroll)
return; return;
gui_list->selected_item = gui_list->nb_items - 1; gui_list->selected_item = gui_list->nb_items - gui_list->selected_size;
} }
else else
{ {
nb_lines-=nb_lines%gui_list->selected_size;
gui_list->selected_item -= nb_lines; gui_list->selected_item -= nb_lines;
if(gui_list->selected_item < 0) if(gui_list->selected_item < 0)
gui_list->selected_item = 0; gui_list->selected_item = 0;
@ -467,7 +480,9 @@ void gui_list_screen_scroll_out_of_view(bool enable)
void gui_synclist_init( void gui_synclist_init(
struct gui_synclist * lists, struct gui_synclist * lists,
list_get_name callback_get_item_name, list_get_name callback_get_item_name,
void * data void * data,
bool scroll_all,
int selected_size
) )
{ {
int i; int i;
@ -475,7 +490,7 @@ void gui_synclist_init(
{ {
gui_list_init(&(lists->gui_list[i]), gui_list_init(&(lists->gui_list[i]),
callback_get_item_name, callback_get_item_name,
data); data, scroll_all, selected_size);
gui_list_set_display(&(lists->gui_list[i]), &(screens[i])); gui_list_set_display(&(lists->gui_list[i]), &(screens[i]));
} }
} }
@ -641,9 +656,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
case LIST_RC_PGRIGHT: case LIST_RC_PGRIGHT:
case LIST_RC_PGRIGHT | BUTTON_REPEAT: case LIST_RC_PGRIGHT | BUTTON_REPEAT:
#endif #endif
gui_synclist_scroll_right(lists); gui_synclist_scroll_right(lists);
gui_synclist_draw(lists); gui_synclist_draw(lists);
return true; return true;
#endif #endif
#ifdef LIST_PGLEFT #ifdef LIST_PGLEFT
@ -653,9 +668,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
case LIST_RC_PGLEFT: case LIST_RC_PGLEFT:
case LIST_RC_PGLEFT | BUTTON_REPEAT: case LIST_RC_PGLEFT | BUTTON_REPEAT:
#endif #endif
gui_synclist_scroll_left(lists); gui_synclist_scroll_left(lists);
gui_synclist_draw(lists); gui_synclist_draw(lists);
return true; return true;
#endif #endif
/* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen /* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen

View file

@ -147,6 +147,11 @@ struct gui_list
/* defines wether the list should stop when reaching the top/bottom /* defines wether the list should stop when reaching the top/bottom
* or should continue (by going to bottom/top) */ * or should continue (by going to bottom/top) */
bool limit_scroll; bool limit_scroll;
/* wether the text of the whole items of the list have to be
* scrolled or only for the selected item */
bool scroll_all;
/* the number of lines that are selected at the same time */
int selected_size;
/* The data that will be passed to the callback function YOU implement */ /* The data that will be passed to the callback function YOU implement */
void * data; void * data;
}; };
@ -162,7 +167,9 @@ struct gui_list
*/ */
extern void gui_list_init(struct gui_list * gui_list, extern void gui_list_init(struct gui_list * gui_list,
list_get_name callback_get_item_name, list_get_name callback_get_item_name,
void * data void * data,
bool scroll_all,
int selected_size
); );
/* /*
@ -329,7 +336,9 @@ struct gui_synclist
extern void gui_synclist_init( extern void gui_synclist_init(
struct gui_synclist * lists, struct gui_synclist * lists,
list_get_name callback_get_item_name, list_get_name callback_get_item_name,
void * data void * data,
bool scroll_all,
int selected_size
); );
extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items);
extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback);

View file

@ -5469,7 +5469,7 @@
*: "[Bitrate]" *: "[Bitrate]"
</source> </source>
<dest> <dest>
*: "[Fréquence]" *: "[Débit binaire]"
</dest> </dest>
<voice> <voice>
*: "" *: ""
@ -5511,7 +5511,7 @@
*: "[Frequency]" *: "[Frequency]"
</source> </source>
<dest> <dest>
*: "[Fréquence]" *: "[Échantillonnage]"
</dest> </dest>
<voice> <voice>
*: "" *: ""

View file

@ -96,7 +96,7 @@ int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, in
return -1; return -1;
menus[menu].items = (struct menu_item*)mitems; /* de-const */ menus[menu].items = (struct menu_item*)mitems; /* de-const */
gui_synclist_init(&(menus[menu].synclist), gui_synclist_init(&(menus[menu].synclist),
&menu_get_itemname, &menus[menu]); &menu_get_itemname, &menus[menu], false, 1);
gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL); gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL);
gui_synclist_set_nb_items(&(menus[menu].synclist), count); gui_synclist_set_nb_items(&(menus[menu].synclist), count);
menus[menu].callback = callback; menus[menu].callback = callback;

View file

@ -621,7 +621,7 @@ bool playlist_viewer_ex(char* filename)
if (!playlist_viewer_init(&viewer, filename, false)) if (!playlist_viewer_init(&viewer, filename, false))
goto exit; goto exit;
gui_synclist_init(&playlist_lists, playlist_callback_name, &viewer); gui_synclist_init(&playlist_lists, playlist_callback_name, &viewer, false, 1);
gui_synclist_set_icon_callback(&playlist_lists, gui_synclist_set_icon_callback(&playlist_lists,
global_settings.playlist_viewer_icons? global_settings.playlist_viewer_icons?
&playlist_callback_icons:NULL); &playlist_callback_icons:NULL);
@ -873,7 +873,7 @@ bool search_playlist(void)
} }
backlight_on(); backlight_on();
gui_synclist_init(&playlist_lists, playlist_search_callback_name, gui_synclist_init(&playlist_lists, playlist_search_callback_name,
found_indicies); found_indicies, false, 1);
gui_synclist_set_icon_callback(&playlist_lists, gui_synclist_set_icon_callback(&playlist_lists,
global_settings.playlist_viewer_icons? global_settings.playlist_viewer_icons?
&playlist_search_callback_icons:NULL); &playlist_search_callback_icons:NULL);

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/ * \/ \/ \/ \/ \/
* $Id$ * $Id$
* *
* Copyright (C) 2002 Bj<EFBFBD>n Stenberg * Copyright (C) 2002 Björn Stenberg
* *
* All files in this archive are subject to the GNU General Public License. * All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement. * See the file COPYING in the source tree root for full license agreement.
@ -488,7 +488,8 @@ struct plugin_api {
/* list */ /* list */
void (*gui_synclist_init)(struct gui_synclist * lists, void (*gui_synclist_init)(struct gui_synclist * lists,
list_get_name callback_get_item_name,void * data); list_get_name callback_get_item_name,void * data,
bool scroll_all,int selected_size);
void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback); void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback);
int (*gui_synclist_get_nb_items)(struct gui_synclist * lists); int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);

View file

@ -245,7 +245,7 @@ void save_changes(int overwrite)
void setup_lists(struct gui_synclist *lists, int sel) void setup_lists(struct gui_synclist *lists, int sel)
{ {
rb->gui_synclist_init(lists,list_get_name_cb,0); rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1);
rb->gui_synclist_set_icon_callback(lists,NULL); rb->gui_synclist_set_icon_callback(lists,NULL);
rb->gui_synclist_set_nb_items(lists,line_count); rb->gui_synclist_set_nb_items(lists,line_count);
rb->gui_synclist_limit_scroll(lists,true); rb->gui_synclist_limit_scroll(lists,true);

View file

@ -53,6 +53,7 @@
#include "quickscreen.h" #include "quickscreen.h"
#include "logo.h" #include "logo.h"
#include "pcmbuf.h" #include "pcmbuf.h"
#include "list.h"
#if defined(HAVE_LCD_BITMAP) #if defined(HAVE_LCD_BITMAP)
#include "widgets.h" #include "widgets.h"
@ -1006,189 +1007,127 @@ bool shutdown_screen(void)
} }
#endif #endif
int draw_id3_item(int line, int top, int header, const char* body)
{
if (line >= top)
{
#if defined(HAVE_LCD_BITMAP)
const int rows = LCD_HEIGHT / font_get(FONT_UI)->height;
#else
const int rows = 2;
#endif
int y = line - top;
if (y < rows)
{
lcd_puts(0, y, str(header));
}
if (++y < rows)
{
lcd_puts_scroll(0, y,
body ? (const unsigned char*) body : str(LANG_ID3_NO_INFO));
}
}
return line + 2;
}
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC
#define ID3_ITEMS 13 #define ID3_ITEMS 13
#else #else
#define ID3_ITEMS 11 #define ID3_ITEMS 11
#endif #endif
char * id3_get_info(int selected_item, void* data, char *buffer)
{
struct mp3entry* id3 =(struct mp3entry*)data;
int info_no=selected_item/2;
DEBUGF("%d : %d\n",info_no, selected_item);
if(!(selected_item%2))
{/* header */
int headers[]=
{
LANG_ID3_TITLE,
LANG_ID3_ARTIST,
LANG_ID3_ALBUM,
LANG_ID3_TRACKNUM,
LANG_ID3_GENRE,
LANG_ID3_YEAR,
LANG_ID3_LENGTH,
LANG_ID3_PLAYLIST,
LANG_ID3_BITRATE,
LANG_ID3_FRECUENCY,
#if CONFIG_CODEC == SWCODEC
LANG_ID3_TRACK_GAIN,
LANG_ID3_ALBUM_GAIN,
#endif
LANG_ID3_PATH,
};
return( str(headers[info_no]));
}
else
{/* data */
char * info=NULL;
switch(info_no)
{
case 0:/*LANG_ID3_TITLE*/
info=id3->title;
break;
case 1:/*LANG_ID3_ARTIST*/
info=id3->artist;
break;
case 2:/*LANG_ID3_ALBUM*/
info=id3->album;
break;
case 3:/*LANG_ID3_TRACKNUM*/
if (id3->track_string)
info = id3->track_string;
else if (id3->tracknum)
{
snprintf(buffer, MAX_PATH, "%d", id3->tracknum);
info = buffer;
}
break;
case 4:/*LANG_ID3_GENRE*/
info = id3_get_genre(id3);
break;
case 5:/*LANG_ID3_YEAR*/
if (id3->year_string)
info = id3->year_string;
else if (id3->year)
{
snprintf(buffer, MAX_PATH, "%d", id3->year);
info = buffer;
}
break;
case 6:/*LANG_ID3_LENGTH*/
gui_wps_format_time(buffer, MAX_PATH, id3->length);
info=buffer;
break;
case 7:/*LANG_ID3_PLAYLIST*/
snprintf(buffer, MAX_PATH, "%d/%d", playlist_get_display_index(),
playlist_amount());
info=buffer;
break;
case 8:/*LANG_ID3_BITRATE*/
snprintf(buffer, MAX_PATH, "%d kbps%s", id3->bitrate,
id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
info=buffer;
break;
case 9:/*LANG_ID3_FRECUENCY*/
snprintf(buffer, MAX_PATH, "%ld Hz", id3->frequency);
info=buffer;
break;
#if CONFIG_CODEC == SWCODEC
case 10:/*LANG_ID3_TRACK_GAIN*/
info=id3->track_gain_string;
break;
case 11:/*LANG_ID3_ALBUM_GAIN*/
info=id3->album_gain_string;
break;
case 12:/*LANG_ID3_PATH*/
#else
case 10:/*LANG_ID3_PATH*/
#endif
info=id3->path;
break;
}
if(info==NULL)
return(str(LANG_ID3_NO_INFO));
return(info);
}
}
bool browse_id3(void) bool browse_id3(void)
{ {
char buf[64]; struct gui_synclist id3_lists;
const struct mp3entry* id3 = audio_current_track(); struct mp3entry* id3 = audio_current_track();
#if defined(HAVE_LCD_BITMAP) int key;
const int y_margin = global_settings.statusbar ? STATUSBAR_HEIGHT : 0;
const int line_height = font_get(FONT_UI)->height;
const int rows = (LCD_HEIGHT - y_margin) / line_height;
const bool show_scrollbar = global_settings.scrollbar
&& (ID3_ITEMS * 2 > rows);
#else
const int rows = 2;
#endif
const int top_max = (ID3_ITEMS * 2) - (rows & ~1);
int top = 0;
int button;
bool exit = false;
if (!id3 || (!(audio_status() & AUDIO_STATUS_PLAY)))
{
return false;
}
#if defined(HAVE_LCD_BITMAP)
lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, y_margin);
#endif
while (!exit)
{
int line = 0;
int old_top = top;
char* body;
lcd_clear_display();
gui_syncstatusbar_draw(&statusbars, true);
line = draw_id3_item(line, top, LANG_ID3_TITLE, id3->title);
line = draw_id3_item(line, top, LANG_ID3_ARTIST, id3->artist);
line = draw_id3_item(line, top, LANG_ID3_ALBUM, id3->album);
if (id3->track_string)
{
body = id3->track_string;
}
else if (id3->tracknum)
{
snprintf(buf, sizeof(buf), "%d", id3->tracknum);
body = buf;
}
else
{
body = NULL;
}
line = draw_id3_item(line, top, LANG_ID3_TRACKNUM, body);
body = id3->genre_string ? id3->genre_string : id3_get_genre(id3);
line = draw_id3_item(line, top, LANG_ID3_GENRE, body);
if (id3->year_string)
{
body = id3->year_string;
}
else if (id3->year)
{
snprintf(buf, sizeof(buf), "%d", id3->year);
body = buf;
}
else
{
body = NULL;
}
line = draw_id3_item(line, top, LANG_ID3_YEAR, body);
gui_wps_format_time(buf, sizeof(buf), id3->length);
line = draw_id3_item(line, top, LANG_ID3_LENGTH, buf);
snprintf(buf, sizeof(buf), "%d/%d", playlist_get_display_index(),
playlist_amount());
line = draw_id3_item(line, top, LANG_ID3_PLAYLIST, buf);
snprintf(buf, sizeof(buf), "%d kbps%s", id3->bitrate,
id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
line = draw_id3_item(line, top, LANG_ID3_BITRATE, buf);
snprintf(buf, sizeof(buf), "%ld Hz", id3->frequency);
line = draw_id3_item(line, top, LANG_ID3_FRECUENCY, buf);
#if CONFIG_CODEC == SWCODEC
line = draw_id3_item(line, top, LANG_ID3_TRACK_GAIN,
id3->track_gain_string);
line = draw_id3_item(line, top, LANG_ID3_ALBUM_GAIN,
id3->album_gain_string);
#endif
line = draw_id3_item(line, top, LANG_ID3_PATH, id3->path);
#if defined(HAVE_LCD_BITMAP)
if (show_scrollbar)
{
scrollbar(0, y_margin, SCROLLBAR_WIDTH - 1, rows * line_height,
ID3_ITEMS * 2 + (rows & 1), top, top + rows, VERTICAL);
}
#endif
while (!exit && (top == old_top))
{
gui_syncstatusbar_draw(&statusbars, false);
lcd_update();
button = button_get_w_tmo(HZ / 2);
switch(button)
{
/* It makes more sense to have the keys mapped "backwards" when
* scrolling a list on the archos studios/players and the ipod.
*/
#if defined(HAVE_LCD_BITMAP) && !(CONFIG_KEYPAD == IPOD_4G_PAD)
case SETTINGS_INC:
case SETTINGS_INC | BUTTON_REPEAT:
#else
case SETTINGS_DEC:
#endif
if (top > 0)
{
top -= 2;
}
else if (!(button & BUTTON_REPEAT))
{
top = top_max;
}
break;
#if defined(HAVE_LCD_BITMAP) && !(CONFIG_KEYPAD == IPOD_4G_PAD)
case SETTINGS_DEC:
case SETTINGS_DEC | BUTTON_REPEAT:
#else
case SETTINGS_INC:
#endif
if (top < top_max)
{
top += 2;
}
else if (!(button & BUTTON_REPEAT))
{
top = 0;
}
break;
gui_synclist_init(&id3_lists, &id3_get_info, id3, true, 2);
gui_synclist_set_nb_items(&id3_lists, ID3_ITEMS*2);
gui_synclist_draw(&id3_lists);
while (true) {
key = button_get_w_tmo(HZ/2);
/* If moved, "say" the entry under the cursor */
gui_synclist_do_button(&id3_lists, key);
switch( key ) {
#ifdef SETTINGS_OK2 #ifdef SETTINGS_OK2
case SETTINGS_OK2: case SETTINGS_OK2:
#endif #endif
@ -1196,23 +1135,17 @@ bool browse_id3(void)
lcd_stop_scroll(); lcd_stop_scroll();
/* Eat release event */ /* Eat release event */
button_get(true); button_get(true);
exit = true; return(false);
break;
default: default:
if (default_event_handler(button) == SYS_USB_CONNECTED) if (default_event_handler(key) == SYS_USB_CONNECTED)
{
return true; return true;
}
break;
}
} }
gui_syncstatusbar_draw(&statusbars, false);
} }
return false;
} }
bool set_rating(void) bool set_rating(void)
{ {
struct mp3entry* id3 = audio_current_track(); struct mp3entry* id3 = audio_current_track();

View file

@ -248,7 +248,7 @@ void browse_root(void)
/* since archos only have one screen, no need to create more than that */ /* since archos only have one screen, no need to create more than that */
gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) ); gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) );
#endif #endif
gui_synclist_init(&tree_lists, &tree_get_filename, &tc); gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1);
gui_synclist_set_icon_callback(&tree_lists, gui_synclist_set_icon_callback(&tree_lists,
global_settings.show_icons?&tree_get_fileicon:NULL); global_settings.show_icons?&tree_get_fileicon:NULL);
#ifndef SIMULATOR #ifndef SIMULATOR