summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/midi_time_axis.cc11
-rw-r--r--gtk2_ardour/midi_time_axis.h2
-rw-r--r--gtk2_ardour/step_entry.cc35
-rw-r--r--gtk2_ardour/step_entry.h6
4 files changed, 42 insertions, 12 deletions
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 4a13004a96..b2c6cb81ae 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -1084,6 +1084,17 @@ MidiTimeAxisView::step_edit_rest (Evoral::MusicalTime beats)
}
}
+void
+MidiTimeAxisView::step_edit_beat_sync ()
+{
+ step_edit_beat_pos = ceil (step_edit_beat_pos);
+}
+
+void
+MidiTimeAxisView::step_edit_bar_sync ()
+{
+}
+
boost::shared_ptr<Region>
MidiTimeAxisView::add_region (framepos_t pos)
{
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index 3dacc19981..c9983c64ef 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -89,6 +89,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
void check_step_edit ();
void step_edit_rest (Evoral::MusicalTime beats);
+ void step_edit_beat_sync ();
+ void step_edit_bar_sync ();
int step_add_note (uint8_t channel, uint8_t pitch, uint8_t velocity,
Evoral::MusicalTime beat_duration);
bool step_edit_within_triplet () const;
diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc
index d2de0f79e1..f8cb79d285 100644
--- a/gtk2_ardour/step_entry.cc
+++ b/gtk2_ardour/step_entry.cc
@@ -46,9 +46,11 @@ _rest_event_handler (GtkWidget* widget, gpointer arg)
StepEntry::StepEntry (MidiTimeAxisView& mtv)
: ArdourDialog (string_compose (_("Step Entry: %1"), mtv.name()))
, triplet_button ("3")
- , sustain_button ("sustain")
- , rest_button ("rest")
- , grid_rest_button ("g-rest")
+ , 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)
@@ -199,11 +201,16 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv)
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")));
@@ -218,6 +225,7 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv)
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);
@@ -225,7 +233,6 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv)
piano = Glib::wrap ((GtkWidget*) _piano);
piano->set_flags (Gtk::CAN_FOCUS);
- piano->signal_enter_notify_event().connect (sigc::mem_fun (*this, &StepEntry::piano_enter_notify_event), false);
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);
@@ -234,6 +241,8 @@ StepEntry::StepEntry (MidiTimeAxisView& mtv)
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);
@@ -370,18 +379,20 @@ StepEntry::chord_toggled ()
}
}
-bool
-StepEntry::piano_enter_notify_event (GdkEventCrossing *ev)
+void
+StepEntry::on_show ()
{
- std::cerr << "PIANO ENTER\n";
+ ArdourDialog::on_show ();
piano->grab_focus ();
- return false;
}
void
-StepEntry::on_show ()
+StepEntry::beat_resync_click ()
+{
+ _mtv->step_edit_beat_sync ();
+}
+
+void
+StepEntry::bar_resync_click ()
{
- ArdourDialog::on_show ();
- piano->grab_focus ();
- std::cerr << "SHOW, piano has focus\n";
}
diff --git a/gtk2_ardour/step_entry.h b/gtk2_ardour/step_entry.h
index 44f8072a83..df1fd69026 100644
--- a/gtk2_ardour/step_entry.h
+++ b/gtk2_ardour/step_entry.h
@@ -55,6 +55,10 @@ class StepEntry : public ArdourDialog
Gtk::ToggleButton dot_button;
Gtk::ToggleButton restart_button;
+ Gtk::VBox resync_box;
+ Gtk::Button beat_resync_button;
+ Gtk::Button bar_resync_button;
+
Gtk::Button sustain_button;
Gtk::Button rest_button;
Gtk::Button grid_rest_button;
@@ -90,6 +94,8 @@ class StepEntry : public ArdourDialog
void sustain_click ();
void chord_toggled ();
void triplet_toggled ();
+ void beat_resync_click ();
+ void bar_resync_click ();
bool piano_enter_notify_event (GdkEventCrossing *ev);
bool on_key_release_event (GdkEventKey*);