From c08309a9e284026a207f428afb4c4b4b5f0fbb9a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 2 Nov 2007 21:27:37 +0000 Subject: [PATCH] cosmetics git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21391 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/KeyMap.cpp | 19 +++++++++---------- src/KeyMap.h | 12 ++++-------- src/LyXFunc.cpp | 2 +- src/MenuBackend.cpp | 2 +- src/insets/InsetInfo.cpp | 2 +- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/KeyMap.cpp b/src/KeyMap.cpp index 89e1f48837..5f90aa3042 100644 --- a/src/KeyMap.cpp +++ b/src/KeyMap.cpp @@ -429,9 +429,9 @@ void KeyMap::unbind(KeySequence * seq, FuncRequest const & func, unsigned int r) } -docstring const KeyMap::printbindings(FuncRequest const & func) const +docstring KeyMap::printBindings(FuncRequest const & func) const { - Bindings bindings = findbindings(func); + Bindings bindings = findBindings(func); if (bindings.empty()) return docstring(); @@ -447,26 +447,25 @@ docstring const KeyMap::printbindings(FuncRequest const & func) const } -KeyMap::Bindings KeyMap::findbindings(FuncRequest const & func) const +KeyMap::Bindings KeyMap::findBindings(FuncRequest const & func) const { - return findbindings(func, KeySequence(0, 0)); + return findBindings(func, KeySequence(0, 0)); } -KeyMap::Bindings KeyMap::findbindings(FuncRequest const & func, +KeyMap::Bindings KeyMap::findBindings(FuncRequest const & func, KeySequence const & prefix) const { Bindings res; - if (table.empty()) return res; + if (table.empty()) + return res; Table::const_iterator end = table.end(); - for (Table::const_iterator cit = table.begin(); - cit != end; ++cit) { + for (Table::const_iterator cit = table.begin(); cit != end; ++cit) { if (cit->table.get()) { KeySequence seq = prefix; seq.addkey(cit->code, cit->mod.first); - Bindings res2 = - cit->table->findbindings(func, seq); + Bindings res2 = cit->table->findBindings(func, seq); res.insert(res.end(), res2.begin(), res2.end()); } else if (cit->func == func) { KeySequence seq = prefix; diff --git a/src/KeyMap.h b/src/KeyMap.h index b9f8b28641..acb0c22110 100644 --- a/src/KeyMap.h +++ b/src/KeyMap.h @@ -22,7 +22,6 @@ #include #include -#include namespace lyx { @@ -91,13 +90,13 @@ public: lookup(KeySymbol const & key, KeyModifier mod, KeySequence * seq) const; /// - typedef std::deque Bindings; + typedef std::vector Bindings; /// Given an action, find all keybindings. - Bindings findbindings(FuncRequest const & func) const; + Bindings findBindings(FuncRequest const & func) const; /// Given an action, print the keybindings. - docstring const printbindings(FuncRequest const & func) const; + docstring printBindings(FuncRequest const & func) const; struct Binding { Binding(FuncRequest const & r, KeySequence const & s, int t) @@ -139,13 +138,10 @@ private: struct Key { /// Keysym KeySymbol code; - /// Modifier masks ModifierPair mod; - /// Keymap for prefix keys boost::shared_ptr table; - /// Action for !prefix keys FuncRequest func; }; @@ -155,7 +151,7 @@ private: * @param func the action * @param prefix a sequence to prepend the results */ - Bindings findbindings(FuncRequest const & func, + Bindings findBindings(FuncRequest const & func, KeySequence const & prefix) const; void listBindings(BindingList & list, KeySequence const & prefix, diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 0300b52b75..8ace0fb13a 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -2141,7 +2141,7 @@ void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd } } - docstring const shortcuts = theTopLevelKeymap().printbindings(cmd); + docstring const shortcuts = theTopLevelKeymap().printBindings(cmd); if (!shortcuts.empty()) comname += ": " + shortcuts; diff --git a/src/MenuBackend.cpp b/src/MenuBackend.cpp index 25d9f74412..ac3cbfa339 100644 --- a/src/MenuBackend.cpp +++ b/src/MenuBackend.cpp @@ -137,7 +137,7 @@ docstring const MenuItem::binding(bool forgui) const // Get the keys bound to this action, but keep only the // first one later - KeyMap::Bindings bindings = theTopLevelKeymap().findbindings(func_); + KeyMap::Bindings bindings = theTopLevelKeymap().findBindings(func_); if (bindings.size()) { return bindings.begin()->print(KeySequence::ForGui); diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 8bb9624f67..ec4fdcde53 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -182,7 +182,7 @@ void InsetInfo::updateInfo() case SHORTCUT_INFO: { FuncRequest func = lyxaction.lookupFunc(name_); if (func.action != LFUN_UNKNOWN_ACTION) - setText(theTopLevelKeymap().printbindings(func), + setText(theTopLevelKeymap().printBindings(func), bp_.getFont(), false); break; } -- 2.39.2