X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Flyr_std%2Fimport.cpp;h=708ddd8ca7859a1651a43dbcad7bef2242574f9d;hb=70bcefce2ab011a11014f36fc129b473cc0bc61e;hp=29df89799ecfd2c3578d218f0c26e494600ac45a;hpb=28f28705612902c15cd0702cc891fba35bf2d2df;p=synfig.git diff --git a/synfig-core/trunk/src/modules/lyr_std/import.cpp b/synfig-core/trunk/src/modules/lyr_std/import.cpp index 29df897..708ddd8 100644 --- a/synfig-core/trunk/src/modules/lyr_std/import.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/import.cpp @@ -1,18 +1,20 @@ -/*! ======================================================================== -** Synfig -** Image Import Layer Implementation -** $Id: import.cpp,v 1.2 2005/03/19 04:26:42 darco Exp $ +/* === S Y N F I G ========================================================= */ +/*! \file import.cpp +** \brief Image Import Layer Implementation ** -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** 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. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** 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 ** ** === N O T E S =========================================================== ** @@ -88,29 +90,29 @@ Import::set_param(const String & param, const ValueBase &value) surface.clear(); return true; } - + String newfilename=value.get(string()); String filename_with_path; - + // Get rid of any %20 crap { unsigned int n; while((n=newfilename.find("%20"))!=String::npos) newfilename.replace(n,3," "); } - + //if(get_canvas()->get_file_path()==dirname(newfilename)) //{ // synfig::info("Image seems to be in local directory. Adjusting path..."); // newfilename=basename(newfilename); //} - + #ifndef WIN32 if(is_absolute_path(newfilename)) { string curpath(cleanup_path(absolute_path(get_canvas()->get_file_path()))); while(basename(curpath)==".")curpath=dirname(curpath); - + newfilename=relative_path(curpath,newfilename); synfig::info("basename(curpath)=%s, Path adjusted to %s",basename(curpath).c_str(),newfilename.c_str()); } @@ -126,23 +128,23 @@ Import::set_param(const String & param, const ValueBase &value) surface.clear(); return true; } - + // If we are already loaded, don't reload if(filename==newfilename && importer) { synfig::warning(strprintf(_("Filename seems to already be set to \"%s\" (%s)"),filename.c_str(),newfilename.c_str())); return true; } - + assert(get_canvas()); - + if(is_absolute_path(newfilename)) filename_with_path=newfilename; else filename_with_path=get_canvas()->get_file_path()+ETL_DIRECTORY_SEPERATOR+newfilename; - + handle newimporter; - + newimporter=Importer::open(absolute_path(filename_with_path)); if(!newimporter) @@ -165,11 +167,11 @@ Import::set_param(const String & param, const ValueBase &value) importer=newimporter; filename=newfilename; abs_filename=absolute_path(filename_with_path); - + return true; } } catch(...) { set_amount(0); return false; } - + return Layer_Bitmap::set_param(param,value); } @@ -191,15 +193,15 @@ Import::get_param(const String & param)const EXPORT_NAME(); EXPORT_VERSION(); - - return Layer_Bitmap::get_param(param); + + return Layer_Bitmap::get_param(param); } Layer::Vocab Import::get_param_vocab()const { Layer::Vocab ret(Layer_Bitmap::get_param_vocab()); - + ret.push_back(ParamDesc("filename") .set_local_name(_("Filename")) .set_description(_("File to import")) @@ -208,7 +210,7 @@ Import::get_param_vocab()const ret.push_back(ParamDesc("time_offset") .set_local_name(_("Time Offset")) ); - + return ret; }