summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2011-11-24 22:16:03 +0000
committerCarl Hetherington <carl@carlh.net>2011-11-24 22:16:03 +0000
commit0f2efef73e1b7b5649e33c462361a33ffeb3599c (patch)
tree17c72dfbddacdaa2d19dd7a1db302df25961ff53 /gtk2_ardour
parente5dd712ac42c8a8a7367cd6e0b06c530ca990c75 (diff)
Fix confusion with midi note selection and channel
selection (#4208). git-svn-id: svn://localhost/ardour2/branches/3.0@10823 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/canvas-note-event.cc33
-rw-r--r--gtk2_ardour/canvas-note-event.h1
2 files changed, 22 insertions, 12 deletions
diff --git a/gtk2_ardour/canvas-note-event.cc b/gtk2_ardour/canvas-note-event.cc
index 8f5a9f5807..75f9ed0d06 100644
--- a/gtk2_ardour/canvas-note-event.cc
+++ b/gtk2_ardour/canvas-note-event.cc
@@ -55,6 +55,7 @@ CanvasNoteEvent::CanvasNoteEvent(MidiRegionView& region, Item* item, const boost
, _valid (true)
, _mouse_x_fraction (-1.0)
, _mouse_y_fraction (-1.0)
+ , _channel_selection (0xffff)
{
}
@@ -113,14 +114,11 @@ CanvasNoteEvent::hide_velocity()
void
CanvasNoteEvent::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_MidiNoteInactiveChannel.get());
- set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
- } else {
- // set the color according to the notes selection state
- set_selected(_selected);
- }
+ _channel_selection = selection;
+
+ /* this takes into account whether or not the note should be drawn as inactive */
+ set_selected (_selected);
+
// this forces the item to update..... maybe slow...
_item->hide();
_item->show();
@@ -187,20 +185,31 @@ CanvasNoteEvent::set_selected(bool selected)
}
_selected = selected;
- set_fill_color (base_color ());
- if (_selected) {
+ bool const active = (_channel_selection & (1 << _note->channel())) != 0;
+
+ if (_selected && active) {
set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteSelected.get()));
if(_region.channel_selector_scoped_note() != 0){
_region.channel_selector_scoped_note()->hide_channel_selector();
_region.set_channel_selector_scoped_note(0);
}
+
+ set_fill_color (base_color ());
+
} else {
- set_outline_color(calculate_outline(base_color()));
+
+ if (active) {
+ set_fill_color(base_color());
+ set_outline_color(calculate_outline(base_color()));
+ } else {
+ set_fill_color(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get());
+ set_outline_color(calculate_outline(ARDOUR_UI::config()->canvasvar_MidiNoteInactiveChannel.get()));
+ }
+
hide_channel_selector();
}
-
}
#define SCALE_USHORT_TO_UINT8_T(x) ((x) / 257)
diff --git a/gtk2_ardour/canvas-note-event.h b/gtk2_ardour/canvas-note-event.h
index 69b3e49076..876c1159f5 100644
--- a/gtk2_ardour/canvas-note-event.h
+++ b/gtk2_ardour/canvas-note-event.h
@@ -159,6 +159,7 @@ class CanvasNoteEvent : virtual public sigc::trackable
bool _valid;
float _mouse_x_fraction;
float _mouse_y_fraction;
+ uint16_t _channel_selection;
void set_mouse_fractions (GdkEvent*);
};