diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 79d7397f5e..4dee71190b 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -3688,10 +3688,8 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) } else { Location* loc = _marker->location (); - if (loc) { - if (loc->is_skip()) { - loc->set_skipping (!loc->is_skipping ()); - } + if (loc && loc->is_skip()) { + loc->set_skipping (!loc->is_skipping ()); } break; } @@ -3710,22 +3708,23 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred) _editor->begin_reversible_command ( _("move marker") ); XMLNode &before = _editor->session()->locations()->get_state(); + bool do_commit = false; MarkerSelection::iterator i; CopiedLocationInfo::iterator x; - bool do_commit = false; for (i = _editor->selection->markers.begin(), x = _copied_locations.begin(); x != _copied_locations.end() && i != _editor->selection->markers.end(); ++i, ++x) { - Location * location = (*i)->location (); + Location* location = (*i)->location (); + Location* copy = (*x).location; if (location && !location->locked()) { if (location->is_mark()) { - do_commit = (do_commit || !location->set_start (((*x).location)->start())); + do_commit += !location->set_start (copy->start()); } else { - do_commit = (do_commit || !location->set (((*x).location)->start(), ((*x).location)->end())); + do_commit += !location->set (copy->start(), copy->end()); } } } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index f577168708..78a92d694b 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -1163,12 +1163,15 @@ Editor::toggle_marker_menu_lock (ARDOUR::Location* location, bool lock) begin_reversible_command (many ? (lock ? _("lock markers"):_("unlock markers")) : (lock ? _("lock marker"):_("unlock marker"))); XMLNode &before = _session->locations()->get_state(); + bool do_commit = false; - if (location) { // null says: deal with selection + if (location && (location->locked () != lock)) { // null says: deal with selection if (lock) { location->lock (); + do_commit = true; } else { location->unlock (); + do_commit = true; } } else { for (MarkerSelection::iterator x = selection->markers.begin(); x != selection->markers.end(); ++x) { @@ -1179,20 +1182,22 @@ Editor::toggle_marker_menu_lock (ARDOUR::Location* location, bool lock) continue; } - if (marker && loc->is_mark () && !dynamic_cast (marker)) { - if (loc->locked () && !lock) { - loc->unlock (); + if (marker && loc->is_mark () && (loc->locked () != lock)) { + if (lock) { + do_commit = true; + loc->lock (); } else { - if (lock && !loc->locked ()) { - loc->lock (); - } + loc->unlock (); + do_commit = true; } } } } - XMLNode &after = _session->locations()->get_state(); - _session->add_command(new MementoCommand(*(_session->locations()), &before, &after)); - commit_reversible_command (); + if (do_commit) { + XMLNode &after = _session->locations()->get_state(); + _session->add_command(new MementoCommand(*(_session->locations()), &before, &after)); + commit_reversible_command (); + } } void