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()) if (empty())
return; return;
@ -301,7 +301,7 @@ void MathArray::Write(ostream & os, bool fragile) const
for (int pos = 0; pos < size(); next(pos)) { for (int pos = 0; pos < size(); next(pos)) {
if (isInset(pos)) { if (isInset(pos)) {
nextInset(pos)->Write(os, fragile); nextInset(pos)->write(os, fragile);
} else { } 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()) { if (empty()) {
os << "[par] "; os << "[par] ";
return; 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)) for (int pos = 0; pos < size(); next(pos))
if (isInset(pos)) if (isInset(pos))
nextInset(pos)->Validate(features); nextInset(pos)->validate(features);
} }

View File

@ -120,11 +120,11 @@ public:
/// ///
bool isInset(int pos) const; 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: private:
/// ///
typedef std::vector<unsigned char> buffer_type; typedef std::vector<unsigned char> buffer_type;

View File

@ -66,7 +66,7 @@ InsetFormula::InsetFormula(MathInsetTypes t)
InsetFormula::InsetFormula(string const & s) InsetFormula::InsetFormula(string const & s)
: InsetFormulaBase(mathed_parse(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 int InsetFormula::latex(ostream & os, bool fragile, bool) const
{ {
par()->Write(os, fragile); par()->write(os, fragile);
return 1; return 1;
} }
int InsetFormula::ascii(ostream & os, int) const int InsetFormula::ascii(ostream & os, int) const
{ {
par()->Write(os, false); par()->write(os, false);
return 1; return 1;
} }
@ -112,7 +112,7 @@ int InsetFormula::docBook(ostream & os) const
void InsetFormula::read(LyXLex & lex) void InsetFormula::read(LyXLex & lex)
{ {
par(mathed_parse(lex)); par(mathed_parse(lex));
Metrics(); metrics();
} }
@ -125,7 +125,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const &,
MathInset::workwidth = bv->workWidth(); MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter(); Painter & pain = bv->painter();
Metrics(); metrics();
int w = par()->width(); int w = par()->width();
int h = par()->height(); int h = par()->height();
int a = par()->ascent(); 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 vector<string> const InsetFormula::getLabelList() const
@ -262,7 +262,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
int x; int x;
int y; int y;
mathcursor->GetPos(x, y); mathcursor->GetPos(x, y);
if (par()->GetType() == LM_OT_SIMPLE) if (par()->getType() == LM_OT_SIMPLE)
par()->mutate(LM_OT_EQUATION); par()->mutate(LM_OT_EQUATION);
else else
par()->mutate(LM_OT_SIMPLE); par()->mutate(LM_OT_SIMPLE);
@ -293,7 +293,7 @@ void InsetFormula::handleExtern(const string & arg, BufferView *)
//string outfile = lyx::tempName("maple.out"); //string outfile = lyx::tempName("maple.out");
string outfile = "/tmp/lyx2" + arg + ".out"; string outfile = "/tmp/lyx2" + arg + ".out";
ostringstream os; ostringstream os;
par()->WriteNormal(os); par()->writeNormal(os);
string code = os.str().c_str(); string code = os.str().c_str();
string script = "lyx2" + arg + " '" + code + "' " + outfile; string script = "lyx2" + arg + " '" + code + "' " + outfile;
lyxerr << "calling: " << script << endl; lyxerr << "calling: " << script << endl;
@ -301,12 +301,12 @@ void InsetFormula::handleExtern(const string & arg, BufferView *)
ifstream is(outfile.c_str()); ifstream is(outfile.c_str());
par(mathed_parse(is)); par(mathed_parse(is));
Metrics(); metrics();
} }
bool InsetFormula::display() const 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 void InsetFormula::validate(LaTeXFeatures & features) const
{ {
par()->Validate(features); par()->validate(features);
} }
bool InsetFormula::insetAllowed(Inset::Code code) const 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 int InsetFormula::width(BufferView *, LyXFont const &) const
{ {
Metrics(); metrics();
return par()->width(); return par()->width();
} }

View File

@ -44,7 +44,7 @@ public:
/// ///
void draw(BufferView *, LyXFont const &, int, float &, bool) const; void draw(BufferView *, LyXFont const &, int, float &, bool) const;
/// ///
void Metrics() const; void metrics() const;
/// ///
void write(std::ostream &) 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)) if (!bv->lockInset(this))
lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl; lyxerr[Debug::MATHED] << "Cannot lock inset!!!" << endl;
Metrics(); metrics();
//bv->updateInset(this, false); //bv->updateInset(this, false);
if (x == 0) if (x == 0)
mathcursor->first(); mathcursor->first();
@ -295,14 +295,14 @@ vector<string> const InsetFormulaBase::getLabelList() const
void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty) void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
{ {
Metrics(); metrics();
bv->updateInset(this, dirty); 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; int y1;
istringstream is(arg.c_str()); istringstream is(arg.c_str());
is >> x >> y; is >> x >> y;
par_->GetXY(x1, y1); par_->getXY(x1, y1);
mathcursor->SetPos(x1 + x, y1 + y); mathcursor->SetPos(x1 + x, y1 + y);
updateLocal(bv, false); updateLocal(bv, false);
} }

View File

@ -117,7 +117,7 @@ public:
/// ///
MathInset * par() const; MathInset * par() const;
/// ///
virtual void Metrics() const; virtual void metrics() const;
protected: protected:
/// ///
virtual void updateLocal(BufferView * bv, bool mark_dirty); 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 void InsetFormulaMacro::write(ostream & os) const
{ {
os << "FormulaMacro "; os << "FormulaMacro ";
tmacro()->Write(os, false); tmacro()->write(os, false);
} }
int InsetFormulaMacro::latex(ostream & os, bool fragile, int InsetFormulaMacro::latex(ostream & os, bool fragile,
bool /*free_spacing*/) const bool /*free_spacing*/) const
{ {
tmacro()->Write(os, fragile); tmacro()->write(os, fragile);
return 2; return 2;
} }
int InsetFormulaMacro::ascii(ostream & os, int) const int InsetFormulaMacro::ascii(ostream & os, int) const
{ {
tmacro()->Write(os, false); tmacro()->write(os, false);
return 0; return 0;
} }
@ -97,7 +97,7 @@ void InsetFormulaMacro::read(LyXLex & lex)
// Awful hack... // Awful hack...
par_ = mathed_parse(lex); par_ = mathed_parse(lex);
MathMacroTable::insertTemplate(tmacro()); 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 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(); 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) if (fragile)
os << "\\protect"; os << "\\protect";
@ -31,7 +31,7 @@ void MathArrayInset::Write(std::ostream & os, bool fragile) const
os << colinfo_[col].h_align_; os << colinfo_[col].h_align_;
os << "}\n"; os << "}\n";
MathGridInset::Write(os, fragile); MathGridInset::write(os, fragile);
if (fragile) if (fragile)
os << "\\protect"; os << "\\protect";

View File

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

View File

@ -9,7 +9,7 @@ using std::ostream;
MathBigopInset::MathBigopInset(string const & name, int id) MathBigopInset::MathBigopInset(string const & name, int id)
: sym_(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; //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
os << '\\' << name(); os << '\\' << name();
} }
void MathBigopInset::WriteNormal(ostream & os) const void MathBigopInset::writeNormal(ostream & os) const
{ {
os << "[bigop " << name() << "] "; os << "[bigop " << name() << "] ";
} }
void MathBigopInset::Metrics(MathStyles st) void MathBigopInset::metrics(MathStyles st)
{ {
//cerr << "\nBigopDraw\n"; //cerr << "\nBigopDraw\n";
size(st); size(st);

View File

@ -12,11 +12,11 @@ public:
/// ///
MathInset * clone() const; 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); void draw(Painter &, int, int);
/// ///

View File

@ -239,8 +239,8 @@ bool MathCursor::Left(bool sel)
if (macro_mode) { if (macro_mode) {
// was MacroModeBack() // was MacroModeBack()
if (!imacro->name().empty()) { if (!imacro->name().empty()) {
imacro->SetName(imacro->name().substr(0, imacro->name().length()-1)); imacro->setName(imacro->name().substr(0, imacro->name().length()-1));
imacro->Metrics(imacro->size()); imacro->metrics(imacro->size());
} else } else
MacroModeClose(); MacroModeClose();
return true; return true;
@ -402,7 +402,7 @@ void MathCursor::insert(char c, MathTextCodes t)
if (macro_mode) { if (macro_mode) {
if (MathIsAlphaFont(t) || t == LM_TC_MIN) { if (MathIsAlphaFont(t) || t == LM_TC_MIN) {
// was MacroModeinsert(c); // was MacroModeinsert(c);
imacro->SetName(imacro->name() + static_cast<char>(c)); imacro->setName(imacro->name() + static_cast<char>(c));
return; return;
} }
} }
@ -604,7 +604,7 @@ bool MathCursor::toggleLimits()
void MathCursor::SetSize(MathStyles size) 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) if (oldsel)
SelPaste(); 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) { for (int i = Cursor_.size() - 1; i >= 0; --i) {
//lyxerr << "checking level " << i << "\n"; //lyxerr << "checking level " << i << "\n";
if (Cursor_[i].par_->GetType() == t) { if (Cursor_[i].par_->getType() == t) {
idx = Cursor_[i].idx_; idx = Cursor_[i].idx_;
return Cursor_[i].par_; return Cursor_[i].par_;
} }
@ -1169,7 +1169,7 @@ void MathCursor::splitCell()
void MathCursor::breakLine() void MathCursor::breakLine()
{ {
MathMatrixInset * p = static_cast<MathMatrixInset *>(formula()->par()); 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->mutate(LM_OT_EQNARRAY);
p->addRow(0); p->addRow(0);
cursor().idx_ = p->nrows(); 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; size_ = st;
width_ = xcell(0).width(); width_ = xcell(0).width();
ascent_ = xcell(0).ascent(); 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 && if (fragile &&
(name_ == "overbrace" || (name_ == "overbrace" ||
@ -75,15 +75,15 @@ void MathDecorationInset::Write(ostream & os, bool fragile) const
else else
os << '{'; os << '{';
cell(0).Write(os, fragile); cell(0).write(os, fragile);
if (deco_ != LM_not) if (deco_ != LM_not)
os << '}'; os << '}';
} }
void MathDecorationInset::WriteNormal(ostream & os) const void MathDecorationInset::writeNormal(ostream & os) const
{ {
os << "[" << name_ << " "; os << "[" << name_ << " ";
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << "] "; os << "] ";
} }

View File

@ -20,11 +20,11 @@ public:
/// ///
void draw(Painter &, int, int); 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: private:
/// ///
int deco_; 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_ != '|') ? latexkeys const * l = (left_ != '|') ?
lm_get_key_by_id(left_, LM_TK_SYM) : 0; 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_) << ' '; os << char(left_) << ' ';
} }
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "\\right"; os << "\\right";
if (r) 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; size_ = st;
ascent_ = xcell(0).ascent() + 2; ascent_ = xcell(0).ascent() + 2;
descent_ = xcell(0).descent() + 2; descent_ = xcell(0).descent() + 2;

View File

@ -20,9 +20,9 @@ public:
/// ///
void draw(Painter &, int, int); 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: private:
int dw() const; 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); size(st);
mathed_char_dim(LM_TC_VAR, size(), 'M', ascent_, descent_, width_); 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() << ' '; os << '\\' << name() << ' ';
} }
void MathDotsInset::WriteNormal(ostream & os) const void MathDotsInset::writeNormal(ostream & os) const
{ {
os << "[" << name() << "] "; os << "[" << name() << "] ";
} }

View File

@ -19,11 +19,11 @@ public:
/// ///
void draw(Painter &, int, int); 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: protected:
/// ///
int dh_; 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); size_ = smallerStyleFrac(st);
xcell(0).Metrics(size_); xcell(0).metrics(size_);
xcell(1).Metrics(size_); xcell(1).metrics(size_);
width_ = std::max(xcell(0).width(), xcell(1).width()) + 4; width_ = std::max(xcell(0).width(), xcell(1).width()) + 4;
ascent_ = xcell(0).height() + 4 + 5; ascent_ = xcell(0).height() + 4 + 5;
descent_ = xcell(1).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() << '{'; os << '\\' << name() << '{';
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "}{"; os << "}{";
cell(1).Write(os, fragile); cell(1).write(os, fragile);
os << '}'; os << '}';
} }
void MathFracInset::WriteNormal(std::ostream & os) const void MathFracInset::writeNormal(std::ostream & os) const
{ {
os << '[' << name() << ' '; os << '[' << name() << ' ';
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << " "; os << " ";
cell(1).WriteNormal(os); cell(1).writeNormal(os);
os << "] "; os << "] ";
} }

View File

@ -18,11 +18,11 @@ public:
/// ///
virtual MathInset * clone() const; 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); 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) MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
: MathInset(0, nm, 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_ << ' '; os << "\\" << name_ << ' ';
} }
void MathFuncInset::WriteNormal(std::ostream & os) const void MathFuncInset::writeNormal(std::ostream & os) const
{ {
os << "[" << name_ << "] "; os << "[" << name_ << "] ";
} }
void MathFuncInset::Metrics(MathStyles st) void MathFuncInset::metrics(MathStyles st)
{ {
size_ = st; size_ = st;
if (name_.empty()) if (name_.empty())

View File

@ -21,11 +21,11 @@ public:
/// ///
void draw(Painter &, int, int); 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: private:
/// ///
bool lims_; bool lims_;

View File

@ -74,10 +74,10 @@ char MathGridInset::valign() const
return v_align_; return v_align_;
} }
void MathGridInset::Metrics(MathStyles st) void MathGridInset::metrics(MathStyles st)
{ {
// let the cells adjust themselves // let the cells adjust themselves
MathInset::Metrics(st); MathInset::metrics(st);
size_ = st; size_ = st;
// adjust vertical structure // 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) { for (int row = 0; row < nrows(); ++row) {
if (row) if (row)
@ -220,7 +220,7 @@ void MathGridInset::Write(std::ostream & os, bool fragile) const
for (int col = 0; col < ncols(); ++col) { for (int col = 0; col < ncols(); ++col) {
if (col) if (col)
os << " & "; 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; 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); 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; return objtype;
} }
void MathInset::SetType(MathInsetTypes t) void MathInset::setType(MathInsetTypes t)
{ {
objtype = t; objtype = t;
} }
void MathInset::SetName(string const & n) void MathInset::setName(string const & n)
{ {
name_ = n; name_ = n;
} }
@ -103,7 +103,7 @@ void MathInset::size(MathStyles s)
std::ostream & operator<<(std::ostream & os, MathInset const & inset) std::ostream & operator<<(std::ostream & os, MathInset const & inset)
{ {
inset.Write(os, false); inset.write(os, false);
return os; return os;
} }
@ -170,11 +170,11 @@ void MathInset::substitute(MathArray & array, MathMacro const & m) const
array.push_back(p); array.push_back(p);
} }
void MathInset::Metrics(MathStyles st) void MathInset::metrics(MathStyles st)
{ {
size_ = st; size_ = st;
for (int i = 0; i < nargs(); ++i) 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::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(); x = xo();
y = yo(); 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) { if (sz >= 0) {
size_ = sz; 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_ << "] "; os << "[" << name_ << "] ";
} }
@ -326,7 +326,7 @@ void MathInset::WriteNormal(std::ostream & os) const
void MathInset::dump() const void MathInset::dump() const
{ {
lyxerr << "---------------------------------------------\n"; lyxerr << "---------------------------------------------\n";
Write(lyxerr, false); write(lyxerr, false);
lyxerr << "\n"; lyxerr << "\n";
for (int i = 0; i < nargs(); ++i) for (int i = 0; i < nargs(); ++i)
lyxerr << cell(i) << "\n"; lyxerr << cell(i) << "\n";
@ -361,10 +361,10 @@ bool MathInset::covers(int x, int y) const
y <= yo_ + descent_; y <= yo_ + descent_;
} }
void MathInset::Validate(LaTeXFeatures & features) const void MathInset::validate(LaTeXFeatures & features) const
{ {
for (int i = 0; i < nargs(); ++i) 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 std::vector<int> MathInset::idxBetween(int from, int to) const

View File

@ -43,28 +43,25 @@ class LaTeXFeatures;
class MathInset { class MathInset {
public: public:
/** A math inset has a name (usually its LaTeX name),
type and font-size
*/
/// ///
explicit MathInset explicit MathInset
(int na = 0, string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE); (int na = 0, string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE);
/// The virtual base destructor /// the virtual base destructor
virtual ~MathInset() {} virtual ~MathInset() {}
/// Draw the object /// draw the object, sets xo_ and yo_ cached values
virtual void draw(Painter &, int x, int baseline) = 0; virtual void draw(Painter &, int x, int baseline) = 0;
/// Write LaTeX and Lyx code /// write LaTeX and Lyx code
virtual void Write(std::ostream &, bool fragile) const = 0; virtual void write(std::ostream &, bool fragile) const = 0;
/// Write normalized content /// write normalized content
virtual void WriteNormal(std::ostream &) const; virtual void writeNormal(std::ostream &) const;
/// Reproduces itself /// reproduce itself
virtual MathInset * clone() const = 0; 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; virtual void substitute(MathArray & array, MathMacro const & macro) const;
/// Compute the size of the object /// compute the size of the object, sets ascend_, descend_ and width_
virtual void Metrics(MathStyles st) = 0; virtual void metrics(MathStyles st) = 0;
/// ///
virtual int ascent() const; virtual int ascent() const;
/// ///
@ -80,12 +77,14 @@ public:
/// ///
string const & name() 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 //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; MathStyles size() const;
@ -172,10 +171,10 @@ public:
virtual void delCol(int) {} 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; bool covers(int x, int y) const;
/// Identifies things that can get scripts /// Identifies things that can get scripts
@ -196,24 +195,24 @@ public:
void dump() const; void dump() const;
/// ///
void Validate(LaTeXFeatures & features) const; void validate(LaTeXFeatures & features) const;
/// ///
static int workwidth; static int workwidth;
protected: protected:
/// /// usually the LaTeX name of the thingy
string name_; string name_;
/// ///
MathInsetTypes objtype; MathInsetTypes objtype;
/// /// the width of this inset as computed by metrics()
int width_; int width_;
/// ///
int ascent_; int ascent_;
/// ///
int descent_; int descent_;
/// ///
void size(MathStyles s); void size(MathStyles s);
/// /// the used font size
MathStyles size_; MathStyles size_;
protected: protected:
@ -222,14 +221,14 @@ protected:
/** /**
* The contents of the inset are contained here. * The contents of the inset are contained here.
* Each inset is build from a number of insets. * Each inset is build from a number of insets.
* For instance, a
*/ */
cells_type cells_; cells_type cells_;
private: 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_; int xo_;
/// /// cached cursor start position in pixels from the document top
int yo_; 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)) { if (mathcursor && mathcursor->isInside(this)) {
expanded_ = tmplate_->xcell(0); expanded_ = tmplate_->xcell(0);
expanded_.Metrics(st); expanded_.metrics(st);
size_ = st; size_ = st;
width_ = expanded_.width() + 4; width_ = expanded_.width() + 4;
ascent_ = expanded_.ascent() + 2; ascent_ = expanded_.ascent() + 2;
@ -68,7 +68,7 @@ void MathMacro::Metrics(MathStyles st)
for (int i = 0; i < nargs(); ++i) { for (int i = 0; i < nargs(); ++i) {
MathXArray & c = xcell(i); MathXArray & c = xcell(i);
c.Metrics(st); c.metrics(st);
width_ = std::max(width_, c.width() + lwid); width_ = std::max(width_, c.width() + lwid);
descent_ += std::max(c.ascent(), lasc) + 5; descent_ += std::max(c.ascent(), lasc) + 5;
descent_ += std::max(c.descent(), ldes) + 5; descent_ += std::max(c.descent(), ldes) + 5;
@ -76,7 +76,7 @@ void MathMacro::Metrics(MathStyles st)
} else { } else {
expanded_ = tmplate_->xcell(0); expanded_ = tmplate_->xcell(0);
expanded_.data_.substitute(*this); expanded_.data_.substitute(*this);
expanded_.Metrics(st); expanded_.metrics(st);
size_ = st; size_ = st;
width_ = expanded_.width() + 6; width_ = expanded_.width() + 6;
ascent_ = expanded_.ascent() + 3; ascent_ = expanded_.ascent() + 3;
@ -90,7 +90,7 @@ void MathMacro::draw(Painter & pain, int x, int y)
xo(x); xo(x);
yo(y); yo(y);
Metrics(size()); metrics(size());
LColor::color col; LColor::color col;
@ -138,12 +138,12 @@ void MathMacro::dump(std::ostream & os) const
os << endl; os << endl;
} }
void MathMacro::Write(std::ostream & os, bool fragile) const void MathMacro::write(std::ostream & os, bool fragile) const
{ {
os << '\\' << name_; os << '\\' << name_;
for (int i = 0; i < nargs(); ++i) { for (int i = 0; i < nargs(); ++i) {
os << '{'; os << '{';
cell(i).Write(os, fragile); cell(i).write(os, fragile);
os << '}'; os << '}';
} }
if (nargs() == 0) 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_ << " "; os << "[macro " << name_ << " ";
for (int i = 0; i < nargs(); ++i) { for (int i = 0; i < nargs(); ++i) {
cell(i).WriteNormal(os); cell(i).writeNormal(os);
os << ' '; 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") if (name_ == "binom")
features.binom = true; features.binom = true;
MathInset::Validate(features); MathInset::validate(features);
} }

View File

@ -43,13 +43,13 @@ public:
/// ///
void draw(Painter &, int, int); void draw(Painter &, int, int);
/// ///
void Metrics(MathStyles st); void metrics(MathStyles st);
/// ///
MathInset * clone() const; 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; void dump(std::ostream & os) const;
@ -63,7 +63,7 @@ public:
bool idxRight(int &, int &) const; bool idxRight(int &, int &) const;
/// ///
void Validate(LaTeXFeatures &) const; void validate(LaTeXFeatures &) const;
private: 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"; char str[] = "#0";
str[1] += number_; 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_ << ' '; os << '#' << number_ << ' ';
} }
void MathMacroArgument::WriteNormal(std::ostream & os) const void MathMacroArgument::writeNormal(std::ostream & os) const
{ {
os << "[macroarg " << number_ << "] "; os << "[macroarg " << number_ << "] ";
} }

View File

@ -18,13 +18,13 @@ public:
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
void Metrics(MathStyles st); void metrics(MathStyles st);
/// ///
void draw(Painter &, int x, int baseline); 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 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_ << "}"; os << "\n\\newcommand{\\" << name_ << "}";
@ -44,14 +44,14 @@ void MathMacroTemplate::Write(std::ostream & os, bool fragile) const
os << "[" << numargs_ << "]"; os << "[" << numargs_ << "]";
os << "{"; os << "{";
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "}\n"; os << "}\n";
} }
void MathMacroTemplate::Metrics(MathStyles st) void MathMacroTemplate::metrics(MathStyles st)
{ {
xcell(0).Metrics(st); xcell(0).metrics(st);
size_ = st; size_ = st;
width_ = xcell(0).width() + 4; width_ = xcell(0).width() + 4;
ascent_ = xcell(0).ascent() + 2; ascent_ = xcell(0).ascent() + 2;

View File

@ -24,7 +24,7 @@ public:
/// ///
MathInset * clone() const; MathInset * clone() const;
/// ///
void Write(std::ostream &, bool fragile) const; void write(std::ostream &, bool fragile) const;
/// Number of arguments /// Number of arguments
int numargs() const; int numargs() const;
/// ///
@ -32,7 +32,7 @@ public:
/// ///
void draw(Painter &, int, int); void draw(Painter &, int, int);
/// ///
void Metrics(MathStyles st); void metrics(MathStyles st);
private: private:
/// ///
int numargs_; 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 // let the cells adjust themselves
MathGridInset::Metrics(size_); MathGridInset::metrics(size_);
if (display()) { if (display()) {
ascent_ += 12; 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); header_write(os);
@ -144,7 +144,7 @@ void MathMatrixInset::Write(std::ostream & os, bool fragile) const
for (int col = 0; col < ncols(); ++col) { for (int col = 0; col < ncols(); ++col) {
if (col) if (col)
os << " & "; os << " & ";
cell(index(row, col)).Write(os, fragile); cell(index(row, col)).write(os, fragile);
} }
if (n) { if (n) {
if (!label_[row].empty()) if (!label_[row].empty())
@ -189,7 +189,7 @@ bool MathMatrixInset::ams() const
bool MathMatrixInset::display() 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 bool MathMatrixInset::numberedType() const
{ {
if (GetType() == LM_OT_SIMPLE) if (getType() == LM_OT_SIMPLE)
return false; return false;
for (int row = 0; row < nrows(); ++row) for (int row = 0; row < nrows(); ++row)
if (!nonum_[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(); features.amsstyle = ams();
// Validation is necessary only if not using AMS math. // 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) //if (features.amsstyle)
// return; // return;
features.boldsymbol = true; features.boldsymbol = true;
//features.binom = 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(); bool n = numberedType();
switch (GetType()) { switch (getType()) {
case LM_OT_SIMPLE: case LM_OT_SIMPLE:
os << "\\("; os << "\\(";
break; break;
@ -268,7 +268,7 @@ void MathMatrixInset::footer_write(std::ostream & os) const
{ {
bool n = numberedType(); bool n = numberedType();
switch (GetType()) { switch (getType()) {
case LM_OT_SIMPLE: case LM_OT_SIMPLE:
os << "\\)"; os << "\\)";
break; break;
@ -322,7 +322,7 @@ void MathMatrixInset::delRow(int row)
void MathMatrixInset::addCol(int col) void MathMatrixInset::addCol(int col)
{ {
switch (GetType()) { switch (getType()) {
case LM_OT_EQUATION: case LM_OT_EQUATION:
mutate(LM_OT_EQNARRAY); mutate(LM_OT_EQNARRAY);
break; break;
@ -347,7 +347,7 @@ void MathMatrixInset::addCol(int col)
void MathMatrixInset::delCol(int col) void MathMatrixInset::delCol(int col)
{ {
switch (GetType()) { switch (getType()) {
case LM_OT_ALIGN: case LM_OT_ALIGN:
MathGridInset::delCol(col); MathGridInset::delCol(col);
break; break;
@ -395,7 +395,7 @@ void MathMatrixInset::mutate(string const & newtype)
dump(); dump();
return; return;
} }
//lyxerr << "mutating from '" << GetType() << "' to '" << newtype << "'\n"; //lyxerr << "mutating from '" << getType() << "' to '" << newtype << "'\n";
mutate(typecode(newtype)); mutate(typecode(newtype));
} }
@ -410,14 +410,14 @@ void MathMatrixInset::glueall()
void MathMatrixInset::mutate(short 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; return;
switch (GetType()) { switch (getType()) {
case LM_OT_SIMPLE: case LM_OT_SIMPLE:
SetType(LM_OT_EQUATION); setType(LM_OT_EQUATION);
numbered(0, false); numbered(0, false);
mutate(newtype); mutate(newtype);
break; break;
@ -425,7 +425,7 @@ void MathMatrixInset::mutate(short newtype)
case LM_OT_EQUATION: case LM_OT_EQUATION:
switch (newtype) { switch (newtype) {
case LM_OT_SIMPLE: case LM_OT_SIMPLE:
SetType(LM_OT_SIMPLE); setType(LM_OT_SIMPLE);
break; break;
case LM_OT_ALIGN: { case LM_OT_ALIGN: {
@ -438,7 +438,7 @@ void MathMatrixInset::mutate(short newtype)
cell(1).erase(0, pos); cell(1).erase(0, pos);
halign("rl"); halign("rl");
SetType(LM_OT_ALIGN); setType(LM_OT_ALIGN);
break; break;
} }
@ -459,7 +459,7 @@ void MathMatrixInset::mutate(short newtype)
cell(2).erase(0, pos2); cell(2).erase(0, pos2);
halign("rcl"); halign("rcl");
SetType(LM_OT_EQNARRAY); setType(LM_OT_EQNARRAY);
mutate(newtype); mutate(newtype);
break; break;
} }
@ -500,7 +500,7 @@ void MathMatrixInset::mutate(short newtype)
cell(c).push_back(cell(c + 1)); cell(c).push_back(cell(c + 1));
} }
MathGridInset::delCol(2); MathGridInset::delCol(2);
SetType(LM_OT_ALIGN); setType(LM_OT_ALIGN);
halign("rl"); halign("rl");
mutate(newtype); mutate(newtype);
break; break;
@ -514,20 +514,20 @@ void MathMatrixInset::mutate(short newtype)
case LM_OT_EQUATION: case LM_OT_EQUATION:
case LM_OT_EQNARRAY: case LM_OT_EQNARRAY:
MathGridInset::addCol(1); MathGridInset::addCol(1);
SetType(LM_OT_EQNARRAY); setType(LM_OT_EQNARRAY);
halign("rcl"); halign("rcl");
mutate(newtype); mutate(newtype);
break; break;
default: default:
lyxerr << "mutation from '" << GetType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented\n";
break; break;
} }
break; break;
default: default:
lyxerr << "mutation from '" << GetType() lyxerr << "mutation from '" << getType()
<< "' to '" << newtype << "' not implemented\n"; << "' to '" << newtype << "' not implemented\n";
} }
} }

View File

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

View File

@ -478,7 +478,7 @@ MathInset * mathed_parse()
lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n"; lyxerr[Debug::MATHED] << "1: unknown math environment: " << typ << "\n";
} }
p->SetName(latex_mathenv[i].basename); p->setName(latex_mathenv[i].basename);
break; break;
} }
@ -762,7 +762,7 @@ void mathed_parse(MathArray & array, unsigned flags)
for (int i = 0; i < m->nargs(); ++i) for (int i = 0; i < m->nargs(); ++i)
mathed_parse(m->cell(i), FLAG_ITEM); mathed_parse(m->cell(i), FLAG_ITEM);
array.push_back(m); array.push_back(m);
m->Metrics(LM_ST_TEXT); m->metrics(LM_ST_TEXT);
} else } else
array.push_back(new MathFuncInset(yytext, LM_OT_UNDEF)); array.push_back(new MathFuncInset(yytext, LM_OT_UNDEF));
break; 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; size_ = st;
ascent_ = std::max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2; ascent_ = std::max(xcell(0).ascent() + 5, xcell(1).ascent()) + 2;
descent_ = std::max(xcell(1).descent() + 5, xcell(0).descent()) + 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["; os << "\\sqrt[";
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "]{"; os << "]{";
cell(1).Write(os, fragile); cell(1).write(os, fragile);
os << '}'; os << '}';
} }
void MathRootInset::WriteNormal(std::ostream & os) const void MathRootInset::writeNormal(std::ostream & os) const
{ {
os << "[root "; os << "[root ";
cell(1).WriteNormal(os); cell(1).writeNormal(os);
os << " "; os << " ";
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << "] "; os << "] ";
} }

View File

@ -35,11 +35,11 @@ public:
/// ///
void draw(Painter &, int x, int baseline); 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; 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_) { if (symbol_) {
symbol_->Write(os, fragile); symbol_->write(os, fragile);
if (limits()) if (limits())
os << (limits() == 1 ? "\\limits" : "\\nolimits"); os << (limits() == 1 ? "\\limits" : "\\nolimits");
} }
if (up()) { if (up()) {
os << "^{"; os << "^{";
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "}"; os << "}";
} }
if (down()) { if (down()) {
os << "_{"; os << "_{";
cell(1).Write(os, fragile); cell(1).write(os, fragile);
os << "}"; os << "}";
} }
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_) if (limits() && symbol_)
os << "[" << (limits() ? "limits" : "nolimits") << "]"; os << "[" << (limits() ? "limits" : "nolimits") << "]";
if (up()) { if (up()) {
os << "[superscript "; os << "[superscript ";
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << "] "; os << "] ";
} }
if (down()) { if (down()) {
os << "[subscript "; os << "[subscript ";
cell(1).WriteNormal(os); cell(1).writeNormal(os);
os << "] "; os << "] ";
} }
} }
void MathScriptInset::Metrics(MathStyles st) void MathScriptInset::metrics(MathStyles st)
{ {
size_ = st; size_ = st;
MathStyles tt = smallerStyleScript(st); MathStyles tt = smallerStyleScript(st);
xcell(0).Metrics(tt); xcell(0).metrics(tt);
xcell(1).Metrics(tt); xcell(1).metrics(tt);
width_ = std::max(xcell(0).width(), xcell(1).width()); width_ = std::max(xcell(0).width(), xcell(1).width());
if (hasLimits()) { if (hasLimits()) {
symbol_->Metrics(st); symbol_->metrics(st);
int wid = symbol_->width(); int wid = symbol_->width();
ascent_ = symbol_->ascent(); ascent_ = symbol_->ascent();
descent_ = symbol_->descent(); descent_ = symbol_->descent();
@ -244,7 +244,7 @@ void MathScriptInset::Metrics(MathStyles st)
int wid = 0; int wid = 0;
mathed_char_height(LM_TC_VAR, st, 'I', asc, des); mathed_char_height(LM_TC_VAR, st, 'I', asc, des);
if (symbol_) { if (symbol_) {
symbol_->Metrics(st); symbol_->metrics(st);
wid = symbol_->width(); wid = symbol_->width();
asc = symbol_->ascent(); asc = symbol_->ascent();
des = symbol_->descent(); des = symbol_->descent();

View File

@ -26,11 +26,11 @@ public:
/// ///
MathInset * clone() const; 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 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_; ascent_ = xcell(0).ascent_;
descent_ = xcell(0).descent_; descent_ = xcell(0).descent_;
width_ = xcell(0).width_; width_ = xcell(0).width_;
} }
void MathSizeInset::Write(std::ostream & os, bool fragile) const void MathSizeInset::write(std::ostream & os, bool fragile) const
{ {
os << "{\\" << name() << " "; os << "{\\" << name() << " ";
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << "}"; os << "}";
} }
void MathSizeInset::WriteNormal(std::ostream & os) const void MathSizeInset::writeNormal(std::ostream & os) const
{ {
os << "[" << name() << " "; os << "[" << name() << " ";
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << "]"; os << "]";
} }

View File

@ -20,13 +20,13 @@ public:
/// ///
virtual MathInset * clone() const; virtual MathInset * clone() const;
/// ///
void Metrics(MathStyles st); void metrics(MathStyles st);
/// ///
void draw(Painter &, int x, int baseline); 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: 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) if (space_ >= 0 && space_ < 6)
os << '\\' << latex_mathspace[space_] << ' '; os << '\\' << latex_mathspace[space_] << ' ';
} }
void MathSpaceInset::WriteNormal(std::ostream & os) const void MathSpaceInset::writeNormal(std::ostream & os) const
{ {
os << "[space " << space_ << "] "; os << "[space " << space_ << "] ";
} }
void MathSpaceInset::Metrics(MathStyles st) void MathSpaceInset::metrics(MathStyles st)
{ {
size_ = st; size_ = st;
width_ = space_ ? space_ * 2 : 2; width_ = space_ ? space_ * 2 : 2;

View File

@ -19,11 +19,11 @@ public:
/// ///
void draw(Painter &, int, int); 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; } 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; size_ = st;
ascent_ = xcell(0).ascent() + 4; ascent_ = xcell(0).ascent() + 4;
descent_ = xcell(0).descent() + 2; 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{"; os << "\\sqrt{";
cell(0).Write(os, fragile); cell(0).write(os, fragile);
os << '}'; os << '}';
} }
void MathSqrtInset::WriteNormal(std::ostream & os) const void MathSqrtInset::writeNormal(std::ostream & os) const
{ {
os << "[sqrt "; os << "[sqrt ";
cell(0).WriteNormal(os); cell(0).writeNormal(os);
os << "] "; os << "] ";
} }

View File

@ -20,10 +20,10 @@ public:
/// ///
void draw(Painter &, int x, int baseline); 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 #endif

View File

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

View File

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