On Oct 8, 2004, at 10:53 AM, Ronald Florence wrote:
The source code for late versions of LyX/Mac-1.3.3 and for 1.3.4 was patched to allow reverse DVI search with MacDviX or recent versions of xdvi. LyX/Mac-1.3.5 needs the same patch (included below) for reverse DVI search to work.
Does anyone know what the status of reverse dvi searching on the Mac is for 1.4.0? (Trying to apply Ronald's patch for 1.3.x -- see below -- fails in 1.4.0.)
Bennett
--- src/bufferlist.C.orig Wed Nov 27 05:30:07 2002 +++ src/bufferlist.C Sat Oct 18 11:38:26 2003 @@ -463,6 +463,15 @@ }
+Buffer * BufferList::getBufferFromTmppath(string const & s)
+{
+ BufferStorage::iterator it = bstore.begin();
+ BufferStorage::iterator end = bstore.end();
+ for (; (it != end) && (s.compare((*it)->tmppath, 0, s.rfind('/'))); ++it);
+ return it != bstore.end() ? (*it) : 0;
+}
+
+
Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
{
// get a free buffer
--- src/bufferlist.h.orig Thu Mar 21 12:25:09 2002
+++ src/bufferlist.h Sat Oct 18 11:41:27 2003
@@ -160,6 +160,10 @@
Buffer * getBuffer(string const &);
/// returns a pointer to the buffer with the given number.
Buffer * getBuffer(unsigned int);
+
+ /// returns a pointer to the buffer with the given tmppath
+ Buffer * getBufferFromTmppath(string const & s);
+
private:
/// ask to save a buffer on quit
bool qwriteOne(Buffer * buf, string const & fname,
--- src/lyxfunc.C.orig Wed Mar 12 06:14:02 2003
+++ src/lyxfunc.C Sat Oct 18 11:38:26 2003
@@ -1291,12 +1291,19 @@
istr >> file_name >> row;
// Must replace extension of the file to be .lyx and get full path
string const s(ChangeExtension(file_name, ".lyx"));
+ string const tempdirslash = system_tempdir + "/";
- // Either change buffer or load the file - if (bufferlist.exists(s)) { - view()->buffer(bufferlist.getBuffer(s)); + // Check wether the path is in the temp dir + if (!s.compare(tempdirslash, 0, tempdirslash.length())) { + lyxerr[Debug::INFO] << "Gotofilerow in tmpdir " << endl; + view()->buffer(bufferlist.getBufferFromTmppath(s)); } else { - view()->buffer(bufferlist.loadLyXFile(s)); + // Either change buffer or load the file + if (bufferlist.exists(s)) { + view()->buffer(bufferlist.getBuffer(s)); + } else { + view()->buffer(bufferlist.loadLyXFile(s)); + } }
view()->setCursorFromRow(row);