Jürgen, I belive this would solve the init problem that you mentioned. I will commit this. ? build ? ny Index: src/BufferView_pimpl.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v retrieving revision 1.130 diff -u -p -r1.130 BufferView_pimpl.C --- src/BufferView_pimpl.C 2001/07/06 12:09:30 1.130 +++ src/BufferView_pimpl.C 2001/07/06 15:35:51 @@ -305,6 +305,7 @@ int BufferView::Pimpl::resizeCurrentBuff the_locking_inset = bv_->theLockingInset(); delete bv_->text; bv_->text = new LyXText(bv_); + bv_->text->init(bv_); } else { // See if we have a text in TextCache that fits // the new buffer_ with the correct width. @@ -320,6 +321,7 @@ int BufferView::Pimpl::resizeCurrentBuff textcache.show(lyxerr, "resizeCurrentBuffer"); } else { bv_->text = new LyXText(bv_); + bv_->text->init(bv_); } } updateScreen(); Index: src/lyxtext.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxtext.h,v retrieving revision 1.71 diff -u -p -r1.71 lyxtext.h --- src/lyxtext.h 2001/06/28 13:02:02 1.71 +++ src/lyxtext.h 2001/07/06 15:35:51 @@ -223,6 +223,9 @@ public: /** The structrue that keeps track of the selections set. */ struct Selection { + Selection() + : set_(false), mark_(false) + {} bool set() const { return set_; } @@ -511,8 +514,6 @@ public: (bidi_start <= pos && pos <= bidi_end); } private: - /// - void init(); /// mutable Row * firstrow; /// Index: src/text2.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/text2.C,v retrieving revision 1.137 diff -u -p -r1.137 text2.C --- src/text2.C 2001/07/03 15:39:16 1.137 +++ src/text2.C 2001/07/06 15:35:52 @@ -49,80 +49,23 @@ using std::pair; LyXText::LyXText(BufferView * bv) -{ - bv_owner = bv; - inset_owner = 0; - init(); -} + : number_of_rows(0), height(0), width(0), first(0), + bv_owner(bv), inset_owner(0), the_locking_inset(0), + need_break_row(0), refresh_y(0), status(LyXText::UNCHANGED), + undo_finished(true), undo_frozen(false), firstrow(0), lastrow(0), + copylayouttype(0) +{} LyXText::LyXText(InsetText * inset) -{ - inset_owner = inset; - bv_owner = 0; - init(); -} - - -void LyXText::init() -{ - the_locking_inset = 0; - firstrow = 0; - lastrow = 0; - number_of_rows = 0; - refresh_y = 0; - height = 0; - width = 0; - first = 0; - status = LyXText::UNCHANGED; - - // set cursor at the very top position - selection.set(true); /* these setting is necessary - because of the delete-empty- - paragraph mechanism in - SetCursor */ - if (bv_owner) { - Paragraph * par = ownerParagraph(); - current_font = getFont(bv_owner->buffer(), par, 0); - while (par) { - insertParagraph(bv_owner, par, lastrow); - par = par->next(); - } - setCursor(bv_owner, firstrow->par(), 0); - } else - current_font = LyXFont(LyXFont::ALL_SANE); - - selection.cursor = cursor; - selection.set(false); - selection.mark(false); - - // no rebreak necessary - need_break_row = 0; - - undo_finished = true; - undo_frozen = false; + : number_of_rows(0), height(0), width(0), first(0), + bv_owner(0), inset_owner(inset), the_locking_inset(0), + need_break_row(0), refresh_y(0), status(LyXText::UNCHANGED), + undo_finished(true), undo_frozen(false), firstrow(0), lastrow(0), + copylayouttype(0) +{} - // Default layouttype for copy environment type - copylayouttype = 0; -#if 0 - // Dump all rowinformation: - Row * tmprow = firstrow; - lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n"; - while (tmprow) { - lyxerr << tmprow->baseline() << '\t' - << tmprow->par << '\t' - << tmprow->pos() << '\t' - << tmprow->height << '\t' - << tmprow->ascent_of_text << '\t' - << tmprow->fill << '\n'; - tmprow = tmprow->next(); - } - lyxerr.flush(); -#endif -} - - void LyXText::init(BufferView * bview) { if (firstrow) @@ -136,25 +79,9 @@ void LyXText::init(BufferView * bview) } setCursorIntern(bview, firstrow->par(), 0); selection.cursor = cursor; -#if 0 - printf("TP = %x\n",inset_owner->owner()); - // Dump all rowinformation: - Row * tmprow = firstrow; - lyxerr << "Width = " << width << endl; - lyxerr << "Baseline Paragraph Pos Height Ascent Fill\n"; - while (tmprow) { - lyxerr << tmprow->baseline() << '\t' - << tmprow->par() << '\t' - << tmprow->pos() << '\t' - << tmprow->height() << '\t' - << tmprow->ascent_of_text() << '\t' - << tmprow->fill() << '\n'; - tmprow = tmprow->next(); - } - lyxerr.flush(); -#endif } + LyXText::~LyXText() { // Delete all rows, this does not touch the paragraphs! @@ -297,6 +224,7 @@ void LyXText::setCharFont(BufferView * b par->setFont(pos, font); } + void LyXText::setCharFont(Buffer const * buf, Paragraph * par, Paragraph::size_type pos, LyXFont const & fnt) -- Lgb