From d54fb5f54ec4e3cfb88887a6a0ab5ee9407af0b5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 19 Jun 2012 13:54:28 +0000 Subject: Add option to add new range marker from the context menu without needing the keyboard (#4378). git-svn-id: svn://localhost/ardour2/branches/3.0@12781 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_markers.cc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gtk2_ardour/editor_markers.cc') diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 46f4a0ddd5..28706ac7bc 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -661,6 +661,31 @@ Editor::mouse_add_new_marker (framepos_t where, bool is_cd, bool is_xrun) } } +void +Editor::mouse_add_new_range (framepos_t where) +{ + if (!_session) { + return; + } + + /* Make this marker 1/8th of the visible area of the session so that + it's reasonably easy to manipulate after creation. + */ + + framepos_t const end = where + current_page_frames() / 8; + + string name; + _session->locations()->next_available_name (name, _("range")); + Location* loc = new Location (*_session, where, end, name, Location::IsRangeMarker); + + begin_reversible_command (_("new range marker")); + XMLNode& before = _session->locations()->get_state (); + _session->locations()->add (loc, true); + XMLNode& after = _session->locations()->get_state (); + _session->add_command (new MementoCommand (*_session->locations(), &before, &after)); + commit_reversible_command (); +} + void Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent*) { -- cgit v1.2.3