From: dooglus Date: Tue, 15 Jan 2008 14:58:07 +0000 (+0000) Subject: Changes related to loading .sif files containing mnemonic attributes for Composite... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=58ac9c8e2a4fb012ec3d163132332dfcdfc383ee;p=synfig.git Changes related to loading .sif files containing mnemonic attributes for Composite ValueNodes. git-svn-id: http://svn.voria.com/code@1381 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/loadcanvas.cpp b/synfig-core/trunk/src/synfig/loadcanvas.cpp index fa5eb40..fc6fbee 100644 --- a/synfig-core/trunk/src/synfig/loadcanvas.cpp +++ b/synfig-core/trunk/src/synfig/loadcanvas.cpp @@ -1255,7 +1255,7 @@ CanvasParser::parse_composite(xmlpp::Element *element,Canvas::Handle canvas) for(i=0;ilink_count();i++) { - string name=strprintf("c%d",i+1); + string name=value_node->link_name(i); if(c[i]) { error(element,name+" was already defined in "); @@ -1282,15 +1282,22 @@ CanvasParser::parse_composite(xmlpp::Element *element,Canvas::Handle canvas) xmlpp::Element *child(dynamic_cast(*iter)); if(!child) continue; - else + + string child_name = child->get_name(); for(i=0;ilink_count();i++) { - string name=strprintf("c%d",i+1); - if(child->get_name()==name) + string name=value_node->link_name(i); + int old_index = -1; + + if (child_name.size() == 2 && child_name[0] == 'c') + old_index = child_name[1] - '1'; + + if ((old_index != -1 && old_index == i) || + (old_index == -1 && value_node->get_link_index_from_name(child_name) == i)) { if(c[i]) { - error(child,name+" was already defined in "); + error(child,child_name+" was already defined in "); break; } @@ -1303,7 +1310,7 @@ CanvasParser::parse_composite(xmlpp::Element *element,Canvas::Handle canvas) if(iter==list.end()) { - error(child,strprintf(_("<%s> is missing its contents"),name.c_str())); + error(child,strprintf(_("<%s> is missing its contents"),child_name.c_str())); break; } @@ -1311,13 +1318,13 @@ CanvasParser::parse_composite(xmlpp::Element *element,Canvas::Handle canvas) if(!c[i]) { - error((*iter),"Parse of "+name+" ValueNode failed"); + error((*iter),"Parse of "+child_name+" ValueNode failed"); break; } if(!value_node->set_link(i,c[i])) { - error(child,strprintf(_("<%s> has a bad value"),name.c_str())); + error(child,strprintf(_("<%s> has a bad value"),child_name.c_str())); break; } @@ -1326,7 +1333,7 @@ CanvasParser::parse_composite(xmlpp::Element *element,Canvas::Handle canvas) } } // somewhat of a hack, but it works - if(i==value_node->link_count()) error_unexpected_element(child,child->get_name()); + if(i==value_node->link_count()) error_unexpected_element(child,child_name); } switch(value_node->link_count())