View Issue Details

IDProjectCategoryView StatusLast Update
0002481ardourbugspublic2011-08-16 11:12
Reportercolinf Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product VersionSVN/2.0-ongoing 
Summary0002481: "Selected Regions" | "Add Range Markers" only adds range markers for one region
DescriptionTo reproduce:

 - select more than one region
 - choose "Add Range Markers" from the "Selected Regions" context sub-menu
 - a new range marker is created, but it only spans one of the selected regions

I suppose it's debatable what should actually happen: should a single range marker spanning all the selected regions be created, or should a range marker be created for each region?
TagsNo tags attached.

Activities

cth103

2008-12-02 01:14

administrator   ~0005415

Confirmed. The attached patch should fix this. I went for separate markers being created for each region.

2008-12-02 01:15

 

2481-add-range-markers.patch (1,442 bytes)   
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 51cb8b6..9b19e65 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2002,15 +2002,22 @@ Editor::add_location_from_audio_region ()
 		return;
 	}
 
-	RegionView* rv = *(rs.begin());
-	boost::shared_ptr<Region> region = rv->region();
+	session->begin_reversible_command (rs.size () > 1 ? _("add markers") : _("add marker"));
+	XMLNode &before = session->locations()->get_state();
 	
-	Location *location = new Location (region->position(), region->last_frame(), region->name(), Location::IsRangeMarker);
-	session->begin_reversible_command (_("add marker"));
-        XMLNode &before = session->locations()->get_state();
-	session->locations()->add (location, true);
-        XMLNode &after = session->locations()->get_state();
-	session->add_command(new MementoCommand<Locations>(*(session->locations()), &before, &after));
+	for (RegionSelection::iterator i = rs.begin (); i != rs.end (); ++i) {
+		
+		boost::shared_ptr<Region> region = (*i)->region ();
+	
+		Location *location = new Location (
+			region->position(), region->last_frame(), region->name(), Location::IsRangeMarker
+			);
+		
+		session->locations()->add (location, true);
+	}
+
+	XMLNode &after = session->locations()->get_state();
+	session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
 	session->commit_reversible_command ();
 }
 
2481-add-range-markers.patch (1,442 bytes)   

colinf

2008-12-02 11:31

updater   ~0005422

Yes, I was about to post a pretty-much identical patch for the 'separate markers for each region' case.

I've also made a patch for the 'one range encompassing all selected regions' behaviour, which I'll attach in a moment. It also uses the 'name new markers' setting to choose whether to prompt for a new name for the range marker.

I'm sure there are uses for both ways of doing it: perhaps there should be two menu items?

2008-12-02 11:32

 

single-range-marker-from-selection.patch (1,100 bytes)   
Index: gtk2_ardour/editor_ops.cc
===================================================================
--- gtk2_ardour/editor_ops.cc	(revision 4277)
+++ gtk2_ardour/editor_ops.cc	(working copy)
@@ -2002,10 +2002,22 @@
 		return;
 	}
 
-	RegionView* rv = *(rs.begin());
-	boost::shared_ptr<Region> region = rv->region();
-	
-	Location *location = new Location (region->position(), region->last_frame(), region->name(), Location::IsRangeMarker);
+	string markername;
+
+	if (rs.size() > 1) {		// more than one region selected
+		session->locations()->next_available_name(markername, "selection");
+	} else {
+		RegionView* rv = *(rs.begin());
+		boost::shared_ptr<Region> region = rv->region();
+		markername = region->name();
+	}
+		
+	if (!choose_new_marker_name(markername)) {
+		return;
+	}
+
+	// single range spanning all selected 
+	Location *location = new Location (rs.start(), rs.end_frame(), markername, Location::IsRangeMarker);
 	session->begin_reversible_command (_("add marker"));
         XMLNode &before = session->locations()->get_state();
 	session->locations()->add (location, true);

paul

2008-12-05 10:32

administrator   ~0005497

two actions now exist, covering both use cases. actions added to Region top level menu and region context menu. thanks for your inputs & ideas. rev4291.

Issue History

Date Modified Username Field Change
2008-12-01 18:57 colinf New Issue
2008-12-02 01:14 cth103 Note Added: 0005415
2008-12-02 01:14 cth103 Assigned To => paul
2008-12-02 01:14 cth103 Status new => confirmed
2008-12-02 01:15 cth103 File Added: 2481-add-range-markers.patch
2008-12-02 11:31 colinf Note Added: 0005422
2008-12-02 11:32 colinf File Added: single-range-marker-from-selection.patch
2008-12-05 10:32 paul cost => 0.00
2008-12-05 10:32 paul Status confirmed => resolved
2008-12-05 10:32 paul Resolution open => fixed
2008-12-05 10:32 paul Note Added: 0005497
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:32 cth103 Category bugs2 => bugs
2011-08-16 11:12 colinf Status resolved => closed