diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 95474201b6..56cf9399df 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -170,6 +170,20 @@ MidiRegionView::init (bool /*wfd*/) connect_to_diskstream (); } +void +MidiRegionView::set_model (std::shared_ptr model) +{ + MidiView::set_model (model); + + region_muted (); + region_sync_changed (); + region_resized (ARDOUR::bounds_change); + region_locked (); + + set_colors (); + reset_width_dependent_items (_pixel_width); +} + bool MidiRegionView::display_is_enabled () const { @@ -642,24 +656,8 @@ MidiRegionView::~MidiRegionView () void MidiRegionView::reset_width_dependent_items (double pixel_width) { - RegionView::reset_width_dependent_items(pixel_width); - - view_changed (); - - bool hide_all = false; - PatchChanges::iterator x = _patch_changes.begin(); - if (x != _patch_changes.end()) { - hide_all = x->second->width() >= _pixel_width; - } - - if (hide_all) { - for (; x != _patch_changes.end(); ++x) { - x->second->hide(); - } - } - - move_step_edit_cursor (_step_edit_cursor_position); - set_step_edit_cursor_width (_step_edit_cursor_width); + MidiView::reset_width_dependent_items (pixel_width); + RegionView::reset_width_dependent_items (pixel_width); } void diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 39c85d4bdf..8968e4b9b0 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -112,6 +112,7 @@ public: { return midi_view()->midi_view(); } void set_height (double); + void set_model (std::shared_ptr); inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); } diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index 31951c6e14..71eb64ceac 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -251,17 +251,6 @@ MidiView::set_model (std::shared_ptr m) //set_height (trackview.current_height()); -#warning paul pianorule needs these fixed -/* XXXX - region_muted (); - region_sync_changed (); - region_resized (ARDOUR::bounds_change); - //region_locked (); - - set_colors (); - reset_width_dependent_items (_pixel_width); -*/ - _model->ContentsChanged.connect (connections_requiring_model, invalidator (*this), std::bind (&MidiView::model_changed, this), gui_context()); _midi_track->playback_filter().ChannelModeChanged.connect (connections_requiring_model, invalidator (*this), diff --git a/gtk2_ardour/midi_view.h b/gtk2_ardour/midi_view.h index 4d22bdbfee..32355d242e 100644 --- a/gtk2_ardour/midi_view.h +++ b/gtk2_ardour/midi_view.h @@ -118,9 +118,9 @@ class MidiView : public virtual sigc::trackable, public LineMerger virtual GhostRegion* add_ghost (TimeAxisView&) { return nullptr; } virtual std::string get_modifier_name() const; - void set_region (std::shared_ptr); - void set_track (std::shared_ptr); - void set_model (std::shared_ptr); + virtual void set_region (std::shared_ptr); + virtual void set_track (std::shared_ptr); + virtual void set_model (std::shared_ptr); NoteBase* add_note(const std::shared_ptr note, bool visible);