}
-void MathArray::Write(ostream & os, bool fragile) const
+void MathArray::write(ostream & os, bool fragile) const
{
if (empty())
return;
for (int pos = 0; pos < size(); next(pos)) {
if (isInset(pos)) {
- nextInset(pos)->Write(os, fragile);
+ nextInset(pos)->write(os, fragile);
} else {
}
-void MathArray::WriteNormal(ostream & os) const
+void MathArray::writeNormal(ostream & os) const
{
if (empty()) {
os << "[par] ";
return;
}
- Write(os, true);
+ write(os, true);
}
-void MathArray::Validate(LaTeXFeatures & features) const
+void MathArray::validate(LaTeXFeatures & features) const
{
for (int pos = 0; pos < size(); next(pos))
if (isInset(pos))
- nextInset(pos)->Validate(features);
+ nextInset(pos)->validate(features);
}
///
bool isInset(int pos) const;
///
- void Write(std::ostream &, bool) const;
+ void write(std::ostream &, bool) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Validate(LaTeXFeatures &) const;
+ void validate(LaTeXFeatures &) const;
private:
///
typedef std::vector<unsigned char> buffer_type;
InsetFormula::InsetFormula(string const & s)
: InsetFormulaBase(mathed_parse(s))
{
- Metrics();
+ metrics();
}
int InsetFormula::latex(ostream & os, bool fragile, bool) const
{
- par()->Write(os, fragile);
+ par()->write(os, fragile);
return 1;
}
int InsetFormula::ascii(ostream & os, int) const
{
- par()->Write(os, false);
+ par()->write(os, false);
return 1;
}
void InsetFormula::read(LyXLex & lex)
{
par(mathed_parse(lex));
- Metrics();
+ metrics();
}
MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter();
- Metrics();
+ metrics();
int w = par()->width();
int h = par()->height();
int a = par()->ascent();
}
-void InsetFormula::Metrics() const
+void InsetFormula::metrics() const
{
- const_cast<MathInset *>(par_)->Metrics(display() ? LM_ST_DISPLAY : LM_ST_TEXT);
+ const_cast<MathInset *>(par_)->metrics(display() ? LM_ST_DISPLAY : LM_ST_TEXT);
}
vector<string> const InsetFormula::getLabelList() const
int x;
int y;
mathcursor->GetPos(x, y);
- if (par()->GetType() == LM_OT_SIMPLE)
+ if (par()->getType() == LM_OT_SIMPLE)
par()->mutate(LM_OT_EQUATION);
else
par()->mutate(LM_OT_SIMPLE);
//string outfile = lyx::tempName("maple.out");
string outfile = "/tmp/lyx2" + arg + ".out";
ostringstream os;
- par()->WriteNormal(os);
+ par()->writeNormal(os);
string code = os.str().c_str();
string script = "lyx2" + arg + " '" + code + "' " + outfile;
lyxerr << "calling: " << script << endl;
ifstream is(outfile.c_str());
par(mathed_parse(is));
- Metrics();
+ metrics();
}
bool InsetFormula::display() const
{
- return par_->GetType() != LM_OT_SIMPLE;
+ return par_->getType() != LM_OT_SIMPLE;
}
void InsetFormula::validate(LaTeXFeatures & features) const
{
- par()->Validate(features);
+ par()->validate(features);
}
bool InsetFormula::insetAllowed(Inset::Code code) const
int InsetFormula::width(BufferView *, LyXFont const &) const
{
- Metrics();
+ metrics();
return par()->width();
}
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///
- void Metrics() const;
+ void metrics() const;
///
void write(std::ostream &) const;
if (!bv->lockInset(this))
lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
- Metrics();
+ metrics();
//bv->updateInset(this, false);
if (x == 0)
mathcursor->first();
void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
{
- Metrics();
+ metrics();
bv->updateInset(this, dirty);
}
-void InsetFormulaBase::Metrics() const
+void InsetFormulaBase::metrics() const
{
- const_cast<MathInset *>(par_)->Metrics(LM_ST_TEXT);
+ const_cast<MathInset *>(par_)->metrics(LM_ST_TEXT);
}
int y1;
istringstream is(arg.c_str());
is >> x >> y;
- par_->GetXY(x1, y1);
+ par_->getXY(x1, y1);
mathcursor->SetPos(x1 + x, y1 + y);
updateLocal(bv, false);
}
///
MathInset * par() const;
///
- virtual void Metrics() const;
+ virtual void metrics() const;
protected:
///
virtual void updateLocal(BufferView * bv, bool mark_dirty);
void InsetFormulaMacro::write(ostream & os) const
{
os << "FormulaMacro ";
- tmacro()->Write(os, false);
+ tmacro()->write(os, false);
}
int InsetFormulaMacro::latex(ostream & os, bool fragile,
bool /*free_spacing*/) const
{
- tmacro()->Write(os, fragile);
+ tmacro()->write(os, fragile);
return 2;
}
int InsetFormulaMacro::ascii(ostream & os, int) const
{
- tmacro()->Write(os, false);
+ tmacro()->write(os, false);
return 0;
}
// Awful hack...
par_ = mathed_parse(lex);
MathMacroTable::insertTemplate(tmacro());
- par_->Metrics(LM_ST_TEXT);
+ par_->metrics(LM_ST_TEXT);
}
int InsetFormulaMacro::width(BufferView *, LyXFont const & f) const
{
- tmacro()->Metrics(LM_ST_TEXT);
+ tmacro()->metrics(LM_ST_TEXT);
return 10 + lyxfont::width(prefix(), f) + tmacro()->width();
}
}
-void MathArrayInset::Write(std::ostream & os, bool fragile) const
+void MathArrayInset::write(std::ostream & os, bool fragile) const
{
if (fragile)
os << "\\protect";
os << colinfo_[col].h_align_;
os << "}\n";
- MathGridInset::Write(os, fragile);
+ MathGridInset::write(os, fragile);
if (fragile)
os << "\\protect";
///
virtual MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
};
#endif
MathBigopInset::MathBigopInset(string const & name, int id)
: sym_(id)
{
- SetName(name);
+ setName(name);
}
}
-void MathBigopInset::Write(ostream & os, bool /* fragile */) const
+void MathBigopInset::write(ostream & os, bool /* fragile */) const
{
//bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
os << '\\' << name();
}
-void MathBigopInset::WriteNormal(ostream & os) const
+void MathBigopInset::writeNormal(ostream & os) const
{
os << "[bigop " << name() << "] ";
}
-void MathBigopInset::Metrics(MathStyles st)
+void MathBigopInset::metrics(MathStyles st)
{
//cerr << "\nBigopDraw\n";
size(st);
///
MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int, int);
///
if (macro_mode) {
// was MacroModeBack()
if (!imacro->name().empty()) {
- imacro->SetName(imacro->name().substr(0, imacro->name().length()-1));
- imacro->Metrics(imacro->size());
+ imacro->setName(imacro->name().substr(0, imacro->name().length()-1));
+ imacro->metrics(imacro->size());
} else
MacroModeClose();
return true;
if (macro_mode) {
if (MathIsAlphaFont(t) || t == LM_TC_MIN) {
// was MacroModeinsert(c);
- imacro->SetName(imacro->name() + static_cast<char>(c));
+ imacro->setName(imacro->name() + static_cast<char>(c));
return;
}
}
void MathCursor::SetSize(MathStyles size)
{
- cursor().par_->UserSetSize(size);
+ cursor().par_->userSetSize(size);
}
if (oldsel)
SelPaste();
}
- p->Metrics(p->size());
+ p->metrics(p->size());
}
}
{
for (int i = Cursor_.size() - 1; i >= 0; --i) {
//lyxerr << "checking level " << i << "\n";
- if (Cursor_[i].par_->GetType() == t) {
+ if (Cursor_[i].par_->getType() == t) {
idx = Cursor_[i].idx_;
return Cursor_[i].par_;
}
void MathCursor::breakLine()
{
MathMatrixInset * p = static_cast<MathMatrixInset *>(formula()->par());
- if (p->GetType() == LM_OT_SIMPLE || p->GetType() == LM_OT_EQUATION) {
+ if (p->getType() == LM_OT_SIMPLE || p->getType() == LM_OT_EQUATION) {
p->mutate(LM_OT_EQNARRAY);
p->addRow(0);
cursor().idx_ = p->nrows();
-void MathDecorationInset::Metrics(MathStyles st)
+void MathDecorationInset::metrics(MathStyles st)
{
- xcell(0).Metrics(st);
+ xcell(0).metrics(st);
size_ = st;
width_ = xcell(0).width();
ascent_ = xcell(0).ascent();
}
-void MathDecorationInset::Write(ostream & os, bool fragile) const
+void MathDecorationInset::write(ostream & os, bool fragile) const
{
if (fragile &&
(name_ == "overbrace" ||
else
os << '{';
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
if (deco_ != LM_not)
os << '}';
}
-void MathDecorationInset::WriteNormal(ostream & os) const
+void MathDecorationInset::writeNormal(ostream & os) const
{
os << "[" << name_ << " ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "] ";
}
///
void draw(Painter &, int, int);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
- void WriteNormal(std::ostream & os) const;
+ void writeNormal(std::ostream & os) const;
private:
///
int deco_;
}
-void MathDelimInset::Write(std::ostream & os, bool fragile) const
+void MathDelimInset::write(std::ostream & os, bool fragile) const
{
latexkeys const * l = (left_ != '|') ?
lm_get_key_by_id(left_, LM_TK_SYM) : 0;
os << char(left_) << ' ';
}
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "\\right";
if (r)
}
-void MathDelimInset::Metrics(MathStyles st)
+void MathDelimInset::metrics(MathStyles st)
{
- xcell(0).Metrics(st);
+ xcell(0).metrics(st);
size_ = st;
ascent_ = xcell(0).ascent() + 2;
descent_ = xcell(0).descent() + 2;
///
void draw(Painter &, int, int);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
private:
int dw() const;
///
}
-void MathDotsInset::Metrics(MathStyles st)
+void MathDotsInset::metrics(MathStyles st)
{
size(st);
mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
}
-void MathDotsInset::Write(ostream & os, bool /* fragile */) const
+void MathDotsInset::write(ostream & os, bool /* fragile */) const
{
os << '\\' << name() << ' ';
}
-void MathDotsInset::WriteNormal(ostream & os) const
+void MathDotsInset::writeNormal(ostream & os) const
{
os << "[" << name() << "] ";
}
///
void draw(Painter &, int, int);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
protected:
///
int dh_;
}
-void MathFracInset::Metrics(MathStyles st)
+void MathFracInset::metrics(MathStyles st)
{
size_ = smallerStyleFrac(st);
- xcell(0).Metrics(size_);
- xcell(1).Metrics(size_);
+ xcell(0).metrics(size_);
+ xcell(1).metrics(size_);
width_ = std::max(xcell(0).width(), xcell(1).width()) + 4;
ascent_ = xcell(0).height() + 4 + 5;
descent_ = xcell(1).height() + 4 - 5;
}
-void MathFracInset::Write(std::ostream & os, bool fragile) const
+void MathFracInset::write(std::ostream & os, bool fragile) const
{
os << '\\' << name() << '{';
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "}{";
- cell(1).Write(os, fragile);
+ cell(1).write(os, fragile);
os << '}';
}
-void MathFracInset::WriteNormal(std::ostream & os) const
+void MathFracInset::writeNormal(std::ostream & os) const
{
os << '[' << name() << ' ';
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << " ";
- cell(1).WriteNormal(os);
+ cell(1).writeNormal(os);
os << "] ";
}
///
virtual MathInset * clone() const;
///
- virtual void Write(std::ostream &, bool fragile) const;
+ virtual void write(std::ostream &, bool fragile) const;
///
- virtual void WriteNormal(std::ostream &) const;
+ virtual void writeNormal(std::ostream &) const;
///
- virtual void Metrics(MathStyles st);
+ virtual void metrics(MathStyles st);
///
virtual void draw(Painter &, int x, int baseline);
///
MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
: MathInset(0, nm, ot)
{
- lims_ = (GetType() == LM_OT_FUNCLIM);
+ lims_ = (getType() == LM_OT_FUNCLIM);
}
}
-void MathFuncInset::Write(std::ostream & os, bool /* fragile */) const
+void MathFuncInset::write(std::ostream & os, bool /* fragile */) const
{
os << "\\" << name_ << ' ';
}
-void MathFuncInset::WriteNormal(std::ostream & os) const
+void MathFuncInset::writeNormal(std::ostream & os) const
{
os << "[" << name_ << "] ";
}
-void MathFuncInset::Metrics(MathStyles st)
+void MathFuncInset::metrics(MathStyles st)
{
size_ = st;
if (name_.empty())
///
void draw(Painter &, int, int);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
private:
///
bool lims_;
return v_align_;
}
-void MathGridInset::Metrics(MathStyles st)
+void MathGridInset::metrics(MathStyles st)
{
// let the cells adjust themselves
- MathInset::Metrics(st);
+ MathInset::metrics(st);
size_ = st;
// adjust vertical structure
}
-void MathGridInset::Write(std::ostream & os, bool fragile) const
+void MathGridInset::write(std::ostream & os, bool fragile) const
{
for (int row = 0; row < nrows(); ++row) {
if (row)
for (int col = 0; col < ncols(); ++col) {
if (col)
os << " & ";
- cell(index(row, col)).Write(os, fragile);
+ cell(index(row, col)).write(os, fragile);
}
}
}
///
virtual MathInset * clone() const = 0;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int, int);
///
}
-MathInsetTypes MathInset::GetType() const
+MathInsetTypes MathInset::getType() const
{
return objtype;
}
-void MathInset::SetType(MathInsetTypes t)
+void MathInset::setType(MathInsetTypes t)
{
objtype = t;
}
-void MathInset::SetName(string const & n)
+void MathInset::setName(string const & n)
{
name_ = n;
}
std::ostream & operator<<(std::ostream & os, MathInset const & inset)
{
- inset.Write(os, false);
+ inset.write(os, false);
return os;
}
array.push_back(p);
}
-void MathInset::Metrics(MathStyles st)
+void MathInset::metrics(MathStyles st)
{
size_ = st;
for (int i = 0; i < nargs(); ++i)
- xcell(i).Metrics(st);
+ xcell(i).metrics(st);
}
void MathInset::draw(Painter & pain, int x, int y)
}
-void MathInset::GetXY(int & x, int & y) const
+void MathInset::getXY(int & x, int & y) const
{
x = xo();
y = yo();
/*
-void MathInset::UserSetSize(MathStyles sz)
+void MathInset::userSetSize(MathStyles sz)
{
if (sz >= 0) {
size_ = sz;
}
*/
-void MathInset::WriteNormal(std::ostream & os) const
+void MathInset::writeNormal(std::ostream & os) const
{
os << "[" << name_ << "] ";
}
void MathInset::dump() const
{
lyxerr << "---------------------------------------------\n";
- Write(lyxerr, false);
+ write(lyxerr, false);
lyxerr << "\n";
for (int i = 0; i < nargs(); ++i)
lyxerr << cell(i) << "\n";
y <= yo_ + descent_;
}
-void MathInset::Validate(LaTeXFeatures & features) const
+void MathInset::validate(LaTeXFeatures & features) const
{
for (int i = 0; i < nargs(); ++i)
- cell(i).Validate(features);
+ cell(i).validate(features);
}
std::vector<int> MathInset::idxBetween(int from, int to) const
class MathInset {
public:
- /** A math inset has a name (usually its LaTeX name),
- type and font-size
- */
///
explicit MathInset
(int na = 0, string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE);
- /// The virtual base destructor
+ /// the virtual base destructor
virtual ~MathInset() {}
- /// Draw the object
+ /// draw the object, sets xo_ and yo_ cached values
virtual void draw(Painter &, int x, int baseline) = 0;
- /// Write LaTeX and Lyx code
- virtual void Write(std::ostream &, bool fragile) const = 0;
- /// Write normalized content
- virtual void WriteNormal(std::ostream &) const;
- /// Reproduces itself
+ /// write LaTeX and Lyx code
+ virtual void write(std::ostream &, bool fragile) const = 0;
+ /// write normalized content
+ virtual void writeNormal(std::ostream &) const;
+ /// reproduce itself
virtual MathInset * clone() const = 0;
- /// Appends itself with macro arguments substituted
+ /// appends itself with macro arguments substituted
virtual void substitute(MathArray & array, MathMacro const & macro) const;
- /// Compute the size of the object
- virtual void Metrics(MathStyles st) = 0;
+ /// compute the size of the object, sets ascend_, descend_ and width_
+ virtual void metrics(MathStyles st) = 0;
///
virtual int ascent() const;
///
///
string const & name() const;
///
- MathInsetTypes GetType() const;
+ MathInsetTypes getType() const;
+ ///
+ MathInsetTypes GetType() const { return getType(); }
//Man: Avoid to use these functions if it's not strictly necessary
///
- virtual void SetType(MathInsetTypes t);
+ virtual void setType(MathInsetTypes t);
///
- virtual void SetName(string const & n);
+ virtual void setName(string const & n);
///
MathStyles size() const;
virtual void delCol(int) {}
///
- virtual void UserSetSize(MathStyles &) {}
+ virtual void userSetSize(MathStyles &) {}
///
- void GetXY(int & x, int & y) const;
+ void getXY(int & x, int & y) const;
///
bool covers(int x, int y) const;
/// Identifies things that can get scripts
void dump() const;
///
- void Validate(LaTeXFeatures & features) const;
+ void validate(LaTeXFeatures & features) const;
///
static int workwidth;
protected:
- ///
+ /// usually the LaTeX name of the thingy
string name_;
- ///
+ ///
MathInsetTypes objtype;
- ///
+ /// the width of this inset as computed by metrics()
int width_;
- ///
+ ///
int ascent_;
///
int descent_;
- ///
+ ///
void size(MathStyles s);
- ///
+ /// the used font size
MathStyles size_;
protected:
/**
* The contents of the inset are contained here.
* Each inset is build from a number of insets.
- * For instance, a
*/
cells_type cells_;
private:
- /// Cursor start position in pixels from the document top
+ /// the following are used for positioning the cursor with the mouse
+ /// cached cursor start position in pixels from the document left
int xo_;
- ///
+ /// cached cursor start position in pixels from the document top
int yo_;
};
}
-void MathMacro::Metrics(MathStyles st)
+void MathMacro::metrics(MathStyles st)
{
if (mathcursor && mathcursor->isInside(this)) {
expanded_ = tmplate_->xcell(0);
- expanded_.Metrics(st);
+ expanded_.metrics(st);
size_ = st;
width_ = expanded_.width() + 4;
ascent_ = expanded_.ascent() + 2;
for (int i = 0; i < nargs(); ++i) {
MathXArray & c = xcell(i);
- c.Metrics(st);
+ c.metrics(st);
width_ = std::max(width_, c.width() + lwid);
descent_ += std::max(c.ascent(), lasc) + 5;
descent_ += std::max(c.descent(), ldes) + 5;
} else {
expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this);
- expanded_.Metrics(st);
+ expanded_.metrics(st);
size_ = st;
width_ = expanded_.width() + 6;
ascent_ = expanded_.ascent() + 3;
xo(x);
yo(y);
- Metrics(size());
+ metrics(size());
LColor::color col;
os << endl;
}
-void MathMacro::Write(std::ostream & os, bool fragile) const
+void MathMacro::write(std::ostream & os, bool fragile) const
{
os << '\\' << name_;
for (int i = 0; i < nargs(); ++i) {
os << '{';
- cell(i).Write(os, fragile);
+ cell(i).write(os, fragile);
os << '}';
}
if (nargs() == 0)
}
-void MathMacro::WriteNormal(std::ostream & os) const
+void MathMacro::writeNormal(std::ostream & os) const
{
os << "[macro " << name_ << " ";
for (int i = 0; i < nargs(); ++i) {
- cell(i).WriteNormal(os);
+ cell(i).writeNormal(os);
os << ' ';
}
os << "] ";
}
-void MathMacro::Validate(LaTeXFeatures & features) const
+void MathMacro::validate(LaTeXFeatures & features) const
{
if (name_ == "binom")
features.binom = true;
- MathInset::Validate(features);
+ MathInset::validate(features);
}
///
void draw(Painter &, int, int);
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
void dump(std::ostream & os) const;
bool idxRight(int &, int &) const;
///
- void Validate(LaTeXFeatures &) const;
+ void validate(LaTeXFeatures &) const;
private:
///
}
-void MathMacroArgument::Metrics(MathStyles st)
+void MathMacroArgument::metrics(MathStyles st)
{
char str[] = "#0";
str[1] += number_;
}
-void MathMacroArgument::Write(std::ostream & os, bool /*fragile*/) const
+void MathMacroArgument::write(std::ostream & os, bool /*fragile*/) const
{
os << '#' << number_ << ' ';
}
-void MathMacroArgument::WriteNormal(std::ostream & os) const
+void MathMacroArgument::writeNormal(std::ostream & os) const
{
os << "[macroarg " << number_ << "] ";
}
///
MathInset * clone() const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int x, int baseline);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
void substitute(MathArray & array, MathMacro const & macro) const;
}
-void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
+void MathMacroTemplate::write(std::ostream & os, bool fragile) const
{
os << "\n\\newcommand{\\" << name_ << "}";
os << "[" << numargs_ << "]";
os << "{";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "}\n";
}
-void MathMacroTemplate::Metrics(MathStyles st)
+void MathMacroTemplate::metrics(MathStyles st)
{
- xcell(0).Metrics(st);
+ xcell(0).metrics(st);
size_ = st;
width_ = xcell(0).width() + 4;
ascent_ = xcell(0).ascent() + 2;
///
MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
/// Number of arguments
int numargs() const;
///
///
void draw(Painter &, int, int);
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
private:
///
int numargs_;
}
-void MathMatrixInset::Metrics(MathStyles /* st */)
+void MathMatrixInset::metrics(MathStyles /* st */)
{
- size_ = (GetType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY;
+ size_ = (getType() == LM_OT_SIMPLE) ? LM_ST_TEXT : LM_ST_DISPLAY;
// let the cells adjust themselves
- MathGridInset::Metrics(size_);
+ MathGridInset::metrics(size_);
if (display()) {
ascent_ += 12;
}
-void MathMatrixInset::Write(std::ostream & os, bool fragile) const
+void MathMatrixInset::write(std::ostream & os, bool fragile) const
{
header_write(os);
for (int col = 0; col < ncols(); ++col) {
if (col)
os << " & ";
- cell(index(row, col)).Write(os, fragile);
+ cell(index(row, col)).write(os, fragile);
}
if (n) {
if (!label_[row].empty())
bool MathMatrixInset::display() const
{
- return GetType() != LM_OT_SIMPLE;
+ return getType() != LM_OT_SIMPLE;
}
bool MathMatrixInset::numberedType() const
{
- if (GetType() == LM_OT_SIMPLE)
+ if (getType() == LM_OT_SIMPLE)
return false;
for (int row = 0; row < nrows(); ++row)
if (!nonum_[row])
}
-void MathMatrixInset::Validate(LaTeXFeatures & features) const
+void MathMatrixInset::validate(LaTeXFeatures & features) const
{
features.amsstyle = ams();
// Validation is necessary only if not using AMS math.
- // To be safe, we will always run mathedValidate.
+ // To be safe, we will always run mathedvalidate.
//if (features.amsstyle)
// return;
features.boldsymbol = true;
//features.binom = true;
- MathInset::Validate(features);
+ MathInset::validate(features);
}
{
bool n = numberedType();
- switch (GetType()) {
+ switch (getType()) {
case LM_OT_SIMPLE:
os << "\\(";
break;
{
bool n = numberedType();
- switch (GetType()) {
+ switch (getType()) {
case LM_OT_SIMPLE:
os << "\\)";
break;
void MathMatrixInset::addCol(int col)
{
- switch (GetType()) {
+ switch (getType()) {
case LM_OT_EQUATION:
mutate(LM_OT_EQNARRAY);
break;
void MathMatrixInset::delCol(int col)
{
- switch (GetType()) {
+ switch (getType()) {
case LM_OT_ALIGN:
MathGridInset::delCol(col);
break;
dump();
return;
}
- //lyxerr << "mutating from '" << GetType() << "' to '" << newtype << "'\n";
+ //lyxerr << "mutating from '" << getType() << "' to '" << newtype << "'\n";
mutate(typecode(newtype));
}
void MathMatrixInset::mutate(short newtype)
{
- //lyxerr << "mutating from '" << GetType() << "' to '" << newtype << "'\n";
+ //lyxerr << "mutating from '" << getType() << "' to '" << newtype << "'\n";
- if (newtype == GetType())
+ if (newtype == getType())
return;
- switch (GetType()) {
+ switch (getType()) {
case LM_OT_SIMPLE:
- SetType(LM_OT_EQUATION);
+ setType(LM_OT_EQUATION);
numbered(0, false);
mutate(newtype);
break;
case LM_OT_EQUATION:
switch (newtype) {
case LM_OT_SIMPLE:
- SetType(LM_OT_SIMPLE);
+ setType(LM_OT_SIMPLE);
break;
case LM_OT_ALIGN: {
cell(1).erase(0, pos);
halign("rl");
- SetType(LM_OT_ALIGN);
+ setType(LM_OT_ALIGN);
break;
}
cell(2).erase(0, pos2);
halign("rcl");
- SetType(LM_OT_EQNARRAY);
+ setType(LM_OT_EQNARRAY);
mutate(newtype);
break;
}
cell(c).push_back(cell(c + 1));
}
MathGridInset::delCol(2);
- SetType(LM_OT_ALIGN);
+ setType(LM_OT_ALIGN);
halign("rl");
mutate(newtype);
break;
case LM_OT_EQUATION:
case LM_OT_EQNARRAY:
MathGridInset::addCol(1);
- SetType(LM_OT_EQNARRAY);
+ setType(LM_OT_EQNARRAY);
halign("rcl");
mutate(newtype);
break;
default:
- lyxerr << "mutation from '" << GetType()
+ lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n";
break;
}
break;
default:
- lyxerr << "mutation from '" << GetType()
+ lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n";
}
}
///
MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int, int);
///
///
std::vector<string> const getLabelList() const;
///
- void Validate(LaTeXFeatures & features) const;
+ void validate(LaTeXFeatures & features) const;
///
void addRow(int);
private:
///
- void Validate1(LaTeXFeatures & features);
+ void validate1(LaTeXFeatures & features);
///
void header_write(std::ostream &) const;
///
lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n";
}
- p->SetName(latex_mathenv[i].basename);
+ p->setName(latex_mathenv[i].basename);
break;
}
for (int i = 0; i < m->nargs(); ++i)
mathed_parse(m->cell(i), FLAG_ITEM);
array.push_back(m);
- m->Metrics(LM_ST_TEXT);
+ m->metrics(LM_ST_TEXT);
} else
array.push_back(new MathFuncInset(yytext, LM_OT_UNDEF));
break;
}
-void MathRootInset::Metrics(MathStyles st)
+void MathRootInset::metrics(MathStyles st)
{
- MathInset::Metrics(st);
+ MathInset::metrics(st);
size_ = st;
ascent_ = std::max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2;
descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 2;
}
-void MathRootInset::Write(std::ostream & os, bool fragile) const
+void MathRootInset::write(std::ostream & os, bool fragile) const
{
os << "\\sqrt[";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "]{";
- cell(1).Write(os, fragile);
+ cell(1).write(os, fragile);
os << '}';
}
-void MathRootInset::WriteNormal(std::ostream & os) const
+void MathRootInset::writeNormal(std::ostream & os) const
{
os << "[root ";
- cell(1).WriteNormal(os);
+ cell(1).writeNormal(os);
os << " ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "] ";
}
///
void draw(Painter &, int x, int baseline);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
bool idxUp(int & idx, int & pos) const;
///
}
-void MathScriptInset::Write(std::ostream & os, bool fragile) const
+void MathScriptInset::write(std::ostream & os, bool fragile) const
{
if (symbol_) {
- symbol_->Write(os, fragile);
+ symbol_->write(os, fragile);
if (limits())
os << (limits() == 1 ? "\\limits" : "\\nolimits");
}
if (up()) {
os << "^{";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "}";
}
if (down()) {
os << "_{";
- cell(1).Write(os, fragile);
+ cell(1).write(os, fragile);
os << "}";
}
os << " ";
}
-void MathScriptInset::WriteNormal(std::ostream & os) const
+void MathScriptInset::writeNormal(std::ostream & os) const
{
if (limits() && symbol_)
os << "[" << (limits() ? "limits" : "nolimits") << "]";
if (up()) {
os << "[superscript ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "] ";
}
if (down()) {
os << "[subscript ";
- cell(1).WriteNormal(os);
+ cell(1).writeNormal(os);
os << "] ";
}
}
-void MathScriptInset::Metrics(MathStyles st)
+void MathScriptInset::metrics(MathStyles st)
{
size_ = st;
MathStyles tt = smallerStyleScript(st);
- xcell(0).Metrics(tt);
- xcell(1).Metrics(tt);
+ xcell(0).metrics(tt);
+ xcell(1).metrics(tt);
width_ = std::max(xcell(0).width(), xcell(1).width());
if (hasLimits()) {
- symbol_->Metrics(st);
+ symbol_->metrics(st);
int wid = symbol_->width();
ascent_ = symbol_->ascent();
descent_ = symbol_->descent();
int wid = 0;
mathed_char_height(LM_TC_VAR, st, 'I', asc, des);
if (symbol_) {
- symbol_->Metrics(st);
+ symbol_->metrics(st);
wid = symbol_->width();
asc = symbol_->ascent();
des = symbol_->descent();
///
MathInset * clone() const;
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int x, int baseline);
}
-void MathSizeInset::Metrics(MathStyles /* st */)
+void MathSizeInset::metrics(MathStyles /* st */)
{
- xcell(0).Metrics(style_);
+ xcell(0).metrics(style_);
ascent_ = xcell(0).ascent_;
descent_ = xcell(0).descent_;
width_ = xcell(0).width_;
}
-void MathSizeInset::Write(std::ostream & os, bool fragile) const
+void MathSizeInset::write(std::ostream & os, bool fragile) const
{
os << "{\\" << name() << " ";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "}";
}
-void MathSizeInset::WriteNormal(std::ostream & os) const
+void MathSizeInset::writeNormal(std::ostream & os) const
{
os << "[" << name() << " ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "]";
}
///
virtual MathInset * clone() const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter &, int x, int baseline);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
private:
///
}
-void MathSpaceInset::Write(std::ostream & os, bool /* fragile */) const
+void MathSpaceInset::write(std::ostream & os, bool /* fragile */) const
{
if (space_ >= 0 && space_ < 6)
os << '\\' << latex_mathspace[space_] << ' ';
}
-void MathSpaceInset::WriteNormal(std::ostream & os) const
+void MathSpaceInset::writeNormal(std::ostream & os) const
{
os << "[space " << space_ << "] ";
}
-void MathSpaceInset::Metrics(MathStyles st)
+void MathSpaceInset::metrics(MathStyles st)
{
size_ = st;
width_ = space_ ? space_ * 2 : 2;
///
void draw(Painter &, int, int);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
bool isSpaceInset() const { return true; }
///
}
-void MathSqrtInset::Metrics(MathStyles st)
+void MathSqrtInset::metrics(MathStyles st)
{
- xcell(0).Metrics(st);
+ xcell(0).metrics(st);
size_ = st;
ascent_ = xcell(0).ascent() + 4;
descent_ = xcell(0).descent() + 2;
}
-void MathSqrtInset::Write(std::ostream & os, bool fragile) const
+void MathSqrtInset::write(std::ostream & os, bool fragile) const
{
os << "\\sqrt{";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << '}';
}
-void MathSqrtInset::WriteNormal(std::ostream & os) const
+void MathSqrtInset::writeNormal(std::ostream & os) const
{
os << "[sqrt ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "] ";
}
///
void draw(Painter &, int x, int baseline);
///
- void Write(std::ostream &, bool fragile) const;
+ void write(std::ostream &, bool fragile) const;
///
- void WriteNormal(std::ostream &) const;
+ void writeNormal(std::ostream &) const;
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
};
#endif
{}
-void MathXArray::Metrics(MathStyles st)
+void MathXArray::metrics(MathStyles st)
{
if (data_.empty()) {
mathed_char_dim(LM_TC_VAR, st, 'I', ascent_, descent_, width_);
int wid;
MathInset * p = data_.nextInset(pos);
if (p) {
- p->Metrics(st);
+ p->metrics(st);
asc = p->ascent();
des = p->descent();
wid = p->width();
///
MathXArray();
///
- void Metrics(MathStyles st);
+ void metrics(MathStyles st);
///
void draw(Painter & pain, int x, int y);