]> git.lyx.org Git - features.git/commitdiff
make a some members private
authorAndré Pönitz <poenitz@gmx.net>
Mon, 8 Jul 2002 14:57:12 +0000 (14:57 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Mon, 8 Jul 2002 14:57:12 +0000 (14:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4552 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/formula.C
src/mathed/math_diffinset.C
src/mathed/math_extern.C
src/mathed/math_inset.C
src/mathed/math_macro.C
src/mathed/math_nestinset.C
src/mathed/math_scriptinset.C
src/mathed/math_sizeinset.C
src/mathed/math_xdata.h

index 0de6a27e80f736a70350408f1cbd9bd9575efb88..cf95fb007c87c75ef30379235822617ea16a7678 100644 (file)
@@ -102,7 +102,8 @@ InsetFormula::InsetFormula()
 
 
 InsetFormula::InsetFormula(InsetFormula const & other)
-       : par_(other.par_),
+       :       InsetFormulaBase(other),
+               par_(other.par_),
          preview_(new PreviewImpl(*this))
 {}
 
index bf30b4a7ce4a7fdd142b4d8c5ab6efff4999d44f..0fb261878f87a4caae2fb3f0709b7bd470b3820d 100644 (file)
@@ -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;
 }
 
 
index a8fc186a10955cfbf68272b9cb801bb8f43da62f..df6de81e292464ea3c0fdae5cb4e6a95c492f7a7 100644 (file)
@@ -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));
index fb8e78baff01d742d5c96420cfdfadb6fc4022a3..5b29fefe340256d7fb10199593153e7287e2faa7 100644 (file)
@@ -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();
 }
 
 
index bb0fc39a85a707e8451e20112f42d0501f62887b..9983cf5f78b523af9c7425a1a17867bf75460d45 100644 (file)
@@ -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);
 }
index add5e81e5ab7533dfa92968479d6060410723e2a..2cec6fa4d460dd92bb86f3f8336167909923f4f3 100644 (file)
@@ -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();
 }
 
 
index 6b448903c0673414c6b4a52d8060432d2c188e3a..67e0e3af805e0218efd55d1b28e56e1a95811c70 100644 (file)
@@ -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 << "<mrow/>";
 
        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() << ')';
 }
 
 
index 07c9cfdc999e32b18b2fd3cb872184f5d5fa5027..5ba9927690f6c17c690b985f3308a3138f9af5b8 100644 (file)
@@ -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;
 }
 
 
index b35c062b9a575f02826100cec3fe7d52f511f658..73d6008d41f9f785ec1c49d2e3ba695b602ac99f 100644 (file)
@@ -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<Row> rows_;
 };
 
 /// output cell on a stream