make a some members private

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4552 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-07-08 14:57:12 +00:00
parent f68213134c
commit 469946043f
9 changed files with 66 additions and 50 deletions

View File

@ -102,7 +102,8 @@ InsetFormula::InsetFormula()
InsetFormula::InsetFormula(InsetFormula const & other) InsetFormula::InsetFormula(InsetFormula const & other)
: par_(other.par_), : InsetFormulaBase(other),
par_(other.par_),
preview_(new PreviewImpl(*this)) preview_(new PreviewImpl(*this))
{} {}

View File

@ -19,7 +19,7 @@ MathInset * MathDiffInset::clone() const
void MathDiffInset::addDer(MathArray const & der) void MathDiffInset::addDer(MathArray const & der)
{ {
cells_.push_back(MathXArray()); cells_.push_back(MathXArray());
cells_.back().data_ = der; cells_.back().data() = der;
} }

View File

@ -299,7 +299,7 @@ void splitScripts(MathArray & ar)
// create extra script inset and move superscript over // create extra script inset and move superscript over
MathScriptInset * q = new MathScriptInset; MathScriptInset * q = new MathScriptInset;
q->ensure(true); q->ensure(true);
q->up().data_.swap(p->up().data_); q->up().data().swap(p->up().data());
p->removeScript(true); p->removeScript(true);
// insert new inset behind // insert new inset behind
@ -549,7 +549,7 @@ void extractIntegrals(MathArray & ar)
if (st != ar.end()) if (st != ar.end())
if (MathScriptInset * sub = (*st)->asScriptInset()) if (MathScriptInset * sub = (*st)->asScriptInset())
if (sub->hasDown()) { if (sub->hasDown()) {
p->cell(2) = sub->down().data_; p->cell(2) = sub->down().data();
++st; ++st;
} }
@ -557,7 +557,7 @@ void extractIntegrals(MathArray & ar)
if (st != ar.end()) if (st != ar.end())
if (MathScriptInset * sup = (*st)->asScriptInset()) if (MathScriptInset * sup = (*st)->asScriptInset())
if (sup->hasUp()) { if (sup->hasUp()) {
p->cell(3) = sup->up().data_; p->cell(3) = sup->up().data();
++st; ++st;
} }
@ -617,7 +617,7 @@ void extractSums(MathArray & ar)
if (MathScriptInset * sub = (*st)->asScriptInset()) if (MathScriptInset * sub = (*st)->asScriptInset())
if (sub->hasDown()) { if (sub->hasDown()) {
// try to figure out the summation index from the subscript // try to figure out the summation index from the subscript
MathArray & ar = sub->down().data_; MathArray & ar = sub->down().data();
MathArray::iterator it = MathArray::iterator it =
find_if(ar.begin(), ar.end(), &testEqualSign); find_if(ar.begin(), ar.end(), &testEqualSign);
if (it != ar.end()) { if (it != ar.end()) {
@ -636,7 +636,7 @@ void extractSums(MathArray & ar)
if (st != ar.end()) if (st != ar.end())
if (MathScriptInset * sup = (*st)->asScriptInset()) if (MathScriptInset * sup = (*st)->asScriptInset())
if (sup->hasUp()) { if (sup->hasUp()) {
p->cell(3) = sup->up().data_; p->cell(3) = sup->up().data();
++st; ++st;
} }
@ -741,7 +741,7 @@ void extractDiff(MathArray & ar)
if (script && script->hasUp()) { if (script && script->hasUp()) {
// things like d.../dx^n // things like d.../dx^n
int mult = 1; int mult = 1;
if (extractNumber(script->up().data_, mult)) { if (extractNumber(script->up().data(), mult)) {
//lyxerr << "mult: " << mult << endl; //lyxerr << "mult: " << mult << endl;
for (int i = 0; i < mult; ++i) for (int i = 0; i < mult; ++i)
diff->addDer(MathArray(dt + 1, st)); diff->addDer(MathArray(dt + 1, st));

View File

@ -87,14 +87,14 @@ MathXArray const & MathInset::xcell(idx_type) const
MathArray & MathInset::cell(idx_type) MathArray & MathInset::cell(idx_type)
{ {
lyxerr << "I don't have a cell 3\n"; lyxerr << "I don't have a cell 3\n";
return dummyCell.data_; return dummyCell.data();
} }
MathArray const & MathInset::cell(idx_type) const MathArray const & MathInset::cell(idx_type) const
{ {
lyxerr << "I don't have a cell 4\n"; lyxerr << "I don't have a cell 4\n";
return dummyCell.data_; return dummyCell.data();
} }

View File

@ -107,7 +107,7 @@ void MathMacro::metrics(MathMetricsInfo & mi) const
} }
expand(); expand();
expanded_.data_.substitute(*this); expanded_.data().substitute(*this);
expanded_.metrics(mi_); expanded_.metrics(mi_);
width_ = expanded_.width(); width_ = expanded_.width();
ascent_ = expanded_.ascent(); ascent_ = expanded_.ascent();
@ -199,21 +199,21 @@ void MathMacro::validate(LaTeXFeatures & features) const
void MathMacro::maplize(MapleStream & os) const void MathMacro::maplize(MapleStream & os) const
{ {
updateExpansion(); updateExpansion();
::maplize(expanded_.data_, os); ::maplize(expanded_.data(), os);
} }
void MathMacro::mathmlize(MathMLStream & os) const void MathMacro::mathmlize(MathMLStream & os) const
{ {
updateExpansion(); updateExpansion();
::mathmlize(expanded_.data_, os); ::mathmlize(expanded_.data(), os);
} }
void MathMacro::octavize(OctaveStream & os) const void MathMacro::octavize(OctaveStream & os) const
{ {
updateExpansion(); updateExpansion();
::octavize(expanded_.data_, os); ::octavize(expanded_.data(), os);
} }
@ -239,5 +239,5 @@ void MathMacro::write(WriteStream & os) const
void MathMacro::updateExpansion() const void MathMacro::updateExpansion() const
{ {
expand(); expand();
expanded_.data_.substitute(*this); expanded_.data().substitute(*this);
} }

View File

@ -38,13 +38,13 @@ MathXArray const & MathNestInset::xcell(idx_type i) const
MathArray & MathNestInset::cell(idx_type i) MathArray & MathNestInset::cell(idx_type i)
{ {
return cells_[i].data_; return cells_[i].data();
} }
MathArray const & MathNestInset::cell(idx_type i) const MathArray const & MathNestInset::cell(idx_type i) const
{ {
return cells_[i].data_; return cells_[i].data();
} }

View File

@ -361,11 +361,11 @@ void MathScriptInset::write2(MathInset const * nuc, WriteStream & os) const
else else
os << "{}"; os << "{}";
if (hasDown() && down().data_.size()) if (hasDown() && down().data().size())
os << "_{" << down().data_ << '}'; os << "_{" << down().data() << '}';
if (hasUp() && up().data_.size()) if (hasUp() && up().data().size())
os << "^{" << up().data_ << '}'; os << "^{" << up().data() << '}';
} }
@ -378,8 +378,8 @@ void MathScriptInset::normalize(NormalStream & os) const
void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const
{ {
bool d = hasDown() && down().data_.size(); bool d = hasDown() && down().data().size();
bool u = hasUp() && up().data_.size(); bool u = hasUp() && up().data().size();
if (u) if (u)
os << "[sup "; os << "[sup ";
@ -392,9 +392,9 @@ void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const
os << "[par]"; os << "[par]";
if (d) if (d)
os << down().data_ << ']'; os << down().data() << ']';
if (u) if (u)
os << up().data_ << ']'; os << up().data() << ']';
} }
@ -402,17 +402,17 @@ void MathScriptInset::maplize2(MathInset const * nuc, MapleStream & os) const
{ {
if (nuc) if (nuc)
os << nuc; os << nuc;
if (hasDown() && down().data_.size()) if (hasDown() && down().data().size())
os << '[' << down().data_ << ']'; os << '[' << down().data() << ']';
if (hasUp() && up().data_.size()) if (hasUp() && up().data().size())
os << "^(" << up().data_ << ')'; os << "^(" << up().data() << ')';
} }
void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & os) const void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & os) const
{ {
bool d = hasDown() && down().data_.size(); bool d = hasDown() && down().data().size();
bool u = hasUp() && up().data_.size(); bool u = hasUp() && up().data().size();
if (nuc) if (nuc)
if (d) //subscript only if nuc ! if (d) //subscript only if nuc !
@ -420,18 +420,18 @@ void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream &
else else
os << nuc; os << nuc;
if (u) if (u)
os << "^(" << up().data_ << ")"; os << "^(" << up().data() << ")";
if (nuc) if (nuc)
if (d) if (d)
os << "," << down().data_ << "]"; os << "," << down().data() << "]";
} }
void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const
{ {
bool d = hasDown() && down().data_.size(); bool d = hasDown() && down().data().size();
bool u = hasUp() && up().data_.size(); bool u = hasUp() && up().data().size();
if (u && d) if (u && d)
os << MTag("msubsup"); os << MTag("msubsup");
@ -446,11 +446,11 @@ void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const
os << "<mrow/>"; os << "<mrow/>";
if (u && d) if (u && d)
os << down().data_ << up().data_ << ETag("msubsup"); os << down().data() << up().data() << ETag("msubsup");
else if (u) else if (u)
os << up().data_ << ETag("msup"); os << up().data() << ETag("msup");
else if (d) else if (d)
os << down().data_ << ETag("msub"); os << down().data() << ETag("msub");
} }
@ -458,10 +458,10 @@ void MathScriptInset::octavize2(MathInset const * nuc, OctaveStream & os) const
{ {
if (nuc) if (nuc)
os << nuc; os << nuc;
if (hasDown() && down().data_.size()) if (hasDown() && down().data().size())
os << '[' << down().data_ << ']'; os << '[' << down().data() << ']';
if (hasUp() && up().data_.size()) if (hasUp() && up().data().size())
os << "^(" << up().data_ << ')'; os << "^(" << up().data() << ')';
} }

View File

@ -26,9 +26,9 @@ void MathSizeInset::metrics(MathMetricsInfo & mi) const
{ {
//MathStyleChanger dummy(mi.base, MathStyles(key_->id)); //MathStyleChanger dummy(mi.base, MathStyles(key_->id));
xcell(0).metrics(mi); xcell(0).metrics(mi);
ascent_ = xcell(0).ascent_ + 1; ascent_ = xcell(0).ascent() + 1;
descent_ = xcell(0).descent_ + 1; descent_ = xcell(0).descent() + 1;
width_ = xcell(0).width_ + 2; width_ = xcell(0).width() + 2;
} }

View File

@ -30,13 +30,13 @@ public:
/// constructor /// constructor
MathXArray(); MathXArray();
/// rebuild cached metrics information /// rebuild cached metrics information
void metrics(MathMetricsInfo & st) const; void metrics(MathMetricsInfo & mi) const;
/// redraw cell using cache metrics information /// redraw cell using cache metrics information
void draw(MathPainterInfo & pain, int x, int y) const; void draw(MathPainterInfo & pi, int x, int y) const;
/// rebuild cached metrics information /// rebuild cached metrics information
void metricsT(TextMetricsInfo const & st) const; void metricsT(TextMetricsInfo const & mi) const;
/// redraw cell using cache metrics information /// redraw cell using cache metrics information
void drawT(TextPainter & pain, int x, int y) const; void drawT(TextPainter & pi, int x, int y) const;
/// mark cell for re-drawing /// mark cell for re-drawing
void touch() const; void touch() const;
@ -77,8 +77,12 @@ public:
const_iterator begin() const { return data_.begin(); } const_iterator begin() const { return data_.begin(); }
/// end iterator of the underlying MathArray /// end iterator of the underlying MathArray
const_iterator end() const { return data_.end(); } const_iterator end() const { return data_.end(); }
/// access to data
MathArray const & data() const { return data_; }
/// access to data
MathArray & data() { return data_; }
public: private:
/// the underlying MathArray /// the underlying MathArray
MathArray data_; MathArray data_;
/// cached width of cell /// cached width of cell
@ -97,6 +101,17 @@ public:
mutable bool clean_; mutable bool clean_;
/// cached draw status of cell /// cached draw status of cell
mutable bool drawn_; mutable bool drawn_;
// cached metrics
struct Row {
///
Row();
/// y offset relative to yo
int yo;
/// glue between words
int glue;
};
std::vector<Row> rows_;
}; };
/// output cell on a stream /// output cell on a stream