Index: insets/InsetGraphics.cpp
===================================================================
--- insets/InsetGraphics.cpp    (revision 35500)
+++ insets/InsetGraphics.cpp    (working copy)
@@ -589,16 +589,28 @@
                params().filename.outputFileName(masterBuffer->filePath()) :
                onlyFileName(temp_file.absFileName());

-       if (runparams.nice&&  !isValidLaTeXFileName(output_file)) {
-               frontend::Alert::warning(_("Invalid filename"),
-                                        _("The following filename is likely to 
cause trouble "
-                                          "when running the exported file through 
LaTeX: ") +
-                                           from_utf8(output_file));
+       // determine the export format
+       string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
+                       "latex" : "pdflatex";
+
I'd just leave this where it was....

+       if (runparams.nice ) {
+               if (!isValidLaTeXFileName(output_file)) {
+                       frontend::Alert::warning(_("Invalid filename"),
+                                        _("The following filename will cause 
troubles "
+                                              "when running the exported file 
through LaTeX: ") +
+                                            from_utf8(output_file));
+               }
+               // only show DVI-specific warning when export format is plain 
latex
+               if (!isValidDVIFileName(output_file)&&  tex_format != 
"pdflatex") {

and do the comparison here as: runparams.flavor == OutputParams::LATEX. This is cheaper and will still be correct if e.g. I were to change the name of the format. Or to change how addExternalFile handles formats (which I've long been tempted to do).

+                       frontend::Alert::warning(_("Problematic filename for 
DVI"),
+                                        _("The following filename can cause 
troubles "
+                                              "when running the exported file 
through LaTeX "
+                                                  "and opening the resulting DVI: 
") +
+                                            from_utf8(output_file), true);
+               }
        }

        FileName source_file = runparams.nice ? FileName(params().filename) : 
temp_file;
-       string const tex_format = (runparams.flavor == OutputParams::LATEX) ?
-                       "latex" : "pdflatex";

        // If the file is compressed and we have specified that it
        // should not be uncompressed, then just return its name and
Index: support/filetools.h
===================================================================
--- support/filetools.h (revision 35500)
+++ support/filetools.h (working copy)
@@ -72,6 +72,9 @@
  ///
  bool isValidLaTeXFileName(std::string const&  filename);

+///
+bool isValidDVIFileName(std::string const&  filename);
+
  /** Returns the path of a library data file.
      Search the file name.ext in the subdirectory dir of
        -# user_lyxdir

A little comment in the header here about what these do and why there are two of them would be good.

Richard

Reply via email to