diff options
author | Ben Loftis <ben@harrisonconsoles.com> | 2015-04-27 15:58:50 -0500 |
---|---|---|
committer | Ben Loftis <ben@harrisonconsoles.com> | 2015-04-27 15:59:03 -0500 |
commit | 4aace9be681539d5b131f84337b871f8de39a6ec (patch) | |
tree | baa5db7667096037e259952e44aa01b10728eee9 /gtk2_ardour | |
parent | 5291400878597a0bd3b1a70578c9edcbf5be21fe (diff) |
new actions: allow user to set session start and end to playhead location
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 4 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 3 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 52 | ||||
-rw-r--r-- | gtk2_ardour/mnemonic-us.bindings.in | 3 |
5 files changed, 60 insertions, 4 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index fcbc855c6c..85680ac7b0 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -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/> diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 73e7582a81..eaa9132e86 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -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); diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 6d960d5d6a..baebda73af 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -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)); 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 (); diff --git a/gtk2_ardour/mnemonic-us.bindings.in b/gtk2_ardour/mnemonic-us.bindings.in index af03be3aa4..0c62f39d7f 100644 --- a/gtk2_ardour/mnemonic-us.bindings.in +++ b/gtk2_ardour/mnemonic-us.bindings.in @@ -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 |