Fixing warnings from doxygen:
[synfig.git] / synfig-core / trunk / src / modules / lyr_std / timeloop.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file timeloop.cpp
3 **      \brief Image Layer_TimeLoop Layer Implementation
4 **
5 **      \legal
6 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
7 **
8 **      This package is free software; you can redistribute it and/or
9 **      modify it under the terms of the GNU General Public License as
10 **      published by the Free Software Foundation; either version 2 of
11 **      the License, or (at your option) any later version.
12 **
13 **      This package is distributed in the hope that it will be useful,
14 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 **      General Public License for more details.
17 **      \endlegal
18 **
19 ** === N O T E S ===========================================================
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 "timeloop.h"
33 #include <synfig/time.h>
34 #include <synfig/context.h>
35 #include <synfig/paramdesc.h>
36 #include <synfig/renddesc.h>
37 #include <synfig/value.h>
38
39 #endif
40
41 using namespace synfig;
42 using namespace std;
43 using namespace etl;
44
45 /* === M A C R O S ========================================================= */
46
47 /* === G L O B A L S ======================================================= */
48
49 SYNFIG_LAYER_INIT(Layer_TimeLoop);
50 SYNFIG_LAYER_SET_NAME(Layer_TimeLoop,"timeloop");
51 SYNFIG_LAYER_SET_LOCAL_NAME(Layer_TimeLoop,_("TimeLoop"));
52 SYNFIG_LAYER_SET_CATEGORY(Layer_TimeLoop,_("Other"));
53 SYNFIG_LAYER_SET_VERSION(Layer_TimeLoop,"0.1");
54 SYNFIG_LAYER_SET_CVS_ID(Layer_TimeLoop,"$Id: timeloop.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $");
55
56 /* === P R O C E D U R E S ================================================= */
57
58 /* === M E T H O D S ======================================================= */
59
60 Layer_TimeLoop::Layer_TimeLoop()
61 {
62         start_time=0;
63         end_time=1;
64 }
65
66 Layer_TimeLoop::~Layer_TimeLoop()
67 {
68 }
69
70 bool
71 Layer_TimeLoop::set_param(const String & param, const ValueBase &value)
72 {
73         IMPORT(start_time);
74         IMPORT(end_time);
75         return Layer::set_param(param,value);
76 }
77
78 ValueBase
79 Layer_TimeLoop::get_param(const String & param)const
80 {
81         EXPORT(start_time);
82         EXPORT(end_time);
83         EXPORT_NAME();
84         EXPORT_VERSION();
85
86         return Layer::get_param(param);
87 }
88
89 Layer::Vocab
90 Layer_TimeLoop::get_param_vocab()const
91 {
92         Layer::Vocab ret(Layer::get_param_vocab());
93
94         ret.push_back(ParamDesc("start_time")
95                 .set_local_name(_("Start Time"))
96         );
97
98         ret.push_back(ParamDesc("end_time")
99                 .set_local_name(_("End Time"))
100         );
101
102         return ret;
103 }
104
105 void
106 Layer_TimeLoop::set_time(Context context, Time time)const
107 {
108         Real diff(end_time-start_time);
109         if(diff>0)
110                 time-=int(Real(time-start_time)/diff)*diff+start_time;
111         context.set_time(time);
112 }
113
114 Color
115 Layer_TimeLoop::get_color(Context context, const Point &pos)const
116 {
117         return context.get_color(pos);
118 }
119
120 bool
121 Layer_TimeLoop::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
122 {
123         return context.accelerated_render(surface,quality,renddesc,cb);
124 }