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
This commit is contained in:
Vincent van Ravesteijn 2011-02-13 10:07:00 +00:00
parent 1b6f1ee810
commit 5036ca8500
3 changed files with 5 additions and 6 deletions

View 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) {

View 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;

View 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]; }