13
0

use virtual methods to get MidiRegionView to do ::set_model() correctly

This commit is contained in:
Paul Davis 2024-11-04 15:47:30 -07:00
parent f17a656217
commit 61f1466f50
4 changed files with 20 additions and 32 deletions

View File

@ -170,6 +170,20 @@ MidiRegionView::init (bool /*wfd*/)
connect_to_diskstream ();
}
void
MidiRegionView::set_model (std::shared_ptr<ARDOUR::MidiModel> 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)
{
MidiView::reset_width_dependent_items (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);
}
void

View File

@ -112,6 +112,7 @@ public:
{ return midi_view()->midi_view(); }
void set_height (double);
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); }

View File

@ -251,17 +251,6 @@ MidiView::set_model (std::shared_ptr<MidiModel> 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),

View File

@ -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<ARDOUR::MidiRegion>);
void set_track (std::shared_ptr<ARDOUR::MidiTrack>);
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
virtual void set_region (std::shared_ptr<ARDOUR::MidiRegion>);
virtual void set_track (std::shared_ptr<ARDOUR::MidiTrack>);
virtual void set_model (std::shared_ptr<ARDOUR::MidiModel>);
NoteBase* add_note(const std::shared_ptr<NoteType> note, bool visible);