mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-20 13:46:30 +01:00
fix up some errors with fade in/out commands; make commit_reversible_command() do nothing if the transaction contains no commands; fix up undo with fade in/out objects
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2854 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
beedf463fa
commit
b007f7fe62
4 changed files with 65 additions and 16 deletions
|
|
@ -4276,8 +4276,14 @@ Editor::set_fade_length (bool in)
|
|||
return;
|
||||
}
|
||||
|
||||
AutomationList& alist = tmp->audio_region()->fade_in();
|
||||
XMLNode &before = alist.get_state();
|
||||
AutomationList* alist;
|
||||
if (in) {
|
||||
alist = &tmp->audio_region()->fade_in();
|
||||
} else {
|
||||
alist = &tmp->audio_region()->fade_out();
|
||||
}
|
||||
|
||||
XMLNode &before = alist->get_state();
|
||||
|
||||
if (in) {
|
||||
tmp->audio_region()->set_fade_in_length (len);
|
||||
|
|
@ -4285,8 +4291,8 @@ Editor::set_fade_length (bool in)
|
|||
tmp->audio_region()->set_fade_out_length (len);
|
||||
}
|
||||
|
||||
XMLNode &after = alist.get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(alist, &before, &after));
|
||||
XMLNode &after = alist->get_state();
|
||||
session->add_command(new MementoCommand<AutomationList>(*alist, &before, &after));
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
|
|
@ -4305,7 +4311,6 @@ Editor::toggle_fade_active (bool in)
|
|||
const char* cmd = (in ? _("toggle fade in active") : _("toggle fade out active"));
|
||||
bool have_switch = false;
|
||||
bool yn;
|
||||
bool in_command = false;
|
||||
|
||||
begin_reversible_command (cmd);
|
||||
|
||||
|
|
@ -4321,25 +4326,31 @@ Editor::toggle_fade_active (bool in)
|
|||
/* make the behaviour consistent across all regions */
|
||||
|
||||
if (!have_switch) {
|
||||
yn = region->fade_in_active();
|
||||
if (in) {
|
||||
yn = region->fade_in_active();
|
||||
} else {
|
||||
yn = region->fade_out_active();
|
||||
}
|
||||
have_switch = true;
|
||||
}
|
||||
|
||||
XMLNode &before = region->get_state();
|
||||
region->set_fade_in_active (!yn);
|
||||
if (in) {
|
||||
region->set_fade_in_active (!yn);
|
||||
} else {
|
||||
region->set_fade_out_active (!yn);
|
||||
}
|
||||
XMLNode &after = region->get_state();
|
||||
session->add_command(new MementoCommand<AudioRegion>(*region.get(), &before, &after));
|
||||
in_command = true;
|
||||
}
|
||||
|
||||
if (in_command) {
|
||||
commit_reversible_command ();
|
||||
}
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
|
||||
{
|
||||
|
||||
begin_reversible_command (_("set fade in shape"));
|
||||
|
||||
for (RegionSelection::iterator x = selection->regions.begin(); x != selection->regions.end(); ++x) {
|
||||
|
|
@ -4359,6 +4370,7 @@ Editor::set_fade_in_shape (AudioRegion::FadeShape shape)
|
|||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -4407,6 +4419,8 @@ Editor::set_fade_in_active (bool yn)
|
|||
XMLNode &after = ar->get_state();
|
||||
session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -4430,6 +4444,8 @@ Editor::set_fade_out_active (bool yn)
|
|||
XMLNode &after = ar->get_state();
|
||||
session->add_command(new MementoCommand<AudioRegion>(*ar, &before, &after));
|
||||
}
|
||||
|
||||
commit_reversible_command ();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -711,6 +711,8 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
|
|||
|
||||
uint32_t old_flags = _flags;
|
||||
|
||||
cerr << _name << " setting live state\n";
|
||||
|
||||
if ((prop = node.property ("flags")) != 0) {
|
||||
_flags = Flag (string_2_enum (prop->value(), _flags));
|
||||
|
||||
|
|
@ -761,17 +763,44 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
|
|||
|
||||
_fade_in.clear ();
|
||||
|
||||
if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0 || _fade_in.set_state (*child)) {
|
||||
if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0) {
|
||||
set_default_fade_in ();
|
||||
} else {
|
||||
XMLNode* grandchild = child->child ("AutomationList");
|
||||
if (grandchild) {
|
||||
_fade_in.set_state (*grandchild);
|
||||
}
|
||||
}
|
||||
|
||||
if ((prop = child->property ("active")) != 0) {
|
||||
if (prop->value() == "yes") {
|
||||
set_fade_in_active (true);
|
||||
} else {
|
||||
set_fade_in_active (true);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (child->name() == "FadeOut") {
|
||||
|
||||
_fade_out.clear ();
|
||||
|
||||
if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0 || _fade_out.set_state (*child)) {
|
||||
if ((prop = child->property ("default")) != 0 || (prop = child->property ("steepness")) != 0) {
|
||||
set_default_fade_out ();
|
||||
} else {
|
||||
XMLNode* grandchild = child->child ("AutomationList");
|
||||
if (grandchild) {
|
||||
_fade_out.set_state (*grandchild);
|
||||
}
|
||||
}
|
||||
|
||||
if ((prop = child->property ("active")) != 0) {
|
||||
if (prop->value() == "yes") {
|
||||
set_fade_out_active (true);
|
||||
} else {
|
||||
set_fade_out_active (false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2305,6 +2305,10 @@ Session::commit_reversible_command (Command *cmd)
|
|||
current_trans->add_command (cmd);
|
||||
}
|
||||
|
||||
if (current_trans->empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
gettimeofday (&now, 0);
|
||||
current_trans->set_timestamp (now);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __ardour_svn_revision_h__
|
||||
#define __ardour_svn_revision_h__
|
||||
static const char* ardour_svn_revision = "2852";
|
||||
static const char* ardour_svn_revision = "2853";
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue