From 653eaace76a8d667375e12c5282cb85c3e903401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 29 Apr 2003 14:05:54 +0000 Subject: [PATCH] * paragraph.h: make operator= private unimplemented as long as it is unusable * ParagraphList.C: whitespace * paragraph.[Ch]: paragraph_pimpl.[Ch]: paragraph_funcs.C: CutAndPaste.C: undo_funcs.C: whitespace + Paragraph * -> Paragraph (const) & * text2.C: undo_funcs.[Ch]: Paragraph * -> ParagraphList::iterator git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6881 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 16 ++++++++++++---- src/mathed/math_parser.C | 2 +- src/paragraph.h | 3 +++ src/paragraph_funcs.C | 11 +++++++---- src/text2.C | 20 ++++++++++---------- src/undo_funcs.C | 19 ++++++++++--------- src/undo_funcs.h | 5 +++-- 7 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ae0036fe94..dcb0fc9b09 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,16 +1,24 @@ -2003-04-29 Alfredo Braunstein - * CutAndPaste.C (cutSelection): big rework, some bugs fixed - 2003-04-29 André Pönitz + * paragraph.h: make operator= private unimplemented as long as + it is unusable + * ParagraphList.C: whitespace * paragraph.[Ch]: paragraph_pimpl.[Ch]: paragraph_funcs.C: - undo_funcs.C: Paragraph * -> Paragraph (const) & + CutAndPaste.C: + undo_funcs.C: whitespace + Paragraph * -> Paragraph (const) & + * text2.C: + undo_funcs.[Ch]: Paragraph * -> ParagraphList::iterator + +2003-04-29 Alfredo Braunstein + + * CutAndPaste.C (cutSelection): big rework, some bugs fixed + 2003-04-28 John Levon * bufferlist.C: changes for unsaved changes dialog diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index b7601e448e..947655d85b 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -86,7 +86,7 @@ namespace { MathInset::mode_type asMode(MathInset::mode_type oldmode, string const & str) { - lyxerr << "handling mode: '" << str << "'\n"; + //lyxerr << "handling mode: '" << str << "'\n"; if (str == "mathmode") return MathInset::MATH_MODE; if (str == "textmode" || str == "forcetext") diff --git a/src/paragraph.h b/src/paragraph.h index 056a0bc1ba..248107ff6c 100644 --- a/src/paragraph.h +++ b/src/paragraph.h @@ -335,6 +335,9 @@ private: friend struct Paragraph::Pimpl; /// Pimpl * pimpl_; + + /// unimplemented + void operator=(Paragraph const &); }; diff --git a/src/paragraph_funcs.C b/src/paragraph_funcs.C index 1b15479f39..6b27301b8d 100644 --- a/src/paragraph_funcs.C +++ b/src/paragraph_funcs.C @@ -151,8 +151,8 @@ void breakParagraphConservative(BufferParams const & bparams, new Paragraph); tmp->makeSameLayout(*par); - // When can pos > Last()? - // I guess pos == Last() is possible. + // When can pos > size()? + // I guess pos == size() is possible. if (par->size() > pos) { // copy everything behind the break-position to the new // paragraph @@ -292,7 +292,8 @@ TeXDeeper(Buffer const * buf, lyxerr[Debug::LATEX] << "TeXDeeper... " << &*pit << endl; ParagraphList::iterator par = pit; - while (par != paragraphs.end()&& par->params().depth() == pit->params().depth()) { + while (par != paragraphs.end() && + par->params().depth() == pit->params().depth()) { if (par->layout()->isEnvironment()) { par = TeXEnvironment(buf, paragraphs, par, os, texrow); @@ -477,7 +478,9 @@ TeXOnePar(Buffer const * buf, } if (pit->params().lineTop()) { - os << "\\lyxline{\\" << pit->getFont(bparams, 0, outerFont(pit, paragraphs)).latexSize() << '}' + os << "\\lyxline{\\" + << pit->getFont(bparams, 0, outerFont(pit, paragraphs)).latexSize() + << '}' << "\\vspace{-1\\parskip}"; further_blank_line = true; } diff --git a/src/text2.C b/src/text2.C index 940b08820d..83bec0feda 100644 --- a/src/text2.C +++ b/src/text2.C @@ -389,7 +389,7 @@ LyXText::setLayout(LyXCursor & cur, LyXCursor & sstart_cur, ++endpit; } - setUndo(bv(), Undo::EDIT, &*sstart_cur.par(), &*undoendpit); + setUndo(bv(), Undo::EDIT, sstart_cur.par(), undoendpit); // ok we have a selection. This is always between sstart_cur // and sel_end cursor @@ -463,7 +463,7 @@ bool LyXText::changeDepth(bv_funcs::DEPTH_CHANGE type, bool test_only) ParagraphList::iterator pastend = boost::next(end); if (!test_only) - setUndo(bv(), Undo::EDIT, &(*start), &(*pastend)); + setUndo(bv(), Undo::EDIT, start, pastend); bool changed = false; @@ -566,7 +566,7 @@ void LyXText::setFont(LyXFont const & font, bool toggleall) // and sel_end cursor setUndo(bv(), Undo::EDIT, - &*selection.start.par(), &*boost::next(selection.end.par())); + selection.start.par(), boost::next(selection.end.par())); freezeUndo(); cursor = selection.start; while (cursor.par() != selection.end.par() || @@ -968,7 +968,7 @@ void LyXText::setParagraph(bool line_top, bool line_bottom, ++endpit; } - setUndo(bv(), Undo::EDIT, &*selection.start.par(), &*undoendpit); + setUndo(bv(), Undo::EDIT, selection.start.par(), undoendpit); ParagraphList::iterator tmppit = selection.end.par(); @@ -1255,8 +1255,8 @@ void LyXText::insertInset(Inset * inset) { if (!cursor.par()->insetAllowed(inset->lyxCode())) return; - setUndo(bv(), Undo::FINISH, &*cursor.par(), - &*boost::next(cursor.par())); + setUndo(bv(), Undo::FINISH, cursor.par(), + boost::next(cursor.par())); freezeUndo(); cursor.par()->insertInset(cursor.pos(), inset); // Just to rebreak and refresh correctly. @@ -1308,7 +1308,7 @@ void LyXText::cutSelection(bool doclear, bool realcut) ++endpit; } - setUndo(bv(), Undo::DELETE, &*selection.start.par(), &*undoendpit); + setUndo(bv(), Undo::DELETE, selection.start.par(), undoendpit); endpit = selection.end.par(); @@ -1381,7 +1381,7 @@ void LyXText::pasteSelection() return; setUndo(bv(), Undo::INSERT, - &*cursor.par(), &*boost::next(cursor.par())); + cursor.par(), boost::next(cursor.par())); Paragraph * endpar; ParagraphList::iterator actpit = cursor.par(); @@ -2236,7 +2236,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) ++endpit; } - setUndo(bv(), Undo::DELETE, &*old_cursor.par(), &*endpit); + setUndo(bv(), Undo::DELETE, old_cursor.par(), endpit); cursor = tmpcursor; // delete old row @@ -2267,7 +2267,7 @@ bool LyXText::deleteEmptyParagraphMechanism(LyXCursor const & old_cursor) ++endpit; } - setUndo(bv(), Undo::DELETE, &*old_cursor.par(), &*endpit); + setUndo(bv(), Undo::DELETE, old_cursor.par(), endpit); cursor = tmpcursor; // delete old row diff --git a/src/undo_funcs.C b/src/undo_funcs.C index e4cf78c5d4..4267e65b83 100644 --- a/src/undo_funcs.C +++ b/src/undo_funcs.C @@ -77,10 +77,8 @@ bool textHandleUndo(BufferView * bv, Undo & undo) { Buffer * b = bv->buffer(); - Paragraph * before = - &*b->getParFromID(undo.number_of_before_par); - Paragraph * behind = - &*b->getParFromID(undo.number_of_behind_par); + Paragraph * before = &*b->getParFromID(undo.number_of_before_par); + Paragraph * behind = &*b->getParFromID(undo.number_of_behind_par); Paragraph * tmppar; Paragraph * tmppar2; @@ -284,8 +282,11 @@ bool textHandleUndo(BufferView * bv, Undo & undo) bool createUndo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind, shared_ptr & u) + ParagraphList::iterator itfirst, ParagraphList::iterator itbehind, + shared_ptr & u) { + Paragraph * first = &*itfirst; + Paragraph * behind = &*itbehind; lyx::Assert(first); int before_number = -1; @@ -476,11 +477,11 @@ bool textRedo(BufferView * bv) void setUndo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind) + ParagraphList::iterator first, ParagraphList::iterator behind) { if (!undo_frozen) { shared_ptr u; - if (createUndo(bv, kind, first, behind, u)) + if (createUndo(bv, kind, &*first, &*behind, u)) bv->buffer()->undostack.push(u); bv->buffer()->redostack.clear(); } @@ -488,10 +489,10 @@ void setUndo(BufferView * bv, Undo::undo_kind kind, void setRedo(BufferView * bv, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind) + ParagraphList::iterator first, ParagraphList::iterator behind) { shared_ptr u; - if (createUndo(bv, kind, first, behind, u)) + if (createUndo(bv, kind, &*first, &*behind, u)) bv->buffer()->redostack.push(u); } diff --git a/src/undo_funcs.h b/src/undo_funcs.h index 4db09bd796..0633f64881 100644 --- a/src/undo_funcs.h +++ b/src/undo_funcs.h @@ -12,6 +12,7 @@ #define UNDO_FUNCS_H #include "undo.h" +#include "ParagraphList.h" class BufferView; class Paragraph; @@ -29,10 +30,10 @@ extern void freezeUndo(); extern void unFreezeUndo(); /// FIXME extern void setUndo(BufferView *, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind); + ParagraphList::iterator first, ParagraphList::iterator behind); /// FIXME extern void setRedo(BufferView *, Undo::undo_kind kind, - Paragraph const * first, Paragraph const * behind); + ParagraphList::iterator first, ParagraphList::iterator behind); /// FIXME extern void setCursorParUndo(BufferView *);