diff options
author | Carl Hetherington <carl@carlh.net> | 2012-06-08 12:17:33 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-06-08 12:17:33 +0000 |
commit | ef213e49a7e4eb7083696fd7e953c8f11e492849 (patch) | |
tree | 027d7db89742650050164596e00f04dd2108d3b5 /gtk2_ardour/midi_region_view.cc | |
parent | f13119d2e111e7f295330560478ed6090f27a1f6 (diff) |
Grey-out patch changes on inactive channels rather than not
plotting them at all (part of #4207).
git-svn-id: svn://localhost/ardour2/branches/3.0@12600 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_region_view.cc')
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 592da5aa91..25ef2dfc33 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -1184,15 +1184,15 @@ MidiRegionView::display_patch_changes () uint16_t chn_mask = mtv->channel_selector().get_selected_channels(); for (uint8_t i = 0; i < 16; ++i) { - if (chn_mask & (1<<i)) { - display_patch_changes_on_channel (i); - } - /* TODO gray-out patch instad of not displaying it */ + display_patch_changes_on_channel (i, chn_mask & (1 << i)); } } +/** @param active_channel true to display patch changes fully, false to display + * them `greyed-out' (as on an inactive channel) + */ void -MidiRegionView::display_patch_changes_on_channel (uint8_t channel) +MidiRegionView::display_patch_changes_on_channel (uint8_t channel, bool active_channel) { for (MidiModel::PatchChanges::const_iterator i = _model->patch_changes().begin(); i != _model->patch_changes().end(); ++i) { @@ -1207,12 +1207,12 @@ MidiRegionView::display_patch_changes_on_channel (uint8_t channel) _model_name, _custom_device_mode, channel, patch_key); if (patch != 0) { - add_canvas_patch_change (*i, patch->name()); + add_canvas_patch_change (*i, patch->name(), active_channel); } else { char buf[16]; /* program and bank numbers are zero-based: convert to one-based: MIDI_BP_ZERO */ snprintf (buf, 16, "%d %d", (*i)->program() + MIDI_BP_ZERO , (*i)->bank() + MIDI_BP_ZERO); - add_canvas_patch_change (*i, buf); + add_canvas_patch_change (*i, buf, active_channel); } } } @@ -1756,8 +1756,13 @@ MidiRegionView::step_sustain (Evoral::MusicalTime beats) change_note_lengths (false, false, beats, false, true); } +/** Add a new patch change flag to the canvas. + * @param patch the patch change to add + * @param the text to display in the flag + * @param active_channel true to display the flag as on an active channel, false to grey it out for an inactive channel. + */ void -MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext) +MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const string& displaytext, bool active_channel) { assert (patch->time() >= 0); @@ -1773,7 +1778,8 @@ MidiRegionView::add_canvas_patch_change (MidiModel::PatchChangePtr patch, const x, 1.0, _model_name, _custom_device_mode, - patch) + patch, + active_channel) ); // Show unless patch change is beyond the region bounds |