summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2008-01-09 06:39:18 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2008-01-09 06:39:18 +0000
commitb007f7fe621e8390b41df5a725fbb697d3d69fb9 (patch)
treeeeb833c1241f80eca1f3242cf85c5e5eeef369af
parentbeedf463fae114507e596c2e822abadea578e249 (diff)
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
-rw-r--r--gtk2_ardour/editor_ops.cc38
-rw-r--r--libs/ardour/audioregion.cc37
-rw-r--r--libs/ardour/session_state.cc4
-rw-r--r--svn_revision.h2
4 files changed, 65 insertions, 16 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index c3202f6a90..faf1ff41db 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -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 ();
}
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index 86844deed1..28e3d5a6d9 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -710,6 +710,8 @@ AudioRegion::set_live_state (const XMLNode& node, Change& what_changed, bool sen
Region::set_live_state (node, what_changed, false);
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);
+ }
+ }
+
}
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index c32418a752..bcdae0c269 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -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);
diff --git a/svn_revision.h b/svn_revision.h
index 57b0bf26e9..001a238553 100644
--- a/svn_revision.h
+++ b/svn_revision.h
@@ -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