texrowpar = text->firstParagraph();
tmppos = 0;
} else {
- texrowpar = text->getParFromID(tmpid);
+ texrowpar = buffer()->getParFromID(tmpid);
}
if (texrowpar == 0)
texrowpar = text->firstParagraph();
tmppos = 0;
} else {
- texrowpar = text->getParFromID(tmpid);
+ texrowpar = buffer()->getParFromID(tmpid);
}
text->setCursor(this, texrowpar, tmppos);
}
if (b != 0 ) buffer(b);
}
- Paragraph * par = bv_->text->getParFromID(saved_positions[i].par_id);
+ Paragraph * par = buffer_->getParFromID(saved_positions[i].par_id);
if (!par)
return;
+2001-07-09 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * text2.C (getParFromID): removed
+
+ * buffer.C (getParFromID): new method moved form lyxtext.
+ * BufferView2.C (insertErrors): adjust
+ (setCursorFromRow): adjust
+ * BufferView_pimpl.C (restorePosition): adjust
+ * lyxfunc.C (Dispatch): adjust
+ * undo_funcs.C (textUndo): adjust
+ (textRedo): adjust
+ (textHandleUndo): adjust
+ (textHandleUndo): adjust
+
2001-07-08 Lars Gullik Bjønnes <larsbj@birdstep.com>
* buffer.C: up' the LYX_FORMAT
}
return 0;
}
+
+
+Paragraph * Buffer::getParFromID(int id) const
+{
+ if (id < 0) return 0;
+ Paragraph * par = paragraph;
+ while (par) {
+ if (par->id() == id) {
+ return par;
+ }
+ Paragraph * tmp = par->getParFromID(id);
+ if (tmp) {
+ return tmp;
+ }
+ par = par->next();
+ }
+ return 0;
+}
void insertErtContents(Paragraph * par, int & pos,
LyXFont const & font,
bool set_inactive = true);
+ ///
+ Paragraph * getParFromID(int id) const;
private:
/// Parse a single inset.
void readInset(LyXLex &, Paragraph *& par, int & pos, LyXFont &);
return sx;
}
+
Paragraph * InsetCollapsable::getParFromID(int id) const
{
return inset.getParFromID(id);
}
+
Paragraph * InsetCollapsable::firstParagraph() const
{
return inset.firstParagraph();
}
+
LyXCursor const & InsetCollapsable::cursor(BufferView * bv) const
{
return inset.cursor(bv);
}
+
Inset * InsetCollapsable::getInsetFromID(int id_arg) const
{
if (id_arg == id())
Paragraph * InsetTabular::getParFromID(int id) const
{
Paragraph * result;
- for(int i=0; i < tabular->rows(); ++i) {
- for(int j=0; j < tabular->columns(); ++j) {
+ for(int i = 0; i < tabular->rows(); ++i) {
+ for(int j = 0; j < tabular->columns(); ++j) {
if ((result = tabular->GetCellInset(i, j)->getParFromID(id)))
return result;
}
need_update = FULL;
}
+
Paragraph * InsetText::getParFromID(int id) const
{
Paragraph * result = par;
return result;
}
+
Paragraph * InsetText::firstParagraph() const
{
Paragraph * result;
return par;
}
+
LyXCursor const & InsetText::cursor(BufferView * bv) const
{
if (the_locking_inset)
return getLyXText(bv)->cursor;
}
+
Paragraph * InsetText::paragraph() const
{
return par;
}
+
void InsetText::paragraph(Paragraph * p)
{
par = p;
need_update |= INIT;
}
+
Inset * InsetText::getInsetFromID(int id_arg) const
{
if (id_arg == id())
int id;
istr >> id;
- Paragraph * par = TEXT()->getParFromID(id);
+ Paragraph * par = owner->buffer()->getParFromID(id);
if (par == 0) {
lyxerr[Debug::INFO] << "No matching paragraph found! ["
<< id << "]" << std::endl;
///
int numberOfCell(Paragraph * par,
Paragraph::size_type pos) const;
- ///
- Paragraph * getParFromID(int id) const;
-
///
void removeTableRow(LyXCursor & cursor) const;
///
Paragraph * Paragraph::Pimpl::getParFromID(int id) const
{
+ InsetList::const_iterator cit = owner_->insetlist.begin();
InsetList::const_iterator lend = owner_->insetlist.end();
Paragraph * result;
- for (InsetList::const_iterator cit = owner_->insetlist.begin();
- cit != lend; ++cit)
- {
+ for (; cit != lend; ++cit) {
if ((result = cit->inset->getParFromID(id)))
return result;
}
}
-Paragraph * LyXText::getParFromID(int id) const
-{
- if (id < 0)
- return 0;
- Paragraph * result = firstParagraph();
- Paragraph * ires = 0;
- while (result && result->id() != id) {
- if ((ires = result->getParFromID(id)))
- return ires;
- result = result->next();
- }
- return result;
-}
-
void LyXText::toggleAppendix(BufferView * bview)
{
Paragraph * par = cursor.par();
Paragraph * LyXText::ownerParagraph(int id, Paragraph * p) const
{
- Paragraph * op = getParFromID(id);
+ Paragraph * op = bv_owner->buffer()->getParFromID(id);
if (op && op->InInset()) {
static_cast<InsetText *>(op->InInset())->paragraph(p);
} else {
if (undo) {
finishUndo();
if (!undo_frozen) {
- Paragraph * first = bv->text->getParFromID(undo->number_of_before_par);
+ Paragraph * first = bv->buffer()->getParFromID(undo->number_of_before_par);
if (!first)
first = firstUndoParagraph(bv, undo->number_of_inset_id);
if (first) {
bv->buffer()->redostack.push(
createUndo(bv, undo->kind, first,
- bv->text->getParFromID(undo->number_of_behind_par)));
+ bv->buffer()->getParFromID(undo->number_of_behind_par)));
}
}
}
if (undo) {
finishUndo();
if (!undo_frozen) {
- Paragraph * first = bv->text->getParFromID(undo->number_of_before_par);
+ Paragraph * first = bv->buffer()->getParFromID(undo->number_of_before_par);
if (!first)
first = firstUndoParagraph(bv, undo->number_of_inset_id);
if (first) {
bv->buffer()->undostack.push(
createUndo(bv, undo->kind, first,
- bv->text->getParFromID(undo->number_of_behind_par)));
+ bv->buffer()->getParFromID(undo->number_of_behind_par)));
}
}
}
bool result = false;
if (undo) {
Paragraph * before =
- bv->text->getParFromID(undo->number_of_before_par);
+ bv->buffer()->getParFromID(undo->number_of_before_par);
Paragraph * behind =
- bv->text->getParFromID(undo->number_of_behind_par);
+ bv->buffer()->getParFromID(undo->number_of_behind_par);
Paragraph * tmppar;
Paragraph * tmppar2;
Paragraph * endpar;
} else
endpar = behind;
- tmppar = bv->text->getParFromID(undo->number_of_cursor_par);
+ tmppar = bv->buffer()->getParFromID(undo->number_of_cursor_par);
UpdatableInset* it = static_cast<UpdatableInset*>(tmppar3->InInset());
if (it) {
it->getLyXText(bv)->redoParagraphs(bv, it->getLyXText(bv)->cursor,