From ffe1d53cdb9db64916f15ccf7b2f38776942bf25 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 2 Feb 2016 17:17:10 +0100 Subject: [PATCH] Pass a BufferView to Inset::clickable --- src/BufferView.cpp | 2 +- src/insets/Inset.cpp | 2 +- src/insets/Inset.h | 2 +- src/insets/InsetCollapsable.cpp | 2 +- src/insets/InsetCollapsable.h | 2 +- src/insets/InsetCommand.cpp | 2 +- src/insets/InsetCommand.h | 2 +- src/insets/InsetExternal.h | 2 +- src/insets/InsetFloatList.h | 2 +- src/insets/InsetGraphics.h | 2 +- src/insets/InsetSpace.h | 2 +- src/insets/InsetTOC.h | 2 +- src/insets/InsetVSpace.h | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index a267410f2c..56ecd94e29 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 75991cd7de..a0bbf32f4a 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 96071faf7d..c413f9b4cc 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 aeac8b3586..f94d7fdb45 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 f2ce0caf3c..f24beb5f82 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 dbbaed1253..fcda3cd2b9 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 1be72a8ec8..39b1cbbef3 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 75131182b9..813e933a0a 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 58a7e232f6..32a0dd5c81 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 3cf296fc8d..5270f2bfa9 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 03ca7aebab..a4fd6151f9 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 074ad535db..bd6ba17973 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 e94ebcd91f..21afbcd036 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; /// -- 2.39.2