From 7c984f40f2bb6dd91d6e0faba0bbec135a121694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sun, 5 Aug 2001 22:12:27 +0000 Subject: [PATCH] some debug stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2421 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/bufferview_funcs.C | 3 +++ src/insets/insetcollapsable.C | 1 + src/insets/insettext.C | 17 +++++++++++++++++ src/lyxfunc.C | 5 ++++- src/text2.C | 26 +++++++++++++++++++------- 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index c65b911735..7239dbd0e2 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -194,6 +194,9 @@ string const currentState(BufferView * bv) break; } } +#if 1 + state << _(", Paragraph: ") << text->cursor.par()->id(); +#endif } return state.str().c_str(); } diff --git a/src/insets/insetcollapsable.C b/src/insets/insetcollapsable.C index 20801418a6..beb5728367 100644 --- a/src/insets/insetcollapsable.C +++ b/src/insets/insetcollapsable.C @@ -550,6 +550,7 @@ int InsetCollapsable::scroll(bool recursive) const Paragraph * InsetCollapsable::getParFromID(int id) const { + lyxerr[Debug::INFO] << "Looking for paragraph " << id << endl; return inset.getParFromID(id); } diff --git a/src/insets/insettext.C b/src/insets/insettext.C index 8049dbdbd1..74f8d7ebd7 100644 --- a/src/insets/insettext.C +++ b/src/insets/insettext.C @@ -1998,6 +1998,7 @@ void InsetText::clearInset(Painter & pain, int baseline, bool & cleared) const Paragraph * InsetText::getParFromID(int id) const { +#if 0 Paragraph * result = par; Paragraph * ires = 0; while (result && result->id() != id) { @@ -2006,6 +2007,22 @@ Paragraph * InsetText::getParFromID(int id) const result = result->next(); } return result; +#else + Paragraph * tmp = par; + while (tmp) { + int tmp_id = tmp->id(); + lyxerr << "Looking at paragraph: " << tmp_id << endl; + if (tmp->id() == id) { + return tmp; + } + Paragraph * tmp2 = tmp->getParFromID(id); + if (tmp2 != 0) { + return tmp2; + } + tmp = tmp->next(); + } + return 0; +#endif } diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 2bfadf470c..a95050cc8b 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -1393,10 +1393,13 @@ string const LyXFunc::dispatch(int ac, lyxerr[Debug::INFO] << "No matching paragraph found! [" << id << "]" << std::endl; break; + } else { + lyxerr << "Paragraph " << par->id() + << " found." << endl; } // Set the cursor - TEXT()->setCursor(owner->view(), par, 0); + owner->view()->text->setCursor(owner->view(), par, 0); owner->view()->setState(); owner->showState(); diff --git a/src/text2.C b/src/text2.C index fa5220ac46..179b5dacb1 100644 --- a/src/text2.C +++ b/src/text2.C @@ -2137,14 +2137,26 @@ void LyXText::setCursorIntern(BufferView * bview, Paragraph * par, bool setfont, bool boundary) const { InsetText * it = static_cast(par->inInset()); - if (it && (it != inset_owner)) { - it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont, - boundary); - } else { - setCursor(bview, cursor, par, pos, boundary); - if (setfont) - setCurrentFont(bview); + if (it) { + lyxerr << "InsetText is " << it << endl; + lyxerr << "inset_owner is " << inset_owner << endl; + if (it != inset_owner) { +#warning I belive this code is wrong. (Lgb) +#warning Jürgen, have a look at this. (Lgb) + // Jürgen, would you like to have a look? + // I guess we need to move the outer cursor + // and open and lock the inset (bla bla bla) + // stuff I don't know... so can you have a look? + // (Lgb) + it->getLyXText(bview)->setCursorIntern(bview, par, pos, setfont, + boundary); + return; + } } + + setCursor(bview, cursor, par, pos, boundary); + if (setfont) + setCurrentFont(bview); }