internal override byte[] SequenceKeyData(Keys modifier, Keys key) { if ((int)Keys.F1 <= (int)key && (int)key <= (int)Keys.F12) { return(base.SequenceKeyData(modifier, key)); } else if (GUtil.IsCursorKey(key)) { byte[] data = modifyCursorKey(modifier, key); if (data != null) { return(data); } return(base.SequenceKeyData(modifier, key)); } else { byte[] r = new byte[4]; r[0] = 0x1B; r[1] = (byte)'['; r[3] = (byte)'~'; //このあたりはxtermでは割と違うようだ if (key == Keys.Insert) { r[2] = (byte)'2'; } else if (key == Keys.Home) { r[2] = (byte)'7'; } else if (key == Keys.PageUp) { r[2] = (byte)'5'; } else if (key == Keys.Delete) { r[2] = (byte)'3'; } else if (key == Keys.End) { r[2] = (byte)'8'; } else if (key == Keys.PageDown) { r[2] = (byte)'6'; } else { throw new ArgumentException("unknown key " + key.ToString()); } return(r); } }
protected override bool ProcessDialogKey(Keys keyData) { //Debug.WriteLine("MultiPane ProcessDialogKey " + keyData); //おそらくContainerControlが、Shift+カーソルキーを処理してフォーカスを移動させるようだ if ((keyData & Keys.Modifiers) == Keys.Shift && GUtil.IsCursorKey(keyData & Keys.KeyCode)) { return(true); } else { return(base.ProcessDialogKey(keyData)); } }
internal override int EncodeInputKey1(Keys key, out byte[] data) { Keys code = key & Keys.KeyCode; if ((int)Keys.F1 <= (int)code && (int)code <= (int)Keys.F12) { return(base.EncodeInputKey1(key, out data)); } else if (GUtil.IsCursorKey(code)) { return(base.EncodeInputKey1(key, out data)); } else { byte[] r = data = new byte[4]; r[0] = 0x1B; r[1] = (byte)'['; r[3] = (byte)'~'; //このあたりはxtermでは割と違うようだ if (code == Keys.Insert) { r[2] = (byte)'2'; } else if (code == Keys.Home) { r[2] = (byte)'7'; } else if (code == Keys.PageUp) { r[2] = (byte)'5'; } else if (code == Keys.Delete) { r[2] = (byte)'3'; } else if (code == Keys.End) { r[2] = (byte)'8'; } else if (code == Keys.PageDown) { r[2] = (byte)'6'; } else { return(0); } return(4); } }
//特定のデータを流すタイプ。現在、カーソルキーとファンクションキーが該当する internal override byte[] SequenceKeyData(Keys modifier, Keys body) { if ((int)Keys.F1 <= (int)body && (int)body <= (int)Keys.F12) { byte[] r = new byte[5]; r[0] = 0x1B; r[1] = (byte)'['; int n = (int)body - (int)Keys.F1; if ((modifier & Keys.Shift) != Keys.None) { n += 10; //shiftは値を10ずらす } char tail; if (n >= 20) { tail = (modifier & Keys.Control) != Keys.None ? '@' : '$'; } else { tail = (modifier & Keys.Control) != Keys.None ? '^' : '~'; } string f = FUNCTIONKEY_MAP[n]; r[2] = (byte)f[0]; r[3] = (byte)f[1]; r[4] = (byte)tail; return(r); } else if (GUtil.IsCursorKey(body)) { byte[] r = new byte[3]; r[0] = 0x1B; if (_cursorKeyMode == TerminalMode.Normal) { r[1] = (byte)'['; } else { r[1] = (byte)'O'; } switch (body) { case Keys.Up: r[2] = (byte)'A'; break; case Keys.Down: r[2] = (byte)'B'; break; case Keys.Right: r[2] = (byte)'C'; break; case Keys.Left: r[2] = (byte)'D'; break; default: throw new ArgumentException("unknown cursor key code", "key"); } return(r); } else { byte[] r = new byte[4]; r[0] = 0x1B; r[1] = (byte)'['; r[3] = (byte)'~'; if (body == Keys.Insert) { r[2] = (byte)'1'; } else if (body == Keys.Home) { r[2] = (byte)'2'; } else if (body == Keys.PageUp) { r[2] = (byte)'3'; } else if (body == Keys.Delete) { r[2] = (byte)'4'; } else if (body == Keys.End) { r[2] = (byte)'5'; } else if (body == Keys.PageDown) { r[2] = (byte)'6'; } else { throw new ArgumentException("unknown key " + body.ToString()); } return(r); } }
//特定のデータを流すタイプ。現在、カーソルキーとファンクションキーが該当する internal override int EncodeInputKey1(Keys key, out byte[] data) { Keys mods = key & Keys.Modifiers; Keys code = key & Keys.KeyCode; if ((int)Keys.F1 <= (int)code && (int)code <= (int)Keys.F12) { byte[] r = data = new byte[5]; r[0] = 0x1B; r[1] = (byte)'['; int n = (int)code - (int)Keys.F1; if ((mods & Keys.Shift) != Keys.None) { n += 10; //shiftは値を10ずらす } char tail; if (n >= 20) { tail = (mods & Keys.Control) != Keys.None? '@' : '$'; } else { tail = (mods & Keys.Control) != Keys.None? '^' : '~'; } string f = FUNCTIONKEY_MAP[n]; r[2] = (byte)f[0]; r[3] = (byte)f[1]; r[4] = (byte)tail; return(5); } else if (GUtil.IsCursorKey(code)) { byte[] r = data = new byte[3]; r[0] = 0x1B; if (_cursorKeyMode == TerminalMode.Normal) { r[1] = (byte)'['; } else { r[1] = (byte)'O'; } switch (code) { case Keys.Up: r[2] = (byte)'A'; break; case Keys.Down: r[2] = (byte)'B'; break; case Keys.Right: r[2] = (byte)'C'; break; case Keys.Left: r[2] = (byte)'D'; break; default: throw new ArgumentException("unknown cursor key code", "key"); } return(3); } else { byte[] r = data = new byte[4]; r[0] = 0x1B; r[1] = (byte)'['; r[3] = (byte)'~'; if (code == Keys.Insert) { r[2] = (byte)'1'; } else if (code == Keys.Home) { r[2] = (byte)'2'; } else if (code == Keys.PageUp) { r[2] = (byte)'3'; } else if (code == Keys.Delete) { r[2] = (byte)'4'; } else if (code == Keys.End) { r[2] = (byte)'5'; } else if (code == Keys.PageDown) { r[2] = (byte)'6'; } else { return(0); } return(4); } }