mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-28 12:26:59 +00:00
Force a Buffer * argument to math insets constructor
Make sure that math insets have a proper buffer. To this end, make the Buffer* parameter of InsetMath mandatory and fix the compilation errors that ensue.
This commit is contained in:
parent
57d7130655
commit
c013799887
@ -1492,7 +1492,7 @@ void Cursor::insert(char_type c)
|
|||||||
LASSERT(!empty(), return);
|
LASSERT(!empty(), return);
|
||||||
if (inMathed()) {
|
if (inMathed()) {
|
||||||
cap::selClearOrDel(*this);
|
cap::selClearOrDel(*this);
|
||||||
insert(new InsetMathChar(c));
|
insert(new InsetMathChar(buffer(), c));
|
||||||
} else {
|
} else {
|
||||||
text()->insertChar(*this, c);
|
text()->insertChar(*this, c);
|
||||||
}
|
}
|
||||||
@ -1576,7 +1576,7 @@ void Cursor::niceInsert(MathAtom const & t)
|
|||||||
docstring const name = t->asMacro()->name();
|
docstring const name = t->asMacro()->name();
|
||||||
MacroData const * data = buffer()->getMacro(name);
|
MacroData const * data = buffer()->getMacro(name);
|
||||||
if (data && data->numargs() - data->optionals() > 0) {
|
if (data && data->numargs() - data->optionals() > 0) {
|
||||||
plainInsert(MathAtom(new InsetMathBrace(ar)));
|
plainInsert(MathAtom(new InsetMathBrace(buffer(), ar)));
|
||||||
posBackward();
|
posBackward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1836,7 +1836,7 @@ bool Cursor::macroModeClose(bool cancel)
|
|||||||
// finally put the macro argument behind, if needed
|
// finally put the macro argument behind, if needed
|
||||||
if (macroArg) {
|
if (macroArg) {
|
||||||
if (selection.size() > 1 || selection[0]->asScriptInset())
|
if (selection.size() > 1 || selection[0]->asScriptInset())
|
||||||
plainInsert(MathAtom(new InsetMathBrace(selection)));
|
plainInsert(MathAtom(new InsetMathBrace(buffer(), selection)));
|
||||||
else
|
else
|
||||||
insert(selection);
|
insert(selection);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class ReplaceData;
|
|||||||
class InsetMath : public Inset {
|
class InsetMath : public Inset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMath(Buffer * buf = 0) : Inset(buf) {}
|
explicit InsetMath(Buffer * buf) : Inset(buf) {}
|
||||||
/// identification as math inset
|
/// identification as math inset
|
||||||
InsetMath * asInsetMath() override { return this; }
|
InsetMath * asInsetMath() override { return this; }
|
||||||
/// identification as math inset
|
/// identification as math inset
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
|
|
||||||
InsetMathBig::InsetMathBig(docstring const & name, docstring const & delim)
|
InsetMathBig::InsetMathBig(Buffer * buf, docstring const & name, docstring const & delim)
|
||||||
: name_(name), delim_(delim)
|
: InsetMath(buf), name_(name), delim_(delim)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace lyx {
|
|||||||
class InsetMathBig : public InsetMath {
|
class InsetMathBig : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetMathBig(docstring const & name, docstring const & delim);
|
InsetMathBig(Buffer * buf, docstring const & name, docstring const & delim);
|
||||||
///
|
///
|
||||||
docstring name() const override;
|
docstring name() const override;
|
||||||
/// class is different for l(eft), r(ight) and m(iddle)
|
/// class is different for l(eft), r(ight) and m(iddle)
|
||||||
|
@ -32,8 +32,8 @@ InsetMathBrace::InsetMathBrace(Buffer * buf)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetMathBrace::InsetMathBrace(MathData const & ar)
|
InsetMathBrace::InsetMathBrace(Buffer * buf, MathData const & ar)
|
||||||
: InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1),
|
: InsetMathNest(buf, 1),
|
||||||
current_mode_(UNDECIDED_MODE)
|
current_mode_(UNDECIDED_MODE)
|
||||||
{
|
{
|
||||||
cell(0) = ar;
|
cell(0) = ar;
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
///
|
///
|
||||||
explicit InsetMathBrace(Buffer * buf);
|
explicit InsetMathBrace(Buffer * buf);
|
||||||
///
|
///
|
||||||
explicit InsetMathBrace(MathData const & ar);
|
explicit InsetMathBrace(Buffer * buf, MathData const & ar);
|
||||||
/// identifies brace insets
|
/// identifies brace insets
|
||||||
InsetMathBrace * asBraceInset() override { return this; }
|
InsetMathBrace * asBraceInset() override { return this; }
|
||||||
/// identifies brace insets
|
/// identifies brace insets
|
||||||
|
@ -92,8 +92,8 @@ static bool slanted(char_type c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathChar::InsetMathChar(char_type c)
|
InsetMathChar::InsetMathChar(Buffer * buf, char_type c)
|
||||||
: char_(c), kerning_(0), subst_(makeSubstitute(c))
|
: InsetMath(buf), char_(c), kerning_(0), subst_(makeSubstitute(c))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class latexkeys;
|
|||||||
class InsetMathChar : public InsetMath {
|
class InsetMathChar : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathChar(char_type c);
|
explicit InsetMathChar(Buffer * buf, char_type c);
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathDots::InsetMathDots(latexkeys const * key)
|
InsetMathDots::InsetMathDots(Buffer * buf, latexkeys const * key)
|
||||||
: dh_(0), key_(key)
|
: InsetMath(buf), dh_(0), key_(key)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class latexkeys;
|
|||||||
class InsetMathDots : public InsetMath {
|
class InsetMathDots : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathDots(latexkeys const * key);
|
explicit InsetMathDots(Buffer * buf, latexkeys const * key);
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -129,7 +129,7 @@ void InsetMathExInt::mathmlize(MathMLStream & ms) const
|
|||||||
// If we should decide to do so later, then we'll need to re-merge
|
// If we should decide to do so later, then we'll need to re-merge
|
||||||
// r32566 and r32568.
|
// r32566 and r32568.
|
||||||
// So right now this only handles integrals.
|
// So right now this only handles integrals.
|
||||||
InsetMathSymbol sym(symbol_);
|
InsetMathSymbol sym(buffer_, symbol_);
|
||||||
bool const lower = !cell(2).empty();
|
bool const lower = !cell(2).empty();
|
||||||
bool const upper = !cell(3).empty();
|
bool const upper = !cell(3).empty();
|
||||||
if (lower && upper)
|
if (lower && upper)
|
||||||
@ -164,7 +164,7 @@ void InsetMathExInt::htmlize(HtmlStream & os) const
|
|||||||
{
|
{
|
||||||
// At the moment, we are not extracting sums and the like for HTML.
|
// At the moment, we are not extracting sums and the like for HTML.
|
||||||
// So right now this only handles integrals.
|
// So right now this only handles integrals.
|
||||||
InsetMathSymbol sym(symbol_);
|
InsetMathSymbol sym(buffer_, symbol_);
|
||||||
bool const lower = !cell(2).empty();
|
bool const lower = !cell(2).empty();
|
||||||
bool const upper = !cell(3).empty();
|
bool const upper = !cell(3).empty();
|
||||||
|
|
||||||
|
@ -1598,7 +1598,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
else {
|
else {
|
||||||
for (unsigned int l = 0; l < grid.rowinfo_[0].lines; ++l) {
|
for (unsigned int l = 0; l < grid.rowinfo_[0].lines; ++l) {
|
||||||
cur.cell().insert(0,
|
cur.cell().insert(0,
|
||||||
MathAtom(new InsetMathUnknown(from_ascii("\\hline"))));
|
MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\hline"))));
|
||||||
cur.pos()++;
|
cur.pos()++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1624,7 +1624,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
|
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
|
||||||
idx_type i = index(r + startrow, 0);
|
idx_type i = index(r + startrow, 0);
|
||||||
cell(i).insert(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
|
// append columns for the left over horizontal cells
|
||||||
@ -1649,7 +1649,7 @@ void InsetMathGrid::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
else {
|
else {
|
||||||
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
|
for (unsigned int l = 0; l < grid.rowinfo_[r].lines; ++l) {
|
||||||
cell(i).insert(0,
|
cell(i).insert(0,
|
||||||
MathAtom(new InsetMathUnknown(from_ascii("\\hline"))));
|
MathAtom(new InsetMathUnknown(buffer_, from_ascii("\\hline"))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1793,7 +1793,7 @@ void InsetMathHull::doExtern(Cursor & cur, FuncRequest & func)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MathData eq(buffer_);
|
MathData eq(buffer_);
|
||||||
eq.push_back(MathAtom(new InsetMathChar('=')));
|
eq.push_back(MathAtom(new InsetMathChar(buffer_, '=')));
|
||||||
|
|
||||||
// go to first item in line
|
// go to first item in line
|
||||||
cur.idx() -= cur.idx() % ncols();
|
cur.idx() -= cur.idx() % ncols();
|
||||||
|
@ -22,19 +22,20 @@
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathKern::InsetMathKern()
|
InsetMathKern::InsetMathKern(Buffer * buf)
|
||||||
|
: InsetMath(buf)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathKern::InsetMathKern(Length const & w)
|
InsetMathKern::InsetMathKern(Buffer * buf, Length const & w)
|
||||||
: wid_(w)
|
: InsetMath(buf), wid_(w)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathKern::InsetMathKern(docstring const & s)
|
InsetMathKern::InsetMathKern(Buffer * buf, docstring const & s)
|
||||||
: wid_(to_utf8(s))
|
: InsetMath(buf), wid_(to_utf8(s))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,11 +26,11 @@ namespace lyx {
|
|||||||
class InsetMathKern : public InsetMath {
|
class InsetMathKern : public InsetMath {
|
||||||
public:
|
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;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -59,10 +59,12 @@ class InsetArgumentProxy : public InsetMath {
|
|||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
InsetArgumentProxy(InsetMathMacro * mathMacro, size_t idx)
|
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)
|
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_);
|
asArray(def, def_);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ void InsetMathHash::normalize(NormalStream & os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathMacroArgument::InsetMathMacroArgument(int n)
|
InsetMathMacroArgument::InsetMathMacroArgument(Buffer * buf, int n)
|
||||||
: number_(n)
|
: InsetMathHash(buf), number_(n)
|
||||||
{
|
{
|
||||||
if (n < 1 || n > 9) {
|
if (n < 1 || n > 9) {
|
||||||
LYXERR0("InsetMathMacroArgument::InsetMathMacroArgument: wrong Argument id: "
|
LYXERR0("InsetMathMacroArgument::InsetMathMacroArgument: wrong Argument id: "
|
||||||
|
@ -24,7 +24,8 @@ namespace lyx {
|
|||||||
// A # that failed to parse
|
// A # that failed to parse
|
||||||
class InsetMathHash : public InsetMath {
|
class InsetMathHash : public InsetMath {
|
||||||
public:
|
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;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
@ -47,7 +48,7 @@ protected:
|
|||||||
class InsetMathMacroArgument : public InsetMathHash {
|
class InsetMathMacroArgument : public InsetMathHash {
|
||||||
public:
|
public:
|
||||||
/// Assumes 0 < number <= 9
|
/// Assumes 0 < number <= 9
|
||||||
explicit InsetMathMacroArgument(int number);
|
explicit InsetMathMacroArgument(Buffer * buf, int number);
|
||||||
///
|
///
|
||||||
int number() const { return number_; }
|
int number() const { return number_; }
|
||||||
/// Assumes 0 < n <= 9
|
/// Assumes 0 < n <= 9
|
||||||
|
@ -249,7 +249,8 @@ void InsetDisplayLabelBox::draw(PainterInfo & pi, int x, int y) const
|
|||||||
class InsetMathWrapper : public InsetMath {
|
class InsetMathWrapper : public InsetMath {
|
||||||
public:
|
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;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
@ -339,7 +340,7 @@ void InsetColoredCell::draw(PainterInfo & pi, int x, int y) const
|
|||||||
class InsetNameWrapper : public InsetMathWrapper {
|
class InsetNameWrapper : public InsetMathWrapper {
|
||||||
public:
|
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;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
@ -353,9 +354,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
InsetNameWrapper::InsetNameWrapper(MathData const * value,
|
InsetNameWrapper::InsetNameWrapper(Buffer * buf, MathData const * value,
|
||||||
InsetMathMacroTemplate const & parent)
|
InsetMathMacroTemplate const & parent)
|
||||||
: InsetMathWrapper(value), parent_(parent)
|
: InsetMathWrapper(buf, value), parent_(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +490,7 @@ void InsetMathMacroTemplate::createLook(int args) const
|
|||||||
look_.push_back(MathAtom(
|
look_.push_back(MathAtom(
|
||||||
new InsetLabelBox(buffer_, _("Name"), *this, false)));
|
new InsetLabelBox(buffer_, _("Name"), *this, false)));
|
||||||
MathData & nameData = look_[look_.size() - 1].nucleus()->cell(0);
|
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]
|
// [#1][#2]
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -506,44 +507,44 @@ void InsetMathMacroTemplate::createLook(int args) const
|
|||||||
optData = &(*optData)[optData->size() - 1].nucleus()->cell(0);
|
optData = &(*optData)[optData->size() - 1].nucleus()->cell(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
optData->push_back(MathAtom(new InsetMathChar('[')));
|
optData->push_back(MathAtom(new InsetMathChar(buffer_, '[')));
|
||||||
optData->push_back(MathAtom(new InsetMathWrapper(&cell(1 + i))));
|
optData->push_back(MathAtom(new InsetMathWrapper(buffer_, &cell(1 + i))));
|
||||||
optData->push_back(MathAtom(new InsetMathChar(']')));
|
optData->push_back(MathAtom(new InsetMathChar(buffer_, ']')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// {#3}{#4}
|
// {#3}{#4}
|
||||||
for (; i < numargs_; ++i) {
|
for (; i < numargs_; ++i) {
|
||||||
MathData arg(buffer_);
|
MathData arg(buffer_);
|
||||||
arg.push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
|
arg.push_back(MathAtom(new InsetMathMacroArgument(buffer_, i + 1)));
|
||||||
if (i >= argsInLook_) {
|
if (i >= argsInLook_) {
|
||||||
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
|
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
|
||||||
Color_mathmacrooldarg,
|
Color_mathmacrooldarg,
|
||||||
MathAtom(new InsetMathBrace(arg)))));
|
MathAtom(new InsetMathBrace(buffer_, arg)))));
|
||||||
} else
|
} else
|
||||||
look_.push_back(MathAtom(new InsetMathBrace(arg)));
|
look_.push_back(MathAtom(new InsetMathBrace(buffer_, arg)));
|
||||||
}
|
}
|
||||||
for (; i < argsInLook_; ++i) {
|
for (; i < argsInLook_; ++i) {
|
||||||
MathData arg(buffer_);
|
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_,
|
look_.push_back(MathAtom(new InsetColoredCell(buffer_,
|
||||||
Color_mathmacronewarg,
|
Color_mathmacronewarg,
|
||||||
MathAtom(new InsetMathBrace(arg)))));
|
MathAtom(new InsetMathBrace(buffer_, arg)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// :=
|
// :=
|
||||||
look_.push_back(MathAtom(new InsetMathChar(':')));
|
look_.push_back(MathAtom(new InsetMathChar(buffer_, ':')));
|
||||||
look_.push_back(MathAtom(new InsetMathChar('=')));
|
look_.push_back(MathAtom(new InsetMathChar(buffer_, '=')));
|
||||||
|
|
||||||
// definition
|
// definition
|
||||||
look_.push_back(MathAtom(
|
look_.push_back(MathAtom(
|
||||||
new InsetLabelBox(buffer_, MathAtom(
|
new InsetLabelBox(buffer_, MathAtom(
|
||||||
new InsetMathWrapper(&cell(defIdx()))), _("TeX"), *this, true)));
|
new InsetMathWrapper(buffer_, &cell(defIdx()))), _("TeX"), *this, true)));
|
||||||
|
|
||||||
// display
|
// display
|
||||||
look_.push_back(MathAtom(
|
look_.push_back(MathAtom(
|
||||||
new InsetDisplayLabelBox(buffer_, MathAtom(
|
new InsetDisplayLabelBox(buffer_, MathAtom(
|
||||||
new InsetMathWrapper(&cell(displayIdx()))), _("LyX"), *this)));
|
new InsetMathWrapper(buffer_, &cell(displayIdx()))), _("LyX"), *this)));
|
||||||
|
|
||||||
look_.setContentsBuffer();
|
look_.setContentsBuffer();
|
||||||
}
|
}
|
||||||
@ -716,7 +717,7 @@ void InsetMathMacroTemplate::insertMissingArguments(int maxArg)
|
|||||||
if (found[i])
|
if (found[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
cell(idx).push_back(MathAtom(new InsetMathMacroArgument(i + 1)));
|
cell(idx).push_back(MathAtom(new InsetMathMacroArgument(buffer_, i + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,9 +887,9 @@ void InsetMathMacroTemplate::insertParameter(Cursor & cur,
|
|||||||
if (addarg) {
|
if (addarg) {
|
||||||
shiftArguments(pos, 1);
|
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())
|
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) {
|
if (!greedy) {
|
||||||
|
@ -1433,13 +1433,11 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
docstring const selection = grabAndEraseSelection(cur);
|
docstring const selection = grabAndEraseSelection(cur);
|
||||||
selClearOrDel(cur);
|
selClearOrDel(cur);
|
||||||
if (have_l)
|
if (have_l)
|
||||||
cur.insert(MathAtom(new InsetMathBig(lname,
|
cur.insert(MathAtom(new InsetMathBig(buffer_, lname, ldelim)));
|
||||||
ldelim)));
|
|
||||||
// first insert the right delimiter and then go back
|
// first insert the right delimiter and then go back
|
||||||
// and re-insert the selection (bug 7088)
|
// and re-insert the selection (bug 7088)
|
||||||
if (have_r) {
|
if (have_r) {
|
||||||
cur.insert(MathAtom(new InsetMathBig(rname,
|
cur.insert(MathAtom(new InsetMathBig(buffer_, rname, rdelim)));
|
||||||
rdelim)));
|
|
||||||
cur.posBackward();
|
cur.posBackward();
|
||||||
}
|
}
|
||||||
cur.niceInsert(selection);
|
cur.niceInsert(selection);
|
||||||
@ -1453,18 +1451,18 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
cur.recordUndoSelection();
|
cur.recordUndoSelection();
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
if (name == "normal")
|
if (name == "normal")
|
||||||
cur.insert(MathAtom(new InsetMathSpace(" ", "")));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_, " ", "")));
|
||||||
else if (name == "protected")
|
else if (name == "protected")
|
||||||
cur.insert(MathAtom(new InsetMathSpace("~", "")));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_, "~", "")));
|
||||||
else if (name == "thin" || name == "med" || name == "thick")
|
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*")
|
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" ||
|
else if (name == "quad" || name == "qquad" ||
|
||||||
name == "enspace" || name == "enskip" ||
|
name == "enspace" || name == "enskip" ||
|
||||||
name == "negthinspace" || name == "negmedspace" ||
|
name == "negthinspace" || name == "negmedspace" ||
|
||||||
name == "negthickspace" || name == "hfill")
|
name == "negthickspace" || name == "hfill")
|
||||||
cur.insert(MathAtom(new InsetMathSpace(name, "")));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_, name, "")));
|
||||||
else if (name == "hspace" || name == "hspace*") {
|
else if (name == "hspace" || name == "hspace*") {
|
||||||
string const len = cmd.getArg(1);
|
string const len = cmd.getArg(1);
|
||||||
if (len.empty() || !isValidLength(len)) {
|
if (len.empty() || !isValidLength(len)) {
|
||||||
@ -1472,20 +1470,20 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest & cmd)
|
|||||||
"needs a valid length argument." << endl;
|
"needs a valid length argument." << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cur.insert(MathAtom(new InsetMathSpace(name, len)));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_, name, len)));
|
||||||
} else
|
} else
|
||||||
cur.insert(MathAtom(new InsetMathSpace));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LFUN_MATH_SPACE:
|
case LFUN_MATH_SPACE:
|
||||||
cur.recordUndoSelection();
|
cur.recordUndoSelection();
|
||||||
if (cmd.argument().empty())
|
if (cmd.argument().empty())
|
||||||
cur.insert(MathAtom(new InsetMathSpace));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_)));
|
||||||
else {
|
else {
|
||||||
string const name = cmd.getArg(0);
|
string const name = cmd.getArg(0);
|
||||||
string const len = cmd.getArg(1);
|
string const len = cmd.getArg(1);
|
||||||
cur.insert(MathAtom(new InsetMathSpace(name, len)));
|
cur.insert(MathAtom(new InsetMathSpace(buffer_, name, len)));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2024,7 +2022,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
cur.backspace();
|
cur.backspace();
|
||||||
int n = c - '0';
|
int n = c - '0';
|
||||||
if (n >= 1 && n <= 9)
|
if (n >= 1 && n <= 9)
|
||||||
cur.insert(new InsetMathMacroArgument(n));
|
cur.insert(new InsetMathMacroArgument(buffer_, n));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2057,7 +2055,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
asArray(p->selection(), sel);
|
asArray(p->selection(), sel);
|
||||||
cur.backspace();
|
cur.backspace();
|
||||||
if (c == '{')
|
if (c == '{')
|
||||||
cur.niceInsert(MathAtom(new InsetMathBrace(sel)));
|
cur.niceInsert(MathAtom(new InsetMathBrace(buffer_, sel)));
|
||||||
else
|
else
|
||||||
cur.niceInsert(MathAtom(new InsetMathComment(sel)));
|
cur.niceInsert(MathAtom(new InsetMathComment(sel)));
|
||||||
} else if (c == '#') {
|
} else if (c == '#') {
|
||||||
@ -2095,7 +2093,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
--cur.pos();
|
--cur.pos();
|
||||||
cur.cell().erase(cur.pos());
|
cur.cell().erase(cur.pos());
|
||||||
cur.plainInsert(MathAtom(
|
cur.plainInsert(MathAtom(
|
||||||
new InsetMathBig(name.substr(1), delim)));
|
new InsetMathBig(buffer_, name.substr(1), delim)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (name == "\\smash" && c == '[') {
|
} else if (name == "\\smash" && c == '[') {
|
||||||
@ -2142,7 +2140,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
cur.recordUndoInset();
|
cur.recordUndoInset();
|
||||||
docstring const safe = cap::grabAndEraseSelection(cur);
|
docstring const safe = cap::grabAndEraseSelection(cur);
|
||||||
if (!cur.inRegexped() && !in_macro_name)
|
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
|
else
|
||||||
cur.niceInsert(createInsetMath("backslash", buf));
|
cur.niceInsert(createInsetMath("backslash", buf));
|
||||||
}
|
}
|
||||||
@ -2238,7 +2236,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
|
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") {
|
if (cur.prevInset() && cur.prevInset()->asInsetMath()->name() == "text") {
|
||||||
// reuse existing \text inset
|
// reuse existing \text inset
|
||||||
cur.prevInset()->asInsetMath()->cell(0).push_back(atom);
|
cur.prevInset()->asInsetMath()->cell(0).push_back(atom);
|
||||||
@ -2296,7 +2294,7 @@ bool InsetMathNest::interpretString(Cursor & cur, docstring const & str)
|
|||||||
if (l && l->inset == "big") {
|
if (l && l->inset == "big") {
|
||||||
cur.recordUndoSelection();
|
cur.recordUndoSelection();
|
||||||
cur.cell()[cur.pos() - 1] =
|
cur.cell()[cur.pos() - 1] =
|
||||||
MathAtom(new InsetMathBig(prev, str));
|
MathAtom(new InsetMathBig(buffer_, prev, str));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ using namespace std;
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathNumber::InsetMathNumber(docstring const & s)
|
InsetMathNumber::InsetMathNumber(Buffer * buf, docstring const & s)
|
||||||
: str_(s)
|
: InsetMath(buf), str_(s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace lyx {
|
|||||||
class InsetMathNumber : public InsetMath {
|
class InsetMathNumber : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathNumber(docstring const & s);
|
explicit InsetMathNumber(Buffer * buf, docstring const & s);
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -77,14 +77,14 @@ int const defaultSpace = 4;
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
InsetMathSpace::InsetMathSpace()
|
InsetMathSpace::InsetMathSpace(Buffer * buf)
|
||||||
: space_(defaultSpace)
|
: InsetMath(buf), space_(defaultSpace)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathSpace::InsetMathSpace(string const & name, string const & length)
|
InsetMathSpace::InsetMathSpace(Buffer * buf, string const & name, string const & length)
|
||||||
: space_(defaultSpace)
|
: InsetMath(buf), space_(defaultSpace)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nSpace; ++i)
|
for (int i = 0; i < nSpace; ++i)
|
||||||
if (space_info[i].name == name) {
|
if (space_info[i].name == name) {
|
||||||
@ -101,8 +101,8 @@ InsetMathSpace::InsetMathSpace(string const & name, string const & length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetMathSpace::InsetMathSpace(Length const & length, bool const prot)
|
InsetMathSpace::InsetMathSpace(Buffer * buf, Length const & length, bool const prot)
|
||||||
: space_(defaultSpace), length_(length)
|
: InsetMath(buf), space_(defaultSpace), length_(length)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nSpace; ++i)
|
for (int i = 0; i < nSpace; ++i)
|
||||||
if ((prot && space_info[i].name == "hspace*")
|
if ((prot && space_info[i].name == "hspace*")
|
||||||
|
@ -25,11 +25,11 @@ struct InsetSpaceParams;
|
|||||||
class InsetMathSpace : public InsetMath {
|
class InsetMathSpace : public InsetMath {
|
||||||
public:
|
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; }
|
InsetMathSpace const * asSpaceInset() const override { return this; }
|
||||||
///
|
///
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
|
|
||||||
InsetMathSpecialChar::InsetMathSpecialChar(docstring const & name)
|
InsetMathSpecialChar::InsetMathSpecialChar(Buffer * buf, docstring const & name)
|
||||||
: name_(name), kerning_(0)
|
: InsetMath(buf), name_(name), kerning_(0)
|
||||||
{
|
{
|
||||||
if (name.size() != 1) {
|
if (name.size() != 1) {
|
||||||
if (name == "textasciicircum" || name == "mathcircumflex")
|
if (name == "textasciicircum" || name == "mathcircumflex")
|
||||||
|
@ -23,7 +23,7 @@ class InsetMathSpecialChar : public InsetMath
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathSpecialChar(docstring const & name);
|
explicit InsetMathSpecialChar(Buffer * buf, docstring const & name);
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -31,8 +31,8 @@ using lyx::support::escape;
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathString::InsetMathString(docstring const & s)
|
InsetMathString::InsetMathString(Buffer * buf, docstring const & s)
|
||||||
: str_(s)
|
: InsetMath(buf), str_(s)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace lyx {
|
|||||||
class InsetMathString : public InsetMath {
|
class InsetMathString : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathString(docstring const & s);
|
explicit InsetMathString(Buffer * buf, docstring const & s);
|
||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -30,18 +30,18 @@ using namespace std;
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
|
InsetMathSymbol::InsetMathSymbol(Buffer * buf, latexkeys const * l)
|
||||||
: sym_(l)
|
: InsetMath(buf), sym_(l)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetMathSymbol::InsetMathSymbol(char const * name)
|
InsetMathSymbol::InsetMathSymbol(Buffer * buf, char const * name)
|
||||||
: sym_(in_word_set(from_ascii(name)))
|
: InsetMath(buf), sym_(in_word_set(from_ascii(name)))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
InsetMathSymbol::InsetMathSymbol(docstring const & name)
|
InsetMathSymbol::InsetMathSymbol(Buffer * buf, docstring const & name)
|
||||||
: sym_(in_word_set(name))
|
: InsetMath(buf), sym_(in_word_set(name))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@ class latexkeys;
|
|||||||
class InsetMathSymbol : public InsetMath {
|
class InsetMathSymbol : public InsetMath {
|
||||||
public:
|
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;
|
void metrics(MetricsInfo & mi, Dimension & dim) const override;
|
||||||
///
|
///
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
InsetMathUnknown::InsetMathUnknown(docstring const & name,
|
InsetMathUnknown::InsetMathUnknown(Buffer * buf, docstring const & name,
|
||||||
docstring const & selection, bool final, bool black)
|
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)
|
selection_(selection)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace lyx {
|
|||||||
class InsetMathUnknown : public InsetMath {
|
class InsetMathUnknown : public InsetMath {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit InsetMathUnknown(docstring const & name,
|
explicit InsetMathUnknown(Buffer * buf, docstring const & name,
|
||||||
docstring const & selection = empty_docstring(),
|
docstring const & selection = empty_docstring(),
|
||||||
bool final = true, bool black = false);
|
bool final = true, bool black = false);
|
||||||
///
|
///
|
||||||
|
@ -645,7 +645,7 @@ void MathData::detachMacroParameters(DocIterator * cur, const size_type macroPos
|
|||||||
&& !(arg[0]->asMacro() && arg[0]->asMacro()->arity() > 0))
|
&& !(arg[0]->asMacro() && arg[0]->asMacro()->arity() > 0))
|
||||||
insert(p, arg[0]);
|
insert(p, arg[0]);
|
||||||
else
|
else
|
||||||
insert(p, MathAtom(new InsetMathBrace(arg)));
|
insert(p, MathAtom(new InsetMathBrace(buffer_, arg)));
|
||||||
|
|
||||||
// cursor in macro?
|
// cursor in macro?
|
||||||
if (curMacroSlice == -1)
|
if (curMacroSlice == -1)
|
||||||
@ -711,7 +711,7 @@ void MathData::attachMacroParameters(Cursor * cur,
|
|||||||
if (scriptInset->nuc().empty()) {
|
if (scriptInset->nuc().empty()) {
|
||||||
MathData ar(buffer_);
|
MathData ar(buffer_);
|
||||||
scriptInset->nuc().push_back(
|
scriptInset->nuc().push_back(
|
||||||
MathAtom(new InsetMathBrace(ar)));
|
MathAtom(new InsetMathBrace(buffer_, ar)));
|
||||||
}
|
}
|
||||||
// put macro into a script inset
|
// put macro into a script inset
|
||||||
scriptInset->nuc()[0] = operator[](macroPos);
|
scriptInset->nuc()[0] = operator[](macroPos);
|
||||||
|
@ -191,7 +191,7 @@ void extractStrings(MathData & ar)
|
|||||||
if (!ar[i]->asCharInset())
|
if (!ar[i]->asCharInset())
|
||||||
continue;
|
continue;
|
||||||
docstring s = charSequence(ar.begin() + i, ar.end());
|
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());
|
ar.erase(i + 1, i + s.size());
|
||||||
}
|
}
|
||||||
//lyxerr << "\nStrings to: " << ar << endl;
|
//lyxerr << "\nStrings to: " << ar << endl;
|
||||||
@ -486,7 +486,7 @@ void extractNumbers(MathData & ar)
|
|||||||
|
|
||||||
docstring s = digitSequence(ar.begin() + i, ar.end());
|
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());
|
ar.erase(i + 1, i + s.size());
|
||||||
}
|
}
|
||||||
//lyxerr << "\nNumbers to: " << ar << endl;
|
//lyxerr << "\nNumbers to: " << ar << endl;
|
||||||
|
@ -474,11 +474,11 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
|
|||||||
if (inset == "decoration")
|
if (inset == "decoration")
|
||||||
return MathAtom(new InsetMathDecoration(buf, l));
|
return MathAtom(new InsetMathDecoration(buf, l));
|
||||||
if (inset == "space")
|
if (inset == "space")
|
||||||
return MathAtom(new InsetMathSpace(to_ascii(l->name), ""));
|
return MathAtom(new InsetMathSpace(buf, to_ascii(l->name), ""));
|
||||||
if (inset == "class")
|
if (inset == "class")
|
||||||
return MathAtom(new InsetMathClass(buf, string_to_class(s)));
|
return MathAtom(new InsetMathClass(buf, string_to_class(s)));
|
||||||
if (inset == "dots")
|
if (inset == "dots")
|
||||||
return MathAtom(new InsetMathDots(l));
|
return MathAtom(new InsetMathDots(buf, l));
|
||||||
if (inset == "mbox")
|
if (inset == "mbox")
|
||||||
return MathAtom(new InsetMathBox(buf, l->name));
|
return MathAtom(new InsetMathBox(buf, l->name));
|
||||||
// if (inset == "fbox")
|
// if (inset == "fbox")
|
||||||
@ -498,15 +498,15 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
|
|||||||
if (inset == "big")
|
if (inset == "big")
|
||||||
// we can't create a InsetMathBig, since the argument
|
// we can't create a InsetMathBig, since the argument
|
||||||
// is missing.
|
// is missing.
|
||||||
return MathAtom(new InsetMathUnknown(s));
|
return MathAtom(new InsetMathUnknown(buf, s));
|
||||||
return MathAtom(new InsetMathSymbol(l));
|
return MathAtom(new InsetMathSymbol(buf, l));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
|
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] == '#'
|
if (s.size() == 3 && s[0] == '\\' && s[1] == '#'
|
||||||
&& s[2] >= '1' && s[2] <= '9')
|
&& s[2] >= '1' && s[2] <= '9')
|
||||||
return MathAtom(new InsetMathMacroArgument(s[2] - '0'));
|
return MathAtom(new InsetMathMacroArgument(buf, s[2] - '0'));
|
||||||
if (s == "boxed")
|
if (s == "boxed")
|
||||||
return MathAtom(new InsetMathBoxed(buf));
|
return MathAtom(new InsetMathBoxed(buf));
|
||||||
if (s == "fbox")
|
if (s == "fbox")
|
||||||
@ -680,9 +680,9 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
|
|||||||
if (s == "sidesetn")
|
if (s == "sidesetn")
|
||||||
return MathAtom(new InsetMathSideset(buf, false, false));
|
return MathAtom(new InsetMathSideset(buf, false, false));
|
||||||
if (isSpecialChar(s))
|
if (isSpecialChar(s))
|
||||||
return MathAtom(new InsetMathSpecialChar(s));
|
return MathAtom(new InsetMathSpecialChar(buf, s));
|
||||||
if (s == " ")
|
if (s == " ")
|
||||||
return MathAtom(new InsetMathSpace(" ", ""));
|
return MathAtom(new InsetMathSpace(buf, " ", ""));
|
||||||
if (s == "regexp")
|
if (s == "regexp")
|
||||||
return MathAtom(new InsetMathHull(buf, hullRegexp));
|
return MathAtom(new InsetMathHull(buf, hullRegexp));
|
||||||
|
|
||||||
|
@ -916,30 +916,30 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cat() == catLetter)
|
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) {
|
else if (t.cat() == catSpace && mode != InsetMath::MATH_MODE) {
|
||||||
if (cell->empty() || cell->back()->getChar() != ' ')
|
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) {
|
else if (t.cat() == catNewline && mode != InsetMath::MATH_MODE) {
|
||||||
if (cell->empty() || cell->back()->getChar() != ' ')
|
if (cell->empty() || cell->back()->getChar() != ' ')
|
||||||
cell->push_back(MathAtom(new InsetMathChar(' ')));
|
cell->push_back(MathAtom(new InsetMathChar(buf, ' ')));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cat() == catParameter) {
|
else if (t.cat() == catParameter) {
|
||||||
Token const & n = nextToken();
|
Token const & n = nextToken();
|
||||||
char_type c = n.character();
|
char_type c = n.character();
|
||||||
if (c && '0' < c && c <= '9') {
|
if (c && '0' < c && c <= '9') {
|
||||||
cell->push_back(MathAtom(new InsetMathMacroArgument(c - '0')));
|
cell->push_back(MathAtom(new InsetMathMacroArgument(buf, c - '0')));
|
||||||
getToken();
|
getToken();
|
||||||
} else
|
} else
|
||||||
cell->push_back(MathAtom(new InsetMathHash()));
|
cell->push_back(MathAtom(new InsetMathHash(buf)));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cat() == catActive)
|
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) {
|
else if (t.cat() == catBegin) {
|
||||||
MathData ar(buf);
|
MathData ar(buf);
|
||||||
@ -949,7 +949,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
if (ar.size() == 1 && ar[0]->extraBraces())
|
if (ar.size() == 1 && ar[0]->extraBraces())
|
||||||
cell->append(ar);
|
cell->append(ar);
|
||||||
else
|
else
|
||||||
cell->push_back(MathAtom(new InsetMathBrace(ar)));
|
cell->push_back(MathAtom(new InsetMathBrace(buf, ar)));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cat() == catEnd) {
|
else if (t.cat() == catEnd) {
|
||||||
@ -1017,14 +1017,14 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|| mode_ & Parse::VERBATIM
|
|| mode_ & Parse::VERBATIM
|
||||||
|| !(mode_ & Parse::USETEXT)
|
|| !(mode_ & Parse::USETEXT)
|
||||||
|| mode == InsetMath::TEXT_MODE) {
|
|| mode == InsetMath::TEXT_MODE) {
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(buf, c)));
|
||||||
} else {
|
} else {
|
||||||
MathAtom at = createInsetMath("text", buf);
|
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
|
while (nextToken().cat() == catOther
|
||||||
&& Encodings::isUnicodeTextOnly(nextToken().character())) {
|
&& Encodings::isUnicodeTextOnly(nextToken().character())) {
|
||||||
c = getToken().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);
|
cell->push_back(at);
|
||||||
}
|
}
|
||||||
@ -1397,7 +1397,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
} else {
|
} else {
|
||||||
MathAtom at = MathAtom(new InsetMathMacro(buf, t.cs()));
|
MathAtom at = MathAtom(new InsetMathMacro(buf, t.cs()));
|
||||||
cell->push_back(at);
|
cell->push_back(at);
|
||||||
cell->push_back(MathAtom(new InsetMathBrace(count)));
|
cell->push_back(MathAtom(new InsetMathBrace(buf, count)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1553,10 +1553,10 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
docstring const ref = parse_verbatim_item();
|
docstring const ref = parse_verbatim_item();
|
||||||
if (!opt.empty()) {
|
if (!opt.empty()) {
|
||||||
cell->back().nucleus()->cell(1).push_back(
|
cell->back().nucleus()->cell(1).push_back(
|
||||||
MathAtom(new InsetMathString(opt)));
|
MathAtom(new InsetMathString(buf, opt)));
|
||||||
}
|
}
|
||||||
cell->back().nucleus()->cell(0).push_back(
|
cell->back().nucleus()->cell(0).push_back(
|
||||||
MathAtom(new InsetMathString(ref)));
|
MathAtom(new InsetMathString(buf, ref)));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "left") {
|
else if (t.cs() == "left") {
|
||||||
@ -1784,7 +1784,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
if (s.empty())
|
if (s.empty())
|
||||||
cell->push_back(MathAtom(new InsetMathMacro(buf, t.cs())));
|
cell->push_back(MathAtom(new InsetMathMacro(buf, t.cs())));
|
||||||
else
|
else
|
||||||
cell->push_back(MathAtom(new InsetMathKern(s)));
|
cell->push_back(MathAtom(new InsetMathKern(buf, s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (t.cs() == "label") {
|
else if (t.cs() == "label") {
|
||||||
@ -1796,7 +1796,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
grid.asHullInset()->label(cellrow, label);
|
grid.asHullInset()->label(cellrow, label);
|
||||||
} else {
|
} else {
|
||||||
cell->push_back(createInsetMath(t.cs(), buf));
|
cell->push_back(createInsetMath(t.cs(), buf));
|
||||||
cell->push_back(MathAtom(new InsetMathBrace(ar)));
|
cell->push_back(MathAtom(new InsetMathBrace(buf, ar)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1885,9 +1885,9 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
docstring const arg = parse_verbatim_item();
|
docstring const arg = parse_verbatim_item();
|
||||||
Length length;
|
Length length;
|
||||||
if (prot && arg == "\\fill")
|
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))
|
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 {
|
else {
|
||||||
// Since the Length class cannot use length variables
|
// Since the Length class cannot use length variables
|
||||||
// we must not create an InsetMathSpace.
|
// we must not create an InsetMathSpace.
|
||||||
@ -1962,10 +1962,10 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
Encodings::MATH_CMD | Encodings::TEXT_CMD,
|
Encodings::MATH_CMD | Encodings::TEXT_CMD,
|
||||||
termination, rem);
|
termination, rem);
|
||||||
for (char_type c : cmd)
|
for (char_type c : cmd)
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(buf, c)));
|
||||||
if (!rem.empty()) {
|
if (!rem.empty()) {
|
||||||
char_type c = rem[0];
|
char_type c = rem[0];
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(buf, c)));
|
||||||
cmd = rem.substr(1);
|
cmd = rem.substr(1);
|
||||||
rem.clear();
|
rem.clear();
|
||||||
} else
|
} else
|
||||||
@ -1991,7 +1991,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
docstring const delim = getToken().asInput();
|
docstring const delim = getToken().asInput();
|
||||||
if (InsetMathBig::isBigInsetDelim(delim))
|
if (InsetMathBig::isBigInsetDelim(delim))
|
||||||
cell->push_back(MathAtom(
|
cell->push_back(MathAtom(
|
||||||
new InsetMathBig(t.cs(), delim)));
|
new InsetMathBig(buf, t.cs(), delim)));
|
||||||
else {
|
else {
|
||||||
cell->push_back(createInsetMath(t.cs(), buf));
|
cell->push_back(createInsetMath(t.cs(), buf));
|
||||||
// For some reason delim.empty()
|
// For some reason delim.empty()
|
||||||
@ -2091,7 +2091,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is_unicode_symbol = true;
|
is_unicode_symbol = true;
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(buf, c)));
|
||||||
} else {
|
} else {
|
||||||
while (num_tokens--)
|
while (num_tokens--)
|
||||||
putback();
|
putback();
|
||||||
|
Loading…
Reference in New Issue
Block a user