private bool MovingSelectorMouseUp()
        {
            bool ret = false;
            if (CurrentSelector != null && CurrentSelector.Chord != null)
            {
                var sel = CurrentSelector;

                if (sel.StartPoint.X != sel.CurrentPoint.X)
                {
                    var tickPair = sel.Chord.TickPair;

                    if (sel.IsRight)
                    {
                        tickPair.Up = GetTickFromClientPoint(sel.CurrentPoint.X + Utility.SelectorWidth);
                    }
                    else
                    {
                        tickPair.Down = GetTickFromClientPoint(sel.CurrentPoint.X);
                    }
                    try
                    {
                        if (tickPair.TickLength > Utility.TickCloseWidth)
                        {
                            EditorPro.BackupSequence();

                            sel.Chord.SetTicks(tickPair);

                            var newChords = OnAddChordHandler(this, sel.Chord);

                            currentSelector = null;
                            if (newChords.Any())
                            {
                                SetSelected(newChords);
                            }
                        }
                        ret = true;
                    }
                    catch { }

                }
            }
            EditorPro.Invalidate();
            CurrentSelectionState = EditorSelectionState.Idle;
            return ret;
        }
        void DrawSelector(Graphics g,
            Selector sel)
        {
            var c = Utility.noteBGBrushSel.Color;
            var color = Color.FromArgb(40, 80, 40);
            if (sel == null || sel.Chord.HasNotes == false)
                return;

            var trans = sel.IsMouseOver ? 205 : sel.IsMouseNear ? 120 : 80;

            var r = sel.GetCurrentRect(this);

            using (Pen pn = new Pen(Color.FromArgb(trans, color), 1.0f))
            {
                int w = 3;
                if (sel.IsMouseOver == false)
                    w = 2;
                for (int j = 0; j < w; j++)
                {
                    Point[] p = new Point[2];
                    if (sel.IsRight)
                    {
                        p[0] = new Point(
                            r.X + Utility.SelectorWidth - 1 + j,
                            r.Y - 1);
                        p[1] = new Point(
                            r.X + Utility.SelectorWidth - 1 + j,
                            r.Y + r.Height + 2);
                    }
                    else
                    {
                        p[0] = new Point(
                             r.X - 1 + j,
                            r.Y - 1);
                        p[1] = new Point(
                            r.X - 1 + j,
                            r.Y + r.Height + 2);
                    }

                    g.DrawLine(pn, p[0], p[1]);
                }

                g.DrawLine(pn,
                    r.X,
                    r.Y - 1,
                    r.X + r.Width,
                    r.Y - 2);
                g.DrawLine(pn,
                    r.X,
                    r.Y + r.Height + 2,
                    r.X + r.Width,
                    r.Y + r.Height + 2);
            }
        }
        List<Selector> GetVisibleSelectors()
        {
            var ret = new List<Selector>();
            var chord = SelectedChord;
            if ((SelectedChord != null && SelectedChord.IsDeleted) || chord == null || chord.HasNotes == false)
                return ret;

            Point p = PointToClient(MousePosition);

            var minMaxY = GetChordYMinMax(chord);
            var start = GetClientPointFromTick(chord.DownTick);
            var end = GetClientPointFromTick(chord.UpTick);

            var chordScreen = new Rectangle(start, minMaxY.X, end - start, minMaxY.Y - minMaxY.X);

            var distC = p.Distance(chordScreen);

            if (distC <= Utility.ShowSelectorDist)
            {

                for (int sl = 0; sl < 2; sl++)
                {
                    var selector = new Rectangle(
                        chordScreen.X,
                        chordScreen.Top,
                        Utility.SelectorWidth,
                        chordScreen.Height);

                    Point startPos;

                    if (sl == 0)
                    {
                        selector.X += chordScreen.Width - Utility.SelectorWidth;

                        startPos = new Point(
                            chordScreen.Right - selector.Width,
                            chordScreen.Top);
                    }
                    else
                    {
                        startPos = new Point(chordScreen.X,
                            chordScreen.Top);
                    }

                    var sel = new Selector()
                    {
                        StartPoint = startPos,
                        CurrentPoint = startPos,
                        Chord = SelectedChord,
                        IsRight = sl == 0
                    };

                    Rectangle r = sel.GetCurrentRect(this);

                    var dist = p.Distance(r);

                    sel.IsMouseOver = false;
                    if (dist <= Utility.ShowSelectorDist)
                    {
                        sel.IsMouseNear = true;
                        if (r.Contains(p))
                        {
                            sel.IsMouseOver = true;

                        }
                    }
                    ret.Add(sel);
                }
            }

            return ret;
        }
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (Capture == false)
            {
                Capture = true;
            }

            if (DesignMode || InPlayback || guitarTrack == null || IsLoaded == false)
                return;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                SelectStartPoint = PointToClient(MousePosition);
            }

            if (EditorType != EEditorType.Guitar5)
            {
                Editor5.ClearSelection();
            }

            if (e.Button == System.Windows.Forms.MouseButtons.Right &&
                EditorType != EEditorType.Guitar5)
            {
                if (CurrentSelectionState == EditorSelectionState.MovingNotes)
                {
                    CurrentSelectionState = EditorSelectionState.Idle;
                    RestoreBackup();
                    Invalidate();
                    return;
                }
                else
                {
                    HandleProRightMouseMenu(e);

                    CurrentSelectionState = EditorSelectionState.Idle;
                    Invalidate();
                    return;
                }
            }
            else if (EditorType == EEditorType.Guitar5)
            {
                if (OnMouseDown5Tar(e))
                {
                    Invalidate();
                    return;
                }
            }

            bool handledEvent = false;

            if (EditorType != EEditorType.Guitar5)
            {
                if (CurrentSelectionState == EditorSelectionState.Idle)
                {
                    if (OnMouseDownEvent != null)
                    {
                        handledEvent = OnMouseDownEvent(this, e);
                    }

                    if (!handledEvent && !IsControlKeyDown && !IsAltKeyDown)
                    {
                        var mouseChord = GetChordFromPoint(PointToClient(MousePosition));
                        if (NumSelectedChords == 0 || mouseChord == null || mouseChord != SelectedChord)
                        {

                        }
                        else
                        {
                            if (EditMode == EEditMode.Chords)
                            {
                                if (mouseChord != null && SelectedChord != null &&
                                    mouseChord == SelectedChord)
                                {
                                    UpdateSelectorVisibility();

                                    if (MouseOverSelector)
                                    {
                                        foreach (var sel in visibleSelectors)
                                        {
                                            if (sel.GetCurrentRect(this).Contains(PointToClient(MousePosition)))
                                            {
                                                CurrentSelectionState = EditorSelectionState.MovingSelector;
                                                currentSelector = sel;
                                            }
                                        }
                                        if (CurrentSelectionState != EditorSelectionState.MovingSelector)
                                        {
                                            CurrentSelectionState = EditorSelectionState.Idle;
                                        }

                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (!handledEvent &&
                (CurrentSelectionState == EditorSelectionState.Idle ||
                CurrentSelectionState == EditorSelectionState.MovingSelector))
            {

                var mc = GetChordFromPoint(PointToClient(MousePosition));
                if (mc == null)
                {
                    if (CurrentSelectionState == EditorSelectionState.Idle)
                    {
                        if (!handledEvent)
                        {
                            CurrentSelectionState = EditorSelectionState.SelectingBox;
                        }
                    }
                }
                else
                {

                    if (CurrentSelectionState == EditorSelectionState.Idle)
                    {
                        if (IsControlKeyDown)
                        {
                            mc.Selected = true;
                        }
                        else if (IsAltKeyDown)
                        {
                            mc.Selected = false;
                        }
                        else
                        {
                            SetSelectedChord(mc, true, mc.Selected);

                            visibleSelectors = GetVisibleSelectors();
                        }
                    }
                }

                SelectCurrentPoint = SelectStartPoint;

            }
            UpdateSelectorVisibility();
            Invalidate();
        }