summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@harrisonconsoles.com>2015-04-27 15:58:50 -0500
committerBen Loftis <ben@harrisonconsoles.com>2015-04-27 15:59:03 -0500
commit4aace9be681539d5b131f84337b871f8de39a6ec (patch)
treebaa5db7667096037e259952e44aa01b10728eee9 /gtk2_ardour/editor_ops.cc
parent5291400878597a0bd3b1a70578c9edcbf5be21fe (diff)
new actions: allow user to set session start and end to playhead location
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc52
1 files changed, 50 insertions, 2 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 0cef0d90e5..5c45951e04 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2115,6 +2115,54 @@ Editor::add_location_mark (framepos_t where)
}
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 ()
{
add_location_mark (_session->audible_frame());
@@ -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 ();