summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uisimulator/common/sim_icons.c259
1 files changed, 97 insertions, 162 deletions
diff --git a/uisimulator/common/sim_icons.c b/uisimulator/common/sim_icons.c
index 1d01761f42..1aaf1bb75c 100644
--- a/uisimulator/common/sim_icons.c
+++ b/uisimulator/common/sim_icons.c
@@ -26,181 +26,116 @@
26#include <string.h> 26#include <string.h>
27#include <debug.h> 27#include <debug.h>
28 28
29#define XPOS_volume 54 29static char* icon_battery_3[]=
30#define XPOS_volume1 XPOS_volume + 15 30 {
31#define XPOS_volume2 XPOS_volume1 + 2 31 "*************** ",
32#define XPOS_volume3 XPOS_volume2 + 2 32 "* * ",
33#define XPOS_volume4 XPOS_volume3 + 2 33 "* ** ** ** * ",
34#define XPOS_volume5 XPOS_volume4 + 2 34 "* ** ** ** ***",
35 35 "* ** ** ** ***",
36#define BMPHEIGHT_battery 7 36 "* ** ** ** ***",
37#define BMPWIDTH_battery 14 37 "* ** ** ** * ",
38const unsigned char battery[] = { 38 "* * ",
390x7f, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x7f, 0x14, 0x1c, 39 "*************** ",NULL
40 40 };
41}; 41static char* icon_battery_2[]=
42#define BMPHEIGHT_battery_bit 3 42 {
43#define BMPWIDTH_battery_bit 2 43 "*************** ",
44const unsigned char battery_bit[] = { 44 "* * ",
450x07, 0x07, 45 "* ** ** * ",
46 46 "* ** ** ***",
47}; 47 "* ** ** ***",
48#define BMPHEIGHT_pause 7 48 "* ** ** ***",
49#define BMPWIDTH_pause 7 49 "* ** ** * ",
50const unsigned char pause[] = { 50 "* * ",
510x7f, 0x7f, 0x7f, 0x00, 0x7f, 0x7f, 0x7f, 51 "*************** ",NULL
52 52 };
53}; 53static char* icon_battery_1[]=
54#define BMPHEIGHT_play 7 54 {
55#define BMPWIDTH_play 8 55 "*************** ",
56const unsigned char play[] = { 56 "* * ",
570x7f, 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08, 0x08, 57 "* ** * ",
58 58 "* ** ***",
59}; 59 "* ** ***",
60#define BMPHEIGHT_record 8 60 "* ** ***",
61#define BMPWIDTH_record 4 61 "* ** * ",
62const unsigned char record[] = { 62 "* * ",
630x08, 0x1c, 0x1c, 0x08, 63 "*************** ",NULL
64 64 };
65}; 65static char* icon_battery[]=
66#define BMPHEIGHT_volume 7 66 {
67#define BMPWIDTH_volume 13 67 "*************** ",
68const unsigned char volume[] = { 68 "* * ",
690x0e, 0x30, 0x60, 0x30, 0x0e, 0x30, 0x48, 0x48, 0x48, 0x30, 0x00, 0x7e, 0x00, 69 "* * ",
70 70 "* ***",
71}; 71 "* ***",
72#define BMPHEIGHT_volume1 7 72 "* ***",
73#define BMPWIDTH_volume1 2 73 "* * ",
74const unsigned char volume1[] = { 74 "* * ",
750x00, 0x70, 75 "*************** ",NULL
76 76 };
77}; 77
78#define BMPHEIGHT_volume2 7 78static char* icon_volume[]=
79#define BMPWIDTH_volume2 2 79 {
80const unsigned char volume2[] = { 80 "* * * ",
810x00, 0x78, 81 "* * * ",
82 82 "* * * ",
83}; 83 " * * * ",
84#define BMPHEIGHT_volume3 7 84 " * * * ",
85#define BMPWIDTH_volume3 2 85 " * * * * ",
86const unsigned char volume3[] = { 86 " * * * * ",
870x00, 0x7c, 87 " * * * * ",
88 88 " * * * ",NULL
89}; 89 };
90#define BMPHEIGHT_volume4 7 90static char* icon_volume_1[]={NULL};
91#define BMPWIDTH_volume4 2 91static char* icon_volume_2[]={NULL};
92const unsigned char volume4[] = { 92static char* icon_volume_3[]={NULL};
930x00, 0x7e, 93static char* icon_volume_4[]={NULL};
94 94static char* icon_volume_5[]={NULL};
95}; 95
96#define BMPHEIGHT_volume5 7 96static char* icon_pause[]={NULL};
97#define BMPWIDTH_volume5 2 97static char* icon_play[]={NULL};
98const unsigned char volume5[] = { 98static char* icon_record[]={NULL};
990x00, 0x7f, 99static char* icon_usb[]={NULL};
100 100static char* icon_audio[]={NULL};
101}; 101static char* icon_param[]={NULL};
102#define BMPHEIGHT_usb 7 102static char* icon_repeat[]={NULL};
103#define BMPWIDTH_usb 22 103static char* icon_repeat2[]={NULL};
104const unsigned char usb[] = {
1050x08, 0x1c, 0x1c, 0x08, 0x0c, 0x0e, 0x1b, 0x39, 0x69, 0x49, 0x49, 0x49, 0x4b, 0x4b, 0x48, 0x48, 0x68, 0x68, 0x08, 0x1c, 0x1c, 0x08,
106
107};
108#define BMPHEIGHT_audio 7
109#define BMPWIDTH_audio 27
110const unsigned char audio[] = {
1110x1c, 0x22, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x5d, 0x61, 0x61, 0x5d, 0x41, 0x7d, 0x65, 0x65, 0x59, 0x41, 0x7d, 0x41, 0x59, 0x65, 0x65, 0x59, 0x41, 0x22, 0x1c,
112
113};
114#define BMPHEIGHT_param 7
115#define BMPWIDTH_param 31
116const unsigned char param[] = {
1170x1c, 0x22, 0x41, 0x7d, 0x55, 0x55, 0x49, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x7d, 0x55, 0x75, 0x69, 0x41, 0x79, 0x55, 0x55, 0x79, 0x41, 0x7d, 0x49, 0x51, 0x49, 0x7d, 0x41, 0x22, 0x1c,
118
119};
120
121#define BMPHEIGHT_repeat 7
122#define BMPWIDTH_repeat 12
123const unsigned char repeat[] = {
1240x1c, 0x22, 0x41, 0x41, 0x41, 0x41, 0x71, 0x71, 0x61, 0x61, 0x41, 0x40,
125
126};
127
128#define BMPHEIGHT_repeat1 7
129#define BMPWIDTH_repeat1 3
130const unsigned char repeat1[] = {
1310x42, 0x7f, 0x40,
132
133};
134 104
135struct icon_info 105struct icon_info
136{ 106{
137 const unsigned char* bitmap; 107 char** bitmap;
138 int xpos; 108 int xpos;
139 int ypos; 109 int row;
140 int width;
141 int height;
142}; 110};
143 111
144static struct icon_info icons [] = 112static struct icon_info icons [] =
145{ 113{
146 { battery, 0, 0, BMPWIDTH_battery, BMPHEIGHT_battery }, /* ICON_BATTERY */ 114 {icon_battery, 0, 0},
147 { battery_bit, 2, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_1 */ 115 {icon_battery_1, 0, 0},
148 { battery_bit, 5, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_2 */ 116 {icon_battery_2, 0, 0},
149 { battery_bit, 8, 2, BMPWIDTH_battery_bit, BMPHEIGHT_battery_bit }, /* ICON_BATTERY_3 */ 117 {icon_battery_3, 0, 0},
150 { usb, 0, 40, BMPWIDTH_usb, BMPHEIGHT_usb }, /* ICON_USB */ 118 {icon_usb, 0, 1},
151 { play, 20, 0, BMPWIDTH_play, BMPHEIGHT_play }, /* ICON_PLAY */ 119 {icon_play, 0, 1},
152 { record, 35, 0, BMPWIDTH_record, BMPHEIGHT_record }, /* ICON_RECORD */ 120 {icon_record, 0, 1},
153 { pause, 50, 0, BMPWIDTH_pause, BMPHEIGHT_pause }, /* ICON_PAUSE */ 121 {icon_pause, 0, 1},
154 { audio, 40, 40, BMPWIDTH_audio, BMPHEIGHT_audio }, /* ICON_AUDIO */ 122 {icon_audio, 0, 1},
155 { repeat, XPOS_volume-4-BMPWIDTH_repeat, 123 {icon_repeat, 0, 1},
156 0, BMPWIDTH_repeat, BMPHEIGHT_repeat }, /* ICON_REPEAT */ 124 {icon_repeat2, 0, 1},
157 { repeat1, XPOS_volume-10, 0, BMPWIDTH_repeat1, BMPHEIGHT_repeat1 }, /* ICON_1 */ 125 {icon_volume, 108, 0},
158 { volume, XPOS_volume, 0, BMPWIDTH_volume, BMPHEIGHT_volume }, /* ICON_VOLUME */ 126 {icon_volume_1, 108, 0},
159 { volume1, XPOS_volume1, 0, BMPWIDTH_volume1, BMPHEIGHT_volume1 }, /* ICON_VOLUME1 */ 127 {icon_volume_2, 108, 0},
160 { volume2, XPOS_volume2, 0, BMPWIDTH_volume2, BMPHEIGHT_volume2 }, /* ICON_VOLUME2 */ 128 {icon_volume_3, 108, 0},
161 { volume3, XPOS_volume3, 0, BMPWIDTH_volume3, BMPHEIGHT_volume3 }, /* ICON_VOLUME3 */ 129 {icon_volume_4, 108, 0},
162 { volume4, XPOS_volume4, 0, BMPWIDTH_volume4, BMPHEIGHT_volume4 }, /* ICON_VOLUME4 */ 130 {icon_volume_5, 108, 0},
163 { volume5, XPOS_volume5, 0, BMPWIDTH_volume5, BMPHEIGHT_volume5 }, /* ICON_VOLUME5 */ 131 {icon_param, 0, 1}
164 { param, 90, 40, BMPWIDTH_param, BMPHEIGHT_param }, /* ICON_PARAM */
165};
166
167void display_icon(int icon, bool enable)
168{
169 if (enable)
170 lcd_bitmap((unsigned char*)icons[icon].bitmap, icons[icon].xpos, icons[icon].ypos, icons[icon].width, icons[icon].height, true);
171 else
172 lcd_clearrect(icons[icon].xpos, icons[icon].ypos, icons[icon].width, icons[icon].height);
173}
174
175void sim_battery_icon(int icon, bool enable)
176{
177 static bool battery_icons[4] = { true, true, true, true };
178 int i;
179
180 battery_icons[icon] = enable;
181
182 for (i = 0; i <= ICON_BATTERY_3; ++i)
183 {
184 display_icon(icon, battery_icons[i]);
185 }
186}; 132};
187 133
188void 134void
189lcd_icon(int icon, bool enable) 135lcd_icon(int icon, bool enable)
190{ 136{
191 switch (icon) 137 lcd_print_icon(icons[icon].xpos, icons[icon].row, enable,
192 { 138 icons[icon].bitmap);
193 case ICON_BATTERY:
194 case ICON_BATTERY_1:
195 case ICON_BATTERY_2:
196 case ICON_BATTERY_3:
197 sim_battery_icon(icon, enable);
198 break;
199 default:
200 display_icon(icon, enable);
201 break;
202 }
203 lcd_update();
204} 139}
205 140
206#endif /* HAVE_LCD_CHARCELLS */ 141#endif /* HAVE_LCD_CHARCELLS */