Ralph Boland wrote: > I intend to modify the Squeak balloon system to support direct > access to the detailed information in the Lyx document > (by the user putting the mouse cursor over the GUI object while > pressing the shift key). > The user would then see a window containing the information on the > GUI object where the window would be owned by a running Lyx program > on the entire document. For users the lyx document would be in read > only mode so they could not modify the document. > (Really the users should see a postscript or pdf file but that is a > separate problem.) > For developers the Lyx document > would be modifyable making editing the Lyx document really easy.
Hi, Ralph. This method of communication with LyX has has been used successfully by João Assirati to implement his inverse-DVI search facilities. (Click on a DVI document in xdvi or kdvi and the LyX page goes to the same place.) João communicated with LyX through a unix socket but you could do the same using unix FIFOs (named pipes) if you prefer. All you'll need to do is post messages to LyX of the form reference-goto cap:mercer etal, ventilatory units in LyX 1.3 and label-goto cap:mercer etal, ventilatory units in LyX 1.4 where "cap:mercer etal, ventilatory units" is the contents of a label inset (Insert->Label) in the LyX document. (You can do this from within LyX too by hitting Alt-x to activate the minibuffer at the bottom of the LyX screen and inputting the command there.) > Alas, I need help on the Lyx side. > Ideally, when the user asks for documentation of a GUI object to be > displayed > my application would open a (Squeak) window showing the Lyx > document with the cursor at the point in the document containing the > description of the GUI object. > I think this is too difficult so a simpler solution would be for my > application to call Lyx to open the document when the application > starts but have Lyx not open its window. Interesting; I wonder if we could add an LFUN to minimize and restore the LyX screen? > My application would then need to send messages to Lyx telling it to > open its window displaying the text at particular points in the > document and also messages to close the Lyx window (but not > terminate). Finally, there would also be a "shut down Lyx" message > sent when my application closes. lyx-quit in both LyX 1.3 and LyX 1.4. I've never tried to play with João's unix socket interface, but the named pipes work beautifully under linux. My LyX support directory here is $HOME/.lyx-1.3.x and I have my LyX pipes set up from the Edit->Preferences dialog, Paths pane, "LyXServer pipe" widget as /home/aleem/.lyx-1.3.x/lyxpipe Looking in this directoy once LyX 1.3 is up and running: $ (cd ~/.lyx-1.3.x && ls -l lyxpipe*) prw------- 1 aleem aleem 0 Sep 23 12:00 lyxpipe.in prw------- 1 aleem aleem 0 Sep 23 12:00 lyxpipe.out Communication with LyX through these pipes has a simple syntax. Fire up LyX as $ lyx -dbg lyxserver so that diagnostic messages are printed to the console. Thereafter tell LyX you're communicating with it: $ echo "LYXSRV:ANGUS:hello" > ~/.lyx-1.3.x/lyxpipe.in where ANGUS is the name identifying the client, resulting in these diagnostic messages being printed to LyX's parent console: LyXComm: status:19, read_buffer_:, cmd:LYXSRV:ANGUS:hello LyXServer: Received: 'LYXSRV:ANGUS:hello' LyXServer: Client: 'ANGUS' Command: 'hello' Argument: '' LyXServer: Greeting ANGUS LyXComm: Sending 'LYXSRV:ANGUS:hello ' LyXComm: Closing connection LyXComm: Opening connection LyXComm: Connection established Similarly, tell LyX you're ending communication with: $ echo "LYXSRV:ANGUS:bye" > ~/.lyx-1.3.x/lyxpipe.in Once you've opened the communication pathway you can post individual "LFUN" commands as: $ echo "LYXCMD:ANGUS:reference-goto:cap:mercer etal, ventilatory units" > ~/.lyx-1.3.x/lyxpipe.in Note the colon between the LFUN "reference-goto" and its argumnet "cap:mercer etal, ventilatory units", resulting in these diagnostic messages being printed to LyX's parent console: LyXComm: status:63, read_buffer_:, cmd:LYXCMD:ANGUS:reference-goto cap:mercer etal, ventilatory units LyXServer: Received: 'LYXCMD:ANGUS:reference-goto cap:mercer etal, ventilatory units' LyXServer: Client: 'ANGUS' Command: 'reference-goto cap' Argument: 'mercer etal, ventilatory units' [EMAIL PROTECTED]:spectral$ LyXComm: Closing connection LyXComm: Opening connection LyXComm: Connection established Moreover, and more importantly :), LyX goes to the right place in the document. Finally: $ echo "LYXCMD:ANGUS:lyx-quit" > ~/.lyx-1.3.x/lyxpipe.in LyXComm: status:22, read_buffer_:, cmd:LYXCMD:ANGUS:lyx-quit LyXServer: Received: 'LYXCMD:ANGUS:lyx-quit' LyXServer: Client: 'ANGUS' Command: 'lyx-quit' Argument: '' TextCache: BufferView::buffer LyXComm: Sending 'LYXSRV:ANGUS:bye ' LyXComm: Closing connection and LyX exits. You'll find various play tools to communicate with LyX programatically in the development/lyxserver directory. HTH, -- Angus