]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetExternal.cpp
Add comment.
[lyx.git] / src / insets / InsetExternal.cpp
index 3ab50c2b63e545673e67cc52c802c4e3f27ed1cc..426aee5891405250b8e60c1359ab10d540d51615 100644 (file)
@@ -45,7 +45,7 @@
 #include "support/lyxlib.h"
 #include "support/Translator.h"
 
-#include <boost/bind.hpp>
+#include "support/bind.h"
 
 #include <sstream>
 
@@ -371,6 +371,7 @@ InsetExternal::InsetExternal(Buffer * buf)
 }
 
 
+// Mouse hover is not copied and remains empty
 InsetExternal::InsetExternal(InsetExternal const & other)
        : Inset(other),
          boost::signals::trackable(),
@@ -382,6 +383,19 @@ InsetExternal::InsetExternal(InsetExternal const & other)
 InsetExternal::~InsetExternal()
 {
        hideDialogs("external", this);
+
+       map<BufferView const *, bool>::iterator it = mouse_hover_.begin();
+       map<BufferView const *, bool>::iterator end = mouse_hover_.end();
+       for (; it != end; ++it)
+               if (it->second)
+                       it->first->clearLastInset(this);
+}
+
+
+bool InsetExternal::setMouseHover(BufferView const * bv, bool mouse_hover)
+{
+       mouse_hover_[bv] = mouse_hover;
+       return true;
 }
 
 
@@ -454,6 +468,8 @@ void InsetExternal::metrics(MetricsInfo & mi, Dimension & dim) const
 
 void InsetExternal::draw(PainterInfo & pi, int x, int y) const
 {
+       if (renderer_->asButton())
+               renderer_->setRenderState(mouse_hover_[pi.base.bv]);
        renderer_->draw(pi, x, y);
 }
 
@@ -571,7 +587,7 @@ void InsetExternal::setParams(InsetExternalParams const & p)
                RenderMonitoredPreview * preview_ptr = renderer_->asMonitoredPreview();
                renderer_.reset(new RenderMonitoredPreview(this));
                preview_ptr = renderer_->asMonitoredPreview();
-               preview_ptr->fileChanged(boost::bind(&InsetExternal::fileChanged, this));
+               preview_ptr->fileChanged(bind(&InsetExternal::fileChanged, this));
                if (preview_ptr->monitoring())
                        preview_ptr->stopMonitoring();
                add_preview_and_start_loading(*preview_ptr, *this, buffer());