+bool GuiView::goToFileRow(string const & argument)
+{
+ string file_name;
+ int row;
+ size_t i = argument.find_last_of(' ');
+ if (i != string::npos) {
+ file_name = os::internal_path(trim(argument.substr(0, i)));
+ istringstream is(argument.substr(i + 1));
+ is >> row;
+ if (is.fail())
+ i = string::npos;
+ }
+ if (i == string::npos) {
+ LYXERR0("Wrong argument: " << argument);
+ return false;
+ }
+ Buffer * buf = 0;
+ string const abstmp = package().temp_dir().absFilename();
+ string const realtmp = package().temp_dir().realPath();
+ // We have to use os::path_prefix_is() here, instead of
+ // simply prefixIs(), because the file name comes from
+ // an external application and may need case adjustment.
+ if (os::path_prefix_is(file_name, abstmp, os::CASE_ADJUSTED)
+ || os::path_prefix_is(file_name, realtmp, os::CASE_ADJUSTED)) {
+ // Needed by inverse dvi search. If it is a file
+ // in tmpdir, call the apropriated function.
+ // If tmpdir is a symlink, we may have the real
+ // path passed back, so we correct for that.
+ if (!prefixIs(file_name, abstmp))
+ file_name = subst(file_name, realtmp, abstmp);
+ buf = theBufferList().getBufferFromTmp(file_name);
+ } else {
+ // Must replace extension of the file to be .lyx
+ // and get full path
+ FileName const s = fileSearch(string(),
+ support::changeExtension(file_name, ".lyx"), "lyx");
+ // Either change buffer or load the file
+ if (theBufferList().exists(s))
+ buf = theBufferList().getBuffer(s);
+ else if (s.exists()) {
+ buf = loadDocument(s);
+ buf->updateLabels();
+ buf->errors("Parse");
+ } else {
+ message(bformat(
+ _("File does not exist: %1$s"),
+ makeDisplayPath(file_name)));
+ return false;
+ }
+ }
+ setBuffer(buf);
+ documentBufferView()->setCursorFromRow(row);
+ return true;
+}
+
+
+#if (QT_VERSION >= 0x040400)
+static docstring exportAndDestroy(Buffer * buffer, string const & format)
+{
+ bool const update_unincluded =
+ buffer->params().maintain_unincluded_children
+ && !buffer->params().getIncludedChildren().empty();
+ bool const success = buffer->doExport(format, true, update_unincluded);
+ delete buffer;
+ return success
+ ? bformat(_("Successful export to format: %1$s"), from_utf8(format))
+ : bformat(_("Error exporting to format: %1$s"), from_utf8(format));
+}
+
+
+static docstring previewAndDestroy(Buffer * buffer, string const & format)
+{
+ bool const update_unincluded =
+ buffer->params().maintain_unincluded_children
+ && !buffer->params().getIncludedChildren().empty();
+ bool const success = buffer->preview(format, update_unincluded);
+ delete buffer;
+ return success
+ ? bformat(_("Successful preview of format: %1$s"), from_utf8(format))
+ : bformat(_("Error previewing format: %1$s"), from_utf8(format));
+}
+#endif
+
+
+void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)