moreupdates
[synfig.git] / synfig-core / trunk / 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 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_VALUENODE_ANIMATED_H
25 #define __SYNFIG_VALUENODE_ANIMATED_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <list>
30
31 #include "valuenode.h"
32 #include "uniqueid.h"
33 #include "waypoint.h"
34
35 /* === M A C R O S ========================================================= */
36
37 /* === C L A S S E S & S T R U C T S ======================================= */
38
39 namespace synfig {
40
41 struct ValueNode_Animated : public ValueNode
42 {
43 public:
44         typedef etl::handle<ValueNode_Animated> Handle;
45         typedef etl::handle<const ValueNode_Animated> ConstHandle;
46
47         typedef synfig::Waypoint Waypoint;
48         typedef synfig::WaypointList WaypointList;
49         
50         typedef std::pair<WaypointList::iterator,bool>  findresult;
51         typedef std::pair<WaypointList::const_iterator,bool>    const_findresult;
52
53 protected:
54         WaypointList waypoint_list_;
55
56 public:
57         WaypointList &waypoint_list() { return waypoint_list_; }
58
59         const WaypointList &waypoint_list()const { return waypoint_list_; }
60
61         virtual WaypointList::iterator new_waypoint(Time t, ValueBase value)=0;
62
63         virtual WaypointList::iterator new_waypoint(Time t, ValueNode::Handle value_node)=0;
64
65         /*! \note this does not add any waypoint to the ValueNode! */
66         Waypoint new_waypoint_at_time(const Time& t)const;
67         
68         WaypointList::iterator add(const Waypoint &x);
69
70         void erase(const UniqueID &x);
71         
72         //either use find result (return bool and iterator) or 
73         findresult                      find_uid(const UniqueID &x);
74         const_findresult        find_uid(const UniqueID &x)const;
75         findresult                      find_time(const Time &x);       
76         const_findresult        find_time(const Time &x)const;
77                 
78         WaypointList::iterator find(const UniqueID &x);
79         WaypointList::const_iterator find(const UniqueID &x)const;
80         WaypointList::iterator find(const Time &x);     
81         WaypointList::const_iterator find(const Time &x)const;
82         
83         WaypointList::iterator find_next(const Time &x);
84         WaypointList::const_iterator find_next(const Time &x)const;
85         WaypointList::iterator find_prev(const Time &x);
86         WaypointList::const_iterator find_prev(const Time &x)const;
87
88         virtual ~ValueNode_Animated();
89
90         virtual String get_name()const;
91         virtual String get_local_name()const;
92
93         static Handle create(ValueBase::Type type);
94
95         static Handle create(const ValueBase& value, const Time& time);
96
97         static Handle create(ValueNode::Handle value_node, const Time& time);
98
99         int find(const Time& begin,const Time& end,std::vector<Waypoint*>& list);
100
101         void insert_time(const Time& location, const Time& delta);
102         
103 protected:
104         ValueNode_Animated();
105
106         void set_type(ValueBase::Type t);
107         virtual void get_times_vfunc(Node::time_set &set) const;
108 public:
109         DCAST_HACK_ID(4);
110 };
111
112 }; // END of namespace synfig
113
114 /* === E N D =============================================================== */
115
116 #endif