From fd21b02845a8ff5f678a3b7b7ad511c124e56137 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 19 Jun 2014 15:29:51 +0100 Subject: [PATCH] Made the SVG parser set the component ID of the drawables it creates. --- .../juce_gui_basics/drawables/juce_SVGParser.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index a61f0ac2fe..f5dbcd9ffd 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -54,7 +54,7 @@ public: DrawableComposite* const drawable = new DrawableComposite(); - drawable->setName (xml->getStringAttribute ("id")); + setDrawableID (*drawable, xml); SVGState newState (*this); @@ -363,6 +363,13 @@ private: AffineTransform transform; String cssStyleText; + static void setDrawableID (Drawable& d, const XmlPath& xml) + { + String compID (xml->getStringAttribute ("id")); + d.setName (compID); + d.setComponentID (compID); + } + //============================================================================== void parseSubElements (const XmlPath& xml, DrawableComposite& parentDrawable) { @@ -402,7 +409,7 @@ private: { DrawableComposite* const drawable = new DrawableComposite(); - drawable->setName (xml->getStringAttribute ("id")); + setDrawableID (*drawable, xml); if (xml->hasAttribute ("transform")) { @@ -547,7 +554,7 @@ private: } DrawablePath* dp = new DrawablePath(); - dp->setName (xml->getStringAttribute ("id")); + setDrawableID (*dp, xml); dp->setFill (Colours::transparentBlack); path.applyTransform (transform);