summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/FILES1
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/bitmaps/native/SOURCES7
-rw-r--r--apps/bitmaps/native/default_icons.6x8x1.bmpbin0 -> 5174 bytes
-rwxr-xr-xapps/bitmaps/native/default_icons.6x8x16.bmpbin0 -> 5174 bytes
-rw-r--r--apps/bitmaps/remote_native/SOURCES2
-rw-r--r--apps/bitmaps/remote_native/remote_default_icons.6x8x1.bmpbin0 -> 5174 bytes
-rw-r--r--apps/bitmaps/remote_native/remote_default_icons.6x8x2.bmpbin0 -> 5174 bytes
-rw-r--r--apps/filetypes.c103
-rw-r--r--apps/filetypes.h3
-rw-r--r--apps/gui/color_picker.c14
-rw-r--r--apps/gui/icon.c261
-rw-r--r--apps/gui/icon.h80
-rw-r--r--apps/gui/list.c49
-rw-r--r--apps/gui/list.h8
-rw-r--r--apps/main.c3
-rw-r--r--apps/menu.c53
-rw-r--r--apps/player/icons.c89
-rw-r--r--apps/player/icons.h45
-rw-r--r--apps/playlist_viewer.c49
-rw-r--r--apps/plugin.h2
-rw-r--r--apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x1.bmpbin0 -> 478 bytes
-rw-r--r--apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x2.bmpbin0 -> 478 bytes
-rw-r--r--apps/plugins/bitmaps/viewer_defaults/viewers.6x8x1.bmpbin0 -> 478 bytes
-rw-r--r--apps/plugins/bitmaps/viewer_defaults/viewers.6x8x16.bmpbin0 -> 2134 bytes
-rw-r--r--apps/plugins/viewers.config64
-rw-r--r--apps/recorder/bmp.c7
-rw-r--r--apps/recorder/icons.c38
-rw-r--r--apps/recorder/icons.h45
-rw-r--r--apps/recorder/keyboard.c16
-rw-r--r--apps/settings.c11
-rw-r--r--apps/settings.h9
-rw-r--r--apps/settings_list.c15
-rw-r--r--apps/tagtree.c10
-rw-r--r--apps/tagtree.h6
-rw-r--r--apps/tree.c6
-rw-r--r--firmware/export/config.h14
-rwxr-xr-xtools/buildzip.pl44
38 files changed, 659 insertions, 397 deletions
diff --git a/apps/FILES b/apps/FILES
index d7207d7d4c..1897f66d8f 100644
--- a/apps/FILES
+++ b/apps/FILES
@@ -47,6 +47,7 @@ plugins/bitmaps/mono/*
47plugins/bitmaps/native/* 47plugins/bitmaps/native/*
48plugins/bitmaps/remote_mono/* 48plugins/bitmaps/remote_mono/*
49plugins/bitmaps/remote_native/* 49plugins/bitmaps/remote_native/*
50plugins/bitmaps/viewer_defaults/*
50plugins/chessbox/Makefile 51plugins/chessbox/Makefile
51plugins/chessbox/*.lds 52plugins/chessbox/*.lds
52plugins/chessbox/*.[ch] 53plugins/chessbox/*.[ch]
diff --git a/apps/SOURCES b/apps/SOURCES
index ca640ab05e..1dabb12d2b 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -48,7 +48,9 @@ screen_access.c
48gui/buttonbar.c 48gui/buttonbar.c
49gui/gwps.c 49gui/gwps.c
50gui/gwps-common.c 50gui/gwps-common.c
51#ifdef HAVE_LCD_BITMAP
51gui/icon.c 52gui/icon.c
53#endif
52gui/list.c 54gui/list.c
53gui/option_select.c 55gui/option_select.c
54gui/quickscreen.c 56gui/quickscreen.c
diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES
index ba642ab7aa..51e92c9c5b 100644
--- a/apps/bitmaps/native/SOURCES
+++ b/apps/bitmaps/native/SOURCES
@@ -40,4 +40,11 @@ usblogo.104x27x1.bmp
40#endif 40#endif
41#endif 41#endif
42 42
43/* List Icons */
44#if LCD_DEPTH == 16
45default_icons.6x8x16.bmp
46#else
47default_icons.6x8x1.bmp
48#endif
49
43#endif /* HAVE_LCD_BITMAP */ 50#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/bitmaps/native/default_icons.6x8x1.bmp b/apps/bitmaps/native/default_icons.6x8x1.bmp
new file mode 100644
index 0000000000..857b1e1d7b
--- /dev/null
+++ b/apps/bitmaps/native/default_icons.6x8x1.bmp
Binary files differ
diff --git a/apps/bitmaps/native/default_icons.6x8x16.bmp b/apps/bitmaps/native/default_icons.6x8x16.bmp
new file mode 100755
index 0000000000..601c4f95a6
--- /dev/null
+++ b/apps/bitmaps/native/default_icons.6x8x16.bmp
Binary files differ
diff --git a/apps/bitmaps/remote_native/SOURCES b/apps/bitmaps/remote_native/SOURCES
index c93dc89a1c..2692179d5a 100644
--- a/apps/bitmaps/remote_native/SOURCES
+++ b/apps/bitmaps/remote_native/SOURCES
@@ -3,9 +3,11 @@
3#if (LCD_REMOTE_DEPTH == 1) 3#if (LCD_REMOTE_DEPTH == 1)
4remote_rockboxlogo.128x42x1.bmp 4remote_rockboxlogo.128x42x1.bmp
5remote_usblogo.104x27x1.bmp 5remote_usblogo.104x27x1.bmp
6remote_default_icons.6x8x1.bmp
6#elif (LCD_REMOTE_DEPTH == 2) 7#elif (LCD_REMOTE_DEPTH == 2)
7remote_rockboxlogo.128x42x2.bmp 8remote_rockboxlogo.128x42x2.bmp
8remote_usblogo.104x27x2.bmp 9remote_usblogo.104x27x2.bmp
10remote_default_icons.6x8x2.bmp
9#endif 11#endif
10 12
11#endif /* HAVE_REMOTE_LCD */ 13#endif /* HAVE_REMOTE_LCD */
diff --git a/apps/bitmaps/remote_native/remote_default_icons.6x8x1.bmp b/apps/bitmaps/remote_native/remote_default_icons.6x8x1.bmp
new file mode 100644
index 0000000000..857b1e1d7b
--- /dev/null
+++ b/apps/bitmaps/remote_native/remote_default_icons.6x8x1.bmp
Binary files differ
diff --git a/apps/bitmaps/remote_native/remote_default_icons.6x8x2.bmp b/apps/bitmaps/remote_native/remote_default_icons.6x8x2.bmp
new file mode 100644
index 0000000000..857b1e1d7b
--- /dev/null
+++ b/apps/bitmaps/remote_native/remote_default_icons.6x8x2.bmp
Binary files differ
diff --git a/apps/filetypes.c b/apps/filetypes.c
index ca6578aa23..f91df19652 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -22,6 +22,7 @@
22#include <stdlib.h> 22#include <stdlib.h>
23#include <stdbool.h> 23#include <stdbool.h>
24#include "string.h" 24#include "string.h"
25#include "atoi.h"
25#include <ctype.h> 26#include <ctype.h>
26 27
27#include "sprintf.h" 28#include "sprintf.h"
@@ -55,7 +56,7 @@
55#define ROCK_EXTENSION "rock" 56#define ROCK_EXTENSION "rock"
56 57
57struct file_type { 58struct file_type {
58 ICON_NO_CONST icon; /* the icon which shall be used for it, NOICON if unknown */ 59 int icon; /* the icon which shall be used for it, NOICON if unknown */
59 bool viewer; /* true if the rock is in viewers, false if in rocks */ 60 bool viewer; /* true if the rock is in viewers, false if in rocks */
60 unsigned char attr; /* FILETYPES_MASK >> 8 */ 61 unsigned char attr; /* FILETYPES_MASK >> 8 */
61 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */ 62 char* plugin; /* Which plugin to use, NULL if unknown, or builtin */
@@ -73,6 +74,38 @@ static char *filetypes_strdup(char* string)
73} 74}
74static void read_builtin_types(void); 75static void read_builtin_types(void);
75static void read_config(char* config_file); 76static void read_config(char* config_file);
77#ifdef HAVE_LCD_BITMAP
78void read_viewer_theme_file(void)
79{
80 char buffer[MAX_PATH];
81 int fd;
82 char *ext, *icon;
83 int i;
84 snprintf(buffer, MAX_PATH, "%s/%s.icons", ICON_DIR,
85 global_settings.viewers_icon_file);
86 fd = open(buffer, O_RDONLY);
87 if (fd < 0)
88 return;
89 while (read_line(fd, buffer, MAX_PATH) > 0)
90 {
91 if (!settings_parseline(buffer, &ext, &icon))
92 continue;
93 for (i=0; i<filetype_count; i++)
94 {
95 if (filetypes[i].extension && !strcasecmp(ext, filetypes[i].extension))
96 {
97 if (*icon == '*')
98 filetypes[i].icon = atoi(icon+1);
99 else if (*icon == '-')
100 filetypes[i].icon = Icon_NOICON;
101 else filetypes[i].icon = Icon_Last_Themeable + atoi(icon);
102 break;
103 }
104 }
105 }
106 close(fd);
107}
108#endif
76 109
77void filetype_init(void) 110void filetype_init(void)
78{ 111{
@@ -80,15 +113,14 @@ void filetype_init(void)
80 filetypes[0].extension = NULL; 113 filetypes[0].extension = NULL;
81 filetypes[0].plugin = NULL; 114 filetypes[0].plugin = NULL;
82 filetypes[0].attr = 0; 115 filetypes[0].attr = 0;
83 filetypes[0].icon = 116 filetypes[0].icon = Icon_Folder;
84#ifdef HAVE_LCD_BITMAP 117
85 (ICON_NO_CONST)&bitmap_icons_6x8[Icon_Folder];
86#else
87 (ICON_NO_CONST)Icon_Folder;
88#endif
89 filetype_count = 1; 118 filetype_count = 1;
90 read_builtin_types(); 119 read_builtin_types();
91 read_config(VIEWERS_CONFIG); 120 read_config(VIEWERS_CONFIG);
121#ifdef HAVE_LCD_BITMAP
122 read_viewer_theme_file();
123#endif
92} 124}
93 125
94/* remove all white spaces from string */ 126/* remove all white spaces from string */
@@ -119,12 +151,7 @@ static void read_builtin_types(void)
119 filetypes[filetype_count].attr = types[i].tree_attr>>8; 151 filetypes[filetype_count].attr = types[i].tree_attr>>8;
120 if (filetypes[filetype_count].attr > heighest_attr) 152 if (filetypes[filetype_count].attr > heighest_attr)
121 heighest_attr = filetypes[filetype_count].attr; 153 heighest_attr = filetypes[filetype_count].attr;
122 filetypes[filetype_count].icon = 154 filetypes[filetype_count].icon = types[i].icon;
123#ifdef HAVE_LCD_BITMAP
124 (ICON_NO_CONST)&bitmap_icons_6x8[types[i].icon];
125#else
126 (ICON_NO_CONST)types[i].icon;
127#endif
128 filetype_count++; 155 filetype_count++;
129 } 156 }
130} 157}
@@ -133,10 +160,6 @@ static void read_config(char* config_file)
133{ 160{
134 char line[64], *s, *e; 161 char line[64], *s, *e;
135 char extension[8], plugin[32]; 162 char extension[8], plugin[32];
136#ifdef HAVE_LCD_BITMAP
137 char icon[ICON_LENGTH];
138 int good_icon;
139#endif
140 bool viewer; 163 bool viewer;
141 int fd = open(config_file, O_RDONLY); 164 int fd = open(config_file, O_RDONLY);
142 if (fd < 0) 165 if (fd < 0)
@@ -181,44 +204,18 @@ static void read_config(char* config_file)
181 filetypes[filetype_count].plugin = filetypes_strdup(plugin); 204 filetypes[filetype_count].plugin = filetypes_strdup(plugin);
182 filetypes[filetype_count].viewer = viewer; 205 filetypes[filetype_count].viewer = viewer;
183 filetypes[filetype_count].attr = heighest_attr +1; 206 filetypes[filetype_count].attr = heighest_attr +1;
207 filetypes[filetype_count].icon = Icon_Questionmark;
184 heighest_attr++; 208 heighest_attr++;
185 /* get the icon */ 209 /* get the icon */
186#ifdef HAVE_LCD_BITMAP 210#ifdef HAVE_LCD_BITMAP
187 s = e+1; 211 s = e+1;
188 good_icon = 1; 212 if (*s == '*')
189 if (strlen(s) == 12) 213 filetypes[filetype_count].icon = atoi(s+1);
190 { 214 else if (*s == '-')
191 int i, j; 215 filetypes[filetype_count].icon = Icon_NOICON;
192 char val[2]; 216 else filetypes[filetype_count].icon = Icon_Last_Themeable + atoi(s);
193 for (i = 0; good_icon && i < ICON_LENGTH; i++)
194 {
195 for (j=0; good_icon && j<2; j++)
196 {
197 val[j] = tolower(s[i*2+j]);
198 if (val[j] >= 'a' && val[j] <= 'f')
199 {
200 val[j] = val[j] - 'a' + 10;
201 }
202 else if (val[j] >= '0' && val[j] <= '9')
203 {
204 val[j] = val[j] - '0';
205 }
206 else
207 good_icon = 0;
208 }
209 icon[i]=((val[0]<<4) | val[1]);
210 }
211 }
212 if (good_icon)
213 {
214 filetypes[filetype_count].icon =
215 (ICON_NO_CONST)buffer_alloc(ICON_LENGTH);
216 memcpy(filetypes[filetype_count].icon, icon, ICON_LENGTH);
217 }
218 else
219 filetypes[filetype_count].icon = NOICON;
220#else 217#else
221 filetypes[filetype_count].icon = Icon_Unknown; 218 filetypes[filetype_count].icon = Icon_NOICON;
222#endif 219#endif
223 filetype_count++; 220 filetype_count++;
224 } 221 }
@@ -254,12 +251,12 @@ static int find_attr(int attr)
254 return -1; 251 return -1;
255} 252}
256 253
257ICON filetype_get_icon(int attr) 254int filetype_get_icon(int attr)
258{ 255{
259 int index = find_attr(attr); 256 int index = find_attr(attr);
260 if (index < 0) 257 if (index < 0)
261 return NOICON; 258 return Icon_NOICON;
262 return (ICON)filetypes[index].icon; 259 return filetypes[index].icon;
263} 260}
264 261
265char* filetype_get_plugin(const struct entry* file) 262char* filetype_get_plugin(const struct entry* file)
diff --git a/apps/filetypes.h b/apps/filetypes.h
index d2556c1d95..182cb0da4e 100644
--- a/apps/filetypes.h
+++ b/apps/filetypes.h
@@ -25,10 +25,11 @@
25/* init the filetypes structs. 25/* init the filetypes structs.
26 uses audio buffer for storage, so call early in init... */ 26 uses audio buffer for storage, so call early in init... */
27void filetype_init(void); 27void filetype_init(void);
28void read_viewer_theme_file(void);
28 29
29/* Return the attribute (TREE_ATTR_*) of the file */ 30/* Return the attribute (TREE_ATTR_*) of the file */
30int filetype_get_attr(const char* file); 31int filetype_get_attr(const char* file);
31ICON filetype_get_icon(int attr); 32int filetype_get_icon(int attr);
32/* return the plugin filename associated with the file */ 33/* return the plugin filename associated with the file */
33char* filetype_get_plugin(const struct entry* file); 34char* filetype_get_plugin(const struct entry* file);
34 35
diff --git a/apps/gui/color_picker.c b/apps/gui/color_picker.c
index 2d0dba1221..1739f3fd61 100644
--- a/apps/gui/color_picker.c
+++ b/apps/gui/color_picker.c
@@ -31,7 +31,7 @@
31#include "lang.h" 31#include "lang.h"
32#include "splash.h" 32#include "splash.h"
33#include "action.h" 33#include "action.h"
34#include "icons.h" 34#include "icon.h"
35 35
36/* structure for color info */ 36/* structure for color info */
37struct rgb_pick 37struct rgb_pick
@@ -220,13 +220,11 @@ static void draw_screen(struct screen *display, char *title,
220 /* Draw "> <" around sliders */ 220 /* Draw "> <" around sliders */
221 int top = text_top + (display->char_height - 221 int top = text_top + (display->char_height -
222 SELECTOR_HEIGHT) / 2; 222 SELECTOR_HEIGHT) / 2;
223 display->mono_bitmap(bitmap_icons_6x8[Icon_Cursor], 223 screen_put_iconxy(display, MARGIN_LEFT, top, Icon_Cursor);
224 MARGIN_LEFT, top, 224 screen_put_iconxy(display,
225 SELECTOR_WIDTH, SELECTOR_HEIGHT); 225 display->width - MARGIN_RIGHT -
226 display->mono_bitmap(bitmap_icons_6x8[Icon_Reverse_Cursor], 226 get_icon_width(display->screen_type),
227 display->width - MARGIN_RIGHT - 227 top, Icon_Cursor);
228 SELECTOR_WIDTH, top, SELECTOR_WIDTH,
229 SELECTOR_HEIGHT);
230 } 228 }
231 229
232 if (display->depth >= 16) 230 if (display->depth >= 16)
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index ef6f61f94e..2cb0035ad7 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) Robert E. Hak(2002) 10 * Copyright (C) 2007 Jonathan Gordon
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.
@@ -16,42 +16,265 @@
16 * KIND, either express or implied. 16 * KIND, either express or implied.
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19#include <stdio.h>
20#include <stdlib.h>
21#include <string.h>
22#include "inttypes.h"
20#include "config.h" 23#include "config.h"
21#include "icon.h" 24#include "icon.h"
22#include "screen_access.h" 25#include "screen_access.h"
23#include "icons.h" 26#include "icons.h"
27#include "settings.h"
28#include "bmp.h"
29#include "filetypes.h"
30
31/* Quick and Dirty hack untill lcd bitmap drawing is fixed */
32#ifdef HAVE_REMOTE_LCD
33#include "lcd-remote.h"
34#endif
35
36
37#include <default_icons.h>
38#ifdef HAVE_REMOTE_LCD
39#include <remote_default_icons.h>
40#endif
41
42#define DEFAULT_VIEWER_BMP ICON_DIR "/viewers.bmp"
43#define DEFAULT_REMOTE_VIEWER_BMP ICON_DIR "/remote_viewers.bmp"
44
45/* These should robably be moved to config-<target>.h */
46#define MAX_ICON_HEIGHT 24
47#define MAX_ICON_WIDTH 24
48
49
50/* We dont actually do anything with these pointers,
51 but they need to be grouped like this to save code
52 so storing them as void* is ok. (stops compile warning) */
53static const void * inbuilt_icons[NB_SCREENS] = {
54 (void*)default_icons
55#ifdef HAVE_REMOTE_LCD
56 , (void*)remote_default_icons
57#endif
58};
24 59
25/* Count in letter positions, NOT pixels */ 60static const int default_width[NB_SCREENS] = {
26void screen_put_iconxy(struct screen * display, int x, int y, ICON icon) 61 BMPWIDTH_default_icons
62#ifdef HAVE_REMOTE_LCD
63 , BMPWIDTH_remote_default_icons
64#endif
65};
66
67/* height of whole file */
68static const int default_height[NB_SCREENS] = {
69 BMPHEIGHT_default_icons
70#ifdef HAVE_REMOTE_LCD
71 , BMPHEIGHT_remote_default_icons
72#endif
73};
74
75#define IMG_BUFSIZE (MAX_ICON_HEIGHT * MAX_ICON_WIDTH * \
76 Icon_Last_Themeable *LCD_DEPTH/8)
77static unsigned char icon_buffer[IMG_BUFSIZE][NB_SCREENS];
78static bool custom_icons_loaded[NB_SCREENS] = {false};
79static struct bitmap user_iconset[NB_SCREENS];
80
81static unsigned char viewer_icon_buffer[IMG_BUFSIZE][NB_SCREENS];
82static bool viewer_icons_loaded[NB_SCREENS] = {false};
83static struct bitmap viewer_iconset[NB_SCREENS];
84
85
86#define ICON_HEIGHT(screen) (!custom_icons_loaded[screen]? \
87 default_height[screen] : \
88 user_iconset[screen].height) \
89 / Icon_Last_Themeable
90
91#define ICON_WIDTH(screen) (!custom_icons_loaded[screen]? \
92 default_width[screen] : \
93 user_iconset[screen].width)
94
95/* x,y in letters, not pixles */
96void screen_put_icon(struct screen * display,
97 int x, int y, enum themable_icons icon)
98{
99 screen_put_icon_with_offset(display, x, y, 0, 0, icon);
100}
101
102void screen_put_icon_with_offset(struct screen * display,
103 int x, int y, int off_x, int off_y,
104 enum themable_icons icon)
27{ 105{
28#ifdef HAVE_LCD_BITMAP
29 int width, height;
30 int xpos, ypos; 106 int xpos, ypos;
107 int width, height;
108 int screen = display->screen_type;
31 display->getstringsize((unsigned char *)"M", &width, &height); 109 display->getstringsize((unsigned char *)"M", &width, &height);
32 xpos = x*CURSOR_WIDTH; 110 xpos = x*ICON_WIDTH(screen) + off_x;
33 ypos = y*height + display->getymargin(); 111 ypos = y*height + display->getymargin() + off_y;
112
113 if ( height > ICON_HEIGHT(screen) )/* center the cursor */
114 ypos += (height - ICON_HEIGHT(screen)) / 2;
115 screen_put_iconxy(display, xpos, ypos, icon);
116}
34 117
35 if ( height > CURSOR_HEIGHT )/* center the cursor */ 118/* x,y in pixels */
36 ypos += (height - CURSOR_HEIGHT) / 2; 119typedef void (*lcd_draw_func)(const fb_data *src, int src_x, int src_y,
37 if(icon==0)/* Don't display invalid icons */ 120 int stride, int x, int y, int width, int height);
38 screen_clear_area(display, xpos, ypos, CURSOR_WIDTH, CURSOR_HEIGHT); 121void screen_put_iconxy(struct screen * display,
122 int xpos, int ypos, enum themable_icons icon)
123{
124 fb_data *data;
125 int screen = display->screen_type;
126 lcd_draw_func draw_func = NULL;
127
128 if (icon == Icon_NOICON)
129 {
130 screen_clear_area(display, xpos, ypos,
131 ICON_WIDTH(screen), ICON_HEIGHT(screen));
132 return;
133 }
134 else if (icon >= Icon_Last_Themeable)
135 {
136 icon -= Icon_Last_Themeable;
137 if (!viewer_icons_loaded[screen] ||
138 (icon*ICON_HEIGHT(screen) > viewer_iconset[screen].height))
139 {
140 screen_clear_area(display, xpos, ypos,
141 ICON_WIDTH(screen), ICON_HEIGHT(screen));
142 return;
143 }
144 data = (fb_data *)viewer_iconset[screen].data;
145 }
146 else if (custom_icons_loaded[screen])
147 {
148 data = (fb_data *)user_iconset[screen].data;
149 }
39 else 150 else
40 display->mono_bitmap(icon, xpos, ypos, CURSOR_WIDTH, CURSOR_HEIGHT); 151 {
41#else 152 data = (fb_data *)inbuilt_icons[screen];
42 if(icon==-1) 153 }
43 display->putc(x, y, ' '); 154 /* add some left padding to the icons if they are on the edge */
155 if (xpos == 0)
156 xpos++;
157
158#ifdef HAVE_REMOTE_LCD
159 if (display->screen_type == SCREEN_REMOTE)
160 {
161 /* Quick and Dirty hack untill lcd bitmap drawing is fixed */
162 draw_func = (lcd_draw_func)lcd_remote_bitmap_part;
163 }
44 else 164 else
45 display->putc(x, y, icon);
46#endif 165#endif
166#if LCD_DEPTH == 16
167 draw_func = display->transparent_bitmap_part;
168#else /* LCD_DEPTH < 16 */
169 draw_func = display->bitmap_part;
170#endif /* LCD_DEPTH == 16 */
171
172 draw_func( (const fb_data *)data,
173 0, ICON_HEIGHT(screen)*icon,
174 ICON_WIDTH(screen), xpos, ypos,
175 ICON_WIDTH(screen), ICON_HEIGHT(screen));
47} 176}
48 177
49void screen_put_cursorxy(struct screen * display, int x, int y, bool on) 178void screen_put_cursorxy(struct screen * display, int x, int y, bool on)
50{ 179{
51#ifdef HAVE_LCD_BITMAP 180#ifdef HAVE_LCD_BITMAP
52 screen_put_iconxy(display, x, y, on?bitmap_icons_6x8[Icon_Cursor]:0); 181 screen_put_icon(display, x, y, on?Icon_Cursor:0);
53#else 182#else
54 screen_put_iconxy(display, x, y, on?CURSOR_CHAR:-1); 183 screen_put_icon(display, x, y, on?CURSOR_CHAR:-1);
55#endif 184#endif
56 185
57} 186}
187enum Iconset {
188 Iconset_Mainscreen,
189 Iconset_Mainscreen_viewers,
190#ifdef HAVE_REMOTE_LCD
191 Iconset_Remotescreen,
192 Iconset_Remotescreen_viewers,
193#endif
194};
195
196static void load_icons(const char* filename, enum Iconset iconset)
197{
198 int size_read;
199 bool *loaded_ok = NULL;
200 struct bitmap *bmp = NULL;
201
202 switch (iconset)
203 {
204 case Iconset_Mainscreen:
205 loaded_ok = &custom_icons_loaded[SCREEN_MAIN];
206 bmp = &user_iconset[SCREEN_MAIN];
207 bmp->data = icon_buffer[SCREEN_MAIN];
208 break;
209 case Iconset_Mainscreen_viewers:
210 loaded_ok = &viewer_icons_loaded[SCREEN_MAIN];
211 bmp = &viewer_iconset[SCREEN_MAIN];
212 bmp->data = viewer_icon_buffer[SCREEN_MAIN];
213 break;
214#ifdef HAVE_REMOTE_LCD
215 case Iconset_Remotescreen:
216 loaded_ok = &custom_icons_loaded[SCREEN_MAIN];
217 bmp = &user_iconset[SCREEN_MAIN];
218 bmp->data = icon_buffer[SCREEN_MAIN];
219 break;
220 case Iconset_Remotescreen_viewers:
221 loaded_ok = &viewer_icons_loaded[SCREEN_REMOTE];
222 bmp = &viewer_iconset[SCREEN_REMOTE];
223 bmp->data = viewer_icon_buffer[SCREEN_REMOTE];
224 break;
225#endif
226 }
227
228 *loaded_ok = false;
229 if (filename != NULL)
230 {
231 size_read = read_bmp_file((char*)filename, bmp, IMG_BUFSIZE,
232 FORMAT_NATIVE | FORMAT_DITHER);
233 if (size_read > 0)
234 {
235 *loaded_ok = true;
236 }
237 }
238}
239
240
241void icons_init(void)
242{
243 char path[MAX_PATH];
244 if (global_settings.icon_file[0])
245 {
246 snprintf(path, MAX_PATH, "%s/%s.bmp",
247 ICON_DIR, global_settings.icon_file);
248 load_icons(path, Iconset_Mainscreen);
249 }
250 if (global_settings.viewers_icon_file[0])
251 {
252 snprintf(path, MAX_PATH, "%s/%s.bmp",
253 ICON_DIR, global_settings.viewers_icon_file);
254 load_icons(path, Iconset_Mainscreen_viewers);
255 read_viewer_theme_file();
256 }
257 else
258 load_icons(DEFAULT_VIEWER_BMP, Iconset_Mainscreen_viewers);
259#ifdef HAVE_REMOTE_LCD
260 if (global_settings.remote_icon_file[0])
261 {
262 snprintf(path, MAX_PATH, "%s/%s.bmp",
263 ICON_DIR, global_settings.remote_icon_file);
264 load_icons(path, Iconset_Remotescreen);
265 }
266 if (global_settings.remote_viewers_icon_file[0])
267 {
268 snprintf(path, MAX_PATH, "%s/%s.bmp",
269 ICON_DIR, global_settings.remote_viewers_icon_file);
270 load_icons(path, Iconset_Remotescreen_viewers);
271 }
272 else
273 load_icons(DEFAULT_REMOTE_VIEWER_BMP, Iconset_Mainscreen_viewers);
274#endif
275}
276
277int get_icon_width(enum screen_type screen_type)
278{
279 return ICON_WIDTH(screen_type);
280}
diff --git a/apps/gui/icon.h b/apps/gui/icon.h
index c717bbc6ea..fa6919030f 100644
--- a/apps/gui/icon.h
+++ b/apps/gui/icon.h
@@ -24,19 +24,51 @@
24 * char-based displays and bitmap displays */ 24 * char-based displays and bitmap displays */
25#ifdef HAVE_LCD_BITMAP 25#ifdef HAVE_LCD_BITMAP
26typedef const unsigned char * ICON; 26typedef const unsigned char * ICON;
27typedef unsigned char * ICON_NO_CONST; 27#define NOICON Icon_NOICON
28#define NOICON NULL
29#else 28#else
30typedef long ICON; 29typedef long ICON;
31#define ICON_NO_CONST ICON 30#define NOICON Icon_NOICON
32#define NOICON -1
33#endif 31#endif
34 32
35#define Icon_NOICON -1 33#define FORCE_INBUILT_ICON 0x80000000
36 34/* Don't #ifdef icon values, or we wont be able to use the same
37#define CURSOR_CHAR 0xe10c 35 cmp for every target. */
38#define CURSOR_WIDTH 6 36enum themable_icons {
39#define CURSOR_HEIGHT 8 37 Icon_NOICON = -1, /* Dont put this in a .bmp */
38 Icon_Audio,
39 Icon_Folder,
40 Icon_Playlist,
41 Icon_Cursor,
42 Icon_Wps,
43 Icon_Firmware,
44 Icon_Font,
45 Icon_Language,
46 Icon_Config,
47 Icon_Plugin,
48 Icon_Bookmark,
49 Icon_Preset,
50 Icon_Queued,
51 Icon_Moving,
52 Icon_Keyboard,
53 Icon_Reverse_Cursor,
54 Icon_Questionmark,
55 Icon_Menu_setting,
56 Icon_Menu_functioncall,
57 Icon_Submenu,
58 Icon_Submenu_Entered,
59 Icon_Recording,
60 Icon_Voice,
61 Icon_General_settings_menu,
62 Icon_System_menu,
63 Icon_Playback_menu,
64 Icon_Display_menu,
65 Icon_Remote_Display_menu,
66 Icon_Radio_screen,
67 Icon_file_view_menu,
68 Icon_EQ,
69 Icon_Rockbox,
70 Icon_Last_Themeable,
71};
40 72
41/* 73/*
42 * Draws a cursor at a given position, if th 74 * Draws a cursor at a given position, if th
@@ -49,12 +81,36 @@ extern void screen_put_cursorxy(struct screen * screen, int x, int y, bool on);
49/* 81/*
50 * Put an icon on a screen at a given position 82 * Put an icon on a screen at a given position
51 * (the position is given in characters) 83 * (the position is given in characters)
52 * If the given icon is null (HAVE_LCD_BITMAP) or -1 otherwise, the icon 84 * If the given icon is Icon_blank, the icon
53 * at the given position will be erased 85 * at the given position will be erased
54 * - screen : the screen where we put our icon 86 * - screen : the screen where we put our icon
55 * - x, y : the position, in character, not in pixel !! 87 * - x, y : the position, pixel value !!
56 * - icon : the icon to put 88 * - icon : the icon to put
57 */ 89 */
58extern void screen_put_iconxy(struct screen * screen, int x, int y, ICON icon); 90extern void screen_put_iconxy(struct screen * screen,
91 int x, int y, enum themable_icons icon);
92#ifdef HAVE_LCD_CHARCELLS
93# define screen_put_icon(s, x, y, i) screen_put_iconxy(s, x, y, i)
94# define screen_put_icon_with_offset(s, x, y, w, h, i) screen_put_icon(s, x, y, i)
95#else
96/* For both of these, the icon will be placed in the center of the rectangle */
97/* as above, but x,y are letter position, NOT PIXEL */
98extern void screen_put_icon(struct screen * screen,
99 int x, int y, enum themable_icons icon);
100/* as above (x,y are letter pos), but with a pxiel offset for both */
101extern void screen_put_icon_with_offset(struct screen * display,
102 int x, int y, int off_x, int off_y,
103 enum themable_icons icon);
104#endif
105
106void icons_init(void);
107
108
109#ifdef HAVE_LCD_CHARCELLS
110# define CURSOR_CHAR 0xe10c
111# define get_icon_width(a) 6
112#else
113int get_icon_width(enum screen_type screen_type);
114#endif
59 115
60#endif /*_GUI_ICON_H_*/ 116#endif /*_GUI_ICON_H_*/
diff --git a/apps/gui/list.c b/apps/gui/list.c
index e3b0d6afe5..c93210e0eb 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -92,7 +92,7 @@ static void gui_list_init(struct gui_list * gui_list,
92 gui_list->selected_size=selected_size; 92 gui_list->selected_size=selected_size;
93 gui_list->title = NULL; 93 gui_list->title = NULL;
94 gui_list->title_width = 0; 94 gui_list->title_width = 0;
95 gui_list->title_icon = NOICON; 95 gui_list->title_icon = Icon_NOICON;
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 ;
@@ -230,8 +230,6 @@ static int gui_list_get_item_offset(struct gui_list * gui_list, int item_width,
230static void gui_list_draw_smart(struct gui_list *gui_list) 230static void gui_list_draw_smart(struct gui_list *gui_list)
231{ 231{
232 struct screen * display=gui_list->display; 232 struct screen * display=gui_list->display;
233 int cursor_pos = 0;
234 int icon_pos = 1;
235 int text_pos; 233 int text_pos;
236 bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons); 234 bool draw_icons = (gui_list->callback_get_item_icon != NULL && global_settings.show_icons);
237 bool draw_cursor; 235 bool draw_cursor;
@@ -288,9 +286,9 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
288 { 286 {
289 if (gui_list->title_icon != NOICON && draw_icons) 287 if (gui_list->title_icon != NOICON && draw_icons)
290 { 288 {
291 screen_put_iconxy(display, 0, 0, gui_list->title_icon); 289 screen_put_icon(display, 0, 0, gui_list->title_icon);
292#ifdef HAVE_LCD_BITMAP 290#ifdef HAVE_LCD_BITMAP
293 text_pos = 8; /* pixels */ 291 text_pos = get_icon_width(display->screen_type)+2; /* pixels */
294#else 292#else
295 text_pos = 1; /* chars */ 293 text_pos = 1; /* chars */
296#endif 294#endif
@@ -327,17 +325,13 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
327 if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's 325 if(draw_scrollbar || SHOW_LIST_TITLE) /* indent if there's
328 a title */ 326 a title */
329 { 327 {
330 cursor_pos++;
331 icon_pos++;
332 text_pos += SCROLLBAR_WIDTH; 328 text_pos += SCROLLBAR_WIDTH;
333 } 329 }
334 if(!draw_cursor) 330 if(draw_cursor)
335 icon_pos--; 331 text_pos += get_icon_width(display->screen_type) + 2;
336 else
337 text_pos += CURSOR_WIDTH;
338 332
339 if(draw_icons) 333 if(draw_icons)
340 text_pos += 8; 334 text_pos += get_icon_width(display->screen_type) + 2;
341#else 335#else
342 draw_cursor = true; 336 draw_cursor = true;
343 if(draw_icons) 337 if(draw_icons)
@@ -413,7 +407,12 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
413#endif 407#endif
414 408
415 if (draw_cursor) 409 if (draw_cursor)
416 screen_put_cursorxy(display, cursor_pos, i, true); 410 {
411 screen_put_icon_with_offset(display, 0, i,
412 (draw_scrollbar || SHOW_LIST_TITLE)?
413 SCROLLBAR_WIDTH: 0,
414 0, Icon_Cursor);
415 }
417 } 416 }
418 else 417 else
419 {/* normal item */ 418 {/* normal item */
@@ -437,12 +436,19 @@ static void gui_list_draw_smart(struct gui_list *gui_list)
437 /* Icons display */ 436 /* Icons display */
438 if(draw_icons) 437 if(draw_icons)
439 { 438 {
440 ICON icon; 439 enum themable_icons icon;
441 gui_list->callback_get_item_icon(current_item, 440 icon = gui_list->callback_get_item_icon(current_item, gui_list->data);
442 gui_list->data, 441 if(icon > Icon_NOICON)
443 &icon); 442 {
444 if(icon) 443#ifdef HAVE_LCD_BITMAP
445 screen_put_iconxy(display, icon_pos, i, icon); 444 int x = draw_cursor?1:0;
445 int x_off = (draw_scrollbar || SHOW_LIST_TITLE) ? SCROLLBAR_WIDTH: 0;
446 screen_put_icon_with_offset(display, x, i,
447 x_off, 0, icon);
448#else
449 screen_put_icon(display, 1, i, icon);
450#endif
451 }
446 } 452 }
447 } 453 }
448 454
@@ -737,7 +743,8 @@ void gui_list_screen_scroll_out_of_view(bool enable)
737 * Set the title and title icon of the list. Setting title to NULL disables 743 * Set the title and title icon of the list. Setting title to NULL disables
738 * both the title and icon. Use NOICON if there is no icon. 744 * both the title and icon. Use NOICON if there is no icon.
739 */ 745 */
740static void gui_list_set_title(struct gui_list * gui_list, char * title, ICON icon) 746static void gui_list_set_title(struct gui_list * gui_list,
747 char * title, enum themable_icons icon)
741{ 748{
742 gui_list->title = title; 749 gui_list->title = title;
743 gui_list->title_icon = icon; 750 gui_list->title_icon = icon;
@@ -870,7 +877,7 @@ void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll)
870} 877}
871 878
872void gui_synclist_set_title(struct gui_synclist * lists, 879void gui_synclist_set_title(struct gui_synclist * lists,
873 char * title, ICON icon) 880 char * title, enum themable_icons icon)
874{ 881{
875 int i; 882 int i;
876 FOR_NB_SCREENS(i) 883 FOR_NB_SCREENS(i)
diff --git a/apps/gui/list.h b/apps/gui/list.h
index bd43edf7ef..283676d631 100644
--- a/apps/gui/list.h
+++ b/apps/gui/list.h
@@ -49,9 +49,7 @@ enum list_wrap {
49 * the icon after the function returns. 49 * the icon after the function returns.
50 * Note : we use the ICON type because the real type depends of the plateform 50 * Note : we use the ICON type because the real type depends of the plateform
51 */ 51 */
52typedef void list_get_icon(int selected_item, 52typedef enum themable_icons list_get_icon(int selected_item, void * data);
53 void * data,
54 ICON * icon);
55/* 53/*
56 * Text callback 54 * Text callback
57 * - selected_item : an integer that tells the number of the item to display 55 * - selected_item : an integer that tells the number of the item to display
@@ -101,7 +99,7 @@ struct gui_list
101 /* The optional title, set to NULL for none */ 99 /* The optional title, set to NULL for none */
102 char * title; 100 char * title;
103 /* Optional title icon */ 101 /* Optional title icon */
104 ICON title_icon; 102 enum themable_icons title_icon;
105}; 103};
106 104
107/* 105/*
@@ -190,7 +188,7 @@ extern void gui_synclist_del_item(struct gui_synclist * lists);
190extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll); 188extern void gui_synclist_limit_scroll(struct gui_synclist * lists, bool scroll);
191extern void gui_synclist_flash(struct gui_synclist * lists); 189extern void gui_synclist_flash(struct gui_synclist * lists);
192extern void gui_synclist_set_title(struct gui_synclist * lists, char * title, 190extern void gui_synclist_set_title(struct gui_synclist * lists, char * title,
193 ICON icon); 191 int icon);
194 192
195/* 193/*
196 * Do the action implied by the given button, 194 * Do the action implied by the given button,
diff --git a/apps/main.c b/apps/main.c
index 3145f3693b..75903825d8 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -70,6 +70,7 @@
70#include "splash.h" 70#include "splash.h"
71#include "eeprom_settings.h" 71#include "eeprom_settings.h"
72#include "scrobbler.h" 72#include "scrobbler.h"
73#include "icon.h"
73 74
74#if (CONFIG_CODEC == SWCODEC) 75#if (CONFIG_CODEC == SWCODEC)
75#include "playback.h" 76#include "playback.h"
@@ -267,6 +268,7 @@ static void init(void)
267 sleep(HZ/2); 268 sleep(HZ/2);
268 tree_init(); 269 tree_init();
269 filetype_init(); 270 filetype_init();
271 icons_init();
270 playlist_init(); 272 playlist_init();
271 273
272#if CONFIG_CODEC != SWCODEC 274#if CONFIG_CODEC != SWCODEC
@@ -501,6 +503,7 @@ static void init(void)
501 playlist_init(); 503 playlist_init();
502 tree_init(); 504 tree_init();
503 filetype_init(); 505 filetype_init();
506 icons_init();
504 scrobbler_init(); 507 scrobbler_init();
505 cuesheet_init(); 508 cuesheet_init();
506 509
diff --git a/apps/menu.c b/apps/menu.c
index 71a066f428..e840432f42 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -136,7 +136,7 @@ static char * get_menu_item_name(int selected_item,void * data, char *buffer)
136 return P2STR(menu->callback_and_desc->desc); 136 return P2STR(menu->callback_and_desc->desc);
137} 137}
138#ifdef HAVE_LCD_BITMAP 138#ifdef HAVE_LCD_BITMAP
139static void menu_get_icon(int selected_item, void * data, ICON * icon) 139static int menu_get_icon(int selected_item, void * data)
140{ 140{
141 const struct menu_item_ex *menu = (const struct menu_item_ex *)data; 141 const struct menu_item_ex *menu = (const struct menu_item_ex *)data;
142 int menu_icon = Icon_NOICON; 142 int menu_icon = Icon_NOICON;
@@ -144,8 +144,7 @@ static void menu_get_icon(int selected_item, void * data, ICON * icon)
144 144
145 if ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID) 145 if ((menu->flags&MENU_TYPE_MASK) == MT_RETURN_ID)
146 { 146 {
147 *icon = bitmap_icons_6x8[Icon_Menu_functioncall]; 147 return Icon_Menu_functioncall;
148 return;
149 } 148 }
150 menu = menu->submenus[selected_item]; 149 menu = menu->submenus[selected_item];
151 if (menu->flags&MENU_HAS_DESC) 150 if (menu->flags&MENU_HAS_DESC)
@@ -153,28 +152,24 @@ static void menu_get_icon(int selected_item, void * data, ICON * icon)
153 else if (menu->flags&MENU_DYNAMIC_DESC) 152 else if (menu->flags&MENU_DYNAMIC_DESC)
154 menu_icon = menu->menu_get_name_and_icon->icon_id; 153 menu_icon = menu->menu_get_name_and_icon->icon_id;
155 154
156 switch (menu->flags&MENU_TYPE_MASK) 155 if (menu_icon == Icon_NOICON)
157 { 156 {
158 case MT_SETTING: 157 switch (menu->flags&MENU_TYPE_MASK)
159 case MT_SETTING_W_TEXT: 158 {
160 *icon = bitmap_icons_6x8[Icon_Menu_setting]; 159 case MT_SETTING:
161 break; 160 case MT_SETTING_W_TEXT:
162 case MT_MENU: 161 menu_icon = Icon_Menu_setting;
163 if (menu_icon == Icon_NOICON) 162 break;
164 *icon = bitmap_icons_6x8[Icon_Submenu]; 163 case MT_MENU:
165 else 164 menu_icon = Icon_Submenu;
166 *icon = bitmap_icons_6x8[menu_icon]; 165 break;
167 break; 166 case MT_FUNCTION_CALL:
168 case MT_FUNCTION_CALL: 167 case MT_RETURN_VALUE:
169 case MT_RETURN_VALUE: 168 menu_icon = Icon_Menu_functioncall;
170 if (menu_icon == Icon_NOICON) 169 break;
171 *icon = bitmap_icons_6x8[Icon_Menu_functioncall]; 170 }
172 else
173 *icon = bitmap_icons_6x8[menu_icon];
174 break;
175 default:
176 *icon = NOICON;
177 } 171 }
172 return menu_icon;
178} 173}
179#endif 174#endif
180 175
@@ -184,7 +179,7 @@ static void init_menu_lists(const struct menu_item_ex *menu,
184 int i, count = MENU_GET_COUNT(menu->flags); 179 int i, count = MENU_GET_COUNT(menu->flags);
185 int type = (menu->flags&MENU_TYPE_MASK); 180 int type = (menu->flags&MENU_TYPE_MASK);
186 menu_callback_type menu_callback = NULL; 181 menu_callback_type menu_callback = NULL;
187 ICON icon = NOICON; 182 int icon;
188 current_subitems_count = 0; 183 current_subitems_count = 0;
189 184
190 if (type == MT_OLD_MENU) 185 if (type == MT_OLD_MENU)
@@ -220,9 +215,9 @@ static void init_menu_lists(const struct menu_item_ex *menu,
220 gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1); 215 gui_synclist_init(lists,get_menu_item_name,(void*)menu,false,1);
221#ifdef HAVE_LCD_BITMAP 216#ifdef HAVE_LCD_BITMAP
222 if (menu->callback_and_desc->icon_id == Icon_NOICON) 217 if (menu->callback_and_desc->icon_id == Icon_NOICON)
223 icon = bitmap_icons_6x8[Icon_Submenu_Entered]; 218 icon = Icon_Submenu_Entered;
224 else 219 else
225 icon = bitmap_icons_6x8[menu->callback_and_desc->icon_id]; 220 icon = menu->callback_and_desc->icon_id;
226 gui_synclist_set_title(lists, P2STR(menu->callback_and_desc->desc), icon); 221 gui_synclist_set_title(lists, P2STR(menu->callback_and_desc->desc), icon);
227 gui_synclist_set_icon_callback(lists, menu_get_icon); 222 gui_synclist_set_icon_callback(lists, menu_get_icon);
228#else 223#else
@@ -704,10 +699,10 @@ static char* oldmenuwrapper_getname(int selected_item,
704} 699}
705 700
706#ifdef HAVE_LCD_BITMAP 701#ifdef HAVE_LCD_BITMAP
707static void oldmenu_get_icon(int selected_item, void * data, ICON * icon) 702static int oldmenu_get_icon(int selected_item, void * data)
708{ 703{
709 (void)data; (void)selected_item; 704 (void)data; (void)selected_item;
710 *icon = bitmap_icons_6x8[Icon_Menu_functioncall]; 705 return Icon_Menu_functioncall;
711} 706}
712#endif 707#endif
713 708
@@ -721,7 +716,7 @@ static void init_oldmenu(const struct menu_item_ex *menu,
721 gui_synclist_limit_scroll(lists, true); 716 gui_synclist_limit_scroll(lists, true);
722#ifdef HAVE_LCD_BITMAP 717#ifdef HAVE_LCD_BITMAP
723 gui_synclist_set_title(lists, menus[menu->value].title, 718 gui_synclist_set_title(lists, menus[menu->value].title,
724 bitmap_icons_6x8[Icon_Submenu_Entered]); 719 Icon_Submenu_Entered);
725 gui_synclist_set_icon_callback(lists, oldmenu_get_icon); 720 gui_synclist_set_icon_callback(lists, oldmenu_get_icon);
726#endif 721#endif
727 gui_synclist_select_item(lists, selected); 722 gui_synclist_select_item(lists, selected);
diff --git a/apps/player/icons.c b/apps/player/icons.c
index 3f9b7c1547..6717eb12bd 100644
--- a/apps/player/icons.c
+++ b/apps/player/icons.c
@@ -7,7 +7,7 @@
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$ 8 * $Id$
9 * 9 *
10 * Copyright (C) 2002 Justin Heiner 10 * Copyright (C) 2007 Jonathan Gordon
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.
@@ -17,8 +17,93 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19#include "lcd.h" 19#include "lcd.h"
20#include "icons.h" 20#include "icon.h"
21 21
22#ifdef HAVE_LCD_CHARCELLS 22#ifdef HAVE_LCD_CHARCELLS
23/* For the moment, charcell cant load custom maps... */
24
25enum old_values{
26 old_Icon_Queued = 'Q',
27 old_Icon_Moving = 'M',
28 old_Icon_Unknown = 0xe100,
29 old_Icon_Bookmark,
30 old_Icon_Plugin,
31 old_Icon_Folder,
32 old_Icon_Firmware,
33 old_Icon_Language,
34 old_Icon_Audio,
35 old_Icon_Wps,
36 old_Icon_Playlist,
37 old_Icon_Text,
38 old_Icon_Config,
39};
40
41static const long icon_unknown = old_Icon_Unknown;
42static const long icons[Icon_Last_Themeable] = {
43 [0 ... Icon_Last_Themeable-1] = 0,
44
45 [Icon_Audio] = old_Icon_Audio,
46 [Icon_Folder] = old_Icon_Folder,
47 [Icon_Playlist] = old_Icon_Playlist,
48 [Icon_Cursor] = CURSOR_CHAR,
49 [Icon_Wps] = old_Icon_Wps,
50 [Icon_Firmware] = old_Icon_Firmware,
51 [Icon_Language] = old_Icon_Language,
52 [Icon_Config] = old_Icon_Config,
53 [Icon_Plugin] = old_Icon_Plugin,
54 [Icon_Bookmark] = old_Icon_Bookmark,
55 [Icon_Queued] = 'Q',
56 [Icon_Moving] = 'M',
57
58 /*
59 [Icon_Keyboard] = ,
60 [Icon_Font] = ,
61 [Icon_Preset] = ,
62 [Icon_Reverse_Cursor] = ,
63 [Icon_Questionmark] = ,
64 [Icon_Menu_setting] = ,
65 [Icon_Menu_functioncall] = ,
66 [Icon_Submenu] = ,
67 [Icon_Submenu_Entered] = ,
68 [Icon_Recording] = ,
69 [Icon_Voice] = ,
70 [Icon_General_settings_menu] = ,
71 [Icon_System_menu] = ,
72 [Icon_Playback_menu] = ,
73 [Icon_Display_menu] = ,
74 [Icon_Remote_Display_menu] = ,
75 [Icon_Radio_screen] = ,
76 [Icon_file_view_menu] = ,
77 [Icon_EQ] = ,
78 [Icon_Rockbox] = ,
79 */
80};
81
82/* as above, but x,y are letter position, NOT PIXEL */
83extern void screen_put_iconxy(struct screen * screen,
84 int x, int y, enum themable_icons icon)
85{
86 if (icon == -1)
87 screen->putc(x, y, icon_unknown);
88 else if ((icon==Icon_NOICON) && (icons[icon]!=0))
89 screen->putc(x, y, ' ');
90 else
91 screen->putc(x, y, icons[icon]);
92}
93
94void screen_put_cursorxy(struct screen * display, int x, int y, bool on)
95{
96 screen_put_iconxy(display, x, y, on?Icon_Cursor:-1);
97
98}
99
100void icons_init(void)
101{
102}
103
104
105
106
107
23 108
24#endif 109#endif
diff --git a/apps/player/icons.h b/apps/player/icons.h
index 5df94b09e3..48dfdfc345 100644
--- a/apps/player/icons.h
+++ b/apps/player/icons.h
@@ -25,50 +25,5 @@
25 * Icons of size 5x7 pixels for the Player LCD 25 * Icons of size 5x7 pixels for the Player LCD
26 */ 26 */
27 27
28#ifdef HAVE_LCD_CHARCELLS
29
30enum {
31 Icon_Queued = 'Q',
32 Icon_Moving = 'M',
33 Icon_Unknown = 0xe100,
34 Icon_Bookmark,
35 Icon_Plugin,
36 Icon_Folder,
37 Icon_Firmware,
38 Icon_Language,
39 Icon_Audio,
40 Icon_Wps,
41 Icon_Playlist,
42 Icon_Text,
43 Icon_Config,
44};
45
46/* put icons from the 6x8 enum here if the player
47 doesnt have an icon for it */
48enum unused_but_needed {
49 Icon_Cursor,
50 Icon_Font,
51 Icon_Preset,
52 Icon_Keyboard,
53 Icon_Reverse_Cursor,
54 Icon_Questionmark,
55 Icon_Menu_setting,
56 Icon_Menu_functioncall,
57 Icon_Submenu,
58 Icon_Submenu_Entered,
59 Icon_Recording,
60 Icon_Voice,
61 Icon_General_settings_menu,
62 Icon_System_menu,
63 Icon_Playback_menu,
64 Icon_Display_menu,
65 Icon_Remote_Display_menu,
66 Icon_Radio_screen,
67 Icon_file_view_menu,
68 Icon_EQ,
69 Icon_Rockbox,
70 Icon6x8Last,
71};
72#endif
73 28
74#endif /* _ICONS_H_ */ 29#endif /* _ICONS_H_ */
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 7d6bf2db2b..b5f72cbfe5 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -570,7 +570,7 @@ static char *playlist_callback_name(int selected_item, void *data, char *buffer)
570} 570}
571 571
572 572
573static void playlist_callback_icons(int selected_item, void *data, ICON * icon) 573static int playlist_callback_icons(int selected_item, void *data)
574{ 574{
575 struct playlist_viewer * local_viewer=(struct playlist_viewer *)data; 575 struct playlist_viewer * local_viewer=(struct playlist_viewer *)data;
576 struct playlist_entry *track= 576 struct playlist_entry *track=
@@ -578,36 +578,20 @@ static void playlist_callback_icons(int selected_item, void *data, ICON * icon)
578 if (track->index == local_viewer->current_playing_track) 578 if (track->index == local_viewer->current_playing_track)
579 { 579 {
580 /* Current playing track */ 580 /* Current playing track */
581#ifdef HAVE_LCD_BITMAP 581 return Icon_Audio;
582 *icon=bitmap_icons_6x8[Icon_Audio];
583#else
584 *icon=Icon_Audio;
585#endif
586 } 582 }
587 else if (track->index == local_viewer->move_track) 583 else if (track->index == local_viewer->move_track)
588 { 584 {
589 /* Track we are moving */ 585 /* Track we are moving */
590#ifdef HAVE_LCD_BITMAP 586 return Icon_Moving;
591 *icon=bitmap_icons_6x8[Icon_Moving];
592#else
593 *icon=Icon_Moving;
594#endif
595 } 587 }
596 else if (track->queued) 588 else if (track->queued)
597 { 589 {
598 /* Queued track */ 590 /* Queued track */
599#ifdef HAVE_LCD_BITMAP 591 return Icon_Queued;
600 *icon=bitmap_icons_6x8[Icon_Queued];
601#else
602 *icon=Icon_Queued;
603#endif
604 } 592 }
605 else 593 else
606#ifdef HAVE_LCD_BITMAP 594 return Icon_NOICON;
607 *icon=0;
608#else
609 *icon=-1;
610#endif
611} 595}
612 596
613/* Main viewer function. Filename identifies playlist to be viewed. If NULL, 597/* Main viewer function. Filename identifies playlist to be viewed. If NULL,
@@ -627,13 +611,7 @@ bool playlist_viewer_ex(char* filename)
627 &playlist_callback_icons:NULL); 611 &playlist_callback_icons:NULL);
628 gui_synclist_set_nb_items(&playlist_lists, viewer.num_tracks); 612 gui_synclist_set_nb_items(&playlist_lists, viewer.num_tracks);
629 gui_synclist_select_item(&playlist_lists, viewer.selected_track); 613 gui_synclist_select_item(&playlist_lists, viewer.selected_track);
630 gui_synclist_set_title(&playlist_lists, str(LANG_PLAYLIST_MENU), 614 gui_synclist_set_title(&playlist_lists, str(LANG_PLAYLIST_MENU), Icon_Playlist);
631#ifdef HAVE_LCD_BITMAP
632 bitmap_icons_6x8[Icon_Playlist]
633#else
634 NOICON
635#endif
636 );
637 gui_synclist_draw(&playlist_lists); 615 gui_synclist_draw(&playlist_lists);
638 action_signalscreenchange(); 616 action_signalscreenchange();
639 while (!exit) 617 while (!exit)
@@ -800,17 +778,6 @@ static char *playlist_search_callback_name(int selected_item, void * data, char
800 return(buffer); 778 return(buffer);
801} 779}
802 780
803
804static void playlist_search_callback_icons(int selected_item, void * data, ICON * icon)
805{
806 (void)selected_item;
807 (void)data;
808#ifdef HAVE_LCD_BITMAP
809 *icon=0;
810#else
811 *icon=-1;
812#endif
813}
814bool search_playlist(void) 781bool search_playlist(void)
815{ 782{
816 char search_str[32] = ""; 783 char search_str[32] = "";
@@ -851,9 +818,7 @@ bool search_playlist(void)
851 backlight_on(); 818 backlight_on();
852 gui_synclist_init(&playlist_lists, playlist_search_callback_name, 819 gui_synclist_init(&playlist_lists, playlist_search_callback_name,
853 found_indicies, false, 1); 820 found_indicies, false, 1);
854 gui_synclist_set_icon_callback(&playlist_lists, 821 gui_synclist_set_icon_callback(&playlist_lists, NULL);
855 global_settings.playlist_viewer_icons?
856 &playlist_search_callback_icons:NULL);
857 gui_synclist_set_nb_items(&playlist_lists, found_indicies_count); 822 gui_synclist_set_nb_items(&playlist_lists, found_indicies_count);
858 gui_synclist_select_item(&playlist_lists, 0); 823 gui_synclist_select_item(&playlist_lists, 0);
859 gui_synclist_draw(&playlist_lists); 824 gui_synclist_draw(&playlist_lists);
diff --git a/apps/plugin.h b/apps/plugin.h
index 0c2d050a73..f118260154 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -274,7 +274,7 @@ struct plugin_api {
274 void (*gui_synclist_flash)(struct gui_synclist * lists); 274 void (*gui_synclist_flash)(struct gui_synclist * lists);
275 unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, 275 unsigned (*gui_synclist_do_button)(struct gui_synclist * lists,
276 unsigned button,enum list_wrap wrap); 276 unsigned button,enum list_wrap wrap);
277 void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, ICON icon); 277 void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, int icon);
278 278
279 /* button */ 279 /* button */
280 long (*button_get)(bool block); 280 long (*button_get)(bool block);
diff --git a/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x1.bmp b/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x1.bmp
new file mode 100644
index 0000000000..d7d896608c
--- /dev/null
+++ b/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x2.bmp b/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x2.bmp
new file mode 100644
index 0000000000..d7d896608c
--- /dev/null
+++ b/apps/plugins/bitmaps/viewer_defaults/remote_viewers.6x8x2.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x1.bmp b/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x1.bmp
new file mode 100644
index 0000000000..d7d896608c
--- /dev/null
+++ b/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x1.bmp
Binary files differ
diff --git a/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x16.bmp b/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x16.bmp
new file mode 100644
index 0000000000..1760e66d43
--- /dev/null
+++ b/apps/plugins/bitmaps/viewer_defaults/viewers.6x8x16.bmp
Binary files differ
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config
index 67a39b8dc3..d53fb2371e 100644
--- a/apps/plugins/viewers.config
+++ b/apps/plugins/viewers.config
@@ -1,32 +1,32 @@
1ch8,viewers/chip8,70 70 7f 7f 70 70 1ch8,viewers/chip8,0
2txt,viewers/viewer,55 55 55 55 55 55 2txt,viewers/viewer,1
3nfo,viewers/viewer,55 55 55 55 55 55 3nfo,viewers/viewer,1
4txt,rocks/text_editor, 55 55 55 55 55 55 4txt,rocks/text_editor,2
5jpg,viewers/jpeg,18 24 3C 3C 24 18 5jpg,viewers/jpeg,2
6jpe,viewers/jpeg,18 24 3C 3C 24 18 6jpe,viewers/jpeg,2
7jpeg,viewers/jpeg,18 24 3C 3C 24 18 7jpeg,viewers/jpeg,2
8ucl,viewers/rockbox_flash,2A 7F 41 41 7F 2A 8ucl,viewers/rockbox_flash,3
9rvf,viewers/video,5D 7F 5D 7F 5D 7F 9rvf,viewers/video,4
10mp3,viewers/vbrfix,10 08 58 38 04 02 10mp3,viewers/vbrfix,5
11m3u,viewers/search,00 00 00 00 00 00 11m3u,viewers/search,-
12txt,viewers/sort,00 00 00 00 00 00 12txt,viewers/sort,-
13gb,viewers/rockboy,0C 2A 59 7A 2E 0C 13gb,viewers/rockboy,6
14gbc,viewers/rockboy,0C 2A 59 7A 2E 0C 14gbc,viewers/rockboy,6
15m3u,viewers/iriverify,00 00 00 00 00 00 15m3u,viewers/iriverify,-
16mid,viewers/midiplay,20 70 70 3F 00 00 16mid,viewers/midiplay,7
17rmi,viewers/midiplay,20 70 70 3F 00 00 17rmi,viewers/midiplay,7
18rsp,viewers/searchengine,0e 11 11 31 7e 60 18rsp,viewers/searchengine,8
19ss,rocks/sudoku,55 55 55 55 55 55 19ss,rocks/sudoku,1
20wav,viewers/wav2wv,00 00 00 00 00 00 20wav,viewers/wav2wv,-
21wav,viewers/mp3_encoder,00 00 00 00 00 00 21wav,viewers/mp3_encoder,-
22wav,viewers/wavplay,60 7F 05 35 3F 00 22wav,viewers/wavplay,*0
23wav,viewers/wavview,18 7E 3C FF 7E 18 23wav,viewers/wavview,10
24bmp,rocks/rockpaint,01 10 01 10 01 10 24bmp,rocks/rockpaint,11
25mpg,viewers/mpegplayer,5D 7F 5D 7F 5D 7F 25mpg,viewers/mpegplayer,4
26mpeg,viewers/mpegplayer,5D 7F 5D 7F 5D 7F 26mpeg,viewers/mpegplayer,4
27iriver,viewers/iriver_flash,2A 7F 41 41 7F 2A 27iriver,viewers/iriver_flash,3
28tap,viewers/zxbox,66 52 4A 66 52 4A 28tap,viewers/zxbox,12
29sna,viewers/zxbox,66 52 4A 66 52 4A 29sna,viewers/zxbox,12
30tzx,viewers/zxbox,66 52 4A 66 52 4A 30tzx,viewers/zxbox,12
31z80,viewers/zxbox,66 52 4A 66 52 4A 31z80,viewers/zxbox,12
32zzz,viewers/properties,00 00 00 00 00 00 32zzz,viewers/properties,-
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index b33c0a329d..352b2f47b1 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -215,13 +215,6 @@ int read_bmp_file(char* filename,
215 } 215 }
216 216
217 height = readlong(&bmph.height); 217 height = readlong(&bmph.height);
218 if (height > LCD_HEIGHT) {
219 DEBUGF("read_bmp_file: Bitmap too high (%d pixels, max is %d)\n",
220 height, LCD_HEIGHT);
221 close(fd);
222 return -5;
223 }
224
225 depth = readshort(&bmph.bit_count); 218 depth = readshort(&bmph.bit_count);
226 padded_width = ((width * depth + 31) >> 3) & ~3; /* 4-byte boundary aligned */ 219 padded_width = ((width * depth + 31) >> 3) & ~3; /* 4-byte boundary aligned */
227 220
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index ccb42d5919..007cd07b7d 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -44,44 +44,6 @@ const unsigned char bitmap_icons_5x8[][5] =
44#endif 44#endif
45}; 45};
46 46
47const unsigned char bitmap_icons_6x8[][6] =
48{
49 { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */
50 { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */
51 { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */
52 { 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */
53 { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */
54 { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */
55 { 0x60, 0x70, 0x38, 0x2c, 0x7e, 0x7e }, /* Font file */
56 { 0x3e, 0x2a, 0x3e, 0x2a, 0x2a, 0x3e }, /* Language file */
57 { 0x4e, 0x51, 0x51, 0x40, 0x55, 0x55 }, /* Config file */
58 { 0x0a, 0x0a, 0x5f, 0x4e, 0x24, 0x18 }, /* Plugin file */
59 { 0x7f, 0x41, 0x4f, 0x4a, 0x4c, 0x78 }, /* Bookmark file */
60 { 0x5f, 0x45, 0x5b, 0x40, 0x55, 0x55 }, /* Preset file */
61 { 0x77, 0x55, 0x55, 0x55, 0x55, 0x77 }, /* Queued Item */
62 { 0x3e, 0x41, 0x3e, 0x1c, 0x1c, 0x08 }, /* Moving Item */
63 { 0x7f, 0x7f, 0x1c, 0x3e, 0x77, 0x63 }, /* Keyboard file */
64 { 0x00, 0x00, 0x00, 0x08, 0x1c, 0x3e }, /* Reverse Cursor / Marker */
65 { 0x06, 0x03, 0x5b, 0x5b, 0x0f, 0x06 }, /* question mark */
66 { 0x00, 0x18, 0x24, 0x24, 0x18, 0x00 }, /* Menu Settings */
67 { 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00 }, /* function call from the menu */
68 { 0x18, 0x18, 0x7e, 0x7e, 0x18, 0x18 }, /* sub menu */
69 { 0x01, 0x55, 0x01, 0x55, 0x54, 0x54 }, /* in submenu */
70 { 0x1c, 0x3e, 0x7f, 0x7f, 0x3e, 0x1c }, /* Recording menu */
71 { 0x1c, 0x1c, 0x22, 0x41, 0x7f, 0x00 }, /* voice menu */
72 { 0x06, 0x0f, 0x78, 0x78, 0x0f, 0x06 }, /* general settings menu */
73 { 0x1e, 0x22, 0x49, 0x49, 0x22, 0x1e }, /* system menu */
74 { 0x7f, 0x7f, 0x3e, 0x1c, 0x08, 0x00 }, /* playback menu */
75 { 0x1f, 0x51, 0x71, 0x71, 0x51, 0x1f }, /* display menu */
76 { 0x1e, 0x32, 0x32, 0x32, 0x1e, 0x00 }, /* remote display menu */
77#if CONFIG_TUNER
78 { 0x03, 0x05, 0x7f, 0x05, 0x03, 0x00 }, /* radio */
79#endif
80 { 0x1f, 0x11, 0x7d, 0x46, 0x44, 0x78 }, /* File View Menu */
81 { 0x06, 0x7f, 0x06, 0x18, 0x7f, 0x18 }, /* EQ menu */
82 { 0x20, 0x70, 0x70, 0x3f, 0x0a, 0x0a }, /* "rockbox" musical note */
83};
84
85const unsigned char bitmap_icons_7x8[][7] = 47const unsigned char bitmap_icons_7x8[][7] =
86{ 48{
87 {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ 49 {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index 7682d44733..8c4cd2b2dd 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -32,10 +32,6 @@
32#include <remote_rockboxlogo.h> 32#include <remote_rockboxlogo.h>
33#endif 33#endif
34 34
35/*
36 * Icons of size 6x8 pixels
37 */
38
39 35
40/* Symbolic names for icons */ 36/* Symbolic names for icons */
41enum icons_5x8 { 37enum icons_5x8 {
@@ -49,46 +45,6 @@ enum icons_5x8 {
49 Icon5x8Last 45 Icon5x8Last
50}; 46};
51 47
52/* If any icons are added to this enum, they must be
53 added to the unused_but_needed enum in ../player/icons.h */
54enum icons_6x8 {
55 Icon_Audio,
56 Icon_Folder,
57 Icon_Playlist,
58 Icon_Cursor,
59 Icon_Wps,
60 Icon_Firmware,
61 Icon_Font,
62 Icon_Language,
63 Icon_Config,
64 Icon_Plugin,
65 Icon_Bookmark,
66 Icon_Preset,
67 Icon_Queued,
68 Icon_Moving,
69 Icon_Keyboard,
70 Icon_Reverse_Cursor,
71 Icon_Questionmark,
72 Icon_Menu_setting,
73 Icon_Menu_functioncall,
74 Icon_Submenu,
75 Icon_Submenu_Entered,
76 Icon_Recording,
77 Icon_Voice,
78 Icon_General_settings_menu,
79 Icon_System_menu,
80 Icon_Playback_menu,
81 Icon_Display_menu,
82 Icon_Remote_Display_menu,
83#if CONFIG_TUNER
84 Icon_Radio_screen,
85#endif
86 Icon_file_view_menu,
87 Icon_EQ,
88 Icon_Rockbox,
89 Icon6x8Last,
90};
91
92enum icons_7x8 { 48enum icons_7x8 {
93 Icon_Plug, 49 Icon_Plug,
94 Icon_USBPlug, 50 Icon_USBPlug,
@@ -144,7 +100,6 @@ extern const unsigned char bitmap_formats_18x8[Format_18x8Last][18];
144#endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */ 100#endif /* CONFIG_CODEC == SWCODEC && defined (HAVE_RECORDING) */
145 101
146extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5]; 102extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5];
147extern const unsigned char bitmap_icons_6x8[Icon6x8Last][6];
148extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7]; 103extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7];
149extern const unsigned char bitmap_icon_disk[]; 104extern const unsigned char bitmap_icon_disk[];
150 105
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index 9856e80d4a..bb8e4e93c3 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -31,7 +31,7 @@
31#include "logf.h" 31#include "logf.h"
32#include "hangul.h" 32#include "hangul.h"
33#include "action.h" 33#include "action.h"
34#include "icons.h" 34#include "icon.h"
35 35
36#ifndef O_BINARY 36#ifndef O_BINARY
37#define O_BINARY 0 37#define O_BINARY 0
@@ -654,10 +654,9 @@ int kbd_input(char* text, int buflen)
654 /* Draw nicer bitmap arrow if room, else settle for "<". */ 654 /* Draw nicer bitmap arrow if room, else settle for "<". */
655 if (text_w >= 6 && pm->font_h >= 8) 655 if (text_w >= 6 && pm->font_h >= 8)
656 { 656 {
657 sc->mono_bitmap(bitmap_icons_6x8[Icon_Reverse_Cursor], 657 screen_put_iconxy(sc, (text_w - 6) / 2,
658 (text_w - 6) / 2, 658 pm->main_y + (pm->font_h - 8) / 2 ,
659 pm->main_y + (pm->font_h - 8) / 2 , 659 Icon_Reverse_Cursor);
660 6, 8);
661 } 660 }
662 else 661 else
663 { 662 {
@@ -672,10 +671,9 @@ int kbd_input(char* text, int buflen)
672 /* Draw nicer bitmap arrow if room, else settle for ">". */ 671 /* Draw nicer bitmap arrow if room, else settle for ">". */
673 if (text_w >= 6 && pm->font_h >= 8) 672 if (text_w >= 6 && pm->font_h >= 8)
674 { 673 {
675 sc->mono_bitmap(bitmap_icons_6x8[Icon_Cursor], 674 screen_put_iconxy(sc, sc->width - text_w + (text_w - 6) / 2,
676 sc->width - text_w + (text_w - 6) / 2, 675 pm->main_y + (pm->font_h - 8) / 2,
677 pm->main_y + (pm->font_h - 8) / 2, 676 Icon_Cursor);
678 6, 8);
679 } 677 }
680 else 678 else
681 { 679 {
diff --git a/apps/settings.c b/apps/settings.c
index 23b81173bd..f3ce2d41c1 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -853,6 +853,9 @@ void settings_apply(void)
853#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC 853#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
854 enc_global_settings_apply(); 854 enc_global_settings_apply();
855#endif 855#endif
856 /* load the icon set */
857 icons_init();
858
856} 859}
857 860
858 861
@@ -1076,13 +1079,7 @@ static bool do_set_setting(const unsigned char* string, void *variable,
1076 else oldvalue = *(bool*)variable; 1079 else oldvalue = *(bool*)variable;
1077 1080
1078 gui_synclist_init(&lists,value_setting_get_name_cb,(void*)cb_data,false,1); 1081 gui_synclist_init(&lists,value_setting_get_name_cb,(void*)cb_data,false,1);
1079 gui_synclist_set_title(&lists, (char*)string, 1082 gui_synclist_set_title(&lists, (char*)string,Icon_Questionmark);
1080#ifdef HAVE_LCD_BITMAP
1081 bitmap_icons_6x8[Icon_Questionmark]
1082#else
1083 NOICON
1084#endif
1085 );
1086 gui_synclist_set_icon_callback(&lists,NULL); 1083 gui_synclist_set_icon_callback(&lists,NULL);
1087 gui_synclist_set_nb_items(&lists,nb_items); 1084 gui_synclist_set_nb_items(&lists,nb_items);
1088 gui_synclist_limit_scroll(&lists,true); 1085 gui_synclist_limit_scroll(&lists,true);
diff --git a/apps/settings.h b/apps/settings.h
index 33dfb8546a..c27b6e602b 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -55,6 +55,7 @@
55#define LANG_DIR ROCKBOX_DIR "/langs" 55#define LANG_DIR ROCKBOX_DIR "/langs"
56#define WPS_DIR ROCKBOX_DIR "/wps" 56#define WPS_DIR ROCKBOX_DIR "/wps"
57#define THEME_DIR ROCKBOX_DIR "/themes" 57#define THEME_DIR ROCKBOX_DIR "/themes"
58#define ICON_DIR ROCKBOX_DIR "/icons"
58#define PLUGIN_DIR ROCKBOX_DIR "/rocks" 59#define PLUGIN_DIR ROCKBOX_DIR "/rocks"
59#define VIEWERS_DIR ROCKBOX_DIR "/viewers" 60#define VIEWERS_DIR ROCKBOX_DIR "/viewers"
60#define BACKDROP_DIR ROCKBOX_DIR "/backdrops" 61#define BACKDROP_DIR ROCKBOX_DIR "/backdrops"
@@ -706,7 +707,13 @@ struct user_settings
706 (defined(HAVE_RECORDING) || CONFIG_TUNER) 707 (defined(HAVE_RECORDING) || CONFIG_TUNER)
707 int alarm_wake_up_screen; 708 int alarm_wake_up_screen;
708#endif 709#endif
709 710 /* customizable icons */
711 unsigned char icon_file[MAX_FILENAME+1];
712 unsigned char viewers_icon_file[MAX_FILENAME+1];
713#ifdef HAVE_REMOTE_LCD
714 unsigned char remote_icon_file[MAX_FILENAME+1];
715 unsigned char remote_viewers_icon_file[MAX_FILENAME+1];
716#endif
710}; 717};
711 718
712/** global variables **/ 719/** global variables **/
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 3e4e3fb49a..2ebce0ea77 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1160,6 +1160,21 @@ const struct settings_list settings[] = {
1160 {F_T_INT, &global_settings.alarm_wake_up_screen, LANG_ALARM_WAKEUP_SCREEN, 1160 {F_T_INT, &global_settings.alarm_wake_up_screen, LANG_ALARM_WAKEUP_SCREEN,
1161 INT(ALARM_START_WPS), "alarm wakeup screen", ALARM_SETTING_TEXT, UNUSED}, 1161 INT(ALARM_START_WPS), "alarm wakeup screen", ALARM_SETTING_TEXT, UNUSED},
1162#endif /* HAVE_RTC_ALARM */ 1162#endif /* HAVE_RTC_ALARM */
1163
1164 /* Customizable icons */
1165#ifdef HAVE_LCD_BITMAP
1166 FILENAME_SETTING(F_THEMESETTING, icon_file, "iconset", "",
1167 ICON_DIR "/", ".bmp", MAX_FILENAME+1),
1168 FILENAME_SETTING(F_THEMESETTING, viewers_icon_file, "viewers iconset", "",
1169 ICON_DIR "/", ".bmp", MAX_FILENAME+1),
1170#ifdef HAVE_REMOTE_LCD
1171 FILENAME_SETTING(F_THEMESETTING, remote_icon_file, "remote iconset", "",
1172 ICON_DIR "/", ".bmp", MAX_FILENAME+1),
1173 FILENAME_SETTING(F_THEMESETTING, remote_viewers_icon_file,
1174 "remote viewers iconset", "",
1175 ICON_DIR "/", ".bmp", MAX_FILENAME+1),
1176#endif
1177#endif /* HAVE_REMOTE_LCD */
1163}; 1178};
1164 1179
1165const int nb_settings = sizeof(settings)/sizeof(*settings); 1180const int nb_settings = sizeof(settings)/sizeof(*settings);
diff --git a/apps/tagtree.c b/apps/tagtree.c
index 56e8740ac8..41db17b31a 100644
--- a/apps/tagtree.c
+++ b/apps/tagtree.c
@@ -1686,20 +1686,12 @@ int tagtree_get_attr(struct tree_context* c)
1686 return attr; 1686 return attr;
1687} 1687}
1688 1688
1689#ifdef HAVE_LCD_BITMAP 1689int tagtree_get_icon(struct tree_context* c)
1690const unsigned char* tagtree_get_icon(struct tree_context* c)
1691#else
1692int tagtree_get_icon(struct tree_context* c)
1693#endif
1694{ 1690{
1695 int icon = Icon_Folder; 1691 int icon = Icon_Folder;
1696 1692
1697 if (tagtree_get_attr(c) == TREE_ATTR_MPA) 1693 if (tagtree_get_attr(c) == TREE_ATTR_MPA)
1698 icon = Icon_Audio; 1694 icon = Icon_Audio;
1699 1695
1700#ifdef HAVE_LCD_BITMAP
1701 return bitmap_icons_6x8[icon];
1702#else
1703 return icon; 1696 return icon;
1704#endif
1705} 1697}
diff --git a/apps/tagtree.h b/apps/tagtree.h
index ccb71c4470..980dc0d0b4 100644
--- a/apps/tagtree.h
+++ b/apps/tagtree.h
@@ -46,11 +46,7 @@ struct tagentry* tagtree_get_entry(struct tree_context *c, int id);
46bool tagtree_insert_selection_playlist(int position, bool queue); 46bool tagtree_insert_selection_playlist(int position, bool queue);
47char *tagtree_get_title(struct tree_context* c); 47char *tagtree_get_title(struct tree_context* c);
48int tagtree_get_attr(struct tree_context* c); 48int tagtree_get_attr(struct tree_context* c);
49#ifdef HAVE_LCD_BITMAP 49int tagtree_get_icon(struct tree_context* c);
50const unsigned char* tagtree_get_icon(struct tree_context* c);
51#else
52int tagtree_get_icon(struct tree_context* c);
53#endif
54int tagtree_get_filename(struct tree_context* c, char *buf, int buflen); 50int tagtree_get_filename(struct tree_context* c, char *buf, int buflen);
55 51
56#endif 52#endif
diff --git a/apps/tree.c b/apps/tree.c
index 4e4d4c7a9a..944f76840f 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -219,20 +219,20 @@ static char * tree_get_filename(int selected_item, void * data, char *buffer)
219} 219}
220 220
221 221
222static void tree_get_fileicon(int selected_item, void * data, ICON * icon) 222static int tree_get_fileicon(int selected_item, void * data)
223{ 223{
224 struct tree_context * local_tc=(struct tree_context *)data; 224 struct tree_context * local_tc=(struct tree_context *)data;
225#ifdef HAVE_TAGCACHE 225#ifdef HAVE_TAGCACHE
226 bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB; 226 bool id3db = *(local_tc->dirfilter) == SHOW_ID3DB;
227 if (id3db) { 227 if (id3db) {
228 *icon = (ICON)tagtree_get_icon(&tc); 228 return tagtree_get_icon(&tc);
229 } 229 }
230 else 230 else
231#endif 231#endif
232 { 232 {
233 struct entry* dc = local_tc->dircache; 233 struct entry* dc = local_tc->dircache;
234 struct entry* e = &dc[selected_item]; 234 struct entry* e = &dc[selected_item];
235 *icon = (ICON)filetype_get_icon(e->attr); 235 return filetype_get_icon(e->attr);
236 } 236 }
237} 237}
238 238
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 0ad94e06b1..9d537acdda 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -225,6 +225,20 @@
225#define CONFIG_RTC 0 225#define CONFIG_RTC 0
226#endif 226#endif
227 227
228/* define this in the target config.h to use a different size */
229#ifndef CONFIG_DEFAULT_ICON_HEIGHT
230#define CONFIG_DEFAULT_ICON_HEIGHT 8
231#endif
232#ifndef CONFIG_DEFAULT_ICON_WIDTH
233#define CONFIG_DEFAULT_ICON_WIDTH 6
234#endif
235#ifndef CONFIG_REMOTE_DEFAULT_ICON_HEIGHT
236#define CONFIG_REMOTE_DEFAULT_ICON_HEIGHT 8
237#endif
238#ifndef CONFIG_REMOTE_DEFAULT_ICON_WIDTH
239#define CONFIG_REMOTE_DEFAULT_ICON_WIDTH 6
240#endif
241
228/* Enable the directory cache and tagcache in RAM if we have 242/* Enable the directory cache and tagcache in RAM if we have
229 * plenty of RAM. Both features can be enabled independently. */ 243 * plenty of RAM. Both features can be enabled independently. */
230#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \ 244#if ((defined(MEMORYSIZE) && (MEMORYSIZE > 8)) || MEM > 8) && \
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 380c3a41e2..1dc33979af 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -61,6 +61,8 @@ while(1) {
61 61
62 62
63my $firmdir="$ROOT/firmware"; 63my $firmdir="$ROOT/firmware";
64my $appsdir="$ROOT/apps";
65my $viewer_bmpdir="$ROOT/apps/plugins/bitmaps/viewer_defaults";
64 66
65my $cppdef = $target; 67my $cppdef = $target;
66 68
@@ -72,8 +74,17 @@ sub gettargetinfo {
72#ifdef HAVE_LCD_BITMAP 74#ifdef HAVE_LCD_BITMAP
73Bitmap: yes 75Bitmap: yes
74Depth: LCD_DEPTH 76Depth: LCD_DEPTH
77Icon Width: CONFIG_DEFAULT_ICON_WIDTH
78Icon Height: CONFIG_DEFAULT_ICON_HEIGHT
75#endif 79#endif
76Codec: CONFIG_CODEC 80Codec: CONFIG_CODEC
81#ifdef HAVE_REMOTE_LCD
82Remote Depth: LCD_REMOTE_DEPTH
83Remote Icon Width: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
84Remote Icon Height: CONFIG_REMOTE_DEFAULT_ICON_WIDTH
85#else
86Remote Depth: 0
87#endif
77STOP 88STOP
78; 89;
79 close(GCC); 90 close(GCC);
@@ -84,7 +95,9 @@ STOP
84 95
85 open(TARGET, "$c|"); 96 open(TARGET, "$c|");
86 97
87 my ($bitmap, $depth, $swcodec); 98 my ($bitmap, $depth, $swcodec, $icon_h, $icon_w);
99 my ($remote_depth, $remote_icon_h, $remote_icon_w);
100 $icon_count = 1;
88 while(<TARGET>) { 101 while(<TARGET>) {
89 # print STDERR "DATA: $_"; 102 # print STDERR "DATA: $_";
90 if($_ =~ /^Bitmap: (.*)/) { 103 if($_ =~ /^Bitmap: (.*)/) {
@@ -93,15 +106,31 @@ STOP
93 elsif($_ =~ /^Depth: (\d*)/) { 106 elsif($_ =~ /^Depth: (\d*)/) {
94 $depth = $1; 107 $depth = $1;
95 } 108 }
109 elsif($_ =~ /^Icon Width: (\d*)/) {
110 $icon_w = $1;
111 }
112 elsif($_ =~ /^Icon Height: (\d*)/) {
113 $icon_h = $1;
114 }
96 elsif($_ =~ /^Codec: (\d*)/) { 115 elsif($_ =~ /^Codec: (\d*)/) {
97 # SWCODEC is 1, the others are HWCODEC 116 # SWCODEC is 1, the others are HWCODEC
98 $swcodec = ($1 == 1); 117 $swcodec = ($1 == 1);
99 } 118 }
119 elsif($_ =~ /^Remote Depth: (\d*)/) {
120 $remote_depth = $1;
121 }
122 elsif($_ =~ /^Remote Icon Width: (\d*)/) {
123 $remote_icon_w = $1;
124 }
125 elsif($_ =~ /^Remote Icon Height: (\d*)/) {
126 $remote_icon_h = $1;
127 }
100 } 128 }
101 close(TARGET); 129 close(TARGET);
102 unlink("gcctemp"); 130 unlink("gcctemp");
103 131
104 return ($bitmap, $depth, $swcodec); 132 return ($bitmap, $depth, $icon_w, $icon_h,
133 $swcodec, $remote_depth, $remote_icon_w, $remote_icon_h);
105} 134}
106 135
107sub filesize { 136sub filesize {
@@ -130,7 +159,8 @@ sub buildlangs {
130sub buildzip { 159sub buildzip {
131 my ($zip, $image, $fonts)=@_; 160 my ($zip, $image, $fonts)=@_;
132 161
133 my ($bitmap, $depth, $swcodec) = &gettargetinfo(); 162 my ($bitmap, $depth, $icon_w, $icon_h, $swcodec,
163 $remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo();
134 164
135 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n"; 165 # print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
136 166
@@ -261,6 +291,14 @@ sub buildzip {
261 } 291 }
262 close VIEWERS; 292 close VIEWERS;
263 293
294 if ($bitmap) {
295 mkdir ".rockbox/icons", 0777;
296 `cp $viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp .rockbox/icons/viewers.bmp`;
297 if ($remote_depth) {
298 `cp $viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp .rockbox/icons/remote_viewers.bmp`;
299 }
300 }
301
264 `cp $ROOT/apps/tagnavi.config .rockbox/`; 302 `cp $ROOT/apps/tagnavi.config .rockbox/`;
265 303
266 if($bitmap) { 304 if($bitmap) {