diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 3b55375398..184d755dea 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -190,6 +190,14 @@ MidiView::init (std::shared_ptr mt) _note_group->raise_to_top(); EditingContext::DropDownKeys.connect (sigc::mem_fun (*this, &MidiView::drop_down_keys)); _midi_context.NoteRangeChanged.connect (sigc::mem_fun (*this, &MidiView::view_changed)); + _midi_context.NoteModeChanged.connect (sigc::mem_fun (*this, &MidiView::note_mode_changed)); +} + +void +MidiView::note_mode_changed () +{ + clear_events (); + model_changed (); } void @@ -1862,9 +1870,15 @@ MidiView::update_hit (Hit* ev) } std::shared_ptr note = ev->note(); - const timepos_t note_time = _midi_region->source_beats_to_absolute_time (note->time()); + double x; + + if (_midi_region && !_show_source) { + const timepos_t note_time = _midi_region->source_beats_to_absolute_time (note->time()); + x = _editing_context.time_to_pixel(note_time) - _editing_context.time_to_pixel (_midi_region->position()); + } else { + x = _editing_context.sample_to_pixel (timepos_t (note->time()).samples()); + } - const double x = _editing_context.time_to_pixel(note_time) - _editing_context.time_to_pixel (_midi_region->position()); const double diamond_size = std::max(1., floor(note_height()) - 2.); const double y = 1.5 + floor(note_to_y(note->note())) + diamond_size * .5; diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index 78126cb4bb..66c93277c0 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -633,6 +633,7 @@ class MidiView : public virtual sigc::trackable, public LineMerger void update_sysexes (); void view_changed (); void model_changed (); + void note_mode_changed (); void sync_ghost_selection (NoteBase*); diff --git a/gtk2_ardour/midi_view_background.cc b/gtk2_ardour/midi_view_background.cc index 1ab5c6517c..97d6cffb14 100644 --- a/gtk2_ardour/midi_view_background.cc +++ b/gtk2_ardour/midi_view_background.cc @@ -249,7 +249,6 @@ MidiViewBackground::apply_note_range (uint8_t lowest, uint8_t highest, bool to_c { bool changed = false; - if (_highest_note != highest) { _highest_note = highest; changed = true; @@ -323,5 +322,8 @@ MidiViewBackground::update_data_note_range (uint8_t min, uint8_t max) void MidiViewBackground::set_note_mode (ARDOUR::NoteMode nm) { - _note_mode = nm; + if (_note_mode != nm) { + _note_mode = nm; + NoteModeChanged(); /* EMIT SIGNAL */ + } } diff --git a/gtk2_ardour/midi_view_background.h b/gtk2_ardour/midi_view_background.h index 5811c8fcca..6629fd3a9a 100644 --- a/gtk2_ardour/midi_view_background.h +++ b/gtk2_ardour/midi_view_background.h @@ -61,6 +61,7 @@ class MidiViewBackground : public virtual ViewBackground ARDOUR::NoteMode note_mode() const { return _note_mode; } void set_note_mode (ARDOUR::NoteMode nm); + sigc::signal NoteModeChanged; ARDOUR::ColorMode color_mode() const { return _color_mode; } void set_color_mode (ARDOUR::ColorMode);