A couple of fixes from Herbert.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3467 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2002-02-01 09:57:44 +00:00
parent b5c2e2065f
commit 7c49abda63
4 changed files with 32 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2002-02-01 Herbert Voss <voss@lyx.org>
* ControlGraphics.[C] (readBB): search only, if it is a
".?ps" file and look for bb's at end of file
2002-01-30 Herbert Voss <voss@lyx.org> 2002-01-30 Herbert Voss <voss@lyx.org>
* ControlGraphic.[C]: do not search the whole file, when * ControlGraphic.[C]: do not search the whole file, when

View File

@ -104,17 +104,20 @@ string const ControlGraphics::readBB(string const & file)
// in a file it's an entry like %%BoundingBox:23 45 321 345 // in a file it's an entry like %%BoundingBox:23 45 321 345
// the first number can following without a space, so we have // the first number can following without a space, so we have
// to check a bit more. // 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()); std::ifstream is(file.c_str());
int count = 0; if (!contains(getExtFromContents(file),"ps")) // bb exists?
int const max_count = 50; // don't search the whole file return string();
while (is && (++count < max_count)) { while (is) {
string s; string s;
is >> s; is >> s;
if (contains(s,"%%BoundingBox:")) { if (contains(s,"%%BoundingBox:")) {
string a, b, c, d; string a, b, c, d;
is >> a >> b >> c >> d; is >> a >> b >> c >> d;
if (is) { if (is && !contains(a,"atend")) { // bb at the end?
if (s != "%%BoundingBox:") if (s != "%%BoundingBox:")
return (s.substr(14)+" "+a+" "+b+" "+c+" "); return (s.substr(14)+" "+a+" "+b+" "+c+" ");
else else

View File

@ -1,3 +1,7 @@
2002-01-31 Herbert Voss <voss@lyx.org>
* insetgraphic.C: (readfigInset) set display to pref-default
2002-01-30 Herbert Voss <voss@lyx.org> 2002-01-30 Herbert Voss <voss@lyx.org>
* insetgraphic.C: get the filetyp from it's contents * insetgraphic.C: get the filetyp from it's contents

View File

@ -373,7 +373,15 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
std::vector<string> const oldUnits = std::vector<string> const oldUnits =
getVectorFromString("pt,cm,in,p%,c%"); getVectorFromString("pt,cm,in,p%,c%");
bool finished = false; 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) { while (lex.isOK() && !finished) {
lex.next(); lex.next();
@ -409,13 +417,15 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
if (lex.next()) if (lex.next())
params.lyxheight = LyXLength(lex.getString()+"pt"); params.lyxheight = LyXLength(lex.getString()+"pt");
} else if (token == "flags") { } else if (token == "flags") {
InsetGraphicsParams::DisplayType tmp = InsetGraphicsParams::COLOR;
if (lex.next()) if (lex.next())
switch (lex.getInteger()) { switch (lex.getInteger()) {
case 1: tmp = InsetGraphicsParams::MONOCHROME; break; case 1: params.display = InsetGraphicsParams::MONOCHROME;
case 2: tmp = InsetGraphicsParams::GRAYSCALE; break; break;
case 2: params.display = InsetGraphicsParams::GRAYSCALE;
break;
case 3: params.display = InsetGraphicsParams::COLOR;
break;
} }
params.display = tmp;
} else if (token == "subfigure") { } else if (token == "subfigure") {
params.subcaption = true; params.subcaption = true;
} else if (token == "width") { } else if (token == "width") {