}
-void MathNestInset::drawSelection(PainterInfo & pi, int, int) const
+void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
{
+ // FIXME: hack to get position cache warm
+ draw(pi, x, y);
+
// this should use the x/y values given, not the cached values
LCursor & cur = pi.base.bv->cursor();
if (!cur.selection())
}
-void MathNestInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
+void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
{
//lyxerr << "MathNestInset: request: " << cmd << std::endl;
//CursorSlice sl = cur.current();
cur.message(_("Paste"));
replaceSelection(cur);
size_t n = 0;
- istringstream is(cmd.argument.c_str());
+ istringstream is(cmd.argument);
is >> n;
pasteSelection(cur, n);
cur.clearSelection(); // bug 393
lyxerr << "LFUN_SETXY broken!" << endl;
int x = 0;
int y = 0;
- istringstream is(cmd.argument.c_str());
+ istringstream is(cmd.argument);
is >> x >> y;
cur.setScreenPos(x, y);
break;
case LFUN_MATH_MODE:
#if 1
+ // ignore math-mode on when already in math mode
+ if (currentMode() == InsetBase::MATH_MODE && cmd.argument == "on")
+ break;
cur.macroModeClose();
selClearOrDel(cur);
cur.plainInsert(MathAtom(new MathMBoxInset(cur.bv())));
}
default:
- MathDimInset::priv_dispatch(cur, cmd);
+ MathDimInset::doDispatch(cur, cmd);
break;
}
}
void MathNestInset::lfunMouseMotion(LCursor & cur, FuncRequest & cmd)
{
// only select with button 1
- if (cmd.button() != mouse_button::button1)
- return;
-
- if (abs(cmd.x - first_x) < 2 && abs(cmd.y - first_y) < 2)
- return;
-
- first_x = cmd.x;
- first_y = cmd.y;
-
- cur.bv().cursor().setCursor(cur, true);
+ if (cmd.button() == mouse_button::button1) {
+ LCursor & bvcur = cur.bv().cursor();
+ if (abs(cmd.x - first_x) + abs(cmd.y - first_y) > 4
+ && bvcur.anchor_.hasPart(cur)) {
+ first_x = cmd.x;
+ first_y = cmd.y;
+
+ bvcur.setCursor(cur);
+ bvcur.selection() = true;
+ }
+ }
}
lyxerr << "lfunMouseRelease: buttons: " << cmd.button() << endl;
if (cmd.button() == mouse_button::button1) {
- // try to dispatch to enclosed insets first
//cur.bv().stuffClipboard(cur.grabSelection());
return;
}