diff options
Diffstat (limited to 'apps/tree.c')
-rw-r--r-- | apps/tree.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/apps/tree.c b/apps/tree.c index a9b62e0beb..653b6afa2a 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "rolo.h" | 46 | #include "rolo.h" |
47 | #include "icons.h" | 47 | #include "icons.h" |
48 | #include "lang.h" | 48 | #include "lang.h" |
49 | #include "viewer.h" | ||
49 | #include "language.h" | 50 | #include "language.h" |
50 | #include "screens.h" | 51 | #include "screens.h" |
51 | 52 | ||
@@ -141,6 +142,7 @@ extern unsigned char bitmap_icons_6x8[LastIcon][6]; | |||
141 | #define TREE_ATTR_WPS 0x100 /* wps config file */ | 142 | #define TREE_ATTR_WPS 0x100 /* wps config file */ |
142 | #define TREE_ATTR_MOD 0x200 /* firmware file */ | 143 | #define TREE_ATTR_MOD 0x200 /* firmware file */ |
143 | #define TREE_ATTR_EQ 0x400 /* EQ config file */ | 144 | #define TREE_ATTR_EQ 0x400 /* EQ config file */ |
145 | #define TREE_ATTR_TXT 0x500 /* text file */ | ||
144 | #define TREE_ATTR_FONT 0x800 /* font file */ | 146 | #define TREE_ATTR_FONT 0x800 /* font file */ |
145 | #define TREE_ATTR_LNG 0x1000 /* binary lang file */ | 147 | #define TREE_ATTR_LNG 0x1000 /* binary lang file */ |
146 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ | 148 | #define TREE_ATTR_MASK 0xffd0 /* which bits tree.c uses (above + DIR) */ |
@@ -258,6 +260,8 @@ static int showdir(char *path, int start) | |||
258 | dptr->attr |= TREE_ATTR_EQ; | 260 | dptr->attr |= TREE_ATTR_EQ; |
259 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) | 261 | else if (!strcasecmp(&entry->d_name[len-4], ".wps")) |
260 | dptr->attr |= TREE_ATTR_WPS; | 262 | dptr->attr |= TREE_ATTR_WPS; |
263 | else if (!strcasecmp(&entry->d_name[len-4], ".txt")) | ||
264 | dptr->attr |= TREE_ATTR_TXT; | ||
261 | else if (!strcasecmp(&entry->d_name[len-4], ".lng")) | 265 | else if (!strcasecmp(&entry->d_name[len-4], ".lng")) |
262 | dptr->attr |= TREE_ATTR_LNG; | 266 | dptr->attr |= TREE_ATTR_LNG; |
263 | #ifdef HAVE_RECORDER_KEYPAD | 267 | #ifdef HAVE_RECORDER_KEYPAD |
@@ -383,6 +387,10 @@ static int showdir(char *path, int start) | |||
383 | icon_type = Wps; | 387 | icon_type = Wps; |
384 | break; | 388 | break; |
385 | 389 | ||
390 | case TREE_ATTR_TXT: | ||
391 | icon_type = Wps; | ||
392 | break; | ||
393 | |||
386 | case TREE_ATTR_LNG: | 394 | case TREE_ATTR_LNG: |
387 | icon_type = Language; | 395 | icon_type = Language; |
388 | break; | 396 | break; |
@@ -801,6 +809,13 @@ bool dirbrowse(char *root) | |||
801 | restore = true; | 809 | restore = true; |
802 | break; | 810 | break; |
803 | 811 | ||
812 | case TREE_ATTR_TXT: | ||
813 | snprintf(buf, sizeof buf, "%s/%s", | ||
814 | currdir, file->name); | ||
815 | viewer_run(buf); | ||
816 | restore = true; | ||
817 | break; | ||
818 | |||
804 | case TREE_ATTR_LNG: | 819 | case TREE_ATTR_LNG: |
805 | snprintf(buf, sizeof buf, "%s/%s", | 820 | snprintf(buf, sizeof buf, "%s/%s", |
806 | currdir, file->name); | 821 | currdir, file->name); |
@@ -1031,6 +1046,11 @@ bool dirbrowse(char *root) | |||
1031 | dirstart++; | 1046 | dirstart++; |
1032 | dircursor--; | 1047 | dircursor--; |
1033 | } | 1048 | } |
1049 | #ifdef HAVE_LCD_BITMAP | ||
1050 | /* the sub-screen might've ruined the margins */ | ||
1051 | lcd_setmargins(MARGIN_X,MARGIN_Y); /* leave room for cursor and | ||
1052 | icon */ | ||
1053 | #endif | ||
1034 | numentries = showdir(currdir, dirstart); | 1054 | numentries = showdir(currdir, dirstart); |
1035 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); | 1055 | put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true); |
1036 | } | 1056 | } |