]> git.lyx.org Git - features.git/commitdiff
Constify InsetMathNest::setMouseHover and remove the const_cast from BufferView.
authorVincent van Ravesteijn <vfr@lyx.org>
Sun, 13 Feb 2011 10:07:00 +0000 (10:07 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 13 Feb 2011 10:07:00 +0000 (10:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37632 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/mathed/InsetMathNest.cpp
src/mathed/InsetMathNest.h

index e0c96856ddeb4c2eea6a845d7226d58cf6fb6f77..fb82f10ce7e829fe965f198ac2218c20f8a423c9 100644 (file)
@@ -269,7 +269,7 @@ struct BufferView::Private
        /** kept to send setMouseHover(false).
          * Not owned, so don't delete.
          */
-       Inset * last_inset_;
+       Inset const * last_inset_;
        /// are we hovering something that we can click
        bool clickable_inset_;
 
@@ -1992,14 +1992,12 @@ void BufferView::updateHoveredInset() const
                d->last_inset_ = 0;
        }
        
-       // const_cast because of setMouseHover().
-       Inset * inset = const_cast<Inset *>(covering_inset);
-       if (inset && inset->setMouseHover(this, true)) {
+       if (covering_inset && covering_inset->setMouseHover(this, true)) {
                need_redraw = true;
                // Only the insets that accept the hover state, do 
                // clear the last_inset_, so only set the last_inset_
                // member if the hovered setting is accepted.
-               d->last_inset_ = inset;
+               d->last_inset_ = covering_inset;
        }
 
        if (need_redraw) {
index 25204bc91bcacc7bbdae76a78bfd8f5e951bf459..edbe99aea08ccdd904a642debc75f98a2688459e 100644 (file)
@@ -407,6 +407,7 @@ void InsetMathNest::latex(otexstream & os, OutputParams const & runparams) const
 
 
 bool InsetMathNest::setMouseHover(BufferView const * bv, bool mouse_hover)
+       const
 {
        mouse_hover_[bv] = mouse_hover;
        return true;
index 5a737c3b61bc1e421f582bf01b6e5c94b76e9d4a..4e18dbda71e25d787945371e654213922e212474 100644 (file)
@@ -113,7 +113,7 @@ public:
        ///
        void latex(otexstream & os, OutputParams const & runparams) const;
        ///
-       bool setMouseHover(BufferView const * bv, bool mouse_hover);
+       bool setMouseHover(BufferView const * bv, bool mouse_hover) const;
        ///
        bool mouseHovered(BufferView const * bv) const 
                { return mouse_hover_[bv]; }