Comment out an unused function.
[synfig.git] / synfig-core / trunk / src / synfig / loadcanvas.cpp
index 760a231..49cf6bc 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -290,6 +291,15 @@ CanvasParser::parse_integer(xmlpp::Element *element)
        return atoi(val.c_str());
 }
 
+// see 'minor hack' at the end of parse_vector() below
+// making this 'static' to give it file local scope
+// stops it working (where working means working around
+// bug #1509627)
+Vector &canvas_parser_vector_id(Vector &vector)
+{
+       return vector;
+}
+
 Vector
 CanvasParser::parse_vector(xmlpp::Element *element)
 {
@@ -332,7 +342,12 @@ CanvasParser::parse_vector(xmlpp::Element *element)
                else
                        error_unexpected_element(child,child->get_name());
        }
-       return vect;
+       // Minor hack - gcc 4.1.2 and earlier think that we're not using
+       // 'vect' and optimize it out at -O2 and higher.  This convinces
+       // them that we are really using it.
+       return canvas_parser_vector_id(vect);
+       // When the bug is fixed, we can just do this instead:
+       // return vect;
 }
 
 Color
@@ -1535,7 +1550,7 @@ CanvasParser::parse_value_node(xmlpp::Element *element,Canvas::Handle canvas)
                        return value_node;
        }
 
-       // If ValueBase::ident_type() recognises the name, then we know it's a ValueBase
+       // If ValueBase::ident_type() recognizes the name, then we know it's a ValueBase
        if(element->get_name()!="canvas" && ValueBase::ident_type(element->get_name()))
        {
                ValueBase data=parse_value(element,canvas);
@@ -1741,7 +1756,7 @@ CanvasParser::parse_layer(xmlpp::Element *element,Canvas::Handle canvas)
                                continue;
                        }
 
-                       // If we recognise the element name as a
+                       // If we recognize the element name as a
                        // ValueBase, then treat is at one
                        if(/*(*iter)->get_name()!="canvas" && */ValueBase::ident_type((*iter)->get_name()) && !dynamic_cast<xmlpp::Element*>(*iter)->get_attribute("guid"))
                        {
@@ -1974,7 +1989,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in
 
                                // If we don't have any name, warn
                                if(list.empty())
-                                       warning(child,_("blank \"name\" entitity"));
+                                       warning(child,_("blank \"name\" entity"));
 
                                string tmp;
                                for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
@@ -1989,7 +2004,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in
 
                                // If we don't have any description, warn
                                if(list.empty())
-                                       warning(child,_("blank \"desc\" entitity"));
+                                       warning(child,_("blank \"desc\" entity"));
 
                                string tmp;
                                for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
@@ -2004,7 +2019,7 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in
 
                                // If we don't have any description, warn
                                if(list.empty())
-                                       warning(child,_("blank \"author\" entitity"));
+                                       warning(child,_("blank \"author\" entity"));
 
                                string tmp;
                                for(xmlpp::Element::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
@@ -2029,7 +2044,17 @@ CanvasParser::parse_canvas(xmlpp::Element *element,Canvas::Handle parent,bool in
 
        if(canvas->value_node_list().placeholder_count())
        {
-               error(element,strprintf(_("Canvas %s has undefined ValueNodes"),canvas->get_id().c_str()));
+               String nodes;
+               for (ValueNodeList::const_iterator iter = canvas->value_node_list().begin(); iter != canvas->value_node_list().end(); iter++)
+                       if(PlaceholderValueNode::Handle::cast_dynamic(*iter))
+                       {
+                               if (nodes != "") nodes += ", ";
+                               nodes += "'" + (*iter)->get_id() + "'";
+                       }
+               error(element,strprintf(_("Canvas '%s' has undefined %s: %s"),
+                                                               canvas->get_id().c_str(),
+                                                               canvas->value_node_list().placeholder_count() == 1 ? _("ValueNode") : _("ValueNodes"),
+                                                               nodes.c_str()));
        }
 
        return canvas;
@@ -2044,7 +2069,6 @@ CanvasParser::parse_from_file(const String &file)
 Canvas::Handle
 CanvasParser::parse_from_file_as(const String &file_,const String &as_)
 {
-       CHECK_EXPIRE_TIME();
        try
        {
         ChangeLocale change_locale(LC_NUMERIC, "C");
@@ -2105,8 +2129,6 @@ CanvasParser::parse_from_file_as(const String &file_,const String &as_)
 Canvas::Handle
 CanvasParser::parse_from_string(const String &data)
 {
-       CHECK_EXPIRE_TIME();
-
        try
        {
         ChangeLocale change_locale(LC_NUMERIC, "C");