diff options
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index c0b6ce24f9..df398eaa58 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -40,10 +40,8 @@ | |||
40 | 40 | ||
41 | 41 | ||
42 | void gui_list_init(struct gui_list * gui_list, | 42 | void gui_list_init(struct gui_list * gui_list, |
43 | void (*callback_get_item_icon) | 43 | list_get_icon callback_get_item_icon, |
44 | (int selected_item, void * data, ICON * icon), | 44 | list_get_name callback_get_item_name, |
45 | char * (*callback_get_item_name) | ||
46 | (int selected_item, void * data, char *buffer), | ||
47 | void * data | 45 | void * data |
48 | ) | 46 | ) |
49 | { | 47 | { |
@@ -75,11 +73,10 @@ void gui_list_flash(struct gui_list * gui_list) | |||
75 | gui_list->cursor_flash_state=!gui_list->cursor_flash_state; | 73 | gui_list->cursor_flash_state=!gui_list->cursor_flash_state; |
76 | int selected_line=gui_list->selected_item-gui_list->start_item; | 74 | int selected_line=gui_list->selected_item-gui_list->start_item; |
77 | #ifdef HAVE_LCD_BITMAP | 75 | #ifdef HAVE_LCD_BITMAP |
78 | int cursor_xpos=global_settings.scrollbar?1:0; | ||
79 | int line_xpos=display->getxmargin(); | ||
80 | int line_ypos=display->getymargin()+display->char_height*selected_line; | 76 | int line_ypos=display->getymargin()+display->char_height*selected_line; |
81 | if (global_settings.invert_cursor) | 77 | if (global_settings.invert_cursor) |
82 | { | 78 | { |
79 | int line_xpos=display->getxmargin(); | ||
83 | display->set_drawmode(DRMODE_COMPLEMENT); | 80 | display->set_drawmode(DRMODE_COMPLEMENT); |
84 | display->fillrect(line_xpos, line_ypos, display->width, | 81 | display->fillrect(line_xpos, line_ypos, display->width, |
85 | display->char_height); | 82 | display->char_height); |
@@ -88,19 +85,14 @@ void gui_list_flash(struct gui_list * gui_list) | |||
88 | } | 85 | } |
89 | else | 86 | else |
90 | { | 87 | { |
91 | if(gui_list->cursor_flash_state) | 88 | int cursor_xpos=(global_settings.scrollbar && |
92 | screen_clear_area(display, cursor_xpos*SCROLLBAR_WIDTH, line_ypos, | 89 | display->nb_lines < gui_list->nb_items)?1:0; |
93 | CURSOR_WIDTH, CURSOR_HEIGHT); | 90 | screen_put_cursorxy(display, cursor_xpos, selected_line, gui_list->cursor_flash_state); |
94 | else | ||
95 | screen_put_cursorxy(display, cursor_xpos, selected_line); | ||
96 | } | 91 | } |
97 | display->update_rect(0, line_ypos,display->width, | 92 | display->update_rect(0, line_ypos,display->width, |
98 | display->char_height); | 93 | display->char_height); |
99 | #else | 94 | #else |
100 | if(gui_list->cursor_flash_state) | 95 | screen_put_cursorxy(display, 0, selected_line, gui_list->cursor_flash_state); |
101 | display->putc(0, selected_line, ' '); | ||
102 | else | ||
103 | screen_put_cursorxy(display, 0, selected_line); | ||
104 | gui_textarea_update(display); | 96 | gui_textarea_update(display); |
105 | #endif | 97 | #endif |
106 | } | 98 | } |
@@ -199,7 +191,7 @@ void gui_list_draw(struct gui_list * gui_list) | |||
199 | #endif | 191 | #endif |
200 | 192 | ||
201 | if(draw_cursor) | 193 | if(draw_cursor) |
202 | screen_put_cursorxy(display, cursor_pos, i); | 194 | screen_put_cursorxy(display, cursor_pos, i, true); |
203 | } | 195 | } |
204 | else | 196 | else |
205 | {/* normal item */ | 197 | {/* normal item */ |
@@ -371,10 +363,8 @@ void gui_list_del_item(struct gui_list * gui_list) | |||
371 | */ | 363 | */ |
372 | void gui_synclist_init( | 364 | void gui_synclist_init( |
373 | struct gui_synclist * lists, | 365 | struct gui_synclist * lists, |
374 | void (*callback_get_item_icon) | 366 | list_get_icon callback_get_item_icon, |
375 | (int selected_item, void * data, ICON * icon), | 367 | list_get_name callback_get_item_name, |
376 | char * (*callback_get_item_name) | ||
377 | (int selected_item, void * data, char *buffer), | ||
378 | void * data | 368 | void * data |
379 | ) | 369 | ) |
380 | { | 370 | { |
@@ -472,7 +462,7 @@ void gui_synclist_flash(struct gui_synclist * lists) | |||
472 | gui_list_flash(&(lists->gui_list[i])); | 462 | gui_list_flash(&(lists->gui_list[i])); |
473 | } | 463 | } |
474 | 464 | ||
475 | bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | 465 | unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) |
476 | { | 466 | { |
477 | gui_synclist_limit_scroll(lists, true); | 467 | gui_synclist_limit_scroll(lists, true); |
478 | switch(button) | 468 | switch(button) |
@@ -489,7 +479,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
489 | #endif | 479 | #endif |
490 | gui_synclist_select_previous(lists); | 480 | gui_synclist_select_previous(lists); |
491 | gui_synclist_draw(lists); | 481 | gui_synclist_draw(lists); |
492 | return true; | 482 | return LIST_PREV; |
493 | 483 | ||
494 | case LIST_NEXT: | 484 | case LIST_NEXT: |
495 | #ifdef LIST_RC_NEXT | 485 | #ifdef LIST_RC_NEXT |
@@ -504,7 +494,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
504 | #endif | 494 | #endif |
505 | gui_synclist_select_next(lists); | 495 | gui_synclist_select_next(lists); |
506 | gui_synclist_draw(lists); | 496 | gui_synclist_draw(lists); |
507 | return true; | 497 | return LIST_NEXT; |
508 | /* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen | 498 | /* for pgup / pgdown, we are obliged to have a different behaviour depending on the screen |
509 | * for which the user pressed the key since for example, remote and main screen doesn't | 499 | * for which the user pressed the key since for example, remote and main screen doesn't |
510 | * have the same number of lines*/ | 500 | * have the same number of lines*/ |
@@ -514,7 +504,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
514 | case LIST_PGUP | BUTTON_REPEAT: | 504 | case LIST_PGUP | BUTTON_REPEAT: |
515 | gui_synclist_select_previous_page(lists, SCREEN_MAIN); | 505 | gui_synclist_select_previous_page(lists, SCREEN_MAIN); |
516 | gui_synclist_draw(lists); | 506 | gui_synclist_draw(lists); |
517 | return true; | 507 | return LIST_NEXT; |
518 | #endif | 508 | #endif |
519 | 509 | ||
520 | #ifdef LIST_RC_PGUP | 510 | #ifdef LIST_RC_PGUP |
@@ -523,7 +513,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
523 | case LIST_RC_PGUP | BUTTON_REPEAT: | 513 | case LIST_RC_PGUP | BUTTON_REPEAT: |
524 | gui_synclist_select_previous_page(lists, SCREEN_REMOTE); | 514 | gui_synclist_select_previous_page(lists, SCREEN_REMOTE); |
525 | gui_synclist_draw(lists); | 515 | gui_synclist_draw(lists); |
526 | return true; | 516 | return LIST_NEXT; |
527 | #endif | 517 | #endif |
528 | 518 | ||
529 | #ifdef LIST_PGDN | 519 | #ifdef LIST_PGDN |
@@ -532,7 +522,7 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
532 | case LIST_PGDN | BUTTON_REPEAT: | 522 | case LIST_PGDN | BUTTON_REPEAT: |
533 | gui_synclist_select_next_page(lists, SCREEN_MAIN); | 523 | gui_synclist_select_next_page(lists, SCREEN_MAIN); |
534 | gui_synclist_draw(lists); | 524 | gui_synclist_draw(lists); |
535 | return true; | 525 | return LIST_PREV; |
536 | #endif | 526 | #endif |
537 | 527 | ||
538 | #ifdef LIST_RC_PGDN | 528 | #ifdef LIST_RC_PGDN |
@@ -541,8 +531,8 @@ bool gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
541 | case LIST_RC_PGDN | BUTTON_REPEAT: | 531 | case LIST_RC_PGDN | BUTTON_REPEAT: |
542 | gui_synclist_select_next_page(lists, SCREEN_REMOTE); | 532 | gui_synclist_select_next_page(lists, SCREEN_REMOTE); |
543 | gui_synclist_draw(lists); | 533 | gui_synclist_draw(lists); |
544 | return true; | 534 | return LIST_PREV; |
545 | #endif | 535 | #endif |
546 | } | 536 | } |
547 | return false; | 537 | return 0; |
548 | } | 538 | } |