mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +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>
|
2001-10-30 John Levon <moz@compsoc.man.ac.uk>
|
||||||
|
|
||||||
* Makefile.am: remove BUGS.lyx mention
|
* Makefile.am: remove BUGS.lyx mention
|
||||||
@ -6,6 +12,21 @@
|
|||||||
|
|
||||||
* ui/default.ui: remove Known Bugs entry
|
* 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>
|
2001-10-24 José Matos <jamatos@fep.up.pt>
|
||||||
|
|
||||||
* layouts/db_lyxmacros.inc:
|
* layouts/db_lyxmacros.inc:
|
||||||
|
@ -19,7 +19,7 @@ KBD = kbd/*.kmap kbd/*.cdef
|
|||||||
LAYOUT = layouts/*.layout layouts/*.inc
|
LAYOUT = layouts/*.layout layouts/*.inc
|
||||||
LYXSCRIPTS = configure configure.cmd scripts/*
|
LYXSCRIPTS = configure configure.cmd scripts/*
|
||||||
TEMPL = templates/*.lyx
|
TEMPL = templates/*.lyx
|
||||||
TEXSUPPORT = tex/*.cls
|
TEXSUPPORT = tex/*.cls tex/*.sty
|
||||||
UI = ui/*.ui
|
UI = ui/*.ui
|
||||||
|
|
||||||
configure: configure.m4
|
configure: configure.m4
|
||||||
|
@ -99,21 +99,21 @@ Template ChessDiagram
|
|||||||
remember to middle and right click to
|
remember to middle and right click to
|
||||||
insert new material in the board.
|
insert new material in the board.
|
||||||
In order for this to work, you have to
|
In order for this to work, you have to
|
||||||
install the lyxchess.sty which is bundled
|
put the bundled lyxskak.sty in a place
|
||||||
with LyX, and the chess.sty from CTAN.
|
that TeX will find it, and you will need
|
||||||
|
to install the skak package from CTAN.
|
||||||
HelpTextEnd
|
HelpTextEnd
|
||||||
FileFilter "*.fen"
|
FileFilter "*.fen"
|
||||||
ViewCommand "xboard -lpf $$FName"
|
ViewCommand "xboard -lpf $$FName"
|
||||||
EditCommand "xboard -lpf $$FName"
|
EditCommand "xboard -lpf $$FName -mode EditPosition"
|
||||||
AutomaticProduction true
|
AutomaticProduction true
|
||||||
Format LaTeX
|
Format LaTeX
|
||||||
Product "$$Contents(\"$$Basename.tex\")"
|
Product "\\loadgame{$$FPath/$$Basename}\\showboard"
|
||||||
UpdateCommand "python $$Sysdir/scripts/fen2latex.py $$FName $$Basename.tex"
|
|
||||||
Requirement "chess"
|
Requirement "chess"
|
||||||
FormatEnd
|
FormatEnd
|
||||||
Format Ascii
|
Format Ascii
|
||||||
Product "$$Contents(\"$$Basename.asc\")"
|
Product "$$Contents(\"$$Basename.asc\")"
|
||||||
UpdateCommand "python $$Sysdir/scripts/fen2ascii.py $$FName $$Basename.tex"
|
UpdateCommand "python $$Sysdir/scripts/fen2ascii.py $$FName $$Basename.asc"
|
||||||
FormatEnd
|
FormatEnd
|
||||||
Format DocBook
|
Format DocBook
|
||||||
Product "[Chess: $$Basename]"
|
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
|
#!/usr/bin/python
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 The LyX Team.
|
# Copyright (C) 2001 The LyX Team.
|
||||||
#
|
#
|
||||||
# This file is distributed under the GPL license.
|
# This file is distributed under the GPL license.
|
||||||
#
|
#
|
||||||
# This script will convert a chess position in the FEN
|
# 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.
|
# style.
|
||||||
|
|
||||||
import sys,string,os
|
import sys,string,os
|
||||||
@ -19,33 +19,6 @@ line = sys.stdin.readline()
|
|||||||
if line[-1] == '\n':
|
if line[-1] == '\n':
|
||||||
line = line[:-1]
|
line = line[:-1]
|
||||||
|
|
||||||
line=string.split(line,' ')[0]
|
print "\\fenboard{"+line+"}"
|
||||||
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 "\\showboard%"
|
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
|
* 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>
|
2001-10-24 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* tabular-old.C (ReadOld): below variable changes reflected.
|
* tabular-old.C (ReadOld): below variable changes reflected.
|
||||||
|
@ -189,9 +189,9 @@ string const LaTeXFeatures::getPackages() const
|
|||||||
// packages << "\\usepackage{algorithm}\n";
|
// packages << "\\usepackage{algorithm}\n";
|
||||||
//}
|
//}
|
||||||
|
|
||||||
// lyxchess.sty
|
// lyxskak.sty --- newer chess support based on skak.sty
|
||||||
if (chess) {
|
if (chess) {
|
||||||
packages << "\\usepackage{lyxchess}\n";
|
packages << "\\usepackage[ps,mover]{lyxskak}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// setspace.sty
|
// setspace.sty
|
||||||
|
@ -94,7 +94,7 @@ struct LaTeXFeatures {
|
|||||||
///
|
///
|
||||||
bool prettyref; // prettyref.sty
|
bool prettyref; // prettyref.sty
|
||||||
///
|
///
|
||||||
bool chess; // chess.sty
|
bool chess; // skak.sty (new chess support)
|
||||||
///
|
///
|
||||||
bool natbib; // natbib.sty
|
bool natbib; // natbib.sty
|
||||||
///
|
///
|
||||||
|
@ -71,10 +71,10 @@ void gettext_init(string const & localedir)
|
|||||||
|
|
||||||
void locale_init()
|
void locale_init()
|
||||||
{
|
{
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
}
|
}
|
||||||
|
|
||||||
void gettext_init(string const &)
|
void gettext_init(string const &)
|
||||||
{
|
{
|
||||||
setlocale(LC_NUMERIC, "C");
|
|
||||||
}
|
}
|
||||||
#endif
|
#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>
|
2001-10-24 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
* insettabular.C: use new ltType struct for setting longtable
|
* 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 (status_ != Inlined) {
|
||||||
if (collapsed_) {
|
if (collapsed_) {
|
||||||
status(0, Collapsed);
|
status(bv, swap ? Open : Collapsed);
|
||||||
} else {
|
} 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);
|
set_latex_font(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,13 +272,7 @@ Inset::EDITABLE InsetERT::editable() const
|
|||||||
void InsetERT::edit(BufferView * bv, bool front)
|
void InsetERT::edit(BufferView * bv, bool front)
|
||||||
{
|
{
|
||||||
InsetCollapsable::edit(bv, front);
|
InsetCollapsable::edit(bv, front);
|
||||||
if (status_ != Inlined) {
|
updateStatus(0);
|
||||||
if (collapsed_) {
|
|
||||||
status(0, Collapsed);
|
|
||||||
} else {
|
|
||||||
status(0, Open);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set_latex_font(bv);
|
set_latex_font(bv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,33 +283,22 @@ void InsetERT::insetButtonRelease(BufferView * bv, int x, int y, int button)
|
|||||||
showInsetDialog(bv);
|
showInsetDialog(bv);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((x >= 0) && (x < button_length) &&
|
|
||||||
(y >= button_top_y) && (y <= button_bottom_y))
|
if (status_ != Inlined && (x >= 0) && (x < button_length) &&
|
||||||
{
|
(y >= button_top_y) && (y <= button_bottom_y)) {
|
||||||
// if (collapsed_) {
|
updateStatus(bv, true);
|
||||||
// setLabel(_("ERT"));
|
} else {
|
||||||
// } 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)) {
|
|
||||||
LyXFont font(LyXFont::ALL_SANE);
|
LyXFont font(LyXFont::ALL_SANE);
|
||||||
int yy = ascent(bv, font) + y -
|
int yy = ascent(bv, font) + y - inset.ascent(bv, font);
|
||||||
(ascent_collapsed() +
|
|
||||||
descent_collapsed() +
|
// inlined is special - the text appears above
|
||||||
inset.ascent(bv, font));
|
// button_bottom_y
|
||||||
inset.insetButtonRelease(bv, x, yy, button);
|
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.
|
/** A collapsable text inset for LaTeX insertions.
|
||||||
|
|
||||||
To write full ert (including styles and other insets) in a given
|
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 {
|
class InsetERT : public InsetCollapsable {
|
||||||
public:
|
public:
|
||||||
@ -93,6 +96,10 @@ public:
|
|||||||
///
|
///
|
||||||
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
||||||
///
|
///
|
||||||
|
bool inlined() const { return status_ == Inlined; }
|
||||||
|
///
|
||||||
|
ERTStatus status() const { return status_; }
|
||||||
|
///
|
||||||
void open(BufferView *);
|
void open(BufferView *);
|
||||||
///
|
///
|
||||||
void close(BufferView *) const;
|
void close(BufferView *) const;
|
||||||
@ -100,8 +107,6 @@ public:
|
|||||||
bool allowSpellcheck() { return false; }
|
bool allowSpellcheck() { return false; }
|
||||||
string const selectNextWordToSpellcheck(BufferView *, float &) const;
|
string const selectNextWordToSpellcheck(BufferView *, float &) const;
|
||||||
///
|
///
|
||||||
bool inlined() const { return status_ == Inlined; }
|
|
||||||
///
|
|
||||||
int ascent(BufferView *, LyXFont const &) const;
|
int ascent(BufferView *, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
int descent(BufferView *, LyXFont const &) const;
|
int descent(BufferView *, LyXFont const &) const;
|
||||||
@ -109,9 +114,7 @@ public:
|
|||||||
int width(BufferView *, LyXFont const &) const;
|
int width(BufferView *, LyXFont const &) const;
|
||||||
///
|
///
|
||||||
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
|
||||||
///
|
/// set the status of the inset
|
||||||
ERTStatus status() const { return status_; }
|
|
||||||
///
|
|
||||||
void status(BufferView *, ERTStatus const st) const;
|
void status(BufferView *, ERTStatus const st) const;
|
||||||
///
|
///
|
||||||
bool showInsetDialog(BufferView *) const;
|
bool showInsetDialog(BufferView *) const;
|
||||||
@ -125,6 +128,8 @@ private:
|
|||||||
void setButtonLabel() const;
|
void setButtonLabel() const;
|
||||||
///
|
///
|
||||||
void set_latex_font(BufferView *);
|
void set_latex_font(BufferView *);
|
||||||
|
/// update status on button
|
||||||
|
void updateStatus(BufferView *, bool = false) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
mutable ERTStatus status_;
|
mutable ERTStatus status_;
|
||||||
|
@ -235,9 +235,11 @@ string const InsetExternal::doSubstitution(Buffer const * buffer,
|
|||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
string const basename = ChangeExtension(params_.filename, string());
|
string const basename = ChangeExtension(params_.filename, string());
|
||||||
|
string const filepath = OnlyPath(MakeAbsPath(params_.filename));
|
||||||
result = subst(s, "$$FName", params_.filename);
|
result = subst(s, "$$FName", params_.filename);
|
||||||
result = subst(result, "$$Basename", basename);
|
result = subst(result, "$$Basename", basename);
|
||||||
result = subst(result, "$$Parameters", params_.parameters);
|
result = subst(result, "$$Parameters", params_.parameters);
|
||||||
|
result = subst(result, "$$FPath", filepath);
|
||||||
result = ReplaceEnvironmentPath(result);
|
result = ReplaceEnvironmentPath(result);
|
||||||
result = subst(result, "$$Tempname", tempname_);
|
result = subst(result, "$$Tempname", tempname_);
|
||||||
result = subst(result, "$$Sysdir", system_lyxdir);
|
result = subst(result, "$$Sysdir", system_lyxdir);
|
||||||
|
Loading…
Reference in New Issue
Block a user