//TODO: This has not been revisited yet.

        /*
         * private void MouseMove_DragMoving_OLD(MouseEventArgs e)
         * {
         * Point gridLocation = translateLocation(e.Location);
         *
         * // if we don't have anything selected, there's no point dragging anything...
         * if (SelectedElements.Count() == 0)
         * return;
         *
         * Point d = new Point(e.X - m_lastMouseLocation.X, e.Y - m_lastMouseLocation.Y);
         * m_lastMouseLocation = e.Location;
         *
         * // calculate the points at which we should start dragging; ie. account for any selected elements.
         * // (we subtract VisibleTimeStart to make it relative to the control, instead of the grid canvas.)
         * TimeSpan earliestTime = GetEarliestTimeForElements(SelectedElements);
         * TimeSpan latestTime = GetLatestTimeForElements(SelectedElements);
         * int leftBoundary = (int)timeToPixels(earliestTime - VisibleTimeStart + DragTimeLeftOver);
         * int rightBoundary = (int)timeToPixels(latestTime - VisibleTimeStart + DragTimeLeftOver);
         *
         * // if the mouse moved left, only add it to the scroll size if:
         * // 1) the elements are hard left (or more) in the viewport
         * // 2) the elements are hard right, and we are moving right. This provides deceleration.
         * //    Cap this value to 0.
         * if (d.X < 0)
         * {
         * if (leftBoundary <= 0)
         *  m_dragAutoscrollDistance.Width += d.X;
         * else if (rightBoundary >= ClientSize.Width && m_dragAutoscrollDistance.Width > 0)
         *  m_dragAutoscrollDistance.Width = Math.Max(0, m_dragAutoscrollDistance.Width + d.X);
         * }
         *
         * // if the mouse moved right, do the inverse of the above rules.
         * if (d.X > 0)
         * {
         * if (rightBoundary >= ClientSize.Width)
         *  m_dragAutoscrollDistance.Width += d.X;
         * else if (leftBoundary <= 0 && m_dragAutoscrollDistance.Width < 0)
         *  m_dragAutoscrollDistance.Width = Math.Min(0, m_dragAutoscrollDistance.Width + d.X);
         * }
         *
         * // if the left and right boundaries are within the viewport, then stop all
         * // horizontal scrolling. This can happen if the user scrolls, and mouse-wheels
         * // (to zoom out). the control is stuck scrolling, and can't be stopped.
         * if (leftBoundary > 0 && rightBoundary < ClientSize.Width)
         * m_dragAutoscrollDistance.Width = 0;
         *
         * m_dragAutoscrollDistance.Height = (e.Y < 0) ? e.Y : ((e.Y > ClientSize.Height) ? e.Y - ClientSize.Height : 0);
         *
         * // if we're scrolling, start the timer if needed. If not, vice-versa.
         * if (m_dragAutoscrollDistance.Width != 0 || m_dragAutoscrollDistance.Height != 0)
         * {
         * if (!ScrollTimer.Enabled)
         *  ScrollTimer.Start();
         * }
         * else
         * {
         * if (ScrollTimer.Enabled)
         *  ScrollTimer.Stop();
         * }
         *
         * // only move the elements here if we aren't going to be auto-dragging while scrolling in the timer events.
         * if (d.X != 0 && m_dragAutoscrollDistance.Width == 0)
         * {
         * TimeSpan desiredMoveTime = DragTimeLeftOver + pixelsToTime(d.X);
         * TimeSpan realMoveTime = OffsetElementsByTime(SelectedElements, desiredMoveTime);
         * DragTimeLeftOver = desiredMoveTime - realMoveTime;
         * }
         *
         * // if we've moved vertically, we may need to move elements between rows
         * if (d.Y != 0 && !ResizingElement)
         * {
         * MoveElementsVerticallyToLocation(SelectedElements, gridLocation);
         * }
         * }
         */


        /// <summary>
        /// Handles mouse move events while in the "Moving" state.
        /// </summary>
        /// <param name="gridLocation">Mouse location on the grid.</param>
        private void MouseMove_DragMoving(Point gridLocation)
        {
            // if we don't have anything selected, there's no point dragging anything...
            if (SelectedElements.Count() == 0)
            {
                return;
            }

            TimeSpan dt = pixelsToTime(gridLocation.X - m_elemMoveInfo.InitialGridLocation.X);
            int      dy = gridLocation.Y - m_elemMoveInfo.InitialGridLocation.Y;

            // If we didn't move, get outta here.
            if (dt == TimeSpan.Zero && dy == 0)
            {
                return;
            }


            // Calculate what our actual dt value will be.
            TimeSpan earliest = m_elemMoveInfo.OriginalElements.Values.Min(x => x.StartTime);

            if ((earliest + dt) < TimeSpan.Zero)
            {
                dt = -earliest;
            }

            TimeSpan latest = m_elemMoveInfo.OriginalElements.Values.Max(x => x.EndTime);

            if ((latest + dt) > TimeInfo.TotalTime)
            {
                dt = TimeInfo.TotalTime - latest;
            }

            // modify the dt time based on snap points (ie. marks, and borders of other elements)
            dt = FindSnapTimeForElements(SelectedElements, dt, ResizeZone.None);

            foreach (var elem in SelectedElements)
            {
                // Get this elemenent's original times (before resize started)
                ElementTimeInfo orig = m_elemMoveInfo.OriginalElements[elem];
                elem.StartTime = orig.StartTime + dt;
            }

            // if we've moved vertically, we may need to move elements between rows
            if (dy != 0)
            {
                MoveElementsVerticallyToLocation(SelectedElements, gridLocation);
            }

            Invalidate();
        }