summaryrefslogtreecommitdiff
path: root/src/Fl_Input.cxx
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-04-20 04:43:24 +0000
committerBill Spitzak <spitzak@gmail.com>1999-04-20 04:43:24 +0000
commit2f22abf4e2713eee5a4bf199cd86cd807e08e4fd (patch)
tree345517d34e51108b2dfdb54b0a4eea77ce75984f /src/Fl_Input.cxx
parentdf8016354cc3b15968043e347de73609180e5c9e (diff)
Compose for Icelandic thorn character is "TH" or "th". Also fixed the
comments in Fl_Input.cxx and fixed the documentation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@552 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Input.cxx')
-rw-r--r--src/Fl_Input.cxx49
1 files changed, 28 insertions, 21 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index 95b0de087..d0e1fc8a3 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input.cxx,v 1.10 1999/01/24 15:28:59 mike Exp $"
+// "$Id: Fl_Input.cxx,v 1.10.2.1 1999/04/20 04:43:24 bill Exp $"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
@@ -54,29 +54,36 @@ int Fl_Input::shift_up_down_position(int p) {
////////////////////////////////////////////////////////////////
// Fltk "compose"
-// I tried to do compose characters "correctly" with much more user
-// feedback. They can see the character they will get, rather than
-// the "dead key" effect. Notice that I completely ignore that horrid
-// XIM extension!
-// Although the current scheme only works for Latin-NR1 character sets
-// the intention is to expand this to UTF-8 someday, to allow you to
-// compose all characters in all languages with no stupid "locale"
-// setting.
-// To use, you call "fl_compose()" for each keystroke. You pass it
-// the characters it displayed last time plus the new character. It
-// returns a new set of characters to replace the old one with. If
-// it returns zero length you should leave the old set unchanged and
-// treat the new key normally.
-// Pressing any function keys or moving the cursor should set the
-// compose state back to zero.
-
-// This string lists a pair for each possible foreign letter in Latin-NR1
+//
+// This is a demonstration of a IMHO "correct" interface to compose
+// character sequences. It does not have a "dead key" effect: the
+// user has feedback at all times, and sees exactly the symbol they
+// will get if they stop typing at that point. Notice that I totally
+// ignore the horrid XIM extension!
+//
+// You only need to keep track of your normal text buffer and a
+// single integer "state". Call fl_compose() for each character
+// keystroke. The return value is the new "state" that must be passed
+// the next time you call fl_compose(). It also returns the number of
+// characters to delete to the left, a buffer of new characters, and
+// the number of characters in that buffer. Obey these editing
+// instructions. Reset the state to zero if the user types any
+// function keys or clicks the mouse.
+//
+// Fl_Input does not call fl_compose unless you hit the "compose" key
+// first. It may be interesting and useful to always call it, though...
+
+// Although this simple code is only for ISO-8859-1 character
+// encodings, I think the interface can be expanded to UTF-8 (encoded
+// Unicode) someday.
+
+// This string lists a pair for each possible foreign letter in ISO-8859-1
// starting at code 0xa0 (nbsp). If the second character is a space then
// only the first character needs to by typed:
static const char* const compose_pairs =
" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "
-"A`A'A^A~A:A*AEC,E`E'E^E:I`I'I^I:D-N~O`O'O^O~O:x O/U`U'U^U:Y'DDss"
-"a`a'a^a~a:a*aec,e`e'e^e:i`i'i^i:d-n~o`o'o^o~o:-:o/u`u'u^u:y'ddy:";
+"A`A'A^A~A:A*AEC,E`E'E^E:I`I'I^I:D-N~O`O'O^O~O:x O/U`U'U^U:Y'THss"
+"a`a'a^a~a:a*aec,e`e'e^e:i`i'i^i:d-n~o`o'o^o~o:-:o/u`u'u^u:y'thy:";
int fl_compose(int state, char c, int& del, char* buffer, int& ins) {
del = 0; ins = 1; buffer[0] = c;
@@ -330,5 +337,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l)
}
//
-// End of "$Id: Fl_Input.cxx,v 1.10 1999/01/24 15:28:59 mike Exp $".
+// End of "$Id: Fl_Input.cxx,v 1.10.2.1 1999/04/20 04:43:24 bill Exp $".
//