]> git.lyx.org Git - lyx.git/commitdiff
Fixed poping up of Layout-Dialogs on Mouse-Button-3 press.
authorJürgen Vigna <jug@sad.it>
Mon, 17 Dec 2001 13:33:22 +0000 (13:33 +0000)
committerJürgen Vigna <jug@sad.it>
Mon, 17 Dec 2001 13:33:22 +0000 (13:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3225 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
src/insets/ChangeLog
src/insets/inset.C
src/insets/inset.h
src/insets/insetcollapsable.C
src/insets/insetcollapsable.h
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetfloat.C
src/insets/insetfloat.h
src/insets/insetminipage.C
src/insets/insetminipage.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.C
src/insets/insettext.h
src/mathed/formulabase.C
src/mathed/formulabase.h

index 984d306d01e949b9ac7e7d5af0c48d746b6db015..eebc28ef2e563c2cb8e17c159a0713e64e525f18 100644 (file)
@@ -1,3 +1,21 @@
+2001-12-17  Juergen Vigna  <jug@sad.it>
+
+       * insetert.C (read): removed piece of compatibility code only needed
+       for 1.2.0.
+
+       * insettabular.C (insetButtonRelease): fixed so that sub-dialogs
+       can be opened.
+
+       * insetcollapsable.C (insetButtonRelease): changed so that it can
+       open evetual existing popup dialogs on mousebutton==3.
+
+       * insetfloat.C (insetButtonRelease): removed not needed anymore!
+
+       * insetminipage.C (insetButtonRelease): removed not needed anymore!
+
+       * inset.C (insetButtonRelease): return a bool for telling the outer
+       world that we opened a dialog.
+
 2001-12-07  Juergen Vigna  <jug@sad.it>
 
        * insettext.C (paragraph): remove the deleteing of paragraphs as
index 39e9a31685589d6d0950f72b174323c5437f5493..85248d564c11e1fde09c9aa0563a745e44c4e02f 100644 (file)
@@ -164,10 +164,11 @@ void UpdatableInset::insetButtonPress(BufferView *, int x, int y, int button)
 }
 
 
-void UpdatableInset::insetButtonRelease(BufferView *, int x, int y, int button)
+bool UpdatableInset::insetButtonRelease(BufferView *, int x, int y, int button)
 {
        lyxerr[Debug::INFO] << "Inset Button Release x=" << x
                       << ", y=" << y << ", button=" << button << endl;
+       return false;
 }
 
 
index 9e9c654d1ab704855a0eab2d5cf44ac8102be078..8e070260b16d660a6279663e46cdeb9be76703b7 100644 (file)
@@ -159,7 +159,12 @@ public:
        /// This is called when the user clicks inside an inset
        virtual void insetButtonPress(BufferView *, int, int, int) {}
        /// This is called when the user releases the button inside an inset
-       virtual void insetButtonRelease(BufferView *, int, int, int) {}
+       // the bool return is used to see if we opened a dialog so that we can
+       // check this from an outer inset and open the dialog of the outer inset
+       // if that one has one!
+       ///
+       virtual bool insetButtonRelease(BufferView *, int, int, int)
+               { return false; }
        /// This is called when the user moves the mouse inside an inset
        virtual void insetMotionNotify(BufferView *, int , int , int) {}
        ///
@@ -430,8 +435,12 @@ public:
        ///
        virtual void insetButtonPress(BufferView *, int x, int y, int button);
        ///
-       virtual void insetButtonRelease(BufferView *,
-                                       int x, int y, int button);
+       // the bool return is used to see if we opened a dialog so that we can
+       // check this from an outer inset and open the dialog of the outer inset
+       // if that one has one!
+       ///
+       virtual bool insetButtonRelease(BufferView *,
+                                       int x, int y, int button);
        ///
        virtual void insetKeyPress(XKeyEvent * ev);
        ///
index 01e0d11abf8143d840fe59de3fdb12b4431d42be..c314aa2f82e7fec75790c5ecdd8adf1150df581a 100644 (file)
@@ -322,10 +322,11 @@ void InsetCollapsable::insetButtonPress(BufferView * bv,
 }
 
 
-void InsetCollapsable::insetButtonRelease(BufferView * bv,
+bool InsetCollapsable::insetButtonRelease(BufferView * bv,
                                           int x, int y, int button)
 {
-       if ((x >= 0)  && (x < button_length) &&
+       bool ret = false;
+       if ((button != 3) && (x >= 0)  && (x < button_length) &&
            (y >= button_top_y) &&  (y <= button_bottom_y))
        {
                if (collapsed_) {
@@ -345,8 +346,12 @@ void InsetCollapsable::insetButtonRelease(BufferView * bv,
                    (ascent_collapsed() +
                     descent_collapsed() +
                     inset.ascent(bv, font));
-               inset.insetButtonRelease(bv, x, yy, button);
+               ret = inset.insetButtonRelease(bv, x, yy, button);
        }
+       if ((button == 3) && !ret) {
+               return showInsetDialog(bv);
+       }
+       return false;
 }
 
 
index 9f73fbbbe8c5b88cdf6f29a90ff5362441388e1b..3a53cce62553b335b682aa22797bff3aaa01e956 100644 (file)
@@ -89,7 +89,7 @@ public:
        ///
        unsigned int insetInInsetY();
        ///
-       void insetButtonRelease(BufferView *, int, int, int);
+       bool insetButtonRelease(BufferView *, int, int, int);
        ///
        void insetButtonPress(BufferView *, int, int, int);
        ///
index e964ea2b9da4f943e8f0ade0c241f8a2e8f7f6c1..6b3c6f61cf1eebe2a909cb4e0375fe864afae809 100644 (file)
@@ -126,6 +126,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
                        lex.pushToken(token);
                }
        }
+#if 0
 #warning this should be really short lived only for compatibility to
 #warning files written 07/08/2001 so this has to go before 1.2.0! (Jug)
        if (lex.isOK()) {
@@ -139,6 +140,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
                        lex.pushToken(token);
                }
        }
+#endif
        inset.read(buf, lex);
 
 #ifndef INHERIT_LANG
@@ -299,11 +301,11 @@ void InsetERT::insetButtonPress(BufferView * bv,
 }
 
 
-void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
+bool InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
 {
        if (button == 3) {
                showInsetDialog(bv);
-               return;
+               return true;
        }
  
        if (status_ != Inlined && (x >= 0)  && (x < button_length) &&
@@ -322,6 +324,7 @@ void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
                        inset.insetButtonRelease(bv, x, yy, button);
                }
        }
+       return false;
 }
 
 
index 78b89be5212ae3f63f88d84cfda5344c807e590d..7d24a6f13962554dbd09352608051282130f2d43 100644 (file)
@@ -73,7 +73,7 @@ public:
        ///
        void insetButtonPress(BufferView *, int x, int y, int button);
        ///
-       void insetButtonRelease(BufferView * bv, int x, int y, int button);
+       bool insetButtonRelease(BufferView * bv, int x, int y, int button);
        ///
        void insetMotionNotify(BufferView *, int x, int y, int state);
        ///
index 93ae48a21f7f29d513ec24db9b3601b6caea0439..1d4c3614cb81a9fbc0dc6b67415468138b08ec09 100644 (file)
@@ -271,26 +271,6 @@ bool InsetFloat::showInsetDialog(BufferView * bv) const
 }
 
 
-void InsetFloat::insetButtonRelease(BufferView * bv, int x, int y, int button)
-{
-#if 1
-       if ((x >= 0)  && (x < button_length) &&
-           (y >= button_top_y) &&  (y <= button_bottom_y) &&
-           (button == 3))
-       {
-               showInsetDialog(bv);
-               return;
-       }
-#else
-       if (button == 3) {
-               showInsetDialog(bv);
-               return;
-       }
-#endif
-       InsetCollapsable::insetButtonRelease(bv, x, y, button);
-}
-
-
 string const & InsetFloat::type() const 
 {
        return floatType_;
index 9376c626be37db1c4de7f915c12aaed16177ada7..42288867165ea0d8c375c0be49d8714023439b36 100644 (file)
@@ -51,8 +51,6 @@ public:
        ///
        bool insetAllowed(Inset::Code) const;
        ///
-       void insetButtonRelease(BufferView * bv, int x, int y, int button);
-       ///
        string const & type() const;
        ///
        void placement(string const & p);
index 81523d353c37bc770044d12d488167fc96d2f993..069cd6958c2764afa2ee7794cd0582d6d9f2935a 100644 (file)
@@ -324,17 +324,6 @@ bool InsetMinipage::showInsetDialog(BufferView * bv) const
 }
 
 
-void InsetMinipage::insetButtonRelease(BufferView * bv, int x, int y,
-                                       int button)
-{
-       if (button == 3) {
-               showInsetDialog(bv);
-               return;
-       }
-       InsetCollapsable::insetButtonRelease(bv, x, y, button);
-}
-
-
 int InsetMinipage::getMaxWidth(BufferView * bv, UpdatableInset const * inset)
        const
 {
index 4171e03d488d32ae466e2d9753914b5ff55ee376..4b1797d804c7b32789d984a7ef1692a31b378a9b 100644 (file)
@@ -81,8 +81,6 @@ public:
        ///
        SigC::Signal0<void> hideDialog;
        ///
-       void insetButtonRelease(BufferView * bv, int x, int y, int button);
-       ///
        int getMaxWidth(BufferView *, UpdatableInset const *) const;
        ///
        bool needFullRow() const { return false; }
index 2da68f6db4594aa409b9b391dd96a9c0395bec29..4745b270758ccd59e0807a3da8c4e519f17d2973 100644 (file)
@@ -745,6 +745,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
        if (actrow != orow)
                updateLocal(bv, NONE, false);
        clearSelection();
+#if 0
        if (button == 3) {
                if ((ocell != actcell) && the_locking_inset) {
                        the_locking_inset->insetUnlock(bv);
@@ -753,6 +754,7 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
                showInsetCursor(bv);
                return;
        }
+#endif
 
        bool const inset_hit = insetHit(bv, x, y);
 
@@ -782,26 +784,17 @@ void InsetTabular::insetButtonPress(BufferView * bv, int x, int y, int button)
 }
 
 
-void InsetTabular::insetButtonRelease(BufferView * bv,
-                                     int x, int y, int button)
+bool InsetTabular::insetButtonRelease(BufferView * bv,
+                                      int x, int y, int button)
 {
-       if (button == 3) {
-               if (the_locking_inset) {
-                       UpdatableInset * i;
-                       if ((i = the_locking_inset->getFirstLockingInsetOfType(TABULAR_CODE))) {
-                               i->insetButtonRelease(bv, x, y, button);
-                               return;
-                       }
-               }
+       bool ret = false;
+       if (the_locking_inset)
+               ret = the_locking_inset->insetButtonRelease(bv, x, y, button);
+       if (button == 3 && !ret) {
                bv->owner()->getDialogs()->showTabular(this);
-               return;
-       }
-       if (the_locking_inset) {
-               the_locking_inset->insetButtonRelease(bv,
-                                                     x - inset_x, y - inset_y,
-                                                     button);
-               return;
+               return true;
        }
+       return ret;
 }
 
 
index d53d4305d292c863f225163463bd41e4e5beb003..e495a272d9a4c399966cae23cef45e5ba6666832 100644 (file)
@@ -131,7 +131,7 @@ public:
        ///
        bool display() const { return tabular->IsLongTabular(); }
        ///
-       void insetButtonRelease(BufferView *, int, int, int);
+       bool insetButtonRelease(BufferView *, int, int, int);
        ///
        void insetButtonPress(BufferView *, int, int, int);
        ///
index 1e0a9906fbfc36df01b4c07797c90e1fd64a8cd2..15afebff957f579f6ad560b496128f32b856a36c 100644 (file)
@@ -995,34 +995,32 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
 }
 
 
-void InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
+bool InsetText::insetButtonRelease(BufferView * bv, int x, int y, int button)
 {
-       UpdatableInset * inset = 0;
-
        if (the_locking_inset) {
-               the_locking_inset->insetButtonRelease(bv,
-                                                     x - inset_x, y - inset_y,
-                                                     button);
-       } else {
-               if (cpar(bv)->isInset(cpos(bv))) {
-                       inset = static_cast<UpdatableInset*>(cpar(bv)->getInset(cpos(bv)));
-                       if (isHighlyEditableInset(inset)) {
-                               inset->insetButtonRelease(bv,
-                                                         x - inset_x,
-                                                         y - inset_y, button);
-                       } else {
-                               inset_x = cx(bv) - top_x + drawTextXOffset;
-                               inset_y = cy(bv) + drawTextYOffset;
-                               inset->insetButtonRelease(bv,
-                                                         x - inset_x,
-                                                         y - inset_y, button);
-                               inset->edit(bv,
-                                           x - inset_x, y - inset_y, button);
-                       }
-                       updateLocal(bv, CURSOR_PAR, false);
+               return the_locking_inset->insetButtonRelease(bv,
+                                                            x - inset_x, y - inset_y,
+                                                            button);
+       }
+       int tmp_x = x - drawTextXOffset;
+       int tmp_y = y + insetAscent - getLyXText(bv)->first;
+       Inset * inset = bv->checkInsetHit(getLyXText(bv), tmp_x, tmp_y, button);
+       bool ret = false;
+       if (inset) {
+               if (isHighlyEditableInset(inset)) {
+                       ret = inset->insetButtonRelease(bv, x - inset_x,
+                                                       y - inset_y, button);
+               } else {
+                       inset_x = cx(bv) - top_x + drawTextXOffset;
+                       inset_y = cy(bv) + drawTextYOffset;
+                       ret = inset->insetButtonRelease(bv, x - inset_x,
+                                                       y - inset_y, button);
+                       inset->edit(bv, x - inset_x,
+                                   y - inset_y, button);
                }
+               updateLocal(bv, CURSOR_PAR, false);
        }
-       no_selection = false;
+       return ret;
 }
 
 
index 5ffc127287731675f3d9041ad0e19a4d9726b309..aeae6f866286e0315f7799521da9978e1e84b23d 100644 (file)
@@ -122,7 +122,7 @@ public:
        ///
        bool updateInsetInInset(BufferView *, Inset *);
        ///
-       void insetButtonRelease(BufferView *, int, int, int);
+       bool insetButtonRelease(BufferView *, int, int, int);
        ///
        void insetButtonPress(BufferView *, int, int, int);
        ///
index 7a54dc02b159e7d92a897e7ddd2946b2b685d95d..fc2b83b1ff330a0e4a82a8d00fc530154bd93c36 100644 (file)
@@ -252,15 +252,16 @@ void InsetFormulaBase::updateLocal(BufferView * bv, bool dirty)
 }
 
 
-void InsetFormulaBase::insetButtonRelease(BufferView * bv,
-                                         int /*x*/, int /*y*/, int /*button*/)
+bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
+                                          int /*x*/, int /*y*/, int /*button*/)
 {
        if (!mathcursor)
-               return;
+               return false;
        //lyxerr << "insetButtonRelease: " << x << " " << y << "\n";
        hideInsetCursor(bv);
        showInsetCursor(bv);
        bv->updateInset(this, false);
+       return false;
 }
 
 
index 4f7e588ee1ac7faf54a14641fbd4e9571c8ffc5b..21e856578c53e0b969d603b221f0ee6021088bbe 100644 (file)
@@ -80,7 +80,7 @@ public:
        ///
        virtual void insetButtonPress(BufferView *, int x, int y, int button);
        ///
-       virtual void insetButtonRelease(BufferView *, int x, int y, int button);
+       virtual bool insetButtonRelease(BufferView *, int x, int y, int button);
        ///
        virtual void insetKeyPress(XKeyEvent * ev);
        ///