- try to keep begin/commit pairs in the same file where possible.
void
AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction)
{
- trackview.editor().begin_reversible_command (_("automation event move"));
trackview.editor().session()->add_command (
new MementoCommand<AutomationList> (memento_command_binder(), &get_state(), 0));
void
AutomationLine::start_drag_line (uint32_t i1, uint32_t i2, float fraction)
{
- trackview.editor().begin_reversible_command (_("automation range move"));
trackview.editor().session()->add_command (
new MementoCommand<AutomationList> (memento_command_binder (), &get_state(), 0));
void
AutomationLine::start_drag_multiple (list<ControlPoint*> cp, float fraction, XMLNode* state)
{
- trackview.editor().begin_reversible_command (_("automation range move"));
trackview.editor().session()->add_command (
new MementoCommand<AutomationList> (memento_command_binder(), state, 0));
fade_length = pos - region->position();
}
- _editor->begin_reversible_command (_("change fade in length"));
+ bool in_command = false;
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
tmp->audio_region()->set_fade_in_length (fade_length);
tmp->audio_region()->set_fade_in_active (true);
+ if (!in_command) {
+ _editor->begin_reversible_command (_("change fade in length"));
+ in_command = true;
+ }
XMLNode &after = alist->get_state();
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
- _editor->commit_reversible_command ();
+ if (in_command) {
+ _editor->commit_reversible_command ();
+ }
}
void
fade_length = region->last_frame() - pos;
}
- _editor->begin_reversible_command (_("change fade out length"));
+ bool in_command = false;
for (list<DraggingView>::iterator i = _views.begin(); i != _views.end(); ++i) {
tmp->audio_region()->set_fade_out_length (fade_length);
tmp->audio_region()->set_fade_out_active (true);
+ if (!in_command) {
+ _editor->begin_reversible_command (_("change fade out length"));
+ in_command = false;
+ }
XMLNode &after = alist->get_state();
_editor->session()->add_command(new MementoCommand<AutomationList>(*alist.get(), &before, &after));
}
- _editor->commit_reversible_command ();
+ if (in_command) {
+ _editor->commit_reversible_command ();
+ }
}
void
_editor->_dragging_edit_point = false;
- _editor->begin_reversible_command ( _("move marker") );
XMLNode &before = _editor->session()->locations()->get_state();
+ bool in_command = false;
MarkerSelection::iterator i;
CopiedLocationInfo::iterator x;
if (location) {
if (location->locked()) {
- return;
+ continue;
+ }
+ if (!in_command) {
+ _editor->begin_reversible_command ( _("move marker") );
+ in_command = true;
}
-
if (location->is_mark()) {
location->set_start (((*x).location)->start());
} else {
}
}
- XMLNode &after = _editor->session()->locations()->get_state();
- _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
- _editor->commit_reversible_command ();
+ if (in_command) {
+ XMLNode &after = _editor->session()->locations()->get_state();
+ _editor->session()->add_command(new MementoCommand<Locations>(*(_editor->session()->locations()), &before, &after));
+ _editor->commit_reversible_command ();
+ }
}
void
setup_snap_delta (pos);
float const fraction = 1 - (_point->get_y() / _point->line().height());
-
+ _editor->begin_reversible_command (_("automation event move"));
_point->line().start_drag_single (_point, _fixed_grab_x, fraction);
show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction));
_fixed_grab_y = cy;
double fraction = 1.0 - (cy / _line->height());
-
+ _editor->begin_reversible_command (_("automation range move"));
_line->start_drag_line (before, after, fraction);
show_verbose_cursor_text (_line->get_verbose_cursor_string (fraction));
if (_nothing_to_drag) {
return;
}
-
+ _editor->begin_reversible_command (_("automation range move"));
for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
i->line->start_drag_multiple (i->points, y_fraction (i->line, current_pointer_y()), i->state);
}
MidiTimeAxisView::add_region (framepos_t pos, framecnt_t length, bool commit)
{
Editor* real_editor = dynamic_cast<Editor*> (&_editor);
-
- real_editor->begin_reversible_command (Operations::create_region);
+ if (commit) {
+ real_editor->begin_reversible_command (Operations::create_region);
+ }
playlist()->clear_changes ();
real_editor->snap_to (pos, RoundNearest);
void
RegionEditor::position_clock_changed ()
{
- PublicEditor::instance().begin_reversible_command (_("change region start position"));
-
+ bool in_command = false;
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
+ PublicEditor::instance().begin_reversible_command (_("change region start position"));
+ in_command = true;
+
_region->clear_changes ();
_region->set_position (position_clock.current_time());
_session->add_command(new StatefulDiffCommand (_region));
}
- PublicEditor::instance().commit_reversible_command ();
+ if (in_command) {
+ PublicEditor::instance().commit_reversible_command ();
+ }
}
void
RegionEditor::end_clock_changed ()
{
- PublicEditor::instance().begin_reversible_command (_("change region end position"));
-
+ bool in_command = false;
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
+ PublicEditor::instance().begin_reversible_command (_("change region end position"));
+ in_command = true;
+
_region->clear_changes ();
_region->trim_end (end_clock.current_time());
_session->add_command(new StatefulDiffCommand (_region));
}
- PublicEditor::instance().commit_reversible_command ();
+ if (in_command) {
+ PublicEditor::instance().commit_reversible_command ();
+ }
end_clock.set (_region->position() + _region->length() - 1, true);
}
RegionEditor::length_clock_changed ()
{
framecnt_t frames = length_clock.current_time();
-
- PublicEditor::instance().begin_reversible_command (_("change region length"));
-
+ bool in_command = false;
boost::shared_ptr<Playlist> pl = _region->playlist();
if (pl) {
- _region->clear_changes ();
+ PublicEditor::instance().begin_reversible_command (_("change region length"));
+ in_command = true;
+
+ _region->clear_changes ();
_region->trim_end (_region->position() + frames - 1);
_session->add_command(new StatefulDiffCommand (_region));
}
- PublicEditor::instance().commit_reversible_command ();
+ if (in_command) {
+ PublicEditor::instance().commit_reversible_command ();
+ }
length_clock.set (_region->length());
}