summaryrefslogtreecommitdiff
path: root/apps/neo
diff options
context:
space:
mode:
Diffstat (limited to 'apps/neo')
-rw-r--r--apps/neo/icons.h38
-rw-r--r--apps/neo/keyboard.c308
-rw-r--r--apps/neo/lcd-charset.h46
3 files changed, 0 insertions, 392 deletions
diff --git a/apps/neo/icons.h b/apps/neo/icons.h
deleted file mode 100644
index 460fee83ba..0000000000
--- a/apps/neo/icons.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 Justin Heiner
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#ifndef _ICONS_H_
20#define _ICONS_H_
21
22#include <lcd.h>
23
24/*
25 * Icons of size 5x7 pixels for the Player LCD
26 */
27
28#ifdef HAVE_LCD_CHARCELLS
29
30enum {
31 Unknown=0x90,
32 Bookmark = 0x16,
33 Plugin, Folder, Mod_Ajz, Language, File, Wps, Playlist, Text, Config,
34};
35
36#endif
37
38#endif
diff --git a/apps/neo/keyboard.c b/apps/neo/keyboard.c
deleted file mode 100644
index 6dd315e16e..0000000000
--- a/apps/neo/keyboard.c
+++ /dev/null
@@ -1,308 +0,0 @@
1
2/***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
10 *
11 * Copyright (C) 2003 by Francois Boucher
12 *
13 * All files in this archive are subject to the GNU General Public License.
14 * See the file COPYING in the source tree root for full license agreement.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20#include <string.h>
21
22#include "lcd.h"
23#include "button.h"
24#include "kernel.h"
25#include "version.h"
26#include "sprintf.h"
27#include "lcd-charset.h"
28#include "lang.h"
29#include "debug.h"
30
31/* Two functions that are part of the firmware for the Neo-builds only.
32 TODO: make them proper "official" firmware functions or replace them
33 with apps code */
34extern void lcd_cursor(int x, int y);
35extern int button_add(unsigned int button);
36
37#define KEYBOARD_MAX_LENGTH 255
38
39static const unsigned char* const kbd_screens[3] = {
40 "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
41 "abcdefghijklmnopqrstuvwxyz",
42 " !\"#$%&'()*+,-./0123456789;<=>?@[]^_`{|}"
43};
44
45static const unsigned char* const kbd_screens_names[3] = {
46 "Capitals",
47 "Small",
48 "Others"
49};
50
51static void kbd_show_legend( int nb )
52{
53 char buf[24];
54 snprintf(buf, sizeof(buf), "[%s]", kbd_screens_names[nb] );
55 lcd_puts( 0, 1, buf );
56 lcd_puts( 0, 2, kbd_screens[nb] );
57 lcd_puts( 0, 3, &kbd_screens[nb][20] );
58}
59
60/*
61 Returns text len Max = KEYBOARD_MAX_LENGTH characters.
62
63 This function MUST NOT fill in more than 'buflen' bytes into the given
64 buffer!
65*/
66static char kbdbuffer[KEYBOARD_MAX_LENGTH+1]; /* no use to alloc this huge one
67 on the stack */
68int kbd_input(char* text, int buflen)
69{
70 char* pstart;
71 char* pcursor;
72 char* pold;
73 int bufferlen;
74 char cursorpos = 0;
75 int ret = 0;
76 bool done = false;
77 int key;
78 int screen = 0;
79 int screenidx = -1;
80 const unsigned char * pcurscreen = kbd_screens[0];
81 bool ctl;
82
83 bufferlen = strlen(text);
84
85 if(bufferlen > KEYBOARD_MAX_LENGTH)
86 bufferlen = KEYBOARD_MAX_LENGTH;
87
88 strncpy(kbdbuffer, text, bufferlen);
89 kbdbuffer[bufferlen] = 0;
90
91 lcd_clear_display();
92
93 /* Initial setup */
94 lcd_puts(0, 0, kbdbuffer);
95 kbd_show_legend(screen);
96 lcd_cursor(cursorpos, 0);
97 lcd_write_command(LCD_BLINKCUR);
98
99 pstart = pcursor = kbdbuffer;
100
101 while(!done) {
102 /* We want all the keys except the releases and the repeats */
103 key = button_get(true);
104
105 if( key & BUTTON_IR)
106 ctl = key & (NEO_IR_BUTTON_PLAY|NEO_IR_BUTTON_STOP|NEO_IR_BUTTON_BROWSE);
107 else
108 ctl = key & (BUTTON_PLAY|BUTTON_STOP|BUTTON_MENU);
109
110 if( ctl ) {
111 /* These key do not change the first line */
112 switch( key ) {
113 case BUTTON_MENU:
114 case BUTTON_IR|NEO_IR_BUTTON_BROWSE:
115
116 /* Toggle legend screen */
117 screen++;
118 if( screen == 3 )
119 screen = 0;
120
121 pcurscreen = kbd_screens[screen];
122
123 screenidx = -1;
124 kbd_show_legend( screen );
125
126 /* Restore cursor */
127 lcd_cursor( cursorpos, 0 );
128 break;
129
130 case BUTTON_PLAY:
131 case BUTTON_IR|NEO_IR_BUTTON_PLAY:
132 if( bufferlen ) {
133 strncpy(text, kbdbuffer, bufferlen);
134 text[bufferlen] = 0;
135 ret = bufferlen;
136 }
137 /* fallthrough */
138
139 case BUTTON_STOP:
140 case BUTTON_IR|NEO_IR_BUTTON_STOP:
141
142 /* Remove blinking cursor */
143 lcd_write_command(LCD_OFFCUR);
144 done = true;
145 }
146 }
147 else {
148
149 switch( key ) {
150
151 case BUTTON_PROGRAM:
152 case BUTTON_PROGRAM|BUTTON_REPEAT:
153 case BUTTON_IR|NEO_IR_BUTTON_PROGRAM:
154
155 /* Delete char at pcursor */
156 /* Check if we are at the last char */
157
158 if( *(pcursor+1) != 0 ) {
159 /* move rest of the string to the left in buffer */
160 pold = pcursor;
161 while( *pcursor ){
162 *pcursor = *(pcursor+1);
163 pcursor++;
164 }
165
166 /* Restore position */
167 pcursor = pold;
168 }
169 else {
170 *pcursor = 0;
171 pcursor--;
172 cursorpos--;
173 }
174
175 bufferlen--;
176 break;
177
178 case BUTTON_IR|NEO_IR_BUTTON_EQ:
179 case BUTTON_SELECT|BUTTON_LEFT:
180
181 /* Insert left */
182
183 if(bufferlen >= buflen)
184 break;
185
186 pold = pcursor;
187
188 /* Goto end */
189 while( *pcursor )
190 pcursor++;
191
192 /* Move string content to the right */
193 while( pcursor >= pold ){
194 *(pcursor+1) = *pcursor;
195 pcursor--;
196 }
197
198 pcursor = pold;
199 *pcursor = ' ';
200
201 bufferlen++;
202 break;
203
204 case BUTTON_IR|NEO_IR_BUTTON_MUTE:
205 case BUTTON_SELECT|BUTTON_RIGHT:
206
207 /* Insert Right */
208
209 if(bufferlen >= buflen)
210 break;
211
212 pold = pcursor;
213
214 /* Goto end */
215 while(*pcursor)
216 pcursor++;
217
218 /* Move string content to the right */
219 while(pcursor > pold){
220 *(pcursor+1) = *pcursor;
221 pcursor--;
222 }
223
224 pcursor = pold;
225 *(pcursor+1) = ' ';
226
227 bufferlen++;
228
229 button_add( BUTTON_RIGHT );
230 break;
231
232 case BUTTON_LEFT:
233 case BUTTON_REPEAT|BUTTON_LEFT:
234 case BUTTON_IR|NEO_IR_BUTTON_REWIND:
235 case BUTTON_IR|NEO_IR_BUTTON_REWIND|BUTTON_REPEAT:
236
237 /* Move cursor left. Shift text right if all the way to the
238 left */
239
240 /* Check for start of string */
241 if(pcursor > kbdbuffer) {
242
243 screenidx = -1;
244 cursorpos--;
245 pcursor--;
246
247 /* Check if were going off the screen */
248 if( cursorpos == -1 ) {
249 cursorpos = 0;
250
251 /* Shift text right if we are */
252 pstart--;
253 }
254 }
255 break;
256
257 case BUTTON_RIGHT:
258 case BUTTON_REPEAT|BUTTON_RIGHT:
259 case BUTTON_IR|NEO_IR_BUTTON_FFORWARD:
260 case BUTTON_IR|NEO_IR_BUTTON_FFORWARD|BUTTON_REPEAT:
261
262 /* Move cursor right. Shift text left if all the way to
263 the right */
264
265 /* Check for end of string */
266 if( *(pcursor+1) != 0 ) {
267 screenidx = -1;
268 cursorpos++;
269 pcursor++;
270
271 /* Check if were going of the screen */
272 if( cursorpos == 20 ) {
273 cursorpos = 19;
274
275 /* Shift text left if we are */
276 pstart++;
277 }
278 }
279 break;
280
281 case BUTTON_UP:
282 case BUTTON_UP|BUTTON_REPEAT:
283 case BUTTON_IR|NEO_IR_BUTTON_VOLUP:
284 case BUTTON_IR|NEO_IR_BUTTON_VOLUP|BUTTON_REPEAT:
285 screenidx += 2;
286 /* fallthrough */
287 case BUTTON_DOWN:
288 case BUTTON_DOWN|BUTTON_REPEAT:
289 case BUTTON_IR|NEO_IR_BUTTON_VOLDN:
290 case BUTTON_IR|NEO_IR_BUTTON_VOLDN|BUTTON_REPEAT:
291 screenidx--;
292
293 if( screenidx < 0 )
294 screenidx = strlen(pcurscreen)-1;
295
296 if( pcurscreen[screenidx] == 0 )
297 screenidx = 0;
298
299 /* Changes the character over the cursor */
300 *pcursor = pcurscreen[screenidx];
301 }
302
303 lcd_puts( 0, 0, pstart);
304 lcd_cursor( cursorpos, 0 );
305 }
306 }
307 return ret;
308}
diff --git a/apps/neo/lcd-charset.h b/apps/neo/lcd-charset.h
deleted file mode 100644
index 24e3b223c2..0000000000
--- a/apps/neo/lcd-charset.h
+++ /dev/null
@@ -1,46 +0,0 @@
1#define CGRAM0 0x00
2#define CGRAM1 0x01
3#define CGRAM2 0x02
4#define CGRAM3 0x03
5#define CGRAM4 0x04
6#define CGRAM5 0x05
7#define CGRAM6 0x06
8#define CGRAM7 0x07
9
10#define CGRAM0_CHAR 0x10
11#define CGRAM1_CHAR 0x11
12#define CGRAM2_CHAR 0x12
13#define CGRAM3_CHAR 0x13
14#define CGRAM4_CHAR 0x14
15#define CGRAM5_CHAR 0x15
16#define CGRAM6_CHAR 0x16
17#define CGRAM7_CHAR 0x17
18
19#define RESERVED_CHAR 0xff
20#define NOCHAR_OLD 0x24
21#define UNKNOWN_CHAR 0x3f
22
23#define LARROW_CHAR 0x1e
24#define RARROW_CHAR 0x1f
25#define FULLGRID_CHAR 0x7f
26
27#define BACKSLASH_LCD CGRAM0
28#define RARROW_LCD 0x7e
29#define LARROW_LCD 0x7f
30#define FULLGRID_LCD 0xff
31
32#define PROGRESS1_LCD CGRAM1
33#define PROGRESS2_LCD CGRAM2
34#define PROGRESS3_LCD CGRAM3
35#define PROGRESS4_LCD CGRAM4
36#define PROGRESS5_LCD FULLGRID_LCD
37
38#define PROGRESS1_CHAR CGRAM1_CHAR
39#define PROGRESS2_CHAR CGRAM2_CHAR
40#define PROGRESS3_CHAR CGRAM3_CHAR
41#define PROGRESS4_CHAR CGRAM4_CHAR
42#define PROGRESS5_CHAR FULLGRID_CHAR
43
44
45extern unsigned char latin1_to_lcd[256];
46