From 44b7b7fc71ee64a6febdd20bd35d5b4db9cab2a0 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Wed, 31 Oct 2001 17:16:35 +0000 Subject: [PATCH] more skak tweaks git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2957 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 12 ++ lib/examples/chessgame.lyx | 255 +++++++++++++++++++++++++++++++++++++ lib/examples/iecc05.fen | 1 + lib/examples/iecc07.fen | 1 + lib/examples/iecc12.fen | 1 + lib/external_templates | 2 +- lib/scripts/fen2latex.py | 24 ---- src/insets/ChangeLog | 7 + src/insets/insetexternal.C | 5 +- 9 files changed, 282 insertions(+), 26 deletions(-) create mode 100644 lib/examples/chessgame.lyx create mode 100644 lib/examples/iecc05.fen create mode 100644 lib/examples/iecc07.fen create mode 100644 lib/examples/iecc12.fen delete mode 100644 lib/scripts/fen2latex.py diff --git a/lib/ChangeLog b/lib/ChangeLog index dc6ccecba6..f6577abe55 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,15 @@ +2001-10-31 Jean-Marc Lasgouttes + + * examples/iecc05.fen: + * examples/iecc07.fen: + * examples/iecc12.fen: + * lib/examples/chessgame.lyx: an example for the new chess support. + +2001-10-31 Kayvan A. Sylvan + + * external_templates: Minor tweak. Changed $$FPath/$$Basename + to $$FPath$$Basename. + 2001-10-30 Kayvan A. Sylvan * external_templates: Fix up the help message for ChessDiagram diff --git a/lib/examples/chessgame.lyx b/lib/examples/chessgame.lyx new file mode 100644 index 0000000000..68ed6592dd --- /dev/null +++ b/lib/examples/chessgame.lyx @@ -0,0 +1,255 @@ +#LyX 1.2 created this file. For more info see http://www.lyx.org/ +\lyxformat 220 +\textclass article +\begin_preamble +\usepackage{chess-workshop-symbols} +\end_preamble +\language english +\inputencoding auto +\fontscheme default +\graphics default +\paperfontsize 12 +\spacing single +\papersize letterpaper +\paperpackage a4 +\use_geometry 1 +\use_amsmath 0 +\use_natbib 0 +\use_numerical_citations 0 +\paperorientation portrait +\topmargin 0in +\bottommargin 0.5in +\headheight 0in +\headsep 0in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation skip +\defskip smallskip +\quotes_language english +\quotes_times 2 +\papercolumns 2 +\papersides 1 +\paperpagestyle empty + +\layout Title + +Email Chess Game analyzed +\layout Author + +Kayvan A. + Sylvan +\newline + +\layout Date + + +\emph on +Game start 05/29/2001 +\layout Standard + +The following game was played at the IECC (International Email Chess Club). + It is presented as an example of the fun you can have with LyX's new chess + support. + You must have xboard installed on your machine to be able to open and view + the chess positions from LyX. +\layout Standard +\line_top \line_bottom + +\noun on +Sylvan, Kayvan +\hfill +Wakeham, Marc +\newline +(1623) +\hfill +(1639) +\layout Standard + + +\begin_inset ERT +status Open + +\layout Standard + +\backslash +newgame +\backslash +smallboard% +\layout Standard + +\backslash +mainline{1. e4 c5 2. Nc3 d6 3. g3 Nc6 4. Bg2 e6 5. Nge2} +\end_inset + + +\layout Standard +\added_space_top medskip + +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +[ +\end_inset + + +\begin_inset External ChessDiagram,"iecc05.fen","" + +\end_inset + + +\begin_inset ERT +status Inlined + +\layout Standard + +\backslash +] +\backslash +printknightmove{g1}{e2} +\backslash +highlight{d4,f4} +\end_inset + + +\layout Standard + +So far, so good. + This is all according to theory. +\layout Standard + + +\begin_inset ERT +status Open + +\layout Standard + +\backslash +mainline{5... Be7?!} +\backslash +variation{5... Nge7} +\backslash +equal % +\layout Standard + +\backslash +mainline{6. d4 cxd4 7. Nxd4 a6} +\end_inset + + +\layout Standard + +With 7...\SpecialChar ~ +a6, we are back in the well-trodden theory of this opening. +\layout Standard + + +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +[ +\end_inset + + +\begin_inset External ChessDiagram,"iecc07.fen","" + +\end_inset + + +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +] +\end_inset + + +\layout Standard + + +\begin_inset ERT +status Open + +\layout Standard + +\backslash +mainline{8. Nxc6 bxc6 9. O-O Bb7 10. Qg4 Bf6 11. Bf4 Ne7 12. Rad1} +\end_inset + + +\layout Standard + + +\begin_inset ERT +status Collapsed + +\layout Standard + +\backslash +[ +\end_inset + + +\begin_inset External ChessDiagram,"iecc12.fen","" + +\end_inset + + +\begin_inset ERT +status Inlined + +\layout Standard + +\backslash +] +\backslash +printarrow{a1}{d1} +\end_inset + + +\layout Standard + +White continues to develop pieces and also sets a trap for Black. +\layout Standard + + +\begin_inset ERT +status Open + +\layout Standard + +\backslash +mainline{12... O-O?} This loses instantly. +\layout Standard +Best was +\backslash +variation{12... e5 13. Be3 Qc7 14. Na4 O-O} +\backslash +wbetter +\layout Standard + +\backslash +mainline{13. e5!} Black's knight and bishop form a bumbling pair here, the Bishop is doomed. +\layout Standard + +\backslash +mainline{13... Nd5!? 14. Bxd5 cxd5 15. exf6 Qxf6 16. Bxd6 Rfd8 17. Bc7 Rd7 18. Bf4 1-0 }% +\layout Standard + +\backslash +[ +\backslash +showboard +\backslash +] +\end_inset + + +\the_end diff --git a/lib/examples/iecc05.fen b/lib/examples/iecc05.fen new file mode 100644 index 0000000000..bd120ec128 --- /dev/null +++ b/lib/examples/iecc05.fen @@ -0,0 +1 @@ +r1bqkbnr/pp3ppp/2npp3/2p5/4P3/2N3P1/PPPPNPBP/R1BQK2R b KQkq - 0 5 diff --git a/lib/examples/iecc07.fen b/lib/examples/iecc07.fen new file mode 100644 index 0000000000..e631996830 --- /dev/null +++ b/lib/examples/iecc07.fen @@ -0,0 +1 @@ +r1bqk1nr/1p2bppp/p1npp3/8/3NP3/2N3P1/PPP2PBP/R1BQK2R w KQkq - 0 8 diff --git a/lib/examples/iecc12.fen b/lib/examples/iecc12.fen new file mode 100644 index 0000000000..1f827c3052 --- /dev/null +++ b/lib/examples/iecc12.fen @@ -0,0 +1 @@ +r2qk2r/1b2nppp/p1pppb2/8/4PBQ1/2N3P1/PPP2PBP/3R1RK1 b kq - 0 12 diff --git a/lib/external_templates b/lib/external_templates index 91efbb8d66..28760b22d8 100644 --- a/lib/external_templates +++ b/lib/external_templates @@ -108,7 +108,7 @@ Template ChessDiagram 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 diff --git a/lib/scripts/fen2latex.py b/lib/scripts/fen2latex.py deleted file mode 100644 index eb5d426a65..0000000000 --- a/lib/scripts/fen2latex.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python -# -# 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 skak.sty -# style. - -import sys,string,os - -os.close(0) -os.close(1) -sys.stdin = open(sys.argv[1],"r") -sys.stdout = open(sys.argv[2],"w") - -line = sys.stdin.readline() -if line[-1] == '\n': - line = line[:-1] - -print "\\fenboard{"+line+"}" -print "\\showboard%" - diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index ace8d765b4..a4b2e950f9 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,10 @@ +2001-10-31 Kayvan A. Sylvan + + * 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 * insetert.h: diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 6870de8fb8..6fb09380e7 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -235,7 +235,10 @@ string const InsetExternal::doSubstitution(Buffer const * buffer, { 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);