1 /* === S Y N F I G ========================================================= */
2 /*! \file layer_mime.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
32 #include "layer_mime.h"
47 #include "paramdesc.h"
51 /* === U S I N G =========================================================== */
55 using namespace synfig;
57 /* === M A C R O S ========================================================= */
59 /* === G L O B A L S ======================================================= */
61 /* === P R O C E D U R E S ================================================= */
63 /* === M E T H O D S ======================================================= */
65 Layer_Mime::Layer_Mime(String x):name(x)
67 // Throw a bogus default version onto the parameter list.
68 param_list["Version"]="9";
72 Layer_Mime::get_version()const
74 return get_param("Version").get(String());
78 Layer_Mime::set_version(const String &ver)
80 return set_param("Version",ver);
84 Layer_Mime::get_local_name()const
86 return _("[MIME]")+get_name();
90 Layer_Mime::set_param(const String ¶m, const ValueBase &value)
92 // Don't try to set the name
93 if(param=="name" || param=="Name" || param=="name__")
96 // Otherwise, remember this parameter's value
97 param_list[param]=value;
102 Layer_Mime::get_param(const String ¶m)const
104 // If they are requesting the name of
105 // the layer, just return it
106 if(param=="name" || param=="Name" || param=="name__")
107 return ValueBase(name);
109 // Otherwise, return the stored parameter value
110 map<string,ValueBase>::const_iterator iter=param_list.find(param);
111 if(iter!=param_list.end())
117 Layer_Mime::get_color(Context context, const Point &pos)const
119 // A Layer_Mime layer should do nothing at all.
120 return context.get_color(pos);
124 Layer_Mime::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb)const
126 // A Layer_Mime layer should do nothing at all.
127 return context.accelerated_render(surface,quality,renddesc,cb);
131 Layer_Mime::get_param_vocab()const
134 map<string,ValueBase>::const_iterator iter;
136 // Construct the vocabulary from the stored
138 for(iter=param_list.begin();iter!=param_list.end();iter++)
140 // Make sure that we don't add the version
141 // into the vocabulary
142 if(iter->first!="Version")
143 ret.push_back(ParamDesc(iter->first));