See attached. Basic operations on nested text insets work, tables and
some of the mouse related stuff is defunct but not nearly as bad as last
time.

Someone willing to help me to fix that mess?

It's probably mostly making sense of the stuff in '#ifdef LOCK' and
replacing it with a 'modern' equivalent. (LOCK is undefined, so this is
a #if 0 in disguise.)

Andre'
Index: BufferView.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.C,v
retrieving revision 1.206
diff -u -p -r1.206 BufferView.C
--- BufferView.C        4 Nov 2003 12:36:49 -0000       1.206
+++ BufferView.C        6 Nov 2003 17:31:38 -0000
@@ -384,6 +384,8 @@ void BufferView::replaceWord(string cons
 
 bool BufferView::lockInset(UpdatableInset * inset)
 {
+       return true;
+#ifdef LOCK
        if (!inset)
                return false;
 
@@ -420,6 +422,7 @@ bool BufferView::lockInset(UpdatableInse
                }
        }
        return false;
+#endif
 }
 
 
@@ -444,6 +447,8 @@ void BufferView::hideCursor()
 
 int BufferView::unlockInset(UpdatableInset * inset)
 {
+       return 1;
+#ifdef LOCK
        if (!inset)
                return 0;
        if (inset && theLockingInset() == inset) {
@@ -465,6 +470,7 @@ int BufferView::unlockInset(UpdatableIns
                return 0;
        }
        return 1;
+#endif
 }
 
 
@@ -489,27 +495,13 @@ bool BufferView::ChangeRefsIfUnique(stri
 
 UpdatableInset * BufferView::theLockingInset() const
 {
-       // If NULL is not allowed we should put an Assert here. (Lgb)
-       if (text)
-               return text->the_locking_inset;
-       return 0;
-}
-
-
-void BufferView::theLockingInset(UpdatableInset * inset)
-{
-       text->the_locking_inset = inset;
+       return static_cast<UpdatableInset*>(cursor().innerInset());
 }
 
 
 LyXText * BufferView::getLyXText() const
 {
-       if (theLockingInset()) {
-               LyXText * txt = theLockingInset()->getLyXText(this, true);
-               if (txt)
-                       return txt;
-       }
-       return text;
+       return cursor().innerText();
 }
 
 
Index: BufferView.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView.h,v
retrieving revision 1.150
diff -u -p -r1.150 BufferView.h
--- BufferView.h        4 Nov 2003 12:36:50 -0000       1.150
+++ BufferView.h        6 Nov 2003 17:31:38 -0000
@@ -208,9 +208,6 @@ public:
        LCursor const & cursor() const;
 
 private:
-       /// Set the current locking inset
-       void theLockingInset(UpdatableInset * inset);
-
        struct Pimpl;
        friend struct BufferView::Pimpl;
 
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.453
diff -u -p -r1.453 BufferView_pimpl.C
--- BufferView_pimpl.C  4 Nov 2003 12:36:50 -0000       1.453
+++ BufferView_pimpl.C  6 Nov 2003 17:31:38 -0000
@@ -438,8 +438,10 @@ void BufferView::Pimpl::resizeCurrentBuf
                        bv_->text->selection.cursor = bv_->text->cursor;
                        bv_->text->selection.set(false);
                }
+#ifdef LOCK
                // remake the inset locking
                bv_->theLockingInset(the_locking_inset);
+#endif
        }
 
        top_y(screen().topCursorVisible(bv_->text));
@@ -739,7 +741,6 @@ void BufferView::Pimpl::insetUnlock()
 {
        if (bv_->theLockingInset()) {
                bv_->theLockingInset()->insetUnlock(bv_);
-               bv_->theLockingInset(0);
                finishUndo();
        }
 }
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.15
diff -u -p -r1.15 cursor.C
--- cursor.C    6 Nov 2003 16:43:09 -0000       1.15
+++ cursor.C    6 Nov 2003 17:31:38 -0000
@@ -50,9 +50,10 @@ std::ostream & operator<<(std::ostream &
 
 DispatchResult LCursor::dispatch(FuncRequest const & cmd)
 {
+       lyxerr << "\nLCursor::dispatch: " << *this << endl;
        for (int i = data_.size() - 1; i >= 0; --i) {
                CursorItem const & citem = data_[i];
-               lyxerr << "trying to dispatch to inset" << citem.inset_ << endl;
+               lyxerr << "trying to dispatch to inset " << citem.inset_ << endl;
                DispatchResult res = citem.inset_->dispatch(cmd);
                if (handleResult(res))
                        return DispatchResult(true, true);
@@ -101,7 +102,7 @@ bool LCursor::handleResult(DispatchResul
 
                default:
                        lyxerr << "# unhandled result: " << res.val() << endl;
-                       return false;
+                       return res.dispatched();
        }
 }
 
Index: lyxfunc.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.538
diff -u -p -r1.538 lyxfunc.C
--- lyxfunc.C   6 Nov 2003 16:43:09 -0000       1.538
+++ lyxfunc.C   6 Nov 2003 17:31:38 -0000
@@ -881,207 +881,16 @@ void LyXFunc::dispatch(FuncRequest const
        if (view()->available())
                view()->hideCursor();
 
-#if 1
-       {
-               UpdatableInset * innerinset = view()->theLockingInset();
-               for (UpdatableInset * tmp = innerinset; tmp; tmp = tmp->lockingInset())
-                       innerinset = tmp;
-
-               if (view()->cursor().innerInset() != innerinset) {
-                       lyxerr << "### CURSOR OUT OF SYNC: tli: "
-                               << view()->theLockingInset() << "  inner: "
-                               << innerinset
-                               << "\ncursor: " << view()->cursor() << endl; 
-               }
-       }
-
-       if (0) {
-               DispatchResult result =
-                       view()->cursor().dispatch(FuncRequest(func, view()));
-
-               if (result.dispatched()) {
-                       if (result.update()) {
-                               view()->update();
-                       }
-                       lyxerr << "dispatched by Cursor::dispatch()\n";
-                       goto exit_with_message;
-               }
-               lyxerr << "### NOT DispatchResult(true, true) BY Cursor::dispatch() 
###\n";
-       }
-#endif
-
-
-       if (view()->available() && view()->theLockingInset()) {
-               DispatchResult result;
-               if (action > 1 || (action == LFUN_UNKNOWN_ACTION &&
-                                    !keyseq.deleted()))
-               {
-                       UpdatableInset * inset = view()->theLockingInset();
-#if 1
-                       int inset_x;
-                       int dummy_y;
-                       inset->getCursorPos(view(), inset_x, dummy_y);
-#endif
-                       if (action == LFUN_UNKNOWN_ACTION && argument.empty())
-                               argument = encoded_last_key;
-
-                       // the insets can't try to handle this,
-                       // a table cell in the dummy position will
-                       // lock its insettext, the insettext will
-                       // pass it the bufferview, and succeed,
-                       // so it will stay not locked. Not good
-                       // if we've just done LFUN_ESCAPE (which
-                       // injects an LFUN_PARAGRAPH_UPDATE)
-                       if (action == LFUN_PARAGRAPH_UPDATE) {
-                               view()->dispatch(func);
-                               goto exit_with_message;
-                       }
-
-                       // Undo/Redo is a bit tricky for insets.
-                       if (action == LFUN_UNDO) {
-                               view()->undo();
-                               goto exit_with_message;
-                       }
-
-                       if (action == LFUN_REDO) {
-                               view()->redo();
-                               goto exit_with_message;
-                       }
-
-                       // Hand-over to inset's own dispatch:
-                       result = inset->dispatch(FuncRequest(view(), action, 
argument));
-                       if (result.dispatched()) {
-                               if (result.update())
-                                       view()->update();
-
-                               goto exit_with_message;
-                       }
-
-                       // If DispatchResult(false), just soldier on
-                       if (result.val() == FINISHED) {
-                               owner->clearMessage();
-                               goto exit_with_message;
-                               // We do not need special RTL handling here:
-                               // FINISHED means that the cursor should be
-                               // one position after the inset.
-                       }
-
-                       if (result.val() == FINISHED_RIGHT) {
-                               view()->text->cursorRight(view());
-                               moveCursorUpdate();
-                               owner->clearMessage();
-                               goto exit_with_message;
-                       }
-
-                       if (result.val() == FINISHED_UP) {
-                               LyXText * text = view()->text;
-                               ParagraphList::iterator pit = text->cursorPar();
-                               Row const & row = *pit->getRow(text->cursor.pos());
-                               if (text->isFirstRow(pit, row)) {
-#if 1
-                                       text->setCursorFromCoordinates(
-                                               text->cursor.x() + inset_x,
-                                               text->cursor.y() -
-                                               row.baseline() - 1);
-                                       view()->x_target(text->cursor.x());
-#else
-                                       text->cursorUp(view());
-#endif
-                                       moveCursorUpdate();
-                               } else {
-                                       view()->update();
-                               }
-                               owner->clearMessage();
-                               goto exit_with_message;
-                       }
-
-                       if (result.val() == FINISHED_DOWN) {
-                               LyXText * text = view()->text;
-                               ParagraphList::iterator pit = text->cursorPar();
-                               Row const & row = *pit->getRow(text->cursor.pos());
-                               if (text->isLastRow(pit, row)) {
-#if 1
-                                       text->setCursorFromCoordinates(
-                                               text->cursor.x() + inset_x,
-                                               text->cursor.y() -
-                                               row.baseline() +
-                                               row.height() + 1);
-                                       view()->x_target(text->cursor.x());
-#else
-                                       text->cursorDown(view());
-#endif
-                               } else {
-                                       text->cursorRight(view());
-                               }
-                               moveCursorUpdate();
-                               owner->clearMessage();
-                               goto exit_with_message;
-                       }
 
-#warning I am not sure this is still right, please have a look! (Jug 20020417)
-                       // result == DispatchResult()
-                       //setMessage(N_("Text mode"));
-                       switch (action) {
-                       case LFUN_UNKNOWN_ACTION:
-                       case LFUN_BREAKPARAGRAPH:
-                       case LFUN_BREAKLINE:
-                               view()->text->cursorRight(view());
-                               view()->switchKeyMap();
-                               owner->view_state_changed();
-                               break;
-                       case LFUN_RIGHT:
-                               if 
(!view()->text->cursorPar()->isRightToLeftPar(owner->buffer()->params())) {
-                                       view()->text->cursorRight(view());
-                                       moveCursorUpdate();
-                                       owner->view_state_changed();
-                               }
-                               goto exit_with_message;
-                       case LFUN_LEFT:
-                               if 
(view()->text->cursorPar()->isRightToLeftPar(owner->buffer()->params())) {
-                                       view()->text->cursorRight(view());
-                                       moveCursorUpdate();
-                                       owner->view_state_changed();
-                               }
-                               goto exit_with_message;
-                       case LFUN_DOWN: {
-                               LyXText * text = view()->text;
-                               ParagraphList::iterator pit = text->cursorPar();
-                               if (text->isLastRow(pit, 
*pit->getRow(text->cursor.pos())))
-                                       view()->text->cursorDown(view());
-                               else
-                                       view()->text->cursorRight(view());
-                               moveCursorUpdate();
-                               owner->view_state_changed();
-                               goto exit_with_message;
-                       }
-                       default:
-                               break;
-                       }
-               }
-       }
 
        switch (action) {
 
        case LFUN_ESCAPE: {
                if (!view()->available())
                        break;
-               // this function should be used always [asierra060396]
-               UpdatableInset * tli = view()->theLockingInset();
-               if (tli) {
-                       UpdatableInset * lock = tli->getLockingInset();
-
-                       if (tli == lock) {
-                               view()->unlockInset(tli);
-                               view()->text->cursorRight(view());
-                               moveCursorUpdate();
-                               owner->view_state_changed();
-                       } else {
-                               tli->unlockInsetInInset(view(), lock, true);
-                       }
-                       finishUndo();
-                       // Tell the paragraph dialog that we changed paragraph
-                       dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
-               }
+               view()->cursor().pop();
+               // Tell the paragraph dialog that we changed paragraph
+               dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
                break;
        }
 
@@ -1656,15 +1465,21 @@ void LyXFunc::dispatch(FuncRequest const
                InsetExternal().dispatch(FuncRequest(view(), action, argument));
                break;
 
-       default:
-               // Then if it was none of the above
-               // Trying the BufferView::pimpl dispatch:
-               if (!view()->dispatch(func))
-                       lyxerr << "A truly unknown func ["
-                              << lyxaction.getActionName(func.action) << "]!"
-                              << endl;
-               break;
-       } // end of switch
+       default: {
+                       DispatchResult result =
+                               view()->cursor().dispatch(FuncRequest(func, view()));
+
+                       if (result.dispatched()) {
+                               if (result.update()) {
+                                       view()->update();
+                               }
+                               lyxerr << "dispatched by Cursor::dispatch()\n";
+                               goto exit_with_message;
+                       }
+                       lyxerr << "### NOT DispatchResult(true, true) BY 
Cursor::dispatch() ###\n";
+                       break;
+               }
+       }
 
 exit_with_message:
 
Index: text3.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text3.C,v
retrieving revision 1.170
diff -u -p -r1.170 text3.C
--- text3.C     6 Nov 2003 16:43:10 -0000       1.170
+++ text3.C     6 Nov 2003 17:31:38 -0000
@@ -391,7 +391,8 @@ void doInsertInset(LyXText * lt, FuncReq
 
 DispatchResult LyXText::dispatch(FuncRequest const & cmd)
 {
-       lyxerr[Debug::ACTION] << "LyXText::dispatch: action[" << cmd.action
+       ///lyxerr[Debug::ACTION] << "LyXText::dispatch: action[" << cmd.action
+       lyxerr << "LyXText::dispatch: action[" << cmd.action
                              <<"] arg[" << cmd.argument << ']' << "xy[" <<
                                  cmd.x << ',' << cmd.y << ']' << endl;
 
Index: insets/insettabular.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.h,v
retrieving revision 1.163
diff -u -p -r1.163 insettabular.h
--- insets/insettabular.h       6 Nov 2003 16:43:11 -0000       1.163
+++ insets/insettabular.h       6 Nov 2003 17:31:38 -0000
@@ -273,8 +273,6 @@ private:
                          int & srow, int & erow) const;
        ///
        bool insertAsciiString(BufferView *, std::string const & buf, bool usePaste);
-       ///
-       UpdatableInset * lockingInset() const { return the_locking_inset; }
 
        //
        // Private structures and variables
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.533
diff -u -p -r1.533 insettext.C
--- insets/insettext.C  6 Nov 2003 16:43:11 -0000       1.533
+++ insets/insettext.C  6 Nov 2003 17:31:38 -0000
@@ -118,7 +118,6 @@ void InsetText::init()
        inset_x = 0;
        inset_y = 0;
        no_selection = true;
-       the_locking_inset = 0;
        old_par = -1;
        in_insetAllowed = false;
        mouse_x = 0;
@@ -323,11 +322,6 @@ string const InsetText::editMessage() co
 
 void InsetText::insetUnlock(BufferView * bv)
 {
-       if (the_locking_inset) {
-               the_locking_inset->insetUnlock(bv);
-               the_locking_inset = 0;
-               updateLocal(bv, false);
-       }
        no_selection = true;
        locked = false;
 
@@ -349,7 +343,6 @@ void InsetText::insetUnlock(BufferView *
 void InsetText::lockInset(BufferView * bv)
 {
        locked = true;
-       the_locking_inset = 0;
        inset_x = inset_y = 0;
        inset_boundary = false;
        old_par = -1;
@@ -367,9 +360,8 @@ void InsetText::lockInset(BufferView * b
 }
 
 
-void InsetText::lockInset(BufferView * /*bv*/, UpdatableInset * inset)
+void InsetText::lockInset(BufferView *, UpdatableInset *)
 {
-       the_locking_inset = inset;
        inset_x = cx() - top_x;
        inset_y = cy();
        inset_boundary = cboundary();
@@ -382,6 +374,7 @@ bool InsetText::lockInsetInInset(BufferV
                              << inset << "): " << endl;
        if (!inset)
                return false;
+#ifdef LOCK
        if (!the_locking_inset) {
                ParagraphList::iterator pit = paragraphs.begin();
                ParagraphList::iterator pend = paragraphs.end();
@@ -405,12 +398,14 @@ bool InsetText::lockInsetInInset(BufferV
                lyxerr << "InsetText::lockInsetInInset: 3" << endl;
                return false;
        }
+#endif
        if (inset == cpar()->getInset(cpos())) {
                lyxerr[Debug::INSETS] << "OK" << endl;
                lockInset(bv, inset);
                return true;
        }
 
+#ifdef LOCK
        if (the_locking_inset && the_locking_inset == inset) {
                inset_x = cx() - top_x;
                inset_y = cy();
@@ -418,14 +413,15 @@ bool InsetText::lockInsetInInset(BufferV
                lyxerr[Debug::INSETS] << "MAYBE" << endl;
                return the_locking_inset->lockInsetInInset(bv, inset);
        }
+#endif
        lyxerr[Debug::INSETS] << "NOT OK" << endl;
        return false;
 }
 
 
-bool InsetText::unlockInsetInInset(BufferView * bv, UpdatableInset * inset,
-                                  bool lr)
+bool InsetText::unlockInsetInInset(BufferView *, UpdatableInset *, bool)
 {
+#ifdef LOCK 
        if (!the_locking_inset)
                return false;
        if (the_locking_inset == inset) {
@@ -441,6 +437,8 @@ bool InsetText::unlockInsetInInset(Buffe
                return true;
        }
        return the_locking_inset->unlockInsetInInset(bv, inset, lr);
+#endif
+       return 0;
 }
 
 
@@ -462,19 +460,10 @@ void InsetText::lfunMousePress(FuncReque
        int tmp_x = cmd.x;
        int tmp_y = cmd.y + dim_.asc - bv->top_y();
        InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
-
-       if (the_locking_inset) {
-               if (the_locking_inset == inset) {
-                       the_locking_inset->dispatch(cmd1);
-                       return;
-               }
-               // otherwise only unlock the_locking_inset
-               the_locking_inset->insetUnlock(bv);
-               the_locking_inset = 0;
-       }
        if (!inset)
                no_selection = false;
 
+#if 0
        if (bv->theLockingInset()) {
                if (isHighlyEditableInset(inset)) {
                        // We just have to lock the inset before calling a
@@ -489,6 +478,7 @@ void InsetText::lfunMousePress(FuncReque
                        return;
                }
        }
+#endif
        if (!inset) {
                bool paste_internally = false;
                if (cmd.button() == mouse_button::button2 && 
getLyXText(bv)->selection.set()) {
@@ -534,11 +524,6 @@ bool InsetText::lfunMouseRelease(FuncReq
        cmd1.y -= inset_y;
 
        no_selection = true;
-       if (the_locking_inset) {
-               DispatchResult const res = the_locking_inset->dispatch(cmd1);
-               return res.dispatched();
-       }
-
        int tmp_x = cmd.x;
        int tmp_y = cmd.y + dim_.asc - bv->top_y();
        InsetOld * inset = getLyXText(bv)->checkInsetHit(tmp_x, tmp_y);
@@ -560,11 +545,6 @@ void InsetText::lfunMouseMotion(FuncRequ
        cmd1.x -= inset_x;
        cmd1.y -= inset_y;
 
-       if (the_locking_inset) {
-               the_locking_inset->dispatch(cmd1);
-               return;
-       }
-
        if (no_selection || (mouse_x == cmd.x && mouse_y == cmd.y))
                return;
 
@@ -590,7 +570,6 @@ void InsetText::edit(BufferView * bv, bo
        lyxerr << "InsetText: edit left/right" << endl;
 
        locked = true;
-       the_locking_inset = 0;
        inset_x = 0;
        inset_y = 0;
        inset_boundary = false;
@@ -627,7 +606,6 @@ void InsetText::edit(BufferView * bv, in
        lyxerr << "InsetText: edit xy" << endl;
 
        locked = true;
-       the_locking_inset = 0;
        inset_x = 0;
        inset_y = 0;
        inset_boundary = false;
@@ -665,11 +643,19 @@ void InsetText::edit(BufferView * bv, in
 
 
 DispatchResult
-InsetText::priv_dispatch(FuncRequest const & cmd,
-                        idx_type & idx, pos_type & pos)
+InsetText::priv_dispatch(FuncRequest const & cmd, idx_type &, pos_type &)
 {
+       lyxerr << "InsetText::priv_dispatch (begin), act: " << cmd.action << " " << 
endl;
        BufferView * bv = cmd.view();
        setViewCache(bv);
+       DispatchResult result;
+       result.dispatched(true);
+
+       bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
+       if (cmd.action != LFUN_MOUSE_PRESS
+                       && cmd.action != LFUN_MOUSE_MOTION
+                       && cmd.action != LFUN_MOUSE_RELEASE)
+               no_selection = false;
 
        switch (cmd.action) {
        case LFUN_MOUSE_PRESS:
@@ -683,71 +669,9 @@ InsetText::priv_dispatch(FuncRequest con
        case LFUN_MOUSE_RELEASE:
                return DispatchResult(lfunMouseRelease(cmd));
 
-       default:
-               break;
-       }
-
-       bool was_empty = paragraphs.begin()->empty() && paragraphs.size() == 1;
-       no_selection = false;
-
-       DispatchResult result = UpdatableInset::priv_dispatch(cmd, idx, pos);
-       if (result.dispatched())
-               return result;
-
-#if 0
-       // This looks utterly strange. (Lgb)
-       if (cmd.action == LFUN_UNKNOWN_ACTION && cmd.argument.empty())
-               return DispatchResult(false, FINISHED);
-#endif
-
-       if (the_locking_inset) {
-               DispatchResult result = the_locking_inset->dispatch(cmd);
-
-               if (result.dispatched()) {
-                       if (result.update()) {
-                               result.update(false);
-                               updateLocal(bv, false);
-                       }
-                       return result;
-               }
-
-               switch (result.val()) {
-               case FINISHED_RIGHT:
-                       moveRightIntern(bv, false, false);
-                       result.dispatched(true);
-                       result.update(true);
-                       break;
-               case FINISHED_UP:
-                       result = moveUp(bv);
-                       if (result.val() >= FINISHED) {
-                               updateLocal(bv, false);
-                               bv->unlockInset(this);
-                       }
-                       break;
-               case FINISHED_DOWN:
-                       result = moveDown(bv);
-                       if (result.val() >= FINISHED) {
-                               updateLocal(bv, false);
-                               bv->unlockInset(this);
-                       }
-                       break;
-               default:
-                       result.dispatched(true);
-                       result.update(true);
-                       break;
-               }
-               the_locking_inset = 0;
-               updateLocal(bv, false);
-               // make sure status gets reset immediately
-               bv->owner()->clearMessage();
-               return result;
-       }
-
-       switch (cmd.action) {
-       // Normal chars
        case LFUN_SELFINSERT:
                if (bv->buffer()->isReadonly()) {
-//         setErrorMessage(N_("Document is read only"));
+                       // setErrorMessage(N_("Document is read only"));
                        break;
                }
                if (!cmd.argument.empty()) {
@@ -938,6 +862,7 @@ InsetText::priv_dispatch(FuncRequest con
                break;
 
        default:
+               result.dispatched(false);       
                break;
        }
 
@@ -957,9 +882,9 @@ InsetText::priv_dispatch(FuncRequest con
 
        if (result.val() >= FINISHED) {
                result.val(NONE);
-               bv->unlockInset(this);
+               //bv->cursor().pop();
        }
-
+       lyxerr << "InsetText::priv_dispatch (end)" << endl;
        return result;
 }
 
@@ -1010,23 +935,15 @@ void InsetText::validate(LaTeXFeatures &
 }
 
 
-void InsetText::getCursor(BufferView & bv, int & x, int & y) const
+void InsetText::getCursor(BufferView &, int & x, int & y) const
 {
-       if (the_locking_inset) {
-               the_locking_inset->getCursor(bv, x, y);
-               return;
-       }
        x = cx();
        y = cy() + InsetText::y();
 }
 
 
-void InsetText::getCursorPos(BufferView * bv, int & x, int & y) const
+void InsetText::getCursorPos(BufferView *, int & x, int & y) const
 {
-       if (the_locking_inset) {
-               the_locking_inset->getCursorPos(bv, x, y);
-               return;
-       }
        x = cx() - top_x - TEXT_TO_INSET_OFFSET;
        y = cy() - TEXT_TO_INSET_OFFSET;
 }
@@ -1034,25 +951,18 @@ void InsetText::getCursorPos(BufferView 
 
 int InsetText::insetInInsetY() const
 {
-       if (!the_locking_inset)
-               return 0;
-
+#ifdef LOCK
        return inset_y + the_locking_inset->insetInInsetY();
+#endif
+       return inset_y;
 }
 
 
 void InsetText::fitInsetCursor(BufferView * bv) const
 {
-       if (the_locking_inset) {
-               the_locking_inset->fitInsetCursor(bv);
-               return;
-       }
-
        LyXFont const font = text_.getFont(cpar(), cpos());
-
        int const asc = font_metrics::maxAscent(font);
        int const desc = font_metrics::maxDescent(font);
-
        bv->fitLockedInsetCursor(cx(), cy(), asc, desc);
 }
 
@@ -1141,11 +1051,6 @@ DispatchResult InsetText::moveDown(Buffe
 
 bool InsetText::insertInset(BufferView * bv, InsetOld * inset)
 {
-       if (the_locking_inset) {
-               if (the_locking_inset->insetAllowed(inset))
-                       return the_locking_inset->insertInset(bv, inset);
-               return false;
-       }
        inset->setOwner(this);
        text_.insertInset(inset);
        bv->fitCursor();
@@ -1164,36 +1069,23 @@ bool InsetText::insetAllowed(InsetOld::C
        if (in_insetAllowed)
                return ret;
        in_insetAllowed = true;
-       if (the_locking_inset)
-               ret = the_locking_inset->insetAllowed(code);
-       else if (owner())
+       if (owner())
                ret = owner()->insetAllowed(code);
        in_insetAllowed = false;
        return ret;
 }
 
 
-UpdatableInset * InsetText::getLockingInset() const
-{
-       return the_locking_inset ? the_locking_inset->getLockingInset() :
-               const_cast<InsetText *>(this);
-}
-
-
 UpdatableInset * InsetText::getFirstLockingInsetOfType(InsetOld::Code c)
 {
        if (c == lyxCode())
                return this;
-       if (the_locking_inset)
-               return the_locking_inset->getFirstLockingInsetOfType(c);
        return 0;
 }
 
 
-bool InsetText::showInsetDialog(BufferView * bv) const
+bool InsetText::showInsetDialog(BufferView *) const
 {
-       if (the_locking_inset)
-               return the_locking_inset->showInsetDialog(bv);
        return false;
 }
 
@@ -1215,11 +1107,6 @@ void InsetText::getLabelList(Buffer cons
 void InsetText::setFont(BufferView * bv, LyXFont const & font, bool toggleall,
                        bool selectall)
 {
-       if (the_locking_inset) {
-               the_locking_inset->setFont(bv, font, toggleall, selectall);
-               return;
-       }
-
        if ((paragraphs.size() == 1 && paragraphs.begin()->empty())
            || cpar()->empty()) {
                text_.setFont(font, toggleall);
@@ -1254,8 +1141,6 @@ bool InsetText::checkAndActivateInset(Bu
        if (!isHighlyEditableInset(inset))
                return false;
        inset->edit(bv, front);
-       if (!the_locking_inset)
-               return false;
        updateLocal(bv, false);
        return true;
 }
@@ -1277,8 +1162,6 @@ bool InsetText::checkAndActivateInset(Bu
        inset_x = cx() - top_x;
        inset_y = cy();
        inset->edit(bv, x - inset_x, y - inset_y);
-       if (!the_locking_inset)
-               return false;
        updateLocal(bv, false);
        return true;
 }
@@ -1337,13 +1220,7 @@ void InsetText::setFrameColor(LColor_col
 
 int InsetText::cx() const
 {
-       int x = text_.cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
-       if (the_locking_inset) {
-               LyXFont font = text_.getFont(text_.cursorPar(), text_.cursor.pos());
-               if (font.isVisibleRightToLeft())
-                       x -= the_locking_inset->width();
-       }
-       return x;
+       return text_.cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
 }
 
 
@@ -1377,12 +1254,9 @@ RowList::iterator InsetText::crow() cons
 }
 
 
-LyXText * InsetText::getLyXText(BufferView const * bv,
-                               bool const recursive) const
+LyXText * InsetText::getLyXText(BufferView const * bv, bool) const
 {
        setViewCache(bv);
-       if (recursive && the_locking_inset)
-               return the_locking_inset->getLyXText(bv, true);
        return &text_;
 }
 
@@ -1424,12 +1298,7 @@ void InsetText::removeNewlines()
 
 int InsetText::scroll(bool recursive) const
 {
-       int sx = UpdatableInset::scroll(false);
-
-       if (recursive && the_locking_inset)
-               sx += the_locking_inset->scroll(recursive);
-
-       return sx;
+       return UpdatableInset::scroll(false);
 }
 
 
@@ -1470,11 +1339,9 @@ LyXText * InsetText::getText(int i) cons
 }
 
 
-LyXCursor const & InsetText::cursor(BufferView * bv) const
+LyXCursor const & InsetText::cursor(BufferView *) const
 {
-       if (the_locking_inset)
-               return the_locking_inset->cursor(bv);
-       return getLyXText(bv)->cursor;
+       return text_.cursor;
 }
 
 
Index: insets/insettext.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.h,v
retrieving revision 1.225
diff -u -p -r1.225 insettext.h
--- insets/insettext.h  6 Nov 2003 16:43:12 -0000       1.225
+++ insets/insettext.h  6 Nov 2003 17:31:38 -0000
@@ -108,8 +108,6 @@ public:
        ///
        bool insetAllowed(InsetOld::Code) const;
        ///
-       UpdatableInset * getLockingInset() const;
-       ///
        UpdatableInset * getFirstLockingInsetOfType(InsetOld::Code);
        ///
        void setFont(BufferView *, LyXFont const &,
@@ -183,8 +181,6 @@ public:
        void edit(BufferView *, bool);
        ///
        void edit(BufferView *, int, int);
-       ///
-       UpdatableInset * lockingInset() const { return the_locking_inset; }
 
        ///
        int numParagraphs() const { return 1; }
@@ -275,8 +271,6 @@ private:
        mutable int inset_y;
        ///
        bool no_selection;
-       ///
-       UpdatableInset * the_locking_inset;
        ///
        mutable lyx::paroffset_type old_par;
 

Reply via email to