summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-09-07 23:26:21 +0000
committerCarl Hetherington <carl@carlh.net>2010-09-07 23:26:21 +0000
commit136b8ed74721957e9617885fe156e6b8657116bd (patch)
treebe74d5cf34efff949f21bce2c54e57a5aef7ba8d /gtk2_ardour
parent5ce3409e5debaf9d42749cb69c544a09c550f43a (diff)
Fix restore of fader automation from 2.X sessions.
git-svn-id: svn://localhost/ardour2/branches/3.0@7754 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/automation_time_axis.cc29
-rw-r--r--gtk2_ardour/automation_time_axis.h3
-rw-r--r--gtk2_ardour/route_time_axis.h2
-rw-r--r--gtk2_ardour/route_ui.cc15
-rw-r--r--gtk2_ardour/route_ui.h2
-rw-r--r--gtk2_ardour/time_axis_view.h2
6 files changed, 43 insertions, 10 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 4a4045f823..b356ce7595 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -194,7 +194,8 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr<Ro
controls_ebox.set_name (controls_base_unselected_name);
XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (
- _control->parameter());
+ _control->parameter(), Stateful::loading_state_version
+ );
if (xml_node) {
set_state (*xml_node, Stateful::loading_state_version);
@@ -403,7 +404,7 @@ AutomationTimeAxisView::set_height (uint32_t h)
TimeAxisView* state_parent = get_parent_with_state ();
assert(state_parent);
- XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter());
+ XMLNode* xml_node = state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
TimeAxisView::set_height (h);
_base_rect->property_y2() = h;
@@ -950,6 +951,10 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
{
TimeAxisView::set_state (node, version);
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
XMLProperty const * type = node.property ("automation-id");
if (type && type->value () == ARDOUR::EventTypeMap::instance().to_symbol (_control->parameter())) {
XMLProperty const * shown = node.property ("shown");
@@ -966,13 +971,31 @@ AutomationTimeAxisView::set_state (const XMLNode& node, int version)
return 0;
}
+int
+AutomationTimeAxisView::set_state_2X (const XMLNode& node, int version)
+{
+ if (node.name() == X_("gain") && _control->parameter() == Evoral::Parameter (GainAutomation)) {
+ XMLProperty const * shown = node.property (X_("shown"));
+ if (shown && string_is_affirmative (shown->value ())) {
+ set_marked_for_display (true);
+ _canvas_display->show (); /* FIXME: necessary? show_at? */
+ }
+ }
+
+ if (!_marked_for_display) {
+ hide ();
+ }
+
+ return 0;
+}
+
XMLNode*
AutomationTimeAxisView::get_state_node ()
{
TimeAxisView* state_parent = get_parent_with_state ();
if (state_parent) {
- return state_parent->get_automation_child_xml_node (_control->parameter());
+ return state_parent->get_automation_child_xml_node (_control->parameter(), Stateful::loading_state_version);
} else {
return 0;
}
diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h
index c4132269f1..55fcb14202 100644
--- a/gtk2_ardour/automation_time_axis.h
+++ b/gtk2_ardour/automation_time_axis.h
@@ -175,6 +175,9 @@ class AutomationTimeAxisView : public TimeAxisView {
static Pango::FontDescription* name_font;
static bool have_name_font;
+
+private:
+ int set_state_2X (const XMLNode &, int);
};
#endif /* __ardour_gtk_automation_time_axis_h__ */
diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h
index 840b18ed14..90cc4aa48c 100644
--- a/gtk2_ardour/route_time_axis.h
+++ b/gtk2_ardour/route_time_axis.h
@@ -117,7 +117,7 @@ public:
/* make sure we get the right version of this */
- XMLNode* get_automation_child_xml_node (Evoral::Parameter param) { return RouteUI::get_automation_child_xml_node (param); }
+ XMLNode* get_automation_child_xml_node (Evoral::Parameter param, int version) { return RouteUI::get_automation_child_xml_node (param, version); }
typedef std::map<Evoral::Parameter, boost::shared_ptr<AutomationTimeAxisView> > AutomationTracks;
AutomationTracks automation_tracks() { return _automation_tracks; }
diff --git a/gtk2_ardour/route_ui.cc b/gtk2_ardour/route_ui.cc
index 60d6f5f263..4222b40a93 100644
--- a/gtk2_ardour/route_ui.cc
+++ b/gtk2_ardour/route_ui.cc
@@ -1271,7 +1271,7 @@ RouteUI::ensure_xml_node ()
}
XMLNode*
-RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
+RouteUI::get_automation_child_xml_node (Evoral::Parameter param, int version)
{
ensure_xml_node ();
@@ -1281,10 +1281,17 @@ RouteUI::get_automation_child_xml_node (Evoral::Parameter param)
const string sym = ARDOUR::EventTypeMap::instance().to_symbol(param);
for (iter = kids.begin(); iter != kids.end(); ++iter) {
- if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
- XMLProperty* type = (*iter)->property("automation-id");
- if (type && type->value() == sym)
+
+ if (version < 3000) {
+ if ((*iter)->name() == sym) {
return *iter;
+ }
+ } else {
+ if ((*iter)->name() == AutomationTimeAxisView::state_node_name) {
+ XMLProperty* type = (*iter)->property("automation-id");
+ if (type && type->value() == sym)
+ return *iter;
+ }
}
}
diff --git a/gtk2_ardour/route_ui.h b/gtk2_ardour/route_ui.h
index 3ba0635fd7..952b39a433 100644
--- a/gtk2_ardour/route_ui.h
+++ b/gtk2_ardour/route_ui.h
@@ -111,7 +111,7 @@ class RouteUI : public virtual AxisView
XMLNode *xml_node;
void ensure_xml_node ();
- virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter param);
+ virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int);
bool mute_press(GdkEventButton*);
bool mute_release(GdkEventButton*);
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h
index f8a30d5778..f01aa508ae 100644
--- a/gtk2_ardour/time_axis_view.h
+++ b/gtk2_ardour/time_axis_view.h
@@ -206,7 +206,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful
/* call this on the parent */
- virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter /*param*/) { return 0; }
+ virtual XMLNode* get_automation_child_xml_node (Evoral::Parameter, int) { return 0; }
virtual LayerDisplay layer_display () const { return Overlaid; }
virtual StreamView* view () const { return 0; }