diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-07 12:14:31 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-06-07 12:14:31 +0000 |
commit | 3823486a5864796cd7fcba07521f4ca2ebab3885 (patch) | |
tree | ab1564f9f1e7af51f320a6a17766f57788f662c3 /apps/gui/list.c | |
parent | a1f0a83a012f01cdb39025519c95df664399deed (diff) | |
download | rockbox-3823486a5864796cd7fcba07521f4ca2ebab3885.tar.gz rockbox-3823486a5864796cd7fcba07521f4ca2ebab3885.zip |
Add a mode the lists which doesnt show the selection marker.
Useful for the debug menus where users shouldn't think pressing select would do anything.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13588 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/list.c')
-rw-r--r-- | apps/gui/list.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index 43bbbe27cb..8fb99c1a66 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -96,6 +96,15 @@ static void gui_list_init(struct gui_list * gui_list, | |||
96 | 96 | ||
97 | gui_list->last_displayed_selected_item = -1 ; | 97 | gui_list->last_displayed_selected_item = -1 ; |
98 | gui_list->last_displayed_start_item = -1 ; | 98 | gui_list->last_displayed_start_item = -1 ; |
99 | gui_list->show_selection_marker = true; | ||
100 | } | ||
101 | |||
102 | /* this toggles the selection bar or cursor */ | ||
103 | void gui_synclist_hide_selection_marker(struct gui_synclist * lists, bool hide) | ||
104 | { | ||
105 | int i; | ||
106 | FOR_NB_SCREENS(i) | ||
107 | lists->gui_list[i].show_selection_marker = !hide; | ||
99 | } | 108 | } |
100 | 109 | ||
101 | /* | 110 | /* |
@@ -285,7 +294,8 @@ static void gui_list_draw_smart(struct gui_list *gui_list) | |||
285 | draw_scrollbar = (global_settings.scrollbar && | 294 | draw_scrollbar = (global_settings.scrollbar && |
286 | lines < gui_list->nb_items); | 295 | lines < gui_list->nb_items); |
287 | 296 | ||
288 | draw_cursor = !global_settings.invert_cursor; | 297 | draw_cursor = !global_settings.invert_cursor && |
298 | gui_list->show_selection_marker; | ||
289 | text_pos = 0; /* here it's in pixels */ | 299 | text_pos = 0; /* here it's in pixels */ |
290 | if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's | 300 | if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's |
291 | a title */ | 301 | a title */ |
@@ -340,7 +350,8 @@ static void gui_list_draw_smart(struct gui_list *gui_list) | |||
340 | item_offset = gui_list_get_item_offset(gui_list, item_width, text_pos); | 350 | item_offset = gui_list_get_item_offset(gui_list, item_width, text_pos); |
341 | #endif | 351 | #endif |
342 | 352 | ||
343 | if(current_item >= gui_list->selected_item && | 353 | if(gui_list->show_selection_marker && |
354 | current_item >= gui_list->selected_item && | ||
344 | current_item < gui_list->selected_item + gui_list->selected_size) | 355 | current_item < gui_list->selected_item + gui_list->selected_size) |
345 | {/* The selected item must be displayed scrolling */ | 356 | {/* The selected item must be displayed scrolling */ |
346 | #ifdef HAVE_LCD_BITMAP | 357 | #ifdef HAVE_LCD_BITMAP |
@@ -470,10 +481,19 @@ static void gui_list_select_above(struct gui_list * gui_list, int items) | |||
470 | nb_lines--; | 481 | nb_lines--; |
471 | 482 | ||
472 | gui_list->selected_item -= items; | 483 | gui_list->selected_item -= items; |
484 | |||
473 | /* in bottom "3rd" of the screen, so dont move the start item. | 485 | /* in bottom "3rd" of the screen, so dont move the start item. |
474 | by 3rd I mean above SCROLL_LIMIT lines above the end of the screen */ | 486 | by 3rd I mean above SCROLL_LIMIT lines above the end of the screen */ |
475 | if (items && gui_list->start_item + SCROLL_LIMIT < gui_list->selected_item) | 487 | if (items && gui_list->start_item + SCROLL_LIMIT < gui_list->selected_item) |
488 | { | ||
489 | if (gui_list->show_selection_marker == false) | ||
490 | { | ||
491 | gui_list->start_item -= items; | ||
492 | if (gui_list->start_item < 0) | ||
493 | gui_list->start_item = 0; | ||
494 | } | ||
476 | return; | 495 | return; |
496 | } | ||
477 | if (gui_list->selected_item < 0) | 497 | if (gui_list->selected_item < 0) |
478 | { | 498 | { |
479 | if(gui_list->limit_scroll) | 499 | if(gui_list->limit_scroll) |
@@ -515,15 +535,36 @@ static void gui_list_select_above(struct gui_list * gui_list, int items) | |||
515 | static void gui_list_select_below(struct gui_list * gui_list, int items) | 535 | static void gui_list_select_below(struct gui_list * gui_list, int items) |
516 | { | 536 | { |
517 | int nb_lines = gui_list->display->nb_lines; | 537 | int nb_lines = gui_list->display->nb_lines; |
538 | int bottom; | ||
518 | if (SHOW_LIST_TITLE) | 539 | if (SHOW_LIST_TITLE) |
519 | nb_lines--; | 540 | nb_lines--; |
520 | 541 | ||
521 | gui_list->selected_item += items; | 542 | gui_list->selected_item += items; |
543 | bottom = gui_list->nb_items - nb_lines; | ||
544 | |||
545 | /* always move the screen if selection isnt "visible" */ | ||
546 | if (items && gui_list->show_selection_marker == false) | ||
547 | { | ||
548 | if (bottom < 0) | ||
549 | bottom = 0; | ||
550 | gui_list->start_item = MIN(bottom, gui_list->start_item + | ||
551 | items); | ||
552 | return; | ||
553 | } | ||
522 | /* in top "3rd" of the screen, so dont move the start item */ | 554 | /* in top "3rd" of the screen, so dont move the start item */ |
523 | if (items && | 555 | if (items && |
524 | (gui_list->start_item + nb_lines - SCROLL_LIMIT > gui_list->selected_item) | 556 | (gui_list->start_item + nb_lines - SCROLL_LIMIT > gui_list->selected_item) |
525 | && (gui_list->selected_item < gui_list->nb_items)) | 557 | && (gui_list->selected_item < gui_list->nb_items)) |
558 | { | ||
559 | if (gui_list->show_selection_marker == false) | ||
560 | { | ||
561 | if (bottom < 0) | ||
562 | bottom = 0; | ||
563 | gui_list->start_item = MIN(bottom, | ||
564 | gui_list->start_item + items); | ||
565 | } | ||
526 | return; | 566 | return; |
567 | } | ||
527 | 568 | ||
528 | if (gui_list->selected_item >= gui_list->nb_items) | 569 | if (gui_list->selected_item >= gui_list->nb_items) |
529 | { | 570 | { |
@@ -539,7 +580,7 @@ static void gui_list_select_below(struct gui_list * gui_list, int items) | |||
539 | } | 580 | } |
540 | return; | 581 | return; |
541 | } | 582 | } |
542 | int bottom = gui_list->nb_items - nb_lines; | 583 | |
543 | if (gui_list->nb_items > nb_lines) | 584 | if (gui_list->nb_items > nb_lines) |
544 | { | 585 | { |
545 | if (global_settings.scroll_paginated) | 586 | if (global_settings.scroll_paginated) |