more updates
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_const.cpp
1 /* === S I N F G =========================================================== */
2 /*!     \file template.cpp
3 **      \brief Template File
4 **
5 **      $Id: valuenode_const.cpp,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 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include "valuenode_const.h"
32 #include "general.h"
33
34 #endif
35
36 /* === U S I N G =========================================================== */
37
38 using namespace std;
39 using namespace etl;
40 using namespace sinfg;
41
42 /* === M A C R O S ========================================================= */
43
44 /* === G L O B A L S ======================================================= */
45
46 /* === P R O C E D U R E S ================================================= */
47
48 /* === M E T H O D S ======================================================= */
49
50 ValueNode_Const::ValueNode_Const()
51 {
52         DCAST_HACK_ENABLE();
53 }
54
55
56 ValueNode_Const::ValueNode_Const(const ValueBase &x):
57         ValueNode       (x.get_type()),
58         value           (x)
59 {
60         DCAST_HACK_ENABLE();
61 }
62
63
64 ValueNode_Const*
65 ValueNode_Const::create(const ValueBase &x)
66 {
67         return new ValueNode_Const(x);
68 }
69
70
71 ValueNode*
72 ValueNode_Const::clone(const GUID& deriv_guid)const
73 {
74         { ValueNode* x(find_value_node(get_guid()^deriv_guid).get()); if(x)return x; }
75         ValueNode* ret(new ValueNode_Const(value));
76         ret->set_guid(get_guid()^deriv_guid);
77         return ret;
78 }
79
80
81 ValueNode_Const::~ValueNode_Const()
82 {
83 }
84
85
86 ValueBase
87 ValueNode_Const::operator()(Time t)const
88 {
89         return value;
90 }
91
92
93 const ValueBase &
94 ValueNode_Const::get_value()const
95 {
96         return value;
97 }
98
99 ValueBase &
100 ValueNode_Const::get_value()
101 {
102         return value;
103 }
104
105 void
106 ValueNode_Const::set_value(const ValueBase &data)
107 {
108         if(data!=value)
109         {
110                 value=data;
111                 changed();
112         }
113 }
114
115
116 String
117 ValueNode_Const::get_name()const
118 {
119         return "constant";
120 }
121
122 String
123 ValueNode_Const::get_local_name()const
124 {
125         return _("Constant");
126 }
127
128 void ValueNode_Const::get_times_vfunc(Node::time_set &set) const
129 {
130 }