]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MacroTable.cpp
... and RELEASE-NOTES
[lyx.git] / src / mathed / MacroTable.cpp
index 2d29f520e99657d65261c8645d477dd0dc313823..5a61a8ba581176b382a64e9bb13e6ef2d1d973b6 100644 (file)
@@ -68,8 +68,7 @@ bool MacroData::expand(vector<MathData> const & args, MathData & to) const
        updateData();
 
        // Hack. Any inset with a cell would do.
-       static InsetMathSqrt inset(0);
-       inset.setBuffer(const_cast<Buffer &>(*buffer_));
+       InsetMathSqrt inset(const_cast<Buffer *>(buffer_));
 
        docstring const & definition(display_.empty() ? definition_ : display_);
        asArray(definition, inset.cell(0));
@@ -201,7 +200,8 @@ int MacroData::write(odocstream & os, bool overwriteRedefinition) const
        // output template
        MathMacroTemplate const & tmpl =
                static_cast<MathMacroTemplate const &>(*inset);
-       WriteStream wi(os, false, true, WriteStream::wsDefault);
+       otexrowstream ots(os);
+       WriteStream wi(ots, false, true, WriteStream::wsDefault);
        return tmpl.write(wi, overwriteRedefinition);
 }
 
@@ -244,7 +244,8 @@ MacroTable::iterator
 MacroTable::insert(Buffer * buf, docstring const & def)
 {
        //lyxerr << "MacroTable::insert, def: " << to_utf8(def) << endl;
-       MathMacroTemplate mac(buf, def);
+       MathMacroTemplate mac(buf);
+       mac.fromString(def);
        MacroData data(buf, mac);
        return insert(mac.name(), data);
 }