]> git.lyx.org Git - lyx.git/blobdiff - src/KeyMap.h
saner borderline between buffer and exporter
[lyx.git] / src / KeyMap.h
index 9a9f2bd5dfb174f6af794e74ab30791d12726a47..d8069f2d6876bdbc3c8c8f367a33915cdeff0866 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "FuncRequest.h"
 
-#include "frontends/key_state.h"
+#include "frontends/KeyModifier.h"
 #include "frontends/KeySymbol.h"
 
 #include "support/docstream.h"
@@ -60,8 +60,7 @@ public:
         * @return the action / LFUN_COMMAND_PREFIX / LFUN_UNKNOWN_ACTION
         */
        FuncRequest const &
-       lookup(KeySymbolPtr key,
-              key_modifier::state mod, KeySequence * seq) const;
+       lookup(KeySymbol const & key, KeyModifier mod, KeySequence * seq) const;
 
        ///
        typedef std::deque<KeySequence> Bindings;
@@ -72,12 +71,20 @@ public:
        /// Given an action, print the keybindings.
        docstring const printbindings(FuncRequest const & func) const;
 
+       typedef std::pair<FuncRequest, KeySequence> Binding; 
+       typedef std::vector<Binding> BindingList;
+       /**
+        * Return all lfun and their associated bindings.
+        * @param unbound list unbound (func without any keybinding) as well
+        */
+       BindingList const listBindings(bool unbound) const;
+
        /**
         *  Given an action, find the first 1-key binding (if it exists).
         *  The KeySymbol pointer is 0 is no key is found.
         *  [only used by the Qt/Mac frontend]
         */
-       std::pair<KeySymbol const *, key_modifier::state>
+       std::pair<KeySymbol, KeyModifier>
        find1keybinding(FuncRequest const & func) const;
 
 
@@ -87,18 +94,19 @@ public:
         * @param mod the modifiers
         */
        static std::string const printKeySym(KeySymbol const & key,
-                                            key_modifier::state mod);
+                                            KeyModifier mod);
+
+       typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
 
-       typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
 
 private:
        ///
        struct Key {
                /// Keysym
-               KeySymbolPtr code;
+               KeySymbol code;
 
                /// Modifier masks
-               modifier_pair mod;
+               ModifierPair mod;
 
                /// Keymap for prefix keys
                boost::shared_ptr<KeyMap> table;
@@ -121,6 +129,9 @@ private:
         */
        Bindings findbindings(FuncRequest const & func,
                              KeySequence const & prefix) const;
+       
+       void listBindings(BindingList & list,
+                                 KeySequence const & prefix) const;
 
        /// is the table empty ?
        bool empty() const { return table.empty(); }