* InsetMathNest::lfunMouseRelease(): keep the optimization only if there is no selection. This allows to shorten the time when the cursor is initially set at the beginning of the math inset.

* InsetMathNest::lfunMousePress(): Disable optimization introduced in revision 16006. This is because we need the box corners when navigating inside formulas.

* InsetMathNest::doDispatch(): ditto.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16011 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-11-22 14:45:33 +00:00
parent d67e506396
commit dd91a7f6b6

View File

@ -493,7 +493,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_CHAR_FORWARD:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_CHAR_FORWARD_SELECT:
cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
cur.autocorrect() = false;
@ -512,7 +516,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_CHAR_BACKWARD:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_CHAR_BACKWARD_SELECT:
cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
cur.autocorrect() = false;
@ -532,7 +540,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_UP:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_UP_SELECT:
// FIXME Tried to use clearTargetX and macroModeClose, crashed on cur.up()
if (cur.inMacroMode()) {
@ -550,7 +562,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_DOWN:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_DOWN_SELECT:
if (cur.inMacroMode()) {
cur.macroModeClose();
@ -578,14 +594,22 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_PARAGRAPH_UP:
case LFUN_PARAGRAPH_DOWN:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_PARAGRAPH_UP_SELECT:
case LFUN_PARAGRAPH_DOWN_SELECT:
break;
case LFUN_LINE_BEGIN:
case LFUN_WORD_BACKWARD:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_LINE_BEGIN_SELECT:
case LFUN_WORD_BACKWARD_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
@ -607,7 +631,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
case LFUN_WORD_FORWARD:
case LFUN_LINE_END:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
case LFUN_WORD_FORWARD_SELECT:
case LFUN_LINE_END_SELECT:
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
@ -641,12 +669,20 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
case LFUN_CELL_FORWARD:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
cur.inset().idxNext(cur);
break;
case LFUN_CELL_BACKWARD:
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
cur.inset().idxPrev(cur);
break;
@ -1131,7 +1167,9 @@ void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
if (cmd.button() == mouse_button::button1) {
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
bv.mouseSetCursor(cur);
cur.noUpdate();
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset.
//cur.noUpdate();
} else if (cmd.button() == mouse_button::button2) {
MathArray ar;
if (cur.selection())
@ -1169,7 +1207,8 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
if (cmd.button() == mouse_button::button1) {
//theSelection().put(cur.grabSelection());
cur.noUpdate();
if (!cur.selection())
cur.noUpdate();
return;
}
@ -1313,22 +1352,33 @@ bool InsetMathNest::interpretChar(LCursor & cur, char_type c)
// it is better than nothing...
if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' ') {
cur.insert(c);
cur.updateFlags(Update::SinglePar | Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::SinglePar | Update::FitCursor);
}
return true;
}
if (cur.pos() != 0 && cur.prevAtom()->asSpaceInset()) {
cur.prevAtom().nucleus()->asSpaceInset()->incSpace();
cur.updateFlags(Update::SinglePar | Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::SinglePar | Update::FitCursor);
return true;
}
if (cur.popRight()) {
cur.updateFlags(Update::FitCursor);
// FIXME: we have to enable full redraw here because of the
// visual box corners that define the inset. If we know for
// sure that we stay within the same cell we can optimize for
// that using:
//cur.updateFlags(Update::FitCursor);
return true;
}
cur.updateFlags(Update::FitCursor);
// if we are at the very end, leave the formula
return cur.pos() != cur.lastpos();
}