]> git.lyx.org Git - features.git/commitdiff
(Herbert): enable successful export to LaTeX if the graphics file is
authorAngus Leeming <leeming@lyx.org>
Mon, 29 Apr 2002 09:24:19 +0000 (09:24 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 29 Apr 2002 09:24:19 +0000 (09:24 +0000)
stored without extension.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4084 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/ChangeLog
src/insets/insetgraphics.C

index 759095ec867c367d7351c6a14c48e4eb5010f28c..c6de2ce5d88618010f4748d2149705e44788a928 100644 (file)
@@ -3,6 +3,11 @@
        * insetfloatlist.C (getScreenLabel): Fix crash in the case where
        float type do not exist.
 
+2002-04-28  Herbert Voss  <voss@perce.de>
+
+       * insetgraphics.C (latex): fix bug with missing file-extension.
+       LaTeX still allows a missing "eps" or "ps".
+
 2002-04-26  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * insetfloat.C (c-tor, wide): translate the name of the float.
index 9eac436855b6fef839262cbd508740208e54af09..1bdc1c7ba76d467e976f7da35d822a13713769ad 100644 (file)
@@ -703,16 +703,25 @@ int InsetGraphics::latex(Buffer const *buf, ostream & os,
        // If there is no file specified or not existing,
        // just output a message about it in the latex output.
        lyxerr[Debug::GRAPHICS]
-               << "InsetGraphics::latex. Filename = "
+               << "insetgraphics::latex: Filename = "
                << params().filename << endl;
 
-       string const message =
-           (IsFileReadable(MakeAbsPath(params().filename, buf->filePath()))
-               && !params().filename.empty()) ?
-                   string() :
-                   string("bb = 0 0 200 100, draft, type=eps]");
+       // A missing (e)ps-extension is no problem for LaTeX, so
+       // we have to test three different cases
+       string const file_(MakeAbsPath(params().filename, buf->filePath()));
+       bool const file_exists = 
+               !file_.empty() && 
+               (IsFileReadable(file_) ||               // original
+                IsFileReadable(file_ + ".eps") ||      // original.eps
+                IsFileReadable(file_ + ".ps"));        // original.ps
+       string const message = file_exists ? 
+               string() : string("bb = 0 0 200 100, draft, type=eps]");
+       // if !message.empty() than there was no existing file
+       // "filename(.(e)ps)" found. In this case LaTeX
+       // draws only a rectangle with the above bb and the
+       // not found filename in it.
        lyxerr[Debug::GRAPHICS]
-               << "InsetGraphics::latex. Message = " << message << endl;
+               << "InsetGraphics::latex. Message = \"" << message << '\"' << endl;
 
        // These variables collect all the latex code that should be before and
        // after the actual includegraphics command.