LASSERT(!empty(), return);
if (inMathed()) {
cap::selClearOrDel(*this);
- insert(new InsetMathChar(c));
+ insert(new InsetMathChar(buffer(), c));
} else {
text()->insertChar(*this, c);
}
docstring const name = t->asMacro()->name();
MacroData const * data = buffer()->getMacro(name);
if (data && data->numargs() - data->optionals() > 0) {
- plainInsert(MathAtom(new InsetMathBrace(ar)));
+ plainInsert(MathAtom(new InsetMathBrace(buffer(), ar)));
posBackward();
}
}
// finally put the macro argument behind, if needed
if (macroArg) {
if (selection.size() > 1 || selection[0]->asScriptInset())
- plainInsert(MathAtom(new InsetMathBrace(selection)));
+ plainInsert(MathAtom(new InsetMathBrace(buffer(), selection)));
else
insert(selection);
}
class InsetMath : public Inset {
public:
///
- explicit InsetMath(Buffer * buf = 0) : Inset(buf) {}
+ explicit InsetMath(Buffer * buf) : Inset(buf) {}
/// identification as math inset
InsetMath * asInsetMath() override { return this; }
/// identification as math inset
namespace lyx {
-InsetMathBig::InsetMathBig(docstring const & name, docstring const & delim)
- : name_(name), delim_(delim)
+InsetMathBig::InsetMathBig(Buffer * buf, docstring const & name, docstring const & delim)
+ : InsetMath(buf), name_(name), delim_(delim)
{}
class InsetMathBig : public InsetMath {
public:
///
- InsetMathBig(docstring const & name, docstring const & delim);
+ InsetMathBig(Buffer * buf, docstring const & name, docstring const & delim);
///
docstring name() const override;
/// class is different for l(eft), r(ight) and m(iddle)
{}
-InsetMathBrace::InsetMathBrace(MathData const & ar)
- : InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1),
+InsetMathBrace::InsetMathBrace(Buffer * buf, MathData const & ar)
+ : InsetMathNest(buf, 1),
current_mode_(UNDECIDED_MODE)
{
cell(0) = ar;
///
explicit InsetMathBrace(Buffer * buf);
///
- explicit InsetMathBrace(MathData const & ar);
+ explicit InsetMathBrace(Buffer * buf, MathData const & ar);
/// identifies brace insets
InsetMathBrace * asBraceInset() override { return this; }
/// identifies brace insets
}
-InsetMathChar::InsetMathChar(char_type c)
- : char_(c), kerning_(0), subst_(makeSubstitute(c))
+InsetMathChar::InsetMathChar(Buffer * buf, char_type c)
+ : InsetMath(buf), char_(c), kerning_(0), subst_(makeSubstitute(c))
{}
class InsetMathChar : public InsetMath {
public:
///
- explicit InsetMathChar(char_type c);
+ explicit InsetMathChar(Buffer * buf, char_type c);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
namespace lyx {
-InsetMathDots::InsetMathDots(latexkeys const * key)
- : dh_(0), key_(key)
+InsetMathDots::InsetMathDots(Buffer * buf, latexkeys const * key)
+ : InsetMath(buf), dh_(0), key_(key)
{}
class InsetMathDots : public InsetMath {
public:
///
- explicit InsetMathDots(latexkeys const * key);
+ explicit InsetMathDots(Buffer * buf, latexkeys const * key);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
// If we should decide to do so later, then we'll need to re-merge
// r32566 and r32568.
// So right now this only handles integrals.
- InsetMathSymbol sym(symbol_);
+ InsetMathSymbol sym(buffer_, symbol_);
bool const lower = !cell(2).empty();
bool const upper = !cell(3).empty();
if (lower && upper)
{
// At the moment, we are not extracting sums and the like for HTML.
// So right now this only handles integrals.
- InsetMathSymbol sym(symbol_);
+ InsetMathSymbol sym(buffer_, symbol_);
bool const lower = !cell(2).empty();
bool const upper = !cell(3).empty();
else {
for (unsigned int l = 0; l < grid.rowinfo_[0].lines; ++l) {
cur.cell().insert(0,
- MathAtom(new InsetMathUnknown(from_ascii("\\hline"))));
+ MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\hline"))));
cur.pos()++;
}
}
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
idx_type i = index(r + startrow, 0);
cell(i).insert(0,
- MathAtom(new InsetMathUnknown(from_ascii("\\hline"))));
+ MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\hline"))));
}
}
// append columns for the left over horizontal cells
else {
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
cell(i).insert(0,
- MathAtom(new InsetMathUnknown(from_ascii("\\hline"))));
+ MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\hline"))));
}
}
}
}
MathData eq(buffer_);
- eq.push_back(MathAtom(new InsetMathChar('=')));
+ eq.push_back(MathAtom(new InsetMathChar(buffer_, '=')));
// go to first item in line
cur.idx() -= cur.idx() % ncols();
namespace lyx {
-InsetMathKern::InsetMathKern()
+InsetMathKern::InsetMathKern(Buffer * buf)
+ : InsetMath(buf)
{
}
-InsetMathKern::InsetMathKern(Length const & w)
- : wid_(w)
+InsetMathKern::InsetMathKern(Buffer * buf, Length const & w)
+ : InsetMath(buf), wid_(w)
{
}
-InsetMathKern::InsetMathKern(docstring const & s)
- : wid_(to_utf8(s))
+InsetMathKern::InsetMathKern(Buffer * buf, docstring const & s)
+ : InsetMath(buf), wid_(to_utf8(s))
{
}
class InsetMathKern : public InsetMath {
public:
///
- InsetMathKern();
+ InsetMathKern(Buffer * buf);
///
- explicit InsetMathKern(Length const & wid);
+ explicit InsetMathKern(Buffer * buf, Length const & wid);
///
- explicit InsetMathKern(docstring const & wid);
+ explicit InsetMathKern(Buffer * buf, docstring const & wid);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
public:
///
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx)
- : mathMacro_(mathMacro), idx_(idx), def_(&mathMacro->buffer()) {}
+ : InsetMath(&mathMacro->buffer()), mathMacro_(mathMacro), idx_(idx),
+ def_(&mathMacro->buffer()) {}
///
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx, docstring const & def)
- : mathMacro_(mathMacro), idx_(idx), def_(&mathMacro->buffer())
+ : InsetMath(&mathMacro->buffer()), mathMacro_(mathMacro), idx_(idx),
+ def_(&mathMacro->buffer())
{
asArray(def, def_);
}
}
-InsetMathMacroArgument::InsetMathMacroArgument(int n)
- : number_(n)
+InsetMathMacroArgument::InsetMathMacroArgument(Buffer * buf, int n)
+ : InsetMathHash(buf), number_(n)
{
if (n < 1 || n > 9) {
LYXERR0("InsetMathMacroArgument::InsetMathMacroArgument: wrong Argument id: "
// A # that failed to parse
class InsetMathHash : public InsetMath {
public:
- explicit InsetMathHash(docstring const & str = docstring()) : str_('#' + str) {}
+ explicit InsetMathHash(Buffer * buf, docstring const & str = docstring())
+ : InsetMath(buf), str_('#' + str) {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
class InsetMathMacroArgument : public InsetMathHash {
public:
/// Assumes 0 < number <= 9
- explicit InsetMathMacroArgument(int number);
+ explicit InsetMathMacroArgument(Buffer * buf, int number);
///
int number() const { return number_; }
/// Assumes 0 < n <= 9
class InsetMathWrapper : public InsetMath {
public:
///
- explicit InsetMathWrapper(MathData const * value) : value_(value) {}
+ explicit InsetMathWrapper(Buffer * buf, MathData const * value)
+ : InsetMath(buf), value_(value) {}
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
class InsetNameWrapper : public InsetMathWrapper {
public:
///
- InsetNameWrapper(MathData const * value, InsetMathMacroTemplate const & parent);
+ InsetNameWrapper(Buffer * buf, MathData const * value, InsetMathMacroTemplate const & parent);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
};
-InsetNameWrapper::InsetNameWrapper(MathData const * value,
+InsetNameWrapper::InsetNameWrapper(Buffer * buf, MathData const * value,
InsetMathMacroTemplate const & parent)
- : InsetMathWrapper(value), parent_(parent)
+ : InsetMathWrapper(buf, value), parent_(parent)
{
}
look_.push_back(MathAtom(
new InsetLabelBox(buffer_, _("Name"), *this, false)));
MathData & nameData = look_[look_.size() - 1].nucleus()->cell(0);
- nameData.push_back(MathAtom(new InsetNameWrapper(&cell(0), *this)));
+ nameData.push_back(MathAtom(new InsetNameWrapper(buffer_, &cell(0), *this)));
// [#1][#2]
int i = 0;
optData = &(*optData)[optData->size() - 1].nucleus()->cell(0);
}
- optData->push_back(MathAtom(new InsetMathChar('[')));
- optData->push_back(MathAtom(new InsetMathWrapper(&cell(1 + i))));
- optData->push_back(MathAtom(new InsetMathChar(']')));
+ optData->push_back(MathAtom(new InsetMathChar(buffer_, '[')));
+ optData->push_back(MathAtom(new InsetMathWrapper(buffer_, &cell(1 + i))));
+ optData->push_back(MathAtom(new InsetMathChar(buffer_, ']')));
}
}
// {#3}{#4}
for (; i < numargs_; ++i) {
- MathData arg;
- arg.push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
+ MathData arg(buffer_);
+ arg.push_back(MathAtom(new InsetMathMacroArgument(buffer_, i + 1)));
if (i >= argsInLook_) {
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
Color_mathmacrooldarg,
- MathAtom(new InsetMathBrace(arg)))));
+ MathAtom(new InsetMathBrace(buffer_, arg)))));
} else
- look_.push_back(MathAtom(new InsetMathBrace(arg)));
+ look_.push_back(MathAtom(new InsetMathBrace(buffer_, arg)));
}
for (; i < argsInLook_; ++i) {
MathData arg(buffer_);
- arg.push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
+ arg.push_back(MathAtom(new InsetMathMacroArgument(buffer_, i + 1)));
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
Color_mathmacronewarg,
- MathAtom(new InsetMathBrace(arg)))));
+ MathAtom(new InsetMathBrace(buffer_, arg)))));
}
// :=
- look_.push_back(MathAtom(new InsetMathChar(':')));
- look_.push_back(MathAtom(new InsetMathChar('=')));
+ look_.push_back(MathAtom(new InsetMathChar(buffer_, ':')));
+ look_.push_back(MathAtom(new InsetMathChar(buffer_, '=')));
// definition
look_.push_back(MathAtom(
new InsetLabelBox(buffer_, MathAtom(
- new InsetMathWrapper(&cell(defIdx()))), _("TeX"), *this, true)));
+ new InsetMathWrapper(buffer_, &cell(defIdx()))), _("TeX"), *this, true)));
// display
look_.push_back(MathAtom(
new InsetDisplayLabelBox(buffer_, MathAtom(
- new InsetMathWrapper(&cell(displayIdx()))), _("LyX"), *this)));
+ new InsetMathWrapper(buffer_, &cell(displayIdx()))), _("LyX"), *this)));
look_.setContentsBuffer();
}
if (found[i])
continue;
- cell(idx).push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
+ cell(idx).push_back(MathAtom(new InsetMathMacroArgument(buffer_, i + 1)));
}
}
if (addarg) {
shiftArguments(pos, 1);
- cell(defIdx()).push_back(MathAtom(new InsetMathMacroArgument(pos + 1)));
+ cell(defIdx()).push_back(MathAtom(new InsetMathMacroArgument(buffer_, pos + 1)));
if (!cell(displayIdx()).empty())
- cell(displayIdx()).push_back(MathAtom(new InsetMathMacroArgument(pos + 1)));
+ cell(displayIdx()).push_back(MathAtom(new InsetMathMacroArgument(buffer_, pos + 1)));
}
if (!greedy) {
docstring const selection = grabAndEraseSelection(cur);
selClearOrDel(cur);
if (have_l)
- cur.insert(MathAtom(new InsetMathBig(lname,
- ldelim)));
+ cur.insert(MathAtom(new InsetMathBig(buffer_, lname, ldelim)));
// first insert the right delimiter and then go back
// and re-insert the selection (bug 7088)
if (have_r) {
- cur.insert(MathAtom(new InsetMathBig(rname,
- rdelim)));
+ cur.insert(MathAtom(new InsetMathBig(buffer_, rname, rdelim)));
cur.posBackward();
}
cur.niceInsert(selection);
cur.recordUndoSelection();
string const name = cmd.getArg(0);
if (name == "normal")
- cur.insert(MathAtom(new InsetMathSpace(" ", "")));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, " ", "")));
else if (name == "protected")
- cur.insert(MathAtom(new InsetMathSpace("~", "")));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, "~", "")));
else if (name == "thin" || name == "med" || name == "thick")
- cur.insert(MathAtom(new InsetMathSpace(name + "space", "")));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, name + "space", "")));
else if (name == "hfill*")
- cur.insert(MathAtom(new InsetMathSpace("hspace*{\\fill}", "")));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, "hspace*{\\fill}", "")));
else if (name == "quad" || name == "qquad" ||
name == "enspace" || name == "enskip" ||
name == "negthinspace" || name == "negmedspace" ||
name == "negthickspace" || name == "hfill")
- cur.insert(MathAtom(new InsetMathSpace(name, "")));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, name, "")));
else if (name == "hspace" || name == "hspace*") {
string const len = cmd.getArg(1);
if (len.empty() || !isValidLength(len)) {
"needs a valid length argument." << endl;
break;
}
- cur.insert(MathAtom(new InsetMathSpace(name, len)));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, name, len)));
} else
- cur.insert(MathAtom(new InsetMathSpace));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_)));
break;
}
case LFUN_MATH_SPACE:
cur.recordUndoSelection();
if (cmd.argument().empty())
- cur.insert(MathAtom(new InsetMathSpace));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_)));
else {
string const name = cmd.getArg(0);
string const len = cmd.getArg(1);
- cur.insert(MathAtom(new InsetMathSpace(name, len)));
+ cur.insert(MathAtom(new InsetMathSpace(buffer_, name, len)));
}
break;
cur.backspace();
int n = c - '0';
if (n >= 1 && n <= 9)
- cur.insert(new InsetMathMacroArgument(n));
+ cur.insert(new InsetMathMacroArgument(buffer_, n));
return true;
}
asArray(p->selection(), sel);
cur.backspace();
if (c == '{')
- cur.niceInsert(MathAtom(new InsetMathBrace(sel)));
+ cur.niceInsert(MathAtom(new InsetMathBrace(buffer_, sel)));
else
cur.niceInsert(MathAtom(new InsetMathComment(sel)));
} else if (c == '#') {
--cur.pos();
cur.cell().erase(cur.pos());
cur.plainInsert(MathAtom(
- new InsetMathBig(name.substr(1), delim)));
+ new InsetMathBig(buffer_, name.substr(1), delim)));
return true;
}
} else if (name == "\\smash" && c == '[') {
cur.recordUndoInset();
docstring const safe = cap::grabAndEraseSelection(cur);
if (!cur.inRegexped() && !in_macro_name)
- cur.insert(MathAtom(new InsetMathUnknown(from_ascii("\\"), safe, false)));
+ cur.insert(MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\"), safe, false)));
else
cur.niceInsert(createInsetMath("backslash", buf));
}
return true;
}
if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
- MathAtom const atom(new InsetMathChar(c));
+ MathAtom const atom(new InsetMathChar(buffer_, c));
if (cur.prevInset() && cur.prevInset()->asInsetMath()->name() == "text") {
// reuse existing \text inset
cur.prevInset()->asInsetMath()->cell(0).push_back(atom);
if (l && l->inset == "big") {
cur.recordUndoSelection();
cur.cell()[cur.pos() - 1] =
- MathAtom(new InsetMathBig(prev, str));
+ MathAtom(new InsetMathBig(buffer_, prev, str));
return true;
}
}
namespace lyx {
-InsetMathNumber::InsetMathNumber(docstring const & s)
- : str_(s)
+InsetMathNumber::InsetMathNumber(Buffer * buf, docstring const & s)
+ : InsetMath(buf), str_(s)
{}
class InsetMathNumber : public InsetMath {
public:
///
- explicit InsetMathNumber(docstring const & s);
+ explicit InsetMathNumber(Buffer * buf, docstring const & s);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
} // namespace
-InsetMathSpace::InsetMathSpace()
- : space_(defaultSpace)
+InsetMathSpace::InsetMathSpace(Buffer * buf)
+ : InsetMath(buf), space_(defaultSpace)
{
}
-InsetMathSpace::InsetMathSpace(string const & name, string const & length)
- : space_(defaultSpace)
+InsetMathSpace::InsetMathSpace(Buffer * buf, string const & name, string const & length)
+ : InsetMath(buf), space_(defaultSpace)
{
for (int i = 0; i < nSpace; ++i)
if (space_info[i].name == name) {
}
-InsetMathSpace::InsetMathSpace(Length const & length, bool const prot)
- : space_(defaultSpace), length_(length)
+InsetMathSpace::InsetMathSpace(Buffer * buf, Length const & length, bool const prot)
+ : InsetMath(buf), space_(defaultSpace), length_(length)
{
for (int i = 0; i < nSpace; ++i)
if ((prot && space_info[i].name == "hspace*")
class InsetMathSpace : public InsetMath {
public:
///
- explicit InsetMathSpace();
+ explicit InsetMathSpace(Buffer * buf);
///
- explicit InsetMathSpace(std::string const & name, std::string const & length);
+ explicit InsetMathSpace(Buffer * buf, std::string const & name, std::string const & length);
///
- explicit InsetMathSpace(Length const & length, bool const prot = false);
+ explicit InsetMathSpace(Buffer * buf, Length const & length, bool const prot = false);
///
InsetMathSpace const * asSpaceInset() const override { return this; }
///
namespace lyx {
-InsetMathSpecialChar::InsetMathSpecialChar(docstring const & name)
- : name_(name), kerning_(0)
+InsetMathSpecialChar::InsetMathSpecialChar(Buffer * buf, docstring const & name)
+ : InsetMath(buf), name_(name), kerning_(0)
{
if (name.size() != 1) {
if (name == "textasciicircum" || name == "mathcircumflex")
{
public:
///
- explicit InsetMathSpecialChar(docstring const & name);
+ explicit InsetMathSpecialChar(Buffer * buf, docstring const & name);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
namespace lyx {
-InsetMathString::InsetMathString(docstring const & s)
- : str_(s)
+InsetMathString::InsetMathString(Buffer * buf, docstring const & s)
+ : InsetMath(buf), str_(s)
{}
class InsetMathString : public InsetMath {
public:
///
- explicit InsetMathString(docstring const & s);
+ explicit InsetMathString(Buffer * buf, docstring const & s);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
namespace lyx {
-InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
- : sym_(l)
+InsetMathSymbol::InsetMathSymbol(Buffer * buf, latexkeys const * l)
+ : InsetMath(buf), sym_(l)
{}
-InsetMathSymbol::InsetMathSymbol(char const * name)
- : sym_(in_word_set(from_ascii(name)))
+InsetMathSymbol::InsetMathSymbol(Buffer * buf, char const * name)
+ : InsetMath(buf), sym_(in_word_set(from_ascii(name)))
{}
-InsetMathSymbol::InsetMathSymbol(docstring const & name)
- : sym_(in_word_set(name))
+InsetMathSymbol::InsetMathSymbol(Buffer * buf, docstring const & name)
+ : InsetMath(buf), sym_(in_word_set(name))
{}
class InsetMathSymbol : public InsetMath {
public:
///
- explicit InsetMathSymbol(latexkeys const * l);
+ explicit InsetMathSymbol(Buffer * buf, latexkeys const * l);
///
- explicit InsetMathSymbol(char const * name);
+ explicit InsetMathSymbol(Buffer * buf, char const * name);
///
- explicit InsetMathSymbol(docstring const & name);
+ explicit InsetMathSymbol(Buffer * buf, docstring const & name);
///
void metrics(MetricsInfo & mi, Dimension & dim) const override;
///
namespace lyx {
-InsetMathUnknown::InsetMathUnknown(docstring const & name,
+InsetMathUnknown::InsetMathUnknown(Buffer * buf, docstring const & name,
docstring const & selection, bool final, bool black)
- : name_(name), final_(final), black_(black), kerning_(0),
+ : InsetMath(buf), name_(name), final_(final), black_(black), kerning_(0),
selection_(selection)
{}
class InsetMathUnknown : public InsetMath {
public:
///
- explicit InsetMathUnknown(docstring const & name,
+ explicit InsetMathUnknown(Buffer * buf, docstring const & name,
docstring const & selection = empty_docstring(),
bool final = true, bool black = false);
///
&& !(arg[0]->asMacro() && arg[0]->asMacro()->arity() > 0))
insert(p, arg[0]);
else
- insert(p, MathAtom(new InsetMathBrace(arg)));
+ insert(p, MathAtom(new InsetMathBrace(buffer_, arg)));
// cursor in macro?
if (curMacroSlice == -1)
if (scriptInset->nuc().empty()) {
MathData ar(buffer_);
scriptInset->nuc().push_back(
- MathAtom(new InsetMathBrace(ar)));
+ MathAtom(new InsetMathBrace(buffer_, ar)));
}
// put macro into a script inset
scriptInset->nuc()[0] = operator[](macroPos);
if (!ar[i]->asCharInset())
continue;
docstring s = charSequence(ar.begin() + i, ar.end());
- ar[i] = MathAtom(new InsetMathString(s));
+ ar[i] = MathAtom(new InsetMathString(ar.buffer(), s));
ar.erase(i + 1, i + s.size());
}
//lyxerr << "\nStrings to: " << ar << endl;
docstring s = digitSequence(ar.begin() + i, ar.end());
- ar[i] = MathAtom(new InsetMathNumber(s));
+ ar[i] = MathAtom(new InsetMathNumber(ar.buffer(), s));
ar.erase(i + 1, i + s.size());
}
//lyxerr << "\nNumbers to: " << ar << endl;
if (inset == "decoration")
return MathAtom(new InsetMathDecoration(buf, l));
if (inset == "space")
- return MathAtom(new InsetMathSpace(to_ascii(l->name), ""));
+ return MathAtom(new InsetMathSpace(buf, to_ascii(l->name), ""));
if (inset == "class")
return MathAtom(new InsetMathClass(buf, string_to_class(s)));
if (inset == "dots")
- return MathAtom(new InsetMathDots(l));
+ return MathAtom(new InsetMathDots(buf, l));
if (inset == "mbox")
return MathAtom(new InsetMathBox(buf, l->name));
// if (inset == "fbox")
if (inset == "big")
// we can't create a InsetMathBig, since the argument
// is missing.
- return MathAtom(new InsetMathUnknown(s));
- return MathAtom(new InsetMathSymbol(l));
+ return MathAtom(new InsetMathUnknown(buf, s));
+ return MathAtom(new InsetMathSymbol(buf, l));
}
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
- return MathAtom(new InsetMathMacroArgument(s[1] - '0'));
+ return MathAtom(new InsetMathMacroArgument(buf, s[1] - '0'));
if (s.size() == 3 && s[0] == '\\' && s[1] == '#'
&& s[2] >= '1' && s[2] <= '9')
- return MathAtom(new InsetMathMacroArgument(s[2] - '0'));
+ return MathAtom(new InsetMathMacroArgument(buf, s[2] - '0'));
if (s == "boxed")
return MathAtom(new InsetMathBoxed(buf));
if (s == "fbox")
if (s == "sidesetn")
return MathAtom(new InsetMathSideset(buf, false, false));
if (isSpecialChar(s))
- return MathAtom(new InsetMathSpecialChar(s));
+ return MathAtom(new InsetMathSpecialChar(buf, s));
if (s == " ")
- return MathAtom(new InsetMathSpace(" ", ""));
+ return MathAtom(new InsetMathSpace(buf, " ", ""));
if (s == "regexp")
return MathAtom(new InsetMathHull(buf, hullRegexp));
}
else if (t.cat() == catLetter)
- cell->push_back(MathAtom(new InsetMathChar(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(buf, t.character())));
else if (t.cat() == catSpace && mode != InsetMath::MATH_MODE) {
if (cell->empty() || cell->back()->getChar() != ' ')
- cell->push_back(MathAtom(new InsetMathChar(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(buf, t.character())));
}
else if (t.cat() == catNewline && mode != InsetMath::MATH_MODE) {
if (cell->empty() || cell->back()->getChar() != ' ')
- cell->push_back(MathAtom(new InsetMathChar(' ')));
+ cell->push_back(MathAtom(new InsetMathChar(buf, ' ')));
}
else if (t.cat() == catParameter) {
Token const & n = nextToken();
char_type c = n.character();
if (c && '0' < c && c <= '9') {
- cell->push_back(MathAtom(new InsetMathMacroArgument(c - '0')));
+ cell->push_back(MathAtom(new InsetMathMacroArgument(buf, c - '0')));
getToken();
} else
- cell->push_back(MathAtom(new InsetMathHash()));
+ cell->push_back(MathAtom(new InsetMathHash(buf)));
}
else if (t.cat() == catActive)
- cell->push_back(MathAtom(new InsetMathSpace(string(1, t.character()), "")));
+ cell->push_back(MathAtom(new InsetMathSpace(buf, string(1, t.character()), "")));
else if (t.cat() == catBegin) {
MathData ar(buf);
if (ar.size() == 1 && ar[0]->extraBraces())
cell->append(ar);
else
- cell->push_back(MathAtom(new InsetMathBrace(ar)));
+ cell->push_back(MathAtom(new InsetMathBrace(buf, ar)));
}
else if (t.cat() == catEnd) {
|| mode_ & Parse::VERBATIM
|| !(mode_ & Parse::USETEXT)
|| mode == InsetMath::TEXT_MODE) {
- cell->push_back(MathAtom(new InsetMathChar(c)));
+ cell->push_back(MathAtom(new InsetMathChar(buf, c)));
} else {
MathAtom at = createInsetMath("text", buf);
- at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
+ at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(buf, c)));
while (nextToken().cat() == catOther
&& Encodings::isUnicodeTextOnly(nextToken().character())) {
c = getToken().character();
- at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
+ at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(buf, c)));
}
cell->push_back(at);
}
} else {
MathAtom at = MathAtom(new InsetMathMacro(buf, t.cs()));
cell->push_back(at);
- cell->push_back(MathAtom(new InsetMathBrace(count)));
+ cell->push_back(MathAtom(new InsetMathBrace(buf, count)));
}
}
docstring const ref = parse_verbatim_item();
if (!opt.empty()) {
cell->back().nucleus()->cell(1).push_back(
- MathAtom(new InsetMathString(opt)));
+ MathAtom(new InsetMathString(buf, opt)));
}
cell->back().nucleus()->cell(0).push_back(
- MathAtom(new InsetMathString(ref)));
+ MathAtom(new InsetMathString(buf, ref)));
}
else if (t.cs() == "left") {
if (s.empty())
cell->push_back(MathAtom(new InsetMathMacro(buf, t.cs())));
else
- cell->push_back(MathAtom(new InsetMathKern(s)));
+ cell->push_back(MathAtom(new InsetMathKern(buf, s)));
}
else if (t.cs() == "label") {
grid.asHullInset()->label(cellrow, label);
} else {
cell->push_back(createInsetMath(t.cs(), buf));
- cell->push_back(MathAtom(new InsetMathBrace(ar)));
+ cell->push_back(MathAtom(new InsetMathBrace(buf, ar)));
}
}
docstring const arg = parse_verbatim_item();
Length length;
if (prot && arg == "\\fill")
- cell->push_back(MathAtom(new InsetMathSpace("hspace*{\\fill}", "")));
+ cell->push_back(MathAtom(new InsetMathSpace(buf, "hspace*{\\fill}", "")));
else if (isValidLength(to_utf8(arg), &length))
- cell->push_back(MathAtom(new InsetMathSpace(length, prot)));
+ cell->push_back(MathAtom(new InsetMathSpace(buf, length, prot)));
else {
// Since the Length class cannot use length variables
// we must not create an InsetMathSpace.
Encodings::MATH_CMD | Encodings::TEXT_CMD,
termination, rem);
for (char_type c : cmd)
- cell->push_back(MathAtom(new InsetMathChar(c)));
+ cell->push_back(MathAtom(new InsetMathChar(buf, c)));
if (!rem.empty()) {
char_type c = rem[0];
- cell->push_back(MathAtom(new InsetMathChar(c)));
+ cell->push_back(MathAtom(new InsetMathChar(buf, c)));
cmd = rem.substr(1);
rem.clear();
} else
docstring const delim = getToken().asInput();
if (InsetMathBig::isBigInsetDelim(delim))
cell->push_back(MathAtom(
- new InsetMathBig(t.cs(), delim)));
+ new InsetMathBig(buf, t.cs(), delim)));
else {
cell->push_back(createInsetMath(t.cs(), buf));
// For some reason delim.empty()
}
}
is_unicode_symbol = true;
- cell->push_back(MathAtom(new InsetMathChar(c)));
+ cell->push_back(MathAtom(new InsetMathChar(buf, c)));
} else {
while (num_tokens--)
putback();