mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
pass mouse clicks also to insets "close enough"
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6251 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1fcedd4b63
commit
787c8e95ac
@ -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";
|
||||
|
@ -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_);
|
||||
|
@ -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;
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user