コード例 #1
0
        /// <summary>
        /// <ja>特別なキーの入力を受け付けます。
        /// Enter Up Dn Right Left Del Ins Home End PgUp PgDn, C-記号, etc.</ja>
        /// <en>Processes special key inputs such as
        /// Enter, Up, Dn, Right, Left, Del, Ins, Home, End, PgUp, PgDn, C-symbols, etc.</en>
        /// </summary>
        /// <param name="key">押されたキーに関する情報を指定します。</param>
        /// <returns>キー入力が処理された場合に true を返します。</returns>
        protected override bool ProcessDialogKey(Keys key)
        {
            Keys modifiers = key & Keys.Modifiers;
            Keys keybody   = key & Keys.KeyCode;

            //接続中でないとだめなキー
            if (IsAcceptableUserInput())
            {
                //TODO Enter,Space,SequenceKey系もカスタムキーに入れてしまいたい
                char[] custom = TerminalEmulatorPlugin.Instance.CustomKeySettings.Scan(key);                 //カスタムキー
                if (custom != null)
                {
                    SendCharArray(custom);
                    return(true);
                }
                else if (ProcessAdvancedFeatureKey(modifiers, keybody))
                {
                    return(true);
                }

                switch (key)
                {
                case Keys.Enter:                         // Keys.Return
                case Keys.LineFeed:
                    _escForVI = false;
                    SendCharArray(TerminalUtil.NewLineChars(GetTerminalSettings().TransmitNL));
                    return(true);

                case Keys.Control | Keys.Space:
                    SendChar('\0');
                    return(true);

                case Keys.Tab:
                case Keys.Tab | Keys.Shift:
                    SendChar('\t');
                    return(true);
                }

                if ((key & Keys.Alt) == 0 && mwgSendKey(key))
                {
                    return(true);
                }

#if DEBUG_UNRECOGNIZED_INPUT
                System.Console.WriteLine("ProcessDialogKey: unknown key = " + key);
#endif
            }

            //常に送れるキー
            if (keybody == Keys.Apps)            //コンテキストメニュー
            {
                TerminalDocument document = GetDocument();
                int   x = document.CaretColumn;
                int   y = document.CurrentLineNumber - document.TopLineNumber;
                SizeF p = GetRenderProfile().Pitch;
                _terminalEmulatorMouseHandler.ShowContextMenu(new Point((int)(p.Width * x), (int)(p.Height * y)));
                return(true);
            }

            return(base.ProcessDialogKey(key));
        }