diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 96 |
1 files changed, 38 insertions, 58 deletions
diff --git a/apps/tree.c b/apps/tree.c index c9cbf4dae2..a190d78ff5 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -327,18 +327,17 @@ static int showdir(char *path, int start) | |||
327 | default: | 327 | default: |
328 | icon_type = 0; | 328 | icon_type = 0; |
329 | } | 329 | } |
330 | |||
331 | if (icon_type) { | ||
330 | #ifdef HAVE_LCD_BITMAP | 332 | #ifdef HAVE_LCD_BITMAP |
331 | if (icon_type) | ||
332 | lcd_bitmap(bitmap_icons_6x8[icon_type], | 333 | lcd_bitmap(bitmap_icons_6x8[icon_type], |
333 | CURSOR_X * 6 + CURSOR_WIDTH, | 334 | CURSOR_X * 6 + CURSOR_WIDTH, |
334 | MARGIN_Y+(i-start)*line_height, 6, 8, true); | 335 | MARGIN_Y+(i-start)*line_height, 6, 8, true); |
335 | #else | 336 | #else |
336 | if(icon_type!=0) | ||
337 | { | ||
338 | lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); | 337 | lcd_define_pattern((i-start)*8,tree_icons_5x7[icon_type],8); |
339 | lcd_putc(LINE_X-1, i-start, i-start); | 338 | lcd_putc(LINE_X-1, i-start, i-start); |
340 | } | ||
341 | #endif | 339 | #endif |
340 | } | ||
342 | 341 | ||
343 | /* if MP3 filter is on, cut off the extension */ | 342 | /* if MP3 filter is on, cut off the extension */ |
344 | if (global_settings.mp3filter && | 343 | if (global_settings.mp3filter && |
@@ -476,9 +475,12 @@ bool dirbrowse(char *root) | |||
476 | char buf[MAX_PATH]; | 475 | char buf[MAX_PATH]; |
477 | int i; | 476 | int i; |
478 | int lasti=-1; | 477 | int lasti=-1; |
479 | int rc; | ||
480 | int button; | 478 | int button; |
481 | int tree_max_on_screen; | 479 | int tree_max_on_screen; |
480 | bool reload_root = false; | ||
481 | bool lastfilter = global_settings.mp3filter; | ||
482 | bool lastsortcase = global_settings.sort_case; | ||
483 | bool lastshowhidden = global_settings.show_hidden_files; | ||
482 | #ifdef LOADABLE_FONTS | 484 | #ifdef LOADABLE_FONTS |
483 | int fh; | 485 | int fh; |
484 | unsigned char *font = lcd_getcurrentldfont(); | 486 | unsigned char *font = lcd_getcurrentldfont(); |
@@ -629,15 +631,8 @@ bool dirbrowse(char *root) | |||
629 | status_set_playmode(STATUS_PLAY); | 631 | status_set_playmode(STATUS_PLAY); |
630 | status_draw(); | 632 | status_draw(); |
631 | lcd_stop_scroll(); | 633 | lcd_stop_scroll(); |
632 | rc = wps_show(); | 634 | if ( wps_show() == SYS_USB_CONNECTED ) { |
633 | if(rc == SYS_USB_CONNECTED) | 635 | reload_root = true; |
634 | { | ||
635 | /* Force a re-read of the root directory */ | ||
636 | strcpy(currdir, "/"); | ||
637 | lastdir[0] = 0; | ||
638 | dirlevel = 0; | ||
639 | dircursor = 0; | ||
640 | start = 0; | ||
641 | global_settings.resume_index = -1; | 636 | global_settings.resume_index = -1; |
642 | } | 637 | } |
643 | #ifdef LOADABLE_FONTS | 638 | #ifdef LOADABLE_FONTS |
@@ -721,38 +716,18 @@ bool dirbrowse(char *root) | |||
721 | } | 716 | } |
722 | break; | 717 | break; |
723 | 718 | ||
724 | case TREE_MENU: { | 719 | case TREE_MENU: |
725 | bool lastfilter = global_settings.mp3filter; | ||
726 | bool lastsortcase = global_settings.sort_case; | ||
727 | bool show_hidden_files = global_settings.show_hidden_files; | ||
728 | Menu result; | ||
729 | |||
730 | lcd_stop_scroll(); | 720 | lcd_stop_scroll(); |
731 | result = main_menu(); | 721 | main_menu(); |
732 | /* do we need to rescan dir? */ | ||
733 | if (result == MENU_DISK_CHANGED || | ||
734 | lastfilter != global_settings.mp3filter || | ||
735 | lastsortcase != global_settings.sort_case || | ||
736 | show_hidden_files != global_settings.show_hidden_files) | ||
737 | lastdir[0] = 0; | ||
738 | restore = true; | 722 | restore = true; |
739 | break; | 723 | break; |
740 | } | ||
741 | 724 | ||
742 | case BUTTON_ON: | 725 | case BUTTON_ON: |
743 | if (mpeg_is_playing()) | 726 | if (mpeg_is_playing()) |
744 | { | 727 | { |
745 | lcd_stop_scroll(); | 728 | lcd_stop_scroll(); |
746 | rc = wps_show(); | 729 | if (wps_show() == SYS_USB_CONNECTED) |
747 | if(rc == SYS_USB_CONNECTED) | 730 | reload_root = true; |
748 | { | ||
749 | /* Force a re-read of the root directory */ | ||
750 | strcpy(currdir, "/"); | ||
751 | lastdir[0] = 0; | ||
752 | dirlevel = 0; | ||
753 | dircursor = 0; | ||
754 | start = 0; | ||
755 | } | ||
756 | #ifdef LOADABLE_FONTS | 731 | #ifdef LOADABLE_FONTS |
757 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 732 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
758 | #else | 733 | #else |
@@ -764,24 +739,14 @@ bool dirbrowse(char *root) | |||
764 | 739 | ||
765 | #ifdef HAVE_RECORDER_KEYPAD | 740 | #ifdef HAVE_RECORDER_KEYPAD |
766 | case BUTTON_F2: | 741 | case BUTTON_F2: |
767 | if (f2_screen()) { | 742 | if (f2_screen()) |
768 | /* reread root dir */ | 743 | reload_root = true; |
769 | strcpy(currdir, "/"); | ||
770 | lastdir[0] = 0; | ||
771 | dirlevel = 0; | ||
772 | dircursor = 0; | ||
773 | } | ||
774 | restore = true; | 744 | restore = true; |
775 | break; | 745 | break; |
776 | 746 | ||
777 | case BUTTON_F3: | 747 | case BUTTON_F3: |
778 | if (f3_screen()) { | 748 | if (f3_screen()) |
779 | /* reread root dir */ | 749 | reload_root = true; |
780 | strcpy(currdir, "/"); | ||
781 | lastdir[0] = 0; | ||
782 | dirlevel = 0; | ||
783 | dircursor = 0; | ||
784 | } | ||
785 | #ifdef LOADABLE_FONTS | 750 | #ifdef LOADABLE_FONTS |
786 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; | 751 | tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh; |
787 | #else | 752 | #else |
@@ -805,12 +770,7 @@ bool dirbrowse(char *root) | |||
805 | backlight_time(global_settings.backlight); | 770 | backlight_time(global_settings.backlight); |
806 | 771 | ||
807 | /* Force a re-read of the root directory */ | 772 | /* Force a re-read of the root directory */ |
808 | restore = true; | 773 | reload_root = true; |
809 | strcpy(currdir, "/"); | ||
810 | lastdir[0] = 0; | ||
811 | dirlevel = 0; | ||
812 | dircursor = 0; | ||
813 | start = 0; | ||
814 | } | 774 | } |
815 | break; | 775 | break; |
816 | #endif | 776 | #endif |
@@ -819,6 +779,26 @@ bool dirbrowse(char *root) | |||
819 | if ( button ) | 779 | if ( button ) |
820 | ata_spin(); | 780 | ata_spin(); |
821 | 781 | ||
782 | /* do we need to rescan dir? */ | ||
783 | if (reload_root || | ||
784 | lastfilter != global_settings.mp3filter || | ||
785 | lastsortcase != global_settings.sort_case || | ||
786 | lastshowhidden != global_settings.show_hidden_files) | ||
787 | { | ||
788 | if ( reload_root ) { | ||
789 | strcpy(currdir, "/"); | ||
790 | dirlevel = 0; | ||
791 | reload_root = false; | ||
792 | } | ||
793 | dircursor = 0; | ||
794 | start = 0; | ||
795 | lastdir[0] = 0; | ||
796 | lastfilter = global_settings.mp3filter; | ||
797 | lastsortcase = global_settings.sort_case; | ||
798 | lastshowhidden = global_settings.show_hidden_files; | ||
799 | restore = true; | ||
800 | } | ||
801 | |||
822 | if ( restore ) { | 802 | if ( restore ) { |
823 | /* restore display */ | 803 | /* restore display */ |
824 | /* We need to adjust if the number of lines on screen have | 804 | /* We need to adjust if the number of lines on screen have |