#include "cursor.h"
#include "debug.h"
#include "dispatchresult.h"
+#include "exporter.h"
#include "funcrequest.h"
#include "gettext.h"
#include "LaTeXFeatures.h"
#include "lyx_main.h"
+#include "lyxrc.h"
#include "lyxlex.h"
#include "metricsinfo.h"
#include "outputparams.h"
#include <boost/bind.hpp>
#include "support/std_ostream.h"
-#include "support/std_sstream.h"
+
+#include <sstream>
using lyx::support::AddName;
using lyx::support::AbsolutePath;
break;
case LFUN_MOUSE_RELEASE:
- if (button_.box().contains(cmd.x, cmd.y))
- InsetIncludeMailer(*this).showDialog(&cur.bv());
- break;
-
case LFUN_INSET_DIALOG_SHOW:
InsetIncludeMailer(*this).showDialog(&cur.bv());
break;
}
// write it to a file (so far the complete file)
- string writefile = ChangeExtension(included_file, ".tex");
+ string const exportfile = ChangeExtension(incfile, ".tex");
+ string const mangled = FileName(ChangeExtension(included_file,
+ ".tex")).mangledFilename();
+ string const writefile = MakeAbsPath(mangled, m_buffer->temppath());
- if (!runparams.nice) {
- incfile = FileName(writefile).mangledFilename();
- writefile = MakeAbsPath(incfile, m_buffer->temppath());
- }
+ if (!runparams.nice)
+ incfile = mangled;
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "exportfile:" << exportfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
if (loadIfNeeded(buffer, params_)) {
tmp->makeLaTeXFile(writefile,
OnlyPath(masterFilename(buffer)),
runparams, false);
- } else if (!runparams.nice) {
+ } 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.C.
if (isVerbatim(params_)) {
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
} else if (type(params_) == INPUT) {
+ runparams.exportdata->addExternalFile("latex", writefile,
+ exportfile);
+
// \input wants file with extension (default is .tex)
if (!IsLyXFilename(included_file)) {
os << '\\' << params_.getCmdName() << '{' << incfile << '}';
<< '}';
}
} else {
+ runparams.exportdata->addExternalFile("latex", writefile,
+ exportfile);
+
// \include don't want extension and demands that the
// file really have .tex
os << '\\' << params_.getCmdName() << '{'
string const included_file = includedFilename(buffer, params_);
+ // write it to a file (so far the complete file)
+ string const exportfile = ChangeExtension(incfile, ".sgml");
+ string writefile = ChangeExtension(included_file, ".sgml");
+
if (loadIfNeeded(buffer, params_)) {
Buffer * tmp = bufferlist.getBuffer(included_file);
- // write it to a file (so far the complete file)
- string writefile = ChangeExtension(included_file, ".sgml");
-
- if (!runparams.nice) {
- incfile = FileName(writefile).mangledFilename();
- writefile = MakeAbsPath(incfile,
- buffer.getMasterBuffer()->temppath());
- }
+ writefile = MakeAbsPath(FileName(writefile).mangledFilename(),
+ buffer.getMasterBuffer()->temppath());
+ if (!runparams.nice)
+ incfile = writefile;
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "exportfile:" << exportfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- OutputParams runp = runparams;
- tmp->makeLinuxDocFile(writefile, runp, true);
+ tmp->makeLinuxDocFile(writefile, runparams, true);
}
if (isVerbatim(params_)) {
os << "<![CDATA["
<< GetFileContents(included_file)
<< "]]>";
- } else
+ } else {
+ runparams.exportdata->addExternalFile("linuxdoc", writefile,
+ exportfile);
os << '&' << include_label << ';';
+ }
return 0;
}
string const included_file = includedFilename(buffer, params_);
+ // write it to a file (so far the complete file)
+ string const exportfile = ChangeExtension(incfile, ".sgml");
+ string writefile = ChangeExtension(included_file, ".sgml");
+
if (loadIfNeeded(buffer, params_)) {
Buffer * tmp = bufferlist.getBuffer(included_file);
- // write it to a file (so far the complete file)
- string writefile = ChangeExtension(included_file, ".sgml");
-
- if (!runparams.nice) {
- incfile = FileName(writefile).mangledFilename();
- writefile = MakeAbsPath(incfile,
- buffer.getMasterBuffer()->temppath());
- }
+ string const mangled = FileName(writefile).mangledFilename();
+ writefile = MakeAbsPath(mangled,
+ buffer.getMasterBuffer()->temppath());
+ if (!runparams.nice)
+ incfile = mangled;
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "exportfile:" << exportfile << endl;
lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
- OutputParams runp = runparams;
- tmp->makeDocBookFile(writefile, runp, true);
+ tmp->makeDocBookFile(writefile, runparams, true);
}
+ runparams.exportdata->addExternalFile("docbook", writefile,
+ exportfile);
+ runparams.exportdata->addExternalFile("docbook-xml", writefile,
+ exportfile);
+
if (isVerbatim(params_)) {
os << "<inlinegraphic fileref=\""
<< '&' << include_label << ';'
BOOST_ASSERT(mi.base.bv && mi.base.bv->buffer());
bool use_preview = false;
- if (RenderPreview::activated()) {
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*mi.base.bv->buffer());
use_preview = pimage && pimage->image();
if (!set_label_) {
set_label_ = true;
button_.update(getScreenLabel(*mi.base.bv->buffer()),
- editable() != NOT_EDITABLE);
+ true);
}
button_.metrics(mi, dim);
}
- int center_indent = type(params_) == INPUT ?
- 0 : (mi.base.textwidth - dim.wid) / 2;
- Box b(center_indent, center_indent + dim.wid, -dim.asc, dim.des);
+
+ Box b(0, dim.wid, -dim.asc, dim.des);
button_.setBox(b);
- dim.wid = mi.base.textwidth;
dim_ = dim;
}
BOOST_ASSERT(pi.base.bv && pi.base.bv->buffer());
bool use_preview = false;
- if (RenderPreview::activated()) {
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF) {
lyx::graphics::PreviewImage const * pimage =
preview_->getPreviewImage(*pi.base.bv->buffer());
use_preview = pimage && pimage->image();
}
if (use_preview)
- preview_->draw(pi, x + button_.box().x1, y);
+ preview_->draw(pi, x, y);
else
- button_.draw(pi, x + button_.box().x1, y);
+ button_.draw(pi, x, y);
+}
+
+bool InsetInclude::display() const
+{
+ return type(params_) != INPUT;
}
+
//
// preview stuff
//
Buffer const & buffer)
{
InsetCommandParams const & params = inset.params();
- if (RenderPreview::activated() && preview_wanted(params, buffer)) {
+ if (RenderPreview::status() != LyXRC::PREVIEW_OFF &&
+ preview_wanted(params, buffer)) {
renderer.setAbsFile(includedFilename(buffer, params));
string const snippet = latex_string(inset, buffer);
renderer.addPreview(snippet, buffer);