}
-void InsetMathNest::drawMarkers(PainterInfo & pi, int x, int y) const
-{
- Color::color pen_color = mouse_hover_ || editing(pi.base.bv) ?
- Color::mathframe : Color::mathcorners;
-
- int const t = x + width() - 1;
- int const d = y + descent();
- pi.pain.line(x, d - 3, x, d, pen_color);
- pi.pain.line(t, d - 3, t, d, pen_color);
- pi.pain.line(x, d, x + 3, d, pen_color);
- pi.pain.line(t - 3, d, t, d, pen_color);
- setPosCache(pi, x, y);
-}
-
-
-void InsetMathNest::drawMarkers2(PainterInfo & pi, int x, int y) const
-{
- Color::color pen_color = mouse_hover_ || editing(pi.base.bv)?
- Color::mathframe : Color::mathcorners;
-
- drawMarkers(pi, x, y);
- int const t = x + width() - 1;
- int const a = y - ascent();
- pi.pain.line(x, a + 3, x, a, pen_color);
- pi.pain.line(t, a + 3, t, a, pen_color);
- pi.pain.line(x, a, x + 3, a, pen_color);
- pi.pain.line(t - 3, a, t, a, pen_color);
- setPosCache(pi, x, y);
-}
-
-
bool InsetMathNest::setMouseHover(bool mouse_hover)
{
mouse_hover_ = mouse_hover;
}
cur.niceInsert(topaste);
cur.clearSelection(); // bug 393
- cur.bv().switchKeyMap();
finishUndo();
break;
}
}
break;
- case LFUN_UP:
- cur.updateFlags(Update::Decoration | Update::FitCursor);
- case LFUN_UP_SELECT:
- // FIXME Tried to use clearTargetX and macroModeClose, crashed on cur.up()
- if (cur.inMacroMode()) {
- // Make Helge happy
- cur.macroModeClose();
- break;
- }
- cur.selHandle(cmd.action == LFUN_UP_SELECT);
- if (!cur.upDownInMath(true))
- cur.undispatched();
- // fixes bug 1598. Please check!
- cur.normalize();
- break;
-
case LFUN_DOWN:
+ case LFUN_UP:
cur.updateFlags(Update::Decoration | Update::FitCursor);
- case LFUN_DOWN_SELECT:
+ case LFUN_DOWN_SELECT:
+ case LFUN_UP_SELECT: {
+ // close active macro
if (cur.inMacroMode()) {
cur.macroModeClose();
break;
}
- cur.selHandle(cmd.action == LFUN_DOWN_SELECT);
- if (!cur.upDownInMath(false))
+
+ // stop/start the selection
+ bool select = cmd.action == LFUN_DOWN_SELECT ||
+ cmd.action == LFUN_UP_SELECT;
+ cur.selHandle(select);
+
+ // go up/down
+ bool up = cmd.action == LFUN_UP || cmd.action == LFUN_UP_SELECT;
+ bool successful = cur.upDownInMath(up);
+ if (successful) {
+ // notify left insets and give them chance to set update flags
+ lyx::notifyCursorLeaves(cur.beforeDispatchCursor(), cur);
+ cur.fixIfBroken();
+ } else
cur.undispatched();
- // fixes bug 1598. Please check!
- cur.normalize();
break;
+ }
case LFUN_MOUSE_DOUBLE:
case LFUN_MOUSE_TRIPLE:
&& cur.inMacroMode() && cur.macroName() != "\\"
&& cur.macroModeClose()) {
MathAtom const atom = cur.prevAtom();
- if (atom->asNestInset() && atom->nargs() > 0) {
+ if (atom->asNestInset() && atom->isActive()) {
cur.posLeft();
cur.pushLeft(*cur.nextInset());
}