Ejemplo n.º 1
0
bool
Seq24SeqEventInput::on_motion_notify_event
(
   GdkEventMotion * ev,
   seqevent & seqev
)
{
    bool result = false;
    midipulse tick = 0;
    if (seqev.m_moving_init)
    {
        seqev.m_moving_init = false;
        seqev.m_moving = true;
    }
    if (seqev.m_selecting || seqev.m_moving || seqev.m_paste)
    {
        seqev.m_current_x = int(ev->x) + seqev.m_scroll_offset_x;
        if (seqev.m_moving || seqev.m_paste)
            seqev.snap_x(seqev.m_current_x);

        seqev.draw_selection_on_window();
    }
    if (seqev.m_painting)
    {
        seqev.m_current_x = int(ev->x) + seqev.m_scroll_offset_x;
        seqev.snap_x(seqev.m_current_x);
        seqev.convert_x(seqev.m_current_x, tick);
        seqev.drop_event(tick);
        result = true;
    }
    return result;
}
Ejemplo n.º 2
0
void
Seq24SeqEventInput::set_adding (bool adding, seqevent & seqev)
{
    m_adding = adding;
    if (adding)
        seqev.get_window()->set_cursor(Gdk::Cursor(Gdk::PENCIL));
    else
        seqev.get_window()->set_cursor(Gdk::Cursor(Gdk::LEFT_PTR));
}
Ejemplo n.º 3
0
void
FruitySeqEventInput::update_mouse_pointer (seqevent & seqev)
{
    midipulse tick_s, tick_w, pos;
    seqev.convert_x(seqev.m_current_x, tick_s);
    seqev.convert_x(c_eventevent_x, tick_w);

    midipulse tick_f = tick_s + tick_w; // can tick_f ever get < 0?
    if (tick_s < 0)
        tick_s = 0;                     // clamp to 0

    if (m_is_drag_pasting || seqev.m_selecting || seqev.m_moving || seqev.m_paste)
        seqev.get_window()->set_cursor(Gdk::Cursor(Gdk::LEFT_PTR));
    else if (seqev.m_seq.intersect_events(tick_s, tick_f, seqev.m_status, pos))
        seqev.get_window()->set_cursor(Gdk::Cursor(Gdk::CENTER_PTR));
    else
        seqev.get_window()->set_cursor(Gdk::Cursor(Gdk::PENCIL));
}
Ejemplo n.º 4
0
bool
Seq24SeqEventInput::on_button_release_event
(
    GdkEventButton * a_ev,
    seqevent & seqev
)
{
    long tick_s;
    long tick_f;
    seqev.grab_focus();
    seqev.m_current_x = int(a_ev->x) + seqev.m_scroll_offset_x;
    if (seqev.m_moving)
        seqev.snap_x(seqev.m_current_x);

    int delta_x = seqev.m_current_x - seqev.m_drop_x;
    long delta_tick;
    if (CLICK_IS_LEFT(a_ev->button))
    {
        if (seqev.m_selecting)
        {
            int x, w;
            seqev.x_to_w(seqev.m_drop_x, seqev.m_current_x, x, w);
            seqev.convert_x(x, tick_s);
            seqev.convert_x(x + w, tick_f);
            (void) seqev.m_seq.select_events
            (
                tick_s, tick_f, seqev.m_status, seqev.m_cc, sequence::e_select
            );
        }
        if (seqev.m_moving)
        {
            delta_x -= seqev.m_move_snap_offset_x; /* adjust for snap       */
            seqev.convert_x(delta_x, delta_tick);  /* to screen coordinates */
            seqev.m_seq.push_undo();              /* still moves events    */
            seqev.m_seq.move_selected_notes(delta_tick, 0);
        }
        set_adding(m_adding, seqev);
    }
    if (CLICK_IS_RIGHT(a_ev->button))
    {
        set_adding(false, seqev);
    }
    seqev.m_selecting = false;                      /* turn off             */
    seqev.m_moving = false;
    seqev.m_growing = false;
    seqev.m_moving_init = false;
    seqev.m_painting = false;
    seqev.m_seq.unpaint_all();
    seqev.update_pixmap();            /* if they clicked, something changed */
    seqev.draw_pixmap_on_window();
    return true;
}
Ejemplo n.º 5
0
bool
FruitySeqEventInput::on_motion_notify_event
(
    GdkEventMotion * ev,
    seqevent & seqev
)
{
    bool result = false;
    midipulse tick = 0;
    seqev.m_current_x = (int) ev->x  + seqev.m_scroll_offset_x;
    if (seqev.m_moving_init)
    {
        seqev.m_moving_init = false;
        seqev.m_moving = true;
    }
    update_mouse_pointer(seqev);      /* context sensitive mouse pointer... */

    /*
     * Ctrl-left click drag on selected note(s) starts a copy/unselect/paste.
     */

    if (m_is_drag_pasting_start)
    {
        seqev.m_seq.copy_selected();
        seqev.m_seq.unselect();
        seqev.start_paste();
        m_is_drag_pasting_start = false;
        m_is_drag_pasting = true;
    }
    if (seqev.m_selecting || seqev.m_moving || seqev.m_paste)
    {
        if (seqev.m_moving || seqev.m_paste)
            seqev.snap_x(seqev.m_current_x);

        seqev.draw_selection_on_window();
    }
    if (seqev.m_painting)
    {
        seqev.m_current_x = int(ev->x)  + seqev.m_scroll_offset_x;
        seqev.snap_x(seqev.m_current_x);
        seqev.convert_x(seqev.m_current_x, tick);
        seqev.drop_event(tick);             // Why no push_undo()?
        result = true;
    }
    return result;
}
Ejemplo n.º 6
0
bool
FruitySeqEventInput::on_button_release_event
(
    GdkEventButton * ev,
    seqevent & seqev
)
{
    bool result = false;
    midipulse tick_s;
    midipulse tick_f;
    seqev.grab_focus();
    seqev.m_current_x = int(ev->x) + seqev.m_scroll_offset_x;;
    if (seqev.m_moving || m_is_drag_pasting)
        seqev.snap_x(seqev.m_current_x);

    int delta_x = seqev.m_current_x - seqev.m_drop_x;
    midipulse delta_tick;
    if (SEQ64_CLICK_LEFT(ev->button))
    {
        int current_x = seqev.m_current_x;
        midipulse t_s, t_f;
        seqev.snap_x(current_x);
        seqev.convert_x(current_x, t_s);
        t_f = t_s + (seqev.m_zoom);                 /* shift back a few ticks */
        if (t_s < 0)
            t_s = 0;

        /*
         * Use the ctrl-left click button up for select/drag copy/paste;
         * use the left click button up for ending a move of selected notes.
         */

        if (m_is_drag_pasting)
        {
            m_is_drag_pasting = false;
            m_is_drag_pasting_start = false;
            seqev.m_paste = false; /* convert deltas into screen coordinates */
            seqev.m_seq.paste_selected(t_s, 0);
            result = true;
        }

        /* ctrl-left click but without movement - select a note */

        if (m_is_drag_pasting_start)
        {
            m_is_drag_pasting_start = false;

            /*
             * If a ctrl-left click without movement and if the note under
             * cursor is selected, and ctrl is held and button-down,
             * just select one.
             */

            if                                  /* deselect the event? */
            (
                is_ctrl_key(ev) &&
                ! m_justselected_one &&
                seqev.m_seq.select_events
                (
                    t_s, t_f, seqev.m_status, seqev.m_cc, sequence::e_is_selected
                ) 
            )
            {
                (void) seqev.m_seq.select_events
                (
                    t_s, t_f, seqev.m_status, seqev.m_cc, sequence::e_deselect
                );
            }
        }
        m_justselected_one = false;         /* clear flag on left button up */
        if (seqev.m_moving)
        {
            delta_x -= seqev.m_move_snap_offset_x; /* adjust for snap         */
            seqev.convert_x(delta_x, delta_tick);  /* deltas to screen coords */
            seqev.m_seq.move_selected_notes(delta_tick, 0);
            result = true;
        }
    }

    /*
     * Yet another stazed fix.  :-)
     */

    bool right = SEQ64_CLICK_RIGHT(ev->button);
    if (! right)
        right = is_ctrl_key(ev) && SEQ64_CLICK_LEFT(ev->button);

    if (right)
    {
        if (seqev.m_selecting)
        {
            int x, w;
            seqev.x_to_w(seqev.m_drop_x, seqev.m_current_x, x, w);
            seqev.convert_x(x, tick_s);
            seqev.convert_x(x + w, tick_f);
            (void) seqev.m_seq.select_events
            (
                tick_s, tick_f,
                seqev.m_status, seqev.m_cc, sequence::e_toggle_selection
            );

#ifdef USE_STAZED_SELECTION_EXTENSIONS

            /*
             * Stazed fix
             */

            if (event::is_strict_note_msg(seqev.m_status))
                seqev.m_seq.select_linked(tick_s, tick_f, seqev.m_status);
#endif

            /*
             * To update the select or unselect of notes by this action.
             * Not sure this makes sense, though.  How does selection dirty
             * anything?
             */

            seqev.m_seq.set_dirty();
        }
    }
    seqev.m_selecting = false;          /* turn it all off */
    seqev.m_moving = false;
    seqev.m_growing = false;
    seqev.m_moving_init = false;
    seqev.m_painting = false;
    seqev.m_seq.unpaint_all();
    seqev.update_pixmap();              /* if they clicked, something changed */
    seqev.draw_pixmap_on_window();
    update_mouse_pointer(seqev);
    return result;                      // true;
}
Ejemplo n.º 7
0
bool
FruitySeqEventInput::on_button_press_event
(
    GdkEventButton * ev,
    seqevent & seqev
)
{
    bool result = false;
    midipulse tick_s, tick_w;
    seqev.grab_focus();                 // NEW: I think this would be helpful
    seqev.convert_x(c_eventevent_x, tick_w);
    seqev.m_drop_x = seqev.m_current_x = int(ev->x) + seqev.m_scroll_offset_x;
    seqev.m_old.x = seqev.m_old.y = seqev.m_old.width = seqev.m_old.height = 0;
    if (seqev.m_paste)
    {
        seqev.snap_x(seqev.m_current_x);
        seqev.convert_x(seqev.m_current_x, tick_s);
        seqev.m_paste = false;
        seqev.m_seq.paste_selected(tick_s, 0);          /* does undo/mod    */
        seqev.m_seq.set_dirty();                        /* a stazed fix     */
        result = true;
    }
    else
    {
        int x, w;
        midipulse tick_f;
        if (SEQ64_CLICK_LEFT(ev->button))               /* Note 1   */
        {
            seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y into tick/note    */
            tick_f = tick_s + seqev.m_zoom;          /* shift back some ticks */
            tick_s -= tick_w;
            if (tick_s < 0)
                tick_s = 0;

            int eventcount = seqev.m_seq.select_events
            (
                tick_s, tick_f, seqev.m_status, seqev.m_cc,
                sequence::e_would_select
            );
            if (! is_ctrl_key(ev) && eventcount == 0)
            {
                seqev.m_painting = true;
                seqev.snap_x(seqev.m_drop_x);
                seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y-->tick/note  */
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status, seqev.m_cc,
                    sequence::e_would_select
                );
                if (eventcount == 0)
                {
                    seqev.m_seq.push_undo();            /* add to add_event? */
                    seqev.drop_event(tick_s);           /* m_seq.add_event() */
                    result = true;
                }
            }
            else                                        /* selecting         */
            {
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status, seqev.m_cc,
                    sequence::e_is_selected
                );
                if (eventcount == 0)
                {
                    eventcount = seqev.m_seq.select_events
                    (
                        tick_s, tick_f, seqev.m_status, seqev.m_cc,
                        sequence::e_would_select
                    );
                    if (eventcount > 0)                 /* if clicking event */
                    {
                        if (! is_ctrl_key(ev))
                            seqev.m_seq.unselect();
                    }
                    else    /* clickempty space, unselect all if no Ctrl-Sh  */
                    {
                        if (! is_ctrl_shift_key(ev))
                            seqev.m_seq.unselect();
                    }

                    /* on direct click select only one event */

                    eventcount = seqev.m_seq.select_events
                    (
                        tick_s, tick_f, seqev.m_status,
                        seqev.m_cc, sequence::e_select_one
                    );

                    /*
                     * Stazed fix:
                     */

#ifdef USE_STAZED_SELECTION_EXTENSIONS
                    if (event::is_strict_note_msg(seqev.m_status))
                    {
                        seqev.m_seq.select_linked(tick_s, tick_f, seqev.m_status);
                        seqev.m_seq.set_dirty();
                    }
#endif

                    if (eventcount)
                        m_justselected_one = true;  /* stop deselect on release */

                    /* if nothing selected, start the selection box */

                    if (is_ctrl_key(ev) && eventcount == 0)
                        seqev.m_selecting = true;
                }
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status, seqev.m_cc,
                    sequence::e_is_selected
                );
                if (eventcount > 0)         /* if event under cursor selected */
                {
                    if (! is_ctrl_key(ev))          /* grab/move note       */
                    {
                        seqev.m_moving_init = true;
                        int note;
                        seqev.m_seq.get_selected_box(tick_s, note, tick_f, note);
                        tick_f += tick_w;
                        seqev.convert_t(tick_s, x); /* convert to X,Y values */
                        seqev.convert_t(tick_f, w);
                        w -= x;                     /* w is coordinates now  */

                        /* set the m_selected rectangle for x,y,w,h */

                        seqev.m_selected.x = x;
                        seqev.m_selected.width = w;
                        seqev.m_selected.y = (c_eventarea_y-c_eventevent_y) / 2;
                        seqev.m_selected.height = c_eventevent_y;

                        /* save offset that we get from the snap above */

                        int adjusted_selected_x = seqev.m_selected.x;
                        seqev.snap_x(adjusted_selected_x);
                        seqev.m_move_snap_offset_x =
                            seqev.m_selected.x - adjusted_selected_x;

                        /* align selection for drawing */

                        seqev.snap_x(seqev.m_selected.x);
                        seqev.snap_x(seqev.m_current_x);
                        seqev.snap_x(seqev.m_drop_x);
                    }
                    else if   /* Ctrl-Left-click when stuff already selected */
                    (
                        is_ctrl_key(ev) &&
                        seqev.m_seq.select_events(tick_s, tick_f,
                           seqev. m_status, seqev.m_cc, sequence::e_is_selected)
                    )
                    {
                        m_is_drag_pasting_start = true;
                    }
                }
            }

        }
        if (SEQ64_CLICK_RIGHT(ev->button))
        {
            seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y in to tick/note   */
            tick_f = tick_s + seqev.m_zoom;          /* shift back some ticks */
            tick_s -= (tick_w);
            if (tick_s < 0)
                tick_s = 0;

            /*
             * Stazed fix: don't allow individual deletion of Note On/Off
             * events.  Should we do the same for AfterTouch events?  No, they
             * are not linked to Note On or Note Off events.
             */

            if (event::is_strict_note_msg(seqev.m_status))
                return true;

            int eventcount = seqev.m_seq.select_events
            (
                tick_s, tick_f, seqev.m_status, seqev.m_cc,
                sequence::e_would_select
            );
            if (eventcount > 0)   /* erase event under cursor if there is one */
            {
                /* remove only note under cursor, leave selection intact */

                (void) seqev.m_seq.select_events
                (
                    tick_s, tick_f,
                    seqev.m_status, seqev.m_cc, sequence::e_remove_one
                );
                seqev.redraw();
                seqev.m_seq.set_dirty();                /* take note!       */
                result = true;
            }
            else                                        /* selecting        */
            {
                if (! is_ctrl_key(ev))
                    seqev.m_seq.unselect();             /* nothing selected   */

                seqev.m_selecting = true;               /* start select-box   */
            }
        }
    }
    seqev.update_pixmap();              /* if they clicked, something changed */
    seqev.draw_pixmap_on_window();
    update_mouse_pointer(seqev);
    return result;                      // true;
}
Ejemplo n.º 8
0
bool
Seq24SeqEventInput::on_button_press_event
(
    GdkEventButton * ev,
    seqevent & seqev
)
{
    bool result = false;
    midipulse tick_s, tick_w;
    seqev.grab_focus();                 // NEW: I think this would be helpful
    seqev.convert_x(c_eventevent_x, tick_w);
    seqev.set_current_drop_x(int(ev->x + seqev.m_scroll_offset_x));
    seqev.m_old.x = seqev.m_old.y = seqev.m_old.width = seqev.m_old.height = 0;
    if (seqev.m_paste)
    {
        seqev.snap_x(seqev.m_current_x);
        seqev.convert_x(seqev.m_current_x, tick_s);
        seqev.m_paste = false;
        seqev.m_seq.paste_selected(tick_s, 0);      /* handles undo & modify    */
        result = true;
    }
    else
    {
        int x, w;
        midipulse tick_f;
        if (SEQ64_CLICK_LEFT(ev->button))
        {
            seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y in to tick/note     */
            tick_f = tick_s + seqev.m_zoom;          /* shift back a few ticks  */
            tick_s -= tick_w;
            if (tick_s < 0)
                tick_s = 0;

            int eventcount = 0;
            if (m_adding)
            {
                seqev.m_painting = true;
                seqev.snap_x(seqev.m_drop_x);
                seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y to tick/note    */
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status, seqev.m_cc,
                    sequence::e_would_select
                );
                if (eventcount == 0)
                {
                    seqev.m_seq.push_undo();
                    seqev.drop_event(tick_s);           // CHECK!
                    result = true;
                }
            }
            else                                        /* selecting */
            {
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status,
                    seqev.m_cc, sequence::e_is_selected
                );

#ifdef USE_STAZED_SELECTION_EXTENSIONS

                /*
                 * Stazed fix: if we didn't select anything (user clicked empty
                 * space), then unselect all notes, and start selecting.
                 */
                
                if (event::is_strict_note_msg(seqev.m_status))
                {
                    seqev.m_seq.select_linked(tick_s, tick_f, seqev.m_status);
                    seqev.m_seq.set_dirty();
                }
#endif

                if (eventcount == 0)
                {
                    if (! is_ctrl_key(ev))
                        seqev.m_seq.unselect();

                    eventcount = seqev.m_seq.select_events
                    (
                        tick_s, tick_f, seqev.m_status,
                        seqev.m_cc, sequence::e_select_one
                    );

                    /*
                     * If nothing selected (user clicked empty space),
                     * unselect all notes, and start selecting with a new
                     * selection box.
                     */

                    if (eventcount == 0)
                    {
                        seqev.m_selecting = true;
                    }
                    else
                    {
                        /**
                         * Needs update.
                         * seqev.m_seq.unselect();  ???????
                         */
                    }
                }
                eventcount = seqev.m_seq.select_events
                (
                    tick_s, tick_f, seqev.m_status,
                    seqev.m_cc, sequence::e_is_selected
                );
                if (eventcount > 0)             /* get box selections are in */
                {
                    seqev.m_moving_init = true;
                    int note;
                    seqev.m_seq.get_selected_box(tick_s, note, tick_f, note);
                    tick_f += tick_w;
                    seqev.convert_t(tick_s, x); /* convert box to X,Y values */
                    seqev.convert_t(tick_f, w);
                    w -= x;                     /* w is coordinate now       */

                    /* set the m_selected rectangle for x,y,w,h */

                    seqev.m_selected.x = x;
                    seqev.m_selected.width = w;
                    seqev.m_selected.y = (c_eventarea_y - c_eventevent_y) / 2;
                    seqev.m_selected.height = c_eventevent_y;

                    /* save offset that we get from the snap above */

                    int adjusted_selected_x = seqev.m_selected.x;
                    seqev.snap_x(adjusted_selected_x);
                    seqev.m_move_snap_offset_x =
                        seqev.m_selected.x - adjusted_selected_x;

                    /* align selection for drawing */

                    seqev.snap_x(seqev.m_selected.x);
                    seqev.snap_x(seqev.m_current_x);
                    seqev.snap_x(seqev.m_drop_x);
                }
            }
        }
        if (SEQ64_CLICK_RIGHT(ev->button))
            set_adding(true, seqev);
    }
    seqev.update_pixmap();              /* if they clicked, something changed */
    seqev.draw_pixmap_on_window();
    return result;                      // true;
}
Ejemplo n.º 9
0
bool
Seq24SeqEventInput::on_button_release_event
(
    GdkEventButton * ev,
    seqevent & seqev
)
{
    bool result = false;
    midipulse tick_s;
    midipulse tick_f;
    seqev.grab_focus();
    seqev.m_current_x = int(ev->x) + seqev.m_scroll_offset_x;
    if (seqev.m_moving)
        seqev.snap_x(seqev.m_current_x);

    int delta_x = seqev.m_current_x - seqev.m_drop_x;
    midipulse delta_tick;
    if (SEQ64_CLICK_LEFT(ev->button))
    {
        if (seqev.m_selecting)
        {
            int x, w;
            seqev.x_to_w(seqev.m_drop_x, seqev.m_current_x, x, w);
            seqev.convert_x(x, tick_s);
            seqev.convert_x(x + w, tick_f);
            (void) seqev.m_seq.select_events
            (
                tick_s, tick_f, seqev.m_status, seqev.m_cc, sequence::e_select
            );

#ifdef USE_STAZED_SELECTION_EXTENSIONS

            /*
             * Stazed fix: if we did'nt select anything (user clicked empty
             * space), then unselect all notes, and start selecting.
             */
            
            if (event::is_strict_note_msg(seqev.m_status))
            {
                seqev.m_seq.select_linked(tick_s, tick_f, seqev.m_status);
            }
            seqev.m_seq.set_dirty();    // ??????????? Why not in brackets?
#endif

        }
        if (seqev.m_moving)
        {
            delta_x -= seqev.m_move_snap_offset_x;  /* adjust for snap       */
            seqev.convert_x(delta_x, delta_tick);   /* to screen coordinates */
            seqev.m_seq.move_selected_notes(delta_tick, 0);
            result = true;
        }
        set_adding(m_adding, seqev);
    }
    if (SEQ64_CLICK_RIGHT(ev->button))
    {
        set_adding(false, seqev);
    }
    seqev.m_selecting = false;                      /* turn off              */
    seqev.m_moving = false;
    seqev.m_growing = false;
    seqev.m_moving_init = false;
    seqev.m_painting = false;
    seqev.m_seq.unpaint_all();
    seqev.update_pixmap();                  /* if a click, something changed */
    seqev.draw_pixmap_on_window();
    return result;                          // true;
}
Ejemplo n.º 10
0
bool
Seq24SeqEventInput::on_button_press_event
(
    GdkEventButton * a_ev,
    seqevent & seqev
)
{
    long tick_s, tick_w;
    seqev.convert_x(c_eventevent_x, tick_w);
    seqev.m_drop_x = seqev.m_current_x = int(a_ev->x + seqev.m_scroll_offset_x);
    seqev.m_old.x = seqev.m_old.y = seqev.m_old.width = seqev.m_old.height = 0;
    if (seqev.m_paste)
    {
        seqev.snap_x(seqev.m_current_x);
        seqev.convert_x(seqev.m_current_x, tick_s);
        seqev.m_paste = false;
        seqev.m_seq.push_undo();
        seqev.m_seq.paste_selected(tick_s, 0);
    }
    else
    {
        int x, w;
        long tick_f;
        if (CLICK_IS_LEFT(a_ev->button))
        {
            seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y in to tick/note    */
            tick_f = tick_s + seqev.m_zoom;          /* shift back a few ticks */
            tick_s -= tick_w;
            if (tick_s < 0)
                tick_s = 0;

            int eventcount = 0;
            if (m_adding)
            {
                seqev.m_painting = true;
                seqev.snap_x(seqev.m_drop_x);
                seqev.convert_x(seqev.m_drop_x, tick_s); /* x,y to tick/note */
                eventcount = seqev.m_seq.select_events
                             (
                                 tick_s, tick_f, seqev.m_status, seqev.m_cc,
                                 sequence::e_would_select
                             );
                if (eventcount == 0)
                {
                    seqev.m_seq.push_undo();
                    seqev.drop_event(tick_s);
                }
            }
            else                                        /* selecting */
            {
                eventcount = seqev.m_seq.select_events
                             (
                                 tick_s, tick_f, seqev.m_status,
                                 seqev.m_cc, sequence::e_is_selected
                             );
                if (eventcount == 0)
                {
                    if (! (a_ev->state & GDK_CONTROL_MASK))
                        seqev.m_seq.unselect();

                    eventcount = seqev.m_seq.select_events
                                 (
                                     tick_s, tick_f, seqev.m_status,
                                     seqev.m_cc, sequence::e_select_one
                                 );

                    /*
                     * If nothing selected (user clicked empty space),
                     * unselect all notes, and start selecting with a new
                     * selection box.
                     */

                    if (eventcount == 0)
                    {
                        seqev.m_selecting = true;
                    }
                    else
                    {
                        /**
                         *  Needs update.
                         *
                         * seqev.m_seq.unselect();  ???????
                         */
                    }
                }
                eventcount = seqev.m_seq.select_events
                             (
                                 tick_s, tick_f, seqev.m_status,
                                 seqev.m_cc, sequence::e_is_selected
                             );
                if (eventcount > 0)
                {
                    seqev.m_moving_init = true;
                    int note;
                    seqev.m_seq.get_selected_box(tick_s, note, tick_f, note);
                    tick_f += tick_w;
                    seqev.convert_t(tick_s, x); /* convert box to X,Y values */
                    seqev.convert_t(tick_f, w);
                    w -= x;                     /* w is coordinate now       */

                    /* set the m_selected rectangle for x,y,w,h */

                    seqev.m_selected.x = x;
                    seqev.m_selected.width = w;
                    seqev.m_selected.y = (c_eventarea_y - c_eventevent_y) / 2;
                    seqev.m_selected.height = c_eventevent_y;

                    /* save offset that we get from the snap above */

                    int adjusted_selected_x = seqev.m_selected.x;
                    seqev.snap_x(adjusted_selected_x);
                    seqev.m_move_snap_offset_x =
                        seqev.m_selected.x - adjusted_selected_x;

                    /* align selection for drawing */

                    seqev.snap_x(seqev.m_selected.x);
                    seqev.snap_x(seqev.m_current_x);
                    seqev.snap_x(seqev.m_drop_x);
                }
            }
        }
        if (CLICK_IS_RIGHT(a_ev->button))
            set_adding(true, seqev);
    }
    seqev.update_pixmap();          /* if they clicked, something changed */
    seqev.draw_pixmap_on_window();
    return true;
}