]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathChar.cpp
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / InsetMathChar.cpp
index 1b305ac38542477a52fe6898c3a99883c647ffae..46083a439eebb75bce0fbaadab1b79a290641add 100644 (file)
 #include <config.h>
 
 #include "InsetMathChar.h"
+
 #include "MathSupport.h"
 #include "MathStream.h"
+#include "MetricsInfo.h"
 
-#include "debug.h"
 #include "Dimension.h"
 #include "TextPainter.h"
 
-#include "support/lstrings.h"
-
 #include "frontends/FontMetrics.h"
 
+#include "support/debug.h"
+#include "support/lstrings.h"
+
 
 namespace lyx {
 
 extern bool has_math_fonts;
 
-namespace {
-
-       bool isBinaryOp(char_type c)
-       {
-               return support::contains("+-<>=/*", static_cast<char>(c));
-       }
 
+static bool isBinaryOp(char_type c)
+{
+       return support::contains("+-<>=/*", static_cast<char>(c));
+}
 
-       bool slanted(char_type c)
-       {
-               return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
-       }
 
+static bool slanted(char_type c)
+{
+       return ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z');
 }
 
 
@@ -56,7 +55,7 @@ Inset * InsetMathChar::clone() const
 }
 
 
-bool InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
 {
 #if 1
        if (char_ == '=' && has_math_fonts) {
@@ -66,7 +65,7 @@ bool InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
                FontSetChanger dummy(mi.base, "cmm");
                dim = theFontMetrics(mi.base.font).dimension(char_);
        } else if (!slanted(char_) && mi.base.fontname == "mathnormal") {
-               ShapeChanger dummy(mi.base.font, Font::UP_SHAPE);
+               ShapeChanger dummy(mi.base.font, UP_SHAPE);
                dim = theFontMetrics(mi.base.font).dimension(char_);
        } else {
                frontend::FontMetrics const & fm = theFontMetrics(mi.base.font);
@@ -85,12 +84,6 @@ bool InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
                dim.wid += 2 * theFontMetrics(font_).width(' ');
        lyxerr << "InsetMathChar::metrics: " << dim << endl;
 #endif
-
-       if (dim_ == dim)
-               return false;
-
-       dim_ = dim;
-       return true;
 }
 
 
@@ -110,7 +103,7 @@ void InsetMathChar::draw(PainterInfo & pi, int x, int y) const
                FontSetChanger dummy(pi.base, "cmm");
                pi.draw(x, y, char_);
        } else if (!slanted(char_) && pi.base.fontname == "mathnormal") {
-               ShapeChanger dummy(pi.base.font, Font::UP_SHAPE);
+               ShapeChanger dummy(pi.base.font, UP_SHAPE);
                pi.draw(x, y, char_);
        } else {
                pi.draw(x, y, char_);