using cap::selClearOrDel;
-InsetMathNest::InsetMathNest(idx_type nargs)
- : cells_(nargs), lock_(false), mouse_hover_(false)
-{}
+InsetMathNest::InsetMathNest(Buffer * buf, idx_type nargs)
+ : InsetMath(buf), cells_(nargs), lock_(false), mouse_hover_(false)
+{
+ setBuffer(*buf);
+}
InsetMathNest::InsetMathNest(InsetMathNest const & inset)
if (cur.inset().asInsetMath()->name() == font)
cur.handleFont(to_utf8(font));
else
- handleNest(cur, createInsetMath(font), arg);
+ handleNest(cur, createInsetMath(font, cur.buffer()), arg);
}
font.fromString(to_utf8(arg), b);
if (font.fontInfo().color() != Color_inherit &&
font.fontInfo().color() != Color_ignore)
- handleNest(cur, MathAtom(new InsetMathColor(true, font.fontInfo().color())));
+ handleNest(cur, MathAtom(new InsetMathColor(buffer_, true, font.fontInfo().color())));
// FIXME: support other font changes here as well?
}
is >> n;
topaste = cap::selection(n);
}
- cur.niceInsert(topaste, parseflg);
+ cur.niceInsert(topaste, parseflg, false);
cur.clearSelection(); // bug 393
cur.finishUndo();
break;
handleFont(cur, cmd.argument(), "textnormal");
break;
+ case LFUN_FONT_UNDERLINE:
+ cur.recordUndo();
+ cur.handleNest(createInsetMath("underline", cur.buffer()));
+ break;
case LFUN_MATH_MODE: {
#if 1
// ignore math-mode on when already in math mode
selClearOrDel(cur);
//cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
if (currentMode() <= Inset::TEXT_MODE)
- cur.plainInsert(MathAtom(new InsetMathEnsureMath));
+ cur.plainInsert(MathAtom(new InsetMathEnsureMath(buffer_)));
else
- cur.plainInsert(MathAtom(new InsetMathBox(from_ascii("mbox"))));
+ cur.plainInsert(MathAtom(new InsetMathBox(buffer_, from_ascii("mbox"))));
cur.posBackward();
cur.pushBackward(*cur.nextInset());
cur.niceInsert(save_selection);
#else
if (currentMode() == Inset::TEXT_MODE) {
cur.recordUndoSelection();
- cur.niceInsert(MathAtom(new InsetMathHull("simple")));
+ cur.niceInsert(MathAtom(new InsetMathHull("simple", cur.buffer())));
cur.message(_("create new math text environment ($...$)"));
} else {
handleFont(cur, cmd.argument(), "textrm");
cur.macroModeClose();
docstring const save_selection = grabAndEraseSelection(cur);
selClearOrDel(cur);
- cur.plainInsert(MathAtom(new InsetMathHull(hullRegexp)));
+ cur.plainInsert(MathAtom(new InsetMathHull(buffer_, hullRegexp)));
cur.posBackward();
cur.pushBackward(*cur.nextInset());
cur.niceInsert(save_selection);
if (n < 1)
n = 1;
v_align += 'c';
- cur.niceInsert(
- MathAtom(new InsetMathArray(from_ascii("array"), m, n, (char)v_align[0], h_align)));
+ cur.niceInsert(MathAtom(new InsetMathArray(buffer_,
+ from_ascii("array"), m, n, (char)v_align[0], h_align)));
break;
}
if (n < 1)
n = 1;
cur.niceInsert(
- MathAtom(new InsetMathAMSArray(name, m, n)));
+ MathAtom(new InsetMathAMSArray(buffer_, name, m, n)));
break;
}
if (rs.empty())
rs = ')';
cur.recordUndo();
- cur.handleNest(MathAtom(new InsetMathDelim(ls, rs)));
+ cur.handleNest(MathAtom(new InsetMathDelim(buffer_, ls, rs)));
break;
}
docstring const & name = cmd.argument();
string data;
if (name == "ref") {
- InsetMathRef tmp(name);
+ InsetMathRef tmp(buffer_, name);
data = tmp.createDialogStr(to_utf8(name));
} else if (name == "mathspace") {
InsetMathSpace tmp;
flag.setEnabled(true);
break;
+ case LFUN_FONT_UNDERLINE:
case LFUN_FONT_FRAK:
flag.setEnabled(currentMode() != TEXT_MODE);
break;
save_selection = grabAndEraseSelection(cur);
cur.clearTargetX();
+ Buffer * buf = cur.buffer();
// handle macroMode
if (cur.inMacroMode()) {
if (c == '\\') {
cur.backspace();
if (currentMode() <= InsetMath::TEXT_MODE)
- cur.niceInsert(createInsetMath("textbackslash"));
+ cur.niceInsert(createInsetMath("textbackslash", buf));
else
- cur.niceInsert(createInsetMath("backslash"));
+ cur.niceInsert(createInsetMath("backslash", buf));
} else if (c == '^' && currentMode() == InsetMath::MATH_MODE) {
cur.backspace();
- cur.niceInsert(createInsetMath("mathcircumflex"));
+ cur.niceInsert(createInsetMath("mathcircumflex", buf));
} else if (c == '{') {
cur.backspace();
- cur.niceInsert(MathAtom(new InsetMathBrace));
+ cur.niceInsert(MathAtom(new InsetMathBrace(buf)));
} else if (c == '%') {
cur.backspace();
- cur.niceInsert(MathAtom(new InsetMathComment));
+ cur.niceInsert(MathAtom(new InsetMathComment(buf)));
} else if (c == '#') {
LASSERT(cur.activeMacro(), /**/);
cur.activeMacro()->setName(name + docstring(1, c));
} else {
cur.backspace();
- cur.niceInsert(createInsetMath(docstring(1, c)));
+ cur.niceInsert(createInsetMath(docstring(1, c), buf));
}
return true;
}
}
}
if (c == '{')
- cur.niceInsert(MathAtom(new InsetMathBrace));
+ cur.niceInsert(MathAtom(new InsetMathBrace(buf)));
else if (c != ' ')
interpretChar(cur, c);
return true;
return true;
}
if (c == '~') {
- cur.niceInsert(createInsetMath("sim"));
+ cur.niceInsert(createInsetMath("sim", buf));
return true;
}
if (currentMode() == InsetMath::MATH_MODE && !isAsciiOrMathAlpha(c)) {
- MathAtom at = createInsetMath("text");
+ MathAtom at = createInsetMath("text", buf);
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
cur.niceInsert(at);
cur.posForward();
}
} else {
if (c == '^') {
- cur.niceInsert(createInsetMath("textasciicircum"));
+ cur.niceInsert(createInsetMath("textasciicircum", buf));
return true;
}
if (c == '~') {
- cur.niceInsert(createInsetMath("textasciitilde"));
+ cur.niceInsert(createInsetMath("textasciitilde", buf));
return true;
}
}
if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' ||
c == '%' || c == '_') {
- cur.niceInsert(createInsetMath(docstring(1, c)));
+ cur.niceInsert(createInsetMath(docstring(1, c), buf));
return true;
}
//lyxerr << "handling script: up: " << up << endl;
if (cur.inMacroMode() && cur.macroName() == "\\") {
if (up)
- cur.niceInsert(createInsetMath("mathcircumflex"));
+ cur.niceInsert(createInsetMath("mathcircumflex", cur.buffer()));
else
interpretChar(cur, '_');
return true;
// one if in the very first position of the array
if (cur.pos() == 0) {
//lyxerr << "new scriptinset" << endl;
- cur.insert(new InsetMathScript(up));
+ cur.insert(new InsetMathScript(buffer_, up));
} else {
//lyxerr << "converting prev atom " << endl;
- cur.prevAtom() = MathAtom(new InsetMathScript(cur.prevAtom(), up));
+ cur.prevAtom() = MathAtom(new InsetMathScript(buffer_, cur.prevAtom(), up));
}
--cur.pos();
InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset();