diff options
author | David Robillard <d@drobilla.net> | 2010-08-04 21:50:57 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-08-04 21:50:57 +0000 |
commit | 1018368aef84931249c73f41caf66735172f2105 (patch) | |
tree | 82b8f1526c9c6f67312daa55fa7a676e16120994 /gtk2_ardour | |
parent | 38f2336b450982ccfc03017238c431b5edb3b20c (diff) |
Fix spacey tabs...
http://ardour.org/development/styleguide
git-svn-id: svn://localhost/ardour2/branches/3.0@7542 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/gtk_pianokeyboard.c | 130 | ||||
-rwxr-xr-x | gtk2_ardour/midi_automation_line.cc | 18 | ||||
-rw-r--r-- | gtk2_ardour/step_entry.cc | 417 |
3 files changed, 283 insertions, 282 deletions
diff --git a/gtk2_ardour/gtk_pianokeyboard.c b/gtk2_ardour/gtk_pianokeyboard.c index bc51edb371..ffeb87be82 100644 --- a/gtk2_ardour/gtk_pianokeyboard.c +++ b/gtk2_ardour/gtk_pianokeyboard.c @@ -47,7 +47,7 @@ enum { NOTE_ON_SIGNAL, NOTE_OFF_SIGNAL, - REST_SIGNAL, + REST_SIGNAL, LAST_SIGNAL }; @@ -64,32 +64,32 @@ draw_keyboard_cue(PianoKeyboard *pk, cairo_t* cr) int first_note_in_higher_row = (pk->octave + 6) * 12; int last_note_in_higher_row = (pk->octave + 7) * 12 + 4; - cairo_set_source_rgb (cr, 1.0f, 0.0f, 0.0f); - cairo_move_to (cr, pk->notes[first_note_in_lower_row].x + 3, h - 6); - cairo_line_to (cr, pk->notes[last_note_in_lower_row].x + w - 3, h - 6); - cairo_stroke (cr); + cairo_set_source_rgb (cr, 1.0f, 0.0f, 0.0f); + cairo_move_to (cr, pk->notes[first_note_in_lower_row].x + 3, h - 6); + cairo_line_to (cr, pk->notes[last_note_in_lower_row].x + w - 3, h - 6); + cairo_stroke (cr); - cairo_set_source_rgb (cr, 0.0f, 0.0f, 1.0f); - cairo_move_to (cr, pk->notes[first_note_in_higher_row].x + 3, h - 9); - cairo_line_to (cr, pk->notes[last_note_in_higher_row].x + w - 3, h - 9); - cairo_stroke (cr); + cairo_set_source_rgb (cr, 0.0f, 0.0f, 1.0f); + cairo_move_to (cr, pk->notes[first_note_in_higher_row].x + 3, h - 9); + cairo_line_to (cr, pk->notes[last_note_in_higher_row].x + w - 3, h - 9); + cairo_stroke (cr); } static void queue_note_draw (PianoKeyboard* pk, int note) { - GdkWindow* w = GTK_WIDGET(pk)->window; + GdkWindow* w = GTK_WIDGET(pk)->window; - if (w) { - GdkRectangle r; + if (w) { + GdkRectangle r; - r.x = pk->notes[note].x; - r.y = 0; - r.width = pk->notes[note].w; - r.height = pk->notes[note].h; + r.x = pk->notes[note].x; + r.y = 0; + r.width = pk->notes[note].w; + r.height = pk->notes[note].h; - gdk_window_invalidate_rect (w, &r, TRUE); - } + gdk_window_invalidate_rect (w, &r, TRUE); + } } static void @@ -103,35 +103,35 @@ draw_note(PianoKeyboard *pk, cairo_t* cr, int note) if (pk->notes[note].pressed || pk->notes[note].sustained) { is_white = !is_white; - } + } - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 1.0); if (is_white) { - cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f); - } else { - cairo_set_source_rgb (cr, 0.0f, 0.0f, 0.0f); - } + cairo_set_source_rgb (cr, 1.0f, 1.0f, 1.0f); + } else { + cairo_set_source_rgb (cr, 0.0f, 0.0f, 0.0f); + } - cairo_rectangle (cr, x, 0, w, h); - cairo_fill (cr); + cairo_rectangle (cr, x, 0, w, h); + cairo_fill (cr); - cairo_set_source_rgb(cr, 0.0f, 0.0f, 0.0f); /* black outline */ - cairo_rectangle (cr, x, 0, w, h); - cairo_stroke (cr); + cairo_set_source_rgb(cr, 0.0f, 0.0f, 0.0f); /* black outline */ + cairo_rectangle (cr, x, 0, w, h); + cairo_stroke (cr); if (pk->enable_keyboard_cue) { draw_keyboard_cue (pk, cr); - } + } /* We need to redraw black keys that partially obscure the white one. */ if (note < NNOTES - 2 && !pk->notes[note + 1].white) { draw_note(pk, cr, note + 1); - } + } if (note > 0 && !pk->notes[note - 1].white) { draw_note(pk, cr, note - 1); - } + } } static int @@ -256,7 +256,7 @@ bind_keys_qwerty(PianoKeyboard *pk) { clear_notes(pk); - bind_key(pk, "space", 128); + bind_key(pk, "space", 128); /* Lower keyboard row - "zxcvbnm". */ bind_key(pk, "z", 12); /* C0 */ @@ -309,7 +309,7 @@ bind_keys_azerty(PianoKeyboard *pk) { clear_notes(pk); - bind_key(pk, "space", 128); + bind_key(pk, "space", 128); /* Lower keyboard row - "wxcvbn,". */ bind_key(pk, "w", 12); /* C0 */ @@ -378,13 +378,13 @@ keyboard_event_handler(GtkWidget *mk, GdkEventKey *event, gpointer notused) return FALSE; } - if (note == 128) { - if (event->type == GDK_KEY_RELEASE) { - rest (pk); - } + if (note == 128) { + if (event->type == GDK_KEY_RELEASE) { + rest (pk); + } - return TRUE; - } + return TRUE; + } note += pk->octave * 12; @@ -494,30 +494,30 @@ piano_keyboard_expose(GtkWidget *widget, GdkEventExpose *event) { int i; PianoKeyboard *pk = PIANO_KEYBOARD(widget); - cairo_t* cr = gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET(pk)->window)); - - gdk_cairo_region (cr, event->region); - cairo_clip (cr); + cairo_t* cr = gdk_cairo_create (GDK_DRAWABLE (GTK_WIDGET(pk)->window)); + + gdk_cairo_region (cr, event->region); + cairo_clip (cr); for (i = 0; i < NNOTES; i++) { - GdkRectangle r; - - r.x = pk->notes[i].x; - r.y = 0; - r.width = pk->notes[i].w; - r.height = pk->notes[i].h; - - switch (gdk_region_rect_in (event->region, &r)) { - case GDK_OVERLAP_RECTANGLE_PART: - case GDK_OVERLAP_RECTANGLE_IN: - draw_note (pk, cr, i); - break; - default: - break; - } - } + GdkRectangle r; + + r.x = pk->notes[i].x; + r.y = 0; + r.width = pk->notes[i].w; + r.height = pk->notes[i].h; + + switch (gdk_region_rect_in (event->region, &r)) { + case GDK_OVERLAP_RECTANGLE_PART: + case GDK_OVERLAP_RECTANGLE_IN: + draw_note (pk, cr, i); + break; + default: + break; + } + } - cairo_destroy (cr); + cairo_destroy (cr); return TRUE; } @@ -624,8 +624,8 @@ piano_keyboard_init(GtkWidget *mk) g_signal_connect(G_OBJECT(mk), "button-press-event", G_CALLBACK(mouse_button_event_handler), NULL); g_signal_connect(G_OBJECT(mk), "button-release-event", G_CALLBACK(mouse_button_event_handler), NULL); g_signal_connect(G_OBJECT(mk), "motion-notify-event", G_CALLBACK(mouse_motion_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "key-press-event", G_CALLBACK(keyboard_event_handler), NULL); - g_signal_connect(G_OBJECT(mk), "key-release-event", G_CALLBACK(keyboard_event_handler), NULL); + g_signal_connect(G_OBJECT(mk), "key-press-event", G_CALLBACK(keyboard_event_handler), NULL); + g_signal_connect(G_OBJECT(mk), "key-release-event", G_CALLBACK(keyboard_event_handler), NULL); } GType @@ -701,7 +701,7 @@ piano_keyboard_set_note_on(PianoKeyboard *pk, int note) { if (pk->notes[note].pressed == 0) { pk->notes[note].pressed = 1; - queue_note_draw (pk, note); + queue_note_draw (pk, note); } } @@ -711,7 +711,7 @@ piano_keyboard_set_note_off(PianoKeyboard *pk, int note) if (pk->notes[note].pressed || pk->notes[note].sustained) { pk->notes[note].pressed = 0; pk->notes[note].sustained = 0; - queue_note_draw (pk, note); + queue_note_draw (pk, note); } } diff --git a/gtk2_ardour/midi_automation_line.cc b/gtk2_ardour/midi_automation_line.cc index c6bb8335aa..b0d28ec8db 100755 --- a/gtk2_ardour/midi_automation_line.cc +++ b/gtk2_ardour/midi_automation_line.cc @@ -23,14 +23,16 @@ using namespace std; MidiAutomationLine::MidiAutomationLine ( - const std::string& name, TimeAxisView& tav, ArdourCanvas::Group& group, - boost::shared_ptr<ARDOUR::AutomationList> list, - boost::shared_ptr<ARDOUR::MidiRegion> region, - Evoral::Parameter parameter, - const Evoral::TimeConverter<double, ARDOUR::sframes_t>* converter - ) : AutomationLine (name, tav, group, list, converter) - , _region (region) - , _parameter (parameter) + const std::string& name, + TimeAxisView& tav, + ArdourCanvas::Group& group, + boost::shared_ptr<ARDOUR::AutomationList> list, + boost::shared_ptr<ARDOUR::MidiRegion> region, + Evoral::Parameter parameter, + const Evoral::TimeConverter<double, ARDOUR::sframes_t>* converter) + : AutomationLine (name, tav, group, list, converter) + , _region (region) + , _parameter (parameter) { } diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index f8cb79d285..f85849012d 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -34,42 +34,42 @@ using namespace Gtk; static void _note_off_event_handler (GtkWidget* widget, int note, gpointer arg) { - ((StepEntry*)arg)->note_off_event_handler (note); + ((StepEntry*)arg)->note_off_event_handler (note); } static void _rest_event_handler (GtkWidget* widget, gpointer arg) { - ((StepEntry*)arg)->rest_event_handler (); + ((StepEntry*)arg)->rest_event_handler (); } StepEntry::StepEntry (MidiTimeAxisView& mtv) - : ArdourDialog (string_compose (_("Step Entry: %1"), mtv.name())) - , triplet_button ("3") - , beat_resync_button (_(">beat")) - , bar_resync_button (_(">bar")) - , sustain_button (_("sustain")) - , rest_button (_("rest")) - , grid_rest_button (_("g-rest")) - , channel_adjustment (1, 1, 16, 0, 1, 4) - , channel_spinner (channel_adjustment) - , _piano (0) - , piano (0) - , _mtv (&mtv) + : ArdourDialog (string_compose (_("Step Entry: %1"), mtv.name())) + , triplet_button ("3") + , beat_resync_button (_(">beat")) + , bar_resync_button (_(">bar")) + , sustain_button (_("sustain")) + , rest_button (_("rest")) + , grid_rest_button (_("g-rest")) + , channel_adjustment (1, 1, 16, 0, 1, 4) + , channel_spinner (channel_adjustment) + , _piano (0) + , piano (0) + , _mtv (&mtv) { - /* set channel selector to first selected channel. if none - are selected, it will remain at the value set in its - constructor, above (1) - */ + /* set channel selector to first selected channel. if none + are selected, it will remain at the value set in its + constructor, above (1) + */ - uint16_t chn_mask = _mtv->channel_selector().get_selected_channels(); + uint16_t chn_mask = _mtv->channel_selector().get_selected_channels(); - for (uint32_t i = 0; i < 16; ++i) { - if (chn_mask & (1<<i)) { - channel_adjustment.set_value (i+1); - break; - } - } + for (uint32_t i = 0; i < 16; ++i) { + if (chn_mask & (1<<i)) { + channel_adjustment.set_value (i+1); + break; + } + } RadioButtonGroup length_group = length_1_button.get_group(); length_2_button.set_group (length_group); @@ -80,7 +80,7 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv) length_32_button.set_group (length_group); length_64_button.set_group (length_group); - Widget* w; + Widget* w; w = manage (new Image (::get_icon (X_("wholenote")))); w->show(); @@ -104,38 +104,38 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv) w->show(); length_64_button.add (*w); - length_1_button.property_draw_indicator() = false; - length_2_button.property_draw_indicator() = false; - length_4_button.property_draw_indicator() = false; - length_8_button.property_draw_indicator() = false; - length_16_button.property_draw_indicator() = false; - length_32_button.property_draw_indicator() = false; - length_64_button.property_draw_indicator() = false; - - note_length_box.pack_start (length_1_button, false, false); - note_length_box.pack_start (length_2_button, false, false); - note_length_box.pack_start (length_4_button, false, false); - note_length_box.pack_start (length_8_button, false, false); - note_length_box.pack_start (length_16_button, false, false); - note_length_box.pack_start (length_32_button, false, false); - note_length_box.pack_start (length_64_button, false, false); - - ARDOUR_UI::instance()->set_tip (&length_1_button, _("Set note length to a whole note"), ""); - ARDOUR_UI::instance()->set_tip (&length_2_button, _("Set note length to a half note"), ""); - ARDOUR_UI::instance()->set_tip (&length_4_button, _("Set note length to a quarter note"), ""); - ARDOUR_UI::instance()->set_tip (&length_8_button, _("Set note length to a eighth note"), ""); - ARDOUR_UI::instance()->set_tip (&length_16_button, _("Set note length to a sixteenth note"), ""); - ARDOUR_UI::instance()->set_tip (&length_32_button, _("Set note length to a thirty-second note"), ""); - ARDOUR_UI::instance()->set_tip (&length_64_button, _("Set note length to a sixty-fourth note"), ""); + length_1_button.property_draw_indicator() = false; + length_2_button.property_draw_indicator() = false; + length_4_button.property_draw_indicator() = false; + length_8_button.property_draw_indicator() = false; + length_16_button.property_draw_indicator() = false; + length_32_button.property_draw_indicator() = false; + length_64_button.property_draw_indicator() = false; + + note_length_box.pack_start (length_1_button, false, false); + note_length_box.pack_start (length_2_button, false, false); + note_length_box.pack_start (length_4_button, false, false); + note_length_box.pack_start (length_8_button, false, false); + note_length_box.pack_start (length_16_button, false, false); + note_length_box.pack_start (length_32_button, false, false); + note_length_box.pack_start (length_64_button, false, false); + + ARDOUR_UI::instance()->set_tip (&length_1_button, _("Set note length to a whole note"), ""); + ARDOUR_UI::instance()->set_tip (&length_2_button, _("Set note length to a half note"), ""); + ARDOUR_UI::instance()->set_tip (&length_4_button, _("Set note length to a quarter note"), ""); + ARDOUR_UI::instance()->set_tip (&length_8_button, _("Set note length to a eighth note"), ""); + ARDOUR_UI::instance()->set_tip (&length_16_button, _("Set note length to a sixteenth note"), ""); + ARDOUR_UI::instance()->set_tip (&length_32_button, _("Set note length to a thirty-second note"), ""); + ARDOUR_UI::instance()->set_tip (&length_64_button, _("Set note length to a sixty-fourth note"), ""); RadioButtonGroup velocity_group = velocity_ppp_button.get_group(); - velocity_pp_button.set_group (velocity_group); - velocity_p_button.set_group (velocity_group); - velocity_mp_button.set_group (velocity_group); - velocity_mf_button.set_group (velocity_group); - velocity_f_button.set_group (velocity_group); - velocity_ff_button.set_group (velocity_group); - velocity_fff_button.set_group (velocity_group); + velocity_pp_button.set_group (velocity_group); + velocity_p_button.set_group (velocity_group); + velocity_mp_button.set_group (velocity_group); + velocity_mf_button.set_group (velocity_group); + velocity_f_button.set_group (velocity_group); + velocity_ff_button.set_group (velocity_group); + velocity_fff_button.set_group (velocity_group); w = manage (new Image (::get_icon (X_("pianississimo")))); w->show(); @@ -162,94 +162,94 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv) w->show(); velocity_fff_button.add (*w); - velocity_ppp_button.property_draw_indicator() = false; - velocity_pp_button.property_draw_indicator() = false; - velocity_p_button.property_draw_indicator() = false; - velocity_mp_button.property_draw_indicator() = false; - velocity_mf_button.property_draw_indicator() = false; - velocity_f_button.property_draw_indicator() = false; - velocity_ff_button.property_draw_indicator() = false; - velocity_fff_button.property_draw_indicator() = false; - - ARDOUR_UI::instance()->set_tip (&velocity_ppp_button, _("Set volume (velocity) to pianississimo"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_pp_button, _("Set volume (velocity) to pianissimo"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_p_button, _("Set volume (velocity) to piano"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_mp_button, _("Set volume (velocity) to mezzo-piano"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_mf_button, _("Set volume (velocity) to mezzo-forte"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_f_button, _("Set volume (velocity) to forte"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_ff_button, _("Set volume (velocity) to forteissimo"), ""); - ARDOUR_UI::instance()->set_tip (&velocity_fff_button, _("Set volume (velocity) to forteississimo"), ""); - - note_velocity_box.pack_start (velocity_ppp_button, false, false); - note_velocity_box.pack_start (velocity_pp_button, false, false); - note_velocity_box.pack_start (velocity_p_button, false, false); - note_velocity_box.pack_start (velocity_mp_button, false, false); - note_velocity_box.pack_start (velocity_mf_button, false, false); - note_velocity_box.pack_start (velocity_f_button, false, false); - note_velocity_box.pack_start (velocity_ff_button, false, false); - note_velocity_box.pack_start (velocity_fff_button, false, false); - - Label* l = manage (new Label); - l->set_markup ("<b><big>.</big></b>"); - l->show (); - dot_button.add (*l); + velocity_ppp_button.property_draw_indicator() = false; + velocity_pp_button.property_draw_indicator() = false; + velocity_p_button.property_draw_indicator() = false; + velocity_mp_button.property_draw_indicator() = false; + velocity_mf_button.property_draw_indicator() = false; + velocity_f_button.property_draw_indicator() = false; + velocity_ff_button.property_draw_indicator() = false; + velocity_fff_button.property_draw_indicator() = false; + + ARDOUR_UI::instance()->set_tip (&velocity_ppp_button, _("Set volume (velocity) to pianississimo"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_pp_button, _("Set volume (velocity) to pianissimo"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_p_button, _("Set volume (velocity) to piano"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_mp_button, _("Set volume (velocity) to mezzo-piano"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_mf_button, _("Set volume (velocity) to mezzo-forte"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_f_button, _("Set volume (velocity) to forte"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_ff_button, _("Set volume (velocity) to forteissimo"), ""); + ARDOUR_UI::instance()->set_tip (&velocity_fff_button, _("Set volume (velocity) to forteississimo"), ""); + + note_velocity_box.pack_start (velocity_ppp_button, false, false); + note_velocity_box.pack_start (velocity_pp_button, false, false); + note_velocity_box.pack_start (velocity_p_button, false, false); + note_velocity_box.pack_start (velocity_mp_button, false, false); + note_velocity_box.pack_start (velocity_mf_button, false, false); + note_velocity_box.pack_start (velocity_f_button, false, false); + note_velocity_box.pack_start (velocity_ff_button, false, false); + note_velocity_box.pack_start (velocity_fff_button, false, false); + + Label* l = manage (new Label); + l->set_markup ("<b><big>.</big></b>"); + l->show (); + dot_button.add (*l); w = manage (new Image (::get_icon (X_("chord")))); w->show(); chord_button.add (*w); - rest_box.pack_start (rest_button, false, false); - rest_box.pack_start (grid_rest_button, false, false); - - resync_box.pack_start (beat_resync_button, false, false); - resync_box.pack_start (bar_resync_button, false, false); - - ARDOUR_UI::instance()->set_tip (&chord_button, _("Stack inserted notes to form a chord"), ""); - ARDOUR_UI::instance()->set_tip (&sustain_button, _("Extend selected notes by note length"), ""); - ARDOUR_UI::instance()->set_tip (&dot_button, _("Use dotted note lengths"), ""); - ARDOUR_UI::instance()->set_tip (&rest_button, _("Insert a note-length's rest"), ""); - ARDOUR_UI::instance()->set_tip (&grid_rest_button, _("Insert a grid-unit's rest"), ""); - ARDOUR_UI::instance()->set_tip (&beat_resync_button, _("Insert a rest until the next beat"), ""); - ARDOUR_UI::instance()->set_tip (&bar_resync_button, _("Insert a rest until the next bar"), ""); - - VBox* v = manage (new VBox); - l = manage (new Label (_("Channel"))); - v->set_spacing (6); - v->pack_start (*l, false, false); - v->pack_start (channel_spinner, false, false); - - upper_box.set_spacing (6); - upper_box.pack_start (chord_button, false, false); - upper_box.pack_start (note_length_box, false, false, 12); - upper_box.pack_start (triplet_button, false, false); - upper_box.pack_start (dot_button, false, false); - upper_box.pack_start (sustain_button, false, false); - upper_box.pack_start (rest_box, false, false); - upper_box.pack_start (resync_box, false, false); - upper_box.pack_start (note_velocity_box, false, false, 12); - upper_box.pack_start (*v, false, false); - - _piano = (PianoKeyboard*) piano_keyboard_new (); - piano = Glib::wrap ((GtkWidget*) _piano); - - piano->set_flags (Gtk::CAN_FOCUS); - - g_signal_connect(G_OBJECT(_piano), "note-off", G_CALLBACK(_note_off_event_handler), this); - g_signal_connect(G_OBJECT(_piano), "rest", G_CALLBACK(_rest_event_handler), this); + rest_box.pack_start (rest_button, false, false); + rest_box.pack_start (grid_rest_button, false, false); + + resync_box.pack_start (beat_resync_button, false, false); + resync_box.pack_start (bar_resync_button, false, false); + + ARDOUR_UI::instance()->set_tip (&chord_button, _("Stack inserted notes to form a chord"), ""); + ARDOUR_UI::instance()->set_tip (&sustain_button, _("Extend selected notes by note length"), ""); + ARDOUR_UI::instance()->set_tip (&dot_button, _("Use dotted note lengths"), ""); + ARDOUR_UI::instance()->set_tip (&rest_button, _("Insert a note-length's rest"), ""); + ARDOUR_UI::instance()->set_tip (&grid_rest_button, _("Insert a grid-unit's rest"), ""); + ARDOUR_UI::instance()->set_tip (&beat_resync_button, _("Insert a rest until the next beat"), ""); + ARDOUR_UI::instance()->set_tip (&bar_resync_button, _("Insert a rest until the next bar"), ""); + + VBox* v = manage (new VBox); + l = manage (new Label (_("Channel"))); + v->set_spacing (6); + v->pack_start (*l, false, false); + v->pack_start (channel_spinner, false, false); + + upper_box.set_spacing (6); + upper_box.pack_start (chord_button, false, false); + upper_box.pack_start (note_length_box, false, false, 12); + upper_box.pack_start (triplet_button, false, false); + upper_box.pack_start (dot_button, false, false); + upper_box.pack_start (sustain_button, false, false); + upper_box.pack_start (rest_box, false, false); + upper_box.pack_start (resync_box, false, false); + upper_box.pack_start (note_velocity_box, false, false, 12); + upper_box.pack_start (*v, false, false); + + _piano = (PianoKeyboard*) piano_keyboard_new (); + piano = Glib::wrap ((GtkWidget*) _piano); + + piano->set_flags (Gtk::CAN_FOCUS); + + g_signal_connect(G_OBJECT(_piano), "note-off", G_CALLBACK(_note_off_event_handler), this); + g_signal_connect(G_OBJECT(_piano), "rest", G_CALLBACK(_rest_event_handler), this); - rest_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::rest_click)); - grid_rest_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::grid_rest_click)); - chord_button.signal_toggled().connect (sigc::mem_fun (*this, &StepEntry::chord_toggled)); - triplet_button.signal_toggled().connect (sigc::mem_fun (*this, &StepEntry::triplet_toggled)); - beat_resync_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::beat_resync_click)); - bar_resync_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::bar_resync_click)); - - packer.set_spacing (6); - packer.pack_start (upper_box, false, false); - packer.pack_start (*piano, false, false); - packer.show_all (); - - get_vbox()->add (packer); + rest_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::rest_click)); + grid_rest_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::grid_rest_click)); + chord_button.signal_toggled().connect (sigc::mem_fun (*this, &StepEntry::chord_toggled)); + triplet_button.signal_toggled().connect (sigc::mem_fun (*this, &StepEntry::triplet_toggled)); + beat_resync_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::beat_resync_click)); + bar_resync_button.signal_clicked().connect (sigc::mem_fun (*this, &StepEntry::bar_resync_click)); + + packer.set_spacing (6); + packer.pack_start (upper_box, false, false); + packer.pack_start (*piano, false, false); + packer.show_all (); + + get_vbox()->add (packer); } StepEntry::~StepEntry() @@ -259,137 +259,136 @@ StepEntry::~StepEntry() bool StepEntry::on_key_press_event (GdkEventKey* ev) { - if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { - return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); - } - return true; + if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { + return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); + } + return true; } bool StepEntry::on_key_release_event (GdkEventKey* ev) { - if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { - return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); - } - return true; + if (!gtk_window_propagate_key_event (GTK_WINDOW(gobj()), ev)) { + return gtk_window_activate_key (GTK_WINDOW(gobj()), ev); + } + return true; } void StepEntry::rest_event_handler () { - _mtv->step_edit_rest (0.0); + _mtv->step_edit_rest (0.0); } Evoral::MusicalTime StepEntry::note_length () const { - Evoral::MusicalTime length = 0.0; - - if (length_64_button.get_active()) { - length = 1.0/64.0; - } else if (length_32_button.get_active()) { - length = 1.0/32.0; - } else if (length_16_button.get_active()) { - length = 1.0/16.0; - } else if (length_8_button.get_active()) { - length = 1.0/8.0; - } else if (length_4_button.get_active()) { - length = 1.0/4.0; - } else if (length_2_button.get_active()) { - length = 1.0/2.0; - } else if (length_1_button.get_active()) { - length = 1.0/1.0; - } - - if (dot_button.get_active()) { - length *= 0.5; - } - - if (_mtv->step_edit_within_triplet()) { - length *= 2.0/3.0; - } - - return length; + Evoral::MusicalTime length = 0.0; + + if (length_64_button.get_active()) { + length = 1.0/64.0; + } else if (length_32_button.get_active()) { + length = 1.0/32.0; + } else if (length_16_button.get_active()) { + length = 1.0/16.0; + } else if (length_8_button.get_active()) { + length = 1.0/8.0; + } else if (length_4_button.get_active()) { + length = 1.0/4.0; + } else if (length_2_button.get_active()) { + length = 1.0/2.0; + } else if (length_1_button.get_active()) { + length = 1.0/1.0; + } + + if (dot_button.get_active()) { + length *= 0.5; + } + + if (_mtv->step_edit_within_triplet()) { + length *= 2.0/3.0; + } + + return length; } uint8_t StepEntry::note_velocity () const { - uint8_t velocity = 64; - - if (velocity_ppp_button.get_active()) { - velocity = 16; - } else if (velocity_pp_button.get_active()) { - velocity = 32; - } else if (velocity_p_button.get_active()) { - velocity = 48; - } else if (velocity_mp_button.get_active()) { - velocity = 64; - } else if (velocity_mf_button.get_active()) { - velocity = 80; - } else if (velocity_f_button.get_active()) { - velocity = 96; - } else if (velocity_ff_button.get_active()) { - velocity = 112; - } else if (velocity_fff_button.get_active()) { - velocity = 127; - } - - return velocity; + uint8_t velocity = 64; + + if (velocity_ppp_button.get_active()) { + velocity = 16; + } else if (velocity_pp_button.get_active()) { + velocity = 32; + } else if (velocity_p_button.get_active()) { + velocity = 48; + } else if (velocity_mp_button.get_active()) { + velocity = 64; + } else if (velocity_mf_button.get_active()) { + velocity = 80; + } else if (velocity_f_button.get_active()) { + velocity = 96; + } else if (velocity_ff_button.get_active()) { + velocity = 112; + } else if (velocity_fff_button.get_active()) { + velocity = 127; + } + + return velocity; } uint8_t StepEntry::note_channel() const { - return channel_adjustment.get_value() - 1; + return channel_adjustment.get_value() - 1; } void StepEntry::note_off_event_handler (int note) { - - _mtv->step_add_note (note_channel(), note, note_velocity(), note_length()); + _mtv->step_add_note (note_channel(), note, note_velocity(), note_length()); } void StepEntry::rest_click () { - _mtv->step_edit_rest (note_length()); + _mtv->step_edit_rest (note_length()); } void StepEntry::grid_rest_click () { - _mtv->step_edit_rest (0.0); + _mtv->step_edit_rest (0.0); } void StepEntry::triplet_toggled () { - if (triplet_button.get_active () != _mtv->step_edit_within_triplet()) { - _mtv->step_edit_toggle_triplet (); - } + if (triplet_button.get_active () != _mtv->step_edit_within_triplet()) { + _mtv->step_edit_toggle_triplet (); + } } void StepEntry::chord_toggled () { - if (chord_button.get_active() != _mtv->step_edit_within_chord ()) { - _mtv->step_edit_toggle_chord (); - } + if (chord_button.get_active() != _mtv->step_edit_within_chord ()) { + _mtv->step_edit_toggle_chord (); + } } void StepEntry::on_show () { - ArdourDialog::on_show (); - piano->grab_focus (); + ArdourDialog::on_show (); + piano->grab_focus (); } void StepEntry::beat_resync_click () { - _mtv->step_edit_beat_sync (); + _mtv->step_edit_beat_sync (); } void |