Top |
The GtexSynctex class (a singleton) implements the support of SyncTeX between this application and the Evince PDF viewer. It is used to switch between the source file(s) and the PDF, at the same position in the document. It is called the forward search: source file -> PDF. And backward search: PDF -> source file.
It works only with PDF files, it doesn't work with DVI or PS or other generated document formats.
D-Bus is used to communicate between this application and Evince. The implementation uses the asynchronous gdbus generated functions.
For the position, only the line is used, not the column. The column is a bit buggy.
void gtex_synctex_connect_evince_window (GtexSynctex *synctex
,const gchar *pdf_uri
);
Connects asynchronously the evince window for pdf_uri
. This application will
then listen the signals emitted by the evince window when the user wants to
switch from the PDF to the corresponding *.tex file.
void gtex_synctex_forward_search (GtexSynctex *synctex
,GtkTextBuffer *buffer
,GFile *buffer_location
,GFile *main_tex_file
,guint timestamp
);
Does a forward search, i.e. switch from the *.tex file to the PDF file at the
same position as the cursor position in buffer
.
A correct timestamp
of the event is important. If GDK_CURRENT_TIME
is used
instead, Evince is sometimes not shown directly, a notification appears
instead saying that the "Document Viewer [...] is ready". It's more
convenient if the Evince window is presented directly, which should work if
the correct timestamp
is provided.
synctex |
the GtexSynctex instance. |
|
buffer |
||
buffer_location |
the *.tex file of |
|
main_tex_file |
the main *.tex file of |
|
timestamp |
the timestamp of the event. |
“backward-search”
signalvoid user_function (GtexSynctex *synctex, char *tex_uri, int line, guint timestamp, gpointer user_data)
The ::backward-search signal is emitted to perform a backward search, i.e. switching from the PDF to the source *.tex file.
synctex |
the GtexSynctex instance. |
|
tex_uri |
the *.tex file URI. |
|
line |
the line to jump to. |
|
timestamp |
timestamp of the event. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last