]> git.lyx.org Git - lyx.git/blobdiff - src/KeySequence.h
Fix bug #12772
[lyx.git] / src / KeySequence.h
index e39d6e2d35633b821a978b950556492c764d8ef9..6e46abac2c95a583a76bc48ded8e14383ab5702f 100644 (file)
@@ -4,16 +4,16 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  *
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef KB_SEQUENCE_H
-#define KB_SEQUENCE_H
+#ifndef KEYSEQUENCE_H
+#define KEYSEQUENCE_H
 
-#include "frontends/key_state.h"
+#include "frontends/KeyModifier.h"
 #include "frontends/KeySymbol.h"
 
 #include <string>
@@ -40,14 +40,13 @@ public:
        /**
         * Add a key to the key sequence and look it up in the curmap
         * if the latter is defined.
-        * @param keysym the key to add
+        * @param key the key to add
         * @param mod modifier mask
         * @param nmod which modifiers to mask out for equality test
         * @return the action matching this key sequence or LFUN_UNKNOWN_ACTION
         */
-       FuncRequest const &
-       addkey(KeySymbol const & keysym, key_modifier::state mod,
-              key_modifier::state nmod = key_modifier::none);
+       FuncRequest const & addkey(KeySymbol const & key, KeyModifier mod,
+              KeyModifier nmod = NoModifier);
 
        /**
         * Add a sequence of keys from a string to the sequence
@@ -62,13 +61,18 @@ public:
         */
        size_t parse(std::string const & s);
 
+       enum outputFormat {
+               Portable,       //< use a more portable format
+               ForGui,         //< use platform specific translations and special characters
+               BindFile        //< the format used in lyx bind files
+       };
+
        /**
         * Return the current sequence as a string.
-        * @param forgui true if the string should use translations and
-        *   special characters.
+        * @param format output format
         * @see parse()
         */
-       docstring const print(bool forgui) const;
+       docstring const print(outputFormat format, bool const untranslated = false) const;
 
        /**
         * Return the current sequence and available options as
@@ -78,38 +82,37 @@ public:
         */
        docstring const printOptions(bool forgui) const;
 
-       /// Mark the sequence as deleted.
-       void mark_deleted();
-
        /// Reset sequence to become "deleted"
        void reset();
 
        /// clear in full
        void clear();
 
+       /// remove last key in sequence
+       void removeKey();
+
        bool deleted() const { return deleted_; }
 
        /// length of sequence
        size_t length() const { return sequence.size(); }
 
+private:
        /// Keymap to use if a new sequence is starting
        KeyMap * stdmap;
 
        /// Keymap to use for the next key
        KeyMap * curmap;
 
-private:
        /**
         * Array holding the current key sequence as KeySyms.
         * If sequence[length - 1] < 0xff it can be used as ISO8859 char
         */
        Sequence sequence;
 
-       typedef std::pair<key_modifier::state, key_modifier::state>
-               modifier_pair;
+       typedef std::pair<KeyModifier, KeyModifier> ModifierPair;
 
        /// modifiers for keys in the sequence
-       std::vector<modifier_pair> modifiers;
+       std::vector<ModifierPair> modifiers;
 
        /// is keysequence deleted ?
        bool deleted_;