Re: [PATCH] Inverse search update.

2003-10-21 Thread Alfredo Braunstein
Angus Leeming wrote:

> Alfredo Braunstein wrote:
> 
>> btw, how should we introduce source-latex only for view->dvi? a
>> latexflavour?
> 
> Your pet project surfaces again? Why not try and put a few thoughts
> down on e-paper about how it might be implemented and we can knock
> some ideas around.

Yes... somehow. I think that using latex flavours one can get a hackish but
simple solution fast (and I suggest Joao Luis to have a look at that).

Maybe I'll follow your advice and write something about my (even if for
starters, I've tried to have you doing it from the very beginning, and you
have rejected every stroke with a Winbledon-level swing) pet project
(mostly what we have discussed in Chemnitz). I don't think, however, that
hacking into that is a wise thing to do now: I'll probably better fix some
bugs in my spare time, instead of introducing new ones in what is probably
the last non-regressed part of the code... ;-)

> Angus (back from a long w/e in a beautiful, but cold, Budapest.)

Completely OT! (no envy here ;-)

Alfredo




Re: [PATCH] Inverse search update.

2003-10-20 Thread Jose' Matos
On Monday 20 October 2003 19:27, Angus Leeming wrote:
> Alfredo Braunstein wrote:
> > btw, how should we introduce source-latex only for view->dvi? a
> > latexflavour?
>
> Your pet project surfaces again? Why not try and put a few thoughts
> down on e-paper about how it might be implemented and we can knock
> some ideas around.

  Agreed, here someone proposed also something that would best implemented as 
a flavour.

  If I understand well the inverse dvi search that could be a flavour.

> Angus (back from a long w/e in a beautiful, but cold, Budapest.)

  Citing Lars (out of context, as it should be ;-), cold is on the eyes of the 
beholder. ;-)

-- 
José Abílio

LyX and docbook, a perfect match. :-)



Re: [PATCH] Inverse search update.

2003-10-20 Thread Angus Leeming
Alfredo Braunstein wrote:

> btw, how should we introduce source-latex only for view->dvi? a
> latexflavour?

Your pet project surfaces again? Why not try and put a few thoughts 
down on e-paper about how it might be implemented and we can knock 
some ideas around.

Angus (back from a long w/e in a beautiful, but cold, Budapest.)



Re: [PATCH] Inverse search update.

2003-10-19 Thread Alfredo Braunstein
Angus Leeming wrote:

> I hope that's lib/configure rather than $top/configure. The effect
> shouldn't be compiled into LyX.

Exactly. ... it would be so nice if some autoconfigure-knowledgeable good
soul had a look (existence of srcltx.sty/availiability of --source-specials
option to latex)...

> Undesirability? I get lots of warning messages when generating
> previews for a file with \usepackage{srcltx} in the preamble. Dunno
> if that's something to bear in mind or not.

I can remember vaguely some months ago having \usepackage{srcltx} choking
with revtex4. I didn't investigate though (I can try to reproduce the
errors if needed). Maybe we should put a simple opt-out checkbox for
preview latex somewhere. 

> Your suggestion (view->dvi) would fix that.

btw, how should we introduce source-latex only for view->dvi? a
latexflavour?

Alfredo




Re: [PATCH] Inverse search update.

2003-10-17 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> Undesirability? I get lots of warning messages when generating
Angus> previews for a file with \usepackage{srcltx} in the preamble.
Angus> Dunno if that's something to bear in mind or not.

Warnings about specials can usually be suppressed with -hushspecials.

JMarc


Re: [PATCH] Inverse search update.

2003-10-16 Thread John Levon
On Thu, Oct 16, 2003 at 06:54:25PM -0200, Joao Luis Meloni Assirati wrote:

> Lyx should work with a number of latex distributions, in many versions
> etc. It is hard to predict what will be the behavior of each one, and
> _maybe_ implementing a dialog like I sugested could be simpler and more
> reliable that trying to detect versions and usability (I am NOT trying to
> have my bit in the gui!:)). Anyway, as you noted, work still have to be

GUI shouldn't be added because it might be needed; it is added when it
is needed, and there is no other way.

IOW, try the auto-configuration; if people hit problems with it that
can't be fixed in the code, then we consider some GUI

regards,
john
-- 
Khendon's Law:
If the same point is made twice by the same person, the thread is over.


Re: [PATCH] Inverse search update.

2003-10-16 Thread Joao Luis Meloni Assirati

On Thu, 16 Oct 2003, Alfredo Braunstein wrote:

> Joao Luis Meloni Assirati wrote:
> > I think that the frontends should have a dialog with a tri-state
> > (radio) button as this:
> >
> > Inverse DVI search:
> >  [ ] Disable
> >  [ ] Latex option   [ --src-specials ] <- text box
> >  [ ] Package[ srcltx ] <- text box
>
> I think that we should detect the thing in configure (existence of
> srcltx.sty and latex --src-specials), and then pick one and add it when
> running latex for view->dvi but *not* for export->latex. I think that
> there's no need to add burden to the gui. When can be undesirable to have
> it? Can it collide with other packages etc? (maybe a checkbox to supress it
> after all?).

Lyx should work with a number of latex distributions, in many versions
etc. It is hard to predict what will be the behavior of each one, and
_maybe_ implementing a dialog like I sugested could be simpler and more
reliable that trying to detect versions and usability (I am NOT trying to
have my bit in the gui!:)). Anyway, as you noted, work still have to be
done so source specials are included only when viewing->dvi.

Note that direct DVI search also uses source specials, so the proposed
dialog would rather be called "DVI search", not "Inverse DVI search".

I think that passing lyxclient through the XEDITOR environment variable
(see still unapplied patch in the first email in this thread) was a good
thing, as xdvi will pick that variable if it needs, and therefore there is
no need to do any kind of detection.

João.



Re: [PATCH] Inverse search update.

2003-10-16 Thread Dekel Tsur
On Thu, Oct 16, 2003 at 07:11:34PM +0200, Alfredo Braunstein wrote:
> 
> it? Can it collide with other packages etc? (maybe a checkbox to supress it
> after all?). 

It can potentially screw up the spacing, but I don't know if this is indeed
a problem.


Re: [PATCH] Inverse search update.

2003-10-16 Thread Angus Leeming
Alfredo Braunstein wrote:

> Joao Luis Meloni Assirati wrote:
> 
>> The patch attached plus the two files socket_callback.{C,h}, that
>> must be placed under src/frontends/qt2, solve add qt support (don't
>> forget to run autogen/configure). The files socket_callback.{C,h}
>> _really_ need to be checked by someone that understands qt, as they
>> were made by pure imitation of io_callback.{C,h}.
> 
> Works beautifully. Can someone that understands qt have a look? I'm
> ready to commit this if someone gives me a go.
> 
>>> - adding \usepackage[active]{srcltx} when available/needed
>> 
>> I think that the frontends should have a dialog with a tri-state
>> (radio) button as this:
>> 
>> Inverse DVI search:
>>  [ ] Disable
>>  [ ] Latex option   [ --src-specials ] <- text box
>>  [ ] Package[ srcltx ] <- text box
> 
> I think that we should detect the thing in configure (existence of
> srcltx.sty and latex --src-specials), and then pick one and add it
> when running latex for view->dvi but *not* for export->latex. I
> think that there's no need to add burden to the gui. When can be
> undesirable to have it? Can it collide with other packages etc?
> (maybe a checkbox to supress it after all?).

I hope that's lib/configure rather than $top/configure. The effect 
shouldn't be compiled into LyX.

Undesirability? I get lots of warning messages when generating 
previews for a file with \usepackage{srcltx} in the preamble. Dunno 
if that's something to bear in mind or not.

Your suggestion (view->dvi) would fix that.

-- 
Angus



Re: [PATCH] Inverse search update.

2003-10-16 Thread Alfredo Braunstein
Joao Luis Meloni Assirati wrote:

> The patch attached plus the two files socket_callback.{C,h}, that must be
> placed under src/frontends/qt2, solve add qt support (don't forget to run
> autogen/configure). The files socket_callback.{C,h} _really_ need to be
> checked by someone that understands qt, as they were made by pure
> imitation of io_callback.{C,h}.

Works beautifully. Can someone that understands qt have a look? I'm ready to
commit this if someone gives me a go.

>> - adding \usepackage[active]{srcltx} when available/needed
> 
> I think that the frontends should have a dialog with a tri-state
> (radio) button as this:
> 
> Inverse DVI search:
>  [ ] Disable
>  [ ] Latex option   [ --src-specials ] <- text box
>  [ ] Package[ srcltx ] <- text box

I think that we should detect the thing in configure (existence of
srcltx.sty and latex --src-specials), and then pick one and add it when
running latex for view->dvi but *not* for export->latex. I think that
there's no need to add burden to the gui. When can be undesirable to have
it? Can it collide with other packages etc? (maybe a checkbox to supress it
after all?). 
 
Alfredo




Re: [PATCH] Inverse search update.

2003-10-15 Thread Joao Luis Meloni Assirati


On Wed, 15 Oct 2003, Alfredo Braunstein wrote:
>
> Things still missing:
>
> - qt support

The patch attached plus the two files socket_callback.{C,h}, that must be
placed under src/frontends/qt2, solve add qt support (don't forget to run
autogen/configure). The files socket_callback.{C,h} _really_ need to be
checked by someone that understands qt, as they were made by pure
imitation of io_callback.{C,h}.

> (well I don't understand why it has to be in a
> frontend-specific part of the code, but haven't look really)

detection of file descriptor activity must be in the toolkit main loop;
and it cannot be mage generic as xforms and qt seem to handle callbacks in
essentialy different ways.

> - adding \usepackage[active]{srcltx} when available/needed

I think that the frontends should have a dialog with a tri-state
(radio) button as this:

Inverse DVI search:
 [ ] Disable
 [ ] Latex option   [ --src-specials ] <- text box
 [ ] Package[ srcltx ] <- text box

Where the text boxes get activacted when the corresponding button is
enabled, and can be changed accordingly.

> Other than that, it's a fantastic feature.

It will be complete with direct dvi search that is as useful as inverse.

Regards,
João.
Index: src/frontends/qt2/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/ChangeLog,v
retrieving revision 1.599
diff -u -r1.599 ChangeLog
--- src/frontends/qt2/ChangeLog	2003/10/14 21:30:20	1.599
+++ src/frontends/qt2/ChangeLog	2003/10/15 21:33:41
@@ -1,3 +1,11 @@
+2003-10-15  João Luis Meloni Assirati  <[EMAIL PROTECTED]>
+
+	* {set,remove}_{server,data}socket_callback(): Working functions
+
+	* socket_callback.[Ch]: new files with a class to connect sockets
+
+	* Makefile.dialogs: add the above
+
 2003-10-14  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* lyx_gui.C (start): store the LyXView in the LyX list of all LyXViews.
Index: src/frontends/qt2/Makefile.dialogs
===
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/Makefile.dialogs,v
retrieving revision 1.44
diff -u -r1.44 Makefile.dialogs
--- src/frontends/qt2/Makefile.dialogs	2003/07/25 18:10:34	1.44
+++ src/frontends/qt2/Makefile.dialogs	2003/10/15 21:33:41
@@ -122,4 +122,5 @@
 	QURLDialog.C QURLDialog.h \
 	QVCLogDialog.C QVCLogDialog.h \
 	QWrapDialog.C QWrapDialog.h \
-	QLToolbar.C QLToolbar.h
+	QLToolbar.C QLToolbar.h \
+	socket_callback.C socket_callback.h
Index: src/frontends/qt2/lyx_gui.C
===
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/lyx_gui.C,v
retrieving revision 1.58
diff -u -r1.58 lyx_gui.C
--- src/frontends/qt2/lyx_gui.C	2003/10/14 21:30:21	1.58
+++ src/frontends/qt2/lyx_gui.C	2003/10/15 21:33:42
@@ -40,6 +40,7 @@
 #include "QLImage.h"
 #include "qfont_loader.h"
 #include "io_callback.h"
+#include "socket_callback.h"
 #include "lcolorcache.h"
 
 #include 
@@ -70,6 +71,7 @@
 }
 
 map io_callbacks;
+map socket_callbacks;
 
 } // namespace anon
 
@@ -177,6 +179,7 @@
 
 void exit()
 {
+	delete lyxsocket;
 	delete lyxserver;
 	lyxserver = 0;
 
@@ -247,22 +250,35 @@
 	}
 }
 
-
-void set_datasocket_callback(LyXDataSocket * /* p */)
-{}
-
-
-void remove_datasocket_callback(LyXDataSocket * /* p */)
-{}
 
+void set_datasocket_callback(LyXDataSocket * p)
+{
+	socket_callbacks[p->fd()] = new socket_callback(p);
+}
 
-void set_serversocket_callback(LyXServerSocket * /* p */)
-{}
+void set_serversocket_callback(LyXServerSocket * p)
+{
+	socket_callbacks[p->fd()] = new socket_callback(p);
+}
 
+void remove_socket_callback(int fd)
+{
+	map::iterator it = socket_callbacks.find(fd);
+	if (it != socket_callbacks.end()) {
+		delete it->second;
+		socket_callbacks.erase(it);
+	}
+}
 
-void remove_serversocket_callback(LyXServerSocket * /* p */)
-{}
+void remove_datasocket_callback(LyXDataSocket * p)
+{
+	remove_socket_callback(p->fd());
+}
 
+void remove_serversocket_callback(LyXServerSocket * p)
+{
+	remove_socket_callback(p->fd());
+}
 
 string const roman_font_name()
 {
// -*- C++ -*-
/**
 * \file io_callback.h
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author unknown
 * \author John Levon
 *
 * Full author contact details are available in file CREDITS.
 */

#ifndef SOCKET_CALLBACK_H
#define SOCKET_CALLBACK_H


#include 
#include 
#include 

class LyXServerSocket;
class LyXDataSocket;

/**
 * socket_callback - a simple wrapper for asynchronous pipe notification
 *
 * This is used by the lyxsocket to notice the sockets is ready to be
 * connected/read.
 *
 * FIXME: this code apparently will not work on Windows.
 */
class socket_callback : public QObject {
	Q_OBJECT
public:
	/// connect a connection notification from the LyXServerSocket
	socket_callback(LyXServerSocket * server);
	socket_callback(LyXDataSocket * data);
public slots:
	void server_received();
	void data_received();
p

Re: [PATCH] Inverse search update.

2003-10-15 Thread Alfredo Braunstein
Joao Luis Meloni Assirati wrote:

> And finaly Angus, as promised, lyxclient.man. Can someone check my
> horrible english?

Your english is not worse than mine (but that means nothing so no help here)

The patch works as advertised. Can I apply it (or someone else)?

Unfortunately, my xdvi (stock rh9) seems to have no support for source latex
(it's not a -editor problem). So only tested with kdvi. Works fine.

Things still missing: 

- qt support (well I don't understand why it has to be in a
frontend-specific part of the code, but haven't look really)

- adding \usepackage[active]{srcltx} when available/needed

Other than that, it's a fantastic feature.

Regards, Alfredo




[PATCH] Inverse search update.

2003-10-14 Thread Joao Luis Meloni Assirati

Hello all,

These patches implement the idea of seting the socket address using
environment variables.

putenv.diff is a necessary patch to putenv. Environment variables must
be allocated.

export-socket.diff makes LyXSocketServer export the variables XEDITOR (for
xdvi) and LYXSOCKET (for lyxclient). With it, the DVI viewer doesn't need
to be called with the -editor switch. This is good as not all versions of
xdvi support it. Also, seting LYXSOCKET makes it possible to use
inverse dvi search with kdvi, just set the editor as 'lyxclient -g %f %l'.

lyxclient.diff adjust lyxclient to use LYXSOCKET environment variable.

And finaly Angus, as promised, lyxclient.man. Can someone check my
horrible english?

Regards,
João.


putenv.diff.gz
Description: Binary data


export-socket.diff.gz
Description: Binary data


lyxclient.diff.gz
Description: Binary data


lyxclient.man.gz
Description: Binary data