Ejemplo n.º 1
0
void
perfnames::change_vert ()
{
    if (m_sequence_offset != int(m_vadjust.get_value()))
    {
        m_sequence_offset = int(m_vadjust.get_value());
        enqueue_draw();
    }
}
Ejemplo n.º 2
0
bool
perfnames::on_button_press_event (GdkEventButton * ev)
{
    int y = int(ev->y);
    int seqnum = convert_y(y);
    current_seq(seqnum);
    if (SEQ64_CLICK_LEFT(ev->button))
    {
        if (perf().is_active(seqnum))
        {
            guint modifiers;        /* for filtering out caps/num lock etc. */
            modifiers = gtk_accelerator_get_default_mod_mask();
            if ((ev->state & modifiers) == SEQ64_SHIFT_MASK)
            {
                /*
                 * \new ca 2016-03-15
                 *      If the Shift key is pressed, mute all other sequences.
                 *      Inactive sequences are skipped.
                 */

                for (int s = 0; s < m_sequence_max; ++s)
                {
                    if (s != seqnum)
                    {
                        sequence * seq = perf().get_sequence(s);
                        if (not_nullptr(seq))
                        {
                            bool muted = seq->get_song_mute();
                            seq->set_song_mute(! muted);
                        }
                    }
                }
            }
            else
            {
                sequence * seq = perf().get_sequence(seqnum);
                bool muted = seq->get_song_mute();
                seq->set_song_mute(! muted);
            }
            enqueue_draw();
        }
    }
    return true;
}
Ejemplo n.º 3
0
void
perfedit::expand ()
{
    perf().expand();
    enqueue_draw();
}
Ejemplo n.º 4
0
void
perfedit::copy ()
{
    perf().copy();
    enqueue_draw();
}
Ejemplo n.º 5
0
void
perfedit::collapse ()
{
    perf().collapse();
    enqueue_draw();
}
Ejemplo n.º 6
0
void
perfedit::redo ()
{
    perf().pop_trigger_redo();
    enqueue_draw();
}
Ejemplo n.º 7
0
bool
perftime::key_press_event (GdkEventKey * ev)
{
    bool result = false;
    {
        if (ev->keyval == SEQ64_l)
        {
            if (m_left_marker_tick == (-1))
            {
                m_right_marker_tick = (-1);
                m_left_marker_tick = perf().get_left_tick();
            }
        }
        else if (ev->keyval == SEQ64_r)
        {
            if (m_right_marker_tick == (-1))
            {
                m_left_marker_tick = (-1);
                m_right_marker_tick = perf().get_right_tick();
            }
        }
        else if (ev->keyval == SEQ64_x)             /* "x-scape" the modes  */
        {
            m_left_marker_tick = m_right_marker_tick = (-1);
        }
        else if (ev->keyval == SEQ64_Left)
        {
            if (m_left_marker_tick != (-1))
            {
                m_left_marker_tick -= m_snap;
                perf().set_left_tick(m_left_marker_tick);
                result = true;
            }
            else if (m_right_marker_tick != (-1))
            {
                m_right_marker_tick -= m_snap;
                perf().set_right_tick(m_right_marker_tick);
                result = true;
            }
        }
        else if (ev->keyval == SEQ64_Right)
        {
            if (m_left_marker_tick != (-1))
            {
                m_left_marker_tick += m_snap;
                perf().set_left_tick(m_left_marker_tick);
                result = true;
            }
            else if (m_right_marker_tick != (-1))
            {
                m_right_marker_tick += m_snap;
                perf().set_right_tick(m_right_marker_tick);
                result = true;
            }
        }
    }
    if (result)
        perf().modify();                                    /* flag it */

    enqueue_draw();
    return result;
}
Ejemplo n.º 8
0
void
perftime::draw_background ()
{
    draw_rectangle(white_paint(), 0, 0, m_window_x, m_window_y);
    draw_line(black_paint(), 0, m_window_y - 1, m_window_x, m_window_y - 1);
    midipulse first_measure = m_tick_offset / m_measure_length;
    midipulse last_measure = first_measure +
        (m_window_x * m_perf_scale_x / m_measure_length) + 1;

#ifdef USE_STAZED_EXTRAS

    float bar_draw = m_measure_length / float(m_perf_scale_x);
    int bar_skip = 1;
    if (bar_draw < 24)
        bar_skip = 4;

    if (bar_draw < 12)
        bar_skip = 8;

    if (bar_draw < 6)
        bar_skip = 16;

    if (bar_draw < 3)
        bar_skip = 32;

    if (bar_draw < .75)
        bar_skip = 64;
#endif

    m_gc->set_foreground(grey());                   /* draw vertical lines  */

#ifdef USE_STAZED_EXTRAS
    for (midipulse i = first_measure; i < last_measure; i += bar_skip)
    {
        int x_pos = ((i * m_measure_length) - m_tick_offset) / m_perf_scale_x;
#else
    for (midipulse i = first_measure; i < last_measure; ++i)
    {
        int x_pos = tick_to_pixel(i * m_measure_length);
#endif

        char bar[8];
        snprintf(bar, sizeof(bar), "%ld", i + 1);       /* bar numbers      */
        draw_line(x_pos, 0, x_pos, m_window_y);         /* beat             */
        render_string(x_pos + 2, 0, bar, font::BLACK, true);
    }

    midipulse left = tick_to_pixel(perf().get_left_tick());
    midipulse right = tick_to_pixel(perf().get_right_tick());
    if (left >= 0 && left <= m_window_x)                /* draw L marker    */
    {
        draw_rectangle(black_paint(), left, m_window_y - 9, 7, 10);
        render_string(left + 1, 9, "L", font::WHITE, true);
    }
    if (right >= 0 && right <= m_window_x)              /* draw R marker    */
    {
        draw_rectangle(black_paint(), right - 6, m_window_y - 9, 7, 10);
        render_string(right - 6 + 1, 9, "R", font::WHITE, true);
    }
}

/**
 *  Implement the button-press event to set the L and R ticks.  Added
 *  functionality to try to set the start-tick if ctrl-left-click is pressed.
 *
 * \param p0
 *      The button event.
 *
 * \return
 *      Always returns true.
 */

bool
perftime::on_button_press_event (GdkEventButton * p0)
{
    midipulse tick = pixel_to_tick(long(p0->x));
    tick -= tick % m_snap;

    /**
     * Why is setting the start-tick disabled?  We re-enable it and see if it
     * works.  To our surprise, it works, but it sticks between stop/pause and
     * the next playback in the performance editor.  We added a feature where
     * stop sets the start-tick to the left tick (or the beginning tick).
     */

    if (SEQ64_CLICK_MIDDLE(p0->button))
    {
        perf().set_start_tick(tick);
    }
    else if (SEQ64_CLICK_LEFT(p0->button))
    {
        if (is_ctrl_key(p0))
            perf().set_start_tick(tick);
        else
            perf().set_left_tick(tick);
    }
    else if (SEQ64_CLICK_RIGHT(p0->button))
    {
        perf().set_right_tick(tick + m_snap);
    }
    enqueue_draw();
    return true;
}