Merge remote-tracking branch 'remotes/origin/cairocanvas' into windows
[ardour.git] / gtk2_ardour / midi_time_axis.cc
index 54f883ac195df918354ac9a95658bd1c07e604ed..4884dc34f38c929f9b3b3edf9600925994bfd2e9 100644 (file)
@@ -26,6 +26,7 @@
 #include <sigc++/bind.h>
 
 #include "pbd/error.h"
+#include "pbd/ffs.h"
 #include "pbd/stl_delete.h"
 #include "pbd/whitespace.h"
 #include "pbd/basename.h"
 #include "ardour/track.h"
 #include "ardour/types.h"
 
-#include "midi++/names.h"
-
 #include "ardour_ui.h"
 #include "ardour_button.h"
 #include "automation_line.h"
 #include "automation_time_axis.h"
-#include "canvas-note-event.h"
-#include "canvas_impl.h"
 #include "editor.h"
 #include "enums.h"
 #include "ghostregion.h"
 #include "gui_thread.h"
 #include "keyboard.h"
+#include "midi_channel_selector.h"
 #include "midi_scroomer.h"
 #include "midi_streamview.h"
 #include "midi_region_view.h"
@@ -82,8 +80,8 @@
 #include "rgb_macros.h"
 #include "selection.h"
 #include "step_editor.h"
-#include "simplerect.h"
 #include "utils.h"
+#include "note_base.h"
 
 #include "ardour/midi_track.h"
 
@@ -96,10 +94,10 @@ using namespace Gtkmm2ext;
 using namespace Editing;
 
 // Minimum height at which a control is displayed
-static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 162;
-static const uint32_t KEYBOARD_MIN_HEIGHT = 140;
+static const uint32_t MIDI_CONTROLS_BOX_MIN_HEIGHT = 140;
+static const uint32_t KEYBOARD_MIN_HEIGHT = 130;
 
-MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, Canvas& canvas)
+MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
        : AxisView(sess) // virtually inherited
        , RouteTimeAxisView(ed, sess, canvas)
        , _ignore_signals(false)
@@ -112,6 +110,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session* sess, Canvas& can
        , _meter_color_mode_item(0)
        , _channel_color_mode_item(0)
        , _track_color_mode_item(0)
+       , _channel_selector (0)
        , _step_edit_item (0)
        , controller_menu (0)
        , _step_editor (0)
@@ -148,6 +147,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                                               atoi (gui_property ("note-range-max").c_str()),
                                               true);
        }
+
        midi_view()->NoteRangeChanged.connect (
                sigc::mem_fun (*this, &MidiTimeAxisView::note_range_changed));
        _view->ContentsHeightChanged.connect (
@@ -198,7 +198,7 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                v->pack_start (*manage (new Label ("")), true, true);
                v->show ();
                h->show ();
-               controls_hbox.pack_start(*v);
+               controls_hbox.pack_start(*v, false, false);
 
                controls_ebox.set_name ("MidiTrackControlsBaseUnselected");
                controls_base_selected_name = "MidiTrackControlsBaseSelected";
@@ -211,6 +211,22 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                _view->RegionViewAdded.connect (
                        sigc::mem_fun(*this, &MidiTimeAxisView::region_view_added));
 
+               midi_track()->PlaybackChannelModeChanged.connect (*this, invalidator (*this),
+                                                                 boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
+                                                                 gui_context());
+               midi_track()->PlaybackChannelMaskChanged.connect (*this, invalidator (*this),
+                                                                 boost::bind (&MidiTimeAxisView::playback_channel_mode_changed, this),
+                                                                 gui_context());
+               midi_track()->CaptureChannelModeChanged.connect (*this, invalidator (*this),
+                                                                 boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
+                                                                 gui_context());
+               midi_track()->CaptureChannelMaskChanged.connect (*this, invalidator (*this),
+                                                                 boost::bind (&MidiTimeAxisView::capture_channel_mode_changed, this),
+                                                                 gui_context());
+
+               playback_channel_mode_changed ();
+               capture_channel_mode_changed ();
+
                if (!_editor.have_idled()) {
                        /* first idle will do what we need */
                } else {
@@ -218,7 +234,6 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                }
        }
 
-
        MIDI::Name::MidiPatchManager& patch_manager = MIDI::Name::MidiPatchManager::instance();
 
        MIDI::Name::MasterDeviceNames::Models::const_iterator m = patch_manager.all_models().begin();
@@ -226,6 +241,18 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                _midnam_model_selector.append_text(m->c_str());
        }
 
+       if (gui_property (X_("midnam-model-name")).empty()) {
+               set_gui_property (X_("midnam-model-name"), "Generic");
+       }
+
+       if (gui_property (X_("midnam-custom-device-mode")).empty()) {
+               boost::shared_ptr<MIDI::Name::MasterDeviceNames> device_names = get_device_names();
+               if (device_names) {
+                       set_gui_property (X_("midnam-custom-device-mode"),
+                                         *device_names->custom_device_mode_names().begin());
+               }
+       }
+
        _midnam_model_selector.set_active_text (gui_property (X_("midnam-model-name")));
        _midnam_custom_device_mode_selector.set_active_text (gui_property (X_("midnam-custom-device-mode")));
 
@@ -235,28 +262,41 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        _midi_controls_box.set_homogeneous(false);
        _midi_controls_box.set_border_width (10);
 
-       if (!patch_manager.all_models().empty()) {
-               _channel_selector.set_border_width(2);
-               _channel_selector.show_all ();
+       _channel_status_box.set_homogeneous (false);
+       _channel_status_box.set_spacing (6);
+       
+       _channel_selector_button.set_label (_("Chns"));
+       ARDOUR_UI::instance()->set_tip (_channel_selector_button, _("Click to edit channel settings"));
+       
+       /* fixed sized labels to prevent silly nonsense (though obviously,
+        * they cause their own too)
+        */
 
-               _midi_controls_box.resize(3, 2);
-               _midi_controls_box.attach(_channel_selector, 0, 2, 0, 1);
-               
-               _midi_controls_box.attach(*manage(new HSeparator()), 0, 2, 1, 2);
+       _playback_channel_status.set_size_request (65, -1);
+       _capture_channel_status.set_size_request (60, -1);
+
+       _channel_status_box.pack_start (_playback_channel_status, false, false);
+       _channel_status_box.pack_start (_capture_channel_status, false, false);
+       _channel_status_box.pack_start (_channel_selector_button, false, false);
+       _channel_status_box.show_all ();
+
+       _channel_selector_button.signal_clicked().connect (sigc::mem_fun (*this, &MidiTimeAxisView::toggle_channel_selector));
+       
+       _midi_controls_box.pack_start (_channel_status_box, false, false, 10);
+
+       if (!patch_manager.all_models().empty()) {
 
                _midnam_model_selector.set_size_request(22, 30);
                _midnam_model_selector.set_border_width(2);
                _midnam_model_selector.show ();
-               _midi_controls_box.attach(_midnam_model_selector, 0, 1, 2, 3);
+               _midi_controls_box.pack_start (_midnam_model_selector);
 
                _midnam_custom_device_mode_selector.set_size_request(10, 30);
                _midnam_custom_device_mode_selector.set_border_width(2);
                _midnam_custom_device_mode_selector.show ();
-               _midi_controls_box.attach(_midnam_custom_device_mode_selector, 0, 1, 3, 4);
-       } else {
-               _midi_controls_box.attach(_channel_selector, 0, 1, 0, 1);
-               _channel_selector.show_all ();
-       }
+
+               _midi_controls_box.pack_start (_midnam_custom_device_mode_selector);
+       } 
 
        model_changed();
        custom_device_mode_changed();
@@ -266,22 +306,13 @@ MidiTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        _midnam_custom_device_mode_selector.signal_changed().connect(
                sigc::mem_fun(*this, &MidiTimeAxisView::custom_device_mode_changed));
 
-
        controls_vbox.pack_start(_midi_controls_box, false, false);
 
-       // restore channel selector settings
-       _channel_selector.set_channel_mode(midi_track()->get_channel_mode(),
-                                          midi_track()->get_channel_mask());
-       _channel_selector.mode_changed.connect(
-               sigc::mem_fun(*midi_track(), &MidiTrack::set_channel_mode));
-       _channel_selector.mode_changed.connect(
-               sigc::mem_fun(*this, &MidiTimeAxisView::set_channel_mode));
-
        const string color_mode = gui_property ("color-mode");
        if (!color_mode.empty()) {
                _color_mode = ColorMode (string_2_enum(color_mode, _color_mode));
-               if (_color_mode == ChannelColors) {
-                       _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
+               if (_channel_selector && _color_mode == ChannelColors) {
+                       _channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
                }
        }
 
@@ -324,6 +355,8 @@ MidiTimeAxisView::first_idle ()
 
 MidiTimeAxisView::~MidiTimeAxisView ()
 {
+       delete _channel_selector;
+
        delete _piano_roll_header;
        _piano_roll_header = 0;
 
@@ -368,14 +401,9 @@ MidiTimeAxisView::model_changed()
 
        _midnam_custom_device_mode_selector.clear_items();
 
-       if (device_modes.size() < 2) {
-               _midnam_custom_device_mode_selector.hide();
-       } else {
-               _midnam_custom_device_mode_selector.show();
-               for (std::list<std::string>::const_iterator i = device_modes.begin();
-                    i != device_modes.end(); ++i) {
-                       _midnam_custom_device_mode_selector.append_text(*i);
-               }
+       for (std::list<std::string>::const_iterator i = device_modes.begin();
+            i != device_modes.end(); ++i) {
+               _midnam_custom_device_mode_selector.append_text(*i);
        }
 
        _midnam_custom_device_mode_selector.set_active(0);
@@ -463,10 +491,35 @@ MidiTimeAxisView::append_extra_display_menu_items ()
 
        items.push_back (MenuElem (_("Note Range"), *range_menu));
        items.push_back (MenuElem (_("Note Mode"), *build_note_mode_menu()));
+       items.push_back (MenuElem (_("Channel Selector"),
+                                  sigc::mem_fun(*this, &MidiTimeAxisView::toggle_channel_selector)));
 
+       color_mode_menu = build_color_mode_menu();
+       if (color_mode_menu) {
+               items.push_back (MenuElem (_("Color Mode"), *color_mode_menu));
+       }
+       
        items.push_back (SeparatorElem ());
 }
 
+void
+MidiTimeAxisView::toggle_channel_selector ()
+{
+       if (!_channel_selector) {
+               _channel_selector = new MidiChannelSelectorWindow (midi_track());
+
+               if (_color_mode == ChannelColors) {
+                       _channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
+               } else {
+                       _channel_selector->set_default_channel_color ();
+               }
+
+               _channel_selector->show_all ();
+       } else {
+               _channel_selector->cycle_visibility ();
+       }
+}
+
 void
 MidiTimeAxisView::build_automation_action_menu (bool for_selection)
 {
@@ -488,7 +541,7 @@ MidiTimeAxisView::build_automation_action_menu (bool for_selection)
 
        MenuList& automation_items = automation_action_menu->items();
 
-       uint16_t selected_channels = _channel_selector.get_selected_channels();
+       uint16_t selected_channels = midi_track()->get_playback_channel_mask();
 
        if (selected_channels !=  0) {
 
@@ -532,7 +585,7 @@ MidiTimeAxisView::build_automation_action_menu (bool for_selection)
 void
 MidiTimeAxisView::change_all_channel_tracks_visibility (bool yn, Evoral::Parameter param)
 {
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
 
        for (uint8_t chn = 0; chn < 16; chn++) {
                if (selected_channels & (0x0001 << chn)) {
@@ -559,7 +612,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
           structure if there is more than 1 selected.
         */
 
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
        int chn_cnt = 0;
 
        for (uint8_t chn = 0; chn < 16; chn++) {
@@ -609,7 +662,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
                                        }
                                }
 
-                               CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
+                               Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&chn_items.back());
                                _channel_command_menu_map[fully_qualified_param] = cmi;
                                cmi->set_active (visible);
                        }
@@ -641,7 +694,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
                                        }
                                }
 
-                               CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&items.back());
+                               Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&items.back());
                                _channel_command_menu_map[fully_qualified_param] = cmi;
                                cmi->set_active (visible);
 
@@ -660,7 +713,7 @@ MidiTimeAxisView::add_single_channel_controller_item(Menu_Helpers::MenuList& ctl
 {
        using namespace Menu_Helpers;
 
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
        for (uint8_t chn = 0; chn < 16; chn++) {
                if (selected_channels & (0x0001 << chn)) {
 
@@ -683,7 +736,7 @@ MidiTimeAxisView::add_single_channel_controller_item(Menu_Helpers::MenuList& ctl
                                }
                        }
 
-                       CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&ctl_items.back());
+                       Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&ctl_items.back());
                        _controller_menu_map[fully_qualified_param] = cmi;
                        cmi->set_active (visible);
 
@@ -701,7 +754,7 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
 {
        using namespace Menu_Helpers;
 
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
 
        Menu* chn_menu = manage (new Menu);
        MenuList& chn_items (chn_menu->items());
@@ -739,7 +792,7 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
                                }
                        }
 
-                       CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
+                       Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&chn_items.back());
                        _controller_menu_map[fully_qualified_param] = cmi;
                        cmi->set_active (visible);
                }
@@ -751,6 +804,36 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
        dynamic_cast<Label*> (ctl_items.back().get_child())->set_use_markup (true);
 }
 
+boost::shared_ptr<MIDI::Name::CustomDeviceMode>
+MidiTimeAxisView::get_device_mode()
+{
+       using namespace MIDI::Name;
+
+       boost::shared_ptr<MasterDeviceNames> device_names = get_device_names();
+       if (!device_names) {
+               return boost::shared_ptr<MIDI::Name::CustomDeviceMode>();
+       }
+
+       return device_names->custom_device_mode_by_name(
+               gui_property (X_("midnam-custom-device-mode")));
+}
+
+boost::shared_ptr<MIDI::Name::MasterDeviceNames>
+MidiTimeAxisView::get_device_names()
+{
+       using namespace MIDI::Name;
+
+       const std::string model = gui_property (X_("midnam-model-name"));
+
+       boost::shared_ptr<MIDINameDocument> midnam = MidiPatchManager::instance()
+               .document_by_model(model);
+       if (midnam) {
+               return midnam->master_device_names(model);
+       } else {
+               return boost::shared_ptr<MasterDeviceNames>();
+       }
+}
+
 void
 MidiTimeAxisView::build_controller_menu ()
 {
@@ -769,7 +852,7 @@ MidiTimeAxisView::build_controller_menu ()
           combination covering the currently selected channels for this track
        */
 
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
 
        /* count the number of selected channels because we will build a different menu
           structure if there is more than 1 selected.
@@ -785,46 +868,41 @@ MidiTimeAxisView::build_controller_menu ()
        }
 
        using namespace MIDI::Name;
-       const Glib::ustring model = _midnam_model_selector.get_active_text();
-       boost::shared_ptr<MIDINameDocument> midnam = MidiPatchManager::instance()
-               .document_by_model(model);
-       boost::shared_ptr<MasterDeviceNames> device_names;
+       boost::shared_ptr<MasterDeviceNames> device_names = get_device_names();
 
-       if (midnam) {
-               device_names = midnam->master_device_names(model);
-       }
-       
        if (device_names && !device_names->controls().empty()) {
                /* Controllers names available in midnam file, generate fancy menu */
                unsigned n_items  = 0;
                unsigned n_groups = 0;
+
+               /* TODO: This is not correct, should look up the currently applicable ControlNameList
+                  and only build a menu for that one. */
                for (MasterDeviceNames::ControlNameLists::const_iterator l = device_names->controls().begin();
                     l != device_names->controls().end(); ++l) {
-                       boost::shared_ptr<ControlNameList> name_list = *l;
+                       boost::shared_ptr<ControlNameList> name_list = l->second;
                        Menu*                              ctl_menu  = NULL;
                        
-                       for (ControlNameList::Controls::const_iterator c = (*l)->controls().begin();
-                            c != (*l)->controls().end(); ++c) {
-                               const int ctl = atoi((*c)->number().c_str());
-                               if (ctl == MIDI_CTL_MSB_BANK || ctl == MIDI_CTL_LSB_BANK) {
+                       for (ControlNameList::Controls::const_iterator c = name_list->controls().begin();
+                            c != name_list->controls().end();) {
+                               const uint16_t ctl = c->second->number();
+                               if (ctl != MIDI_CTL_MSB_BANK && ctl != MIDI_CTL_LSB_BANK) {
                                        /* Skip bank select controllers since they're handled specially */
-                                       continue;
-                               }
-                               
-                               if (n_items == 0) {
-                                       /* Create a new submenu */
-                                       ctl_menu = manage (new Menu);
-                               }
+                                       if (n_items == 0) {
+                                               /* Create a new submenu */
+                                               ctl_menu = manage (new Menu);
+                                       }
                                
-                               MenuList& ctl_items (ctl_menu->items());
-                               if (chn_cnt > 1) {
-                                       add_multi_channel_controller_item(ctl_items, ctl, (*c)->name());
-                               } else {
-                                       add_single_channel_controller_item(ctl_items, ctl, (*c)->name());
+                                       MenuList& ctl_items (ctl_menu->items());
+                                       if (chn_cnt > 1) {
+                                               add_multi_channel_controller_item(ctl_items, ctl, c->second->name());
+                                       } else {
+                                               add_single_channel_controller_item(ctl_items, ctl, c->second->name());
+                                       }
                                }
-                               
-                               if (++n_items == 16 || c == (*l)->controls().end()) {
-                                       /* Submenu has 16 items, add it to controller menu and reset */
+
+                               ++c;
+                               if (ctl_menu && (++n_items == 16 || c == name_list->controls().end())) {
+                                       /* Submenu has 16 items or we're done, add it to controller menu and reset */
                                        items.push_back(
                                                MenuElem(string_compose(_("Controllers %1-%2"),
                                                                        (16 * n_groups), (16 * n_groups) + n_items - 1),
@@ -952,10 +1030,12 @@ MidiTimeAxisView::set_color_mode (ColorMode mode, bool force, bool redisplay, bo
                        return;
                }
                
-               if (mode == ChannelColors) {
-                       _channel_selector.set_channel_colors(CanvasNoteEvent::midi_channel_colors);
-               } else {
-                       _channel_selector.set_default_channel_color();
+               if (_channel_selector) {
+                       if (mode == ChannelColors) {
+                               _channel_selector->set_channel_colors(NoteBase::midi_channel_colors);
+                       } else {
+                               _channel_selector->set_default_channel_color();
+                       }
                }
                
                _color_mode = mode;
@@ -1138,7 +1218,7 @@ MidiTimeAxisView::set_note_selection (uint8_t note)
                return;
        }
 
-       uint16_t chn_mask = _channel_selector.get_selected_channels();
+       uint16_t chn_mask = midi_track()->get_playback_channel_mask();
 
        if (_view->num_selected_regionviews() == 0) {
                _view->foreach_regionview (
@@ -1158,7 +1238,7 @@ MidiTimeAxisView::add_note_selection (uint8_t note)
                return;
        }
 
-       const uint16_t chn_mask = _channel_selector.get_selected_channels();
+       const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
 
        if (_view->num_selected_regionviews() == 0) {
                _view->foreach_regionview (
@@ -1178,7 +1258,7 @@ MidiTimeAxisView::extend_note_selection (uint8_t note)
                return;
        }
 
-       const uint16_t chn_mask = _channel_selector.get_selected_channels();
+       const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
 
        if (_view->num_selected_regionviews() == 0) {
                _view->foreach_regionview (
@@ -1198,7 +1278,7 @@ MidiTimeAxisView::toggle_note_selection (uint8_t note)
                return;
        }
 
-       const uint16_t chn_mask = _channel_selector.get_selected_channels();
+       const uint16_t chn_mask = midi_track()->get_playback_channel_mask();
 
        if (_view->num_selected_regionviews() == 0) {
                _view->foreach_regionview (
@@ -1242,7 +1322,7 @@ MidiTimeAxisView::set_channel_mode (ChannelMode, uint16_t)
           the right ones.
        */
 
-       const uint16_t selected_channels = _channel_selector.get_selected_channels();
+       const uint16_t selected_channels = midi_track()->get_playback_channel_mask();
        bool changed = false;
 
        no_redraw = true;
@@ -1356,14 +1436,13 @@ MidiTimeAxisView::stop_step_editing ()
        }
 }
 
-
 /** @return channel (counted from 0) to add an event to, based on the current setting
  *  of the channel selector.
  */
 uint8_t
 MidiTimeAxisView::get_channel_for_add () const
 {
-       uint16_t const chn_mask = _channel_selector.get_selected_channels ();
+       uint16_t const chn_mask = midi_track()->get_playback_channel_mask();
        int chn_cnt = 0;
        uint8_t channel = 0;
 
@@ -1397,3 +1476,35 @@ MidiTimeAxisView::contents_height_changed ()
 {
        _range_scroomer->set_size_request (-1, _view->child_height ());
 }
+
+void
+MidiTimeAxisView::playback_channel_mode_changed ()
+{
+       switch (midi_track()->get_playback_channel_mode()) {
+       case AllChannels:
+               _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), _("all")));
+               break;
+       case FilterChannels:
+               _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), _("some")));
+               break;
+       case ForceChannel:
+               _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Play"), _("all"), PBD::ffs (midi_track()->get_playback_channel_mask())));
+               break;
+       }
+}
+
+void
+MidiTimeAxisView::capture_channel_mode_changed ()
+{
+       switch (midi_track()->get_capture_channel_mode()) {
+       case AllChannels:
+               _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), _("all")));
+               break;
+       case FilterChannels:
+               _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), _("some")));
+               break;
+       case ForceChannel:
+               _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Rec"), _("all"), PBD::ffs (midi_track()->get_capture_channel_mask())));
+               break;
+       }
+}