]> git.lyx.org Git - features.git/commitdiff
fix the size of some variables to avoid compaq cxx warnings
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 1 Oct 2001 12:10:32 +0000 (12:10 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 1 Oct 2001 12:10:32 +0000 (12:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2826 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_fracbase.C
src/mathed/math_fracbase.h

index 76da0003379699d9f052533b7e48dc3e56dae4f1..213091f596ef85648ce1cec4edd55e22d98be3e2 100644 (file)
@@ -1,3 +1,15 @@
+2001-10-01  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * math_cursor.C:
+       * formula.C (localDispatch): fix a few of local variable sizes
+
+       * math_fracbase.C: change parameter types to match MathInset
+
+2001-09-27  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * math_cursor.C: fix type mismatches with what was declared in
+       math_cursor.h. 
+
 2001-09-28  Dekel Tsur  <dekelts@tau.ac.il>
 
        * math_matrixinset.C (header_write): Add \n after \begin{align}
index 7bcefdd8ea52fbf948caa83710e8a48a4bb9c94d..1a66a3663ce6166c1bea675ba602bfe4232538d0 100644 (file)
@@ -201,7 +201,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                        //lyxerr << "toggling line number\n";
                        if (display()) {
                                bv->lockedInsetStoreUndo(Undo::INSERT);
-                               int row = mathcursor->row();
+                               MathCursor::row_type row = mathcursor->row();
                                bool old = par_->numbered(row);
                                bv->owner()->message(old ? _("No number") : _("Number"));
                                par_->numbered(row, !old);
@@ -214,7 +214,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
                {
                        bv->lockedInsetStoreUndo(Undo::INSERT);
 
-                       int row = mathcursor->row();
+                       MathCursor::row_type row = mathcursor->row();
                        string old_label = par_->label(row);
                        string new_label = arg;
 
index 4558c55a380626932798983b778b24c4c12455b1..a9ae33e68bedf4bc55310b36f326ccd5bd63b536 100644 (file)
@@ -76,7 +76,7 @@ struct Selection
                if (i1.idx_ == i2.idx_)
                        i1.cell().erase(i1.pos_, i2.pos_);
                else {
-                       std::vector<unsigned int> indices = i1.par_->idxBetween(i1.idx_, i2.idx_);
+                       std::vector<MathInset::idx_type> indices = i1.par_->idxBetween(i1.idx_, i2.idx_);
                        for (unsigned i = 0; i < indices.size(); ++i)
                                i1.cell(indices[i]).erase();
                }
@@ -371,7 +371,7 @@ void MathCursor::setPos(int x, int y)
                        MathXArray const & ar = par()->xcell(i);
                        int x1 = x - ar.xo();
                        int y1 = y - ar.yo();
-                       int c  = ar.x2pos(x1);
+                       MathXArray::size_type c  = ar.x2pos(x1);
                        int xx = abs(x1 - ar.pos2x(c));
                        int yy = abs(y1);
                        //lyxerr << "idx: " << i << " xx: " << xx << " yy: " << yy
@@ -753,7 +753,7 @@ void MathCursor::drawSelection(Painter & pain) const
                int y2 = c.yo() + c.descent();
                pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
        } else {
-               std::vector<unsigned int> indices = i1.par_->idxBetween(i1.idx_, i2.idx_);
+               std::vector<MathInset::idx_type> indices = i1.par_->idxBetween(i1.idx_, i2.idx_);
                for (unsigned i = 0; i < indices.size(); ++i) {
                        MathXArray & c = i1.xcell(indices[i]);
                        int x1 = c.xo();
@@ -782,7 +782,8 @@ void MathCursor::handleFont(MathTextCodes t)
                getSelection(i1, i2); 
                if (i1.idx_ == i2.idx_) {
                        MathArray & ar = i1.cell();
-                       for (unsigned int pos = i1.pos_; pos != i2.pos_; ++pos) {
+                       for (MathInset::pos_type pos = i1.pos_;
+                            pos != i2.pos_; ++pos) {
                                MathInset * p = ar.at(pos)->nucleus();
                                if (p)
                                        p->handleFont(t);
@@ -833,25 +834,25 @@ InsetFormulaBase const * MathCursor::formula()
 }
 
 
-unsigned int MathCursor::idx() const
+MathCursor::idx_type MathCursor::idx() const
 {
        return cursor().idx_;
 }
 
 
-unsigned int & MathCursor::idx()
+MathCursor::idx_type & MathCursor::idx()
 {
        return cursor().idx_;
 }
 
 
-unsigned int MathCursor::pos() const
+MathCursor::pos_type MathCursor::pos() const
 {
        return cursor().pos_;
 }
 
 
-unsigned int & MathCursor::pos()
+MathCursor::pos_type & MathCursor::pos()
 {
        return cursor().pos_;
 }
@@ -869,7 +870,7 @@ bool MathCursor::selection() const
 }
 
 
-MathArrayInset * MathCursor::enclosingArray(unsigned int & idx) const
+MathArrayInset * MathCursor::enclosingArray(MathCursor::idx_type & idx) const
 {
        for (int i = Cursor_.size() - 1; i >= 0; --i) {
                if (Cursor_[i].par_->isArray()) {
@@ -924,19 +925,19 @@ void MathCursor::normalize() const
 }
 
 
-unsigned int MathCursor::size() const
+MathCursor::size_type MathCursor::size() const
 {
        return array().size();
 }
 
 
-unsigned int MathCursor::col() const
+MathCursor::col_type MathCursor::col() const
 {
        return par()->col(idx());
 }
 
 
-unsigned int MathCursor::row() const
+MathCursor::row_type MathCursor::row() const
 {
        return par()->row(idx());
 }
@@ -1067,10 +1068,10 @@ void MathCursor::breakLine()
                p->addRow(row());
 
                // split line
-               const unsigned int r = row();
-               for (unsigned int c = col() + 1; c < p->ncols(); ++c) {
-                       const unsigned int i1 = p->index(r, c);
-                       const unsigned int i2 = p->index(r + 1, c);     
+               const row_type r = row();
+               for (col_type c = col() + 1; c < p->ncols(); ++c) {
+                       const MathMatrixInset::idx_type i1 = p->index(r, c);
+                       const MathMatrixInset::idx_type i2 = p->index(r + 1, c);        
                        lyxerr << "swapping cells " << i1 << " and " << i2 << "\n";
                        p->cell(i1).swap(p->cell(i2));
                }
@@ -1084,17 +1085,17 @@ void MathCursor::breakLine()
 
 char MathCursor::valign() const
 {
-       unsigned int idx;
+       idx_type idx;
        MathArrayInset * p = enclosingArray(idx);
-       return p ? p->valign() : 0;
+       return p ? p->valign() : '\0';
 }
 
 
 char MathCursor::halign() const
 {
-       unsigned int idx;
+       idx_type idx;
        MathArrayInset * p = enclosingArray(idx);
-       return p ? p->halign(idx % p->ncols()) : 0;
+       return p ? p->halign(idx % p->ncols()) : '\0';
 }
 
 
@@ -1123,13 +1124,13 @@ MathCursorPos const & MathCursor::cursor() const
 }
 
 
-unsigned int MathCursor::cellXOffset() const
+int MathCursor::cellXOffset() const
 {
        return par()->cellXOffset(idx());
 }
 
 
-unsigned int MathCursor::cellYOffset() const
+int MathCursor::cellYOffset() const
 {
        return par()->cellYOffset(idx());
 }
@@ -1425,7 +1426,7 @@ bool operator<(MathCursorPos const & ti, MathCursorPos const & it)
 }
 
 
-MathArray & MathCursorPos::cell(unsigned int idx) const
+MathArray & MathCursorPos::cell(MathCursor::idx_type idx) const
 {
        return par_->cell(idx);
 }
@@ -1437,7 +1438,7 @@ MathArray & MathCursorPos::cell() const
 }
 
 
-MathXArray & MathCursorPos::xcell(unsigned int idx) const
+MathXArray & MathCursorPos::xcell(MathCursor::idx_type idx) const
 {
        return par_->xcell(idx);
 }
index 25501ba05eae8c87ece091441e5f885fae3d962b..7137547ad5c46dba0e94b1e0204c09558f9e414a 100644 (file)
@@ -277,9 +277,9 @@ private:
        /// write access to cursor cell index
        idx_type & idx();
        /// x-offset of current cell relative to par xo
-       idx_type cellXOffset() const;
+       int cellXOffset() const;
        /// y-offset of current cell relative to par yo
-       idx_type cellYOffset() const;
+       int cellYOffset() const;
        /// current x position relative to par xo
        int xpos() const;
        /// current y position relative to par yo
index e52a841fccd689220d2953e3db542bc9bc1eeb7f..aa17ea7e82f5aa40003cd1bde0ec4e320f6ae856 100644 (file)
@@ -10,19 +10,22 @@ MathFracbaseInset::MathFracbaseInset()
 {}
 
 
-bool MathFracbaseInset::idxRight(int &, int &) const
+bool MathFracbaseInset::idxRight(MathInset::idx_type &,
+                                MathInset::pos_type &) const
 {
        return false;
 }
 
 
-bool MathFracbaseInset::idxLeft(int &, int &) const
+bool MathFracbaseInset::idxLeft(MathInset::idx_type &,
+                               MathInset::pos_type &) const
 {
        return false;
 }
 
 
-bool MathFracbaseInset::idxUp(int & idx, int &) const
+bool MathFracbaseInset::idxUp(MathInset::idx_type & idx,
+                             MathInset::pos_type &) const
 {
        if (idx == 0)
                return false;
@@ -31,7 +34,8 @@ bool MathFracbaseInset::idxUp(int & idx, int &) const
 }
 
 
-bool MathFracbaseInset::idxDown(int & idx, int &) const
+bool MathFracbaseInset::idxDown(MathInset::idx_type & idx,
+                               MathInset::pos_type &) const
 {
        if (idx == 1)
                return false;
index 1236c8a69830b8f2b195455de06cf9acf89f124a..08f05017d5a9212623f6040432c8acbbbf0dddb6 100644 (file)
@@ -13,13 +13,13 @@ public:
        ///
        MathFracbaseInset();
        ///
-       bool idxUp(int &, int &) const;
+       bool idxUp(MathInset::idx_type &, MathInset::pos_type &) const;
        ///
-       bool idxDown(int &, int &) const;
+       bool idxDown(MathInset::idx_type &, MathInset::pos_type &) const;
        ///
-       bool idxLeft(int &, int &) const;
+       bool idxLeft(MathInset::idx_type &, MathInset::pos_type &) const;
        ///
-       bool idxRight(int &, int &) const;
+       bool idxRight(MathInset::idx_type &, MathInset::pos_type &) const;
 };
 
 #endif