From c04225fdf19f00c1cc91255073ad1a8fcd76675b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Wed, 3 Apr 2002 13:59:04 +0000 Subject: [PATCH] Fix insetButtonPress in InsetText the same way as in Bufferview_pimpl. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3892 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView_pimpl.C | 1 + src/insets/ChangeLog | 5 +++++ src/insets/insettext.C | 20 ++++++++++---------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 56548fbca3..e4c70906e4 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -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) { diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 2a1254f92e..d14e4eb5bf 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,8 @@ +2002-04-03 Juergen Vigna + + * insettext.C (insetButtonPress): fix insetButtonPress events the same + way as in Bufferview_pimpl. + 2002-04-03 Allan Rae * insetgraphics.C (latex): one % too many makes living on the bleeding diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 3ceb4f4881..7448eb2fa2 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -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(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;