- // negative length marks sequence as deleted, but we can still
- // print() it or retrieve the last char using getiso()
- length = -length;
-}
-
-
-/* ---F+------------------------------------------------------------------ *\
- Function : kb_sequence::getsym
- Called by : [user], getiso
- Purpose : get the keysym of the last key in sequence
- Parameters: none
- Returns : keysym
-\* ---F------------------------------------------------------------------- */
-
-KeySym kb_sequence::getsym()
-{
- int l = length;
- if(l==0) return NoSymbol;
- if(l<0) l = -l;
- return sequence[l-1];
-}
-
-
-/* ---F+------------------------------------------------------------------ *\
- Function : kb_sequence::getiso
- Called by : [user]
- Purpose : return iso character code of last key, if any
- Parameters: none
- Returns : iso code or 0 if none
-\* ---F------------------------------------------------------------------- */
-
-char kb_sequence::getiso()
-{
- int c = getsym();
-
- if(c > 0xff)
- return '\0';
- return (char)c;
-}
-
-
-/* ---F+------------------------------------------------------------------ *\
- Function : kb_sequence::reset
- Called by : [user]
- Purpose : reset sequence to initial state. RVDK_PATCH_5
- Parameters: none
- Returns : void
-\* ---F------------------------------------------------------------------- */
-
-void kb_sequence::reset()
-{
- delseq();
- curmap = stdmap;
- if ( length > 0 ) length = -length;
-}
-
-
-// === kb_keymap methods ==================================================
-
-// This binds a key to an action
-int kb_keymap::bind(char const *seq, int action)
-{
- kb_sequence k;
-
- int res = k.parse(seq);
- if (!res) {
- defkey(&k, action);
- } else
- lyxerr[Debug::KBMAP] << "Parse error at position " << res
- << " in key sequence '" << seq << "'."
- << endl;
- return res;
-}
-
-
-/* ---F+------------------------------------------------------------------ *\
- Function : kb_keymap::lookup
- Called by : [user], kb_sequence::add()
- Purpose : look up a key press in a given keymap
- Parameters: key - the keysym of the key press
- mod - the modifier mask of the keypress
- seq - the key-sequence retrieved so far
- Returns : user defined action; 0 for prefix key, -1 if key not found
-\* ---F------------------------------------------------------------------- */
-
-int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence *seq)
-{
- unsigned int hashval, ksym, msk1, msk0;
- kb_key *tab;
-
- //suppress modifier bits we do not handle
- mod &= ModsMask;
-
- if(!table) {
- // error - no keymap defined: