mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
skak support, John's ERT fixes, loclae blunder fix
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2955 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
48a3633de7
commit
60ca300e1d
@ -1,3 +1,9 @@
|
||||
2001-10-30 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* 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 <moz@compsoc.man.ac.uk>
|
||||
|
||||
* Makefile.am: remove BUGS.lyx mention
|
||||
@ -6,6 +12,21 @@
|
||||
|
||||
* ui/default.ui: remove Known Bugs entry
|
||||
|
||||
2001-10-28 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* 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 <kayvan@sylvan.com>
|
||||
|
||||
* 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 <jamatos@fep.up.pt>
|
||||
|
||||
* layouts/db_lyxmacros.inc:
|
||||
|
@ -19,7 +19,7 @@ KBD = kbd/*.kmap kbd/*.cdef
|
||||
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
|
||||
|
@ -99,21 +99,21 @@ Template ChessDiagram
|
||||
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{$$FPath/$$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]"
|
||||
|
48
lib/scripts/fen2ascii.py
Normal file
48
lib/scripts/fen2ascii.py
Normal file
@ -0,0 +1,48 @@
|
||||
#!/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 an ascii representation of the position.
|
||||
#
|
||||
|
||||
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]
|
||||
|
||||
line=string.split(line,' ')[0]
|
||||
comp=string.split(line,'/')
|
||||
|
||||
cont=1
|
||||
margin= " "*6
|
||||
|
||||
print margin+' +'+"-"*15+'+'
|
||||
for i in range(8):
|
||||
|
||||
cont = cont + 1
|
||||
tmp=""
|
||||
for j in comp[i]:
|
||||
if j>='0' and j <= '9':
|
||||
for k in range(int(j)):
|
||||
cont = cont + 1
|
||||
x, mod = divmod(cont,2)
|
||||
if mod : tmp = tmp + '| '
|
||||
else : tmp = tmp + '|*'
|
||||
else :
|
||||
tmp = tmp + '|' + j
|
||||
cont = cont + 1
|
||||
|
||||
row = 8 - i
|
||||
print margin, row, tmp+"|"
|
||||
|
||||
print margin+' +'+"-"*15+'+'
|
||||
print margin+' a b c d e f g h '
|
@ -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 @@ line = sys.stdin.readline()
|
||||
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(int(j)):
|
||||
cont = cont + 1
|
||||
x, mod = divmod(cont,2)
|
||||
if mod : tmp = tmp + ' '
|
||||
else : tmp = tmp + '*'
|
||||
else :
|
||||
tmp = tmp + j
|
||||
cont = cont + 1
|
||||
|
||||
if first:
|
||||
first = 0
|
||||
print "\\board{"+tmp+"}"
|
||||
else :
|
||||
print margin+"{"+tmp+"}"
|
||||
|
||||
print "\\fenboard{"+line+"}"
|
||||
print "\\showboard%"
|
||||
|
||||
|
1575
lib/tex/lyxskak.sty
Normal file
1575
lib/tex/lyxskak.sty
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,6 +7,15 @@
|
||||
|
||||
* lyx_main.C: change ref to known bugs
|
||||
|
||||
2001-10-30 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* LaTeXFeatures.C (getPackages): Use lyxskak.sty now instead
|
||||
to work around older babel problems.
|
||||
|
||||
2001-10-28 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* LaTeXFeatures.[hC]: Now uses skak.sty for chess material.
|
||||
|
||||
2001-10-24 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* tabular-old.C (ReadOld): below variable changes reflected.
|
||||
|
@ -189,9 +189,9 @@ string const LaTeXFeatures::getPackages() const
|
||||
// packages << "\\usepackage{algorithm}\n";
|
||||
//}
|
||||
|
||||
// lyxchess.sty
|
||||
// lyxskak.sty --- newer chess support based on skak.sty
|
||||
if (chess) {
|
||||
packages << "\\usepackage{lyxchess}\n";
|
||||
packages << "\\usepackage[ps,mover]{lyxskak}\n";
|
||||
}
|
||||
|
||||
// setspace.sty
|
||||
|
@ -94,7 +94,7 @@ struct LaTeXFeatures {
|
||||
///
|
||||
bool prettyref; // prettyref.sty
|
||||
///
|
||||
bool chess; // chess.sty
|
||||
bool chess; // skak.sty (new chess support)
|
||||
///
|
||||
bool natbib; // natbib.sty
|
||||
///
|
||||
|
@ -71,10 +71,10 @@ void gettext_init(string const & localedir)
|
||||
|
||||
void locale_init()
|
||||
{
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
|
||||
void gettext_init(string const &)
|
||||
{
|
||||
setlocale(LC_NUMERIC, "C");
|
||||
}
|
||||
#endif
|
||||
|
@ -1,3 +1,13 @@
|
||||
2001-10-30 John Levon <moz@compsoc.man.ac.uk>
|
||||
|
||||
* insetert.h:
|
||||
* insetert.C: fix some problems
|
||||
|
||||
2001-10-30 Kayvan A. Sylvan <kayvan@sylvan.com>
|
||||
|
||||
* insetexternal.C (doSubstitution): Added $$FPath token
|
||||
to list of usable substitutions in external inset templates.
|
||||
|
||||
2001-10-24 Juergen Vigna <jug@sad.it>
|
||||
|
||||
* insettabular.C: use new ltType struct for setting longtable
|
||||
|
@ -238,16 +238,25 @@ void InsetERT::setFont(BufferView *, LyXFont const &, bool, bool selectall)
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
void InsetERT::updateStatus(BufferView * bv, bool swap) const
|
||||
{
|
||||
InsetCollapsable::edit(bv, x, y, button);
|
||||
if (status_ != Inlined) {
|
||||
if (collapsed_) {
|
||||
status(0, Collapsed);
|
||||
status(bv, swap ? Open : Collapsed);
|
||||
} else {
|
||||
status(0, Open);
|
||||
status(bv, swap ? Collapsed : Open);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetERT::edit(BufferView * bv, int x, int y, unsigned int button)
|
||||
{
|
||||
if (button == 3)
|
||||
return;
|
||||
|
||||
InsetCollapsable::edit(bv, x, y, button);
|
||||
updateStatus(0);
|
||||
set_latex_font(bv);
|
||||
}
|
||||
|
||||
@ -263,13 +272,7 @@ Inset::EDITABLE InsetERT::editable() const
|
||||
void InsetERT::edit(BufferView * bv, bool front)
|
||||
{
|
||||
InsetCollapsable::edit(bv, front);
|
||||
if (status_ != Inlined) {
|
||||
if (collapsed_) {
|
||||
status(0, Collapsed);
|
||||
} else {
|
||||
status(0, Open);
|
||||
}
|
||||
}
|
||||
updateStatus(0);
|
||||
set_latex_font(bv);
|
||||
}
|
||||
|
||||
@ -280,33 +283,22 @@ void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
||||
showInsetDialog(bv);
|
||||
return;
|
||||
}
|
||||
if ((x >= 0) && (x < button_length) &&
|
||||
(y >= button_top_y) && (y <= button_bottom_y))
|
||||
{
|
||||
// if (collapsed_) {
|
||||
// setLabel(_("ERT"));
|
||||
// } else {
|
||||
// setLabel(get_new_label());
|
||||
// }
|
||||
if (collapsed_) {
|
||||
status(bv, Open);
|
||||
// collapsed_ = false;
|
||||
// inset.insetButtonRelease(bv, 0, 0, button);
|
||||
// inset.setUpdateStatus(bv, InsetText::FULL);
|
||||
// bv->updateInset(this, true);
|
||||
} else {
|
||||
status(bv, Collapsed);
|
||||
// collapsed_ = true;
|
||||
// bv->unlockInset(this);
|
||||
// bv->updateInset(this, true);
|
||||
}
|
||||
} else if (!collapsed_ && (y > button_bottom_y)) {
|
||||
|
||||
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
|
||||
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||
updateStatus(bv, true);
|
||||
} else {
|
||||
LyXFont font(LyXFont::ALL_SANE);
|
||||
int yy = ascent(bv, font) + y -
|
||||
(ascent_collapsed() +
|
||||
descent_collapsed() +
|
||||
inset.ascent(bv, font));
|
||||
inset.insetButtonRelease(bv, x, yy, button);
|
||||
int yy = ascent(bv, font) + y - inset.ascent(bv, font);
|
||||
|
||||
// inlined is special - the text appears above
|
||||
// button_bottom_y
|
||||
if (status_ == Inlined) {
|
||||
inset.insetButtonRelease(bv, x, yy, button);
|
||||
} else if (!collapsed_ && (y > button_bottom_y)) {
|
||||
yy -= (ascent_collapsed() + descent_collapsed());
|
||||
inset.insetButtonRelease(bv, x, yy, button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,10 @@
|
||||
/** A collapsable text inset for LaTeX insertions.
|
||||
|
||||
To write full ert (including styles and other insets) in a given
|
||||
space.
|
||||
space.
|
||||
|
||||
Note that collapsed_ encompasses both the inline and collapsed button
|
||||
versions of this inset.
|
||||
*/
|
||||
class InsetERT : public InsetCollapsable {
|
||||
public:
|
||||
@ -93,6 +96,10 @@ public:
|
||||
///
|
||||
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
||||
///
|
||||
bool inlined() const { return status_ == Inlined; }
|
||||
///
|
||||
ERTStatus status() const { return status_; }
|
||||
///
|
||||
void open(BufferView *);
|
||||
///
|
||||
void close(BufferView *) const;
|
||||
@ -100,8 +107,6 @@ public:
|
||||
bool allowSpellcheck() { return false; }
|
||||
string const selectNextWordToSpellcheck(BufferView *, float &) const;
|
||||
///
|
||||
bool inlined() const { return status_ == Inlined; }
|
||||
///
|
||||
int ascent(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
int descent(BufferView *, LyXFont const &) const;
|
||||
@ -109,9 +114,7 @@ public:
|
||||
int width(BufferView *, LyXFont const &) const;
|
||||
///
|
||||
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
||||
///
|
||||
ERTStatus status() const { return status_; }
|
||||
///
|
||||
/// set the status of the inset
|
||||
void status(BufferView *, ERTStatus const st) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
@ -125,6 +128,8 @@ private:
|
||||
void setButtonLabel() const;
|
||||
///
|
||||
void set_latex_font(BufferView *);
|
||||
/// update status on button
|
||||
void updateStatus(BufferView *, bool = false) const;
|
||||
|
||||
///
|
||||
mutable ERTStatus status_;
|
||||
|
@ -235,9 +235,11 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
|
||||
{
|
||||
string result;
|
||||
string const basename = ChangeExtension(params_.filename, string());
|
||||
string const filepath = OnlyPath(MakeAbsPath(params_.filename));
|
||||
result = subst(s, "$$FName", params_.filename);
|
||||
result = subst(result, "$$Basename", basename);
|
||||
result = subst(result, "$$Parameters", params_.parameters);
|
||||
result = subst(result, "$$FPath", filepath);
|
||||
result = ReplaceEnvironmentPath(result);
|
||||
result = subst(result, "$$Tempname", tempname_);
|
||||
result = subst(result, "$$Sysdir", system_lyxdir);
|
||||
|
Loading…
Reference in New Issue
Block a user