diff --git a/src/Mod/Drawing/App/FeaturePage.cpp b/src/Mod/Drawing/App/FeaturePage.cpp index bf1af14af..684fe28cf 100644 --- a/src/Mod/Drawing/App/FeaturePage.cpp +++ b/src/Mod/Drawing/App/FeaturePage.cpp @@ -77,10 +77,8 @@ void FeaturePage::onChanged(const App::Property* prop) } if (prop == &Template) { if (!this->isRestoring()) { - cout << "setting template " << Template.getValue() << endl; - EditableTexts.setValues(getEditableTexts()); + EditableTexts.setValues(getEditableTextsFromTemplate()); } - else cout << "restoring" << endl; } App::DocumentObjectGroup::onChanged(prop); } @@ -142,13 +140,14 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) if (EditableTexts.getSize() > 0) { boost::regex e1 ("(.*?)"); string::const_iterator begin, end; - begin = ofile.str().begin(); - end = ofile.str().end(); + begin = outfragment.begin(); + end = outfragment.end(); boost::match_results what; int count = 0; while (boost::regex_search(begin, end, what, e1)) { if (count < EditableTexts.getSize()) { + // change values of editable texts boost::regex e2 ("((.*?)()"); outfragment = boost::regex_replace(outfragment, e2, "$1>"+EditableTexts.getValues()[count]+"$3"); } @@ -177,8 +176,8 @@ App::DocumentObjectExecReturn *FeaturePage::execute(void) return App::DocumentObject::StdReturn; } -std::vector FeaturePage::getEditableTexts(void) const { - //getting editable texts from "freecad:editable" tags in SVG template +std::vector FeaturePage::getEditableTextsFromTemplate(void) const { + //getting editable texts from "freecad:editable" attributes in SVG template std::vector eds; @@ -195,9 +194,9 @@ std::vector FeaturePage::getEditableTexts(void) const { string tline, tfrag; ifstream tfile (tfi.filePath().c_str()); while (!tfile.eof()) { - getline (tfile,tline); - tfrag += tline; - tfrag += "--endOfLine--"; + getline (tfile,tline); + tfrag += tline; + tfrag += "--endOfLine--"; } tfile.close(); boost::regex e ("(.*?)"); @@ -206,9 +205,8 @@ std::vector FeaturePage::getEditableTexts(void) const { tend = tfrag.end(); boost::match_results twhat; while (boost::regex_search(tbegin, tend, twhat, e)) { - printf(twhat[1].str().c_str()); - eds.push_back(twhat[2]); - tbegin = twhat[0].second; + eds.push_back(twhat[2]); + tbegin = twhat[0].second; } } return eds; diff --git a/src/Mod/Drawing/App/FeaturePage.h b/src/Mod/Drawing/App/FeaturePage.h index 3f74065b7..8f03c76d4 100644 --- a/src/Mod/Drawing/App/FeaturePage.h +++ b/src/Mod/Drawing/App/FeaturePage.h @@ -59,7 +59,7 @@ public: virtual const char* getViewProviderName(void) const { return "DrawingGui::ViewProviderDrawingPage"; } - virtual std::vector getEditableTexts(void) const; + virtual std::vector getEditableTextsFromTemplate(void) const; protected: void onChanged(const App::Property* prop);