diff options
Diffstat (limited to 'apps/gui/wps.c')
-rw-r--r-- | apps/gui/wps.c | 96 |
1 files changed, 69 insertions, 27 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 430746cc8d..fe4bcf3213 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include "wps.h" | 63 | #include "wps.h" |
64 | #include "statusbar-skinned.h" | 64 | #include "statusbar-skinned.h" |
65 | #include "skin_engine/wps_internals.h" | 65 | #include "skin_engine/wps_internals.h" |
66 | #include "open_plugin.h" | ||
66 | 67 | ||
67 | #define RESTORE_WPS_INSTANTLY 0l | 68 | #define RESTORE_WPS_INSTANTLY 0l |
68 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) | 69 | #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) |
@@ -514,16 +515,19 @@ static void wps_lcd_activation_hook(unsigned short id, void *param) | |||
514 | } | 515 | } |
515 | #endif | 516 | #endif |
516 | 517 | ||
517 | static void gwps_leave_wps(void) | 518 | static void gwps_leave_wps(bool theme_enabled) |
518 | { | 519 | { |
519 | FOR_NB_SCREENS(i) | 520 | FOR_NB_SCREENS(i) |
520 | { | 521 | { |
521 | struct gui_wps *gwps = skin_get_gwps(WPS, i); | 522 | struct gui_wps *gwps = skin_get_gwps(WPS, i); |
522 | gwps->display->scroll_stop(); | 523 | gwps->display->scroll_stop(); |
524 | if (theme_enabled) | ||
525 | { | ||
523 | #ifdef HAVE_BACKDROP_IMAGE | 526 | #ifdef HAVE_BACKDROP_IMAGE |
524 | skin_backdrop_show(sb_get_backdrop(i)); | 527 | skin_backdrop_show(sb_get_backdrop(i)); |
525 | #endif | 528 | #endif |
526 | viewportmanager_theme_undo(i, skin_has_sbs(gwps)); | 529 | viewportmanager_theme_undo(i, skin_has_sbs(gwps)); |
530 | } | ||
527 | } | 531 | } |
528 | 532 | ||
529 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 533 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
@@ -539,7 +543,7 @@ static void gwps_leave_wps(void) | |||
539 | 543 | ||
540 | /* | 544 | /* |
541 | * display the wps on entering or restoring */ | 545 | * display the wps on entering or restoring */ |
542 | static void gwps_enter_wps(void) | 546 | static void gwps_enter_wps(bool theme_enabled) |
543 | { | 547 | { |
544 | struct gui_wps *gwps; | 548 | struct gui_wps *gwps; |
545 | struct screen *display; | 549 | struct screen *display; |
@@ -548,7 +552,8 @@ static void gwps_enter_wps(void) | |||
548 | gwps = skin_get_gwps(WPS, i); | 552 | gwps = skin_get_gwps(WPS, i); |
549 | display = gwps->display; | 553 | display = gwps->display; |
550 | display->scroll_stop(); | 554 | display->scroll_stop(); |
551 | viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); | 555 | if (theme_enabled) |
556 | viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); | ||
552 | 557 | ||
553 | /* Update the values in the first (default) viewport - in case the user | 558 | /* Update the values in the first (default) viewport - in case the user |
554 | has modified the statusbar or colour settings */ | 559 | has modified the statusbar or colour settings */ |
@@ -609,7 +614,7 @@ void wps_do_playpause(bool updatewps) | |||
609 | * b) return with a value evaluated by root_menu.c, in this case the wps | 614 | * b) return with a value evaluated by root_menu.c, in this case the wps |
610 | * is really left, and root_menu will handle the next screen | 615 | * is really left, and root_menu will handle the next screen |
611 | * | 616 | * |
612 | * In either way, call gwps_leave_wps(), in order to restore the correct | 617 | * In either way, call gwps_leave_wps(true), in order to restore the correct |
613 | * "main screen" backdrops and statusbars | 618 | * "main screen" backdrops and statusbars |
614 | */ | 619 | */ |
615 | long gui_wps_show(void) | 620 | long gui_wps_show(void) |
@@ -632,6 +637,7 @@ long gui_wps_show(void) | |||
632 | 637 | ||
633 | while ( 1 ) | 638 | while ( 1 ) |
634 | { | 639 | { |
640 | bool theme_enabled = true; | ||
635 | bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; | 641 | bool audio_paused = (audio_status() & AUDIO_STATUS_PAUSE)?true:false; |
636 | 642 | ||
637 | /* did someone else (i.e power thread) change audio pause mode? */ | 643 | /* did someone else (i.e power thread) change audio pause mode? */ |
@@ -693,23 +699,59 @@ long gui_wps_show(void) | |||
693 | case ACTION_WPS_CONTEXT: | 699 | case ACTION_WPS_CONTEXT: |
694 | { | 700 | { |
695 | bool hotkey = button == ACTION_WPS_HOTKEY; | 701 | bool hotkey = button == ACTION_WPS_HOTKEY; |
696 | gwps_leave_wps(); | 702 | |
697 | int retval = onplay(state->id3->path, | 703 | #ifdef HAVE_HOTKEY |
704 | if (hotkey && global_settings.hotkey_wps == HOTKEY_PLUGIN) | ||
705 | { | ||
706 | /* leave WPS without re-enabling theme */ | ||
707 | theme_enabled = false; | ||
708 | gwps_leave_wps(theme_enabled); | ||
709 | onplay(state->id3->path, | ||
698 | FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); | 710 | FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); |
699 | /* if music is stopped in the context menu we want to exit the wps */ | 711 | if (!audio_status()) |
700 | if (retval == ONPLAY_MAINMENU | 712 | { |
701 | || !audio_status()) | 713 | /* re-enable theme since we're returning to SBS */ |
702 | return GO_TO_ROOT; | 714 | FOR_NB_SCREENS(i) |
703 | else if (retval == ONPLAY_PLAYLIST) | 715 | { |
704 | return GO_TO_PLAYLIST_VIEWER; | 716 | struct gui_wps *gwps = skin_get_gwps(WPS, i); |
705 | else if (retval == ONPLAY_PLUGIN) | 717 | #ifdef HAVE_BACKDROP_IMAGE |
706 | return GO_TO_PLUGIN; | 718 | skin_backdrop_show(sb_get_backdrop(i)); |
719 | #endif | ||
720 | viewportmanager_theme_undo(i, skin_has_sbs(gwps)); | ||
721 | } | ||
722 | return GO_TO_ROOT; | ||
723 | } | ||
724 | } | ||
725 | else | ||
726 | #endif | ||
727 | { | ||
728 | gwps_leave_wps(true); | ||
729 | int retval = onplay(state->id3->path, | ||
730 | FILE_ATTR_AUDIO, CONTEXT_WPS, hotkey); | ||
731 | /* if music is stopped in the context menu we want to exit the wps */ | ||
732 | if (retval == ONPLAY_MAINMENU | ||
733 | || !audio_status()) | ||
734 | return GO_TO_ROOT; | ||
735 | else if (retval == ONPLAY_PLAYLIST) | ||
736 | return GO_TO_PLAYLIST_VIEWER; | ||
737 | else if (retval == ONPLAY_PLUGIN) | ||
738 | { | ||
739 | FOR_NB_SCREENS(i) | ||
740 | { | ||
741 | struct gui_wps *gwps = skin_get_gwps(WPS, i); | ||
742 | viewportmanager_theme_enable(i, skin_has_sbs(gwps), NULL); | ||
743 | } | ||
744 | theme_enabled = false; | ||
745 | open_plugin_run(ID2P(LANG_OPEN_PLUGIN_SET_WPS_CONTEXT_PLUGIN)); | ||
746 | } | ||
747 | } | ||
748 | |||
707 | restore = true; | 749 | restore = true; |
708 | } | 750 | } |
709 | break; | 751 | break; |
710 | 752 | ||
711 | case ACTION_WPS_BROWSE: | 753 | case ACTION_WPS_BROWSE: |
712 | gwps_leave_wps(); | 754 | gwps_leave_wps(true); |
713 | return GO_TO_PREVIOUS_BROWSER; | 755 | return GO_TO_PREVIOUS_BROWSER; |
714 | break; | 756 | break; |
715 | 757 | ||
@@ -852,7 +894,7 @@ long gui_wps_show(void) | |||
852 | break; | 894 | break; |
853 | /* menu key functions */ | 895 | /* menu key functions */ |
854 | case ACTION_WPS_MENU: | 896 | case ACTION_WPS_MENU: |
855 | gwps_leave_wps(); | 897 | gwps_leave_wps(true); |
856 | return GO_TO_ROOT; | 898 | return GO_TO_ROOT; |
857 | break; | 899 | break; |
858 | 900 | ||
@@ -860,7 +902,7 @@ long gui_wps_show(void) | |||
860 | #ifdef HAVE_QUICKSCREEN | 902 | #ifdef HAVE_QUICKSCREEN |
861 | case ACTION_WPS_QUICKSCREEN: | 903 | case ACTION_WPS_QUICKSCREEN: |
862 | { | 904 | { |
863 | gwps_leave_wps(); | 905 | gwps_leave_wps(true); |
864 | bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs; | 906 | bool enter_shortcuts_menu = global_settings.shortcuts_replaces_qs; |
865 | if (!enter_shortcuts_menu) | 907 | if (!enter_shortcuts_menu) |
866 | { | 908 | { |
@@ -889,7 +931,7 @@ long gui_wps_show(void) | |||
889 | #ifdef HAVE_PITCHCONTROL | 931 | #ifdef HAVE_PITCHCONTROL |
890 | case ACTION_WPS_PITCHSCREEN: | 932 | case ACTION_WPS_PITCHSCREEN: |
891 | { | 933 | { |
892 | gwps_leave_wps(); | 934 | gwps_leave_wps(true); |
893 | if (1 == gui_syncpitchscreen_run()) | 935 | if (1 == gui_syncpitchscreen_run()) |
894 | return GO_TO_ROOT; | 936 | return GO_TO_ROOT; |
895 | restore = true; | 937 | restore = true; |
@@ -917,7 +959,7 @@ long gui_wps_show(void) | |||
917 | break; | 959 | break; |
918 | 960 | ||
919 | case ACTION_WPS_LIST_BOOKMARKS: | 961 | case ACTION_WPS_LIST_BOOKMARKS: |
920 | gwps_leave_wps(); | 962 | gwps_leave_wps(true); |
921 | if (bookmark_load_menu() == BOOKMARK_USB_CONNECTED) | 963 | if (bookmark_load_menu() == BOOKMARK_USB_CONNECTED) |
922 | { | 964 | { |
923 | return GO_TO_ROOT; | 965 | return GO_TO_ROOT; |
@@ -926,14 +968,14 @@ long gui_wps_show(void) | |||
926 | break; | 968 | break; |
927 | 969 | ||
928 | case ACTION_WPS_CREATE_BOOKMARK: | 970 | case ACTION_WPS_CREATE_BOOKMARK: |
929 | gwps_leave_wps(); | 971 | gwps_leave_wps(true); |
930 | bookmark_create_menu(); | 972 | bookmark_create_menu(); |
931 | restore = true; | 973 | restore = true; |
932 | break; | 974 | break; |
933 | 975 | ||
934 | case ACTION_WPS_ID3SCREEN: | 976 | case ACTION_WPS_ID3SCREEN: |
935 | { | 977 | { |
936 | gwps_leave_wps(); | 978 | gwps_leave_wps(true); |
937 | if (browse_id3(audio_current_track(), | 979 | if (browse_id3(audio_current_track(), |
938 | playlist_get_display_index(), | 980 | playlist_get_display_index(), |
939 | playlist_amount())) | 981 | playlist_amount())) |
@@ -956,7 +998,7 @@ long gui_wps_show(void) | |||
956 | break; | 998 | break; |
957 | #endif | 999 | #endif |
958 | case ACTION_WPS_VIEW_PLAYLIST: | 1000 | case ACTION_WPS_VIEW_PLAYLIST: |
959 | gwps_leave_wps(); | 1001 | gwps_leave_wps(true); |
960 | return GO_TO_PLAYLIST_VIEWER; | 1002 | return GO_TO_PLAYLIST_VIEWER; |
961 | break; | 1003 | break; |
962 | default: | 1004 | default: |
@@ -965,7 +1007,7 @@ long gui_wps_show(void) | |||
965 | case SYS_USB_CONNECTED: | 1007 | case SYS_USB_CONNECTED: |
966 | case SYS_CALL_INCOMING: | 1008 | case SYS_CALL_INCOMING: |
967 | case BUTTON_MULTIMEDIA_STOP: | 1009 | case BUTTON_MULTIMEDIA_STOP: |
968 | gwps_leave_wps(); | 1010 | gwps_leave_wps(true); |
969 | return GO_TO_ROOT; | 1011 | return GO_TO_ROOT; |
970 | } | 1012 | } |
971 | update = true; | 1013 | update = true; |
@@ -1003,7 +1045,7 @@ long gui_wps_show(void) | |||
1003 | sb_skin_set_update_delay(0); | 1045 | sb_skin_set_update_delay(0); |
1004 | skin_request_full_update(WPS); | 1046 | skin_request_full_update(WPS); |
1005 | update = true; | 1047 | update = true; |
1006 | gwps_enter_wps(); | 1048 | gwps_enter_wps(theme_enabled); |
1007 | } | 1049 | } |
1008 | else | 1050 | else |
1009 | { | 1051 | { |
@@ -1038,7 +1080,7 @@ long gui_wps_show(void) | |||
1038 | #ifdef AB_REPEAT_ENABLE | 1080 | #ifdef AB_REPEAT_ENABLE |
1039 | ab_reset_markers(); | 1081 | ab_reset_markers(); |
1040 | #endif | 1082 | #endif |
1041 | gwps_leave_wps(); | 1083 | gwps_leave_wps(true); |
1042 | #ifdef HAVE_RECORDING | 1084 | #ifdef HAVE_RECORDING |
1043 | if (button == ACTION_WPS_REC) | 1085 | if (button == ACTION_WPS_REC) |
1044 | return GO_TO_RECSCREEN; | 1086 | return GO_TO_RECSCREEN; |