]> git.lyx.org Git - lyx.git/blobdiff - src/kbsequence.h
Herbert's patch, part 1
[lyx.git] / src / kbsequence.h
index 9315d43b11f22eed1cecaa5309f8add1c578d860..91c94e045487506f0eb27364ccc99fd83a282bbc 100644 (file)
 #pragma interface
 #endif
 
+#include <vector>
 #include "LString.h"
 
-#define KB_PREALLOC  16
-
 class kb_keymap;
 
 /// Holds a key sequence and the current and standard keymaps
@@ -25,20 +24,9 @@ public:
        ///
        kb_sequence() {
                stdmap = curmap = 0;
-               sequence = staticseq;
-               modifiers = staticmod;
-               length = 0; 
-               size = KB_PREALLOC;
-       }
-       
-       ///
-       ~kb_sequence() {
-               if (sequence != staticseq) {
-                       delete sequence;
-                       delete modifiers;
-               }
+               length = 0;
        }
-       
+
        /** Add a key to the key sequence and look it up in the curmap
            if the latter is defined. */
        int addkey(unsigned int key, unsigned int mod, unsigned int nmod = 0);
@@ -51,7 +39,7 @@ public:
        
        /// Make length negative to mark the sequence as deleted
        void delseq();
-       
+
        ///
        char getiso() const;
        
@@ -62,7 +50,7 @@ public:
        void reset();
        
        ///
-       int parse(char const * s);
+       int parse(string const & s);
        
        /// Keymap to use if a new sequence is starting
        kb_keymap * stdmap;
@@ -72,23 +60,13 @@ public:
        
        /** Array holding the current key sequence.
            If sequence[length-1] < 0xff it can be used as ISO8859 char */
-       unsigned int * sequence;
+       std::vector<unsigned int> sequence;
        
        ///
-       unsigned int * modifiers;
+       std::vector<unsigned int> modifiers;
        
        /// Current length of key sequence
        int length;
-       
-private:
-       /// Static array preallocated for sequence
-       unsigned int staticseq[KB_PREALLOC];
-       
-       ///
-       unsigned int staticmod[KB_PREALLOC];
-       
-       /// Physically allocated storage size
-       int size;
 };
 
 #endif