Buffer ctor: Use preferred InsetText ctor.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25972 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-07-29 11:35:13 +00:00
parent e46613d70b
commit c95f99255f

View File

@ -133,6 +133,7 @@ public:
wa_->closeAll(); wa_->closeAll();
delete wa_; delete wa_;
} }
delete inset;
} }
BufferParams params; BufferParams params;
@ -218,7 +219,7 @@ public:
mutable RefCache ref_cache_; mutable RefCache ref_cache_;
/// our Text that should be wrapped in an InsetText /// our Text that should be wrapped in an InsetText
InsetText inset; InsetText * inset;
}; };
@ -259,10 +260,9 @@ Buffer::Buffer(string const & file, bool readonly)
{ {
LYXERR(Debug::INFO, "Buffer::Buffer()"); LYXERR(Debug::INFO, "Buffer::Buffer()");
d->inset.setBuffer(*this); d->inset = new InsetText(*this);
d->inset.initParagraphs(*this); d->inset->setAutoBreakRows(true);
d->inset.setAutoBreakRows(true); d->inset->getText(0)->setMacrocontextPosition(par_iterator_begin());
d->inset.getText(0)->setMacrocontextPosition(par_iterator_begin());
} }
@ -315,13 +315,13 @@ frontend::WorkAreaManager & Buffer::workAreaManager() const
Text & Buffer::text() const Text & Buffer::text() const
{ {
return const_cast<Text &>(d->inset.text_); return d->inset->text_;
} }
Inset & Buffer::inset() const Inset & Buffer::inset() const
{ {
return const_cast<InsetText &>(d->inset); return *d->inset;
} }
@ -578,7 +578,7 @@ bool Buffer::readDocument(Lexer & lex)
} }
// read main text // read main text
bool const res = text().read(*this, lex, errorList, &(d->inset)); bool const res = text().read(*this, lex, errorList, d->inset);
updateMacros(); updateMacros();
updateMacroInstances(); updateMacroInstances();