parlist cleanup

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6945 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-05-07 09:26:33 +00:00
parent 37c20c64c4
commit bb4f477fe3
12 changed files with 70 additions and 35 deletions

View File

@ -695,12 +695,12 @@ bool BufferView::lockInset(UpdatableInset * inset)
InsetList::iterator end = pit->insetlist.end();
for (; it != end; ++it) {
if (it.getInset() == inset) {
text->setCursorIntern(&*pit, it.getPos());
text->setCursorIntern(pit, it.getPos());
theLockingInset(inset);
return true;
}
if (it.getInset()->getInsetFromID(id)) {
text->setCursorIntern(&*pit, it.getPos());
text->setCursorIntern(pit, it.getPos());
it.getInset()->edit(this);
return theLockingInset()->lockInsetInInset(this, inset);
}
@ -808,7 +808,7 @@ bool BufferView::ChangeInsets(Inset::Code code,
if (it.size() == 1) {
text->setCursorIntern(par, 0);
text->redoParagraphs(text->cursor,
text->cursor.par()->next());
boost::next(text->cursor.par()));
text->fullRebreak();
}
}

View File

@ -899,7 +899,7 @@ void BufferView::Pimpl::trackChanges()
buf->undostack.clear();
} else {
update(BufferView::SELECT);
bv_->text->setCursor(&(*buf->paragraphs.begin()), 0);
bv_->text->setCursor(buf->paragraphs.begin(), 0);
#warning changes FIXME
//moveCursorUpdate(false);
@ -1229,7 +1229,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
case LFUN_ACCEPT_ALL_CHANGES: {
update(BufferView::SELECT);
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
bv_->text->setCursor(bv_->buffer()->paragraphs.begin(), 0);
#warning FIXME changes
//moveCursorUpdate(false);
@ -1242,7 +1242,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
case LFUN_REJECT_ALL_CHANGES: {
update(BufferView::SELECT);
bv_->text->setCursor(&(*bv_->buffer()->paragraphs.begin()), 0);
bv_->text->setCursor(bv_->buffer()->paragraphs.begin(), 0);
#warning FIXME changes
//moveCursorUpdate(false);

View File

@ -1,3 +1,20 @@
2003-05-07 Lars Gullik Bjønnes <larsbj@gullik.net>
* text2.C (changeDepth): parlist cleanup
(getColumnNearX): ditto
* rowpainter.C (getLabelFont): parlist cleanup
* bufferlist.C (newFile): parlist cleanup
* CutAndPaste.C (eraseSelection): parlist cleanup
* BufferView_pimpl.C (trackChanges): parlist cleanup
(dispatch): ditto
* BufferView.C (lockInset): parlist cleanup.
(ChangeInsets): ditto
2003-05-06 Lars Gullik Bjønnes <larsbj@gullik.net>
* CutAndPaste.h: Update file header.

View File

@ -140,7 +140,7 @@ PitPosPair CutAndPaste::eraseSelection(ParagraphList & pars,
#warning current_view used here.
// should we pass buffer or buffer->params around?
Buffer * buffer = current_view->buffer();
mergeParagraph(buffer->params, pars, &*startpit);
mergeParagraph(buffer->params, pars, startpit);
// this because endpar gets deleted here!
endpit = startpit;
endpos = startpos;

View File

@ -1037,7 +1037,7 @@ void Buffer::makeLaTeXFile(ostream & os,
texrow.reset();
// The starting paragraph of the coming rows is the
// first paragraph of the document. (Asger)
texrow.start(&*(paragraphs.begin()), 0);
texrow.start(&*paragraphs.begin(), 0);
if (!only_body && nice) {
os << "%% " << lyx_docversion << " created this file. "

View File

@ -485,11 +485,11 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
#endif
Alert::error(_("Could not read template"), text);
// no template, start with empty buffer
b->paragraphs.set(new Paragraph);
b->paragraphs.push_back(new Paragraph);
b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout());
}
} else { // start with empty buffer
b->paragraphs.set(new Paragraph);
b->paragraphs.push_back(new Paragraph);
b->paragraphs.begin()->layout(b->params.getLyXTextClass().defaultLayout());
}
@ -500,7 +500,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
b->setReadonly(false);
b->updateDocLang(b->params.language);
return b;
}

View File

@ -1,3 +1,7 @@
2003-05-07 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlDocument.C (saveAsDefault): parlist cleanup
2003-05-06 John Levon <levon@movementarian.org>
* ControlDocument.C: fix buggy boost format

View File

@ -202,7 +202,7 @@ void ControlDocument::saveAsDefault()
// add an empty paragraph. Is this enough?
Paragraph * par = new Paragraph;
par->layout(params().getLyXTextClass().defaultLayout());
defaults.paragraphs.set(par);
defaults.paragraphs.push_back(par);
defaults.writeFile(defaults.fileName());

View File

@ -1,3 +1,17 @@
2003-05-07 Lars Gullik Bjønnes <larsbj@gullik.net>
* insettext.C (InsetText): parlist cleanup
(clear): ditto
(edit): ditto
(insetUnlock): ditto
(lockInset): ditto
(lockInsetInInset): ditto
(cx): ditto
(cix): ditto
(getLyXText): ditto
(searchBackward): ditto
(collapseParagraphs): ditto
2003-05-06 John Levon <levon@movementarian.org>
* insetcaption.C: don't cast wrap inset to InsetFloat

View File

@ -136,7 +136,7 @@ InsetText::InsetText(BufferParams const & bp)
: UpdatableInset(), lt(0), in_update(false), do_resize(0),
do_reinit(false)
{
paragraphs.set(new Paragraph);
paragraphs.push_back(new Paragraph);
paragraphs.begin()->layout(bp.getLyXTextClass().defaultLayout());
if (bp.tracking_changes)
paragraphs.begin()->trackChanges();
@ -217,7 +217,7 @@ void InsetText::clear(bool just_mark_erased)
LyXLayout_ptr old_layout = paragraphs.begin()->layout();
paragraphs.clear();
paragraphs.set(new Paragraph);
paragraphs.push_back(new Paragraph);
paragraphs.begin()->setInsetOwner(this);
paragraphs.begin()->layout(old_layout);
@ -672,14 +672,14 @@ void InsetText::edit(BufferView * bv, bool front)
clear = true;
}
if (front)
lt->setCursor(&*(paragraphs.begin()), 0);
lt->setCursor(paragraphs.begin(), 0);
else {
ParagraphList::iterator it = paragraphs.begin();
ParagraphList::iterator end = paragraphs.end();
while (boost::next(it) != end)
++it;
// int const pos = (p->size() ? p->size()-1 : p->size());
lt->setCursor(&*it, it->size());
lt->setCursor(it, it->size());
}
lt->clearSelection();
finishUndo();
@ -727,9 +727,9 @@ void InsetText::insetUnlock(BufferView * bv)
bv->owner()->setLayout(bv->text->cursor.par()->layout()->name());
// hack for deleteEmptyParMech
if (!paragraphs.begin()->empty()) {
lt->setCursor(&*(paragraphs.begin()), 0);
lt->setCursor(paragraphs.begin(), 0);
} else if (boost::next(paragraphs.begin()) != paragraphs.end()) {
lt->setCursor(&*boost::next(paragraphs.begin()), 0);
lt->setCursor(boost::next(paragraphs.begin()), 0);
}
if (clear)
lt = 0;
@ -755,7 +755,7 @@ void InsetText::lockInset(BufferView * bv)
lt = getLyXText(bv);
clear = true;
}
lt->setCursor(&*(paragraphs.begin()), 0);
lt->setCursor(paragraphs.begin(), 0);
lt->clearSelection();
finishUndo();
// If the inset is empty set the language of the current font to the
@ -806,12 +806,12 @@ bool InsetText::lockInsetInInset(BufferView * bv, UpdatableInset * inset)
pit->insetlist.end();
for (; it != end; ++it) {
if (it.getInset() == inset) {
getLyXText(bv)->setCursorIntern(&*pit, it.getPos());
getLyXText(bv)->setCursorIntern(pit, it.getPos());
lockInset(bv, inset);
return true;
}
if (it.getInset()->getInsetFromID(id)) {
getLyXText(bv)->setCursorIntern(&*pit, it.getPos());
getLyXText(bv)->setCursorIntern(pit, it.getPos());
it.getInset()->edit(bv);
return the_locking_inset->lockInsetInInset(bv, inset);
}
@ -2070,7 +2070,7 @@ int InsetText::cx(BufferView * bv) const
LyXText * llt = getLyXText(bv);
int x = llt->cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
if (the_locking_inset) {
LyXFont font = llt->getFont(bv->buffer(), &*llt->cursor.par(),
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
llt->cursor.pos());
if (font.isVisibleRightToLeft())
x -= the_locking_inset->width(bv, font);
@ -2085,7 +2085,7 @@ int InsetText::cix(BufferView * bv) const
LyXText * llt = getLyXText(bv);
int x = llt->cursor.ix() + top_x + TEXT_TO_INSET_OFFSET;
if (the_locking_inset) {
LyXFont font = llt->getFont(bv->buffer(), &*llt->cursor.par(),
LyXFont font = llt->getFont(bv->buffer(), llt->cursor.par(),
llt->cursor.pos());
if (font.isVisibleRightToLeft())
x -= the_locking_inset->width(bv, font);
@ -2139,7 +2139,7 @@ LyXText * InsetText::getLyXText(BufferView const * lbv,
if (recursive && the_locking_inset)
return the_locking_inset->getLyXText(lbv, true);
LyXText * lt = cached_text.get();
lyx::Assert(lt && lt->rows().begin()->par() == &*(paragraphs.begin()));
lyx::Assert(lt && lt->rows().begin()->par() == paragraphs.begin());
return lt;
}
// Super UGLY! (Lgb)
@ -2591,7 +2591,7 @@ bool InsetText::searchBackward(BufferView * bv, string const & str,
while (boost::next(pit) != pend)
++pit;
lt->setCursor(&*pit, pit->size());
lt->setCursor(pit, pit->size());
}
lyxfind::SearchResult result =
lyxfind::LyXFind(bv, lt, str, false, cs, mw);
@ -2632,12 +2632,12 @@ void InsetText::collapseParagraphs(BufferView * bv)
}
if (llt->selection.set()) {
if (llt->selection.start.par() == boost::next(paragraphs.begin())) {
llt->selection.start.par(&*(paragraphs.begin()));
llt->selection.start.par(paragraphs.begin());
llt->selection.start.pos(
llt->selection.start.pos() + paragraphs.begin()->size());
}
if (llt->selection.end.par() == boost::next(paragraphs.begin())) {
llt->selection.end.par(&*(paragraphs.begin()));
llt->selection.end.par(paragraphs.begin());
llt->selection.end.pos(
llt->selection.end.pos() + paragraphs.begin()->size());
}

View File

@ -81,7 +81,7 @@ int RowPainter::singleWidth(lyx::pos_type pos, char c) const
LyXFont const RowPainter::getLabelFont() const
{
return text_.getLabelFont(bv_.buffer(), &*pit_);
return text_.getLabelFont(bv_.buffer(), pit_);
}

View File

@ -505,10 +505,10 @@ bool LyXText::changeDepth(bv_funcs::DEPTH_CHANGE type, bool test_only)
// Wow, redoParagraphs is stupid.
LyXCursor tmpcursor;
setCursor(tmpcursor, &(*start), 0);
setCursor(tmpcursor, start, 0);
//redoParagraphs(tmpcursor, &(*pastend));
redoParagraphs(tmpcursor, &(*pastend));
redoParagraphs(tmpcursor, pastend);
// We need to actually move the text->cursor. I don't
// understand why ...
@ -1395,11 +1395,11 @@ void LyXText::pasteSelection()
ParagraphList::iterator endpit;
PitPosPair ppp;
boost::tie(ppp, endpit) =
CutAndPaste::pasteSelection(ownerParagraphs(),
cursor.par(), cursor.pos(),
boost::tie(ppp, endpit) =
CutAndPaste::pasteSelection(ownerParagraphs(),
cursor.par(), cursor.pos(),
bv()->buffer()->params.textclass);
redoParagraphs(cursor, endpit);
setCursor(cursor.par(), cursor.pos());
@ -1872,7 +1872,7 @@ LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const
if (body_pos > 0 && c == body_pos - 1) {
tmpx += fill_label_hfill +
font_metrics::width(layout->labelsep,
getLabelFont(bv()->buffer(), &*rit_par));
getLabelFont(bv()->buffer(), rit_par));
if (rit_par->isLineSeparator(body_pos - 1))
tmpx -= singleWidth(rit_par, body_pos - 1);
}