From 5036ca8500368bfa5e445c2734834185b7d78978 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 13 Feb 2011 10:07:00 +0000 Subject: [PATCH] Constify InsetMathNest::setMouseHover and remove the const_cast from BufferView. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37632 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 8 +++----- src/mathed/InsetMathNest.cpp | 1 + src/mathed/InsetMathNest.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index e0c96856dd..fb82f10ce7 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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(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) { diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 25204bc91b..edbe99aea0 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -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; diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index 5a737c3b61..4e18dbda71 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -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]; } -- 2.39.5