From: André Pönitz Date: Mon, 8 Jul 2002 14:57:12 +0000 (+0000) Subject: make a some members private X-Git-Tag: 1.6.10~18949 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=469946043fdc6a238380146dd4caca268c72925d;p=features.git make a some members private git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4552 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 0de6a27e80..cf95fb007c 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -102,7 +102,8 @@ InsetFormula::InsetFormula() InsetFormula::InsetFormula(InsetFormula const & other) - : par_(other.par_), + : InsetFormulaBase(other), + par_(other.par_), preview_(new PreviewImpl(*this)) {} diff --git a/src/mathed/math_diffinset.C b/src/mathed/math_diffinset.C index bf30b4a7ce..0fb261878f 100644 --- a/src/mathed/math_diffinset.C +++ b/src/mathed/math_diffinset.C @@ -19,7 +19,7 @@ MathInset * MathDiffInset::clone() const void MathDiffInset::addDer(MathArray const & der) { cells_.push_back(MathXArray()); - cells_.back().data_ = der; + cells_.back().data() = der; } diff --git a/src/mathed/math_extern.C b/src/mathed/math_extern.C index a8fc186a10..df6de81e29 100644 --- a/src/mathed/math_extern.C +++ b/src/mathed/math_extern.C @@ -299,7 +299,7 @@ void splitScripts(MathArray & ar) // create extra script inset and move superscript over MathScriptInset * q = new MathScriptInset; q->ensure(true); - q->up().data_.swap(p->up().data_); + q->up().data().swap(p->up().data()); p->removeScript(true); // insert new inset behind @@ -549,7 +549,7 @@ void extractIntegrals(MathArray & ar) if (st != ar.end()) if (MathScriptInset * sub = (*st)->asScriptInset()) if (sub->hasDown()) { - p->cell(2) = sub->down().data_; + p->cell(2) = sub->down().data(); ++st; } @@ -557,7 +557,7 @@ void extractIntegrals(MathArray & ar) if (st != ar.end()) if (MathScriptInset * sup = (*st)->asScriptInset()) if (sup->hasUp()) { - p->cell(3) = sup->up().data_; + p->cell(3) = sup->up().data(); ++st; } @@ -617,7 +617,7 @@ void extractSums(MathArray & ar) if (MathScriptInset * sub = (*st)->asScriptInset()) if (sub->hasDown()) { // try to figure out the summation index from the subscript - MathArray & ar = sub->down().data_; + MathArray & ar = sub->down().data(); MathArray::iterator it = find_if(ar.begin(), ar.end(), &testEqualSign); if (it != ar.end()) { @@ -636,7 +636,7 @@ void extractSums(MathArray & ar) if (st != ar.end()) if (MathScriptInset * sup = (*st)->asScriptInset()) if (sup->hasUp()) { - p->cell(3) = sup->up().data_; + p->cell(3) = sup->up().data(); ++st; } @@ -741,7 +741,7 @@ void extractDiff(MathArray & ar) if (script && script->hasUp()) { // things like d.../dx^n int mult = 1; - if (extractNumber(script->up().data_, mult)) { + if (extractNumber(script->up().data(), mult)) { //lyxerr << "mult: " << mult << endl; for (int i = 0; i < mult; ++i) diff->addDer(MathArray(dt + 1, st)); diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index fb8e78baff..5b29fefe34 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -87,14 +87,14 @@ MathXArray const & MathInset::xcell(idx_type) const MathArray & MathInset::cell(idx_type) { lyxerr << "I don't have a cell 3\n"; - return dummyCell.data_; + return dummyCell.data(); } MathArray const & MathInset::cell(idx_type) const { lyxerr << "I don't have a cell 4\n"; - return dummyCell.data_; + return dummyCell.data(); } diff --git a/src/mathed/math_macro.C b/src/mathed/math_macro.C index bb0fc39a85..9983cf5f78 100644 --- a/src/mathed/math_macro.C +++ b/src/mathed/math_macro.C @@ -107,7 +107,7 @@ void MathMacro::metrics(MathMetricsInfo & mi) const } expand(); - expanded_.data_.substitute(*this); + expanded_.data().substitute(*this); expanded_.metrics(mi_); width_ = expanded_.width(); ascent_ = expanded_.ascent(); @@ -199,21 +199,21 @@ void MathMacro::validate(LaTeXFeatures & features) const void MathMacro::maplize(MapleStream & os) const { updateExpansion(); - ::maplize(expanded_.data_, os); + ::maplize(expanded_.data(), os); } void MathMacro::mathmlize(MathMLStream & os) const { updateExpansion(); - ::mathmlize(expanded_.data_, os); + ::mathmlize(expanded_.data(), os); } void MathMacro::octavize(OctaveStream & os) const { updateExpansion(); - ::octavize(expanded_.data_, os); + ::octavize(expanded_.data(), os); } @@ -239,5 +239,5 @@ void MathMacro::write(WriteStream & os) const void MathMacro::updateExpansion() const { expand(); - expanded_.data_.substitute(*this); + expanded_.data().substitute(*this); } diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index add5e81e5a..2cec6fa4d4 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -38,13 +38,13 @@ MathXArray const & MathNestInset::xcell(idx_type i) const MathArray & MathNestInset::cell(idx_type i) { - return cells_[i].data_; + return cells_[i].data(); } MathArray const & MathNestInset::cell(idx_type i) const { - return cells_[i].data_; + return cells_[i].data(); } diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index 6b448903c0..67e0e3af80 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -361,11 +361,11 @@ void MathScriptInset::write2(MathInset const * nuc, WriteStream & os) const else os << "{}"; - if (hasDown() && down().data_.size()) - os << "_{" << down().data_ << '}'; + if (hasDown() && down().data().size()) + os << "_{" << down().data() << '}'; - if (hasUp() && up().data_.size()) - os << "^{" << up().data_ << '}'; + if (hasUp() && up().data().size()) + os << "^{" << up().data() << '}'; } @@ -378,8 +378,8 @@ void MathScriptInset::normalize(NormalStream & os) const void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const { - bool d = hasDown() && down().data_.size(); - bool u = hasUp() && up().data_.size(); + bool d = hasDown() && down().data().size(); + bool u = hasUp() && up().data().size(); if (u) os << "[sup "; @@ -392,9 +392,9 @@ void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const os << "[par]"; if (d) - os << down().data_ << ']'; + os << down().data() << ']'; if (u) - os << up().data_ << ']'; + os << up().data() << ']'; } @@ -402,17 +402,17 @@ void MathScriptInset::maplize2(MathInset const * nuc, MapleStream & os) const { if (nuc) os << nuc; - if (hasDown() && down().data_.size()) - os << '[' << down().data_ << ']'; - if (hasUp() && up().data_.size()) - os << "^(" << up().data_ << ')'; + if (hasDown() && down().data().size()) + os << '[' << down().data() << ']'; + if (hasUp() && up().data().size()) + os << "^(" << up().data() << ')'; } void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & os) const { - bool d = hasDown() && down().data_.size(); - bool u = hasUp() && up().data_.size(); + bool d = hasDown() && down().data().size(); + bool u = hasUp() && up().data().size(); if (nuc) if (d) //subscript only if nuc ! @@ -420,18 +420,18 @@ void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & else os << nuc; if (u) - os << "^(" << up().data_ << ")"; + os << "^(" << up().data() << ")"; if (nuc) if (d) - os << "," << down().data_ << "]"; + os << "," << down().data() << "]"; } void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const { - bool d = hasDown() && down().data_.size(); - bool u = hasUp() && up().data_.size(); + bool d = hasDown() && down().data().size(); + bool u = hasUp() && up().data().size(); if (u && d) os << MTag("msubsup"); @@ -446,11 +446,11 @@ void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const os << ""; if (u && d) - os << down().data_ << up().data_ << ETag("msubsup"); + os << down().data() << up().data() << ETag("msubsup"); else if (u) - os << up().data_ << ETag("msup"); + os << up().data() << ETag("msup"); 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) os << nuc; - if (hasDown() && down().data_.size()) - os << '[' << down().data_ << ']'; - if (hasUp() && up().data_.size()) - os << "^(" << up().data_ << ')'; + if (hasDown() && down().data().size()) + os << '[' << down().data() << ']'; + if (hasUp() && up().data().size()) + os << "^(" << up().data() << ')'; } diff --git a/src/mathed/math_sizeinset.C b/src/mathed/math_sizeinset.C index 07c9cfdc99..5ba9927690 100644 --- a/src/mathed/math_sizeinset.C +++ b/src/mathed/math_sizeinset.C @@ -26,9 +26,9 @@ void MathSizeInset::metrics(MathMetricsInfo & mi) const { //MathStyleChanger dummy(mi.base, MathStyles(key_->id)); xcell(0).metrics(mi); - ascent_ = xcell(0).ascent_ + 1; - descent_ = xcell(0).descent_ + 1; - width_ = xcell(0).width_ + 2; + ascent_ = xcell(0).ascent() + 1; + descent_ = xcell(0).descent() + 1; + width_ = xcell(0).width() + 2; } diff --git a/src/mathed/math_xdata.h b/src/mathed/math_xdata.h index b35c062b9a..73d6008d41 100644 --- a/src/mathed/math_xdata.h +++ b/src/mathed/math_xdata.h @@ -30,13 +30,13 @@ public: /// constructor MathXArray(); /// rebuild cached metrics information - void metrics(MathMetricsInfo & st) const; + void metrics(MathMetricsInfo & mi) const; /// 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 - void metricsT(TextMetricsInfo const & st) const; + void metricsT(TextMetricsInfo const & mi) const; /// 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 void touch() const; @@ -77,8 +77,12 @@ public: const_iterator begin() const { return data_.begin(); } /// end iterator of the underlying MathArray 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 MathArray data_; /// cached width of cell @@ -97,6 +101,17 @@ public: mutable bool clean_; /// cached draw status of cell mutable bool drawn_; + + // cached metrics + struct Row { + /// + Row(); + /// y offset relative to yo + int yo; + /// glue between words + int glue; + }; + std::vector rows_; }; /// output cell on a stream