Stefan Schimanski wrote:
Hi!
On top of my PDF pasting patch from some days ago I added experimental
LinkBack [1] support to LyX.
* Concept
The basic concept is that you paste objects from LinkBack enabled
application (e.g. OmniGraffle [2]) and LyX will store the PDF
representation _and_ the LinkBack data (by appending .linkback to the
filename). The latter is the original document format of the so called
"LinkBack server application".
My comments below... all IMHO.
If you click on the edit button now in the Graphics dialog the server
application is launched by the LinkBack framework and the LinkBack data
is sent back to it for editing. After modifying and saving, the updated
LinkBack data and the updated PDF is sent back to LyX. LyX will update
the files and redisplay the PDF (see P.S.).
I am wondering... Why not just stay with LinkBack data and use the
external framework a la XFig? If you define a converter from LinkBack to
pdf then the Converter cache will automatically takes care of monitoring
file on disk.
* Cross-Platform
The code is restricted to PDFs at the moment and linked to the LinkBack
framework. But there is no reason not to do something similar in Windows
via its OLE objects. If anybody is interested in such things, it
shouldn't be too hard to introduce more abstraction to share code
between Mac and Windows.
I have to admit I am not a big fan of OLE. AFAICS, this can of
functionality can be achieved with detached process and file monitoring.
* Implementation
The Implementation is based on the official Objective-C framework which
I wrap in a C++ LinkBackProxy class.
With InsetExternal I guess you wouldn't need that...
This is used in CutAndPaste.cpp (to
get the LinkBack data from the clipboard into the foo.pdf.linkback file)
and in the EmbeddedFile objects in Buffer::embeddedFiles() (to hold the
connection when editing a .linkback graphic, and to handle the updated
data).
I think this part must stay within the clipboard code. That is the part
that saves the data into a file. CutAndPaste should remain focused on
LyX data only IMHO.
The LinkBackProxy class has two signals for lost connections and the
update notification that the server sent back the modified document.
These are connected to the EmbeddedFile objects during editing.
Stefan
P.S.: How do I force a InsetGraphics to re-convert the source files to
display on screen? In the file cache code there is some kind of
monitoring. Is this supposed to monitor the source file (the PDF in my
case)? If yes, it does not work here.
There might be something missing here. We have the FileMonitor class
IIRC and maybe you can use that. I think this should be porter to
QFileSystemWatcher.
Abdel.