X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetExternal.cpp;h=5e04597b3a8eb355ce315a7bb14d71ee6b6becc8;hb=06254d11dfdf670fab3548dc2a2674e7a261262c;hp=3f7ff2a06f427540691ae2f0d001bd8809b10a41;hpb=f07105d0e5d7feea9a09abea413bfd5d4d059108;p=lyx.git diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 3f7ff2a06f..5e04597b3a 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -19,12 +19,12 @@ #include "Buffer.h" #include "Cursor.h" -#include "debug.h" +#include "support/debug.h" #include "DispatchResult.h" #include "Exporter.h" #include "FuncStatus.h" #include "FuncRequest.h" -#include "gettext.h" +#include "support/gettext.h" #include "LaTeXFeatures.h" #include "Lexer.h" #include "LyXRC.h" @@ -43,13 +43,8 @@ #include -using std::string; -using std::istringstream; -using std::ostream; -using std::ostringstream; -using std::vector; - -using lyx::support::DocFileName; +using namespace std; +using namespace lyx::support; namespace { @@ -70,11 +65,11 @@ namespace external { TempName::TempName() { - support::FileName const tempname(support::tempName(support::FileName(), "lyxext")); + FileName const tempname = FileName::tempName("lyxext"); // FIXME: This is unsafe tempname.removeFile(); // must have an extension for the converter code to work correctly. - tempname_ = support::FileName(tempname.absFilename() + ".tmp"); + tempname_ = FileName(tempname.absFilename() + ".tmp"); } @@ -153,7 +148,7 @@ void clearIfNotFound(T & data, external::TransformID value, const_iterator it = ids.begin(); const_iterator end = ids.end(); - it = std::find(it, end, value); + it = find(it, end, value); if (it == end) data = T(); } @@ -187,15 +182,8 @@ void InsetExternalParams::write(Buffer const & buffer, ostream & os) const os << "External\n" << "\ttemplate " << templatename() << '\n'; - if (!filename.empty()) { - // when we save, we still use the original filename - EmbeddedFiles::EmbeddedFileList::const_iterator it = - buffer.embeddedFiles().find(filename.toFilesystemEncoding()); - if (it != buffer.embeddedFiles().end()) - os << "\tfilename " << DocFileName(it->absFilename()).outputFilename(buffer.filePath()) << '\n'; - else - os << "\tfilename " << filename.outputFilename(buffer.filePath()) << '\n'; - } + if (!filename.empty()) + os << "\tfilename " << filename.outputFilename(buffer.filePath()) << '\n'; if (display != defaultDisplayType) os << "\tdisplay " @@ -229,7 +217,6 @@ void InsetExternalParams::write(Buffer const & buffer, ostream & os) const } if (!resizedata.no_resize()) { - using support::float_equal; double const scl = convert(resizedata.scale); if (!float_equal(scl, 0.0, 0.05)) { if (!float_equal(scl, 100.0, 0.05)) @@ -303,12 +290,6 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex) lex.eatLine(); string const name = lex.getString(); filename.set(name, buffer.filePath()); - // maybe this file is embedded - EmbeddedFiles::EmbeddedFileList::const_iterator it = buffer.embeddedFiles().find(filename.toFilesystemEncoding()); - if (it != buffer.embeddedFiles().end()) - // using available file, embedded or external, depending on file availability and - // embedding status. - filename = DocFileName(it->availableFile(&buffer)); break; } @@ -495,7 +476,8 @@ bool InsetExternal::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetExternal::registerEmbeddedFiles(Buffer const &, EmbeddedFiles & files) const { - files.registerFile(params_.filename.absFilename(), false, this); + // temporarily disable embedding for this inset + /* files.registerFile(params_.filename, this); */ } @@ -592,7 +574,7 @@ docstring const getScreenLabel(InsetExternalParams const & params, external::getTemplatePtr(params); if (!ptr) // FIXME UNICODE - return support::bformat((_("External template %1$s is not installed")), + return bformat((_("External template %1$s is not installed")), from_utf8(params.templatename())); // FIXME UNICODE docstring gui = _(ptr->guiName);