]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDots.cpp
Fix bug 5802 (http://bugzilla.lyx.org/show_bug.cgi?id=5802)
[lyx.git] / src / mathed / InsetMathDots.cpp
index e949df8fdddd4947654edf7b7422e33d3c51276d..8052f1a82030b1f3511d7972440fc38850d06657 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 #include <config.h>
 
 #include "InsetMathDots.h"
+
+#include "LaTeXFeatures.h"
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "MathParser.h"
+#include "MetricsInfo.h"
 
 #include "frontends/FontMetrics.h"
 
@@ -32,7 +35,7 @@ Inset * InsetMathDots::clone() const
 }
 
 
-bool InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        dim = theFontMetrics(mi.base.font).dimension('M');
        dh_ = 0;
@@ -47,22 +50,19 @@ bool InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
        }
        else if (key_->name == "ddots")
                dh_ = dim.asc;
-       if (dim_ == dim)
-               return false;
-       dim_ = dim;
-       return true;
 }
 
 
 void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
 {
-       mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
+       Dimension const dim = dimension(*pain.base.bv);
+       mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                key_->name);
        if (key_->name == "vdots" || key_->name == "ddots")
                ++x;
        if (key_->name != "vdots")
                --y;
-       mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
+       mathed_draw_deco(pain, x + 2, y - dh_, dim.width() - 2, dim.ascent(),
                key_->name);
        setPosCache(pain, x, y);
 }
@@ -74,4 +74,11 @@ docstring InsetMathDots::name() const
 }
 
 
+void InsetMathDots::validate(LaTeXFeatures & features) const
+{
+       if (!key_->requires.empty())
+               features.require(to_utf8(key_->requires));
+}
+
+
 } // namespace lyx