#include <config.h>
#include "KeySequence.h"
-
-#include "gettext.h"
#include "KeyMap.h"
-#include "lfuns.h"
-#include "frontends/KeySymbol.h"
+#include "support/gettext.h"
-using std::make_pair;
-using std::string;
+#include "frontends/KeySymbol.h"
+using namespace std;
namespace lyx {
modifiers.push_back(make_pair(mod, nmod));
sequence.push_back(key);
- if (curmap) {
+ if (curmap)
return curmap->lookup(key, mod, this);
- }
static FuncRequest unknown(LFUN_UNKNOWN_ACTION);
return unknown;
}
-docstring const KeySequence::print(bool forgui) const
+docstring const KeySequence::print(outputFormat format) const
{
docstring buf;
size_t const length = sequence.size();
for (size_t i = 0; i != length; ++i) {
- buf += sequence[i].print(modifiers[i].first, forgui);
+ switch (format) {
+ case Portable:
+ buf += sequence[i].print(modifiers[i].first, false);
+ break;
+ case ForGui:
+ buf += sequence[i].print(modifiers[i].first, true);
+ break;
+ case BindFile:
+ KeyModifier mod = modifiers[i].first;
+ if (mod & ControlModifier)
+ buf += "C-";
+ if (mod & AltModifier)
+ buf += "M-";
+ if (mod & ShiftModifier)
+ buf += "S-";
+
+ buf += from_utf8(sequence[i].getSymbolName());
+ break;
+ }
// append a blank
if (i + 1 != length)
buf += ' ';
docstring const KeySequence::printOptions(bool forgui) const
{
- docstring buf = print(forgui);
+ docstring buf = print(forgui ? ForGui : Portable);
if (!curmap)
return buf;
buf += _(" options: ");
- buf += curmap->print(forgui);
+ buf += curmap->print(forgui ? ForGui : Portable);
return buf;
}