]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_xyarrowinset.C
Jean-Marc's fix for wrong descent
[lyx.git] / src / mathed / math_xyarrowinset.C
index fe5a886297550599033f1b3e6f52da1994e29264..b0047d99ef30727b2bb2a2d9f3c6f81ea4898d1f 100644 (file)
@@ -1,8 +1,5 @@
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
 
 #include "math_xyarrowinset.h"
 #include "math_xymatrixinset.h"
@@ -33,8 +30,9 @@ MathXYMatrixInset const * MathXYArrowInset::targetMatrix() const
 }
 
 
-MathXArray const & MathXYArrowInset::targetCell() const
+MathArray const & MathXYArrowInset::targetCell() const
 {
+#if 0
        MathXYMatrixInset const * p = targetMatrix();
        int x = 0;
        int y = 0;
@@ -54,13 +52,22 @@ MathXArray const & MathXYArrowInset::targetCell() const
                lyxerr << "target: n: " << n << " out of range\n";
                n = 0;
        }
-  return p->xcell(n);
+  return p->cell(n);
+#else
+       static MathArray dummy;
+       return dummy;
+#endif
 }
 
 
-MathXArray const & MathXYArrowInset::sourceCell() const
+MathArray const & MathXYArrowInset::sourceCell() const
 {
-  return targetMatrix()->xcell(mi_.idx);
+#if 0
+  return targetMatrix()->cell(mi_.idx);
+#else
+       static MathArray dummy;
+       return dummy;
+#endif
 }
 
 
@@ -69,19 +76,21 @@ void MathXYArrowInset::metrics(MathMetricsInfo & mi) const
        MathNestInset::metrics(mi);
        mi_   = mi;
        MathFontSetChanger dummy(mi.base, "textrm");
+#if 0
        target_ = mi.inset ? mi.inset->asXYMatrixInset() : 0;
 
        if (editing()) {
                int w    = mathed_string_width(mi.base.font, "target: ");
-               width_   = w + max(xcell(0).width(), xcell(1).width());
-               ascent_  = xcell(0).ascent();
-               descent_ = xcell(0).descent() + xcell(1).height() + 10;
+               width_   = w + max(cell(0).width(), cell(1).width());
+               ascent_  = cell(0).ascent();
+               descent_ = cell(0).descent() + cell(1).height() + 10;
        } else {
                width_   = 0;
                ascent_  = 0;
                descent_ = 0;
                //mathed_string_dim(font_, "X", ascent_, descent_, width_);
        }
+#endif
 }
 
 
@@ -92,26 +101,30 @@ void MathXYArrowInset::draw(MathPainterInfo & pi, int x, int y) const
 
        if (editing()) {
 
+#if 0
+
                int lasc;
                int ldes;
                int lwid;
                mathed_string_dim(pi.base.font, "target: ", lasc, ldes, lwid);
 
-               xcell(0).draw(pi, x + lwid, y);
+               cell(0).draw(pi, x + lwid, y);
                drawStr(pi, pi.base.font, x + 3, y, "target");
-               y += max(xcell(0).descent(), ldes) + 5;
+               y += max(cell(0).descent(), ldes) + 5;
 
-               y += max(xcell(1).ascent(), lasc) + 5;
-               xcell(1).draw(pi, x + lwid, y);
+               y += max(cell(1).ascent(), lasc) + 5;
+               cell(1).draw(pi, x + lwid, y);
                drawStr(pi, pi.base.font, x + 3, y, "label");
 
+#endif
+
        } else {
 
-               //drawStr(pi, font_, x, y, "X");
-               MathXArray const & s = sourceCell();
-               MathXArray const & t = targetCell();
+               drawStr(pi, font_, x, y, "X");
+               MathArray const & s = sourceCell();
+               MathArray const & t = targetCell();
                pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), LColor::math);
-               xcell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
+               cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
 
        }
 }
@@ -121,9 +134,9 @@ void MathXYArrowInset::write(WriteStream & os) const
 {
        os << "\\ar";
        if (cell(0).size())
-               os << "[" << cell(0) << "]";
+               os << '[' << cell(0) << ']';
        if (cell(1).size())
-               os << (up_ ? "^" : "_") << "{" << cell(1) << "}";
+               os << (up_ ? '^' : '_') << '{' << cell(1) << '}';
        os << " ";
 }
 
@@ -132,5 +145,5 @@ void MathXYArrowInset::normalize(NormalStream & os) const
 {
        os << "[xyarrow ";
        MathNestInset::normalize(os);
-       os << "]";
+       os << ']';
 }