From 708b73cab792f7398e7b2f977dd6d2f98f6281d9 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Fri, 30 Apr 2010 14:55:37 +0000 Subject: [PATCH] Fix bug #3900: Mathed corners displayed without mouse hover. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34348 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 15 ++++++++++----- src/BufferView.h | 2 ++ src/insets/InsetCollapsable.cpp | 10 ++++++++++ src/insets/InsetCollapsable.h | 2 ++ src/insets/InsetCommand.cpp | 5 +++++ src/mathed/InsetMathNest.cpp | 10 ++++++++++ src/mathed/InsetMathNest.h | 2 +- 7 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 0a4e11bcb1..0d852f500e 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -403,11 +403,6 @@ bool BufferView::fitCursor() void BufferView::processUpdateFlags(Update::flags flags) { - // last_inset_ points to the last visited inset. This pointer may become - // invalid because of keyboard editing. Since all such operations - // causes screen update(), I reset last_inset_ to avoid such a problem. - d->last_inset_ = 0; - // This is close to a hot-path. LYXERR(Debug::DEBUG, "BufferView::processUpdateFlags()" << "[fitcursor = " << (flags & Update::FitCursor) @@ -1926,6 +1921,16 @@ void BufferView::updateHoveredInset() const } +void BufferView::clearLastInset(Inset * inset) const +{ + if (d->last_inset_ != inset) { + LYXERR0("Wrong last_inset!"); + LASSERT(false, /**/); + } + d->last_inset_ = 0; +} + + void BufferView::mouseEventDispatch(FuncRequest const & cmd0) { //lyxerr << "[ cmd0 " << cmd0 << "]" << endl; diff --git a/src/BufferView.h b/src/BufferView.h index b9f19b1a31..eaf063182b 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -308,6 +308,8 @@ public: Inset * editedInset(std::string const & name) const; /// Associate an inset associated with given dialog name. void editInset(std::string const & name, Inset * inset); + /// + void clearLastInset(Inset * inset) const; private: /// noncopyable diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp index e84d2432d9..f68546275f 100644 --- a/src/insets/InsetCollapsable.cpp +++ b/src/insets/InsetCollapsable.cpp @@ -63,6 +63,16 @@ InsetCollapsable::InsetCollapsable(InsetCollapsable const & rhs) } +InsetCollapsable::~InsetCollapsable() +{ + map::iterator it = mouse_hover_.begin(); + map::iterator end = mouse_hover_.end(); + for (; it != end; ++it) + if (it->second) + it->first->clearLastInset(this); +} + + InsetCollapsable::CollapseStatus InsetCollapsable::status(BufferView const & bv) const { if (decoration() == InsetLayout::CONGLOMERATE) diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h index d93ddae12a..0ec354be74 100644 --- a/src/insets/InsetCollapsable.h +++ b/src/insets/InsetCollapsable.h @@ -37,6 +37,8 @@ public: /// InsetCollapsable(InsetCollapsable const & rhs); /// + ~InsetCollapsable(); + /// InsetCollapsable * asInsetCollapsable() { return this; } /// InsetCollapsable const * asInsetCollapsable() const { return this; } diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp index d99ccd6c8d..03d9442227 100644 --- a/src/insets/InsetCommand.cpp +++ b/src/insets/InsetCommand.cpp @@ -63,6 +63,11 @@ InsetCommand::~InsetCommand() { if (!mailer_name_.empty()) hideDialogs(mailer_name_, this); + map::iterator it = mouse_hover_.begin(); + map::iterator end = mouse_hover_.end(); + for (; it != end; ++it) + if (it->second) + it->first->clearLastInset(this); } diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 4fae4f5ba5..21b16a7258 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -91,6 +91,16 @@ InsetMathNest::InsetMathNest(InsetMathNest const & inset) {} +InsetMathNest::~InsetMathNest() +{ + map::iterator it = mouse_hover_.begin(); + map::iterator end = mouse_hover_.end(); + for (; it != end; ++it) + if (it->second) + it->first->clearLastInset(this); +} + + InsetMathNest & InsetMathNest::operator=(InsetMathNest const & inset) { cells_ = inset.cells_; diff --git a/src/mathed/InsetMathNest.h b/src/mathed/InsetMathNest.h index 39fa62b630..d9c1f09f42 100644 --- a/src/mathed/InsetMathNest.h +++ b/src/mathed/InsetMathNest.h @@ -31,7 +31,7 @@ public: /// nestinsets have a fixed size to start with InsetMathNest(Buffer * buf, idx_type ncells); /// - virtual ~InsetMathNest() {} + virtual ~InsetMathNest(); /// void setBuffer(Buffer &); -- 2.39.2