int sel_y;
bool sel_flag;
+
void handleFont(BufferView * bv, MathTextCodes t)
{
if (mathcursor->selection())
bool openNewInset(BufferView * bv, UpdatableInset * new_inset)
{
- LyXText * lt = bv->getLyXText();
-
- bv->beforeChange(lt);
- finishUndo();
if (!bv->insertInset(new_inset)) {
delete new_inset;
return false;
}
-// returns the nearest enclosing grid
-MathArrayInset * matrixpar(MathInset::idx_type & idx)
-{
- idx = 0;
- return mathcursor ? mathcursor->enclosingArray(idx) : 0;
-}
-
-
} // namespace anon
case LFUN_PASTE:
if (was_macro)
mathcursor->macroModeClose();
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->selPaste();
updateLocal(bv, true);
break;
break;
case LFUN_MATH_LIMITS:
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
if (mathcursor->toggleLimits())
updateLocal(bv, true);
break;
case LFUN_MATH_SIZE:
#if 0
if (!arg.empty()) {
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->setSize(arg);
updateLocal(bv, true);
}
case LFUN_INSERT_MATRIX:
if (!arg.empty()) {
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->interpret("matrix " + arg);
updateLocal(bv, true);
}
case LFUN_MATH_DELIM:
{
- bv->lockedInsetStoreUndo(Undo::INSERT);
//lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
string ls;
string rs;
case LFUN_PROTECTEDSPACE:
//lyxerr << " called LFUN_PROTECTEDSPACE\n";
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->insert(MathAtom(new MathSpaceInset(1)));
updateLocal(bv, true);
break;
case LFUN_MATH_HALIGN:
- {
- bv->lockedInsetStoreUndo(Undo::INSERT);
- lyxerr << "handling halign '" << arg << "'\n";
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- if (!p)
- break;
- p->halign(arg.size() ? arg[0] : 'c', p->col(idx));
- updateLocal(bv, true);
- break;
- }
-
case LFUN_MATH_VALIGN:
- {
- bv->lockedInsetStoreUndo(Undo::INSERT);
- lyxerr << "handling valign '" << arg << "'\n";
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- if (!p)
- break;
- p->valign(arg.size() ? arg[0] : 'c');
- updateLocal(bv, true);
- break;
- }
-
case LFUN_MATH_ROW_INSERT:
- {
- bv->lockedInsetStoreUndo(Undo::INSERT);
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- lyxerr << " calling LFUN_MATH_ROW_INSERT on " << p << endl;
- if (!p)
- break;
- p->addRow(p->row(idx));
- updateLocal(bv, true);
- break;
- }
-
case LFUN_MATH_ROW_DELETE:
- {
- bv->lockedInsetStoreUndo(Undo::INSERT);
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- lyxerr << " calling LFUN_MATH_ROW_DELETE on " << p << endl;
- if (!p)
- break;
- p->delRow(p->row(idx));
- updateLocal(bv, true);
- break;
- }
-
case LFUN_MATH_COLUMN_INSERT:
- {
- bv->lockedInsetStoreUndo(Undo::INSERT);
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- if (!p)
- break;
- p->addCol(p->col(idx));
- updateLocal(bv, true);
- break;
- }
-
case LFUN_MATH_COLUMN_DELETE:
{
- bv->lockedInsetStoreUndo(Undo::INSERT);
- MathInset::idx_type idx;
- MathArrayInset * p = matrixpar(idx);
- if (!p)
- break;
- p->delCol(p->col(idx));
- updateLocal(bv, true);
+ MathInset::idx_type idx = 0;
+ MathArrayInset * p = mathcursor ? mathcursor->enclosingArray(idx) : 0;
+ if (p) {
+ bv->lockedInsetStoreUndo(Undo::EDIT);
+ char al = arg.size() ? arg[0] : 'c';
+ switch (action) {
+ case LFUN_MATH_HALIGN: p->halign(al, p->col(idx)); break;
+ case LFUN_MATH_VALIGN: p->valign(al); break;
+ case LFUN_MATH_ROW_INSERT: p->addRow(p->row(idx)); break;
+ case LFUN_MATH_ROW_DELETE: p->delRow(p->row(idx)); break;
+ case LFUN_MATH_COLUMN_INSERT: p->addCol(p->col(idx)); break;
+ case LFUN_MATH_COLUMN_DELETE: p->delCol(p->col(idx)); break;
+ default: ;
+ }
+ updateLocal(bv, true);
+ }
break;
}
case LFUN_INSERT_MATH:
case LFUN_SELFINSERT:
if (!arg.empty()) {
- bv->lockedInsetStoreUndo(Undo::INSERT);
+ bv->lockedInsetStoreUndo(Undo::EDIT);
mathcursor->interpret(arg);
updateLocal(bv, true);
}
FLAG_RIGHT = 1 << 2, // next \\right ends the parsing process
FLAG_END = 1 << 3, // next \\end ends the parsing process
FLAG_BRACK_END = 1 << 4, // next closing bracket ends the parsing process
- FLAG_NEWLINE = 1 << 6, // next \\\\ ends the parsing process
FLAG_ITEM = 1 << 7, // read a (possibly braced token)
FLAG_BLOCK = 1 << 8, // next block ends the parsing process
FLAG_LEAVE = 1 << 9 // leave the loop at the end
add(array, t.character(), code);
//
- // codesequences
+ // control sequences
//
- else if (t.cs() == "protect")
+ else if (t.cs() == "protect")
+ // ignore \\protect, will be re-added during output
;
else if (t.cs() == "end")
else if (t.cs() == "\\") {
curr_skip_ = getArg('[', ']');
- if (flags & FLAG_NEWLINE)
- return;
- lyxerr[Debug::MATHED]
- << "found newline unexpectedly, array: '" << array << "'\n";
+ lyxerr << "found newline unexpectedly, array: '" << array << "'\n";
array.push_back(createMathInset("\\"));
}