2 Copyright (C) 2002 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include <sigc++/bind.h>
27 #include <ardour/param_id.h>
28 #include <ardour/automation_event.h>
29 #include <ardour/curve.h>
30 #include <pbd/stacktrace.h>
35 using namespace ARDOUR;
39 sigc::signal<void,AutomationList *> AutomationList::AutomationListCreated;
41 static bool sort_events_by_time (ControlEvent* a, ControlEvent* b)
43 return a->when < b->when;
47 static void dumpit (const AutomationList& al, string prefix = "")
49 cerr << prefix << &al << endl;
50 for (AutomationList::const_iterator i = al.const_begin(); i != al.const_end(); ++i) {
51 cerr << prefix << '\t' << (*i)->when << ',' << (*i)->value << endl;
57 AutomationList::AutomationList (ParamID id, double min_val, double max_val, double default_val)
59 , _curve(new Curve(*this))
63 _changed_when_thawed = false;
69 _max_xval = 0; // means "no limit"
70 _default_value = default_val;
71 _rt_insertion_point = _events.end();
72 _lookup_cache.left = -1;
73 _lookup_cache.range.first = _events.end();
74 _sort_pending = false;
76 assert(_param_id.type() != NullAutomation);
77 AutomationListCreated(this);
80 AutomationList::AutomationList (const AutomationList& other)
81 : _param_id(other._param_id)
82 , _curve(new Curve(*this))
85 _changed_when_thawed = false;
86 _style = other._style;
87 _min_yval = other._min_yval;
88 _max_yval = other._max_yval;
89 _max_xval = other._max_xval;
90 _default_value = other._default_value;
91 _state = other._state;
92 _touching = other._touching;
93 _rt_insertion_point = _events.end();
94 _lookup_cache.left = -1;
95 _lookup_cache.range.first = _events.end();
96 _sort_pending = false;
98 for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) {
99 _events.push_back (new ControlEvent (**i));
103 assert(_param_id.type() != NullAutomation);
104 AutomationListCreated(this);
107 AutomationList::AutomationList (const AutomationList& other, double start, double end)
108 : _param_id(other._param_id)
109 , _curve(new Curve(*this))
112 _changed_when_thawed = false;
113 _style = other._style;
114 _min_yval = other._min_yval;
115 _max_yval = other._max_yval;
116 _max_xval = other._max_xval;
117 _default_value = other._default_value;
118 _state = other._state;
119 _touching = other._touching;
120 _rt_insertion_point = _events.end();
121 _lookup_cache.left = -1;
122 _lookup_cache.range.first = _events.end();
123 _sort_pending = false;
125 /* now grab the relevant points, and shift them back if necessary */
127 AutomationList* section = const_cast<AutomationList*>(&other)->copy (start, end);
129 if (!section->empty()) {
130 for (AutomationList::iterator i = section->begin(); i != section->end(); ++i) {
131 _events.push_back (new ControlEvent ((*i)->when, (*i)->value));
139 assert(_param_id.type() != NullAutomation);
140 AutomationListCreated(this);
143 /** \a id is used for legacy sessions where the type is not present
144 * in or below the <AutomationList> node. It is used if \a id is non-null.
146 AutomationList::AutomationList (const XMLNode& node, ParamID id)
147 : _curve(new Curve(*this))
150 _changed_when_thawed = false;
154 _max_xval = 0; // means "no limit"
157 _rt_insertion_point = _events.end();
158 _lookup_cache.left = -1;
159 _lookup_cache.range.first = _events.end();
160 _sort_pending = false;
167 assert(_param_id.type() != NullAutomation);
168 AutomationListCreated(this);
171 AutomationList::~AutomationList()
175 for (EventList::iterator x = _events.begin(); x != _events.end(); ++x) {
181 AutomationList::operator== (const AutomationList& other)
183 return _events == other._events;
187 AutomationList::operator= (const AutomationList& other)
189 if (this != &other) {
193 for (const_iterator i = other._events.begin(); i != other._events.end(); ++i) {
194 _events.push_back (new ControlEvent (**i));
197 _min_yval = other._min_yval;
198 _max_yval = other._max_yval;
199 _max_xval = other._max_xval;
200 _default_value = other._default_value;
203 maybe_signal_changed ();
210 AutomationList::maybe_signal_changed ()
215 _changed_when_thawed = true;
222 AutomationList::set_automation_state (AutoState s)
226 automation_state_changed (); /* EMIT SIGNAL */
231 AutomationList::set_automation_style (AutoStyle s)
235 automation_style_changed (); /* EMIT SIGNAL */
240 AutomationList::start_touch ()
247 AutomationList::stop_touch ()
254 AutomationList::clear ()
257 Glib::Mutex::Lock lm (_lock);
262 maybe_signal_changed ();
266 AutomationList::x_scale (double factor)
268 Glib::Mutex::Lock lm (_lock);
273 AutomationList::extend_to (double when)
275 Glib::Mutex::Lock lm (_lock);
276 if (_events.empty() || _events.back()->when == when) {
279 double factor = when / _events.back()->when;
284 void AutomationList::_x_scale (double factor)
286 for (AutomationList::iterator i = _events.begin(); i != _events.end(); ++i) {
287 (*i)->when = floor ((*i)->when * factor);
294 AutomationList::reposition_for_rt_add (double when)
296 _rt_insertion_point = _events.end();
300 AutomationList::rt_add (double when, double value)
302 /* this is for automation recording */
304 if ((_state & Touch) && !_touching) {
308 // cerr << "RT: alist @ " << this << " add " << value << " @ " << when << endl;
311 Glib::Mutex::Lock lm (_lock);
315 ControlEvent cp (when, 0.0);
318 if ((_rt_insertion_point != _events.end()) && ((*_rt_insertion_point)->when < when) ) {
320 /* we have a previous insertion point, so we should delete
321 everything between it and the position where we are going
322 to insert this point.
325 iterator after = _rt_insertion_point;
327 if (++after != _events.end()) {
328 iterator far = after;
330 while (far != _events.end()) {
331 if ((*far)->when > when) {
339 _rt_insertion_point = where;
341 if((*where)->when == when) {
342 (*where)->value = value;
346 where = _events.erase (after, far);
355 iterator previous = _rt_insertion_point;
358 if (_rt_insertion_point != _events.begin() && (*_rt_insertion_point)->value == value && (*previous)->value == value) {
359 (*_rt_insertion_point)->when = when;
366 where = lower_bound (_events.begin(), _events.end(), &cp, cmp);
368 if (where != _events.end()) {
369 if ((*where)->when == when) {
370 (*where)->value = value;
377 _rt_insertion_point = _events.insert (where, new ControlEvent (when, value));
384 maybe_signal_changed ();
388 AutomationList::fast_simple_add (double when, double value)
390 /* to be used only for loading pre-sorted data from saved state */
391 _events.insert (_events.end(), new ControlEvent (when, value));
395 AutomationList::add (double when, double value)
397 /* this is for graphical editing */
400 Glib::Mutex::Lock lm (_lock);
402 ControlEvent cp (when, 0.0f);
404 iterator insertion_point;
406 for (insertion_point = lower_bound (_events.begin(), _events.end(), &cp, cmp); insertion_point != _events.end(); ++insertion_point) {
408 /* only one point allowed per time point */
410 if ((*insertion_point)->when == when) {
411 (*insertion_point)->value = value;
416 if ((*insertion_point)->when >= when) {
423 _events.insert (insertion_point, new ControlEvent (when, value));
424 reposition_for_rt_add (0);
431 maybe_signal_changed ();
435 AutomationList::erase (AutomationList::iterator i)
438 Glib::Mutex::Lock lm (_lock);
440 reposition_for_rt_add (0);
443 maybe_signal_changed ();
447 AutomationList::erase (AutomationList::iterator start, AutomationList::iterator end)
450 Glib::Mutex::Lock lm (_lock);
451 _events.erase (start, end);
452 reposition_for_rt_add (0);
455 maybe_signal_changed ();
459 AutomationList::reset_range (double start, double endt)
464 Glib::Mutex::Lock lm (_lock);
466 ControlEvent cp (start, 0.0f);
470 if ((s = lower_bound (_events.begin(), _events.end(), &cp, cmp)) != _events.end()) {
473 e = upper_bound (_events.begin(), _events.end(), &cp, cmp);
475 for (iterator i = s; i != e; ++i) {
476 (*i)->value = _default_value;
486 maybe_signal_changed ();
491 AutomationList::erase_range (double start, double endt)
496 Glib::Mutex::Lock lm (_lock);
498 ControlEvent cp (start, 0.0f);
502 if ((s = lower_bound (_events.begin(), _events.end(), &cp, cmp)) != _events.end()) {
504 e = upper_bound (_events.begin(), _events.end(), &cp, cmp);
505 _events.erase (s, e);
506 reposition_for_rt_add (0);
514 maybe_signal_changed ();
519 AutomationList::move_range (iterator start, iterator end, double xdelta, double ydelta)
521 /* note: we assume higher level logic is in place to avoid this
522 reordering the time-order of control events in the list. ie. all
523 points after end are later than (end)->when.
527 Glib::Mutex::Lock lm (_lock);
529 while (start != end) {
530 (*start)->when += xdelta;
531 (*start)->value += ydelta;
532 if (isnan ((*start)->value)) {
539 _events.sort (sort_events_by_time);
541 _sort_pending = true;
547 maybe_signal_changed ();
551 AutomationList::slide (iterator before, double distance)
554 Glib::Mutex::Lock lm (_lock);
556 if (before == _events.end()) {
560 while (before != _events.end()) {
561 (*before)->when += distance;
566 maybe_signal_changed ();
570 AutomationList::modify (iterator iter, double when, double val)
572 /* note: we assume higher level logic is in place to avoid this
573 reordering the time-order of control events in the list. ie. all
574 points after *iter are later than when.
578 Glib::Mutex::Lock lm (_lock);
580 (*iter)->when = when;
581 (*iter)->value = val;
588 _events.sort (sort_events_by_time);
590 _sort_pending = true;
596 maybe_signal_changed ();
599 std::pair<AutomationList::iterator,AutomationList::iterator>
600 AutomationList::control_points_adjacent (double xval)
602 Glib::Mutex::Lock lm (_lock);
605 ControlEvent cp (xval, 0.0f);
606 std::pair<iterator,iterator> ret;
608 ret.first = _events.end();
609 ret.second = _events.end();
611 for (i = lower_bound (_events.begin(), _events.end(), &cp, cmp); i != _events.end(); ++i) {
613 if (ret.first == _events.end()) {
614 if ((*i)->when >= xval) {
615 if (i != _events.begin()) {
624 if ((*i)->when > xval) {
634 AutomationList::freeze ()
640 AutomationList::thaw ()
643 PBD::stacktrace (cerr);
644 fatal << string_compose (_("programming error: %1"), X_("AutomationList::thaw() called while not frozen")) << endmsg;
653 Glib::Mutex::Lock lm (_lock);
656 _events.sort (sort_events_by_time);
657 _sort_pending = false;
661 if (_changed_when_thawed) {
662 StateChanged(); /* EMIT SIGNAL */
667 AutomationList::set_max_xval (double x)
673 AutomationList::mark_dirty ()
675 _lookup_cache.left = -1;
676 Dirty (); /* EMIT SIGNAL */
680 AutomationList::truncate_end (double last_coordinate)
683 Glib::Mutex::Lock lm (_lock);
684 ControlEvent cp (last_coordinate, 0);
685 list<ControlEvent*>::reverse_iterator i;
688 if (_events.empty()) {
692 if (last_coordinate == _events.back()->when) {
696 if (last_coordinate > _events.back()->when) {
701 iterator foo = _events.begin();
704 if (foo == _events.end()) {
706 } else if (++foo == _events.end()) {
713 /* less than 2 points: add a new point */
714 _events.push_back (new ControlEvent (last_coordinate, _events.back()->value));
717 /* more than 2 points: check to see if the last 2 values
718 are equal. if so, just move the position of the
719 last point. otherwise, add a new point.
722 iterator penultimate = _events.end();
723 --penultimate; /* points at last point */
724 --penultimate; /* points at the penultimate point */
726 if (_events.back()->value == (*penultimate)->value) {
727 _events.back()->when = last_coordinate;
729 _events.push_back (new ControlEvent (last_coordinate, _events.back()->value));
737 last_val = unlocked_eval (last_coordinate);
738 last_val = max ((double) _min_yval, last_val);
739 last_val = min ((double) _max_yval, last_val);
741 i = _events.rbegin();
743 /* make i point to the last control point */
747 /* now go backwards, removing control points that are
748 beyond the new last coordinate.
751 uint32_t sz = _events.size();
753 while (i != _events.rend() && sz > 2) {
754 list<ControlEvent*>::reverse_iterator tmp;
759 if ((*i)->when < last_coordinate) {
763 _events.erase (i.base());
769 _events.back()->when = last_coordinate;
770 _events.back()->value = last_val;
773 reposition_for_rt_add (0);
777 maybe_signal_changed ();
781 AutomationList::truncate_start (double overall_length)
784 Glib::Mutex::Lock lm (_lock);
785 AutomationList::iterator i;
786 double first_legal_value;
787 double first_legal_coordinate;
789 if (_events.empty()) {
790 fatal << _("programming error:")
791 << "AutomationList::truncate_start() called on an empty list"
797 if (overall_length == _events.back()->when) {
798 /* no change in overall length */
802 if (overall_length > _events.back()->when) {
804 /* growing at front: duplicate first point. shift all others */
806 double shift = overall_length - _events.back()->when;
809 for (np = 0, i = _events.begin(); i != _events.end(); ++i, ++np) {
815 /* less than 2 points: add a new point */
816 _events.push_front (new ControlEvent (0, _events.front()->value));
820 /* more than 2 points: check to see if the first 2 values
821 are equal. if so, just move the position of the
822 first point. otherwise, add a new point.
825 iterator second = _events.begin();
826 ++second; /* points at the second point */
828 if (_events.front()->value == (*second)->value) {
829 /* first segment is flat, just move start point back to zero */
830 _events.front()->when = 0;
832 /* leave non-flat segment in place, add a new leading point. */
833 _events.push_front (new ControlEvent (0, _events.front()->value));
839 /* shrinking at front */
841 first_legal_coordinate = _events.back()->when - overall_length;
842 first_legal_value = unlocked_eval (first_legal_coordinate);
843 first_legal_value = max (_min_yval, first_legal_value);
844 first_legal_value = min (_max_yval, first_legal_value);
846 /* remove all events earlier than the new "front" */
850 while (i != _events.end() && !_events.empty()) {
851 list<ControlEvent*>::iterator tmp;
856 if ((*i)->when > first_legal_coordinate) {
866 /* shift all remaining points left to keep their same
870 for (i = _events.begin(); i != _events.end(); ++i) {
871 (*i)->when -= first_legal_coordinate;
874 /* add a new point for the interpolated new value */
876 _events.push_front (new ControlEvent (0, first_legal_value));
879 reposition_for_rt_add (0);
884 maybe_signal_changed ();
888 AutomationList::unlocked_eval (double x) const
890 pair<EventList::iterator,EventList::iterator> range;
896 npoints = _events.size();
900 return _default_value;
903 if (x >= _events.front()->when) {
904 return _events.front()->value;
906 // return _default_value;
907 return _events.front()->value;
911 if (x >= _events.back()->when) {
912 return _events.back()->value;
913 } else if (x == _events.front()->when) {
914 return _events.front()->value;
915 } else if (x < _events.front()->when) {
916 // return _default_value;
917 return _events.front()->value;
920 lpos = _events.front()->when;
921 lval = _events.front()->value;
922 upos = _events.back()->when;
923 uval = _events.back()->value;
925 /* linear interpolation betweeen the two points
928 fraction = (double) (x - lpos) / (double) (upos - lpos);
929 return lval + (fraction * (uval - lval));
933 if (x >= _events.back()->when) {
934 return _events.back()->value;
935 } else if (x == _events.front()->when) {
936 return _events.front()->value;
937 } else if (x < _events.front()->when) {
938 // return _default_value;
939 return _events.front()->value;
942 return multipoint_eval (x);
948 AutomationList::multipoint_eval (double x) const
950 pair<AutomationList::const_iterator,AutomationList::const_iterator> range;
955 /* only do the range lookup if x is in a different range than last time
956 this was called (or if the lookup cache has been marked "dirty" (left<0)
959 if ((_lookup_cache.left < 0) ||
960 ((_lookup_cache.left > x) ||
961 (_lookup_cache.range.first == _events.end()) ||
962 ((*_lookup_cache.range.second)->when < x))) {
964 ControlEvent cp (x, 0);
967 _lookup_cache.range = equal_range (_events.begin(), _events.end(), &cp, cmp);
970 range = _lookup_cache.range;
972 if (range.first == range.second) {
974 /* x does not exist within the list as a control point */
976 _lookup_cache.left = x;
978 if (range.first != _events.begin()) {
980 lpos = (*range.first)->when;
981 lval = (*range.first)->value;
983 /* we're before the first point */
984 // return _default_value;
985 return _events.front()->value;
988 if (range.second == _events.end()) {
989 /* we're after the last point */
990 return _events.back()->value;
993 upos = (*range.second)->when;
994 uval = (*range.second)->value;
996 /* linear interpolation betweeen the two points
1000 fraction = (double) (x - lpos) / (double) (upos - lpos);
1001 return lval + (fraction * (uval - lval));
1005 /* x is a control point in the data */
1006 _lookup_cache.left = -1;
1007 return (*range.first)->value;
1011 AutomationList::cut (iterator start, iterator end)
1013 AutomationList* nal = new AutomationList (_param_id, _min_yval, _max_yval, _default_value);
1016 Glib::Mutex::Lock lm (_lock);
1018 for (iterator x = start; x != end; ) {
1024 nal->_events.push_back (new ControlEvent (**x));
1027 reposition_for_rt_add (0);
1035 maybe_signal_changed ();
1041 AutomationList::cut_copy_clear (double start, double end, int op)
1043 AutomationList* nal = new AutomationList (_param_id, _min_yval, _max_yval, _default_value);
1045 ControlEvent cp (start, 0.0);
1047 bool changed = false;
1050 Glib::Mutex::Lock lm (_lock);
1052 if ((s = lower_bound (_events.begin(), _events.end(), &cp, cmp)) == _events.end()) {
1057 e = upper_bound (_events.begin(), _events.end(), &cp, cmp);
1059 if (op != 2 && (*s)->when != start) {
1060 nal->_events.push_back (new ControlEvent (0, unlocked_eval (start)));
1063 for (iterator x = s; x != e; ) {
1071 /* adjust new points to be relative to start, which
1072 has been set to zero.
1076 nal->_events.push_back (new ControlEvent ((*x)->when - start, (*x)->value));
1086 if (op != 2 && nal->_events.back()->when != end - start) {
1087 nal->_events.push_back (new ControlEvent (end - start, unlocked_eval (end)));
1091 reposition_for_rt_add (0);
1097 maybe_signal_changed ();
1104 AutomationList::copy (iterator start, iterator end)
1106 AutomationList* nal = new AutomationList (_param_id, _min_yval, _max_yval, _default_value);
1109 Glib::Mutex::Lock lm (_lock);
1111 for (iterator x = start; x != end; ) {
1117 nal->_events.push_back (new ControlEvent (**x));
1127 AutomationList::cut (double start, double end)
1129 return cut_copy_clear (start, end, 0);
1133 AutomationList::copy (double start, double end)
1135 return cut_copy_clear (start, end, 1);
1139 AutomationList::clear (double start, double end)
1141 (void) cut_copy_clear (start, end, 2);
1145 AutomationList::paste (AutomationList& alist, double pos, float times)
1147 if (alist._events.empty()) {
1152 Glib::Mutex::Lock lm (_lock);
1156 ControlEvent cp (pos, 0.0);
1159 where = upper_bound (_events.begin(), _events.end(), &cp, cmp);
1161 for (iterator i = alist.begin();i != alist.end(); ++i) {
1162 _events.insert (where, new ControlEvent( (*i)->when+pos,( *i)->value));
1163 end = (*i)->when + pos;
1167 /* move all points after the insertion along the timeline by
1171 while (where != _events.end()) {
1173 if ((*where)->when <= end) {
1176 _events.erase(where);
1184 reposition_for_rt_add (0);
1188 maybe_signal_changed ();
1193 AutomationList::get_state ()
1195 return state (true);
1199 AutomationList::state (bool full)
1201 XMLNode* root = new XMLNode (X_("AutomationList"));
1203 LocaleGuard lg (X_("POSIX"));
1205 root->add_property ("automation-id", _param_id.to_string());
1207 root->add_property ("id", _id.to_s());
1209 snprintf (buf, sizeof (buf), "%.12g", _default_value);
1210 root->add_property ("default", buf);
1211 snprintf (buf, sizeof (buf), "%.12g", _min_yval);
1212 root->add_property ("min_yval", buf);
1213 snprintf (buf, sizeof (buf), "%.12g", _max_yval);
1214 root->add_property ("max_yval", buf);
1215 snprintf (buf, sizeof (buf), "%.12g", _max_xval);
1216 root->add_property ("max_xval", buf);
1219 root->add_property ("state", auto_state_to_string (_state));
1221 /* never save anything but Off for automation state to a template */
1222 root->add_property ("state", auto_state_to_string (Off));
1225 root->add_property ("style", auto_style_to_string (_style));
1227 if (!_events.empty()) {
1228 root->add_child_nocopy (serialize_events());
1235 AutomationList::serialize_events ()
1237 XMLNode* node = new XMLNode (X_("events"));
1240 for (iterator xx = _events.begin(); xx != _events.end(); ++xx) {
1241 str << (double) (*xx)->when;
1243 str <<(double) (*xx)->value;
1247 /* XML is a bit wierd */
1249 XMLNode* content_node = new XMLNode (X_("foo")); /* it gets renamed by libxml when we set content */
1250 content_node->set_content (str.str());
1252 node->add_child_nocopy (*content_node);
1258 AutomationList::deserialize_events (const XMLNode& node)
1260 if (node.children().empty()) {
1264 XMLNode* content_node = node.children().front();
1266 if (content_node->content().empty()) {
1273 stringstream str (content_node->content());
1289 fast_simple_add (x, y);
1294 error << _("automation list: cannot load coordinates from XML, all points ignored") << endmsg;
1297 reposition_for_rt_add (0);
1298 maybe_signal_changed ();
1307 AutomationList::set_state (const XMLNode& node)
1309 XMLNodeList nlist = node.children();
1311 XMLNodeIterator niter;
1312 const XMLProperty* prop;
1314 if (node.name() == X_("events")) {
1315 /* partial state setting*/
1316 return deserialize_events (node);
1319 if (node.name() == X_("Envelope") || node.name() == X_("FadeOut") || node.name() == X_("FadeIn")) {
1321 if ((nsos = node.child (X_("AutomationList")))) {
1322 /* new school in old school clothing */
1323 return set_state (*nsos);
1328 const XMLNodeList& elist = node.children();
1329 XMLNodeConstIterator i;
1337 for (i = elist.begin(); i != elist.end(); ++i) {
1339 if ((prop = (*i)->property ("x")) == 0) {
1340 error << _("automation list: no x-coordinate stored for control point (point ignored)") << endmsg;
1343 x = atoi (prop->value().c_str());
1345 if ((prop = (*i)->property ("y")) == 0) {
1346 error << _("automation list: no y-coordinate stored for control point (point ignored)") << endmsg;
1349 y = atof (prop->value().c_str());
1351 fast_simple_add (x, y);
1359 if (node.name() != X_("AutomationList") ) {
1360 error << string_compose (_("AutomationList: passed XML node called %1, not \"AutomationList\" - ignored"), node.name()) << endmsg;
1364 if ((prop = node.property ("id")) != 0) {
1365 _id = prop->value ();
1366 /* update session AL list */
1367 AutomationListCreated(this);
1370 if ((prop = node.property (X_("automation-id"))) != 0){
1371 _param_id = ParamID(prop->value());
1373 warning << "Legacy session: automation list has no automation-id property.";
1376 if ((prop = node.property (X_("default"))) != 0){
1377 _default_value = atof (prop->value());
1379 _default_value = 0.0;
1382 if ((prop = node.property (X_("style"))) != 0) {
1383 _style = string_to_auto_style (prop->value());
1388 if ((prop = node.property (X_("state"))) != 0) {
1389 _state = string_to_auto_state (prop->value());
1394 if ((prop = node.property (X_("min_yval"))) != 0) {
1395 _min_yval = atof (prop->value ());
1397 _min_yval = FLT_MIN;
1400 if ((prop = node.property (X_("max_yval"))) != 0) {
1401 _max_yval = atof (prop->value ());
1403 _max_yval = FLT_MAX;
1406 if ((prop = node.property (X_("max_xval"))) != 0) {
1407 _max_xval = atof (prop->value ());
1409 _max_xval = 0; // means "no limit ;
1412 for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
1413 if ((*niter)->name() == X_("events")) {
1414 deserialize_events (*(*niter));