mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
First step towards fixing some issues noted by Vincent. We record in the
Buffer whether we are exporting or not, rather than rely upon isClone(), which could be adapted to other purposes. And, of course, someone might choose locally to disable cloning.... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34999 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c12dea0182
commit
2f78698fbd
@ -289,6 +289,8 @@ public:
|
||||
/// If non zero, this buffer is a clone of existing buffer \p cloned_buffer_
|
||||
/// This one is useful for preview detached in a thread.
|
||||
Buffer const * cloned_buffer_;
|
||||
/// are we in the process of exporting this buffer?
|
||||
mutable bool doing_export;
|
||||
|
||||
private:
|
||||
/// So we can force access via the accessors.
|
||||
@ -322,7 +324,7 @@ Buffer::Impl::Impl(Buffer * owner, FileName const & file, bool readonly_,
|
||||
read_only(readonly_), filename(file), file_fully_loaded(false),
|
||||
toc_backend(owner), macro_lock(false), timestamp_(0),
|
||||
checksum_(0), wa_(0), gui_(0), undo_(*owner), bibinfo_cache_valid_(false),
|
||||
cloned_buffer_(cloned_buffer), parent_buffer(0)
|
||||
cloned_buffer_(cloned_buffer), doing_export(false), parent_buffer(0)
|
||||
{
|
||||
if (!cloned_buffer_) {
|
||||
temppath = createBufferTmpDir();
|
||||
@ -3260,10 +3262,41 @@ string Buffer::getDefaultOutputFormat() const
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
// helper class, to guarantee this gets reset properly
|
||||
class MarkAsExporting {
|
||||
public:
|
||||
MarkAsExporting(Buffer const * buf) : buf_(buf)
|
||||
{
|
||||
LASSERT(buf_, /* */);
|
||||
buf_->setExportStatus(true);
|
||||
}
|
||||
~MarkAsExporting()
|
||||
{
|
||||
buf_->setExportStatus(false);
|
||||
}
|
||||
private:
|
||||
Buffer const * const buf_;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void Buffer::setExportStatus(bool e) const
|
||||
{
|
||||
d->doing_export = e;
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::isExporting() const
|
||||
{
|
||||
return d->doing_export;
|
||||
}
|
||||
|
||||
|
||||
bool Buffer::doExport(string const & format, bool put_in_tempdir,
|
||||
bool includeall, string & result_file) const
|
||||
{
|
||||
MarkAsExporting exporting(this);
|
||||
string backend_format;
|
||||
OutputParams runparams(¶ms().encoding());
|
||||
runparams.flavor = OutputParams::LATEX;
|
||||
@ -3460,6 +3493,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
|
||||
|
||||
bool Buffer::preview(string const & format, bool includeall) const
|
||||
{
|
||||
MarkAsExporting exporting(this);
|
||||
string result_file;
|
||||
// (1) export with all included children (omit \includeonly)
|
||||
if (includeall && !doExport(format, true, true))
|
||||
|
@ -525,6 +525,10 @@ public:
|
||||
std::vector<Format const *> exportableFormats(bool only_viewable) const;
|
||||
///
|
||||
bool isExportableFormat(std::string const & format) const;
|
||||
/// mark the buffer as busy exporting something, or not
|
||||
void setExportStatus(bool e) const;
|
||||
///
|
||||
bool isExporting() const;
|
||||
|
||||
///
|
||||
typedef std::vector<std::pair<Inset *, ParIterator> > References;
|
||||
|
@ -588,7 +588,7 @@ void PreviewLoader::Impl::startLoading(bool wait)
|
||||
|
||||
// For XHTML image export, we need to control the background
|
||||
// color here.
|
||||
ColorCode bg = buffer_.isClone()
|
||||
ColorCode bg = buffer_.isExporting()
|
||||
? Color_white : PreviewLoader::backgroundColor();
|
||||
// The conversion command.
|
||||
ostringstream cs;
|
||||
|
Loading…
Reference in New Issue
Block a user