X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Ftool%2Fmain.cpp;h=b4155f476f5479c522690f10d8b3893b9d79944f;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;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..b4155f4 100644 --- a/synfig-core/trunk/src/tool/main.cpp +++ b/synfig-core/trunk/src/tool/main.cpp @@ -1,20 +1,22 @@ -/* === 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 +** Copyright (c) 2007, 2008 Chris Moore ** -** 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 */ /* ========================================================================= */ @@ -33,45 +35,55 @@ #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 +#include +#include #endif using namespace std; using namespace etl; -using namespace sinfg; +using namespace synfig; /* === M A C R O S ========================================================= */ +#ifdef ENABLE_NLS +#undef _ +#define _(x) gettext(x) +#else +#undef _ +#define _(x) (x) +#endif + 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_BORED = 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 +102,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 +132,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 +188,7 @@ public: if(clk2()<0.2) return true; clk2.reset(); - + if(scanline) seconds=(int)time+1; else @@ -185,7 +197,7 @@ public: clk.reset(); clk_scanline=scanline; } - + if(seconds<0) { clk.reset(); @@ -200,7 +212,7 @@ public: days++,hours-=24; while(days>=7) weeks++,days-=7; - + cerr<=1) + + cerr << endl << _("syntax: ") << progname << " [DEFAULT OPTIONS] ([SIF FILE] [SPECIFIC OPTIONS])..." << endl << endl; + + if(amount == 0) + Argument("--help",NULL,_("Print out usage and syntax info")); + else { Argument("-t","",_("Specify output target (Default:unknown)")); Argument("-w","",_("Set the image width (Use zero for file default)")); @@ -312,16 +326,13 @@ void display_help(int amount) Argument("-c","",_("Render the canvas with the given id instead of the root.")); Argument("-o","",_("Specify output filename")); Argument("-T","<# of threads>",_("Enable multithreaded renderer using specified # of threads")); - Argument("-b",NULL,_("Print Benchmarks")); - Argument("--fps","",_("Set the frame rate")); Argument("--time","