From c96b60b2dfad806d2b69829afa9ae2098b4f85ea Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 11 Feb 2008 02:12:02 +0000 Subject: [PATCH] Add option '--list-canvases' to list exported canvases. git-svn-id: http://svn.voria.com/code@1665 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/tool/main.cpp | 45 +++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/synfig-core/trunk/src/tool/main.cpp b/synfig-core/trunk/src/tool/main.cpp index 370e8bb..238d23a 100644 --- a/synfig-core/trunk/src/tool/main.cpp +++ b/synfig-core/trunk/src/tool/main.cpp @@ -258,6 +258,7 @@ struct Job int quality; bool sifout; + bool list_canvases; }; typedef list arg_list_t; @@ -335,6 +336,7 @@ void display_help(int amount) Argument("--dpi","",_("Set the physical resolution (dots-per-inch)")); Argument("--dpi-x","",_("Set the physical X resolution (dots-per-inch")); Argument("--dpi-y","",_("Set the physical Y resolution (dots-per-inch)")); + Argument("--list-canvases",NULL,_("List the exported canvases in the composition")); Argument("--append","",_("Append layers in to composition")); Argument("--layer-info","",_("Print out layer's description, parameter info, etc.")); Argument("--layers",NULL,_("Print out the list of available layers")); @@ -826,6 +828,20 @@ int extract_canvasid(arg_list_t &arg_list,string &canvasid) return SYNFIGTOOL_OK; } +int extract_list_canvases(arg_list_t &arg_list,bool &list_canvases) +{ + arg_list_t::iterator iter, next; + + for(next=arg_list.begin(),iter=next++;iter!=arg_list.end();iter=next++) + if(*iter=="--list-canvases") + { + list_canvases = true; + arg_list.erase(iter); + } + + return SYNFIGTOOL_OK; +} + /* === M E T H O D S ======================================================= */ /* === E N T R Y P O I N T ================================================= */ @@ -898,6 +914,10 @@ int main(int argc, char *argv[]) continue; } + bool list_canvases = false; + extract_list_canvases(imageargs, list_canvases); + job_list.front().list_canvases = list_canvases; + job_list.front().root->set_time(0); string canvasid; @@ -1092,7 +1112,22 @@ int main(int argc, char *argv[]) RenderProgress p; p.task(job_list.front().filename+" ==> "+job_list.front().outfilename); - if(!job_list.front().sifout) + if(job_list.front().sifout) + { + if(!save_canvas(job_list.front().outfilename,job_list.front().canvas)) + { + cerr<<"Render Failure."<children()); + for (Canvas::Children::iterator iter = children.begin(); iter != children.end(); iter++) + cout << " " << job_list.front().filename << "#:" << (*iter)->get_id() << endl; + } + else { VERBOSE_OUT(1)<<_("Rendering...")<