}
// Push directory path.
- string const path = buffer->temppath();
- support::Path p(path);
+ string const path(buffer->temppath());
+ // Prevent the compiler from optimizing away p
+ FileName pp(path);
+ support::Path p(pp);
// there are three cases here:
// 1. we print to a file
int row;
istringstream is(argument);
is >> file_name >> row;
- if (prefixIs(file_name, package().temp_dir())) {
+ if (prefixIs(file_name, package().temp_dir().absFilename())) {
// Needed by inverse dvi search. If it is a file
// in tmpdir, call the apropriated function
lyx_view_->setBuffer(theBufferList().getBufferFromTmp(file_name));
string opt1;
if (contains(argument, "|")) {
arg = token(argument, '|', 0);
- opt1 = '[' + token(argument, '|', 1) + ']';
+ opt1 = token(argument, '|', 1);
}
- std::ostringstream os;
- os << "citation LatexCommand\n"
- << "\\cite" << opt1 << "{" << arg << "}\n"
- << "\\end_inset";
- FuncRequest fr(LFUN_INSET_INSERT, os.str());
+ InsetCommandParams icp("cite");
+ icp["key"] = from_utf8(arg);
+ if (!opt1.empty())
+ icp["before"] = from_utf8(opt1);
+ string icstr = InsetCommandMailer::params2string("citation", icp);
+ FuncRequest fr(LFUN_INSET_INSERT, icstr);
dispatch(fr);
} else
- dispatch(FuncRequest(LFUN_DIALOG_SHOW, "citation"));
+ dispatch(FuncRequest(LFUN_DIALOG_SHOW_NEW_INSET, "citation"));
break;
}
case LFUN_PREFERENCES_SAVE: {
lyxrc.write(makeAbsPath("preferences",
- package().user_support()),
+ package().user_support().absFilename()),
false);
break;
}
case LFUN_BUFFER_SAVE_AS_DEFAULT: {
string const fname =
- addName(addPath(package().user_support(), "templates/"),
+ addName(addPath(package().user_support().absFilename(), "templates/"),
"defaults.lyx");
Buffer defaults(fname);
FileDialog fileDlg(_("Select document to open"),
LFUN_FILE_OPEN,
make_pair(_("Documents|#o#O"), from_utf8(lyxrc.document_path)),
- make_pair(_("Examples|#E#e"), from_utf8(addPath(package().system_support(), "examples"))));
+ make_pair(_("Examples|#E#e"), from_utf8(addPath(package().system_support().absFilename(), "examples"))));
FileDialog::Result result =
fileDlg.open(from_utf8(initpath),
LFUN_BUFFER_IMPORT,
make_pair(_("Documents|#o#O"), from_utf8(lyxrc.document_path)),
make_pair(_("Examples|#E#e"),
- from_utf8(addPath(package().system_support(), "examples"))));
+ from_utf8(addPath(package().system_support().absFilename(), "examples"))));
docstring filter = formats.prettyName(format);
filter += " (*.";
string const encoded = FileName(
lyxrc_new.document_path).toFilesystemEncoding();
if (fs::exists(encoded) && fs::is_directory(encoded))
- support::package().document_dir() = lyxrc.document_path;
+ support::package().document_dir() = FileName(lyxrc.document_path);
}
case LyXRC::RC_ESC_CHARS:
case LyXRC::RC_FONT_ENCODING: