[Summary] Debugged UNDO/REDO support for Lock/Unlock marker(s) and for Move Marker (s)

This commit is contained in:
Valeriy Kamyshniy 2015-02-18 02:29:09 +02:00
parent 02813f6ec3
commit 09d21a0a9e
2 changed files with 22 additions and 18 deletions

View file

@ -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());
}
}
}

View file

@ -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 <RangeMarker*> (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<Locations>(*(_session->locations()), &before, &after));
commit_reversible_command ();
if (do_commit) {
XMLNode &after = _session->locations()->get_state();
_session->add_command(new MementoCommand<Locations>(*(_session->locations()), &before, &after));
commit_reversible_command ();
}
}
void