diff options
Diffstat (limited to 'apps/gui/charcell')
-rw-r--r-- | apps/gui/charcell/list.c | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/apps/gui/charcell/list.c b/apps/gui/charcell/list.c deleted file mode 100644 index cbee8b0d9d..0000000000 --- a/apps/gui/charcell/list.c +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Jonathan Gordon | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | /* This file contains the code to draw the list widget on BITMAP LCDs. */ | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "lcd.h" | ||
26 | #include "font.h" | ||
27 | #include "button.h" | ||
28 | #include "string.h" | ||
29 | #include "settings.h" | ||
30 | #include "kernel.h" | ||
31 | #include "system.h" | ||
32 | #include "file.h" | ||
33 | |||
34 | #include "list.h" | ||
35 | #include "screen_access.h" | ||
36 | #include "scrollbar.h" | ||
37 | #include "lang.h" | ||
38 | #include "sound.h" | ||
39 | #include "misc.h" | ||
40 | |||
41 | void gui_synclist_scroll_stop(struct gui_synclist *lists) | ||
42 | { | ||
43 | (void)lists; | ||
44 | FOR_NB_SCREENS(i) | ||
45 | { | ||
46 | screens[i].scroll_stop(); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | void list_draw(struct screen *display, struct gui_synclist *gui_list) | ||
51 | { | ||
52 | bool draw_icons = (gui_list->callback_get_item_icon != NULL); | ||
53 | bool selected; | ||
54 | int i; | ||
55 | int start, end; | ||
56 | |||
57 | display->set_viewport(NULL); | ||
58 | |||
59 | display->clear_display(); | ||
60 | start = 0; | ||
61 | end = display->getnblines(); | ||
62 | |||
63 | struct line_desc desc = { | ||
64 | .height = -1, | ||
65 | .text_color = 1, | ||
66 | .line_color = 1, | ||
67 | .line_end_color = 1, | ||
68 | .style = STYLE_DEFAULT | ||
69 | }; | ||
70 | |||
71 | for (i = start; i < end; i++) | ||
72 | { | ||
73 | unsigned const char *s; | ||
74 | char entry_buffer[MAX_PATH]; | ||
75 | unsigned char *entry_name; | ||
76 | int current_item = gui_list->start_item[display->screen_type] + i; | ||
77 | |||
78 | /* When there are less items to display than the | ||
79 | * current available space on the screen, we stop*/ | ||
80 | if(current_item >= gui_list->nb_items) | ||
81 | break; | ||
82 | s = gui_list->callback_get_item_name(current_item, | ||
83 | gui_list->data, | ||
84 | entry_buffer, | ||
85 | sizeof(entry_buffer)); | ||
86 | entry_name = P2STR(s); | ||
87 | |||
88 | if (gui_list->show_selection_marker && | ||
89 | current_item >= gui_list->selected_item && | ||
90 | current_item < gui_list->selected_item + gui_list->selected_size) | ||
91 | selected = true; /* The selected item must be displayed scrolling */ | ||
92 | else | ||
93 | selected = false; | ||
94 | |||
95 | desc.nlines = gui_list->selected_size, | ||
96 | desc.line = gui_list->selected_size > 1 ? i : 0, | ||
97 | desc.scroll = selected ? true : gui_list->scroll_all; | ||
98 | |||
99 | if (draw_icons) | ||
100 | put_line(display, 0, i, &desc, "$i$i$t", | ||
101 | selected ? Icon_Cursor : Icon_NOICON, | ||
102 | gui_list->callback_get_item_icon(current_item, gui_list->data), | ||
103 | entry_name); | ||
104 | else | ||
105 | put_line(display, 0, i, &desc, "$i$t", | ||
106 | selected ? Icon_Cursor : Icon_NOICON, | ||
107 | entry_name); | ||
108 | } | ||
109 | |||
110 | display->update_viewport(); | ||
111 | display->update(); | ||
112 | } | ||