Keyboard handling
To begin with, we look into the input of regular characters. The OnChar
method is called every time a user presses a graphical character (with an ASCII value between 32 and 127, inclusive) or the Return key. If a part of the text is marked, that part is removed first. Then the character is added to the character list by the InsertChar
method of the OverwriteChar
class, depending on the keyboard
mode.
void WordDocument::OnChar(TCHAR tChar) { if (isprint(tChar) || (tChar == NewLine)) { if (wordMode == WordMark) { OnDelete(); } Paragraph* paragraphPtr = charList[editIndex].ParagraphPtr(); switch (GetKeyboardMode()) { case InsertKeyboard: OnInsertChar(tChar, paragraphPtr); break; case OverwriteKeyboard: OnOverwriteChar(tChar, paragraphPtr); break; } SetDirty(true); GenerateParagraph...