Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_const.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file valuenode_const.cpp
3 **      \brief Implementation of the "Constant" valuenode conversion.
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         if (getenv("SYNFIG_DEBUG_VALUENODE_OPERATORS"))
91                 printf("%s:%d operator()\n", __FILE__, __LINE__);
92
93         return value;
94 }
95
96
97 const ValueBase &
98 ValueNode_Const::get_value()const
99 {
100         return value;
101 }
102
103 ValueBase &
104 ValueNode_Const::get_value()
105 {
106         return value;
107 }
108
109 void
110 ValueNode_Const::set_value(const ValueBase &data)
111 {
112         if(data!=value)
113         {
114                 value=data;
115                 changed();
116         }
117 }
118
119
120 String
121 ValueNode_Const::get_name()const
122 {
123         return "constant";
124 }
125
126 String
127 ValueNode_Const::get_local_name()const
128 {
129         return _("Constant");
130 }
131
132 void ValueNode_Const::get_times_vfunc(Node::time_set &/*set*/) const
133 {
134 }