diff options
-rw-r--r-- | gtk2_ardour/ardour.menus.in | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/editor_actions.cc | 1 | ||||
-rw-r--r-- | gtk2_ardour/editor_ops.cc | 23 |
4 files changed, 24 insertions, 3 deletions
diff --git a/gtk2_ardour/ardour.menus.in b/gtk2_ardour/ardour.menus.in index d8ea6eb669..f0c8dfe1f7 100644 --- a/gtk2_ardour/ardour.menus.in +++ b/gtk2_ardour/ardour.menus.in @@ -130,6 +130,7 @@ <menu action="MarkerMenu"> <menuitem action='add-location-from-playhead'/> <menuitem action='remove-location-from-playhead'/> + <menuitem action='toggle-location-at-playhead'/> <separator/> <menuitem action='goto-mark-1'/> <menuitem action='goto-mark-2'/> diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index d45545b4a7..7d754ed1b0 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -1461,7 +1461,9 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void set_loop_range (framepos_t start, framepos_t end, std::string cmd); void set_punch_range (framepos_t start, framepos_t end, std::string cmd); + void toggle_location_at_playhead_cursor (); void add_location_from_playhead_cursor (); + bool do_remove_location_at_playhead_cursor (); void remove_location_at_playhead_cursor (); bool select_new_marker; diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index 79900b3517..44c66e36c8 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -254,6 +254,7 @@ Editor::register_actions () 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, "toggle-location-at-playhead", _("Toggle Mark at Playhead"), sigc::mem_fun(*this, &Editor::toggle_location_at_playhead_cursor)); 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 2741f66d4d..2022216934 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -2243,19 +2243,29 @@ Editor::set_session_end_from_playhead () _session->set_end_is_free (false); } + +void +Editor::toggle_location_at_playhead_cursor () +{ + if (!do_remove_location_at_playhead_cursor()) + { + add_location_from_playhead_cursor(); + } +} + void Editor::add_location_from_playhead_cursor () { add_location_mark (_session->audible_frame()); } -void -Editor::remove_location_at_playhead_cursor () +bool +Editor::do_remove_location_at_playhead_cursor () { + bool removed = false; if (_session) { //set up for undo XMLNode &before = _session->locations()->get_state(); - bool removed = false; //find location(s) at this time Locations::LocationList locs; @@ -2275,6 +2285,13 @@ Editor::remove_location_at_playhead_cursor () commit_reversible_command (); } } + return removed; +} + +void +Editor::remove_location_at_playhead_cursor () +{ + do_remove_location_at_playhead_cursor (); } /** Add a range marker around each selected region */ |