]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDiagram.cpp
Account for old versions of Pygments
[lyx.git] / src / mathed / InsetMathDiagram.cpp
index 25ad63ca5f967096ef80fffa80e4dff595eae3f8..c2019d4be856930273f5d456822a6ca327bfec07 100644 (file)
 
 #include "InsetMathDiagram.h"
 
-#include "LaTeXFeatures.h"
 #include "MathStream.h"
 
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
+
 #include <ostream>
 
 namespace lyx {
@@ -46,19 +48,34 @@ int InsetMathDiagram::rowsep() const
 
 void InsetMathDiagram::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       if (mi.base.style == LM_ST_DISPLAY)
-               mi.base.style = LM_ST_TEXT;
+       Changer dummy2 = mi.base.changeEnsureMath();
+       FontInfo & f = mi.base.font;
+       Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
+               : Changer();
        InsetMathGrid::metrics(mi, dim);
 }
 
 
+void InsetMathDiagram::draw(PainterInfo & pi, int x, int y) const
+{
+       Changer dummy2 = pi.base.changeEnsureMath();
+       FontInfo & f = pi.base.font;
+       Changer dummy = (f.style() == LM_ST_DISPLAY) ? f.changeStyle(LM_ST_TEXT)
+               : Changer();
+       InsetMathGrid::draw(pi, x, y);
+}
+
+
 void InsetMathDiagram::write(WriteStream & os) const
 {
        MathEnsurer ensurer(os);
        os << "\\Diagram";
+       bool open = os.startOuterRow();
        os << '{';
        InsetMathGrid::write(os);
        os << "}\n";
+       if (open)
+               os.startOuterRow();
 }