From 6e49ca61a4da8b8755d5cbf765ea06df4bc234a3 Mon Sep 17 00:00:00 2001 From: nick_m Date: Fri, 22 Jul 2016 23:21:27 +1000 Subject: [PATCH] Remove the temporary note group in MidiRegionView, update start trim during drag. --- gtk2_ardour/editor_drag.cc | 1 - gtk2_ardour/midi_region_view.cc | 27 +++++++-------------------- gtk2_ardour/midi_region_view.h | 5 ----- 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index a3b6664e57..6fa3cb099d 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2856,7 +2856,6 @@ TrimDrag::motion (GdkEvent* event, bool first_move) for (list::const_iterator i = _views.begin(); i != _views.end(); ++i) { RegionView* rv = i->view; - rv->enable_display (false); rv->region()->playlist()->clear_owned_changes (); if (_operation == StartTrim) { diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index 79933b94d6..3d67fef187 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -111,7 +111,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent, , _step_edit_cursor_width (1.0) , _step_edit_cursor_position (0.0) , _channel_selection_scoped_note (0) - , _temporary_note_group (0) , _mouse_state(None) , _pressed_button(0) , _sort_needed (true) @@ -155,7 +154,6 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent, , _step_edit_cursor_width (1.0) , _step_edit_cursor_position (0.0) , _channel_selection_scoped_note (0) - , _temporary_note_group (0) , _mouse_state(None) , _pressed_button(0) , _sort_needed (true) @@ -204,7 +202,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other) , _step_edit_cursor_width (1.0) , _step_edit_cursor_position (0.0) , _channel_selection_scoped_note (0) - , _temporary_note_group (0) , _mouse_state(None) , _pressed_button(0) , _sort_needed (true) @@ -237,7 +234,6 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptrposition() - _region->start()); } - /* catch an end trim so we can live update */ + /* catch end and start trim so we can update the view*/ if (!what_changed.contains (ARDOUR::Properties::start) && what_changed.contains (ARDOUR::Properties::length)) { enable_display (true); + } else if (what_changed.contains (ARDOUR::Properties::start) && + what_changed.contains (ARDOUR::Properties::length)) { + enable_display (true); } } @@ -1435,7 +1433,7 @@ MidiRegionView::reset_width_dependent_items (double pixel_width) if (_enable_display) { redisplay_model(); - } + } for (PatchChanges::iterator x = _patch_changes.begin(); x != _patch_changes.end(); ++x) { if ((*x)->canvas_item()->width() >= _pixel_width) { @@ -3980,29 +3978,18 @@ MidiRegionView::data_recorded (boost::weak_ptr w) void MidiRegionView::trim_front_starting () { - /* Reparent the note group to the region view's parent, so that it doesn't change - when the region view is trimmed. + /* We used to eparent the note group to the region view's parent, so that it didn't change. + now we update it. */ - _temporary_note_group = new ArdourCanvas::Container (group->parent ()); - _temporary_note_group->move (group->position ()); - _note_group->reparent (_temporary_note_group); } void MidiRegionView::trim_front_ending () { - _note_group->reparent (group); - delete _temporary_note_group; - _temporary_note_group = 0; - if (_region->start() < 0) { /* Trim drag made start time -ve; fix this */ midi_region()->fix_negative_start (); } - /* until _start is modified on the fly during front trim, - we have to redisplay the model when a start trim has finished. - */ - enable_display (true); } void diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index afe2f4a97d..ac2cd4b8d3 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -427,11 +427,6 @@ private: Evoral::Beats _step_edit_cursor_position; NoteBase* _channel_selection_scoped_note; - /** A group used to temporarily reparent _note_group to during start trims, so - * that the notes don't move with the parent region view. - */ - ArdourCanvas::Container* _temporary_note_group; - MouseState _mouse_state; int _pressed_button; -- 2.30.2