List exported canvases recursively - exported canvases can have exported canvases...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 11 Feb 2008 02:12:25 +0000 (02:12 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 11 Feb 2008 02:12:25 +0000 (02:12 +0000)
git-svn-id: http://svn.voria.com/code@1667 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-core/trunk/src/tool/main.cpp

index fa6d785..7fa7357 100644 (file)
@@ -845,6 +845,16 @@ int extract_list_canvases(arg_list_t &arg_list,bool &list_canvases)
        return SYNFIGTOOL_OK;
 }
 
+void list_child_canvases(string prefix, Canvas::Handle canvas)
+{
+       Canvas::Children children(canvas->children());
+       for (Canvas::Children::iterator iter = children.begin(); iter != children.end(); iter++)
+       {
+               cout << prefix << ":" << (*iter)->get_id() << endl;
+               list_child_canvases(prefix + ":" + (*iter)->get_id(), *iter);
+       }
+}
+
 /* === M E T H O D S ======================================================= */
 
 /* === E N T R Y P O I N T ================================================= */
@@ -1121,10 +1131,8 @@ int main(int argc, char *argv[])
                }
                else if (job_list.front().list_canvases)
                {
-                       cerr << "Listing Canvases:" << endl;
-                       Canvas::Children children(job_list.front().canvas->children());
-                       for (Canvas::Children::iterator iter = children.begin(); iter != children.end(); iter++)
-                               cout << "  " << job_list.front().filename << "#:" << (*iter)->get_id() << endl;
+                       list_child_canvases(job_list.front().filename + "#", job_list.front().canvas);
+                       cerr << endl;
                }
                else
                {