]> git.lyx.org Git - lyx.git/commitdiff
constify the various incarnations of editXY
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 13 Aug 2004 19:14:17 +0000 (19:14 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 13 Aug 2004 19:14:17 +0000 (19:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8907 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
src/ChangeLog
src/insets/ChangeLog
src/insets/insetbase.C
src/insets/insetbase.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/lyxtext.h
src/mathed/ChangeLog
src/mathed/math_nestinset.C
src/mathed/math_nestinset.h
src/text2.C
src/text3.C

index 6aaa39784c6be231a24ce343d51b939ef3e52c90..22ec2ee7a8d7a0d6fc6b9acb6bbbf149e5daf97e 100644 (file)
@@ -1,3 +1,8 @@
+2004-08-13  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * text2.C (editXY): 
+       * text3.C (checkInsetHit): constify
+
 2004-08-13  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
        * LyXAction.C (init): mark LFUN_WORD_FIND as working in read-only
index 19287b23781dbd39f92d88dcd0a2d4e94be2dfea..753aac8eb9d1b2f9a6aa836e676ea408aa06e610 100644 (file)
@@ -1,5 +1,11 @@
 2004-08-13  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
 
+       * insettext.C (editXY): 
+
+       * insettabular.C (editXY): 
+       * insetcollapsable.C (editXY): 
+       * insetbase.C (editXY): constify
+
        * insetcollapsable.C (priv_dispatch): on a mouse press event, do
        not ask for an update if we did nothing; on a mouse release, make
        sure that the cursor is  moved to the right position; on a mouse
index bc27fb0968c30c269178fbe996808b73767dec06..abfeeb8ca71e8add0ebd7c0718b1be314b0d93de 100644 (file)
@@ -138,10 +138,10 @@ void InsetBase::edit(LCursor &, bool)
 }
 
 
-InsetBase * InsetBase::editXY(LCursor &, int x, int y)
+InsetBase * InsetBase::editXY(LCursor &, int x, int y) const
 {
        lyxerr << "InsetBase: editXY x:" << x << " y: " << y << std::endl;
-       return this;
+       return const_cast<InsetBase*>(this);
 }
 
 
index 5f9e1c2ac9dec8737bc52d4246aff752f1cfe4ce..1287b5a74a8c3068f017ea08d7aa503185213303 100644 (file)
@@ -79,7 +79,7 @@ public:
        /// cursor enters
        virtual void edit(LCursor & cur, bool left);
        /// cursor enters
-       virtual InsetBase * editXY(LCursor & cur, int x, int y);
+       virtual InsetBase * editXY(LCursor & cur, int x, int y) const;
 
        /// compute the size of the object returned in dim
        virtual void metrics(MetricsInfo & mi, Dimension & dim) const = 0;
index 7b31d8e750189fb14a2c8158c69950b3b3845f58..7f7fb2b766f16511baa1c2b9bb4139021ca0ccac 100644 (file)
@@ -240,12 +240,12 @@ void InsetCollapsable::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetCollapsable::editXY(LCursor & cur, int x, int y) const
 {
-       cur.push(*this);
+       cur.push(const_cast<InsetCollapsable&>(*this));
        //lyxerr << "InsetCollapsable: edit xy" << endl;
        if (status_ == Collapsed) {
-               return this;
+               return const_cast<InsetCollapsable*>(this);
        }
        return InsetText::editXY(cur, x, y);
 }
index 4e30b609a5498e3cd5aa9f4bd3d743fe7a2c4f4a..335c0ddb340546c28586d5d816bd8487cfebbbef 100644 (file)
@@ -101,7 +101,7 @@ protected:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
 
 protected:
        ///
index 515f95cf227b5399f3e7718181774e6f1dbdb5b2..a0c75ba21bec3bb7464bb13827f451dd7572e431 100644 (file)
@@ -394,11 +394,11 @@ void InsetTabular::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetTabular::editXY(LCursor & cur, int x, int y) const
 {
        //lyxerr << "InsetTabular::editXY: " << this << endl;
        cur.selection() = false;
-       cur.push(*this);
+       cur.push(const_cast<InsetTabular&>(*this));
        return setPos(cur, x, y);
        //int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
 }
index 1e01bb7bd0a1af96b3e835823bc91489eada292d..712fbe4b61ddefce94a949beac034d7ba6370e27 100644 (file)
@@ -137,7 +137,7 @@ public:
        /// lock cell with given index
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
        /// can we go further down on mouse click?
        bool descendable() const { return true; }
 
index 1fc588c0e2bd9f9a19ef56d2933da0585d1cc95a..cd751325f5d0ad8ae8530fa540c0028d9bbdd017 100644 (file)
@@ -304,7 +304,7 @@ void InsetText::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * InsetText::editXY(LCursor & cur, int x, int y)
+InsetBase * InsetText::editXY(LCursor & cur, int x, int y) const
 {
        lyxerr << "InsetText::edit xy" << endl;
        old_par = -1;
index d89bb3413e4aee9d0ec14c8dfea50240d7d174c1..09ba6880118e6f34b7b70e3f6efced886eb3caff 100644 (file)
@@ -138,7 +138,7 @@ public:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
 
        /// number of cells in this inset
        size_t nargs() const { return 1; }
index 7a489ac934bdb36a29690cf38f1f524c702a2055..965f8f990cba8d9cd9fb8507510f25d36fe7c6e7 100644 (file)
@@ -184,7 +184,7 @@ public:
        ///
        void setCursorFromCoordinates(LCursor & cur, int x, int y);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
        ///
        void cursorUp(LCursor & cur);
        ///
@@ -268,7 +268,7 @@ public:
        /// updates all counters
        void updateCounters();
        /// Returns an inset if inset was hit, or 0 if not.
-       InsetBase * checkInsetHit(int x, int y);
+       InsetBase * checkInsetHit(int x, int y) const;
 
        ///
        int singleWidth(par_type pit, pos_type pos) const;
index b1fb5ac0cc204f2727b773a7bc7a705b73bdd7f3..fb7004c6fa994e6f075b2f0c956d9477af58bfd7 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-13  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * math_nestinset.C (editXY): constify
+
 2004-08-13  José Matos  <jamatos@lyx.org>
 
        * math_hullinset.C (docbook): add awareness of the distinction
index 74af5a143969999e5f5a2fc8b326cbe4614d078e..341faf7d41176b589b8b957b3557adee290a19c8 100644 (file)
@@ -879,7 +879,7 @@ void MathNestInset::edit(LCursor & cur, bool left)
 }
 
 
-InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
+InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) const
 {
        int idx_min = 0;
        int dist_min = 1000000;
@@ -890,8 +890,8 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
                        idx_min = i;
                }
        }
-       MathArray & ar = cell(idx_min);
-       cur.push(*this);
+       MathArray const & ar = cell(idx_min);
+       cur.push(const_cast<MathNestInset&>(*this));
        cur.idx() = idx_min;
        cur.pos() = ar.x2pos(x - ar.xo());
        lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl;
@@ -901,7 +901,7 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y)
                        if (ar[i]->covers(x, y))
                                return ar[i].nucleus()->editXY(cur, x, y);
        }
-       return this;
+       return const_cast<MathNestInset*>(this);
 }
 
 
index 012f1542ae67182f2c55678d741ad35a24f40676..819d64dc647051def384e1aa30947116b78da727 100644 (file)
@@ -41,7 +41,7 @@ public:
        ///
        void edit(LCursor & cur, bool left);
        ///
-       InsetBase * editXY(LCursor & cur, int x, int y);
+       InsetBase * editXY(LCursor & cur, int x, int y) const;
 
        /// order of movement through the cells when pressing the left key
        bool idxLeft(LCursor &) const;
index 8b8db5f61ecaa5ac0f28df41f8b23f9725cfe9d6..d7a8733ba0b39a8907e95070a625562c92338efe 100644 (file)
@@ -1138,7 +1138,7 @@ void LyXText::setCursorFromCoordinates(LCursor & cur, int x, int y)
 
 
 // x,y are absolute screen coordinates
-InsetBase * LyXText::editXY(LCursor & cur, int x, int y)
+InsetBase * LyXText::editXY(LCursor & cur, int x, int y) const
 {
        par_type pit;
        Row const & row = getRowNearY(y - yo_, pit);
index 4a36c41392de4c570bfb55a7c9ceb768d8ae3f66..dd6b10244ae0b11d56059a6d3d07ebcbe7407c4a 100644 (file)
@@ -185,7 +185,7 @@ string const freefont2string()
 
 
 //takes absolute x,y coordinates
-InsetBase * LyXText::checkInsetHit(int x, int y)
+InsetBase * LyXText::checkInsetHit(int x, int y) const 
 {
        par_type pit;
        par_type end;
@@ -198,8 +198,8 @@ InsetBase * LyXText::checkInsetHit(int x, int y)
        lyxerr << "checkInsetHit: x: " << x << " y: " << y << endl;
        lyxerr << "  pit: " << pit << " end: " << end << endl;
        for (; pit != end; ++pit) {
-               InsetList::iterator iit = pars_[pit].insetlist.begin();
-               InsetList::iterator iend = pars_[pit].insetlist.end();
+               InsetList::const_iterator iit = pars_[pit].insetlist.begin();
+               InsetList::const_iterator iend = pars_[pit].insetlist.end();
                for (; iit != iend; ++iit) {
                        InsetBase * inset = iit->inset;
 #if 0