+/**
+ * \file math_scriptinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
#include "math_scriptinset.h"
+#include "math_data.h"
+#include "math_mathmlstream.h"
#include "math_support.h"
#include "math_symbolinset.h"
-#include "math_mathmlstream.h"
-#include "funcrequest.h"
-#include "support/LAssert.h"
+#include "dispatchresult.h"
#include "debug.h"
+#include "funcrequest.h"
+
+#include <boost/assert.hpp>
+using std::string;
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());
+ BOOST_ASSERT(hasDown());
return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
}
int MathScriptInset::dx1() const
{
- lyx::Assert(hasUp());
+ BOOST_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 << "{}";
}
}
-dispatch_result MathScriptInset::dispatch
- (FuncRequest const & cmd, idx_type & idx, pos_type & pos)
+DispatchResult
+MathScriptInset::priv_dispatch(FuncRequest const & cmd,
+ idx_type & idx, pos_type & pos)
{
if (cmd.action == LFUN_MATH_LIMITS) {
if (!cmd.argument.empty()) {
else
limits_ = 0;
} else if (limits_ == 0)
- limits_ = (hasLimits()) ? -1 : 1;
+ limits_ = hasLimits() ? -1 : 1;
else
limits_ = 0;
- return DISPATCHED;
+ return DispatchResult(true, true);
}
- return MathNestInset::dispatch(cmd, idx, pos);
+ return MathNestInset::priv_dispatch(cmd, idx, pos);
}