mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Added isInternal() method, mapped temporarily on check about ".internal" filename extension (minimum impact on current code).
Replaced various replica of such check with the invocation of the new method. TocBackend now does not call addToToc() for internal buffers. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31340 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
9673d23f08
commit
f3b3f62d5b
@ -312,7 +312,7 @@ Buffer::~Buffer()
|
||||
// GuiView already destroyed
|
||||
gui_ = 0;
|
||||
|
||||
if (d->unnamed && d->filename.extension() == "internal") {
|
||||
if (isInternal()) {
|
||||
// No need to do additional cleanups for internal buffer.
|
||||
delete d;
|
||||
return;
|
||||
@ -2040,6 +2040,17 @@ bool Buffer::isUnnamed() const
|
||||
}
|
||||
|
||||
|
||||
/// \note
|
||||
/// Don't check unnamed, here: isInternal() is used in
|
||||
/// newBuffer(), where the unnamed flag has not been set by anyone
|
||||
/// yet. Also, for an internal buffer, there should be no need for
|
||||
/// retrieving fileName() nor for checking if it is unnamed or not.
|
||||
bool Buffer::isInternal() const
|
||||
{
|
||||
return fileName().extension() == "internal";
|
||||
}
|
||||
|
||||
|
||||
// FIXME: this function should be moved to buffer_pimpl.C
|
||||
void Buffer::markDirty()
|
||||
{
|
||||
|
@ -262,9 +262,16 @@ public:
|
||||
///
|
||||
void setUnnamed(bool flag = true);
|
||||
|
||||
///
|
||||
/// Whether or not a filename has been assigned to this buffer
|
||||
bool isUnnamed() const;
|
||||
|
||||
/// Whether or not this buffer is internal.
|
||||
///
|
||||
/// An internal buffer does not contain a real document, but some auxiliary text segment.
|
||||
/// It is not associated with a filename, it is never saved, thus it does not need to be
|
||||
/// automatically saved, nor it needs to trigger any "do you want to save ?" question.
|
||||
bool isInternal() const;
|
||||
|
||||
/// Mark this buffer as dirty.
|
||||
void markDirty();
|
||||
|
||||
|
@ -119,7 +119,7 @@ Buffer * BufferList::newBuffer(string const & s, bool const ronly)
|
||||
}
|
||||
}
|
||||
tmpbuf->params().useClassDefaults();
|
||||
if (tmpbuf->fileName().extension() == "internal") {
|
||||
if (tmpbuf->isInternal()) {
|
||||
binternal.push_back(tmpbuf.get());
|
||||
} else {
|
||||
LYXERR(Debug::INFO, "Assigning to buffer " << bstore.size());
|
||||
|
@ -163,8 +163,10 @@ bool TocBackend::updateItem(DocIterator const & dit)
|
||||
void TocBackend::update()
|
||||
{
|
||||
tocs_.clear();
|
||||
DocIterator dit;
|
||||
buffer_->inset().addToToc(dit);
|
||||
if (! buffer_->isInternal()) {
|
||||
DocIterator dit;
|
||||
buffer_->inset().addToToc(dit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user