math_sqrtinset.h \
math_stackrelinset.C \
math_stackrelinset.h \
+ math_streamstr.h \
math_stringinset.C \
math_stringinset.h \
math_support.C \
}
-int InsetFormula::latex(Buffer const * buf, ostream & os, bool fragil, bool)
- const
+int InsetFormula::latex(Buffer const *, ostream & os, bool fragil, bool) const
{
- WriteStream wi(buf, os, fragil);
+ WriteStream wi(os, fragil);
par_->write(wi);
- return wi.line_;
+ return wi.line();
}
-int InsetFormula::ascii(Buffer const * buf, ostream & os, int) const
+int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
- WriteStream wi(buf, os, false);
+ WriteStream wi(os, false);
par_->write(wi);
- return wi.line_;
+ return wi.line();
}
{
MathMLStream ms(os);
ms << MTag("equation") << MTag("alt");
- int res = ascii(buf, ms.os_, 0);
+ int res = ascii(buf, ms.os(), 0);
ms << ETag("alt") << MTag("math");
ms << par_.nucleus();
ms << ETag("math") << ETag("equation");
- return ms.line_ + res;
+ return ms.line() + res;
}
case LFUN_MATH_DELIM:
{
- //lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
+ lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
string ls;
string rs;
istringstream is(arg.c_str());
void mathDispatchMathDelim(BufferView * bv, string const & arg)
-{
+{
if (bv->available()) {
if (openNewInset(bv, new InsetFormula))
bv->theLockingInset()->localDispatch(bv, LFUN_MATH_DELIM, arg);
}
-void InsetFormulaMacro::write(Buffer const * buf, ostream & os) const
+void InsetFormulaMacro::write(Buffer const *, ostream & os) const
{
os << "FormulaMacro ";
- WriteStream wi(buf, os, false);
+ WriteStream wi(os, false);
par()->write(wi);
}
-int InsetFormulaMacro::latex(Buffer const * buf, ostream & os, bool fragile,
+int InsetFormulaMacro::latex(Buffer const *, ostream & os, bool fragile,
bool /*free_spacing*/) const
{
- WriteStream wi(buf, os, fragile);
+ WriteStream wi(os, fragile);
par()->write(wi);
return 2;
}
-int InsetFormulaMacro::ascii(Buffer const * buf, ostream & os, int) const
+int InsetFormulaMacro::ascii(Buffer const *, ostream & os, int) const
{
- WriteStream wi(buf, os, false);
+ WriteStream wi(os, false);
par()->write(wi);
return 0;
}
void MathArrayInset::write(WriteStream & os) const
{
- if (os.fragile)
+ if (os.fragile())
os << "\\protect";
os << "\\begin{array}";
MathGridInset::write(os);
- if (os.fragile)
+ if (os.fragile())
os << "\\protect";
os << "\\end{array}\n";
}
void MathCasesInset::write(WriteStream & os) const
{
- if (os.fragile)
+ if (os.fragile())
os << "\\protect";
os << "\\begin{cases}";
MathGridInset::write(os);
- if (os.fragile)
+ if (os.fragile())
os << "\\protect";
os << "\\end{cases}\n";
}
void MathCharInset::write(WriteStream & os) const
{
- writeHeader(os.os);
- writeRaw(os.os);
- writeTrailer(os.os);
+ writeHeader(os.os());
+ writeRaw(os.os());
+ writeTrailer(os.os());
}
int x = c.xo() + c.pos2x(anc.pos_);
int y1 = c.yo() - c.ascent();
int y2 = c.yo() + c.descent();
- pain.line(x, y1, x, y2, LColor::mathline);
+ pain.line(x, y1, x, y2, LColor::math);
}
#endif
}
lyxerr << "this should not really happen - 2: "
<< pos() << " " << size() << " in idx: " << it->idx()
<< " in atom: '";
- WriteStream wi(0, lyxerr, false);
+ WriteStream wi(lyxerr, false);
it->par()->write(wi);
lyxerr << "\n";
dump("error 4");
class Painter;
class Selection;
+/**
+
+[Have a look at math_inset.h first]
+
+The MathCursor is different from the kind of cursor used in the Outer
+World. It contains a stack of MathCursorPositions, each of which is made
+up of a inset pointer, an index and a position offset, marking a path from
+this formula's mathHullInset to the current position.
+
+*/
+
+
/// Description of a position
struct MathCursorPos {
- /// inset
+ /// pointer to an inset
MathAtom * par_;
- /// cell index
+ /// cell index of a position in this inset
MathInset::idx_type idx_;
- /// cell position
+ /// position in this cell
MathInset::pos_type pos_;
/// returns cell corresponding to this position
MathXArray & xcell(MathInset::idx_type idx) const;
};
-///
+/// test for equality
bool operator==(MathCursorPos const &, MathCursorPos const &);
-///
+/// test for unequality
bool operator<(MathCursorPos const &, MathCursorPos const &);
-/// This is the external interface of Math's subkernel
+/// see above
class MathCursor {
public:
/// short of anything else reasonable
void erase();
///
void backspace();
- ///
+ /// called for LFUN_HOME etc
void home(bool sel = false);
- ///
+ /// called for LFUN_END etc
void end(bool sel = false);
- ///
+ /// called for LFUN_RIGHT and LFUN_RIGHTSEL
bool right(bool sel = false);
- ///
+ /// called for LFUN_LEFT etc
bool left(bool sel = false);
- ///
+ /// called for LFUN_UP etc
bool up(bool sel = false);
- ///
+ /// called for LFUN_DOWN etc
bool down(bool sel = false);
/// Put the cursor in the first position
void first();
/// Put the cursor in the last position
void last();
- ///
+ /// move to next cell in current inset
void idxNext();
- ///
+ /// move to previous cell in current inset
void idxPrev();
///
void plainErase();
///
void delLine();
- /// This is in pixels from (maybe?) the top of inset
+ /// in pixels from top of screen
void setPos(int x, int y);
- /// This is in pixels from (maybe?) the top of inset, don't move further
- ///
+ /// in pixels from top of screen
void getPos(int & x, int & y);
- ///
+ ///
MathAtom & par() const;
/// return the next enclosing grid inset and the cursor's index in it
MathGridInset * enclosingGrid(idx_type &) const;
///
InsetFormulaBase const * formula();
- ///
+ /// current offset in the current cell
pos_type pos() const;
- ///
+ /// current cell
idx_type idx() const;
- ///
+ /// size of current cell
size_type size() const;
///
bool interpret(string const &);
bool interpret(char);
///
bool toggleLimits();
- ///
- // Macro mode methods
+ /// interpret name a name of a macro
void macroModeClose();
///
bool inMacroMode() const;
void handleDelim(string const & l, string const & r);
///
void handleNest(MathInset * p);
- /// Splits cells and shifts right part to the next cell
+ /// splits cells and shifts right part to the next cell
void splitCell();
- /// Splits line and insert new row of cell
+ /// splits line and insert new row of cell
void breakLine();
/// read contents of line into an array
void readLine(MathArray & ar) const;
///
row_type row() const;
- /// Make sure cursor position is valid
+ /// make sure cursor position is valid
void normalize() const;
///
UpdatableInset * asHyperActiveInset() const;
/// path of positions the anchor had to go if it were leving each inset
cursor_type Anchor_;
- /// reference to the last item of the path
+ /// reference to the last item of the path, i.e. "The Cursor"
MathCursorPos & cursor();
- ///
+ /// reference to the last item of the path, i.e. "The Cursor"
MathCursorPos const & cursor() const;
- ///
+ /// dump selection information for debugging
void seldump(char const * str) const;
- ///
+ /// dump selection information for debugging
void dump(char const * str) const;
///
void stripFromLastEqualSign();
void MathDecorationInset::write(WriteStream & os) const
{
- if (os.fragile && protect())
+ if (os.fragile() && protect())
os << "\\protect";
os << '\\' << name_.c_str() << '{' << cell(0) << '}';
}
MathArray ar = dat;
extractStrings(ar);
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) {
- wi.firstitem = (it == ar.begin());
+ wi.firstitem() = (it == ar.begin());
MathInset const * p = it->nucleus();
if (it + 1 != ar.end()) {
if (MathScriptInset const * q = asScript(it)) {
xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 3 - 5);
xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent() + 3 - 5);
if (!atop_)
- pain.line(x + 2, y - 5, x + width() - 4, y - 5, LColor::mathline);
+ pain.line(x + 2, y - 5, x + width() - 4, y - 5, LColor::math);
}
#endif
#include "math_gridinset.h"
-#include "math_mathmlstream.h"
+#include "math_streamstr.h"
#include "lyxfont.h"
#include "Painter.h"
#include "debug.h"
#include "debug.h"
-MathInset::MathInset()
-{}
-
-
-MathInset::~MathInset()
-{}
-
-
int MathInset::height() const
{
return ascent() + descent();
std::ostream & operator<<(std::ostream & os, MathInset const & inset)
{
- WriteStream wi(0, os, false);
+ WriteStream wi(os, false);
inset.write(wi);
return os;
}
void MathInset::normalize(NormalStream & os) const
{
os << "[unknown ";
- WriteStream wi(0, os.os_, false);
+ WriteStream wi(os.os(), false);
write(wi);
os << "] ";
}
void MathInset::dump() const
{
lyxerr << "---------------------------------------------\n";
- WriteStream wi(0, lyxerr, false);
+ WriteStream wi(lyxerr, false);
write(wi);
lyxerr << "\n---------------------------------------------\n";
}
void MathInset::octavize(OctaveStream & os) const
{
- NormalStream ns(os.os_);
+ NormalStream ns(os.os());
normalize(ns);
}
void MathInset::maplize(MapleStream & os) const
{
- NormalStream ns(os.os_);
+ NormalStream ns(os.os());
normalize(ns);
}
void MathInset::mathmlize(MathMLStream & os) const
{
- NormalStream ns(os.os_);
+ NormalStream ns(os.os());
normalize(ns);
}
#include "math_xdata.h"
#include "math_defs.h"
-/** Abstract base class for all math objects.
- A math insets is for use of the math editor only, it isn't a
- general LyX inset. It's used to represent all the math objects.
- The formulaInset (a LyX inset) encapsulates a math inset.
+/**
+
+Abstract base class for all math objects. A math insets is for use of the
+math editor only, it isn't a general LyX inset. It's used to represent all
+the math objects.
+
+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
+inclusion in the "real LyX insets" FormulaInset and FormulaMacroInset.
+
*/
/// type for column numbers
typedef size_type col_type;
- ///
- MathInset();
+ /// our members behave nicely...
+ MathInset() {}
/// the virtual base destructor
- virtual ~MathInset();
+ virtual ~MathInset() {}
/// draw the object
virtual void draw(Painter &, int x, int y) const;
{}
-MathMLStream & MathMLStream::operator<<(MathInset const * p)
+MathMLStream & operator<<(MathMLStream & ms, MathInset const * p)
{
if (p)
- p->mathmlize(*this);
+ p->mathmlize(ms);
else
- lyxerr << "MathMLStream::operator<<(NULL) called\n";
- return *this;
+ lyxerr << "operator<<(MathMLStream, NULL) called\n";
+ return ms;
}
-MathMLStream & MathMLStream::operator<<(MathArray const & ar)
+MathMLStream & operator<<(MathMLStream & ms, MathArray const & ar)
{
- mathmlize(ar, *this);
- return *this;
+ mathmlize(ar, ms);
+ return ms;
}
-MathMLStream & MathMLStream::operator<<(char const * s)
+MathMLStream & operator<<(MathMLStream & ms, char const * s)
{
- os_ << s;
- return *this;
+ ms.os() << s;
+ return ms;
}
-MathMLStream & MathMLStream::operator<<(char c)
+MathMLStream & operator<<(MathMLStream & ms, char c)
{
- os_ << c;
- return *this;
+ ms.os() << c;
+ return ms;
}
-MathMLStream & MathMLStream::operator<<(MTag const & t)
+MathMLStream & operator<<(MathMLStream & ms, MTag const & t)
{
- ++tab_;
- cr();
- os_ << '<' << t.tag_ << '>';
- return *this;
+ ++ms.tab();
+ ms.cr();
+ ms.os() << '<' << t.tag_ << '>';
+ return ms;
}
-MathMLStream & MathMLStream::operator<<(ETag const & t)
+MathMLStream & operator<<(MathMLStream & ms, ETag const & t)
{
- cr();
- if (tab_ > 0)
- --tab_;
- os_ << "</" << t.tag_ << '>';
- return *this;
+ ms.cr();
+ if (ms.tab() > 0)
+ --ms.tab();
+ ms.os() << "</" << t.tag_ << '>';
+ return ms;
}
void MathMLStream::cr()
{
- os_ << '\n';
- for (int i = 0; i < tab_; ++i)
- os_ << ' ';
+ os() << '\n';
+ for (int i = 0; i < tab(); ++i)
+ os() << ' ';
}
//////////////////////////////////////////////////////////////////////
-MapleStream & MapleStream::operator<<(MathInset const * p)
+MapleStream & operator<<(MapleStream & ms, MathInset const * p)
{
if (p)
- p->maplize(*this);
+ p->maplize(ms);
else
- lyxerr << "MathMLStream::operator<<(NULL) called\n";
- return *this;
+ lyxerr << "operator<<(MapleStream, NULL) called\n";
+ return ms;
}
-MapleStream & MapleStream::operator<<(MathArray const & ar)
+MapleStream & operator<<(MapleStream & ms, MathArray const & ar)
{
- maplize(ar, *this);
- return *this;
+ maplize(ar, ms);
+ return ms;
}
-MapleStream & MapleStream::operator<<(char const * s)
+MapleStream & operator<<(MapleStream & ms, char const * s)
{
- os_ << s;
- return *this;
+ ms.os() << s;
+ return ms;
}
-MapleStream & MapleStream::operator<<(char c)
+MapleStream & operator<<(MapleStream & ms, char c)
{
- os_ << c;
- return *this;
+ ms.os() << c;
+ return ms;
}
-MapleStream & MapleStream::operator<<(int i)
+MapleStream & operator<<(MapleStream & ms, int i)
{
- os_ << i;
- return *this;
+ ms.os() << i;
+ return ms;
}
//////////////////////////////////////////////////////////////////////
-OctaveStream & OctaveStream::operator<<(MathInset const * p)
+OctaveStream & operator<<(OctaveStream & ns, MathInset const * p)
{
if (p)
- p->octavize(*this);
+ p->octavize(ns);
else
- lyxerr << "MathMLStream::operator<<(NULL) called\n";
- return *this;
+ lyxerr << "operator<<(OctaveStream, NULL) called\n";
+ return ns;
}
-OctaveStream & OctaveStream::operator<<(MathArray const & ar)
+OctaveStream & operator<<(OctaveStream & ns, MathArray const & ar)
{
- octavize(ar, *this);
- return *this;
+ octavize(ar, ns);
+ return ns;
}
-OctaveStream & OctaveStream::operator<<(char const * s)
+OctaveStream & operator<<(OctaveStream & ns, char const * s)
{
- os_ << s;
- return *this;
+ ns.os() << s;
+ return ns;
}
-OctaveStream & OctaveStream::operator<<(char c)
+OctaveStream & operator<<(OctaveStream & ns, char c)
{
- os_ << c;
- return *this;
+ ns.os() << c;
+ return ns;
}
//////////////////////////////////////////////////////////////////////
-NormalStream & NormalStream::operator<<(MathInset const * p)
+NormalStream & operator<<(NormalStream & ns, MathInset const * p)
{
if (p)
- p->normalize(*this);
+ p->normalize(ns);
else
- lyxerr << "MathMLStream::operator<<(NULL) called\n";
- return *this;
+ lyxerr << "operator<<(NormalStream, NULL) called\n";
+ return ns;
}
-NormalStream & NormalStream::operator<<(MathArray const & ar)
+NormalStream & operator<<(NormalStream & ns, MathArray const & ar)
{
- normalize(ar, *this);
- return *this;
+ normalize(ar, ns);
+ return ns;
}
-NormalStream & NormalStream::operator<<(char const * s)
+NormalStream & operator<<(NormalStream & ns, char const * s)
{
- os_ << s;
- return *this;
+ ns.os() << s;
+ return ns;
}
-NormalStream & NormalStream::operator<<(char c)
+NormalStream & operator<<(NormalStream & ns, char c)
{
- os_ << c;
- return *this;
+ ns.os() << c;
+ return ns;
}
//////////////////////////////////////////////////////////////////////
-WriteStream::WriteStream
- (Buffer const * buffer_, std::ostream & os_, bool fragile_)
- : buffer(buffer_), os(os_), fragile(fragile_), line_(0)
+WriteStream::WriteStream(std::ostream & os, bool fragile)
+ : os_(os), fragile_(fragile), line_(0)
{}
-WriteStream::WriteStream(std::ostream & os_)
- : buffer(0), os(os_), fragile(false), line_(0)
+WriteStream::WriteStream(std::ostream & os)
+ : os_(os), fragile_(false), line_(0)
{}
-WriteStream & WriteStream::operator<<(MathInset const * p)
+WriteStream & operator<<(WriteStream & ws, MathInset const * p)
{
if (p)
- p->write(*this);
+ p->write(ws);
else
- lyxerr << "MathMLStream::operator<<(NULL) called\n";
- return *this;
+ lyxerr << "operator<<(WriteStream, NULL) called\n";
+ return ws;
}
-WriteStream & WriteStream::operator<<(MathArray const & ar)
+WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
{
- write(ar, *this);
- return *this;
+ write(ar, ws);
+ return ws;
}
-WriteStream & WriteStream::operator<<(string const & s)
+WriteStream & operator<<(WriteStream & ws, char const * s)
{
- os << s;
- string::const_iterator cit = s.begin();
- string::const_iterator end = s.end();
- for ( ; cit != end ; ++cit) {
- if (*cit == '\n')
- ++line_;
- }
- return *this;
-}
-
-
-WriteStream & WriteStream::operator<<(char const * s)
-{
- os << s;
+ ws.os() << s;
for ( ; *s ; ++s) {
if (*s == '\n')
- ++line_;
+ ++ws.line();
}
- return *this;
+ return ws;
}
-WriteStream & WriteStream::operator<<(char c)
+WriteStream & operator<<(WriteStream & ws, char c)
{
- os << c;
+ ws.os() << c;
if (c == '\n')
- ++line_;
- return *this;
+ ++ws.line();
+ return ws;
}
-WriteStream & WriteStream::operator<<(int i)
+WriteStream & operator<<(WriteStream & ws, int i)
{
- os << i;
- return *this;
+ ws.os() << i;
+ return ws;
}
-WriteStream & WriteStream::operator<<(unsigned int i)
+WriteStream & operator<<(WriteStream & ws, unsigned int i)
{
- os << i;
- return *this;
+ ws.os() << i;
+ return ws;
}
#ifndef MATH_MATHMLSTREAM_H
#define MATH_MATHMLSTREAM_H
-#include "LString.h"
-#include "support/LOstream.h"
+// Please keep all four streams in one file until the interface has
+// settled.
+
#include <iosfwd>
-struct MathArray;
-struct MathInset;
-struct Buffer;
+class MathArray;
+class MathInset;
+
+
+//
+// MathML
+//
struct MTag {
///
char const * const tag_;
};
-struct MathMLStream {
+class MathMLStream {
+public:
///
explicit MathMLStream(std::ostream & os);
///
- MathMLStream & operator<<(MathInset const *);
- ///
- MathMLStream & operator<<(MathArray const &);
- ///
- MathMLStream & operator<<(char const *);
+ void cr();
///
- MathMLStream & operator<<(char);
+ std::ostream & os() { return os_; }
///
- MathMLStream & operator<<(MTag const &);
+ int & line() { return line_; }
///
- MathMLStream & operator<<(ETag const &);
- ///
- void cr();
-
+ int & tab() { return tab_; }
+private:
///
std::ostream & os_;
///
char lastchar_;
};
+///
+MathMLStream & operator<<(MathMLStream &, MathInset const *);
+///
+MathMLStream & operator<<(MathMLStream &, MathArray const &);
+///
+MathMLStream & operator<<(MathMLStream &, char const *);
+///
+MathMLStream & operator<<(MathMLStream &, char);
+///
+MathMLStream & operator<<(MathMLStream &, MTag const &);
+///
+MathMLStream & operator<<(MathMLStream &, ETag const &);
+
-struct NormalStream {
+
+//
+// Debugging
+//
+
+class NormalStream {
+public:
///
explicit NormalStream(std::ostream & os) : os_(os) {}
///
- std::ostream & os_;
+ std::ostream & os() { return os_; }
+private:
///
- NormalStream & operator<<(MathInset const *);
- ///
- NormalStream & operator<<(MathArray const &);
- ///
- NormalStream & operator<<(char const *);
- ///
- NormalStream & operator<<(char);
+ std::ostream & os_;
};
+///
+NormalStream & operator<<(NormalStream &, MathInset const *);
+///
+NormalStream & operator<<(NormalStream &, MathArray const &);
+///
+NormalStream & operator<<(NormalStream &, char const *);
+///
+NormalStream & operator<<(NormalStream &, char);
+
+
-struct MapleStream {
+
+//
+// Maple
+//
+
+
+class MapleStream {
+public:
///
explicit MapleStream(std::ostream & os) : os_(os) {}
///
- std::ostream & os_;
- ///
- MapleStream & operator<<(MathInset const *);
- ///
- MapleStream & operator<<(MathArray const &);
+ std::ostream & os() { return os_; }
+private:
///
- MapleStream & operator<<(char const *);
- ///
- MapleStream & operator<<(char);
- ///
- MapleStream & operator<<(int);
+ std::ostream & os_;
};
-struct OctaveStream {
+///
+MapleStream & operator<<(MapleStream &, MathInset const *);
+///
+MapleStream & operator<<(MapleStream &, MathArray const &);
+///
+MapleStream & operator<<(MapleStream &, char const *);
+///
+MapleStream & operator<<(MapleStream &, char);
+///
+MapleStream & operator<<(MapleStream &, int);
+
+
+//
+// Octave
+//
+
+
+class OctaveStream {
+public:
///
explicit OctaveStream(std::ostream & os) : os_(os) {}
///
- std::ostream & os_;
- ///
- OctaveStream & operator<<(MathInset const *);
+ std::ostream & os() { return os_; }
+private:
///
- OctaveStream & operator<<(MathArray const &);
- ///
- OctaveStream & operator<<(char const *);
- ///
- OctaveStream & operator<<(char);
+ std::ostream & os_;
};
+///
+OctaveStream & operator<<(OctaveStream &, MathInset const *);
+///
+OctaveStream & operator<<(OctaveStream &, MathArray const &);
+///
+OctaveStream & operator<<(OctaveStream &, char const *);
+///
+OctaveStream & operator<<(OctaveStream &, char);
-struct WriteStream {
- ///
- WriteStream(Buffer const * buffer_, std::ostream & os_, bool fragile_);
- ///
- explicit WriteStream(std::ostream & os_);
+
+//
+// LaTeX/LyX
+//
+
+class WriteStream {
+public:
///
- WriteStream & operator<<(MathInset const *);
- ///
- WriteStream & operator<<(MathArray const &);
- ///
- WriteStream & operator<<(string const &);
- ///
- WriteStream & operator<<(char const *);
+ WriteStream(std::ostream & os, bool fragile);
///
- WriteStream & operator<<(char);
+ explicit WriteStream(std::ostream & os_);
+ /// yes... the references will be removed some day...
+ int & line() { return line_; }
///
- WriteStream & operator<<(int);
+ bool fragile() const { return fragile_; }
///
- WriteStream & operator<<(unsigned int);
-
+ std::ostream & os() { return os_; }
///
- Buffer const * buffer;
+ bool & firstitem() { return firstitem_; }
+private:
///
- std::ostream & os;
+ std::ostream & os_;
///
- bool fragile;
+ bool fragile_;
/// are we at the beginning of an MathArray?
- bool firstitem;
+ bool firstitem_;
///
int line_;
};
+///
+WriteStream & operator<<(WriteStream &, MathInset const *);
+///
+WriteStream & operator<<(WriteStream &, MathArray const &);
+///
+WriteStream & operator<<(WriteStream &, char const *);
+///
+WriteStream & operator<<(WriteStream &, char);
+///
+WriteStream & operator<<(WriteStream &, int);
+///
+WriteStream & operator<<(WriteStream &, unsigned int);
+
#endif
xp[2] = x + w; yp[2] = y + d;
xp[3] = x + w - 2; yp[3] = y + (d - a)/2 + 2;
xp[4] = x; yp[4] = y + (d - a)/2 + 2;
- pain.lines(xp, yp, 5, LColor::mathline);
+ pain.lines(xp, yp, 5, LColor::math);
}
os << "\\limits ";
}
} else
- if (os.firstitem)
+ if (os.firstitem())
lyxerr << "suppressing {} \n";
else
os << "{}";
}
-void MathSplitInset::write(WriteStream & os) const
+void MathSplitInset::write(WriteStream & ws) const
{
- if (os.fragile)
- os << "\\protect";
- os << "\\begin{split}";
- MathGridInset::write(os);
- if (os.fragile)
- os << "\\protect";
- os << "\\end{split}\n";
+ if (ws.fragile())
+ ws << "\\protect";
+ ws << "\\begin{split}";
+ MathGridInset::write(ws);
+ if (ws.fragile())
+ ws << "\\protect";
+ ws << "\\end{split}\n";
}
xp[1] = x + 8; yp[1] = y - a + 1;
xp[2] = x + 5; yp[2] = y + d - 1;
xp[3] = x; yp[3] = y + (d - a)/2;
- pain.lines(xp, yp, 4, LColor::mathline);
+ pain.lines(xp, yp, 4, LColor::math);
}
--- /dev/null
+#ifndef MATH_STREAMSTR_H
+#define MATH_STREAMSTR_H
+
+#include "LString.h"
+#include "math_mathmlstream.h"
+
+//
+// writing strings directly
+//
+
+inline WriteStream & operator<<(WriteStream & ws, string const & s)
+{
+ ws << s.c_str();
+ return ws;
+}
+
+#endif
mt.transform(xx, yy);
mt.transform(x2, y2);
pain.line(x + int(xx), y + int(yy), x + int(x2), y + int(y2),
- LColor::mathline);
+ LColor::math);
} else {
int xp[32];
int yp[32];
yp[j] = y + int(yy);
// lyxerr << "P[" << j " " << xx << " " << yy << " " << x << " " << y << "]";
}
- pain.lines(xp, yp, n, LColor::mathline);
+ pain.lines(xp, yp, n, LColor::math);
}
}
}