/// we ran updateBuffer(), i.e., whether citation labels may need
/// to be updated.
mutable bool cite_labels_valid_;
+ /// these hold the file name and format, written to by Buffer::preview
+ /// and read from by LFUN_BUFFER_VIEW_CACHE.
+ FileName preview_file_;
+ string preview_format_;
mutable RefCache ref_cache_;
static FileName createBufferTmpDir()
{
// FIXME This would be the ideal application for a TempDir class (like
- // TempFile but for directories)
+ // TempFile but for directories)
string counter;
{
static int count;
cite_labels_valid_ = cloned_buffer_->d->cite_labels_valid_;
unnamed = cloned_buffer_->d->unnamed;
internal_buffer = cloned_buffer_->d->internal_buffer;
+ preview_file_ = cloned_buffer_->d->preview_file_;
+ preview_format_ = cloned_buffer_->d->preview_format_;
}
it.paragraph().setId(cloned_it.paragraph().id());
} else
d->inset = new InsetText(this);
- d->inset->setAutoBreakRows(true);
d->inset->getText(0)->setMacrocontextPosition(par_iterator_begin());
}
enable = !isReadonly();
break;
+ case LFUN_BUFFER_VIEW_CACHE:
+ enable = (d->preview_file_).exists();
+ break;
+
default:
return false;
}
break;
}
+ case LFUN_BUFFER_VIEW_CACHE:
+ if (!formats.view(*this, d->preview_file_,
+ d->preview_format_))
+ dr.setMessage(_("Error viewing the output file."));
+ break;
+
default:
dispatched = false;
break;
continue;
// register macro
- // FIXME (Abdel), I don't understandt why we pass 'it' here
+ // FIXME (Abdel), I don't understand why we pass 'it' here
// instead of 'macroTemplate' defined above... is this correct?
macros[macroTemplate.name()][it] =
Impl::ScopeMacro(scope, MacroData(const_cast<Buffer *>(owner_), it));
d->cloned_buffer_->d->errorLists[error_type] = d->errorLists[error_type];
}
- if (!success)
- return ExportConverterError;
if (put_in_tempdir) {
result_file = tmp_result_file.absFileName();
- return ExportSuccess;
+ return success ? ExportSuccess : ExportConverterError;
}
if (dest_filename.empty())
formats.prettyName(format)));
}
- return ExportSuccess;
+ return success ? ExportSuccess : ExportConverterError;
}
}
// (2) export with included children only
ExportStatus const status = doExport(format, true, false, result_file);
+ FileName const previewFile(result_file);
+
+ LATTEST (isClone());
+ d->cloned_buffer_->d->preview_file_ = previewFile;
+ d->cloned_buffer_->d->preview_format_ = format;
+
if (status != ExportSuccess)
return status;
- if (!formats.view(*this, FileName(result_file), format))
- return PreviewError;
- return PreviewSuccess;
+ if (previewFile.exists()) {
+ if (!formats.view(*this, previewFile, format))
+ return PreviewError;
+ else
+ return PreviewSuccess;
+ }
+ else {
+ // Successful export but no output file?
+ // Probably a bug in error detection.
+ LATTEST (status != ExportSuccess);
+
+ return status;
+ }
}
if (master != this) {
bufToUpdate.insert(this);
master->updateBuffer(UpdateMaster, utype);
- // If the master buffer has no gui associated with it, then the TocModel is
- // not updated during the updateBuffer call and TocModel::toc_ is invalid
- // (bug 5699). The same happens if the master buffer is open in a different
+ // If the master buffer has no gui associated with it, then the TocModel is
+ // not updated during the updateBuffer call and TocModel::toc_ is invalid
+ // (bug 5699). The same happens if the master buffer is open in a different
// window. This test catches both possibilities.
// See: http://marc.info/?l=lyx-devel&m=138590578911716&w=2
// There remains a problem here: If there is another child open in yet a third