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