Am 25.09.2010 22:08, schrieb Richard Heck:

Perhaps the warning could be (a) rephrased to make it sound less dire and (b) given 
a "don't show
again" box.

The attached patch does this and also distinguishes between LaTeX and DVI. This is in my opinion important. The method isValidLaTeXFileName should only check if the file is valid LaTeX while the new method isValidDVIFileName checks if this is valid for DVI. This way we give the users valid and useful
information.

Besides this, we should not show warning for bugs in third-party programs like DVI-viewers as we also don't for PDF, HTML, PostScript, or any other output format. I mean when you are using Unicoe characters in the PDF document settings, export as PDF and then open the result with older PDF viewers, you will also get errors. You see, we cannot care about all possible cases.

Mioreover, it seems that only xdvi is causing troubles, so it should be fixed there. The DVI viewers of TeXLive and MiKTeX work fine.
Can anybody please do me the favor and test xdvi and TeXLive on Linux?

> Some people still use older distributions. Two of my laptops run tetex, as 
does my work machine.
> Who knows how many people are still running the last Ubuntu LTS. What does 
that have? My main
> concern would be that we don't really know who uses what.

As every other software we have to do a cut what we are supporting. We cannot rely on bugs of other programs forever. teTeX3 was released 5 years ago and is not under development for 4 years. Why should we for all time support it and live with its bugs that will and can never be fixed? LyX 2.0 is a good version number to cut support teTeX3 support. This will not harm because you can also install TeXLive on an Ubuntu from 2006 because it is a live system and can even be run from an USB-stick.

regards Uwe
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";
+
+	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") {
+			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.cpp
===================================================================
--- support/filetools.cpp	(revision 35500)
+++ support/filetools.cpp	(working copy)
@@ -74,11 +74,18 @@
 
 bool isValidLaTeXFileName(string const & filename)
 {
-	string const invalid_chars("#$%{}()[]\"^");
+	string const invalid_chars("#%\"");
 	return filename.find_first_of(invalid_chars) == string::npos;
 }
 
 
+bool isValidDVIFileName(string const & filename)
+{
+	string const invalid_chars("${}()[]^");
+	return filename.find_first_of(invalid_chars) == string::npos;
+}
+
+
 string const latex_path(string const & original_path,
 		latex_path_extension extension,
 		latex_path_dots dots)
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

Reply via email to