From 7f82b918ae08bbd34e6032aeef38877f375ead59 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 28 May 2024 20:52:35 -0600 Subject: [PATCH 1/3] add DEBUG::TrackDrag to help try to track down #9711 --- gtk2_ardour/debug.cc | 1 + gtk2_ardour/debug.h | 1 + gtk2_ardour/editor.cc | 2 ++ 3 files changed, 4 insertions(+) diff --git a/gtk2_ardour/debug.cc b/gtk2_ardour/debug.cc index f83111c1cf..5c9895ba9a 100644 --- a/gtk2_ardour/debug.cc +++ b/gtk2_ardour/debug.cc @@ -31,3 +31,4 @@ PBD::DebugBits PBD::DEBUG::Accelerators = PBD::new_debug_bit ("accelerators"); PBD::DebugBits PBD::DEBUG::GUITiming = PBD::new_debug_bit ("guitiming"); PBD::DebugBits PBD::DEBUG::EngineControl = PBD::new_debug_bit ("enginecontrol"); PBD::DebugBits PBD::DEBUG::GuiStartup = PBD::new_debug_bit ("guistartup"); +PBD::DebugBits PBD::DEBUG::TrackDrag = PBD::new_debug_bit ("trackdrag"); diff --git a/gtk2_ardour/debug.h b/gtk2_ardour/debug.h index 14c0a60773..127b9dce3b 100644 --- a/gtk2_ardour/debug.h +++ b/gtk2_ardour/debug.h @@ -32,6 +32,7 @@ namespace PBD { extern DebugBits GUITiming; extern DebugBits EngineControl; extern DebugBits GuiStartup; + extern DebugBits TrackDrag; } } diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index c4a714d5b0..d173f5153f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -7033,6 +7033,7 @@ void Editor::start_track_drag (TimeAxisView& tav, int y, Gtk::Widget& w) { track_drag = new TrackDrag (dynamic_cast (&tav)); + DEBUG_TRACE (DEBUG::TrackDrag, string_compose ("start track drag with %1\n", track_drag)); track_drag->drag_cursor = _cursors->move->gobj(); track_drag->predrag_cursor = gdk_window_get_cursor (edit_controls_vbox.get_window()->gobj()); @@ -7097,6 +7098,7 @@ Editor::end_track_drag () 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; } From 1f35010713eee53c2ed02e08a40f2396246de114 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 28 May 2024 22:07:13 -0600 Subject: [PATCH 2/3] extend libardour API to include possible flags when searching for prev/next mark --- libs/ardour/ardour/location.h | 11 +++++++++-- libs/ardour/location.cc | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index 600cb6d222..2f9bf841e9 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -301,8 +301,15 @@ public: void set_clock_origin (Location*, void *src); - timepos_t first_mark_before (timepos_t const &, bool include_special_ranges = false); - timepos_t first_mark_after (timepos_t const &, bool include_special_ranges = false); + timepos_t first_mark_before_flagged (timepos_t const &, bool include_special_ranges = false, Location::Flags whitelist = Location::Flags (0), Location::Flags blacklist = Location::Flags (0), Location::Flags equalist = Location::Flags (0)); + timepos_t first_mark_after_flagged (timepos_t const &, bool include_special_ranges = false, Location::Flags whitelist = Location::Flags (0), Location::Flags blacklist = Location::Flags (0), Location::Flags equalist = Location::Flags (0)); + + timepos_t first_mark_after (timepos_t const & t, bool include_special_ranges = false) { + return first_mark_after_flagged (t, include_special_ranges); + } + timepos_t first_mark_before (timepos_t const & t, bool include_special_ranges = false) { + return first_mark_before_flagged (t, include_special_ranges); + } Location* next_section (Location*, timepos_t&, timepos_t&) const; Location* next_section_iter (Location*, timepos_t&, timepos_t&, std::vector& cache) const; diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 4d9d86310d..c7ce3cec6b 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -1417,7 +1417,7 @@ struct LocationStartLaterComparison }; timepos_t -Locations::first_mark_before (timepos_t const & pos, bool include_special_ranges) +Locations::first_mark_before_flagged (timepos_t const & pos, bool include_special_ranges, Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist) { vector locs; { @@ -1443,6 +1443,21 @@ Locations::first_mark_before (timepos_t const & pos, bool include_special_ranges if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) { continue; } + if (whitelist != Location::Flags (0)) { + if (!((*i).second->flags() & whitelist)) { + continue; + } + } + if (blacklist != Location::Flags (0)) { + if ((*i).second->flags() & blacklist) { + continue; + } + } + if (equalist != Location::Flags (0)) { + if (!((*i).second->flags() == equalist)) { + continue; + } + } if ((*i).first < pos) { return (*i).first; } @@ -1490,7 +1505,7 @@ Locations::mark_at (timepos_t const & pos, timecnt_t const & slop) const } timepos_t -Locations::first_mark_after (timepos_t const & pos, bool include_special_ranges) +Locations::first_mark_after_flagged (timepos_t const & pos, bool include_special_ranges, Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist) { vector locs; @@ -1517,6 +1532,21 @@ Locations::first_mark_after (timepos_t const & pos, bool include_special_ranges) if (!include_special_ranges && ((*i).second->is_auto_loop() || (*i).second->is_auto_punch())) { continue; } + if (whitelist != Location::Flags (0)) { + if (!((*i).second->flags() & whitelist)) { + continue; + } + } + if (blacklist != Location::Flags (0)) { + if ((*i).second->flags() & blacklist) { + continue; + } + } + if (equalist != Location::Flags (0)) { + if (!((*i).second->flags() == equalist)) { + continue; + } + } if ((*i).first > pos) { return (*i).first; } From 2d8c6413147d976df6df1ecc1fc12cd2d941b854 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 28 May 2024 22:07:35 -0600 Subject: [PATCH 3/3] provide new actions to jump to prev/next location marker (no other markers) --- gtk2_ardour/ardour_ui_ed.cc | 8 ++++++++ gtk2_ardour/editor.h | 4 ++-- gtk2_ardour/editor_ops.cc | 8 ++++---- gtk2_ardour/public_editor.h | 10 ++++++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index dabbc6f14c..910decc2db 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -583,6 +583,14 @@ ARDOUR_UI::install_dependent_actions () act = ActionManager::register_action (common_actions, "jump-forward-to-mark", _("Jump to Next Mark"), sigc::mem_fun(*editor, &PublicEditor::jump_forward_to_mark)); ActionManager::session_sensitive_actions.push_back (act); + act = ActionManager::register_action (common_actions, "jump-backward-to-location-mark", _("Jump to Previous Location Mark"), + sigc::bind (sigc::mem_fun(*editor, &PublicEditor::jump_backward_to_mark_flagged), Location::Flags (0), Location::Flags (0), Location::IsMark)); + ActionManager::session_sensitive_actions.push_back (act); + + act = ActionManager::register_action (common_actions, "jump-forward-to-location-mark", _("Jump to Next Location Mark"), + sigc::bind (sigc::mem_fun(*editor, &PublicEditor::jump_forward_to_mark_flagged), Location::Flags (0), Location::Flags (0), Location::IsMark)); + ActionManager::session_sensitive_actions.push_back (act); + for (int i = 1; i <= 9; ++i) { string const a = string_compose(X_("goto-mark-%1"), i); string const n = string_compose(_("Locate to Mark %1"), i); diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index ef861d80ee..30b1c62270 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -740,8 +740,8 @@ private: void update_selection_markers (); void update_section_box (); - void jump_forward_to_mark (); - void jump_backward_to_mark (); + void jump_forward_to_mark_flagged (ARDOUR::Location::Flags, ARDOUR::Location::Flags, ARDOUR::Location::Flags); + void jump_backward_to_mark_flagged (ARDOUR::Location::Flags, ARDOUR::Location::Flags, ARDOUR::Location::Flags); struct LocationMarkers { ArdourMarker* start; diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index e8cc160e31..e915256fa4 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2563,13 +2563,13 @@ Editor::add_location_from_region () /* MARKS */ void -Editor::jump_forward_to_mark () +Editor::jump_forward_to_mark_flagged (Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist) { if (!_session) { return; } - timepos_t pos = _session->locations()->first_mark_after (timepos_t (_session->transport_sample()+1)); + timepos_t pos = _session->locations()->first_mark_after_flagged (timepos_t (_session->transport_sample()+1), true, whitelist, blacklist, equalist); if (pos == timepos_t::max (Temporal::AudioTime)) { return; @@ -2579,13 +2579,13 @@ Editor::jump_forward_to_mark () } void -Editor::jump_backward_to_mark () +Editor::jump_backward_to_mark_flagged (Location::Flags whitelist, Location::Flags blacklist, Location::Flags equalist) { if (!_session) { return; } - timepos_t pos = _session->locations()->first_mark_before (timepos_t (_playhead_cursor->current_sample())); + timepos_t pos = _session->locations()->first_mark_before_flagged (timepos_t (_playhead_cursor->current_sample()), true, whitelist, blacklist, equalist); //handle the case where we are rolling, and we're less than one-half second past the mark, we want to go to the prior mark... if (_session->transport_rolling()) { diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index c4c2c3d1f5..54ec0573aa 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -266,8 +266,14 @@ public: virtual void set_loop_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0; virtual void set_punch_range (Temporal::timepos_t const & start, Temporal::timepos_t const & end, std::string cmd) = 0; - virtual void jump_forward_to_mark () = 0; - virtual void jump_backward_to_mark () = 0; + void jump_forward_to_mark () { + jump_forward_to_mark_flagged (ARDOUR::Location::Flags (0), ARDOUR::Location::Flags (0), ARDOUR::Location::Flags (0)); + } + void jump_backward_to_mark () { + jump_backward_to_mark_flagged (ARDOUR::Location::Flags (0), ARDOUR::Location::Flags (0), ARDOUR::Location::Flags (0)); + } + virtual void jump_forward_to_mark_flagged (ARDOUR::Location::Flags whitelist, ARDOUR::Location::Flags blacklist, ARDOUR::Location::Flags equalist) = 0; + virtual void jump_backward_to_mark_flagged (ARDOUR::Location::Flags whitelist, ARDOUR::Location::Flags blacklist, ARDOUR::Location::Flags equalist) = 0; virtual void set_session_start_from_playhead () = 0; virtual void set_session_end_from_playhead () = 0;