]> git.lyx.org Git - lyx.git/commitdiff
Pass a BufferView to Inset::clickable
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 2 Feb 2016 16:17:10 +0000 (17:17 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 19 Apr 2016 09:58:41 +0000 (11:58 +0200)
13 files changed:
src/BufferView.cpp
src/insets/Inset.cpp
src/insets/Inset.h
src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h
src/insets/InsetCommand.cpp
src/insets/InsetCommand.h
src/insets/InsetExternal.h
src/insets/InsetFloatList.h
src/insets/InsetGraphics.h
src/insets/InsetSpace.h
src/insets/InsetTOC.h
src/insets/InsetVSpace.h

index a267410f2c10004db83cbf0e11945b72dd7f328b..56ecd94e29694099a67855963092d3db506cbf6a 100644 (file)
@@ -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...
index 75991cd7de1f971f983dac21f06992fce9790820..a0bbf32f4a2435af33456a26ef48a6b4de6e0618 100644 (file)
@@ -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);
                }
index 96071faf7dd7e716bef8622c7440f9a9654c865c..c413f9b4cc2cd47934635ca2b5c56e12b2a003c9 100644 (file)
@@ -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; }
 
index aeac8b358681eebc60f7e8a6043d613c903ae707..f94d7fdb45aa126f05352d63a80226fc91d848fd 100644 (file)
@@ -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);
index f2ce0caf3ca976904ec983f5c1c63cc6c92e64d9..f24beb5f82986af4a59fb46be9cd1e8684f68ae1 100644 (file)
@@ -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;
        ///
index dbbaed1253ed2f0cd6754bf49ce7c5b61bb60dc1..fcda3cd2b984175a7cf24169adffb322c2a74095 100644 (file)
@@ -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);
 }
 
index 1be72a8ec856db9c0e55c221dd2d9e1b6d1c1868..39b1cbbef36ae745633b307033de70cd3d192e85 100644 (file)
@@ -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:
index 75131182b982928eb2a29ec44b45cba77b821653..813e933a0a1d9088ca72576a7fd4826feb3beb86 100644 (file)
@@ -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;
index 58a7e232f6a77a53aabe606e518dffedf4aba81d..32a0dd5c81fdefb72660d276bc1e20cf4f6ac912 100644 (file)
@@ -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;
        //@}
index 3cf296fc8db71be2ce34525d138c9bf90749c543..5270f2bfa9f9497109e510de965719fafaa9cda7 100644 (file)
@@ -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:
        ///
index 03ca7aebabe6bee5bc03a516cc2e16109cf785e1..a4fd6151f90a458c9a8429573e6d0cdc735f03a1 100644 (file)
@@ -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)?
index 074ad535dbf6e8f4b6de193670af8d00f224eee7..bd6ba17973453d9e7f3d820c03042925c56e716e 100644 (file)
@@ -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
index e94ebcd91fb59d6c0d38ef69e6a90df1b03efdac..21afbcd03605392a1f999bf0e46fc4a9c656d570 100644 (file)
@@ -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;
        ///