]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathXYArrow.cpp
Do not throw exceptions here either. See r22806.
[lyx.git] / src / mathed / InsetMathXYArrow.cpp
index 884e78423bb9153659be15f8a06c1bfac944ea05..b0e20499036ed2f9767b12631a7d6ba0b8763ce5 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 #include "MathStream.h"
 #include "MathSupport.h"
 #include "frontends/Painter.h"
-#include "debug.h"
+#include "support/debug.h"
 
+using namespace std;
 
 namespace lyx {
 
 
-using std::max;
-
-
 InsetMathXYArrow::InsetMathXYArrow()
        : InsetMathNest(2)
 {}
@@ -91,9 +89,9 @@ bool InsetMathXYArrow::metrics(MetricsInfo & mi) const
 
        if (editing()) {
                int w    = mathed_string_width(mi.base.font, from_ascii("target: "));
-               width_   = w + max(cell(0).width(), cell(1).width());
-               ascent_  = cell(0).ascent();
-               descent_ = cell(0).descent() + cell(1).height() + 10;
+               width_   = w + max(dim0.width(), dim1.wid);
+               ascent_  = dim0.asc;
+               descent_ = dim0.des + dim1.height() + 10;
        } else {
                width_   = 0;
                ascent_  = 0;
@@ -120,9 +118,9 @@ void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
 
                cell(0).draw(pi, x + lwid, y);
                pi.base.text(x + 3, y, "target");
-               y += max(cell(0).descent(), ldes) + 5;
+               y += max(dim0.des, ldes) + 5;
 
-               y += max(cell(1).ascent(), lasc) + 5;
+               y += max(dim1.asc, lasc) + 5;
                cell(1).draw(pi, x + lwid, y);
                pi.base.text(x + 3, y, "label");
 
@@ -133,7 +131,7 @@ void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
                pi.pain.text(x, y, "X");
                MathData const & s = sourceCell();
                MathData const & t = targetCell();
-               pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color::math);
+               pi.pain.line(s.xm(), s.ym(), t.xm(), t.ym(), Color_math);
                cell(1).draw(pi, (s.xm() + t.xm())/2, (s.ym() + t.ym())/2);
 
        }
@@ -142,6 +140,7 @@ void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
 
 void InsetMathXYArrow::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
        os << "\\ar";
        if (cell(0).size())
                os << '[' << cell(0) << ']';