mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 21:40:19 +00:00
(Jo�o Assirati): add the ability to inverse-search a dvi file.
To use, you'll need either to run 'latex --src-specials' or, if your version of latex isn't up to the task, to use the srcltx package. Further, your vi viewer must be up to the task. xdvi 22.38 or the kde 3 version of kdvi. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7917 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
09e56ecb68
commit
4e136e6f41
@ -5,6 +5,15 @@
|
||||
* lyxrc.C: displayTranslator is now a function,
|
||||
declared in GraphicsTypes.h.
|
||||
|
||||
2003-10-13 Joao Luis Meloni Assirati <assirati@fma.if.usp.br>
|
||||
|
||||
* format.C: new placeholder $$a to pass the socket address.
|
||||
|
||||
* bufferlist.[Ch]: new function getBufferFromTmp.
|
||||
|
||||
* lyxfunc.C: Modification of LFUN_GOTOFILEROW so that it can handle
|
||||
files in the temporary dir.
|
||||
|
||||
2003-10-13 Joao Luis Meloni Assirati <assirati@fma.if.usp.br>
|
||||
|
||||
* lyxsocket.[Ch]: new files. A simple local socket interface for lyx.
|
||||
|
@ -37,6 +37,7 @@ using lyx::support::MakeAbsPath;
|
||||
using lyx::support::MakeDisplayPath;
|
||||
using lyx::support::OnlyFilename;
|
||||
using lyx::support::removeAutosaveFile;
|
||||
using lyx::support::prefixIs;
|
||||
|
||||
using std::endl;
|
||||
using std::find;
|
||||
@ -329,6 +330,17 @@ Buffer * BufferList::getBuffer(string const & s)
|
||||
}
|
||||
|
||||
|
||||
Buffer * BufferList::getBufferFromTmp(string const & s)
|
||||
{
|
||||
BufferStorage::iterator it = bstore.begin();
|
||||
BufferStorage::iterator end = bstore.end();
|
||||
for (; it < end; ++it)
|
||||
if (prefixIs(s, (*it)->temppath()))
|
||||
return *it;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void BufferList::setCurrentAuthor(string const & name, string const & email)
|
||||
{
|
||||
BufferStorage::iterator it = bstore.begin();
|
||||
|
@ -68,6 +68,8 @@ public:
|
||||
Buffer * getBuffer(std::string const &);
|
||||
/// returns a pointer to the buffer with the given number.
|
||||
Buffer * getBuffer(unsigned int);
|
||||
/// returns a pointer to the buffer whose temppath matches the string
|
||||
Buffer * BufferList::getBufferFromTmp(std::string const &);
|
||||
|
||||
/// reset current author for all buffers
|
||||
void setCurrentAuthor(std::string const & name, std::string const & email);
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "lyxrc.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxsocket.h"
|
||||
|
||||
#include "frontends/Alert.h" //to be removed?
|
||||
|
||||
@ -36,11 +37,13 @@ using lyx::support::Systemcall;
|
||||
|
||||
using std::string;
|
||||
|
||||
extern LyXServerSocket * lyxsocket;
|
||||
|
||||
namespace {
|
||||
|
||||
string const token_from("$$i");
|
||||
string const token_path("$$p");
|
||||
string const token_socket("$$a");
|
||||
|
||||
} //namespace anon
|
||||
|
||||
@ -196,7 +199,7 @@ bool Formats::view(Buffer const & buffer, string const & filename,
|
||||
command = subst(command, token_from,
|
||||
QuoteName(OnlyFilename(filename)));
|
||||
command = subst(command, token_path, QuoteName(OnlyPath(filename)));
|
||||
|
||||
command = subst(command, token_socket, QuoteName(lyxsocket->address()));
|
||||
lyxerr[Debug::FILES] << "Executing command: " << command << std::endl;
|
||||
buffer.message(_("Executing command: ") + command);
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-10-13 João Luis Meloni Assirati <assirati@fma.if.usp.br>
|
||||
|
||||
* lyx_gui.C: Declared and allocated lyxsocket.
|
||||
|
||||
2003-10-13 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lyx_gui.C (set_datasocket_callback, set_serversocket_callback,
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/os.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include "lyx_gui.h"
|
||||
@ -25,6 +26,7 @@
|
||||
#include "lyxfunc.h"
|
||||
#include "lyxrc.h"
|
||||
#include "lyxserver.h"
|
||||
#include "lyxsocket.h"
|
||||
#include "BufferView.h"
|
||||
#include "LColor.h"
|
||||
|
||||
@ -44,6 +46,8 @@
|
||||
|
||||
using lyx::support::ltrim;
|
||||
|
||||
namespace os = lyx::support::os;
|
||||
|
||||
#ifndef CXX_GLOBAL_CSTD
|
||||
using std::exit;
|
||||
#endif
|
||||
@ -70,6 +74,7 @@ map<int, io_callback *> io_callbacks;
|
||||
|
||||
// FIXME: wrong place !
|
||||
LyXServer * lyxserver;
|
||||
LyXServerSocket * lyxsocket;
|
||||
|
||||
// in QLyXKeySym.C
|
||||
extern void initEncodings();
|
||||
@ -138,6 +143,8 @@ void start(string const & batch, vector<string> const & files)
|
||||
// FIXME: some code below needs moving
|
||||
|
||||
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
|
||||
lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
|
||||
os::slashify_path(os::getTmpDir() + "/lyxsocket"));
|
||||
|
||||
vector<string>::const_iterator cit = files.begin();
|
||||
vector<string>::const_iterator end = files.end();
|
||||
@ -152,6 +159,7 @@ void start(string const & batch, vector<string> const & files)
|
||||
qApp->exec();
|
||||
|
||||
// FIXME
|
||||
delete lyxsocket;
|
||||
delete lyxserver;
|
||||
lyxserver = 0;
|
||||
}
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "support/path_defines.h"
|
||||
#include "support/tostr.h"
|
||||
#include "support/std_sstream.h"
|
||||
#include "support/os.h"
|
||||
|
||||
using bv_funcs::apply_freefont;
|
||||
using bv_funcs::changeDepth;
|
||||
@ -104,6 +105,8 @@ using lyx::support::system_lyxdir;
|
||||
using lyx::support::token;
|
||||
using lyx::support::trim;
|
||||
using lyx::support::user_lyxdir;
|
||||
using lyx::support::prefixIs;
|
||||
using lyx::support::os::getTmpDir;
|
||||
|
||||
using std::endl;
|
||||
using std::make_pair;
|
||||
@ -1362,15 +1365,21 @@ void LyXFunc::dispatch(FuncRequest const & func, bool verbose)
|
||||
int row;
|
||||
istringstream istr(argument.c_str());
|
||||
istr >> file_name >> row;
|
||||
// Must replace extension of the file to be .lyx and get full path
|
||||
if (prefixIs(file_name, getTmpDir())) {
|
||||
// Needed by inverse dvi search. If it is a file
|
||||
// in tmpdir, call the apropriated function
|
||||
view()->buffer(bufferlist.getBufferFromTmp(file_name));
|
||||
} else {
|
||||
// Must replace extension of the file to be .lyx
|
||||
// and get full path
|
||||
string const s(ChangeExtension(file_name, ".lyx"));
|
||||
|
||||
// Either change buffer or load the file
|
||||
if (bufferlist.exists(s)) {
|
||||
view()->buffer(bufferlist.getBuffer(s));
|
||||
} else {
|
||||
view()->loadLyXFile(s);
|
||||
}
|
||||
}
|
||||
|
||||
view()->setCursorFromRow(row);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user