diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 3 | ||||
-rw-r--r-- | apps/plugins/lib/SOURCES | 1 | ||||
-rw-r--r-- | apps/plugins/lib/icon_helper.c | 48 | ||||
-rw-r--r-- | apps/plugins/lib/icon_helper.h | 26 | ||||
-rw-r--r-- | apps/recorder/icons.c | 8 | ||||
-rw-r--r-- | apps/recorder/icons.h | 24 |
7 files changed, 110 insertions, 2 deletions
diff --git a/apps/plugin.c b/apps/plugin.c index 4877c3d255..30269b39e7 100644 --- a/apps/plugin.c +++ b/apps/plugin.c | |||
@@ -178,7 +178,7 @@ static const struct plugin_api rockbox_api = { | |||
178 | &global_settings, | 178 | &global_settings, |
179 | &global_status, | 179 | &global_status, |
180 | language_strings, | 180 | language_strings, |
181 | 181 | &core_bitmaps, | |
182 | /* lcd */ | 182 | /* lcd */ |
183 | splash, | 183 | splash, |
184 | splashf, | 184 | splashf, |
diff --git a/apps/plugin.h b/apps/plugin.h index bd467bcade..023b442295 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -188,6 +188,7 @@ struct plugin_api { | |||
188 | struct user_settings* global_settings; | 188 | struct user_settings* global_settings; |
189 | struct system_status *global_status; | 189 | struct system_status *global_status; |
190 | unsigned char **language_strings; | 190 | unsigned char **language_strings; |
191 | const struct cbmp_bitmap_info_entry *core_bitmaps; | ||
191 | 192 | ||
192 | /* lcd */ | 193 | /* lcd */ |
193 | void (*splash)(int ticks, const char *str); | 194 | void (*splash)(int ticks, const char *str); |
@@ -700,7 +701,7 @@ struct plugin_api { | |||
700 | void (*dsp_eq_enable)(bool enable); | 701 | void (*dsp_eq_enable)(bool enable); |
701 | void (*dsp_dither_enable)(bool enable); | 702 | void (*dsp_dither_enable)(bool enable); |
702 | #ifdef HAVE_PITCHCONTROL | 703 | #ifdef HAVE_PITCHCONTROL |
703 | void (*dsp_set_timestretch)(int32_t percent); | 704 | void (*dsp_set_timestretch)(int32_t percent); |
704 | #endif | 705 | #endif |
705 | intptr_t (*dsp_configure)(struct dsp_config *dsp, | 706 | intptr_t (*dsp_configure)(struct dsp_config *dsp, |
706 | unsigned int setting, intptr_t value); | 707 | unsigned int setting, intptr_t value); |
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index 811771e0ca..6d5fe6cb5f 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES | |||
@@ -2,6 +2,7 @@ sha1.c | |||
2 | gcc-support.c | 2 | gcc-support.c |
3 | pluginlib_actions.c | 3 | pluginlib_actions.c |
4 | helper.c | 4 | helper.c |
5 | icon_helper.c | ||
5 | md5.c | 6 | md5.c |
6 | jhash.c | 7 | jhash.c |
7 | configfile.c | 8 | configfile.c |
diff --git a/apps/plugins/lib/icon_helper.c b/apps/plugins/lib/icon_helper.c new file mode 100644 index 0000000000..857bddb128 --- /dev/null +++ b/apps/plugins/lib/icon_helper.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2021 William Wilgus | ||
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 | #include "plugin.h" | ||
23 | #include "icon_helper.h" | ||
24 | |||
25 | const unsigned char* cbmp_get_icon(unsigned int cbmp_fmt, unsigned int index, int *width, int *height) | ||
26 | { | ||
27 | const unsigned char* bmp = NULL; | ||
28 | while (cbmp_fmt < CBMP_BitmapFormatLast) | ||
29 | { | ||
30 | const struct cbmp_bitmap_info_entry *cbmp = &rb->core_bitmaps[cbmp_fmt]; | ||
31 | if (index > cbmp->count) | ||
32 | break; | ||
33 | int w = cbmp->width; | ||
34 | int h = cbmp->height; | ||
35 | /* ((height/CHAR_BIT) Should always be 1 thus far */ | ||
36 | |||
37 | off_t offset = (((unsigned)h/CHAR_BIT) * (index * w)); | ||
38 | bmp = cbmp->pbmp + offset; | ||
39 | |||
40 | if (width) | ||
41 | *width = w; | ||
42 | if (height) | ||
43 | *height = h; | ||
44 | break; | ||
45 | } | ||
46 | |||
47 | return bmp; | ||
48 | } | ||
diff --git a/apps/plugins/lib/icon_helper.h b/apps/plugins/lib/icon_helper.h new file mode 100644 index 0000000000..e30a607a3f --- /dev/null +++ b/apps/plugins/lib/icon_helper.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2021 William Wilgus | ||
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 | #ifndef _LIB_ICON_HELPER_H_ | ||
22 | #define _LIB_ICON_HELPER_H_ | ||
23 | |||
24 | #include "plugin.h" | ||
25 | const unsigned char* cbmp_get_icon(unsigned int cbmp_fmt, unsigned int index, int *width, int *height); | ||
26 | #endif /* _LIB_ICON_HELPER_H_ */ | ||
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index cc53716674..de623d28b7 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -122,3 +122,11 @@ const unsigned char bitmap_icon_disk[12] = | |||
122 | {0x00,0x00,0x00,0x1c,0x2e,0x4f,0x77,0x79,0x3a,0x1c,0x00,0x00}; | 122 | {0x00,0x00,0x00,0x1c,0x2e,0x4f,0x77,0x79,0x3a,0x1c,0x00,0x00}; |
123 | #endif | 123 | #endif |
124 | 124 | ||
125 | const struct cbmp_bitmap_info_entry core_bitmaps[CBMP_BitmapFormatLast] = /* */ | ||
126 | { | ||
127 | /* index, pointer, w, h, count */ | ||
128 | [CBMP_Mono_5x8] = {bitmap_icons_5x8[0], 5,8, Icon5x8Last}, | ||
129 | [CBMP_Mono_7x8] = {bitmap_icons_7x8[0], 7, 8, Icon7x8Last}, | ||
130 | [CBMP_Mono_12x8] = {bitmap_icon_disk, 12, 8, 1}, | ||
131 | }; | ||
132 | |||
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h index 249453a943..944f319415 100644 --- a/apps/recorder/icons.h +++ b/apps/recorder/icons.h | |||
@@ -32,7 +32,25 @@ | |||
32 | #ifdef HAVE_REMOTE_LCD | 32 | #ifdef HAVE_REMOTE_LCD |
33 | #include "bitmaps/remote_rockboxlogo.h" | 33 | #include "bitmaps/remote_rockboxlogo.h" |
34 | #endif | 34 | #endif |
35 | #endif /* PLUGIN */ | ||
36 | |||
37 | struct cbmp_bitmap_info_entry /* */ | ||
38 | { | ||
39 | const unsigned char* pbmp; | ||
40 | unsigned char width; | ||
41 | unsigned char height; /* !ASSUMES MULTIPLES OF 8! */ | ||
42 | unsigned char count; | ||
43 | }; | ||
44 | |||
45 | enum cbmp_bitmap_format | ||
46 | { | ||
47 | CBMP_Mono_5x8 = 0, | ||
48 | CBMP_Mono_7x8, | ||
49 | CBMP_Mono_12x8, | ||
50 | CBMP_BitmapFormatLast | ||
51 | }; | ||
35 | 52 | ||
53 | extern const struct cbmp_bitmap_info_entry core_bitmaps[CBMP_BitmapFormatLast]; | ||
36 | 54 | ||
37 | /* Symbolic names for icons */ | 55 | /* Symbolic names for icons */ |
38 | enum icons_5x8 { | 56 | enum icons_5x8 { |
@@ -65,6 +83,12 @@ enum icons_7x8 { | |||
65 | Icon7x8Last | 83 | Icon7x8Last |
66 | }; | 84 | }; |
67 | 85 | ||
86 | enum icons_12x8 { | ||
87 | Icon_Disk, | ||
88 | Icon12x8Last | ||
89 | }; | ||
90 | |||
91 | #ifndef PLUGIN | ||
68 | #if defined (HAVE_RECORDING) | 92 | #if defined (HAVE_RECORDING) |
69 | #define BM_GLYPH_WIDTH 4 | 93 | #define BM_GLYPH_WIDTH 4 |
70 | enum Glyphs_4x8 { | 94 | enum Glyphs_4x8 { |