X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fmodules%2Fmod_svg%2Flayer_svg.cpp;fp=synfig-core%2Fsrc%2Fmodules%2Fmod_svg%2Flayer_svg.cpp;h=29060797a09445ffd47e2e45f5807283ca222947;hb=a095981e18cc37a8ecc7cd237cc22b9c10329264;hp=0000000000000000000000000000000000000000;hpb=9459638ad6797b8139f1e9f0715c96076dbf0890;p=synfig.git diff --git a/synfig-core/src/modules/mod_svg/layer_svg.cpp b/synfig-core/src/modules/mod_svg/layer_svg.cpp new file mode 100644 index 0000000..2906079 --- /dev/null +++ b/synfig-core/src/modules/mod_svg/layer_svg.cpp @@ -0,0 +1,103 @@ +/* === S Y N F I G ========================================================= */ +/*! \file layer_svg.cpp +** \brief Implementation of the Svg layer +** +** $Id:$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2008 Chris Moore +** Copyright (c) 2009 Carlos A. Sosa Navarro +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === H E A D E R S ======================================================= */ + +#ifdef USING_PCH +# include "pch.h" +#else +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include "layer_svg.h" + +#endif + +/* === U S I N G =========================================================== */ + +using namespace etl; +using namespace std; +using namespace synfig; + +/* === G L O B A L S ======================================================= */ + +SYNFIG_LAYER_INIT(svg_layer); +SYNFIG_LAYER_SET_NAME(svg_layer,"svg_layer"); +SYNFIG_LAYER_SET_LOCAL_NAME(svg_layer,N_("Import Svg")); +SYNFIG_LAYER_SET_CATEGORY(svg_layer,N_("NotVisible"));//this is auxiliar +SYNFIG_LAYER_SET_VERSION(svg_layer,"0.1"); +SYNFIG_LAYER_SET_CVS_ID(svg_layer,"$Id: layer_svg.cpp 2240 2008-11-22 15:35:33Z dooglus $"); + +/* === P R O C E D U R E S ================================================= */ + +svg_layer::svg_layer(): + Layer_PasteCanvas(), + filename("none") +{ +} + +bool +svg_layer::set_param(const String & param, const ValueBase &value) +{ + if(param=="filename"){ + Canvas::Handle canvas; + //if ext of filename == "svg" then + canvas=open_svg(value.get(String()),errors,warnings); + //else other parsers maybe + if(canvas){ + canvas->set_inline(get_canvas()); + set_sub_canvas(canvas); + IMPORT(filename); + } + } + return Layer_PasteCanvas::set_param(param,value); +} + +ValueBase +svg_layer::get_param(const String ¶m)const +{ + EXPORT(filename); + EXPORT_NAME(); + EXPORT_VERSION(); + + return Layer_PasteCanvas::get_param(param); +} + +Layer::Vocab +svg_layer::get_param_vocab()const +{ + Layer::Vocab ret(Layer_PasteCanvas::get_param_vocab()); + + ret.push_back(ParamDesc("filename") + .set_local_name(_("Filename")) + ); + return ret; +} +