It is only used one place, and had some ugly operator=(...) stuff in it. Please have a look.
Index: cursor.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.h,v retrieving revision 1.66 diff -u -p -B -b -w -r1.66 cursor.h --- cursor.h 15 Aug 2004 21:20:58 -0000 1.66 +++ cursor.h 27 Nov 2004 16:21:04 -0000 @@ -41,9 +41,10 @@ public: void dispatch(FuncRequest const & cmd); /// get the resut of the last dispatch DispatchResult result() const; +#if 0 /// are we willing to handle this event? bool getStatus(FuncRequest const & cmd, FuncStatus & flag); - +#endif /// add a new cursor slice void push(InsetBase & inset); /// add a new cursor slice, place cursor on left end Index: cursor.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v retrieving revision 1.113 diff -u -p -B -b -w -r1.113 cursor.C --- cursor.C 24 Nov 2004 21:53:37 -0000 1.113 +++ cursor.C 27 Nov 2004 16:21:04 -0000 @@ -229,6 +229,7 @@ DispatchResult LCursor::result() const } +#if 0 bool LCursor::getStatus(FuncRequest const & cmd, FuncStatus & status) { // This is, of course, a mess. Better create a new doc iterator and use @@ -266,7 +267,59 @@ bool LCursor::getStatus(FuncRequest cons operator=(safe); return res; } +#else +#if 0 +// moved to anon ns on lyxfunc.C +bool getStatus(LCursor cursor, + FuncRequest const & cmd, FuncStatus & status) +{ + // This is, of course, a mess. Better create a new doc iterator and use + // this in Inset::getStatus. This might require an additional + // BufferView * arg, though (which should be avoided) + //LCursor safe = *this; + bool res = false; + for ( ; cursor.size(); cursor.pop()) { + //lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl; + DocIterator::idx_type & idx = cursor.idx(); + DocIterator::idx_type const lastidx = cursor.lastidx(); + + if (idx > lastidx) { + lyxerr << "wrong idx " << idx << ", max is " << lastidx + << ". Trying to correct this." << endl; + idx = lastidx; + } + + DocIterator::pit_type & pit = cursor.pit(); + DocIterator::pit_type const lastpit = cursor.lastpit(); + + if (pit > lastpit) { + lyxerr << "wrong par " << pit << ", max is " << lastpit + << ". Trying to correct this." << endl; + pit = lastpit; + } + + DocIterator::pos_type & pos = cursor.pos(); + DocIterator::pos_type const lastpos = cursor.lastpos(); + if (pos > lastpos) { + lyxerr << "wrong pos " << pos << ", max is " << lastpos + << ". Trying to correct this." << endl; + pos = lastpos; + } + + // The inset's getStatus() will return 'true' if it made + // a definitive decision on whether it want to handle the + // request or not. The result of this decision is put into + // the 'status' parameter. + if (cursor.inset().getStatus(cursor, cmd, status)) { + res = true; + break; + } + } + return res; +} +#endif +#endif BufferView & LCursor::bv() const { Index: lyxfunc.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxfunc.C,v retrieving revision 1.632 diff -u -p -B -b -w -r1.632 lyxfunc.C --- lyxfunc.C 25 Nov 2004 19:12:58 -0000 1.632 +++ lyxfunc.C 27 Nov 2004 16:21:04 -0000 @@ -142,6 +142,59 @@ extern boost::scoped_ptr<kb_keymap> topl extern tex_accent_struct get_accent(kb_action action); +namespace { + +bool getStatus(LCursor cursor, + FuncRequest const & cmd, FuncStatus & status) +{ + // This is, of course, a mess. Better create a new doc iterator and use + // this in Inset::getStatus. This might require an additional + // BufferView * arg, though (which should be avoided) + //LCursor safe = *this; + bool res = false; + for ( ; cursor.size(); cursor.pop()) { + //lyxerr << "\nLCursor::getStatus: cmd: " << cmd << endl << *this << endl; + DocIterator::idx_type & idx = cursor.idx(); + DocIterator::idx_type const lastidx = cursor.lastidx(); + + if (idx > lastidx) { + lyxerr << "wrong idx " << idx << ", max is " << lastidx + << ". Trying to correct this." << endl; + idx = lastidx; + } + + DocIterator::pit_type & pit = cursor.pit(); + DocIterator::pit_type const lastpit = cursor.lastpit(); + + if (pit > lastpit) { + lyxerr << "wrong par " << pit << ", max is " << lastpit + << ". Trying to correct this." << endl; + pit = lastpit; + } + + DocIterator::pos_type & pos = cursor.pos(); + DocIterator::pos_type const lastpos = cursor.lastpos(); + + if (pos > lastpos) { + lyxerr << "wrong pos " << pos << ", max is " << lastpos + << ". Trying to correct this." << endl; + pos = lastpos; + } + + // The inset's getStatus() will return 'true' if it made + // a definitive decision on whether it want to handle the + // request or not. The result of this decision is put into + // the 'status' parameter. + if (cursor.inset().getStatus(cursor, cmd, status)) { + res = true; + break; + } + } + return res; +} + +} + LyXFunc::LyXFunc(LyXView * lv) : owner(lv), encoded_last_key(0), @@ -522,7 +575,7 @@ FuncStatus LyXFunc::getStatus(FuncReques default: - if (!cur.getStatus(cmd, flag)) + if (!::getStatus(cur, cmd, flag)) flag = view()->getStatus(cmd); }
-- Lgb