[Summary] Added UNDO/FOR for toggling "skipping state" of SKIP markers.

This commit is contained in:
VKamyshniy 2015-02-19 22:06:56 +02:00
parent 13a542c13a
commit 498d97f78c
3 changed files with 23 additions and 7 deletions

View file

@ -178,6 +178,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
// UNDOable commands:
void move_markers_command (std::list<Marker*>&, const std::list<ARDOUR::Location*>&);
void toggle_location_skipping_command (Marker*);
XMLNode& get_state ();
int set_state (const XMLNode&, int version);

View file

@ -3689,13 +3689,8 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
(_editor->selection->markers.front ()->type () == Marker::Range)) {
_editor->selection->markers.clear ();
}
} else {
Location* loc = _marker->location ();
if (loc && loc->is_skip()) {
loc->set_skipping (!loc->is_skipping ());
}
_editor->toggle_location_skipping_command (_marker);
break;
}
_editor->selection->toggle (_marker);

View file

@ -41,7 +41,7 @@
#include "utils.h"
#include "i18n.h"
void
void
Editor::move_markers_command (std::list<Marker*>&markers, const std::list<ARDOUR::Location*>& locations)
{
const size_t markers_count = markers.size ();
@ -84,3 +84,23 @@ Editor::move_markers_command (std::list<Marker*>&markers, const std::list<ARDOUR
session()->add_command(new MementoCommand<ARDOUR::Locations>(*(session()->locations()), &before, &after));
commit_reversible_command ();
}
void
Editor::toggle_location_skipping_command (Marker* marker)
{
ARDOUR::Location* loc = marker ? marker->location () : 0;
if (!(loc && loc->is_skip ())) {
WavesMessageDialog (_("Skip State"), _("MOVE MARKERS: Invalid argument!")).run ();
return;
}
begin_reversible_command (_("skip state"));
XMLNode &before = session()->locations()->get_state();
loc->set_skipping (!loc->is_skipping ());
XMLNode &after = session()->locations()->get_state();
session()->add_command(new MementoCommand<ARDOUR::Locations>(*(session()->locations()), &before, &after));
commit_reversible_command ();
}