]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetGraphics.cpp
Squash some warnings.
[lyx.git] / src / insets / InsetGraphics.cpp
index ac9d0809d83f0a73203245a25b5cf108f0e64cec..dc617fb1773cfc34ae1454c19ee9806244faa0d8 100644 (file)
@@ -84,10 +84,9 @@ TODO
 #include "support/os.h"
 #include "support/Systemcall.h"
 
-#include <boost/tuple/tuple.hpp>
-
 #include <algorithm>
 #include <sstream>
+#include <tuple>
 
 using namespace std;
 using namespace lyx::support;
@@ -139,7 +138,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams)
 }
 
 
-void readInsetGraphics(Lexer & lex, string const & bufpath,
+void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin,
        InsetGraphicsParams & params)
 {
        bool finished = false;
@@ -156,7 +155,7 @@ void readInsetGraphics(Lexer & lex, string const & bufpath,
                if (token == "\\end_inset") {
                        finished = true;
                } else {
-                       if (!params.Read(lex, token, bufpath))
+                       if (!params.Read(lex, token, buf, allowOrigin))
                                lyxerr << "Unknown token, "
                                       << token
                                       << ", skipping."
@@ -299,7 +298,7 @@ void InsetGraphics::read(Lexer & lex)
 {
        lex.setContext("InsetGraphics::read");
        //lex >> "Graphics";
-       readInsetGraphics(lex, buffer().originFilePath(), params_);
+       readInsetGraphics(lex, buffer(), true, params_);
        graphic_->update(params().as_grfxParams());
 }
 
@@ -438,7 +437,7 @@ docstring InsetGraphics::createDocBookAttributes() const
        if (!params().scale.empty() && !float_equal(scl, 0.0, 0.05)) {
                if (!float_equal(scl, 100.0, 0.05))
                        options << " scale=\""
-                               << static_cast<int>( (scl) + 0.5 )
+                               << support::iround(scl)
                                << "\" ";
        } else {
                if (!params().width.zero()) {
@@ -503,7 +502,7 @@ copyToDirIfNeeded(DocFileName const & file, string const & dir)
 {
        string const file_in = file.absFileName();
        string const only_path = onlyPath(file_in);
-       if (rtrim(onlyPath(file_in) , "/") == rtrim(dir, "/"))
+       if (rtrim(only_path, "/") == rtrim(dir, "/"))
                return make_pair(IDENTICAL_PATHS, FileName(file_in));
 
        string mangled = file.mangledFileName();
@@ -595,8 +594,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const
        // we move it to a temp dir or uncompress it.
        FileName temp_file;
        GraphicsCopyStatus status;
-       boost::tie(status, temp_file) =
-                       copyToDirIfNeeded(params().filename, temp_path);
+       tie(status, temp_file) = copyToDirIfNeeded(params().filename, temp_path);
 
        if (status == FAILURE)
                return orig_file;
@@ -891,8 +889,7 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const
        // Copy to temporary directory.
        FileName temp_file;
        GraphicsCopyStatus status;
-       boost::tie(status, temp_file) =
-                       copyToDirIfNeeded(params().filename, temp_path);
+       tie(status, temp_file) = copyToDirIfNeeded(params().filename, temp_path);
 
        if (status == FAILURE)
                return string();
@@ -1027,11 +1024,12 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p) const
 }
 
 
-void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active) const
+void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active,
+                                                        UpdateType) const
 {
        //FIXME UNICODE
        docstring const str = from_utf8(params_.filename.onlyFileName());
-       buffer().tocBackend().toc("graphics").push_back(TocItem(cpit, 0, str, output_active));
+       buffer().tocBackend().toc("graphics")->push_back(TocItem(cpit, 0, str, output_active));
 }
 
 
@@ -1053,7 +1051,7 @@ void InsetGraphics::string2params(string const & in, Buffer const & buffer,
        lex.setContext("InsetGraphics::string2params");
        lex >> "graphics";
        params = InsetGraphicsParams();
-       readInsetGraphics(lex, buffer.filePath(), params);
+       readInsetGraphics(lex, buffer, false, params);
 }