here comes another small fix to support file with
bb-values at the end of the file.
please apply

Herbert


-- 
http://www.lyx.org/help/
Index: src/frontends/controllers/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v
retrieving revision 1.129
diff -u -r1.129 ChangeLog
--- src/frontends/controllers/ChangeLog 2002/01/31 14:20:08     1.129
+++ src/frontends/controllers/ChangeLog 2002/02/01 07:03:32
@@ -1,3 +1,8 @@
+2002-02-01  Herbert Voss  <[EMAIL PROTECTED]>
+
+       * ControlGraphic.[C]: (readBB) search only, if it is a
+       ".?ps" file and look for bb's at end of file
+
 2002-01-30  Herbert Voss  <[EMAIL PROTECTED]>
 
        * ControlGraphic.[C]: do not search the whole file, when
Index: src/frontends/controllers/ControlGraphics.C
===================================================================
RCS file: 
/usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v
retrieving revision 1.17
diff -u -r1.17 ControlGraphics.C
--- src/frontends/controllers/ControlGraphics.C 2002/01/31 14:20:08     1.17
+++ src/frontends/controllers/ControlGraphics.C 2002/02/01 07:03:32
@@ -104,17 +104,20 @@
 // 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. 
-//     ControlGraphics::bbChanged = false;
+// 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.
        std::ifstream is(file.c_str());
-       int count = 0;
-       int const max_count = 50;       // don't search the whole file
-       while (is && (++count < max_count)) {
+       if (!con tains(getExtFromContents(file),"ps"))  // bb exists? 
+           return string();
+       while (is) {
                string s;
                is >> s;
                if (contains(s,"%%BoundingBox:")) {
                        string a, b, c, d;
                        is >> a >> b >> c >> d;
-                       if (is) {
+                       if (is && !contains(a,"atend")) { // bb at the end?
                                if (s != "%%BoundingBox:") 
                                    return (s.substr(14)+" "+a+" "+b+" "+c+" ");
                                else

Reply via email to