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);
can_remove = mm->meter().movable ();
} else if (tm) {
can_remove = tm->tempo().movable ();
- }
+ } else {
+ return;
+ }
delete tempo_or_meter_marker_menu;
build_tempo_or_meter_marker_menu (can_remove);
if (loc->is_mark()) {
Menu *markerMenu;
if (loc->is_session_range ()) {
- if (session_range_marker_menu == 0) {
- build_marker_menu (true);
- }
+ delete session_range_marker_menu;
+ build_marker_menu (true, loc);
markerMenu = session_range_marker_menu;
} else {
- if (marker_menu == 0)
- build_marker_menu (false);
+ delete marker_menu;
+ build_marker_menu (false, loc);
markerMenu = marker_menu;
}
}
void
-Editor::build_marker_menu (bool session_range)
+Editor::build_marker_menu (bool session_range, Location* loc)
{
using namespace Menu_Helpers;
MenuList& items = markerMenu->items();
markerMenu->set_name ("ArdourContextMenu");
- items.push_back (MenuElem (_("Locate to here"), sigc::mem_fun(*this, &Editor::marker_menu_set_playhead)));
- items.push_back (MenuElem (_("Play from here"), sigc::mem_fun(*this, &Editor::marker_menu_play_from)));
+ items.push_back (MenuElem (_("Locate to Here"), sigc::mem_fun(*this, &Editor::marker_menu_set_playhead)));
+ items.push_back (MenuElem (_("Play from Here"), sigc::mem_fun(*this, &Editor::marker_menu_play_from)));
items.push_back (MenuElem (_("Move Mark to Playhead"), sigc::mem_fun(*this, &Editor::marker_menu_set_from_playhead)));
items.push_back (SeparatorElem());
- items.push_back (MenuElem (_("Create range to next marker"), sigc::mem_fun(*this, &Editor::marker_menu_range_to_next)));
+ items.push_back (MenuElem (_("Create Range to Next Marker"), sigc::mem_fun(*this, &Editor::marker_menu_range_to_next)));
items.push_back (MenuElem (_("Hide"), sigc::mem_fun(*this, &Editor::marker_menu_hide)));
if (session_range) {
return;
}
items.push_back (MenuElem (_("Rename"), sigc::mem_fun(*this, &Editor::marker_menu_rename)));
- items.push_back (MenuElem (_("Lock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), true)));
- items.push_back (MenuElem (_("Unlock"), sigc::bind (sigc::mem_fun(*this, &Editor::marker_menu_lock), false)));
+ items.push_back (CheckMenuElem (_("Lock")));
+ CheckMenuItem* lock_item = static_cast<CheckMenuItem*> (&items.back());
+ if (loc->locked ()) {
+ 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());
items.push_back (MenuElem (_("Remove"), sigc::mem_fun(*this, &Editor::marker_menu_remove)));
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);
}
}
*m = dynamic_cast<MeterMarker*> (marker);
*t = dynamic_cast<TempoMarker*> (marker);
-
- if (*m == 0 && *t == 0) {
- fatal << X_("programming erorr: unhandled marker type in Editor::dynamic_cast_marker_object")
- << endmsg;
- /*NOTREACHED*/
- }
}
void
}
void
-Editor::marker_menu_lock (bool yn)
+Editor::toggle_marker_menu_lock ()
{
-
Marker* marker;
if ((marker = reinterpret_cast<Marker *> (marker_menu_item->get_data ("marker"))) == 0) {
loc = find_location_from_marker (marker, ignored);
- if (!loc) return;
+ if (!loc) {
+ return;
+ }
- if (yn) {
- loc->lock();
- } else {
+ if (loc->locked()) {
loc->unlock ();
+ } else {
+ loc->lock ();
}
}
}
}
}
+
+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);
+ }
+
+}