diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2014-12-09 16:17:47 -0600 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2014-12-09 16:18:47 -0600 |
commit | e66752cec1dd19e674b9a2c87436c937c4886295 (patch) | |
tree | 1b83ab9014dcd5484d9cfda2c5089bb887a652a8 /gtk2_ardour/editor_ops.cc | |
parent | 1e0c1751a53999a8b9ac6978393486afbf317529 (diff) |
add set-session-extents-from-edit-range
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index f975c8df7f..aa0f316467 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -5902,6 +5902,34 @@ Editor::set_punch_from_selection () } void +Editor::set_session_extents_from_selection () +{ + if (_session == 0 || selection->time.empty()) { + return; + } + + begin_reversible_command (_("set session start/stop from selection")); + + framepos_t start = selection->time[clicked_selection].start; + framepos_t end = selection->time[clicked_selection].end; + + 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 + } else { + XMLNode &before = loc->get_state(); + + _session->set_session_extents ( start, end ); + + XMLNode &after = loc->get_state(); + + _session->add_command (new MementoCommand<Location>(*loc, &before, &after)); + + commit_reversible_command (); + } +} + +void Editor::set_punch_from_edit_range () { if (_session == 0) { |