Fix bug #7186 (Forward Search not working for Child Documents)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37602 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2011-02-12 20:24:09 +00:00
parent 16ba37879e
commit 4460f32dfd
3 changed files with 21 additions and 5 deletions

View File

@ -3595,6 +3595,10 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
ListOfBuffers::const_iterator const cen = clist.end();
for (; cit != cen; ++cit) {
if (d->cloned_buffer_) {
// Enable reverse search by copying back the
// texrow object to the cloned buffer.
// FIXME: this is not thread safe.
(*cit)->d->cloned_buffer_->d->texrow = (*cit)->d->texrow;
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
(*cit)->d->errorLists[error_type];
} else

View File

@ -377,7 +377,7 @@ PrefOutput::PrefOutput(GuiPreferences * form)
connect(pdfCB, SIGNAL(editTextChanged(QString)),
this, SIGNAL(changed()));
dviCB->addItem("");
dviCB->addItem("xdvi -sourceposition $$n:$$t $$o");
dviCB->addItem("xdvi -sourceposition '$$n:\\ $$t' $$o");
dviCB->addItem("yap -1 -s $$n$$t $$o");
dviCB->addItem("okular --unique $$o#src:$$n$$t");
dviCB->addItem("synctex view -i $$n:0:$$t -o $$o -x \"evince -p %{page+1} $$o\"");

View File

@ -136,6 +136,11 @@ using namespace std;
using namespace lyx::support;
namespace lyx {
using support::addExtension;
using support::changeExtension;
using support::removeExtension;
namespace frontend {
namespace {
@ -3466,12 +3471,19 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
break;
case LFUN_FORWARD_SEARCH: {
FileName const path(doc_buffer->temppath());
string const texname = doc_buffer->latexName();
Buffer const * doc_master = doc_buffer->masterBuffer();
FileName const path(doc_master->temppath());
string const texname = doc_master->isChild(doc_buffer)
? DocFileName(changeExtension(
doc_buffer->absFileName(),
"tex")).mangledFileName()
: doc_buffer->latexName();
string const mastername =
removeExtension(doc_master->latexName());
FileName const dviname(addName(path.absFileName(),
support::changeExtension(texname, "dvi")));
addExtension(mastername, "dvi")));
FileName const pdfname(addName(path.absFileName(),
support::changeExtension(texname, "pdf")));
addExtension(mastername, "pdf")));
if (!dviname.exists() && !pdfname.exists()) {
dr.setMessage(_("Please, preview the document first."));
break;