summaryrefslogtreecommitdiff
path: root/apps/gui
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 /apps/gui
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
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/list.c85
-rw-r--r--apps/gui/list.h13
2 files changed, 61 insertions, 37 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);