From 8dffd939959b8d4a2d5a83aa0f67c5de6d970677 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Sun, 18 Apr 2010 10:54:43 +0000 Subject: [PATCH] In the meantime that we decide whether to introduce menu choices for both dvi and pdf, let's allow switching forward search from one format to the other through a timestamp check, such that the most recent generated format will be used. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34200 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 204b3568e0..98169a9964 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -3223,20 +3223,27 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) break; case LFUN_FORWARD_SEARCH: { - string command = lyxrc.forward_search_dvi; FileName const path(doc_buffer->temppath()); string const texname = doc_buffer->latexName(); - string outname = support::changeExtension(texname, "dvi"); - if (!FileName(addName(path.absFilename(), outname)).exists()) { - outname = support::changeExtension(texname, "pdf"); + FileName const dviname(addName(path.absFilename(), + support::changeExtension(texname, "dvi"))); + FileName const pdfname(addName(path.absFilename(), + support::changeExtension(texname, "pdf"))); + if (!dviname.exists() && !pdfname.exists()) { + dr.setMessage(_("Please, preview the document first.")); + break; + } + string outname = dviname.onlyFileName(); + string command = lyxrc.forward_search_dvi; + if (!dviname.exists() || + pdfname.lastModified() > dviname.lastModified()) { + outname = pdfname.onlyFileName(); command = lyxrc.forward_search_pdf; - if (!FileName(addName(path.absFilename(), outname)).exists()) - break; } int row = doc_buffer->texrow().getRowFromIdPos(bv->cursor().paragraph().id(), bv->cursor().pos()); LYXERR(Debug::ACTION, "Forward search: row:" << row - << " id:" << bv->cursor().paragraph().id() << "\n"); + << " id:" << bv->cursor().paragraph().id()); if (!row || command.empty()) { dr.setMessage(_("Couldn't proceed.")); break; -- 2.39.2