13
0

add actions for region lock/unlock (from Mark Knoop < mark@opus11.net>

This commit is contained in:
Paul Davis 2024-07-31 22:38:38 -06:00
parent 170bc45de9
commit d4227b6ca4
3 changed files with 55 additions and 1 deletions

View File

@ -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 ();

View File

@ -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 */

View File

@ -6753,6 +6753,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 ()
{