diff options
-rw-r--r-- | apps/showtext.c | 132 | ||||
-rw-r--r-- | uisimulator/win32/Makefile | 5 | ||||
-rw-r--r-- | uisimulator/x11/Makefile | 5 |
3 files changed, 2 insertions, 140 deletions
diff --git a/apps/showtext.c b/apps/showtext.c deleted file mode 100644 index 0266a678f5..0000000000 --- a/apps/showtext.c +++ /dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Daniel Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <string.h> | ||
21 | |||
22 | #include "file.h" | ||
23 | #include "lcd.h" | ||
24 | #include "kernel.h" | ||
25 | #include "button.h" | ||
26 | #include "sprintf.h" | ||
27 | |||
28 | static int here=0; | ||
29 | |||
30 | char *singleshow(char *word) | ||
31 | { | ||
32 | static unsigned char words[22]; | ||
33 | int len = strlen(word); | ||
34 | |||
35 | if(len>=10) { | ||
36 | if(len < 12 ) { | ||
37 | lcd_clear_display(); | ||
38 | lcd_puts(0,0, word); | ||
39 | strcpy(words, ""); | ||
40 | here=0; | ||
41 | return words; | ||
42 | } | ||
43 | /* huuuge word, use two lines! */ | ||
44 | return NULL; | ||
45 | } | ||
46 | |||
47 | else if(here +1 + len <= 11) { /* 1 is for space */ | ||
48 | if(words[0]) | ||
49 | strcat(words, " "); | ||
50 | strcat(words, word); | ||
51 | here+=1+len; | ||
52 | return NULL; /* no show right now */ | ||
53 | } | ||
54 | else { | ||
55 | lcd_clear_display(); | ||
56 | lcd_puts(0,0, words); | ||
57 | strcpy(words, word); | ||
58 | here=len; | ||
59 | return words; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | #define SEP(x) (((x) == '\n') || ((x) == '\t') || ((x) == ' ')) | ||
64 | |||
65 | void showtext(char *filename) | ||
66 | { | ||
67 | static char textbuffer[1024]; | ||
68 | |||
69 | int fd; | ||
70 | int size; | ||
71 | char *ptr; | ||
72 | char *end; | ||
73 | unsigned char backup; | ||
74 | char num[8]; | ||
75 | int count=0; | ||
76 | int b; | ||
77 | char *show; | ||
78 | int delay = HZ; | ||
79 | |||
80 | fd = open(filename, O_RDONLY); | ||
81 | |||
82 | if(-1 == fd) | ||
83 | return; | ||
84 | |||
85 | do { | ||
86 | size = read(fd, textbuffer, sizeof(textbuffer)); | ||
87 | |||
88 | ptr = textbuffer; | ||
89 | while (size > 0) { | ||
90 | while(ptr && *ptr && SEP(*ptr)) { | ||
91 | ptr++; | ||
92 | size--; | ||
93 | count++; | ||
94 | } | ||
95 | end = ptr; | ||
96 | |||
97 | while(end && *end && !SEP(*end)) { | ||
98 | end++; | ||
99 | count++; | ||
100 | } | ||
101 | |||
102 | backup = *end; | ||
103 | *end = 0; | ||
104 | |||
105 | |||
106 | show = singleshow(ptr); | ||
107 | |||
108 | if(show) { | ||
109 | snprintf(num, sizeof(num), "%d", count); | ||
110 | lcd_puts(0,1, num); | ||
111 | } | ||
112 | |||
113 | *end = backup; | ||
114 | |||
115 | ptr += (end - ptr); | ||
116 | size -= (end - ptr); | ||
117 | |||
118 | b = button_get(false); | ||
119 | if(b) { | ||
120 | size = -1; | ||
121 | break; | ||
122 | } | ||
123 | if(show) | ||
124 | sleep(delay); | ||
125 | } | ||
126 | |||
127 | |||
128 | } while(size>0); | ||
129 | |||
130 | close(fd); | ||
131 | |||
132 | } | ||
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile index 5ad6130020..4554f39888 100644 --- a/uisimulator/win32/Makefile +++ b/uisimulator/win32/Makefile | |||
@@ -68,7 +68,7 @@ FIRMSRCS = lcd-recorder.c power.c sprintf.c id3.c usb.c \ | |||
68 | mpeg.c powermgmt.c font.c sysfont.c ctype.c | 68 | mpeg.c powermgmt.c font.c sysfont.c ctype.c |
69 | 69 | ||
70 | APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \ | 70 | APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \ |
71 | playlist.c showtext.c wps.c wps-display.c settings.c status.c \ | 71 | playlist.c wps.c wps-display.c settings.c status.c \ |
72 | screens.c peakmeter.c viewer.c | 72 | screens.c peakmeter.c viewer.c |
73 | 73 | ||
74 | MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c | 74 | MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c |
@@ -167,9 +167,6 @@ $(OBJDIR)/tree.o: $(APPDIR)/tree.c | |||
167 | $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c | 167 | $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c |
168 | $(CC) $(APPCFLAGS) -c $< -o $@ | 168 | $(CC) $(APPCFLAGS) -c $< -o $@ |
169 | 169 | ||
170 | $(OBJDIR)/showtext.o: $(APPDIR)/showtext.c | ||
171 | $(CC) $(APPCFLAGS) -c $< -o $@ | ||
172 | |||
173 | $(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang | 170 | $(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang |
174 | perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@ | 171 | perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@ |
175 | 172 | ||
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index d4df5ef637..88a7214b9c 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile | |||
@@ -88,7 +88,7 @@ FIRMSRCS = $(LCDSRSC) sprintf.c id3.c debug.c usb.c mpeg.c power.c\ | |||
88 | powermgmt.c font.c panic.c sysfont.c ctype.c | 88 | powermgmt.c font.c panic.c sysfont.c ctype.c |
89 | 89 | ||
90 | APPS = main.c tree.c menu.c credits.c main_menu.c language.c\ | 90 | APPS = main.c tree.c menu.c credits.c main_menu.c language.c\ |
91 | playlist.c showtext.c wps.c wps-display.c settings.c status.c icons.c\ | 91 | playlist.c wps.c wps-display.c settings.c status.c icons.c\ |
92 | screens.c peakmeter.c viewer.c | 92 | screens.c peakmeter.c viewer.c |
93 | 93 | ||
94 | MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c | 94 | MENUS = games_menu.c demo_menu.c settings_menu.c sound_menu.c |
@@ -223,9 +223,6 @@ $(OBJDIR)/tree.o: $(APPDIR)/tree.c | |||
223 | $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c | 223 | $(OBJDIR)/playlist.o: $(APPDIR)/playlist.c |
224 | $(CC) $(APPCFLAGS) -c $< -o $@ | 224 | $(CC) $(APPCFLAGS) -c $< -o $@ |
225 | 225 | ||
226 | $(OBJDIR)/showtext.o: $(APPDIR)/showtext.c | ||
227 | $(CC) $(APPCFLAGS) -c $< -o $@ | ||
228 | |||
229 | $(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang | 226 | $(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang |
230 | perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@ | 227 | perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@ |
231 | 228 | ||