summaryrefslogtreecommitdiff
path: root/apps/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tree.c')
-rw-r--r--apps/tree.c108
1 files changed, 28 insertions, 80 deletions
diff --git a/apps/tree.c b/apps/tree.c
index 2f1d140ad9..34d5d0b1bb 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -72,6 +72,7 @@
72#include "splash.h" 72#include "splash.h"
73#include "buttonbar.h" 73#include "buttonbar.h"
74#include "textarea.h" 74#include "textarea.h"
75#include "action.h"
75 76
76#ifdef HAVE_LCD_BITMAP 77#ifdef HAVE_LCD_BITMAP
77#include "widgets.h" 78#include "widgets.h"
@@ -590,28 +591,11 @@ static bool dirbrowse(void)
590 boot_changed = false; 591 boot_changed = false;
591 } 592 }
592#endif 593#endif
593 button = button_get_w_tmo(HZ/5); 594 button = get_action(CONTEXT_TREE,HZ/5);
594 need_update = gui_synclist_do_button(&tree_lists, button); 595 need_update = gui_synclist_do_button(&tree_lists, button);
595 596
596 switch ( button ) { 597 switch ( button ) {
597#ifdef TREE_ENTER 598 case ACTION_STD_OK:
598 case TREE_ENTER | BUTTON_REL:
599 if (lastbutton != TREE_ENTER)
600 break;
601#endif
602#ifdef TREE_RC_RUN
603 case TREE_RC_RUN:
604#endif
605 case TREE_RUN:
606#ifdef TREE_RUN_PRE
607 if (((button == TREE_RUN)
608#ifdef TREE_RC_RUN_PRE
609 || (button == TREE_RC_RUN))
610 && ((lastbutton != TREE_RC_RUN_PRE)
611#endif
612 && (lastbutton != TREE_RUN_PRE)))
613 break;
614#endif
615 /* nothing to do if no files to display */ 599 /* nothing to do if no files to display */
616 if ( numentries == 0 ) 600 if ( numentries == 0 )
617 break; 601 break;
@@ -626,31 +610,27 @@ static bool dirbrowse(void)
626 restore = true; 610 restore = true;
627 break; 611 break;
628 612
629 case TREE_EXIT | BUTTON_REL: 613 case ACTION_STD_CANCEL:
630 if (lastbutton != TREE_EXIT)
631 break;
632#ifdef TREE_RC_EXIT
633 case TREE_RC_EXIT:
634#endif
635 if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) { 614 if (*tc.dirfilter > NUM_FILTER_MODES && tc.dirlevel < 1) {
636 exit_func = true; 615 exit_func = true;
637 break; 616 break;
638 } 617 }
639 /* if we are in /, nothing to do */ 618 /* if we are in /, stop playback
640 if (tc.dirlevel == 0 && !strcmp(currdir,"/")) 619 (skip this and fall into tree_stop)*/
620 if (tc.dirlevel != 0 || strcmp(currdir,"/"))
621 {
622 if (id3db)
623 tagtree_exit(&tc);
624 else
625 if (ft_exit(&tc) == 3)
626 exit_func = true;
627
628 restore = true;
641 break; 629 break;
630 }
631 /* else fall through */
642 632
643 if (id3db) 633 case ACTION_TREE_STOP:
644 tagtree_exit(&tc);
645 else
646 if (ft_exit(&tc) == 3)
647 exit_func = true;
648
649 restore = true;
650 break;
651
652#ifdef TREE_OFF
653 case TREE_OFF:
654 if (*tc.dirfilter < NUM_FILTER_MODES) 634 if (*tc.dirfilter < NUM_FILTER_MODES)
655 { 635 {
656 /* Stop the music if it is playing */ 636 /* Stop the music if it is playing */
@@ -676,6 +656,7 @@ static bool dirbrowse(void)
676#endif 656#endif
677 } 657 }
678 break; 658 break;
659 /* ??
679#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING) 660#if defined(CONFIG_CHARGING) && !defined(HAVE_POWEROFF_WHILE_CHARGING)
680 case TREE_OFF | BUTTON_REPEAT: 661 case TREE_OFF | BUTTON_REPEAT:
681 if (charger_inserted()) { 662 if (charger_inserted()) {
@@ -684,25 +665,15 @@ static bool dirbrowse(void)
684 } 665 }
685 break; 666 break;
686#endif 667#endif
687#endif /* TREE_OFF */ 668 */
688 case TREE_MENU: 669 case ACTION_STD_MENU:
689#ifdef TREE_RC_MENU
690 case TREE_RC_MENU:
691#endif
692#ifdef TREE_MENU_PRE
693 if (lastbutton != TREE_MENU_PRE
694#ifdef TREE_RC_MENU_PRE
695 && lastbutton != TREE_RC_MENU_PRE
696#endif
697 )
698 break;
699#endif
700 /* don't enter menu from plugin browser */ 670 /* don't enter menu from plugin browser */
701 if (*tc.dirfilter < NUM_FILTER_MODES) 671 if (*tc.dirfilter < NUM_FILTER_MODES)
702 { 672 {
703 int i; 673 int i;
704 FOR_NB_SCREENS(i) 674 FOR_NB_SCREENS(i)
705 screens[i].stop_scroll(); 675 screens[i].stop_scroll();
676 action_signalscreenchange();
706 if (main_menu()) 677 if (main_menu())
707 reload_dir = true; 678 reload_dir = true;
708 restore = true; 679 restore = true;
@@ -715,18 +686,7 @@ static bool dirbrowse(void)
715 exit_func = true; 686 exit_func = true;
716 break; 687 break;
717 688
718 case TREE_WPS: 689 case ACTION_TREE_WPS:
719#ifdef TREE_RC_WPS
720 case TREE_RC_WPS:
721#endif
722#ifdef TREE_WPS_PRE
723 if ((lastbutton != TREE_WPS_PRE)
724#ifdef TREE_RC_WPS
725 && (lastbutton != TREE_RC_WPS_PRE)
726#endif
727 )
728 break;
729#endif
730 /* don't enter wps from plugin browser etc */ 690 /* don't enter wps from plugin browser etc */
731 if (*tc.dirfilter < NUM_FILTER_MODES) 691 if (*tc.dirfilter < NUM_FILTER_MODES)
732 { 692 {
@@ -741,12 +701,8 @@ static bool dirbrowse(void)
741 } 701 }
742 } 702 }
743 break; 703 break;
744
745#ifdef HAVE_QUICKSCREEN 704#ifdef HAVE_QUICKSCREEN
746 case TREE_QUICK: 705 case ACTION_STD_QUICKSCREEN:
747#ifdef TREE_RC_QUICK
748 case TREE_RC_QUICK:
749#endif
750 /* don't enter f2 from plugin browser */ 706 /* don't enter f2 from plugin browser */
751 if (*tc.dirfilter < NUM_FILTER_MODES) 707 if (*tc.dirfilter < NUM_FILTER_MODES)
752 { 708 {
@@ -759,7 +715,6 @@ static bool dirbrowse(void)
759 } 715 }
760 break; 716 break;
761#endif 717#endif
762
763#ifdef BUTTON_F3 718#ifdef BUTTON_F3
764 case BUTTON_F3: 719 case BUTTON_F3:
765 /* don't enter f3 from plugin browser */ 720 /* don't enter f3 from plugin browser */
@@ -772,13 +727,7 @@ static bool dirbrowse(void)
772 break; 727 break;
773#endif 728#endif
774 729
775 case TREE_CONTEXT: 730 case ACTION_STD_CONTEXT:
776#ifdef TREE_RC_CONTEXT
777 case TREE_RC_CONTEXT:
778#endif
779#ifdef TREE_CONTEXT2
780 case TREE_CONTEXT2:
781#endif
782 { 731 {
783 int onplay_result; 732 int onplay_result;
784 int attr = 0; 733 int attr = 0;
@@ -827,7 +776,7 @@ static bool dirbrowse(void)
827 break; 776 break;
828 } 777 }
829 778
830 case BUTTON_NONE: 779 case ACTION_NONE:
831 if (thumbnail_time != -1 && 780 if (thumbnail_time != -1 &&
832 TIME_AFTER(current_tick, thumbnail_time)) 781 TIME_AFTER(current_tick, thumbnail_time))
833 { /* a delayed hovering thumbnail is due now */ 782 { /* a delayed hovering thumbnail is due now */
@@ -947,7 +896,6 @@ static bool dirbrowse(void)
947 lastfilter = *tc.dirfilter; 896 lastfilter = *tc.dirfilter;
948 lastsortcase = global_settings.sort_case; 897 lastsortcase = global_settings.sort_case;
949 restore = true; 898 restore = true;
950 button_clear_queue(); /* clear button queue */
951 } 899 }
952 900
953 if (exit_func) 901 if (exit_func)
@@ -1045,7 +993,7 @@ static bool dirbrowse(void)
1045 } 993 }
1046 } 994 }
1047 } 995 }
1048 996 action_signalscreenchange();
1049 return true; 997 return true;
1050} 998}
1051 999
@@ -1057,7 +1005,7 @@ static bool add_dir(char* dirname, int len, int fd)
1057 DIRCACHED* dir; 1005 DIRCACHED* dir;
1058 1006
1059 /* check for user abort */ 1007 /* check for user abort */
1060 if (button_get(false) == TREE_ABORT) 1008 if (action_userabort(TIMEOUT_NOBLOCK))
1061 return true; 1009 return true;
1062 1010
1063 dir = opendir_cached(dirname); 1011 dir = opendir_cached(dirname);