Ejemplo n.º 1
0
        /// <inheritdoc />
        protected override void OnMouseDown(MouseEventArgs e)
        {
            Focus();
            _mouseDownMark = null;
            Point location = _mouseDownLocation = TranslateLocation(e.Location);


            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                _mouseDownMark = MarkAt(location);

                if (!CtrlPressed && !ShiftPressed)
                {
                    if (!_marksSelectionManager.IsSelected(_mouseDownMark))
                    {
                        _lastSingleSelectedMarkLocation = location;
                        _marksSelectionManager.ClearSelected();
                        _marksSelectionManager.Select(_mouseDownMark);
                    }
                }
                else if (ShiftPressed)
                {
                    if (_lastSingleSelectedMarkLocation != Point.Empty)
                    {
                        SelectMarksBetween(_lastSingleSelectedMarkLocation, location);
                    }
                }
                else
                {
                    if (_marksSelectionManager.IsSelected(_mouseDownMark))
                    {
                        _marksSelectionManager.DeSelect(_mouseDownMark);
                    }
                    else
                    {
                        _lastSingleSelectedMarkLocation = location;
                        _marksSelectionManager.Select(_mouseDownMark);
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                if (_markResizeZone == ResizeZone.None)
                {
                    // begin waiting for a normal drag
                    WaitForDragMove(location);
                }
                else if (!CtrlPressed)
                {
                    BeginHResize(location);                     // begin a resize.
                }
            }
        }
Ejemplo n.º 2
0
        //public SortedDictionary<TimeSpan, SnapDetails> selectedMarks = new SortedDictionary<TimeSpan, SnapDetails>();

        protected override void OnMouseDown(MouseEventArgs e)
        {
            //Console.WriteLine("Clicks: " + e.Clicks);

            m_button     = e.Button;
            m_mouseDownX = e.X;
            //if (e.Button != MouseButtons.Left) return;

            // If we're hovering over a mark when left button is clicked, then select/move the mark
            var marksAtTime = MarksAt(pixelsToTime(e.X) + VisibleTimeStart);

            if (marksAtTime.Any())
            {
                if (ModifierKeys != Keys.Control)
                {
                    _marksSelectionManager.ClearSelected();
                }

                if (_marksSelectionManager.SelectedMarks.Contains(marksAtTime.First()))
                {
                    _marksSelectionManager.DeSelect(marksAtTime.First());
                }
                else
                {
                    _marksSelectionManager.Select(marksAtTime.First());
                }

                _mouseDownMark       = marksAtTime.First();
                _dragLastTime        = _mouseDownMark.StartTime;
                m_mouseState         = MouseState.DraggingMark;
                _marksMoveResizeInfo = new MarksMoveResizeInfo(_marksSelectionManager.SelectedMarks);
            }
            else if (Cursor == Cursors.HSplit)
            {
                m_mouseState = MouseState.ResizeRuler;
            }
            else
            {
                _marksSelectionManager.ClearSelected();
                m_mouseState = MouseState.DragWait;
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        protected override void OnMouseDown(MouseEventArgs e)
        {
            Focus();
            _mouseDownMark = null;
            Point location = _mouseDownLocation = TranslateLocation(e.Location);

            if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
            {
                _mouseDownMark = MarkAt(location);

                if (e.Clicks == 2 && _mouseDownMark != null)
                {
                    if (AltPressed)
                    {
                        BeginMoveResizeMarks(location);
                        _mouseDownMark.Parent.FillGapTimes(_mouseDownMark);
                        FinishedResizeMoveMarks(ElementMoveType.Resize);
                        return;
                    }

                    _timeLineGlobalEventManager.OnPlayRange(new PlayRangeEventArgs(_mouseDownMark.StartTime,
                                                                                   _mouseDownMark.EndTime));
                    return;
                }

                if (!CtrlPressed && !ShiftPressed)
                {
                    if (!_marksSelectionManager.IsSelected(_mouseDownMark))
                    {
                        _lastSingleSelectedMarkLocation = location;
                        _marksSelectionManager.ClearSelected();
                        _marksSelectionManager.Select(_mouseDownMark);
                    }
                }
                else if (ShiftPressed)
                {
                    if (_lastSingleSelectedMarkLocation != Point.Empty)
                    {
                        SelectMarksBetween(_lastSingleSelectedMarkLocation, location);
                    }
                }
                else
                {
                    if (_marksSelectionManager.IsSelected(_mouseDownMark))
                    {
                        _marksSelectionManager.DeSelect(_mouseDownMark);
                    }
                    else
                    {
                        _lastSingleSelectedMarkLocation = location;
                        _marksSelectionManager.Select(_mouseDownMark);
                    }
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                if (_markResizeZone == ResizeZone.None)
                {
                    // begin waiting for a normal drag
                    WaitForDragMove(location);
                }
                else if (!CtrlPressed)
                {
                    BeginHResize(location);                     // begin a resize.
                }
            }
        }