cosmetics

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2353 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-07-26 06:56:43 +00:00
parent 9ccefe810b
commit fda98080cc
47 changed files with 248 additions and 249 deletions

View File

@ -291,7 +291,7 @@ std::ostream & operator<<(std::ostream & os, MathArray const & ar)
}
void MathArray::Write(ostream & os, bool fragile) const
void MathArray::write(ostream & os, bool fragile) const
{
if (empty())
return;
@ -301,7 +301,7 @@ void MathArray::Write(ostream & os, bool fragile) const
for (int pos = 0; pos < size(); next(pos)) {
if (isInset(pos)) {
nextInset(pos)->Write(os, fragile);
nextInset(pos)->write(os, fragile);
} else {
@ -351,22 +351,22 @@ void MathArray::Write(ostream & os, bool fragile) const
}
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);
}

View File

@ -120,11 +120,11 @@ public:
///
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;

View File

@ -66,7 +66,7 @@ InsetFormula::InsetFormula(MathInsetTypes t)
InsetFormula::InsetFormula(string const & s)
: InsetFormulaBase(mathed_parse(s))
{
Metrics();
metrics();
}
@ -85,14 +85,14 @@ void InsetFormula::write(ostream & os) const
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;
}
@ -112,7 +112,7 @@ int InsetFormula::docBook(ostream & os) const
void InsetFormula::read(LyXLex & lex)
{
par(mathed_parse(lex));
Metrics();
metrics();
}
@ -125,7 +125,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const &,
MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter();
Metrics();
metrics();
int w = par()->width();
int h = par()->height();
int a = par()->ascent();
@ -143,9 +143,9 @@ void InsetFormula::draw(BufferView * bv, LyXFont const &,
}
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
@ -262,7 +262,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
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);
@ -293,7 +293,7 @@ void InsetFormula::handleExtern(const string & arg, BufferView *)
//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;
@ -301,12 +301,12 @@ void InsetFormula::handleExtern(const string & arg, BufferView *)
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;
}
@ -330,7 +330,7 @@ Inset::Code InsetFormula::lyxCode() const
void InsetFormula::validate(LaTeXFeatures & features) const
{
par()->Validate(features);
par()->validate(features);
}
bool InsetFormula::insetAllowed(Inset::Code code) const
@ -353,6 +353,6 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const
int InsetFormula::width(BufferView *, LyXFont const &) const
{
Metrics();
metrics();
return par()->width();
}

View File

@ -44,7 +44,7 @@ public:
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///
void Metrics() const;
void metrics() const;
///
void write(std::ostream &) const;

View File

@ -190,7 +190,7 @@ void InsetFormulaBase::edit(BufferView * bv, int x, int /*y*/, unsigned int)
if (!bv->lockInset(this))
lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
Metrics();
metrics();
//bv->updateInset(this, false);
if (x == 0)
mathcursor->first();
@ -295,14 +295,14 @@ vector<string> const InsetFormulaBase::getLabelList() const
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);
}
@ -501,7 +501,7 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action,
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);
}

View File

@ -117,7 +117,7 @@ public:
///
MathInset * par() const;
///
virtual void Metrics() const;
virtual void metrics() const;
protected:
///
virtual void updateLocal(BufferView * bv, bool mark_dirty);

View File

@ -62,20 +62,20 @@ Inset * InsetFormulaMacro::clone(Buffer const &, bool) const
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;
}
@ -97,7 +97,7 @@ void InsetFormulaMacro::read(LyXLex & lex)
// Awful hack...
par_ = mathed_parse(lex);
MathMacroTable::insertTemplate(tmacro());
par_->Metrics(LM_ST_TEXT);
par_->metrics(LM_ST_TEXT);
}
@ -121,7 +121,7 @@ int InsetFormulaMacro::descent(BufferView *, LyXFont const &) const
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();
}

View File

@ -17,7 +17,7 @@ MathInset * MathArrayInset::clone() const
}
void MathArrayInset::Write(std::ostream & os, bool fragile) const
void MathArrayInset::write(std::ostream & os, bool fragile) const
{
if (fragile)
os << "\\protect";
@ -31,7 +31,7 @@ void MathArrayInset::Write(std::ostream & os, bool fragile) const
os << colinfo_[col].h_align_;
os << "}\n";
MathGridInset::Write(os, fragile);
MathGridInset::write(os, fragile);
if (fragile)
os << "\\protect";

View File

@ -16,7 +16,7 @@ public:
///
virtual MathInset * clone() const;
///
void Write(std::ostream &, bool fragile) const;
void write(std::ostream &, bool fragile) const;
};
#endif

View File

@ -9,7 +9,7 @@ using std::ostream;
MathBigopInset::MathBigopInset(string const & name, int id)
: sym_(id)
{
SetName(name);
setName(name);
}
@ -19,20 +19,20 @@ MathInset * MathBigopInset::clone() const
}
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);

View File

@ -12,11 +12,11 @@ public:
///
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);
///

View File

@ -239,8 +239,8 @@ bool MathCursor::Left(bool sel)
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;
@ -402,7 +402,7 @@ void MathCursor::insert(char c, MathTextCodes t)
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;
}
}
@ -604,7 +604,7 @@ bool MathCursor::toggleLimits()
void MathCursor::SetSize(MathStyles size)
{
cursor().par_->UserSetSize(size);
cursor().par_->userSetSize(size);
}
@ -737,7 +737,7 @@ void MathCursor::Interpret(string const & s)
if (oldsel)
SelPaste();
}
p->Metrics(p->size());
p->metrics(p->size());
}
}
@ -981,7 +981,7 @@ MathInset * MathCursor::enclosing(MathInsetTypes t, int & idx) const
{
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_;
}
@ -1169,7 +1169,7 @@ void MathCursor::splitCell()
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();

View File

@ -25,9 +25,9 @@ MathInset * MathDecorationInset::clone() const
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();
@ -60,7 +60,7 @@ void MathDecorationInset::draw(Painter & pain, int x, int y)
}
void MathDecorationInset::Write(ostream & os, bool fragile) const
void MathDecorationInset::write(ostream & os, bool fragile) const
{
if (fragile &&
(name_ == "overbrace" ||
@ -75,15 +75,15 @@ void MathDecorationInset::Write(ostream & os, bool fragile) const
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 << "] ";
}

View File

@ -20,11 +20,11 @@ public:
///
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_;

View File

@ -20,7 +20,7 @@ MathInset * MathDelimInset::clone() const
}
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;
@ -37,7 +37,7 @@ void MathDelimInset::Write(std::ostream & os, bool fragile) const
os << char(left_) << ' ';
}
cell(0).Write(os, fragile);
cell(0).write(os, fragile);
os << "\\right";
if (r)
@ -86,9 +86,9 @@ int MathDelimInset::dw() const
}
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;

View File

@ -20,9 +20,9 @@ public:
///
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;
///

View File

@ -31,7 +31,7 @@ void MathDotsInset::draw(Painter & pain, int x, int y)
}
void MathDotsInset::Metrics(MathStyles st)
void MathDotsInset::metrics(MathStyles st)
{
size(st);
mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_);
@ -44,13 +44,13 @@ void MathDotsInset::Metrics(MathStyles st)
}
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() << "] ";
}

View File

@ -19,11 +19,11 @@ public:
///
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_;

View File

@ -19,11 +19,11 @@ MathInset * MathFracInset::clone() const
}
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;
@ -43,22 +43,22 @@ void MathFracInset::draw(Painter & pain, int x, int y)
}
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 << "] ";
}

View File

@ -18,11 +18,11 @@ public:
///
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);
///

View File

@ -17,7 +17,7 @@ extern LyXFont WhichFont(short type, int size);
MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
: MathInset(0, nm, ot)
{
lims_ = (GetType() == LM_OT_FUNCLIM);
lims_ = (getType() == LM_OT_FUNCLIM);
}
@ -27,19 +27,19 @@ MathInset * MathFuncInset::clone() const
}
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())

View File

@ -21,11 +21,11 @@ public:
///
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_;

View File

@ -74,10 +74,10 @@ char MathGridInset::valign() const
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
@ -212,7 +212,7 @@ void MathGridInset::draw(Painter & pain, int x, int y)
}
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)
@ -220,7 +220,7 @@ void MathGridInset::Write(std::ostream & os, bool fragile) const
for (int col = 0; col < ncols(); ++col) {
if (col)
os << " & ";
cell(index(row, col)).Write(os, fragile);
cell(index(row, col)).write(os, fragile);
}
}
}

View File

@ -56,9 +56,9 @@ public:
///
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);
///

View File

@ -72,19 +72,19 @@ string const & MathInset::name() const
}
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;
}
@ -103,7 +103,7 @@ void MathInset::size(MathStyles s)
std::ostream & operator<<(std::ostream & os, MathInset const & inset)
{
inset.Write(os, false);
inset.write(os, false);
return os;
}
@ -170,11 +170,11 @@ void MathInset::substitute(MathArray & array, MathMacro const & m) const
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)
@ -300,7 +300,7 @@ bool MathInset::idxLastDown(int &, int &) const
}
void MathInset::GetXY(int & x, int & y) const
void MathInset::getXY(int & x, int & y) const
{
x = xo();
y = yo();
@ -308,7 +308,7 @@ void MathInset::GetXY(int & x, int & y) const
/*
void MathInset::UserSetSize(MathStyles sz)
void MathInset::userSetSize(MathStyles sz)
{
if (sz >= 0) {
size_ = sz;
@ -317,7 +317,7 @@ void MathInset::UserSetSize(MathStyles sz)
}
*/
void MathInset::WriteNormal(std::ostream & os) const
void MathInset::writeNormal(std::ostream & os) const
{
os << "[" << name_ << "] ";
}
@ -326,7 +326,7 @@ void MathInset::WriteNormal(std::ostream & os) const
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";
@ -361,10 +361,10 @@ bool MathInset::covers(int x, int y) const
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

View File

@ -43,28 +43,25 @@ class LaTeXFeatures;
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;
///
@ -80,12 +77,14 @@ public:
///
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;
@ -172,10 +171,10 @@ public:
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
@ -196,24 +195,24 @@ public:
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:
@ -222,14 +221,14 @@ 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_;
};

View File

@ -49,11 +49,11 @@ MathInset * MathMacro::clone() const
}
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;
@ -68,7 +68,7 @@ void MathMacro::Metrics(MathStyles st)
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;
@ -76,7 +76,7 @@ void MathMacro::Metrics(MathStyles st)
} 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;
@ -90,7 +90,7 @@ void MathMacro::draw(Painter & pain, int x, int y)
xo(x);
yo(y);
Metrics(size());
metrics(size());
LColor::color col;
@ -138,12 +138,12 @@ void MathMacro::dump(std::ostream & os) const
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)
@ -151,11 +151,11 @@ void MathMacro::Write(std::ostream & os, bool fragile) const
}
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 << "] ";
@ -186,9 +186,9 @@ bool MathMacro::idxRight(int &, int &) const
}
void MathMacro::Validate(LaTeXFeatures & features) const
void MathMacro::validate(LaTeXFeatures & features) const
{
if (name_ == "binom")
features.binom = true;
MathInset::Validate(features);
MathInset::validate(features);
}

View File

@ -43,13 +43,13 @@ public:
///
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;
@ -63,7 +63,7 @@ public:
bool idxRight(int &, int &) const;
///
void Validate(LaTeXFeatures &) const;
void validate(LaTeXFeatures &) const;
private:
///

View File

@ -34,7 +34,7 @@ void MathMacroArgument::draw(Painter & pain, int x, int y)
}
void MathMacroArgument::Metrics(MathStyles st)
void MathMacroArgument::metrics(MathStyles st)
{
char str[] = "#0";
str[1] += number_;
@ -43,13 +43,13 @@ void MathMacroArgument::Metrics(MathStyles st)
}
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_ << "] ";
}

View File

@ -18,13 +18,13 @@ public:
///
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;

View File

@ -36,7 +36,7 @@ void MathMacroTemplate::numargs(int numargs)
}
void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
void MathMacroTemplate::write(std::ostream & os, bool fragile) const
{
os << "\n\\newcommand{\\" << name_ << "}";
@ -44,14 +44,14 @@ void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
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;

View File

@ -24,7 +24,7 @@ public:
///
MathInset * clone() const;
///
void Write(std::ostream &, bool fragile) const;
void write(std::ostream &, bool fragile) const;
/// Number of arguments
int numargs() const;
///
@ -32,7 +32,7 @@ public:
///
void draw(Painter &, int, int);
///
void Metrics(MathStyles st);
void metrics(MathStyles st);
private:
///
int numargs_;

View File

@ -92,12 +92,12 @@ MathInset * MathMatrixInset::clone() const
}
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;
@ -132,7 +132,7 @@ void MathMatrixInset::draw(Painter & pain, int x, int y)
}
void MathMatrixInset::Write(std::ostream & os, bool fragile) const
void MathMatrixInset::write(std::ostream & os, bool fragile) const
{
header_write(os);
@ -144,7 +144,7 @@ void MathMatrixInset::Write(std::ostream & os, bool fragile) const
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())
@ -189,7 +189,7 @@ bool MathMatrixInset::ams() const
bool MathMatrixInset::display() const
{
return GetType() != LM_OT_SIMPLE;
return getType() != LM_OT_SIMPLE;
}
@ -205,7 +205,7 @@ std::vector<string> const MathMatrixInset::getLabelList() const
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])
@ -214,19 +214,19 @@ bool MathMatrixInset::numberedType() const
}
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);
}
@ -234,7 +234,7 @@ void MathMatrixInset::header_write(std::ostream & os) const
{
bool n = numberedType();
switch (GetType()) {
switch (getType()) {
case LM_OT_SIMPLE:
os << "\\(";
break;
@ -268,7 +268,7 @@ void MathMatrixInset::footer_write(std::ostream & os) const
{
bool n = numberedType();
switch (GetType()) {
switch (getType()) {
case LM_OT_SIMPLE:
os << "\\)";
break;
@ -322,7 +322,7 @@ void MathMatrixInset::delRow(int row)
void MathMatrixInset::addCol(int col)
{
switch (GetType()) {
switch (getType()) {
case LM_OT_EQUATION:
mutate(LM_OT_EQNARRAY);
break;
@ -347,7 +347,7 @@ void MathMatrixInset::addCol(int col)
void MathMatrixInset::delCol(int col)
{
switch (GetType()) {
switch (getType()) {
case LM_OT_ALIGN:
MathGridInset::delCol(col);
break;
@ -395,7 +395,7 @@ void MathMatrixInset::mutate(string const & newtype)
dump();
return;
}
//lyxerr << "mutating from '" << GetType() << "' to '" << newtype << "'\n";
//lyxerr << "mutating from '" << getType() << "' to '" << newtype << "'\n";
mutate(typecode(newtype));
}
@ -410,14 +410,14 @@ void MathMatrixInset::glueall()
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;
@ -425,7 +425,7 @@ void MathMatrixInset::mutate(short newtype)
case LM_OT_EQUATION:
switch (newtype) {
case LM_OT_SIMPLE:
SetType(LM_OT_SIMPLE);
setType(LM_OT_SIMPLE);
break;
case LM_OT_ALIGN: {
@ -438,7 +438,7 @@ void MathMatrixInset::mutate(short newtype)
cell(1).erase(0, pos);
halign("rl");
SetType(LM_OT_ALIGN);
setType(LM_OT_ALIGN);
break;
}
@ -459,7 +459,7 @@ void MathMatrixInset::mutate(short newtype)
cell(2).erase(0, pos2);
halign("rcl");
SetType(LM_OT_EQNARRAY);
setType(LM_OT_EQNARRAY);
mutate(newtype);
break;
}
@ -500,7 +500,7 @@ void MathMatrixInset::mutate(short newtype)
cell(c).push_back(cell(c + 1));
}
MathGridInset::delCol(2);
SetType(LM_OT_ALIGN);
setType(LM_OT_ALIGN);
halign("rl");
mutate(newtype);
break;
@ -514,20 +514,20 @@ void MathMatrixInset::mutate(short newtype)
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";
}
}

View File

@ -25,9 +25,9 @@ public:
///
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);
///
@ -47,7 +47,7 @@ public:
///
std::vector<string> const getLabelList() const;
///
void Validate(LaTeXFeatures & features) const;
void validate(LaTeXFeatures & features) const;
///
void addRow(int);
@ -67,7 +67,7 @@ public:
private:
///
void Validate1(LaTeXFeatures & features);
void validate1(LaTeXFeatures & features);
///
void header_write(std::ostream &) const;
///

View File

@ -478,7 +478,7 @@ MathInset * mathed_parse()
lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n";
}
p->SetName(latex_mathenv[i].basename);
p->setName(latex_mathenv[i].basename);
break;
}
@ -762,7 +762,7 @@ void mathed_parse(MathArray & array, unsigned flags)
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;

View File

@ -30,9 +30,9 @@ MathInset * MathRootInset::clone() const
}
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;
@ -60,22 +60,22 @@ void MathRootInset::draw(Painter & pain, int x, int y)
}
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 << "] ";
}

View File

@ -35,11 +35,11 @@ public:
///
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;
///

View File

@ -143,21 +143,21 @@ bool MathScriptInset::idxLastDown(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 << " ";
@ -194,35 +194,35 @@ bool MathScriptInset::hasLimits() const
}
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();
@ -244,7 +244,7 @@ void MathScriptInset::Metrics(MathStyles st)
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();

View File

@ -26,11 +26,11 @@ public:
///
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);

View File

@ -43,26 +43,26 @@ void MathSizeInset::draw(Painter & pain, int x, int y)
}
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 << "]";
}

View File

@ -20,13 +20,13 @@ public:
///
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:
///

View File

@ -38,20 +38,20 @@ void MathSpaceInset::draw(Painter & pain, int x, int y)
}
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;

View File

@ -19,11 +19,11 @@ public:
///
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; }
///

View File

@ -19,9 +19,9 @@ MathInset * MathSqrtInset::clone() const
}
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;
@ -46,17 +46,17 @@ void MathSqrtInset::draw(Painter & pain, int x, int y)
}
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 << "] ";
}

View File

@ -20,10 +20,10 @@ public:
///
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

View File

@ -19,7 +19,7 @@ MathXArray::MathXArray()
{}
void MathXArray::Metrics(MathStyles st)
void MathXArray::metrics(MathStyles st)
{
if (data_.empty()) {
mathed_char_dim(LM_TC_VAR, st, 'I', ascent_, descent_, width_);
@ -37,7 +37,7 @@ void MathXArray::Metrics(MathStyles st)
int wid;
MathInset * p = data_.nextInset(pos);
if (p) {
p->Metrics(st);
p->metrics(st);
asc = p->ascent();
des = p->descent();
wid = p->width();

View File

@ -18,7 +18,7 @@ public:
///
MathXArray();
///
void Metrics(MathStyles st);
void metrics(MathStyles st);
///
void draw(Painter & pain, int x, int y);