X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fkbsequence.h;h=91c94e045487506f0eb27364ccc99fd83a282bbc;hb=00d24ec87650e4ac7db77ad54cb4aa2f688100f3;hp=9315d43b11f22eed1cecaa5309f8add1c578d860;hpb=9ce32d63e5ff1dbf4c04e3d8263b2649ef3ac595;p=lyx.git diff --git a/src/kbsequence.h b/src/kbsequence.h index 9315d43b11..91c94e0454 100644 --- a/src/kbsequence.h +++ b/src/kbsequence.h @@ -13,10 +13,9 @@ #pragma interface #endif +#include #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 sequence; /// - unsigned int * modifiers; + std::vector 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