+KeyMap::BindingList KeyMap::listBindings(bool unbound, int tag) const
+{
+ BindingList list;
+ listBindings(list, KeySequence(0, 0), tag);
+ if (unbound) {
+ LyXAction::const_func_iterator fit = lyxaction.func_begin();
+ LyXAction::const_func_iterator fit_end = lyxaction.func_end();
+ for (; fit != fit_end; ++fit) {
+ FuncCode action = fit->second;
+ bool has_action = false;
+ BindingList::const_iterator it = list.begin();
+ BindingList::const_iterator it_end = list.end();
+ for (; it != it_end; ++it)
+ if (it->request.action == action) {
+ has_action = true;
+ break;
+ }
+ if (!has_action)
+ list.push_back(Binding(FuncRequest(action), KeySequence(0, 0), tag));
+ }
+ }
+ return list;
+}
+
+
+void KeyMap::listBindings(BindingList & list,
+ KeySequence const & prefix, int tag) const
+{
+ Table::const_iterator it = table.begin();
+ Table::const_iterator it_end = table.end();
+ for (; it != it_end; ++it) {
+ // a LFUN_COMMAND_PREFIX
+ if (it->table.get()) {
+ KeySequence seq = prefix;
+ seq.addkey(it->code, it->mod.first);
+ it->table->listBindings(list, seq, tag);
+ } else {
+ KeySequence seq = prefix;
+ seq.addkey(it->code, it->mod.first);
+ list.push_back(Binding(it->func, seq, tag));
+ }
+ }
+}
+
+