summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ferrare <kevin@rockbox.org>2006-07-02 12:28:27 +0000
committerKevin Ferrare <kevin@rockbox.org>2006-07-02 12:28:27 +0000
commitf77ac7a6a7e19aa20bdeb10bd006ad1a8c147f76 (patch)
treee3d2b4912b5e810ec63f109bc112b1d05972d0e3
parent31c7a453e1b852c48a9429be3ad23d4e85a2945f (diff)
downloadrockbox-f77ac7a6a7e19aa20bdeb10bd006ad1a8c147f76.tar.gz
rockbox-f77ac7a6a7e19aa20bdeb10bd006ad1a8c147f76.zip
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
-rw-r--r--apps/gui/list.c85
-rw-r--r--apps/gui/list.h13
-rw-r--r--apps/lang/francais.lang4
-rw-r--r--apps/menu.c2
-rw-r--r--apps/playlist_viewer.c4
-rw-r--r--apps/plugin.h5
-rw-r--r--apps/plugins/text_editor.c2
-rw-r--r--apps/screens.c277
-rw-r--r--apps/tree.c2
9 files changed, 176 insertions, 218 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c
index ebc8115be0..5dff8dc1b2 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -47,7 +47,9 @@ static bool offset_out_of_view = false;
47 47
48void gui_list_init(struct gui_list * gui_list, 48void gui_list_init(struct gui_list * gui_list,
49 list_get_name callback_get_item_name, 49 list_get_name callback_get_item_name,
50 void * data 50 void * data,
51 bool scroll_all,
52 int selected_size
51 ) 53 )
52{ 54{
53 gui_list->callback_get_item_icon = NULL; 55 gui_list->callback_get_item_icon = NULL;
@@ -62,6 +64,8 @@ void gui_list_init(struct gui_list * gui_list,
62#ifdef HAVE_LCD_BITMAP 64#ifdef HAVE_LCD_BITMAP
63 gui_list->offset_position = 0; 65 gui_list->offset_position = 0;
64#endif 66#endif
67 gui_list->scroll_all=scroll_all;
68 gui_list->selected_size=selected_size;
65} 69}
66 70
67void gui_list_set_display(struct gui_list * gui_list, struct screen * display) 71void 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)
212 item_offset = gui_list->offset_position; 216 item_offset = gui_list->offset_position;
213 217
214#endif 218#endif
215 if(current_item == gui_list->selected_item) { 219 if(current_item >= gui_list->selected_item && current_item < gui_list->selected_item+gui_list->selected_size)
216 /* The selected item must be displayed scrolling */ 220 {/* The selected item must be displayed scrolling */
217#ifdef HAVE_LCD_BITMAP 221#ifdef HAVE_LCD_BITMAP
218 if (global_settings.invert_cursor)/* Display inverted-line-style*/ 222 if (global_settings.invert_cursor)/* Display inverted-line-style*/
219 /* if text got out of view */ 223 /* if text got out of view */
@@ -237,11 +241,22 @@ void gui_list_draw(struct gui_list * gui_list)
237 } 241 }
238 else 242 else
239 {/* normal item */ 243 {/* normal item */
244 if(gui_list->scroll_all)
245 {
246#ifdef HAVE_LCD_BITMAP
247 display->puts_scroll_offset(0, i, entry_name,item_offset);
248#else
249 display->puts_scroll(text_pos, i, entry_name);
250#endif
251 }
252 else
253 {
240#ifdef HAVE_LCD_BITMAP 254#ifdef HAVE_LCD_BITMAP
241 display->puts_offset(0, i, entry_name,item_offset); 255 display->puts_offset(0, i, entry_name,item_offset);
242#else 256#else
243 display->puts(text_pos, i, entry_name); 257 display->puts(text_pos, i, entry_name);
244#endif 258#endif
259 }
245 } 260 }
246 /* Icons display */ 261 /* Icons display */
247 if(draw_icons) 262 if(draw_icons)
@@ -280,29 +295,26 @@ void gui_list_select_item(struct gui_list * gui_list, int item_number)
280 295
281void gui_list_select_next(struct gui_list * gui_list) 296void gui_list_select_next(struct gui_list * gui_list)
282{ 297{
283 int item_pos; 298 if( gui_list->selected_item+gui_list->selected_size >= gui_list->nb_items )
284 int end_item;
285
286 if( gui_list->selected_item == gui_list->nb_items-1 )
287 { 299 {
288 if(gui_list->limit_scroll) 300 if(gui_list->limit_scroll)
289 return; 301 return;
290 gui_list->selected_item++;
291 /* we have already reached the bottom of the list */ 302 /* we have already reached the bottom of the list */
292 gui_list->selected_item = 0; 303 gui_list->selected_item = 0;
293 gui_list->start_item = 0; 304 gui_list->start_item = 0;
294 } 305 }
295 else 306 else
296 { 307 {
308 gui_list->selected_item+=gui_list->selected_size;
297 int nb_lines = gui_list->display->nb_lines; 309 int nb_lines = gui_list->display->nb_lines;
298 gui_list->selected_item++; 310 int item_pos = gui_list->selected_item - gui_list->start_item;
299 item_pos = gui_list->selected_item - gui_list->start_item; 311 int end_item = gui_list->start_item + nb_lines;
300 end_item = gui_list->start_item + nb_lines; 312
301 if (global_settings.scroll_paginated) 313 if (global_settings.scroll_paginated)
302 { 314 {
303 /* When we reach the bottom of the list 315 /* When we reach the bottom of the list
304 * we jump to a new page if there are more items*/ 316 * we jump to a new page if there are more items*/
305 if( item_pos > nb_lines-1 && end_item < gui_list->nb_items ) 317 if( item_pos > nb_lines-gui_list->selected_size && end_item < gui_list->nb_items )
306 { 318 {
307 gui_list->start_item = gui_list->selected_item; 319 gui_list->start_item = gui_list->selected_item;
308 if ( gui_list->start_item > gui_list->nb_items-nb_lines ) 320 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)
315 * (nb_lines-SCROLL_LIMIT) 327 * (nb_lines-SCROLL_LIMIT)
316 * and when we are not in the last part of the list*/ 328 * and when we are not in the last part of the list*/
317 if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items ) 329 if( item_pos > nb_lines-SCROLL_LIMIT && end_item < gui_list->nb_items )
318 gui_list->start_item++; 330 gui_list->start_item+=gui_list->selected_size;
319 } 331 }
320 } 332 }
321} 333}
322 334
323void gui_list_select_previous(struct gui_list * gui_list) 335void gui_list_select_previous(struct gui_list * gui_list)
324{ 336{
325 if( gui_list->selected_item == 0 ) 337 if( gui_list->selected_item-gui_list->selected_size < 0 )
326 { 338 {
327 int nb_lines = gui_list->display->nb_lines; 339 int nb_lines = gui_list->display->nb_lines;
328 if(gui_list->limit_scroll) 340 if(gui_list->limit_scroll)
329 return; 341 return;
330 gui_list->selected_item--;
331 /* we have aleady reached the top of the list */ 342 /* we have aleady reached the top of the list */
332 int start; 343 int start;
333 gui_list->selected_item = gui_list->nb_items-1; 344 gui_list->selected_item = gui_list->nb_items-gui_list->selected_size;
334 start = gui_list->nb_items-nb_lines; 345 start = gui_list->nb_items-nb_lines;
335 if( start < 0 ) 346 if( start < 0 )
336 gui_list->start_item = 0; 347 gui_list->start_item = 0;
@@ -341,31 +352,31 @@ void gui_list_select_previous(struct gui_list * gui_list)
341 { 352 {
342 int item_pos; 353 int item_pos;
343 int nb_lines = gui_list->display->nb_lines; 354 int nb_lines = gui_list->display->nb_lines;
344 gui_list->selected_item--; 355 gui_list->selected_item-=gui_list->selected_size;
345 item_pos = gui_list->selected_item - gui_list->start_item; 356 item_pos = gui_list->selected_item - gui_list->start_item;
346 if (global_settings.scroll_paginated) 357 if (global_settings.scroll_paginated)
347 { 358 {
348 /* When we reach the top of the list 359 /* When we reach the top of the list
349 * we jump to a new page if there are more items*/ 360 * we jump to a new page if there are more items*/
350 if( item_pos < 0 && gui_list->start_item > 0 ) 361 if( item_pos < 0)
351 gui_list->start_item = gui_list->selected_item-nb_lines+1; 362 gui_list->start_item = gui_list->selected_item-nb_lines+gui_list->selected_size;
352 if( gui_list->start_item < 0 )
353 gui_list->start_item = 0;
354 } 363 }
355 else 364 else
356 { 365 {
357 /* we start scrolling vertically when reaching the line 366 /* we start scrolling vertically when reaching the line
358 * (nb_lines-SCROLL_LIMIT) 367 * (nb_lines-SCROLL_LIMIT)
359 * and when we are not in the last part of the list*/ 368 * and when we are not in the last part of the list*/
360 if( item_pos < SCROLL_LIMIT-1 && gui_list->start_item > 0 ) 369 if( item_pos < SCROLL_LIMIT-1)
361 gui_list->start_item--; 370 gui_list->start_item-=gui_list->selected_size;
362 } 371 }
372 if( gui_list->start_item < 0 )
373 gui_list->start_item = 0;
363 } 374 }
364} 375}
365 376
366void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines) 377void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
367{ 378{
368 if(gui_list->selected_item == gui_list->nb_items-1) 379 if(gui_list->selected_item == gui_list->nb_items-gui_list->selected_size)
369 { 380 {
370 if(gui_list->limit_scroll) 381 if(gui_list->limit_scroll)
371 return; 382 return;
@@ -373,6 +384,7 @@ void gui_list_select_next_page(struct gui_list * gui_list, int nb_lines)
373 } 384 }
374 else 385 else
375 { 386 {
387 nb_lines-=nb_lines%gui_list->selected_size;
376 gui_list->selected_item += nb_lines; 388 gui_list->selected_item += nb_lines;
377 if(gui_list->selected_item > gui_list->nb_items-1) 389 if(gui_list->selected_item > gui_list->nb_items-1)
378 gui_list->selected_item = gui_list->nb_items-1; 390 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)
386 { 398 {
387 if(gui_list->limit_scroll) 399 if(gui_list->limit_scroll)
388 return; 400 return;
389 gui_list->selected_item = gui_list->nb_items - 1; 401 gui_list->selected_item = gui_list->nb_items - gui_list->selected_size;
390 } 402 }
391 else 403 else
392 { 404 {
405 nb_lines-=nb_lines%gui_list->selected_size;
393 gui_list->selected_item -= nb_lines; 406 gui_list->selected_item -= nb_lines;
394 if(gui_list->selected_item < 0) 407 if(gui_list->selected_item < 0)
395 gui_list->selected_item = 0; 408 gui_list->selected_item = 0;
@@ -467,7 +480,9 @@ void gui_list_screen_scroll_out_of_view(bool enable)
467void gui_synclist_init( 480void gui_synclist_init(
468 struct gui_synclist * lists, 481 struct gui_synclist * lists,
469 list_get_name callback_get_item_name, 482 list_get_name callback_get_item_name,
470 void * data 483 void * data,
484 bool scroll_all,
485 int selected_size
471 ) 486 )
472{ 487{
473 int i; 488 int i;
@@ -475,7 +490,7 @@ void gui_synclist_init(
475 { 490 {
476 gui_list_init(&(lists->gui_list[i]), 491 gui_list_init(&(lists->gui_list[i]),
477 callback_get_item_name, 492 callback_get_item_name,
478 data); 493 data, scroll_all, selected_size);
479 gui_list_set_display(&(lists->gui_list[i]), &(screens[i])); 494 gui_list_set_display(&(lists->gui_list[i]), &(screens[i]));
480 } 495 }
481} 496}
@@ -641,9 +656,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
641 case LIST_RC_PGRIGHT: 656 case LIST_RC_PGRIGHT:
642 case LIST_RC_PGRIGHT | BUTTON_REPEAT: 657 case LIST_RC_PGRIGHT | BUTTON_REPEAT:
643#endif 658#endif
644 gui_synclist_scroll_right(lists); 659 gui_synclist_scroll_right(lists);
645 gui_synclist_draw(lists); 660 gui_synclist_draw(lists);
646 return true; 661 return true;
647#endif 662#endif
648 663
649#ifdef LIST_PGLEFT 664#ifdef LIST_PGLEFT
@@ -653,9 +668,9 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button)
653 case LIST_RC_PGLEFT: 668 case LIST_RC_PGLEFT:
654 case LIST_RC_PGLEFT | BUTTON_REPEAT: 669 case LIST_RC_PGLEFT | BUTTON_REPEAT:
655#endif 670#endif
656 gui_synclist_scroll_left(lists); 671 gui_synclist_scroll_left(lists);
657 gui_synclist_draw(lists); 672 gui_synclist_draw(lists);
658 return true; 673 return true;
659#endif 674#endif
660 675
661/* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen 676/* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen
diff --git a/apps/gui/list.h b/apps/gui/list.h
index 5658a1cd62..60a3651259 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -147,6 +147,11 @@ struct gui_list
147 /* defines wether the list should stop when reaching the top/bottom 147 /* defines wether the list should stop when reaching the top/bottom
148 * or should continue (by going to bottom/top) */ 148 * or should continue (by going to bottom/top) */
149 bool limit_scroll; 149 bool limit_scroll;
150 /* wether the text of the whole items of the list have to be
151 * scrolled or only for the selected item */
152 bool scroll_all;
153 /* the number of lines that are selected at the same time */
154 int selected_size;
150 /* The data that will be passed to the callback function YOU implement */ 155 /* The data that will be passed to the callback function YOU implement */
151 void * data; 156 void * data;
152}; 157};
@@ -162,7 +167,9 @@ struct gui_list
162 */ 167 */
163extern void gui_list_init(struct gui_list * gui_list, 168extern void gui_list_init(struct gui_list * gui_list,
164 list_get_name callback_get_item_name, 169 list_get_name callback_get_item_name,
165 void * data 170 void * data,
171 bool scroll_all,
172 int selected_size
166 ); 173 );
167 174
168/* 175/*
@@ -329,7 +336,9 @@ struct gui_synclist
329extern void gui_synclist_init( 336extern void gui_synclist_init(
330 struct gui_synclist * lists, 337 struct gui_synclist * lists,
331 list_get_name callback_get_item_name, 338 list_get_name callback_get_item_name,
332 void * data 339 void * data,
340 bool scroll_all,
341 int selected_size
333 ); 342 );
334extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items); 343extern void gui_synclist_set_nb_items(struct gui_synclist * lists, int nb_items);
335extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback); 344extern void gui_synclist_set_icon_callback(struct gui_synclist * lists, list_get_icon icon_callback);
diff --git a/apps/lang/francais.lang b/apps/lang/francais.lang
index 17f6354501..22391f0858 100644
--- a/apps/lang/francais.lang
+++ b/apps/lang/francais.lang
@@ -5469,7 +5469,7 @@
5469 *: "[Bitrate]" 5469 *: "[Bitrate]"
5470 </source> 5470 </source>
5471 <dest> 5471 <dest>
5472 *: "[Fréquence]" 5472 *: "[Débit binaire]"
5473 </dest> 5473 </dest>
5474 <voice> 5474 <voice>
5475 *: "" 5475 *: ""
@@ -5511,7 +5511,7 @@
5511 *: "[Frequency]" 5511 *: "[Frequency]"
5512 </source> 5512 </source>
5513 <dest> 5513 <dest>
5514 *: "[Fréquence]" 5514 *: "[Ãchantillonnage]"
5515 </dest> 5515 </dest>
5516 <voice> 5516 <voice>
5517 *: "" 5517 *: ""
diff --git a/apps/menu.c b/apps/menu.c
index 26df94b5a7..f67c0633c6 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -96,7 +96,7 @@ int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, in
96 return -1; 96 return -1;
97 menus[menu].items = (struct menu_item*)mitems; /* de-const */ 97 menus[menu].items = (struct menu_item*)mitems; /* de-const */
98 gui_synclist_init(&(menus[menu].synclist), 98 gui_synclist_init(&(menus[menu].synclist),
99 &menu_get_itemname, &menus[menu]); 99 &menu_get_itemname, &menus[menu], false, 1);
100 gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL); 100 gui_synclist_set_icon_callback(&(menus[menu].synclist), NULL);
101 gui_synclist_set_nb_items(&(menus[menu].synclist), count); 101 gui_synclist_set_nb_items(&(menus[menu].synclist), count);
102 menus[menu].callback = callback; 102 menus[menu].callback = callback;
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 640063bb64..087bdd1583 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -621,7 +621,7 @@ bool playlist_viewer_ex(char* filename)
621 if (!playlist_viewer_init(&viewer, filename, false)) 621 if (!playlist_viewer_init(&viewer, filename, false))
622 goto exit; 622 goto exit;
623 623
624 gui_synclist_init(&playlist_lists, playlist_callback_name, &viewer); 624 gui_synclist_init(&playlist_lists, playlist_callback_name, &viewer, false, 1);
625 gui_synclist_set_icon_callback(&playlist_lists, 625 gui_synclist_set_icon_callback(&playlist_lists,
626 global_settings.playlist_viewer_icons? 626 global_settings.playlist_viewer_icons?
627 &playlist_callback_icons:NULL); 627 &playlist_callback_icons:NULL);
@@ -873,7 +873,7 @@ bool search_playlist(void)
873 } 873 }
874 backlight_on(); 874 backlight_on();
875 gui_synclist_init(&playlist_lists, playlist_search_callback_name, 875 gui_synclist_init(&playlist_lists, playlist_search_callback_name,
876 found_indicies); 876 found_indicies, false, 1);
877 gui_synclist_set_icon_callback(&playlist_lists, 877 gui_synclist_set_icon_callback(&playlist_lists,
878 global_settings.playlist_viewer_icons? 878 global_settings.playlist_viewer_icons?
879 &playlist_search_callback_icons:NULL); 879 &playlist_search_callback_icons:NULL);
diff --git a/apps/plugin.h b/apps/plugin.h
index f27654049b..1429e83847 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Bj�n Stenberg 10 * Copyright (C) 2002 Björn Stenberg
11 * 11 *
12 * All files in this archive are subject to the GNU General Public License. 12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement. 13 * See the file COPYING in the source tree root for full license agreement.
@@ -488,7 +488,8 @@ struct plugin_api {
488 488
489 /* list */ 489 /* list */
490 void (*gui_synclist_init)(struct gui_synclist * lists, 490 void (*gui_synclist_init)(struct gui_synclist * lists,
491 list_get_name callback_get_item_name,void * data); 491 list_get_name callback_get_item_name,void * data,
492 bool scroll_all,int selected_size);
492 void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); 493 void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
493 void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback); 494 void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback);
494 int (*gui_synclist_get_nb_items)(struct gui_synclist * lists); 495 int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c
index 5abd48485f..01af458654 100644
--- a/apps/plugins/text_editor.c
+++ b/apps/plugins/text_editor.c
@@ -245,7 +245,7 @@ void save_changes(int overwrite)
245 245
246void setup_lists(struct gui_synclist *lists, int sel) 246void setup_lists(struct gui_synclist *lists, int sel)
247{ 247{
248 rb->gui_synclist_init(lists,list_get_name_cb,0); 248 rb->gui_synclist_init(lists,list_get_name_cb,0, false, 1);
249 rb->gui_synclist_set_icon_callback(lists,NULL); 249 rb->gui_synclist_set_icon_callback(lists,NULL);
250 rb->gui_synclist_set_nb_items(lists,line_count); 250 rb->gui_synclist_set_nb_items(lists,line_count);
251 rb->gui_synclist_limit_scroll(lists,true); 251 rb->gui_synclist_limit_scroll(lists,true);
diff --git a/apps/screens.c b/apps/screens.c
index 51201525d4..99f23c55af 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -53,6 +53,7 @@
53#include "quickscreen.h" 53#include "quickscreen.h"
54#include "logo.h" 54#include "logo.h"
55#include "pcmbuf.h" 55#include "pcmbuf.h"
56#include "list.h"
56 57
57#if defined(HAVE_LCD_BITMAP) 58#if defined(HAVE_LCD_BITMAP)
58#include "widgets.h" 59#include "widgets.h"
@@ -1006,189 +1007,127 @@ bool shutdown_screen(void)
1006} 1007}
1007#endif 1008#endif
1008 1009
1009int draw_id3_item(int line, int top, int header, const char* body)
1010{
1011 if (line >= top)
1012 {
1013#if defined(HAVE_LCD_BITMAP)
1014 const int rows = LCD_HEIGHT / font_get(FONT_UI)->height;
1015#else
1016 const int rows = 2;
1017#endif
1018 int y = line - top;
1019
1020 if (y < rows)
1021 {
1022 lcd_puts(0, y, str(header));
1023 }
1024
1025 if (++y < rows)
1026 {
1027 lcd_puts_scroll(0, y,
1028 body ? (const unsigned char*) body : str(LANG_ID3_NO_INFO));
1029 }
1030 }
1031
1032 return line + 2;
1033}
1034
1035#if CONFIG_CODEC == SWCODEC 1010#if CONFIG_CODEC == SWCODEC
1036#define ID3_ITEMS 13 1011#define ID3_ITEMS 13
1037#else 1012#else
1038#define ID3_ITEMS 11 1013#define ID3_ITEMS 11
1039#endif 1014#endif
1040 1015
1041bool browse_id3(void) 1016char * id3_get_info(int selected_item, void* data, char *buffer)
1042{ 1017{
1043 char buf[64]; 1018 struct mp3entry* id3 =(struct mp3entry*)data;
1044 const struct mp3entry* id3 = audio_current_track(); 1019 int info_no=selected_item/2;
1045#if defined(HAVE_LCD_BITMAP) 1020 DEBUGF("%d : %d\n",info_no, selected_item);
1046 const int y_margin = global_settings.statusbar ? STATUSBAR_HEIGHT : 0; 1021 if(!(selected_item%2))
1047 const int line_height = font_get(FONT_UI)->height; 1022 {/* header */
1048 const int rows = (LCD_HEIGHT - y_margin) / line_height; 1023 int headers[]=
1049 const bool show_scrollbar = global_settings.scrollbar
1050 && (ID3_ITEMS * 2 > rows);
1051#else
1052 const int rows = 2;
1053#endif
1054 const int top_max = (ID3_ITEMS * 2) - (rows & ~1);
1055 int top = 0;
1056 int button;
1057 bool exit = false;
1058
1059 if (!id3 || (!(audio_status() & AUDIO_STATUS_PLAY)))
1060 {
1061 return false;
1062 }
1063
1064#if defined(HAVE_LCD_BITMAP)
1065 lcd_setmargins(show_scrollbar ? SCROLLBAR_WIDTH : 0, y_margin);
1066#endif
1067
1068 while (!exit)
1069 {
1070 int line = 0;
1071 int old_top = top;
1072 char* body;
1073
1074 lcd_clear_display();
1075 gui_syncstatusbar_draw(&statusbars, true);
1076 line = draw_id3_item(line, top, LANG_ID3_TITLE, id3->title);
1077 line = draw_id3_item(line, top, LANG_ID3_ARTIST, id3->artist);
1078 line = draw_id3_item(line, top, LANG_ID3_ALBUM, id3->album);
1079
1080 if (id3->track_string)
1081 {
1082 body = id3->track_string;
1083 }
1084 else if (id3->tracknum)
1085 { 1024 {
1086 snprintf(buf, sizeof(buf), "%d", id3->tracknum); 1025 LANG_ID3_TITLE,
1087 body = buf; 1026 LANG_ID3_ARTIST,
1088 } 1027 LANG_ID3_ALBUM,
1089 else 1028 LANG_ID3_TRACKNUM,
1090 { 1029 LANG_ID3_GENRE,
1091 body = NULL; 1030 LANG_ID3_YEAR,
1092 } 1031 LANG_ID3_LENGTH,
1093 1032 LANG_ID3_PLAYLIST,
1094 line = draw_id3_item(line, top, LANG_ID3_TRACKNUM, body); 1033 LANG_ID3_BITRATE,
1095 1034 LANG_ID3_FRECUENCY,
1096 body = id3->genre_string ? id3->genre_string : id3_get_genre(id3);
1097 line = draw_id3_item(line, top, LANG_ID3_GENRE, body);
1098
1099 if (id3->year_string)
1100 {
1101 body = id3->year_string;
1102 }
1103 else if (id3->year)
1104 {
1105 snprintf(buf, sizeof(buf), "%d", id3->year);
1106 body = buf;
1107 }
1108 else
1109 {
1110 body = NULL;
1111 }
1112
1113 line = draw_id3_item(line, top, LANG_ID3_YEAR, body);
1114
1115 gui_wps_format_time(buf, sizeof(buf), id3->length);
1116 line = draw_id3_item(line, top, LANG_ID3_LENGTH, buf);
1117
1118 snprintf(buf, sizeof(buf), "%d/%d", playlist_get_display_index(),
1119 playlist_amount());
1120 line = draw_id3_item(line, top, LANG_ID3_PLAYLIST, buf);
1121
1122 snprintf(buf, sizeof(buf), "%d kbps%s", id3->bitrate,
1123 id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
1124 line = draw_id3_item(line, top, LANG_ID3_BITRATE, buf);
1125
1126 snprintf(buf, sizeof(buf), "%ld Hz", id3->frequency);
1127 line = draw_id3_item(line, top, LANG_ID3_FRECUENCY, buf);
1128
1129#if CONFIG_CODEC == SWCODEC 1035#if CONFIG_CODEC == SWCODEC
1130 line = draw_id3_item(line, top, LANG_ID3_TRACK_GAIN, 1036 LANG_ID3_TRACK_GAIN,
1131 id3->track_gain_string); 1037 LANG_ID3_ALBUM_GAIN,
1132
1133 line = draw_id3_item(line, top, LANG_ID3_ALBUM_GAIN,
1134 id3->album_gain_string);
1135#endif
1136
1137 line = draw_id3_item(line, top, LANG_ID3_PATH, id3->path);
1138
1139#if defined(HAVE_LCD_BITMAP)
1140 if (show_scrollbar)
1141 {
1142 scrollbar(0, y_margin, SCROLLBAR_WIDTH - 1, rows * line_height,
1143 ID3_ITEMS * 2 + (rows & 1), top, top + rows, VERTICAL);
1144 }
1145#endif 1038#endif
1039 LANG_ID3_PATH,
1040 };
1041 return( str(headers[info_no]));
1042 }
1043 else
1044 {/* data */
1146 1045
1147 while (!exit && (top == old_top)) 1046 char * info=NULL;
1047 switch(info_no)
1148 { 1048 {
1149 gui_syncstatusbar_draw(&statusbars, false); 1049 case 0:/*LANG_ID3_TITLE*/
1150 lcd_update(); 1050 info=id3->title;
1151 button = button_get_w_tmo(HZ / 2); 1051 break;
1152 1052 case 1:/*LANG_ID3_ARTIST*/
1153 switch(button) 1053 info=id3->artist;
1154 { 1054 break;
1155 /* It makes more sense to have the keys mapped "backwards" when 1055 case 2:/*LANG_ID3_ALBUM*/
1156 * scrolling a list on the archos studios/players and the ipod. 1056 info=id3->album;
1157 */ 1057 break;
1158#if defined(HAVE_LCD_BITMAP) && !(CONFIG_KEYPAD == IPOD_4G_PAD) 1058 case 3:/*LANG_ID3_TRACKNUM*/
1159 case SETTINGS_INC: 1059 if (id3->track_string)
1160 case SETTINGS_INC | BUTTON_REPEAT: 1060 info = id3->track_string;
1161#else 1061 else if (id3->tracknum)
1162 case SETTINGS_DEC:
1163#endif
1164 if (top > 0)
1165 { 1062 {
1166 top -= 2; 1063 snprintf(buffer, MAX_PATH, "%d", id3->tracknum);
1064 info = buffer;
1167 } 1065 }
1168 else if (!(button & BUTTON_REPEAT)) 1066 break;
1067 case 4:/*LANG_ID3_GENRE*/
1068 info = id3_get_genre(id3);
1069 break;
1070 case 5:/*LANG_ID3_YEAR*/
1071 if (id3->year_string)
1072 info = id3->year_string;
1073 else if (id3->year)
1169 { 1074 {
1170 top = top_max; 1075 snprintf(buffer, MAX_PATH, "%d", id3->year);
1076 info = buffer;
1171 } 1077 }
1172
1173 break; 1078 break;
1174 1079 case 6:/*LANG_ID3_LENGTH*/
1175#if defined(HAVE_LCD_BITMAP) && !(CONFIG_KEYPAD == IPOD_4G_PAD) 1080 gui_wps_format_time(buffer, MAX_PATH, id3->length);
1176 case SETTINGS_DEC: 1081 info=buffer;
1177 case SETTINGS_DEC | BUTTON_REPEAT: 1082 break;
1083 case 7:/*LANG_ID3_PLAYLIST*/
1084 snprintf(buffer, MAX_PATH, "%d/%d", playlist_get_display_index(),
1085 playlist_amount());
1086 info=buffer;
1087 break;
1088 case 8:/*LANG_ID3_BITRATE*/
1089 snprintf(buffer, MAX_PATH, "%d kbps%s", id3->bitrate,
1090 id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
1091 info=buffer;
1092 break;
1093 case 9:/*LANG_ID3_FRECUENCY*/
1094 snprintf(buffer, MAX_PATH, "%ld Hz", id3->frequency);
1095 info=buffer;
1096 break;
1097#if CONFIG_CODEC == SWCODEC
1098 case 10:/*LANG_ID3_TRACK_GAIN*/
1099 info=id3->track_gain_string;
1100 break;
1101 case 11:/*LANG_ID3_ALBUM_GAIN*/
1102 info=id3->album_gain_string;
1103 break;
1104 case 12:/*LANG_ID3_PATH*/
1178#else 1105#else
1179 case SETTINGS_INC: 1106 case 10:/*LANG_ID3_PATH*/
1180#endif 1107#endif
1181 if (top < top_max) 1108 info=id3->path;
1182 {
1183 top += 2;
1184 }
1185 else if (!(button & BUTTON_REPEAT))
1186 {
1187 top = 0;
1188 }
1189
1190 break; 1109 break;
1110 }
1111 if(info==NULL)
1112 return(str(LANG_ID3_NO_INFO));
1113 return(info);
1114 }
1115}
1191 1116
1117bool browse_id3(void)
1118{
1119 struct gui_synclist id3_lists;
1120 struct mp3entry* id3 = audio_current_track();
1121 int key;
1122
1123 gui_synclist_init(&id3_lists, &id3_get_info, id3, true, 2);
1124 gui_synclist_set_nb_items(&id3_lists, ID3_ITEMS*2);
1125 gui_synclist_draw(&id3_lists);
1126 while (true) {
1127 key = button_get_w_tmo(HZ/2);
1128 /* If moved, "say" the entry under the cursor */
1129 gui_synclist_do_button(&id3_lists, key);
1130 switch( key ) {
1192#ifdef SETTINGS_OK2 1131#ifdef SETTINGS_OK2
1193 case SETTINGS_OK2: 1132 case SETTINGS_OK2:
1194#endif 1133#endif
@@ -1196,23 +1135,17 @@ bool browse_id3(void)
1196 lcd_stop_scroll(); 1135 lcd_stop_scroll();
1197 /* Eat release event */ 1136 /* Eat release event */
1198 button_get(true); 1137 button_get(true);
1199 exit = true; 1138 return(false);
1200 break;
1201 1139
1202 default: 1140 default:
1203 if (default_event_handler(button) == SYS_USB_CONNECTED) 1141 if (default_event_handler(key) == SYS_USB_CONNECTED)
1204 {
1205 return true; 1142 return true;
1206 }
1207
1208 break;
1209 }
1210 } 1143 }
1144 gui_syncstatusbar_draw(&statusbars, false);
1211 } 1145 }
1212
1213 return false;
1214} 1146}
1215 1147
1148
1216bool set_rating(void) 1149bool set_rating(void)
1217{ 1150{
1218 struct mp3entry* id3 = audio_current_track(); 1151 struct mp3entry* id3 = audio_current_track();
diff --git a/apps/tree.c b/apps/tree.c
index 4556d86c53..0322c3933a 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -248,7 +248,7 @@ void browse_root(void)
248 /* since archos only have one screen, no need to create more than that */ 248 /* since archos only have one screen, no need to create more than that */
249 gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) ); 249 gui_buttonbar_set_display(&tree_buttonbar, &(screens[SCREEN_MAIN]) );
250#endif 250#endif
251 gui_synclist_init(&tree_lists, &tree_get_filename, &tc); 251 gui_synclist_init(&tree_lists, &tree_get_filename, &tc, false, 1);
252 gui_synclist_set_icon_callback(&tree_lists, 252 gui_synclist_set_icon_callback(&tree_lists,
253 global_settings.show_icons?&tree_get_fileicon:NULL); 253 global_settings.show_icons?&tree_get_fileicon:NULL);
254#ifndef SIMULATOR 254#ifndef SIMULATOR