#include "InsetInclude.h"
-#include "LayoutFile.h"
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferList.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LaTeXFeatures.h"
+#include "LayoutFile.h"
#include "LyX.h"
#include "LyXFunc.h"
#include "LyXRC.h"
#include "insets/InsetListingsParams.h"
#include "insets/RenderPreview.h"
-#include "support/assert.h"
+#include "support/convert.h"
#include "support/debug.h"
#include "support/docstream.h"
#include "support/FileNameList.h"
#include "support/filetools.h"
#include "support/gettext.h"
+#include "support/lassert.h"
#include "support/lstrings.h" // contains
#include "support/lyxalgo.h"
-#include "support/convert.h"
#include <boost/bind.hpp>
InsetInclude::~InsetInclude()
{
delete label_;
- 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);
}
switch (cmd.action) {
case LFUN_INSET_EDIT:
- flag.enabled(true);
+ case LFUN_INSET_MODIFY:
+ flag.setEnabled(true);
return true;
default:
}
-void InsetInclude::addToToc(ParConstIterator const & cpit) const
+void InsetInclude::addToToc(DocIterator const & cpit)
{
TocBackend & backend = buffer().tocBackend();
Toc & toc = backend.toc("listing");
docstring str = convert<docstring>(toc.size() + 1)
+ ". " + from_utf8(caption);
- ParConstIterator pit = cpit;
- pit.push_back(*this);
+ DocIterator pit = cpit;
toc.push_back(TocItem(pit, 0, str));
return;
}
toc.push_back(TocItem(cpit, 0, str));
TocList & toclist = backend.tocs();
+ childbuffer->tocBackend().update();
TocList const & childtoclist = childbuffer->tocBackend().tocs();
TocList::const_iterator it = childtoclist.begin();
TocList::const_iterator const end = childtoclist.end();
InsetListingsParams const par(to_utf8(params()["lstparams"]));
if (par.getParamValue("caption").empty()) {
- listings_label_.clear();
+ listings_label_ = buffer().B_("Program Listing");
return;
}
- Counters & counters = buffer().params().documentClass().counters();
+ Buffer const & master = *buffer().masterBuffer();
+ Counters & counters = master.params().documentClass().counters();
docstring const cnt = from_ascii("listing");
- listings_label_ = buffer().B_("Program Listing");
+ listings_label_ = master.B_("Program Listing");
if (counters.hasCounter(cnt)) {
counters.step(cnt);
listings_label_ += " " + convert<docstring>(counters.value(cnt));