From: Lars Gullik Bjønnes Date: Fri, 6 Jul 2001 15:41:17 +0000 (+0000) Subject: make init of the lyxtext explicit X-Git-Tag: 1.6.10~21126 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=217e8059aeae5d0c7b830844f4ec12bb15cedf01;p=features.git make init of the lyxtext explicit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2194 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 916ad1769e..e63c903df7 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -305,6 +305,7 @@ int BufferView::Pimpl::resizeCurrentBuffer() 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::resizeCurrentBuffer() textcache.show(lyxerr, "resizeCurrentBuffer"); } else { bv_->text = new LyXText(bv_); + bv_->text->init(bv_); } } updateScreen(); diff --git a/src/ChangeLog b/src/ChangeLog index faf8c2563d..5e5087f990 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2001-07-06 Lars Gullik Bjønnes + + * BufferView_pimpl.C (resizeCurrentBuffer): init the new LyXText + + * text2.C (LyXText): use initialization lists. + + * lyxtext.h (Selection): initialize set_ and mark_ + (init): remove method + 2001-07-05 Dekel Tsur * LaTeX.C (scanLogFile): Parse rerun messages from latex packages. diff --git a/src/lyxtext.h b/src/lyxtext.h index 0b2b545255..144e71ed15 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -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; /// diff --git a/src/text2.C b/src/text2.C index 749911ab15..4793569831 100644 --- a/src/text2.C +++ b/src/text2.C @@ -49,78 +49,21 @@ 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; - - // 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 -} + : 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) +{} void LyXText::init(BufferView * bview) @@ -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! @@ -298,6 +225,7 @@ void LyXText::setCharFont(BufferView * bv, Paragraph * par, par->setFont(pos, font); } + void LyXText::setCharFont(Buffer const * buf, Paragraph * par, Paragraph::size_type pos, LyXFont const & fnt) {