#include "graphics/PreviewLoader.h"
-#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
-#include "support/tostr.h"
+#include "support/convert.h"
#include "support/translator.h"
#include <boost/bind.hpp>
if (!resizedata.no_resize()) {
using support::float_equal;
- double scl = support::strToDbl(resizedata.scale);
+ double const scl = convert<double>(resizedata.scale);
if (!float_equal(scl, 0.0, 0.05)) {
if (!float_equal(scl, 100.0, 0.05))
os << "\tscale "
}
+bool InsetExternal::getStatus(LCursor & cur, FuncRequest const & cmd,
+ FuncStatus & flag) const
+{
+ switch (cmd.action) {
+
+ case LFUN_EXTERNAL_EDIT:
+ case LFUN_INSET_MODIFY:
+ case LFUN_INSET_DIALOG_UPDATE:
+ flag.enabled(true);
+ return true;
+
+ default:
+ return InsetBase::getStatus(cur, cmd, flag);
+ }
+}
+
+
void InsetExternal::edit(LCursor & cur, bool)
{
InsetExternalMailer(*this).showDialog(&cur.bv());
gparams.scale = eparams.lyxscale;
if (eparams.clipdata.clip)
gparams.bb = eparams.clipdata.bbox;
- gparams.angle = lyx::support::strToDbl(eparams.rotationdata.adjAngle());
+ gparams.angle = convert<double>(eparams.rotationdata.adjAngle());
switch (eparams.display) {
case external::DefaultDisplay:
if (!ptr)
return support::bformat(_("External template %1$s is not installed"),
params.templatename());
- return external::doSubstitution(params, buffer, ptr->guiName);
+ return external::doSubstitution(params, buffer, ptr->guiName, false);
}
void add_preview_and_start_loading(RenderMonitoredPreview &,
return;
external::Template const & et = *et_ptr;
+ // FIXME: This is wrong if we export to PDFLaTeX
external::Template::Formats::const_iterator cit =
et.formats.find("LaTeX");
if (cit == et.formats.end())
return;
- if (!cit->second.requirement.empty())
- features.require(cit->second.requirement);
+ // FIXME: We don't need that always
+ features.require("lyxdot");
+
+ vector<string>::const_iterator it = cit->second.requirements.begin();
+ vector<string>::const_iterator end = cit->second.requirements.end();
+ for (; it != end; ++it)
+ features.require(*it);
external::TemplateManager & etm = external::TemplateManager::get();
- vector<string>::const_iterator it = cit->second.preambleNames.begin();
- vector<string>::const_iterator end = cit->second.preambleNames.end();
+ it = cit->second.preambleNames.begin();
+ end = cit->second.preambleNames.end();
for (; it != end; ++it) {
string const preamble = etm.getPreambleDefByName(*it);
if (!preamble.empty())