From 33c5d408fae53babcf6a37b78fdbf953e76f862f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lars=20Gullik=20Bj=C3=B8nnes?= Date: Sun, 13 Jan 2002 00:33:21 +0000 Subject: [PATCH] small stupid stuff git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3348 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView2.C | 4 ++-- src/BufferView_pimpl.C | 4 ++-- src/ChangeLog | 10 ++++++++++ src/buffer.C | 27 ++++++++++++++++----------- src/lyxtext.h | 2 -- src/text2.C | 15 ++++----------- src/undo_funcs.C | 6 ++++++ 7 files changed, 40 insertions(+), 28 deletions(-) diff --git a/src/BufferView2.C b/src/BufferView2.C index bbfa04cadf..5ed89afe18 100644 --- a/src/BufferView2.C +++ b/src/BufferView2.C @@ -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); diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 1efca6de2f..220390374e 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -3465,9 +3465,9 @@ void BufferView::Pimpl::gotoInset(vector 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; diff --git a/src/ChangeLog b/src/ChangeLog index 0ecf8a48e1..8e97bb3d4e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2002-01-13 Lars Gullik Bjønnes + + * 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 * BufferView2.C (removeAutoInsets): ensure we have a valid cursor if diff --git a/src/buffer.C b/src/buffer.C index 873d135c90..a24213ad5d 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -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 diff --git a/src/lyxtext.h b/src/lyxtext.h index f80c84b7d0..b7da0fe71e 100644 --- a/src/lyxtext.h +++ b/src/lyxtext.h @@ -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 at cursor position void breakParagraph(BufferView *, char keep_layout = 0); diff --git a/src/text2.C b/src/text2.C index ce0fe04a3a..0c030a5cbd 100644 --- a/src/text2.C +++ b/src/text2.C @@ -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); } diff --git a/src/undo_funcs.C b/src/undo_funcs.C index 68b6576053..e0b0e42117 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -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); -- 2.39.2