}
+InsetInclude::~InsetInclude()
+{
+ if (isVerbatim(params()) || isListings(params()))
+ return;
+
+
+ string const parent_filename = buffer().absFileName();
+ FileName const included_file = makeAbsPath(to_utf8(params()["filename"]),
+ onlyPath(parent_filename));
+
+ if (!isLyXFilename(included_file.absFilename()))
+ return;
+
+ Buffer * child = theBufferList().getBuffer(included_file.absFilename());
+ // File not opened, nothing to close.
+ if (!child)
+ return;
+
+ // Child document has a different parent, don't close it.
+ if (child->parent() != &buffer())
+ return;
+
+ //close the buffer.
+ theBufferList().release(child);
+}
+
+
ParamInfo const & InsetInclude::findInfo(string const & /* cmdName */)
{
// FIXME
}
-void resetParentBuffer(Buffer const * parent, InsetCommandParams const & params,
- bool close_it)
-{
- if (isVerbatim(params) || isListings(params))
- return;
-
- string const parent_filename = parent->absFileName();
- FileName const included_file = makeAbsPath(to_utf8(params["filename"]),
- onlyPath(parent_filename));
-
- if (!isLyXFilename(included_file.absFilename()))
- return;
-
- Buffer * child = theBufferList().getBuffer(included_file.absFilename());
- // File not opened, nothing to close.
- if (!child)
- return;
-
- // Child document has a different parent, don't close it.
- if (child->parent() != parent)
- return;
-
- //close the buffer.
- child->setParent(0);
- if (close_it)
- theBufferList().release(child);
- else
- updateLabels(*child);
-}
-
-
int InsetInclude::latex(odocstream & os, OutputParams const & runparams) const
{
string incfile = to_utf8(params()["filename"]);