]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathData.cpp
We only support gcc >= 4.9.
[lyx.git] / src / mathed / MathData.cpp
index 39d5f80184303c7f02f5813c7d90296af1d66f8d..d3ce3a31c877ec03843005424a0351b3d044ac7d 100644 (file)
 
 #include "InsetMathBrace.h"
 #include "InsetMathFont.h"
+#include "InsetMathMacro.h"
 #include "InsetMathScript.h"
 #include "MacroTable.h"
-#include "InsetMathMacro.h"
+#include "MathRow.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MetricsInfo.h"
@@ -27,6 +28,7 @@
 #include "BufferView.h"
 #include "CoordCache.h"
 #include "Cursor.h"
+#include "Dimension.h"
 
 #include "mathed/InsetMathUnknown.h"
 
@@ -37,7 +39,6 @@
 #include "support/docstream.h"
 #include "support/gettext.h"
 #include "support/lassert.h"
-#include "support/lyxalgo.h"
 
 #include <cstdlib>
 
@@ -47,8 +48,7 @@ namespace lyx {
 
 
 MathData::MathData(Buffer * buf, const_iterator from, const_iterator to)
-       : base_type(from, to), minasc_(0), mindes_(0), slevel_(0),
-         sshift_(0), buffer_(buf)
+       : base_type(from, to), buffer_(buf)
 {}
 
 
@@ -224,6 +224,7 @@ bool MathData::addToMathRow(MathRow & mrow, MetricsInfo & mi) const
 {
        bool has_contents = false;
        BufferView * bv = mi.base.bv;
+       display_style_ = mi.base.font.style() == DISPLAY_STYLE;
        MathData * ar = const_cast<MathData*>(this);
        ar->updateMacros(&bv->cursor(), mi.macrocontext,
                         InternalUpdate, mi.base.macro_nesting);
@@ -968,6 +969,17 @@ MathClass MathData::mathClass() const
 }
 
 
+MathClass MathData::firstMathClass() const
+{
+       for (MathAtom const & at : *this) {
+               MathClass mc = at->mathClass();
+               if (mc != MC_UNKNOWN)
+                       return mc;
+       }
+       return MC_ORD;
+}
+
+
 MathClass MathData::lastMathClass() const
 {
        MathClass res = MC_ORD;