1 /* === S Y N F I G ========================================================= */
2 /*! \file valuenode_animated.h
3 ** \brief Header file for implementation of the "Animated" valuenode conversion.
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_VALUENODE_ANIMATED_H
26 #define __SYNFIG_VALUENODE_ANIMATED_H
28 /* === H E A D E R S ======================================================= */
32 #include "valuenode.h"
36 /* === M A C R O S ========================================================= */
38 /* === C L A S S E S & S T R U C T S ======================================= */
42 struct ValueNode_Animated : public ValueNode
45 typedef etl::handle<ValueNode_Animated> Handle;
46 typedef etl::handle<const ValueNode_Animated> ConstHandle;
48 typedef synfig::Waypoint Waypoint;
49 typedef synfig::WaypointList WaypointList;
51 typedef std::pair<WaypointList::iterator,bool> findresult;
52 typedef std::pair<WaypointList::const_iterator,bool> const_findresult;
55 WaypointList waypoint_list_;
58 WaypointList &waypoint_list() { return waypoint_list_; }
60 const WaypointList &waypoint_list()const { return waypoint_list_; }
62 virtual WaypointList::iterator new_waypoint(Time t, ValueBase value)=0;
64 virtual WaypointList::iterator new_waypoint(Time t, ValueNode::Handle value_node)=0;
66 /*! \note this does not add any waypoint to the ValueNode! */
67 Waypoint new_waypoint_at_time(const Time& t)const;
69 WaypointList::iterator add(const Waypoint &x);
71 void erase(const UniqueID &x);
73 //either use find result (return bool and iterator) or
74 findresult find_uid(const UniqueID &x);
75 const_findresult find_uid(const UniqueID &x)const;
76 findresult find_time(const Time &x);
77 const_findresult find_time(const Time &x)const;
79 WaypointList::iterator find(const UniqueID &x);
80 WaypointList::const_iterator find(const UniqueID &x)const;
81 WaypointList::iterator find(const Time &x);
82 WaypointList::const_iterator find(const Time &x)const;
84 WaypointList::iterator find_next(const Time &x);
85 WaypointList::const_iterator find_next(const Time &x)const;
86 WaypointList::iterator find_prev(const Time &x);
87 WaypointList::const_iterator find_prev(const Time &x)const;
89 virtual ~ValueNode_Animated();
91 virtual String get_name()const;
92 virtual String get_local_name()const;
94 static Handle create(ValueBase::Type type);
96 static Handle create(const ValueBase& value, const Time& time);
98 static Handle create(ValueNode::Handle value_node, const Time& time);
100 int find(const Time& begin,const Time& end,std::vector<Waypoint*>& list);
102 void insert_time(const Time& location, const Time& delta);
105 ValueNode_Animated();
107 void set_type(ValueBase::Type t);
108 virtual void get_times_vfunc(Node::time_set &set) const;
113 }; // END of namespace synfig
115 /* === E N D =============================================================== */