diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index a8292a5c40..c44c127e08 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -615,6 +615,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/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 b4605b3dd6..a6ca1f768f 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -7259,6 +7259,8 @@ Editor::start_track_drag (TimeAxisView& tav, int y, Gtk::Widget& w) } track_drag = new TrackDrag (dynamic_cast (&tav), *_session); + 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()); @@ -7323,17 +7325,9 @@ Editor::end_track_drag () gdk_window_set_cursor (edit_controls_vbox.get_toplevel()->get_window()->gobj(), track_drag->predrag_cursor); } - bool did_move = !track_drag->first_move; - - delete track_drag; - track_drag = nullptr; - - /* the suspender was deleted with track_drag, now catch up on any track - numbering and side effects - */ - if (did_move) { - _session->update_track_numbers (); - } + DEBUG_TRACE (DEBUG::TrackDrag, string_compose ("ending track drag with %1\n", track_drag)); + delete track_drag; + track_drag = nullptr; } bool diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 902f906ee8..4731db52da 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -746,8 +746,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 f02e4f4fda..ac1e66d721 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2569,13 +2569,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; @@ -2585,13 +2585,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 23ae43c0f4..9c08386e3f 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -268,8 +268,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; 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; }