-FuncRequest const &
-KeyMap::lookup(KeySymbolPtr key,
- key_modifier::state mod, KeySequence * seq) const
+void KeyMap::write(string const & bind_file, bool append, bool unbind) const
+{
+ ofstream os(bind_file.c_str(),
+ append ? (ios::app | ios::out) : ios::out);
+
+ if (!append)
+ os << "## This file is automatically generated by lyx\n"
+ << "## All modifications will be lost\n\n";
+
+ string tag = unbind ? "\\unbind" : "\\bind";
+ BindingList const list = listBindings(false);
+ BindingList::const_iterator it = list.begin();
+ BindingList::const_iterator it_end = list.end();
+ for (; it != it_end; ++it) {
+ FuncCode action = it->request.action;
+ string arg = to_utf8(it->request.argument());
+
+ os << tag << " \""
+ << to_utf8(it->sequence.print(KeySequence::BindFile))
+ << "\" \""
+ << lyxaction.getActionName(action)
+ << (arg.empty() ? "" : " ") << arg
+ << "\"\n";
+ }
+ os << "\n";
+ os.close();
+}
+
+
+FuncRequest const & KeyMap::lookup(KeySymbol const &key,
+ KeyModifier mod, KeySequence * seq) const