+
+void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
+{
+ bool finished = false;
+
+ while (lex.isOK() && !finished) {
+ lex.next();
+
+ string const token = lex.getString();
+ lyxerr[Debug::INFO] << "Token: " << token << endl;
+
+ if (token.empty())
+ continue;
+ else if (token == "\\end_inset") {
+ finished = true;
+ } else if (token == "file") {
+ if (lex.next()) {
+ string const name = lex.getString();
+ string const path = OnlyPath(buf->fileName());
+ params.filename = MakeAbsPath(name, path);
+ }
+ } else if (token == "extra") {
+ if (lex.next());
+ // kept for backwards compability. Delete in 0.13.x
+ } else if (token == "subcaption") {
+ if (lex.eatLine())
+ params.subcaptionText = lex.getString();
+ } else if (token == "label") {
+ if (lex.next());
+ // kept for backwards compability. Delete in 0.13.x
+ } else if (token == "angle") {
+ if (lex.next())
+ params.rotateAngle = lex.getFloat();
+ } else if (token == "size") {
+ // Size of image on screen is ignored in InsetGraphics, just eat
+ // the input.
+ if (lex.next()) {
+ lex.getInteger();
+ }
+ if (lex.next()) {
+ lex.getInteger();
+ }
+ } 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;
+ }
+ params.display = tmp;
+ } else if (token == "subfigure") {
+ params.subcaption = true;
+ } else if (token == "width") {
+ if (lex.next()) {
+ params.widthResize = static_cast<InsetGraphicsParams::Resize>(lex.getInteger());
+ }
+ if (lex.next()) {
+ params.widthSize = lex.getFloat();
+ }
+ } else if (token == "height") {
+ if (lex.next()) {
+ params.heightResize = static_cast<InsetGraphicsParams::Resize>(lex.getInteger());
+ }
+ if (lex.next()) {
+ params.heightSize = lex.getFloat();
+ }
+ }
+ }