X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Flyr_std%2Fimport.cpp;h=f7385a953b7fea998a923f2db5dea777d21e5a97;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=bf5f32e314d0890869f3acb1649582d68512b02f;hpb=5ddcf36f04cfbd10fabda4e3c5633cb27cdd4c0a;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 bf5f32e..f7385a9 100644 --- a/synfig-core/trunk/src/modules/lyr_std/import.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/import.cpp @@ -1,9 +1,12 @@ -/*! ======================================================================== -** 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 Implementation of the "Import Image" layer ** +** $Id$ +** +** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -14,6 +17,7 @@ ** 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 =========================================================== ** @@ -51,10 +55,10 @@ using namespace etl; SYNFIG_LAYER_INIT(Import); SYNFIG_LAYER_SET_NAME(Import,"import"); -SYNFIG_LAYER_SET_LOCAL_NAME(Import,_("Import")); -SYNFIG_LAYER_SET_CATEGORY(Import,_("Other")); +SYNFIG_LAYER_SET_LOCAL_NAME(Import,N_("Import Image")); +SYNFIG_LAYER_SET_CATEGORY(Import,N_("Other")); SYNFIG_LAYER_SET_VERSION(Import,"0.1"); -SYNFIG_LAYER_SET_CVS_ID(Import,"$Id: import.cpp,v 1.2 2005/03/19 04:26:42 darco Exp $"); +SYNFIG_LAYER_SET_CVS_ID(Import,"$Id$"); /* === P R O C E D U R E S ================================================= */ @@ -80,7 +84,7 @@ Import::set_param(const String & param, const ValueBase &value) { try{ IMPORT(time_offset); - if(param=="filename" && value.same_as(filename)) + if(param=="filename" && value.same_type_as(filename)) { if(!get_canvas()) { @@ -95,7 +99,7 @@ Import::set_param(const String & param, const ValueBase &value) // Get rid of any %20 crap { - unsigned int n; + String::size_type n; while((n=newfilename.find("%20"))!=String::npos) newfilename.replace(n,3," "); } @@ -140,7 +144,7 @@ Import::set_param(const String & param, const ValueBase &value) if(is_absolute_path(newfilename)) filename_with_path=newfilename; else - filename_with_path=get_canvas()->get_file_path()+ETL_DIRECTORY_SEPERATOR+newfilename; + filename_with_path=get_canvas()->get_file_path()+ETL_DIRECTORY_SEPARATOR+newfilename; handle newimporter; @@ -148,7 +152,7 @@ Import::set_param(const String & param, const ValueBase &value) if(!newimporter) { - newimporter=Importer::open(get_canvas()->get_file_path()+ETL_DIRECTORY_SEPERATOR+basename(newfilename)); + newimporter=Importer::open(get_canvas()->get_file_path()+ETL_DIRECTORY_SEPARATOR+basename(newfilename)); if(!newimporter) { synfig::error(strprintf("Unable to create an importer object with file \"%s\"",filename_with_path.c_str())); @@ -158,7 +162,7 @@ Import::set_param(const String & param, const ValueBase &value) } surface.clear(); - if(!newimporter->get_frame(surface,Time(0))) + if(!newimporter->get_frame(surface,Time(0),trimmed,width,height,top,left)) { synfig::warning(strprintf("Unable to get frame from \"%s\"",filename_with_path.c_str())); } @@ -216,15 +220,19 @@ Import::get_param_vocab()const void Import::set_time(Context context, Time time)const { - if(get_amount() && importer && importer->is_animated())importer->get_frame(surface,time+time_offset); - //else surface.clear(); + if(get_amount() && importer && + importer->is_animated()) + importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left); + context.set_time(time); } void Import::set_time(Context context, Time time, const Point &pos)const { - if(get_amount() && importer && importer->is_animated())importer->get_frame(surface,time+time_offset); - //else surface.clear(); + if(get_amount() && importer && + importer->is_animated()) + importer->get_frame(surface,time+time_offset,trimmed,width,height,top,left); + context.set_time(time,pos); }