diff options
author | Jens Arnold <amiconn@rockbox.org> | 2005-08-24 00:09:42 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2005-08-24 00:09:42 +0000 |
commit | 6c00e38665fbe7e4aa724667cf1105596a8495a6 (patch) | |
tree | e4bf9bf9c379fb5011e74c7bc9ae343f40091403 /apps/recorder/icons.c | |
parent | 992cbf20a0a3945ccf48bbb304cadf552d11c510 (diff) | |
download | rockbox-6c00e38665fbe7e4aa724667cf1105596a8495a6.tar.gz rockbox-6c00e38665fbe7e4aa724667cf1105596a8495a6.zip |
Icon code cleanup, optimisation & policeing. Removed unused icons. Applied uniform icon naming scheme.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7396 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/icons.c')
-rw-r--r-- | apps/recorder/icons.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c index 78f3039df2..148235f040 100644 --- a/apps/recorder/icons.c +++ b/apps/recorder/icons.c | |||
@@ -36,15 +36,9 @@ const unsigned char bitmap_icons_5x8[][5] = | |||
36 | 36 | ||
37 | const unsigned char bitmap_icons_6x8[LastIcon][6] = | 37 | const unsigned char bitmap_icons_6x8[LastIcon][6] = |
38 | { | 38 | { |
39 | { 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f }, /* Box_Filled */ | ||
40 | { 0x00, 0x7f, 0x41, 0x41, 0x41, 0x7f }, /* Box_Empty */ | ||
41 | { 0x00, 0x3e, 0x7f, 0x63, 0x7f, 0x3e }, /* Slider_Horizontal */ | ||
42 | { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ | 39 | { 0x60, 0x7f, 0x03, 0x33, 0x3f, 0x00 }, /* Musical note */ |
43 | { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */ | 40 | { 0x7e, 0x41, 0x41, 0x42, 0x7e, 0x00 }, /* Folder */ |
44 | { 0x3e, 0x26, 0x26, 0x24, 0x3c, 0x00 }, /* Directory */ | ||
45 | { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */ | 41 | { 0x55, 0x00, 0x55, 0x55, 0x55, 0x55 }, /* Playlist */ |
46 | { 0x39, 0x43, 0x47, 0x71, 0x61, 0x4e }, /* Repeat */ | ||
47 | { 0x00, 0x1c, 0x3e, 0x3e, 0x3e, 0x1c }, /* Selected */ | ||
48 | { 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */ | 42 | { 0x3e, 0x1c, 0x08, 0x00, 0x00, 0x00 }, /* Cursor / Marker */ |
49 | { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */ | 43 | { 0x58, 0x5f, 0x42, 0x50, 0x55, 0x55 }, /* WPS file */ |
50 | { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */ | 44 | { 0x63, 0x7f, 0x3a, 0x7f, 0x63, 0x00 }, /* Mod or ajz file */ |
@@ -59,7 +53,6 @@ const unsigned char bitmap_icons_7x8[][7] = | |||
59 | { | 53 | { |
60 | {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ | 54 | {0x08,0x1c,0x3e,0x3e,0x3e,0x14,0x14}, /* Power plug */ |
61 | {0x1c,0x14,0x3e,0x2a,0x22,0x1c,0x08}, /* USB plug */ | 55 | {0x1c,0x14,0x3e,0x2a,0x22,0x1c,0x08}, /* USB plug */ |
62 | {0x00,0x1c,0x1c,0x3e,0x7f,0x00,0x00}, /* Speaker */ | ||
63 | {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */ | 56 | {0x01,0x1e,0x1c,0x3e,0x7f,0x20,0x40}, /* Speaker mute */ |
64 | {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */ | 57 | {0x00,0x7f,0x7f,0x3e,0x1c,0x08,0x00}, /* Play */ |
65 | {0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f}, /* Stop */ | 58 | {0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f}, /* Stop */ |
@@ -82,7 +75,8 @@ const unsigned char bitmap_icon_disk[12] = | |||
82 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; | 75 | {0x15,0x3f,0x7d,0x7B,0x77,0x67,0x79,0x7b,0x57,0x4f,0x47,0x7f}; |
83 | #endif | 76 | #endif |
84 | 77 | ||
85 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | 78 | #if LCD_WIDTH == 112 || LCD_WIDTH == 128 \ |
79 | || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_WIDTH == 128) | ||
86 | /* Archos Jukebox/ Ondio + Gmini LCD width / remote lcd of iriver*/ | 80 | /* Archos Jukebox/ Ondio + Gmini LCD width / remote lcd of iriver*/ |
87 | 81 | ||
88 | const unsigned char rockbox112x37[]={ | 82 | const unsigned char rockbox112x37[]={ |
@@ -347,29 +341,24 @@ const unsigned char rockbox160x53x2[] = { | |||
347 | */ | 341 | */ |
348 | void statusbar_icon_battery(int percent) | 342 | void statusbar_icon_battery(int percent) |
349 | { | 343 | { |
350 | int i; | ||
351 | int fill; | 344 | int fill; |
352 | char buffer[5]; | 345 | char buffer[5]; |
353 | unsigned int width, height; | 346 | unsigned int width, height; |
354 | 347 | ||
355 | /* fill battery */ | 348 | /* fill battery */ |
356 | fill=percent; | 349 | fill = percent; |
357 | if (fill < 0) | 350 | if (fill < 0) |
358 | fill = 0; | 351 | fill = 0; |
359 | if (fill > 100) | 352 | if (fill > 100) |
360 | fill = 100; | 353 | fill = 100; |
361 | 354 | ||
362 | #ifdef SIMULATOR | 355 | #if defined(HAVE_CHARGE_CTRL) && !defined(SIMULATOR) /* Rec v1 target only */ |
363 | if (global_settings.battery_display && (percent > -1)) { | ||
364 | #else | ||
365 | #ifdef HAVE_CHARGE_CTRL /* Recorder */ | ||
366 | /* show graphical animation when charging instead of numbers */ | 356 | /* show graphical animation when charging instead of numbers */ |
367 | if ((global_settings.battery_display) && | 357 | if ((global_settings.battery_display) && |
368 | (charge_state != 1) && | 358 | (charge_state != 1) && |
369 | (percent > -1)) { | 359 | (percent > -1)) { |
370 | #else /* FM */ | 360 | #else /* all others */ |
371 | if (global_settings.battery_display && (percent > -1)) { | 361 | if (global_settings.battery_display && (percent > -1)) { |
372 | #endif /* HAVE_CHARGE_CTRL */ | ||
373 | #endif | 362 | #endif |
374 | /* Numeric display */ | 363 | /* Numeric display */ |
375 | snprintf(buffer, sizeof(buffer), "%3d", fill); | 364 | snprintf(buffer, sizeof(buffer), "%3d", fill); |
@@ -384,11 +373,10 @@ void statusbar_icon_battery(int percent) | |||
384 | else { | 373 | else { |
385 | /* draw battery */ | 374 | /* draw battery */ |
386 | lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); | 375 | lcd_drawrect(ICON_BATTERY_X_POS, STATUSBAR_Y_POS, 17, 7); |
387 | for (i=2; i < 5; i++) | 376 | lcd_vline(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + 2, |
388 | lcd_drawpixel(ICON_BATTERY_X_POS + 17, STATUSBAR_Y_POS + i); | 377 | STATUSBAR_Y_POS + 4); |
389 | 378 | ||
390 | fill = fill * 15 / 100; | 379 | fill = fill * 15 / 100; |
391 | |||
392 | lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); | 380 | lcd_fillrect(ICON_BATTERY_X_POS + 1, STATUSBAR_Y_POS + 1, fill, 5); |
393 | } | 381 | } |
394 | 382 | ||
@@ -405,17 +393,13 @@ void statusbar_icon_battery(int percent) | |||
405 | */ | 393 | */ |
406 | bool statusbar_icon_volume(int percent) | 394 | bool statusbar_icon_volume(int percent) |
407 | { | 395 | { |
408 | int i,j; | 396 | int i; |
409 | int volume; | 397 | int volume; |
410 | int vol; | 398 | int vol; |
411 | int step=0; | ||
412 | char buffer[4]; | 399 | char buffer[4]; |
413 | unsigned int width, height; | 400 | unsigned int width, height; |
414 | bool needs_redraw = false; | 401 | bool needs_redraw = false; |
415 | int type = global_settings.volume_type; | 402 | int type = global_settings.volume_type; |
416 | #if defined(LOADABLE_FONTS) | ||
417 | unsigned char *font; | ||
418 | #endif | ||
419 | static long switch_tick; | 403 | static long switch_tick; |
420 | static int last_volume = -1; /* -1 means "first update ever" */ | 404 | static int last_volume = -1; /* -1 means "first update ever" */ |
421 | 405 | ||
@@ -425,7 +409,7 @@ bool statusbar_icon_volume(int percent) | |||
425 | if (volume > 100) | 409 | if (volume > 100) |
426 | volume = 100; | 410 | volume = 100; |
427 | 411 | ||
428 | if (volume==0) { | 412 | if (volume == 0) { |
429 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute], | 413 | lcd_mono_bitmap(bitmap_icons_7x8[Icon_Mute], |
430 | ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, | 414 | ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, |
431 | STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); | 415 | STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT); |
@@ -438,7 +422,7 @@ bool statusbar_icon_volume(int percent) | |||
438 | 422 | ||
439 | /* If the timeout hasn't yet been reached, we show it numerically | 423 | /* If the timeout hasn't yet been reached, we show it numerically |
440 | and tell the caller that we want to be called again */ | 424 | and tell the caller that we want to be called again */ |
441 | if(TIME_BEFORE(current_tick,switch_tick)) { | 425 | if (TIME_BEFORE(current_tick,switch_tick)) { |
442 | type = 1; | 426 | type = 1; |
443 | needs_redraw = true; | 427 | needs_redraw = true; |
444 | } | 428 | } |
@@ -457,11 +441,8 @@ bool statusbar_icon_volume(int percent) | |||
457 | /* display volume bar */ | 441 | /* display volume bar */ |
458 | vol = volume * 14 / 100; | 442 | vol = volume * 14 / 100; |
459 | for(i=0; i < vol; i++) { | 443 | for(i=0; i < vol; i++) { |
460 | if(i%2 == 0) | 444 | lcd_vline(ICON_VOLUME_X_POS + i, STATUSBAR_Y_POS + 6 - i / 2, |
461 | step++; | 445 | STATUSBAR_Y_POS + 6); |
462 | for(j=1; j <= step; j++) | ||
463 | lcd_drawpixel(ICON_VOLUME_X_POS + i, | ||
464 | STATUSBAR_Y_POS + 7 - j); | ||
465 | } | 446 | } |
466 | } | 447 | } |
467 | } | 448 | } |
@@ -475,8 +456,8 @@ bool statusbar_icon_volume(int percent) | |||
475 | */ | 456 | */ |
476 | void statusbar_icon_play_state(int state) | 457 | void statusbar_icon_play_state(int state) |
477 | { | 458 | { |
478 | lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS, | 459 | lcd_mono_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, |
479 | ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); | 460 | STATUSBAR_Y_POS, ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT); |
480 | } | 461 | } |
481 | 462 | ||
482 | /* | 463 | /* |
@@ -484,8 +465,8 @@ void statusbar_icon_play_state(int state) | |||
484 | */ | 465 | */ |
485 | void statusbar_icon_play_mode(int mode) | 466 | void statusbar_icon_play_mode(int mode) |
486 | { | 467 | { |
487 | lcd_mono_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS, | 468 | lcd_mono_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, |
488 | ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT); | 469 | STATUSBAR_Y_POS, ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT); |
489 | } | 470 | } |
490 | 471 | ||
491 | /* | 472 | /* |
@@ -512,7 +493,7 @@ void statusbar_icon_lock(void) | |||
512 | */ | 493 | */ |
513 | void statusbar_led(void) | 494 | void statusbar_led(void) |
514 | { | 495 | { |
515 | lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, | 496 | lcd_mono_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, |
516 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT); | 497 | STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT); |
517 | } | 498 | } |
518 | #endif | 499 | #endif |
@@ -533,7 +514,7 @@ void statusbar_time(int hour, int minute) | |||
533 | if ( global_settings.timeformat ) { /* 12 hour clock */ | 514 | if ( global_settings.timeformat ) { /* 12 hour clock */ |
534 | hour %= 12; | 515 | hour %= 12; |
535 | if ( hour == 0 ) { | 516 | if ( hour == 0 ) { |
536 | hour +=12; | 517 | hour += 12; |
537 | } | 518 | } |
538 | } | 519 | } |
539 | snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); | 520 | snprintf(buffer, sizeof(buffer), "%02d:%02d", hour, minute); |