diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index 316ea479bf..27a2df6176 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -318,6 +318,7 @@ dispatch_result InsetFormulaBase::lfunMouseRelease(FuncRequest const & cmd) // try to dispatch to enclosed insets first if (mathcursor->dispatch(cmd) == UNDISPATCHED) { // launch math panel for right mouse button + lyxerr << "lfunMouseRelease: undispatched: " << cmd.button() << endl; bv->owner()->getDialogs().showMathPanel(); } return DISPATCHED; @@ -422,10 +423,12 @@ dispatch_result InsetFormulaBase::localDispatch(FuncRequest const & cmd) switch (cmd.action) { case LFUN_MOUSE_PRESS: + //lyxerr << "Mouse single press\n"; return lfunMousePress(cmd); case LFUN_MOUSE_MOTION: - return lfunMouseMotion(cmd); + //return lfunMouseMotion(cmd); case LFUN_MOUSE_RELEASE: + lyxerr << "Mouse single release\n"; return lfunMouseRelease(cmd); case LFUN_MOUSE_DOUBLE: //lyxerr << "Mouse double\n"; diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 7efecbba79..77208b6fa9 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1411,6 +1411,32 @@ MathCursorPos MathCursor::normalAnchor() const dispatch_result MathCursor::dispatch(FuncRequest const & cmd) { + // mouse clicks are somewhat special + // check + switch (cmd.action) { + case LFUN_MOUSE_PRESS: + case LFUN_MOUSE_MOTION: + case LFUN_MOUSE_RELEASE: + case LFUN_MOUSE_DOUBLE: { + MathCursorPos & pos = Cursor_.back(); + dispatch_result res = UNDISPATCHED; + int x = 0, y = 0; + getPos(x, y); + if (x < cmd.x && hasPrevAtom()) { + res = prevAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_); + if (res != UNDISPATCHED) + return res; + } + if (x > cmd.x && hasNextAtom()) { + res = nextAtom().nucleus()->dispatch(cmd, pos.idx_, pos.pos_); + if (res != UNDISPATCHED) + return res; + } + } + default: + break; + } + for (int i = Cursor_.size() - 1; i >= 0; --i) { MathCursorPos & pos = Cursor_[i]; dispatch_result res = pos.par_->dispatch(cmd, pos.idx_, pos.pos_); diff --git a/src/mathed/math_data.C b/src/mathed/math_data.C index a3641321ba..1f65cd705a 100644 --- a/src/mathed/math_data.C +++ b/src/mathed/math_data.C @@ -355,6 +355,7 @@ void MathArray::boundingBox(int & x1, int & x2, int & y1, int & y2) y2 = yo_ + descent(); } + void MathArray::center(int & x, int & y) const { x = xo_ + width() / 2; diff --git a/src/mathed/ref_inset.C b/src/mathed/ref_inset.C index 520b6a0c86..9e3b5a8e30 100644 --- a/src/mathed/ref_inset.C +++ b/src/mathed/ref_inset.C @@ -40,6 +40,7 @@ dispatch_result RefInset::dispatch(FuncRequest const & cmd, idx_type & idx, pos_type & pos) { switch (cmd.action) { + lyxerr << "dispatching " << cmd.argument << "\n"; case LFUN_MOUSE_RELEASE: if (cmd.button() == mouse_button::button3) { lyxerr << "trying to goto ref" << cell(0) << "\n";