]> git.lyx.org Git - features.git/commitdiff
Transfer general edit context menu from BufferView to InsetText.
authorAbdelrazak Younes <younes@lyx.org>
Sat, 8 Mar 2008 22:57:22 +0000 (22:57 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 8 Mar 2008 22:57:22 +0000 (22:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23574 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/insets/InsetCollapsable.cpp
src/insets/InsetCollapsable.h
src/insets/InsetRef.cpp
src/insets/InsetRef.h
src/insets/InsetText.cpp
src/insets/InsetText.h

index 73de5426381d5d24374b8f9ca94f9de250413f24..b13d4cebd198de9d7623ccda9b63ea439a628c1b 100644 (file)
@@ -531,8 +531,7 @@ docstring BufferView::contextMenu(int x, int y) const
        if (covering_inset)
                return covering_inset->contextMenu(*this, x, y);
 
-       // FIXME: Do something more elaborate here.
-       return from_ascii("edit");
+       return buffer_.inset().contextMenu(*this, x, y);
 }
 
 
index 8a97f4073e22c428fa00ca3c725867e2cdf7d23d..f9f8f3637606f07766ee960d7dd9f0f1826c2e55 100644 (file)
@@ -896,4 +896,16 @@ bool InsetCollapsable::undefined() const
 }
 
 
+docstring InsetCollapsable::contextMenu(BufferView const & bv, int x,
+       int y) const
+{
+       if (geometry() != NoButton) {
+               Dimension dim = dimensionCollapsed();
+               if (x < xo(bv) + dim.wid && y < yo(bv) + dim.des)
+                       return docstring();
+       }
+
+       return InsetText::contextMenu(bv, x, y);
+}
+
 } // namespace lyx
index b35a2bd09648d54f1831ed11c507d1aaabf8fb4a..99679d315b6c73b5a65da0b29b6ac9f38bde2f09 100644 (file)
@@ -151,6 +151,8 @@ public:
        /// Is this inset's layout defined in the document's textclass?
        /// May be wrong after textclass change or paste from another document
        bool undefined() const;
+       ///
+       virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
 protected:
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
index c2c3358ddd438133ee2458115123a82ca14bd088..f908a13598eddbb060eb88e2e421147d6d73a29d 100644 (file)
@@ -183,6 +183,13 @@ void InsetRef::addToToc(ParConstIterator const & cpit) const
 }
 
 
+docstring InsetRef::contextMenu(BufferView const &, int, int) const
+{
+       // FIXME: find a way to create a menu with "Goto label" inside.
+       return docstring();
+}
+
+
 void InsetRef::validate(LaTeXFeatures & features) const
 {
        if (getCmdName() == "vref" || getCmdName() == "vpageref")
index 9bb4521aa271f6b45a790d4fc13cb161ffa20fd1..a9c8f7c8877c2950f2043ae3d6cca3c624b5ee84 100644 (file)
@@ -71,6 +71,8 @@ public:
        void updateLabels(ParIterator const & it);
        ///
        void addToToc(ParConstIterator const &) const;
+       ///
+       virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
 protected:
        ///
        InsetRef(InsetRef const &);
index 172255bc699d10d2eee4d95573d1d31c37b1874c..927787805440eff73e24ef0a0d5bb46abe91a4fa 100644 (file)
@@ -596,4 +596,11 @@ void InsetText::completionPosAndDim(Cursor const & cur, int & x, int & y,
 }
 
 
+docstring InsetText::contextMenu(BufferView const &, int, int) const
+{
+       // FIXME: Do something more elaborate here.
+       return from_ascii("edit");
+}
+
+
 } // namespace lyx
index bc7a56b5319599e3f659d5a666e1e0d6d39b2754..2d183c11064db2d6898f1ba374c5897b6359a78d 100644 (file)
@@ -158,7 +158,8 @@ public:
        bool insertCompletion(Cursor & cur, docstring const & s, bool finished);
        ///
        void completionPosAndDim(Cursor const &, int & x, int & y, Dimension & dim) const;
-
+       ///
+       virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
        ///
        void doDispatch(Cursor & cur, FuncRequest & cmd);
 private: