- writeOrigin(os, rotateOrigin);
- if (rotateAngle != 0)
- os << " rotateAngle " << rotateAngle << endl;
-}
-
-static void readResize(InsetGraphicsParams * igp, bool height,
- string const & token)
-{
- InsetGraphicsParams::Resize resize = InsetGraphicsParams::DEFAULT_SIZE;
-
- resize = resizeTranslator.find(token);
-#if 0
- // Old code, before translator.
- if (token == "default")
- resize = InsetGraphicsParams::DEFAULT_SIZE;
- else if (token == "cm")
- resize = InsetGraphicsParams::CM;
- else if (token == "inch")
- resize = InsetGraphicsParams::INCH;
- else if (token == "percentOfPage")
- resize = InsetGraphicsParams::PERCENT_PAGE;
- else if (token == "percentOfColumn")
- resize = InsetGraphicsParams::PERCENT_COLUMN;
- else {
- lyxerr << "BUG: When reading resize value of InsetGraphicsParam"
- " unknown token found '" << token << '\'' << endl;
- }
-#endif
-
- if (height)
- igp->heightResize = resize;
- else
- igp->widthResize = resize;
-}
-
-static void readOrigin(InsetGraphicsParams * igp, string const & token)
-{ // TODO: complete this function.
- igp->rotateOrigin = originTranslator.find(token);
-}
-
-bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
- string const& token)
-{
- if (token == "filename") {
- lex.next();
- filename = lex.GetString();
-
- if (!filename.empty()) {
- // Make the filename with absolute directory.
- filename = MakeAbsPath(filename, OnlyPath(buf->fileName()));
- }
- } else if (token == "display") {
- lex.next();
- string const type = lex.GetString();
-
- display = displayTranslator.find(type);
-#if 0
- if (type == "color")
- display = COLOR;
- else if (type == "grayscale")
- display = GRAYSCALE;
- else if (type == "monochrome")
- display = MONOCHROME;
- else if (type == "none")
- display = NONE;
- else {
- display = MONOCHROME;
- lyxerr << "BUG: When reading InsetGraphicsParams"
- " display has an unknown type " << type << endl;
- }
-#endif
- } else if (token == "inline") {
- inlineFigure = true;
- } else if (token == "subcaption") {
- subcaption = true;
- } else if (token == "subcaptionText") {
- lex.next();
- subcaptionText = lex.GetString();
- } else if (token == "widthResize") {
- lex.next();
- string const token = lex.GetString();
-
- readResize(this, false, token);
- } else if (token == "width") {
- lex.next();
- widthSize = lex.GetFloat();
- } else if (token == "heightResize") {
- lex.next();
- string const token = lex.GetString();
-
- readResize(this, true, token);
- } else if (token == "height") {
- lex.next();
- heightSize = lex.GetFloat();
- } else if (token == "rotateOrigin") {
- lex.next();
- string const token = lex.GetString();
-
- readOrigin(this, token);
- } else if (token == "rotateAngle") {
- lex.next();
- rotateAngle = lex.GetInteger();
- } else {
- // If it's none of the above, its not ours.
- return false;
- }
-
- return true;
-}