#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;
}
-void readInsetGraphics(Lexer & lex, string const & bufpath,
+void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin,
InsetGraphicsParams & params)
{
bool finished = false;
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."
{
lex.setContext("InsetGraphics::read");
//lex >> "Graphics";
- readInsetGraphics(lex, buffer().originFilePath(), params_);
+ readInsetGraphics(lex, buffer(), true, params_);
graphic_->update(params().as_grfxParams());
}
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()) {
{
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();
// 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;
// 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();
}
-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));
}
lex.setContext("InsetGraphics::string2params");
lex >> "graphics";
params = InsetGraphicsParams();
- readInsetGraphics(lex, buffer.filePath(), params);
+ readInsetGraphics(lex, buffer, false, params);
}