mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
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:
parent
b5c2e2065f
commit
7c49abda63
@ -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>
|
||||
|
||||
* ControlGraphic.[C]: do not search the whole file, when
|
||||
|
@ -104,17 +104,20 @@ 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.
|
||||
// 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 (!contains(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
|
||||
|
@ -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>
|
||||
|
||||
* insetgraphic.C: get the filetyp from it's contents
|
||||
|
@ -373,7 +373,15 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
|
||||
std::vector<string> 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 @@ void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
|
||||
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") {
|
||||
|
Loading…
Reference in New Issue
Block a user