]> git.lyx.org Git - lyx.git/commitdiff
small stupid stuff
authorLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 13 Jan 2002 00:33:21 +0000 (00:33 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Sun, 13 Jan 2002 00:33:21 +0000 (00:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3348 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView2.C
src/BufferView_pimpl.C
src/ChangeLog
src/buffer.C
src/lyxtext.h
src/text2.C
src/undo_funcs.C

index bbfa04cadfa3967063f27626f7d1f39f6653f66e..5ed89afe1885cc78d825500005bc7a780c98f788 100644 (file)
@@ -235,7 +235,7 @@ void BufferView::insertErrors(TeXErrors & terr)
                Paragraph * texrowpar = 0;
 
                if (tmpid == -1) {
-                       texrowpar = text->firstParagraph();
+                       texrowpar = text->ownerParagraph();
                        tmppos = 0;
                } else {
                        texrowpar = buffer()->getParFromID(tmpid);
@@ -264,7 +264,7 @@ void BufferView::setCursorFromRow(int row)
        Paragraph * texrowpar;
 
        if (tmpid == -1) {
-               texrowpar = text->firstParagraph();
+               texrowpar = text->ownerParagraph();
                tmppos = 0;
        } else {
                texrowpar = buffer()->getParFromID(tmpid);
index 1efca6de2f60ea1bf17e1c460137c80d3a86da9d..220390374e5b8989bf4b948f6a9abfefda0a3c84 100644 (file)
@@ -3465,9 +3465,9 @@ void BufferView::Pimpl::gotoInset(vector<Inset::Code> const & codes,
  
        if (!bv_->text->gotoNextInset(bv_, codes, contents)) {
                if (bv_->text->cursor.pos() 
-                   || bv_->text->cursor.par() != bv_->text->firstParagraph()) {
+                   || bv_->text->cursor.par() != bv_->text->ownerParagraph()) {
                        LyXCursor tmp = bv_->text->cursor;
-                       bv_->text->cursor.par(bv_->text->firstParagraph());
+                       bv_->text->cursor.par(bv_->text->ownerParagraph());
                        bv_->text->cursor.pos(0);
                        if (!bv_->text->gotoNextInset(bv_, codes, contents)) {
                                bv_->text->cursor = tmp;
index 0ecf8a48e1ae61e9920a1d8394b263f9c382fab0..8e97bb3d4e06c88b1a9b7163b13ad912b3dbfb9f 100644 (file)
@@ -1,3 +1,13 @@
+2002-01-13  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * text2.C (firstParagraph): removed member function, all uses
+       replaces with ownerParagraph
+       (redoParagraphs): here
+       (updateInset): here
+       (toggleAppendix): here
+       * BufferView2.C (insertErrors): here
+       (setCursorFromRow): here
+
 2002-01-13  Allan Rae  <rae@lyx.org>
 
        * BufferView2.C (removeAutoInsets): ensure we have a valid cursor if
index 873d135c900642536a6e699f190ab2c129fbb490..a24213ad5da08f91777fd8b891d21232ca1cd2f0 100644 (file)
@@ -148,21 +148,26 @@ extern int tex_code_break_column;
 
 
 Buffer::Buffer(string const & file, bool ronly)
+       : paragraph(0), lyx_clean(true), bak_clean(true),
+         unnamed(false), dep_clean(0), read_only(ronly),
+         filename(file), users(0)
 {
        lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
-       filename = file;
+//     filename = file;
        filepath = OnlyPath(file);
-       paragraph = 0;
-       lyx_clean = true;
-       bak_clean = true;
-       dep_clean = 0;
-       read_only = ronly;
-       unnamed = false;
-       users = 0;
+//     paragraph = 0;
+//     lyx_clean = true;
+//     bak_clean = true;
+//     dep_clean = 0;
+//     read_only = ronly;
+//     unnamed = false;
+//     users = 0;
        lyxvc.buffer(this);
-       if (read_only || (lyxrc.use_tempdir)) {
+       if (read_only || lyxrc.use_tempdir) {
                tmppath = CreateBufferTmpDir();
-       } else tmppath.erase();
+       } else {
+               tmppath.erase();
+       }
 }
 
 
@@ -332,7 +337,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
        } else {
                // We are inserting into an existing document
                users->text->breakParagraph(users);
-               first_par = users->text->firstParagraph();
+               first_par = users->text->ownerParagraph();
                pos = 0;
                markDirty();
                // We don't want to adopt the parameters from the
index f80c84b7d0698c610154413e0fb296fda12f8dee..b7da0fe71e2e798fddf1fccea0b1631df88db0aa 100644 (file)
@@ -107,8 +107,6 @@ public:
                         lyx::pos_type pos, LyXFont const & font);
        void setCharFont(BufferView *, Paragraph * par,
                         lyx::pos_type pos, LyXFont const & font, bool toggleall);
-       /// returns a pointer to the very first Paragraph
-       Paragraph * firstParagraph() const;
   
        /// what you expect when pressing <enter> at cursor position
        void breakParagraph(BufferView *, char keep_layout = 0);
index ce0fe04a3a8be7e5e5bd61a848d460db7a7653a1..0c030a5cbd1100aa38fd92c8858b42b4cebde228 100644 (file)
@@ -863,9 +863,9 @@ void LyXText::redoParagraphs(BufferView * bview, LyXCursor const & cur,
        if (!tmprow->previous()) {
                // a trick/hack for UNDO
                // This is needed because in an UNDO/REDO we could have changed
-               // the firstParagrah() so the paragraph inside the row is NOT
+               // the ownerParagrah() so the paragraph inside the row is NOT
                // my really first par anymore. Got it Lars ;) (Jug 20011206)
-               first_phys_par = firstParagraph();
+               first_phys_par = ownerParagraph();
        } else {
                first_phys_par = tmprow->par();
                while (tmprow->previous()
@@ -1852,13 +1852,6 @@ void LyXText::pasteSelection(BufferView * bview)
 }
 
 
-// returns a pointer to the very first Paragraph
-Paragraph * LyXText::firstParagraph() const
-{
-       return ownerParagraph();
-}
-
-
 // sets the selection over the number of characters of string, no check!!
 void LyXText::setSelectionOverString(BufferView * bview, string const & str)
 {
@@ -2076,7 +2069,7 @@ bool LyXText::updateInset(BufferView * bview, Inset * inset)
   
        // check every paragraph
   
-       Paragraph * par = firstParagraph();
+       Paragraph * par = ownerParagraph();
        do {
                pos = par->getPositionOfInset(inset);
                if (pos != -1) {
@@ -2564,7 +2557,7 @@ void LyXText::toggleAppendix(BufferView * bview)
        bool start = !par->params().startOfAppendix();
 
        // ensure that we have only one start_of_appendix in this document
-       Paragraph * tmp = firstParagraph();
+       Paragraph * tmp = ownerParagraph();
        for (; tmp; tmp = tmp->next()) {
                tmp->params().startOfAppendix(false);
        }
index 68b6576053d2efb2883bd13281847785af87f2ea..e0b0e42117d517414b6e2151597628b46efd689d 100644 (file)
@@ -388,13 +388,19 @@ Undo * createUndo(BufferView * bv, Undo::undo_kind kind,
   
                while (tmppar != end && tmppar->next()) {
                        tmppar = tmppar->next();
+#if 0
                        tmppar2->next(new Paragraph(*tmppar, true));
+#else
+                       Paragraph * ptmp = new Paragraph(*tmppar, true);
+                       tmppar2->next(ptmp);
+#endif
                        // a memory optimization: Just store the layout
                        // information when only edit
                        if (kind == Undo::EDIT) {
                                tmppar2->clearContents();
                        }
                        tmppar2->next()->previous(tmppar2);
+                       
                        tmppar2 = tmppar2->next();
                }
                tmppar2->next(0);