]> git.lyx.org Git - features.git/commitdiff
make init of the lyxtext explicit
authorLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 6 Jul 2001 15:41:17 +0000 (15:41 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Fri, 6 Jul 2001 15:41:17 +0000 (15:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2194 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView_pimpl.C
src/ChangeLog
src/lyxtext.h
src/text2.C

index 916ad1769e3f679a8252b9993e90ba86f2615d2b..e63c903df79f0b321b948aa4f22d9bffdb5c21b4 100644 (file)
@@ -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();
index faf8c2563da5d675864080b244cfe67d58c68fa0..5e5087f99095bf177ce15c65a55e9f9c979a9d88 100644 (file)
@@ -1,3 +1,12 @@
+2001-07-06  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * 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  <dekelts@tau.ac.il>
 
        * LaTeX.C (scanLogFile): Parse rerun messages from latex packages.
index 0b2b54525532ccc8eec1ce235488b122da5d752e..144e71ed15b99af3e6ed194bdfc32b1e46bc9488 100644 (file)
@@ -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 749911ab15b9c2df6485c8e483877f003046ee8c..4793569831eab6a7545e5bef7feb8a15b4c0f9c4 100644 (file)
@@ -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)
 {