various fixes for cue marker creation, dragging, naming

This commit is contained in:
Paul Davis 2022-01-05 13:27:39 -07:00
parent fd2f2f46cc
commit 7c35783d63
6 changed files with 31 additions and 15 deletions

View File

@ -595,7 +595,7 @@ public:
void metric_get_minsec (std::vector<ArdourCanvas::Ruler::Mark>&, int64_t, int64_t, gint);
/* editing operations that need to be public */
void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0));
void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0), int32_t cue_id = 0);
void split_regions_at (Temporal::timepos_t const & , RegionSelection&);
void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false);
RegionSelection get_regions_from_selection_and_mouse (Temporal::timepos_t const &);

View File

@ -4836,7 +4836,15 @@ MarkerDrag::motion (GdkEvent* event, bool)
if (copy_location->is_mark()) {
/* now move it */
copy_location->set_start (copy_location->start() + f_delta, false);
if (copy_location->is_cue_marker()) {
/* cue marks should always move with snapping */
timepos_t s (copy_location->start() + f_delta);
_editor->snap_to (s, Temporal::RoundNearest, SnapToGrid_Scaled, true);
copy_location->set_start (s, false);
} else {
copy_location->set_start (copy_location->start() + f_delta, false);
}
} else {

View File

@ -722,7 +722,7 @@ Editor::LocationMarkers::setup_lines ()
}
void
Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags)
Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags, int32_t cue_id)
{
string markername;
string namebase;
@ -733,17 +733,18 @@ Editor::mouse_add_new_marker (timepos_t where, Location::Flags extra_flags)
if (_session) {
if (flags & Location::IsCueMarker) {
namebase = _("cue");
/* XXX i18n needed for cue letter names */
markername = string_compose (_("cue %1"), (char) ('A' + cue_id));
} else {
namebase = _("mark");
}
_session->locations()->next_available_name (markername, namebase);
_session->locations()->next_available_name (markername, namebase);
if (!choose_new_marker_name (markername)) {
return;
if (!choose_new_marker_name (markername)) {
return;
}
}
Location *location = new Location (*_session, where, where, markername, flags);
Location *location = new Location (*_session, where, where, markername, flags, cue_id);
begin_reversible_command (_("add marker"));
XMLNode &before = _session->locations()->get_state();

View File

@ -1641,7 +1641,6 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case RangeMarkerBarItem:
case TransportMarkerBarItem:
case CdMarkerBarItem:
case CueMarkerBarItem:
case TempoBarItem:
case TempoCurveItem:
case MeterBarItem:
@ -1653,6 +1652,12 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
popup_ruler_menu (where, item_type);
break;
case CueMarkerBarItem:
snap_to (where, Temporal::RoundNearest, SnapToGrid_Scaled, true);
std::cerr << "cue marker will be at " << where << " beats = " << where.beats() << std::endl;
popup_ruler_menu (where, item_type);
break;
case MarkerItem:
marker_context_menu (&event->button, item);
break;

View File

@ -221,7 +221,7 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
switch (t) {
case MarkerBarItem:
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags (0))));
ruler_items.push_back (MenuElem (_("New location marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::Flags (0), 0)));
ruler_items.push_back (MenuElem (_("Clear all locations"), sigc::mem_fun(*this, &Editor::clear_markers)));
ruler_items.push_back (MenuElem (_("Clear all xruns"), sigc::mem_fun(*this, &Editor::clear_xrun_markers)));
ruler_items.push_back (MenuElem (_("Unhide locations"), sigc::mem_fun(*this, &Editor::unhide_markers)));
@ -240,12 +240,14 @@ Editor::popup_ruler_menu (timepos_t const & where, ItemType t)
case CdMarkerBarItem:
// TODO
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCDMarker)));
ruler_items.push_back (MenuElem (_("New CD track marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCDMarker, 0)));
break;
case CueMarkerBarItem:
// TODO
ruler_items.push_back (MenuElem (_("New Cue marker"), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker)));
for (int32_t n = 0; n < TriggerBox::default_triggers_per_box; ++n) {
/* XXX the "letter" names of the cues need to be subject to i18n somehow */
ruler_items.push_back (MenuElem (string_compose (_("Cue %1"), (char) ('A' + n)), sigc::bind (sigc::mem_fun(*this, &Editor::mouse_add_new_marker), where, Location::IsCueMarker, n)));
}
break;
case TempoBarItem:

View File

@ -374,7 +374,7 @@ public:
virtual void toggle_meter_updating() = 0;
virtual void split_regions_at (Temporal::timepos_t const &, RegionSelection&) = 0;
virtual void split_region_at_points (boost::shared_ptr<ARDOUR::Region>, ARDOUR::AnalysisFeatureList&, bool can_ferret, bool select_new = false) = 0;
virtual void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0)) = 0;
virtual void mouse_add_new_marker (Temporal::timepos_t where, ARDOUR::Location::Flags extra_flags = ARDOUR::Location::Flags (0), int32_t cue_id = 0) = 0;
virtual void foreach_time_axis_view (sigc::slot<void,TimeAxisView&>) = 0;
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
virtual Temporal::timecnt_t get_nudge_distance (Temporal::timepos_t const & pos, Temporal::timecnt_t& next) = 0;