Text Input (legacy)
From iPodLinux
Contents |
Support
I consider this unsupported until it makes it into CVS. I'd be happy to help anyone who has a question, however. :)
Downloads
>>> TextInput8.tgz < < <
Version 8 works with podzilla CVS as of, I don't know, October 18, 2005? It adds a SQLite database system and provides numerous other improvements. See Version History below.
Installation
For Windows Users:
Either:
Launch the file INSTALL.BAT. This will detect your iPod drive and copy all the necessary files for you.
Or:
Copy the podzilla-ti8, MultiConvert.tabl, SeaChelUnicode.fnt, ptextwords, ptext.db, and start files to your iPod drive.
Once you reset your iPod launch podzilla-ti8 from the File Browser.
For Everyone Else:
- Copy MultiConvert.tabl to the /etc folder on your iPod.
- Copy SeaChelUnicode.fnt to the /usr/share/fonts folder on your iPod, creating any folders if necessary (optional).
- Copy ptextwords to the /usr/share/dict folder on your iPod, creating any folders if necessary.
- Copy ptext.db to the /etc folder on your iPod.
- Copy the podzilla-ti8 file to anywhere on your iPod, most preferably /sbin.
- Launch podzilla-ti8 from the File Browser.
For Developers, Simple Method:
Apply the text_input.diff patch to your podzilla source. You can use the shell script applypatch.sh to do this for you.
./applypatch.sh ~/ipodlinux/podzilla
(If ~/ipodlinux/podzilla is the path to your podzilla source directory.)
For Developers, Complex Method:
Copy the following files and folders to your podzilla source folder:
- clickwheel.h
- clickwheel.c
- textinput.h
- textinput.c
- run.c
- podwrite.c
- multiconvert.c
- textinput/*
- sqlite/*
Then manually apply the changes listed in Diffs for Text Input.txt.
How To Use
Launch podzilla-ti7 in any way you want (File Browser, sash, /etc/rc, whatever).
Go to Settings > Text Input to select a text input method.
Go to Extras > Stuff > Text Input Demo to test it out.
Go to Run... to enter a command that you would enter on the command line.
For instructions on how to use each text input method, see the Text Input Methods page.
To rename a file in the File Browser, hold down the action button and select Rename. To cancel the rename delete all the characters.
To open a file in the File Browser with PodWrite, hold down the action button and select Open with Podwrite. To get to a PodWrite window with no text in it, go to Extras > Applications > PodWrite.
Once in PodWrite, enter text normally. To bring up the PodWrite menu, press the button for exit in whatever text input method you have selected (usually Menu or the action button). The PodWrite menu has six options:
- Return to PodWrite - Continue editing normally.
- Move Cursor - Switch to move mode. Use the wheel to move the cursor. Press the action button to return to editing mode, or the Menu button to return to the PodWrite menu. Use |<< and >>| to move the cursor to the beginning or end of the text.
- Scroll - Use the wheel to scroll through text longer than the screen. Press the action button to return to editing mode, or the Menu button to return to the PodWrite menu.
- Clear - Clear all the text.
- Save... - Save the text to a file. A normal one-line text box will appear prompting for the file name.
- Exit PodWrite - Return to the Applications menu or File Browser from whence you came.
Resources
- Descriptions of all text input methods currently implemented in the text input system.
- Brief descriptions of all text input concepts suggested up to this day.
- Button mappings for each text input method.
- Peter Burk's cursive text input concept.
- Morse code reference.
- BeckieRGB's Four-Button Keyboard text input concept.
- Graphical reference for Four-Button Keyboard.
- Keystroke reference for Four-Button Keyboard.
Development
To bring up a new text box:
new_text_box(x, y, width, height, default_text, callback_function);
The callback function is optional and gets called when the text box is closed. A width of 0 is interpreted as the width of the screen - 20 pixels, and a height of 0 is interpreted as the best height for one text line in whatever text input method is selected (some have status bars and such).
If you want only numeric input, use this:
new_text_box_numeric(x, y, width, height, default_text, callback_function);
If you want to input a password, and want to display stars so nobody can see it:
new_text_box_password(x, y, width, height, default_text, callback_function);
A much more complicated method to bring up a new text box:
new_text_box_x(x, y, width, height, default_text, callback_function, draw_function, output_function, event_handler_function, exit_function);
Similar to above, except allows you to hook into four parts of the text input system that allow you to control pretty much everything. Each of the four extra functions is optional; you can leave one out by passing NULL. The draw and exit functions take no parameters and return void, the output function takes an int and returns void, and the event handler function takes a GR_EVENT * and returns an int. The draw function is called whenever the text window is drawn, the output function is called whenever a character is to be added to the text input buffer, the event handler function is called whenever a Microwindows/Nano-X event occurs, and the exit function is called whenever the text box is about to be closed. You can continue on normally by calling text_draw_continue(), text_output_char_continue(int i), int text_handle_event_continue(GR_EVENT * e), or text_exit_continue(), respectively, or not do anything and handle it all yourself if you prefer. PodWrite uses this mechanism.
Note: The character output functions work with ints, not chars. This means Unicode.
To get the text that was entered:
char * s = text_get_buffer();
You'll need this in the callback function, if you have one.
Additional text input concepts can be implemented and added quite easily. Just add an item for it to menu.c, add a constant to textinput.h, and connect an event handler and status bar drawer thingy to textinput.c. You'll understand if you look at the code yourself.
Miscellaneous Status Info
- 1 - Partial coverage only.
- 2 - Outside of PodWrite. In PodWrite, you can move the cursor regardless of input method.
- 3 - This will become important when we stop using the hold switch in PodWrite, which isn't really the proper way to do things. See this thread.
Version History
TextInput1:
- Initial release.
- Text Input Demo and Run... command.
TextInput2:
- Fix to keypad.c (input character when pressing a button other than the last one pressed) incorporated.
- Rename option in File Browser menu.
- Hooks for overriding four important functions in the text input system.
- Proper management of graphic context (gc).
- Text input uses the same font as the rest of podzilla.
- Fewer compiler warnings.
- Other miscellaneous bug fixes.
- On-Screen Keyboard text input method (really crowded though).
- UTF-8 support (only On-Screen Keyboard currently outputs non-ISO-Latin-1 characters).
- Text cursor (caret, insertion point) display.
- Editing in the middle of the string.
- PodWrite, a podzilla word processor.
- Open in PodWrite option in File Browser menu.
TextInput3:
- Mouse cursor is moved back to the middle of the screen after the text window closes, fixing a potential bug if a text window was way off-center and a message window was displayed.
- MultiConvert is included.
- Numeric mode, used by MultiConvert.
- "Dead keys" in On-Screen Keyboard now use correct case.
- On-Screen Keyboard will use SeaChelUnicode.fnt (included) or SeaChel.fnt for the keyboard, if they are found in /usr/share/fonts. This is a tiny font ideal for the small buttons of the On-Screen Keyboard.
- Non-ASCII characters in Four-Button Keyboard no longer act funky.
- Text input buffer is now dynamic rather than fixed-size.
- Telephone Keypad can now generate a zero.
- Better handling of text input methods cleaning up on exit.
- Hold switch in Telephone Keypad input no longer attempts to generate characters.
- Four-Button Keyboard and Cursive methods can move the cursor.
- PodWrite stops clicking and redrawing text when reaching the beginning or end while in move or scroll mode.
- Improved scrolling in PodWrite (hopefully).
- Rewind and forward move cursor to beginning or end of text in move mode in PodWrite.
- PodWrite now displays a scroll bar.
- No compiler warnings whatsoever.
TextInput4:
- Works with latest CVS (July 25, 2005).
- Text input, MultiConvert, and PodWrite are all appearance-compliant (use the colors from appearance.h).
- Text input, MultiConvert, and PodWrite are all double-buffered (no more flickering at all).
- Brackets and currency are switched in Four-Button Keyboard, and an @ sign is added to the symbols.
TextInput5:
- Works with latest CVS (August 21, 2005).
- Internationalization support.
- Podzilla-ti has updated libitunesdb.
TextInput6:
- Arrays of chars instead of literal strings used for temporary storage (preventing segmentation faults).
TextInput7:
- Serial, Morse Code, Cursive, and Keypad input methods now call both text_output_char(10) and text_exit(), so we are now able to make a distinction between the two. (Other methods already had this distinction.)
- PodWrite no longer uses the hold button, but instead uses the distinction between newline and exit. See the text input mappings / text input summary file.
- Telephone Keypad input methods support more characters under different buttons, instead of just basic ASCII all under the 1 button.
- Four-Button Keypad can now move the cursor (at the sacrifice of having space and backspace under the 1 key).
- Morse Code can now move the cursor. The codes to do this are .-... (for left) and .-..- (for right).
- Morse Code now covers all of ASCII. The codes for this will be listed separately.
- WheelBoard can now move the cursor. It's implemented as another "character set."
- Scroll Through and Dial Type can now move the cursor through an M option at the end of the character list.
- Finally fixed the problem with WheelBoard not using the correct font.
- New text input methods: Telephone Keypad and Thumbscript use the click wheel on 4th-gen iPods as a telephone keypad. Telephone Keypad inputs characters as on a cellular phone, and Thumbscript inputs characters using Thumbscript (see information and reference at http://www.thumbscript.com). See jackinloadup's post about these concepts here for more information. Someone will have to test these for me because I don't have a fourth-generation iPod.
- Predictive Text! Turn on ptext, the iPod predictive text system, by holding down the action button in telephone keypad modes. The 1 key acts the same, but the 2-9 keys now input characters immediately. You must have a file /usr/share/dict/ptextwords for this to work.
TextInput8:
- Removed need for podwrite.h file.
- Renamed textinputextensions.c to run.c (since all it contained was new_run_window).
- Added functions for clickwheel control in clickwheel.h and clickwheel.c. These can be used by anything in podzilla, not just text input.
- Made center button on Four-Button Keyboard return to home level (A-H, I-P, Q-X, YZEtc) when pressed, exit when held down.
- Now includes SQLite port with minimal features. This is an optional component specified with PTEXT_DB=1 passed to the make command (see next item).
- Predictive text uses SQLite database. This will only work with PTEXT_DB=1 passed to the make command; otherwise predictive text uses the text dictionary file as before.
- Improved reliability of Telephone Keypad and Thumbscript input methods though clickwheel.c. You should now be able to just touch the wheel instead of rubbing it.
- Made PodWrite a little faster by not redrawing the header on every refresh. (This is most noticable when you have decorations turned on.)
- A unified function for a text input method to display a message inside the text input window.
- New text input entry point for passworded input.
- Four-button keyboard has better layout for status bar on non-3g iPods.
- Text window is now centered vertically if passed 0 for y.
- PodWrite displays confirmation dialog before clearing all text.
- PodWrite remembers the name of a file opened through the file browser or the name of the file last saved when using the Save command.
- Fixed a couple memory leaks, and a bus error that would occur when leaving the Save text box empty.
- Text input always exits if it receives a $1B (escape) keystroke. This is helpful if you're running podzilla in X11.