- case RC_BIND:
- {
- // we should not do an explicit binding before
- // loading a bind file. So, in this case, load
- // the default bind file.
- readBindFileIfNeeded();
-
- // !!!chb, dynamic key binding...
- int action = 0;
- string::size_type res = 0;
- string seq, cmd;
-
- if (lexrc.next()) {
- seq = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: Missing key sequence");
- break;
- }
-
- if (lexrc.next(true)) {
- cmd = lexrc.getString();
- } else {
- lexrc.printError("RC_BIND: missing command");
- break;
- }
-
- if ((action = lyxaction.LookupFunc(cmd)) >= 0) {
- if (lyxerr.debugging(Debug::LYXRC)) {
- lyxerr << "RC_BIND: Sequence `"
- << seq << "' Command `"
- << cmd << "' Action `"
- << action << '\'' << endl;
- }
- res = toplevel_keymap->bind(seq, kb_action(action));
- if (res != string::npos
- && lyxerr.debugging(Debug::LYXRC)) {
- lexrc.printError(
- "RC_BIND: "
- "Invalid key sequence `"
- + seq + '\'');
- }
- } else {// cmd is the last token read.
- lexrc.printError(
- "Unknown LyX function `$$Token'");
- }
- break;
- }