]> git.lyx.org Git - lyx.git/blobdiff - src/KeyMap.h
adjust
[lyx.git] / src / KeyMap.h
index 97687a7c6084dc061a1c40d7e2c351a95b76d8d9..c3ff0820e0ac0feefd0e6c195d896c1900ba5c3e 100644 (file)
@@ -16,8 +16,8 @@
 
 #include "FuncRequest.h"
 
-#include "frontends/key_state.h"
-#include "frontends/LyXKeySym.h"
+#include "frontends/KeyModifier.h"
+#include "frontends/KeySymbol.h"
 
 #include "support/docstream.h"
 
@@ -29,7 +29,7 @@
 
 namespace lyx {
 
-class kb_sequence;
+class KeySequence;
 
 /// Defines key maps and actions for key sequences
 class KeyMap {
@@ -38,7 +38,7 @@ public:
         * Bind a key sequence to an action.
         * @return 0 on success, or position in string seq where error
         * occurs.
-        * See kb_sequence::parse for the syntax of the seq string
+        * See KeySequence::parse for the syntax of the seq string
         */
        size_t bind(std::string const & seq, FuncRequest const & func);
 
@@ -47,8 +47,8 @@ public:
 
        /**
         * print all available keysyms
-        * @param forgui true if the string should use translations and 
-        *   special characters. 
+        * @param forgui true if the string should use translations and
+        *   special characters.
         */
        docstring const print(bool forgui) const;
 
@@ -60,11 +60,10 @@ public:
         * @return the action / LFUN_COMMAND_PREFIX / LFUN_UNKNOWN_ACTION
         */
        FuncRequest const &
-       lookup(LyXKeySymPtr key,
-              key_modifier::state mod, kb_sequence * seq) const;
+       lookup(KeySymbol const & key, KeyModifier mod, KeySequence * seq) const;
 
        ///
-       typedef std::deque<kb_sequence> Bindings;
+       typedef std::deque<KeySequence> Bindings;
 
        /// Given an action, find all keybindings.
        Bindings findbindings(FuncRequest const & func) const;
@@ -74,10 +73,10 @@ public:
 
        /**
         *  Given an action, find the first 1-key binding (if it exists).
-        *  The LyXKeySym pointer is 0 is no key is found.
+        *  The KeySymbol pointer is 0 is no key is found.
         *  [only used by the Qt/Mac frontend]
         */
-       std::pair<LyXKeySym const *, key_modifier::state>
+       std::pair<KeySymbol, KeyModifier>
        find1keybinding(FuncRequest const & func) const;
 
 
@@ -86,19 +85,18 @@ public:
         * @param key the key as a keysym
         * @param mod the modifiers
         */
-       static std::string const printKeySym(LyXKeySym const & key,
-                                            key_modifier::state mod);
+       static std::string const printKeySym(KeySymbol const & key,
+                                            KeyModifier mod);
 
-       typedef std::pair<key_modifier::state, key_modifier::state> modifier_pair;
+       typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
 
-private:
        ///
        struct Key {
                /// Keysym
-               LyXKeySymPtr code;
+               KeySymbol code;
 
                /// Modifier masks
-               modifier_pair mod;
+               ModifierPair mod;
 
                /// Keymap for prefix keys
                boost::shared_ptr<KeyMap> table;
@@ -107,11 +105,18 @@ private:
                FuncRequest func;
        };
 
+       ///
+       typedef std::vector<Key> Table;
+
+       Table::const_iterator begin() const { return table.begin(); }
+       Table::const_iterator end() const { return table.end(); }
+
+private:
        /**
         * Define an action for a key sequence.
         * @param r internal recursion level
         */
-       void defkey(kb_sequence * seq, FuncRequest const & func,
+       void defkey(KeySequence * seq, FuncRequest const & func,
                    unsigned int r = 0);
 
        /**
@@ -120,13 +125,11 @@ private:
         * @param prefix a sequence to prepend the results
         */
        Bindings findbindings(FuncRequest const & func,
-                             kb_sequence const & prefix) const;
+                             KeySequence const & prefix) const;
 
        /// is the table empty ?
        bool empty() const { return table.empty(); }
        ///
-       typedef std::vector<Key> Table;
-       ///
        Table table;
 };