text->setCursor(cur, ppp.first, ppp.second);
}
- // mathed is handled in MathNestInset/MathGridInset
+ // mathed is handled in InsetMathNest/InsetMathGrid
BOOST_ASSERT(!cur.inMathed());
}
//lyxerr << "LCursor::eraseSelection begin: " << cur << endl;
CursorSlice const & i1 = cur.selBegin();
CursorSlice const & i2 = cur.selEnd();
- if (i1.inset().asMathInset()) {
+ if (i1.inset().asInsetMath()) {
cur.top() = i1;
if (i1.idx() == i2.idx()) {
i1.cell().erase(i1.pos(), i2.pos());
if (cur.pos() > cur.lastpos())
cur.pos() = cur.lastpos();
} else {
- MathInset * p = i1.asMathInset();
+ InsetMath * p = i1.asInsetMath();
InsetBase::row_type r1, r2;
InsetBase::col_type c1, c2;
region(i1, i2, r1, r2, c1, c2);
CursorSlice i2 = cur.selEnd();
if (i1.idx() == i2.idx()) {
- if (i1.inset().asMathInset()) {
+ if (i1.inset().asInsetMath()) {
MathArray::const_iterator it = i1.cell().begin();
return asString(MathArray(it + i1.pos(), it + i2.pos()));
} else {
region(i1, i2, r1, r2, c1, c2);
string data;
- if (i1.inset().asMathInset()) {
+ if (i1.inset().asInsetMath()) {
for (InsetBase::row_type row = r1; row <= r2; ++row) {
if (row > r1)
data += "\\\\";
for (InsetBase::col_type col = c1; col <= c2; ++col) {
if (col > c1)
data += '&';
- data += asString(i1.asMathInset()->
- cell(i1.asMathInset()->index(row, col)));
+ data += asString(i1.asInsetMath()->
+ cell(i1.asInsetMath()->index(row, col)));
}
}
} else {
DocIterator it = c;
it.top().pos() = 0;
DocIterator et = c;
- et.top().pos() = et.top().asMathInset()->cell(et.top().idx()).size();
+ et.top().pos() = et.top().asInsetMath()->cell(et.top().idx()).size();
for (size_t i = 0; ; ++i) {
int xo;
int yo;
//
// The part below is the non-integrated rest of the original math
// cursor. This should be either generalized for texted or moved
-// back to mathed (in most cases to MathNestInset).
+// back to mathed (in most cases to InsetMathNest).
//
///////////////////////////////////////////////////////////////////
BOOST_ASSERT(!empty());
if (inMathed()) {
lyx::cap::selClearOrDel(*this);
- insert(new MathCharInset(c));
+ insert(new InsetMathChar(c));
} else {
text()->insertChar(*this, c);
}
}
if (inMacroMode()) {
- MathUnknownInset * p = activeMacro();
+ InsetMathUnknown * p = activeMacro();
if (p->name().size() > 1) {
p->setName(p->name().substr(0, p->name().size() - 1));
return true;
{
if (!inMacroMode())
return false;
- MathUnknownInset * p = activeMacro();
+ InsetMathUnknown * p = activeMacro();
p->finalize();
string const s = p->name();
--pos();
if (macro && macro->getInsetName() == name)
lyxerr << "can't enter recursive macro" << endl;
- MathNestInset * const in = inset().asMathInset()->asNestInset();
+ InsetMathNest * const in = inset().asInsetMath()->asNestInset();
if (in && in->interpret(*this, s))
return true;
- plainInsert(createMathInset(name));
+ plainInsert(createInsetMath(name));
return true;
}
{
if (pos() == 0)
return false;
- MathUnknownInset const * p = prevAtom()->asUnknownInset();
+ InsetMathUnknown const * p = prevAtom()->asUnknownInset();
return p && !p->final();
}
-MathUnknownInset * LCursor::activeMacro()
+InsetMathUnknown * LCursor::activeMacro()
{
return inMacroMode() ? prevAtom().nucleus()->asUnknownInset() : 0;
}
<< pos() << ' ' << lastpos() << " in idx: " << idx()
<< " in atom: '";
WriteStream wi(lyxerr, false, true);
- inset().asMathInset()->write(wi);
+ inset().asInsetMath()->write(wi);
lyxerr << endl;
pos() = lastpos();
}
int yo = 0;
getPos(xo, yo);
- // check if we had something else in mind, if not, this is the future goal
+ // check if we had something else in mind, if not, this is the future
+ // target
if (x_target() == -1)
x_target() = xo;
else
if (!selection()) {
// try left
if (pos() != 0) {
- MathScriptInset const * p = prevAtom()->asScriptInset();
+ InsetMathScript const * p = prevAtom()->asScriptInset();
if (p && p->has(up)) {
--pos();
- push(*const_cast<MathScriptInset*>(p));
+ push(*const_cast<InsetMathScript*>(p));
idx() = p->idxOfScript(up);
pos() = lastpos();
return true;
// try right
if (pos() != lastpos()) {
- MathScriptInset const * p = nextAtom()->asScriptInset();
+ InsetMathScript const * p = nextAtom()->asScriptInset();
if (p && p->has(up)) {
- push(*const_cast<MathScriptInset*>(p));
+ push(*const_cast<InsetMathScript*>(p));
idx() = p->idxOfScript(up);
pos() = 0;
return true;
} else {
// cursor in between. split cell
MathArray::iterator bt = cell().begin();
- MathAtom at = createMathInset(font);
+ MathAtom at = createInsetMath(font);
at.nucleus()->cell(0) = MathArray(bt, bt + pos());
cell().erase(bt, bt + pos());
popLeft();
class LyXFont;
// these should go
-class MathUnknownInset;
+class InsetMathUnknown;
class Encoding;
/// are we currently typing the name of a macro?
bool inMacroMode() const;
/// get access to the macro we are currently typing
- MathUnknownInset * activeMacro();
+ InsetMathUnknown * activeMacro();
/// replace selected stuff with at, placing the former
// selection in given cell of atom
MathArray & CursorSlice::cell() const
{
- return inset_->asMathInset()->cell(idx_);
+ return inset_->asInsetMath()->cell(idx_);
}
CursorSlice::pos_type CursorSlice::lastpos() const
{
BOOST_ASSERT(inset_);
- return inset_->asMathInset() ? cell().size() : paragraph().size();
+ return inset_->asInsetMath() ? cell().size() : paragraph().size();
}
CursorSlice::row_type CursorSlice::row() const
{
- BOOST_ASSERT(asMathInset());
- return asMathInset()->row(idx_);
+ BOOST_ASSERT(asInsetMath());
+ return asInsetMath()->row(idx_);
}
CursorSlice::col_type CursorSlice::col() const
{
- BOOST_ASSERT(asMathInset());
- return asMathInset()->col(idx_);
+ BOOST_ASSERT(asInsetMath());
+ return asInsetMath()->col(idx_);
}
///
/// mathed specific stuff
///
- /// returns the owning inset if it is a MathInset, else 0
- MathInset * asMathInset() const { return inset_->asMathInset(); }
+ /// returns the owning inset if it is a InsetMath, else 0
+ InsetMath * asInsetMath() const { return inset_->asInsetMath(); }
/// returns cell corresponding to this position
MathArray & cell() const;
}
// jump over collapsables if they are collapsed
- // FIXME: the check for asMathInset() shouldn't be necessary
+ // FIXME: the check for asInsetMath() shouldn't be necessary
// but math insets do not return a sensible editable() state yet.
- if (ignorecollapsed && nextInset() && (!nextInset()->asMathInset()
+ if (ignorecollapsed && nextInset() && (!nextInset()->asInsetMath()
&& nextInset()->editable() != InsetBase::HIGHLY_EDITABLE)) {
++top().pos();
return;
} else if (tmptok == "FormulaMacro") {
inset.reset(new MathMacroTemplate);
} else if (tmptok == "Formula") {
- inset.reset(new MathHullInset);
+ inset.reset(new InsetMathHull);
} else if (tmptok == "Graphics") {
inset.reset(new InsetGraphics);
} else if (tmptok == "Note") {
* Full author contact details are available in file CREDITS.
*/
-// X11 use a define called CursorShape, and we really want to use
-// that name our selves. Therefore we do something similar to what is done
-// in kde/fixx11h.h:
-namespace X {
-#ifdef CursorShape
-#ifndef FIXX11H_CursorShape
-#define FIXX11H_CursorShape
-int const XCursorShape = CursorShape;
-#undef CursorShape
-int const CursorShape = CursorShape;
-#endif
-#undef CursorShape
-#endif
-} // namespace X
-
-
#ifndef BASE_WORKAREA_H
#define BASE_WORKAREA_H
/// modifier key states
namespace key_modifier {
- enum state {
- none = 0, //< no modifiers held
- ctrl = 1, //< control button held
- alt = 2, //< alt/meta key held
- shift = 4 //< shift key held
- };
+
+enum state {
+ none = 0, //< no modifiers held
+ ctrl = 1, //< control button held
+ alt = 2, //< alt/meta key held
+ shift = 4 //< shift key held
+};
inline state operator|(state const & s1, state const & s2)
class CursorSlice;
class FuncRequest;
class FuncStatus;
+class InsetMath;
class InsetText;
class LaTeXFeatures;
class LCursor;
class LyXLex;
class LyXText;
-class MathInset;
class MetricsInfo;
class Dimension;
class PainterInfo;
std::auto_ptr<InsetBase> clone() const;
/// identification as math inset
- virtual MathInset * asMathInset() { return 0; }
+ virtual InsetMath * asInsetMath() { return 0; }
/// true for 'math' math inset, but not for e.g. mbox
virtual bool inMathed() const { return false; }
return;
// clear the selection
- LyXText & const text = bv->buffer()->text();
+ LyXText const & text = bv->buffer()->text();
if (&text == bv->getLyXText())
bv->cursor().clearSelection();
if (asParagraph)
CommandInset::CommandInset(string const & name)
- : MathNestInset(2), name_(name), set_label_(false)
+ : InsetMathNest(2), name_(name), set_label_(false)
{
lock_ = true;
}
/// Inset for things like \name[options]{contents}
-class CommandInset : public MathNestInset {
+class CommandInset : public InsetMathNest {
public:
///
explicit CommandInset(std::string const & name);
InsetFormulaMacro::InsetFormulaMacro()
- : MathNestInset(2), name_("unknownA")
+ : InsetMathNest(2), name_("unknownA")
{}
InsetFormulaMacro::InsetFormulaMacro
(string const & name, int nargs, string const & type)
- : MathNestInset(2), name_(name)
+ : InsetMathNest(2), name_(name)
{
MathMacroTable::create(MathAtom(new MathMacroTemplate(name, nargs, type)));
}
InsetFormulaMacro::InsetFormulaMacro(string const & s)
- : MathNestInset(2), name_("unknownB")
+ : InsetMathNest(2), name_("unknownB")
{
std::istringstream is(s);
read(is);
// MathMacroTable if it needs to know more.
/// Main LyX Inset for defining math macros
-class InsetFormulaMacro : public MathNestInset {
+class InsetFormulaMacro : public InsetMathNest {
public:
///
InsetFormulaMacro();
using lyx::support::bformat;
-MathAMSArrayInset::MathAMSArrayInset(string const & name, int m, int n)
- : MathGridInset(m, n), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(string const & name, int m, int n)
+ : InsetMathGrid(m, n), name_(name)
{}
-MathAMSArrayInset::MathAMSArrayInset(string const & name)
- : MathGridInset(1, 1), name_(name)
+InsetMathAMSArray::InsetMathAMSArray(string const & name)
+ : InsetMathGrid(1, 1), name_(name)
{}
-auto_ptr<InsetBase> MathAMSArrayInset::doClone() const
+auto_ptr<InsetBase> InsetMathAMSArray::doClone() const
{
- return auto_ptr<InsetBase>(new MathAMSArrayInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathAMSArray(*this));
}
-char const * MathAMSArrayInset::name_left() const
+char const * InsetMathAMSArray::name_left() const
{
if (name_ == "bmatrix")
return "[";
}
-char const * MathAMSArrayInset::name_right() const
+char const * InsetMathAMSArray::name_right() const
{
if (name_ == "bmatrix")
return "]";
}
-void MathAMSArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathAMSArray::metrics(MetricsInfo & mi, Dimension & dim) const
{
ArrayChanger dummy(mi.base);
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
dim.wid += 14;
dim_ = dim;
}
-void MathAMSArrayInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathAMSArray::draw(PainterInfo & pi, int x, int y) const
{
int const yy = y - dim_.ascent();
// Drawing the deco after an ArrayChanger does not work
mathed_draw_deco(pi, x + 1, yy, 5, dim_.height(), name_left());
mathed_draw_deco(pi, x + dim_.width() - 8, yy, 5, dim_.height(), name_right());
ArrayChanger dummy(pi.base);
- MathGridInset::drawWithMargin(pi, x, y, 6, 8);
+ InsetMathGrid::drawWithMargin(pi, x, y, 6, 8);
}
-bool MathAMSArrayInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathAMSArray::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
switch (cmd.action) {
flag.enabled(false);
return true;
}
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
default:
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
}
-void MathAMSArrayInset::write(WriteStream & os) const
+void InsetMathAMSArray::write(WriteStream & os) const
{
os << "\\begin{" << name_ << '}';
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
os << "\\end{" << name_ << '}';
}
-void MathAMSArrayInset::infoize(std::ostream & os) const
+void InsetMathAMSArray::infoize(std::ostream & os) const
{
string name = name_;
name[0] = lyx::support::uppercase(name[0]);
}
-void MathAMSArrayInset::normalize(NormalStream & os) const
+void InsetMathAMSArray::normalize(NormalStream & os) const
{
os << '[' << name_ << ' ';
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathAMSArrayInset::validate(LaTeXFeatures & features) const
+void InsetMathAMSArray::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathGridInset::validate(features);
+ InsetMathGrid::validate(features);
}
/// Inset for things like [pbvV]matrix, psmatrix etc
-class MathAMSArrayInset : public MathGridInset {
+class InsetMathAMSArray : public InsetMathGrid {
public:
///
- MathAMSArrayInset(std::string const & name, int m, int n);
+ InsetMathAMSArray(std::string const & name, int m, int n);
///
- MathAMSArrayInset(std::string const & name);
+ InsetMathAMSArray(std::string const & name);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pain, int x, int y) const;
///
- MathAMSArrayInset * asAMSArrayInset() { return this; }
+ InsetMathAMSArray * asAMSArrayInset() { return this; }
///
- MathAMSArrayInset const * asAMSArrayInset() const { return this; }
+ InsetMathAMSArray const * asAMSArrayInset() const { return this; }
///
bool getStatus(LCursor & cur, FuncRequest const & cmd,
using std::vector;
-MathArrayInset::MathArrayInset(string const & name, int m, int n)
- : MathGridInset(m, n), name_(name)
+InsetMathArray::InsetMathArray(string const & name, int m, int n)
+ : InsetMathGrid(m, n), name_(name)
{}
-MathArrayInset::MathArrayInset(string const & name, int m, int n,
+InsetMathArray::InsetMathArray(string const & name, int m, int n,
char valign, string const & halign)
- : MathGridInset(m, n, valign, halign), name_(name)
+ : InsetMathGrid(m, n, valign, halign), name_(name)
{}
-MathArrayInset::MathArrayInset(string const & name, char valign,
+InsetMathArray::InsetMathArray(string const & name, char valign,
string const & halign)
- : MathGridInset(valign, halign), name_(name)
+ : InsetMathGrid(valign, halign), name_(name)
{}
-MathArrayInset::MathArrayInset(string const & name, string const & str)
- : MathGridInset(1, 1), name_(name)
+InsetMathArray::InsetMathArray(string const & name, string const & str)
+ : InsetMathGrid(1, 1), name_(name)
{
vector< vector<string> > dat;
istringstream is(str);
}
-auto_ptr<InsetBase> MathArrayInset::doClone() const
+auto_ptr<InsetBase> InsetMathArray::doClone() const
{
- return auto_ptr<InsetBase>(new MathArrayInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathArray(*this));
}
-void MathArrayInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathArray::metrics(MetricsInfo & mi, Dimension & dim) const
{
ArrayChanger dummy(mi.base);
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
dim.wid += 6;
dim_ = dim;
}
-void MathArrayInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathArray::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
ArrayChanger dummy(pi.base);
- MathGridInset::drawWithMargin(pi, x, y, 4, 2);
+ InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
}
-void MathArrayInset::write(WriteStream & os) const
+void InsetMathArray::write(WriteStream & os) const
{
if (os.fragile())
os << "\\protect";
os << '[' << char(v_align_) << ']';
os << '{' << halign() << "}\n";
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
if (os.fragile())
os << "\\protect";
}
-void MathArrayInset::infoize(std::ostream & os) const
+void InsetMathArray::infoize(std::ostream & os) const
{
string name = name_;
name[0] = lyx::support::uppercase(name[0]);
}
-void MathArrayInset::normalize(NormalStream & os) const
+void InsetMathArray::normalize(NormalStream & os) const
{
os << '[' << name_ << ' ';
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathArrayInset::maple(MapleStream & os) const
+void InsetMathArray::maple(MapleStream & os) const
{
os << "array(";
- MathGridInset::maple(os);
+ InsetMathGrid::maple(os);
os << ')';
}
-void MathArrayInset::validate(LaTeXFeatures & features) const
+void InsetMathArray::validate(LaTeXFeatures & features) const
{
if (name_ == "subarray")
features.require("amsmath");
- MathGridInset::validate(features);
+ InsetMathGrid::validate(features);
}
/// Inset for things like \begin{array}...\end{array}
-class MathArrayInset : public MathGridInset {
+class InsetMathArray : public InsetMathGrid {
public:
///
- MathArrayInset(std::string const &, int m, int n);
+ InsetMathArray(std::string const &, int m, int n);
///
- MathArrayInset(std::string const &, int m, int n,
+ InsetMathArray(std::string const &, int m, int n,
char valign, std::string const & halign);
///
- MathArrayInset(std::string const &, char valign, std::string const & halign);
+ InsetMathArray(std::string const &, char valign, std::string const & halign);
/// convenience constructor from whitespace/newline separated data
- MathArrayInset(std::string const &, std::string const & str);
+ InsetMathArray(std::string const &, std::string const & str);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
- MathArrayInset * asArrayInset() { return this; }
+ InsetMathArray * asArrayInset() { return this; }
///
- MathArrayInset const * asArrayInset() const { return this; }
+ InsetMathArray const * asArrayInset() const { return this; }
///
void write(WriteStream & os) const;
MathAtom::MathAtom(InsetBase * p)
- : nucleus_(static_cast<MathInset *>(p))
+ : nucleus_(static_cast<InsetMath *>(p))
{}
: nucleus_(0)
{
if (at.nucleus_)
- nucleus_ = static_cast<MathInset*>(at.nucleus_->clone().release());
+ nucleus_ = static_cast<InsetMath*>(at.nucleus_->clone().release());
}
/**
-Wrapper for MathInset * with copy-semantics
+Wrapper for InsetMath * with copy-semantics
--
--
Ok: Implementing it thusly is not feasible since cursor movement gets
-hackish. We use MathAtom only as a wrapper around MathInset * with value
+hackish. We use MathAtom only as a wrapper around InsetMath * with value
semantics.
-The MathAtom owns the MathInset * and is responsible for proper cloning and
-destruction. Every MathInset * should be put into a MathAtom after its
+The MathAtom owns the InsetMath * and is responsible for proper cloning and
+destruction. Every InsetMath * should be put into a MathAtom after its
creation as soon as possible.
Andre'
*/
class InsetBase;
-class MathInset;
+class InsetMath;
class MathAtom {
public:
/// assignment invokes nucleus_->clone()
MathAtom & operator=(MathAtom const &);
/// access to the inset (checked with gprof)
- MathInset * nucleus() { return nucleus_; }
- MathInset const * nucleus() const { return nucleus_; }
+ InsetMath * nucleus() { return nucleus_; }
+ InsetMath const * nucleus() const { return nucleus_; }
/// access to the inset
- MathInset const * operator->() const { return nucleus_; }
+ InsetMath const * operator->() const { return nucleus_; }
/// width cache. Not nice...
//mutable int width_;
private:
///
- MathInset * nucleus_;
+ InsetMath * nucleus_;
};
#endif
using std::auto_ptr;
-MathBigInset::MathBigInset(string const & name, string const & delim)
+InsetMathBig::InsetMathBig(string const & name, string const & delim)
: name_(name), delim_(delim)
{}
-string MathBigInset::name() const
+string InsetMathBig::name() const
{
return name_;
}
-auto_ptr<InsetBase> MathBigInset::doClone() const
+auto_ptr<InsetBase> InsetMathBig::doClone() const
{
- return auto_ptr<InsetBase>(new MathBigInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBig(*this));
}
-MathBigInset::size_type MathBigInset::size() const
+InsetMathBig::size_type InsetMathBig::size() const
{
// order: big Big bigg Bigg biggg Biggg
// 0 1 2 3 4 5
}
-double MathBigInset::increase() const
+double InsetMathBig::increase() const
{
// The formula used in amsmath.sty is
// 1.2 * (1.0 + size() * 0.5) - 1.0.
}
-void MathBigInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBig::metrics(MetricsInfo & mi, Dimension & dim) const
{
double const h = mathed_char_ascent(mi.base.font, 'I');
double const f = increase();
}
-void MathBigInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBig::draw(PainterInfo & pi, int x, int y) const
{
// mathed_draw_deco does not use the leading backslash, so remove it.
// Replace \| by \Vert (equivalent in LaTeX), since mathed_draw_deco
}
-void MathBigInset::write(WriteStream & os) const
+void InsetMathBig::write(WriteStream & os) const
{
os << '\\' << name_ << ' ' << delim_;
if (delim_[0] == '\\')
}
-void MathBigInset::normalize(NormalStream & os) const
+void InsetMathBig::normalize(NormalStream & os) const
{
os << '[' << name_ << ' ' << delim_ << ']';
}
-void MathBigInset::infoize2(std::ostream & os) const
+void InsetMathBig::infoize2(std::ostream & os) const
{
os << name_;
}
-bool MathBigInset::isBigInsetDelim(string const & delim)
+bool InsetMathBig::isBigInsetDelim(string const & delim)
{
// mathed_draw_deco must handle these
static char const * const delimiters[] = {
#include <string>
/// Inset for \\bigl & Co.
-class MathBigInset : public MathDimInset {
+class InsetMathBig : public InsetMathDim {
public:
///
- MathBigInset(std::string const & name, std::string const & delim);
+ InsetMathBig(std::string const & name, std::string const & delim);
///
std::string name() const;
///
using std::auto_ptr;
-MathBinomInset::MathBinomInset(bool choose)
+InsetMathBinom::InsetMathBinom(bool choose)
: choose_(choose)
{}
-auto_ptr<InsetBase> MathBinomInset::doClone() const
+auto_ptr<InsetBase> InsetMathBinom::doClone() const
{
- return auto_ptr<InsetBase>(new MathBinomInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBinom(*this));
}
-int MathBinomInset::dw() const
+int InsetMathBinom::dw() const
{
int w = dim_.height() / 5;
if (w > 15)
}
-void MathBinomInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBinom::metrics(MetricsInfo & mi, Dimension & dim) const
{
ScriptChanger dummy(mi.base);
cell(0).metrics(mi);
}
-void MathBinomInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBinom::draw(PainterInfo & pi, int x, int y) const
{
int m = x + dim_.width() / 2;
ScriptChanger dummy(pi.base);
}
-bool MathBinomInset::extraBraces() const
+bool InsetMathBinom::extraBraces() const
{
return choose_;
}
-void MathBinomInset::write(WriteStream & os) const
+void InsetMathBinom::write(WriteStream & os) const
{
if (choose_)
os << '{' << cell(0) << " \\choose " << cell(1) << '}';
}
-void MathBinomInset::normalize(NormalStream & os) const
+void InsetMathBinom::normalize(NormalStream & os) const
{
os << "[binom " << cell(0) << ' ' << cell(1) << ']';
}
/// Binom like objects
-class MathBinomInset : public MathFracbaseInset {
+class InsetMathBinom : public InsetMathFracBase {
public:
///
- explicit MathBinomInset(bool choose = false);
+ explicit InsetMathBinom(bool choose = false);
///
void write(WriteStream & os) const;
///
using std::auto_ptr;
-MathBoldsymbolInset::MathBoldsymbolInset()
- : MathNestInset(1)
+InsetMathBoldSymbol::InsetMathBoldSymbol()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathBoldsymbolInset::doClone() const
+auto_ptr<InsetBase> InsetMathBoldSymbol::doClone() const
{
- return auto_ptr<InsetBase>(new MathBoldsymbolInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBoldSymbol(*this));
}
-void MathBoldsymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBoldSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
{
//FontSetChanger dummy(mi.base, "mathbf");
cell(0).metrics(mi, dim);
}
-void MathBoldsymbolInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBoldSymbol::draw(PainterInfo & pi, int x, int y) const
{
//FontSetChanger dummy(pi.base, "mathbf");
cell(0).draw(pi, x + 1, y);
}
-void MathBoldsymbolInset::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
+void InsetMathBoldSymbol::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
{
cell(0).metricsT(mi, dim_);
}
-void MathBoldsymbolInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
{
cell(0).drawT(pain, x, y);
}
-void MathBoldsymbolInset::validate(LaTeXFeatures & features) const
+void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
{
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
features.require("amssymb");
}
-void MathBoldsymbolInset::write(WriteStream & os) const
+void InsetMathBoldSymbol::write(WriteStream & os) const
{
os << "\\boldsymbol{" << cell(0) << "}";
}
-void MathBoldsymbolInset::infoize(std::ostream & os) const
+void InsetMathBoldSymbol::infoize(std::ostream & os) const
{
os << "Boldsymbol ";
}
/// Inset for AMSTeX's \boldsymbol
-class MathBoldsymbolInset : public MathNestInset {
+class InsetMathBoldSymbol : public InsetMathNest {
public:
///
- MathBoldsymbolInset();
+ InsetMathBoldSymbol();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::auto_ptr;
-MathBoxedInset::MathBoxedInset()
- : MathNestInset(1)
+InsetMathBoxed::InsetMathBoxed()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathBoxedInset::doClone() const
+auto_ptr<InsetBase> InsetMathBoxed::doClone() const
{
- return auto_ptr<InsetBase>(new MathBoxedInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBoxed(*this));
}
-void MathBoxedInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBoxed::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
metricsMarkers2(dim, 3); // 1 pixel space, 1 frame, 1 space
}
-void MathBoxedInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBoxed::draw(PainterInfo & pi, int x, int y) const
{
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
dim_.width() - 2, dim_.height() - 2, LColor::foreground);
}
-void MathBoxedInset::write(WriteStream & os) const
+void InsetMathBoxed::write(WriteStream & os) const
{
os << "\\boxed{" << cell(0) << '}';
}
-void MathBoxedInset::normalize(NormalStream & os) const
+void InsetMathBoxed::normalize(NormalStream & os) const
{
os << "[boxed " << cell(0) << ']';
}
-void MathBoxedInset::infoize(std::ostream & os) const
+void InsetMathBoxed::infoize(std::ostream & os) const
{
os << "Boxed: ";
}
-void MathBoxedInset::validate(LaTeXFeatures & features) const
+void InsetMathBoxed::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
}
/// Non-AMS-style frame
-class MathBoxedInset : public MathNestInset {
+class InsetMathBoxed : public InsetMathNest {
public:
///
- MathBoxedInset();
+ InsetMathBoxed();
///
void validate(LaTeXFeatures & features) const;
///
using std::auto_ptr;
-MathBoxInset::MathBoxInset(string const & name)
- : MathNestInset(1), name_(name)
+InsetMathBox::InsetMathBox(string const & name)
+ : InsetMathNest(1), name_(name)
{}
-auto_ptr<InsetBase> MathBoxInset::doClone() const
+auto_ptr<InsetBase> InsetMathBox::doClone() const
{
- return auto_ptr<InsetBase>(new MathBoxInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBox(*this));
}
-void MathBoxInset::write(WriteStream & os) const
+void InsetMathBox::write(WriteStream & os) const
{
os << '\\' << name_ << '{' << cell(0) << '}';
}
-void MathBoxInset::normalize(NormalStream & os) const
+void InsetMathBox::normalize(NormalStream & os) const
{
os << '[' << name_ << ' ';
//text_->write(buffer(), os);
}
-void MathBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
cell(0).metrics(mi, dim);
}
-void MathBoxInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBox::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, "textnormal");
cell(0).draw(pi, x, y);
}
-void MathBoxInset::infoize(std::ostream & os) const
+void InsetMathBox::infoize(std::ostream & os) const
{
os << "Box: " << name_;
}
/// Support for \\mbox
-class MathBoxInset : public MathNestInset {
+class InsetMathBox : public InsetMathNest {
public:
///
- explicit MathBoxInset(std::string const & name);
+ explicit InsetMathBox(std::string const & name);
///
mode_type currentMode() const { return TEXT_MODE; }
///
using std::auto_ptr;
-MathBraceInset::MathBraceInset()
- : MathNestInset(1)
+InsetMathBrace::InsetMathBrace()
+ : InsetMathNest(1)
{}
-MathBraceInset::MathBraceInset(MathArray const & ar)
- : MathNestInset(1)
+InsetMathBrace::InsetMathBrace(MathArray const & ar)
+ : InsetMathNest(1)
{
cell(0) = ar;
}
-auto_ptr<InsetBase> MathBraceInset::doClone() const
+auto_ptr<InsetBase> InsetMathBrace::doClone() const
{
- return auto_ptr<InsetBase>(new MathBraceInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathBrace(*this));
}
-void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi);
Dimension t;
}
-void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
{
LyXFont font = pi.base.font;
font.setColor(LColor::latex);
}
-void MathBraceInset::write(WriteStream & os) const
+void InsetMathBrace::write(WriteStream & os) const
{
os << '{' << cell(0) << '}';
}
-void MathBraceInset::normalize(NormalStream & os) const
+void InsetMathBrace::normalize(NormalStream & os) const
{
os << "[block " << cell(0) << ']';
}
-void MathBraceInset::maple(MapleStream & os) const
+void InsetMathBrace::maple(MapleStream & os) const
{
os << cell(0);
}
-void MathBraceInset::octave(OctaveStream & os) const
+void InsetMathBrace::octave(OctaveStream & os) const
{
os << cell(0);
}
-void MathBraceInset::mathmlize(MathMLStream & os) const
+void InsetMathBrace::mathmlize(MathMLStream & os) const
{
os << MTag("mrow") << cell(0) << ETag("mrow");
}
-void MathBraceInset::mathematica(MathematicaStream & os) const
+void InsetMathBrace::mathematica(MathematicaStream & os) const
{
os << cell(0);
}
-void MathBraceInset::infoize(std::ostream & os) const
+void InsetMathBrace::infoize(std::ostream & os) const
{
os << "Nested Block: ";
}
/// Extra nesting
-class MathBraceInset : public MathNestInset {
+class InsetMathBrace : public InsetMathNest {
public:
///
- MathBraceInset();
+ InsetMathBrace();
///
- MathBraceInset(MathArray const & ar);
+ InsetMathBrace(MathArray const & ar);
///
- MathBraceInset const * asBraceInset() const { return this; }
+ InsetMathBrace const * asBraceInset() const { return this; }
/// we write extra braces in any case...
bool extraBraces() const { return true; }
///
using std::auto_ptr;
-MathCasesInset::MathCasesInset(row_type n)
- : MathGridInset(2, n, 'c', "ll")
+InsetMathCases::InsetMathCases(row_type n)
+ : InsetMathGrid(2, n, 'c', "ll")
{}
-auto_ptr<InsetBase> MathCasesInset::doClone() const
+auto_ptr<InsetBase> InsetMathCases::doClone() const
{
- return auto_ptr<InsetBase>(new MathCasesInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathCases(*this));
}
-void MathCasesInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
{
- MathGridInset::metrics(mi);
+ InsetMathGrid::metrics(mi);
dim_.wid += 8;
dim = dim_;
}
-void MathCasesInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
{
mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), "{");
- MathGridInset::drawWithMargin(pi, x, y, 8, 0);
+ InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
setPosCache(pi, x, y);
}
-void MathCasesInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathCases::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- //lyxerr << "*** MathCasesInset: request: " << cmd << endl;
+ //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
switch (cmd.action) {
case LFUN_TABULAR_FEATURE: {
recordUndo(cur);
}
}
default:
- MathGridInset::doDispatch(cur, cmd);
+ InsetMathGrid::doDispatch(cur, cmd);
}
}
-bool MathCasesInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathCases::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
switch (cmd.action) {
}
}
default:
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
}
-void MathCasesInset::write(WriteStream & os) const
+void InsetMathCases::write(WriteStream & os) const
{
if (os.fragile())
os << "\\protect";
os << "\\begin{cases}\n";
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
if (os.fragile())
os << "\\protect";
os << "\\end{cases}";
}
-void MathCasesInset::normalize(NormalStream & os) const
+void InsetMathCases::normalize(NormalStream & os) const
{
os << "[cases ";
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathCasesInset::maple(MapleStream & os) const
+void InsetMathCases::maple(MapleStream & os) const
{
os << "cases(";
- MathGridInset::maple(os);
+ InsetMathGrid::maple(os);
os << ')';
}
-void MathCasesInset::infoize(std::ostream & os) const
+void InsetMathCases::infoize(std::ostream & os) const
{
os << "Cases ";
}
-void MathCasesInset::validate(LaTeXFeatures & features) const
+void InsetMathCases::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathGridInset::validate(features);
+ InsetMathGrid::validate(features);
}
class LaTeXFeatures;
-class MathCasesInset : public MathGridInset {
+class InsetMathCases : public InsetMathGrid {
public:
///
- explicit MathCasesInset(row_type rows = 1u);
+ explicit InsetMathCases(row_type rows = 1u);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
}
-MathCharInset::MathCharInset(char c)
+InsetMathChar::InsetMathChar(char c)
: char_(c)
{}
-auto_ptr<InsetBase> MathCharInset::doClone() const
+auto_ptr<InsetBase> InsetMathChar::doClone() const
{
- return auto_ptr<InsetBase>(new MathCharInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathChar(*this));
}
-void MathCharInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathChar::metrics(MetricsInfo & mi, Dimension & dim) const
{
#if 1
if (char_ == '=' && has_math_fonts) {
mathed_char_dim(font_, char_, dim_);
if (isBinaryOp(char_, code_))
width_ += 2 * font_metrics::width(' ', font_);
- lyxerr << "MathCharInset::metrics: " << dim << endl;
+ lyxerr << "InsetMathChar::metrics: " << dim << endl;
#endif
width_ = dim.wid;
}
-void MathCharInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathChar::draw(PainterInfo & pi, int x, int y) const
{
//lyxerr << "drawing '" << char_ << "' font: " << pi.base.fontname << endl;
int const em = mathed_char_width(pi.base.font, 'M');
}
-void MathCharInset::metricsT(TextMetricsInfo const &, Dimension & dim) const
+void InsetMathChar::metricsT(TextMetricsInfo const &, Dimension & dim) const
{
dim.wid = 1;
dim.asc = 1;
}
-void MathCharInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathChar::drawT(TextPainter & pain, int x, int y) const
{
//lyxerr << "drawing text '" << char_ << "' code: " << code_ << endl;
pain.draw(x, y, char_);
}
-void MathCharInset::write(WriteStream & os) const
+void InsetMathChar::write(WriteStream & os) const
{
os << char_;
}
-void MathCharInset::normalize(NormalStream & os) const
+void InsetMathChar::normalize(NormalStream & os) const
{
os << "[char " << char_ << " mathalpha]";
}
-void MathCharInset::octave(OctaveStream & os) const
+void InsetMathChar::octave(OctaveStream & os) const
{
os << char_;
}
-void MathCharInset::mathmlize(MathMLStream & ms) const
+void InsetMathChar::mathmlize(MathMLStream & ms) const
{
switch (char_) {
case '<': ms << "<"; break;
}
-bool MathCharInset::isRelOp() const
+bool InsetMathChar::isRelOp() const
{
return char_ == '=' || char_ == '<' || char_ == '>';
}
/// The base character inset.
-class MathCharInset : public MathInset {
+class InsetMathChar : public InsetMath {
public:
///
- explicit MathCharInset(char c);
+ explicit InsetMathChar(char c);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
///
void mathmlize(MathMLStream & ms) const;
/// identifies Charinsets
- MathCharInset const * asCharInset() const { return this; }
+ InsetMathChar const * asCharInset() const { return this; }
///
char getChar() const { return char_; }
///
} // namespace anon
-MathColorInset::MathColorInset(bool oldstyle, LColor_color const & color)
- : MathNestInset(1), oldstyle_(oldstyle),
+InsetMathColor::InsetMathColor(bool oldstyle, LColor_color const & color)
+ : InsetMathNest(1), oldstyle_(oldstyle),
color_(lcolor.getLaTeXName(color))
{}
-MathColorInset::MathColorInset(bool oldstyle, string const & color)
- : MathNestInset(1), oldstyle_(oldstyle), color_(color)
+InsetMathColor::InsetMathColor(bool oldstyle, string const & color)
+ : InsetMathNest(1), oldstyle_(oldstyle), color_(color)
{}
-auto_ptr<InsetBase> MathColorInset::doClone() const
+auto_ptr<InsetBase> InsetMathColor::doClone() const
{
- return auto_ptr<InsetBase>(new MathColorInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathColor(*this));
}
-void MathColorInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathColor::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
-void MathColorInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathColor::draw(PainterInfo & pi, int x, int y) const
{
LColor_color origcol = pi.base.font.color();
pi.base.font.setColor(lcolor.getFromLaTeXName(color_));
}
-void MathColorInset::validate(LaTeXFeatures & features) const
+void InsetMathColor::validate(LaTeXFeatures & features) const
{
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
if (!normalcolor(color_))
features.require("color");
}
-void MathColorInset::write(WriteStream & os) const
+void InsetMathColor::write(WriteStream & os) const
{
if (normalcolor(color_))
// reset to default color inside another color inset
}
-void MathColorInset::normalize(NormalStream & os) const
+void InsetMathColor::normalize(NormalStream & os) const
{
os << "[color " << color_ << ' ' << cell(0) << ']';
}
-void MathColorInset::infoize(std::ostream & os) const
+void InsetMathColor::infoize(std::ostream & os) const
{
os << "Color: " << color_;
}
/// Change colours.
-class MathColorInset : public MathNestInset {
+class InsetMathColor : public InsetMathNest {
public:
/// Create a color inset from LyX color number
- explicit MathColorInset(bool oldstyle,
+ explicit InsetMathColor(bool oldstyle,
LColor_color const & color = LColor::none);
/// Create a color inset from LaTeX color name
- explicit MathColorInset(bool oldstyle, std::string const & color);
+ explicit InsetMathColor(bool oldstyle, std::string const & color);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// we write extra braces in any case...
using std::auto_ptr;
-MathCommentInset::MathCommentInset()
- : MathNestInset(1)
+InsetMathComment::InsetMathComment()
+ : InsetMathNest(1)
{}
-MathCommentInset::MathCommentInset(string const & str)
- : MathNestInset(1)
+InsetMathComment::InsetMathComment(string const & str)
+ : InsetMathNest(1)
{
asArray(str, cell(0));
}
-auto_ptr<InsetBase> MathCommentInset::doClone() const
+auto_ptr<InsetBase> InsetMathComment::doClone() const
{
- return auto_ptr<InsetBase>(new MathCommentInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathComment(*this));
}
-void MathCommentInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathComment::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
-void MathCommentInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathComment::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 1, y);
drawMarkers(pi, x, y);
}
-void MathCommentInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathComment::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
cell(0).metricsT(mi, dim);
}
-void MathCommentInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathComment::drawT(TextPainter & pain, int x, int y) const
{
cell(0).drawT(pain, x, y);
}
-void MathCommentInset::write(WriteStream & os) const
+void InsetMathComment::write(WriteStream & os) const
{
os << '%' << cell(0) << "\n";
}
-void MathCommentInset::maple(MapleStream & os) const
+void InsetMathComment::maple(MapleStream & os) const
{
os << '#' << cell(0) << "\n";
}
-void MathCommentInset::mathematica(MathematicaStream &) const
+void InsetMathComment::mathematica(MathematicaStream &) const
{}
-void MathCommentInset::octave(OctaveStream &) const
+void InsetMathComment::octave(OctaveStream &) const
{}
-void MathCommentInset::mathmlize(MathMLStream & os) const
+void InsetMathComment::mathmlize(MathMLStream & os) const
{
os << MTag("comment") << cell(0) << cell(1) << ETag("comment");
}
-void MathCommentInset::infoize(std::ostream & os) const
+void InsetMathComment::infoize(std::ostream & os) const
{
os << "Comment";
}
class latexkeys;
/// Inset for end-of-line comments
-class MathCommentInset : public MathNestInset {
+class InsetMathComment : public InsetMathNest {
public:
///
- MathCommentInset();
+ InsetMathComment();
///
- explicit MathCommentInset(std::string const &);
+ explicit InsetMathComment(std::string const &);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
#include "support/std_ostream.h"
-MathDecorationInset::MathDecorationInset(latexkeys const * key)
- : MathNestInset(1), key_(key)
+InsetMathDecoration::InsetMathDecoration(latexkeys const * key)
+ : InsetMathNest(1), key_(key)
{
// lyxerr << " creating deco " << key->name << std::endl;
}
-std::auto_ptr<InsetBase> MathDecorationInset::doClone() const
+std::auto_ptr<InsetBase> InsetMathDecoration::doClone() const
{
- return std::auto_ptr<InsetBase>(new MathDecorationInset(*this));
+ return std::auto_ptr<InsetBase>(new InsetMathDecoration(*this));
}
-bool MathDecorationInset::upper() const
+bool InsetMathDecoration::upper() const
{
return key_->name.substr(0, 5) != "under";
}
-bool MathDecorationInset::isScriptable() const
+bool InsetMathDecoration::isScriptable() const
{
return
key_->name == "overbrace" ||
}
-bool MathDecorationInset::protect() const
+bool InsetMathDecoration::protect() const
{
return
key_->name == "overbrace" ||
}
-bool MathDecorationInset::wide() const
+bool InsetMathDecoration::wide() const
{
return
key_->name == "overline" ||
}
-bool MathDecorationInset::ams() const
+bool InsetMathDecoration::ams() const
{
return
key_->name == "overleftrightarrow" ||
}
-void MathDecorationInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDecoration::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
}
-void MathDecorationInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathDecoration::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 1, y);
if (wide())
}
-void MathDecorationInset::write(WriteStream & os) const
+void InsetMathDecoration::write(WriteStream & os) const
{
if (os.fragile() && protect())
os << "\\protect";
}
-void MathDecorationInset::normalize(NormalStream & os) const
+void InsetMathDecoration::normalize(NormalStream & os) const
{
os << "[deco " << key_->name << ' ' << cell(0) << ']';
}
-void MathDecorationInset::infoize(std::ostream & os) const
+void InsetMathDecoration::infoize(std::ostream & os) const
{
os << "Deco: " << key_->name;
}
-void MathDecorationInset::validate(LaTeXFeatures & features) const
+void InsetMathDecoration::validate(LaTeXFeatures & features) const
{
if (ams())
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
class latexkeys;
/// Decorations and accents over (below) a math object
-class MathDecorationInset : public MathNestInset {
+class InsetMathDecoration : public InsetMathNest {
public:
///
- explicit MathDecorationInset(latexkeys const * key);
+ explicit InsetMathDecoration(latexkeys const * key);
///
void draw(PainterInfo &, int x, int y) const;
///
-MathDelimInset::MathDelimInset(string const & l, string const & r)
- : MathNestInset(1), left_(l), right_(r)
+InsetMathDelim::InsetMathDelim(string const & l, string const & r)
+ : InsetMathNest(1), left_(l), right_(r)
{}
-MathDelimInset::MathDelimInset
+InsetMathDelim::InsetMathDelim
(string const & l, string const & r, MathArray const & ar)
- : MathNestInset(1), left_(l), right_(r)
+ : InsetMathNest(1), left_(l), right_(r)
{
cell(0) = ar;
}
-auto_ptr<InsetBase> MathDelimInset::doClone() const
+auto_ptr<InsetBase> InsetMathDelim::doClone() const
{
- return auto_ptr<InsetBase>(new MathDelimInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathDelim(*this));
}
-void MathDelimInset::write(WriteStream & os) const
+void InsetMathDelim::write(WriteStream & os) const
{
os << "\\left" << convertDelimToLatexName(left_) << cell(0)
<< "\\right" << convertDelimToLatexName(right_);
}
-void MathDelimInset::normalize(NormalStream & os) const
+void InsetMathDelim::normalize(NormalStream & os) const
{
os << "[delim " << convertDelimToLatexName(left_) << ' '
<< convertDelimToLatexName(right_) << ' ' << cell(0) << ']';
}
-void MathDelimInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi);
Dimension t;
}
-void MathDelimInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathDelim::draw(PainterInfo & pi, int x, int y) const
{
int const b = y - dim_.asc;
cell(0).draw(pi, x + dw_ + 4, y);
}
-bool MathDelimInset::isParenthesis() const
+bool InsetMathDelim::isParenthesis() const
{
return left_ == "(" && right_ == ")";
}
-bool MathDelimInset::isBrackets() const
+bool InsetMathDelim::isBrackets() const
{
return left_ == "[" && right_ == "]";
}
-bool MathDelimInset::isAbs() const
+bool InsetMathDelim::isAbs() const
{
return left_ == "|" && right_ == "|";
}
-void MathDelimInset::maple(MapleStream & os) const
+void InsetMathDelim::maple(MapleStream & os) const
{
if (isAbs()) {
if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
os << left_ << cell(0) << right_;
}
-void MathDelimInset::maxima(MaximaStream & os) const
+void InsetMathDelim::maxima(MaximaStream & os) const
{
if (isAbs()) {
if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
}
-void MathDelimInset::mathematica(MathematicaStream & os) const
+void InsetMathDelim::mathematica(MathematicaStream & os) const
{
if (isAbs()) {
if (cell(0).size() == 1 && cell(0).front()->asMatrixInset())
}
-void MathDelimInset::mathmlize(MathMLStream & os) const
+void InsetMathDelim::mathmlize(MathMLStream & os) const
{
os << "<fenced open=\"" << left_ << "\" close=\""
<< right_ << "\">" << cell(0) << "</fenced>";
}
-void MathDelimInset::octave(OctaveStream & os) const
+void InsetMathDelim::octave(OctaveStream & os) const
{
if (isAbs())
os << "det(" << cell(0) << ')';
/// A delimiter
-class MathDelimInset : public MathNestInset {
+class InsetMathDelim : public InsetMathNest {
public:
///
- MathDelimInset(std::string const & left, std::string const & right);
+ InsetMathDelim(std::string const & left, std::string const & right);
///
- MathDelimInset(std::string const & left, std::string const & right, MathArray const &);
+ InsetMathDelim(std::string const & left, std::string const & right, MathArray const &);
///
- MathDelimInset * asDelimInset() { return this; }
+ InsetMathDelim * asDelimInset() { return this; }
///
- MathDelimInset const * asDelimInset() const { return this; }
+ InsetMathDelim const * asDelimInset() const { return this; }
/// is it (...)?
bool isParenthesis() const;
/// is it [...]?
using std::auto_ptr;
-MathDfracInset::MathDfracInset()
- : MathFracInset()
+InsetMathDFrac::InsetMathDFrac()
+ : InsetMathFrac()
{}
-auto_ptr<InsetBase> MathDfracInset::doClone() const
+auto_ptr<InsetBase> InsetMathDFrac::doClone() const
{
- return auto_ptr<InsetBase>(new MathDfracInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathDFrac(*this));
}
-void MathDfracInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi);
cell(1).metrics(mi);
}
-void MathDfracInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathDFrac::draw(PainterInfo & pi, int x, int y) const
{
int m = x + dim_.wid / 2;
cell(0).draw(pi, m - cell(0).width() / 2, y - cell(0).descent() - 2 - 5);
}
-string MathDfracInset::name() const
+string InsetMathDFrac::name() const
{
return "dfrac";
}
-void MathDfracInset::mathmlize(MathMLStream & os) const
+void InsetMathDFrac::mathmlize(MathMLStream & os) const
{
os << MTag("mdfrac") << cell(0) << cell(1) << ETag("mdfrac");
}
-void MathDfracInset::validate(LaTeXFeatures & features) const
+void InsetMathDFrac::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
/// \dfrac support
-class MathDfracInset : public MathFracInset {
+class InsetMathDFrac : public InsetMathFrac {
public:
///
- MathDfracInset();
+ InsetMathDFrac();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::endl;
-MathDiffInset::MathDiffInset()
- : MathNestInset(1)
+InsetMathDiff::InsetMathDiff()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathDiffInset::doClone() const
+auto_ptr<InsetBase> InsetMathDiff::doClone() const
{
- return auto_ptr<InsetBase>(new MathDiffInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathDiff(*this));
}
-void MathDiffInset::addDer(MathArray const & der)
+void InsetMathDiff::addDer(MathArray const & der)
{
cells_.push_back(der);
}
-void MathDiffInset::normalize(NormalStream & os) const
+void InsetMathDiff::normalize(NormalStream & os) const
{
os << "[diff";
for (idx_type idx = 0; idx < nargs(); ++idx)
}
-void MathDiffInset::metrics(MetricsInfo &, Dimension &) const
+void InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
{
lyxerr << "should not happen" << endl;
}
-void MathDiffInset::draw(PainterInfo &, int, int) const
+void InsetMathDiff::draw(PainterInfo &, int, int) const
{
lyxerr << "should not happen" << endl;
}
-void MathDiffInset::maple(MapleStream & os) const
+void InsetMathDiff::maple(MapleStream & os) const
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
}
-void MathDiffInset::maxima(MaximaStream & os) const
+void InsetMathDiff::maxima(MaximaStream & os) const
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
}
-void MathDiffInset::mathematica(MathematicaStream & os) const
+void InsetMathDiff::mathematica(MathematicaStream & os) const
{
os << "D[";
for (idx_type idx = 0; idx < nargs(); ++idx) {
}
-void MathDiffInset::mathmlize(MathMLStream & os) const
+void InsetMathDiff::mathmlize(MathMLStream & os) const
{
os << "diff(";
for (idx_type idx = 0; idx < nargs(); ++idx) {
}
-void MathDiffInset::write(WriteStream &) const
+void InsetMathDiff::write(WriteStream &) const
{
lyxerr << "should not happen" << endl;
}
#include "math_nestinset.h"
-class MathDiffInset : public MathNestInset {
+class InsetMathDiff : public InsetMathNest {
public:
///
- MathDiffInset();
+ InsetMathDiff();
///
void addDer(MathArray const & der);
///
#include "debug.h"
-MathDimInset::MathDimInset()
+InsetMathDim::InsetMathDim()
{}
-int MathDimInset::ascent() const
+int InsetMathDim::ascent() const
{
return dim_.asc;
}
-int MathDimInset::descent() const
+int InsetMathDim::descent() const
{
return dim_.des;
}
-int MathDimInset::width() const
+int InsetMathDim::width() const
{
return dim_.wid;
}
-void MathDimInset::setPosCache(PainterInfo const &, int x, int y) const
+void InsetMathDim::setPosCache(PainterInfo const &, int x, int y) const
{
- //lyxerr << "MathDimInset: cache to " << x << " " << y << std::endl;
+ //lyxerr << "InsetMathDim: cache to " << x << " " << y << std::endl;
theCoords.insets().add(this, x, y);
}
/// things that need the dimension cache
-class MathDimInset : public MathInset {
+class InsetMathDim : public InsetMath {
public:
///
- MathDimInset();
+ InsetMathDim();
///
Dimension dimensions() const { return dim_; }
using std::auto_ptr;
-MathDotsInset::MathDotsInset(latexkeys const * key)
+InsetMathDots::InsetMathDots(latexkeys const * key)
: key_(key)
{}
-auto_ptr<InsetBase> MathDotsInset::doClone() const
+auto_ptr<InsetBase> InsetMathDots::doClone() const
{
- return auto_ptr<InsetBase>(new MathDotsInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathDots(*this));
}
-void MathDotsInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathDots::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_char_dim(mi.base.font, 'M', dim);
dh_ = 0;
}
-void MathDotsInset::draw(PainterInfo & pain, int x, int y) const
+void InsetMathDots::draw(PainterInfo & pain, int x, int y) const
{
mathed_draw_deco(pain, x + 2, y - dh_, dim_.width() - 2, dim_.ascent(),
key_->name);
}
-string MathDotsInset::name() const
+string InsetMathDots::name() const
{
return key_->name;
}
class latexkeys;
/// The different kinds of ellipsis
-class MathDotsInset : public MathDimInset {
+class InsetMathDots : public InsetMathDim {
public:
///
- explicit MathDotsInset(latexkeys const * l);
+ explicit InsetMathDots(latexkeys const * l);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::auto_ptr;
-MathEnvInset::MathEnvInset(string const & name)
- : MathNestInset(1), name_(name)
+InsetMathEnv::InsetMathEnv(string const & name)
+ : InsetMathNest(1), name_(name)
{}
-auto_ptr<InsetBase> MathEnvInset::doClone() const
+auto_ptr<InsetBase> InsetMathEnv::doClone() const
{
- return auto_ptr<InsetBase>(new MathEnvInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathEnv(*this));
}
-void MathEnvInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathEnv::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
-void MathEnvInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathEnv::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 1, y);
drawMarkers(pi, x, y);
}
-void MathEnvInset::write(WriteStream & os) const
+void InsetMathEnv::write(WriteStream & os) const
{
os << "\\begin{" << name_ << '}' << cell(0) << "\\end{" << name_ << '}';
}
-void MathEnvInset::normalize(NormalStream & os) const
+void InsetMathEnv::normalize(NormalStream & os) const
{
os << "[env " << name_ << ' ' << cell(0) << ']';
}
-void MathEnvInset::infoize(std::ostream & os) const
+void InsetMathEnv::infoize(std::ostream & os) const
{
os << "Env: " << name_;
}
/// Environtments á la \begin{something}...\end{something}
-class MathEnvInset : public MathNestInset {
+class InsetMathEnv : public InsetMathNest {
public:
///
- MathEnvInset(std::string const & name_);
+ InsetMathEnv(std::string const & name_);
///
void draw(PainterInfo &, int x, int y) const;
///
using std::auto_ptr;
-MathExFuncInset::MathExFuncInset(string const & name)
- : MathNestInset(1), name_(name)
+InsetMathExFunc::InsetMathExFunc(string const & name)
+ : InsetMathNest(1), name_(name)
{}
-MathExFuncInset::MathExFuncInset(string const & name, MathArray const & ar)
- : MathNestInset(1), name_(name)
+InsetMathExFunc::InsetMathExFunc(string const & name, MathArray const & ar)
+ : InsetMathNest(1), name_(name)
{
cell(0) = ar;
}
-auto_ptr<InsetBase> MathExFuncInset::doClone() const
+auto_ptr<InsetBase> InsetMathExFunc::doClone() const
{
- return auto_ptr<InsetBase>(new MathExFuncInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathExFunc(*this));
}
-void MathExFuncInset::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
+void InsetMathExFunc::metrics(MetricsInfo & mi, Dimension & /*dim*/) const
{
mathed_string_dim(mi.base.font, name_, dim_);
}
-void MathExFuncInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathExFunc::draw(PainterInfo & pi, int x, int y) const
{
drawStrBlack(pi, x, y, name_);
}
-string MathExFuncInset::name() const
+string InsetMathExFunc::name() const
{
return name_;
}
-void MathExFuncInset::maple(MapleStream & os) const
+void InsetMathExFunc::maple(MapleStream & os) const
{
if (name_ == "det")
os << "linalg[det](" << cell(0) << ')';
}
-void MathExFuncInset::maxima(MaximaStream & os) const
+void InsetMathExFunc::maxima(MaximaStream & os) const
{
if (name_ == "det")
os << "determinant(" << cell(0) << ')';
}
-void MathExFuncInset::mathematica(MathematicaStream & os) const
+void InsetMathExFunc::mathematica(MathematicaStream & os) const
{
os << asMathematicaName(name_) << '[' << cell(0) << ']';
}
-void MathExFuncInset::mathmlize(MathMLStream & os) const
+void InsetMathExFunc::mathmlize(MathMLStream & os) const
{
os << MTag(name_.c_str()) << cell(0) << ETag(name_.c_str());
}
-void MathExFuncInset::octave(OctaveStream & os) const
+void InsetMathExFunc::octave(OctaveStream & os) const
{
os << name_ << '(' << cell(0) << ')';
}
// f(x) in one block (as opposed to 'f','(','x',')' or 'f','x')
// for interfacing external programs
-class MathExFuncInset : public MathNestInset {
+class InsetMathExFunc : public InsetMathNest {
public:
///
- explicit MathExFuncInset(std::string const & name);
+ explicit InsetMathExFunc(std::string const & name);
///
- MathExFuncInset(std::string const & name, MathArray const & ar);
+ InsetMathExFunc(std::string const & name, MathArray const & ar);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::endl;
-MathExIntInset::MathExIntInset(string const & name)
- : MathNestInset(4), symbol_(name)
+InsetMathExInt::InsetMathExInt(string const & name)
+ : InsetMathNest(4), symbol_(name)
{}
// 0 - core
// 3 - upper
-auto_ptr<InsetBase> MathExIntInset::doClone() const
+auto_ptr<InsetBase> InsetMathExInt::doClone() const
{
- return auto_ptr<InsetBase>(new MathExIntInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathExInt(*this));
}
-void MathExIntInset::symbol(string const & symbol)
+void InsetMathExInt::symbol(string const & symbol)
{
symbol_ = symbol;
}
-bool MathExIntInset::hasScripts() const
+bool InsetMathExInt::hasScripts() const
{
// take empty upper bound as "no scripts"
return !cell(3).empty();
-void MathExIntInset::normalize(NormalStream & os) const
+void InsetMathExInt::normalize(NormalStream & os) const
{
os << '[' << symbol_ << ' ' << cell(0) << ' ' << cell(1) << ' '
<< cell(2) << ' ' << cell(3) << ']';
}
-void MathExIntInset::metrics(MetricsInfo &, Dimension &) const
+void InsetMathExInt::metrics(MetricsInfo &, Dimension &) const
{
lyxerr << "should not happen" << endl;
}
-void MathExIntInset::draw(PainterInfo &, int, int) const
+void InsetMathExInt::draw(PainterInfo &, int, int) const
{
lyxerr << "should not happen" << endl;
}
-void MathExIntInset::maple(MapleStream & os) const
+void InsetMathExInt::maple(MapleStream & os) const
{
os << symbol_ << '(';
if (cell(0).size())
}
-void MathExIntInset::maxima(MaximaStream & os) const
+void InsetMathExInt::maxima(MaximaStream & os) const
{
if ( symbol_ == "int" )
os << "integrate(";
os << cell(1) << ')';
}
-void MathExIntInset::mathematica(MathematicaStream & os) const
+void InsetMathExInt::mathematica(MathematicaStream & os) const
{
if ( symbol_ == "int" )
os << "Integrate[";
}
-void MathExIntInset::mathmlize(MathMLStream & os) const
+void InsetMathExInt::mathmlize(MathMLStream & os) const
{
- boost::scoped_ptr<MathSymbolInset> sym(new MathSymbolInset(symbol_));
+ boost::scoped_ptr<InsetMathSymbol> sym(new InsetMathSymbol(symbol_));
//if (hasScripts())
// mathmlize(sym, os);
//else
}
-void MathExIntInset::write(WriteStream &) const
+void InsetMathExInt::write(WriteStream &) const
{
lyxerr << "should not happen" << endl;
}
// cell(0) is stuff before the 'd', cell(1) the stuff after
-class MathExIntInset : public MathNestInset {
+class InsetMathExInt : public InsetMathNest {
public:
///
- explicit MathExIntInset(std::string const & name_);
+ explicit InsetMathExInt(std::string const & name_);
///
void symbol(std::string const &);
///
if (!ar[i]->asCharInset())
continue;
string s = charSequence(ar.begin() + i, ar.end());
- ar[i] = MathAtom(new MathStringInset(s));
+ ar[i] = MathAtom(new InsetMathString(s));
ar.erase(i + 1, i + s.size());
}
//lyxerr << "\nStrings to: " << ar << endl;
continue;
if (!arr.front()->asGridInset())
continue;
- ar[i] = MathAtom(new MathMatrixInset(*(arr.front()->asGridInset())));
+ ar[i] = MathAtom(new InsetMathMatrix(*(arr.front()->asGridInset())));
}
// second pass for AMS "pmatrix" etc
for (size_t i = 0; i < ar.size(); ++i)
if (ar[i]->asAMSArrayInset())
- ar[i] = MathAtom(new MathMatrixInset(*(ar[i]->asGridInset())));
+ ar[i] = MathAtom(new InsetMathMatrix(*(ar[i]->asGridInset())));
//lyxerr << "\nMatrices to: " << ar << endl;
}
{
//lyxerr << "\nScripts from: " << ar << endl;
for (size_t i = 0; i < ar.size(); ++i) {
- MathScriptInset const * script = ar[i]->asScriptInset();
+ InsetMathScript const * script = ar[i]->asScriptInset();
// is this a script inset and do we also have a superscript?
if (!script || !script->hasUp())
if (script->nuc().size() == 1) {
// leave alone sums and integrals
- MathSymbolInset const * sym =
+ InsetMathSymbol const * sym =
script->nuc().front()->asSymbolInset();
if (sym && (sym->name() == "sum" || sym->name() == "int"))
continue;
}
// create extra script inset and move superscript over
- MathScriptInset * p = ar[i].nucleus()->asScriptInset();
- auto_ptr<MathScriptInset> q(new MathScriptInset(true));
+ InsetMathScript * p = ar[i].nucleus()->asScriptInset();
+ auto_ptr<InsetMathScript> q(new InsetMathScript(true));
swap(q->up(), p->up());
p->removeScript(true);
continue;
// we need an exponent but no subscript
- MathScriptInset const * sup = ar[i + 1]->asScriptInset();
+ InsetMathScript const * sup = ar[i + 1]->asScriptInset();
if (!sup || sup->hasDown())
continue;
// create a proper exp-inset as replacement
- ar[i] = MathAtom(new MathExFuncInset("exp", sup->cell(1)));
+ ar[i] = MathAtom(new InsetMathExFunc("exp", sup->cell(1)));
ar.erase(i + 1);
}
//lyxerr << "\nExps to: " << ar << endl;
{
//lyxerr << "\ndet from: " << ar << endl;
for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
- MathDelimInset const * del = (*it)->asDelimInset();
+ InsetMathDelim const * del = (*it)->asDelimInset();
if (!del)
continue;
if (!del->isAbs())
continue;
- *it = MathAtom(new MathExFuncInset("det", del->cell(0)));
+ *it = MathAtom(new InsetMathExFunc("det", del->cell(0)));
}
//lyxerr << "\ndet to: " << ar << endl;
}
string s = digitSequence(ar.begin() + i, ar.end());
- ar[i] = MathAtom(new MathNumberInset(s));
+ ar[i] = MathAtom(new InsetMathNumber(s));
ar.erase(i + 1, i + s.size());
}
//lyxerr << "\nNumbers to: " << ar << endl;
MathAtom replaceParenDelims(const MathArray & ar)
{
- return MathAtom(new MathDelimInset("(", ")", ar));
+ return MathAtom(new InsetMathDelim("(", ")", ar));
}
MathAtom replaceBracketDelims(const MathArray & ar)
{
- return MathAtom(new MathDelimInset("[", "]", ar));
+ return MathAtom(new InsetMathDelim("[", "]", ar));
}
-// replace '('...')' and '['...']' sequences by a real MathDelimInset
+// replace '('...')' and '['...']' sequences by a real InsetMathDelim
void extractDelims(MathArray & ar)
{
//lyxerr << "\nDelims from: " << ar << endl;
//
-// replace 'f' '(...)' and 'f' '^n' '(...)' sequences by a real MathExFuncInset
+// replace 'f' '(...)' and 'f' '^n' '(...)' sequences by a real InsetMathExFunc
// assume 'extractDelims' ran before
void extractFunctions(MathArray & ar)
{
continue;
// guess so, if this is followed by
// a DelimInset with a single item in the cell
- MathDelimInset const * del = (*jt)->asDelimInset();
+ InsetMathDelim const * del = (*jt)->asDelimInset();
if (!del || del->cell(0).size() != 1)
continue;
// fall trough into main branch
extractScript(exp, jt, ar.end(), true);
// create a proper inset as replacement
- auto_ptr<MathExFuncInset> p(new MathExFuncInset(name));
+ auto_ptr<InsetMathExFunc> p(new InsetMathExFunc(name));
// jt points to the "argument". Get hold of this.
MathArray::iterator st = extractArgument(p->cell(0), jt, ar.end(), true);
}
-// replace '\int' ['_^'] x 'd''x'(...)' sequences by a real MathExIntInset
+// replace '\int' ['_^'] x 'd''x'(...)' sequences by a real InsetMathExInt
// assume 'extractDelims' ran before
void extractIntegrals(MathArray & ar)
{
continue;
// core ist part from behind the scripts to the 'd'
- auto_ptr<MathExIntInset> p(new MathExIntInset("int"));
+ auto_ptr<InsetMathExInt> p(new InsetMathExInt("int"));
// handle scripts if available
if (!testIntSymbol(*it)) {
}
-// replace '\sum' ['_^'] f(x) sequences by a real MathExIntInset
+// replace '\sum' ['_^'] f(x) sequences by a real InsetMathExInt
// assume 'extractDelims' ran before
void extractSums(MathArray & ar)
{
continue;
// create a proper inset as replacement
- auto_ptr<MathExIntInset> p(new MathExIntInset("sum"));
+ auto_ptr<InsetMathExInt> p(new InsetMathExInt("sum"));
// collect lower bound and summation index
- MathScriptInset const * sub = ar[i]->asScriptInset();
+ InsetMathScript const * sub = ar[i]->asScriptInset();
if (sub && sub->hasDown()) {
// try to figure out the summation index from the subscript
MathArray const & ar = sub->down();
return true;
// we may have d^n .../d and splitScripts() has not yet seen it
- MathScriptInset const * sup = at->asScriptInset();
+ InsetMathScript const * sup = at->asScriptInset();
if (sup && !sup->hasDown() && sup->hasUp() && sup->nuc().size() == 1) {
MathAtom const & ma = sup->nuc().front();
return testString(ma, "d") || testSymbol(ma, "partial");
if (!testDiffFrac(*it))
continue;
- MathFracInset const * f = (*it)->asFracInset();
+ InsetMathFrac const * f = (*it)->asFracInset();
if (!f) {
lyxerr << "should not happen" << endl;
continue;
}
// create a proper diff inset
- auto_ptr<MathDiffInset> diff(new MathDiffInset);
+ auto_ptr<InsetMathDiff> diff(new InsetMathDiff);
// collect function, let jt point behind last used item
MathArray::iterator jt = it + 1;
// point before this
MathArray::iterator st = et - 1;
- MathScriptInset const * script = (*st)->asScriptInset();
+ InsetMathScript const * script = (*st)->asScriptInset();
if (script && script->hasUp()) {
// things like d.../dx^n
int mult = 1;
-// replace '\lim_{x->x0} f(x)' sequences by a real MathLimInset
+// replace '\lim_{x->x0} f(x)' sequences by a real InsetMathLim
// assume 'extractDelims' ran before
void extractLims(MathArray & ar)
{
MathArray::iterator it = ar.begin() + i;
// must be a script inset with a subscript (without superscript)
- MathScriptInset const * sub = (*it)->asScriptInset();
+ InsetMathScript const * sub = (*it)->asScriptInset();
if (!sub || !sub->hasDown() || sub->hasUp() || sub->nuc().size() != 1)
continue;
ar.erase(it + 1, tt);
// create a proper inset as replacement
- *it = MathAtom(new MathLimInset(f, x, x0));
+ *it = MathAtom(new InsetMathLim(f, x, x0));
}
//lyxerr << "\nLimits to: " << ar << endl;
}
out = out.substr(6);
// parse output as matrix or single number
- MathAtom at(new MathArrayInset("array", out));
- MathArrayInset const * mat = at->asArrayInset();
+ MathAtom at(new InsetMathArray("array", out));
+ InsetMathArray const * mat = at->asArrayInset();
MathArray res;
if (mat->ncols() == 1 && mat->nrows() == 1)
res.append(mat->cell(0));
else {
- res.push_back(MathAtom(new MathDelimInset("(", ")")));
+ res.push_back(MathAtom(new InsetMathDelim("(", ")")));
res.back().nucleus()->cell(0).push_back(at);
}
return res;
}
-MathAtom createMathInset(string const & s)
+MathAtom createInsetMath(string const & s)
{
//lyxerr << "creating inset with name: '" << s << '\'' << endl;
latexkeys const * l = in_word_set(s);
if (inset == "ref")
return MathAtom(new RefInset(l->name));
if (inset == "overset")
- return MathAtom(new MathOversetInset);
+ return MathAtom(new InsetMathOverset);
if (inset == "underset")
- return MathAtom(new MathUndersetInset);
+ return MathAtom(new InsetMathUnderset);
if (inset == "decoration")
- return MathAtom(new MathDecorationInset(l));
+ return MathAtom(new InsetMathDecoration(l));
if (inset == "space")
- return MathAtom(new MathSpaceInset(l->name));
+ return MathAtom(new InsetMathSpace(l->name));
if (inset == "dots")
- return MathAtom(new MathDotsInset(l));
+ return MathAtom(new InsetMathDots(l));
if (inset == "mbox")
- // return MathAtom(new MathMBoxInset);
- // MathMBoxInset is proposed to replace MathBoxInset,
+ // return MathAtom(new InsetMathMBox);
+ // InsetMathMBox is proposed to replace InsetMathBox,
// but is not ready yet (it needs a BufferView for
// construction)
- return MathAtom(new MathBoxInset(l->name));
+ return MathAtom(new InsetMathBox(l->name));
// if (inset == "fbox")
-// return MathAtom(new MathFboxInset(l));
+// return MathAtom(new InsetMathFBox(l));
if (inset == "style")
- return MathAtom(new MathSizeInset(l));
+ return MathAtom(new InsetMathSize(l));
if (inset == "font")
- return MathAtom(new MathFontInset(l));
+ return MathAtom(new InsetMathFont(l));
if (inset == "oldfont")
- return MathAtom(new MathFontOldInset(l));
+ return MathAtom(new InsetMathFontOld(l));
if (inset == "matrix")
- return MathAtom(new MathAMSArrayInset(s));
+ return MathAtom(new InsetMathAMSArray(s));
if (inset == "big")
- // we can't create a MathBigInset, since the argument
+ // we can't create a InsetMathBig, since the argument
// is missing.
- return MathAtom(new MathUnknownInset(s));
- return MathAtom(new MathSymbolInset(l));
+ return MathAtom(new InsetMathUnknown(s));
+ return MathAtom(new InsetMathSymbol(l));
}
if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
&& s[2] >= '1' && s[2] <= '9')
return MathAtom(new MathMacroArgument(s[2] - '0'));
if (s == "boxed")
- return MathAtom(new MathBoxedInset());
+ return MathAtom(new InsetMathBoxed());
if (s == "fbox")
- return MathAtom(new MathFboxInset());
+ return MathAtom(new InsetMathFBox());
if (s == "framebox")
- return MathAtom(new MathFrameboxInset);
+ return MathAtom(new InsetMathFrameBox);
if (s == "makebox")
- return MathAtom(new MathMakeboxInset);
+ return MathAtom(new InsetMathMakebox);
if (s == "kern")
- return MathAtom(new MathKernInset);
+ return MathAtom(new InsetMathKern);
if (s == "xymatrix")
- return MathAtom(new MathXYMatrixInset);
+ return MathAtom(new InsetMathXYMatrix);
if (s == "xrightarrow" || s == "xleftarrow")
- return MathAtom(new MathXArrowInset(s));
+ return MathAtom(new InsetMathXArrow(s));
if (s == "split" || s == "gathered" || s == "aligned" || s == "alignedat")
- return MathAtom(new MathSplitInset(s));
+ return MathAtom(new InsetMathSplit(s));
if (s == "cases")
- return MathAtom(new MathCasesInset);
+ return MathAtom(new InsetMathCases);
if (s == "substack")
- return MathAtom(new MathSubstackInset);
+ return MathAtom(new InsetMathSubstack);
if (s == "subarray" || s == "array")
- return MathAtom(new MathArrayInset(s, 1, 1));
+ return MathAtom(new InsetMathArray(s, 1, 1));
if (s == "sqrt")
- return MathAtom(new MathSqrtInset);
+ return MathAtom(new InsetMathSqrt);
if (s == "root")
- return MathAtom(new MathRootInset);
+ return MathAtom(new InsetMathRoot);
if (s == "tabular")
- return MathAtom(new MathTabularInset(s, 1, 1));
+ return MathAtom(new InsetMathTabular(s, 1, 1));
if (s == "stackrel")
- return MathAtom(new MathStackrelInset);
+ return MathAtom(new InsetMathStackrel);
if (s == "binom" || s == "choose")
- return MathAtom(new MathBinomInset(s == "choose"));
+ return MathAtom(new InsetMathBinom(s == "choose"));
if (s == "frac")
- return MathAtom(new MathFracInset);
+ return MathAtom(new InsetMathFrac);
if (s == "over")
- return MathAtom(new MathFracInset(MathFracInset::OVER));
+ return MathAtom(new InsetMathFrac(InsetMathFrac::OVER));
if (s == "nicefrac")
- return MathAtom(new MathFracInset(MathFracInset::NICEFRAC));
+ return MathAtom(new InsetMathFrac(InsetMathFrac::NICEFRAC));
//if (s == "infer")
// return MathAtom(new MathInferInset);
if (s == "atop")
- return MathAtom(new MathFracInset(MathFracInset::ATOP));
+ return MathAtom(new InsetMathFrac(InsetMathFrac::ATOP));
if (s == "lefteqn")
- return MathAtom(new MathLefteqnInset);
+ return MathAtom(new InsetMathLefteqn);
if (s == "boldsymbol")
- return MathAtom(new MathBoldsymbolInset);
+ return MathAtom(new InsetMathBoldSymbol);
if (s == "color" || s == "normalcolor")
- return MathAtom(new MathColorInset(true));
+ return MathAtom(new InsetMathColor(true));
if (s == "textcolor")
- return MathAtom(new MathColorInset(false));
+ return MathAtom(new InsetMathColor(false));
if (s == "dfrac")
- return MathAtom(new MathDfracInset);
+ return MathAtom(new InsetMathDFrac);
if (s == "tfrac")
- return MathAtom(new MathTfracInset);
+ return MathAtom(new InsetMathTFrac);
if (s == "hphantom")
- return MathAtom(new MathPhantomInset(MathPhantomInset::hphantom));
+ return MathAtom(new InsetMathPhantom(InsetMathPhantom::hphantom));
if (s == "phantom")
- return MathAtom(new MathPhantomInset(MathPhantomInset::phantom));
+ return MathAtom(new InsetMathPhantom(InsetMathPhantom::phantom));
if (s == "vphantom")
- return MathAtom(new MathPhantomInset(MathPhantomInset::vphantom));
+ return MathAtom(new InsetMathPhantom(InsetMathPhantom::vphantom));
if (MacroTable::globalMacros().has(s))
return MathAtom(new MathMacro(s,
// MacroTable::localMacros().get(s).numargs()));
//lyxerr << "creating unknown inset '" << s << "'" << endl;
- return MathAtom(new MathUnknownInset(s));
+ return MathAtom(new InsetMathUnknown(s));
}
-bool createMathInset_fromDialogStr(string const & str, MathArray & ar)
+bool createInsetMath_fromDialogStr(string const & str, MathArray & ar)
{
// An example str:
// "ref LatexCommand \\ref{sec:Title}\n\\end_inset\n\n";
class MathArray;
-MathAtom createMathInset(std::string const &);
+MathAtom createInsetMath(std::string const &);
/** Fills ar with the contents of str.
* str is created by the frontend dialog's and returned to the LyX core.
* The function returns true if successful.
*/
-bool createMathInset_fromDialogStr(std::string const &, MathArray &);
+bool createInsetMath_fromDialogStr(std::string const &, MathArray &);
#endif
using std::auto_ptr;
-MathFboxInset::MathFboxInset()
- : MathNestInset(1)
+InsetMathFBox::InsetMathFBox()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathFboxInset::doClone() const
+auto_ptr<InsetBase> InsetMathFBox::doClone() const
{
- return auto_ptr<InsetBase>(new MathFboxInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathFBox(*this));
}
-MathInset::mode_type MathFboxInset::currentMode() const
+InsetMath::mode_type InsetMathFBox::currentMode() const
{
return TEXT_MODE;
}
-void MathFboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathFBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
cell(0).metrics(mi, dim);
}
-void MathFboxInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathFBox::draw(PainterInfo & pi, int x, int y) const
{
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
dim_.width() - 2, dim_.height() - 2, LColor::foreground);
}
-void MathFboxInset::write(WriteStream & os) const
+void InsetMathFBox::write(WriteStream & os) const
{
os << "\\fbox{" << cell(0) << '}';
}
-void MathFboxInset::normalize(NormalStream & os) const
+void InsetMathFBox::normalize(NormalStream & os) const
{
os << "[fbox " << cell(0) << ']';
}
-void MathFboxInset::infoize(std::ostream & os) const
+void InsetMathFBox::infoize(std::ostream & os) const
{
os << "FBox: ";
}
/// Non-AMS-style frame
-class MathFboxInset : public MathNestInset {
+class InsetMathFBox : public InsetMathNest {
public:
///
- MathFboxInset();
+ InsetMathFBox();
///
mode_type currentMode() const;
///
using std::auto_ptr;
-MathFontInset::MathFontInset(latexkeys const * key)
- : MathNestInset(1), key_(key)
+InsetMathFont::InsetMathFont(latexkeys const * key)
+ : InsetMathNest(1), key_(key)
{}
-auto_ptr<InsetBase> MathFontInset::doClone() const
+auto_ptr<InsetBase> InsetMathFont::doClone() const
{
- return auto_ptr<InsetBase>(new MathFontInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathFont(*this));
}
-MathInset::mode_type MathFontInset::currentMode() const
+InsetMath::mode_type InsetMathFont::currentMode() const
{
if (key_->extra == "mathmode")
return MATH_MODE;
}
-void MathFontInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathFont::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, key_->name.c_str());
cell(0).metrics(mi, dim);
}
-void MathFontInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathFont::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, key_->name.c_str());
cell(0).draw(pi, x + 1, y);
}
-void MathFontInset::metricsT(TextMetricsInfo const & mi, Dimension &) const
+void InsetMathFont::metricsT(TextMetricsInfo const & mi, Dimension &) const
{
cell(0).metricsT(mi, dim_);
}
-void MathFontInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathFont::drawT(TextPainter & pain, int x, int y) const
{
cell(0).drawT(pain, x, y);
}
-string MathFontInset::name() const
+string InsetMathFont::name() const
{
return key_->name;
}
-void MathFontInset::validate(LaTeXFeatures & features) const
+void InsetMathFont::validate(LaTeXFeatures & features) const
{
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
// Make sure amssymb is put in preamble if Blackboard Bold or
// Fraktur used:
if (key_->name == "mathfrak" || key_->name == "mathbb")
}
-void MathFontInset::infoize(std::ostream & os) const
+void InsetMathFont::infoize(std::ostream & os) const
{
os << "Font: " << key_->name;
}
class latexkeys;
/// Inset for font changes
-class MathFontInset : public MathNestInset {
+class InsetMathFont : public InsetMathNest {
public:
///
- explicit MathFontInset(latexkeys const * key);
+ explicit InsetMathFont(latexkeys const * key);
///
- MathFontInset * asFontInset() { return this; }
+ InsetMathFont * asFontInset() { return this; }
///
- MathFontInset const * asFontInset() const { return this; }
+ InsetMathFont const * asFontInset() const { return this; }
/// are we in math mode, text mode, or unsure?
mode_type currentMode() const;
///
using std::auto_ptr;
-MathFontOldInset::MathFontOldInset(latexkeys const * key)
- : MathNestInset(1), key_(key)
+InsetMathFontOld::InsetMathFontOld(latexkeys const * key)
+ : InsetMathNest(1), key_(key)
{
//lock(true);
}
-auto_ptr<InsetBase> MathFontOldInset::doClone() const
+auto_ptr<InsetBase> InsetMathFontOld::doClone() const
{
- return auto_ptr<InsetBase>(new MathFontOldInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathFontOld(*this));
}
-void MathFontOldInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathFontOld::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, key_->name.c_str());
cell(0).metrics(mi, dim);
}
-void MathFontOldInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathFontOld::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, key_->name.c_str());
cell(0).draw(pi, x + 1, y);
}
-void MathFontOldInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathFontOld::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
cell(0).metricsT(mi, dim);
}
-void MathFontOldInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathFontOld::drawT(TextPainter & pain, int x, int y) const
{
cell(0).drawT(pain, x, y);
}
-void MathFontOldInset::write(WriteStream & os) const
+void InsetMathFontOld::write(WriteStream & os) const
{
os << "{\\" << key_->name << ' ' << cell(0) << '}';
}
-void MathFontOldInset::normalize(NormalStream & os) const
+void InsetMathFontOld::normalize(NormalStream & os) const
{
os << "[font " << key_->name << ' ' << cell(0) << ']';
}
-void MathFontOldInset::infoize(std::ostream & os) const
+void InsetMathFontOld::infoize(std::ostream & os) const
{
os << "Font: " << key_->name;
}
class latexkeys;
/// Old-style font changes
-class MathFontOldInset : public MathNestInset {
+class InsetMathFontOld : public InsetMathNest {
public:
///
- explicit MathFontOldInset(latexkeys const * key);
+ explicit InsetMathFontOld(latexkeys const * key);
/// we are in text mode.
mode_type currentMode() const { return TEXT_MODE; }
/// we write extra braces in any case...
#include "cursor.h"
-MathFracbaseInset::MathFracbaseInset()
- : MathNestInset(2)
+InsetMathFracBase::InsetMathFracBase()
+ : InsetMathNest(2)
{}
-bool MathFracbaseInset::idxRight(LCursor &) const
+bool InsetMathFracBase::idxRight(LCursor &) const
{
return false;
}
-bool MathFracbaseInset::idxLeft(LCursor &) const
+bool InsetMathFracBase::idxLeft(LCursor &) const
{
return false;
}
-bool MathFracbaseInset::idxUpDown(LCursor & cur, bool up) const
+bool InsetMathFracBase::idxUpDown(LCursor & cur, bool up) const
{
- MathInset::idx_type target = !up; // up ? 0 : 1, since upper cell has idx 0
+ InsetMath::idx_type target = !up; // up ? 0 : 1, since upper cell has idx 0
if (cur.idx() == target)
return false;
cur.idx() = target;
#include "math_nestinset.h"
-class MathFracbaseInset : public MathNestInset {
+class InsetMathFracBase : public InsetMathNest {
public:
///
- MathFracbaseInset();
+ InsetMathFracBase();
///
bool idxUpDown(LCursor &, bool up) const;
///
using std::auto_ptr;
-MathFracInset::MathFracInset(Kind kind)
+InsetMathFrac::InsetMathFrac(Kind kind)
: kind_(kind)
{}
-auto_ptr<InsetBase> MathFracInset::doClone() const
+auto_ptr<InsetBase> InsetMathFrac::doClone() const
{
- return auto_ptr<InsetBase>(new MathFracInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathFrac(*this));
}
-MathFracInset * MathFracInset::asFracInset()
+InsetMathFrac * InsetMathFrac::asFracInset()
{
return kind_ == ATOP ? 0 : this;
}
-MathFracInset const * MathFracInset::asFracInset() const
+InsetMathFrac const * InsetMathFrac::asFracInset() const
{
return kind_ == ATOP ? 0 : this;
}
-void MathFracInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
FracChanger dummy(mi.base);
cell(0).metrics(mi);
}
-void MathFracInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathFrac::draw(PainterInfo & pi, int x, int y) const
{
setPosCache(pi, x, y);
int m = x + dim_.wid / 2;
}
-void MathFracInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathFrac::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
cell(0).metricsT(mi, dim);
cell(1).metricsT(mi, dim);
}
-void MathFracInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathFrac::drawT(TextPainter & pain, int x, int y) const
{
int m = x + dim_.width() / 2;
cell(0).drawT(pain, m - cell(0).width() / 2, y - cell(0).descent() - 1);
}
-void MathFracInset::write(WriteStream & os) const
+void InsetMathFrac::write(WriteStream & os) const
{
switch (kind_) {
case ATOP:
break;
case FRAC:
case NICEFRAC:
- MathNestInset::write(os);
+ InsetMathNest::write(os);
break;
}
}
-string MathFracInset::name() const
+string InsetMathFrac::name() const
{
switch (kind_) {
case FRAC:
}
-bool MathFracInset::extraBraces() const
+bool InsetMathFrac::extraBraces() const
{
return kind_ == ATOP || kind_ == OVER;
}
-void MathFracInset::maple(MapleStream & os) const
+void InsetMathFrac::maple(MapleStream & os) const
{
os << '(' << cell(0) << ")/(" << cell(1) << ')';
}
-void MathFracInset::mathematica(MathematicaStream & os) const
+void InsetMathFrac::mathematica(MathematicaStream & os) const
{
os << '(' << cell(0) << ")/(" << cell(1) << ')';
}
-void MathFracInset::octave(OctaveStream & os) const
+void InsetMathFrac::octave(OctaveStream & os) const
{
os << '(' << cell(0) << ")/(" << cell(1) << ')';
}
-void MathFracInset::mathmlize(MathMLStream & os) const
+void InsetMathFrac::mathmlize(MathMLStream & os) const
{
os << MTag("mfrac") << cell(0) << cell(1) << ETag("mfrac");
}
-void MathFracInset::validate(LaTeXFeatures & features) const
+void InsetMathFrac::validate(LaTeXFeatures & features) const
{
if (kind_ == NICEFRAC)
features.require("nicefrac");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
/// Fraction like objects (frac, binom)
-class MathFracInset : public MathFracbaseInset {
+class InsetMathFrac : public InsetMathFracBase {
public:
///
enum Kind {
};
///
- explicit MathFracInset(Kind kind = FRAC);
+ explicit InsetMathFrac(Kind kind = FRAC);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
///
void drawT(TextPainter &, int x, int y) const;
/// identifies FracInsets
- MathFracInset * asFracInset();
+ InsetMathFrac * asFracInset();
/// identifies FracInsets
- MathFracInset const * asFracInset() const;
+ InsetMathFrac const * asFracInset() const;
///
std::string name() const;
///
using std::auto_ptr;
-MathFrameboxInset::MathFrameboxInset()
- : MathNestInset(3)
+InsetMathFrameBox::InsetMathFrameBox()
+ : InsetMathNest(3)
{}
-auto_ptr<InsetBase> MathFrameboxInset::doClone() const
+auto_ptr<InsetBase> InsetMathFrameBox::doClone() const
{
- return auto_ptr<InsetBase>(new MathFrameboxInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathFrameBox(*this));
}
-void MathFrameboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathFrameBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
w_ = mathed_char_width(mi.base.font, '[');
- MathNestInset::metrics(mi);
+ InsetMathNest::metrics(mi);
dim = cell(0).dim();
dim += cell(1).dim();
dim += cell(2).dim();
}
-void MathFrameboxInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathFrameBox::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, "textnormal");
pi.pain.rectangle(x + 1, y - dim_.ascent() + 1,
}
-void MathFrameboxInset::write(WriteStream & os) const
+void InsetMathFrameBox::write(WriteStream & os) const
{
os << "\\framebox";
os << '[' << cell(0) << ']';
}
-void MathFrameboxInset::normalize(NormalStream & os) const
+void InsetMathFrameBox::normalize(NormalStream & os) const
{
os << "[framebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
}
/// Extra nesting
-class MathFrameboxInset : public MathNestInset {
+class InsetMathFrameBox : public InsetMathNest {
public:
///
- MathFrameboxInset();
+ InsetMathFrameBox();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
class GridInsetMailer : public MailInset {
public:
- GridInsetMailer(MathGridInset & inset) : inset_(inset) {}
+ GridInsetMailer(InsetMathGrid & inset) : inset_(inset) {}
///
virtual string const & name() const
{
protected:
InsetBase & inset() const { return inset_; }
- MathGridInset & inset_;
+ InsetMathGrid & inset_;
};
-void mathed_parse_normal(MathGridInset &, string const & argument);
+void mathed_parse_normal(InsetMathGrid &, string const & argument);
namespace {
//////////////////////////////////////////////////////////////
-MathGridInset::CellInfo::CellInfo()
+InsetMathGrid::CellInfo::CellInfo()
: dummy_(false)
{}
//////////////////////////////////////////////////////////////
-MathGridInset::RowInfo::RowInfo()
+InsetMathGrid::RowInfo::RowInfo()
: lines_(0), skip_(0)
{}
-int MathGridInset::RowInfo::skipPixels() const
+int InsetMathGrid::RowInfo::skipPixels() const
{
return crskip_.inBP();
}
//////////////////////////////////////////////////////////////
-MathGridInset::ColInfo::ColInfo()
+InsetMathGrid::ColInfo::ColInfo()
: align_('c'), lines_(0)
{}
//////////////////////////////////////////////////////////////
-MathGridInset::MathGridInset(char v, string const & h)
- : MathNestInset(guessColumns(h)),
+InsetMathGrid::InsetMathGrid(char v, string const & h)
+ : InsetMathNest(guessColumns(h)),
rowinfo_(2),
colinfo_(guessColumns(h) + 1),
cellinfo_(1 * guessColumns(h))
}
-MathGridInset::MathGridInset()
- : MathNestInset(1),
+InsetMathGrid::InsetMathGrid()
+ : InsetMathNest(1),
rowinfo_(1 + 1),
colinfo_(1 + 1),
cellinfo_(1),
}
-MathGridInset::MathGridInset(col_type m, row_type n)
- : MathNestInset(m * n),
+InsetMathGrid::InsetMathGrid(col_type m, row_type n)
+ : InsetMathNest(m * n),
rowinfo_(n + 1),
colinfo_(m + 1),
cellinfo_(m * n),
}
-MathGridInset::MathGridInset(col_type m, row_type n, char v, string const & h)
- : MathNestInset(m * n),
+InsetMathGrid::InsetMathGrid(col_type m, row_type n, char v, string const & h)
+ : InsetMathNest(m * n),
rowinfo_(n + 1),
colinfo_(m + 1),
cellinfo_(m * n),
}
-MathGridInset::~MathGridInset()
+InsetMathGrid::~InsetMathGrid()
{
GridInsetMailer mailer(*this);
mailer.hideDialog();
}
-auto_ptr<InsetBase> MathGridInset::doClone() const
+auto_ptr<InsetBase> InsetMathGrid::doClone() const
{
- return auto_ptr<InsetBase>(new MathGridInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathGrid(*this));
}
-MathInset::idx_type MathGridInset::index(row_type row, col_type col) const
+InsetMath::idx_type InsetMathGrid::index(row_type row, col_type col) const
{
return col + ncols() * row;
}
-void MathGridInset::setDefaults()
+void InsetMathGrid::setDefaults()
{
if (ncols() <= 0)
lyxerr << "positive number of columns expected" << endl;
}
-void MathGridInset::halign(string const & hh)
+void InsetMathGrid::halign(string const & hh)
{
col_type col = 0;
for (string::const_iterator it = hh.begin(); it != hh.end(); ++it) {
}
-MathGridInset::col_type MathGridInset::guessColumns(string const & hh) const
+InsetMathGrid::col_type InsetMathGrid::guessColumns(string const & hh) const
{
col_type col = 0;
for (string::const_iterator it = hh.begin(); it != hh.end(); ++it)
}
-void MathGridInset::halign(char h, col_type col)
+void InsetMathGrid::halign(char h, col_type col)
{
colinfo_[col].align_ = h;
}
-char MathGridInset::halign(col_type col) const
+char InsetMathGrid::halign(col_type col) const
{
return colinfo_[col].align_;
}
-string MathGridInset::halign() const
+string InsetMathGrid::halign() const
{
string res;
for (col_type col = 0; col < ncols(); ++col) {
}
-void MathGridInset::valign(char c)
+void InsetMathGrid::valign(char c)
{
v_align_ = c;
}
-char MathGridInset::valign() const
+char InsetMathGrid::valign() const
{
return v_align_;
}
-MathGridInset::col_type MathGridInset::ncols() const
+InsetMathGrid::col_type InsetMathGrid::ncols() const
{
return colinfo_.size() - 1;
}
-MathGridInset::row_type MathGridInset::nrows() const
+InsetMathGrid::row_type InsetMathGrid::nrows() const
{
return rowinfo_.size() - 1;
}
-MathGridInset::col_type MathGridInset::col(idx_type idx) const
+InsetMathGrid::col_type InsetMathGrid::col(idx_type idx) const
{
return idx % ncols();
}
-MathGridInset::row_type MathGridInset::row(idx_type idx) const
+InsetMathGrid::row_type InsetMathGrid::row(idx_type idx) const
{
return idx / ncols();
}
-void MathGridInset::vcrskip(LyXLength const & crskip, row_type row)
+void InsetMathGrid::vcrskip(LyXLength const & crskip, row_type row)
{
rowinfo_[row].crskip_ = crskip;
}
-LyXLength MathGridInset::vcrskip(row_type row) const
+LyXLength InsetMathGrid::vcrskip(row_type row) const
{
return rowinfo_[row].crskip_;
}
-void MathGridInset::metrics(MetricsInfo & mi) const
+void InsetMathGrid::metrics(MetricsInfo & mi) const
{
// let the cells adjust themselves
- MathNestInset::metrics(mi);
+ InsetMathNest::metrics(mi);
// compute absolute sizes of vertical structure
for (row_type row = 0; row < nrows(); ++row) {
}
-void MathGridInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathGrid::metrics(MetricsInfo & mi, Dimension & dim) const
{
metrics(mi);
dim = dim_;
}
-void MathGridInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathGrid::draw(PainterInfo & pi, int x, int y) const
{
drawWithMargin(pi, x, y, 0, 0);
}
-void MathGridInset::drawWithMargin(PainterInfo & pi, int x, int y,
+void InsetMathGrid::drawWithMargin(PainterInfo & pi, int x, int y,
int lmargin, int rmargin) const
{
for (idx_type idx = 0; idx < nargs(); ++idx)
}
-void MathGridInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathGrid::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
// let the cells adjust themselves
- //MathNestInset::metrics(mi);
+ //InsetMathNest::metrics(mi);
for (idx_type i = 0; i < nargs(); ++i)
cell(i).metricsT(mi, dim);
}
-void MathGridInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathGrid::drawT(TextPainter & pain, int x, int y) const
{
for (idx_type idx = 0; idx < nargs(); ++idx)
cell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
}
-string MathGridInset::eolString(row_type row, bool emptyline, bool fragile) const
+string InsetMathGrid::eolString(row_type row, bool emptyline, bool fragile) const
{
string eol;
}
-string MathGridInset::eocString(col_type col, col_type lastcol) const
+string InsetMathGrid::eocString(col_type col, col_type lastcol) const
{
if (col + 1 == lastcol)
return string();
}
-void MathGridInset::addRow(row_type row)
+void InsetMathGrid::addRow(row_type row)
{
rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
cells_.insert
}
-void MathGridInset::appendRow()
+void InsetMathGrid::appendRow()
{
rowinfo_.push_back(RowInfo());
//cells_.insert(cells_.end(), ncols(), MathArray());
}
-void MathGridInset::delRow(row_type row)
+void InsetMathGrid::delRow(row_type row)
{
if (nrows() == 1)
return;
}
-void MathGridInset::copyRow(row_type row)
+void InsetMathGrid::copyRow(row_type row)
{
addRow(row);
for (col_type col = 0; col < ncols(); ++col)
}
-void MathGridInset::swapRow(row_type row)
+void InsetMathGrid::swapRow(row_type row)
{
if (nrows() == 1)
return;
}
-void MathGridInset::addCol(col_type newcol)
+void InsetMathGrid::addCol(col_type newcol)
{
const col_type nc = ncols();
const row_type nr = nrows();
}
-void MathGridInset::delCol(col_type col)
+void InsetMathGrid::delCol(col_type col)
{
if (ncols() == 1)
return;
}
-void MathGridInset::copyCol(col_type col)
+void InsetMathGrid::copyCol(col_type col)
{
addCol(col);
for (row_type row = 0; row < nrows(); ++row)
}
-void MathGridInset::swapCol(col_type col)
+void InsetMathGrid::swapCol(col_type col)
{
if (ncols() == 1)
return;
}
-int MathGridInset::cellXOffset(idx_type idx) const
+int InsetMathGrid::cellXOffset(idx_type idx) const
{
col_type c = col(idx);
int x = colinfo_[c].offset_;
}
-int MathGridInset::cellYOffset(idx_type idx) const
+int InsetMathGrid::cellYOffset(idx_type idx) const
{
return rowinfo_[row(idx)].offset_;
}
-bool MathGridInset::idxUpDown(LCursor & cur, bool up) const
+bool InsetMathGrid::idxUpDown(LCursor & cur, bool up) const
{
if (up) {
if (cur.row() == 0)
}
-bool MathGridInset::idxLeft(LCursor & cur) const
+bool InsetMathGrid::idxLeft(LCursor & cur) const
{
// leave matrix if on the left hand edge
if (cur.col() == 0)
}
-bool MathGridInset::idxRight(LCursor & cur) const
+bool InsetMathGrid::idxRight(LCursor & cur) const
{
// leave matrix if on the right hand edge
if (cur.col() + 1 == ncols())
}
-bool MathGridInset::idxFirst(LCursor & cur) const
+bool InsetMathGrid::idxFirst(LCursor & cur) const
{
switch (v_align_) {
case 't':
}
-bool MathGridInset::idxLast(LCursor & cur) const
+bool InsetMathGrid::idxLast(LCursor & cur) const
{
switch (v_align_) {
case 't':
}
-bool MathGridInset::idxDelete(idx_type & idx)
+bool InsetMathGrid::idxDelete(idx_type & idx)
{
// nothing to do if we have just one row
if (nrows() == 1)
// reimplement old behaviour when pressing Delete in the last position
// of a cell
-void MathGridInset::idxGlue(idx_type idx)
+void InsetMathGrid::idxGlue(idx_type idx)
{
col_type c = col(idx);
if (c + 1 == ncols()) {
}
-MathGridInset::RowInfo const & MathGridInset::rowinfo(row_type row) const
+InsetMathGrid::RowInfo const & InsetMathGrid::rowinfo(row_type row) const
{
return rowinfo_[row];
}
-MathGridInset::RowInfo & MathGridInset::rowinfo(row_type row)
+InsetMathGrid::RowInfo & InsetMathGrid::rowinfo(row_type row)
{
return rowinfo_[row];
}
-bool MathGridInset::idxBetween(idx_type idx, idx_type from, idx_type to) const
+bool InsetMathGrid::idxBetween(idx_type idx, idx_type from, idx_type to) const
{
row_type const ri = row(idx);
row_type const r1 = min(row(from), row(to));
-void MathGridInset::normalize(NormalStream & os) const
+void InsetMathGrid::normalize(NormalStream & os) const
{
os << "[grid ";
for (row_type row = 0; row < nrows(); ++row) {
}
-void MathGridInset::mathmlize(MathMLStream & os) const
+void InsetMathGrid::mathmlize(MathMLStream & os) const
{
os << MTag("mtable");
for (row_type row = 0; row < nrows(); ++row) {
}
-void MathGridInset::write(WriteStream & os) const
+void InsetMathGrid::write(WriteStream & os) const
{
string eol;
for (row_type row = 0; row < nrows(); ++row) {
}
-int MathGridInset::colsep() const
+int InsetMathGrid::colsep() const
{
return 6;
}
-int MathGridInset::rowsep() const
+int InsetMathGrid::rowsep() const
{
return 6;
}
-int MathGridInset::hlinesep() const
+int InsetMathGrid::hlinesep() const
{
return 3;
}
-int MathGridInset::vlinesep() const
+int InsetMathGrid::vlinesep() const
{
return 3;
}
-int MathGridInset::border() const
+int InsetMathGrid::border() const
{
return 1;
}
-void MathGridInset::splitCell(LCursor & cur)
+void InsetMathGrid::splitCell(LCursor & cur)
{
if (cur.idx() == cur.lastidx())
return;
}
-void MathGridInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathGrid::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- //lyxerr << "*** MathGridInset: request: " << cmd << endl;
+ //lyxerr << "*** InsetMathGrid: request: " << cmd << endl;
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
// GridInsetMailer(*this).showDialog();
// return DispatchResult(true, true);
//}
- MathNestInset::doDispatch(cur, cmd);
+ InsetMathNest::doDispatch(cur, cmd);
break;
case LFUN_INSET_DIALOG_UPDATE:
istringstream is(lyx::to_utf8(cmd.argument()));
int n = 0;
is >> n;
- MathGridInset grid(1, 1);
+ InsetMathGrid grid(1, 1);
mathed_parse_normal(grid, lyx::cap::getSelection(cur.buffer(), n));
if (grid.nargs() == 1) {
// single cell/part of cell
}
// append the left over horizontal cells to the last column
idx_type i = index(r + cur.row(), ncols() - 1);
- for (MathInset::col_type c = numcols; c < grid.ncols(); ++c)
+ for (InsetMath::col_type c = numcols; c < grid.ncols(); ++c)
cell(i).append(grid.cell(grid.index(r, c)));
}
// append the left over vertical cells to the last _cell_
break;
default:
- MathNestInset::doDispatch(cur, cmd);
+ InsetMathNest::doDispatch(cur, cmd);
}
}
-bool MathGridInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathGrid::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & status) const
{
switch (cmd.action) {
return true;
default:
- return MathNestInset::getStatus(cur, cmd, status);
+ return InsetMathNest::getStatus(cur, cmd, status);
}
}
/** Gridded math inset base class.
* This is the base to all grid-like editable math objects
*/
-class MathGridInset : public MathNestInset {
+class InsetMathGrid : public InsetMathNest {
public:
/// additional per-cell information
public:
/// sets nrows and ncols to 1
- MathGridInset();
+ InsetMathGrid();
/// constructor from columns description, creates one row
- MathGridInset(char valign, std::string const & halign);
+ InsetMathGrid(char valign, std::string const & halign);
/// Note: columns first!
- MathGridInset(col_type m, row_type n);
+ InsetMathGrid(col_type m, row_type n);
///
- MathGridInset(col_type m, row_type n, char valign, std::string const & halign);
+ InsetMathGrid(col_type m, row_type n, char valign, std::string const & halign);
/// Ensures that the dialog is closed.
- ~MathGridInset();
+ ~InsetMathGrid();
///
void metrics(MetricsInfo & mi) const;
///
///
CellInfo & cellinfo(idx_type idx) { return cellinfo_[idx]; }
/// identifies GridInset
- MathGridInset * asGridInset() { return this; }
+ InsetMathGrid * asGridInset() { return this; }
/// identifies GridInset
- MathGridInset const * asGridInset() const { return this; }
+ InsetMathGrid const * asGridInset() const { return this; }
///
col_type ncols() const;
///
#include <config.h>
+#include "math_arrayinset.h"
#include "math_charinset.h"
#include "math_colorinset.h"
#include "math_data.h"
+#include "math_deliminset.h"
#include "math_extern.h"
#include "math_factory.h"
#include "math_hullinset.h"
#include "math_mathmlstream.h"
+#include "math_parser.h"
+#include "math_spaceinset.h"
#include "math_streamstr.h"
#include "math_support.h"
+#include "ref_inset.h"
+
+#include "bufferview_funcs.h"
+#include "lyxtext.h"
#include "buffer.h"
#include "bufferparams.h"
#include "graphics/PreviewImage.h"
#include "graphics/PreviewLoader.h"
+#include "support/lyxlib.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
}
-MathHullInset::MathHullInset()
- : MathGridInset(1, 1), type_(hullNone), nonum_(1), label_(1),
+InsetMathHull::InsetMathHull()
+ : InsetMathGrid(1, 1), type_(hullNone), nonum_(1), label_(1),
preview_(new RenderPreview(this))
{
- //lyxerr << "sizeof MathInset: " << sizeof(MathInset) << endl;
+ //lyxerr << "sizeof InsetMath: " << sizeof(InsetMath) << endl;
//lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl;
- //lyxerr << "sizeof MathCharInset: " << sizeof(MathCharInset) << endl;
+ //lyxerr << "sizeof InsetMathChar: " << sizeof(InsetMathChar) << endl;
//lyxerr << "sizeof LyXFont: " << sizeof(LyXFont) << endl;
initMath();
setDefaults();
}
-MathHullInset::MathHullInset(HullType type)
- : MathGridInset(getCols(type), 1), type_(type), nonum_(1), label_(1),
+InsetMathHull::InsetMathHull(HullType type)
+ : InsetMathGrid(getCols(type), 1), type_(type), nonum_(1), label_(1),
preview_(new RenderPreview(this))
{
initMath();
}
-MathHullInset::MathHullInset(MathHullInset const & other)
- : MathGridInset(other),
+InsetMathHull::InsetMathHull(InsetMathHull const & other)
+ : InsetMathGrid(other),
type_(other.type_), nonum_(other.nonum_), label_(other.label_),
preview_(new RenderPreview(this))
{}
-MathHullInset::~MathHullInset()
+InsetMathHull::~InsetMathHull()
{}
-auto_ptr<InsetBase> MathHullInset::doClone() const
+auto_ptr<InsetBase> InsetMathHull::doClone() const
{
- return auto_ptr<InsetBase>(new MathHullInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathHull(*this));
}
-MathHullInset & MathHullInset::operator=(MathHullInset const & other)
+InsetMathHull & InsetMathHull::operator=(InsetMathHull const & other)
{
if (this == &other)
return *this;
- *static_cast<MathGridInset*>(this) = MathGridInset(other);
+ *static_cast<InsetMathGrid*>(this) = InsetMathGrid(other);
type_ = other.type_;
nonum_ = other.nonum_;
label_ = other.label_;
}
-InsetBase * MathHullInset::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetMathHull::editXY(LCursor & cur, int x, int y)
{
if (use_preview_) {
edit(cur, true);
return this;
}
- return MathNestInset::editXY(cur, x, y);
+ return InsetMathNest::editXY(cur, x, y);
}
-MathInset::mode_type MathHullInset::currentMode() const
+InsetMath::mode_type InsetMathHull::currentMode() const
{
if (type_ == hullNone)
return UNDECIDED_MODE;
}
-bool MathHullInset::idxFirst(LCursor & cur) const
+bool InsetMathHull::idxFirst(LCursor & cur) const
{
cur.idx() = 0;
cur.pos() = 0;
}
-bool MathHullInset::idxLast(LCursor & cur) const
+bool InsetMathHull::idxLast(LCursor & cur) const
{
cur.idx() = nargs() - 1;
cur.pos() = cur.lastpos();
}
-char MathHullInset::defaultColAlign(col_type col)
+char InsetMathHull::defaultColAlign(col_type col)
{
if (type_ == hullEqnArray)
return "rcl"[col];
}
-int MathHullInset::defaultColSpace(col_type col)
+int InsetMathHull::defaultColSpace(col_type col)
{
if (type_ == hullAlign || type_ == hullAlignAt)
return 0;
}
-char const * MathHullInset::standardFont() const
+char const * InsetMathHull::standardFont() const
{
return type_ == hullNone ? "lyxnochange" : "mathnormal";
}
-bool MathHullInset::previewState(BufferView * bv) const
+bool InsetMathHull::previewState(BufferView * bv) const
{
if (!editing(bv) && RenderPreview::status() == LyXRC::PREVIEW_ON) {
lyx::graphics::PreviewImage const * pimage =
}
-void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathHull::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (previewState(mi.base.bv)) {
preview_->metrics(mi, dim);
StyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
// let the cells adjust themselves
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
if (display()) {
dim.asc += displayMargin();
}
-void MathHullInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
{
use_preview_ = previewState(pi.base.bv);
FontSetChanger dummy1(pi.base, standardFont());
StyleChanger dummy2(pi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
- MathGridInset::draw(pi, x + 1, y);
+ InsetMathGrid::draw(pi, x + 1, y);
if (numberedType()) {
int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
}
-void MathHullInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathHull::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
if (display()) {
- MathGridInset::metricsT(mi, dim);
+ InsetMathGrid::metricsT(mi, dim);
} else {
ostringstream os;
WriteStream wi(os, false, true);
}
-void MathHullInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathHull::drawT(TextPainter & pain, int x, int y) const
{
if (display()) {
- MathGridInset::drawT(pain, x, y);
+ InsetMathGrid::drawT(pain, x, y);
} else {
ostringstream os;
WriteStream wi(os, false, true);
namespace {
-string const latex_string(MathHullInset const & inset)
+string const latex_string(InsetMathHull const & inset)
{
ostringstream ls;
WriteStream wi(ls, false, false);
} // namespace anon
-void MathHullInset::addPreview(lyx::graphics::PreviewLoader & ploader) const
+void InsetMathHull::addPreview(lyx::graphics::PreviewLoader & ploader) const
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
string const snippet = latex_string(*this);
}
-bool MathHullInset::notifyCursorLeaves(LCursor & cur)
+bool InsetMathHull::notifyCursorLeaves(LCursor & cur)
{
if (RenderPreview::status() == LyXRC::PREVIEW_ON) {
Buffer const & buffer = cur.buffer();
}
-string MathHullInset::label(row_type row) const
+string InsetMathHull::label(row_type row) const
{
BOOST_ASSERT(row < nrows());
return label_[row];
}
-void MathHullInset::label(row_type row, string const & label)
+void InsetMathHull::label(row_type row, string const & label)
{
//lyxerr << "setting label '" << label << "' for row " << row << endl;
label_[row] = label;
}
-void MathHullInset::numbered(row_type row, bool num)
+void InsetMathHull::numbered(row_type row, bool num)
{
nonum_[row] = !num;
}
-bool MathHullInset::numbered(row_type row) const
+bool InsetMathHull::numbered(row_type row) const
{
return !nonum_[row];
}
-bool MathHullInset::ams() const
+bool InsetMathHull::ams() const
{
return
type_ == hullAlign ||
}
-bool MathHullInset::display() const
+bool InsetMathHull::display() const
{
return type_ != hullSimple && type_ != hullNone;
}
-void MathHullInset::getLabelList(Buffer const &, vector<string> & labels) const
+void InsetMathHull::getLabelList(Buffer const &, vector<string> & labels) const
{
for (row_type row = 0; row < nrows(); ++row)
if (!label_[row].empty() && nonum_[row] != 1)
}
-bool MathHullInset::numberedType() const
+bool InsetMathHull::numberedType() const
{
if (type_ == hullNone)
return false;
}
-void MathHullInset::validate(LaTeXFeatures & features) const
+void InsetMathHull::validate(LaTeXFeatures & features) const
{
if (ams())
features.require("amsmath");
features.require("boldsymbol");
//features.binom = true;
- MathGridInset::validate(features);
+ InsetMathGrid::validate(features);
}
-void MathHullInset::header_write(WriteStream & os) const
+void InsetMathHull::header_write(WriteStream & os) const
{
bool n = numberedType();
}
-void MathHullInset::footer_write(WriteStream & os) const
+void InsetMathHull::footer_write(WriteStream & os) const
{
bool n = numberedType();
}
-bool MathHullInset::rowChangeOK() const
+bool InsetMathHull::rowChangeOK() const
{
return
type_ == hullEqnArray || type_ == hullAlign ||
}
-bool MathHullInset::colChangeOK() const
+bool InsetMathHull::colChangeOK() const
{
return
type_ == hullAlign || type_ == hullFlAlign ||type_ == hullAlignAt ||
}
-void MathHullInset::addRow(row_type row)
+void InsetMathHull::addRow(row_type row)
{
if (!rowChangeOK())
return;
nonum_.insert(nonum_.begin() + row + 1, !numberedType());
label_.insert(label_.begin() + row + 1, string());
- MathGridInset::addRow(row);
+ InsetMathGrid::addRow(row);
}
-void MathHullInset::swapRow(row_type row)
+void InsetMathHull::swapRow(row_type row)
{
if (nrows() <= 1)
return;
--row;
swap(nonum_[row], nonum_[row + 1]);
swap(label_[row], label_[row + 1]);
- MathGridInset::swapRow(row);
+ InsetMathGrid::swapRow(row);
}
-void MathHullInset::delRow(row_type row)
+void InsetMathHull::delRow(row_type row)
{
if (nrows() <= 1 || !rowChangeOK())
return;
- MathGridInset::delRow(row);
+ InsetMathGrid::delRow(row);
// The last dummy row has no number info nor a label.
// Test nrows() + 1 because we have already erased the row.
if (row == nrows() + 1)
}
-void MathHullInset::addCol(col_type col)
+void InsetMathHull::addCol(col_type col)
{
if (!colChangeOK())
return;
- MathGridInset::addCol(col);
+ InsetMathGrid::addCol(col);
}
-void MathHullInset::delCol(col_type col)
+void InsetMathHull::delCol(col_type col)
{
if (ncols() <= 1 || !colChangeOK())
return;
- MathGridInset::delCol(col);
+ InsetMathGrid::delCol(col);
}
-string MathHullInset::nicelabel(row_type row) const
+string InsetMathHull::nicelabel(row_type row) const
{
if (nonum_[row])
return string();
}
-void MathHullInset::glueall()
+void InsetMathHull::glueall()
{
MathArray ar;
for (idx_type i = 0; i < nargs(); ++i)
ar.append(cell(i));
- *this = MathHullInset(hullSimple);
+ *this = InsetMathHull(hullSimple);
cell(0) = ar;
setDefaults();
}
-void MathHullInset::splitTo2Cols()
+void InsetMathHull::splitTo2Cols()
{
BOOST_ASSERT(ncols() == 1);
- MathGridInset::addCol(1);
+ InsetMathGrid::addCol(1);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 2 * row;
pos_type pos = firstRelOp(cell(i));
}
-void MathHullInset::splitTo3Cols()
+void InsetMathHull::splitTo3Cols()
{
BOOST_ASSERT(ncols() < 3);
if (ncols() < 2)
splitTo2Cols();
- MathGridInset::addCol(1);
+ InsetMathGrid::addCol(1);
for (row_type row = 0; row < nrows(); ++row) {
idx_type const i = 3 * row + 1;
if (cell(i).size()) {
}
-void MathHullInset::changeCols(col_type cols)
+void InsetMathHull::changeCols(col_type cols)
{
if (ncols() == cols)
return;
else {
splitTo3Cols();
while (ncols() < cols)
- MathGridInset::addCol(ncols() - 1);
+ InsetMathGrid::addCol(ncols() - 1);
}
return;
}
}
// delete columns
while (ncols() > cols) {
- MathGridInset::delCol(ncols() - 1);
+ InsetMathGrid::delCol(ncols() - 1);
}
}
-HullType MathHullInset::getType() const
+HullType InsetMathHull::getType() const
{
return type_;
}
-void MathHullInset::setType(HullType type)
+void InsetMathHull::setType(HullType type)
{
type_ = type;
setDefaults();
}
-void MathHullInset::mutate(HullType newtype)
+void InsetMathHull::mutate(HullType newtype)
{
//lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
}
-string MathHullInset::eolString(row_type row, bool emptyline, bool fragile) const
+string InsetMathHull::eolString(row_type row, bool emptyline, bool fragile) const
{
string res;
if (numberedType()) {
if (nonum_[row] && (type_ != hullMultline))
res += "\\nonumber ";
}
- return res + MathGridInset::eolString(row, emptyline, fragile);
+ return res + InsetMathGrid::eolString(row, emptyline, fragile);
}
-void MathHullInset::write(WriteStream & os) const
+void InsetMathHull::write(WriteStream & os) const
{
header_write(os);
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
footer_write(os);
}
-void MathHullInset::normalize(NormalStream & os) const
+void InsetMathHull::normalize(NormalStream & os) const
{
os << "[formula " << type_ << ' ';
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << "] ";
}
-void MathHullInset::mathmlize(MathMLStream & os) const
+void InsetMathHull::mathmlize(MathMLStream & os) const
{
- MathGridInset::mathmlize(os);
+ InsetMathGrid::mathmlize(os);
}
-void MathHullInset::infoize(ostream & os) const
+void InsetMathHull::infoize(ostream & os) const
{
os << "Type: " << type_;
}
-void MathHullInset::check() const
+void InsetMathHull::check() const
{
BOOST_ASSERT(nonum_.size() == nrows());
BOOST_ASSERT(label_.size() == nrows());
}
-void MathHullInset::doExtern(LCursor & cur, FuncRequest & func)
+void InsetMathHull::doExtern(LCursor & cur, FuncRequest & func)
{
string lang;
string extra;
#endif
MathArray eq;
- eq.push_back(MathAtom(new MathCharInset('=')));
+ eq.push_back(MathAtom(new InsetMathChar('=')));
// go to first item in line
cur.idx() -= cur.idx() % ncols();
}
-void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd)
{
//lyxerr << "action: " << cmd.action << endl;
switch (cmd.action) {
case LFUN_FINISHED_UP:
case LFUN_FINISHED_DOWN:
//lyxerr << "action: " << cmd.action << endl;
- MathGridInset::doDispatch(cur, cmd);
+ InsetMathGrid::doDispatch(cur, cmd);
notifyCursorLeaves(cur);
cur.undispatched();
break;
cur.idx() = 0;
cur.pos() = cur.lastpos();
}
- MathGridInset::doDispatch(cur, cmd);
+ InsetMathGrid::doDispatch(cur, cmd);
break;
case LFUN_MATH_NUMBER:
break;
}
MathArray ar;
- if (createMathInset_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
+ if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
recordUndo(cur);
cur.insert(ar);
} else
}
default:
- MathGridInset::doDispatch(cur, cmd);
+ InsetMathGrid::doDispatch(cur, cmd);
break;
}
}
-bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathHull::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & status) const
{
switch (cmd.action) {
status.enabled(type_ != hullSimple);
return true;
case LFUN_INSET_INSERT: {
- // Don't test createMathInset_fromDialogStr(), since
+ // Don't test createInsetMath_fromDialogStr(), since
// getStatus is not called with a valid reference and the
// dialog would not be applyable.
string const name = cmd.getArg(0);
status.enabled(false);
return true;
}
- return MathGridInset::getStatus(cur, cmd, status);
+ return InsetMathGrid::getStatus(cur, cmd, status);
}
default:
- return MathGridInset::getStatus(cur, cmd, status);
+ return InsetMathGrid::getStatus(cur, cmd, status);
}
// This cannot really happen, but inserted to shut-up gcc
- return MathGridInset::getStatus(cur, cmd, status);
+ return InsetMathGrid::getStatus(cur, cmd, status);
}
/////////////////////////////////////////////////////////////////////
-#include "math_arrayinset.h"
-#include "math_deliminset.h"
-#include "math_factory.h"
-#include "math_parser.h"
-#include "math_spaceinset.h"
-#include "ref_inset.h"
-
-#include "bufferview_funcs.h"
-#include "lyxtext.h"
-
-#include "frontends/LyXView.h"
-#include "frontends/Dialogs.h"
-
-#include "support/lyxlib.h"
// simply scrap this function if you want
-void MathHullInset::mutateToText()
+void InsetMathHull::mutateToText()
{
#if 0
// translate to latex
}
-void MathHullInset::handleFont(LCursor & cur, string const & arg,
+void InsetMathHull::handleFont(LCursor & cur, string const & arg,
string const & font)
{
// this whole function is a hack and won't work for incremental font
// changes...
recordUndo(cur);
- if (cur.inset().asMathInset()->name() == font)
+ if (cur.inset().asInsetMath()->name() == font)
cur.handleFont(font);
else {
- cur.handleNest(createMathInset(font));
+ cur.handleNest(createInsetMath(font));
cur.insert(arg);
}
}
-void MathHullInset::handleFont2(LCursor & cur, string const & arg)
+void InsetMathHull::handleFont2(LCursor & cur, string const & arg)
{
recordUndo(cur);
LyXFont font;
bool b;
bv_funcs::string2font(arg, font, b);
if (font.color() != LColor::inherit) {
- MathAtom at = MathAtom(new MathColorInset(true, font.color()));
+ MathAtom at = MathAtom(new InsetMathColor(true, font.color()));
cur.handleNest(at, 0);
}
}
-void MathHullInset::edit(LCursor & cur, bool left)
+void InsetMathHull::edit(LCursor & cur, bool left)
{
cur.push(*this);
left ? idxFirst(cur) : idxLast(cur);
}
-docstring const MathHullInset::editMessage() const
+docstring const InsetMathHull::editMessage() const
{
return _("Math editor mode");
}
-void MathHullInset::revealCodes(LCursor & cur) const
+void InsetMathHull::revealCodes(LCursor & cur) const
{
if (!cur.inMathed())
return;
}
-InsetBase::Code MathHullInset::lyxCode() const
+InsetBase::Code InsetMathHull::lyxCode() const
{
return MATH_CODE;
}
#if 0
-bool MathHullInset::searchForward(BufferView * bv, string const & str,
+bool InsetMathHull::searchForward(BufferView * bv, string const & str,
bool, bool)
{
#ifdef WITH_WARNINGS
#warning completely broken
#endif
- static MathHullInset * lastformula = 0;
+ static InsetMathHull * lastformula = 0;
static CursorBase current = DocIterator(ibegin(nucleus()));
static MathArray ar;
static string laststr;
for (DocIterator it = current; it != iend(nucleus()); increment(it)) {
CursorSlice & top = it.back();
- MathArray const & a = top.asMathInset()->cell(top.idx_);
+ MathArray const & a = top.asInsetMath()->cell(top.idx_);
if (a.matchpart(ar, top.pos_)) {
bv->cursor().setSelection(it, ar.size());
current = it;
#endif
-void MathHullInset::write(Buffer const &, std::ostream & os) const
+void InsetMathHull::write(Buffer const &, std::ostream & os) const
{
WriteStream wi(os, false, false);
os << "Formula ";
}
-void MathHullInset::read(Buffer const &, LyXLex & lex)
+void InsetMathHull::read(Buffer const &, LyXLex & lex)
{
MathAtom at;
mathed_parse_normal(at, lex);
}
-int MathHullInset::plaintext(Buffer const &, ostream & os,
+int InsetMathHull::plaintext(Buffer const &, ostream & os,
OutputParams const &) const
{
if (0 && display()) {
}
-int MathHullInset::docbook(Buffer const & buf, ostream & os,
+int InsetMathHull::docbook(Buffer const & buf, ostream & os,
OutputParams const & runparams) const
{
MathMLStream ms(os);
// \ensuremath{} or \begin{display}\end{display}
// so we strip LyX' math environment
WriteStream wi(ls, false, false);
- MathGridInset::write(wi);
+ InsetMathGrid::write(wi);
ms << subst(subst(ls.str(), "&", "&"), "<", "<");
ms << ETag("alt");
ms << MTag("math");
- MathGridInset::mathmlize(ms);
+ InsetMathGrid::mathmlize(ms);
ms << ETag("math");
} else {
ms << MTag("alt role=\"tex\"");
}
-int MathHullInset::textString(Buffer const & buf, ostream & os,
+int InsetMathHull::textString(Buffer const & buf, ostream & os,
OutputParams const & op) const
{
return plaintext(buf, os, op);
/// This provides an interface between "LyX insets" and "LyX math insets"
-class MathHullInset : public MathGridInset {
+class InsetMathHull : public InsetMathGrid {
public:
///
- MathHullInset();
+ InsetMathHull();
///
- explicit MathHullInset(HullType type);
+ explicit InsetMathHull(HullType type);
///
- ~MathHullInset();
+ ~InsetMathHull();
///
- MathHullInset & operator=(MathHullInset const &);
+ InsetMathHull & operator=(InsetMathHull const &);
///
mode_type currentMode() const;
///
///
void validate(LaTeXFeatures & features) const;
/// identifies HullInset
- MathHullInset const * asHullInset() const { return this; }
+ InsetMathHull const * asHullInset() const { return this; }
/// identifies HullInset
- MathHullInset * asHullInset() { return this; }
+ InsetMathHull * asHullInset() { return this; }
/// add a row
void addRow(row_type row);
static int displayMargin() { return 12; }
protected:
- MathHullInset(MathHullInset const &);
+ InsetMathHull(InsetMathHull const &);
virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
using std::endl;
-MathArray & MathInset::cell(idx_type)
+MathArray & InsetMath::cell(idx_type)
{
static MathArray dummyCell;
lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
}
-MathArray const & MathInset::cell(idx_type) const
+MathArray const & InsetMath::cell(idx_type) const
{
static MathArray dummyCell;
lyxerr << BOOST_CURRENT_FUNCTION << ": I don't have any cell" << endl;
}
-void MathInset::dump() const
+void InsetMath::dump() const
{
lyxerr << "---------------------------------------------" << endl;
WriteStream wi(lyxerr, false, true);
}
-void MathInset::metricsT(TextMetricsInfo const &, Dimension &) const
+void InsetMath::metricsT(TextMetricsInfo const &, Dimension &) const
{
#ifdef WITH_WARNINGS
- lyxerr << "MathInset::metricsT(Text) called directly!" << endl;
+ lyxerr << "InsetMath::metricsT(Text) called directly!" << endl;
#endif
}
-void MathInset::drawT(TextPainter &, int, int) const
+void InsetMath::drawT(TextPainter &, int, int) const
{
#ifdef WITH_WARNINGS
- lyxerr << "MathInset::drawT(Text) called directly!" << endl;
+ lyxerr << "InsetMath::drawT(Text) called directly!" << endl;
#endif
}
-void MathInset::write(WriteStream & os) const
+void InsetMath::write(WriteStream & os) const
{
string const s = name();
os << '\\' << s.c_str();
}
-void MathInset::normalize(NormalStream & os) const
+void InsetMath::normalize(NormalStream & os) const
{
os << '[' << name().c_str() << "] ";
}
-void MathInset::octave(OctaveStream & os) const
+void InsetMath::octave(OctaveStream & os) const
{
NormalStream ns(os.os());
normalize(ns);
}
-void MathInset::maple(MapleStream & os) const
+void InsetMath::maple(MapleStream & os) const
{
NormalStream ns(os.os());
normalize(ns);
}
-void MathInset::maxima(MaximaStream & os) const
+void InsetMath::maxima(MaximaStream & os) const
{
MapleStream ns(os.os());
maple(ns);
}
-void MathInset::mathematica(MathematicaStream & os) const
+void InsetMath::mathematica(MathematicaStream & os) const
{
NormalStream ns(os.os());
normalize(ns);
}
-void MathInset::mathmlize(MathMLStream & os) const
+void InsetMath::mathmlize(MathMLStream & os) const
{
NormalStream ns(os.os());
normalize(ns);
}
-HullType MathInset::getType() const
+HullType InsetMath::getType() const
{
return hullNone;
}
-string MathInset::name() const
+string InsetMath::name() const
{
return "unknown";
}
Math insets do not know there parents, a cursor position or things
like that. The are dumb object that are contained in other math insets
-(MathNestInsets, in fact) thus forming a tree. The root of this tree is
-always a MathHullInset, which provides an interface to the Outer World by
+(InsetMathNests, in fact) thus forming a tree. The root of this tree is
+always a InsetMathHull, which provides an interface to the Outer World by
inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
*/
class OutputParams;
-class MathArrayInset;
-class MathAMSArrayInset;
-class MathBraceInset;
-class MathCharInset;
-class MathDelimInset;
-class MathFracInset;
-class MathFontInset;
-class MathGridInset;
-class MathHullInset;
-class MathMatrixInset;
-class MathNestInset;
-class MathParboxInset;
-class MathScriptInset;
-class MathStringInset;
-class MathSpaceInset;
-class MathSymbolInset;
-class MathUnknownInset;
+class InsetMathArray;
+class InsetMathAMSArray;
+class InsetMathBrace;
+class InsetMathChar;
+class InsetMathDelim;
+class InsetMathFrac;
+class InsetMathFont;
+class InsetMathGrid;
+class InsetMathHull;
+class InsetMathMatrix;
+class InsetMathNest;
+class InsetMathParbox;
+class InsetMathScript;
+class InsetMathString;
+class InsetMathSpace;
+class InsetMathSymbol;
+class InsetMathUnknown;
class RefInset;
class ReplaceData;
-class MathInset : public InsetBase {
+class InsetMath : public InsetBase {
public:
/// identification as math inset
- MathInset * asMathInset() { return this; }
+ InsetMath * asInsetMath() { return this; }
/// this is overridden in math text insets (i.e. mbox)
bool inMathed() const { return true; }
virtual MathArray const & cell(idx_type) const;
/// identifies certain types of insets
- virtual MathAMSArrayInset * asAMSArrayInset() { return 0; }
- virtual MathAMSArrayInset const * asAMSArrayInset() const { return 0; }
- virtual MathArrayInset * asArrayInset() { return 0; }
- virtual MathArrayInset const * asArrayInset() const { return 0; }
- virtual MathBraceInset const * asBraceInset() const { return 0; }
- virtual MathCharInset const * asCharInset() const { return 0; }
- virtual MathDelimInset * asDelimInset() { return 0; }
- virtual MathDelimInset const * asDelimInset() const { return 0; }
- virtual MathFracInset * asFracInset() { return 0; }
- virtual MathFracInset const * asFracInset() const { return 0; }
- virtual MathFontInset * asFontInset() { return 0; }
- virtual MathFontInset const * asFontInset() const { return 0; }
- virtual MathGridInset * asGridInset() { return 0; }
- virtual MathGridInset const * asGridInset() const { return 0; }
- virtual MathHullInset * asHullInset() { return 0; }
- virtual MathHullInset const * asHullInset() const { return 0; }
+ virtual InsetMathAMSArray * asAMSArrayInset() { return 0; }
+ virtual InsetMathAMSArray const * asAMSArrayInset() const { return 0; }
+ virtual InsetMathArray * asArrayInset() { return 0; }
+ virtual InsetMathArray const * asArrayInset() const { return 0; }
+ virtual InsetMathBrace const * asBraceInset() const { return 0; }
+ virtual InsetMathChar const * asCharInset() const { return 0; }
+ virtual InsetMathDelim * asDelimInset() { return 0; }
+ virtual InsetMathDelim const * asDelimInset() const { return 0; }
+ virtual InsetMathFrac * asFracInset() { return 0; }
+ virtual InsetMathFrac const * asFracInset() const { return 0; }
+ virtual InsetMathFont * asFontInset() { return 0; }
+ virtual InsetMathFont const * asFontInset() const { return 0; }
+ virtual InsetMathGrid * asGridInset() { return 0; }
+ virtual InsetMathGrid const * asGridInset() const { return 0; }
+ virtual InsetMathHull * asHullInset() { return 0; }
+ virtual InsetMathHull const * asHullInset() const { return 0; }
virtual MathMacro * asMacro() { return 0; }
virtual MathMacro const * asMacro() const { return 0; }
virtual MathMacroTemplate * asMacroTemplate() { return 0; }
virtual MathMacroTemplate const * asMacroTemplate() const { return 0; }
- virtual MathMatrixInset const * asMatrixInset() const { return 0; }
- virtual MathNestInset * asNestInset() { return 0; }
- virtual MathNestInset const * asNestInset() const { return 0; }
- virtual MathParboxInset * asParboxInset() { return 0; }
- virtual MathScriptInset * asScriptInset() { return 0; }
- virtual MathScriptInset const * asScriptInset() const { return 0; }
- virtual MathSpaceInset * asSpaceInset() { return 0; }
- virtual MathSpaceInset const * asSpaceInset() const { return 0; }
- virtual MathStringInset * asStringInset() { return 0; }
- virtual MathStringInset const * asStringInset() const { return 0; }
- virtual MathSymbolInset const * asSymbolInset() const { return 0; }
- virtual MathUnknownInset * asUnknownInset() { return 0; }
- virtual MathUnknownInset const * asUnknownInset() const { return 0; }
+ virtual InsetMathMatrix const * asMatrixInset() const { return 0; }
+ virtual InsetMathNest * asNestInset() { return 0; }
+ virtual InsetMathNest const * asNestInset() const { return 0; }
+ virtual InsetMathParbox * asParboxInset() { return 0; }
+ virtual InsetMathScript * asScriptInset() { return 0; }
+ virtual InsetMathScript const * asScriptInset() const { return 0; }
+ virtual InsetMathSpace * asSpaceInset() { return 0; }
+ virtual InsetMathSpace const * asSpaceInset() const { return 0; }
+ virtual InsetMathString * asStringInset() { return 0; }
+ virtual InsetMathString const * asStringInset() const { return 0; }
+ virtual InsetMathSymbol const * asSymbolInset() const { return 0; }
+ virtual InsetMathUnknown * asUnknownInset() { return 0; }
+ virtual InsetMathUnknown const * asUnknownInset() const { return 0; }
virtual RefInset * asRefInset() { return 0; }
/// identifies things that can get scripts
using std::auto_ptr;
-MathKernInset::MathKernInset()
+InsetMathKern::InsetMathKern()
{}
-MathKernInset::MathKernInset(LyXLength const & w)
+InsetMathKern::InsetMathKern(LyXLength const & w)
: wid_(w)
{}
-MathKernInset::MathKernInset(string const & s)
+InsetMathKern::InsetMathKern(string const & s)
: wid_(s)
{}
-auto_ptr<InsetBase> MathKernInset::doClone() const
+auto_ptr<InsetBase> InsetMathKern::doClone() const
{
- return auto_ptr<InsetBase>(new MathKernInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathKern(*this));
}
-void MathKernInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const
{
wid_pix_ = wid_.inPixels(0, mathed_char_width(mi.base.font, 'M'));
dim.wid = wid_pix_;
}
-int MathKernInset::width() const
+int InsetMathKern::width() const
{
return wid_pix_;
}
-void MathKernInset::draw(PainterInfo &, int, int) const
+void InsetMathKern::draw(PainterInfo &, int, int) const
{}
-void MathKernInset::write(WriteStream & os) const
+void InsetMathKern::write(WriteStream & os) const
{
os << "\\kern" << wid_.asLatexString() << ' ';
}
-void MathKernInset::normalize(NormalStream & os) const
+void InsetMathKern::normalize(NormalStream & os) const
{
os << "[kern " << wid_.asLatexString() << ']';
}
/// The \kern primitive
/// Some hack for visual effects
-class MathKernInset : public MathInset {
+class InsetMathKern : public InsetMath {
public:
///
- MathKernInset();
+ InsetMathKern();
///
- explicit MathKernInset(LyXLength const & wid);
+ explicit InsetMathKern(LyXLength const & wid);
///
- explicit MathKernInset(std::string const & wid);
+ explicit InsetMathKern(std::string const & wid);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::auto_ptr;
-MathLefteqnInset::MathLefteqnInset()
- : MathNestInset(1)
+InsetMathLefteqn::InsetMathLefteqn()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathLefteqnInset::doClone() const
+auto_ptr<InsetBase> InsetMathLefteqn::doClone() const
{
- return auto_ptr<InsetBase>(new MathLefteqnInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathLefteqn(*this));
}
-void MathLefteqnInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathLefteqn::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
dim.asc += 2;
}
-void MathLefteqnInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathLefteqn::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 2, y);
drawMarkers(pi, x, y);
}
-string MathLefteqnInset::name() const
+string InsetMathLefteqn::name() const
{
return "lefteqn";
}
-void MathLefteqnInset::infoize(std::ostream & os) const
+void InsetMathLefteqn::infoize(std::ostream & os) const
{
os << "Lefteqn ";
}
/// Support for LaTeX's \\lefteqn command
-class MathLefteqnInset : public MathNestInset {
+class InsetMathLefteqn : public InsetMathNest {
public:
///
- MathLefteqnInset();
+ InsetMathLefteqn();
///
std::string name() const;
///
using std::endl;
-MathLimInset::MathLimInset
+InsetMathLim::InsetMathLim
(MathArray const & f, MathArray const & x, MathArray const & x0)
- : MathNestInset(3)
+ : InsetMathNest(3)
{
cell(0) = f;
cell(1) = x;
}
-auto_ptr<InsetBase> MathLimInset::doClone() const
+auto_ptr<InsetBase> InsetMathLim::doClone() const
{
- return auto_ptr<InsetBase>(new MathLimInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathLim(*this));
}
-void MathLimInset::normalize(NormalStream & os) const
+void InsetMathLim::normalize(NormalStream & os) const
{
os << "[lim " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
}
-void MathLimInset::metrics(MetricsInfo &, Dimension &) const
+void InsetMathLim::metrics(MetricsInfo &, Dimension &) const
{
lyxerr << "should not happen" << endl;
}
-void MathLimInset::draw(PainterInfo &, int, int) const
+void InsetMathLim::draw(PainterInfo &, int, int) const
{
lyxerr << "should not happen" << endl;
}
-void MathLimInset::maple(MapleStream & os) const
+void InsetMathLim::maple(MapleStream & os) const
{
os << "limit(" << cell(0) << ',' << cell(1) << '=' << cell(2) << ')';
}
-void MathLimInset::maxima(MaximaStream & os) const
+void InsetMathLim::maxima(MaximaStream & os) const
{
os << "limit(" << cell(0) << ',' << cell(1) << ',' << cell(2) << ')';
}
-void MathLimInset::mathematica(MathematicaStream & os) const
+void InsetMathLim::mathematica(MathematicaStream & os) const
{
os << "Limit[" << cell(0) << ',' << cell(1) << "-> " << cell(2) << ']';
}
-void MathLimInset::mathmlize(MathMLStream & os) const
+void InsetMathLim::mathmlize(MathMLStream & os) const
{
os << "lim(" << cell(0) << ',' << cell(1) << ',' << cell(2) << ')';
}
-void MathLimInset::write(WriteStream &) const
+void InsetMathLim::write(WriteStream &) const
{
lyxerr << "should not happen" << endl;
}
#include "math_nestinset.h"
-class MathLimInset : public MathNestInset {
+class InsetMathLim : public InsetMathNest {
public:
///
- MathLimInset(MathArray const & f, MathArray const & x, MathArray const & x0);
+ InsetMathLim(MathArray const & f, MathArray const & x, MathArray const & x0);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
MathMacro::MathMacro(string const & name, int numargs)
- : MathNestInset(numargs), name_(name)
+ : InsetMathNest(numargs), name_(name)
{}
void MathMacro::cursorPos(CursorSlice const & sl, bool boundary, int & x,
int & y) const
{
- // We may have 0 arguments, but MathNestInset requires at least one.
+ // We may have 0 arguments, but InsetMathNest requires at least one.
if (nargs() > 0)
- MathNestInset::cursorPos(sl, boundary, x, y);
+ InsetMathNest::cursorPos(sl, boundary, x, y);
}
void MathMacro::drawSelection(PainterInfo & pi, int x, int y) const
{
- // We may have 0 arguments, but MathNestInset requires at least one.
+ // We may have 0 arguments, but InsetMathNest requires at least one.
if (nargs() > 0)
- MathNestInset::drawSelection(pi, x, y);
+ InsetMathNest::drawSelection(pi, x, y);
}
InsetBase * MathMacro::editXY(LCursor & cur, int x, int y)
{
- // We may have 0 arguments, but MathNestInset requires at least one.
+ // We may have 0 arguments, but InsetMathNest requires at least one.
if (nargs() > 0) {
// Prevent crash due to cold coordcache
// FIXME: This is only a workaround, the call of
- // MathNestInset::editXY is correct. The correct fix would
+ // InsetMathNest::editXY is correct. The correct fix would
// ensure that the coordcache of the arguments is valid.
if (!editing(&cur.bv())) {
edit(cur, true);
return this;
}
- return MathNestInset::editXY(cur, x, y);
+ return InsetMathNest::editXY(cur, x, y);
}
return this;
}
/// This class contains the data for a macro.
-class MathMacro : public MathNestInset {
+class MathMacro : public InsetMathNest {
public:
/// A macro can be built from an existing template
MathMacro(std::string const & name, int numargs);
/// A macro argument.
-class MathMacroArgument : public MathDimInset {
+class MathMacroArgument : public InsetMathDim {
public:
///
explicit MathMacroArgument(std::size_t);
void MacroData::expand(vector<MathArray> const & args, MathArray & to) const
{
- MathSqrtInset inset; // Hack. Any inset with a cell would do.
+ InsetMathSqrt inset; // Hack. Any inset with a cell would do.
asArray(disp_.empty() ? def_ : disp_, inset.cell(0));
//lyxerr << "MathData::expand: args: " << args << endl;
//lyxerr << "MathData::expand: ar: " << inset.cell(0) << endl;
if (it.nextInset()->lyxCode() != InsetBase::MATHMACROARG_CODE)
continue;
//it.cell().erase(it.pos());
- //it.cell().insert(it.pos(), it.nextInset()->asMathInset()
+ //it.cell().insert(it.pos(), it.nextInset()->asInsetMath()
size_t n = static_cast<MathMacroArgument*>(it.nextInset())->number();
if (n <= args.size()) {
it.cell().erase(it.pos());
MathMacroTemplate::MathMacroTemplate()
- : MathNestInset(2), numargs_(0), name_(), type_("newcommand")
+ : InsetMathNest(2), numargs_(0), name_(), type_("newcommand")
{
initMath();
}
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs,
string const & type, MathArray const & ar1, MathArray const & ar2)
- : MathNestInset(2), numargs_(numargs), name_(nm), type_(type)
+ : InsetMathNest(2), numargs_(numargs), name_(nm), type_(type)
{
initMath();
MathMacroTemplate::MathMacroTemplate(std::istream & is)
- : MathNestInset(2), numargs_(0), name_()
+ : InsetMathNest(2), numargs_(0), name_()
{
initMath();
#include "support/types.h"
/// This class contains the macro definition.
-class MathMacroTemplate : public MathNestInset {
+class MathMacroTemplate : public InsetMathNest {
public:
///
MathMacroTemplate();
using std::auto_ptr;
-MathMakeboxInset::MathMakeboxInset()
- : MathNestInset(3)
+InsetMathMakebox::InsetMathMakebox()
+ : InsetMathNest(3)
{}
-auto_ptr<InsetBase> MathMakeboxInset::doClone() const
+auto_ptr<InsetBase> InsetMathMakebox::doClone() const
{
- return auto_ptr<InsetBase>(new MathMakeboxInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathMakebox(*this));
}
-void MathMakeboxInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathMakebox::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
w_ = mathed_char_width(mi.base.font, '[');
- MathNestInset::metrics(mi);
+ InsetMathNest::metrics(mi);
dim = cell(0).dim();
dim += cell(1).dim();
dim += cell(2).dim();
}
-void MathMakeboxInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathMakebox::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, "textnormal");
drawMarkers(pi, x, y);
}
-void MathMakeboxInset::write(WriteStream & os) const
+void InsetMathMakebox::write(WriteStream & os) const
{
os << "\\makebox";
os << '[' << cell(0) << ']';
}
-void MathMakeboxInset::normalize(NormalStream & os) const
+void InsetMathMakebox::normalize(NormalStream & os) const
{
os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
}
-void MathMakeboxInset::infoize(std::ostream & os) const
+void InsetMathMakebox::infoize(std::ostream & os) const
{
os << "Makebox (width: " << cell(0)
<< " pos: " << cell(1) << ")";
#include "math_nestinset.h"
/// Extra nesting: \\makebox.
-// consolidate with MathFrameboxInset?
+// consolidate with InsetMathFrameBox?
-class MathMakeboxInset : public MathNestInset {
+class InsetMathMakebox : public InsetMathNest {
public:
///
- MathMakeboxInset();
+ InsetMathMakebox();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
#include <iosfwd>
class MathArray;
-class MathInset;
+class InsetMath;
class MathAtom;
//
using std::auto_ptr;
-MathMatrixInset::MathMatrixInset(MathGridInset const & p)
- : MathGridInset(p)
+InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
+ : InsetMathGrid(p)
{}
-auto_ptr<InsetBase> MathMatrixInset::doClone() const
+auto_ptr<InsetBase> InsetMathMatrix::doClone() const
{
- return auto_ptr<InsetBase>(new MathMatrixInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathMatrix(*this));
}
-void MathMatrixInset::write(WriteStream & os) const
+void InsetMathMatrix::write(WriteStream & os) const
{
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
}
-void MathMatrixInset::normalize(NormalStream & os) const
+void InsetMathMatrix::normalize(NormalStream & os) const
{
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
}
-void MathMatrixInset::maple(MapleStream & os) const
+void InsetMathMatrix::maple(MapleStream & os) const
{
os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
for (idx_type idx = 0; idx < nargs(); ++idx) {
}
-void MathMatrixInset::maxima(MaximaStream & os) const
+void InsetMathMatrix::maxima(MaximaStream & os) const
{
os << "matrix(";
for (row_type row = 0; row < nrows(); ++row) {
}
-void MathMatrixInset::mathematica(MathematicaStream & os) const
+void InsetMathMatrix::mathematica(MathematicaStream & os) const
{
os << '{';
for (row_type row = 0; row < nrows(); ++row) {
}
-void MathMatrixInset::mathmlize(MathMLStream & os) const
+void InsetMathMatrix::mathmlize(MathMLStream & os) const
{
- MathGridInset::mathmlize(os);
+ InsetMathGrid::mathmlize(os);
}
-void MathMatrixInset::octave(OctaveStream & os) const
+void InsetMathMatrix::octave(OctaveStream & os) const
{
os << '[';
for (row_type row = 0; row < nrows(); ++row) {
// "shortcut" for DelimInset("(",ArrayInset,")")
-class MathMatrixInset : public MathGridInset {
+class InsetMathMatrix : public InsetMathGrid {
public:
///
- explicit MathMatrixInset(MathGridInset const &);
+ explicit InsetMathMatrix(InsetMathGrid const &);
///
- explicit MathMatrixInset(std::string const & str);
+ explicit InsetMathMatrix(std::string const & str);
/// identifies MatrixInsets
- MathMatrixInset const * asMatrixInset() const { return this; }
+ InsetMathMatrix const * asMatrixInset() const { return this; }
///
void write(WriteStream & os) const;
using std::endl;
-MathMBoxInset::MathMBoxInset(BufferView & bv)
+InsetMathMBox::InsetMathMBox(BufferView & bv)
: text_(&bv), bv_(&bv)
{
text_.paragraphs().clear();
}
-auto_ptr<InsetBase> MathMBoxInset::doClone() const
+auto_ptr<InsetBase> InsetMathMBox::doClone() const
{
- return auto_ptr<InsetBase>(new MathMBoxInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathMBox(*this));
}
-void MathMBoxInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathMBox::metrics(MetricsInfo & mi, Dimension & dim) const
{
text_.metrics(mi, dim);
metricsMarkers2(dim);
}
-void MathMBoxInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathMBox::draw(PainterInfo & pi, int x, int y) const
{
text_.draw(pi, x + 1, y);
drawMarkers(pi, x, y);
}
-void MathMBoxInset::write(WriteStream & ws) const
+void InsetMathMBox::write(WriteStream & ws) const
{
if (ws.latex()) {
ws << "\\mbox{\n";
}
-int MathMBoxInset::latex(Buffer const & buf, std::ostream & os,
+int InsetMathMBox::latex(Buffer const & buf, std::ostream & os,
OutputParams const & runparams) const
{
os << "\\mbox{\n";
}
-void MathMBoxInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathMBox::doDispatch(LCursor & cur, FuncRequest & cmd)
{
text_.dispatch(cur, cmd);
}
-LyXText * MathMBoxInset::getText(int) const
+LyXText * InsetMathMBox::getText(int) const
{
return &text_;
}
-void MathMBoxInset::cursorPos
+void InsetMathMBox::cursorPos
(CursorSlice const & sl, bool boundary, int & x, int & y) const
{
x = text_.cursorX(sl, boundary);
}
-void MathMBoxInset::drawSelection(PainterInfo & pi, int x, int y) const
+void InsetMathMBox::drawSelection(PainterInfo & pi, int x, int y) const
{
text_.drawSelection(pi, x, y);
}
// almost a substitute for the real text inset...
-class MathMBoxInset : public MathDimInset {
+class InsetMathMBox : public InsetMathDim {
public:
///
- explicit MathMBoxInset(BufferView & bv);
+ explicit InsetMathMBox(BufferView & bv);
/// this stores metrics information in cache_
void metrics(MetricsInfo & mi, Dimension & dim) const;
/// draw according to cached metrics
using std::istringstream;
-MathNestInset::MathNestInset(idx_type nargs)
+InsetMathNest::InsetMathNest(idx_type nargs)
: cells_(nargs), lock_(false)
{}
-MathInset::idx_type MathNestInset::nargs() const
+InsetMath::idx_type InsetMathNest::nargs() const
{
return cells_.size();
}
-MathArray & MathNestInset::cell(idx_type i)
+MathArray & InsetMathNest::cell(idx_type i)
{
return cells_[i];
}
-MathArray const & MathNestInset::cell(idx_type i) const
+MathArray const & InsetMathNest::cell(idx_type i) const
{
return cells_[i];
}
-void MathNestInset::cursorPos(CursorSlice const & sl, bool /*boundary*/,
+void InsetMathNest::cursorPos(CursorSlice const & sl, bool /*boundary*/,
int & x, int & y) const
{
// FIXME: This is a hack. Ideally, the coord cache should not store
}
-void MathNestInset::metrics(MetricsInfo const & mi) const
+void InsetMathNest::metrics(MetricsInfo const & mi) const
{
MetricsInfo m = mi;
for (idx_type i = 0, n = nargs(); i != n; ++i)
}
-bool MathNestInset::idxNext(LCursor & cur) const
+bool InsetMathNest::idxNext(LCursor & cur) const
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (cur.idx() == cur.lastidx())
}
-bool MathNestInset::idxRight(LCursor & cur) const
+bool InsetMathNest::idxRight(LCursor & cur) const
{
return idxNext(cur);
}
-bool MathNestInset::idxPrev(LCursor & cur) const
+bool InsetMathNest::idxPrev(LCursor & cur) const
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (cur.idx() == 0)
}
-bool MathNestInset::idxLeft(LCursor & cur) const
+bool InsetMathNest::idxLeft(LCursor & cur) const
{
return idxPrev(cur);
}
-bool MathNestInset::idxFirst(LCursor & cur) const
+bool InsetMathNest::idxFirst(LCursor & cur) const
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (nargs() == 0)
}
-bool MathNestInset::idxLast(LCursor & cur) const
+bool InsetMathNest::idxLast(LCursor & cur) const
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (nargs() == 0)
}
-void MathNestInset::dump() const
+void InsetMathNest::dump() const
{
WriteStream os(lyxerr);
os << "---------------------------------------------\n";
}
-void MathNestInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathNest::draw(PainterInfo & pi, int x, int y) const
{
#if 0
if (lock_)
}
-void MathNestInset::drawSelection(PainterInfo & pi, int x, int y) const
+void InsetMathNest::drawSelection(PainterInfo & pi, int x, int y) const
{
// this should use the x/y values given, not the cached values
LCursor & cur = pi.base.bv->cursor();
CursorSlice s1 = cur.selBegin();
CursorSlice s2 = cur.selEnd();
- //lyxerr << "MathNestInset::drawing selection: "
+ //lyxerr << "InsetMathNest::drawing selection: "
// << " s1: " << s1 << " s2: " << s2 << endl;
if (s1.idx() == s2.idx()) {
MathArray const & c = cell(s1.idx());
int x2 = c.xo() + c.pos2x(s2.pos());
int y2 = c.yo() + c.descent();
pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
- //lyxerr << "MathNestInset::drawing selection 3: "
+ //lyxerr << "InsetMathNest::drawing selection 3: "
// << " x1: " << x1 << " x2: " << x2
// << " y1: " << y1 << " y2: " << y2 << endl;
} else {
}
-void MathNestInset::validate(LaTeXFeatures & features) const
+void InsetMathNest::validate(LaTeXFeatures & features) const
{
for (idx_type i = 0; i < nargs(); ++i)
cell(i).validate(features);
}
-void MathNestInset::replace(ReplaceData & rep)
+void InsetMathNest::replace(ReplaceData & rep)
{
for (idx_type i = 0; i < nargs(); ++i)
cell(i).replace(rep);
}
-bool MathNestInset::contains(MathArray const & ar) const
+bool InsetMathNest::contains(MathArray const & ar) const
{
for (idx_type i = 0; i < nargs(); ++i)
if (cell(i).contains(ar))
}
-bool MathNestInset::lock() const
+bool InsetMathNest::lock() const
{
return lock_;
}
-void MathNestInset::lock(bool l)
+void InsetMathNest::lock(bool l)
{
lock_ = l;
}
-bool MathNestInset::isActive() const
+bool InsetMathNest::isActive() const
{
return nargs() > 0;
}
-MathArray MathNestInset::glue() const
+MathArray InsetMathNest::glue() const
{
MathArray ar;
for (size_t i = 0; i < nargs(); ++i)
}
-void MathNestInset::write(WriteStream & os) const
+void InsetMathNest::write(WriteStream & os) const
{
os << '\\' << name().c_str();
for (size_t i = 0; i < nargs(); ++i)
}
-void MathNestInset::normalize(NormalStream & os) const
+void InsetMathNest::normalize(NormalStream & os) const
{
os << '[' << name().c_str();
for (size_t i = 0; i < nargs(); ++i)
}
-int MathNestInset::latex(Buffer const &, std::ostream & os,
+int InsetMathNest::latex(Buffer const &, std::ostream & os,
OutputParams const & runparams) const
{
WriteStream wi(os, runparams.moving_arg, true);
}
-bool MathNestInset::notifyCursorLeaves(LCursor & /*cur*/)
+bool InsetMathNest::notifyCursorLeaves(LCursor & /*cur*/)
{
#ifdef WITH_WARNINGS
#warning look here
MathArray & ar = cur.cell();
// remove base-only "scripts"
for (pos_type i = 0; i + 1 < ar.size(); ++i) {
- MathScriptInset * p = operator[](i).nucleus()->asScriptInset();
+ InsetMathScript * p = operator[](i).nucleus()->asScriptInset();
if (p && p->nargs() == 1) {
MathArray ar = p->nuc();
erase(i);
// glue adjacent font insets of the same kind
for (pos_type i = 0; i + 1 < size(); ++i) {
- MathFontInset * p = operator[](i).nucleus()->asFontInset();
- MathFontInset const * q = operator[](i + 1)->asFontInset();
+ InsetMathFont * p = operator[](i).nucleus()->asFontInset();
+ InsetMathFont const * q = operator[](i + 1)->asFontInset();
if (p && q && p->name() == q->name()) {
p->cell(0).append(q->cell(0));
erase(i + 1);
}
-void MathNestInset::handleFont
+void InsetMathNest::handleFont
(LCursor & cur, string const & arg, string const & font)
{
// this whole function is a hack and won't work for incremental font
// changes...
recordUndo(cur, Undo::ATOMIC);
- if (cur.inset().asMathInset()->name() == font)
+ if (cur.inset().asInsetMath()->name() == font)
cur.handleFont(font);
else {
- cur.handleNest(createMathInset(font));
+ cur.handleNest(createInsetMath(font));
cur.insert(arg);
}
}
-void MathNestInset::handleFont2(LCursor & cur, string const & arg)
+void InsetMathNest::handleFont2(LCursor & cur, string const & arg)
{
recordUndo(cur, Undo::ATOMIC);
LyXFont font;
bool b;
bv_funcs::string2font(arg, font, b);
if (font.color() != LColor::inherit) {
- MathAtom at = MathAtom(new MathColorInset(true, font.color()));
+ MathAtom at = MathAtom(new InsetMathColor(true, font.color()));
cur.handleNest(at, 0);
}
}
-void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- //lyxerr << "MathNestInset: request: " << cmd << std::endl;
+ //lyxerr << "InsetMathNest: request: " << cmd << std::endl;
//CursorSlice sl = cur.current();
switch (cmd.action) {
// Otherwise we'll get an invalid cursor if we undo after
// the macro was finished and the macro is a known command,
// e.g. sqrt. LCursor::macroModeClose replaces in this case
- // the MathUnknownInset with name "frac" by an empty
- // MathFracInset -> a pos value > 0 is invalid.
+ // the InsetMathUnknown with name "frac" by an empty
+ // InsetMathFrac -> a pos value > 0 is invalid.
// A side effect is that an undo before the macro is finished
// undoes the complete macro, not only the last character.
if (!cur.inMacroMode())
cur.macroModeClose();
string const save_selection = grabAndEraseSelection(cur);
selClearOrDel(cur);
- //cur.plainInsert(MathAtom(new MathMBoxInset(cur.bv())));
- cur.plainInsert(MathAtom(new MathBoxInset("mbox")));
+ //cur.plainInsert(MathAtom(new InsetMathMBox(cur.bv())));
+ cur.plainInsert(MathAtom(new InsetMathBox("mbox")));
cur.posLeft();
cur.pushLeft(*cur.nextInset());
cur.niceInsert(save_selection);
#else
if (currentMode() == InsetBase::TEXT_MODE) {
- cur.niceInsert(MathAtom(new MathHullInset("simple")));
+ cur.niceInsert(MathAtom(new InsetMathHull("simple")));
cur.message(_("create new math text environment ($...$)"));
} else {
handleFont(cur, lyx::to_utf8(cmd.argument()), "textrm");
n = 1;
v_align += 'c';
cur.niceInsert(
- MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align)));
+ MathAtom(new InsetMathArray("array", m, n, v_align[0], h_align)));
break;
}
if (rs.empty())
rs = ')';
recordUndo(cur, Undo::ATOMIC);
- cur.handleNest(MathAtom(new MathDelimInset(ls, rs)));
+ cur.handleNest(MathAtom(new InsetMathDelim(ls, rs)));
break;
}
string const rdelim = cmd.getArg(3);
latexkeys const * l = in_word_set(lname);
bool const have_l = l && l->inset == "big" &&
- MathBigInset::isBigInsetDelim(ldelim);
+ InsetMathBig::isBigInsetDelim(ldelim);
l = in_word_set(rname);
bool const have_r = l && l->inset == "big" &&
- MathBigInset::isBigInsetDelim(rdelim);
+ InsetMathBig::isBigInsetDelim(rdelim);
// We mimic LFUN_MATH_DELIM in case we have an empty left
// or right delimiter.
if (have_l || have_r) {
string const selection = grabAndEraseSelection(cur);
selClearOrDel(cur);
if (have_l)
- cur.insert(MathAtom(new MathBigInset(lname,
+ cur.insert(MathAtom(new InsetMathBig(lname,
ldelim)));
cur.niceInsert(selection);
if (have_r)
- cur.insert(MathAtom(new MathBigInset(rname,
+ cur.insert(MathAtom(new InsetMathBig(rname,
rdelim)));
}
// Don't call cur.undispatched() if we did nothing, this would
case LFUN_SPACE_INSERT:
case LFUN_MATH_SPACE:
recordUndo(cur, Undo::ATOMIC);
- cur.insert(MathAtom(new MathSpaceInset(",")));
+ cur.insert(MathAtom(new InsetMathSpace(",")));
break;
case LFUN_ERT_INSERT:
}
default:
- MathDimInset::doDispatch(cur, cmd);
+ InsetMathDim::doDispatch(cur, cmd);
break;
}
}
-bool MathNestInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathNest::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
// the font related toggles
}
-void MathNestInset::edit(LCursor & cur, bool left)
+void InsetMathNest::edit(LCursor & cur, bool left)
{
cur.push(*this);
cur.idx() = left ? 0 : cur.lastidx();
cur.pos() = left ? 0 : cur.lastpos();
cur.resetAnchor();
- //lyxerr << "MathNestInset::edit, cur:\n" << cur << endl;
+ //lyxerr << "InsetMathNest::edit, cur:\n" << cur << endl;
}
-InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetMathNest::editXY(LCursor & cur, int x, int y)
{
int idx_min = 0;
int dist_min = 1000000;
}
-void MathNestInset::lfunMousePress(LCursor & cur, FuncRequest & cmd)
+void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
{
//lyxerr << "## lfunMousePress: buttons: " << cmd.button() << endl;
BufferView & bv = cur.bv();
}
-void MathNestInset::lfunMouseMotion(LCursor & cur, FuncRequest & cmd)
+void InsetMathNest::lfunMouseMotion(LCursor & cur, FuncRequest & cmd)
{
// only select with button 1
if (cmd.button() == mouse_button::button1) {
}
-void MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
+void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
{
//lyxerr << "## lfunMouseRelease: buttons: " << cmd.button() << endl;
}
-bool MathNestInset::interpret(LCursor & cur, char c)
+bool InsetMathNest::interpret(LCursor & cur, char c)
{
//lyxerr << "interpret 2: '" << c << "'" << endl;
string save_selection;
// remove the '\\'
if (c == '\\') {
cur.backspace();
- if (currentMode() == MathInset::TEXT_MODE)
- cur.niceInsert(createMathInset("textbackslash"));
+ if (currentMode() == InsetMath::TEXT_MODE)
+ cur.niceInsert(createInsetMath("textbackslash"));
else
- cur.niceInsert(createMathInset("backslash"));
+ cur.niceInsert(createInsetMath("backslash"));
} else if (c == '{') {
cur.backspace();
- cur.niceInsert(MathAtom(new MathBraceInset));
+ cur.niceInsert(MathAtom(new InsetMathBrace));
} else if (c == '%') {
cur.backspace();
- cur.niceInsert(MathAtom(new MathCommentInset));
+ cur.niceInsert(MathAtom(new InsetMathComment));
} else if (c == '#') {
BOOST_ASSERT(cur.activeMacro());
cur.activeMacro()->setName(name + c);
} else {
cur.backspace();
- cur.niceInsert(createMathInset(string(1, c)));
+ cur.niceInsert(createInsetMath(string(1, c)));
}
return true;
}
delim = string(1, c);
break;
}
- if (MathBigInset::isBigInsetDelim(delim)) {
- // name + delim ared a valid MathBigInset.
+ if (InsetMathBig::isBigInsetDelim(delim)) {
+ // name + delim ared a valid InsetMathBig.
// We can't use cur.macroModeClose() because
// it does not handle delim.
- MathUnknownInset * p = cur.activeMacro();
+ InsetMathUnknown * p = cur.activeMacro();
p->finalize();
--cur.pos();
cur.cell().erase(cur.pos());
cur.plainInsert(MathAtom(
- new MathBigInset(name.substr(1), delim)));
+ new InsetMathBig(name.substr(1), delim)));
return true;
}
}
// leave macro mode and try again if necessary
cur.macroModeClose();
if (c == '{')
- cur.niceInsert(MathAtom(new MathBraceInset));
+ cur.niceInsert(MathAtom(new InsetMathBrace));
else if (c != ' ')
interpret(cur, c);
return true;
if (c == '\\') {
//lyxerr << "starting with macro" << endl;
- cur.insert(MathAtom(new MathUnknownInset("\\", false)));
+ cur.insert(MathAtom(new InsetMathUnknown("\\", false)));
return true;
}
if (c == '\n') {
- if (currentMode() == MathInset::TEXT_MODE)
+ if (currentMode() == InsetMath::TEXT_MODE)
cur.insert(c);
return true;
}
if (c == ' ') {
- if (currentMode() == MathInset::TEXT_MODE) {
+ if (currentMode() == InsetMath::TEXT_MODE) {
// insert spaces in text mode,
// but suppress direct insertion of two spaces in a row
// the still allows typing '<space>a<space>' and deleting the 'a', but
}
// These shouldn't work in text mode:
- if (currentMode() != MathInset::TEXT_MODE) {
+ if (currentMode() != InsetMath::TEXT_MODE) {
if (c == '_') {
script(cur, false, save_selection);
return true;
return true;
}
if (c == '~') {
- cur.niceInsert(createMathInset("sim"));
+ cur.niceInsert(createInsetMath("sim"));
return true;
}
}
if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' ||
c == '%' || c == '_' || c == '^') {
- cur.niceInsert(createMathInset(string(1, c)));
+ cur.niceInsert(createInsetMath(string(1, c)));
return true;
}
}
-bool MathNestInset::interpret(LCursor & cur, string const & str)
+bool InsetMathNest::interpret(LCursor & cur, string const & str)
{
- // Create a MathBigInset from cur.cell()[cur.pos() - 1] and t if
+ // Create a InsetMathBig from cur.cell()[cur.pos() - 1] and t if
// possible
if (!cur.empty() && cur.pos() > 0 &&
cur.cell()[cur.pos() - 1]->asUnknownInset()) {
- if (MathBigInset::isBigInsetDelim(str)) {
+ if (InsetMathBig::isBigInsetDelim(str)) {
string prev = asString(cur.cell()[cur.pos() - 1]);
if (prev[0] == '\\') {
prev = prev.substr(1);
latexkeys const * l = in_word_set(prev);
if (l && l->inset == "big") {
cur.cell()[cur.pos() - 1] =
- MathAtom(new MathBigInset(prev, str));
+ MathAtom(new InsetMathBig(prev, str));
return true;
}
}
}
-bool MathNestInset::script(LCursor & cur, bool up, string const &
+bool InsetMathNest::script(LCursor & cur, bool up, string const &
save_selection)
{
// Hack to get \^ and \_ working
//lyxerr << "handling script: up: " << up << endl;
if (cur.inMacroMode() && cur.macroName() == "\\") {
if (up)
- cur.niceInsert(createMathInset("mathcircumflex"));
+ cur.niceInsert(createInsetMath("mathcircumflex"));
else
interpret(cur, '_');
return true;
cur.macroModeClose();
if (asScriptInset() && cur.idx() == 0) {
// we are in a nucleus of a script inset, move to _our_ script
- MathScriptInset * inset = asScriptInset();
+ InsetMathScript * inset = asScriptInset();
//lyxerr << " going to cell " << inset->idxOfScript(up) << endl;
inset->ensure(up);
cur.idx() = inset->idxOfScript(up);
cur.pos() = 0;
} else if (cur.pos() != 0 && cur.prevAtom()->asScriptInset()) {
--cur.pos();
- MathScriptInset * inset = cur.nextAtom().nucleus()->asScriptInset();
+ InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset();
cur.push(*inset);
inset->ensure(up);
cur.idx() = inset->idxOfScript(up);
// one if in the very first position of the array
if (cur.pos() == 0) {
//lyxerr << "new scriptinset" << endl;
- cur.insert(new MathScriptInset(up));
+ cur.insert(new InsetMathScript(up));
} else {
//lyxerr << "converting prev atom " << endl;
- cur.prevAtom() = MathAtom(new MathScriptInset(cur.prevAtom(), up));
+ cur.prevAtom() = MathAtom(new InsetMathScript(cur.prevAtom(), up));
}
--cur.pos();
- MathScriptInset * inset = cur.nextAtom().nucleus()->asScriptInset();
+ InsetMathScript * inset = cur.nextAtom().nucleus()->asScriptInset();
// special handling of {}-bases
// is this always correct?
if (inset->nuc().size() == 1
single symbol.
*/
-class MathNestInset : public MathDimInset {
+class InsetMathNest : public InsetMathDim {
public:
/// nestinsets have a fixed size to start with
- explicit MathNestInset(idx_type ncells);
+ explicit InsetMathNest(idx_type ncells);
/// the size is usually some sort of convex hull of the cells
/// hides inset::metrics() intentionally!
/// draw selection background
void drawSelection(PainterInfo & pi, int x, int y) const;
/// identifies NestInsets
- MathNestInset * asNestInset() { return this; }
+ InsetMathNest * asNestInset() { return this; }
/// identifies NestInsets
- MathNestInset const * asNestInset() const { return this; }
+ InsetMathNest const * asNestInset() const { return this; }
/// get cursor position
void cursorPos(CursorSlice const & sl, bool boundary, int & x, int & y) const;
///
using std::auto_ptr;
-MathNumberInset::MathNumberInset(string const & s)
+InsetMathNumber::InsetMathNumber(string const & s)
: str_(s)
{}
-auto_ptr<InsetBase> MathNumberInset::doClone() const
+auto_ptr<InsetBase> InsetMathNumber::doClone() const
{
- return auto_ptr<InsetBase>(new MathNumberInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathNumber(*this));
}
-void MathNumberInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathNumber::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_string_dim(mi.base.font, str_, dim);
}
-void MathNumberInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathNumber::draw(PainterInfo & pi, int x, int y) const
{
docstring const dstr(str_.begin(), str_.end());
pi.draw(x, y, dstr);
}
-void MathNumberInset::normalize(NormalStream & os) const
+void InsetMathNumber::normalize(NormalStream & os) const
{
os << "[number " << str_ << ']';
}
-void MathNumberInset::maple(MapleStream & os) const
+void InsetMathNumber::maple(MapleStream & os) const
{
os << str_;
}
-void MathNumberInset::mathematica(MathematicaStream & os) const
+void InsetMathNumber::mathematica(MathematicaStream & os) const
{
os << str_;
}
-void MathNumberInset::octave(OctaveStream & os) const
+void InsetMathNumber::octave(OctaveStream & os) const
{
os << str_;
}
-void MathNumberInset::mathmlize(MathMLStream & os) const
+void InsetMathNumber::mathmlize(MathMLStream & os) const
{
os << "<mi> " << str_ << " </mi>";
}
-void MathNumberInset::write(WriteStream & os) const
+void InsetMathNumber::write(WriteStream & os) const
{
os << str_;
}
/** Some inset that "is" a number
* mainly for math-extern
*/
-class MathNumberInset : public MathInset {
+class InsetMathNumber : public InsetMath {
public:
///
- explicit MathNumberInset(std::string const & s);
+ explicit InsetMathNumber(std::string const & s);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
///
std::string str() const { return str_; }
///
- MathNumberInset * asNumberInset() { return this; }
+ InsetMathNumber * asNumberInset() { return this; }
///
void normalize(NormalStream &) const;
using std::auto_ptr;
-auto_ptr<InsetBase> MathOversetInset::doClone() const
+auto_ptr<InsetBase> InsetMathOverset::doClone() const
{
- return auto_ptr<InsetBase>(new MathOversetInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathOverset(*this));
}
-void MathOversetInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathOverset::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(1).metrics(mi);
FracChanger dummy(mi.base);
}
-void MathOversetInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathOverset::draw(PainterInfo & pi, int x, int y) const
{
int m = x + width() / 2;
int yo = y - cell(1).ascent() + cell(0).descent() - 1;
}
-bool MathOversetInset::idxFirst(LCursor & cur) const
+bool InsetMathOverset::idxFirst(LCursor & cur) const
{
cur.idx() = 1;
cur.pos() = 0;
}
-bool MathOversetInset::idxLast(LCursor & cur) const
+bool InsetMathOverset::idxLast(LCursor & cur) const
{
cur.idx() = 1;
cur.pos() = cur.lastpos();
}
-void MathOversetInset::write(WriteStream & os) const
+void InsetMathOverset::write(WriteStream & os) const
{
os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';
}
-void MathOversetInset::normalize(NormalStream & os) const
+void InsetMathOverset::normalize(NormalStream & os) const
{
os << "[overset " << cell(0) << ' ' << cell(1) << ']';
}
-void MathOversetInset::validate(LaTeXFeatures & features) const
+void InsetMathOverset::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
#include "math_fracbase.h"
/// Inset for overset
-class MathOversetInset : public MathFracbaseInset {
+class InsetMathOverset : public InsetMathFracBase {
public:
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
using std::auto_ptr;
-MathParInset::MathParInset(MathArray const & ar)
+InsetMathPar::InsetMathPar(MathArray const & ar)
{
cells_[0] = ar;
}
-void MathParInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathPar::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy1(mi.base, "textnormal");
- MathGridInset::metrics(mi);
+ InsetMathGrid::metrics(mi);
dim = dim_;
}
-void MathParInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathPar::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy1(pi.base, "textnormal");
- MathGridInset::draw(pi, x, y);
+ InsetMathGrid::draw(pi, x, y);
}
-void MathParInset::write(WriteStream & os) const
+void InsetMathPar::write(WriteStream & os) const
{
for (idx_type i = 0; i < nargs(); ++i)
os << cell(i) << "\n";
}
-void MathParInset::infoize(std::ostream & os) const
+void InsetMathPar::infoize(std::ostream & os) const
{
os << "Type: Paragraph ";
}
-auto_ptr<InsetBase> MathParInset::doClone() const
+auto_ptr<InsetBase> InsetMathPar::doClone() const
{
- return auto_ptr<InsetBase>(new MathParInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathPar(*this));
}
#include "math_hullinset.h"
-class MathParInset : public MathHullInset {
+class InsetMathPar : public InsetMathHull {
public:
///
- MathParInset() {}
+ InsetMathPar() {}
///
- MathParInset(MathArray const & ar);
+ InsetMathPar(MathArray const & ar);
///
mode_type currentMode() const { return TEXT_MODE; }
///
namespace {
-MathInset::mode_type asMode(MathInset::mode_type oldmode, string const & str)
+InsetMath::mode_type asMode(InsetMath::mode_type oldmode, string const & str)
{
//lyxerr << "handling mode: '" << str << "'" << endl;
if (str == "mathmode")
- return MathInset::MATH_MODE;
+ return InsetMath::MATH_MODE;
if (str == "textmode" || str == "forcetext")
- return MathInset::TEXT_MODE;
+ return InsetMath::TEXT_MODE;
return oldmode;
}
* \returns wether the row could be added. Adding a row can fail for
* environments like "equation" that have a fixed number of rows.
*/
-bool addRow(MathGridInset & grid, MathGridInset::row_type & cellrow,
+bool addRow(InsetMathGrid & grid, InsetMathGrid::row_type & cellrow,
string const & vskip)
{
++cellrow;
* \returns wether the column could be added. Adding a column can fail for
* environments like "eqnarray" that have a fixed number of columns.
*/
-bool addCol(MathGridInset & grid, MathGridInset::col_type & cellcol)
+bool addCol(InsetMathGrid & grid, InsetMathGrid::col_type & cellcol)
{
++cellcol;
if (cellcol == grid.ncols()) {
* will result in a grid with 3 rows (+ the dummy row that is always present),
* because the last '\\' opens a new row.
*/
-void delEmptyLastRow(MathGridInset & grid)
+void delEmptyLastRow(InsetMathGrid & grid)
{
- MathGridInset::row_type const row = grid.nrows() - 1;
- for (MathGridInset::col_type col = 0; col < grid.ncols(); ++col) {
+ InsetMathGrid::row_type const row = grid.nrows() - 1;
+ for (InsetMathGrid::col_type col = 0; col < grid.ncols(); ++col) {
if (!grid.cell(grid.index(row, col)).empty())
return;
}
class Parser {
public:
///
- typedef MathInset::mode_type mode_type;
+ typedef InsetMath::mode_type mode_type;
///
Parser(LyXLex & lex);
///
void parse(MathArray & array, unsigned flags, mode_type mode);
///
- void parse1(MathGridInset & grid, unsigned flags, mode_type mode,
+ void parse1(InsetMathGrid & grid, unsigned flags, mode_type mode,
bool numbered);
///
MathArray parse(unsigned flags, mode_type mode);
{
skipSpaces();
MathArray ar;
- parse(ar, false, MathInset::UNDECIDED_MODE);
+ parse(ar, false, InsetMath::UNDECIDED_MODE);
if (ar.size() != 1 || ar.front()->getType() == hullNone) {
lyxerr << "unusual contents found: " << ar << endl;
- at = MathAtom(new MathParInset(ar));
+ at = MathAtom(new InsetMathPar(ar));
//if (at->nargs() > 0)
// at.nucleus()->cell(0) = ar;
//else
void Parser::parse(MathArray & array, unsigned flags, mode_type mode)
{
- MathGridInset grid(1, 1);
+ InsetMathGrid grid(1, 1);
parse1(grid, flags, mode, false);
array = grid.cell(0);
}
}
-void Parser::parse1(MathGridInset & grid, unsigned flags,
+void Parser::parse1(InsetMathGrid & grid, unsigned flags,
const mode_type mode, const bool numbered)
{
int limits = 0;
- MathGridInset::row_type cellrow = 0;
- MathGridInset::col_type cellcol = 0;
+ InsetMathGrid::row_type cellrow = 0;
+ InsetMathGrid::col_type cellcol = 0;
MathArray * cell = &grid.cell(grid.index(cellrow, cellcol));
if (grid.asHullInset())
// cat codes
//
if (t.cat() == catMath) {
- if (mode != MathInset::MATH_MODE) {
+ if (mode != InsetMath::MATH_MODE) {
// we are inside some text mode thingy, so opening new math is allowed
Token const & n = getToken();
if (n.cat() == catMath) {
// TeX's $$...$$ syntax for displayed math
- cell->push_back(MathAtom(new MathHullInset(hullEquation)));
- parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
+ cell->push_back(MathAtom(new InsetMathHull(hullEquation)));
+ parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
getToken(); // skip the second '$' token
} else {
// simple $...$ stuff
putback();
- cell->push_back(MathAtom(new MathHullInset(hullSimple)));
- parse2(cell->back(), FLAG_SIMPLE, MathInset::MATH_MODE, false);
+ cell->push_back(MathAtom(new InsetMathHull(hullSimple)));
+ parse2(cell->back(), FLAG_SIMPLE, InsetMath::MATH_MODE, false);
}
}
}
else if (t.cat() == catLetter)
- cell->push_back(MathAtom(new MathCharInset(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(t.character())));
- else if (t.cat() == catSpace && mode != MathInset::MATH_MODE) {
+ else if (t.cat() == catSpace && mode != InsetMath::MATH_MODE) {
if (cell->empty() || cell->back()->getChar() != ' ')
- cell->push_back(MathAtom(new MathCharInset(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(t.character())));
}
- else if (t.cat() == catNewline && mode != MathInset::MATH_MODE) {
+ else if (t.cat() == catNewline && mode != InsetMath::MATH_MODE) {
if (cell->empty() || cell->back()->getChar() != ' ')
- cell->push_back(MathAtom(new MathCharInset(' ')));
+ cell->push_back(MathAtom(new InsetMathChar(' ')));
}
else if (t.cat() == catParameter) {
}
else if (t.cat() == catActive)
- cell->push_back(MathAtom(new MathCharInset(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(t.character())));
else if (t.cat() == catBegin) {
MathArray ar;
if (ar.size() == 1 && ar[0]->extraBraces())
cell->append(ar);
else
- cell->push_back(MathAtom(new MathBraceInset(ar)));
+ cell->push_back(MathAtom(new InsetMathBrace(ar)));
}
else if (t.cat() == catEnd) {
// we need no new script inset if the last thing was a scriptinset,
// which has that script already not the same script already
if (!cell->size())
- cell->push_back(MathAtom(new MathScriptInset(up)));
+ cell->push_back(MathAtom(new InsetMathScript(up)));
else if (cell->back()->asScriptInset() &&
!cell->back()->asScriptInset()->has(up))
cell->back().nucleus()->asScriptInset()->ensure(up);
else if (cell->back()->asScriptInset())
- cell->push_back(MathAtom(new MathScriptInset(up)));
+ cell->push_back(MathAtom(new InsetMathScript(up)));
else
- cell->back() = MathAtom(new MathScriptInset(cell->back(), up));
- MathScriptInset * p = cell->back().nucleus()->asScriptInset();
+ cell->back() = MathAtom(new InsetMathScript(cell->back(), up));
+ InsetMathScript * p = cell->back().nucleus()->asScriptInset();
// special handling of {}-bases
// is this always correct?
if (p->nuc().size() == 1
}
else if (t.cat() == catOther)
- cell->push_back(MathAtom(new MathCharInset(t.character())));
+ cell->push_back(MathAtom(new InsetMathChar(t.character())));
else if (t.cat() == catComment) {
string s;
break;
s += t.asString();
}
- cell->push_back(MathAtom(new MathCommentInset(s)));
+ cell->push_back(MathAtom(new InsetMathComment(s)));
skipSpaces();
}
}
MathArray ar1;
- parse(ar1, FLAG_ITEM, MathInset::UNDECIDED_MODE);
+ parse(ar1, FLAG_ITEM, InsetMath::UNDECIDED_MODE);
// we cannot handle recursive stuff at all
//MathArray test;
- //test.push_back(createMathInset(name));
+ //test.push_back(createInsetMath(name));
//if (ar1.contains(test)) {
// error("we cannot handle recursive macros at all.");
// return;
skipSpaces();
MathArray ar2;
if (nextToken().cat() == catBegin)
- parse(ar2, FLAG_ITEM, MathInset::MATH_MODE);
+ parse(ar2, FLAG_ITEM, InsetMath::MATH_MODE);
cell->push_back(MathAtom(new MathMacroTemplate(name, nargs, type,
ar1, ar2)));
}
else if (t.cs() == "(") {
- cell->push_back(MathAtom(new MathHullInset(hullSimple)));
- parse2(cell->back(), FLAG_SIMPLE2, MathInset::MATH_MODE, false);
+ cell->push_back(MathAtom(new InsetMathHull(hullSimple)));
+ parse2(cell->back(), FLAG_SIMPLE2, InsetMath::MATH_MODE, false);
}
else if (t.cs() == "[") {
- cell->push_back(MathAtom(new MathHullInset(hullEquation)));
- parse2(cell->back(), FLAG_EQUATION, MathInset::MATH_MODE, false);
+ cell->push_back(MathAtom(new InsetMathHull(hullEquation)));
+ parse2(cell->back(), FLAG_EQUATION, InsetMath::MATH_MODE, false);
}
else if (t.cs() == "protect")
environments_.pop_back();
// Delete empty last row in matrix
// like insets.
- // If you abuse MathGridInset for
+ // If you abuse InsetMathGrid for
// non-matrix like structures you
// probably need to refine this test.
// Right now we only have to test for
MathArray ar;
parse(ar, FLAG_OPTION, mode);
if (ar.size()) {
- cell->push_back(MathAtom(new MathRootInset));
+ cell->push_back(MathAtom(new InsetMathRoot));
cell->back().nucleus()->cell(0) = ar;
parse(cell->back().nucleus()->cell(1), FLAG_ITEM, mode);
} else {
- cell->push_back(MathAtom(new MathSqrtInset));
+ cell->push_back(MathAtom(new InsetMathSqrt));
parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
}
}
else if (t.cs() == "xrightarrow" || t.cs() == "xleftarrow") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse(cell->back().nucleus()->cell(1), FLAG_OPTION, mode);
parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
}
else if (t.cs() == "left") {
skipSpaces();
Token const & tl = getToken();
- // \| and \Vert are equivalent, and MathDelimInset
+ // \| and \Vert are equivalent, and InsetMathDelim
// can't handle \|
- // FIXME: fix this in MathDelimInset itself!
+ // FIXME: fix this in InsetMathDelim itself!
string const l = tl.cs() == "|" ? "Vert" : tl.asString();
MathArray ar;
parse(ar, FLAG_RIGHT, mode);
skipSpaces();
Token const & tr = getToken();
string const r = tr.cs() == "|" ? "Vert" : tr.asString();
- cell->push_back(MathAtom(new MathDelimInset(l, r, ar)));
+ cell->push_back(MathAtom(new InsetMathDelim(l, r, ar)));
}
else if (t.cs() == "right") {
if (name == "array" || name == "subarray") {
string const valign = parse_verbatim_option() + 'c';
string const halign = parse_verbatim_item();
- cell->push_back(MathAtom(new MathArrayInset(name, valign[0], halign)));
+ cell->push_back(MathAtom(new InsetMathArray(name, valign[0], halign)));
parse2(cell->back(), FLAG_END, mode, false);
}
else if (name == "tabular") {
string const valign = parse_verbatim_option() + 'c';
string const halign = parse_verbatim_item();
- cell->push_back(MathAtom(new MathTabularInset(name, valign[0], halign)));
- parse2(cell->back(), FLAG_END, MathInset::TEXT_MODE, false);
+ cell->push_back(MathAtom(new InsetMathTabular(name, valign[0], halign)));
+ parse2(cell->back(), FLAG_END, InsetMath::TEXT_MODE, false);
}
else if (name == "split" || name == "cases" ||
name == "gathered" || name == "aligned") {
- cell->push_back(createMathInset(name));
+ cell->push_back(createInsetMath(name));
parse2(cell->back(), FLAG_END, mode, false);
}
else if (name == "alignedat") {
// ignore this for a while
getArg('{', '}');
- cell->push_back(createMathInset(name));
+ cell->push_back(createInsetMath(name));
parse2(cell->back(), FLAG_END, mode, false);
}
else if (name == "math") {
- cell->push_back(MathAtom(new MathHullInset(hullSimple)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, true);
+ cell->push_back(MathAtom(new InsetMathHull(hullSimple)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, true);
}
else if (name == "equation" || name == "equation*"
|| name == "displaymath") {
- cell->push_back(MathAtom(new MathHullInset(hullEquation)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, (name == "equation"));
+ cell->push_back(MathAtom(new InsetMathHull(hullEquation)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, (name == "equation"));
}
else if (name == "eqnarray" || name == "eqnarray*") {
- cell->push_back(MathAtom(new MathHullInset(hullEqnArray)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullEqnArray)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "align" || name == "align*") {
- cell->push_back(MathAtom(new MathHullInset(hullAlign)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullAlign)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "flalign" || name == "flalign*") {
- cell->push_back(MathAtom(new MathHullInset(hullFlAlign)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullFlAlign)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "alignat" || name == "alignat*") {
// ignore this for a while
getArg('{', '}');
- cell->push_back(MathAtom(new MathHullInset(hullAlignAt)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullAlignAt)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "xalignat" || name == "xalignat*") {
// ignore this for a while
getArg('{', '}');
- cell->push_back(MathAtom(new MathHullInset(hullXAlignAt)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullXAlignAt)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "xxalignat") {
// ignore this for a while
getArg('{', '}');
- cell->push_back(MathAtom(new MathHullInset(hullXXAlignAt)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullXXAlignAt)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "multline" || name == "multline*") {
- cell->push_back(MathAtom(new MathHullInset(hullMultline)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullMultline)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (name == "gather" || name == "gather*") {
- cell->push_back(MathAtom(new MathHullInset(hullGather)));
- parse2(cell->back(), FLAG_END, MathInset::MATH_MODE, !stared(name));
+ cell->push_back(MathAtom(new InsetMathHull(hullGather)));
+ parse2(cell->back(), FLAG_END, InsetMath::MATH_MODE, !stared(name));
}
else if (latexkeys const * l = in_word_set(name)) {
if (l->inset == "matrix") {
- cell->push_back(createMathInset(name));
+ cell->push_back(createInsetMath(name));
parse2(cell->back(), FLAG_END, mode, false);
}
}
dump();
lyxerr << "found unknown math environment '" << name << "'" << endl;
// create generic environment inset
- cell->push_back(MathAtom(new MathEnvInset(name)));
+ cell->push_back(MathAtom(new InsetMathEnv(name)));
parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode);
}
}
if (isValidLength(s))
break;
}
- cell->push_back(MathAtom(new MathKernInset(s)));
+ cell->push_back(MathAtom(new InsetMathKern(s)));
}
else if (t.cs() == "label") {
if (grid.asHullInset()) {
grid.asHullInset()->label(cellrow, label);
} else {
- cell->push_back(createMathInset(t.cs()));
- cell->push_back(MathAtom(new MathBraceInset(ar)));
+ cell->push_back(createInsetMath(t.cs()));
+ cell->push_back(MathAtom(new InsetMathBrace(ar)));
}
}
else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
- MathAtom at = createMathInset(t.cs());
+ MathAtom at = createInsetMath(t.cs());
at.nucleus()->cell(0) = *cell;
cell->clear();
parse(at.nucleus()->cell(1), flags, mode);
else if (t.cs() == "color") {
string const color = parse_verbatim_item();
- cell->push_back(MathAtom(new MathColorInset(true, color)));
+ cell->push_back(MathAtom(new InsetMathColor(true, color)));
parse(cell->back().nucleus()->cell(0), flags, mode);
return;
}
else if (t.cs() == "textcolor") {
string const color = parse_verbatim_item();
- cell->push_back(MathAtom(new MathColorInset(false, color)));
- parse(cell->back().nucleus()->cell(0), FLAG_ITEM, MathInset::TEXT_MODE);
+ cell->push_back(MathAtom(new InsetMathColor(false, color)));
+ parse(cell->back().nucleus()->cell(0), FLAG_ITEM, InsetMath::TEXT_MODE);
}
else if (t.cs() == "normalcolor") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse(cell->back().nucleus()->cell(0), flags, mode);
return;
}
else if (t.cs() == "substack") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse2(cell->back(), FLAG_ITEM, mode, false);
}
else if (t.cs() == "xymatrix") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse2(cell->back(), FLAG_ITEM, mode, false);
}
else if (t.cs() == "framebox" || t.cs() == "makebox") {
- cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0), FLAG_OPTION, MathInset::TEXT_MODE);
- parse(cell->back().nucleus()->cell(1), FLAG_OPTION, MathInset::TEXT_MODE);
- parse(cell->back().nucleus()->cell(2), FLAG_ITEM, MathInset::TEXT_MODE);
+ cell->push_back(createInsetMath(t.cs()));
+ parse(cell->back().nucleus()->cell(0), FLAG_OPTION, InsetMath::TEXT_MODE);
+ parse(cell->back().nucleus()->cell(1), FLAG_OPTION, InsetMath::TEXT_MODE);
+ parse(cell->back().nucleus()->cell(2), FLAG_ITEM, InsetMath::TEXT_MODE);
}
else if (t.cs() == "tag") {
if (nextToken().character() == '*') {
getToken();
- cell->push_back(createMathInset(t.cs() + '*'));
+ cell->push_back(createInsetMath(t.cs() + '*'));
} else
- cell->push_back(createMathInset(t.cs()));
- parse(cell->back().nucleus()->cell(0), FLAG_ITEM, MathInset::TEXT_MODE);
+ cell->push_back(createInsetMath(t.cs()));
+ parse(cell->back().nucleus()->cell(0), FLAG_ITEM, InsetMath::TEXT_MODE);
}
#if 0
else if (t.cs() == "infer") {
MathArray ar;
parse(ar, FLAG_OPTION, mode);
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse2(cell->back(), FLAG_ITEM, mode, false);
}
// Disabled
else if (1 && t.cs() == "ar") {
- auto_ptr<MathXYArrowInset> p(new MathXYArrowInset);
+ auto_ptr<InsetMathXYArrow> p(new InsetMathXYArrow);
// try to read target
parse(p->cell(0), FLAG_OTPTION, mode);
// try to read label
if (l->inset == "big") {
skipSpaces();
string const delim = getToken().asInput();
- if (MathBigInset::isBigInsetDelim(delim))
+ if (InsetMathBig::isBigInsetDelim(delim))
cell->push_back(MathAtom(
- new MathBigInset(t.cs(), delim)));
+ new InsetMathBig(t.cs(), delim)));
else {
- cell->push_back(createMathInset(t.cs()));
- cell->push_back(createMathInset(
+ cell->push_back(createInsetMath(t.cs()));
+ cell->push_back(createInsetMath(
delim.substr(1)));
}
}
else if (l->inset == "font") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse(cell->back().nucleus()->cell(0),
FLAG_ITEM, asMode(mode, l->extra));
}
else if (l->inset == "oldfont") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse(cell->back().nucleus()->cell(0),
flags | FLAG_ALIGN, asMode(mode, l->extra));
if (prevToken().cat() != catAlign &&
}
else if (l->inset == "style") {
- cell->push_back(createMathInset(t.cs()));
+ cell->push_back(createInsetMath(t.cs()));
parse(cell->back().nucleus()->cell(0),
flags | FLAG_ALIGN, mode);
if (prevToken().cat() != catAlign &&
}
else {
- MathAtom at = createMathInset(t.cs());
- for (MathInset::idx_type i = 0; i < at->nargs(); ++i)
+ MathAtom at = createInsetMath(t.cs());
+ for (InsetMath::idx_type i = 0; i < at->nargs(); ++i)
parse(at.nucleus()->cell(i),
FLAG_ITEM, asMode(mode, l->extra));
cell->push_back(at);
}
else {
- MathAtom at = createMathInset(t.cs());
- MathInset::mode_type m = mode;
- //if (m == MathInset::UNDECIDED_MODE)
+ MathAtom at = createInsetMath(t.cs());
+ InsetMath::mode_type m = mode;
+ //if (m == InsetMath::UNDECIDED_MODE)
//lyxerr << "default creation: m1: " << m << endl;
- if (at->currentMode() != MathInset::UNDECIDED_MODE)
+ if (at->currentMode() != InsetMath::UNDECIDED_MODE)
m = at->currentMode();
//lyxerr << "default creation: m2: " << m << endl;
- MathInset::idx_type start = 0;
+ InsetMath::idx_type start = 0;
// this fails on \bigg[...\bigg]
//MathArray opt;
- //parse(opt, FLAG_OPTION, MathInset::VERBATIM_MODE);
+ //parse(opt, FLAG_OPTION, InsetMath::VERBATIM_MODE);
//if (opt.size()) {
// start = 1;
// at.nucleus()->cell(0) = opt;
//}
- for (MathInset::idx_type i = start; i < at->nargs(); ++i) {
+ for (InsetMath::idx_type i = start; i < at->nargs(); ++i) {
parse(at.nucleus()->cell(i), FLAG_ITEM, m);
skipSpaces();
}
void mathed_parse_cell(MathArray & ar, istream & is)
{
- Parser(is).parse(ar, 0, MathInset::MATH_MODE);
+ Parser(is).parse(ar, 0, InsetMath::MATH_MODE);
}
}
-void mathed_parse_normal(MathGridInset & grid, string const & str)
+void mathed_parse_normal(InsetMathGrid & grid, string const & str)
{
istringstream is(str);
- Parser(is).parse1(grid, 0, MathInset::MATH_MODE, false);
+ Parser(is).parse1(grid, 0, InsetMath::MATH_MODE, false);
}
class MathAtom;
class MathArray;
-class MathGridInset;
+class InsetMathGrid;
class LyXLex;
/// ... the LyX lexxer
bool mathed_parse_normal(MathAtom &, LyXLex &);
/// ... the LyX lexxer
-void mathed_parse_normal(MathGridInset &, std::string const &);
+void mathed_parse_normal(InsetMathGrid &, std::string const &);
/// parse a single cell from a string
void mathed_parse_cell(MathArray & ar, std::string const &);
#include "support/std_ostream.h"
-MathPhantomInset::MathPhantomInset(Kind k)
- : MathNestInset(1), kind_(k)
+InsetMathPhantom::InsetMathPhantom(Kind k)
+ : InsetMathNest(1), kind_(k)
{}
-std::auto_ptr<InsetBase> MathPhantomInset::doClone() const
+std::auto_ptr<InsetBase> InsetMathPhantom::doClone() const
{
- return std::auto_ptr<InsetBase>(new MathPhantomInset(*this));
+ return std::auto_ptr<InsetBase>(new InsetMathPhantom(*this));
}
-void MathPhantomInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathPhantom::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
metricsMarkers(dim);
}
-void MathPhantomInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathPhantom::draw(PainterInfo & pi, int x, int y) const
{
static int const arrow_size = 4;
}
-void MathPhantomInset::write(WriteStream & os) const
+void InsetMathPhantom::write(WriteStream & os) const
{
switch (kind_) {
case phantom:
}
-void MathPhantomInset::normalize(NormalStream & os) const
+void InsetMathPhantom::normalize(NormalStream & os) const
{
switch (kind_) {
case phantom:
}
-void MathPhantomInset::infoize(std::ostream & os) const
+void InsetMathPhantom::infoize(std::ostream & os) const
{
switch (kind_) {
case phantom:
#include "math_nestinset.h"
-class MathPhantomInset : public MathNestInset {
+class InsetMathPhantom : public InsetMathNest {
public:
///
enum Kind {
hphantom
};
///
- explicit MathPhantomInset(Kind);
+ explicit InsetMathPhantom(Kind);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
-MathRootInset::MathRootInset()
- : MathNestInset(2)
+InsetMathRoot::InsetMathRoot()
+ : InsetMathNest(2)
{}
-auto_ptr<InsetBase> MathRootInset::doClone() const
+auto_ptr<InsetBase> InsetMathRoot::doClone() const
{
- return auto_ptr<InsetBase>(new MathRootInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathRoot(*this));
}
-void MathRootInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathRoot::metrics(MetricsInfo & mi, Dimension & dim) const
{
- MathNestInset::metrics(mi);
+ InsetMathNest::metrics(mi);
dim.asc = max(cell(0).ascent() + 5, cell(1).ascent()) + 2;
dim.des = max(cell(1).descent() + 5, cell(0).descent()) + 2;
dim.wid = cell(0).width() + cell(1).width() + 10;
}
-void MathRootInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
{
int const w = cell(0).width();
// the "exponent"
}
-void MathRootInset::write(WriteStream & os) const
+void InsetMathRoot::write(WriteStream & os) const
{
os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
}
-void MathRootInset::normalize(NormalStream & os) const
+void InsetMathRoot::normalize(NormalStream & os) const
{
os << "[root " << cell(0) << ' ' << cell(1) << ']';
}
-bool MathRootInset::idxUpDown(LCursor & cur, bool up) const
+bool InsetMathRoot::idxUpDown(LCursor & cur, bool up) const
{
LCursor::idx_type const target = up ? 0 : 1;
if (cur.idx() == target)
}
-void MathRootInset::maple(MapleStream & os) const
+void InsetMathRoot::maple(MapleStream & os) const
{
os << '(' << cell(1) << ")^(1/(" << cell(0) <<"))";
}
-void MathRootInset::octave(OctaveStream & os) const
+void InsetMathRoot::octave(OctaveStream & os) const
{
os << "root(" << cell(1) << ',' << cell(0) << ')';
}
-void MathRootInset::mathmlize(MathMLStream & os) const
+void InsetMathRoot::mathmlize(MathMLStream & os) const
{
os << MTag("mroot") << cell(1) << cell(0) << ETag("mroot");
}
/// The general n-th root inset.
-class MathRootInset : public MathNestInset {
+class InsetMathRoot : public InsetMathNest {
public:
///
- MathRootInset();
+ InsetMathRoot();
///
bool idxUpDown(LCursor & cur, bool up) const;
///
-MathScriptInset::MathScriptInset()
- : MathNestInset(1), cell_1_is_up_(false), limits_(0)
+InsetMathScript::InsetMathScript()
+ : InsetMathNest(1), cell_1_is_up_(false), limits_(0)
{}
-MathScriptInset::MathScriptInset(bool up)
- : MathNestInset(2), cell_1_is_up_(up), limits_(0)
+InsetMathScript::InsetMathScript(bool up)
+ : InsetMathNest(2), cell_1_is_up_(up), limits_(0)
{}
-MathScriptInset::MathScriptInset(MathAtom const & at, bool up)
- : MathNestInset(2), cell_1_is_up_(up), limits_(0)
+InsetMathScript::InsetMathScript(MathAtom const & at, bool up)
+ : InsetMathNest(2), cell_1_is_up_(up), limits_(0)
{
BOOST_ASSERT(nargs() >= 1);
cell(0).push_back(at);
}
-auto_ptr<InsetBase> MathScriptInset::doClone() const
+auto_ptr<InsetBase> InsetMathScript::doClone() const
{
- return auto_ptr<InsetBase>(new MathScriptInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathScript(*this));
}
-MathScriptInset const * MathScriptInset::asScriptInset() const
+InsetMathScript const * InsetMathScript::asScriptInset() const
{
return this;
}
-MathScriptInset * MathScriptInset::asScriptInset()
+InsetMathScript * InsetMathScript::asScriptInset()
{
return this;
}
-bool MathScriptInset::idxFirst(LCursor & cur) const
+bool InsetMathScript::idxFirst(LCursor & cur) const
{
cur.idx() = 0;
cur.pos() = 0;
}
-bool MathScriptInset::idxLast(LCursor & cur) const
+bool InsetMathScript::idxLast(LCursor & cur) const
{
cur.idx() = 0;
cur.pos() = nuc().size();
}
-MathArray const & MathScriptInset::down() const
+MathArray const & InsetMathScript::down() const
{
if (nargs() == 3)
return cell(2);
}
-MathArray & MathScriptInset::down()
+MathArray & InsetMathScript::down()
{
if (nargs() == 3)
return cell(2);
}
-MathArray const & MathScriptInset::up() const
+MathArray const & InsetMathScript::up() const
{
BOOST_ASSERT(nargs() > 1);
return cell(1);
}
-MathArray & MathScriptInset::up()
+MathArray & InsetMathScript::up()
{
BOOST_ASSERT(nargs() > 1);
return cell(1);
}
-void MathScriptInset::ensure(bool up)
+void InsetMathScript::ensure(bool up)
{
if (nargs() == 1) {
// just nucleus so far
}
-MathArray const & MathScriptInset::nuc() const
+MathArray const & InsetMathScript::nuc() const
{
return cell(0);
}
-MathArray & MathScriptInset::nuc()
+MathArray & InsetMathScript::nuc()
{
return cell(0);
}
-int MathScriptInset::dy0() const
+int InsetMathScript::dy0() const
{
int nd = ndes();
if (!hasDown())
}
-int MathScriptInset::dy1() const
+int InsetMathScript::dy1() const
{
int na = nasc();
if (!hasUp())
}
-int MathScriptInset::dx0() const
+int InsetMathScript::dx0() const
{
BOOST_ASSERT(hasDown());
return hasLimits() ? (dim_.wid - down().width()) / 2 : nwid();
}
-int MathScriptInset::dx1() const
+int InsetMathScript::dx1() const
{
BOOST_ASSERT(hasUp());
return hasLimits() ? (dim_.wid - up().width()) / 2 : nwid();
}
-int MathScriptInset::dxx() const
+int InsetMathScript::dxx() const
{
return hasLimits() ? (dim_.wid - nwid()) / 2 : 0;
}
-int MathScriptInset::nwid() const
+int InsetMathScript::nwid() const
{
return nuc().size() ? nuc().width() : 2;
}
-int MathScriptInset::nasc() const
+int InsetMathScript::nasc() const
{
return nuc().size() ? nuc().ascent() : 5;
}
-int MathScriptInset::ndes() const
+int InsetMathScript::ndes() const
{
return nuc().size() ? nuc().descent() : 0;
}
-void MathScriptInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathScript::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi);
ScriptChanger dummy(mi.base);
}
-void MathScriptInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathScript::draw(PainterInfo & pi, int x, int y) const
{
if (nuc().size())
nuc().draw(pi, x + dxx(), y);
}
-void MathScriptInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathScript::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
if (hasUp())
up().metricsT(mi, dim);
}
-void MathScriptInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathScript::drawT(TextPainter & pain, int x, int y) const
{
if (nuc().size())
nuc().drawT(pain, x + dxx(), y);
-bool MathScriptInset::hasLimits() const
+bool InsetMathScript::hasLimits() const
{
// obvious cases
if (limits_ == 1)
}
-void MathScriptInset::removeScript(bool up)
+void InsetMathScript::removeScript(bool up)
{
if (nargs() == 2) {
if (up == cell_1_is_up_)
}
-bool MathScriptInset::has(bool up) const
+bool InsetMathScript::has(bool up) const
{
return idxOfScript(up);
}
-bool MathScriptInset::hasUp() const
+bool InsetMathScript::hasUp() const
{
//lyxerr << "1up: " << bool(cell_1_is_up_) << endl;
//lyxerr << "hasUp: " << bool(idxOfScript(true)) << endl;
}
-bool MathScriptInset::hasDown() const
+bool InsetMathScript::hasDown() const
{
//lyxerr << "1up: " << bool(cell_1_is_up_) << endl;
//lyxerr << "hasDown: " << bool(idxOfScript(false)) << endl;
}
-InsetBase::idx_type MathScriptInset::idxOfScript(bool up) const
+InsetBase::idx_type InsetMathScript::idxOfScript(bool up) const
{
if (nargs() == 1)
return 0;
}
-bool MathScriptInset::idxRight(LCursor &) const
+bool InsetMathScript::idxRight(LCursor &) const
{
return false;
}
-bool MathScriptInset::idxLeft(LCursor &) const
+bool InsetMathScript::idxLeft(LCursor &) const
{
return false;
}
-bool MathScriptInset::idxUpDown(LCursor & cur, bool up) const
+bool InsetMathScript::idxUpDown(LCursor & cur, bool up) const
{
// in nucleus?
if (cur.idx() == 0) {
}
-void MathScriptInset::write(WriteStream & os) const
+void InsetMathScript::write(WriteStream & os) const
{
if (nuc().size()) {
if (nuc().size() == 1
}
-void MathScriptInset::normalize(NormalStream & os) const
+void InsetMathScript::normalize(NormalStream & os) const
{
bool d = hasDown() && down().size();
bool u = hasUp() && up().size();
}
-void MathScriptInset::maple(MapleStream & os) const
+void InsetMathScript::maple(MapleStream & os) const
{
if (nuc().size())
os << nuc();
}
-void MathScriptInset::mathematica(MathematicaStream & os) const
+void InsetMathScript::mathematica(MathematicaStream & os) const
{
bool d = hasDown() && down().size();
bool u = hasUp() && up().size();
}
-void MathScriptInset::mathmlize(MathMLStream & os) const
+void InsetMathScript::mathmlize(MathMLStream & os) const
{
bool d = hasDown() && down().size();
bool u = hasUp() && up().size();
}
-void MathScriptInset::octave(OctaveStream & os) const
+void InsetMathScript::octave(OctaveStream & os) const
{
if (nuc().size())
os << nuc();
}
-void MathScriptInset::infoize(std::ostream & os) const
+void InsetMathScript::infoize(std::ostream & os) const
{
os << "Scripts";
}
-void MathScriptInset::infoize2(std::ostream & os) const
+void InsetMathScript::infoize2(std::ostream & os) const
{
if (limits_)
os << (limits_ == 1 ? ", Displayed limits" : ", Inlined limits");
}
-bool MathScriptInset::notifyCursorLeaves(LCursor & cur)
+bool InsetMathScript::notifyCursorLeaves(LCursor & cur)
{
- MathNestInset::notifyCursorLeaves(cur);
+ InsetMathNest::notifyCursorLeaves(cur);
- //lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl;
+ //lyxerr << "InsetMathScript::notifyCursorLeaves: 1 " << cur << endl;
// remove empty scripts if possible
if (nargs() > 2) {
return true;
}
- //lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl;
+ //lyxerr << "InsetMathScript::notifyCursorLeaves: 2 " << cur << endl;
return false;
}
-void MathScriptInset::doDispatch(LCursor & cur, FuncRequest & cmd)
+void InsetMathScript::doDispatch(LCursor & cur, FuncRequest & cmd)
{
- //lyxerr << "MathScriptInset: request: " << cmd << std::endl;
+ //lyxerr << "InsetMathScript: request: " << cmd << std::endl;
if (cmd.action == LFUN_MATH_LIMITS) {
if (!cmd.argument().empty()) {
return;
}
- MathNestInset::doDispatch(cur, cmd);
+ InsetMathNest::doDispatch(cur, cmd);
}
// cell 0. If there is just one script, it's cell 1 and cell_1_is_up_
// is set accordingly. If both are used, cell 1 is up and cell 2 is down.
-class MathScriptInset : public MathNestInset {
+class InsetMathScript : public InsetMathNest {
public:
/// create inset without scripts
- MathScriptInset();
+ InsetMathScript();
/// create inset with single script
- explicit MathScriptInset(bool up);
+ explicit InsetMathScript(bool up);
/// create inset with single script and given nucleus
- MathScriptInset(MathAtom const & at, bool up);
+ InsetMathScript(MathAtom const & at, bool up);
///
mode_type currentMode() const { return MATH_MODE; }
///
void octave(OctaveStream &) const;
/// identifies scriptinsets
- MathScriptInset const * asScriptInset() const;
+ InsetMathScript const * asScriptInset() const;
///
- MathScriptInset * asScriptInset();
+ InsetMathScript * asScriptInset();
/// set limits
void limits(int lim) { limits_ = lim; }
using std::auto_ptr;
-MathSizeInset::MathSizeInset(latexkeys const * l)
- : MathNestInset(1), key_(l), style_(Styles(convert<int>(l->extra)))
+InsetMathSize::InsetMathSize(latexkeys const * l)
+ : InsetMathNest(1), key_(l), style_(Styles(convert<int>(l->extra)))
{}
-auto_ptr<InsetBase> MathSizeInset::doClone() const
+auto_ptr<InsetBase> InsetMathSize::doClone() const
{
- return auto_ptr<InsetBase>(new MathSizeInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSize(*this));
}
-void MathSizeInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathSize::metrics(MetricsInfo & mi, Dimension & dim) const
{
StyleChanger dummy(mi.base, style_);
cell(0).metrics(mi, dim);
}
-void MathSizeInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSize::draw(PainterInfo & pi, int x, int y) const
{
StyleChanger dummy(pi.base, style_);
cell(0).draw(pi, x + 1, y);
}
-void MathSizeInset::write(WriteStream & os) const
+void InsetMathSize::write(WriteStream & os) const
{
os << "{\\" << key_->name << ' ' << cell(0) << '}';
}
-void MathSizeInset::normalize(NormalStream & os) const
+void InsetMathSize::normalize(NormalStream & os) const
{
os << '[' << key_->name << ' ' << cell(0) << ']';
}
-void MathSizeInset::infoize(std::ostream & os) const
+void InsetMathSize::infoize(std::ostream & os) const
{
os << "Size: " << key_->name;
}
class latexkeys;
/// An inset for \scriptsize etc.
-class MathSizeInset : public MathNestInset {
+class InsetMathSize : public InsetMathNest {
public:
///
- explicit MathSizeInset(latexkeys const * l);
+ explicit InsetMathSize(latexkeys const * l);
/// we write extra braces in any case...
bool extraBraces() const { return true; }
///
int const nSpace = sizeof(latex_mathspace)/sizeof(char *);
-MathSpaceInset::MathSpaceInset(int sp)
+InsetMathSpace::InsetMathSpace(int sp)
: space_(sp)
{}
-MathSpaceInset::MathSpaceInset(string const & name)
+InsetMathSpace::InsetMathSpace(string const & name)
: space_(1)
{
for (int i = 0; i < nSpace; ++i)
}
-auto_ptr<InsetBase> MathSpaceInset::doClone() const
+auto_ptr<InsetBase> InsetMathSpace::doClone() const
{
- return auto_ptr<InsetBase>(new MathSpaceInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSpace(*this));
}
-int MathSpaceInset::width() const
+int InsetMathSpace::width() const
{
switch (space_) {
case 0: return 6;
}
-int MathSpaceInset::ascent() const
+int InsetMathSpace::ascent() const
{
return 4;
}
-int MathSpaceInset::descent() const
+int InsetMathSpace::descent() const
{
return 0;
}
-void MathSpaceInset::metrics(MetricsInfo &, Dimension & dim) const
+void InsetMathSpace::metrics(MetricsInfo &, Dimension & dim) const
{
dim.wid = width();
dim.asc = ascent();
}
-void MathSpaceInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSpace::draw(PainterInfo & pi, int x, int y) const
{
// Sadly, HP-UX CC can't handle that kind of initialization.
// XPoint p[4] = {{++x, y-3}, {x, y}, {x+width-2, y}, {x+width-2, y-3}};
}
-void MathSpaceInset::incSpace()
+void InsetMathSpace::incSpace()
{
space_ = (space_ + 1) % (nSpace - 2);
}
-void MathSpaceInset::validate(LaTeXFeatures & features) const
+void InsetMathSpace::validate(LaTeXFeatures & features) const
{
if (space_ >= 0 && space_< nSpace) {
if ((latex_mathspace[space_] == string("negmedspace"))
}
-void MathSpaceInset::maple(MapleStream & os) const
+void InsetMathSpace::maple(MapleStream & os) const
{
os << ' ';
}
-void MathSpaceInset::mathematica(MathematicaStream & os) const
+void InsetMathSpace::mathematica(MathematicaStream & os) const
{
os << ' ';
}
-void MathSpaceInset::octave(OctaveStream & os) const
+void InsetMathSpace::octave(OctaveStream & os) const
{
os << ' ';
}
-void MathSpaceInset::normalize(NormalStream & os) const
+void InsetMathSpace::normalize(NormalStream & os) const
{
os << "[space " << int(space_) << "] ";
}
-void MathSpaceInset::write(WriteStream & os) const
+void InsetMathSpace::write(WriteStream & os) const
{
if (space_ >= 0 && space_ < nSpace) {
os << '\\' << latex_mathspace[space_];
/// Smart spaces
-class MathSpaceInset : public MathInset {
+class InsetMathSpace : public InsetMath {
public:
///
- explicit MathSpaceInset(int sp);
+ explicit InsetMathSpace(int sp);
///
- explicit MathSpaceInset(std::string const & name);
+ explicit InsetMathSpace(std::string const & name);
///
- MathSpaceInset const * asSpaceInset() const { return this; }
+ InsetMathSpace const * asSpaceInset() const { return this; }
///
- MathSpaceInset * asSpaceInset() { return this; }
+ InsetMathSpace * asSpaceInset() { return this; }
///
void incSpace();
///
using std::auto_ptr;
-MathSplitInset::MathSplitInset(string const & name)
- : MathGridInset(1, 1), name_(name)
+InsetMathSplit::InsetMathSplit(string const & name)
+ : InsetMathGrid(1, 1), name_(name)
{
setDefaults();
}
-auto_ptr<InsetBase> MathSplitInset::doClone() const
+auto_ptr<InsetBase> InsetMathSplit::doClone() const
{
- return auto_ptr<InsetBase>(new MathSplitInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSplit(*this));
}
-char MathSplitInset::defaultColAlign(col_type col)
+char InsetMathSplit::defaultColAlign(col_type col)
{
if (name_ == "split")
return 'l';
}
-void MathSplitInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSplit::draw(PainterInfo & pi, int x, int y) const
{
- MathGridInset::draw(pi, x, y);
+ InsetMathGrid::draw(pi, x, y);
setPosCache(pi, x, y);
}
-bool MathSplitInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathSplit::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
switch (cmd.action) {
flag.enabled(false);
return true;
}
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
default:
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
}
-void MathSplitInset::write(WriteStream & ws) const
+void InsetMathSplit::write(WriteStream & ws) const
{
if (ws.fragile())
ws << "\\protect";
ws << "\\begin{" << name_ << '}';
if (name_ == "alignedat")
ws << '{' << static_cast<unsigned int>((ncols() + 1)/2) << '}';
- MathGridInset::write(ws);
+ InsetMathGrid::write(ws);
if (ws.fragile())
ws << "\\protect";
ws << "\\end{" << name_ << "}\n";
}
-void MathSplitInset::infoize(std::ostream & os) const
+void InsetMathSplit::infoize(std::ostream & os) const
{
string name = name_;
name[0] = lyx::support::uppercase(name[0]);
}
-void MathSplitInset::validate(LaTeXFeatures & features) const
+void InsetMathSplit::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
#include "math_gridinset.h"
-class MathSplitInset : public MathGridInset {
+class InsetMathSplit : public InsetMathGrid {
public:
///
- explicit MathSplitInset(std::string const & name);
+ explicit InsetMathSplit(std::string const & name);
///
void draw(PainterInfo & pi, int x, int y) const;
using std::auto_ptr;
-MathSqrtInset::MathSqrtInset()
- : MathNestInset(1)
+InsetMathSqrt::InsetMathSqrt()
+ : InsetMathNest(1)
{}
-auto_ptr<InsetBase> MathSqrtInset::doClone() const
+auto_ptr<InsetBase> InsetMathSqrt::doClone() const
{
- return auto_ptr<InsetBase>(new MathSqrtInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSqrt(*this));
}
-void MathSqrtInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathSqrt::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
dim.asc += 4;
}
-void MathSqrtInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSqrt::draw(PainterInfo & pi, int x, int y) const
{
cell(0).draw(pi, x + 10, y);
int const a = dim_.ascent();
}
-void MathSqrtInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
+void InsetMathSqrt::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
{
cell(0).metricsT(mi, dim);
dim.asc += 1;
}
-void MathSqrtInset::drawT(TextPainter & pain, int x, int y) const
+void InsetMathSqrt::drawT(TextPainter & pain, int x, int y) const
{
cell(0).drawT(pain, x + 2, y);
pain.horizontalLine(x + 2, y - cell(0).ascent(), cell(0).width(), '_');
}
-void MathSqrtInset::write(WriteStream & os) const
+void InsetMathSqrt::write(WriteStream & os) const
{
os << "\\sqrt{" << cell(0) << '}';
}
-void MathSqrtInset::normalize(NormalStream & os) const
+void InsetMathSqrt::normalize(NormalStream & os) const
{
os << "[sqrt " << cell(0) << ']';
}
-void MathSqrtInset::maple(MapleStream & os) const
+void InsetMathSqrt::maple(MapleStream & os) const
{
os << "sqrt(" << cell(0) << ')';
}
-void MathSqrtInset::mathematica(MathematicaStream & os) const
+void InsetMathSqrt::mathematica(MathematicaStream & os) const
{
os << "Sqrt[" << cell(0) << ']';
}
-void MathSqrtInset::octave(OctaveStream & os) const
+void InsetMathSqrt::octave(OctaveStream & os) const
{
os << "sqrt(" << cell(0) << ')';
}
-void MathSqrtInset::mathmlize(MathMLStream & os) const
+void InsetMathSqrt::mathmlize(MathMLStream & os) const
{
os << MTag("msqrt") << cell(0) << ETag("msqrt");
}
#include "math_nestinset.h"
-/// \c MathSqrtInset The square root inset.
-class MathSqrtInset : public MathNestInset {
+/// \c InsetMathSqrt The square root inset.
+class InsetMathSqrt : public InsetMathNest {
public:
///
- MathSqrtInset();
+ InsetMathSqrt();
///
void draw(PainterInfo &, int x, int y) const;
///
using std::auto_ptr;
-MathStackrelInset::MathStackrelInset()
+InsetMathStackrel::InsetMathStackrel()
{}
-auto_ptr<InsetBase> MathStackrelInset::doClone() const
+auto_ptr<InsetBase> InsetMathStackrel::doClone() const
{
- return auto_ptr<InsetBase>(new MathStackrelInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathStackrel(*this));
}
-void MathStackrelInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathStackrel::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(1).metrics(mi);
FracChanger dummy(mi.base);
}
-void MathStackrelInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathStackrel::draw(PainterInfo & pi, int x, int y) const
{
int m = x + dim_.width() / 2;
int yo = y - cell(1).ascent() - cell(0).descent() - 1;
}
-void MathStackrelInset::write(WriteStream & os) const
+void InsetMathStackrel::write(WriteStream & os) const
{
os << "\\stackrel{" << cell(0) << "}{" << cell(1) << '}';
}
-void MathStackrelInset::normalize(NormalStream & os) const
+void InsetMathStackrel::normalize(NormalStream & os) const
{
os << "[stackrel " << cell(0) << ' ' << cell(1) << ']';
}
*
* Full author contact details are available in file CREDITS.
*/
-class MathStackrelInset : public MathFracbaseInset {
+class InsetMathStackrel : public InsetMathFracBase {
public:
///
- MathStackrelInset();
+ InsetMathStackrel();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
using std::auto_ptr;
-MathStringInset::MathStringInset(string const & s)
+InsetMathString::InsetMathString(string const & s)
: str_(s)
{}
-auto_ptr<InsetBase> MathStringInset::doClone() const
+auto_ptr<InsetBase> InsetMathString::doClone() const
{
- return auto_ptr<InsetBase>(new MathStringInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathString(*this));
}
-void MathStringInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathString::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_string_dim(mi.base.font, str_, dim);
}
-void MathStringInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathString::draw(PainterInfo & pi, int x, int y) const
{
//lyxerr << "drawing '" << str_ << "' code: " << code_ << endl;
docstring dstr(str_.begin(), str_.end());
}
-void MathStringInset::normalize(NormalStream & os) const
+void InsetMathString::normalize(NormalStream & os) const
{
os << "[string " << str_ << ' ' << "mathalpha" << ']';
}
-void MathStringInset::maple(MapleStream & os) const
+void InsetMathString::maple(MapleStream & os) const
{
if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
os << ' ' << str_ << ' ';
}
-void MathStringInset::mathematica(MathematicaStream & os) const
+void InsetMathString::mathematica(MathematicaStream & os) const
{
os << ' ' << str_ << ' ';
}
-void MathStringInset::octave(OctaveStream & os) const
+void InsetMathString::octave(OctaveStream & os) const
{
if (/*code_ != LM_TC_VAR ||*/ str_.size() <= 1) {
os << ' ' << str_ << ' ';
}
-void MathStringInset::mathmlize(MathMLStream & os) const
+void InsetMathString::mathmlize(MathMLStream & os) const
{
/*
if (code_ == LM_TC_VAR)
}
-void MathStringInset::write(WriteStream & os) const
+void InsetMathString::write(WriteStream & os) const
{
os << str_;
}
* mainly for math-extern
*/
-class MathStringInset : public MathInset {
+class InsetMathString : public InsetMath {
public:
///
- explicit MathStringInset(std::string const & s);
+ explicit InsetMathString(std::string const & s);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
///
std::string str() const { return str_; }
///
- MathStringInset * asStringInset() { return this; }
+ InsetMathString * asStringInset() { return this; }
///
- MathStringInset const * asStringInset() const { return this; }
+ InsetMathString const * asStringInset() const { return this; }
///
void normalize(NormalStream &) const;
using std::auto_ptr;
-MathSubstackInset::MathSubstackInset()
- : MathGridInset(1, 1)
+InsetMathSubstack::InsetMathSubstack()
+ : InsetMathGrid(1, 1)
{}
-auto_ptr<InsetBase> MathSubstackInset::doClone() const
+auto_ptr<InsetBase> InsetMathSubstack::doClone() const
{
- return auto_ptr<InsetBase>(new MathSubstackInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSubstack(*this));
}
-void MathSubstackInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (mi.base.style == LM_ST_DISPLAY) {
StyleChanger dummy(mi.base, LM_ST_TEXT);
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
} else {
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
}
dim_ = dim;
}
-void MathSubstackInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSubstack::draw(PainterInfo & pi, int x, int y) const
{
- MathGridInset::draw(pi, x + 1, y);
+ InsetMathGrid::draw(pi, x + 1, y);
}
-bool MathSubstackInset::getStatus(LCursor & cur, FuncRequest const & cmd,
+bool InsetMathSubstack::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const
{
switch (cmd.action) {
flag.enabled(false);
return true;
}
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
default:
- return MathGridInset::getStatus(cur, cmd, flag);
+ return InsetMathGrid::getStatus(cur, cmd, flag);
}
}
-void MathSubstackInset::infoize(std::ostream & os) const
+void InsetMathSubstack::infoize(std::ostream & os) const
{
os << "Substack ";
}
-void MathSubstackInset::write(WriteStream & os) const
+void InsetMathSubstack::write(WriteStream & os) const
{
os << "\\substack{";
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
os << "}\n";
}
-void MathSubstackInset::normalize(NormalStream & os) const
+void InsetMathSubstack::normalize(NormalStream & os) const
{
os << "[substack ";
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathSubstackInset::maple(MapleStream & os) const
+void InsetMathSubstack::maple(MapleStream & os) const
{
os << "substack(";
- MathGridInset::maple(os);
+ InsetMathGrid::maple(os);
os << ')';
}
-void MathSubstackInset::validate(LaTeXFeatures & features) const
+void InsetMathSubstack::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathGridInset::validate(features);
+ InsetMathGrid::validate(features);
}
/// support for AMS's \\substack
-class MathSubstackInset : public MathGridInset {
+class InsetMathSubstack : public InsetMathGrid {
public:
///
- MathSubstackInset();
+ InsetMathSubstack();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
- MathSubstackInset const * asSubstackInset() const { return this; }
+ InsetMathSubstack const * asSubstackInset() const { return this; }
///
bool getStatus(LCursor & cur, FuncRequest const & cmd,
}
-string asString(MathInset const & inset)
+string asString(InsetMath const & inset)
{
std::ostringstream os;
WriteStream ws(os);
class Dimension;
class MathArray;
class MathAtom;
-class MathInset;
+class InsetMath;
void mathed_char_dim(LyXFont const &, unsigned char c, Dimension & dim);
// converts single cell to string
std::string asString(MathArray const & ar);
// converts single inset to string
-std::string asString(MathInset const &);
+std::string asString(InsetMath const &);
std::string asString(MathAtom const &);
// converts string to single cell
void asArray(std::string const & str, MathArray & ar);
using std::auto_ptr;
-MathSymbolInset::MathSymbolInset(latexkeys const * l)
+InsetMathSymbol::InsetMathSymbol(latexkeys const * l)
: sym_(l), h_(0), width_(0), scriptable_(false)
{}
-MathSymbolInset::MathSymbolInset(char const * name)
+InsetMathSymbol::InsetMathSymbol(char const * name)
: sym_(in_word_set(name)), h_(0), width_(0), scriptable_(false)
{}
-MathSymbolInset::MathSymbolInset(string const & name)
+InsetMathSymbol::InsetMathSymbol(string const & name)
: sym_(in_word_set(name.c_str())), h_(0), width_(0), scriptable_(false)
{}
-auto_ptr<InsetBase> MathSymbolInset::doClone() const
+auto_ptr<InsetBase> InsetMathSymbol::doClone() const
{
- return auto_ptr<InsetBase>(new MathSymbolInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathSymbol(*this));
}
-string MathSymbolInset::name() const
+string InsetMathSymbol::name() const
{
return sym_->name;
}
-void MathSymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathSymbol::metrics(MetricsInfo & mi, Dimension & dim) const
{
//lyxerr << "metrics: symbol: '" << sym_->name
// << "' in font: '" << sym_->inset
}
-void MathSymbolInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathSymbol::draw(PainterInfo & pi, int x, int y) const
{
//lyxerr << "metrics: symbol: '" << sym_->name
// << "' in font: '" << sym_->inset
}
-bool MathSymbolInset::isRelOp() const
+bool InsetMathSymbol::isRelOp() const
{
return sym_->extra == "mathrel";
}
-bool MathSymbolInset::isScriptable() const
+bool InsetMathSymbol::isScriptable() const
{
return scriptable_;
}
-bool MathSymbolInset::takesLimits() const
+bool InsetMathSymbol::takesLimits() const
{
return
sym_->inset == "cmex" ||
}
-void MathSymbolInset::validate(LaTeXFeatures & features) const
+void InsetMathSymbol::validate(LaTeXFeatures & features) const
{
if (!sym_->requires.empty())
features.require(sym_->requires);
}
-void MathSymbolInset::normalize(NormalStream & os) const
+void InsetMathSymbol::normalize(NormalStream & os) const
{
os << "[symbol " << name() << ']';
}
-void MathSymbolInset::maple(MapleStream & os) const
+void InsetMathSymbol::maple(MapleStream & os) const
{
if (name() == "cdot")
os << '*';
os << name();
}
-void MathSymbolInset::maxima(MaximaStream & os) const
+void InsetMathSymbol::maxima(MaximaStream & os) const
{
if (name() == "cdot")
os << '*';
}
-void MathSymbolInset::mathematica(MathematicaStream & os) const
+void InsetMathSymbol::mathematica(MathematicaStream & os) const
{
if ( name() == "pi") { os << "Pi"; return;}
if ( name() == "infty") { os << "Infinity"; return;}
}
-void MathSymbolInset::mathmlize(MathMLStream & os) const
+void InsetMathSymbol::mathmlize(MathMLStream & os) const
{
char const * type = MathMLtype(sym_->extra);
os << '<' << type << "> ";
}
-void MathSymbolInset::octave(OctaveStream & os) const
+void InsetMathSymbol::octave(OctaveStream & os) const
{
if (name() == "cdot")
os << '*';
}
-void MathSymbolInset::write(WriteStream & os) const
+void InsetMathSymbol::write(WriteStream & os) const
{
os << '\\' << name();
os.pendingSpace(true);
}
-void MathSymbolInset::infoize2(std::ostream & os) const
+void InsetMathSymbol::infoize2(std::ostream & os) const
{
os << "Symbol: " << name();
}
/** "normal" symbols that don't take limits and don't grow in displayed
* formulae.
*/
-class MathSymbolInset : public MathInset {
+class InsetMathSymbol : public InsetMath {
public:
///
- explicit MathSymbolInset(latexkeys const * l);
+ explicit InsetMathSymbol(latexkeys const * l);
///
- explicit MathSymbolInset(char const * name);
+ explicit InsetMathSymbol(char const * name);
///
- explicit MathSymbolInset(std::string const & name);
+ explicit InsetMathSymbol(std::string const & name);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
/// do we take \limits or \nolimits?
bool takesLimits() const;
/// identifies SymbolInset as such
- MathSymbolInset const * asSymbolInset() const { return this; }
+ InsetMathSymbol const * asSymbolInset() const { return this; }
/// the LaTeX name of the symbol (without the backslash)
std::string name() const;
/// request "external features"
using std::auto_ptr;
-MathTabularInset::MathTabularInset(string const & name, int m, int n)
- : MathGridInset(m, n), name_(name)
+InsetMathTabular::InsetMathTabular(string const & name, int m, int n)
+ : InsetMathGrid(m, n), name_(name)
{}
-MathTabularInset::MathTabularInset(string const & name, int m, int n,
+InsetMathTabular::InsetMathTabular(string const & name, int m, int n,
char valign, string const & halign)
- : MathGridInset(m, n, valign, halign), name_(name)
+ : InsetMathGrid(m, n, valign, halign), name_(name)
{}
-MathTabularInset::MathTabularInset(string const & name, char valign,
+InsetMathTabular::InsetMathTabular(string const & name, char valign,
string const & halign)
- : MathGridInset(valign, halign), name_(name)
+ : InsetMathGrid(valign, halign), name_(name)
{}
-auto_ptr<InsetBase> MathTabularInset::doClone() const
+auto_ptr<InsetBase> InsetMathTabular::doClone() const
{
- return auto_ptr<InsetBase>(new MathTabularInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathTabular(*this));
}
-void MathTabularInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathTabular::metrics(MetricsInfo & mi, Dimension & dim) const
{
FontSetChanger dummy(mi.base, "textnormal");
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
dim.wid += 6;
dim_ = dim;
}
-void MathTabularInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathTabular::draw(PainterInfo & pi, int x, int y) const
{
FontSetChanger dummy(pi.base, "textnormal");
- MathGridInset::drawWithMargin(pi, x, y, 4, 2);
+ InsetMathGrid::drawWithMargin(pi, x, y, 4, 2);
}
-void MathTabularInset::write(WriteStream & os) const
+void InsetMathTabular::write(WriteStream & os) const
{
if (os.fragile())
os << "\\protect";
os << '[' << char(v_align_) << ']';
os << '{' << halign() << "}\n";
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
if (os.fragile())
os << "\\protect";
}
-void MathTabularInset::infoize(std::ostream & os) const
+void InsetMathTabular::infoize(std::ostream & os) const
{
string name = name_;
name[0] = lyx::support::uppercase(name[0]);
}
-void MathTabularInset::normalize(NormalStream & os) const
+void InsetMathTabular::normalize(NormalStream & os) const
{
os << '[' << name_ << ' ';
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathTabularInset::maple(MapleStream & os) const
+void InsetMathTabular::maple(MapleStream & os) const
{
os << "array(";
- MathGridInset::maple(os);
+ InsetMathGrid::maple(os);
os << ')';
}
/// Inset for things like \begin{tabular}...\end{tabular}
-class MathTabularInset : public MathGridInset {
+class InsetMathTabular : public InsetMathGrid {
public:
///
- MathTabularInset(std::string const &, int m, int n);
+ InsetMathTabular(std::string const &, int m, int n);
///
- MathTabularInset(std::string const &, int m, int n,
+ InsetMathTabular(std::string const &, int m, int n,
char valign, std::string const & halign);
///
- MathTabularInset(std::string const &, char valign, std::string const & halign);
+ InsetMathTabular(std::string const &, char valign, std::string const & halign);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///
- MathTabularInset * asTabularInset() { return this; }
+ InsetMathTabular * asTabularInset() { return this; }
///
- MathTabularInset const * asTabularInset() const { return this; }
+ InsetMathTabular const * asTabularInset() const { return this; }
///
void write(WriteStream & os) const;
using std::auto_ptr;
-MathTfracInset::MathTfracInset()
- : MathFracInset()
+InsetMathTFrac::InsetMathTFrac()
+ : InsetMathFrac()
{}
-auto_ptr<InsetBase> MathTfracInset::doClone() const
+auto_ptr<InsetBase> InsetMathTFrac::doClone() const
{
- return auto_ptr<InsetBase>(new MathTfracInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathTFrac(*this));
}
-void MathTfracInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathTFrac::metrics(MetricsInfo & mi, Dimension & dim) const
{
StyleChanger dummy(mi.base, LM_ST_SCRIPT);
cell(0).metrics(mi);
}
-void MathTfracInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathTFrac::draw(PainterInfo & pi, int x, int y) const
{
StyleChanger dummy(pi.base, LM_ST_SCRIPT);
int m = x + dim_.wid / 2;
}
-string MathTfracInset::name() const
+string InsetMathTFrac::name() const
{
return "tfrac";
}
-void MathTfracInset::mathmlize(MathMLStream & os) const
+void InsetMathTFrac::mathmlize(MathMLStream & os) const
{
os << MTag("mtfrac") << cell(0) << cell(1) << ETag("mtfrac");
}
-void MathTfracInset::validate(LaTeXFeatures & features) const
+void InsetMathTFrac::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
/// \dfrac support
-class MathTfracInset : public MathFracInset {
+class InsetMathTFrac : public InsetMathFrac {
public:
///
- MathTfracInset();
+ InsetMathTFrac();
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
-auto_ptr<InsetBase> MathUndersetInset::doClone() const
+auto_ptr<InsetBase> InsetMathUnderset::doClone() const
{
- return auto_ptr<InsetBase>(new MathUndersetInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathUnderset(*this));
}
-void MathUndersetInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathUnderset::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(1).metrics(mi);
FracChanger dummy(mi.base);
}
-void MathUndersetInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathUnderset::draw(PainterInfo & pi, int x, int y) const
{
int m = x + width() / 2;
int yo = y + cell(1).descent() + cell(0).ascent() + 1;
}
-bool MathUndersetInset::idxFirst(LCursor & cur) const
+bool InsetMathUnderset::idxFirst(LCursor & cur) const
{
cur.idx() = 1;
cur.pos() = 0;
}
-bool MathUndersetInset::idxLast(LCursor & cur) const
+bool InsetMathUnderset::idxLast(LCursor & cur) const
{
cur.idx() = 1;
cur.pos() = cur.lastpos();
}
-bool MathUndersetInset::idxUpDown(LCursor & cur, bool up) const
+bool InsetMathUnderset::idxUpDown(LCursor & cur, bool up) const
{
idx_type target = up; // up ? 1 : 0, since upper cell has idx 1
if (cur.idx() == target)
}
-void MathUndersetInset::write(WriteStream & os) const
+void InsetMathUnderset::write(WriteStream & os) const
{
os << "\\underset{" << cell(0) << "}{" << cell(1) << '}';
}
-void MathUndersetInset::normalize(NormalStream & os) const
+void InsetMathUnderset::normalize(NormalStream & os) const
{
os << "[underset " << cell(0) << ' ' << cell(1) << ']';
}
-void MathUndersetInset::validate(LaTeXFeatures & features) const
+void InsetMathUnderset::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
#include "math_fracbase.h"
/// Inset for underset
-class MathUndersetInset : public MathFracbaseInset {
+class InsetMathUnderset : public InsetMathFracBase {
public:
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
using std::auto_ptr;
-MathUnknownInset::MathUnknownInset(string const & nm, bool final, bool black)
+InsetMathUnknown::InsetMathUnknown(string const & nm, bool final, bool black)
: name_(nm), final_(final), black_(black)
{}
-auto_ptr<InsetBase> MathUnknownInset::doClone() const
+auto_ptr<InsetBase> InsetMathUnknown::doClone() const
{
- return auto_ptr<InsetBase>(new MathUnknownInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathUnknown(*this));
}
-string MathUnknownInset::name() const
+string InsetMathUnknown::name() const
{
return name_;
}
-void MathUnknownInset::setName(string const & name)
+void InsetMathUnknown::setName(string const & name)
{
name_ = name;
}
-void MathUnknownInset::normalize(NormalStream & os) const
+void InsetMathUnknown::normalize(NormalStream & os) const
{
os << "[unknown " << name_ << ']';
}
-void MathUnknownInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathUnknown::metrics(MetricsInfo & mi, Dimension & dim) const
{
mathed_string_dim(mi.base.font, name_, dim);
dim_ = dim;
}
-void MathUnknownInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathUnknown::draw(PainterInfo & pi, int x, int y) const
{
if (black_)
drawStrBlack(pi, x, y, name_);
}
-void MathUnknownInset::finalize()
+void InsetMathUnknown::finalize()
{
final_ = true;
}
-bool MathUnknownInset::final() const
+bool InsetMathUnknown::final() const
{
return final_;
}
-void MathUnknownInset::maple(MapleStream & os) const
+void InsetMathUnknown::maple(MapleStream & os) const
{
os << name_;
}
-void MathUnknownInset::mathematica(MathematicaStream & os) const
+void InsetMathUnknown::mathematica(MathematicaStream & os) const
{
os << name_;
}
-void MathUnknownInset::mathmlize(MathMLStream & os) const
+void InsetMathUnknown::mathmlize(MathMLStream & os) const
{
os << MTag("mi") << name_ << ETag("mi");
}
-void MathUnknownInset::octave(OctaveStream & os) const
+void InsetMathUnknown::octave(OctaveStream & os) const
{
os << name_;
}
/// LaTeX names for objects that we really don't know
-class MathUnknownInset : public MathDimInset {
+class InsetMathUnknown : public InsetMathDim {
public:
///
- explicit MathUnknownInset(std::string const & name,
+ explicit InsetMathUnknown(std::string const & name,
bool final = true, bool black = false);
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
std::string name() const;
/// identifies UnknownInsets
- MathUnknownInset const * asUnknownInset() const { return this; }
+ InsetMathUnknown const * asUnknownInset() const { return this; }
/// identifies UnknownInsets
- MathUnknownInset * asUnknownInset() { return this; }
+ InsetMathUnknown * asUnknownInset() { return this; }
///
void normalize(NormalStream &) const;
using std::auto_ptr;
-MathXArrowInset::MathXArrowInset(string const & name)
- : MathFracbaseInset(), name_(name)
+InsetMathXArrow::InsetMathXArrow(string const & name)
+ : InsetMathFracBase(), name_(name)
{}
-auto_ptr<InsetBase> MathXArrowInset::doClone() const
+auto_ptr<InsetBase> InsetMathXArrow::doClone() const
{
- return auto_ptr<InsetBase>(new MathXArrowInset(*this));
+ return auto_ptr<InsetBase>(new InsetMathXArrow(*this));
}
-void MathXArrowInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathXArrow::metrics(MetricsInfo & mi, Dimension & dim) const
{
ScriptChanger dummy(mi.base);
cell(0).metrics(mi);
}
-void MathXArrowInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathXArrow::draw(PainterInfo & pi, int x, int y) const
{
ScriptChanger dummy(pi.base);
cell(0).draw(pi, x + 5, y - 10);
}
-void MathXArrowInset::write(WriteStream & os) const
+void InsetMathXArrow::write(WriteStream & os) const
{
os << '\\' << name_;
if (cell(1).size())
}
-void MathXArrowInset::normalize(NormalStream & os) const
+void InsetMathXArrow::normalize(NormalStream & os) const
{
os << "[xarrow " << name_ << ' ' << cell(0) << ' ' << cell(1) << ']';
}
-void MathXArrowInset::validate(LaTeXFeatures & features) const
+void InsetMathXArrow::validate(LaTeXFeatures & features) const
{
features.require("amsmath");
- MathNestInset::validate(features);
+ InsetMathNest::validate(features);
}
/// Wide arrows like \xrightarrow
-class MathXArrowInset : public MathFracbaseInset {
+class InsetMathXArrow : public InsetMathFracBase {
public:
///
- explicit MathXArrowInset(std::string const & name);
+ explicit InsetMathXArrow(std::string const & name);
///
void draw(PainterInfo & pi, int x, int y) const;
///
using std::max;
-MathXYArrowInset::MathXYArrowInset()
- : MathNestInset(2)
+InsetMathXYArrow::InsetMathXYArrow()
+ : InsetMathNest(2)
{}
-std::auto_ptr<InsetBase> MathXYArrowInset::clone() const
+std::auto_ptr<InsetBase> InsetMathXYArrow::clone() const
{
- return std::auto_ptr<InsetBase>(new MathXYArrowInset(*this));
+ return std::auto_ptr<InsetBase>(new InsetMathXYArrow(*this));
}
-MathXYMatrixInset const * MathXYArrowInset::targetMatrix() const
+InsetMathXYMatrix const * InsetMathXYArrow::targetMatrix() const
{
return target_;
}
-MathArray const & MathXYArrowInset::targetCell() const
+MathArray const & InsetMathXYArrow::targetCell() const
{
#if 0
- MathXYMatrixInset const * p = targetMatrix();
+ InsetMathXYMatrix const * p = targetMatrix();
int x = 0;
int y = 0;
MathArray const & t = cell(0);
}
}
//lyxerr << "target: x: " << x << " y: " << y << endl;
- MathInset::idx_type n = mi_.idx + p->ncols() * y + x;
+ InsetMath::idx_type n = mi_.idx + p->ncols() * y + x;
if (n >= p->nargs()) {
lyxerr << "source: n: " << mi_.idx << "\n"
<< "target: n: " << n << " out of range" << endl;
}
-MathArray const & MathXYArrowInset::sourceCell() const
+MathArray const & InsetMathXYArrow::sourceCell() const
{
#if 0
return targetMatrix()->cell(mi_.idx);
}
-void MathXYArrowInset::metrics(MetricsInfo & mi) const
+void InsetMathXYArrow::metrics(MetricsInfo & mi) const
{
- MathNestInset::metrics(mi);
+ InsetMathNest::metrics(mi);
mi_ = mi;
FontSetChanger dummy(mi.base, "textrm");
#if 0
}
-void MathXYArrowInset::draw(PainterInfo & pi, int x, int y) const
+void InsetMathXYArrow::draw(PainterInfo & pi, int x, int y) const
{
metrics(mi_);
FontSetChanger dummy(pi.base, "textrm");
}
-void MathXYArrowInset::write(WriteStream & os) const
+void InsetMathXYArrow::write(WriteStream & os) const
{
os << "\\ar";
if (cell(0).size())
}
-void MathXYArrowInset::normalize(NormalStream & os) const
+void InsetMathXYArrow::normalize(NormalStream & os) const
{
os << "[xyarrow ";
- MathNestInset::normalize(os);
+ InsetMathNest::normalize(os);
os << ']';
}
// for the \ar stuff in \xymatrix
-class MathXYMatrixInset;
+class InsetMathXYMatrix;
-class MathXYArrowInset : public MathNestInset {
+class InsetMathXYArrow : public InsetMathNest {
public:
///
- MathXYArrowInset();
+ InsetMathXYArrow();
///
virtual std::auto_ptr<InsetBase> clone() const;
///
///
void draw(PainterInfo & pi, int x, int y) const;
///
- MathXYArrowInset * asXYArrowInset() { return this; }
+ InsetMathXYArrow * asXYArrowInset() { return this; }
///
void normalize();
public:
///
- MathXYMatrixInset const * targetMatrix() const;
+ InsetMathXYMatrix const * targetMatrix() const;
///
MathArray const & targetCell() const;
///
///
mutable LyXFont font_;
///
- mutable MathXYMatrixInset const * target_;
+ mutable InsetMathXYMatrix const * target_;
};
#endif
#include "support/std_ostream.h"
-MathXYMatrixInset::MathXYMatrixInset()
- : MathGridInset(1, 1)
+InsetMathXYMatrix::InsetMathXYMatrix()
+ : InsetMathGrid(1, 1)
{}
-std::auto_ptr<InsetBase> MathXYMatrixInset::doClone() const
+std::auto_ptr<InsetBase> InsetMathXYMatrix::doClone() const
{
- return std::auto_ptr<InsetBase>(new MathXYMatrixInset(*this));
+ return std::auto_ptr<InsetBase>(new InsetMathXYMatrix(*this));
}
-int MathXYMatrixInset::colsep() const
+int InsetMathXYMatrix::colsep() const
{
return 40;
}
-int MathXYMatrixInset::rowsep() const
+int InsetMathXYMatrix::rowsep() const
{
return 40;
}
-void MathXYMatrixInset::metrics(MetricsInfo & mi, Dimension & dim) const
+void InsetMathXYMatrix::metrics(MetricsInfo & mi, Dimension & dim) const
{
if (mi.base.style == LM_ST_DISPLAY)
mi.base.style = LM_ST_TEXT;
- MathGridInset::metrics(mi, dim);
+ InsetMathGrid::metrics(mi, dim);
}
-void MathXYMatrixInset::write(WriteStream & os) const
+void InsetMathXYMatrix::write(WriteStream & os) const
{
os << "\\xymatrix{";
- MathGridInset::write(os);
+ InsetMathGrid::write(os);
os << "}\n";
}
-void MathXYMatrixInset::infoize(std::ostream & os) const
+void InsetMathXYMatrix::infoize(std::ostream & os) const
{
os << "xymatrix ";
- MathGridInset::infoize(os);
+ InsetMathGrid::infoize(os);
}
-void MathXYMatrixInset::normalize(NormalStream & os) const
+void InsetMathXYMatrix::normalize(NormalStream & os) const
{
os << "[xymatrix ";
- MathGridInset::normalize(os);
+ InsetMathGrid::normalize(os);
os << ']';
}
-void MathXYMatrixInset::maple(MapleStream & os) const
+void InsetMathXYMatrix::maple(MapleStream & os) const
{
os << "xymatrix(";
- MathGridInset::maple(os);
+ InsetMathGrid::maple(os);
os << ')';
}
#include "math_gridinset.h"
-class MathXYMatrixInset : public MathGridInset {
+class InsetMathXYMatrix : public InsetMathGrid {
public:
///
- MathXYMatrixInset();
+ InsetMathXYMatrix();
///
void metrics(MetricsInfo &, Dimension &) const;
///
- MathXYMatrixInset const * asXYMatrixInset() const { return this; }
+ InsetMathXYMatrix const * asXYMatrixInset() const { return this; }
///
virtual int colsep() const;
///
case LFUN_INSET_MODIFY:
if (cmd.getArg(0) == "ref") {
MathArray ar;
- if (createMathInset_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
+ if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
*this = *ar[0].nucleus()->asRefInset();
break;
}
LCursor old = cur;
// Go to middle of previous row. 16 found to work OK;
// 12 = top/bottom margin of display math
- int const margin = 3 * MathHullInset::displayMargin() / 2;
+ int const margin = 3 * InsetMathHull::displayMargin() / 2;
editXY(cur, x, y - par.rows()[row].ascent() - margin);
cur.clearSelection();
int const y = bv_funcs::getPos(cur, cur.boundary()).y_;
LCursor old = cur;
// To middle of next row
- int const margin = 3 * MathHullInset::displayMargin() / 2;
+ int const margin = 3 * InsetMathHull::displayMargin() / 2;
editXY(cur, x, y + par.rows()[row].descent() + margin);
cur.clearSelection();
if (sel.empty()) {
const int old_pos = cur.pos();
- cur.insert(new MathHullInset(hullSimple));
+ cur.insert(new InsetMathHull(hullSimple));
BOOST_ASSERT(old_pos == cur.pos());
cur.nextInset()->edit(cur, true);
// don't do that also for LFUN_MATH_MODE
if (sel.find("\\newcommand") == string::npos
&& sel.find("\\def") == string::npos)
{
- MathHullInset * formula = new MathHullInset;
+ InsetMathHull * formula = new InsetMathHull;
LyXLex lex(0, 0);
lex.setStream(is);
formula->read(cur.buffer(), lex);
case LFUN_MATH_MATRIX:
case LFUN_MATH_DELIM:
case LFUN_MATH_BIGDELIM: {
- cur.insert(new MathHullInset(hullSimple));
+ cur.insert(new InsetMathHull(hullSimple));
cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
cur.dispatch(cmd);
break;