commit 6ad2edc38143693a81aa9f8471b354b4527b3533
Author: Jean-Marc Lasgouttes <[email protected]>
Date: Tue Feb 2 17:17:10 2016 +0100
Pass a BufferView to Inset::clickable
diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index a267410..56ecd94 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -2124,7 +2124,7 @@ void BufferView::updateHoveredInset() const
int const y = d->mouse_position_cache_.y_;
Inset const * covering_inset = getCoveringInset(buffer_.text(), x, y);
- d->clickable_inset_ = covering_inset && covering_inset->clickable(x, y);
+ d->clickable_inset_ = covering_inset &&
covering_inset->clickable(*this, x, y);
if (covering_inset == d->last_inset_)
// Same inset, no need to do anything...
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index 75991cd..a0bbf32 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -350,7 +350,7 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
// if the derived inset did not explicitly handle mouse_release,
// we assume we request the settings dialog
if (!cur.selection() && cmd.button() == mouse_button::button1
- && clickable(cmd.x(), cmd.y()) && hasSettings()) {
+ && clickable(cur.bv(), cmd.x(), cmd.y()) && hasSettings()) {
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
dispatch(cur, tmpcmd);
}
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 96071fa..c413f9b 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -344,7 +344,7 @@ public:
// true for InsetTabular & InsetText
virtual bool isActive() const { return nargs() > 0; }
/// can we click at the specified position ?
- virtual bool clickable(int, int) const { return false; }
+ virtual bool clickable(BufferView const &, int, int) const { return
false; }
/// Move one cell backwards
virtual bool allowsCaptionVariation(std::string const &) const { return
false; }
diff --git a/src/insets/InsetCollapsable.cpp b/src/insets/InsetCollapsable.cpp
index aeac8b3..f94d7fd 100644
--- a/src/insets/InsetCollapsable.cpp
+++ b/src/insets/InsetCollapsable.cpp
@@ -414,7 +414,7 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd)
const
}
-bool InsetCollapsable::clickable(int x, int y) const
+bool InsetCollapsable::clickable(BufferView const &, int x, int y) const
{
FuncRequest cmd(LFUN_NOACTION, x, y, mouse_button::none);
return hitButton(cmd);
diff --git a/src/insets/InsetCollapsable.h b/src/insets/InsetCollapsable.h
index f2ce0ca..f24beb5 100644
--- a/src/insets/InsetCollapsable.h
+++ b/src/insets/InsetCollapsable.h
@@ -69,7 +69,7 @@ public:
///
bool hasSettings() const { return true; }
///
- bool clickable(int x, int y) const;
+ bool clickable(BufferView const &, int x, int y) const;
/// can we go further down on mouse click?
bool descendable(BufferView const & bv) const;
///
diff --git a/src/insets/InsetCommand.cpp b/src/insets/InsetCommand.cpp
index dbbaed1..fcda3cd 100644
--- a/src/insets/InsetCommand.cpp
+++ b/src/insets/InsetCommand.cpp
@@ -94,7 +94,7 @@ InsetCommand::~InsetCommand()
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
{
- button_.update(screenLabel(), editable() || clickable(0, 0));
+ button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0,
0));
button_.metrics(mi, dim);
}
diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h
index 1be72a8..39b1cbb 100644
--- a/src/insets/InsetCommand.h
+++ b/src/insets/InsetCommand.h
@@ -87,7 +87,7 @@ public:
///
bool setMouseHover(BufferView const * bv, bool mouse_hover) const;
///
- bool clickable(int, int) const { return hasSettings(); }
+ bool clickable(BufferView const &, int, int) const { return
hasSettings(); }
//@}
protected:
diff --git a/src/insets/InsetExternal.h b/src/insets/InsetExternal.h
index 7513118..813e933 100644
--- a/src/insets/InsetExternal.h
+++ b/src/insets/InsetExternal.h
@@ -118,7 +118,7 @@ public:
///
bool setMouseHover(BufferView const * bv, bool mouse_hover) const;
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
///
void addToToc(DocIterator const & di, bool output_active,
UpdateType utype) const;
diff --git a/src/insets/InsetFloatList.h b/src/insets/InsetFloatList.h
index 58a7e23..32a0dd5 100644
--- a/src/insets/InsetFloatList.h
+++ b/src/insets/InsetFloatList.h
@@ -49,7 +49,7 @@ public:
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
///
void validate(LaTeXFeatures & features) const;
//@}
diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h
index 3cf296f..5270f2b 100644
--- a/src/insets/InsetGraphics.h
+++ b/src/insets/InsetGraphics.h
@@ -53,7 +53,7 @@ public:
InsetGraphicsParams getParams() const { return params_;}
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
private:
///
diff --git a/src/insets/InsetSpace.h b/src/insets/InsetSpace.h
index 03ca7ae..a4fd615 100644
--- a/src/insets/InsetSpace.h
+++ b/src/insets/InsetSpace.h
@@ -139,7 +139,7 @@ public:
///
bool hasSettings() const { return true; }
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
///
InsetCode lyxCode() const { return SPACE_CODE; }
/// does this inset try to use all available space (like \\hfill does)?
diff --git a/src/insets/InsetTOC.h b/src/insets/InsetTOC.h
index 074ad53..bd6ba17 100644
--- a/src/insets/InsetTOC.h
+++ b/src/insets/InsetTOC.h
@@ -49,7 +49,7 @@ public:
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
//@}
/// \name Static public methods obligated for InsetCommand derived
classes
diff --git a/src/insets/InsetVSpace.h b/src/insets/InsetVSpace.h
index e94ebcd..21afbcd 100644
--- a/src/insets/InsetVSpace.h
+++ b/src/insets/InsetVSpace.h
@@ -32,7 +32,7 @@ public:
///
bool hasSettings() const { return true; }
///
- bool clickable(int, int) const { return true; }
+ bool clickable(BufferView const &, int, int) const { return true; }
///
std::string contextMenuName() const;
///