ripple (gui part): should_ripple_all() encapsulates modes Ripple+RippleAll

This commit is contained in:
Ben Loftis 2022-03-14 19:14:43 -05:00
parent 3a6210696d
commit 01ef5a5b24
4 changed files with 39 additions and 18 deletions

View File

@ -608,6 +608,7 @@ public:
void edit_meter_section (Temporal::MeterPoint&);
bool should_ripple () const;
bool should_ripple_all () const; /* RippleAll will ripple all similar regions and the timeline markers */
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, ARDOUR::RegionList* exclude, bool add_to_command);
void do_ripple (boost::shared_ptr<ARDOUR::Playlist>, Temporal::timepos_t const &, Temporal::timecnt_t const &, boost::shared_ptr<ARDOUR::Region> exclude, bool add_to_command);
void ripple_marks (boost::shared_ptr<ARDOUR::Playlist> target_playlist, Temporal::timepos_t at, Temporal::timecnt_t const & distance);

View File

@ -1823,7 +1823,7 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const changed_t
/* Ripple marks & ranges if appropriate */
if (Config->get_edit_mode() == RippleAll) {
if (_editor->should_ripple_all()) {
_editor->ripple_marks (_primary->region()->playlist(), extent_min, extent_min.distance (extent_max));
}
@ -2042,7 +2042,7 @@ RegionMoveDrag::finished_no_copy (
(*p)->thaw();
}
if (Config->get_edit_mode() == RippleAll) {
if (_editor->should_ripple_all()) {
_editor->ripple_marks (_primary->region()->playlist(), extent_min, -drag_delta);
}
@ -5704,7 +5704,7 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
}
if (first_move) {
if (Config->get_edit_mode() == RippleAll && !Config->get_interview_editing()) {
if (_editor->should_ripple_all()) {
_editor->selection->set (_editor->get_track_views());
}
_track_selection_at_start = _editor->selection->tracks;
@ -5771,7 +5771,9 @@ SelectionDrag::motion (GdkEvent* event, bool first_move)
ArdourCanvas::Coord const top = grab_y();
ArdourCanvas::Coord const bottom = current_pointer_y();
if ((Config->get_edit_mode() != RippleAll || Config->get_interview_editing()) && top >= 0 && bottom >= 0) {
bool RippleAll = _editor->should_ripple_all();
if (!RippleAll && top >= 0 && bottom >= 0) {
//first, find the tracks that are covered in the y range selection
for (TrackViewList::const_iterator i = all_tracks.begin(); i != all_tracks.end(); ++i) {

View File

@ -9374,8 +9374,30 @@ Editor::remove_gaps (timecnt_t const & gap_threshold, timecnt_t const & leave_ga
bool
Editor::should_ripple () const
{
return (Config->get_edit_mode() == Ripple ||
(Config->get_edit_mode() == RippleAll && (selection->tracks.size() > 1 || !Config->get_interview_editing())));
/*only ripple if edit mode is Ripple (duh) */
if (Config->get_edit_mode() != Ripple) {
return false;
}
/* RippleInterview does not ripple if only one track is selected */
if (Config->get_ripple_mode() == RippleInterview && selection->tracks.size() == 1) {
return false;
}
return true;
}
bool
Editor::should_ripple_all () const
{
/*first check if ripple is engaged at all*/
if (!should_ripple()) {
return false;
}
/*TODO: maybe if in RippleInterview and ALL tracks are selected, this means RippleAll? */
return (Config->get_ripple_mode() == RippleAll);
}
void
@ -9396,7 +9418,7 @@ Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, timepos_t const
playlists.insert (target_playlist);
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
TrackViewList ts = track_views.filter_to_unique_playlists ();
boost::shared_ptr<Playlist> pl;
@ -9455,13 +9477,9 @@ Editor::do_ripple (boost::shared_ptr<Playlist> target_playlist, timepos_t const
}
/* Ripple marks & ranges if appropriate */
if (Config->get_edit_mode() != RippleAll) {
cerr << "out here\n";
return;
if (should_ripple_all()) {
ripple_marks (target_playlist, at, distance);
}
ripple_marks (target_playlist, at, distance);
}
timepos_t

View File

@ -677,7 +677,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
* permitted button release
*/
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
get_all_equivalent_regions (clicked_regionview, all_equivalent_regions);
selection->remove (all_equivalent_regions);
} else {
@ -697,7 +697,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
if (press) {
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
get_all_equivalent_regions (clicked_regionview, all_equivalent_regions);
} else {
if (selection->selected (clicked_routeview)) {
@ -720,7 +720,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
case Selection::Set:
if (!selection->selected (clicked_regionview)) {
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
get_all_equivalent_regions (clicked_regionview, all_equivalent_regions);
} else {
get_equivalent_regions (clicked_regionview, all_equivalent_regions, ARDOUR::Properties::group_select.property_id);
@ -734,7 +734,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
else {
if (selection->regions.size() > 1) {
/* collapse region selection down to just this one region (and its equivalents) */
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
get_all_equivalent_regions (clicked_regionview, all_equivalent_regions);
} else {
get_equivalent_regions(clicked_regionview, all_equivalent_regions, ARDOUR::Properties::group_select.property_id);
@ -847,7 +847,7 @@ Editor::set_selected_regionview_from_click (bool press, Selection::Operation op)
set<RouteTimeAxisView*> relevant_tracks;
if (Config->get_edit_mode() == RippleAll) {
if (should_ripple_all()) {
for (TrackSelection::iterator i = track_views.begin(); i != track_views.end(); ++i) {
RouteTimeAxisView* r = dynamic_cast<RouteTimeAxisView*> (*i);
if (r) {