2 * \file KeySequence.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
7 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
15 #include "KeySequence.h"
21 #include "frontends/KeySymbol.h"
29 FuncRequest const & KeySequence::addkey(KeySymbol const & key,
30 KeyModifier mod, KeyModifier nmod)
32 // adding a key to a deleted sequence
33 // starts a new sequence
40 modifiers.push_back(make_pair(mod, nmod));
41 sequence.push_back(key);
44 return curmap->lookup(key, mod, this);
47 static FuncRequest unknown(LFUN_UNKNOWN_ACTION);
52 size_t KeySequence::parse(string const & s)
58 KeyModifier mod = NoModifier;
59 KeyModifier nmod = NoModifier;
61 while (i < s.length()) {
67 if (i + 1 < s.length() && s[i + 1] == '-') {
74 mod |= ControlModifier;
84 } else if (i + 2 < s.length() && s[i] == '~'
88 nmod |= ShiftModifier;
92 nmod |= ControlModifier;
105 for (; j < s.length() && s[j] != ' '; ++j)
106 tbuf += s[j]; // (!!!check bounds :-)
116 addkey(key, mod, nmod);
122 if (sequence.size() == 0)
125 // everything is fine
130 docstring const KeySequence::print(bool forgui) const
134 size_t const length = sequence.size();
136 for (size_t i = 0; i != length; ++i) {
137 buf += sequence[i].print(modifiers[i].first, forgui);
146 docstring const KeySequence::printOptions(bool forgui) const
148 docstring buf = print(forgui);
153 buf += _(" options: ");
154 buf += curmap->print(forgui);
159 void KeySequence::mark_deleted()
165 void KeySequence::reset()
172 void KeySequence::clear()