* 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
This commit is contained in:
Jean-Marc Lasgouttes 2007-08-13 15:44:19 +00:00
parent 5be5543d2c
commit e7b3dd74b5
3 changed files with 28 additions and 49 deletions

View File

@ -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) {

View File

@ -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);
}
}
}

View File

@ -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)