mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 05:33:33 +00:00
* handle the multiple-selected-cells case also for color changes in mathed
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23682 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5e2aeffc43
commit
2f67f8c2b3
@ -416,7 +416,13 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
|
||||
if (cur.inset().asInsetMath()->name() == font) {
|
||||
cur.recordUndoInset();
|
||||
cur.handleFont(to_utf8(font));
|
||||
} else {
|
||||
} else
|
||||
handleNest(cur, createInsetMath(font), arg);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathNest::handleNest(Cursor & cur, MathAtom const & nest, docstring const & arg)
|
||||
{
|
||||
CursorSlice i1 = cur.selBegin();
|
||||
CursorSlice i2 = cur.selEnd();
|
||||
if (!i1.inset().asInsetMath())
|
||||
@ -424,7 +430,7 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
|
||||
if (i1.idx() == i2.idx()) {
|
||||
// the easy case where only one cell is selected
|
||||
cur.recordUndo();
|
||||
cur.handleNest(createInsetMath(font));
|
||||
cur.handleNest(nest);
|
||||
cur.insert(arg);
|
||||
return;
|
||||
}
|
||||
@ -441,7 +447,7 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
|
||||
cur.setSelection();
|
||||
|
||||
// change font of cell
|
||||
cur.handleNest(createInsetMath(font));
|
||||
cur.handleNest(nest);
|
||||
cur.insert(arg);
|
||||
|
||||
// cur is in the font inset now. If the loop continues,
|
||||
@ -466,8 +472,8 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
|
||||
cur.pos() = cur.lastpos();
|
||||
cur.setSelection();
|
||||
|
||||
// change font of cell
|
||||
cur.handleNest(createInsetMath(font));
|
||||
//
|
||||
cur.handleNest(nest);
|
||||
cur.insert(arg);
|
||||
|
||||
// cur is in the font inset now. If the loop continues,
|
||||
@ -477,7 +483,6 @@ void InsetMathNest::handleFont(Cursor & cur, docstring const & arg, docstring co
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
@ -486,10 +491,8 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
Font font;
|
||||
bool b;
|
||||
font.fromString(to_utf8(arg), b);
|
||||
if (font.fontInfo().color() != Color_ignore) {
|
||||
MathAtom at = MathAtom(new InsetMathColor(true, font.fontInfo().color()));
|
||||
cur.handleNest(at, 0);
|
||||
}
|
||||
if (font.fontInfo().color() != Color_ignore)
|
||||
handleNest(cur, MathAtom(new InsetMathColor(true, font.fontInfo().color())));
|
||||
|
||||
// FIXME: support other font changes here as well?
|
||||
}
|
||||
|
@ -169,6 +169,11 @@ protected:
|
||||
docstring const & arg, char const * const font);
|
||||
///
|
||||
void handleFont2(Cursor & cur, docstring const & arg);
|
||||
/// Grab and erase selection and insert the InsetMathNest atom in every
|
||||
/// previously selected cell, insert the grabbed former data and \c arg
|
||||
/// in the first cell of the inserted atom.
|
||||
void handleNest(Cursor & cur, MathAtom const & nest,
|
||||
docstring const & arg = docstring());
|
||||
|
||||
/// interpret \p c and insert the result at the current position of
|
||||
/// of \p cur. Return whether the cursor should stay in the formula.
|
||||
|
Loading…
Reference in New Issue
Block a user