Example #1
0
            /// <summary>
            /// Updates the mouse selection.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
            private void UpdateMouseSelection(object sender, MouseEventArgs e)
            {
                if (!mouseDown)
                {
                    return;
                }

                currentPositionInfo = GetBytePositionInfo(new Point(e.X, e.Y));
                long selEnd = currentPositionInfo.Index;
                long realselStart;
                long realselLength;

                if (selEnd < startPositionInfo.Index)
                {
                    realselStart  = selEnd;
                    realselLength = startPositionInfo.Index - selEnd;
                }
                else if (selEnd > startPositionInfo.Index)
                {
                    realselStart  = startPositionInfo.Index;
                    realselLength = selEnd - realselStart;
                }
                else
                {
                    realselStart  = HexViewer.bytePosition;
                    realselLength = 0;
                }

                if (realselStart != HexViewer.bytePosition || realselLength != HexViewer._selectionLength)
                {
                    HexViewer.InternalSelect(realselStart, realselLength);
                }
            }
Example #2
0
            /// <summary>
            /// Begins the mouse selection.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
            private void BeginMouseSelection(object sender, MouseEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("BeginMouseSelection()", "KeyInterpreter");

                mouseDown = true;

                if (!ShiftDown)
                {
                    startPositionInfo = new BytePositionInfo(HexViewer.bytePosition, HexViewer.byteCharacterPosition);
                    HexViewer.ReleaseSelection();
                }
                else
                {
                    UpdateMouseSelection(this, e);
                }
            }
Example #3
0
            /// <summary>
            /// Pres the process wm key down_ shift shift key.
            /// </summary>
            /// <param name="m">The m.</param>
            /// <returns></returns>
            protected virtual bool PreProcessWmKeyDown_ShiftShiftKey(ref Message m)
            {
                if (mouseDown)
                {
                    return(true);
                }
                if (ShiftDown)
                {
                    return(true);
                }

                ShiftDown = true;

                if (HexViewer._selectionLength > 0)
                {
                    return(true);
                }

                startPositionInfo = new BytePositionInfo(HexViewer.bytePosition, HexViewer.byteCharacterPosition);

                return(true);
            }
Example #4
0
            protected virtual bool PreProcessWmKeyDown_ShiftShiftKey(ref Message m)
            {
                if (_mouseDown)
                    return true;
                if (_shiftDown)
                    return true;

                _shiftDown = true;

                if (_hexBox._selectionLength > 0)
                    return true;

                _bpiStart = new BytePositionInfo(_hexBox._bytePos, _hexBox._byteCharacterPos);

                return true;
            }
Example #5
0
            private void UpdateMouseSelection(object sender, MouseEventArgs e)
            {
                if (!_mouseDown)
                    return;

                _bpi = GetBytePositionInfo(new Point(e.X, e.Y));
                long selEnd = _bpi.Index;
                long realselStart;
                long realselLength;

                if (selEnd < _bpiStart.Index)
                {
                    realselStart = selEnd;
                    realselLength = _bpiStart.Index - selEnd;
                }
                else if (selEnd > _bpiStart.Index)
                {
                    realselStart = _bpiStart.Index;
                    realselLength = selEnd - realselStart;
                }
                else
                {
                    realselStart = _hexBox._bytePos;
                    realselLength = 0;
                }

                if (realselStart != _hexBox._bytePos || realselLength != _hexBox._selectionLength)
                {
                    _hexBox.InternalSelect(realselStart, realselLength);
                }
            }
Example #6
0
            private void BeginMouseSelection(object sender, MouseEventArgs e)
            {
                Debug.WriteLine("BeginMouseSelection()", "KeyInterpreter");

                _mouseDown = true;

                if (!_shiftDown)
                {
                    _bpiStart = new BytePositionInfo(_hexBox._bytePos, _hexBox._byteCharacterPos);
                    _hexBox.ReleaseSelection();
                }
                else
                {
                    UpdateMouseSelection(this, e);
                }
            }
            void BeginMouseSelection(object sender, MouseEventArgs e)
            {
                System.Diagnostics.Debug.WriteLine("BeginMouseSelection()", "KeyInterpreter");

                if (e.Button != MouseButtons.Left)
                    return;

                _mouseDown = true;

                if (!_shiftDown)
                {
                    _bpiStart = new BytePositionInfo(_hexBox._bytePos, _hexBox._byteCharacterPos);
                    _hexBox.ReleaseSelection();
                }
                else
                {
                    UpdateMouseSelection(this, e);
                }
            }
Example #8
0
 private void UpdateMouseSelection(object sender, MouseEventArgs e)
 {
     if (!_mouseDown)
         return;
     _bpi = GetBytePositionInfo(new Point(e.X, e.Y));
     long index = _bpi.Index;
     long start;
     long length;
     if (index < _bpiStart.Index)
     {
         start = index;
         length = _bpiStart.Index - index;
     }
     else if (index > _bpiStart.Index)
     {
         start = _bpiStart.Index;
         length = index - start;
     }
     else
     {
         start = _hexBox._bytePos;
         length = 0L;
     }
     if (start != _hexBox._bytePos || length != _hexBox._selectionLength)
     {
         _hexBox.InternalSelect(start, length);
         _hexBox.ScrollByteIntoView(_bpi.Index);
     }
     long num1 = _hexBox._bytePos;
     long num2 = _hexBox._selectionLength;
     if (_bpiStart.Index <= num1)
     {
         long num3 = num2 + (long)_hexBox._iHexMaxHBytes;
         _hexBox.ScrollByteIntoView(num1 + num3);
     }
     else
     {
         long num3 = num2 - (long)_hexBox._iHexMaxHBytes;
         long num4;
         long num5;
         if (num3 < 0L)
         {
             num4 = _bpiStart.Index;
             num5 = -num3;
         }
         else
         {
             num4 = num1 + (long)_hexBox._iHexMaxHBytes;
             num5 = num3 - (long)_hexBox._iHexMaxHBytes;
         }
         _hexBox.ScrollByteIntoView();
     }
 }
Example #9
0
 private void BeginMouseSelection(object sender, MouseEventArgs e)
 {
     if (e.Button != MouseButtons.Left)
         return;
     _mouseDown = true;
     if (!_shiftDown)
     {
         _bpiStart = new BytePositionInfo(_hexBox._bytePos, _hexBox._byteCharacterPos);
         _hexBox.ReleaseSelection();
     }
     else
         UpdateMouseSelection((object)this, e);
 }
Example #10
0
 private void UpdateMouseSelection(object sender, MouseEventArgs e)
 {
     if (!_mouseDown)
         return;
     _bpi = GetBytePositionInfo(new Point(e.X, e.Y));
     var selEnd = _bpi.Index;
     long realselStart;
     long realselLength;
     if (selEnd < _bpiStart.Index)
     {
         realselStart = selEnd;
         realselLength = _bpiStart.Index - selEnd;
     }
     else if (selEnd > _bpiStart.Index)
     {
         realselStart = _bpiStart.Index;
         realselLength = selEnd - realselStart;
     }
     else
     {
         realselStart = HexBox._bytePos;
         realselLength = 0;
     }
     if (realselStart == HexBox._bytePos && realselLength == HexBox._selectionLength) return;
     HexBox.InternalSelect(realselStart, realselLength);
     HexBox.ScrollByteIntoView(_bpi.Index); // <--- This line is added
 }
Example #11
0
        private void ctrlHexBox_MouseMove(object sender, MouseEventArgs e)
        {
            BytePositionInfo bpi = ctrlHexBox.GetHexBytePositionInfo(e.Location);

            ByteMouseHover?.Invoke((int)bpi.Index);
        }
Example #12
0
			void UpdateMouseSelection(object sender, MouseEventArgs e)
			{
				if (!_mouseDown)
					return;

				_bpi = GetBytePositionInfo(new Point(e.X, e.Y));
                long selEnd = _bpi.Index;

				long realselStart;
				long realselLength;

				if (selEnd < _bpiStart.Index)
				{
					realselStart = selEnd + _bpi.CharacterPosition;
					realselLength = _bpiStart.Index - selEnd + (_bpi.CharacterPosition ^ 1);
				}
				else if (selEnd > _bpiStart.Index)
				{
					realselStart = _bpiStart.Index;
					realselLength = selEnd - realselStart + _bpi.CharacterPosition;
				}
				else
				{
					realselStart = _bpiStart.Index;
					realselLength = 1;
				}

				if (realselStart != _hexBox._bytePos || realselLength != _hexBox._selectionLength)
				{
					_hexBox.InternalSelect(realselStart, realselLength);
					_hexBox.ScrollByteIntoView(_bpi.Index);
				}
			}
Example #13
0
 private void BeginMouseSelection(object sender, MouseEventArgs e)
 {
     Debug.WriteLine("BeginMouseSelection()", "KeyInterpreter");
     if (e.Button != MouseButtons.Left)
         return;
     this._mouseDown = true;
     if (!this._shiftDown)
     {
         this._bpiStart = new BytePositionInfo(this._hexBox._bytePos, this._hexBox._byteCharacterPos);
         this._hexBox.ReleaseSelection();
     }
     else
         this.UpdateMouseSelection((object)this, e);
 }
Example #14
0
 private void UpdateMouseSelection(object sender, MouseEventArgs e)
 {
     if (this._mouseDown)
     {
         long num2;
         long num3;
         this._bpi = this.GetBytePositionInfo(new Point(e.X, e.Y));
         long index = this._bpi.Index;
         if (index < this._bpiStart.Index)
         {
             num2 = index;
             num3 = this._bpiStart.Index - index;
         }
         else if (index > this._bpiStart.Index)
         {
             num2 = this._bpiStart.Index;
             num3 = index - num2;
         }
         else
         {
             num2 = this._hexBox._bytePos;
             num3 = 0L;
         }
         if ((num2 != this._hexBox._bytePos) || (num3 != this._hexBox._selectionLength))
         {
             this._hexBox.InternalSelect(num2, num3);
             this._hexBox.ScrollByteIntoView(this._bpi.Index);
         }
         long num4 = this._hexBox._bytePos;
         long num5 = this._hexBox._selectionLength;
         if (this._bpiStart.Index <= num4)
         {
             num5 += this._hexBox._iHexMaxHBytes;
             this._hexBox.ScrollByteIntoView(num4 + num5);
         }
         else
         {
             num5 -= this._hexBox._iHexMaxHBytes;
             if (num5 < 0L)
             {
                 num4 = this._bpiStart.Index;
                 num5 = -num5;
             }
             else
             {
                 num4 += this._hexBox._iHexMaxHBytes;
                 num5 -= this._hexBox._iHexMaxHBytes;
             }
             this._hexBox.ScrollByteIntoView();
         }
     }
 }
Example #15
0
 protected virtual bool PreProcessWmKeyDown_ShiftShiftKey(ref Message m)
 {
     if (!this._mouseDown)
     {
         if (this._shiftDown)
         {
             return true;
         }
         this._shiftDown = true;
         if (this._hexBox._selectionLength > 0L)
         {
             return true;
         }
         this._bpiStart = new BytePositionInfo(this._hexBox._bytePos, this._hexBox._byteCharacterPos);
     }
     return true;
 }
Example #16
0
 private void BeginMouseSelection(object sender, MouseEventArgs e)
 {
     this._mouseDown = true;
     if (!this._shiftDown)
     {
         this._bpiStart = new BytePositionInfo(this._hexBox._bytePos, this._hexBox._byteCharacterPos);
         this._hexBox.ReleaseSelection();
     }
     else
     {
         this.UpdateMouseSelection(this, e);
     }
 }