diff --git a/gtk2_ardour/editing_context.cc b/gtk2_ardour/editing_context.cc index 880387cc2e..7fb0732fe4 100644 --- a/gtk2_ardour/editing_context.cc +++ b/gtk2_ardour/editing_context.cc @@ -61,6 +61,7 @@ using namespace Gtk; using namespace Gtkmm2ext; using namespace PBD; using namespace Temporal; +using namespace ArdourWidgets; using std::string; sigc::signal EditingContext::DropDownKeys; @@ -118,11 +119,15 @@ EditingContext::EditingContext (std::string const & name) , _grid_type (GridTypeBeat) , _snap_mode (SnapOff) , _timeline_origin (0.) + , play_note_selection_button (_("Ear"), ArdourButton::Text, true) + , follow_playhead_button (_("F"), ArdourButton::Text, true) + , full_zoom_button (_("<->"), ArdourButton::Text) , _drags (new DragManager (this)) , _leftmost_sample (0) , _playhead_cursor (nullptr) , _snapped_cursor (nullptr) , _follow_playhead (false) + , visible_channel_label (_("MIDI|Channel")) , selection (new Selection (this, true)) , cut_buffer (new Selection (this, false)) , _selection_memento (new SelectionMemento()) @@ -149,6 +154,8 @@ EditingContext::EditingContext (std::string const & name) , entered_regionview (nullptr) , clear_entered_track (false) { + using namespace Gtk::Menu_Helpers; + if (!button_bindings) { button_bindings = new Bindings ("editor-mouse"); @@ -184,6 +191,21 @@ EditingContext::EditingContext (std::string const & name) set_tooltip (grid_type_selector, _("Grid Mode")); set_tooltip (snap_mode_button, _("Snap Mode\n\nRight-click to visit Snap preferences.")); + set_tooltip (play_note_selection_button, _("Play notes when selected")); + set_tooltip (follow_playhead_button, _("Scroll automatically to keep playhead visible")); + /* Leave tip for full zoom button to derived class */ + set_tooltip (visible_channel_selector, _("Select visible MIDI channel")); + + play_note_selection_button.signal_clicked.connect (sigc::mem_fun (*this, &EditingContext::play_note_selection_clicked)); + follow_playhead_button.signal_clicked.connect (sigc::mem_fun (*this, &EditingContext::follow_playhead_clicked)); + full_zoom_button.signal_clicked.connect (sigc::mem_fun (*this, &EditingContext::full_zoom_clicked)); + + for (int i = 0; i < 16; i++) { + char buf[4]; + sprintf(buf, "%d", i+1); + visible_channel_selector.AddMenuElem (MenuElem (buf, [this,i]() { EditingContext::set_visible_channel (i); })); + } + /* handle escape */ ARDOUR_UI::instance()->Escape.connect (escape_connection, MISSING_INVALIDATOR, std::bind (&EditingContext::escape, this), gui_context()); @@ -2758,4 +2780,12 @@ EditingContext::update_all_enter_cursors () } } +void +EditingContext::play_note_selection_clicked () +{ +} +void +EditingContext::follow_playhead_clicked () +{ +} diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index a52cc60348..8daf7b5b00 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -490,6 +490,17 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider void snap_mode_chosen (Editing::SnapMode); void grid_type_chosen (Editing::GridType); + ArdourWidgets::ArdourButton play_note_selection_button; + ArdourWidgets::ArdourButton follow_playhead_button; + ArdourWidgets::ArdourButton full_zoom_button; + Gtk::Label visible_channel_label; + ArdourWidgets::ArdourDropdown visible_channel_selector; + + virtual void play_note_selection_clicked(); + virtual void follow_playhead_clicked (); + virtual void full_zoom_clicked() {}; + virtual void set_visible_channel (int) {} + DragManager* _drags; ArdourWidgets::ArdourButton snap_mode_button; diff --git a/gtk2_ardour/midi_cue_editor.cc b/gtk2_ardour/midi_cue_editor.cc index d7d751841e..3a0d63cd2c 100644 --- a/gtk2_ardour/midi_cue_editor.cc +++ b/gtk2_ardour/midi_cue_editor.cc @@ -31,6 +31,8 @@ #include "gtkmm2ext/actions.h" #include "widgets/ardour_button.h" +#include "widgets/ardour_dropdown.h" +#include "widgets/tooltips.h" #include "ardour_ui.h" #include "editor_cursors.h" @@ -153,6 +155,8 @@ MidiCueEditor::build_lower_toolbar () void MidiCueEditor::build_upper_toolbar () { + using namespace Gtk::Menu_Helpers; + Gtk::HBox* mode_box = manage(new Gtk::HBox); mode_box->set_border_width (2); mode_box->set_spacing(2); @@ -194,13 +198,28 @@ MidiCueEditor::build_upper_toolbar () _toolbar_inner->pack_start (grid_box, false, false); _toolbar_inner->pack_start (draw_box, false, false); + set_tooltip (full_zoom_button, _("Zoom to full clip")); + + _toolbar_outer->set_border_width (6); + _toolbar_outer->set_spacing (12); + _toolbar_outer->pack_start (visible_channel_label, false, false); + _toolbar_outer->pack_start (visible_channel_selector, false, false); + _toolbar_outer->pack_start (play_note_selection_button, false, false); + _toolbar_outer->pack_start (follow_playhead_button, false, false); + _toolbar_outer->pack_start (full_zoom_button, false, false); _toolbar_outer->pack_start (*_toolbar_inner, true, false); + _toolbox.pack_start (*_toolbar_outer, false, false); Bindings* pr_bindings = Bindings::get_bindings (X_("Pianoroll")); _toolbox.set_data (X_("ardour-bindings"), pr_bindings); } +void +MidiCueEditor::set_visible_channel (int n) +{ +} + void MidiCueEditor::build_canvas () { diff --git a/gtk2_ardour/midi_cue_editor.h b/gtk2_ardour/midi_cue_editor.h index d2cf527060..0368d08fdc 100644 --- a/gtk2_ardour/midi_cue_editor.h +++ b/gtk2_ardour/midi_cue_editor.h @@ -109,6 +109,8 @@ class MidiCueEditor : public CueEditor Gdk::Cursor* which_trim_cursor (bool left_side) const; Gdk::Cursor* which_canvas_cursor (ItemType type) const; + void set_visible_channel (int chan); + protected: void register_actions (); @@ -233,6 +235,8 @@ class MidiCueEditor : public CueEditor bool automation_button_event (GdkEventButton*, Evoral::ParameterType type, int id); void automation_button_click (Evoral::ParameterType type, int id, ARDOUR::SelectionOperation); + + int _visible_channel; };