new actions: allow user to set session start and end to playhead location

This commit is contained in:
Ben Loftis 2015-04-27 15:58:50 -05:00
parent 5291400878
commit 4aace9be68
5 changed files with 60 additions and 4 deletions

View File

@ -70,6 +70,7 @@
<separator/>
<menuitem action='set-loop-from-edit-range'/>
<menuitem action='set-punch-from-edit-range'/>
<menuitem action='set-session-from-edit-range'/>
<separator/>
<menuitem action='Forward'/>
@ -129,6 +130,9 @@
<menuitem action='goto-mark-7'/>
<menuitem action='goto-mark-8'/>
<menuitem action='goto-mark-9'/>
<separator/>
<menuitem action='set-session-start-from-playhead'/>
<menuitem action='set-session-end-from-playhead'/>
</menu>
<separator/>

View File

@ -1441,6 +1441,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void set_punch_from_selection ();
void set_punch_from_region ();
void set_session_start_from_playhead ();
void set_session_end_from_playhead ();
void set_session_extents_from_selection ();
void set_loop_from_region (bool play);

View File

@ -248,6 +248,9 @@ Editor::register_actions ()
reg_sens (editor_actions, "jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
reg_sens (editor_actions, "alternate-jump-backward-to-mark", _("Jump to Previous Mark"), sigc::mem_fun(*this, &Editor::jump_backward_to_mark));
reg_sens (editor_actions, "set-session-start-from-playhead", _("Set Session Start from Playhead"), sigc::mem_fun(*this, &Editor::set_session_start_from_playhead));
reg_sens (editor_actions, "set-session-end-from-playhead", _("Set Session End from Playhead"), sigc::mem_fun(*this, &Editor::set_session_end_from_playhead));
reg_sens (editor_actions, "add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));
reg_sens (editor_actions, "alternate-add-location-from-playhead", _("Add Mark from Playhead"), sigc::mem_fun(*this, &Editor::add_location_from_playhead_cursor));

View File

@ -2114,6 +2114,54 @@ Editor::add_location_mark (framepos_t where)
commit_reversible_command ();
}
void
Editor::set_session_start_from_playhead ()
{
if (!_session)
return;
Location* loc;
if ((loc = _session->locations()->session_range_location()) == 0) { //should never happen
_session->set_session_extents ( _session->audible_frame(), _session->audible_frame() );
} else {
XMLNode &before = loc->get_state();
_session->set_session_extents ( _session->audible_frame(), loc->end() );
XMLNode &after = loc->get_state();
begin_reversible_command (_("Set session start"));
_session->add_command (new MementoCommand<Location>(*loc, &before, &after));
commit_reversible_command ();
}
}
void
Editor::set_session_end_from_playhead ()
{
if (!_session)
return;
Location* loc;
if ((loc = _session->locations()->session_range_location()) == 0) { //should never happen
_session->set_session_extents ( _session->audible_frame(), _session->audible_frame() );
} else {
XMLNode &before = loc->get_state();
_session->set_session_extents ( loc->start(), _session->audible_frame() );
XMLNode &after = loc->get_state();
begin_reversible_command (_("Set session start"));
_session->add_command (new MementoCommand<Location>(*loc, &before, &after));
commit_reversible_command ();
}
}
void
Editor::add_location_from_playhead_cursor ()
{
@ -6038,8 +6086,6 @@ Editor::set_session_extents_from_selection ()
if (!get_selection_extents ( start, end))
return;
begin_reversible_command (_("set session start/end from selection"));
Location* loc;
if ((loc = _session->locations()->session_range_location()) == 0) {
_session->set_session_extents ( start, end ); // this will create a new session range; no need for UNDO
@ -6050,6 +6096,8 @@ Editor::set_session_extents_from_selection ()
XMLNode &after = loc->get_state();
begin_reversible_command (_("set session start/end from selection"));
_session->add_command (new MementoCommand<Location>(*loc, &before, &after));
commit_reversible_command ();

View File

@ -106,8 +106,7 @@ This mode provides many different operations on both regions and control points,
@trans|Editor/add-location-from-playhead|nabla|add marker
@trans|Editor/remove-location-from-playhead|<@PRIMARY@>nabla|add marker
;@trans|Transport/GotoStart|Return|to start marker
@movp|Transport/alternate-GotoStart|KP_Return|to edit point
@movp|Transport/alternate-GotoStart|Return|to start marker
@trans|Editor/editor-fade-range|slash|fade range selection
@rop|Region/set-fade-in-length|<@PRIMARY@>slash|set fade in length