]> git.lyx.org Git - features.git/blobdiff - src/frontends/controllers/ControlGraphics.C
Herbert's and my fixes to the graphics inset.
[features.git] / src / frontends / controllers / ControlGraphics.C
index e5df87deb3806f495bfeb5e2c5e1e5fd4f7b27e1..6c1454fc13d7ed72ec6b2c3f48e9765af7217489 100644 (file)
@@ -104,19 +104,22 @@ string const ControlGraphics::Browse(string const & in_name)
 
 string const ControlGraphics::readBB(string const & file)
 {
-// in a file it's an entry like %%BoundingBox:23 45 321 345
-// the first number can following without a space, so we have
-// to check a bit more.
-// on the other hand some plot programs write the bb at the
-// end of the file. Than we have in the header a
-//     %%BoundingBox: (atend)
-// In this case we must check until the end.
+       // in a file it's an entry like %%BoundingBox:23 45 321 345
+       // The first number can following without a space, so we have
+       // to be a little careful.
+       // On the other hand some plot programs write the bb at the
+       // end of the file. Than we have in the header:
+       // %%BoundingBox: (atend)
+       // In this case we must check the end.
        string file_ = file;
        if (zippedFile(file_))
            file_ = unzipFile(file_);
+
+       string const format = getExtFromContents(file_);
+       if (format != "eps" && format != "ps")
+               return string();
+
        std::ifstream is(file_.c_str());
-       if (!contains(getExtFromContents(file_),"ps"))  // bb exists?
-           return string();
        while (is) {
                string s;
                is >> s;