Re: graphix inset
On Thursday 31 January 2002 7:55 pm, Garst R. Reese wrote: Incidentally, the conversion process is slow because you're using ImageMagik's convert, I bet. It's much much quicker if you use the netpbm suite of converters. Well, I have both installed, but some folks may have one or the other. How does lyx decide which to use? The converters! xforms and qt2 and gnome can all load graphics themselves. The long term aim is to use these. There'll still be a need for the conversion mechanism for those esoteric graphics formats, but most of the common ones can be loaded direct. In this case choose don't display from graphic gui. OK, but it meant doing SR with an editor through several lyx files to change display color to display none. It is just not feasible to bring up each image to change it. You have a Preferences graphics diaplay choice Mono Gray Color None No. Each inset will have a display choice: Default Mono Gray Color None Which will override the Preferences policy unless set to Default. In this case the Preferences policy will be used. Much. Except for the reason old-graphics was dumped before new-graphics was functional -- maybe to force testers;) Not my choice, but it has indeed caused a flurry of activity. Angus
Re: graphix inset
On Thursday 31 January 2002 6:18 pm, Herbert Voss wrote: Angus Leeming wrote: Incidentally, the conversion process is slow because you're using ImageMagik's convert, I bet. It's much much quicker if you use the netpbm suite of converters. I don't understand why all images are converted when opening the file, especially the floats which can be collapsed. This one could be converted when the float is opened? The worst case is: all images are in floats and these are collapsed and I don't open any float. So they are converted without any sense. Good point. Lars, here's a question for you: are the ascent, descent, width, draw methods of an inset inside a collapsed InsetCollapsable called? If not, then we just pass the graphics data to the GraphicsCache the first time they are. Make sense? Angus
Re: graphix inset
On Fri, Feb 01, 2002 at 01:54:41PM -0400, Garst R. Reese wrote: Herbert Voss wrote: Garst R. Reese wrote: Custom does not work. no problem here When I set scale is does not persist over a file close. When I reopen the file, custom is checked. also no problem after the last patch. Then I suspect that some patch(es) did not make it to Kayvan's CVS. The CVS update happens every hour, so I don't think that's the case. Also, the automatic rebuild-from-scratch happens twice a day, resulting in a new tarball and new RPMs in ftp://ftp.sylvan.com/pub/lyx/devel -- Kayvan A. Sylvan | Proud husband of | Father to my kids: Sylvan Associates, Inc. | Laura Isabella Sylvan | Katherine Yelena (8/8/89) http://sylvan.com/~kayvan | crown of her husband | Robin Gregory (2/28/92) msg32304/pgp0.pgp Description: PGP signature
Re: graphix inset
On Thursday 31 January 2002 7:55 pm, Garst R. Reese wrote: > > Incidentally, the conversion process is slow because you're using > > ImageMagik's convert, I bet. It's much much quicker if you use the netpbm > > suite of converters. > > Well, I have both installed, but some folks may have one or the other. > How does lyx decide which to use? The converters! > > xforms and qt2 and gnome can all load graphics themselves. The long term aim > > is to use these. There'll still be a need for the conversion mechanism for > > those esoteric graphics formats, but most of the common ones can be loaded > > direct. > > > > > In this case choose "don't display" from graphic gui. > > OK, but it meant doing S with an editor through several lyx files to > change display color to display none. It is just not feasible to bring > up each image to change it. You have a Preferences graphics diaplay choice "Mono" "Gray" "Color" "None" No. Each inset will have a display choice: "Default" "Mono" "Gray" "Color" "None" Which will override the Preferences policy unless set to Default. In this case the Preferences policy will be used. > Much. Except for the reason old-graphics was dumped before new-graphics > was functional -- maybe to force testers;) Not my choice, but it has indeed caused a flurry of activity. Angus
Re: graphix inset
On Thursday 31 January 2002 6:18 pm, Herbert Voss wrote: > Angus Leeming wrote: > > > Incidentally, the conversion process is slow because you're using > > ImageMagik's convert, I bet. It's much much quicker if you use the netpbm > > suite of converters. > > > I don't understand why all images are converted when > opening the file, especially the floats which can be collapsed. > This one could be converted when the float is opened? > > The worst case is: all images are in floats and these > are collapsed and I don't open any float. So they are > converted without any sense. Good point. Lars, here's a question for you: are the ascent, descent, width, draw methods of an inset inside a collapsed InsetCollapsable called? If not, then we just pass the graphics data to the GraphicsCache the first time they are. Make sense? Angus
Re: graphix inset
Angus Leeming wrote: >>Much. Except for the reason old-graphics was dumped before new-graphics >>was functional -- maybe to force testers;) >> > > Not my choice, but it has indeed caused a flurry of activity. the only way to get it run ... ;-) Herbert -- http://www.lyx.org/help/
Re: graphix inset
On Fri, Feb 01, 2002 at 01:54:41PM -0400, Garst R. Reese wrote: > Herbert Voss wrote: > > > > Garst R. Reese wrote: > > > > > Custom does not work. > > > > no problem here > > > > > When I set scale is does not persist over a file close. When I reopen > > > the file, custom is checked. > > > > also no problem after the last patch. > > > Then I suspect that some patch(es) did not make it to Kayvan's CVS. The CVS update happens every hour, so I don't think that's the case. Also, the automatic rebuild-from-scratch happens twice a day, resulting in a new tarball and new RPMs in ftp://ftp.sylvan.com/pub/lyx/devel -- Kayvan A. Sylvan | Proud husband of | Father to my kids: Sylvan Associates, Inc. | Laura Isabella Sylvan | Katherine Yelena (8/8/89) http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92) msg32304/pgp0.pgp Description: PGP signature
Re: graphix inset
Herbert Voss wrote: the next patch to get the file type from it's contents. Especially to Garst, please try. please commit the attached graphics2.diff instead of the one from the previous mail. this patch does: - read properly scale - sets display_screen dependet to the one in pref - get the type of the graphic only from it's contents so that the file-extension is now not important. supported are gif, jpg, eps, ps, xbm, xpm, pdf let me know, if you miss a format! In this case send me a demofile of that type. - support ps-graphic files - the graphic files may be zipped. At this time only *.gz is supported. Herbert -- http://www.lyx.org/help/ Index: lib/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v retrieving revision 1.157 diff -u -r1.157 ChangeLog --- lib/ChangeLog 2002/01/30 19:18:40 1.157 +++ lib/ChangeLog 2002/01/31 11:03:21 @@ -1,3 +1,7 @@ +2002-01-30 Herbert Voss [EMAIL PROTECTED] + + * configure.m4: add convert-support for ps-files + 2002-01-29 Herbert Voss [EMAIL PROTECTED] * ui/default.ui: delete old figure entries Index: lib/configure.m4 === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v retrieving revision 1.28 diff -u -r1.28 configure.m4 --- lib/configure.m42002/01/13 13:07:24 1.28 +++ lib/configure.m42002/01/31 11:03:21 @@ -371,6 +371,7 @@ eps_to_xpm=convert EPS:\$\$i XPM:\$\$o jpg_to_xpm=convert JPG:\$\$i XPM:\$\$o png_to_xpm=convert PNG:\$\$i XPM:\$\$o + ps_to_xpm=convert PS:\$\$i XPM:\$\$o fi SEARCH_PROG([For an EPS - PDF converter], EPSTOPDF, epstopdf) Index: src/frontends/controllers/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.128 diff -u -r1.128 ChangeLog --- src/frontends/controllers/ChangeLog 2002/01/30 19:14:09 1.128 +++ src/frontends/controllers/ChangeLog 2002/01/31 11:03:22 @@ -1,3 +1,8 @@ +2002-01-30 Herbert Voss [EMAIL PROTECTED] + + * ControlGraphic.[C]: do not search the whole file, when + getting the bb + 2002-01-29 Herbert Voss [EMAIL PROTECTED] * ControlGraphic.[C]: added a button for document path Index: src/frontends/controllers/ControlGraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v retrieving revision 1.16 diff -u -r1.16 ControlGraphics.C --- src/frontends/controllers/ControlGraphics.C 2002/01/30 19:14:09 1.16 +++ src/frontends/controllers/ControlGraphics.C 2002/01/31 11:03:22 @@ -40,7 +40,6 @@ using std::pair; using std::make_pair; - using std::ifstream; ControlGraphics::ControlGraphics(LyXView lv, Dialogs d) @@ -107,7 +106,9 @@ // to check a bit more. // ControlGraphics::bbChanged = false; std::ifstream is(file.c_str()); - while (is) { + int count = 0; + int const max_count = 50; // don't search the whole file + while (is (++count max_count)) { string s; is s; if (contains(s,%%BoundingBox:)) { Index: src/graphics/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v retrieving revision 1.25 diff -u -r1.25 ChangeLog --- src/graphics/ChangeLog 2002/01/29 09:26:24 1.25 +++ src/graphics/ChangeLog 2002/01/31 11:03:22 @@ -1,3 +1,8 @@ +2002-01-31 Herbert Voss [EMAIL PROTECTED] + + * GraphicsCacheItem.h: handle filetype without the file extension; + getting type from contents; handle zipped files + 2002-01-27 Herbert Voss [EMAIL PROTECTED] * GraphicsCacheItem.h: added Converting to the ImageStatus enum. Index: src/graphics/GraphicsCacheItem.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCacheItem.C,v retrieving revision 1.21 diff -u -r1.21 GraphicsCacheItem.C --- src/graphics/GraphicsCacheItem.C2001/09/20 13:16:17 1.21 +++ src/graphics/GraphicsCacheItem.C2002/01/31 11:03:22 @@ -5,7 +5,8 @@ * Copyright 1995 Matthias Ettrich. * Copyright 1995-2001 The LyX Team. * - * This file Copyright 2000 Baruch Even + * \author Baruch Even + * \author Herbert Voss [EMAIL PROTECTED] * = */ #include config.h @@ -25,6 +26,8 @@ #include debug.h #include support/LAssert.h #include gettext.h +#include support/syscall.h +#include lyxfunc.h using std::endl; @@ -73,8 +76,7 @@ GraphicsCacheItem::getImage() const { return image_.get(); } -void -GraphicsCacheItem::imageConverted(bool success) +void
Re: graphix inset
Garst R. Reese wrote: A few remaining problems. 1. The ps view of some images goes way off the page. The setting was width 100 p%, which I presume means % of page. I changed to settings to Scale 100 % and all but one came into line. I had to change it to Scale 85%. 2. Some images are clipped in the lyx view, either the left or right side. 3. My preferences says to display in monochrome, the the graphics dialogue defaults to color. 4. Another file with 90 1.6cm x 1.6cm images took 10 minutes display, and each image covered the entire lyx screen. It seems that the height and width parameters are being completely ignored. With the old-graphics rendering was very fast and worked perfectly. the problem is the conversion to xpm-format, which is needed for xforms (don't ask me why ..) and this takes some time when the eps(ps) image is a large one. In this case choose don't display from graphic gui. Angus is working on this LyX-displaying with scaling. Herbert -- http://www.lyx.org/help/
Re: graphix inset
Angus Leeming wrote: Incidentally, the conversion process is slow because you're using ImageMagik's convert, I bet. It's much much quicker if you use the netpbm suite of converters. I don't understand why all images are converted when opening the file, especially the floats which can be collapsed. This one could be converted when the float is opened? The worst case is: all images are in floats and these are collapsed and I don't open any float. So they are converted without any sense. Herbert -- http://www.lyx.org/help/
Re: graphix inset - fix
Garst R. Reese wrote: 3. My preferences says to display in monochrome, the the graphics dialogue defaults to color. attached a small fix, please apply. Herbert -- http://www.lyx.org/help/ Index: src/insets/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.300 diff -u -r1.300 ChangeLog --- src/insets/ChangeLog2002/01/31 14:20:09 1.300 +++ src/insets/ChangeLog2002/01/31 18:38:26 @@ -1,3 +1,7 @@ +2002-01-31 Herbert Voss [EMAIL PROTECTED] + + * insetgraphic.C: (readfigInset) set display to pref-default + 2002-01-30 Herbert Voss [EMAIL PROTECTED] * insetgraphic.C: get the filetyp from it's contents Index: src/insets/insetgraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.69 diff -u -r1.69 insetgraphics.C --- src/insets/insetgraphics.C 2002/01/31 14:20:09 1.69 +++ src/insets/insetgraphics.C 2002/01/31 18:38:26 @@ -373,7 +373,15 @@ std::vectorstring const oldUnits = getVectorFromString(pt,cm,in,p%,c%); bool finished = false; - + // set the display default + if (lyxrc.display_graphics == mono) + params.display = InsetGraphicsParams::MONOCHROME; + else if (lyxrc.display_graphics == gray) + params.display = InsetGraphicsParams::GRAYSCALE; + else if (lyxrc.display_graphics == color) + params.display = InsetGraphicsParams::COLOR; + else + params.display = InsetGraphicsParams::NONE; while (lex.isOK() !finished) { lex.next(); @@ -409,13 +417,15 @@ if (lex.next()) params.lyxheight = LyXLength(lex.getString()+pt); } else if (token == flags) { - InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR; if (lex.next()) switch (lex.getInteger()) { - case 1: tmp = InsetGraphicsParams::MONOCHROME; break; - case 2: tmp = InsetGraphicsParams::GRAYSCALE; break; + case 1: params.display = +InsetGraphicsParams::MONOCHROME; + break; + case 2: params.display = +InsetGraphicsParams::GRAYSCALE; + break; + case 3: params.display = InsetGraphicsParams::COLOR; + break; } - params.display = tmp; } else if (token == subfigure) { params.subcaption = true; } else if (token == width) {
Re: graphix inset
Garst R. Reese wrote: Custom does not work. no problem here When I set scale is does not persist over a file close. When I reopen the file, custom is checked. also no problem after the last patch. Herbert -- http://www.lyx.org/help/
graphix inset - bounding box fix
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
Re: graphix inset - bounding box fix
Herbert Voss wrote: Index: src/frontends/controllers/ControlGraphics.C [...] + if (!con tains(getExtFromContents(file),ps)) // bb exists? ^^^ sorry, a typo, should be !contains. Don't know how get it in ... Herbert -- http://www.lyx.org/help/
Re: graphix inset
Herbert Voss wrote: > the next patch to get the file type from it's contents. > Especially to Garst, please try. please commit the attached graphics2.diff instead of the one from the previous mail. this patch does: - read properly scale - sets display_screen dependet to the one in pref - get the type of the graphic only from it's contents so that the file-extension is now not important. supported are gif, jpg, eps, ps, xbm, xpm, pdf let me know, if you miss a format! In this case send me a demofile of that type. - support ps-graphic files - the graphic files may be zipped. At this time only *.gz is supported. Herbert -- http://www.lyx.org/help/ Index: lib/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v retrieving revision 1.157 diff -u -r1.157 ChangeLog --- lib/ChangeLog 2002/01/30 19:18:40 1.157 +++ lib/ChangeLog 2002/01/31 11:03:21 @@ -1,3 +1,7 @@ +2002-01-30 Herbert Voss <[EMAIL PROTECTED]> + + * configure.m4: add convert-support for ps-files + 2002-01-29 Herbert Voss <[EMAIL PROTECTED]> * ui/default.ui: delete old figure entries Index: lib/configure.m4 === RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/configure.m4,v retrieving revision 1.28 diff -u -r1.28 configure.m4 --- lib/configure.m42002/01/13 13:07:24 1.28 +++ lib/configure.m42002/01/31 11:03:21 @@ -371,6 +371,7 @@ eps_to_xpm="convert EPS:\$\$i XPM:\$\$o" jpg_to_xpm="convert JPG:\$\$i XPM:\$\$o" png_to_xpm="convert PNG:\$\$i XPM:\$\$o" + ps_to_xpm="convert PS:\$\$i XPM:\$\$o" fi SEARCH_PROG([For an EPS -> PDF converter], EPSTOPDF, epstopdf) Index: src/frontends/controllers/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ChangeLog,v retrieving revision 1.128 diff -u -r1.128 ChangeLog --- src/frontends/controllers/ChangeLog 2002/01/30 19:14:09 1.128 +++ src/frontends/controllers/ChangeLog 2002/01/31 11:03:22 @@ -1,3 +1,8 @@ +2002-01-30 Herbert Voss <[EMAIL PROTECTED]> + + * ControlGraphic.[C]: do not search the whole file, when + getting the bb + 2002-01-29 Herbert Voss <[EMAIL PROTECTED]> * ControlGraphic.[C]: added a button for document path Index: src/frontends/controllers/ControlGraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v retrieving revision 1.16 diff -u -r1.16 ControlGraphics.C --- src/frontends/controllers/ControlGraphics.C 2002/01/30 19:14:09 1.16 +++ src/frontends/controllers/ControlGraphics.C 2002/01/31 11:03:22 @@ -40,7 +40,6 @@ using std::pair; using std::make_pair; - using std::ifstream; ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d) @@ -107,7 +106,9 @@ // to check a bit more. // ControlGraphics::bbChanged = false; std::ifstream is(file.c_str()); - while (is) { + int count = 0; + int const max_count = 50; // don't search the whole file + while (is && (++count < max_count)) { string s; is >> s; if (contains(s,"%%BoundingBox:")) { Index: src/graphics/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/ChangeLog,v retrieving revision 1.25 diff -u -r1.25 ChangeLog --- src/graphics/ChangeLog 2002/01/29 09:26:24 1.25 +++ src/graphics/ChangeLog 2002/01/31 11:03:22 @@ -1,3 +1,8 @@ +2002-01-31 Herbert Voss <[EMAIL PROTECTED]> + + * GraphicsCacheItem.h: handle filetype without the file extension; + getting type from contents; handle zipped files + 2002-01-27 Herbert Voss <[EMAIL PROTECTED]> * GraphicsCacheItem.h: added Converting to the ImageStatus enum. Index: src/graphics/GraphicsCacheItem.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/graphics/GraphicsCacheItem.C,v retrieving revision 1.21 diff -u -r1.21 GraphicsCacheItem.C --- src/graphics/GraphicsCacheItem.C2001/09/20 13:16:17 1.21 +++ src/graphics/GraphicsCacheItem.C2002/01/31 11:03:22 @@ -5,7 +5,8 @@ * Copyright 1995 Matthias Ettrich. * Copyright 1995-2001 The LyX Team. * - * This file Copyright 2000 Baruch Even + * \author Baruch Even + * \author Herbert Voss <[EMAIL PROTECTED]> * = */ #include @@ -25,6 +26,8 @@ #include "debug.h" #include "support/LAssert.h" #include "gettext.h" +#include "support/syscall.h" +#include "lyxfunc.h" using std::endl; @@ -73,8 +76,7 @@ GraphicsCacheItem::getImage() const { return image_.get(); } -void
Re: graphix inset
Garst R. Reese wrote: > A few remaining problems. > 1. The ps view of some images goes way off the page. The setting was > width 100 p%, which I presume means % of page. I changed to settings to > Scale 100 % and all but one came into line. I had to change it to Scale > 85%. > 2. Some images are clipped in the lyx view, either the left or right > side. > 3. My preferences says to display in monochrome, the the graphics > dialogue defaults to color. > 4. Another file with 90 1.6cm x 1.6cm images took 10 minutes display, > and each image covered the entire lyx screen. It seems that the height > and width parameters are being completely ignored. With the old-graphics > rendering was very fast and worked perfectly. the problem is the conversion to xpm-format, which is needed for xforms (don't ask me why ..) and this takes some time when the eps(ps) image is a large one. In this case choose "don't display" from graphic gui. Angus is working on this LyX-displaying with scaling. Herbert -- http://www.lyx.org/help/
Re: graphix inset
Angus Leeming wrote: > Incidentally, the conversion process is slow because you're using > ImageMagik's convert, I bet. It's much much quicker if you use the netpbm > suite of converters. I don't understand why all images are converted when opening the file, especially the floats which can be collapsed. This one could be converted when the float is opened? The worst case is: all images are in floats and these are collapsed and I don't open any float. So they are converted without any sense. Herbert -- http://www.lyx.org/help/
Re: graphix inset - fix
Garst R. Reese wrote: >>>3. My preferences says to display in monochrome, the the graphics >>>dialogue defaults to color. attached a small fix, please apply. Herbert -- http://www.lyx.org/help/ Index: src/insets/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.300 diff -u -r1.300 ChangeLog --- src/insets/ChangeLog2002/01/31 14:20:09 1.300 +++ src/insets/ChangeLog2002/01/31 18:38:26 @@ -1,3 +1,7 @@ +2002-01-31 Herbert Voss <[EMAIL PROTECTED]> + + * insetgraphic.C: (readfigInset) set display to pref-default + 2002-01-30 Herbert Voss <[EMAIL PROTECTED]> * insetgraphic.C: get the filetyp from it's contents Index: src/insets/insetgraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.69 diff -u -r1.69 insetgraphics.C --- src/insets/insetgraphics.C 2002/01/31 14:20:09 1.69 +++ src/insets/insetgraphics.C 2002/01/31 18:38:26 @@ -373,7 +373,15 @@ std::vector const oldUnits = getVectorFromString("pt,cm,in,p%,c%"); bool finished = false; - + // set the display default + if (lyxrc.display_graphics == "mono") + params.display = InsetGraphicsParams::MONOCHROME; + else if (lyxrc.display_graphics == "gray") + params.display = InsetGraphicsParams::GRAYSCALE; + else if (lyxrc.display_graphics == "color") + params.display = InsetGraphicsParams::COLOR; + else + params.display = InsetGraphicsParams::NONE; while (lex.isOK() && !finished) { lex.next(); @@ -409,13 +417,15 @@ if (lex.next()) params.lyxheight = LyXLength(lex.getString()+"pt"); } else if (token == "flags") { - InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR; if (lex.next()) switch (lex.getInteger()) { - case 1: tmp = InsetGraphicsParams::MONOCHROME; break; - case 2: tmp = InsetGraphicsParams::GRAYSCALE; break; + case 1: params.display = +InsetGraphicsParams::MONOCHROME; + break; + case 2: params.display = +InsetGraphicsParams::GRAYSCALE; + break; + case 3: params.display = InsetGraphicsParams::COLOR; + break; } - params.display = tmp; } else if (token == "subfigure") { params.subcaption = true; } else if (token == "width") {
Re: graphix inset
Garst R. Reese wrote: > Custom does not work. no problem here > When I set scale is does not persist over a file close. When I reopen > the file, custom is checked. also no problem after the last patch. Herbert -- http://www.lyx.org/help/
graphix inset - bounding box fix
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
Re: graphix inset - bounding box fix
Herbert Voss wrote: > Index: src/frontends/controllers/ControlGraphics.C [...] > + if (!con tains(getExtFromContents(file),"ps")) // bb exists? ^^^ sorry, a typo, should be !contains. Don't know how get it in ... Herbert -- http://www.lyx.org/help/
graphix inset
the next patch to get the file type from it's contents. Especially to Garst, please try. 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.128 diff -u -r1.128 ChangeLog --- src/frontends/controllers/ChangeLog 2002/01/30 19:14:09 1.128 +++ src/frontends/controllers/ChangeLog 2002/01/30 20:04:03 @@ -1,3 +1,8 @@ +2002-01-30 Herbert Voss [EMAIL PROTECTED] + + * ControlGraphic.[C]: do not search the whole file, when + getting the bb + 2002-01-29 Herbert Voss [EMAIL PROTECTED] * ControlGraphic.[C]: added a button for document path Index: src/frontends/controllers/ControlGraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v retrieving revision 1.16 diff -u -r1.16 ControlGraphics.C --- src/frontends/controllers/ControlGraphics.C 2002/01/30 19:14:09 1.16 +++ src/frontends/controllers/ControlGraphics.C 2002/01/30 20:04:04 @@ -40,7 +40,6 @@ using std::pair; using std::make_pair; - using std::ifstream; ControlGraphics::ControlGraphics(LyXView lv, Dialogs d) @@ -107,7 +106,9 @@ // to check a bit more. // ControlGraphics::bbChanged = false; std::ifstream is(file.c_str()); - while (is) { + int count = 0; + int const max_count = 50; // don't search the whole file + while (is (++count max_count)) { string s; is s; if (contains(s,%%BoundingBox:)) { Index: src/insets/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.299 diff -u -r1.299 ChangeLog --- src/insets/ChangeLog2002/01/30 18:16:12 1.299 +++ src/insets/ChangeLog2002/01/30 20:04:06 @@ -1,3 +1,9 @@ +2002-01-30 Herbert Voss [EMAIL PROTECTED] + + * insetgraphic.C: get the filetyp from it's contents + * insetgraphicparams.C: add token scale and lyxrc.display when + creating a new inset + 2002-01-30 Angus Leeming [EMAIL PROTECTED] * figinset.C: added using std::ios directive. Index: src/insets/insetgraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.68 diff -u -r1.68 insetgraphics.C --- src/insets/insetgraphics.C 2002/01/29 09:26:24 1.68 +++ src/insets/insetgraphics.C 2002/01/30 20:04:06 @@ -81,6 +81,7 @@ * Image format * fromto * EPS epstopdf + * PS ps2pdf * JPG/PNG direct * PDF direct * others PNG @@ -161,8 +162,7 @@ } -string const -InsetGraphics::statusMessage() const +string const InsetGraphics::statusMessage() const { string msg; if (cacheHandle.get()) { @@ -258,32 +258,25 @@ paint.image(old_x + 2, baseline - lascent, lwidth - 4, lascent + ldescent, cacheHandle-getImage()); - } else { - + } else { // Get the image status, default to unknown error. GraphicsCacheItem::ImageStatus status = GraphicsCacheItem::UnknownError; - if (lyxrc.display_graphics != no lyxrc.use_gui -params.display != InsetGraphicsParams::NONE + if (lyxrc.use_gui params.display != InsetGraphicsParams::NONE cacheHandle.get()) status = cacheHandle-getImageStatus(); - // Check if the image is now ready. if (status == GraphicsCacheItem::Loaded) { imageLoaded = true; - // Tell BufferView we need to be updated! bv-text-status(bv, LyXText::CHANGED_IN_DRAW); return; } - paint.rectangle(old_x + 2, baseline - lascent, lwidth - 4, lascent + ldescent); - // Print the file name. LyXFont msgFont(font); msgFont.setFamily(LyXFont::SANS_FAMILY); - string const justname = OnlyFilename (params.filename); if (!justname.empty()) { msgFont.setSize(LyXFont::SIZE_FOOTNOTE); @@ -291,7 +284,6 @@ baseline - lyxfont::maxAscent(msgFont) - 4, justname, msgFont); } - // Print the message. string const msg = statusMessage(); if (!msg.empty()) { @@ -500,57 +492,53 @@ namespace {
Re: graphix inset
Lars Gullik Bjønnes wrote: Herbert Voss [EMAIL PROTECTED] writes: | the next patch to get the file type from it's contents. | Especially to Garst, please try. You forget that some eps files has the BoundingBox at the end. never heard about this. Maybe that's not a real problem, but eps-files of 2 megs are possible. (And some have a HiresBoundingBox) yes, but makes no difference, we search for BoundingBox Herbert -- http://www.lyx.org/help/
Re: graphix inset
Lars Gullik Bjønnes wrote: If I remember correctly it is then something like: BoundingBox: At End makes life easier The old code handled this. (Probably by just reading the whole file) will have a look Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: Didn't work, but I don't see why :( Attached is the header to one of my files. %!PS-Adobe-1.0 forgot to say, this this is a ps-file and LyX doesn't has a converter for this. Look at preferences converters, if a ps-xpm is missing install one. it's just the same than the one from eps-xpm HErbert -- http://www.lyx.org/help/
Re: graphix inset
Lars Gullik Bjønnes wrote: Herbert Voss [EMAIL PROTECTED] writes: | Lars Gullik Bjønnes wrote: If I remember correctly it is then something like: BoundingBox: At End | makes life easier Or it is perhaps: Comments: At End I read in my old postscript book and it said that the bb had to appear in the header. we can't really know without having one of those ps/eps files. let's wait until somebody has such file. Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: %%Pages: (atend) blah blah %%Trailer %%Pages: 5 I did not find anything with %%BoundingBox (atend) or the like. Note: atend is one word. I suppose that this is only possible for standard ps-output with no bounding box, which has some other problems. but will also think about it until weekend. Herbert -- http://www.lyx.org/help/
Re: graphix inset
On Thu, 31 Jan 2002, Herbert Voss wrote: Garst R. Reese wrote: %%Pages: (atend) blah blah %%Trailer %%Pages: 5 I did not find anything with %%BoundingBox (atend) or the like. Note: atend is one word. From a figure I have: %!PS-Adobe-3.0 EPSF-3.0 %%For: brucew %%Title: PGPLOT PostScript plot %%Creator: PGPLOT %%CreationDate: 13-Jun-2000 14:59 %%BoundingBox: (atend) %%DocumentFonts: (atend) %%LanguageLevel: 1 %%Orientation: Portrait %%Pages: (atend) %%EndComments %%BeginProlog blah blah PGPLOT restore showpage %%PageTrailer %%PageBoundingBox: 40 28 535 757 %%Trailer %%BoundingBox: 40 28 535 757 %%DocumentFonts: %%Pages: 1 %%EOF Note the use of PageBoundingBox as well ... Mike -- Mike Ressler [EMAIL PROTECTED] OK, I'm lame: I don't have my own website ...
Re: graphix inset
Mike Ressler wrote: From a figure I have: %!PS-Adobe-3.0 EPSF-3.0 %%For: brucew %%Title: PGPLOT PostScript plot %%Creator: PGPLOT %%CreationDate: 13-Jun-2000 14:59 %%BoundingBox: (atend) %%DocumentFonts: (atend) can you send me the whole file for testing? Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: While you are hopefully sleeping well and not plagued by Garst nightmares, I tried some experiments with tonight's CVS + your test :-) it works now, send you a patch in my afternoon. Herbert -- http://www.lyx.org/help/
graphix inset
the next patch to get the file type from it's contents. Especially to Garst, please try. 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.128 diff -u -r1.128 ChangeLog --- src/frontends/controllers/ChangeLog 2002/01/30 19:14:09 1.128 +++ src/frontends/controllers/ChangeLog 2002/01/30 20:04:03 @@ -1,3 +1,8 @@ +2002-01-30 Herbert Voss <[EMAIL PROTECTED]> + + * ControlGraphic.[C]: do not search the whole file, when + getting the bb + 2002-01-29 Herbert Voss <[EMAIL PROTECTED]> * ControlGraphic.[C]: added a button for document path Index: src/frontends/controllers/ControlGraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/frontends/controllers/ControlGraphics.C,v retrieving revision 1.16 diff -u -r1.16 ControlGraphics.C --- src/frontends/controllers/ControlGraphics.C 2002/01/30 19:14:09 1.16 +++ src/frontends/controllers/ControlGraphics.C 2002/01/30 20:04:04 @@ -40,7 +40,6 @@ using std::pair; using std::make_pair; - using std::ifstream; ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d) @@ -107,7 +106,9 @@ // to check a bit more. // ControlGraphics::bbChanged = false; std::ifstream is(file.c_str()); - while (is) { + int count = 0; + int const max_count = 50; // don't search the whole file + while (is && (++count < max_count)) { string s; is >> s; if (contains(s,"%%BoundingBox:")) { Index: src/insets/ChangeLog === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.299 diff -u -r1.299 ChangeLog --- src/insets/ChangeLog2002/01/30 18:16:12 1.299 +++ src/insets/ChangeLog2002/01/30 20:04:06 @@ -1,3 +1,9 @@ +2002-01-30 Herbert Voss <[EMAIL PROTECTED]> + + * insetgraphic.C: get the filetyp from it's contents + * insetgraphicparams.C: add token scale and lyxrc.display when + creating a new inset + 2002-01-30 Angus Leeming <[EMAIL PROTECTED]> * figinset.C: added using std::ios directive. Index: src/insets/insetgraphics.C === RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.68 diff -u -r1.68 insetgraphics.C --- src/insets/insetgraphics.C 2002/01/29 09:26:24 1.68 +++ src/insets/insetgraphics.C 2002/01/30 20:04:06 @@ -81,6 +81,7 @@ * Image format * fromto * EPS epstopdf + * PS ps2pdf * JPG/PNG direct * PDF direct * others PNG @@ -161,8 +162,7 @@ } -string const -InsetGraphics::statusMessage() const +string const InsetGraphics::statusMessage() const { string msg; if (cacheHandle.get()) { @@ -258,32 +258,25 @@ paint.image(old_x + 2, baseline - lascent, lwidth - 4, lascent + ldescent, cacheHandle->getImage()); - } else { - + } else { // Get the image status, default to unknown error. GraphicsCacheItem::ImageStatus status = GraphicsCacheItem::UnknownError; - if (lyxrc.display_graphics != "no" && lyxrc.use_gui - && params.display != InsetGraphicsParams::NONE && + if (lyxrc.use_gui && params.display != InsetGraphicsParams::NONE && cacheHandle.get()) status = cacheHandle->getImageStatus(); - // Check if the image is now ready. if (status == GraphicsCacheItem::Loaded) { imageLoaded = true; - // Tell BufferView we need to be updated! bv->text->status(bv, LyXText::CHANGED_IN_DRAW); return; } - paint.rectangle(old_x + 2, baseline - lascent, lwidth - 4, lascent + ldescent); - // Print the file name. LyXFont msgFont(font); msgFont.setFamily(LyXFont::SANS_FAMILY); - string const justname = OnlyFilename (params.filename); if (!justname.empty()) { msgFont.setSize(LyXFont::SIZE_FOOTNOTE); @@ -291,7 +284,6 @@ baseline - lyxfont::maxAscent(msgFont) - 4, justname, msgFont); } - // Print the message. string const msg = statusMessage(); if (!msg.empty()) { @@
Re: graphix inset
Lars Gullik Bjønnes wrote: > Herbert Voss <[EMAIL PROTECTED]> writes: > > | the next patch to get the file type from it's contents. > | Especially to Garst, please try. > > You forget that some eps files has the BoundingBox at the end. never heard about this. Maybe that's not a real problem, but eps-files of 2 megs are possible. > (And some have a HiresBoundingBox) yes, but makes no difference, we search for BoundingBox Herbert -- http://www.lyx.org/help/
Re: graphix inset
Lars Gullik Bjønnes wrote: > If I remember correctly it is then something like: > > BoundingBox: At End makes life easier > The old code handled this. > (Probably by just reading the whole file) will have a look Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: > Didn't work, but I don't see why :( > Attached is the header to one of my files. > > %!PS-Adobe-1.0 forgot to say, this this is a ps-file and LyX doesn't has a converter for this. Look at preferences converters, if a ps->xpm is missing install one. it's just the same than the one from eps->xpm HErbert -- http://www.lyx.org/help/
Re: graphix inset
Lars Gullik Bjønnes wrote: > Herbert Voss <[EMAIL PROTECTED]> writes: > > | Lars Gullik Bjønnes wrote: > >>>If I remember correctly it is then something like: >>>BoundingBox: At End >>> >> > | makes life easier > > Or it is perhaps: > > Comments: At End I read in my old postscript book and it said that the bb had to appear in the header. > we can't really know without having one of those ps/eps files. let's wait until somebody has such file. Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: > %%Pages: (atend) > blah blah > %%Trailer > %%Pages: 5 > I did not find anything with %%BoundingBox (atend) or the like. > Note: atend is one word. I suppose that this is only possible for standard ps-output with no bounding box, which has some other problems. but will also think about it until weekend. Herbert -- http://www.lyx.org/help/
Re: graphix inset
On Thu, 31 Jan 2002, Herbert Voss wrote: > Garst R. Reese wrote: > > %%Pages: (atend) > > blah blah > > %%Trailer > > %%Pages: 5 > > I did not find anything with %%BoundingBox (atend) or the like. > > Note: atend is one word. >From a figure I have: %!PS-Adobe-3.0 EPSF-3.0 %%For: brucew %%Title: PGPLOT PostScript plot %%Creator: PGPLOT %%CreationDate: 13-Jun-2000 14:59 %%BoundingBox: (atend) %%DocumentFonts: (atend) %%LanguageLevel: 1 %%Orientation: Portrait %%Pages: (atend) %%EndComments %%BeginProlog blah blah PGPLOT restore showpage %%PageTrailer %%PageBoundingBox: 40 28 535 757 %%Trailer %%BoundingBox: 40 28 535 757 %%DocumentFonts: %%Pages: 1 %%EOF Note the use of PageBoundingBox as well ... Mike -- Mike Ressler [EMAIL PROTECTED] OK, I'm lame: I don't have my own website ...
Re: graphix inset
Mike Ressler wrote: >>From a figure I have: > > %!PS-Adobe-3.0 EPSF-3.0 > %%For: brucew > %%Title: PGPLOT PostScript plot > %%Creator: PGPLOT > %%CreationDate: 13-Jun-2000 14:59 > %%BoundingBox: (atend) > %%DocumentFonts: (atend) can you send me the whole file for testing? Herbert -- http://www.lyx.org/help/
Re: graphix inset
Garst R. Reese wrote: > While you are hopefully sleeping well and not plagued by Garst > nightmares, I tried some experiments with tonight's CVS + your test :-) it works now, send you a patch in my afternoon. Herbert -- http://www.lyx.org/help/