+#include <config.h>
#include "math_scriptinset.h"
#include "math_support.h"
#include "support/LAssert.h"
#include "debug.h"
+using namespace lyx::support;
using std::max;
+using std::auto_ptr;
+using std::endl;
MathScriptInset::MathScriptInset()
-MathInset * MathScriptInset::clone() const
+auto_ptr<InsetBase> MathScriptInset::clone() const
{
- return new MathScriptInset(*this);
+ return auto_ptr<InsetBase>(new MathScriptInset(*this));
}
int MathScriptInset::dx0() const
{
- lyx::Assert(hasDown());
+ Assert(hasDown());
return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
}
int MathScriptInset::dx1() const
{
- lyx::Assert(hasUp());
+ Assert(hasUp());
return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid();
}
}
-void MathScriptInset::metrics(MetricsInfo & mi) const
+void MathScriptInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(2).metrics(mi);
ScriptChanger dummy(mi.base);
}
dim_.asc = dy1() + (hasUp() ? up().ascent() : 0);
dim_.des = dy0() + (hasDown() ? down().descent() : 0);
- metricsMarkers2();
+ metricsMarkers();
+ dim = dim_;
}
up().draw(pi, x + dx1(), y - dy1());
if (hasDown())
down().draw(pi, x + dx0(), y + dy0());
- drawMarkers2(pi, x, y);
+ drawMarkers(pi, x, y);
}
-void MathScriptInset::metricsT(TextMetricsInfo const & mi) const
+void MathScriptInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
if (hasUp())
- up().metricsT(mi);
+ up().metricsT(mi, dim);
if (hasDown())
- down().metricsT(mi);
- nuc().metricsT(mi);
+ down().metricsT(mi, dim);
+ nuc().metricsT(mi, dim);
}
//}
} else {
if (os.firstitem())
- lyxerr[Debug::MATHED] << "suppressing {} when writing\n";
+ lyxerr[Debug::MATHED] << "suppressing {} when writing"
+ << endl;
else
os << "{}";
}