Add missing actions from MB2 for Mike:

Set-Loop-Start/End-From-Edit-Point
Set-Punch-Start/End-From-Edit-Point
This commit is contained in:
Ben Loftis 2015-08-19 14:53:35 -05:00
parent 11f51497f3
commit 84845833c1
4 changed files with 139 additions and 2 deletions

View File

@ -1480,6 +1480,11 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
int scrub_reverse_distance;
void scrub (framepos_t, double);
void set_punch_start_from_edit_point ();
void set_punch_end_from_edit_point ();
void set_loop_start_from_edit_point ();
void set_loop_end_from_edit_point ();
void keyboard_selection_begin ();
void keyboard_selection_finish (bool add);
bool have_pending_keyboard_selection;

View File

@ -365,6 +365,12 @@ Editor::register_actions ()
reg_sens (editor_actions, "start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
reg_sens (editor_actions, "finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));
reg_sens (editor_actions, "start-punch-range", _("Start Punch Range"), sigc::mem_fun(*this, &Editor::set_punch_start_from_edit_point));
reg_sens (editor_actions, "finish-punch-range", _("Finish Punch Range"), sigc::mem_fun(*this, &Editor::set_punch_end_from_edit_point));
reg_sens (editor_actions, "start-loop-range", _("Start Loop Range"), sigc::mem_fun(*this, &Editor::set_loop_start_from_edit_point));
reg_sens (editor_actions, "finish-loop-range", _("Finish Loop Range"), sigc::mem_fun(*this, &Editor::set_loop_end_from_edit_point));
reg_sens (editor_actions, "alt-start-range", _("Start Range"), sigc::mem_fun(*this, &Editor::keyboard_selection_begin));
reg_sens (editor_actions, "alt-finish-range", _("Finish Range"), sigc::bind (sigc::mem_fun(*this, &Editor::keyboard_selection_finish), false));

View File

@ -6289,6 +6289,128 @@ Editor::set_session_extents_from_selection ()
}
}
void
Editor::set_punch_start_from_edit_point ()
{
if (_session) {
framepos_t start;
framepos_t end;
//use the existing loop end, if any
Location* tpl = transport_punch_location();
if (tpl)
end = tpl->end();
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
start = _session->audible_frame();
} else {
start = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(start);
//if there's not already a sensible selection endpoint, go "forever"
if ( start > end ) {
end = max_framepos;
}
set_punch_range (start, end, _("set punch start from EP"));
}
}
void
Editor::set_punch_end_from_edit_point ()
{
printf("set punch end\n");
if (_session) {
framepos_t start;
framepos_t end;
//use the existing loop end, if any
Location* tpl = transport_punch_location();
if (tpl)
start = tpl->start();
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
end = _session->audible_frame();
} else {
end = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(end);
printf("set punch %d, %d\n", start, end);
set_punch_range (start, end, _("set punch end from EP"));
}
}
void
Editor::set_loop_start_from_edit_point ()
{
printf("set loop start\n");
if (_session) {
framepos_t start;
framepos_t end;
//use the existing loop end, if any
Location* tpl = transport_loop_location();
if (tpl)
end = tpl->end();
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
start = _session->audible_frame();
} else {
start = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(start);
//if there's not already a sensible selection endpoint, go "forever"
if ( start > end ) {
end = max_framepos;
}
printf("set loop %d, %d\n", start, end);
set_loop_range (start, end, _("set loop start from EP"));
}
}
void
Editor::set_loop_end_from_edit_point ()
{
if (_session) {
framepos_t start;
framepos_t end;
//use the existing loop end, if any
Location* tpl = transport_loop_location();
if (tpl)
start = tpl->start();
if ((_edit_point == EditAtPlayhead) && _session->transport_rolling()) {
end = _session->audible_frame();
} else {
end = get_preferred_edit_position();
}
//snap the selection start/end
snap_to(end);
set_loop_range (start, end, _("set loop end from EP"));
}
}
void
Editor::set_punch_from_region ()
{

View File

@ -282,8 +282,12 @@ This mode provides many different operations on both regions and control points,
@-group|Editor/start-range|comma|some text
@-group|Editor/finish-range|period|some text
@-group|Editor/alt-start-range|<@PRIMARY@>KP_Down|some text
@-group|Editor/alt-finish-range|<@PRIMARY@>KP_Up|some text
@-group|Editor/alt-start-range|<@PRIMARY@>KP_Down|set the start of the range selection
@-group|Editor/alt-finish-range|<@PRIMARY@>KP_Up|set the end of the range selection
@-group|Editor/start-punch-range|<@PRIMARY@>comma|set the start of the Punch range
@-group|Editor/finish-punch-range|<@PRIMARY@>period|set the end of the Punch range
@-group|Editor/start-loop-range|<@SECONDARY@>comma|set the start of the Loop range
@-group|Editor/finish-loop-range|<@SECONDARY@>period|set the end of the Loop range
@markers|Editor/alternate-add-location-from-playhead|KP_Enter|add mark at playhead
@markers|Editor/alternate-remove-location-from-playhead|<@PRIMARY@>KP_Enter|add mark at playhead