private void TourStopList_MouseDown(object sender, MouseEventArgs e)
        {
            pointDown = e.Location;
            if (timeEditor != null)
            {
                timeEditor.Close();
                timeEditor.Dispose();
                timeEditor = null;
            }
            if (e.Y < 10)
            {
                int scrollbarWidth = Width;
                int scrollbarStart = 0;

                scrollbarWidth = Math.Max(14, (int)(Math.Min(1.0f, (float)ItemsPerPage / (float)(TotalItems + 1)) * (float)Width));
                scrollbarStart = (int)(((float)startIndex / (float)(TotalItems + 1)) * (float)Width);

                // Page Up
                if (e.X > (scrollbarWidth + scrollbarStart))
                {
                    startIndex = Math.Min((TotalItems + 1) - ItemsPerPage, startIndex + ItemsPerPage);

                    return;
                }

                if (e.X < scrollbarStart)
                {
                    startIndex = Math.Max(0, startIndex - ItemsPerPage);
                    Refresh();
                    return;
                }

                scrollStartIndex = startIndex;
                scrolling        = true;
            }

            mouseDown = true;
        }
        private void TourStopList_MouseDown(object sender, MouseEventArgs e)
        {
            pointDown = e.Location;
            if (timeEditor != null)
            {
                timeEditor.Close();
                timeEditor.Dispose();
                timeEditor = null;
            }
            if (e.Y < 10)
            {
                int scrollbarWidth = Width;
                int scrollbarStart = 0;

                scrollbarWidth = Math.Max(14, (int)(Math.Min(1.0f, (float)ItemsPerPage / (float)(TotalItems + 1)) * (float)Width));
                scrollbarStart = (int)(((float)startIndex / (float)(TotalItems + 1)) * (float)Width);

                // Page Up
                if (e.X > (scrollbarWidth + scrollbarStart))
                {

                    startIndex = Math.Min((TotalItems + 1) - ItemsPerPage, startIndex + ItemsPerPage);

                    return;
                }

                if (e.X < scrollbarStart)
                {
                    startIndex = Math.Max(0, startIndex - ItemsPerPage);
                    Refresh();
                    return;
                }

                scrollStartIndex = startIndex;
                scrolling = true;
            }

            mouseDown = true;
        }
        private void TourStopList_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Y < 10)
            {
                return;
            }
            bool extendingRange = false;
            int index = GetItemIndexFromCursor(e.Location);
            if (index > -1)
            {

                if (multiSelectMode)
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        if (SelectedItems.ContainsKey(index) && SelectedItems.Count > 1)
                        {
                            // We are right clicking on a multi selection.. Set focus only
                            selectedItem = index;
                            return;
                        }
                    }

                    if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
                    {
                        // No control key means clear existing selection and replace
                        SelectedItems.Clear();
                    }

                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        extendingRange = true;
                        // Add Range to selection
                        int a = Math.Min(index, selectedItem);
                        int b = Math.Max(index, selectedItem);

                        for (int i = a; i <= b; i++)
                        {
                            if (!SelectedItems.ContainsKey(i))
                            {
                                SelectedItems.Add(i, Items[i]);
                            }
                        }
                    }
                    else
                    {
                        // Simple Selection
                        if (SelectedItems.ContainsKey(index))
                        {
                            // Remove an item only if there is more than one selection.
                            if (SelectedItems.Count > 1)
                            {
                                SelectedItems.Remove(index);
                            }
                        }
                        else
                        {
                            SelectedItems.Add(index, Items[index]);
                        }
                    }

                    multipleSelection = (SelectedItems.Count > 1);
                }
                else
                {
                    multipleSelection = false;
                    SelectedItems.Clear();
                    SelectedItems.Add(index, Items[index]);
                }

                // In multiselect case this acts as focus
                if (!extendingRange)
                {
                    selectedItem = index;
                }

                if (((Control.ModifierKeys & Keys.Control) == Keys.Control) || ((Control.ModifierKeys & Keys.Shift) == Keys.Shift))
                {
                    // Early exit if multi-selecting
                    return;
                }

                hitType = this.GetCusorSytleFromCursorPosition(e.Location);

                if (ItemClicked != null)
                {
                    ItemClicked.Invoke(this, Items[index]);
                }

                if (Tour.EditMode)
                {
                    if (hitType == HitPosition.EditTime)
                    {
                        int item = GetItemIndexFromCursor(e.Location);
                        Point pnt = GetTimeEditLocation(e.Location);
                        if (timeEditor != null)
                        {
                            timeEditor.Close();
                            timeEditor.Dispose();
                            timeEditor = null;
                        }
                        timeEditor = new DurrationEditor();
                        timeEditor.target = Items[index];
                        timeEditor.Show();
                        timeEditor.Focus();

                        pnt = PointToScreen(pnt);
                        pnt.X += 4;
                        pnt.Y += 65;
                        timeEditor.Location = pnt;
                    }

                    if (hitType == HitPosition.EditName)
                    {
                        int item = GetItemIndexFromCursor(e.Location);
                        Point pnt = GetTimeEditLocation(e.Location);
                        if (textEditor != null)
                        {
                            textEditor.Close();
                            textEditor.Dispose();
                            textEditor = null;
                        }
                        textEditor = new PopupTextEditor();
                        textEditor.target = Items[index];
                        textEditor.Show();
                        textEditor.Focus();

                        pnt = PointToScreen(pnt);
                        pnt.X += 15;
                        pnt.Y += 49;
                        textEditor.Location = pnt;
                    }

                    if (hitType == HitPosition.StartPosition)
                    {
                        if (ShowStartPosition != null)
                        {

                            ShowStartPosition.Invoke(this, Items[index]);
                        }
                    }
                    if (hitType == HitPosition.EndPosition)
                    {
                        if (ShowStartPosition != null)
                        {
                            ShowEndPosition.Invoke(this, Items[index]);
                        }
                    }

                    if (hitType == HitPosition.Transition)
                    {
                        TransitionsPopup transPopup = new TransitionsPopup();
                        transPopup.Target = Items[index];
                        transPopup.TargetWasChanged += new EventHandler(transPopup_TargetWasChanged);
                        Point pnt = new Point((int)((int)(e.X / horzMultiple) * horzMultiple), Height);

                        transPopup.Show();
                        transPopup.Focus();
                        pnt = PointToScreen(pnt);
                        pnt.X -= 10;
                        pnt.Y -= 18;
                        transPopup.Location = pnt;

                    }
                }
            }
            else if (addButtonHover)
            {
                if (e.Button != System.Windows.Forms.MouseButtons.Right)
                {
                    if (Tour.EditMode && showAddButton)
                    {
                        if (AddNewSlide != null)
                        {
                            AddNewSlide.Invoke(this, null);
                        }
                    }
                }
                else
                {
                    SelectedItems.Clear();
                    SelectedItem = -1;
                }
            }
            else if (index == -2)
            {
                SelectedItems.Clear();
                SelectedItem = -1;
                if (ItemClicked != null)
                {
                    ItemClicked.Invoke(this, null);
                }
            }
        }
        private void TourStopList_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Y < 10)
            {
                return;
            }
            bool extendingRange = false;
            int  index          = GetItemIndexFromCursor(e.Location);

            if (index > -1)
            {
                if (multiSelectMode)
                {
                    if (e.Button == System.Windows.Forms.MouseButtons.Right)
                    {
                        if (SelectedItems.ContainsKey(index) && SelectedItems.Count > 1)
                        {
                            // We are right clicking on a multi selection.. Set focus only
                            selectedItem = index;
                            return;
                        }
                    }


                    if ((Control.ModifierKeys & Keys.Control) != Keys.Control)
                    {
                        // No control key means clear existing selection and replace
                        SelectedItems.Clear();
                    }

                    if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift)
                    {
                        extendingRange = true;
                        // Add Range to selection
                        int a = Math.Min(index, selectedItem);
                        int b = Math.Max(index, selectedItem);

                        for (int i = a; i <= b; i++)
                        {
                            if (!SelectedItems.ContainsKey(i))
                            {
                                SelectedItems.Add(i, Items[i]);
                            }
                        }
                    }
                    else
                    {
                        // Simple Selection
                        if (SelectedItems.ContainsKey(index))
                        {
                            // Remove an item only if there is more than one selection.
                            if (SelectedItems.Count > 1)
                            {
                                SelectedItems.Remove(index);
                            }
                        }
                        else
                        {
                            SelectedItems.Add(index, Items[index]);
                        }
                    }

                    multipleSelection = (SelectedItems.Count > 1);
                }
                else
                {
                    multipleSelection = false;
                    SelectedItems.Clear();
                    SelectedItems.Add(index, Items[index]);
                }

                // In multiselect case this acts as focus
                if (!extendingRange)
                {
                    selectedItem = index;
                }

                if (((Control.ModifierKeys & Keys.Control) == Keys.Control) || ((Control.ModifierKeys & Keys.Shift) == Keys.Shift))
                {
                    // Early exit if multi-selecting
                    return;
                }

                hitType = this.GetCusorSytleFromCursorPosition(e.Location);

                if (ItemClicked != null)
                {
                    ItemClicked.Invoke(this, Items[index]);
                }

                if (Tour.EditMode)
                {
                    if (hitType == HitPosition.EditTime)
                    {
                        int   item = GetItemIndexFromCursor(e.Location);
                        Point pnt  = GetTimeEditLocation(e.Location);
                        if (timeEditor != null)
                        {
                            timeEditor.Close();
                            timeEditor.Dispose();
                            timeEditor = null;
                        }
                        timeEditor        = new DurrationEditor();
                        timeEditor.target = Items[index];
                        timeEditor.Show();
                        timeEditor.Focus();

                        pnt    = PointToScreen(pnt);
                        pnt.X += 4;
                        pnt.Y += 65;
                        timeEditor.Location = pnt;
                    }

                    if (hitType == HitPosition.EditName)
                    {
                        int   item = GetItemIndexFromCursor(e.Location);
                        Point pnt  = GetTimeEditLocation(e.Location);
                        if (textEditor != null)
                        {
                            textEditor.Close();
                            textEditor.Dispose();
                            textEditor = null;
                        }
                        textEditor        = new PopupTextEditor();
                        textEditor.target = Items[index];
                        textEditor.Show();
                        textEditor.Focus();

                        pnt    = PointToScreen(pnt);
                        pnt.X += 15;
                        pnt.Y += 49;
                        textEditor.Location = pnt;
                    }

                    if (hitType == HitPosition.StartPosition)
                    {
                        if (ShowStartPosition != null)
                        {
                            ShowStartPosition.Invoke(this, Items[index]);
                        }
                    }
                    if (hitType == HitPosition.EndPosition)
                    {
                        if (ShowStartPosition != null)
                        {
                            ShowEndPosition.Invoke(this, Items[index]);
                        }
                    }

                    if (hitType == HitPosition.Transition)
                    {
                        TransitionsPopup transPopup = new TransitionsPopup();
                        transPopup.Target            = Items[index];
                        transPopup.TargetWasChanged += new EventHandler(transPopup_TargetWasChanged);
                        Point pnt = new Point((int)((int)(e.X / horzMultiple) * horzMultiple), Height);

                        transPopup.Show();
                        transPopup.Focus();
                        pnt    = PointToScreen(pnt);
                        pnt.X -= 10;
                        pnt.Y -= 18;
                        transPopup.Location = pnt;
                    }
                }
            }
            else if (addButtonHover)
            {
                if (e.Button != System.Windows.Forms.MouseButtons.Right)
                {
                    if (Tour.EditMode && showAddButton)
                    {
                        if (AddNewSlide != null)
                        {
                            AddNewSlide.Invoke(this, null);
                        }
                    }
                }
                else
                {
                    SelectedItems.Clear();
                    SelectedItem = -1;
                }
            }
            else if (index == -2)
            {
                SelectedItems.Clear();
                SelectedItem = -1;
                if (ItemClicked != null)
                {
                    ItemClicked.Invoke(this, null);
                }
            }
        }