* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
* \author Alfredo Braunstein
*
* Full author contact details are available in file CREDITS.
Buffer * checkAndLoadLyXFile(FileName const & filename)
{
// File already open?
- Buffer * checkBuffer = theBufferList().getBuffer(filename.absFilename());
+ Buffer * checkBuffer = theBufferList().getBuffer(filename);
if (checkBuffer) {
if (checkBuffer->isClean())
return checkBuffer;
{
static int newfile_number;
- string document_path = path.absFilename();
- string filename = addName(document_path,
+ FileName filename(path,
"newfile" + convert<string>(++newfile_number) + ".lyx");
while (theBufferList().exists(filename)
- || FileName(filename).isReadableFile()) {
+ || filename.isReadableFile()) {
++newfile_number;
- filename = addName(document_path,
+ filename.set(path,
"newfile" + convert<string>(newfile_number) + ".lyx");
}
- return newFile(filename, templatename, false);
+ return newFile(filename.absFilename(), templatename, false);
}
}
}
-
-// FIXME: buf should should be const because updateLabels() modifies
-// the contents of the paragraphs.
-void updateLabels(Buffer const & buf, bool childonly)
-{
- Buffer const * const master = buf.masterBuffer();
- // Use the master text class also for child documents
- DocumentClass const & textclass = master->params().documentClass();
-
- if (!childonly) {
- // If this is a child document start with the master
- if (master != &buf) {
- updateLabels(*master);
- return;
- }
-
- // start over the counters
- textclass.counters().reset();
- buf.clearReferenceCache();
- buf.updateMacros();
- }
-
- Buffer & cbuf = const_cast<Buffer &>(buf);
-
- if (buf.text().empty()) {
- // FIXME: we don't call continue with updateLabels()
- // here because it crashes on newly created documents.
- // But the TocBackend needs to be initialised
- // nonetheless so we update the tocBackend manually.
- cbuf.tocBackend().update();
- return;
- }
-
- // do the real work
- ParIterator parit = par_iterator_begin(buf.inset());
- updateLabels(buf, parit);
-
- cbuf.tocBackend().update();
- if (!childonly)
- cbuf.structureChanged();
-}
-
-
} // namespace lyx