X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferList.cpp;h=a5c4b42f0365502a0f1824fc4df2a555bf37d26c;hb=4d5bef1bdcbe7a20d67613a793acb89f0e583bf6;hp=e19c8aa63d3f86523e7da5f4609fef018c28cb82;hpb=d703d9057432ebce6f7cd73cbe6c0e71b241c0f1;p=lyx.git diff --git a/src/BufferList.cpp b/src/BufferList.cpp index e19c8aa63d..a5c4b42f03 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -104,11 +104,33 @@ void BufferList::release(Buffer * buf) } -Buffer * BufferList::newBuffer(string const & s, bool const ronly) +Buffer * BufferList::newInternalBuffer(string const & s) +{ + Buffer * const buf = createNewBuffer(s); + if (buf) { + buf->setInternal(true); + binternal.push_back(buf); + } + return buf; +} + + +Buffer * BufferList::newBuffer(string const & s) +{ + Buffer * const buf = createNewBuffer(s); + if (buf) { + LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size()); + bstore.push_back(buf); + } + return buf; +} + + +Buffer * BufferList::createNewBuffer(string const & s) { auto_ptr tmpbuf; try { - tmpbuf.reset(new Buffer(s, ronly)); + tmpbuf.reset(new Buffer(s)); } catch (ExceptionMessage const & message) { if (message.type_ == ErrorException) { Alert::error(message.title_, message.details_); @@ -119,12 +141,6 @@ Buffer * BufferList::newBuffer(string const & s, bool const ronly) } } tmpbuf->params().useClassDefaults(); - if (tmpbuf->isInternal()) { - binternal.push_back(tmpbuf.get()); - } else { - LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size()); - bstore.push_back(tmpbuf.get()); - } return tmpbuf.release(); } @@ -180,8 +196,8 @@ Buffer * BufferList::next(Buffer const * buf) const if (bstore.empty()) return 0; - BufferStorage::const_iterator it = find(bstore.begin(), - bstore.end(), buf); + BufferStorage::const_iterator it = + find(bstore.begin(), bstore.end(), buf); LASSERT(it != bstore.end(), /**/); ++it; Buffer * nextbuf = (it == bstore.end()) ? bstore.front() : *it; @@ -195,8 +211,8 @@ Buffer * BufferList::previous(Buffer const * buf) const if (bstore.empty()) return 0; - BufferStorage::const_iterator it = find(bstore.begin(), - bstore.end(), buf); + BufferStorage::const_iterator it = + find(bstore.begin(), bstore.end(), buf); LASSERT(it != bstore.end(), /**/); Buffer * previousbuf = (it == bstore.begin()) ? bstore.back() : *(it - 1); @@ -213,7 +229,7 @@ void BufferList::updateIncludedTeXfiles(string const & masterTmpDir, if (!(*it)->isDepClean(masterTmpDir)) { string writefile = addName(masterTmpDir, (*it)->latexName()); (*it)->makeLaTeXFile(FileName(writefile), masterTmpDir, - runparams, false); + runparams, Buffer::OnlyBody); (*it)->markDepClean(masterTmpDir); } }