X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fkbmap.h;h=edadfaa9c641881f5e57f3c4b95f853561b5ed2e;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=a9da168d31c7e597e9bd4e0d90f78e2c472eff62;hpb=44cd0fc9a1687cc63911c7f98d978594458e7813;p=lyx.git diff --git a/src/kbmap.h b/src/kbmap.h index a9da168d31..edadfaa9c6 100644 --- a/src/kbmap.h +++ b/src/kbmap.h @@ -17,13 +17,17 @@ #include "funcrequest.h" #include "frontends/key_state.h" +#include "frontends/LyXKeySym.h" #include #include +#include + + +namespace lyx { class kb_sequence; -class LyXKeySym; /// Defines key maps and actions for key sequences class kb_keymap { @@ -42,30 +46,42 @@ public: /// print all available keysyms std::string const print() const; - /// - typedef boost::shared_ptr LyXKeySymPtr; /** * Look up a key press in the keymap. * @param key the keysym * @param mod the modifiers * @param seq the current key sequence so far - * @return the action / LFUN_PREFIX / LFUN_UNKNOWN_ACTION + * @return the action / LFUN_COMMAND_PREFIX / LFUN_UNKNOWN_ACTION */ FuncRequest const & lookup(LyXKeySymPtr key, key_modifier::state mod, kb_sequence * seq) const; + /// + typedef std::deque Bindings; + /// Given an action, find all keybindings. - std::string const findbinding(FuncRequest const & func, - std::string const & prefix = std::string()) const; + Bindings findbindings(FuncRequest const & func) const; + + /// Given an action, print the keybindings. + std::string const printbindings(FuncRequest const & func) const; + + /** + * Given an action, find the first 1-key binding (if it exists). + * The LyXKeySym pointer is 0 is no key is found. + * [only used by the Qt/Mac frontend] + */ + std::pair + find1keybinding(FuncRequest const & func) const; + /** * Returns a string of the given keysym, with modifiers. * @param key the key as a keysym * @param mod the modifiers */ - static std::string const printKeysym(LyXKeySymPtr key, - key_modifier::state mod); + static std::string const printKeySym(LyXKeySym const & key, + key_modifier::state mod); typedef std::pair modifier_pair; @@ -95,6 +111,14 @@ private: /// Returns a string of the given key std::string const printKey(kb_key const & key) const; + /** + * Given an action, find all keybindings + * @param func the action + * @param prefix a sequence to prepend the results + */ + Bindings findbindings(FuncRequest const & func, + kb_sequence const & prefix) const; + /// is the table empty ? bool empty() const { return table.empty(); @@ -105,4 +129,10 @@ private: Table table; }; +/// Implementation is in lyx_main.C +extern kb_keymap & theTopLevelKeymap(); + + +} // namespace lyx + #endif // KBMAP_H