From ae60474513f473e86fa7cc9decd06a7a65ac797c Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Sun, 15 Nov 2009 12:30:26 +0000 Subject: [PATCH] Get math macros working for MathML. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32004 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetCode.h | 2 ++ src/mathed/MathMacro.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/insets/InsetCode.h b/src/insets/InsetCode.h index 841ae0d0c7..38ed7718af 100644 --- a/src/insets/InsetCode.h +++ b/src/insets/InsetCode.h @@ -218,6 +218,8 @@ enum InsetCode { MATH_XYMATRIX_CODE, /// MATH_MACRO_CODE, + /// + ARGUMENT_PROXY_CODE, // 100 }; } // namespace lyx diff --git a/src/mathed/MathMacro.cpp b/src/mathed/MathMacro.cpp index f1aeb13293..3da0421aba 100644 --- a/src/mathed/MathMacro.cpp +++ b/src/mathed/MathMacro.cpp @@ -59,6 +59,8 @@ public: asArray(def, def_); } /// + InsetCode lyxCode() const { return ARGUMENT_PROXY_CODE; } + /// void metrics(MetricsInfo & mi, Dimension & dim) const { mathMacro_.macro()->unlock(); mathMacro_.cell(idx_).metrics(mi, dim); @@ -69,6 +71,9 @@ public: mathMacro_.macro()->lock(); } + // FIXME Other external things need similar treatment. + /// + void mathmlize(MathStream & ms) const { ms << mathMacro_.cell(idx_); } /// void draw(PainterInfo & pi, int x, int y) const { if (mathMacro_.editMetrics(pi.base.bv)) { @@ -127,7 +132,7 @@ Inset * MathMacro::clone() const { MathMacro * copy = new MathMacro(*this); copy->needsUpdate_ = true; - copy->expanded_.cell(0).clear(); + //copy->expanded_.cell(0).clear(); return copy; } @@ -325,10 +330,9 @@ void MathMacro::updateRepresentation() proxy = new ArgumentProxy(*this, i); values[i].insert(0, MathAtom(proxy)); } - // expanding macro with the values macro_->expand(values, expanded_.cell(0)); - // get definition for list edit mode + // get definition for list edit mode docstring const & display = macro_->display(); asArray(display.empty() ? macro_->definition() : display, definition_); } @@ -710,7 +714,7 @@ void MathMacro::write(WriteStream & os) const // skip the tailing empty optionals i = optionals_; - // Print remaining macros + // Print remaining arguments for (; i < cells_.size(); ++i) { if (cell(i).size() == 1 && cell(i)[0].nucleus()->asCharInset() @@ -737,7 +741,7 @@ void MathMacro::maple(MapleStream & os) const void MathMacro::mathmlize(MathStream & os) const { - lyx::mathmlize(expanded_.cell(0), os); + os << expanded_.cell(0); } -- 2.39.2