diff --git a/gtk2_ardour/ardour3_ui_default.conf b/gtk2_ardour/ardour3_ui_default.conf
index aff521db37..84681c3675 100644
--- a/gtk2_ardour/ardour3_ui_default.conf
+++ b/gtk2_ardour/ardour3_ui_default.conf
@@ -59,9 +59,11 @@
+
+
diff --git a/gtk2_ardour/canvas-midi-event.cc b/gtk2_ardour/canvas-midi-event.cc
index 56ec1ec160..f87ae135cb 100644
--- a/gtk2_ardour/canvas-midi-event.cc
+++ b/gtk2_ardour/canvas-midi-event.cc
@@ -78,6 +78,22 @@ CanvasMidiEvent::hide_velocity(void)
_text->hide();
}
+void
+CanvasMidiEvent::on_channel_selection_change(uint16_t selection)
+{
+ // make note change its color if its channel is not marked active
+ if( (selection & (1 << _note->channel())) == 0 ) {
+ set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteFillInactiveChannel.get());
+ set_outline_color(ARDOUR_UI::config()->canvasvar_MidiNoteOutlineInactiveChannel.get());
+ } else {
+ set_fill_color(note_fill_color(_note->velocity()));
+ set_outline_color(note_outline_color(_note->velocity()));
+ }
+ // this forces the item to update..... maybe slow...
+ _item->hide();
+ _item->show();
+}
+
void
CanvasMidiEvent::on_channel_change(uint8_t channel)
{
diff --git a/gtk2_ardour/canvas-midi-event.h b/gtk2_ardour/canvas-midi-event.h
index 5c5f3ef520..acb49b8984 100644
--- a/gtk2_ardour/canvas-midi-event.h
+++ b/gtk2_ardour/canvas-midi-event.h
@@ -44,7 +44,7 @@ namespace Canvas {
*
* A newer, better canvas should remove the need for all the ugly here.
*/
-class CanvasMidiEvent {
+class CanvasMidiEvent : public sigc::trackable {
public:
CanvasMidiEvent(
MidiRegionView& region,
@@ -64,9 +64,10 @@ public:
void hide_velocity();
/**
- * This slot is called, when a new channel is selected for the event
+ * This slot is called, when a new channel is selected for the single event
* */
void on_channel_change(uint8_t channel);
+ void on_channel_selection_change(uint16_t selection);
void show_channel_selector();
diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h
index c152ebbc38..5a29309e67 100644
--- a/gtk2_ardour/canvas_vars.h
+++ b/gtk2_ardour/canvas_vars.h
@@ -59,9 +59,11 @@ CANVAS_VARIABLE(canvasvar_MidiFrameBase, "midi frame base")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMax, "midi note fill max")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMid, "midi note fill mid")
CANVAS_VARIABLE(canvasvar_MidiNoteFillMin, "midi note fill min")
+CANVAS_VARIABLE(canvasvar_MidiNoteFillInactiveChannel, "midi note fill inactive channel")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMax, "midi note outline max")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMid, "midi note outline mid")
CANVAS_VARIABLE(canvasvar_MidiNoteOutlineMin, "midi note outline min")
+CANVAS_VARIABLE(canvasvar_MidiNoteOutlineInactiveChannel, "midi note outline inactive channel")
CANVAS_VARIABLE(canvasvar_MidiNoteSelectedOutline, "midi note selected outline")
CANVAS_VARIABLE(canvasvar_MidiSelectRectFill, "midi select rect fill")
CANVAS_VARIABLE(canvasvar_MidiSelectRectOutline, "midi select rect outline")
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index 446f275618..6fa98e0b96 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -60,6 +60,7 @@ using namespace ArdourCanvas;
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, Gdk::Color& basic_color)
: RegionView (parent, tv, r, spu, basic_color)
+ , last_channel_selection(0xFFFF)
, _default_note_length(0.0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
@@ -75,12 +76,14 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, Gdk::Color& basic_color, TimeAxisViewItem::Visibility visibility)
: RegionView (parent, tv, r, spu, basic_color, visibility)
+ , last_channel_selection(0xFFFF)
, _default_note_length(0.0)
, _active_notes(0)
, _note_group(new ArdourCanvas::Group(*parent))
, _delta_command(NULL)
, _mouse_state(None)
, _pressed_button(0)
+
{
_note_group->raise_to_top();
}
@@ -128,6 +131,8 @@ MidiRegionView::init (Gdk::Color& basic_color, bool wfd)
group->signal_event().connect (mem_fun (this, &MidiRegionView::canvas_event), false);
+ midi_view()->signal_channel_selection_changed().connect(
+ mem_fun(this, &MidiRegionView::midi_channel_selection_changed));
}
bool
@@ -721,9 +726,6 @@ MidiRegionView::add_note(const boost::shared_ptr note)
ev_rect->property_x2() = trackview.editor.frame_to_pixel(_region->length());
ev_rect->property_y2() = y1 + floor(midi_stream_view()->note_height());
- ev_rect->property_fill_color_rgba() = note_fill_color(note->velocity());
- ev_rect->property_outline_color_rgba() = note_outline_color(note->velocity());
-
if (note->duration() == 0) {
_active_notes[note->note()] = ev_rect;
/* outline all but right edge */
@@ -756,8 +758,6 @@ MidiRegionView::add_note(const boost::shared_ptr note)
CanvasHit* ev_diamond = new CanvasHit(*this, *group, diamond_size, note);
ev_diamond->move(x, y);
ev_diamond->show();
- ev_diamond->property_fill_color_rgba() = note_fill_color(note->velocity());
- ev_diamond->property_outline_color_rgba() = note_outline_color(note->velocity());
_events.push_back(ev_diamond);
event = ev_diamond;
} else {
@@ -768,6 +768,7 @@ MidiRegionView::add_note(const boost::shared_ptr note)
if(_marked_for_selection.find(event->note()) != _marked_for_selection.end()) {
note_selected(event, true);
}
+ event->on_channel_selection_change(last_channel_selection);
}
}
@@ -1231,3 +1232,14 @@ MidiRegionView::set_frame_color()
}
}
}
+
+void
+MidiRegionView::midi_channel_selection_changed(uint16_t selection)
+{
+ for(std::vector::iterator i = _events.begin();
+ i != _events.end();
+ ++i) {
+ (*i)->on_channel_selection_change(selection);
+ }
+ last_channel_selection = selection;
+}
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 6c390db0b9..fdc37380f6 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -237,6 +237,9 @@ class MidiRegionView : public RegionView
bool canvas_event(GdkEvent* ev);
bool note_canvas_event(GdkEvent* ev);
+
+ uint16_t last_channel_selection;
+ void midi_channel_selection_changed(uint16_t selection);
void clear_selection_except(ArdourCanvas::CanvasMidiEvent* ev);
void clear_selection() { clear_selection_except(NULL); }
diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc
index 3ad66f4b9f..a199d2e676 100644
--- a/gtk2_ardour/midi_time_axis.cc
+++ b/gtk2_ardour/midi_time_axis.cc
@@ -91,7 +91,7 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar
, _note_mode_item(NULL)
, _percussion_mode_item(NULL)
, _midi_expander("MIDI")
- , _channel_selector(0)
+ , _channel_selector(0xFFFF)
{
subplugin_menu.set_name ("ArdourContextMenu");
@@ -137,15 +137,14 @@ MidiTimeAxisView::MidiTimeAxisView (PublicEditor& ed, Session& sess, boost::shar
_view->attach ();
}
- // add channel selector
- _channel_selector = manage(new MidiMultipleChannelSelector(0xFFFF));
+ // add channel selector expander
HBox *channel_selector_box = manage(new HBox());
- channel_selector_box->pack_start(*_channel_selector, SHRINK, 0);
+ channel_selector_box->pack_start(_channel_selector, SHRINK, 0);
_midi_expander.add(*channel_selector_box);
_midi_expander.property_expanded().signal_changed().connect(
mem_fun(this, &MidiTimeAxisView::channel_selector_toggled));
controls_vbox.pack_end(_midi_expander, SHRINK, 0);
- _channel_selector->selection_changed.connect(
+ _channel_selector.selection_changed.connect(
mem_fun(*midi_track()->midi_diskstream(), &MidiDiskstream::set_channel_mask));
}
@@ -389,7 +388,6 @@ void
MidiTimeAxisView::channel_selector_toggled()
{
static TimeAxisView::TrackHeight previous_height;
- assert(_channel_selector);
if(_midi_expander.property_expanded()) {
previous_height = height_style;
@@ -401,3 +399,5 @@ MidiTimeAxisView::channel_selector_toggled()
}
}
+
+
diff --git a/gtk2_ardour/midi_time_axis.h b/gtk2_ardour/midi_time_axis.h
index fd9fea3968..0702fb65f9 100644
--- a/gtk2_ardour/midi_time_axis.h
+++ b/gtk2_ardour/midi_time_axis.h
@@ -73,6 +73,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
ARDOUR::NoteMode note_mode() const { return _note_mode; }
void update_range();
+
+ sigc::signal& signal_channel_selection_changed() { return _channel_selector.selection_changed; }
private:
@@ -89,15 +91,15 @@ class MidiTimeAxisView : public RouteTimeAxisView
void channel_selector_toggled();
- Gtk::Menu _subplugin_menu;
+ Gtk::Menu _subplugin_menu;
- MidiScroomer* _range_scroomer;
- PianoRollHeader* _piano_roll_header;
- ARDOUR::NoteMode _note_mode;
- Gtk::RadioMenuItem* _note_mode_item;
- Gtk::RadioMenuItem* _percussion_mode_item;
+ MidiScroomer* _range_scroomer;
+ PianoRollHeader* _piano_roll_header;
+ ARDOUR::NoteMode _note_mode;
+ Gtk::RadioMenuItem* _note_mode_item;
+ Gtk::RadioMenuItem* _percussion_mode_item;
Gtk::Expander _midi_expander;
- MidiMultipleChannelSelector* _channel_selector;
+ MidiMultipleChannelSelector _channel_selector;
};
#endif /* __ardour_midi_time_axis_h__ */