]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetGraphicsParams.cpp
reduce line noise
[features.git] / src / insets / InsetGraphicsParams.cpp
index 6b1bc4cfd4d1e779548b688d6787aaf3efa90649..596f738503f8563f9fad31ac4877e6fe67b4204b 100644 (file)
@@ -18,9 +18,9 @@
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "Buffer.h"
-#include "EmbeddedFiles.h"
 
 #include "graphics/GraphicsParams.h"
+#include "graphics/GraphicsTypes.h"
 
 #include "support/convert.h"
 #include "support/filetools.h"
@@ -117,7 +117,7 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp)
 bool operator==(InsetGraphicsParams const & left,
                InsetGraphicsParams const & right)
 {
-       if (left.filename == right.filename &&
+       return left.filename == right.filename &&
            left.lyxscale == right.lyxscale &&
            left.display == right.display &&
            left.scale == right.scale &&
@@ -128,7 +128,6 @@ bool operator==(InsetGraphicsParams const & left,
            left.noUnzip == right.noUnzip &&
            left.scaleBeforeRotation == right.scaleBeforeRotation &&
 
-
            left.bb == right.bb &&
            left.clip == right.clip &&
 
@@ -136,11 +135,7 @@ bool operator==(InsetGraphicsParams const & left,
            left.rotateOrigin == right.rotateOrigin &&
            left.subcaption == right.subcaption &&
            left.subcaptionText == right.subcaptionText &&
-           left.special == right.special
-          )
-               return true;
-
-       return false;
+           left.special == right.special;
 }
 
 
@@ -154,15 +149,10 @@ bool operator!=(InsetGraphicsParams const & left,
 void InsetGraphicsParams::Write(ostream & os, Buffer const & buffer) const
 {
        // Do not write the default values
-
        if (!filename.empty()) {
-               // when we save, we still use the original filename
-               EmbeddedFiles::EmbeddedFileList::const_iterator it = 
-                       buffer.embeddedFiles().find(filename.toFilesystemEncoding());
-               if (it != buffer.embeddedFiles().end())
-                       os << "\tfilename " << DocFileName(it->absFilename()).outputFilename(buffer.filePath()) << '\n';
-               else
-                       os << "\tfilename " << filename.outputFilename(buffer.filePath()) << '\n';
+               os << "\tfilename " << filename.outputFilename(buffer.filePath()) << '\n';
+               os << "\tinzipName " << filename.inzipName() << '\n';
+               os << "\tembed " << (filename.embedded() ? "true" : "false") << '\n';
        }
        if (lyxscale != 100)
                os << "\tlyxscale " << lyxscale << '\n';
@@ -211,6 +201,12 @@ bool InsetGraphicsParams::Read(Lexer & lex, string const & token, string const &
        if (token == "filename") {
                lex.eatLine();
                filename.set(lex.getString(), bufpath);
+       } else if (token == "inzipName") {
+               lex.eatLine();
+               filename.setInzipName(lex.getString());
+       } else if (token == "embed") {
+               lex.next();
+               filename.setEmbed(lex.getBool());               
        } else if (token == "lyxscale") {
                lex.next();
                lyxscale = lex.getInteger();
@@ -291,7 +287,7 @@ graphics::Params InsetGraphicsParams::as_grfxParams() const
 
                // Get the original Bounding Box from the file
                string const tmp = readBB_from_PSFile(filename);
-               LYXERR(Debug::GRAPHICS) << "BB_from_File: " << tmp << std::endl;
+               LYXERR(Debug::GRAPHICS, "BB_from_File: " << tmp);
                if (!tmp.empty()) {
                        // FIXME: why not convert to unsigned int? (Lgb)
                        unsigned int const bb_orig_xl = convert<int>(token(tmp, ' ', 0));
@@ -332,15 +328,14 @@ graphics::Params InsetGraphicsParams::as_grfxParams() const
        }
 
        if (display == graphics::DefaultDisplay) {
-               pars.display = lyxrc.display_graphics;
+               pars.display = graphics::DisplayType(lyxrc.display_graphics);
        } else {
                pars.display = display;
        }
 
        // Override the above if we're not using a gui
-       if (!use_gui) {
+       if (!use_gui)
                pars.display = graphics::NoDisplay;
-       }
 
        return pars;
 }