+ default:
+ break;
+ }
+
+ if (!msg.empty())
+ message(from_utf8(msg));
+}
+
+
+void GuiView::openChildDocument(string const & fname)
+{
+ LASSERT(documentBufferView(), return);
+ Buffer & buffer = documentBufferView()->buffer();
+ FileName const filename = support::makeAbsPath(fname, buffer.filePath());
+ documentBufferView()->saveBookmark(false);
+ Buffer * child = 0;
+ bool parsed = false;
+ if (theBufferList().exists(filename)) {
+ child = theBufferList().getBuffer(filename);
+ } else {
+ message(bformat(_("Opening child document %1$s..."),
+ makeDisplayPath(filename.absFilename())));
+ child = loadDocument(filename, false);
+ parsed = true;
+ }
+ if (!child)
+ return;
+
+ // Set the parent name of the child document.
+ // This makes insertion of citations and references in the child work,
+ // when the target is in the parent or another child document.
+ child->setParent(&buffer);
+ child->masterBuffer()->updateLabels();
+ setBuffer(child);
+ if (parsed)
+ child->errors("Parse");
+}
+
+
+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;
+ }