Fix most of bug 5539.

If a file fails to load, we do not try to load it again. The downside is that, even if you fixed the problem, then LyX won't try to load it again in that session. I tried resetting the failedtoload_ variable in fileChanged(), but that didn't work, as it doesn't seem to get hit. I'm not sure what to do here, but it isn't a huge issue.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27688 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-11-24 12:45:18 +00:00
parent aeb997e3f0
commit 39bc3f3f93
2 changed files with 10 additions and 2 deletions

View File

@ -160,7 +160,8 @@ InsetLabel * createLabel(docstring const & label_str)
InsetInclude::InsetInclude(InsetCommandParams const & p)
: InsetCommand(p, "include"), include_label(uniqueID()),
preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
set_label_(false), label_(0)
{
preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
@ -173,7 +174,8 @@ InsetInclude::InsetInclude(InsetCommandParams const & p)
InsetInclude::InsetInclude(InsetInclude const & other)
: InsetCommand(other), include_label(other.include_label),
preview_(new RenderMonitoredPreview(this)), set_label_(false), label_(0)
preview_(new RenderMonitoredPreview(this)), failedtoload_(false),
set_label_(false), label_(0)
{
preview_->fileChanged(boost::bind(&InsetInclude::fileChanged, this));
@ -371,6 +373,9 @@ Buffer * InsetInclude::getChildBuffer(Buffer const & buffer) const
Buffer * InsetInclude::loadIfNeeded(Buffer const & parent) const
{
InsetCommandParams const & p = params();
if (failedtoload_)
return 0;
if (isVerbatim(p) || isListings(p))
return 0;
@ -393,6 +398,7 @@ Buffer * InsetInclude::loadIfNeeded(Buffer const & parent) const
return 0;
if (!child->loadLyXFile(included_file)) {
failedtoload_ = true;
//close the buffer we just opened
theBufferList().release(child);
return 0;

View File

@ -125,6 +125,8 @@ private:
/// The pointer never changes although *preview_'s contents may.
boost::scoped_ptr<RenderMonitoredPreview> const preview_;
///
mutable bool failedtoload_;
/// cache
mutable bool set_label_;
mutable RenderButton button_;