Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-core / tags / synfig_0_61_03 / synfig-core / src / synfig / valuenode_animated.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file valuenode_animated.h
3 **      \brief Template Header
4 **
5 **      $Id: valuenode_animated.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === S T A R T =========================================================== */
24
25 #ifndef __SYNFIG_VALUENODE_ANIMATED_H
26 #define __SYNFIG_VALUENODE_ANIMATED_H
27
28 /* === H E A D E R S ======================================================= */
29
30 #include <list>
31
32 #include "valuenode.h"
33 #include "uniqueid.h"
34 #include "waypoint.h"
35
36 /* === M A C R O S ========================================================= */
37
38 /* === C L A S S E S & S T R U C T S ======================================= */
39
40 namespace synfig {
41
42 struct ValueNode_Animated : public ValueNode
43 {
44 public:
45         typedef etl::handle<ValueNode_Animated> Handle;
46         typedef etl::handle<const ValueNode_Animated> ConstHandle;
47
48         typedef synfig::Waypoint Waypoint;
49         typedef synfig::WaypointList WaypointList;
50         
51         typedef std::pair<WaypointList::iterator,bool>  findresult;
52         typedef std::pair<WaypointList::const_iterator,bool>    const_findresult;
53
54 protected:
55         WaypointList waypoint_list_;
56
57 public:
58         WaypointList &waypoint_list() { return waypoint_list_; }
59
60         const WaypointList &waypoint_list()const { return waypoint_list_; }
61
62         virtual WaypointList::iterator new_waypoint(Time t, ValueBase value)=0;
63
64         virtual WaypointList::iterator new_waypoint(Time t, ValueNode::Handle value_node)=0;
65
66         /*! \note this does not add any waypoint to the ValueNode! */
67         Waypoint new_waypoint_at_time(const Time& t)const;
68         
69         WaypointList::iterator add(const Waypoint &x);
70
71         void erase(const UniqueID &x);
72         
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;
78                 
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;
83         
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;
88
89         virtual ~ValueNode_Animated();
90
91         virtual String get_name()const;
92         virtual String get_local_name()const;
93
94         static Handle create(ValueBase::Type type);
95
96         static Handle create(const ValueBase& value, const Time& time);
97
98         static Handle create(ValueNode::Handle value_node, const Time& time);
99
100         int find(const Time& begin,const Time& end,std::vector<Waypoint*>& list);
101
102         void insert_time(const Time& location, const Time& delta);
103         
104 protected:
105         ValueNode_Animated();
106
107         void set_type(ValueBase::Type t);
108         virtual void get_times_vfunc(Node::time_set &set) const;
109 public:
110         DCAST_HACK_ID(4);
111 };
112
113 }; // END of namespace synfig
114
115 /* === E N D =============================================================== */
116
117 #endif