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 | |
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')
-rw-r--r-- | gtk2_ardour/ardour3_ui_default.conf | 2 | ||||
-rw-r--r-- | gtk2_ardour/canvas_patch_change.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/canvas_patch_change.h | 3 | ||||
-rw-r--r-- | gtk2_ardour/canvas_vars.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.cc | 24 | ||||
-rw-r--r-- | gtk2_ardour/midi_region_view.h | 8 |
6 files changed, 31 insertions, 19 deletions
diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf index 801037713b..b578556b12 100644 --- a/gtk2_ardour/ardour3_ui_default.conf +++ b/gtk2_ardour/ardour3_ui_default.conf @@ -73,6 +73,8 @@ <Option name="midi note velocity text" value="f4f214bc"/> <Option name="midi patch change fill" value="0000ffa0"/> <Option name="midi patch change outline" value="a7a7d4ff"/> + <Option name="midi patch change inactive channel fill" value="00000000"/> + <Option name="midi patch change inactive channel outline" value="222222ff"/> <Option name="midi sysex fill" value="f1e139a0"/> <Option name="midi sysex outline" value="a7a7d4ff"/> <Option name="midi select rect fill" value="8888ff88"/> diff --git a/gtk2_ardour/canvas_patch_change.cc b/gtk2_ardour/canvas_patch_change.cc index b4da0d5b46..44389ae96c 100644 --- a/gtk2_ardour/canvas_patch_change.cc +++ b/gtk2_ardour/canvas_patch_change.cc @@ -46,13 +46,18 @@ CanvasPatchChange::CanvasPatchChange( double y, string& model_name, string& custom_device_mode, - ARDOUR::MidiModel::PatchChangePtr patch) + ARDOUR::MidiModel::PatchChangePtr patch, + bool active_channel) : CanvasFlag( region, parent, height, - ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get(), - ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get(), + active_channel ? + ARDOUR_UI::config()->canvasvar_MidiPatchChangeOutline.get() : + ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelOutline.get(), + active_channel ? + ARDOUR_UI::config()->canvasvar_MidiPatchChangeFill.get() : + ARDOUR_UI::config()->canvasvar_MidiPatchChangeInactiveChannelFill.get(), x, y) , _model_name(model_name) diff --git a/gtk2_ardour/canvas_patch_change.h b/gtk2_ardour/canvas_patch_change.h index 79eb80dfae..2a219fdbb6 100644 --- a/gtk2_ardour/canvas_patch_change.h +++ b/gtk2_ardour/canvas_patch_change.h @@ -45,7 +45,8 @@ public: double y, string& model_name, string& custom_device_mode, - ARDOUR::MidiModel::PatchChangePtr patch + ARDOUR::MidiModel::PatchChangePtr patch, + bool ); virtual ~CanvasPatchChange(); diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h index fb374692f3..975f5eb2af 100644 --- a/gtk2_ardour/canvas_vars.h +++ b/gtk2_ardour/canvas_vars.h @@ -67,6 +67,8 @@ CANVAS_VARIABLE(canvasvar_MidiNoteSelected, "midi note selected") CANVAS_VARIABLE(canvasvar_MidiNoteVelocityText, "midi note velocity text") CANVAS_VARIABLE(canvasvar_MidiPatchChangeFill, "midi patch change fill") CANVAS_VARIABLE(canvasvar_MidiPatchChangeOutline, "midi patch change outline") +CANVAS_VARIABLE(canvasvar_MidiPatchChangeInactiveChannelFill, "midi patch change inactive channel fill") +CANVAS_VARIABLE(canvasvar_MidiPatchChangeInactiveChannelOutline, "midi patch change inactive channel outline") CANVAS_VARIABLE(canvasvar_MidiSysExFill, "midi sysex fill") CANVAS_VARIABLE(canvasvar_MidiSysExOutline, "midi sysex outline") CANVAS_VARIABLE(canvasvar_MidiSelectRectFill, "midi select rect fill") 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 diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index a6750ef123..f47c94a1a9 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -118,11 +118,7 @@ public: void cut_copy_clear (Editing::CutCopyOp); void paste (framepos_t pos, float times, const MidiCutBuffer&); - /** Add a new patch change flag to the canvas. - * @param patch the patch change to add - * @param the text to display in the flag - */ - void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext); + void add_canvas_patch_change (ARDOUR::MidiModel::PatchChangePtr patch, const std::string& displaytext, bool); /** Look up the given time and channel in the 'automation' and set keys accordingly. * @param time the time of the patch change event @@ -466,7 +462,7 @@ private: void maybe_select_by_position (GdkEventButton* ev, double x, double y); void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0); - void display_patch_changes_on_channel (uint8_t); + void display_patch_changes_on_channel (uint8_t, bool); void connect_to_diskstream (); void data_recorded (boost::weak_ptr<ARDOUR::MidiSource>); |