mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
* inset/InsetTabular.cpp (doDispatch): LFUN_MOUSE_PRESS: let Text::dispatch
do the work, unless we really have a reason not to (fixes bug 4133) * mathed/InsetMathNest.cpp (lfunMousePress): refactor the code to use BufferView::mouseSetCursor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19506 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6fd5763db0
commit
ded1c011f2
@ -3215,35 +3215,16 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd)
|
||||
case LFUN_MOUSE_PRESS:
|
||||
//lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl;
|
||||
|
||||
if (cmd.button() == mouse_button::button1
|
||||
|| (cmd.button() == mouse_button::button3
|
||||
&& (&bvcur.selBegin().inset() != this || !tablemode(bvcur)))) {
|
||||
if (!bvcur.selection() && !cur.bv().mouseSetCursor(cur))
|
||||
cur.noUpdate();
|
||||
cur.selection() = false;
|
||||
setCursorFromCoordinates(cur, cmd.x, cmd.y);
|
||||
cur.bv().mouseSetCursor(cur);
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd.button() == mouse_button::button2) {
|
||||
if (cap::selection()) {
|
||||
// See comment in Text::dispatch why we
|
||||
// do this
|
||||
// FIXME This does not use paste_tabular,
|
||||
// another reason why paste_tabular should go.
|
||||
cap::copySelectionToStack();
|
||||
cmd = FuncRequest(LFUN_PASTE, "0");
|
||||
} else {
|
||||
cmd = FuncRequest(LFUN_PRIMARY_SELECTION_PASTE,
|
||||
"paragraph");
|
||||
}
|
||||
doDispatch(cur, cmd);
|
||||
cur.bv().buffer()->markDirty();
|
||||
cur.bv().mouseSetCursor(cur);
|
||||
}
|
||||
// do not reset cursor/selection if we have selected
|
||||
// some cells (bug 2715).
|
||||
if (cmd.button() == mouse_button::button3
|
||||
&& &bvcur.selBegin().inset() == this
|
||||
&& tablemode(bvcur))
|
||||
;
|
||||
else
|
||||
// Let InsetText do it
|
||||
cell(cur.idx())->dispatch(cur, cmd);
|
||||
break;
|
||||
|
||||
case LFUN_MOUSE_MOTION:
|
||||
//lyxerr << "# InsetTabular::MouseMotion\n" << bvcur << endl;
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
|
@ -1151,29 +1151,30 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd)
|
||||
{
|
||||
//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
|
||||
BufferView & bv = cur.bv();
|
||||
bv.mouseSetCursor(cur);
|
||||
if (cmd.button() == mouse_button::button1) {
|
||||
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
|
||||
bv.mouseSetCursor(cur);
|
||||
// Update the cursor update flags as needed:
|
||||
//
|
||||
// Update::Decoration: tells to update the decoration (visual box
|
||||
// corners that define the inset)/
|
||||
// Update::FitCursor: adjust the screen to the cursor position if
|
||||
// needed
|
||||
// Update::Decoration: tells to update the decoration
|
||||
// (visual box corners that define
|
||||
// the inset)/
|
||||
// Update::FitCursor: adjust the screen to the cursor
|
||||
// position if needed
|
||||
// cur.result().update(): don't overwrite previously set flags.
|
||||
cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
|
||||
cur.updateFlags(Update::Decoration | Update::FitCursor
|
||||
| cur.result().update());
|
||||
} else if (cmd.button() == mouse_button::button2) {
|
||||
MathData ar;
|
||||
if (cap::selection()) {
|
||||
// See comment in Text::dispatch why we do this
|
||||
cap::copySelectionToStack();
|
||||
cmd = FuncRequest(LFUN_PASTE, "0");
|
||||
doDispatch(cur, cmd);
|
||||
} else
|
||||
doDispatch(bv.cursor(), cmd);
|
||||
} else {
|
||||
MathData ar;
|
||||
asArray(theSelection().get(), ar);
|
||||
|
||||
cur.insert(ar);
|
||||
bv.mouseSetCursor(cur);
|
||||
bv.cursor().insert(ar);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user