Re: New chess (skak.sty) support (IGNORE PREVIOUS)

2001-10-31 Thread Jean-Marc Lasgouttes

> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> This is a bug fix to the way the file path is generated
Kayvan> (currently, since we use params_.filename, LyX will always
Kayvan> return the directory from which it was launched as opposed to
Kayvan> the actual path to the file).

Kayvan> Also, we don't want to embed the full path when exporting a
Kayvan> nice LaTeX file.

I'll appl;y it.

Kayvan> Please add in the example files (and change lib/Makefile to
Kayvan> include the *.fen files) from
Kayvan> ftp://ftp.sylvan.com/pub/lyx/devel/chess

Do I really need to add the pdf file??

Kayvan> I have tested all of this on old and new tetex installations.

Thanks.

JMarc



Re: New chess (skak.sty) support (IGNORE PREVIOUS)

2001-10-31 Thread Kayvan A. Sylvan

On Wed, Oct 31, 2001 at 04:24:37PM +0100, Jean-Marc Lasgouttes wrote:
> > "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:
> 
> Kayvan> Sorry. Here is a much smaller file.
> 
> Applied.

Thank you.

This is a bug fix to the way the file path is generated (currently,
since we use params_.filename, LyX will always return the directory from
which it was launched as opposed to the actual path to the file).

Also, we don't want to embed the full path when exporting a nice LaTeX file.

Please add in the example files (and change lib/Makefile to
include the *.fen files) from ftp://ftp.sylvan.com/pub/lyx/devel/chess

I have tested all of this on old and new tetex installations.

---Kayvan
-- 
Kayvan A. Sylvan  | Proud husband of   | Father to my kids:
Sylvan Associates, Inc.   | Laura Isabella Sylvan  | Katherine Yelena (8/8/89)
http://sylvan.com/~kayvan | "crown of her husband" | Robin Gregory (2/28/92)


? src/version_info.h
Index: lib/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/lib/ChangeLog,v
retrieving revision 1.122
diff -u -r1.122 ChangeLog
--- lib/ChangeLog   2001/10/31 15:19:48 1.122
+++ lib/ChangeLog   2001/10/31 16:25:36
@@ -1,3 +1,8 @@
+2001-10-31  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * external_templates: Minor tweak. Changed $$FPath/$$Basename
+   to $$FPath$$Basename.
+
 2001-10-30  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
 
* external_templates: Fix up the help message for ChessDiagram
Index: lib/external_templates
===
RCS file: /cvs/lyx/lyx-devel/lib/external_templates,v
retrieving revision 1.5
diff -u -r1.5 external_templates
--- lib/external_templates  2001/10/31 15:19:48 1.5
+++ lib/external_templates  2001/10/31 16:25:36
@@ -108,7 +108,7 @@
EditCommand "xboard -lpf $$FName -mode EditPosition"
AutomaticProduction true
Format LaTeX
-   Product "\\loadgame{$$FPath/$$Basename}\\showboard"
+   Product "\\loadgame{$$FPath$$Basename}\\showboard"
Requirement "chess"
FormatEnd
Format Ascii
Index: src/insets/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/src/insets/ChangeLog,v
retrieving revision 1.214
diff -u -r1.214 ChangeLog
--- src/insets/ChangeLog2001/10/31 15:19:49 1.214
+++ src/insets/ChangeLog2001/10/31 16:25:37
@@ -1,3 +1,10 @@
+2001-10-31  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * insetexternal.C (doSubstitution): Fix filepath ($$FPath in
+   external_templates) to use the buffer->fileName() but only if
+   previewing. Generating a TeX file should make FPath return
+   "".
+
 2001-10-30  John Levon  <[EMAIL PROTECTED]>
 
* insetert.h:
Index: src/insets/insetexternal.C
===
RCS file: /cvs/lyx/lyx-devel/src/insets/insetexternal.C,v
retrieving revision 1.32
diff -u -r1.32 insetexternal.C
--- src/insets/insetexternal.C  2001/10/31 15:19:49 1.32
+++ src/insets/insetexternal.C  2001/10/31 16:25:37
@@ -235,7 +235,10 @@
 {
string result;
string const basename = ChangeExtension(params_.filename, string());
-   string const filepath = OnlyPath(MakeAbsPath(params_.filename));
+   string filepath = "";
+   if (buffer && (!buffer->niceFile)) {
+   filepath = OnlyPath(MakeAbsPath(buffer->fileName()));
+   }
result = subst(s, "$$FName", params_.filename);
result = subst(result, "$$Basename", basename);
result = subst(result, "$$Parameters", params_.parameters);



Re: New chess (skak.sty) support (IGNORE PREVIOUS)

2001-10-31 Thread Jean-Marc Lasgouttes

> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> Sorry. Here is a much smaller file.

Applied.

JMarc



Re: New chess (skak.sty) support (IGNORE PREVIOUS)

2001-10-31 Thread Jean-Marc Lasgouttes

> "Kayvan" == Kayvan A Sylvan <[EMAIL PROTECTED]> writes:

Kayvan> On Tue, Oct 30, 2001 at 11:11:42AM -0800, Kayvan A. Sylvan
Kayvan> wrote:
>>  I submit my chess patch again. Please apply this. It's quite
>> limited in scope and won't break anything else. ;-)

Kayvan> Ugh. I just noticed all the *.po file garbage in my patch
Kayvan> file.

Kayvan> Sorry. Here is a much smaller file.

Not that I am unwilling to apply it, but I am not sure we want a
lyxskak.sty:

- this file in itself is not enough to make things work afaik, since
  it also needs font and packages.

- what about contacting the author of skak.sty and asking him to
  update his package? I would be better to ask people to get the
  latest version rather than hack one just for our own use. 

- I could not find your original message about the errors you are
  getting. What is the reason why babel redefinition of ifthenelse was
  bad? I'd guess that skak uses ifthenelse in a strange way...

Also, I do not like much your $$lyxfilepath variable, so I'll change
it to $$Path.

JMarc



Re: New chess (skak.sty) support (IGNORE PREVIOUS)

2001-10-30 Thread Kayvan A. Sylvan

On Tue, Oct 30, 2001 at 11:11:42AM -0800, Kayvan A. Sylvan wrote:
> 
> I submit my chess patch again. Please apply this. It's quite limited
> in scope and won't break anything else. ;-)
> 
>   ---Kayvan

Ugh. I just noticed all the *.po file garbage in my patch file.

Sorry. Here is a much smaller file.


? lib/scripts/fen2ascii.py
? lib/tex/lyxskak.sty
? src/version_info.h
Index: lib/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/lib/ChangeLog,v
retrieving revision 1.121
diff -u -r1.121 ChangeLog
--- lib/ChangeLog   2001/10/30 17:05:57 1.121
+++ lib/ChangeLog   2001/10/30 19:17:59
@@ -1,3 +1,9 @@
+2001-10-30  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * external_templates: Fix up the help message for ChessDiagram
+   again (referring to the new lyxskak.sty). Reworked the LaTeX
+   output to use skak.sty \loadgame{file} feature.
+
 2001-10-30  John Levon  <[EMAIL PROTECTED]>
 
* Makefile.am: remove BUGS.lyx mention
@@ -6,6 +12,21 @@
 
* ui/default.ui: remove Known Bugs entry
  
+2001-10-28  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * scripts/fen2latex.py: Simplified greatly. Now uses skak.
+   
+   * scripts/fen2ascii.py: New file added. Makes a nice ascii
+   representation of the chess position.
+
+2001-10-28  Kayvan A. Sylvan  <[EMAIL PROTECTED]>
+
+   * external_templates: Changed comment to inform user to use skak
+   package instead of the very old chess.sty for external chess
+   material. Added the -mode EditPosition flag to the "xboard"
+   invocation. Fixed the invocation of fen2ascii (which did *not*
+   exist, even though it was referenced).
+
 2001-10-24  José Matos  <[EMAIL PROTECTED]>
 
* layouts/db_lyxmacros.inc:
Index: lib/Makefile.am
===
RCS file: /cvs/lyx/lyx-devel/lib/Makefile.am,v
retrieving revision 1.29
diff -u -r1.29 Makefile.am
--- lib/Makefile.am 2001/10/30 17:05:57 1.29
+++ lib/Makefile.am 2001/10/30 19:17:59
@@ -19,7 +19,7 @@
 LAYOUT = layouts/*.layout layouts/*.inc 
 LYXSCRIPTS = configure configure.cmd scripts/*
 TEMPL = templates/*.lyx
-TEXSUPPORT = tex/*.cls
+TEXSUPPORT = tex/*.cls tex/*.sty
 UI = ui/*.ui
 
 configure: configure.m4
Index: lib/external_templates
===
RCS file: /cvs/lyx/lyx-devel/lib/external_templates,v
retrieving revision 1.4
diff -u -r1.4 external_templates
--- lib/external_templates  2000/06/20 07:58:10 1.4
+++ lib/external_templates  2001/10/30 19:17:59
@@ -99,21 +99,21 @@
remember to middle and right click to 
insert new material in the board.
In order for this to work, you have to
-   install the lyxchess.sty which is bundled
-   with LyX, and the chess.sty from CTAN.
+   put the bundled lyxskak.sty in a place
+   that TeX will find it, and you will need
+   to install the skak package from CTAN.
HelpTextEnd
FileFilter "*.fen"
ViewCommand "xboard -lpf $$FName"
-   EditCommand "xboard -lpf $$FName"
+   EditCommand "xboard -lpf $$FName -mode EditPosition"
AutomaticProduction true
Format LaTeX
-   Product "$$Contents(\"$$Basename.tex\")"
-   UpdateCommand "python $$Sysdir/scripts/fen2latex.py $$FName 
$$Basename.tex"
+   Product "\\loadgame{$$lyxfilepath/$$Basename}\\showboard"
Requirement "chess"
FormatEnd
Format Ascii
Product "$$Contents(\"$$Basename.asc\")"
-   UpdateCommand "python $$Sysdir/scripts/fen2ascii.py $$FName 
$$Basename.tex"
+   UpdateCommand "python $$Sysdir/scripts/fen2ascii.py $$FName 
+$$Basename.asc"
FormatEnd
Format DocBook
Product "[Chess: $$Basename]"
Index: lib/scripts/fen2latex.py
===
RCS file: /cvs/lyx/lyx-devel/lib/scripts/fen2latex.py,v
retrieving revision 1.1
diff -u -r1.1 fen2latex.py
--- lib/scripts/fen2latex.py2000/06/12 11:27:08 1.1
+++ lib/scripts/fen2latex.py2001/10/30 19:17:59
@@ -1,11 +1,11 @@
 #!/usr/bin/python
 #
-# Copyright (C) 2000 The LyX Team.
+# Copyright (C) 2001 The LyX Team.
 #
 # This file is distributed under the GPL license.
 #
 # This script will convert a chess position in the FEN
-# format to a chunk of LaTeX to be used with the chess.sty
+# format to a chunk of LaTeX to be used with the skak.sty
 # style.
 
 import sys,string,os
@@ -19,33 +19,6 @@
 if line[-1] == '\n':
 line = line[:-1]
 
-line=string.split(line,' ')[0]
-comp=string.split(line,'/')
-
-first = 1
-cont=1
-margin= " "*6
-
-for i in range(8):
-
-cont = cont + 1
-tmp=""
-for j in comp[i]:
-   if j>='0' and j <= '9':
-   for k in range(