fix inheritance design error in MidiRegionView/MidiView

trim_front_(starting|ending) must be in a class derived from RegionView,
which MidiView is not.

This ensures that Carl's original design for this (with these two methods
called at the start and end of a front-trim drag) is still operational, and we
do not end up with MIDI regions that have a negative start value.
This commit is contained in:
Paul Davis
2025-04-08 15:48:50 -06:00
parent 0c924c3933
commit 1f4ddcd53f
4 changed files with 25 additions and 24 deletions

View File

@@ -718,3 +718,25 @@ MidiRegionView::hide_region_editor ()
delete _editor;
_editor = nullptr;
}
void
MidiRegionView::trim_front_starting ()
{
/* We used to eparent the note group to the region view's parent, so that it didn't change.
now we update it.
*/
}
void
MidiRegionView::trim_front_ending ()
{
if (!_midi_region) {
return;
}
if (_midi_region->start().is_negative()) {
/* Trim drag made start time -ve; fix this */
midi_region()->fix_negative_start (_editing_context.history());
}
}

View File

@@ -138,6 +138,9 @@ public:
void show_region_editor ();
void hide_region_editor ();
void trim_front_starting ();
void trim_front_ending ();
protected:
void reset_width_dependent_items (double pixel_width);
void parameter_changed (std::string const & p);

View File

@@ -4785,27 +4785,6 @@ MidiView::data_recorded (std::weak_ptr<MidiSource> w)
_midi_context.record_layer_check (_midi_region, back);
}
void
MidiView::trim_front_starting ()
{
/* We used to eparent the note group to the region view's parent, so that it didn't change.
now we update it.
*/
}
void
MidiView::trim_front_ending ()
{
if (!_midi_region) {
return;
}
if (_midi_region->start().is_negative()) {
/* Trim drag made start time -ve; fix this */
midi_region()->fix_negative_start ();
}
}
void
MidiView::edit_patch_change (PatchChange* pc)
{

View File

@@ -338,9 +338,6 @@ class MidiView : public virtual sigc::trackable, public LineMerger
void set_channel_selector_scoped_note(NoteBase* note){ _channel_selection_scoped_note = note; }
NoteBase* channel_selector_scoped_note(){ return _channel_selection_scoped_note; }
void trim_front_starting ();
void trim_front_ending ();
/** Add a note to the model, and the view, at a canvas (click) coordinate.
* \param t time in samples relative to the position of the region
* \param y vertical position in pixels