From c196d2fc7c3ece7ccb7d89c425499a75ead7e59b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 8 Mar 2000 01:43:56 +0000 Subject: Initial revision --- src/KeyMap.cxx | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/KeyMap.cxx (limited to 'src/KeyMap.cxx') diff --git a/src/KeyMap.cxx b/src/KeyMap.cxx new file mode 100644 index 000000000..f339cd275 --- /dev/null +++ b/src/KeyMap.cxx @@ -0,0 +1,111 @@ +// Scintilla source code edit control +// KeyMap.cxx - defines a mapping between keystrokes and commands +// Copyright 1998-2000 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include "Platform.h" + +#include "Scintilla.h" + +#include "KeyMap.h" + +KeyMap::KeyMap() : kmap(0), len(0), alloc(0) { + for (int i = 0; MapDefault[i].key; i++) { + AssignCmdKey(MapDefault[i].key, + MapDefault[i].modifiers, + MapDefault[i].msg); + } +} + +KeyMap::~KeyMap() { + Clear(); +} + +void KeyMap::Clear() { + delete []kmap; + kmap = 0; + len = 0; + alloc = 0; +} + +void KeyMap::AssignCmdKey(int key, int modifiers, UINT msg) { + if ((len+1) >= alloc) { + KeyToCommand *ktcNew = new KeyToCommand[alloc + 5]; + if (!ktcNew) + return; + for (int k=0;k