View Issue Details

IDProjectCategoryView StatusLast Update
0009720ardourfeaturespublic2024-08-01 04:38
Reportermpk Assigned Topaul  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
PlatformGNUOSLinuxOS Version(any)
Product Version8.6 
Summary0009720: Add actions for region_lock and region_unlock
DescriptionDefinitive actions are particularly useful when dealing with selections of multiple regions. In this case, toggling the locked status is less useful.

For example, when editing one might lock a selection of regions so that they are unaffected by ripple actions earlier in the timeline. In a large selection, it might not be noticed that one region was already locked - toggle-region-lock will thus unlock it resulting in pain and frustration.

See attached patch.
TagsNo tags attached.

Activities

mpk

2024-06-05 14:44

reporter  

region-lock.patch (3,279 bytes)   
diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h
index 52e2b22bb8..bbf24a82a4 100644
--- a/gtk2_ardour/editor.h
+++ b/gtk2_ardour/editor.h
@@ -1336,6 +1336,8 @@ private:
 	/* EDITING OPERATIONS */
 
 	void reset_point_selection ();
+	void region_lock ();
+	void region_unlock ();
 	void toggle_region_lock ();
 	void toggle_opaque_region ();
 	void toggle_record_enable ();
diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc
index 5bdd8105cd..16ad1ab137 100644
--- a/gtk2_ardour/editor_actions.cc
+++ b/gtk2_ardour/editor_actions.cc
@@ -1871,8 +1871,12 @@ Editor::register_region_actions ()
 	/* Move selected regions to their original (`natural') position */
 	register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "naturalize-region", _("Move to Original Position"), sigc::mem_fun (*this, &Editor::naturalize_region));
 
+	/* Change `locked' status of selected regions */
+	register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::region_lock));
+	register_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "region-unlock", _("Unlock"), sigc::mem_fun(*this, &Editor::region_unlock));
+
 	/* Toggle `locked' status of selected regions */
-	register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-lock", _("Lock"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
+	register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-lock", _("Lock (toggle)"), sigc::mem_fun(*this, &Editor::toggle_region_lock));
 	register_toggle_region_action (_region_actions, RegionActionTarget (SelectedRegions|EnteredRegions), "toggle-region-video-lock", _("Lock to Video"), sigc::mem_fun(*this, &Editor::toggle_region_video_lock));
 
 	/* Remove sync points from selected regions */
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index a00cd24aff..b5a228c276 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -6731,6 +6731,54 @@ Editor::toggle_gain_envelope_active ()
 	}
 }
 
+void
+Editor::region_lock ()
+{
+	if (_ignore_region_action) {
+		return;
+	}
+
+	RegionSelection rs = get_regions_from_selection_and_entered ();
+
+	if (!_session || rs.empty()) {
+		return;
+	}
+
+	begin_reversible_command (_("region lock"));
+
+	for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
+		(*i)->region()->clear_changes ();
+		(*i)->region()->set_locked (true);
+		_session->add_command (new StatefulDiffCommand ((*i)->region()));
+	}
+
+	commit_reversible_command ();
+}
+
+void
+Editor::region_unlock ()
+{
+	if (_ignore_region_action) {
+		return;
+	}
+
+	RegionSelection rs = get_regions_from_selection_and_entered ();
+
+	if (!_session || rs.empty()) {
+		return;
+	}
+
+	begin_reversible_command (_("region unlock"));
+
+	for (RegionSelection::iterator i = rs.begin(); i != rs.end(); ++i) {
+		(*i)->region()->clear_changes ();
+		(*i)->region()->set_locked (false);
+		_session->add_command (new StatefulDiffCommand ((*i)->region()));
+	}
+
+	commit_reversible_command ();
+}
+
 void
 Editor::toggle_region_lock ()
 {
region-lock.patch (3,279 bytes)   

paul

2024-08-01 04:38

administrator   ~0028884

patch applied, with thanks. Good idea!

Issue History

Date Modified Username Field Change
2024-06-05 14:44 mpk New Issue
2024-06-05 14:44 mpk File Added: region-lock.patch
2024-08-01 04:38 paul Assigned To => paul
2024-08-01 04:38 paul Status new => resolved
2024-08-01 04:38 paul Resolution open => fixed
2024-08-01 04:38 paul Note Added: 0028884