X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Ftool%2Fmain.cpp;h=14f6b74dea1370234ff3a5443e0e6510551ddb06;hb=19814e54d027ea1a98c532218966212298b9b555;hp=794e0d10ea5342a553650e2720709e8a68a0db92;hpb=16b3beced25134bef064705568ecb893a6be4e79;p=synfig.git diff --git a/synfig-core/trunk/src/tool/main.cpp b/synfig-core/trunk/src/tool/main.cpp index 794e0d1..14f6b74 100644 --- a/synfig-core/trunk/src/tool/main.cpp +++ b/synfig-core/trunk/src/tool/main.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ -/*! \file main.cpp -** \brief SINFG Tool +/* === S Y N F I G ========================================================= */ +/*! \file tool/main.cpp +** \brief SYNFIG Tool ** -** $Id: main.cpp,v 1.9 2005/01/23 04:41:10 darco Exp $ +** $Id$ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** 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 */ /* ========================================================================= */ @@ -34,44 +35,45 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #endif using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; /* === M A C R O S ========================================================= */ enum exit_code { - SINFGTOOL_OK =0, - SINFGTOOL_FILENOTFOUND =1, - SINFGTOOL_BORRED =2, - SINFGTOOL_HELP =3, - SINFGTOOL_UNKNOWNARGUMENT =4, - SINFGTOOL_UNKNOWNERROR =5, - SINFGTOOL_INVALIDTARGET =6, - SINFGTOOL_RENDERFAILURE =7, - SINFGTOOL_BLANK =8, - SINFGTOOL_BADVERSION =9 + SYNFIGTOOL_OK =0, + SYNFIGTOOL_FILENOTFOUND =1, + SYNFIGTOOL_BORRED =2, + SYNFIGTOOL_HELP =3, + SYNFIGTOOL_UNKNOWNARGUMENT =4, + SYNFIGTOOL_UNKNOWNERROR =5, + SYNFIGTOOL_INVALIDTARGET =6, + SYNFIGTOOL_RENDERFAILURE =7, + SYNFIGTOOL_BLANK =8, + SYNFIGTOOL_BADVERSION =9, + SYNFIGTOOL_MISSINGARGUMENT =10 }; #ifndef VERSION #define VERSION "unknown" -#define PACKAGE "sinfg-tool" +#define PACKAGE "synfig-tool" #endif #ifdef DEFAULT_QUALITY @@ -90,14 +92,14 @@ bool print_benchmarks=false; /* === M E T H O D S ======================================================= */ -class Progress : public sinfg::ProgressCallback +class Progress : public synfig::ProgressCallback { const char *program; - + public: - + Progress(const char *name):program(name) { } - + virtual bool task(const String &task) { @@ -120,25 +122,25 @@ public: } virtual bool - amount_complete(int current, int total) + amount_complete(int /*current*/, int /*total*/) { return true; } }; -class RenderProgress : public sinfg::ProgressCallback +class RenderProgress : public synfig::ProgressCallback { string taskname; - + etl::clock clk; int clk_scanline; // The scanline at which the clock was reset etl::clock clk2; - float last_time; + float last_time; public: - - RenderProgress():clk_scanline(0) { } - + + RenderProgress():clk_scanline(0), last_time(0) { } + virtual bool task(const String &thetask) { @@ -176,7 +178,7 @@ public: if(clk2()<0.2) return true; clk2.reset(); - + if(scanline) seconds=(int)time+1; else @@ -185,7 +187,7 @@ public: clk.reset(); clk_scanline=scanline; } - + if(seconds<0) { clk.reset(); @@ -200,7 +202,7 @@ public: days++,hours-=24; while(days>=7) weeks++,days-=7; - + cerr<>8)<<'.'<<((__TCPLUSPLUS__&255)>>4)<<'.'<<(__TCPLUSPLUS__&15); #endif - cout<first<get_name()<get_local_name()<get_version()<first<first<first<first<begin() != '-') { //cerr<<*iter->begin()<<"-----------"<c_str()); arg_list.erase(iter); } - if(*iter=="-h") + else if(*iter=="-h") { arg_list.erase(iter); iter=next++; h=atoi(iter->c_str()); arg_list.erase(iter); } - if(*iter=="-a") + else if(*iter=="-a") { int a; arg_list.erase(iter); @@ -606,7 +610,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc) VERBOSE_OUT(1)<c_str()))); - //arg_list.erase(iter); + arg_list.erase(iter); } } if(w&&h) @@ -704,7 +708,7 @@ int extract_RendDesc(arg_list_t &arg_list,RendDesc &desc) } if(span) desc.set_span(span); - return SINFGTOOL_OK; + return SYNFIGTOOL_OK; } int extract_quality(arg_list_t &arg_list,int &quality) @@ -721,8 +725,8 @@ int extract_quality(arg_list_t &arg_list,int &quality) arg_list.erase(iter); } } - - return SINFGTOOL_OK; + + return SYNFIGTOOL_OK; } int extract_threads(arg_list_t &arg_list,int &threads) @@ -739,15 +743,15 @@ int extract_threads(arg_list_t &arg_list,int &threads) arg_list.erase(iter); } } - - return SINFGTOOL_OK; + + return SYNFIGTOOL_OK; } int extract_target(arg_list_t &arg_list,string &type) { arg_list_t::iterator iter, next; type.clear(); - + for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++) { if(*iter=="-t") @@ -759,14 +763,14 @@ int extract_target(arg_list_t &arg_list,string &type) } } - return SINFGTOOL_OK; + return SYNFIGTOOL_OK; } int extract_append(arg_list_t &arg_list,string &filename) { arg_list_t::iterator iter, next; filename.clear(); - + for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++) { if(*iter=="--append") @@ -778,15 +782,15 @@ int extract_append(arg_list_t &arg_list,string &filename) } } - return SINFGTOOL_OK; + return SYNFIGTOOL_OK; } int extract_outfile(arg_list_t &arg_list,string &outfile) { arg_list_t::iterator iter, next; - int ret=SINFGTOOL_FILENOTFOUND; + int ret=SYNFIGTOOL_FILENOTFOUND; outfile.clear(); - + for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++) { if(*iter=="-o") @@ -795,7 +799,7 @@ int extract_outfile(arg_list_t &arg_list,string &outfile) iter=next++; outfile=*iter; arg_list.erase(iter); - ret=SINFGTOOL_OK; + ret=SYNFIGTOOL_OK; } } @@ -806,7 +810,7 @@ int extract_canvasid(arg_list_t &arg_list,string &canvasid) { arg_list_t::iterator iter, next; //canvasid.clear(); - + for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++) { if(*iter=="-c") @@ -818,7 +822,7 @@ int extract_canvasid(arg_list_t &arg_list,string &canvasid) } } - return SINFGTOOL_OK; + return SYNFIGTOOL_OK; } /* === M E T H O D S ======================================================= */ @@ -830,48 +834,51 @@ int main(int argc, char *argv[]) int i; arg_list_t arg_list; job_list_t job_list; - + progname=argv[0]; Progress p(argv[0]); - - if(!SINFG_CHECK_VERSION()) + + if(!SYNFIG_CHECK_VERSION()) { - cerr<<_("FATAL: Sinfg Version Mismatch")<set_time(0); - + string canvasid; extract_canvasid(imageargs,canvasid); if(!canvasid.empty()) @@ -900,7 +907,7 @@ int main(int argc, char *argv[]) cerr<<_("Throwing out job...")<rend_desc()); extract_target(imageargs,target_name); extract_threads(imageargs,threads); @@ -942,25 +949,20 @@ int main(int argc, char *argv[]) VERBOSE_OUT(2)<<_("Appended contents of ")<set_canvas(job_list.front().canvas); - VERBOSE_OUT(4)<<_("Setting the quality of the target...")<set_quality(job_list.front().quality); } - + // Set the threads for the target if(job_list.front().target && Target_Scanline::Handle::cast_dynamic(job_list.front().target)) { Target_Scanline::Handle::cast_dynamic(job_list.front().target)->set_threads(threads); } - + if(imageargs.size()) { cerr<<_("Unidentified arguments for ")< "+job_list.front().outfilename); if(!job_list.front().sifout) @@ -1079,7 +1081,7 @@ int main(int argc, char *argv[]) if(!job_list.front().target->render(&p)) { cerr<<"Render Failure."<