From 2fceb661935c9562ccb553db259c3894566aa200 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 18 Aug 2024 12:51:28 -0600 Subject: [PATCH] manual fixups for errors during rebasing against master --- gtk2_ardour/cue_editor.cc | 2 +- gtk2_ardour/cue_editor.h | 2 +- gtk2_ardour/editing_context.h | 2 +- gtk2_ardour/editor.cc | 88 ----------------------------------- gtk2_ardour/editor_drag.cc | 35 +++++++------- libs/ardour/ardour/region.h | 2 + 6 files changed, 21 insertions(+), 110 deletions(-) diff --git a/gtk2_ardour/cue_editor.cc b/gtk2_ardour/cue_editor.cc index 60a8108617..fb53b6abb6 100644 --- a/gtk2_ardour/cue_editor.cc +++ b/gtk2_ardour/cue_editor.cc @@ -28,7 +28,7 @@ CueEditor::filter_to_unique_midi_region_views (RegionSelection const & ms) const } void -CueEditor::select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, Selection::Operation, bool) +CueEditor::select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, ARDOUR::SelectionOperation, bool) { } diff --git a/gtk2_ardour/cue_editor.h b/gtk2_ardour/cue_editor.h index b0510a5959..8e922a3fa6 100644 --- a/gtk2_ardour/cue_editor.h +++ b/gtk2_ardour/cue_editor.h @@ -30,7 +30,7 @@ class CueEditor : public EditingContext, public PBD::HistoryOwner, public sigc:: CueEditor (std::string const & name); ~CueEditor (); - void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, Selection::Operation, bool); + void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, ARDOUR::SelectionOperation, bool); void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const; StripableTimeAxisView* get_stripable_time_axis_by_id (const PBD::ID& id) const; diff --git a/gtk2_ardour/editing_context.h b/gtk2_ardour/editing_context.h index 3e8bf7930f..e3d8e1bc44 100644 --- a/gtk2_ardour/editing_context.h +++ b/gtk2_ardour/editing_context.h @@ -112,7 +112,7 @@ class EditingContext : public ARDOUR::SessionHandlePtr, public AxisViewProvider virtual ArdourCanvas::Duple upper_left() const { return ArdourCanvas::Duple (0, 0); } - virtual void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, Selection::Operation, bool) = 0; + virtual void select_all_within (Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, TrackViewList const &, ARDOUR::SelectionOperation, bool) = 0; virtual void get_per_region_note_selection (std::list > > > >&) const = 0; virtual void get_regionviews_by_id (PBD::ID const id, RegionSelection & regions) const = 0; virtual StripableTimeAxisView* get_stripable_time_axis_by_id (const PBD::ID& id) const = 0; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7702c10f0b..a5e3a80e47 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -6112,91 +6112,3 @@ Editor::upper_left() const return get_trackview_group ()->canvas_origin (); } -void -Editor::start_track_drag (TimeAxisView& tav, int y, Gtk::Widget& w, bool can_change_cursor) -{ - track_drag = new TrackDrag (dynamic_cast (&tav), *_session); - DEBUG_TRACE (DEBUG::TrackDrag, string_compose ("start track drag with %1\n", track_drag)); - - int xo, yo; - w.translate_coordinates (edit_controls_vbox, 0, y, xo, yo); - - if (can_change_cursor) { - track_drag->drag_cursor = _cursors->move->gobj(); - track_drag->predrag_cursor = gdk_window_get_cursor (edit_controls_vbox.get_window()->gobj()); - gdk_window_set_cursor (edit_controls_vbox.get_toplevel()->get_window()->gobj(), track_drag->drag_cursor); - track_drag->have_predrag_cursor = true; - } - - track_drag->bump_track = nullptr; - track_drag->previous = yo; - track_drag->start = yo; -} - -void -Editor::mid_track_drag (GdkEventMotion* ev, Gtk::Widget& w) -{ - int xo, yo; - w.translate_coordinates (edit_controls_vbox, ev->x, ev->y, xo, yo); - - if (track_drag->first_move) { - - /* move threshold */ - - if (abs (yo - track_drag->previous) < (int) (4 * UIConfiguration::instance().get_ui_scale())) { - return; - } - - if (!track_drag->track->selected()) { - set_selected_track (*track_drag->track, Selection::Set, false); - } - - if (!track_drag->have_predrag_cursor) { - track_drag->drag_cursor = _cursors->move->gobj(); - track_drag->predrag_cursor = gdk_window_get_cursor (edit_controls_vbox.get_window()->gobj()); - gdk_window_set_cursor (edit_controls_vbox.get_toplevel()->get_window()->gobj(), track_drag->drag_cursor); - track_drag->have_predrag_cursor = true; - } - - track_drag->first_move = false; - } - - track_drag->current = yo; - - if (track_drag->current > track_drag->previous) { - if (track_drag->direction != 1) { - track_drag->bump_track = nullptr; - track_drag->direction = 1; - } - } else if (track_drag->current < track_drag->previous) { - if (track_drag->direction != -1) { - track_drag->bump_track = nullptr; - track_drag->direction = -1; - } - } - - if (track_drag->current == track_drag->previous) { - return; - } - - redisplay_track_views (); - track_drag->previous = yo; -} - -void -Editor::end_track_drag () -{ - if (track_drag->have_predrag_cursor) { - gdk_window_set_cursor (edit_controls_vbox.get_toplevel()->get_window()->gobj(), track_drag->predrag_cursor); - } - - DEBUG_TRACE (DEBUG::TrackDrag, string_compose ("ending track drag with %1\n", track_drag)); - delete track_drag; - track_drag = nullptr; -} - -bool -Editor::track_dragging() const -{ - return (bool) track_drag; -} diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index e63d9ccf5b..2ffed22584 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4403,8 +4403,8 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) /* we toggle on the button release */ break; case SelectionSet: - if (!_editor->selection->selected (_marker)) { - _editor->selection->set (_marker); + if (!editing_context.get_selection().selected (_marker)) { + editing_context.get_selection().set (_marker); _selection_changed = true; } break; @@ -4412,7 +4412,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) Locations::LocationList ll; list to_add; timepos_t s, e; - _editing_context.get_selection().markers.range (s, e); + editing_context.get_selection().markers.range (s, e); s = min (_marker->position (), s); e = max (_marker->position (), e); s = min (s, e); @@ -4420,9 +4420,9 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) if (e < timepos_t::max (e.time_domain ())) { e = e.increment (); } - _editor->session ()->locations ()->find_all_between (s, e, ll, Location::Flags (0)); + _editor.session ()->locations ()->find_all_between (s, e, ll, Location::Flags (0)); for (Locations::LocationList::iterator i = ll.begin (); i != ll.end (); ++i) { - Editor::LocationMarkers* lm = _editor->find_location_markers (*i); + Editor::LocationMarkers* lm = _editor.find_location_markers (*i); if (lm) { if (lm->start) { to_add.push_back (lm->start); @@ -4433,7 +4433,7 @@ MarkerDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor) } } if (!to_add.empty ()) { - _editing_context.get_selection().add (to_add); + editing_context.get_selection().add (to_add); _selection_changed = true; } break; @@ -4656,15 +4656,15 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) SelectionOperation op = ArdourKeyboard::selection_type (event->button.state); switch (op) { case SelectionSet: - if (_editor->selection->selected (_marker) && _editor->selection->markers.size () > 1) { - _editing_context.selection->set (_marker); + if (editing_context.get_selection().selected (_marker) && _editor.selection->markers.size () > 1) { + editing_context.get_selection().set (_marker); _selection_changed = true; } break; case SelectionToggle: /* we toggle on the button release, click only */ - _editing_context.selection->toggle (_marker); + editing_context.get_selection().toggle (_marker); _selection_changed = true; break; @@ -5609,14 +5609,14 @@ SelectionDrag::motion (GdkEvent* event, bool first_move) if (first_move) { if (_add) { /* adding to the selection */ - _editor->set_selected_track_as_side_effect (SelectionAdd, gcd); - _editor->clicked_selection = _editing_context.get_selection().add (start, end); + _editor.set_selected_track_as_side_effect (SelectionAdd, gcd); + _editor.clicked_selection = editing_context.get_selection().add (start, end); _add = false; } else { /* new selection */ - if (_editor->clicked_axisview && !_editing_context.get_selection()selected (_editor->clicked_axisview)) { - _editor->set_selected_track_as_side_effect (SelectionSet, gcd); + if (_editor.clicked_axisview && !editing_context.get_selection().selected (_editor.clicked_axisview)) { + _editor.set_selected_track_as_side_effect (SelectionSet, gcd); } _editor.clicked_selection = editing_context.get_selection().set (start, end); @@ -6113,7 +6113,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred) switch (editing_context.current_mouse_mode()) { case MouseObject: /* find the two markers on either side and then make the selection from it */ - _editing_context.select_all_within (start, end, 0.0f, FLT_MAX, _editor->track_views, SelectionSet, false); + editing_context.select_all_within (start, end, 0.0f, FLT_MAX, _editor.track_views, SelectionSet, false); break; case MouseRange: @@ -6211,8 +6211,8 @@ NoteDrag::total_dx (GdkEvent* event) const } /* we need to use absolute positions here to honor the tempo-map */ - timepos_t const t1 = pixel_to_time (_drags->current_pointer_x ()); - timepos_t const t2 = pixel_to_time (grab_x ()); + timepos_t const t1 = pixel_duration_to_time (_drags->current_pointer_x ()); + timepos_t const t2 = pixel_duration_to_time (grab_x ()); /* now calculate proper `b@b` time */ timecnt_t dx = t2.distance (t1); @@ -6260,10 +6260,7 @@ NoteDrag::total_dy () const return 0; } - double const y = _region->midi_context().y_position (); - double const p = current_pointer_y(); - /* new current note */ uint8_t n = _region->y_to_note (current_pointer_y () - y); /* clamp */ diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 11ebc08a97..9313d84a2d 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -143,6 +143,8 @@ public: timepos_t end() const; timepos_t nt_last() const { return end().decrement(); } + virtual timecnt_t tail () const { return timecnt_t (0); } + timepos_t source_position () const; timecnt_t source_relative_position (Temporal::timepos_t const &) const; timecnt_t region_relative_position (Temporal::timepos_t const &) const;