diff options
author | Carl Hetherington <carl@carlh.net> | 2010-08-09 16:40:31 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-08-09 16:40:31 +0000 |
commit | 5b520324ceab2559723b4ef5127301fa61ff4846 (patch) | |
tree | 13850a356fabdcbd55ca527fc5faf2fda63cb209 /gtk2_ardour/editor_markers.cc | |
parent | aa9fd3334976ceae7e164c3fabc87e55fc921dff (diff) |
Allow markers to be glued to bar/beat time. Fixes #1815.
git-svn-id: svn://localhost/ardour2/branches/3.0@7573 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_markers.cc')
-rw-r--r-- | gtk2_ardour/editor_markers.cc | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 87bc4b5138..23332047bd 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -413,7 +413,7 @@ Editor::mouse_add_new_marker (nframes64_t where, bool is_cd, bool is_xrun) if (!is_xrun && !choose_new_marker_name(markername)) { return; } - Location *location = new Location (where, where, markername, (Location::Flags) flags); + Location *location = new Location (*_session, where, where, markername, (Location::Flags) flags); _session->begin_reversible_command (_("add marker")); XMLNode &before = _session->locations()->get_state(); _session->locations()->add (location, true); @@ -628,6 +628,13 @@ Editor::build_marker_menu (bool session_range, Location* loc) lock_item->set_active (); } lock_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_lock)); + + items.push_back (CheckMenuElem (_("Glue to Bars and Beats"))); + CheckMenuItem* glue_item = static_cast<CheckMenuItem*> (&items.back()); + if (loc->position_lock_style() == MusicTime) { + glue_item->set_active (); + } + glue_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_glue)); items.push_back (SeparatorElem()); @@ -867,7 +874,7 @@ Editor::marker_menu_range_to_next () string range_name = l->name(); range_name += "-range"; - Location* newrange = new Location (marker->position(), end, range_name, Location::IsRangeMarker); + Location* newrange = new Location (*_session, marker->position(), end, range_name, Location::IsRangeMarker); _session->locations()->add (newrange); } } @@ -1243,3 +1250,30 @@ Editor::goto_nth_marker (int n) } } } + +void +Editor::toggle_marker_menu_glue () +{ + Marker* marker; + + if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) { + fatal << _("programming error: marker canvas item has no marker object pointer!") << endmsg; + /*NOTREACHED*/ + } + + Location* loc; + bool ignored; + + loc = find_location_from_marker (marker, ignored); + + if (!loc) { + return; + } + + if (loc->position_lock_style() == MusicTime) { + loc->set_position_lock_style (AudioTime); + } else { + loc->set_position_lock_style (MusicTime); + } + +} |