示例#1
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (this.IsAcceptableUserInput())
            {
                if (terminalMouseState == 0)
                {
                    goto skip;
                }

                // 位置・ボタン情報
                Keys       flags = KeyboardInfo.GetModifierState();
                Gdi::Point pos   = base.ClientPointToCharBorder(e.Location);
                pos.X++;
                pos.Y++;
                //Gdi::Point pos=base.ClientPointToTextPosition(e.Location);
                //pos.X++;
                //pos.Y++;

                // MouseTracking "Button Released"
                int f = 0;
                if (UpdateMouseButtonState(e, MouseButtons.Left, flags | Keys.LButton, pos, true))
                {
                    f++;
                }
                if (UpdateMouseButtonState(e, MouseButtons.Right, flags | Keys.RButton, pos, true))
                {
                    f++;
                }
                if (UpdateMouseButtonState(e, MouseButtons.Middle, flags | Keys.MButton, pos, true))
                {
                    f++;
                }
                if (f != 0)
                {
                    return;
                }

                // MouseTracking "Release-Button Pressed"
                terminalMouseState &= ~e.Button;
                if (terminalMouseState == 0)
                {
                    if (UpdateMouseButtonState(e, 0, flags, pos, false))
                    {
                        return;
                    }
                }
            }

skip:
            base.OnMouseUp(e);
        }
示例#2
0
        /// <summary>
        /// <ja>指定したキー入力に対する送信バイトを取得します。</ja>
        /// </summary>
        /// <param name="key"><ja>キー入力を指定します。</ja></param>
        /// <returns><ja>1バイトでキー入力を表現出来る場合に、その値を返します。1バイトで表現できない場合には 0xFF を返します。</ja></returns>
        internal virtual byte EncodeInputByte(Keys key)
        {
            byte r = KeyboardInfo.ConvertToChar(key);

            if (r != 0)
            {
                if (0 != (key & Keys.Control))
                {
                    r &= 0x1F;
                }
                return(r);
            }
            return(0xFF);
        }
示例#3
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (this.IsAcceptableUserInput())
            {
                Keys flags = KeyboardInfo.GetModifierState();
                //if((flags&Keys.Shift)==0){
                if (Control.IsKeyLocked(Keys.Scroll))
                {
                    Gdi::Point pos = base.ClientPointToCharBorder(e.Location);
                    pos.X++;
                    pos.Y++;
                    //Gdi::Point pos=base.ClientPointToTextPosition(e.Location);
                    //pos.X++;
                    //pos.Y++;

                    int f = 0;
                    if (UpdateMouseButtonState(e, MouseButtons.Left, flags | Keys.LButton, pos, false))
                    {
                        f++;
                    }
                    if (UpdateMouseButtonState(e, MouseButtons.Right, flags | Keys.RButton, pos, false))
                    {
                        f++;
                    }
                    if (UpdateMouseButtonState(e, MouseButtons.Middle, flags | Keys.MButton, pos, false))
                    {
                        f++;
                    }
                    if (f != 0)
                    {
                        return;
                    }
                }
            }
            base.OnMouseDown(e);
        }
示例#4
0
        protected override void OnMouseWheel(MouseEventArgs e)
        {
            //base.OnMouseWheel(e); //CharacaterDocumentViewerは無視してよい
            if (!this.EnabledEx)
            {
                return;
            }

#if MWG_MOUSE
            if (this.IsAcceptableUserInput())
            {
                Keys flags = KeyboardInfo.GetModifierState();
                //if((flags&Keys.Shift)==0){ // shift は poderosa で処理。
                if (Control.IsKeyLocked(Keys.Scroll))                 // shift は poderosa で処理。
                // 便宜上 [↑]を XButton1 に [↓]を XButton2 に割り当てる。
                {
                    Keys buttons = e.Delta > 0?Keys.XButton1:Keys.XButton2;
                    buttons |= flags;

                    //Gdi::Point pos=base.ClientPointToTextPosition(e.Location);
                    //pos.X++;
                    //pos.Y++;
                    Gdi::Point pos = base.ClientPointToCharBorder(e.Location);
                    pos.X++;
                    pos.Y++;

                    byte[] seq;
                    int    len = GetTerminal().EncodeInputMouse(buttons, pos.X, pos.Y, out seq, false);
                    if (len > 0)
                    {
                        mwgSendBytes(seq, len);
                        return;
                    }
                }
            }
#endif

            //アプリケーションモードでは通常処理をやめてカーソル上下と同等の処理にする
            if (_session != null && !GEnv.Options.AllowsScrollInAppMode && GetTerminal().TerminalMode == TerminalMode.Application)
            {
                int m = GEnv.Options.WheelAmount;
                for (int i = 0; i < m; i++)
                {
                    mwgSendKey(Keys.None | (e.Delta > 0? Keys.Up : Keys.Down));
                }
                return;
            }

            if (_VScrollBar.Enabled)
            {
                int d = e.Delta / 120;                 //開発環境だとDeltaに120。これで1か-1が入るはず
                d *= GEnv.Options.WheelAmount;

                int newval = _VScrollBar.Value - d;
                if (newval < 0)
                {
                    newval = 0;
                }
                if (newval > _VScrollBar.Maximum - _VScrollBar.LargeChange)
                {
                    newval = _VScrollBar.Maximum - _VScrollBar.LargeChange + 1;
                }
                _VScrollBar.Value = newval;
            }
        }