More _reversible_command() auditing in the gui.
- try to keep begin/commit pairs in the same file where possible.
This commit is contained in:
parent
d019ee836c
commit
44790ebff0
|
@ -466,7 +466,6 @@ AutomationLine::string_to_fraction (string const & s) const
|
|||
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));
|
||||
|
||||
|
@ -492,7 +491,6 @@ AutomationLine::start_drag_single (ControlPoint* cp, double x, float fraction)
|
|||
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));
|
||||
|
||||
|
@ -512,7 +510,6 @@ AutomationLine::start_drag_line (uint32_t i1, uint32_t i2, float fraction)
|
|||
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));
|
||||
|
||||
|
|
|
@ -3479,7 +3479,7 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
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) {
|
||||
|
||||
|
@ -3495,11 +3495,17 @@ FadeInDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
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
|
||||
|
@ -3598,7 +3604,7 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
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) {
|
||||
|
||||
|
@ -3614,11 +3620,17 @@ FadeOutDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
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
|
||||
|
@ -3952,8 +3964,8 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
|
||||
_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;
|
||||
|
@ -3968,9 +3980,12 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
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 {
|
||||
|
@ -3979,9 +3994,11 @@ MarkerDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -4044,7 +4061,7 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
|
|||
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));
|
||||
|
@ -4190,7 +4207,7 @@ LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
|
|||
_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));
|
||||
|
@ -5583,7 +5600,7 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -1509,8 +1509,9 @@ boost::shared_ptr<MidiRegion>
|
|||
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);
|
||||
|
|
|
@ -270,33 +270,41 @@ RegionEditor::connect_editor_events ()
|
|||
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);
|
||||
}
|
||||
|
@ -305,18 +313,21 @@ void
|
|||
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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue