]> git.lyx.org Git - lyx.git/blobdiff - src/Converter.cpp
Fix bug #2213 (part 1): GuiChanges lacks "Previous Change" button.
[lyx.git] / src / Converter.cpp
index 32afe035e67c28da44836546645933fce4f80ecc..fd4e7856f76f644219d1b938279c156e0b141f95 100644 (file)
@@ -27,7 +27,6 @@
 #include "support/debug.h"
 #include "support/FileNameList.h"
 #include "support/filetools.h"
-#include "support/FileZipListDir.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
 #include "support/os.h"
@@ -49,6 +48,7 @@ string const token_from("$$i");
 string const token_base("$$b");
 string const token_to("$$o");
 string const token_path("$$p");
+string const token_orig_path("$$r");
 
 
 
@@ -65,8 +65,8 @@ string const dvipdfm_options(BufferParams const & bp)
        string result;
 
        if (bp.papersize != PAPER_CUSTOM) {
-               string const paper_size = bp.paperSizeName();
-               if (paper_size != "b5" && paper_size != "foolscap")
+               string const paper_size = bp.paperSizeName(BufferParams::DVIPDFM);
+               if (!paper_size.empty())
                        result = "-p "+ paper_size;
 
                if (bp.orientation == ORIENTATION_LANDSCAPE)
@@ -303,6 +303,14 @@ bool Converters::convert(Buffer const * buffer,
                                return true;
                        }
                }
+
+               // only warn once per session and per file type
+               static std::map<string, string> warned;
+               if (warned.find(from_format) != warned.end() && warned.find(from_format)->second == to_format) {
+                       return false;
+               }
+               warned.insert(make_pair(from_format, to_format));
+
                Alert::error(_("Cannot convert file"),
                             bformat(_("No information for converting %1$s "
                                                    "format files to %2$s.\n"
@@ -387,6 +395,8 @@ bool Converters::convert(Buffer const * buffer,
                        command = subst(command, token_from, quoteName(infile2));
                        command = subst(command, token_base, quoteName(from_base));
                        command = subst(command, token_to, quoteName(outfile2));
+                       command = subst(command, token_path, quoteName(infile.onlyPath().absFilename()));
+                       command = subst(command, token_orig_path, quoteName(orig_from.onlyPath().absFilename()));
                        command = libScriptSearch(command);
 
                        if (!conv.parselog.empty())
@@ -496,8 +506,8 @@ bool Converters::move(string const & fmt,
        string const to_base = removeExtension(to.absFilename());
        string const to_extension = getExtension(to.absFilename());
 
-       FileNameList const files = FileName(path).dirList(getExtension(from.absFilename()));
-       for (FileNameList::const_iterator it = files.begin();
+       support::FileNameList const files = FileName(path).dirList(getExtension(from.absFilename()));
+       for (support::FileNameList::const_iterator it = files.begin();
             it != files.end(); ++it) {
                string const from2 = it->absFilename();
                string const file2 = onlyFilename(from2);