break;
case LFUN_MOUSE_RELEASE:
- if (!cur.selection())
+ if (!cur.selection())
InsetIncludeMailer(*this).showDialog(&cur.bv());
break;
}
-bool isInputOrInclude(InsetCommandParams const & params)
+bool isInputOrInclude(InsetCommandParams const & params)
{
Types const t = type(params);
return (t == INPUT) || (t == INCLUDE);
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
- "Read: `$$Token'");
+ "Read: `$$Token'");
}
}
return 0;
Buffer * childBuffer = theBufferList().getBuffer(included_file);
-
+
//FIXME RECURSIVE INCLUDES
if (childBuffer == & buffer)
return 0;
int InsetInclude::latex(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile(to_utf8(params_["filename"]));
return 0;
FileName const included_file(includedFilename(buffer, params_));
-
+
//Check we're not trying to include ourselves.
//FIXME RECURSIVE INCLUDE
//This isn't sufficient, as the inclusion could be downstream.
//But it'll have to do for now.
if (isInputOrInclude(params_) &&
- buffer.fileName() == included_file.toFilesystemEncoding())
+ buffer.fileName() == included_file.absFilename())
{
- Alert::error(_("Recursive input"),
- bformat(_("Attempted to include file %1$s in itself! "
- "Ignoring inclusion."), from_utf8(incfile)));
+ Alert::error(_("Recursive input"),
+ bformat(_("Attempted to include file %1$s in itself! "
+ "Ignoring inclusion."), from_utf8(incfile)));
return 0;
}
if (!absolutePath(incfile)) {
// FIXME UNICODE
incfile = to_utf8(makeRelPath(from_utf8(included_file.absFilename()),
- from_utf8(m_buffer->filePath())));
+ from_utf8(m_buffer->filePath())));
}
// write it to a file (so far the complete file)
string const exportfile = changeExtension(incfile, ".tex");
- string const mangled =
+ string const mangled =
DocFileName(changeExtension(included_file.absFilename(),".tex")).
mangledFilename();
FileName const writefile(makeAbsPath(mangled, m_buffer->temppath()));
LYXERR(Debug::LATEX) << "exportfile:" << exportfile << endl;
LYXERR(Debug::LATEX) << "writefile:" << writefile << endl;
- if (runparams.inComment || runparams.dryrun)
- // Don't try to load or copy the file
- ;
- //if it's a LyX file and we're including or inputting it...
- else if (isInputOrInclude(params_) &&
- isLyXFilename(included_file.absFilename())) {
+ if (runparams.inComment || runparams.dryrun) {
+ //Don't try to load or copy the file if we're
+ //in a comment or doing a dryrun
+ } else if (isInputOrInclude(params_) &&
+ isLyXFilename(included_file.absFilename())) {
+ //if it's a LyX file and we're inputting or including,
//try to load it so we can write the associated latex
if (!loadIfNeeded(buffer, params_))
return false;
-
+
Buffer * tmp = theBufferList().getBuffer(included_file.absFilename());
if (tmp->params().textclass != m_buffer->params().textclass) {
runparams, false);
runparams.encoding = oldEnc;
} else {
- // Copy the file to the temp dir, so that .aux files etc.
- // are not created in the original dir. Files included by
- // this file will be found via input@path, see ../Buffer.cpp.
+ // In this case, it's not a LyX file, so we copy the file
+ // to the temp dir, so that .aux files etc. are not created
+ // in the original dir. Files included by this file will be
+ // found via input@path, see ../Buffer.cpp.
unsigned long const checksum_in = sum(included_file);
unsigned long const checksum_out = sum(writefile);
int InsetInclude::plaintext(Buffer const & buffer, odocstream & os,
- OutputParams const &) const
+ OutputParams const &) const
{
if (isVerbatim(params_) || isListings(params_)) {
os << '[' << getScreenLabel(buffer) << '\n';
int InsetInclude::docbook(Buffer const & buffer, odocstream & os,
- OutputParams const & runparams) const
+ OutputParams const & runparams) const
{
string incfile = to_utf8(params_["filename"]);
//This isn't sufficient, as the inclusion could be downstream.
//But it'll have to do for now.
if (buffer.fileName() == included_file) {
- Alert::error(_("Recursive input"),
- bformat(_("Attempted to include file %1$s in itself! "
- "Ignoring inclusion."), from_utf8(incfile)));
+ Alert::error(_("Recursive input"),
+ bformat(_("Attempted to include file %1$s in itself! "
+ "Ignoring inclusion."), from_utf8(incfile)));
return 0;
}
<< '&' << include_label << ';'
<< "\" format=\"linespecific\">";
} else
- os << '&' << include_label << ';';
+ os << '&' << include_label << ';';
return 0;
}