diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index 6b274d74b4..c994b04695 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include "action.h" | 49 | #include "action.h" |
50 | #include "splash.h" | 50 | #include "splash.h" |
51 | #include "yesno.h" | 51 | #include "yesno.h" |
52 | #include "backdrop.h" | ||
52 | 53 | ||
53 | #ifdef HAVE_LCD_BITMAP | 54 | #ifdef HAVE_LCD_BITMAP |
54 | #include "icons.h" | 55 | #include "icons.h" |
@@ -440,6 +441,31 @@ static bool delete_dir(void) | |||
440 | return delete_handler(true); | 441 | return delete_handler(true); |
441 | } | 442 | } |
442 | 443 | ||
444 | #ifdef HAVE_LCD_COLOR | ||
445 | static bool set_backdrop(void) | ||
446 | { | ||
447 | struct bitmap bm; | ||
448 | int ret; | ||
449 | |||
450 | /* load the image */ | ||
451 | bm.data=(char*)&main_backdrop[0][0]; | ||
452 | ret = read_bmp_file(selected_file, &bm, | ||
453 | sizeof(main_backdrop), FORMAT_NATIVE); | ||
454 | |||
455 | if ((ret > 0) && (bm.width == LCD_WIDTH) | ||
456 | && (bm.height == LCD_HEIGHT)) { | ||
457 | lcd_set_backdrop(&main_backdrop[0][0]); | ||
458 | gui_syncsplash(HZ, true, str(LANG_BACKDROP_LOADED)); | ||
459 | set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME); | ||
460 | return true; | ||
461 | } else { | ||
462 | lcd_set_backdrop(NULL); | ||
463 | gui_syncsplash(HZ, true, str(LANG_BACKDROP_FAILED)); | ||
464 | return false; | ||
465 | } | ||
466 | } | ||
467 | #endif | ||
468 | |||
443 | static bool rename_file(void) | 469 | static bool rename_file(void) |
444 | { | 470 | { |
445 | char newname[MAX_PATH]; | 471 | char newname[MAX_PATH]; |
@@ -512,6 +538,7 @@ int onplay(char* file, int attr, int from) | |||
512 | { | 538 | { |
513 | struct menu_item items[8]; /* increase this if you add entries! */ | 539 | struct menu_item items[8]; /* increase this if you add entries! */ |
514 | int m, i=0, result; | 540 | int m, i=0, result; |
541 | char *suffix; | ||
515 | 542 | ||
516 | onplay_result = ONPLAY_OK; | 543 | onplay_result = ONPLAY_OK; |
517 | context=from; | 544 | context=from; |
@@ -573,6 +600,17 @@ int onplay(char* file, int attr, int from) | |||
573 | items[i].desc = ID2P(LANG_DELETE); | 600 | items[i].desc = ID2P(LANG_DELETE); |
574 | items[i].function = delete_file; | 601 | items[i].function = delete_file; |
575 | i++; | 602 | i++; |
603 | |||
604 | #if HAVE_LCD_COLOR | ||
605 | suffix = strrchr(file, '.'); | ||
606 | if (suffix) { | ||
607 | if (strcasecmp(suffix, ".bmp") == 0) { | ||
608 | items[i].desc = ID2P(LANG_SET_AS_BACKDROP); | ||
609 | items[i].function = set_backdrop; | ||
610 | i++; | ||
611 | } | ||
612 | } | ||
613 | #endif | ||
576 | } | 614 | } |
577 | else | 615 | else |
578 | { | 616 | { |