-#ifdef __GNUG__
-#pragma implementation
-#endif
#include "math_nestinset.h"
#include "math_cursor.h"
#include "math_parser.h"
#include "funcrequest.h"
#include "debug.h"
+#include "BufferView.h"
#include "frontends/Painter.h"
x += 2;
}
+
void MathNestInset::substitute(MathMacro const & m)
{
for (idx_type i = 0; i < nargs(); ++i)
}
-void MathNestInset::metrics(MathMetricsInfo const & mi) const
+void MathNestInset::metrics(MetricsInfo const & mi) const
{
- MathMetricsInfo m = mi;
+ MetricsInfo m = mi;
for (idx_type i = 0; i < nargs(); ++i)
cell(i).metrics(m);
}
}
-//void MathNestInset::draw(MathPainterInfo & pi, int x, int y) const
-void MathNestInset::draw(MathPainterInfo &, int, int) const
+//void MathNestInset::draw(PainterInfo & pi, int x, int y) const
+void MathNestInset::draw(PainterInfo &, int, int) const
{
#if 0
if (lock_)
}
-void MathNestInset::drawSelection(MathPainterInfo & pi,
+void MathNestInset::drawSelection(PainterInfo & pi,
idx_type idx1, pos_type pos1, idx_type idx2, pos_type pos2) const
{
if (idx1 == idx2) {
}
-void MathNestInset::drawMarkers(MathPainterInfo & pi, int x, int y) const
+void MathNestInset::drawMarkers(PainterInfo & pi, int x, int y) const
{
if (!editing())
return;
}
-void MathNestInset::drawMarkers2(MathPainterInfo & pi, int x, int y) const
+void MathNestInset::drawMarkers2(PainterInfo & pi, int x, int y) const
{
if (!editing())
return;
os << '\\' << name().c_str();
for (unsigned i = 0; i < nargs(); ++i)
os << '{' << cell(i) << '}';
- if (lock_ && !os.latex())
- os << "\\lyxlock ";
if (nargs() == 0)
- os << ' ';
+ os.pendingSpace(true);
+ if (lock_ && !os.latex()) {
+ os << "\\lyxlock";
+ os.pendingSpace(true);
+ }
}
}
-void MathNestInset::notifyCursorLeaves()
-{}
+void MathNestInset::notifyCursorLeaves(idx_type idx)
+{
+ cell(idx).notifyCursorLeaves();
+}
-MathInset::result_type MathNestInset::dispatch
+dispatch_result MathNestInset::dispatch
(FuncRequest const & cmd, idx_type & idx, pos_type & pos)
{
+ BufferView * bv = cmd.view();
+
switch (cmd.action) {
case LFUN_PASTE: {
- lyxerr << "pasting '" << cmd.argument << "'\n";
MathArray ar;
mathed_parse_cell(ar, cmd.argument);
- lyxerr << "pasting '" << ar << "'\n";
- lyxerr << "cell(idx) '" << cell(idx) << "'\n";
cell(idx).insert(pos, ar);
pos += ar.size();
return DISPATCHED;
}
- default:
+ case LFUN_PASTESELECTION:
+ return
+ dispatch(
+ FuncRequest(bv, LFUN_PASTE, bv->getClipboard()), idx, pos);
+
+ case LFUN_MOUSE_PRESS:
+ if (cmd.button() == mouse_button::button2)
+ return dispatch(FuncRequest(bv, LFUN_PASTESELECTION), idx, pos);
+ return UNDISPATCHED;
+
+ default:
return MathInset::dispatch(cmd, idx, pos);
}
return UNDISPATCHED;