From e7b3dd74b5030c227d60ad04019f584f63649ca3 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 13 Aug 2007 15:44:19 +0000 Subject: [PATCH] * 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/branches/BRANCH_1_5_X@19507 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetTabular.cpp | 40 ++++++++---------------------------- src/mathed/InsetMathNest.cpp | 28 ++++++++++++------------- status.15x | 9 +++++--- 3 files changed, 28 insertions(+), 49 deletions(-) diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index c3e39f1aad..0983f3d971 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -3204,39 +3204,17 @@ void InsetTabular::doDispatch(Cursor & cur, FuncRequest & cmd) case LFUN_MOUSE_PRESS: //lyxerr << "# InsetTabular::MousePress\n" << cur.bv().cursor() << endl; - // FIXME: the following should be replaced by a better fix - // that is already used for plain text (Text3.cpp). - cap::saveSelection(bvcur); - 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) { diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 94bec2f62e..8a7db60910 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -1153,32 +1153,30 @@ void InsetMathNest::lfunMousePress(Cursor & cur, FuncRequest & cmd) { //lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl; BufferView & bv = cur.bv(); - // FIXME: the following should be replaced by a better fix - // that is already used for plain text (Text3.cpp). - cap::saveSelection(bv.cursor()); + 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); + } } } diff --git a/status.15x b/status.15x index e85d87a557..15ac7ff024 100644 --- a/status.15x +++ b/status.15x @@ -27,14 +27,14 @@ What's new all of its menus and for help files. Documents strings like "Chapter" are correctly translated on screen too. -- Add support for translating the menus in Simplified Chinese. +- Add support for translating the menus in Simplified Chinese. * USER INTERFACE -- Add "Save all" menu entry, to save all modified files (Bug 2840) +- Add "Save all" menu entry, to save all modified files (Bug 2840). -- Mark modified files in the View menu with an asterisk (Bug 2876) +- Mark modified files in the View menu with an asterisk (Bug 2876). ** Bug fixes: @@ -47,6 +47,9 @@ What's new * USER INTERFACE: +- Fix crash when clickin in a tabular cell and the "delete empty paragraph" + mechanism triggers (bug 4133). + - Fix loading non-lyx child documents with relative path names, change 'Load' to 'Edit' in the child document dialog (Bugs 4107 and 4111)