Grey-out patch changes on inactive channels rather than not
authorCarl Hetherington <carl@carlh.net>
Fri, 8 Jun 2012 12:17:33 +0000 (12:17 +0000)
committerCarl Hetherington <carl@carlh.net>
Fri, 8 Jun 2012 12:17:33 +0000 (12:17 +0000)
plotting them at all (part of #4207).

git-svn-id: svn://localhost/ardour2/branches/3.0@12600 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour3_ui_default.conf
gtk2_ardour/canvas_patch_change.cc
gtk2_ardour/canvas_patch_change.h
gtk2_ardour/canvas_vars.h
gtk2_ardour/midi_region_view.cc
gtk2_ardour/midi_region_view.h

index 801037713b17662282e36ee37fef76d12cdbc48e..b578556b12245fae37a4e3a281b65a8043e7f429 100644 (file)
@@ -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"/>
index b4da0d5b460a6fbd57a7c251297a8684b5644dd0..44389ae96ced806d0f3e9f4cd189e3da8183755e 100644 (file)
@@ -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)
index 79eb80dfae6bf9fb2433359e23ad6d9eeaa445c5..2a219fdbb631aad2c3217a7eed758cdf938e8ac0 100644 (file)
@@ -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();
index fb374692f350999df356cb7693db2961333b9f6f..975f5eb2af436dafb5bc062b218a55ec1fb3b25f 100644 (file)
@@ -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")
index 592da5aa916cf833760c7614ec4b8b9d4c94d87c..25ef2dfc339d1e95fa16feb9f1cd1db6be6f84f1 100644 (file)
@@ -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
index a6750ef12305920e346e575b4590459c2279d755..f47c94a1a96fbbbdd0bc6f710362cf345744e956 100644 (file)
@@ -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>);