-/*
- * File: math_root.C
- * Purpose: Implementation of the root object
- * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
- * Created: January 1999
- * Description: Root math object
+/**
+ * \file math_rootinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
*
- * Copyright: 1999 Alejandro Aguilar Sierra
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
*
- * You are free to use and modify this code under the terms of
- * the GNU General Public Licence version 2 or later.
+ * Full author contact details are available in file CREDITS.
*/
+#include <config.h>
#include "math_rootinset.h"
+#include "math_data.h"
#include "math_mathmlstream.h"
-#include "frontends/Painter.h"
+#include "cursor.h"
+#include "LColor.h"
+#include "frontends/Painter.h"
using std::max;
+using std::auto_ptr;
+
MathRootInset::MathRootInset()
{}
-InsetBase * MathRootInset::clone() const
+auto_ptr<InsetBase> MathRootInset::clone() const
{
- return new MathRootInset(*this);
+ return auto_ptr<InsetBase>(new MathRootInset(*this));
}
void MathRootInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
MathNestInset::metrics(mi);
- dim_.asc = max(cell(0).ascent() + 5, cell(1).ascent()) + 2;
- dim_.des = max(cell(1).descent() + 5, cell(0).descent()) + 2;
- dim_.wid = cell(0).width() + cell(1).width() + 10;
- metricsMarkers(1);
- dim = dim_;
+ dim.asc = max(cell(0).ascent() + 5, cell(1).ascent()) + 2;
+ dim.des = max(cell(1).descent() + 5, cell(0).descent()) + 2;
+ dim.wid = cell(0).width() + cell(1).width() + 10;
+ metricsMarkers(dim);
+ dim_ = dim;
}
}
-bool MathRootInset::idxUpDown(idx_type & idx, pos_type & pos, bool up, int) const
+bool MathRootInset::idxUpDown(LCursor & cur, bool up) const
{
bool target = !up; // up ? 0 : 1;
- if (idx == target)
+ if (cur.idx() == target)
return false;
- idx = target;
- pos = target ? 0 : cell(0).size();
+ cur.idx() = target;
+ cur.pos() = up ? cur.lastpos() : 0;
return true;
}