]> git.lyx.org Git - features.git/commitdiff
Fix insetButtonPress in InsetText the same way as in Bufferview_pimpl.
authorJürgen Vigna <jug@sad.it>
Wed, 3 Apr 2002 13:59:04 +0000 (13:59 +0000)
committerJürgen Vigna <jug@sad.it>
Wed, 3 Apr 2002 13:59:04 +0000 (13:59 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3892 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/insets/ChangeLog
src/insets/insettext.C

index 56548fbca349b941f8de85ff871ed97aeb767be3..e4c70906e48c2c9b14ffed83dfbe54bf46800ba6 100644 (file)
@@ -651,6 +651,7 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos,
                inset->insetButtonPress(bv_, xpos, ypos, button);
                return;
        }
+       // I'm not sure we should continue here if we hit an inset (Jug20020403)
 
        // Right click on a footnote flag opens float menu
        if (button == 3) {
index 2a1254f92e31c58cc24e81c172a5e5ad1401d16e..d14e4eb5bf3d85b8054377953702a4e4a6a5dd7f 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-03  Juergen Vigna  <jug@sad.it>
+
+       * insettext.C (insetButtonPress): fix insetButtonPress events the same
+       way as in Bufferview_pimpl.
+
 2002-04-03  Allan Rae  <rae@lyx.org>
 
        * insetgraphics.C (latex): one % too many makes living on the bleeding
index 3ceb4f48812088d2d5af000f6cfb8fbe54e070fe..7448eb2fa21226d57d4e6d5c40db75437e272f3f 100644 (file)
@@ -937,7 +937,9 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
                                                            y - inset_y,
                                                            button);
                        return;
-               } else if (inset) {
+               }
+#if 0
+               else if (inset) {
                        // otherwise unlock the_locking_inset and lock the new inset
                        the_locking_inset->insetUnlock(bv);
                        inset_x = cx(bv) - top_x + drawTextXOffset;
@@ -950,6 +952,7 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
                                updateLocal(bv, CURSOR, false);
                        return;
                }
+#endif
                // otherwise only unlock the_locking_inset
                the_locking_inset->insetUnlock(bv);
                the_locking_inset = 0;
@@ -959,16 +962,13 @@ void InsetText::insetButtonPress(BufferView * bv, int x, int y, int button)
 
        if (bv->theLockingInset()) {
                if (isHighlyEditableInset(inset)) {
+                       // We just have to lock the inset before calling a
+                       // PressEvent on it!
                        UpdatableInset * uinset = static_cast<UpdatableInset*>(inset);
-                       inset_x = cx(bv) - top_x + drawTextXOffset;
-                       inset_y = cy(bv) + drawTextYOffset;
-                       inset_pos = cpos(bv);
-                       inset_par = cpar(bv);
-                       inset_boundary = cboundary(bv);
-                       the_locking_inset = uinset;
-                       uinset->insetButtonPress(bv, x - inset_x, y - inset_y,
-                                                button);
-                       uinset->edit(bv, x - inset_x, y - inset_y, 0);
+                       if (!bv->lockInset(uinset)) {
+                               lyxerr[Debug::INSETS] << "Cannot lock inset" << endl;
+                       }
+                       inset->insetButtonPress(bv, x - inset_x, y - inset_y, button);
                        if (the_locking_inset)
                                updateLocal(bv, CURSOR, false);
                        return;