** $Id: main.cpp,v 1.9 2005/01/23 04:41:10 darco Exp $
**
** \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
*/
/* ========================================================================= */
SYNFIGTOOL_INVALIDTARGET =6,
SYNFIGTOOL_RENDERFAILURE =7,
SYNFIGTOOL_BLANK =8,
- SYNFIGTOOL_BADVERSION =9
+ SYNFIGTOOL_BADVERSION =9,
+ SYNFIGTOOL_MISSINGARGUMENT =10
};
#ifndef VERSION
float last_time;
public:
- RenderProgress():clk_scanline(0) { }
+ RenderProgress():clk_scanline(0), last_time(0) { }
virtual bool
task(const String &thetask)
cerr<<PACKAGE<<" "<<VERSION<<endl;
cout<<SYNFIG_COPYRIGHT<<endl<<endl;
cerr<<"\
-** This software and associated documentation\n\
-** are CONFIDENTIAL and PROPRIETARY property of\n\
-** the above-mentioned copyright holder.\n\
+** This package is free software; you can redistribute it and/or\n\
+** modify it under the terms of the GNU General Public License as\n\
+** published by the Free Software Foundation; either version 2 of\n\
+** the License, or (at your option) any later version.\n\
**\n\
-** You may not use, copy, print, publish, or in\n\
-** any other way distribute or exploit this software\n\
-** without a prior written agreement with the\n\
-** copyright holder. " << endl << endl;
+** " << endl << endl;
arg_list.erase(iter);
return SYNFIGTOOL_HELP;
cluster.push_back(*iter);
arg_list.erase(iter);
iter=next++;
+ if (iter==arg_list.end()) {
+ error("The `%s' flag requires a value. Use --help for a list of options.", cluster.back().c_str());
+ return SYNFIGTOOL_MISSINGARGUMENT;
+ }
}
cluster.push_back(*iter);
w=atoi(iter->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);
VERBOSE_OUT(1)<<strprintf(_("Antialiasing set to %d, (%d samples per pixel)"),a,a*a)<<endl;
arg_list.erase(iter);
}
- if(*iter=="-s")
+ else if(*iter=="-s")
{
arg_list.erase(iter);
iter=next++;
VERBOSE_OUT(1)<<strprintf(_("Span set to %d units"),span)<<endl;
arg_list.erase(iter);
}
- if(*iter=="--fps")
+ else if(*iter=="--fps")
{
arg_list.erase(iter);
iter=next++;
arg_list.erase(iter);
VERBOSE_OUT(1)<<strprintf(_("Frame rate set to %d frames per second"),fps)<<endl;
}
- if(*iter=="--dpi")
+ else if(*iter=="--dpi")
{
arg_list.erase(iter);
iter=next++;
arg_list.erase(iter);
VERBOSE_OUT(1)<<strprintf(_("Physical resolution set to %f dpi"),dpi)<<endl;
}
- if(*iter=="--dpi-x")
+ else if(*iter=="--dpi-x")
{
arg_list.erase(iter);
iter=next++;
arg_list.erase(iter);
VERBOSE_OUT(1)<<strprintf(_("Physical X resolution set to %f dpi"),dpi)<<endl;
}
- if(*iter=="--dpi-y")
+ else if(*iter=="--dpi-y")
{
arg_list.erase(iter);
iter=next++;
arg_list.erase(iter);
VERBOSE_OUT(1)<<strprintf(_("Physical Y resolution set to %f dpi"),dpi)<<endl;
}
- if(*iter=="--start-time" || *iter=="--begin-time")
+ else if(*iter=="--start-time" || *iter=="--begin-time")
{
arg_list.erase(iter);
iter=next++;
desc.set_time_start(Time(*iter,desc.get_frame_rate()));
arg_list.erase(iter);
}
- if(*iter=="--end-time")
+ else if(*iter=="--end-time")
{
arg_list.erase(iter);
iter=next++;
desc.set_time_end(Time(*iter,desc.get_frame_rate()));
arg_list.erase(iter);
}
- if(*iter=="--time")
+ else if(*iter=="--time")
{
arg_list.erase(iter);
iter=next++;
VERBOSE_OUT(1)<<_("Rendering frame at ")<<desc.get_time_start().get_string(desc.get_frame_rate())<<endl;
arg_list.erase(iter);
}
- if(*iter=="-g")
+ else if(*iter=="-g")
{
synfig::warning("Gamma argument is currently ignored");
//arg_list.erase(iter);
{
arg_list_t defaults, imageargs;
+ int ret;
// Grab the defaults before the first file
- extract_arg_cluster(arg_list,defaults);
+ if ((ret = extract_arg_cluster(arg_list,defaults)) != SYNFIGTOOL_OK)
+ return ret;
while(arg_list.size())
{
job_list.front().filename=arg_list.front();
arg_list.pop_front();
- extract_arg_cluster(arg_list,imageargs);
+ if ((ret = extract_arg_cluster(arg_list,imageargs)) != SYNFIGTOOL_OK)
+ return ret;
// Open the composition
{