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
This commit is contained in:
Carl Hetherington 2012-06-19 13:54:28 +00:00
parent 3dd8fbdefa
commit d54fb5f54e
3 changed files with 27 additions and 1 deletions

View File

@ -632,6 +632,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
void hide_marker (ArdourCanvas::Item*, GdkEvent*);
void clear_marker_display ();
void mouse_add_new_marker (framepos_t where, bool is_cd=false, bool is_xrun=false);
void mouse_add_new_range (framepos_t);
bool choose_new_marker_name(std::string &name);
void update_cd_marker_display ();
void ensure_cd_marker_updated (LocationMarkers * lam, ARDOUR::Location * location);

View File

@ -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<Locations> (*_session->locations(), &before, &after));
commit_reversible_command ();
}
void
Editor::remove_marker (ArdourCanvas::Item& item, GdkEvent*)
{

View File

@ -342,7 +342,7 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t)
ruler_items.push_back (SeparatorElem ());
break;
case RangeMarkerBarItem:
//ruler_items.push_back (MenuElem (_("New Range")));
ruler_items.push_back (MenuElem (_("New range"), sigc::bind (sigc::mem_fun (*this, &Editor::mouse_add_new_range), where)));
ruler_items.push_back (MenuElem (_("Clear all ranges"), sigc::mem_fun(*this, &Editor::clear_ranges)));
ruler_items.push_back (MenuElem (_("Unhide ranges"), sigc::mem_fun(*this, &Editor::unhide_ranges)));
ruler_items.push_back (SeparatorElem ());