]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_decorationinset.C
further code uglification to make Jean-Marc's compiler happy
[lyx.git] / src / mathed / math_decorationinset.C
index 8d3d3501e8b70a631a0a9157d855174771f0e2d4..2cd1af5a9e9363db4eddd0aa1ee24b351169a0f5 100644 (file)
@@ -28,6 +28,16 @@ bool MathDecorationInset::upper() const
 }
 
 
+bool MathDecorationInset::isScriptable() const
+{
+       return
+                       name_ == "overbrace" ||
+                       name_ == "underbrace" ||
+                       name_ == "overleftarrow" ||
+                       name_ == "overrightarrow";
+}
+
+
 bool MathDecorationInset::protect() const
 {
        return
@@ -38,6 +48,18 @@ bool MathDecorationInset::protect() const
 }
 
 
+bool MathDecorationInset::wide() const
+{
+       return
+                       name_ == "overbrace" ||
+                       name_ == "underbrace" ||
+                       name_ == "overleftarrow" ||
+                       name_ == "overrightarrow" ||
+                       name_ == "widehat" ||
+                       name_ == "widetilde";
+}
+
+
 void MathDecorationInset::metrics(MathStyles st) const
 {
        xcell(0).metrics(st);
@@ -63,7 +85,12 @@ void MathDecorationInset::draw(Painter & pain, int x, int y) const
        xo(x);
        yo(x);
        xcell(0).draw(pain, x, y);
-       mathed_draw_deco(pain, x, y + dy_, width_, dh_, name_);
+       if (wide()) 
+               mathed_draw_deco(pain, x, y + dy_, width_, dh_, name_);
+       else {
+               int w = 2 + mathed_char_width(LM_TC_VAR, size(), 'x'); 
+               mathed_draw_deco(pain, x + (width_ - w) / 2, y + dy_, w, dh_, name_);
+       }
 }