From 1e775a68c63772a657cb1547c390d663ce94e1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Vigna?= Date: Thu, 17 Jan 2002 14:27:01 +0000 Subject: [PATCH] Fixed insetlocking-mechanism and PARAGRAPH_GOTO func. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3407 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 2 +- src/ChangeLog | 7 +++++++ src/insets/ChangeLog | 6 ++++++ src/insets/insettabular.C | 7 ++++--- src/insets/insettext.C | 13 ++++++++++--- src/lyxfunc.C | 9 +++++++-- 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index ad4d36297c..892d36e22e 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -520,7 +520,7 @@ bool BufferView::lockInset(UpdatableInset * inset) } if ((*it)->getInsetFromID(id)) { text->setCursorIntern(this, par, it.getPos()); - theLockingInset(static_cast(*it)); + (*it)->edit(this); return theLockingInset()->lockInsetInInset(this, inset); } } diff --git a/src/ChangeLog b/src/ChangeLog index d47352bc1f..76cd984f9d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2002-01-17 Juergen Vigna + + * lyxfunc.C (dispatch): fixed PARAGRAPH_GOTO + + * BufferView2.C (lockInset): call edit() so that theLockingInset() + is set correctly and the inset is updated correctly. + 2002-01-17 Jean-Marc Lasgouttes * CutAndPaste.C (pasteSelection): move the setInsetOwner call at diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 817a8a68ad..ef5bcda5be 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,7 +1,13 @@ 2002-01-17 Juergen Vigna + * insettabular.C (lockInsetInInset): same change as in insettext. + * insettext.C (draw): width() function was called without setting the right top_x which could lead to wrong insetWidth setting! + (lockInsetInInset): call edit instead of calling lockInset if we + have to lock an inset inside! + (edit): we have to also tell the inset that we have to redraw the + frame on an edit call if this inset draws a frame only if locked. 2002-01-16 Jean-Marc Lasgouttes diff --git a/src/insets/insettabular.C b/src/insets/insettabular.C index 3d27fe93d7..0990b8db48 100644 --- a/src/insets/insettabular.C +++ b/src/insets/insettabular.C @@ -645,9 +645,10 @@ bool InsetTabular::lockInsetInInset(BufferView * bv, UpdatableInset * inset) } if (in->getInsetFromID(id)) { actcell = i; - the_locking_inset = in; - locked = true; - resetPos(bv); + in->edit(bv); +// the_locking_inset = in; +// locked = true; +// resetPos(bv); return the_locking_inset->lockInsetInInset(bv, inset); } } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index f2cec46c17..5c866725c6 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -668,7 +668,11 @@ void InsetText::edit(BufferView * bv, int x, int y, unsigned int button) showInsetCursor(bv); if (clear) lt = 0; - updateLocal(bv, CURSOR, false); + + int code = CURSOR; + if (drawFrame_ == LOCKED) + code = CURSOR|DRAW_FRAME; + updateLocal(bv, code, false); } @@ -713,7 +717,10 @@ void InsetText::edit(BufferView * bv, bool front) showInsetCursor(bv); if (clear) lt = 0; - updateLocal(bv, CURSOR, false); + int code = CURSOR; + if (drawFrame_ == LOCKED) + code = CURSOR|DRAW_FRAME; + updateLocal(bv, code, false); } @@ -785,7 +792,7 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset) } if ((*it)->getInsetFromID(id)) { getLyXText(bv)->setCursorIntern(bv, p, it.getPos()); - lockInset(bv, static_cast(*it)); + (*it)->edit(bv); return the_locking_inset->lockInsetInInset(bv, inset); } } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index b65a5e6472..08da670326 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1397,7 +1397,7 @@ string const LyXFunc::dispatch(kb_action action, string argument) case LFUN_GOTO_PARAGRAPH: { - istringstream istr(argument.c_str()); + istringstream istr(argument.c_str()); int id; istr >> id; @@ -1411,8 +1411,13 @@ string const LyXFunc::dispatch(kb_action action, string argument) << " found." << endl; } + if (owner->view()->theLockingInset()) + owner->view()->unlockInset(owner->view()->theLockingInset()); + if (par->inInset()) { + par->inInset()->edit(owner->view()); + } // Set the cursor - owner->view()->text->setCursor(owner->view(), par, 0); + owner->view()->getLyXText()->setCursor(owner->view(), par, 0); owner->view()->setState(); owner->showState();