Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / modules / mod_svg / layer_svg.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file layer_svg.cpp
3 **      \brief Implementation of the Svg layer
4 **
5 **      $Id:$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **      Copyright (c) 2008 Chris Moore
10 **      Copyright (c) 2009 Carlos A. Sosa Navarro
11 **
12 **      This package is free software; you can redistribute it and/or
13 **      modify it under the terms of the GNU General Public License as
14 **      published by the Free Software Foundation; either version 2 of
15 **      the License, or (at your option) any later version.
16 **
17 **      This package is distributed in the hope that it will be useful,
18 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
19 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 **      General Public License for more details.
21 **      \endlegal
22 */
23 /* ========================================================================= */
24
25 /* === H E A D E R S ======================================================= */
26
27 #ifdef USING_PCH
28 #       include "pch.h"
29 #else
30 #ifdef HAVE_CONFIG_H
31 #       include <config.h>
32 #endif
33
34 #include <synfig/string.h>
35 #include <synfig/paramdesc.h>
36 #include <synfig/value.h>
37 #include <synfig/valuenode.h>
38
39 #include "layer_svg.h"
40
41 #endif
42
43 /* === U S I N G =========================================================== */
44
45 using namespace etl;
46 using namespace std;
47 using namespace synfig;
48
49 /* === G L O B A L S ======================================================= */
50
51 SYNFIG_LAYER_INIT(svg_layer);
52 SYNFIG_LAYER_SET_NAME(svg_layer,"svg_layer");
53 SYNFIG_LAYER_SET_LOCAL_NAME(svg_layer,N_("Import Svg"));
54 SYNFIG_LAYER_SET_CATEGORY(svg_layer,N_("NotVisible"));//this is auxiliar
55 SYNFIG_LAYER_SET_VERSION(svg_layer,"0.1");
56 SYNFIG_LAYER_SET_CVS_ID(svg_layer,"$Id: layer_svg.cpp 2240 2008-11-22 15:35:33Z dooglus $");
57
58 /* === P R O C E D U R E S ================================================= */
59
60 svg_layer::svg_layer():
61         Layer_PasteCanvas(),
62         filename("none")
63 {
64 }
65
66 bool
67 svg_layer::set_param(const String & param, const ValueBase &value)
68 {
69         if(param=="filename"){
70                 Canvas::Handle canvas;
71                 //if ext of filename == "svg" then
72                 canvas=open_svg(value.get(String()),errors,warnings);
73                 //else other parsers maybe
74                 if(canvas){
75                         canvas->set_inline(get_canvas());
76                         set_sub_canvas(canvas);
77                         IMPORT(filename);
78                 }
79         }
80         return Layer_PasteCanvas::set_param(param,value);
81 }
82
83 ValueBase
84 svg_layer::get_param(const String &param)const
85 {
86         EXPORT(filename);
87         EXPORT_NAME();
88         EXPORT_VERSION();
89
90         return Layer_PasteCanvas::get_param(param);
91 }
92
93 Layer::Vocab
94 svg_layer::get_param_vocab()const
95 {
96         Layer::Vocab ret(Layer_PasteCanvas::get_param_vocab());
97
98         ret.push_back(ParamDesc("filename")
99                 .set_local_name(_("Filename"))
100         );
101         return ret;
102 }
103