// this whole function is a hack and won't work for incremental font
// changes...
bv->lockedInsetStoreUndo(Undo::EDIT);
- if (mathcursor->par()->name() == font) {
+ if (mathcursor->par()->name() == font)
mathcursor->handleFont(font);
- bv->updateInset(this);
- } else {
- bool sel = mathcursor->selection();
- if (sel)
- bv->updateInset(this);
+ else {
mathcursor->handleNest(createMathInset(font));
mathcursor->insert(arg);
- if (!sel)
- bv->updateInset(this);
}
}
case LFUN_MATH_LIMITS:
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->dispatch(cmd);
- bv->updateInset(this);
break;
case LFUN_RIGHTSEL:
result = mathcursor->right(sel) ? DISPATCHED : FINISHED_RIGHT;
//lyxerr << "calling scroll 20\n";
//scroll(bv, 20);
- bv->updateInset(this);
// write something to the minibuffer
//bv->owner()->message(mathcursor->info());
break;
sel = true; // fall through
case LFUN_LEFT:
result = mathcursor->left(sel) ? DISPATCHED : FINISHED;
- bv->updateInset(this);
break;
case LFUN_UPSEL:
sel = true; // fall through
case LFUN_UP:
result = mathcursor->up(sel) ? DISPATCHED : FINISHED_UP;
- bv->updateInset(this);
break;
case LFUN_DOWNSEL:
sel = true; // fall through
case LFUN_DOWN:
result = mathcursor->down(sel) ? DISPATCHED : FINISHED_DOWN;
- bv->updateInset(this);
break;
case LFUN_WORDSEL:
mathcursor->home(false);
mathcursor->end(true);
- bv->updateInset(this);
break;
case LFUN_UP_PARAGRAPHSEL:
case LFUN_DOWN_PARAGRAPHSEL:
case LFUN_DOWN_PARAGRAPH:
result = FINISHED;
- bv->updateInset(this);
break;
case LFUN_HOMESEL:
case LFUN_HOME:
case LFUN_WORDLEFT:
result = mathcursor->home(sel) ? DISPATCHED : FINISHED;
- bv->updateInset(this);
break;
case LFUN_ENDSEL:
case LFUN_END:
case LFUN_WORDRIGHT:
result = mathcursor->end(sel) ? DISPATCHED : FINISHED_RIGHT;
- bv->updateInset(this);
break;
case LFUN_PRIORSEL:
case LFUN_BEGINNINGBUFSEL:
case LFUN_BEGINNINGBUF:
result = FINISHED;
- bv->updateInset(this);
break;
case LFUN_NEXTSEL:
case LFUN_ENDBUFSEL:
case LFUN_ENDBUF:
result = FINISHED_RIGHT;
- bv->updateInset(this);
break;
case LFUN_TAB:
mathcursor->idxNext();
- bv->updateInset(this);
break;
case LFUN_SHIFT_TAB:
mathcursor->idxPrev();
- bv->updateInset(this);
break;
case LFUN_DELETE_WORD_BACKWARD:
case LFUN_BACKSPACE:
bv->lockedInsetStoreUndo(Undo::EDIT);
- if (mathcursor->backspace()) {
- result = DISPATCHED;
- } else {
+ if (!mathcursor->backspace()) {
result = FINISHED;
remove_inset = true;
}
- bv->updateInset(this);
break;
case LFUN_DELETE_WORD_FORWARD:
case LFUN_DELETE:
bv->lockedInsetStoreUndo(Undo::EDIT);
- if (mathcursor->erase()) {
- result = DISPATCHED;
- } else {
+ if (!mathcursor->erase()) {
result = FINISHED;
remove_inset = true;
}
- bv->updateInset(this);
break;
// case LFUN_GETXY:
istringstream is(cmd.argument.c_str());
is >> x >> y;
mathcursor->setPos(x, y);
- bv->updateInset(this);
break;
}
mathcursor->macroModeClose();
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->selPaste();
- bv->updateInset(this);
break;
case LFUN_CUT:
bv->lockedInsetStoreUndo(Undo::DELETE);
mathcursor->selCut();
- bv->updateInset(this);
break;
case LFUN_COPY:
// deadkeys
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->script(true);
- bv->updateInset(this);
}
break;
break;
// Math fonts
- //case LFUN_GREEK_TOGGLE: handleFont(bv, cmd.argument, "lyxgreek"); break;
case LFUN_BOLD: handleFont(bv, cmd.argument, "mathbf"); break;
case LFUN_SANS: handleFont(bv, cmd.argument, "mathsf"); break;
case LFUN_EMPH: handleFont(bv, cmd.argument, "mathcal"); break;
case LFUN_FREEFONT_APPLY: handleFont(bv, cmd.argument, "textrm"); break;
case LFUN_DEFAULT: handleFont(bv, cmd.argument, "textnormal"); break;
- //case LFUN_GREEK:
- // handleFont(bv, cmd.argument, "lyxgreek1");
- // if (cmd.argument.size())
- // mathcursor->insert(asArray(cmd.argument));
- // break;
-
case LFUN_MATH_MODE:
- if (mathcursor->currentMode() == MathInset::TEXT_MODE) {
+ if (mathcursor->currentMode() == MathInset::TEXT_MODE)
mathcursor->niceInsert(MathAtom(new MathHullInset("simple")));
- bv->updateInset(this);
- } else {
+ else
handleFont(bv, cmd.argument, "textrm");
- }
//bv->owner()->message(_("math text mode toggled"));
break;
if (!arg.empty()) {
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->setSize(arg);
- bv->updateInset(this);
}
#endif
break;
v_align += 'c';
mathcursor->niceInsert(
MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align)));
- bv->updateInset(this);
break;
}
{
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->script(cmd.action == LFUN_SUPERSCRIPT);
- bv->updateInset(this);
break;
}
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->handleNest(MathAtom(new MathDelimInset(ls, rs)));
- bv->updateInset(this);
break;
}
case LFUN_MATH_SPACE:
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->insert(MathAtom(new MathSpaceInset(",")));
- bv->updateInset(this);
break;
case LFUN_UNDO:
// interpret this as if a backslash was typed
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->interpret('\\');
- bv->updateInset(this);
break;
case LFUN_BREAKPARAGRAPH:
case LFUN_INSERT_MATH:
bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->niceInsert(argument);
- bv->updateInset(this);
break;
case -1:
result = mathcursor->interpret(argument[0]) ? DISPATCHED : FINISHED_RIGHT;
else
mathcursor->insert(asArray(argument));
- bv->updateInset(this);
}
break;
case LFUN_INSET_TOGGLE:
mathcursor->insetToggle();
- bv->updateInset(this);
break;
case LFUN_DIALOG_SHOW_NEW_INSET: {
result = UNDISPATCHED;
}
}
- if (result == DISPATCHED)
- bv->updateInset(this);
}
break;
result = UNDISPATCHED;
}
+ if (result == DISPATCHED)
+ bv->updateInset(this);
+
mathcursor->normalize();
mathcursor->touch();
}
break;
}
+
default:
break;
}