1 | diff -xrevision -x.svn -x.DS_Store -Naur a/i386/boot2/gui.c b/i386/boot2/gui.c␊ |
2 | --- a/i386/boot2/gui.c␉2012-05-08 19:40:04.000000000 +0100␊ |
3 | +++ b/i386/boot2/gui.c␉2012-05-27 02:04:24.000000000 +0100␊ |
4 | @@ -15,7 +15,7 @@␊ |
5 | ␊ |
6 | #define IMG_REQUIRED -1␊ |
7 | #define THEME_NAME_DEFAULT␉"Default"␊ |
8 | -static const char *theme_name = THEME_NAME_DEFAULT;␉␊ |
9 | +static const char *theme_name = THEME_NAME_DEFAULT;␊ |
10 | ␊ |
11 | #ifdef CONFIG_EMBED_THEME␊ |
12 | #include "art.h"␊ |
13 | @@ -43,23 +43,27 @@␊ |
14 | iDeviceGeneric_o,␊ |
15 | iDeviceHFS,␊ |
16 | iDeviceHFS_o,␊ |
17 | -␉iDeviceHFS_Lion,␊ |
18 | + iDeviceHFS_ML,␊ |
19 | + iDeviceHFS_ML_o,␊ |
20 | + iDeviceHFS_Lion,␊ |
21 | iDeviceHFS_Lion_o,␊ |
22 | -␉iDeviceHFS_SL,␊ |
23 | + iDeviceHFS_SL,␊ |
24 | iDeviceHFS_SL_o,␊ |
25 | -␉iDeviceHFS_Leo,␊ |
26 | + iDeviceHFS_Leo,␊ |
27 | iDeviceHFS_Leo_o,␊ |
28 | -␉iDeviceHFS_Tiger,␊ |
29 | + iDeviceHFS_Tiger,␊ |
30 | iDeviceHFS_Tiger_o,␊ |
31 | iDeviceHFSRAID,␊ |
32 | iDeviceHFSRAID_o,␊ |
33 | -␉iDeviceHFSRAID_Lion,␊ |
34 | + iDeviceHFSRAID_ML,␊ |
35 | + iDeviceHFSRAID_ML_o,␊ |
36 | + iDeviceHFSRAID_Lion,␊ |
37 | iDeviceHFSRAID_Lion_o,␊ |
38 | -␉iDeviceHFSRAID_SL,␊ |
39 | + iDeviceHFSRAID_SL,␊ |
40 | iDeviceHFSRAID_SL_o,␊ |
41 | -␉iDeviceHFSRAID_Leo,␊ |
42 | + iDeviceHFSRAID_Leo,␊ |
43 | iDeviceHFSRAID_Leo_o,␊ |
44 | -␉iDeviceHFSRAID_Tiger,␊ |
45 | + iDeviceHFSRAID_Tiger,␊ |
46 | iDeviceHFSRAID_Tiger_o,␊ |
47 | iDeviceEXT3,␊ |
48 | iDeviceEXT3_o,␊ |
49 | @@ -113,26 +117,30 @@␊ |
50 | {.name = "device_generic", .image = NULL},␊ |
51 | {.name = "device_generic_o", .image = NULL},␊ |
52 | {.name = "device_hfsplus", .image = NULL},␊ |
53 | - {.name = "device_hfsplus_o", .image = NULL},␉␊ |
54 | -␉{.name = "device_hfsplus_lion", .image = NULL},␊ |
55 | - {.name = "device_hfsplus_lion_o", .image = NULL},␊ |
56 | -␉{.name = "device_hfsplus_sl", .image = NULL},␊ |
57 | - {.name = "device_hfsplus_sl_o", .image = NULL},␊ |
58 | -␉{.name = "device_hfsplus_leo", .image = NULL},␊ |
59 | - {.name = "device_hfsplus_leo_o", .image = NULL},␊ |
60 | -␉{.name = "device_hfsplus_tiger", .image = NULL},␊ |
61 | - {.name = "device_hfsplus_tiger_o", .image = NULL},␊ |
62 | -␉␊ |
63 | + {.name = "device_hfsplus_o", .image = NULL},␊ |
64 | + {.name = "device_hfsplus_ml", .image = NULL},␊ |
65 | + {.name = "device_hfsplus_ml_o", .image = NULL},␊ |
66 | + {.name = "device_hfsplus_lion", .image = NULL},␊ |
67 | + {.name = "device_hfsplus_lion_o", .image = NULL},␊ |
68 | + {.name = "device_hfsplus_sl", .image = NULL},␊ |
69 | + {.name = "device_hfsplus_sl_o", .image = NULL},␊ |
70 | + {.name = "device_hfsplus_leo", .image = NULL},␊ |
71 | + {.name = "device_hfsplus_leo_o", .image = NULL},␊ |
72 | + {.name = "device_hfsplus_tiger", .image = NULL},␊ |
73 | + {.name = "device_hfsplus_tiger_o", .image = NULL},␊ |
74 | +␊ |
75 | {.name = "device_hfsraid", .image = NULL},␊ |
76 | {.name = "device_hfsraid_o", .image = NULL},␊ |
77 | -␉{.name = "device_hfsraid_lion", .image = NULL},␊ |
78 | - {.name = "device_hfsraid_lion_o", .image = NULL},␊ |
79 | -␉{.name = "device_hfsraid_sl", .image = NULL},␊ |
80 | - {.name = "device_hfsraid_sl_o", .image = NULL},␊ |
81 | -␉{.name = "device_hfsraid_leo", .image = NULL},␊ |
82 | - {.name = "device_hfsraid_leo_o", .image = NULL},␊ |
83 | -␉{.name = "device_hfsraid_tiger", .image = NULL},␊ |
84 | - {.name = "device_hfsraid_tiger_o", .image = NULL},␊ |
85 | + {.name = "device_hfsraid_ml", .image = NULL},␊ |
86 | + {.name = "device_hfsraid_ml_o", .image = NULL},␊ |
87 | + {.name = "device_hfsraid_lion", .image = NULL},␊ |
88 | + {.name = "device_hfsraid_lion_o", .image = NULL},␊ |
89 | + {.name = "device_hfsraid_sl", .image = NULL},␊ |
90 | + {.name = "device_hfsraid_sl_o", .image = NULL},␊ |
91 | + {.name = "device_hfsraid_leo", .image = NULL},␊ |
92 | + {.name = "device_hfsraid_leo_o", .image = NULL},␊ |
93 | + {.name = "device_hfsraid_tiger", .image = NULL},␊ |
94 | + {.name = "device_hfsraid_tiger_o", .image = NULL},␊ |
95 | {.name = "device_ext3", .image = NULL},␊ |
96 | {.name = "device_ext3_o", .image = NULL},␊ |
97 | {.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
98 | @@ -189,7 +197,7 @@␊ |
99 | extern char gBootArgs[BOOT_STRING_LEN];␊ |
100 | ␊ |
101 | char prompt_text[] = "boot: ";␊ |
102 | - ␊ |
103 | +␊ |
104 | menuitem_t infoMenuItems[] =␊ |
105 | {␊ |
106 | ␉{ .text = "Boot" },␊ |
107 | @@ -306,7 +314,7 @@␊ |
108 | unsigned int embed_size;␊ |
109 | embed_data = embeddedImages[e].pngdata;␊ |
110 | embed_size = *embeddedImages[e].length;␊ |
111 | - ␊ |
112 | +␊ |
113 | if (loadEmbeddedPngImage(embed_data, embed_size, &width, &height, &imagedata) == 0)␊ |
114 | {␊ |
115 | images[i].image->width = width;␊ |
116 | @@ -330,9 +338,9 @@␊ |
117 | ␉␉␉␉images[i].image->pixels = images[alt_image].image->pixels;␊ |
118 | ␉␉␉␉␊ |
119 | ␉␉␉} else {␊ |
120 | - ␊ |
121 | +␊ |
122 | ␉␉␉␉// Unable to load or to find the image, this image not vital anyway, reseting and returning success !!␊ |
123 | - ␊ |
124 | +␊ |
125 | ␉␉␉␉free(images[i].image);␊ |
126 | ␉␉␉␉images[i].image = NULL;␊ |
127 | ␉␉␉} ␊ |
128 | @@ -348,9 +356,9 @@␊ |
129 | ␉␉␉free(images[i].image);␊ |
130 | ␉␉␉images[i].image = NULL;␊ |
131 | ␉␉␉return 1;␊ |
132 | - ␊ |
133 | +␊ |
134 | } ␊ |
135 | - ␊ |
136 | +␊ |
137 | }␊ |
138 | ␉return 1;␊ |
139 | }␊ |
140 | @@ -364,6 +372,8 @@␊ |
141 | ␉LOADPNG(device_generic_o, iDeviceGeneric);␊ |
142 | ␉LOADPNG(device_hfsplus, iDeviceGeneric);␊ |
143 | ␉LOADPNG(device_hfsplus_o, iDeviceHFS);␊ |
144 | +␉LOADPNG(device_hfsplus_ml, iDeviceHFS_ML);␊ |
145 | +␉LOADPNG(device_hfsplus_ml_o, iDeviceHFS_ML_o);␊ |
146 | ␉LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion);␊ |
147 | ␉LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o);␊ |
148 | ␉LOADPNG(device_hfsplus_sl, iDeviceHFS_SL);␊ |
149 | @@ -372,17 +382,19 @@␊ |
150 | ␉LOADPNG(device_hfsplus_leo_o, iDeviceHFS_Leo_o);␊ |
151 | ␉LOADPNG(device_hfsplus_tiger, iDeviceHFS_Tiger);␊ |
152 | ␉LOADPNG(device_hfsplus_tiger_o, iDeviceHFS_Tiger_o);␊ |
153 | -␉␊ |
154 | +␊ |
155 | ␉LOADPNG(device_hfsraid, iDeviceGeneric);␊ |
156 | ␉LOADPNG(device_hfsraid_o, iDeviceHFSRAID);␊ |
157 | -␉LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);␊ |
158 | -␉LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);␊ |
159 | -␉LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);␊ |
160 | -␉LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);␊ |
161 | -␉LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);␊ |
162 | -␉LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo_o);␊ |
163 | -␉LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID_Tiger);␊ |
164 | -␉LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger_o);␊ |
165 | +␉LOADPNG(device_hfsraid_ml, iDeviceHFSRAID_ML);␊ |
166 | +␉LOADPNG(device_hfsraid_ml_o, iDeviceHFSRAID_ML_o);␊ |
167 | +␉LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);␊ |
168 | +␉LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);␊ |
169 | +␉LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);␊ |
170 | +␉LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);␊ |
171 | +␉LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);␊ |
172 | +␉LOADPNG(device_hfsraid_leo_o, iDeviceHFSRAID_Leo_o);␊ |
173 | +␉LOADPNG(device_hfsraid_tiger, iDeviceHFSRAID_Tiger);␊ |
174 | +␉LOADPNG(device_hfsraid_tiger_o, iDeviceHFSRAID_Tiger_o);␊ |
175 | ␉LOADPNG(device_ext3, iDeviceGeneric);␊ |
176 | ␉LOADPNG(device_ext3_o, iDeviceEXT3);␊ |
177 | ␉LOADPNG(device_freebsd, iDeviceGeneric); /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
178 | @@ -432,14 +444,13 @@␊ |
179 | ␊ |
180 | ␉return 0;␊ |
181 | }␊ |
182 | - ␊ |
183 | +␊ |
184 | static int unloadGraphics(void)␊ |
185 | {␊ |
186 | int i;␊ |
187 | ␊ |
188 | destroyFont(&font_console);␊ |
189 | destroyFont(&font_small);␊ |
190 | -␊ |
191 | ␉for (i = 0; i < sizeof(images) / sizeof(images[0]); i++)␊ |
192 | ␉{␊ |
193 | ␉ if (images[i].image)␊ |
194 | @@ -452,6 +463,19 @@␊ |
195 | ␉return 0;␊ |
196 | }␊ |
197 | ␊ |
198 | +int freeBackBuffer( window_t *window )␊ |
199 | +{␊ |
200 | + if (gui.backbuffer && gui.backbuffer->pixels)␊ |
201 | + {␊ |
202 | + free(gui.backbuffer->pixels);␊ |
203 | + free(gui.backbuffer);␊ |
204 | + gui.backbuffer = 0;␊ |
205 | + return 0;␊ |
206 | + }␊ |
207 | +␊ |
208 | + return 1;␊ |
209 | +}␊ |
210 | +␊ |
211 | pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height )␊ |
212 | {␊ |
213 | ␉␊ |
214 | @@ -482,8 +506,9 @@␊ |
215 | {␊ |
216 | ␉gui.backbuffer = malloc(sizeof(pixmap_t));␊ |
217 | ␉if(!gui.backbuffer)␊ |
218 | +␉{␊ |
219 | ␉␉return 1;␊ |
220 | -␉␊ |
221 | +␉}␊ |
222 | ␉gui.backbuffer->pixels = malloc( window->width * window->height * 4 );␊ |
223 | ␉if(!gui.backbuffer->pixels)␊ |
224 | ␉{␊ |
225 | @@ -494,28 +519,17 @@␊ |
226 | ␉␊ |
227 | ␉gui.backbuffer->width = gui.screen.width;␊ |
228 | ␉gui.backbuffer->height = gui.screen.height;␊ |
229 | - ␊ |
230 | -␉return 0;␊ |
231 | -}␊ |
232 | -␊ |
233 | -int freeBackBuffer( window_t *window )␊ |
234 | -{␊ |
235 | -␉if (gui.backbuffer && gui.backbuffer->pixels)␊ |
236 | - {␊ |
237 | -␉␉free(gui.backbuffer->pixels);␊ |
238 | -␉␉free(gui.backbuffer);␊ |
239 | -␉␉gui.backbuffer = 0;␊ |
240 | -␉␉return 0;␊ |
241 | -␉}␊ |
242 | ␊ |
243 | -␉return 1;␊ |
244 | +␉return 0;␊ |
245 | }␊ |
246 | ␊ |
247 | int createWindowBuffer( window_t *window )␊ |
248 | {␊ |
249 | ␉window->pixmap = malloc(sizeof(pixmap_t));␊ |
250 | ␉if(!window->pixmap)␊ |
251 | +␉{␊ |
252 | ␉␉return 1;␊ |
253 | +␉}␊ |
254 | ␊ |
255 | ␉window->pixmap->pixels = malloc( window->width * window->height * 4 );␊ |
256 | ␉if(!window->pixmap->pixels)␊ |
257 | @@ -527,7 +541,7 @@␊ |
258 | ␉␊ |
259 | ␉window->pixmap->width = window->width;␊ |
260 | ␉window->pixmap->height = window->height;␊ |
261 | -␉␉␊ |
262 | +␊ |
263 | ␉return 0;␊ |
264 | }␊ |
265 | ␊ |
266 | @@ -539,7 +553,7 @@␊ |
267 | ␉␉free(window->pixmap);␊ |
268 | ␉␉return 0;␊ |
269 | ␉}␊ |
270 | -␉␉␊ |
271 | +␊ |
272 | ␉return 1;␊ |
273 | }␊ |
274 | ␊ |
275 | @@ -606,7 +620,7 @@␊ |
276 | ␉␉if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )␊ |
277 | ␉␉␉gui.devicelist.pos.y = pixel;␊ |
278 | ␉␉break;␊ |
279 | -␉␉␊ |
280 | +␊ |
281 | ␉case HorizontalLayout:␊ |
282 | ␉default:␊ |
283 | ␉␉gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);␊ |
284 | @@ -790,7 +804,7 @@␊ |
285 | ␉if(getColorForKey("font_console_color", &color, theme))␊ |
286 | ␉␉gui.screen.font_console_color = (color & 0x00FFFFFF);␊ |
287 | }␊ |
288 | - ␊ |
289 | +␊ |
290 | int initGUI(void)␊ |
291 | {␊ |
292 | ␉int␉␉val;␊ |
293 | @@ -859,14 +873,16 @@␊ |
294 | ␉␉␉}␊ |
295 | ␉␉}␊ |
296 | ␉}␊ |
297 | -␉// not available memory, freeing resources␊ |
298 | -␉freeWindowBuffer(&gui.menu);␊ |
299 | -␉freeWindowBuffer(&gui.infobox);␊ |
300 | -␉freeWindowBuffer(&gui.bootprompt);␊ |
301 | -␉freeWindowBuffer(&gui.devicelist);␊ |
302 | -␉freeWindowBuffer(&gui.screen);␊ |
303 | -␉freeBackBuffer(&gui.screen);␊ |
304 | -␉unloadGraphics();␊ |
305 | +␊ |
306 | + // not available memory, freeing resources␊ |
307 | + freeWindowBuffer(&gui.menu);␊ |
308 | + freeWindowBuffer(&gui.infobox);␊ |
309 | + freeWindowBuffer(&gui.bootprompt);␊ |
310 | + freeWindowBuffer(&gui.devicelist);␊ |
311 | + freeWindowBuffer(&gui.screen);␊ |
312 | + freeBackBuffer(&gui.screen);␊ |
313 | + unloadGraphics();␊ |
314 | +␊ |
315 | ␉return 1;␊ |
316 | }␊ |
317 | ␊ |
318 | @@ -889,9 +905,13 @@␊ |
319 | ␉␉␉{␉␉␉␉␊ |
320 | ␊ |
321 | ␉␉␉␉// Use HFS or HFSRAID icon depending on bvr flags.␊ |
322 | -␉␉␉␉if (device->flags & kBVFlagBooter) {␊ |
323 | +␉␉␉␉if (device->flags & kBVFlagBooter)␊ |
324 | +␉␉␉␉{␊ |
325 | ␊ |
326 | ␉␉␉␉␉switch (device->OSVersion[3]) {␊ |
327 | +␉␉␉␉␉␉case '8':␊ |
328 | +␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFSRAID_ML) ? iDeviceHFSRAID_ML : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;␊ |
329 | +␉␉␉␉␉␉␉break;␊ |
330 | ␉␉␉␉␉␉case '7':␊ |
331 | ␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;␊ |
332 | ␉␉␉␉␉␉␉break;␊ |
333 | @@ -909,11 +929,12 @@␊ |
334 | ␉␉␉␉␉␉␉break;␊ |
335 | ␉␉␉␉␉}␊ |
336 | ␉␉␉␉␉␊ |
337 | -␉␉␉␉} ␊ |
338 | - else␊ |
339 | -␉␉␉␉{␉␉␉␉␉␊ |
340 | -␉␉␉␉␉␊ |
341 | +␉␉␉␉} else {␉␉␉␉␉␊ |
342 | +␊ |
343 | ␉␉␉␉␉switch (device->OSVersion[3]) {␊ |
344 | +␉␉␉␉␉␉case '8':␊ |
345 | +␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFS_ML) ? iDeviceHFS_ML : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;␊ |
346 | +␉␉␉␉␉␉␉break;␊ |
347 | ␉␉␉␉␉␉case '7':␊ |
348 | ␉␉␉␉␉␉␉devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;␊ |
349 | ␉␉␉␉␉␉␉break;␊ |
350 | @@ -939,31 +960,31 @@␊ |
351 | ␉␉␉case kPartitionTypeHPFS:␊ |
352 | ␉␉␉␉devicetype = is_image_loaded(iDeviceNTFS) ? iDeviceNTFS : iDeviceGeneric;␉␉// Use HPFS / NTFS icon␊ |
353 | ␉␉␉␉break;␊ |
354 | -␉␉␉␉␊ |
355 | +␊ |
356 | ␉␉␉case kPartitionTypeFAT16:␊ |
357 | ␉␉␉␉devicetype = is_image_loaded(iDeviceFAT16) ? iDeviceFAT16 : iDeviceGeneric;␉␉// Use FAT16 icon␊ |
358 | ␉␉␉␉break;␊ |
359 | -␉␉␉␉␊ |
360 | +␊ |
361 | ␉␉␉case kPartitionTypeFAT32:␊ |
362 | ␉␉␉␉devicetype = is_image_loaded(iDeviceFAT32) ? iDeviceFAT32 : iDeviceGeneric;␉␉// Use FAT32 icon␊ |
363 | ␉␉␉␉break;␊ |
364 | -␉␉␉␉␊ |
365 | +␊ |
366 | ␉␉␉case kPartitionTypeEXT3:␊ |
367 | ␉␉␉␉devicetype = is_image_loaded(iDeviceEXT3) ? iDeviceEXT3 : iDeviceGeneric;␉␉// Use EXT2/3 icon␊ |
368 | ␉␉␉␉break;␊ |
369 | -␉␉␉␉␊ |
370 | -␉␉␉case kPartitionTypeFreeBSD:␊ |
371 | +␊ |
372 | +␉␉␉case kPartitionTypeFreeBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
373 | ␉␉␉␉devicetype = is_image_loaded(iDeviceFreeBSD) ? iDeviceFreeBSD : iDeviceGeneric;␉␉// Use FreeBSD icon␊ |
374 | ␉␉␉␉break;␊ |
375 | -␉␉␉␉␊ |
376 | -␉␉␉case kPartitionTypeOpenBSD:␊ |
377 | +␊ |
378 | +␉␉␉case kPartitionTypeOpenBSD: /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */␊ |
379 | ␉␉␉␉devicetype = is_image_loaded(iDeviceOpenBSD) ? iDeviceOpenBSD : iDeviceGeneric;␉␉// Use OpenBSD icon␊ |
380 | ␉␉␉␉break;␊ |
381 | -␉␉␉␉␊ |
382 | -␉␉␉case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */␊ |
383 | +␊ |
384 | +␉␉␉case kPartitionTypeBEFS: /* Haiku detection and Icon credits to scorpius */␊ |
385 | ␉␉␉␉devicetype = is_image_loaded(iDeviceBEFS) ? iDeviceBEFS : iDeviceGeneric;// Use BEFS / Haiku icon␊ |
386 | ␉␉␉␉break;␊ |
387 | -␉␉␉␉␊ |
388 | +␊ |
389 | ␉␉␉default:␊ |
390 | ␉␉␉␉devicetype = iDeviceGeneric;␉// Use Generic icon␊ |
391 | ␉␉␉␉break;␊ |
392 | @@ -974,7 +995,7 @@␊ |
393 | if (isSelected)␊ |
394 | ␉{␊ |
395 | ␉␉blend(images[iSelection].image, buffer, centeredAt(images[iSelection].image, p));␊ |
396 | -␉␉devicetype++;␊ |
397 | +␉␉devicetype++; // selec override image ␊ |
398 | ␉}␊ |
399 | ␊ |
400 | ␉// draw icon␊ |
401 | @@ -995,7 +1016,7 @@␊ |
402 | ␉position_t␉p, p_prev, p_next;␊ |
403 | ␊ |
404 | ␉//uint8_t␉maxDevices = MIN( gui.maxdevices, menucount );␊ |
405 | -␉␉␊ |
406 | +␊ |
407 | ␉fillPixmapWithColor( gui.devicelist.pixmap, gui.devicelist.bgcolor);␊ |
408 | ␊ |
409 | ␉makeRoundedCorners( gui.devicelist.pixmap);␊ |
410 | @@ -1045,7 +1066,7 @@␊ |
411 | if(infoMenuSelection >= INFOMENU_NATIVEBOOT_START && infoMenuSelection <= INFOMENU_NATIVEBOOT_END)␊ |
412 | infoMenuSelection = 0;␊ |
413 | }␊ |
414 | -␉␉␉ ␊ |
415 | +␊ |
416 | ␉␉␉if (gui.menu.draw)␊ |
417 | ␉␉␉␉drawInfoMenuItems();␊ |
418 | ␉␉␉␊ |
419 | @@ -1098,7 +1119,7 @@␊ |
420 | ␉updateVRAM();␊ |
421 | ␉␊ |
422 | }␊ |
423 | - ␊ |
424 | +␊ |
425 | void clearGraphicBootPrompt()␊ |
426 | {␊ |
427 | ␉// clear text buffer␊ |
428 | @@ -1172,7 +1193,7 @@␊ |
429 | ␉␉␉␉␉␉//␉␉␉␉␉␉break;␉␉␉␉␉␉␉␊ |
430 | ␉␉␉␉␉case 15:␊ |
431 | ␉␉␉␉␉␉*(uint16_t *)(((uint8_t *)vram)+i*VIDEO (rowBytes) + j*2) = ((b&0xf8)>>3) | ((g&0xf8)<<2) | ((r&0xf8)<<7);␊ |
432 | -␉␉␉␉␉␉break;␉␉␉␉␉␉␉␉␉␉␉␉␉␉␊ |
433 | +␉␉␉␉␉␉break;␉␊ |
434 | ␉␉␉␉}␊ |
435 | ␉␉␉}␊ |
436 | ␉}␊ |
437 | @@ -1187,14 +1208,14 @@␊ |
438 | ␊ |
439 | ␉␉if (gui.bootprompt.draw)␊ |
440 | ␉␉␉blend( gui.bootprompt.pixmap, gui.backbuffer, gui.bootprompt.pos );␊ |
441 | -␉␉␉␉␊ |
442 | +␊ |
443 | ␉␉if (gui.menu.draw)␊ |
444 | ␉␉␉blend( gui.menu.pixmap, gui.backbuffer, gui.menu.pos );␊ |
445 | ␉␉␊ |
446 | ␉␉if (gui.infobox.draw)␊ |
447 | ␉␉␉blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos );␊ |
448 | ␉}␊ |
449 | -␉␊ |
450 | +␊ |
451 | ␉vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height );␊ |
452 | ␊ |
453 | ␉if (gui.redraw)␊ |
454 | @@ -1251,15 +1272,15 @@␊ |
455 | ␉␉bounds.y = ( window->height - window->vborder );␊ |
456 | ␉␉␊ |
457 | ␉␉cursor = origin;␊ |
458 | -␉␉␉␊ |
459 | +␊ |
460 | ␉␉font_t *font = &font_console;␊ |
461 | -␉␉␉␊ |
462 | +␊ |
463 | ␉␉for( i=0; i< strlen(formattedtext); i++ )␊ |
464 | ␉␉{␊ |
465 | ␉␉␉character = formattedtext[i];␊ |
466 | ␉␉␉␊ |
467 | ␉␉␉character -= 32;␊ |
468 | -␉␉␉␉␊ |
469 | +␊ |
470 | ␉␉␉// newline ?␊ |
471 | ␉␉␉if( formattedtext[i] == '\n' )␊ |
472 | ␉␉␉{␊ |
473 | @@ -1271,7 +1292,7 @@␊ |
474 | ␊ |
475 | ␉␉␉␉continue;␊ |
476 | ␉␉␉}␊ |
477 | -␉␉␉␉␊ |
478 | +␊ |
479 | ␉␉␉// tab ?␊ |
480 | ␉␉␉if( formattedtext[i] == '\t' )␊ |
481 | ␉␉␉␉cursor.x += ( font->chars[0]->width * 5 );␊ |
482 | @@ -1414,7 +1435,7 @@␊ |
483 | ␉␉bounds.x = ( window->width - ( window->hborder * 2 ) );␊ |
484 | ␉␉bounds.y = ( window->height - ( window->vborder * 2 ) );␊ |
485 | ␉␉cursor = origin;␊ |
486 | -␉␉␉␊ |
487 | +␊ |
488 | ␉␉for( i=0; i< strlen(formattedtext); i++ )␊ |
489 | ␉␉{␊ |
490 | ␉␉␉character = formattedtext[i];␊ |
491 | @@ -1449,7 +1470,7 @@␊ |
492 | ␉␉␉␉cursor.x = origin.x;␊ |
493 | ␉␉␉␉cursor.y += font->height;␊ |
494 | ␉␉␉}␊ |
495 | -␉␉␉␉␊ |
496 | +␊ |
497 | ␉␉␉// check y pos and reset to origin.y␊ |
498 | ␉␉␉if ( cursor.y > ( bounds.y + font->chars[0]->height) )␊ |
499 | ␉␉␉{␊ |
500 | @@ -1548,6 +1569,21 @@␊ |
501 | ␉drawStr(text, font, blendInto, p);␊ |
502 | }␊ |
503 | ␊ |
504 | +int destroyFont(font_t *font)␊ |
505 | +{␊ |
506 | + int i;␊ |
507 | + for (i = 0; i < CHARACTERS_COUNT; i++)␊ |
508 | + {␊ |
509 | + if (font->chars[i])␊ |
510 | + {␊ |
511 | + if (font->chars[i]->pixels) free (font->chars[i]->pixels);␊ |
512 | + free (font->chars[i]);␊ |
513 | + font->chars[i] = 0;␊ |
514 | + }␊ |
515 | + }␊ |
516 | + return 0;␊ |
517 | +}␊ |
518 | +␊ |
519 | int initFont(font_t *font, image_t *data)␊ |
520 | {␊ |
521 | ␉unsigned int x = 0, y = 0, x2 = 0, x3 = 0;␊ |
522 | @@ -1561,7 +1597,7 @@␊ |
523 | ␉for( x = 0; x < data->image->width && count < CHARACTERS_COUNT; x++)␊ |
524 | ␉{␊ |
525 | ␉␉start = end;␊ |
526 | -␉␉␉␉␊ |
527 | +␊ |
528 | ␉␉// if the pixel is red we've reached the end of the char␊ |
529 | ␉␉if( pixel( data->image, x, 0 ).value == 0xFFFF0000)␊ |
530 | ␉␉{␊ |
531 | @@ -1587,7 +1623,7 @@␊ |
532 | ␉␉␉␉␉// check if font is monospaced␊ |
533 | ␉␉␉␉␉if( ( count > 0 ) && ( font->width != font->chars[count]->width ) )␊ |
534 | ␉␉␉␉␉␉monospaced = true;␊ |
535 | -␉␉␉␉␉␉␊ |
536 | +␊ |
537 | ␉␉␉␉␉font->width = font->chars[count]->width;␊ |
538 | ␉␉␉␉␉␊ |
539 | ␉␉␉␉␉count++;␊ |
540 | @@ -1607,21 +1643,6 @@␊ |
541 | ␉return 0;␊ |
542 | }␊ |
543 | ␊ |
544 | -int destroyFont(font_t *font)␊ |
545 | -{␊ |
546 | -␉int i;␊ |
547 | - for (i = 0; i < CHARACTERS_COUNT; i++)␊ |
548 | - {␊ |
549 | -␉␉if (font->chars[i])␊ |
550 | -␉␉{␊ |
551 | -␉␉␉if (font->chars[i]->pixels) free (font->chars[i]->pixels);␊ |
552 | -␉␉␉free (font->chars[i]);␊ |
553 | -␉␉␉font->chars[i] = 0;␊ |
554 | -␉␉}␊ |
555 | - }␊ |
556 | - return 0;␊ |
557 | -}␊ |
558 | -␊ |
559 | void colorFont(font_t *font, uint32_t color)␊ |
560 | {␊ |
561 | ␉if( !color )␊ |
562 | @@ -1759,11 +1780,11 @@␊ |
563 | ␉␉␉␉break;␊ |
564 | ␉␉␉}␊ |
565 | ␉␉}␊ |
566 | -␉␉␉␉␊ |
567 | +␊ |
568 | ␉␉fillPixmapWithColor( gui.infobox.pixmap, gui.infobox.bgcolor);␊ |
569 | ␊ |
570 | ␉␉makeRoundedCorners( gui.infobox.pixmap);␊ |
571 | -␉␉␉␊ |
572 | +␊ |
573 | ␉␉// print the title if present␊ |
574 | ␉␉if( title )␊ |
575 | ␉␉␉drawStr(title, &font_console, gui.infobox.pixmap, pos_title);␊ |
576 | @@ -1813,7 +1834,7 @@␊ |
577 | ␉␉␉updateVRAM();␊ |
578 | ␉␉␉break;␊ |
579 | ␉␉}␊ |
580 | -␉␉␊ |
581 | +␊ |
582 | ␉␉if(key == ' ') // spacebar = next page␊ |
583 | ␉␉{␊ |
584 | ␉␉␉if( lines > ( currentline + visiblelines ) ) ␊ |
585 | @@ -1885,7 +1906,7 @@␊ |
586 | ␉␉for(x=todraw, x2 = 0; x < width - 1; x++, x2++)␊ |
587 | ␉␉{␊ |
588 | ␉␉␉if(x2 == (buffBG->width -2 )) x2 = 0;␊ |
589 | -␉␉␉␉pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value;␊ |
590 | +␉␉␉pixel(&progressbar, x,y).value = pixel(buffBG, x2,y).value;␊ |
591 | ␉␉}␊ |
592 | ␉␉if(progress < 100)␊ |
593 | ␉␉␉pixel(&progressbar, width - 1, y).value = pixel(buffBG, buffBG->width - 1, y).value;␊ |
594 | @@ -1893,7 +1914,7 @@␊ |
595 | ␉␉␉pixel(&progressbar, 0, y).value = pixel(buffBG, buffBG->width - 1, y).value;␊ |
596 | ␉␉x2=0;␊ |
597 | ␉}␊ |
598 | -␉ ␊ |
599 | +␊ |
600 | ␉blend(&progressbar, blendInto, p);␊ |
601 | ␉animateProgressBar();␊ |
602 | ␉free(progressbar.pixels);␊ |
603 | @@ -1920,15 +1941,21 @@␊ |
604 | ␉for ( i = 0, n = iMenuBoot; i < infoMenuItemsCount; i++, n++)␊ |
605 | ␉{␊ |
606 | ␉␉if (i == infoMenuSelection)␊ |
607 | +␉␉{␊ |
608 | ␉␉␉blend(selection, gui.menu.pixmap, position);␊ |
609 | +␉␉}␊ |
610 | ␊ |
611 | ␉␉pbuff = images[n].image;␊ |
612 | ␉␉if (offset && i >= INFOMENU_NATIVEBOOT_START && i <= INFOMENU_NATIVEBOOT_END)␊ |
613 | +␉␉{␊ |
614 | ␉␉␉blend( images[n + (iMenuHelp - iMenuBoot)].image , gui.menu.pixmap, ␊ |
615 | ␉␉␉␉pos((position.x + (gui.menu.hborder / 2)), position.y + ((selection->height - pbuff->height) / 2)));␊ |
616 | +␉␉}␊ |
617 | ␉␉else␊ |
618 | +␉␉{␊ |
619 | ␉␉␉blend( pbuff, gui.menu.pixmap, ␊ |
620 | ␉␉␉␉pos((position.x + (gui.menu.hborder / 2)), position.y + ((selection->height - pbuff->height) / 2)));␊ |
621 | +␉␉}␊ |
622 | ␊ |
623 | ␉␉drawStr(infoMenuItems[i].text, &font_console, gui.menu.pixmap, ␊ |
624 | ␉␉␉pos(position.x + (pbuff->width + gui.menu.hborder), ␊ |
625 | @@ -1957,58 +1984,63 @@␊ |
626 | ␉{␊ |
627 | ␊ |
628 | ␉␉case KEY_UP:␉// up arrow␊ |
629 | -␉␉␉␉if (infoMenuSelection > 0)␊ |
630 | +␉␉␉if (infoMenuSelection > 0)␊ |
631 | +␉␉␉{␊ |
632 | +␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_END + 1)␊ |
633 | ␉␉␉␉{␊ |
634 | -␉␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_END + 1)␊ |
635 | -␉␉␉␉␉␉infoMenuSelection -= 4;␊ |
636 | -␉␉␉␉␉␊ |
637 | -␉␉␉␉␉else␊ |
638 | -␉␉␉␉␉␉infoMenuSelection--;␊ |
639 | -␉␉␉␉␉␉drawInfoMenuItems();␊ |
640 | -␉␉␉␉␉␉updateVRAM();␊ |
641 | -␉␉␉␉␉␊ |
642 | -␉␉␉␉} else {␊ |
643 | -␉␉␉␉␉␊ |
644 | -␉␉␉␉␉gui.menu.draw = false;␊ |
645 | -␉␉␉␉␉gui.redraw = true;␊ |
646 | -␊ |
647 | -␉␉␉␉␉updateVRAM();␊ |
648 | -␉␉␉␉␉␊ |
649 | -␉␉␉␉␉return CLOSE_INFO_MENU;␊ |
650 | +␉␉␉␉␉infoMenuSelection -= 4;␊ |
651 | ␉␉␉␉}␊ |
652 | -␉␉␉␉break;␊ |
653 | -␊ |
654 | -␉␉case KEY_DOWN:␉// down arrow␊ |
655 | -␉␉␉␉if (infoMenuSelection < infoMenuItemsCount - 1)␊ |
656 | +␉␉␉␉else␊ |
657 | ␉␉␉␉{␊ |
658 | -␉␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_START - 1)␊ |
659 | -␉␉␉␉␉␉infoMenuSelection += 4;␊ |
660 | -␉␉␉␉␉else␊ |
661 | -␉␉␉␉␉␉infoMenuSelection++;␊ |
662 | -␉␉␉␉␉drawInfoMenuItems();␊ |
663 | -␉␉␉␉␉updateVRAM();␊ |
664 | +␉␉␉␉␉infoMenuSelection--;␊ |
665 | ␉␉␉␉}␊ |
666 | -␉␉␉␉break;␊ |
667 | +␉␉␉␉drawInfoMenuItems();␊ |
668 | +␉␉␉␉updateVRAM();␊ |
669 | +␊ |
670 | +␉␉␉}␊ |
671 | +␉␉␉else␊ |
672 | +␉␉␉{␊ |
673 | +␊ |
674 | +␉␉␉␉gui.menu.draw = false;␊ |
675 | +␉␉␉␉gui.redraw = true;␊ |
676 | +␊ |
677 | +␉␉␉␉updateVRAM();␊ |
678 | +␉␉␉␉␊ |
679 | +␉␉␉␉return CLOSE_INFO_MENU;␊ |
680 | +␉␉␉}␊ |
681 | +␉␉␉break;␊ |
682 | +␊ |
683 | +␉␉case KEY_DOWN:␉// down arrow␊ |
684 | +␉␉␉if (infoMenuSelection < infoMenuItemsCount - 1)␊ |
685 | +␉␉␉{␊ |
686 | +␉␉␉␉if(!infoMenuNativeBoot && infoMenuSelection == INFOMENU_NATIVEBOOT_START - 1)␊ |
687 | +␉␉␉␉␉infoMenuSelection += 4;␊ |
688 | +␉␉␉␉else␊ |
689 | +␉␉␉␉␉infoMenuSelection++;␊ |
690 | +␉␉␉␉drawInfoMenuItems();␊ |
691 | +␉␉␉␉updateVRAM();␊ |
692 | +␉␉␉}␊ |
693 | +␉␉␉break;␊ |
694 | ␊ |
695 | ␉␉case KEY_ENTER:␊ |
696 | -␉␉␉␉key = 0;␊ |
697 | -␉␉␉␉if( infoMenuSelection == MENU_SHOW_MEMORY_INFO )␊ |
698 | -␉␉␉␉␉showInfoBox( "Memory Info. Press q to quit.\n", getMemoryInfoString());␊ |
699 | +␉␉␉key = 0;␊ |
700 | +␉␉␉if( infoMenuSelection == MENU_SHOW_MEMORY_INFO )␊ |
701 | +␉␉␉␉showInfoBox( "Memory Info. Press q to quit.\n", getMemoryInfoString());␊ |
702 | ␊ |
703 | -␉␉␉␉else if( infoMenuSelection == MENU_SHOW_VIDEO_INFO )␊ |
704 | -␉␉␉␉␉showInfoBox( getVBEInfoString(), getVBEModeInfoString() );␊ |
705 | +␉␉␉else if( infoMenuSelection == MENU_SHOW_VIDEO_INFO )␊ |
706 | +␉␉␉␉showInfoBox( getVBEInfoString(), getVBEModeInfoString() );␊ |
707 | ␉␉␉␊ |
708 | -␉␉␉␉else if( infoMenuSelection == MENU_SHOW_HELP )␊ |
709 | -␉␉␉␉␉showHelp();␊ |
710 | -␉␉␉␉␉␊ |
711 | -␉␉␉␉else␊ |
712 | -␉␉␉␉{␊ |
713 | -␉␉␉␉␉int buff = infoMenuSelection;␊ |
714 | -␉␉␉␉␉infoMenuSelection = 0;␊ |
715 | -␉␉␉␉␉return buff;␊ |
716 | -␉␉␉␉}␊ |
717 | -␉␉␉␉break;␊ |
718 | -␉␉}␊ |
719 | +␉␉␉else if( infoMenuSelection == MENU_SHOW_HELP )␊ |
720 | +␉␉␉␉showHelp();␊ |
721 | +␊ |
722 | +␉␉␉else␊ |
723 | +␉␉␉{␊ |
724 | +␉␉␉␉int buff = infoMenuSelection;␊ |
725 | +␉␉␉␉infoMenuSelection = 0;␊ |
726 | +␉␉␉␉return buff;␊ |
727 | +␉␉␉}␊ |
728 | +␉␉␉break;␊ |
729 | +␉}␊ |
730 | ␉return DO_NOT_BOOT;␊ |
731 | }␊ |
732 | ␊ |
733 | diff -xrevision -x.svn -x.DS_Store -Naur a/i386/boot2/gui.h b/i386/boot2/gui.h␊ |
734 | --- a/i386/boot2/gui.h␉2012-03-14 02:11:49.000000000 +0000␊ |
735 | +++ b/i386/boot2/gui.h␉2012-05-29 12:36:57.000000000 +0100␊ |
736 | @@ -17,25 +17,25 @@␊ |
737 | #include "graphic_utils.h"␊ |
738 | #include "picopng.h"␊ |
739 | ␊ |
740 | -#define CHARACTERS_COUNT␉223␊ |
741 | +#define CHARACTERS_COUNT␉␉223␊ |
742 | ␊ |
743 | #define BOOT_NORMAL␉␉␉0␊ |
744 | -#define BOOT_VERBOSE␉␉1␊ |
745 | -#define BOOT_IGNORECACHE␉2␊ |
746 | -#define BOOT_SINGLEUSER␉␉3␊ |
747 | +#define BOOT_VERBOSE␉␉␉1␊ |
748 | +#define BOOT_IGNORECACHE␉␉2␊ |
749 | +#define BOOT_SINGLEUSER␉␉␉3␊ |
750 | #define DO_NOT_BOOT␉␉␉4␊ |
751 | -#define CLOSE_INFO_MENU␉␉5␊ |
752 | +#define CLOSE_INFO_MENU␉␉␉5␊ |
753 | ␊ |
754 | #define INFOMENU_NATIVEBOOT_START␉1␊ |
755 | #define INFOMENU_NATIVEBOOT_END␉␉3␊ |
756 | ␊ |
757 | #define MENU_SHOW_MEMORY_INFO␉␉4␊ |
758 | #define MENU_SHOW_VIDEO_INFO␉␉5␊ |
759 | -#define MENU_SHOW_HELP␉␉␉␉6␊ |
760 | +#define MENU_SHOW_HELP␉␉␉6␊ |
761 | ␊ |
762 | enum {␊ |
763 | ␉HorizontalLayout␉= 0,␊ |
764 | -␉VerticalLayout␉␉= 1␊ |
765 | +␉VerticalLayout␉␉= 1,␊ |
766 | };␊ |
767 | ␊ |
768 | /*␊ |
769 | |