#!/bin/sh

# Scid (Shane's Chess Information Database)
#
# Copyright (C) 1999--2002  Shane Hudson. All rights reserved.
# This is freely redistributable software; see the file named COPYING
# that came with this program.
# To contact the author: email me at:  shane@cosc.canterbury.ac.nz

# The following comments are only for Unix versions of Scid:

# The "\" at the end of the comment line below is necessary! It means
#   that the "exec" line is a comment to Tcl/Tk, but not to /bin/sh.
# The next line restarts using tkscid: \
exec tkscid "$0" "$@"

# For the above to work, tkscid must be in a directory in your PATH.
# Alternatively, you can set the first line to start tkscid directly
# by specifying the full name of tkscid, eg:
# #!/home/myname/bin/tkscid

############################################################

set scidVersion "3.3"

# Determine operating system platform: unix or windows
set windowsOS 0
if {$tcl_platform(platform) == "windows"} { set windowsOS 1 }

# Check that the version of tkscid matches the version of this script:

if {[string compare [sc_info version] $scidVersion]} {
  wm withdraw .
  tk_messageBox -type ok -icon error -title "Scid: Version Error" \
    -message "This program,\n\"$argv0\",\nhas version $scidVersion,\nbut the tkscid program \nit uses has version [sc_info version].\nCheck that the path to tkscid is correct."
  exit 1
}


#############################################################
# Customisable variables:

# scidExeDir: contains the directory of the Scid executable program.
# Not used under Linux/Unix, but is used under Windows to determine the
# directory where the options file is stored.
set scidExeDir [file dirname [info nameofexecutable]]

# scidUserDir: location of user-specific Scid files.
# This is "~/.scid" on Unix, and the Scid exectuable dir on Windows.
if {$windowsOS} {
  set scidUserDir $scidExeDir
} else {
  set scidUserDir [file nativename "~/.scid"]
}

# ecoFile: the ECO file for opening classification. Scid will try to load
# this first, and if that fails, it will try to load  "scid.eco" in the
# current directory.
if {$windowsOS} {
  set ecoFile [file join $scidExeDir "scid.eco"]
} else {
  set ecoFile "/usr/local/share/scid/scid.eco"
}

# boardSizes: a list of the available board sizes.
set boardSizes [list 25 30 35 40 45 50 55 60 65 70]
set boardSizesOLD [list 21 25 29 33 37 40 45 49 54 58 64 72]

# boardSize: Default board size. See the available board sizes above.
set boardSize 45

# boardStyle: Default board piece set. See bitmaps.tcl for styles.
set boardStyle Merida

# language for help pages and messages:
set language E
set oldLang X

# Toolbar icons:
foreach i {
  new open save close finder bkm gprev gnext cut copy paste
  rfilter bsearch hsearch msearch
  switcher glist pgn tmt maint eco tree crosst engine
} {
  set toolbar($i) 1
}

# boardCoords: 1 to show board Coordinates, 0 to hide them.
set boardCoords 0

# Default values for fonts:
proc createFont {name} {
  set opts $::fontOptions($name)
  font create font_$name \
    -family [lindex $opts 0] -size [lindex $opts 1] \
    -weight [lindex $opts 2] -slant [lindex $opts 3]
}

proc configureFont {name} {
  set opts $::fontOptions($name)
  font configure font_$name \
    -family [lindex $opts 0] -size [lindex $opts 1] \
    -weight [lindex $opts 2] -slant [lindex $opts 3]
}

if {$windowsOS} {
  set fontOptions(Regular) [list arial   11 normal roman]
  set fontOptions(Menu)    [list arial   10 normal roman]
  set fontOptions(Small)   [list arial   10 normal roman]
  set fontOptions(Fixed)   [list courier 11 normal roman]
} else {
  set fontOptions(Regular) [list helvetica 11 normal roman]
  set fontOptions(Menu)    [list helvetica 10 normal roman]
  set fontOptions(Small)   [list helvetica 10 normal roman]
  set fontOptions(Fixed)   [list fixed     11 normal roman]
}

createFont Regular
createFont Menu
createFont Small
createFont Fixed

# Analysis command: to start chess analysis engine.
set analysisCommand ""
if {$windowsOS} {
  set analysisChoices {wcrafty.exe}
} else {
  set analysisChoices {crafty}
}

# Colors: dark and lite are square colors
#     whitecolor/blackcolor are piece colors
#     highcolor is the color when something is selected.
#     bestcolor is used to indicate a suggested move square.
set dark        "\#a08050"
set lite        "\#d0c0a0"
set whitecolor  "\#ffffff"
set blackcolor  "\#000000"
set whiteborder "\#000000"
set blackborder "\#ffffff"
set highcolor   "\#b0d0e0"
set bestcolor   "\#bebebe"
set buttoncolor "\#b0c0d0"


# Defaults for the PGN window:
# if doColorPgn is 1, the PGN text will be colorized.
set doColorPgn 1
set pgnIndentVars 1
set pgnIndentComments 1
set pgnSymbolicNags 1
set pgnMoveNumSpace 0
set pgnShortHeader 0
set pgnColumn 0
set pgnStripMarks 0
set pgnColor(Header) "\#00008b"
set pgnColor(Main) "\#000000"
set pgnColor(Var) "\#0000ee"
set pgnColor(Nag) "\#ee0000"
set pgnColor(Comment) "\#008b00"
set pgnColor(Current) lightSteelBlue
set pgnColor(NextMove) "\#fefe80"
set pgnColor(Background) "\#ffffff"


# Defaults for initial directories:
set initialDir(base) "."
set initialDir(book) "."
set initialDir(html) "."
set initialDir(tex)  "."
set initialDir(tablebase1) ""
set initialDir(tablebase2) ""
set initialDir(tablebase3) ""
set initialDir(tablebase4) ""

# glistSize: Number of games displayed in the game list window
set glistSize 15

# glexport: Format for saving Game List to text file.
set glexportDefault "g6: w13 W4  b13 B4  r3:m2 y4 s11 o4"
set glexport $glexportDefault

# glistSelectPly: The number of moves to display in a game list entry
# when that entry is selected with button-2 to shoe the first moves
# of a game. E.g., a value of 4 might give: "1.e4 e5 2.Nf3 Nc6".
set glistSelectPly 80


# Default window locations:
foreach i {. .pgnWin .helpWin .crosstabWin .treeWin .commentWin .glist \
             .playerInfoWin .baseWin .treeBest .treeGraph .tourney .finder \
             .ecograph .statsWin .glistWin .maintWin .nedit offset} {
  set winX($i) -1
  set winY($i) -1
}

# Default PGN window size:
set winWidth(.pgnWin)  65
set winHeight(.pgnWin) 20

# Default help window size:
set winWidth(.helpWin)  50
set winHeight(.helpWin) 32

# Default stats window size:
set winWidth(.statsWin) 60
set winHeight(.statsWin) 13

# Default crosstable window size:
set winWidth(.crosstabWin)  65
set winHeight(.crosstabWin) 15

# Default tree window size:
set winWidth(.treeWin)  58
set winHeight(.treeWin) 20

# Default comment editor size:
set winWidth(.commentWin)  50
set winHeight(.commentWin)  6

# Default spellcheck results window size:
set winWidth(.spellcheckWin)  55
set winHeight(.spellcheckWin) 25

# Default player info window size:
set winWidth(.playerInfoWin)  45
set winHeight(.playerInfoWin) 20


# Default stats window lines:
array set stats {
  r2600 1
  r2500 1
  r2400 1
  r2300 1
  r2200 0
  r2100 0
  r2000 0
  y1900 0
  y1950 0
  y1960 0
  y1970 0
  y1980 0
  y1990 0
  y1992 0
  y1994 0
  y1996 1
  y1998 1
  y2000 1
  y2001 1
}

# Default PGN display options:
set pgnStyle(Tags) 1
set pgnStyle(Comments) 1
set pgnStyle(Vars) 1


# Default Tree sort method:
set tree(order) frequency

# Auto-save tree cache when closing tree window:
set tree(autoSave) 0

# Auto-save options when exiting:
set optionsAutoSave 0

#  Numeric locale: first char is decimal, second is thousands.
#  Example: ".," for "1,234.5" format; ",." for "1.234,5" format.
set locale(numeric) ".,"

# Ask before replacing existing moves: on by default
set askToReplaceMoves 1

# Show suggested moves: on by default
set suggestMoves 1

# Keyboard Move entry options:
set moveEntry(On) 1
set moveEntry(AutoExpand) 0
set moveEntry(Coord) 1

set autoplayDelay 5000

# Geometry of windows:
array set geometry {}

# startup:
#   Stores which windows should be opened on startup.
set startup(pgn) 0
set startup(switcher) 0
set startup(tip) 1
set startup(tree) 0
set startup(finder) 0
set startup(crosstable) 0
set startup(gamelist) 0
set startup(stats) 0

# glistFields: Layout of the GameList window fields.
#    element 0: code (e.g. g for gameNumber, w for White name)
#    element 1: initial width, in characters
#    element 2: justification (left or right)
#    element 3: color
#    element 4: true if a separator field should follow
#
#    Note that the "g" (game number) field MUST appear somewhere,
#    but the fields can be in any order.
#    See the comments at the start of the function "PrintGameInfo" in
#    src/index.cpp for a list of available field codes.
#
set glistFields {
  { g  7 right black      1 }
  { w 14 left  darkBlue   0 }
  { W  5 right darkGreen  1 }
  { b 14 left  darkBlue   0 }
  { B  5 right darkGreen  1 }
  { e 10 left  black      0 }
  { s 10 left  black      0 }
  { n  2 right black      1 }
  { d  7 left  darkRed    1 }
  { r  3 left  blue       0 }
  { m  3 right black      1 }
  { o  5 left  darkGreen  0 }
  { O  6 left  darkGreen  1 }
  { D  1 left  darkRed    0 }
  { U  2 left  blue       1 }
  { V  2 right blue       0 }
  { C  2 right blue       0 }
  { A  2 right blue       0 }
  { S  1 left  darkRed    0 }
}

set glistDefaultFields $glistFields
set glistAllFields $glistFields
lappend glistAllFields { c  3 left  black      0 }
lappend glistAllFields { E  7 left  darkRed    0 }
lappend glistAllFields { F  7 left  darkBlue   0 }


# Game information area options:
set gameInfo(photos) 1
set gameInfo(hideNextMove) 0
set gameInfo(showMaterial) 0
set gameInfo(showFEN) 0
set gameInfo(showMarks) 1
set gameInfo(wrap) 0
set gameInfo(fullComment) 0
set gameInfo(showTB) 0
if {[sc_info tb]} { set gameInfo(showTB) 2 }

# Twin deletion options:

array set twinSettings {
  players No
  colors  No
  event   No
  site    Yes
  round   Yes
  year    Yes
  month   Yes
  day     No
  result  No
  eco     No
  moves   Yes
  skipshort  Yes
  setfilter  Yes
  undelete   Yes
  comments   Yes
  variations Yes
  usefilter  No
  delete     Shorter
}
array set twinSettingsDefaults [array get twinSettings]

# Opening report options:
array set optable {
  Stats 1
  Oldest 5
  Newest 5
  Popular 1
  MostFrequent 6
  MostFrequentWhite 1
  MostFrequentBlack 1
  AvgPerf 1
  HighRating 8
  Results 1
  Shortest 5
  ShortestWhite 1
  ShortestBlack 1
  MoveOrders 8
  MovesFrom 1
  Themes 1
  Endgames 1
  MaxGames 500
  ExtraMoves 1
}
array set optableDefaults [array get optable]

# Export file options:
set exportFlags(comments) 1
set exportFlags(indentc) 0
set exportFlags(vars) 1
set exportFlags(indentv) 1
set exportFlags(column) 0
set exportFlags(append) 0
set exportFlags(symbols) 1
set exportFlags(htmldiag) 0
set exportFlags(stripMarks) 0
set default_exportStartFile(PGN) {}
set default_exportEndFile(PGN) {}

set default_exportStartFile(LaTeX) {\documentclass[10pt,twocolumn]{article}
% This is a LaTeX file generated by Scid.
% You must have the "chess12" package installed to typeset this file.

\usepackage{times}
\usepackage{a4wide}
\usepackage{chess}
\usepackage[T1]{fontenc}

\setlength{\columnsep}{7mm}
\setlength{\parindent}{0pt}

% Macros for variations and diagrams:
\newenvironment{variation}{\begin{quote}}{\end{quote}}
\newenvironment{diagram}{\begin{nochess}}{$$\showboard$$\end{nochess}}

\begin{document}
}
set default_exportEndFile(LaTeX) {\end{document}
}


set default_exportStartFile(HTML) {<html>
<head><title>Scid export</title></head>
<body bgcolor="#ffffff">
}
set default_exportEndFile(HTML) {</body>
</html>
}

foreach type {PGN HTML LaTeX} {
  set exportStartFile($type) $default_exportStartFile($type)
  set exportEndFile($type) $default_exportEndFile($type)
}


# switcherVertical:
#   If 1, Switcher frames are arranged vertically.

set switcherVertical 0


# autoRaise: defines whether the "raise" command should be used to raise
# certain windows (like progress bars) when they become obscured.
# Some Unix window managers (e.g. some versions of Enlightenment and sawfish,
# so I have heard) have a bug where the Tcl/Tk "raise" command times out
# and takes a few seconds. Setting autoRaise to 0 will help avoid this.

set autoRaise 1

proc raiseWin {w} {
  global autoRaise
  if {$autoRaise} { raise $w }
  return
}

# autoIconify:
#   Specified whether Scid should iconify all other Scid windows when
#   the main window is iconified. Most people like this behaviour but
#   some window managers send an "UnMap" event when the user switches
#   to another virtual window without iconifying the Scid window so
#   users of such managers will probably want to turn this off.

set autoIconify 1


# Email configuration:
set email(logfile) [file join $scidUserDir "scidmail.log"]
set email(smtp) 1
set email(smproc) "/usr/lib/sendmail"
set email(server) localhost
set email(from) ""
set email(bcc) ""


# Spell-checking file: default is "spelling.ssp".
if {$windowsOS} {
  set spellCheckFile [file join $scidExeDir "spelling.ssp"]
} else {
  set spellCheckFile "/usr/local/share/scid/spelling.ssp"
}

# Engines list file:
set engines(file) [file join $scidUserDir "engines.lis"]
set engines(backup) [file join $scidUserDir "engines.bak"]

# Engines data:
set engines(list) {}
set engines(sort) Time


# Start up splash screen:

set autoCloseSplash 0
wm withdraw .
toplevel .splash
wm protocol .splash WM_DELETE_WINDOW { wm withdraw .splash }
wm title .splash "Welcome to Scid [sc_info version]"
frame .splash.f
frame .splash.b
text .splash.t -height 14 -width 50 -cursor top_left_arrow \
    -background white -font font_Regular -wrap word \
    -yscrollcommand {.splash.ybar set} -setgrid 1
scrollbar .splash.ybar -command {.splash.t yview}
checkbutton .splash.auto -text "Auto-close after startup" \
  -variable autoCloseSplash -font font_Regular -relief raised -pady 5 -padx 5
button .splash.dismiss -text " Close " -command {wm withdraw .splash} \
  -font font_Regular
pack .splash.f -side top -expand yes -fill both
pack .splash.b -side top -fill x
pack .splash.auto -side left -in .splash.b -pady 2 -ipadx 10 -padx 10
pack .splash.dismiss -side right -in .splash.b -pady 2 -ipadx 10 -padx 10
pack .splash.ybar -in .splash.f -side right -fill y
pack .splash.t -in .splash.f -side left -fill both -expand yes

bind .splash <F1> {helpWindow Index}
bind .splash <Escape> {.splash.dismiss invoke}

.splash.t tag configure indent -lmargin2 20

proc addSplash {text} {
    if {! [winfo exists .splash]} {return}
    .splash.t configure -state normal
    .splash.t insert end "\n$text" indent
    .splash.t see end
    .splash.t configure -state disabled
    update
}

# Old Scid logo:
image create photo splash -format gif -data \
"R0lGODdhZgAmAMIAAP///6CBUNHBoQAAcAAAAFK4bgAAAAAAACwAAAAAZgAmAAAD/gi63P4w
ykkrDThjwTvXmueBmdiRmymggbqirqawMazSt23iuy7KAN7PNyKejB/ki1TDzJTCIjM37VWH
moFWiw08r1JQU0wlW83YrXrQ/ZrX8NQ5VKbPSzn4th2E6f9sd3JddoR4PYB8LIB/dYeGg2GF
knB8KokccWBHm0mdS2gCmo8KJn+Da1Cqn1Gjg6Uieo+prKoEt4+Sua4tHbAdp6hqq6Ent8eR
nKG8Hr+ZssJbRMG9JsfX1YZrosy+ALHQ2dxaNozSLtfITea0pN8ejOLKWex7Kum4NfXDhc7P
mJAaBdCDDp+8f2oKgOPnjkS9YsHGtcuADxmKSqAGbgvj/gbDvgG5JPITKU1DRWwgCGbEqKyj
x4/iqJEkZ/IkrpQbV+b05KWPw48L280kYfNmBpU61Sgqtw9eOIRsiBbFmZOqvZY+0dRzOmoM
xZM/q9JTyjHrpJk5ZToKYDMs2aRXebpMBjXtU0dFCVi9ujcQ1qBMRzXiOSnvLa4Mg9J0B3gK
tcEZHxk+BgyaYpD93lUuSSecRpVCJh+uS/MyGn8TU3hmFFljB9EENscxnVkxE2ovc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5B9Z5ndfZFDD+cQcZgBZ2siQk850Jkn6hwxTnpwctoQeKkQXB
8HrBkBDv6Qnt2Z7y2Z6vdyE60BJKgJ4Nsp/9ySMA2iB/VwqvlxBbcqAIuiVrUKAZ0AlR0CA7
IAwSOm36qXPoqZ9MMZ9r4AeHcAim4KGx4CnYOaIkmp3W8AmHoDYpqhIrqjaJIAxHYgo60Akl
WqPY+QHlcCWJcAgTOgYrGiPC0KGHsKOBgDAjGptOkgzgtaRM2qRNKl5ZEJtSagxVUAWwaaWv
+QHGoANO2qVOGgXFMKWxaaVYeqXGUAp84KQL4QfZEZHk2T86QZ6hYwp80SYkwjoMwTo2UQzp
5zuJ8KeACqh0aierhCMiQ9AiUDIih1odCnEin5AIdGoKifA0D8ElBLIhEYloS8MjPuIU22ky
6tUwQVIJ34Ah3SSpgXqZH6INMcKqTQMhnBk0+PE0JqIAKSKpAhE0GZAMUdCqCqJDXTMgDcIH
sAMvnAk1yBoM7KEWv9olFXN+Q0OdoJIB6WAoS1IhLUJBvTogUPGrS3MR5REuQIOs8LIw3Lk3
eoGp4WkYkYCVQ6MQF/MBwZAr3xkQADs=
}

.splash.t image create end -image splash
.splash.t insert end "Shane's Chess Information Database"
addSplash "Copyright (C) 1999-2001 Shane Hudson  (shane@cosc.canterbury.ac.nz)"
addSplash "This is Scid [sc_info version], released [sc_info version date]."
addSplash "Website: scid.sourceforge.net\n"

# Remember old font settings before loading options file:
set fontOptions(oldRegular) $fontOptions(Regular)
set fontOptions(oldMenu) $fontOptions(Menu)
set fontOptions(oldSmall) $fontOptions(Small)
set fontOptions(oldFixed) $fontOptions(Fixed)

# Try to load saved options:
# The options file is ".scid" in the users home directory on Unix systems,
# or "scid.opt" in the directory of the Scid program on Windows.
if {! $windowsOS} {
  set optionsFile [file join $scidUserDir "scidrc"]
  set optionsFileBak [file join $scidUserDir "scidrc.bak"]
} else {
  set optionsFile [file join $scidExeDir "scid.opt"]
  set optionsFileBak [file join $scidExeDir "scidopt.bak"]
}

# Create user ".scid" directory in Unix if necessary:
# Since the options file used to be ".scid", rename it:
if {! [file isdirectory $scidUserDir]} {
  if {[file isfile $scidUserDir]} {
    catch {file rename -force $scidUserDir "$scidUserDir.old"}
  }
  if {[catch {file mkdir $scidUserDir} err]} {
    addSplash "Error creating ~/.scid directory: $err"
  } else {
    catch {file rename "$scidUserDir.old" $optionsFile}
  }
  # Rename old "~/.scid_sent_emails" if necessary:
  if {[file isfile [file nativename "~/.scid_sent_emails"]]} {
    catch {file rename [file nativename "~/.scid_sent_emails"] $email(logfile)}
  }
}

if {[catch {source $optionsFile} ]} {
  #addSplash "Unable to find the options file: [file tail $optionsFile]"
} else {
  addSplash "Your options file \"[file tail $optionsFile]\" was found and loaded."
}

# Reconfigure fonts if necessary:
foreach i {Regular Menu Small Fixed} {
  if {$fontOptions($i) == $fontOptions(old$i)} {
    # Old font format in options file, or no file. Extract new options:
    set fontOptions($i) {}
    lappend fontOptions($i) [font actual font_$i -family]
    lappend fontOptions($i) [font actual font_$i -size]
    lappend fontOptions($i) [font actual font_$i -weight]
    lappend fontOptions($i) [font actual font_$i -slant]
  } else {
    # New font format in options file:
    configureFont $i
  }
}

# Check board size is valid:
set newSize [lindex $boardSizes 0]
foreach sz $boardSizes {
  if {$boardSize >= $sz} { set newSize $sz }
}
set boardSize $newSize

# Check for old (single-directory) tablebase option:
if {[info exists initialDir(tablebase)]} {
  set initialDir(tablebase1) $initialDir(tablebase)
}

# font_Regular is the default font for widgets:
option add *Font font_Regular
option add *Menu*Font font_Menu
option add *Menubutton*Font font_Menu
option add Scrollbar*borderWidth 1

# Set the radiobutton and checkbutton background color if desired.
# I find the maroon color on Unix ugly!
if {! $windowsOS} {
  option add *Radiobutton*selectColor $buttoncolor
  option add *Checkbutton*selectColor $buttoncolor
  option add *Menu*selectColor $buttoncolor
}

set fontsize [font configure font_Regular -size]
set font [font configure font_Regular -family]

font create font_Bold -family $font -size $fontsize -weight bold
font create font_BoldItalic -family $font -size $fontsize -weight bold \
  -slant italic
font create font_Italic -family $font -size $fontsize -slant italic
font create font_H1 -family $font -size [expr $fontsize + 8] -weight bold
font create font_H2 -family $font -size [expr $fontsize + 6] -weight bold
font create font_H3 -family $font -size [expr $fontsize + 4] -weight bold
font create font_H4 -family $font -size [expr $fontsize + 2] -weight bold
font create font_H5 -family $font -size [expr $fontsize + 0] -weight bold

set fontsize [font configure font_Small -size]
set font [font configure font_Small -family]
font create font_SmallBold -family $font -size $fontsize -weight bold
font create font_SmallItalic -family $font -size $fontsize -slant italic

# Check window offset of window manager frame:
# This is done by creating a window, positioning it at +0+0
# (the top left corner), and then reading its actual position.
# If the values are already set from the options file, this
# does not need to be done.

if {$winX(offset) == -1  ||  $winY(offset) == -1} {
  toplevel .testWin
  wm geometry .testWin +0+0
  update idletasks
  set winX(offset) [winfo rootx .testWin]
  set winY(offset) [winfo rooty .testWin]
  destroy .testWin
}

###
### End of file: start.tcl
# bitmaps.tcl:
# Chess piece bitmaps used by Scid.

# The piece images used here were generated from freeware chess
# fonts available in TrueType format at the En Passant website
# "Chess Fonts" page, http://www.enpassant.dk/chess/fonteng.htm

# The authors of the original TrueType fonts are:
#   Alpha: Eric Bentzen.
#   Leipzig, Merida: Armando H. Marroquin.


set boardStyles {}


##########
# Size 20 is only used in Material search window, not for boards.
# It has two special extra images, wm20 and bm20, which contain a
# bishop and knight, for indicating a minor piece.
#

image create photo wm20 -data {
R0lGODlhFAAUAMIAAH9/f7+/vz8/PwAAAP///////////////yH5BAEKAAcALAAAAAAUABQA
AANweLp8cCG02cSwNB8RSACctgBAR3iDqJDd5wlidBLCHGb1CQzzx+yPDYAWyJ1gixpSwOLM
CClFESSRup7RImF42zxP0Vpg0EE6SGjSCqxTKYxHN4RJ6sYETHxVNa3vM2gDQyBoGkNbhIdq
FHRBZyAaCQA7}

image create photo bm20 -data {
R0lGODlhFAAUAMIAAH9/f7+/vwAAAD8/P////////////////yH5BAEKAAcALAAAAAAUABQA
AANneLp8cCG02YQYgupj+5CbEgyYAAQC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JTfUA1hRoJMXYmJkHESOLIXIl1v+A5mAMgE2IkS9qLUGdDH9gIt0fprAaHQRxHeHeIfV
eEc2CuV0Z6TrNVYcVrdEodp0ZY36WVVsPrPYb/HxmVFykfrYyJfLddTeCx15MZ8ovJlEVHx1
zoNillrWICgh2zxpeluLfbZVnllK9pefNiiaSopPWLrVD0BZoqnbboOhBexxEQF7bXxuGfdg
rlTEJxt9YDh1n0Dj7rOmjhtVmmmG6E2ArlRpapGmYsDa6+2qlwYcxAWHyrHwwxAX1h47EVds
8cUYZ6xxBwkAADs=
}

image create photo e20 -height 20 -width 20
set x 0
foreach p {wp wn wb wr wq wk bp bn bb br bq bk} {
  image create photo ${p}20 -width 20 -height 20
  ${p}20 copy p20 -from $x 0 [expr $x + 19] 19
  incr x 20
}


####################
# Alpha:

lappend boardStyles Alpha

set pieceImageData(Alpha,25) {
R0lGODlhLAEZAMIAAL+/vz8/PwAAAH9/f////////////////yH5BAEKAAcALAAAAAAsARkA
AAP+eLrc/jDKSau9OOvNu/9gKI5kaZ5oqq4QAHSBELD0QFcuLN+rzUsC3yZAmP0WA6EiqQEM
gq+jI9gRWKVL5YGZcUI7SW038IQNjBYnUz14haOSM3crzzyt4kvYA4gJdGg4e2xuSXARd0KJ
dlZUQ2GBGGcABACOGH2TegMEf0kETAKgeQ1yinUafzpWkXqNeE0xAYcTd56NNrgUi0uwqWCc
BKNjwcJFrXGzlbMWn7igjcMUAcwKfcgVqhu2vhd9r6zYENwCtIjg6N0SMXCW4hPaGp/Ccziz
lsXHFtTGwtQV8/oJrBehHJpZ8cbJYIevnDt2AMGRaiELWiMn+9K9Q5L+Dt1EBqwW+Nm10GEQ
k9TKASxGME45gf3+1SJCzxiZbJRgCrNkjg4cUcz6dFqgpgG/neyWKfO3cYtEV3iSvJrVlJvV
bB1f9TS04OIBS1esETy6rFwbajn1TePUJw0Znf14ShBqTJTNng6ohdkr8wERVU4q2XjbRgFQ
BnRjUkp8d1qjptb8ZDWI1xq4Tlor6N2b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2pA8UgVkNlq0gUQ/8JJhxqgBqRwnqg67oEvX2Mn9eOm
SPOaDmopCyL+eHLpnnIaiNaEWX21E0CEM2XIW8CVlGc4a4PKMO4pVPSpp0pVope4oHfGbhoF
jXNDpFbYhtxnTAuUpF84qZ+6erMoU6laN9ITNg/3b/YpKxx3o7F1rDoqG4fYdCG5kktJMnMa
rA5Iq9k6oXBIbmtxDrwiPZyWnM86q9JafPvXqBNkrZ/SergKX7BkPNVzfOQYdzkYiRJ4nDDq
rjIhE/PKquCElKkTleyabDH2cC7JrW3ib8DydbO6r8iHpusan6uqPpZkPepqLVfaKSfCq9um
qL60Tv9KXNCTqboqnWyaZzm6bwbLgRfbiC76LgARUzK5Es6Tr/d2nCzbqXcSl3T++rHTRE0r
AomX+KcgKlTVN7N1CINM6q1W2LE+K6CFAEI/RbJZdLKUQg5ay3vFGUAdGCYxG3dL4Qh0BkR+
p3P+qZhCuZczOjssum9hmzpqSox1OztI2qETy4xM25C2WEJn5qGJSLVfi2rkdrctin9/unfi
d7i8V6z4tRQJiosZgrbd96AlK7nSJ1mWGpSvyLkIe27qCmTyiVXYOkfvCYxi1meGu7LxybOF
FrqSO7qnx7nuRrS4a4Oau0Iz+kM0O6Nze16722jc5LjgR7a4a7toOKspOau6gohR2yinexnT
W5W6y7mQe1RlG4R1SqXg65k0Fr7gqzSnR6XIE7sYGZ7PLzsa5Bu+X7uK71ulZlptzTq/8oai
HWC4DduxxZKxdCGfFHW90sJN8ou/stK+r3TACJy/YcW/NEa1G8E0xBC1lWe4WHm6ijiUzhsm
Hdu/pVsNUaqa+Ehwr1u/FKDB2Ua0HVx4HxzBVCvCXUsQORuolPi6oQi9F9fC6TqrIKyuMtxq
NGySEArBxKiuT0rAZtYQTNzETvzEUBzFUjzFVFzFVnzFWJzFWrzFXNzFXvzFYBzGYjzGZFzG
ZnzGaJzGarzGbNzGbvzGcBzHcjzHT5AAADs=
}


####################
# Leipzig:

lappend boardStyles Leipzig

set pieceImageData(Leipzig,25) {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JRd6ZUmYHWXmZgM4FAkIZP+tXSZU+mbUslUXcmYKHiU7OkANDhwbpeenfGeCxma
MTeV+vmc+pmb/Nhm4CmEh/l+DYqDtGB1mghtEqqX8qmWWcOa06WgzmabwpJMiZmg+/lm0/mf
/pJ42TgNRwWG7amik8VNrAkss0mbN3l0tlkTKLl730c9vyglqHme6CmP53maeMYcP9pBAsej
SCpIJAqkghSC/FZqctmiPgg79eKPYKOfKNCf/tmUrHcgeLhaWvKOV1pkkplyxQmlN0afylil
Wvg8I8lbQlqiJlSkkSkMhyelrxFNfBQifMkfRjMoT6pXGhBrushav5Y2rekcFfekJ4V2vpin
hdoc2lJna2r+qDoThWcYjpzKboxIp+dppzmCp2nSkkgVO3EgltxJUES4oFfXoEioClXpMoPG
a3jVo/zCp0FIqFwaP5JKnRFggK9BrH84AfM1o43KpvioGjmKpMGoFbgqFs9KL9HaFB8JPrUa
dNmKrIroNEbaN17FonGabTcmpH2UXG5jhcXRrVT4oKByRZyXj+6KWKE3qY0Sb1bRXiRZqclV
G5JakFsEsAUarrQJrwTFmzUCqxB6bcEhgHyKBndUL3upcc7EsE4DaVFEkzClh06xrfrXRjZ6
lArrpV9qsEsUKBLra8VWqRpbqPtGop6qn8PZX7/aiHUTQrpCfFGEEOfospEZpj2zq4sPS6DX
SmVrGaq4d5Q1252pibMVaxx4wLMvJLD56bKnRbIEqp02mY9d6q/kM6EA6B1NQhdky58XA7SJ
eaZYio3WGbCg57XTArZVJ7bpcbYtZrbYiUlpq7bN4rS/sLf4YF9TqrB7cLh5wKESmLQpORqI
+7iQSzSKexSE27iGG7mYm7mau7mc27me+7mgG7qiO7qkW7qme7qom7qqu7qs27qu+7qwG7uy
O7u0W7u2e7sfkAAAOw==
}

set pieceImageData(Merida,65) {
R0lGODlhDANBAMIAAH9/f7+/vz8/PwAAAP///////////////yH5BAEKAAcALAAAAAAMA0EA
AAP+eLrc/jDKSau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqPyK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mpwr8wOCJ7uPGpllqoQyCxorucu7evm+mAQpY+ufR/xM2rq4pUuRvRtgy6qqcsyszInFdXzG
43vGUReeBTy5xymp+7uWLbb+wDkCkyKVHUlodnLLnKGLN4n5gFtWslB8ZaPKWDocujXVw5Bc
ppuYK3S6LLF8lNBnyGyJyJxbndN6Vtt5sLrso7ysyvMVvrQatfdLbP9ot2RhW+izvtB4zBZV
ZbJgu+OVVqD1C5L6sHmcr2lCkWYoyPQ5x59Tyz1sfyTMwUGcuUYszDNlxOk8l+tswJ3sktp7
zJN8OfGBEXR5i5v0oaTaRykLTfOMVKFLCtRMqjNMpsC6lSPcZK06uXn6zeRcditLLQJdzuZ8
kBhtrBtNAqMZwhCUvXp5tiBttQktwTWcuOQhM1e7cSXNrVWWRKH8TXvcslfGlmvMzoOsiotU
ol7xClE2KM73nKkYzX6WWdQ2XdSGWc5NzNTLhqgJXB2ekFum7KWPI9QuKGf4ua13DBliSNVQ
rckTdTNSzbXFS2AdvZpVmThTTUUhetVKbdQQitVR9NWz7J+4S75NzcRXlExlNBAzk0znHNfs
rCjvPJfDa9hlSjDyS8c97dTQ59cNKgEezNi5MNiEHbeHrSWte5Z0rcCNENqizb9rHdZ/HQyp
zE50Odqs3dq5EKKmPdkakdp2XI2ufdu4ndu6vdu83du+/dvAHdzCPdzEXdzGfdzIndzKvdzM
3dzO/dzQHd3SPd3UXd3Wfd3Ynd3avd3czdoJAAA7
}

######################################################################

# setPieceData:
#   Given a piece font name and size, resets the images for
#   pieces of that size.
#
proc setPieceData {font size} {
  image create photo e$size -height $size -width $size
  image create photo tempPieces -data $::pieceImageData($font,$size)
  set x 0
  foreach p {wp wn wb wr wq wk bp bn bb br bq bk} {
    image create photo $p$size -width $size -height $size
    $p$size copy tempPieces -from $x 0 [expr $x + $size - 1] [expr $size - 1]
    incr x $size
  }
  image delete tempPieces
}

# setPieceFont:
#   Given a piece font name, resets all piece images in all
#   available board sizes to that font.
#
proc setPieceFont {font} {
  #set start [clock clicks -milli]
  foreach size $::boardSizes { setPieceData $font $size }
  #set end [clock clicks -milli]
  #puts "Font: $font. Time: [expr $end - $start] ms."
}

# Ensure the board style is valid:
if {[lsearch -exact $boardStyles $boardStyle] == -1} {
  set boardStyle [lindex $boardStyles 0]
}

# Set up the board style:
setPieceFont $boardStyle
### Menus.tcl: part of Scid.
### Copyright (C) 2001 Shane Hudson.

############################################################
###  Status bar help for menu items, buttons, etc:

array set helpMessage {}
set showHelp 1
set oldStatus ""

# statusBarHelp:
#   Called when a button or menu entry is entered to display
#   a status bar help message if applicable.
#
proc statusBarHelp {window {item {}}} {
  global showHelp helpMessage statusBar language

  set status ""
  if {! $showHelp} { return }

  # Tcl/Tk seems to generate strange window names for menus that
  # are configured to be a toplevel window main menu, e.g.
  # .menu.file get reported as ".#menu.#menu#file" and
  # .menu.file.utils is ".#menu.#menu#file.#menu#file#utils"
  # I have no idea why it does this, but to avoid it we
  # convert a window paths with hashes to its true value:

  if {[string range $window 0 1] == ".\#"} {
    set idx [string last . $window]
    set window [string range $window [expr $idx+1] end]
    regsub -all "\#" $window . window
  }

  # Look for a status bar help message for the current button
  # or menu entry, in the current language or English:

  if {$item == ""} { set index $window } else { set index "$window,$item" }
  if {[info exists helpMessage($language,$index)]} {
    set status "  $helpMessage($language,$index)"
  } elseif {[info exists helpMessage(E,$index)]} {
    set status "  $helpMessage(E,$index)"
  } elseif {[info exists helpMessage($index)]} {
    set tag $helpMessage($index)
    if {[info exists helpMessage($language,$tag)]} {
      set status "  $helpMessage($language,$tag)"
    } elseif {[info exists helpMessage(E,$tag)]} {
      set status "  $helpMessage(E,$tag)"
    } else { set status $tag }
  }

  if {$status == ""} { statusBarRestore $window; return }

  if {[string range $window 0 7] == ".treeWin"} {
    ::tree::status $status
  } else {
    set statusBar $status
  }
}

# statusBarRestore:
#   Updates a status bar that was displaying a help message.
#
proc statusBarRestore {window} {
  global showHelp statusBar

  if {! $showHelp} { return }
  if {[string range $window 0 7] == ".treeWin"} {
    ::tree::status
  } else {
    updateStatusBar
  }
}

bind Menu <Any-Enter> "+statusBarHelp %W \[ %W index @%y \]"
bind Menu <Any-Motion> "+statusBarHelp %W \[ %W index @%y \]"
bind Menu <Any-Leave> "+statusBarRestore %W"

bind Menubutton <Any-Enter> "+statusBarHelp %W"
bind Menubutton <Any-Leave> "+statusBarRestore %W"
bind Button <Any-Enter> "+statusBarHelp %W"
bind Button <Any-Leave> "+statusBarRestore %W"
bind Label <Any-Enter> "+statusBarHelp %W"
bind Label <Any-Leave> "+statusBarRestore %W"


############################################################
### Main window menus:

option add *Menu*TearOff 0

menu .menu
. configure -menu .menu

.menu add cascade -label File -menu .menu.file
.menu add cascade -label Edit -menu .menu.edit
.menu add cascade -label Game -menu .menu.game
.menu add cascade -label Search -menu .menu.search
.menu add cascade -label Windows -menu .menu.windows
.menu add cascade -label Tools -menu .menu.tools
.menu add cascade -label Options -menu .menu.options
.menu add cascade -label Help -menu .menu.helpmenu

foreach menuname { file edit game search windows tools options helpmenu } {
    menu .menu.${menuname}
}


### File menu:

set m .menu.file
$m add command -label FileNew -acc "Ctrl+N" -command fileNew
bind . <Control-n> fileNew
set helpMessage($m,0) FileNew

$m add command -label FileOpen -acc "Ctrl+O" -command fileOpen
bind . <Control-o> fileOpen
set helpMessage($m,1) FileOpen

$m add command -label FileClose -command fileClose
set helpMessage($m,2) FileClose

$m add command -label FileFinder -acc "Ctrl+/" -command fileFinder
bind . <Control-slash> fileFinder
set helpMessage($m,3) FileFinder

$m add cascade -label FileBookmarks -accelerator "Ctrl+B" -menu $m.bookmarks
set helpMessage($m,4) FileBookmarks
menu $m.bookmarks

$m add separator

menu $m.utils
$m add cascade -label FileMaint -menu .menu.file.utils
set helpMessage($m,6) FileMaint

$m.utils add checkbutton -label FileMaintWin \
  -accelerator "Ctrl+M" -variable maintWin -command makeMaintWin 
bind . <Control-m> makeMaintWin
set helpMessage($m.utils,0) FileMaintWin

$m.utils add command -label FileMaintCompact -command makeCompactWin
set helpMessage($m.utils,1) FileMaintCompact

$m.utils add command -label FileMaintClass -command classifyAllGames \
  -accelerator "Ctrl+Shift+C"
bind . <Control-C> classifyAllGames
set helpMessage($m.utils,2) FileMaintClass

$m.utils add command -label FileMaintSort -command makeSortWin
set helpMessage($m.utils,3) FileMaintSort

$m.utils add separator

$m.utils add command -label FileMaintDelete -state disabled -command markTwins
set helpMessage($m.utils,5) FileMaintDelete

$m.utils add command -label FileMaintTwin -command updateTwinChecker
set helpMessage($m.utils,6) FileMaintTwin

$m.utils add separator

menu $m.utils.name
$m.utils add cascade -label FileMaintName -menu .menu.file.utils.name
set helpMessage($m.utils,8) FileMaintName

$m.utils.name add checkbutton -label FileMaintNameEditor \
  -command nameEditor -variable nameEditorWin -accelerator "Ctrl+Shift+N"
bind . <Control-N> nameEditor
set helpMessage($m.utils.name,0) FileMaintNameEditor

$m.utils.name add command -label FileMaintNamePlayer -command {openSpellCheckWin Player}
set helpMessage($m.utils.name,1) FileMaintNamePlayer

$m.utils.name add command -label FileMaintNameEvent -command {openSpellCheckWin Event}
set helpMessage($m.utils.name,2) FileMaintNameEvent

$m.utils.name add command -label FileMaintNameSite -command {openSpellCheckWin Site}
set helpMessage($m.utils.name.3) FileMaintNameSite

$m.utils.name add command -label FileMaintNameRound -command {openSpellCheckWin Round}
set helpMessage($m.utils.name,4) FileMaintNameRound

bind . <Control-d> makeBaseWin

$m add command -label FileReadOnly -command makeBaseReadOnly
set helpMessage($m,7) FileReadOnly

$m add separator

set totalBaseSlots [sc_base count total]
set clipbaseSlot [sc_info clipbase]
set currentSlot [sc_base current]

for {set i 1} { $i <= $totalBaseSlots} {incr i} {
  $m add radiobutton -variable currentSlot -value $i -label "Base $i: <none>" \
    -underline 5 -accelerator "Ctrl+$i" -command "switchBase $i"
  set helpMessage($m,[expr $i + 8]) "Switch to base slot $i"
  if {$i == $clipbaseSlot} {
    set helpMessage($m,[expr $i + 8]) "Switch to the clipbase database"
  }
  bind . "<Control-Key-$i>" "switchBase $i"
}

proc switchBase {b} {
  sc_base switch $b
  # Close tree and email windows when a base is switched:
  #if {[winfo exists .treeWin]} { destroy .treeWin }
  if {[winfo exists .emailWin]} { destroy .emailWin }
  updateBoardAndPgn .board
  updateTitle
  updateMenuStates
  updateStatusBar
  updateGList
}

$m add separator

$m add command -label FileExit -accelerator "Ctrl+Q" -command fileExit
bind . <Control-q> fileExit
set helpMessage($m,[expr $totalBaseSlots + 10]) FileExit


### Edit menu:

set m .menu.edit
$m add command -label EditAdd \
  -accel "Ctrl+A" -command {sc_var create; updateBoardAndPgn .board}
set helpMessage($m,0) EditAdd

menu $m.del
$m add cascade -label EditDelete -menu $m.del
set helpMessage($m,1) EditDelete

menu $m.first
$m add cascade -label EditFirst -menu $m.first
set helpMessage($m,2) EditFirst

menu $m.main
$m add cascade -label EditMain -menu $m.main
set helpMessage($m,3) EditMain

$m add checkbutton -label EditTrial -variable trialMode \
  -accelerator "Ctrl+space" -command {setTrialMode update}
bind . <Control-space> { setTrialMode toggle }
set helpMessage($m,4) EditTrial

$m add cascade -label EditStrip -menu $m.strip
set helpMessage($m,5) EditStrip

menu $m.strip
$m.strip add command -label EditStripComments -command {gameStrip comments}
set helpMessage($m.strip,0) EditStripComments
$m.strip add command -label EditStripVars -command {gameStrip variations}
set helpMessage($m.strip,1) EditStripVars

$m add separator

$m add command -label EditReset -command {
  sc_clipbase clear
  updateBoardAndPgn .board
  updateGList
  updateTitle
}
set helpMessage($m,7) EditReset

$m add command -label EditCopy -accelerator "Ctrl+C" -command {
  catch {sc_clipbase copy}
  updateBoard .board
}
bind . <Control-c> {catch {sc_clipbase copy}; updateBoard .board}
set helpMessage($m,8) EditCopy

$m add command -label EditPaste -accelerator "Ctrl+V" -command {
  sc_clipbase paste
  updateBoardAndPgn .board
}
bind . <Control-v> {catch {sc_clipbase paste}; updateBoardAndPgn .board}
set helpMessage($m,9) EditPaste

$m add separator

$m add command -label EditSetup -accelerator "Ctrl+Shift+S" -command setupBoard
bind . <Control-S> setupBoard
set helpMessage($m,11) EditSetup

$m add command -label EditPasteBoard -accelerator "Ctrl+Shift+V" \
  -underline 12 -command pasteFEN
bind . <Control-V> pasteFEN
set helpMessage($m,12) EditPasteBoard


### Game menu:

set m .menu.game
$m add command -label GameNew -accelerator "Ctrl+X" -command gameClear
bind . <Control-x> gameClear
set helpMessage($m,0) GameNew

$m add command -label GameFirst -accelerator "Ctrl+Shift+Up" \
  -command {gameLoadNextPrev first}
bind . <Control-Shift-Up> {gameLoadNextPrev first}
set helpMessage($m,1) GameFirst

$m add command -label GamePrev -accelerator "Ctrl+Up" \
  -command {gameLoadNextPrev previous}
bind . <Control-Up> {gameLoadNextPrev previous}
set helpMessage($m,2) GamePrev

$m add command -label GameReload -command gameReload \
  -accelerator "Ctrl+Shift+L"
bind . <Control-L> gameReload
set helpMessage($m,3) GameReload

$m add command -label GameNext -accelerator "Ctrl+Down" \
  -command {gameLoadNextPrev next}
bind . <Control-Down> {gameLoadNextPrev next}
set helpMessage($m,4) GameNext

$m add command -label GameLast -accelerator "Ctrl+Shift+Down" \
  -command {gameLoadNextPrev last}
bind . <Control-Shift-Down> {gameLoadNextPrev last}
set helpMessage($m,5) GameLast

$m add command -label GameRandom -command gameLoadRandom -accelerator "Ctrl+?"
bind . <Control-question> gameLoadRandom
set helpMessage($m,6) GameRandom

$m add command -label GameNumber -command gameLoadNumber -accelerator "Ctrl+G"
bind . <Control-g> gameLoadNumber
set helpMessage($m,7) GameNumber

$m add separator

$m add command -label GameReplace -command gameReplace -accelerator "Ctrl+R"
bind . <Control-r> { .menu.game invoke [tr GameReplace] }
set helpMessage($m,9) GameReplace

$m  add command -label GameAdd -command gameAdd  -accelerator "Ctrl+S"
bind . <Control-s> gameAdd
set helpMessage($m,10) GameAdd

$m add separator

$m add command -label GameDeepest -accelerator "Ctrl+Shift+D" -command {
  sc_move ply [sc_eco game ply]
  updateBoard .board
}
bind . <Control-D> {sc_move ply [sc_eco game ply]; updateBoard .board}
set helpMessage($m,12) GameDeepest

$m add command -label GameGotoMove -accelerator "Ctrl+U" \
  -command gotoMoveNumber
set helpMessage($m,13) GameGotoMove
bind . <Control-u> gotoMoveNumber

$m add command -label GameNovelty -accelerator "Ctrl+Shift+Y" \
  -command findNovelty
bind . <Control-Y> findNovelty
set helpMessage($m,14) GameNovelty


### Search menu:

set m .menu.search
$m  add command -label SearchReset -acc "Ctrl+F" -command searchReset
bind . <Control-f> searchReset
set helpMessage($m,0) SearchReset

$m  add command -label SearchNegate -acc "Ctrl+Shift+F" -command searchNegate
bind . <Control-F> searchNegate
set helpMessage($m,1) SearchNegate

$m  add separator

$m  add command -label SearchCurrent \
  -command searchBoard -accelerator "Ctrl+Shift+B"
bind . <Control-B> searchBoard
set helpMessage($m,3) SearchCurrent

$m  add command -label SearchHeader \
  -command searchHeader -accelerator "Ctrl+Shift+H"
bind . <Control-H> searchHeader
set helpMessage($m,4) SearchHeader

$m  add command -label SearchMaterial \
  -command searchMaterial -accelerator "Ctrl+Shift+M"
bind . <Control-M> searchMaterial
set helpMessage($m,5) SearchMaterial

$m  add separator

$m add command -label SearchUsing -accel "Ctrl+Shift+U" \
  -command useSearchFile
bind . <Control-KeyPress-U> useSearchFile
set helpMessage($m,7) SearchUsing

proc useSearchFile {} {
  set ftype { { "Scid SearchOption files" {".sso"} } }
  set ::fName [tk_getOpenFile -initialdir $::initialDir(base) \
                 -filetypes $ftype -title "Select a SearchOptions file"]
  if {$::fName == ""} { return }

  if {[catch {uplevel "#0" {source $::fName} } ]} {
    tk_messageBox -title "Scid: Error reading file" -type ok -icon warning \
                -message "Unable to open or read SearchOptions file: $fName"
  } else {
    switch -- $::searchType {
      "Material" { searchMaterial }
      "Header"   { searchHeader }
      default    { return }
    }
  }
}


### Windows menu:

set m .menu.windows
$m  add checkbutton -label WindowsComment \
  -var commentWin -command makeCommentWin -accelerator "Ctrl+E"
bind . <Control-e> makeCommentWin
set helpMessage($m,0) WindowsComment

$m  add checkbutton -label WindowsGList \
  -variable glist -command makeGList  -accelerator "Ctrl+L"
bind . <Control-l> makeGList
set helpMessage($m,1) WindowsGList

$m  add checkbutton -label WindowsPGN \
  -variable pgnWin -command makePgnWin  -accelerator "Ctrl+P"
bind . <Control-p> makePgnWin
set helpMessage($m,2) WindowsPGN

$m add checkbutton -label WindowsTmt \
  -variable tourneyWin -command ::tourney::toggle -accelerator "Ctrl+Shift+T"
bind . <Control-T> ::tourney::toggle
set helpMessage($m,3) WindowsTmt

$m add separator

$m add checkbutton -label WindowsSwitcher \
  -variable baseWin -accelerator "Ctrl+D" -command makeBaseWin
set helpMessage($m,5) WindowsSwitcher

$m add checkbutton -label WindowsMaint \
  -accelerator "Ctrl+M" -variable maintWin -command makeMaintWin 
bind . <Control-m> makeMaintWin
set helpMessage($m,6) WindowsMaint

$m add separator

$m add checkbutton -label WindowsECO -accelerator "Ctrl+Y" \
  -variable ecoBrowserWin -command {openCloseEcoBrowser}
bind . <Control-y> openCloseEcoBrowser
set helpMessage($m,8) WindowsECO

$m add checkbutton -label WindowsRepertoire -variable ::rep::Win \
  -accelerator "Ctrl+Shift+P" -command ::rep::openCloseWindow
bind . <Control-P> ::rep::openCloseWindow
set helpMessage($m,9) WindowsRepertoire

$m add checkbutton -label WindowsStats -variable statsWin \
  -accelerator "Ctrl+I" -command makeStatsWin
bind . <Control-i> makeStatsWin
set helpMessage($m,10) WindowsStats

$m add checkbutton -label WindowsTree \
  -variable treeWin -command ::tree::make -accelerator "Ctrl+T"
bind . <Control-t> { .menu.windows invoke [tr WindowsTree] }
set helpMessage($m,11) WindowsTree

$m add checkbutton -label WindowsTB -variable tbWin -command ::tb::open \
  -accelerator "Ctrl+="
bind . <Control-equal> ::tb::open
set helpMessage($m,12) WindowsTB


### Tools menu:

set m .menu.tools

$m  add checkbutton -label ToolsAnalysis -variable analysisWin1 \
  -command makeAnalysisWin -accelerator "Ctrl+Shift+A"
bind . <Control-A> makeAnalysisWin
set helpMessage($m,0) ToolsAnalysis

$m  add checkbutton -label ToolsAnalysis2 -variable analysisWin2 \
  -command "makeAnalysisWin 2" -accelerator "Ctrl+Shift+2"
bind . <Control-at> "makeAnalysisWin 2"
set helpMessage($m,1) ToolsAnalysis2

$m add command -label ToolsCross \
  -accelerator "Ctrl+Shift+X" -command crosstabWin
bind . <Control-X> crosstabWin
set helpMessage($m,2) ToolsCross

$m add checkbutton -label ToolsEmail \
  -accelerator "Ctrl+Shift+E" -variable emailWin -command makeEmailWin
bind . <Control-E> makeEmailWin
set helpMessage($m,3) ToolsEmail

$m add checkbutton -label ToolsFilterGraph \
  -accelerator "Ctrl+Shift+G" -variable filterGraph -command makeFilterGraph
bind . <Control-G> makeFilterGraph
set helpMessage($m,4) ToolsFilterGraph

$m add command -label ToolsOpReport \
  -accelerator "Ctrl+Shift+O" -command ::optable::makeReportWin
bind . <Control-O> ::optable::makeReportWin
set helpMessage($m,5) ToolsOpReport

$m add command -label ToolsTracker \
  -accelerator "Ctrl+Shift+K" -command ::ptrack::make
bind . <Control-K> ::ptrack::make
set helpMessage($m,6) ToolsTracker

$m add separator

menu $m.pinfo
$m add cascade -label ToolsPInfo -menu $m.pinfo
$m.pinfo add command -label White -underline 0 -command {
  playerInfo [sc_game info white]
}
$m.pinfo add command -label Black -underline 0 -command {
  playerInfo [sc_game info black]
}
set helpMessage($m,8) ToolsPInfo

$m add command -label ToolsRating \
  -accelerator "Ctrl+Shift+R" -command {updateRatingGraph both}
bind . <Control-R> {updateRatingGraph both}
set helpMessage($m,9) ToolsRating

$m add command -label ToolsScore \
  -accelerator "Ctrl+Shift+Z" -command updateScoreGraph
bind . <Control-Z> updateScoreGraph
set helpMessage($m,10) ToolsScore

$m add separator

menu $m.exportcurrent

$m add cascade -label ToolsExpCurrent -menu $m.exportcurrent
set helpMessage($m,12) ToolsExpCurrent

$m.exportcurrent add command -label ToolsExpCurrentPGN \
  -command {exportGames current PGN}
set helpMessage($m.exportcurrent,0) ToolsExpCurrentPGN

$m.exportcurrent add command -label ToolsExpCurrentHTML \
  -command {exportGames current HTML}
set helpMessage($m.exportcurrent,1) ToolsExpCurrentHTML

$m.exportcurrent add command -label ToolsExpCurrentLaTeX \
  -command {exportGames current LaTeX}
set helpMessage($m.exportcurrent,2) ToolsExpCurrentLaTeX

menu $m.exportfilter

$m add cascade -label ToolsExpFilter -menu $m.exportfilter
set helpMessage($m,13) ToolsExpFilter

$m.exportfilter add command -label ToolsExpFilterPGN \
  -command {exportGames filter PGN}
set helpMessage($m.exportfilter,0) ToolsExpFilterPGN

$m.exportfilter add command -label ToolsExpFilterHTML \
  -command {exportGames filter HTML}
set helpMessage($m.exportfilter,1) ToolsExpFilterHTML

$m.exportfilter add command -label ToolsExpFilterLaTeX \
  -command {exportGames filter LaTeX}
set helpMessage($m.exportfilter,2) ToolsExpFilterLaTeX

$m add separator

$m add command -label ToolsImportOne \
  -accelerator "Ctrl+Shift+I" -command importPgnGame
bind . <Control-I> importPgnGame
set helpMessage($m,15) ToolsImportOne

$m add command -label ToolsImportFile -command importPgnFile
set helpMessage($m,16) ToolsImportFile

### Options menu:

set m .menu.options
$m add cascade -label OptionsSize -menu $m.bdsize
set helpMessage($m,0) OptionsSize

$m add cascade -label OptionsPieces -menu $m.pieces
set helpMessage($m,1) OptionsPieces

$m add command -label OptionsColors -command chooseBoardColors
set helpMessage($m,2) OptionsColors

set optMenus {export fonts ginfo language entry numbers startup windows}
set optLabels {Export Fonts GInfo Language Moves Numbers Startup Windows}
set i 3
foreach menu $optMenus label $optLabels {
  $m add cascade -label Options$label -menu $m.$menu
  set helpMessage($m,$i) Options$label
  incr i
}

$m add command -label OptionsToolbar -command configToolbar
set helpMessage($m,11) OptionsToolbar

$m add separator

$m add command -label OptionsECO -command {
  set ftype { { "Scid ECO files" {".eco"} } }
  if {[sc_info gzip]} {
    set ftype { { "Scid ECO files" {".eco" ".eco.gz"} } }
  }
  set fullname [tk_getOpenFile -initialdir [pwd] -filetypes $ftype -title "Load ECO file"]
  if {[string compare $fullname ""]} {
    if {[catch {sc_eco read $fullname} result]} {
      tk_messageBox -title "Scid" -type ok \
        -icon warning -message $result
    } else {
      set ecoFile $fullname
      tk_messageBox -title "Scid: ECO file loaded." -type ok -icon info \
        -message "ECO file $fullname loaded: $result positions.\n\nTo have this file automatically loaded when you start Scid, select \"Save Options\" from the Options menu before exiting."
    }
  }
}
set helpMessage($m,13) OptionsECO

$m add command -label OptionsSpell -command readSpellCheckFile
set helpMessage($m,14) OptionsSpell

$m add command -label OptionsTable -command setTableBaseDir
set helpMessage($m,15) OptionsTable
if {![sc_info tb]} { $m entryconfigure 15 -state disabled }

# setTableBaseDir:
#    Prompt user to select a tablebase file; all the files in its 
#    directory will be used.
#
proc setTableBaseDir {} {
  global initialDir tempDir
  set ftype { { "Tablebase files" {".emd" ".nbw" ".nbb"} } }

  set w .tbDialog
  toplevel $w
  wm title $w Scid
  label $w.title -text "Select up to 4 table base directories:"
  pack $w.title -side top
  foreach i {1 2 3 4} {
    set tempDir(tablebase$i) $initialDir(tablebase$i)
    pack [frame $w.f$i] -side top -pady 3 -fill x -expand yes
    entry $w.f$i.e -width 30 -textvariable tempDir(tablebase$i)
    bindFocusColors $w.f$i.e
    button $w.f$i.b -text "..." -pady 2 -command [list chooseTableBaseDir $i]
    pack $w.f$i.b -side right -padx 2
    pack $w.f$i.e -side left -padx 2 -fill x -expand yes
  }
  addHorizontalRule $w
  pack [frame $w.b] -side top -fill x
  button $w.b.ok -text "OK" \
    -command "catch {grab release $w; destroy $w}; openTableBaseDirs"
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w; destroy $w}"
  pack $w.b.cancel $w.b.ok -side right -padx 2
  bind $w <Escape> "$w.b.cancel invoke"
  wm resizable $w 1 0
  grab $w
}

proc openTableBaseDirs {} {
  global initialDir tempDir
  set tableBaseDirs ""
  foreach i {1 2 3 4} {
    set tbDir [string trim $tempDir(tablebase$i)]
    if {$tbDir != ""} {
      if {$tableBaseDirs != ""} { append tableBaseDirs ";" }
      append tableBaseDirs $tbDir
    }
  }

  set npieces [sc_info tb $tableBaseDirs]
  if {$npieces == 0} {
    set msg "No tablebases were found."
  } else {
    set msg "Tablebases with up to $npieces pieces were found.\n\n"
    append msg "If you want these tablebases be used whenever\n"
    append msg "you start Scid, select \"Save Options\" from the\n"
    append msg "Options menu before you exit Scid."
    foreach i {1 2 3 4} {
      set initialDir(tablebase$i) $tempDir(tablebase$i)
    }
  }
  tk_messageBox -type ok -icon info -title "Scid: Tablebase results" \
    -message $msg
    
}
proc chooseTableBaseDir {i} {
  global tempDir

  set ftype { { "Tablebase files" {".emd" ".nbw" ".nbb"} } }
  set idir $tempDir(tablebase$i)
  if {$idir == ""} { set idir [pwd] }

  set fullname [tk_getOpenFile -initialdir $idir -filetypes $ftype \
                  -title "Scid: Select a Tablebase file"]
  if {$fullname == ""} { return }

  set tempDir(tablebase$i) [file dirname $fullname]
}

$m add command -label OptionsRecent -command ::recentFiles::configure
set helpMessage($m,16) OptionsRecent

$m add separator

$m add command -label OptionsSave -command {
  set optionF ""
  if {[catch {open $optionsFile w} optionF]} {
    tk_messageBox -title "Scid: Unable to write file" -type ok -icon warning \
      -message "Unable to write options file: $optionsFile\n$optionF"
  } else {
    puts $optionF "# Scid options file"
    puts $optionF "# Version: $scidVersion"
    puts $optionF "# This file contains commands in the Tcl language format."
    puts $optionF "# If you edit this file, you must preserve valid its Tcl"
    puts $optionF "# format or it will not set your Scid options properly."
    puts $optionF ""
    foreach i {boardSize boardStyle language doColorPgn \
                 pgnIndentVars pgnIndentComments \
                 pgnSymbolicNags pgnMoveNumSpace pgnColumn \
                 tree(order) tree(autoSave) optionsAutoSave \
                 ecoFile suggestMoves glistSize glexport autoplayDelay \
                 boardCoords moveEntry(AutoExpand) moveEntry(Coord) \
                 askToReplaceMoves switcherVertical locale(numeric) \
                 spellCheckFile autoCloseSplash autoRaise autoIconify \
                 exportFlags(comments) exportFlags(vars) \
                 exportFlags(indentc) exportFlags(indentv) \
                 exportFlags(column) exportFlags(symbols) \
                 exportFlags(htmldiag) \
                 email(smtp) email(smproc) email(server) \
                 email(from) email(bcc) \
                 gameInfo(photos) gameInfo(hideNextMove) gameInfo(wrap) \
                 gameInfo(fullComment) gameInfo(showMarks) \
                 gameInfo(showMaterial) gameInfo(showFEN) gameInfo(showTB)} {
      puts $optionF "set $i [list [set $i]]"
    }
    foreach i [lsort [array names winWidth]] {
      puts $optionF "set winWidth($i)  [expr $winWidth($i)]"
      puts $optionF "set winHeight($i) [expr $winHeight($i)]"
    }
    foreach i [lsort [array names winX]] {
      puts $optionF "set winX($i)  [expr $winX($i)]"
      puts $optionF "set winY($i)  [expr $winY($i)]"
    }
    puts $optionF "set analysisCommand [list $analysisCommand]"
    puts $optionF "set analysisChoices [list $analysisChoices]"
    foreach i {lite dark whitecolor blackcolor highcolor bestcolor \
               whiteborder blackborder \
               pgnColor(Header) pgnColor(Main) pgnColor(Var) \
               pgnColor(Nag) pgnColor(Comment) pgnColor(Background) \
               pgnColor(Current) pgnColor(NextMove) } {
      puts $optionF "set $i [list [set $i]]"
    }
    foreach i [lsort [array names optable]] {
      puts $optionF "set optable($i) [list $optable($i)]"
    }
    foreach i [lsort [array names stats]] {
      puts $optionF "set stats($i) [list $stats($i)]"
    }
    foreach i [lsort [array names startup]] {
      puts $optionF "set startup($i) [list $startup($i)]"
    }
    foreach i [lsort [array names toolbar]] {
      puts $optionF "set toolbar($i) [list $toolbar($i)]"
    }
    foreach i [lsort [array names twinSettings]] {
      puts $optionF "set twinSettings($i) [list $twinSettings($i)]"
    }
    foreach i {Regular Menu Small Fixed} {
      puts $optionF "set fontOptions($i) [list $fontOptions($i)]"
    }
    puts $optionF "set glistFields [list $glistFields]"
    foreach type {base book html tex tablebase1 tablebase2 tablebase3 tablebase4} {
      puts $optionF "set initialDir($type) [list $initialDir($type)]"
    }
    foreach type {PGN HTML LaTeX} {
      puts $optionF "set exportStartFile($type) [list $exportStartFile($type)]"
      puts $optionF "set exportEndFile($type) [list $exportEndFile($type)]"
    }
    close $optionF
    set ::statusBar "Options were saved to: $optionsFile"
    #tk_messageBox -title "Saved options" -type ok -icon info \
      -message "Options were saved to: $optionsFile"
  }
}
set helpMessage($m,18) OptionsSave

$m add checkbutton -label OptionsAutoSave -variable optionsAutoSave
set helpMessage($m,19) OptionsAutoSave

menu $m.ginfo
$m.ginfo add checkbutton -label GInfoHideNext \
  -variable gameInfo(hideNextMove) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
$m.ginfo add checkbutton -label GInfoMaterial \
  -variable gameInfo(showMaterial) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
$m.ginfo add checkbutton -label GInfoFEN \
  -variable gameInfo(showFEN) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
$m.ginfo add checkbutton -label GInfoMarks \
  -variable gameInfo(showMarks) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
$m.ginfo add checkbutton -label GInfoWrap \
  -variable gameInfo(wrap) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
$m.ginfo add checkbutton -label GInfoFullComment \
  -variable gameInfo(fullComment) -offvalue 0 -onvalue 1 \
  -command {updateBoard .board}
#$m.ginfo add checkbutton -label Photos \
#  -variable gameInfo(photos) -offvalue 0 -onvalue 1 \
#  -command {updatePlayerPhotos -force}
$m.ginfo add separator
$m.ginfo add radiobutton -label GInfoTBNothing \
  -variable gameInfo(showTB) -value 0 -command {updateBoard .board}
$m.ginfo add radiobutton -label GInfoTBResult \
  -variable gameInfo(showTB) -value 1 -command {updateBoard .board}
$m.ginfo add radiobutton -label GInfoTBAll \
  -variable gameInfo(showTB) -value 2 -command {updateBoard .board}

menu $m.entry
$m.entry add checkbutton -label OptionsMovesAsk \
  -variable askToReplaceMoves -offvalue 0 -onvalue 1
set helpMessage($m.entry,0) OptionsMovesAsk \

$m.entry add command -label OptionsMovesDelay -command setAutoplayDelay
set helpMessage($m.entry,1) OptionsMovesDelay

$m.entry add checkbutton -label OptionsMovesCoord \
 -variable moveEntry(Coord) -offvalue 0 -onvalue 1
set helpMessage($m.entry,2) OptionsMovesCoord

$m.entry add checkbutton -label OptionsMovesKey \
  -variable moveEntry(AutoExpand) -offvalue 0 -onvalue 1
set helpMessage($m.entry,3) OptionsMovesKey

$m.entry add checkbutton -label OptionsMovesSuggest \
  -variable suggestMoves -offvalue 0 -onvalue 1
set helpMessage($m.entry,4) OptionsMovesSuggest

proc updateLocale {} {
  global locale
  sc_info decimal $locale(numeric)
  updateGList
  updateTitle
}

set m .menu.options.numbers
menu $m
foreach numeric {".,"   ". "   "."   ",."   ", "   ","} \
      underline {  0     1      2     4      5      6} {
  set decimal [string index $numeric 0]
  set thousands [string index $numeric 1]
  $m add radiobutton -label "12${thousands}345${decimal}67" \
    -underline $underline \
    -variable locale(numeric) -value $numeric -command updateLocale
}

set m .menu.options.export
menu $m
foreach format {PGN HTML LaTeX} {
  $m add command -label "$format file text" -underline 0 \
    -command "setExportText $format"
}

set m .menu.options.windows
menu $m
$m add checkbutton -label OptionsWindowsIconify -variable autoIconify
set helpMessage($m,0) OptionsWindowsIconify
$m add checkbutton -label OptionsWindowsRaise -variable autoRaise
set helpMessage($m,1) OptionsWindowsRaise

menu .menu.options.language

set m .menu.options.fonts
menu $m
$m add command -label OptionsFontsRegular -underline 0 -command {
  set fontOptions(temp) [FontDialog font_Regular $fontOptions(Regular)]
  if {$fontOptions(temp) != ""} { set fontOptions(Regular) $fontOptions(temp) }
  set font [font configure font_Regular -family]
  set fontsize [font configure font_Regular -size]
  font configure font_Bold -family $font -size $fontsize
  font configure font_Italic -family $font -size $fontsize
  font configure font_BoldItalic -family $font -size $fontsize
  font configure font_H1 -family $font -size [expr $fontsize + 8]
  font configure font_H2 -family $font -size [expr $fontsize + 6]
  font configure font_H3 -family $font -size [expr $fontsize + 4]
  font configure font_H4 -family $font -size [expr $fontsize + 2]
  font configure font_H5 -family $font -size [expr $fontsize + 0]
}
set helpMessage($m,0) OptionsFontsRegular
$m add command -label OptionsFontsMenu -underline 0 -command {
  set fontOptions(temp) [FontDialog font_Menu $fontOptions(Menu)]
  if {$fontOptions(temp) != ""} { set fontOptions(Menu) $fontOptions(temp) }
}
set helpMessage($m,1) OptionsFontsMenu
$m add command -label OptionsFontsSmall -underline 0 -command {
  set fontOptions(temp) [FontDialog font_Small $fontOptions(Small)]
  if {$fontOptions(temp) != ""} { set fontOptions(Small) $fontOptions(temp) }
  set font [font configure font_Small -family]
  set fontsize [font configure font_Small -size]
  font configure font_SmallBold -family $font -size $fontsize
  font configure font_SmallItalic -family $font -size $fontsize
}
set helpMessage($m,2) OptionsFontsFixed
$m add command -label OptionsFontsFixed -underline 0 -command {
  set fontOptions(temp) [FontDialog font_Fixed $fontOptions(Fixed) 1]
  if {$fontOptions(temp) != ""} { set fontOptions(Fixed) $fontOptions(temp) }
}
set helpMessage($m,3) OptionsFontsFixed

set m .menu.options.startup
menu $m
$m add checkbutton -label HelpTip -variable startup(tip)
$m add checkbutton -label ToolsCross -variable startup(crosstable)
$m add checkbutton -label WindowsSwitcher -variable startup(switcher)
$m add checkbutton -label FileFinder -variable startup(finder)
$m add checkbutton -label WindowsGList -variable startup(gamelist)
$m add checkbutton -label WindowsPGN -variable startup(pgn)
$m add checkbutton -label WindowsStats -variable startup(stats)
$m add checkbutton -label WindowsTree -variable startup(tree)

# Menu for changing board size:
menu .menu.options.bdsize
set count 0
foreach i $boardSizes {
  incr count
  set underline -1
  if {$count < 10} {set underline 0}
  if {$count == 10} {set underline 1}
  .menu.options.bdsize add radio -label $count -variable boardSize \
    -value $i -underline $underline -command "::board::resize .board $i"
  unset underline
}

# Shortcut keys for changing board size:

bind . <Control-Shift-Left>  decreaseBoardSize
bind . <Control-Shift-Right> increaseBoardSize

proc decreaseBoardSize {} {
  global boardSize
  set boardSize [::board::resize .board -1]
}

proc increaseBoardSize {} {
  global boardSize
  set boardSize [::board::resize .board +1]
}

# Menu for changing Piece set:
menu .menu.options.pieces
foreach i $boardStyles {
  .menu.options.pieces add radio -label $i -variable boardStyle -value $i \
    -underline 0 -command "setPieceFont $i"
}

### Help menu:
set m .menu.helpmenu
$m add command -label HelpIndex -command {helpWindow Index} -accelerator "F1"
set helpMessage($m,0) HelpIndex
$m add command -label HelpGuide -command {helpWindow Guide}
set helpMessage($m,1) HelpGuide
$m add command -label HelpHints -command {helpWindow Hints}
set helpMessage($m,2) HelpHints
$m add command -label HelpContact -command {helpWindow Author}
set helpMessage($m,3) HelpContact
$m add command -label HelpTip -command ::tip::show
set helpMessage($m,4) HelpTip
$m add separator
$m add command -label HelpStartup -command {
  wm deiconify .splash
  raiseWin .splash
}
set helpMessage($m,6) HelpStartup
$m  add command -label HelpAbout -command helpAbout
set helpMessage($m,7) HelpAbout

bind . <F1> {helpWindow Index}

##################################################

# updateMenuStates:
#   Update all the menus, rechecking which state each item should be in.
#
proc updateMenuStates {} {
  global totalBaseSlots windowsOS
  set ::currentSlot [sc_base current]
  set lang $::language
  set m .menu
  for {set i 1} { $i <= $totalBaseSlots } { incr i } {
    set fname [file tail [sc_base filename $i]]
    $m.file entryconfig [expr $i + 8] -label "Base $i: $fname"
  }
  foreach i {Compact Delete} {
    $m.file.utils entryconfig [tr FileMaint$i] -state disabled
  }
  foreach i {Player Event Site Round} {
    $m.file.utils.name entryconfig [tr FileMaintName$i] -state disabled
  }
  $m.file entryconfig [tr FileReadOnly] -state disabled

  # Remove and reinsert the Recent files list and Exit command:
  set idx [expr $::totalBaseSlots + 10]
  $m.file delete $idx end
  set nrecent [::recentFiles::show $m.file]
  incr idx $nrecent
  if {$nrecent > 0} {
    $m.file add separator
    incr idx
  }
  $m.file add command -label [tr FileExit] -accelerator "Ctrl+Q" \
    -command fileExit
  set helpMessage($m.file,$idx) FileExit

  if {[sc_base inUse]} {
    set isReadOnly [sc_base isReadOnly]
    $m.file entryconfig [tr FileClose] -state normal
    if {! $isReadOnly} {
      $m.file.utils entryconfig [tr FileMaintDelete] -state normal
      $m.file.utils entryconfig [tr FileMaintName] -state normal
      foreach i {Player Event Site Round} {
        $m.file.utils.name entryconfig [tr FileMaintName$i] -state normal
      }
      $m.file entryconfig [tr FileReadOnly] -state normal
    }

    # Load first/last/random buttons:
    set filtercount [sc_filter count]
    if {$filtercount == 0} {set state disabled} else {set state normal}
    $m.game entryconfig [tr GameFirst] -state $state
    $m.game entryconfig [tr GameLast] -state $state
    $m.game entryconfig [tr GameRandom] -state $state

    # Load previous button:
    if {[sc_filter previous]} {set state normal} else {set state disabled}
    $m.game entryconfig [tr GamePrev] -state $state
    .tb.gprev configure -state $state

    # Reload button:
    if {[sc_game number]} {set state normal} else {set state disabled}
    $m.game entryconfig [tr GameReload] -state $state

    # Load next button:
    if {[sc_filter next]} {set state normal} else {set state disabled}
    $m.game entryconfig [tr GameNext] -state $state
    .tb.gnext configure -state $state

    $m.game entryconfig [tr GameNumber] -state normal

    # Save add button:
    set state normal
    if {$isReadOnly  ||  $::trialMode} {set state disabled}
    $m.game entryconfig [tr GameAdd] -state $state

    # Save replace button:
    set state normal
    if {[sc_game number] == 0  ||  $isReadOnly  ||  $::trialMode} {
      set state disabled
    }
    $m.game entryconfig [tr GameReplace] -state $state

    # Searching:
    foreach i {Reset Negate} {
      $m.search entryconfig [tr Search$i] -state normal
    }
    #$m.windows entryconfig [tr WindowsTree] -state normal

    # Tools:
    # Email manager only available in Unix:
    $m.tools entryconfig [tr ToolsEmail] -state normal
    $m.tools entryconfig [tr ToolsOpReport] -state normal

  } else {
    # Base is not in use:
    $m.file entryconfig [tr FileClose] -state disabled

    foreach i {First Prev Reload Next Last Random Number Replace Add} {
      $m.game entryconfig [tr Game$i] -state disabled
    }
    .tb.gprev configure -state disabled
    .tb.gnext configure -state disabled

    # search:
    foreach i {Reset Negate} {
      $m.search entryconfig [tr Search$i] -state disabled
    }
    #$m.windows entryconfig [tr WindowsTree] -state disabled

    # tools:
    $m.tools entryconfig [tr ToolsEmail] -state disabled
    $m.tools entryconfig [tr ToolsOpReport] -state disabled
  }

  if {[sc_base numGames] == 0} {
    $m.tools entryconfig [tr ToolsExpFilter] -state disabled
  } else {
    $m.tools entryconfig [tr ToolsExpFilter] -state normal
  }

  set state disabled
  if {[baseIsCompactable]} { set state normal }
  $m.file.utils entryconfig [tr FileMaintCompact] -state $state

  configSearchState
  updateBaseWin
  updateMaintWin
  ::bookmarks::refresh
}


##############################
#
# Multiple-language menu support functions.

# configMenuName:
#    Reconfigure a menu name.
#
proc configMenuName {menu tag lang} {
  global menuLabel menuUnder
  if {[info exists menuLabel($lang,$tag)] && [info exists menuUnder($lang,$tag)]} {
    $menu configure -text $menuLabel($lang,$tag) \
      -underline $menuUnder($lang,$tag)
  } else {
    $menu configure -text $menuLabel(E,$tag) \
      -underline $menuUnder(E,$tag)
  }
}

# configMenuText:
#    Reconfigures the main window menus. Called when the language is changed.
#
proc configMenuText {menu entry tag lang} {
  global menuLabel menuUnder
  if {[info exists menuLabel($lang,$tag)] && [info exists menuUnder($lang,$tag)]} {
      $menu entryconfig $entry -label $menuLabel($lang,$tag) \
        -underline $menuUnder($lang,$tag)
  } else {
      $menu entryconfig $entry -label $menuLabel(E,$tag) \
        -underline $menuUnder(E,$tag)
  }
}

proc setLanguageMenus {{lang ""}} {
  global menuLabel menuUnder oldLang

  if {$lang == ""} {set lang $::language}

  foreach tag {File Edit Game Search Windows Tools Options Help} {
    configMenuText .menu [tr $tag $oldLang] $tag $lang
  }

  foreach tag {New Open Close Finder Bookmarks Maint ReadOnly Exit} {
    configMenuText .menu.file [tr File$tag $oldLang] File$tag $lang
  }
  foreach tag {Win Compact Delete Twin Class Sort Name} {
    configMenuText .menu.file.utils [tr FileMaint$tag $oldLang] \
      FileMaint$tag $lang
  }
  foreach tag {Editor Player Event Site Round} {
    configMenuText .menu.file.utils.name [tr FileMaintName$tag $oldLang] \
      FileMaintName$tag $lang
  }
  foreach tag {Add Delete First Main Trial Strip Reset Copy Paste Setup PasteBoard} {
    configMenuText .menu.edit [tr Edit$tag $oldLang] Edit$tag $lang
  }
  foreach tag {Comments Vars} {
    configMenuText .menu.edit.strip [tr EditStrip$tag $oldLang] \
      EditStrip$tag $lang
  }
  foreach tag {New First Prev Reload Next Last Random Number
               Replace Add Deepest GotoMove Novelty} {
    configMenuText .menu.game [tr Game$tag $oldLang] Game$tag $lang
  }
  foreach tag {Reset Negate Material Current Header Using} {
    configMenuText .menu.search [tr Search$tag $oldLang] Search$tag $lang
  }
  foreach tag {Comment GList PGN Tmt Switcher Maint ECO Repertoire Stats Tree TB} {
    configMenuText .menu.windows [tr Windows$tag $oldLang] Windows$tag $lang
  }
  foreach tag {Analysis Analysis2 Cross Email FilterGraph OpReport Tracker
               Rating Score ExpCurrent ExpFilter ImportOne ImportFile PInfo} {
    configMenuText .menu.tools [tr Tools$tag $oldLang] Tools$tag $lang
  }
  .menu.tools.pinfo entryconfigure 0 -label $::tr(White)
  .menu.tools.pinfo entryconfigure 1 -label $::tr(Black)
  foreach tag {ToolsExpCurrentPGN ToolsExpCurrentHTML ToolsExpCurrentLaTeX} {
    configMenuText .menu.tools.exportcurrent [tr $tag $oldLang] $tag $lang
  }
  foreach tag {ToolsExpFilterPGN ToolsExpFilterHTML ToolsExpFilterLaTeX} {
    configMenuText .menu.tools.exportfilter [tr $tag $oldLang] $tag $lang
  }
  foreach tag {Size Pieces Colors Export Fonts GInfo Language Moves Numbers
               Startup Toolbar Windows ECO Spell Table Recent Save AutoSave} {
    configMenuText .menu.options [tr Options$tag $oldLang] Options$tag $lang
  }
  foreach tag {Regular Menu Small Fixed} {
    configMenuText .menu.options.fonts [tr OptionsFonts$tag $oldLang] \
      OptionsFonts$tag $lang
  }
  foreach tag {HideNext Material FEN Marks Wrap FullComment \
                 TBNothing TBResult TBAll} {
    configMenuText .menu.options.ginfo [tr GInfo$tag $oldLang] \
      GInfo$tag $lang
  }
  foreach tag {Ask Delay Suggest Key Coord} {
    configMenuText .menu.options.entry [tr OptionsMoves$tag $oldLang] \
      OptionsMoves$tag $lang
  }
  foreach tag {HelpTip WindowsSwitcher WindowsPGN WindowsTree FileFinder \
                 ToolsCross WindowsGList WindowsStats} {
    configMenuText .menu.options.startup [tr $tag $oldLang] $tag $lang
  }
  foreach tag {Iconify Raise} {
    configMenuText .menu.options.windows [tr OptionsWindows$tag $oldLang] \
      OptionsWindows$tag $lang
  }
  foreach tag {Index Guide Hints Contact Tip Startup About} {
    configMenuText .menu.helpmenu [tr Help$tag $oldLang] Help$tag $lang
  }

  foreach tag {HideNext Material FEN Marks Wrap FullComment \
                 TBNothing TBResult TBAll Delete Mark} {
    configMenuText .gameInfo.menu [tr GInfo$tag $oldLang] GInfo$tag $lang
  }

  set i 0
  foreach flag $::maintFlaglist {
    .gameInfo.menu.mark entryconfigure $i \
      -label "$::tr($::maintFlags($flag)) ($flag)"
    incr i
  }

  configPgnMenus
  configStatsMenus
  ::tree::configMenus
  configCrosstabMenus
  ::optable::configMenus
  ::tourney::configMenus

  # Check for duplicate menu underline characters in this language:
  # set ::verifyMenus 1
  if {[info exists ::verifyMenus] && $::verifyMenus} {
    foreach m {file edit game search windows tools options help} {
      set list [checkMenuUnderline .menu.$m]
      if {[llength $list] > 0} {
        puts stderr "Menu $m has duplicate underline letters: $list"
      }
    }
  }
}

# checkMenuUnderline:
#  Given a menu widget, returns a list of all the underline
#  characters that appear more than once.
#
proc checkMenuUnderline {menu} {
  array set found {}
  set duplicates {}
  set last [$menu index last]
  for {set i [$menu cget -tearoff]} {$i <= $last} {incr i} {
    if {[string equal [$menu type $i] "separator"]} {
      continue
    }
    set char [string index [$menu entrycget $i -label] \
                [$menu entrycget $i -underline]]
    set char [string tolower $char]
    if {$char == ""} { 
      continue 
    }
    if {[info exists found($char)]} {
      lappend duplicates $char
    }
    set found($char) 1
  }
  return $duplicates
}


# standardShortcuts:
#    Sets up a number of standard shortcut keys for the specified window.
#
proc standardShortcuts {w} {
  if {! [winfo exists $w]} { return }
  bind $w <Control-o> fileOpen
  bind $w <Control-slash> fileFinder
  bind $w <Control-m> makeMaintWin
  bind $w <Control-d> makeBaseWin
  bind $w <Control-q> fileExit
  bind $w <Control-L> gameReload
  bind $w <Control-Shift-Up> {gameLoadNextPrev first}
  bind $w <Control-Shift-Down> {gameLoadNextPrev last}
  bind $w <Control-Up> {gameLoadNextPrev previous}
  bind $w <Control-Down> {gameLoadNextPrev next}
  bind $w <Control-question> gameLoadRandom
  bind $w <Control-g> gameLoadNumber
  bind $w <Control-f> searchReset
  bind $w <Control-B> searchBoard
  bind $w <Control-H> searchHeader
  bind $w <Control-M> searchMaterial
  bind $w <Control-KeyPress-U> useSearchFile
  bind $w <Control-e> makeCommentWin
  bind $w <Control-l> makeGList
  bind $w <Control-p> makePgnWin
  bind $w <Control-T> ::tourney::toggle
  bind $w <Control-i> makeStatsWin
  bind $w <Control-t> ::tree::make
  bind $w <Control-A> makeAnalysisWin
  bind $w <Control-X> crosstabWin
  bind $w <Control-E> makeEmailWin
  bind $w <Control-O> ::optable::makeReportWin
  bind $w <Control-R> {updateRatingGraph both}
  bind $w <Control-Z> updateScoreGraph
  bind $w <Control-I> importPgnGame
  for {set i 1} { $i <= $::totalBaseSlots} {incr i} {
    bind $w "<Control-Key-$i>" "switchBase $i"
  }
}

### End of file: menus.tcl

###
### windows.tcl: part of Scid.
### Copyright (C) 1999-2001  Shane Hudson.
###


########################################################################
###  Optional windows: all off initially.

set treeWin 0
set pgnWin 0
set statsWin 0
set commentWin 0
set bookWin 0
set filterGraph 0

set nagValue 0

# recordWinSize:
#   Records window width and height, for saving in options file.
#
proc recordWinSize {win} {
  global winWidth winHeight tempWidth tempHeight winX winY
  if {![winfo exists $win]} { return }
  set temp [wm geometry $win]
  set n [scan $temp "%dx%d" tempWidth tempHeight]
  if {$n == 2} {
    set winWidth($win) $tempWidth
    set winHeight($win) $tempHeight
  }
  set tempX [winfo rootx $win]
  set tempY [winfo rooty $win]
  incr tempX -$winX(offset)
  incr tempY -$winY(offset)
  # Account for menu height and border if recording the main window
  # position, since it does not get included in the "winfo rooty" value:
  if {$win == "."} {
    incr tempY -[winfo y .button]
    incr tempY -6
  }
  set winX($win) $tempX
  set winY($win) $tempY
}

proc setWinLocation {win} {
  global winX winY
  if {[info exists winX($win)]  &&  [info exists winY($win)]  && \
        $winX($win) >= 0  &&  $winY($win) >= 0} {
    wm geometry $win "+$winX($win)+$winY($win)"
  }
}

########################################################################
### Games list window

set glist 0
set glstart 1
set glSelection 0
set glNumber 0

array set glName {
  g Number
  f Filtered
  w White
  W WElo
  b Black
  B BElo
  e Event
  s Site
  n Round
  d Date
  y Year
  E EDate
  r Result
  m Length
  c Country
  o ECO
  O Opening
  F EndMaterial
  D Deleted
  U Flags
  V Vars
  C Comments
  A Annos
  S Start
}

# glistExtra is the window that displays the starting moves of a
# game when the middle mouse button is pressed in the game list window.

toplevel .glistExtra
wm withdraw .glistExtra
wm overrideredirect .glistExtra 1
text .glistExtra.text -font font_Small -background lightYellow \
  -width 40 -height 8 -wrap word -relief solid -borderwidth 1
pack .glistExtra.text -side top

set glistMaxWidth 30

set glFindText ""
set glGoto ""
trace variable glGoto w {forceRegexp {^[0-9]*$}}

proc findGListText {} {
  global glstart glFindtext
  busyCursor .glistWin 1
  set temp [sc_filter textfind $glstart $glFindtext]
  busyCursor .glistWin 0
  if {$temp < 1} { set temp 1 }
  set glstart $temp
  updateGList
}

proc makeGList {} {
  global glist glstart glistSize highcolor glSelection helpMessage
  global glistFields glNumber glGoto glFindText buttoncolor glName
  if [winfo exists .glistWin] {
    focus .
    destroy .glistWin
    set glist 0
    return
  }
  set w .glistWin
  toplevel $w
  # Window is only directly resizable vertically:
  wm resizable $w false true
  setWinLocation $w

  # Pack buttons frame first:
  pack [frame $w.b] -side bottom -fill x -ipady 5 -padx 10
  scale $w.scale -from 1 -length 250 -orient horiz \
    -variable glstart -showvalue 0 -command {setGLstart} \
    -bigincrement $glistSize -takefocus 0 -width 10 -troughcolor $buttoncolor
  pack $w.scale -side bottom -fill x -padx 30 -pady 4
  frame $w.columns -takefocus 1 -highlightcolor black -highlightthickness 2
  pack $w.columns -side top -expand yes -fill both

  # Make each column in the listing:
  foreach i $glistFields {
    set code [lindex $i 0]
    set width [lindex $i 1]
    set justify [lindex $i 2]
    set fgcolor [lindex $i 3]
    set sep [lindex $i 4]
    frame $w.c$code

    if {[info exists glName($code)]} { set name $glName($code) }
    if {[info exists ::tr(Glist$name)]} { set name $::tr(Glist$name) }

    # Each heading is a label:
    label $w.c$code.header -foreground darkBlue -width $width \
      -font font_Small -relief flat -background gray90 \
      -text $name -anchor w
    set helpMessage(E,$w.c$code.header) \
      {Press the left or right mouse button here for a configuration menu}

    bind $w.c$code.header <Control-ButtonPress-3> "incrGLwidth $code; break"
    bind $w.c$code.header <Control-ButtonPress-1> "decrGLwidth $code; break"
    bind $w.c$code.header <Shift-ButtonPress-3> "incrGLwidth $code; break"
    bind $w.c$code.header <Shift-ButtonPress-1> "decrGLwidth $code; break"
    bind $w.c$code.header <ButtonPress-1> "popupGLconfig $code %x %y %X %Y"
    bind $w.c$code.header <ButtonPress-3> "popupGLconfig $code %x %y %X %Y"
    pack $w.c$code -in $w.columns -side left -expand yes -fill y -padx 0
    pack $w.c$code.header -side top
    addHorizontalRule $w.c$code 1 flat

    text $w.c$code.text -background white -width $width \
      -height $glistSize -font font_Small -relief flat \
      -foreground $fgcolor -wrap none -setgrid 1 -cursor top_left_arrow
    $w.c$code.text tag configure align -justify $justify \
      -foreground $fgcolor
    $w.c$code.text tag configure highlight -background lightBlue
    $w.c$code.text tag configure current -background lightYellow2
    $w.c$code.text tag configure underline -underline true

    bind $w.c$code.text <Button1-Motion> "break"
    bind $w.c$code.text <Button2-Motion> "break"
    bind $w.c$code.text <Double-Button-1> \
      "setGLselection $code %x %y; gameLoad \$glNumber; break"
    bind $w.c$code.text <Button-1> \
      "setGLselection $code %x %y; highlightGLline \$glSelection; break"
    bind $w.c$code.text <ButtonRelease-1> \
      "setGLselection $code %x %y; unhighlightGL; break"

    bind $w.c$code.text <ButtonPress-3> "popupGLmenu $code %x %y %X %Y"

    bind $w.c$code.text <ButtonPress-2> \
      "setGLselection $code %x %y; showMovesGList %X %Y; break"
    bind $w.c$code.text <ButtonRelease-2> \
      "wm withdraw .glistExtra; unhighlightGL; break"

    pack $w.c$code.text -side top -expand true -fill y
    if {$sep} { addVerticalRule $w.columns 1 flat }
  }

  menu $w.config -tearoff 0
  $w.config add cascade -label $::tr(GlistMoveField) -menu $w.config.move
  menu $w.config.move -tearoff 0
  $w.config add command -label $::tr(GlistEditField...)
  $w.config add cascade -label $::tr(GlistAddField) -menu $w.config.insert
  menu $w.config.insert -tearoff 0
  $w.config add command -label $::tr(GlistDeleteField)

  menu $w.popup -tearoff 0
  $w.popup add command -label $::tr(BrowseGame) \
    -command {::gbrowser::new 0 $glNumber}
  $w.popup add command -label $::tr(LoadGame) -command {gameLoad $glNumber}
  $w.popup add command -label $::tr(MergeGame) -command mergeGame
  $w.popup add separator
  $w.popup add command -label "Remove this game from Filter" \
    -command removeFromFilter
  $w.popup add command -label "Remove game (and all above it) from Filter" \
    -command {removeFromFilter up}
  $w.popup add command -label "Remove game (and all below it) from Filter" \
    -command {removeFromFilter down}
  $w.popup add separator
  $w.popup add command -label "(Un)Delete this game" \
    -command {toggleGameFlag delete}
  $w.popup add command -label "Delete all games in filter" \
    -command {catch {sc_game flag delete filter 1}; updateGList}
  $w.popup add command -label "Undelete all games in filter" \
    -command {catch {sc_game flag delete filter 0}; updateGList}

  button $w.b.start -image tb_start -command {set glstart 1; updateGList}
  set helpMessage(E,$w.b.start) {Go to the first page of games}

  button $w.b.pgup -image tb_prev -command {
    set glstart [expr $glstart - $glistSize];
    if {$glstart < 1} { set glstart 1 };
    updateGList
  }
  set helpMessage(E,$w.b.pgup) {Previous page of games}

  button $w.b.pgdn -image tb_next  -command {
    set glstart [expr $glstart + $glistSize];
    if {$glstart > [sc_filter count] } {
      set glstart [sc_filter count]
    }
    if {$glstart < 1} { set glstart 1 }
    updateGList
  }
  set helpMessage(E,$w.b.pgdn) {Next page of games}

  button $w.b.end -image tb_end -command {
    set glstart [expr [sc_filter count] - $glistSize + 1]
    if {$glstart < 1} { set glstart 1}
    updateGList
  }
  set helpMessage(E,$w.b.end) {Go to the last page of games}

  button $w.b.current -textvar ::tr(Current) -font font_Small -command {
    set glstart [sc_filter locate [sc_game number]]
    if {$glstart < 1} { set glstart 1}
    updateGList
  }

  bind $w <Up> {
    set glstart [expr $glstart - 1]
    if {$glstart < 1} { set glstart 1 }
    updateGList
  }
  bind $w <Down> {
    set glstart [expr $glstart + 1]
    if {$glstart > [sc_filter count] } {
      set glstart [sc_filter count]
    }
    updateGList
  }

  bind $w <Home>  "$w.b.start invoke"
  bind $w <End>   "$w.b.end invoke"
  bind $w <Prior> "$w.b.pgup invoke"
  bind $w <Next>  "$w.b.pgdn invoke"

  label $w.b.gotolabel -textvar ::tr(GlistGameNumber:)
  entry $w.b.goto -bg white -width 8 -textvariable glGoto
  bind $w.b.goto <Home> "$w.b.start invoke; break"
  bind $w.b.goto <End> "$w.b.end invoke; break"
  bind $w.b.goto <Return> {
    set glstart [sc_filter locate $glGoto]
    if {$glstart < 1} { set glstart 1}
    set glGoto ""
    updateGList
  }

  label $w.b.findlabel -textvar ::tr(GlistFindText:)
  entry $w.b.find -background white -width 15 -textvariable glFindtext
  bind $w.b.find <Return> findGListText
  bind $w.b.find <Home> "$w.b.find icursor 0; break"
  bind $w.b.find <End> "$w.b.find icursor end; break"

  frame $w.b.space -width 0.25c
  frame $w.b.space2 -width 0.25c

  button $w.b.export -textvar ::tr(Save...) -command openExportGList
  button $w.b.help -textvar ::tr(Help) -command { helpWindow GameList }
  button $w.b.close -textvar ::tr(Close) -command { focus .; destroy .glistWin }

  pack $w.b.start $w.b.pgup $w.b.pgdn $w.b.end $w.b.current -side left -padx 1
  pack $w.b.space $w.b.gotolabel $w.b.goto -side left
  pack $w.b.space2 $w.b.findlabel $w.b.find -side left
  pack $w.b.close $w.b.help $w.b.export -side right -padx 5

  set glist 1
  bind $w <F1> { helpWindow GameList }
  bind $w <Destroy> { set glist 0 }
  bind $w <Escape> "$w.b.close invoke"
  standardShortcuts $w

  # Binding to reset glistSize when the window is resized:
  # The way this is done is very ugly, but the only way I could
  # find that actually works.
  # Set temp to window geometry (e.g. 80x20+...) and then
  # extract the part between the "x" and the first "+" or "-":
  bind $w <Configure> {
    recordWinSize .glistWin
    set temp [wm geometry .glistWin]
    set temp [string range $temp [expr [string first "x" $temp] + 1] end]
    set idx [string first "+" $temp]
    if {$idx != -1} {
      set temp [string range $temp 0 [expr $idx - 1]]
    }
    set idx [string first "-" $temp]
    if {$idx != -1} {
      set temp [string range $temp 0 [expr $idx - 1]]
    }
    if {$temp != $glistSize && $temp > 0} {
      set glistSize $temp
      updateGList
    }
  }

  wm iconname $w "Scid: [tr WindowsGList]"
  updateGList
  focus $w.b.goto
}

proc setGLselection {code xcoord ycoord} {
  global glSelection glNumber
  set glSelection [expr int([.glistWin.c$code.text index @$xcoord,$ycoord])]
  set glNumber [.glistWin.cg.text get $glSelection.0 $glSelection.end]
}

proc incrGLwidth {code} {
  global glistSize glistMaxWidth
  set w .glistWin.c$code
  set width [$w.header cget -width]
  if {$width >= $glistMaxWidth} { return }
  incr width
  $w.header configure -width $width
  $w.text configure -width $width
  updateGLwidths $code $width
}

proc decrGLwidth {code} {
  global glistSize
  set w .glistWin.c$code
  set width [$w.header cget -width]
  if {$width <= 1} { return }
  incr width -1
  $w.header configure -width $width
  $w.text configure -width $width
  updateGLwidths $code $width
}

proc updateGLwidths {code width} {
  global glistFields
  set len [llength $glistFields]
  for {set i 0} {$i < $len} {incr i} {
    set column [lindex $glistFields $i]
    set tcode [lindex $column 0]
    if {$tcode != $code} { continue }
    set oldwidth [lindex $column 1]
    if {$oldwidth != $width} {
      set column [lreplace $column 1 1 $width]
      set glistFields [lreplace $glistFields $i $i $column]
    }
  }
}

proc unhighlightGL {} {
  global glistFields glistSize
  foreach column $glistFields {
    set code [lindex $column 0]
    .glistWin.c$code.text tag remove highlight 1.0 end
  }
}

proc highlightGLline {linenum} {
  global glistFields glistSize
  foreach column $glistFields {
    set code [lindex $column 0]
    .glistWin.c$code.text tag remove highlight 1.0 end
    .glistWin.c$code.text tag add highlight $linenum.0 [expr $linenum+1].0
  }
}

proc popupGLconfig {code xcoord ycoord xscreen yscreen} {
  global glistFields glistAllFields
  set menu .glistWin.config

  # Move-field submenu:
  $menu.move delete 0 end
  $menu.move add command -label "|<<" -command "moveGLfield $code -99"
  $menu.move add command -label "<" -command "moveGLfield $code -1"
  $menu.move add command -label ">" -command "moveGLfield $code 1"
  $menu.move add command -label ">>|" -command "moveGLfield $code 99"

  # Configure-field command:
  $menu entryconfig 1 -command "configGLdialog $code"

  # Insert-field submenu:
  array set displayed {}
  foreach column $glistAllFields {
    set field [lindex $column 0]
    set displayed($field) 0
  }
  foreach column $glistFields {
    set tcode [lindex $column 0]
    set displayed($tcode) 1
  }
  $menu.insert delete 0 end
  foreach column $glistAllFields {
    set tcode [lindex $column 0]
    if {! $displayed($tcode)} {
      set name $::glName($tcode)
      $menu.insert add command -label $::tr(Glist$name) \
        -command "insertGLfield $code $tcode"
    }
  }

  # Delete-field command:
  if {$code == "g"} {
    $menu entryconfig 3 -state disabled
  } else {
    $menu entryconfig 3 -state normal -command "deleteGLfield $code"
  }
  # event generate .glistWin <ButtonRelease-3>
  $menu post $xscreen [expr $yscreen + 2]
  event generate $menu <ButtonPress-1>
}

array set glconfig {}

proc configGLdialog {code} {
  global glistFields glconfig glName
  foreach column $glistFields {
    if {$code == [lindex $column 0]} {
      set glconfig(width) [lindex $column 1]
      set glconfig(align) [lindex $column 2]
      set glconfig(color) [lindex $column 3]
      set glconfig(sep) [lindex $column 4]
    }
  }
  set w .glconfig
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid"
  label $w.title -text "$glName($code)" -font font_Bold
  pack $w.title -side top
  pack [frame $w.g] -side top -fill x
  label $w.g.width -text $::tr(GlistWidth)
  set m [tk_optionMenu $w.g.vwidth glconfig(width) 1 2 3 4 5 6 7 8 9 10 \
           11 12 13 14 15 16 17 18 19 20]
  $w.g.vwidth configure -width 3
  $m entryconfigure 10 -columnbreak 1
  label $w.g.align -text $::tr(GlistAlign)
  frame $w.g.valign
  radiobutton $w.g.valign.left -text "<<" -indicatoron 0 \
    -variable glconfig(align) -value left
  radiobutton $w.g.valign.right -text ">>" -indicatoron 0 \
    -variable glconfig(align) -value right
  pack $w.g.valign.left $w.g.valign.right -side left -padx 1
  label $w.g.color -text $::tr(GlistColor)
  frame $w.g.vcolor
  foreach color {black darkBlue blue darkGreen darkRed red2 gray50} {
    image create photo color_$color -width 14 -height 16
    color_$color put $color -to 1 1 12 14
    radiobutton $w.g.vcolor.$color -image color_$color -indicatoron 0 \
      -variable glconfig(color) -value $color
    pack $w.g.vcolor.$color -side left -padx 1
  }
  label $w.g.sep -text $::tr(GlistSep)
  frame $w.g.vsep
  radiobutton $w.g.vsep.yes -text $::tr(Yes) -indicatoron 0 \
    -variable glconfig(sep) -value 1
  radiobutton $w.g.vsep.no -text $::tr(No) -indicatoron 0 \
    -variable glconfig(sep) -value 0
  pack $w.g.vsep.yes $w.g.vsep.no -side left -padx 1

  set row 0
  foreach t {width align color sep} {
    grid $w.g.$t -row $row -column 0 -sticky w
    grid $w.g.v$t -row $row -column 1 -sticky e
    incr row
  }

  addHorizontalRule $w
  pack [frame $w.b] -side top -fill x
  button $w.b.ok -text "OK" \
    -command "catch {grab release $w}; destroy $w; configGLfield $code"
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  wm resizable $w 0 0
  centreWin $w
  catch {grab $w}
}

proc configGLfield {code} {
  global glistFields glconfig
  set newcolumn [list $code $glconfig(width) $glconfig(align) \
                   $glconfig(color) $glconfig(sep)]
  set len [llength $glistFields]
  for {set i 0} {$i < $len} {incr i} {
    set column [lindex $glistFields $i]
    set tcode [lindex $column 0]
    if {$tcode == $code} {
      set glistFields [lreplace $glistFields $i $i $newcolumn]
      break
    }
  }
  destroy .glistWin
  makeGList
}

proc moveGLfield {code delta} {
  global glistFields
  set len [llength $glistFields]
  for {set i 0} {$i < $len} {incr i} {
    set column [lindex $glistFields $i]
    set tcode [lindex $column 0]
    if {$tcode == $code} {
      set glistFields [lreplace $glistFields $i $i]
      set insert [expr $i + $delta]
      set glistFields [linsert $glistFields $insert $column]
      break
    }
  }
  destroy .glistWin
  makeGList
}

proc insertGLfield {code newcode} {
  global glistFields glistAllFields
  set len [llength $glistFields]
  set newcolumn ""
  foreach column $glistAllFields {
    set tcode [lindex $column 0]
    if {$tcode == $newcode} { set newcolumn $column }
  }
  if {$newcolumn == ""} { return }

  for {set i 0} {$i < $len} {incr i} {
    set column [lindex $glistFields $i]
    set tcode [lindex $column 0]
    if {$tcode == $code} {
      incr i
      set glistFields [linsert $glistFields $i $newcolumn]
      break
    }
  }
  destroy .glistWin
  makeGList
}

proc deleteGLfield {code} {
  global glistFields
  set len [llength $glistFields]
  for {set i 0} {$i < $len} {incr i} {
    set column [lindex $glistFields $i]
    set tcode [lindex $column 0]
    if {$tcode != $code} { continue }
    set glistFields [lreplace $glistFields $i $i]
  }
  destroy .glistWin
  makeGList
}

proc popupGLmenu {code xcoord ycoord xscreen yscreen} {
  global glSelection glNumber
  setGLselection $code $xcoord $ycoord
  if {$glNumber < 1} {return}
  highlightGLline $glSelection
  if {[sc_base isReadOnly]} {
    .glistWin.popup entryconfig "*elete this*" -state disabled
    .glistWin.popup entryconfig "Delete all*" -state disabled
    .glistWin.popup entryconfig "Undelete all*" -state disabled
  } else {
    .glistWin.popup entryconfig "*elete this*" -state normal
    .glistWin.popup entryconfig "Delete all*" -state normal
    .glistWin.popup entryconfig "Undelete all*" -state normal
  }
  .glistWin.popup post $xscreen [expr $yscreen + 2]
  event generate .glistWin.popup <ButtonPress-1>
}

proc setGLstart { start } {
  global glstart
  set glstart $start
  updateGList
}

proc toggleGameFlag {flag} {
  global glNumber
  # If an invalid game number, just return:
  if {$glNumber < 1} { return }
  if {$glNumber > [sc_base numGames]} { return }
  catch {sc_game flag $flag $glNumber invert}
  updateGList
}

proc removeFromFilter {{dir none}} {
  global glNumber glstart
  if {$glNumber < 1} { return }
  if {$glNumber > [sc_base numGames]} { return }
  if {$dir == "none"} {
    sc_filter remove $glNumber
  } elseif {$dir == "up"} {
    sc_filter remove 1 $glNumber
    set glstart 1
  } else {
    sc_filter remove $glNumber 9999999
  }
  updateStatsWin
  updateGList
}

proc showMovesGList {xcoord ycoord} {
  global glistSelectPly glNumber glSelection
  # If an invalid game number, just return:
  if {$glNumber < 1} { return }
  if {$glNumber > [sc_base numGames]} { return }

  highlightGLline $glSelection
  .glistExtra.text delete 1.0 end
  .glistExtra.text insert end [sc_game firstMoves $glNumber $glistSelectPly]
  wm geometry .glistExtra +$xcoord+$ycoord
  wm deiconify .glistExtra
  raiseWin .glistExtra
}

proc updateGList {} {
  global glistSize glstart
  global glistFields
  updateStatusBar
  if ![winfo exists .glistWin] { return }
  set totalSize [sc_filter count]
  set linenum [sc_game list $glstart $glistSize -current]
  foreach column $glistFields {
    set code [lindex $column 0]
    set cformat $code
    append cformat "*\n"
    .glistWin.c$code.text config -state normal
    .glistWin.c$code.text delete 1.0 end
    .glistWin.c$code.text insert end \
      [sc_game list $glstart $glistSize $cformat] align
    if {$linenum > 0} {
      .glistWin.c$code.text tag add current $linenum.0 [expr $linenum+1].0
    }
    .glistWin.c$code.text config -state disabled
  }

  # Now update the window title:
  set str "Scid [tr WindowsGList]: "
  if {$totalSize > 0} {
    set right [expr $totalSize + 1 - $glistSize]
    if {$right < 1} { set right 1 }
    .glistWin.scale configure -to $right
    set glend [expr $glstart + $glistSize - 1]
    if {$glend > $totalSize} { set glend $totalSize}
    append str [thousands $glstart] " .. " \
      [thousands $glend] " / " [thousands $totalSize] " " $::tr(games)
  } else {
    append str $::tr(noGames)
    .glistWin.scale configure -to 1
  }
  wm title .glistWin $str
}

trace variable glexport w updateExportGList

proc openExportGList {} {
  global glexport
  set w .glexport

  if {[sc_filter count] < 1} {
    tk_messageBox -type ok -icon info -title "Scid" \
      -message "This are no games in the current filter."
    return
  }

  if {[winfo exists $w]} {
    raiseWin $w
    updateExportGList
    return
  }
  toplevel $w
  wm title $w "Scid: Save Game List"

  label $w.lfmt -text "Format:" -font font_Bold
  pack $w.lfmt -side top
  entry $w.fmt -textvar glexport -bg white -fg black -font font_Fixed
  pack $w.fmt -side top -fill x
  text $w.tfmt -width 1 -height 5 -font font_Fixed -fg black \
    -wrap none -relief flat
  pack $w.tfmt -side top -fill x
  $w.tfmt insert end "w: White            b: Black            "
  $w.tfmt insert end "W: White Elo        B: Black Elo        \n"
  $w.tfmt insert end "m: Moves count      r: Result           "
  $w.tfmt insert end "y: Year             d: Date             \n"
  $w.tfmt insert end "e: Event            s: Site             "
  $w.tfmt insert end "n: Round            o: ECO code         \n"
  $w.tfmt insert end "g: Game number      f: Filtered number  "
  $w.tfmt insert end "F: Final material   S: Non-std start pos\n"
  $w.tfmt insert end "D: Deleted flag     U: User flags       "
  $w.tfmt insert end "C: Comments flag    V: Variations flag  \n"
  $w.tfmt configure -cursor top_left_arrow -state disabled
  addHorizontalRule $w
  label $w.lpreview -text $::tr(Preview:) -font font_Bold
  pack $w.lpreview -side top
  text $w.preview -width 80 -height 5 -font font_Fixed -bg gray95 -fg black \
    -wrap none -setgrid 1 -xscrollcommand "$w.xbar set"
  scrollbar $w.xbar -orient horizontal -command "$w.preview xview"
  pack $w.preview -side top -fill x
  pack $w.xbar -side top -fill x
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.b.default -text "Default" -command {set glexport $glexportDefault}
  button $w.b.ok -text "OK" -command saveExportGList
  button $w.b.close -textvar ::tr(Cancel) -command "focus .; grab release $w; destroy $w"
  pack $w.b.close $w.b.ok -side right -padx 2 -pady 2
  pack $w.b.default -side left -padx 2 -pady 2
  wm resizable $w 1 0
  focus $w.fmt
  updateExportGList
  grab $w
}

proc updateExportGList {args} {
  global glexport
  set w .glexport
  if {! [winfo exists $w]} { return }
  set text [sc_game list 1 5 "$glexport\n"]
  $w.preview configure -state normal
  $w.preview delete 1.0 end
  $w.preview insert end $text
  $w.preview configure -state disabled
}

proc saveExportGList {} {
  global glexport
  set ftypes {{"Text files" {.txt}} {"All files" *}}
  set fname [tk_getSaveFile -filetypes $ftypes -parent .glexport \
               -title "Scid: Save Game List"]
  if {$fname == ""} { return }
  set showProgress 0
  if {[sc_filter count] >= 20000} { set showProgress 1 }
  if {$showProgress} {
    progressWindow "Scid" "Saving game list..." $::tr(Cancel) sc_progressBar
  }
  busyCursor .
  set res [catch {sc_game list 1 9999999 "$glexport\n" $fname} err]
  unbusyCursor .
  if {$showProgress} { closeProgressWindow }
  if {$res} {
    tk_messageBox -type ok -icon warning -title "Scid" -message $err
    return
  }
  focus .
  grab release .glexport
  destroy .glexport
  return
}


############################################################
### TREE window

namespace eval ::tree {}
set tree(training) 0
set tree(locked) 0
set tree(base) 0
set tree(status) ""

proc ::tree::configMenus {{lang ""}} {
  if {! [winfo exists .treeWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .treeWin.menu
  foreach menu {file sort opt help} tag {File Sort Opt Help} {
    configMenuName $m.$menu Tree$tag $lang
  }
  foreach idx {0 1 3 4 6 8} tag {Save Fill Best Graph Copy Close} {
    configMenuText $m.file.m $idx TreeFile$tag $lang
  }
  foreach idx {0 1 2 3} tag {Alpha ECO Freq Score} {
    configMenuText $m.sort.m $idx TreeSort$tag $lang
  }
  foreach idx {0 1 3} tag {Lock Training Autosave} {
    configMenuText $m.opt.m $idx TreeOpt$tag $lang
  }
  foreach idx {0 1} tag {Tree Index} {
    configMenuText $m.help.m $idx TreeHelp$tag $lang
  }
}

proc ::tree::copyToSelection {args} {
  set sel [join [.treeWin.f.tl get 0 end] "\n"]
  append sel "\n"
  return $sel
}

proc ::tree::make {} {
  global tree treeWin highcolor geometry helpMessage
  if {[winfo exists .treeWin]} {
    focus .
    destroy .treeWin
    set treeWin 0
    return
  }
  toplevel .treeWin
  set w .treeWin
  setWinLocation $w

  # Set the tree window title now:
  wm title $w "Scid: [tr WindowsTree]"
  set treeWin 1
  set tree(training) 0

  bind $w <Destroy> { set treeWin 0; set tree(locked) 0 }
  bind $w <F1> { helpWindow Tree }
  bind $w <Escape> { .treeWin.buttons.stop invoke }
  standardShortcuts $w

  frame $w.menu
  pack $w.menu -side top -fill x
  $w configure -menu $w.menu
  menubutton $w.menu.file -text TreeFile -menu $w.menu.file.m
  menubutton $w.menu.sort -text TreeSort -menu $w.menu.sort.m
  menubutton $w.menu.opt  -text TreeOpt  -menu $w.menu.opt.m
  menubutton $w.menu.help -text TreeHelp -menu $w.menu.help.m
  foreach i {file sort opt help} {
    menu $w.menu.$i.m -tearoff 0
    pack $w.menu.$i -side left
  }

  $w.menu.file.m add command -label TreeFileSave -command {
    busyCursor .
    update
    if {[catch {sc_tree write $tree(base)} result]} {
      tk_messageBox -type ok -icon warning -title "Scid: Error writing file" \
        -message $result
    }
    unbusyCursor .
  }
  set helpMessage($w.menu.file.m,0) TreeFileSave
  $w.menu.file.m add command -label TreeFileFill -command ::tree::prime
  set helpMessage($w.menu.file.m,1) TreeFileFill
  $w.menu.file.m add separator
  $w.menu.file.m add command -label TreeFileBest -command ::tree::best
  set helpMessage($w.menu.file.m,3) TreeFileBest
  $w.menu.file.m add command -label TreeFileGraph -command ::tree::graph
  set helpMessage($w.menu.file.m,4) TreeFileGraph
  $w.menu.file.m add separator
  $w.menu.file.m add command -label TreeFileCopy -command {
    clipboard clear
    clipboard append [::tree::copyToSelection]
    selection own .treeWin.f.tl
    selection get
  }
  set helpMessage($w.menu.file.m,6) TreeFileCopy
  $w.menu.file.m add separator
  $w.menu.file.m add command -label TreeFileClose \
    -command {.treeWin.buttons.close invoke}
  set helpMessage($w.menu.file.m,8) TreeFileClose

  foreach label {Alpha ECO Freq Score} value {alpha eco frequency score} {
    $w.menu.sort.m add radiobutton -label TreeSort$label \
      -variable tree(order) -value $value -command ::tree::refresh
  }

  $w.menu.opt.m add checkbutton -label TreeOptLock -variable tree(locked) \
    -command ::tree::toggleLock
  set helpMessage($w.menu.opt.m,0) TreeOptLock

  $w.menu.opt.m add checkbutton -label TreeOptTraining \
    -variable tree(training) -command ::tree::toggleTraining
  set helpMessage($w.menu.opt.m,1) TreeOptTraining

  $w.menu.opt.m add separator
  $w.menu.opt.m add checkbutton -label TreeOptAutosave \
    -variable tree(autoSave)
  set helpMessage($w.menu.opt.m,3) TreeOptAutosave

  $w.menu.help.m add command -label TreeHelpTree \
    -accelerator F1 -command {helpWindow Tree}
  $w.menu.help.m add command -label TreeHelpIndex -command {helpWindow Index}

  ::tree::configMenus

  frame $w.f
  listbox $w.f.tl -borderwidth 2 \
    -width $::winWidth($w) -height $::winHeight($w) \
    -font font_Fixed -foreground black -background white \
    -selectbackground $highcolor -selectmode browse -setgrid 1 \
    -yscroll "$w.f.ybar set" -xscroll "$w.f.xbar set"
  scrollbar $w.f.ybar -command ".treeWin.f.tl yview"
  scrollbar $w.f.xbar -orient horizontal -command ".treeWin.f.tl xview"
  canvas $w.progress -width 250 -height 15 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  selection handle $w.f.tl ::tree::copyToSelection

  bind $w.f.tl <Destroy> {
    if {$tree(autoSave)} {
      busyCursor .
      catch {sc_tree write $tree(base)}
      unbusyCursor .
    }
  }

  bind $w <Configure> "recordWinSize $w"

  label $w.status -width 1 -anchor w -font font_Small \
    -relief sunken -textvar tree(status)
  pack $w.status -side bottom -fill x
  pack $w.progress -side bottom
  pack [frame $w.buttons -relief sunken] -side bottom -fill x
  pack $w.f -side top -expand 1 -fill both
  grid $w.f.tl -row 0 -column 0 -sticky news
  grid $w.f.ybar -row 0 -column 1 -sticky news
  grid $w.f.xbar -row 1 -column 0 -sticky news
  grid rowconfig $w.f 0 -weight 1 -minsize 0
  grid columnconfig $w.f 0 -weight 1 -minsize 0

  button $w.buttons.best -image b_list -command ::tree::best
  button $w.buttons.graph -image b_bargraph -command ::tree::graph
  checkbutton $w.buttons.lock -textvar ::tr(LockTree) \
    -variable tree(locked) -relief raised -pady 5 -padx 5 \
    -command ::tree::toggleLock
  checkbutton $w.buttons.training -textvar ::tr(Training) \
    -variable tree(training) -relief raised -pady 5 -padx 5 \
    -command ::tree::toggleTraining

  foreach {b t} {
    best TreeFileBest graph TreeFileGraph lock TreeOptLock
    training TreeOptTraining
  } {
    set helpMessage($w.buttons.$b) $t
  }

  button $w.buttons.stop -textvar ::tr(Stop) -command { sc_progressBar }
  button $w.buttons.close -textvar ::tr(Close) -command {
    set geometry(treeWin) [wm geometry .treeWin]
    focus .; destroy .treeWin
  }

  pack $w.buttons.best $w.buttons.graph $w.buttons.lock $w.buttons.training \
    -side left -padx 2 -pady 2
  pack $w.buttons.close $w.buttons.stop -side right -padx 2 -pady 2
  $w.buttons.stop configure -state disabled

  wm minsize $w 40 5

  bind $w.f.tl <Return> {
    tree::select [lindex [ .treeWin.f.tl curselection] 0]
  }
  bind $w.f.tl <ButtonRelease-1> {
    .treeWin.f.tl selection clear 0 end
    tree::select [ .treeWin.f.tl nearest %y ]
    .treeWin.f.tl selection clear 0 end
    break
  }

  wm protocol $w WM_DELETE_WINDOW { .treeWin.buttons.close invoke }
  ::tree::refresh
}

proc ::tree::toggleTraining {} {
  global tree
  if {$tree(training)} {
    ::tree::doTraining
  } else {
    ::tree::refresh
  }
}

proc ::tree::doTraining {{n 0}} {
  global tree
  if {$n != 1  &&  [winfo exists .analysisWin1]  &&  $::analysis(automove1)} {
    automove 1
    return
  }
  if {$n != 2  &&  [winfo exists .analysisWin2]  &&  $::analysis(automove2)} {
    automove 2
    return
  }
  if {[::tb::isopen]  &&  $::tbTraining} {
    ::tb::move
    return
  }
  if {! [winfo exists .treeWin]} { return }
  if {$tree(training) == 0} { return }
  sc_tree click $tree(base) random
  updateBoardAndPgn .board
}

proc ::tree::toggleLock {} {
  global tree
  if {$tree(locked)} {
    set tree(base) [sc_base current]
  } else {
    set tree(base) 0
  }
  ::tree::refresh
}

proc ::tree::select { selection } {
  global tree
  if {! [winfo exists .treeWin]} { return }
  sc_tree click $tree(base) $selection
  .treeWin.f.tl selection clear 0 end
  updateBoardAndPgn .board
}

set tree(refresh) 0

proc ::tree::refresh {} {
  global tree treeWin glstart
  set w .treeWin

  if {![winfo exists $w]} { return }
  busyCursor .
  sc_progressBar $w.progress bar 251 16
  foreach button {best graph training lock close} {
    $w.buttons.$button configure -state disabled
  }
  $w.buttons.stop configure -state normal
  set tree(refresh) 1
  catch {grab $w.buttons.stop}

  update
  set base 0
  if {$tree(locked)} { set base $tree(base) }
  set moves [sc_tree search -hide $tree(training) -sort $tree(order) -base $base]
  catch {grab release $w.buttons.stop}
  set tree(refresh) 0
  foreach button {best graph training lock close} {
    $w.buttons.$button configure -state normal
  }
  $w.buttons.stop configure -state disabled -relief raised

  set moves [split $moves "\n"]
  set len [llength $moves]
  $w.f.tl delete 0 end
  for { set i 0 } { $i < $len } { incr i } {
    $w.f.tl insert end [lindex $moves $i]
  }
  catch {$w.f.tl itemconfigure 0 -foreground darkBlue}

  #set n [expr $len - 4]
  #if {$n > 0} {
  #  for {set i 1} {$i < $n} {incr i} {
  #    set f [string range [lindex $moves $i] 25 27]
  #    if {$f < 5} {
  #      catch {$w.f.tl itemconfigure $i -foreground gray50}
  #    }
  #  }
  #  while {$n < $len} {
  #    catch {$w.f.tl itemconfigure $n -foreground darkBlue}
  #    incr n
  #  }
  #}

  if {[winfo exists .treeBest]} { ::tree::best }

  unbusyCursor .
  $w.f.tl configure -cursor {}
  $w.f.tl selection clear 0 end

  ::tree::status
  set glstart 1
  updateStatsWin
  if {[winfo exists .treeGraph]} ::tree::graph
  updateGList
  updateTitle
}

proc ::tree::status {{msg ""}} {
  global tree
  if {$msg != ""} {
    set tree(status) $msg
    return
  }
  set s "  $::tr(Database)"
  set base [sc_base current]
  if {$tree(locked)} { set base $tree(base) }
  set status "  $::tr(Database) $base: [file tail [sc_base filename $base]]"
  if {$tree(locked)} { append status " ($::tr(TreeLocked))" }
  append status "   $::tr(Filter)"
  append status ": [filterText $base]"
  set tree(status) $status
}

set tree(standardLines) {
  {}
  {1.c4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6 2.d4 d5 3.Nc3}
  {1.e4 c6 2.d4 d5 3.Nd2}
  {1.e4 d5}
  {1.e4 d6}
  {1.e4 d6 2.d4}
  {1.e4 d6 2.d4 Nf6}
  {1.e4 d6 2.d4 Nf6 3.Nc3}
  {1.e4 e5}
  {1.e4 e5 2.Nf3}
  {1.e4 e5 2.Nf3 Nc6}
  {1.e4 e5 2.Nf3 Nc6 3.d4}
  {1.e4 e5 2.Nf3 Nc6 3.Bb5}
  {1.e4 e5 2.Nf3 Nc6 3.Bb5 a6}
  {1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4}
  {1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6}
  {1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O}
  {1.e4 e5 2.Nf3 Nc6 3.Bc4}
  {1.e4 e5 2.Nf3 Nf6}
  {1.e4 e6}
  {1.e4 e6 2.d4}
  {1.e4 e6 2.d4 d5}
  {1.e4 e6 2.d4 d5 3.Nc3}
  {1.e4 e6 2.d4 d5 3.Nc3 Bb4}
  {1.e4 e6 2.d4 d5 3.Nc3 Nf6}
  {1.e4 e6 2.d4 d5 3.Nd2}
  {1.e4 e6 2.d4 d5 3.Nd2 c5}
  {1.e4 e6 2.d4 d5 3.Nd2 Nf6}
  {1.e4 Nf6}
  {1.e4 Nf6 2.e5}
  {1.e4 Nf6 2.e5 Nd5}
  {1.Nf3}
  {1.Nf3 Nf6}
}

# ::tree::prime
#   Primes the tree for this database, filling it with a number of
#   common opening positions.
#
proc ::tree::prime {} {
  global tree
  if {! [winfo exists .treeWin]} { return }
  set base [sc_base current]
  if {$tree(locked)} { set base $tree(base) }
  if {! [sc_base inUse]} { return }
  set fname [sc_base filename $base]
  if {[string index $fname 0] == "\["  ||  [file extension $fname] == ".pgn"} {
    tk_messageBox -parent .treeWin -icon info -type ok -title "Scid" \
      -message "Sorry, only Scid-format database files can have a tree cache file."
    return
  }

  set ::interrupt 0
  progressWindow "Scid: [tr TreeFileFill]" "" $::tr(Cancel) {set ::interrupt 1}
  resetProgressWindow
  leftJustifyProgressWindow
  busyCursor .
  sc_game push
  set i 1
  set len [llength $tree(standardLines)]
  foreach line $tree(standardLines) {
    sc_game new
    set text [format "%3d/\%3d" $i $len]
    if {[llength $line] > 0}  {
      sc_move addSan $line
      changeProgressWindow "$text: $line"
    } else {
      changeProgressWindow "$text: start position"
    }
    sc_tree search -base $base
    updateProgressWindow $i $len
    incr i
    if {$::interrupt} {
      closeProgressWindow
      set ::interrupt 0
      sc_game pop
      unbusyCursor .
      ::tree::refresh
      return
    }
  }
  closeProgressWindow
  if {[catch {sc_tree write $base} result]} {
    #tk_messageBox -type ok -icon warning -title "Scid: Error writing file" \
        -message $result
  } else {
    #set a "$fname.stc: [sc_tree positions] positions, "
    #append a "$result bytes: "
    #set pergame [expr double($result) / double([sc_base numGames])]
    #append a [format "%.2f" $pergame]
    #append a " bytes per game"
    #tk_messageBox -type ok -parent .treeWin -title "Scid" -message $a
  }
  sc_game pop
  unbusyCursor .
  ::tree::refresh
}

set tree(bestMax) 50
trace variable tree(bestMax) w ::tree::best
set tree(bestRes) "1-0 0-1 1/2 *"
trace variable tree(bestRes) w ::tree::best

# ::tree::best
#   Updates the window of best (highest-rated) tree games.
#
proc ::tree::best {args} {
  global tree
  set w .treeBest
  if {! [winfo exists .treeWin]} { return }
  if {! [winfo exists $w]} {
    toplevel $w
    wm title $w "Scid: $::tr(TreeBestGames)"
    bind $w <Configure> "recordWinSize $w"
    setWinLocation $w
    bind $w <Escape> "destroy $w"
    bind $w <F1> {helpWindow Tree Best}
    pack [frame $w.b] -side bottom -fill x
    pack [frame $w.opt] -side bottom -fill x
    set pane [::pane::create $w.pane blist bpgn 520 320 0.6]
    ::pane::range $w.pane 0.3 0.8
    pack $pane -side top -expand true -fill both
    scrollbar $pane.blist.ybar -command "$pane.blist.list yview" -takefocus 0
    listbox $pane.blist.list -background white -selectbackground $::highcolor \
      -yscrollcommand "$pane.blist.ybar set" -font font_Small
    pack $pane.blist.ybar -side right -fill y
    pack $pane.blist.list -side left -fill both -expand yes
    bind $pane.blist.list <<ListboxSelect>> ::tree::bestPgn
    bind $pane.blist.list <Double-Button-1> ::tree::bestBrowse

    scrollbar $pane.bpgn.ybar -command "$pane.bpgn.text yview" -takefocus 0
    text $pane.bpgn.text -width 50 -height 20 -wrap none -background gray90 \
      -cursor top_left_arrow -yscrollcommand "$pane.bpgn.ybar set" -wrap word \
      -state disabled -font font_Small
    pack $pane.bpgn.ybar -side right -fill y
    pack $pane.bpgn.text -side left -fill both -expand yes
    set t $pane.bpgn.text
    bind $t <ButtonPress-1> "showPgnBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-1> hidePgnBoard
    bind $t <ButtonPress-2> "showPgnBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-2> hidePgnBoard
    bind $t <ButtonPress-3> "showPgnBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-3> hidePgnBoard

    label $w.opt.lmax -text $::tr(TreeBest:) -font font_Small
    set m [tk_optionMenu $w.opt.max tree(bestMax) 10 20 50 100 200 500]
    $m configure -font font_Small
    $w.opt.max configure -font font_Small
    label $w.opt.lres -text " $::tr(Result):" -font font_Small
    set m [tk_optionMenu $w.opt.res tree(bestRes) \
             "1-0 0-1 1/2 *" 1-0 0-1 "1-0 0-1" 1/2-1/2]
    $m configure -font font_Small
    $w.opt.res configure -font font_Small

    button $w.b.browse -text $::tr(BrowseGame) -command ::tree::bestBrowse
    button $w.b.load -text $::tr(LoadGame) -command ::tree::bestLoad
    button $w.b.merge -text $::tr(MergeGame) -command ::tree::bestMerge
    button $w.b.close -text $::tr(Close) -command "destroy $w"
    foreach i {browse load merge close} { $w.b.$i configure -font font_Small }
    pack $w.b.close $w.b.merge $w.b.load $w.b.browse \
      -side right -padx 1 -pady 2
    pack $w.opt.lmax $w.opt.max -side left -padx 0 -pady 2
    pack $w.opt.lres $w.opt.res -side left -padx 0 -pady 2
    focus $w.pane.blist.list
  }
  $w.pane.blist.list delete 0 end
  set tree(bestList) {}
  set count 0
  if {! [sc_base inUse]} { return }
  foreach {idx line} [sc_tree best $tree(base) $tree(bestMax) $tree(bestRes)] {
    incr count
    $w.pane.blist.list insert end "[format %02d $count]:  $line"
    lappend tree(bestList) $idx
  }
  catch {$w.pane.blist.list selection set 0}
  ::tree::bestPgn
}

proc ::tree::bestLoad {} {
  global tree
  if {[catch {set sel [.treeBest.pane.blist.list curselection]}]} { return }
  if {[catch {set g [lindex $tree(bestList) $sel]}]} { return }
  if {$tree(locked)} { sc_base switch $tree(base) }
  gameLoad $g
}

proc ::tree::bestMerge {} {
  global tree
  if {[catch {set sel [.treeBest.pane.blist.list curselection]}]} { return }
  if {[catch {set gnum [lindex $tree(bestList) $sel]}]} { return }
  set base [sc_base current]
  if {$tree(locked)} { set base $tree(base) }
  mergeGame $base $gnum
}

proc ::tree::bestBrowse {} {
  global tree
  if {[catch {set sel [.treeBest.pane.blist.list curselection]}]} { return }
  if {[catch {set gnum [lindex $tree(bestList) $sel]}]} { return }
  set base [sc_base current]
  if {$tree(locked)} { set base $tree(base) }
  ::gbrowser::new $base $gnum
}

proc ::tree::bestPgn {} {
  global tree
  set t .treeBest.pane.bpgn.text
  $t configure -state normal
  $t delete 1.0 end
  if {[catch {set sel [.treeBest.pane.blist.list curselection]}]} { return }
  if {[catch {set g [lindex $tree(bestList) $sel]}]} { return }
  set base [sc_base current]
  if {$tree(locked)} { set base $tree(base) }
  if {[catch {sc_game summary -base $base -game $g header} header]} { return }
  if {[catch {sc_game summary -base $base -game $g moves} moves]} { return }
  if {[catch {sc_filter value $base $g} ply]} { return }
  $t tag configure header -foreground darkBlue
  $t tag configure start -foreground darkRed
  $t insert end $header header
  $t insert end "\n\n"
  set m 0
  foreach move $moves {
    incr m
    if {$m < $ply} {
      $t insert end $move start
    } else {
      $t insert end $move
    }
    $t insert end " "
  }
  #catch {$t insert end [sc_game pgn -base $base -game $g \
  #                        -short 1 -indentC 1 -indentV 1 -symbol 1 -tags 0]}
  $t configure -state disabled
}

# ::tree::graph
#   Updates the tree graph window, creating it if necessary.
#
proc ::tree::graph {} {
  set w .treeGraph
  if {! [winfo exists .treeWin]} { return }
  if {! [winfo exists $w]} {
    toplevel $w
    setWinLocation $w
    bind $w <Escape> "destroy $w"
    bind $w <F1> {helpWindow Tree Graph}
    frame $w.menu -relief raised -borderwidth 2
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text GraphFile -menu $w.menu.file.m
    menu $w.menu.file.m
    $w.menu.file.m add command -label GraphFileColor \
      -command "saveGraph color $w.c"
    $w.menu.file.m add command -label GraphFileGrey \
      -command "saveGraph gray $w.c"
    $w.menu.file.m add separator
    $w.menu.file.m add command -label GraphFileClose -command "destroy $w"
    pack $w.menu.file -side left

    canvas $w.c -width 500 -height 300
    pack $w.c -side top -fill both -expand yes
    $w.c create text 25 10 -tag text -justify center -width 1 \
      -font font_Regular -anchor n
    bind $w <Configure> {
      .treeGraph.c itemconfigure text -width [expr [winfo width .treeGraph.c] - 50]
      .treeGraph.c coords text [expr [winfo width .treeGraph.c] / 2] 10
      ::graph::configure tree -height [expr [winfo height .treeGraph.c] - 100]
      ::graph::configure tree -width [expr [winfo width .treeGraph.c] - 50]
      ::graph::redraw tree
    }
    bind $w.c <Button-1> ::tree::graph
    wm title $w "Scid: Tree Graph"
    # wm minsize $w 300 200
    standardShortcuts $w
    ::tree::configGraphMenus
  }

  $w.c itemconfigure text -width [expr [winfo width $w.c] - 50]
  $w.c coords text [expr [winfo width $w.c] / 2] 10
  set height [expr [winfo height $w.c] - 100]
  set width [expr [winfo width $w.c] - 50]
  ::graph::create tree -width $width -height $height -xtop 25 -ytop 60 \
    -xmin 0.5 -xtick 1 -ytick 5 -font font_Small -canvas $w.c

  set data {}
  set xlabels {}
  set othersCount 0
  set numOthers 0
  set othersName "..."
  set count 0
  set othersScore 0.0
  set mean 50.0
  set totalGames 0
  set treeData [.treeWin.f.tl get 0 end]

  for {set i 0} {$i < [llength $treeData]} {incr i} {
    # Extract info from each line of the tree window:
    # Note we convert "," decimal char back to "." where necessary.
    set line [lindex $treeData $i]
    set mNum [string trim [string range $line  0  1]]
    set freq [string trim [string range $line 17 23]]
    set fpct [string trim [string range $line 25 29]]
    regsub -all {,} $fpct . fpct
    set move [string trim [string range $line  4 9]]
    set score [string trim [string range $line 33 37]]
    regsub -all {,} $score . score
    if {$score > 99.9} { set score 99.9 }
    # Check if this line is "TOTAL:" line:
    if {![string compare "TO" $mNum]} {
      set mean $score
      set totalGames $freq
    }
    # Add info for this move to the graph if necessary:
    if {[string index $line 2] == ":"  &&  [string compare "<end>" $move]} {
      if {$fpct < 1.0  ||  $freq < 5  ||  $i > 5} {
        incr othersCount $freq
        incr numOthers
        set othersScore [expr $othersScore + (double($freq) * $score)]
        set m $move
        if {$numOthers > 1} { set m "..." }
      } else {
        incr count
        lappend data $count
        lappend data $score
        lappend xlabels [list $count "$move ([expr round($score)]%)\n$freq: [expr round($fpct)]%"]
      }
    }
  }

  # Add extra bar for other moves if necessary:
  if {$numOthers > 0} {
    incr count
    set fpct [expr double($othersCount) * 100.0 / double($totalGames)]
    set sc [expr round($othersScore / double($othersCount))]
    set othersName "$m ($sc%)\n$othersCount: [expr round($fpct)]%"
    lappend data $count
    lappend data [expr $othersScore / double($othersCount)]
    lappend xlabels [list $count $othersName]
  }

  # Plot fake bounds data so graph at least shows range 40-65:
  ::graph::data tree bounds -points 0 -lines 0 -bars 0 -coords {1 41 1 64}

  # Replot the graph:
  ::graph::data tree data -color red -points 0 -lines 0 -bars 1 \
    -barwidth 0.75 -outline black -coords $data
  ::graph::configure tree -xlabels $xlabels -xmax [expr $count + 0.5] \
    -hline [list {gray80 1 each 5} {gray50 1 each 10} {black 2 at 50} \
              {black 1 at 55} [list red 2 at $mean]] \
    -brect [list [list 0.5 55 [expr $count + 0.5] 50 LightSkyBlue1]]

  ::graph::redraw tree
  set moves ""
  catch {set moves [sc_game firstMoves 0 -1]}
  if {[string length $moves] == 0} { set moves $::tr(StartPos) }
  set title "$moves ([thousands $totalGames] $::tr(games))"
  $w.c itemconfigure text -text $title
}

proc ::tree::configGraphMenus {{lang ""}} {
  if {! [winfo exists .treeGraph]} { return }
  if {$lang == ""} { set lang $::language }
  set m .treeGraph.menu
  foreach menu {file} tag {File} {
    configMenuName $m.$menu Graph$tag $lang
  }
  foreach idx {0 1 3} tag {Color Grey Close} {
    configMenuText $m.file.m $idx GraphFile$tag $lang
  }
}

# saveGraph:
#   Saves a graph (e.g. tree graph or rating graph) to a
#   color or greyscale Postscript file. The mode should be
#   "color" or "gray"
#
proc saveGraph {mode w} {
  if {! [winfo exists $w]} { return }
  set ftypes {{"PostScript files" {.eps .ps}} {"All files" *}}
  set fname [tk_getSaveFile -filetypes $ftypes -parent $w \
               -defaultextension ".eps" -title "Scid: Save Graph"]
  if {$fname == ""} { return }
  if {[catch {$w postscript -file $fname -colormode $mode} result]} {
    tk_messageBox -icon info -parent $w -title "Scid" -message $result
  }
}

###############################################
### Filter Statistics window

proc makeStatsWin {} {
  global statsWin stats
  set w .statsWin
  if [winfo exists $w] {
    focus .
    destroy $w
    set statsWin 0
    return
  }
  toplevel $w
  wm title $w "Scid: Filter Statistics"
  setWinLocation $w
  bind $w <Configure> "recordWinSize $w"

  frame $w.menu -borderwidth 3 -relief raised
  pack $w.menu -side top -fill x
  $w configure -menu $w.menu
  menubutton $w.menu.file -text StatsFile -menu $w.menu.file.m
  menubutton $w.menu.opt -text StatsOpt -menu $w.menu.opt.m
  menu $w.menu.file.m
  $w.menu.file.m add command -label StatsFilePrint -command {
    set ftype {
      { "Text files" {".txt"} }
      { "All files"  {"*"}    }
    }
    set fname [tk_getSaveFile -initialdir [pwd] -filetypes $ftype -title "Save text file"]
    if {$fname != ""} {
      if {[catch {set tempfile [open $fname w]}]} {
        tk_messageBox -title "Scid: Error saving file" -type ok -icon warning \
          -message "Unable to save the file: $fname\n\n"
      } else {
        puts $tempfile [.statsWin.stats get 1.0 end-1c]
        close $tempfile
      }
    }
  }
  $w.menu.file.m add separator
  $w.menu.file.m add command -label StatsFileClose -accelerator Esc \
      -command "destroy $w"

  menu $w.menu.opt.m
  $w.menu.opt.m add cascade -label $::tr(OprepStatBoth) -menu $w.menu.opt.m.elo
  menu $w.menu.opt.m.elo
  foreach i [lsort -decreasing [array names stats r*]] {
    set elo [string range $i 1 end]
    $w.menu.opt.m.elo add checkbutton -label "$::tr(OprepStatBoth) $elo+" \
      -variable stats($i) -command updateStatsWin
  }
  $w.menu.opt.m add separator
  $w.menu.opt.m add cascade -label $::tr(OprepStatSince) \
    -menu $w.menu.opt.m.year
  menu $w.menu.opt.m.year
  foreach i [lsort [array names stats y*]] {
    set year [string range $i 1 end]
    $w.menu.opt.m.year add checkbutton \
      -label "$::tr(OprepStatSince) $year.01.01" \
      -variable stats($i) -command updateStatsWin
  }

  pack $w.menu -side top -fill x
  pack $w.menu.file $w.menu.opt -side left

  text $w.stats -borderwidth 0 \
    -width $::winWidth($w) -height $::winHeight($w) -font font_Fixed \
    -foreground black -background white -cursor top_left_arrow -wrap none \
    -setgrid 1
  pack $w.stats -side top -fill both -expand yes
  set statsWin 1
  bind $w <Control-q> "destroy $w"
  bind $w <Escape> "destroy $w"
  bind $w <F1> { helpWindow Index }
  bind $w <Destroy> {
    set statsWin 0
  }
  standardShortcuts $w
  wm resizable $w 1 0
  configStatsMenus
  updateStatsWin
}

proc updateStatsWin {} {
  global statsWin stats
  if {[winfo exists .playerInfoWin]} { playerInfo }
  updateGList
  updateMaintWin
  updateStatusBar
  updateFilterGraph
  if {! [winfo exists .statsWin]} { return }

  # Set up variables for translated phrases:
  set all [capital $::tr(allGames)]
  set both $::tr(OprepStatBoth)
  set since $::tr(OprepStatSince)
  set games [capital $::tr(games)]
  set score [capital $::tr(score)]

  # Find length of longest left-hand column:
  set alen [expr [string length $all] + 1]
  set blen [expr [string length $both] + 7]
  set slen [expr [string length $since] + 12]
  set len $alen
  if {$len < $blen} { set len $blen }
  if {$len < $slen} { set len $slen }

  set height 4
  set ratings 0
  set years 0
  set rlist [lsort -decreasing [array names stats r*]]
  set ylist [lsort [array names stats y*]]

  foreach i $rlist {
    if {$stats($i)} { set ratings 1 }
  }
  foreach i $ylist {
    if {$stats($i)} { set years 1 }
  }

  if {$ratings} { incr height }
  if {$years} { incr height }

  set s ""
  set stat ""
  append s " [pad $stat [expr $len - 4]] [padR $games 10]"
  append s "     1-0     =-=     0-1 [padR $score 8]\n"
  append s "------------------------------------------------------------------------"
  append s "\n [pad $all $len]" [sc_filter stats all]

  if {$ratings} {
    append s "\n"
    foreach i $rlist {
      if {$stats($i)} {
        incr height
        set elo [string range $i 1 end]
        set stat "$both $elo+"
        append s "\n [pad $stat $len]"   [sc_filter stats elo $elo]
      }
    }
  }

  if {$years} {
    append s "\n"
    foreach i $ylist {
      if {$stats($i)} {
        incr height
        set year [string range $i 1 end]
        set stat "$since $year.01.01"
        append s "\n [pad $stat $len]"   [sc_filter stats year $year]
      }
    }
  }

  set w .statsWin.stats
  $w configure -state normal
  $w delete 1.0 end
  $w insert end $s
  $w tag configure blue -foreground darkBlue
  $w tag configure red -foreground red
  $w tag add blue 1.0 2.0
  $w tag add red 2.0 3.0
  $w configure -height $height
  $w configure -state disabled
}

proc configStatsMenus {{lang ""}} {
  if {! [winfo exists .statsWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .statsWin.menu
  foreach menu {file opt} tag {File Opt} {
    configMenuName $m.$menu Stats$tag $lang
  }
  foreach idx {0 2} tag {Print Close} {
    configMenuText $m.file.m $idx StatsFile$tag $lang
  }
}

#####################
# Filter graph window

# fgraphType: can be "decade", "year" or "elo"
set fgraphType decade

proc makeFilterGraph {} {
  global filterGraph
  set w .fgraph
  if {[winfo exists $w]} {
    focus .
    destroy $w
    set filterGraph 0
    return
  }
  toplevel $w
  wm title $w "Scid: Filter Graph"
  set filterGraph 1
  bind $w <Destroy> {set filterGraph 0}

  frame $w.b
  pack $w.b -side bottom -fill x
  label $w.b.status -width 1 -font font_Small -anchor w
  frame $w.sep -height 2 -borderwidth 2 -relief sunken -background white
  pack $w.sep -side bottom -fill x -pady 4

  canvas $w.c -width 500 -height 300
  $w.c create text 25 5 -tag title -justify center -width 1 \
    -font font_Small -anchor n
  $w.c create text 250 295 -tag type -justify center -width 1 \
    -font font_Small -anchor s
  pack $w.c -side top -expand yes -fill both
  ::graph::create filter

  bind $w <F1> {helpWindow Graphs Filter}
  bind $w <Configure> {
    .fgraph.c itemconfigure title -width [expr [winfo width .fgraph.c] - 50]
    .fgraph.c coords title [expr [winfo width .fgraph.c] / 2] 10
    .fgraph.c itemconfigure type -width [expr [winfo width .fgraph.c] - 50]
    .fgraph.c coords type [expr [winfo width .fgraph.c] / 2] \
      [expr [winfo height .fgraph.c] - 10]
    ::graph::configure filter -height [expr [winfo height .fgraph.c] - 80]
    ::graph::configure filter -width [expr [winfo width .fgraph.c] - 60]
    ::graph::redraw filter
  }
  bind $w.c <1> switchFilterGraph
  bind $w.c <3> updateFilterGraph

  foreach {name text} {decade Decade year Year elo Rating} {
    radiobutton $w.b.$name -variable fgraphType -value $name -padx 4 -pady 3 \
      -text $::tr($text) -indicatoron 0 -command updateFilterGraph
    pack $w.b.$name -side left -padx 1 -pady 2
  }
  button $w.b.close -text $::tr(Close) -command "destroy $w"
  pack $w.b.decade $w.b.elo -side left -padx 1 -pady 2
  pack $w.b.close -side right -padx 2 -pady 2
  pack $w.b.status -side left -padx 2 -pady 2 -fill x -expand yes

  updateFilterGraph
}

proc switchFilterGraph {} {
  global fgraphType
  switch $fgraphType {
    "decade" { set fgraphType "year" }
    "year" { set fgraphType "elo" }
    "elo" { set fgraphType "decade" }
  }
  updateFilterGraph
}

proc updateFilterGraph {} {
  global fgraphType
  set w .fgraph
  if {! [winfo exists $w]} { return }

  $w.c itemconfigure title -width [expr [winfo width $w.c] - 50]
  $w.c coords title [expr [winfo width $w.c] / 2] 10
  $w.c itemconfigure type -width [expr [winfo width $w.c] - 50]
  $w.c coords type [expr [winfo width $w.c] / 2] \
    [expr [winfo height $w.c] - 10]
  set height [expr [winfo height $w.c] - 80]
  set width [expr [winfo width $w.c] - 60]
  set vlines {}
  if {$fgraphType == "elo"} {
    # Vertical lines for Elo-range graph:
    for {set i 1} {$i < 9} { incr i } {
      lappend vlines [list gray80 1 at $i.5]
    }
  } elseif {$fgraphType == "year"} {
    # Vertical lines for Year-range graph:
    for {set i 1} {$i < 11} { incr i } {
      lappend vlines [list gray80 1 at $i.5]
    }
  } else {
    # Vertical lines for Decade graph: most are gray, but those
    # just before 1950s and 2000s are blue to make them stand out.
    for {set i 1} {$i < 10} {incr i} {
      set vlineColor gray80
      if {$i == 4  ||  $i == 9} { set vlineColor steelBlue }
      lappend vlines [list $vlineColor 1 at $i.5]
    }
  }
  ::graph::create filter -width $width -height $height -xtop 40 -ytop 35 \
    -ytick 1 -xtick 1 -font font_Small -canvas $w.c -textcolor black \
    -vline $vlines -background lightYellow -tickcolor black -xmin 0 -xmax 1
  ::graph::redraw filter
  busyCursor .
  update

  set count 0
  set dlist {}
  set xlabels {}
  set max 0.0

  # Generate plot values and labels:
  if {$fgraphType == "decade"} {
    set ftype date
    set typeName $::tr(Decade)
    set rlist [list 0000 1919 -1919  1920 1929 20-29 \
                 1930 1939 30-39  1940 1949 40-49  1950 1959 50-59 \
                 1960 1969 60-69  1970 1979 70-79  1980 1989 80-89 \
                 1990 1999 90-99  2000 2009 2000+]
  } elseif {$fgraphType == "year"} {
    set ftype date
    set typeName $::tr(Year)
    set endYear [::date::today year]
    set startYear [expr $endYear - 10]
    set rlist {}
    for {set i $startYear} {$i <= $endYear} {incr i} {
      lappend rlist $i
      lappend rlist $i
      lappend rlist $i
    }
  } else {
    set ftype elo
    set typeName $::tr(Rating)
    set rlist [list 0 1999 0-1999  2000 2099 20xx  2100 2199 21xx  \
                 2200 2299 22xx  2300 2399 23xx  2400 2499 24xx  \
                 2500 2599 25xx  2600 2699 26xx  2700 3999 2700+]
  }

  foreach {start end label} $rlist {
    if {$ftype == "date"} { append end ".12.31" }
    set r [sc_filter freq $ftype $start $end]
    set filter [lindex $r 0]
    set all [lindex $r 1]
    if {$all == 0} {
      set freq 0.0
    } else {
      set freq [expr double($filter) * 1000.0 / double($all)]
    }
    if {$freq >= 1000.0} { set freq 999.99 }
    incr count
    lappend dlist $count
    lappend dlist $freq
    if {$freq > $max} { set max $freq }
    lappend xlabels [list $count $label]
  }

  # Find a suitable spacing of y-axis labels:
  set ytick 0.1
  if {$max > 1.0} { set ytick 0.2 }
  if {$max > 2.5} { set ytick 0.5 }
  if {$max >   5} { set ytick   1 }
  if {$max >  10} { set ytick   2 }
  if {$max >  25} { set ytick   5 }
  if {$max >  50} { set ytick  10 }
  if {$max > 100} { set ytick  20 }
  if {$max > 250} { set ytick  50 }
  if {$max > 500} { set ytick 100 }
  set hlines [list [list gray80 1 each $ytick]]
  # Add mean horizontal line:
  set filter [sc_filter count]
  set all [sc_base numGames]
  if {$all > 0} {
    set mean [expr double($filter) * 1000.0 / double($all)]
    if {$mean >= 1000.0} { set mean 999.9 }
    lappend hlines [list red 1 at $mean]
  }

  # Create fake dataset with bounds so we see 0.0::
  #::graph::data decade bounds -points 0 -lines 0 -bars 0 -coords {1 0.0 1 0.0}

  ::graph::data filter data -color darkBlue -points 1 -lines 1 -bars 0 \
    -linewidth 2 -radius 4 -outline darkBlue -coords $dlist
  ::graph::configure filter -xlabels $xlabels -ytick $ytick \
    -hline $hlines -ymin 0 -xmin 0.5 -xmax [expr $count + 0.5]
  ::graph::redraw filter
  $w.c itemconfigure title -text $::tr(GraphFilterTitle)
  $w.c itemconfigure type -text $typeName
  $w.b.status configure -text "  $::tr(Filter): [filterText]"
  unbusyCursor .
  update
}



############################################################
### PGN window

proc choosePgnColor {type name} {
  global pgnColor
  set x [tk_chooseColor -initialcolor $pgnColor($type) \
           -title "PGN $name color"]
  if {$x != ""} { set pgnColor($type) $x; resetPgnColors }
}

proc configPgnMenus {{lang ""}} {
  if {! [winfo exists .pgnWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .pgnWin.menu
  foreach menu {file opt color help} tag {File Opt Color Help} {
    configMenuName $m.$menu Pgn$tag $lang
  }
  foreach idx {0 2} tag {Print Close} {
    configMenuText $m.file.m $idx PgnFile$tag $lang
  }
  foreach idx {0 1 2 3 4 5 6 7} tag {Color Short Symbols IndentC IndentV Space Column StripMarks} {
    configMenuText $m.opt.m $idx PgnOpt$tag $lang
  }
  foreach idx {0 1 2 3 4} tag {Header Anno Comments Vars Background} {
    configMenuText $m.color.m $idx PgnColor$tag $lang
  }
  foreach idx {0 1} tag {Pgn Index} {
    configMenuText $m.help.m $idx PgnHelp$tag $lang
  }
}

proc makePgnWin {} {
  global pgnWin pgnHeight pgnWidth pgnColor pgnColumn pgnStripMarks
  if [winfo exists .pgnWin] {
    focus .
    destroy .pgnWin
    set pgnWin 0
    return
  }
  set w [toplevel .pgnWin]
  setWinLocation $w
  bind $w <Configure> "recordWinSize $w"

  frame $w.menu -borderwidth 3 -relief raised
  pack $w.menu -side top -fill x
  $w configure -menu $w.menu
  menubutton $w.menu.file -text PgnFile -menu $w.menu.file.m -underline 0
  menubutton $w.menu.opt -text PgnOpt -menu $w.menu.opt.m -underline 0
  menubutton $w.menu.color -text PgnColor -menu $w.menu.color.m -underline 0
  menubutton $w.menu.help -text PgnHelp -menu $w.menu.help.m -underline 0
  foreach i {file opt color help} {
    menu $w.menu.$i.m -tearoff 0
    pack $w.menu.$i -side left
  }

  $w.menu.file.m add command -label PgnFilePrint -command {
    set ftype {
      { "PGN files"  {".pgn"} }
      { "Text files" {".txt"} }
      { "All files"  {"*"}    }
    }
    set fname [tk_getSaveFile -initialdir [pwd] -filetypes $ftype -title "Save PGN file"]
    if {$fname != ""} {
      if {[catch {set tempfile [open $fname w]}]} {
        tk_messageBox -title "Scid: Error saving file" -type ok -icon warning \
          -message "Unable to save the file: $fname\n\n"
      } else {
        puts $tempfile \
          [sc_game pgn -width 75 -symbols $pgnSymbolicNags \
             -indentVar $pgnIndentVars -indentCom $pgnIndentComments \
             -space $pgnMoveNumSpace -format plain -column $::pgnColumn \
             -markCodes $::pgnStripMarks]
        close $tempfile
      }
    }
  }
  $w.menu.file.m add separator
  $w.menu.file.m add command -label PgnFileClose -accelerator Esc \
      -command "focus .; destroy $w"

  $w.menu.opt.m add checkbutton -label PgnOptColor \
    -variable doColorPgn -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptShort \
    -variable pgnShortHeader -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptSymbols \
    -variable pgnSymbolicNags -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptIndentC \
    -variable pgnIndentComments -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptIndentV \
    -variable pgnIndentVars -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptSpace \
    -variable pgnMoveNumSpace -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptColumn \
    -variable pgnColumn -command {updateBoardAndPgn .board}
  $w.menu.opt.m add checkbutton -label PgnOptStripMarks \
    -variable pgnStripMarks -command {updateBoardAndPgn .board}

  $w.menu.color.m add command -label PgnColorHeader \
    -command {choosePgnColor Header "header text"}
  $w.menu.color.m add command -label PgnColorAnno \
    -command {choosePgnColor Nag annotation}
  $w.menu.color.m add command -label PgnColorComments \
    -command {choosePgnColor Comment comment}
  $w.menu.color.m add command -label PgnColorVars \
    -command {choosePgnColor Var variation}
  $w.menu.color.m add command -label PgnColorBackground \
    -command {choosePgnColor Background background}

  $w.menu.help.m add command -label PgnHelpPgn \
    -accelerator F1 -command {helpWindow PGN}
  $w.menu.help.m add command -label PgnHelpIndex -command {helpWindow Index}

  configPgnMenus

  text $w.text -width $::winWidth($w) -height $::winHeight($w) -wrap word \
    -background $pgnColor(Background) -cursor crosshair \
    -yscrollcommand "$w.scroll set" -setgrid 1 -tabs {1c right 2c 4c}
  scrollbar $w.scroll -command "$w.text yview" -takefocus 0
  pack [frame $w.buttons] -side bottom -fill x
  pack $w.scroll -side right -fill y
  pack $w.text -fill both -expand yes
  button $w.buttons.help -textvar ::tr(Help) -command { helpWindow PGN }
  button $w.buttons.close -textvar ::tr(Close) -command { focus .; destroy .pgnWin }
  #pack $w.buttons.close $w.buttons.help -side right -padx 5 -pady 2
  set pgnWin 1
  bind $w <Destroy> { set pgnWin 0 }

  # Bind middle or right button to popup a PGN board:
  bind $w <ButtonPress-2> "showPgnBoard .pgnWin.text 5 %x %y %X %Y"
  bind $w <ButtonRelease-2> hidePgnBoard
  bind $w <ButtonPress-3> "showPgnBoard .pgnWin.text 5 %x %y %X %Y"
  bind $w <ButtonRelease-3> hidePgnBoard

  # set the same arrow key, etc bindings that the main window has:
  bind $w <F1> { helpWindow PGN }
  bind $w <Home>  {sc_move start; updateBoard .board}
  bind $w <Up>    {sc_move back 10; updateBoard .board}
  bind $w <Left>  {sc_move back; updateBoard .board}
  bind $w <Down>  {sc_move forward 10; updateBoard .board}
  bind $w <Right> {sc_move forward; updateBoard .board}
  bind $w <End>   {sc_move end; updateBoard .board}
  bind $w <Escape> {focus .; destroy .pgnWin}
  standardShortcuts $w

  # Add variation navigation bindings:
  bind $w <KeyPress-v> [bind . <KeyPress-v>]
  bind $w <KeyPress-z> [bind . <KeyPress-z>]

  $w.text tag add Current 0.0 0.0
  resetPgnColors
}

# showPgnBoard:
#    Produces a popup window showing the board position in the
#    game at the current mouse location in the PGN window.
#
proc showPgnBoard {win startLine x y xc yc} {
  global lite dark
  set bd [sc_pos pgnBoard [$win get $startLine.0 @$x,$y]]
  set w .pgnPopup
  set psize 30
  if {$psize > $::boardSize} { set psize $::boardSize }

  if {! [winfo exists $w]} {
    toplevel $w -relief solid -borderwidth 2
    wm withdraw $w
    wm overrideredirect $w 1
    ::board::new $w.bd $psize
    pack $w.bd -side top -padx 2 -pady 2
    wm withdraw $w
  }

  ::board::update $w.bd $bd

  # Make sure the popup window can fit on the screen:
  incr xc 5
  incr yc 5
  update idletasks
  set dx [winfo width $w]
  set dy [winfo height $w]
  if {($xc+$dx) > [winfo screenwidth $w]} {
    set xc [expr [winfo screenwidth $w] - $dx]
  }
  if {($yc+$dy) > [winfo screenheight $w]} {
    set yc [expr [winfo screenheight $w] - $dy]
  }
  wm geometry $w "+$xc+$yc"
  wm deiconify $w
  raiseWin $w
}

# hidePgnBoard:
#    Hides the window produced by showPgnBoard.
#
proc hidePgnBoard {} {
  wm withdraw .pgnPopup
}

# resetPgnColors:
#    Reconfigures the pgn Colors, after a color is changed by the user
proc resetPgnColors {} {
  global pgnColor
  if {![winfo exists .pgnWin]} { return }
  .pgnWin.text configure -background $pgnColor(Background)
  .pgnWin.text tag configure Current -background $pgnColor(Current)
  .pgnWin.text tag configure NextMove -background $pgnColor(NextMove)
  ::htext::init .pgnWin.text
  ::htext::updateRate .pgnWin.text 60
  updatePgnWin 1
}

# updatePgnWin:
#    Updates the PGN window. If $pgnNeedsUpdate == 0, then the
#    window text is not regenerated; only the current and next move
#    tags will be updated.
#
proc updatePgnWin {{pgnNeedsUpdate 0}} {
  global doColorPgn pgnIndentVars pgnIndentComments pgnSymbolicNags
  global pgnMoveNumSpace pgnShortHeader pgnColumn pgnStripMarks
  if {![winfo exists .pgnWin]} { return }
  set format plain
  if {$doColorPgn} {set format color}
  set pgnStr [sc_game pgn -symbols $pgnSymbolicNags \
                -indentVar $pgnIndentVars -indentCom $pgnIndentComments \
                -space $pgnMoveNumSpace -format $format -column $pgnColumn \
                -short $pgnShortHeader -markCodes $pgnStripMarks]
  if {$pgnNeedsUpdate} {
    busyCursor .
    wm title .pgnWin "Scid: PGN of Game [sc_game number]"
    .pgnWin.text configure -state normal
    .pgnWin.text delete 1.0 end
    if {$doColorPgn} {
      #set start [clock clicks -milli]
      ::htext::display .pgnWin.text $pgnStr
      #set end [clock clicks -milli]
      #puts "PGN: [expr $end - $start] ms"
    } else {
      .pgnWin.text insert 1.0 $pgnStr
    }
    unbusyCursor .
  }

  if {$doColorPgn} {
    # Now update Current and NextMove tags:
    .pgnWin.text tag remove Current 1.0 end
    set offset [sc_pos pgnOffset]
    set moveRange [.pgnWin.text tag nextrange "m_$offset" 1.0]
    if {[llength $moveRange] == 2} {
      .pgnWin.text tag add Current [lindex $moveRange 0] [lindex $moveRange 1]
      .pgnWin.text see [lindex $moveRange 0]
    }

    .pgnWin.text tag remove NextMove 1.0 end
    set noffset [sc_pos pgnOffset next]
    if {$noffset == $offset} {set noffset 0}
    set moveRange [.pgnWin.text tag nextrange "m_$noffset" 1.0]
    if {[llength $moveRange] == 2} {
      .pgnWin.text tag add NextMove [lindex $moveRange 0] [lindex $moveRange 1]
    }
    .pgnWin.text configure -state disabled
  }
  return
}


############################################################
### Comment Editor window

proc addNag {nag} {
  if {![winfo exists .commentWin]} { return }
  .commentWin.nf.tf.text insert end "$nag  "
  storeComment
  updatePgnWin 1
}

proc makeCommentWin {} {
  global commentWin
  if {[winfo exists .commentWin]} {
    closeCommentWin
  } else {
    openCommentWin
  }
}

proc closeCommentWin {} {
  global commentWin
  if {[winfo exists .commentWin]} {
    focus .
    destroy .commentWin
    set commentWin 0
  }
}

proc openCommentWin {} {
  global commentWin nagValue highcolor helpMessage
  set commentWin 1
  if {[winfo exists .commentWin]} {
    focus .commentWin.cf.text
    return
  }
  set w .commentWin
  toplevel $w
  setWinLocation $w
  bind $w <F1> {helpWindow Comment}
  bind $w <Destroy> {set commentWin 0}

  # Comment frame:
  frame $w.cf
  text $w.cf.text -width $::winWidth($w) -height $::winHeight($w) \
    -background white -wrap word -font font_Regular \
    -yscrollcommand ".commentWin.cf.scroll set" -setgrid 1
  scrollbar $w.cf.scroll -command ".commentWin.cf.text yview"
  label $w.cf.label -font font_Bold -textvar ::tr(Comment)
  bindFocusColors $w.cf.text
  bind $w.cf.text <Alt-KeyRelease-c> { .commentWin.b.close invoke }
  bind $w.cf.text <Alt-KeyRelease-s> { .commentWin.b.store invoke }
  bind $w <Configure> "recordWinSize $w"

  # NAG frame:
  frame $w.nf -width 100
  frame $w.nf.tf
  entry $w.nf.tf.text -width 20 -background white
  bindFocusColors $w.nf.tf.text
  bind $w.nf.tf.text <Alt-KeyRelease-c> { .commentWin.b.close invoke }

  set nagbox $w.nf.tf.text
  set nagbuttons $w.nf.b
  frame $w.nf.b
  button $nagbuttons.b1 -text "!" -command {addNag "!"}
  set helpMessage(E,$nagbuttons.b1) {Good move}
  button $nagbuttons.b2 -text "?" -command {addNag "?"}
  set helpMessage(E,$nagbuttons.b2) {Poor move}
  button $nagbuttons.b3 -text "!!" -command {addNag "!!"}
  set helpMessage(E,$nagbuttons.b3) {Excellent move}
  button $nagbuttons.b4 -text "??" -command {addNag "??"}
  set helpMessage(E,$nagbuttons.b4) {Blunder; terrible move}
  button $nagbuttons.b5 -text "!?" -command {addNag "!?"}
  set helpMessage(E,$nagbuttons.b5) {Interesting move}
  button $nagbuttons.b6 -text "?!" -command {addNag "?!"}
  set helpMessage(E,$nagbuttons.b6) {Dubious move}
  button $nagbuttons.b7 -text "N" -command {addNag "N"}
  set helpMessage(E,$nagbuttons.b7) {Novelty; new move}
  button $nagbuttons.b8 -text "D" -command {addNag "D"}
  set helpMessage(E,$nagbuttons.b8) {Diagram symbol}

  frame $w.nf.b2
  set nagbuttons $w.nf.b2
  button $nagbuttons.b1 -text "+-" -command {addNag "+-"}
  set helpMessage(E,$nagbuttons.b1) {White has a decisive advantage}
  button $nagbuttons.b2 -text "+/-" -command {addNag "+/-"}
  set helpMessage(E,$nagbuttons.b2) {White has a clear advantage}
  button $nagbuttons.b3 -text "+=" -command {addNag "+="}
  set helpMessage(E,$nagbuttons.b3) {White has a slight advantage}
  button $nagbuttons.b4 -text "=" -command {addNag "="}
  set helpMessage(E,$nagbuttons.b4) {Equal or drawish position}
  button $nagbuttons.b5 -text "=+" -command {addNag "=+"}
  set helpMessage(E,$nagbuttons.b5) {Black has a slight advantage}
  button $nagbuttons.b6 -text "-/+" -command {addNag "-/+"}
  set helpMessage(E,$nagbuttons.b6) {Black has a clear advantage}
  button $nagbuttons.b7 -text "-+" -command {addNag "-+"}
  set helpMessage(E,$nagbuttons.b7) {Black has a decisive advantage}

  label $w.nf.label -font font_Bold -textvar ::tr(AnnotationSymbols)
  pack $w.nf -side top
  addHorizontalRule $w

  button $w.nf.tf.clear -textvar ::tr(Clear) \
    -command {.commentWin.nf.tf.text delete 0 end}
  set helpMessage(E,$w.nf.tf.clear) {Clear all symbols for this move}
  pack $w.nf.label -side top -expand 0
  pack $w.nf.tf -side top
  pack $w.nf.tf.text -side left
  pack $w.nf.tf.clear -side right -padx 20 -pady 5
  pack $w.nf.b -side top
  for {set i 1} { $i <= 8 } { incr i } {
    pack $w.nf.b.b$i -side left
  }
  pack $w.nf.b2 -side top
  for {set i 1} { $i <= 7 } { incr i } {
    pack $w.nf.b2.b$i -side left
  }

  frame $w.b
  pack $w.b -side bottom -ipady 4 -fill x -padx 2

  pack $w.cf -side top -expand 1 -fill both
  pack $w.cf.label -side top
  pack $w.cf.scroll -side right -fill y
  pack $w.cf.text -side right -expand 1 -fill both

  addHorizontalRule $w

  wm minsize $w 40 3

  # Buttons:

  button $w.b.mark -text "Insert mark..." -command {
    .commentWin.cf.text insert insert [insertMarkComment]
    storeComment
  }

  button $w.b.clear -textvar ::tr(Clear) \
    -command ".commentWin.cf.text delete 0.0 end"
  set helpMessage(E,$w.b.clear) {Clear this comment}
  button $w.b.revert -textvar ::tr(Revert) \
    -command updateCommentWin
  set helpMessage(E,$w.b.revert) {Revert to the stored comment}
  button $w.b.store -textvar ::tr(Store) \
    -command {storeComment; updatePgnWin 1}
  set helpMessage(E,$w.b.store) {Store this comment in the game}
  frame $w.b.space -width 10
  button $w.b.close -textvar ::tr(Close) \
    -command { set commentWin 0; focus .; destroy .commentWin}
  set helpMessage(E,$w.b.close) {Close the comment editor window}

  pack $w.b.close $w.b.space $w.b.store $w.b.revert $w.b.clear -side right
  pack $w.b.mark -side left

  wm title $w "Scid: Comment editor"
  wm iconname $w "Scid: Comment editor"
  updateCommentWin
  focus $w.cf.text
}

set insertMark(Text) ""
set insertMark(OK) 0
set insertMark(from) -1
set insertMark(to) -1
set insertMark(color) red
set insertMark(colorList) {
  red red2 orange yellow green darkGreen blue darkBlue purple
}

# insertMarkComment:
#   Produces a dialog box for inserting a square color mark
#   or arrow into the current comment.
#
proc insertMarkComment {} {
  global insertMark
  set w .markDlg
  if {![winfo exists .commentWin]} { return }
  toplevel $w
  wm title $w "Scid: Insert mark"
  set insertMark(Text) ""
  set insertMark(OK) 0
  set insertMark(from) -1
  set insertMark(to) -1

  ::board::new $w.bd
  pack $w.bd -side top

  pack [frame $w.c] -side top -pady 2
  foreach i $insertMark(colorList) {
    image create photo markColor_$i -width 20 -height 20
    markColor_$i put $i -to 1 1 18 18
    radiobutton $w.c.c$i -variable insertMark(color) -value $i \
      -indicatoron 0 -image markColor_$i -command insertMarkSelect
    pack $w.c.c$i -side left -padx 1
  }

  pack [frame $w.f] -side bottom -fill x -pady 2
  entry $w.f.e -textvar insertMark(Text) -width 30
  bindFocusColors $w.f.e
  button $w.f.ok -text OK -command "set insertMark(OK) 1; destroy $w"
  button $w.f.cancel -text $::tr(Cancel) -command "destroy $w"
  pack $w.f.cancel $w.f.ok -side right -padx 1
  pack $w.f.e -side left -padx 1

  for {set i 0} {$i < 64} {incr i} {
    ::board::bind $w.bd $i <1> "insertMarkSelect $i"
  }

  update
  catch {grab $w}
  tkwait window $w
  if {$insertMark(OK)} { return $insertMark(Text) }
  return ""
}

# insertMarkSelect:
#   Called when a square is selected in the Insert Mark dialog box.
#
proc insertMarkSelect {{sq -1}} {
  global insertMark
  set w .markDlg
  ::board::update $w.bd
  ::board::recolor $w.bd

  if {$sq >= 0} {
    if {$insertMark(from) < 0  ||  $insertMark(from) != $insertMark(to)} {
      set insertMark(from) $sq
      set insertMark(to) $sq
    } else {
      set insertMark(to) $sq
    }
  }

  set files [list a b c d e f g h]
  set from [lindex $files [expr $insertMark(from) % 8]]
  append from [expr int($insertMark(from)/8) + 1]
  set to [lindex $files [expr $insertMark(to) % 8]]
  append to [expr int($insertMark(to)/8) + 1]

  if {$insertMark(from) < 0} { return }
  if {$insertMark(from) == $insertMark(to)} {
    ::board::colorSquare $w.bd $insertMark(from) $insertMark(color)
    set insertMark(Text) "\[%mark $from $insertMark(color)\]"
  } else {
    ::board::arrow $w.bd $insertMark(from) $insertMark(to) $insertMark(color)
    set insertMark(Text) "\[%arrow $from $to $insertMark(color)\]"
  }
}

proc storeComment {} {
  if {![winfo exists .commentWin]} { return }
  sc_pos clearNags
  foreach i [split [.commentWin.nf.tf.text get] " "] {
    sc_pos addNag $i
  }

  # The "end-1c" below is because Tk adds a newline to text contents:
  set newComment [.commentWin.cf.text get 1.0 end-1c]
  set oldComment [sc_pos getComment]
  if {[string compare $oldComment $newComment]} {
    sc_pos setComment $newComment
    updateStatusBar
    updatePgnWin 1
    updateBoard .board
  }
}


proc updateCommentWin {} {
  if {![winfo exists .commentWin]} { return }
  set nag [sc_pos getNags]
  .commentWin.nf.tf.text configure -state normal
  .commentWin.nf.tf.text delete 0 end
  if {$nag != "0"} {
    .commentWin.nf.tf.text insert end $nag
  }
  .commentWin.cf.text delete 0.0 end
  .commentWin.cf.text insert 0.0 [sc_pos getComment]
}


######################################################################
### Crosstable window

set crosstab(sort) score
set crosstab(type) auto
set crosstab(ages) "+ages"
set crosstab(colors) "+colors"
set crosstab(ratings) "+ratings"
set crosstab(countries) "+countries"
set crosstab(titles) "+titles"
set crosstab(groups) "-groups"
set crosstab(breaks) "-breaks"
set crosstab(deleted) "-deleted"
set crosstab(cnumbers) "-numcolumns"
set crosstab(text) hypertext

proc configCrosstabMenus {{lang ""}} {
  if {! [winfo exists .crosstabWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .crosstabWin.menu
  foreach menu {file edit opt sort color help} tag {File Edit Opt Sort Color Help} {
    configMenuName $m.$menu Crosstab$tag $lang
  }
  foreach idx {0 1 2 4} tag {Text Html LaTeX Close} {
    configMenuText $m.file.m $idx CrosstabFile$tag $lang
  }
  foreach idx {0 1 2} tag {Event Site Date} {
    configMenuText $m.edit.m $idx CrosstabEdit$tag $lang
  }
  foreach idx {0 1 2 3 5 6 7 8 9 10 12 13 15} tag {All Swiss Knockout Auto Ages Nats Ratings Titles Breaks Deleted Colors ColumnNumbers Group} {
    configMenuText $m.opt.m $idx CrosstabOpt$tag $lang
  }
  foreach idx {0 1 2} tag {Name Rating Score} {
    configMenuText $m.sort.m $idx CrosstabSort$tag $lang
  }
  foreach idx {0 1} tag {Plain Hyper} {
    configMenuText $m.color.m $idx CrosstabColor$tag $lang
  }
  foreach idx {0 1} tag {Cross Index} {
    configMenuText $m.help.m $idx CrosstabHelp$tag $lang
  }
}

proc toggleCrosstabWin {} {
  set w .crosstabWin
  if {[winfo exists $w]} {
    destroy $w
  } else {
    crosstabWin
  }
}

proc updateCrosstabWin {} {
  set w .crosstabWin
  if {[winfo exists $w]} { crosstabWin }
}

proc crosstabWin {} {
  global crosstab
  set w .crosstabWin
  if {! [winfo exists $w]} {
    toplevel $w
    wm title $w "Scid: [tr ToolsCross]"
    wm minsize $w 50 5
    setWinLocation $w

    frame $w.menu -borderwidth 3 -relief raised
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text CrosstabFile -menu $w.menu.file.m
    menubutton $w.menu.edit -text CrosstabEdit -menu $w.menu.edit.m
    menubutton $w.menu.opt -text CrosstabOpt -menu $w.menu.opt.m
    menubutton $w.menu.sort -text CrosstabSort -menu $w.menu.sort.m
    menubutton $w.menu.color -text CrosstabText -menu $w.menu.color.m
    menubutton $w.menu.help -text CrosstabHelp -menu $w.menu.help.m
    foreach i {file edit opt sort color help} {
      menu $w.menu.$i.m -tearoff 0
      pack $w.menu.$i -side left
    }

    $w.menu.file.m add command -label CrosstabFileText -command {
      set ftype {
        { "Text files" {".txt"} }
        { "All files"  {"*"}    }
      }
      set fname [tk_getSaveFile -initialdir [pwd] -filetypes $ftype  -title "Save Crosstable"]
      if {$fname != ""} {
        if {[catch {set tempfile [open $fname w]}]} {
          tk_messageBox -title "Scid: Error saving file" \
            -type ok -icon warning \
            -message "Unable to save the file: $fname\n\n"
        } else {
          puts -nonewline $tempfile [.crosstabWin.f.text get 1.0 end]
          close $tempfile
        }
      }
    }
    $w.menu.file.m add command -label CrosstabFileHtml -command {
      set ftype {
        { "HTML files" {".html" ".htm"} }
        { "All files"  {"*"}    }
      }
      set fname [tk_getSaveFile -initialdir $::initialDir(html) -filetypes $ftype  -title "Save Crosstable as HTML"]
      if {$fname != ""} {
        if {[catch {set tempfile [open $fname w]}]} {
          tk_messageBox -title "Scid: Error saving file" \
            -type ok -icon warning \
            -message "Unable to save the file: $fname\n\n"
        } else {
          catch {sc_game crosstable html $crosstab(sort) $crosstab(type) \
                   $crosstab(ratings) $crosstab(countries) $crosstab(titles) \
                   $crosstab(colors) $crosstab(groups) $crosstab(ages) \
                   $crosstab(breaks) $crosstab(cnumbers) $crosstab(deleted)} \
            result
          puts $tempfile $result
          close $tempfile
        }
      }
    }
    $w.menu.file.m add command -label CrosstabFileLaTeX -command {
      set ftype {
        { "LaTeX files" {".tex" ".ltx"} }
        { "All files"  {"*"}    }
      }
      set fname [tk_getSaveFile -initialdir $::initialDir(tex) -filetypes $ftype  -title "Save Crosstable as LaTeX"]
      if {$fname != ""} {
        if {[catch {set tempfile [open $fname w]}]} {
          tk_messageBox -title "Scid: Error saving file" \
            -type ok -icon warning \
            -message "Unable to save the file: $fname\n\n"
        } else {
          catch {sc_game crosstable latex $crosstab(sort) $crosstab(type) \
                   $crosstab(ratings) $crosstab(countries) $crosstab(titles) \
                   $crosstab(colors) $crosstab(groups) $crosstab(ages) \
                   $crosstab(breaks) $crosstab(cnumbers) $crosstab(deleted)} \
            result
          puts $tempfile $result
          close $tempfile
        }
      }
    }
    $w.menu.file.m add separator
    $w.menu.file.m add command -label CrosstabFileClose \
      -command { .crosstabWin.b.cancel invoke } -accelerator Esc

    $w.menu.edit.m add command -label CrosstabEditEvent -command {
      makeNameEditor
      setNameEditorType event
      set editName [sc_game info event]
      set editNameNew ""
      set editNameSelect crosstable
    }
    $w.menu.edit.m add command -label CrosstabEditSite -command {
      makeNameEditor
      setNameEditorType site
      set editName [sc_game info site]
      set editNameNew ""
      set editNameSelect crosstable
    }
    $w.menu.edit.m add command -label CrosstabEditDate -command {
      makeNameEditor
      setNameEditorType date
      set editNameNew " "
      set editDate [sc_game info date]
      set editDateNew [sc_game info date]
      set editNameSelect crosstable
    }

    $w.menu.opt.m add radiobutton -label CrosstabOptAll \
      -variable crosstab(type) -value allplay -command crosstabWin
    $w.menu.opt.m add radiobutton -label CrosstabOptSwiss \
      -variable crosstab(type) -value swiss -command crosstabWin
    $w.menu.opt.m add radiobutton -label CrosstabOptKnockout \
      -variable crosstab(type) -value knockout -command crosstabWin
    $w.menu.opt.m add radiobutton -label CrosstabOptAuto \
      -variable crosstab(type) -value auto -command crosstabWin
    $w.menu.opt.m add separator
    $w.menu.opt.m add checkbutton -label CrosstabOptAges \
      -variable crosstab(ages) -onvalue "+ages" \
      -offvalue "-ages" -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptNats \
      -variable crosstab(countries) -onvalue "+countries" \
      -offvalue "-countries" -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptRatings \
      -variable crosstab(ratings) -onvalue "+ratings" -offvalue "-ratings" \
      -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptTitles \
      -variable crosstab(titles) -onvalue "+titles" -offvalue "-titles" \
      -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptBreaks \
      -variable crosstab(breaks) -onvalue "+breaks" \
      -offvalue "-breaks" -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptDeleted \
      -variable crosstab(deleted) -onvalue "+deleted" \
      -offvalue "-deleted" -command crosstabWin
    $w.menu.opt.m add separator
    $w.menu.opt.m add checkbutton -label CrosstabOptColors \
      -underline 0 -variable crosstab(colors) \
      -onvalue "+colors" -offvalue "-colors" -command crosstabWin
    $w.menu.opt.m add checkbutton -label CrosstabOptColumnNumbers \
      -underline 0 -variable crosstab(cnumbers) \
      -onvalue "+numcolumns" -offvalue "-numcolumns" -command crosstabWin
    $w.menu.opt.m add separator
    $w.menu.opt.m add checkbutton -label CrosstabOptGroup \
      -underline 0 -variable crosstab(groups) \
      -onvalue "+groups" -offvalue "-groups" -command crosstabWin

    $w.menu.sort.m add radiobutton -label CrosstabSortName \
      -variable crosstab(sort) -value name -command crosstabWin
    $w.menu.sort.m add radiobutton -label CrosstabSortRating \
      -variable crosstab(sort) -value rating -command crosstabWin
    $w.menu.sort.m add radiobutton -label CrosstabSortScore \
      -variable crosstab(sort) -value score -command crosstabWin

    $w.menu.color.m add radiobutton -label CrosstabColorPlain \
      -variable crosstab(text) -value plain -command crosstabWin
    $w.menu.color.m add radiobutton -label CrosstabColorHyper \
      -variable crosstab(text) -value hypertext -command crosstabWin

    $w.menu.help.m add command -label CrosstabHelpCross \
      -accelerator F1 -command {helpWindow Crosstable}
    $w.menu.help.m add command -label CrosstabHelpIndex \
       -command {helpWindow Index}

    configCrosstabMenus

    frame $w.b
    pack $w.b -side bottom -fill x
    frame $w.f
    pack $w.f -side top -fill both -expand true
    text $w.f.text -width $::winWidth($w) -height $::winHeight($w) \
      -wrap none -font font_Fixed \
      -background white -yscroll "$w.f.ybar set" \
      -xscroll "$w.f.xbar set" -setgrid 1 -cursor top_left_arrow
    ::htext::init $w.f.text
    $w.f.text tag configure bgGray -background gray95
    scrollbar $w.f.ybar -command "$w.f.text yview"
    scrollbar $w.f.xbar -orient horizontal -command "$w.f.text xview"
    grid $w.f.text -row 0 -column 0 -sticky nesw
    grid $w.f.ybar -row 0 -column 1 -sticky nesw
    grid $w.f.xbar -row 1 -column 0 -sticky nesw
    grid rowconfig $w.f 0 -weight 1 -minsize 0
    grid columnconfig $w.f 0 -weight 1 -minsize 0
    button $w.b.stop -textvar ::tr(Stop) -state disabled \
      -command { set ::htext::interrupt 1 }
    menubutton $w.b.type -text "" -menu $w.b.type.menu \
      -relief raised -bd 2 -indicatoron 1
    menu $w.b.type.menu
    $w.b.type.menu add radiobutton -label [tr CrosstabOptAll] \
      -variable crosstab(type) -value allplay -command crosstabWin
    $w.b.type.menu add radiobutton -label [tr CrosstabOptSwiss] \
      -variable crosstab(type) -value swiss -command crosstabWin
    $w.b.type.menu add radiobutton -label [tr CrosstabOptKnockout] \
      -variable crosstab(type) -value knockout -command crosstabWin
    $w.b.type.menu add radiobutton -label [tr CrosstabOptAuto] \
      -variable crosstab(type) -value auto -command crosstabWin
    button $w.b.update -textvar ::tr(Update) -command crosstabWin
    button $w.b.cancel -textvar ::tr(Close) -command {
      focus .
      destroy .crosstabWin
    }
    button $w.b.setfilter -textvar ::tr(SetFilter) -command {
        searchReset
        searchNegate
        sc_game crosstable filter
        updateGList
    }
    button $w.b.addfilter -textvar ::tr(AddToFilter) -command {
        sc_game crosstable filter
        updateGList
    }
    pack $w.b.cancel $w.b.update $w.b.type \
      -side right -pady 3 -padx 5
    pack $w.b.setfilter $w.b.addfilter -side left -pady 3 -padx 5
    bind $w <Configure> "recordWinSize $w"
    bind $w <F1> { helpWindow Crosstable }
    bind $w <Return> { .crosstabWin.b.update invoke }
    bind $w <Escape> { .crosstabWin.b.cancel invoke }
    bind $w <Up> { .crosstabWin.f.text yview scroll -1 units }
    bind $w <Down> { .crosstabWin.f.text yview scroll 1 units }
    bind $w <Prior> { .crosstabWin.f.text yview scroll -1 pages }
    bind $w <Next> { .crosstabWin.f.text yview scroll 1 pages }
    bind $w <Left> { .crosstabWin.f.text xview scroll -1 units }
    bind $w <Right> { .crosstabWin.f.text xview scroll 1 units }
    bind $w <Key-Home> {
      .crosstabWin.f.text xview moveto 0
    }
    bind $w <Key-End> {
      .crosstabWin.f.text xview moveto 0.99
    }
    standardShortcuts $w
  }

  switch $crosstab(type) {
    allplay  { $w.b.type configure -text [tr CrosstabOptAll] }
    swiss    { $w.b.type configure -text [tr CrosstabOptSwiss] }
    knockout { $w.b.type configure -text [tr CrosstabOptKnockout] }
    auto     { $w.b.type configure -text [tr CrosstabOptAuto] }
  }
  $w.f.text configure -state normal
  $w.f.text delete 1.0 end
  busyCursor .
  $w.f.text configure -state disabled
  update idle
  $w.b.stop configure -state normal
  foreach button {update cancel setfilter addfilter type} {
    $w.b.$button configure -state disabled
  }
  pack $w.b.stop -side right -padx 5 -pady 3
  catch {grab $w.b.stop}
  update
  catch {sc_game crosstable $crosstab(text) $crosstab(sort) $crosstab(type) \
         $crosstab(ratings) $crosstab(countries) $crosstab(titles) \
         $crosstab(colors) $crosstab(groups) $crosstab(ages) \
         $crosstab(breaks) $crosstab(cnumbers) $crosstab(deleted)} result
  $w.f.text configure -state normal
  if {$crosstab(text) == "plain"} {
    $w.f.text insert end $result
  } else {
    ::htext::display $w.f.text $result
  }
  # Shade every second line to help readability:
  set lastLineNum [expr int([$w.f.text index end])]
  for {set i 2} {$i <= $lastLineNum} {incr i 2} {
    $w.f.text tag add bgGray $i.0 "$i.0 lineend +1c"
  }
  unbusyCursor .
  catch {grab release $w.b.stop}
  $w.b.stop configure -state disabled
  pack forget $w.b.stop
  foreach button {update cancel setfilter addfilter type} {
    $w.b.$button configure -state normal
  }
  $w.f.text configure -state disabled
  raiseWin $w
}


####################
# Game score graph

proc updateScoreGraph {} {
  set linecolor red
  set linewidth 2
  set psize 2

  set w .sgraph

  if {! [winfo exists $w]} {
    toplevel $w
    frame $w.menu -relief raised -borderwidth 2
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text GraphFile -menu $w.menu.file.m
    menu $w.menu.file.m
    $w.menu.file.m add command -label GraphFileColor \
      -command "saveGraph color $w.c"
    $w.menu.file.m add command -label GraphFileGrey \
      -command "saveGraph gray $w.c"
    $w.menu.file.m add separator
    $w.menu.file.m add command -label GraphFileClose -command "destroy $w"
    pack $w.menu.file -side left

    canvas $w.c -width 500 -height 300
    $w.c create text 25 5 -tag text -justify center -width 1 \
      -font font_Regular -anchor n
    pack $w.c -side top -expand yes -fill both
    bind $w <F1> {helpWindow Graphs Score}
    bind $w <Configure> {
      .sgraph.c itemconfigure text -width [expr [winfo width .sgraph.c] - 50]
      .sgraph.c coords text [expr [winfo width .sgraph.c] / 2] 10
      ::graph::configure score -height [expr [winfo height .sgraph.c] - 90]
      ::graph::configure score -width [expr [winfo width .sgraph.c] - 100]
      ::graph::redraw score
    }
    bind $w.c <3> updateScoreGraph
    bind $w.c <1> {moveInScoreGraph %x}
    wm title $w "Scid: [tr ToolsScore]"
    configScoreGraphMenus
  }

  $w.c itemconfigure text -width [expr [winfo width $w.c] - 50]
  $w.c coords text [expr [winfo width $w.c] / 2] 10
  set height [expr [winfo height $w.c] - 90]
  set width [expr [winfo width $w.c] - 100]
  ::graph::create score -width $width -height $height -xtop 50 -ytop 45 \
    -ytick 1 -xtick 5 -font font_Small -canvas $w.c -textcolor black \
    -hline {{gray80 1 each 1} {black 1 at 0}} \
    -vline {{gray80 1 each 1} {steelBlue 1 each 5}}

  # Create fake dataset with bounds so we see at least -1.0 to 1.0:
  ::graph::data score bounds -points 0 -lines 0 -bars 0 -coords {1 -0.9 1 0.9}

  # Update the graph:
  $w.c itemconfigure text -text "[sc_game info white] - [sc_game info black]\n[sc_game info site]  [sc_game info date]"
  busyCursor $w
  update
  catch {::graph::data score data -color $linecolor -points 1 -lines 1 \
             -linewidth $linewidth -radius $psize -outline $linecolor \
             -coords [sc_game scores]}
  ::graph::redraw score
  unbusyCursor $w
  update
}

proc configScoreGraphMenus {{lang ""}} {
  if {! [winfo exists .sgraph]} { return }
  if {$lang == ""} { set lang $::language }
  set m .sgraph.menu
  foreach menu {file} tag {File} {
    configMenuName $m.$menu Graph$tag $lang
  }
  foreach idx {0 1 3} tag {Color Grey Close} {
    configMenuText $m.file.m $idx GraphFile$tag $lang
  }
}

proc moveInScoreGraph {xc} {
  set x [expr round([::graph::xunmap score $xc] * 2)]
  sc_move start
  sc_move forward $x
  updateBoard
}


####################
# Rating graph

set rgraph(year) 1900
set rgraph(type) both
set rgraph(player) ""

proc updateRatingGraph {{type ""} {player ""}} {
  global rgraph
  set white [sc_game info white]
  set black [sc_game info black]
  set whiteColor red
  set blackColor blue
  set lwidth 2
  set psize 2

  if {$type == ""} { set type $rgraph(type) }
  if {$player == ""} { set player $rgraph(player) }
  set rgraph(type) $type
  set rgraph(player) $player

  set w .rgraph

  if {! [winfo exists $w]} {
    toplevel $w
    frame $w.menu -relief raised -borderwidth 2
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text GraphFile -menu $w.menu.file.m
    menu $w.menu.file.m
    $w.menu.file.m add command -label GraphFileColor \
      -command "saveGraph color $w.c"
    $w.menu.file.m add command -label GraphFileGrey \
      -command "saveGraph gray $w.c"
    $w.menu.file.m add separator
    $w.menu.file.m add command -label GraphFileClose -command "destroy $w"
    menubutton $w.menu.options -text GraphOptions -menu $w.menu.options.m
    menu $w.menu.options.m
    foreach i {White Black Both PInfo} j {white black both player} {
      $w.menu.options.m add radiobutton -label GraphOptions$i \
        -variable rgraph(type) -value $j -command "updateRatingGraph"
    }
    $w.menu.options.m add separator
    foreach i {1900 1980 1985 1990 1995 2000} {
      $w.menu.options.m add radiobutton -label "Since $i" \
        -variable rgraph(year) -value $i -command "updateRatingGraph"
    }
    pack $w.menu.file $w.menu.options -side left

    canvas $w.c -width 500 -height 300
    $w.c create text 25 10 -tag text -justify center -width 1 \
      -font font_Regular -anchor n
    pack $w.c -side top -expand yes -fill both
    bind $w <F1> {helpWindow Graphs Rating}
    bind $w <Configure> {
      .rgraph.c itemconfigure text -width [expr [winfo width .rgraph.c] - 50]
      .rgraph.c coords text [expr [winfo width .rgraph.c] / 2] 10
      ::graph::configure ratings -height [expr [winfo height .rgraph.c] - 70]
      ::graph::configure ratings -width [expr [winfo width .rgraph.c] - 100]
      ::graph::configure ratings -logy 10
      ::graph::redraw ratings
    }
    bind $w.c <Button-1> "updateRatingGraph"
    bind $w.c <Button-3> "updateRatingGraph"
    wm title $w "Scid: [tr ToolsRating]"
    configRatingGraphMenus
  }

  $w.c itemconfigure text -width [expr [winfo width $w.c] - 50]
  $w.c coords text [expr [winfo width $w.c] / 2] 10
  set height [expr [winfo height $w.c] - 70]
  set width [expr [winfo width $w.c] - 100]
  ::graph::create ratings -width $width -height $height -xtop 50 -ytop 35 \
    -ytick 50 -xtick 1 -font font_Small -canvas $w.c -textcolor black \
    -hline {{gray80 1 each 25} {steelBlue 1 each 100}} \
    -vline {{gray80 1 each 1} {steelBlue 1 each 5}}
  ::graph::redraw ratings
  busyCursor $w
  update

  set title "[tr ToolsRating]: "
  if {$type == "player"} {
    append title $player
    catch {::graph::data ratings d -color $whiteColor -points 1 -lines 1 \
             -linewidth $lwidth -radius $psize -outline $whiteColor \
             -coords [sc_name info -ratings:$rgraph(year) $player]}
  }
  if {$type == "white"  ||  $type == "both"} {
    set key ""
    if {$type == "both"} { set key [surname $white] }
    append title $white
    catch {::graph::data ratings d -color $whiteColor -points 1 -lines 1 \
             -linewidth $lwidth -radius $psize -outline $whiteColor \
             -key $key -coords [sc_name info -ratings:$rgraph(year) $white]}
  }
  if {$type == "both"} { append title " - " }
  if {$type == "black"  ||  $type == "both"} {
    set key ""
    if {$type == "both"} { set key [surname $black] }
    append title $black
    catch {::graph::data ratings d2 -color $blackColor -points 1 -lines 1 \
             -linewidth $lwidth -radius $psize -outline $blackColor \
             -key $key -coords [sc_name info -ratings:$rgraph(year) $black]}
  }
  set minYear [expr int([::graph::cget ratings axmin])]
  set maxYear [expr int([::graph::cget ratings axmax])]
  ::graph::configure ratings -xtick 1
  if {[expr $maxYear - $minYear] > 10} {::graph::configure ratings -xtick 5}
  ::graph::redraw ratings
  $w.c itemconfigure text -text $title
  unbusyCursor $w
}

proc configRatingGraphMenus {{lang ""}} {
  if {! [winfo exists .rgraph]} { return }
  if {$lang == ""} { set lang $::language }
  set m .rgraph.menu
  foreach menu {file options} tag {File Options} {
    configMenuName $m.$menu Graph$tag $lang
  }
  foreach idx {0 1 3} tag {Color Grey Close} {
    configMenuText $m.file.m $idx GraphFile$tag $lang
  }
  foreach idx {0 1 2 3} tag {White Black Both PInfo} {
    configMenuText $m.options.m $idx GraphOptions$tag $lang
  }
}


# surname:
#   Returns the surname of a player name.
#
proc surname {name} {
  set idx [string first "," $name]
  if {$idx > 0} { set name [string range $name 0 [expr $idx - 1]] }
  return $name
}


####################
# Player Info window

set playerInfoName ""

proc playerInfo {{player ""}} {
  global playerInfoName
  if {$player == ""} { set player $playerInfoName }
  if {[catch {sc_name info -htext $player} pinfo]} { return }
  set playerInfoName $player
  set ::rgraph(player) $player
  set w .playerInfoWin
  if {! [winfo exists $w]} {
    toplevel $w
    setWinLocation $w
    wm title $w "Scid: Player Info"
    wm minsize $w 40 5
    pack [frame $w.b2] -side bottom -fill x
    pack [frame $w.b] -side bottom -fill x
    button $w.b.graph -text "Rating graph" \
      -command {updateRatingGraph player $playerInfoName}
    button $w.b.edit -text "Edit ratings" -command {
      makeNameEditor
      setNameEditorType rating
      set editName $playerInfoName
      set editNameSelect crosstable
    }
    button $w.b2.help -textvar ::tr(Help) -command {helpWindow PInfo}
    button $w.b2.update -textvar ::tr(Update) -command {playerInfo $playerInfoName}
    button $w.b2.close -textvar ::tr(Close) -command "focus .; destroy $w"
    pack $w.b2.close $w.b2.update $w.b2.help -side right -padx 3
    pack $w.b.graph $w.b.edit -side left -padx 3
    scrollbar $w.ybar -command "$w.text yview"
    pack $w.ybar -side right -fill y
    text $w.text -font font_Regular -background white \
      -width $::winWidth($w) -height $::winHeight($w) \
      -setgrid 1 -wrap none -yscrollcommand "$w.ybar set"
    label $w.photo -background white
    pack $w.text -side top -fill both -expand yes
    bind $w <Escape> "focus .; destroy $w"
    ::htext::init $w.text
    ::htext::updateRate $w.text 0
    bind $w <Escape> "focus .; destroy $w"
    bind $w <F1> {helpWindow PInfo}
    bind $w <Configure> "recordWinSize $w"
    standardShortcuts $w
  }
  if {[info exists ::photo($player)]} {
    image create photo photoPInfo -data $::photo($player)
    $w.photo configure -image photoPInfo -anchor ne
    place $w.photo -in $w.text -relx 1.0 -x -1 -rely 0.0 -y 1 -anchor ne
  } else {
    place forget $w.photo
  }
  $w.text configure -state normal
  $w.text delete 1.0 end
  ::htext::display $w.text $pinfo
  $w.text configure -state disabled
  updateGList
  updateMaintWin
  #raiseWin $w
}


####################
# Game Browser window

namespace eval ::gbrowser {}
set ::gbrowser::size 35

proc ::gbrowser::new {base gnum {ply -1}} {
  set n 0
  while {[winfo exists .gb$n]} { incr n }
  set w .gb$n
  toplevel $w
  if {$base < 1} { set base [sc_base current] }
  if {$gnum < 1} { set game [sc_game number] }
  set filename [file tail [sc_base filename $base]]
  wm title $w "Scid: $::tr(BrowseGame) ($filename: $gnum)"
  set header [sc_game summary -base $base -game $gnum header]
  set ::gbrowser::boards($n) [sc_game summary -base $base -game $gnum boards]
  set moves [sc_game summary -base $base -game $gnum moves]

  pack [frame $w.b] -side bottom -fill x
  ::board::new $w.bd $::gbrowser::size
  $w.bd configure -relief solid -borderwidth 1
  pack $w.bd -side left -padx 4 -pady 4

  pack [frame $w.t] -side right -fill both -expand yes
  text $w.t.text -foreground black -background white -wrap word \
    -width 45 -height 12 -font font_Small -yscrollcommand "$w.t.ybar set" \
    -setgrid 1
  scrollbar $w.t.ybar -command "$w.t.text yview" -takefocus 0
  pack $w.t.ybar -side right -fill y
  pack $w.t.text -side left -fill both -expand yes
  set t $w.t.text
  event generate $t <ButtonRelease-1>
  $t tag configure header -foreground darkBlue
  $t tag configure next -foreground yellow -background darkBlue
  $t insert end "$header" header
  $t insert end "\n\n"
  set m 0
  foreach i $moves {
    set moveTag m$m
    $t insert end $i $moveTag
    $t insert end " "
    $t tag bind $moveTag <ButtonRelease-1> "::gbrowser::update $n $m"
    $t tag bind $moveTag <Any-Enter> \
      "$t tag configure $moveTag -foreground red
       $t configure -cursor hand2"
    $t tag bind $moveTag <Any-Leave> \
      "$t tag configure $moveTag -foreground {}
       $t configure -cursor {}"
    incr m
  }
  bind $w <F1> {helpWindow GameList Browsing}
  bind $w <Escape> "destroy $w"
  bind $w <Home> "::gbrowser::update $n start"
  bind $w <End> "::gbrowser::update $n end"
  bind $w <Left> "::gbrowser::update $n -1"
  bind $w <Right> "::gbrowser::update $n +1"
  bind $w <Up> "::gbrowser::update $n -10"
  bind $w <Down> "::gbrowser::update $n +10"
  bind $w <Control-Shift-Left> "::board::resize $w.bd -1"
  bind $w <Control-Shift-Right> "::board::resize $w.bd +1"

  button $w.b.start -image tb_start -command "::gbrowser::update $n start"
  button $w.b.back -image tb_prev -command "::gbrowser::update $n -1"
  button $w.b.forward -image tb_next -command "::gbrowser::update $n +1"
  button $w.b.end -image tb_end -command "::gbrowser::update $n end"
  pack $w.b.start $w.b.back $w.b.forward $w.b.end -side left -padx 1 -pady 1

  set ::gbrowser::flip($n) [::board::isFlipped .board]
  button $w.b.flip -image tb_flip -command "::gbrowser::flip $n"
  pack $w.b.flip -side left -padx 3 -pady 1

  if {$gnum > 0} {
    button $w.b.load -textvar ::tr(LoadGame) \
      -command "sc_base switch $base; gameLoad $gnum"
    button $w.b.merge -textvar ::tr(MergeGame) \
      -command "mergeGame $base $gnum"
  }
  button $w.b.close -textvar ::tr(Close) -command "destroy $w"
  pack $w.b.close -side right -padx 1 -pady 1
  if {$gnum > 0} {
    pack $w.b.merge $w.b.load -side right -padx 1 -pady 1
  }

  wm resizable $w 1 0
  if {$ply < 0} {
    set ply 0
    if {$gnum > 0} {
      set ply [sc_filter value $base $gnum]
      if {$ply > 0} { incr ply -1 }
    }
  }
  ::gbrowser::update $n $ply
}

proc ::gbrowser::flip {n} {
  ::board::flip .gb$n.bd
}

proc ::gbrowser::update {n ply} {
  set w .gb$n
  if {! [winfo exists $w]} { return }
  set oldply 0
  if {[info exists ::gbrowser::ply($n)]} { set oldply $::gbrowser::ply($n) }
  if {$ply == "forward"} { set ply [expr $oldply + 1] }
  if {$ply == "back"} { set ply [expr $oldply - 1] }
  if {$ply == "start"} { set ply 0 }
  if {$ply == "end"} { set ply 9999 }
  if {[string index $ply 0] == "-"  ||  [string index $ply 0] == "+"} {
    set ply [expr $oldply + $ply]
  }
  if {$ply < 0} { set ply 0 }
  set max [expr [llength $::gbrowser::boards($n)] - 1]
  if {$ply > $max} { set ply $max }
  set ::gbrowser::ply($n) $ply
  ::board::update $w.bd [lindex $::gbrowser::boards($n) $ply]

  set t $w.t.text
  $t configure -state normal
  set moveRange [$t tag nextrange m$ply 1.0]
  $t tag remove next 1.0 end
  set moveRange [$t tag nextrange m$ply 1.0]
  if {[llength $moveRange] == 2} {
    $t tag add next [lindex $moveRange 0] [lindex $moveRange 1]
    $t see [lindex $moveRange 0]
  }
  $t configure -state disabled
}


####################
# ECO Browser window

set ecoBrowser(code) ""
set ecoBrowser(count) 0
set ecoBrowserWin 0

proc openCloseEcoBrowser {} {
  if {[winfo exists .ecograph]} {
    destroy .ecograph
  } else {
    updateEcoWin
  }
}

# updateEcoWin:
#    Updates the ECO Browser window, opening it if necessary.
#    If the ECO code "code" is "x", then the value of the global
#    variable ecoBrowser(code) is used instead.
#
proc updateEcoWin {{code "x"}} {
  set w .ecograph
  set graph $w.pane.graph
  set text $w.pane.text
  if {$code != "x"} { set ::ecoBrowser(code) $code }
  if {! [winfo exists $w]} {
    set ::ecoBrowserWin 1
    toplevel $w
    wm minsize $w 200 100
    setWinLocation $w
    bind $w <Escape> "destroy $w"
    bind $w <F1> {helpWindow ECO}
    bind $w <Destroy> {set ::ecoBrowserWin 0}
    text $w.title -relief flat -height 1 -width 1 -wrap word -font font_Bold
    $w.title tag configure center -justify center
    $w.title configure -cursor top_left_arrow
    pack $w.title -side top -fill x
    frame $w.b
    pack $w.b -side bottom -fill x
    button $w.b.classify -textvar ::tr(ReclassifyGames) -command classifyAllGames
    button $w.b.help -textvar ::tr(Help) -command {helpWindow ECO}
    button $w.b.close -textvar ::tr(Close) -command "destroy $w"
    pack $w.b.classify -side left -padx 5 -pady 5
    pack $w.b.close $w.b.help -side right -padx 5 -pady 5
    set pane [::pane::create $w.pane graph text 500 400 0.5]
    ::pane::range $w.pane 0.3 0.7
    ::pane::setdrag $w.pane 0
    pack $pane -side top -expand true -fill both

    canvas $graph.c -width 500 -height 250
    pack $graph.c -side top -fill both -expand yes
    text $text.text -height 12 -width 75 -wrap word -font font_Regular \
      -background white -selectbackground lightBlue \
      -yscroll "$text.ybar set" -xscroll "$text.xbar set"
    $text.text tag configure bold -font font_Bold
    $text.text tag configure indent -lmargin2 20
    $text.text configure -cursor top_left_arrow
    ::htext::init $text.text
    scrollbar $text.ybar -command "$text.text yview"
    scrollbar $text.xbar -orient horizontal -command "$text.text xview"
    grid $text.text -row 0 -column 0 -sticky nesw
    grid $text.ybar -row 0 -column 1 -sticky nesw
    #grid $text.xbar -row 1 -column 0 -sticky nesw
    grid rowconfig $text 0 -weight 1 -minsize 0
    grid columnconfig $text 0 -weight 1 -minsize 0

    foreach i {0 1 2 3 4 5 6 7 8 9 A B C D E a b c d e f g h i j k l m n o p
               q r s t u v w x y z} {
      bind $w <KeyPress-$i> "keyEcoBrowser $i"
    }

    foreach i {Left Delete less BackSpace} {
      bind $w <KeyPress-$i> {keyEcoBrowser "<"}
    }

    bind $w <Home>  {.ecograph.pane.text.text yview moveto 0}
    bind $w <End>   {.ecograph.pane.text.text yview moveto 1.0}
    bind $w <Up>    {.ecograph.pane.text.text yview scroll -1 units}
    bind $w <Down>  {.ecograph.pane.text.text yview scroll 1 units}
    bind $w <Prior> {.ecograph.pane.text.text yview scroll -1 pages}
    bind $w <Next>  {.ecograph.pane.text.text yview scroll 1 pages}
    standardShortcuts $w

    bind $graph.c <1> { selectEcoBrowser %x }
    bind $graph.c <3> { keyEcoBrowser "<" }

    bind $graph <Configure> {
      ::graph::configure eco -height [expr [winfo height .ecograph.pane.graph.c] - 50]
      ::graph::configure eco -width [expr [winfo width .ecograph.pane.graph.c] - 60]
      ::graph::redraw eco
    }
    bind $w <Configure> {
      ::graph::configure eco -height [expr [winfo height .ecograph.pane.graph.c] - 50]
      ::graph::configure eco -width [expr [winfo width .ecograph.pane.graph.c] - 60]
      ::graph::redraw eco
    }
    wm title $w "Scid: [tr WindowsECO]"
    ::graph::create eco -width 1 -height 1 -xtop 50 -ytop 20 \
      -xmin 0.5 -xtick 1 -ytick 5 -font font_Small -canvas $graph.c
    update
  }

  set height [expr [winfo height $graph.c] - 50]
  set width [expr [winfo width $graph.c] - 60]

  set code $::ecoBrowser(code)
  # Collect data:
  set len [string length $code]
  set subcodes {}
  if {$len == 0} {
    set subcodes {A B C D E}
  } elseif {$len == 1  ||  $len == 2} {
    set subcodes {0 1 2 3 4 5 6 7 8 9}
  } elseif {$len == 3} {
    set subcodes {a b c d e f g h i j k l m n o p q r s t u v w x y z}
  }

  set xlabels {}
  set count 0
  set data {}
  set maxfreq 1
  set wins {}
  set draws {}

  foreach i $subcodes {
    set subcode "$code$i"
    set stats [sc_base ecoStats $subcode]
    set freq [lindex $stats 0]
    incr count
    lappend data $count
    lappend data $freq
    lappend wins $count
    lappend wins [lindex $stats 1]
    lappend draws $count
    lappend draws [expr [lindex $stats 1] + [lindex $stats 2] + [lindex $stats 4]]
    if {$freq > $maxfreq} {set maxfreq $freq}
    if {$len == 3} {
      set subcode $i
    }
    lappend xlabels [list $count $subcode]
  }
  set hline 5
  if {$maxfreq >    20} { set hline    10 }
  if {$maxfreq >    50} { set hline    25 }
  if {$maxfreq >   100} { set hline    50 }
  if {$maxfreq >   200} { set hline   100 }
  if {$maxfreq >   500} { set hline   250 }
  if {$maxfreq >  1000} { set hline   500 }
  if {$maxfreq >  2000} { set hline  1000 }
  if {$maxfreq >  5000} { set hline  2500 }
  if {$maxfreq > 10000} { set hline  5000 }
  if {$maxfreq > 20000} { set hline 10000 }
  if {$maxfreq > 50000} { set hline 25000 }
  if {$maxfreq > 100000} { set hline 50000 }

  ::graph::create eco -width $width -height $height -xtop 50 -ytop 20 \
    -xmin 0.5 -xtick 1 -ytick $hline -font font_Small -canvas $graph.c
  ::graph::data eco data -color SteelBlue4 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $data
  ::graph::data eco draws -color SteelBlue3 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $draws
  ::graph::data eco wins -color SteelBlue1 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $wins
  ::graph::data eco bounds -points 0 -lines 0 -bars 0 -coords {1 0 1 1}
  ::graph::configure eco -ymin 0 -xmin 0.4 -xmax [expr $count + 0.6] \
    -xlabels $xlabels -hline [list [list gray80 1 each $hline]]
  ::graph::redraw eco
  $text.text configure -state normal
  $text.text delete 1.0 end
  set stats [sc_base eco $code]
  if {$len == 0} {
    set section $::tr(ECOAllSections)
  } elseif {$len < 3} {
    set section "$::tr(ECOSection) \"$code\""
  } else {
    set section "$::tr(ECOCode) \"$code\""
  }
  set header "<center><b>$::tr(ECOSummary) $section</b><br>"
  append header "[lindex $stats 0] $::tr(games): +[lindex $stats 1] =[lindex $stats 2] -[lindex $stats 3]  ([lindex $stats 5]%)</center>\n\n"
  ::htext::display $text.text "$header[sc_eco summary $code 1]"
  $text.text configure -state disabled
  $w.title configure -state normal
  $w.title delete 1.0 end
  $w.title insert end "$::tr(ECOFrequency) $section" center
  $w.title configure -state disabled
  set ::ecoBrowser(count) $count
}

proc selectEcoBrowser {xc} {
  set count $::ecoBrowser(count)
  set code $::ecoBrowser(code)
  set x [::graph::xunmap eco $xc]
  set selection 0
  for {set i 1} {$i <= $count} {incr i} {
    if {$x >= [expr $i - 0.4]  &&  $x <= [expr $i + 0.4]} {
      set selection $i
    }
  }
  if {$selection == 0} { return }
  incr selection -1
  set len [string length $code]
  if {$len == 0} {
    set code [lindex {A B C D E} $selection]
  } elseif {$len == 1  ||  $len == 2} {
    append code $selection
  } elseif {$len == 3} {
    append code [lindex {a b c d e f g h i j k l m n o p q r s t u v w x y z} $selection]
  } else {
    return
  }
  set ::ecoBrowser(code) $code
  updateEcoWin
}

# keyEcoBrowser:
#    Handles keyboard events in ECO browser window
#
proc keyEcoBrowser {key} {
  set code $::ecoBrowser(code)
  set len [string length $code]
  if {$key == "<"} {
    set ::ecoBrowser(code) [string range $code 0 [expr $len - 2]]
    updateEcoWin
    return
  }
  if {$key == "top"} {
    set ::ecoBrowser(code) ""
    updateEcoWin
    return
  }

  if {$len == 0} {
    set key [string toupper $key]
    switch $key {
      A - B - C - D - E {
        # nothing
      }
      default { set key "" }
    }
  } elseif {$len == 1 || $len == 2} {
    switch $key {
      0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 {
        # nothing
      }
      default { set key "" }
    }
  } elseif {$len == 3} {
    set key [string tolower $key]
    switch $key {
      a - b - c - d - e - f - g - h - i - j - k - l - m - n - o - p - q - r -
      s - t - u - v - w - x - y - z {
        # nothing
      }
      default { set key "" }
    }
  }

  if {$key != ""} {
    set ::ecoBrowser(code) "$code$key"
    updateEcoWin
  }
}


####################
# File finder window

set finder(dir) [pwd]
set finder(sort) name
set finder(recurse) 0
set finder(stop) 0
set finder(Scid) 1
set finder(PGN) 1
set finder(Rep) 1
set finder(EPD) 1
set finder(Old) 1

image create photo updir -data {
  R0lGODdhGQAUAKEAANnZ2QAAAPD/gAAngSwAAAAAGQAUAAACToSPqcvtEGJ8LIh7A00WY71B
  0kiWnIemHmh06pshrjAM8CpjdX3HR7fboXifnM6WIvpaHmUTuYQ8g1Tcb0gVWpk9FUvaTX1F
  pfIohE4zCgA7
}

proc fileFinder {} {
  global finder
  set w .finder
  if {[winfo exists $w]} { return }

  toplevel $w
  wm title $w "Scid: $::tr(FileFinder)"
  bind $w <F1> {helpWindow Finder}
  setWinLocation $w
  bind $w <Configure> "recordWinSize $w"

  frame $w.menu -relief raised -borderwidth 2
  pack $w.menu -side top -fill x
  $w configure -menu $w.menu
  menubutton $w.menu.file -text FinderFile -menu $w.menu.file.m
  menu $w.menu.file.m
  $w.menu.file.m add checkbutton -label FinderFileSubdirs \
    -variable finder(recurse) -onvalue 1 -offvalue 0 -command updateFileFinder
  $w.menu.file.m add separator
  $w.menu.file.m add command -label FinderFileClose -command "destroy $w"
  menubutton $w.menu.sort -text FinderSort -menu $w.menu.sort.m
  menu $w.menu.sort.m
  foreach {name value} {Type type Size size Mod mod Filename name Path path} {
    $w.menu.sort.m add radiobutton -label FinderSort$name \
      -variable finder(sort) -value $value -command {updateFileFinder -fast}
  }
  menubutton $w.menu.types -text FinderTypes -menu $w.menu.types.m
  menu $w.menu.types.m
  foreach type {Scid Old PGN Rep EPD} {
    $w.menu.types.m add checkbutton -label FinderTypes$type \
      -variable finder($type) -onvalue 1 -offvalue 0 -command updateFileFinder
  }
  menubutton $w.menu.help -text FinderHelp -menu $w.menu.help.m
  menu $w.menu.help.m
  $w.menu.help.m add command -label FinderHelpFinder \
    -accelerator F1 -command {helpWindow Finder}
  $w.menu.help.m add command -label FinderHelpIndex -command {helpWindow Index}
  pack $w.menu.file $w.menu.sort $w.menu.types $w.menu.help -side left

  pack [frame $w.d] -side top -fill x
  label $w.d.label -text "$::tr(FinderDir):" -font font_Small
  set finder(menu) [tk_optionMenu $w.d.mb finder(dir) ""]
  $w.d.mb configure -font font_Small -width 1 -anchor e
  $finder(menu) configure -font font_Small
  button $w.d.up -image updir -command {updateFileFinder ..}
  pack $w.d.label -side left -padx 5
  pack $w.d.up -side right -padx 5
  pack $w.d.mb -side left -fill x -expand yes

  frame $w.t
  frame $w.b
  text $w.t.text -width 65 -height 25 -font font_Small -wrap none \
    -fg black -bg white -yscrollcommand "$w.t.ybar set" -setgrid 1 \
    -cursor top_left_arrow
  scrollbar $w.t.ybar -command "$w.t.text yview" -width 12
  $w.t.text tag configure Dir -foreground brown
  $w.t.text tag configure Vol -foreground gray25
  $w.t.text tag configure PGN -foreground blue
  $w.t.text tag configure Scid -foreground red
  $w.t.text tag configure Old -foreground black
  $w.t.text tag configure Rep -foreground darkGreen
  $w.t.text tag configure EPD -foreground orange
  $w.t.text tag configure bold -font font_SmallBold
  $w.t.text tag configure center -justify center
  set xwidth [font measure [$w.t.text cget -font] "x"]
  set tablist {}
  foreach {tab justify} {15 r 30 r 32 l 50 l} {
    set tabwidth [expr $xwidth * $tab]
    lappend tablist $tabwidth $justify
  }
  $w.t.text configure -tabs $tablist

  checkbutton $w.b.sub -text [tr FinderFileSubdirs] \
    -relief raised -pady 5 -padx 10 \
    -variable finder(recurse) -onvalue 1 -offvalue 0 -command updateFileFinder
  button $w.b.stop -textvar ::tr(Stop) -command {set finder(stop) 1 }
  button $w.b.help -textvar ::tr(Help) -command {helpWindow Finder}
  button $w.b.close -textvar ::tr(Close) -command "destroy $w"
  bind $w <Escape> "$w.b.stop invoke"

  pack $w.b -side bottom -fill x
  pack $w.b.sub -side left -padx 5 -pady 2
  pack $w.b.close $w.b.help $w.b.stop -side right -padx 5 -pady 2
  pack $w.t -side top -fill both -expand yes
  pack $w.t.ybar -side right -fill y
  pack $w.t.text -side left -fill both -expand yes
  configFinderMenus
  updateFileFinder
}

proc updateFileFinder {{newdir ""}} {
  global finder
  set w .finder
  if {! [winfo exists $w]} { return }
  set t $w.t.text

  # When parameter is "-fast", just re-sort the existing data:
  set fastmode 0
  if {$newdir == "-fast"} {
    set fastmode 1
    set newdir ""
  }
  if {$newdir == ".."} { set newdir [file dirname $finder(dir)] }
  if {$newdir != ""} { set finder(dir) $newdir }

  busyCursor .
  set finder(stop) 0
  $w.b.close configure -state disabled
  $w.b.help configure -state disabled
  $w.b.sub configure -state disabled
  $w.b.stop configure -state normal
  catch {grab $w.b.stop}
  $t configure -state normal
  update

  if {$fastmode} {
    set flist $finder(flist)
  } else {
    set flist [finder_getFiles $finder(dir)]
    set finder(flist) $flist
  }

  switch $finder(sort) {
    "none" {}
    "type" { set flist [lsort -decreasing -index 1 $flist] }
    "size" { set flist [lsort -integer -decreasing -index 0 $flist] }
    "name" { set flist [lsort -dict -index 2 $flist] }
    "path" { set flist [lsort -dict -index 3 $flist] }
    "mod"  { set flist [lsort -integer -decreasing -index 4 $flist] }
  }

  set hc yellow
  $t delete 1.0 end
  set dcount 0
  $t insert end "$::tr(FinderDirs)\n" {center bold}
  set dlist {}

  # Insert drive letters, on Windows:
  if {$::windowsOS} {
    foreach drive [lsort -dictionary [file volume]] {
      $t insert end " $drive " [list Vol v$drive]
      $t insert end "    "
      $t tag bind v$drive <1> [list updateFileFinder $drive]
      $t tag bind v$drive <Any-Enter> \
        "$t tag configure [list v$drive] -background $hc"
      $t tag bind v$drive <Any-Leave> \
        "$t tag configure [list v$drive] -background {}"
    }
    $t insert end "\n"
  }

  # Insert parent directory entry:
  lappend dlist ..

  # Generate other directory entries:
  set dirlist [lsort -dictionary [glob -nocomplain [file join $finder(dir) *]]]
  foreach dir $dirlist {
    if {[file isdir $dir]} {
      lappend dlist $dir
    }
  }
  foreach dir $dlist {
    if {$dcount != 0} {
      set sep "\n"
      if {$dcount % 2 != 0} { set sep "\t\t\t" }
      $t insert end $sep
    }
    incr dcount
    if {$dir == ".."} {
      set d ..
      $t insert end " .. ($::tr(FinderUpDir)) " [list Dir d..]
    } else {
      set d [file tail $dir]
      $t insert end " $d " [list Dir d$d]
    }
    $t tag bind d$d <1> [list updateFileFinder $dir]
    $t tag bind d$d <Any-Enter> \
      "$t tag configure [list d$d] -background $hc"
    $t tag bind d$d <Any-Leave> \
      "$t tag configure [list d$d] -background {}"
  }

  # Add File section headings:
  $t insert end "\n\n"
  if {[llength $flist] != 0} {
    foreach i {Type Size Mod Name Path} v {type size mod name path} {
      $t tag configure s$i -font font_SmallBold
      $t tag bind s$i <1> "set finder(sort) $v; updateFileFinder -fast"
      $t tag bind s$i <Any-Enter> "$t tag config s$i -foreground red"
      $t tag bind s$i <Any-Leave> "$t tag config s$i -foreground {}"
    }
    $t insert end "$::tr(FinderFiles)\n" {center bold}
    $t insert end " "
    $t insert end "[tr FinderSortType]" sType
    $t insert end "\t"
    $t insert end "[tr FinderSortSize]" sSize
    $t insert end "\t"
    $t insert end "[tr FinderSortMod]" sMod
    $t insert end "\t"
    $t insert end "[tr FinderSortName]" sName
    $t insert end "\t"
    $t insert end "[tr FinderSortPath]" sPath
    $t insert end "\n"
  }

  # Add each file:
  foreach i $flist {
    set size [lindex $i 0]
    set type [lindex $i 1]
    set fname [lindex $i 2]
    set path [lindex $i 3]
    set mtime [lindex $i 4]
    set est [lindex $i 5]
    $t insert end "\n "
    $t insert end $type [list $type f$path]
    set esize ""
    if {$est} { set esize "~" }
    append esize [thousands $size]
    $t insert end "\t$esize" f$path
    $t insert end "\t[clock format $mtime -format {%b %d %Y}]" f$path
    $t insert end "\t$fname\t" f$path
    set dir [file dirname $path]
    set tail [file tail $path]
    set fullpath $finder(dir)/$dir/$tail
    $t tag bind f$path <ButtonPress-1> "fileOpen [list $fullpath]"
    $t tag bind f$path <Any-Enter> \
      "$t tag configure [list f$path] -background $hc"
    $t tag bind f$path <Any-Leave> \
      "$t tag configure [list f$path] -background {}"
    if {$dir == "."} {
      set fullpath "$finder(dir)/$tail"
    } else {
      $t tag configure p$path -foreground darkblue
      $t insert end "$dir/" [list p$path f$path]
    }
    $t tag configure t$path -foreground blue
    $t insert end $tail [list t$path f$path]
  }
  $t configure -state disabled

  # Update directory menubutton:
  $finder(menu) delete 0 end
  set mlist {}
  set d {}
  foreach subdir [file split $finder(dir)] {
    set d [file join $d $subdir]
    lappend mlist $d
  }
  foreach m $mlist {
    $finder(menu) add command -label $m -command "updateFileFinder [list $m]"
  }

  catch {grab release $w.b.stop}
  $w.b.stop configure -state disabled
  $w.b.help configure -state normal
  $w.b.close configure -state normal
  $w.b.sub configure -state normal
  unbusyCursor .
}

proc configFinderMenus {{lang ""}} {
  if {! [winfo exists .finder]} { return }
  if {$lang == ""} { set lang $::language }
  set m .finder.menu
  foreach menu {file sort types help} tag {File Sort Types Help} {
    configMenuName $m.$menu Finder$tag $lang
  }
  foreach idx {0 2} tag {Subdirs Close} {
    configMenuText $m.file.m $idx FinderFile$tag $lang
  }
  foreach idx {0 1 2 3 4} tag {Type Size Mod Name Path} {
    configMenuText $m.sort.m $idx FinderSort$tag $lang
  }
  foreach idx {0 1 2 3 4} tag {Scid Old PGN Rep EPD} {
    configMenuText $m.types.m $idx FinderTypes$tag $lang
  }
  foreach idx {0 1} tag {Finder Index} {
    configMenuText $m.help.m $idx FinderHelp$tag $lang
  }
}

proc finder_getFiles {dir {len -1}} {
  global finder
  set dlist {}
  set flist {}
  if {$len < 0} {
    set len [expr [string length $dir] + 1]
  }

  foreach f [glob -nocomplain [file join $dir *]] {
    if {[file isdir $f]} {
      lappend dlist $f
    } elseif {[file isfile $f]} {
      set ext [string tolower [file extension $f]]
      if {[catch {set mtime [file mtime $f]}]} { set mtime 0 }
      set showFile 0
      set rootname [file rootname $f]
      set type PGN
      if {$ext == ".si3"} {
        set showFile 1
        set type Scid
      } elseif {$ext == ".si"} {
        set showFile 1
        set type Old
      } elseif {$ext == ".sor"} {
        set showFile 1
        set type Rep
      } elseif {$ext == ".epd"} {
        set type EPD
        set showFile 1
      } elseif {$ext == ".pgn"} {
        set showFile 1
      } elseif {$ext == ".gz"} {
        set rootname [file rootname $rootname]
        if {[regexp {\.epd\.gz} $f]} { set showFile 1; set type EPD }
        if {[regexp {\.pgn\.gz} $f]} { set showFile 1 }
      }
      if {$showFile  &&  [info exists finder($type)]  &&  $finder($type)} {
        set path [string range $f $len end]
        set est 0
        if {[catch {set size [sc_info fsize $f]}]} {
          # Could not determine file size, probably a PGN or EPD file
          # that the user does not have permission to read.
          set est 1
          set size 0
        }
        if {$size < 0} {
          set est 1
          set size [expr 0 - $size]
        }
        if {[file dirname $path] == "."} { set path "./$path" }
        lappend flist [list $size $type [file tail $rootname] $path $mtime $est]
      }
    }
    update
    if {$finder(stop)} { break }
  }
  if {$finder(recurse)} {
    foreach f $dlist {
      foreach i [finder_getFiles $f $len] {
        lappend flist $i
        update
        if {$finder(stop)} { break }
      }
    }
  }
  return $flist
}


####################
# Tournament window

namespace eval ::tourney {}

foreach {n v} {start 0000.00.00 end 2047.12.31 minPlayers 2 maxPlayers 999 \
                 minGames 1 maxGames 9999 minElo 0 sort Date country "" \
                 site "" player ""} {
  set ::tourney::$n $v
}

trace variable ::tourney::start w forceDate
trace variable ::tourney::end w forceDate
foreach {n v} {minPlayers 999 maxPlayers 999 minGames 9999 maxGames 9999 \
                 minElo 4000} {
  trace variable ::tourney::$n w [list forceInt $v 0]
}

set tourneyWin 0

proc ::tourney::toggle {} {
  set w .tourney
  if {[winfo exists $w]} {
    destroy $w
  } else {
    ::tourney::open
  }
}

proc ::tourney::open {} {
  global tourneyWin
  set w .tourney
  if {[winfo exists $w]} { return }
  set tourneyWin 1

  if {! [info exists ::tourney::_defaults]} { ::tourney::defaults }

  toplevel $w
  wm title $w "Scid: [tr WindowsTmt]"
  setWinLocation $w
  bind $w <Configure> "recordWinSize $w"

  bind $w <F1> {helpWindow Tmt}
  bind $w <Escape> "$w.b.close invoke"
  bind $w <Return> ::tourney::refresh
  bind $w <Destroy> { set tourneyWin 0 }
  standardShortcuts $w
  bind $w <Up> "$w.t.text yview scroll -1 units"
  bind $w <Down> "$w.t.text yview scroll 1 units"
  bind $w <Prior> "$w.t.text yview scroll -1 pages"
  bind $w <Next> "$w.t.text yview scroll 1 pages"
  bind $w <Key-Home> "$w.t.text yview moveto 0"
  bind $w <Key-End> "$w.t.text yview moveto 0.99"

  frame $w.menu -relief raised -borderwidth 2
  pack $w.menu -side top -fill x
  $w configure -menu $w.menu
  menubutton $w.menu.file -text File -menu $w.menu.file.m
  menu $w.menu.file.m
  $w.menu.file.m add command -label Update -command ::tourney::refresh
  $w.menu.file.m add command -label Close -command "destroy $w"
  menubutton $w.menu.sort -text Sort -menu $w.menu.sort.m
  menu $w.menu.sort.m
  foreach name {Date Players Games Elo Site Event Winner} {
    $w.menu.sort.m add radiobutton -label $name \
      -variable ::tourney::sort -value $name -command {::tourney::refresh -fast}
  }
  pack $w.menu.file $w.menu.sort -side left

  foreach i {t o1 o2 o3 b} {frame $w.$i}
  text $w.t.text -width 75 -height 22 -font font_Small -wrap none \
    -fg black -bg white -yscrollcommand "$w.t.ybar set" -setgrid 1 \
    -cursor top_left_arrow -xscrollcommand "$w.t.xbar set"
  scrollbar $w.t.ybar -command "$w.t.text yview" -width 12 -takefocus 0
  scrollbar $w.t.xbar -orient horiz -command "$w.t.text xview" -width 12 \
    -takefocus 0
  set xwidth [font measure [$w.t.text cget -font] "0"]
  set tablist {}
  foreach {tab justify} {3 r 4 l 18 r 23 r 30 r 32 l 55 l} {
    set tabwidth [expr $xwidth * $tab]
    lappend tablist $tabwidth $justify
  }
  $w.t.text configure -tabs $tablist
  $w.t.text tag configure date -foreground darkRed
  $w.t.text tag configure np -foreground darkBlue
  $w.t.text tag configure elo -foreground darkGreen
  $w.t.text tag configure best -foreground steelBlue
  $w.t.text tag configure event -foreground darkRed
  $w.t.text tag configure title -font font_SmallBold

  set font font_Small
  set fbold font_SmallBold
  set f $w.o1
  label $f.from -text "[tr TmtSortDate]:" -font $fbold
  entry $f.efrom -textvariable ::tourney::start -width 10 -font $font
  bindFocusColors $f.efrom
  bind $f.efrom <FocusOut> +::tourney::check
  label $f.to -text "-" -font $font
  entry $f.eto -textvariable ::tourney::end -width 10 -font $font
  bindFocusColors $f.eto
  bind $f.eto <FocusOut> +::tourney::check
  pack $f.from $f.efrom $f.to $f.eto -side left

  label $f.cn -text "  $::tr(Country):" -font $fbold
  entry $f.ecn -textvariable ::tourney::country -width 4 -font $font
  bindFocusColors $f.ecn
  bind $f.ecn <FocusOut> +::tourney::check
  menubutton $f.cm -font font_Small -text "..." -menu $f.cm.m \
    -relief raised
  menu $f.cm.m -font font_Small
  $f.cm.m add command -label --- -command {set ::tourney::country ""}
  foreach c {AUT CZE DEN ENG ESP FRA GER GRE HUN ITA NED POL RUS SUI SWE \
             USA YUG} {
    $f.cm.m add command -label $c -command [list set ::tourney::country $c]
  }
  $f.cm.m entryconfigure 6 -columnbreak 1
  $f.cm.m entryconfigure 12 -columnbreak 1
  pack $f.cn $f.ecn -side left
  pack $f.cm -side left -padx 2

  label $f.size -text $::tr(TmtLimit:) -font $fbold
  set m [tk_optionMenu $f.msize ::tourney::size 10 20 50 100 200]
  $f.msize configure -width 3 -anchor e -font $font
  $m configure -font $font
  pack $f.msize $f.size -side right

  set f $w.o2
  label $f.players -text "[tr TmtSortPlayers]:" -font $fbold
  entry $f.pmin -textvariable ::tourney::minPlayers \
    -width 3 -justify right -font $font
  bindFocusColors $f.pmin
  bind $f.pmin <FocusOut> +::tourney::check
  label $f.pto -text "-"
  entry $f.pmax -textvariable ::tourney::maxPlayers \
    -width 3 -justify right -font $font
  bindFocusColors $f.pmax
  bind $f.pmax <FocusOut> +::tourney::check
  pack $f.players $f.pmin $f.pto $f.pmax -side left

  label $f.games -text "   [tr TmtSortGames]:" -font $fbold
  entry $f.gmin -textvariable ::tourney::minGames \
    -width 4 -justify right -font $font
  bindFocusColors $f.gmin
  bind $f.gmin <FocusOut> +::tourney::check
  label $f.gto -text "-" -font $font
  entry $f.gmax -textvariable ::tourney::maxGames \
    -width 4 -justify right -font $font
  bindFocusColors $f.gmax
  bind $f.gmax <FocusOut> +::tourney::check
  pack $f.games $f.gmin $f.gto $f.gmax -side left
  label $f.elolab -text "$::tr(TmtMeanElo):" -font $fbold
  entry $f.elo -textvariable ::tourney::minElo \
    -width 5 -justify right -font $font
  bindFocusColors $f.elo
  pack $f.elo $f.elolab -side right

  set f $w.o3
  label $f.sitelab -text "$::tr(Site):" -font $fbold
  entry $f.site -textvariable ::tourney::site -width 12 -font $font
  bindFocusColors $f.site
  pack $f.sitelab $f.site -side left
  label $f.playerlab -text "$::tr(Player):" -font $fbold
  entry $f.player -textvariable ::tourney::player -width 12 -font $font
  bindFocusColors $f.player
  pack $f.player $f.playerlab -side right

  button $w.b.defaults -textvar ::tr(Defaults) -command ::tourney::defaults
  button $w.b.help -textvar ::tr(Help) -command {helpWindow Tmt}
  button $w.b.update -textvar ::tr(Update) -command ::tourney::refresh
  button $w.b.close -textvar ::tr(Close) -command "destroy $w"
  pack $w.b -side bottom -fill x
  pack $w.b.close $w.b.update $w.b.help -side right -padx 2 -pady 2
  pack $w.b.defaults -side left -padx 2 -pady 2
  pack $w.o3 -side bottom -fill x -padx 2
  pack $w.o2 -side bottom -fill x -padx 2
  pack $w.o1 -side bottom -fill x -padx 2
  pack $w.t -side top -fill both -expand yes
  grid $w.t.text -row 0 -column 0 -sticky news
  grid $w.t.ybar -row 0 -column 1 -sticky news
  grid $w.t.xbar -row 1 -column 0 -sticky news
  grid rowconfig $w.t 0 -weight 1 -minsize 0
  grid columnconfig $w.t 0 -weight 1 -minsize 0

  ::tourney::configMenus
  ::tourney::refresh
}

proc ::tourney::configMenus {{lang ""}} {
  set w .tourney
  if {! [winfo exists $w]} { return }
  if {$lang == ""} { set lang $::language }
  set m $w.menu
  foreach menu {file sort} tag {File Sort} {
    configMenuName $m.$menu Tmt$tag $lang
  }
  foreach idx {0 2} tag {Update Close} {
    configMenuText $m.file.m $idx TmtFile$tag $lang
  }
  foreach idx {0 1 2 3 4 5 6} tag {Date Players Games Elo Site Event Winner} {
    configMenuText $m.sort.m $idx TmtSort$tag $lang
  }
}

proc ::tourney::defaults {} {
  set ::tourney::_defaults 1
  set year [::date::today year]
  #set ::tourney::start "$year.??.??"
  set ::tourney::start "1800.??.??"
  set ::tourney::end "$year.12.31"
  set ::tourney::size 50
  set ::tourney::minPlayers 2
  set ::tourney::maxPlayers 999
  set ::tourney::minGames 1
  set ::tourney::maxGames 9999
  set ::tourney::minElo 0
  set ::tourney::country ""
  set ::tourney::site ""
  set ::tourney::player ""
}

proc ::tourney::refresh {{option ""}} {
  set w .tourney
  if {! [winfo exists $w]} { return }
  busyCursor $w
  set t $w.t.text
  $t configure -state normal
  $t delete 1.0 end
  update
  set fastmode 0
  if {$option == "-fast"} { set fastmode 1 }

  if {$fastmode  &&  $::tourney::list != ""} {
    set tlist $::tourney::list
  } else {
    if {[catch {sc_base tournaments \
                  -start $::tourney::start \
                  -end $::tourney::end \
                  -size 2500 \
                  -minPlayers $::tourney::minPlayers \
                  -maxPlayers $::tourney::maxPlayers \
                  -minGames $::tourney::minGames \
                  -maxGames $::tourney::maxGames \
                  -minElo $::tourney::minElo \
                  -country [string toupper $::tourney::country] \
                  -site $::tourney::site \
                  -player $::tourney::player \
                } tlist]} {
      $t insert end $tlist
      $t configure -state disabled
      unbusyCursor .
      return
    }
    set ::tourney::list $tlist
  }

  switch $::tourney::sort {
    "None" {}
    "Date" { set tlist [lsort -decreasing -index 0 $tlist] }
    "Players" { set tlist [lsort -integer -decreasing -index 3 $tlist] }
    "Games" { set tlist [lsort -integer -decreasing -index 4 $tlist] }
    "Elo" { set tlist [lsort -integer -decreasing -index 5 $tlist] }
    "Site" { set tlist [lsort -dict -index 1 $tlist] }
    "Event" { set tlist [lsort -dict -index 2 $tlist] }
    "Winner" { set tlist [lsort -dict -index 7 $tlist] }
  }

  if {[llength $tlist] > 0} {
    foreach i {Date Players Games Elo Site Event Winner} {
      $t tag configure s$i -font font_SmallBold
      $t tag bind s$i <1> "set ::tourney::sort $i; ::tourney::refresh -fast"
      $t tag bind s$i <Any-Enter> "$t tag config s$i -foreground red"
      $t tag bind s$i <Any-Leave> "$t tag config s$i -foreground {}"
    }
    $t insert end "\t\t"
    $t insert end [tr TmtSortDate] sDate
    $t insert end "\t"
    $t insert end [tr TmtSortPlayers] sPlayers
    $t insert end "\t"
    $t insert end [tr TmtSortGames] sGames
    $t insert end "\t"
    $t insert end [tr TmtSortElo] sElo
    $t insert end "\t"
    $t insert end [tr TmtSortSite] sSite
    $t insert end ": "
    $t insert end [tr TmtSortEvent] sEvent
    $t insert end "\t"
    $t insert end [tr TmtSortWinner] sWinner
    $t insert end "\n"
  } else {
    $t insert end $::tr(TmtNone)
  }

  set hc yellow
  set count 0
  foreach tmt $tlist {
    incr count
    if {$count > $::tourney::size} { break }
    set date [lindex $tmt 0]
    set site [lindex $tmt 1]
    set event [lindex $tmt 2]
    set np [lindex $tmt 3]
    set ng [lindex $tmt 4]
    set elo [lindex $tmt 5]
    set g [lindex $tmt 6]
    set white [surname [lindex $tmt 7]]
    set welo [lindex $tmt 8]
    set wscore [lindex $tmt 9]
    set black [surname [lindex $tmt 10]]
    set belo [lindex $tmt 11]
    set bscore [lindex $tmt 12]
    if {$welo > 0} { append white "($welo)" }
    if {$belo > 0} { append black "($belo)" }
    append white " $wscore"
    append black " $bscore"
    set one "1."
    set two "2."
    if {$wscore == $bscore} {
      set one "1="; set two "1="
    }
    set best "$one $white, $two $black, ..."
    if {$np == 2} { set best "$one $white, $two $black" }

    $t tag bind g$count <ButtonPress-1> [list ::tourney::select $g]
    $t tag bind g$count <ButtonPress-3> [list ::tourney::select $g 1]
    $t tag bind g$count <Any-Enter> \
      "$t tag configure g$count -background $hc"
    $t tag bind g$count <Any-Leave> \
      "$t tag configure g$count -background {}"
    $t insert end "\n"
    $t insert end "\t$count\t" g$count
    $t insert end $date [list date g$count]
    $t insert end "\t" g$count
    $t insert end $np [list np g$count]
    $t insert end "\t" g$count
    $t insert end $ng [list ng g$count]
    $t insert end "\t" g$count
    $t insert end $elo [list elo g$count]
    $t insert end "\t" g$count
    $t insert end "$site: " [list site g$count]
    $t insert end "$event" [list event g$count]
    $t insert end "\t$best" [list best g$count]
  }
  $t insert end "\n"
  $t configure -state disabled
  unbusyCursor .
}

proc ::tourney::check {} {
  set start $::tourney::start
  set end $::tourney::end
  if {[string length $start] == 0} { set start "0000" }
  if {[string length $end] == 0} { set end [sc_info limit year]}
  if {[string length $start] == 4} { append start ".??.??" }
  if {[string length $end] == 4} { append end ".12.31" }
  if {[string length $start] == 7} { append start ".??" }
  if {[string length $end] == 7} { append end ".31" }
  set ::tourney::start $start
  set ::tourney::end $end
  if {$::tourney::minPlayers < 2} {set ::tourney::minPlayers 2}
  if {$::tourney::minPlayers > $::tourney::maxPlayers} {
    set ::tourney::maxPlayers $::tourney::minPlayers
  }
  set s $::tourney::country
  set s [string toupper [string trim $s]]
  if {[string length $s] > 3} { set s [string range $s 0 2] }
  set ::tourney::country $s
}

proc ::tourney::select {gnum {openCrosstable 0}} {
  if {[catch {sc_game load $gnum} result]} {
    tk_messageBox -type ok -icon info -title "Scid" -message $result
    return
  }
  updateBoardAndPgn .board
  updateTitle
  if {$openCrosstable} {
    crosstabWin
  } else {
    updateCrosstabWin
  }
}


####################
# Piece tracker window

namespace eval ::ptrack {}

set ::ptrack::psize 35
set ::ptrack::select d1
set ::ptrack::moves(start) 1
set ::ptrack::moves(end) 20
set ::ptrack::mode "-games"
set ::ptrack::color blue
set ::ptrack::colors [list black red yellow cyan blue xblack xred xyellow xcyan xblue]

trace variable ::ptrack::moves(start) w {forceInt 999 0}
trace variable ::ptrack::moves(end) w {forceInt 999 0}

# ::ptrack::sq
#   Given a square number (0=a1 to 63=h8), returns the square name.
#
proc ::ptrack::sq {n} {
  set sq [lindex [list a b c d e f g h] [expr $n % 8]]
  append sq [expr int($n/8) + 1]
  return $sq
}

# ::ptrack::unselect
#   Unselects all pieces in the Piece Tracker window.
#
proc ::ptrack::unselect {} {
  set w .ptracker
  set ::ptrack::select {}
  foreach i {a1 c1 e1 g1 b2 d2 f2 h2 a7 c7 e7 g7 b8 d8 f8 h8} {
    $w.bd.p$i configure -background $::dark
  }
  foreach i {b1 d1 f1 h1 a2 c2 e2 g2 b7 d7 f7 h7 a8 c8 e8 g8} {
    $w.bd.p$i configure -background $::lite
  }
}

# ::ptrack::select
#   Selects all the listed pieces the Piece Tracker window.
#
proc ::ptrack::select {plist} {
  ::ptrack::unselect
  foreach p $plist {
    lappend ::ptrack::select $p
    .ptracker.bd.p$p configure -background $::highcolor
  }
}

# ::ptrack::status
#   Sets the Piece Tracker window status bar.
#
proc ::ptrack::status {{text ""}} {
  set t .ptracker.status
  if {$text == ""} {
    $t configure -text "$::tr(Filter): [filterText]"
  } else {
    $t configure -text $text
  }
}

# ::ptrack::recolor
#   Changes the color scheme for track values.
#
proc ::ptrack::recolor {color} {
  set ::ptrack::color $color
  .ptracker.t.color.b configure -image ptrack_$::ptrack::color
  ::ptrack::refresh color
}

# ::ptrack::color
#   Given a real value between 0.0 and 100.0, returns
#   the corresponding Piece Tracker color value.
#
proc ::ptrack::color {pct {col ""}} {
  if {$col == ""} {
    set col $::ptrack::color
  }
  set x $pct
  if {$x > 100.0} { set x 100.0}
  if {$x < 0.01} { set x 0.01 }
  set y [expr 255 - round($x * 0.5 + 10 * log($x))]
  set yb [expr 255 - round($x * 2.0 + 10 * log($x))]
  if {$y > 255} { set y 255}
  if {$yb > 255} { set yb 255}
  if {$yb < 0} { set yb 0}
  if {$y < 0} { set y 0}
  if {$pct > 0.0  &&  $y == 0} { set y 1 }
  if {$pct > 0.0  &&  $yb == 0} { set yb 1 }
  set xy [expr 255 - $y]
  set xyb [expr 255 - $yb]
  switch $col {
    black   { set color [format "\#%02X%02X%02X" $yb $yb $yb] }
    red     { set color [format "\#%02X%02X%02X" $y $yb $yb] }
    yellow  { set color [format "\#%02X%02X%02X" $y $y $yb] }
    cyan    { set color [format "\#%02X%02X%02X" $yb $y $y] }
    blue    { set color [format "\#%02X%02X%02X" $yb $yb $y] }
    xblack  { set color [format "\#%02X%02X%02X" $xyb $xyb $xyb] }
    xred    { set color [format "\#%02X%02X%02X" $xyb $xy $xy] }
    xyellow { set color [format "\#%02X%02X%02X" $xyb $xyb $xy] }
    xcyan   { set color [format "\#%02X%02X%02X" $xy $xyb $xyb] }
    xblue   { set color [format "\#%02X%02X%02X" $xy $xy $xyb] }
  }
  return $color
}

# ::ptrack::make
#   Creates the Piece Tracker window
#
proc ::ptrack::make {} {
  set w .ptracker
  if {[winfo exists $w]} { return }

  toplevel $w
  wm title $w "Scid: [tr ToolsTracker]"
  bind $w <Escape> "destroy $w"
  bind $w <F1> {helpWindow PTracker}
  image create photo ptrack -width $::ptrack::psize -height $::ptrack::psize
  pack [label $w.status -width 1 -anchor w -relief sunken] -side bottom -fill x

  canvas $w.progress -height 20 -width 400 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 395 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"
  pack $w.progress -side bottom -pady 2

  frame $w.bd
  pack $w.bd -side left -padx 2 -pady 4

  frame $w.t
  pack $w.t -side right -fill y -expand yes
  pack [frame $w.gap -width 5] -side left

  frame $w.t.color
  frame $w.t.mode
  frame $w.t.moves
  frame $w.t.buttons
  pack $w.t.buttons -side bottom -fill x
  pack $w.t.moves -side bottom
  pack $w.t.mode -side bottom
  pack $w.t.color -side bottom

  set ::ptrack::shade {}
  for {set i 0} {$i < 64} {incr i} {
    label $w.bd.sq$i -image ptrack -background white -border 1 -relief raised
    set rank [expr $i / 8]
    set file [expr $i % 8]
    grid $w.bd.sq$i -row [expr 7 - $rank] -column [expr $file + 1]
    lappend ::ptrack::shade 0.0
  }

  foreach rank {1 2 3 4 5 6 7 8} {
    label $w.bd.r$rank -text $rank -width 2
    grid $w.bd.r$rank -column 0 -row [expr 8 - $rank]
  }

  foreach column {1 2 3 4 5 6 7 8} file {a b c d e f g h} {
    label $w.bd.f$file -text $file
    grid $w.bd.f$file -row 8 -column $column
  }

  grid [frame $w.bd.gap1 -height 5] -row 9 -column 0

  foreach file {a b c d e f g h} c {1 2 3 4 5 6 7 8} p {r n b q k b n r} {
    set sq ${file}8
    set b $w.bd.p$sq
    label $b -image b$p$::ptrack::psize -border 1 -relief raised
    grid $b -row 10 -column $c
    bind $b <1> "::ptrack::select $sq"
  }
  foreach file {a b c d e f g h} c {1 2 3 4 5 6 7 8} p {p p p p p p p p} {
    set sq ${file}7
    set b $w.bd.p$sq
    label $b -image b$p$::ptrack::psize -border 1 -relief raised
    grid $b -row 11 -column $c
    bind $b <1> "::ptrack::select $sq"
    bind $b <3> "::ptrack::select {a7 b7 c7 d7 e7 f7 g7 h7}"
  }
  grid [frame $w.bd.gap2 -height 5] -row 12 -column 0
  foreach file {a b c d e f g h} c {1 2 3 4 5 6 7 8} p {p p p p p p p p} {
    set sq ${file}2
    set b $w.bd.p$sq
    label $b -image w$p$::ptrack::psize -border 1 -relief raised
    grid $b -row 13 -column $c
    bind $b <ButtonPress-1> "::ptrack::select $sq"
    bind $b <3> "::ptrack::select {a2 b2 c2 d2 e2 f2 g2 h2}"
  }
  foreach file {a b c d e f g h} c {1 2 3 4 5 6 7 8} p {r n b q k b n r} {
    set sq ${file}1
    set b $w.bd.p$sq
    label $b -image w$p$::ptrack::psize -border 1 -relief raised
    grid $b -row 14 -column $c
    bind $b <Button-1> "::ptrack::select $sq"
  }

  # Both-piece bindings:
  foreach sq {d1 e1 d8 e8} {
    bind $w.bd.p$sq <3> [list ::ptrack::select $sq]
  }
  foreach left {a b c} right {h g f} {
    set cmd [list ::ptrack::select [list ${left}1 ${right}1]]
    bind $w.bd.p${left}1 <ButtonPress-3> $cmd
    bind $w.bd.p${right}1 <ButtonPress-3> $cmd
    set cmd [list ::ptrack::select [list ${left}8 ${right}8]]
    bind $w.bd.p${left}8 <ButtonPress-3> $cmd
    bind $w.bd.p${right}8 <ButtonPress-3> $cmd
  }

  # Status-bar help:
  foreach sq {d1 e1 d8 e8} {
    bind $w.bd.p$sq <Any-Enter> {
      ::ptrack::status $::tr(TrackerSelectSingle)
    }
    bind $w.bd.p$sq <Any-Leave> ::ptrack::status
  }

  foreach sq {a1 b1 c1 f1 g1 h1 a8 b8 c8 f8 g8 h8} {
    bind $w.bd.p$sq <Any-Enter> {
      ::ptrack::status $::tr(TrackerSelectPair)
    }
    bind $w.bd.p$sq <Any-Leave> ::ptrack::status
  }
  foreach sq {a2 b2 c2 d2 e2 f2 g2 h2 a7 b7 c7 d7 e7 f7 g7 h7} {
    bind $w.bd.p$sq <Any-Enter> {
      ::ptrack::status $::tr(TrackerSelectPawn)
    }
    bind $w.bd.p$sq <Any-Leave> ::ptrack::status
  }
  set plist $::ptrack::select
  ::ptrack::unselect
  ::ptrack::select $plist

  set f $w.t.text
  pack [frame $f] -side top -fill both -expand yes -padx 2 -pady 2
  text $f.text -width 28 -height 1 -foreground black -background white \
    -yscrollcommand "$f.ybar set" -relief sunken -takefocus 0 \
    -wrap none -font font_Small
  set xwidth [font measure [$f.text cget -font] "x"]
  foreach {tab justify} {3 r 5 l 19 r 29 r} {
    set tabwidth [expr $xwidth * $tab]
    lappend tablist $tabwidth $justify
  }
  $f.text configure -tabs $tablist
  scrollbar $f.ybar -takefocus 0 -command "$f.text yview"
  pack $f.ybar -side right -fill y
  pack $f.text -side left -fill y -expand yes

  set f $w.t.color

  menubutton $f.b -menu $f.b.menu -indicatoron 0 -relief raised
  menu $f.b.menu
  foreach col $::ptrack::colors {
    image create photo ptrack_$col -width 101 -height 20
    for {set i 0} {$i <= 100} {incr i} {
      set color [::ptrack::color $i $col]
      ptrack_$col put $color -to $i 0 [expr $i+1] 19
    }
    $f.b.menu add command -image ptrack_$col \
      -command "::ptrack::recolor $col"
  }
  $f.b configure -image ptrack_$::ptrack::color
  label $f.label -text $::tr(GlistColor:) -font font_Bold
  pack $f.label $f.b -side left -pady 5

  set f $w.t.mode
  label $f.mode -text $::tr(TrackerStat:) -font font_Bold
  grid $f.mode -row 0 -column 0
  radiobutton $f.games -text $::tr(TrackerGames) -anchor w \
    -variable ::ptrack::mode -value "-games"
  radiobutton $f.time -text $::tr(TrackerTime) -anchor w \
    -variable ::ptrack::mode -value "-time"
  grid $f.games -row 1 -column 0 -sticky we
  grid $f.time -row 2 -column 0 -sticky we

  set f $w.t.moves
  label $f.lfrom -text $::tr(TrackerMoves:) -font font_Bold
  entry $f.from -width 3 -justify right -textvariable ::ptrack::moves(start)
  label $f.lto -text "-"
  entry $f.to -width 3 -justify right -textvariable ::ptrack::moves(end)
  pack $f.lfrom $f.from $f.lto $f.to -side left -pady 5
  bindFocusColors $f.from
  bindFocusColors $f.to
  bind $f.from <FocusIn> [list +::ptrack::status $::tr(TrackerMovesStart)]
  bind $f.from <FocusOut> +::ptrack::status
  bind $f.to <FocusIn> [list +::ptrack::status $::tr(TrackerMovesStop)]
  bind $f.to <FocusOut> +::ptrack::status

  set f $w.t.buttons
  button $f.stop -text $::tr(Stop) -command sc_progressBar -state disabled
  button $f.update -text $::tr(Update) -command ::ptrack::refresh
  button $f.close -text $::tr(Close) -command "destroy $w"
  pack $f.close $f.update $f.stop -side right -padx 3 -pady 5
  ::ptrack::status
  wm resizable $w 0 0
  focus $w.t.buttons.update
}

# ::ptrack::refresh
#   Regenerates Piece Tracker statistics and updates the window
#
proc ::ptrack::refresh {{type "all"}} {
  set w .ptracker
  if {! [winfo exists $w]} { return }

  # Check if only the color needs refreshing:
  if {$type == "color"} {
    for {set i 0} {$i < 64} {incr i} {
      set x [lindex $::ptrack::shade $i]
      $w.bd.sq$i configure -background [::ptrack::color $x]
    }
    return
  }

  busyCursor .
  $w.t.buttons.update configure -state disabled
  $w.t.buttons.close configure -state disabled
  $w.t.buttons.stop configure -state normal
  catch {grab $w.t.buttons.stop}

  if {$::ptrack::moves(end) < $::ptrack::moves(start)} {
    set ::ptrack::moves(end) $::ptrack::moves(start)
  }

  set timeMode 0
  if {$::ptrack::mode == "-time"} { set timeMode 1 }

  sc_progressBar $w.progress bar 401 21 time
  set data [eval sc_base piecetrack $::ptrack::mode \
              $::ptrack::moves(start) $::ptrack::moves(end) \
              $::ptrack::select]
  set ::ptrack::data $data

  catch {grab release $w.t.buttons.stop}
  $w.t.buttons.stop configure -state disabled
  $w.t.buttons.update configure -state normal
  $w.t.buttons.close configure -state normal
  unbusyCursor .

  set dfilter [sc_filter count]
  if {$timeMode} {
    set nmoves [expr $::ptrack::moves(end) + 1 - $::ptrack::moves(start)]
    set dfilter [expr $dfilter * $nmoves]
  }
  if {$dfilter == 0} { set dfilter 1 } ;# to avoid divide-by-zero

  set max 1
  for {set i 0} {$i < 64} {incr i} {
    set freq [lindex $data $i]
    if {$freq > $max} {set max $freq}
  }

  set ::ptrack::shade {}
  for {set i 0} {$i < 64} {incr i} {
    set freq [lindex $data $i]
    set x [expr $freq * 100.0 / $max]
    set color [::ptrack::color $x]
    lappend ::ptrack::shade $x
    $w.bd.sq$i configure -background $color
  }

  # Update text frame:
  set text $w.t.text.text
  $text delete 1.0 end
  array set printed {}
  for {set top 1} {$top <= 64} {incr top} {
    set best -1
    set idx -1
    for {set i 0} {$i < 64} {incr i} {
      set n [lindex $data $i]
      if {$n > $best  &&  ![info exists printed($i)]} {
        set idx $i
        set best $n
      }
    }

    set printed($idx) 1
    set pct [expr round(double($best) * 10000.0 / double($dfilter)) / 100.0]
    set line [format "\t%2d.\t%s\t%7s\t%6.2f %%" $top \
                [::ptrack::sq $idx] [thousands $best] $pct]
    $text insert end "$line\n"
    set status "  [::ptrack::sq $idx]: [thousands $best] ($pct%%)  $top/64"
    bind $w.bd.sq$idx <Any-Enter> [list ::ptrack::status $status]
    bind $w.bd.sq$idx <Any-Leave> ::ptrack::status
  }
}

###
### End of file: windows.tcl
###

###################
# htext.tcl: Online help/hypertext display module for Scid
#
# The htext module implements html-like display in a text widget.
# It is used in Scid for the help and crosstable windows, and for
# the game information area.

namespace eval ::htext {}

set helpWin(Stack) {}
set helpWin(yStack) {}
set helpWin(Indent) 0

# help_PushStack and help_PopStack:
#   Implements the stack of help windows for the "Back" button.
#
proc help_PushStack {name {heading ""}} {
  global helpWin
  lappend helpWin(Stack) $name
  if {[llength $helpWin(Stack)] > 10} {
    set helpWin(Stack) [lrange $helpWin(Stack) 1 end]
  }
  if {[winfo exists .helpWin]} {
    set helpWin(yStack) [linsert $helpWin(yStack) 0 \
                           [lindex [.helpWin.text yview] 0]]
    if {[llength $helpWin(yStack)] > 10} {
      set helpWin(yStack) [lrange $helpWin(yStack) 0 9]
    }
  }
}

set ::htext::headingColor "\#990000"
array set ::htext:updates {}

proc help_PopStack {} {
  global helpWin helpText
  set len [llength $helpWin(Stack)]
  if {$len < 1} { return }
  incr len -2
  set name [lindex $helpWin(Stack) $len]
  set helpWin(Stack) [lrange $helpWin(Stack) 0 $len]

  set ylen [llength $helpWin(yStack)]
  set yview 0.0
  if {$ylen >= 1} {
    set yview [lindex $helpWin(yStack) 0]
    set helpWin(yStack) [lrange $helpWin(yStack) 1 end]
  }
  updateHelpWindow $name
  .helpWin.text yview moveto $yview
}

proc helpWindow {name {heading ""}} {
  help_PushStack $name
  updateHelpWindow $name $heading
}

proc updateHelpWindow {name {heading ""}} {
  global helpWin helpText helpTitle windowsOS language
  set w .helpWin

  set slist [split $name " "]
  if {[llength $slist] > 1} {
    set name [lindex $slist 0]
    set heading [lindex $slist 1]
  }

  if {[info exists helpText($language,$name)] && [info exists helpTitle($language,$name)]} {
    set title $helpTitle($language,$name)
    set helptext $helpText($language,$name)
  } elseif {[info exists helpText($name)] && [info exists helpTitle($name)]} {
    set title $helpTitle($name)
    set helptext $helpText($name)
  } else {
    return
  }

  if {![winfo exists $w]} {
    toplevel $w
    wm geometry $w -10+0
    wm minsize $w 40 5
    text $w.text -setgrid yes -wrap word -width $::winWidth($w) \
      -height $::winHeight($w) -relief sunken -border 2 \
      -yscroll "$w.scroll set"
    scrollbar $w.scroll -relief sunken -command "$w.text yview"

    frame $w.b -relief raised -border 2
    pack $w.b -side bottom -fill x
    button $w.b.index -textvar ::tr(Index) -command { helpWindow Index }
    button $w.b.back -textvar ::tr(Back) -command { help_PopStack }
    button $w.b.close -textvar ::tr(Close) -command { 
      set ::helpWin(Stack) {}
      set ::helpWin(yStack) {}
      destroy .helpWin 
    }

    pack $w.b.index $w.b.back -side left -padx 5 -pady 2
    pack $w.b.close -side right -padx 5 -pady 2
    pack $w.scroll -side right -fill y -padx 2 -pady 2
    pack $w.text -fill both -expand 1 -padx 5

    $w.text configure -font font_Regular -foreground black -background white
    ::htext::init $w.text
    bind $w <Configure> "recordWinSize $w"
  }

  $w.text configure -cursor top_left_arrow
  $w.text configure -state normal
  $w.text delete 0.0 end

  $w.b.index configure -state normal
  if {$name == "Index"} { $w.b.index configure -state disabled }
  $w.b.back configure -state disabled
  if {[llength $helpWin(Stack)] >= 2} {
    $w.b.back configure -state normal
  }

  wm title $w "Scid Help: $title"
  wm iconname $w "Scid help"

  $w.text delete 0.0 end
  bind $w <Up> "$w.text yview scroll -1 units"
  bind $w <Down> "$w.text yview scroll 1 units"
  bind $w <Prior> "$w.text yview scroll -1 pages"
  bind $w <Next> "$w.text yview scroll 1 pages"
  bind $w <Key-Home> "$w.text yview moveto 0"
  bind $w <Key-End> "$w.text yview moveto 0.99"
  bind $w <Escape> "$w.b.close invoke"
  bind $w <Key-b> "$w.b.back invoke"
  bind $w <Left> "$w.b.back invoke"
  bind $w <Key-i> "$w.b.index invoke"

  ::htext::display $w.text $helptext $heading 0
  focus $w
}

proc ::htext::updateRate {w rate} {
    set ::htext::updates($w) $rate
}

proc ::htext::init {w} {
  set cyan "\#007000"
  set maroon "\#990000"
  set green "darkgreen"

  set ::htext::updates($w) 100
  $w tag configure black -foreground black
  $w tag configure white -foreground white
  $w tag configure red -foreground red
  $w tag configure blue -foreground blue
  $w tag configure darkblue -foreground darkBlue
  $w tag configure green -foreground $green
  $w tag configure cyan -foreground $cyan
  $w tag configure yellow -foreground yellow
  $w tag configure maroon -foreground $maroon
  $w tag configure gray -foreground gray20

  $w tag configure bgBlack -background black
  $w tag configure bgWhite -background white
  $w tag configure bgRed -background red
  $w tag configure bgBlue -background blue
  $w tag configure bgLightBlue -background lightBlue
  $w tag configure bgGreen -background $green
  $w tag configure bgCyan -background $cyan
  $w tag configure bgYellow -background yellow

  $w tag configure tab -lmargin2 50
  $w tag configure li -lmargin2 50
  $w tag configure center -justify center

  if {[$w cget -font] == "font_Small"} {
    $w tag configure b -font font_SmallBold
    $w tag configure i -font font_SmallItalic
  } else {
    $w tag configure b -font font_Bold
    $w tag configure i -font font_Italic
  }
  $w tag configure bi -font font_BoldItalic
  $w tag configure tt -font font_Fixed
  $w tag configure u -underline 1
  $w tag configure h1 -font font_H1 -foreground $::htext::headingColor \
    -justify center
  $w tag configure h2 -font font_H2 -foreground $::htext::headingColor
  $w tag configure h3 -font font_H3 -foreground $::htext::headingColor
  $w tag configure h4 -font font_H4 -foreground $::htext::headingColor
  $w tag configure h5 -font font_H5 -foreground $::htext::headingColor
  $w tag configure footer -font font_Small -justify center

  $w tag configure term -font font_BoldItalic -foreground $::htext::headingColor
  $w tag configure menu -font font_Bold -foreground $cyan

  # PGN-window-specific tags:
  $w tag configure tag -foreground $::pgnColor(Header)
  $w tag configure nag -foreground $::pgnColor(Nag)
  $w tag configure var -foreground $::pgnColor(Var)
  $w tag configure ip1 -lmargin1 25 -lmargin2 25
  $w tag configure ip2 -lmargin1 50 -lmargin2 50
}

proc ::htext::isStartTag {tagName} {
  return [expr ![strIsPrefix "/" $tagName]]
}

proc ::htext::isEndTag {tagName} {
  return [strIsPrefix "/" $tagName]
}

proc ::htext::isLinkTag {tagName} {
  return [strIsPrefix "a " $tagName]
}

proc ::htext::extractLinkName {tagName} {
  if {[::htext::isLinkTag $tagName]} {
    return [lindex [split [string range $tagName 2 end] " "] 0]
  }
  return ""
}

proc ::htext::extractSectionName {tagName} {
  if {[::htext::isLinkTag $tagName]} {
    return [lindex [split [string range $tagName 2 end] " "] 1]
  }
  return ""
}

set ::htext::interrupt 0

proc ::htext::display {w helptext {section ""} {fixed 1}} {
  global helpWin
  set helpWin(Indent) 0
  set ::htext::interrupt 0
  $w mark set insert 0.0
  $w configure -state normal
  set linkName ""

  set count 0
  set str $helptext
  if {$fixed} {
    regsub -all "\n\n" $str "<p>" str
    regsub -all "\n" $str " " str
  } else {
    regsub -all "\[ \n\]+" $str " " str
    regsub -all ">\[ \n\]+" $str "> " str
    regsub -all "\[ \n\]+<" $str " <" str
  }
  set tagType ""
  set seePoint ""

  if {! [info exists ::htext::updates($w)]} {
    set ::htext::updates($w) 100
  }

  # Loop through the text finding the next formatting tag:

  while {1} {
    set startPos [string first "<" $str]
    if {$startPos < 0} { break }
    set endPos [string first ">" $str]
    if {$endPos < 1} { break }

    set tagName [string range $str [expr $startPos + 1] [expr $endPos - 1]]

    # Check if it is a starting tag (no "/" at the start):

    if {![strIsPrefix "/" $tagName]} {

      # Check if it is a link tag:
      if {[strIsPrefix "a " $tagName]} {
        set linkName [::htext::extractLinkName $tagName]
        set sectionName [::htext::extractSectionName $tagName]
        set linkTag "link ${linkName} ${sectionName}"
        set tagName "a"
        $w tag configure "$linkTag" -foreground blue -underline 1
        $w tag bind "$linkTag" <ButtonRelease-1> \
          "helpWindow $linkName $sectionName"
        $w tag bind $linkTag <Any-Enter> \
          "$w tag configure \"$linkTag\" -background yellow
           $w configure -cursor hand2"
        $w tag bind $linkTag <Any-Leave> \
          "$w tag configure \"$linkTag\" -background {}
           $w configure -cursor {}"
      }

      # Check if it is a URL tag:
      if {[strIsPrefix "url " $tagName]} {
        set urlName [string range $tagName 4 end]
        set urlTag "url $urlName"
        set tagName "url"
        $w tag configure "$urlTag" -foreground red -underline 1
        $w tag bind "$urlTag" <ButtonRelease-1> "openURL {$urlName}"
        $w tag bind $urlTag <Any-Enter> \
          "$w tag configure \"$urlTag\" -background yellow
           $w configure -cursor hand2"
        $w tag bind $urlTag <Any-Leave> \
          "$w tag configure \"$urlTag\" -background {}
           $w configure -cursor {}"
      }

      # Check if it is a Tcl command tag:
      if {[strIsPrefix "run " $tagName]} {
        set runName [string range $tagName 4 end]
        set runTag "run $runName"
        set tagName "run"
        $w tag bind "$runTag" <ButtonRelease-1> "catch {$runName}"
        $w tag bind $runTag <Any-Enter> \
          "$w tag configure \"$runTag\" -foreground yellow
           $w tag configure \"$runTag\" -background darkBlue
           $w configure -cursor hand2"
        $w tag bind $runTag <Any-Leave> \
          "$w tag configure \"$runTag\" -foreground {}
           $w tag configure \"$runTag\" -background {}
           $w configure -cursor {}"
      }

      # Check if it is a goto tag:
      if {[strIsPrefix "go " $tagName]} {
        set goName [string range $tagName 3 end]
        set goTag "go $goName"
        set tagName "go"
        $w tag bind "$goTag" <ButtonRelease-1> \
          "catch {$w see \[lindex \[$w tag nextrange $goName 1.0\] 0\]}"
        $w tag bind $goTag <Any-Enter> \
          "$w tag configure \"$goTag\" -foreground yellow
           $w tag configure \"$goTag\" -background maroon
           $w configure -cursor hand2"
        $w tag bind $goTag <Any-Leave> \
          "$w tag configure \"$goTag\" -foreground {}
           $w tag configure \"$goTag\" -background {}
           $w configure -cursor {}"
      }

      # Check if it is a player info tag:
      if {[strIsPrefix "pi " $tagName]} {
        set playerTag $tagName
        set playerName [string range $playerTag 3 end]
        set tagName "pi"
        $w tag configure "$playerTag" -foreground darkBlue
        $w tag bind "$playerTag" <ButtonRelease-1> "playerInfo \"$playerName\""
        $w tag bind $playerTag <Any-Enter> \
          "$w tag configure \"$playerTag\" -foreground yellow
           $w tag configure \"$playerTag\" -background darkBlue
           $w configure -cursor hand2"
        $w tag bind $playerTag <Any-Leave> \
          "$w tag configure \"$playerTag\" -foreground darkBlue
           $w tag configure \"$playerTag\" -background {}
           $w configure -cursor {}"
      }

      # Check if it is a game-load tag:
      if {[strIsPrefix "g_" $tagName]} {
        set gameTag $tagName
        set tagName "g"
        set gnum [string range $gameTag 2 end]
        set glCommand "gameLoadMenu $w [sc_base current] $gnum %X %Y"
        $w tag bind $gameTag <ButtonPress-1> $glCommand
        $w tag bind $gameTag <ButtonPress-3> \
          "::gbrowser::new [sc_base current] $gnum"
        $w tag bind $gameTag <Any-Enter> \
          "$w tag configure $gameTag -foreground yellow
           $w tag configure $gameTag -background darkBlue
           $w configure -cursor hand2"
        $w tag bind $gameTag <Any-Leave> \
          "$w tag configure $gameTag -foreground {}
           $w tag configure $gameTag -background {}
           $w configure -cursor {}"
      }

      # Check if it is a move tag:
      if {[strIsPrefix "m_" $tagName]} {
        set moveTag $tagName
        set tagName "m"
        $w tag bind $moveTag <ButtonRelease-1> \
          "sc_move pgn [string range $moveTag 2 end]; updateBoard"
        $w tag bind $moveTag <Any-Enter> \
          "$w tag configure $moveTag -underline 1
           $w configure -cursor hand2"
        $w tag bind $moveTag <Any-Leave> \
          "$w tag configure $moveTag -underline 0
           $w configure -cursor {}"
      }

      # Check if it is a comment tag:
      if {[strIsPrefix "c_" $tagName]} {
        set commentTag $tagName
        set tagName "c"
        $w tag configure $commentTag -foreground $::pgnColor(Comment)
        $w tag bind $commentTag <ButtonRelease-1> \
          "sc_move pgn [string range $commentTag 2 end]; updateBoard; openCommentWin"
        $w tag bind $commentTag <Any-Enter> \
          "$w tag configure $commentTag -underline 1
           $w configure -cursor hand2"
        $w tag bind $commentTag <Any-Leave> \
          "$w tag configure $commentTag -underline 0
           $w configure -cursor {}"
      }

      if {$tagName == "h1"} {$w insert end "\n"}

    }

    # Now insert the text up to the formatting tag:
    $w insert end [string range $str 0 [expr $startPos - 1]]

    # Check if it is a name tag matching the section we want:
    if {$section != ""  &&  [strIsPrefix "name " $tagName]} {
      set sect [string range $tagName 5 end]
      if {$section == $sect} { set seePoint [$w index insert] }
    }

    if {[string index $tagName 0] == "/"} {
      # Get rid of initial "/" character:
      set tagName [string range $tagName 1 end]
      switch -- $tagName {
        h1 - h2 - h3 - h4 - h5  {$w insert end "\n"}
      }
      if {$tagName == "p"} {$w insert end "\n"}
      #if {$tagName == "h1"} {$w insert end "\n"}
      if {$tagName == "menu"} {$w insert end "\]"}
      if {$tagName == "ul"} {
        incr helpWin(Indent) -4
        $w insert end "\n"
      }
      if {[info exists startIndex($tagName)]} {
        switch -- $tagName {
          a {$w tag add $linkTag $startIndex($tagName) [$w index insert]}
          g  {$w tag add $gameTag $startIndex($tagName) [$w index insert]}
          c  {$w tag add $commentTag $startIndex($tagName) [$w index insert]}
          m  {$w tag add $moveTag $startIndex($tagName) [$w index insert]}
          pi {$w tag add $playerTag $startIndex($tagName) [$w index insert]}
          url {$w tag add $urlTag $startIndex($tagName) [$w index insert]}
          run {$w tag add $runTag $startIndex($tagName) [$w index insert]}
          go {$w tag add $goTag $startIndex($tagName) [$w index insert]}
          default {$w tag add $tagName $startIndex($tagName) [$w index insert]}
        }
        unset startIndex($tagName)
      }
    } else {
      switch -- $tagName {
        ul {incr helpWin(Indent) 4}
        li {
          $w insert end "\n"
          for {set space 0} {$space < $helpWin(Indent)} {incr space} {
            $w insert end " "
          }
        }
        p  {$w insert end "\n"}
        br {$w insert end "\n"}
        q  {$w insert end "\""}
        lt {$w insert end "<"}
        gt {$w insert end ">"}
        h2 - h3 - h4 - h5  {$w insert end "\n"}
      }
      #Set the start index for this type of tag:
      set startIndex($tagName) [$w index insert]
      if {$tagName == "menu"} {$w insert end "\["}
    }

    # Check if it is an image or button tag:
    if {[strIsPrefix "img " $tagName]} {
      set imgName [string range $tagName 4 end]
      set winName $w.$imgName
      while {[winfo exists $winName]} { append winName a }
      label $winName -image $imgName -relief flat -borderwidth 0
      $w window create end -window $winName
    }
    if {[strIsPrefix "button " $tagName]} {
      set imgName [string range $tagName 7 end]
      set winName $w.$imgName
      while {[winfo exists $winName]} { append winName a }
      button $winName -image $imgName
      $w window create end -window $winName
    }
    if {[strIsPrefix "window " $tagName]} {
      set winName [string range $tagName 7 end]
      $w window create end -window $winName
    }

    # Now eliminate the processed text from the string:
    set str [string range $str [expr $endPos + 1] end]
    incr count
    if {$count == $::htext::updates($w)} { update idletasks; set count 1 }
    if {$::htext::interrupt} {
      $w configure -state disabled
      return
    }
  }

  # Now add any remaining text:
  if {! $::htext::interrupt} { $w insert end $str }

  if {$seePoint != ""} { $w yview $seePoint }
  $w configure -state disabled
}


# openURL:
#    Sends a command to the user's web browser to view a webpage given
#    its URL.
#
proc openURL {url} {
  global windowsOS
  busyCursor .
  if {$windowsOS} {
    # On Windows, use the "start" command:
    if {[string match $::tcl_platform(os) "Windows NT"]} {
      catch {exec $::env(COMSPEC) /c start $url &}
    } else {
      catch {exec start $url &}
    }
    unbusyCursor .
    return
  }

  # On Unix systems, there is no standard for invoking favorite
  # web browser, so just try starting Mozilla or Netscape.

  # First, check if Mozilla seems to be available:
  if {[file executable /usr/bin/mozilla]  ||
      [file executable /usr/local/bin/mozilla]} {
    # First, try -remote mode:
    if {[catch {exec /bin/sh -c "mozilla -remote 'openURL($url)'"}]} {
      # Now try a new Mozilla process:
      catch {exec /bin/sh -c "mozilla '$url'" &}
    }
  } else {
    # OK, no Mozilla (poor user) so try Netscape (yuck):
    # First, try -remote mode to avoid starting a new netscape process:
    if {[catch {exec /bin/sh -c "netscape -raise -remote 'openURL($url)'"}]} {
      # Now just try starting a new netscape process:
      catch {exec /bin/sh -c "netscape '$url'" &}
    }
  }
  unbusyCursor .
}
### help.tcl: Help pages for Scid.

#################################################

set helpTitle(Index) "Index"
set helpText(Index) {<h1>Scid Help Index</h1>

<h4>Starting out and general help</h4>
<ul>
<li><a Guide><b>Quick Guide</b> to using Scid</a> <red>(Read this first)</red></li>
<li><a Hints><b>Hints</b> for getting more out of Scid</a></li>
<li><a MainWindow>The Scid <b>main window</b></a></li>
<li><a Menus>Scid <b>menus</b></a> <red>(updated!)</red></li>
<li><a Moves>Entering <b>chess moves</b></a></li>
<li><a Searches><b>Searches</b> in Scid</a></li>
<li><a Clipbase>Using the <b>Clipbase</b> database</a></li>
</ul>

<h4>Other Scid windows</h4>
<ul>
<li><a Analysis><b>Analysis</b> window</a> <red>(updated!)</red></li>
<li><a Comment><b>Comment editor</b> window</a> <red>(updated!)</red></li>
<li><a Crosstable><b>Crosstable</b> window</a></li>
<li><a Switcher><b>Database Switcher</b> window</a></li>
<li><a Email><b>Email</b> chess manager window</a></li>
<li><a Finder><b>File Finder</b> window</a></li>
<li><a GameList><b>Game List</b> window</a> <red>(updated!)</red></li>
<li><a Import><b>Import game</b> window</a></li>
<li><a OpReport><b>Opening Report</b> window</a> <red>(updated!)</red></li>
<li><a PGN><b>PGN</b> (game text) window</a></li>
<li><a PTracker><b>Piece Tracker</b></a> <red>(New!)</red></li>
<li><a PInfo><b>Player Info</b> window</a></li>
<li><a Repertoire><b>Repertoire editor</b> window</a></li>
<li><a Tmt><b>Tournament Finder</b> window</a> <red>(updated!)</red></li>
<li><a Tree><b>Tree</b> window</a></li>
<li><a Graphs><b>Graph</b> windows</a> <red>(updated!)</red></li>
<li><a TB>Using <b>Tablebases</b> in Scid</a> <red>(updated!)</red></li>
</ul>

<h4>Other utilities and information</h4>
<ul>
<li><a Bookmarks><b>Bookmarks</b></a></li>
<li><a Cmdline>Command-line options</a></li>
<li><a Compact><b>Compacting</b> a database</a></li>
<li><a Maintenance><b>Database maintenance</b> tools</a></li>
<li><a ECO><b>ECO</b> openings classification</a></li>
<li><a EPD><b>EPD</b> files</a></li>
<li><a Export><b>Exporting</b> games to text files</a></li>
<li><a Flags>Game <b>Flags</b></a></li>
<li><a LaTeX>Using <b>LaTeX</b> with Scid</a></li>
<li><a Options><b>Options</b> and preferences</a></li>
<li><a Sorting><b>Sorting</b> a database</a></li>
<li><a Pgnscid><b>Pgnscid</b>: converting PGN files</a></li>
<li><a NAGs>Standard <b>NAG</b> annotation values</a></li>
<li><a Formats>Scid database <b>file formats</b></a></li>
<li><a Author>Contact information</a></li>
</ul>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}


####################
### Quick Guide help:

set helpTitle(Guide) "Quick Guide to using Scid"
set helpText(Guide) {<h1>Quick Guide to using Scid</h1>
<p>
Scid is a chess database application; with it you can browse
databases of chess games, edit games and <a Searches>search</a>
for games by various criteria.
</p>
<p>
Scid uses its own special three-file <a Formats>database format</a>
which is very compact and fast, but it can convert to and from
the standard PGN (Portable Game Notation) format.
Scids <a PGN>PGN window</a> displays the text of the current game in
PGN format.
</p>
<p>
You can use Scid to add chess games to a database, using the keyboard or
mouse to enter moves. See the help page on <a Moves>entering chess moves</a>
for more details.
</p>
<p>
You can also use Scid as a <a PGN>PGN</a> file browser, by pasting
PGN text into Scids <a Import>Import</a> window or by opening a PGN file
in Scid.
However, PGN files cannot be edited by Scid (it opens them read-only) and
they use more memory and are slower to load, so for large PGN files it
is recommended that you create a Scid database from them first with the
<a Pgnscid>pgnscid</a> utility.
</p>
<p>
The <a MainWindow>main window</a>
of Scid (with the graphical chess board) shows details of
the active game and database. At any time, you can have up to four
databases open (five including the <a Clipbase>clipbase</a>),
and each will have its own active game.
(A game numbered 0 indicates a scratch game that is not part of the
actual database).
You can switch between the open databases with the
<a Menus File>File menu</a>.
</p>
<p>
For more information, please read the other help pages listed in the
<a Index>Help Index</a>.
</p>
<p>
See the <a Author>contact information</a> page if you need to contact the
author of Scid.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}


####################
### Hints page:
set helpTitle(Hints) "Scid Hints"
set helpText(Hints) {<h1>Scid Hints</h1>
<p>
This page contains useful hints in question and answer format to help you
use Scid better. If you are new to Scid, please read the
<a Guide>quick guide</a> first.
Most of the information on this page is available in more detail on the
other help pages listed in the <a Index>index</a>.
If you think of a useful hint to add to this page, please send it
to the <a Author>author of Scid</a>.
</p>

<h4>Can I get Scid to load a database when it starts?</h4>
<p>
Yes, you can add databases, PGN files or <a EPD>EPD files</a>
to the command line. For example:
<ul>
<li> <b>scid  mybase  games.pgn.gz</b> </li>
</ul>
will load the Scid database <b>mybase</b> and also load the
Gzip-compressed PGN file <b>games.pgn.gz</b>.
</p>

<h4>Is there an easier way to change the board size than using the
options menu?</h4>
<p>
Yes, you can use the shortcut keys <b>Control+Shift+LeftArrow</b> and
<b>Control+Shift+RightArrow</b> to decrease or increase the board size.
</p>

<h4>I am training by playing through a game, so I do not want Scid to
print the next move in the game information area below the chessboard.
Can I hide it?</h4>
<p>
You can hide the next move by pressing the <b>right</b> mouse button in the
game information area, and selecting <b>Hide next move</b> from the
menu that appears.
</p>

<h4>How can I see the ECO opening code for the current position?</h4>
<p>
The ECO code is displayed on the bottom line of the game
information box, below the chessboard in the <a MainWindow>main window</a>,
if you have the ECO classification file (<b>scid.eco</b>) loaded. <br>
The <a ECO>ECO codes</a> help page explains how to load the ECO classification
file and save options so it will be loaded every time you start Scid.
</p>

<h4>I am entering a game, and I am up to move 30, but just saw that move
10 was wrong. How can I correct it and keep all the moves after it?</h4>
<p>
You can use the <a Import>Import</a> window; see the
<a Moves Mistakes>entering moves</a> help page for more information.
</p>

<h4>How do I copy games from one database to another?</h4>
<p>
Use the <a Switcher>database switcher window</a>: drag from the source
database to the target database to copy all games in the source database
<a Searches Filter>filter</a>.
</p>

<h4>Every time I enter a move where one already exists, I get a
"Replace move?" dialog box. How do I avoid that?</h4>
<p>
Turn it off with the <b>Ask before replacing moves</b> option in the
<menu>Options: Moves</menu> menu.
Or, get into the habit of taking back moves using the right-mouse button,
which actually removes the move from the game if you are at the last move of
the game.
</p>

<h4>How do I change column widths in the Game List window?</h4>
<p>
Click the left or right mouse button on each column title.
</p>

<h4>How can I use the tree window on a selection of games, not my whole
database?</h4>
<p>
Use the <a Clipbase>clipbase</a>. Set your database filter to contain the
games you want to use the tree on, then copy them to the clipbase using the
<a Switcher>database switcher</a>. Then, just open the tree window in the
clipbase.
</p>

<h4>The Tree is slow for large databases. How do I speed it up?</h4>
<p>
Save the Tree cache often, to save tree results for future use.
See the caching section of the <a Tree>Tree</a> help page for details.
</p>

<h4>How can I edit the PGN representation of the game directly?</h4>
<p>
You cannot use the <a PGN>PGN</a> window to edit the current game, but you can
still edit its PGN representation using the <a Import>Import game</a> window.
Just open it (shortcut key: <b>Control+Shift+I</b>) and then press the
<b>Paste current game</b> button, then edit the game, then press <b>Import</b>.
</p>

<h4>My database has several spellings for some player names. How do I
correct them all?</h4>
<p>
You can edit individual names or spellcheck all the names in a database
with the commands in the <menu>File: Maintenance</menu> menu.
See the <a Maintenance Editing>maintenance</a> page.
</p>

<h4>I have two databases open: one with my own games, and a large database of
grandmaster games. How do I compare one of my games to those in the large
database?</h4>
<p>
In the large database, open the <a Tree>tree window</a> and press the
<term>Lock</term> button to lock the tree to that database. Then switch
to the other database, and the tree will continue to show data for the
large database.
</p>

<p><footer>(Updated: Scid 2.6, August 2001)</footer></p>
}


####################
### Main window help:

set helpTitle(MainWindow) "Scid main window"
set helpText(MainWindow) {<h1>Scid main window</h1>
<p>
The main window in Scid displays the current board position of the
active game and information about the current game and database.
Separate help pages describe the <a Menus>menus</a> and ways to
<a Moves>enter chess moves</a>.
</p>

<h3>Game navigation buttons</h3>
<p>
The navigation buttons above the board have the following meanings, from
left to right:
<ul>
<li> <button tb_start> Move to the start of the game. </li>
<li> <button tb_prev> Move back one move. </li>
<li> <button tb_next> Move forward one move. </li>
<li> <button tb_end> Move to the end of the game. </li>
<li> <button tb_invar> Move into a variation. </li>
<li> <button tb_outvar> Move out of the current variation. </li>
<li> <button tb_addvar> Add a new variation. </li>
<li> <button autoplay_off> Start/stop autoplay mode (see below). </li>
<li> <button tb_trial> Start/stop <a Moves Trial>trial mode</a>. </li>
<li> <button tb_flip> Rotate the board 180 degrees. </li>
<li> <button tb_coords> Show/hide board coordinates. </li>
</ul>

<h4><name Autoplay>Autoplay mode</name></h4>
<p>
In autoplay mode, Scid automatically plays the moves in the current game,
moving forward until the end of the game. The time delay between moves can
be set from the <menu>Options: Moves</menu> menu, and is saved to your
options file when you save options.
</p>
<p>
The shortcut key <b>Control+Z</b> starts or stops autoplay mode, and
you can also exit autoplay mode by pressing the <b>Escape</b> key.
</p>
<p>
If you start autoplay mode when the <a Analysis>analysis window</a> is open,
the game is <term>annotated</term>: the score and analysis for each position
are added to the game as a new variation just before each move is made.
See the <a Analysis>analysis window</a> help page for details.
</p>

<h3>The game information area</h3>
<p>
The area below the chessboard showing information about the game is called
the <term>game information area</term>.
Its first three lines show information such as the players, result,
date, and site.
The fourth line indicates the current position in the game, and what the
next move is.
</p>
<p>
The fifth line shows the <a ECO>ECO</a> (Encyclopedia of Chess
Openings) code for the current position, if the position appears in
the ECO file being used.
</p>
<p>
The game information area has a menu activated with the right mouse button,
with options to hide the next move (useful if you are training using a game
and want to guess each move) and to delete or undelete the current game.
You can also activate this menu without using the mouse, by pressing the
<b>[F9]</b> function key.
</p>

<h4>Tablebases</h4>
<p>
The game information area also displays tablebase results whenever the
displayed position reaches a material configuration found in a
tablebase file. See the <a TB>tablebases</a> help page for details.
</p>

<h3>The status bar</h3>
<p>
The status bar shows information about the current database.
The first field indicates the game status: <b>XX</b> means it has been
altered and not yet saved, while <b>--</b> means it is unchanged,
and <b>%%</b> indicates the database is read-only (not alterable).
</p>
<p>
If you want a database to be opened read-only, just set the permissions
of its Scid files, or at least its index file, for example:
<b>chmod a-w myfile.si3</b>
as a shell command, and it will be opened read-only by Scid.
</p>
<p>
The status bar also shows how many games are currently in the
<a Searches Filter>filter</a>.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}


####################
### Menus help screen:

set helpTitle(Menus) "Menus"
set helpText(Menus) {<h1>Scid menus</h1>

<h3><name File>File</name></h3>
<ul>
<li><menu>New</menu>: Creates a new empty Scid database.</li>
<li><menu>Open</menu>: Opens an existing Scid database.</li>
<li><menu>Close</menu>: Closes the current Scid database.</li>
<li><menu>Finder</menu>: Opens the <a Finder>File Finder</a>.</li>
<li><menu>Bookmarks</menu>: <a Bookmarks>Bookmarks</a> and bookmark
    functions.</li>
<li><menu>Maintenance</menu>: Database <a Maintenance>maintenance</a>
functions.</li>
<ul>
  <li><menu>Maintenance window</menu>: Opens/closes the database maintenance
      window.</li>
  <li><menu>Delete twin games</menu>: Finds <a Maintenance Twins>twin</a>
      games in the database.</li>
  <li><menu>ECO-Classify games</menu>: Recomputes the
      <a ECO>ECO code</a> for all games in the database. </li>
  <li><menu>Name editor</menu>: Replaces all occurrences of a player,
      event site or round name.</li>
</ul>
<li><menu>Read-Only</menu>: Makes the current database read-only.</li>
<li><menu>Base 1/2/3/4/5</menu>: These commands let you switch between
    the four available database slots and the <a Clipbase>clipbase</a>
    database.</li>
<li><menu>Exit</menu>: Exits Scid. </li>
</ul>

<h3>Edit</h3>
<ul>
<li><menu>Add Variation</menu>: Adds a new empty variation for the
    next move, or for the previous move if there is no next move yet.</li>
<li><menu>Delete Variation</menu>: Provides a submenu of variations for
    the current move, so one can be deleted.</li>
<li><menu>Make First Variation</menu>: Promotes a variation to be the
    first variation of the current move.</li>
<li><menu>Promote Variation to Main line</menu>: Promotes a variation
    to be the main line, swapping it with its parent.</li>
<li><menu>Try Variation</menu>: Enters <a Moves Trial>trial mode</a> for
    testing a temporary variation without altering the current game.</li>
<li><menu>Strip</menu>: Strips all comments or variations from the current
    game.</li>
<br>
<li><menu>Empty Clipbase</menu>: Empties the <a Clipbase>clipbase</a>
    so it contains no games.</li>
<li><menu>Copy this game to clipbase</menu>: Copies the current game
    to the <a Clipbase>clipbase</a> database.</li>
<li><menu>Paste last clipbase game</menu>: Pastes the active game of
    the <a Clipbase>clipbase</a> to be the active game of the current
    database.</li>
<br>
<li><menu>Setup start board</menu>: Sets the starting position for the
    current game.</li>
<li><menu>Paste start board</menu>: Sets the start board from the current
    text selection (clipboard).</li>
</ul>

<h3>Game</h3>
<ul>
<li><menu>New Game</menu>: Resets the active game to an empty state,
    discarding any unsaved changes.</li>
<li><menu>Load First/Previous/Next/Last Game</menu>: These load the first,
    previous, next or last game in the <a Searches Filter>filter</a>.</li>
<li><menu>Reload this game</menu>: Reloads the current game, discarding
    any changes made.</li>
<li><menu>Load Game Number</menu>: Loads the game given its game number
    in the current database.</li>
<br>
<li><menu>Save: Replace game</menu>: Saves the current game, replacing
    its original version in the database.</li>
<li><menu>Save: Add new game</menu>: Saves the current game as a new
    game, appending to the end of the database.</li>
<br>
<li><menu>Identify opening</menu>: Finds the deepest
    position in the current game that is in the ECO file.</li>
<li><menu>Goto move number</menu>: Goes to the specified move number in
    the current game.</li>
<li><menu>Find novelty</menu>: Finds the first move of the current game
    that has not been played before.</li>
</ul>

<h3>Search</h3>
<ul>
<li><menu>Reset Filter</menu>: Resets the <a Searches Filter>filter</a>
so all games are included.</li>
<li><menu>Negate filter</menu>: Inverts the filter to only include
games that were excluded.</li>
<br>
<li><menu>Current board</menu>: Searches for the
<a Searches Board>current board</a> position.</li>
<li><menu>Header</menu>: Searches by <a Searches Header>header</a>
information such as player names.</li>
<li><menu>Material/Pattern</menu>: Searches by
<a Searches Material>material</a> or chessboard patterns</a>.</li>
<br>
<li><menu>Using search file</menu>: Searches using
<a Searches Settings>settings</a> from a SearchOptions file.</li>
</ul>

<h3>Windows</h3>
<ul>
<li><menu>Comment Editor</menu>: Opens/closes the
    <a Comment>Comment Editor</a> window.</li>
<li><menu>Game List window</menu>: Opens/closes the
    <a GameList>Game List window</a>.</li>
<li><menu>PGN window</menu>: Opens/closes the
    <a PGN>PGN window</a>.</li>
<li><menu>Tournament Finder</menu>: Opens/closes the
    <a Tmt>Tournament Finder</a> window.</li>
<br>
<li><menu>Database switcher</menu>: Opens/closes the
    <a Switcher>Database Switcher</a> window, which lets you switch to
    another database or copy games between databases easily.</li>
<li><menu>Maintenance window</menu>: Opens/closes the database
    <a Maintenance>maintenance</a> window.</li>
<br>
<li><menu>ECO Browser</menu>: Opens/closes the
    <a ECO browser>ECO Browser</a> window.</li>
<li><menu>Repertoire editor</menu>: Opens/closes the
    <a Repertoire>repertoire editor</a>.</li>
<li><menu>Statistics window</menu>: Opens/closes the
    <term>Filter statistics window</term> which gives a win/loss summary
    of the games in the <a Searches Filter>filter.</a></li>
<li><menu>Tree window</menu>: Opens/closes the <a Tree>tree window</a>.</li>
<li><menu>Endgame Tablebase window</menu>: Opens/closes the window that
    displays <a TB>tablebase</a> information.</li>
</ul>

<h3>Tools</h3>
<ul>
<li><menu>Analysis engine</menu>: Starts/stops the chess analysis
    engine, displaying the evaluation of the current position
    in the <a Analysis>analysis window</a>.</li>
<li><menu>Analysis engine #2</menu>: Starts/stops a second analysis
    engine.</li>
<li><menu>Crosstable</menu>: Constructs a tournament
    <a Crosstable>crosstable</a> for the current game. </li>
<li><menu>Email manager</menu>: Opens/closes the <a Email>email manager</a>
    window, for managing email correspondence games.</li>
<br>
<li><menu>Opening report</menu>: Generates an <a OpReport>opening report</a>
    for the current position.</li>
<li><menu>Piece Tracker</menu>: Opens the <a PTracker>piece tracker</a>
    window.</li>
<br>
<li><menu>Player information</menu>: Displays <a PInfo>player information</a>
    for one of the two players of the current game.</li>
<li><menu>Rating graph</menu>: Displays the
    <a Graphs Rating>rating graph</a>.</li>
<li><menu>Score graph</menu>: Displays the
    <a Graphs Score>score graph</a>.</li>
<br>
<li><menu>Export current game</menu>: Saves the current game to a text
    file in PGN, HTML or LaTeX format. See the <a Export>export</a> help
    page.</li>
<li><menu>Export all filter games</menu>: Saves all games in the
    search <a Searches Filter>filter</a> to a text file in PGN, HTML or
    LaTeX format. See the <a Export>export</a> help page.</li>
<br>
<li><menu>Import PGN game</menu>: Opens the <a Import>Import window</a>
    for entering a game by typing or pasting its text in
    <a PGN>PGN format</a>.</li>
<li><menu>Import file of PGN games</menu>: Imports a whole file containing
    games in PGN format to the current database.</li>
</ul>

<h3>Options</h3>
<p>
This menu provides entries for setting most of Scid's configurable
options.
The <menu>Save options</menu> entry saves the current options to the
file "<b>~/.scid/scidrc</b>" (or <b>scid.opt</b> in the
directory of the Scid executable programs for Windows users);
this file is loaded each time you start up Scid.
</p>

<h3>Help</h3>
<p>
This menu contains help functions, and access to the tip of the day
window or the startup window which provides information about the
files Scid loaded when it started.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}


####################
### Entering moves help:

set helpTitle(Moves) "Entering moves"
set helpText(Moves) {<h1>Entering chess moves</h1>
<p>
In Scid, you can enter the moves for a game using the
mouse or the keyboard. As you move the mouse over a square,
it and one other square will change color if there is a legal
move to or from that square. This is the <term>suggested move</term>.
To make this move simply click the <term>left</term> mouse button.
You can turn off move suggestion using the Options menu if it annoys you.
</p>
<p>
To make any move other than the suggested move, you can use
the <term>left</term> mouse button: just press the button over one square,
and release it over the other square.
</p>
<p>
If you prefer to make moves with two mouse clicks instead of dragging with
the mouse button pressed, you can use the <term>middle</term> button: just
click on one square then the other.
</p>

<h4>Retracting a move</h4>
<p>
To take back a move, click the right mouse button. This goes back one move,
and deletes the move if it is the last in the game or variation.
</p>

<h4>Replacing old moves</h4>
<p>
When you enter a move at a point in the game where a move already exists,
Scid will present a dialog box asking if you really want to replace the
old move (the old move and all moves after it will be lost), or want
to add the new move as a variation instead. Some people may find this
dialog box annoying and always want to replace old moves, so it can be
turned off with the <menu>Options: Moves</menu> menu option
"<i>Ask before replacing moves</i>".
</p>

<h4><name Trial>Trial mode</name></h4>
<p>
If you are studying a game and reach a position where you want to try
an alternative variation on the board without altering the game, select
<b>Try variation</b> from the <menu>Edit</menu> menu to enter trial
mode. In this mode, you can make temporary moves and changes to the
game, then return to the original position when you exit trial mode.
</p>

<h3><name Mistakes>Correcting mistakes</name></h3>
<p>
If you are entering a game and suddenly see an incorrect move several
moves earlier, it is possible to correct it without losing the extra
moves you have added. The only way is to edit the PGN representation
of the game: open the <a Import>Import</a> window, select "Paste current
game", correct the incorrect move, then select "Import".
</p>

<h3>Keyboard move entry</h3>
<p>
To enter moves at the keyboard, simply press letter and digit
keys. Note that accepted moves should be in <term>SAN notation</term>,
<i>without</i> the capture symbol (x) or the promotion symbol (=).
Moves are matched case-insensitively, so you can type
[n][f][3] instead of Nf3, for example -- but see the note below
about conflicts with pawn moves.
</p>
<p>
To ensure that no move is a prefix of any other move, the notation
for kingside and queenside castling is [O][K] and
[O][Q] respectively, instead of the usual O-O and O-O-O.
</p>
<p>
As you enter a move, the status bar will show the list of matching moves.
You can press the [space] bar at any time to choose the first
matching move in the list and add it to the game.
To delete a character, press [Backspace] or [Delete].
</p>
<p>
<b>Note</b> that a lower-case letter matches to a pawn first, so a
[b] can match to a pawn or Bishop, but if there is a conflict
you must use a capital [B] for the Bishop move.
</p>

<h4>Auto-Completion</h4>
<p>
In the Options menu, you can turn on or off <term>Auto-Completion</term>
of moves.
With auto-completion, a move is made as soon as you have typed enough
to distinguish it from any other legal move. For example, with
auto-completion, you would only need to type [n][f] instead
of [n][f][3] for <b>Nf3</b> in the starting position.
</p>

<h4>Entering common annotation symbols</h4>
<p>
You can also add common <a NAGs>annotation symbols</a> using the keyboard
in the main window, without needing to use the <a Comment>comment editor</a>
window. The following list shows which symbols you can add, and their
keyboard shortcuts:
<ul>
<li> !	: [!][Return] </li>
<li> ?	: [?][Return] </li>
<li> !?	: [!][?][Return] </li>
<li> ?!	: [?][!][Return] </li>
<li> !!	: [!][!][Return] </li>
<li> ??	: [?][?][Return] </li>
<li> </li>
<li> +-	: [+][-] </li>
<li> +/-	: [+][/] </li>
<li> +=	: [+][=] </li>
<li> =	: [=][Return] </li>
<li> -+	: [-][+] </li>
<li> -/+	: [-][/] </li>
<li> =+	: [=][+] </li>
</ul>

<p><footer>(Updated: Scid 2.6, August 2001)</footer></p>
}


########################################
### Searches help screen:

set helpTitle(Searches) "Searches"
set helpText(Searches) {<h1>Searches in Scid</h1>
<p>
Scid can perform many different types of search on a database.
The three main types of search are:
<ul>
<li><b>1)</b> for the current board, </li>
<li><b>2)</b> for specified material and piece patterns, and </li>
<li><b>3)</b> by header information such as players, result, date. </li>
</ul>
<p>
In addition to these, there is also an automatic search mode called the
<a Tree>Tree window</a> which is explained separately.
</p>

<h3><name Filter>The Search Filter</name></h3>
<p>
Searches in Scid are based on the concept of a <term>filter</term>.
The filter represents a subset of the current database; at any time,
each game is either included in or excluded from the filter.
</p>
<p>
With each type of search, you can choose to restrict the existing
filter, add to it, or ignore it and search the whole database.
This choice permits complex searches to be built up incrementally.
</p>
<p>
You can also copy all games in the filter of one database to another,
using the <a Switcher>database switcher</a> window.
</p>
<p>
With exact position, <a Tree>tree</a> or material/pattern searches, the
move number of the first matching position of each matching game is
remembered, so when you load each game it will show the matching position
automatically.
</p>
<p>
<b>Note</b> that searches only apply to the main line moves of a game,
not to any moves in variations.
</p>

<h3><name Board>Search: Current Board</name></h3>
<p>
This search finds games that contain the current displayed position,
ignoring castling and <i>en passant</i> rights.
</p>
<p>
There are four board search types available. All four require a position
to have the same exact material and side to move for a match.
The types are:
<ul>
<li> [1] exact (the two positions must match on every square), </li>
<li> [2] pawns (the pawn structure must match exactly, but other pieces
     can be anywhere), </li>
<li> [3] files (the number of white and black pawns on each file must match
     exactly, but other pieces can be anywhere), and </li>
<li> [4] material (pawns and pieces can be anywhere). </li>
</ul>
<p>
The pawns search is useful for studying openings by pawn structure, and
the files and material searches are useful for finding similar positions
in an endgame.
</p>
<p>
To search for an arbitrary position, you can set the position first
(from the <menu>Edit: Setup Start Board</menu> menu) and then
start the search.
</p>
<p>
You can request that the search look in variations (instead of only
examining actual game moves) by selecting the <b>Look in variations</b>
checkbox, but this may make the search much slower if your database
is large and has many games with variations.
</p>

<h3><name Material>Search: Material/Pattern</name></h3>
<p>
This search is useful for finding endgame or middlegame themes.
You can specify minimum and maximum amounts of each type of material,
and find patterns such as a Bishop on f7, or a pawn on the f-file.
</p>
<p>
A number of common material and pattern settings are provided, such
as Rook vs. Pawn endings, or isolated Queens pawns.
</p>
<p>
<b>Hints:</b><br>
The speed of pattern searches can vary widely. You can reduce the time
needed for a search by setting restrictions intelligently. For example,
if you set the minimum move number to 20 for an ending, all games that
end in under 20 moves can be skipped.
</p>

<h3><name Header>Search: Header</name></h3>
<p>
This search can be used to find aspects of the game that are
stored in the header (such as date, result, names, flags and ratings),
so it does not require any moves to be decoded.
</p>
<p>
For a game to match a Header search, <b>all</b> fields that you
specify must match.
</p>
<p>
The name fields (White, Black, Event, Site and Round) match on any text
inside the name, case-insensitive and ignoring spaces.
</p>
<p>
You can do case-sensitive wildcard searches for the White, Black, Event,
Site and Round fields (with <b>?</b> representing one character and
<b>*</b> representing zero or more characters) by putting the
search text in double quotes. For example a search for the site <b>USA</b>
will find American cities and also <b>Lausanne SUI</b>, which is probably
not what you wanted! A search for the site <b>"*USA"</b> (remember to
use the double-quotes) will only match cities in the United States.
</p>
<p>
If you are searching for a particular player (or pair of opponents) as White
or Black and it does not matter what color they played, select the
<b>Ignore Colors</b> option.
</p>
<p>
Finally, the Header search can be used to find any text (case-sensitive
and without wildcards) in the PGN representation of each game.
You may enter up to three text phrases, and they must all appear in a
game for it to be a match.
This search is very useful for searching in the comments or extra tags of
a game (such as <b>lost on time</b> or <b>Annotator</b>),
or for a move sequence like <b>Bxh7+</b> and <b>Kxh7</b> for a bishop
sacrifice on h7 that was accepted.
However, this type of search can be <i>very</i> slow since all the games that
match other criteria must be decoded and scanned for the text phrases.
So it is a good idea to limit these searches as much as possible.
Here are some examples.
To find games with under-promotions to a rook,
search for <b>=R</b> and also set the <b>Promotions</b> flag to Yes.
When searching for text that would appear in comments, set
the <b>Comments</b> flag to Yes.
If you are searching for the moves <b>Bxh7+</b> and <b>Kxh7</b>, you
may want to restrict the search to games with a 1-0 result and at least 40
half-moves, for example, or do a material/pattern search first to find
games where a white bishop moves to h7.
</p>

<h3><name Settings>Saving search settings</name></h3>
<p>
The Material/Pattern and Header search windows provide a
<term>Save settings</term> button. This lets you save the current
search settings for later use, to a <term>SearchOptions</term> file
(suffix .sso).
To search using a previously saved SearchOptions (.sso) file, select
<menu>Open</menu> from the <menu>Search</menu> menu.
</p>

<h3>Search times and skipped games</h3>
<p>
Most searches produce a message indicating the time taken and the number
of games that were <term>skipped</term>. A skipped game is one that can
be excluded from the search without decoding any of its moves, based on
information stored in the index. See the help page on
<a Formats>file formats</a> for more information.
</p>

<p><footer>(Updated: Scid 3.0, November 2001)</footer></p>
}


#################
### Clipbase help:

set helpTitle(Clipbase) "The Clipbase"
set helpText(Clipbase) {<h1>The Clipbase database</h1>
<p>
In addition to the databases you have open, Scid provides
a <term>clipbase</term> database, which is just like any other database
except that it exists in memory only and has no files for permanent storage.
</p>
<p>
The clipbase is useful as a temporary database, for merging
the results of searches on more than one database or for treating the
results of a search as a separate database.
</p>
<p>
For example, assume you want to prepare for an opponent and have searched
a database so the <a Searches Filter>filter</a> contains only games where
the opponent played White.
You can copy these games to the clipbase (by dragging from their database
to the clipbase in the <a Switcher>database switcher</a> window),
switch to the clipbase database, and then open
the <a Tree>Tree window</a> to examine that players repertoire.
</p>
<p>
Note that you can copy games in the filter of one database directly to another
opened database (without needing the clipbase as an intermediary
location) using the <a Switcher>database switcher</a> window.
</p>
<p>
Note that the clipbase <i>cannot</i> be closed; selecting the
<menu>File: Close</menu> command while in the clipbase is equivalent
to <menu>Edit: Reset Clipbase</menu> which empties the clipbase.
</p>
<p>
The clipbase has a limit of 20,000 games at any time, since it exists in
memory only.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}


###############################
### Comment editor window help:

set helpTitle(Comment) "Comment Editor window"
set helpText(Comment) {<h1>The Comment Editor window</h1>
<p>
The Comment Editor window lets you add or edit comments and symbolic
annotation symbols for moves in the active chess game.
</p>

<h3>Annotation symbols</h3>
<p>
Scid uses the <a Author Related>PGN standard</a>
for annotation symbols, accepting
<a NAGs>NAG (numeric annotation glyph)</a> values for annotations.
Some of the most common symbols (such as "!" or "+-") are displayed
as symbols, and have a button in the comment editor window for fast
entry. For other symbols, you can enter the appropriate
numeric NAG value which is a number from 1 to 255.
For example, the NAG value 36 means "White has the initiative" and will
be displayed as "$36" in the <a PGN>PGN text</a> of the game.
</p>
<p>
See the help page of <a NAGs>NAG values</a> for NAG values defined
by the PGN standard.
</p>
<p>
<b>Hint:</b> You can add the common move evaluation symbols (!, ?, !!,
??, !? and ?!) while in the main window, without needing
to use the comment editor window, by typing the symbol followed by
the [Return] key.
This is especially useful if you are <a Moves>entering chess moves</a>
using the keyboard.
</p>

<h3>Comments</h3>
<p>
You can edit comments by typing in the text area provided and using
the Clear, Revert and Store buttons.
You do not need to press the Store button to update a comment; it is
automatically updated whenever you move to another position in the game.
</p>

<h3>Coloring squares</h3>
<p>
You can color any square with any color using a special embedded command
which can appear anywhere in a comment. The command format is:
</p>
<ul>
<li><b>[%mark square color]</b><li>
</ul>
<p>
where <b>square</b> is a square name like d4 and <b>color</b> is any
recognized color name (such as red, blue4, darkGreen, lightSteelBlue, etc)
or RGB code (a <b>#</b> followed by six hexadecimal digits, such as #a0b0c8).
If the color is omitted, it defaults to <red>red</red>.
</p>
<p>
A comment may contain any number of color commands, but each must have
in its own <b>[%mark ...]</b> tag.
For example, the comment text</p>
<p>
  Now d6 [%mark d6] is weak and the knight can attack it
  from b5. [%mark b5 #000070]
</p>
<p>
will color d6 <red>red</red> and b5 with the dark-blue color
<darkblue>#000070</darkblue>.
</p>

<h3>Drawing arrows</h3>
<p>
You can draw an arrow from one square to another using a special
comment command similar to the for coloring squares described above.
The format is:
</p>
<ul>
<li><b>[%arrow fromSquare toSquare color]</b><li>
</ul>
<p>
where <b>fromSquare</b> and <b>toSquare</b> are square names like d4
and <b>color</b> is any recognized color name (such as red, blue4, etc)
or RGB code (like #a0b0c0).
If the color is omitted, it defaults to <red>red</red>.
</p>
<p>
For example, the comment text
</p>
<p>
  The c3-knight and c4-bishop control the weak d5 square.
  [%arrow c3 d5 red] [%arrow c4 d5 blue]
</p>
<p>
will draw a red arrow from c3 to d5 and a blue one from c4 to d5.
</p>

<p><footer>(Updated: Scid 3.2, February 2002)</footer></p>
}

####################
### Crosstable window help:

set helpTitle(Crosstable) "Crosstable window"
set helpText(Crosstable) {<h1>The Crosstable window</h1>
<p>
The crosstable window shows the tournament crosstable for the
current game. Each time you refresh the crosstable window (by
pressing its Refresh button, by pressing the <b>Return</b> key in the
crosstable window, or by typing <b>Control+Shift+X</b> in the
<a MainWindow>main</a> or <a GameList>game list</a> windows), Scid
searches for all games in the same tournament as the current game.
</p>
<p>
Any game played up to <b>three months before or after</b> the current game,
with the <b>exact same Event and Site tags</b>, is considered to be in
the tournament.
</p>
<p>
A single left-mouse button click on any result in the crosstable
loads the corresponding game.
You can add all the games in the tournament to the
<a Searches Filter>filter</a>
with the <b>Add to filter</b> button in the crosstable window.
</p>

<h4>Crosstable window menus</h4>
<p>
The <menu>File</menu> menu lets you print the current table to a file
in plain text, LaTeX or HTML table format.
</p>
<p>
The <menu>Display</menu> menu allows you to choose the table format:
<b>All-play-all</b>, <b>Swiss</b> or <b>Knockout</b> or <b>Auto</b>.
</p>
<p>
The all-play-all format (for round-robin-type events) has a limit of 30
players, but the Swiss format (for tournaments with many players) can
display up to 200 players and up to 20 rounds. <b>Auto</b>, which chooses
the best format automatically for each tournament, is the default.
</p>
<p>
Note that Scid uses the <b>Round</b> tag of each game to produce a Swiss
crosstable, so you will not see any games in the Swiss table for a tournament
if its games do not have numeric round values: 1, 2, 3, etc.
</p>
<p>
The Display menu also lets you customize the data presented to
include or exclude ratings, countries and player titles. You can also
choose whether color allocations in Swiss tables are displayed.
</p>
<p>
The <b>Separate score groups</b> option only affects the layout of the table
when the players are sorted by score: it causes a blank line to be inserted
between each group of players with the same score.
</p>
<p>
The <menu>Sort</menu> menu allows you to sort the players by name, rating
or score; by score is the default.
</p>
<p>
The <menu>Color</menu> menu lets you turn color (hypertext) display on or off.
Since it can take a long time to format and display large crosstables in
hypertext, selecting <b>Plain text</b> for large events will save a
lot of time.
However, in plain text mode you cannot click on players or games.
</p>

<h4>Duplicate games in crosstables</h4>
<p>
To get good results with the crosstable, you should mark duplicate games
for deletion and your games should have consistent spelling of player,
site and event names.
See the <a Maintenance>database maintenance</a> page for help on
deleting duplicate games and editing (or spellchecking)
player/event/site names.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}


####################
### Database switcher help:

set helpTitle(Switcher) "Database Switcher"
set helpText(Switcher) {<h1>The Database Switcher window</h1>
<p>
The Database Switcher window provides a view which makes it easy to
switch between databases or copy games between databases.
The name, <a Searches Filter>filter</a> state and graphic type icon
of each database is displayed, and the active database is highlighted
with a yellow background.
</p>
<p>
You can open the database switcher window from the <menu>Windows</menu> menu,
or by its shortcut key: <b>Control+D</b>.
</p>
<p>
To copy all the filtered games in one database to another, drag with the
left mouse button from the source base to the target base. You will then
see a confirmation dialog (if the target database is not the
<a Clipbase>clipbase</a>) if the games can be copied, or an error message
if the games cannot be copied (for example, if a selected database is not
open).
</p>
<p>
Pressing right mouse button over a database produces a popup menu applying
to that database, from which you can change the database type icon or
reset its <a Searches Filter>filter</a>. You can also use this menu to
change the orientation of the window (to arrange the database slots
vertically or horizontally) which is useful for smaller screens.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}


####################
### File Finder window help:

set helpTitle(Finder) "File Finder window"
set helpText(Finder) {<h1>The File Finder window</h1>
<p>
The <term>File Finder</term> helps you find files of any type you can
use in Scid: databases, <a PGN>PGN</a> files, <a EPD>EPD</a> files,
and <a Repertoire>repertoire</a> files.
</p>
<p>
The finder shows useful information about each file, such as its size
(see below) and date of last modification. You can open any displayed
file by selecting it with a single left mouse button click.
</p>

<h3>Looking in subdirectories</h3>
<p>
When you want to find all files in all subdirectories of the current
directory, turn on the <b>Look in subdirectories</b> checkbox. This
will make Scid recursively examine every subdirectory for files that
can be opened in Scid. This can take a long time if there are many
subdirectories, so you may not want to do it for a directory near the
root of the file system. You can interrupt the file search by pressing
the <b>Stop</b> button.
</p>

<h3>File sizes</h3>
<p>
The meaning of a file size displayed by the finder depends on the file
type. For Scid databases and PGN files, it is the number of games. For
EPD files, it is the number of positions. For repertoire files, it is
the number of (include or exclude) lines.
</p>
<p>
For all file types except Scid databases, the file size is an estimate
taken by examining only the first 64 kilobytes of the file, so the size
may not be correct for files larger than 64 kb. Estimate sizes are shown
with a tilde (~) to show they are not exact.
</p>

<p><footer>(Updated: Scid 2.7, September 2001)</footer></p>
}

####################
### Tournament Finder window help:

set helpTitle(Tmt) "Tournament Finder window"
set helpText(Tmt) {<h1>The Tournament Finder window</h1>
<p>
The <term>Tournament Finder</term> lets you find tournaments in the
current database. It scans all the database games and collates data
about the tournaments found. Note that two games are considered to
be in the same tournament if they have the same Event tag, same Site
tag and were played within three months of each other.
</p>
<p>
You can limit the list of tournaments by the number of players and
games, date, mean Elo rating and country, by editing the fields below
the tournament list and then pressing the <b>Update</b> button.
</p>
<p>
The displayed list can be sorted by date, number of players, number
of games, mean Elo rating, site, event or the surname of the winner.
Select the category from the <menu>Sort</menu> menu or click on a
column title to change the sort field.
</p>
<p>
To load the first game of any displayed tournament, just click the
left mouse button when its line is highlighted. This will also
update the <a Crosstable>Crosstable</a> window if it is open.
If you press the right mouse button instead, the game will be loaded
and the Crosstable window will be opened even if it is closed.
</p>
<p>
To speed up the tournament searching process, it is a good idea to
set a fairly small date range (like a few years at most) or select
a particular country (by its three-letter standard code). Doing
these will greatly reduce the number of games Scid has to consider
when trying to form tournaments out of the games in the database.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}

####################
### GameList window help:

set helpTitle(GameList) "Game List window"
set helpText(GameList) {<h1>The Game List window</h1>
<p>
The Game List window displays a one-line summary for each game included
in the current <term>filter</term>.
</p>

<h3>Navigating the game list</h3>
<p>
You can scroll the game list using the slider bar or the four
buttons under the list.
You can also use the [Home], [End],
[Page Up], [Page Down] and arrow keys to scroll
using the keyboard.
</p>
<p>
You can find the next game in the list which has certain text in its
White, Black, Event or Site field, using the <b>Find text</b> box.
</p>

<h3>Actions on games in the list</h3>
<p>
To load a game from the game list, double-click the left mouse button
on the game.
Clicking the middle mouse button shows the initial moves of a game;
this can be useful for checking a games opening before loading it.
</p>
<p>
The right mouse button produces a menu for the selected game, in which
you can browse or merge the game (see below), delete (or undelete) the
game, or exclude it from the filter.
Note that deleting a game only turns on its delete flag; it will remain in
the database until you <a Compact>compact</a> it.
</p>

<h3>Configuring the game list</h3>
<p>
Click the left or right mouse button on a column title to configure the
game list. You can alter widths, add or remove columns, and change
the color for each column.
</p>
<p>
If you only want to change the width of a column, there is a shortcut:
while pressing the <b>Control</b> (or <b>Shift</b>) key, pressing
the left mouse button on the column title will make it narrower
and pressing the right mouse button will make it wider.
</p>

<h3>Altering the size of the game list</h3>
<p>
The size of the game list window is stored in the options file
whenever you save options.
So if you want the game list to show 10 games by default, just resize
the game list window and then select <menu>Save options</menu>
from the <menu>Options</menu> menu.
</p>

<h3><name Browsing>Browsing and merging games</name></h3>
<p>
The game list right-mouse menu (and some other windows, such as the
<a OpReport>opening report</a> window and the
<a Tree Best>best games list</a> of the <a Tree>tree</a> window)
provide the choice of loading, browsing or merging a game.
</p>
<p>
When <term>Browse game</term> is selected, the moves of the selected
game (without comments or variations) will be displayed in a separate
window. This is a useful way of previewing another game without
affecting the currently loaded game.
</p>
<p>
The <term>Merge game</term> feature provides a way to include the
selected game as a variation of the current game. Scid finds the
deepest point where the selected game differs from the current
game (taking transpositions into account) and adds a variation
for the selected game at that position. You can change the number
of moves of the selected game to be shown, depending on whether you
are interested in adding the whole game or just its opening phase.
</p>

<p><footer>(Updated: Scid 3.2, February 2002)</footer></p>
}


####################
### Import window help:

set helpTitle(Import) "Import window"
set helpText(Import) {<h1>The Import window</h1>
<p>
Scids Import window provides an easy way for you to paste a game
in <a PGN>PGN format</a> into Scid from some other application or window.
</p>
<p>
The large white frame in the window is where you type or paste
the text of the game in PGN format, and the gray frame below it
provides feedback of any errors or warnings.
</p>

<h3>Editing the current game with the Import window</h3>
<p>
The Import window also doubles as a convenient way to make a few changes
to the current game: you can paste the current game into the
Import window (with the <b>Paste current game</b> button), edit the
text, and click <b>Import</b> when done.
</p>

<h3>PGN tags in the Import window</h3>
<p>
Scid expects to see PGN header tags such as
<ul>
<li> <b>[Result "*"]</b> </li>
</ul>
before any moves, but you can just paste in a game fragment like
<ul>
<li> <b>1.e4 e5 2.Bc4 Bc5 3.Qh5?! Nf6?? 4.Qxf7# 1-0</b> </li>
</ul>
without any header tags and Scid will import it.
</p>

<h3>Using PGN files in Scid</h3>
<p>
If you want to use a PGN format file in Scid but do not
want to convert it with <a Pgnscid>pgnscid</a> first, there are two
possible ways.
</p>
<p>
First, you can import the games in the file to an existing database
with the <menu>Tools: Import file of PGN games...</menu> menu command.
</p>
<p>
The alternative is to open the PGN file directly in Scid. However, PGN
format files are opened read-only and consume more memory than a
comparable Scid database, so this is only recommended for relatively
small PGN files.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### Exporting help:

set helpTitle(Export) "Exporting games"
set helpText(Export) {<h1>Exporting games</h1>
<p>
You can use commands under the <menu>Tools</menu> menu to export the current
game or all games in the current filter to a text file.
</p>
<p>
Three text file formats are available: <a PGN>PGN</a> (portable game
notation), HTML (for web pages) and LaTeX (a popular typesetting system).
</p>
<p>
When exporting, you can choose to create a new file, or add the games to
an existing file of games exported by Scid.
</p>

<h3>Diagrams</h3>
<p>
When exporting in HTML or LaTeX format, Scid will automatically add a
diagram wherever a diagram <a NAGs>nag</a> ("D") or a <a Comment>comment</a>
that starts with the character "#" appears in the game.
</p>

<h3>HTML Export</h3>
<p>
Scid can export games to an HTML file. For diagrams to appear, you will
need the diagram images (distributed with Scid in the directory
"<b>bitmaps/</b>") to be in a subdirectory <b>bitmaps/</b> under the
directory the HTML file is in.
</p>

<h3>LaTeX Export</h3>
<p>
Scid can export games to a LaTeX file.
Games be printed two columns to a page and moves are in
figurine algebraic notation.
</p>
<p>
See the <a LaTeX>Using LaTeX with Scid</a> help page for more information.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### LaTeX help:

set helpTitle(LaTeX) "Scid and LaTeX"
set helpText(LaTeX) {<h1>Using LaTeX with Scid</h1>
<p>
Scid can save games and opening reports to files in LaTeX format.
LaTeX is an extension to TeX, a popular typesetting system.
</p>
<p>
To typeset the LaTeX files produced by Scid, you must have
LaTeX (of course) and have the "chess12" chess font package installed.
This font package is usually not part of standard LaTeX installations,
so even if you have LaTeX, you may not have the chess font.
</p>
<p>
For information about downloading and installing the LaTeX chess font,
visit the
<url http://scid.sourceforge.net/latex.html>Using LaTeX with Scid</url>
page at the <url http://scid.sourceforge.net/>Scid website</url>.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### PGN window help:

set helpTitle(PGN) "PGN window"
set helpText(PGN) {<h1>The PGN window</h1>
<p>
Scids PGN window displays the contents of the current game
in standard PGN representation. In the move text, comments
appear {in braces} and variations appear (in parentheses).
</p>

<h3>PGN format</h3>
<p>
PGN (Portable Game Notation) is a common standard for transferring
chess games between computer programs.
A PGN game consists of two sections. The first is
the header, which contains tags
such as
<b>[White "Kasparov, Gary"]</b>
and
<b>[Result "1/2-1/2"]</b>.
</p>
<p>
The second section contains the actual moves of the game, in
standard algebraic notation (SAN) along with any variations,
<a NAGs>annotation symbols</a> and <a Comment>comments</a>.
</p>

<h3>Actions in the PGN window</h3>
<p>
You can use the PGN window to navigate around the game: clicking the
left mouse button on a move will jump to that move. Click the left
mouse button on a comment will edit it.
The arrow keys and (<b>v</b> and <b>z</b> keys for entering or leaving
variations) work for game navigation just as in the main window.
</p>

<h3>PGN display options</h3>
<p>
The PGN window menus contain options that affect the PGN window display.
Scid can display the game in color or plain text -- see the
<menu>Display</menu> menu in the PGN window.
The color display is easier to read, and allows you to select moves and
comments using the mouse, but it is much slower to update. For very long
games, you may want to select plain text display.
</p>
<p>
You can also alter the format of comments and variations, choosing
to display them indented on a separate line for greater visibility.
</p>
<p>
The PGN display options, and the size of the PGN window, are saved to the
options file whenever you <b>Save Options</b> from the <menu>Options</menu>
menu of the main window.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}


####################
### Piece Tracker help:

set helpTitle(PTracker) "Piece tracker"
set helpText(PTracker) {<h1>The Piece Tracker window</h1>
<p>
The <term>Piece Tracker</term> is a tool that tracks the movements
of a particular piece in all games in the current filter, and
generates a "footprint" showing how often each square has been
visited by the piece.
</p>
<p>
To use the Piece Tracker, first make sure the filter contains the
games you are interested in, such as games reaching a particular
opening position or all games where a certain player had the white pieces.
Then, select the piece to track and set other tracking options; these are
explained below. Then press the <b>Update</b> button.
</p>
<p>
The tracked piece movement information is displayed in two ways: a
graphical "footprint", and a text list with one line of data per square.
</p>

<h3>Selecting the tracked piece</h3>
<p>
The chess pieces are displayed as in the standard chess starting position
below the footprint chart. A single piece (such as the White b1 knight or
the Black d7 pawn) can be selected with the left mouse button, and all
pieces of the same type and color (such as all White pawns or both Black
rooks) can be selected using the right mouse button.
</p>

<h3>Other piece tracker settings</h3>
<p>
The move number range controls when tracking should start and stop in
each game. The default range of 1-20 (meaning tracking should stop after
Black's 20th move) is appropriate for examining opening themes, but (for
example) a range like 15-35 would be better when looking for middlegame
trends.
</p>
<p>
There are two types of statistic the tracker can generate:
<ul>
<li> <b>% games with move to square</b>: shows what proportion of filter
     games contain a move by the tracked piece to each square. This is
     the default setting and usually the most suitable choice.
<li> <b>% time in each square</b>: shows the proportion of time the
     tracked piece has spent on each square.
</ul>
</p>

<h3>Hints</h3>
<p>
There are (at least) three good uses for the Piece Tracker: opening
preparation, middlegame themes, and player preparation.
</p>
<p>
For opening preparation, use the piece tracker with the <a Tree>Tree</a>
opened. By tracking pieces you can see trends in the current opening
such as common pawn pushes, knight outposts, and where the bishops are
most often placed. You may find it useful to set the move number range
to start after the current move in the game, so the moves made to reach
the current position are not included in the statistics.
</p>
<p>
For middlegame themes, the piece tracker can be useful when the filter
has been set to contain a certain ECO range (using a
<a Searches Header>Header search</a>) or perhaps a pattern such as a
White IQP (using a <a Searches Material>Material/pattern search</a>).
Set the move range to something suitable (such as 20-40), and track
pieces to see pawn pushes in the late middlegame or early endgame,
for example.
</p>
<p>
For player preparation, use a <a Searches Header>Header search</a> or
the <a PInfo>Player information</a> window to find all games by a
certain player with one color. The Piece Tracker can then be used to
discover how likely the player is to fianchetto bishops, castle
queenside, or set up a d5 or e5 pawn wedge, for example.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}


####################
### Repertoire editor help:

set helpTitle(Repertoire) "Repertoire editor"
set helpText(Repertoire) {<h1>The Repertoire editor window</h1>
<p>
The Repertoire editor lets you create, view, edit and <term>repertoire</term>
files. A repertoire (.sor) file is a list of the opening positions you want to
reach or try to avoid, and you can use it to manage your chess opening
preferences and also to search databases in Scid.
</p>

<h3>Repertoire groups and lines</h3>
<p>
A repertoire contains two types of elements: <term>groups</term> and
<term>lines</term>. Groups are not actually part of your repertoire; they
are only used to structure it the same way directories give structure to the
files on a computer disk.
</p>
<p>
Lines in a repertoire come in two types: <term>include</term> lines which
represent opening positions you are interested in and try to reach,
and <term>exclude</term> lines which are those you have no interest in
playing and try to avoid.
For example, if you play the QGA (1.d4 d5 2.c4 dxc4) as Black and you play
all moves after 3.e4 <i>except</i> 3...Nf6, you would have
1.d4 d5 2.c4 dxc4 3.e4 as an include line and 1.d4 d5 2.c4 dxc4 3.e4 Nf6 as
an exclude line.
</p>

<h3>Comments and notes</h3>
<p>
Each group or line can have comments attached to it. There are two types:
short (single-line) comments appear (in red) in the repertoire hierarchy
next to the moves of a group or line, while a long (multiple-line) comment
is only shown when the group or line is selected.
</p>

<h3>Using the repertoire editor window</h3>
<p>
The <b>left</b> side of the window shows the repertoire hierarchy. You can
click on folder icons to expand and collapse groups, and click on the
moves of a group or line to select it and see its comments.
Include lines are shown with a blue tick icon, and exclude lines have
a red cross.
</p>
<p>
If a line or group has a short comment, it is shown after the moves. If it
has a long comment, this is indicated with <b><red>**</red></b> after the
moves. Groups have a number in parentheses after their moves showing the
number of (include and exclude) lines they contain.
</p>
<p>
Clicking the right mouse button on a group or line produces a menu
of functions for it, such as deleting it or changing its state.
</p>
<p>
The <b>right</b> side of the window contains three frames. The first frame
is a list of the moves in the currently selected line or group. You can click
the left mouse button on this to paste the moves in the
<a Import>Import</a> window, which is useful for setting the current game
to start with a line in the repertoire.
The second frame contains the short comment for the line or group, and
the third frame contains its long comment.
</p>

<h3>Adding groups and lines to the repertoire</h3>
<p>
To add a line or group to the window, just make its moves on the
chessboard in the main window, then use the <menu>Edit</menu> menu
in the repertoire editor to add it as a group, include line or exclude line.
</p>
<p>
To delete a group or line, click the right mouse button on it and select
the appropriate command from the menu that appears.
</p>

<h3><name Search>Searching databases using repertoire files</name></h3>
<p>
The repertoire editor <menu>Search</menu> menu lets you search the
current database using the repertoire. Each game will be searched for
the positions in the repertoire and will only match the search if
the <i>deepest</i> repertoire position found is for an <i>include</i> line.
</p>
<p>
You can choose to search using the whole repertoire, or just the displayed
lines. Searching by displayed lines only is useful when you only want to
use some of the repertoire. For example, a repertoire might have two main
groups at the top level, one for 1.e4 and one for 1.d4. If you are only
interested in the 1.e4 lines, simply collapse the 1.d4 group and then
search by displayed lines only.
</p>

<h3>Extra hints</h3>
<p>
A repertoire file is great for finding new games in your opening systems.
For example, each time you get a new PGN file to add to your main database
(such as the excellent weekly PGN file from
<url http://www.chesscenter.com/twic/>The Week In Chess</url>),
just open the PGN file in Scid and do a repertoire search. Then you
can browse the filtered games to see all the games played that are
in your repertoire.
</p>
<p>
You may want to keep two repertoire files: one for Black and one for
White, so you can search with each file separately.
</p>
<p>
A repertoire file can be opened from the command line, for example: <br>
<b>scid mybase white.sor</b>
</p>
<p>
You can edit a repertoire (.sor) file in any text editor, but be careful
to preserve its format or it may not be loadable or searchable in Scid.
</p>

<p><footer>(Updated: Scid 2.6, August 2001)</footer></p>
}

####################
### Tree window help:

set helpTitle(Tree) "Tree window"
set helpText(Tree) {<h1>The Tree window</h1>
<p>
The <term>Tree</term> window displays information on all the
moves made from the current position in games in the database.
In tree mode, the tree window is updated automatically whenever the
main windows board changes. This can be slow for large databases.
</p>
<p>
Note that whenever the tree window is updated, the
<a Searches Filter>filter</a>
is reset and only the games that contain the current position will
be included.
</p>
<p>
Clicking the left mouse button on a move in the tree window adds that
move to the game.
</p>

<h3>Tree window contents</h3>
<p>
The tree window shows the <a ECO>ECO code</a> (if any), frequency (both as
number of games, and a percentage) and score of each move.
The <term>score</term> is always computed from the <b>White</b>
perspective, so 100% means all White wins and 0% means all Black wins.
</p>
<p>
The moves in the tree window can be sorted by move (alphabetically),
ECO code, frequency, or score. You can change the sort method
using the <menu>Sort</menu> menu.
</p>

<h3><name Best>Best games window</name></h3>
<p>
The tree window has a File menu command and button for opening the
<term>Best games</term> window, which shows a list of the highest-rated
games in the currently displayed tree branch.
The games are listed in order of average rating, and you can restrict
the list to show games with a particular result.
</p>

<h3><name Graph>Tree graph window</name></h3>
<p>
The tree window buttons include a button marked <term>Graph</term>
which produces a graphical display of the relative performance of each
move from the current position.
All moves that have been played at least 1% of the time, and at least 5
times, are displayed.
Percentage scores are always from White's perspective even when it is
Black to move.
</p>
<p>
In the tree graph, a red line is plotted showing the mean over all games
from the current position, and the area between 50 and 55% (where most
standard openings are expected to score) is colored blue
to assist comparison of moves. Note that white usually scores around 55%
in master level chess.
</p>

<h3><name Lock>Locking the tree window</name></h3>
<p>
The <term>Lock</term> button in the tree window can be used to lock the
tree to the current database. This means the tree will continue to use
that database even when you switch to another open database. This is
useful if you want to use a large database as a reference while
playing through a game in another database: simply open the tree on the
reference database, lock it, then switch to the other base.
</p>

<h3><name Training>Training</name></h3>
<p>
When the <term>Training</term> checkbox in the tree window is selected,
Scid will randomly make a move every time you add a move to the game.
The move Scid chooses depends on database statistics, so a move played
in 80% of database games will be chosen by Scid with 80% probability.
Turning on this feature, then hiding (or iconifying) the Tree window and
playing openings against a large database, is a great way to test your
knowledge of your opening repertoire.
</p>

<h3>Using the Tree with EPD files open</h3>
<p>
For each open <a EPD>EPD file</a>, the tree window will contain an extra
column that shows a short (five character) summary of the contents of the
EPD file for each position reached from the moves listed.
</p>
<p>
The summary could be an evaluation, an opening code or a suggested move;
it will be the contents of the first EPD field found from the
following list: <b>ce, eco, nic, pv, pm, bm, id</b>,
or just the first EPD field if none of the above are present.
</p>
<p>
For a description of EPD fields, see the <a EPD>EPD file</a> help page.
Note that if the summary is of the <b>ce</b> field, it is shown as an
evaluation in pawns from Whites perspective (rather than as a score in
centipawns from the perspective of the side to move, which is its stored
format in the EPD file) for improved readability.
</p>

<h3>Caching for faster results</h3>
<p>
Scid maintains a cache of tree search results for the positions with the
most matching games. If you move forward and back in a game in tree mode,
you will see the tree window update almost instantly when the position
being searched for is in the cache.
</p>
<p>
The tree window has a file menu command named <term>Save Cache</term>.
When you select this, the current contents of the tree cache in memory
are written to a file (with the suffix <b>.stc</b>) to speed up future
use of Tree mode with this database.
</p>
<p>
The <term>Fill cache file</term> command in the file menu of the tree
window fills the cache file with data for many opening positions.
It does a tree search for about 100 of the most common opening positions,
then saves the cache file.
</p>
<p>
Note that a tree cache (.stc) file is completely redundant; you can remove
it without affecting the database, and in fact it is removed by Scid
whenever an action occurs that could leave it out of date -- for example,
adding or replacing a game, or sorting the database.
</p>

<p><footer>(Updated: Scid 3.0, November 2001)</footer></p>
}



####################
### Compaction help:

set helpTitle(Compact) "Database compaction"
set helpText(Compact) {<h1>Database compaction</h1>
<p>
Database <term>compaction</term> is a specific type of
<a Maintenance>maintenance</a> that keeps a database as small and
efficient as possible.
Compacting a database means removing any unused space in its files.
There are two types: name file and game file compaction.
</p>

<h3>Name file compaction</h3>
<p>
Over time, you may find a database starts to contain a number of player,
event, site or round names that are no longer used in any game. This will
often happen after you spellcheck names. The unused names waste space in
the name file, and can slow down name searches.
Name file compaction removes all names that are not used in any games.
</p>

<h3>Game file compaction</h3>
<p>
Whenever a game is replaced or deleted, wasted space is left in the game
file (the largest of the three files in a Scid database). Game file
compaction removes all wasted space, leaving no deleted games in the
database. Note that this operation is irreversible: after compaction,
the deleted games are gone forever!
</p>
<p>
Game file compaction is also recommended after <a Sorting>sorting</a> a
database, to keep the order of the game file consistent with the sorted
index file.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}


####################
### Database maintenance tools help:

set helpTitle(Maintenance) "Database maintenance"
set helpText(Maintenance) {<h1>Database maintenance</h1>
<p>
Scid provides a number of tools for maintaining databases,
available from the Scid <a Menus File>File</a> menu. The
database <a Compact>compaction</a> and <a Sorting>sorting</a>
functions are explained in separate help pages.
</p>

<h3>Maintenance window</h3>
<p>
Most Scid database maintenance can be done from the Maintenance
window, which can be opened from the <menu>File: Maintenance</menu>
or <menu>Windows</menu> menus or the shortcut key <b>Ctrl+M</b>.
</p>
<p>
You can use this window to maintain <a Flags>game flags</a>,
spellcheck names, <a Compact>compact</a> or <a Sorting>sort</a>
a database. Note that any operations that are not available
for the current database (for example, because it may be read-only
or a PGN file) will be grayed out.
</p>

<h3><name Twins>Deleting twin games</name></h3>
<p>
The <menu>File: Maintenance</menu> menu has a command
<menu>Delete twin games...</menu> for detecting extra copies
(twins) of games in the database.
This command finds all pairs of games that are twins and, for each pair,
flags the shorter game deleted leaving the longer game undeleted.
Two games are considered to be twins if their players
(and any other tags that you can optionally specify) match exactly.
</p>
<p>
If you specify the "same moves" option, each pair of games must have the
same actual moves up to the length of the shorter game (or up to move 60,
whichever comes first) to be twins.
</p>
<p>
When you have deleted twins, it is a good idea to check that each
game deleted really is a copy of another game.
You can do this easily if you selected the
"<b>Set filter to all deleted games</b>" option in the
delete twins dialog box. The filter will now contain all deleted games.
You can browse through them (using the <b>p</b> and <b>n</b> keys) with
the <term>twins checker</term> window (available from the maintenance
menu, or the shortcut key <b>Ctrl+Shift+T</b>) to verify that each game is
deleted because it actually is a twin of another game.
</p>

<h3><name Editing>Editing player, event, site and round names</name></h3>
<p>
You may find mis-spelt names in your databases and want to correct them.
You can do this in Scid with the <term>Name editor</term> window
(shortcut key: <b>Control+Shift+N</b>),
available from the <menu>File: Maintenance</menu> submenu.
</p>
<p>
Each unique name is only stored once in the name file, so changing a name
actually changes all occurrences of it.
</p>

<h3><name Spellcheck>Spellchecking names</name></h3>
<p>
Scid comes with a <term>spellcheck</term> file named <b>spelling.ssp</b>,
for correction of player, event, site and round names.
Scid will try to load the spellcheck file whenever it starts up; if it
does not load, you can load it from the <menu>Options</menu> menu.
</p>
<p>
Once the spellcheck file is loaded, you can use it on a
a Scid database using the spellcheck commands in the
<menu>File: Maintenance</menu> menu, or from the maintenance window.
</p>
<p>
When you spellcheck a database, Scid produces a list of corrections that you
can edit before actually making any corrections, so you can remove any
corrections you do not want to make.
</p>
<p>
Spellchecking is especially useful for standardizing a database so all
instances of a particular player are spelt the same way.
For example, with the standard spellcheck file, the names "Kramnik,V.",
"Vladimir Kramnik", and "V. Kramnik" would all be corrected
to "Kramnik, Vladimir".
</p>
<p>
The spellcheck file has one
additional use: when it is loaded, its player data is
used to enhance the <a PInfo>player information</a> window and the
<a Crosstable>crosstable</a> window:
you will see FIDE master title
(<b>gm</b> = International Grandmaster, <b>im</b> = International Master, etc)
and country information for any player that is
listed in the spellcheck file. Over 6500 strong players of the past and
present are listed in the <b>spelling.ssp</b> file that comes with Scid.
</p>

<h3><name Ratings>Adding Elo ratings to games</name></h3>
<p>
The "Add Elo ratings..." button in the Maintenance window causes Scid
to search the current database for games where a player does not have
a rating, but the spellcheck file has an Elo rating listed for that
player at the date of the game. Scid will add all such ratings
automatically. This is very useful for a database of master-level games
which has few ratings.
</p>
<p>
The spellcheck file "spelling.ssp" that comes with Scid does not contain
the Elo rating information needed for this function, but a larger version
of it called "ratings.ssp" is available from the <a Author>Scid website</a>.
</p>

<h3><name Cleaner>The Cleaner</name></h3>
<p>
The Scid <term>Cleaner</term> (available from the Maintenance window) is
a tool for doing a number of maintenance tasks on a database in one
action. You can choose which tasks you want to do, and Scid will
perform them on the current database without requiring user interaction.
This is especially useful for maintenance of large databases.
</p>

<h3>Setting the database autoload game</h3>
<p>
The <term>autoload</term> game of a database is the game automatically
loaded whenever that database is opened. To change the autoload game of
a database, use the "Autoload game number..." button. If you always want
the last game of a database to be opened (regardless of the actual number
of games in the database), just set it to a very high number such as
9999999.
</p>

<p><footer>(Updated: Scid 3.1, December 2001)</footer></p>
}

####################
### Sorting help:

set helpTitle(Sorting) "Sorting a database"
set helpText(Sorting) {<h1>Sorting a database</h1>
<p>
The <term>sorting</term> function sorts all games in a database.
You can select a number of sort criteria.
When two games are equal according to the the first criteria, they
are sorted using the second criteria, and so on.
</p>

<h3>Sort criteria</h3>
<p>
The available sorting criteria are:
</p>
<ul>
<li> Date (oldest games first)
<li> Year (same as date, but using the year only)
<li> Event name
<li> Site name
<li> Country (last 3 letters of Site name)
<li> Round name
<li> White name
<li> Rating (average of White and Black ratings, highest first)
<li> Black name
<li> Result (White wins, then draws, then Black wins)
<li> Length (number of full moves in the game)
<li> ECO (the <a ECO>Encyclopedia of Chess Openings code</a>)
</ul>

<h3>Sort results</h3>
<p>
When you sort a Scid database that is not read-only, the sort results
are saved so the order of games in the database is permanently changed.
If you want to the sort results to be temporary, make the database
read-only first using the <b>File: Read-only</b> menu command.
</p>
<p>
When you sort a database that is read-only or is actually a PGN file,
the sort results cannot be saved so the sorted order of games will be lost
when the file is closed.
</p>
<p>
Note that sorting a database resets the
<a Searches Filter>search filter</a> to contain all games.
</p>

<h3>Important note about sorting databases:</h3>
<p>
When a database is sorted, the index file is altered but the game file
is not changed. This means sorting a database will leave the game file
records in a scrambled order relative to the index file. This can
really <b>slow down</b> <a Tree>tree</a>, position and material/pattern
<a Searches>searches</a>, so you should reorder the game file by
<a Compact>compacting</a> it after sorting the database to maintain
good search performance.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### Flags help:

set helpTitle(Flags) "Game Flags"
set helpText(Flags) {<h1>Game Flags</h1>

<p>
A <term>flag</term> is an indicator of some chess characteristic
that can be turned on or off for each game in the database.
There are 13 user-settable flags that you can directly set for
each game. Of these, only the Delete flag has any special
significance: games with the Delete flag turned on are marked
for deletion and will removed when the database is
<a Compact>compacted</a>.
</p>
<p>
The other 12 user-settable flags and their symbols are:
</p>

<ul>
<li>White opening (W)</li>
<li>Black opening (B)</li>
<li>Middlegame (M)</li>
<li>Endgame (E)</li>
<li>Novelty (N)</li>
<li>Pawn structure (P)</li>
<li>Tactics (T)</li>
<li>Queenside play (Q)</li>
<li>Kingside play (K)</li>
<li>Brilliancy (!)</li>
<li>Blunder (?)</li>
<li>User-defined (U)</li>
</ul>

<p>
A flag can be set for the current game, all filter games, or all
database games using the <a Maintenance>maintenance</a> window.
</p>
<p>
You can use a <a Searches Header>header search</a> to find all
games in a database that have a particular flag turned on or off,
or use flags as part of more complex searches.
</p>
<p>
Since all the user-settable flags (except the Delete flag) have
no significance to Scid, you can use them for any purpose that
suits your needs. For example, you could use the Kingside (K)
flag for kingside pawn storms, or kingside heavy piece attacks,
or even for endgames with all pawns on the kingside.
</p>

<p><footer>(Updated: Scid 3.0, November 2001)</footer></p>
}

####################
### Analysis window help:

set helpTitle(Analysis) "Analysis window"
set helpText(Analysis) {<h1>The Analysis window</h1>
<p>
The Scid analysis window shows the analysis by a chess program (known
as an <term>engine</term>) of the current board position. Whenever the
board changes, Scid sends the new position to the engine and it
shows its assessment of that position.
</p>
<p>
The score shown in the analysis window is always from the perspective
of White, so a negative score indicates Black is better.
The lower frame in the window (with the scrollbar) shows the history of
evaluations produced by the engine for the current position, so you can
see how the assessment has changed.
</p>
<p>
To add the best move chosen by the engine as a new move in the current
game, press the <b>Add move</b> button.
</p>

<h3><name List>The Analysis Engines List</name></h3>
<p>
Scid maintains a list of the engines you have used, along with an
estimated Elo rating (if you guess one) and the date when each
engine was last used. You can sort the engine list by name, Elo
rating, or date.
Select the <b>New</b> or <b>Edit</b> buttons to add a new engine to
the list or edit the details for an existing entry.
</p>
<h3><name Start>Engine commands and directories</name></h3>
<p>
For each engine, you must specify the executable file to run and
which directory Scid should run it in.
</p>
<p>
The most likely cause of engine starting problems is the choice of
which directory the engine should run in. Some engines require an
initialization or opening book file in their start directory to run
properly.
Other engines (like Crafty) write log files to the directory they start
in, so you will need to run them in a directory where you have write
access.
If the directory setting for an engine is ".", Scid will just start
the engine in the current directory.
</p>
<p>
So if an engine that should work fine in Scid does not start, try
changing its directory setting. To avoid engines creating log files
in many different directories, I recommend starting engines in
the directory of the Scid User files (this is where the <b>scid.exe</b>
file is located on Windows, or <b>~/.scid/</b> on Unix); there is a
button in the dialog box for editing engine details marked
<b>scid.exe dir</b> on Windows or <b>~/.scid</b> on Unix that lets
you set the engine to start in this directory.
</p>

<h3>Training</h3>
<p>
With the <b>Training</b> button, you can play moves against the analysis
engine. The time for each move is fixed, and the analysis results are
not shown when training mode is on.
</p>

<h3>Annotating a game</h3>
<p>
The <b>Add variation</b> button in the analysis window adds the current
score and best line of play as a new variation in the game.
</p>
<p>
You can do this automatically for a number of moves (annotating the game)
by pressing the <b>Annotate</b> button. This prompts you for some
annotation options and then turns on autoplay mode.
When autoplay mode is used and the analysis window is open, a variation
containing the score and best line of play is automatically added for each
position as autoplay mode moves through the game.
Only positions from the current position until the end of the game
(or until you exit autoplay mode) are annotated, so you can skip annotation
of opening moves by moving to a middlegame position before starting autoplay.
</p>
<p>
To cancel annotation at any time, just turn off autoplay mode, for example by
pressing the <b>Escape</b> key in the main window.
</p>
<p>
Note that for simplicity, the <b>Annotate</b> button is only available
in the window opened as analysis engine 1. If you open an engine as
analysis engine 2, you cannot use it to annotate the game.
</p>

<h3>Interface details</h3>
<p>
To use the analysis window, you will need a chess program that supports
the <term>WinBoard/Xboard</term> protocol.
</p>
<p>
Scid sends he <b>xboard</b>, <b>post</b> and <b>protover 2</b> to an
engine when it starts, and will use the <b>setboard</b> and <b>analyze</b>
commands for more efficient communication if the engine responds indicating
that it supports them.
If an engine does not support the <b>setboard</b> command, it will
not be able to provide analysis in any game that begins with a
non-standard start position.
</p>
<p>
For programs that do not support the <b>analyze</b> command, Scid sends
the following commands every time the position changes: <b>new</b> and
<b>force</b>, then the moves in the game to the current position, then
<b>go</b>.
</p>
<p>
Bob Hyatt's excellent free chess program <term>Crafty</term> is what I
use and recommend for the Scid analysis window, but many other WinBoard
or XBoard compatible programs have been successfully used with Scid.
Some download sites for a few engines are listed below.
</p>
<p>
Crafty:
<url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url>
</p>
<p>
Yace:
<url http://home1.stofanet.dk/moq/>http://home1.stofanet.dk/moq/</url>
</p>
<p>
Phalanx:
<url ftp://ftp.math.muni.cz/pub/math/people/Dobes/>ftp://ftp.math.muni.cz/pub/math/people/Dobes/</url>
</p>
<p>
Comet:
<url http://members.aol.com/utuerke/comet/>http://members.aol.com/utuerke/comet/</url>
</p>
<p>
Gnuchess:
<url http://www.gnu.org/software/chess/chess.html>http://www.gnu.org/software/chess/chess.html</url>
</p>
<p>
The Crazy Bishop:
<url http://remi.coulom.free.fr/>http://remi.coulom.free.fr/</url>
</p>

<p><footer>(Updated: Scid 3.2, February 2002)</footer></p>
}

####################
### EPD files help:

set helpTitle(EPD) "EPD files"
set helpText(EPD) {<h1>EPD files</h1>
<p>
An EPD (extended position description) file is a collection of positions,
where each position has some associated text. Like <a PGN>PGN</a>, it
is a common standard for chess information.
</p>
<p>
An EPD file has a number of defined <term>opcodes</term> (fields)
which are stored separated by semicolons (<b>;</b>) in the file
but are shown on separate lines in a Scid EPD window to make editing easier.
A semicolon within an EPD field is stored as "<b>\s</b>" by Scid to
distinguish it from an end-of-field marker.
Each position and its associated opcodes are stored on one single line
in the EPD file.
</p>
<p>
Standard EPD opcodes include:
<ul>
<li> <b>acd</b> Analysis count: depth searched.</li>
<li> <b>acn</b> Analysis count: number of nodes searched.</li>
<li> <b>acs</b> Analysis count: search time in seconds.</li>
<li> <b>bm</b> Best moves: move(s) judged best for some reason.</li>
<li> <b>ce</b> Centipawn evaluation: evaluation in hundredths of a
pawn from the perspective of the <b>side to move</b> -- note this
differs from the Analysis window which shows evaluations in pawns from
Whites perspective. </li>
<li> <b>cX</b> Comment (where <b>X</b> is a digit, 0-9).</li>
<li> <b>eco</b> <a ECO>ECO</a> system opening code.</li>
<li> <b>id</b> Unique Identification for this position.</li>
<li> <b>nic</b> <i>New In Chess</i> system opening code.</li>
<li> <b>pm</b> Predicted move: the first move of the PV.</li>
<li> <b>pv</b> Predicted variation: the line of best play.</li>
</ul>

<p>
EPD files have a number of uses: Scid uses an EPD file to classify
games according to the <a ECO>Encyclopedia of Chess Openings</a> (ECO)
system, and you can create an EPD file for your opening repertoire,
adding comments for positions you regularly reach in games.
</p>
<p>
You can create a new EPD file or open an existing one, from the
<menu>New</menu> and <menu>Open</menu> commands of the
<menu>File</menu> menu. At most four EPD files can be open at any time.
</p>

<h3>EPD windows</h3>
<p>
For each open EPD file, you will see a window which shows the text for
the current position. You do not have to press the Store button to store
any changes you make to a positions text; the text will be stored whenever
you move to a different position in the game.
</p>

<h3>Navigating EPD files</h3>
<p>
To browse through the positions in a EPD file, use the
<menu>Next position</menu> and <menu>Previous position</menu> commands
from the EPD window <menu>Tools</menu> menu, or use the shortcut
keys <b>Ctrl+DownArrow</b> and <b>Ctrl+UpArrow</b>.
These commands move to the next/previous position in the file, clearing
the current game and setting its start position.
</p>

<h3>Stripping out EPD fields</h3>
<p>
EPD files you find on the Internet may contain fields that do not
interest you, and they can waste a lot of space in the file.
For example, an EPD file of computer evaluations might have ce, acd,
acn, pm, pv and id fields but you may only need the ce and pv fields.
</p>
<p>
You can strip out an EPD opcode from all positions in the EPD file using
the <menu>Strip out EPD field</menu> from the EPD window <menu>Tools</menu>
menu.
</p>

<h3>The EPD window status bar</h3>
<p>
The status bar of each EPD window shows:
<ul>
<li>- the file status (<b>--</b> means unchanged, <b>XX</b> means
      changed, and <b>%%</b> means read-only); </li>
<li>- the file name; </li>
<li>- the number of positions in the file; </li>
<li>- legal moves from the current position reach another position
in this EPD file.</li>
</ul>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### Email window help:

set helpTitle(Email) "Email window"
set helpText(Email) {<h1>The Email window</h1>
<p>
Scids email manager window provides a way for you to manage correspondence
chess games played by email.
If you do not play email chess, this will be of no interest to you.
But if you play correspondence chess by email, you can send your email
messages directly from Scid!
</p>
<p>
To use the email manager:
<ul>
<li><b>1)</b> Create the game(s) for your opponent in the
database. </li>
<li><b>2)</b> In the email manager window, select <b>Add</b> and enter
your opponents details: name, email address, and the game numbers in the
database. </li>
<li><b>3)</b> Select <b>Send email</b> in the email window each time you
have added moves to the game(s) and want to send a message. </li>
</ul>

<p>
When you send an email message, Scid generates the message with the games
in PGN format <b>without</b> any comments, annotations or variations, since
you would not usually want your opponent to see your analysis.
You can edit the message before sending it to add conditional moves or
other text.
</p>
<p>
For each opponent, you may have any number of games; one or two is most
common. Note that Scid does not check if game numbers change, so after
setting up the details of your opponents, be careful to avoid deleting games
or sorting your database of email games, since this will rearrange games
and the game numbers for each opponent will be incorrect.
</p>

<h3>Limitations</h3>
<p>
Scid does not have any capability to check your email folder yet, so you
still need to add your opponents moves to the games manually.
</p>

<h3>Configuration</h3>
<p>
A copy of each email message sent by Scid is stored in the file
<b>~/.scid/scidmail.log</b>. If you want them to be stored
in a different file, you will need to edit the file <b>tcl/start.tcl</b>
and recompile Scid.
</p>
<p>
Scid can send email messages using an SMTP server or sendmail.
User the <b>Settings</b> button in the Email Manager to specify which
you want to use.
</p>
<p>
Scid stores the opponent details for a database in a file
with the same name as the database and the suffix "<b>.sem</b>".
</p>

<p><footer>(Updated: Scid 3.0, November 2001)</footer></p>
}

####################
### Opening Report help:

set helpTitle(OpReport) "Opening Reports"
set helpText(OpReport) {<h1>Opening Reports</h1>
<p>
Scid can produce an <term>opening report</term> that displays interesting
facts about an opening position. To generate an opening report, first make
sure the displayed position is the one you want a report for, then select
<b>Opening Report</b> from the <b>Tools</b> menu.
</p>
<p>
The <term>Opening Report</term> window displays the results of the report
Scid generated. The <b>File</b> menu has commands to save the report
to a file in plain text, HTML or <a LaTeX>LaTeX</a> format.
</p>
<p>
The first sections of the report present information on the games that
reach the report position, and moves played from the position. You can
see if the opening is becoming more popular, if it has many short draws,
and what move orders (transpositions) are used to reach it.
</p>
<p>
The final and largest part of the report is the theory table. When saving
the report to a file, you can choose to save just the theory table, a compact
report without the theory table, or the whole report.
</p>
<p>
Almost all the report sections can be turned on or off or adjusted in
the opening report options, so you can customize a report to only show
the information that interests you.
</p>
<p>
Most items of information in the report window that are shown in color,
invoke some action when selected with the left mouse button. For example,
you can click on a game reference to load that game, or click on a
positional theme to set the filter to contain only the report games where
that theme occurred.
</p>

<h3>Limits</h3>
<p>
There is a limit of 2000 games for most data generated by the report, so
if the report position occurs in more than 2000 games, some results may
be slightly incorrect.
</p>
<p>
Also, there is a limit of 500 games for the theory table. If the report
position occurs in more than 500 games, only the 500 games with the highest
average Elo rating are used to generate the theory table. You can adjust the
number of games used to generate the theory table in the Opening Report
options.
</p>

<h3>LaTeX preview</h3>
<p>
The <b>Preview Latex</b> button in the bottom left corner of the report
window (not available in Windows versions) saves the report as a
temporary LaTeX-format file, runs <b>latex</b> and <b>dvips/</b> on it,
and then executes <b>ghostview</b> to display the results. This will
<b>only</b> work if you have latex, dvips, ghostview and all the
necessary latex packages installed on
your computer; see the <a LaTeX>Using LaTeX with Scid</a> help page.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}

####################
### Player Info help:

set helpTitle(PInfo) "Player Info window"
set helpText(PInfo) {<h1>The Player Info window</h1>
<p>
The <term>Player Information</term> window is produced or updated whenever
you click the left mouse button on a player name in the game information
area (below the chessboard) or in the <a Crosstable>crosstable</a> window.
</p>
<p>
It displays (hopefully) useful information about the player, including their
success with White and Black, favorite openings (by <a ECO>ECO code</a>),
and rating history.
</p>
<p>
All percentages displayed are an expected score (success rate), from the
player's perspective -- so higher is always better for the player, whether they
are White or Black.
</p>
<p>
You can see the player's rating history in a graph by pressing the
<a Graphs Rating>Rating graph</a> button.
</p>
<p>
Any number printed in red can be clicked with the left mouse button to set
the <a Searches Filter>filter</a> to the games it represents.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### Graphs help:

set helpTitle(Graphs) "Graph windows"
set helpText(Graphs) {<h1>Graph windows</h1>
<p>
Scid has a number of windows which display information graphically.
They are explained below.
</p>

<h3><name Filter>Filter Graph window</name></h3>
<p>
The <term>Filter Graph</term> window shows trends by date or by
Elo rating for the games in the current filter, compared to the
entire database. For example, it is useful when the <a Tree>tree</a>
is open as a tool showing how the current opening position has changed
in popularity in recent years or decades, or whether it is especially
popular among higher-rated players such as grandmasters.
Each point on the graph represents the number of games in the filter
per 1000 games in the entire database, for a particular date or Elo
rating range.
</p>
<p>
When plotting the Filter graph by rating, Scid uses the average (mean)
rating for each game. Estimate ratings (such as those in the spelling file)
are not used. If one player in a game has a rating but the opponent
does not, the opponent is presumed to have the same up to a limit of 2200.
For example, if one player is rated 2500 and the opponent has no rating,
the mean rating is (2500+2200)/2=2350.
</p>

<h3><name Rating>Rating Graph window</name></h3>
<p>
The <term>Rating Graph</term> window shows the rating history of one
player or the two players of the current game.
You can produce the graph for a single player by pressing the
<b>Rating graph</b> button in the <a PInfo>player information</a>
window, or produce it for the two players of the current game by
selecting <b>Rating graph</b> from the <menu>Tools</menu> menu.
</p>

<h3><name Score>Score Graph window</name></h3>
<p>
The <term>Score Graph</term> window shows the numeric evaluations (scores)
stored in the comments of the current game as a graph.
You can click the left mouse button anywhere in the score graph to go to the
corresponding position in the game.
</p>
<p>
Two types of evaluation comment are recognized: those produced by
the Scid <a Analysis>analysis</a> window (which have the format
<ul>
<li><b>1.e4 {"+0.25 ...."}</b></li>
</ul>
and are always scores from White's perspective) and those produced
by the Crafty annotate command (which have the format
<ul>
<li><b>1.e4 ({9:+0.25} ....)</b></li>
</ul>
and are also scores from White's perspective).
</p>

<h3><name Tree>Tree Graph window</name></h3>
<p>
The <term>Tree Graph</term> window is available from the tree
window. It shows the performance of the most popular moves from the
current position. More information is available from the
<a Tree Graph>Tree</a> help page.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}

####################
### Tablebases help:

set helpTitle(TB) "Tablebases"
set helpText(TB) {<h1>Tablebases</h1>

<p>
A <term>tablebase</term> is a file containing the perfect result
information about all positions of a particular material setup,
such as King and Rook versus King and Pawn. Tablebases for all
material situations up to five men (including the Kings) have been
generated, and some simple 6-men tablebases are also available.
</p>
<p>
Scid can use Nalimov-format tablebases that are used by many modern
chess engines. These often end with the file suffix <b>.nbw.emd</b>
or <b>.nbb.emd</b>. All 3-, 4- and 5-men Nalimov tablebases can be
used in Scid.
</p>

<h3>Using tablebases in Scid</h3>
<p>
To use tablebase files in Scid, simply set their directories by
selecting <b>Tablebase directory...</b> from the <menu>Options</menu> menu.
You can select up to 4 directories where your tablebase files are stored.
You can press a <b>...</b> button to the right of an entry to choose a
file, to specify that the directory of that file should be used.
</p>
<p>
When a position found in a tablebase file is reached, the game information
area (below the chessboard) will show tablebase information. You can
configure the amount of information shown by clicking the right-mouse
button in that area or selecting <b>Game information</b> from the
<menu>Options</menu> menu. Selecting the "result and best moves" option
gives the most useful information, but is much often slower than
the "result only" option.
</p>

<h3>The Tablebase window</h3>
<p>
You can get even more tablebase information about the current position
by opening the <term>Tablebase window</term> (<menu>Windows</menu> menu,
shortcut: Ctrl+Shift+=). This window shows the result with perfect play
of all legal moves from the current position.
</p>
<p>
The window has two main parts. The summary frame (on the left) shows
which tablebases Scid found on your computer and a summary for each
tablebase. The results frame (on the right) shows optimal results for
all moves from the current position displayed in the main window.
</p>

<h4>The summary frame</h4>
<p>
The top part of the summary frame lets you select a particular
tablebase. Those you have available are shown in blue and unavailable
tablebases are shown in gray, but you can select any tablebase.
The lower part of the summary frame shows summary information for the
selected tablebase. (Not all tablebases have a summary recorded in
Scid yet.)
</p>
<p>
The summary includes the frequency (how many games per million
reach a position with this material, computed from a database of nearly
600,000 master-level games), a longest mate for either side, and the
number of mutual (or "reciprocal") zugzwangs. A mutual zugwang is a
position where white to move draws and black to move loses, or where
white to move loses and black to move draws, or where whoever moves
loses.
</p>
<p>
For some tablebases with mutual zugzwangs, the summary also includes
a list of all of the zugwang positions or a selection of them. A full
list for every tablebase is not feasible since some tablebases have
thousands of mutual zugzwangs.
</p>
<p>
You can set up a random position from the selected tablebase by pressing
the <b>Random</b> button.
</p>

<h4>The results frame</h4>
<p>
The results frame is updated whenever the chessboard in the main window
changes. The first line shows how many moves win (+), draw (=), lose (-),
or have an unknown result (?). The rest of the frame gives a more detailed
list of results, ranking them from shortest to longest mates, then draws,
then longest to shortest losses. All distances are to checkmate.
</p>

<h3>Obtaining Tablebase files</h3>
<p>
See the <a Author Related>related links</a> section for help on finding
tablebase files on the Internet.
</p>

<p><footer>(Updated: Scid 3.3, April 2002)</footer></p>
}

####################
### Bookmarks help:

set helpTitle(Bookmarks) "Bookmarks"
set helpText(Bookmarks) {<h1>Bookmarks</h1>
<p>
Scid allows you to <term>bookmark</term> important games for easy
future reference. The bookmarks menu is available from the
<menu>File</menu> menu, the toolbar, or the <B>Ctrl+B</b> shortcut key.
</p>
<p>
When you select a bookmarked game from the Bookmarks menu, Scid will
open its database if necessary, find that game, and move to the game
position at which it was bookmarked.
</p>
<p>
Only games in a Scid format database (not a PGN file or the clipbase)
can be bookmarked.
</p>
<p>
If the database of a bookmarked game is sorted or compacted, the bookmark
details may become out of date. When that happens, Scid will search the
database for the best matching game (comparing player names, site, etc)
when the bookmark is selected, so the bookmarked game should still be
loaded. However, if details of the bookmarked game change, it is possible
that a different game will match the bookmark details better and be
loaded instead. So it is a good idea to re-bookmark a game if you edit
its players, site, result, round or year.
</p>

<h3>Editing bookmarks</h3>
<p>
With the bookmark editor, you can change the menu text displayed for
each bookmarked game and add folders to categorize bookmarks.
</p>

<h3>Hints</h3>
<p>
You can use bookmarks for fast access to databases you use often
by bookmarking a game from each database. Another good use for
bookmarks is to add important games you find when studying a
particular chess opening.
</p>
<p>
The bookmarks menu contains an entry for controlling the display of
bookmark folders: they can be shown as submenus (useful when there are
many bookmarks), or as a single list.
</p>

<p><footer>(Updated: Scid 3.0, November 2001)</footer></p>
}

####################
### Command-line options help:

set helpTitle(Cmdline) "Command-line options"
set helpText(Cmdline) {<h1>Command-line options</h1>
<p>
When you start Scid from a shell or console, there are command-line
options you can specify. Scid-format databases (with or without a
file suffix such as ".si3") and PGN files to be opened can be given,
for example:
<ul>
<li>scid mybase newgames.pgn</li>
</ul>
will start Scid and open the Scid database called mybase and the
PGN file named newgames.pgn.
</p>
<p>
There are also optional arguments to control which files Scid should
search for and use when it starts. You can turn off the use of
<a TB>tablebases</a> with the <b>-xtb</b> (or <b>-xt</b>) option,
avoid loading the <a ECO>ECO openings classification</a> file with
<b>-xeco</b> or <b>-xe</b>, and avoid loading the
<a Maintenance Spellcheck>spelling</a> file
with <b>-xspell</b> or <b>-xs</b>. Also, the option <b>-fast</b>
or <b>-f</b> does all three, so <b>scid -f</b> is equivalent
to <b>scid -xeco -xspell -xtb</b>.
</p>

<p><footer>(Updated: Scid 3.1, November 2001)</footer></p>
}

####################
### Pgnscid help:

set helpTitle(Pgnscid) "Pgnscid"
set helpText(Pgnscid) {<h1>Pgnscid</h1>
<p>
<term>Pgnscid</term> is the separate program that you need to use to
convert PGN (portable game notation) files into Scid databases.
</p>
<p>
To convert a file named <i>myfile.pgn</i>, simply type:
<ul>
<li> <b>pgnscid myfile.pgn</b> </li>
</ul>
and the scid database (consisting of <i>myfile.si3</i>, <i>myfile.sg3</i>
and <i>myfile.sn3</i>) will be created.
Any errors or warnings will be written to the file <i>myfile.err</i>.
</p>
<p>
If you want the database to be created in a different directory or have
a different name, you can add the database name to the command line,
for example:
<ul>
<li> <b>pgnscid myfile.pgn mybase</b> </li>
</ul>
will create a database consisting of the files <i>mybase.si3</i>,
<i>mybase.sg3</i> and <i>mybase.sn3</i>.
</p>
<p>
Note that pgnscid (and scid) can read Gzipped PGN files
(e.g. <b>mybase.pgn.gz</b>)
directly, so if you have a large PGN file compressed with Gzip to save
disk space, you do not have to un-gzip it first.
</p>

<h3>Options</h3>
<p>
There are two optional arguments pgnscid can accept before the filename:
<b>-f</b> and <b>-x</b>.
</p>
<p>
The <b>-f</b> option forces overwriting of an existing database; by
default, pgnscid will not convert to a database that already exists.
</p>
<p>
The <b>-x</b> option causes pgnscid to ignore all text between games.
By default, text between games is stored as a pre-game comment of the
game that follows. This option only affects text between games; standard
comments inside each game are still converted and stored.
</p>

<h3>Formatting player names</h3>
<p>
To reduce the number of multiple spellings of names that refer to the
same player, some basic formatting of player names is done by pgnscid.
For example, the number of spaces after each comma is standardized to one,
any spaces at the start and end of a name are removed, and a dot at the
end of a name is removed.
Dutch prefixes such as "van den" and "Van Der" are also normalized to have
a capital V and small d.
</p>
<p>
You can edit (and even spellcheck) player, event, site and round names in
Scid; see the <a Maintenance Editing>Maintenance</a> help page for details.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}


####################
### File formats help:

set helpTitle(Formats) "File Formats"
set helpText(Formats) {<h1>Scid File Formats</h1>
<p>
Scid databases consist of three essential files: an Index file, a Name
file and a Game file. All have a two-letter suffix starting with "s":
".si" for index files, ".sn" for name files, and ".sg" for game files.
</p>

<h3>The Index (.si) file</h3>
<p>
This file contains a description for the database and a small fixed-size
entry for each game. The current size is 41 bytes per game.
Of this, about 28 bytes is essential information such as the result,
date, player/event/site name ID numbers (the actual names are in the
Name file), etc.
</p>
<p>
The remaining 13 bytes contain redundant but useful information about the
game that is used to speed up position, material and pattern searches.
See the section <a Formats Fast>Fast searches</a> below for more information.
</p>

<h3>The Name (.sn) file</h3>
<p>
This file contains all player, event, site and round names used in the
database. Each name is stored only once even if it occurs in many games.
The name file is usually the smallest of the three essential files in a
database.
</p>

<h3>The Game (.sg) file</h3>
<p>
This file contains the actual moves, variations and comments of each game.
The move encoding format is very compact: most moves take only one byte
of storage.
</p>
<p>
When a game is replaced, its new version is saved to the <i>end</i> of
the game file, so wasted space can accumulate over time. You can restore
a database to its minimal size by <a Compact>compacting</a> it.
</p>

<h3>Other Scid files</h3>
<p>
An <a EPD>EPD</a> file (suffix: ".epd")
contains a number of chess positions, each with a text comment.
The EPD file format is described in the <a Author Related>PGN standard</a>.
</p>
<p>
An email (suffix: ".sem") file for a database stores details of the opponents
you send email messages to.
</p>
<p>
A SearchOptions (suffix: ".sso") file contains Scid
<a Searches Header>header</a> or
<a Searches Material>material/pattern</a> search settings.
</p>

<h3><name Fast>Fast searches in Scid</name></h3>
<p>
As mentioned above, the index file stores some redundant but useful
information about each game to speed up position or material searches.
</p>
<p>
For example, the material of the final position is stored. If you search
for rook and pawn endings, then all games that end with a queen, bishop
or knight on the board (and have no pawn promotions) will be quickly
skipped over.
</p>
<p>
Another useful piece of information stored is the order in which pawns
leave their home squares (by moving, or by being captured). This is used
to speed up tree or exact position searches, especially for opening
positions. For example, when searching for the starting position of the
French defence (1.e4 e6), every game starts with 1.e4 c5, or 1.d4, etc, will
be skipped, but games starting with 1.e4 e5 will still need to be searched.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### Options and Fonts help:

set helpTitle(Options) "Options"
set helpText(Options) {<h1>Options and preferences</h1>
<p>
Many Scid options and preferences (such as the board size, colors, fonts,
and default settings) are adjustable from the <menu>Options</menu> menu.
All these (and more, such as the last directory you loaded a database from
and the sizes of some windows) are saved to an options file when
you select <b>Save Options</b> from the Options menu.
The options file is loaded whenever you start Scid.
</p>
<p>
If you use Windows, the options file is <b>scid.opt</b> in the directory
where the Scid program file <b>scid.exe</b> is located. For users of Unix
operating systems (such as Solaris or Linux) the file
is <b>~/.scid/scidrc</b>.
</p>

<h3><name Fonts>Setting Fonts</name></h3>
<p>
Scid has three basic fonts it uses in most of its windows, and you can
customize all of them. They are called <b>regular</b>, <b>small</b> and
<b>fixed</b>.
</p>
<p>
The fixed font should be a fixed-width (not proportional) font. It is used
for the <a Tree>tree</a> and <a Crosstable>crosstable</a> windows.
</p>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}

####################
### NAG values help:

set helpTitle(NAGs) "NAG values"
set helpText(NAGs) {<h1>Standard NAG values</h1>
<p>
Standard NAG (Numeric Annotation Symbol) values defined in the
<a Author Related>PGN standard</a> are:
</p>
<cyan>
<ul>
<li>  1   Good move (!) </li>
<li>  2   Poor move (?) </li>
<li>  3   Excellent move (!!) </li>
<li>  4   Blunder (??) </li>
<li>  5   Interesting move (!?) </li>
<li>  6   Dubious move (?!) </li>
<li>  7   Forced move </li>
<li>  8   Singular move; no reasonable alternatives </li>
<li>  9   Worst move </li>
<li> 10   Drawish position (=) </li>
<li> 11   Equal chances, quiet position (=) </li>
<li> 12   Equal chances, active position (=) </li>
<li> 13   Unclear position (~) </li>
<li> 14   White has a slight advantage (+=) </li>
<li> 15   Black has a slight advantage (=+) </li>
<li> 16   White has a moderate advantage (+/-) </li>
<li> 17   Black has a moderate advantage (-/+) </li>
<li> 18   White has a decisive advantage (+-) </li>
<li> 19   Black has a decisive advantage (-+) </li>
<li> 20   White has a crushing advantage (+-) </li>
<li> 21   Black has a crushing advantage (-+) </li>
<li> 22   White is in zugzwang </li>
<li> 23   Black is in zugzwang </li>
<li> 24   White has a slight space advantage </li>
<li> 25   Black has a slight space advantage </li>
<li> 26   White has a moderate space advantage </li>
<li> 27   Black has a moderate space advantage </li>
<li> 28   White has a decisive space advantage </li>
<li> 29   Black has a decisive space advantage </li>
<li> 30   White has a slight time (development) advantage </li>
<li> 31   Black has a slight time (development) advantage </li>
<li> 32   White has a moderate time (development) advantage </li>
<li> 33   Black has a moderate time (development) advantage </li>
<li> 34   White has a decisive time (development) advantage </li>
<li> 35   Black has a decisive time (development) advantage </li>
<li> 36   White has the initiative </li>
<li> 37   Black has the initiative </li>
<li> 38   White has a lasting initiative </li>
<li> 39   Black has a lasting initiative </li>
<li> 40   White has the attack </li>
<li> 41   Black has the attack </li>
<li> 42   White has insufficient compensation for material deficit </li>
<li> 43   Black has insufficient compensation for material deficit </li>
<li> 44   White has sufficient compensation for material deficit </li>
<li> 45   Black has sufficient compensation for material deficit </li>
<li> 46   White has more than adequate compensation for material deficit </li>
<li> 47   Black has more than adequate compensation for material deficit </li>
<li> 48   White has a slight center control advantage </li>
<li> 49   Black has a slight center control advantage </li>
<li> 50   White has a moderate center control advantage </li>
<li> 51   Black has a moderate center control advantage </li>
<li> 52   White has a decisive center control advantage </li>
<li> 53   Black has a decisive center control advantage </li>
<li> 54   White has a slight kingside control advantage </li>
<li> 55   Black has a slight kingside control advantage </li>
<li> 56   White has a moderate kingside control advantage </li>
<li> 57   Black has a moderate kingside control advantage </li>
<li> 58   White has a decisive kingside control advantage </li>
<li> 59   Black has a decisive kingside control advantage </li>
<li> 60   White has a slight queenside control advantage </li>
<li> 61   Black has a slight queenside control advantage </li>
<li> 62   White has a moderate queenside control advantage </li>
<li> 63   Black has a moderate queenside control advantage </li>
<li> 64   White has a decisive queenside control advantage </li>
<li> 65   Black has a decisive queenside control advantage </li>
<li> 66   White has a vulnerable first rank </li>
<li> 67   Black has a vulnerable first rank </li>
<li> 68   White has a well protected first rank </li>
<li> 69   Black has a well protected first rank </li>
<li> 70   White has a poorly protected king </li>
<li> 71   Black has a poorly protected king </li>
<li> 72   White has a well protected king </li>
<li> 73   Black has a well protected king </li>
<li> 74   White has a poorly placed king </li>
<li> 75   Black has a poorly placed king </li>
<li> 76   White has a well placed king </li>
<li> 77   Black has a well placed king </li>
<li> 78   White has a very weak pawn structure </li>
<li> 79   Black has a very weak pawn structure </li>
<li> 80   White has a moderately weak pawn structure </li>
<li> 81   Black has a moderately weak pawn structure </li>
<li> 82   White has a moderately strong pawn structure </li>
<li> 83   Black has a moderately strong pawn structure </li>
<li> 84   White has a very strong pawn structure </li>
<li> 85   Black has a very strong pawn structure </li>
<li> 86   White has poor knight placement </li>
<li> 87   Black has poor knight placement </li>
<li> 88   White has good knight placement </li>
<li> 89   Black has good knight placement </li>
<li> 90   White has poor bishop placement </li>
<li> 91   Black has poor bishop placement </li>
<li> 92   White has good bishop placement </li>
<li> 93   Black has good bishop placement </li>
<li> 94   White has poor rook placement </li>
<li> 95   Black has poor rook placement </li>
<li> 96   White has good rook placement </li>
<li> 97   Black has good rook placement </li>
<li> 98   White has poor queen placement </li>
<li> 99   Black has poor queen placement </li>
<li>100   White has good queen placement </li>
<li>101   Black has good queen placement </li>
<li>102   White has poor piece coordination </li>
<li>103   Black has poor piece coordination </li>
<li>104   White has good piece coordination </li>
<li>105   Black has good piece coordination </li>
<li>106   White has played the opening very poorly </li>
<li>107   Black has played the opening very poorly </li>
<li>108   White has played the opening poorly </li>
<li>109   Black has played the opening poorly </li>
<li>110   White has played the opening well </li>
<li>111   Black has played the opening well </li>
<li>112   White has played the opening very well </li>
<li>113   Black has played the opening very well </li>
<li>114   White has played the middlegame very poorly </li>
<li>115   Black has played the middlegame very poorly </li>
<li>116   White has played the middlegame poorly </li>
<li>117   Black has played the middlegame poorly </li>
<li>118   White has played the middlegame well </li>
<li>119   Black has played the middlegame well </li>
<li>120   White has played the middlegame very well </li>
<li>121   Black has played the middlegame very well </li>
<li>122   White has played the ending very poorly </li>
<li>123   Black has played the ending very poorly </li>
<li>124   White has played the ending poorly </li>
<li>125   Black has played the ending poorly </li>
<li>126   White has played the ending well </li>
<li>127   Black has played the ending well </li>
<li>128   White has played the ending very well </li>
<li>129   Black has played the ending very well </li>
<li>130   White has slight counterplay </li>
<li>131   Black has slight counterplay </li>
<li>132   White has moderate counterplay </li>
<li>133   Black has moderate counterplay </li>
<li>134   White has decisive counterplay </li>
<li>135   Black has decisive counterplay </li>
<li>136   White has moderate time control pressure </li>
<li>137   Black has moderate time control pressure </li>
<li>138   White has severe time control pressure </li>
<li>139   Black has severe time control pressure </li>
</ul>
</cyan>

<p>
Other proposed NAG values for Chess Informant publication symbols include:
</p>
<cyan>
<ul>
<li>140   With the idea ... </li>
<li>141   Aimed against ... </li>
<li>142   Better move </li>
<li>143   Worse move </li>
<li>144   Equivalent move </li>
<li>145   Editor's Remark ("RR") </li>
<li>146   Novelty ("N") </li>
<li>147   Weak point </li>
<li>148   Endgame </li>
<li>149   Line </li>
<li>150   Diagonal </li>
<li>151   White has a pair of Bishops </li>
<li>152   Black has a pair of Bishops </li>
<li>153   Bishops of opposite color </li>
<li>154   Bishops of same color </li>
</ul>
</cyan>

<p>
Other suggested values are:
</p>
<cyan>
<ul>
<li>190   Etc. </li>
<li>191   Doubled pawns </li>
<li>192   Isolated pawn </li>
<li>193   Connected pawns </li>
<li>194   Hanging pawns </li>
<li>195   Backwards pawn </li>
</ul>
</cyan>

<p>
Symbols defined by Scid for its own use are:
</p>
<cyan>
<ul>
<li>201   Diagram ("D", sometimes denoted "#") </li>
</ul>
</cyan>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}


set helpTitle(ECO) "ECO guide"
set helpText(ECO) {<h1>ECO openings classification</h1>
<p>
Scid can classify chess games according to the <b>ECO</b>
(Encyclopedia of Chess Openings) chess openings classification.
An standard ECO code consists of a letter (A..E) followed by two
digits, so there are 500 distinct standard ECO codes.
</p>

<h3>Scid extensions to the ECO system</h3>
<p>
The ECO system is very limited and not sufficient for modern games:
some of the 500 codes are almost never seen any more, while some
are seen very often. To improve this situation, Scid allows an optional
extension to the basic ECO codes: each code can be extended with a
letter (a..z), with a further extension (another digit, 1..4) being
possible but not used in the standard Scid ECO file yet.
So an extended Scid ECO code looks like "<b>A41e</b>" or "<b>E99b2</b>".
Many of the most common ECO codes found in modern master-level games have
extensions defined in the Scid ECO file.
</p>

<h3><name Browser>The ECO Browser window</name></h3>
<p>
The <term>ECO Browser</term> window shows you the positions that are
used to classify each ECO code, and the frequency and performance of
ECO codes in the current database.
</p>
<p>
The upper pane shows the frequency of each ECO code in the current
database. The bars in the graph have three sections: the lowest
(lightest color) is the number of White wins, the middle is the
number of draws, and the highest (darkest) is the number of Black wins.
This lets you see at a glance the characteristics of an opening: for
example, if White is scoring very well, or if draws are very common.
</p>
<p>
To go to a deeper ECO level, click the left mouse button
on a bar in the graph (or type the
letter or digit it corresponds to). To go back to the higher level,
click the right mouse button anywhere in the graph, or press the left
arrow (or delete or backspace) key.
</p>
<p>
The lower pane shows the positions that comprise a particular ECO code,
according to the ECO file you have loaded.
</p>

<h3>Loading the Scid ECO file</h3>
<p>
The ECO file that comes with Scid is called <b>scid.eco</b>,
and Scid tries to load this when it starts up.
If Scid cannot find it, you will need to do the following to enable ECO
classification:
<ul>
<li>(a) In Scid, use the menu command
        <menu>Options: Load ECO file</menu>
        and select the file <b>scid.eco</b>. </li>
<li>(b) Save options (from the <menu>Options</menu> menu). </li>
</ul>
After you do this, the ECO file will be loaded every time you start Scid.
</p>

<h3>ECO code system</h3>
<p>
The basic structure of the ECO system is:
</p>
<p>
<b><blue><run updateEcoWin A>A</run></blue></b>
   1.d4 Nf6 2...;  1.d4 ...;  1.c4;  1.various
<ul>
<li>  <b>A0</b>  1.<i>various</i>
      (<b>A02-A03</b> 1.f4: <i>Bird's Opening</i>,
      <b>A04-A09</b>  1.Nf3: <i>Reti, King's Indian Attack</i>) </li>
<li>  <b>A1</b>  1.c4 ...: <i>English</i> </li>
<li>  <b>A2</b>  1.c4 e5: <i>King's English</i> </li>
<li>  <b>A3</b>  1.c4 c5: <i>English, Symmetrical </i> </li>
<li>  <b>A4</b>  1.d4 ...: <i>Queen's Pawn</i> </li>
<li>  <b>A5</b>  1.d4 Nf6 2.c4 ..: <i>Indian Defence </i> </li>
<li>  <b>A6</b>  1.d4 Nf6 2.c4 c5 3.d5 e6: <i>Modern Benoni</i> </li>
<li>  <b>A7</b>  A6 + 4.Nc3 exd5 5.cxd5 d6 6.e4 g6 7.Nf3 </li>
<li>  <b>A8</b>  1.d4 f5: <i>Dutch Defence</i> </li>
<li>  <b>A9</b>  1.d4 f5 2.c4 e6: <i>Dutch Defence</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin B>B</run></blue></b>
   1.e4 c5;  1.e4 c6;  1.e4 d6;  1.e4 <i>various</i>
<ul>
<li>  <b>B0</b>  1.e4 ...
      (<b>B02-B05</b>  1.e4 Nf6: <i>Alekhine Defence</i>;
      <b>B07-B09</b>  1.e4 d6: <i>Pirc</i>) </li>
<li>  <b>B1</b>  1.e4 c6: <i>Caro-Kann</i> </li>
<li>  <b>B2</b>  1.e4 c5: <i>Sicilian Defence </i> </li>
<li>  <b>B3</b>  1.e4 c5 2.Nf3 Nc6: <i>Sicilian</i> </li>
<li>  <b>B4</b>  1.e4 c5 2.Nf3 e6: <i>Sicilian</i> </li>
<li>  <b>B5</b>  1.e4 c5 2.Nf3 d6: <i>Sicilian</i> </li>
<li>  <b>B6</b>  B5 + 3.d4 cxd4 4.Nxd4 Nf6 5.Nc3 Nc6 </li>
<li>  <b>B7</b>  B5 + 4.Nxd4 Nf6 5.Nc3 g6: <i>Sicilian Dragon</i> </li>
<li>  <b>B8</b>  B5 + 4.Nxd4 Nf6 5.Nc3 e6: <i>Sicilian Scheveningen</i> </li>
<li>  <b>B9</b>  B5 + 4.Nxd4 Nf6 5.Nc3 a6: <i>Sicilian Najdorf</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin C>C</run></blue></b>
   1.e4 e5;  1.e4 e6
<ul>
<li>  <b>C0</b>  1.e4 e6: <i>French Defence</i> </li>
<li>  <b>C1</b>  1.e4 e6 2.d4 d5 3.Nc3: <i>French, Winawer/Classical</i> </li>
<li>  <b>C2</b>  1.e4 e5: <i>Open Game</i> </li>
<li>  <b>C3</b>  1.e4 e5 2.f4: <i>King's Gambit</i> </li>
<li>  <b>C4</b>  1.e4 e5 2.Nf3: <i>Open Game</i> </li>
<li>  <b>C5</b>  1.e4 e5 2.Nf3 Nc6 3.Bc4: <i>Italian; Two Knights</i> </li>
<li>  <b>C6</b>  1.e4 e5 2.Nf3 Nc6 3.Bb5: <i>Spanish (Ruy Lopez)</i> </li>
<li>  <b>C7</b>  1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4: <i>Spanish</i> </li>
<li>  <b>C8</b>  C7 + 4...Nf6 5.O-O: <i>Spanish, Closed and Open</i>
      (<b>C80-C83</b>  5.O-O Nxe4: <i>Spanish, Open System</i>;
      <b>C84-C89</b>  5.O-O Be7: <i>Spanish, Closed System</i>) </li>
<li>  <b>C9</b>  C8 + 5...Be7 6.Re1 b5 7.Bb3 d6: <i>Spanish, Closed</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin D>D</run></blue></b>
   1.d4 d5; 1.d4 Nf6 2.c4 g6 with 3...d5
<ul>
<li>  <b>D0</b>   1.d4 d5: <i>Queen's Pawn</i> </li>
<li>  <b>D1</b>   1.d4 d5 2.c4 c6: <i>Slav Defence</i> </li>
<li>  <b>D2</b>  1.d4 d5 2.c4 dxc4: <i>Queen's Gambit Accepted (QGA)</i> </li>
<li>  <b>D3</b>  1.d4 d5 2.c4 e6: <i>Queen's Gambit Declined (QGD)</i> </li>
<li>  <b>D4</b>  D3 + 3.Nc3 Nf6 4.Nf3 c5/c6: <i>Semi-Tarrasch; Semi-Slav</i> </li>
<li>  <b>D5</b>  D3 + 3.Nc3 Nf6 4.Bg5: <i>QGD Classical</i> </li>
<li>  <b>D6</b>  D5 + 4...Be7 5.e3 O-O 6.Nf3 Nbd7: <i>QGD Orthodox</i> </li>
<li>  <b>D7</b>  1.d4 Nf6 2.c4 g6 with 3...d5: <i>Grunfeld</i> </li>
<li>  <b>D8</b>  1.d4 Nf6 2.c4 g6 3.Nc3 d5: <i>Grunfeld</i> </li>
<li>  <b>D9</b>  1.d4 Nf6 2.c4 g6 3.Nc3 d5 4.Nf3: <i>Grunfeld</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin E>E</run></blue></b>
   1.d4 Nf6 2.c4 e6; 1.d4 Nf6 2.c4 g6 </li>
<ul>
<li>  <b>E0</b>  1.d4 Nf6 2.c4 e6: <i>Catalan, etc</i> </li>
<li>  <b>E1</b>  1.d4 Nf6 2.c4 e6 3.Nf3 (b6): <i>Queen's Indian, etc</i> </li>
<li>  <b>E2</b>  1.d4 Nf6 2.c4 e6 3.Nc3 (Bb4): <i>Nimzo-Indian, etc</i> </li>
<li>  <b>E3</b>  E2 + 4.Bg5 or 4.Qc2: <i>Nimzo-Indian</i> </li>
<li>  <b>E4</b>  E2 + 4.e3: <i>Nimzo-Indian, Rubinstein</i> </li>
<li>  <b>E5</b>  E4 + 4...O-O 5.Nf3: <i>Nimzo-Indian, main line</i> </li>
<li>  <b>E6</b>  1.d4 Nf6 2.c4 g6: <i>King's Indian</i> </li>
<li>  <b>E7</b>  1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.e4: <i>King's Indian</i> </li>
<li>  <b>E8</b>  E7 + 4...d6 5.f3: <i>King's Indian, Samisch</i> </li>
<li>  <b>E9</b>  E7 + 4...d6 5.Nf3: <i>King's Indian, main lines</i> </li>
</ul>

<p><footer>(Updated: Scid 2.5, June 2001)</footer></p>
}


set helpTitle(Author) "Contact information"
set helpText(Author) {<h1>Contact Information</h1>
<p>
The Scid web page is located at: <br>
<b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>
</p>
<p>
It has downloads of the latest version of Scid and any extra
files that are available.
</p>
<p>
Please send any comments, questions, suggestions or bug reports to the
author of Scid, Shane Hudson, at the email address:<br>
<b>shane@cosc.canterbury.ac.nz</b>
</p>

<h3><name Related>Related Links</name></h3>
<p>
If you enjoy using Scid, you may find the following websites interesting:
</p>
<ul>
<li><url http://www.tim-mann.org/chess.html>http://www.tim_mann.org/chess.html</url> --
Home page of Tim Mann's <b>xboard & winboard</b> program which is a PGN
reader and an interface for Internet chess servers. His site also has
good information on Crafty, GNUchess and other free chess programs.</li>

<li><url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url> --
the strong chess-playing program Crafty.
The subdirectory there named <b>TB</b> has many Nalimov-format tablebase
files that you can use in several chess programs and in Scid.</li>

<li><url http://www.chesscenter.com/twic/>http://www.chesscenter.com/twic/</url> --
TWIC (the week in chess), an excellent weekly bulletin of international
chess games in available in PGN format.</li>

<li><url http://scid.sourceforge.net/doc/standard.txt>http://scid.sourceforge.net/doc/standard.txt</url> --
the <b>PGN Standard</b>, created by Steven J. Edwards in 1994.
This text file explains the PGN and EPD formats in detail.</li>
</ul>

<p><footer>(Updated: Scid 2.6, August 2001)</footer></p>
}


namespace eval ::tip {}

proc ::tip::show {{n -1}} {
  global tips language
  set w .tipsWin

  if {! [winfo exists .tipsWin]} {
    toplevel $w
    wm title $w "Scid: [tr HelpTip]"
    pack [frame $w.b] -side bottom -fill x
    text $w.text -background gray95 -foreground black \
      -cursor top_left_arrow -width 40 -height 8 -setgrid 1 \
      -yscrollcommand "$w.ybar set" -wrap word
    ::htext::init $w.text
    scrollbar $w.ybar -command "$w.text yview"
    pack $w.ybar -side right -fill y
    pack $w.text -side left -fill both -expand 1
    checkbutton $w.b.start -textvar ::tr(TipAtStartup) -font font_Small \
      -variable startup(tip)
    button $w.b.prev -text "<" -font font_Small
    button $w.b.next -text ">" -font font_Small
    button $w.b.close -textvar ::tr(Close) -font font_Small \
      -command "destroy $w"
    pack $w.b.start -side left -padx 2
    pack $w.b.close $w.b.next $w.b.prev -side right -padx 2

    bind $w <Up> "$w.text yview scroll -1 units"
    bind $w <Down> "$w.text yview scroll 1 units"
    bind $w <Prior> "$w.text yview scroll -1 pages"
    bind $w <Next> "$w.text yview scroll 1 pages"
    bind $w <Key-Home> "$w.text yview moveto 0"
    bind $w <Key-End> "$w.text yview moveto 0.99"
    bind $w <Escape> "$w.b.close invoke"
    centreWin $w
    raiseWin $w
    focus $w
  }
  $w.text configure -state normal
  $w.text delete 1.0 end
  if {[info exists tips($language)]} {
    set tiplist $tips($language)
  } else {
    set tiplist $tips(E)
  }

  set ntips [llength $tiplist]
  if {$n < 0} {
    set n [expr int(double($ntips) * rand())]
  }
  set prev [expr $n - 1]
  if {$prev < 0} {set prev [expr $ntips - 1]}
  set next [expr ($n + 1) % $ntips]
  $w.b.prev configure -command "::tip::show $prev"
  $w.b.next configure -command "::tip::show $next"
  set tip "<center><b>$::tr(Tip) [expr $n + 1]:</b></center><br><br>"
  append tip [string trim [lindex $tiplist $n]]
  if {$::hasEncoding  &&  $::langEncoding($language) != ""} {
    # Convert tip charset, e.g. from is08859-2 coding:
    catch {set tip [encoding convertfrom $::langEncoding($language) $tip]}
  }
  ::htext::display $w.text $tip "" 0
}

set tips(E) {
  {
    Scid has over 30 <a Index>help pages</a>, and in most Scid windows
    pressing the <b>F1</b> key will produce the help page about that
    window.
  }
  {
    Some Scid windows (e.g. the game information area, database
    <a Switcher>switcher</a>) have a right-mouse button menu. Try
    pressing the right mouse button in each window to see if it has
    one and what functions are available.
  }
  {
    Scid offers you more than one way to enter chess moves, letting
    you choose which suits you best. You can use the mouse
    (with or without move suggestion) or the keyboard
    (with or without move completion). Read the
    <a Moves>entering chess moves</a> help page for details.
  }
  {
    If you have a few databases that you open often, add a
    <a Bookmarks>bookmark</a> for each one, and then you will be able
    to open them faster using the bookmarks menu.
  }
  {
    You can see all the moves of the current game
    (with any variations and comments) using the <a PGN>PGN window</a>.
    In the PGN window, you can go to any move by clicking
    the left mouse button on it, or use the middle or right mouse button
    to see a preview of that position.
  }
  {
    You can copy games from one database to another using drag and drop
    with the left mouse button in the <a Switcher>database switcher</a> window.
  }
  {
    Scid can open PGN files, even if they are compressed with Gzip
    (with a .gz filename suffix). PGN files are opened read-only, so
    if you want to edit a PGN file in Scid, create a new Scid database
    and copy the PGN file games to it using the
    <a Switcher>database switcher</a>.
  }
  {
    If you have a large database you use with the <a Tree>tree</a> window
    often, it is worth selecting <b>Fill cache file</b> from the tree
    window File menu. This will remember tree statistics for many common
    opening positions, making tree access faster for the database.
  }
  {
    The <a Tree>tree</a> window can show you all moves played from the
    current position, but if you also want to see all the move orders
    that reached this position, you can find them by generating
    an <a OpReport>opening report</a>.
  }
  {
    In the <a GameList>game list</a> window, press the left or right mouse
    button on the heading of each column to adjust its width.
  }
  {
    With the <a PInfo>player information</a> window (just click on either
    player name in the game info area below the main window chessboard
    to open it), you can easily set the <a Searches Filter>filter</a> to
    contain all games by a certain player with a certain result by
    clicking on any value that is displayed <red>in red text</red>.
  }
  {
    When studying an opening, it can be very useful to do a
    <a Searches Board>board search</a> with the <b>Pawns</b> or
    <b>Files</b> option on an important opening position, as this may
    reveal other openings that reach the same pawn structure.
  }
  {
    In the game information area (below the chessboard), you can press
    the right mouse button to produce a menu for customising it. For
    example, you can make Scid hide the next move which is useful for
    training by playing though a game guessing the moves.
  }
  {
    If you often do a lot of database <a Maintenance>maintenance</a> on
    a large database, you can do several maintenance jobs at once using
    the <a Maintenance Cleaner>cleaner</a>.
  }
  {
    If you have a large database where most games have an EventDate and
    you want the games in date order, consider <a Sorting>sorting</a> it
    by EventDate then Event instead of Date then Event, as this will
    help to keep games in the same tournament with different dates
    together (assuming they all have the same EventDate, of course).
  }
  {
    Before <a Maintenance Twins>deleting twin games</a>, it is a good idea
    to <a Maintenance Spellcheck>spellcheck</a> your database since this
    will enable to Scid find more twins and mark them for deletion.
  }
  {
    <a Flags>Flags</a> are useful for marking database games with
    characteristics you may want to search for at a later time, such
    as pawn structure, tactics, etc. You can search by flags with a
    <a Searches Header>header search</a>.
  }
  {
    If you are playing through a game and want to try out some moves
    without altering the game, simply turn on Trial mode (with the
    <b>Ctrl+space</b> shortcut or from the toolbar icon), then turn it off
    again to return to the original game when you are done.
  }
  {
    To find the most prominent games (with high-rated opponents)
    reaching a particular position, open the <a Tree>tree</a> window
    and from there, open the best games list. You can even restrict
    the best games list to show only games with a particular result.
  }
  {
    A great way to study an opening using a large database of games is
    to turn on training mode in the <a Tree>tree</a> window, then play
    against the database to see which lines occur often.
  }
  {
    If you have two databases open, and want to see <a Tree>tree</a>
    statistics of the first database while examining a game from the
    second database, just press the <b>Lock</b> button in the tree
    window to lock it to the first database and then switch to the
    second base.
  }
  {
    The <a Tmt>tournament finder</a> is not only useful for finding
    a particular tournament, but can also be used to see what tournaments
    a certain player has competed in recently or browse the top
    tournaments played in a particular country.
  }
  {
    There are a number of common patterns defined in the
    <a Searches Material>Material/Pattern</a> search window that you
    may find useful for openings or middlegame study.
  }
  {
    When searching for a particular material situation in the
    <a Searches Material>Material/Pattern</a> search window, it is
    often useful to restrict the search to games that match for at
    least a few half-moves to eliminate games where the searched-for
    situation only occurred briefly.
  }
  {
    If you have an important database you do not want to accidentally
    alter, select <b>Read-only...</b> from the <b>File</b> menu after
    opening it, or change its file permissions to be read-only.
  }
  {
    If you use XBoard or WinBoard (or some other chess program that
    can copy a chess position in standard FEN notation to the clipboard)
    and want to copy its current chess position to Scid, the fastest and
    easiest way is to select <b>Copy Position</b> from the File menu in
    XBoard/WinBoard, then <b>Paste start board</b> from the Edit menu
    in Scid.
  }
  {
    In a <a Searches Header>header search</a>, player/event/site/round
    names are case-insensitive and match anywhere in a name. You can choose
    to do a case-sensitive wildcard search instead
    (where "?" = any single character and "*" = zero or more characters)
    by entering the search text "in quotes". For example, type "*BEL"
    (with the quote characters) in the site field to find all games played
    in Belgium but not Belgrade.
  }
  {
    If you want to correct a move in a game without losing all the moves
    played after it, open the <a Import>Import</a> window, press the
    <b>Paste current game</b> button, edit the incorrect move and then
    press <b>Import</b>.
  }
  {
    If you have an ECO classification file loaded, you can go to the
    deepest classified position in the current game with
    <b>Identify opening</b> in the <b>Game</b> menu
    (shortcut: Ctrl+Shift+D).
  }
  {
    If you want to check the size of a file or its date of last modification
    before opening it, use the <a Finder>file finder</a> to open it.
  }
  {
    A <a Repertoire>repertoire</a> file is a great way to keep track of
    your favourite opening lines, and also find games where those lines
    were played. Once you have your openings stored in a repertoire file,
    you can do a repertoire search every time you get a new file of
    games and browse the games that feature your favourite openings.
  }
  {
    An <a OpReport>opening report</a> is great for learning more about
    a particular position. You can see how well it scores, whether it
    leads to frequent short draws, and common positional themes.
  }
  {
    You can add the most common annotation symbols (!, !?, +=, etc) to the
    current move or position with keyboard shortcuts without needing to
    use the <a Comment>comment editor<a> -- for example, type "!" then
    the Return key to add a "!" annotation symbol. See the
    <a Moves>Entering chess moves</a> help page for details.
  }
  {
    If you are browsing openings in a database with the <a Tree>tree</a>,
    you can see a useful overview of how well the current opening is
    scoring recently and between high-rated players by opening the
    Statistics window (shortcut: Ctrl+I).
  }
  {
    You can change the main window board size by holding down the <b>Ctrl</b>
    and <b>Shift</b> keys, and pressing the <b>Left</b> or <b>Right</b>
    arrow key.
  }
  {
    After a <a Searches>search</a>, you can easily browse through all
    the matching games by holding down <b>Ctrl</b> and pressing the
    <b>Up</b> or <b>Down</b> key to load the previous or next
    <a Searches Filter>filter</a> game.
  }
}
###
### misc.tcl: part of Scid.
### Copyright (C) 2001  Shane Hudson.
###
### Miscellaneous routines called by other Tcl functions

namespace eval ::date {}

# ::date::today:
#   Returns todays date, in "yyyy.mm.dd" format.
#   The optional parameter "year", "month" or "day" can be used to
#   limit the returned value to just the year, month or day.
#
proc ::date::today {{type all}} {
  set timeNow [clock seconds]
  set year [clock format $timeNow -format "%Y"]
  set month [clock format $timeNow -format "%m"]
  set day [clock format $timeNow -format "%d"]
  switch -- $type {
    "all"   { return [format "%s.%s.%s" $year $month $day] }
    "year"  { return $year }
    "month" { return $month }
    "day"   { return $day }
    default { error "Unrecognised parameter: $type" }
  }
}

image create photo calendar -data {
R0lGODdhFgAUAMIAANnZ2VFR+wAAAP////oTQP//AAAAAAAAACwAAAAAFgAUAAADTwi63A4h
yklrVAFruDO0lCCO5NMIw4CqqWAya9ySdG3LbI7He+vrsxthSLiJfitCoUBAzpwDJRNqFBCL
RqpW1QN6q+DRdrfomsvh2mvtSAAAOw==
}

#::date::chooser:
#   Produce a date-selection dialog box.
#   Originally based on code from Effective Tcl/Tk Programming by
#   Mark Harrison, but with lots of changes and improvements.
#
proc ::date::chooser {{date "now"}} {
  set time [clock seconds]
  if {$date != "now"} {
    catch {set time [clock scan $date]}
  }
  set ::date::_time $time
  set ::date::_selected [clock format $time -format "%Y-%m-%d"]

  set win .dateChooser
  toplevel $win
  canvas $win.cal -width 300 -height 220
  pack [frame $win.b] -side bottom -fill x
  button $win.b.ok -text "OK" -command "destroy $win"
  button $win.b.cancel -text $::tr(Cancel) -command "
    set ::date::_selected {}
    destroy $win"
  pack $win.b.cancel $win.b.ok -side right -padx 5 -pady 5
  pack $win.cal -side top -expand yes -fill both

  button $win.cal.prevY -image tb_start -command "::date::_month $win -12"
  button $win.cal.prev -image tb_prev -command "::date::_month $win -1"
  button $win.cal.next -image tb_next -command "::date::_month $win +1"
  button $win.cal.nextY -image tb_end -command "::date::_month $win +12"
  bind $win.cal <Configure> "::date::_redraw $win"
  bind $win.cal <Double-Button-1> "destroy $win"
  bind $win <Escape> "$win.b.cancel invoke"
  bind $win <Return> "$win.b.ok invoke"
  bind $win <Prior> "$win.cal.prev invoke"
  bind $win <Next> "$win.cal.next invoke"
  bind $win <Shift-Prior> "$win.cal.prevY invoke"
  bind $win <Shift-Next> "$win.cal.nextY invoke"
  bind $win <Up> "::date::_day $win -7"
  bind $win <Down> "::date::_day $win +7"
  bind $win <Left> "::date::_day $win -1"
  bind $win <Right> "::date::_day $win +1"

  wm minsize $win 250 200
  wm title $win "Scid: Choose Date"
  focus $win
  grab $win
  tkwait window $win
  if {$::date::_selected == ""} { return {} }
  set time [clock scan $::date::_selected]
  return [list \
          [clock format $time -format "%Y"] \
          [clock format $time -format "%m"] \
          [clock format $time -format "%d"] \
         ]
}

proc ::date::_day {win delta} {
  set unit "day"
  if {$delta < 0} {set unit "day ago"}
  set time [clock scan "[expr abs($delta)] $unit" -base $::date::_time]
  set day [string trimleft [clock format $time -format "%d"] 0]
  set month [string trimleft [clock format $time -format "%m"] 0]
  set year [clock format $time -format "%Y"]
  ::date::_select $win "$year-$month-$day"
}

proc ::date::_month {win delta} {
  set dir [expr ($delta > 0) ? 1 : -1]
  set day [string trimleft [clock format $::date::_time -format "%d"] 0]
  set month [string trimleft [clock format $::date::_time -format "%m"] 0]
  set year [clock format $::date::_time -format "%Y"]

  for {set i 0} {$i < abs($delta)} {incr i} {
    incr month $dir
    if {$month < 1} {
      set month 12
      incr year -1
    } elseif {$month > 12} {
      set month 1
      incr year 1
    }
  }
  if {[catch {::date::_select $win "$year-$month-$day"}]} {
    ::date::_select $win "$year-$month-28"
  }
}

proc ::date::_redraw {win} {
  $win.cal delete all
  set time $::date::_time
  set wmax [winfo width $win.cal]
  set hmax [winfo height $win.cal]

  $win.cal create window 3 3 -anchor nw -window $win.cal.prevY
  $win.cal create window 40 3 -anchor nw -window $win.cal.prev
  $win.cal create window [expr $wmax-43] 3 -anchor ne -window $win.cal.next
  $win.cal create window [expr $wmax-3] 3 -anchor ne -window $win.cal.nextY
  set bottom [lindex [$win.cal bbox all] 3]

  set month [string trimleft [clock format $time -format "%m"] 0]
  set year [clock format $time -format "%Y"]
  $win.cal create text [expr $wmax/2] $bottom -anchor s -font font_Bold \
    -text "[lindex $::tr(Months) [expr $month - 1]] $year"

  incr bottom 3
  $win.cal create line 0 $bottom $wmax $bottom -width 2
  incr bottom 25

  set current ""

  set layout [::date::_layout $time]
  set weeks [expr [lindex $layout end]+1]

  for {set day 0} {$day < 7} {incr day} {
    set x0 [expr $day*($wmax-7)/7+3]
    set x1 [expr ($day+1)*($wmax-7)/7+3]
    $win.cal create text [expr ($x1+$x0)/2] $bottom -anchor s \
      -text [lindex $::tr(Days) $day] -font font_Small
  }
  incr bottom 3

  foreach {day date dcol wrow} $layout {
    set x0 [expr $dcol*($wmax-7)/7+3]
    set y0 [expr $wrow*($hmax-$bottom-4)/$weeks+$bottom]
    set x1 [expr ($dcol+1)*($wmax-7)/7+3]
    set y1 [expr ($wrow+1)*($hmax-$bottom-4)/$weeks+$bottom]

    if {$date == $::date::_selected} {set current $date}

    $win.cal create rectangle $x0 $y0 $x1 $y1 -outline black -fill white

    $win.cal create text [expr $x0+4] [expr $y0+2] -anchor nw -text "$day" \
      -fill black -font font_Small -tags [list $date-text all-text]

    $win.cal create rectangle $x0 $y0 $x1 $y1 \
      -outline "" -fill "" -tags [list $date-sensor all-sensor]

    $win.cal bind $date-sensor <ButtonPress-1> "::date::_select $win $date"
  }

  if {$current != ""} {
    $win.cal itemconfigure $current-sensor -outline red -width 3
    $win.cal raise $current-sensor
  } elseif {$::date::_selected == ""} {
    set date [clock format $time -format "%Y-%m-%d"]
    ::date::_select $win $date
  }
}

proc ::date::_layout {time} {
  set month [string trimleft [clock format $time -format "%m"] 0]
  set year  [clock format $time -format "%Y"]

  foreach lastday {31 30 29 28} {
    if {[catch {clock scan "$year-$month-$lastday"}] == 0} { break }
  }
  set seconds [clock scan "$year-$month-1"]
  set firstday [clock format $seconds -format %w]
  set weeks [expr ceil(double($lastday+$firstday)/7)]

  set rlist ""
  for {set day 1} {$day <= $lastday} {incr day} {
    set seconds [clock scan "$year-$month-$day"]
    set date [clock format $seconds -format "%Y-%m-%d"]
    set daycol [clock format $seconds -format %w]
    set weekrow [expr ($firstday+$day-1)/7]
    lappend rlist $day $date $daycol $weekrow
  }
  return $rlist
}

proc ::date::_select {win date} {
  set time [clock scan $date]
  set date [clock format $time -format "%Y-%m-%d"]

  set currentMonth [clock format $::date::_time -format "%m %Y"]
  set selectedMonth [clock format $time -format "%m %Y"]
  set ::date::_time $time
  set ::date::_selected $date

  if {$currentMonth == $selectedMonth} {
    $win.cal itemconfigure all-sensor -outline "" -width 1
    $win.cal itemconfigure $date-sensor -outline red -width 3
    $win.cal raise $date-sensor
  } else {
    ::date::_redraw $win
  }
}


# centreWin:
#   Centers a window on the screen.
#
proc centreWin {w} {
  wm withdraw $w
  update idletasks
  set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
                 - [winfo vrootx .]}]
  set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
                 - [winfo vrooty .]}]
  wm geom $w +$x+$y
  wm deiconify $w
}

# plural:
#   Returns "s" if the number is > 1, "" otherwise.
#   Useful for printing values, e.g. "$value game[plural $value]"
#   will yield "1 game" or "2 games".
#
proc plural {n} {
  if {$n == 1} { return "" }
  return "s"
}

# thousands, percentFormat:
#   Functions to format integer numbers.
#   thousands inserts the thousands separator (usually "," or ".") for
#   every three digits before the decimal separator in the number.
#   percentFormat does the same as thousands, but also adds a percentage.
#   If "kilo" is nonzero, numbers >= $kilo are divided by 1000 and have
#   the unit "K" appended.
#
proc thousands {n {kilo 0}} {
  global locale
  set commaChar [string index $locale(numeric) 1]
  set unit ""
  if {$kilo > 0  &&  $n >= $kilo} {
    set unit "K"
    set n [expr int($n / 1000)]
  }
  if {$commaChar == ""} { return "$n$unit" }
  while {[regsub {^([-+]?[0-9]+)([0-9][0-9][0-9])} $n "\\1$commaChar\\2" n]} {}
  return "$n$unit"
}

proc percentFormat {num denom} {
  # Ensure denominator is not zero:
  if {$denom == 0} {set denom 1}
  return "[thousands $num] ([expr $num * 100 / $denom]%)"
}

# pad:
#   Given a string and a length, pads the string with padChar to have
#   the required length.
#
proc pad {str length {padChar " "}} {
  set s $str
  for {set actual [string length $s]} {$actual < $length} {incr actual} {
    append s $padChar
  }
  return $s
}

# padR:
#   Like pad, but adds the padding characters to the start of the string.
#
proc padR {str length {padChar " "}} {
  set s $str
  for {set actual [string length $s]} {$actual < $length} {incr actual} {
    set s "$padChar$s"
  }
  return $s
}

# padC:
#   Like pad and padR, but centers the specified string.
#
proc padC {str length {padChar " "}} {
  set pre 1
  set s $str
  for {set actual [string length $s]} {$actual < $length} {incr actual} {
    if {$pre} {
      set s "$padChar$s"
      set pre 0
    } else {
      append s $padChar
      set pre 1
    }
  }
  return $s
}

# capital:
#    Returns a string with the first character capitalised.
#
proc capital {str} {
  set s [string toupper [string index $str 0]]
  append s [string range $str 1 end]
  return $s
}


# bindFocusColors:
#   Configures a text or entry widget so it turns lightYellow when it
#   gets the focus, and turns white again when it loses focus.
#
proc bindFocusColors {w {inColor lightYellow} {outColor white}} {
  $w configure -background white
  bind $w <FocusIn> "$w configure -background $inColor"
  bind $w <FocusOut> "$w configure -background $outColor"
}


# busyCursor, unbusyCursor:
#   Sets all cursors to watch (indicating busy) or back to their normal
#   setting again.

array set scid_busycursor {}
set scid_busycursorState 0

proc doBusyCursor {w flag} {
  global scid_busycursor
  if {! [winfo exists $w]} { return }
  # The comment editor window "flashes" when its cursor is changed,
  # no idea why but skip over it:
  if {$w == ".commentWin"} { return }
  if {$w == ".menu"} { return }

  if {$flag} {
    set scid_busycursor($w) [$w cget -cursor]
    catch {$w configure -cursor watch}
  } else {
    catch {$w configure -cursor $scid_busycursor($w)} err
  }
  foreach i [winfo children $w] { doBusyCursor $i $flag }
}

proc busyCursor {w {flag 1}} {
  global scid_busycursor scid_busycursorState
  if {$scid_busycursorState == $flag} { return }
  set scid_busycursorState $flag
  doBusyCursor $w $flag
}

proc unbusyCursor {w} {busyCursor $w 0}


# addHorizontalRule, addVerticalRule
#   Add a horizontal/vertical rule frame to a window.
#   The optional parameters [x/y]padding and sunken allow the spacing and
#   appearance of the rule to be specified.
#
set horizRuleCounter 0
set vertRuleCounter 0

proc addHorizontalRule {w {ypadding 5} {relief sunken} {height 2} } {
  global horizRuleCounter
  set f [ frame $w.line$horizRuleCounter -height $height -borderwidth 2 \
            -relief $relief -background white ]
  pack $f -fill x -pady $ypadding
  incr horizRuleCounter
  return $f
}

proc addVerticalRule {w {xpadding 5} {relief sunken}} {
  global vertRuleCounter
  set f [ frame $w.line$vertRuleCounter -width 2 -borderwidth 2 \
            -relief $relief -background white ]
  pack $f -fill y -padx $xpadding -side left
  incr vertRuleCounter
  return $f
}


## Variable tracing:

# forceInt:
#   Used to check the size of integers in entry boxes.
#
proc forceInt {maxValue allowQuestionMarks name el op} {
  global $name ${name}_old
  if {[string comp {} $el]} {
    set old  ${name}_old\($el\)
    set name $name\($el\)
  } else {
    set old ${name}_old
  }

  if {$allowQuestionMarks > 0} {
    if {[regexp {^\?*$} [set $name]]} {
      # Accept this value:
      set $old [set $name]
      return
    }
  }

  # Only non-negative integers up to maxValue are allowed, unless the
  # value is negative:
  set allowNegatives 0
  if {$maxValue < 0} {
    set allowNegatives 1
    set maxValue [expr 0 - $maxValue]
  }

  if {$allowNegatives} {
    if {![regexp {^[-+]?[0-9]*$} [set $name]]} {
      set $name [set $old]
      bell
      return
    }
  } else {
    if {![regexp {^[+]?[0-9]*$} [set $name]]} {
      set $name [set $old]
      bell
      return
    }
  }
  if {[set $name] > $maxValue} {
    set $name [set $old]
    bell
    return
  }
  #if {[expr {0 - [set $name]}] < [expr {0 - $maxValue}]} {
  #  set $name [set $old]
  #  bell
  #  return
  #}
  set $old [set $name]
}

# forceDate:
#    Used to check the validity of a date string as it is entered.
#
proc forceDate {name el op} {
  global $name ${name}_old
  set old ${name}_old
  if {![sc_info validDate [set $name]]} {
    set $name [set $old]
    bell
    return
  }
  set $old [set $name]
}

# forceResult:
#    Used to check the validity of a result entrybox value.
#    Result can be empty, "1", "0", "=", or "*".
#
proc forceResult {name el op} {
  global $name ${name}_old
  set old ${name}_old
  if {![regexp {^[1|0|=|\*]?$} [set $name]]} {
    set $name [set $old]
    bell
    return
  }
  set $old [set $name]
}

# forceAlpha:
#    Used to check that an entrybox contains only letters.
proc forceAlpha {name el op} {
  global $name ${name}_old
  set old ${name}_old
  if {![regexp {^[A-Za-z]*$} [set $name]]} {
    set $name [set $old]
    bell
    return
  }
  set $old [set $name]

}

# forceRegexp:
#    Used to check the validity of an entrybox given a regular expression.
#    Used to verify a file is "a-h", for example.
#
proc forceRegexp {expression name el op} {
  global $name ${name}_old
  set old ${name}_old
  if ![regexp $expression [set $name]] {
    set $name [set $old]
    bell
    return
  }
  set $old [set $name]
}


# progressWindow:
#   Creates a window with a label, progress bar, and (if specified),
#   a cancel button and cancellation command.
#
proc progressWindow {args} {
  set w .progressWin
  if {[winfo exists $w]} { return }
  toplevel $w
  wm withdraw $w
  wm resizable $w 0 0
  if {[llength $args] == 2} {
    set title [lindex $args 0]
    set text [lindex $args 1]
    set b 0
  } elseif {[llength $args] == 4} {
    set title [lindex $args 0]
    set text [lindex $args 1]
    set button [lindex $args 2]
    set command [lindex $args 3]
    set b 1
  } else { return }
  wm title $w $title
  label $w.t -text $text
  pack $w.t -side top
  canvas $w.c -width 400 -height 20 -bg white -relief solid -border 1
  $w.c create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.c create text 395 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"
  pack $w.c -side top -pady 10
  if {$b} {
    pack [frame $w.b] -side bottom -fill x
    button $w.b.cancel -text $button -command $command
    pack $w.b.cancel -side right -padx 5 -pady 2
  }
  # Set up geometry for middle of screen:
  set x [winfo screenwidth $w]
  set x [expr $x - 400]
  set x [expr $x / 2]
  set y [winfo screenheight $w]
  set y [expr $y - 20]
  set y [expr $y / 2]
  wm geometry $w +$x+$y
  sc_progressBar $w.c bar 401 21 time
  update idletasks
  wm deiconify $w
  raiseWin $w
  if {$b} {
    grab $w.b.cancel
  } else {
    grab $w
  }
  bind $w <Visibility> "raiseWin $w"
  set ::progressWin_time [clock seconds]
}

proc leftJustifyProgressWindow {} {
  set w .progressWin
  if {! [winfo exists $w]} { return }
  pack configure $w.t -fill x
  $w.t configure -width 1 -anchor w
}

proc changeProgressWindow {newtext} {
  set w .progressWin
  if {[winfo exists $w]} { 
    $w.t configure -text $newtext
    update idletasks
  }
}

proc resetProgressWindow {} {
  set w .progressWin
  set ::progressWin_time [clock seconds]
  if {[winfo exists $w]} { 
    $w.c coords bar 0 0 0 0
    $w.c itemconfigure time -text "0:00 / 0:00"
    update idletasks
  }
}

proc updateProgressWindow {done total} {
  set w .progressWin
  if {! [winfo exists $w]} { return }
  set elapsed [expr [clock seconds] - $::progressWin_time]
  set width 401
  if {$total > 0} { 
    set width [expr int(double($width) * double($done) / double($total))]
  }
  $w.c coords bar 0 0 $width 21
  set estimated $elapsed
  if {$done != 0} {
    set estimated [expr int(double($elapsed) * double($total) / double($done))]
  }
  set t [format "%d:%02d / %d:%02d" \
           [expr $elapsed / 60] [expr $elapsed % 60] \
           [expr $estimated / 60] [expr $estimated % 60]]
  $w.c itemconfigure time -text $t
  update
}

proc closeProgressWindow {} {
  set w .progressWin
  if {! [winfo exists $w]} {
    # puts stderr "Hmm, no progress window -- bug?"
    return
  }
  grab release $w
  destroy $w
}


# The following paned window code is from the book:
#
#  Effective Tcl/Tk Programming
#     Mark Harrison, DSC Communications Corp.
#     Michael McLennan, Bell Labs Innovations for Lucent Technologies
#     Addison-Wesley Professional Computing Series
#  Copyright (c) 1996-1997  Lucent Technologies Inc. and Mark Harrison
#
# Some modifications and improvements for use in Scid have been made,
# including namespacing the code.
#
#  -- Shane Hudson, February 2000.

namespace eval ::pane {}
array set ::pane::_data {}

proc ::pane::create {win pane1 pane2 width height {ratio 0.5} {orient vert}} {
  set ::pane::_data($win,1) $pane1
  set ::pane::_data($win,2) $pane2
  set ::pane::_data($win,drag) 1
  set vertical 1
  if {[string index $orient 0] == "h"} { set vertical 0 }
  set ::pane::_data($win,vertical) $vertical
  # Default minimum size of each frame is 10%:
  set ::pane::_data($win,min) 0.1
  set ::pane::_data($win,max) 0.9

  frame $win -width $width -height $height
  frame $win.$pane1
  frame $win.$pane2
  if {$vertical} {
    place $win.$pane1 -relx 0.5 -rely 0 -anchor n -relwidth 1.0 -relheight 0.5
    place $win.$pane2 -relx 0.5 -rely 1 -anchor s -relwidth 1.0 -relheight 0.5

    frame $win.pane_sash -height 1 -borderwidth 1 -relief flat \
      -cursor sb_v_double_arrow -background black
    place $win.pane_sash -relx 0.5 -rely 0.5 -relwidth 1.0 -anchor c

    frame $win.pane_grip -width 20 -height 7 -borderwidth 1 -relief solid \
      -cursor sb_v_double_arrow -background gray
    place $win.pane_grip -relx 0.95 -rely 0.5 -anchor c
  } else {
    place $win.$pane1 -relx 0 -rely 0.5 -anchor w -relwidth 0.5 -relheight 1.0
    place $win.$pane2 -relx 1 -rely 0.5 -anchor e -relwidth 0.5 -relheight 1.0

    frame $win.pane_sash -width 1 -borderwidth 1 -relief flat \
      -cursor sb_h_double_arrow -background black
    place $win.pane_sash -relx 0.5 -rely 0.5 -relheight 1.0 -anchor c

    frame $win.pane_grip -height 20 -width 7 -borderwidth 1 -relief solid \
      -cursor sb_h_double_arrow -background gray
    place $win.pane_grip -relx 0.5 -rely 0.95 -anchor c
  }

  #bind $win.pane_grip <Enter>           "::pane::enter $win"
  #bind $win.pane_grip <Leave>           "::pane::leave $win"
  #bind $win.pane_sash <Enter>           "::pane::enter $win"
  #bind $win.pane_sash <Leave>           "::pane::leave $win"

  if {$vertical} { set c "%Y" } else { set c "%X" }
  bind $win.pane_grip <ButtonPress-1>   "::pane::grab $win"
  bind $win.pane_grip <B1-Motion>       "::pane::drag $win $c"
  bind $win.pane_grip <ButtonRelease-1> "::pane::drop $win $c"
  bind $win.pane_sash <ButtonPress-1>   "::pane::grab $win"
  bind $win.pane_sash <B1-Motion>       "::pane::drag $win $c"
  bind $win.pane_sash <ButtonRelease-1> "::pane::drop $win $c"

  ::pane::divide $win $ratio
  return $win
}

proc ::pane::setdrag {win bool} {
  set ::pane::_data($win,drag) $bool
}

proc ::pane::range {win min max} {
  set ::pane::_data($win,min) $min
  set ::pane::_data($win,max) $max
}

proc ::pane::enter {win} {
  $win.pane_sash configure -background yellow
  $win.pane_grip configure -background yellow
}

proc ::pane::leave {win} {
  $win.pane_sash configure -background black
  $win.pane_grip configure -background black
}

proc ::pane::grab {win} {
  $win.pane_sash configure -background red
  $win.pane_grip configure -background red
}

proc ::pane::drag {win y} {
  set vertical $::pane::_data($win,vertical)
  if {$vertical} {
    set realY [expr $y-[winfo rooty $win]]
    set Ymax  [winfo height $win]
  } else {
    set realY [expr $y-[winfo rootx $win]]
    set Ymax  [winfo width $win]
  }
  set frac [expr double($realY)/$Ymax]
  if {$frac < $::pane::_data($win,min)} {set frac $::pane::_data($win,min)}
  if {$frac > $::pane::_data($win,max)} {set frac $::pane::_data($win,max)}

  if {$::pane::_data($win,drag)} {
    ::pane::divide $win $frac
  } else {
    if {$vertical} {
      place $win.pane_sash -rely $frac
      place $win.pane_grip -rely $frac
    } else {
      place $win.pane_sash -relx $frac
      place $win.pane_grip -relx $frac
    }
  }
  return $frac
}

proc ::pane::drop {win y} {
  set frac [::pane::drag $win $y]
  ::pane::divide $win $frac
  $win.pane_sash configure -background black
  $win.pane_grip configure -background gray
}

proc ::pane::divide {win frac} {
  if {$::pane::_data($win,vertical)} {
    place $win.pane_sash -rely $frac
    place $win.pane_grip -rely $frac
    place $win.$::pane::_data($win,1) -relheight $frac
    place $win.$::pane::_data($win,2) -relheight [expr 1-$frac]
  } else {
    place $win.pane_sash -relx $frac
    place $win.pane_grip -relx $frac
    place $win.$::pane::_data($win,1) -relwidth $frac
    place $win.$::pane::_data($win,2) -relwidth [expr 1-$frac]
  }
}


###
### search.tcl: Search routines for Scid.
###

# searchType: set to Header or Material in a SearchOptions file
set searchType 0


# search_addFilterOpFrame:
#   Adds a search filter operation selection frame to the window.
#   Adds a frame of radiobuttons allowing the filter operation
#   (AND with current filter, OR with current filter, or RESET filter)
#   to be chosen.
#   The default value for the first search is RESET:
set filterOp 2

proc search_addFilterOpFrame {w {small 0}} {
  global filterOp
  frame $w.filterop
  set f $w.filterop
  pack $f -side top
  set regular font_Regular
  set bold font_Bold
  if {$small} {
    set regular font_Small
    set bold font_SmallBold
  }
  label $f.title -font $bold -textvar ::tr(FilterOperation)
  radiobutton $f.and -textvar ::tr(FilterAnd) -variable filterOp \
    -value 0 -indicatoron 0 -pady 5 -padx 5 -font $regular
  radiobutton $f.or -textvar ::tr(FilterOr) -variable filterOp \
    -value 1 -indicatoron 0 -pady 5 -padx 5 -font $regular
  radiobutton $f.ignore -textvar ::tr(FilterIgnore) -variable filterOp \
    -value 2 -indicatoron 0 -pady 5 -padx 5 -font $regular
  pack $f.title -side top
  pack $f.and $f.or $f.ignore -side left
}


########################################
### BOARD searching

set searchInVars 0
set sBoardIgnoreCols 0
set sBoardSearchType Exact

# searchBoard:
#   Searches for the current board position.
#
proc searchBoard {} {
  global glstart filterOp searchInVars sBoardType sBoardIgnoreCols

  set w .sb
  if {[winfo exists $w]} {
    wm deiconify $w
    raiseWin $w
    return
  }

  toplevel $w
  wm title $w "Scid: $::tr(BoardSearch)"

  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.search invoke"
  bind $w <F1> { helpWindow Searches Board }

  label $w.type -textvar ::tr(SearchType) -font font_Bold
  pack $w.type -side top
  pack [frame $w.g] -side top -fill x
  radiobutton $w.g.exact -textvar ::tr(SearchBoardExact) \
    -variable sBoardSearchType -value Exact
  radiobutton $w.g.pawns -textvar ::tr(SearchBoardPawns) \
    -variable sBoardSearchType -value Pawns
  radiobutton $w.g.files -textvar ::tr(SearchBoardFiles) \
    -variable sBoardSearchType -value Fyles
  radiobutton $w.g.material -textvar ::tr(SearchBoardAny) \
    -variable sBoardSearchType -value Material
  set row 0
  foreach i {exact pawns files material} {
    grid $w.g.$i -row $row -column 0 -sticky w
    incr row
  }
  addHorizontalRule $w

  search_addFilterOpFrame $w
  addHorizontalRule $w

  ### Progress bar:

  canvas $w.progress -height 20 -width 300 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  frame $w.b
  pack $w.b -side top -ipady 5 -fill x
  checkbutton $w.b.vars -textvar ::tr(LookInVars) -padx 10 -pady 5 \
    -onvalue 1 -offvalue 0 -variable searchInVars -relief raised
  checkbutton $w.b.flip -textvar ::tr(IgnoreColors) -padx 10 -pady 5 \
    -onvalue 1 -offvalue 0 -variable sBoardIgnoreCols -relief raised

  button $w.b.stop -textvar ::tr(Stop) -command sc_progressBar
  $w.b.stop configure -state disabled

  button $w.b.search -textvar ::tr(Search) -command {
    busyCursor .
    .sb.b.stop configure -state normal
    grab .sb.b.stop
    sc_progressBar .sb.progress bar 301 21 time
    set str [sc_search board $filterOp $sBoardSearchType $searchInVars \
              $sBoardIgnoreCols]
    unbusyCursor .
    grab release .sb.b.stop
    .sb.b.stop configure -state disabled
    #tk_messageBox -type ok -title $::tr(SearchResults) -message $str
    .sb.status configure -text $str
    set glstart 1
    updateGList
    updateStatsWin
  }
  button $w.b.cancel -textvar ::tr(Close) -command "focus .; destroy $w"
  pack $w.b.vars $w.b.flip -side left -pady 5 -padx 5
  pack $w.b.cancel .sb.b.search .sb.b.stop -side right -pady 5 -padx 5
  pack $w.progress -side top -pady 2
  label $w.status -text "" -width 1 -font font_Small -relief sunken -anchor w
  pack $w.status -side bottom -fill x
  wm resizable $w 0 0
  standardShortcuts $w
  configSearchState
  focus $w.b.search
}

########################################
### MATERIAL searching

set ignoreColors 0
set minMoveNum 1
set maxMoveNum 999
set minHalfMoves 1
set oppBishops "Either"
set minMatDiff -40
set maxMatDiff +40

trace variable minMoveNum w {forceInt 999 0}
trace variable maxMoveNum w {forceInt 999 0}
trace variable minHalfMoves w {forceInt 99 0}
trace variable minMatDiff w {forceInt -99 0}
trace variable maxMatDiff w {forceInt -99 0}

set nPatterns 9

array set pMin [list wq 0 bq 0 wr 0 br 0 wb 0 bb 0 wn 0 bn 0 wm 0 bm 0 wp 0 bp 0]
array set pMax [list wq 2 bq 2 wr 2 br 2 wb 2 bb 2 wn 2 bn 2 wm 4 bm 4 wp 8 bp 8]
for { set i 1 } { $i <= $nPatterns } { incr i } {
  set pattPiece($i) "?";  set pattFyle($i) "?";  set pattRank($i) "?"
}

proc checkPieceCounts {name el op} {
  global pMin pMax
  forceInt 9 0 $name $el $op
  # Now make sure minor piece counts fit with bishop/knight counts:
  set wmMin [expr $pMin(wn) + $pMin(wb)]
  set wmMax [expr $pMax(wn) + $pMax(wb)]
  set bmMin [expr $pMin(bn) + $pMin(bb)]
  set bmMax [expr $pMax(bn) + $pMax(bb)]
  if {$pMin(wm) < $wmMin} { set pMin(wm) $wmMin }
  if {$pMax(wm) > $wmMax} { set pMax(wm) $wmMax }
  if {$pMin(bm) < $bmMin} { set pMin(bm) $bmMin }
  if {$pMax(bm) > $bmMax} { set pMax(bm) $bmMax }
  foreach p {wq wr wb wn wm wp bq br bb bn bm bp} {
    if {$pMax($p) != ""  &&  $pMax($p) < $pMin($p)} { set pMax($p) $pMin($p) }
  }
}

trace variable pMin w checkPieceCounts
trace variable pMax w checkPieceCounts


proc makePieceMenu {w varName} {
  global dark
  upvar #0 $varName var
  if {![info exists var]} { set var "?" }
  menubutton $w -textvariable $varName -indicatoron 0 -menu $w.menu \
    -relief raised -bd 2 -highlightthickness 2 -anchor w -image ""
  menu $w.menu -tearoff 0
  $w.menu add radiobutton -label " ? " -variable $varName -value "?" \
    -command "$w configure -image e20" -hidemargin 1
  foreach i {wk wq wr wb wn wp bk bq br bb bn bp} {
    $w.menu add radiobutton -label $i -image ${i}20 -value $i \
      -variable $varName \
      -command "$w configure -image ${i}20" -hidemargin 1
  }
  foreach i {" ? " wk bk} {
    $w.menu entryconfigure $i -columnbreak 1
  }
  return $w.menu
}

proc updatePatternImages {} {
  global pattPiece nPatterns
  if {! [winfo exists .sm]} { return }
  for {set i 1} {$i <= $nPatterns} {incr i} {
    if {$pattPiece($i) == "?"} {
      .sm.patt.p$i configure -image e20
    } else {
      .sm.patt.p$i configure -image "$pattPiece($i)20"
    }
  }
}

# zeroMaterial:
#   Called to clear all material minumum/maximum values to zero.
#
proc zeroMaterial {} {
  global pMin pMax
  array set pMin {wq 0 bq 0 wr 0 br 0 wb 0 bb 0 wn 0 bn 0 wm 0 bm 0 wp 0 bp 0}
  array set pMax {wq 0 bq 0 wr 0 br 0 wb 0 bb 0 wn 0 bn 0 wm 0 bm 0 wp 0 bp 0}
}

proc anyMaterial {} {
  global pMin pMax
  array set pMin {wq 0 bq 0 wr 0 br 0 wb 0 bb 0 wn 0 bn 0 wm 0 bm 0 wp 0 bp 0}
  array set pMax {wq 2 bq 2 wr 2 br 2 wb 2 bb 2 wn 2 bn 2 wm 4 bm 4 wp 8 bp 8}
  set ::minMatDiff -40
  set maxMatDiff +40
}

proc clearPatterns {} {
  global pattPiece pattFyle pattRank pattBool nPatterns

  for { set i 1 } { $i <= $nPatterns } { incr i } {
    set pattPiece($i) "?";  set pattFyle($i) "?";  set pattRank($i) "?"
    set pattBool($i) "Yes"
  }
  updatePatternImages
}

proc setPatterns {pattlist} {
  global pattPiece pattFyle pattRank pattBool nPatterns

  clearPatterns
  set count 1
  foreach patt $pattlist {
    if {$count <= $nPatterns  &&  [llength $patt] == 4} {
      set pattPiece($count) [lindex $patt 0]
      set pattFyle($count) [lindex $patt 1]
      set pattRank($count) [lindex $patt 2]
      set pattBool($count) [lindex $patt 3]
      incr count
    }
  }
  updatePatternImages
}

set smDisplayed(Material) 1
set smDisplayed(Patterns) 0

# searchMaterial:
#   Search by material or patterns.
#
proc searchMaterial {} {
  global glstart dark pMin pMax ignoreColors filterOp minMoveNum maxMoveNum
  global pattPiece pattFyle pattRank pattBool oppBishops nPatterns
  global minHalfMoves smDisplayed

  set w .sm
  if {[winfo exists $w]} {
    wm deiconify $w
    raiseWin $w
    return
  }
  set small font_Small

  toplevel $w
  wm title $w "Scid: $::tr(MaterialSearch)"
  button $w.piecelabel -font font_Bold -textvar ::tr(Material:) -command {
    if {$smDisplayed(Material)} {
      set smDisplayed(Material) 0
      pack forget .sm.q .sm.r .sm.b .sm.n .sm.m .sm.p .sm.b1 .sm.mdiff
    } else {
      set smDisplayed(Material) 1
      pack .sm.q .sm.r .sm.b .sm.n .sm.m .sm.p .sm.b1 .sm.mdiff \
        -after .sm.piecelabel
    }
  }
  pack $w.piecelabel -side top
  foreach piece {q r b n m p} {
    frame $w.$piece
    pack $w.$piece -side top -padx 2
  }

  bind $w <F1> { helpWindow Searches Material }
  bind $w <Escape> "$w.b3.cancel invoke"
  bind $w <Return> "$w.b3.search invoke"

  foreach i {q r b n m p} {
    set f $w.$i
    button $f.w0 -text "0" -command "set pMin(w$i) 0; set pMax(w$i) 0"
    button $f.w1 -text "1" -command "set pMin(w$i) 1; set pMax(w$i) 1"
    button $f.w2 -text "2" -command "set pMin(w$i) 2; set pMax(w$i) 2"
    button $f.wa -text "0+" -command "set pMin(w$i) 0; set pMax(w$i) 2"
    button $f.w1p -text "1+" -command "set pMin(w$i) 1; set pMax(w$i) 2"
    label $f.wi -image w${i}20 -font font_Small
    label $f.wto -text "-" -font font_Small -padx 0
    entry $f.wmin -width 2 -relief sunken -textvar pMin(w$i) -font font_Small \
      -justify right
    entry $f.wmax -width 2 -relief sunken -textvar pMax(w$i) -font font_Small \
      -justify right
    pack $f.w0 $f.w1 $f.w2 $f.wa $f.w1p $f.wi $f.wmin $f.wto $f.wmax -side left

    pack [frame $f.space -width 20] -side left
    button $f.b0 -text "0" -command "set pMin(b$i) 0; set pMax(b$i) 0"
    button $f.b1 -text "1" -command "set pMin(b$i) 1; set pMax(b$i) 1"
    button $f.b2 -text "2" -command "set pMin(b$i) 2; set pMax(b$i) 2"
    button $f.ba -text "0+" -command "set pMin(b$i) 0; set pMax(b$i) 2"
    button $f.b1p -text "1+" -command "set pMin(b$i) 1; set pMax(b$i) 2"
    label $f.bi -image b${i}20 -font font_Small
    label $f.bto -text "-" -font font_Small
    entry $f.bmin -width 2 -relief sunken -textvar pMin(b$i) -font font_Small \
      -justify right
    entry $f.bmax -width 2 -relief sunken -textvar pMax(b$i) -font font_Small \
      -justify right
    pack $f.b0 $f.b1 $f.b2 $f.ba $f.b1p $f.bi $f.bmin $f.bto $f.bmax -side left

    foreach b {0 1 2 a 1p} {
      $f.w$b configure -width 4 -padx 1 -pady 3 -takefocus 0 -font $small
      $f.b$b configure -width 4 -padx 1 -pady 3 -takefocus 0 -font $small
    }
    foreach widget {wmin wmax bmin bmax} {
      bindFocusColors $f.$widget
    }
  }

  $w.p.w1p configure -command "set pMin(wp) 1; set pMax(wp) 8"
  $w.p.wa configure -command "set pMin(wp) 0; set pMax(wp) 8"
  $w.p.b1p configure -command "set pMin(bp) 1; set pMax(bp) 8"
  $w.p.ba configure -command "set pMin(bp) 0; set pMax(bp) 8"

  $w.m.w1p configure -command "set pMin(wp) 1; set pMax(wp) 4"
  $w.m.wa configure -command "set pMin(wp) 0; set pMax(wp) 4"
  $w.m.b1p configure -command "set pMin(bp) 1; set pMax(bp) 4"
  $w.m.ba configure -command "set pMin(bp) 0; set pMax(bp) 4"

  # Buttons that manipulate material settings:
  set f $w.b1
  pack [frame $f] -side top -ipady 2

  button $f.zero -textvar ::tr(Zero) -font $small -command zeroMaterial
  button $f.reset -textvar ::tr(Any) -font $small -command anyMaterial
  button $f.current -textvar ::tr(CurrentBoard) -font $small -command {
      zeroMaterial
      set bd [sc_pos board]
      for {set i 0} {$i < 64} {incr i} {
        set piece $images([ string index $bd $i ])
        if {$piece != "e"  &&  $piece != "wk"  &&  $piece != "bk"} {
          incr pMin($piece); set pMax($piece) $pMin($piece)
        }
      }
    }

  menubutton .sm.b1.common -textvar ::tr(CommonEndings...) \
    -menu .sm.b1.common.m -relief raised -font $small
  menu .sm.b1.common.m -font $small
  set m .sm.b1.common.m
  $m add command -label "Pawn(s) --- Pawn(s)" -command {
    zeroMaterial
    array set pMin {wp 1 bp 1}
    array set pMax {wp 8 bp 8}
  }
  $m add command -label "Rook --- Pawn(s)" -command {
    zeroMaterial
    array set pMin {wr 1 bp 1}
    array set pMax {wr 1 bp 8}
  }
  $m add command -label "Rook + 1 Pawn --- Rook" -command {
    zeroMaterial
    array set pMin {wr 1 br 1 wp 1}
    array set pMax {wr 1 br 1 wp 1}
  }
  $m add command -label "Rook + Pawn(s) --- Rook" -command {
    zeroMaterial
    array set pMin {wr 1 br 1 wp 1}
    array set pMax {wr 1 br 1 wp 8}
  }
  $m add command -label "Rook vs. Rook endings" -command {
    zeroMaterial
    array set pMin {wr 1 br 1}
    array set pMax {wr 1 br 1 wp 8 bp 8}
    set pMin(wr) 1; set pMax(wr) 1; set pMin(wp) 0; set mPax(wp) 8
    set pMin(br) 1; set pMax(br) 1; set pMin(bp) 0; set mPax(bp) 8
  }
  $m add command -label "Rook vs. Rook: passed a-pawn" -command {
    zeroMaterial
    array set pMin {wr 1 br 1 wp 1}
    array set pMax {wr 1 br 1 wp 8 bp 8}
    setPatterns {{wp a ? Yes} {bp a ? No} {bp b ? No}}
    set ignoreColors 1
  }
  $m add command -label "Double Rooks endings" -command {
    zeroMaterial
    array set pMin {wr 2 br 2}
    array set pMax {wr 2 br 2 wp 8 bp 8}
  }
  $m add command -label "Bishop vs. Bishop endings" -command {
    zeroMaterial
    array set pMin {wb 1 bb 1 wm 1 bm 1}
    array set pMax {wb 1 bb 1 wm 1 bm 1 wp 8 bp 8}
  }
  $m add command -label "Bishop vs. Knight endings" -command {
    zeroMaterial
    array set pMin {wb 1 bn 1 wm 1 bm 1}
    array set pMax {wb 1 bn 1 wm 1 bm 1 wp 8 bp 8}
  }
  $m add command -label "Knight vs. Knight endings" -command {
    zeroMaterial
    array set pMin {wn 1 bn 1 wm 1 bm 1}
    array set pMax {wn 1 bn 1 wm 1 bm 1 wp 8 bp 8}
  }
  $m add command -label "Queen + 1 Pawn --- Queen" -command {
    zeroMaterial
    array set pMin {wq 1 bq 1 wp 1}
    array set pMax {wq 1 bq 1 wp 1}
  }
  $m add command -label "Queen vs. Queen endings" -command {
    zeroMaterial
    array set pMin {wq 1 bq 1}
    array set pMax {wq 1 bq 1 wp 8 bp 8}
  }
  $m add command -label "2B vs. 2N middlegame" -command {
    zeroMaterial
    array set pMin {wb 2 bn 2 wm 2 bm 2}
    array set pMax {wq 1 bq 1 wr 2 br 2 wb 2 bn 2 wm 2 bm 2 wp 8 bp 8}
  }

  pack $f.zero $f.reset $f.current $f.common -side left -pady 5 -padx 10
  if {! $smDisplayed(Material)} {
    pack forget .sm.q .sm.r .sm.b .sm.n .sm.m .sm.p .sm.b1 .sm.mdiff
  }

  set f $w.mdiff
  pack [frame $f] -side top
  label $f.label -font font_SmallBold -textvar ::tr(MaterialDiff)
  label $f.label2 -font $small \
    -text "($::tr(White)-$::tr(Black), Q=9 R=5 B=N=3 P=1): "
  entry $f.min -width 3 -relief sunken -textvar minMatDiff -font $small \
    -justify right
  bindFocusColors $f.min
  label $f.sep -text "-" -font $small
  entry $f.max -width 3 -relief sunken -textvar maxMatDiff -font $small \
    -justify right
  bindFocusColors $f.max
  label $f.sep2 -text " " -font $small
  button $f.any -textvar ::tr(Any) -font $small -padx 1 -pady 1 \
    -command {set minMatDiff -40; set maxMatDiff +40}
  button $f.w1 -text " + " -font $small -padx 1 -pady 1 \
    -command {set minMatDiff +1; set maxMatDiff +40}
  button $f.equal -text " = " -font $small -padx 1 -pady 1 \
    -command {set minMatDiff 0; set maxMatDiff 0}
  button $f.b1 -text " - " -font $small -padx 1 -pady 1 \
    -command {set minMatDiff -40; set maxMatDiff -1}
  pack $f.label $f.label2 $f.min $f.sep $f.max -side left
  pack $f.sep2 $f.any $f.w1 $f.equal $f.b1 -side left

  addHorizontalRule $w

  button $w.pattl -font font_Bold -textvar ::tr(Patterns:) -command {
    if {$smDisplayed(Patterns)} {
      set smDisplayed(Patterns) 0
      pack forget .sm.patt .sm.b2
    } else {
      set smDisplayed(Patterns) 1
      pack .sm.patt .sm.b2 -after .sm.pattl
    }
  }
  pack $w.pattl -side top
  set f $w.patt
  frame $f
  pack $f -ipady 5 -side top
  for { set i 1 } { $i <= $nPatterns } { incr i } {
    tk_optionMenu $f.b$i pattBool($i) "Yes" "No"
    set menuPiece1 [ makePieceMenu .sm.patt.p$i pattPiece($i) ]
    tk_optionMenu $f.f$i pattFyle($i) "?" a b c d e f g h
    tk_optionMenu $f.r$i pattRank($i) "?" 1 2 3 4 5 6 7 8
    $f.b$i configure -indicatoron 0 -width 4
    $f.f$i configure -indicatoron 0 -width 2
    $f.r$i configure -indicatoron 0 -width 2
    set column [expr 5 * (($i - 1) / 3)]
    set row [expr ($i - 1) % 3]
    grid $f.b$i -row $row -column $column; incr column
    grid $f.p$i -row $row -column $column; incr column
    grid $f.f$i -row $row -column $column; incr column
    grid $f.r$i -row $row -column $column; incr column
    if {$column == 4  ||  $column == 9} {
      label $f.sp_$i -text "  "
      grid $f.sp_$i -row $row -column $column
    }
  }

  updatePatternImages

  ### Buttons that manipulate patterns:
  set f .sm.b2
  frame $f
  button $f.clearPat -textvar ::tr(Clear) -command clearPatterns
  menubutton $f.common -textvar ::tr(CommonPatterns) \
    -menu $f.common.m -relief raised -font $small
  menu $f.common.m -font $small
  $f.common.m add command -label "White IQP" -command {
    if {$pMin(wp) < 1} { set pMin(wp) 1 }
    setPatterns {{wp d ? Yes} {wp c ? No} {wp e ? No}}
  }
  $f.common.m add command -label "White IQP: d4-d5 break vs e6" -command {
    if {$pMin(wp) < 1} { set pMin(wp) 1 }
    if {$pMin(bp) < 1} { set pMin(bp) 1 }
    setPatterns {{wp d 5 Yes} {wp c ? No} {wp e ? No} {wp d 4 No} \
                   {bp e 6 Yes} {bp c ? No} {bp d ? No}}
  }
  $f.common.m add command -label "Black IQP" -command {
    if {$pMin(bp) < 1} { set pMin(bp) 1 }
    setPatterns {{bp d ? Yes} {bp c ? No} {bp e ? No}}
  }
  $f.common.m add command -label "White IQP + Black IQP" -command {
    if {$pMin(wp) < 1} { set pMin(wp) 1 }
    if {$pMin(bp) < 1} { set pMin(bp) 1 }
    setPatterns {{wp d ? Yes} {wp c ? No} {wp e ? No} \
                   {bp d ? Yes} {bp c ? No} {bp e ? No}}
  }
  $f.common.m add command -label "White c3+d4 isolated pawn couple" -command {
    set pMin(wp) 4; set pMax(wp) 6
    set pMin(bp) 4; set pMax(bp) 6
    setPatterns {{wp c 3 Yes} {wp d 4 Yes} {wp b ? No} {wp e ? No}
      {bp c ? No} {bp d ? No}}
  }
  $f.common.m add command -label "Hanging Black c5+d5 pawns" -command {
    set pMin(bp) 4; set pMax(bp) 6
    set pMin(wp) 4; set pMax(wp) 6
    setPatterns {{bp c 5 Yes} {bp d 5 Yes} {bp b ? No} {bp e ? No}
      {wp c ? No} {wp d ? No}}
  }
  $f.common.m add command -label "Maroczy center" -command {
    if {$pMin(bp) < 1} { set pMin(bp) 1 }
    if {$pMax(bp) > 7} { set pMax(bp) 7 }
    if {$pMin(wp) < 2} { set pMin(wp) 2 }
    if {$pMax(wp) > 7} { set pMax(wp) 7 }
    setPatterns {{wp c 4 Yes} {wp e 4 Yes} {bp d ? Yes} {wp d ? No}
                 {bp c ? No} {bp d 5 No}}
  }
  $f.common.m add command -label "Rook-sac on c3" -command {
    set pMin(br) 2; set pMax(br) 2
    set pMin(wr) 2; set pMax(wr) 2
    setPatterns { {br c 3 Yes} {wp b 2 Yes} }
  }
  $f.common.m add command -label "White Kc1; Black Kg8" -command {
    setPatterns { {wk c 1 Yes} {bk g 8 Yes} }
  }
  $f.common.m add command -label "White Kg1; Black Kc8" -command {
    setPatterns { {wk g 1 Yes} {bk c 8 Yes} }
  }
  $f.common.m add command -label "4 fianchettos" -command {
    set pMin(wb) 2; set pMin(bb) 2
    setPatterns { {wb b 2 Yes} {wb g 2 Yes} {bb b 7 Yes} {bb g 7 Yes} }
  }

  pack $f -side top
  pack $f.clearPat $f.common -side left -pady 5 -padx 10
  if {! $smDisplayed(Patterns)} {
    pack forget $w.patt $w.b2
  }

  addHorizontalRule $w

  ### Now the move counter:

  set f $w.bishops
  pack [frame $f] -side top
  label $f.t1 -text "1"
  label $f.t2 -image wb20
  label $f.t3 -text "- 1"
  label $f.t4 -image bb20
  label $f.t5 -textvar ::tr(squares:)
  radiobutton $f.same -textvar ::tr(SameColor) -variable oppBishops \
    -value "Same" -indicatoron 0 -pady 5 -padx 5
  radiobutton $f.opp -textvar ::tr(OppColor) -variable oppBishops \
    -value "Opposite" -indicatoron 0 -pady 5 -padx 5
  radiobutton $f.either -textvar ::tr(Either) -variable oppBishops \
    -value "Either" -indicatoron 0 -pady 5 -padx 5
  foreach i {t1 t2 t3 t4 t5 same opp either} { pack $f.$i -side left }

  set f $w.move
  pack [frame $f] -side top -ipady 5
  label $f.fromlab -textvar ::tr(MoveNumberRange:)
  entry $f.from -width 4 -relief sunken -textvar minMoveNum -justify right
  label $f.tolab -text "-"
  entry $f.to -width 4 -relief sunken -textvar maxMoveNum -justify right
  label $f.space -text "  "
  label $f.label1 -textvar ::tr(MatchForAtLeast)
  entry $f.hmoves -width 3 -relief sunken -textvar minHalfMoves -justify right
  label $f.label2 -textvar ::tr(HalfMoves)
  bindFocusColors $f.from
  bindFocusColors $f.to
  bindFocusColors $f.hmoves
  pack $f.fromlab $f.from $f.tolab $f.to $f.space \
    $f.label1 $f.hmoves $f.label2 -side left

  addHorizontalRule $w
  search_addFilterOpFrame $w 1
  addHorizontalRule $w

  ### Progress bar:

  canvas $w.progress -height 20 -width 300 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -outline blue -fill blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  ### Last of all, the buttons frame:

  set f $w.b3
  pack [frame $f] -side top -ipady 5 -fill x
  checkbutton $f.ignorecol -textvar ::tr(IgnoreColors) \
    -variable ignoreColors -relief raised -padx 8 -pady 5

  button $f.save -textvar ::tr(Save...) -padx 10 -command saveMaterialSearch

  button $f.stop -textvar ::tr(Stop) -command sc_progressBar
  $f.stop configure -state disabled

  button $f.search -textvar ::tr(Search) -padx 20 -command {
    busyCursor .
    .sm.b3.stop configure -state normal
    grab .sm.b3.stop
    sc_progressBar .sm.progress bar 301 21 time
    set str [sc_search material \
               -wq [list $pMin(wq) $pMax(wq)] -bq [list $pMin(bq) $pMax(bq)] \
               -wr [list $pMin(wr) $pMax(wr)] -br [list $pMin(br) $pMax(br)] \
               -wb [list $pMin(wb) $pMax(wb)] -bb [list $pMin(bb) $pMax(bb)] \
               -wn [list $pMin(wn) $pMax(wn)] -bn [list $pMin(bn) $pMax(bn)] \
               -wm [list $pMin(wm) $pMax(wm)] -bm [list $pMin(bm) $pMax(bm)] \
               -wp [list $pMin(wp) $pMax(wp)] -bp [list $pMin(bp) $pMax(bp)] \
               -flip $ignoreColors -filter $filterOp \
               -range [list $minMoveNum $maxMoveNum] \
               -length $minHalfMoves -bishops $oppBishops \
               -diff [list $minMatDiff $maxMatDiff] \
               -patt "$pattBool(1) $pattPiece(1) $pattFyle(1) $pattRank(1)" \
               -patt "$pattBool(2) $pattPiece(2) $pattFyle(2) $pattRank(2)" \
               -patt "$pattBool(3) $pattPiece(3) $pattFyle(3) $pattRank(3)" \
               -patt "$pattBool(4) $pattPiece(4) $pattFyle(4) $pattRank(4)" \
               -patt "$pattBool(5) $pattPiece(5) $pattFyle(5) $pattRank(5)" \
               -patt "$pattBool(6) $pattPiece(6) $pattFyle(6) $pattRank(6)" \
               -patt "$pattBool(7) $pattPiece(7) $pattFyle(7) $pattRank(7)" \
               -patt "$pattBool(8) $pattPiece(8) $pattFyle(8) $pattRank(8)" \
               -patt "$pattBool(9) $pattPiece(9) $pattFyle(9) $pattRank(9)" ]
    grab release .sm.b3.stop
    .sm.b3.stop configure -state disabled
    unbusyCursor .
    #tk_messageBox -type ok -title $::tr(SearchResults) -message $str
    .sm.status configure -text $str
    set glstart 1
    updateGList
    updateStatsWin
  }

  button $f.cancel -textvar ::tr(Close) -padx 20 \
    -command { focus .; destroy .sm }

  pack $f.ignorecol $w.b3.save -side left -pady 5 -padx 5
  pack $w.b3.cancel $w.b3.search $w.b3.stop -side right -pady 5 -padx 5
  pack $w.progress -side top -pady 2

  label $w.status -text "" -width 1 -font font_Small -relief sunken -anchor w
  pack $w.status -side bottom -fill x

  update
  wm resizable $w 0 0
  standardShortcuts $w
  configSearchState
  focus $f.search
}

proc saveMaterialSearch {} {
  global pMin pMax ignoreColors filterOp minMoveNum maxMoveNum minHalfMoves
  global pattPiece pattFyle pattRank pattBool oppBishops nPatterns

  set ftype { { "Scid SearchOptions files" {".sso"} } }
  set fName [tk_getSaveFile -initialdir [pwd] -filetypes $ftype -title "Create a SearchOptions file"]
  if {$fName == ""} { return }

  if {[string compare [file extension $fName] ".sso"] != 0} {
    append fName ".sso"
  }

  if {[catch {set searchF [open $fName w]}]} {
    tk_messageBox -title "Error: Unable to open file" -type ok -icon error \
      -message "Unable to create SearchOptions file: $fName"
    return
  }
  puts $searchF "\# SearchOptions File created by Scid [sc_info version]"
  puts $searchF "set searchType Material"
  # First write the material counts:
  foreach i {wq bq wr br wb bb wn bn wp bp} {
    puts $searchF "set pMin($i) $pMin($i)"
    puts $searchF "set pMax($i) $pMax($i)"
  }
  # Now write other numeric values:
  foreach i {ignoreColors filterOp minMoveNum maxMoveNum minHalfMoves oppBishops} {
    puts $searchF "set $i [set $i]"
  }
  # Last, write the patterns:
  for {set i 1} {$i <= $nPatterns} {incr i} {
    puts $searchF "set pattPiece($i) $pattPiece($i)"
    puts $searchF "set pattFyle($i) $pattFyle($i)"
    puts $searchF "set pattRank($i) $pattRank($i)"
    puts $searchF "set pattBool($i) $pattBool($i)"
  }
  tk_messageBox -type ok -icon info -title "Search Options saved" \
    -message "Material/pattern search options saved to: $fName"
  close $searchF
}


########################################
### HEADER Searching (Name, etc).

set sWhite "";  set sBlack "";  set sEvent ""; set sSite "";  set sRound ""
set sWhiteEloMin 0; set sWhiteEloMax 4000
set sBlackEloMin 0; set sBlackEloMax 4000
set sEloDiffMin -4000; set sEloDiffMax +4000
set sTitleList [list gm im fm none wgm wim wfm w]
foreach i $sTitleList {
  set sTitles(w:$i) 1
  set sTitles(b:$i) 1
}
set sGlMin 0; set sGlMax 999
set sEcoMin "A00";  set sEcoMax "E99"; set sEco Yes
set sDateMin "0000.00.00"; set sDateMax "[sc_info limit year].12.31"
set sResWin 1; set sResLoss 1; set sResDraw 1; set sResOther 1
set sGnumMin 1; set sGnumMax -1
set sIgnoreCol No
set sHeaderFlagList {StdStart Promotions Comments Variations Annotations \
      DeleteFlag WhiteOpFlag BlackOpFlag MiddlegameFlag EndgameFlag \
      NoveltyFlag PawnFlag TacticsFlag KsideFlag QsideFlag \
      BrilliancyFlag BlunderFlag UserFlag
}
foreach i $sHeaderFlagList {
    set sHeaderFlags($i) both
}
set sPgntext(1) ""
set sPgntext(2) ""
set sPgntext(3) ""

trace variable sDateMin w forceDate
trace variable sDateMax w forceDate

foreach i {sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax} {
  trace variable $i w {forceInt 4000 0}
}
trace variable sEloDiffMin w {forceInt -4000 0}
trace variable sEloDiffMax w {forceInt -4000 0}

trace variable sGlMin w {forceInt 9999 0}
trace variable sGlMax w {forceInt 9999 0}

trace variable sGnumMin w {forceInt -9999999 0}
trace variable sGnumMax w {forceInt -9999999 0}

# Forcing ECO entry to be valid ECO codes:
foreach i {sEcoMin sEcoMax} {
  trace variable $i w {forceRegexp {^$|^[A-Ea-e]$|^[A-Ea-e][0-9]$|^[A-Ea-e][0-9][0-9]$|^[A-Ea-e][0-9][0-9][a-z]$|^[A-Ea-e][0-9][0-9][a-z][1-4]$}}
}

# checkDates:
#    Checks minimum/maximum search dates in header search window and
#    extends them if necessary.
proc checkDates {} {
  global sDateMin sDateMax
  if {[string length $sDateMin] == 0} { set sDateMin "0000" }
  if {[string length $sDateMax] == 0} { set sDateMax [sc_info limit year]}
  if {[string length $sDateMin] == 4} { append sDateMin ".??.??" }
  if {[string length $sDateMax] == 4} { append sDateMax ".12.31" }
  if {[string length $sDateMin] == 7} { append sDateMin ".??" }
  if {[string length $sDateMax] == 7} { append sDateMax ".31" }
}

# configSearchState:
#   Sets state of Search button in Header, Board and Material windows
#
proc configSearchState {{state ""}} {
  if {$state == ""} {
    set state disabled
    if {[sc_base inUse]} { set state normal }
  }
  catch {.sh.b.search configure -state $state }
  catch {.sb.b.search configure -state $state }
  catch {.sm.b3.search configure -state $state }
  catch {.spprep.b.search configure -state $state }
}

proc searchHeaderDefaults {} {
  global sWhite sBlack sEvent sSite sRound sDateMin sDateMax sIgnoreCol
  global sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax
  global sEloDiffMin sEloDiffMax
  global sEco sEcoMin sEcoMax sHeaderFlags sGlMin sGlMax
  global sGnumMin sGnumMax
  global sResWin sResLoss sResDraw sResOther glstart filterOp
  global sPgntext sTitles

  set sWhite "";  set sBlack ""
  set sEvent ""; set sSite "";  set sRound ""
  set sWhiteEloMin 0; set sWhiteEloMax 4000
  set sBlackEloMin 0; set sBlackEloMax 4000
  set sEloDiffMin  -4000; set sEloDiffMax +4000
  set sGlMin 0; set sGlMax 999
  set sEcoMin "A00";  set sEcoMax "E99"; set sEco Yes
  set sGnumMin 1; set sGnumMax -1
  set sDateMin "0000.00.00"; set sDateMax "[sc_info limit year].12.31"
  set sResWin 1; set sResLoss 1; set sResDraw 1; set sResOther 1
  set sIgnoreCol No
  foreach flag $::sHeaderFlagList { set sHeaderFlags($flag) both }
  foreach i [array names sPgntext] { set sPgntext($i) "" }
  foreach i $::sTitleList {
    set sTitles(w:$i) 1
    set sTitles(b:$i) 1
  }
}

searchHeaderDefaults

set sHeaderFlagFrame 0

# searchHeader:
#   Search by header information.
#
proc searchHeader {} {
  global sWhite sBlack sEvent sSite sRound sDateMin sDateMax sIgnoreCol
  global sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax
  global sEloDiffMin sEloDiffMax
  global sEco sEcoMin sEcoMax sHeaderFlags sGlMin sGlMax sTitleList sTitles
  global sResWin sResLoss sResDraw sResOther glstart filterOp sPgntext

  set w .sh
  if {[winfo exists $w]} {
    wm deiconify $w
    raiseWin $w
    return
  }

  toplevel $w
  wm title $w "Scid: $::tr(HeaderSearch)"
  foreach frame {white black ignore tw tb eventsite dateround res gl eco} {
    frame $w.$frame
  }

  bind $w <F1> { helpWindow Searches Header }
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.search invoke"

  set regular font_Small
  set bold font_SmallBold

  foreach color {white black} Color {White Black} {
    pack $w.$color -side top -fill x
    label $w.$color.lab -textvar ::tr($Color:) -font $bold -width 9 -anchor w
    entry $w.$color.e -textvariable "s$Color" -width 40 -font $regular
    label $w.$color.space
    label $w.$color.elo1 -textvar ::tr(Rating:) -font $bold
    entry $w.$color.elomin -textvar s${Color}EloMin -width 6 -justify right \
      -font $regular
    label $w.$color.elo2 -text "-" -font $regular
    entry $w.$color.elomax -textvar s${Color}EloMax -width 6 -justify right \
      -font $regular
    bindFocusColors $w.$color.e
    bindFocusColors $w.$color.elomin
    bindFocusColors $w.$color.elomax
    pack $w.$color.lab $w.$color.e $w.$color.space -side left
    pack $w.$color.elomax $w.$color.elo2 $w.$color.elomin $w.$color.elo1 \
      -side right
  }

  pack $w.ignore -side top -fill x
  label $w.ignore.l -textvar ::tr(IgnoreColors:) -font $bold
  radiobutton $w.ignore.yes -variable sIgnoreCol -value Yes \
    -textvar ::tr(Yes) -font $regular
  radiobutton $w.ignore.no  -variable sIgnoreCol -value No \
    -textvar ::tr(No) -font $regular
  pack $w.ignore.l $w.ignore.yes $w.ignore.no -side left
  label $w.ignore.rdiff -textvar ::tr(RatingDiff:) -font $bold
  entry $w.ignore.rdmin -width 6 -textvar sEloDiffMin -justify right \
    -font $regular
  label $w.ignore.rdto -text "-" -font $regular
  entry $w.ignore.rdmax -width 6 -textvar sEloDiffMax -justify right \
    -font $regular
  bindFocusColors $w.ignore.rdmin
  bindFocusColors $w.ignore.rdmax
  pack $w.ignore.rdmax $w.ignore.rdto $w.ignore.rdmin $w.ignore.rdiff \
    -side right

  set spellstate normal
  if {[lindex [sc_name read] 0] == 0} { set spellstate disabled }
  foreach c {w b} name {White Black} {
    pack $w.t$c -side top -fill x
    label $w.t$c.label -text "$::tr($name) FIDE:" \
      -font $bold -width 14 -anchor w
    pack $w.t$c.label -side left
    foreach i $sTitleList {
      set name [string toupper $i]
      if {$i == "none"} { set name "-" }
      checkbutton $w.t$c.b$i -text $name -width 5 -font $regular \
        -variable sTitles($c:$i) -offvalue 0 -onvalue 1 -indicatoron 0 \
        -state $spellstate -pady 0
      pack $w.t$c.b$i -side left -padx 1
    }
  }

  addHorizontalRule $w

  set f $w.eventsite
  pack $f -side top -fill x
  foreach i {Event Site} {
    label $f.l$i -textvar ::tr(${i}:) -font $bold
    entry $f.e$i -textvariable s$i -width 30 -font $regular
    bindFocusColors $f.e$i
  }
  pack $f.lEvent $f.eEvent -side left
  pack $f.eSite $f.lSite -side right

  set f $w.dateround
  pack $f -side top -fill x
  label $f.l1 -textvar ::tr(Date:) -font $bold
  label $f.l2 -text "-" -font $regular
  label $f.l3 -text " " -font $regular
  entry $f.emin -textvariable sDateMin -width 10 -font $regular
  button $f.eminCal -image calendar -padx 0 -pady 0 -command {
    regsub -all {[.]} $sDateMin "-" newdate
    set ndate [::date::chooser $newdate]
    if {[llength $ndate] == 3} {
      set sDateMin "[lindex $ndate 0].[lindex $ndate 1].[lindex $ndate 2]"
    }
  }
  entry $f.emax -textvariable sDateMax -width 10 -font $regular
  button $f.emaxCal -image calendar -padx 0 -pady 0 -command {
    regsub -all {[.]} $sDateMax "-" newdate
    set ndate [::date::chooser $newdate]
    if {[llength $ndate] == 3} {
      set sDateMax "[lindex $ndate 0].[lindex $ndate 1].[lindex $ndate 2]"
    }
  }
  bindFocusColors $f.emin
  bindFocusColors $f.emax
  bind $f.emin <FocusOut> +checkDates
  bind $f.emax <FocusOut> +checkDates
  button $f.lyear -textvar ::tr(YearToToday) -font $regular -pady 2 -command {
    set sDateMin "[expr [::date::today year]-1].[::date::today month].[::date::today day]"
    set sDateMax [::date::today]
  }
  if {$::tcl_version >= 8.3} {
    pack $f.l1 $f.emin $f.eminCal $f.l2 $f.emax $f.emaxCal $f.l3 $f.lyear \
      -side left
  } else {
    pack $f.l1 $f.emin $f.l2 $f.emax $f.l3 $f.lyear -side left
  }

  label $f.lRound -textvar ::tr(Round:) -font $bold
  entry $f.eRound -textvariable sRound -width 10 -font $regular
  bindFocusColors $f.eRound
  pack $f.eRound $f.lRound -side right

  addHorizontalRule $w

  pack .sh.res -side top -fill x
  label $w.res.l1 -textvar ::tr(Result:) -font $bold
  pack $w.res.l1 -side left
  foreach i {win draw loss other} \
          v {sResWin sResDraw sResLoss sResOther} \
          text {"1-0:"  " =-=:"  " 0-1:"  " *:"} {
    checkbutton $w.res.e$i -variable $v -offvalue 0 -onvalue 1
    label $w.res.$i -text $text -font $regular
    pack $w.res.$i $w.res.e$i -side left
  }

  label $w.gl.l1 -textvar ::tr(GameLength:) -font $bold
  label $w.gl.l2 -text "-" -font $regular
  label $w.gl.l3 -textvar ::tr(HalfMoves) -font $regular
  entry $w.gl.emin -textvariable sGlMin -justify right -width 4 -font $regular
  entry $w.gl.emax -textvariable sGlMax -justify right -width 4 -font $regular
  bindFocusColors $w.gl.emin
  bindFocusColors $w.gl.emax
  pack $w.gl -in $w.res -side right -fill x
  pack $w.gl.l1 $w.gl.emin $w.gl.l2 $w.gl.emax $w.gl.l3 -side left

  label $w.eco.l1 -textvar ::tr(ECOCode:) -font $bold
  label $w.eco.l2 -text "-" -font $regular
  label $w.eco.l3 -text " " -font $regular
  label $w.eco.l4 -textvar ::tr(GamesWithNoECO:) -font $bold
  entry $w.eco.emin -textvariable sEcoMin -width 5 -font $regular
  entry $w.eco.emax -textvariable sEcoMax -width 5 -font $regular
  bindFocusColors $w.eco.emin
  bindFocusColors $w.eco.emax
  button $w.eco.range -text "..." -font $regular -pady 2 -padx 4 -command {
    set tempResult [chooseEcoRange]
    if {[scan $tempResult "%\[A-E0-9a-z\]-%\[A-E0-9a-z\]" sEcoMin_tmp sEcoMax_tmp] == 2} {
      set sEcoMin $sEcoMin_tmp
      set sEcoMax $sEcoMax_tmp
    }
    unset tempResult
  }
  radiobutton $w.eco.yes -variable sEco -value Yes -textvar ::tr(Yes) \
     -font $regular
  radiobutton $w.eco.no -variable sEco -value No -textvar ::tr(No) \
     -font $regular
  pack $w.eco -side top -fill x
  pack $w.eco.l1 $w.eco.emin $w.eco.l2 $w.eco.emax \
    $w.eco.range $w.eco.l3 $w.eco.l4 $w.eco.yes $w.eco.no -side left

  set f [frame $w.gnum]
  pack $f -side top -fill x
  label $f.l1 -textvar ::tr(GlistGameNumber:) -font $bold
  entry $f.emin -textvariable sGnumMin -width 8 -justify right -font $regular
  label $f.l2 -text "-" -font $regular
  entry $f.emax -textvariable sGnumMax -width 8 -justify right -font $regular
  pack $f.l1 $f.emin $f.l2 $f.emax -side left
  bindFocusColors $f.emin
  bindFocusColors $f.emax
  label $f.l3 -text " " -font $regular
  button $f.all -text [capital $::tr(all)] -pady 2 -font $regular \
    -command {set sGnumMin 1; set sGnumMax -1}
  menubutton $f.first -textvar ::tr(First...) -pady 2 -font $regular \
    -menu $f.first.m -indicatoron 0 -relief raised
  menubutton $f.last -textvar ::tr(Last...) -pady 2 -font $regular \
    -menu $f.last.m -indicatoron 0 -relief raised
  menu $f.first.m -font $regular
  menu $f.last.m -font $regular
  foreach x {10 50 100 500 1000 5000 10000} {
    $f.first.m add command -label $x \
      -command "set sGnumMin 1; set sGnumMax $x"
    $f.last.m add command -label $x \
      -command "set sGnumMin -$x; set sGnumMax -1"
  }
  pack $f.l3 $f.all $f.first $f.last -side left -padx 2

  set f [frame $w.pgntext]
  pack $f -side top -fill x
  label $f.l1 -textvar ::tr(PgnContains:) -font $bold
  entry $f.e1 -textvariable sPgntext(1) -width 15 -font $regular
  label $f.l2 -text "+" -font $regular
  entry $f.e2 -textvariable sPgntext(2) -width 15 -font $regular
  label $f.l3 -text "+" -font $regular
  entry $f.e3 -textvariable sPgntext(3) -width 15 -font $regular
  bindFocusColors $f.e1
  bindFocusColors $f.e2
  bindFocusColors $f.e3
  pack $f.l1 $f.e1 $f.l2 $f.e2 $f.l3 $f.e3 -side left

  addHorizontalRule $w

  button $w.flagslabel -textvar ::tr(FindGamesWith:) -font $bold -command {
    if {$sHeaderFlagFrame} {
      set sHeaderFlagFrame 0
      pack forget .sh.flags
    } else {
      set sHeaderFlagFrame 1
      pack .sh.flags -side top -after .sh.flagslabel
    }
  }
  pack $w.flagslabel -side top

  frame $w.flags
  if {$::sHeaderFlagFrame} {
    pack $w.flags -side top
  }

  set count 0
  set row 0
  set col 0
  foreach var $::sHeaderFlagList {
    set lab [label $w.flags.l$var -textvar ::tr($var) -font font_Small]
    grid $lab -row $row -column $col -sticky e
    incr col
    grid [radiobutton $w.flags.yes$var -variable sHeaderFlags($var) \
            -ind 0 -value yes -text $::tr(Yes) -padx 2 -pady 0 \
            -font font_Small] \
      -row $row -column $col
    incr col
    grid [radiobutton $w.flags.no$var -variable sHeaderFlags($var) \
            -ind 0 -value no -text $::tr(No) -padx 2 -pady 0 \
            -font font_Small] \
      -row $row -column $col
    incr col
    grid [radiobutton $w.flags.both$var -variable sHeaderFlags($var) \
            -ind 0 -value both -text $::tr(Both) -padx 2 -pady 0 \
            -font font_Small] \
      -row $row -column $col
    incr count
    incr col -3
    incr row
    if {$count == 6} { set col 5; set row 0 }
    if {$count == 12} { set col 10; set row 0 }
  }
  grid [label $w.flags.space -text "" -font $regular] -row 0 -column 4
  grid [label $w.flags.space2 -text "" -font $regular] -row 0 -column 9

  addHorizontalRule $w
  search_addFilterOpFrame $w 1
  addHorizontalRule $w

  ### Header search: search/cancel buttons

  frame $w.b
  pack $w.b -side top -pady 2 -fill x
  button $w.b.defaults -textvar ::tr(Defaults) -padx 20 \
    -command searchHeaderDefaults
  button $w.b.save -textvar ::tr(Save...) -padx 20 -command saveHeaderSearch
  button $w.b.stop -textvar ::tr(Stop) -command sc_progressBar
  button $w.b.search -textvar ::tr(Search) -padx 20 -command {
    set sPgnlist {}
    foreach i {1 2 3} {
        set temp [string trim $sPgntext($i)]
        if {$temp != ""} { lappend sPgnlist $temp }
    }
    busyCursor .
    pack .sh.b.stop -side right -padx 5
    grab .sh.b.stop
    sc_progressBar .sh.progress bar 301 21 time
    set wtitles {}
    set btitles {}
    foreach i $sTitleList {
      if $sTitles(w:$i) { lappend wtitles $i }
      if $sTitles(b:$i) { lappend btitles $i }
    }
    set str [sc_search header -white $sWhite -black $sBlack \
               -event $sEvent -site $sSite -round $sRound \
               -date [list $sDateMin $sDateMax] \
               -results [list $sResWin $sResDraw $sResLoss $sResOther] \
               -welo [list $sWhiteEloMin $sWhiteEloMax] \
               -belo [list $sBlackEloMin $sBlackEloMax] \
               -delo [list $sEloDiffMin $sEloDiffMax] \
               -eco [list $sEcoMin $sEcoMax $sEco] \
               -length [list $sGlMin $sGlMax] \
               -gameNumber [list $sGnumMin $sGnumMax] \
               -flip $sIgnoreCol -filter $filterOp \
               -fStdStart $sHeaderFlags(StdStart) \
               -fPromotions $sHeaderFlags(Promotions) \
               -fComments $sHeaderFlags(Comments) \
               -fVariations $sHeaderFlags(Variations) \
               -fAnnotations $sHeaderFlags(Annotations) \
               -fDelete $sHeaderFlags(DeleteFlag) \
               -fWhiteOp $sHeaderFlags(WhiteOpFlag) \
               -fBlackOp $sHeaderFlags(BlackOpFlag) \
               -fMiddlegame $sHeaderFlags(MiddlegameFlag) \
               -fEndgame $sHeaderFlags(EndgameFlag) \
               -fNovelty $sHeaderFlags(NoveltyFlag) \
               -fPawnStruct $sHeaderFlags(PawnFlag) \
               -fTactics $sHeaderFlags(TacticsFlag) \
               -fKingside $sHeaderFlags(KsideFlag) \
               -fQueenside $sHeaderFlags(QsideFlag) \
               -fBrilliancy $sHeaderFlags(BrilliancyFlag) \
               -fBlunder $sHeaderFlags(BlunderFlag) \
               -fUser $sHeaderFlags(UserFlag) \
               -pgn $sPgnlist -wtitles $wtitles -btitles $btitles \
              ]

    grab release .sh.b.stop
    pack forget .sh.b.stop
    unbusyCursor .

    .sh.status configure -text $str
    set glstart 1
    updateGList
    updateStatsWin
  }

  button $w.b.cancel -textvar ::tr(Close) -padx 20 \
    -command {focus .; destroy .sh}

  foreach i {defaults save cancel search stop} {
    $w.b.$i configure -font $regular
  }

  pack $w.b.defaults $w.b.save -side left -padx 5
  pack $w.b.cancel $w.b.search -side right -padx 5


  canvas $w.progress -height 20 -width 300 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"
  pack $w.progress -side top -pady 2
  label $w.status -text "" -width 1 -font font_Small -relief sunken -anchor w
  pack $w.status -side bottom -fill x
  update
  wm resizable $w 0 0
  standardShortcuts $w
  configSearchState
  focus $w.white.e
}

proc saveHeaderSearch {} {
  global sWhite sBlack sEvent sSite sRound sDateMin sDateMax sIgnoreCol
  global sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax
  global sEloDiffMin sEloDiffMax
  global sEco sEcoMin sEcoMax sHeaderFlags
  global sResWin sResLoss sResDraw sResOther glstart filterOp sPgntext

  set ftype { { "Scid SearchOptions files" {".sso"} } }
  set fName [tk_getSaveFile -initialdir [pwd] -filetypes $ftype -title "Create a SearchOptions file"]
  if {$fName == ""} { return }

  if {[string compare [file extension $fName] ".sso"] != 0} {
    append fName ".sso"
  }

  if {[catch {set searchF [open [file nativename $fName] w]} ]} {
    tk_messageBox -title "Error: Unable to open file" -type ok -icon error \
      -message "Unable to create SearchOptions file: $fName"
    return
  }
  puts $searchF "\# SearchOptions File created by Scid [sc_info version]"
  puts $searchF "set searchType Header"

  # First write the regular variables:
  foreach i {sWhite sBlack sEvent sSite sRound sDateMin sDateMax sResWin
     sResLoss sResDraw sResOther sWhiteEloMin sWhiteEloMax sBlackEloMin
     sBlackEloMax sEcoMin sEcoMax filterOp sEloDiffMin sEloDiffMax
     sIgnoreCol} {
    puts $searchF "set $i [list [set $i]]"
  }

  # Now write the array values:
  foreach i [array names sHeaderFlags] {
    puts $searchF "set sHeaderFlags($i) [list $sHeaderFlags($i)]"
  }
  foreach i [array names sPgntext] {
    puts $searchF "set sPgntext($i) [list $sPgntext($i)]"
  }

  tk_messageBox -type ok -icon info -title "Search Options saved" \
    -message "Header search options saved to: $fName"
  close $searchF
}


##############################
### Selecting common ECO ranges

set ecoCommonRanges {
  {A04-A09  Reti: 1.Nf3}
  {A10-A39  English: 1.c4}
  {A40-A49  1.d4, 1.d4 Nf6 Miscellaneous}
  {A45l-A45z  Trompowsky: 1.d4 Nf6 2.Bg5}
  {A51-A52  Budapest: 1.d4 Nf6 2.c4 e5}
  {A53-A55  Old Indian: 1.d4 Nf6 2.c4 d6}
  {A57-A59  Benko Gambit: 1.d4 Nf6 2.c4 c5 3.d5 b5}
  {A60-A79  Modern Benoni: 1.d4 Nf6 2.c4 c5 3.d5 e6}
  {A80-A99  Dutch Defence: 1.d4 f5}
  {____________________________________________________________}
  {B00-C99  1.e4}
  {B01-B01     Scandinavian: 1.e4 d5}
  {B02-B05     Alekhine Defence: 1.e4 Nf6}
  {B07-B09     Pirc: 1.e4 d6}
  {B10-B19     Caro-Kann: 1.e4 c6}
  {B12i-B12z      Caro-Kann: Advance: 1.e4 c6 2.d4 d5 3.e5}
  {B20-B99  Sicilian: 1.e4 c5}
  {B22-B22     Sicilian: Alapin: 1.e4 c5 2.c3}
  {B23-B26     Sicilian: Closed: 1.e4 c5 2.Nc3}
  {B30-B39     Sicilian: 1.e4 c5 2.Nf3 Nc6}
  {B40-B49     Sicilian: 1.e4 c5 2.Nf3 e6}
  {B50-B59     Sicilian Rauzer: 1.e4 c5 2.Nf3 d6 ... 5.Nc3 Nc6}
  {B70-B79     Sicilian Dragon: 1.e4 c5 2.Nf3 d6 ... 5.Nc3 g6}
  {B80-B89     Sicilian Scheveningen: 1.e4 c5 2.Nf3 d6 ... 5.Nc3 e6}
  {B90-B99     Sicilian Najdorf: 1.e4 c5 2.Nf3 d6 ... 5.Nc3 a6}
  {____________________________________________________________}
  {C00-C19  French Defence: 1.e4 e6}
  {C02-C02     French: Advance: 1.e4 e6 2.d4 d5 3.e5}
  {C03-C09     French: Tarrasch: 1.e4 e6 2.d4 d5 3.Nd2}
  {C15-C19     French: Winawer: 1.e4 e6 2.d4 d5 3.Nc3 Bb4}
  {C20-C99  Open Game: 1.e4 e5}
  {C25-C29     Vienna: 1.e4 e5 2.Nc3}
  {C30-C39     King's Gambit: 1.e4 e5 2.f4}
  {C42-C43     Russian Game: 1.e4 e5 2.Nf3 Nf6}
  {C44-C49     Open Game: 1.e4 e5 2.Nf3 Nc6}
  {C50-C59     Italian/Two Knights: 1.e4 e5 2.Nf3 Nc6 3.Bc4}
  {C60-C99  Spanish: 1.e4 e5 2.Nf3 Nc6 3.Bb5}
  {C68-C69      Spanish: Exchange: 3.Bb5 a6 4.Bxc6}
  {C80-C83      Spanish: Open: 3.Bb5 a6 4.Ba4 Nf6 5.O-O Nxe4}
  {C84-C99      Spanish: Closed: 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7}
  {____________________________________________________________}
  {D00-D99  Queen's Pawn: 1.d4 d5}
  {D10-D19  Slav: 1.d4 d5 2.c4 c6}
  {D20-D29  QGA: 1.d4 d5 2.c4 dxc4}
  {D30-D69  QGD: 1.d4 d5 2.c4 e6}
  {D35-D36     QGD: Exchange: 1.d4 d5 2.c4 e6 3.cxd5 exd5}
  {D43-D49     Semi-Slav: 3.Nc3 Nf6 4.Nf3 c6}
  {D50-D69     QGD with Bg5: 1.d4 d5 2.c4 e6 3.Nc3 Nf6 4.Bg5}
  {D60-D69     QGD: Orthodox: 4.Bg5 Be7 5.e3 O-O 6.Nf3 Nbd7}
  {D70-D99  Grnfeld: 1.d4 Nf6 2.c4 g6 with 3...d5}
  {D85-D89     Grnfeld: Exchange: 3.Nc3 d5 4.e4 Nxc3 5.bxc3}
  {D96-D99     Grnfeld: Russian: 3.Nc3 d5 4.Nf3 Bg7 5.Qb3}
  {____________________________________________________________}
  {E00-E09  Catalan: 1.d4 Nf6 2.c4 e6 3.g3/...}
  {E02-E05     Catalan: Open: 3.g3 d5 4.Bg2 dxc4}
  {E06-E09     Catalan: Closed: 3.g3 d5 4.Bg2 Be7}
  {E12-E19  Queen's Indian: 1.d4 Nf6 2.c4 e6 3.Nf3 b6}
  {E20-E59  Nimzo-Indian: 1.d4 Nf6 2.c4 e6 3.Nc3 Bb4}
  {E32-E39     Nimzo-Indian: Classical: 4.Qc2}
  {E40-E59     Nimzo-Indian: Rubinstein: 4.e3}
  {E60-E99  King's Indian: 1.d4 Nf6 2.c4 g6}
  {E80-E89     King's Indian: Smisch: 4.e4 d6 5.f3}
  {E90-E99     King's Indian: Main Line: 4.e4 d6 5.Nf3}
}

set scid_ecoRangeChosen ""

proc chooseEcoRange {} {
  global ecoCommonRanges scid_ecoRangeChosen
  if {[winfo exists .ecoRangeWin]} { return }
  set w .ecoRangeWin
  toplevel $w
  wm title $w "Scid: Choose ECO Range"
  wm minsize $w 30 5

  listbox $w.list -yscrollcommand "$w.ybar set" -height 20 -width 60 \
    -background white -selectbackground lightBlue -setgrid 1
  foreach i $ecoCommonRanges { $w.list insert end $i }
  scrollbar $w.ybar -command "$w.list yview" -takefocus 0
  pack [frame $w.b] -side bottom -fill x
  pack $w.ybar -side right -fill y
  pack $w.list -side left -fill both -expand yes

  button $w.b.ok -text "OK" -command {
    set sel [.ecoRangeWin.list curselection]
    if {[llength $sel] > 0} {
      set scid_ecoRangeChosen [lindex $ecoCommonRanges [lindex $sel 0]]
    }
    focus .
    destroy .ecoRangeWin
  }
  button $w.b.cancel -text $::tr(Cancel) -command "focus .; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 2
  bind $w <Escape> "
    set scid_ecoRangeChosen {}
    grab release $w
    focus .
    destroy $w
    break"
  bind $w <Return> "$w.b.ok invoke; break"
  bind $w.list <Double-ButtonRelease-1> "$w.b.ok invoke; break"
  focus $w.list
  grab $w
  tkwait window $w
  return $scid_ecoRangeChosen
}


###
### End of file: search.tcl

# ezsmtp.tcl --
#
#	"Easy" SMTP-base mail sending library.  See the ezsmtp.html
#	file for documentation on using this package.
#
# Copyright (c) 1999-2000 by D. J. Hagberg and other parties
#
# See the file "license.txt" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

package provide ezsmtp 1.0.0

namespace eval ::ezsmtp {
    global env tcl_platform
    variable mail

    # Make CVS version ID accessible.
    set mail(cvsid) \
            {$Id: ezsmtp.tcl,v 1.1.1.1 2002/04/04 22:44:15 sgh Exp $}

    # Global variables that may be altered through ezsmtp::config.
    set mail(vars) [list verbose mailhost port from batchsize \
                         logproc strictaddr]
    set mail(verbose) 0                 ;# No logging output
    set mail(mailhost) localhost        ;# Host with smtp daemon
    set mail(port) 25                   ;# port for smtp daemon
    set mail(batchsize) 0               ;# no batching of RCPT TO's.
    set mail(logproc) {}		;# empty means log to stdout.
    set mail(strictaddr) 0		;# should we enforce RFC821 addresses?

    # Try to figure out a reasonable default FROM.
    # Tcl8.1 already has figured out the username for us.
    # Older versions are not so nice-- need to look in the environment
    if {[info exists tcl_platform(user)]} {set mail(from) $tcl_platform(user)}\
    elseif {[info exists env(LOGNAME)]}   {set mail(from) $env(LOGNAME)} \
    elseif {[info exists env(USERNAME)]}  {set mail(from) $env(USERNAME)} \
    elseif {[info exists env(USER)]}      {set mail(from) $env(USER)} \
    else   {set mail(from) {}}
    
    # Trim any leading/trailing spaces and add @ current host name
    set mail(from) [string trim $mail(from)]
    if {[string length $mail(from)] > 0} {
        append mail(from) @ [info hostname]
    }

    # Regular-expression for validating email addresses.
    set mail(hostre) {[A-Za-z]([A-Za-z0-9-]*[A-Za-z0-9])*|\#[0-9]+|}
    append mail(hostre) {\[[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\]}
    set mail(hostre) "($mail(hostre))(\\.($mail(hostre)))*"
    set mail(strictre) "^\[^\x01-\x20\x7F-\xFF<>@\]+@"
    append mail(strictre) $mail(hostre) {$}
    set mail(!strictre) {^[^@]+|[^@]+@[^@]+$}

    # Default character set/encoding settings
    set mail(tclcharset) ascii
    set mail(mimecharset) us-ascii

    # Package-wide header settings to be sent in the DATA section of the email.
    # Note each header variable is a list -- one element per line.
    set mail(x-mailer) "Tcl ezsmtp Mailer Package"
    if {[llength $mail(cvsid)] > 2} {
        append mail(x-mailer) " (build " [lindex $mail(cvsid) 3] ")"
    }
    set mail(x-mailer:)     [list $mail(x-mailer)]
    set mail(mime-version:) [list "1.0"]
}


#############################################################################
##
## PUBLICALLY-DOCUMENTED PROCS
##
#############################################################################


# ezsmtp::config --
#
#	See documentation for details.
#
# Arguments:
#	args		Options parsed by the procedure.
# Results:
#	See documentation
#
proc ::ezsmtp::config {args} {
    variable mail

    if {[llength $args] == 0} {
        set resl {}
        foreach v $mail(vars) {lappend resl "-$v" [set mail($v)]}
        return $resl
    }

    # Build up a list of valid switches.
    set swl {}
    foreach sw $mail(vars) {lappend swl "-$sw"}

    # If we got a single arg, return its associated variable value
    if {[llength $args] == 1} {
        set v [lindex $args 0]
        if {[lsearch $swl $v] == -1} {
            error "invalid config option, must be one of: $swl"
	}
        return $mail([string trimleft $v -])
    }

    # If we got multiple args, make sure we got an even number.
    set argc [llength $args]
    if {$argc % 2} {
        error "must have an even number of config -option value's."
    }

    # Try each -option/value
    foreach {sw v} $args {
        if {[lsearch $swl $sw] == -1} {
            error "invalid config option, must be one of $swl"
	}

        # Verify numeric & other config values.
        switch -regexp -- $sw {
            {^-(verbose|batchsize)} { 
                set v [expr {int($v)}]
                if {$v < 0} {
                    error "config value for $sw must be a number >= 0"
		}
	    }
            {^-strictaddr$} {
                set v [expr {$v ? 1 : 0}]
	    }
            {^-from$} {
                set v [private_valid_address $v -from]
	    }
            default { }
        }
        set mail([string trimleft $sw -]) $v
    }

    return 1
}


# ezsmtp::send --
#
#	See documentation for details.
#
# Arguments:
#	args		Options parsed by the procedure.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::send {args} {
    global errorInfo errorCode
    variable mail

    # Set defaults for the current send based on global variables
    foreach v [list mailhost port from batchsize tclcharset mimecharset] {
        set cur($v) [set mail($v)]
    }

    # Start with an empty recipient list and return-receipt disabled
    set cur(rcpt) {}
    set cur(receipt) 0

    # process arguments to smtp::send.
    set validopts [list -subject -from -mailhost -port -channel -body \
            -batchsize]
    set argc [llength $args]
    for {set i 0} {$i < $argc} {incr i} {
        set arg [lindex $args $i]
        switch -regexp -- $arg {
            {^-headers$} {
                incr i; set arg [lindex $args $i]
                if {[llength $arg] % 2} {
                    error "Invalid -headers.  Must be a well-formatted list\
                            of even length with alternating keys/values."
                }
                foreach {k v} $arg { private_add_header cur $k $v }
            }
            {^-(to|cc|bcc|tolist|cclist|bcclist|replyto|replytolist)$} {
                incr i
                set recip [lindex $args $i]
                private_add_recip cur [string trimleft $arg -] $recip
            }
            {^-receipt$} {
                incr i
                private_return_receipt cur [lindex $args $i]
            }
            {^-charset$} {
                incr i
                private_set_charset cur [lindex $args $i]
            }
	    {^-} {
                if {[lsearch $validopts $arg] == -1} {
                    error "Unknown option: $arg.  Must be one of: -headers\
                            -to -cc -bcc -tolist -cclist -bcclist -replyto\
                            -replytolist $validopts"
		}
                incr i
                set cur([string trimleft $arg -]) [lindex $args $i]
            }
            default {
                break
            }
        }
    }

    # Throw an error on any remaining arguments.  Older versions (< 1.0)
    # allowed addresses to be specified after the last arg...
    if {$i < [llength $args]} {
        error "Unknown argument(s): [lrange $args $i [expr\
                {[llength $args]-1}]].  Please read the docs about\
                ezsmtp::send -to/-cc/-bcc/-tolist/-cclist/-bcclist."
    }

    # Make sure we have at least one recipient.
    if {[llength $cur(rcpt)] < 1} {
        error "Missing RECIPIENTs.  Must be: ...send ?options?\
                ?RECIPIENT? ?RECIPIENT...?"
    }

    # Make sure we have a from address and header configured
    set cur(from) [string trim $cur(from)]
    if {![string length $cur(from)]} {
        error "no from address has been specified (length=0)"
    }
    if {![info exists cur(from:)]} {private_add_header cur from $cur(from)}
    set cur(from) [private_valid_address $cur(from) -from]

    # Make sure we have either -channel or -body specified.
    if {[info exists cur(channel)] && [info exists cur(body)]} {
        error "Cannot specify both -channel and -body options."
    } elseif {!([info exists cur(channel)] || [info exists cur(body)])} {
        error "Must specify either -channel or -body option."
    }

    # Open a socket to the SMTP server and send the message, catching any
    # errors to ensure the socket gets closed.  Rethrow error after close.
    set s [socket $cur(mailhost) $cur(port)]
    if {[catch [list private_smtp_begin $s cur] msg]} {
        set tmp_EI $::errorInfo; set tmp_EC $::errorCode
        private_log 9 "errorCode=$tmp_EC errorInfo=$tmp_EI"
        catch [list close $s]
        error $msg $tmp_EI $tmp_EC
    }
    catch [list close $s]
    return $msg
}



#############################################################################
##
## PRIVATE PROCS - SUBJECT TO RADICAL CHANGE ON THE SLIGHTEST WHIM.
##
#############################################################################


# ezsmtp::private_add_header --
#
#	Validate and add a single header to the list of email headers to be 
#	sent before the message.
#
# Arguments:
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
#	key		An RFC822-compliant header name without the trailing
#			colon.  Example: Reply-To
#	value		Value to be sent for the above header name.  Multi-line
#			headers may be specified using newline (\n) separators.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_add_header {var key value} {
    upvar 1 $var cur
    variable mail

    # Force the header name to lower case and ensure RFC compliance.
    set key [string tolower $key]
    if {[regexp "\[\x01-\x20\x7F-\xFF:\]" $key]} {
        error "Invalid header name ($key).  RFC 822 stipulates ASCII\
                Characters excluding CTRL characters, space, and `:'"
    }

    # split value into lines, trimming leading and trailing space.
    set vall {}
    foreach ln [split $value \n] {
        set ln [string trim $ln]
        if {[string length $ln] > 65} {
            private_log 2 "Header $key contains line longer than 65\
                    chars:\n$ln"
        }
        lappend vall $ln
    }
    
    # set in the current send session's array by appending colon to key.
    private_log 6 "Header $key=[join $vall "\n\t"]"
    set cur([set key]:) $vall
}


# ezsmtp::private_set_charset --
#
#	Validate and set the Tcl socket encoding and default MIME charset 
#	for this send.
#
# Arguments:
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
#	value		A Tcl list with either 1 or 2 elements, per the
#			docs for ezsmtp::send -charset
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_set_charset {var value} {
    upvar 1 $var cur
    global tcl_version

    if {$tcl_version < 8.1} {
        error "Cannot specify -charset running in Tcl versions < 8.1"
    }

    if {[llength $value] == 1} {
        set cstcl [string tolower [lindex $value 0]]
        if {[string compare $cstcl ascii] == 0} {
            set csmime us-ascii
	} else {
            set csmime $cstcl
	}
    } elseif {[llength $value] == 2} {
        set cstcl [string tolower [lindex $value 0]]
        set csmime [string tolower [lindex $value 1]]
    } else {
        error "-charset value must be a Tcl list with either one or two\
                elements"
    }
    if {[lsearch -exact [encoding names] $cstcl] == -1} {
        error "charset $cstcl is not a valid Tcl encoding"
    }
    set cur(mimecharset) $csmime
    set cur(tclcharset) $cstcl
}


# ezsmtp::private_add_recip --
#
#	Add a single or list of recipients/respondants as either `To:', 
#	`Cc:', Bcc, or `Reply-To:' addresses.
#
# Arguments:
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
#	type		One of to, cc, bcc, replyto, tolist, cclist, bcclist,
#			or replytolist.
#	value		If the `type' specified is one of tolist, cclist, 
#			bcclist, or replytolist this must be a well-formed Tcl
#			list of addresses.  If the `type' specified is one of
#			to, cc, bcc, or replyto this must be a single email 
#			address to add.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_add_recip {var type value} {
    upvar 1 $var cur
    variable mail
    set rcpt_added 0
    set is_replyto 0
    set is_bcc 0

    # decide whether "value" is a list or a single-element address 
    # based on whether the type ends in "list".  If it ends in "list", 
    # strip that off the end.  If no recipients, return immediately.
    if {[string match *list $type]} {
        set reciplist $value
        regsub {list$} $type {} type
    } else {
        set reciplist [list $value]
    }
    if {[llength $reciplist] < 1} {
        return $rcpt_added
    }

    # At this point $type will be "bcc", "to", "cc", or "replyto".
    # Determine which header variable we will be affecting and make
    # sure it exists, skipping bcc.  "replyto" should be "reply-to" in
    # the headers, so we switch it here.
    if {[string compare $type bcc] == 0} {
        set is_bcc 1
    } elseif {[string compare $type replyto] == 0} {
        set is_replyto 1
        set type reply-to
    }
    if {!$is_bcc} {
        set headvar "cur([set type]:)"
        if {[info exists $headvar]} {
            set curlist [set $headvar]
        } else {
            set curlist {}
        }

        # If current stuff in header and we need to add more to the header,
        # make sure the last element ends with a comma (,).
        if {([llength $curlist] > 0) && ([llength $reciplist] > 0)} {
            set idxend [expr {[llength $curlist]-1}]
            set lastelem [lindex $curlist $idxend]
            append lastelem ","
            set curlist [lreplace $curlist $idxend $idxend $lastelem]
        }
    }

    # Loop through all the addresses passed to this proc
    foreach addr $reciplist {
        set addr [string trim $addr]
        if {![string length $addr]} {
            private_log 1 "WARNING: empty address ignored"
            continue
        }

        # Add the address to `To:', `Cc:', and `Reply-To:' headers verbatim.
        if {!$is_bcc} { lappend curlist "$addr," }

        # Do fussy-validation on the recipient address before adding to rcpt's
        set addr [private_valid_address $addr -$type]

        # Add all but Reply-To addresses to the recipient list
        if {!$is_replyto} {
            lappend cur(rcpt) $addr
	}

        incr rcpt_added
    }

    # Nuke any trailing comma in To:/Cc:/Reply-To: header var's, 
    # then and set header var.
    if {!$is_bcc} {
        if {[llength $curlist] > 0} {
            set idxend [expr {[llength $curlist]-1}]
            set lastelem [string trimright [lindex $curlist $idxend] ,]
            set curlist [lreplace $curlist $idxend $idxend $lastelem]
        }
        set $headvar $curlist
    }

    # Return number of addresses added
    set rcpt_added
}


# ezsmtp::private_return_receipt --
#
#	Sets the return-receipt behavior of this send.  See the docs
#	for ezsmtp::send -receipt to describe the arglist argument.
#
# Arguments:
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
#	arglist		May be either a single boolean element or a key/value
#			list of return-receipt settings, per the docs.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_return_receipt {var arglist} {
    upvar 1 $var cur

    # List of valid keys for -receipt list options
    set validopts [list delivery delay nsmail returnfull envelopeid]

    # Set receipt off and array values to default settings.
    array set cur [list receipt 0 receipt,delivery 1 receipt,delay 1 \
            receipt,nsmail 0 receipt,returnfull 0 receipt,envelopeid {}]

    # Single-argument to -receipt should be a boolean on/off for defaults.
    if {[llength $arglist] == 1} {
        set cur(receipt) [expr {[lindex $arglist 0] ? 1 : 0}]
        return
    }

    # Otherwise, we have a list of arguments that must be validated & set.
    # First, make sure the argument list has a valid length...
    if {([llength $arglist] < 2) || ([llength $arglist] % 2)} {
        error "ERROR: keyvaluelist passed to ezsmtp::send -receipt must have\
                an even number of elements and a length of at least 2 elements"
    }

    # And validate each setting, setting appropriate current-send variable.
    foreach {k v} $arglist {
        switch -exact -- $k {
            envelopeid {
                if {[string length [set v [private_xtext $v]]] > 38} {
                    error "ERROR: encoded envelope ID ($v) is too long.  Must\
                            be < 38 chars encoded."
		}
                set cur(receipt,$k) $v
	    }
            default {
                if {[lsearch -exact $validopts $k] == -1} {
                    error "ERROR: bad setting for -receipt key.  Must be 1 of:\
                             [join $validopts { }]"
		}
                set cur(receipt,$k) [expr {$v ? 1 : 0}]
	    }
	}
    }
    set cur(receipt) 1
}


# ezsmtp::private_smtp_begin --
#
#	Start the send by trying EHLO/HELO greeting followed by one or more
#	SMTP conversations, optionally batching some number of recipients.
#
# Arguments:
#	s		Open socket to SMTP server.
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_smtp_begin {s var} {
    upvar 1 $var cur
    global tcl_version
    variable mail

    # Set up the socket for line-buffering/translation.  Only set encoding
    # if we're running in Tcl 8.1 or newer that supports encodings.
    if {$tcl_version < 8.1} {
        fconfigure $s -buffering line -blocking 1 -eofchar {} \
                -translation {auto crlf}
    } else {
        fconfigure $s -buffering line -blocking 1 -eofchar {} \
                -translation {auto crlf} -encoding $cur(tclcharset)
    }
    private_log 2 "Opened connection to SMTP server $cur(mailhost)"
    private_read_all $s 3 220

    # Try to set up for ESMTP conversation
    set cur(esmtp) 0
    private_send_line $s 3 "EHLO [info hostname]"
    set buf [private_read_all $s 3 {[0-9][0-9][0-9]}]
    if {[string match "250*" $buf]} {
        set cur(esmtp) 1
        set buf [split $buf \n]
        foreach ln [lrange $buf 1 [expr {[llength $buf]-1}]] {
            if {[regexp -nocase \
		    "^250\[ -\](\[A-Z0-9\]\[A-Z0-9-\]*) (\[^\x01-\x20\x7F\])"\
                    $ln nil ehlo_keyword ehlo_param]} {
                set ehlo_keyword [string tolower $ehlo_keyword]
                set ehlo_param [string tolower $ehlo_param]
                set cur(esmtp,$ehlo_keyword) $ehlo_param
	    } elseif {[regexp -nocase "^250\[ -\](\[A-Z0-9\]\[A-Z0-9-\]*)" \
                    $ln nil ehlo_keyword]} {
                set ehlo_keyword [string tolower $ehlo_keyword]
                set cur(esmtp,$ehlo_keyword) 1
	    }
	}
    } else {
        # Otherwise, set up for normal RFC-821 SMTP conversation.
        private_send_line $s 3 "HELO [info hostname]"
        private_read_all $s 3 250
    }

    # If user requested return-receipt but not supported by server, bail.
    if {$cur(receipt) && ![info exists cur(esmtp,dsn)]} {
        error "ERROR: Server does not support DSN for return receipt"
    }

    # If user requested 8bit charset but not supported by server, bail.
    if {([string compare $cur(tclcharset) ascii] != 0) && \
            ![info exists cur(esmtp,8bitmime)]} {
        error "Server does not support 8-bit characters"
    }

    # If we are not doing any batching, do a straightforward send
    set sentcnt 0
    set rcptlen [llength $cur(rcpt)]
    if {($cur(batchsize) <= 0) || ($rcptlen <= $cur(batchsize))} {
        private_log 1 "Starting mail send to [join $cur(rcpt) {, }]"
        private_smtp_batch $s cur 0 [expr {$rcptlen-1}]
        incr sentcnt $rcptlen
        private_log 1 "Mail sent OK"
        return $sentcnt
    }

    # If we are batching sends and reading message body from a channel,
    # find out what position we are in the channel if we are sending to
    # more addr's than our batch size, to allow multiple send batches.
    if {[info exists cur(channel)] && [info exists cur(batchsize)]} {
        set cur(channelpos) [tell $cur(channel)]
        if {($cur(channelpos) == -1) && ($cur(batchsize) > 0)} {
            error "Channel must be seek-able when a batch size has been\
                    specified."
	}
    }

    # Loop through the batches of recipients
    set i 0
    while {$i < $rcptlen} {
        set e [expr {$i+$cur(batchsize)-1}]
        if {$e >= $rcptlen} {
            set e [expr {$rcptlen-1}] 
        }
        private_log 1 "Starting mail send for recipients $i to $e:\n \
                [join [lrange $cur(rcpt) $i $e] "\n  "]"
        private_smtp_batch $s cur $i $e
        incr sentcnt [expr {$e-$i+1}]
        private_log 1 "Mail sent OK"

        # If we need to, send server a reset and rewind the channel position.
        if {($e < ($rcptlen-1)) && [info exists cur(channelpos)]} {
            seek $cur(channelpos)
        }

        set i [expr {$e + 1}]
    }

    # Return the count of unique recipients
    set sentcnt
}


# ezsmtp::private_smtp_batch --
#
#	Implement the SMTP conversation necessary to send the message
#	to a batch of recipients.  This proc works off a subset of the
#	cur(rcpt) array of recipient email addresses specified by the
#	rcptstart and rcptend arguments.
#
# Arguments:
#	s		Open socket to SMTP server.
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
#	rcptstart	index in the cur(rcpt) array to start
#	rcptend		index in the cur(rcpt) array to end
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_smtp_batch {s var rcptstart rcptend} {
    upvar 1 $var cur
    variable mail

    # Reset the SMTP server's state to begin a new conversation
    private_send_line $s 3 "RSET"
    private_read_all $s 3

    # Try to build a valid "MAIL FROM:" command, including return-receipt info
    set cmd "MAIL FROM:<$cur(from)>"
    if {$cur(receipt)} {
        if {$cur(receipt,returnfull)} {append cmd " RET=FULL"} \
        else {append cmd " RET=HDRS"}
        if {[string length $cur(receipt,envelopeid)]} {
            append cmd " ENVID=" $cur(receipt,envelopeid)
	}
    }
    private_send_line $s 3 $cmd
    private_read_all $s 3

    # Build up our `NOTIFY=' extension if necessary
    set notifystr {}
    if {$cur(receipt)} {
        set notifyl [list FAILURE]
        if {$cur(receipt,delivery)} { lappend notifyl SUCCESS }
        if {$cur(receipt,delay)}    { lappend notifyl DELAY }
        append notifystr " NOTIFY=" [join $notifyl ,]
    }

    # Each recipent may be specified as "emailaddr" or "Full Name <emailaddr>"
    set rcptlist [lrange $cur(rcpt) $rcptstart $rcptend]
    foreach r $rcptlist {
        if {$cur(receipt)} {
            set orcptstr " ORCPT=rfc822;[private_xtext $r]"
            private_send_line $s 3 "RCPT TO:<$r>${notifystr}${orcptstr}"
	} else {
            private_send_line $s 3 "RCPT TO:<$r>"
	}
        private_read_all $s 3 {25[01]}
    }

    private_send_line $s 3 "DATA"
    private_read_all $s 3 354

    # Send all the mail headers followed by a blank line
    private_send_mail_headers $s cur

    private_log 4 ">>\[message body\]"
    # If we were given a -body in the send command, split into lines and send,
    # ensuring that we strip any stray CR's.
    if {[info exists cur(body)]} {
        set linenum 0
        regsub -all "\r" $cur(body) {} cur(body)
        foreach line [split $cur(body) \n] {
            incr linenum

            # Force breaks at 998 chars to comply with RFC 821 limit.
            while {[string length $line] > 998} {
                private_log 1 "WARNING: >998 chars split at line $linenum"
                set first998 [string range $line 0 997]
                set line [string range 998 [expr \
                        {[string length $line]-1}]]
                if {[string match ".*" $first998]} {
                    set first998 ".$first998"
                }
                private_send_line $s 5 $first998
	    }

            # Send remainder <= 998 chars.
            if {[string match ".*" $line]} {          ;# Double up leading '.'
                set line ".$line"
            }
            private_send_line $s 5 $line
	}
    }

    # If we were given a -channel in the send command, read from the channel
    # one line at a time and send.  Assuming channel configured to strip CRs.
    if {[info exists cur(channel)]} {
        set linenum 0
        while {[gets $cur(channel) line] != -1} {
            incr linenum

            # Force breaks at 998 chars to comply with RFC 821 limit.
            while {[string length $line] > 998} {
                private_log 1 "WARNING: >998 chars split at line $linenum"
                set first998 [string range $line 0 997]
                set line [string range 998 [expr \
                        {[string length $line]-1}]]
                if {[string match ".*" $first998]} {
                    set first998 ".$first998"
                }
                private_send_line $s 5 $first998
	    }

            # Send remainder <= 998 chars.
            if {[string match ".*" $line]} {          ;# Double up leading '.'
                set line ".$line"
            }
            private_send_line $s 5 $line
        }
    }

    # Finally, send the message terminator and read any result.
    private_send_line $s 4 "."
    private_read_all $s 3
}


# ezsmtp::private_send_mail_headers --
#
#	Output all the available email headers at the beginning of the 
#	message, followed by a single empty line.
#
# Arguments:
#	s		Open socket to SMTP server.
#	var		Variable name for associative array in the calling 
#			proc containing the specification for this send.
# Results:
#	Throws an error if anything goes wrong.
#
proc ::ezsmtp::private_send_mail_headers {s var} {
    upvar 1 $var cur
    variable mail

    set doNotSend [list date: subject: from: bcc: content-type: \
            content-transfer-encoding:]

    # If user didn't force a custom date, use the current time in GMT.
    set frm "%a, %d %b %Y %H:%M:%S +0000"
    if {[info exists cur(date:)]} {
        private_send_header $s date: $cur(date:)
    } else {
        private_send_line $s 4 "Date: [clock format [clock seconds] -gmt 1 \
                -format $frm]"
    }

    # If user didn't specify a custom "From:" header, use the one specified
    # by -from parameter or system default.
    if {[info exists cur(from:)]} {
        private_send_header $s from: $cur(from:)
    } else {
        private_send_line $s 4 "From: $cur(from)"
    }

    # Send -subject parameter if specified, or from Subject: custom header.
    if {[info exists cur(subject)]} {
        private_send_line $s 4 "Subject: $cur(subject)"
    } elseif {[info exists cur(subject:)]} {
        private_send_header $s subject: $cur(subject:)
    }

    # Send the required MIME content-type and content-transfer-encoding.
    if {[info exists cur(content-type:)]} {
        private_send_header $s content-type: $cur(content-type:)
    } else {
        private_send_line $s 4 "Content-Type: text/plain;\
                charset=$cur(mimecharset)"
    }
    if {[info exists cur(content-transfer-encoding:)]} {
        private_send_header $s content-transfer-encoding: \
                $cur(content-transfer-encoding:)
    } elseif {[string compare $cur(tclcharset) ascii] == 0} {
        private_send_line $s 4 "Content-Transfer-Encoding: 7bit"
    } else {
        private_send_line $s 4 "Content-Transfer-Encoding: 8bit"
    }

    # Send the custom headers for this current session.
    foreach h [array names cur *:] {
        if {[lsearch $doNotSend $h] != -1} continue
        private_send_header $s $h $cur($h)
    }

    # Send our global headers IFF they are not excluded or custom to 
    # the current sending session.
    foreach h [array names mail *:] {
        if {[lsearch $doNotSend $h] != -1} continue
        if {[info exists cur($h)]} continue
        private_send_header $s $h $mail($h)
    }

    # Check to see if the user requested netscape-style return-receipt on open
    if {$cur(receipt)} {
        if {$cur(receipt,nsmail) && \
                ![info exists cur(disposition-notification-to:)]} {
            private_send_line $s 4 "Disposition-Notification-To: $cur(from)"
	}
    }

    private_send_line $s 4 ""
}


# ezsmtp::private_send_header --
#
#	Sends a header (possibly multi-line) to the SMTP server socket, 
#	formatting the header in proper-text and indenting subsequent
#	lines with a single tab.
#
# Arguments:
#	s		Open socket to SMTP server.
#	name		Name of the header being sent w/trailing colon,
#			like reply-to:
#	valuel		value of header as a list -- one line per list
#			element.
# Results:
#	Header is formatted and output.  Returns number of lines output.
#
proc ::ezsmtp::private_send_header {s name valuel} {
    set lines 0
    set first [lindex $valuel 0]
    set remain [lrange $valuel 1 [expr {[llength $valuel]-1}]]
    private_send_line $s 4 "[private_proper_header $name] $first"
    incr lines
    foreach ln $remain {
        private_send_line $s 4 "\t$ln"
        incr lines
    }
    set lines
}
       

# ezsmtp::private_send_line --
#
#	Sends a line of text to the SMTP server socket, logging at the
#	specified level.
#
# Arguments:
#	s		Open socket to SMTP server.
#	level		Log level between 0 and 9, where 0 is always,
#			1 is whenever -verbose is on, and 9 is the highest
#			debug level available.  Suggested: 4
#	line		Line of text to be sent to the SMTP server, minus
#			any trailing newline or carriage-return characters.
# Results:
#	Closes socket $s and un-sets buffer and status variables.
#
proc ::ezsmtp::private_send_line {s level line} {
    private_log $level "S: $line"
    puts $s $line
    flush $s
}


# ezsmtp::private_read_all --
#
#	Read all available data from the SMTP server socket, handling
#	multi-line responses if necessary, and checking  for a response 
#	code.
#
# Arguments:
#	s		Open socket to SMTP server.
#	level		log level for data read from the socket.
#	resp		glob-style expression to match against the start of
#			data received from the SMTP server.  If left un-
#			specified, the standard 250 (OK) is expected.
# Results:
#	Throws an error if anything goes wrong or an unexpected response 
#	is seen.  Otherwise, returns the data read from the server, with
#	multi-line responses separated by newline (\n) characters.
#
proc ::ezsmtp::private_read_all {s level {resp 250}} {
    variable mail

    # Read response from SMTP server.  Single line or last line of multi-line
    # response will have three digits followed by a space.  Other multi-line
    # responses will have three digits followed by a dash (RFC 821 appendix E).
    # Anything else, including eof, is an error.
    set buf {}
    while {1} {
        if {[eof $s]} {
            error "ERROR: unexpected EOF waiting for output from SMTP server"
        }
        set ln [gets $s]
        append buf $ln \n
        private_log $level "R: $ln"
        if {[string match {[0-9][0-9][0-9] *} $ln]} {
            break
	}
        if {![string match {[0-9][0-9][0-9]-*} $ln]} {
            error "ERROR: unexpected response from SMTP server.  Expected\
                    three digits followed by either a space or a dash (-)"
	}
    }

    # Validate the start of the response
    if {![string match "$resp*" $buf]} {
        error "ERROR: bad response `$buf', wanted: `$resp'"
    }

    # and return the contents of all lines read, separated by newlines.
    set buf
}


# ezsmtp::private_proper_header --
#
#	Proper-cases an RFC 822-style email header name.
#
# Arguments:
#	h		header name like reply-to
# Results:
#	Returns the header name capitalized as most email users 
#	expect: the first letter of each dash-separated word is 
#	capitalized and the remainder is lower-cased, thus the
#	result from above would be Reply-To
#
proc ::ezsmtp::private_proper_header {h} {
    set h [string tolower $h]
    set resl {}

    # RFC 1521 clearly specifies the exact case, verbatim, for mime-version.
    if {[regexp -nocase mime-version: $h]} {
        return "MIME-Version:"
    }

    # For other headers, we capitalize the leading letter of each dash-
    # separated word.
    foreach elem [split $h -] {
        set str [string toupper [string index $elem 0]]
        append str [string range $elem 1 [expr {[string length $elem]-1}]]
        lappend resl $str
    }
    join $resl -
}


# ezsmtp::private_xtext --
#
#	Encode a string as an RFC 1891-compliant xtext value.  Characters 
#	outside the range ! (33) to ~ (126) or the plus (+ (43)) or 
#	equals (= (61)) characters are coded as the plus sign (+) followed
#	by two upper-case hexadecimal digits representing the character code.
#
# Arguments:
#	str		string to be encoded
# Results:
#	xtext-encoded value of str, per the above spec.
#
proc ::ezsmtp::private_xtext {str} {
    set result {}
    foreach c [split $str {}] {
        scan $c %c x
        if {($x < 33) || ($x > 126) || ($x == 43) || ($x == 61)} {
            append result + [format %02X $x]
        } else {
            append result $c
	}
    }
    set result
}


# ezsmtp::private_valid_address --
#
#	Validate and return the essential part of an email address,
#	using the contents of <addr> inside a `Full Name <addr>' spec.
#
# Arguments:
#	addrspec	address spec like `user@a.com' or
#			`Full Name <user@b.com>'
#	setting		setting to be output in an error message, like
#			-from, -to, ...
# Results:
#	stripped-down email address, if valid.  If invalid, an error is 
#	thrown.
#
proc ::ezsmtp::private_valid_address {addrspec setting} {
    variable mail

    set addrspec [string trim $addrspec]
    if {[regexp {<([^>]*)>$} $addrspec nil inneraddr]} {
        set addrspec [string trim $inneraddr]
    }
    if {$mail(strictaddr)} {set re $mail(strictre)} \
    else {set re $mail(!strictre)}
    if {![regexp $re $addrspec]} {
        error "ERROR: $setting address specified ($addrspec) is not compliant.\
                Must be in a form like `user@a.domain' or `Full Name\
                <user@b.domain>'"
    }
    set addrspec
}


# ezsmtp::private_log --
#
#	Log a progress/debug message to stdout or to a user-customized 
#	procedure.
#
# Arguments:
#	level		numeric level at which to log, usu. between 0 (always)
#			and 9 (low-level full debug).
#	msg		message text to log
# Results:
#	xtext-encoded value of str, per the above spec.
#
proc ::ezsmtp::private_log {level msg} {
    variable mail

    if {$mail(verbose) >= $level} {
        if {[string length $mail(logproc)]} {
            uplevel #0 $mail(logproc) $msg
	} else {
            puts stdout "$msg"
            flush stdout
	}
    }
}
###
### email.tcl: part of Scid.
### Copyright (C) 1999-2001  Shane Hudson.
###

# Email manager window: closed by default
set emailWin 0

# makeEmailWin:
#   Opens the email chess manager window, for sending moves to opponents.
#
proc makeEmailWin {} {
  global emailWin emailData
  if {[winfo exists .emailWin]} {
    destroy .emailWin
    set emailwin 0
    return
  }
  set emailWin 1
  toplevel .emailWin
  wm title .emailWin "Scid: Email Manager"
  wm minsize .emailWin 25 10

  bind .emailWin <Destroy> { set .emailWin 0 }
  bind .emailWin <F1> { helpWindow Email }

  frame .emailWin.f
  frame .emailWin.b
  pack .emailWin.f -side left -fill y
  addVerticalRule .emailWin
  pack .emailWin.b -side right -fill y

  set w .emailWin.f
  label $w.title -text "Opponent list" -font font_Bold
  listbox $w.list -height 16 -width 40 -exportselection false \
    -selectmode browse -selectbackground lightBlue -font font_Fixed \
    -yscrollcommand "$w.scroll set" -background white -setgrid 1
  scrollbar $w.scroll -command "$w.list yview" -takefocus 0
  pack $w -side left -expand true -fill both
  pack $w.title -side top
  pack $w.scroll -side right -fill y
  pack $w.list -side right -expand true -fill both

  bind $w.list <ButtonRelease-1> updateEmailWinButtons
  bind $w.list <Enter> updateEmailWinButtons
  bind $w.list <Key-Up> updateEmailWinButtons
  bind $w.list <Key-Down> updateEmailWinButtons

  bind $w.list <Key-a> {.emailWin.b.add invoke}
  bind $w.list <Key-e> {.emailWin.b.edit invoke}
  bind $w.list <Key-d> {.emailWin.b.delete invoke}
  bind $w.list <Key-l> {.emailWin.b.load invoke}
  bind $w.list <Key-s> {.emailWin.b.send invoke}
  bind $w.list <Key-t> {tkMbPost .emailWin.b.time}

  set w .emailWin.b

  button $w.add -text "Add..." -underline 0 -command {
    set idx [llength $emailData]
    lappend emailData [list "" "" "" "" ""]
    modifyEmailDetails $idx
    updateEmailWin
  }

  button $w.edit -text "Edit..." -underline 0 -command email_EditButton
  button $w.delete -text "Delete..." -underline 0 -command email_DeleteButton
  button $w.load -text "Load game" -underline 0 -command email_LoadButton
  button $w.send -text "Send email..." -underline 0 -command email_SendButton
  menubutton $w.time -text "Time" -underline 0 -indicatoron 1 \
    -menu $w.time.m -relief raised
  menu $w.time.m
  $w.time.m add command -label "Received today" -underline 0 \
    -command {email_TimesButton r}
  $w.time.m add command -label "Sent today" -underline 0 \
    -command {email_TimesButton s}
  $w.time.m add command -label "Edit..." -underline 0 \
    -command {email_TimesButton e}

  button $w.config -text "Settings..." -command email_Config
  button $w.help -text $::tr(Help) -command { helpWindow Email }
  button $w.close -text $::tr(Close) -command { destroy .emailWin }

  foreach i {add edit delete load send time config help close} {
    $w.$i configure -font font_Small
  }
  pack $w.add $w.edit $w.delete $w.load $w.send $w.time \
    -side top -pady 1 -padx 5 -fill x
  pack $w.close $w.help $w.config -side bottom -pady 1 -padx 5  -fill x

  bind .emailWin <Destroy> { set emailWin 0 }
  set emailData [email_readOpponentFile]
  focus .emailWin.f.list
  updateEmailWin
}

proc email_Config {} {
  global email
  set w .emailConf
  toplevel $w
  wm title $w "Scid"
  label $w.use -text "Send email using:" -font font_Bold
  frame $w.smtp
  radiobutton $w.smtp.b -text "SMTP server:" -variable email(smtp) -value 1
  entry $w.smtp.s -width 30 -textvar email(server) -bg white
  frame $w.sm
  radiobutton $w.sm.b -text "sendmail process:" -variable email(smtp) -value 0
  entry $w.sm.s -width 30 -textvar email(smproc) -bg white
  pack $w.use -side top
  pack $w.smtp $w.sm -side top -fill x
  pack $w.smtp.s $w.smtp.b -side right
  pack $w.sm.s $w.sm.b -side right
  addHorizontalRule $w
  label $w.addr -text "Email address fields:" -font font_Bold
  frame $w.from
  label $w.from.lab -text "From:"
  entry $w.from.e -textvar email(from) -width 30 -bg white
  frame $w.bcc
  label $w.bcc.lab -text "Bcc:"
  entry $w.bcc.e -textvar email(bcc) -width 30 -bg white
  pack $w.addr $w.from $w.bcc -side top -fill x
  pack $w.from.e $w.from.lab -side right
  pack $w.bcc.e $w.bcc.lab -side right
  addHorizontalRule $w
  pack [frame $w.b] -side top -fill x
  button $w.b.ok -text [tr OptionsSave] -command {
    .menu.options.m invoke [tr OptionsSave]
    catch {grab release .emailConf}
    destroy .emailConf
  }
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  wm resizable $w 1 0
  catch {grab $w}
}

proc email_EditButton {} {
  global emailData
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] == 1} {
    set idx [lindex $sel 0]
    if {[llength $emailData] > $idx} {
      modifyEmailDetails $idx
    }
  }
  updateEmailWin
}

proc email_DeleteButton {} {
  global emailData
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] != 1} { return }
  set idx [lindex $sel 0]
  if {[llength $emailData] <= $idx} { return }
  set confirm [tk_messageBox -icon question -type yesno -default yes \
                 -parent .emailWin -title "Really delete opponent?" \
                 -message "Do you really want to delete this opponent?"]
  if {$confirm == "yes"} {
      set emailData [lreplace $emailData $idx $idx]
    email_writeOpponentFile $emailData
    updateEmailWin
  }
}

proc email_LoadButton {} {
  global emailData
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] != 1} { return }
  set idx [lindex $sel 0]
  if {[llength $emailData] <= $idx} { return }
  set details [lindex $emailData $idx]
  if {[llength [lindex $details 3]] > 0} {
    if {[catch {sc_game load [lindex [lindex $details 3] 0]} result]} {
      tk_messageBox -type ok -icon warning -title "Scid" -message $result
    } else {
      sc_move end
      updateBoardAndPgn .board
      updateTitle
    }
  }
}

proc email_SendButton {} {
  global emailData
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] != 1} { return }
  set idx [lindex $sel 0]
  if {[llength $emailData] <= $idx} { return }
  set details [lindex $emailData $idx]
  emailMessageEditor $idx [lindex $details 0] [lindex $details 1] \
    [lindex $details 2] [lindex $details 3] [lindex $details 4]
}

set emailTimesIdx 0

proc email_TimesButton {type} {
  global emailData emailTimesIdx
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] != 1} { return }
  set idx [lindex $sel 0]
  if {[llength $emailData] <= $idx} { return }
  set details [lindex $emailData $idx]
  while {[llength $details] < 6} { lappend details {} }
  set timeList [lindex $details 5] 
  set last [lindex $timeList end]

  if {$type == "r"  || $type == "s"} {
    email_addSentReceived $idx $type
    return
  }

  set emailTimesIdx $idx
  set w .emailTimesWin
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: Email Times"
  label $w.title -text "Email Times for [lindex $details 0]"
  frame $w.t
  text $w.t.text -height 15 -width 30 -font font_Fixed -setgrid 1 \
    -yscrollcommand "$w.t.ybar set" -bg white -fg black
  scrollbar $w.t.ybar -command "$w.t.text yview"
  frame $w.b
  button $w.b.ok -text "OK" -command {
    set details [lindex $emailData $emailTimesIdx]
    set timeList [split [string trim [.emailTimesWin.t.text get 1.0 end]] "\n"]
    set details [lreplace $details 5 5 $timeList]
    set emailData [lreplace $emailData $emailTimesIdx $emailTimesIdx $details]
    email_writeOpponentFile $emailData
    grab release .emailTimesWin
    updateEmailWin 0
    catch {focus .emailWin}
    destroy .emailTimesWin
  }
  button $w.b.cancel -text $::tr(Cancel) \
    -command "grab release $w; catch {focus .emailWin}; destroy $w"
  pack $w.title -side top -fill x
  pack $w.t -side top -fill both
  pack $w.t.ybar -side right -fill y
  pack $w.t.text -side left -fill both -expand yes
  pack $w.b -side bottom -fill x
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  foreach i $timeList {
    $w.t.text insert end "$i\n"
  }
  grab $w
}

proc email_addSentReceived {idx type} {
  global emailData
  if {[llength $emailData] <= $idx} { return }
  set details [lindex $emailData $idx]
  while {[llength $details] < 6} { lappend details {} }
  set timeList [lindex $details 5] 
  set last [lindex $timeList end]

  set new ""
  if {$type == "r"} { append new "Received " } else { append new "Sent     " }

  set oppGList [lindex $details 3]
  if {[llength $oppGList] > 0} {
    set oppGNum [lindex $oppGList 0]
    sc_game push
    set mnum "     "
    if {[catch {sc_game load $oppGNum}]} {
    } else {
      sc_move end
      set m [llength [split [sc_game moves coord list]]]
      if {$m > 0} {
        set m [expr int(($m+1)/2)]
        set mnum [format "%3d  " $m]
      }
    }
    sc_game pop
    append new $mnum
  }
  append new [::date::today]
  if {! [string compare $last $new]} { return }
  lappend timeList $new
  set details [lreplace $details 5 5 $timeList]
  set emailData [lreplace $emailData $idx $idx $details]
  email_writeOpponentFile $emailData
  updateEmailWin 0
}

proc updateEmailWinButtons {} {
  set sel [.emailWin.f.list curselection]
  if {[llength $sel] > 0} {
    .emailWin.b.edit configure -state normal
    .emailWin.b.delete configure -state normal
    .emailWin.b.load configure -state normal
    .emailWin.b.send configure -state normal
  } else {
    .emailWin.b.edit configure -state disabled
    .emailWin.b.delete configure -state disabled
    .emailWin.b.load configure -state disabled
    .emailWin.b.send configure -state disabled
  }
}

proc updateEmailWin {{clearSelection 1}} {
  global emailWin emailData
  if {! [winfo exists .emailWin]} { return }
  if {$clearSelection} {
    set sel ""
    .emailWin.f.list selection clear 0 end
  } else {
    set sel [lindex [.emailWin.f.list curselection] 0]
  }
  .emailWin.f.list delete 0 end
  # set emailData [lsort -dictionary -index 0 $emailData]
  foreach i $emailData {
    set name [lindex $i 0]
    set time ""
    if {[llength $i] == 6} {
      set timeList [lindex $i 5]
      set time [lindex $timeList end]
    }
    .emailWin.f.list insert end [format "%-14s %s" $name $time]
  }
  if {$sel != ""} {
    .emailWin.f.list selection set $sel
  }
  updateEmailWinButtons
}

#Initial values for globals:
set emailData {}
set emailData_index 0
set emailData_name ""
set emailData_addr ""
set emailData_subj ""
set emailData_glist ""
set emailData_dates ""
set emailData_helpBar {}
array set email_helpBar ""

#Force the game numbers list to be digits and spaces only:
trace variable emailData_glist w {forceRegexp {^[0-9\ ]*$}}


# emailCount: counter to give each email window a unique name.
set emailCount 0

# emailMessageEditor:
#    Contsructs the email message to the opponent and
#    creates the editor window for editing and sending the message.
#
proc emailMessageEditor {idx name addr subj gamelist sig} {
  global emailCount emailData email
  incr emailCount
  if {$emailCount >= 10000} { set emailCount 1 }

  set w ".emailMessageWin$emailCount"
  toplevel $w
  wm title $w "Send email to $name"
  set f [frame $w.fields]

  label $f.fromlab -text "From: "
  entry $f.from -background white
  $f.from insert end $email(from)

  label $f.tolab -text "To: "
  entry $f.to -background white
  $f.to insert end $addr

  label $f.subjlab -text "Subject: "
  entry $f.subj -background white
  $f.subj insert end $subj

  label $f.bcclab -text "Bcc: "
  entry $f.bcc -background white
  $f.bcc insert end $email(bcc)

  button $f.send -text "Send" -command "email_processMessage $w $idx"
  button $f.cancel -text "Cancel" -command "destroy $w"

  grid $f.send -row 0 -column 3 -rowspan 2 -sticky nesw
  grid $f.cancel -row 2 -column 3 -rowspan 2 -sticky nesw
  grid $f.fromlab -row 0 -column 0 -sticky e
  grid $f.from -row 0 -column 1 -sticky ew
  grid $f.tolab -row 1 -column 0 -sticky e
  grid $f.to -row 1 -column 1 -sticky ew
  grid $f.subjlab -row 2 -column 0 -sticky e
  grid $f.subj -row 2 -column 1 -sticky ew
  grid $f.bcclab -row 3 -column 0 -sticky e
  grid $f.bcc -row 3 -column 1 -sticky ew
  grid columnconfigure $f 1 -weight 1

  set f [frame $w.message]
  pack $w.fields -fill x -padx 4 -pady 4
  pack $w.message -expand yes -fill both -padx 4 -pady 4

  scrollbar $f.ybar -command "$f.text yview"
  scrollbar $f.xbar -orient horizontal -command "$f.text xview"
  text $f.text -yscrollcommand "$f.ybar set" -xscrollcommand "$f.xbar set" \
    -setgrid 1 -width 72 -height 20 -background white -wrap none

  grid $f.text -row 0 -column 0 -sticky news
  grid $f.ybar -row 0 -column 1 -sticky news
  grid $f.xbar -row 1 -column 0 -sticky news

  grid rowconfig $w.message 0 -weight 1 -minsize 0
  grid columnconfig $w.message 0 -weight 1 -minsize 0

  # Right-mouse button cut/copy/paste menu:
  menu $f.text.edit -tearoff 0
  $f.text.edit add command -label "Cut" -command "tk_textCut $f.text"
  $f.text.edit add command -label "Copy" -command "tk_textCopy $f.text"
  $f.text.edit add command -label "Paste" -command "tk_textPaste $f.text"
  bind $f.text <ButtonPress-3> "tk_popup $f.text.edit %X %Y"

  set text $w.message.text
  # $text insert end "Hi $name,\n\n"
  $text insert end "\n"
  foreach i $gamelist {
    catch {set gamePgn [sc_game pgn -gameNumber $i -width 70 -tags 0 \
                          -variations 0 -comments 0]}
    $text insert end "$gamePgn\n"
  }
  $text insert end $sig
  return
}

proc email_processMessage {w idx} {
  global emailData
  set from [$w.fields.from get]
  set to [$w.fields.to get]
  set subj [$w.fields.subj get]
  set bcc [$w.fields.bcc get]
  set message [$w.message.text get 1.0 end]
  if {[string trim $to] == ""} {
    tk_messageBox -icon error -type ok -title "Empty email address" \
      -message "You must specify an email address."
    return
  }
  set cmd {email_sendMessage $from $to $subj $bcc $message}
  if {[catch $cmd result] != 0} {
    tk_messageBox -icon error -type ok -title "Error sending email" \
      -message "Error sending email: $result"
  } else {
    email_addSentReceived $idx s
    tk_messageBox -icon info -type ok -title "Scid" -message $result
    destroy $w
  }
}

proc email_sendMessage {from to subject bcc message} {
  global email

  ### Uncomment following line for testing, to avoid sending email:
  # return "Testing, no email was actually sent"

  set copy_id ""
  catch {set copy_id [open [file nativename $email(logfile)] "a+"]}
  if {$copy_id == ""} {
    return -code error "Unable to open $email(logfile)"
  }
  if {$email(smtp)} {
    set cmdargs "-to {$to} -subject {$subject} "
    if {$email(server) != ""} { ::ezsmtp::config -mailhost $email(server) }
    if {$email(from) != ""} {
      if {[catch {::ezsmtp::config -from $from} result]} {
        close $copy_id
        return -code error "Error configuring SMTP: $result"
      }
      append cmdargs "-from {$from} "
    }
    if {$email(bcc) != ""} {
      append cmdargs "-bcc {$bcc} "
    }
    if {[catch {eval "::ezsmtp::send $cmdargs -body {$message}"} result]} {
      close $copy_id
      return -code error "Error sending mail with SMTP: $result"
    }
  } else {
    if {[catch {open "| $email(smproc) -oi -t" "w"} email_id]} {
      close $copy_id
      return -code error "Scid could not find the sendmail program: $email(smproc)"
    }
    if {[string trim $from] != ""} {
      puts $email_id "From: $from"
    }
    puts $email_id "To: $to"
    puts $email_id "Subject: $subject"
    if {[string trim $bcc] != ""} {
      puts $email_id "Bcc: $bcc"
    }
    puts $email_id ""
    puts $email_id $message
    close $email_id
  }
  puts $copy_id  "To: $to"
  puts $copy_id  "Subject: $subject"
  puts $copy_id  ""
  puts $copy_id $message
  close $copy_id
  return "The email message was sent; a copy was appended to $email(logfile)"
}

proc modifyEmailDetails {i} {
  global emailData emailData_name emailData_addr emailData_glist emailData_subj
  global emailData_sig emailData_index emailData_helpBar email_helpBar

  toplevel .emailEditor
  set w .emailEditor
  bind $w <F1> { helpWindow Email }
  set emailData_index $i
  if {[lindex [lindex $emailData $i] 0] == ""} {
    wm title $w "Add opponent details"
  } else {
    wm title $w "Edit opponent details"
  }
  set f [frame $w.name]
  label $f.label -text "Name: "
  entry $f.entry -width 30 -background white -textvariable emailData_name
  set email_helpBar(name) "Enter the opponent's name"

  set f [frame $w.addr]
  label $f.label -text "Email address: "
  entry $f.entry -width 30 -background white -textvariable emailData_addr
  set email_helpBar(addr) "Enter the opponent's email address"

  set f [frame $w.subj]
  label $f.label -text "Subject: "
  entry $f.entry -width 30 -background white -textvariable emailData_subj
  set email_helpBar(subj) "Enter the subject for each message"

  set f [frame $w.glist]
  label $f.label -text "Game Numbers: "
  entry $f.entry -width 30 -background white -textvariable emailData_glist
  set email_helpBar(glist) \
    "Enter opponent's game numbers, separated by spaces"

  foreach f {name addr subj glist} {
    pack $w.$f -side top -fill x
    pack $w.$f.entry $w.$f.label -side right -anchor e
    set e $w.$f.entry
    bind $e <FocusIn> "$e configure -background lightYellow;
      set emailData_helpBar \$email_helpBar($f)"
    bind $e <FocusOut> "$e configure -background white"
  }

  addHorizontalRule $w

  set f [frame $w.sig]
  label $f.label -text "Signature: " -anchor n
  text $f.entry -width 30 -height 5 -background white
  bind $f.entry <FocusIn> "$f.entry configure -background lightYellow
    set emailData_helpBar {Enter the closing text for each message}"
  bind $f.entry <FocusOut> "$f.entry configure -background white"

  pack $f -side top -fill x
  pack $f.entry $f.label -side right -anchor n

  addHorizontalRule $w

  set f [frame $w.buttons]
  button $w.buttons.save -text "Save" -command {
    set gNumberErr [email_validGameNumbers $emailData_glist]
    if {$gNumberErr != -1} {
      tk_messageBox -icon error -type ok -title "Invalid data" \
        -message "The games list contains an invalid game number: $gNumberErr; there are only [sc_base numGames] games in this database."
    } else {
      set emailData [lreplace $emailData $emailData_index \
                       $emailData_index \
                       [list $emailData_name $emailData_addr $emailData_subj \
                          $emailData_glist \
                          [.emailEditor.sig.entry get 1.0 end-1c]]]
      email_writeOpponentFile $emailData
      destroy .emailEditor
      updateEmailWin
    }
  }
  button $f.cancel -text "Cancel" -command {
    set emailData [email_readOpponentFile]
    destroy .emailEditor
    updateEmailWin
  }
  pack $f -side top
  pack $f.save $f.cancel -side left -padx 20 -pady 10

  label $w.helpBar -width 1 -textvariable emailData_helpBar -relief sunken \
    -font font_Small -anchor w
  pack $w.helpBar -side bottom -fill x

  # Set up the initial values in the entry boxes:
  set details [lindex $emailData $emailData_index]
  set emailData_name [lindex $details 0]
  set emailData_addr [lindex $details 1]
  set emailData_subj [lindex $details 2]
  set emailData_glist [lindex $details 3]
  $w.sig.entry insert 1.0 [lindex $details 4]
  grab .emailEditor
}

proc email_validGameNumbers {numberList} {
  foreach i $numberList {
    if {$i < 1  ||  $i > [sc_base numGames]} { return $i }
  }
  return -1
}

proc email_opponentFilename {} {
  set filename [sc_base filename]
  append filename ".sem"
  return $filename
}

proc email_readOpponentFile {} {
  set filename [email_opponentFilename]
  if {[catch {set f [open $filename "r"]} ]} {
    # puts "Unable to open opponent file"
    return {}
  }
  set data [read -nonewline $f]
  close $f
  return $data
}

proc email_writeOpponentFile {data} {
  set filename [email_opponentFilename]
  if {[catch {set f [open $filename "w"]} ]} {
    # puts "Unable to write opponent file"
    return {}
  }
  puts $f $data
  close $f
}

# epd.tcl: EPD editing windows for Scid.
# Copyright (C) 2000  Shane Hudson

set maxEpd [sc_info limit epd]

proc storeEpdText {id} {
  sc_epd set $id [.epd$id.text get 1.0 "end-1c"]
}

proc storeEpdTexts {} {
  global maxEpd
  for {set i 1} {$i <= $maxEpd} {incr i} {
    if {[winfo exists .epd$i]} { storeEpdText $i }
  }
}

proc updateEpdWin {id} {
  set w .epd$id
  $w.text delete 1.0 end
  $w.text insert end [sc_epd get $id]

  # Update the EPD window status bar:
  set str "  --  "
  if {[sc_epd readonly $id]} {
    set str "  %%  "
  } elseif {[sc_epd altered $id]} {
    set str "  XX  "
  }
  append str "[file tail [sc_epd name $id]]  [sc_epd size $id] positions"
  set moves [lsort -ascii [sc_epd moves $id]]
  set len [llength $moves]
  if {$len} {
    append str "  \[[llength $moves]: [join $moves " "]\]"
  } else {
    append str {  [No moves from this position]}
  }
  $w.status configure -text $str
  unset str
}

proc updateEpdWins {} {
  global maxEpd
  for {set i 1} {$i <= $maxEpd} {incr i} {
    if {[winfo exists .epd$i]} { updateEpdWin $i }
  }
}

proc closeEpdWin {id} {
  catch {sc_epd close $id}
}

proc confirmCloseEpd {id} {
  if {! [winfo exists .epd$id]} { return }
  storeEpdText $id
  if {[sc_epd altered $id]  &&  ! [sc_epd readonly $id]} {
    set result [tk_dialog .dialog "Save changes?" \
      "This file has been altered; do you want to save it?" \
      "" 0 "Save changes" "Close without saving" "Cancel"]
    if {$result == 2} { return }
    if {$result == 0} { sc_epd write $id }
  }
  sc_epd close $id
  focus .
  destroy .epd$id
  return
}

proc saveEpdWin {id} {
  set w .epd$id
  busyCursor . 1
  set temp_oldcursor [$w.text cget -cursor]
  $w.text configure -cursor watch
  update idletasks
  storeEpdText $id
  sc_epd write $id
  updateEpdWin $id
  $w.text configure -cursor $temp_oldcursor
  busyCursor . 0
}

proc epd_MoveToDeepestMatch {id} {
  if {! [winfo exists .epd$id]} { return }
  sc_move ply [sc_epd deepest $id]
  updateBoard .board
  return
}

proc newEpdWin {cmd {fname ""}} {
  global maxEpd
  set showErrors 1
  if {$cmd == "openSilent"} { set showErrors 0 }
  if {$fname == ""} { set showErrors 1 }
  if {[sc_epd available] < 1} {
    if {$showErrors} {
      tk_messageBox -type ok -icon info -title "Too many EPD files open" \
        -message "You already have $maxEpd EPD files open; close one first."
    }
    return 0
  }
  set new_types { {"EPD files" {".epd"} } }
  set open_types $new_types
  if {[sc_info gzip]} {
    set open_types { {"EPD files" {".epd" ".epd.gz"} } }
  }
  if {$fname == ""} {
    if {$cmd == "create"} {
      set fname [tk_getSaveFile -initialdir $::initialDir(epd) -filetypes $new_types -title "Create an EPD file"]
    } elseif {$cmd == "open"} {
      set fname [tk_getOpenFile -initialdir $::initialDir(epd) -filetypes $open_types -title "Open an EPD file"]
    } else { return 0 }
  }
  if {$fname == ""} { return 0 }

  busyCursor . 1
  if {[catch {sc_epd $cmd $fname} result]} {
    if {$showErrors} {
      busyCursor . 0
      tk_messageBox -type ok -icon error -title "Scid: EPD file error" \
        -message $result
    }
    return 0
  }
  busyCursor . 0
  set id $result
  set w .epd$id
  toplevel $w
  wm title $w "Scid EPD: [file tail $fname]"
  wm minsize $w 40 1
  bind $w <Destroy> "closeEpdWin $id"
  bind $w <F1> { helpWindow EPD }

  frame $w.grid
  text $w.text -background white -font font_Regular -width 60 -height 7 \
    -wrap none -setgrid 1 -yscrollcommand "$w.ybar set" \
    -xscrollcommand "$w.xbar set"
  scrollbar $w.ybar -takefocus 0 -command "$w.text yview"
  scrollbar $w.xbar -orient horizontal -takefocus 0 -command "$w.text xview"
  label $w.status -width 1 -anchor w -font font_Small -relief sunken

  frame $w.menu -borderwidth 3 -relief raised
  pack $w.menu  -side top -fill x
  menubutton $w.menu.file -text File -menu $w.menu.file.m -underline 0
  menubutton $w.menu.edit -text Edit -menu $w.menu.edit.m -underline 0
  menubutton $w.menu.tools -text Tools -menu $w.menu.tools.m -underline 0
  menubutton $w.menu.help -text Help -menu $w.menu.help.m -underline 0

  foreach i {file edit tools help} {
    menu $w.menu.$i.m -tearoff 0
    pack $w.menu.$i -side left
  }

  set m $w.menu.file.m
  $m add command -label "New" -acc "Ctrl+N" -underline 0 \
    -command {newEpdWin create}
  bind $w <Control-n> {newEpdWin create}
  $m add command -label "Open" -acc "Ctrl+O" -underline 0 \
    -command {newEpdWin open}
  bind $w <Control-o> {newEpdWin open}
  $m add command -label "Save" -acc "Ctrl+S" -underline 0 \
    -command "saveEpdWin $id"
  if {[sc_epd readonly $id]} {
    $m entryconfig "Save" -state disabled
  } else {
    bind $w <Control-s> "saveEpdWin $id; break"
  }
  $m add command -label "Close" -acc "Ctrl+Q" -underline 0 \
    -command "confirmCloseEpd $id"
  bind $w <Control-q> "confirmCloseEpd $id"

  set m $w.menu.edit.m
  $m add command -label "Cut" -acc "Ctrl+X" -underline 2 -command "tk_textCut $w.text"
  bind $w <Control-x> "tk_textCut $w.text; break"
  $m add command -label "Copy" -acc "Ctrl+C" -underline 0 -command "tk_textCopy $w.text"
  bind $w <Control-c> "tk_textCopy $w.text; break"
  $m add command -label "Paste" -acc "Ctrl+V" -underline 0 -command "tk_textPaste $w.text"
  bind $w <Control-v> "tk_textPaste $w.text; break"
  $m add command -label "Select All" -acc "Ctrl+A" -underline 7 \
    -command "$w.text tag add sel 1.0 end"
  bind $w <Control-a> "$w.text tag add sel 1.0 end; break"
  $m add separator
  $m add command -label "Revert" -acc "Ctrl+R" -underline 0 \
    -command "updateEpdWin $id"
  bind $w <Control-r> "updateEpdWin $id; break"
  $m add command -label "Sort lines" -accel "Ctrl+Shift+S" \
    -underline 0 -command "epd_sortLines $w.text"
  bind $w <Control-S> "epd_sortLines $w.text; break"

  set m $w.menu.tools.m
  $m add command -label "Find Deepest game position" \
    -underline 5 -command "epd_MoveToDeepestMatch $id"
  $m add separator
  $m add command -label "Next position in file" \
    -accelerator "Ctrl+DownArrow" -underline 0 \
    -command "sc_epd next $id; updateBoardAndPgn .board"
  bind $w <Control-Down> "sc_epd next $id; updateBoardAndPgn .board; break"
  $m add command -label "Previous position in file" \
    -accelerator "Ctrl+UpArrow" -underline 0 \
    -command "sc_epd prev $id; updateBoardAndPgn .board"
  bind $w <Control-Up> "sc_epd prev $id; updateBoardAndPgn .board; break"
  $m add separator
  $m add command -label "Paste analysis" -accelerator "Ctrl+Shift+A" \
    -underline 6 -command "epd_pasteAnalysis $w.text"
  bind $w <Control-A> "epd_pasteAnalysis $w.text; break"
  $m add separator
  $m add command -label "Strip out EPD field" -underline 0 \
    -command "epd_chooseStripField $id"

  $w.menu.help.m add command -label "EPD files help" -underline 0 \
    -acc "F1" -command "helpWindow EPD"
  $w.menu.help.m add command -label "General index" -underline 0 \
    -command "helpWindow Index"

  pack $w.status -side bottom -fill x
  pack $w.grid -fill both -expand yes
  grid $w.text -in $w.grid -row 0 -column 0 -sticky news
  grid $w.ybar -in $w.grid -row 0 -column 1 -sticky news
  grid $w.xbar -in $w.grid -row 1 -column 0 -sticky news

  grid rowconfig $w.grid 0 -weight 1 -minsize 0
  grid columnconfig $w.grid 0 -weight 1 -minsize 0

  # Right-mouse button cut/copy/paste menu:
  menu $w.text.edit -tearoff 0
  $w.text.edit add command -label "Cut"  -command "tk_textCut $w.text"
  $w.text.edit add command -label "Copy" -command "tk_textCopy $w.text"
  $w.text.edit add command -label "Paste" -command "tk_textPaste $w.text"
  bind $w.text <ButtonPress-3> "tk_popup $w.text.edit %X %Y"

  updateEpdWin $id
  return 1
}


proc epd_sortLines {textwidget} {
  if {! [winfo exists $textwidget]} { return }
  set text [$textwidget get 1.0 "end-1c"]
  set fieldlist [split $text "\n"]
  set sortedlist [lsort $fieldlist]
  while {[lindex $sortedlist 0] == ""} {
    set sortedlist [lrange $sortedlist 1 end]
  }
  set newtext [join $sortedlist "\n"]
  append newtext "\n"
  if {! [string compare $text $newtext]} { return }
  $textwidget delete 1.0 end
  $textwidget insert end "$newtext"
}

# epd_pasteAnalysis:
#    Pastes current chess engine analysis into this EPD file position.
proc epd_pasteAnalysis {textwidget} {
  global analysis
  if {! [winfo exists $textwidget]} { return }
  if {! [winfo exists .analysisWin1]} { return }
  $textwidget insert insert "acd $analysis(depth1)\n"
  $textwidget insert insert "acn $analysis(nodes1)\n"
  set ce [expr int($analysis(score1) * 100)]
  if {[sc_pos side] == "black"} { set ce [expr 0 - $ce] }
  $textwidget insert insert "ce $ce\n"
  $textwidget insert insert "pv $analysis(moves1)\n"
}


set epd_stripField ""

proc epd_chooseStripField {id} {
  global epd_stripField
  if {! [winfo exists .epd$id]} { return }
  set w [toplevel .epdStrip]
  wm title $w "Scid: Strip EPD field"
  wm resizable $w false false
  label $w.label -text "Enter the name of the EPD field you want\n\
removed from all positions in this file:"
  entry $w.e -width 10 -background white -textvariable epd_stripField
  pack $w.label $w.e -side top -pady 5 -padx 5
  addHorizontalRule $w
  set b [frame $w.buttons]
  pack $b -side bottom -pady 5
  button $b.ok -text "Strip EPD field" \
    -command "epd_stripEpdField $id \$epd_stripField"
  button $b.cancel -text "Cancel" -command "focus .epd$id; destroy $w"
  pack $b.ok $b.cancel -side left -padx 5
  bind $w <Return> "$b.ok invoke"
  bind $w <Escape> "$b.cancel invoke"
  focus .epdStrip.e
  grab .epdStrip
}

proc epd_stripEpdField {id field} {
  if {! [winfo exists .epdStrip]} { return }
  if {! [string compare $field ""]} { beep; return }
  set result [sc_epd strip $id $field]
  updateEpdWin $id
  tk_messageBox -type ok -icon info -title "Scid: EPD field stripped" \
    -message "Scid found and stripped an EPD field named \"$field\" from\
$result positions."
  focus .epd$id
  destroy .epdStrip
}
########################################
### fontsel.tcl: part of Scid.
#
# The following procs implement a font selection dialog. I found the code
# at codearchive.com (I dont think there was an author listed for it) and
# simplified it for use with Scid.

# FontDialog:
#   Creates a font dialog to select a font.
#   Returns 1 if user chose a font, 0 otherwise.
#
proc FontDialog {font_name {options ""} {fixedOnly 0}} {
  global fd_family fd_style fd_size fd_close
  global fd_strikeout fd_underline

  set fd_family {}; set fd_style {}; set fd_size {}
  set fd_close  -1

  set unsorted_fam [font families]
  set families [lsort $unsorted_fam]
  if {$fixedOnly} {
    set fams $families
    set families {}
    foreach f $fams {
      if {[font metrics [list $f] -fixed] == 1} { lappend families $f }
    }
  }

  # Get current font's family and so on.
  if {[llength $options] == 4} {
    # Use provided font settings:
    set family [lindex $options 0]
    set size [lindex $options 1]
    set weight [lindex $options 2]
    set slant [lindex $options 3]
  } else {
    # Get options using [font actual]:
    set family [font actual $font_name -family]
    set size   [font actual $font_name -size]
    set weight    [font actual $font_name -weight]
    set slant     [font actual $font_name -slant]
  }

  # Default style.
  set fd_style "Regular"
  if { $slant == "italic" } {
    if { $weight == "bold" } {
      set fd_style "Bold Italic"
    } else {
      set fd_style "Italic"
    }
  } else {
    if { $weight == "bold" } {
      set fd_style "Bold"
    }
  }

  set fd_family $family
  set fd_size   $size

  # Create font dialog.
  set dlg .fontdialog
  toplevel $dlg
  wm protocol $dlg WM_DELETE_WINDOW "set fd_close 0"
  wm title $dlg Font

  label $dlg.family_lbl -text "Font:" -anchor w
  entry $dlg.family_ent -textvariable fd_family -background white
  bind  $dlg.family_ent <Key-Return> "FontDialogRegen $font_name"
  grid config $dlg.family_lbl -column 0 -row 0 -sticky w
  grid config $dlg.family_ent -column 0 -row 1 -sticky snew

  label $dlg.style_lbl  -text "Font Style:" -anchor w
  entry $dlg.style_ent  -textvariable fd_style -width 11 -background white
  bind  $dlg.style_ent  <Key-Return>  "FontDialogRegen $font_name"
  grid config $dlg.style_lbl  -column 1 -row 0 -sticky w
  grid config $dlg.style_ent  -column 1 -row 1 -sticky snew

  label $dlg.size_lbl   -text "Size:" -anchor w
  entry $dlg.size_ent   -textvariable fd_size -width 4 -background white
  bind  $dlg.size_ent   <Key-Return> "FontDialogRegen $font_name"
  grid config $dlg.size_lbl   -column 2 -row 0 -sticky w
  grid config $dlg.size_ent   -column 2 -row 1 -sticky snew

  # Font family listbox.
  set fr $dlg.family_list
  frame $fr -bd 0
  listbox $fr.list -height 6 -selectmode single -width 30 \
    -background white -yscrollcommand "$fr.scroll set"
  scrollbar $fr.scroll -command "$fr.list yview"

  foreach f $families {
    $fr.list insert end $f
  }

  bind $fr.list <Double-Button-1> \
    "FontDialogFamily $fr.list $font_name $dlg.family_ent"

  pack $fr.scroll -side right -fill y
  pack $fr.list -side left
  grid config $fr -column 0 -row 2 -rowspan 16

  # Font style listbox.
  set fr $dlg.style_list
  frame $fr -bd 0
  listbox $fr.list -height 6 -selectmode single -width 11 \
    -background white -yscrollcommand "$fr.scroll set"
  scrollbar $fr.scroll -command "$fr.list yview"

  $fr.list insert end "Regular"
  $fr.list insert end "Bold"
  $fr.list insert end "Italic"
  $fr.list insert end "Bold Italic"

  bind $fr.list <Double-Button-1> \
    "FontDialogStyle $fr.list $font_name $dlg.style_ent"

  pack $fr.scroll -side right -fill y
  pack $fr.list -side left
  grid config $fr -column 1 -row 2 -rowspan 16

  # Font size listbox.
  set fr $dlg.size_list
  frame $fr -bd 0
  listbox $fr.list -height 6 -selectmode single -width 4 \
    -background white -yscrollcommand "$fr.scroll set"
  scrollbar $fr.scroll -command "$fr.list yview"

  for {set i 7} {$i <= 20} {incr i} {
    $fr.list insert end $i
  }

  bind $fr.list <Double-Button-1> \
    "FontDialogSize $fr.list $font_name $dlg.size_ent"

  pack $fr.scroll -side right -fill y
  pack $fr.list -side left
  grid config $fr -column 2 -row 2 -rowspan 16

  # OK/Cancel
  set fr $dlg.ok_cancel
  frame $fr -bd 0

  button $fr.ok -text "OK" -command "set fd_close 1"
  button $fr.cancel  -text "Cancel" -command "set fd_close 0"
  pack $fr.ok -side top -fill x
  pack $fr.cancel -side top -fill x -pady 2
  button $fr.help -text "Help" -command "helpWindow Options"
  pack $fr.help -side top -fill x -pady 10
  grid config $fr -column 4 -row 1 -rowspan 2 -sticky snew -padx 12

  # Sample text
  set fr $dlg.sample
  frame $fr -bd 3 -relief groove
  label $fr.l_sample -text "Sample" -anchor w

  label $fr.sample -font $font_name -bd 2 -relief sunken -text \
    "This is some sample text\nAaBbCcDdEeFfGgHhIiJjKkLlMm\n 0123456789. +=-"

  pack  $fr.l_sample -side top -fill x -pady 4
  pack  $fr.sample -side top -pady 4 -ipadx 10 -ipady 10

  grid config $fr -column 0 -columnspan 3 -row 20 \
    -rowspan 2 -sticky snew -pady 10 -padx 2

  # Make this a modal dialog.
  tkwait variable fd_close

  # Get rid of dialog and return value.
  destroy $dlg

  # Restore old font characteristics on a cancel:
  if { $fd_close == 0 } {
    font configure $font_name -family $family \
      -size $size -slant $slant -weight $weight
    return ""
  }

  return [list $fd_family $fd_size \
            [FontWeight $fd_style] [FontSlant $fd_style]]
}


proc FontDialogFamily { listname font_name entrywidget } {
  # Get selected text from list.
  catch {
    set item_num [$listname curselection]
    set item [$listname get $item_num]

    # Set selected list item into entry for font family.
    $entrywidget delete 0 end
    $entrywidget insert end $item

    # Use this family in the font and regenerate font.
    FontDialogRegen $font_name
  }
}


proc FontDialogStyle { listname font_name entrywidget } {
  # Get selected text from list.
  catch {
    set item_num [$listname curselection]
    set item [$listname get $item_num]

    # Set selected list item into entry for font family.
    $entrywidget delete 0 end
    $entrywidget insert end $item

    # Use this family in the font and regenerate font.
    FontDialogRegen $font_name
  }
}


proc FontDialogSize { listname font_name entrywidget } {
  # Get selected text from list.
  catch {
    set item_num [$listname curselection]
    set item [$listname get $item_num]

    # Set selected list item into entry for font family.
    $entrywidget delete 0 end
    $entrywidget insert end $item

    # Use this family in the font and regenerate font.
    FontDialogRegen $font_name
  }
}

proc FontWeight {style} {
  if { $style == "Bold Italic" || $style == "Bold" } {
    return "bold"
  }
  return "normal"
}

proc FontSlant {style} {
  if { $style == "Bold Italic" || $style == "Italic" } {
    return "italic"
  }
  return "roman"
}

# FontDialogRegen: Regenerates font from attributes.
proc FontDialogRegen { font_name } {
  global fd_family fd_style fd_size

  set weight "normal"
  if { $fd_style == "Bold Italic" || $fd_style == "Bold" } {
    set weight "bold"
  }

  set slant "roman"
  if { $fd_style == "Bold Italic" || $fd_style == "Italic" } {
    set slant "italic"
  }

  # Change font to have new characteristics.
  font configure $font_name -family $fd_family \
    -size $fd_size -slant $slant -weight $weight
}

## End of file: fontsel.tcl
# basewind.tcl: part of Scid
# Copyright (C) 2000   Shane Hudson.


# 0: Unknown/empty
image create photo dbt0 -format gif -data \
 "R0lGODdhIAAgAIAAAAAAAP///ywAAAAAIAAgAAACHoyPqcvtD6OctNqLs968+w+G4kiW5omm
  6sq27gubBQA7"

# 1: Temporary database
image create photo dbt1 -format gif -data \
 "R0lGODdhIAAgAKEAAP///wAAAOHh4X9/fywAAAAAIAAgAAACXYSPqcvtD6OctNKAs9Y2iA+G
  X2AB20mWnhimHduWpjDQX127lYfftn6x1YQC4IRnIxolyGFvGWn6cjKpskq8qrJPbE/7+na3
  4p83OX7BRth1UWZCYeD0uv2Oz+sXBQA7"

# 2: Clipbase
image create photo dbt2 -format gif -data \
 "R0lGODdhIAAgAMIAAP///wAAqgAAAP//AOrq6gAAAAAAAAAAACwAAAAAIAAgAAADwAi63P4Q
  hKkCs9NKWvVd2KeFUmmCjVeOG3tWqIpxrHvR2Xp7XOT/wKBwISgaj8ik8SEYOJ/QqPTpaE6v
  2IZ1oOx2tU7BEGgVj39lUGbNbvcA6QphbpwT6vTinBGX2PF3enkCe0RhIH+CgYSDhQp9AYCS
  ikV8hxWTjIuJllwgmYmalYaeco2nmwSdZn6ooKqkrAGhtKern5S5oqxwlxKvqYG3mLq1wrGI
  rsWwj76zyruMw63Br9ORy9W8TbzY0cZFCQA7"

# 3: PGN file
image create photo dbt3 -format gif -data \
 "R0lGODdhIAAgAKEAAP////8AAAAA/wAAACwAAAAAIAAgAAACZISPqcvtD6MMlKIajAXbiP9p
  WMaNpfhsVoWyHQCG5/mKWGqqq3nEgq2z0WqKGmtYInliqMQoE3QQk7vmEiTJaiW+rvcr227B
  ZLBYXE77zmO1m611v+FceZpet5PxEX2ZDxiIVwAAOw=="

# 4: My games
image create photo dbt4 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEg9DISau9lOjNu//eI45kaZ7cqa5kyr6mC8+PTL/2veY6uo2B
  gCkIDBqNIxmxtHw0fZqiUFpkKZ9I0TP202aP1V3X+c2Sj8/rWdjcltTg9lSlJnvD9PFyP3e3
  9HN4fkmAQ31oZjw9b2OLUASOYlGRj5SVloyTmISamzWNmyCio6SlphsRADs="

# 5: Large database
image create photo dbt5 -format gif -data \
 "R0lGODdhIAAgAKEAAP8AAP///wAA/wAAACwAAAAAIAAgAAACiYSPqcvtH6KctFpks544iA9+
  WRhGHQmOqGAeUblR8AnH3uzeNxunYkB7/VS8X1DIq6SELQNTspxEdcCcZTqldIjIzZaYrXzB
  tvE1LLaChxmz9IeWuLtQtjbHDmN5xx33eRRHZ4THIlhnyFd4+LZEY9fjuEiyJum0Q3mG0gRg
  4ymn9un1QFpqeloAADs="

# 6: Correspondence chess
image create photo dbt6 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEuPDJ+YC1NOs97fkfxo0UcDxgKpIcgL5p6LLZPJ24atM7leu8
  1waHAo5MMM4PtKoliRniwTPdmFLJ4ZWpuVI/2U6sWgsxvk/UltrzMs5f6TpEFk/fF/RpLivf
  zzJUaipqbTKATBd0XFNta1uJi5E9EnFjTJd1XZCXnFwkliqZlJueU52kNQYGlpxNoKusX480
  JbEeuI21qqsmvhe7Xbe/wS23p6nBAMO6xcK9yM7Pss3SGdAuydKvNBEAOw=="

# 7: Computer chess
image create photo dbt7 -format gif -data \
 "R0lGODdhIAAgAKEAAP///wAAAOHh4QAA/ywAAAAAIAAgAAACdISPqcvtD6OctNrrgt680yCE
  4kgGEigM6squoQmBrRrMgwA/cmvWLR7ZrXI+Vy6T4gGKxmByeGDejg3hgMoExp7XRJbKsHY0
  LK0uZJu9TqT2CJwZy+HxuSdoz9Oj7v77rDdmFuZXuGcQaIexyNjo+AgZ6VAAADs="

# 8: Index of games
image create photo dbt8 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEovDJSau9OOvNu/9gKALkE5wPqa5A10pJHGtvxrImqkrAcWC1
  i2zGS/kut1wglUwZf5UgbIh09qCT0ml5w1mflNcwsWmZwbyuuvQ1H52hs/z9WkvbVvoIfy0y
  11F8enFtCQGDgBZyKYeDIHKGPo4fco1vW5iZmDVmkZI8Y6FjAEtWllh2ajqebxSir2OnGJq0
  mpJYF7e6u7scvL+3IsLDxMUUEQA7"

# 9: Player collection
image create photo dbt9 -format gif -data \
 "R0lGODdhIAAgAKEAAP///wAAANjGpuFCACwAAAAAIAAgAAACg4SPqcvtD6NMoYYJg9jiYqZx
  m/dR4liaJ5oa4Uq2LxfLcKuyOBLW++wrVWBByewmXCExR2VRYYlKp9FGYIDNarfcQfCadXkq
  YrHWB8aSAeu250zZltnj+jaWVtfn6/shj8W3R8c1VjjoZlDI1iUo2FUBiTgI2WV5iZmpKUnV
  6Tm141AAADs="

# 10: Tournament, all-play-all
image create photo dbt10 -format gif -data \
 "R0lGODdhIAAgAKEAAP///wAAAAAA//8AACwAAAAAIAAgAAACZoSPqcvtH6KMYM6HM7RVdq+F
  4kg2gnEC6YqW7usIsmwExnDnAL7rmA1rAF0zWq+i4yl9mmFQ4QwVU0vkscojRZ+HbayY1AGx
  QS/XnJiGr7X1E13+ztZka5ZrxSO8ara/CqcnOJhQAAA7"

# 11: Tournament, Swiss
image create photo dbt11 -format gif -data \
 "R0lGODdhIAAgAIAAAP8AAP///ywAAAAAIAAgAAACRYSPqcvtD6OctFoQss437d0hnxYeI1di
  Z6qO7BlU8Pw59B03OG3vcO9z6YJCBrG4ONYov1Sz9AxFO9NL1XJlabfcrldRAAA7"

# 12: GM games
image create photo dbt12 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEjNDISau9lOjNu//eI45kaZ7cqa5kyr6mC8+PTL/2veY6upWB
  YNA0BAZEMuFIuTwakT9RsUliSouuadX5sHaxUa1K6CRDNVeY+QtGf5vrt7lNSBO5w7kzy91S
  34BJfWx/RXRwcHiDgVGJR1NijG49O42UPpOXMZaaLZydZ3WgJTygpZ2nmiCrrK2urxsRADs="

# 13: IM games
image create photo dbt13 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEhNDISau9lOjNu//eI45kaZ7cqa5kyr6mC8+PTL/2veY6up2B
  wChoIpZ4D2NSWFKOkMogUySN/YrT6tApgma10unz2vwaw1YN8LskcmtkUlSIfnu3VKY9js/7
  l2kEa31yYl18f4BlgT04iI0tj5CHapM+lZZHkpNIlp2cm5Ago6SlpqcbEQA7"

# 14: Blitz games
image create photo dbt14 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEgvDJSau9OOvNu89AKI7AV4VOqqqlKaHrGroPHKfh4dp3rn+8
  mO/XCcoAhyQQcGMhlR6jM0nkSHGk2ebaxFm7XZGVBHYMo8zwsApKN9dsDHeNVj+hYzUV/33f
  +WM2Ins0NW5whYJ/cUVpg1SFhlh7jI2TkJEoj4A7ZouRE5uchZSgEhEAOw=="

# 15: Tactics
image create photo dbt15 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEdtDISau9lOjNu//eI45kaZ7cqa5kyr6mC8+PTL/2veY6uqmB
  wCkY9GmAwlLxsWz9hslRkxkV8URTKil71bK4T1NWWbWGyatx7bwtS93mIxSp6vZG9vtaLoZ7
  Y2x6TnyCJXl3hz2JOos3jTSPM5EwIJWWl5iZGxEAOw=="

# 16: Endings
image create photo dbt16 -format gif -data \
 "R0lGODdhIAAgAKEAAP///wAAAP/73wAAACwAAAAAIAAgAAAChYSPqcsZDWOYsa5ns5lYXwoE
  AsZ54TQ+orqCFToK6RynVsulONpBO6/L9Ro/Hkd4Kx6FQ2JLBpUZPbBltfmyWjeg0ql3jAY3
  wTJYuySLxec1tIs+OuJD0RpLRZsUdvbe4Yan0RclmEH49oeAKKV4wDjiyKUlCcNm6EPnMghZ
  iMmn6SXJUAAAOw=="

# 17: Openings for White
image create photo dbt17 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAErvDJSau9F+jNu9cYMBxDaZ4oCoRj6rqgJZJvXQLHWs22jec6
  Ca/3+gWCjyExZUQqURLf4XCkPE2UWtPaSmWL0+rkWvrCws6u9yGlpmnQiRbNhWMrYHd9bVbR
  x2plF2d6gHYDGIRiQoGIg0x/jIdLN5FJjZQDW4aZfoWSnSeboKGVn5eTlKOopaaLSRqtmpY/
  H7YetD9Tu7y9vpawv8LCr0IbAcjJysvMSFa30BwSEQA7"

# 18: Openings for Black
image create photo dbt18 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAErvDJSau9F+jNu9cYMBxDaZ4oCoRj6rqgJZJvXQLHWs22jec6
  Ca/3+gWCjyExZUQqVaJak/I0caSHw5HaYm6wWmcXqgFvJ1VrtJg9C8enKzvMpcU7c3cSfsPD
  2mJ2fR5/dGh8H2txgHVkfiqMh4JLVpFvk5QDU5KZkIaXnYufe5iUm6ChN5akqaqjX62nSVmJ
  tRyrGlm6u7y9u3pJP77DvcDBGgHJysvMzUhUttExEQA7"

# 19: Openings for either color
image create photo dbt19 -format gif -data \
 "R0lGODdhIAAgANMAAAAAAAAAqgCqAACqqqoAAKoAqqpVAKqqqlVVVVVV/1X/VVX///9VVf9V
  ////Vf///ywAAAAAIAAgAAAEuvDJSau9F+jNu9cYMBxDaZ4oCoRj6rqgJZKq+JrAsVZzrd2l
  nG4n6Z04wIEwQHwYcZvksvmEJpWHA5NSVUaBU24LiryFJ1UPOLtFj73q17n4/tgkKja1/hlQ
  jnpiNEB/OIFugzeFQYd0iYoPeVp7jy6LWJOCSRaGmYibFZ1tjoQXjJ6kkJyYo05vlqaslFdy
  ja6VtLJcP7mSrUJ2wRy2GlnGx8jJx61OQsrPyczNGgHV1tfY2U27wt07EQA7"

# 20: Theory: 1.c4
image create photo dbt20 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACfYRvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN3UniXebq3/fuLBWlDmwN31CV5S18T+BRqokSqTSCYKB8lwWCQ3Wy1
  PCzZyU15wRdmerX+ZpHvCPY+H7fRZ2h9VvUX2CclaGTI4kc4uKfYWLh4GJkI+cgo5jZZo1EA
  ADs="

# 21: Theory: 1.d4
image create photo dbt21 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACf4RvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN3UniXebq3/fuLBWlDmwN31CV5S18T+BRqokSq8aEQCKRYJlYwGGyv
  E2VXyy17y2Bxtet8tMNbFlSuzZMva35cPXMHKOhHuGE2mFaoeNjX+Lf4ligZufdoiASHiVip
  UQAAOw=="

# 22: Theory: 1.d4 d5
image create photo dbt22 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACh4RvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN3UggIwlTepa67pHzDoLBFbAF3m57jswzinqPobvpwZocaKneL9Opi
  yZdPMBgIaGWyeM32hrNodRxsftbTa1b+YWUj98fzVThDeJTYZKjohvd4uIglGel4V4l5KQip
  yTiXyRnqZwlQAAA7"

# 23: Theory: QGD
image create photo dbt23 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACmYRvoauIzNyB6wgxaZBJm3t1
  FAdo24eJEGmiYelxLQjCo+zRYYvfksn7xYS+l23VQ9JUkWQTYAw6eMvjc5rTWSvOig4jfQyx
  PhIZSURHFRduuikYDFJsuaDRxUNTtrb+DGfXETf3JzZCKBiQWMiStbSoc/LmBlh5CHSFqZlR
  tnnZiWZpGMrJBHpKmjo5yvqpugUbVooa63pQAAA7"

# 24: Theory: Slav
image create photo dbt24 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACmIRvoauIzI4QBy5XbTBzJo19
  lkSJUAhoG9CVKvq23hvGcgrWOUbz6u7oBXceU0Q3YnWMF+SJU8IlfckWs+GMyCjCB2grfVLF
  wymqTPZOi9JJc3wUDAaugJyOhb/ZC3ceHTdXdyfwp3ZyJ5iSiAfzdWMns6JnmGF2+PMGqInJ
  aZn2eUQ5uVl5RdppGiZaihrqeep4+aradVAAADs="

# 25: Theory: 1.d4 Nf6
image create photo dbt25 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACioRvoauIKqJoLrFVrYwhg4tl
  wcZ5IFWNZCeeJiexqdtCZX29q0lXZNxznGTC4MN4GPJAyxyO0YQ+QzPmFFW0Vp1baZfqyXLF
  3iwHe9QWBYPBhJgep8/wJFLTfkfBD3bbXWeh1rdzFfhxhzg0aMcoKNcI+VgWRxlpOcl3qZmJ
  tunZeahkuAeqKAlQAAA7"

# 26: Theory: 1.e4
image create photo dbt26 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACfYRvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN3UniXebq3/fuLBWlDmwN31CV5S18T+BRqokSq8aETCCZKbEowGGw3
  XS5Pa3Z6W2DxhbmOtMNbZLyizdfLb3V6JnVXJXj1F2g4iFjYB0XI0qj4eMg4SQYXWSOZaFAA
  ADs="

# 27: Theory: Sicilian
image create photo dbt27 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAAChYRvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN30iII8V3yeU7jpYTAoCPk+xkfveNPyXrdnsDo7thkDjXYrbYlBOcm
  WXJKMBgILl6zeM0Gd1todVw6j9TTa2S+QtVXdnf1NVPohmeISLiUyLgxGNnWaPPnWGmFOSm3
  uOnnaRmqUQAAOw=="

# 28: Theory: Sicilian 1.e4 c5 2.Nd3 d6 3.d4
image create photo dbt28 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACo4RvoauIzNxZQiyZYMOq1i1p
  oENZ4yNiQOedU8p5rSoGtPzRcLiTdY/S6AIfV0bIIbZsSSRPeWlCdDLjCjjBWYbTGI757IYj
  UrJqHEVbS+nKy+kTDAYmg5x+FPugIHfeHDdXB3An8JdGcidoo4hXc/NFiHMFF6Rn+YOIGSVz
  uJbSaPhYRjFnKorlSURXSHn5BuFB6JjqatY6qsaoiFoJy6BVUQAAOw=="

# 29: Theory: Caro-Kann
image create photo dbt29 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACh4RvoauIzI4QBy5XbTBzJo19
  lkSJUAhoG9CVKvq23hvGcgrWOUbz6u7oBYEPYmakQ/qUQ2bReTwlpUtq0/rERiNTLqrqvYaz
  Xo9pvL2wBgOX8axmlXBQeGPdtq/AFwGbTSFE1ncjmHbH97MnFseI6Lg4+CgZeVipB/NGp4XZ
  1UiZWbeJ1olRAAA7"

# 30: Theory: French
image create photo dbt30 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACiIRvoauIzNyB6wgxaZBJm3t1
  FAdo24eJEGmiYelxLQjCo+zRYYvfksn7xYQ+R9A4RBYfSeYy81RFeivqlFjFXpVZ7pbk7Ia/
  0OzLJi5PBYNB6jiuoNRyrZztlta9FXwbA0fXoAPYJHhiB4TI12C1F9eYuAg5echiqBfJWJnJ
  iUbWeRn1+WjJUQAAOw=="

# 31: Theory: Open Games
image create photo dbt31 -format gif -data \
 "R0lGODdhIAAgAKEAAP/739jGpgAAAP///ywAAAAAIAAgAAACh4RvoauIzNyBSyYaLMDZcv15
  GDiKFHmaELqqkVvBXCN3UngrghDnab7b0Xwtn3DowCUDQZ5t+Us2hazXbcqr9qBFDdf63T5K
  gN2EHKYJBgPBJTr+md/deGvdpoPtETzbrcRXgbWBJoh0OKOFeAbXWPe4Fyk2yahHeWlZ6Jj5
  lLjoWRnaCapRAAA7"


set base_types {
  Unknown
  {Temporary database}
  Clipbase
  {PGN format file}
  {My games}
  {Large database}
  {Correspondence chess}
  {Computer chess}
  {Sorted Index of games}
  {Player collection}
  {Tournament: All-play-all}
  {Tournament: Swiss}
  {Grandmaster games}
  {International Master games}
  {Blitz (fast) games}
  {Tactics}
  {Endgames}
  {Openings for White}
  {Openings for Black}
  {Openings for either color}
  {Theory: 1.c4}
  {Theory: 1.d4}
  {Theory: 1.d4 d5}
  {Theory: QGD: 1.d4 d5 2.c4 e6}
  {Theory: Slav: 1.d4 d5 2.c4 c6}
  {Theory: 1.d4 Nf6}
  {Theory: 1.e4}
  {Theory: Sicilian: 1.e4 c5}
  {Theory: Sicilian: 1.e4 c5 2.Nf3 d6 3.d4}
  {Theory: Caro-Kann: 1.e4 c6}
  {Theory: French: 1.e4 e6}
  {Theory: Open Games: 1.e4 e5}
}


set numBaseTypeIcons [llength $base_types]

set temp_dbtype 0

proc selectBaseType {type} {
  global temp_dbtype
  set w .btypeWin
  if {![winfo exists $w]} { return }
  $w.t configure -state normal
  set temp_dbtype $type
  set linenum [expr $type + 1]
  $w.t tag remove sel 1.0 end
  $w.t tag remove selected 1.0 end
  $w.t tag add selected "${linenum}.2 linestart" "$linenum.2 lineend"
  $w.t see $linenum.2
  $w.t configure -state disabled
}

proc clickBaseType {x y} {
  set type [.btypeWin.t index "@$x,$y linestart"]
  set type [expr int($type) - 1]
  selectBaseType $type
}

proc changeBaseType {baseNum} {
  global temp_dbtype base_types numBaseTypeIcons
  if {$baseNum > [sc_base count total]} { return }
  set temp_dbtype [sc_base type $baseNum]
  if {$temp_dbtype >= $numBaseTypeIcons} { set temp_dbtype 0 }
  toplevel .btypeWin
  set w .btypeWin
  wm title $w "Scid: Choose database icon"

  text $w.t -yscrollcommand "$w.yscroll set" -font font_Regular \
    -height 25 -width 40 -background white -wrap none \
    -cursor top_left_arrow
  $w.t tag configure selected -background {#ffff80}

  scrollbar $w.yscroll -command "$w.t yview" -takefocus 0
  pack [frame $w.b] -side bottom -pady 5
  pack $w.yscroll -side right -fill y
  pack $w.t -side left -fill both -expand yes

  button $w.b.set -text "OK" -command \
    "catch {sc_base type $baseNum \$temp_dbtype}; updateBaseWin;
     focus .; destroy $w"

  button $w.b.cancel -text "Cancel" -command "focus .; destroy $w; focus ."
  pack $w.b.set $w.b.cancel -side left -padx 5

  set numtypes [llength $base_types]
  for {set i  0} {$i < $numtypes} {incr i} {
    if {$i > 0} { $w.t insert end "\n" }
    $w.t image create end -image dbt$i -pady 3 -padx 3
    $w.t insert end "   [lindex $base_types $i]  "
  } 

  bind $w.t <Double-ButtonRelease-1> "clickBaseType %x %y; $w.b.set invoke"
  bind $w.t <ButtonRelease-1> "clickBaseType %x %y"
  bind $w.t <Button1-Motion> "clickBaseType %x %y; break"

  bind $w <Up> {
    if {$temp_dbtype != 0} { selectBaseType [expr $temp_dbtype - 1] }
    break
  }

  bind $w <Down> {
    if {$temp_dbtype < [expr [llength $base_types] - 1]} {
      selectBaseType [expr $temp_dbtype + 1]
    }
    break
  }

  bind $w <Home> { selectBaseType 0 }
  bind $w <End> { selectBaseType [expr [llength $base_types] - 1] }
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.set invoke"

  focus $w.t
  grab $w
  update
  selectBaseType $temp_dbtype
}



proc baseWin_onCursor {i} {
  if {! [winfo exists .baseWin]} {return}
  foreach win {"" .img .name .ngames} {
    .baseWin.f$i$win configure -cursor exchange
  }
}

proc baseWin_offCursor {fromBase x y} {
  if {! [winfo exists .baseWin]} {return}
  foreach win {"" .img .name .ngames} {
    .baseWin.f$fromBase$win configure -cursor {}
  }
  set dropPoint [winfo containing $x $y]
  if {! [string match ".baseWin.f*" $dropPoint]} {return}
  set toBase [string range $dropPoint 10 10]
  if {$toBase == $fromBase} {switchBase $toBase} else {
    copyFilter $fromBase $toBase
  }
}

set baseWin 0

proc makeBaseWin {} {
  global baseWin
  if {[winfo exists .baseWin]} {
    focus .
    destroy .baseWin
    set baseWin 0
    return
  }
  set baseWin 1
  set w [toplevel .baseWin]
  bind $w <Configure> "recordWinSize $w"
  setWinLocation $w

  wm resizable $w false false
  wm title $w "Scid: [tr WindowsSwitcher]"
  bind $w <Escape> makeBaseWin
  bind $w <Destroy> { set baseWin 0 }
  bind $w <F1> { helpWindow Switcher }
  standardShortcuts $w

  set side left
  if {$::switcherVertical} { set side top }
  set numBases [sc_base count total]

  for {set i 1} {$i <= $numBases} {incr i} {
    set f [frame $w.f$i -background white -borderwidth 1 -relief ridge]
    pack $f -side $side
    label $f.img -image dbt0 -relief solid -borderwidth 1
    label $f.name -width 13 -anchor w -font font_Small
    label $f.ngames -text "0" -width 13 -anchor e -font font_Small
    pack $f.img -side top -padx 4 -pady 4
    pack $f.name -side top -padx 2 -fill x
    pack $f.ngames -side top -padx 2 -fill x
    foreach win {"" .img .name .ngames} {
      bind $f$win <ButtonPress-1> "baseWin_onCursor $i"
      bind $f$win <ButtonRelease-1> "baseWin_offCursor $i %X %Y"
    }
    menu $f.menu -tearoff 0
    $f.menu add command -label [tr SearchReset] \
      -command "sc_filter reset $i; updateStatsWin"
    $f.menu add command -label "Change icon..." -command "changeBaseType $i"
    $f.menu add separator
    set closeLabel [tr FileClose]
    if {$i == [sc_info clipbase]} { set closeLabel [tr EditReset] }
    $f.menu add command -label $closeLabel \
      -command "catch {sc_base close $i}"
    foreach win {"" .img .name .ngames} {
      bind $f$win <ButtonPress-3> "tk_popup $f.menu %X %Y"
    }
    $f.menu add separator
    $f.menu add command -label $::tr(ChangeOrient) -command orientBaseWin
  }
  updateBaseWin
}

proc orientBaseWin {} {
  global switcherVertical
  if {$switcherVertical} {
    set switcherVertical 0
    set side left
  } else {
    set switcherVertical 1
    set side top
  }

  set w .baseWin
  set numBases [sc_base count total]

  for {set i 1} {$i <= $numBases} {incr i} {
    pack forget $w.f$i
  }
  for {set i 1} {$i <= $numBases} {incr i} {
    pack $w.f$i -side $side
  }
}

proc updateBaseWin {} {
  global numBaseTypeIcons
  if {! [winfo exists .baseWin]} { return }
  set numBases [sc_base count total]
  set current [sc_base current]
  for {set i 1} {$i <= $numBases} {incr i} {
    .baseWin.f$i configure -background white
    set dbtype [sc_base type $i]
    if {$dbtype >= $numBaseTypeIcons} { set dbtype 0 }
    .baseWin.f$i.img configure -image dbt$dbtype -background white
    .baseWin.f$i.name configure -background white \
      -text "$i: [file tail [sc_base filename $i]]"
    .baseWin.f$i.ngames configure -background white \
      -text "[filterText $i 100000]"
  }

  .baseWin.f$current configure -background {#ffff80}
  foreach i {.img .name .ngames} {
    .baseWin.f$current$i configure -background {#ffff80}
  }
}

###
### import.tcl: part of Scid.
### Copyright (C) 2000  Shane Hudson.
###

### Import game window

proc importPgnGame {} {
  if {[winfo exists .importWin]} { return }
  set w [toplevel .importWin]
  wm title $w "Scid: Import PGN game"
  wm minsize $w 50 5
  frame $w.b
  pack $w.b -side bottom
  set pane [::pane::create $w.pane edit err 650 300 0.8]
  pack $pane -side top -expand true -fill both
  set edit $w.pane.edit
  text $edit.text -height 12 -width 75 -wrap none \
    -background white -selectbackground lightBlue \
    -yscroll "$edit.ybar set" -xscroll "$edit.xbar set"  -setgrid 1
  # Override tab-binding for this widget:
  bind $edit.text <Key-Tab> "[bind all <Key-Tab>]; break"
  scrollbar $edit.ybar -command "$edit.text yview" -takefocus 0
  scrollbar $edit.xbar -orient horizontal -command "$edit.text xview" \
    -takefocus 0
  grid $edit.text -row 0 -column 0 -sticky nesw
  grid $edit.ybar -row 0 -column 1 -sticky nesw
  grid $edit.xbar -row 1 -column 0 -sticky nesw
  grid rowconfig $edit 0 -weight 1 -minsize 0
  grid columnconfig $edit 0 -weight 1 -minsize 0

  # Right-mouse button cut/copy/paste menu:
  menu $edit.text.rmenu -tearoff 0
  $edit.text.rmenu add command -label "Cut" -command "tk_textCut $edit.text"
  $edit.text.rmenu add command -label "Copy" -command "tk_textCopy $edit.text"
  $edit.text.rmenu add command -label "Paste" -command "tk_textPaste $edit.text"
  $edit.text.rmenu add command -label "Select all" -command \
    "$edit.text tag add sel 1.0 end"
  bind $edit.text <ButtonPress-3> "tk_popup $edit.text.rmenu %X %Y"

  text $pane.err.text -height 4 -width 75 -wrap word \
    -yscroll "$pane.err.scroll set"
  $pane.err.text insert end $::tr(ImportHelp1)
  $pane.err.text insert end "\n"
  $pane.err.text insert end $::tr(ImportHelp2)
  $pane.err.text configure -state disabled
  scrollbar $pane.err.scroll -command "$pane.err.text yview" -takefocus 0
  pack $pane.err.scroll -side right -fill y
  pack $pane.err.text -side left -expand true -fill both

  button $w.b.paste -text "$::tr(PasteCurrentGame) (Alt-P)" -command {
    .importWin.pane.edit.text delete 1.0 end
    .importWin.pane.edit.text insert end [sc_game pgn -width 70]
    .importWin.pane.err.text configure -state normal
    .importWin.pane.err.text delete 1.0 end
    .importWin.pane.err.text configure -state disabled
  }
  button $w.b.clear -text "$::tr(Clear) (Alt-C)" -command {
    .importWin.pane.edit.text delete 1.0 end
    .importWin.pane.err.text configure -state normal
    .importWin.pane.err.text delete 1.0 end
    .importWin.pane.err.text configure -state disabled
  }
  button $w.b.ok -text "$::tr(Import) (Alt-I)" -command {
    set err [catch {sc_game import \
                      [.importWin.pane.edit.text get 1.0 end]} result]
    .importWin.pane.err.text configure -state normal
    .importWin.pane.err.text delete 1.0 end
    .importWin.pane.err.text insert end $result
    .importWin.pane.err.text configure -state disabled
    if {! $err} {
      updateBoardAndPgn .board
      updateTitle
    }
  }
  button $w.b.cancel -textvar ::tr(Close) -command {
    destroy .importWin; focus .
  }
  frame $w.b.space -width 20
  pack $w.b.paste $w.b.clear $w.b.space -side left -padx 2 -pady 2
  pack $w.b.cancel $w.b.ok -side right -padx 10 -pady 5
  # Paste the current selected text automatically:
  if {! [catch {$w.pane.edit.text insert end [selection get]}]} {
    # Select all of the pasted text:
    $w.pane.edit.text tag add sel 1.0 end
  }
  bind $w <F1> { helpWindow Import }
  bind $w <Alt-i> { .importWin.b.ok invoke }
  bind $w <Alt-p> { .importWin.b.paste invoke }
  bind $w <Alt-c> { .importWin.b.clear invoke }
  bind $w <Escape> { .importWin.b.cancel invoke }
  focus $w.pane.edit.text
}


proc importPgnLine {line} {
  importPgnGame
  set w .importWin.pane.edit.text
  $w delete 1.0 end
  $w insert end $line
  focus $w
}

proc importMoveList {line} {
  sc_move start
  sc_move addSan $line
  updateBoardAndPgn .board
}

set importPgnErrors ""

### Import file of Pgn games:

proc importPgnFile {} {
  global importPgnErrors

  set err ""
  if {[sc_base isReadOnly]} { set err "This database is read-only." }
  if {![sc_base inUse]} { set err "This is not an open database." }
  if {$err != ""} {
    tk_messageBox -type ok -icon error -title "Scid: Error" -message $err
    return
  }
  if {[sc_info gzip]} {
    set ftypes {
      { "Portable Game Notation files" {".pgn" ".PGN" ".pgn.gz"} }
      { "Text files" {".txt" ".TXT"} }
      { "All files" {"*"} }
    }
  } else {
    set ftypes {
      { "Portable Game Notation files" {".pgn" ".PGN"} }
      { "Text files" {".txt" ".TXT"} }
      { "All files" {"*"} }
    }
  }
  set fname [tk_getOpenFile -filetypes $ftypes -title "Import from a PGN file"]
  if {$fname == ""} {return}
  doPgnFileImport $fname ""
}

proc doPgnFileImport {fname text} {
  set w .ipgnWin
  if {[winfo exists $w]} { destroy $w }
  toplevel $w
  wm title $w "Scid: Importing PGN file"
  canvas $w.progress -width 400 -height 20 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 395 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  pack $w.progress -side bottom

  frame $w.buttons
  pack $w.buttons -side bottom -fill x
  button $w.buttons.stop -textvar ::tr(Stop) -command {sc_progressBar}
  button $w.buttons.close -textvar ::tr(Close) -command "focus .; destroy $w"
  pack $w.buttons.close $w.buttons.stop -side right -ipadx 5 -padx 5 -pady 2

  pack [frame $w.tf] -side top -expand yes -fill both
  text $w.text -height 8 -width 60 -background gray90 \
    -wrap none -cursor watch -setgrid 1 -yscrollcommand "$w.ybar set"
  scrollbar $w.ybar -command "$w.text yview"
  pack $w.ybar -in $w.tf -side right -fill y
  pack $w.text -in $w.tf -side left -fill both -expand yes
  update

  busyCursor .
  sc_progressBar $w.progress bar 401 21 time
  catch {grab $w.buttons.stop}
  bind $w <Escape> "$w.buttons.stop invoke"
  $w.buttons.close configure -state disabled
  $w.text insert end $text
  $w.text insert end "Importing PGN games from [file tail $fname]...\n\n"
  $w.text configure -state disabled

  set importPgnErrors ""
  catch {sc_base import file $fname} result
  $w.text configure -state normal
  $w.text configure -cursor top_left_arrow
  $w.text insert end $result
  $w.text configure -state disabled
  $w.buttons.close configure -state normal
  $w.buttons.stop configure -state disabled
  catch {grab release $w.buttons.stop}
  bind $w <Escape> "$w.buttons.close invoke; break"
  unbusyCursor .
  updateTitle
  updateMenuStates
  updateBaseWin
  updateMaintWin
  update
}

###
### End of file: import.tcl
###

### spellchk.tcl
### Part of Scid.
### Copyright (C) 2000 Shane Hudson.

set spellcheckType Player
set spell_maxCorrections 2000
set spellcheckSurnames 0
set spellcheckAmbiguous 1

# readSpellCheckFile:
#    Presents a File Open dialog box for a Scid spellcheck file,
#    then tries to read the file. If the parameter "message" is true
#    (which is the default), a message box indicating the results
#    is displayed.
#
proc readSpellCheckFile {{message 1}} {
  global spellCheckFile
  set ftype { { "Scid Spellcheck files" {".ssp" ".ssp.gz"} } }
  set fullname [tk_getOpenFile -initialdir [pwd] -filetypes $ftype -title "Open Spellcheck file"]
  if {![string compare $fullname ""]} { return 0 }
  
  if {[catch {sc_name read $fullname} result]} {
      if {$message} {
        tk_messageBox -title "ERROR: Unable to read file" -type ok \
          -icon error -message "Scid could not correctly read the spellcheck file you selected:\n\n$result"
      }
    return 0
  }
  set spellCheckFile $fullname
  if {$message} {
    tk_messageBox -title "Spellcheck file loaded." -type ok -icon info \
      -message "Spellcheck file [file tail $fullname] loaded:\n[lindex $result 0] players, [lindex $result 1] events, [lindex $result 2] sites, [lindex $result 3] rounds.\n\nTo have this file automatically loaded every time you start Scid, select the \"Save Options\" from the Options menu before exiting."
  }
  return 1
}

proc updateSpellCheckWin {type} {
  global spellcheckType spell_maxCorrections spellcheckSurnames
  global spellcheckAmbiguous
  busyCursor .
  .spellcheckWin.text.text delete 1.0 end
  #.spellcheckWin.text.text insert end "Finding player corrections..."
  update idletasks
  catch {sc_name spellcheck -max $spell_maxCorrections \
           -surnames $spellcheckSurnames \
           -ambiguous $spellcheckAmbiguous $type} result
  .spellcheckWin.text.text delete 1.0 end
  .spellcheckWin.text.text insert end $result
  unbusyCursor .
}

proc openSpellCheckWin {type {parent .}} {
  global spellcheckType spell_maxCorrections spellcheckSurnames
  global spellcheckAmbiguous
  set w .spellcheckWin
  if {[winfo exists $w]} {
    tk_messageBox -type ok -icon info -title "Scid: Spellcheck error" \
      -parent $parent \
      -message "The spellcheck window is already open; close it first."
    return
  }
  if {[lindex [sc_name read] 0] == 0} {
    # No spellcheck file loaded, so try to open one:
    if {![readSpellCheckFile]} {
      return
    }
  }
  busyCursor .
  if {[catch {sc_name spellcheck -max $spell_maxCorrections \
                -surnames $spellcheckSurnames \
                -ambiguous $spellcheckAmbiguous $type} result]} {
    unbusyCursor .
    tk_messageBox -type ok -icon info -title "Scid: Spellcheck results" \
      -parent $parent -message $result
    return
  }
  unbusyCursor .
  set spellcheckType $type

  toplevel $w
  wm title $w "Scid: Spellcheck Results"
  wm minsize $w 50 10

  bind $w <F1> { helpWindow Maintenance }
  bind $w <Configure> "recordWinSize $w"

  set f [frame $w.buttons]
  pack $f -side bottom -ipady 1 -fill x

  checkbutton $f.ambig -variable spellcheckAmbiguous -relief raised \
    -text "Ambiguous" -command "updateSpellCheckWin $type"
  pack $f.ambig -side left -padx 2 -ipady 2 -ipadx 3
  if {$type == "Player"} {
    checkbutton $f.surnames -variable spellcheckSurnames -relief raised \
      -text "Surnames" -command "updateSpellCheckWin Player"
    pack $f.surnames -side left -padx 2 -ipady 2 -ipadx 3
  }

  button $f.ok -text "Make Corrections" -underline 0 -command {
    busyCursor .
    set spelltext ""
    catch {set spelltext [.spellcheckWin.text.text get 1.0 end-1c]}
    .spellcheckWin.text.text delete 1.0 end
    .spellcheckWin.text.text insert end \
      "Scid is making the spelling corrections.\nPlease wait..."
    update idletasks
    set spell_result ""
    set result [catch {sc_name correct $spellcheckType $spelltext} spell_result]
    set messageIcon info
    if {$result} { set messageIcon error }
    tk_messageBox -type ok -parent .spellcheckWin -icon $messageIcon \
      -title "Scid: Spellcheck results" -message $spell_result
    unbusyCursor .
    focus .
    destroy .spellcheckWin
    sc_game tags reload
    updateBoardAndPgn
    updateGList
  }
  bind $w <Alt-m> "$f.ok invoke; break"

  button $f.cancel -text "Cancel" -underline 0 -command {
    focus .
    destroy .spellcheckWin
  }
  bind $w <Alt-c> "$f.cancel invoke; break"

  pack $f.cancel $f.ok -side right -padx 5

  set f [frame $w.text]
  pack $w.text -expand yes -fill both
  scrollbar $f.ybar -command "$f.text yview"
  scrollbar $f.xbar -orient horizontal -command "$f.text xview"
  text $f.text -yscrollcommand "$f.ybar set" -xscrollcommand "$f.xbar set" \
    -setgrid 1 -width $::winWidth($w) -height $::winHeight($w) \
    -background white -wrap none
  $f.text configure -tabs \
    [font measure font_Regular  "xxxxxxxxxxxxxxxxxxxxxxxxx"]

  grid $f.text -row 0 -column 0 -sticky news
  grid $f.ybar -row 0 -column 1 -sticky news
  grid $f.xbar -row 1 -column 0 -sticky news

  grid rowconfig $w.text 0 -weight 1 -minsize 0
  grid columnconfig $w.text 0 -weight 1 -minsize 0

  $f.text insert end $result
  focus $f.text
}


# graph.tcl: Graph plotting package for Scid.
#

namespace eval ::graph {}

# Configuration options, specific to each graph:
#
#  -width:     width of graph in canvas units.
#  -height:    height of graph in canvas units.
#  -xtop:      x-coord of top-left graph corner in canvas.
#  -ytop:      y-coord of top-left graph corner in canvas.
#  -background: background color in graph.
#  -font:      font of axis text.
#  -textcolor: color of axis text.
#  -ticksize:  length of ticks on axes, in canvas units.
#  -tickcolor: color to draw x-axis and y-axis ticks.
#  -textgap:   distance from graph border to text, in canvas units.
#  -xtick:     distance between x-axis ticks, in graph units.
#  -ytick:     distance between y-axis ticks, in graph units.
#  -xlabels, -ylabels: lists of {value,label} pairs to print on each axis.
#              If a list has no pairs, values are printed at each tick.
#  -xmin, -xmax, -ymin, -ymax:  miminum/maximum graph units to plot.
#  -canvas:    canvas to plot the graph in.
#  -vline, -hline: list of vertical/horizontal lines to plot. Each
#              element is a list of four items: {color width type value}
#              where color is the line color, width is its width in
#              pixels, type is "each" or "at", and value is the value.
#  -brect: list of background rectangles. Each element is a list of 5 items:
#              the graph coordinates of a rectangle, and its color.
#
set ::graph::_options(graph) {
  width height xtop ytop background font ticksize textgap xtick ytick
  xmin xmax ymin ymax canvas vline hline textcolor tickcolor
  xlabels ylabels brect
}
set ::graph::_defaults(graph) \
  { -width 400 -height 300 -xtop 50 -ytop 30 -ticksize 5 -textgap 4 \
    -xtick 5 -ytick 5 -tickcolor black -font fixed -background white \
      -canvas {} -hline {} -vline {} -textcolor black \
      -xlabels {} -ylabels {} -brect {} }

# Data options, specific to each data set within a graph:
#
#   -points:  1 to display data points.
#   -lines:   1 to display data line.
#   -bars:    1 to display vertical bars.
#   -color:   color to display points, lines and bars in.
#   -outline: color for outline of bars or points. Not used for lines.
#   -radius:  radius of points in canvas units.
#   -linewidth: width of line in canvas units.
#   -barwidth:  width of bars -- in GRAPH units, NOT canvas units.
#   -key:     key name to print by line.
#   -coords:  actual data to plot; should be a list containing an
#             EVEN number of numeric values.
#
set ::graph::_options(data) {
  points lines bars color outline radius linewidth barwidth coords key
}
set ::graph::_defaults(data) \
  { -points 0 -lines 1 -bars 0 -color red -outline black -radius 2 \
    -linewidth 1 -barwidth 1.0 -key {} -coords {} }

set ::graph::_graphs {}
array set ::graph::_data {}


# create:
#    Create a new graph. Sets up the graph configuration and creates a
#    new proc (in the global namespace) with the same name as the graph.
#
proc ::graph::create args {
  set graph [lindex $args 0]
  lappend ::graph::_graphs $graph
  
  # Remove any existing data for this graph name:
  foreach key [array names ::graph::_data] {
    if {[string match "$graph,*" $key]} { unset ::graph::_data($key) }
  }
  set ::graph::_data($graph,sets) {}

  set args [concat graph $graph $::graph::_defaults(graph) [lrange $args 1 end]]
  set extraArgs [eval "::graph::_configure $args"]
  if {$extraArgs != ""} {
    error "Unrecognised arguments: $extraArgs"
  }
  return $graph
}


# delete:
#    Removes all privately stored information about a graph.
#
proc ::graph::delete {graph} {
  # Remove from the list of available graphs:
  set index [lindex $::graph::_graphs $graph]
  if {$index < 0} { return }
  set ::graph::_graphs [lreplace $::graph::_graphs $index $index]
  # Remove all configuration data for the graph:
  foreach key [array names ::graph::_data] {
    if {[string match "$graph,*" $key]} {
      unset ::graph::_data($key)
    }
  }
}


# isgraph:
#    Returns true if the named graph exists.
#
proc graph::isgraph {graph} {
  if {[lsearch $::graph::_graphs $graph] >= 0} { return 1 }
  return 0
}


# data:
#    Adds a new data set to the graph, or modifies an existing one.
#
proc ::graph::data args {
  set graph [lindex $args 0]
  set dataset [lindex $args 1]

  set args [concat data $graph,$dataset $::graph::_defaults(data) \
              [lrange $args 2 end]]

  set extraArgs [eval "::graph::_configure $args"]
  if {$extraArgs != ""} {
    error "Unrecognised graph data options: $extraArgs"
  }

  set marklist $::graph::_data($graph,sets)
  if {[lsearch -exact $marklist $dataset] < 0} {
    lappend ::graph::_data($graph,sets) $dataset
  }

  set datalength 0
  set ncoords [llength $::graph::_data($graph,$dataset,coords)]
  if {$ncoords % 2 != 0} {
    error "Error: coordinates list must have an even length"
  }

  # Redraw graph: do we want to do this here?
  #::graph::redraw $graph
}


# cget:
#    Return a stored attribute of a graph.
#
proc ::graph::cget {graph opt} {
  # Remove initial "-" if necessary:
  if {[string index $opt 0] == "-"} { set opt [string range $opt 1 end] }

  # If asking for axmin/axmax/aymin/aymax, set ranges first:
  if {[string match "a?m??" $opt]} { ::graph::set_range $graph }

  if {! [info exists ::graph::_data($graph,$opt)]} {
    error "No such graph option: $opt"
  }
  return $::graph::_data($graph,$opt)
}

# configure:
#    Modify stored attributes for a graph.
#
proc ::graph::configure args {
  set newargs [concat "graph" [lindex $args 0] [lrange $args 1 end]]
  eval "::graph::_configure $newargs"
}


# _configure:
#    Handle configuration of both the graph, and individual data sets.
#    The first arg (type) should be "graph" or "data". The second should
#    be a graph name for graph configuration, or a "graph,set" pair
#    for dataset configuration.
#
proc ::graph::_configure args {
  set type [lindex $args 0]
  set dataset [lindex $args 1]
  set args [lrange $args 2 end]

  set optionList $::graph::_options($type)
  set option {}

  if {[llength $args] % 2} { error "Error: odd-length options list: $args" }

  for {set i 0} {$i < [llength $args]} {incr i 2} {
    set option [lindex $args $i]
    if {[string index $option 0] != "-"} { return [lrange $args $i end] }
    set option [string range $option 1 end]
    if {[lsearch $optionList $option] >= 0} {
      set ::graph::_data($dataset,$option) [lindex $args [expr $i+1]]
    }
  }
}


# redraw:
#    Redraw the entire graph, axes and data.
#
proc ::graph::redraw {graph} {
  if {! [::graph::isgraph $graph]} { error "$graph: no such graph" }
  if {! [info exists ::graph::_data($graph,canvas)]} { return }
  $::graph::_data($graph,canvas) delete -withtag g$graph
  ::graph::plot_axes $graph
  ::graph::plot_data $graph
}

# plot_axes:
#    Replot the graph axes.
#
proc ::graph::plot_axes {graph} {
  # Set ranges and scaling factors:
  ::graph::set_range $graph
  ::graph::rescale $graph

  set xmin $::graph::_data($graph,axmin)
  set xmax $::graph::_data($graph,axmax)
  set ymin $::graph::_data($graph,aymin)
  set ymax $::graph::_data($graph,aymax)

  set xminc [::graph::xmap $graph $xmin]
  set xmaxc [::graph::xmap $graph $xmax]
  set yminc [::graph::ymap $graph $ymin]
  set ymaxc [::graph::ymap $graph $ymax]

  set canvas $::graph::_data($graph,canvas)
  set tag g$graph

  # Extract the graph attributes we will need to use:
  foreach attr {ticksize font textcolor tickcolor textgap \
                  xtick ytick xlabels ylabels} {
    set $attr $::graph::_data($graph,$attr)
  }

  $canvas create rectangle $xminc $yminc $xmaxc $ymaxc -outline $tickcolor \
    -fill $::graph::_data($graph,background) -tag $tag

  set brect $::graph::_data($graph,brect)
  for {set i 0} {$i < [llength $brect]} {incr i} {
    set item [lindex $brect $i]
    set x1 [::graph::xmap $graph [lindex $item 0]]
    set y1 [::graph::ymap $graph [lindex $item 1]]
    set x2 [::graph::xmap $graph [lindex $item 2]]
    set y2 [::graph::ymap $graph [lindex $item 3]]
    if {$x1 < $xminc} { set x1 $xminc }
    if {$x1 > $xmaxc} { set x1 $xmaxc }
    if {$x2 < $xminc} { set x2 $xminc }
    if {$x2 > $xmaxc} { set x2 $xmaxc }
    if {$y1 > $yminc} { set y1 $yminc }
    if {$y1 < $ymaxc} { set y1 $ymaxc }
    if {$y2 > $yminc} { set y2 $yminc }
    if {$y2 < $ymaxc} { set y2 $ymaxc }
    $canvas create rectangle $x1 $y1 $x2 $y2 -fill [lindex $item 4] -width 0 \
      -tag $tag
  }

  # Plot vertical guide lines:
  foreach vline $::graph::_data($graph,vline) {
    set color [lindex $vline 0]
    set width [lindex $vline 1]
    set type [lindex $vline 2]
    set inc [lindex $vline 3]
    set xminvalue [::graph::xmap $graph $xmin]
    set xmaxvalue [::graph::xmap $graph $xmax]
    if {$type == "at"} {
      # Plot just one line:
      set xvalue [::graph::xmap $graph $inc]
      if {$xvalue != $xminvalue  &&  $xvalue != $xmaxvalue} {
        $canvas create line $xvalue $yminc $xvalue $ymaxc -width $width \
          -fill $color -tag $tag
      }
    } elseif {$inc > 0} {
      # Plot a line at each multiple of "inc" units:
      set x [expr int($xmin/$inc) * $inc + $inc]
      while {$x < $xmax} {
        set xvalue [::graph::xmap $graph $x]
        if {$xvalue != $xminvalue  &&  $xvalue != $xmaxvalue} {
          $canvas create line $xvalue $yminc $xvalue $ymaxc -width $width \
            -fill $color -tag $tag
        }
        set x [expr $x + $inc]
      }
    }
  }

  # Plot horizontal guide lines:
  foreach hline $::graph::_data($graph,hline) {
    set color [lindex $hline 0]
    set width [lindex $hline 1]
    set type [lindex $hline 2]
    set inc [lindex $hline 3]
    set yminvalue [::graph::ymap $graph $ymin]
    set ymaxvalue [::graph::ymap $graph $ymax]
    if {$type == "at"} {
      set yvalue [::graph::ymap $graph $inc]
      if {$yvalue != $yminvalue  &&  $yvalue != $ymaxvalue} {
        $canvas create line $xminc $yvalue $xmaxc $yvalue -width $width \
          -fill $color -tag $tag
      }
    } elseif {$inc > 0} {
      set y [expr int($ymin/$inc) * $inc + $inc]
      while {$y < $ymax} {
        set yvalue [::graph::ymap $graph $y]
        if {$yvalue != $yminvalue  &&  $yvalue != $ymaxvalue} {
          $canvas create line $xminc $yvalue $xmaxc $yvalue -width $width \
            -fill $color -tag $tag
        }
        set y [expr $y + $inc]
      }
    }
  }

  # Plot x ticks and y ticks:
  set nxlabels [llength $xlabels]
  set nylabels [llength $ylabels]

  if {$xtick > 0} {
    set x [expr int($xmin/$xtick) * $xtick]
    while {$x < $xmin} { set x [expr $x + $xtick] }
    while {$x <= $xmax} {
      set xc [::graph::xmap $graph $x]
      $canvas create line $xc $yminc $xc [expr $yminc - $ticksize] -tag $tag \
        -fill $tickcolor
      $canvas create line $xc $ymaxc $xc [expr $ymaxc + $ticksize] -tag $tag \
        -fill $tickcolor
      if {$nxlabels == 0} {
        $canvas create text $xc [expr $yminc + $textgap] -font $font \
          -text [::graph::round $x] -anchor n -tag $tag -fill $textcolor
      }
      set x [expr $x + $xtick]
    }
  }
  for {set i 0} {$i < $nxlabels} {incr i} {
    set label [lindex $xlabels $i]
    set x [lindex $label 0]
    set text [lindex $label 1]
    set xc [::graph::xmap $graph $x]
    $canvas create text $xc [expr $yminc + $textgap] -font $font \
      -text $text -anchor n -tag $tag -fill $textcolor -justify center
  }

  if {$ytick > 0} {
    set y [expr int($ymin/$ytick) * $ytick]
    while {$y < $ymin} { set y [expr $y + $ytick] }
    while {$y <= $ymax} {
      set yc [::graph::ymap $graph $y]
      $canvas create line $xminc $yc [expr $xminc + $ticksize] $yc -tag $tag \
        -fill $tickcolor
      $canvas create line [expr $xmaxc - $ticksize] $yc $xmaxc $yc -tag $tag \
        -fill $tickcolor
      if {$nylabels == 0} {
        $canvas create text [expr $xminc - $textgap] $yc -font $font \
          -text [::graph::round $y] -anchor e -tag $tag -fill $textcolor
      }
      set y [expr $y + $ytick]
    }
  }
  for {set i 0} {$i < $nylabels} {incr i} {
    set label [lindex $ylabels $i]
    set y [lindex $label 0]
    set text [lindex $label 1]
    set yc [::graph::ymap $graph $y]
    $canvas create text [expr $xminc - $textgap] $yc -font $font \
      -text $text -anchor e -tag $tag -fill $textcolor
  }
}

# plot_data:
#    Plot the lines/points/bars for each data set in the graph.
#
proc ::graph::plot_data {graph} {
  set canvas $::graph::_data($graph,canvas)

  foreach dataset $::graph::_data($graph,sets) {
    set color $::graph::_data($graph,$dataset,color)
    set outline $::graph::_data($graph,$dataset,outline)
    set tag g$graph
    set coords [::graph::scale_data $graph $::graph::_data($graph,$dataset,coords)]
    set ncoords [expr [llength $coords] - 1]

    # Draw key:
    if {$::graph::_data($graph,$dataset,key) != ""} {
      set key $::graph::_data($graph,$dataset,key)
      if {$ncoords >= 1} {
        set dy 3
        set anchor nw
        set x [expr [lindex $coords 0] + 3]
        set y [lindex $coords 1]
        if {$ncoords >= 3} {
          set nexty [lindex $coords 3]
          if {$nexty > $y} { set dy -3; set anchor sw }
        }
        incr y $dy
        catch {$canvas create text $x $y -fill $color -tag $tag \
                 -text $::graph::_data($graph,$dataset,key) \
                 -font $::graph::_data($graph,font) -anchor $anchor}
      }
    }

    # Plot line:
    if {$::graph::_data($graph,$dataset,lines)} {
      # Catch errors drawing line in case the data set contains no data:
      catch {eval "$canvas create line $coords -fill $color \
                   -width $::graph::_data($graph,$dataset,linewidth) -tag $tag"}
    }

    # Plot points:
    if {$::graph::_data($graph,$dataset,points)} {
      for {set i 0} {$i < $ncoords} {incr i 2} {
        set x [lindex $coords $i]
        set y [lindex $coords [expr $i + 1]]
        set p $::graph::_data($graph,$dataset,radius)
        $canvas create oval [expr $x-$p] [expr $y-$p] [expr $x+$p] [expr $y+$p] \
          -fill $color -outline $outline -width 1 -tag $tag
      }
    }

    # Plot bars:
    if {$::graph::_data($graph,$dataset,bars)} {
      set base [::graph::ymap $graph $::graph::_data($graph,aymin)]
      set hwidth [::graph::xmap $graph $::graph::_data($graph,$dataset,barwidth)]
      set hwidth [expr $hwidth - [::graph::xmap $graph 0]]
      set hwidth [expr $hwidth / 2]
      if {$hwidth < 1} { set hwidth 1 }

      for {set i 0} {$i < $ncoords} {incr i 2} {
        set x [lindex $coords $i]
        set y [lindex $coords [expr $i + 1]]
        $canvas create rectangle [expr $x-$hwidth] $y [expr $x+$hwidth] $base \
          -fill $color -outline $outline -tag $tag
      }
    }
  }
}


# ::graph::round:
#    Returns a value n rounded to the nearest integer if it is
#    within 0.1 of n, or to one decimal place otherwise.
#    Used to print axis values to a sensible precision.
#
proc ::graph::round {n} {
  set intn [expr int($n)]
  if {[expr $n - $intn] < 0.1  &&  [expr $intn - $n] < 0.1} {
    return [expr round($n)]
  }
  return [expr double(round($n * 10.0)) / 10.0]
}


# point_visible:
#    Returns true if a point (in graph coordinates) is visible given
#    the current display boundaries.
#
proc ::graph::point_visible {graph x y} {
  set xmin $::graph::_data($graph,xtop)
  set ymin $::graph::_data($graph,ytop)
  set xmax [expr $xmin + $::graph::_data($graph,width)]
  set ymax [expr $ymin + $::graph::_data($graph,height)]

  if {$x >= xmin && $x <= $xmax && $y >= $ymin && $y <= $ymax} { return 1 }
  return 0
}


# rescale:
#    Sets the scaling factors used for mapping graph to canvas coordinates.
#
proc ::graph::rescale {graph} {
  set width $::graph::_data($graph,width)
  set height $::graph::_data($graph,height)
  set xdelta [expr double($::graph::_data($graph,axmax) - \
                          $::graph::_data($graph,axmin))]
  set ydelta [expr double($::graph::_data($graph,aymax) - \
                          $::graph::_data($graph,aymin))]
  # Ensure deltas are not zero or too close to it:
  if {$xdelta < 0.0001} { set xdelta 0.0001 }
  if {$ydelta < 0.0001} { set ydelta 0.0001 }

  set ::graph::_data($graph,xfac) [expr double($width)/$xdelta]
  set ::graph::_data($graph,yfac) [expr double($height)/$ydelta]
}


# xmap:
#    Map a graph X coordinate to its canvas unit equivalent.
#
proc ::graph::xmap {graph x} {
  return [expr int(($x - $::graph::_data($graph,axmin)) * \
            $::graph::_data($graph,xfac) + $::graph::_data($graph,xtop))]
}

# ymap:
#    Map a graph Y coordinate to its canvas unit equivalent.
#
proc ::graph::ymap {graph y} {
  return [expr int(($::graph::_data($graph,aymax) - $y) * \
            $::graph::_data($graph,yfac) + $::graph::_data($graph,ytop))]
}

#xunmap:
#    Transform a canvas unit to its graph X coordinate equivalent.
#
proc ::graph::xunmap {graph cx} {
  return [expr $::graph::_data($graph,axmin) + \
            double($cx - $::graph::_data($graph,xtop)) / \
            double($::graph::_data($graph,xfac))]
}

#yunmap:
#    Transform a canvas unit to its graph Y coordinate equivalent.
#
proc ::graph::yunmap {graph cy} {
  return [expr $::graph::_data($graph,aymax) - \
            double($cy - $::graph::_data($graph,ytop)) / \
            double($::graph::_data($graph,yfac))]
}

# scale_data:
#    Transforms an even-sized list of graph coordinates to canvas units.
#
proc ::graph::scale_data {graph coords} {
  set result {}
  for {set i 0} {$i < [llength $coords] - 1} {incr i 2} {
    lappend result [::graph::xmap $graph [lindex $coords $i]]
    lappend result [::graph::ymap $graph [lindex $coords [expr $i+1]]]
  }
  return $result
}

# set_range:
#    Sets any range boundaries that are not already set for a graph.
#
proc ::graph::set_range {graph} {
  set xmin 1000000000; set xmax -100000000
  set ymin 1000000000; set ymax -100000000

  foreach dataset $::graph::_data($graph,sets) {
    set coords $::graph::_data($graph,$dataset,coords)
    for {set i 0} {$i < [llength $coords] - 1} {incr i 2} {
      set x [lindex $coords $i]
      set y [lindex $coords [expr $i+1]]

      if {$x < $xmin} { set xmin $x }
      if {$x > $xmax} { set xmax $x }
      if {$y < $ymin} { set ymin $y }
      if {$y > $ymax} { set ymax $y }
    }
  }

  # Set sane values if no data coordinates exist at all:
  if {$xmax < $xmin} { set xmin 0; set xmax 1 }
  if {$ymax < $ymin} { set ymin 0; set ymax 1 }

  set xtick $::graph::_data($graph,xtick)
  set ytick $::graph::_data($graph,ytick)
  set ::graph::_data($graph,axmin) [expr floor($xmin/$xtick) * $xtick]
  set ::graph::_data($graph,axmax) [expr floor($xmax/$xtick) * $xtick + $xtick]
  set ::graph::_data($graph,aymin) [expr floor($ymin/$ytick) * $ytick]
  set ::graph::_data($graph,aymax) [expr floor($ymax/$ytick) * $ytick + $ytick]

  # Explicitly set boundaries override the detected ranges:
  foreach coord {xmin xmax ymin ymax} {
    if {[info exists ::graph::_data($graph,$coord)]} {
      set ::graph::_data($graph,a$coord) $::graph::_data($graph,$coord)
    }
  }
}

# maint.tcl:   Maintenance-related functions
# Part of Scid.
# Copyright (C) 2000 Shane Hudson.


# setGameFlags:
#   Updates a flag for the current game, all filtered games, or all games.
#   <type> should be "current", "filter" or "all".
#   <flag> should be "delete", "user", "endgame", etc.
#   <value> should be 0 or 1
#
proc setGameFlags {flag type value} {
  if {$flag == "mark"} { set flag $::maintFlag }
  switch -- $type {
    "current" {
      busyCursor .
      catch {sc_game flag $flag [sc_game number] $value}
      unbusyCursor .
    }
    "filter" -
    "all" {
      busyCursor .
      catch {sc_game flag $flag $type $value}
      unbusyCursor .
    }
    default { return }
  }
  updateBoard .board
  updateGList
  updateMaintWin
  updateStatsWin
}

set maintFlag W
set maintFlaglist {W B M E N P T Q K ! ? U}
array set maintFlags {
  W WhiteOpFlag
  B BlackOpFlag
  M MiddlegameFlag
  E EndgameFlag
  N NoveltyFlag
  P PawnFlag
  T TacticsFlag
  Q QsideFlag
  K KsideFlag
  ! BrilliancyFlag
  ? BlunderFlag
  U UserFlag
}

# makeMaintWin:
#   Creates the database maintenance window.
#
set maintWin 0
proc makeMaintWin {} {
  global maintWin maintFlag maintFlags maintFlaglist
  set w .maintWin
  if {[winfo exists $w]} {
    destroy $w
    set maintWin 0
    return
  }
  set maintWin 1
  set font font_Small
  set bold font_SmallBold
  toplevel $w
  wm title $w "Scid: [tr FileMaint]"
  wm resizable $w 0 0
  bind $w <F1> {helpWindow Maintenance}
  bind $w <Escape> "destroy $w; break"
  bind $w <Destroy> {set maintWin 0}
  foreach f {title delete mark spell db buttons} {
    frame $w.$f
  }
  foreach f {title delete mark spell db} {
    pack $w.$f -side top -fill x
    addHorizontalRule $w
  }
  pack $w.buttons -side top -fill x

  label $w.title.name -textvar ::tr(DatabaseName) -font font_Bold
  label $w.title.games -textvar ::tr(NumOfGames) -font font_SmallBold
  label $w.title.icon -textvar ::tr(TypeIcon)
  label $w.title.delete -textvar ::tr(NumDeletedGames) -font $font
  label $w.title.mark -font $font
  label $w.title.filter -textvar ::tr(NumFilterGames) -font $font
  label $w.title.dates -textvar ::tr(YearRange) -font $font
  label $w.title.ratings -textvar ::tr(RatingRange) -font $font
  button $w.title.vicon -command {changeBaseType [sc_base current]}

  foreach name {name games delete mark filter dates ratings} {
    label $w.title.v$name -text "0" -font $font
  }

  set row 0
  set col 0
  foreach name {name icon games filter delete mark dates ratings} {
    grid $w.title.$name -row $row -column $col -sticky w
    incr col
    grid $w.title.v$name -row $row -column $col -sticky e
    incr col
    if {$col == 2} { incr col }
    if {$col >= 5} { set col 0; incr row }
  }
  grid [label $w.title.space -text "   "] -row 0 -column 2
  $w.title.vname configure -font font_Bold
  $w.title.vgames configure -font font_SmallBold

  foreach grid {title delete mark spell db} cols {5 3 3 4 3} {
    for {set i 0} {$i < $cols} {incr i} {
      grid columnconfigure $w.$grid $i -weight 1
    }
  }

  label $w.delete.title -textvar ::tr(DeleteFlag) -font $bold
  menubutton $w.mark.title -menu $w.mark.title.m \
    -indicatoron 1 -relief raised -font $bold
  menu $w.mark.title.m -font $font
  foreach i $maintFlaglist  {
    $w.mark.title.m add command -label "$::tr($maintFlags($i)) ($i)" \
      -command "set maintFlag $i; updateMaintWin"
  }
  foreach flag {delete mark} on {Delete Mark} off {Undelete Unmark} {
    foreach b {Current Filter All} {
      button $w.$flag.on$b -textvar "::tr($on$b)" -font $font \
        -command "setGameFlags $flag [string tolower $b] 1"
      button $w.$flag.off$b -textvar "::tr($off$b)" -font $font \
        -command "setGameFlags $flag [string tolower $b] 0"
    }

    grid $w.$flag.title -columnspan 3 -row 0 -column 0 -sticky n
    grid $w.$flag.onCurrent -row 1 -column 0 -sticky we
    grid $w.$flag.offCurrent -row 2 -column 0 -sticky we
    grid $w.$flag.onFilter -row 1 -column 1 -sticky we
    grid $w.$flag.offFilter -row 2 -column 1 -sticky we
    grid $w.$flag.onAll -row 1 -column 2 -sticky we
    grid $w.$flag.offAll -row 2 -column 2 -sticky we
  }

  label $w.spell.title -textvar ::tr(Spellchecking) -font $bold
  grid $w.spell.title -columnspan 4 -row 0 -column 0 -sticky n
  button $w.spell.player -textvar ::tr(Players...) -font $font \
    -command "openSpellCheckWin Player $w"
  button $w.spell.event -textvar ::tr(Events...) -font $font \
    -command "openSpellCheckWin Event $w"
  button $w.spell.site -textvar ::tr(Sites...) -font $font \
    -command "openSpellCheckWin Site $w"
  button $w.spell.round -textvar ::tr(Rounds...) -font $font \
    -command "openSpellCheckWin Round $w"
  grid $w.spell.player -row 1 -column 0 -sticky we
  grid $w.spell.event -row 1 -column 1 -sticky we
  grid $w.spell.site -row 1 -column 2 -sticky we
  grid $w.spell.round -row 1 -column 3 -sticky we

  bind $w <Alt-p> "$w.spell.player invoke"
  bind $w <Alt-e> "$w.spell.event invoke"
  bind $w <Alt-s> "$w.spell.site invoke"
  bind $w <Alt-r> "$w.spell.round invoke"

  label $w.db.title -textvar ::tr(DatabaseOps) -font $bold
  grid $w.db.title -columnspan 3 -row 0 -column 0 -sticky n

  button $w.db.eco -textvar ::tr(ReclassifyGames...) -command classifyAllGames
  button $w.db.compact -textvar ::tr(CompactDatabase...) -command makeCompactWin
  button $w.db.sort -textvar ::tr(SortDatabase...) -command makeSortWin
  button $w.db.elo -textvar ::tr(AddEloRatings...) -command allocateRatings
  button $w.db.dups -textvar ::tr(DeleteTwins...) -command "markTwins $w"
  button $w.db.cleaner -textvar ::tr(Cleaner...) -command cleanerWin
  button $w.db.autoload -textvar ::tr(AutoloadGame...) -command setAutoloadGame
  button $w.db.strip -textvar ::tr(StripTags...) -command stripTags

  foreach i {eco compact sort elo dups cleaner autoload strip} {
    $w.db.$i configure -font $font
  }
  bind $w <Alt-d> "$w.db.dups invoke"

  grid $w.db.eco -row 1 -column 0 -sticky we
  grid $w.db.compact -row 1 -column 1 -sticky we
  grid $w.db.sort -row 1 -column 2 -sticky we
  grid $w.db.elo -row 2 -column 0 -sticky we
  grid $w.db.dups -row 2 -column 1 -sticky we
  grid $w.db.cleaner -row 2 -column 2 -sticky we
  grid $w.db.autoload -row 3 -column 0 -sticky we
  grid $w.db.strip -row 3 -column 1 -sticky we

  button $w.buttons.help -textvar ::tr(Help) -command {helpWindow Maintenance}
  button $w.buttons.close -textvar ::tr(Close) -command "destroy $w"
  pack $w.buttons.close $w.buttons.help -side right -padx 2 -pady 2
  bind $w <Alt-h> "$w.buttons.help invoke"
  bind $w <Alt-c> "destroy $w; break"
  standardShortcuts $w
  updateMaintWin
}

proc updateMaintWin {} {
  global maintFlag maintFlags
  updateSortWin
  updateClassifyWin

  set w .maintWin
  if {![winfo exists $w]} { return }
  set ng [sc_base numGames]
  set deleted [sc_base stats flag:D]
  set marked [sc_base stats "flag:$maintFlag"]
  set flags [sc_base stats flags]
  set dates [sc_base stats date]
  set ratings [sc_base stats ratings]
  $w.title.vgames configure -text [thousands $ng]
  $w.title.vicon configure -image dbt[sc_base type [sc_base current]]
  $w.title.vname configure -text [file tail [sc_base filename]]
  $w.title.vdelete configure -text [percentFormat $deleted $ng]
  $w.title.vmark configure -text [percentFormat $marked $ng]
  $w.title.vfilter configure -text [percentFormat [sc_filter count] $ng]
  $w.title.vdates configure \
    -text "[lindex $dates 0]-[lindex $dates 1] ([lindex $dates 2])"
  $w.title.vratings configure \
    -text "[lindex $ratings 0]-[lindex $ratings 1] ([lindex $ratings 2])"

  set flagname "$::tr(Flag): $::tr($maintFlags($maintFlag)) ($maintFlag)"
  $w.mark.title configure -text $flagname
  $w.title.mark configure -text $flagname

  # Disable buttons if current base is closed or read-only:
  set state disabled
  if {[sc_base inUse]  &&  ![sc_base isReadOnly]} {
    set state normal
  }
  foreach spell {player event site round} {
    $w.spell.$spell configure -state $state
  }
  foreach button {onCurrent offCurrent onAll offAll onFilter offFilter} {
    $w.delete.$button configure -state $state
    $w.mark.$button configure -state $state
  }
  $w.db.dups configure -state $state
  $w.title.vicon configure -state $state
  $w.db.elo configure -state $state
  $w.db.autoload configure -state $state

  set state disabled
  if {[sc_base inUse]} { set state normal }
  $w.db.eco configure -state $state
  $w.db.sort configure -state $state
  $w.db.strip configure -state $state

  set state disabled
  if {[baseIsCompactable]} {
    set state normal
  }
  $w.db.compact configure -state $state
  $w.db.cleaner configure -state $state
}

# setAutoloadNumber:
#   Creates a dialog for setting the autoload game number of the
#   current database.
#
set autoloadGame 0
trace variable autoloadGame w {forceInt 9999999 0}
proc setAutoloadGame {} {
  global autoloadGame
  set w .autoload
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid"
  set autoloadGame [sc_base autoload]

  pack [frame $w.f] -side top
  label $w.f.label -text $::tr(AutoloadGame:)
  entry $w.f.entry -textvar autoloadGame -justify right -width 10 \
    -foreground black -background white
  pack $w.f.label $w.f.entry -side left

  pack [frame $w.set] -side top -fill x
  button $w.set.none -text $::tr(None) -command {set autoloadGame 0}
  button $w.set.first -text $::tr(First) -command {set autoloadGame 1}
  button $w.set.current -text $::tr(Current) \
    -command {set autoloadGame [sc_game number]}
  button $w.set.last -text $::tr(Last) -command {set autoloadGame 9999999}
  foreach i {none first current last} {$w.set.$i configure -font font_Small}
  pack $w.set.none $w.set.first $w.set.current $w.set.last \
    -side left -padx 1 -pady 2

  addHorizontalRule $w

  pack [frame $w.b] -side top -fill x
  button $w.b.ok -text OK -command \
    "sc_base autoload \$autoloadGame; catch {grab release $w}; destroy $w"
  button $w.b.cancel -text $::tr(Cancel) -command \
    "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 2

  bind $w.f.entry <Return> "$w.b.ok invoke"
  bind $w.f.entry <Escape> "$w.b.cancel invoke"
  wm resizable $w 0 0
  centreWin $w
  focus $w.f.entry
  grab $w
}

# markTwins:
#   Finds twin games and marks them for deletion.
#   Takes parent window as parameter since it can be the main window,
#   or the maintenance window.
#
proc markTwins {{parent .}} {
  global twinSettings
  if {! [sc_base inUse]} { return }
  if {[sc_base numGames] == 0} {
    tk_messageBox -type ok -icon info -title "Scid: No games" \
      -message "There are no games in this database to delete."
    return
  }

  set w .twinSettings
  if {! [winfo exists $w]} {
    toplevel $w
    wm resizable $w 0 0
    wm title $w "Scid: $::tr(DeleteTwins)"
    set small font_Small
    label $w.note -text $::tr(TwinsNote) -justify left \
      -wraplength 500 -font $small
    pack $w.note -side top -anchor w -ipady 0 -pady 0
    addHorizontalRule $w
    label $w.tc -text $::tr(TwinsCriteria) -font font_Bold
    pack $w.tc -side top

    frame $w.g
    pack $w.g -side top
    set row 0
    set col 0
    foreach name {Colors Event Site Round Year Month Day Result ECO Moves} {
      set n [string tolower $name]
      label $w.g.l$n -text $::tr(Twins$name) -font $small
      radiobutton $w.g.yes$n -variable twinSettings($n) -value Yes \
        -text $::tr(Yes) -font $small
      radiobutton $w.g.no$n -variable twinSettings($n) -value No \
        -text $::tr(No) -font $small
      grid $w.g.l$n -row $row -column $col -sticky w
      incr col
      grid $w.g.yes$n -row $row -column $col -sticky w
      incr col
      grid $w.g.no$n -row $row -column $col -sticky w
      incr col
      if {$col >= 5} {
        incr row; set col 0
      } else {
        grid [label $w.g.space$n -text "   "] -row $row -column $col
        incr col
      }
    }
    label $w.g.lPlayers -text $::tr(TwinsPlayers) -font $small
    radiobutton $w.g.yesPlayers -variable twinSettings(players) -value Yes \
      -text $::tr(TwinsPlayersExact) -font $small
    radiobutton $w.g.noPlayers -variable twinSettings(players) -value No \
      -text $::tr(TwinsPlayersPrefix) -font $small
    grid $w.g.lPlayers -row $row -column 0 -sticky w
    grid $w.g.yesPlayers -row $row -column 1 -columnspan 3 -sticky w
    grid $w.g.noPlayers  -row $row -column 4 -columnspan 3 -sticky w
  }
    

  addHorizontalRule $w
  label $w.twhich -text $::tr(TwinsWhich:) -font font_Bold
  pack $w.twhich -side top
  pack [frame $w.g2] -side top -fill x
  radiobutton $w.g2.exall -text $::tr(SelectAllGames) -font $small \
    -variable twinSettings(usefilter) -value No
  label $w.g2.space -text "    " -font $small
  radiobutton $w.g2.exfil -text $::tr(SelectFilterGames) -font $small \
    -variable twinSettings(usefilter) -value Yes
  grid $w.g2.exall -row 0 -column 0 -sticky e
  grid $w.g2.space -row 0 -column 1
  grid $w.g2.exfil -row 0 -column 2 -sticky w
  grid columnconfigure $w.g2 0 -weight 1
  grid columnconfigure $w.g2 2 -weight 1

  addHorizontalRule $w
  label $w.twhen -text $::tr(TwinsWhen:) -font font_Bold
  pack $w.twhen -side top
  pack [frame $w.g3] -side top
  set row 0
  foreach n {skipshort undelete setfilter comments variations} {
    label $w.g3.l$n -text "" -font $small
    checkbutton $w.g3.v$n -width 6 -variable twinSettings($n) -font $small \
      -textvariable twinSettings($n) -onvalue Yes -offvalue No -anchor w
      grid $w.g3.l$n -row $row -column 0 -sticky w
      grid $w.g3.v$n -row $row -column 1 -sticky w
      incr row
  }
  $w.g3.lskipshort configure -text $::tr(TwinsSkipShort)
  $w.g3.lundelete configure -text $::tr(TwinsUndelete)
  $w.g3.lsetfilter configure -text $::tr(TwinsSetFilter)
  $w.g3.lcomments configure -text $::tr(TwinsComments)
  $w.g3.lvariations configure -text $::tr(TwinsVars)
  label $w.g3.ldelete -text $::tr(TwinsDeleteWhich)  -font $small
  grid $w.g3.ldelete -row $row -column 0 -sticky we -columnspan 2
  incr row
  frame $w.g3.vdelete
  foreach v {Shorter Older Newer} {
    radiobutton $w.g3.vdelete.v$v -text $::tr(TwinsDelete$v) \
      -variable twinSettings(delete) -value $v -font $small
    pack $w.g3.vdelete.v$v -side left -padx 5
  }
  grid $w.g3.vdelete -row $row -column 0 -columnspan 2

  foreach g {g g2 g3} {
    grid columnconfigure $w.$g 0 -weight 1
  }

  addHorizontalRule $w
  frame $w.b
  button $w.b.defaults -textvar ::tr(Defaults) -command {
    array set twinSettings [array get twinSettingsDefaults]
  }
  button $w.b.help -text $::tr(Help) \
    -command "helpWindow Maintenance Twins; focus $w"
  button $w.b.go -text $::tr(TwinsDelete) -command {
    if {[twinCriteriaOK .twinSettings]} {
      grab release .twinSettings
      sc_progressBar .twinSettings.progress bar 301 21 time
      set result [doMarkDups .twinSettings]
      focus .
      destroy .twinSettings
      if {$result > 0} { updateTwinChecker }
    }
  }

  button $w.b.cancel -text $::tr(Cancel) \
    -command "grab release $w; focus .; destroy $w"
  canvas $w.progress -width 300 -height 20 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  pack $w.progress -side bottom -padx 2 -pady 2
  pack $w.b -side bottom -fill x
  pack $w.b.cancel $w.b.go -side right -padx 10 -pady 2
  pack $w.b.help -side left -padx 10 -pady 2
  bind $w <F1> "$w.b.help invoke"
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.go invoke"
  grab $w
  update idletasks
  $w.note configure -wraplength [winfo width $w]
  return
}

# twinCriteriaOK:
#   Check that the user specified at least three of the the same site,
#   same round, and same year settings, since otherwise it is quite
#   likely that actual games with simlar moves will be marked as twins:
#
proc twinCriteriaOK {{parent .}} {
  global twinSettings

  set msg "Your settings for finding twin games are potentially likely to "
  append msg "cause non-twin games with similar moves to be marked as twins."
  append msg "\n\n"

  # First, check that if same moves is off, then the same colors, event,
  # site, round, year and month flags should all be set:
  if {$twinSettings(moves) == "No"} {
    if {$twinSettings(colors) == "No"  ||  $twinSettings(event) == "No"  || \
        $twinSettings(site) == "No"  ||  $twinSettings(year) == "No"  || \
        $twinSettings(month) == "No"} {
      append msg "It is recommended that if you select \"No\" for \"same moves\","
      append msg "you should select \"Yes\" for the colors, event, site, round,"
      append msg "year and month settings."
      append msg "\n\n"
      append msg "Do you want to continue and delete twins anyway?"
      set result [tk_messageBox -type yesno -parent $parent -icon warning \
                    -title "Scid: Confirm twin settings" \
                    -message $msg]
      if {$result == "no"} { return 0 } else { return 1 }
    }
  }

  # Now check that at least two of site, round, and year are set:
  set count 0
  if {$twinSettings(site) == "Yes"} { incr count }
  if {$twinSettings(round) == "Yes"} { incr count }
  if {$twinSettings(year) == "Yes"} { incr count }
  if {$count < 2} {
    append msg "It is recommended that you specify \"Yes\" for at least two "
    append msg "of the \"same site\", \"same round\" and \"same year\" "
    append msg "settings."
    append msg "\n\n"
    append msg "Do you want to continue and delete twins anyway?"
    set result [tk_messageBox -type yesno -parent $parent -icon warning \
                  -title "Scid: Confirm twin settings" \
                  -message $msg]
    if {$result == "no"} { return 0 } else { return 1 }
  }
  return 1
}


proc doMarkDups {{parent .}} {
  global twinSettings

  busyCursor .
  if {$twinSettings(undelete) == "Yes"} {
    catch {sc_game flag delete all 0}
  }
  if {[catch {sc_base duplicates -colors $twinSettings(colors) \
                -event $twinSettings(event) -site $twinSettings(site) \
                -round $twinSettings(round) -year $twinSettings(year) \
                -month $twinSettings(month) -day $twinSettings(day) \
                -result $twinSettings(result) -eco $twinSettings(eco) \
                -moves $twinSettings(moves) -players $twinSettings(players) \
                -skipshort $twinSettings(skipshort) \
                -setfilter $twinSettings(setfilter) \
                -usefilter $twinSettings(usefilter) \
                -comments $twinSettings(comments) \
                -variations $twinSettings(variations) \
                -delete $twinSettings(delete)} result]} {
    unbusyCursor .
    tk_messageBox -type ok -parent $parent -icon info \
      -title "Scid" -message $result
    set result 0
  } else {
    unbusyCursor .
    set message "Scid found $result twin games"
    if {$result > 0} {append message " and set their delete flags"}
    append message "."
    tk_messageBox -type ok -parent $parent -icon info -title "Scid: Result" \
      -message $message
  }
  updateMaintWin
  return $result
}


set classifyOption(AllGames) all
set classifyOption(ExtendedCodes) 1

# ClassifyAllGames:
#   Reclassifies all games (recomputes the ECO code of each game).
#   User can choose to reclassify all games, or only those games that
#   currently have no ECO code assigned.
#
proc classifyAllGames {} {
  makeClassifyWin
}

proc makeClassifyWin {} {
  global classifyOption
  set w .classify
  if {[winfo exists $w]} {
    raiseWin $w
    return
  }
  toplevel $w
  wm title $w "Scid: [tr FileMaintClass]"
  label $w.label -font font_Bold -textvar ::tr(ClassifyWhich)
  radiobutton $w.all -textvar ::tr(ClassifyAll) \
    -variable classifyOption(AllGames) -value all
  radiobutton $w.filter -textvar ::tr(SelectFilterGames) \
    -variable classifyOption(AllGames) -value filter
  set year [::date::today year]
  set month [::date::today month]
  set day [::date::today day]
  radiobutton $w.year -textvar ::tr(ClassifyYear) \
    -variable classifyOption(AllGames) \
    -value "date:[expr $year - 1].$month.$day"
  if {$month == "01"} {
    incr year -1
    set month 12
  } else {
    scan $month "%02u" month
    incr month -1
    set month [format "%02u" $month]
  }
  radiobutton $w.month -textvar ::tr(ClassifyMonth) \
    -variable classifyOption(AllGames) \
    -value "date:$year.$month.$day"
  radiobutton $w.new -textvar ::tr(ClassifyNew) \
    -variable classifyOption(AllGames) -value nocode
  label $w.codes -font font_Bold -textvar ::tr(ClassifyCodes:)
  radiobutton $w.extended -textvar ::tr(ClassifyBasic) \
    -variable classifyOption(ExtendedCodes) -value 0
  radiobutton $w.basic -textvar ::tr(ClassifyExtended) \
    -variable classifyOption(ExtendedCodes) -value 1

  frame $w.b
  button $w.b.go -textvar ::tr(Classify) -command {
    busyCursor .
    .classify.b.cancel configure -command "sc_progressBar"
    .classify.b.cancel configure -textvar ::tr(Stop)
    sc_progressBar .classify.progress bar 301 21 time
    grab .classify.b.cancel
    if {[catch  {sc_eco base $classifyOption(AllGames) $classifyOption(ExtendedCodes)} result]} {
      grab release .classify.b.cancel
      unbusyCursor .
      tk_messageBox -parent .classify -type ok -icon info -title "Scid" -message $result
    } else {
      grab release .classify.b.cancel
      unbusyCursor .
    }
    .classify.b.cancel configure -command {focus .; destroy .classify}
    .classify.b.cancel configure -textvar ::tr(Close)
    updateGList
  }
  button $w.b.cancel -textvar ::tr(Close) -command "focus .; destroy $w"
  canvas $w.progress -width 300 -height 20 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  pack $w.label $w.all $w.filter $w.year $w.month $w.new -side top -pady 5
  addHorizontalRule $w
  pack $w.codes $w.extended $w.basic -side top -pady 5
  addHorizontalRule $w
  pack $w.b -side top -pady 5 -fill x
  pack $w.progress -side bottom -padx 2 -pady 2
  pack $w.b.cancel $w.b.go -side right -pady 10 -padx 10
  wm resizable $w 0 0
  bind $w <F1> {helpWindow ECO}
  bind $w <Escape> "$w.b.cancel invoke"
  updateClassifyWin
}

proc updateClassifyWin {} {
  set w .classify
  if {! [winfo exists $w]} { return }
  set state disabled
  if {[sc_base inUse]} { set state normal }
  $w.b.go configure -state $state
}

# Twin checker window:
# Shows PGN of current game, and its twin.

set twincheck(left) 0
set twincheck(right) 0

proc updateTwinChecker {} {
  global twincheck
  set w .twinchecker
  if {![winfo exists $w]} {
    toplevel $w
    pack [frame $w.b] -side bottom -fill x
    pack [frame $w.f] -side top -fill both -expand yes
    frame $w.f.left
    pack $w.f.left -side left -fill y -expand yes
    frame $w.f.split -width 2 -borderwidth 2 -relief sunken
    pack $w.f.split -side left -fill y -padx 5
    frame $w.f.right
    pack $w.f.right -side left -fill y -expand yes
    foreach i {left right} {
      set f $w.f.$i
      pack [frame $f.title] -side top -fill x
      label $f.title.label -font font_Bold -text "Game 0: "
      checkbutton $f.title.d -text "Deleted" -pady 5 \
        -variable twincheck($i) -font font_Small
      label $f.title.note -font font_Small
      pack $f.title.label $f.title.d $f.title.note -side left
      label $f.tmt -font font_Small -text "" -anchor w -width 1
      pack $f.tmt -side bottom -fill x
      frame $f.t
      pack $f.t -side top -fill both -expand yes
      text $f.t.text -height 16 -width 40 -background white \
        -yscroll "$f.t.ybar set" -takefocus 0 -wrap word
      $f.t.text tag configure h -background lightSteelBlue
      scrollbar $f.t.ybar -command "$f.t.text yview"
      pack $f.t.ybar -side right -fill y
      pack $f.t.text -fill both -expand yes
    }
    $w.f.left.title.note configure -text {("1" to flip; "u" undeletes both)}
    $w.f.right.title.note configure -text {("2" to flip; "u" undeletes both)}
    button $w.b.prev -text "Previous pair" -underline 0 \
      -command {gameLoadNextPrev previous}
    button $w.b.next -text "Next pair" -underline 0 \
      -command {gameLoadNextPrev next}
    button $w.b.share -text "Share tags..." -underline 0
    button $w.b.delete -text "Delete twin games..." -underline 0 \
      -command "markTwins $w"
    button $w.b.help -text "Help" -command {helpWindow Maintenance Twins}
    button $w.b.close -text "Close" -command "focus .; destroy $w"
    pack $w.b.close $w.b.help $w.b.delete -side right -padx 5 -pady 2
    pack $w.b.prev $w.b.next $w.b.share -side left -padx 5 -pady 2
    bind $w <F1> "$w.b.help invoke"
    bind $w <Escape> "focus .; destroy $w"
    bind $w <Alt-p> {gameLoadNextPrev previous}
    bind $w <KeyPress-p> {gameLoadNextPrev previous}
    bind $w <Alt-n> {gameLoadNextPrev next}
    bind $w <KeyPress-n> {gameLoadNextPrev next}
    bind $w <Alt-d> "markTwins $w"
    bind $w <KeyPress-d> "markTwins $w"
    bind $w <KeyPress-1> "$w.f.left.title.d invoke"
    bind $w <KeyPress-2> "$w.f.right.title.d invoke"
    bind $w <KeyPress-s> "$w.b.share invoke"
    bind $w <KeyPress-u> {
      if {$twincheck(left)} {.twinchecker.f.left.title.d invoke}
      if {$twincheck(right)} {.twinchecker.f.right.title.d invoke}
    }
    bind $w <Alt-u> {
      if {$twincheck(left)} {.twinchecker.f.left.title.d invoke}
      if {$twincheck(right)} {.twinchecker.f.right.title.d invoke}
    }
    wm resizable $w 0 1
    wm title $w "Scid: Twin game checker"
  }

  set gn [sc_game number]
  set dup 0
  if {$gn > 0} {
    set dup [sc_game info duplicate]
  }
  set twincheck(left) 0
  set twincheck(right) 0

  $w.f.left.title.label configure -text "Game $gn:  "

  if {$gn > 0} {
    set twincheck(left) [sc_game flag delete $gn]
    $w.f.left.title.d configure -command "sc_game flag delete $gn invert; updateBoard"
    $w.f.left.title.d configure -state normal
    set tmt [sc_game crosstable count +deleted]
    $w.f.left.tmt configure -text "Games in tournament: $tmt"
  } else {
    $w.f.left.title.d configure -state disabled
    $w.f.left.tmt configure -text ""
  }
  if {$dup > 0} {
    set twincheck(right) [sc_game flag delete $dup]
    $w.f.right.title.label configure -text "Game $dup:  "
    $w.f.right.title.d configure -command "sc_game flag delete $dup invert; updateBoard"
    $w.f.right.title.d configure -state normal
    set tmt [sc_game crosstable count -game $dup +deleted]
    $w.f.right.tmt configure -text "Games in tournament: $tmt"
  } else {
    $w.f.right.title.label configure -text "No twin  "
    $w.f.right.title.d configure -state disabled
    $w.f.right.tmt configure -text ""
  }

  $w.b.share configure -state disabled -command {}
  if {$gn > 0  &&  $dup > 0} {
    if {[llength [sc_game tags share check $gn $dup]] > 0} {
      $w.b.share configure -state normal -command "shareTwinTags $gn $dup $w"
    }
  }
  set t $w.f.left.t.text
  $t configure -state normal
  $t delete 1.0 end
  $t insert end [sc_game pgn]

  set t $w.f.right.t.text
  $t configure -state normal
  $t delete 1.0 end
  if {$dup > 0} {
    $t insert end [sc_game pgn -gameNumber $dup]
  } else {
    $t insert end "No twin was detected for this game.\n\n"
    $t insert end "To show twins using this window, you must first "
    $t insert end "use the \"Delete twin games...\" function."
  }

  # Now color the differences if appropriate:
  if {$dup > 0} {
    set rlen [$w.f.right.t.text index end-1c]
    set llen [$w.f.right.t.text index end-1c]

    for {set i 0} {$i < $rlen} {incr i} {
      set line [$w.f.right.t.text get $i.0 "$i.0 lineend"]
      set length [string length $line]
      set max 0
      for {set j 0} {$j < $llen} {incr j} {
        set otherLine [$w.f.left.t.text get $j.0 "$j.0 lineend"]
        set plen [strPrefixLen $line $otherLine]
        if {$plen > $max} { set max $plen }
      }
      if {$max < $length} {
        if {![string compare [string index $line 0] "\["]} { set max 0 }
        $w.f.right.t.text tag add h $i.$max "$i.0 lineend"
      }
    }

    for {set i 0} {$i < $llen} {incr i} {
      set line [$w.f.left.t.text get $i.0 "$i.0 lineend"]
      set length [string length $line]
      set max 0
      for {set j 0} {$j < $rlen} {incr j} {
        set otherLine [$w.f.right.t.text get $j.0 "$j.0 lineend"]
        set plen [strPrefixLen $line $otherLine]
        if {$plen > $max} { set max $plen }
      }
      if {$max < $length} {
        if {![string compare [string index $line 0] "\["]} { set max 0 }
        $w.f.left.t.text tag add h $i.$max "$i.0 lineend"
      }
    }
  }

  if {[sc_base inUse]} {
    $w.b.delete configure -state normal
  } else {
    $w.b.delete configure -state disabled
  }

  foreach side {left right} {
    $w.f.$side.t.text configure -state disabled
  }

}

# shareTwinTags:
#   Updates the tags of two twin games by sharing information,
#   filling in the date, round or ratings of each game based on
#   the other where possible.
#
proc shareTwinTags {g1 g2 {parent .}} {
  set sharelist [sc_game tags share check $g1 $g2]
  if {[llength $sharelist] == 0} { return }

  set msg "Change the following game tags:\n\n"
  foreach {gn tag old new} $sharelist {
    append msg "Game $gn: $tag: \"$old\" -> \"$new\"\n"
  }
  set answer [tk_messageBox -parent $parent -title "Scid" \
                -type okcancel -default ok -icon question -message $msg]
  if {$answer != "ok"} { return }
  sc_game tags share update $g1 $g2
  sc_game tags reload
  updateBoardAndPgn
  updateGList
}

# baseIsCompactable:
#   Returns true only if the current base is compactable.
#
proc baseIsCompactable {} {
  # Only a database that is in use, not read-only, and not the
  # clipbase, can be compacted:
  if {! [sc_base inUse]} { return 0 }
  if {[sc_base isReadOnly]} { return 0 }
  if {[sc_base current] == [sc_info clipbase]} { return 0 }
  return 1
}

# makeCompactWin:
# Opens the database compaction dialog box.
#
proc makeCompactWin {} {
  if {! [baseIsCompactable]} { return }
  set w .compactWin
  toplevel $w
  wm title $w "Scid: $::tr(CompactDatabase)"
  wm resizable $w 0 0
  foreach f {top names games buttons} { frame $w.$f }
  pack $w.top -side top -fill x -padx 5
  pack $w.names -in $w.top -side left -fill x -anchor n
  addVerticalRule $w.top 12
  pack $w.games -in $w.top -side left -fill x -anchor n
  addHorizontalRule $w
  pack $w.buttons -side top -fill x

  for {set i 0} {$i < 3} {incr i} {
    grid columnconfigure $w.names $i -weight 1
    grid columnconfigure $w.games $i -weight 1
  }
  label $w.names.title -text $::tr(NameFile) -font font_Bold
  grid $w.names.title -columnspan 3 -row 0 -column 0 -sticky n
  label $w.names.nt -text "  $::tr(Names)"
  grid $w.names.nt -row 1 -column 1 -sticky e
  label $w.names.ut -text "  $::tr(Unused)"
  grid $w.names.ut -row 1 -column 2 -sticky e
  frame $w.names.h -height 1 -relief solid -bg black
  grid $w.names.h -columnspan 3 -row 2 -column 0 -sticky we
  set row 3
  set ndata [sc_compact stats names]
  set idx 0
  foreach n {p e s r} name {Players Events Sites Rounds} {
    label $w.names.t$n -text "$::tr($name)  "
    label $w.names.n$n -text "  [thousands [lindex $ndata $idx]]"
    incr idx
    label $w.names.u$n -text "  [thousands [lindex $ndata $idx]]"
    incr idx
    grid $w.names.t$n -row $row -column 0 -sticky w
    grid $w.names.n$n -row $row -column 1 -sticky e
    grid $w.names.u$n -row $row -column 2 -sticky e
    incr row
  }

  label $w.games.title -text $::tr(GameFile) -font font_Bold
  grid $w.games.title -columnspan 3 -row 0 -column 0 -sticky n
  label $w.games.gt -text "  [capital $::tr(games)]"
  grid $w.games.gt -row 1 -column 1 -sticky e
  label $w.games.st -text "  $::tr(SizeKb)"
  grid $w.games.st -row 1 -column 2 -sticky e
  frame $w.games.h -height 1 -relief solid -bg black
  grid $w.games.h -columnspan 3 -row 2 -column 0 -sticky we
  set row 3
  set ndata [sc_compact stats games]
  set idx 0
  foreach g {current compact} name {CurrentState AfterCompaction} {
    label $w.games.t$g -text "$::tr($name)  "
    label $w.games.g$g -text "  [thousands [lindex $ndata $idx]]"
    incr idx
    set kbytes [expr int(([lindex $ndata $idx] + 512) / 1024)]
    label $w.games.s$g -text "  [thousands $kbytes]"
    incr idx
    grid $w.games.t$g -row $row -column 0 -sticky w
    grid $w.games.g$g -row $row -column 1 -sticky e
    grid $w.games.s$g -row $row -column 2 -sticky e
    incr row
  }

  button $w.buttons.n -text $::tr(CompactNames) -command compactNames
  button $w.buttons.g -text $::tr(CompactGames) -command compactGames
  button $w.buttons.help -text $::tr(Help) -command {helpWindow Compact}
  button $w.buttons.cancel -text $::tr(Cancel) \
    -command "focus .; grab release $w; destroy $w"
  pack $w.buttons.cancel $w.buttons.help -side right -padx 5 -pady 2
  pack $w.buttons.n $w.buttons.g -side left -padx 5 -pady 2
  grab $w
}

proc compactNames {} {
  set w .compactWin
  set stats [sc_compact stats names]
  if {[lindex $stats 1] == 0  &&  [lindex $stats 3] == 0  && \
        [lindex $stats 5] == 0  &&  [lindex $stats 7] == 0} {
    tk_messageBox -type ok -icon info -parent $w -title "Scid: compaction" \
      -message "There are no unused names, so the name file is already fully compacted."
    return
  }
  progressWindow "Scid" "Compacting the name file..."
  busyCursor .
  set err [catch {sc_compact names} result]
  unbusyCursor .
  closeProgressWindow
  set w .compactWin
  if {$err} {
    tk_messageBox -type ok -icon warning -parent $w \
      -title "Scid: Error compacting file" -message $result
  } else {
    tk_messageBox -type ok -icon info -parent $w \
      -title "Scid: Name file compacted" \
      -message "The name file for the database \"[file tail [sc_base filename]]\" was compacted."
  }
  grab release $w
  destroy $w
  updateBoard .board
  updateGList
  updateMaintWin
}

proc compactGames {} {
  set w .compactWin
  set stats [sc_compact stats games]
  if {[lindex $stats 1] == [lindex $stats 3]  && \
        [lindex $stats 0] == [lindex $stats 2]} {
    tk_messageBox -type ok -icon info -parent $w -title "Scid: compaction" \
      -message "The game file is already fully compacted."
    return
  }
  progressWindow "Scid" "Compacting the game file..." \
    $::tr(Cancel) "sc_progressBar"
  busyCursor .
  set err [catch {sc_compact games} result]
  unbusyCursor .
  closeProgressWindow
  if {$err} {
    tk_messageBox -type ok -icon warning -parent $w \
      -title "Scid: Error compacting file" -message $result
  } else {
    tk_messageBox -type ok -icon info -parent $w \
      -title "Scid: Game file compacted" \
      -message "The game file for the database \"[file tail [sc_base filename]]\" was compacted."
  }
  grab release $w
  destroy $w
  updateBoard .board
  updateGList
  updateMaintWin
}

set sortCriteria(real) ""
set sortCriteria(translated) ""

proc clearSortCriteria {} {
  set ::sortCriteria(real) ""
  set ::sortCriteria(translated) ""
  updateSortWin
}
 
proc addSortCriteria {args} {
  global sortCriteria
  foreach x $args {
    if {$sortCriteria(real) == ""} {
      set sortCriteria(real) $x
      set sortCriteria(translated) $::tr($x)
    } else {
      append sortCriteria(real) ", $x"
      append sortCriteria(translated) ", $::tr($x)"
    }
  }
  updateSortWin
}

proc makeSortWin {} {
  global sortCriteria
  set w .sortWin
  if {[winfo exists $w]} {
    raiseWin $w
    return
  }
  toplevel $w
  wm title $w "Scid: [tr FileMaintSort]"
  wm resizable $w 0 0

  label $w.torder -textvar ::tr(SortCriteria:) -font font_Bold
  pack $w.torder -side top
  label $w.order -textvar sortCriteria(translated) -width 40 -bg white \
    -relief solid -anchor w
  pack $w.order -side top -fill x -pady 2 -padx 2
  addHorizontalRule $w
  label $w.tadd -textvar ::tr(AddCriteria:) -font font_Bold
  pack $w.tadd -side top
  pack [frame $w.add] -side top -fill x
  foreach b {Date Year Month Event Site Country Round Result Length 
             White Black Rating ECO Deleted EventDate} {
    set n [string tolower $b]
    button $w.add.$n -textvar ::tr($b) -command "addSortCriteria $b"
  }
  grid $w.add.date -row 0 -column 0 -sticky we
  grid $w.add.year -row 0 -column 1 -sticky we
  grid $w.add.month -row 0 -column 2 -sticky we
  grid $w.add.event -row 1 -column 0 -sticky we
  grid $w.add.site -row 1 -column 1 -sticky we
  grid $w.add.country -row 1 -column 2 -sticky we
  grid $w.add.round -row 2 -column 0 -sticky we
  grid $w.add.result -row 2 -column 1 -sticky we
  grid $w.add.length -row 2 -column 2 -sticky we
  grid $w.add.white -row 3 -column 0 -sticky we
  grid $w.add.black -row 3 -column 1 -sticky we
  grid $w.add.rating -row 3 -column 2 -sticky we
  grid $w.add.eco -row 4 -column 0 -sticky we
  grid $w.add.deleted -row 4 -column 1 -sticky we
  grid $w.add.eventdate -row 4 -column 2 -sticky we

  for {set i 0} {$i < 3} {incr i} {
    grid columnconfigure $w.add $i -weight 1
  }

  addHorizontalRule $w

  label $w.tcommon -textvar ::tr(CommonSorts:) -font font_Bold
  pack $w.tcommon -side top
  pack [frame $w.tc] -side top -fill x
  button $w.tc.ymsedr -text "$::tr(Year), $::tr(Month), $::tr(Site), $::tr(Event), $::tr(Date), $::tr(Round)" -command {
    clearSortCriteria
    addSortCriteria Year Month Site Event Date Round
  }
  button $w.tc.yedr -text "$::tr(Year), $::tr(Event), $::tr(Date), $::tr(Round)" -command {
    clearSortCriteria
    addSortCriteria Year Event Date Round
  }
  button $w.tc.er -text "$::tr(ECO), $::tr(Rating)" -command {
    clearSortCriteria
    addSortCriteria ECO Rating
  }
  grid $w.tc.ymsedr -row 0 -column 0 -sticky we
  grid $w.tc.yedr -row 1 -column 0 -sticky we
  grid $w.tc.er -row 2 -column 0 -sticky we
  grid columnconfigure $w.tc 0 -weight 1
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.b.clear -textvar ::tr(Clear) -command clearSortCriteria
  button $w.b.help -textvar ::tr(Help) -command {helpWindow Sorting}
  button $w.b.sort -textvar ::tr(Sort) -command sortDatabase
  button $w.b.close -textvar ::tr(Close) \
    -command "focus .; destroy $w"
  pack $w.b.close $w.b.sort -side right -padx 5 -pady 2
  pack $w.b.clear $w.b.help -side left -padx 5 -pady 2
  bind $w <F1> {helpWindow Sorting}
  bind $w <Escape> "$w.b.close invoke"
  standardShortcuts $w
  updateSortWin
}

proc updateSortWin {} {
  global sortCriteria
  set w .sortWin
  if {! [winfo exists $w]} { return }
  set state disabled
  if {[sc_base inUse]  &&  $sortCriteria(real) != ""} { set state normal }
  $w.b.sort configure -state $state
}

proc sortDatabase {} {
  global sortCriteria
  set w .sortWin
  if {! [sc_base inUse]} {
    tk_messageBox -type ok -icon info -parent $w -title "Scid: Sort results" \
      -message "This is not an open database; there are no games to sort."
    return
  }
  progressWindow "Scid" "Sorting the database..."
  busyCursor .
  set err [catch {sc_base sort $sortCriteria(real) \
                    {changeProgressWindow "Storing results..."} \
                  } result]
  unbusyCursor .
  closeProgressWindow
  if {$err} {
    tk_messageBox -type ok -icon warning -parent $w \
      -title "Scid: Sort results" -message $result
  } else {
    #tk_messageBox -type ok -icon info -parent $w \
      -title "Scid: Sort results" \
      -message "The database was successfully sorted."
  }
  updateBoard .board
  updateGList
  updateMaintWin
}

proc makeBaseReadOnly {} {
  if {! [sc_base inUse]} { return }
  if {[sc_base isReadOnly]} { return }
  set result [tk_dialog .roDialog "Scid: [tr FileReadOnly]" \
                $::tr(ReadOnlyDialog) "" 1 $::tr(Yes) $::tr(No)]
  if {$result == 0} {
    sc_base isReadOnly set
    updateMenuStates
  }
}


# allocateRatings:
#   Allocate player ratings to games based on the spellcheck file.
#
set addRatings(overwrite) 0
set addRatings(filter) 0

proc allocateRatings {} {
  if {[catch {sc_name ratings -test 1} result]} {
    tk_messageBox -type ok -icon info -parent . -title "Scid" -message $result
    return
  }
  set w .ardialog
  toplevel $w
  wm title $w "Scid"
  label $w.lab -wraplength 3i -justify left -text "This command will use the current spellcheck file to add Elo ratings to games in this database. Wherever a player has no currrent rating but his/her rating at the time of the game is listed in the spellcheck file, that rating will be added."
  pack $w.lab -side top
  addHorizontalRule $w
  pack [frame $w.r] -side top
  label $w.r.lab -text "Overwrite existing non-zero ratings?"
  radiobutton $w.r.yes -variable addRatings(overwrite) \
    -value 1 -text $::tr(Yes)
  radiobutton $w.r.no -variable addRatings(overwrite) \
    -value 0 -text $::tr(No)
  pack $w.r.lab $w.r.yes $w.r.no -side left
  addHorizontalRule $w
  pack [frame $w.g] -side top
  label $w.g.lab -text "Add ratings to:"
  radiobutton $w.g.all -variable addRatings(filter) \
    -value 0 -text $::tr(SelectAllGames)
  radiobutton $w.g.filter -variable addRatings(filter) \
    -value 1 -text $::tr(SelectFilterGames)
  pack $w.g.lab $w.g.all $w.g.filter -side top
  addHorizontalRule $w
  pack [frame $w.b] -side top -fill x
  button $w.b.ok -text "OK" \
    -command "catch {grab release $w}; destroy $w; doAllocateRatings"
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 3 -pady 3
  catch {grab $w}
  focus $w.b.ok
}

proc doAllocateRatings {} {
  global addRatings
  if {[catch {sc_name ratings -test 1} result]} {
    tk_messageBox -type ok -icon info -parent . -title "Scid" -message $result
    return
  }
  progressWindow "Scid" "Adding Elo ratings..."
  busyCursor .
  if {[catch {sc_name ratings -change $addRatings(overwrite) -filter $addRatings(filter)} result]} {
    closeProgressWindow
    tk_messageBox -type ok -icon warning -parent . \
      -title "Scid" -message $result
  } else {
    closeProgressWindow
    set r [thousands [lindex $result 0]]
    set g [thousands [lindex $result 1]]
    tk_messageBox -type ok -icon info -parent . \
      -title "Scid" -message "Scid added $r Elo ratings in $g games."
  }
  unbusyCursor .
}


# stripTags:
#   Strip unwanted PGN tags from the current database.

array set stripTagCount {}

proc stripTags {} {
  global stripTagChoice stripTagCount
  set w .striptags
  if {[winfo exists $w]} { return }
  set stripTagList {}

  # Find extra PGN tags:
  set ::interrupt 0
  progressWindow "Scid" "Searching for extra PGN tags..." \
    $::tr(Cancel) "set ::interrupt 1; sc_progressBar"
  busyCursor .
  set err [catch {sc_base tag list} result]
  unbusyCursor .
  closeProgressWindow
  if {$::interrupt} { return }
  if {$err} { 
    tk_messageBox -title "Scid" -icon warning -type ok -message $result
    return 
  }

  # Make list of extra tags and their frequency:
  array unset stripTagCount
  set nTags 0
  foreach {tag count} $result {
    set stripTagCount($tag) $count
    incr nTags
  }

  if {$nTags == 0} {
    tk_messageBox -title "Scid" -icon info -type ok \
      -message "No extra tags were found."
    return
  }

  toplevel $w
  wm title $w "Scid: $::tr(StripTags)"
  label $w.title -text "Extra PGN tags:" -font font_Bold
  pack $w.title -side top
  pack [frame $w.f] -side top -fill x
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x

  set row 0
  foreach tag [lsort [array names stripTagCount]] {
    set count $stripTagCount($tag)
    radiobutton $w.f.t$tag -text "$tag  " -variable stripTagChoice -value $tag
    label $w.f.c$tag -text [thousands $count]
    if {$row == 0} { set stripTagChoice $tag }
    grid $w.f.t$tag -row $row -column 0 -sticky w
    grid $w.f.c$tag -row $row -column 1 -sticky e
    incr row
  }
  button $w.b.find -text $::tr(SetFilter) -command findStripTags
  button $w.b.strip -text $::tr(StripTag...) -command {
    set removed [doStripTags .striptags]
    set stripTagCount($stripTagChoice) \
      [expr $stripTagCount($stripTagChoice) - $removed]
    .striptags.f.c$stripTagChoice configure -text \
      [thousands $stripTagCount($stripTagChoice)]
  }
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.strip $w.b.find -side right -padx 2 -pady 2
  wm resizable $w 0 0
  update
  catch {grab $w}
}

proc doStripTags {{parent .}} {
  global stripTagChoice
  set msg "Do you really want to remove all occurences of the PGN tag"
  append msg " \"$stripTagChoice\" from this database?"
  set result [tk_messageBox -title "Scid" -parent $parent \
                -icon question -type yesno -message $msg]
  if {$result == "no"} { return 0 }
  progressWindow "Scid" "Removing the PGN tag $stripTagChoice..." \
    $::tr(Cancel) "sc_progressBar"
  busyCursor .
  set err [catch {sc_base tag strip $stripTagChoice} result]
  unbusyCursor .
  closeProgressWindow
  set count 0
  if {! $err} {
    set count $result
    set result "Removed $result instances of \"$stripTagChoice\"."
    append result "\n\n"
    append result "To save space and maintain database efficiency, it is a "
    append result "good idea to compact the game file after removing tags."
  }
  tk_messageBox -title "Scid" -parent $parent -type ok -icon info \
    -message $result
  return $count
}

proc findStripTags {} {
  global stripTagChoice
  progressWindow "Scid" "Finding games with the PGN tag $stripTagChoice..." \
    $::tr(Cancel) "sc_progressBar"
  busyCursor .
  set err [catch {sc_base tag find $stripTagChoice} result]
  unbusyCursor .
  closeProgressWindow
  updateStatsWin
}


# cleanerWin:
#   Open a dialog so the user can choose several maintenance tasks
#   in one action.

set cleaner(players) 1
set cleaner(events) 1
set cleaner(sites) 1
set cleaner(rounds) 1
set cleaner(eco) 1
set cleaner(elo) 1
set cleaner(twins) 1
set cleaner(cnames) 0
set cleaner(cgames) 0
set cleaner(tree) 0

proc cleanerWin {} {
  set w .mtoolWin
  if {[winfo exists $w]} { return }

  toplevel $w
  wm title $w "Scid: $::tr(Cleaner)"
  bind $w <F1> {helpWindow Maintenance Cleaner}

  pack [frame $w.help] -side top -fill x
  text $w.help.text -width 1 -height 7 -wrap word \
    -relief ridge -cursor top_left_arrow -yscrollcommand "$w.help.ybar set"
  scrollbar $w.help.ybar -orient vertical -command "$w.help.text yview" \
    -takefocus 0 -width 10
  pack $w.help.ybar -side right -fill y
  pack $w.help.text -side left -fill x -expand yes
  $w.help.text insert end [string trim $::tr(CleanerHelp)]
  $w.help.text configure -state disabled

  pack [frame $w.f] -side top -padx 20
  foreach i {players events sites rounds} j {Players Events Sites Rounds} {
    label $w.f.$i -text "$::tr(Spellchecking): $::tr($j)"
  }
  label $w.f.eco -text $::tr(ReclassifyGames)
  label $w.f.elo -text $::tr(AddEloRatings)
  label $w.f.twins -text $::tr(DeleteTwins)
  label $w.f.cnames -text $::tr(CompactNames)
  label $w.f.cgames -text $::tr(CompactGames)
  label $w.f.tree -text [tr TreeFileFill]

  foreach i {players events sites rounds eco elo twins cnames cgames tree} {
    radiobutton $w.f.y$i -variable cleaner($i) -value 1 -text $::tr(Yes)
    radiobutton $w.f.n$i -variable cleaner($i) -value 0 -text $::tr(No)
  }
  set row 0
  foreach i {players events sites rounds eco elo twins cnames cgames tree} {
    grid $w.f.$i -row $row -column 0 -sticky w
    grid $w.f.y$i -row $row -column 1 -sticky w
    grid $w.f.n$i -row $row -column 2 -sticky w
    incr row
  }

  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.b.ok -text "OK" -command "catch {grab release $w}; destroy $w; doCleaner"
  button $w.b.cancel -text $::tr(Cancel) -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  wm resizable $w 0 0
  catch {grab $w}
}

proc doCleaner {} {
  global cleaner twinSettings

  set answer [tk_dialog .mtoolDialog "Scid" \
                [string trim $::tr(CleanerConfirm)] "" \
                0 $::tr(Yes) $::tr(No)]
  if {$answer != 0} { return }

  set w .mtoolStatus
  if {! [winfo exists $w]} {
    toplevel $w
    wm title $w "Scid: $::tr(Cleaner)"
    pack [frame $w.b] -side bottom -fill x
    pack [frame $w.t] -side top -fill both -expand yes
    text $w.t.text -width 60 -height 10 -wrap none -setgrid 1 \
      -cursor top_left_arrow -yscrollcommand "$w.t.ybar set"
    scrollbar $w.t.ybar -orient vertical -command "$w.t.text yview" \
      -takefocus 0 -width 10
    pack $w.t.ybar -side right -fill y
    pack $w.t.text -side left -fill both -expand yes
    button $w.b.close -text $::tr(Close) \
      -command "catch {grab release $w}; destroy $w"
    pack $w.b.close -side right -padx 2 -pady 2
    wm minsize $w 20 5
  }

  busyCursor .
  catch {grab $w}
  set t $w.t.text
  $t delete 1.0 end
  $t insert end "$::tr(Cleaner)."
  $t insert end "  $::tr(Database): [file tail [sc_base filename]]\n"

  $w.b.close configure -state disabled

  set count 1

  foreach nameType {Player Event Site Round} {
    set names $nameType
    append names "s"
    set tag [string tolower $names]
    if {$cleaner($tag)} {
      mtoolAdd $t "$count: $::tr(Spellchecking): $::tr($names)..."
      incr count
      set result "0 $nameType names were corrected."
      if {! [catch {sc_name spellcheck -max 100000 $nameType} corrections]} {
        update
        catch {sc_name correct $nameType $corrections} result
      }
      $t insert end "   $result\n"
      $t see end
    }
  }

  if {$cleaner(eco)} {
    mtoolAdd $t "$count: $::tr(ReclassifyGames)..."
    incr count
    catch {sc_eco base $::classifyOption(AllGames) \
             $::classifyOption(ExtendedCodes)} result
    $t insert end "   $result\n"
    $t see end
  }

  if {$cleaner(elo)} {
    mtoolAdd $t "$count: $::tr(AddEloRatings)..."
    incr count
    if {[catch {sc_name ratings} result]} {
      $t insert end "   $result\n"
    } else {
      set r [thousands [lindex $result 0]]
      set g [thousands [lindex $result 1]]
      $t insert end "   Scid added $r Elo ratings in $g games.\n"
    }
  }

  if {$cleaner(twins)} {
    mtoolAdd $t "$count: $::tr(DeleteTwins)..."
    incr count
    if {$twinSettings(undelete) == "Yes"} {
      catch {sc_game flag delete all 0}
      update
    }
    if {[catch {sc_base duplicates -colors $twinSettings(colors) \
                  -event $twinSettings(event) -site $twinSettings(site) \
                  -round $twinSettings(round) -year $twinSettings(year) \
                  -month $twinSettings(month) -day $twinSettings(day) \
                  -result $twinSettings(result) -eco $twinSettings(eco) \
                  -moves $twinSettings(moves) -players $twinSettings(players) \
                  -setfilter $twinSettings(setfilter) \
                  -usefilter $twinSettings(usefilter) \
                  -comments $twinSettings(comments) \
                  -variations $twinSettings(variations) \
                  -delete $twinSettings(delete)} result]} {
      set message $result
    } else {
      set message "Scid found $result twin games"
      if {$result > 0} {append message " and set their delete flags"}
    }
    $t insert end "   $message.\n"
  }

  if {$cleaner(cnames)} {
    mtoolAdd $t "$count: $::tr(CompactNames)..."
    incr count
    set stats [sc_compact stats names]
    if {[lindex $stats 1] == 0  &&  [lindex $stats 3] == 0  && \
          [lindex $stats 5] == 0  &&  [lindex $stats 7] == 0} {
      $t insert end "   Name file already compacted.\n"
    } else {
      set err [catch {sc_compact names} result]
      if {$err} {
        $t insert end "   $result\n"
      } else {
        $t insert end "   Done.\n"
      }
    }
    $t see end
  }

  if {$cleaner(cgames)} {
    mtoolAdd $t "$count: $::tr(CompactGames)..."
    incr count
    set stats [sc_compact stats games]
    if {[lindex $stats 1] == [lindex $stats 3]  && \
          [lindex $stats 0] == [lindex $stats 2]} {
      $t insert end "   Game file already compacted.\n"
    } else {
      set err [catch {sc_compact games} result]
      if {$err} {
        $t insert end "   $result\n"
      } else {
        $t insert end "   Done.\n"
      }
    }
    $t see end
  }

  if {$cleaner(tree)} {
    mtoolAdd $t "$count: [tr TreeFileFill]..."
    incr count
    sc_game push
    set base [sc_base current]
    set len [llength $::tree(standardLines)]
    foreach line $::tree(standardLines) {
      sc_game new
      if {[llength $line] > 0}  {
        foreach move $line {sc_move addSan $move}
      }
      sc_tree search -base $base
      update
    }
    catch {sc_tree write $base} result
    sc_game pop
    $t insert end "   Done.\n"
  }

  mtoolAdd $t "Done."
  updateBoard .board
  updateGList
  updateMaintWin
  $w.b.close configure -state normal
  catch {grab release $w}
  unbusyCursor .
}

proc mtoolAdd {tw title} {
  set time [clock format [clock seconds] -format "%H:%M:%S"]
  $tw insert end "\n\[$time\]\n"
  if {$title != ""} { $tw insert end "$title\n" }
  $tw see end
  update
}
### optable.tcl: Opening report and theory table generation.
### Part of Scid. Copyright 2001 Shane Hudson.

namespace eval ::optable {}
array set ::optable::_data {}

set ::optable::_data(exclude) "---"
set ::optable::_docStart(text) {}
set ::optable::_docEnd(text) {}
set ::optable::_docStart(ctext) {}
set ::optable::_docEnd(ctext) {}
set ::optable::_flip 0

set ::optable::_docStart(html) {<html>
<head><title>Opening Report</title></head>
<body bgcolor="#ffffff">
}
set ::optable::_docEnd(html) {</body>
</html>
}

set ::optable::_docStart(latex) {\documentclass[10pt,a4paper]{article}
% This is a LaTeX file generated by Scid.
% You must have the "chess12" package installed to typeset this file.

\usepackage{times}
\usepackage{a4wide}
\usepackage{chess}
\usepackage[T1]{fontenc}

\setlength{\columnsep}{1cm}
\setlength{\parindent}{0pt}
\setlength{\parskip}{3pt}

\font\F=chessf10
\newcommand{\B}{{\F B}}
\newcommand{\N}{{\F N}}
\newcommand{\R}{{\F R}}
\newcommand{\Q}{{\F Q}}
\newcommand{\K}{{\F K}}
\newcommand{\tspace}{{\vspace{0.08cm}}}
\newcommand{\draw}{{\small$\frac{1}{2}$:$\frac{1}{2}$}}
\newcommand{\loss}{\mbox{0:1}}
\newcommand{\win}{\mbox{1:0}}
\newcommand{\notenum}[1]{\hspace{-0.7cm}\makebox[0.55cm][r]{$^{ #1 }$ }\makebox[0.05cm]{}}

%\font\Chess=chess10
\begin{document}
\raggedright
\nochess
}
set ::optable::_docEnd(latex) {
\end{document}
}

proc ::optable::configMenus {{lang ""}} {
  if {! [winfo exists .oprepWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .oprepWin.menu
  foreach menu {file help} tag {File Help} {
    configMenuName $m.$menu Oprep$tag $lang
  }
  foreach idx {0 1 2 4 6} tag {Text Html LaTeX Options Close} {
    configMenuText $m.file.m $idx OprepFile$tag $lang
  }
  foreach idx {0 1} tag {Report Index} {
    configMenuText $m.help.m $idx OprepHelp$tag $lang
  }
}

proc ::optable::makeReportWin {} {
  if {! [sc_base inUse]} { return }
  set w .progress
  toplevel $w
  wm withdraw $w
  wm title $w "Scid: Generating Report"
  bind $w <Visibility> "raiseWin $w"

  pack [frame $w.b] -side bottom -fill x
  set ::optable::_interrupt 0
  button $w.b.cancel -text $::tr(Cancel) -command {
    set ::optable::_interrupt 1
    sc_progressBar
  }
  pack $w.b.cancel -side right -pady 5 -padx 2

  foreach i {1 2} name {"Searching database for report games"
                        "Generating report information"} {
    label $w.text$i -text "$i. $name"
    pack $w.text$i -side top
    canvas $w.c$i -width 400 -height 20 -bg white -relief solid -border 1
    $w.c$i create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
    $w.c$i create text 395 10 -anchor e -font font_Regular -tags time \
      -fill black -text "0:00 / 0:00"
    pack $w.c$i -side top -pady 10
  }
  wm resizable $w 0 0
  # Set up geometry for middle of screen:
  set x [winfo screenwidth $w]; set x [expr $x - 400]; set x [expr $x / 2]
  set y [winfo screenheight $w]; set y [expr $y - 20]; set y [expr $y / 2]
  wm geometry $w +$x+$y
  wm deiconify $w
  grab $w.b.cancel
  sc_progressBar $w.c1 bar 401 21 time
  busyCursor .
  set newTreeData [sc_tree search -time 0 -epd 0]
  if {$::optable::_interrupt} {
    unbusyCursor .
    grab release $w.b.cancel
    destroy $w
    return
  }
  sc_progressBar $w.c2 bar 401 21 time
  sc_optable create $::optable(ExtraMoves) $::optable(MaxGames)\
    $::optable::_data(exclude)
  unbusyCursor .
  grab release $w.b.cancel
  destroy $w
  if {$::optable::_interrupt} { return }
  set ::optable::_data(tree) $newTreeData
  ::optable::latexifyTree
  set ::optable::_data(bdLaTeX) [sc_pos tex]
  set ::optable::_data(bdHTML) [sc_pos html]
  set ::optable::_data(bdLaTeX_flip) [sc_pos tex flip]
  set ::optable::_data(bdHTML_flip) [sc_pos html -flip 1]
  ::optable::setupRatios
  set report [::optable::report ctext 1]

  set w .oprepWin
  if {![winfo exists $w]} {
    toplevel $w
    wm title $w "Scid: [tr ToolsOpReport]"
    frame $w.menu
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text OprepFile -menu $w.menu.file.m
    menubutton $w.menu.help -text OprepHelp -menu $w.menu.help.m
    foreach i {file help} {
      menu $w.menu.$i.m -tearoff 0
      pack $w.menu.$i -side left
    }
    $w.menu.file.m add command -label OprepFileText \
      -command {::optable::saveReport text}
    $w.menu.file.m add command -label OprepFileHtml \
      -command {::optable::saveReport html}
    $w.menu.file.m add command -label OprepFileLaTeX \
      -command {::optable::saveReport latex}
    $w.menu.file.m add separator
    $w.menu.file.m add command -label OprepFileOptions \
      -command ::optable::setOptions
    $w.menu.file.m add separator
    $w.menu.file.m add command -label OprepFileClose \
      -command "$w.b.close invoke"
    $w.menu.help.m add command -label OprepHelpReport \
      -accelerator F1 -command {helpWindow OpReport}
    $w.menu.help.m add command -label OprepHelpIndex \
      -command {helpWindow Index}

    bind $w <F1> {helpWindow OpReport}
    bind $w <Escape> "$w.b.close invoke"
    bind $w <Up> "$w.text yview scroll -1 units"
    bind $w <Down> "$w.text yview scroll 1 units"
    bind $w <Prior> "$w.text yview scroll -1 pages"
    bind $w <Next> "$w.text yview scroll 1 pages"
    bind $w <Key-Home> "$w.text yview moveto 0"
    bind $w <Key-End> "$w.text yview moveto 0.99"

    text $w.text -height 35 -width 82 -font font_Small -setgrid 1 \
      -wrap word -bg white -foreground black -yscrollcommand "$w.ybar set" \
      -cursor top_left_arrow
    ::htext::init $w.text
    scrollbar $w.ybar -command "$w.text yview"
    frame $w.b
    button $w.b.previewL -text "View LaTeX" -command ::optable::previewLaTeX
    button $w.b.opts -text [tr OprepFileOptions] -command ::optable::setOptions
    label $w.b.lexclude -text "Exclude:"
    menubutton $w.b.exclude -textvar ::optable::_data(exclude) \
      -indicatoron 1 -relief raised -bd 2 -menu $w.b.exclude.m -padx 1
    menu $w.b.exclude.m -tearoff 0
    button $w.b.update -textvar ::tr(Update) -command {
      set ::optable::_data(yview) [lindex [.oprepWin.text yview] 0]
      ::optable::makeReportWin
      .oprepWin.text yview moveto $::optable::_data(yview)
    }
    button $w.b.help -textvar ::tr(Help) -command {helpWindow OpReport}
    button $w.b.close -textvar ::tr(Close) -command "focus .; destroy $w"
    pack $w.b -side bottom -fill x
    pack $w.ybar -side right -fill y
    pack $w.text -side left -fill both -expand yes
    pack $w.b.close $w.b.update -side right -padx 1 -pady 2
    if {! $::windowsOS} {
      pack $w.b.previewL -side left -padx 1 -pady 2
    }
    pack $w.b.opts $w.b.lexclude $w.b.exclude -side left -padx 1 -pady 2
    ::optable::configMenus
  }

  catch {destroy $w.text.bd}
  ::board::new $w.text.bd 30
  if {$::optable::_flip} { ::board::flip $w.text.bd }
  $w.text.bd configure -relief solid -borderwidth 1
  for {set i 0} {$i < 63} {incr i} {
    ::board::bind $w.text.bd $i <ButtonPress-1> ::optable::flipBoard
    #::board::bind $w.text.bd $i <ButtonPress-3> ::optable::resizeBoard
  }
  ::board::update $w.text.bd [sc_pos board]
  $w.b.exclude.m delete 0 end
  $w.b.exclude.m add radiobutton -label "---" \
    -variable ::optable::_data(exclude) -command "$w.b.update invoke"
  foreach move $::optable::_data(moves) {
    $w.b.exclude.m add radiobutton -label $move \
      -variable ::optable::_data(exclude) -command "$w.b.update invoke"
  }
  if {[lsearch $::optable::_data(moves) $::optable::_data(exclude)] < 0} {
    set ::optable::_data(exclude) "---"
  }
  busyCursor .
  $w.text configure -state normal
  $w.text delete 1.0 end
  regsub -all "\n" $report "<br>" report
  ::htext::display $w.text $report
  $w.text configure -state disabled
  unbusyCursor .
}

proc ::optable::flipBoard {} {
  ::board::flip .oprepWin.text.bd
  set ::optable::_flip [::board::isFlipped .oprepWin.text.bd]
}

proc ::optable::resizeBoard {} {
  set bd .oprepWin.text.bd
  set size [::board::size $bd]
  if {$size >= 40} { set size 25 } else { incr size 5 }
  ::board::resize $bd $size
}

proc ::optable::setOptions {} {
  set w .oprepOptions
  if {[winfo exists $w]} { return }
  toplevel $w
  pack [frame $w.f] -side top -fill x -padx 5 -pady 5
  set row 0
  foreach i {Stats Popular AvgPerf Results MovesFrom Themes Endgames} {
    set yesno($i) 1
  }
  foreach i {Stats Oldest Newest Popular MostFrequent sep \
               AvgPerf HighRating sep \
               Results Shortest sep \
               MoveOrders MovesFrom Themes Endgames sep \
               MaxGames ExtraMoves} {
    set from 0; set to 10; set tick 1; set res 1
    if {$i == "MaxGames"} {
      set from 0; set to 500; set tick 100; set res 50
    }
    if {$i == "sep"} {
      frame $w.f.fsep$row -height 2 -borderwidth 2 -relief sunken -bg white
      frame $w.f.tsep$row -height 2 -borderwidth 2 -relief sunken -bg white
      grid $w.f.fsep$row -row $row -column 0 -sticky we -columnspan 4
      #grid $w.f.tsep$row -row $row -column 1 -sticky we -columnspan 2
    } elseif {[info exists yesno($i)]} {
      frame $w.f.f$i
      radiobutton $w.f.f$i.yes -variable ::optable($i) -value 1 \
        -text "$::tr(Yes)   " -font font_Small
      radiobutton $w.f.f$i.no -variable ::optable($i) -value 0 \
        -text "$::tr(No)   "  -font font_Small
      pack $w.f.f$i.yes -side left
      pack $w.f.f$i.no -side right
      label $w.f.t$i -textvar ::tr(Oprep$i) -font font_Small
      grid $w.f.f$i -row $row -column 0 -sticky n
      grid $w.f.t$i -row $row -column 1 -sticky w -columnspan 3
    } else {
      scale $w.f.s$i -variable ::optable($i) -from $from -to $to \
        -width 8 -length 200 -tickinterval $tick -orient horizontal \
        -font font_Small -resolution $res -showvalue 0
      label $w.f.t$i -textvar ::tr(Oprep$i) -font font_Small
      grid $w.f.s$i -row $row -column 0 -sticky we
      if {$i == "MostFrequent"  ||  $i == "Shortest"} {
        checkbutton $w.f.w$i -text $::tr(White) -font font_Small \
          -variable ::optable(${i}White)
        checkbutton $w.f.b$i -text $::tr(Black) -font font_Small \
          -variable ::optable(${i}Black)
        grid $w.f.t$i -row $row -column 1 -sticky w
        grid $w.f.w$i -row $row -column 2
        grid $w.f.b$i -row $row -column 3
      } else {
        grid $w.f.t$i -row $row -column 1 -sticky w -columnspan 3
      }
    }
    grid rowconfigure $w.f $row -pad 2
    incr row
  }
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.b.defaults -textvar ::tr(Defaults) -command {
    array set ::optable [array get ::optableDefaults]
  }
  button $w.b.ok -text "OK" -command {
    destroy .oprepOptions
    catch {set ::optable::_data(yview) [lindex [.oprepWin.text yview] 0]}
    ::optable::makeReportWin
    catch {.oprepWin.text yview moveto $::optable::_data(yview)}
  }
  button $w.b.cancel -textvar ::tr(Cancel) -command {
    array set ::optable [array get ::optable::backup]
    destroy .oprepOptions
  }
  pack $w.b.defaults -side left -padx 5 -pady 5
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 5
  array set ::optable::backup [array get ::optable]
  wm resizable $w 0 0
  wm title $w  "Scid: [tr ToolsOpReport]: [tr OprepFileOptions]"
  bind $w <Escape> "$w.b.cancel invoke"
}

# previewLaTeX:
#   Saves the report to a temporary file, runs latex on it, then
#   "dvips" to produce PostScript, and "ghostview" to display it.
#
proc ::optable::previewLaTeX {} {
  busyCursor .
  set tmpdir $::scidUserDir
  set tmpfile "scidreport"
  set fname [file join $tmpdir $tmpfile]
  catch {exec /bin/sh -c "rm $fname.*" }
  if {[catch {set tempfile [open $fname.tex w]}]} {
    tk_messageBox -title "Scid: Error writing report" -type ok -icon warning \
      -message "Unable to write the file: $fname.tex"
  }
  # Add the "batchmode" command to the top of the file to prevent latex
  # pausing for input on errors:
  puts $tempfile "\\batchmode"
  puts $tempfile [::optable::report latex 1 $::optable::_flip]
  close $tempfile
  if {! [catch {exec /bin/sh -c "cd $tmpdir; latex '$tmpfile.tex'" >& /dev/null}]} {
    if {[catch {exec /bin/sh -c "cd $tmpdir; dvips '$tmpfile.dvi'" >& /dev/null}]} {
      tk_messageBox -title "Scid" -icon warning -type ok \
        -message "Unable to run \"dvips\" to convert the report to PostScript."
    } else {
      if {[catch {exec /bin/sh -c "ghostview '$fname.ps'" >& /dev/null &}]} {
        tk_messageBox -title "Scid" -icon warning -type ok \
          -message "Unable to run \"xdvi\" to view the report."
      }
    }
  } else {
    tk_messageBox -title "Scid: Errors producing report" -type ok \
      -icon warning \
      -message "Errors running latex on the file: $fname.tex\n\nSee $fname.log for details."
  }
  unbusyCursor .
}

# saveReport:
#   Saves the current opening report to a file.
#   "fmt" is the format: text, html or latex.
#   "type" is the report type: report, table, or both.
#
proc ::optable::saveReport {fmt} {
  set t [tk_dialog .dialog "Scid: Select report type" \
           "Select the report type. You may save a full report (which includes the theory table), a compact report (with no theory table), or just the theory table by itself." \
           "" 0 "Full report" "Compact report" \
           "Theory table" "Cancel"]
  if {$t == 3} { return }
  set default ".txt"
  set ftype {
    { "Text files" {".txt"} }
    { "All files"  {"*"}    }
  }
  if {$fmt == "latex"} {
    set default ".tex"
    set ftype {
      { "LaTeX files" {".tex" ".ltx"} }
      { "All files"  {"*"}    }
    }
  } elseif {$fmt == "html"} {
    set default ".html"
    set ftype {
      { "HTML files" {".html" ".htm"} }
      { "All files"  {"*"}    }
    }
  }

  set fname [tk_getSaveFile -initialdir [pwd] -filetypes $ftype \
               -defaultextension $default -title "Scid: Save opening report"]
  if {$fname == ""} { return }

  busyCursor .
  if {[catch {set tempfile [open $fname w]}]} {
    tk_messageBox -title "Scid: Error writing report" -type ok -icon warning \
      -message "Unable to write the file: $fname\n\n"
  } else {
    if {$t == 2} {
      set report [::optable::table $fmt]
    } elseif {$t == 1} {
      set report [::optable::report $fmt 0 $::optable::_flip]
    } else {
      set report [::optable::report $fmt 1 $::optable::_flip]
    }
    if {$::hasEncoding  &&  $::langEncoding($::language) != ""} {
      catch {set report [encoding convertto $::langEncoding($::language) $report]}
    }
    puts $tempfile $report
    close $tempfile
  }
  unbusyCursor .
}

proc ::optable::create {} {
  set ::optable::_data(tree) [sc_tree search -time 0 -epd 0]
  ::optable::latexifyTree
  set ::optable::_data(bdLaTeX) [sc_pos tex]
  set ::optable::_data(bdHTML) [sc_pos html]
  set ::optable::_data(bdLaTeX_flip) [sc_pos tex flip]
  set ::optable::_data(bdHTML_flip) [sc_pos html -flip 1]
  sc_optable create $::optable(ExtraMoves) $::optable(MaxGames)
  ::optable::setupRatios
}

proc ::optable::latexifyTree {} {
  set ::optable::_data(moves) {}
  if {! [info exists ::optable::_data(tree)]} { return }
  set tree [split $::optable::_data(tree) "\n"]
  set ltree "\\begin{tabular}{rllr@{:}rrrrr}\n\\hline\n"
  append ltree " & Move & ECO & \\multicolumn{2}{c}{Frequency}"
  append ltree " & Score & \$\\mu\$Elo & Perf & \$\\mu\$Year \\\\ \n"
  append ltree "\\hline\n"
  set len [llength $tree]
  set done 0
  for {set i 1} {$i < $len} {incr i} {
    set line [lindex $tree $i]
    if {[string index $line 0] == "_"} {
      append ltree "\\hline\n"
      continue
    }
    if {[string length $line] == 0} { continue }
    set num    [string range $line  0  1]
    set move   [string range $line  4  9]
    set eco    [string range $line 11 15]
    set freq   [string range $line 17 23]
    set fpct   [string range $line 25 29]
    set score  [string range $line 33 37]
    set avElo  [string range $line 41 44]
    set perf   [string range $line 47 50]
    set avYear [string range $line 53 56]
    set mv [string trim $move]
    regsub K $move {{\\K}} move
    regsub Q $move {{\\Q}} move
    regsub R $move {{\\R}} move
    regsub B $move {{\\B}} move
    regsub N $move {{\\N}} move
    if {[string index $line 0] == "T"} {
      append ltree "\\multicolumn{2}{l}{Total}"
    } else {
      append ltree " $num & $move "
      lappend ::optable::_data(moves) $mv
    }
    append ltree " & $eco & $freq & $fpct\\% & $score\\%"
    append ltree " & $avElo & $perf & $avYear \\\\ \n"
  }
  append ltree "\\hline\n"
  append ltree "\\end{tabular}\n"
  set ::optable::_data(latexTree) $ltree
}

proc ::optable::setupRatios {} {
  set r [sc_filter freq date 0000.00.00]
  if {[lindex $r 0] == 0} {
    set ::optable::_data(ratioAll) 0
  } else {
    set ::optable::_data(ratioAll) \
      [expr int(double([lindex $r 1]) / double([lindex $r 0]))]
  }
  foreach {start end} {1800 1899  1900 1949  1950 1969  1970 1979
    1980 1989 1990 1999 2000 2009} {
    set r [sc_filter freq date $start.00.00 $end.12.31]
    set filter [lindex $r 0]
    set all [lindex $r 1]
    if {$filter == 0} {
      set ::optable::_data(range$start) "---"
    } else {
      set ::optable::_data(range$start) \
        [expr int(double($all) / double($filter))]
    }
  }
  foreach y {1 5 10} {
    set year "[expr [::date::today year]-$y]"
    append year ".[::date::today month].[::date::today day]"
    set r [sc_filter freq date $year]
    set filter [lindex $r 0]
    set all [lindex $r 1]
    if {$filter == 0} {
      set ::optable::_data(ratio$y) 0
    } else {
      set ::optable::_data(ratio$y) \
        [expr int(double($all) / double($filter))]
    }
    if {$::optable::_data(ratio$y) == 0} {
      set r 1.0
    } else {
      set r [expr double($::optable::_data(ratioAll))]
      set r [expr $r / double($::optable::_data(ratio$y))]
    }
    set ::optable::_data(delta$y) [expr int(($r - 1.0) * 100.0 + 0.5)]
  }
}

proc ::optable::_percent {x} {
  set p "%"
  if {$::optable::_data(fmt) == "latex"} { set p "\\%" }
  return "[expr $x / 10][sc_info decimal][expr $x % 10]$p"
}

proc ::optable::results {} {
  set s {}
  append s [::optable::_subsec $::tr(OprepResults)]
  set fmt $::optable::_data(fmt)

  set n "\n"; set next " "; set p "%"
  set white "1-0"; set draw "=-="; set black "0-1"

  if {$fmt == "latex"} {
    set next " & "; set n "\\\\\n"; set p "\\%"
    set white "\\win"; set draw "\\draw"; set black "\\loss"
    append s "\\begin{tabular}{lccccccc}\n"
  }

  if {$fmt == "html"} { append s "<pre>\n" }
  if {$fmt == "ctext"} { append s "<tt>" }
  if {$fmt == "latex"} { append s "\\hline\n" }

  set lenReport [string length $::tr(OprepReportGames)]
  set lenAll [string length $::tr(OprepAllGames)]
  set len [expr ($lenReport > $lenAll) ? $lenReport : $lenAll]
  set score [capital $::tr(score)]
  set slen [string length $score]
  if {$slen < 7} { set slen 7 }

  append s " [pad {} $len] $next"
  append s "[padR $score $slen] $next"
  if {$fmt == "latex"} {
    append s "\\multicolumn{3}{c}{$::tr(OprepLength)} & "
    append s "\\multicolumn{3}{c}{$::tr(OprepFrequency)} $n "
  } else {
    append s "[padC $::tr(OprepLength) 19] $next"
    append s "[padC $::tr(OprepFrequency) 22] $n"
  }

  append s " [pad {} $len] $next"
  append s "[padR {} $slen] $next"
  append s "[padR $white 5] $next"
  append s "[padR $draw  5] $next"
  append s "[padR $black 5] $next"
  append s "[padR $white 5]  $next"
  append s "[padR $draw  5]  $next"
  append s "[padR $black 5]  $n"
  if {$fmt == "latex"} { append s "\\hline\n" }

  set sc [sc_optable score]
  set wlen [sc_optable avgLength 1]
  set dlen [sc_optable avgLength =]
  set blen [sc_optable avgLength 0]
  set wf [sc_optable freq 1]
  set df [sc_optable freq =]
  set bf [sc_optable freq 0]

  append s " [pad $::tr(OprepReportGames) $len] $next"
  append s "[padR [::optable::_percent [lindex $sc 0]] $slen] $next"
  append s "[padR [lindex $wlen 0] 5] $next"
  append s "[padR [lindex $dlen 0] 5] $next"
  append s "[padR [lindex $blen 0] 5] $next"
  append s "[padR [::optable::_percent [lindex $wf 0]] 6] $next"
  append s "[padR [::optable::_percent [lindex $df 0]] 6] $next"
  append s "[padR [::optable::_percent [lindex $bf 0]] 6] $n"

  append s " [pad $::tr(OprepAllGames) $len] $next"
  append s "[padR [::optable::_percent [lindex $sc 1]] $slen] $next"
  append s "[padR [lindex $wlen 1] 5] $next"
  append s "[padR [lindex $dlen 1] 5] $next"
  append s "[padR [lindex $blen 1] 5] $next"
  append s "[padR [::optable::_percent [lindex $wf 1]] 6] $next"
  append s "[padR [::optable::_percent [lindex $df 1]] 6] $next"
  append s "[padR [::optable::_percent [lindex $bf 1]] 6] $n"

  if {$fmt == "latex"} { append s "\\hline\n\\end{tabular}\n" }
  if {$fmt == "html"} { append s "</pre>\n" }
  if {$fmt == "ctext"} { append s "</tt>" }
  return $s
}

proc ::optable::stats {} {
  global stats
  set s {}
  set all $::tr(OprepStatAll)
  set both $::tr(OprepStatBoth)
  set since $::tr(OprepStatSince)
  set games [capital $::tr(games)]
  set score [capital $::tr(score)]

  set alen [string length $all]
  set blen [expr [string length $both] + 6]
  set slen [expr [string length $since] + 11]
  set len $alen
  if {$len < $blen} { set len $blen }
  if {$len < $slen} { set len $slen }

  set ratings 0
  set years 0
  set rlist [lsort -decreasing [array names stats r*]]
  set ylist [lsort [array names stats y*]]
  foreach i $rlist { if {$stats($i)} { set ratings 1 } }
  foreach i $ylist { if {$stats($i)} { set years 1 } }

  if {$::optable::_data(fmt) == "latex"} {
    append s "\\begin{tabular}{l r r r r r @{.} l}\n\\hline\n"
    append s "       & $games & \\win & \\draw & \\loss & "
    append s "\\multicolumn{2}{c}{$score} \\tspace \\\\ \\hline \n"
    scan [sc_filter stats all] "%u%u%u%u%u%\[.,\]%u" g w d l p c x
    append s "$all & $g & $w & $d & $l & $p&$x\\% \\\\\n"

    if {$ratings} {
      append s "\\hline\n"
      foreach i $rlist {
        if {$stats($i)} {
          set elo [string range $i 1 end]
          scan [sc_filter stats elo $elo] "%u%u%u%u%u%\[.,\]%u" g w d l p c x
          append s "$both $elo+ & $g & $w & $d & $l & $p&$x\\% \\\\\n"
        }
      }
    }
    if {$years} {
      append s "\\hline\n"
      foreach i $ylist {
        if {$stats($i)} {
          set year [string range $i 1 end]
          scan [sc_filter stats year $year] "%u%u%u%u%u%\[.,\]%u" g w d l p c x
          append s "$since $year.01.01 & $g & $w & $d & $l & $p&$x\\% \\\\\n"
        }
      }
    }
    append s "\\hline\n\\end{tabular}\n"
    return $s
  }

  # For non-LaTeX format, just display in plain text:
  if {$::optable::_data(fmt) == "html"} { append s "<pre>\n" }
  if {$::optable::_data(fmt) == "ctext"} { append s "<tt>" }
  set stat ""
  append s " [pad $stat [expr $len - 4]] [padR $games 10]"
  append s "     1-0     =-=     0-1 [padR $score 8]\n"
  append s "-----------------------------------------------------------"
  append s "\n [pad $all $len]"     [sc_filter stats all]

  if {$ratings} {
    append s "\n"
    foreach i $rlist {
      if {$stats($i)} {
        set elo [string range $i 1 end]
        set stat "$both $elo+"
        append s "\n [pad $stat $len]"   [sc_filter stats elo $elo]
      }
    }
  }
  if {$years} {
    append s "\n"
    foreach i $ylist {
      if {$stats($i)} {
        set year [string range $i 1 end]
        set stat "$since $year.01.01"
        append s "\n [pad $stat $len]"   [sc_filter stats year $year]
      }
    }
  }
  append s "\n-----------------------------------------------------------\n"
  if {$::optable::_data(fmt) == "html"} { append s "</pre>\n" }
  if {$::optable::_data(fmt) == "ctext"} { append s "</tt>" }
  return $s
}

proc ::optable::_reset {} {
  set ::optable::_data(sec) 0
  set ::optable::_data(subsec) 0
}

proc ::optable::_title {} {
  set fmt $::optable::_data(fmt)
  set title $::tr(OprepTitle)
  if {$fmt == "latex"} {
    return "\\begin{center}{\\LARGE \\bf $title}\\end{center}\n\n"
  } elseif {$fmt == "html"} {
    return "<h1><center>$title</center></h1>\n\n"
  } elseif {$fmt == "ctext"} {
    return "<h1><center>$title</center></h1>\n\n"
  }
  set r    "--------------------------------------------------------------"
  append r "\n                        [string toupper $title]\n"
  append r "--------------------------------------------------------------"
  append r "\n\n"
  return $r
}

proc ::optable::_sec {text} {
  set fmt $::optable::_data(fmt)
  incr ::optable::_data(sec)
  set ::optable::_data(subsec) 0
  if {$fmt == "latex"} {
    return "\n\n\\section{$text}\n"
  } elseif {$fmt == "html"} {
    return "\n<h2>$::optable::_data(sec). $text</h2>\n"
  } elseif {$fmt == "ctext"} {
    return "<h4>$::optable::_data(sec). $text</h4>"
  }
  set line "$::optable::_data(sec). [string toupper $text]"
  set underline "-----------------------------------------------------"
  return "\n\n$line\n[string range $underline 1 [string length $line]]\n"
}

proc ::optable::_subsec {text} {
  set fmt $::optable::_data(fmt)
  incr ::optable::_data(subsec)
  if {$fmt == "latex"} {
    return "\n\\subsection{$text}\n\n"
  } elseif {$fmt == "html"} {
    return "\n<h3>$::optable::_data(sec).$::optable::_data(subsec) $text</h3>\n\n"
  } elseif {$fmt == "ctext"} {
    return "\n<maroon><b>$::optable::_data(sec).$::optable::_data(subsec) $text</b></maroon>\n\n"
  }
  return "\n$::optable::_data(sec).$::optable::_data(subsec)  $text\n\n"
}

# report:
#   Produces a report in the appropriate format. If "withTable" is true,
#   the theory table is also included.
#
proc ::optable::report {fmt withTable {flipPos 0}} {
  global tr
  sc_optable format $fmt
  set fmt [string tolower $fmt]
  set ::optable::_data(fmt) $fmt
  ::optable::_reset

  # numRows: the number of rows to show in the theory table.
  # If it is zero, the number of rows if decided according to the
  # number of games in the report.
  set numRows 0

  # Specify whether a theory table is to be printed, so note numbers
  # can be generated and displayed if necessary:
  sc_optable notes $withTable $numRows

  set n "\n"; set p "\n\n"; set preText ""; set postText ""
  set percent "%"; set bullet "  * "
  if {$fmt == "latex"} {
    set n "\\\\\n"; set p "\n\n"
    #set preText "{\\samepage\\begin{verbatim}\n"
    #set postText "\\end{verbatim}\n}\n"
    set percent "\\%"; set bullet "\\hspace{0.5cm}\$\\bullet\$"
  } elseif {$fmt == "html"} {
    set n "<br>\n"; set p "<p>\n\n"
    set preText "<pre>\n"; set postText "</pre>\n"
  } elseif {$fmt == "ctext"} {
    set preText "<tt>"; set postText "</tt>"
  }

  # Generate the report:
  set games $tr(games)
  set moves $tr(moves)
  set counts [sc_optable count]
  set rgames [lindex $counts 0]
  set tgames [lindex $counts 1]

  set r {}
  append r $::optable::_docStart($fmt)
  append r [::optable::_title]
  append r "$tr(Database): [file tail [sc_base filename]] "
  append r "([thousands [sc_base numGames]] $games)$n"
  append r "$tr(OprepReport): [sc_optable line] ("
  if {$fmt == "ctext"} {
    append r "<darkblue><run sc_optable select all 0; updateStatsWin>"
  }
  append r "$rgames"
  if {$fmt == "ctext"} { append r "</run></darkblue>"; }
  append r " $games)$n"
  set eco [sc_optable eco]
  if {$eco != ""} {
    append r "ECO: [sc_optable eco]$n"
  }
  append r "$::tr(OprepGenerated) Scid [sc_info version], [::date::today]\n"
  if {$fmt == "latex"} {
    if {$flipPos} {
      append r $::optable::_data(bdLaTeX_flip)
    } else {
      append r $::optable::_data(bdLaTeX)
    }
    append r {$$\showboard$$}
  } elseif {$fmt == "html"} {
    if {$flipPos} {
      append r $::optable::_data(bdHTML_flip)
    } else {
      append r $::optable::_data(bdHTML)
    }
  } elseif {$fmt == "ctext"} {
    append r "\n<center><window .oprepWin.text.bd></center>\n"
  }
  if {$rgames == 0} {
    append r $::optable::_docEnd($fmt)
    return $r
  }

  if {$::optable(Stats) > 0  ||
      $::optable(Oldest) > 0  ||
      $::optable(Newest) > 0  ||
      $::optable(Popular) > 0  ||
      ($::optable(MostFrequent) > 0 &&
       ($::optable(MostFrequentWhite) || $::optable(MostFrequentBlack)))} {
    append r [::optable::_sec $tr(OprepStatsHist)]
  }
  if {$::optable(Stats)} {
    append r [::optable::_subsec $tr(OprepStats)]
    append r [::optable::stats]
  }
  if {$::optable(Oldest) > 0} {
    append r [::optable::_subsec $tr(OprepOldest)]
    append r [sc_optable best o $::optable(Oldest)]
  }
  if {$::optable(Newest) > 0} {
    append r [::optable::_subsec $tr(OprepNewest)]
    append r [sc_optable best n $::optable(Newest)]
  }

  if {$::optable(Popular) > 0} {
    append r [::optable::_subsec $tr(OprepPopular)]
    set next ""
    if {$fmt == "latex"} { set next " & " }

    # A table showing popularity by year ranges:
    if {$fmt == "latex"} {
      append r "\\begin{tabular}{lccccccc}\n\\hline\n"
    } else {
      append r $preText
    }
    set sYear $tr(Year)
    set sEvery [capital $tr(OprepEvery)]
    regsub "%u" $sEvery X sEvery
    set len [string length $sYear]
    if {[string length $sEvery] > $len} { set len [string length $sEvery] }
    append r [pad $tr(Year) $len]
    foreach range {1800-99 1900-49 1950-69 1970-79 1980-89 1990-99 2000-09} {
      append r $next
      append r [padC $range 8]
    }
    append r $n
    append r [pad $sEvery $len]
    foreach y {1800 1900 1950 1970 1980 1990 2000} {
      append r $next
      append r [padC $::optable::_data(range$y) 8]
    }
    append r $n
    if {$fmt == "latex"} {
      append r "\\hline\n\\end{tabular}\n"
    } else {
      append r $postText
    }

    append r "\n"

    # A table showing popularity in the last 1/5/10 years:
    if {$fmt == "latex"} {
      append r "\\begin{tabular}{lrr}\n"
    }
    foreach y {All 10 5 1} {
      if {$fmt == "ctext"} { append r "<tt>" }
      append r $tr(OprepFreq$y)
      if {$fmt == "ctext"} { append r "</tt>" }
      append r $next
      append r [format $tr(OprepEvery) $::optable::_data(ratio$y)]
      if {$y != "All"} {
        append r $next
        set d $::optable::_data(delta$y)
        if {$d > 0} {
          append r " ([format $tr(OprepUp) $d $percent])"
        } elseif {$d < 0} {
          append r " ([format $tr(OprepDown) [expr 0- $d] $percent])"
        } else {
        append r " ($tr(OprepSame))"
        }
      }
      append r "$n"
    }
    if {$fmt == "latex"} {
      append r "\\end{tabular}\n"
    }
  }

  if {$::optable(MostFrequent) > 0  &&  $::optable(MostFrequentWhite)} {
    append r [::optable::_subsec "$tr(OprepMostFrequent) ($tr(White))"]
    append r [sc_optable players white $::optable(MostFrequent)]
  }
  if {$::optable(MostFrequent) > 0  &&  $::optable(MostFrequentBlack)} {
    append r [::optable::_subsec "$tr(OprepMostFrequent) ($tr(Black))"]
    append r [sc_optable players black $::optable(MostFrequent)]
  }

  if {$::optable(AvgPerf)  ||  $::optable(HighRating)} {
    append r [::optable::_sec $tr(OprepRatingsPerf)]
  }
  if {$::optable(AvgPerf)} {
    append r [::optable::_subsec $tr(OprepAvgPerf)]
    set e [sc_optable elo white]
    set welo [lindex $e 0]; set wng [lindex $e 1]
    set bpct [lindex $e 2]; set bperf [lindex $e 3]
    set e [sc_optable elo black]
    set belo [lindex $e 0]; set bng [lindex $e 1]
    set wpct [lindex $e 2]; set wperf [lindex $e 3]
    append r "$tr(OprepWRating): $welo ($wng $games);  "
    append r "$tr(OprepWPerf): $wperf ($wpct$percent vs $belo)$n"
    append r "$tr(OprepBRating): $belo ($bng $games);  "
    append r "$tr(OprepBPerf): $bperf ($bpct$percent vs $welo)$n"
  }
  if {$::optable(HighRating) > 0} {
    append r [::optable::_subsec $tr(OprepHighRating)]
    append r [sc_optable best a $::optable(HighRating)]
  }

  if {$::optable(Results)  ||
      ($::optable(Shortest) > 0  &&
       ($::optable(ShortestBlack) || $::optable(ShortestBlack)))} {
    append r [::optable::_sec $tr(OprepTrends)]
  }

  if {$::optable(Results)} {
    append r [::optable::results]
  }
  if {$::optable(Shortest) > 0  &&  $::optable(ShortestWhite)} {
    append r [::optable::_subsec "$tr(OprepShortest) ($tr(White))"]
    append r [sc_optable best w $::optable(Shortest)]
  }
  if {$::optable(Shortest) > 0  &&  $::optable(ShortestBlack)} {
    append r [::optable::_subsec "$tr(OprepShortest) ($tr(Black))"]
    append r [sc_optable best b $::optable(Shortest)]
  }

  if {$::optable(MoveOrders) > 0  ||
      $::optable(MovesFrom) > 0  ||
      $::optable(Themes) > 0  ||
      $::optable(Endgames) > 0} {
    append r [::optable::_sec $tr(OprepMovesThemes)]
  }
  if {$::optable(MoveOrders) > 0} {
    append r [::optable::_subsec $tr(OprepMoveOrders)]
    set nOrders [sc_optable moveOrders 0]
    set maxOrders $::optable(MoveOrders)
    if {$nOrders == 1} {
      append r $tr(OprepMoveOrdersOne)
    } elseif {$nOrders <= $maxOrders} {
      append r [format $tr(OprepMoveOrdersAll) $nOrders]
    } else {
      append r [format $tr(OprepMoveOrdersMany) $nOrders $maxOrders]
    }
    append r $n
    append r [sc_optable moveOrders $maxOrders]
  }
  if {$::optable(MovesFrom)} {
    append r [::optable::_subsec $tr(OprepMovesFrom)]
    if {$fmt == "latex"} {
      append r $::optable::_data(latexTree)
    } else {
      append r $preText
      append r $::optable::_data(tree)
      append r $postText
    }
  }

  if {$::optable(Themes) > 0} {
    append r [::optable::_subsec $tr(OprepThemes)]
    append r [sc_optable themes $tr(OprepThemeDescription:) \
                $tr(OprepThemeSameCastling:) $tr(OprepThemeOppCastling:) \
                $tr(OprepThemeNoCastling:) $tr(OprepThemeKPawnStorm:) \
                $tr(OprepThemeQueenswap:) $tr(OprepThemeIQP:) \
                $tr(OprepThemeWP567:) $tr(OprepThemeBP234:) \
                $tr(OprepThemeOpenCDE:) $tr(OprepTheme1BishopPair:)]
  }

  if {$::optable(Endgames) > 0} {
    append r [::optable::_subsec $tr(OprepEndgames)]
    append r "$tr(OprepEndClass:)$n"
    append r [sc_optable endmat]
  }

  if {$withTable  &&  $::optable(MaxGames) > 0} {
    set sec [::optable::_sec $tr(OprepTheoryTable)]
    set comment ""
    if {$tgames > $::optable(MaxGames)} {
      set comment [format $tr(OprepTableComment) $::optable(MaxGames)]
    }
    append r [sc_optable print $numRows $sec $comment]
  }
  append r $::optable::_docEnd($fmt)

  # Eszet (ss) characters seem to be mishandled by LaTeX, even with
  # the font encoding package, so convert them explicitly:
  if {$fmt == "latex"} { regsub -all  $r {{\\ss}} r }

  return $r
}

# table:
#   Produces only the ECO table, not any other part of the report.
#
proc ::optable::table {fmt} {
  sc_optable format $fmt
  set ::optable::_data(fmt) $fmt
  set r {}
  append r $::optable::_docStart($fmt)
  append r [sc_optable print]
  append r $::optable::_docEnd($fmt)
  return $r
}

# end of optable.tcl
###
### analysis.tcl: part of Scid.
### Copyright (C) 1999-2002  Shane Hudson.
###

######################################################################
### Analysis window: uses a chess engine to analyze the board.

# analysis(logMax):
#   The maximum number of log message lines to be saved in a log file.
set analysis(logMax) 500

# analysis(log_stdout):
#   Set this to 1 if you want Scid-Engine communication log messages
#   to be echoed to stdout.
#
set analysis(log_stdout) 0


# resetEngine:
#   Resets all engine-specific data.
#
proc resetEngine {n} {
  global analysis
  set analysis(pipe$n) ""             ;# Communication pipe file channel
  set analysis(seen$n) 0              ;# Seen any output from engine yet?
  set analysis(seenEval$n) 0          ;# Seen evaluation line yet?
  set analysis(score$n) 0             ;# Current score in centipawns
  set analysis(nodes$n) 0             ;# Number of nodes searched
  set analysis(depth$n) 0             ;# Depth in ply
  set analysis(prev_depth$n) 0        ;# Previous depth
  set analysis(time$n) 0              ;# Time in centisec (or sec; see below)
  set analysis(moves$n) ""            ;# PV (best line) output from engine
  set analysis(movelist$n) {}         ;# Moves to reach current position
  set analysis(nonStdStart$n) 0       ;# Game has non-standard start
  set analysis(has_analyze$n) 0       ;# Engine has analyze command
  set analysis(has_setboard$n) 0      ;# Engine has setboard command
  set analysis(send_sigint$n) 0       ;# Engine wants INT signal
  set analysis(wants_usermove$n) 0    ;# Engine wants "usermove" before moves
  set analysis(isCrafty$n) 0          ;# Engine appears to be Crafty
  set analysis(wholeSeconds$n) 0      ;# Engine times in seconds not centisec
  set analysis(analyzeMode$n) 0       ;# Scid has started analyze mode
  set analysis(invertScore$n) 1       ;# Score is for side to move, not white
  set analysis(automove$n) 0
  set analysis(automoveThinking$n) 0
  set analysis(automoveTime$n) 4000
  set analysis(lastClicks$n) 0
  set analysis(after$n) ""
  set analysis(log$n) ""              ;# Log file channel
  set analysis(logCount$n) 0          ;# Number of lines sent to log file
  set analysis(wbEngineDetected$n) 0  ;# Is this a special Winboard engine?
}

resetEngine 1
resetEngine 2

set annotateMode 0
set annotateMoves all

# resetAnalysis:
#   Resets the analysis statistics: score, depth, etc.
#
proc resetAnalysis {{n 1}} {
  global analysis
  set analysis(score$n) 0
  set analysis(nodes$n) 0
  set analysis(prev_depth$n) 0
  set analysis(depth$n) 0
  set analysis(time$n) 0
  set analysis(moves$n) ""
}

namespace eval enginelist {}

set engines(list) {}

# engine:
#   Adds an engine to the engine list.
#   Calls to this function will be found in the user engines.lis
#   file, which is sourced below.
#
proc engine {arglist} {
  global engines
  array set newEngine {}
  foreach {attr value} $arglist {
    set newEngine($attr) $value
  }
  # Check that required attributes exist:
  if {! [info exists newEngine(Name)]} { return  0 }
  if {! [info exists newEngine(Cmd)]} { return  0 }
  if {! [info exists newEngine(Dir)]} { return  0 }
  # Fill in optional attributes:
  if {! [info exists newEngine(Args)]} { set newEngine(Args) "" }
  if {! [info exists newEngine(Elo)]} { set newEngine(Elo) 0 }
  if {! [info exists newEngine(Time)]} { set newEngine(Time) 0 }
  if {! [info exists newEngine(URL)]} { set newEngine(URL) "" }
  lappend engines(list) [list $newEngine(Name) $newEngine(Cmd) \
                           $newEngine(Args) $newEngine(Dir) \
                           $newEngine(Elo) $newEngine(Time) \
                           $newEngine(URL)]
  return 1
}

# ::enginelist::read
#   Reads the user Engine list file.
#
proc ::enginelist::read {} {
  catch {source $::engines(file)}
}

# ::enginelist::write:
#   Writes the user Engine list file.
#
proc ::enginelist::write {} {
  global engines
  # Try to rename old list to backup file and open new file:
  catch {file rename -force $engines(file) $engines(backup)}
  if {[catch {open $engines(file) w} f]} {
    catch {file rename $engines(backup) $engines(file)}
    return 0
  }

  puts $f "\# Analysis engines list file for Scid [sc_info version]"
  puts $f ""
  foreach e $engines(list) {
    set name [lindex $e 0]
    set cmd [lindex $e 1]
    set args [lindex $e 2]
    set dir [lindex $e 3]
    set elo [lindex $e 4]
    set time [lindex $e 5]
    set url [lindex $e 6]
    puts $f "engine {"
    puts $f "  Name [list $name]"
    puts $f "  Cmd  [list $cmd]"
    puts $f "  Args [list $args]"
    puts $f "  Dir  [list $dir]"
    puts $f "  Elo  [list $elo]"
    puts $f "  Time [list $time]"
    puts $f "  URL  [list $url]"
    puts $f "}"
    puts $f ""
  }
  close $f
  return 1
}

# Read the user Engine List file now:
#
catch { ::enginelist::read }
if {[llength $engines(list)] == 0} {
  # No engines, so set up a default engine list:
  set cmd crafty
  if {$::windowsOS} { set cmd wcrafty.exe }
  engine [list \
    Name Crafty \
    Cmd  $cmd \
    Dir  . \
    URL  ftp://ftp.cis.uab.edu/pub/hyatt/ \
  ]
}

# ::enginelist::date
#   Given a time in seconds since 1970, returns a
#   formatted date string.
proc ::enginelist::date {time} {
  return [clock format $time -format "%a %b %d %Y %H:%M"]
}

# ::enginelist::sort
#   Sort the engine list.
#   If the engine-open dialog is open, its list is updated.
#   The type defaults to the current engines(sort) value.
#
proc ::enginelist::sort {{type ""}} {
  global engines

  if {$type == ""} {
    set type $engines(sort)
  } else {
    set engines(sort) $type
  }
  switch $type {
    Name {
      set engines(list) [lsort -dictionary -index 0 $engines(list)]
    }
    Elo {
      set engines(list) [lsort -integer -decreasing -index 4 $engines(list)]
    }
    Time {
      set engines(list) [lsort -integer -decreasing -index 5 $engines(list)]
    }
  }

  # If the Engine-open dialog is open, update it:
  #
  set w .enginelist
  if {! [winfo exists $w]} { return }
  set f $w.list.list
  $f delete 0 end
  set count 0
  foreach engine $engines(list) {
    incr count
    set name [lindex $engine 0]
    set elo [lindex $engine 4]
    set time [lindex $engine 5]
    set date [::enginelist::date $time]
    set text [format "%2u. %-21s " $count $name]
    set eloText "    "
    if {$elo > 0} { set eloText [format "%4u" $elo] }
    append text $eloText
    set timeText "  "
    if {$time > 0} { set timeText "   $date" }
    append text $timeText
    $f insert end $text
  }
  $f selection set 0

  # Show the sorted column heading in red text:
  $w.title configure -state normal
  foreach i {Name Elo Time} {
    $w.title tag configure $i -foreground {}
  }
  $w.title tag configure $engines(sort) -foreground red
  $w.title configure -state disabled
}

# ::enginelist::choose
#   Select an engine from the Engine List.
#   Returns an integer index into the engines(list) list variable.
#   If no engine is selected, returns the empty string.
#
proc ::enginelist::choose {} {
  global engines
  set w .enginelist
  toplevel $w
  wm title $w "Scid: [tr ToolsAnalysis]"
   label $w.flabel -text $::tr(EngineList:) -font font_Bold
  pack $w.flabel -side top

  pack [frame $w.buttons] -side bottom -pady 6 -fill x
  frame $w.rule -height 2 -borderwidth 2 -relief sunken -background white
  pack $w.rule -side bottom -fill x -pady 5

  # Set up title frame for sorting the list:
  text $w.title -width 55 -height 1 -font font_Fixed -relief flat \
    -cursor top_left_arrow
  $w.title insert end "    "
  $w.title insert end $::tr(EngineName) Name
  for {set i [string length $::tr(EngineName)]} {$i < 21} { incr i } {
    $w.title insert end " "
  }
  $w.title insert end "  "
  $w.title insert end $::tr(EngineElo) Elo
  for {set i [string length $::tr(EngineElo)]} {$i < 4} { incr i } {
    $w.title insert end " "
  }
  $w.title insert end "  "
  $w.title insert end $::tr(EngineTime) Time
  foreach i {Name Elo Time} {
    $w.title tag bind $i <Any-Enter> \
      "$w.title tag configure $i -background yellow"
    $w.title tag bind $i <Any-Leave> \
      "$w.title tag configure $i -background {}"
    $w.title tag bind $i <1> [list ::enginelist::sort $i]
  }
  $w.title configure -state disabled
  pack $w.title -side top -fill x

  # The list of choices:
  set f $w.list
  pack [frame $f] -side top -expand yes -fill both
  listbox $f.list -height 10 -width 55  -selectmode browse \
    -selectbackground lightBlue -background white -setgrid 1 \
    -yscrollcommand "$f.ybar set" -font font_Fixed -exportselection 0
  bind $f.list <Double-ButtonRelease-1> "$w.buttons.ok invoke; break"
  scrollbar $f.ybar -command "$f.list yview"
  pack $f.ybar -side right -fill y
  pack $f.list -side top -fill both -expand yes
  $f.list selection set 0

  set f $w.buttons
  button $f.add -text $::tr(EngineNew...) -command {::enginelist::edit -1}
  button $f.edit -text $::tr(EngineEdit...) -command {
    ::enginelist::edit [lindex [.enginelist.list.list curselection] 0]
  }
  button $f.delete -text $::tr(Delete...) -command {
    ::enginelist::delete [lindex [.enginelist.list.list curselection] 0]
  }
  label $f.sep -text "   "
  button $f.ok -text "OK" -command {
    set engines(selection) [lindex [.enginelist.list.list curselection] 0]
    destroy .enginelist
  }
  button $f.cancel -text $::tr(Cancel) -command {
    set engines(selection) ""
    destroy .enginelist
  }
  pack $f.cancel $f.ok -side right -padx 1
  pack $f.add $f.edit $f.delete -side left -padx 1

  ::enginelist::sort
  centreWin $w
  focus $w.list.list
  wm protocol $w WM_DELETE_WINDOW "destroy $w"
  bind $w <F1> { helpWindow Analysis List }
  bind $w <Escape> "destroy $w"
  bind $w.list.list <Return> "$w.buttons.ok invoke; break"
  set engines(selection) ""
  grab $w
  tkwait window $w
  return $engines(selection)
}

# ::enginelist::setTime
#   Sets the last-opened time of the engine specified by its
#   index in the engines(list) list variable.
#   The time should be in standard format (seconds since 1970)
#   and defaults to the current time.
#
proc ::enginelist::setTime {index {time -1}} {
  global engines
  set e [lindex $engines(list) $index]
  if {$time < 0} { set time [clock seconds] }
  set e [lreplace $e 5 5 $time]
  set engines(list) [lreplace $engines(list) $index $index $e]
}

trace variable engines(newElo) w {forceInt 4000 0}

# ::enginelist::delete
#   Removes an engine from the list.
#
proc ::enginelist::delete {index} {
  global engines
  if {$index == ""  ||  $index < 0} { return }
  set e [lindex $engines(list) $index]
  set msg "Name: [lindex $e 0]\n"
  append msg "Command: [lindex $e 1]\n\n"
  append msg "Do you really want to remove this engine from the list?"
  set answer [tk_messageBox -title Scid -icon question -type yesno \
                -message $msg]
  if {$answer == "yes"} {
    set engines(list) [lreplace $engines(list) $index $index]
    ::enginelist::sort
    ::enginelist::write
  }
}

# ::enginelist::edit
#   Opens a dialog for editing an existing engine list entry (if
#   index >= 0), or adding a new entry (if index is -1).
#
proc ::enginelist::edit {index} {
  global engines
  if {$index == ""} { return }

  if {$index >= 0  ||  $index >= [llength $engines(list)]} {
    set e [lindex $engines(list) $index]
  } else {
    set e [list "" "" "" . 0 0 ""]
  }

  set engines(newIndex) $index
  set engines(newName) [lindex $e 0]
  set engines(newCmd) [lindex $e 1]
  set engines(newArgs) [lindex $e 2]
  set engines(newDir) [lindex $e 3]
  set engines(newElo) [lindex $e 4]
  set engines(newTime) [lindex $e 5]
  set engines(newURL) [lindex $e 6]
  set engines(newDate) $::tr(None)
  if {$engines(newTime) > 0 } {
    set engines(newDate) [::enginelist::date $engines(newTime)]
  }

  set w .engineEdit
  toplevel $w
  wm title $w Scid

  set f [frame $w.f]
  pack $f -side top -fill x -expand yes
  set row 0
  foreach i {Name Cmd Args Dir URL} {
    label $f.l$i -text $i
    if {[info exists ::tr(Engine$i)]} {
      $f.l$i configure -text $::tr(Engine$i)
    }
    entry $f.e$i -textvariable engines(new$i) -width 40
    bindFocusColors $f.e$i
    grid $f.l$i -row $row -column 0 -sticky w
    grid $f.e$i -row $row -column 1 -sticky we

    # Browse button for choosing an executable file:
    if {$i == "Cmd"} {
      button $f.b$i -text "..." -command {
        if {$::windowsOS} {
          set scid_temp(filetype) {
            {"Applications" {".bat" ".exe"} }
            {"All files" {"*"} }
          }
        } else {
          set scid_temp(filetype) {
            {"All files" {"*"} }
          }
        }
        set scid_temp(cmd) [tk_getOpenFile -initialdir $engines(newDir) \
                              -title "Scid: [tr ToolsAnalysis]" \
                    -filetypes $scid_temp(filetype)]
        if {$scid_temp(cmd) != ""} {
          set engines(newCmd) $scid_temp(cmd)
          if {[string first " " $scid_temp(cmd)] >= 0} {
            # The command contains spaces, so put it in quotes:
            set engines(newCmd) "\"$scid_temp(cmd)\""
          }
          # Set the directory from the executable path if possible:
          set engines(newDir) [file dirname $scid_temp(cmd)]
          if {$engines(newDir) == ""} [ set engines(newDir) .]
        }
      }
      grid $f.b$i -row $row -column 2 -sticky we
    }

    if {$i == "Dir"} {
      button $f.current -text " . " -command {
         set engines(newDir) .
      }
      button $f.user -text "~/.scid" -command {
        set engines(newDir) $scidUserDir
      }
      if {$::windowsOS} {
        $f.user configure -text "scid.exe dir"
      }
      grid $f.current -row $row -column 2 -sticky we
      grid $f.user -row $row -column 3 -sticky we
    }

    if {$i == "URL"} {
      button $f.bURL -text [tr FileOpen] -command {
        if {$engines(newURL) != ""} { openURL $engines(newURL) }
      }
      grid $f.bURL -row $row -column 2 -sticky we
    }

    incr row
  }

  grid columnconfigure $f 1 -weight 1

  # Mark required fields:
  $f.lName configure -font font_Bold
  $f.lCmd configure -font font_Bold
  $f.lDir configure -font font_Bold

  label $f.lElo -text $::tr(EngineElo)
  entry $f.eElo -textvariable engines(newElo) -justify right -width 5
  bindFocusColors $f.eElo
  grid $f.lElo -row $row -column 0 -sticky w
  grid $f.eElo -row $row -column 1 -sticky w
  incr row

  label $f.lTime -text $::tr(EngineTime)
  label $f.eTime -textvariable engines(newDate) -anchor w -width 1
  grid $f.lTime -row $row -column 0 -sticky w
  grid $f.eTime -row $row -column 1 -sticky we
  button $f.clearTime -text $::tr(Clear) -command {
    set engines(newTime) 0
    set engines(newDate) $::tr(None)
  }
  button $f.nowTime -text $::tr(Update) -command {
    set engines(newTime) [clock seconds]
    set engines(newDate) [::enginelist::date $engines(newTime)]
  }
  grid $f.clearTime -row $row -column 2 -sticky we
  grid $f.nowTime -row $row -column 3 -sticky we

  addHorizontalRule $w
  set f [frame $w.buttons]
  button $f.ok -text OK -command {
    if {[string trim $engines(newName)] == ""  ||
        [string trim $engines(newCmd)] == ""  ||
        [string trim $engines(newDir)] == ""} {
      tk_messageBox -title Scid -icon info \
        -message "The Name, Command and Directory fields must not be empty."
    } else {
      set newEntry [list $engines(newName) $engines(newCmd) \
                      $engines(newArgs) $engines(newDir) \
                      $engines(newElo) $engines(newTime) \
                      $engines(newURL)]
      if {$engines(newIndex) < 0} {
        lappend engines(list) $newEntry
      } else {
        set engines(list) [lreplace $engines(list) \
                             $engines(newIndex) $engines(newIndex) $newEntry]
      }
      destroy .engineEdit
      ::enginelist::sort
      ::enginelist::write
    }
  }
  button $f.cancel -text $::tr(Cancel) -command "destroy $w"
  pack $f -side bottom -fill x
  pack $f.cancel $f.ok -side right -padx 2 -pady 2
  label $f.required -font font_Small -text $::tr(EngineRequired)
  pack $f.required -side left
  
  bind $w <Return> "$f.ok invoke"
  bind $w <Escape> "destroy $w"
  bind $w <F1> { helpWindow Analysis List }
  focus $w.f.eName
  wm resizable $w 1 0
  grab $w
}

proc addAnalysisVariation {{n 1}} {
  global analysis annotateMoves annotateMode
  if {! [winfo exists .analysisWin$n]} { return }
  # Cannot add a variation to an empty variation:
  if {[sc_pos isAt vstart]  &&  [sc_pos isAt vend]} { return }
  # Cannot (yet) add a variation at the end of the game or a variation:
  if {[sc_pos isAt vend]} { return }

  set tomove [sc_pos side]
  if {$annotateMode} {
    if {$annotateMoves == "white"  &&  $tomove == "black"} { return }
    if {$annotateMoves == "black"  &&  $tomove == "white"} { return }
  }
  set text [format "%d:%+.2f" $analysis(depth$n) $analysis(score$n)]
  set moves $analysis(moves$n)
  # Temporarily clear the pre-move command since we want to add a
  # whole line without Scid updating stuff:
  sc_info preMoveCmd {}
  # Add the variation:
  sc_var create
  # Add the comment at the start of the variation:
  sc_pos setComment $text
  # Add as many moves as possible from the engine analysis:
  catch {sc_move addSan $moves}
  sc_var exit
  # Remove the variation if necessary:
  if {$annotateMode  &&  $annotateMoves == "notbest"} {
    set lastvar [expr [sc_var count] - 1]
    set firstMove [lindex [sc_var list] $lastvar]
    if {$firstMove == [sc_game info next]} {
      sc_var delete $lastvar
    }
  }
  # Restore the pre-move command:
  sc_info preMoveCmd preMoveCommand
  updateBoardAndPgn
}

proc addAnalysisToComment {line {n 1}} {
  global analysis
  if {! [winfo exists .analysisWin$n]} { return }

  # If comment editor window is open, add the score there, otherwise
  # just add the comment directly:
  if {[winfo exists .commentWin]} {
    set tempStr [.commentWin.cf.text get 1.0 "end-1c"]
  } else {
    set tempStr [sc_pos getComment]
  }
  set score $analysis(score$n)
  if {$analysis(invertScore$n)  && (! [string compare [sc_pos side] "black"])} {
    set score [expr 0.0 - $score]
  }

  # If line is true, add the whole line, else just add the score:
  if {$line} {
    set scoretext [format "%+.2f: %s" $score $analysis(moves$n)]
  } else {
    set scoretext [format "%+.2f" $score]
  }

  # Strip out old score if it exists at the start of the comment:
  regsub {^\".*\"} $tempStr "" tempStr
  set newText "\"$scoretext\"$tempStr"
  if {[winfo exists .commentWin]} {
    .commentWin.cf.text delete 1.0 end
    .commentWin.cf.text insert 1.0 $newText
  } else {
    sc_pos setComment $newText
  }
  updatePgnWin 1
}

proc makeAnalysisMove {{n 1}} {
  set s $::analysis(moves$n)
  while {1} {
    if {[string length $s] == 0} { return 0 }
    set c [string index $s 0]
    switch -- $c {
      a - b - c - d - e - f - g - h -
      K - Q - R - B - N - O {
        break
      }
    }
    set s [string range $s 1 end]
  }
  if {[scan $s "%s" move] != 1} { return 0 }
  set action "replace"
  if {! [sc_pos isAt vend]} {
      set action [confirmReplaceMove]
  }
  if {$action == "cancel"} { return }
  set ::analysis(automoveThinking$n) 0
  if {$action == "var"} { sc_var create }
  if {[catch {sc_move addSan $move}]} { return 0 }
  updateBoardAndPgn .board
  return 1
}

# destroyAnalysisWin:
#   Closes an engine, because its analysis window is being destroyed.
#
proc destroyAnalysisWin {{n 1}} {
  global windowsOS analysis

  # Check the pipe is not already closed:
  if {$analysis(pipe$n) == ""} {
    set ::analysisWin$n 0
    return
  }

  # Send interrupt signal if the engine wants it:
  if {(!$windowsOS)  &&  $analysis(send_sigint$n)} {
    catch {exec -- kill -s INT [pid $analysis(pipe$n)]}
  }

  # Some engines in analyze mode may not react as expected to "quit"
  # so ensure the engine exits analyze mode first:
  sendToEngine $n "exit"
  sendToEngine $n "quit"
  flush $analysis(pipe$n)

  # Uncomment following line to turn on blocking mode before
  # closing the engine (but probably not a good idea!)
  #   fconfigure $analysis(pipe$n) -blocking 1

  # Close the engine, ignoring any errors since nothing can really
  # be done about them anyway -- maybe should alert the user with
  # a message box?
  catch {close $analysis(pipe$n)}

  if {$analysis(log$n) != ""} {
    catch {close $analysis(log$n)}
    set analysis(log$n) ""
  }
  set analysis(pipe$n) ""
  set ::analysisWin$n 0
}

# sendToEngine:
#   Send a command to a running analysis engine.
#
proc sendToEngine {n text} {
  logEngine $n "Scid  : $text"
  catch {puts $::analysis(pipe$n) $text}
}

# sendMoveToEngine:
#   Sends a move to a running analysis engine, using sendToEngine.
#   If the engine has indicated (with "usermove=1" on a "feature" line)
#   that it wants it, send with "usermove " before the move.
#
proc sendMoveToEngine {n move} {
  # Convert "e7e8Q" into "e7e8q" since that is the XBoard/WinBoard
  # standard for sending moves in coordinate notation:
  set move [string tolower $move]
  if {$::analysis(wants_usermove$n)} {
    sendToEngine $n "usermove $move"
  } else {
    sendToEngine $n $move
  }
}

# logEngine:
#   Log Scid-Engine communication.
#
proc logEngine {n text} {
  global analysis

  # Print the log message to stdout if applicable:
  if {$::analysis(log_stdout)} {
    puts stdout $text
  }

  if {$::analysis(log$n) != ""} {
    puts $::analysis(log$n) $text

    # Close the log file if the limit is reached:
    incr analysis(logCount$n)
    if {$analysis(logCount$n) >= $analysis(logMax)} {
        puts $::analysis(log$n) \
          "NOTE  : Log file size limit reached; closing log file."
        catch {close $analysis(log$n)}
        set analysis(log$n) ""
    }
  }
}

# logEngineNote:
#   Add a note to the engine comminucation log file.
#
proc logEngineNote {n text} {
  logEngine $n "NOTE  : $text"
}


# makeAnalysisWin:
#   Produces the engine list dialog box for choosing an engine,
#   then opens an analysis window and starts the engine.
#
proc makeAnalysisWin {{n 1}} {
  global analysisWin$n font_Analysis analysisCommand analysis
  set w ".analysisWin$n"
  if {[winfo exists $w]} {
    focus .
    destroy $w
    set analysisWin$n 0
    resetEngine $n
    return
  }

  resetEngine $n
  set index [::enginelist::choose]
  if {$index == ""  ||  $index < 0} {
    set analysisWin$n 0
    return
  }
  ::enginelist::setTime $index
  catch {::enginelist::write}
  set engineData [lindex $::engines(list) $index]
  set analysisName [lindex $engineData 0]
  set analysisCommand [lindex $engineData 1]
  set analysisArgs [lindex $engineData 2]
  set analysisDir [lindex $engineData 3]
  if {$analysisArgs != ""} {
    append analysisCommand " $analysisArgs"
  }

  # If the analysis directory is not current dir, cd to it:
  set oldpwd ""
  if {$analysisDir != "."} {
    set oldpwd [pwd]
    catch {cd $analysisDir}
  }

  # Try to execute the analysis program:
  if {[catch {set analysis(pipe$n) [open "| $analysisCommand" "r+"]} result]} {
    if {$oldpwd != ""} { catch {cd $oldpwd} }
    tk_messageBox -title "Scid: error starting analysis" \
      -icon warning -type ok \
      -message "Unable to start the program:\n$analysisCommand"
    set analysisWin$n 0
    resetEngine $n
    return
  }

  set analysisWin$n 1

  # Return to original dir if necessary:
  if {$oldpwd != ""} { catch {cd $oldpwd} }

  # Open log file if applicable:
  set analysis(log$n) ""
  if {$analysis(logMax) > 0} {
    if {! [catch {open [file join $::scidUserDir "engine$n.log"] w} log]} {
      set analysis(log$n) $log
      logEngine $n "Scid-Engine communication log file"
      logEngine $n "Engine: $analysisName"
      logEngine $n "Command: $analysisCommand"
      logEngine $n "Date: [clock format [clock seconds]]"
      logEngine $n ""
      logEngine $n "This file was automatically generated by Scid."
      logEngine $n "It is rewritten every time an engine is started in Scid."
      logEngine $n ""
    }
  }

  # Configure pipe for line buffering and non-blocking mode:
  fconfigure $analysis(pipe$n) -buffering line -blocking 0

  #
  # Set up the  analysis window:
  #
  toplevel $w
  if {$n == 1} {
    wm title $w "Scid: Analysis: $analysisName"
  } else {
    wm title $w "Scid: Analysis $n: $analysisName"
  }
  bind $w <F1> { helpWindow Analysis }

  frame $w.b1
  frame $w.b2
  pack $w.b2 -side bottom -fill x
  pack $w.b1 -side bottom -fill x
  checkbutton $w.b1.automove -textvar ::tr(Training) \
    -relief raised -pady 5 -padx 4 \
    -command "toggleAutomove $n" -variable analysis(automove$n)
  button $w.b1.line -textvar ::tr(AddVariation) \
    -command "addAnalysisVariation $n"
  button $w.b1.move -textvar ::tr(AddMove) \
    -command "makeAnalysisMove $n"
  if {$n == 1} {
    checkbutton $w.b2.annotate -textvar ::tr(Annotate...) \
      -variable annotateMode -relief raised -pady 5 -padx 4 \
      -command {toggleAutoplay 1}
  }
  button $w.b2.update -textvar ::tr(Update) \
    -command "sendToEngine $n ."
  button $w.b2.help -textvar ::tr(Help) -command { helpWindow Analysis }
  button $w.b2.close -textvar ::tr(Close) -command "focus .; destroy $w"

  pack $w.b1.automove $w.b1.line $w.b1.move -side left -padx 2 -pady 2
  pack $w.b2.close $w.b2.help $w.b2.update -side right -padx 2 -pady 2
  if {$n == 1} {
    pack $w.b2.annotate -side left -padx 2 -pady 2
  }

  text $w.text -width 50 -height 5 -fg black -bg white -font font_Fixed \
    -wrap word
  frame $w.hist
  text $w.hist.text -width 50 -height 4 -fg black -bg white -font font_Fixed \
    -wrap word -setgrid 1 -yscrollcommand "$w.hist.ybar set"
  $w.hist.text tag configure indent -lmargin2 \
    [font measure font_Fixed "xxxxxxxxxx"]
  scrollbar $w.hist.ybar -command "$w.hist.text yview" -takefocus 0
  pack $w.text -side top -fill both
  pack $w.hist -side top -expand 1 -fill both
  pack $w.hist.ybar -side right -fill y
  pack $w.hist.text -side left -expand 1 -fill both
  $w.text tag bind score <ButtonPress-1> "
    set analysis(invertScore$n) \[expr 1 - \$analysis(invertScore$n)\]
    updateAnalysisText $n
  "
  $w.text tag configure blue -foreground blue
  $w.text insert end "With some engines, you will not see any analysis \
until the board changes. So if you see this message, try changing the board \
by moving backwards or forwards or making a new move."
  $w.text configure -state disabled
  bind $w <Destroy> "destroyAnalysisWin $n"
  wm minsize $w 45 0

  fileevent $analysis(pipe$n) readable "processAnalysisInput $n"

  after 1000 "checkAnalysisStarted $n"
}

# checkAnalysisStarted
#   Called a short time after an analysis engine was started
#   to send it commands if Scid has not seen any output from
#   it yet.
#
proc checkAnalysisStarted {n} {
  global analysis
  if {$analysis(seen$n)} { return }

  # Some Winboard engines do not issue any output when
  # they start up, so the fileevent above is never triggered.
  # Most, but not all, of these engines will respond in some
  # way once they have received input of some type.  This
  # proc will issue the same initialization commands as
  # those in processAnalysisInput below, but without the need
  # for a triggering fileevent to occur.

  logEngineNote $n {Quiet engine (still no output); sending it initial commands.}
  set analysis(seen$n) 1
  sendToEngine $n "xboard"
  sendToEngine $n "protover 2"
  sendToEngine $n "post"
  # Prevent some engines from making an immediate "book"
  # reply move as black when position is sent later:
  sendToEngine $n "force"
}

# processAnalysisInput
#   Called from a fileevent whenever there is a line of input
#   from an analysis engine waiting to be processed.
#
proc processAnalysisInput {{n 1}} {
  global analysis

  # Get one line from the engine:
  set line [gets $analysis(pipe$n)]
  logEngine $n "Engine: $line"

  # Check that the engine did not terminate unexpectedly:
  if {[eof $analysis(pipe$n)]} {
    fileevent $analysis(pipe$n) readable {}
    catch {close $analysis(pipe$n)}
    set analysis(pipe$n) ""
    logEngineNote $n {Engine terminated without warning.}
    catch {destroy .analysisWin$n}
    tk_messageBox -type ok -icon info -parent . -title "Scid" \
      -message "The analysis engine terminated without warning; it probably crashed or had an internal error."
  }

  if {! $analysis(seen$n)} {
    # First line of output from the program, so send initial commands:
    logEngineNote $n {First line from engine seen; sending it initial commands now.}
    set analysis(seen$n) 1
    sendToEngine $n "xboard"
    sendToEngine $n "protover 2"
    sendToEngine $n "post"
  }

  # Check for "feature" commands so we can determine if the engine
  # has the setboard and analyze commands:
  #
  if {! [string compare [string range $line 0 6] "feature"]} {
    if {[regexp "analyze=1" $line]} { set analysis(has_analyze$n) 1 }
    if {[regexp "setboard=1" $line]} { set analysis(has_setboard$n) 1 }
    if {[regexp "usermove=1" $line]} { set analysis(wants_usermove$n) 1 }
    if {[regexp "sigint=1" $line]} { set analysis(send_sigint$n) 1 }
    if {[regexp "myname=\"(\[^\"\]*)\"" $line dummy name]} {
      if {$n == 1} {
        catch {wm title .analysisWin$n "Scid: Analysis: $name"}
      } else {
        catch {wm title .analysisWin$n "Scid: Analysis $n: $name"}
      }
    }
    if {$analysis(has_analyze$n)} { startAnalyzeMode $n }
    return
  }

  # Check for a line starting with "Crafty", so Scid can work well
  # with older Crafty versions that do not recognize "protover":
  #
  if {[regexp "^Crafty" $line]} {
    logEngineNote $n {Seen "Crafty"; assuming analyze and setboard commands.}
    set major 0
    if {[scan $line "Crafty v%d.%d" major minor] == 2  &&  $major >= 18} {
      logEngineNote $n {Crafty version is >= 18.0; assuming scores are from White perspective.}
      set analysis(invertScore$n) 0
    }
    # Turn off crafty logging, to reduce number of junk files:
    sendToEngine $n "log off"
    # Set a fairly low noise value so Crafty is responsive to board changes,
    # but not so low that we get lots of short-ply search data:
    sendToEngine $n "noise 1000"
    set analysis(isCrafty$n) 1
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    startAnalyzeMode $n
    return
  }

  # Scan the line from the engine for the analysis data:
  #
  set res [scan $line "%d%c %d %d %d %\[^\n\]\n" \
             temp_depth dummy temp_score \
             temp_time temp_nodes temp_moves]
  if {$res == 6} {
    set analysis(depth$n) $temp_depth
    set analysis(score$n) $temp_score
    set analysis(time$n) $temp_time
    set analysis(nodes$n) $temp_nodes
    set analysis(moves$n) [formatAnalysisMoves $temp_moves]
    # Convert score to pawns from centipawns:
    set analysis(score$n) [expr double($analysis(score$n)) / 100.0]
    # Convert time to seconds from centiseconds:
    if {! $analysis(wholeSeconds$n)} {
      set analysis(time$n) [expr double($analysis(time$n)) / 100.0]
    }
    updateAnalysisText $n
    if {! $analysis(seenEval$n)} {
      # This is the first evaluation line seen, so send the current
      # position details to the engine:
      set analysis(seenEval$n) 1
      updateAnalysis $n
    }
    return
  }

  # Check for a "stat01:" line, the reply to the "." command:
  #
  if {! [string compare [string range $line 0 6] "stat01:"]} {
    if {[scan $line "%s %d %d %d" \
           dummy temp_time temp_nodes temp_depth] == 4} {
      set analysis(depth$n) $temp_depth
      set analysis(time$n) $temp_time
      set analysis(nodes$n) $temp_nodes
      # Convert time to seconds from centiseconds:
      if {! $analysis(wholeSeconds$n)} {
        set analysis(time$n) [expr double($analysis(time$n)) / 100.0]
      }
      updateAnalysisText $n
    }
    return
  }

  # Check for other engine-specific lines:
  # The following checks are intended to make Scid work with
  # various WinBoard engines that are not properly configured
  # by the "feature" line checking code above.
  #
  # Many thanks to Allen Lake for testing Scid with many
  # WinBoard engines and providing this code and the detection
  # code in wbdetect.tcl

  if { !$analysis(wbEngineDetected$n) } { detectWBEngine $n $line }
  if { $analysis(has_analyze$n) } { startAnalyzeMode $n }

}

# formatAnalysisMoves:
#   Given the text at the end of a line of analysis data from an engine,
#   this proc tries to strip out some extra stuff engines add to make
#   the text more compatible for adding as a variation.
#
proc formatAnalysisMoves {text} {
  # Yace puts ".", "t", "t-" or "t+" at the start of its moves text,
  # unless directed not to in its .ini file. Get rid of it:
  if {[strIsPrefix ". " $text]} { set text [string range $text 2 end]}
  if {[strIsPrefix "t " $text]} { set text [string range $text 2 end]}
  if {[strIsPrefix "t- " $text]} { set text [string range $text 3 end]}
  if {[strIsPrefix "t+ " $text]} { set text [string range $text 3 end]}

  # Trim any initial or final whitespace:
  set text [string trim $text]

  # Yace often adds "H" after a move, e.g. "Bc4H". Remove them:
  regsub -all "H " $text " " text

  # Crafty adds "<HT>" for a hash table comment. Change it to "{HT}":
  regsub "<HT>" $text "{HT}" text

  return $text
}

# startAnalyzeMode:
#   Put the engine in analyze mode for the first time.
#
proc startAnalyzeMode {{n 1}} {
  global analysis
  # Check that the engine has not already had analyze mode started:
  if {$analysis(analyzeMode$n)} { return }
  set analysis(analyzeMode$n) 1
  set analysis(has_analyze$n) 1
  sendToEngine $n "analyze"
}

# updateAnalysisText
#   Update the text in an analysis window.
#
proc updateAnalysisText {{n 1}} {
  global analysis
  set nps 0
  if {$analysis(time$n) > 0.0} {
    set nps [expr round($analysis(nodes$n) / $analysis(time$n))]
  }
  set newStr [format "Depth:   %6u      Nodes: %8u (%u n/s)\n" \
                $analysis(depth$n) $analysis(nodes$n) $nps]
  set score $analysis(score$n)
  if {$analysis(invertScore$n)  && (![string compare [sc_pos side] "black"])} {
    set score [expr 0.0 - $score]
  }
  append newStr [format "Score: %+8.2f      Time: %9.2f seconds\n" \
                   $score $analysis(time$n)]
  set t .analysisWin$n.text
  $t configure -state normal
  $t delete 0.0 end
  $t insert 1.0 $newStr
  if {$analysis(automove$n)} {
    if {$analysis(automoveThinking$n)} {
      set moves "   Thinking..... "
    } else {
      set moves "   Your move..... "
    }
  } else {
    set moves $analysis(moves$n)
  }

  if {! $analysis(automove$n)} {
    set h .analysisWin$n.hist.text
    $h configure -state normal
    set cleared 0
    if {$analysis(depth$n) < $analysis(prev_depth$n)  || \
        $analysis(prev_depth$n) == 0} {
      $h delete 1.0 end
      set cleared 1
    }
    if {! $cleared} { $h insert end "\n" }
    $h insert end [format "%2d %+5.2f  %s (%.2f)" $analysis(depth$n) \
                     $score $moves $analysis(time$n)] indent
    $h see end-1c
    $h configure -state disabled
    set analysis(prev_depth$n) $analysis(depth$n)
  }
  $t insert end $moves blue
  $t tag add score 2.0 2.13
  $t configure -state disabled
}

# updateAnalysis
#   Update an analysis window by sending the current board
#   to the engine.
#
proc updateAnalysis {{n 1}} {
  global analysisWin analysis windowsOS
  if {$analysis(pipe$n) == ""} { return }
  # Just return if no output has been seen from the analysis program yet:
  if {! $analysis(seen$n)} { return }

  # If too close to the previous update, and no other future update is
  # pending, reschedule this update to occur in another 0.3 seconds:
  #
  if {[catch {set clicks [clock clicks -milliseconds]}]} {
    set clicks [clock clicks]
  }
  set diff [expr $clicks - $analysis(lastClicks$n)]
  if {$diff < 300  &&  $diff >= 0} {
    if {$analysis(after$n) == ""} {
      set analysis(after$n) [after 300 updateAnalysis $n]
    }
    return
  }
  set analysis(lastClicks$n) $clicks
  set analysis(after$n) ""
  after cancel updateAnalysis $n

  set old_movelist $analysis(movelist$n)
  set movelist [sc_game moves coord list]
  set analysis(movelist$n) $movelist
  set nonStdStart [sc_game startBoard]
  set old_nonStdStart $analysis(nonStdStart$n)
  set analysis(nonStdStart$n) $nonStdStart

  if {$analysis(has_analyze$n)} {

    #
    # This section is for engines that support "analyze":
    #

    sendToEngine $n "exit"   ;# Get out of analyze mode, to send moves.

    # On Crafty, "force" command has different meaning when not in
    # XBoard mode, and some users have noticed Crafty not being in
    # that mode at this point -- although I cannot reproduce this.
    # So just re-send "xboard" to Crafty to make sure:
    if {$analysis(isCrafty$n)} { sendToEngine $n "xboard" }

    sendToEngine $n "force"  ;# Stop engine replying to moves.

    # Check if the setboard command must be used -- that is, if the
    # previous or current position arose from a non-standard start.

    if {$analysis(has_setboard$n)  &&  ($old_nonStdStart  || $nonStdStart)} {
      sendToEngine $n "setboard [sc_pos fen]"
      # Most engines with setboard do not recognize the crafty "mn"
      # command (it is not in the XBoard/WinBoard protocol), so
      # only send it to crafty:
      if {$analysis(isCrafty$n)} {
        sendToEngine $n "mn [sc_pos moveNumber]"
      }
      sendToEngine $n "analyze"
      return
    }

    # If we need a non-standard start and the engine does not have
    # setboard, the user is out of luck:
    if {$nonStdStart} {
      set analysis(moves$n) "  Sorry, this game has a non-standard start position."
      updateAnalysisText $n
      return
    }

    # Here, the engine has the analyze command but this game does
    # not have a non-standard start position.

    set oldlen [llength $old_movelist]
    set newlen [llength $movelist]

    # Check for optimization to minimize the commands to be sent:
    # Scid sends "undo" to backup wherever possible, and avoid "new" as
    # on many engines this would clear hash tables, causing poor
    # hash table performance.

    # Send just the new move if possible (if the new move list is exactly
    # the same as the previous move list, with one extra move):

    if {($newlen == $oldlen + 1) \
          && ($old_movelist == [lrange $movelist 0 [expr $oldlen - 1]])} {
      sendMoveToEngine $n [lindex $movelist $oldlen]

    } elseif {($newlen + 1 == $oldlen) && \
                ($movelist == [lrange $old_movelist 0 [expr $newlen - 1]])} {

      # Here the new move list is the same as the old list but with one
      # less move, just send one "undo":

      sendToEngine $n "undo"

    } elseif {$newlen == $oldlen  &&  $old_movelist == $movelist} {

      # Here the board has not changed, so send nothing

    } else {

      # Otherwise, undo and re-send all moves:
      for {set i 0} {$i < $oldlen} {incr i} {
        sendToEngine $n "undo"
      }
      foreach m $movelist {
        sendMoveToEngine $n $m
      }
    }

    sendToEngine $n "analyze"

  } else {

    # This section is for engines without the analyze command:
    # In this case, Scid just sends "new", "force" and a bunch
    # of moves, then sets a very long search time/depth and
    # sends "go". This is not ideal but it works OK for engines
    # without "analyze" that I have tried.

    # If Unix OS and engine wants it, send an INT signal:
    if {(!$windowsOS)  &&  $analysis(send_sigint$n)} {
      catch {exec -- kill -s INT [pid $analysis(pipe$n)]}
    }
    sendToEngine $n "new"
    sendToEngine $n "force"
    if {$nonStdStart} {
      set analysis(moves$n) "  Sorry, this game has a non-standard start position."
      updateAnalysisText $n
      return
    }
    foreach m $movelist {
      sendMoveToEngine $n $m
    }
    # Set engine to be white or black:
    sendToEngine $n [sc_pos side]
    # Set search time and depth to something very large and start search:
    sendToEngine $n "st 120000"
    sendToEngine $n "sd 50"
    sendToEngine $n "post"
    sendToEngine $n "go"
  }
}

set temptime 0
trace variable temptime w {forceRegexp {^[0-9]*\.?[0-9]*$}}

proc setAutomoveTime {{n 1}} {
  global analysis temptime dialogResult
  set ::tempn $n
  set temptime [expr $analysis(automoveTime$n) / 1000.0]
  set w .apdialog
  toplevel $w
  #wm transient $w .analysisWin
  wm title $w "Scid: Engine thinking time"
  wm resizable $w 0 0
  label $w.label -text "Set the engine thinking time per move in seconds:"
  pack $w.label -side top -pady 5 -padx 5
  entry $w.entry -background white -width 10 -textvariable temptime
  pack $w.entry -side top -pady 5
  bind $w.entry <Escape> { .apdialog.buttons.cancel invoke }
  bind $w.entry <Return> { .apdialog.buttons.ok invoke }

  addHorizontalRule $w

  set dialogResult ""
  set b [frame $w.buttons]
  pack $b -side top -fill x
  button $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .apdialog
    destroy .apdialog
    focus .
    set dialogResult Cancel
  }
  button $b.ok -text "OK" -command {
    grab release .apdialog
    if {$temptime < 0.1} { set temptime 0.1 }
    set analysis(automoveTime$tempn) [expr int($temptime * 1000)]
    focus .
    grab release .apdialog
    destroy .apdialog
    focus .
    set dialogResult OK
  }
  pack $b.cancel $b.ok -side right -padx 5 -pady 5
  focus $w.entry
  update
  grab .apdialog
  tkwait window .apdialog
  if {$dialogResult != "OK"} {
    return 0
  }
  return 1
}

proc toggleAutomove {{n 1}} {
  global analysis
  if {! $analysis(automove$n)} {
    cancelAutomove $n
  } else {
    set analysis(automove$n) 0
    if {! [setAutomoveTime $n]} {
      return
    }
    set analysis(automove$n) 1
    automove $n
  }
}

proc cancelAutomove {{n 1}} {
  global analysis
  set analysis(automove$n) 0
  after cancel "automove $n"
  after cancel "automove_go $n"
}

proc automove {{n 1}} {
  global analysis autoplayDelay
  if {! $analysis(automove$n)} { return }
  after cancel "automove $n"
  set analysis(automoveThinking$n) 1
  after $analysis(automoveTime$n) "automove_go $n"
}

proc automove_go {{n 1}} {
  global analysis
  if {$analysis(automove$n)} {
    if {[makeAnalysisMove $n]} {
      set analysis(autoMoveThinking$n) 0
      updateBoardAndPgn .board
      after cancel "automove $n"
      ::tree::doTraining $n
    } else {
      after 1000 "automove $n"
    }
  }
}

###
### End of file: analysis.tcl
###
###
### wbdetect.tcl: part of Scid.
### Copyright (C) 1999-2002  Shane Hudson.
###

######################################################################
#
# Code to detect various Winboard engines being used as analysis
# engines in Scid.  
#
# Thanks to Allen Lake for testing many WinBoard engines
# with Scid in Windows and providing this code.
#
# Most cases below are for engines that have analyze mode but
# do not let Scid know about it by sending a "feature" line
# with "analyze=1" in response to the "protover 2" command.
# Some cases also cover engines that report times in seconds
# instead of centiseconds.

proc detectWBEngine { {n 1} engineOutput } {

  global analysis

  # Check for a line containing "Amy version" to detect use of
  # the Amy 0.7 Winboard engine, which doesn't support the
  # "setboard" command, but does support the "analyze" command.
  if {[regexp "Amy version" $engineOutput] } {
    logEngineNote $n {Seen "Amy"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Baron" to detect use of the 
  # Baron 0.26, 0.26a, 0.27, or 0.28a Winboard engines.  These
  # engines display analysis time in whole seconds, rather than
  # in centiseconds, so I have added code to detect this.
  if {[regexp "Baron" $engineOutput] } {
    logEngineNote $n {Seen "Baron"; assuming analyze, setboard, times in seconds.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wholeSeconds$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "D U K E" to detect use of
  # the Duke 1.0 or 1.1 Winboard engines, which don't support the
  # "setboard" command, but do support the "analyze" command.
  if {[regexp "D U K E" $engineOutput] } {
    logEngineNote $n {Seen "Duke"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "ESCbook.bin" to detect use of
  # the Esc 1.09 Winboard engine, which doesn't support the
  # "setboard" command, but does support the "analyze" command.
  if {[regexp "ESCbook.bin" $engineOutput] } {
    logEngineNote $n {Seen "ESC"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "FORTRESS" to detect use of
  # the Fortress 1.62 Winboard engine, which doesn't support the
  # "setboard" command, but does support the "analyze" command.
  if {[regexp "FORTRESS" $engineOutput] } {
    logEngineNote $n {Seen "Fortress"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line starting with "Chess", to detect the use of
  # GNU Chess 4, which issues time in whole seconds rather than in
  # centiseconds.
  if {! [string compare [string range $engineOutput 0 4] "Chess"]} {
    logEngineNote $n {Seen "GNU Chess 4"; assuming times in seconds.}
    set analysis(wholeSeconds$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "GNU Chess v5" to detect use of
  # the GNU Chess 5.02 or 5.03 Winboard engine, which don't support the
  # "analyze" command, but do support the "setboard" command.
  if {[regexp "GNU Chess v5" $engineOutput] } {
    logEngineNote $n {Seen "GNU Chess 5"; assuming setboard command.}
    set analysis(has_setboard$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Gromit3" to detect use of the
  # Gromit 3.00 or Gromit 3.8.2 Winboard engine, which don't
  # support the "setboard" command, but do support the 
  # "analyze" command.
  if {[regexp "Gromit3" $engineOutput]  ||  [regexp "GROMIT" $engineOutput]} {
    logEngineNote $n {Seen "Gromit"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Jester" to detect use of the 
  # Jester 0.82 Winboard engine.  This engine supports "analyze"
  # but does not support "setboard" or "protover".
  if {[regexp "Jester" $engineOutput] } {
    logEngineNote $n {Seen "Jester"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Calzerano" to detect use of the
  # Leila 0.36 or Leila 0.41i Winboard engine, which don't
  # support the "setboard" command, but do support the 
  # "analyze" command.
  if {[regexp "Calzerano" $engineOutput] } {
    logEngineNote $n {Seen "Calzerano" (Leila); assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "LordKing" to detect use of the 
  # LordKing 3.0, 3.1, or 3.2 Winboard engines.  These engines
  # have "analyze", but do not support "setboard" or "protover".
  if {[regexp "LordKing" $engineOutput] } {
    logEngineNote $n {Seen "LordKing"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "NEJMET" to detect use of the
  # Nejmet 2.6.0 Winboard engine, which supports "setboard"
  # and "analyze", but not "protover".
  if {[regexp "NEJMET" $engineOutput] } {
    logEngineNote $n {Seen "Nejmet"; assuming analyze and setboard commands.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Nejmet" to detect use of the
  # Nejmet 3.0.1 and 3.0.2 Winboard engines, which send 
  # "feature analyse=1" instead of "feature analyze=1".
  if {[regexp "Nejmet" $engineOutput] } {
    logEngineNote $n {Seen "Nejmet"; assuming analyze and setboard commands.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Pharaon" to detect use of the 
  # Pharaon 2.50 or Pharaon 2.61 Winboard engines.  These
  # engines display analysis time in whole seconds, rather than
  # in centiseconds, so I have added code to detect this.
  # Performance of these engines has been somewhat uneven, with
  # occasional crashes of the engine, but more stable and 
  # predictable with this code in place.
  if {[regexp "Pharaon" $engineOutput] } {
    logEngineNote $n {Seen "Pharaon"; assuming analyze, setboard, times in seconds.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wholeSeconds$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "Skaki" to detect use of the 
  # Skaki 1.19 Winboard engine.  This engine has "analyze", 
  # but does not support "setboard" or "protover".
  if {[regexp "Skaki" $engineOutput] } {
    logEngineNote $n {Seen "Skaki"; assuming analyze command.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "EngineControl-TCB" to detect use of the 
  # TCB 0045 Winboard engine.  This engine has "analyze", 
  # but does not support "setboard" or "protover".
  if {[regexp "EngineControl-TCB" $engineOutput] } {
    logEngineNote $n {Seen "TCB"; assuming analyze and setboard commands.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "ZChess" to detect use of the
  # ZChess 2.22 Winboard engine.  ZChess is the predecessor
  # of the Pharaon series of Winboard engines and, as such,
  # displays analysis time in whole seconds, rather than
  # in centiseconds. 
  if {[regexp "ZChess" $engineOutput] } {
    logEngineNote $n {Seen "ZChess"; assuming analyze, setboard, times in seconds.}
    set analysis(has_analyze$n) 1
    set analysis(wholeSeconds$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "King of Kings" to detect use
  # of the King of Kings 2.02 Winboard engine.  KofK uses the
  # "protover" command, but seems to confuse previous code on
  # Win98SE. Setting analysis(has_setboard$n) and
  # analysis(has_analyze$n) explicitly seems to help.
  if {[regexp "King of Kings" $engineOutput] } {
    logEngineNote $n {Seen "King of Kings"; assuming analyze and setboard commands.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "EXchess" to detect use of the
  # EXchess 4.02 or 4.03 Winboard engine, which supports "setboard"
  # and "analyze", but not "protover".
  if {[regexp "EXchess" $engineOutput] } {
    logEngineNote $n {Seen "EXchess"; assuming analyze and setboard commands.}
    set analysis(has_setboard$n) 1
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }

  # Check for a line containing "WildCat version 2.61" to detect use of the
  # WildCat 2.61 Winboard engine, which supports "analyze"
  # but not "setboard" or "protover".
  if {[regexp "WildCat version 2.61" $engineOutput] } {
    logEngineNote $n {Seen "WildCat 2.61"; assuming analyze and setboard commands.}
    set analysis(has_analyze$n) 1
    set analysis(wbEngineDetected$n) 1
    return
  }
}

###
### End of file: wbdetect.tcl
###
### reper.tcl:
### Repertoire editor functions for Scid.
### Copyright (C) 2001 Shane Hudson.

# The heirarchical view used to display a repertoire in Scid was
# originally based on the  public domain Tcl/Tk tree widget written by
# D. Richard Hipp (available at: http://www.hwaci.com/sw/tk/tree.html)
# but the Scid code is completely rewritten and significantly improved.

namespace eval ::rep {}
array set ::rep::_data {}
set ::rep::Win 0

# ::rep::create
#   Create a new repertoire widget.  $args become the configuration
#   arguments to the canvas widget that is created.
#
proc ::rep::create {w args} {
  eval canvas $w -bg white -width 1 $args
  bind $w <Destroy> "catch {::rep::clear $w}"
  ::rep::_defaults $w /
  ::rep::_drawWhenIdle $w
  set ::rep::_data($w:selection) {}
  set ::rep::_data($w:selidx) {}
  set ::rep::_data($w:altered) 0
  set ::rep::_data($w:nlines) 0
  set ::rep::_data($w:ngroups) 0
  set ::rep::_data($w:filename) ""
  #set ::rep::_data($w:readonly) 0
}

# ::rep::_defaults
#   Used to initialize a new element of the tree.
#
proc ::rep::_defaults {w v} {
  set ::rep::_data($w:$v:children) {}
  set ::rep::_data($w:$v:shown) 1
  set ::rep::_data($w:$v:tags) {}
  set ::rep::_data($w:$v:comment) {}
  set ::rep::_data($w:$v:text) {}
  set ::rep::_data($w:$v:group) 0
  set ::rep::_data($w:$v:include) 1
}

# ::rep::_findGroup
#   Finds the parent group of a line or group that will be added.
#
proc ::rep::_findGroup {w v parent} {
  set p $parent
  if {$parent == ""} { set p "/" }
  foreach g $::rep::_data($w:$p:children) {
    set len [string length $g]
    set v2 [string range $v 0 [expr $len - 1]]
    regsub -all " " $v2 "," v2
    if {! [string compare $v2 $g]} {
      set v [string trim [string range $v $len end]]
      return [::rep::_findGroup $w $v $parent/$g]
    }
  }
  set v [string trim $v]
  regsub -all " " $v "," v
  return $parent/$v
}

# ::rep::addCurrentBoard
#   Adds the line representing the current board position as a
#   group, included line or excluded line.
#
proc ::rep::addCurrentBoard {w type} {
  switch -exact -- $type {
    group   { set grp 1; set inc 0; set cmd ::rep::newGroup }
    include { set grp 0; set inc 1; set cmd ::rep::newLine  }
    exclude { set grp 0; set inc 0; set cmd ::rep::newLine  }
    default { return }
  }
  # Verify that the current game began at the standard starting position:
  if {[sc_game startBoard]} {
    tk_messageBox -parent $w -type ok -icon info -title "Scid" \
      -message "The current game does not have the standard starting position, so its positions cannot be added to the repertoire."
    return
  }
  set moves [string trim [sc_game moves]]
  set err [catch {$cmd $w $moves -group $grp -include $inc} res]
  if {$err} {
    tk_messageBox -parent $w -type ok -icon info -title "Scid" -message $res
    return
  }
  ::rep::regroup $w
  singleClick $w $res
}

# ::rep::newGroup
#   Adds a new group to the repertoire.
#
proc ::rep::newGroup {w v args} {
  if {$v == ""} {
    return -code error "The starting chess position cannot be a group."
  }
  set s [::rep::_findGroup $w $v ""]
  lappend args -group 1
  return [::rep::_newItem $w $s $args]
}

# ::rep::newLine
#   Adds a new group to the repertoire.
#
proc ::rep::newLine {w v args} {
  set s [::rep::_findGroup $w $v ""]
  lappend args -group 0
  return [::rep::_newItem $w "${s} ,LINE" $args]
}

# ::rep::_decode
#   Decodes a group or line path back to standard chess notation,
#   e.g. "/1.e4_c5/2.Nf3_d6" -> "1.e4 c5 2.Nf3 d6"
#
proc ::rep::_decode {m} {
  regsub -all "," $m " " moves
  regsub -all "/" $moves " " moves
  regsub "LINE" $moves "" moves
  set moves [string trim $moves]
  return $moves
}

# ::rep::_newItem
#   Called from newGroup or newLine to add a new element to the repertoire.
#
proc ::rep::_newItem {w v args} {
  regsub -all " " $v "," v
  set dir [file dirname $v]
  set n [file tail $v]
  if {[llength $args] == 1} {
    set args [lindex $args 0]
  }
  set image {}
  set tags {}
  set text {}
  set comment {}
  set group 0
  set include 1
  set shown 1

  foreach {op arg} $args {
    switch -exact -- $op {
      -image {set image $arg}
      -tags {set tags $arg}
      -text {set text $arg}
      -comment {set comment $arg}
      -group {set group $arg}
      -include {set include $arg}
      -shown {set shown $arg}
    }
  }
  if {![info exists ::rep::_data($w:$dir:shown)]} {
    return -code error "parent item \"$dir\" is missing"
  }
  set i [lsearch -exact $::rep::_data($w:$dir:children) $n]
  if {$i >= 0} {
    set  type "line"
    if {$group} { set type "group" }
    return -code error "The $type \"[::rep::_decode $v]\" already exists in this repertoire."
  }
  if {$group} {
    incr ::rep::_data($w:ngroups)
  } else {
    incr ::rep::_data($w:nlines)
  }

  lappend ::rep::_data($w:$dir:children) $n
  set ::rep::_data($w:$dir:children) [lsort $::rep::_data($w:$dir:children)]
  ::rep::_defaults $w $v
  set ::rep::_data($w:$v:comment) $comment
  set ::rep::_data($w:$v:image) $image
  set ::rep::_data($w:$v:tags) $tags
  set ::rep::_data($w:$v:text) $text
  set ::rep::_data($w:$v:group) $group
  set ::rep::_data($w:$v:include) $include
  set ::rep::_data($w:$v:shown) $shown
  set ::rep::_data($w:altered) 1
  ::rep::updateStatus $w
  # ::rep::_drawWhenIdle $w
  return $v
}

# ::rep::updateStatus
#   Updates the status bar message for the repertoire window.
#
proc ::rep::updateStatus {w} {
  set s "  "
  if {$::rep::_data($w:altered)} { append s "XX" } else { append s "--" }
  append s "  "
  set f $::rep::_data($w:filename)
  if {$f == ""} {
    set f "(Untitled)"
  } else {
    set f [file tail $f]
  }
  append s "$f: $::rep::_data($w:nlines) lines"
  append s " in $::rep::_data($w:ngroups) groups"
  set ::rep::_data($w:status) $s
}

# ::rep::updateWinTitle
#   Updates the repertoire window title.
#
proc ::rep::updateWinTitle {w} {
  set f $::rep::_data($w:filename)
  if {$f == ""} {
    set f "(Untitled)"
  } else {
    set f [file tail $f]
  }
  wm title [winfo toplevel $w] "Scid: [tr WindowsRepertoire]: $f"
}

# ::rep::regroup
#   Calls ::rep::_extract to produce a set of commands for rebuilding
#   the repertoire heirarchy, then clears and rebuilds it.
#   Used to reorganise the repertoire whenever a group is added or
#   removed.
proc ::rep::regroup {w} {
  set list [::rep::_extract $w / {}]
  ::rep::clear $w
  foreach i $list {eval $i}
  ::rep::_drawWhenIdle $w
}

# ::rep::newFile
#   Clears the repertoire and reset the filename to be untitled.
#
proc ::rep::newFile {w} {
  ::rep::clear $w
  set ::rep::_data($w:filename) ""
  #set ::rep::_data($w:readonly) 0
  ::rep::updateWinTitle $w
  ::rep::_drawWhenIdle $w
}

# ::rep::clear
#   Clears the repertoire, but keeps its filename.
#
proc ::rep::clear {w} {
  set fname ""
  set fname $::rep::_data($w:filename)
  foreach t [array names ::rep::_data $w:*] {
    unset ::rep::_data($t)
  }
  set ::rep::_data($w:filename) $fname
  set ::rep::_data($w:selection) {}
  set ::rep::_data($w:selidx) {}
  set ::rep::_data($w:altered) 0
  set ::rep::_data($w:nlines) 0
  set ::rep::_data($w:ngroups) 0
  ::rep::_defaults $w /
}

# ::rep::deleteGroup
#   After verification from the user, this deletes the specified
#   group but keeps all subgroups and lines.
#
proc ::rep::deleteGroup {w v} {
  if {! [info exists ::rep::_data($w:$v:group)]} { return }
  if {! $::rep::_data($w:$v:group)} { return }
  set v2 [::rep::_decode $v]
  set msg "The group \"$v2\" contains [::rep::_numChildLines $w $v] lines "
  append msg "in [expr [::rep::_numChildGroups $w $v] - 1] subgroups.\n\n"
  append msg "Are you sure you want to delete this group, keeping all the groups and lines under it?"
  set answer [tk_messageBox -parent $w -title "Scid: Delete group?" \
                            -type yesno -icon question -message $msg]
  if {$answer != "yes"} { return }
  set ::rep::_data($w:$v:delete) 1
  ::rep::regroup $w
}

# ::rep::pruneGroup
#   After verification from the user, this deletes the specified
#   group AND all its subgroups and lines.
#
proc ::rep::pruneGroup {w v} {
  if {! [info exists ::rep::_data($w:$v:group)]} { return }
  if {! $::rep::_data($w:$v:group)} { return }
  set v2 [::rep::_decode $v]
  set msg "The group \"$v2\" contains [::rep::_numChildLines $w $v] lines "
  append msg "in [expr [::rep::_numChildGroups $w $v] - 1] subgroups.\n\n"
  append msg "Are you sure you want to delete this group AND ALL the groups and lines under it?"
  set answer [tk_messageBox -parent $w -title "Scid: Delete group?" \
                            -type yesno -icon question -message $msg]
  if {$answer != "yes"} { return }
  set ::rep::_data($w:$v:delete) 1
  set ::rep::_data($w:$v:prune) 1
  ::rep::regroup $w
}

# ::rep::deleteGroup
#   After verification from the user, this deletes the specified line.
#
proc ::rep::deleteLine {w v} {
  if {! [info exists ::rep::_data($w:$v:group)]} { return }
  if {$::rep::_data($w:$v:group)} { return }
  set v2 [::rep::_decode $v]
  set msg "Delete: $v2\n\n"
  append msg "Are you sure you want to delete this line?"
  set answer [tk_messageBox -parent $w -title "Scid: Delete line?" \
                            -type yesno -icon question -message $msg]
  if {$answer != "yes"} { return }
  set ::rep::_data($w:$v:delete) 1
  ::rep::regroup $w
}

# ::rep::showAll
#   Expands the specified group and all its subgroups.
#
proc ::rep::showAll {w {v ""}} {
  foreach i [array names ::rep::_data $w:$v*:shown] {
    set ::rep::_data($i) 1
  }
  ::rep::_drawWhenIdle $w
}

# ::rep::hideAll
#   Collapses the specified group and all its subgroups.
#
proc ::rep::hideAll {w {v ""}} {
  foreach i [array names ::rep::_data $w:$v*:shown] {
    set ::rep::_data($i) 0
  }
  ::rep::_drawWhenIdle $w
}

# ::rep::setSelection
#   Changes the selection to the specified group or line.
#
proc ::rep::setSelection {w v} {
  set ::rep::_data($w:selection) $v
  ::rep::_drawSelection $w
  ::rep::updateStatus $w
}
 
# ::rep::getSelection
#   Retrieves the current selection.
#
proc ::rep::getSelection {w} {
  return $::rep::_data($w:selection)
}

# ::rep::_numChildGroups
#   Returns the number of (direct and indirect) subgroups of a group.
#
proc ::rep::_numChildGroups {w v} {
  if {! $::rep::_data($w:$v:group)} { return 0 }
  set count 1
  if {[info exists ::rep::_data($w:$v:children)]} {
    foreach child $::rep::_data($w:$v:children) {
      incr count [::rep::_numChildGroups $w $v/$child]
    }
  }
  return $count
}


# ::rep::_numChildLines
#   Returns the number of (direct and indirect) child lines of a group.
#
proc ::rep::_numChildLines {w v} {
  if {! $::rep::_data($w:$v:group)} { return 1 }
  set count 0
  if {[info exists ::rep::_data($w:$v:children)]} {
    foreach child $::rep::_data($w:$v:children) {
      incr count [::rep::_numChildLines $w $v/$child]
    }
  }
  return $count
}

# ::rep::_draw
#   Draws the repertoire heirarchy.
#
proc ::rep::_draw {w} {
  catch {unset ::rep::_data($w:drawPending)}
  $w delete all
  set ::rep::_data($w:y) 30
  ::rep::_drawLevel $w "/" 10
  $w config -scrollregion [$w bbox all]
  ::rep::_drawSelection $w
  ::rep::updateStatus $w
  $w xview moveto 0.0
}

# ::rep::_drawLevel
#   Draws a single level of the heirarchy, indented by $in pixels.
#
proc ::rep::_drawLevel {w v in} {
  set p $v
  if {$v == "/"} { set p "" }
  set start [expr $::rep::_data($w:y)-10]
  set y 0
  if {[llength $::rep::_data($w:$v:children)] == 0} {
    set y $::rep::_data($w:y)
    incr ::rep::_data($w:y) 17
    $w create line $in $y [expr $in+10] $y -fill gray50 
    incr in 12
    $w create text $in $y -font font_Small -anchor w -text "(empty)"
    return
  }

  foreach c $::rep::_data($w:$v:children) {
    set y $::rep::_data($w:y)
    incr ::rep::_data($w:y) 17
    $w create line $in $y [expr $in + 10] $y -fill gray50 
    set group $::rep::_data($w:$p/$c:group)
    set icon $::rep::_data($w:$p/$c:image)
    set taglist x
    foreach tag $::rep::_data($w:$p/$c:tags) { lappend taglist $tag }
    if {$group} {
      set icon ::rep::_closedgroup
      if {$::rep::_data($w:$p/$c:shown)} { set icon ::rep::_opengroup }
    } else {
      set icon ::rep::_cross
      if {$::rep::_data($w:$p/$c:include)} { set icon ::rep::_tick }
    }
    set x [expr $in + 12]

    if {$icon != ""} {
      set tag [$w create image $x $y -image $icon -anchor w -tags $taglist]
      incr x 20
      set ::rep::_data($w:tag:$tag) $p/$c
      if {$group} {
        set s [expr 1 - $::rep::_data($w:$p/$c:shown)]
        $w bind $tag <1> "set ::rep::_data($w:$p/$c:shown) $s; ::rep::_draw $w"
      }
      $w bind $tag <3> "::rep::_popupMenu $w $p/$c %X %Y"
    }
    set moves [::rep::_decode $c]
    if {$moves == ""} { set moves "..." }
    if {$group} {
      append moves " ([::rep::_numChildLines $w $p/$c])"
    }
    set tag [$w create text $x $y -text $moves -font font_Small \
                                  -anchor w -tags $taglist]
    set ::rep::_data($w:tag:$tag) $p/$c
    set ::rep::_data($w:$p/$c:tag) $tag
    $w bind $tag <3> "::rep::_popupMenu $w $p/$c %X %Y"
    set comment ""
    if {[string length $::rep::_data($w:$p/$c:text)] > 0} {
      set comment "** "
    }
    if {[string length $::rep::_data($w:$p/$c:comment)] > 0} {
      append comment "$::rep::_data($w:$p/$c:comment)"
    }
    if {$comment != ""} {
      incr x [expr 3 + [lindex [$w bbox $tag] 2] - [lindex [$w bbox $tag] 0]]
      set tag [$w create text $x $y -text $comment -font font_Small \
                                  -fill red3 -anchor w -tags $taglist]
      $w bind $tag <3> "::rep::_popupMenu $w $p/$c %X %Y"
      set ::rep::_data($w:tag:$tag) $p/$c
    }

    if {[llength $::rep::_data($w:$p/$c:children)] > 0} {
      if {$::rep::_data($w:$p/$c:shown)} {
        set tag [$w create image $in $y -image ::rep::_shown]
        $w bind $tag <1> "set ::rep::_data($w:$p/$c:shown) 0; ::rep::_draw $w"
        ::rep::_drawLevel $w $p/$c [expr $in + 18]
      } else {
        set tag [$w create image $in $y -image ::rep::_hidden]
        $w bind $tag <1> "set ::rep::_data($w:$p/$c:shown) 1; ::rep::_draw $w"
      }
      $w bind $tag <3> "::rep::_popupMenu $w $p/$c %X %Y"
    }
  }
  set tag [$w create line $in $start $in [expr $y+1] -fill gray50 ]
  $w lower $tag
}

# ::rep::showGroup
#   Expand a single group.
#
proc ::rep::showGroup {w v} {
  if {[info exists ::rep::_data($w:$v:shown)]
      &&  $::rep::_data($w:$v:shown) == 0
      &&  [info exists ::rep::_data($w:$v:children)] 
      &&  [llength $::rep::_data($w:$v:children)] > 0} {
    set ::rep::_data($w:$v:shown) 1
    ::rep::_draw $w
  }
}

# ::rep::showGroup
#   Collapse a single group.
#
proc ::rep::hideGroup {w v} {
  if {[info exists ::rep::_data($w:$v:shown)]
      &&  $::rep::_data($w:$v:shown) == 1} {
    set ::rep::_data($w:$v:shown) 0
    ::rep::_draw $w
  }
}

# ::rep::toggleLineState
#   Change the state of a line (included vs excluded).
#
proc ::rep::toggleLineState {w v} {
  if {[info exists ::rep::_data($w:$v:group)]
      &&  $::rep::_data($w:$v:group) == 0} {
    set state $::rep::_data($w:$v:include)
    set state [expr 1 - $state]
    set ::rep::_data($w:$v:include) $state
    set ::rep::_data($w:altered) 1
    ::rep::_draw $w
  }
}

# ::rep::_drawSelection
#   Highlight the selected goupr or line.
#
proc ::rep::_drawSelection w {
  if {[string length $::rep::_data($w:selidx)]} {
    $w delete $::rep::_data($w:selidx)
  }
  set v $::rep::_data($w:selection)
  if {[string length $v]==0} { return }
  if {![info exists ::rep::_data($w:$v:tag)]} { return }
  set bbox [$w bbox $::rep::_data($w:$v:tag)]
  if {[llength $bbox]==4} {
    set i [eval $w create rectangle $bbox -fill yellow2 -outline {{}}]
    set ::rep::_data($w:selidx) $i
    $w lower $i
  } else {
    set ::rep::_data($w:selidx) {}
  }
}

# ::rep::_drawWhenIdle
#   Schedule a redraw event of the repertoire heirarchy.
#
proc ::rep::_drawWhenIdle w {
  if {![info exists ::rep::_data($w:drawPending)]} {
    set ::rep::_data($w:drawPending) 1
    after idle "::rep::_draw $w"
  }
}

# ::rep::labelAtXY
#   Return the group or line in the repertoire located at the
#   real coordinates ($x,$y).
#
proc ::rep::labelAtXY {w x y} {
  set x [$w canvasx $x]
  set y [$w canvasy $y]
  foreach m [$w find overlapping $x $y $x $y] {
    if {[info exists ::rep::_data($w:tag:$m)]} {
      return $::rep::_data($w:tag:$m)
    }
  }
  return ""
}

# ::rep::openCloseWindow
#   Open/close the repertoire editor.
#
proc ::rep::openCloseWindow {} {
  set w .repWin
  if {[winfo exists $w]} { 
    destroy $w 
    return
  }
  ::rep::makeWindow
}

# ::rep::closeWindow
#   Close the repertoire editor.
#
proc ::rep::closeWindow {} {
  set w .repWin
  if {! [winfo exists $w]} { return }
  if {$::rep::_data($w.f.w.rep:altered)} {
    set answer [tk_dialog .repDialog "Scid: [tr RepFileClose]" \
                  $::tr(RepCloseDialog) "" 0 $::tr(Yes) $::tr(No) ]
    if {$answer == 1} { return }
  }
  destroy $w
  set ::rep::Win 0
}

# ::rep::openWithFile
#   Open the repertoire editor and losd the specified file.
#
proc ::rep::openWithFile {fname} {
  ::rep::makeWindow
  ::rep::readFile .repWin.f.w.rep $fname
}

# ::rep::configMenus
#   Called to set the window menus to a specified language.
proc ::rep::configMenus {w {lang ""}} {
  if {! [winfo exists $w]} { return }
  if {$lang == ""} { set lang $::language }
  set m $w.m
  foreach menu {file edit view search help} tag {File Edit View Search Help} {
    configMenuName $m.$menu Rep$tag $lang
  }
  foreach idx {0 1 3 4 6} tag {New Open Save SaveAs Close} {
    configMenuText $m.file.menu $idx RepFile$tag $lang
  }
  foreach idx {0 1 2} tag {Group Include Exclude} {
    configMenuText $m.edit.menu $idx RepEdit$tag $lang
  }
  foreach idx {0 1} tag {Expand Collapse} {
    configMenuText $m.view.menu $idx RepView$tag $lang
  }
  foreach idx {0 1} tag {All Displayed} {
    configMenuText $m.search.menu $idx RepSearch$tag $lang
  }
  foreach idx {0 1} tag {Rep Index} {
    configMenuText $m.help.menu $idx RepHelp$tag $lang
  }
}

# ::rep::makeWindow
#   Create the repertoire editor window.
#
proc ::rep::makeWindow {} {
  set w .repWin
  if {[winfo exists $w]} { return }
  set ::rep::Win 1
  toplevel $w

  standardShortcuts $w
  wm protocol $w WM_DELETE_WINDOW ::rep::closeWindow

  frame $w.m -bd 1 -relief raised
  pack $w.m -side top -fill x 
  $w configure -menu $w.m
  menubutton $w.m.file -text RepFile -menu $w.m.file.menu
  menu $w.m.file.menu
  $w.m.file.menu add command -label RepFileNew -accelerator "Ctrl+N" \
    -command "::rep::newFile $w.f.w.rep"
  bind $w <Control-n> "$w.m.file.menu invoke 0"
  $w.m.file.menu add command -label RepFileOpen -accelerator "Ctrl+O" \
    -command "::rep::openFile $w.f.w.rep"
  bind $w <Control-o> "$w.m.file.menu invoke 1"
  $w.m.file.menu add separator
  $w.m.file.menu add command -label RepFileSave -accelerator "Ctrl+S" \
    -command "::rep::saveFile $w.f.w.rep"
  bind $w <Control-s> "$w.m.file.menu invoke 3"
  $w.m.file.menu add command -label RepFileSaveAs \
    -command "::rep::saveFile $w.f.w.rep new"
  $w.m.file.menu add separator
  $w.m.file.menu add command -label RepFileClose -accelerator "Ctrl+Q" \
    -command "destroy $w"
  bind $w <Control-q> "destroy $w"

  menubutton $w.m.edit -text RepEdit -menu $w.m.edit.menu
  menu $w.m.edit.menu
  $w.m.edit.menu add command -label RepEditGroup -accelerator "Ctrl+G" \
    -command "::rep::addCurrentBoard $w.f.w.rep group"
  bind $w <Control-g> "$w.m.edit.menu invoke 0"
  $w.m.edit.menu add command -label RepEditInclude -accelerator "Ctrl+I" \
    -command "::rep::addCurrentBoard $w.f.w.rep include"
  bind $w <Control-i> "$w.m.edit.menu invoke 1"
  $w.m.edit.menu add command -label RepEditExclude -accelerator "Ctrl+X" \
    -command "::rep::addCurrentBoard $w.f.w.rep exclude"
  bind $w <Control-x> "$w.m.edit.menu invoke 2"

  menubutton $w.m.view -text RepView -menu $w.m.view.menu
  menu $w.m.view.menu
  $w.m.view.menu add command -label RepViewExpand \
    -command "::rep::showAll $w.f.w.rep"
  $w.m.view.menu add command -label RepViewCollapse \
    -command "::rep::hideAll $w.f.w.rep"

  menubutton $w.m.search -text RepSearch -menu $w.m.search.menu
  menu $w.m.search.menu
  $w.m.search.menu add command -label RepSearchAll \
    -command "::rep::search $w.f.w.rep all"
  $w.m.search.menu add command -label RepSearchDisplayed \
    -command "::rep::search $w.f.w.rep displayed"

  menubutton $w.m.help -text RepHelp -menu $w.m.help.menu
  menu $w.m.help.menu
  $w.m.help.menu add command -label RepHelpRep -command {helpWindow Repertoire}
  $w.m.help.menu add command -label RepHelpIndex -command {helpWindow Index}

  pack $w.m.file $w.m.edit $w.m.view $w.m.search $w.m.help -side left -padx 5

  label $w.status -relief sunken -width 1 -anchor w -font font_Small
  pack $w.status -side bottom -anchor w -fill x -expand yes

  set pane [::pane::create $w.f w text 600 300 0.5 h]
  ::pane::range $w.f 0.2 0.8
  #::pane::setdrag $w.f 0
  pack $w.f -fill both -expand 1

  ::rep::create $w.f.w.rep -yscrollcommand "$w.f.w.sb set"
  scrollbar $w.f.w.sb -orient vertical -command "$w.f.w.rep yview"
  pack $w.f.w.sb -side right -fill y
  pack $w.f.w.rep -side left -fill both -expand 1 -padx 5 -pady 5
  text $w.f.text.moves -height 3 -fg darkBlue -bg white -font font_Small \
    -state disabled -cursor top_left_arrow -wrap word
  entry $w.f.text.entry -width 1 -fg black -bg white -font font_Small
  text $w.f.text.note -width 40 -height 10 -fg black -bg white -font font_Small
  pack $w.f.text.moves -side top -fill x
  pack $w.f.text.entry -side top -fill x
  pack $w.f.text.note -side top -expand 1 -fill both
  $w.status configure -textvar ::rep::_data($w.f.w.rep:status)

  bind $w <F1> {helpWindow Repertoire}
  bind $w <Down> "$w.f.w.rep yview scroll +1 units"
  bind $w <Up> "$w.f.w.rep yview scroll -1 units"
  bind $w <Prior> "$w.f.w.rep yview scroll -1 pages"
  bind $w <Next> "$w.f.w.rep yview scroll +1 pages"
  bind $w <Home> "$w.f.w.rep yview moveto 0.0"
  bind $w <End> "$w.f.w.rep yview moveto 0.99"
  $w.f.w.rep xview moveto 0.0
  $w.f.w.rep yview moveto 0.0

  $w.f.w.rep bind x <1> "singleClick $w.f.w.rep \[::rep::labelAtXY %W %x %y\]"
  #$w.f.w.rep bind x <3> "singleClick $w.f.w.rep \[::rep::labelAtXY %W %x %y\]"

  bind $w.f.text.moves <1> "if {\[string length \[$w.f.text.moves get 1.0 end\]\] > 1} { importPgnLine \[$w.f.text.moves get 1.0 end\] }"

  bind $w.f.text.entry <KeyPress> {
    after idle {
      set label [::rep::getSelection .repWin.f.w.rep]
      if {$label != ""} {
        set ::rep::_data(.repWin.f.w.rep:$label:comment) \
          [string trim [.repWin.f.text.entry get]]
        ::rep::_draw .repWin.f.w.rep
      }
    }
  }

  bind $w.f.text.note <KeyPress> {
    after idle {
      set label [::rep::getSelection .repWin.f.w.rep]
      if {$label != ""} {
        set ::rep::_data(.repWin.f.w.rep:$label:text) \
          [string trim [.repWin.f.text.note get 1.0 end]]
      }
    }
  }

  ::rep::configMenus $w
  ::rep::updateWinTitle $w.f.w.rep
  #wm minsize $w 300 200
}

# ::rep::singleClick
#   Updates the move list label, single-line comment entry widget
#   and multi-line comment text widget in the repertoire editor.
#   Called whenever the left mouse button is clicked on a group or
#   line in the repertoire.
#
proc singleClick {w label} {
  ::rep::setSelection $w $label
  if {$label == ""} { return }
  set moves [::rep::_decode $label]
  set win [winfo toplevel $w]
  $win.f.text.moves configure -state normal
  $win.f.text.moves delete 1.0 end
  $win.f.text.moves insert end $moves
  $win.f.text.moves configure -state disabled
  set comment ""
  catch {set comment $::rep::_data($w:$label:comment)}
  $win.f.text.entry delete 0 end
  $win.f.text.entry insert end $comment
  set temptext ""
  catch {set temptext $::rep::_data($w:$label:text)}
  set temptext [string trim $temptext]
  $win.f.text.note delete 1.0 end
  $win.f.text.note insert end $temptext
}

# ::rep::_extract
#   Traverses the repertoire heirarchy, producing a list of
#   commands needed to reconstruct the entire repertoire.
#   If a line or group is marked deleted, it is not included in
#   the list. If a group is marked pruned, its children are not
#   included either.
#
proc ::rep::_extract {w v returnList} {
  set p $v
  if {$v == "/"} { set p "" }
  foreach c $::rep::_data($w:$v:children) {
    set text [string trim $::rep::_data($w:$p/$c:text)]
    set comment [string trim $::rep::_data($w:$p/$c:comment)]
    set moves [::rep::_decode $p/$c]

    set recurse 0
    if {$::rep::_data($w:$p/$c:group)} {
      if {! [info exists ::rep::_data($w:$p/$c:prune)]} { set recurse 1 }
      set cmd "::rep::newGroup $w [list $moves]"
      append cmd " -shown $::rep::_data($w:$p/$c:shown)"
    } else {
      set cmd "::rep::newLine $w [list $moves]"
      append cmd " -include $::rep::_data($w:$p/$c:include)"
    }
    append cmd " -comment [list $comment] -text [list $text]"
    if {! [info exists ::rep::_data($w:$p/$c:delete)]} {
      lappend returnList $cmd
    }

    if {$recurse  &&  [llength $::rep::_data($w:$p/$c:children)] > 0} {
      set returnList [::rep::_extract $w $p/$c $returnList]
    }
  }
  return $returnList
}

# ::rep::_searchLines
#   Traverses the repertoire heirarchy, producing a list of
#   lines to be searched. If type is "all", all lines in the
#   repertoire will appear. Otherwise, type should be "displayed"
#   and only currently displayed lines will appear.
#   Each include-line returned has "1 " prepended to its moves, and
#   each exclude-line returned has "0 " prepended to its moves.
#   
proc ::rep::_searchLines {w type v returnList} {
  set p $v
  if {$v == "/"} { set p "" }
  foreach c $::rep::_data($w:$v:children) {
    set text [string trim $::rep::_data($w:$p/$c:text)]
    set comment [string trim $::rep::_data($w:$p/$c:comment)]
    set moves [::rep::_decode $p/$c]

    set recurse 0
    if {$::rep::_data($w:$p/$c:group)} {
      if {$type == "all"  ||  $::rep::_data($w:$p/$c:shown)} {
        set recurse 1
      }
    } else {
      lappend returnList "$::rep::_data($w:$p/$c:include) $moves"
    }

    if {$recurse  &&  [llength $::rep::_data($w:$p/$c:children)] > 0} {
      set returnList [::rep::_searchLines $w $type $p/$c $returnList]
    }
  }
  return $returnList
}

# ::rep::readFile
#   Reads the specified repertoire file.
#
proc ::rep::readFile {w fname} {
  #set readonly 0
  #if {[catch {open $fname r+} f]} {
  #  set readonly 1
  #} else {
  #  close $f
  #}

  if {[catch {open $fname r} f]} {
    return -code error "Unable to open the file: $fname"
  }
  ::rep::clear $w
  set ::rep::_data($w:altered) 1
  #set ::rep::_data($w:readonly) 1
  set text ""
  set count 0
  set groups {}
  while {1} {
    set line [string trim [gets $f]]
    if {[eof $f]} { break }
    incr count
    set sep [string first ";" $line]
    if {$sep < 0} {
      set moves $line
      set comment ""
    } else {
      set moves [string trim [string range $line 0 [expr $sep - 1]]]
      set comment [string trim [string range $line [expr $sep + 1] end]]
    }
    set c [string index $line 0]

    switch -exact -- $c {
      "\#" {
        set line [string trim [string range $line 1 end]]
        append text "$line\n"
      }
      "\[" {
        set group [string trim [string range $moves 1 end]]
        set m [join $groups]
        append m " $group"
        if {[catch {::rep::newGroup $w $m -comment $comment -text $text} err]} {
            return -code error "Error: $fname: line $count: $err"
        }
        lappend groups $group
        set text ""
      }
      "\]" {
        set len [llength $groups]
        if {$len == 0} {
          return -code error "Error: $fname: line $count: extra \"\]\" symbol."
        } elseif {$len == 1} {
          set groups {}
        } else {
          set groups [lrange $groups 0 [expr $len - 2]]
        }
      }
      "-" {
        set m [join $groups]
        append m " "
        append m [string trim [string range $moves 1 end]]
        if {[catch {::rep::newLine $w $m -include 0 -comment $comment -text $text} err]} {
            return -code error "Error: $fname: line $count: $err"
        }
        set text ""
      }
      "+" {
        set m [join $groups]
        append m " "
        append m [string trim [string range $moves 1 end]]
        if {[catch {::rep::newLine $w $m -include 1 -comment $comment -text $text} err]} {
            return -code error "Error: $fname: line $count: $err"
        }
        set text ""
      }
      "" -
      "@" {
        # do nothing
      }
      default {
        return -code error "Error in $fname at line $count: unexpected character: \"$c\""
      }
    }
  }
  close $f
  set ::rep::_data($w:altered) 0
  set ::rep::_data($w:filename) $fname
  ::rep::_drawWhenIdle $w
  ::rep::updateWinTitle $w
  return
}

# ::rep::writeFile
#   Writes the repertoire to the specified file.
#
proc ::rep::writeFile {w fname} {
  if {[catch {open $fname w} f]} {
    return -code error "Unable to open the file \"$fname\""
  }
  puts $f "@ Scid opening repertoire file.  Updated: [::date::today]."
  if {[catch {::rep::_writeFileLevel $w $f "/" 0} err]} {
    return -code error "Error writing the file \"$fname\": $err"
  }
  close $f
  set ::rep::_data($w:altered) 0
  set ::rep::_data($w:filename) $fname
  ::rep::updateStatus $w
  ::rep::updateWinTitle $w
  return
}

# ::rep::_writeFileLevel
#   Writes a single level of the repertoire to the open
#   file channel "f", indented "in" spaces.
#
proc ::rep::_writeFileLevel {w f v in} {
  set p $v
  if {$v == "/"} { set p "" }
  if {[llength $::rep::_data($w:$v:children)] == 0} { return }

  foreach c $::rep::_data($w:$v:children) {
    if {$in == 0} { puts $f "" }
    set text [split [string trim $::rep::_data($w:$p/$c:text)] "\n"]
    foreach line $text {
      for {set i 0} {$i < $in} {incr i} { puts -nonewline $f " " }
      puts -nonewline $f "\# "
      puts $f [string trim $line]
    }

    for {set i 0} {$i < $in} {incr i} { puts -nonewline $f " " }
    if {$::rep::_data($w:$p/$c:group)} {
      puts -nonewline $f "\[ "
    } else {
      if {$::rep::_data($w:$p/$c:include)} {
        puts -nonewline $f "+ "
      } else {
        puts -nonewline $f "- "
      }
    }
    set moves [::rep::_decode $c]
    if {[string length $::rep::_data($w:$p/$c:comment)] > 0} {
      append moves " ; $::rep::_data($w:$p/$c:comment)"
    }
    puts $f $moves
    if {[llength $::rep::_data($w:$p/$c:children)] > 0} {
      ::rep::_writeFileLevel $w $f $p/$c [expr $in + 4]
    }
    if {$::rep::_data($w:$p/$c:group)} {
      for {set i 0} {$i < $in} {incr i} { puts -nonewline $f " " }
      puts $f "\]"
    }
  }
}

# ::rep::openFile
#   Prompts the user to select a repertoire file, and reads it.
#
proc ::rep::openFile {w} {
  set ftype { {"Scid repertoire files" {".sor"}} }
  set fname [tk_getOpenFile -filetypes $ftype -title "Open a repertoire file"]
  if {$fname == ""} { return }
  ::rep::readFile $w $fname
}

# ::rep::saveFile
#   Prompts the user to select a repertoire file name if the file is
#   untitled or if the user type is "new", and then writes the file.
#
proc ::rep::saveFile {w {type current}} {
  set fname $::rep::_data($w:filename)
  if {$type == "new"  ||  $fname == ""} {
    set ftype { {"Scid repertoire files" {".sor"}} }
    set fname [tk_getSaveFile -filetypes $ftype \
                 -defaultextension ".sor" \
                 -title "Create a repertoire file"]
  }
  if {$fname == ""} { return }
  ::rep::writeFile $w $fname
}

# ::rep::_popupMenu
#   Creates and presents a right-mouse-button popup menu for a
#   group or line at the real coordinates ($x,$y).
#
proc ::rep::_popupMenu {w v x y} {
  if {! [info exists ::rep::_data($w:$v:group)]} { return }
  catch {destroy $w.popup}
  set group $::rep::_data($w:$v:group)
  menu $w.popup
  $w.popup add command -label "Paste moves as current game" \
    -command "catch {sc_game import \"[::rep::_decode $v]\"};
              updateBoardAndPgn .board"
  $w.popup add separator
  if {$group} {
    $w.popup add command -label "Expand group and all subgroups" \
      -command "::rep::showAll $w $v"
    $w.popup add command -label "Collapse group and all subgroups" \
      -command "::rep::hideAll $w $v"
    $w.popup add separator
    $w.popup add command -label "Delete group, keeping subgroups..." \
      -command "::rep::deleteGroup $w $v"
    $w.popup add command -label "Delete group and subgroups..." \
      -command "::rep::pruneGroup $w $v"
  } else {
    $w.popup add command -label "Toggle included/excluded state" \
      -command "::rep::toggleLineState $w $v"
    $w.popup add separator
    $w.popup add command -label "Delete line..." \
      -command "::rep::deleteLine $w $v"
  }
  tk_popup $w.popup $x $y
}

# ::rep::search
#   Opens the repertoire search window. The parameter "type" should be
#   "all" or "displayed", indicating which lines to use in the search.
#
proc ::rep::search {repwin {type all}} {
  global filterOp
  sc_search repertoire clear
  set lines [::rep::_searchLines $repwin $type / {}]
  set numIncluded 0
  set numExcluded 0
  foreach i $lines {
    set include [string index $i 0]
    set moves [string range $i 2 end]
    sc_game push
    if {[catch {eval "sc_move addSan $moves"} result]} {
      sc_game pop
      tk_messageBox -parent $repwin -type ok -icon warning -title "Scid" \
        -message "Error in line \"$moves\": $result"
      sc_search repertoire clear
      return
    }
    sc_search repertoire add $include
    sc_game pop
    if {$include} { incr numIncluded } else { incr numExcluded }
  }
  if {$numIncluded == 0} {
      tk_messageBox -parent $repwin -type ok -icon info -title "Scid" \
        -message "The repertoire you want to search for has no included lines, so it cannot possibly match any games."
    return
  }

  set w .searchRep
  toplevel $w
  wm title $w "Scid: $::tr(RepSearch)"
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.search invoke"
  bind $w <F1> {helpWindow Repertoire Search}

  pack [label $w.l -anchor w] -side top -fill x
  set t "$::tr(RepSearch): $numIncluded $::tr(RepIncludedLines), "
  append t "$numExcluded $::tr(RepExcludedLines)"
  $w.l configure -text $t

  search_addFilterOpFrame $w
  addHorizontalRule $w

  canvas $w.progress -height 20 -width 300 -bg white -relief solid -border 1
  $w.progress create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.progress create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  frame $w.b
  pack $w.b -side top -ipady 5 -fill x

  set ::_searchRep $repwin
  button $w.b.search -textvar ::tr(Search) -command {
    busyCursor .
    grab .searchRep.b.cancel
    sc_progressBar .searchRep.progress bar 301 21 time
    .searchRep.b.cancel configure -command sc_progressBar
    set err [catch {sc_search repertoire go $filterOp} result]
    sc_search repertoire clear
    unbusyCursor .
    grab release .searchRep.b.cancel
    grab release .searchRep
    focus .repWin
    destroy .searchRep
    if {$err} {
      tk_messageBox -parent $::_searchRep -type ok -icon info -title "Scid" \
        -message $result
    } else {
      set ::rep::_data($::_searchRep:status) "  $::tr(RepSearch): $result"
    }
    set glstart 1
    updateGList
    updateStatsWin
  }
  button $w.b.cancel -textvar ::tr(Cancel) \
    -command "grab release $w; focus $repwin; destroy $w"
  pack $w.b.cancel $w.b.search -side right -pady 5 -padx 5
  pack $w.progress -side bottom
  wm resizable $w 0 0
  grab $w
}


# Images and bitmaps used in heirarchical repertoire view.
# I found the open and closed folder images used at the sourceforge.net
# website, but i hope to find or create nicer-looking ones...

image create photo ::rep::_closedgroup -data {
R0lGODdhDwANAIQAAP7+/AICBMa6la6ehJaJda6ihPbu6ubcwNbGtN7V2c7Dp97Opc66m8a1
lLaniu7q2Xp0cHJuW+7m1LaulKaYfL6zl25mWJ6ObYJ5a1pVTQAAAAAAAAAAAAAAAAAAAAAA
ACwAAAAADwANAAAFYSAgjmQ5BmhgkoEwuOoaDARdEGkqBsbR/wZE4qBQBQ6CBUO5EDQcAhwg
8GgynVAHxHhYLgWCbCFilDAbYUFhQiFPu4tK2uGgUCzlBRpaqF8IeG8QBBgUGIQRFhYZMTmO
OiEAOw==
}

#image create photo ::rep::_oldgroup -data {
#R0lGODdhEAAPAMIAAP////j4+Hh4eLi4uPj4AAAAAAAAAAAAACwAAAAAEAAPAAADPAi63BBB
#SAlrfWIQPYS92SZ2EwUIjiMUJzC+2tpy8CajNX0DdG+zOJ8OyMv9WsYYsMQssQKFqHQ6TVkV
#CQA7
#}

image create photo ::rep::_opengroup -data {
R0lGODdhDwANAKUAAP7+/O7u7M7OzDo6NN7e3PLy5J6enNbW1K6urH5+fDo2LIZ+bK6qnJaW
lGpqbFZSRF5eXG5ubG5mVLaunNLOxObm4HpyZGJiXA4ODBoWFJaOfHZuXI6GdObi3OLi5EpG
RJqOfMrKzNrWzPb27Pr69CIiHH52ZJqSfBoaFFpWT4J6ZN7azCoqLGZeVKqqrLq2pO7q5IaG
hKKahL6+vFZWVGpmVD4+PJKKdAYGBAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAADwANAAAG
kkCAcBgQCAYDwrBgOAAQhoRCsWA0BAaD4wGJQB6SCYVSsVwemIxmseF0PAUA5ONYgDIhhUY0
IhESJSYcICcnKAQpKisADSwtIBonGpMZAC4fLyMoJyCdkJMoAB0RGzAZhJKchJUAMS0yKJOy
HA8lM0M0JhmFnDU2BkNCBimnIDUPN8HBLCgWCgnAykMHODQCAdJBADs=
}

image create photo ::rep::_tick -data {
R0lGODdhEAAQAKEAAP///wAAAFFR+wAAACwAAAAAEAAQAAACMISPacHtvpQKUSIKsBQiV8V1
mIaEFWmYJ8Cl7TGynQpH4XtV9/ThuWepZR5ERtBSAAA7
}

image create photo ::rep::_cross -data {
R0lGODdhEAAQAKEAAP///wAAAPoTQAAAACwAAAAAEAAQAAACL4SPacHtvpQKUSIKsFA7V9EZ
YIUBoxliJXqSSeseIKzKXVujyJlbse/JPIYMoKQAADs=
}

set maskdata "#define solid_width 9\n#define solid_height 9"
append maskdata {
  static unsigned char solid_bits[] = {
   0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01, 0xff, 0x01,
   0xff, 0x01, 0xff, 0x01, 0xff, 0x01
  };
}

set data "#define open_width 9\n#define open_height 9"
append data {
  static unsigned char open_bits[] = {
   0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
   0x01, 0x01, 0x01, 0x01, 0xff, 0x01
  };
}

image create bitmap ::rep::_shown -data $data -maskdata $maskdata \
  -foreground black -background white

set data "#define closed_width 9\n#define closed_height 9"
append data {
  static unsigned char closed_bits[] = {
   0xff, 0x01, 0x01, 0x01, 0x11, 0x01, 0x11, 0x01, 0x7d, 0x01, 0x11, 0x01,
   0x11, 0x01, 0x01, 0x01, 0xff, 0x01
  };
}

image create bitmap ::rep::_hidden -data $data -maskdata $maskdata \
  -foreground black -background white

###
### End of file: reper.tcl
###
### lang.tcl: Support for multiple-language menus, buttons, etc.
### Part of Scid. Copyright 2001 Shane Hudson.

array set langEncoding {}
set languages {}

if {[catch {encoding names}]} {
  set hasEncoding 0
} else {
  set hasEncoding 1
}

proc addLanguage {letter name underline {encodingSystem ""}} {
  global langEncoding languages
  .menu.options.language add radiobutton -label $name \
    -underline $underline -variable language -value $letter \
    -command setLanguage
  set ::langEncoding($letter) $encodingSystem
  lappend languages $letter
}

# menuText:
#    Assigns the menu name and help message for a menu entry and language.
#
proc menuText {lang tag label underline {helpMsg ""}} {
  global hasEncoding langEncoding
  if {$hasEncoding  &&  $langEncoding($lang) != ""} {
    catch {set label [encoding convertfrom $langEncoding($lang) $label]}
    catch {set helpMsg [encoding convertfrom $langEncoding($lang) $helpMsg]}
  }
  set ::menuLabel($lang,$tag) $label
  set ::menuUnder($lang,$tag) $underline
  if {$helpMsg != ""} {
    set ::helpMessage($lang,$tag) $helpMsg
  }
}


# helpMsg:
#    Assigns the help message for a particular language for a button.
#
proc helpMsg {lang button message} {
  global hasEncoding langEncoding
  if {$hasEncoding  &&  $langEncoding($lang) != ""} {
    catch {set message [encoding convertfrom $langEncoding($lang) $message]}
  }
  set ::helpMessage($lang,$button) $message
}

array set tr {}
array set translations {}

# translate:
#    Assigns a translation for future reference.
#
proc translate {lang tag label} {
  global menuLabel hasEncoding langEncoding
  if {$hasEncoding  &&  $langEncoding($lang) != ""} {
    catch {set label [encoding convertfrom $langEncoding($lang) $label]}
  }
  set ::translations($lang,$tag) $label
  set ::tr($tag) $label
  foreach extra {":" "..."} {
    set newtag "${tag}${extra}"
    set newlabel "${label}${extra}"
    set ::translations($lang,$newtag) $newlabel
    set ::tr($newtag) $newlabel
  }
}

# translateECO:
#    Given a pair list of ECO opening name phrase translations,
#    assigns the translations for furute reference.
#
proc translateECO {lang pairList} {
  global hasEncoding langEncoding
  foreach {from to} $pairList {
    if {$hasEncoding  &&  $langEncoding($lang) != ""} {
      catch {set to [encoding convertfrom $langEncoding($lang) $to]}
    }
    sc_eco translate $lang $from $to
  }
}

# tr:
#    Given a tag and language, returns the stored text for that tag.
#
proc tr {tag {lang ""}} {
  global menuLabel
  if {$lang == ""} {set lang $::language}
  if {$lang == "X"} {return $tag}
  if {[info exists menuLabel($lang,$tag)]} {
    return $menuLabel($lang,$tag)
  }
  if {[info exists menuLabel(E,$tag)]} {
    return $menuLabel(E,$tag)
  }
  return $tag
}

proc setLanguage {{lang ""}} {
  global menuLabel menuUnder oldLang

  if {$lang == ""} {set lang $::language}

  if {[catch {setLanguage_$lang} err]} { puts "Error: $err" }

  # If using Tk, translate all menus:
  if {! [catch {winfo exists .}]} { setLanguageMenus $lang }

  foreach i [array names ::tr] {
    if {[info exists ::translations($lang,$i)]} {
      set ::tr($i) $::translations($lang,$i)
    } elseif {[info exists ::translations(E,$i)]} {
      set ::tr($i) $::translations(E,$i)
    }
  }
  set oldLang $lang
}


### End of file: lang.tcl

# english.tcl:
# Text for menu names and status bar help messages in English.
# Part of Scid (Shane's Chess Information Database).
#
# Instructions for adding a new language:
#
# (1) Choose a letter code for the language. Currently assigned codes are:
#      E=English, D=Deutsch, F=Francais, S=Spanish, P=Polish,
#      N=Nederlands, C=Czech.
#
# (2) Edit the code below that has the lines "addLanguage ..." and add your
#     new language. The final digit in each line is the index of the
#     letter to underline in the menu, counting from 0 as the first letter.
#
# (3) Copy the section of English menu and help message details below (all
#     the commands that start "menuText E ..." or "helpMsg E ..." or
#     "translate E ...") and change all the "E" letters to the letter you
#     assigned for the new language.
#
# (4) Write the translations. This involves changing anything "in quotes"
#     or {in braces} for the menuText, helpMsg and translate commands.
#
#     A menu command has the format:
#         menuText L tag "Name..." underline {HelpMessage...}
#
#     A status bar help message for a button has the format:
#         helpMsg L tag {HelpMessage...}
#
#     A general word or message translation has the format:
#         translate L tag {message...}
#
#     where "L" is the language letter, "tag" is the name of the menu entry
#     or the button widget name, and "underline" is the index of the letter
#     to underline, counting from zero as the first letter. Two menu entries
#     that appear in the same menu should have a different underlined letter.
#     If in doubt, just make them all "0" and I'll assign sensible underlined
#     letters when your translations are incorporated into Scid.
#
# Additions, corrections? Email: shane@cosc.canterbury.ac.nz


addLanguage E English 0

proc setLanguage_E {} {

# File menu:
menuText E File "File" 0
menuText E FileNew "New..." 0 {Create a new Scid database}
menuText E FileOpen "Open..." 0 {Open an existing Scid database}
menuText E FileClose "Close" 0 {Close the active Scid database}
menuText E FileFinder "Finder" 0 {Open the File Finder window}
menuText E FileBookmarks "Bookmarks" 0 {Bookmarks menu (shortcut: Ctrl+B)}
menuText E FileBookmarksAdd "Add bookmark" 0 \
  {Bookmark the current database game and position}
menuText E FileBookmarksFile "File bookmark" 0 \
  {File a bookmark for the current game and position}
menuText E FileBookmarksEdit "Edit bookmarks..." 0 \
  {Edit the bookmarks menus}
menuText E FileBookmarksList "Display folders as single list" 0 \
  {Display bookmark folders as a single list, not submenus}
menuText E FileBookmarksSub "Display folders as submenus" 0 \
  {Display bookmark folders as submenus, not a single list}
menuText E FileMaint "Maintenance" 0 {Scid database maintenance tools}
menuText E FileMaintWin "Maintenance Window" 0 \
  {Open/close the Scid database maintenance window}
menuText E FileMaintCompact "Compact database..." 0 \
  {Compact database files, removing deleted games and unused names}
menuText E FileMaintClass "ECO-Classify games..." 2 \
  {Recompute the ECO code of all games}
menuText E FileMaintSort "Sort database..." 0 \
  {Sort all games in the database}
menuText E FileMaintDelete "Delete twin games..." 0 \
  {Find twin games and set them to be deleted}
menuText E FileMaintTwin "Twin checker window" 0 \
  {Open/update the Twin checker window}
menuText E FileMaintName "Name spelling" 0 {Name editing and spelling tools}
menuText E FileMaintNameEditor "Name editor" 0 \
  {Open/close the name editor window}
menuText E FileMaintNamePlayer "Spellcheck Player names..." 11 \
  {Spellcheck player names using the spellcheck file}
menuText E FileMaintNameEvent "Spellcheck Event names..." 11 \
  {Spellcheck event names using the spellcheck file}
menuText E FileMaintNameSite "Spellcheck Site names..." 11 \
  {Spellcheck site names using the spellcheck file}
menuText E FileMaintNameRound "Spellcheck Round names..." 11 \
  {Spellcheck round names using the spellcheck file}
menuText E FileReadOnly "Read-only..." 0 \
  {Treat the current database as read-only, preventing changes}
menuText E FileExit "Exit" 1 {Exit Scid}

# Edit menu:
menuText E Edit "Edit" 0
menuText E EditAdd "Add Variation" 0 {Add a variation at this move in the game}
menuText E EditDelete "Delete Variation" 0 {Delete a variation for this move}
menuText E EditFirst "Make First Variation" 5 \
  {Promote a variation to be first in the list}
menuText E EditMain "Promote Variation to Main line" 21 \
  {Promote a variation to be the main line}
menuText E EditTrial "Try variation" 0 \
  {Start/stop trial mode, for testing an idea on the board}
menuText E EditStrip "Strip" 2 {Strip comments or variations from this game}
menuText E EditStripComments "Comments" 0 \
  {Strip all comments and annotations from this game}
menuText E EditStripVars "Variations" 0 {Strip all variations from this game}
menuText E EditReset "Empty Clipbase" 0 \
  {Reset the clipbase to be completely empty}
menuText E EditCopy "Copy this game to Clipbase" 0 \
  {Copy this game to the Clipbase database}
menuText E EditPaste "Paste last Clipbase game" 0 \
  {Paste the active Clipbase game here}
menuText E EditSetup "Setup start board..." 0 \
  {Set the start position for this game}
menuText E EditPasteBoard "Paste start board" 12 \
  {Set the start board from the current text selection (clipboard)}

# Game menu:
menuText E Game "Game" 0
menuText E GameNew "New game" 0 \
  {Reset to an empty game, discarding any changes}
menuText E GameFirst "Load First Game" 5 {Load the first filtered game}
menuText E GamePrev "Load Previous Game" 5 {Load the previous filtered game}
menuText E GameReload "Re-Load Current Game" 3 \
  {Reload this game, discarding any changes made}
menuText E GameNext "Load Next Game" 7 {Load the next filtered game}
menuText E GameLast "Load Last Game" 8 {Load the last filtered game}
menuText E GameRandom "Load Random Game" 8 {Load a random filtered game}
menuText E GameNumber "Load Game Number..." 5 \
  {Load a game by entering its number}
menuText E GameReplace "Save: Replace game..." 6 \
  {Save this game, replacing the old version}
menuText E GameAdd "Save: Add new game..." 6 \
  {Save this game as a new game in the database}
menuText E GameDeepest "Identify opening" 0 \
  {Goto the deepest game position listed in the ECO book}
menuText E GameGotoMove "Goto move number..." 5 \
  {Go to a specified move number in the current game}
menuText E GameNovelty "Find Novelty..." 7 \
  {Find the first move of this game that has not played before}

# Search Menu:
menuText E Search "Search" 0
menuText E SearchReset "Reset Filter" 0 {Reset the filter so all games are included}
menuText E SearchNegate "Negate Filter" 0 {Negate the filter to only include excluded games}
menuText E SearchCurrent "Current Board..." 0 {Search for the current board position}
menuText E SearchHeader "Header..." 0 {Search by Header (player, event, etc) information}
menuText E SearchMaterial "Material/Pattern..." 0 {Search for material or board patterns}
menuText E SearchUsing "Using search file..." 0 {Search using a SearchOptions file}

# Windows menu:
menuText E Windows "Windows" 0
menuText E WindowsComment "Comment editor" 0 {Open/close the comment editor}
menuText E WindowsGList "Game List" 0 {Open/close the game list window}
menuText E WindowsPGN "PGN window" 0 \
  {Open/close the PGN (game notation) window}
menuText E WindowsTmt "Tournament Finder" 2 {Open/close the tournament finder}
menuText E WindowsSwitcher "Database switcher" 0 \
  {Open/close the Database Switcher window}
menuText E WindowsMaint "Maintenance window" 0 \
  {Open/close the Maintenance window}
menuText E WindowsECO "ECO Browser" 0 {Open/close the ECO Browser window}
menuText E WindowsRepertoire "Repertoire editor" 0 \
  {Open/close the opening repertoire editor}
menuText E WindowsStats "Statistics window" 0 \
  {Open/close the filter statistics window}
menuText E WindowsTree "Tree window" 0 {Open/close the Tree window}
menuText E WindowsTB "Endgame Tablebase window" 1 \
  {Open/close the Tablebase window}

# Tools menu:
menuText E Tools "Tools" 0
menuText E ToolsAnalysis "Analysis engine..." 0 \
  {Start/stop a chess analysis engine}
menuText E ToolsAnalysis2 "Analysis engine #2..." 17 \
  {Start/stop the 2nd chess analysis engine}
menuText E ToolsCross "Crosstable" 0 {Show tournament crosstable for this game}
menuText E ToolsEmail "Email manager" 0 \
  {Open/close the email chess manager window}
menuText E ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window}
menuText E ToolsOpReport "Opening report" 0 \
  {Generate an opening report for the current position}
menuText E ToolsTracker "Piece Tracker"  6 {Open the Piece Tracker window}
menuText E ToolsPInfo "Player Information"  0 \
  {Open/update the Player Information window}
menuText E ToolsRating "Rating graph" 0 \
  {Graph the rating history of the current game players}
menuText E ToolsScore "Score graph" 0 {Show the score graph window}
menuText E ToolsExpCurrent "Export current game" 8 \
  {Write current game to a text file}
menuText E ToolsExpCurrentPGN "Export game to PGN file..." 15 \
  {Write current game to a PGN file}
menuText E ToolsExpCurrentHTML "Export game to HTML file..." 15 \
  {Write current game to a HTML file}
menuText E ToolsExpCurrentLaTeX "Export game to LaTeX file..." 15 \
  {Write current game to a LaTeX file}
menuText E ToolsExpFilter "Export all filter games" 1 \
  {Write all filtered games to a text file}
menuText E ToolsExpFilterPGN "Export filter to PGN file..." 17 \
  {Write all filtered games to a PGN file}
menuText E ToolsExpFilterHTML "Export filter to HTML file..." 17 \
  {Write all filtered games to a HTML file}
menuText E ToolsExpFilterLaTeX "Export filter to LaTeX file..." 17 \
  {Write all filtered games to a LaTeX file}
menuText E ToolsImportOne "Import one PGN game..." 0 \
  {Import a game from PGN text}
menuText E ToolsImportFile "Import file of PGN games..." 7 \
  {Import games from a PGN file}

# Options menu:
menuText E Options "Options" 0
menuText E OptionsSize "Board Size" 0 {Change the board size}
menuText E OptionsPieces "Board Piece Style" 6 {Change the board piece style}
menuText E OptionsColors "Colors..." 0 {Change board colors}
menuText E OptionsExport "Exporting" 0 {Change text export options}
menuText E OptionsFonts "Fonts" 0 {Change fonts}
menuText E OptionsFontsRegular "Regular" 0 {Change the regular font}
menuText E OptionsFontsMenu "Menu" 0 {Change the menu font}
menuText E OptionsFontsSmall "Small" 0 {Change the small font}
menuText E OptionsFontsFixed "Fixed" 0 {Change the fixed-width font}
menuText E OptionsGInfo "Game information" 0 {Game information options}
menuText E OptionsLanguage "Language" 0 {Select menu language}
menuText E OptionsMoves "Moves" 0 {Move entry options}
menuText E OptionsMovesAsk "Ask before replacing moves" 0 \
  {Ask before overwriting any existing moves}
menuText E OptionsMovesDelay "Autoplay time delay..." 1 \
  {Set the time delay for autoplay mode}
menuText E OptionsMovesCoord "Coordinate move entry" 0 \
  {Accept coordinate-style move entry ("g1f3")}
menuText E OptionsMovesSuggest "Show suggested moves" 0 \
  {Turn on/off move suggestion}
menuText E OptionsMovesKey "Keyboard completion" 0 \
  {Turn on/off keyboard move auto-completion}
menuText E OptionsNumbers "Number format" 0 {Select the number format}
menuText E OptionsStartup "Startup" 3 {Select windows to open at startup}
menuText E OptionsWindows "Windows" 0 {Window options}
menuText E OptionsWindowsIconify "Auto-iconify" 5 \
  {Iconify all windows when the main window is iconified}
menuText E OptionsWindowsRaise "Auto-raise" 5 \
  {Raise certain windows (e.g. progress bars) whenever they are obscured}
menuText E OptionsToolbar "Toolbar" 0 {Configure the main window toolbar}
menuText E OptionsECO "Load ECO file..." 7 {Load the ECO classification file}
menuText E OptionsSpell "Load Spellcheck file..." 11 \
  {Load the Scid spellcheck file}
menuText E OptionsTable "Tablebase directory..." 10 \
  {Select a tablebase file; all tablebases in its directory will be used}
menuText E OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu}
menuText E OptionsSave "Save Options" 0 \
  "Save all settable options to the file $::optionsFile"
menuText E OptionsAutoSave "Auto-save Options on Exit" 0 \
  {Auto-save all options when exiting Scid}

# Help menu:
menuText E Help "Help" 0
menuText E HelpIndex "Index" 0 {Show the help index page}
menuText E HelpGuide "Quick Guide" 0 {Show the quick guide help page}
menuText E HelpHints "Hints" 0 {Show the hints help page}
menuText E HelpContact "Contact info" 0 {Show the contact information help page}
menuText E HelpTip "Tip of the day" 0 {Show a useful Scid tip}
menuText E HelpStartup "Startup window" 0 {Show the startup window}
menuText E HelpAbout "About Scid" 0 {Information about Scid}

# Game info box popup menu:
menuText E GInfoHideNext "Hide next move" 0
menuText E GInfoMaterial "Show material values" 0
menuText E GInfoFEN "Show FEN" 5
menuText E GInfoMarks "Show colored squares and arrows" 5
menuText E GInfoWrap "Wrap long lines" 0
menuText E GInfoFullComment "Show Full Comment" 10
menuText E GInfoTBNothing "Tablebases: nothing" 12
menuText E GInfoTBResult "Tablebases: result only" 12
menuText E GInfoTBAll "Tablebases: result and best moves" 19
menuText E GInfoDelete "(Un)Delete this game" 4
menuText E GInfoMark "(Un)Mark this game" 4

# Main window buttons:
helpMsg E .button.start {Go to start of game  (key: Home)}
helpMsg E .button.end {Go to end of game  (key: End)}
helpMsg E .button.back {Go back one move  (key: LeftArrow)}
helpMsg E .button.forward {Go forward one move  (key: RightArrow)}
helpMsg E .button.intoVar {Move into a variation  (shortcut key: v)}
helpMsg E .button.exitVar {Leave the current variation  (shortcut key: z)}
helpMsg E .button.flip {Rotate board  (shortcut key: .)}
helpMsg E .button.coords {Turn board coordinates on or off  (shortcut key: 0)}
helpMsg E .button.autoplay {Autoplay moves  (key: Ctrl+Z)}

# General buttons:
translate E Back {Back}
translate E Cancel {Cancel}
translate E Clear {Clear}
translate E Close {Close}
translate E Defaults {Defaults}
translate E Delete {Delete}
translate E Graph {Graph}
translate E Help {Help}
translate E Import {Import}
translate E Index {Index}
translate E LoadGame {Load game}
translate E BrowseGame {Browse game}
translate E MergeGame {Merge game}
translate E Preview {Preview}
translate E Revert {Revert}
translate E Save {Save}
translate E Search {Search}
translate E Stop {Stop}
translate E Store {Store}
translate E Update {Update}
translate E ChangeOrient {Change window orientation}
translate E None {None}
translate E First {First}
translate E Current {Current}
translate E Last {Last}

# General messages:
translate E game {game}
translate E games {games}
translate E move {move}
translate E moves {moves}
translate E all {all}
translate E Yes {Yes}
translate E No {No}
translate E Both {Both}
translate E King {King}
translate E Queen {Queen}
translate E Rook {Rook}
translate E Bishop {Bishop}
translate E Knight {Knight}
translate E Pawn {Pawn}
translate E White {White}
translate E Black {Black}
translate E Player {Player}
translate E Rating {Rating}
translate E RatingDiff {Rating difference (White - Black)}
translate E Event {Event}
translate E Site {Site}
translate E Country {Country}
translate E IgnoreColors {Ignore colors}
translate E Date {Date}
translate E EventDate {Event date}
translate E Decade {Decade}
translate E Year {Year}
translate E Month {Month}
translate E Months {January February March April May June
  July August September October November December}
translate E Days {Sun Mon Tue Wed Thu Fri Sat}
translate E YearToToday {Year to today}
translate E Result {Result}
translate E Round {Round}
translate E Length {Length}
translate E ECOCode {ECO code}
translate E ECO {ECO}
translate E Deleted {Deleted}
translate E SearchResults {Search Results}
translate E OpeningTheDatabase {Opening database}
translate E Database {Database}
translate E Filter {Filter}
translate E noGames {no games}
translate E allGames {all games}
translate E empty {empty}
translate E clipbase {clipbase}
translate E score {score}
translate E StartPos {Start position}
translate E Total {Total}

# Game information:
translate E twin {twin}
translate E deleted {deleted}
translate E comment {comment}
translate E hidden {hidden}
translate E LastMove {Last move}
translate E NextMove {Next}
translate E GameStart {Start of game}
translate E LineStart {Start of line}
translate E GameEnd {End of game}
translate E LineEnd {End of line}

# Player information:
translate E PInfoAll {Results for <b>all</b> games}
translate E PInfoFilter {Results for <b>filter</b> games}
translate E PInfoAgainst {Results against}
translate E PInfoMostWhite {Most common openings as White}
translate E PInfoMostBlack {Most common openings as Black}
translate E PInfoRating {Rating history}
translate E PInfoBio {Biography}

# Tablebase information:
translate E Draw {Draw}
translate E stalemate {stalemate}
translate E withAllMoves {with all moves}
translate E withAllButOneMove {with all but one move}
translate E with {with}
translate E only {only}
translate E lose {lose}
translate E loses {loses}
translate E allOthersLose {all others lose}
translate E matesIn {mates in}
translate E hasCheckmated {has checkmated}
translate E longest {longest}

# Tip of the day:
translate E Tip {Tip}
translate E TipAtStartup {Tip at startup}

# Tree window menus:
menuText E TreeFile "File" 0
menuText E TreeFileSave "Save cache file" 0 {Save the tree cache (.stc) file}
menuText E TreeFileFill "Fill cache file" 0 \
  {Fill the cache file with common opening positions}
menuText E TreeFileBest "Best games list" 0 {Show the best tree games list}
menuText E TreeFileGraph "Graph window" 0 {Show the graph for this tree branch}
menuText E TreeFileCopy "Copy tree text to clipboard" 1 \
  {Copy the tree statisctics to the clipboard}
menuText E TreeFileClose "Close tree window" 0 {Close the tree window}
menuText E TreeSort "Sort" 0
menuText E TreeSortAlpha "Alphabetical" 0
menuText E TreeSortECO "ECO code" 0
menuText E TreeSortFreq "Frequency" 0
menuText E TreeSortScore "Score" 0
menuText E TreeOpt "Options" 0
menuText E TreeOptLock "Lock" 0 {Lock/unlock the tree to the current database}
menuText E TreeOptTraining "Training" 0 {Turn on/off tree training mode}
menuText E TreeOptAutosave "Auto-save cache file" 0 \
  {Auto-save the cache file when closing the tree window}
menuText E TreeHelp "Help" 0
menuText E TreeHelpTree "Tree help" 0
menuText E TreeHelpIndex "Help index" 0
translate E SaveCache {Save cache}
translate E Training {Training}
translate E LockTree {Lock}
translate E TreeLocked {locked}
translate E TreeBest {Best}
translate E TreeBestGames {Best tree games}

# Finder window:
menuText E FinderFile "File" 0
menuText E FinderFileSubdirs "Look in subdirectories" 0
menuText E FinderFileClose "Close File Finder" 0
menuText E FinderSort "Sort" 0
menuText E FinderSortType "Type" 0
menuText E FinderSortSize "Size" 0
menuText E FinderSortMod "Modified" 0
menuText E FinderSortName "Name" 0
menuText E FinderSortPath "Path" 0
menuText E FinderTypes "Types" 0
menuText E FinderTypesScid "Scid databases" 0
menuText E FinderTypesOld "Old-format Scid databases" 0
menuText E FinderTypesPGN "PGN files" 0
menuText E FinderTypesEPD "EPD files" 0
menuText E FinderTypesRep "Repertoire files" 0
menuText E FinderHelp "Help" 0
menuText E FinderHelpFinder "File Finder help" 0
menuText E FinderHelpIndex "Help index" 0
translate E FileFinder {File Finder}
translate E FinderDir {Directory}
translate E FinderDirs {Directories}
translate E FinderFiles {Files}
translate E FinderUpDir {up}

# Tournament finder:
menuText E TmtFile "File" 0
menuText E TmtFileUpdate "Update" 0
menuText E TmtFileClose "Close Tournament Finder" 0
menuText E TmtSort "Sort" 0
menuText E TmtSortDate "Date" 0
menuText E TmtSortPlayers "Players" 0
menuText E TmtSortGames "Games" 0
menuText E TmtSortElo "Elo" 0
menuText E TmtSortSite "Site" 0
menuText E TmtSortEvent "Event" 1
menuText E TmtSortWinner "Winner" 0
translate E TmtLimit "List limit"
translate E TmtMeanElo "Lowest mean Elo"
translate E TmtNone "No matching tournaments were found."

# Graph windows:
menuText E GraphFile "File" 0
menuText E GraphFileColor "Save as Color PostScript..." 8
menuText E GraphFileGrey "Save as Greyscale PostScript..." 8
menuText E GraphFileClose "Close window" 6
menuText E GraphOptions "Options" 0
menuText E GraphOptionsWhite "White" 0
menuText E GraphOptionsBlack "Black" 0
menuText E GraphOptionsBoth "Both" 1
menuText E GraphOptionsPInfo "Player Info player" 0
translate E GraphFilterTitle "Filter graph: frequency per 1000 games"

# Analysis window:
translate E AddVariation {Add variation}
translate E AddMove {Add move}
translate E Annotate {Annotate}
translate E AnalysisCommand {Analysis command}
translate E PreviousChoices {Previous choices}
translate E AnnotateTime {Set the time between moves in seconds}
translate E AnnotateWhich {Add variations}
translate E AnnotateAll {For moves by both sides}
translate E AnnotateWhite {For White moves only}
translate E AnnotateBlack {For Black moves only}
translate E AnnotateNotBest {When game move is not best move}

# Analysis Engine open dialog:
translate E EngineList {Analysis Engine List}
translate E EngineName {Name}
translate E EngineCmd {Command}
translate E EngineArgs {Parameters}
translate E EngineDir {Directory}
translate E EngineElo {Elo}
translate E EngineTime {Date}
translate E EngineNew {New}
translate E EngineEdit {Edit}
translate E EngineRequired {Fields in bold are required; others are optional}

# Stats window menus:
menuText E StatsFile "File" 0
menuText E StatsFilePrint "Print to file..." 0
menuText E StatsFileClose "Close window" 0
menuText E StatsOpt "Options" 0

# PGN window menus:
menuText E PgnFile "File" 0
menuText E PgnFilePrint "Print to file..." 0
menuText E PgnFileClose "Close PGN window" 0
menuText E PgnOpt "Display" 0
menuText E PgnOptColor "Color display" 0
menuText E PgnOptShort "Short (3-line) header" 0
menuText E PgnOptSymbols "Symbolic annotations" 1
menuText E PgnOptIndentC "Indent comments" 0
menuText E PgnOptIndentV "Indent variations" 7
menuText E PgnOptColumn "Column style (one move per line)" 1
menuText E PgnOptSpace "Space after move numbers" 1
menuText E PgnOptStripMarks "Strip out colored square/arrow codes" 1
menuText E PgnColor "Colors" 0
menuText E PgnColorHeader "Header..." 0
menuText E PgnColorAnno "Annotations..." 0
menuText E PgnColorComments "Comments..." 0
menuText E PgnColorVars "Variations..." 0
menuText E PgnColorBackground "Background..." 0
menuText E PgnHelp "Help" 0
menuText E PgnHelpPgn "PGN help" 0
menuText E PgnHelpIndex "Index" 0

# Crosstable window menus:
menuText E CrosstabFile "File" 0
menuText E CrosstabFileText "Print to Text file..." 9
menuText E CrosstabFileHtml "Print to HTML file..." 9
menuText E CrosstabFileLaTeX "Print to LaTeX file..." 9
menuText E CrosstabFileClose "Close Crosstable window" 0
menuText E CrosstabEdit "Edit" 0
menuText E CrosstabEditEvent "Event" 0
menuText E CrosstabEditSite "Site" 0
menuText E CrosstabEditDate "Date" 0
menuText E CrosstabOpt "Display" 0
menuText E CrosstabOptAll "All-play-all" 0
menuText E CrosstabOptSwiss "Swiss" 0
menuText E CrosstabOptKnockout "Knockout" 0
menuText E CrosstabOptAuto "Auto" 1
menuText E CrosstabOptAges "Ages in years" 8
menuText E CrosstabOptNats "Nationalities" 0
menuText E CrosstabOptRatings "Ratings" 0
menuText E CrosstabOptTitles "Titles" 0
menuText E CrosstabOptBreaks "Tie-break scores" 4
menuText E CrosstabOptDeleted "Include deleted games" 8
menuText E CrosstabOptColors "Colors (Swiss table only)" 0
menuText E CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2
menuText E CrosstabOptGroup "Group scores" 0
menuText E CrosstabSort "Sort" 0
menuText E CrosstabSortName "Name" 0
menuText E CrosstabSortRating "Rating" 0
menuText E CrosstabSortScore "Score" 0
menuText E CrosstabColor "Color" 0
menuText E CrosstabColorPlain "Plain text" 0
menuText E CrosstabColorHyper "Hypertext" 0
menuText E CrosstabHelp "Help" 0
menuText E CrosstabHelpCross "Crosstable help" 0
menuText E CrosstabHelpIndex "Help index" 0
translate E SetFilter {Set Filter}
translate E AddToFilter {Add to Filter}
translate E Swiss {Swiss}

# Opening report window menus:
menuText E OprepFile "File" 0
menuText E OprepFileText "Print to Text file..." 9
menuText E OprepFileHtml "Print to HTML file..." 9
menuText E OprepFileLaTeX "Print to LaTeX file..." 9
menuText E OprepFileOptions "Options..." 0
menuText E OprepFileClose "Close report window" 0
menuText E OprepHelp "Help" 0
menuText E OprepHelpReport "Opening Report help" 0
menuText E OprepHelpIndex "Help index" 0

# Repertoire editor:
menuText E RepFile "File" 0
menuText E RepFileNew "New" 0
menuText E RepFileOpen "Open..." 0
menuText E RepFileSave "Save..." 0
menuText E RepFileSaveAs "Save As..." 5
menuText E RepFileClose "Close window" 0
menuText E RepEdit "Edit" 0
menuText E RepEditGroup "Add Group" 4
menuText E RepEditInclude "Add Include line" 4
menuText E RepEditExclude "Add Exclude line" 4
menuText E RepView "View" 0
menuText E RepViewExpand "Expand all groups" 0
menuText E RepViewCollapse "Collapse all groups" 0
menuText E RepSearch "Search" 0
menuText E RepSearchAll "All of repertoire..." 0
menuText E RepSearchDisplayed "Displayed lines only..." 0
menuText E RepHelp "Help" 0
menuText E RepHelpRep "Repertoire help" 0
menuText E RepHelpIndex "Help index" 0
translate E RepSearch "Repertoire search"
translate E RepIncludedLines "included lines"
translate E RepExcludedLines "excluded lines"
translate E RepCloseDialog {This repertoire has unsaved changes.

Do you really want to continue and discard the changes you have made?
}

# Header search:
translate E HeaderSearch {Header Search}
translate E GamesWithNoECO {Games with no ECO?}
translate E GameLength {Game length}
translate E FindGamesWith {Find games with flags}
translate E StdStart {Non-standard start}
translate E Promotions {Promotions}
translate E Comments {Comments}
translate E Variations {Variations}
translate E Annotations {Annotations}
translate E DeleteFlag {Delete flag}
translate E WhiteOpFlag {White opening}
translate E BlackOpFlag {Black opening}
translate E MiddlegameFlag {Middlegame}
translate E EndgameFlag {Endgame}
translate E NoveltyFlag {Novelty}
translate E PawnFlag {Pawn structure}
translate E TacticsFlag {Tactics}
translate E QsideFlag {Queenside play}
translate E KsideFlag {Kingside play}
translate E BrilliancyFlag {Brilliancy}
translate E BlunderFlag {Blunder}
translate E UserFlag {User}
translate E PgnContains {PGN contains text}

# Game list window:
translate E GlistNumber {Number}
translate E GlistWhite {White}
translate E GlistBlack {Black}
translate E GlistWElo {W-Elo}
translate E GlistBElo {B-Elo}
translate E GlistEvent {Event}
translate E GlistSite {Site}
translate E GlistRound {Round}
translate E GlistDate {Date}
translate E GlistYear {Year}
translate E GlistEDate {EventDate}
translate E GlistResult {Result}
translate E GlistLength {Length}
translate E GlistCountry {Country}
translate E GlistECO {ECO}
translate E GlistOpening {Opening}
translate E GlistEndMaterial {End-Material}
translate E GlistDeleted {Deleted}
translate E GlistFlags {Flags}
translate E GlistVars {Variations}
translate E GlistComments {Comments}
translate E GlistAnnos {Annotations}
translate E GlistStart {Start}
translate E GlistGameNumber {Game number}
translate E GlistFindText {Find text}
translate E GlistMoveField {Move}
translate E GlistEditField {Configure}
translate E GlistAddField {Add}
translate E GlistDeleteField {Remove}
translate E GlistWidth {Width}
translate E GlistAlign {Align}
translate E GlistColor {Color}
translate E GlistSep {Separator}

# Maintenance window:
translate E DatabaseName {Database Name:}
translate E TypeIcon {Type Icon:}
translate E NumOfGames {Games:}
translate E NumDeletedGames {Deleted games:}
translate E NumFilterGames {Games in filter:}
translate E YearRange {Year range:}
translate E RatingRange {Rating range:}
translate E Flag {Flag}
translate E DeleteCurrent {Delete current game}
translate E DeleteFilter {Delete filter games}
translate E DeleteAll {Delete all games}
translate E UndeleteCurrent {Undelete current game}
translate E UndeleteFilter {Undelete filter games}
translate E UndeleteAll {Undelete all games}
translate E DeleteTwins {Delete twin games}
translate E MarkCurrent {Mark current game}
translate E MarkFilter {Mark filter games}
translate E MarkAll {Mark all games}
translate E UnmarkCurrent {Unmark current game}
translate E UnmarkFilter {Unmark filter games}
translate E UnmarkAll {Unmark all games}
translate E Spellchecking {Spell-checking}
translate E Players {Players}
translate E Events {Events}
translate E Sites {Sites}
translate E Rounds {Rounds}
translate E DatabaseOps {Database operations}
translate E ReclassifyGames {ECO-classify games}
translate E CompactDatabase {Compact database}
translate E SortDatabase {Sort database}
translate E AddEloRatings {Add Elo ratings}
translate E AutoloadGame {Autoload game number}
translate E StripTags {Strip PGN tags}
translate E StripTag {Strip tag}
translate E Cleaner {Cleaner}
translate E CleanerHelp {
The Scid Cleaner will perform all the maintenance actions you select from the list below, on the current database.

Current settings in the ECO classification and twin deletion dialogs will apply if you select those functions.
}
translate E CleanerConfirm {
Once Cleaner maintenance is started, it cannot be interrupted!

This may take a long time on a large database, depending on the functions you have selected and their current settings.

Are you sure you want to commence the maintenance functions you selected?
}

# Comment editor:
translate E AnnotationSymbols  {Annotation Symbols:}
translate E Comment {Comment:}

# Board search:
translate E BoardSearch {Board Search}
translate E FilterOperation {Operation on current filter:}
translate E FilterAnd {AND (Restrict filter)}
translate E FilterOr {OR (Add to filter)}
translate E FilterIgnore {IGNORE (Reset filter)}
translate E SearchType {Search type:}
translate E SearchBoardExact {Exact position (all pieces on same squares)}
translate E SearchBoardPawns {Pawns (same material, all pawns on same squares)}
translate E SearchBoardFiles {Files (same material, all pawns on same files)}
translate E SearchBoardAny {Any (same material, pawns and pieces anywhere)}
translate E LookInVars {Look in variations}

# Material search:
translate E MaterialSearch {Material Search}
translate E Material {Material}
translate E Patterns {Patterns}
translate E Zero {Zero}
translate E Any {Any}
translate E CurrentBoard {Current board}
translate E CommonEndings {Common endings}
translate E CommonPatterns {Common patterns}
translate E MaterialDiff {Material difference}
translate E squares {squares}
translate E SameColor {Same color}
translate E OppColor {Opposite color}
translate E Either {Either}
translate E MoveNumberRange {Move number range}
translate E MatchForAtLeast {Match for at least}
translate E HalfMoves {half-moves}

# Game saving:
translate E Today {Today}
translate E ClassifyGame {Classify game}

# Setup position:
translate E EmptyBoard {Empty board}
translate E InitialBoard {Initial board}
translate E SideToMove {Side to move}
translate E MoveNumber {Move number}
translate E Castling {Castling}
translate E EnPassentFile {En Passent file}
translate E ClearFen {Clear FEN}
translate E PasteFen {Paste FEN}

# Replace move dialog:
translate E ReplaceMove {Replace move}
translate E AddNewVar {Add new variation}
translate E ReplaceMoveMessage {A move already exists here.

You can replace it, discarding all moves after it, or add your move as a new variation.

(You can avoid seeing this message in future by turning off the "Ask before replacing moves" option in the Options:Moves menu.)}

# Make database read-only dialog:
translate E ReadOnlyDialog {If you make this database read-only, no changes will be permitted.
No games can be saved or replaced, and no delete flags can be altered.
Any sorting or ECO-classification results will be temporary.

You can easily make the database writable again, by closing and reopening it.

Do you really want to make this database read-only?}

# Clear game dialog:
translate E ClearGameDialog {This game has been altered.

Do you really want to continue and discard the changes made to it?
}

# Exit dialog:
translate E ExitDialog {Do you really want to exit Scid?}
translate E ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.}

# Import window:
translate E PasteCurrentGame {Paste current game}
translate E ImportHelp1 {Enter or paste a PGN-format game in the frame above.}
translate E ImportHelp2 {Any errors importing the game will be displayed here.}

# ECO Browser:
translate E ECOAllSections {all ECO sections}
translate E ECOSection {ECO section}
translate E ECOSummary {Summary for}
translate E ECOFrequency {Frequency of subcodes for}

# Opening Report:
translate E OprepTitle {Opening Report}
translate E OprepReport {Report}
translate E OprepGenerated {Generated by}
translate E OprepStatsHist {Statistics and History}
translate E OprepStats {Statistics}
translate E OprepStatAll {All report games}
translate E OprepStatBoth {Both rated}
translate E OprepStatSince {Since}
translate E OprepOldest {Oldest games}
translate E OprepNewest {Newest games}
translate E OprepPopular {Current popularity}
translate E OprepFreqAll {Frequency in all years:   }
translate E OprepFreq1   {In the  1 year  to today: }
translate E OprepFreq5   {In the  5 years to today: }
translate E OprepFreq10  {In the 10 years to today: }
translate E OprepEvery {once every %u games}
translate E OprepUp {up %u%s from all years}
translate E OprepDown {down %u%s from all years}
translate E OprepSame {no change from all years}
translate E OprepMostFrequent {Most frequent players}
translate E OprepRatingsPerf {Ratings and Performance}
translate E OprepAvgPerf {Average ratings and performance}
translate E OprepWRating {White rating}
translate E OprepBRating {Black rating}
translate E OprepWPerf {White performance}
translate E OprepBPerf {Black performance}
translate E OprepHighRating {Games with highest average rating}
translate E OprepTrends {Result Trends}
translate E OprepResults {Result lengths and frequencies}
translate E OprepLength {Game length}
translate E OprepFrequency {Frequency}
translate E OprepWWins {White wins: }
translate E OprepBWins {Black wins: }
translate E OprepDraws {Draws:      }
translate E OprepWholeDB {whole database}
translate E OprepShortest {Shortest wins}
translate E OprepMovesThemes {Moves and Themes}
translate E OprepMoveOrders {Move orders reaching the report position}
translate E OprepMoveOrdersOne \
  {There was only one move order reaching this position:}
translate E OprepMoveOrdersAll \
  {There were %u move orders reaching this position:}
translate E OprepMoveOrdersMany \
  {There were %u move orders reaching this position. The top %u are:}
translate E OprepMovesFrom {Moves from the report position}
translate E OprepThemes {Positional Themes}
translate E OprepThemeDescription {Frequency of themes at move %u}
translate E OprepThemeSameCastling {Same-side castling}
translate E OprepThemeOppCastling {Opposite castling}
translate E OprepThemeNoCastling {Both Kings uncastled}
translate E OprepThemeKPawnStorm {Kingside pawn storm}
translate E OprepThemeQueenswap {Queens exchanged}
translate E OprepThemeIQP {Isolated Queen Pawn}
translate E OprepThemeWP567 {White Pawn on 5/6/7th rank}
translate E OprepThemeBP234 {Black Pawn on 2/3/4th rank}
translate E OprepThemeOpenCDE {Open c/d/e file}
translate E OprepTheme1BishopPair {Only one side has Bishop pair}
translate E OprepEndgames {Endgames}
translate E OprepReportGames {Report games}
translate E OprepAllGames    {All games}
translate E OprepEndClass {Material at the end of each game}
translate E OprepTheoryTable {Theory Table}
translate E OprepTableComment {Generated from the %u highest-rated games.}
translate E OprepExtraMoves {Extra note moves in theory table}
translate E OprepMaxGames {Maximum games in theory table}

# Piece Tracker window:
translate E TrackerSelectSingle {Left mouse button selects this piece.}
translate E TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate E TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate E TrackerStat {Statistic}
translate E TrackerGames {% games with move to square}
translate E TrackerTime {% time on each square}
translate E TrackerMoves {Moves}
translate E TrackerMovesStart {Enter the move number where tracking should begin.}
translate E TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate E SelectAllGames {All games in the database}
translate E SelectFilterGames {Only games in the filter}
translate E SelectTournamentGames {Only games in the current tournament}
translate E SelectOlderGames {Only older games}

# Delete Twins window:
translate E TwinsNote {To be twins, two games must at least have the same two players, and criteria you can set below. When a pair of twins is found, the shorter game is deleted.
Hint: it is best to spellcheck the database before deleting twins, since it improves twin detection. }
translate E TwinsCriteria {Criteria: Twin games must have...}
translate E TwinsWhich {Examine which games}
translate E TwinsColors {Same player colors?}
translate E TwinsEvent {Same event?}
translate E TwinsSite {Same site?}
translate E TwinsRound {Same round?}
translate E TwinsYear {Same year?}
translate E TwinsMonth {Same month?}
translate E TwinsDay {Same day?}
translate E TwinsResult {Same result?}
translate E TwinsECO {Same ECO code?}
translate E TwinsMoves {Same moves?}
translate E TwinsPlayers {Comparing player names:}
translate E TwinsPlayersExact {Exact match}
translate E TwinsPlayersPrefix {First 4 letters only}
translate E TwinsWhen {When deleting twin games}
translate E TwinsSkipShort {Ignore all games under 5 moves long?}
translate E TwinsUndelete {Undelete all games first?}
translate E TwinsSetFilter {Set filter to all deleted twin games?}
translate E TwinsComments {Always keep games with comments?}
translate E TwinsVars {Always keep games with variations?}
translate E TwinsDeleteWhich {Delete which game:}
translate E TwinsDeleteShorter {Shorter game}
translate E TwinsDeleteOlder {Smaller game number}
translate E TwinsDeleteNewer {Larger game number}
translate E TwinsDelete {Delete games}

# Name editor window:
translate E NameEditType {Type of name to edit}
translate E NameEditSelect {Games to edit}
translate E NameEditReplace {Replace}
translate E NameEditWith {with}
translate E NameEditMatches {Matches: Press Ctrl+1 to Ctrl+9 to select}

# Classify window:
translate E Classify {Classify}
translate E ClassifyWhich {ECO-Classify which games}
translate E ClassifyAll {All games (overwrite old ECO codes)}
translate E ClassifyYear {All games played in the last year}
translate E ClassifyMonth {All games played in the last month}
translate E ClassifyNew {Only games with no ECO code yet}
translate E ClassifyCodes {ECO Codes to use}
translate E ClassifyBasic {Basic codes only ("B12", ...)}
translate E ClassifyExtended {Scid extensions ("B12j", ...)}

# Compaction:
translate E NameFile {Name file}
translate E GameFile {Game file}
translate E Names {Names}
translate E Unused {Unused}
translate E SizeKb {Size (kb)}
translate E CurrentState {Current State}
translate E AfterCompaction {After compaction}
translate E CompactNames {Compact name file}
translate E CompactGames {Compact game file}

# Sorting:
translate E SortCriteria {Criteria}
translate E AddCriteria {Add criteria}
translate E CommonSorts {Common sorts}
translate E Sort {Sort}

# Exporting:
translate E AddToExistingFile {Add games to an existing file?}
translate E ExportComments {Export comments?}
translate E ExportVariations {Export variations?}
translate E IndentComments {Indent comments?}
translate E IndentVariations {Indent variations?}
translate E ExportColumnStyle {Column style (one move per line)?}
translate E ExportSymbolStyle {Symbolic annotation style:}
translate E ExportStripMarks {Strip square/arrow mark codes from comments?}

# Goto game/move dialogs:
translate E LoadGameNumber {Enter the game number to load:}
translate E GotoMoveNumber {Goto move number:}

# Copy games dialog:
translate E CopyGames {Copy games}
translate E CopyConfirm {
 Do you really want to copy
 the [thousands $nGamesToCopy] filtered games
 in the database "$fromName"
 to the database "$targetName"?
}
translate E CopyErr {Cannot copy games}
translate E CopyErrSource {the source database}
translate E CopyErrTarget {the target database}
translate E CopyErrNoGames {has no games in its filter}
translate E CopyErrReadOnly {is read-only}
translate E CopyErrNotOpen {is not open}

# Colors:
translate E LightSquares {Light squares}
translate E DarkSquares {Dark squares}
translate E SelectedSquares {Selected squares}
translate E SuggestedSquares {Suggested move squares}
translate E WhitePieces {White pieces}
translate E BlackPieces {Black pieces}
translate E WhiteBorder {White border}
translate E BlackBorder {Black border}

# Novelty window:
translate E FindNovelty {Find Novelty}
translate E Novelty {Novelty}
translate E NoveltyInterrupt {Novelty search interrupted}
translate E NoveltyNone {No novelty was found for this game}
translate E NoveltyHelp {
Scid will find the first move of the current game that reaches a position not found in the selected database or in the ECO openings book.
}

# Upgrading databases:
translate E Upgrading {Upgrading}
translate E ConfirmOpenNew {
This is an old-format (Scid 2) database that cannot be opened in Scid 3, but a new-format (Scid 3) version has already been created.

Do you want to open the new-format version of the database?
}
translate E ConfirmUpgrade {
This is an old-format (Scid 2) database. A new-format version of the database must be created before it can be used in Scid 3.

Upgrading will create a new version of the database; it will not edit or remove the original files.

This may take a while, but it only needs to be done one time. You can cancel if it takes too long.

Do you want to upgrade this database now?
}

# Recent files options:
translate E RecentFilesMenu {Number of recent files in File menu}
translate E RecentFilesExtra {Number of recent files in extra submenu}

}
# end of english.tcl
### deutsch.tcl:
#  German language support for Scid.
#  Contributors: Bernhard Bialas, Jrgen Clos et al.
#  Untranslated messages are marked with a "***" comment.

addLanguage D Deutsch 0

proc setLanguage_D {} {

# File menu:
menuText D File "Datei" 0
menuText D FileNew "Neu..." 0 {Neue Scid-Datenbank anlegen}
menuText D FileOpen "ffnen..." 0 {ffnen einer existierenden Scid-Datenbank}
menuText D FileClose "Schlieen" 0 {Schlieen der aktiven Scid-Datenbank}
menuText D FileFinder "Finder" 0 {ffnen des Dateifinder-Fensters}
menuText D FileBookmarks "Lesezeichen" 0 {Lesezeichen-Men (Tasten: Strg+B)}
menuText D FileBookmarksAdd "Lesezeichen zur Liste hinzufgen" 0 \
  {Lesezeichen fr die aktuelle Partie und Datenbank}
menuText D FileBookmarksFile "Lesezeichen hinzufgen in Verzeichnis" 26 \
  {Lesezeichen fr die aktuelle Stellung und Partie zum Verzeichnis hinzufgen}
menuText D FileBookmarksEdit "Lesezeichen editieren..." 12 \
  {Editieren der Lesezeichen}
menuText D FileBookmarksList "Listenansicht" 1 \
  {Zeigt die Lesezeichen als Liste, ohne Unterverzeichnisse}
menuText D FileBookmarksSub "Verzeichnisansicht" 3 \
  {Zeigt Lesezeichen, eingeordnet in Verzeichnisse, nicht als Gesamtliste}
menuText D FileMaint "Wartung" 0 {Das Scid-Datenbank-Wartungsfenster}
menuText D FileMaintWin "Wartungfenster" 0 \
  {ffnet/schliet das Scid-Datenbank-Wartungsfenster}
menuText D FileMaintCompact "Datenbank komprimieren..." 10 \
  {Datenbank komprimieren, entfernt gelschte Spiele, unbenutzte Namen..}
menuText D FileMaintClass "Partien ECO-klassifizieren..." 8 \
{Neuklassifizierung aller Partien nach dem ECO-Code}
menuText D FileMaintSort "Sortieren..." 0 \
  {Sortieren von allen Partien in der aktuellen Datenbank}
menuText D FileMaintDelete "Dubletten lschen..." 0 \
  {Findet Dubletten und setzt das Lschkennzeichen}
menuText D FileMaintTwin "Dubletten prfen" 10 \
  {ffnet/erneuert das Dublettenfenster}
menuText D FileMaintName "Namen" 0 \
  {Namenseditor und Rechtschreibprfung}
menuText D FileMaintNameEditor "Namenseditor" 0 \
  {ffnet/schliet das Namenseditor-Fenster}
menuText D FileMaintNamePlayer "Schreibkorrektur Spieler..." 17 \
  {Schreibkorrektur der Spielernamen mit Hilfe der .ssp-datei}
menuText D FileMaintNameEvent "Schreibkorrektur Ereignis..." 17 \
  {Schreibkorrektur der Ereignisse mit Hilfe der .ssp-Datei}
menuText D FileMaintNameSite "Schreibkorrektur Ort..." 17 \
  {Schreibkorrektur der Orte mit Hilfe der .ssp-Datei}
menuText D FileMaintNameRound "Schreibkorrektur Runde..." 17 \
  {Schreibkorrektur der Runden mit Hilfe der .ssp-Datei}
menuText D FileReadOnly "Schreibschutz..." 3 \
  {Behandelt die Datenbank als schreibgeschtzt, verhindert nderungen}
menuText D FileExit "Ende" 0 {Beendet Scid}

# Edit menu:
menuText D Edit "Bearbeiten" 0
menuText D EditAdd "Variante hinzufgen" 0 \
  {Hinzufgen einer Variante zu diesem Zug in dieser Partie}
menuText D EditDelete "Variante lschen" 9 \
  {Lschen einer Variante fr diesen Zug}
menuText D EditFirst "Als erste Variante setzen" 4 \
  {Variante an erste Stelle in der Liste setzten}
menuText D EditMain "Variante als Hauptvariante setzen" 13 \
  {Variante zur Partiefortsetzung machen}
menuText D EditTrial "Variante testen" 9 \
  {Starten/Stoppen des Testmodus, zum Ausprobieren von Ideen am Brett}
menuText D EditStrip "Entfernen" 1 \
   {Kommentare oder Varianten aus der Partie entfernen} ;# Gibt's Besseres?
menuText D EditStripComments "Kommentare" 0 \
  {Alle Kommentare und Kommentarzeichen aus dieser Partie entfernen}
menuText D EditStripVars "Varianten" 0 \
  {Alle Varianten aus der Partie entfernen}
menuText D EditReset "Ablage leeren" 0 \
   {Lschen des Inhalts der Ablage-Datenbank}
menuText D EditCopy "Partie in Ablage kopieren" 17 \
  {Kopiert die Partie in die Ablage-Datenbank}
menuText D EditPaste "Partie aus Ablage einfgen" 19 \
  {Fgt die aktive Partie aus der Ablage in die aktuelle Datenbank ein}
menuText D EditSetup "Stellungseingabe..." 0 {Eingabe einer neuen Stellung}
menuText D EditPasteBoard "Stellung einfgen" 12 \
  {Stellung aus der Zwischenablage (im FEN-Format) einfgen}

# Game menu:
menuText D Game "Partie" 0
menuText D GameNew "Neue Partie" 5 \
  {Neue Partie beginnen, nderungen werden verworfen}
menuText D GameFirst "Erste Partie laden" 0 {Ldt die erste Partie aus dem Filter}
menuText D GamePrev "Vorherige Partie laden" 0 \
  {Ldt die vorherige Partie aus dem Filter}
menuText D GameReload "Partie wiederladen" 7 \
  {Diese Partie erneut laden, alle nderungen werden verworfen}
menuText D GameNext "Nchste Partie laden" 0 {Ldt die nchste Partie aus dem Filter}
menuText D GameLast "Letzte Partie laden" 0 {Ldt die letzte Partie aus dem Filter}
menuText D GameRandom "Zufllige Partie laden" 1 \
  {Ldt eine zufllig ausgewhlte Partie aus dem Filter} ;# ***
menuText D GameNumber "Lade Partie Nummer..." 14 \
  {Ldt eine Partie durch Angabe der Nummer}
menuText D GameReplace "Partie ersetzen..." 8 \
  {Sichert diese Partie, alte Version wird berschrieben}
menuText D GameAdd "Partie speichern..." 7 \
  {Sichert diese Partie als neue Partie in der Datenbank}
menuText D GameDeepest "Erffnung identifizieren" 10 \
  {Gehe zur sptestmglichen Erffnungsposition in der ECO-Klassifikation}
menuText D GameGotoMove "Zugnummer..." 0 \
  {Gehe zur angegebenen Zugnummer in der aktuellen Partie}
menuText D GameNovelty "Finde Neuerung..." 0 \
  {Finde den ersten Zug dieser Partie, der vorher noch nie gespielt wurde}

# Search menu:
menuText D Search "Suchen" 0
menuText D SearchReset "Filter zurcksetzen" 0 \
  {Den Filter zurcksetzen, so da alle Partien eingeschlossen sind}
menuText D SearchNegate "Filter negieren" 7 \
  {Den Filter invertieren, so da er alle ausgeschlossenen Partien enthlt}
menuText D SearchCurrent "Brett..." 0 \
  {Suche die aktuelle Brettposition}
menuText D SearchHeader "Partiedaten..." 0 \
  {Suche nach Partiedaten (Spieler, Turnier etc.)}
menuText D SearchMaterial "Material/Muster..." 0 \
  {Suche nach Material oder Stellungs-Mustern}
menuText D SearchUsing "Mit Suchoptions-Datei..." 4 \
  {Suche mit Hilfe einer Suchoptions-Datei}

# Windows menu:
menuText D Windows "Fenster" 0
menuText D WindowsComment "Kommentareditor" 0 {ffne/schliee den Kommentar-Editor}
menuText D WindowsGList "Partieliste" 6 {ffne/schliee das Partieliste-Fenster}
menuText D WindowsPGN "PGN-Fenster" 0 {ffne/schliee das PGN-Fenster (Partie-Notation)}
menuText D WindowsTmt "Turnier-Finder" 0 {ffne/schliee den Turnier-Finder}
menuText D WindowsSwitcher "Datenbank-Umschalter" 0 \
  {ffne/schliee das Fenster Datenbank-Umschalter}
menuText D WindowsMaint "Wartungsfenster" 0 \
  {ffne/schliee das Wartungsfenster}
menuText D WindowsECO "ECO-Auswertung" 0 {ffne/schliee das Fenster ECO-Auswertung}
menuText D WindowsRepertoire "Repertoire-Editor" 0 {ffne/schliee den Erffnungsrepertoire-Editor}
menuText D WindowsStats "Statistik" 0 \
  {ffne/schliee das Filterstatistik-Fenster}
menuText D WindowsTree "Zugbaum" 0 {ffne/schliee das Zugbaum-Fenster}
menuText D WindowsTB "Endspieltabellen..." 1 \
  {ffne/schliee das Fenster Endspieltabellen}

# Tools menu:
menuText D Tools "Werkzeuge" 0
menuText D ToolsAnalysis "Analyse-Engine..." 0 \
  {Schachanalyse-Programm starten/beenden}
menuText D ToolsAnalysis2 "Analyse-Engine #2..." 16 \
  {Schachanalyse-Programm Nr.2 starten/beenden}
menuText D ToolsCross "Kreuztabelle" 0 {Kreuztabelle fr diese Partie anzeigen}
menuText D ToolsEmail "E-Mail-Manager" 7 \
  {Fenster E-Mail-Manager ffnen/schlieen}
menuText D ToolsFilterGraph "Filter-Graphik" 7 \
  {ffnet/schliet das Fenster Filter-Graphik}
menuText D ToolsOpReport "Erffnungsreport" 0 \
  {Erffnungsreport fr die aktuelle Position erstellen}
menuText D ToolsTracker "Figurenverteilung"  7 \
  {ffnet das Figurenverteilungs-Fenster}
menuText D ToolsPInfo "Spieler-Information"  0 \
  {Fenster Spieler-Information ffnen/schlieen}
menuText D ToolsRating "ELO-Zahl-Verlauf" 4 \
  {Den Wertungsverlauf beider Spieler graphisch darstellen}
menuText D ToolsScore "Partie-Bewertungsgraph" 0 {Zeige Partie-Bewertungsgraph}
menuText D ToolsExpCurrent "Partie exportieren" 8 \
  {Aktuelle Partie in eine Textdatei schreiben}
menuText D ToolsExpCurrentPGN "Partie in PGN-Datei exportieren..." 10 \
  {Aktuelle Partie in eine PGN-Datei schreiben}
menuText D ToolsExpCurrentHTML "Partie in HTML-Datei exportieren..." 10 \
  {Aktuelle Partie in eine HTML-Datei schreiben}
menuText D ToolsExpCurrentLaTeX "Partie in LaTeX-Datei exportieren..." 10 \
  {Aktuelle Partie in eine LaTeX-Datei schreiben}
menuText D ToolsExpFilter "Alle Partien im Filter exportieren" 16 \
  {Alle Partien im Filter in eine Textdatei schreiben}
menuText D ToolsExpFilterPGN "Filter in PGN-Datei exportieren..." 10 \
  {Alle Partien im Filter in eine PGN-Datei schreiben}
menuText D ToolsExpFilterHTML "Filter in HTML-Datei exportieren..." 10 \
  {Alle Partien im Filter in eine HTML-Datei schreiben}
menuText D ToolsExpFilterLaTeX "Filter in LaTeX-Datei exportieren..." 10 \
  {Alle Partien im Filter in eine LaTeX-Datei schreiben}
menuText D ToolsImportOne "Eine PGN-Partie importieren..." 16 \
  {Eine Partie im PGN-Format eingeben oder einfgen}
menuText D ToolsImportFile "Datei mit PGN-Partien importieren..." 0 \
  {Partien aus einer PGN-Datei lesen}

# Options menu:
menuText D Options "Optionen" 0
menuText D OptionsSize "Brettgre" 0 {Brettgre ndern}
menuText D OptionsPieces "Figurensatz ndern" 2 {ndert den Figurensatz}
menuText D OptionsColors "Farben..." 0 {Brettfarben ndern}
menuText D OptionsExport "Export" 1 {Textausgabe-Optionen ndern}
menuText D OptionsFonts "Zeichenstze" 3 {Zeichenstze wechseln}
menuText D OptionsFontsRegular "Normal" 0 {Standard-Zeichensatz}
menuText D OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText D OptionsFontsSmall "Klein" 0 {Kleine Zeichen}
menuText D OptionsFontsFixed "Fest" 0 {Zeichensatz mit fester Breite (nicht-proportional)}
menuText D OptionsGInfo "Partie-Information" 0 {Partieinformation-Optionen}
menuText D OptionsLanguage "Sprache" 0 {Sprache whlen}
menuText D OptionsMoves "Zge" 0 {Zugeingabe-Optionen}
menuText D OptionsMovesAsk "Fragen vor Ersetzen" 0 \
  {Vor berschreiben existierender Zge nachfragen}
menuText D OptionsMovesDelay "Autom. Vorspielen..." 0 \
  {Zeit fr automatisches Vorspielen einstellen}
menuText D OptionsMovesCoord "Tastatureingabe" 0 \
  {Zugeingabe ber Koordinaten ("g1f3") akzeptieren}
menuText D OptionsMovesSuggest "Zeige Zugvorschlag" 9 \
  {Zugvorschlag ein-/ausschalten}
menuText D OptionsMovesKey "Autom. Zugergnzung" 10 \
  {Automatische Zugergnzung ein-/ausschalten}
menuText D OptionsNumbers "Zahlenformat" 5 {Zahlenformat whlen}
menuText D OptionsStartup "Autostart" 1 {Fenster automatisch ffnen}
menuText D OptionsWindows "Fenster" 6 {Fenster-Optionen}
menuText D OptionsWindowsIconify "Autom. minimieren" 7 \
  {Alle Fenster mit dem Hauptfenster minimieren}
menuText D OptionsWindowsRaise "Autom. Verwaltung" 7 \
  {Bestimmte Fenster (z.B. Zustandsleiste) bei Bedarf ffnen}
menuText D OptionsToolbar "Werkzeugleiste" 0 {Werkzeug- bzw. Symbolleiste Ein/Aus}
menuText D OptionsECO "ECO-Datei laden..." 0 {Ldt die ECO-Klassifikations-Datei}
menuText D OptionsSpell "Schreibkorrektur-Datei laden..." 7 \
  {Ldt die Datei der Scid-Rechtschreibprfung}
menuText D OptionsTable "Endspieltabellen-Verzeichnis..." 17 \
  {Whle eine Tabellendatei; alle Tabellen in deren Verzeichnis werden genutzt}
menuText D OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText D OptionsSave "Optionen speichern" 0 \
  "Alle einstellbaren Optionen werden in der Datei $::optionsFile gesichert"
menuText D OptionsAutoSave "Autom. speichern bei Beenden" 0 \
  {Speichert autom. alle Optionen beim Beenden von Scid}

# Help menu:
menuText D Help "Hilfe" 0
menuText D HelpIndex "Inhalt" 0 {Hilfe-Index anzeigen}
menuText D HelpGuide "Kurzanleitung" 4 {Ein Scid-Schnelldurchgang}
menuText D HelpHints "Hinweise" 0 {Die Scid-Kurztips}
menuText D HelpContact "Kontakt-Information" 0 {Hilfe zur Kontakt-Information}
menuText D HelpTip "Tagestip" 0 {Zeigt einen ntzlichen Tip an}
menuText D HelpStartup "Start-Fenster" 6 {Zeigt das Start-Fenster}
menuText D HelpAbout "Info zu Scid" 1 {ber Scid}

# Game info box popup menu:
menuText D GInfoHideNext "Verstecke nchsten Zug" 0
menuText D GInfoMaterial "Zeige Materialwerte" 0
menuText D GInfoFEN "Zeige FEN" 6
menuText D GInfoMarks "Gefrbte Felder und Pfeile zeigen" 0
menuText D GInfoWrap "Umbruch bei langen Zeilen" 0
menuText D GInfoFullComment "Vollstndigen Kommentar zeigen" 14
menuText D GInfoTBNothing "Endspieltabellen: nichts" 18
menuText D GInfoTBResult "Endspieltabellen: nur Ergebnis" 22
menuText D GInfoTBAll "Endspieltabellen: Ergebnis und bester Zug" 31
menuText D GInfoDelete "(Ent)Lsche diese Partie" 5
menuText D GInfoMark "(Un)Markiere diese Partie" 4

# Main window buttons:
helpMsg D .button.start {Gehe zum Partieanfang  (Taste: Pos 1)}
helpMsg D .button.end {Gehe zum Partieende  (Taste: Ende)}
helpMsg D .button.back {Gehe ein Zug zurck  (Taste: LinksPfeil)}
helpMsg D .button.forward {Gehe ein Zug vor  (Taste: RechtsPfeil)}
helpMsg D .button.intoVar {Gehe in Variante  (Taste: v)}
helpMsg D .button.exitVar {Verlasse Variante  (Taste: z)}
helpMsg D .button.flip {Brett drehen  (Taste: .)}
helpMsg D .button.coords {Brettkoordinaten AN oder AUS  (Taste: 0)}
helpMsg D .button.autoplay {Automatisches Vorspielen  (Taste: Strg+Z)}

# General buttons:
translate D Back {Zurck}
translate D Cancel {Abbrechen}
translate D Clear {Leeren}
translate D Close {Schlieen}
translate D Defaults {Standard}
translate D Delete {Lsche}
translate D Graph {Graphik}
translate D Help {Hilfe}
translate D Import {Importieren}
translate D Index {Inhalt}
translate D LoadGame {Partie laden}
translate D BrowseGame {Partie betrachten}
translate D MergeGame {Partie mischen}
translate D Preview {Vorschau} ;# Voransicht!? (KDE)
translate D Revert {Umkehren}
translate D Save {Speichern}
translate D Search {Suchen}
translate D Stop {Halt}
translate D Store {Speichern}
translate D Update {Aktualisieren}
translate D ChangeOrient {Fensterausrichtung ndern}
translate D None {Keine}
translate D First {Erste}
translate D Current {Aktuelle}
translate D Last {Letzte}

# General messages:
translate D game {Partie}
translate D games {Partien}
translate D move {Zug}
translate D moves {Zge}
translate D all {Alle}
translate D Yes {Ja}
translate D No {Nein}
translate D Both {Beide}
translate D King {Knig}
translate D Queen {Dame}
translate D Rook {Turm}
translate D Bishop {Lufer}
translate D Knight {Springer}
translate D Pawn {Bauer}
translate D White {Wei} ;### bug fixed ?
translate D Black {Schwarz}
translate D Player {Spieler}
translate D Rating {Elo}
translate D RatingDiff {Elo Differenz (Wei - Schwarz)}
translate D Event {Turnier}
translate D Site {Ort}
translate D Country {Land}
translate D IgnoreColors {Farben ignorieren}
translate D Date {Datum}
translate D EventDate {Turnier-Datum}
translate D Decade {Dekade}
translate D Year {Jahr}
translate D Month {Monat}
translate D Months {Januar Februar Mrz April Mai Juni
  Juli August September Oktober November Dezember}
translate D Days {Son Mon Die Mit Don Fre Sam}
translate D YearToToday {Ein Jahr zurck}
translate D Result {Ergebnis}
translate D Round {Runde}
translate D Length {Lnge}
translate D ECOCode {ECO-Code}
translate D ECO {ECO}
translate D Deleted {Gelscht}
translate D SearchResults {Suchergebnisse}
translate D OpeningTheDatabase {Datenbank ffnen}
translate D Database {Datenbank}
translate D Filter {Filter}
translate D noGames {keine Partien}
translate D allGames {alle Partien}
translate D empty {leer}
translate D clipbase {Ablage}
translate D score {Punkte}
translate D StartPos {Stellung}
translate D Total {Summe}

# Game information:
translate D twin {Dublette}
translate D deleted {gelscht}
translate D comment {Kommentar}
translate D hidden {versteckt}
translate D LastMove {letzter Zug}
translate D NextMove {nchster Zug}
translate D GameStart {Partieanfang}
translate D LineStart {Beginn der Zugfolge}
translate D GameEnd {Partieende}
translate D LineEnd {Ende der Zugfolge}

# Player information:
translate D PInfoAll {Ergebnisse fr <b>alle</b> Spiele}
translate D PInfoFilter {Ergebnisse fr <b>Filter</b>-Spiele}
translate D PInfoAgainst {Ergebnisse gegen}
translate D PInfoMostWhite {Hufigste Erffnungen als Weier}
translate D PInfoMostBlack {Hufigste Erffnungen als Schwarzer}
translate D PInfoRating {ELO-Historie}
translate D PInfoBio {Biografie}

# Tablebase information:
translate D Draw {Remis}
translate D stalemate {Patt}
translate D withAllMoves {mit allen Zgen}
translate D withAllButOneMove {mit allen auer einem Zug}
translate D with {mit}
translate D only {nur}
translate D lose {verlieren}
translate D loses {verliert}
translate D allOthersLose {alle anderen verlieren}
translate D matesIn {setzt Matt in}
translate D hasCheckmated {hat Matt gesetzt}
translate D longest {lngste}

# Tip of the day:
translate D Tip {Tip}
translate D TipAtStartup {Tip beim Starten}

# Tree window menus:
menuText D TreeFile "Datei" 0
menuText D TreeFileSave "Cache-Datei sichern" 12 \
  {Speichere die Zugbaum-Cachedatei (.stc)}
menuText D TreeFileFill "Cache-Datei fllen" 12 \
  {Flle die Cachedatei mit hufigen Erffnungspositionen}
menuText D TreeFileBest "Beste Partien" 0 \
  {Zeige die Liste bester Partien im Baum}
menuText D TreeFileGraph "Graphik-Fenster" 0 \
  {Zeige die Graphik fr diesen Ast}
menuText D TreeFileCopy "Kopiere Baum-Fenster in Zwischenablage" 0 \
  {Kopiere die Zugbaum-Statistik in die Zwischenablage}
menuText D TreeFileClose "Baum-Fenster schlieen" 13 {Schliee Zugbaum}
menuText D TreeSort "Sortieren" 0
menuText D TreeSortAlpha "Alphabetisch" 0
menuText D TreeSortECO "ECO-Code" 0
menuText D TreeSortFreq "Frequenz" 0
menuText D TreeSortScore "Punkte" 0
menuText D TreeOpt "Optionen" 0
menuText D TreeOptLock "Anbinden" 0 \
  {Zugbaum an aktive Datenbank anbinden(/lsen)}
menuText D TreeOptTraining "Training" 0 {Trainings-Modus ein-/ausschalten}
menuText D TreeOptAutosave "Autom.Cache-Datei sichern" 4 \
  {Beim Schlieen des Zugbaums automatisch Cache-Datei sichern}
menuText D TreeHelp "Hilfe" 0
menuText D TreeHelpTree "Zugbaum-Hilfe" 0
menuText D TreeHelpIndex "Inhalt" 0
translate D SaveCache {Cache sichern}
translate D Training {Training}
translate D LockTree {Anbinden}
translate D TreeLocked {angebunden}
translate D TreeBest {Beste}
translate D TreeBestGames {Beste Zugbaum-Partien}

# Finder window:
menuText D FinderFile "Datei" 0
menuText D FinderFileSubdirs "Unterverzeichnisse beachten" 0
menuText D FinderFileClose "Datei-Finder schlieen" 0
menuText D FinderSort "Sortieren" 0
menuText D FinderSortType "Typ" 0
menuText D FinderSortSize "Gre" 0
menuText D FinderSortMod "Modifiziert" 0
menuText D FinderSortName "Namen" 0
menuText D FinderSortPath "Pfad" 0
menuText D FinderTypes "Typen" 0
menuText D FinderTypesScid "Scid Datenbanken" 0
menuText D FinderTypesOld "Databanken im alten Format" 0
menuText D FinderTypesPGN "PGN-Dateien" 0
menuText D FinderTypesEPD "EPD-Dateien" 0
menuText D FinderTypesRep "Repertoire Dateien" 0
menuText D FinderHelp "Hilfe" 0
menuText D FinderHelpFinder "Datei-Finder Hilfe" 0
menuText D FinderHelpIndex "Index" 0
translate D FileFinder {Datei-Finder}
translate D FinderDir {Verzeichnis}
translate D FinderDirs {Verzeichnisse}
translate D FinderFiles {Dateien}
translate D FinderUpDir {hoch}

# Tournament finder:
menuText D TmtFile "Datei" 0
menuText D TmtFileUpdate "Aktualisieren" 0
menuText D TmtFileClose "Turnier-Finder schlieen" 0
menuText D TmtSort "Sortieren" 0
menuText D TmtSortDate "Datum" 0
menuText D TmtSortPlayers "Spieler" 0
menuText D TmtSortGames "Partien" 0
menuText D TmtSortElo "Elo" 0
menuText D TmtSortSite "Ort" 0
menuText D TmtSortEvent "Turnier" 1
menuText D TmtSortWinner "Gewinner" 0
translate D TmtLimit "Anzahl Turniere"
translate D TmtMeanElo "Unterster Elo-Durchschnitt"
translate D TmtNone "Keine zutreffenden Turniere gefunden."

# Graph windows:
menuText D GraphFile "Datei" 0
menuText D GraphFileColor "Als Farb-Postscript speichern..." 4
menuText D GraphFileGrey "Als Graustufen-Postscript speichern..." 4
menuText D GraphFileClose "Fenster schlieen" 0
menuText D GraphOptions "Optionen" 0
menuText D GraphOptionsWhite "Wei" 0
menuText D GraphOptionsBlack "Schwarz" 0
menuText D GraphOptionsBoth "Beide" 0
menuText D GraphOptionsPInfo "Spieler-Info Spieler" 1
translate D GraphFilterTitle "Filter-Graphik: Hufigkeit pro 1000 Partien"

# Analysis window:
translate D AddVariation {Addiere Variante}
translate D AddMove {Addiere Zug}
translate D Annotate {Autom. Kommentieren}
translate D AnalysisCommand {Analyse Befehl}
translate D PreviousChoices {Vorherige Wahl}
translate D AnnotateTime {Zeit zwischen den Zgen (in Sek.) einstellen}
translate D AnnotateWhich {Varianten hinzufgen}
translate D AnnotateAll {Fr Zge beider Seiten}
translate D AnnotateWhite {Nur fr Zge von Wei}
translate D AnnotateBlack {Nur fr Zge von Schwarz}
translate D AnnotateNotBest {Wenn der Partiezug nicht der beste Zug ist}

# Analysis Engine open dialog:
translate D EngineList {Analyse-Engines}
translate D EngineName {Name}
translate D EngineCmd {Befehl}
translate D EngineArgs {Parameter}
translate D EngineDir {Verzeichnis}
translate D EngineElo {Elo}
translate D EngineTime {Datum}
translate D EngineNew {Neu}
translate D EngineEdit {Bearbeiten}
translate D EngineRequired {Fettgedruckte Parameter obligatorisch, andere optional}


# Stats window menus:
menuText D StatsFile "Datei" 0
menuText D StatsFilePrint "Drucken in Datei..." 0
menuText D StatsFileClose "Fenster schlieen" 0
menuText D StatsOpt "Optionen" 0

# PGN window menus:
menuText D PgnFile "Datei" 0
menuText D PgnFilePrint "Drucken in Datei..." 0
menuText D PgnFileClose "PGN-Fenster schlieen" 0
menuText D PgnOpt "Ausgabe" 0
menuText D PgnOptColor "Farbige Darstellung" 0
menuText D PgnOptShort "Kurzer (3-Zeilen) Kopf" 0
menuText D PgnOptSymbols "Symbolische Darstellung" 0
menuText D PgnOptIndentC "Kommentare einrcken" 0
menuText D PgnOptIndentV "Varianten einrcken" 0
menuText D PgnOptColumn "Tabellarisch (ein Zug pro Zeile)" 0
menuText D PgnOptSpace "Leerzeichen nach Zugnummer" 0
menuText D PgnOptStripMarks "Entfernen von Farbfelder/Pfeile - Zeichen" 0
menuText D PgnColor "Farben" 0
menuText D PgnColorHeader "Kopf..." 0
menuText D PgnColorAnno "Anmerkungen..." 0
menuText D PgnColorComments "Kommentare..." 0
menuText D PgnColorVars "Varianten..." 0
menuText D PgnColorBackground "Hintergrund..." 0
menuText D PgnHelp "Hilfe" 0
menuText D PgnHelpPgn "PGN-Hilfe" 0
menuText D PgnHelpIndex "Index" 0

# Crosstable window menus:
menuText D CrosstabFile "Datei" 0
menuText D CrosstabFileText "Ausgabe in Text-Datei..." 11
menuText D CrosstabFileHtml "Ausgabe in HTML-Datei..." 11
menuText D CrosstabFileLaTeX "Ausgabe in LaTeX-Datei..." 11
menuText D CrosstabFileClose "Kreuztabelle schlieen" 0
menuText D CrosstabEdit "Bearbeiten" 0
menuText D CrosstabEditEvent "Ereignis" 0
menuText D CrosstabEditSite "Ort" 0
menuText D CrosstabEditDate "Datum" 0
menuText D CrosstabOpt "Ausgabe" 0
menuText D CrosstabOptAll "Jeder gegen jeden" 0
menuText D CrosstabOptSwiss "Schweizer System" 0
menuText D CrosstabOptKnockout "K.o.-System" 0
menuText D CrosstabOptAuto "Automatisch" 1
menuText D CrosstabOptAges "Alter in Jahren" 0
menuText D CrosstabOptNats "Nationalitt" 0
menuText D CrosstabOptRatings "Elo" 0
menuText D CrosstabOptTitles "Titel" 0
menuText D CrosstabOptBreaks "Stichkampf-Punkte" 11
menuText D CrosstabOptDeleted "Inklusive gelschte Partien" 10
menuText D CrosstabOptColors "Farben (nur Schweizer System)" 0
menuText D CrosstabOptColumnNumbers "Numerierte Spalten (Nur jeder-gegen-jeden-Tabelle)" 2
menuText D CrosstabOptGroup "Punktgruppen" 5
menuText D CrosstabSort "Sortieren" 0
menuText D CrosstabSortName "Name" 0
menuText D CrosstabSortRating "Elo" 0
menuText D CrosstabSortScore "Punkte" 0
menuText D CrosstabColor "Farben" 0
menuText D CrosstabColorPlain "Text" 0
menuText D CrosstabColorHyper "Hypertext" 0
menuText D CrosstabHelp "Hilfe" 0
menuText D CrosstabHelpCross "Kreuztabelle-Hilfe" 0
menuText D CrosstabHelpIndex "Index" 0
translate D SetFilter {Filter setzen}
translate D AddToFilter {Zum Filter hinzufgen}
translate D Swiss {Schweizer}

# Opening report window menus:
menuText D OprepFile "Datei" 0
menuText D OprepFileText "Ausgabe in Text-Datei..." 11
menuText D OprepFileHtml "Ausgabe in HTML-Datei..." 11
menuText D OprepFileLaTeX "Ausgabe in LaTeX-Datei..." 11
menuText D OprepFileOptions "Optionen..." 0
menuText D OprepFileClose "Berichtsfenster schlieen" 0
menuText D OprepHelp "Hilfe" 0
menuText D OprepHelpReport "Erffnungsreport Hilfe" 0
menuText D OprepHelpIndex "Index" 0

# Repertoire editor:
menuText D RepFile "Datei" 0
menuText D RepFileNew "Neu" 0
menuText D RepFileOpen "ffnen..." 0
menuText D RepFileSave "Speichern..." 0
menuText D RepFileSaveAs "Speichern unter..." 10
menuText D RepFileClose "Schlieen" 1
menuText D RepEdit "Bearbeiten" 0
menuText D RepEditGroup "Gruppe hinzufgen" 0
menuText D RepEditInclude "Variante einschlieen" 9
menuText D RepEditExclude "Variante ausschlieen" 9
menuText D RepView "Ansicht" 0
menuText D RepViewExpand "Alle Gruppen aufklappen" 13
menuText D RepViewCollapse "Alle Gruppen zuklappen" 13
menuText D RepSearch "Suchen" 0
menuText D RepSearchAll "Im gesamten Repertoire..." 0
menuText D RepSearchDisplayed "Nur in der aktuellen Variante..." 0
menuText D RepHelp "Hilfe" 0
menuText D RepHelpRep "Repertoire Hilfe" 0
menuText D RepHelpIndex "Hilfe-Index" 0
translate D RepSearch "Repertoire Suche"
translate D RepIncludedLines "Eingeschlossene Varianten"
translate D RepExcludedLines "Ausgeschlossene Varianten"
translate D RepCloseDialog {Dieses Repertoire hat ungesicherte nderungen.

Wollen Sie wirklich fortfahren und die nderungen verwerfen?
}

# Header search:
translate D HeaderSearch {Partiedaten-Suche}
translate D GamesWithNoECO {Partien ohne ECO?}
translate D GameLength {Partielnge}
translate D FindGamesWith {Finde Partien mit den Markierungen (Flags)}
translate D StdStart {Standard Anfang}
translate D Promotions {Umwandlung}
translate D Comments {Kommentare}
translate D Variations {Varianten}
translate D Annotations {Anmerkungen}
translate D DeleteFlag {Lschkennzeichen}
translate D WhiteOpFlag {Erffnung Wei}
translate D BlackOpFlag {Erffnung Schwarz}
translate D MiddlegameFlag {Mittelspiel}
translate D EndgameFlag {Endspiel}
translate D NoveltyFlag {Neuerung}
translate D PawnFlag {Bauernstruktur}
translate D TacticsFlag {Taktik}
translate D QsideFlag {Damenflgel}
translate D KsideFlag {Knigsflgel}
translate D BrilliancyFlag {Glnzend}
translate D BlunderFlag {Fehler}
translate D UserFlag {Benutzer}
translate D PgnContains {PGN enthlt Text}

# Game list window:
translate D GlistNumber {Nummer}
translate D GlistWhite {Wei}
translate D GlistBlack {Schwarz}
translate D GlistWElo {W-Elo}
translate D GlistBElo {S-Elo}
translate D GlistEvent {Turnier}
translate D GlistSite {Ort}
translate D GlistRound {Runde}
translate D GlistDate {Datum}
translate D GlistYear {Jahr}
translate D GlistEDate {Turnier-Datum}
translate D GlistResult {Result}
translate D GlistLength {Lnge}
translate D GlistCountry {Land}
translate D GlistECO {ECO}
translate D GlistOpening {Erffnung}
translate D GlistEndMaterial {End-Material}
translate D GlistDeleted {Gelscht}
translate D GlistFlags {Markierungen}
translate D GlistVars {Varianten}
translate D GlistComments {Kommentare}
translate D GlistAnnos {Anmerkungen}
translate D GlistStart {Stellung}
translate D GlistGameNumber {Partie Nummer:}
translate D GlistFindText {Text finden}
translate D GlistMoveField {Verschieben}
translate D GlistEditField {Konfigurieren}
translate D GlistAddField {Hinzufgen}
translate D GlistDeleteField {Lschen}
translate D GlistWidth {Breite}
translate D GlistAlign {Ausrichtung}
translate D GlistColor {Farbe}
translate D GlistSep {Trennlinie}

# Maintenance window:
translate D DatabaseName {Datenbank Name:}
translate D TypeIcon {Symbol:}
translate D NumOfGames {Partien:}
translate D NumDeletedGames {Gelschte Partien:}
translate D NumFilterGames {Partien im Filter:}
translate D YearRange {Jahr-Spanne:}
translate D RatingRange {Elo-Spanne:}
translate D Flag {Flag}
translate D DeleteCurrent {Lsche aktuelle Partie}
translate D DeleteFilter {Lsche Partien im Filter}
translate D DeleteAll {Alle Partien lschen}
translate D UndeleteCurrent {Wiederherstellen aktuelle Partie}
translate D UndeleteFilter {Wiederherstellen Partien im Filter}
translate D UndeleteAll {Wiederherstellen aller Partien}
translate D DeleteTwins {Lsche Dubletten}
translate D MarkCurrent {Markiere aktuelle Partie}
translate D MarkFilter {Markiere Partien im Filter}
translate D MarkAll {Markiere alle Partien}
translate D UnmarkCurrent {Entmarkiere aktuelle Partie}
translate D UnmarkFilter {Entmarkiere Partien im Filter}
translate D UnmarkAll {Entmarkiere alle Partien}
translate D Spellchecking {Schreibkorrektur}
translate D Players {Spieler}
translate D Events {Ereignis}
translate D Sites {Ort}
translate D Rounds {Runde}
translate D DatabaseOps {Datenbank-Operationen}
translate D ReclassifyGames {Partien ECO-klassifizieren}
translate D CompactDatabase {Datenbank komprimieren}
translate D SortDatabase {Datenbank sortieren}
translate D AddEloRatings {ELO-Zahlen hinzufgen}
translate D AutoloadGame {Automatisch Partie Nr. laden}
translate D StripTags {PGN-Markierungen entfernen} ;# ***
translate D StripTag {Markierung entfernen} ;# ***
translate D Cleaner {Bereiniger}
translate D CleanerHelp {
Der Scid-Bereiniger wird fr die aktuelle Datenbank alle
Wartungsarbeiten ausfhren, welche aus der unten stehenden
Liste ausgewhlt werden.

Aktuelle Einstellungen in den Mens ECO-Klassifikation und Dubletten lschen
werden angewendet, falls diese Funktionen selektiert sind.}
translate D CleanerConfirm {
Ist der Bereiniger einmal gestartet, kann er nicht mehr unterbrochen werden!

Dies kann lange dauern, speziell bei groen Datenbanken, abhngig von den
ausgewhlten Funktionen und deren Einstellungen.

Sind Sie sicher, da Sie die ausgewhlten Wartungsarbeiten starten mchten?
}

# Comment editor:
translate D AnnotationSymbols  {Kommentarzeichen:}
translate D Comment {Kommentar:}

# Board search:
translate D BoardSearch {Brettsuchen}
translate D FilterOperation {Durchfhrung am aktuellen Filter:}
translate D FilterAnd {UND (Beschrnke Filter)}
translate D FilterOr {ODER (Addiere zum Filter)}
translate D FilterIgnore {IGNORIERE (Reset Filter)}
translate D SearchType {Suche nach Typ:}
translate D SearchBoardExact {Exakte Position (alle Steine auf gleichen Feldern)}
translate D SearchBoardPawns {Bauern (gleiche Figuren, alle Bauern auf gleichen Feldern)}
translate D SearchBoardFiles {Linien (gleiches Material, alle Bauern auf gleichen Linien)}
translate D SearchBoardAny {Material (gleiches Material, Bauern und Figuren beliebig)}
translate D LookInVars {Schaue in Varianten}

# Material search:
translate D MaterialSearch {Materialsuchen}
translate D Material {Material}
translate D Patterns {Muster}
translate D Zero {Null}
translate D Any {Irgendeine}
translate D CurrentBoard {Aktuelle Stellung}
translate D CommonEndings {Endspiele}
translate D CommonPatterns {Gleiche Muster}
translate D MaterialDiff {Materialdifferenz}
translate D squares {Felder}
translate D SameColor {Gleichfarbige}
translate D OppColor {Ungleichfarbige}
translate D Either {Beides}
translate D MoveNumberRange {Zugnummernbereich}
translate D MatchForAtLeast {Zutreffendend fr mindestens}
translate D HalfMoves {Halb-Zge}

# Game saving:
translate D Today {Heute}
translate D ClassifyGame {Partie klassifizieren}

# Setup position:
translate D EmptyBoard {Brett Leeren}
translate D InitialBoard {Initialisiere Brett}
translate D SideToMove {Zugrecht}
translate D MoveNumber {Zugnummer}
translate D Castling {Rochade}
translate D EnPassentFile {EnPassant-Linie}
translate D ClearFen {FEN lschen}
translate D PasteFen {FEN einfgen}

# Replace move dialog:
translate D ReplaceMove {Zug ersetzen}
translate D AddNewVar {Neue Variante}
translate D ReplaceMoveMessage {Hier existiert bereits ein Zug.

Sie knnen diesen Zug ersetzen - unter Verlust aller nachfolgender Zge - oder
mit dem Zug eine neue Variante hinzufgen.

(Sie knnen diese Anzeige vermeiden indem Sie die "Fragen vor Ersetzen" Option
im Men Optionen/Zge deaktivieren)}

# Make database read-only dialog:
translate D ReadOnlyDialog {Wenn Sie diese Datenbank mit Schreibschutz
versehen, sind keine nderungen mglich. Es knnen keine Partien gespeichert
oder ersetzt und keine Lschkennzeichen gendert werden. Alle Sortierungen oder
ECO-Klassifikations-Ergebnisse sind nur temporr.

Sie knnen den Schreibschutz einfach entfernen, indem Sie die Datenbank
schlieen und wieder ffnen.
Wollen Sie diese Datenbank wirklich schreibschtzen?}

# Clear game dialog:
translate D ClearGameDialog {Diese Partie wurde gendert.

Wollen Sie wirklich fortsetzen und die nderungen verwerfen?
}

# Exit dialog:
translate D ExitDialog {Mchten Sie Scid beenden?}
translate D ExitUnsaved {Die folgenden Datenbanken haben ungesicherte Partienderungen. Wenn Sie jetzt beenden, gehen diese nderungen verloren.}

# Import window:
translate D PasteCurrentGame {Aktuelle Partie einfgen}
translate D ImportHelp1 {Eingeben oder Einfgen einer Partie im PGN-Format in
den oberen Rahmen.}
translate D ImportHelp2 {Hier werden Fehler beim Importieren angezeigt.}

# ECO Browser:
translate D ECOAllSections {alle ECO-Gruppen}
translate D ECOSection {ECO-Gruppe}
translate D ECOSummary {Zusammenfassung fr}
translate D ECOFrequency {Hufigkeit der Untercodes fr}

# Opening Report:
translate D OprepTitle {Erffnungsreport}
translate D OprepReport {Report}
translate D OprepGenerated {Erzeugt durch}
translate D OprepStatsHist {Statistiken und Geschichte}
translate D OprepStats {Statistiken}
translate D OprepStatAll {Alle Report Partien}
translate D OprepStatBoth {Beide Spieler}
translate D OprepStatSince {Nach}
translate D OprepOldest {lteste Partien}
translate D OprepNewest {Neueste Partien}
translate D OprepPopular {Popularitt}
translate D OprepFreqAll {Hufigkeit in allen Jahren: }
translate D OprepFreq1   {im letzten Jahr:            }
translate D OprepFreq5   {der letzten  5 Jahre:       }
translate D OprepFreq10  {der letzten 10 Jahre:       }
translate D OprepEvery {Eins pro %u Partien}
translate D OprepUp {mehr als %u%s von allen Jahren}
translate D OprepDown {weniger als %u%s von allen Jahren}
translate D OprepSame {keine nderung in allen Jahren}
translate D OprepMostFrequent {Hufigste Spieler}
translate D OprepRatingsPerf {ELO und Performance}
translate D OprepAvgPerf {Durchschnitts-ELO und Performance}
translate D OprepWRating {ELO Wei}
translate D OprepBRating {ELO Schwarz}
translate D OprepWPerf {Performance Wei}
translate D OprepBPerf {Performance Schwarz}
translate D OprepHighRating {Spiele mit dem hchsten ELO-Durchschnitt}
translate D OprepTrends {Ergebnis-Trend}
translate D OprepResults {Ergebnis nach Lngen und Hufigkeiten}
translate D OprepLength {Partielnge}
translate D OprepFrequency {Hufigkeit}
translate D OprepWWins {Weisiege:    }
translate D OprepBWins {Schwarzsiege: }
translate D OprepDraws {Remis:        }
translate D OprepWholeDB {ganze Datenbank}
translate D OprepShortest {Krzester Sieg}
translate D OprepMovesThemes {Zge und Themen}
translate D OprepMoveOrders {Zugfolgen zum Erreichen der Report-Position}
translate D OprepMoveOrdersOne \
  {Es gab nur eine Zugfolge zur erreichten Position:}
translate D OprepMoveOrdersAll \
  {Es gab %u Zugfolgen zur erreichten Position:}
translate D OprepMoveOrdersMany \
  {Es gab  %u Zugfolgen zur erreichten Position. Die ersten %u sind:}
translate D OprepMovesFrom {Zge ab der Report-Position}
translate D OprepThemes {Themen}
translate D OprepThemeDescription {Hufigkeit der Themen zum Zug %u}
translate D OprepThemeSameCastling {Gleichseitige Rochaden}
translate D OprepThemeOppCastling {Verschiedenseitige Rochaden}
translate D OprepThemeNoCastling {Beide Seiten unrochiert}
translate D OprepThemeKPawnStorm {Bauernsturm auf Knig}
translate D OprepThemeQueenswap {Damen getauscht}
translate D OprepThemeIQP {Isolierter Damenbauer}
translate D OprepThemeWP567 {Weier Bauer auf Reihe 5/6/7}
translate D OprepThemeBP234 {Schwarzer Bauer auf Reihe 2/3/4}
translate D OprepThemeOpenCDE {Offene c/d/e-Linie}
translate D OprepTheme1BishopPair {Eine Seite hat Luferpaar}
translate D OprepEndgames {Endspiele}
translate D OprepReportGames {Report-Partien}
translate D OprepAllGames {Alle Partien}
translate D OprepEndClass {Materialklassifikation von Endspielstellungen}
translate D OprepTheoryTable {Theorie-Tabelle}
translate D OprepTableComment {Erzeugt aus %u Partien mit hchster ELO-Zahl.}
translate D OprepExtraMoves {Extra Anmerkung Zge in Theorie-Tabelle}
translate D OprepMaxGames {Maximum an Partien in Theorie-Tabelle}

# Piece Tracker window:
translate D TrackerSelectSingle {Linke Maustaste whlt diese Figur.}
translate D TrackerSelectPair \
  {Linke Maustaste whlt diese Figur; rechte Maustaste whlt das Figurenpaar.}
translate D TrackerSelectPawn \
  {Linke Maustaste whlt diesen Bauern; rechte Maustaste whlt alle 8 Bauern.}
translate D TrackerStat {Statistik}
translate D TrackerGames {% der Partien mit Zug auf das Feld}
translate D TrackerTime {% der Zeit auf jedem Feld}
translate D TrackerMoves {Zge}
translate D TrackerMovesStart \
  {Zugnummer, ab der die Verteilungsberechnung beginnen soll.}
translate D TrackerMovesStop \
  {Zugnummer, wo die Verteilungsberechnung enden soll.}

# Game selection dialogs:
translate D SelectAllGames {Alle Spiele in der Datenbank}
translate D SelectFilterGames {Nur Spiele im Filter}
translate D SelectTournamentGames {Nur Spiele des aktuellen Turniers}
translate D SelectOlderGames {Nur ltere Spiele}

# Delete Twins window:
translate D TwinsNote {Damit zwei Spiele Dubletten sind, mssen diese mindestens die beiden selben Spieler haben und die folgenden Kriterien, die sie auswhlen knnen, erfllen.
Wenn zwei Dubletten gefunden werden, so wird die krzere der beiden Spiele gelscht.
Tip: Am besten fhrt man erst eine Schreibkorrektur durch, da dadurch die Detektion von Dubletten verbessert wird.}
translate D TwinsCriteria {Kriterium: Dubletten mssen haben ...}
translate D TwinsWhich {berprfe, welche Spiele}
translate D TwinsColors {die gleichen Spielerfarben?}
translate D TwinsEvent {das gleich Ereignis?}
translate D TwinsSite {den gleichen Ort?}
translate D TwinsRound {die gleiche Runde?}
translate D TwinsYear {das gleiche Jahr?}
translate D TwinsMonth {den gleichen Monat?}
translate D TwinsDay {den gleichen Tag?}
translate D TwinsResult {das gleiche Ergebnis?}
translate D TwinsECO {den gleichen ECO-Code?}
translate D TwinsMoves {die gleichen Zge?}
translate D TwinsPlayers {Vergleich Spielernamen}
translate D TwinsPlayersExact {Exakte Treffer}
translate D TwinsPlayersPrefix {Nur erste 4 Buchstaben}
translate D TwinsWhen {Beim Lschen der Dubletten}
translate D TwinsSkipShort {Partien unter 5 Zgen ignorieren?}
translate D TwinsUndelete {Zuerst alle Partien entlschen?}
translate D TwinsSetFilter {Filter auf Dubletten setzten?}
translate D TwinsComments {Spiele mit Kommentar immer behalten?}
translate D TwinsVars {Spiele mit Varianten immer behalten?}
translate D TwinsDeleteWhich {Welche Partie lschen:}
translate D TwinsDeleteShorter {Krzere Partie}
translate D TwinsDeleteOlder {Kleinere Partienummer}
translate D TwinsDeleteNewer {Grere Partienummer}
translate D TwinsDelete {Lsche Spiele}

# Name editor window:
translate D NameEditType {Namen ndern von}
translate D NameEditSelect {Welche Spiele sollen gendert werden?}
translate D NameEditReplace {Ersetze}
translate D NameEditWith {durch}
translate D NameEditMatches {Entsprechungen: Drcke Strg+1 bis Strg+9 zum Auswhlen}

# Classify window:
translate D Classify {Klassifiziere}
translate D ClassifyWhich {ECO-klassifiziere}
translate D ClassifyAll {Alle Spiele (berschreibe alte ECO-Codes)}
translate D ClassifyYear {Alle Spiele  aus dem letzen Jahr}
translate D ClassifyMonth {Alle Spiele aus dem letzten Monat}
translate D ClassifyNew {Nur Spiele ohne ECO-Code}
translate D ClassifyCodes {Verwende}
translate D ClassifyBasic {Normale ECO-Codes ("B12", ...)}
translate D ClassifyExtended {ECO-Codes mit Scid-Erweiterung ("B12j", ...)}

# Compaction:
translate D NameFile {Namendatenbank}
translate D GameFile {Partiendatenbank}
translate D Names {Namen}
translate D Unused {Unbenutzt}
translate D SizeKb {Gre (kB)}
translate D CurrentState {Momentaner Stand}
translate D AfterCompaction {nach Kompression}
translate D CompactNames {Komprimiere Namen}
translate D CompactGames {Komprimiere Partien}

# Sorting:
translate D SortCriteria {Kriterium}
translate D AddCriteria {Fge Sortierkriterium hinzu}
translate D CommonSorts {bliche Sortierkriterien}
translate D Sort {Sortiere}

# Exporting:
translate D AddToExistingFile {Anhngen an eine bestehende Datei?}
translate D ExportComments {Kommentare exportieren?}
translate D ExportVariations {Varianten exportieren?}
translate D IndentComments {Kommentare einrcken?}
translate D IndentVariations {Varianten einrcken?}
translate D ExportColumnStyle {Tabellarisch (ein Zug pro Zeile)?}
translate D ExportSymbolStyle {Symbolische Notation:}
translate D ExportStripMarks \
  {Felder-/Pfeile-Markierzeichen aus den Kommentaren entfernen?}

# Goto game/move dialogs:
translate D LoadGameNumber {Geben Sie die zu ladende Spiel-Nr. ein:}
translate D GotoMoveNumber {Gehe zu Zug-Nr.:}

# Copy games dialog:
translate D CopyGames {Kopiere Spiele}
translate D CopyConfirm {
 Mchten sie wirklich die [thousands $nGamesToCopy]
 Spiele aus dem Filter
 in der Datenbank "$fromName"
 in die Datenbank "$targetName"
 kopieren?
}
translate D CopyErr {Kann Spiele nicht kopieren}
translate D CopyErrSource {Die Quelldatenbank}
translate D CopyErrTarget {Die Zieldatenbank}
translate D CopyErrNoGames {hat keine Spiele im Filter}
translate D CopyErrReadOnly {ist schreibgeschtzt}
translate D CopyErrNotOpen {ist nicht geffnet}

# Colors:
translate D LightSquares {Helle Felder}
translate D DarkSquares {Dunkle Felder}
translate D SelectedSquares {Selektierte Felder}
translate D SuggestedSquares {Zugvorschlag-Felder}
translate D WhitePieces {Weie Steine}
translate D BlackPieces {Schwarze Steine}
translate D WhiteBorder {Weie Umrandung}
translate D BlackBorder {Schwarze Umrandung}

# Novelty window:
translate D FindNovelty {Finde Neuerung}
translate D Novelty {Neuerung}
translate D NoveltyInterrupt {Neuerungen-Suche abgebrochen}
translate D NoveltyNone {In dieser Partie wurde keine Neuerung gefunden}
translate D NoveltyHelp {
Scid wird den ersten Zug aus der aktuellen Partie finden, welcher zu einer Position fhrt, die nicht in der gewhlten Datenbank oder in dem ECO-Erffnungsbuch enthalten ist.
}

# Upgrading databases:
translate D Upgrading {Upgrading}
translate D ConfirmOpenNew {
Dies ist eine Datenbank im alten (Scid 2.x) Format, die nicht in Scid 3.x
geffnet werden kann. Aber eine Version im neuen Format wurde schon erstellt.

Wollen sie die Version der Datenbank in dem neuen Format ffnen?
}
translate D ConfirmUpgrade {
Dies ist eine Datenbank im alten (Scid 2.x) Format. Vor der Verwendung in
Scid 3, muss eine Version im neuen Format der Datenbank erstellt werden.

Beim Erstellen der neuen Version der Datenbank bleiben die Datein der alten Version erhalten.

Dieser Vorgang kann eine Zeitlang dauern, muss aber nur einmal durchgefhrt
werden. Sie knnen jederzeit abbrechen, wenn es Ihnen zu lange dauert.

Soll das Erstellen der Datenbank im neuen Format jetzt durchgefhrt werden?
}

# Recent files options:
translate D RecentFilesMenu {Number of recent files in File menu} ;# ***
translate D RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}

##########
#
# ECO Opening name translations:

translateECO D {
  Accelerated Beschleunigte
  Accepted Angenommen
  Attack Angriff
  Classical Klassisch
  Counterattack Gegenangriff
  Countergambit Gegengambit
  Defence Verteidigung
  Exchange Abtausch
  Game Partie
  Indian Indisch
  King's Knigs
  Knight Springer
  Bishop Lufer
  Bishop's Lufer
  Open Offen
  Opening Erffnung
  Queen's Damen
  Symmetrical Symmetrisch
  Variation Variante
  with mit
  without ohne

  Alekhine Aljechin
  Austrian sterreichisch
  {Bishop's Opening} Luferspiel
  Catalan Katalanisch
  Dragon Drachen
  Dutch Hollndisch
  English Englisch
  {Four Knights} Vierspringer
  {Four Knights Game} Vierspringerspiel
  {Four Pawns} Vierbauern
  French Franzsisch
  Hungarian Ungarisch
  Italian Italienisch
  {King's Gambit Accepted} {Angen. Knigsgambit}
  {King's Gambit} Knigsgambit
  {King's Indian} Knigsindisch
  {King's Pawn} Knigsbauern
  Nimzo-Indian Nimzoindisch
  {Old Indian} Alt-Indisch
  {Queen's Gambit} Damengambit
  {Queen's Gambit Accepted} {Angen. Damengambit}
  {Queen's Indian} Damenindisch
  {Queen's Pawn} Damenbauern
  {Queen's Pawn Game} Damenbauernspiel
  Russian Russisch
  {Russian Game} Russisch
  Scandinavian Skandinavisch
  Scotch Schottisch
  Sicilian Sizilianisch
  Slav Slawisch
  Spanish Spanisch
  {Three Knights} {Dreispringer}
  {Three Knights Game} {Dreispringerspiel}
  {Two Knights} Zweispringer
  Vienna Wiener
}


############################################################
#
# German help pages:


##########
# Index
#
set helpTitle(D,Index) "Inhaltsverzeichnis"
set helpText(D,Index) {<h1>Inhaltsverzeichnis Scid-Hilfe</h1>

<p>
[E] = Englisch.
</p>

<h4>Start und allgemeine Hilfe</h4>
<ul>
<li><a Guide><b>Kurzanleitung</b> Benutzung von Scid</a> <red>(Zuerst lesen!)</red></li>
<li><a Hints><b>Hinweise</b> zum effizienteren Arbeiten mit Scid</a></li>
<li><a MainWindow>Das Scid-<b>Hauptfenster</b></a></li>
<li><a Menus>Die Scid-<b>Mens</b></a> <red>(Aktualisiert!)</red></li>
<li><a Moves><b>Zge</b> eingeben</a></li>
<li><a Searches><b>Suchen</b> in Scid</a> </li>
<li><a Clipbase>Die <b>Ablage</b>-Datenbank</a></li>
</ul>

<h4>Andere Scid-Fenster</h4>
<ul>
<li><a Analysis><b>Analyse</b>-Fenster</a> <red>(Aktualisiert!)</red></li>
<li><a Finder><b>Dateifinder</b>-Fenster</a></li>
<li><a Switcher><b>Datenbank-Umschalter</b></a></li>
<li><a OpReport><b>Erffnungsreport</b>-Fenster</a></li>
<li><a Email><b>E-Mail</b>-Schach-Manager</a></li>
<ENGLISH>
<li><a PTracker><b>Figurenverteilung</b></a> <red>(Neu!)</red></li>
</ENGLISH>
<li><a Comment><b>Kommentareditor</b></a> <red>(Aktualisiert!)</red></li>
<li><a Crosstable><b>Kreuztabellen</b>-Fenster</a></li>
<li><a GameList><b>Partieliste</b>-Fenster</a> <red>(Aktualisiert!)</red></li>
<li><a Import><b>Partie-Import</b>-Fenster</a></li>
<li><a PGN><b>PGN</b> (Partietext)-Fenster</a></li>
<li><a Repertoire><b>Repertoire-Editor</b></a></li>
<li><a PInfo><b>Spieler-Information</b></a></li>
<li><a Tmt><b>Turnier-Finder</b></a> <red>(Aktualisiert!)</red></li>
<li><a Tree><b>Zugbaum</b>-Fenster</a></red></li>
<li><a Graphs><b>Graphik</b>-Fenster</a></li>
<li><a TB><b>Endspieltabellen</b> in Scid verwenden</a> <red>(Aktualisiert!)</red></li>
</ul>

<h4>Weitere Hilfsprogramme und Informationen</h4>
<ul>
<li><a Maintenance><b>Datenbank-Wartung</b></a></li>
<li><a Sorting>Datenbank<b> sortieren</b></a></li>
<li><a Compact>Datenbank<b> komprimieren</b></a></li>
<li><a ECO><b>ECO</b>-Erffnungsklassifikation</a></li>
<li><a EPD><b>EPD</b>-Dateien</a></li>
<li><a Export>Partien in Textdateien <b>exportieren</b></a></li>
<li><a Cmdline><b>Kommandozeilen</b>-Optionen</a></li>
<li><a LaTeX>Scid und <b>LaTeX</b></a> </li>
<li><a Bookmarks><b>Lesezeichen</b></a></li>
<li><a Flags>Partie-<b>Markierungen</b> (Flags)</a></red></li>
<li><a Options><b>Optionen</b> und Prferenzen</a></li>
<li><a Pgnscid><b>Pgnscid</b>: PGN-Dateien konvertieren</a></li>
<li><a NAGs><b>NAG</b>-Standard-Kommentarwerte</a></li>
<li><a Formats>Scids Datenbank-<b>Dateiformate</b></a></li>
<li><a Author>Kontakt-Information</a></li>
</ul>

<p><footer>(Aktualisiert: Scid 3.3, April 2002)</footer></p>
}


###############
### Quick guide

set helpTitle(D,Guide) "Kurzanleitung zur Benutzung von Scid"
set helpText(D,Guide) {<h1>Kurzanleitung zur Benutzung von Scid</h1>
<p>
Scid ist eine Schachdatenbank, mit welcher man Partiesammlungen
nach einer Vielzahl von Kriterien durchsuchen kann, Partien editieren
und mit Hilfe von Xboard/Winboard-kompatiblen Schachprogrammen
analysieren kann.
</p>
<p>
Scid benutzt ein eigenes, spezielles Drei-Dateien-Datenbankformat,
welches sehr schnell und kompakt ist, aber es kann auch das PGN-
(Portable Game Notation) Format lesen und schreiben. Scids
<a PGN>PGN-Fenster</a> zeigt die Notation der aktuellen Partie im
PGN-Format.
</p>
<p>
Man kann in Scid Partien zur Datenbank hinzufgen, mit Hilfe
der Tastatur oder der Maus. Mehr Details unter der Hilfeseite fr
<a Moves>Zugeingabe</a>.
</p>
<p>
Man kann mit Scid auch <a PGN>PGN</a> - Partiesammlungen bearbeiten:
durch Import der PGN-Datei in Scids - <a Import>Import</a> Fenster
oder direkt durch ffnen von PGN-Dateien in Scid. Jedoch: PGN - Dateien
knnen nicht in Scid bearbeitet werden (sie werden schreibgeschtzt
geffnet), und auerdem benutzen sie mehr Speicher und
werden langsamer geladen. Fr groe PGN - Partiesammlungen
wird empfohlen, sie mit Hilfe des Scid-Programms <a Pgnscid>pgnscid</a>
in eine Scid-Datenbank umzuwandeln (dabei bleibt die PGN-Datei erhalten).
</p>
<p>
Das <a MainWindow>Hauptfenster</a> von Scid (mit dem graphischen
Schachbrett) zeigt Details der aktuellen Partie und Datenbank. Man
kann zu gleicher Zeit bis zu vier Datenbanken geffnet haben (fnf
inklusive der <a Clipbase>Ablage-Datenbank</a>), und jede hat eine
eigene aktuelle Partie. (Die Partie mit der Nr. 0 dient zu Eingabe
einer neuen Partie und ist nicht Bestandteil der Datenbank).
Man kann zwischen den offenen Datenbanken im
<a Menus File>Datei-Men</a> umschalten.
</p>
<p>
Fr zustzliche Information bitte die anderen
Hilfe-Seiten, gelistet im <a Index>Inhaltsverzeichnis</a>, lesen.
</p>
<p>
<a Author>Kontaktinformationen ber den Autor von Scid</a> findet man in
der entsprechenden Hilfeseite.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


###############
### Hints page:

set helpTitle(D,Hints) "Scid Hinweise"
set helpText(D,Hints) {<h1>Scid Hinweise</h1>
<p>
Diese Seite enthlt einige ntzliche Hinweise in Form von Fragen und
Antworten, um Ihnen zu helfen, Scids Fhigkeiten besser zu nutzen.
Wenn Sie das erste Mal mit Scid arbeiten, lesen Sie bitte zuerst die
<a Guide>Kurzanleitung</a> zur Benutzung von Scid.
Die meisten Informationen auf dieser Seite finden Sie detailliert auf
den anderen Hilfeseiten, die im <a Index>Hilfe-Inhaltsverzeichnis</a>
aufgefhrt sind.
Falls Sie einen ntzlichen Hinweis haben, der dieser Seite hinzugefgt
werden sollte, senden Sie ihn bitte (in Englisch) an den
<a Author>Autor von Scid</a>.
</p>

<h4>Kann Scid eine Datenbank automatisch beim Start laden?</h4>
<p>
Ja, Sie knnen Datenbanken, PGN-Dateien oder <a EPD>EPD-Dateien</a>
in der Kommandozeile angeben. Beispiel:
<ul>
<li> <b>scid  datenbank  partien.pgn.gz</b></li>
</ul>
ldt die Scid-Datenbank <b>datenbank</b> und gleichzeitig
die mit gzip komprimierte PGN-Datei <b>partien.pgn.gz</b>.
</p>

<h4>Gibt es eine leichtere Mglichkeit, die Brettgre
zu ndern, als ber das Optionen-Men?</h4>
<p>
Ja, Sie knnen mit den Tastenkombinationen <b>Control+Shift+LeftArrow</b>
und <b>Control+Shift+RightArrow</b> das Brett verkleinern bzw. vergrern.
</p>

<h4>Wenn ich trainiere, indem ich eine Partie nachspiele, mchte ich
nicht, da Scid den nchsten Zug im Informationsbereich anzeigt.
Kann ich ihn "verstecken"?</h4>
<p>
Sie knnen den nchsten Zug verstecken, indem Sie die <b>rechte</b>
Maustaste im Informationsbereich drcken und im darauf erscheinenden
Men <b>Verstecke nchsten Zug</b> auswhlen.
</p>

<h4>Wie kann ich den ECO-Erffnungs-Schlssel der aktuellen Position
ermitteln?</h4>
<p>
Der ECO-Schlssel wird in der letzten Zeile des Informationsbereichs
angezeigt, unterhalb des Schachbretts im <a MainWindow>Haupt-Fenster</a>,
wenn Sie die ECO-Datei (<b>scid.eco</b>) geladen haben.<br>
Auf der <a ECO>ECO-Code</a> Hilfeseite wird erklrt, wie man die ECO-Datei
ldt und die Optionen so einstellt, da sie jedesmal beim Programmstart
geladen wird.
</p>

<h4>Beim Eingeben einer Partie bin ich gerade beim 30. Zug, als ich
bemerke, da der 10. Zug falsch eingegeben wurde. Wie kann ich ihn
korrigieren und dabei alle nachfolgenden Zge erhalten?</h4>
<p>
Sie knnen das im <a Import>Import</a>-Fenster tun; siehe die Hilfeseite
<a Moves Mistakes>Zugeingabe</a> fr weitere Informationen.
</p>

<h4>Wie kopiere ich Partien von einer Datenbank in die andere?</h4>
<p>
Im <a Switcher>Datenbank-Umschalter-Fenster</a>: kopieren Sie alle
Dateien im Datenbank-<a Searches Filter>Filter</a>, indem Sie sie mit
der Maus von einer Datenbank in die andere ziehen.
</p>

<h4>Jedesmal, wenn ich einen bereits vorhandenen Zug eingebe, erhalte
ich ein "Zug ersetzen?"-Dialogfenster. Wie kann ich das verhindern?</h4>
<p>
Schalten Sie es aus mit der Option <b>Fragen vor Ersetzen</b> im Men
<menu>Optionen: Zge</menu>.
Oder gewhnen Sie sich an, Zge mit der rechten Maustaste zurckzunehmen,
die jeweils den letzen Zug der Partie entfernt, wenn Sie sich
am Partiende befinden.
</p>

<h4>Wie ndere ich die Spaltenbreite im Partieliste-Fenster?</h4>
<p>
Klicken Sie die jeweilige Spalten-berschrift mit der linken oder
rechten Maustaste an und whlen Sie <b>Konfigurieren</b>.
</p>

<h4>Wie kann ich das Zugbaum-Fenster statt fr die ganze Datenbank nur
fr eine Auswahl von Partien nutzen?</h4>
<p>
Nutzen Sie die <a Clipbase>Ablage-Datenbank</a>. Whlen Sie den
Datenbank-Filter so, da er die von Ihnen gewnschten Partien enthlt,
dann kopieren Sie diese ber den <a Switcher>Datenbank-Umschalter</a>
in die Ablage-Datenbank. Danach brauchen Sie nur noch das Zugbaum-Fenster
in der Ablage-Datenbank zu ffnen.
</p>

<h4>Der Zugbaum ist bei groen Datenbanken zu langsam. Wie kann ich
ihn beschleunigen?</h4>
<p>
Sichern Sie die Cache-Datei hufig, um die Zugbaum-Resultate zum
spteren Gebrauch zu bewahren. Zu den Details siehe den Abschnitt
<b>Caching</b> auf der <a Tree>Zugbaum</a>-Hilfeseite.
</p>

<h4>Wie kann ich direkt die PGN-Notation der Datei bearbeiten?</h4>
<p>
Im <a PGN>PGN</a>-Fenster knnen sie die aktuelle Partie nicht bearbeiten,
aber Sie knnen immer noch die PGN-Notation editieren, indem Sie das
Fenster <a Import>Partie importieren</a> verwenden.
ffnen Sie es (mit <b>Control+Shift+I</b>) und whlen Sie
<b>Aktuelle Partie einfgen</b>, dann bearbeiten Sie die Partie
und klicken danach <b>Importieren</b> an.

</p>

<h4>In meiner Datenbank sind einige Spielernamen unterschiedlich
geschrieben. Wie kann ich sie korrigieren?</h4>
<p>
Mit den Kommandos im Men <menu>Datei: Wartung</menu> knnen Sie einzelne
Namen editieren oder auch Schreibweisen aller Namen berprfen.
Siehe die Seite <a Maintenance Editing>Wartung</a>.
</p>

<h4>Ich habe zwei Datenbanken geffnet: eine mit meinen eigenen Partien
und eine groe Datenbank mit Gromeister-Partien. Wie kann ich eine
meiner Partien mit denen in der groen Datenbank vergleichen?</h4>
<p>
ffnen Sie das <a Tree>Zugbaum-Fenster</a> in der groen Datenbank und
drcken Sie auf den
<b>Anbinden</b>-Schalter, um den Zugbaum an diese Datenbank
anzubinden. Dann wechseln Sie zur anderen Datenbank, und der Zugbaum
wird weiterhin die Daten der groen Datenbank anzeigen.
</p>

<p><footer>(Aktualisiert: Scid 2.6, August 2001)</footer></p>
}


###############
### Main window

set helpTitle(D,MainWindow) "Scid Hauptfenster"
set helpText(D,MainWindow) {<h1>Scid Hauptfenster</h1>
<p>
Das Hauptfenster in Scid zeigt die aktuelle Stellung der jeweiligen
Partie und Information ber diese Partie und die Datenbank.
Separate Hilfeseiten beschreiben die <a Menus>Mens</a> und die
<a Moves>Zugeingabe</a>.
</p>

<h3>Symbolleiste: Navigieren durch die Partie</h3>
<p>
Die direkt ber dem Schachbrett angebracht Symbole haben die
folgende Bedeutung (von links nach rechts):
<ul>
<li> <button tb_start> Gehe zum Beginn der Partie. </li>
<li> <button tb_prev> Gehe einen Zug zurck. </li>
<li> <button tb_next> Gehe einen Zug vor. </li>
<li> <button tb_end> Gehe zum Ende der Partie. </li>
<li> <button tb_invar> Gehe in Variante. </li>
<li> <button tb_outvar> Verlasse die Variante. </li>
<li> <button tb_addvar> Neue Variante hinzufgen. </li>
<li> <button autoplay_off> Starte/beende automatisches Vorspielen (siehe unten). </li>
<li> <button tb_trial> Starte/beende <a Moves Trial>Testmodus</a>. </li>
<li> <button tb_flip> Brett drehen. </li>
<li> <button tb_coords> Zeige/verdecke Brettkoordinaten. </li>
</ul>

<h4><name Autoplay>Automatisches Vorspielen</name></h4>
<p>
Im diesem Modus spielt Scid automatisch die Zge in der
aktuellen Partie vor, bis zum Spielende. Die Zeit zwischen den Zgen
kann im Men <menu>Optionen: Zge</menu> eingestellt werden und wird
mit "Optionen speichern" gesichert.
</p>
<p>
Die Tastenkombination <b>Strg+Z</b> startet oder stoppt das autom.
Vorspielen, zustzlich kann das autom. Vorpielen auch durch
Drcken der <b>Esc</b>-Taste beendet werden.
</p>
<p>
Wenn der Modus "Automatisches Vorspielen" beim geffneten
<a Analysis>Analyse-Fenster</a> (Engine 1) gestartet wird, so wird
die von der Engine berechnte jeweilige Fortsetzung als Variante jedem Zug
hinzugefgt <term>Autom. Kommentieren</term>. Siehe auch die
Hilfeseite zum <a Analysis>Analyse-Fenster</a>.
</p>

<h3>Der Informationsbereich</h3>
<p>
Der Bereich unter dem Schachbrett, mit Informationen ber die
Partie, wird <term>Informationsbereich</term> genannt. Die ersten 3
Zeilen zeigen Information zu den Spielern, Ergebnis, ECO-Code, Datum,
Ort und Ereignis. Die vierte Zeile zeigt die Informationen zur
aktuellen Stellung sowie den nchsten Zug.
</p>
<p>
Die fnfte Zeile zeigt den <a ECO>ECO-Code</a> der aktuelle Stellung,
falls enthalten in der gerade benutzen ECO-Datei.
</p>
<p>
Der Informationsbereich hat ein Men, welches man mit der
rechten Maustaste aktivieren kann. Hierber kann man bestimmte
Informationen zum Spiel zeigen oder verstecken sowie Markierungen
fr die aktuelle Partie setzten und lschen. Man kann das
Men auch ber die <b>[F9]</b> Funktionstaste erreichen.
</p>

<h4>Endspieltabellen</h4>
<p>
Der Informationsbereich zeigt auch Ergebnisse aus den
Endspieltabellen zur aktuellen Stellung, wenn diese darin enthalten
ist. Mehr dazu in den Hilfeseiten zu <a TB>Endspieltabellen</a>.
</p>

<h3>Die Statusanzeige</h3>
<p>
Die Statusanzeige zeigt Information ber die aktuelle
Datenbank. Das erste Feld zeigt den Partiestatus an: <b>XX</b>
bedeutet, die Partie wurde gendert, aber noch nicht
gespeichert, whrend <b>--</b> bedeutet, es gibt keine
nderungen, und <b>%%</b> zeigt an, da die Datenbank
schreibgeschtzt geffnet wurde.
</p>
<p>
Wenn man eine Datenbank immer schreibgeschtzt ffen will,
kann man auch die Rechte fr die entsprechenden Scid-Dateien
setzen, oder zumindestens die der Index-Datei; z.B. (unter Linux) durch
den Befehl: <b>chmod a-w datenbank1.si3</b>.
Danach ffnet Scid die entsprechende Datenbank immer
schreibgeschtzt.
</p>
<p>
Die Statusanzeige zeigt auch, wieviel Spiele im aktuellen
<a Searches Filter>Filter</a>
sind.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


######################
### Menus help screen:

set helpTitle(D,Menus) "Mens"
set helpText(D,Menus) {<h1>Die Scid-Mens</h1>

<h3><name File>Datei</name></h3>
<ul>
<li><menu>Neu</menu>: Legt eine neue, leere Scid-Datenbank an.</li>
<li><menu>ffnen</menu>: ffnet eine existierende Scid-Datenbank.</li>
<li><menu>Schlieen</menu>: Schliet die aktive Scid-Datenbank.</li>
<li><menu>Finder</menu>: ffnet das <a Finder>Datei-Finder</a>-Fenster.</li>
<li><menu>Lesezeichen</menu>: Das <a Bookmarks>Lesezeichen</a>-Men mit
     einigen Lesezeichen-Funktionen.</li>
<li><menu>Wartung</menu>: Datenbank-<a Maintenance>Wartungs</a>-Funktionen.
    </li>
<ul>
  <li><menu>Wartungs-Fenster</menu>: ffnet/schliet das
      Datenbank-Wartungs-Fenster.</li>
  <li><menu>Partien ECO-klassifizieren</menu>: Bestimmt den
      <a ECO>ECO-Code</a> fr alle Partien der Datenbank neu.</li>
  <li><menu>Dubletten lschen</menu>: Findet <a Maintenance Twins>Dubletten</a>
      in der Datenbank.</li>
  <li><menu>Namen</menu>: Ersetzt alle Vorkommen eines Spieler-,
      Ereignis-, Ort- oder Rundeneintrags.</li>
</ul>
<li><menu>Schreibschutz</menu>: Markiert die aktive Datenbank als schreibgeschtzt.</li>
<li><menu>Datenbank 1/2/3/4/5</menu>: Mit diesen Kommandos knnen Sie
    zwischen den vier verfgbaren Datenbanken und der
    <a Clipbase>Ablage-Datenbank</a> wechseln.</li>
<li><menu>Ende</menu>: Beendet Scid. </li>
</ul>

<h3>Bearbeiten</h3>
<ul>
<li><menu>Variante hinzufgen</menu>: Fgt eine neue, leere Variante zum nchsten
    Zug hinzu bzw. zum vorherigen, falls es noch keinen nchsten Zug gibt.</li>
<li><menu>Variante lschen</menu>: ffnet ein Varianten-Untermen fr
    den aktuellen Zug, um eine Variante zu lschen.</li>
<li><menu>Als erste Variante setzen</menu>: Macht eine Variante zur
    ersten Variante des aktuellen Zuges.</li>
<li><menu>Variante als Hauptvariante setzen</menu>: Tauscht eine Variante
    mit der Partiefolge aus.</li>
<li><menu>Variante testen</menu>: Schaltet in den <a Moves Trial>Testmodus</a>,
    um eine Variante auszuprobieren, ohne die aktuelle Partie zu verndern.</li>
<li><menu>Entfernen</menu>: Entfernt alle Kommentare oder Varianten
    aus der aktuellen Partie.</li>
<br>
<li><menu>Ablage leeren</menu>: Leert die
    <a Clipbase>Ablage</a>-Datenbank.</li>
<li><menu>Partie in Ablage kopieren</menu>: Kopiert die aktuelle Partie
    in die <a Clipbase>Ablage</a>-Datenbank.</li>
<li><menu>Partie aus Ablage einfgen</menu>: Fgt die aktive Partie der
    <a Clipbase>Ablage</a> als aktive Partie in die aktuelle Datenbank
    ein.</li>
<br>
<li><menu>Stellungseingabe</menu>: Legt die Ausgangsstellung fr die
    aktuelle Partie fest.</li>
<li><menu>Stellung einfgen</menu>: Fgt den markierten Text
    (Zwischenablage) als Ausgangsstellung ein.</li>
</ul>

<h3>Partie</h3>
<ul>
<li><menu>Neue Partie</menu>: Verwirft alle nicht gesicherten nderungen
     und beginnt eine neue Partie ab der Grundstellung.</li>
<li><menu>Lade Erste/Vorherige/Nchste/Letzte Partie</menu>: Diese Menpunkte
    laden die erste, vorherige, nchste bzw. letzte Partie im <a Searches Filter>Filter</a>.</li>
<li><menu>Partie wiederladen</menu>: Ldt die aktuelle Partie erneut, wobei
    alle bisherigen nderungen verworfen werden.</li>
<li><menu>Lade Partie Nummer</menu>: Ldt die Partie mit der angegebenen
    Nummer in die aktuelle Datenbank.</li>
<br>
<li><menu>Partie ersetzen</menu>: Sichert die aktuelle Partie, wobei sie
    die Originalversion in der Datenbank ersetzt.</li>
<li><menu>Partie speichern</menu>: Sichert die aktuelle Partie als neue
    Partie, die ans Ende der Datenbank angehngt wird.</li>
<br>
<li><menu>Erffnung identifizieren</menu>: Findet die letztmgliche
    Position der aktuellen Partie in der ECO-Datei.</li>
<li><menu>Zugnummer</menu>: Geht zu der angegebenen Zugnummer in
    der aktuellen Partie.</li>
<li><menu>Finde Neuerung</menu>: Findet den ersten Zug der aktuellen Partie,
    der vorher noch nie gespielt wurde.</li>
</ul>

<h3>Suchen</h3>
<ul>
<li><menu>Filter zurcksetzen</menu>: Setzt den <a Searches Filter>Filter</a>
    zurck, so da er alle Partien enthlt.</li>
<li><menu>Filter negieren</menu>: Invertiert den Filter, so da er alle
    vorher ausgeschlossenen Partien enthlt.</li>
<br>
<li><menu>Brett</menu>: Sucht die
    <a Searches Board>aktuelle Brettposition</a>.</li>
<li><menu>Partiedaten</menu>: Sucht nach <a Searches Header>Partiedaten</a>
    wie z.B. Spielernamen.</li>
<li><menu>Material/Muster</menu>: Sucht nach
    <a Searches Material>Material</a> oder Stellungsmustern</a>.</li>
<br>
<li><menu>Mit Suchoptions-Datei</menu>: Sucht mit Hilfe von
    <a Searches Settings>Einstellungen</a> aus einer Suchoptions-Datei.</li>
</ul>

<h3>Fenster</h3>
<ul>
<li><menu>Kommentareditor</menu>: ffnet/schliet das
    <a Comment>Kommentareditor</a>-Fenster.</li>
<li><menu>Partieliste</menu>: ffnet/schliet das
    <a GameList>Partieliste-Fenster</a>.</li>
<li><menu>PGN-Fenster</menu>: ffnet/schliet das
    <a PGN>PGN-Fenster</a>.</li>
<li><menu>Turnier-Finder</menu>: ffnet/schliet den
    <a Tmt>Turnier-Finder</a>.</li>
<br>
<li><menu>Datenbank-Umschalter</menu>: ffnet/schliet den
    <a Switcher>Datenbank-Umschalter</a>, mit dem man auf einfache Weise zu einer
    anderen Datenbank wechseln oder Partien zwischen Datenbanken kopieren kann.</li>
<li><menu>Wartungsfenster</menu>: ffnet/schliet das
    Datenbank-<a Maintenance>Wartungs</a>-Fenster.</li>
<br>
<li><menu>ECO-Auswertung</menu>: ffnet/schliet das Fenster
    <a ECO browser>ECO-Auswertung</a>.</li>
<li><menu>Repertoire-Editor</menu>: ffnet/schliet den
    <a Repertoire>Repertoire-Editor</a>.</li>
<li><menu>Statistik</menu>: ffnet/schliet das
    <term>Filter-Statistik-Fenster</term>, welches eine Gewinn/Verlust-Zusammenstellung
    aller Partien im <a Searches Filter>Filter</a> lierfert.</li>
<li><menu>Zugbaum</menu>: ffnet/schliet das <a Tree>Zugbaum-Fenster</a>.</li>
<li><menu>Endspieltabellen</menu>: ffnet/schliet das Fenster, das
    die <a TB>Endspieltabellen</a>-Informationen ausgibt.</li>
</ul>

<h3>Werkzeuge</h3>
<ul>
<li><menu>Analyse-Engine</menu>: Startet/beendet die "Schachanalyse-Engine",
    die die Auswertung der aktuellen Position
    im <a Analysis>Analyse-Fenster</a> darstellt.</li>
<li><menu>Analyse-Engine #2</menu>: Startet/beendet eine zweite
    "Schachanlyse-Engine".</li>
<li><menu>Kreuztabelle</menu>: Erstellt eine
    Turnier-<a Crosstable>Kreuztabelle</a> fr die aktuelle Partie. </li>
<li><menu>E-Mail-Manager</menu>: ffnet/schliet den <a Email>E-Mail-Manager</a>
    fr Fernschachpartien.</li>
<br>
<li><menu>Erffnungsreport</menu>: Erstellt einen <a OpReport>Erffnungsreport</a>
    zur aktuellen Position.</li>
<ENGLISH>
<li><menu>Figurenverteilung</menu>: ffnet das Fenster <a PTracker>Figurenverteilung</a>.
    </li>
</ENGLISH>
<li><menu>Spieler-Information</menu>: Gibt <a PInfo>Spieler-Informationen</a>
    fr einen Spieler der aktuellen Partie aus.</li>
<li><menu>ELO-Zahl-Verlauf</menu>: gibt den
    <a Graphs Rating>ELO-Zahl-Verlauf</a> aus.</li>
<li><menu>Partie-Bewertungsgraph</menu>: Gibt den
    <a Graphs Score>Partie-Bewertungsgraph</a> aus.</li>
<br>
<li><menu>Partie exportieren</menu>: Schreibt die aktuelle Partie in eine
    Textdatei im PGN-, HTML- oder LaTeX-Format. Siehe die
    <a Export>Export</a>-Hilfeseite.</li>
<li><menu>Alle Partien im Filter exportieren</menu>: Schreibt alle Partien
    im Such-<a Searches Filter>Filter</a> in eine Text-Datei im PGN-, HTML-
    oder LaTeX-Format. Siehe die <a Export>Export</a>-Hilfeseite.</li>
<br>
<li><menu>Eine PGN-Partie importieren</menu>: ffnet das <a Import>Import-Fenster</a>,
    um den Inhalt einer Partie im <a PGN>PGN-Format</a> direkt
    einzutippen oder einzufgen.</li>
<li><menu>Datei mit PGN-Partien importieren</menu>: Importiert eine ganze
    Datei mit Partien im PGN-Format in die aktuelle Datenbank.</li>
</ul>

<h3>Optionen</h3>
<p>
Dieses Men stellt einige Eintrge bereit, um die meisten konfigurierbaren
Optionen von Scid einzustellen.
Der Menpunkt <menu>Autom. speichern bei Beenden</menu> sichert die aktuellen
Optionen  in der Datei "<b>~/.scid/scidrc</b>" (bzw.
<b>scid.opt</b> im Verzeichnis des ausfhrbaren Scid-Programms fr Windows-User);
diese Datei wird bei jedem Programmstart von Scid geladen.
</p>

<h3>Hilfe</h3>
<p>
Dieses Men enthlt die Hilfe-Funktionen sowie Zugriff auf das
"Tip-des-Tages"-Fenster oder das Start-Fenster, welches Informationen
ber die Dateien liefert, die Scid beim Programmstart geladen hat.
</p>

<p><footer>(Aktualisiert: Scid 3.2, Februar 2002)</footer></p>
}


########################
### Entering moves help:

set helpTitle(D,Moves) "Zge eingeben"
set helpText(D,Moves) {<h1>Schachzge eingeben</h1>
<p>
In Scid knnen Sie die Partiezge mit der Maus oder ber die
Tastatur eingeben. Wenn Sie den Mauszeiger auf ein Feld bewegen,
wird dieses und ein weiteres Feld seine Farbe ndern, falls es
einen legalen Zug auf dieses bzw. von diesem Feld gibt. Das ist
der <term>Zugvorschlag</term>. Sie knnen diesen Zug einfach durch
Klicken der <term>linken</term> Maustaste ausfhren. Falls Sie der
Zugvorschlag strt, knnen Sie ihn im Optionsmen abschalten.
</p>
<p>
Um einen anderen als den vorgeschlagenen Zug auszufhren, knnen Sie
die <term>linke</term> Maustaste verwenden: Drcken Sie einfach die
Taste ber einem Feld und lassen Sie sie ber einem anderen Feld los.
</p>
<p>
Wenn Sie es vorziehen, Zge mit zwei Mausklicks auszufhren statt mit
gedrckter Maustaste, knnen Sie die <term>mittlere</term> Taste
verwenden: Klicken Sie erst das eine Feld an, danach das andere.
</p>

<h4>Einen Zug zurcknehmen</h4>
<p>
Um einen Zug zurckzunehmen, drcken Sie die rechte Maustaste. Damit gehen
Sie einen Zug zurck; gleichzeitig lschen Sie diesen Zug, falls es der
letzte Zug der Partie oder einer Variante war.
</p>

<h4>Alte Zge ersetzen</h4>
<p>
Wenn Sie einen Zug an einer Stelle in der Partie eingeben, wo bereits
ein Zug existiert, wird Scid Sie in einem Dialogfenster fragen, ob Sie
wirklich den alten Zug ersetzen wollen (der alte Zug und alle nachfolgenden
sind dann verloren) oder statt dessen den neuen Zug als Variante eingeben
wollen. Manche Leute mgen dieses Dialogfenster als strend empfinden
und wollen alte Zge immer ersetzen. Sie knnen es daher im Men
<menu>Optionen: Zge</menu> mit der Option "<i>Vor Ersetzen nachfragen</i>"
abschalten.
</p>

<h4><name Trial>Der Testmodus</name></h4>
<p>
Wenn Sie eine Partie nachspielen und eine Position erreichen, wo Sie
eine alternative Variante am Brett ausprobieren wollen, ohne die Partie
zu verndern, whlen Sie <b>Variante testen</b> im Men <menu>Bearbeiten</menu>,
um den Testmodus einzuschalten. In diesem Modus knnen Sie Zge eingeben
und die Partie zeitweilig verndern; sobald Sie den Testmodus verlassen,
kehren Sie zur Ausgangsposition zurck.
</p>

<h3><name Mistakes>Fehler korrigieren</name></h3>
<p>
Wenn Sie eine Partie eingeben und pltzlich einige Zge vorher einen
falschen Zug bemerken, knnen Sie diesen korrigieren, ohne die
nachfolgenden Zge zu verlieren. Der einzige Weg besteht darin, die
PGN-Darstellung der Datei zu bearbeiten: ffnen Sie das
<a Import>Import</a>-Fenster, whlen Sie "Aktuelle Partie einfgen",
korrigieren Sie den falschen Zug, und whlen Sie dann "Importieren".
</p>

<h3>Zugeingabe ber die Tastatur</h3>
<p>
Um Zge ber die Tastatur einzugeben, drcken Sie einfach die jeweiligen
Buchstaben- und Zahlentasten. Die Zge sollten in <term>SAN-Notation</term>
<i>ohne</i> die Symbole fr Schlagen (x) oder Umwandeln (=) eingegeben
werden. Gro- und Kleinschreibung wird ignoriert, Sie knnen also
beispielsweise [n][f][3] anstelle von Nf3 eingeben  -- beachten Sie
aber die Anmerkung weiter unten zu den Konflikten bei Bauernzgen.
</p>
<p>
Um sicherzustellen, da kein Zug in einem anderen enthalten ist,
lautet die Eingabe fr die kurze und lange Rochade [0][K] resp. [0][Q]
anstelle der blichen Notation 0-0 bzw. 0-0-0.
</p>
<p>
Wenn Sie einen Zug eingeben, zeigt die Statusleiste die Liste der
mglichen Zge an. Sie knnen jederzeit die [Leertaste] drcken, um
den ersten mglichen Zug der Liste als Eingabe auszuwhlen.
Um ein Zeichen zu lschen, drcken Sie [Rck] oder [Entf].
</p>
<p>
<b>Beachten</b> Sie, da ein Kleinbuchstabe zuerst als Bauer
interpretiert wird; mit [b] kann also ein Bauer oder Lufer ("Bishop")
gemeint sein, im Zweifelsfall mssen Sie daher ein groes [B] fr den
Lufer verwenden.
</p>

<h4>Automatische Zugergnzung</h4>
<p>
Im Options-Men knnen Sie die <term>Automatische Zugergnzung</term>
ein- oder ausschalten.
Mit Zugergnzung wird ein Zug ausgefhrt, sobald er durch Ihre Eingabe
von jedem anderen mglichen Zug unterschieden werden kann. Beispielsweise
mten Sie mit automatischer Zugergnzung in der Ausgangsstellung nur
[n][f] statt <b>Nf3</b> eintippen.
</p>

<h4>Standard-Kommentarzeichen eingeben</h4>
<p>
Sie knnen die blichen <a NAGs>Kommentarzeichen</a> im Hauptfenster auch
ber die Tastatur ohne den <a Comment>Kommentar-Editor</a> hinzufgen.
Die folgende Liste zeigt Ihnen, welche Zeichen Sie mit welchen Tasten
eingeben knnen:
<ul>
<li> !	: [!][Eingabe] </li>
<li> ?	: [?][Eingabe] </li>
<li> !?	: [!][?][Eingabe] </li>
<li> ?!	: [?][!][Eingabe] </li>
<li> !!	: [!][!][Eingabe] </li>
<li> ??	: [?][?][Eingabe] </li>
<li> </li>
<li> +-	: [+][-] </li>
<li> +/-	: [+][/] </li>
<li> +=	: [+][=] </li>
<li> =	: [=][Eingabe] </li>
<li> -+	: [-][+] </li>
<li> -/+	: [-][/] </li>
<li> =+	: [=][+] </li>
</ul>

<p><footer>(Aktualisiert: Scid 2.6, August 2001)</footer></p>
}


#########################
### Searches help screen:

set helpTitle(D,Searches) "Suchen"
set helpText(D,Searches) {<h1>Suchen in Scid</h1>
<p>
Scid kann auf viele verschiedene Weisen in einer Datenbank suchen.
Die drei wichtigsten Arten zu suchen sind:
<ul>
<li><b>1)</b> nach der aktuellen Brettposition, </li>
<li><b>2)</b> nach angegebenem Material und Stellungsmustern, </li>
<li><b>3)</b> nach Partiedaten-Informationen wie Spieler, Ergebnis, Datum. </li>
</ul>
<p>
Auerdem gibt es noch einen automatischen Suchmodus, den sog.
<a Tree>Zugbaum</a>, der an anderer Stelle erklrt wird.
</p>

<h3><name Filter>Der Such-Filter</name></h3>
<p>
Suchen basiert bei Scid auf dem Konzept eines <term>Filters</term>.
Der Filter reprsentiert eine Teilmenge der aktuellen Datenbank;
eine Partie ist immer entweder im Filter enthalten oder vom
Filter ausgeschlossen.
</p>
<p>
Bei jeder Art der Suche knnen Sie whlen, den vorhandenen Filter
weiter einzugrenzen, zu diesem hinzuzufgen oder ihn zu ignorieren
und die gesamte Datenbank zu durchsuchen. Diese Auswahl erlaubt es,
komplexe Suchvorgnge nacheinander aufzubauen.
</p>
<p>
Sie knnen auch mit dem <a Switcher>Datenbank-Umschalter</a> alle Partien
im Filter einer Datenbank in eine andere Datenbank kopieren.
</p>
<p>
Bei der Suche nach einer exakten Postion, der <a Tree>Zugbaum</a>- oder
Material/Muster-Suche wird die Zugnummer der ersten passenden Position
jeder passenden Partie gespeichert; wenn Sie also jede dieser Partien
laden, wird automatisch die passende Stellung angezeigt.
</p>
<p>
<b>Beachten</b> Sie, da beim Suchen nur mit den Partiezgen
verglichen wird, nicht mit den Zgen der Varianten.
</p>

<h3><name Board>Suchen: Brett...</name></h3>
<p>
Hier finden Sie Partien, die die gerade dargestellte Position enthalten,
ohne Bercksichtigung der Rochade- und <i>en-passant</i>-Rechte.
</p>
<p>
Vier Suchtypen stehen zur Verfgung. Alle vier verlangen von einer
passenden Stellung exakt gleiches Material und die gleiche Seite am Zug.
Die Typen sind:
<ul>
<li> [1] exakt (die beiden Stellungen mssen auf jedem Feld bereinstimmen),
     </li>
<li> [2] Bauern (die Bauernstruktur mu bereinstimmen, aber andere Figuren
     knnen irgenwo stehen), </li>
<li> [3] Linien (die Anzahl weier und schwarzer Bauern auf jeder Linie mu
     bereinstimmen, aber andere Figuren knnen irgendwo stehen), and </li>
<li> [4] Material (Bauern und Figuren knnen irgendwo stehen). </li>
</ul>
<p>
Die Bauernsuche ist hilfreich, um Erffnungen nach Bauernstrukuren zu
studieren, und Linien- und Materialsuche helfen beim Auffinden hnlicher
Endspielstellungen.
</p>
<p>
Um nach einer beliebigen Stellung zu suchen, knnen Sie zuerst
die Position aufbauen (im Men <menu>Bearbeiten: Stellungseingabe</menu>)
und dann die Suche starten.
</p>
<p>
Sie knnen Varianten (statt nur die jeweiligen Partiezge) durchsuchen,
indem Sie den Schalter <b>Schaue in Varianten</b> whlen; das kann
aber die Suche stark verlangsamen, falls die Datenbank sehr gro ist
und viele Partien mit Varianten enthlt.
</p>

<h3><name Material>Suchen: Material/Muster</name></h3>
<p>
Diese Suche ist ntzlich, um End- oder Mittelspielthemen zu finden. Sie
knnen eine minimale und maximale Anzahl von Figuren jeden Typs angeben,
und Sie knnen Stellungsmuster wie Lufer auf f7 oder f-Bauer finden.
</p>
<p>
Eine Reihe von hufigen Materialkonstellationen und Stellungsmustern
sind schon bereitgestellt, wie etwa "Endspiel Turm gegen Bauern" oder
"isolierter Damenbauer".
</p>
<p>
<b>Hinweise:</b><br>
Die Geschwindigkeit der Suche nach Stellungsmustern kann stark variieren.
Sie knnen aber durch eine geschickte Wahl der Bedingungen die bentigte
Zeit reduzieren. Wenn Sie beispielsweise fr ein Endspiel die Mindestzahl
von Zgen auf 20 setzen, werden alle Partien, die vor dem 20. Zug enden,
bersprungen.
</p>

<h3><name Header>Suche: Partiedaten</name></h3>
<p>
Mit dieser Suche knnen Sie Partiedaten finden, die im "Kopfteil"
gespeichert sind (wie z.B. Datum, Ergebnis, Namen und Wertungszahlen),
es mssen daher keine Partiezge dekodiert werden.
</p>
<p>
Um bei der Suche nach Partiedaten eine passende Partie zu finden,
mssen <b>alle</b> von Ihnen angegebenen Felder bereinstimmen.
</p>
<p>
Die Namensfelder (Wei, Schwarz, Turnier, Ort und Runde) passen auf
jeden Text im Namen, ohne Bercksichtigung von Gro- und Kleinschreibung
oder Leerzeichen.
</p>
<p>
Sie knnen fr das Wei-, Schwarz-, Turnier-, Ort- und Rundenfeld mit
Unterscheidung von Gro- und Kleinschreibung und mit "Wildcards" suchen
(mit <b>?</b> fr ein und <b>*</b> fr null oder mehr Zeichen), indem
Sie den Suchtext in Anfhrungszeichen setzen. Eine Suche mit der Ortsangabe
<b>USA</b> wird beispielsweise amerikanische Stdte finden, aber auch
<b>Lausanne SUI</b>, was vermutlich nicht von Ihnen beabsichtigt war! Eine
Suche mit dem Ort <b>"*USA"</b> (denken Sie an die Anfhrungszeichen)
liefert dagegen nur Stdte in den USA.
</p>
<p>
Wenn Sie einen bestimmten Spieler (oder zwei bestimmte Kontrahenten) als
Wei oder Schwarz suchen und die jeweilige Farbe keine Rolle spielt,
whlen Sie die Option <b>Farben ignorieren</b>.
</p>
<p>
Schlielich kann die Suche nach Partiedaten auch verwendet werden, um
irgendeinen Text (mit Bercksichtigung von Gro- und Kleinschreibung,
ohne "Wildcards") in der PGN-Darstellung dieser Partie zu finden. Sie
knnen bis zu drei Textteile eingeben, und sie mssen alle in einer
passenden Partie vorkommen.
Diese Methode ist sehr hilfreich, um in den Kommentaren oder zustzlichen
Daten einer Partie zu suchen (wie <b>Zeitberschreitung</b> oder
<b>Kommentator</b>), oder nach einer Zugfolge wie <b>Bxh7+</b> und
<b>Kxh7</b> fr ein angenommenes Luferopfer auf h7.
Allerdings kann diese Art zu suchen <i>sehr</i> langsam sein, da alle
Partien, auf die andere Kriterien zutreffen, dekodiert und auf diese
Texte durchsucht werden mssen.
Es ist daher eine gute Idee, diese Suchen so weit wie mglich einzugrenzen.
Hier sind einige Beispiele:
Um Partien mit einer Unterverwandlung in einen Turm zu finden,
suchen Sie nach <b>=R</b> und setzen gleichzeitig die Markierung
<b>Umwandlung</b> auf Ja.
Wenn Sie nach Text in Kommentaren suchen, setzen Sie die Markierung
<b>Kommentare</b> auf Ja.
Falls Sie nach den Zgen <b>Bxh7+</b> und <b>Kxh7</b> suchen, mchten
Sie z.B. die Suche mglicherweise auf Partien mit dem Ergebnis 1-0 und
mit mindestens 40 Halbzgen beschrnken, oder Sie suchen zuerst nach
Material oder Stellungsmustern, um Partien mit einem weien Luferzug
nach h7 zu finden.
</p>

<h3><name Settings>Sucheinstellungen sichern</name></h3>
<p>
Die Suchfenster Material/Mustern und Partiedaten besitzen einen Schalter
zum <term>Speichern</term>. Das ermglicht Ihnen, die aktuellen
Sucheinstellungen zur spteren Verwendung in einer
<term>Suchoptions</term>-Datei zu speichern (Endung .sso).
Um mit Hilfe einer vorher gespeicherten Suchoptions-Datei (.sso) zu
suchen, whlen Sie <menu>ffnen</menu> im Men <menu>Suchen</menu>.
</p>

<h3>Suchdauer und bergangene Dateien</h3>
<p>
Die meisten Suchen liefern eine Nachricht, die die bentigte Zeit und
die Anzahl der <term>bergangenen</term> Partien angibt. Eine bergangene
Partie ist eine, die aufgrund der im Index gespeicherten Informationen
von der Suche ausgeschlossen werden kann, ohne da ihre Zge dekodiert
werden mssen. Siehe die Hilfeseite ber
<a Formats>Dateiformate</a> fr weitergehende Informationen.
</p>

<p><footer>(Aktualisiert: Scid 3.0, November 2001)</footer></p>
}


############
### Clipbase

set helpTitle(D,Clipbase) "Die Ablage-Datenbank"
set helpText(D,Clipbase) {<h1>Die Ablage-Datenbank</h1>
<p>
Zustzlich zu den geffneten Datenbanken stellt Scid eine
<term>Ablage-Datenbank</term> (als Datenbank 5) zur Verfgung, welche
sich wie eine normale Datenbank verhlt, mit der Ausnahme, da sie
nur im RAM-Speicher existiert und keine Dateien zur Speicherung auf
der Festplatte besitzt.
</p>
<p>
Die Ablage-Datenbank (kurz: Ablage) ist ntzlich als eine temporre
Datenbank, zum Zusammenfhren von Suchergebnissen aus Suche in
mehreren Datenbanken oder zur Behandlung der Suchergebnisse als eine
eigenstndige Datenbank.
</p>
<p>
Angenommen, zum Beispiel, man will sich auf einen Gegner vorbereiten, und
hat eine Datenbank auf alle Partien des Gegners mit Wei durchsucht,
so da diese Partien im <a Searches Filter>Filter</a> sind.
Man kann nun diese Partien in die Ablage kopieren (durch Ziehen mit der
rechten Maustaste von der Originaldatenbank zur Ablage, im Fenster
<a Switcher>Datenbank-Umschalter</a>), danach im Datei-Men die Ablage
als aktive Datenbank auswhlen, und dann kann man sich im
<a Tree>Zugbaum-Fenster</a> das Erfnungsrepertoire des Gegners
ansehen.
</p>
<p>
Sind 2 Datenbanken geffnet, und hat man im Filter Partien, die man
von der einen Datenbank in die andere kopieren mchte, kann man dies
direkt (ohne Umweg ber die Ablage) tun. Dazu benutzt man wiederum das
Fenster <a Switcher>Datenbank-Umschalter</a>.
</p>
<p>
Die Ablage kann nicht geschlossen werden: mit dem Befehl
<menu>Ablage leeren</menu> aus dem Men <menu>Bearbeiten</menu> wird
der Inhalt der Ablage gelscht.
</p>
<p>
Die Ablage-Datenbank ist begrenzt auf 10.000 Partien zur gleichen Zeit,
da sie nur im Speicher existiert.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################
### Analysis window:

set helpTitle(D,Analysis) "Analyse-Fenster"
set helpText(D,Analysis) {<h1>Das Analyse-Fenster</h1>
<p>
Scids Analyse-Fenster zeigt die Analyse der aktuellen Brettstellung
durch ein Schachprogramm (eine sog. <term>Engine</term>).
Immer, wenn sich die Brettstellung ndert, bermittelt Scid die neue
Position an die Engine, und die zeigt ihre Einschtzung dieser Stellung.
</p>
<p>
Die Bewertung in dem Analysefenster erfolt immer aus der Perspektive
von Wei, eine negative Bewertung heit also, da Schwarz besser steht.
Der untere Fensterbereich (mit dem Rollbalken) zeigt den Verlauf der
Auswertungen der aktuellen Stellung durch die Engine, Sie knnen also
sehen, wie sich die Einschtzung verndert hat.
</p>
<p>
Um den von der Engine ausgewhlten besten Zug als neuen Zug der
aktuellen Partie zu nehmen, klicken Sie einfach auf den Schalter
<b>Zug hinzufgen</b>.
</p>

<h3><name List>Die Liste der Analyse-Engines</name></h3>
<p>
Scid behlt eine Liste der von Ihnen benutzen Engines mit einer
geschtzten Elo-Zahl (wenn Sie eine Schtzung machen) und dem Datum
der letzten Benutzung. Sie knnen diese Liste nach Namen, Elo-Zahl
oder Datum sortieren.
Whlen Sie <b>Neu</b> oder <b>Bearbeiten</b>, um eine neue Engine
zur Liste hinzuzufgen oder Details eines bestehenden Eintrags zu
bearbeiten.
</p>

<h3><name Start>Engine-Kommandos und Verzeichnisse</name></h3>
<p>
Fr jede Engine mssen Sie die aufzurufende Programmdatei angeben
und das Verzeichnis, in dem Scid sie starten soll.
</p>
<p>
Die hufigste Ursache von Problem beim Start einer Engine ist die Wahl
des Verzeichnisses, in dem die Engine laufen soll. Einige Engines
bentigen eine Initialisierung oder eine Erffnungsbuch-Datei in ihrem
Startverzeichnis, um ordnungsgem zu laufen.
Andere Engines (so wie Crafty) schreiben Logdateien in dem Verzeichnis,
in dem sie gestartet wurden, Sie mssen sie also in einem Verzeichnis
aufrufen, fr das Sie Schreibrecht haben.
Wenn fr das Verzeichnis einer Engine "." angegeben ist, wird Scid sie
einfach im aktuellen Verzeichnis starten.
</p>
<p>
Wenn also eine Engine, die in Scid laufen sollte, nicht startet,
versuchen Sie es mit anderen Verzeichniseinstellungen. Um zu vermeiden,
da Engines Logdateien in vielen verschiedenen Verzeichnissen erstellen,
empfehle ich, Engines im Verzeichnis der Scid-Benutzerdateien zu starten
(da, wo sich die Datei <b>scid.exe</b> bei Windows befindet bzw.
<b>~/.scid/</b> bei Unix); in der Dialogbox fr die Engine-Einstellungen
gibt es einen Schalter <b>scid.exe dir</b> fr Windows bzw. <b>~/.scid</b>
fr Unix, mit dem Sie die Engine in diesem Verzeichnis starten lassen
knnen.
</p>

<h3>Training</h3>
<p>
Mit dem Schalter <b>Training</b> knnen Sie gegen die Analyse-Engine
spielen. Die Bedenkzeit fr jeden Zug ist fest vorgegeben und die
Analyse-Ergebnisse werden nicht angezeigt, wenn der Trainingsmodus
eingeschaltet ist.
</p>

<h3>Partie kommentieren</h3>
<p>

Der Schalter <b>Variante hinzufgen</b> im Analysefenster fgt die
laufende Bewertung und beste Variante als neue Variante der Partie hinzu.
</p>
<p>
Man kann das fr mehrere Zge mit dem Schalter <b>Kommentieren</b>
automatisieren. Sie werden zur Eingabe einiger Kommentar-Optionen
aufgefordert, dann wird in den Autoplay-Modus geschaltet.
Wenn der Autoplay-Modus aktiviert und das Analyse-Fenster geffnet ist,
wird die beste Variante mit Stellungsbewertung zu jeder Position
hinzugefgt, da sich der Autoplay-Modus durch die Partie bewegt.
Nur Stellungen von der aktuellen Stellung bis zum Partieende (oder bis
zum Abbruch des Autoplay-Modus) werden kommentiert, so da Sie Kommentare
zu Erffungszgen unterdrcken knnen, indem Sie vor Aktivierung des
Autoplay-Modus zu einer Mittelspielstellung gehen.
</p>
<p>
Die automatische Kommentierung kann jederzeit durch Ausschalten des
Autoplayer-Modus abgebrochen werden, z.B. durch Drcken der
<b>Esc</b>-Taste im Hauptfenster.
</p>
<p>
Zur Vereinfachung steht der <b>Kommentar</b>-Schalter nur in dem Fenster
zur Verfgung, das als erste Analyse-Engine geffnet wurde. Wenn Sie
eine Engine als Analyse-Engine Nr.2 ffnen, knnen Sie sie nicht zur
Partiekommentierung nutzen.
</p>

<h3>Schnittstellen-Details</h3>
<p>
Fr die Benutzung des Analysefensters bentigen Sie ein Schachprogramm,
welches das <term>WinBoard/Xboard</term>-Protokoll untersttzt.
</p>
<p>
Scid sendet beim Programmstart die Befehle <b>xboard</b>, <b>post</b> und
<b>protover 2</b> to einer Engine, und nutzt die Befehle <b>setboard</b>
und <b>analyze</b> zur effizienteren Kommunikation, wenn die Engine in
ihrer Antwort anzeigt, da sie diese untersttzt.
Wenn die Engine den Befehl <b>setboard</b> nicht untersttzt, wird sie
fr Partien, die nicht mit der Standard-Ausgangsstellung beginnen, keine
Analysen liefern knnen.
</p>
<p>
Programmen, die den Befehl <b>analyze</b> nicht untersttzen, sendet
Scid nach jeder nderung der Stellung folgende Kommandos: <b>new</b>
und <b>force</b>, dann die Partiezge zur aktuellen Position, danach
<b>go</b>.
</p>
<p>
Bob Hyatt's exzellentes frei verfgbares Schachprogramm <term>Crafty</term>
benutze und empfehle ich zur Analyse mit Scid. Aber auch andere WinBoard-
oder XBoard-kompatible Programme sind erfolgreich getestet worden.
Ein paar Websites zum Herunterladen einiger Engines sind nachfolgend
aufgefhrt.
</p>
<p>
Crafty:
<url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url>
</p>
<p>
Yace:
<url http://home1.stofanet.dk/moq/>http://home1.stofanet.dk/moq/</url>
</p>
<p>
Phalanx:
<url ftp://ftp.math.muni.cz/pub/math/people/Dobes/>ftp://ftp.math.muni.cz/pub/math/people/Dobes/</url>
</p>
<p>
Comet:
<url http://members.aol.com/utuerke/comet/>http://members.aol.com/utuerke/comet/</url>
</p>
<p>
Gnuchess:
<url http://www.gnu.org/software/chess/chess.html>http://www.gnu.org/software/chess/chess.html</url>
</p>
<p>
The Crazy Bishop:
<url http://remi.coulom.free.fr/>http://remi.coulom.free.fr/</url>
</p>

<p><footer>(Aktualisiert: Scid 3.2, Februar 2002)</footer></p>
}


###############################
### Comment editor window help:

set helpTitle(D,Comment) "Kommentareditor"
set helpText(D,Comment) {<h1>Der Kommentareditor</h1>
<p>
Mit dem Kommentareditor knnen Sie den Zgen der aktuellen Partie
Kommentare und symbolische Kommentarzeichen hinzufgen.
</p>

<h3>Kommentarzeichen</h3>
<p>
Scid verwendet den <a Author Related>PGN-Standard</a> fr
Kommentarzeichen und akzeptiert <a NAGs>NAG</a>-Werte fr Anmerkungen
(NAG = numeric annotation glyph, "numerisches Anmerkungszeichen").
Einige der meistgebruchlichen Symbole (wie "!" oder "+-") werden als
solche ausgegeben und haben zur schnelleren Eingabe einen Schalter im
Kommentareditor. Fr andere Symbole knnen Sie den jeweiligen numerischen
NAG-Wert, eine Zahl von 1 bis 255, eingeben. Zum Beispiel bedeutet
der NAG-Wert 36 "Wei besitzt die Initiative" und wird im
<a PGN>PGN-Text</a> der Partie als "$36" ausgegeben.
</p>
<p>
Zu den NAG-Werten, die durch den PGN-Standard definiert werden,
siehe auch die Hilfeseite <a NAGs>NAG-Werte</a>.
</p>
<p>
<b>Hinweis:</b> Sie knnen die blichen Bewertungssymbole fr Schachzge
(!, ?, !!, ??, !? und ?!) direkt im Haupfenster eingeben, ohne den
Kommentareditor zu verwenden, indem Sie das jeweilige Symbol gefolgt
von der [Eingabe]-Taste eintippen.
Das ist besonders ntzlich beim <a Moves>Schachzge eingeben</a>
ber die Tastatur.
</p>

<h3>Kommentare</h3>
<p>
Sie knnen Kommentare im bereitgestellten Textbereich editieren und
dabei die Leeren-, Umkehren- und Speichern-Schalter verwenden.
Sie brauchen den Schalter "Speichern" nicht anzuklicken, um einen Kommentar
zu aktualisieren; dies geschieht automatisch, wann immer Sie zu einer
anderen Partiestellung gehen.
</p>

<h3>Felder einfrben</h3>
<p>
Sie knnen jedes Feld mit einer beliebigen Farbe einfrben, indem Sie
ein besonderes, an irgendeiner Stelle im Kommentar eingebettetes
Kommando verwenden. Das Format dieses Kommandos ist:
</p>
<ul>
<li><b>[%mark feld farbe]</b> ,<li>
</ul>
<p>
wobei <b>feld</b> ein Feldname wie d4 ist und <b>farbe</b> irgendeine
bekannte Farbbezeichnung (wie etwa red, blue4, darkGreen,
lightSteelBlue, etc.) oder ein RGB-Code (ein <b>#</b> gefolgt von 6
Hexadezimalziffern, wie z.B. #a0b0c8). Die Standardfarbe,
falls die Farbangabe weggelassen wird, ist <red>Rot</red>.
</p>
<p>
Ein Kommentar kann eine beliebige Anzahl von Farbkommandos enthalten,
aber jedes mu ein eigenes <b>[%mark ...]</b>-Tag-Feld haben.
Beispielsweise wird der Kommentartext</p>
<p>
  "Jetzt ist d6 [%mark d6] geschwcht und kann vom Springer auf
  b5 [%mark b5 #000070] angegriffen werden."
</p>
<p>
das Feld d6 <red>rot</red> und das Feld b5 in der dunkelblauen Farbe
<darkblue>#000070</darkblue> einfrben.
</p>

<h3>Pfeile einzeichnen</h3>
<p>
Sie knnen mit einem speziellen Kommentar-Kommando, hnlich dem oben
beschriebenen zum Frben von Feldern, einen Pfeil von einem Feld zum
anderen zeichnen.
Das Format ist:
</p>
<ul>
<li><b>[%arrow vonFeld nachFeld farbe]</b><li>
</ul>
<p>
wobei <b>vonFeld</b> und <b>nachFeld</b> Feldbezeichnungen wie d4
sind und <b>farbe</b> ein bekannter Farbname (wie z.B. red, blue4, etc.)
oder RGB-Code (wie #a0b0c0) ist.
Ohne Farbangabe wird standardmig <red>Rot</red> genommen.
</p>
<p>
Beispiel: Der Kommentartext
</p>
<p>
"Springer auf c3 und Lufer auf c4 kontrollieren das schwache Feld d5.
 [%arrow c3 d5 red] [%arrow c4 d5 blue]"
</p>
<p>
zeichnet einen roten Pfeil von c3 nach d5 und einen blauen von c4 nach d5.
</p>

<p><footer>(Aktualisiert: Scid 3.2, Februar 2002)</footer></p>
}


###########################
### Crosstable window help:

set helpTitle(D,Crosstable) "Kreuztabelle"
set helpText(D,Crosstable) {<h1>Das Kreuztabellen-Fenster</h1>
<p>
Das Kreuztabellen-Fenster zeigt die Turnier-Kreuztabelle zur aktuellen
Partie. Jedesmal, wenn sie das Fenster aktualisieren (indem Sie den
"Aktualisieren"-Schalter anklicken, im Kreuztabellen-Fenster die
[Eingabe]-Taste drcken oder im <a MainWindow>Haupt</a>- oder
<a GameList>Partielisten</a>-Fenster die Tastenkombination
<b>[Strg]-[Umschalt]-X</b> bettigen), sucht Scid alle Partien
vom selben Turnier wie die aktuelle Partie.
</p>
<p>
Jede Partie, die bis zu <b>drei Monate vor oder nach</b> der aktuellen
Partie gespielt wurde und <b>exakt dieselben Turnier- und Ortsangaben</b>
enthlt, wird als Partie dieses Turniers betrachtet.
</p>
<p>
Ein Einfachklick mit der linken Maustaste auf irgendein Ergebnis in der
Kreuztabelle ldt die entsprechende Partie.
Sie knnen alle Partien des Turniers mit dem Schalter
<b>Zum Filter addieren</b> des Kreuztabellen-Fensters zum
<a Searches Filter>Filter</a> hinzufgen.
</p>

<h4>Mens des Kreuztabellen-Fensters</h4>
<p>
Im <menu>Datei</menu>-Men knnen Sie die aktuelle Tabelle im Text-,
LaTeX- oder HTML-Format in eine Datei ausgeben.
</p>
<p>
Das <menu>Ausgabe</menu>-Men erlaubt Ihnen, das Tabellenformat
auszuwhlen: <b>Jeder gegen jeden</b>, <b>Schweizer System</b>,
<b>K.o.-System</b> oder <b>Automatisch</b>.
</p>
<p>
Das Format "Jeder gegen jeden" (fr Rundenturniere) ist auf 30 Spieler
limitiert, aber "Schweizer System" (fr Turniere mit vielen Spielern)
kann bis zu 200 Spieler und 20 Runden ausgeben. Die Standardeinstellung
ist <b>Automatisch</b>, was fr jedes Turnier das beste Format auswhlt.
</p>
<p>
Beachten Sie, da Scid den <b>Runden</b>-Eintrag jeder Partie verwendet,
um eine Kreuztabelle nach Schweizer System zu erstellen, Sie werden daher
keine Partien in der Schweizer-System-Tabelle sehen, wenn sie keine
numerischen Runden-Angaben haben:  1, 2, 3, etc.
</p>
<p>
Im Ausgabe-Men knnen Sie auch das Format der Datenausgabe nach Ihren
Wnschen einstellen, um Wertungszahlen, Lnder oder Titel ein- oder
auzublenden. Sie knnen auch whlen, ob beim Schweizer System die
Farbzuteilung angezeigt werden soll.
</p>
<p>
Die Option <b>Punktgruppen</b> wirkt sich nur dann auf das Aussehen der
Tabelle aus, wenn die Spieler nach Punkten sortiert werden: sie bewirkt
das Einfgen einer Leerzeile zwischen Spielergruppen mit gleicher Punktzahl.
</p>
<p>
Das Men <menu>Sortieren</menu> erlaubt es Ihnen, die Spieler nach
Namen, Elo-Zahlen oder Punkten zu sortieren; Standardeinstellung ist
nach Punkten.
</p>
<p>
Das <menu>Farben</menu>-Men ermglicht es Ihnen, Farbausgabe (Hypertext)
ein- oder auszuschalten. Da es sehr zeitaufwendig ist, groe Kreuztabellen
in HTML zu formatieren und auszugeben, wird Ihnen die Option <b>Text</b>
bei groen Turnieren eine Menge Zeit einsparen.
Allerdings knnen Sie im Text-Modus keine Spieler oder Partien anklicken.
</p>

<h4>Dubletten in Kreuztabellen</h4>
<p>
Um sinnvolle Resultate mit der Kreuztabelle zu erzielen, sollten Sie
Dubletten zum Lschen markieren, und Ihre Partien sollten eine
einheitliche Schreibweise fr Spieler-, Orts- und Turniernamen haben.
Zu Hilfen beim Lschen der Dubletten und Editieren (oder berprfen
der Schreibweisen) von Spieler-/Turnier-/Ortsnamen, siehe die Seite
<a Maintenance>Datenbank-Wartung</a>.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


###########################
### Database switcher help:

set helpTitle(D,Switcher) "Datenbank-Umschalter"
set helpText(D,Switcher) {<h1>Der Datenbank-Umschalter</h1>
<p>
Der Datenbank-Umschalter bietet eine Darstellung, die es besonders
einfach macht, zwischen Datenbanken zu wechseln oder Dateien zu kopieren.
Der Name, <a Searches Filter>Filter</a>-Status und Icon jeder Datenbank
werden angezeigt, und die aktive Datenbank ist durch einen gelben
Hintergrund hervorgehoben.
</p>
<p>
Sie knnen den Datenbank-Umschalter aus dem <menu>Fenster</menu>-Men
starten oder durch die Tastenkombination <b>Strg+D</b>.
</p>
<p>
Um alle ausgewhlten (gefilterten) Dateien einer Datenbank in eine andere
zu kopieren, ziehen Sie sie mit gedrckter linker Maustaste in das Zielfeld.
Sie sehen dann eine Nachfrage (falls die Zieldatenbank nicht die
<a Clipbase>Ablage</a> ist), ob die Dateien kopiert werden sollen, oder
eine Fehlermeldung, falls die Dateien nicht kopiert werden knnen
(z.B. wenn die gewhlte Datenbank nicht geffnet ist).
</p>
<p>
Drcken Sie die rechten Maustaste ber einer Datenbank, erscheint ein
Kontextmen zu dieser Datenbank, mit dem Sie das Datenbank-Icon ndern oder
den <a Searches Filter>Filter</a> zurcksetzen knnen.
In diesem Men knnen Sie auch die Fensterausrichtung ndern (um die
Datenbankfelder vertikal oder horizontal anzuordnen), was fr kleinere
Bildschirme recht ntzlich ist.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


######################
### Email window help:

set helpTitle(D,Email) "Email-Fenster"
set helpText(D,Email) {<h1>Das Email-Fenster</h1>
<p>
Scids Email-Manager ermglicht es Ihnen, Ihre Email-Fernschachkorrespondenz
zu verwalten.
Wenn Sie kein Email-Schach  spielen, ist dies fr Sie nicht von
Interesse. Aber wenn Sie Fernschach per Email spielen, knnen Sie
Ihre Email-Nachrichten direkt von Scid aus versenden!
</p>
<p>
Um den Email-Manager zu benutzen:
<ul>
<li><b>1)</b> Erstellen Sie die Partie(en) fr Ihren Gegner
    in der Datenbank. </li>
<li><b>2)</b> Whlen Sie <b>Hinzufgen</b> im Email-Manager und geben
    Sie die Daten Ihrer Gegner ein: Name, Email-Adresse und die Zahl
    der Partien in der Datenbank. </li>
<li><b>3)</b> Whlen Sie <b>Email versenden</b> im Email-Fenster, wenn
    Sie Partiezge ausgefhrt haben und eine Nachricht versenden wollen. </li>
</ul>

<p>
Wenn Sie eine E-Mail verschicken, erstellt Scid die Nachricht mit den
Partien im PGN-Format <b>ohne</b> jegliche Kommentare, Anmerkungen oder
Varianten, denn Sie wollen Ihrem Gegner in der Regel nicht Ihre Analysen
zeigen.  Bevor Sie die Nachricht verschicken, knnen Sie sie noch
editieren, um bedingte Zge oder sonstigen Text hinzuzufgen.
</p>
<p>
Fr jeden Gegner knnen Sie eine beliebige Anzahl von Partien haben;
meistens sind es eine oder zwei. Beachten Sie, da Scid nicht berprft,
ob sich die Zahl der Partien gendert hat. Passen Sie also auf, da Sie
nicht Partien lschen oder die Datenbank sortieren, nachdem Sie die Daten
Ihrer Gegner eingegeben haben, denn das wrde die Partien umstellen und
die Partienummern fr Ihre Gegner wren nicht mehr korrekt.
</p>

<h3>Einschrnkungen</h3>
<p>
Scid besitzt noch nicht die Fhigkeit, Ihren E-Mail-Ordner zu berprfen,
Sie mssen daher die Zge Ihrer Kontrahenten manuell eingeben.
</p>

<h3>Konfiguration</h3>
<p>
Eine Kopie jeder von Scid gesendeten E-Mail wird in der Datei
<b>~/.scid/scidmail.log</b> gespeichert. Wenn
Sie sie in einer anderen Datei speichern mchten, mssen Sie die Datei
<b>tcl/start.tcl</b> bearbeiten und Scid neu erstellen ("make scid").
</p>
<p>
Scid kann E-Mails ber einen SMTP-Server oder mit sendmail versenden.
Mit dem Schalter <b>Einstellungen</b> im E-Mail-Manager knnen Sie
auswhlen, welche Mglichkeit Sie verwenden wollen.
</p>
<p>
Scid speichert die Daten Ihrer Gegner fr eine Datenbank in einer Datei
mit demselben Namen wie die Datenbank und der Endung "<b>.sem</b>".
</p>

<p><footer>(Aktualisiert: Scid 3.0, November 2001)</footer></p>
}


############################
### File Finder window help:

set helpTitle(D,Finder) "Dateifinder"
set helpText(D,Finder) {<h1>Das Dateifinder-Fenster</h1>
<p>
Der <term>Dateifinder</term> hilft Ihnen, Dateien jedes von Scid
benutzten Typs zu finden:  Datenbanken, <a PGN>PGN</a>-Dateien,
<a EPD>EPD</a>-Dateien und <a Repertoire>Repertoire</a>-Dateien.
</p>
<p>
Der Finder zeigt Ihnen ntzliche Informationen zu jeder Datei, wie
etwa ihre Gre (siehe unten) und Datum der letzten Modifikation.
Sie knnen jede angezeigte Datei durch einen linken Mausklick ffnen.
</p>

<h3>In Unterverzeichnissen nachsehen</h3>
<p>
Wenn Sie alle Dateien in allen Unterverzeichnissen des aktuellen
Verzeichnisses finden wollen, schalten Sie <b>Unterverzeichnisse
beachten</b> ein. Dann durchsucht Scid rekursiv jedes Unterverzeichnis
nach Dateien, die Scid ffnen kann. Wenn viele Unterverzeichnisse
vorhanden sind, kann dies eine Weile dauern, Sie sollten das also
nicht fr ein Verzeichnis nahe dem Hauptverzeichnis des Dateisystems
tun. Sie knnen die Dateisuche mit dem <b>Stop</b>-Schalter unterbrechen.
</p>

<h3>Dateigren</h3>
<p>
Die Bedeutung der vom Finder angegebenen Dateigre hngt vom Typ der
Datei ab. Fr Scid-Datenbanken und -PGN-Dateien ist es die Anzahl der
Partien. Fr EPD-Dateien ist es die Anzahl der Positionen. Fr
Repertoire-Dateien ist es die Anzahl der (gewhlten oder ausgeschlossenen)
Varianten.
</p>
<p>
Fr alle Dateitypen mit Ausnahme von Scid-Datenbanken ist die Dateigre
eine Schtzung durch Auswertung lediglich der ersten 64 Kilobytes der
Datei, die Gre ist daher fr Dateien grer als 64 Kilobytes
mglicherweise nicht korrekt. Geschtzte Gren werden mit einer Tilde
(~) angezeigt zum Zeichen dafr, da sie nicht exakt sind.
</p>

<p><footer>(Aktualisiert: Scid 2.7, September 2001)</footer></p>
}


#########################
### GameList window help:

set helpTitle(D,GameList) "Partieliste"
set helpText(D,GameList) {<h1>Das Partieliste-Fenster</h1>
<p>
Das Partieliste-Fenster gibt eine einzeilige Zusammenfassung jeder
Partie im aktuellen <term>Filter</term> aus.
</p>

<h3>Navigation in der Partieliste</h3>
<p>
Sie knnen in der Partieliste mit dem Schieberegler oder den vier
Schaltern unterhalb der Liste blttern.
Sie knnen auch die Tasten [Pos1], [End], [Bild auf], [Bild ab] sowie
die Cursortasten verwenden, um mit der Tastatur zu scrollen.
</p>
<p>
Sie knnen die nchste Partie in der Liste, die einen bestimmten
Text im Wei-, Schwarz-, Turnier- oder Ortsfeld enthlt, mit dem
<b>Text finden</b>-Eingabefeld finden.
</p>

<h3>Aktionen mit Partien in der Liste</h3>
<p>
Um eine Datei aus der Liste zu laden, klicken Sie sie doppelt mit
der linken Maustaste an.
Ein Klick mit der mittleren Maustaste zeigt die Anfangszge der Partie;
das ist ntzlich, wenn man vor dem Laden einer Partie die Erffnung
nachsehen will.
</p>
<p>
Die rechte Maustaste produziert ein Men fr die ausgewhlte Partie,
in dem Sie die Partie lschen (oder "entlschen") oder aus dem Filter
ausschlieen knnen. Beachten Sie, da das Lschen einer Datei lediglich
ihre Lschmarkierung setzt; sie verbleibt solange in der Datenbank,
bis Sie diese <a Compact>komprimieren</a>.
</p>

<h3>Die Partieliste konfigurieren</h3>
<p>
Um die Partieliste zu konfigurieren, klicken Sie mit der linken oder
rechten Maustaste auf eine Spaltenberschrift. Sie knnen die Breite
verndern, Spalten hinzufgen oder entfernen und die Farbe jeder
Spalte verndern.
</p>
<p>
Wenn Sie nur die Spaltenbreite ndern wollen, dafr gibt es eine
Tastenkombination: klicken Sie bei gedrckter <b>[Strg]</b>- (oder
<b>[Umschalt]</b>)-Taste mit der linken Maustaste auf die
Spaltenberschrift, wird die Spalte kleiner, mit der rechten
Maustaste, wird sie breiter.
</p>

<h3>Gre der Partieliste ndern</h3>
<p>
Die Gre der Partieliste wird jedesmal in der Optionsdatei gespeichert,
wenn Sie Ihre Einstellungen sichern.
Wenn Sie also wollen, da die Dateiliste standardmig 10 Partien anzeigt,
verndern Sie einfach die Gre des Partieliste-Fensters und whlen
dann <b>Optionen speichern</b> im <menu>Optionen</menu>-Men.
</p>

<h3><name Browsing>Partien betrachten und mischen</name></h3>
<p>
Das Kontextmen der Partieliste (und einiger andere Fenster, wie etwa
des <a OpReport>Erffnungs-Report</a>-Fensters und der Liste der
<a Tree Best>beste(n) Partien</a> des <a Tree>Zugbaum</a>-Fensters)
erlauben die Auswahl, eine Partie zu laden, zu betrachten oder zu
mischen.
</p>
<p>
Wenn <term>Partie betrachten</term> ausgewhlt wird, werden die Zge
der ausgewhlten Partie (ohne Kommentare oder Varianten) in einem
separaten Fenster ausgegeben. Das ist eine ntzliche Methode, um eine
andere Partie im voraus anzuschauen, ohne die aktuell geladene Partie
zu berhren.
</p>
<p>
Die Funktion <term>Partie mischen</term> ermglicht es, die ausgewhlte
Partie als Variante der aktuellen Partie einzufgen. Scid findet den
letztmglichen Zeitpunkt, wo die gewhlte Partie von der aktuellen
abweicht (unter Bercksichtigung von Zugumstellungen), und fgt an
dieser Position eine Variante ein. Sie knnen die Zahl der angezeigten
Zge der gewhlten Partie ndern, je nachdem, ob Sie die ganze Partie
oder nur die Erffnungsphase hinzufgen wollen.
</p>

<p><footer>(Aktualisiert: Scid 3.2, Februar 2002)</footer></p>
}


#######################
### Import window help:

set helpTitle(D,Import) "Import-Fenster"
set helpText(D,Import) {<h1>Das Import-Fenster</h1>
<p>
Scids Import-Fenster ermglicht es Ihnen, auf einfache Weise eine
Partie im <a PGN>PGN-Format</a> aus einer anderen Anwendung oder
einem anderen Fenster in Scid einzufgen.
</p>
<p>
In den groen Fensterbereich tippen oder fgen Sie den Partietext im
PGN-Format ein, und im grauen Bereich darunter erscheinen
Fehlermeldungen oder Warnungen.
</p>

<h3>Die aktuelle Partie im Import-Fenster bearbeiten</h3>
<p>
Das Import-Fenster bietet auch eine weitere, bequeme Mglichkeit fr
nderungen an der aktuellen Partie: Sie knnen die aktuelle Partie in
das Import-Fenster einfgen (mit dem Schalter <b>Aktuelle Partie
einfgen</b>), den Text editieren und danach auf <b>Import</b> klicken.
</p>

<h3>PGN-Tags im Import-Fenster</h3>
<p>
Scid erwartet PGN-Eintrge ("header tags") wie
<ul>
<li> <b>[Result "*"]</b> </li>
</ul>
vor den Zgen, aber Sie knnen auch ein Partiefragment wie
<ul>
<li> <b>1.e4 e5 2.Bc4 Bc5 3.Qh5?! Nf6?? 4.Qxf7# 1-0</b> </li>
</ul>
ohne PGN-Tags einfgen, und Scid wird es importieren.
</p>

<h3>PGN-Dateien in Scid verwenden</h3>
<p>
Wenn Sie eine PGN-Datei in Scid verwenden wollen, ohne sie vorher mit
<a Pgnscid>pgnscid</a> zu konvertieren, gibt es zwei Mglichkeiten.
</p>
<p>
Zum einen knnen Sie die Partien der Datei mit der Men-Option
<menu>Werkzeuge: Datei mit PGN-Partien importieren ...</menu> importieren.
</p>
<p>
Die Alternative wre, die PGN-Datei direkt in Scid zu ffnen. Allerdings
werden PGN-Dateien nur zum Lesen geffnet und bentigen mehr Speicher als
eine vergleichbare Scid-Datenbank, diese Mglichkeit ist also nur fr
relativ kleine PGN-Dateien zu empfehlen.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


########################
### Opening Report help:

set helpTitle(D,OpReport) "Erffnungsreport"
set helpText(D,OpReport) {<h1>Erffnungsreport</h1>
<p>
Scid kann einen <term>Erffnungsreport</term> erstellen, der interessante
Informationen ber die aktuelle Erffnungsposition ausgibt. Um den
Erffnungsreport zu generieren, vergewissern Sie sich als erstes, da die
dargestellte Position auch die ist, fr den Sie den Bericht haben wollen,
dann whlen Sie <b>Erffnungsreport</b> im Men <menu>Werkzeuge</menu>.
</p>
<p>
Das <term>Erffnungsreport</term>-Fenster gibt die Ergebnisse des von
Scid erstellten Berichts aus. Das <b>Datei</b>-Men enthlt Optionen,
um den Report in einer Datei zu speichern, im Text-, HTML- oder
<a LaTeX>LaTeX</a>-Format.
</p>
<p>
Die ersten Abschnitte des Berichts prsentieren Informationen zu den
Partien, die die Berichtsposition erreicht haben, und zu den Zgen, die
in dieser Stellung gespielt wurden. Sie knnen erkennen, ob die Erffnung
populrer wird, ob sie zu vielen Kurzremisen fhrt und mit welchen
Zugfolgen (Zugumstellungen) sie erreicht wird.
</p>
<p>
Der letzte und lngste Teil des Berichts ist die Theorie-Tabelle. Wenn Sie
den Bericht in einer Datei sichern, knnen Sie whlen, ob Sie nur die
Theorie-Tabelle, einen kompakten Bericht ohne die Theorie-Tabelle oder
den gesamten Bericht sichern wollen.
</p>
<p>
Fast alle Abschnitte des Berichts knnen mit den Erffnungsreport-Optionen
eingestellt oder ein- und ausgeschaltet werden, Sie knnen also den
Bericht so anpassen, da er nur die fr Sie interesanten Informationen
enthlt.
</p>
<p>
Bei den meisten Informationen im Berichtsfenster, die farbig dargestellt
sind, fhrt ein linker Mauklick zu einer Aktion. Zum Beispiel knnen Sie
eine angefhrte Partie durch Anklicken laden oder den Filter durch
Klicken auf ein Positionsthema so einstellen, da er nur die
Berichtspartien mit diesem Thema enthlt.
</p>

<h3>Beschrnkungen</h3>
<p>
Fr die meisten Berichtsdaten gibt es eine Beschrnkung auf 2000 Partien,
wenn die Berichtsposition also mehr als 2000 Partien enthlt, knnen
einige Resultate etwas ungenau sein.
</p>
<p>
Auerdem gibt es ein Limit von 500 Partien fr die Theorie-Tabelle. Wenn
die Berichtsposition in mehr als 500 Partien vorkommt, werden zur
Erstellung der Theorie-Tabelle nur die 500 Partien mit den hchsten
durchschnittlichen Elo-Zahlen herangezogen. Die Anzahl der Partien zum
Aufbau der Theorie-Tabelle ist einstellbar.
</p>

<h3>LaTeX-Vorschau</h3>
<p>
Der Schalter <b>LateX-Vorschau</b> in der linken unteren Ecke des
Berichtsfensters (nicht verfgbar bei Windows-Versionen) schreibt den
Bericht in eine temporre LaTeX-Datei, ruft <b>latex</b> fr diese Datei
auf und fhrt dann <b>xdvi</b> zur Darstellung des Resultats aus. Das
funktioniert <b>nur</b>, wenn Sie latex, dvi und alle notwendigen
latex-Pakete auf Ihrem Rechner installiert haben; siehe auch die
Hilfeseite <a LaTeX>Scid und LaTeX</a>.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


####################
### PGN window help:

set helpTitle(D,PGN) "PGN-Fenster"
set helpText(D,PGN) {<h1>Das PGN-Fenster</h1>
<p>
Scids PGN-Fenster gibt den Inhalt der aktuellen Partie in der
Standard-PGN-Darstellung aus. Im Partietext erscheinen Kommentare in
{geschweiften} und Varianten in (runden) Klammern.
</p>

<h3>PGN-Format</h3>
<p>
PGN (Portable Game Notation) ist ein verbreiteter Standard zum Transfer
von Schachpartien zwischen Computerprogrammen. Eine PGN-Partie besteht
aus zwei Abschnitten.
Der erste Teil ist der Header ("Kopf"), der Eintragungen ("tags") wie
z.B.
<b>[White "Kasparov, Gary"]</b>
und
<b>[Result "1/2-1/2"]</b> enthlt.
</p>
<p>
Der zweite Abschnitt enthlt die eigentlichen Partiezge in
algebraischer Standardnotation (SAN) zusammen mit eventuellen Varianten,
<a NAGs>Kommentarsymbolen</a> und <a Comment>Kommentaren</a>.
</p>

<h3>Aktionen im PGN-Fenster</h3>
<p>
Sie knnen mit dem PGN-Fenster innerhalb der Partie navigieren: Mit
einem Linksklick auf einen Zug gehen Sie zu diesem Zug, mit einem
Linksklick auf einen Kommentar knnen Sie diesen editieren.
Die Cursortasten (sowie die Tasten <b>v</b> und <b>z</b> fr
Variante beginnen bzw. verlassen) funktionieren zum Navigieren in der
Partie genau wie im Hauptfenster.
</p>

<h3>Einstellungen fr PGN-Ausgabe</h3>
<p>
Das Men des PGN-Fensters enthlt Optionen, die die Ausgabe des Fensters
betreffen. Scid kann die Partie farbig oder als reinen Text darstellen
-- siehe das <menu>Ausgabe</menu>-Men im PGN-Fenster.
Die farbige Darstellung ist leichter zu lesen und erlaubt Ihnen, Zge und
Kommentare mit der Maus auszuwhlen, aber sie ist viel langsamer zu
aktualisieren. Fr sehr lange Partien sollten Sie vielleicht die
einfache Textausgabe whlen.
</p>
<p>
Auch das Format der Kommentare und Varianten knnen Sie verndern,
indem Sie sie zwecks besserer bersichtlichkeit eingerckt oder in
separaten Zeilen ausgeben lassen.
</p>
<p>
Die PGN-Ausgabe-Optionen und die Gre des PGN-Fensters werden, wann
immer Sie <b>Optionen speichern</b> im <menu>Optionen</menu>-Men whlen,
in der Konfigurationsdatei gesichert.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


#######################
### Piece Tracker help:

set helpTitle(D,PTracker) "Figurenverteilung"
set helpText(D,PTracker) {<h1>Das Figurenverteilungs-Fenster</h1>
<ENGLISH>
<p>
Die <term>Figurenverteilung </term> bzw. das Figurenverteilungs-Fenster
ist ein Werkzeug, um die Bewegungen bestimmter Figuren in allen Partien
des aktuellen Filters nachzuvollziehen und ein Bewegungsmuster (eine
"Fuspur") zu generieren, das aufzeigt, wie oft jedes Feld von dieser
Figur besetzt wurde.
</p>
<p>
Um die Figurenverteilung zu benutzen, vergewissern Sie sich zuerst, da
der Filter die Partien enthlt, die Sie interessieren, z.B. Partien mit
einer bestimmten Erffnungsposition oder alle Weipartien eines
bestimmten Spielers. Dann whlen Sie die Figur, deren Bewegung Sie
nachvollziehen wollen, und whlen die unten im Text erluterten Optionen.
Danach klicken Sie auf den Schalter <b>Aktualisieren</b>.
</p>
<p>
Die Information ber die Figurenbewegungen wird auf zwei Arten dargestellt:
eine graphische "Fuspur" und eine Liste mit einer Textzeile pro Feld.
</p>

<h3>Auswahl der Figur</h3>
<p>
Die Schachfiguren sind unterhalb der "Karte" fr die "Fuspur" gem der
Ausgangsstellung angeordnet. Eine einzelne Figur (wie etwa der weie
Springer b1 oder der schwarze Bauer d7) kann mit der linken Maustaste
ausgewhlt werden, alle Figuren von gleichem Typ und gleicher Farbe
(wie z.B. alle weien Bauern oder beide schwarzen Trme) mit der
rechten Maustaste.
</p>

<h3>Weitere Einstellungen</h3>
<p>
Der Zugnummer-Bereich kontrolliert, wann die Figurenverfolgung anfangen
und enden soll. Die Standardeinstellung 1-20 (d.h. die Verfolgung endet
nach dem 20. Zug von Schwarz) ist gut geeignet zur Untersuchung von
Erffnungsthemen, aber (z.B.) ein Bereich von 15-35 wre besser, wenn
man Entwicklungen im Mittelspiel betrachten will.
</p>
<p>
Es knnen zwei Arten von Statistiken generiert werden:
<ul>
<li> <b>% der Partien mit Zug auf das Feld</b>: zeigt, welcher Anteil
     an Filterpartien einen Zug der zu beobachtenden Figur auf jedes
     Feld enthlt. Das ist die Standardeinstellung und normalerweise
     die beste Wahl.
<li> <b>% der Zeit auf jedem Feld</b>: zeigt den Anteil der
     Verweildauer der zu beobachtenden Figur auf jedem Feld.
</ul>
</p>

<h3>Hinweise</h3>
<p>
Es gibt (mindestens) drei gute Verwendungsmglichkeiten fr die
Figurenverteilung: Erffnungsvorbereitung, Mittelspielthemen und
Spielervorbereitung.
</p>
<p>
Fr die Erffnungsvorbereitung verwenden Sie die Figurenverteilung
zusammen mit dem <a Tree>Zugbaum</a>. Indem Sie die Bewegungen von
Figuren nachvollziehen, knnen Sie Entwicklungen in der aktuellen
Erffnung erkennen, beispielsweise bliche Bauernvorste,
Springervorposten und die hufigsten Luferplazierungen. Dabei ist es
hilfreich, den Zugbereich nach dem aktuellen Partiezug beginnen zu
lassen, so da die Zge, die zur aktuellen Stellung fhrten, nicht in
die Statistik einflieen.
</p>
<p>
Fr Mittelspielthemen kann die Figurenverteilung ntzlich sein, wenn
der Filter einen bestimmten Elo-Bereich enthlt (mit der
<a Searches Header>Partiedaten-Suche</a>) oder vielleicht ein Muster
wie "Isolierter Damenbauer von Wei"
(mit der <a Searches Material>Material/Muster-Suche</a>).
Stellen Sie den Zugbereich auf einen sinnvollen Wert ein (z.B. 20-40)
und verfolgen Sie Figuren, um beispielsweise Bauernvorste im spten
Mittelspiel oder frhen Endspiel zu erkennen
</p>
<p>
Zur Spielervorbereitung verwenden Sie die
<a Searches Header>Partiedaten-Suche</a> oder die
<a PInfo>Spieler-Information</a>, um alle Partien einer Farbe eines
bestimmten Spielers zu finden. Die Figurenverteilung kann dann genutzt
werden um z.B. festzustellen, wie gern der Spieler Lufer fianchettiert,
lang rochiert oder einen Bauernkeil bis d5 oder e5 treibt.
</p>
</ENGLISH>

<p><footer>(Aktualisiert: Scid 3.3, April 2002)</footer></p>
}


#####################
### Player Info help:

set helpTitle(D,PInfo) "Spielerinformation"
set helpText(D,PInfo) {<h1>Die Spieler-Information</h1>
<p>
Das Fenster <term>Spieler-Information</term> wird jedesmal aufgebaut
oder aktualisiert, wenn Sie im Informationsbereich (unterhalb des
Schachbretts) oder im <a Crosstable>Kreuztabellen</a>-Fenster mit der
linken Maustaste auf einen Spielernamen klicken.
</p>
<p>
Es gibt (hoffentlich) ntzliche Informationen ber die Spieler aus,
einschlielich ihrer Erfolgsrate mit Wei und Schwarz, ihrer bevorzugten
Erffnungen (nach <a ECO>ECO-Code</a>) und ihrer Elo-Entwicklung.
</p>
<p>
Jede Prozentangabe ist das Ergebnis, das man aus Sicht des Spielers
erwartet (Erfolgsrate) -- d.h. ein hherer Wert ist fr die Spieler
immer besser, ob als Wei oder Schwarz.
</p>
<p>
Sie knnen die ELO-Entwicklung des Spielers graphisch dargestellt
sehen, wenn Sie die Taste <a Graphs Rating>ELO-Zahl-Verlauf</a> anklicken.
</p>
<p>
Jede rot dargestellte Zahl knnen Sie mit der linken Maustaste anklicken,
um den <a Searches Filter>Filter</a> so einzustellen, da er die
entsprechenden Partien enthlt.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


###########################
### Repertoire editor help:

set helpTitle(D,Repertoire) "Repertoire-Editor"
set helpText(D,Repertoire) {<h1>Der Repertoire-Editor</h1>
<p>
Mit dem Repertoire-Editor knnen Sie <term>Repertoire</term>-Dateien
erstellen, lesen oder bearbeiten. Eine Repertoire-Datei ist eine Liste
der Erffnungspositionen, die Sie erreichen wollen oder zu vermeiden
suchen; Sie knnen sie zur Organisation Ihrer Erffnungsprferenzen
und zur Datenbanksuche in Scid verwenden.
</p>

<h3>Repertoiregruppen und -varianten</h3>
<p>
Ein Repertoire enthlt zwei Elementtypen: <term>Gruppen</term> und
<term>Varianten</term>. Gruppen sind nicht tatschlich Teil Ihres
Repertoires; sie werden nur zur Strukturierung verwendet, so wie
Verzeichnisse Dateien auf einem Datentrger strukturieren.
</p>
<p>
In einem Repertoire gibt es in zwei Arten von Varianten:
<term>eingeschlossene</term> Varianten reprsentieren Erffnungspositionen,
an denen Sie interessiert sind und die Sie erreichen wollen, und
<term>ausgeschlossene</term> Varianten, die Sie nicht spielen wollen
und zu vermeiden suchen.
Wenn Sie z.B. Angenommenes Damengambit (1.d4 d5 2.c4 dxc4) mit Schwarz
spielen und nach 3.e4 alle Zge <i>auer </i> 3...Sf6 spielen, htten
Sie 1.d4 d5 2.c4 dxc4 3.e4 als eingeschlossene Variante und 1.d4 d5 2.c4
dxc4 3.e4 Sf6 als ausgeschlossene Variante.
</p>

<h3>Kommentare und Anmerkungen</h3>
<p>
Jede Gruppe oder Variante kann Kommentare enthalten. Es gibt zwei Typen:
kurze (einzeilige) Kommentare erscheinen (in Rot) in der
Repertoire-Hierarchie neben den Zgen der Gruppe oder Variante, whrend
ein langer (mehrzeiliger) Kommentar nur angezeigt wird, wenn die Gruppe
oder Variante ausgewhlt wird.
</p>

<h3>Das Fenster des Repertoire-Editors</h3>
<p>
Die <b>linke</b> Seite des Fensters zeigt die Repertoire-Hierarchie.
Sie knnen die Gruppendarstellung mit einem Klick auf den Ordner auf-
bzw. zuklappen, und mit einem Klick auf die Zge der Gruppen oder
Varianten whlen Sie diese aus und sehen ihre Kommentare.
Eingeschlossene Varianten werden mit einem blauen Haken angezeigt,
ausgeschlossene Varianten haben ein rotes Kreuz.
</p>
<p>
Wenn eine Variante oder Gruppe einen Kurzkommentar hat, wird er hinter
den Zgen angezeigt. Wenn sie einen langen Kommentar hat, wird dies mit
<b><red>**</red></b> nach den Zgen angezeigt. Bei den Gruppen steht
nach den Zgen eine Zahl in Klammern, die die Anzahl der (ein- und
ausgeschlossenen) Varianten anzeigt, die sie jeweils enthalten.
</p>
<p>
Nach einem Rechtsklick auf eine Gruppe oder Variante erscheint ein Men
mit den verfgbaren Funktionen wie Lschen oder Statusnderung.
</p>
<p>
Die <b>rechte</b> Seite des Fensters besteht aus drei Bereichen. Der
erste enthlt die Zge der gerade ausgewhlten Variante oder Gruppe. Sie
knnen ihn mit der linken Maustaste anklicken, womit Sie die Zge in das
<a Import>Import</a>-Fenster einfgen, was recht ntzlich ist, um die
aktuelle Partie mit einer Variante des Repertoires beginnen zu lassen.
Der zweite Bereich enthlt den Kurzkommentar der Variante oder Gruppe,
der dritte Bereich ihren langen Kommentar.
</p>

<h3>Gruppen und Varianten dem Repertoire hinzufgen</h3>
<p>
Um eine Variante oder Gruppe hinzuzufgen, fhren Sie einfach ihre Zge
auf dem Schachbrett im Hauptfenster aus, whlen dann das Men
<menu>Bearbeiten</menu> im Repertoire-Editor und fgen sie als Gruppe,
eingeschlossene Variante oder ausgeschlossene Variante hinzu.
</p>
<p>
Um eine Gruppe oder Variante zu lschen, klicken Sie sie mit der rechten
Maustaste an und whlen im erschienenen Men das entsprechende Kommando.
</p>

<h3><name Search>Datenbanksuche mit Repertoire-Dateien</name></h3>
<p>
Das Men <menu>Suchen</menu> des Repertoire-Editors ermglicht es Ihnen,
mit dem Repertoire in der aktuellen Datenbank zu suchen. Jede Partie
wird mit den Positionen im Repertoire verglichen und nur dann erkannt,
wenn die <i>tiefste</i> Repertoireposition fr eine <i>eingeschlossene</i>
Variante gefunden wurde.
</p>
<p>
Sie knnen whlen, ob Sie nach dem gesamten Repertoire oder nur nach den
ausgegebenen Varianten suchen wollen. Die Suche nach den ausgegebenen
Varianten ist nur dann sinnvoll, wenn Sie nur nach einigen Varianten
des Repertoires suchen. Beispiel: Ein Repertoire habe zwei Hauptgruppen
auf der obersten Ebene, eine fr 1.e4 und eine fr 1.d4. Wenn Sie nur
an den e4-Varianten interessiert sind, klappen Sie einfach die Gruppe
1.d4 zu und suchen dann nur nach den ausgegebenen Varianten.
</p>

<h3>Weitere Hinweise</h3>
<p>
Eine Repertoire-Datei eignet sich sehr gut zum Finden neuer Partien in
Ihrem Erffnungssystem. Beispiel: Jedesmal, wenn Sie eine PGN-Datei
erhalten und sie Ihrer Haupt-Datenbank hinzufgen (wie etwa
die ausgezeichneten wchentlichen PGN-Dateien von
<url http://www.chesscenter.com/twic/>The Week In Chess</url>),
ffnen Sie einfach die PGN-Datei in Scid und fhren eine Repertoire-Suche
durch. Dann knnen Sie die gefilterten Partien betrachten und haben
alle Partien, die in Ihrem Repertoire enthalten sind.
</p>
<p>
Sie sollten vielleicht zwei Repertoire-Dateien anlegen: eine fr Schwarz
und eine fr Wei, so da Sie mit jeder Datei getrennt suchen knnen.
</p>
<p>
Eine Repertoire-Datei kann von der Kommanozeile aus geffnet werden,
zum Beispiel:<br>
<b>scid datenbank weiss.sor</b>
</p>
<p>
Sie knnen eine Repertoire-Datei (.sor) mit jedem Editor bearbeiten,
aber passen Sie auf, da Sie nicht ihr Format verndern, sonst kann
sie von Scid nicht geladen oder gesucht werden.
</p>

<p><footer>(Aktualisiert: Scid 2.6, August 2001)</footer></p>
}


##################################
### Tournament Finder window help:

set helpTitle(D,Tmt) "Turnier-Finder"
set helpText(D,Tmt) {<h1>Der Turnier-Finder</h1>
<p>
Der <term>Turnier-Finder</term> ermglicht es Ihnen, Turniere in der
aktuellen Datenbank zu finden. Er untersucht alle Datenbankpartien und
vergleicht Daten mit den gefundenen Turnieren. Es wird angenommen, da
zwei Partien zum selben Turnier gehren, wenn sie denselben Turnier-
und Ortseintrag haben und innerhalb von drei Monaten gespielt wurden.
</p>
<p>
Sie knnen die Liste der Turniere durch die Anzahl der Spieler und
Partien, das Datum, die durchschnittliche Elo-Zahl und das Land
einschrnken, wenn Sie die Felder unterhalb der Turnierliste ausfllen
und dann auf <b>Aktualisieren</b> klicken.
</p>
<p>
Die ausgegebene Liste kann nach Datum, Spielerzahl, Partienzahl,
durchschnittliche Elo-Zahl, Ort, Turnier oder Nachname des Gewinners
sortiert werden. Whlen Sie die Kategorie im
<menu>Sortieren</menu>-Men oder klicken Sie auf die Spaltenberschrift,
um das Sortierkriterium zu ndern.
</p>
<p>
Um die erste Partie eines der aufgefhrten Turniere zu laden, klicken
Sie einfach mit der linken Maustaste, wenn die entsprechende Zeile
hervorgehoben ist. Damit wird auch das
<a Crosstable>Kreuztabellen</a>-Fenster aktualisiert, falls es geffnet
ist.
<ENGLISH>
Wenn Sie statt dessen die rechte Maustaste drcken, wird die Partie
geladen und das Kreuztabellen-Fenster geffnet, auch wenn es vorher
geschlossen war.
</ENGLISH>
</p>
<p>
Es ist eine gute Idee, zur Beschleunigung des Suchprozesses den
Datenbereich angemessen einzuschrnken (z.B. hchstens einige Jahre)
oder ein einzelnes Land auszuwhlen (mit dem 3stelligen
Standard-Lndercode). Damit wird die Zahl der Partien, die Scid bei
der Konstruktion von Turnieren aus den Partien bercksichtigen mu,
auerordentlich verringert.
</p>

<p><footer>(Aktualisiert: Scid 3.3, April 2002)</footer></p>
}


####################
### Tree window help:

set helpTitle(D,Tree) "Zugbaum"
set helpText(D,Tree) {<h1>Das Zugbaum-Fenster</h1>
<p>
Das <term>Zugbaum</term>-Fenster liefert Informationen ber alle Zge,
die in der aktuellen Position in den Datenbankpartien gespielt wurden.
Im Zugbaum-Modus wird das Fenster automatisch aktualisiert, sowie sich
die Stellung im Hauptfenster ndert. Fr groe Datenbanken ist das
evtl. etwas langsam.
</p>
<p>
Jedesmal, wenn das Zugbaum-Fenster aktualisiert wird, wird der
<a Searches Filter>Filter</a> zurckgesetzt, und nur die Partien, die
die die aktuelle Position enthalten, sind erfat.
</p>
<p>
Ein Klick mit der linken Maustaste auf einen Zug im Zugbaum-Fenster
fgt diesen Zug der Partie hinzu.
</p>

<h3>Inhalt des Zugbaum-Fensters</h3>
<p>
Das Zugbaum-Fenster zeigt den <a ECO>ECO-Code</a> (falls vorhanden),
die Hufigkeit (als Anzahl der Partien und in Prozent) und die
Punkte jedes Zuges an. Die <term>Punkte</term> werden immer aus
der Sicht von <b>Wei</b> berechnet, 100% bedeutet also, alle
Weispieler gewinnen, und 0% heit nur Schwarzsiege.
</p>
<p>
Die Zge im Zugbaum-Fenster knnen nach Zgen (alphabetisch), ECO-Code,
Hufigkeit oder Punkten sortiert werden. Sie knnen die Sortiermethode
im Men <menu>Sortieren</menu> ndern.
</p>

<h3><name Best>Das Fenster "Beste Partien"</name></h3>
<p>
Das Zugbaum-Fenster besitzt ein Dateimen-Kommando und einen Schalter,
um das Fenster <term>Beste Partien</term> zu ffnen, welches eine Liste
der am hchsten bewerteten Partien des aktuell gezeigten Astes ausgibt.
Die Partien sind nach durchschnittlicher Elo-Zahl sortiert, und Sie
knnen die Liste auf Partien mit einem bestimmten Ergebnis beschrnken.
</p>

<h3><name Graph>Zugbaum-Graphik</name></h3>
<p>
Das Zugbaum-Fenster enthlt einen mit <term>Graphik</term> bezeichneten
Schalter, der eine graphische Darstellung der relativen Erfolgsrate
jedes Zuges in der aktuellen Stellung liefert.
Alle Zge, die in mindestens 1% der Partien und mindestens 5mal
gespielt wurden, werden dargestellt.
Die prozentualen Ergebnisse werden immer aus der Perspektive von
Wei gesehen, auch wenn Schwarz am Zug ist.
</p>
<p>
In der Zugbaum-Graphik ist eine rote Linie eingezeichnet, die den
Durchschnitt aller Partien in der aktuellen Position anzeigt, und der
Bereich zwischen 50 und 55% (wo der Erwartungswert der meisten
Standarderffnungen liegt) ist blau gefrbt. In Meisterpartien erreicht
Wei blicherweise etwa 55%.
</p>

<h3><name Lock>Das Zugbaum-Fenster anbinden</name></h3>
<p>
Mit dem Schalter <term>Anbinden</term> im Zugbaum-Fenster kann man den
Zugbaum an die aktuelle Datenbank binden. Das heit, der Zugbaum wird
weiterhin diese Datenbank benutzen, auch wenn Sie zu einer anderen
geffneten Datenbank wechseln. Das ist recht ntzlich, wenn Sie eine
groe Datenbank als Referenz verwenden wollen, whrend Sie eine Partie
in einer anderen Datenbank nachspielen: ffnen Sie einfach den Zugbaum
auf der Referenzdatenbank, binden ihn an und wechseln dann zur anderen
Datenbank.
</p>

<h3><name Training>Training</name></h3>
<p>
Wenn der <term>Trainings</term>-Schalter im Zugbaum-Fenster aktiviert
ist, wird Scid jedesmal, wenn Sie einen Zug in der Partie ausfhren,
einen zufllig ausgewhlten Zug erwidern. Der Zug, den Scid auswhlt,
hngt von der Datenbankstatistik ab, d.h. ein Zug, der in 80% der
Datenbankpartien gespielt wurde, wird von Scid mit 80%iger
Wahrscheinlichkeit ausgewhlt. Diese Funktion einschalten und dann das
Zugbaumfenster verstecken (oder minimieren) und Erffnungen gegen eine
groe Datenbank spielen ist eine ausgezeichnete Methode, Ihre Kenntnisse
Ihres Erffnungsrepertoires zu testen.
</p>

<h3>Den Zugbaum in geffneten EPD-Dateien verwenden</h3>
<p>
Fr jede geffnete <a EPD>EPD-Datei</a> enthlt das Zugbaum-Fenster
eine weitere Spalte, die fr jede Position, die mit den angegebenen
Zgen erreicht wird, eine kurze (fnf Zeichen) Zusammenfassung des
Dateiinhalts anzeigt.
</p>
<p>
Die Zusammenfassung knnte eine Bewertung, ein Erffnungscode oder ein
Zugvorschlag sein; sie wird der Inhalt des ersten gefundenen EPD-Feldes
aus der folgenden Liste sein: <b>ce, eco, nic, pv, pm, bm, id</b>, oder
einfach des ersten EPD-Feldes, falls keines der obigen vorhanden ist.
</p>
<p>
Fr eine Beschreibung der EPD-Felder siehe die Hilfeseite
<a EPD>EPD-Dateien</a>. Wenn die Zusammenfassung das <b>ce</b>-Feld
ist, wird sie zur besseren Lesbarkeit als Bewertung in Bauern aus der
Sicht von Wei angezeigt (anstatt als Bewertung in Hundertstel Bauern
aus der Sicht der am Zug befindlichen Seite, wie sie in der EPD-Datei
gespeichert ist).
</p>

<h3>Schnellere Ergebnisse durch Zwischenspeichern</h3>
<p>
Scid nutzt fr die am hufigsten vorkommenden Positionen einen
Cachespeicher fr die Ergebnisse der Zugbaumsuche. Wenn Sie sich im
Zugbaum-Modus in einer Partie vorwrts und rckwrts bewegen, werden
Sie bemerken, da das Zugbaum-Fenster praktisch sofort aktualisiert
wird, wenn die gesuchte Stellung im Cachespeicher ist.
</p>
<p>
Das Zugbaum-Fenster hat ein Dateimen-Kommando <term>Cache-Datei
sichern</term>. Wenn Sie das auswhlen, wird der aktuelle Inhalt des
Zugbaum-Zwischenspeichers in eine Datei geschrieben (mit der Endung
<b>.stc</b>), um sptere Anwendungen des Zugbaum-Modus mit dieser
Datenbank zu beschleunigen.
</p>
<p>
Die Option <term>Cache-Datei fllen</term> im Dateimen des
Zugbaum-Fensters fllt die Cache-Datei mit Daten fr viele
Erffnungspositionen. Es werden etwa 100 der hufigsten
Erffnungsstellungen gesucht, dann wird die Cache-Datei geschrieben.
</p>
<p>
Beachten Sie, da eine Zugbaum-Cachedatei (.stc) vllig redundant ist;
Sie knnen sie ohne Auswirkungen auf die Datenbank lschen, und
tatschlich wird sie jedesmal von Scid gelscht, wenn sie nach
irgendeiner Aktion veraltet sein knnte -- zum Beispiel nach Hinzufgen
oder Ersetzen einer Partie, oder nach Sortieren der Datenbank.
</p>

<p><footer>(Aktualisiert: Scid 3.0, November 2001)</footer></p>
}


################
### Graphs help:

set helpTitle(D,Graphs) "Graphik-Fenster"
set helpText(D,Graphs) {<h1>Graphik-Fenster</h1>
<p>
Scid hat einige Fenster, die Informationen graphisch darstellen.
Diese werden im nachfolgenden erklrt.
</p>

<ENGLISH>
<h3><name Filter>Filter-Graphik</name></h3>
<p>
Das Fenster <term>Filter-Graphik</term> zeigt Entwicklungen nach Datum
oder Elo-Zahl fr die aktuellen Filterpartien im Vergleich zur gesamten
Datenbank. Das ist beispielsweise im <a Tree>Zugbaum</a>-Fenster eine
ntzliche Hilfe um zu zeigen, wie sich die Popularitt der aktuellen
Erffnungsposition in den letzten Jahren oder Jahrzehnten gendert hat
oder ob sie bei hochrangigen Spielern, etwa bei Gromeistern, besonders
beliebt ist. Jeder Punkt in der Graphik reprsentiert fr ein bestimmtes
Datum oder einen bestimmten Elo-Bereich die Anzahl der Partien im Filter
pro 1000 Partien der gesamten Datenbank.
</p>
<p>
Wenn die Filter-Graphik nach Elo-Zahl ausgegeben wird, verwendet Scid
fr jede Partie die durchschnittliche (mittlere) Wertung. Geschtzte
Elo-Zahlen (wie z.B. aus der Schreibkorrektur-Datei) werden nicht verwendet.
Falls in einer Partie nur einer der beiden Spieler eine Elo-Zahl hat,
wird angenommen, da der Gegner die gleiche Elo-Zahl besitzt bis zu
einer Hchstgrenze von 2200. Wenn also beispielsweise ein Spieler eine
Elo-Zahl von 2500 hat und sein Gegner keine Elo-Zahl, ist die mittlere
Wertungszahl (2500+2200)/2 = 2350.
</p>
</ENGLISH>

<h3><name Rating>ELO-Zahl-Verlauf</name></h3>
<p>
Das Fenster <term>ELO-Zahl-Verlauf</term> zeigt die Entwicklung der
Elo-Zahl(en) eines Spieler oder beider Spieler der aktuellen Partie.
Sie knnen den Graphen fr einen einzelnen Spieler mit dem Schalter
<term>ELO-Zahl-Verlauf</term> im Fenster <a PInfo>Spielerinformation</a>
erzeugen oder fr beide Spieler der aktuellen Partie, indem Sie
<term>ELO-Zahl-Verlauf</term> im <menu>Werkzeuge</menu>-Men auswhlen.
</p>

<h3><name Score>Partie-Bewertungsgraph</name></h3>
<p>
Das Fenster <term>Partie-Bewertungsgraph</term> zeigt die numerische
Bewertung (Stand) der aktuellen Partie, wie sie in den Kommentaren
gespeichert ist, als Graphen.
Sie knnen mit der linken Maustaste irgendwo auf den Graphen klicken,
um zu der korrespondierenden Partiestellung zu gelangen.
</p>
<p>
Zwei Typen von Bewertungs-Kommentaren werden erkannt: die von Scids
<a Analysis>Analyse</a>-Fenster erstellten (welche das Format
<ul>
<li><b>1.e4 {"+0.25 ...."}</b></li>
</ul>
haben und immer aus der Sicht von Wei bewerten) und die vom
Crafty-Kommando "Kommentieren" erstellten (die das Format
<ul>
<li><b>1.e4 ({9:+0.25} ....)</b></li>
</ul>
haben und ebenfalls aus der Perspektive von Wei bewerten).
</p>

<h3><name Tree>Zugbaum-Graphik</name></h3>
<p>
Das Fenster <term>Zugbaum-Graphik</term> ist aus dem Zugbaum-Fenster
zu erreichen. Es zeigt die Erfolgsrate der hufigsten Zge in der
aktuellen Position. Weitere Informationen finden Sie auf der
<a Tree Graph>Zugbaum</a>-Hilfeseite.
</p>

<p><footer>(Aktualisiert: Scid 3.3, April 2002)</footer></p>
}


####################
### Tablebases help:

set helpTitle(D,TB) "Endspieltabellen"
set helpText(D,TB) {<h1>Endspieltabellen</h1>

<p>
Eine <term>Endspieltabelle</term> ist eine Datei, die die vollstndige
Ergebnisinformation ber alle Positionen einer bestimmten
Materialkonstellation enthlt, wie z.B. Knig und Turm gegen Knig und
Bauer. Es gibt Endspieltabellen fr alle Materialkonstellation mit bis
zu 5 Steinen (inkl. Knige), und einige einfache 6-Steine-Tabellen
sind ebenfalls verfgbar.
</p>
<p>
Scid kann Endspieltabellen im Nalimov-Format verwenden, die von vielen
modernen Schachprogrammen genutzt werden. Sie haben oftmals die
Dateiendung <b>.nbw.emd</b>  oder <b>.nbb.emd</b>.
</p>

<h3>Endspieltabellen in Scid verwenden</h3>
<p>
Um die Endspieltabellen-Dateien in Scid zu verwenden, bestimmen Sie
einfach ihre Verzeichnisse mit <b>Endspieltabellen-Verzeichnis...</b>
im <menu>Optionen</menu>-Men. Sie knnen bis zu 4 Verzeichnisse
angeben, wo Ihre Endspieltabellen-Dateien gespeichert sind. Mit dem
Schalter <b>...</b> rechts nebem dem Datei-Eingabefeld knnen Sie
eine Datei suchen, deren Verzeichnis verwendet werden soll.
</p>
<p>
Wenn eine in der Endspieltabelle gefundene Stellung erreicht wurde, zeigt
der Informationsbereich (unterhalb des Schachbretts)
Endspieltabellen-Informationen an. Sie knnen den Umfang der angezeigten
Information konfigurieren, indem Sie mit der rechten Maustaste diesen
Bereich anklicken oder im <menu>Optionen</menu>-Men den Menpunkt
<b>Partie-Information</b> whlen. Die Option "Ergebnis und bester Zug"
liefert die ntzlichste Information, ist aber oftmals sehr viel
langsamer als die Option "nur Ergebnis".
</p>

<h3>Das Endspieltabellen-Fenster</h3>
<p>
Sie knnen sogar noch mehr Endspieltabellen-Informationen zur aktuellen
Position erhalten, indem Sie das <term>Endspieltabellen-Fenster</term>
ffnen (<menu>Fenster</menu>-Men, Tastenkombination Strg+Umschalt+[=]).
Dieses Fenster zeigt das Ergebnis jedes zulssigen Zuges in der aktuellen
Stellung bei perfektem Spiel.
</p>
<ENGLISH>
<p>
Das Fenster enthlt zwei Bereiche. Der bersichtsbereich (links) zeigt
die Endspieltabellen, die Scid auf Ihrem Rechner gefunden hat, mit einer
Inhaltsangabe jeder Tabelle. Der Ergebnisbereich (rechts) zeigt die
optimalen Ergebnisse aller Zge in der aktuellen, im Haupfenster
dargestellten Position.
</p>

<h4>Der bersichtsbereich</h4>
<p>
Im oberen Teil des bersichtsbereichs knnen Sie eine bestimmte
Endspieltabelle auswhlen. Die verfgbaren Tabellen werden blau
angezeigt, die brigen grau, aber Sie knnen jede Tabelle auswhlen.
Der untere Teil des bersichtsbereichs zeigt eine Inhaltsangabe
der Informationen der ausgewhlten Endspieltabelle. (Noch haben nicht
alle Endspieltabellen einen entsprechenden Datensatz in Scid.)
</p>
<p>
Diese Inhaltsangabe enthlt die Hufigkeit (wie viele Partien von
einer Million haben eine Stellung mit diesem Material erreicht,
errechnet anhand einer Datenbank mit ber 600.000 Meisterpartien),
das spteste Matt einer Seite sowie Anzahl wechselseitiger ("umgekehrter")
Zugzwangpositionen. Eine wechselseitige Zugzwangposition liegt dann vor,
wenn Wei am Zug zum Remis fhrt und Schwarz am Zug verliert, wenn
Wei am Zug verliert und Schwarz am Zug Remis ergibt oder wenn derjenige
am Zug verliert.
</p>
<p>
Bei einigen Tabellen mit wechselseitigem Zugzwang enthlt die bersicht
eine Liste aller Zugzwangpositionen oder eine Auswahl davon. Eine
vollstndige Liste fr jede Endspieltabelle ist nicht machbar, da einige
Tabellen tausende von Zugzwangstellungen enthalten.
</p>
<p>
Mit dem Schalter <b>Random</b> knnen Sie eine zufllige Position aus
der ausgewhlten Endspieltabelle aufbauen.
</p>

<h4>Der Ergebnisbereich</h4>
<p>
Der Ergebnisbereich wird immer dann aktualisiert, wenn sich die
Brettstellung im Hauptfenster ndert. Die erste Zeile zeigt an, wie viele
Zge gewinnen (+), zum Remis fhren (=), verlieren (-) oder ein nicht
bekanntes Ergebnis (? )haben. Der brige Teil liefert Ihnen eine
detailliertere Ergebnisliste, mit der Reihenfolge krzeste bis lngste
Matts, danach Remis, dann lngste bis krzeste Verluste. Lnge jeweils
bis zum Matt.
</p>
</ENGLISH>

<h3>Endspieltabellen-Quellen</h3>
<p>
Zur Hilfe beim Auffinden von Endspieltabellen-Dateien im Internet
siehe die entsprechenden <a Author Related>Links</a>.
</p>

<p><footer>(Aktualisiert: Scid 3.3, April 2002)</footer></p>
}


###################
### Bookmarks help:

set helpTitle(D,Bookmarks) "Lesezeichen"
set helpText(D,Bookmarks) {<h1>Lesezeichen</h1>
<p>
Scid erlaubt Ihnen, wichtige Partien fr einen leichten spteren Zugriff
mit <term>Lesezeichen</term> zu markieren. Das Lesezeichen-Men ist aus
dem <menu>Datei</menu>-Men, der Werkzeugleiste oder mit der
Tastenkombination <B>Strg+B</b> zu erreichen.
</p>
<p>
Wenn Sie eine markierte Partie aus dem Lesezeichen-Men whlen, ffnet
Scid falls ntig die Datenbank, findet die Partie und geht zu der
Partiestellung, die mit dem Lesezeichen versehen wurde.
</p>
<p>
Nur Partien in Datenbanken im Scid-Format (keine PGN-Datei, nicht die
Ablage-Datenbank) knnen mit einem Lesezeichen markiert werden.
</p>
<p>
Wenn die Datenbank einer markierten Partie sortiert oder komprimiert
wurde, sind die Lesezeichendaten mglicherweise veraltet. Falls das
passiert, durchsucht Scid die Datenbank nach der passendsten Partie
(vergleicht Spielernamen, Ort etc.), wenn das Lesezeichen ausgewhlt
wird, die markierte Datei sollte also immer noch geladen werden. Wenn
sich allerdings Daten der markierten Partie ndern, ist es mglich,
da eine andere Partie besser auf die Lesezeichendaten pat und statt
dessen geladen wird. Es ist also eine gute Idee, eine Partie erneut zu
markieren, wenn Sie ihre Spieler-, Orts-, Ergebnis-, Runden- oder
Jahresdaten bearbeiten.
</p>

<h3>Lesezeichen bearbeiten</h3>
<p>
Mit dem Lesezeichen-Editor knnen Sie den fr jede markierte Partie
ausgegebenen Mentext ndern und Verzeichnisse erstellen, um die
Lesezeichen zu kategorisieren.
</p>

<h3>Hinweise</h3>
<p>
Sie knnen Lesezeichen zum schnellen Zugriff auf Datenbanken verwenden,
die Sie oft benutzen, indem Sie eine Partie jeder Datenbank markieren.
Eine weitere gute Verwendungsmglichkeit fr Lesezeichen ist es,
wichtige Partien hinzuzufgen, die Sie beim Studieren einer bestimmten
Schacherffnung finden.
</p>
<p>
Das Lesezeichen-Men enthlt einen Eintrag zur Kontrolle der
Verzeichnisdarstellung: sie knnen als Untermens angezeigt werden
(ntzlich bei sehr vielen Lesezeichen) oder als einzelne Liste.
</p>

<p><footer>(Aktualisiert: Scid 3.0, November 2001)</footer></p>
}


##############################
### Command-line options help:

set helpTitle(D,Cmdline) "Kommandozeilen-Optionen"
set helpText(D,Cmdline) {<h1>Kommandozeilen-Optionen</h1>
<p>
Wenn Sie Scid von der Shell oder Konsole starten, knnen Sie
Kommandozeilen-Optionen spezifizieren. Datenbanken im Scid-Format (mit
oder ohne Dateiendung wie z.B. ".si3") und PGN-Dateien, die geffnet
werden sollen, knnen angegeben werden. Beispiel:
<ul>
<li> <b> scid datenbank partien.pgn</b></li>
</ul>
startet Scid und und ffnet die Scid-Datenbank "datenbank" und die
PGN-Datei "partien.pgn".
</p>
<p>
Auerdem gibt es optionale Argumente, die kontrollieren, welche Dateien
Scid suchen und beim Start verwenden soll. Sie knnen die Benutzung
von <a TB>Endspieltabellen</a>  mit der Option <b>-xtb</b> (oder
<b>-xt</b>) ausschalten, das Laden der Datei zur
<a ECO>ECO-Erffnungsklassifikation</a> mit <b>-xeco</b> oder
<b>-xe</b> verhindern und mit <b>-xspell</b> oder <b>-xs</b> vermeiden,
da die Datei zur <a Maintenance Spellcheck>Schreibkorrektur</a>
geladen wird. Die Option <b>-fast</b> oder <b>-f</b> bewirkt das in
einem, d.h. <b>scid -f</b> ist quivalent zu
<b>scid -xeco -xspell -xtb</b>.
</p>

<p><footer>(Aktualisiert: Scid 3.1, November 2001)</footer></p>
}


####################
### Compaction help:

set helpTitle(D,Compact) "Datenbank komprimieren"
set helpText(D,Compact) {<h1>Datenbank komprimieren</h1>
<p>
Datenbank-<term>Komprimierung</term> ist ein besonderer Teil der
<a Maintenance>Wartung</a>, der die Datenbank so klein und effizient
wie mglich hlt.
Eine Datenbank komprimieren heit, jeden ungenutzten Bereich in ihren
Dateien zu lschen.
Es gibt zwei Arten: Namens- und Partiendatenbank-Komprimierung.
</p>

<h3>Namendatenbank-Komprimierung</h3>
<p>
Nach einer gewissen Zeit werden Sie evtl. feststellen, da die Datenbank
eine Reihe von Spieler-, Turnier- oder Rundennamen enthlt, die in keiner
Partie mehr verwendet werden. Das wird regelmig nach Namenskorrekturen
der Fall sein. Die unbenutzten Namen verschwenden Speicherplatz in der
Namendatei und knnen die Suche nach Namen verlangsamen.
Namendatenbank-Komprimierung lscht alle Namen, die nicht in irgendeiner
Partie verwendet werden.
</p>

<h3>Partiendatenbank-Komprimierung</h3>
<p>
Immer, wenn eine Partie ersetzt oder gelscht wird, verbleibt
ungenutzter Platz in der Partiendatei (die grte der drei Dateien
einer Scid-Datenbank). Partiendatenbank-Komprimierung lscht jeden
ungenutzten Speicher, keine gelschte Datei bleibt in der Datenbank.
Beachten Sie, da diese Operation unumkehrbar ist: nach der
Komprimierung sind die gelschten Dateien fr immer verschwunden!
</p>
<p>
Partiendatenbank-Komprimierung ist auch empfehlenswert nach dem
<a Sorting>Sortieren</a> einer Datenbank, um die Reihenfolge
innerhalb der Partiendatei mit der sortierten Indexdatei synchron
zu halten.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################################
### Database maintenance tools help:

set helpTitle(D,Maintenance) "Datenbank-Wartung"
set helpText(D,Maintenance) {<h1>Datenbank-Wartung</h1>
<p>
Scid stellt einige Funktionen zur Datenbank-Wartung zur Verfgung,
die aus dem <a Menus File>Datei</a>-Men zu erreichen sind. Die
Datenbank-<a Compact>Komprimierung</a> und -<a Sorting>Sortierung</a>
werden in separaten Hilfeseiten erklrt.
</p>

<h3>Das Wartungsfenster</h3>
<p>
Die meisten Datenbank-Wartungsarbeiten in Scid knnen aus dem
Wartungsfenster erledigt werden, welches man mit dem Men
<menu>Datei: Wartungsfenster</menu> oder <menu>Fenster</menu>
oder der Tastenkombination <b>Strg+M</b> ffnen kann.
</p>
<p>
Sie knnen in diesem Fenster <a Flags>Partie-Markierungen</a>
bearbeiten, Schreibkorrekturen durchfhren, eine Datenbank
<a Compact>komprimieren</a> oder <a Sorting>sortieren</a>.
Alle Operationen, die fr die aktuelle Datenbank nicht zur Verfgung
stehen (z.B., weil sie schreibgeschtzt oder eine PGN-Datei ist),
werden durch graue Schrift angezeigt.
</p>

<h3><name Twins>Dubletten lschen</name></h3>
<p>
Das Men <menu>Datei: Wartung</menu> hat ein Kommando <menu>Dubletten
lschen...</menu>, um Kopien von Partien (Dubletten) in der Datenbank
zu entdecken. Dieses Kommando findet alle Paare von doppelten Partien
und markiert die krzere Partie als gelscht, whrend die lngere Partie
erhalten bleibt. Zwei Partien werden als gleich angesehen, wenn ihre
Spieler (und alle anderen optionalen Partieeintrge) exakt bereinstimmen.
</p>
<p>
Wenn Sie die Option "gleiche Zge" angeben, mssen zwei Partien die
gleichen Partiezge bis zur Lnge der krzeren Partie haben (oder bis
zum 60. Zug, je nachdem, was zuerst eintritt), um Dubletten zu sein.
</p>
<p>
Wenn Sie Dubletten gelscht haben, ist es eine gute Idee zu berprfen,
ob jede gelschte Partie tatschlich Kopie einer anderen Partie ist.
Das knnen Sie ganz einfach machen, wenn Sie die Option "<b>Filter auf
Dubletten setzen</b>" im Dialogfenster "Dubletten lschen" gewhlt
haben. Der Filter wird dann alle gelschten Partien enthalten. Sie knnen
sie mit dem <term>Dublettenprfer</term> (erreichbar aus dem
Wartungsmen oder mit der Tastenkombination <b>Strg+Umsch+T</b>)
betrachten (blttern mit den Tasten <b>p</b> und <b>n</b>), um zu
verifizieren, da jede Partie deshalb gelscht wurde, weil sie
tatschlich die Dublette einer anderen Partie ist.
</p>

<h3><name Editing>Spieler, Turniere, Orte und Runden editieren</name></h3>
<p>
Sie haben vielleicht falsch geschriebene Namen in Iher Datenbank und
wollen sie korrigieren. Sie knnen das in Scid mit dem
<term>Namenseditor</term> (Tastenkombination: <b>Strg+Umsch+N</b>), den
Sie aus dem Untermen <menu>Datei: Wartung</menu> erreichen.
</p>
<p>
Jeder eindeutige Name ist nur einmal in der Namendatei gespeichert,
mit einer Namensnderung werden daher tatschlich alle Vorkommen
gendert.
</p>

<h3><name Spellcheck>Schreibkorrektur</name></h3>
<p>
Zu Scid gehrt eine <term>Schreibkorrektur</term>-Datei namens
<b>spelling.ssp</b>, um Namen von Spielern, Turnieren, Orten und Runden
zu korrigieren.
Scid versucht die Datei beim Programmstart zu laden; wenn Scid sie
nicht laden kann, knnen Sie sie aus dem <menu>Optionen</menu>-Men
laden.
</p>
<p>
Wenn die Korrektur-Datei erst einmal geladen ist, knnen Sie sie mit
den Schreibkorrektur-Befehlen im Men <menu>Datei: Wartung</menu>  oder
aus dem Wartungsfenster auf eine Datenbank anwenden.
</p>
<p>
Wenn Sie fr eine Datenbank eine Schreibkorrektur durchfhren, erzeugt
Scid eine Liste mit Korrekturen, die Sie editieren knnen, bevor die
Korrekturen tatschlich ausgefhrt werden. Sie knnen also jede
nicht gewollte Korrektur lschen.
</p>
<p>
Schreibkorrekturen sind insbesondere ntzlich, um eine Datenbank zu
standardisieren, damit alle Vorkommen eines bestimmten Spielers gleich
geschrieben werden.
Beispielsweise wrden mit der Standarddatei die Namen"Kramnik,V.",
"Vladimir Kramnik" und "V. Kramnik" alle zu "Kramnik, Vladimir"
berichtigt.
</p>
<p>
Die Schreibkorrektur-Datei hat einen weiteren Nutzen: wenn Sie geladen
ist, werden ihre Spielerdaten genutzt, um die Fenster
<a PInfo>Spielerinformation</a> und <a Crosstable>Kreuztabelle</a>
zu erweitern: Sie sehen dann die FIDE-Titel (<b>gm</b> = Internationaler
Gromeister, <b>im</b> = Internationaler Meister etc.) und
Lnderinformationen zu jedem Spieler, der in der Datei enthalten ist.
ber 6500 starke Spieler der Vergangenheit und Gegenwart sind in der
zu Scid gehrenden Datei <b>spelling.ssp</b> enthalten.
</p>

<h3><name Ratings>Elo-Zahlen zu den Partien hinzufgen</name></h3>
<p>
Der Schalter "Elo-Zahlen hinzufgen..." im Wartungsfenster veranlat
Scid, die aktuelle Datenbank nach Spielern, zu durchsuchen, die keine
Elo-Zahl haben, fr die die Schreibkorrektur-Datei aber eine Elo-Zahl
des jeweiligen Spielers zum Zeitpunkt der Partie enthlt. Scid ergnzt
alle diese Elo-Zahlen automatisch. Das ist sehr ntzlich fr eine
Datenbank mit Meisterpartien, die nur wenige Elo-Angaben enthlt.
</p>
<p>
Die mit Scid gelieferte Datei "spelling.ssp" enthlt die fr diese
Funktion bentigten Elo-Zahlen nicht, aber eine grere Version von
ihr namens "ratings.ssp" steht auf der  <a Author>Scid-Website</a>
zur Verfgung.
</p>

<h3><name Cleaner>Der Bereiniger</name></h3>
<p>
Der <term>Bereiniger</term> von Scid (vom Wartungsfenster zu erreichen)
ist ein Werkzeug, um eine Reihe von Wartungsarbeiten fr eine Datenbank
in einem durchzufhren. Sie knnen whlen, welche Aufgaben Sie erledigen
wollen, und Scid fhrt sie fr die Datenbank aus, ohne weitere Eingaben
des Benutzers zu bentigen. Das ist besonders bei der Wartung sehr
groer Datenbanken hilfreich.
</p>

<h3>Partien automatisch laden</h3>
<p>
Der <term>Automatische Lader</term> ldt jedesmal, wenn Sie die
Datenbank ffnen, eine Partie automatisch. Um die Partie, die geladen
wird, zu ndern, whlen Sie den Schalter "Automatisch Partie Nr.
laden..." Wenn Sie jedesmal die letzte Partie der Datenbank geffnet
haben wollen (unabhngig von der Anzahl der Partien in der Datenbank),
whlen Sie einfach eine besonders groe Zahl wie 9999999.
</p>

<p><footer>(Aktualisiert: Scid 3.1, Dezember 2001)</footer></p>
}


##############
### ECO guide:

set helpTitle(D,ECO) "ECO-Fhrer"
set helpText(D,ECO) {<h1>ECO-Erffnungsklassifikation</h1>
<p>
Scid kann Schachpartien gem der <b>ECO</b>- (Enzyklopdie der
Schacherffnungen) -Erffnungsklassifikation einordnen. Ein
Standard-ECO-Code besteht aus einem Buchstaben (A..E) gefolgt von
zwei Ziffern, so da es 500 verschiedene Standard-ECO-Codes gibt.
</p>

<h3>Scids Erweiterung des ECO-Systems</h3>
<p>
Das ECO-System ist sehr limitiert und fr moderne Partien nicht
ausreichend: einige der 500 Codes sieht man praktisch berhaupt nicht
mehr, whrend einige andere sehr hufig vorkommen. Um diese Situation
zu verbessern, erlaubt Scid eine optionale Erweiterung der
ECO-Basiscodes: jeder Code kann um einen Buchstaben (a..z) erweitert
werden, wobei eine weitere Ergnzung (noch eine Ziffer, 1..4) mglich
ist, aber noch nicht in Scids Standard-ECO-Datei benutzt wird.
Ein erweiterter Scid-ECO-Code sieht also etwa aus wie "<b>A41e</b>"
oder "<b>E99b2</b>". Viele der in modernen Meisterpartien vorkommenden
blichen ECO-Codes haben eine in Scids ECO-Datei definierte
Erweiterung.
</p>

<h3><name Browser>Die ECO-Auswertung</name></h3>
<p>
Das Fenster <term>ECO-Auswertung</term> zeigt Ihnen die Positionen,
die zur Klassifizierung jedes ECO-Codes verwendet werden, sowie die
Hufigkeit und Erfolgsrate der ECO-Codes in der der aktuellen Datenbank.
</p>
<p>
Der obere Teil zeigt die Hufigkeit jedes ECO-Codes in der aktuellen
Datenbank. Die Balken in der Graphik haben drei Bereiche: der unterste
(hellste Farbe) steht fr die Anzahl der Weisiege, der mittlere fr
die Zahl der Remis und der oberste (dunkelste) fr die Anzahl der
Schwarzsiege. Damit knnen Sie auf einen Blick die Charakteristik einer
Erffnung erkennen: z.B., ob Wei sehr erfolgreich ist oder ob Remis
hufig vorkommen.
</p>
<p>
Um zu einem tieferen ECO-Niveau zu gehen, klicken Sie mit der linken
Maustaste auf einen Balken in der Graphik (oder tippen Sie den
korrespondierenden Buchstaben (bzw. Ziffer) ein). Um auf ein hheres
Niveau zurckzugehen, klicken Sie mit der rechten Maustaste irgendwo
auf die Graphik oder drcken Sie die linke Cursortaste (oder [Entf]
oder [Rck]).
</p>
<p>
Der untere Teil zeigt die Positionen, die ein bestimmter ECO-Code
enthlt, und zwar entsprechend der von Ihnen geladenen ECO-Datei.
</p>

<h3>Die ECO-Datei laden</h3>
<p>
Die zu Scid gehrende ECO-Datei heit <b>scid.eco</b>, und Scid
versucht sie beim Programmstart zu laden.
Falls Scid sie nicht findet, mssen Sie folgendes tun, um die
ECO-Klassifikation zu ermglichen:
<ul>
<li>(a) Mit dem Menpunkt <menu>Optionen: ECO-Datei laden</menu>
        whlen Sie die Datei <b>scid.eco</b>. </li>
<li>(b) Speichern Sie die Optionen (im <menu>Optionen</menu>-Men). </li>
</ul>
Nachdem Sie das getan haben, wird die ECO-Datei jedesmal geladen, wenn
Sie Scid starten.
</p>

<h3>Das ECO-Code-System</h3>
<p>
Die Basisstruktur des ECO-Systems ist folgende:
</p>
<p>
<b><blue><run updateEcoWin A>A</run></blue></b>
    1.d4 Sf6 2...;  1.d4 ...;  1.c4;  1.Verschiedenes
<ul>
<li>  <b>A0</b>  1.<i>Verschiedenes</i>
      (<b>A02-A03</b> 1.f4: <i>Bird-Erffnung</i>,
      <b>A04-A09</b>  1.Sf3: <i>Reti, Knigsindischer Angriff</i>) </li>
<li>  <b>A1</b>  1.c4 ...: <i>Englisch</i> </li>
<li>  <b>A2</b>  1.c4 e5: <i>Englisch, Knigsbauer</i> </li>
<li>  <b>A3</b>  1.c4 c5: <i>Englisch, Symmetrisch</i> </li>
<li>  <b>A4</b>  1.d4 ...: <i>Damenbauer</i> </li>
<li>  <b>A5</b>  1.d4 Sf6 2.c4 ..: <i>Indische Verteidigung </i> </li>
<li>  <b>A6</b>  1.d4 Sf6 2.c4 c5 3.d5 e6: <i>Modernes Benoni </i> </li>
<li>  <b>A7</b>  A6 + 4.Sc3 exd5 5.cxd5 d6 6.e4 g6 7.Sf3 </li>
<li>  <b>A8</b>  1.d4 f5: <i>Hollndische Verteidigung</i> </li>
<li>  <b>A9</b>  1.d4 f5 2.c4 e6: <i>Hollndische Verteidigung</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin B>B</run></blue></b>   1.e4 c5;  1.e4 c6;  1.e4 d6;  1.e4 <i>Verschidenes</i>
<ul>
<li>  <b>B0</b>  1.e4 ...
      (<b>B02-B05</b>  1.e4 Sf6: <i>Aljechin-Verteidigung</i>;
      <b>B07-B09</b>  1.e4 d6: <i>Pirc</i>) </li>
<li>  <b>B1</b>  1.e4 c6: <i>Caro-Kann</i> </li>
<li>  <b>B2</b>  1.e4 c5: <i>Sizilianische Verteidigung</i> </li>
<li>  <b>B3</b>  1.e4 c5 2.Sf3 Nc6: <i>Sizilianisch</i> </li>
<li>  <b>B4</b>  1.e4 c5 2.Sf3 e6: <i>Sizilianisch</i> </li>
<li>  <b>B5</b>  1.e4 c5 2.Sf3 d6: <i>Sizilianisch</i> </li>
<li>  <b>B6</b>  B5 + 3.d4 cxd4 4.Sxd4 Sf6 5.Sc3 Sc6 </li>
<li>  <b>B7</b>  B5 + 4.Sxd4 Sf6 5.Sc3 g6: <i>Sizilianisch, Drachen</i> </li>
<li>  <b>B8</b>  B5 + 4.Sxd4 Sf6 5.Sc3 e6: <i>Sizilianisch, Scheveninger</i> </li>
<li>  <b>B9</b>  B5 + 4.Sxd4 Sf6 5.Sc3 a6: <i>Sizilianisch, Najdorf</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin C>C</run></blue></b>   1.e4 e5;  1.e4 e6
<ul>
<li>  <b>C0</b>  1.e4 e6: <i>Franzsische Verteidigung</i> </li>
<li>  <b>C1</b>  1.e4 e6 2.d4 d5 3.Sc3: <i>Franzsisch, Winawer/Klassisch</i> </li>
<li>  <b>C2</b>  1.e4 e5: <i>Offene Partie</i> </li>
<li>  <b>C3</b>  1.e4 e5 2.f4: <i>Knigsgambit</i> </li>
<li>  <b>C4</b>  1.e4 e5 2.Sf3: <i>Offene Partie</i> </li>
<li>  <b>C5</b>  1.e4 e5 2.Sf3 Sc6 3.Lc4: <i>Italienisch; Zweispringerspiel</i> </li>
<li>  <b>C6</b>  1.e4 e5 2.Sf3 Sc6 3.Lb5: <i>Spanische Partie</i> </li>
<li>  <b>C7</b>  1.e4 e5 2.Sf3 Sc6 3.Lb5 a6 4.La4: <i>Spanisch</i> </li>
<li>  <b>C8</b>  C7 + 4...Sf6 5.0-0: <i>Spanisch, Geschlossen und Offen</i>
      (<b>C80-C83</b>  5.0-0 Sxe4: <i>Spanisch, Offenes System</i>;
      <b>C84-C89</b>  5.0-0 Le7: <i>Spanisch, Geschlossenes System</i>) </li>
<li>  <b>C9</b>  C8 + 5...Le7 6.Te1 b5 7.Lb3 d6: <i>Spanisch, Geschlossen</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin D>D</run></blue></b>   1.d4 d5; 1.d4 Sf6 2.c4 g6 with 3...d5
<ul>
<li>  <b>D0</b>   1.d4 d5: <i>Damenbauernspiele</i> </li>
<li>  <b>D1</b>   1.d4 d5 2.c4 c6: <i>Slawisch</i> </li>
<li>  <b>D2</b>  1.d4 d5 2.c4 dxc4: <i>Angenommenes Damengambit</i> </li>
<li>  <b>D3</b>  1.d4 d5 2.c4 e6: <i>Abgelehntes Damengambit</i> </li>
<li>  <b>D4</b>  D3 + 3.Sc3 Sf6 4.Sf3 c5/c6: <i>Semi-Tarrasch; Semi-Slawisch</i> </li>
<li>  <b>D5</b>  D3 + 3.Sc3 Sf6 4.Lg5: <i>Klassisches Damengambit</i> </li>
<li>  <b>D6</b>  D5 + 4...Le7 5.e3 0-0 6.Sf3 Sbd7: <i>Orthodoxes Damengambit</i> </li>
<li>  <b>D7</b>  1.d4 Sf6 2.c4 g6 with 3...d5: <i>Grnfeld-Indisch</i> </li>
<li>  <b>D8</b>  1.d4 Sf6 2.c4 g6 3.Sc3 d5: <i>Grnfeld-Indisch</i> </li>
<li>  <b>D9</b>  1.d4 Sf6 2.c4 g6 3.Sc3 d5 4.Sf3: <i>Grnfeld-Indisch</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin E>E</run></blue></b>   1.d4 Sf6 2.c4 e6; 1.d4 Sf6 2.c4 g6 </li>
<ul>
<li>  <b>E0</b>  1.d4 Sf6 2.c4 e6: <i>Katalanisch etc.</i> </li>
<li>  <b>E1</b>  1.d4 Sf6 2.c4 e6 3.Sf3 (b6): <i>Damenindisch etc.</i> </li>
<li>  <b>E2</b>  1.d4 Sf6 2.c4 e6 3.Sc3 (Lb4): <i>Nimzo-Indisch etc.</i> </li>
<li>  <b>E3</b>  E2 + 4.Lg5 or 4.Dc2: <i>Nimzo-Indisch</i> </li>
<li>  <b>E4</b>  E2 + 4.e3: <i>Nimzo-Indisch, Rubinstein</i> </li>
<li>  <b>E5</b>  E4 + 4...0-0 5.Sf3: <i>Nimzo-Indisch, Hauptvariante</i> </li>
<li>  <b>E6</b>  1.d4 Sf6 2.c4 g6: <i>Knigsindisch</i> </li>
<li>  <b>E7</b>  1.d4 Sf6 2.c4 g6 3.Sc3 Lg7 4.e4: <i>Knigsindisch</i> </li>
<li>  <b>E8</b>  E7 + 4...d6 5.f3: <i>Knigsindisch, Smisch</i> </li>
<li>  <b>E9</b>  E7 + 4...d6 5.Sf3: <i>Knigsindisch, Hauptvarianten</i> </li>
</ul>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################
### EPD files help:

set helpTitle(D,EPD) "EPD-Dateien"
set helpText(D,EPD) {<h1>EPD-Dateien</h1>
<p>
Eine EPD-Datei (extended position description = erweiterte
Stellungsbeschreibung) ist eine Sammlung von Positionen, wobei jeder
Position ein Text zugeordnet ist. Wie <a PGN>PGN</a> ist EPD ein
verbreiteter Standard fr Schachinformationen.
</p>
<p>
Eine EPD-Datei hat eine Reihe definierter "<term>Opcodes</term>"(-Felder),
die in der Datei durch Semikolons (<b>;</b>) getrennt gespeichert sind,
in einem EPD-Fenster von Scid aber in separaten Zeilen dargestellt
werden, um das Bearbeiten zu erleichtern. Ein Semikolon innerhalb eines
EPD-Feldes wird von Scid als "<b>\s</b>" gespeichert, um es von den
Feldende-Markierungen zu unterscheiden.
Jede Position und ihre zugehriger Opcode wird in der EPD-Datei in
einer einzelnen Zeile gespeichert.
</p>
<p>
Standard-EPD-Opcodes sind u.a.:
<ul>
<li> <b>acd</b> Analyse-Zhler: Suchtiefe.</li>
<li> <b>acn</b> Analyse-Zhler: Anzahl der durchsuchten Knoten.</li>
<li> <b>acs</b> Analyse-Zhler: Suchzeit in Sekunden.</li>
<li> <b>bm</b> Beste Zge: aus irgendeinem Grund als beste
eingestufte Zge.</li>
<li> <b>ce</b> Stellungsbeurteilung: Beurteilung in Hundertstel Bauern
[ce = "centipawn evaluation"] aus Sicht der <b>am Zug</b>
befindlichen Seite -- beachten Sie, da sich dies vom Analyse-Fenster
unterscheidet, welches die Einschtzung in Bauerneinheiten aus der
Sicht von Wei zeigt. </li>
<li> <b>cX</b> Kommentar (wobei <b>X</b> eine Ziffer ist, 0-9).</li>
<li> <b>eco</b> Erffnungscode des <a ECO>ECO</a>-Systems.</li>
<li> <b>id</b> Eindeutige Identifizierung dieser Stellung.</li>
<li> <b>nic</b> Erffnungscode des <i>New-In-Chess</i>-Systems.</li>
<li> <b>pm</b> Vorhergesagter Zug: der erste Zug der PV.</li>
<li> <b>pv</b> Vorhergesagte Variante: die beste Variante.</li>
</ul>
</p>
<p>
EPD-Dateien haben einen vielfachen Nutzen: Scid verwendet EPD-Dateien,
um Partien nach dem System der <a ECO>Enzyklopdie der
Schacherffnungen</a> (ECO) zu klassifizieren, und Sie knnen eine
EPD-Datei fr Ihr Erffnungsrepertoire erstellen, mit Kommentaren
zu Stellungen, die Sie regelmig auf dem Brett haben.
</p>
<p>
Mit den Optionen <menu>Neu</menu> und <menu>ffnen</menu>
im <menu>Datei</menu>-Men knnen Sie eine neue EPD-Datei erstellen
bzw. eine bestehende ffnen. Maximal vier EPD-Dateien knnen
gleichzeitig geffnet sein.
</p>

<h3>EPD-Fenster</h3>
<p>
Fr jede geffnete EPD-Datei sehen Sie ein Fenster, welches den Text zur
aktuellen Stellung zeigt. Sie mssen nicht den Schalter "Speichern"
bettigen, um nderungen des Textes zu sichern; der Text wird jedesmal
gespeichert, wenn Sie zu einer anderen Partiestellung gehen.
</p>

<h3>In EPD-Dateien navigieren</h3>
<p>
Um sich durch die Stellungen in einer EPD-Datei zu bewegen, verwenden
Sie die Kommandos <menu>Nchste Position</menu> und <menu>Vorherige
Position</menu> im <menu>Werkzeuge</menu>-Men des EPD-Fensters oder
die Tastenkombinationen <b>Strg+Ab</b> and <b>Strg+Auf</b>.
Diese Befehle gehen zur nchsten/vorherigen Position in der Datei,
wobei sie die aktuelle Partie lschen und die Ausgangsposition
herstellen.
</p>

<h3>EPD-Felder entfernen</h3>
<p>
EPD-Dateien, die Sie im Internet finden, enthalten mglicherweise
Felder, die Sie nicht interessieren und die eine Menge Speicherplatz
in der Datei verschwenden.
Beispielsweise knnte eine EPD-Datei mit Computerauswertungen die Felder
ce, acd, acn, pm, pv und id enthalten, Sie brauchen aber vielleicht
nur das ce- und pv-Feld.
</p>
<p>
Sie knnen einen EPD-Opcode mit dem Menpunkt <menu>EPD-Feld
entfernen</menu> im <menu>Werkzeuge</menu>-Men des EPD-Fensters
aus allen Stellungen in der EPD-Datei entfernen.
</p>

<h3>Die Statusanzeige des EPD-Fensters</h3>
<p>
Die Statuszeile jedes EPD-Fensters zeigt:
<ul>
<li>- den Dateistatus (<b>--</b> heit unverndert, <b>XX</b> heit
      verndert und <b>%%</b> heit schreibgeschtzt); </li>
<li>- den Dateinamen; </li>
<li>- die Anzahl der Positionen in der Datei; </li>
<li>- zulssige Zge in der aktuellen Stellung, die eine andere
Stellung in der EPD-Datei erreichen .</li>
</ul>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


###################
### Exporting help:

set helpTitle(D,Export) "Partien exportieren"
set helpText(D,Export) {<h1>Partien exportieren</h1>
<p>
Sie knnen die Kommandos im <menu>Werkzeuge</menu>-Men benutzen, um die
aktuelle Partie oder alle Partien im aktuellen Filter in eine Textdatei
zu exportieren.
</p>
<p>
Drei Textdatei-Formate stehen zur Verfgung: <a PGN>PGN</a> (portable
game notation), HTML (fr Webseiten) und LaTeX (ein populres
Textsatzsystem).
</p>
<p>
Beim Exportieren knnen Sie whlen, eine neue Datei zu erstellen
oder die Partien einer existierenden Partiendatei hinzuzufgen.
</p>

<h3>Diagramme</h3>
<p>
Wenn Sie im HTML- oder LaTeX-Format exportieren, fgt Scid automatisch
berall dort ein Diagramm ein, wo ein Diagramm-<a NAGs>NAG</a> ("D")
oder ein mit dem Buchstaben "#" beginnender <a Comment>Kommentar</a>
in der Partie vorkommt.
</p>

<h3>HTML-Export</h3>
<p>
Scid kann Partien in eine HTML-Datei exportieren. Um Diagramme einzufgen,
mssen die Diagrammbilder (im Verzeichnis "<b>bitmaps/</b>" mitgeliefert)
in einem Unterverzeichnis "<b>bitmaps/</b>" unterhalb des Verzeichnisses
sein, wo sich die HTML-Datei befindet.
</p>

<h3>LaTeX-Export</h3>
<p>
Scid kann Partien in eine LaTeX-Datei exportieren. Partien werden in
zwei Spalten pro Seite gedruckt und Zge in figuriner algebraischer
Notation.
</p>
<p>
Fr weitere Informationen siehe die Hilfeseite <a LaTeX>Scid und LaTeX</a>.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################
### Flags help:

set helpTitle(D,Flags) "Partie-Markierungen"
set helpText(D,Flags) {<h1>Partie-Markierungen</h1>

<p>
Eine <term>Markierung</term> ("flag") ist ein Kennzeichen irgendeiner
Schach-Charakteristik, die fr jede Partie der Datenbank ein- oder
ausgeschaltet werden kann. Es gibt 13 vom Benutzer einstellbare
Markierungen, die Sie direkt fr jede Partie setzen knnen. Von diesen
hat nur die Lsch-Markierung eine besondere Bedeutung: Partien, bei
denen die Lsch-Markierung eingeschaltet ist, sind zur Lschung
vorgemerkt und werden entfernt, wenn die Datenbank
<a Compact>komprimiert</a> wird.
</p>
<p>
Die anderen 12 vom Benutzer einstellbaren Markierungen und ihre
Symbole sind:
</p>

<ul>
<li>Erffnung Wei (W)</li>
<li>Erffnung Schwarz (B)</li>
<li>Mittelspiel (M)</li>
<li>Endspiel (E)</li>
<li>Neuerung (N)</li>
<li>Bauernstruktur (P)</li>
<li>Taktik (T)</li>
<li>Spiel auf dem Damenflgel (Q)</li>
<li>Spiel auf dem Kngsflgel (K)</li>
<li>Brilliant (!)</li>
<li>Patzer (?)</li>
<li>Benutzer-definiert (U)</li>
</ul>

<p>
Eine Markierung kann fr die aktuelle Partie, fr alle Partien im
Filter oder fr alle Partien der Datenbank im
<a Maintenance>Wartungs</a>-Fenster gesetzt werden.
</p>
<p>
Sie knnen die <a Searches Header>Suche nach Partiedaten</a> benutzen,
um alle Datenbankpartien zu finden, die eine bestimmte Markierung ein-
oder ausgeschaltet haben, oder die Markierungen als Teil einer
komplexeren Suche verwenden.
</p>
<p>
Da alle vom Benutzer einstellbaren Markierungen keine Bedeutung fr
Scid haben (mit Ausnahme der Lsch-Markierung), knnen Sie sie fr
Ihre eigenen Bedrfnisse  verwenden. Zum Beispiel knnten Sie die
Markierung "Spiel auf dem Kngsflgel" (K) fr Bauernstrme auf den
Knig verwenden, fr Figurenangriffe auf den Knig oder auch fr
Endspiele mit allen Bauern auf dem Knigsflgel.
</p>

<p><footer>(Aktualisiert: Scid 3.0, November 2001)</footer></p>
}


###############
### LaTeX help:

set helpTitle(D,LaTeX) "Scid und LaTeX"
set helpText(D,LaTeX) {<h1>Scid und LaTeX</h1>
<p>
Scid kann Partien und Erffnungsberichte im LaTeX-Format in Dateien
sichern. LaTeX ist eine Erweiterung von TeX, einem populren Textsatzsystem.
</p>
<p>
Um die von Scid erzeugten LaTeX-Dateien darzustellen, mssen Sie
(natrlich) LaTeX haben und das Schachzeichensatz-Paket "chess12"
installiert haben. Dieses Paket ist normalerweise nicht Teil der
LaTeX-Standardinstallation, d.h selbst wenn Sie LaTeX haben, haben
Sie vielleicht nicht den Schachzeichensatz.
</p>
<p>
Informationen zum Herunterladen und Installieren des
LaTeX-Schachzeichensatzes finden Sie auf der Seite
<url http://scid.sourceforge.net/latex.html>Using LaTeX with Scid</url>
der <url http://scid.sourceforge.net/>Scid-Website</url>.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


###########################
### Options and Fonts help:

set helpTitle(D,Options) "Options"
set helpText(D,Options) {<h1>Optionen und Prferenzen</h1>
<p>
Viele Optionen und Prferenzen in Scid (z.B. die Brettgre, Farben,
Zeichenstze und Standardwerte) kann man im <menu>Optionen</menu>-Men
verndern. Alle diese (und mehr, wie etwa das letzte Verzeichnis, aus
dem Sie eine Datenbank gelesen haben, und die Gre einiger Fenster)
werden in einer Optionen-Datei gesichert, wenn Sie im Optionen-Men
<b>Optionen speichern</b> whlen.
Jedesmal, wenn Sie Scid starten, wird die Optionen-Datei geladen.
</p>
<p>
Wenn Sie mit Windows arbeiten, ist die Optionen-Datei <b>scid.opt</b>
in demselben Verzeichnis wie Scids Programmdatei. Fr Benutzer von
Unix-Betriebssystemen (wie Solaris oder Linux) ist die Datei
<b>~/.scid/scidrc</b>.
</p>

<h3><name Fonts>Zeichenstze einstellen</name></h3>
<p>
Scid hat drei Basis-Zeichenstze, die in den meisten Fenstern verwendet
werden, und Sie knnen alle drei individuell anpassen. Sie heien
<b>normal</b>, <b>klein</b> und <b>fest</b>.
</p>
<p>
Der feste Zeichensatz sollte ein Zeichensatz mit fester Breite
(nicht-proportional) sein. Er wird fr den <a Tree>Zugbaum</a> und die
<a Crosstable>Kreuztabelle</a> verwendet.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################
### Pgnscid help:

set helpTitle(D,Pgnscid) "Pgnscid"
set helpText(D,Pgnscid) {<h1>Pgnscid</h1>
<p>
<term>Pgnscid</term> ist ein separates Program, das Sie zur
Konvertierung von PGN-Dateien ("portable game notation") nach
Scid-Datenbanken bentigen.
</p>
<p>
Um eine Datei namens <i>partien.pgn</i> umzuwandeln, tippen Sie
einfach
<ul>
<li> <b>pgnscid partien.pgn</b> </li>
</ul>
ein, und die Scid-Datenbank (bestehend aus den Dateien
<i>partien.si3</i>, <i>partien.sg3</i> und <i>partien.sn3</i>) wird
erstellt.
Fehlermeldungen oder Warnungen werden in die Datei <i>partien.err</i>
geschrieben.
</p>
<p>
Wenn Sie wollen, da die Datenbank in einem anderen Verzeichnis oder
mit einem anderen Namen erstellt wird, knnen Sie den Datenbanknamen
in der Kommandozeile mit angeben, zum Beispiel erstellt
<ul>
<li> <b>pgnscid partien.pgn datenbank</b> </li>
</ul>
eine Datenbank bestehend aus den Dateien <i>datenbank.si3</i>,
<i>datenbank.sg3</i> und <i>datenbank.sn3</i>.
</p>
<p>
Beachten Sie, da pgnscid (und auch scid) mit gzip komprimierte
PGN-Dateien (z.B. <b>datenbank.pgn.gz</b>) direkt lesen kann, wenn Sie
also eine groe PGN-Datei mit gzip komprimiert haben, um Speicherplatz
zu sparen, mssen Sie sie nicht zuerst dekomprimieren.
</p>

<h3>Optionen</h3>
<p>
Pgnscid akzeptiert zwei optionale Argumente vor dem Dateinamen:
<b>-f</b> und <b>-x</b>.
</p>
<p>
Die Option <b>-f</b> erzwingt das berschreiben einer existierenden
Datenbank; standardmig wandelt pgnscid nicht in eine bereits
bestehende Datenbank um.
</p>
<p>
Die Option <b>-x</b> veranlat pgnscid, Text zwischen den Partien zu
ignorieren. Gem Voreinstellung wird Text zwischen Partien als
Kommentar vor der folgenden Partie gespeichert. Diese Option betrifft
nur Text zwischen Partien; Standardkommentare innerhalb der Partien
werden weiterhin konvertiert und gespeichert.
</p>

<h3>Spielernamen formatieren</h3>
<p>
Um die Anzahl verschiedener Namensschreibweisen desselben Spielers
zu reduzieren, werden von pgnscid einige Grundformatierungen
durchgefhrt. Zum Beispiel wird die Anzahl der Leerzeichen nach einem
Komma auf eins gesetzt, Leerzeichen am Anfang oder Ende eines Namens
werden ebenso wie ein Punkt am Namensende entfernt.
Hollndische Namenszustze wie "van den" und "Van Der" werden ebenfalls
normalisiert, so da sie ein groes "V" und kleines "d" haben.
</p>
<p>
Sie knnen Spieler-, Turnier- Orts- und Rundenbezeichnungen in Scid
bearbeiten (und sogar automatische Schreibkorrekturen durchfhren);
zu den Details siehe die Hilfeseite <a Maintenance Editing>Wartung</a>.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


#################
### Sorting help:

set helpTitle(D,Sorting) "Datenbank sortieren"
set helpText(D,Sorting) {<h1>Eine Datenbank sortieren</h1>
<p>
Die <term>Sortier</term>-Funktionen sortieren alle Partien einer
Datenbank. Sie knnen mehrere Sortierkriterien auswhlen.
Wenn zwei Partien nach einem Kriterium gleichrangig sind, werden
sie nach dem zweiten Kriterium sortiert, und so weiter.
</p>

<h3>Sortierkriterien</h3>
<p>
Die verfgbaren Sortierkriterien sind:
</p>
<ul>
<li> Datum (lteste Partien zuerst)
<li> Jahr (wie Datum, aber nur das Jahr wird verwendet)
<li> Turnier (Ereignis)
<li> Ort
<li> Land (die letzten 3 Buchstaben des Ortes)
<li> Runde
<li> Wei
<li> Elo-Zahl (Durchschnitt von Wei und Schwarz, hhere zuerst)
<li> Schwarz
<li> Ergebnis (Wei gewinnt, danach Remis, danach Schwarz gewinnt)
<li> Lnge (Anzahl ganzer Zge in der Partie)
<li> ECO (Code der <a ECO>Enzyklopdie der Schacherffnungen</a>)
</ul>

<h3>Sortierergebnis</h3>
<p>
Wenn Sie eine nicht schreibgeschtzte Scid-Datenbank sortieren, wird das
Sortierergebnis gesichert, so da die Reihenfolge der Datenbankpartien
dauerhaft gendert ist. Falls Sie nur eine temporre Sortierung wollen,
schtzen Sie die Datenbank zuerst gegen berschreiben mit dem Menpunkt
<menu>Datei: Schreibschutz</menu>.
</p>
<p>
Wenn Sie eine Datenbank sortieren, die schreibgeschtzt ist oder aus
einer PGN-Datei besteht, kann das Sortierergebnis nicht gesichert werden,
so da die sortierte Partiereihenfolge verloren geht, wenn die Datei
geschlossen wird.
</p>
<p>
Beachten Sie, da das Sortieren einer Datenbank den
<a Searches Filter>Suchfilter</a> zurcksetzt auf alle Partien.
</p>

<h3>Wichtiger Hinweis zum Datenbank sortieren:</h3>
<p>
Wenn eine Datenbank sortiert wurde, ist die Indexdatei gendert, die
Partiendatei aber unverndert. Das heit, das Sortieren einer Datenbank
hinterlt die Partiedatenstze der Datei in einer zuflligen
Reihenfolge relativ zur Indexdatei. Das kann die <a Tree>Zugbaum</a>-,
Positions- und Material/Muster-<a Searches>Suche</a> merklich
<b>verlangsamen</b>, Sie sollten daher nach dem Datenbank sortieren
die Partiendatei durch <a Compact>Komprimieren</a> neuorganisieren,
um gute Suchleistungen zu erhalten.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


####################
### NAG values help:

set helpTitle(D,NAGs) "NAG-Werte"
set helpText(D,NAGs) {<h1>Standard-NAG-Werte</h1>
<p>
Standard-NAG-Werte (Numeric Annotation Glyph = "numerisches
Anmerkungszeichen"), im <a Author Related>PGN-Standard</a> definiert,
sind:
</p>
<cyan>
<ul>
<li>  1   Guter Zug (!) </li>
<li>  2   Schwacher Zug (?) </li>
<li>  3   Ausgezeichneter Zug (!!) </li>
<li>  4   Patzer / Grober Fehler (??) </li>
<li>  5   Interessanter Zug (!?) </li>
<li>  6   Zweifelhafter Zug (?!) </li>
<li>  7   Erzwungener Zug </li>
<li>  8   Der einzige Zug; keine vernnftige Alternative </li>
<li>  9   Schlechtester Zug </li>
<li> 10   Ausgeglichener Position (=) </li>
<li> 11   Gleiche Chancen, ruhige Stellung (=) </li>
<li> 12   Gleiche Chancen, aktive Stellung (=) </li>
<li> 13   Unklare Stellung (~) </li>
<li> 14   Wei hat leichten Vorteil, steht etwas besser (+=) </li>
<li> 15   Schwarz hat leichten Vorteil, steht etwas besser (=+) </li>
<li> 16   Wei hat Vorteil, steht besser (+/-) </li>
<li> 17   Schwarz hat Vorteil, steht besser (-/+) </li>
<li> 18   Wei hat entscheidenden Vorteil (+-) </li>
<li> 19   Schwarz hat entscheidenden Vorteil (-+) </li>
<li> 20   Wei hat berwltigenden Vorteil (+-) </li>
<li> 21   Schwarz hat berwltigenden Vorteil (-+) </li>
<li> 22   Wei ist in Zugzwang </li>
<li> 23   Schwarz ist in Zugzwang </li>
<li> 24   Wei hat leichten Raumvorteil </li>
<li> 25   Schwarz hat leichten Raumvorteil </li>
<li> 26   Wei hat Raumvorteil </li>
<li> 27   Schwarz hat Raumvorteil </li>
<li> 28   Wei hat entscheidenden Raumvorteil </li>
<li> 29   Schwarz hat entscheidenden Raumvorteil </li>
<li> 30   Wei hat leichten Zeit-(Entwicklungs)vorsprung </li>
<li> 31   Schwarz hat leichten Zeit-(Entwicklungs)vorsprung </li>
<li> 32   Wei hat Zeit-(Entwicklungs)vorsprung </li>
<li> 33   Schwarz hat Zeit-(Entwicklungs)vorsprung </li>
<li> 34   Wei hat entscheidenden Zeit-(Entwicklungs)vorsprung </li>
<li> 35   Schwarz hat entscheidenden Zeit-(Entwicklungs)vorsprung </li>
<li> 36   Wei hat die Initiative </li>
<li> 37   Schwarz hat die Initiative </li>
<li> 38   Wei hat andauernde Initiative </li>
<li> 39   Schwarz hat andauernde Initiative </li>
<li> 40   Wei hat Angriff </li>
<li> 41   Schwarz hat Angriff </li>
<li> 42   Wei hat keine ausreichende Kompensation fr das Material </li>
<li> 43   Schwarz hat keine ausreichende Kompensation fr das Material </li>
<li> 44   Wei hat ausreichende Kompensation fr das Material </li>
<li> 45   Schwarz hat ausreichende Kompensation fr das Material </li>
<li> 46   Wei hat mehr als ausreichende Kompensation fr das Material </li>
<li> 47   Schwarz hat mehr als ausreichende Kompensation fr das Material </li>
<li> 48   Wei hat leichtes bergewicht im Zentrum </li>
<li> 49   Schwarz hat leichtes bergewicht im Zentrum </li>
<li> 50   Wei hat bergewicht im Zentrum </li>
<li> 51   Schwarz hat bergewicht im Zentrum </li>
<li> 52   Wei hat entscheidendes bergewicht im Zentrum </li>
<li> 53   Schwarz hat entscheidendes bergewicht im Zentrum </li>
<li> 54   Wei hat leichtes bergewicht am Knigsflgel </li>
<li> 55   Schwarz hat leichtes bergewicht am Knigsflgel </li>
<li> 56   Wei hat bergewicht am Knigsflgel </li>
<li> 57   Schwarz hat bergewicht am Knigsflgel </li>
<li> 58   Wei hat entscheidendes bergewicht am Knigsflgel </li>
<li> 59   Schwarz hat entscheidendes bergewicht am Knigsflgel </li>
<li> 60   Wei hat leichtes bergewicht am Damenflgel </li>
<li> 61   Schwarz hat leichtes bergewicht am Damenflgel </li>
<li> 62   Wei hat bergewicht am Damenflgel </li>
<li> 63   Schwarz hat bergewicht am Damenflgel </li>
<li> 64   Wei hat entscheidendes bergewicht am Damenflgel </li>
<li> 65   Schwarz hat entscheidendes bergewicht am Damenflgel </li>
<li> 66   Wei hat eine schwache Grundreihe </li>
<li> 67   Schwarz hat eine schwache Grundreihe </li>
<li> 68   Wei hat eine gut gesicherte Grundreihe </li>
<li> 69   Schwarz hat eine gut gesicherte Grundreihe </li>
<li> 70   Wei hat einen schlecht gesicherten Knig </li>
<li> 71   Schwarz hat einen schlecht gesicherten Knig </li>
<li> 72   Wei hat einen gut gesicherten Knig </li>
<li> 73   Schwarz hat einen gut gesicherten Knig </li>
<li> 74   Der weie Knig steht schlecht </li>
<li> 75   Der schwarze Knig steht schlecht </li>
<li> 76   Der weie Knig steht gut </li>
<li> 77   Der schwarze Knig steht gut </li>
<li> 78   Wei hat eine sehr schwache Bauernstruktur </li>
<li> 79   Schwarz hat eine sehr schwache Bauernstruktur </li>
<li> 80   Wei hat eine schwache Bauernstruktur </li>
<li> 81   Schwarz hat eine schwache Bauernstruktur </li>
<li> 82   Wei hat eine starke Bauernstruktur </li>
<li> 83   Schwarz hat eine starke Bauernstruktur </li>
<li> 84   Wei hat eine sehr starke Bauernstruktur </li>
<li> 85   Schwarz hat eine sehr starke Bauernstruktur </li>
<li> 86   Der weie Springer steht schlecht </li>
<li> 87   Der schwarze Springer steht schlecht </li>
<li> 88   Der weie Springer steht gut </li>
<li> 89   Der schwarze Springer steht gut </li>
<li> 90   Der weie Lufer steht schlecht </li>
<li> 91   Der schwarze Lufer steht schlecht </li>
<li> 92   Der weie Lufer steht gut </li>
<li> 93   Der schwarze Lufer steht gut </li>
<li> 94   Der weie Turm steht schlecht </li>
<li> 95   Der schwarze Turm steht schlecht </li>
<li> 96   Der weie Turm steht gut </li>
<li> 97   Der schwarze Turm steht gut </li>
<li> 98   Die weie Dame steht schlecht </li>
<li> 99   Die schwarze Dame steht schlecht </li>
<li>100   Die weie Dame steht gut </li>
<li>101   Die schwarze Dame steht gut </li>
<li>102   Die weien Figuren sind schlecht koordiniert </li>
<li>103   Die schwarzen Figuren sind schlecht koordiniert </li>
<li>104   Die weien Figuren sind gut koordiniert </li>
<li>105   Die schwarzen Figuren sind gut koordiniert </li>
<li>106   Wei hat die Erffnung sehr schwach behandelt </li>
<li>107   Schwarz hat die Erffnung sehr schwach behandelt </li>
<li>108   Wei hat die Erffnung schwach behandelt </li>
<li>109   Schwarz hat die Erffnung schwach behandelt </li>
<li>110   Wei hat die Erffnung gut behandelt </li>
<li>111   Schwarz hat die Erffnung gut behandelt </li>
<li>112   Wei hat die Erffnung sehr gut behandelt </li>
<li>113   Schwarz hat die Erffnung sehr gut behandelt </li>
<li>114   Wei hat das Mittelspiel sehr schwach behandelt </li>
<li>115   Schwarz hat das Mittelspiel sehr schwach behandelt </li>
<li>116   Wei hat das Mittelspiel schwach behandelt </li>
<li>117   Schwarz hat das Mittelspiel schwach behandelt </li>
<li>118   Wei hat das Mittelspiel gut behandelt </li>
<li>119   Schwarz hat das Mittelspiel gut behandelt </li>
<li>120   Wei hat das Mittelspiel sehr gut behandelt </li>
<li>121   Schwarz hat das Mittelspiel sehr gut behandelt </li>
<li>122   Wei hat das Endspiel sehr schwach behandelt </li>
<li>123   Schwarz hat das Endspiel sehr schwach behandelt </li>
<li>124   Wei hat das Endspiel schwach behandelt </li>
<li>125   Schwarz hat das Endspiel schwach behandelt </li>
<li>126   Wei hat das Endspiel gut behandelt </li>
<li>127   Schwarz hat das Endspiel gut behandelt </li>
<li>128   Wei hat das Endspiel sehr gut behandelt </li>
<li>129   Schwarz hat das Endspiel sehr gut behandelt </li>
<li>130   Wei hat etwas Gegenspiel </li>
<li>131   Schwarz hat etwas Gegenspiel </li>
<li>132   Wei hat Gegenspiel </li>
<li>133   Schwarz hat Gegenspiel </li>
<li>134   Wei hat entscheidendes Gegenspiel </li>
<li>135   Schwarz hat entscheidendes Gegenspiel </li>
<li>136   Wei ist in leichter Zeitnot </li>
<li>137   Schwarz ist in leichter Zeitnot </li>
<li>138   Wei ist in erheblicher Zeitnot </li>
<li>139   Schwarz ist in erheblicher Zeitnot </li>
</ul>
</cyan>

<p>
Weitere vorgeschlagene NAG-Werte fr Schachinformator-Symbole sind u.a.:
</p>
<cyan>
<ul>
<li>140   Mit der Idee ... </li>
<li>141   Gerichtet gegen ... </li>
<li>142   Besser ist </li>
<li>143   Schlechter ist </li>
<li>144   Gleichwertig ist </li>
<li>145   Anmerkung des Herausgebers ("RR") </li>
<li>146   Neuerung ("N") </li>
<li>147   Schwacher Punkt </li>
<li>148   Endspiel </li>
<li>149   Linie </li>
<li>150   Diagonale </li>
<li>151   Wei hat das Luferpaar </li>
<li>152   Schwarz hat das Luferpaar </li>
<li>153   Verschiedenfarbige Lufer </li>
<li>154   Gleichfarbige Lufer </li>
</ul>
</cyan>

<p>
Andere Vorschlge sind:
</p>
<cyan>
<ul>
<li>190   Etc. </li>
<li>191   Doppelbauern </li>
<li>192   Isolierte Bauern </li>
<li>193   Verbundene Bauern </li>
<li>194   Hngende Bauern </li>
<li>195   Rckstndiger Bauer </li>
</ul>
</cyan>

<p>
Von Scid definierte Symbole zum internen Gebrauch:
</p>
<cyan>
<ul>
<li>201   Diagramm ("D", manchmal auch "#") </li>
</ul>
</cyan>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


######################
### File formats help:

set helpTitle(D,Formats) "Datei-Formate"
set helpText(D,Formats) {<h1>Scids Datei-Formate</h1>
<p>
Scid-Datenbanken bestehen aus drei essentiellen Dateien: eine
Indexdatei, eine Namendatei und eine Partiendatei. Alle haben eine
zweibuchstabige Dateiendung, beginnend mit "s": ".si" fr Indexdateien,
".sn" fr Namendateien und ".sg" fr Partiendateien.
</p>

<h3>Die Indexdatei (.si)</h3>
<p>
Diese Datei enthlt eine Beschreibung der Datenbank und fr jede Partie
einen kleinen Eintrag fester Lnge . Die aktuelle Gre ist 41 Bytes
pro Partie. Von diesen sind 28 Bytes wesentliche Informationen wie
Ergebnis, Datum, Indizes fr Spieler-/Turnier-/Orts-Namen (die
tatschlichen Namen befinden sich  in der Namendatei) etc.
</p>
<p>
Die verbleibenden 13 Bytes enthalten redundante, aber ntzliche
Informationen zur Partie, die zur Beschleunigung der Positions-,
Material- und Mustersuche genutzt werden. Siehe den Abschnitt
<a Formats Fast>Schnelles Suchen</a> weiter unten fr weitere
Informationen.
</p>

<h3>Die Namendatei (.sn)</h3>
<p>
Diese Datei enthlt alle Spieler-, Turnier-, Orts- und Rundennamen, die
in der Datenbank verwendet werden. Jeder Name ist nur einmal gespeichert,
auch wenn er in vielen Partien vorkommt. Die Namendatei ist blicherweise
die kleinste der drei essentiellen Datenbankdateien.
</p>

<h3>Die Partiendatei (.sg)</h3>
<p>
Diese Datei enthlt die aktuellen Zge, Varianten und Kommentare jeder
Partie. Die Zugkodierung ist sehr kompakt: die meisten Zge bentigen
nur ein Byte.
</p>
<p>
Wenn eine Partie ersetzt wird, wird ihre neue Version am <i>Ende</i>
der Datei gespeichert, so da sich ber die Zeit nicht genutzter
Speicherplatz ansammelt. Sie knnen durch <a Compact>Komprimieren</a>
die minimale Gre einer Datenbank wiederherstellen.
</p>

<h3>Andere Scid-Dateien</h3>
<p>
Eine <a EPD>EPD</a>-Datei (Dateiendung: ".epd") enthlt eine Reihe von
Schachpositionen, jede mit einem Textkommentar.
Das EDP-Dateiformat ist beim <a Author Related>PGN-Standard</a>
beschrieben.
</p>
<p>
Eine E-Mail-Datei (Dateiendung: ".sem") einer Datenbank speichert
Daten der Gegner, denen Sie E-Mails senden.
</p>
<p>
Eine Suchoptions-Datei (Dateiendung: ".sso") enthlt Einstellungen fr
eine <a Searches Header>Partiedaten</a>- oder
<a Searches Material>Material/Muster</a>-Suche.
</p>

<h3><name Fast>Schnelles Suchen in Scid</name></h3>
<p>
Wie oben erwhnt, enthlt die Indexdatei einige redundante, aber
ntzliche Informationen ber jede Partie, um Positions- oder
Materialsuchen zu beschleunigen.
</p>
<p>
Beispielsweise ist das Material der Schlustellung gespeichert. Wenn Sie
nach Turm- und Bauernendspielen suchen, werden alle Partien, die mit
einer Dame, einem Lufer oder einem Springer auf dem Brett enden,
schnell bergangen.
</p>
<p>
Eine andere ntzliche Teilinformation ist in der Reihenfolge gespeichert,
in der Bauern ihre Ausgangsstellung verlassen haben (durch Ziehen oder
Geschlagenwerden). Dies wird zur Beschleunigung von Zugbaum- oder exakten
Suchen verwendet, insbesondere nach Erffnungspositionen. Beispielsweise
wird bei der Suche nach der Ausgangsstellung der Franzsischen
Verteidigung (1.e4 e6) jede Partie, die mit 1.e4 c5 oder 1.d4 etc.
beginnt, ausgelassen, Partien, die mit 1.e4 e5 anfangen, mssen aber
immer noch durchsucht werden.
</p>

<p><footer>(Aktualisiert: Scid 2.5, Juni 2001)</footer></p>
}


################
### Contact info

set helpTitle(D,Author) "Kontakt-Information"
set helpText(D,Author) {<h1>Kontakt-Information</h1>
<p>
Die Scid Internet - Seite ist erreichbar unter: <br>
<b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>
</p>
<p>
Sie bietet Downloads der neuesten Versionen von Scid und einigen anderen
zustzlichen und ntzlichen Dateien.
</p>
<p>
Bitte senden Sie Ihre Kommentare, Fragen, Vorschlge oder Fehlerberichte
an den Autor von Scid, Shane Hudson, an folgende E-Mail-Adresse: <br>
<b>shane@cosc.canterbury.ac.nz</b>
</p>

<h3><name Related>Links</name></h3>
<p>
Falls Sie Freude an Scid haben, knnten Sie die folgenden
Internetseiten interessieren:
</p>
<ul>
<li><url http://www.tim-mann.org/chess.html>http://www.tim_mann.org/chess.html</url> --
Homepage von Tim Mann's <b>xboard & winboard</b> Programm: eine grafische
Oberflche fr Schachprogramme und Schnittstelle fr Internet Schach
Server. Sie hat auch gute Informationen ber Crafty, GNUchess und
andere Schachprogramme.</li>

<li><url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url> --
das starke Schachprogram Crafty. Das <b>TB</b> -
Unterverzeichnis beinhaltet fast alle Nalimov-Endspieltabellen, welche
von einigen Schachprogrammen und auch von Scid benutzt werden.</li>

<li><url http://www.chesscenter.com/twic/>http://www.chesscenter.com/twic/</url> --
TWIC (the week in chess), ein hervorragendes Wochenmagazin fr
internationale Schachpartien, verfgbar im PGN-Format. </li>

<li><url http://scid.sourceforge.net/standard.txt>http://scid.sourceforge.net/standard.txt</url> --
der <b>PGN-Standard</b>, geschaffen von Steven J. Edwards im Jahre 1994.
Die Textdatei erklrt das PGN- und EPD-Format im Detail.</li>
</ul>

<p><footer>(Aktualisiert: Scid 2.6, August 2001)</footer></p>
}



############################################################
#
# German tip of the day

set tips(D) {
  {
    Scid hat mehr als 30 <a Index>Hilfeseiten</a>, und in den meisten
    Scid-Fenstern liefert die <b>F1</b>-Taste die Hilfeseite zu diesem
    Fenster.
  }
  {
    Einige Scid-Fenster (z.B. Informationsbereich und
    Datenbank-<a Switcher>Umschalter</a>) haben ein Kontextmenu.
    Drcken Sie einfach die rechte Maustaste in jedem Fenster, um zu
    sehen, ob es ein Men hat und welche Funktionen zur Verfgung
    stehen.
  }
  {
    Scid bietet Ihnen mehr als eine Mglichkeit, Schachzge einzugeben,
    und lt Ihnen die Wahl, welche Ihnen am meisten zusagt. Sie knnen
    die Maus verwenden (mit oder ohne Zugvorschlag) oder die Tastatur
    (mit oder ohne Zugergnzung). Fr Details lesen Sie die Hilfeseite
    <a Moves>Zge eingeben</a>.
  }
  {
    Wenn Sie einige Datenbank hufig ffnen, fgen Sie zu jeder ein
    <a Bookmarks>Lesezeichen</a> hinzu, dann knnen Sie sie schneller
    mit dem Lesezeichen-Men ffnen.
  }
  {
    Sie knnen alle Zge einer Partie (mit allen Varianten und
    Kommentaren) mit dem <a PGN>PGN-Fenster</a> betrachten. Im
    PGN-Fenster knnen Sie zu jedem beliebigen Zug gehen, indem Sie
    ihn mit der linken Maustaste anklicken, oder mit der mittleren
    Maustaste eine Voransicht dieser Stellung erhalten.
  }
  {
    Sie knnen Partien mit der linken Maustaste per "Drag & Drop" im
    <a Switcher>Datenbank-Umschalter</a> von einer Datenbank in eine
    andere kopieren.
  }
  {
    Scid kann PGN-Dateien selbst dann ffnen, wenn sie mit Gzip
    komprimiert wurden (Dateiname mit Erweiterung .gz). PGN-Dateien
    werden schreibgeschtzt geffnet, wenn Sie also eine PGN-Datei
    editieren wollen, erstellen Sie eine neue Scid-Datenbank und
    kopieren die PGN-Datei mit dem <a Switcher>Datenbank-Umschalter</a>
    dorthin.
  }
  {
    Wenn Sie eine groe Datenbank haben, die Sie oftmals mit dem
    <a Tree>Zugbaum-Fenster</a> nuzten, lohnt es sich,
    <b>Cache-Datei fllen</b> im Dateimen des Zugbaum-Fensters zu
    whlen. Damit merken Sie sich Zugbaum-Statistiken fr viele
    hufige Erffnungspositionen und beschleunigen den Zugriff auf
    den Zugbaum fr die Datenbank.
  }
  {
    Das <a Tree>Zugbaum</a>-Fenster kann Ihnen alle Zge zeigen, die
    in der aktuellen Position gespielt wurden, aber wenn Sie auch alle
    Zugfolgen sehen wollen, mit denen diese Stellung erreicht wurde,
    finden Sie diese, wenn Sie einen <a OpReport>Erffnungsreport</a>
    erstellen.
  }
  {
    Klicken Sie mit der linken oder rechten Maustaste auf die berschrift
    einer Spalte im <a GameList>Partieliste</a>-Fenster , um ihre
    Breite anzupassen.
  }
  {
    Mit dem Fenster <a PInfo>Spielerinformation</a> (um es zu ffnen,
    klicken Sie einfach auf einen Spielernamen im Informationsbereich
    unter dem Hauptfenster-Schachbrett) knnen Sie auf einfache Weise
    den <a Searches Filter>Filter</a> so einstellen, da er alle Partien
    eines bestimmten Spielers mit einem bestimmten Ergebnis enthlt,
    indem Sie auf irgendeinen <red>in Rot</red> dargestellten Wert
    klicken.
  }
  {
    Beim Erffnungsstudium kann es sehr hilfreich sein, fr eine wichtige
    Position eine <a Searches Board>Brettsuche</a> mit der <b>Bauern</b>-
    oder <b>Linien</b>-Option durchzufhren, was andere Erffnungen
    entdecken knnte, die zur selben Bauernstruktur fhren.
  }
  {
    Im Informationsbereich (unterhalb des Schachbretts) knnen Sie mit
    der rechten Maustaste ein Men zur Gestaltung der Ausgabe aktivieren.
    Zum Beispiel knnen Sie Scid veranlassen, den nchsten Zug zu
    verstecken, was ntzlich ist, wenn man zum Trainieren eine Partie
    nachspielt und die Zge zu erraten versucht.
  }
  {
    Wenn Sie fr eine groe Datenbank oftmals eine umfangreiche
    Datenbank-<a Maintenance>Wartung</a> durchfhren, knnen Sie
    mehrere Wartungsarbeiten gleichzeitig mit dem
    <a Maintenance Cleaner>Bereiniger</a> ausfhren.
  }
  {
    Wenn Sie eine groe Datenbank haben, wo die meisten Partien einen
    Turnier-Eintrag besitzen, und Sie wollen die Partien nach Datum
    sortiert haben, erwgen Sie ein <a Sorting>Sortieren</a> nach
    Turnier-Datum und Turnier anstatt nach Datum und Turnier, da
    Ihnen das hilft, Partien desselben Turniers mit unterschiedlichen
    Daten zusammen zu halten (natrlich unter der Voraussetzung, da
    sie alle dasselbe Turnier-Datum haben).
  }
  {
    Es ist eine gute Idee, vor einem <a Maintenance Twins>Dubletten
    lschen</a> eine <a Maintenance Spellcheck>Schreibkorrektur</a>
    Ihrer Datenbank durchzufhren, da dies Scid ermglichen wird,
    mehr Dubletten zu finden und zum Lschen vorzumerken.
  }
  {
    <a Flags>Markierungen</a> sind ntzlich, um Datenbankpartien mit
    Charakteristiken zu versehen, nach denen Sie zu einem spteren
    Zeitpunkt vielleicht suchen wollen, wie etwa Bauernstruktur, Taktik
    etc. Sie knnen mit der <a Searches Header>Partiedaten-Suche</a>
    nach Markierungen suchen.
  }
  {
    Wenn Sie eine Partie nachspielen und einige Zge ausprobieren
    wollen, ohne die Partie zu verndern, schalten Sie einfach den
    Testmodus ein (mit der Tastenkombination <b>Strg+Leerzeichen</b>
    oder mit dem Icon aus der Werkzeugleiste), und wenn Sie fertig
    sind, schalten Sie ihn wieder aus, um zur ursprnglichen Partie
    zurckzukommen.
  }
  {
    Um die prominentesten Partien (Spieler mit hohen Elo-Zahlen)
    zu finden, die eine bestimmte Position erreicht haben, ffnen
    Sie das <a Tree>Zugbaum</a>-Fenster und dort die Liste der
    besten Partien. Sie knnen sogar die Liste der besten Partien
    auf Partien mit einem bestimmten Ergebnis begrenzen.
  }
  {
    Eine ausgezeichnete Methode, eine Erffnung mit Hilfe einer groen
    Datenbank zu studieren, ist, den Trainingsmodus im
    <a Tree>Zugbaum</a>-Fenster zu aktivieren und dann gegen die
    Datenbank zu spielen, um zu sehen, welche Zge hufig vorkommen.
  }
  {
    Wenn Sie zwei Datenbanken geffnet haben und die
    <a Tree>Zugbaum</a>-Statistik der ersten Datenbank sehen wollen,
    whrend Sie eine Partie der zweiten Datenbank untersuchen, drcken
    Sie einfach den Schalter <b>Anbinden</b> im Zugbaum-Fenster, um die
    Partie an die erste Datenbank zu binden, und wechseln dann zur
    zweiten Datenbank.
  }
  {
    Der <a Tmt>Turnier-Finder</a> ist nicht nur zum Auffinden eines
    bestimmten Turniers ntzlich, sondern auch um zu sehen, an welchen
    Turnieren ein bestimmter Spieler vor kurzem teilgenommen hat,
    oder um die Spitzenturniere in einem bestimmten Land zu betrachten.
  }
  {
    Es gibt eine Reihe hufiger Stellungsmuster, die im Fenster
    <a Searches Material>Material/Muster</a>-Suche definiert sind und
    die Ihnen beim Erffnungs- oder Mittelspielstudium ntzlich sein
    knnen.
  }
  {
    Wenn Sie im Fenster <a Searches Material>Material/Muster</a>-Suche
    nach einer bestimmten Materialkonstellation suchen, ist es oftmals
    hilfreich, die Suche auf Partien zu beschrnken, die mindestens fr
    einige Halbzge auf das Suchmuster passen, um Partien auszusondern,
    wo die gesuchte Konstellation nur kurz vorkam.
  }
  {
    Wenn Sie eine wichtige Datenbank haben, die Sie nicht versehentlich
    verndern wollen, whlen Sie <b>Schreibschutz...</b> im
    <b>Datei</b>-Men, nachdem Sie sie geffnet haben, oder ndern Sie
    ihre Dateizugriffsrechte auf "nur Lesen".
  }
  {
    Wenn Sie XBoard oder WinBoard benutzen (oder ein anderes
    Schachprogramm, das Schachpositionen in FEN-Standardnotation in die
    Zwischenablage kopieren kann) und wollen dessen aktuelle
    Schachposition nach Scid kopieren, ist der schnellste und einfachste
    Weg, <b>Position sichern</b> im Dateimen von XBoard/Winboard zu
    whlen, danach <b>Stellung einfgen</b> in Scids Men "Bearbeiten".
  }
  {
    Die <a Searches Header>Partiedaten-Suche</a> ignoriert bei
    Spieler/Turnier/Ort/Runden-Namen Gro- und Kleinschreibung.
    Sie knnen sie aber bercksichtigen und gleichzeitig Wildcards
    verwenden (mit "?" = irgendein einzelnes Zeichen und "*" = null oder
    mehr Zeichen), wenn Sie den Suchtext in Anfhrungszeichen ("...")
    eingeben. Beispielsweise geben Sie "*BEL" (mit den Anfhrungszeichen)
    im Ortsfeld ein, um alle in Belgien, nicht aber in Belgrad
    gespielten Partien zu finden.
  }
  {
    Wenn Sie einen Partiezug korrigieren wollen, ohne die danach
    gespielten Zge zu verlieren, ffnen Sie das
    <a Import>Import</a>-Fenster, klicken auf <b>Aktuelle Partie
    einfgen</b>, editieren den falschen Zug und whlen dann
    <b>Importieren</b>.
  }
  {
    Wenn Sie eine ECO-Klassifikationsdatei geladen haben, knnen Sie
    zur am tiefsten klassifizierten Position der aktuellen Partie mit
    <b>Erffnung identifzieren</b> im <b>Partie</b>-Men gehen
    (Tastenkombination: Strg+Umsch+D).
  }
  {
    Wenn Sie vor dem ffnen einer Datei ihre Gre oder das Datum ihrer
    letzten Modifikation berprfen wollen, ffnen Sie sie mit dem
    <a Finder>Datei-Finder</a>.
  }
  {
    Eine <a Repertoire>Repertoire</a>-Datei ist eine ausgezeichnete
    Methode, Ihre favorisierten Erffnungsvarianten im Auge zu behalten
    und die Partien zu finden, wo diese Varianten gespielt wurden.
    Wenn Sie erst einmal Ihre Erffnungen in einer Repertoire-Datei
    gespeichert haben, knnen Sie jedesmal, wenn Sie eine neue Datei
    mit Partien haben, eine Repertoire-Suche durchfhren und die Partien
    mit Ihren favorisierten Erffnungen betrachten.
  }
  {
    Mit einem <a OpReport>Erffnungsreport</a> kann man sehr gut
    mehr ber eine bestimmte Position lernen. Sie knnen die Erfolgsrate
    sehen, ob sie zu vielen Kurzremis fhrt und die typischen
    positionellen Themen.
  }
  {
    Sie knnen die gebruchlichsten Kommentarsymbole (!, !?, += etc.)
    dem aktuellen Zug oder der aktuellen Stellung mit Tastenkombinationen
    hinzufgen, ohne den Kommentareditor benutzen zu mssen -- um
    beispielsweise ein "!" hinzuzufgen, tippen Sie "!" und danach die
    Eingabetaste. Zu den Details siehe die Hilfeseite <a Moves>Zge
    eingeben</a>.
  }
  {
    Wenn Sie Erffnungen in einer Datenbank mit dem <a Tree>Zugbaum</a>
    betrachten, knnen Sie eine ntzlichen bersicht erhalten, welche
    Erfolge mit der aktuellen Erffnung in der letzten Zeit und zwischen
    Spitzenspielern erzielt wurden, indem Sie das Statistik-Fenster
    ffnen (Tastenkombination: Strg-I).
  }
  {
    Sie knnen die Gre des Hauptfensters ndern, indem Sie die
    <b>Strg</b>-Taste gedrckt halten und dann die Cursortaste
    <b>Links</b> oder <b>Rechts</b> drcken.
  }
  {
    Nach einer <a Searches>Suche</a> knnen Sie leicht durch alle
    passenden Partien blttern, indem Sie die <b>Strg</b>-Taste gedrckt
    halten und dann die Cursortaste <b>Auf</b> oder <b>Ab</b> drcken,
    um die vorherige bzw. nchste Partie im <a Searches Filter>Filter</a>
    zu laden.
  }
}


### End of file: deutsch.tcl
### francais.tcl:
#
# French language support for Scid.
# Translations contributed by:
# Gilles Maire, Vincent Serisier, Joel Rivat, and Pascal Heisel.

addLanguage F Francais 0

proc setLanguage_F {} {

# File menu:
menuText F File "Fichier" 0
menuText F FileNew "Nouvelle..." 0 {Crer une nouvelle base de donnes Scid}
menuText F FileOpen "Ouvrir..." 0 {Ouvrir une base de donnes Scid existante}
menuText F FileClose "Fermer" 0 {Fermer la base de donnes Scid active}
menuText F FileFinder "Trouver" 0 {Ouvrir la fentre de recherche de fichier}
menuText F FileBookmarks "Signets" 0 {Menu des signets (raccourci: Ctrl+B)}
menuText F FileBookmarksAdd "Ajouter un signet" 0 \
  {Poser un signet pour la position et partie courante}
menuText F FileBookmarksFile "Classer un signet" 0 \
  {Classer un signet pour la position et partie courante}
menuText F FileBookmarksEdit "Modifier les signets..." 0 \
  {Modifier les menus de signets}
menuText F FileBookmarksList "Afficher les dossiers comme une simple liste" 0 \
  {Afficher les dossiers comme une simple liste et non comme des sous-menus}
menuText F FileBookmarksSub "Afficher les dossiers comme des sous-menus" 0 \
  {Afficher les dossiers comme des sous-menus et non comme une simple liste}
menuText F FileMaint "Maintenance" 0
menuText F FileMaintWin "Fentre de maintenance" 0 \
  {Ouvrir/Fermer la fentre de maintenance}
menuText F FileMaintCompact "Compacter la base..." 0 \
  {Compacter la base: supprimer les parties effaces et les noms non utiliss}
menuText F FileMaintClass "Classer les parties suivant ECO" 2 \
  {Recalculer le code ECO de toutes les parties}
menuText F FileMaintSort "Trier la base..." 0 {Trier toutes les parties de la base}
menuText F FileMaintDelete "Purger les doublons..." 0 \
  {Trouver les parties en doublons et les marquer pour l'effacement}
menuText F FileMaintTwin "Trouver les doublons" 0 \
  {Ouvrir/Actualiser la fentre de recherche de doublons}
menuText F FileMaintName "Orthographie des noms" 0 {dition des noms et outils orthographiques}
menuText F FileMaintNameEditor "diteur de noms" 11 {Ouvrir/Fermer l'diteur de noms}
menuText F FileMaintNamePlayer "Corriger les noms de joueurs..." 21 \
  {Vrifier l'orthographe des noms de joueurs}
menuText F FileMaintNameEvent "Corriger les vnements..." 14 \
  {Vrifier l'orthographe des noms d'vnements}
menuText F FileMaintNameSite "Corriger les noms de lieux.." 21 \
  {Vrifier l'orthographe des noms de lieux}
menuText F FileMaintNameRound "Corriger les noms des rondes..." 22 \
  {Vrifier l'orthographe des noms de rondes}
menuText F FileReadOnly "Lecture seule..." 0 \
  {Traiter la base courante en lecture seule, en empchant les changements}
menuText F FileExit "Quitter" 0 {Quitter Scid}

# Edit menu:
menuText F Edit "diter" 0
menuText F EditAdd "Ajouter variante" 0 {Ajouter une variante}
menuText F EditDelete "Effacer variante" 0 {Effacer cette variante}
menuText F EditFirst "Dplacer en tte" 0 \
  {Dplacer cette variante en tte de liste}
menuText F EditMain "Variante vers ligne principale" 13 \
   {Promouvoir une variante en ligne principale}
menuText F EditTrial "Essayer une variante" 0 \
  {Dmarrer/Stopper mode d'essai, pour tester une ide sur l'chiquier}
menuText F EditStrip "purer" 2 {pure les commentaires ou les variantes de cette partie}
menuText F EditStripComments "Commentaires" 0 \
  {purer cette partie de tous les commentaires et annotations}
menuText F EditStripVars "Variantes" 0 {purer cette partie des variantes}
menuText F EditReset "Vider le presse-papier" 0 {Vider le presse-papier}
menuText F EditCopy "Copier dans le presse-papier" 0 \
  {Copier la partie en cours dans le presse-papier}
menuText F EditPaste "Coller depuis le presse-papier" 1 \
  {Copier la partie contenue dans le presse-papier  cet emplacement}
menuText F EditSetup "Position de dpart" 0 \
  {Choisir une position de dpart pour cette partie}
menuText F EditPasteBoard "Coller la position de dpart" 12 \
  {Initialiser la position de dpart  partir de la slection de texte courante(presse-papier)}

# Game menu:
menuText F Game "Partie" 0
menuText F GameNew "Rinitialiser la partie" 2 \
  {Remettre  zro la partie}
menuText F GameFirst "Charger la premire partie" 5 {Charger la premire partie du filtre}
menuText F GamePrev "Partie prcdente" 7 \
  {Charger la partie prcdente du filtre}
menuText F GameReload "Recharger la partie" 2 \
  {Recharger la partie (les modifications ne seront pas sauvegardes)}
menuText F GameNext "Partie suivante" 7 {Charger la partie suivante du filtre}
menuText F GameLast "Charger la dernire partie" 5 {Charger la dernire partie du filtre}
menuText F GameRandom "Charger une partie au hasard" 8 {Charger au hasard une partie du filtre}
menuText F GameNumber "Partie numro..." 9 \
  {Charger une partie en donnant son numro}
menuText F GameReplace "Enregistrer: Remplacer la partie..." 13 \
  {Enregistrer cette partie, en crasant l'ancienne version}
menuText F GameAdd "Enregistrer: Ajouter nouvelle partie..." 13 \
  {Enregistrer cette partie en tant que nouvelle partie dans la base}
menuText F GameDeepest "Identifier ouverture" 11 \
  {Trouver la partie la plus proche dans la nomenclature ECO}
menuText F GameGotoMove "Coup numero..." 6 \
  {Aller au coup spcifi dans la partie en cours}
menuText F GameNovelty "Trouver la nouveaut..." 7 \
  {Trouver le premier coup de la partie qui n'a pas t jou auparavant}

# Search menu:
menuText F Search "Rechercher" 0
menuText F SearchReset "Rinitialiser le filtre" 0 \
  {Remettre  zro le filtre (inclusion de toutes les parties)}
menuText F SearchNegate "Inverser le filtre" 0 \
  {Inverser le filtre}
menuText F SearchCurrent "Position..." 0 \
  {Rechercher la position en cours}
menuText F SearchHeader "Entte..." 0 \
  {Rechercher par entte (joueur, tournoi, etc) information}
menuText F SearchMaterial "Motifs" 0 \
  {Rechercher des motifs ou un matriel particulier sur l'chiquier}
menuText F SearchUsing "En utilisant un fichier d'options..." 0 \
  {Rechercher en utilisant un fichier d'options de recherche}

# Windows menu:
menuText F Windows "Fentres" 2
menuText F WindowsComment "diteur de commentaires" 0 \
  {Ouvrir/fermer l'diteur de commentaires}
menuText F WindowsGList "Liste des parties" 0 \
  {Ouvrir/fermer la liste des parties}
menuText F WindowsPGN "Fentre PGN" 8 {Ouvrir/fermer la fentre PGN}
menuText F WindowsTmt "Recherche de tournois" 0 {Ouvrir/fermer la recherche de tournois}
menuText F WindowsSwitcher "Changer de base" 0 \
  {Ouvrir/Fermer l'outil de changement de base}
menuText F WindowsMaint "Fentre de Maintenance" 0 \
  {Ouvrir/Fermer la fentre de maintenance}
menuText F WindowsECO "Navigateur ECO" 0 {Ouvrir/fermer le navigateur ECO}
menuText F WindowsRepertoire "diteur de rpertoire" 0 {Ouvrir/Fermer l'diteur de rpertoire}
menuText F WindowsStats "Fentre de statistique" 11 \
  {Ouvir/Fermer le filtre de statistiques}
menuText F WindowsTree "Fentre d'arbre" 10 \
  {Ouvrir/Fermer la fentre d'arbre}
menuText F WindowsTB "Fentre de tables de finales" 8 \
  {Ouvrir/Fermer la fentre de tables de finales}

# Tools menu:
menuText F Tools "Outils" 2
menuText F ToolsAnalysis "Moteur d'analyse..." 9 \
  {Dmarrer/Arrter un moteur d'analyses}
menuText F ToolsAnalysis2 "Moteur d'analyse #2..." 18 \
  {Dmarrer/Arrter un moteur d'analyses}
menuText F ToolsCross "Classement du tournoi" 0 \
  {Montrer le classement du tournoi}
menuText F ToolsEmail "Gestion des messages" 0 \
  {Ouvrir/Fermer la fentre de gestion des messages lectroniques}
menuText F ToolsFilterGraph "Graphique de filtre" 7 \
  {Ouvrir/Fermer la fentre du graphique de filtre}
menuText F ToolsOpReport "Rapport d'ouverture" 0 \
  {Gnrer un rapport d'ouvertures  partir de la position courante}
menuText F ToolsTracker "Suivi de pice"  0 {Ouvrir la fentre de suivi de pice}
menuText F ToolsPInfo "Information sur les joueurs"  0 \
  {Ouvrir/Mettre  jour la fentre d'information sur les joueurs}
menuText F ToolsRating "Elo graphique" 0 \
  {Tracer un graphique du classement Elo des joueurs de cette partie}
menuText F ToolsScore "Score graphique" 0 {Montrer le graphique des scores}
menuText F ToolsExpCurrent "crire la partie en cours" 22 \
  {crire la partie en cours dans un fichier texte}
menuText F ToolsExpCurrentPGN "Dans un fichier PGN..." 16 \
  {crire la partie en cours dans un fichier PGN}
menuText F ToolsExpCurrentHTML "Dans un fichier HTML..." 16 \
  {crire la partie en cours dans un fichier HTML}
menuText F ToolsExpCurrentLaTeX "Dans un fichier LaTeX..." 16 \
  {crire la partie en cours dans un fichier LaTeX}
menuText F ToolsExpFilter "crire le filtre " 2 \
  {crire le filtre dans un fichier texte}
menuText F ToolsExpFilterPGN "Dans un fichier PGN..." 16 \
  {crire le filtre dans un fichier PGN}
menuText F ToolsExpFilterHTML "Dans un fichier HTML..." 16 \
  {crire le filtre dans un fichier HTML}
menuText F ToolsExpFilterLaTeX "Dans un fichier LaTeX..." 16 \
  {crire le filtre dans un fichier LaTeX}
menuText F ToolsImportOne "Importer une partie en PGN..." 0 \
  {Importer une partie  partir d'un texte PGN}
menuText F ToolsImportFile "Importer un fichier en PGN..." 12 \
  {Importer des parties  partir d'un fichier PGN}

# Options menu:
menuText F Options "Options" 0
menuText F OptionsSize "Taille chiquier" 0 {Changer la taille de l'chiquier}
menuText F OptionsPieces "Style des pices" 6 {Changer le style des pices}
menuText F OptionsColors "Couleurs..." 0 {Changer les couleurs}
menuText F OptionsExport "Exportation" 0 {Changer les options d'exportation}
menuText F OptionsFonts "Polices" 0 {Changer les polices}
menuText F OptionsFontsRegular "Normales" 0 {Changer les polices normales}
menuText F OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText F OptionsFontsSmall "Petites" 0 {Changer les petites polices}
menuText F OptionsFontsFixed "Fixe" 0 {Changer les polices de chasse fixe}
menuText F OptionsGInfo "Informations de la partie" 7 {Options d'information de la partie}
menuText F OptionsLanguage "Langue" 0 {Slectionner le menu de choix des langues}
menuText F OptionsMoves "Coups" 2 {Gestion des coups}
menuText F OptionsMovesAsk "Demander avant d'craser les coups" 0 \
  {Demander avant d'craser un coup existant}
menuText F OptionsMovesDelay "Dlai entre les coups" 3 \
  {Positionner le dlai entre deux coups en mode automatique}
menuText F OptionsMovesCoord "Coordonnes entre les coups" 0 \
  {Accepter l'entre des coups par coordonnes ("g1f3")}
menuText F OptionsMovesSuggest "Montrer les coups suggrs" 0 \
  {Activer/Dsactiver le mode de suggestion de coup}
menuText F OptionsMovesKey "Compltion clavier" 0 \
  {Activer/Dsactiver le mode de compltion du clavier}
menuText F OptionsNumbers "Format numrique" 7 {Selectionner le format des nombres}
menuText F OptionsStartup "Dmarrage" 3 {Selectionner les fentres  ouvrir au dmarrage}
menuText F OptionsWindows "Fentres" 0 {Options des fentres}
menuText F OptionsWindowsIconify "Mise en icone automatique" 5 \
  {Mettre toutes les fentres en icones quand la fentre principale est mise en icone}
menuText F OptionsWindowsRaise "Apparition automatique" 0 \
  {Faire apparatre certaines fentres (i.e. barres de progression)  chaque fois qu'elles sont obscurcies}
menuText F OptionsToolbar "Barre d'outils de la fentre principale" 12 \
  {Montrer/Cacher la barre d'outils de la fentre principale}
menuText F OptionsECO "Charger le fichier ECO..." 20 \
  {Charger un fichier au format ECO}
menuText F OptionsSpell "Charger le fichier d'orthographe..." 25 \
  {Charger un fichier de correction orthographique scid}
menuText F OptionsTable "Rpertoire des tables de finales TB..." 0 \
  {Slectionner un rpertoire de fichiers TB, tous les fichiers de ce rpertoire seront utiliss}
menuText F OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText F OptionsSave "Sauver les options" 0 \
  "Sauver les options dans le fichier $::optionsFile"
menuText F OptionsAutoSave "Sauvegarde automatique des options en quittant" 0 \
  {Sauvegarder automatiquement toutes les options en quittant Scid}

# Help menu:
menuText F Help "Aide" 0
menuText F HelpIndex "Index" 0 {Afficher la table des matires}
menuText F HelpGuide "Aide Rapide" 5 {Montrer la page d'aide rapide}
menuText F HelpHints "Astuces" 0 {Afficher les trucs et astuces}
menuText F HelpContact "Contact" 0 {Afficher les noms des contacts}
menuText F HelpTip "Astuce du jour" 0 {Afficher une astuce Scid}
menuText F HelpStartup "Fentre de dmarrage" 0 {Afficher la fentre de dmarrage}
menuText F HelpAbout "A propos de Scid" 2 {Information au sujet de Scid}

# Game info box popup menu:
menuText F GInfoHideNext "Cacher le coup suivant" 0
menuText F GInfoMaterial "Montrer les valeurs de matriel" 0
menuText F GInfoFEN "Montrer la notation FEN" 5
menuText F GInfoMarks "Montrer les cases colores et les flches" 5
menuText F GInfoWrap "Dcouper les longues lignes" 0
menuText F GInfoFullComment "Montrer tous les commentaires" 10
menuText F GInfoTBNothing "Tables de finales: Rien" 12
menuText F GInfoTBResult "Tables de finales: Seulement le rsultat" 12
menuText F GInfoTBAll "Tables de finales: rsultat et meilleurs coups" 19
menuText F GInfoDelete "(Rcuprer)Effacer cette partie" 4
menuText F GInfoMark "(D)Slectionner cette partie" 4

# Main window buttons:
helpMsg F .button.start {Aller au dbut de la partie  (Raccourci clavier: Home)}
helpMsg F .button.end {Aller  la fin de la partie  (Raccourci clavier: Fin)}
helpMsg F .button.back {Reculer d'un coup  (Raccourci clavier: Flche gauche)}
helpMsg F .button.forward {Avancer d'un coup  (Raccourci clavier: Flche droite)}
helpMsg F .button.intoVar {Entrer dans une variante  (Raccourci clavier: v)}
helpMsg F .button.exitVar {Quitter la variante en cours  (Raccourci clavier: z)}
helpMsg F .button.flip {Retourner l'chiquier  (Raccourci clavier: .)}
helpMsg F .button.coords {Afficher/Enlever les coordonnes  (Raccourci clavier: 0)}
helpMsg F .button.autoplay {Jeu automatique  (Raccourci clavier: Ctrl+Z)}

# General buttons:
translate F Back {Retour}
translate F Cancel {Annuler}
translate F Clear {Effacer}
translate F Close {Fermer}
translate F Defaults {Par dfaut}
translate F Delete {liminer}
translate F Graph {Graphique}
translate F Help {Aide}
translate F Import {Importer}
translate F Index {Index}
translate F LoadGame {Charger partie}
translate F BrowseGame {Explorer la partie dans une fentre spare}
translate F MergeGame {Fusionner la partie comme variante}
translate F Preview {Prvisualiser}
translate F Revert {Revenir}
translate F Save {Enregistrer}
translate F Search {Rechercher}
translate F Stop {Arrter}
translate F Store {Enregistrer}
translate F Update {Mettre  jour}
translate F ChangeOrient {Changer l'orientation de la fentre}
translate F None {Aucun}
translate F First {Premier}
translate F Current {En cours}
translate F Last {Dernier}

# General messages:
translate F game {partie}
translate F games {parties}
translate F move {coup}
translate F moves {coups}
translate F all {tout}
translate F Yes {Oui}
translate F No {Non}
translate F Both {Les deux}
translate F King {Roi}
translate F Queen {Dame}
translate F Rook {Tour}
translate F Bishop {Fou}
translate F Knight {Cavalier}
translate F Pawn {Pion}
translate F White {Blancs}
translate F Black {Noirs}
translate F Player {Joueur}
translate F Rating {Classement ELO}
translate F RatingDiff {Difference de classement ELO (Blancs - Noirs)}
translate F Event {vnement}
translate F Site {Lieux}
translate F Country {Pays}
translate F IgnoreColors {Ignorer les couleurs}
translate F Date {Date}
translate F EventDate {vnement date}
translate F Decade {Dcennie}
translate F Year {Anne}
translate F Month {Mois}
translate F Months {Janvier Fvrier Mars Avril Mai Juin
  Juillet Aot Septembre Octobre Novembre Dcembre}
translate F Days {Dim Lun Mar Mer Jeu Ven Sam}
translate F YearToToday {Anne jusqu' aujourd'hui}
translate F Result {Rsultat}
translate F Round {Ronde}
translate F Length {Longueur}
translate F ECOCode {code ECO}
translate F ECO {ECO}
translate F Deleted {limin}
translate F SearchResults {Rsultats de la recherche}
translate F OpeningTheDatabase {Ouverture de la base}
translate F Database {Base}
translate F Filter {Filtre}
translate F noGames {pas de parties}
translate F allGames {toutes les parties}
translate F empty {vide}
translate F clipbase {presse-papier}
translate F score {score}
translate F StartPos {Position de dpart}
translate F Total {Total}

# Game information:
translate F twin {doublon}
translate F deleted {limin}
translate F comment {commentaire}
translate F hidden {cach}
translate F LastMove {Dernier coup}
translate F NextMove {Coup suivant}
translate F GameStart {Dbut de la partie}
translate F LineStart {Dbut de la ligne de jeu}
translate F GameEnd {Fin de la partie}
translate F LineEnd {Fin de la ligne de jeu}

# Player information:
translate F PInfoAll {Rsultats pour <b>toutes</b> les parties}
translate F PInfoFilter {Rsultats pour les parties <b>filtres</b>}
translate F PInfoAgainst {Rsultats contre}
translate F PInfoMostWhite {Ouvertures les plus frquentes avec les blancs}
translate F PInfoMostBlack {Ouvertures les plus frquentes avec les noirs}
translate F PInfoRating {Historique du classement}
translate F PInfoBio {Biographie}

# Tablebase information:
translate F Draw {Nulle}
translate F stalemate {pat}
translate F withAllMoves {avec tous les coups}
translate F withAllButOneMove {avec tous les coups sauf le dernier}
translate F with {avec}
translate F only {seulement}
translate F lose {perte}
translate F loses {pertes}
translate F allOthersLose {toutes les autres pertes}
translate F matesIn {mat en}
translate F hasCheckmated {a mat}
translate F longest {le plus long}

# Tip of the day:
translate F Tip {Conseil}
translate F TipAtStartup {Conseil au dmarrage}

# Tree window menus:
menuText F TreeFile "Fichier" 0
menuText F TreeFileSave "Sauver le cache" 0
menuText F TreeFileFill "Remplir le cache" 0
menuText F TreeFileBest "Liste des meilleures parties" 0 {Montrer la liste des meilleures parties}
menuText F TreeFileGraph "Graphique" 0
menuText F TreeFileCopy "Copier l'arbre dans le presse-papiers" 0
menuText F TreeFileClose "Fermer la fentre d'arbre" 0
menuText F TreeSort "Trier" 0
menuText F TreeSortAlpha "Alphabetique" 0
menuText F TreeSortECO "code ECO" 0
menuText F TreeSortFreq "Frquence" 0
menuText F TreeSortScore "Score" 0
menuText F TreeOpt "Options" 0
menuText F TreeOptLock "Verrouille" 0 {D/verrouiller l'arbre  la base en cours}
menuText F TreeOptTraining "Entrainement" 0 {Dmarrer/Arrter l'arbre du mode d'entrainement}
menuText F TreeOptAutosave "Sauver le cache automatiquement" 0
menuText F TreeHelp "Aide" 0
menuText F TreeHelpTree "Aide Arbre" 0
menuText F TreeHelpIndex "Index" 0
translate F SaveCache {Sauver le cache}
translate F Training {Entrainement}
translate F LockTree {Verrouiller}
translate F TreeLocked {verrouill}
translate F TreeBest {Meilleur}
translate F TreeBestGames {Arbre des meilleures parties}

# Finder window:
menuText F FinderFile "Fichier" 0
menuText F FinderFileSubdirs "Rechercher dans les sous rpertoires" 0
menuText F FinderFileClose "Fermer l'explorateur de fichiers" 0
menuText F FinderSort "Trier" 0
menuText F FinderSortType "Type" 0
menuText F FinderSortSize "Taille" 0
menuText F FinderSortMod "Modifi" 0
menuText F FinderSortName "Nom" 0
menuText F FinderSortPath "Chemin" 0
menuText F FinderTypes "Types" 0
menuText F FinderTypesScid "Bases Scid" 0
menuText F FinderTypesOld "Bases Scid  l'ancien format" 0
menuText F FinderTypesPGN "fichiers PGN" 0
menuText F FinderTypesEPD "fichiers EPD (thorie)" 0
menuText F FinderTypesRep "fichiers des rpertoires" 0
menuText F FinderHelp "Aide" 0
menuText F FinderHelpFinder "Aide de l'explorateur de fichiers" 0
menuText F FinderHelpIndex "Index" 0
translate F FileFinder {Explorateur de fichiers}
translate F FinderDir {Rpertoire}
translate F FinderDirs {Rpertoires}
translate F FinderFiles {Fichiers}
translate F FinderUpDir {rpertoire prcdent}

# Tournament finder:
menuText F TmtFile "Fichier" 0
menuText F TmtFileUpdate "Mettre  jour" 0
menuText F TmtFileClose "Fermer l'explorateur de tournois" 0
menuText F TmtSort "Trier" 0
menuText F TmtSortDate "Date" 0
menuText F TmtSortPlayers "Joueurs" 0
menuText F TmtSortGames "Parties" 0
menuText F TmtSortElo "Elo" 0
menuText F TmtSortSite "Lieux" 0
menuText F TmtSortEvent "vnement" 1
menuText F TmtSortWinner "Vainqueur" 0
translate F TmtLimit "Limite de liste"
translate F TmtMeanElo "Moyenne ELO la plus basse"
translate F TmtNone "Aucun tournoi correspondant n'a t trouv."

# Graph windows:
menuText F GraphFile "Fichier" 0
menuText F GraphFileColor "Sauver comme Postscript en couleurs..." 27
menuText F GraphFileGrey "Sauver comme Postscript en niveaux de gris..." 27
menuText F GraphFileClose "Fermer la fentre" 0
menuText F GraphOptions "Options" 0
menuText F GraphOptionsWhite "Blancs" 0
menuText F GraphOptionsBlack "Noirs" 0
menuText F GraphOptionsBoth "Les deux" 4
menuText F GraphOptionsPInfo "Informations joueurs" 0
translate F GraphFilterTitle "Graphique de filtre: frquence pour 1000 parties"

# Analysis window:
translate F AddVariation {Ajouter une variante}
translate F AddMove {Ajouter le coup}
translate F Annotate {Annotation}
translate F AnalysisCommand {Commande d'analyse}
translate F PreviousChoices {Choix prcdents}
translate F AnnotateTime {Fixer le temps en secondes entre deux coups}
translate F AnnotateWhich {Ajouter des variantes}
translate F AnnotateAll {Pour les coups des deux cots}
translate F AnnotateWhite {Pour les coups des blancs seulement}
translate F AnnotateBlack {Pour les coups des noirs seulement}
translate F AnnotateNotBest {Quand le coup de la partie n'est pas le meilleur}

# Analysis Engine open dialog:
translate F EngineList {Liste des moteurs d'analyse}
translate F EngineName {Nom}
translate F EngineCmd {Commande}
translate F EngineArgs {Paramtres}
translate F EngineDir {Rpertoire}
translate F EngineElo {Elo}
translate F EngineTime {Date}
translate F EngineNew {Nouvelle}
translate F EngineEdit {diter}
translate F EngineRequired {Les champs en gras sont requis; les autres sont optionnels}

# Stats window menus:
menuText F StatsFile "Fichier" 0
menuText F StatsFilePrint "crire dans fichier..." 0
menuText F StatsFileClose "Fermer la fentre" 0
menuText F StatsOpt "Options" 0

# PGN window menus:
menuText F PgnFile "Fichier" 0
menuText F PgnFilePrint "crire dans fichier..." 0
menuText F PgnFileClose "Fermer la fentre PGN" 0
menuText F PgnOpt "Affichage" 0
menuText F PgnOptColor "Couleur d'affichage" 0
menuText F PgnOptShort "Entte court (3-lignes)" 0
menuText F PgnOptSymbols "Annotations symboliques" 0
menuText F PgnOptIndentC "Indentation des commentaires" 0
menuText F PgnOptIndentV "Indentation des variantes" 16
menuText F PgnOptColumn "Style en colonne (un coup par ligne)" 1
menuText F PgnOptSpace "Espace aprs numro des coups" 0
menuText F PgnOptStripMarks "Enlever les codes de flches et de coloration de cases" 1
menuText F PgnColor "Couleur" 0
menuText F PgnColorHeader "Entte..." 0
menuText F PgnColorAnno "Annotations..." 0
menuText F PgnColorComments "Commentaires..." 0
menuText F PgnColorVars "Variantes..." 0
menuText F PgnColorBackground "Couleur du fond..." 11
menuText F PgnHelp "Aide" 0
menuText F PgnHelpPgn "Aide PGN" 0
menuText F PgnHelpIndex "Index" 0

# Crosstable window menus:
menuText F CrosstabFile "Fichier" 0
menuText F CrosstabFileText "crire dans un fichier texte..." 23
menuText F CrosstabFileHtml "crire dans un fichier HTML..." 23
menuText F CrosstabFileLaTeX "crire dans un fichier LaTeX..." 23
menuText F CrosstabFileClose "Fermer fentre tableau" 0
menuText F CrosstabEdit "diter" 0
menuText F CrosstabEditEvent "vnement" 0
menuText F CrosstabEditSite "Lieux" 0
menuText F CrosstabEditDate "Date" 0
menuText F CrosstabOpt "Affichage" 0
menuText F CrosstabOptAll "Toutes rondes" 0
menuText F CrosstabOptSwiss "Suisse" 0
menuText F CrosstabOptKnockout "Knockout" 0
menuText F CrosstabOptAuto "Auto" 0
menuText F CrosstabOptAges "Ages en annes" 8
menuText F CrosstabOptNats "Nationalits" 0
menuText F CrosstabOptRatings "Classements" 0
menuText F CrosstabOptTitles "Titres" 0
menuText F CrosstabOptBreaks "Scores du dpartage" 4
menuText F CrosstabOptDeleted "Inclure les parties effaces" 8
menuText F CrosstabOptColors "Couleurs (systme suisse uniquement)" 1
menuText F CrosstabOptColumnNumbers "Colonnes numrotes (Toutes rondes seulement)" 2
menuText F CrosstabOptGroup "Scores du groupe" 0
menuText F CrosstabSort "Trier" 0
menuText F CrosstabSortName "Nom" 0
menuText F CrosstabSortRating "Elo" 0
menuText F CrosstabSortScore "Score" 0
menuText F CrosstabColor "Couleur" 0
menuText F CrosstabColorPlain "Texte normal" 0
menuText F CrosstabColorHyper "Hypertexte" 0
menuText F CrosstabHelp "Aide" 0
menuText F CrosstabHelpCross "Aide tableau" 0
menuText F CrosstabHelpIndex "Index" 0
translate F SetFilter {Activer le filtre}
translate F AddToFilter {Ajouter au filtre}
translate F Swiss {Suisse}

# Opening report window menus:
menuText F OprepFile "Fichier" 0
menuText F OprepFileText "crire dans un fichier texte..." 23
menuText F OprepFileHtml "crire dans un fichier HTML..." 23
menuText F OprepFileLaTeX "crire dans un fichier LaTeX..." 23
menuText F OprepFileOptions "Options..." 0
menuText F OprepFileClose "Fermer la fentre du rapport" 0
menuText F OprepHelp "Aide" 0
menuText F OprepHelpReport "Aide du rapport" 0
menuText F OprepHelpIndex "Index" 0

# Repertoire editor:
menuText F RepFile "Fichier" 0
menuText F RepFileNew "Nouvelle" 0
menuText F RepFileOpen "Ouvrir..." 0
menuText F RepFileSave "Sauver..." 0
menuText F RepFileSaveAs "Sauver sous..." 5
menuText F RepFileClose "Fermer" 0
menuText F RepEdit "diter" 0
menuText F RepEditGroup "Ajouter Groupe" 4
menuText F RepEditInclude "Ajouter Inclure ligne" 4
menuText F RepEditExclude "Ajouter Exclure ligne" 4
menuText F RepView "Voir" 0
menuText F RepViewExpand "tends tous les groupes" 0
menuText F RepViewCollapse "Fermer tous les groupes" 0
menuText F RepSearch "Rechercher" 0
menuText F RepSearchAll "Tout le rpertoire..." 0
menuText F RepSearchDisplayed "Afficher seulement les lignes..." 0
menuText F RepHelp "Aide" 0
menuText F RepHelpRep "Aide sur le rpertoire" 0
menuText F RepHelpIndex "Index" 0
translate F RepSearch "Rechercher dans le rpertoire"
translate F RepIncludedLines "lignes inclues"
translate F RepExcludedLines "lignes exclues"
translate F RepCloseDialog {Ce rpertoire a des modifications non enregistres.

Voulez vous rellement continuer et ne pas tenir compte des changements que vous avez effectu?
}

# Header search:
translate F HeaderSearch {Rechercher Entte}
translate F GamesWithNoECO {Partie sans code ECO?}
translate F GameLength {Longueur de la partie}
translate F FindGamesWith {Chercher les parties avec}
translate F StdStart {Position initiale standard}
translate F Promotions {Promotions}
translate F Comments {Commentaires}
translate F Variations {Variantes}
translate F Annotations {Annotations}
translate F DeleteFlag {Marques supprimes}
translate F WhiteOpFlag {Ouverture des blancs}
translate F BlackOpFlag {Ouverture des noirs}
translate F MiddlegameFlag {Milieu de partie}
translate F EndgameFlag {Finale}
translate F NoveltyFlag {Nouveaut}
translate F PawnFlag {Structure de pions}
translate F TacticsFlag {Tactiques}
translate F QsideFlag {Jeu  l'aile dame}
translate F KsideFlag {Jeu  l'aile roi}
translate F BrilliancyFlag {Spectaculaire}
translate F BlunderFlag {Gaffe}
translate F UserFlag {Utilisateur}
translate F PgnContains {PGN contenant du texte}

# Game list window:
translate F GlistNumber {Numro}
translate F GlistWhite {Blancs}
translate F GlistBlack {Noirs}
translate F GlistWElo {B-Elo}
translate F GlistBElo {N-Elo}
translate F GlistEvent {vnement}
translate F GlistSite {Lieux}
translate F GlistRound {Ronde}
translate F GlistDate {Date}
translate F GlistYear {Anne}
translate F GlistEDate {vnement-Date}
translate F GlistResult {Rsultat}
translate F GlistLength {Longueur}
translate F GlistCountry {Pays}
translate F GlistECO {ECO}
translate F GlistOpening {Ouverture}
translate F GlistEndMaterial {Matriel final}
translate F GlistDeleted {Effac}
translate F GlistFlags {Drapeaux}
translate F GlistVars {Variantes}
translate F GlistComments {Commentaires}
translate F GlistAnnos {Annotations}
translate F GlistStart {Dpart}
translate F GlistGameNumber {Partie numro}
translate F GlistFindText {Rechercher texte}
translate F GlistMoveField {Coup}
translate F GlistEditField {Configurer}
translate F GlistAddField {Ajouter}
translate F GlistDeleteField {Enlever}
translate F GlistWidth {Largeur}
translate F GlistAlign {Aligner}
translate F GlistColor {Couleur}
translate F GlistSep {Sparateur}

# Maintenance window:
translate F DatabaseName {Nom de base:}
translate F TypeIcon {Type icne:}
translate F NumOfGames {Parties:}
translate F NumDeletedGames {Parties supprimes:}
translate F NumFilterGames {Parties dans le filtre:}
translate F YearRange {Annes:}
translate F RatingRange {Classements:}
translate F Flag {Drapeau}
translate F DeleteCurrent {Effacer la partie courante}
translate F DeleteFilter {Effacer le filtre de parties}
translate F DeleteAll {Effacer toutes les parties}
translate F UndeleteCurrent {Rcuprer la partie en cours}
translate F UndeleteFilter {Rcuprer les parties filtres}
translate F UndeleteAll {Rcuprer toutes les parties}
translate F DeleteTwins {Effacer les parties en doublon}
translate F MarkCurrent {Slectionner la partie en cours}
translate F MarkFilter {Slectionner les parties filtres}
translate F MarkAll {Slectionner toutes les parties}
translate F UnmarkCurrent {Dslectionner la partie en cours}
translate F UnmarkFilter {Dslectionner les parties filtres}
translate F UnmarkAll {Dslectionner toutes les parties}
translate F Spellchecking {Vrification orthographique}
translate F Players {Joueurs}
translate F Events {vnements}
translate F Sites {Lieux}
translate F Rounds {Rondes}
translate F DatabaseOps {Oprations sur la base}
translate F ReclassifyGames {ECO-Classifier les parties...}
translate F CompactDatabase {Compacter la base}
translate F SortDatabase {Trier la base}
translate F AddEloRatings {Ajouter les classements Elo}
translate F AutoloadGame {Chargement automatique du numro de partie}
translate F StripTags {Enlever les marqueurs PGN}
translate F StripTag {Enlever les marqueurs}
translate F Cleaner {Nettoyer}
translate F CleanerHelp {
Le Nettoyeur Scid va raliser pour la base en cours toutes les actions de maintenance que vous avez slectionn  partir de la liste ci-dessous.

Les rglages en cours de la classification ECO et les dialogues d'effacement des jumeaux vont s'appliquer si vous avez slectionn ces fonctions.
}
translate F CleanerConfirm {
Une fois que le nettoyage est commenc, il ne peut tre interrompu!

Cela peut prendre beaucoup de temps sur une grande base, suivant les fonctions que vous avez slectionn et leurs rglages en cours.

Etes vous sr que vous voulez commencer les fonctions de maintenance que vous avez slectionn?
}

# Comment editor:
translate F AnnotationSymbols {Symboles d'annotation:}
translate F Comment {Commentaire:}

# Board search:
translate F BoardSearch {Rechercher Position}
translate F FilterOperation {Opration sur le filtre en cours:}
translate F FilterAnd {ET (Restreint le filtre)}
translate F FilterOr {OU (Ajouter au filtre)}
translate F FilterIgnore {IGNORER (Restaure le filtre initial)}
translate F SearchType {Type de recherche:}
translate F SearchBoardExact {Position exacte (mmes pices sur les mmes cases)}
translate F SearchBoardPawns {Pions (mme matriel, tous les pions sur les mmes cases)}
translate F SearchBoardFiles {Colonnes (mme matriel, tous les pions dans le mme fichier)}
translate F SearchBoardAny {Tous (mme matriel, pions et pices n'importe o)}
translate F LookInVars {Chercher dans les variantes}

# Material search:
translate F MaterialSearch {Rechercher Motifs}
translate F Material {Matriel}
translate F Patterns {Motifs}
translate F Zero {Zro}
translate F Any {Tout}
translate F CurrentBoard {Position en cours}
translate F CommonEndings {Finales}
translate F CommonPatterns {Motifs}
translate F MaterialDiff {Diffrence en matriel}
translate F squares {cases}
translate F SameColor {Mmes couleur}
translate F OppColor {Couleurs opposes}
translate F Either {Les deux}
translate F MoveNumberRange {Dplacer de X coups}
translate F MatchForAtLeast {Correspond  la dernire}
translate F HalfMoves {demi-coups}

# Game saving:
translate F Today {Aujourd'hui}
translate F ClassifyGame {Classer la partie}

# Setup position:
translate F EmptyBoard {Vider l'chiquier}
translate F InitialBoard {R-initiliser l'chiquier}
translate F SideToMove {Cot qui a le trait}
translate F MoveNumber {Coup numero}
translate F Castling {Roque}
translate F EnPassentFile {Prise en passent}
translate F ClearFen {Effacer FEN}
translate F PasteFen {Coller FEN}

# Replace move dialog:
translate F ReplaceMove {Remplacer le coup}
translate F AddNewVar {Ajouter variante}
translate F ReplaceMoveMessage {Un coup existe dj.

Vous pouvez le remplacer, ou bien dtruire tous les coups aprs ce coup ou ajouter une nouvelle variante.

(Vous pouvez demander  ne plus voir ce message  l'avenir, en dslectionnant l'option "Demander avant de remplacer le coup" dans le menu des options)}

# Make database read-only dialog:
translate F ReadOnlyDialog {Si vous mettez cette base en lecture seule, aucun changement ne sera permis.
Aucune partie ne peut tre sauve ou remplace, et aucun drapeau d'effacement ne peut tre altr.
Tout les tris ou les rsultats de classification ECO seront temporaires.

Vous pouvez facilement rendre la base  nouveau accesible en ccriture, en la fermant et en l'ouvrant  nouveau.

Voulez vous vraiment passer cette base en lecture seule?}

# Clear game dialog:
translate F ClearGameDialog {Cette partie a t modifie.

Voulez vous vraiment continuer et ignorer les changements effectus?
}

# Exit dialog:
translate F ExitDialog {Voulez vous rellement quitter Scid?}
translate F ExitUnsaved {Les bases de donnes suivantes ont des parties modifies non sauvegardes. Si vous quittez maintenant, ces modifications seront perdues.}

# Import window:
translate F PasteCurrentGame {Coller la partie courante}
translate F ImportHelp1 {Entrer ou coller une partie au format PGN dans le cadre ci-dessus.}
translate F ImportHelp2 {Toutes les erreurs durant l'import de la partie seront affiches ii.}

# ECO Browser:
translate F ECOAllSections {toutes les sections ECO}
translate F ECOSection {section ECO}
translate F ECOSummary {Rsum pour}
translate F ECOFrequency {Frquence des sous-codes pour}

# Opening Report:
translate F OprepTitle {Rapport sur l'ouverture}
translate F OprepReport {Rapport}
translate F OprepGenerated {Gener par}
translate F OprepStatsHist {Statistiques et Historique}
translate F OprepStats {Statistiques}
translate F OprepStatAll {Toutes les parties du rapport}
translate F OprepStatBoth {Les deux joueurs classs}
translate F OprepStatSince {Depuis}
translate F OprepOldest {Les parties les plus anciennes}
translate F OprepNewest {Les parties les plus rcentes}
translate F OprepPopular {Popularit courante}
translate F OprepFreqAll {Frquence pour toutes les annes: }
translate F OprepFreq1   {Depuis 1 an jusqu' ce jour:      }
translate F OprepFreq5   {Depuis 5 ans jusqu' ce jour:     }
translate F OprepFreq10  {Depuis 10 ans jusqu' ce jour:    }
translate F OprepEvery {une fois toutes les %u parties}
translate F OprepUp {%u%s rencontr pour l'ensemble des annes}
translate F OprepDown {%u%s non rencontr l'ensemble des annes}
translate F OprepSame {sans changement par rapport  l'ensemble des annes}
translate F OprepMostFrequent {Joueurs les plus frquents}
translate F OprepRatingsPerf {Classements et performance}
translate F OprepAvgPerf {Classements moyens et performance}
translate F OprepWRating {Classement des blancs}
translate F OprepBRating {Classement des noirs}
translate F OprepWPerf {Performance des blancs}
translate F OprepBPerf {Performance des noirs}
translate F OprepHighRating {Parties avec le classement moyen le plus lev}
translate F OprepTrends {Tendances de rsultat}
translate F OprepResults {Rsultats longueurs et frquences}
translate F OprepLength {Longueur de partie}
translate F OprepFrequency {Frquence}
translate F OprepWWins {Gains blancs: }
translate F OprepBWins {Gains noirs:  }
translate F OprepDraws {Nulles:       }
translate F OprepWholeDB {base complte}
translate F OprepShortest {Gains les plus rapides}
translate F OprepMovesThemes {Coups et Thmes}
translate F OprepMoveOrders {Ordres de coups atteignant la position du rapport}
translate F OprepMoveOrdersOne \
  {Il n'y a qu'un seul ordre de coups pour atteindre cette position:}
translate F OprepMoveOrdersAll \
  {Il y a %u ordres de coups pour atteindre cette position:}
translate F OprepMoveOrdersMany \
  {Il y a %u ordres de coups pour atteindre cette position. Les %u premiers sont:}
translate F OprepMovesFrom {Coups depuis la position du rapport}
translate F OprepThemes {Thmes positionnels}
translate F OprepThemeDescription {Frquence des thmes au coup %u}
translate F OprepThemeSameCastling {Roques du mme ct}
translate F OprepThemeOppCastling {Roques du ct oppos}
translate F OprepThemeNoCastling {Aucun roque}
translate F OprepThemeKPawnStorm {Avalanche de pions  l'aile roi}
translate F OprepThemeQueenswap {Dames changes}
translate F OprepThemeIQP {Pion Dame isol}
translate F OprepThemeWP567 {Pion blanc sur la 5/6/7e range}
translate F OprepThemeBP234 {Pion noir sur la 2/3/4e range}
translate F OprepThemeOpenCDE {Colonne c/d/e ouverte}
translate F OprepTheme1BishopPair {Paire de fous}
translate F OprepEndgames {Finales}
translate F OprepReportGames {Les parties du rapport}
translate F OprepAllGames {Toutes les parties}
translate F OprepEndClass {Classification du matriel des positions finales}
translate F OprepTheoryTable {Table de Thorie}
translate F OprepTableComment {Gnr  partir des %u parties au classement le plus lev.}
translate F OprepExtraMoves {Nombre de coups additionnels dans la table de thorie}
translate F OprepMaxGames {Nombre maximum de parties dans la table de thorie}

# Piece Tracker window:
translate F TrackerSelectSingle {Le bouton gauche de la souris slectionne cette pice.}
translate F TrackerSelectPair {Le bouton gauche de la souris slectionne cette piece; le bouton droit slectionne aussi son pendant.}
translate F TrackerSelectPawn {Le bouton gauche de la souris slectionne ce pion ; le bouton droit slectionne les 8 pions.}
translate F TrackerStat {Statistiques}
translate F TrackerGames {% parties avec dplacement sur la case}
translate F TrackerTime {% fois sur chaque case}
translate F TrackerMoves {Coups}
translate F TrackerMovesStart {Entrer le numro du coups  partir duquel la recherche doit commencer.}
translate F TrackerMovesStop {Entrer le numro du coups auquel la recherche doit s'arrter.}

# Game selection dialogs:
translate F SelectAllGames {Toutes les parties de la base}
translate F SelectFilterGames {Seulement les parties du filtre}
translate F SelectTournamentGames {Seulement les parties du tournoi courant}
translate F SelectOlderGames {Seulement les parties plus anciennes}

# Delete Twins window:
translate F TwinsNote {Pour tre considres comme doublons, deux parties doivent au moins avoir les deux mmes joueurs, et avoir les critres que vous pouvez fixer ci-dessous satisfaits. Quand une paire de doublons est trouve, la partie la plus courte est fface.
Conseil: il est prfrable de vrifier l'orthographe dans la base avant d'effacer les doublons, car cela amliore la dtection des doublons. }
translate F TwinsCriteria {Critre: Les doublons doivent avoir...}
translate F TwinsWhich {Parties  examiner}
translate F TwinsColors {Mme couleurs de joueurs?}
translate F TwinsEvent {Mme vnement?}
translate F TwinsSite {Mme lieu?}
translate F TwinsRound {Mme ronde?}
translate F TwinsYear {Mme anne?}
translate F TwinsMonth {Mme mois?}
translate F TwinsDay {Mme jour?}
translate F TwinsResult {Mme rsultat?}
translate F TwinsECO {Mme code ECO?}
translate F TwinsMoves {Mmes coups?}
translate F TwinsPlayers {Comparaison des noms des joueurs:}
translate F TwinsPlayersExact {Correspondance exacte}
translate F TwinsPlayersPrefix {Les 4 premires lettres seules}
translate F TwinsWhen {En effaant les doublons}
translate F TwinsSkipShort {Ignorer toutes les parties de moins de cinq coups?}
translate F TwinsUndelete {Rcuprer toutes les parties d'abord?}
translate F TwinsSetFilter {Appliquer le filtre  tous les doublons limins?}
translate F TwinsComments {Toujours garder les parties qui comportent des commentaires?}
translate F TwinsVars {Toujours garder les parties qui comportent des variantes?}
translate F TwinsDeleteWhich {Partie  effacer:}
translate F TwinsDeleteShorter {La partie la plus courte}
translate F TwinsDeleteOlder {La partie avec le plus petit numro}
translate F TwinsDeleteNewer {La partie avec le plus grand numro}
translate F TwinsDelete {Effacer les parties}

# Name editor window:
translate F NameEditType {Taper le nom  diter}
translate F NameEditSelect {Parties  diter}
translate F NameEditReplace {Remplacer}
translate F NameEditWith {avec}
translate F NameEditMatches {Correspondances: Presser Alt+1  Alt+9 pour slectionner}

# Classify window:
translate F Classify {Classer}
translate F ClassifyWhich {Choix des parties  classer suivant ECO}
translate F ClassifyAll {Toutes les parties (crase les ancients codes ECO)}
translate F ClassifyYear {Toutes les parties joues la dernire anne}
translate F ClassifyMonth {Toutes les parties joues le dernier mois}
translate F ClassifyNew {Seulement les parties qui ne possdent pas encore de code ECO}
translate F ClassifyCodes {Codes ECO  utiliser}
translate F ClassifyBasic {Codes de base seulement ("B12", ...)}
translate F ClassifyExtended {Extensions de Scid ("B12j", ...)}

# Compaction:
translate F NameFile {Fichier de noms}
translate F GameFile {Fichier de parties}
translate F Names {Noms}
translate F Unused {Non utilis}
translate F SizeKb {Taille (kb)}
translate F CurrentState {tat courant}
translate F AfterCompaction {Aprs compactage}
translate F CompactNames {Compacter le fichier de noms}
translate F CompactGames {Compacter le fichier de parties}

# Sorting:
translate F SortCriteria {Critre}
translate F AddCriteria {Ajouter un critre}
translate F CommonSorts {Tris courants}
translate F Sort {Tri}

# Exporting:
translate F AddToExistingFile {Ajouter les parties  un fichier existant?}
translate F ExportComments {Exporter les commentaires?}
translate F ExportVariations {Exporter les variantes?}
translate F IndentComments {Indenter les commentaires?}
translate F IndentVariations {Indenter les variantes?}
translate F ExportColumnStyle {Style en colonne (un coup par ligne)?}
translate F ExportSymbolStyle {Style d'annotation symbolique:}
translate F ExportStripMarks {Enlever les codes de marquages de flches et de coloration de cases des commentaires?}

# Goto game/move dialogs:
translate F LoadGameNumber {Entrer le numro de la partie  charger:}
translate F GotoMoveNumber {Aller au coup numro:}

# Copy games dialog:
translate F CopyGames {Copier les parties}
translate F CopyConfirm {
 Voulez vous vraiment copier
 les [thousands $nGamesToCopy] parties filtres
 depuis la base "$fromName"
 vers la base "$targetName"?
}
translate F CopyErr {Ne peut copier les parties}
translate F CopyErrSource {la base source}
translate F CopyErrTarget {la base destination}
translate F CopyErrNoGames {n'a pas de parties dans son filtre}
translate F CopyErrReadOnly {est en lecture seule}
translate F CopyErrNotOpen {n'est pas ouverte}

# Colors:
translate F LightSquares {Cases blanches}
translate F DarkSquares {Cases noires}
translate F SelectedSquares {Cases slectionnes}
translate F SuggestedSquares {Cases des coups suggrs}
translate F WhitePieces {Pieces blanches}
translate F BlackPieces {Pieces noires}
translate F WhiteBorder {Bordure des pices blanches}
translate F BlackBorder {Bordure des pices noires}

# Novelty window:
translate F FindNovelty {Trouver la nouveaut}
translate F Novelty {Nouveaut}
translate F NoveltyInterrupt {Recherche de nouveaut interrompue}
translate F NoveltyNone {Aucune nouveaut n'a t trouve pour cette partie}
translate F NoveltyHelp {
Scid va trouver le premier coup de la partie en cours qui atteint une position qui ne figure ni dans la base slectionne ni dans le rpertoire d'ouvertures ECO.
}

# Upgrading databases:
translate F Upgrading {Mise  jour}
translate F ConfirmOpenNew {
Ceci est une base de donnes  l'ancien format (Scid 2) qui ne peut tre ouverte dans Scid 3, mais une version au nouveau format (Scid 3) a dj t cre.

Voulez vous ouvrir le nouveau format de la base de donnes?
}
translate F ConfirmUpgrade {
Ceci est une base de donnes  l'ancien format (Scid 2). Une version de la base de donnes au nouveau format doit tre cre avant de pouvoir tre utilise dans Scid 3.

Mettre  jour va crer une nouvelle version de la base de donnes; les fichiers originaux ne seront pas dits ou effacs.

Cela peut prendre un peu de temps, mais il n'est ncessaire de le faire qu'une fois. Vous pouvez abandonner si cela dure trop longtemps.

Voulez vous mettre  jour cette base de donnes maintenant?
}

# Recent files options:
translate F RecentFilesMenu {Number of recent files in File menu} ;# ***
translate F RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# end of francais.tcl
### italian.tcl:
# Italian language support for Scid.
# Added by Giancarlo Bassi.
# Updated by Paolo Montrasi.
# Untranslated messages are marked with a "***" comment.

addLanguage I Italian 0

proc setLanguage_I {} {

# File menu:
menuText I File "File" 0
menuText I FileNew "Nuovo..." 0 {Crea un nuovo database Scid}
menuText I FileOpen "Apri..." 0 {Apre un database Scid esistente}
menuText I FileClose "Chiudi" 0 {Chiude un database Scid attivo}
menuText I FileFinder "Finder" 0 {Apre la finestra per cercare i file}
menuText I FileBookmarks "Bookmarks" 0 {Menu' Bookmarks (chiave: Ctrl+B)}
menuText I FileBookmarksAdd "Aggiungi bookmark" 0 \
  {memorizza la partita e la posizione del database attivo}
menuText I FileBookmarksFile "Memorizza bookmark" 0 \
  {Memorizza un bookmark per la partita e posizione corrente}
menuText I FileBookmarksEdit "Modifica bookmarks..." 0 \
  {Modifica il menu' dei bookmarks memorizzati}
menuText I FileBookmarksList "Mostra i bookmark come una lista" 0 \
  {Mostra le cartelle dei bookmarks come una lista, senza sottomenu'}
menuText I FileBookmarksSub "Mostra i bookmark come sottomenu'" 0 \
  {Mostra le cartelle dei bookmarks con sottomenu', non a lista}
menuText I FileMaint "Gestione" 0 {Strumenti di gestione di un database Scid}
menuText I FileMaintWin "Finestra di Gestione" 0 \
  {Apre/chiude la finestra di gestione di un database Scid}
menuText I FileMaintCompact "Compatta database..." 0 \
  {Compatta i file di database, rimuovendo le partite cancellate e i nomi non usati}
menuText I FileMaintClass "Classificazione ECO di partite..." 2 \
  {Ricalcola il codice ECO di tutte le partite}
menuText I FileMaintSort "Ordina database..." 0 \
  {Ordina tutte le partite nel database}
menuText I FileMaintDelete "Cancella le partite doppie..." 20 \
  {Cerca le partite duplicate e le seleziona per cancellarle}
menuText I FileMaintTwin "Finestra di controllo delle doppie" 0 \
  {Apre/aggiorna la finestra del controllo dei duplicati}
menuText I FileMaintName "Controllo di nomi" 13 {Editor di nomi e controllo ortografico}
menuText I FileMaintNameEditor "Finestra di editor dei nomi" 0 \
  {Apre/chiude la finestra di editor dei nomi}
menuText I FileMaintNamePlayer "Controllo di nomi dei giocatori..." 22 \
  {Controllo di nomi dei giocatori mediante il file di verifica di nomi}
menuText I FileMaintNameEvent "Controllo di nomi di Eventi..." 21 \
  {Controllo di nomi dei eventi mediante il file di verifica di eventi}
menuText I FileMaintNameSite "Controllo di nomi di siti..." 21 \
  {Controllo di nomi di siti mediante il file di verifica}
menuText I FileMaintNameRound "Controllo di nomi di turni..." 21 \
  {Controllo di nomi di turni mediante il file di verifica}
menuText I FileReadOnly "Sola-lettura..." 0 \
  {Tratta il database attuale in sola lettura, prevenendo variazioni}
menuText I FileExit "Esci" 0 {Esce da Scid}

# Edit menu:
menuText I Edit "Edita" 0
menuText I EditAdd "Aggiunge una variante" 0 {Aggiunge una variante a questa mossa nella partita}
menuText I EditDelete "Cancella Variante" 0 {Cancella una variante per questa mossa}
menuText I EditFirst "Variante principale" 5 \
  {Promuove a variante principale nella lista}
menuText I EditMain "Promuove una Variante a Linea Principale" 0 \
  {Promuove una variante a linea principale}
menuText I EditTrial "Prova una variante" 0 \
  {Attiva/disattiva la modalita' di prova di una variante, per provare idee direttamente sulla scacchiera}
menuText I EditStrip "Pulisci" 2 {Elimina commenti o varianti dalla partita corrente}
menuText I EditStripComments "Commenti" 0 \
  {Elimina tutti i commenti e le annotazioni dalla parita corrente}
menuText I EditStripVars "Varianti" 0 {Elimina tutte le varianti dalla partita corrente}
menuText I EditReset "Vuota la Clipbase" 0 \
  {Svuota completamente la clipbase}
menuText I EditCopy "Copia questa partita nella Clipbase" 1 \
  {Copia questa partita nella clipbase}
menuText I EditPaste "Incolla l'ultima partita nella Clipbase" 0 \
  {Incolla qui la partita della clipbase}
menuText I EditSetup "Posizione definita..." 10 \
  {Definisce una posizione per la partita corrente}
menuText I EditPasteBoard "Incolla come posizione di partenza" 12 \
  {Imposta la posizione di partenza dalla selezione del testo corrente (clipboard)}

# Game menu:
menuText I Game "Partita" 0
menuText I GameNew "Annulla partita" 0 \
  {Torna alla posizione iniziale, rinunciando ai cambiamenti}
menuText I GameFirst "Carica la prima Partita" 13 {Carica la prima partita filtrata}
menuText I GamePrev "Carica la precedente Partita" 10 {Carica la precedente partita filtrata}
menuText I GameReload "Ricarica la Partita attuale" 0 \
  {Ricarica questa partita, eliminando ogni cambiamento eseguito}
menuText I GameNext "Carica la successiva Partita" 10 {Carica il successivo filtro di partite}
menuText I GameLast "Carica l'ultima partita" 9 {Carica l'ultima partita filtrata}
menuText I GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText I GameNumber "Carica la partita numero..." 18 \
  {Carica una partita digitando il suo numero}
menuText I GameReplace "Salva: Sostituisce la partita..." 8 \
  {Salva questa partita, sostituendo la vecchia versione}
menuText I GameAdd "Save: Aggiunge la nuova partita..." 7 \
  {Salva questa partita come nuova partita nel database}
menuText I GameDeepest "Identifica apertura" 0 \
  {Va' alla posizione di partita piu' profonda listata nel libro ECO}
menuText I GameGotoMove "Vai alla mossa numero..." 0 \
  {Va' al numero di mossa specificato nella partita attuale}
menuText I GameNovelty "Trova Novita'..." 7 \
  {Cerca la prima mossa mai giocata della partita corrente}

# Search Menu:
menuText I Search "Cerca" 0
menuText I SearchReset "Annulla il filtro" 0 {Annulla il filtro per includere tutte le partite}
menuText I SearchNegate "Filtro Negato" 0 {Nega il filtro per comprendere solo partite escluse}
menuText I SearchCurrent "Posizione attuale..." 0 {Cerca la attuale posizione}
menuText I SearchHeader "Intestazione..." 0 {Ricerca per intestazione (giocatore, evento, etc)}
menuText I SearchMaterial "Materiale/Schema..." 0 {Ricerca per materiale o schema posizionale}
menuText I SearchUsing "Uso del file di ricerca..." 0 {Ricerca mediante un file di Opzioni}

# Windows menu:
menuText I Windows "Finestre" 2
menuText I WindowsComment "Editor di commenti" 10 {Apre/chiude l'editor di commenti}
menuText I WindowsGList "Lista di Partite" 0 {Apre/chiude la finestra di lista di partite}
menuText I WindowsPGN "Finestra PGN" 9 {Apre/chiude la finestra PGN (notazione di partita)}
menuText I WindowsTmt "Tournament Finder" 2 {Open/close the tournament finder} ;# ***
menuText I WindowsSwitcher "Scambio di Database" 11 {Apre/chiude la finestra di scambio di Database}
menuText I WindowsMaint "Finestra di gestione" 12 {Apre/chiude la finestra di gestione}
menuText I WindowsECO "Navigazione ECO" 12 {Apre/chiude la finestra di navigazione ECO}
menuText I WindowsRepertoire "Editor di repertorio" 10 \
  {Apre/chiude l'editor di repertorio di apertura}
menuText I WindowsStats "Finestra di statistica" 12 {Apre/chiude la finestra di filtro statistico}
menuText I WindowsTree "Finestra di albero" 12 {Apre/chiude la finestra di albero}
menuText I WindowsTB "Finestra di Tablebase di finale" 12 \
  {Apre/chiude la finestra Tablebase}

# Tools menu:
menuText I Tools "Strumenti" 0
menuText I ToolsAnalysis "Motore di analisi..." 10 \
  {Inizia/termina il motore di analisi scacchistica}
menuText I ToolsAnalysis2 "Motore di analisi #2..." 19 \
  {Inizia/termina il motore di analisi scacchistica}
menuText I ToolsCross "Tabella" 0 {Mostra la tabella di torneo per questa partita}
menuText I ToolsEmail "Gestione Email" 10 \
  {Apre/chiude la finestra di gestione di partite per posta elettronica}
menuText I ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText I ToolsOpReport "Rapporto di Apertura" 0 \
  {Genera un rapporto di apertura per l'attuale posizione}
menuText I ToolsTracker "Piece Tracker"  0 {Open the Piece Tracker window} ;# ***
menuText I ToolsPInfo "Informazioni sul giocatore"  17 \
  {Apre/agiorna la finestra di Informazione del giocatore}
menuText I ToolsRating "Grafico del punteggio Elo" 24 \
  {Grafico storico del punteggio Elo dei giocatori della corrente partita}
menuText I ToolsScore "Grafico dei punti" 12 {Nostra la finestra del grafico dei punti}
menuText I ToolsExpCurrent "Esporta la partita attuale" 0 \
  {Scrive la partita attuale in un file di testo}
menuText I ToolsExpCurrentPGN "Esporta partita in un file PGN..." 15 \
  {Scrive la partita attuale in un file PGN}
menuText I ToolsExpCurrentHTML "Esporta partita in un file HTML..." 15 \
  {Scrive la partita attuale in un file HTML}
menuText I ToolsExpCurrentLaTeX "Esporta partita in un file LaTeX..." 15 \
  {Scrive la partita attuale in un file LaTeX}
menuText I ToolsExpFilter "Esporta tutte le partite del filtro" 1 \
  {Scrive tutte le partite filtrate in un file di testo}
menuText I ToolsExpFilterPGN "Esporta filtro in file PGN..." 17 \
  {Scrive tutte le partite filtrate in un file PGN}
menuText I ToolsExpFilterHTML "Esporta filtro in file HTML..." 17 \
  {Scrive tutte le partite filtrate in un file HTML}
menuText I ToolsExpFilterLaTeX "Esporta filtro in un file LaTeX..." 17 \
  {Scrive tutte le partite filtrate in un file LaTeX}
menuText I ToolsImportOne "Importa una partita in formato PGN..." 0 \
  {Importa una partita da testo PGN}
menuText I ToolsImportFile "Importa il file di partite PGN..." 11 \
  {Importa le partite da un file PGN}

# Options menu:
menuText I Options "Opzioni" 0
menuText I OptionsSize "Dimensione della scacchiera" 0 {Cambia la dimensione della scacchiera}
menuText I OptionsPieces "Stile dei pezzi" 6 \
  {Modifica lo stile dei pezzi della scacchiera}
menuText I OptionsColors "Colori..." 0 {Cambia i colori della scacchiera}
menuText I OptionsExport "Esportazione" 2 {Cambia le opzioni di importazione testo}
menuText I OptionsFonts "Fonts" 0 {Cambia fonts}
menuText I OptionsFontsRegular "Regolare" 0 {Cambia il font in 'regular'}
menuText I OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText I OptionsFontsSmall "Piccolo" 0 {Cambia il font 'small'}
menuText I OptionsFontsFixed "Fisso" 0 {Cambia il font di larghezza fissa}
menuText I OptionsGInfo "Informazioni sulla partita" 0 {Opzioni sulle informazioni della partita}
menuText I OptionsLanguage "Lingua" 0 {Sceglie una nuova lingua di menu}
menuText I OptionsMoves "Mosse" 0 {Opzioni di immissione di mosse}
menuText I OptionsMovesAsk "Conferma prima di sostituire le mosse" 0 \
  {Chiede prima di sovrascrivere ogni mossa esistente}
menuText I OptionsMovesDelay "Intervallo di tempo per il gioco automatico..." 1 \
  {Definisce l'intervallo di tempo per il gioco automatico}
menuText I OptionsMovesCoord "Immissione mossa per coordinate" 0 \
  {Accetta l'input di mossa mediante coordinate ("g1f3")}
menuText I OptionsMovesSuggest "Mostra le mosse suggerite" 0 \
  {Attiva/Disattiva il suggerimento di mosse}
menuText I OptionsMovesKey "Completamento da tastiera" 0 \
  {Attiva/Disattiva l'autocompletamento di mosse da tastiera}
menuText I OptionsNumbers "Formato del numero" 13 {Seglie il formato del numero}
menuText I OptionsStartup "Apertura all'avvio" 3 {Sceglie le finestre da aprire all'avvio}
menuText I OptionsWindows "Finestre" 2 {Opzioni di finestra}
menuText I OptionsWindowsIconify "Minimizza automaticamente" 5 \
  {Minimizza tutte le finestre quando la finestra principale viene minimizzata}
menuText I OptionsWindowsRaise "Auto-aumenta" 0 \
  {Aumenta alcune finestre (per es. le barre di progresso) ogni volta che sono oscurate}
menuText I OptionsToolbar "Barra degli strumenti" 12 \
  {Mostra/nasconde la barra degli strumenti nella finestra principale}
menuText I OptionsECO "Carica il file ECO..." 15 {Carica il file di classificazione ECO}
menuText I OptionsSpell "Carica il file di controllo ortografico..." 28 \
  {Carica il file di controllo di Scid}
menuText I OptionsTable "Directory di Tablebase..." 13 \
  {Seglie un file tablebase; tutte le tablebases nella directory saranno utilizzate}
menuText I OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText I OptionsSave "Salva Opzioni" 0 \
  "Salva tutte le opzioni definibili nel file $::optionsFile"
menuText I OptionsAutoSave "Salva Opzioni all'uscita" 0 \
  {Salva automaticamente tutte le opzioni quando si esce da Scid}

# Help menu:
menuText I Help "Aiuto" 0
menuText I HelpIndex "Indice" 0 {Mostra la pagina dell'indice dell'aiuto}
menuText I HelpGuide "Guida Veloce" 0 {Mostra la pagina di aiuto per la guida veloce}
menuText I HelpHints "Suggerimenti" 0 {Mostra la pagina di aiuto dei suggerimenti}
menuText I HelpContact "Informazioni per contattare" 17 {Mostra la pagina dell'aiuto di informazione di contatto}
menuText I HelpTip "Suggerimento del giorno" 0 {Mostra utili suggerimenti riguardo Scid}
menuText I HelpStartup "Finestra di partenza" 0 {Mostra la finestra di partenza}
menuText I HelpAbout "Su Scid" 1 {Informazioni su Scid}

# partita info box popup menu:
menuText I GInfoHideNext "Nascondi la mossa successiva" 0
menuText I GInfoMaterial "Mostra i valori del materiale" 0
menuText I GInfoFEN "Mostra FEN" 5
menuText I GInfoMarks "Mostra caselle e frecce colorate" 5
menuText I GInfoWrap "A capo automatico" 0
menuText I GInfoFullComment "Mostra commenti completi" 10
menuText I GInfoTBNothing "Tablebases: nulla" 12
menuText I GInfoTBResult "Tablebases: solo risultato" 12
menuText I GInfoTBAll "Tablebases: resultato e mosse migliori" 19
menuText I GInfoDelete "Recupera/Cancella questa partita" 9
menuText I GInfoMark "Smarca/Marca questa partita" 7

# Main window buttons:
helpMsg I .button.start {Va all'inizio della partita  (chiave: Home)}
helpMsg I .button.end {Va alla fine della partita  (chiave: End)}
helpMsg I .button.back {Indietro di una mossa (chiave: LeftArrow)}
helpMsg I .button.forward {Avanti di una mossa (chiave: RightArrow)}
helpMsg I .button.intoVar {Entra in una variante  (chiave abbreviata: v)}
helpMsg I .button.exitVar {Lascia la variante attuale  (chiave abbreviata: z)}
helpMsg I .button.flip {Ruota la scacchiera (chiave abbreviata: .)}
helpMsg I .button.coords {Coordinate on/off  (chiave abbreviata: 0)}
helpMsg I .button.autoplay {Mosse automatiche  (chiave: Ctrl+Z)}

# General buttons:
translate I Back {Indietro}
translate I Cancel {Cancella}
translate I Clear {Annulla}
translate I Close {Chiudi}
translate I Defaults {Defaults} ;# ***
translate I Delete {Annulla}
translate I Graph {Grafico}
translate I Help {Aiuto}
translate I Import {Importa}
translate I Index {Indice}
translate I LoadGame {Carica partita}
translate I BrowseGame {Browse partita} ;# ***
translate I MergeGame {Merge partita} ;# ***
translate I Preview {Anteprima}
translate I Revert {Rovescia}
translate I Save {Salva}
translate I Search {Cerca}
translate I Stop {Stop}
translate I Store {Memorizza}
translate I Update {Aggiorna}
translate I ChangeOrient {Modifica l'orientamento della finestra}
translate I None {Nessuno}
translate I First {Prima}
translate I Current {Attuale}
translate I Last {Ultima}

# General messages:
translate I game {partita}
translate I games {Partite}
translate I move {mossa}
translate I moves {mosse}
translate I all {tutto}
translate I Yes {Si'}
translate I No {No}
translate I Both {Entrambi}
translate I King {Re}
translate I Queen {Donna}
translate I Rook {Torre}
translate I Bishop {Alfiere}
translate I Knight {Cavallo}
translate I Pawn {Pedone}
translate I White {Bianco}
translate I Black {Nero}
translate I Player {Giocatori}
translate I Rating {Punteggio}
translate I RatingDiff {Differenza punteggio (Bianco - Nero)}
translate I Event {Evento}
translate I Site {Sito}
translate I Country {Paese}
translate I IgnoreColors {Ignora i colori}
translate I Date {Data}
translate I EventDate {Evento data}
translate I Decade {Decade} ;# ***
translate I Year {Anno}
translate I Month {Mese}
translate I Months {Gennaio Febbraio Marzo Aprile Maggio Giugno
  Luglio Agosto Settembre Ottobre Novembre Dicembre}
translate I Days {Dom Lun Mar Mer Gio Ven Sab}
translate I YearToToday {Anno ad oggi}
translate I Result {Risultato}
translate I Round {Turno}
translate I Length {Lunghezza}
translate I ECOCode {codice ECO}
translate I ECO {ECO}
translate I Deleted {Cancellato}
translate I SearchResults {Risultati della ricerca}
translate I OpeningTheDatabase {Database di aperture}
translate I Database {Database}
translate I Filter {Filtro}
translate I noGames {no partite}
translate I allGames {tutte le partite}
translate I empty {vuoto}
translate I clipbase {clipbase}
translate I score {score}
translate I StartPos {Posizione iniziale}
translate I Total {Totale}

# Game information:
translate I twin {doppio}
translate I deleted {cancellato}
translate I comment {commento}
translate I hidden {nascosto}
translate I LastMove {Ultima mossa}
translate I NextMove {Mossa Successiva}
translate I GameStart {Inizio di partita}
translate I LineStart {Inizio di variante}
translate I GameEnd {Fine della partita}
translate I LineEnd {Fine della variante}

# Player information:
translate I PInfoAll {Risultati per <b>tutte</b> le partite}
translate I PInfoFilter {Risultati per le partite nel <b>filtro</b>}
translate I PInfoAgainst {Risultati contro}
translate I PInfoMostWhite {Le piu' frequenti aperture con il Bianco}
translate I PInfoMostBlack {Le piu' frequenti aperture con il Nero}
translate I PInfoRating {Variazioni dell'Elo}
translate I PInfoBio {Biografia}

# Tablebase information:
translate I Draw {Patta}
translate I stalemate {stallo}
translate I withAllMoves {con tutte le mosse}
translate I withAllButOneMove {con tutte le mosse tranne una}
translate I with {con}
translate I only {solo}
translate I lose {persa}
translate I loses {perse}
translate I allOthersLose {tutte le altre perse}
translate I matesIn {matto in}
translate I hasCheckmated {e' mattato}
translate I longest {la piu' lunga}

# Tip of the day:
translate I Tip {Suggerimento}
translate I TipAtStartup {Suggerimento all'avvio}

# Tree window menus:
menuText I TreeFile "File" 0
menuText I TreeFileSave "Salva il file di cache" 0 \
  {Salva il file (.stc) della cache dell'albero}
menuText I TreeFileFill "Riempie il file di cache" 0 \
  {Riempie il file di cache con le piu' frequenti posizioni di apertura}
menuText I TreeFileBest "Lista delle migliori partite" 0 {Mostra l'albero delle migliori partite}
menuText I TreeFileGraph "Finestra di grafico" 0 \
  {Mostra il grafico per la corrente variante dell'albero}
menuText I TreeFileCopy "Copia il testo dell'albero nella clipboard" 1 \
  {Copia le statistiche dell'albero nella clipboard}
menuText I TreeFileClose "Chiudi la finestra dell'albero" 0 \
  {Chiudi la finestra dell'albero}
menuText I TreeSort "Ordina" 0
menuText I TreeSortAlpha "Alfabetico" 0
menuText I TreeSortECO "codice ECO" 0
menuText I TreeSortFreq "Frequenza" 0
menuText I TreeSortScore "Punti" 0
menuText I TreeOpt "Opzioni" 0
menuText I TreeOptLock "Blocca" 0 {Blocca/sblocca l'albero al database corrente}
menuText I TreeOptTraining "Training" 0 {Attiva/disattiva la modalita' di esercizio dell'albero}
menuText I TreeOptAutosave "File di cache per Auto-salvare" 0 \
  {Salva automaticamente il file di cahce quando si chiude la finestra dell'albero}
menuText I TreeHelp "Aiuto" 0
menuText I TreeHelpTree "Aiuto per l'albero" 0
menuText I TreeHelpIndex "Indice di aiuto" 0
translate I SaveCache {Salva cache}
translate I Training {Esercizio}
translate I LockTree {Blocca}
translate I TreeLocked {bloccato}
translate I TreeBest {Migliore}
translate I TreeBestGames {Migliori partite}

# Finder window: ***
menuText I FinderFile "File" 0
menuText I FinderFileSubdirs "Cerca nelle sottodirectory" 0
menuText I FinderFileClose "Chiudi File Finder" 0
menuText I FinderSort "Ordina" 0
menuText I FinderSortType "Tipo" 0
menuText I FinderSortSize "Size" 0
menuText I FinderSortMod "Modifica" 0
menuText I FinderSortName "Nome" 0
menuText I FinderSortPath "Percorso" 0
menuText I FinderTypes "Tipi" 0
menuText I FinderTypesScid "Database Scid" 0
menuText I FinderTypesOld "Vecchio formato database Scid" 0
menuText I FinderTypesPGN "File PGN" 0
menuText I FinderTypesEPD "EPD (book) files" 0
menuText I FinderTypesRep "File di Repertorio" 0
menuText I FinderHelp "Aiuto" 0
menuText I FinderHelpFinder "Aiuto su File Finder" 0
menuText I FinderHelpIndex "Indice di aiuto" 0
translate I FileFinder {File Finder}
translate I FinderDir {Directory}
translate I FinderDirs {Directories}
translate I FinderFiles {Files}
translate I FinderUpDir {up}

# Tournament finder:
menuText I TmtFile "File" 0
menuText I TmtFileUpdate "Aggiorna" 0
menuText I TmtFileClose "Chiudi Tournament Finder" 0
menuText I TmtSort "Ordina" 0
menuText I TmtSortDate "Data" 0
menuText I TmtSortPlayers "Giocatori" 0
menuText I TmtSortGames "Partite" 0
menuText I TmtSortElo "Elo" 0
menuText I TmtSortSite "Siti" 0
menuText I TmtSortEvent "Eventi" 1
menuText I TmtSortWinner "Vincitore" 0
translate I TmtLimit "Limite della lista"
translate I TmtMeanElo "Media Elo piu' bassa"
translate I TmtNone "Non e' stato trovato nessun torneo."

# Graph windows:
menuText I GraphFile "File" 0
menuText I GraphFileColor "Salva come Color Postscript..." 8
menuText I GraphFileGrey "Salva come Greyscale Postscript..." 8
menuText I GraphFileClose "Chiudi la finestra" 6
menuText I GraphOptions "Opzioni" 0
menuText I GraphOptionsWhite "Bianco" 0
menuText I GraphOptionsBlack "Nero" 0
menuText I GraphOptionsBoth "Entrambi" 1
menuText I GraphOptionsPInfo "Player Info player" 0 ;# ***
translate I GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate I AddVariation {Aggiungi variante}
translate I AddMove {Aggiunge una mossa}
translate I Annotate {Annota}
translate I AnalysisCommand {Comando di analisi}
translate I PreviousChoices {Scelta precedente}
translate I AnnotateTime {Imposta il tempo tra le mosse in secondi}
translate I AnnotateWhich {Aggiungi varianti}
translate I AnnotateAll {Per mosse di entrambi i colori}
translate I AnnotateWhite {Per solo le mosse del Bianco}
translate I AnnotateBlack {Per solo le mosse del Nero}
translate I AnnotateNotBest {Quando la mossa della partita non e' la migliore}

# Analysis Engine open dialog:
translate I EngineList {Lista dei motori di analisi}
translate I EngineName {Nome}
translate I EngineCmd {Comando}
translate I EngineArgs {Parametri}
translate I EngineDir {Directory}
translate I EngineElo {Elo}
translate I EngineTime {Data}
translate I EngineNew {Nuovo}
translate I EngineEdit {Modifica}
translate I EngineRequired {I campi in grassetto sono obbligatori; gli altri sono opzionali}

# Stats window menus:
menuText I StatsFile "File" 0
menuText I StatsFilePrint "Stampa in file..." 0
menuText I StatsFileClose "Chiudi la finestra" 0
menuText I StatsOpt "Opzioni" 0

# PGN window menus:
menuText I PgnFile "File" 0
menuText I PgnFilePrint "Stampa in file..." 0
menuText I PgnFileClose "Chiudi la finestra PGN" 0
menuText I PgnOpt "Visualizza" 0
menuText I PgnOptColor "Visualizza il Colore" 0
menuText I PgnOptShort "Intestazione compatta (3-righe)" 0
menuText I PgnOptSymbols "Annotazioni simboliche" 0
menuText I PgnOptIndentC "Indenta i commenti" 0
menuText I PgnOptIndentV "Indenta le varianti" 7
menuText I PgnOptColumn "Stile della colonna (una mossa per riga)" 0
menuText I PgnOptSpace "Spazio dopo i numeri delle mosse" 0
menuText I PgnOptStripMarks "Strip out colored square/arrow codes" 1 ;# ***
menuText I PgnColor "Colori" 0
menuText I PgnColorHeader "Intestazione..." 0
menuText I PgnColorAnno "Annotazioni..." 0
menuText I PgnColorComments "Commenti..." 0
menuText I PgnColorVars "Varianti..." 0
menuText I PgnColorBackground "Sfondo..." 0
menuText I PgnHelp "Aiuto" 0
menuText I PgnHelpPgn "Aiuto PGN" 0
menuText I PgnHelpIndex "Indice" 0

# Crosstable window menus:
menuText I CrosstabFile "File" 0
menuText I CrosstabFileText "Stampa in un file di Testo..." 21
menuText I CrosstabFileHtml "Stampa in un file HTML..." 18
menuText I CrosstabFileLaTeX "Stampa in un file LaTeX..." 18
menuText I CrosstabFileClose "Chiudi la finestra del tabella" 0
menuText I CrosstabEdit "Edita" 0
menuText I CrosstabEditEvent "Evento" 0
menuText I CrosstabEditSite "Sito" 0
menuText I CrosstabEditDate "Data" 0
menuText I CrosstabOpt "Visualizza" 0
menuText I CrosstabOptAll "Girone all'italiana" 0
menuText I CrosstabOptSwiss "Girone Svizzero" 0
menuText I CrosstabOptKnockout "Knockout" 0
menuText I CrosstabOptAuto "Auto" 0
menuText I CrosstabOptAges "Eta' in anni" 8
menuText I CrosstabOptNats "Nazionalita'" 0
menuText I CrosstabOptRatings "Punteggi" 0
menuText I CrosstabOptTitles "Titoli" 0
menuText I CrosstabOptBreaks "Punteggi al Tie-break" 4
menuText I CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText I CrosstabOptColors "Colori (solo girone Svizzero)" 0
menuText I CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2 ;# ***
menuText I CrosstabOptGroup "Punti del gruppo" 0
menuText I CrosstabSort "Ordina" 0
menuText I CrosstabSortName "Nome" 0
menuText I CrosstabSortRating "Punteggio" 0
menuText I CrosstabSortScore "Punti" 0
menuText I CrosstabColor "Colore" 0
menuText I CrosstabColorPlain "Testo normale" 0
menuText I CrosstabColorHyper "Ipertesto" 0
menuText I CrosstabHelp "Aiuto" 0
menuText I CrosstabHelpCross "Aiuto tabella" 0
menuText I CrosstabHelpIndex "Indice di aiuto" 0
translate I SetFilter {Imposta filtro}
translate I AddToFilter {Aggiungi al filtro}
translate I Swiss {Svizzero}

# Opening report window menus:
menuText I OprepFile "File" 0
menuText I OprepFileText "Stampa in un file di testo..." 21
menuText I OprepFileHtml "Stampa in un file HTML..." 18
menuText I OprepFileLaTeX "Stampa in un file LaTeX..." 18
menuText I OprepFileOptions "Opzioni..." 0
menuText I OprepFileClose "Chiude la finestra del rapporto" 0
menuText I OprepHelp "Aiuto" 0
menuText I OprepHelpReport "Aiuto sul rapporto di apertura" 0
menuText I OprepHelpIndex "Indice di Aiuto" 0

# Repertoire editor:
menuText I RepFile "File" 0
menuText I RepFileNew "Nuovo" 0
menuText I RepFileOpen "Apri..." 0
menuText I RepFileSave "Salva..." 0
menuText I RepFileSaveAs "Salva con nome..." 3
menuText I RepFileClose "Close window" 0
menuText I RepEdit "Edita" 0
menuText I RepEditGroup "Aggiunge il gruppo" 12
menuText I RepEditInclude "Aggiunge la variante inclusa" 21
menuText I RepEditExclude "Aggiunge la variante esclusa" 21
menuText I RepView "Visualizza" 0
menuText I RepViewExpand "Espande tutti i gruppi" 0
menuText I RepViewCollapse "Collassa tutti i gruppi" 0
menuText I RepSearch "Cerca" 0
menuText I RepSearchAll "Tutto del repertorio..." 0
menuText I RepSearchDisplayed "Visualizza solo varianti..." 0
menuText I RepHelp "Aiuto" 0
menuText I RepHelpRep "Aiuto del repertorio" 0
menuText I RepHelpIndex "Indice di Aiuto" 0
translate I RepSearch "Ricerca nel repertorio"
translate I RepIncludedLines "varianti incluse"
translate I RepExcludedLines "varianti escluse"
translate I RepCloseDialog {Questo repertorio non e' stato salvato.

Vuoi veramente continuare ed eliminare le modifiche effettuate?
}

# Header search:
translate I HeaderSearch {Ricerca per Intestazione}
translate I GamesWithNoECO {Partite senza ECO?}
translate I GameLength {Lunghezza della partita}
translate I FindGamesWith {Cerca partite con}
translate I StdStart {Inizio standard}
translate I Promotions {Promozioni}
translate I Comments {Commenti}
translate I Variations {Varianti}
translate I Annotations {Annotazioni}
translate I DeleteFlag {Cancellato}
translate I WhiteOpFlag {Apertura del Bianco}
translate I BlackOpFlag {Apertura del Nero}
translate I MiddlegameFlag {Mediogioco}
translate I EndgameFlag {Finale}
translate I NoveltyFlag {Novita'}
translate I PawnFlag {Struttura pedonale}
translate I TacticsFlag {Tatticismi}
translate I QsideFlag {Gioco su lato di donna}
translate I KsideFlag {Gioco su lato di re}
translate I BrilliancyFlag {Brillantezza}
translate I BlunderFlag {Svista}
translate I UserFlag {User}
translate I PgnContains {PGN contiene testo}

# Game list window:
translate I GlistNumber {Numero}
translate I GlistWhite {Bianco}
translate I GlistBlack {Nero}
translate I GlistWElo {B-Elo}
translate I GlistBElo {N-Elo}
translate I GlistEvent {Evento}
translate I GlistSite {Sito}
translate I GlistRound {Turno}
translate I GlistDate {Data}
translate I GlistYear {Anno}
translate I GlistEDate {Evento-Data}
translate I GlistResult {Risultato}
translate I GlistLength {Lunghezza}
translate I GlistCountry {Paese}
translate I GlistECO {ECO}
translate I GlistOpening {Apertura}
translate I GlistEndMaterial {Materiale a fine partita}
translate I GlistDeleted {Cancellato}
translate I GlistFlags {Flags}
translate I GlistVars {Varianti}
translate I GlistComments {Commenti}
translate I GlistAnnos {Annotazioni}
translate I GlistStart {Start} ;# ***
translate I GlistGameNumber {numero di Partita}
translate I GlistFindText {Cerca testo}
translate I GlistMoveField {Mossa}
translate I GlistEditField {Configura}
translate I GlistAddField {Aggiungi}
translate I GlistDeleteField {Elimina}
translate I GlistWidth {Larghezza}
translate I GlistAlign {Allinea}
translate I GlistColor {Colore}
translate I GlistSep {Separatore}

# Maintenance window:
translate I DatabaseName {Nome del Database:}
translate I TypeIcon {Icona tipo:}
translate I NumOfGames {Partite:}
translate I NumDeletedGames {partite cancellate:}
translate I NumFilterGames {Partite nel filtro:}
translate I YearRange {Intervallo di anni:}
translate I RatingRange {Intervallo di Punteggio:}
translate I Flag {Flag} ;# ***
translate I DeleteCurrent {Cancella la partita attuale}
translate I DeleteFilter {Cancella le partite del filtro}
translate I DeleteAll {Cancella tutte le partite}
translate I UndeleteCurrent {Recupera la partita attuale}
translate I UndeleteFilter {Recupera il filtro di partite}
translate I UndeleteAll {Recupera tutte le partite}
translate I DeleteTwins {Cancella le partite doppie}
translate I MarkCurrent {Marca la partita attuale}
translate I MarkFilter {Marca partite del filtro}
translate I MarkAll {Marca tutte le partite}
translate I UnmarkCurrent {Smarca la partita attuale}
translate I UnmarkFilter {Smarca le partite del filtro}
translate I UnmarkAll {Smarca tutte le partite}
translate I Spellchecking {Controllo nome}
translate I Players {Giocatori}
translate I Events {Eventi}
translate I Sites {Siti}
translate I Rounds {Turni}
translate I DatabaseOps {Operazioni sul Database}
translate I ReclassifyGames {Partite classificate ECO}
translate I CompactDatabase {Compatta database}
translate I SortDatabase {Ordina database}
translate I AddEloRatings {Aggiungi punteggio Elo}
translate I AutoloadGame {Autoload game number} ;# ***
translate I StripTags {Strip PGN tags} ;# ***
translate I StripTag {Strip tag} ;# ***
translate I Cleaner {Cleaner} ;# ***
translate I CleanerHelp {
La fiestra Cleaner effettura' tutte le operazioni che verranno selezionate dalla lista sottostante, sul database corrente.

Le impostazioni correnti nelle finestre della calssificazione ECO e della cancellazione delle partite doppie verranno applicate se selezionate.
}
translate I CleanerConfirm {
Una volta attivata l'operazione di pulizia questa non puo' piu' essere interrotta!

Questo puo' richiedere diverso tempo su un database grosso, a seconda delle funzioni selezionate e delle impostazioni correnti.

Sei sicuro di voler procedere con le funzioni selezionate?
}

# Comment editor:
translate I AnnotationSymbols  {Simboli di annotazione:}
translate I Comment {Commento:}

# Board search:
translate I BoardSearch {Ricerca Posizione}
translate I FilterOperation {Operazione sul filtro corrente:}
translate I FilterAnd {AND (Restrizione del filtro)}
translate I FilterOr {OR (Aggiunta al filtro)}
translate I FilterIgnore {IGNORA (Annulla il filtro)}
translate I SearchType {Tipo di ricerca:}
translate I SearchBoardExact {Posizione Esatta (tutti i pezzi sulla stessa casa)}
translate I SearchBoardPawns {Pedoni (stesso materiale, tutti i pedoni sulla stessa casa)}
translate I SearchBoardFiles {File (stesso materiale, tutti i pedoni sulle stesse file)}
translate I SearchBoardAny {Dovunque (stesso materiale, pedoni e pezzi dovunque)}
translate I LookInVars {Osserva nelle varianti}

# Material search:
translate I MaterialSearch {Ricerca Materiale}
translate I Material {Materiale}
translate I Patterns {Schema}
translate I Zero {Nessuno}
translate I Any {Tutti}
translate I CurrentBoard {Posizione corrente}
translate I CommonEndings {Finali Comuni}
translate I CommonPatterns {Schemi Comuni}
translate I MaterialDiff {Differenze di materiale}
translate I squares {sulle case di}
translate I SameColor {Stesso colore}
translate I OppColor {Colore opposto}
translate I Either {Entrambi}
translate I MoveNumberRange {Intervallo del numero di mosse}
translate I MatchForAtLeast {Confronta per almeno}
translate I HalfMoves {semi-mosse}

# game saving:
translate I Today {Oggi}
translate I ClassifyGame {Classifica la partita}

# Setup position:
translate I EmptyBoard {Scacchiera vuota}
translate I InitialBoard {Posizione iniziale}
translate I SideToMove {Parte che muove}
translate I MoveNumber {Numero della mossa}
translate I Castling {Arrocco}
translate I EnPassentFile {Fila En Passent}
translate I ClearFen {Annulla FEN}
translate I PasteFen {Incolla FEN}

# Replace move dialog:
translate I ReplaceMove {Sostituisci la mossa}
translate I AddNewVar {Aggiunge una nuova variante}
translate I ReplaceMoveMessage {Esiste gia' una mossa qui.

Puoi sostituirla, rinunciando a tutte le mosse dopo di essa, o aggiungere la tua mossa come nuova variante.

(Puoi impedire di vedere questo messaggio in futuro ponendo ad off l'opzione "Domanda prima di sostiture le mosse" nel menu Opzioni:Mosse.)}

# Make database read-only dialog:
translate I ReadOnlyDialog {Se rendi questo database di sola lettura, nessuna variazione sara'permessa .
Nessuna partita puo' essere salvata o sostituita, e nessuna 'cancella bandiere' puo' essere alterato.
Ognui ordinamento o classificazione ECO resultera' essere temporaneo.

Puoi facilmente rendere ancora scrivibile il database, chiudendolo e riaprendolo.

Desideri veramente rendere questo database di sola lettura?}

# Clear game dialog:
translate I ClearGameDialog {Questa partita e' stata modificata.

Sei sicuro di voler continuare ed eliminare le modifiche effettuate?
}

# Exit dialog:
translate I ExitDialog {Vuoi veramente uscire da Scid?}
translate I ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.} ;# ***

# Import window:
translate I PasteCurrentGame {Incolla la partita attuale}
translate I ImportHelp1 {Immetti o incolla una partita in formato PGN nella struttura precedente.}
translate I ImportHelp2 {Ogni errore di importazione di partita sara' visualizzato qui.}

# ECO Browser:
translate I ECOAllSections {tutte le sezioni ECO}
translate I ECOSection {sezione ECO}
translate I ECOSummary {Sommario per}
translate I ECOFrequency {Frequenze nell'ambito del}

# Opening Report:
translate I OprepTitle {Rapporto di apertura}
translate I OprepReport {Rapporto}
translate I OprepGenerated {Generato da}
translate I OprepStatsHist {Statistica e Storia}
translate I OprepStats {Statistica}
translate I OprepStatAll {tutte le partite della statistica}
translate I OprepStatBoth {Entrambe classificate}
translate I OprepStatSince {Da}
translate I OprepOldest {Le partite piu' vecchie}
translate I OprepNewest {Le partite piu' recenti}
translate I OprepPopular {Attuale popularita'}
translate I OprepFreqAll {Frequenza in tutti gli anni: }
translate I OprepFreq1   {Da  1 anno ad oggi:          }
translate I OprepFreq5   {Da  5 anni ad oggi:          }
translate I OprepFreq10  {Da 10 anni ad oggi:          }
translate I OprepEvery {una volta ogni %u partite}
translate I OprepUp {su %u%s da tutti gli anni}
translate I OprepDown {giu' %u%s da tutti gli anni}
translate I OprepSame {nessuna variazione da tutti gli anni}
translate I OprepMostFrequent {Giocatori piu' frequenti}
translate I OprepRatingsPerf {Punteggi e Performance}
translate I OprepAvgPerf {Punteggi medi e performance}
translate I OprepWRating {Punteggio del Bianco}
translate I OprepBRating {Punteggio del Nero}
translate I OprepWPerf {Performance del bianco}
translate I OprepBPerf {Performance del nero}
translate I OprepHighRating {Partite con il piu' alto punteggio medio}
translate I OprepTrends {Tendenze dei risultati}
translate I OprepResults {Result lengths and frequencies} ;# ***
translate I OprepLength {Lunghezza della partita}
translate I OprepFrequency {Frequenza}
translate I OprepWWins {Vittorie del Bianco: }
translate I OprepBWins {Vittorie del Nero: }
translate I OprepDraws {Patte:      }
translate I OprepWholeDB {intero database}
translate I OprepShortest {Vittorie piu' brevi}
translate I OprepMovesThemes {Mosse e Temi}
translate I OprepMoveOrders {Ordini di mosse che raggiungono la posizione considerata}
translate I OprepMoveOrdersOne \
  {C'era solo un ordine di mosse che raggiungeva questa posizione:}
translate I OprepMoveOrdersAll \
  {C'erano %u ordini di mosse che raggiungevano questa posizione:}
translate I OprepMoveOrdersMany \
  {C'erano %u ordini di mossa che raggiungevano questa posizione. Le prime %u sono:}
translate I OprepMovesFrom {Mosse dalla posizione del rapporto}
translate I OprepThemes {Temi Posizionali}
translate I OprepThemeDescription {Frequenza di temi alla mossa %u}
translate I OprepThemeSameCastling {Arrocco dallo stesso lato}
translate I OprepThemeOppCastling {Arrocchi eterogenei}
translate I OprepThemeNoCastling {Entrambi i re non arroccati}
translate I OprepThemeKPawnStorm {Attacco di pedoni sull'ala di re}
translate I OprepThemeQueenswap {Scambio di donne}
translate I OprepThemeIQP {Pedone di donna isolato}
translate I OprepThemeWP567 {Pedone Bianco sulla 5/6/7ma traversa}
translate I OprepThemeBP234 {Pedone Nero sulla 2/3/4ta traversa}
translate I OprepThemeOpenCDE {Colonne c/d/e aperte}
translate I OprepTheme1BishopPair {Una parte ha la coppia degli alfieri}
translate I OprepEndgames {Finali}
translate I OprepReportGames {Partite del rapporto}
translate I OprepAllGames {tutte le partite}
translate I OprepEndClass {Materiale alla fine di ogni partita}
translate I OprepTheoryTable {Tabella della Teoria}
translate I OprepTableComment {Generato da %u partite piu' quotate.}
translate I OprepExtraMoves {Mosse Extra note nella tabella della teoria}
translate I OprepMaxGames {Numero massimo di partite nella tabella della teoria}

# Piece Tracker window:
translate I TrackerSelectSingle {Left mouse button selects this piece.} ;# ***
translate I TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate I TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate I TrackerStat {Statistic}
translate I TrackerGames {% games with move to square}
translate I TrackerTime {% time on each square}
translate I TrackerMoves {Moves}
translate I TrackerMovesStart {Enter the move number where tracking should begin.}
translate I TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate I SelectAllGames {Tutte le partite nel database}
translate I SelectFilterGames {Solo le partite nel filtro}
translate I SelectTournamentGames {Solo le partite del torneo attuale}
translate I SelectOlderGames {Solo le partite piu' vecchie}

# Delete Twins window:
translate I TwinsNote {Per essere doppie, due partite devono almeno avere gli stessi due giocatori, e criteri che puoi definire sotto. Quando viene trovata una coppia di doppie, la partita piu' breve e' cancellata.
Suggerimento: E' meglio controllare per caratteri il database prima di cancellare le doppie, per migliorare la ricerca delle doppie.}
translate I TwinsCriteria {Criteri: Partite doppie devono avere...}
translate I TwinsWhich {Esamina quali partite}
translate I TwinsColors {Stessi colori?}
translate I TwinsEvent {Stesso evento?}
translate I TwinsSite {Stesso sito?}
translate I TwinsRound {Stesso turno?}
translate I TwinsYear {Stesso anno?}
translate I TwinsMonth {Stesso mese?}
translate I TwinsDay {Stesso giorno?}
translate I TwinsResult {Same result?}
translate I TwinsECO {Stesso codice ECO?}
translate I TwinsMoves {Stesse mosse?}
translate I TwinsPlayers {Confronta i nomi dei giocatori:}
translate I TwinsPlayersExact {Stretta uguaglianza}
translate I TwinsPlayersPrefix {Solo le prima 4 lettere}
translate I TwinsWhen {Quando cancellare partite doppie}
translate I TwinsSkipShort {Ignorare tutte le partite sotto le 5 mosse?}
translate I TwinsUndelete {Recupera prima tutte le partite?}
translate I TwinsSetFilter {Definisci il filtro a tutte le partite doppie cancellate?}
translate I TwinsComments {Mantieni sempre le partite con commenti?}
translate I TwinsVars {Mantieni sempre le partite con varianti?}
translate I TwinsDeleteWhich {Delete which game:} ;# ***
translate I TwinsDeleteShorter {Shorter game} ;# ***
translate I TwinsDeleteOlder {Smaller game number} ;# ***
translate I TwinsDeleteNewer {Larger game number} ;# ***
translate I TwinsDelete {Cancella partite}

# Name editor window:
translate I NameEditType {Tipo di nome da editare}
translate I NameEditSelect {Partite da editare}
translate I NameEditReplace {Sostituisci}
translate I NameEditWith {con}
translate I NameEditMatches {Corrispondenze: Digita da Ctrl+1 ad Ctrl+9 per scegliere}

# Classify window:
translate I Classify {Classifica}
translate I ClassifyWhich {Quali partite classificare ECO}
translate I ClassifyAll {Tutte le partite (sovrascrivi i vecchi codici ECO)}
translate I ClassifyYear {Tutte le partite giocate nell'ultimo anno}
translate I ClassifyMonth {Tutte le partite giocate nell'ultimo mese}
translate I ClassifyNew {Solo partite ancora senza codice ECO}
translate I ClassifyCodes {Codici ECO da usare}
translate I ClassifyBasic {Solo codici di base ("B12", ...)}
translate I ClassifyExtended {estensioni Scid ("B12j", ...)}

# Compaction:
translate I NameFile {File di Nomi}
translate I GameFile {File Partite}
translate I Names {Nomi}
translate I Unused {Non usati}
translate I SizeKb {Ampiezza (kb)}
translate I CurrentState {Stato Attuale}
translate I AfterCompaction {Dopo la compattazione}
translate I CompactNames {Compatta il file di nomi}
translate I CompactGames {Compatta il file di partite}

# Sorting:
translate I SortCriteria {Criteri}
translate I AddCriteria {Aggiungi criteri}
translate I CommonSorts {Ordinamenti Comuni}
translate I Sort {Ordina}

# Exporting:
translate I AddToExistingFile {Aggiungi partite al file esistente?}
translate I ExportComments {Esporta commenti?}
translate I ExportVariations {Esporta varianti?}
translate I IndentComments {Indenta commenti?}
translate I IndentVariations {Indenta varianti?}
translate I ExportColumnStyle {Stile colonna (una mossa per riga)?}
translate I ExportSymbolStyle {Stile annotazione simbolica:}
translate I ExportStripMarks {Strip square/arrow mark codes from comments?} ;# ***

# Goto game/move dialogs:
translate I LoadGameNumber {Inserire il numero della partita da caricare:}
translate I GotoMoveNumber {Vai alla mossa numero:}

# Copy games dialog:
translate I CopyGames {Copia partite}
translate I CopyConfirm {
 Vuoi veramente copiare
 le [thousands $nGamesToCopy] partite dal filtro
 del database "$fromName"
 nel database "$fromName"?
}
translate I CopyErr {Impossibile copiare le partite}
translate I CopyErrSource {il database origine}
translate I CopyErrTarget {il database destinazione}
translate I CopyErrNoGames {non contiene nessuna partita nel suo filtro}
translate I CopyErrReadOnly {e' di sola lettura}
translate I CopyErrNotOpen {non e' aperto}

# Colors:
translate I LightSquares {Case chiare}
translate I DarkSquares {Case scure}
translate I SelectedSquares {Case selezionate}
translate I SuggestedSquares {Case delle mosse suggerite}
translate I WhitePieces {Pezzi bianchi}
translate I BlackPieces {Pezzi neri}
translate I WhiteBorder {Bordi del bianco}
translate I BlackBorder {Bordi del nero}

# Novelty window:
translate I FindNovelty {Trova Novita'}
translate I Novelty {Novita'}
translate I NoveltyInterrupt {Ricerca novita' interrotta}
translate I NoveltyNone {Non e' stata trovata nessuna novita' per la partita corrente}
translate I NoveltyHelp {
Scid cerchera' la prima mossa della partita corrente che raggiungera' una posizione non presente nel database selezionato o nel libro delle aperure.
}

# Upgrading databases:
translate I Upgrading {Aggiornamento}
translate I ConfirmOpenNew {
Questo e' un vecchio formato (Scid 2) di database che non puo' essere aperto da Scid 3, ma e' stata appena creata una nuova versione nel formato (Scid 3).

Vuoi aprire la nuova versione del database?
}
translate I ConfirmUpgrade {
Questo e' un vecchio formato (Scid 2) di database. Prima di poter utilizzare il database in Scid 3 va' creata una nuova versione.

L'aggiornamento creera' una nuova versione del database; non verranno modificati o cancellati i files originali.

Questo richiedera' del tempo, ma necessita di essere fatto una volta sola. Puoi arrestare il processo se durera' a lungo.

Vuoi aggiornare il database ora?
}

# Recent files options:
translate I RecentFilesMenu {Number of recent files in File menu} ;# ***
translate I RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# end of italian.tcl
#  nederlan.tcl:
#  Dutch language support for Scid.
#  Added by J.Kees Hofkamp.
#  Changes by J. Krabbenbos.
#  Changes by Leander Laruelle.


addLanguage N Nederlands 0

proc setLanguage_N {} {

# File menu:
menuText N File "Bestand" 0
menuText N FileNew "Nieuw..." 0 {Maak een nieuwe Scid database}
menuText N FileOpen "Openen..." 0 {Open een bestaande Scid database}
menuText N FileClose "Sluiten" 0 {Sluit de  actieve Scid database}
menuText N FileFinder "Bestandzoeker" 0 {Open het bestandszoekvenster}
menuText N FileBookmarks "Bladwijzers" 0 {Bladwijzer menu (sneltoets: Ctrl+B)}
menuText N FileBookmarksAdd "Toevoegen bladwijzer" 0 \
  {Bladwijzer naar huidige databasepartij en positie}
menuText N FileBookmarksFile "Bladwijzer-bestand" 0 \
  {Maak een bladwijzerbestand voor de huidige partij en stelling}
menuText N FileBookmarksEdit "Wijzigen Bladwijzers..." 0 \
  {Bladwijzermenu's}
menuText N FileBookmarksList "Weergeven bladwijzerfolders als lijst" 0 \
  {Weergeven bladwijzerfolders als lijst, niet als submenu's}
menuText N FileBookmarksSub "Weergeven bladwijzerfolders als submenu's" 0 \
  {Weergeven bladwijzerfolders als submenu's, niet als lijst}
menuText N FileMaint "Onderhoud" 2 {Onderhoud Scid database}
menuText N FileMaintWin "Onderhoudsvenster" 2 \
  {Open/sluit het Scid onderhoudsvenster}
menuText N FileMaintCompact "Reorganiseer database..." 0 \
  {Reorganiseer database bestanden}
menuText N FileMaintClass "Partijen ECO-classificeren..." 10 \
  {Herbereken de ECO code van alle partijen}
menuText N FileMaintSort "Sorteren..." 0 \
  {Sorteer alle partijen in de database}
menuText N FileMaintDelete "Doublures verwijderen..." 0 \
  {Vind dubbele partijen om ze te verwijderen}
menuText N FileMaintTwin "Doublure-venster" 1 \
  {Open/bijwerken het doublure-controle venster}
menuText N FileMaintName "Namen" 0 \
  {Corrigeer namen/spelling}
menuText N FileMaintNameEditor "Namen-editor" 6 \
  {Open/sluit het namen-correctie venster}
menuText N FileMaintNamePlayer "Corrigeer naam speler..." 15 \
  {Controleer spelling namen via het spellingcontrole bestand}
menuText N FileMaintNameEvent "Corrigeer naam evenement..." 15 \
  {Controleer spelling evenementen via spellingchecker bestand}
menuText N FileMaintNameSite "Corrigeer naam plaats..." 15 \
  {Controleer plaatsnamen via spellingchecker bestand}
menuText N FileMaintNameRound "Corrigeer ronde..." 10 \
  {Controleer rondenamen via spelling spellingchecker bestand}
menuText N FileReadOnly "Alleen lezen..." 7 \
  {Zet huidige database op alleen-lezen en voorkom veranderingen}
menuText N FileExit "Einde programma" 0 {Einde Scid}

# Edit menu:
menuText N Edit "Bewerken" 0
menuText N EditAdd "Nieuwe variant" 8 \
 {Voeg op dit punt een variant toe}
menuText N EditDelete "Variant verwijderen" 11 \
 {Verwijder een variant voor deze zet}
menuText N EditFirst "Maak hoofdvariant" 5 \
  {Maak deze variant de eerste in de lijst}
menuText N EditMain "Variatie op hoofdvariant" 13 \
   {Promoveerd de variant als hoofdvariant}
menuText N EditTrial "Probeer variatie" 0 \
  {Start/stop probeer modus, om een idee op het bord te testen}
menuText N EditStrip "Strip" 2 {Verwijder commentaar of varianten uit deze partij}
menuText N EditStripComments "Commentaar" 0 \
  {Verwijder alle commentaar en annotaties uit deze partij}
menuText N EditStripVars "Varianten" 0 {Verwijder alle varianten uit deze partij}
menuText N EditReset "Klembord leegmaken" 0 \
  {Maak het klembord helemaal leeg}
menuText N EditCopy "Partij naar klembord" 7 \
  {Kopieer deze partij naar het klembord}
menuText N EditPaste "Partij vanuit klembord" 7 \
  {Plak actieve klembord-partij hier}
menuText N EditSetup "Stelling opzetten..." 0 \
  {Kies een start-stelling voor de partij}
menuText N EditPasteBoard "Invoegen start stelling" 12 \
  {Maak de start stelling van de huidige tekst selectie (klembord)}

# Game menu:
menuText N Game "Partij" 0
menuText N GameNew "Partij leegmaken" 7 \
  {Maak partij leeg; sla veranderingen niet op}
menuText N GameFirst "Eerste partij laden" 5 {Laad de eerste gefilterde partij}
menuText N GamePrev "Vorige partij laden" 0 \
  {Laad vorige partij in het filter}
menuText N GameReload "Partij opnieuw laden" 7 \
  {Laad partij opnieuw; sla veranderingen niet op}
menuText N GameNext "Volgende partij laden" 3 \
  {Laad volgende partij in het filter}
menuText N GameLast "Laatste partij laden" 6 {Laad de laatste gefilterde partijd}
menuText N GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText N GameNumber "Laad partij nummer..." 12 \
  {Laad partijnummer:}
menuText N GameReplace "Partij overschrijven..." 11 \
  {Bewaar partij; overschrijf oude versie}
menuText N GameAdd "Partij toevoegen..." 7 \
  {Bewaar partij en voeg toe aan de database}
menuText N GameDeepest "Opening bepalen" 8 \
  {Ga naar de diepste positie uit het ECO openingboek}
menuText N GameGotoMove "Zetnummer..." 0 \
  {Ga naar zetnummer .. in de partij}
menuText N GameNovelty "Vind nieuwtje..." 7 \
  {Vind de eerste zet in deze partij die nog niet eerder is gespeeld}

# Search menu:
menuText N Search "Selecteren" 0
menuText N SearchReset "Alle partijen" 0 \
  {Reset filter en toon alle partijen}
menuText N SearchNegate "Selectie omdraaien" 9 \
  {Draai filter om en toon de andere partijen uit de databse}
menuText N SearchCurrent "Zoek huidige stelling" 5 \
  {Zoek in database naar huidige stelling}
menuText N SearchHeader "Partijgegevens..." 5 \
  {Zoek op speciale informatie: speler, evenement enz.}
menuText N SearchMaterial "Materiaal/Kenmerken..." 0 \
  {Zoek op patroon: bord, materiaal enz.}
menuText N SearchUsing "Zoekopties" 0 \
  {Zoek met gebruikmaking van opgeslagen opties}

# Windows menu:
menuText N Windows "Venster" 0
menuText N WindowsComment "Bewerk commentaar" 0 \
 {Open/sluit commentaar bewerkings venster}
menuText N WindowsGList "Toon alle partijen" 0 \
  {Open/sluit lijst met partijen}
menuText N WindowsPGN "PGN-venster" 0 \
 {Open/sluit het PGN-notatie venster}
menuText N WindowsTmt "Toernooi Zoeker" 2 {Open/sluit het toernooi zoekvenster}
menuText N WindowsSwitcher  "Database wisselen" 0 \
  {Open/sluit het database-wisselen venster}
menuText N WindowsMaint "Onderhoudsvenster" 5 \
  {Open/sluit het onderhoudsvenster}
menuText N WindowsECO "ECO Browser" 0 {Open/sluit het ECO browser venster}
menuText N WindowsRepertoire "Repertoire editor" 0 {Open/sluit de openingsrepertoir editor}
menuText N WindowsStats "Statistiek" 0 \
  {Open/sluit het filter statieken-venster}
menuText N WindowsTree "Openingoverzicht" 0 {Open/sluit het zoekboom venster}
menuText N WindowsTB "Tablebase venster" 1 \
  {Open/sluit het Tablebase venster}

# Tools menu:
menuText N Tools "Gereedschappen" 0
menuText N ToolsAnalysis "Schaakprogramma..." 3 \
  {Start/stop een schaak-analyse programma}
menuText N ToolsAnalysis2 "Schaakprogramma #2..." 17 \
  {Start/stop een schaak-analyse programma}
menuText N ToolsCross "Kruistabel" 0 \
  {Toon toernooi-kruistabel voor huidige partij}
menuText N ToolsEmail "Email-Manager" 0 {Open/sluit het email venster}
menuText N ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText N ToolsOpReport "Openingen rapportage" 0 \
  {Genereer een openingsrapport voor de huidige positie}
menuText N ToolsTracker "Stuk Spoorvolger "  0 {Open het Stuk Spoorvolger venster}
menuText N ToolsPInfo "Speler Informatie"  7 \
  {Open/wijzig het spelerinformatievenster}
menuText N ToolsRating "Elo Klassering geschiedenis" 0 \
  {Grafiek van de Elo Klassering van de twee spelers}
menuText N ToolsScore "Partij score" 7 \
  {Laat het partij-score venster zien}
menuText N ToolsExpCurrent "Partij exporteren" 8 \
  {Exporteer huidige partij naar een bestand}
menuText N ToolsExpCurrentPGN "Partij in PGN-formaat exporteren..." 11 \
  {Schrijf huidige partij naar PGN-bestand}
menuText N ToolsExpCurrentHTML "Partij in HTML-formaat exporteren..." 11 \
  {Schrijf huidige partij naar HTML-bestand}
menuText N ToolsExpCurrentLaTeX "Partij in LaTeX-formaat exporteren..." 11 \
  {Schrijf huidige partij naar LaTex-bestand}
menuText N ToolsExpFilter "Alle partijen in filter exporteren" 17 \
  {Exporteer alle geslecteerde partijen naar een bestand}
menuText N ToolsExpFilterPGN "Filter in PGN-formaat exporteren..." 10 \
  {Schrijf selectie naar PGN-bestand}
menuText N ToolsExpFilterHTML "Filter in HTML-formaat exporteren..." 10 \
  {Schrijf selectie naar HTML-bestand}
menuText N ToolsExpFilterLaTeX "Filter in LaTeX-formaat exporteren..." 10 \
  {Schrijf selectie naar LaTex-bestand}
menuText N ToolsImportOne "Een PGN partij importeren..." 4 \
  {Importeer PGN partij}
menuText N ToolsImportFile "PGN database importeren..." 4 \
  {Importeer PGN bestand}

# Options menu:
menuText N Options "Opties" 0
menuText N OptionsSize "Grootte van bord" 0 {Wijzig bord grootte}
menuText N OptionsPieces "Bord Stukken Stijl" 6 \
  {Wijzig de stijl van bord en/of stukken}
menuText N OptionsColors "Kleuren..." 0 {Wijzig bord kleuren}
menuText N OptionsExport "Export" 1 {Wijzig tekst export opties}
menuText N OptionsFonts "Lettertypen" 0 {Wijzig lettertype}
menuText N OptionsFontsRegular "Standaard" 0 {Wijzig het standaard lettertype}
menuText N OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText N OptionsFontsSmall "Klein" 0 {Wijzig het kleine lettertype}
menuText N OptionsFontsFixed "Vaste grootte" 0 {Wijzig dit lettertype}
menuText N OptionsGInfo "Partij Informatie" 0 {Parij-informatie opties}
menuText N OptionsLanguage "Kies taal" 5 {Kies taal}
menuText N OptionsMoves "Zetten" 0 {Wijzig optie voor zet-invoer}
menuText N OptionsMovesAsk "Bevestiging voor overschrijven" 0 \
  {Bevestig het overschrijven van bestaande zetten}
menuText N OptionsMovesDelay "Tijdinstelling voor auto-spelen" 10 \
  {Stel de tijd in voor het automatisch spelen van de zetten}
menuText N OptionsMovesCoord "Zet-ingave" 0 \
  {Accepteer de volgende manier van zetten invoeren ("g1f3")}
menuText N OptionsMovesSuggest "Toon hint" 0 \
  {Schakel hints aan of uit}
menuText N OptionsMovesKey "Auto-aanvullen" 0 \
  {Aan/uitschakelen van toetsenbordzet auto-aanvullen}
menuText N OptionsNumbers "Getalformaat" 5 \
  {Kies de manier waarop getallen te zien zijn}
menuText N OptionsStartup "Opstarten" 3 {Selecteer de vensters die tijdens starten geopend worden}
menuText N OptionsWindows "Vensters" 0 {Venster opties}
menuText N OptionsWindowsIconify "Auto-icoon" 5 \
  {Breng alle vensters in icoonvorm als het hoofdvenster naar icoon gaat.}
menuText N OptionsWindowsRaise "Auto-voorgrond" 0 \
  {Breng sommige vensters terug op de voorgrond (bvb. voortgangsbalken) gelijk wanneer ze verdwijnen.}
menuText N OptionsToolbar "Gereedschappenbalk" 12 \
  {Weergeven/verbergen hoofdvenster gereedschappenbalk}
menuText N OptionsECO "ECO data laden..." 0 \
  {Laad het ECO classificatie bestand}
menuText N OptionsSpell "Laad spelling (namen)..." 5 \
  {Laad het Scid spellingbestand}
menuText N OptionsTable "Eindspel database laden..." 9 \
  {Kies een eindspel database, alle in de directory aanwezige worden gebruikt}
menuText N OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText N OptionsSave "Opties bewaren" 0 \
  "Bewaar alle instellingen in het bestand $::optionsFile"
menuText N OptionsAutoSave "Automatisch bewaren opties tijdens afsluiten" 0 \
  {Automatisch bewaren alle gewijzigde opties bij het afsluiten van Scid}

# Help menu:
menuText N Help "Help" 0
menuText N HelpIndex "Index" 0 {Toon de help inhouds pagina}
menuText N HelpGuide "Snelle hulp" 0 {Laat de snelle-hulp pagina zien}
menuText N HelpHints "Hints" 0 {Laat de hints-hulp pagina zien}
menuText N HelpContact "Contact-info" 0 {Laat de contact-infopagina zien}
menuText N HelpTip "Tip van de dag" 0 {Laat een handige Scid tip zien}
menuText N HelpStartup "Startvenster" 5 {Laat het startvenster zien}
menuText N HelpAbout "Over Scid" 0 {Informatie over Scid}

# Game info box popup menu:
menuText N GInfoHideNext "Verberg volgende zet" 0
menuText N GInfoMaterial "Materiaalverhouding" 0
menuText N GInfoFEN "FEN" 0
menuText N GInfoMarks "Toon gekleurde velden en pijlen. " 5
menuText N GInfoWrap "Lange regels op schermbreedte splitsen." 0
menuText N GInfoFullComment "Volledig commentaar weergeven" 10
menuText N GInfoTBNothing "Tablebases: niets" 12
menuText N GInfoTBResult "Tablebases: alleen resultaat" 12
menuText N GInfoTBAll "Tablebases: resultaat en beste zetten" 19
menuText N GInfoDelete "Partij wissen/terughalen" 9
menuText N GInfoMark "Partij markeren/niet markeren" 7

# Main windows buttons:
helpMsg N .button.start {Naar begin van partij  (toets: home)}
helpMsg N .button.end {Naar eind van partij  (toets: end)}
helpMsg N .button.back {Een zet terug   (toets: pijl links)}
helpMsg N .button.forward {Een zet vooruit  (toets: pijl rechts)}
helpMsg N .button.intoVar {Naar variant  (toets: v)}
helpMsg N .button.exitVar {Verlaat variant  (toets: z)}
helpMsg N .button.flip {Draai bord  (toets: .)}
helpMsg N .button.coords {Coordinaten aan/uit  (toets: 0)}
helpMsg N .button.autoplay {Speel zetten automatisch  (toets: Ctrl+Z)}

# General buttons:
translate N Back {Terug}
translate N Cancel {Annuleren}
translate N Clear {Leegmaken}
translate N Close {Sluiten}
translate N Defaults {Standaard}
translate N Delete {Wis}
translate N Graph {Grafiek}
translate N Help {Help}
translate N Import {Importeren}
translate N Index {Index}
translate N LoadGame {Partij laden}
translate N BrowseGame {Door de partij bladeren}
translate N MergeGame {Partij Samenvoegen}
translate N Preview {Proefbeeld}
translate N Revert {Terugkeren}
translate N Save {Bewaren}
translate N Search {Zoeken}
translate N Stop {Stop}
translate N Store {Opbergen}
translate N Update {Bijwerken}
translate N ChangeOrient {Wijzigen venster orientatie}
translate N None {Geen}
translate N First {Eerste}
translate N Current {Huidige}
translate N Last {Laatste}

# General messages:
translate N game {Partij}
translate N games {Partijen}
translate N move {Zet}
translate N moves {Zetten}
translate N all {Alle}
translate N Yes {Ja}
translate N No {Nee}
translate N Both {Beide}
translate N King {Koning}
translate N Queen {Dame}
translate N Rook {Toren}
translate N Bishop {Loper}
translate N Knight {Paard}
translate N Pawn {Pion}
translate N White {Wit}
translate N Black {Zwart}
translate N Player {Speler}
translate N Rating {Eloklassering}
translate N RatingDiff { EloklasseringsVerschil (Wit - Zwart)}
translate N Event {Evenement}
translate N Site {Plaats}
translate N Country {Land}
translate N IgnoreColors {Kleuren negeren}
translate N Date {Datum}
translate N EventDate {Datum evenement}
translate N Decade {Decade} ;# ***
translate N Year {Jaar}
translate N Month {Maand}
translate N Months {Januari Februari Maart April Mei Juni
  Juli Augustus September October November December}
translate N Days {Zon Maa Din Woe Don Vri Zat}
translate N YearToToday {Een jaar geleden}
translate N Result {Uitslag}
translate N Round {Ronde}
translate N Length {Lengte}
translate N ECOCode {ECO Code}
translate N ECO {ECO}
translate N Deleted {Verwijderd}
translate N SearchResults {Zoekresultaten}
translate N OpeningTheDatabase {Database aan het Openen}
translate N Database {Database}
translate N Filter {Filter}
translate N noGames {Geen partijen}
translate N allGames {Alle partijen}
translate N empty {leeg}
translate N clipbase {Klembord}
translate N score {Score}
translate N StartPos {Start positie}
translate N Total {Totaal}

# Game information:
translate N twin {Dubbele partijen}
translate N deleted {Gewist}
translate N comment {Commentaar}
translate N hidden {Verborgen}
translate N LastMove {Laatste zet}
translate N NextMove {Volgende zet}
translate N GameStart {Start partij}
translate N LineStart {Start variant}
translate N GameEnd {Einde partij}
translate N LineEnd {Einde variant}

# Player information:
translate N PInfoAll {Resultaten voor <b>alle</b> partijen}
translate N PInfoFilter {Resultaten voor <b>filter</b> partijen}
translate N PInfoAgainst {Resultaten tegen}
translate N PInfoMostWhite {Meest gespeelde opening als Wit}
translate N PInfoMostBlack {Meest gespeelde opening als Zwart}
translate N PInfoRating {Geschiedenis Elo Klassering}
translate N PInfoBio {Biografie}

# Tablebase information:
translate N Draw {Remise}
translate N stalemate {Pat}
translate N withAllMoves {met alle zetten}
translate N withAllButOneMove {alle zetten behalve n}
translate N with {met}
translate N only {alleen}
translate N lose {verliezen}
translate N loses {verliest}
translate N allOthersLose {alle overigen verliezen}
translate N matesIn {Mat in}
translate N hasCheckmated {geeft mat}
translate N longest {langste}

# Tip of the day:
translate N Tip {Tip}
translate N TipAtStartup {Tip bij opstarten}

# Tree window menus:
menuText N TreeFile "BoomDataBestand" 0
menuText N TreeFileSave " BoomData Bewaren" 0 {Bewaar de boomdata in een boomcache (.stc) bestand}
menuText N TreeFileFill "Vullen boomcache bestand" 0 \
  {Vul het boomcache bestand met algemene openingsposities}
menuText N TreeFileBest "Lijst beste partijen" 0 {Weergeven van de lijst met beste partijen}
menuText N TreeFileGraph "Grafiek-venster" 0 \
  {Weergeven van de grafiek voor deze tak}
menuText N TreeFileCopy "Kopieer boom tekst naar klembord" 0 \
  {Kopieren van de boomstatistieken naar het klembord}
menuText N TreeFileClose "Zoekboom venster sluiten" 0 {Sluiten van het zoekboom venster}
menuText N TreeSort "Sorteren" 0
menuText N TreeSortAlpha "Alfabetisch" 0
menuText N TreeSortECO "ECO code" 0
menuText N TreeSortFreq "Frequentie" 0
menuText N TreeSortScore "Punten" 0
menuText N TreeOpt "Opties" 0
menuText N TreeOptLock "Vergrendelen" 0 {Vergrendelen/Ontgrendelen van de boom bij de huidige database}
menuText N TreeOptTraining "Training" 0 {Aan/Uit zetten training modus}
menuText N TreeOptAutosave "Autom.cache-data Bewaren" 4 \
  {Automatisch bewaren van het cache bestand bij sluiten boomvenster}
menuText N TreeHelp "Help" 0
menuText N TreeHelpTree "Hulp bij zoekboom" 0
menuText N TreeHelpIndex "Index" 0
translate N SaveCache {Cache Bewaren}
translate N Training {Training}
translate N LockTree {Boom Vergrendelen}
translate N TreeLocked {Vergrendeld}
translate N TreeBest {Beste}
translate N TreeBestGames {Boom Beste partijen}

# Finder window:
menuText N FinderFile "Bestand" 0
menuText N FinderFileSubdirs "Kijken in subdirectories" 0
menuText N FinderFileClose "Sluiten bestandszoeker" 0
menuText N FinderSort "Sorteren" 0
menuText N FinderSortType "Type" 0
menuText N FinderSortSize "Grootte" 0
menuText N FinderSortMod "Gewijzigd" 0
menuText N FinderSortName "Naam" 0
menuText N FinderSortPath "Pad" 0
menuText N FinderTypes "Types" 0
menuText N FinderTypesScid "Scid databases" 0
menuText N FinderTypesOld "Oud formaat Scid databases" 0
menuText N FinderTypesPGN "PGN bestanden" 0
menuText N FinderTypesEPD "EPD (boek) bestanden" 0
menuText N FinderTypesRep "Repertorium bestanden" 0
menuText N FinderHelp "Help" 0
menuText N FinderHelpFinder "Bestandszoeker Help" 0
menuText N FinderHelpIndex " Bestandszoeker Help Inhoud" 0
translate N FileFinder {Bestandszoeker}
translate N FinderDir {Folder}
translate N FinderDirs {Folders}
translate N FinderFiles {Bestanden}
translate N FinderUpDir {Hogere Folder}

# Tournament finder:
menuText N TmtFile "Bestand" 0
menuText N TmtFileUpdate "Bijwerken" 0
menuText N TmtFileClose "Sluiten Toernooi zoeker" 0
menuText N TmtSort "Sorteren" 0
menuText N TmtSortDate "Datum" 0
menuText N TmtSortPlayers "Spelers" 0
menuText N TmtSortGames "Partijen" 0
menuText N TmtSortElo "Elo" 0
menuText N TmtSortSite "Plaats" 0
menuText N TmtSortEvent "Evenement" 1
menuText N TmtSortWinner "Winnaar" 0
translate N TmtLimit "Limiet Lijst"
translate N TmtMeanElo "Laagste gem. Elo"
translate N TmtNone "Geen toernooien gevonden."

# Graph windows:
menuText N GraphFile "Bestand" 0
menuText N GraphFileColor "Bewaren als kleuren Postscript..." 8
menuText N GraphFileGrey "Bewaren als grijze Postscript..." 8
menuText N GraphFileClose "Venster sluiten" 0
menuText N GraphOptions "Opties" 0
menuText N GraphOptionsWhite "Wit" 0
menuText N GraphOptionsBlack "Zwart" 0
menuText N GraphOptionsBoth "Beide" 1
menuText N GraphOptionsPInfo "Speler informatie" 0
translate N GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate N AddVariation {Toevoegen variant}
translate N AddMove {Toevoegen zet}
translate N Annotate {Annotatie}
translate N AnalysisCommand {Analyse commando}
translate N PreviousChoices {Voorgaande keuzes}
translate N AnnotateTime {Geef de analysetijd in seconden per zet}
translate N AnnotateWhich {Voeg varianten toe}
translate N AnnotateAll {Voor zetten van beide zijden}
translate N AnnotateWhite {Alleen voor zetten door Wit}
translate N AnnotateBlack { Alleen voor zetten door Zwart}
translate N AnnotateNotBest {Als de partijzet niet de beste is.}

# Analysis Engine open dialog:
translate N EngineList {Analyse Engine Lijst}
translate N EngineName {Naam}
translate N EngineCmd {Commando}
translate N EngineArgs {Parameters}
translate N EngineDir {Folder}
translate N EngineElo {Elo}
translate N EngineTime {Datum}
translate N EngineNew {Nieuw}
translate N EngineEdit {Bewerk}
translate N EngineRequired {Velden in <b>vet</b> zijn vereist; de andere facultatief}

# Stats window menus:
menuText N StatsFile "Bestand" 0
menuText N StatsFilePrint "Data als tekstbestand Bewaren..." 0
menuText N StatsFileClose "Venster sluiten" 0
menuText N StatsOpt "Opties" 0

# PGN window menus:
menuText N PgnFile "Bestand" 0
menuText N PgnFilePrint "Als pgn bestand Bewaren..." 0
menuText N PgnFileClose "PGN-venster sluiten" 0
menuText N PgnOpt "Opties" 0
menuText N PgnOptColor "Instellen kleuren" 10
menuText N PgnOptShort "Korte (3 regelige) kop" 0
menuText N PgnOptSymbols "Symbolen annotaties" 10
menuText N PgnOptIndentC "Inspringen (commentaar)" 12
menuText N PgnOptIndentV "Inspringen (variant)" 12
menuText N PgnOptColumn "Kolom stijl (een zet per regel)" 0
menuText N PgnOptSpace "Spatie na zetnummer" 0
menuText N PgnOptStripMarks "Verwijder gekleurde vierkante haken codes" 1
menuText N PgnColor "Kleuren" 0
menuText N PgnColorHeader "Kop..." 0
menuText N PgnColorAnno "Annotaties..." 0
menuText N PgnColorComments "Commentaar..." 0
menuText N PgnColorVars "Varianten..." 0
menuText N PgnColorBackground "Achtergrond kleur..." 0
menuText N PgnHelp "Help" 0
menuText N PgnHelpPgn "PGN help" 0
menuText N PgnHelpIndex "Inhoud" 0

# Crosstable window menus:
menuText N CrosstabFile "Bestand" 0
menuText N CrosstabFileText "Bewaren in tekstformaat..." 13
menuText N CrosstabFileHtml " Bewaren in HTML-formaat..." 13
menuText N CrosstabFileLaTeX " Bewaren in LaTeX-formaat..." 13
menuText N CrosstabFileClose "Kruistabel sluiten" 0
menuText N CrosstabEdit "Bewerken" 0
menuText N CrosstabEditEvent "Evenement" 0
menuText N CrosstabEditSite "Plaats" 0
menuText N CrosstabEditDate "Datum" 0
menuText N CrosstabOpt "Opties" 0
menuText N CrosstabOptAll "Gesloten" 0
menuText N CrosstabOptSwiss "Zwitsers" 0
menuText N CrosstabOptKnockout "Knockout" 0
menuText N CrosstabOptAuto "Auto" 0
menuText N CrosstabOptAges "Leeftijd in jaren" 8
menuText N CrosstabOptNats "Nationaliteiten" 1
menuText N CrosstabOptRatings "Elo" 0
menuText N CrosstabOptTitles "Titels" 0
menuText N CrosstabOptBreaks "Tie-break scores" 4
menuText N CrosstabOptDeleted "Inclusief gewiste partijen" 8
menuText N CrosstabOptColors "Kleuren (alleen bij Zwitsers)" 0
menuText N CrosstabOptColumnNumbers "Genummerde kolommen (Alleen bij gesloten tabel)" 2
menuText N CrosstabOptGroup "Punten (groep)" 0
menuText N CrosstabSort "Sorteren" 0
menuText N CrosstabSortName "Naam" 0
menuText N CrosstabSortRating "Elo" 0
menuText N CrosstabSortScore "Score" 0
menuText N CrosstabColor "Kleuren" 0
menuText N CrosstabColorPlain "Tekst" 0
menuText N CrosstabColorHyper "Hypertekst" 1
menuText N CrosstabHelp "Help" 0
menuText N CrosstabHelpCross "Help (kruistabel)" 0
menuText N CrosstabHelpIndex "Inhoud" 0
translate N SetFilter {Zet Filter}
translate N AddToFilter {Toevoegen aan selectie}
translate N Swiss {Zwitsers}

# Opening report window menus:
menuText N OprepFile "Bestand" 0
menuText N OprepFileText "Bewaren in tekstformaat..." 13
menuText N OprepFileHtml " Bewaren in HTML-formaat..." 13
menuText N OprepFileLaTeX " Bewaren in LaTeX-formaat..." 13
menuText N OprepFileOptions "Opties..." 0
menuText N OprepFileClose "Sluit rapportvenster" 0
menuText N OprepHelp "Help" 0
menuText N OprepHelpReport "Help (openingsrapport)" 0
menuText N OprepHelpIndex "Inhoud" 0

# Repertoire editor:
menuText N RepFile "Bestand" 0
menuText N RepFileNew "Nieuw" 0
menuText N RepFileOpen "Openen..." 0
menuText N RepFileSave "Bewaren..." 0
menuText N RepFileSaveAs "Bewaren als..." 5
menuText N RepFileClose "Sluit venster" 2
menuText N RepEdit "Bewerken" 0
menuText N RepEditGroup "Toevoegen Groep" 4
menuText N RepEditInclude "Toevoegen inclusief variant" 4
menuText N RepEditExclude "Toevoegen exclusief variant" 4
menuText N RepView "Bekijken" 0
menuText N RepViewExpand "Uitklappen alle groepen" 0
menuText N RepViewCollapse "Inklappen alle groepen" 0
menuText N RepSearch "Selecteren" 0
menuText N RepSearchAll "Alles van repertorium..." 0
menuText N RepSearchDisplayed "Alleen weergegeven varianten..." 0
menuText N RepHelp "Help" 0
menuText N RepHelpRep "Repertorium help" 0
menuText N RepHelpIndex "Inhoud" 0
translate N RepSearch "Zoeken repertorium"
translate N RepIncludedLines "inclusief varianten"
translate N RepExcludedLines "exclusief varianten"
translate N RepCloseDialog {Dit repetorium heeft onopgeslagen wijzigingen.

Wilt u echt doorgaan en de wijzigingen niet Bewaren?
}

# Header search:
translate N HeaderSearch {Zoek naar kop}
translate N GamesWithNoECO {Partijen zonder ECO?}
translate N GameLength {Lengte partij}
translate N FindGamesWith {Vind partijen met vlag}
translate N StdStart {Ab-normaal begin}
translate N Promotions {Promoties}
translate N Comments {Commentaar}
translate N Variations {Varianten}
translate N Annotations {Annotaties}
translate N DeleteFlag {Gewist-markeringen}
translate N WhiteOpFlag {Wit opening}
translate N BlackOpFlag {Zwart opening}
translate N MiddlegameFlag {Middenspel}
translate N EndgameFlag {Eindspel}
translate N NoveltyFlag {Nieuwtje}
translate N PawnFlag {Pionnenstructur}
translate N TacticsFlag {Tactiek}
translate N QsideFlag {Damevleugel}
translate N KsideFlag {Koningsvleugel}
translate N BrilliancyFlag {Briljant}
translate N BlunderFlag {Blunder}
translate N UserFlag {Gebruiker}
translate N PgnContains {PGN bevat tekst}

# Game list window:
translate N GlistNumber {Nummer}
translate N GlistWhite {Wit}
translate N GlistBlack {Zwart}
translate N GlistWElo {W-Elo}
translate N GlistBElo {Z-Elo}
translate N GlistEvent {Evenement}
translate N GlistSite {Plaats}
translate N GlistRound {Ronde}
translate N GlistDate {Datum}
translate N GlistYear {Jaar}
translate N GlistEDate {Datum evenement}
translate N GlistResult {Uitslag}
translate N GlistLength {Lengte}
translate N GlistCountry {Country}
translate N GlistECO {ECO}
translate N GlistOpening {Opening}
translate N GlistEndMaterial {Eind-Material}
translate N GlistDeleted {Verwijderd}
translate N GlistFlags {Markeringen}
translate N GlistVars {Varianten}
translate N GlistComments {Commentaar}
translate N GlistAnnos {Annotaties}
translate N GlistStart {Start}
translate N GlistGameNumber {Partij nummer}
translate N GlistFindText {Tekst vinden}
translate N GlistMoveField {Zet}
translate N GlistEditField {Configuratie}
translate N GlistAddField {Voeg toe}
translate N GlistDeleteField {Verwijder}
translate N GlistWidth {Breedte}
translate N GlistAlign {Uitlijnen}
translate N GlistColor {Kleuren}
translate N GlistSep {Separator}

# Maintenance windows
translate N DatabaseName {Naam database:}
translate N TypeIcon {Type icoon:}
translate N NumOfGames {Partijen:}
translate N NumDeletedGames {Gewiste partijen:}
translate N NumFilterGames {Partijen in selectie:}
translate N YearRange {JaarBereik:}
translate N RatingRange {EloBereik (laag/hoog):}
translate N Flag {Markering}
translate N DeleteCurrent {Wis huidige partij}
translate N DeleteFilter {Wis geselecteerde partijen}
translate N DeleteAll {Wis alle partijen}
translate N UndeleteCurrent {Haal huidige partij terug}
translate N UndeleteFilter {Haal geselecteerde partijen terug}
translate N UndeleteAll {Haal alle partijen terug}
translate N DeleteTwins {Wis doublures}
translate N MarkCurrent {Markeer huidige partij}
translate N MarkFilter {Markeer geselecteerde partijen}
translate N MarkAll {Markeer alle partijen}
translate N UnmarkCurrent {Verwijder Markering huidige partij)}
translate N UnmarkFilter {Verwijder Markering geselecteerde partijen)}
translate N UnmarkAll {Verwijder Markering alle partijen)}
translate N Spellchecking {Spellingscontrole}
translate N Players {Spelers}
translate N Events {Evenementen}
translate N Sites {Plaatsen}
translate N Rounds {Rondes}
translate N DatabaseOps {Database bewerkingen}
translate N ReclassifyGames {Partijen ECO-classificeren...}
translate N CompactDatabase {Database compact maken = optimaliseren}
translate N SortDatabase {Database sorteren}
translate N AddEloRatings {Toevoegen Elo classificatie}
translate N AutoloadGame {Auto-laden partij nummer}
translate N StripTags {Strip PGN tags} ;# ***
translate N StripTag {Strip tag} ;# ***
translate N Cleaner {Reiniger}
translate N CleanerHelp {
De Scid Reiniger zal alle onderhoudsactiviteiten die u selecteert uit onderstaande lijst, uitvoeren op de huidige database. 
De dialogen van de huidige instellingen in de ECO classificatie en verwijderen van doublures zullen worden toegepast indien u deze functies selecteert.
}
translate N CleanerConfirm {
Eens het Reiniger onderhoud is gestart, kan dit niet worden onderbroken!

Dit kan lang duren op een grote database, afhankelijk van de geselecteerde functies en de huidige instellingen.

Weet u zeker dat u de geselecteerde onderhoudsfuncties wilt uitvoeren?
}

# Comment editor:
translate N AnnotationSymbols  {Symbolen voor annotatie:}
translate N Comment {Commentaar:}

# Board search:
translate N BoardSearch {Zoeken Bord}
translate N FilterOperation {Toepassen op huidige selectie:}
translate N FilterAnd {AND (Selectie beperken)}
translate N FilterOr {OR (Selectie uitbreiden)}
translate N FilterIgnore {Selectie Ongedaan maken}
translate N SearchType {Zoek type stelling:}
translate N SearchBoardExact {Exacte positie (stukken op dezelfde velden)}
translate N SearchBoardPawns {Pionnen (hetzelfde materiaal, alle pionnen op dezelfde velden)}
translate N SearchBoardFiles {Lijnen (hetzelfde materiaal, alle pionnen op dezelfde lijnen)}
translate N SearchBoardAny {Willekeurig (hetzelfde materiaal, pionnen en stukken willekeurig)}
translate N LookInVars {Zoek in varianten}

# Material search:
translate N MaterialSearch {Zoeken Materiaal}
translate N Material {Materiaal}
translate N Patterns {Patroon}
translate N Zero {Niets}
translate N Any {Willekeurig}
translate N CurrentBoard {Huidige stelling}
translate N CommonEndings {Veel Voorkomende Eindspelen}
translate N CommonPatterns { Veel Voorkomende patronen}
translate N MaterialDiff {Material onevenwicht}
translate N squares {Velden}
translate N SameColor {Gelijke kleur}
translate N OppColor {Ongelijke kleur}
translate N Either {Beide}
translate N MoveNumberRange {Zet bereik }
translate N MatchForAtLeast {Op z'n minst gelijk}
translate N HalfMoves {halve zetten}

# Game saving:
translate N Today {Nu}
translate N ClassifyGame {Partij classificeren}

# Setup position:
translate N EmptyBoard {Bord leegmaken}
translate N InitialBoard {Beginstelling}
translate N SideToMove {Aan zet:}
translate N MoveNumber {Zetnummer}
translate N Castling {Rokade}
translate N EnPassentFile {En Passant lijn}
translate N ClearFen {FEN leegmaken}
translate N PasteFen {FEN plakken}

# Replace move dialog:
translate N ReplaceMove {Zet vervangen}
translate N AddNewVar {Voeg Nieuwe Variant Toe}
translate N ReplaceMoveMessage {Hier is al een zet.  

U kunt hem vervangen en alle volgende zetten wissen, of uw zet toevoegen als een nieuwe variant.

(U kunt deze boodschap in de toekeomst vermijden door de optie "Zet vervangen bevestigen" uit te zetten in het menu:Zetten)}

# Make database read-only dialog:
translate N ReadOnlyDialog {Als u deze database "alleen-lezen" maakt, zijn geen veranderingen toegestaan.
Er kunnen geen partijen meer worden opgeslagen of veranderd en ook geen wis-markeringen toegevoegd of verwijderd.
Elke sortering of ECO-classificering zal tijdelijk zijn dan voor deze database.

U kunt de database weer schrijf-toegankelijk maken door hem te sluiten en weer te openen.

Wilt u echt deze database alleen-lezen maken?}

# Clear game dialog:
translate N ClearGameDialog {Deze partij is gewijzigd.

Wilt u echt doorgaan en de wijzigingen niet doorvoeren?
}

# Exit dialog:
translate N ExitDialog {Wilt u Scid werkelijk afsluiten?}
translate N ExitUnsaved {De volgende databases hebben nog onopgeslagen wijzigingen in hun partijen.  Als u nu afsluit zullen deze wijzigingen verloren gaan.}

# Import window:
translate N PasteCurrentGame {Plak huidige partij}
translate N ImportHelp1 {Invoeren of plak een PGN-formaat partij in het venster hierboven.}
translate N ImportHelp2 {Alle import-fouten worden hier weergegeven.}

# ECO Browser:
translate N ECOAllSections {alle ECO code secties}
translate N ECOSection {ECO sectie}
translate N ECOSummary {Samenvatting voor}
translate N ECOFrequency {Frequentie van subcodes voor}

# Opening Report:
translate N OprepTitle {Openings Rapportage}
translate N OprepReport {Rapportage}
translate N OprepGenerated {Samengesteld door }
translate N OprepStatsHist {Statistieken en Geschiedenis}
translate N OprepStats {Statistieken}
translate N OprepStatAll {Alle Rapportage Partijen}
translate N OprepStatBoth {Beide Spelers Elo}
translate N OprepStatSince {Sinds}
translate N OprepOldest {Oudste partijen}
translate N OprepNewest {Meest recente partijen}
translate N OprepPopular {Huidige Populariteit}
translate N OprepFreqAll {Frequentie over alle jaren: }
translate N OprepFreq1   {In het afgelopen jaar:      }
translate N OprepFreq5   {In de afgelopen 5 jaar:    }
translate N OprepFreq10  {In de afgelopen 10 jaar:    }
translate N OprepEvery {Eens per %u partijen}
translate N OprepUp {%u%s hoger dan alle jaren}
translate N OprepDown {%u%s lager dan alle jaren}
translate N OprepSame {zelfde als alle jaren}
translate N OprepMostFrequent {Meest frequente spelers}
translate N OprepRatingsPerf {Elo Classificatie en Resultaten}
translate N OprepAvgPerf {Gemiddelde Elo Classificatie en Resultaten }
translate N OprepWRating {Witte Elo Classificatie }
translate N OprepBRating {Zwarte Elo Classificatie }
translate N OprepWPerf {Prestatie wit}
translate N OprepBPerf {Prestatie zwart}
translate N OprepHighRating {Partijen met de hoogste gemiddelde Elo Classificatie }
translate N OprepTrends {Resultaten trends}
translate N OprepResults {Resultaat lengtes en frequenties}
translate N OprepLength {Partij lengte}
translate N OprepFrequency {Frequentie}
translate N OprepWWins {Overwinningen wit:   }
translate N OprepBWins {Overwinningen zwart: }
translate N OprepDraws {Remises: }
translate N OprepWholeDB {hele database}
translate N OprepShortest {Kortste winst}
# translate N OprepShortWhite {Kortste witte overwinningen}
# translate N OprepShortBlack {Kortste zwarte overwinningen}
translate N OprepMovesThemes {Zetten en thema's}
translate N OprepMoveOrders {Zetvolgorde om rapportstelling te bereiken}
translate N OprepMoveOrdersOne \
  {Er was slechts 1 volgorde om deze stelling te bereiken:}
translate N OprepMoveOrdersAll \
  {Er waren %u zet-volgordes om deze stelling te bereiken:}
translate N OprepMoveOrdersMany \
  {Er waren %u zet-volgordes om deze stelling te bereiken. De top %u zijn:}
translate N OprepMovesFrom {Zetten vanuit de rapportpositie:}
translate N OprepThemes {Positionnele Thema's}
translate N OprepThemeDescription {Frequentie van thema's bij zet %u:}
translate N OprepThemeSameCastling {Gelijke rochades}
translate N OprepThemeOppCastling {Tegengestelde rochades}
translate N OprepThemeNoCastling {Beide zijden niet gerocheerd}
translate N OprepThemeKPawnStorm {Pionnenstorm op koningsvleugel}
translate N OprepThemeQueenswap {Dameruil}
translate N OprepThemeIQP {Gesoleerde d-pion}
translate N OprepThemeWP567 {Witte pion op de 5/6/7de rij}
translate N OprepThemeBP234 {Zwarte pion op de 2/3/4de rij}
translate N OprepThemeOpenCDE {Open c/d/e lijn}
translate N OprepTheme1BishopPair {Slechts 1 kant heeft loperpaar}
translate N OprepEndgames {Eindspelen}
translate N OprepReportGames {Rapportage partijen}
translate N OprepAllGames {Alle partijen}
translate N OprepEndClass {Materiaal classificatie van eindstellingen}
translate N OprepTheoryTable {Theorie tabel}
translate N OprepTableComment {Samengesteld uit de %u partijen met de hoogste Elo classificatie.}
translate N OprepExtraMoves {Extra zetten in theorie tabel}
translate N OprepMaxGames {Maximaal aantal partijen in theorie tabel}

# Piece Tracker window:
translate N TrackerSelectSingle {Linkse muisknop selecteert dit stuk.}
translate N TrackerSelectPair { Linkse muisknop selecteert dit stuk; de rechtermuisknop selecteert zijn buur.}
translate N TrackerSelectPawn { Linkse muisknop selcteert deze pion; ; de rechtermuisknop selecteert alle 8 pionnen.}
translate N TrackerStat {Statistiek}
translate N TrackerGames {% partijen met zet naar dit veld.}
translate N TrackerTime {% keer op ieder veld.}
translate N TrackerMoves {Zetten}
translate N TrackerMovesStart {Voer de zet in waar de Spoorvolger moet beginnen.}
translate N TrackerMovesStop { Voer de zet in waar de Spoorvolger moet stoppen.}

# Game selection dialogs:
translate N SelectAllGames {Alle partijen in de database}
translate N SelectFilterGames {Alleen partijen uit selectiefilter}
translate N SelectTournamentGames {Alleen partijen in huidig toernooi}
translate N SelectOlderGames {Alleen oudere partijen}

# Delete Twins window:
translate N TwinsNote {Om een dubbele partij te zijn moet deze minimaal dezelfde twee spelers en de onderstaande te selecteren criteria bevatten. Bij vondst van twee dubbele partijen wordt de kortste verwijderd.
Hint: Controleer de database op spelfouten voordat doublures worden verwijderd. Dit verhoogt de kans op vinden van dubbele partijen. }
translate N TwinsCriteria {Criteria: Dubbele partijen moeten hebben...}
translate N TwinsWhich {Onderzoek welke partijen}
translate N TwinsColors {Spelers dezelfde kleur?}
translate N TwinsEvent {Hetzelfde evenement?}
translate N TwinsSite {Dezelfde lokatie?}
translate N TwinsRound {Dezelfde ronde?}
translate N TwinsYear {Hetzelfde jaar?}
translate N TwinsMonth {Dezelfde maand?}
translate N TwinsDay {Dezelfde dag?}
translate N TwinsResult {Hetzelfde resultaat?}
translate N TwinsECO {Dezelfde ECO code?}
translate N TwinsMoves {Dezelfde zetten?}
translate N TwinsPlayers {Vergelijken speler namen:}
translate N TwinsPlayersExact {Exacte overeenkomst}
translate N TwinsPlayersPrefix {Alleen eerste 4 letters}
translate N TwinsWhen {Wanner doublures verwijderen}
translate N TwinsSkipShort {Negeer alle partijen korter dan 5 zetten?}
translate N TwinsUndelete {Haal alle voor wissen gemarkeerde partijen eerst terug?}
translate N TwinsSetFilter {Selecteer alle verwijderde dubbele partijen?}
translate N TwinsComments {Altijd partijen met commentaar bewaren?}
translate N TwinsVars {Altijd partijen met varianten bewaren?}
translate N TwinsDeleteWhich {Welke partij wissen:}
translate N TwinsDeleteShorter {Kortste partij}
translate N TwinsDeleteOlder {Laagste partijnummer}
translate N TwinsDeleteNewer {Hoogste partijnummer}
translate N TwinsDelete {Verwijder partijen}

# Name editor window:
translate N NameEditType {Type naam om te wijzigen}
translate N NameEditSelect {Partijen om te wijzigen}
translate N NameEditReplace {Vervangen}
translate N NameEditWith {met}
translate N NameEditMatches {Gelijken: Druk Ctrl+1 tot Ctrl+9 om te selecteren}

# Classify window:
translate N Classify {Classificeren}
translate N ClassifyWhich {ECO-Classificatie: welke partijen}
translate N ClassifyAll {Alle partijen (overschrijven oude ECO codes)}
translate N ClassifyYear {Alle partijen gespeeld in het afgelopen jaar}
translate N ClassifyMonth {Alle partijen gespeeld in de afgelopen maand}
translate N ClassifyNew {Alleen partijen zonder ECO code}
translate N ClassifyCodes {ECO Codes om te gebruiken}
translate N ClassifyBasic {Alleen basis codes ("B12", ...)}
translate N ClassifyExtended {Scid extenties ("B12j", ...)}

# Compaction:
translate N NameFile {Namen Bestand}
translate N GameFile {Partijen Bestand}
translate N Names {Namen}
translate N Unused {Ongebruikt}
translate N SizeKb {Grootte (Kb)}
translate N CurrentState {Huidige toestand}
translate N AfterCompaction {Na comprimeren}
translate N CompactNames {Gecomprimeerde namen bestand}
translate N CompactGames {Gecomprimeerd partijen bestand}

# Sorting:
translate N SortCriteria {Criteria}
translate N AddCriteria {Toevoegen criteria}
translate N CommonSorts {Algemene sorteringen}
translate N Sort {Sorteren}

# Exporting:
translate N AddToExistingFile {Toevoegen partijen aan bestaand bestand?}
translate N ExportComments {Exporteren commentaar?}
translate N ExportVariations {Exporteren varianten?}
translate N IndentComments {Inspringen commentaar?}
translate N IndentVariations {Inspringen varianten?}
translate N ExportColumnStyle {Kolomstijl (een zet per regel)?}
translate N ExportSymbolStyle {Symbolische annotatie stijl:}
translate N ExportStripMarks {Wis vierkante haken/pijlen markeer codes uit de commentaar?}

# Goto game/move dialogs:
translate N LoadGameNumber {Geef het nummer van de te laden partij:}
translate N GotoMoveNumber {Ga naar zetnummer:}

# Copy games dialog:
translate N CopyGames {Kopiren partijen}
translate N CopyConfirm {
 Wilt u echt kopieren
 de [thousands $nGamesToCopy] geselecteerde partijen
 van database "$fromName"
 naar database "$targetName"?
}
translate N CopyErr {Kan partijen niet kopieren}
translate N CopyErrSource {de bron database}
translate N CopyErrTarget {de doel database}
translate N CopyErrNoGames {heeft geen partijen in het filter}
translate N CopyErrReadOnly {is alleen-lezen}
translate N CopyErrNotOpen {is niet geopend}

# Colors:
translate N LightSquares {Lichte velden}
translate N DarkSquares {Donkere velden}
translate N SelectedSquares {Geselecteerde velden}
translate N SuggestedSquares {Zetsuggestie velden}
translate N WhitePieces {Witte stukken}
translate N BlackPieces {Zwarte stukken}
translate N WhiteBorder {Witte rand}
translate N BlackBorder {Zwarte rand}

# Novelty window:
translate N FindNovelty {Vind Nieuwtje}
translate N Novelty {Nieuwtje}
translate N NoveltyInterrupt {Zoeken nieuwtje onderbroken}
translate N NoveltyNone {In deze partij is geen nieuwtje gevonden}
translate N NoveltyHelp {
Scid zal de eerste zet vinden in de huidige partij, waarna een stelling ontstaat die nog niet was gevonden in de database of in het ECO openingsboek.
}

# Upgrading databases:
translate N Upgrading {Bijwerken}
translate N ConfirmOpenNew {
Dit is een oud formaat (Scid 2) database welke in Scid 3 niet kan worden geopend. Maar een nieuwe versie (Scid 3) is reeds aangemaakt.

Wilt u de database in het nieuwe formaat openen?
}
translate N ConfirmUpgrade {
Dit is een oud formaat (Scid 2) database. Een versie in het nieuwe formaat moet worden gemaakt, voordat het in Scid 3 kan worden gebruikt.

Bijwerken creert een nieuwe versie van de database. De originele bestanden blijven bestaan en worden niet gewijzigd.

Dit kan enige tijd duren, maar het hoeft slechts eenmalig plaats te vinden. U kunt het afbreken indien het te lang duurt.

Wilt u de database nu bijwerken?
}

# Recent files options:
translate N RecentFilesMenu {Number of recent files in File menu} ;# ***
translate N RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# End of nederlan.tcl
# spanish.tcl:
# Spanish translations for Scid.
# Contributed by Jordi Gonzlez Boada.

addLanguage S Espanol 1

proc setLanguage_S {} {

# File menu:
menuText S File "Archivo" 0
menuText S FileNew "Nuevo..." 0 {Crea una nueva base de datos Scid vaca}
menuText S FileOpen "Abrir..." 1 {Abre una base de datos Scid ya existente}
menuText S FileClose "Cerrar" 0 {Cierra la base de datos Scid activa}
menuText S FileFinder "Visor..." 0 {Abre la ventana del visor de Archivos}
menuText S FileBookmarks "Bookmarks" 0 {Bookmarks menu (shortcut: Ctrl+B)}
menuText S FileBookmarksAdd "Aadir marcador" 0 \
  {Seala la partida y posicin actual de la base de datos}
menuText S FileBookmarksFile "Archivar marcador" 8 \
  {Archiva un marcador para la partida y posicin actual}
menuText S FileBookmarksEdit "Editar marcadores..." 0 \
  {Edita los menus de los marcadores}
menuText S FileBookmarksList "Mostrar las corpetas en una sola lista" 0 \
  {Muestrar las corpetas de marcadores en una sola lista, sin submenus}
menuText S FileBookmarksSub "Mostrar carpetas como submenus" 0 \
  {Muestrar las corpetas de marcadores como submenus, no una sola lista}
menuText S FileMaint "Mantenimiento" 0 \
  {Herramientas de mantenimiento de la base de datos Scid}
menuText S FileMaintWin "Ventana de mantenimiento" 0 \
  {Abre/cierra la ventana de mantenimiento de la base de datos Scid}
menuText S FileMaintCompact "Compactar base de datos..." 0 \
  {Compacta los archivos de la base de datos, quitando partidas borradas y nombres no usados}
menuText S FileMaintClass "Clasificar partidas por ECO..." 24 \
  {Recalcula el cdigo ECO de todas las partidas}
menuText S FileMaintSort "Ordenar base de datos..." 0 \
  {Ordena todas las partidas de la base de datos}
menuText S FileMaintDelete "Borrar partidas dobles..." 0 \
  {Encuentra partidas dobles y las coloca para ser borradas}
menuText S FileMaintTwin "Ventana de inspeccin de dobles" 11 \
  {Abre/actualiza la ventana de inspeccin de dobles}
menuText S FileMaintName "Ortografa de nombres" 0 {Herramientas de ortografa y edicin de nombres}
menuText S FileMaintNameEditor "Ventana de edicin de nombres" 22 \
  {Abre/cierra la ventana de edicin de nombres}
menuText S FileMaintNamePlayer "Comprobacin ortogrfica de nombres de jugadores..." 39 \
  {Comprobacin ortogrfica de jugadores usando archivo de comprobacin ortogrfica}
menuText S FileMaintNameEvent "Comprobacin ortogrfica de nombres de eventos..." 39 \
  {Comprobacin ortogrfica de eventos usando el archivo de comprobacin ortogrfica}
menuText S FileMaintNameSite "Comprobacin ortogrfica de nombres de lugares..." 39 \
  {Comprobacin ortogrfica de lugares usando el archivo de comprobacin ortogrfica}
menuText S FileMaintNameRound "Comprobacin ortogrfica de rondas..." 28 \
  {Comprobacin ortogrfica de rondas usando el archivo de comprobacin ortogrfica}
menuText S FileReadOnly "Slo lectura..." 5 \
  {Trata la actual base de datos como de slo lectura, previniendo cambios}
menuText S FileExit "Salir" 0 {Salir de Scid}

# Edit menu:
menuText S Edit "Editar" 0
menuText S EditAdd "Aadir variacin" 0 \
  {Aade una variacin a este movimiento en la partida}
menuText S EditDelete "Borrar variacin" 0 {Borra variacin para este movimiento}
menuText S EditFirst "Convertir en primera variacin" 0 \
  {Hace que una variacin sea la primera en la lista}
menuText S EditMain "Variacin a lnea principal" 0 \
   {Promover una variacin para que sea la lnea principal}
menuText S EditTrial "Probar variacin" 1 \
  {Inicia/para el modo de prueba, para ensayar una idea en el tablero}
menuText S EditStrip "Eliminar" 2 \
  {Eliminar comentarios o variaciones de esta partida}
menuText S EditStripComments "Comentarios" 0 \
  {Strip all comments and annotations from this game}
menuText S EditStripVars "Variaciones" 0 {Strip all variations from this game}
menuText S EditReset "Poner a cero la base de trabajo" 0 \
  {Pone a cero la base de trabajo (clipbase) para que est completamente vaca}
menuText S EditCopy "Copiar esta partida a la base de trabajo" 1 \
  {Copia esta partida a la base de trabajo (clipbase)}
menuText S EditPaste "Pegar la ltima partida de la base de trabajo" 2 \
  {Pega la partida activa en la base de trabajo (clipbase) aqu}
menuText S EditSetup "Iniciar tablero de posicin..." 26 \
  {Inicia el tablero de posicin con la posicin de la partida}
menuText S EditPasteBoard "Pegar tablero inicial" 6 \
  {Coloca el tablero inicial de la seleccin de texto actual (clipboard)}

# Game menu:
menuText S Game "Partida" 0
menuText S GameNew "Limpiar partida" 0 \
  {Vuelve a una partida limpia, descartando cualquier cambio}
menuText S GameFirst "Cargar primera partida" 7 {Carga la primera partida filtrada}
menuText S GamePrev "Cargar partida anterior" 16 {Carga la anterior partida filtrada}
menuText S GameReload "Recargar partida actual" 0 \
  {Vuelve a cargar esta partida, descartando cualquier cambio hecho}
menuText S GameNext "Cargar siguiente partida" 7 {Carga la siguiente partida filtrada}
menuText S GameLast "Cargar ltima partida" 9 {Carga la ltima partida filtrada}
menuText S GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText S GameNumber "Cargar partida nmero..." 3 \
  {Carga una partida poniendo su nmero}
menuText S GameReplace "Guardar: Reemplazar partida..." 10 \
  {Guarda esta partida, reemplazando la antigua versin}
menuText S GameAdd "Guardar: Aadir nueva partida..." 9 \
  {Guarda esta partida como una nueva partida en la base de datos}
menuText S GameDeepest "Identificar apertura" 1 \
  {Va a la posicin ms avanzada de la partida segn el libro ECO}
menuText S GameGotoMove "Ir al movimiento nmero..." 6 \
  {Ir al nmero de movimiento especificado en la partida actual}
menuText S GameNovelty "Encontrar Novedad..." 12 \
  {Encuentra el primer movimiento de esta partida que no se ha jugado antes}

# Search Menu:
menuText S Search "Buscar" 0
menuText S SearchReset "Poner a cero el filtro" 0 \
  {Poner a cero el filtro para que todas la partidas estn incluidas}
menuText S SearchNegate "Invertir filtro" 0 \
  {Invierte el filtro para slo incluir las partidas excluidas}
menuText S SearchCurrent "Tablero actual..." 0 \
  {Busca por la posicin actual del tablero}
menuText S SearchHeader "Encabezamiento..." 0 \
  {Busca por informacin de encabezamiento (jugador, evento, etc)}
menuText S SearchMaterial "Material/Patrn..." 0 \
  {Busca por material o patrn del tablero}
menuText S SearchUsing "Usar archivo de bsqueda..." 0 \
  {Busca usando un archivo de opciones de bsqueda}

# Windows menu:
menuText S Windows "Ventanas" 0
menuText S WindowsComment "Editor de comentarios" 0 \
  {Abre/cierra el editor de comentarios}
menuText S WindowsGList "Listado de partidas" 0 \
  {Abre/cierra la  ventana de listado de partidas}
menuText S WindowsPGN "Ventana PGN" 8 \
  {Abre/cierra la ventana de PGN (notacin de partida)}
menuText S WindowsTmt "Visor de Torneos" 9 {Abre/cierra el visor de torneos}
menuText S WindowsSwitcher "Intercambiador de bases de datos" 0 \
  {Abre/cierra la ventana del intercambiador de bases de datos}
menuText S WindowsMaint "Ventana de mantenimiento" 11 \
  {Abre/cierra la ventana de mantenimiento}
menuText S WindowsECO "Buscador ECO" 0 {Abre/cierra la ventana del buscador ECO}
menuText S WindowsRepertoire "Editor de repertorio" 10 \
  {Abrir/cerrar el editor de repertorio de aperturas}
menuText S WindowsStats "Ventana de estadsticas" 12 \
  {Abre/cierra la ventana de estadsticas del filtro}
menuText S WindowsTree "Ventana de rbol" 6 {Abre/cierra la ventana de rbol}
menuText S WindowsTB "Ventana de TBs" 8 \
  {Abre/cierra la ventana de TBs}

# Tools menu:
menuText S Tools "Herramientas" 0
menuText S ToolsAnalysis "Motor de anlisis..." 0 \
  {Inicia/para el anlisis de un motor de ajedrez}
menuText S ToolsAnalysis2 "Motor de anlisis #2..." 18 \
  {Inicia/para el anlisis de un motor de ajedrez}
menuText S ToolsCross "Tabla cruzada" 0 {Muestra la tabla cruzada para esta partida}
menuText S ToolsEmail "Administrador de Email" 0 \
  {Abre/cierra la ventana del administrador de Email}
menuText S ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText S ToolsOpReport "Informe de la apertura" 1 \
  {Crea un informe de la apertura para la posicin actual}
menuText S ToolsTracker "Piece Tracker"  0 {Open the Piece Tracker window} ;# ***
menuText S ToolsPInfo "Informacin del Jugador" 16 \
  {Abrir/actualizar la ventana de Informacin del Jugador}
menuText S ToolsRating "Grfico del Elo" 0 \
  {Grfico de la historia del Elo de los jugadores de la actual partida}
menuText S ToolsScore "Grfico de puntuacin" 1 \
  {Muestra la ventana del grfico de puntuacin}
menuText S ToolsExpCurrent "Exportar la partida actual" 0 \
  {Escribe la partida actual en un archivo de texto}
menuText S ToolsExpCurrentPGN "Exportar la partida a un archivo PGN..." 33 \
  {Escribe la partida actual en un archivo PGN}
menuText S ToolsExpCurrentHTML "Exportar la partida a un archivo HTML..." 33 \
  {Escribe la partida actual en un archivo HTML}
menuText S ToolsExpCurrentLaTeX "Exportar la partida a un archivo LaTeX..." 33 \
  {Escribe la partida actual en un archivo LaTeX}
menuText S ToolsExpFilter "Exportar todas las partidas filtradas" 1 \
  {Escribe todas las partidas filtradas en un archivo de texto}
menuText S ToolsExpFilterPGN "Exportar filtro a un archivo PGN..." 29 \
  {Escribe todas las partidas filtradas en un archivo PGN}
menuText S ToolsExpFilterHTML "Exportar filtro a un archivo HTML..." 29 \
  {Escribe todas las partidas filtradas en un archivo HTML}
menuText S ToolsExpFilterLaTeX "Exportar filtro a un archivo LaTeX..." 29 \
  {Escribe todas las partidas filtradas en un archivo LaTeX}
menuText S ToolsImportOne "Importar una partida PGN..." 0 \
  {Importa una partida de un texto PGN}
menuText S ToolsImportFile "Importar un archivo de partidas PGN..." 2 \
  {Importa partidas de un archivo PGN}

# Options menu:
menuText S Options "Opciones" 0
menuText S OptionsSize "Tamao del tablero" 0 {Cambia el tamao del tablero}
menuText S OptionsPieces "Board Piece Style" 6 \
  {Change the board piece style} ;# ***
menuText S OptionsColors "Colores..." 0 {Cambia los colores del tablero}
menuText S OptionsExport "Exportacin" 0 {Cambia las opciones de exportacin de texto}
menuText S OptionsFonts "Fuentes" 0 {Cambia las fuentes}
menuText S OptionsFontsRegular "Habitual" 0 {Cambia la fuente habitual}
menuText S OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText S OptionsFontsSmall "Pequea" 0 {Cambia la fuente pequea}
menuText S OptionsFontsFixed "Fijada" 0 {Cambia la anchura fijada de la fuente}
menuText S OptionsGInfo "Informacin de la partida" 0 {Informacin de la partida}
menuText S OptionsLanguage "Lenguaje" 0 {Selecciona el lenguaje del men}
menuText S OptionsMoves "Movimientos" 0 {Opciones de la entrada de movimientos}
menuText S OptionsMovesAsk "Preguntar antes de reemplazar movimientos" 0 \
  {Pregunta antes de sobreescribir cualquier movimiento existente}
menuText S OptionsMovesDelay "Demora del automovimiento..." 0 \
  {Pone el tiempo de demora para el modo de automovimiento}
menuText S OptionsMovesCoord "Entrada de movimientos coordinada" 0 \
  {Acepta entrada de movimientos en sistema "coordinado" ("g1f3")}
menuText S OptionsMovesSuggest "Mostrar movimientos sugeridos" 20 \
  {Activa/desactiva la sugerencia de movimientos}
menuText S OptionsMovesKey "Teclado Inteligente" 0 \
{Activa/desactiva la funcin de autocompletado inteligente de movimientos
con teclado}
menuText S OptionsNumbers "Formato de nmeros" 11 {Selecciona el formato de nmeros}
menuText S OptionsStartup "Inicio" 3 {Seleccionar ventanas a abrir al inicio}
menuText S OptionsWindows "Ventanas" 0 {Opciones de ventana}
menuText S OptionsWindowsIconify "Auto-iconify" 5 \
  {Iconify all windows when the main window is iconified} ;# ***
menuText S OptionsWindowsRaise "Poner a la vista automticamente" 0 \
  {Hace visibles ciertas ventanas (ej. barras de progreso) siempre que sean tapadas}
menuText S OptionsToolbar "Barra de herramientas ventana principal" 9 \
  {Muestra/oculta la barra de herramientas de la ventana principal}
menuText S OptionsECO "Cargar archivo ECO..." 7 \
  {Cargar el archivo de clasificacin ECO}
menuText S OptionsSpell "Cargar archivo de comprobacin ortogrfica..." 2 \
  {Carga el archivo de comprobacin ortogrfica Scid}
menuText S OptionsTable "Directorio de las TB..." 19 \
  {Selecciona el directorio de finales; todas las TB de ese directorio sern usadas}
menuText S OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText S OptionsSave "Guardar opciones" 0 \
  "Guarda todas las opciones en el fichero $::optionsFile"
menuText S OptionsAutoSave "Autoguardar opciones al salir" 0 \
  {Guarda automticamente todas las opciones cuando se sale de Scid}

# Help menu:
menuText S Help "Ayuda" 1
menuText S HelpIndex "Indice" 0 {Muestra la pgina ndice de la ayuda}
menuText S HelpGuide "Gua rpida" 0 {Muestra la pgina de la ayuda gua rpida}
menuText S HelpHints "Sugerencias" 1 {Muestra la pgina de la ayuda sugerencias}
menuText S HelpContact "Informacin de contacto" 15 \
  {Muestra la pgina de la ayuda de la informacin de contacto}
menuText S HelpTip "Sugerencia del da" 0 {Muestra una til sugerencia Scid}
menuText S HelpStartup "Ventana de inicio" 0 {Muestra la ventana de inicio}
menuText S HelpAbout "Acerca de Scid" 10 {Informacin acerca de Scid}

# Game info box popup menu:
menuText S GInfoHideNext "Ocultar siguiente movimiento" 0
menuText S GInfoMaterial "Mostrar valor del material" 0
menuText S GInfoFEN "Mostrar FEN" 8
menuText S GInfoMarks "Show colored squares and arrows" 5 ;# ***
menuText S GInfoWrap "Dividir lneas largas" 0
menuText S GInfoFullComment "Mostrar comentarios completos" 8
menuText S GInfoTBNothing "TBs: nada" 5
menuText S GInfoTBResult  "TBs: slo resultado" 10
menuText S GInfoTBAll "TBs: resultado y mejor movimiento" 23
menuText S GInfoDelete "(No)Borrar esta partida" 4
menuText S GInfoMark "(No)Marcar esta partida" 4

# Main window buttons:
helpMsg S .button.start {Ir al principio de la partida  (Tecla: Inicio)}
helpMsg S .button.end {Ir al final de la partida  (Tecla: Fin)}
helpMsg S .button.back {Ir atrs un movimiento  (Tecla: Flecha izquierda)}
helpMsg S .button.forward {Ir adelante un movimiento  (Tecla: Flecha derecha)}
helpMsg S .button.intoVar {Moverse dentro de una variacin  (Tecla rpida: v)}
helpMsg S .button.exitVar {Dejar la variacin actual  (Tecla rpida: z)}
helpMsg S .button.flip {Girar tablero  (Tecla rpida: .)}
helpMsg S .button.coords {Poner/quitar las coordenadas del tablero  (Tecla rpida: 0)}
helpMsg S .button.autoplay {Automovimiento de los movimientos  (Tecla: Ctrl+Z)}

# General buttons:
translate S Back {Atrs}
translate S Cancel {Cancelar}
translate S Clear {Limpiar}
translate S Close {Cerrar}
translate S Defaults {Por defecto}
translate S Delete {Borrar}
translate S Graph {Grfico}
translate S Help {Ayuda}
translate S Import {Importar}
translate S Index {ndice}
translate S LoadGame {Cargar partida}
translate S BrowseGame {Browse game} ;# ***
translate S MergeGame {Merge game} ;# ***
translate S Preview {Preview} ;# ***
translate S Revert {Retroceder}
translate S Save {Guardar}
translate S Search {Buscar}
translate S Stop {Parar}
translate S Store {Almacenar}
translate S Update {Actualizar}
translate S ChangeOrient {Cambiar orientacin de la ventana}
translate S None {Ninguno}
translate S First {Primera}
translate S Current {Actual}
translate S Last {ltima}

# General messages:
translate S game {partida}
translate S games {partidas}
translate S move {movimiento}
translate S moves {movimientos}
translate S all {todo}
translate S Yes {S}
translate S No {No}
translate S Both {Ambos}
translate S King {Rey}
translate S Queen {Dama}
translate S Rook {Torre}
translate S Bishop {Alfil}
translate S Knight {Caballo}
translate S Pawn {Pen}
translate S White {Blanco}
translate S Black {Negro}
translate S Player {Jugador}
translate S Rating {Elo}
translate S RatingDiff {Diferencia de Elo (Blanco - Negro)}
translate S Event {Evento}
translate S Site {Lugar}
translate S Country {Pas}
translate S IgnoreColors {Ignorar colores}
translate S Date {Fecha}
translate S EventDate {Evento fecha}
translate S Decade {Decade} ;# ***
translate S Year {Ao}
translate S Month {Mes}
translate S Months {enero febrero marzo abril mayo junio
  julio agosto septiembre octubre noviembre diciembre}
translate S Days {dom lun mar mi jue vie sb}
translate S YearToToday {ltimo ao hasta hoy}
translate S Result {Resultado}
translate S Round {Ronda}
translate S Length {Longitud}
translate S ECOCode {Cdigo ECO}
translate S ECO {ECO}
translate S Deleted {Borrado}
translate S SearchResults {Buscar resultados}
translate S OpeningTheDatabase {Abriendo base de datos}
translate S Database {Base de datos}
translate S Filter {Filtro}
translate S noGames {no hay partidas}
translate S allGames {todas las partidas}
translate S empty {vaca}
translate S clipbase {clipbase}
translate S score {puntuacin}
translate S StartPos {Posicin inicial}
translate S Total {Total}

# Game information:
translate S twin {doble}
translate S deleted {borradas}
translate S comment {comentario}
translate S hidden {oculto}
translate S LastMove {ltimo movimiento}
translate S NextMove {Siguiente}
translate S GameStart {Inicio de partida}
translate S LineStart {Inicio de lnea}
translate S GameEnd {Fin de partida}
translate S LineEnd {Fin de lnea}

# Player information:
translate S PInfoAll {Resultados para <b>todas</b> las partidas}
translate S PInfoFilter {Resultados para las partidas <b>filtradas</b>}
translate S PInfoAgainst {Results against} ;# ***
translate S PInfoMostWhite {Aperturas ms comunes con Blancas}
translate S PInfoMostBlack {Aperturas ms comunes con Negras}
translate S PInfoRating {Historial de clasificacin}
translate S PInfoBio {Biografa}

# Tablebase information:
translate S Draw {Tablas}
translate S stalemate {rey ahogado}
translate S withAllMoves {con todos los movimientos}
translate S withAllButOneMove {con todos los movimientos excepto uno}
translate S with {con}
translate S only {slo}
translate S lose {formas de perder}
translate S loses {hace perder}
translate S allOthersLose {todos los dems hacen perder}
translate S matesIn {mate en}
translate S hasCheckmated {jaque mate}
translate S longest {el mate ms largo}

# Tip of the day:
translate S Tip {Sugerencia}
translate S TipAtStartup {Sugerencia al iniciar}

# Tree window menus: ***
menuText S TreeFile "Archivo" 0
menuText S TreeFileSave "Guardar archivo cach" 0 \
  {Guarda el archivo cach del rbol (.stc)}
menuText S TreeFileFill "Construir archivo cach" 2 \
  {Fill the cache file with common opening positions}
menuText S TreeFileBest "Best games list" 0 {Show the best tree games list}
menuText S TreeFileGraph "Ventana del grfico" 0 \
  {Show the graph for this tree branch}
menuText S TreeFileCopy "Copiar texto del rbol al clipboard" 1 \
  {Copiar texto del rbol al clipboard}
menuText S TreeFileClose "Cerrar ventana del rbol" 0 \
  {Cerrar ventana del rbol}
menuText S TreeSort "Ordenar" 0
menuText S TreeSortAlpha "Alfabticamente" 0
menuText S TreeSortECO "Por cdigo ECO" 11
menuText S TreeSortFreq "Por frecuencia" 4
menuText S TreeSortScore "Por puntuacin" 4
menuText S TreeOpt "Opciones" 1
menuText S TreeOptLock "Lock" 0 {Lock/unlock the tree to the current database}
menuText S TreeOptTraining "Training" 0 {Turn on/off tree training mode}
menuText S TreeOptAutosave "Autoguardar archivo cach" 0 \
  {Auto-save the cache file when closing the tree window}
menuText S TreeHelp "Ayuda" 1
menuText S TreeHelpTree "Ayuda del rbol" 4
menuText S TreeHelpIndex "Indice de la ayuda" 0
translate S SaveCache {Guardar cach}
translate S Training {Entrenamiento}
translate S LockTree {Bloquear}
translate S TreeLocked {locked}
translate S TreeBest {Best}
translate S TreeBestGames {Best tree games}

# Finder window:
menuText S FinderFile "Archivo" 0
menuText S FinderFileSubdirs "Mirar en subdirectorios" 0
menuText S FinderFileClose "Cierra visor de Archivos" 0
menuText S FinderSort "Ordenar" 0
menuText S FinderSortType "Tipo" 0
menuText S FinderSortSize "Tamao" 0
menuText S FinderSortMod "Modificado" 0
menuText S FinderSortName "Nombre" 0
menuText S FinderSortPath "Camino" 0
menuText S FinderTypes "Tipos" 0
menuText S FinderTypesScid "Bases de datos Scid" 0
menuText S FinderTypesOld "Bases de datos Scid en antiguo formato" 12
menuText S FinderTypesPGN "Archivos PGN" 9
menuText S FinderTypesEPD "Archivos EPD (libro)" 0
menuText S FinderTypesRep "Archivos de Repertorio" 12
menuText S FinderHelp "Ayuda" 1
menuText S FinderHelpFinder "Ayuda del visor de Archivos" 0
menuText S FinderHelpIndex "Indice de la ayuda" 0
translate S FileFinder {Visor de Archivos}
translate S FinderDir {Directorio}
translate S FinderDirs {Directorios}
translate S FinderFiles {Archivos}
translate S FinderUpDir {arriba}

# Tournament finder:
menuText S TmtFile "Archivo" 0
menuText S TmtFileUpdate "Actualizar" 0
menuText S TmtFileClose "Cierra el Visor de Torneos" 0
menuText S TmtSort "Ordenar" 0
menuText S TmtSortDate "Fecha" 0
menuText S TmtSortPlayers "Jugadores" 0
menuText S TmtSortGames "Partidas" 0
menuText S TmtSortElo "Elo" 0
menuText S TmtSortSite "Lugar" 0
menuText S TmtSortEvent "Evento" 1
menuText S TmtSortWinner "Ganador" 0
translate S TmtLimit "Lmite de lista"
translate S TmtMeanElo "Media de Elo inferior"
translate S TmtNone "No se han encontrado torneos concordantes."

# Graph windows:
menuText S GraphFile "Archivo" 0
menuText S GraphFileColor "Guardar como Postscript Color..." 24
menuText S GraphFileGrey "Guardar como Postscript escala de grises..." 34
menuText S GraphFileClose "Cerrar ventana" 7
menuText S GraphOptions "Opciones" 0
menuText S GraphOptionsWhite "Blanco" 0
menuText S GraphOptionsBlack "Negro" 0
menuText S GraphOptionsBoth "Ambos" 0
menuText S GraphOptionsPInfo "Jugador Informacin jugador" 0
translate S GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate S AddVariation {Aadir variacin}
translate S AddMove {Aadir movimiento}
translate S Annotate {Anotar}
translate S AnalysisCommand {Direccin de anlisis}
translate S PreviousChoices {Eleccin previa}
translate S AnnotateTime {Poner el tiempo entre movimientos en segundos}
translate S AnnotateWhich {Aadir variaciones}
translate S AnnotateAll {Para movimientos de ambos lados}
translate S AnnotateWhite {Slo para movimientos de las Blancas}
translate S AnnotateBlack {Slo para movimientos de las Negras}
translate S AnnotateNotBest {Cuando el movimiento de la partida no es el mejor}

# Analysis Engine open dialog:
translate S EngineList {Analysis Engine List} ;# ***
translate S EngineName {Name} ;# ***
translate S EngineCmd {Command} ;# ***
translate S EngineArgs {Parameters} ;# ***
translate S EngineDir {Directory} ;# ***
translate S EngineElo {Elo}
translate S EngineTime {Fecha}
translate S EngineNew {New} ;# ***
translate S EngineEdit {Edit} ;# ***
translate S EngineRequired {Fields in bold are required; others are optional}

# Stats window menus:
menuText S StatsFile "Archivo" 0
menuText S StatsFilePrint "Imprimir en archivo..." 0
menuText S StatsFileClose "Cerrar ventana" 0
menuText S StatsOpt "Opciones" 0

# PGN window menus:
menuText S PgnFile "Archivo" 0
menuText S PgnFilePrint "Imprimir en archivo..." 0
menuText S PgnFileClose "Cerrar ventana PGN" 0
menuText S PgnOpt "Presentacin" 0
menuText S PgnOptColor "Color de la presentacin" 0
menuText S PgnOptShort "Encabezado pequeo (3 lneas)" 13
menuText S PgnOptSymbols "Anotaciones simblicas" 0
menuText S PgnOptIndentC "Sangra en comentarios" 0
menuText S PgnOptIndentV "Sangra en variaciones" 11
menuText S PgnOptColumn "Estilo de columna (un movimiento por lnea)" 1
menuText S PgnOptSpace "Espacio despus del nmero del movimiento" 0
menuText S PgnOptStripMarks "Strip out colored square/arrow codes" 1 ;# ***
menuText S PgnColor "Colores" 1
menuText S PgnColorHeader "Encabezamiento..." 0
menuText S PgnColorAnno "Anotaciones..." 0
menuText S PgnColorComments "Comentarios..." 0
menuText S PgnColorVars "Variaciones..." 0
menuText S PgnColorBackground "Fondo..." 0
menuText S PgnHelp "Ayuda" 1
menuText S PgnHelpPgn "Ayuda de PGN" 9
menuText S PgnHelpIndex "Indice de la ayuda" 0

# Crosstable window menus:
menuText S CrosstabFile "Archivo" 0
menuText S CrosstabFileText "Imprimir en archivo texto..." 20
menuText S CrosstabFileHtml "Imprimir en archivo HTML..." 20
menuText S CrosstabFileLaTeX "Imprimir en archivo LaTeX..." 20
menuText S CrosstabFileClose "Cerrar ventana de tabla cruzada" 0
menuText S CrosstabEdit "Editar" 0
menuText S CrosstabEditEvent "Evento" 0
menuText S CrosstabEditSite "Lugar" 0
menuText S CrosstabEditDate "Fecha" 0
menuText S CrosstabOpt "Presentacin" 0
menuText S CrosstabOptAll "Todos contra todos" 0
menuText S CrosstabOptSwiss "Suizo" 0
menuText S CrosstabOptKnockout "Eliminatoria directa" 0
menuText S CrosstabOptAuto "Auto" 0
menuText S CrosstabOptAges "Edad en aos" 1
menuText S CrosstabOptNats "Nacionalidades" 0
menuText S CrosstabOptRatings "Elo" 0
menuText S CrosstabOptTitles "Ttulos" 0
menuText S CrosstabOptBreaks "Tie-break scores" 4 ;# ***
menuText S CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText S CrosstabOptColors "Colores (slo en tabla de Suizos)" 0
menuText S CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2 ;# ***
menuText S CrosstabOptGroup "Grupos de clasificacin" 0
menuText S CrosstabSort "Ordenar" 0
menuText S CrosstabSortName "Por nombre" 4
menuText S CrosstabSortRating "Por Elo" 4
menuText S CrosstabSortScore "Por puntuacin" 4
menuText S CrosstabColor "Color" 2
menuText S CrosstabColorPlain "Texto simple" 0
menuText S CrosstabColorHyper "Hypertexto" 0
menuText S CrosstabHelp "Ayuda" 1
menuText S CrosstabHelpCross "Ayuda de tabla cruzada" 9
menuText S CrosstabHelpIndex "Indice de la ayuda" 0
translate S SetFilter {Poner filtro}
translate S AddToFilter {Aadir al filtro}
translate S Swiss {Suizo}

# Opening report window menus:
menuText S OprepFile "Archivo" 0
menuText S OprepFileText "Imprimir en archivo texto..." 20
menuText S OprepFileHtml "Imprimir en archivo HTML..." 20
menuText S OprepFileLaTeX "Imprimir en archivo LaTeX..." 20
menuText S OprepFileOptions "Opciones..." 0
menuText S OprepFileClose "Cerrar ventana del informe de la apertura" 0
menuText S OprepHelp "Ayuda" 1
menuText S OprepHelpReport "Ayuda del informe de la apertura" 11
menuText S OprepHelpIndex "Indice de la ayuda" 0

# Repertoire editor:
menuText S RepFile "Archivo" 0
menuText S RepFileNew "Nuevo" 0
menuText S RepFileOpen "Abrir..." 0
menuText S RepFileSave "Guardar..." 0
menuText S RepFileSaveAs "Guardar como..." 1
menuText S RepFileClose "Cerrar ventana" 0
menuText S RepEdit "Editar" 0
menuText S RepEditGroup "Aadir grupo" 7
menuText S RepEditInclude "Aadir lnea incluida" 13
menuText S RepEditExclude "Aadir lnea excluida" 13
menuText S RepView "Ver" 0
menuText S RepViewExpand "Expandir todos los grupos" 0
menuText S RepViewCollapse "Colapsar todos los grupos" 0
menuText S RepSearch "Buscar" 0
menuText S RepSearchAll "Todo el repertorio..." 0
menuText S RepSearchDisplayed "Slo las lneas mostradas..." 16
menuText S RepHelp "Ayuda" 1
menuText S RepHelpRep "Ayuda del repertorio" 10
menuText S RepHelpIndex "Indice de la ayuda" 0
translate S RepSearch "Bsqueda del repertorio"
translate S RepIncludedLines "Lneas incluidas"
translate S RepExcludedLines "Lneas excluidas"
translate S RepCloseDialog {Este repertorio tiene cambios no guardados.

Realmente quieres continuar y descartar los cambios que has hecho?
}

# Header search:
translate S HeaderSearch {Bsqueda por encabezamiento}
translate S GamesWithNoECO {Partidas sin ECO?}
translate S GameLength {Duracin:}
translate S FindGamesWith {Encontrar partidas con}
translate S StdStart {Inicio estndar}
translate S Promotions {Promociones}
translate S Comments {Comentarios}
translate S Variations {Variaciones}
translate S Annotations {Anotaciones}
translate S DeleteFlag {Seal de borrado}
translate S WhiteOpFlag {Apertura de las blancas}
translate S BlackOpFlag {Apertura de las negras}
translate S MiddlegameFlag {Mediojuego}
translate S EndgameFlag {Finales}
translate S NoveltyFlag {Novedad}
translate S PawnFlag {Estruvtura de peones}
translate S TacticsFlag {Tacticas}
translate S QsideFlag {Juego del lado de dama}
translate S KsideFlag {Juego del lado de rey}
translate S BrilliancyFlag {Genialidad}
translate S BlunderFlag {Error}
translate S UserFlag {Usuario}
translate S PgnContains {PGN contiene texto}

# Game list window:
translate S GlistNumber {Nmero}
translate S GlistWhite {Blanco}
translate S GlistBlack {Negro}
translate S GlistWElo {B-Elo}
translate S GlistBElo {N-Elo}
translate S GlistEvent {Evento}
translate S GlistSite {Lugar}
translate S GlistRound {Ronda}
translate S GlistDate {Fecha}
translate S GlistYear {Ao}
translate S GlistEDate {Evento-Fecha}
translate S GlistResult {Resultado}
translate S GlistLength {Longitud}
translate S GlistCountry {Pas}
translate S GlistECO {ECO}
translate S GlistOpening {Apertura}
translate S GlistEndMaterial {Material final}
translate S GlistDeleted {Borrado}
translate S GlistFlags {Seal}
translate S GlistVars {Variaciones}
translate S GlistComments {Comentarios}
translate S GlistAnnos {Anotaciones}
translate S GlistStart {Inicio}
translate S GlistGameNumber {Nmero de partida}
translate S GlistFindText {Encontrar texto}
translate S GlistMoveField {Movimiento}
translate S GlistEditField {Configurar}
translate S GlistAddField {Aadir}
translate S GlistDeleteField {Quitar}
translate S GlistWidth {Anchura}
translate S GlistAlign {Alinear}
translate S GlistColor {Color}
translate S GlistSep {Separador}

# Maintenance window:
translate S DatabaseName {Nombre de la base:}
translate S TypeIcon {Tipo de icono:}
translate S NumOfGames {Partidas:}
translate S NumDeletedGames {Partidas borradas:}
translate S NumFilterGames {Partidas en el filtro:}
translate S YearRange {Rango de aos:}
translate S RatingRange {Rango de Elo:}
translate S Flag {Seal}
translate S DeleteCurrent {Borrar partida actual}
translate S DeleteFilter {Borrar partidas filtradas}
translate S DeleteAll {Borrar todas las partidas}
translate S UndeleteCurrent {No borrar partida actual}
translate S UndeleteFilter {No borrar partidas filtradas}
translate S UndeleteAll {No borrar todas las partidas}
translate S DeleteTwins {Borrar partidas dobles}
translate S MarkCurrent {Marcar partida actual}
translate S MarkFilter {Marcar partidas filtradas}
translate S MarkAll {Marcar todas las partidas}
translate S UnmarkCurrent {No marcar partida actual}
translate S UnmarkFilter {No marcar partidas filtradas}
translate S UnmarkAll {No marcar todas las partidas}
translate S Spellchecking {Revisin ortogrfica}
translate S Players {Jugadores}
translate S Events {Eventos}
translate S Sites {Lugares}
translate S Rounds {Rondas}
translate S DatabaseOps {Operaciones con la base de datos}
translate S ReclassifyGames {Reclasificar partidas por ECO...}
translate S CompactDatabase {Compactar base de datos}
translate S SortDatabase {Ordenar base de datos}
translate S AddEloRatings {Aadir clasificacin Elo}
translate S AutoloadGame {Autocargar nmero de partida}
translate S StripTags {Strip PGN tags} ;# ***
translate S StripTag {Strip tag} ;# ***
translate S Cleaner {MultiHerramienta}
translate S CleanerHelp {
Scid ejecutar, en la actual base de datos, todas las acciones de mantenimiento
que selecciones de la siguiente lista.

Se aplicar el estado actual en la clasificacin ECO y el dilogo de borrado de
dobles si seleccionas esas funciones.
}
translate S CleanerConfirm {
Una vez que la MultiHerramienta de mantenimiento se inicia no puede ser interrumpida!

Esto puede tomar mucho tiempo en una base de datos grande, dependiendo de las funciones que hallas seleccionado y su estado actual.

Ests seguro de querer comenzar las funciones de mantenimiento que has seleccionado?
}

# Comment editor:
translate S AnnotationSymbols  {Smbolos de anotacin:}
translate S Comment {Comentario:}

# Board search:
translate S BoardSearch {Tablero de bsqueda}
translate S FilterOperation {Operacin en filtro actual:}
translate S FilterAnd {Y (Restringir filtro)}
translate S FilterOr {O (Aadir al filtro)}
translate S FilterIgnore {IGNORAR (Poner a cero el filtro)}
translate S SearchType {Tipo de bsqueda:}
translate S SearchBoardExact {Posicin exacta (todas las piezas en las mismas casillas)}
translate S SearchBoardPawns {Peones (igual material, todos los peones en las mismas casillas)}
translate S SearchBoardFiles {Columnas (igual material, todos los peones en las mismas columnas)}
translate S SearchBoardAny {Cualquiera (igual material, peones y piezas en cualquier parte)}
translate S LookInVars {Mirar en variaciones}

# Material search:
translate S MaterialSearch {Bsqueda de Material}
translate S Material {Material}
translate S Patterns {Patrones}
translate S Zero {Cero}
translate S Any {Cualquiera}
translate S CurrentBoard {Tablero Actual}
translate S CommonEndings {Finales comunes}
translate S CommonPatterns {Patrones comunes}
translate S MaterialDiff {Diferencia de material}
translate S squares {casillas}
translate S SameColor {Igual color}
translate S OppColor {Color opuesto}
translate S Either {Cualquiera}
translate S MoveNumberRange {Rango de nmero de movimientos}
translate S MatchForAtLeast {Encuentro de al menos}
translate S HalfMoves {medios movimientos}

# Game saving:
translate S Today {Hoy}
translate S ClassifyGame {Clasificar partida}

# Setup position:
translate S EmptyBoard {Tablero vaco}
translate S InitialBoard {Tablero inicial}
translate S SideToMove {Lado que mueve}
translate S MoveNumber {Movimiento nmero}
translate S Castling {Enroque}
translate S EnPassentFile {Columna al paso}
translate S ClearFen {Quitar FEN}
translate S PasteFen {Pegar FEN}

# Replace move dialog:
translate S ReplaceMove {Reemplazar movimiento}
translate S AddNewVar {Aadir nueva variacin}
translate S ReplaceMoveMessage {Ya existe un movimiento.

Puedes reemplazarlo, descartando todos los movimientos posteriores, o aadirlo como una nueva variacin.

(Puedes evitar seguir viendo este mensaje en el futuro desactivando la opcin "Preguntar antes de reemplazar movimientos" en el men Opciones: Movimientos.)}

# Make database read-only dialog:
translate S ReadOnlyDialog {Si haces que esta base de datos sea de slo lectura no se permitirn hacer cambios. No se podrn guardar o reemplazar partidas, y no se podrn alterar las seales de borrada. Cualquier ordenacin o clasificacin por ECO ser temporal.

Puedes hacer fcilmente escribible la base de datos otra vez cerrndola y abrindola.

Realmente quieres hacer que esta base de datos sea de slo lectura?}

# Clear game dialog:
translate S ClearGameDialog {Esta partida a sido cambiada.

Realmente quieres continuar y eliminar los cambios hechos en ella?
}

# Exit dialog:
translate S ExitDialog {Realmente quieres salir de Scid?}
translate S ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.} ;# ***

# Import window:
translate S PasteCurrentGame {Pegar partida actual}
translate S ImportHelp1 \
  {Introducir o pegar una partida en formato PGN en el marco superior.}
translate S ImportHelp2 \
  {Cualquier error importando la partida ser mostrado aqu.}

# ECO Browser:
translate S ECOAllSections {todas las divisiones ECO}
translate S ECOSection {divisin ECO}
translate S ECOSummary {Resumen de}
translate S ECOFrequency {Frecuencia de los subcdigos para}

# Opening Report:
translate S OprepTitle {Informe de la apertura}
translate S OprepReport {Informe}
translate S OprepGenerated {Generado por}
translate S OprepStatsHist {Estadsticas e Historia}
translate S OprepStats {Estadsticas}
translate S OprepStatAll {Todas las partidas referidas}
translate S OprepStatBoth {Ambos con Elo}
translate S OprepStatSince {Desde}
translate S OprepOldest {Partidas ms antiguas}
translate S OprepNewest {Partidas ms nuevas}
translate S OprepPopular {Popularidad actual}
translate S OprepFreqAll {Frecuencia durante todos los aos: }
translate S OprepFreq1   {Desde el ltimo ao hasta hoy:     }
translate S OprepFreq5   {En los ltimos 5 aos hasta hoy:   }
translate S OprepFreq10  {En los ltimos 10 aos hasta hoy:  }
translate S OprepEvery {una vez cada %u partidas}
translate S OprepUp {sube un %u%s respecto al total de aos}
translate S OprepDown {baja un %u%s respecto al total de aos}
translate S OprepSame {no hay cambios respecto al total de aos}
translate S OprepMostFrequent {Jugadores ms frecuentes}
translate S OprepRatingsPerf {Elo y Rendimiento}
translate S OprepAvgPerf {Promedio de Elo y rendimiento}
translate S OprepWRating {Elo de las blancas}
translate S OprepBRating {Elo de las negras}
translate S OprepWPerf {Rendimiento de las blancas}
translate S OprepBPerf {Rendimiento de las negras}
translate S OprepHighRating {Partida con el mayor promedio de Elo}
translate S OprepTrends {Tendencias de Resultados}
translate S OprepResults {Resultado de duraciones y frecuencias}
translate S OprepLength {Duracin de la partida}
translate S OprepFrequency {Frecuencia}
translate S OprepWWins {Blancas ganan: }
translate S OprepBWins {Negras ganan:  }
translate S OprepDraws {Tablas:        }
translate S OprepWholeDB {en el conjunto de la base de datos}
translate S OprepShortest {Triunfos ms cortos}
translate S OprepMovesThemes {Movimientos y temas}
translate S OprepMoveOrders {Lneas de movimientos que alcanzan la posicin del informe}
translate S OprepMoveOrdersOne \
  {Slo hay una lnea de movimientos que alcanza esta posicin:}
translate S OprepMoveOrdersAll \
  {Hay %u lneas de movimiento que alcanzan esta posicin:}
translate S OprepMoveOrdersMany \
  {Hay %u lneas de movimiento que alcanzan esta posicin. Las %u ms comunes son:}
translate S OprepMovesFrom {Movimientos desde la posicin del informe}
translate S OprepThemes {Temas Posicionales}
translate S OprepThemeDescription {Frecuencia de temas en el movimiento %u}
translate S OprepThemeSameCastling {Enroque al mismo lado}
translate S OprepThemeOppCastling {Enroque en lados opuestos}
translate S OprepThemeNoCastling {Ambos Reyes no enrocados}
translate S OprepThemeKPawnStorm {Avanzada de los peones del Rey}
translate S OprepThemeQueenswap {Damas intercambiadas}
translate S OprepThemeIQP {Peones de Dama aislados}
translate S OprepThemeWP567 {Peones blancos en 5/6/7 fila}
translate S OprepThemeBP234 {Peones negros en 2/3/4 fila}
translate S OprepThemeOpenCDE {Columnas c/d/e abiertas}
translate S OprepTheme1BishopPair {Un lado tiene los dos alfiles}
translate S OprepEndgames {Finales}
translate S OprepReportGames {Informe de partidas}
translate S OprepAllGames {Todas las partidas}
translate S OprepEndClass {Tipos de finales segn la ltima posicin de las partidas}
translate S OprepTheoryTable {Tabla Terica}
translate S OprepTableComment {Generado a partir de las %u partidas con mejor Elo.}
translate S OprepExtraMoves {Anotacin extra de movimientos en la tabla terica}
translate S OprepMaxGames {Mximas partidas en la tabla terica}

# Piece Tracker window:
translate S TrackerSelectSingle {Left mouse button selects this piece.} ;# ***
translate S TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate S TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate S TrackerStat {Statistic}
translate S TrackerGames {% games with move to square}
translate S TrackerTime {% time on each square}
translate S TrackerMoves {Moves}
translate S TrackerMovesStart {Enter the move number where tracking should begin.}
translate S TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate S SelectAllGames {Todas las partidas de la base de datos}
translate S SelectFilterGames {Slo las partidas filtradas}
translate S SelectTournamentGames {Slo las partidas del actual torneo}
translate S SelectOlderGames {Slo partidas antiguas}

# Delete Twins window:
translate S TwinsNote {Para ser dobles, dos partidas deben de tener al menos los mismos dos jugadores, y los criterios que fijes debajo. Cuando un par de dobles es encontrado, la partida ms corta es borrada.
Sugerencia: es mejor hacer la correccin ortogrfica de la base de datos antes de iniciar el borrado de dobles, porque esto mejora su deteccin.}
translate S TwinsCriteria {Criterios: Las partidas dobles deben tener...}
translate S TwinsWhich {Partidas a examinar}
translate S TwinsColors {Jugadores con igual color?}
translate S TwinsEvent {Mismo evento?}
translate S TwinsSite {Mismo sitio?}
translate S TwinsRound {Misma ronda?}
translate S TwinsYear {Mismo ao?}
translate S TwinsMonth {Mismo mes?}
translate S TwinsDay {Mismo da?}
translate S TwinsResult {Mismo resultado?}
translate S TwinsECO {Mismo cdigo ECO?}
translate S TwinsMoves {Mismos movimientos?}
translate S TwinsPlayers {Comparando nombres de jugadores:}
translate S TwinsPlayersExact {Encuentro exacto}
translate S TwinsPlayersPrefix {Slo las primeras 4 letras}
translate S TwinsWhen {Cuando se borren partidas dobles}
translate S TwinsSkipShort {Ignorar todas las partidas con menos de 5 movimientos?}
translate S TwinsUndelete {Quitar marcas de borrado primero?}
translate S TwinsSetFilter {Poner filtro a todas las partidas borradas?}
translate S TwinsComments {Saltar siempre partidas con comentarios?}
translate S TwinsVars {Saltar siempre partidas con variaciones?}
translate S TwinsDeleteWhich {Delete which game:} ;# ***
translate S TwinsDeleteShorter {Shorter game} ;# ***
translate S TwinsDeleteOlder {Smaller game number} ;# ***
translate S TwinsDeleteNewer {Larger game number} ;# ***
translate S TwinsDelete {Borrar partidas}

# Name editor window:
translate S NameEditType {Tipo de nombre a editar}
translate S NameEditSelect {Partidas a editar}
translate S NameEditReplace {Reemplazar}
translate S NameEditWith {con}
translate S NameEditMatches {Encuentros: Presionar Ctrl+1 a Ctrl+9 para seleccionarlo}

# Classify window:
translate S Classify {Clasificar}
translate S ClassifyWhich {Clasificar por cdigos ECO}
translate S ClassifyAll {Todas las partidas (sobreescribir cdigo ECO)}
translate S ClassifyYear {Todas las partidas jugadas en el ltimo ao}
translate S ClassifyMonth {Todas las partidas jugadas en el ltimo mes}
translate S ClassifyNew {Slo las partidas todaba sin cdigo ECO}
translate S ClassifyCodes {Cdigo ECO a usar}
translate S ClassifyBasic {Slo cdigo bsico ("B12", ...)}
translate S ClassifyExtended {Extensiones Scid ("B12j", ...)}

# Compaction:
translate S NameFile {Archivo de nombres}
translate S GameFile {Archivo de partidas}
translate S Names {Nombres}
translate S Unused {No usado}
translate S SizeKb {Tamao (kb)}
translate S CurrentState {Estado actual}
translate S AfterCompaction {Despus de la compactacin}
translate S CompactNames {Compactar archivo de nombres}
translate S CompactGames {Compactar archivo de partidas}

# Sorting:
translate S SortCriteria {Criterio}
translate S AddCriteria {Aadir criterio}
translate S CommonSorts {Ordenaciones comunes}
translate S Sort {Ordenar}

# Exporting:
translate S AddToExistingFile {Aadir partidas a un archivo existente?}
translate S ExportComments {Exportar comentarios?}
translate S ExportVariations {Exportar variaciones?}
translate S IndentComments {Sangrar comentarios?}
translate S IndentVariations {Sangrar variaciones?}
translate S ExportColumnStyle {Estilo de columna (un movimiento por lnea)?}
translate S ExportSymbolStyle {Estilo de anotacin simblico:}
translate S ExportStripMarks {Strip square/arrow mark codes from comments?} ;# ***

# Goto game/move dialogs:
translate S LoadGameNumber {Entra el nmero de la partida a cargar:}
translate S GotoMoveNumber {Ir al movimiento nmero:}

# Copy games dialog:
translate S CopyGames {Copiar partidas}
translate S CopyConfirm {
 Realmente deseas copiar las [thousands $nGamesToCopy] partidas fitradas
 de la base de datos "$fromName"
 a la base de datos "$targetName"?
}
translate S CopyErr {No se pueden copiar las partidas}
translate S CopyErrSource {la base de datos fuente}
translate S CopyErrTarget {la base de datos de destino}
translate S CopyErrNoGames {no tiene partidas en su filtro}
translate S CopyErrReadOnly {es slo de lectura}
translate S CopyErrNotOpen {no est abierta}

# Colors:
translate S LightSquares {Casillas claras}
translate S DarkSquares {Casillas oscuras}
translate S SelectedSquares {Casillas seleccionadas}
translate S SuggestedSquares {Casillas de movimiento sugerido}
translate S WhitePieces {Piezas blancas}
translate S BlackPieces {Piezas negras}
translate S WhiteBorder {Borde blancas}
translate S BlackBorder {Borde negras}

# Novelty window:
translate S FindNovelty {Encontrar Novedad}
translate S Novelty {Novedad}
translate S NoveltyInterrupt {Busqueda de novedades interrumpida}
translate S NoveltyNone {Ninguna novedad encontrada para esta partida}
translate S NoveltyHelp {
Scid encontrar el primer movimiento de la actual partida que alcanza una posicin no encontrada en la base de datos seleccionada o en el libro de aperturas ECO.
}

# Upgrading databases:
translate S Upgrading {Actualizacin}
translate S ConfirmOpenNew {
Este es un formato de base de datos antiguo (Scid 2) que no puede ser abierto con Scid 3, pero ya se ha creado una versin de formato nuevo (Scid 3).

Quieres abrir la versin de formato nuevo de la base de datos?
}
translate S ConfirmUpgrade {
Esta es una base de datos en un formato antiguo (Scid 2). Se debe crear una versin de formato nuevo de base de datos antes de poder ser usada en Scid 3.

La actualizacin crear una nueva versin de la base de datos; esta no corregir o borrar los archivos originales.

Esto puede tomar un tiempo, pero slo es necesario hacerlo una vez. Puedes cancelar si toma demasiado tiempo.

Quieres actualizar esta base de datos ahora?
}

# Recent files options:
translate S RecentFilesMenu {Number of recent files in File menu} ;# ***
translate S RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}

############################################################

# Spanish help pages:

set helpTitle(S,Index) "ndice"
set helpText(S,Index) {<h1>Scid: ndice de la Ayuda</h1>

<h4>Comienzo y ayuda general</h4>
<ul>
<li><a Guide><b>Gua Rpida</b> para usar Scid</a> <red>(Lee esto primero)</red></li>
<li><a Hints><b>Sugerencias</b> para conseguir ms de Scid</a></li>
<li><a MainWindow><b>Ventana principal</b> de Scid</a></li>
<li><a Menus><b>Mens</b> de Scid</a></li>
<li><a Moves>Entrada de <b>movimientos</b></a></li>
<li><a Searches><b>Bsquedas</b> en Scid</a></li>
<li><a Clipbase>Utilizacin de la <b>Base de Trabajo (Clipbase)</b></a></li>
</ul>

<h4>Otras ventanas de Scid</h4>
<ul>
<li><a Analysis>Ventana de <b>Anlisis</b></a></li>
<li><a Comment>Ventana del <b>Editor de Comentarios</b></a></li>
<li><a Crosstable>Ventana de <b>Tablas Cruzadas</b></a></li>
<li><a Switcher>Ventana del <b>Intercambiador de Bases de Datos</b></a></li>
<li><a Email>Ventana del administrador de <b>Emails</b> de ajedrez</a></li>
<li><a Finder>Ventana del <b>Visor de Archivos</b></a> <red>(Nuevo!)</red></li>
<li><a GameList>Ventana del <b>Listado de Partidas</b></a></li>
<li><a Import>Ventana de <b>Importacin de partidas</b></a></li>
<li><a OpReport><b>Ventana del <b>Informe de la apertura</b></a></li>
<li><a PGN>Ventana de <b>PGN</b> (partidas en texto)</a></li>
<li><a PInfo>Ventana de <b>Informacin del Jugador</b></a></li>
<li><a Repertoire><b>Editor de Repertorio</b></a> <red>(Nuevo!)</red></li>
<li><a Tmt>Ventana del <b>Visor de Torneos</b></a> <red>(Nuevo!)</red></li>
<li><a Tree>Ventana de <b>rbol</b></a></li>
<li><a Graphs>Ventanas de <b>Grficos</b></a></li>
<li><a TB>Uso de <b>Tablebases</b> en Scid</a> <red>(Nuevo!)</red></li>
</ul>

<h4>Otras utilidades e informacin</h4>
<ul>
<li><a Bookmarks><b>Bookmarks</b></a> <red>(Nuevo!)</red></li>
<li><a Cmdline>Command-line options</a> <red>(New!)</red></li>
<li><a Compact><b>Compactando</b> una base de datos</a></li>
<li><a Maintenance>Herramientas de <b>mantenimiento de la Base de Datos</b></a>
    <red>(cambios recientes)</red></li>
<li><a ECO>Clasificacin de aberturas por <b>ECO</b></a></li>
<li><a EPD>Archivos de <b>EPD</b></a></li>
<li><a Export><b>Exportacin</b> de partidas a archivos de texto</a></li>
<li><a Flags>Game <b>Flags</b></a> <red>(Nuevo!)</red></li>
<li><a LaTeX>Usando <b>LaTeX</b> con Scid</a></li>
<li><a Options><b>Opciones</b> y preferencias</a></li>
<li><a Sorting><b>Ordenando</b> una base de datos</a></li>
<li><a Pgnscid><b>Pgnscid</b>: conversin de archivos PGN</a></li>
<li><a NAGs>Valores de anotacin <b>NAG</b> estndares</a></li>
<li><a Formats><b>Formatos de archivo</b> de las bases de datos Scid</a></li>
<li><a Author>Informacin de contacto</a></li>
</ul>

<p><footer>(Actualizado: Scid 3.0, Noviembre 2001)</footer></p>
}


####################
### Quick Guide help:

set helpTitle(S,Guide) "Gua rpida para usar Scid"
set helpText(S,Guide) {<h1>Gua rpida para usar Scid</h1>
<p>
Scid es una aplicacin de base de datos de ajedrez; con ella puedes realizar bsquedas en bases de datos de partidas de ajedrez, editar partidas, y <a Searches>buscar</a> partidas por varios criterios.
</p>
<p>
Scid usa su propio <a Formats>formato de base de datos</a> de tres archivos, los cuales son muy compactos y rpidos, adems puede convertir a y desde el formato estndar PGN (Portable Game Notation). La <a PGN>ventana PGN</a> de Scid muestra el texto de la partida actual en formato PGN.
</p>
<p>
Puedes usar Scid para aadir partidas a una base de datos, usando el teclado o el ratn para entrar los movimientos. Ver la pgina de ayuda de <a Moves>entrada de movimientos</a> para ms detalles.
</p>
<p>
Tambin puedes usar Scid como un buscador de archivos <a PGN>PGN</a>, colocando un texto PGN en la ventana de <a Import>Importacin</a> de Scid o abriendo un archivo PGN con Scid. Sin embargo, Scid no puede editar archivos PGN (slo puede abrirlos y leerlos) ocupndose, adems, ms memoria y tardndose ms en cargar, por eso para grandes archivos PGN se recomienda crear primero una base de datos Scid de ellos con la utilidad <a Pgnscid>pgnscid</a>.
</p>
<p>
La <a MainWindow>Ventana Principal</a> de Scid (con el tablero grfico de ajedrez) muestra los datos de la partida activa y de la base de datos. Puedes tener abiertas, al mismo tiempo, tres bases de datos (cuatro incluyendo la <a Clipbase>base de trabajo</a>),
y cada una puede tener abierta su propia partida activa. (Una partida numerada como 0 indica que es una partida que no forma parte de la actual base de datos).
Puedes intercambiar entre las bases de datos abiertas mediante el <a Menus File>men Archivo</a>.
</p>
<p>
Para ms informacin, por favor lee las otras pginas de ayuda mencionadas en el <a Index>ndice de la Ayuda</a>.
</p>
<p>
Mira la pgina de la <a Author>informacin de contacto</a> si necesitas contacta con el autor de Scid.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}


####################
### Main window help:

set helpTitle(S,MainWindow) "Ventana principal de Scid"
set helpText(S,MainWindow) {<h1>Ventana principal de Scid</h1>
<p>
La ventana principal de Scid muestra la actual posicin del tablero de la partida activa e informacin sobre la partida actual y la base de datos. Otras pginas de ayuda describen los <a Menus>mens</a> y las maneras de <a Moves>entrar los movimientos de ajedrez</a>.
</p>

<h3>Botones de navegacin de la partida</h3>
<p>
Los botones de navegacin que hay sobre el tablero tienen, de derecha a izquierda, los siguientes significados:
<ul>
<li> <button tb_start> Va al inicio de la partida. </li>
<li> <button tb_prev> Va un movimiento atrs. </li>
<li> <button tb_next> Va un movimiento adelante. </li>
<li> <button tb_end> Va al final de la partida. </li>
<li> <button tb_invar> Entra en una variacin. </li>
<li> <button tb_outvar> Sale de la actual variacin. </li>
<li> <button tb_addvar> Aade una variacin. </li>
<li> <button autoplay_off> Inicia/para el modo de movimiento automtico (ver ms abajo). </li>
<li> <button tb_flip> Gira el tablero 180 grados. </li>
<li> <button tb_coords> Poner/quitar las coordenadas del tablero. </li>
</ul>

<h4><name Autoplay>Modo de Movimiento Automtico</name></h4>
<p>
En el modo de Movimiento Automtico, Scid automticamente realiza los movimientos de la partida actual, moviendo hacia adelante hasta el final de la partida. El tiempo de demora entre los movimientos puede ser cambiado desde el men <menu>Opciones: Movimientos</menu>, y es guardado en tu archivo de opciones cuando guardas las opciones.
</p>
<p>
La combinacin de teclas <b>Control+Z</b> inicia o para el modo de movimiento automtico, asimismo puedes parar el modo de movimiento automtico apretando la tecla <b>Escape (Esc)</b>.
</p>
<p>
Si inicias el modo de movimiento automtico cuando la <a Analysis>ventana de anlisis</a> est abierta, la partida es <term>comentada</term>: la puntuacin y el anlisis para cada posicin es aadido a la partida como comentarios justo antes de que se realice el siguiente movimiento. Ver la pgina de ayuda de la <a Analysis> ventana de anlisis</a> para ms detalles.
</p>

<h3>El rea de informacin de la partida</h3>
<p>
El rea debajo del tablero de ajedrez que muestra informacin sobre la partida se llama <term>rea de informacin de la partida</term>.
Las dos primeras lneas muestran informacin sobre jugadores, resultado, fecha y lugar. La tercera lnea indica la posicin actual de la partida y cual es el siguiente movimiento.
</p>
<p>
La cuarta lnea muestra el cdigo <a ECO>ECO</a> (Encyclopaedia of Chess Openings) de la actual posicin, si la posicin aparece en el archivo ECO que se este usando.
</p>
<p>
El rea de informacin de la partida tiene un men que se activa con el botn derecho del ratn, con opciones para ocultar el siguiente movimiento (til si ests entrenando usando una partida y quieres calcular cada movimiento), y para suprimir (borrar) o restaurar la partida actual. Puedes activar este men sin usar el ratn, apretando la tecla de funcin <b>F9</b>.
</p>

<h4>Tablebases</h4>
<p>
El rea de informacin de la partida tambin muestra resultados de las tablebases en cualquier momento en el que la posicin mostrada alcanza una configuracin de material que se encuentra en un archivo de tablebase (Tb). Ver la pgina de ayuda de <aTB>tablebases</a> para ms detalles.

<h3>La barra de estado</h3>
<p>
La barra de estado muestra informacin sobre la base de datos actual. El primer campo indica el estado de la partida: <b>XX</b> significa que a sido alterada y an no ha sido salvada, <b>--</b> significa que no ha sido alterada y <b>%%</b> indica que la base de datos slo se puede leer (no es alterable).
</p>
<p>
Si quieres una base de datos que slo se pueda leer pon los permisos de sus archivos Scid, o al menos de su archivo ndice, por ejemplo: <br><li><b>chmod a-w miarchivo.si</b><br> como un comando de un interprete de ordenes para un sistema operativo, y ser abierta por Scid como de slo lectura.
</p>
<p>
La barra de estado tambin muestra cuntas partidas hay actualmente en el <a Searches Filter>filtro</a>.
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}


####################
### Database switcher help:

set helpTitle(S,Switcher) "Intercambiador de Bases de Datos"
set helpText(S,Switcher) {<h1>La ventana del Intercambiador de Bases de Datos</h1>
<p>
La ventana del Intercambiador de Bases de Datos proporciona una presentacin que hace fcil el intercambio entre bases de datos o la copia de partidas entre bases de datos. Se muestra el nombre, el estado del <a Searches Filter>filtro</a> y el tipo de icono grfico de cada base de datos, siendo puesta de relieve la base de datos activa mediante un fondo amarillo.
</p>
<p>
Puedes abrir el intercambiador de bases de datos desde el men <menu>Ventanas</menu>, o mediante la combinacin de teclas: <b>Control+D</b>.
</p>
<p>
Para cambiar de base de datos tan slo debes apretar el botn izquierdo del ratn cuando ests sobre ella.
</p>
<p>
Para copiar todas las partidas filtradas de una base de datos a otra debes arrastra con el botn izquierdo del ratn desde la base de datos fuente hasta la base de datos deseada; entonces vers un dilogo de confirmacin, o un mensaje de error si las partidas no pueden ser copiadas.
</p>
<p>
Presionando el botn derecho del ratn sobre una base de datos se obtiene un men emergente de atributos de la base de datos, desde el que puedes cambiar el tipo de icono de la base de datos o anular su <a Searches Filter>filtro</a>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}


####################
### Entering moves help:

set helpTitle(S,Moves) "Entrada de movimientos"
set helpText(S,Moves) {<h1>Entrada de movimientos de ajedrez</h1>
<p>
En Scid, puedes entrar los movimientos de una partida usando el ratn o el teclado. Cuando mueves el ratn sobre una casilla esta y otra casilla cambian de color si hay un movimiento legal a esta o desde esta casilla. Esto es el <term>movimiento sugerido</term>. Para hacer este movimiento simplemente aprieta el botn <term>izquierdo</term> del ratn. Si esta opcin te molesta puedes desactivar el movimiento sugerido usando el men Opciones.
</p>
<p>
Para hacer cualquier movimiento distinto del movimiento sugerido usa el botn <term>izquierdo</term> del ratn: presiona el botn sobre una casilla y sultalo sobre la casilla deseada.
</p>
<p>
Si prefieres hacer los movimientos mediante dos clicks de ratn en vez de arrastrando puedes usar el botn <term>central</term>: aprieta en una casilla y luego en la otra.
</p>

<h4>Retroceder un atrs</h4>
<p>
Para volver atrs un movimiento aprieta el botn derecho del ratn, esto va hacia atrs un movimiento, y borra el movimiento si este es el ltimo de la partida o variacin.
</p>

<h4>Reemplazar movimientos existentes</h4>
<p>
Cuando introduces un movimiento en un punto de la partida donde ya existe un movimiento Scid muestra una caja de dilogo preguntando si realmente quieres reemplazar el movimiento existente (este y todos los movimientos posteriores se perderan), o si, por contra, quieres aadirlo como una variacin. Algunas personas consideran molesta esta caja de dilogo puesto que siempre desean reemplazar el movimiento existente, si es as puedes desactivarla con la opcin de men "<i>Preguntar antes de reemplazar movimientos</i>" yendo al men <menu>Opciones: Movimientos</menu>.
</p>

<h4>Trial mode</h4>
<p>
If you are studying a game and reach a position where you want to try
an alternative variation on the board without altering the game, select
<b>Try variation</b> from the <menu>Edit</menu> menu to enter trial
mode. In this mode, you can make temporary moves and changes to the
game, then return to the original position when you exit trial mode.
</p>

<h3><name Mistakes>Correccin de errores</name></h3>
<p>
Si estas introduciendo una partida y de pronto ves un movimiento incorrecto varios movimientos antes es posible corregirlo sin perder los movimientos posteriores que has introducido. La nica manera es editando la representacin PGN de la partida: abre la ventana <a Import>Importar</a>, selecciona "Pegar partida actual", corrige el movimiento equivocado y selecciona "Importar".
</p>

<h3>Entrada de movimientos con el teclado</h3>
<p>
Para entrar movimientos con el teclado nicamente se usan teclas de letras y dgitos. Observa que los movimientos aceptados deben de estar en <term>notacin SAN</term>, <i>sin</i> el smbolo de captura (x) o de promocin (=). Los movimientos son identificados de manera insensible, por lo que puedes teclear, por ejemplo, <key>nf3</key> en vez de Nf3 -- mira la nota que hay ms abajo sobre conflictos con movimientos de peones.
</p>
<p>
Para asegurar que ningn movimiento es un prefijo de algn otro movimiento la notacin para el enroque corto y el enroque largo es <key>OK</key> y <key>OQ</key> respectivamente, en vez de la usual O-O y O-O-O.
</p>
<p>
Cuando entres un movimiento la barra de estado mostrar la lista de posibles movimientos. Puedes presionar la <key>barra espaciadora</key> en cualquier momento para escoger el primer movimiento mostrado en la lista y aadirlo a la partida. Para borrar un carcter presiona la tecla de <key>Borrar</key> (encima de Return) o <key>Suprimir</key>.
</p>
<p>
<b>Fijate</b> que una letra minscula representa primero a un pen, por lo que como <key>b</key> puede representar a un pen o a un alfil, si hay un conflicto debes usar una <key>B</key> mayscula para el movimiento del alfil.
</p>

<h4>Teclado Inteligente</h4>
<p>
En el men opciones puedes activar o desactivar la opcin <term>Teclado Inteligente</term>. Con la opcin teclado inteligente se hace un movimiento en cuanto se a escrito lo suficiente para distinguirlo de otros movimientos legales. Por ejemplo, con teclado inteligente, slo necesitaras teclear <key>nf</key> en vez de <key>nf3</key> para el movimiento <b>Nf3</b> en la posicin inicial.
</p>

<h4>Entrada de smbolos comunes de comentario</h4>
<p>
Puedes tambin aadir <a NAGs>smbolos de comentario</a> comunes mediante el teclado en la ventana principal, sin necesidad de usar la ventana del <a Comment>editor de comentarios</a>. La siguiente lista muestra cuales son los smbolos que puedes aadir, y su secuencia de teclas:
<ul>
<li> !  : [!][Return] </li>
<li> ?  : [?][Return] </li>
<li> !? : [!][?][Return] </li>
<li> ?! : [?][!][Return] </li>
<li> !! : [!][!][Return] </li>
<li> ?? : [?][?][Return] </li>
<li> </li>
<li> +- : [+][-] </li>
<li> +/-        : [+][/] </li>
<li> += : [+][=] </li>
<li> =  : [=][Return] </li>
<li> -+ : [-][+] </li>
<li> -/+        : [-][/] </li>
<li> =+ : [=][+] </li>
</ul>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

####################
### Hints page:
set helpTitle(S,Hints) "Sugerencias de Scid"
set helpText(S,Hints) {<h1>Sugerencias de Scid</h1>
<p>
Esta pgina contiene sugerencias en formato de preguntas y respuestas para ayudarte a usar Scid mejor. Si eres un nuevo usuario de Scid, por favor lee la <a Guide>gua rpida</a> primero. Mucha de la informacin de esta pgina esta disponible, con ms detalle, en otras pginas mostradas en el <a Index>ndice</a>. Si piensas una sugerencia til para aadir a esta pgina, por favor envala al <a Author>creador de Scid</a>.
</p>

<h4>Cmo puedo conseguir que Scid cargue una base de datos cuando se arranca?</h4>
<p>
S, puedes aadir bases de datos, archivos PGN o <a EPD>archivos de posiciones</a> en la lnea de comandos. Por ejemplo:
<br><li><b>scid  mibase  partidas.pgn.gz</b>
<br>cargar la base de datos Scid mibase y adems cargar el archivo PGN comprimido en Gzip <b>partidas.pgn.gz</b>.
</p>

<h4>Hay una manera ms fcil de cambiar el tamao del tablero que teniendo que usar el men de opciones?</h4>
<p>
S, se puede usar la combinacin de teclas <b>Control+Maysculas+flecha izquierda</b> y <b>Control+Maysculas+flecha derecha</b> para disminuir o aumentar el tamao del tablero.
</p>

<h4>Estoy entrenando jugando a travs de una partida, por lo que no quiero que Scid muestre el siguiente movimiento en el rea de informacin de la partida. Cmo puedo hacer que no se muestre?</h4>
<p>
Puedes hacer que no se muestre el siguiente movimiento presionando el botn <b>derecho</b> del ratn en el rea de informacin de la partida, y seleccionando <b>Esconder el siguiente movimiento</b> en el men que aparece.
</p>

<h4>Cmo puedo ver el cdigo ECO de apertura de la posicin actual?</h4>
<p>
El cdigo ECO se muestra en la ltima lnea del rea de informacin de la partida, debajo del tablero de ajedrez en la <a MainWindow>ventana principal</a>, si tienes el archivo de clasificacin ECO (<b>scid.eco</b>) cargado. <br>
La pgina de ayuda de los <a ECO>cdigos ECO</a> explica cmo cargar el archivo de la clasificacin ECO y cmo salvar la opcin para que sea cargada cada vez que se inicie Scid.
</p>

<h4>Estoy introduciendo una partida y estoy en el movimiento 30, y entonces me doy cuenta que el nmero 10 est equivocado. Cmo puedo corregirlo y conservar todos los movimientos posteriores?</h4>
<p>
Puedes usar la ventana de <a Import>Importacin</a>; mira en la pgina de ayuda <a Moves Mistakes>entrada de movimientos</a> para obtener ms ayuda.
</p>

<h4>Cmo puedo copiar partidas de una base de datos a otra?</h4>
<p>
Usa la <a Switcher>ventana del intercambiador de bases de datos</a>: arrastra desde la base de datos fuente a la base de datos elegida para copiar todas las partidas <a Searches Filter>filtradas</a> en la base de datos fuente.
</p>

<h4>Cada vez que entro un movimiento donde ya existe uno aparece  la caja de dilogo "Reemplazar movimiento?", Cmo puedo evitarlo?</h4>
<p>
Desactvala con la opcin <b>Preguntar antes de reemplazar movimientos</b> que hay en el men <menu>Opciones: Movimientos</menu>. O adopta el hbito de suprimir movimientos usando el botn derecho del ratn, el cual realmente borra el movimiento de la partida si te encuentras en el ltimo movimiento de la partida.
</p>

<h4>Cmo puedo cambiar la anchura de las columnas en la ventana del Listado de Partidas?</h4>
<p>
Aprieta el botn derecho o izquierdo del botn en cada ttulo de las columnas.
</p>

<h4>Cmo puedo usar la ventana de rbol para las partidas seleccionadas, y no para toda la base de datos?</h4>
<p>
Usa la <a Clipbase>base de trabajo</a>. Haz el filtrado de la base de datos que contiene las partidas en las que quieres usar el rbol, y cpialo a la base de trabajo usando el <a Switcher>intercambiador de bases de datos</a>. Entonces slo tienes que abrir la ventana de rbol en la base de trabajo.
</p>

<h4>El rbol es lento con bases de datos grandes. Cmo puedo aumentar su velocidad?</h4>
<p>
Guardar el archivo cach con frecuencia, para guardar los resultados del rbol para su futuro uso. Ver la seccin sobre cache de la pgina de ayuda del <a Tree>rbol</a> para ms detalles.
</p>

<h4>Cmo puedo editar la representacin PGN de una partida directamente?</h4>
<p>
No puedes usar la ventana <a PGN>PGN</a> para editar la partida actual, pero an as puedes editar su representacin PGN usando la ventana <a Import>Importar partida</a>. Simplemente brela (combinacin de teclas: <b>Control+Mayusculas+I</b>) y el botn <b>Pegar partida actual</b>, entonces edita la partida, y despus aprieta <b>Importar</b>.
</p>

<h4>Mi base de datos tiene muchas ortografas distintas para algunos nombres de jugadores. Cmo puedo corregirlas todas?</h4>
<p>
Puedes editar los nombres individualmente o chequear ortogrficamente todos los nombres en una base de datos con los comandos que hay en el men <menu>Archivo: Mantenimiento</menu>. Ver la pgina de <a Maintenance Editing>mantenimiento</a>.
</p>

<h4>Tengo dos bases de datos abiertas: una con mis partidas, y una gran base de datos de partidas de grandes maestros. Cmo puedo comparar una de mis partidas con las de la base de datos grande?</h4>
<p>
En la base de datos grande abre la <a Tree>ventana de rbol</a> y presiona el botn <term>Bloqueo</term> para bloquear el rbol de esta base de datos. Entonces cambia a la otra base de datos, el rbol continua mostrando los datos de la base de datos grande.
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

####################
### Menus help screen:

set helpTitle(S,Menus) "Mens"
set helpText(S,Menus) {<h1>Mens de Scid</h1>

<h3><name File>Archivo</name></h3>
<ul>
<li><menu>Nuevo</menu>: Crea una nueva base de datos Scid vaca.</li>
<li><menu>Abrir</menu>: Abre una base de datos Scid ya existente.</li>
<li><menu>Cerrar</menu>: Cierra la base de datos Scid activa.</li>
<li><menu>Mantenimiento</menu>: Funciones de <a Maintenance>mantenimiento</a> de la base de datos.</li>
<ul>
  <li><menu>Ventana de mantenimiento</menu>: Abre/cierra la ventana de mantenimiento de la base de datos Scid.</li>
  <li><menu>Borrar partidas dobles</menu>: Encuentra partidas dobles y las marca como borradas.</li>
  <li><menu>Clasificar partidas por ECO</menu>: Recalcula el <a ECO>cdigo ECO</a> de todas las partidas de la base de datos</li>
<li><menu>Editor de nombres</menu>: Reemplaza todos los diferentes nombres de un jugador, evento, sitio o ronda.</li>
</ul>
<li><menu>Read-Only</menu>: Hace que la actual base de datos sea de slo lectura.</li>
<li><menu>Base 1/2/3/4</menu>: Estos comandos te permiten cambiar entre los tres lugares disponibles para bases de datos y la <a Clipbase>base de trabajo</a>.</li>
<li><menu>Archivos de posiciones (EPD)</menu>: Abre o crea un <a EPD>archivo de posiciones</a> Scid.</li>
<li><menu>Salir</menu>: Salir de Scid.
</ul>

<h3>Editar</h3>
<ul>
<li><menu>Aadir variacin</menu>: Aade una nueva variacin, vaca, para el siguiente movimiento, o para el movimiento previo si no hay todava un siguiente movimiento.</li>
<li><menu>Borrar variacin</menu>: Proporciona un submen de variaciones para el movimiento actual, en el que puedes borrar las que quieras.</li>
<li><menu>Convertir en primera variacin</menu>: Hace que una variacin sea la primera en la lista para el movimiento actual.</li>
<br>
<li><menu>Poner a cero la base de trabajo</menu>: Vaca la <a Clipbase>base de trabajo</a> para que est completamente vacia.</li>
<li><menu>Copiar esta partida a la base de trabajo</menu>: Copia la partida actual a la <a Clipbase>base de trabajo</a>.</li>
<li><menu>Pegar la ltima partida de la base de trabajo</menu>: Pega la partida activa de la <a Clipbase>base de trabajo</a> para que sea la partida activa en la actual base de datos.</li>
</ul>

<h3>Partida</h3>
<ul>
<li><menu>Limpiar partida</menu>: Devuelve la partida activa a un estado vacio, descartando cualquier cambio no salvado.</li>
<li><menu>Setup start board</menu>: Pone la posicin inicial de la actual partida.</li>
<li><menu>Cargar partida anterior/siguiente</menu>: Carga la partida anterior/siguiente del <a Searches Filter>filtro</a>.</li>
<li><menu>Recargar partida actual</menu>: Vuelve a cargar la partida actual, descartando cualquier cambio hecho.</li>
<br>
<li><menu>Guardar: Reemplazar partida</menu>: Guarda esta partida, reemplazando la antigua versin en la base de datos.</li>
<li><menu>Guardar: Aadir nueva partida</menu>: Guarda esta partida como una nueva partida, anexionndola al final de la base de datos.</li>
<br>
<li><menu>Ir a la posicin ECO ms avanzada</menu>: Encuentra la posicin ms avanzada de la partida que est en el archivo ECO.</li>
</ul>

<h3>Buscar</h3>
<ul>
<li><menu>Poner a cero el filtro</menu>: Pone a cero el <a Searches Filter>filtro</a> para que todas la partidas esten incluidas.</li>
<li><menu>Invertir filtro</menu>: Invierte el filtro para que as slo se incluyan las partidas que estaban excluidas.</li>
<br>
<li><menu>Tablero actual</menu>: Busca por la posicin  del <a Searches Board>tablero actual</a>.</li>
<li><menu>Material/Patrn</menu>: Busca por <a Searches Material>material</a> o patrn del tablero</a>.</li>
<li><menu>Encabezamiento</menu>: Busca por la informacin del <a Searches Header>encabezamiento</a>, como puede ser, por ejemplo, nombre de jugadores.</li>
<br>
<li><menu>Usar archivo de bsqueda</menu>: Busca usando un archivo de <a Searches Settings>opciones</a> de bsqueda.</li>
</ul>

<h3>Ventanas</h3>
<ul>
<li><menu>Editor de Comentarios</menu>: Abre/cierra la ventana del <a Comment>Editor de Comentarios</a>.</li>
<li><menu>Ventana de Listado de partidas</menu>: Abre/cierra la <a GameList>Ventana de Listado de partidas</a>.</li>
<li><menu>Ventana PGN</menu>: Abre/cierra la <a PGN>ventana PGN</a>.</li>
<br>
<li><menu>Intercambiador de bases de datos</menu>: Abre/cierra la ventana del <a Switcher>Intercambiador de bases de datos</a>, el cual te permite cambiar a otra base de datos o copiar fcilmente partidas entre bases de datos.</li>
<li><menu>Ventana de mantenimiento</menu>: Abre/cierra la ventana de mantenimiento de la base de datos Scid.</li>
<br>
<li><menu>ECO Browser</menu>: Abre/cierra la ventana del <a ECO browser>Buscador ECO</a>.</li>
<li><menu>Repertoire editor</menu>: Abre/cierra el <a Repertoire>editor de repertorio</a>.</li>
<li><menu>Ventana de estadsticas</menu>: Abre/cierra la <term>Ventana de estadsticas del filtro</term> la cual muestra una recopilacin de las partidas ganadas/perdidas dentro del <a Searches Filter>filtro</a>.</li>
<li><menu>Ventana de rbol</menu>: Abre/cierra la <a Tree>ventana de rbol</a>.</li>
<li><menu>Endgame Tablebase window</menu>: Abre/cierra la ventana que muestra informacin de las <a TB>tablebases</a>.</li>
</ul>

<h3>Herramientas</h3>
<ul>
<li><menu>Ventana de anlisis</menu>: Inicia/para el anlisis del motor de ajedrez, mostrando la valoracin de la posicin actual en la <a Analysis>ventana de anlisis</a>.</li>
<li><menu>Tabla cruzada</menu>: Construye una <a Crosstable>tabla cruzada</a> del torneo de la partida actual.</li>
<li><menu>Administrador de Email</menu>: Abre/cierra la ventana del <a Email>administrador de Email</a>, para administrar la correspondencia de Email.</li>
<br>
<li><menu>Opening report</menu>: Genera un <a OpReport>informe de la apertura</a> para la actual posicin.</li>
<li><menu>Player information</menu>: Muestra la <a PInfo>informacin del jugador</a> para uno o dos jugadores de la actual partida.</li>
<li><menu>Rating graph</menu>: Muestra el <a Graphs Rating>grfico de clasificacin</a>.</li>
<li><menu>Score graph</menu>: Muestra el <a Graphs Score>grfico de puntuacin</a>.</li>
<br>
<li><menu>Exportar la partida actual</menu>: Escribe la partida actual en un archivo de texto en formato PGN, HTML or LaTeX. Ver la ayuda de la pgina <a Export>exportar</a>.</li>
<li><menu>Exportar todas las partidas filtradas</menu>: Escribe todas las partidas del <a Searches Filter>filtro</a> de bsqueda en un archivo de texto en formato PGN, HTML or LaTeX. Ver la ayuda de la pgina <a Export>exportar</a>.</li>
<br>
<li><menu>Importar partida PGN</menu>: Abre la <a Import>ventana Importar</a> para anotar una partida escribiendo o pegando su texto en <a PGN>formato PGN</a>.</li>
</ul>

<h3>Opciones</h3>
<p>
Esta ventana proporciona el acceso para fijar la mayor parte de las opciones configurables de Scid.
La entrada de datos <menu>Guardar opciones</menu> guarda las opciones actuales en el archivo "<b>.scid</b>" de tu librera de uso (o para los usuario de Windows en <b>scid.opt</b> en el directorio del ejecutable de Scid).
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}


########################################
### Searches help screen:

set helpTitle(S,Searches) "Bsquedas"
set helpText(S,Searches) {<h1>Bsquedas con Scid</h1>
<p>
Scid puede ejecutar muchos tipos diferentes de bsqueda en una base de datos. Los tres tipos de bsqueda principales son:
<ul>
<li><b>1)</b> para el tablero actual, </li>
<li><b>2)</b> por material especificado o modelo de distribucin de piezas, y </li>
<li><b>3)</b> por informacin de la cabecera, como jugador, resultado, fecha,...</li>
</ul>
<p>
Adems de estas, hay tambin un modo de bsqueda automtica llamado <a Tree>ventana de rbol</a> el cual se explicar separadamente.
</p>

<h3><name Filter>Filtro de Bsqueda</name></h3>
<p>
En Scid las bsquedas se basan en el concepto de <term>filtro</term>.
El filtro representa un subconjunto de la base de datos actualmente en uso; en cualquier momento cada partida puede ser incluida o excluida del filtro.
</p>
<p>
Con cada tipo de bsqueda puedes optar por restringir el filtro existente, aadirlo a l, o ignorarlo y buscar en toda la base de datos. Esta capacidad de eleccin permite complejas bsquedas construidas por partes.
</p>
<p>
Adems puedes copiar todas las partidas del filtro de una base de datos a otra, usando la ventana del <a Switcher>intercambiador de bases de datos</a>.
</p>
<p>
En las bsquedas por posicin exacta, <a Tree>rbol</a> o material/modelo, es recordado el nmero de la primera posicin coincidente de cada partida concordante, por lo que cuando cargas cada partida esta muestra automticamente la posicin coincidente.
</p>
<p>
<b>Nota</b> estas bsquedas slo se aplican a la lnea principal de movimientos de la partida, y no a los movimientos de las variaciones.
</p>

<h3><name Board>Bsqueda: Tablero Actual</name></h3>
<p>
Esta bsqueda encuentra partidas que contienen la posicin actualmente mostrada, ignorando las reglas del enroque y <i>al paso</i>.
</p>
<p>
Hay cuatro tipos de bsquedas por tablero disponibles. Las cuatro precisan de una posicin que tenga exactamente el mismo material y lado que mueva para poder corresponderse.
Los tipos son:
<ul>
<li>[1] exacta (las dos posiciones deben de corresponderse en cada casilla),</li>
<li>[2] peones (la estructura de peones debe corresponderse exactamente, pero las piezas pueden estar en cualquier sitio),</li>
<li>[3] columnas (el nmero de peones blancos y negros de cada columna debe ser exactamente el pedido, por contra las piezas pueden estar en cualquier sitio), y</li>
<li>[4] material (los peones y las piezas pueden estar en cualquier sitio).
La bsqueda por peones es til para estudiar aperturas por estructura de peones, y las bsquedas por columnas y material son tiles para encontrar posiciones similares en un final de partida.</li>
</ul>
<p>
Para buscar una posicin determinada puedes poner la posicin primero (desde el men <menu>Partida: Iniciar tablero de posicin</menu>) y entonces iniciar la bsqueda.
</p>
<p>
Puedes pedir que la bsqueda mire en las variaciones (en vez de slo la lnea principal de las partidas)seleccionando la casilla <b>Mirar en variaciones</b>, pero esto puede hacer la bsqueda mucho ms lenta si la base de datos es larga y tiene muchas partidas con variaciones.
</p>

<h3><name Material>Bsqueda: Material/Modelo</name></h3>
<p>
Esta bsqueda es til para encontrar temas de finales o medio juego. Puedes especificar la cantidad mnima y mxima para cada tipo de material, y encontrar modelos como un Alfil en f7, o un pen en la columna f.
</p>
<p>
Se facilitan algunas disposiciones comunes de material o de modelos, como finales de Torre contra pen, o peones de Dama aislados.
</p>
<p>
<b>Sugerencias:</b><br>
La velocidad de las bsquedas por modelo puede variar ampliamente. Puedes reducir el tiempo necesario para una bsqueda fijando restricciones de manera inteligente. Por ejemplo, si fijas el mnimo nmero de movimientos para un final en 20 todas las partidas que finalizan en menos de 20 movimientos sern saltadas.
</p>

<h3><name Header>Bsqueda: Cabecera</name></h3>
<p>
Esta bsqueda puede ser usada para encontrar caractersticas de una partida que se encuentran almacenadas en la cabecera (como puede ser fecha, resultado, nombres, seales y clasificaciones), las cuales no necesitan decodificar ningn movimiento.
</p>
<p>
Para que una partida se corresponda con una bsqueda por cabecera, <b>todos</b> los campos que especifiques se deben corresponder.
</p>
<p>
Los campos con nombre (blancas, negras, evento y lugar) corresponden con cualquier texto dentro del nombre, de manera insensible e ignorando espacios.
</p>
<p>
Puedes hacer bsquedas ms ajustadas usando comodines (representando <b>?</b> un caracter y <b>*</b> representando cero o ms caracteres) poniendo el texto entre comillas. Por ejemplo, una bsqueda para el lugar <b>USA</b> encontrar ciudades americanas pero tambin <b>Lausanne SUI</b>, lo cual seguramente no es lo que buscas! Una bsqueda por el lugar <b>"*USA"</b> (acurdate de usar las comillas) slo mostrar ciudades de los Estados Unidos.
</p>
<p>
Si estas buscando un jugador en concreto (o pareja de oponentes) tanto para Blanco como para Negro (no importa con el color que jug), selecciona la opcin <b>Ignorar Colores</b>.
</p>

<h3><name Settings>Guardar opciones de bsqueda</name></h3>
<p>
Las ventanas de bsqueda por Material/Modelo y Cabecera facilitan un botn para <term>Guardar opciones</term>. Esto te permite guardar las opciones de bsqueda para usarlas posteriormente, en un archivo de <term>OpcionesBsqueda</term> (extensin .sso).
Para bsquedas usando un archivo OpcionesBsqueda (.sso) previamente guardado, selecciona <menu>Abrir</menu> desde el men <menu>Bsqueda</menu>.
</p>

<h3>Tiempos de bsqueda y partidas saltadas</h3>
<p>
Muchas bsquedas proporcionan un mensaje indicando el tiempo usado y el nmero de partidas que se han <term>saltado</term>. Una partida saltada es aquella que puede se excluida de la bsqueda sin decodificar ninguno de sus movimientos, basndose en la informacin almacenada en su ndice. Ver la pgina de ayuda de los <a Formats>formatos de archivos</a> para obtener ms informacin.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}


###############################
### Clipbase help:

set helpTitle(S,Clipbase) "La Base de Trabajo"
set helpText(S,Clipbase) {<h1>La base de datos Base de Trabajo</h1>
<p>
Adems de las bases de datos que tienes abiertas, Scid proporciona una <term>base de trabajo</term>, la cual es como otra base de datos excepto que esta slo existe en memoria y no tiene archivos para un almacenamiento permanente.
</p>
<p>
La base de trabajo es til como base de datos temporal, para fusionar los resultados de bsqueda realizados en ms de una base de datos o para procesar los resultados de una bsqueda como una base de datos separada.
</p>
<p>
Por ejemplo, supongamos que te estas preparando contra un oponente y has buscado una base de datos en la que el <a filter>filtro</a> contiene slo partidas donde el oponente a jugado con blancas. Puedes copiar estas partidas a la base de trabajo (arrastrando desde su base de datos a la base de trabajo en la ventana del <a Switcher>intercambiador de bases de datos</a>); cambia a la base de trabajo, y entonces abre la <a Tree>Ventana de rbol</a> para examinar su repertorio de juego.
</p>
<p>
Observa que puedes copiar las partidas del filtro de una base de datos directamente a otra base de datos abierta (sin necesidad de usar la base de trabajo como ubicacin intermedia) usando la ventana del <a Switcher>intercambiador de bases de datos</a>.
</p>
<p>
Observa que la base de trabajo <i>no puede</i> ser cerrada; seleccionando el comando <menu>Archivo: Cerrar</menu> en la base de trabajo esto equivale a <menu>Editar: Poner a cero la base de trabajo</menu> lo cual vaca la base de trabajo.
</p>
<p>
La base de trabajo tiene siempre un lmite de 10000 partidas, desde que ella existe slo en memoria.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}


###############################
### Comment editor window help:

set helpTitle(S,Comment) "Ventana del Editor de Comentarios"
set helpText(S,Comment) {<h1>La ventana del Editor de Comentarios</h1>
<p>
La ventana del Editor de Comentarios permite aadir o editar comentarios y anotaciones de smbolos a los movimientos de la partida de ajedrez activa.
</p>

<h3>Anotaciones de smbolos</h3>
<p>
Scid usa el <a Author Related>estndar PGN</a> para la anotacin de smbolos, aceptando valores <a NAGs>NAG (numeric annotation glyph)</a> para las anotaciones.
Algunos de los smbolos ms comunes (como son "!" o "+-") son presentados como smbolos, y tienen un botn en la ventana del editor de comentarios para poder introducirlos rpidamente. Para otros smbolos, puedes introducir el valor numrico NAG apropiado, el cual es un nmero entre 1 y 255.
Por ejemplo, el valor NAG 36 significa "Blancas tienen la iniciativa" y ser mostrado como "$36" en el <a PGN>texto PGN</a> de la partida.
</p>
<p>
Ver la pgina de ayuda de los <a NAGs>valores NAG</a> para ver los valores NAG definidos por el estndar PGN.
</p>
<p>
<b>Sugerencia:</b> Puedes aadir los smbolos de evaluacin comunes (!, ?, !!, ??, !? y ?!) incluso en la ventana principal, sin necesidad de usar la ventana del editor de comentarios, escribiendo el smbolo seguido de la tecla <key>Return</key>. Esto es especialmente si ests <a Moves>anotando los movimientos</a> usando el teclado.
</p>

<h3>Comentarios</h3>
<p>
Puedes editar comentarios escribiendo en el rea de texto que se facilita y usando los botones Limpiar, Retroceder y Almacenar.
No necesitas apretar el botn Almacenar para actualizar un comentario; este es automticamente actualizado en cualquier momento que te muevas a otra posicin de la partida.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Crosstable window help:

set helpTitle(S,Crosstable) "Ventana de Tabla Cruzada"
set helpText(S,Crosstable) {<h1>La ventana de Tabla Cruzada</h1>
<p>
La ventana de tabla cruzada muestra la tabla cruzada del torneo al que pertenece la partida actual. Cada vez que actualices la ventana de tabla cruzada (apretando su botn de actualizacin, apretando la tecla <b>Return</b> en la ventana de tabla cruzada, o con <b>Control+Shift+X</b> en las ventanas <a MainWindow>principal</a> o <a GameList>listado de partidas</a>), Scid buscar todas las partidas jugadas en el mismo torneo que la partida actual.
</p>
<p>
Cualquier partida jugada <b>dos meses antes o despus</b> que la partida actual, con <b>exactamente el mismo Evento y Lugar</b>, es considerada como perteneciente al torneo.
</p>
<p>
Un click del botn izquierdo del ratn sobre cualquier resultado de la tabla carga la partida correspondiente. Puedes aadir todas las partidas del torneo al <a Searches Filter>filtro</a> con el botn <b>Aadir al filtro</b> de la ventana de tabla cruzada.
</p>

<h4>Mens de la ventana de tabla cruzada</h4>
<p>
El men <menu>Archivo</menu> permite guarda la tabla actual a un archivo de texto sin formato o a una tabla en formato HTML.
</p>
<p>
El men <menu>Mostrar</menu> permite escoger el formato de la tabla:
<b>Todos contra todos</b>, <b>Suizo</b> o <b>Eliminatoria directa</b>.
</p>
<p>
El formato todos contra todos tiene un lmite de 30 jugadores, pero el formato Suizo (para torneos con muchos jugadores) puede mostrar ms de 200 jugadores y ms de 20 rondas.
</p>
<p>
Obsrvese que Scid usa la entrada <b>Ronda</b> de cada partida para construir la tabla cruzada de Suizos, por lo que no se ver ninguna partida en la tabla de Suizo de un torneo si las partidas no tienen un valor numrico para la ronda: 1, 2, 3, etc.
</p>
<p>
El men Mostrar adems permite configurar los datos presentados a tu gusto, para incluir o excluir clasificaciones, pases y tratamiento del jugador. Adems puedes escoger si el color asignado en las tablas de Suizos es mostrado o no.
</p>
<p>
La opcin <b>Separar por grupos de clasificacin</b> slo afecta a la presentacin de la tabla cuando los jugadores son ordenados por su clasificacin: inserta una lnea en blanco entre cada grupo de jugadores con la misma clasificacin.
</p>
<p>
El men <menu>Ordenar</menu> te permite ordenar los jugadores por nombre, clasificacin o puntuacin; por defecto lo hace por puntuacin.
</p>
<p>
El men <menu>Texto</menu> te permite cambiar el color de presentacin (hipertexto) entre encendido y apagado. Puesto que puede llevar mucho tiempo el dar forma y mostrar grandes tablas cruzadas en hipertexto, seleccionando <b>Texto sin formato</b> para los eventos largos se puede ganar mucho tiempo. Sin embargo con texto sin formato no se puede pinchar sobre los jugadores o las partidas.
</p>

<h4>Partidas duplicadas en la tabla cruzada</h4>
<p>
Para obtener buenos resultados con la tabla cruzada debes marcar las partidas duplicadas para ser borradas y tus partidas deben tener una ortografa uniforme de los nombres de los jugadores, lugares y eventos.
Ver la pgina de <a Maintenance>mantenimiento de la base de datos</a> para obtener ayuda sobre el borrado de partidas duplicadas y la edicin (o comprobacin ortogrfica) de los nombres de jugadores/eventos/lugares.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### File Finder window help:
set helpTitle(S,Finder) "Ventana del Visor de Archivos"
set helpText(S,Finder) {<h1>La ventana del Visor de Archivos</h1>
<p>
El <term>Visor de Archivos</term> te ayuda a ver cualquier tipo de archivo que p
uedas usar en Scid: bases de datos, archivos <a PGN>PGN</a>, archivos <a EPD>EP
D</a>, y archivos de <a Repertoire>repertorio</a>.
</p>
<p>
El visor muestra informacin til sobre cada archivo, como su tamao (ver ms ab
ajo) y fecha de ltima modificacin. Puedes abrir cualquier archivo mostrado sel
eccionndolo con el botn izquierdo del ratn.
</p>

<h3>Mirando en subdirectorios</h3>
<p>
Cuando desees comprobar todos los archivos de todos los subdirectorios del direc
torio actual, activa el recuadro <b>Mirar en subdirectorios</b>. Esto har que S
cid examine recursivamente cada subdirectorio en busca de archivos que puedan se
r abiertos por Scid. Esto puede tomar largo tiempo si hay muchos subdirectorios,
 por lo que no debes hacer esto en un directorio cercano al directorio raz. Pue
des interrumpir la bsqueda de archivos presionando el botn <b>Parar</b>.
</p>

<h3>Tamaos de archivo</h3>
<p>
El significado del tamao del archivo mostrado por el visor depende del tipo de
archivo. Para bases de datos Scid y archivos PGN, es el nmero de partidas. Para
 archivos EPD, es el nmero de posiciones. Para archivos de repertorio, es el n
mero de lneas (incluidas o excluidas.
</p>
<p>
Para todos los tipos de archivo excepto bases de datos Scid, el tamao del archi
vo es una estimacin tomando como muestra los primeros 64 kilobytes del archivo,
 por lo que el tamao puede no ser correcto para archivos mayores de 64 kb. Los
tamaos estimados se muestran con una tilde (~) para indicar que no son exactos.
</p>

<p><footer>(Actualizado: Scid 2.7, Septiembre 2001)</footer></p>
}

####################
### Tournament Finder window help:

set helpTitle(S,Tmt) "Ventana del Visor de Torneos"
set helpText(S,Tmt) {<h1>La ventana del Visor de Torneos</h1>
<p>
El <term>Visor de Torneos</term> te permite encontrar torneos en la base de dato
s actual. Explora todas las partidas de la base de datos y compara los datos sob
re los torneos encontrados. Ten en cuenta que dos partidas se considera que son
del mismo torneo si tienen la misma etiqueta de Evento, la misma etiqueta de Lug
ar y han sido jugadas como mximo con dos meses de diferencia.
<p>
Puedes limitar la lista de torneos por el nmero de jugadores y partidas, fecha,
 media de Elo y pas, editando los campos por debajo de la lista de torneos y pr
esionando el botn <b>Actualizar</b>.
</p>
<p>
La lista mostrada puede ser ordenada por fecha, nmero de jugadores, nmero de p
artidas, media de Elo, lugar, evento o el apellido del ganador. Selecciona el ti
po desde el men <menu>Ordenar</menu> o pincha en el ttulo de una columna para
cambiar el campo de ordenacin.
</p>
<p>
Para cargar la primera partida de cualquier torneo que se muestre, simplemente p
incha con el botn izquierdo del ratn cuando este se encuentra resaltado. Esto
adems actualiza la ventana de <a Crosstable>Tabla cruzada</a> si se encuentra a
bierta.
</p>
<p>
Para aumentar la velocidad del proceso de bsqueda de torneos, es una buena idea
 introducir un rango de fechas medianamente pequeo (como unos pocos aos como m
ucho) o seleccionar un pas concreto (mediante su cdigo estndar de tres letras
). Haciendo esto se reducir grandemente el nmero de partidas que Scid tiene qu
e considerar cuando trate de formar los torneos fuera de las partidas de la base
 de datos.
</p>

<p><footer>(Actualizado: Scid 2.7, Septiembre 2001)</footer></p>
}

####################
### GameList window help:

set helpTitle(S,GameList) "Ventana de Listado de partidas"
set helpText(S,GameList) {<h1>La ventana de Listado de partidas</h1>
<p>
La ventana de Listado de partidas muestra una lnea sumario para cada partida incluida en el actual <term>filtro</term>.
</p>

<h3>Navegando por la lista de partidas</h3>
<p>
Puedes desplazarte por la lista de partidas usando la barra deslizante o los cuatro botones que hay debajo de la lista.
Tambin puedes usar las teclas <key>Inicio</key>, <key>Fin</key>,
<key>Re Pg</key>, <key>Av Pg</key> y el teclado de flechas para desplazarte usando el teclado.
</p>
<p>
Puedes encontrar la siguiente partida de la lista que tenga cierto texto en los campos blancas, negras, Evento o Lugar usando la caja  <b>Encontrar texto</b>.
</p>

<h3>Acciones sobre las partidas de la lista</h3>
<p>
Para cargar una partida de la lista haz doble click con el botn izquierdo del ratn sobre la partida. Apretando el botn central del ratn se muestran los movimientos iniciales de una partida; esto puede ser til para comprobar la apertura de una partida antes de cargarla.
</p>
<p>
El botn derecho del ratn genera un men para la partida seleccionada, con el cual puedes borrar (o cancelar el borrado, restaurar) la partida, o excluirla del filtro. Observa que borrando una partida slo se activa la marca de borrado; permanece en la base de datos hasta que esta sea compactada, ver <a Compact>compactar</a>.
</p>

<h3>Cambiando la anchura de las columnas en la lista de partidas</h3>
<p>
Aprieta el botn derecho del ratn sobre el ttulo de una columna para hacerla ms alargada, o aprieta el botn izquierdo para hacerla ms corta.
</p>

<h3>Cambiando el tamao del listado de partidas</h3>
<p>
El tamao de la ventana del listado de partidas es guardado en el archivo de opciones siempre que salves las opciones. Por lo que si quieres que el listado de partidas muestre por defecto 10 partidas, slo cambia el tamao de la ventana del listado de partidas y selecciona <menu>Guardar opciones</menu> en el men <menu>Opciones</menu>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Import window help:

set helpTitle(S,Import) "Ventana Importar"
set helpText(S,Import) {<h1>La ventana Importar</h1>
<p>
La ventana de Scid Importar proporciona una manera fcil para pegar una partida en <a PGN>formato PGN</a> dentro de Scid desde alguna otra aplicacin o ventana.
</p>
<p>
El marco grande de la ventana es donde se escribe o pega el texto de una partida en formato PGN, y el marco gris de debajo proporciona la retroinformacin de cualquier error o advertencia.
</p>

<h3>Edicin de la partida actual con la Ventana Importar</h3>
<p>
La ventana Importar adems es la manera ms conveniente de hacer pequeos cambios en la partida actual: puedes pegar la partida actual en la ventana de Importacin (con el botn <b>Pegar partida actual</b>), editar el texto, y apretar <b>Importar</b> cuando est.
</p>

<h3>Etiquetas PGN en la ventana Importar</h3>
<p>
Scid anticipa las etiquetas de la cabecera PGN como
<ul>
<li> <b>[Result "*"]</b>
</ul>
antes de cualquier movimiento; pero puedes pegar solamente un fragmento de partida anlogo a
<ul>
<li> <b>1.e4 e5 2.Bc4 Bc5 3.Qh5?! Nf6?? 4.Qxf7# 1-0</b>
</ul>
sin ninguna etiqueta de cabecera y Scid la importar.
</p>

<h3>Usando archivos PGN en Scid</h3>
<p>
Si quieres usar un archivo en formato PGN en Scid pero no quieres convertirlo primero con <a Pgnscid>pgnscid</a>, hay dos posibles maneras.
</p>
<p>
Primera, puedes importar partidas de un archivo a una base de datos existente con el comando del men <menu>Herramientas: Importar archivo de partidas PGN...</menu>.
</p>
<p>
La alternativa es abrir el archivo PGN directamente en Scid. Sin embargo, los archivos de formato PGN son abiertos como de slo lectura y consumen ms memoria que una base de datos Scid comparable, por lo que esto es slo recomendable para archivos PGN relativamente pequeos.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Exporting help:

set helpTitle(S,Export) "Exportacin de partidas"
set helpText(S,Export) {<h1>Exportacin de partidas</h1>
<p>
Puedes usar comandos mediante el men <menu>Herramientas</menu> para exportar la partida o todas las partidas del filtro actual a un archivo de texto.
</p>
<p>
Hay disponibles tres formatos de archivo: <a PGN>PGN</a> (portable game
notation), HTML (para pginas web) y LaTeX (un sistema popular de composicin tipogrfica).
</p>
<p>
Cuando exportes, puedes decidir crear un nuevo archivo, o aadir las partidas a un archivo ya existente de partidas exportadas por Scid.
</p>

<h3>Diagramas</h3>
<p>
Cuando se exporta a formato HTML o LaTeX, Scid automticamente aadir en la partida un diagrama all donde aparezca un <a NAGs>nag</a> de diagrama ("D") o un <a Comment>comentario</a> que empiece con el caracter "#".
</p>

<h3>Exportacin en HTML</h3>
<p>
Scid puede exportar partidas a un archivo HTML. Para que los diagramas aparezcan, necesitaras que las imgenes de diagrama (distribuidas con Scid, en el directorio "<b>bitmaps/</b>") estn en un subdirectorio <b>bitmaps/</b> dentro del directorio donde se encuentre el archivo HTML.
</p>

<h3>Exportacin en LaTeX</h3>
<p>
Scid puede exportar partidas a archivos LaTeX. Las partidas sern impresas a dos columnas por pgina y los movimientos estarn en notacin algebraica con figuritas.
</p>
<p>
Ver la pgina de ayuda <a LaTeX>Usando LaTeX con Scid</a> para ms informacin.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### LaTeX help:

set helpTitle(S,LaTeX) "Scid y LaTeX"
set helpText(S,LaTeX) {<h1>Usando LaTeX con Scid</h1>
<p>
Scid puede guardar partidas e informes de aperturas en archivos en formato LaTeX. LaTeX es una extensin de TeX, un sistema popular de composicin tipogrfica.
</p>
<p>
Para componer los archivos LaTeX producidos con Scid, debes de tener (por supuesto) LaTeX y tener instalada la fuente "chess12". Esta fuente no es normalmente parte de la instalacin estndar de LaTeX, por lo que si tienes LaTeX puedes no tener la fuente de ajedrez.
</p>
<p>
Para obtener informacin sobre como bajar e instalar la fuente de ajedrez usada con LaTeX, visita la pgina <url http://scid.sourceforge.net/latex.html>Usando LaTeX con Scid</url> en el <url http://scid.sourceforge.net/>sitio web de Scid</url>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### PGN window help:

set helpTitle(S,PGN) "Ventana PGN"
set helpText(S,PGN) {<h1>La ventana PGN</h1>
<p>
La ventana PGN de Scid muestra en la representacin estndar PGN el contenido de la partida actual. En el texto de los movimientos, los comentarios aparecen {entre corchetes} y las variaciones (entre parntesis).
</p>

<h3>Formato PGN</h3>
<p>
PGN (Portable Game Notation) es el estndar comn para transferir partidas de ajedrez entre programas de ordenador. Una partida PGN consiste en dos secciones. La primera es la cabecera, que contiene datos como son <br>
<b>[White "Kasparov, Gary"]</b>
y
<b>[Result "1/2-1/2"]</b>.
</p>
<p>
La segunda seccin contiene los movimientos, actuales, de la partida en la notacin algebraica estndar (standard algebraic notation (SAN)) junto con algunas variaciones, <a NAGs>smbolos de anotacin</a> y <a Comment>comentarios</a>.
</p>

<h3>Acciones en la ventana PGN</h3>
<p>
Puedes usar la ventana PGN para navegar a travs de la partida: apretando el botn izquierdo del ratn sobre un movimiento se salta hasta l. Apretando el botn izquierdo del ratn sobre un comentario se edita este.
</p>

<h3>Opciones de visualizacin PGN</h3>
<p>
Los mens de la ventana PGN contienen opciones que afectan a la visualizacin de esta.
</p>
<p>
Scid puede mostrar las partidas en color o en texto sin formato -- ver el men
<menu>Presentacin</menu> en la ventana PGN. La presentacin en color es ms fcil de leer, y permite seleccionar movimientos y comentarios con el ratn, pero es bastante ms lenta actualizndose. Para partidas muy largas es preferible escoger la presentacin con texto sin formato.
</p>
<p>
Tambin puedes alterar el formato de los comentarios y las variaciones, pudiendo decidir si son mostrados con sangra en una lnea aparte para que tengan una gran visibilidad.
</p>
<p>
Las opciones de presentacin PGN, y el tamao de la ventana PGN, son guardados en el archivo de opciones cada vez que usas en el men de la ventana principal <menu>Opciones</menu> la opcin  <b>Guardar Opciones</b>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Tree window help:

set helpTitle(S,Repertoire) "Editor de Repertorio"
set helpText(S,Repertoire) {<h1>La ventana del editor de Repertorio</h1>
<p>
El editor de repertorio te permite crear, ver y editar archivos de <term>repertorio</term>. Un archivo de repertorio (.sor) es una lista de posiciones de apertura que tratas de alcanzar o de evitar, puedes usarlo para administrar tus preferencias en las aperturas y tambin para buscar en las bases de datos con Scid.
</p>

<h3>Grupos y lneas de repertorio</h3>
<p>
Un repertorio contiene dos tipos de elementos: <term>grupos</term> y
<term>lneas</term>. Los grupos no son realmente parte de tu repertorio; slo son usados para estructurarlo de la misma manera que los directorios dan la estructura a los archivos del disco duro de tu ordenador.
</p>
<p>
Las lneas en un repertorio se organizan en dos tipos: <term>incluir</term> lneas que representan posiciones de apertura en las que ests interesado e intentas alcanzar, y <term>excluir</term> lneas en las que no ests interesado en jugar y que tratas de evitar. Por ejemplo, si juegas QGA (1.d4 d5 2.c4 dxc4) con Negras y tu juegas todos los movimientos despus de 3.e4 <i>excepto</i> 3...Nf6, debers poner 1.d4 d5 2.c4 dxc4 3.e4 como lnea incluida y 1.d4 d5 2.c4 dxc4 3.e4 Nf6 como lnea excluida.
</p>

<h3>Comentarios y notas</h3>
<p>
Cada grupo o lnea puede tener comentarios ligados a estos. Hay dos tipos: cortos (de una sola lnea) aparecen (en rojo) en la estructura del repertorio al lado de los movimientos de un grupo o lnea, por contra los comentarios largos (mltiples lneas) se muestran slo cuando el grupo o lnea es seleccionado.
</p>

<h3>Uso de la ventana del editor de repertorio</h3>
<p>
El lado <b>izquierdo</b> de la ventana muestra la estructura del repertorio. Puedes pinchar en los iconos de carpetas para expandir o colapsar los grupos, y pinchar en los movimientos de un grupo o lnea para seleccionarla y ver sus comentarios. Las lneas incluidas se muestran con una marca azul, y las excluidas con una cruz roja.
</p>
<p>
Si una lnea o grupo tiene un comentario corto este se mostrar despus de los movimientos. Si tiene un comentario largo se indica con la marca <b><red>**</red></b> despus de los movimientos. Los grupos tienen un nmero entre parntesis despus de sus movimientos que muestra el nmero de lneas (directas o indirectas) que contiene.
</p>
<p>
Pinchando con el botn derecho del ratn en un grupo o lnea aparece un men con funciones para l, como su borrado o el cambio de su estado.
</p>
<p>
El lado <b>derecho</b> de la ventana contiene tres marcos. El primer marco es una lista de los movimientos de la lnea o grupo seleccionado. Puedes pinchar con el botn izquierdo del ratn en l para pegar los movimientos en la ventana de <a Import>Importar</a>, lo cual es til para hacer que la partida actual empiece con una lnea del repertorio. El segundo marco contiene el comentario corto de la lnea o grupo, y el tercer marco contiene el comentario largo.
</p>

<h3>Aadir grupos y lneas al repertorio</h3>
<p>
Para aadir una lnea o grupo en la ventana, simplemente haz sus movimientos en el tablero de ajedrez de la ventana principal, entonces usa el men <menu>Editar</menu> del editor de repertorio para aadirlo como un grupo, una lnea incluida o una lnea excluida.
</p>
<p>
Para borrar un grupo o lnea pnchala con el botn derecho del ratn y selecciona la orden apropiada en el men que aparece.
</p>

<h3><name Search>Bsquedas en bases de datos usando archivos de repertorio</name></h3>
<p>
El men <menu>Buscar</menu> del editor de repertorio permite buscar en la base de datos actual usando el repertorio. Cada partida ser buscada para posiciones del repertorio y ser mostrada slo si la posicin del repertorio de <i>mayor profundidad</i>es de una lnea <i>incluida<i>.
</p>
<p>
Puedes escojer entre buscar usando todo el repertorio, o slo las lneas mostradas. La bsqueda de las lneas mostradas es til cuando slo necesitas usar algunas del repertorio. Por ejemplo, un repertorio para las Negras puede tener dos grupos principales en el nivel superior, uno para 1.e4 y otro para 1.d4. Si slo estas interesado en 1.e4, simplemente colapsa el grupo 1.d4 y entonces busca slo para las lneas mostradas.
</p>

<h3>Otras Sugerencias</h3>
<p>
Un archivo de repertorio es muy til para encontrar nuevas partidas con tus maneras de realizar las aperturas. Por ejemplo, cada vez que tengas un nuevo archivo PGN para aadir a tu base de datos principal (como el excelente archivo PGN semanal de <url http://www.chesscenter.com/twic/>The Week In Chess</url>), simplemente abre el archivo PGN con Scid y haz una bsqueda de repertorio. Entonces buscar entre las partidas filtradas para ver todas las partidas jugadas que estn en tu repertorio.
</p>
<p>
Es una buena idea mantener dos archivos de repertorio: uno para las Negras y otro para las Blancas, para poder buscar en cada archivo separadamente.
</p>
<p>
Desde la lnea de comandos puede abrirse un archivo de repertorio, por ejemplo: <br>
<b>scid mibase blancas.sor</b>
</p>
<p>
Puedes editar un archivo de repertorio (.sor) en cualquier editor de texto, pero ten cuidado en preservar su formato pues podra no poder cargarse o buscarse en l con Scid.
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

####################
### Tree window help:

set helpTitle(S,Tree) "Ventana de rbol"
set helpText(S,Tree) {<h1>La ventana de rbol</h1>
<p>
La ventana de <term>rbol</term> muestra informacin sobre todos los movimientos hechos desde la posicin actual en las partidas de la base de datos. En modo rbol, la ventana de rbol es actualizada automticamente cada vez que el tablero de la ventana principal cambia. Esto puede ser lento para bases de datos grandes.
</p>
<p>
Fjate que cada vez que la ventana de rbol es actualizada el <a Searches Filter>filtro</a> es restaurado y slo las partidas que tienen la posicin actual son incluidas en l.
</p>
<p>
Apretando el botn izquierdo del ratn sobre un movimiento en la ventana de rbol este se aade a la partida.
</p>

<h3>Contenidos de la ventana de rbol</h3>
<p>
La ventana de rbol muestra el <a ECO>cdigo ECO</a> (si hay alguno), frecuencia (en nmero de partidas, y en porcentajes) y la puntuacin para cada movimiento. La <term>puntuacin</term> siempre es calculada desde la perspectiva de las blancas, por lo que 100% significa que las blancas siempre han ganado y 0% que las negras siempre han ganado.
</p>
<p>
Los movimientos en la ventana de rbol pueden ser ordenados por el movimiento en si (alfabticamente), cdigo ECO, frecuencia, o puntuacin. Puedes cambiar el mtodo de ordenacin en el men <menu>Ordenar</menu>.
</p>

<h3><name Graph>Ventana grfica del rbol</name></h3>
<p>
La ventana de rbol incluye un botn denominado <term>Grfico</term> el cual muestra un grfico producido a partir de la ejecucin relativa, porcentajes, de cada movimiento en la posicin actual. Son mostrados todos los movimientos que han sido jugados al menos un 1% de las veces, y al menos 5 veces. Los porcentajes son siempre desde la perspectiva de las blancas, incluso cuando son las negras las que mueven.
</p>
<p>
Una lnea roja muestra en el grfico del rbol el trmino medio de todas las partidas segn la posicin actual, y se muestra el rea entre el 50 y 55% (donde se espera que punten la mayora de las aperturas estndar) en color azul para ayudar a la comparacin de los movimientos. Advierte que las blancas normalmente puntan en torno a 55% en el ajedrez a nivel maestro.
</p>

<h3><name Lock>Bloqueo de la ventana de rbol</name></h3>
<p>
El botn <term>Bloquear</term> de la ventana de rbol puede ser usado para bloquear el rbol en la actual base de datos. De esta manera el rbol continuar usando esa base de datos aunque cambies a otra base de datos abierta. Esto es til si necesitas usar una gran base de datos como referencia mientras juegas a traves de una partida en otra base de datos: simplemente abre el rbol en la base de datos de referencia, bloqualo, y entonces cambia a la otra base.
</p>

<h3><name Training>Entrenamiento</name></h3>
<p>
Cuando se selecciona <term>Entrenamiento</term> en la ventana de rbol Scid hace un movimiento aleatoriamente cada vez que aades un movimiento a la partida. El movimiento que escoge Scid depende de las estadsticas de la base de datos, un movimiento jugado en el 80% de las partidas de la base de datos ser escogido por Scid con una probabilidad del 80%. Es un buen sistema de probar tu conocimiento sobre aperturas: activa esta caracterstica, esconde (o minimiza)  la ventana de rbol y juega aperturas contra una base de datos de gran extensin.
</p>

<h3>Uso del rbol con archivos de Posicin abiertos</h3>
<p>
Para cada <a EPD>archivo de Posicin</a> abierto, la ventana de rbol contendr una columna extra que muestra un corto resumen (cinco caracteres) del contenido del libro de posiciones para cada posicin alcanzada desde los movimientos enumerados.
</p>
<p>
El resumen puede ser una valoracin, un cdigo de apertura o un movimiento sugerido; ser el contenido del primer campo EPD encontrado de la siguiente lista: <b>ce, eco, nic, pv, pm, bm, id</b>, o simplemente el primer campo EPD si no se encuentra ninguno de los citados antes.
</p>
<p>
Para obtener una descripcin de los campos EPD ver la pgina de ayuda de los <a EPD>archivos de Posicin</a>. Date cuenta que si el resumen es del campo <b>ce</b>, este es mostrado como una evaluacin en peones desde la perspectiva de las Blancas (en vez de como centsimas de pen desde la perspectiva del lado que mueve; que es el formato en los archivos de posicin) para as aumentar su legibilidad.
</p>

<h3>Cach para unos resultados ms rpidos</h3>
<p>
Scid mantiene una cach de los resultados de la bsqueda de rbol para las posiciones ms usuales en las partidas. Si mueves hacia adelante o atrs en una partida en el modo de rbol, vers la ventana de rbol actualizada casi instantneamente cuando la posicin buscada est en la cach.
</p>
<p>
La ventana de rbol tiene un comando llamado <term>Guardar archivo Cach</term> en el men archivo. Cuando lo seleccionas, se escriben los contenidos actuales de la cach que hay en la memoria a un archivo (con el sufijo <b>.stc</b>) para, en el futuro, aumentar la velocidad de uso del rbol con esta base de datos.
</p>
<p>
Date cuenta que un archivo de cach del rbol (.stc) es totalmente repetitivo; puedes borrarlo sin afectar a la base de datos, y de hecho este es borrado por Scid cada vez que ocurre una accin que pueda dejarlo anticuado -- por ejemplo, al aadir o reemplazar una partida, u ordenar la base de datos.
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

####################
### Compaction help:

set helpTitle(S,Compact) "Compactacin de la base de datos"
set helpText(S,Compact) {<h1>Compactacin de la base de datos</h1>
<p>
<term>Compactacin</term> de la base de datos es un tipo especfico de <a Maintenance>mantenimiento</a> que hace una base de datos tan pequea y eficiente como sea posible.
El compactar una base de datos significa que se borra cualquier espacio no utilizado en los archivos. Hay dos tipos: compactacin del archivo de nombres y del archivo de partidas.
</p>

<h3>Compactacin del archivo de nombres</h3>
<p>
Muchas veces puedes encontrar una base de datos que contiene una serie de nombres de jugadores, eventos, lugares o rondas que no son usados en ninguna partida. Esto amenudo sucede despus de que compruebes ortogrficamente los nombres. Los nombres no usados desaprovechan espacio en el archivo de nombres, y pueden enlentecer las bsquedas por nombres. La compactacin del archivo de nombres borra todos los nombres que no son usados en ninguna partida.
</p>

<h3>Compactacin del archivo de partidas</h3>
<p>
Siempre que una partida es reemplazada o borrada queda informacin no utilizada en el archivo de partidas (el ms grande de los tres archivos de base de datos de Scid). La compactacin del archivo de partidas elimina todo el espacio desaprovechado, quedando en la base de datos las partidas no borradas. Ten en cuenta que esta operacin es irreversible: despus de la compactacin, las partidas borradas se pierden para siempre!
</p>
<p>
La compactacin del archivo de partidas tambin se aconseja despus de <a Sorting>ordenar</a> una base de datos, para mantener el orden de las partidas de manera coherente con el archivo ndice que se a ordenado.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Database maintenance tools help:

set helpTitle(S,Maintenance) "Mantenimiento de la base de datos"
set helpText(S,Maintenance) {<h1>Mantenimiento de la base de datos</h1>
<p>
Scid proporciona una serie de herramientas para el mantenimiento de las bases de datos, accesibles desde el men de Scid <a Menus File>Archivo</a>. Las funciones de base de datos <a Compact>compactar</a> and <a Sorting>ordenar</a> son explicadas en pginas de ayuda separadas.
</p>

<NEW>
<h3>Maintenance window</h3>
<p>
Most Scid database maintenance can be done from the Maintenance
window, which can be opened from the <menu>File: Maintenance</menu>
or <menu>Windows</menu> menus or the shortcut key <b>Ctrl+M</b>.
</p>
<p>
You can use this window to maintain <a Flags>game flags</a>,
spellcheck names, <a Compact>compact</a> or <a Sorting>sort</a>
a database. Note that any operations that are not available
for the current database (for example, because it may be read-only
or a PGN file) will be greyed out.
</p>
</NEW>

<h3><name Twins>Borrado de partidas dobles</name></h3>
<p>
El men <menu>Archivo: Mantenimiento</menu> tiene el comando
<menu>Borrar partidas dobles...</menu> para detectar copias extra (dobles) de partidas en la base de datos. Este comando encuentra todos los pares de partidas que son dobles y, por cada par, seala la partida mas corta como borrada, dejando la ms larga sin borrar. Dos partidas son consideradas como dobles si sus jugadores (y cualquier otra etiqueta que puedes opcionalmente especificar) estn emparejados exactamente.
</p>
<p>
Si especificas la opcin los "mismos movimientos", cada par de partidas debe tener los mismos movimientos hasta la longitud de la partida ms corta (o hasta alcanzar el movimiento 40, lo primero que ocurra) para ser dobles.
</p>
<p>
Cuando tienes partidas dobles borradas, es una buena idea comprobar que cada partida borrada es realmente una copia de otra. Puedes hacer esto fcilmente si seleccionas la opcin "<b>Poner filtro a todas las partidas borradas</b>" en la caja de dilogo borrar dobles. Entonces el filtro contendr todas las partidas borradas. Puedes mirar a travs de ellas (usando las teclas <b>p</b> y <b>n</b>) con la ventana <term>comprobador de dobles</term> (disponible desde el men de mantenimiento, o la combinacin de teclas <b>Ctrl+Shift+T</b>) para verificar que cada partida a sido borrada porque es doble de otra.
</p>

<h3><name Editing>Edicin de nombres de jugadores, eventos, sitios y rondas</name></h3>
<p>
Puedes encontrar incorrecciones en los nombres de tu base de datos, las cuales puedes querer corregir. Puedes hacer esto en Scid con la ventana <term>Edicin de nombres</term> (combinacin de teclas: <b>Control+Shift+N</b>), disponible en el submen <menu>Archivo: Mantenimiento</menu>.
</p>
<p>
Cada nombre es almacenado slo una vez en el archivo de nombres, por lo que cambiando un nombre realmente cambias todas sus ocurrencias.
</p>

<h3><name Spellcheck>Correccin ortogrfica de nombres</name></h3>
<p>
Scid viene con un archivo de <term>correccin ortogrfica</term> llamado <b>spelling.ssp</b>, para la correccin de los nombres de jugadores, eventos, sitios y rondas. Scid intentar cargar el archivo de correccin ortogrfica siempre que se inicie; si este no se carga, puedes cargarlo desde el men <menu>Opciones</menu>.
</p>
<p>
Una vez que el archivo de correccin ortogrfica es cargado, puedes usarlo en una base de datos Scid mediante los comandos del men <menu>Archivo: Mantenimiento</menu>, o desde la ventana de mantenimiento.
</p>
<p>
Cuando corriges la ortografa de una base de datos, Scid produce una lista de correcciones que puedes editar antes de que realmente hagas alguna correccin, de esta manera puedes quitar cualquier correccin que no quieras que se realice.
</p>
<p>
La correccin ortogrfica es especialmente til para estandarizar una base de datos para que todos los ejemplos de un jugador en particular sean escritos de la misma manera. Por ejemplo, con el archivo de correccin ortogrfica estndar, los nombres "Kramnik,V.", "Vladimir Kramnik", y "V. Kramnik" sern todos corregidos a "Kramnik, Vladimir".
</p>
<p>
El archivo de correccin ortogrfica tiene un uso adicional: cuando es cargado, sus datos de jugadores son usados para enriquecer la ventana <a PInfo>informacin de los jugadores</a> y la ventana de <a Crosstable>tabla cruzada</a>: podrs ver los ttulos de los maestros de la FIDE (<b>gm</b> = Gran Maestro Internacional, <b>im</b> = Maestro Internacional, etc) y la informacin del pas de cualquier jugador que este listado en el archivo de correccin ortogrfica. Ms de 5000 grandes jugadores del pasado y el presente estn listados en el archivo <b>spelling.ssp</b> que viene con Scid.
</p>

<h3><name Ratings>Aadiendo clasificacin Elo a las partidas</name></h3>
<p>
El botn "Aadir clasificacin Elo..." de la ventana de mantenimiento hace que Scid busque en la base de datos activa partidas en las que un jugador no tiene clasificacin Elo, pero que en el archivo de correccin ortogrfica tiene almacenada la clasificacin Elo de ese jugador para la fecha en la que se jug esa partida.
Scid aadir todo este tipo de puntuaciones Elo automticamente. Esto es muy til para una base de datos con partidas de maestros en las que se encuentran pocas puntuaciones Elo.
</p>
<p>
El archivo de correccin ortogrfica "spelling.ssp" que viene con Scid no contiene la informacin sobre el Elo necesaria para esta funcin, pero se encuentra disponible en el <a Author>sitio web de Scid</a> una versin de ella llamada "ratings.ssp".
</p>

<h3><name Cleaner>La MultiHerramienta</name></h3>
<p>
La  <term>MultiHerramienta</term> de Scid (disponible desde la ventana de Mantenimiento) es una herramienta para hacer una serie de tareas de mantenimiento en una base de datos en una sola accin. Puedes escoger que tareas deseas hacer, y Scid las ejecutar en la actual bases de datos sin requerir la interaccin del usuario. Esto es especialmente til para el mantenimiento de grandes bases de datos.

<p><footer>(Actualizado: Scid 3.0, Noviembre 2001)</footer></p>
}

####################
### Sorting help:

set helpTitle(S,Sorting) "Ordenar una base de datos"
set helpText(S,Sorting) {<h1>Ordenar una base de datos</h1>
<p>
La funcin <term>ordenar</term> clasifica todas las partidas en una base de datos. Puedes seleccionar una serie de criterios de ordenacin. Cuando dos partidas son iguales segn el primer criterio, son ordenadas usando el segundo criterio y as sucesivamente.
</p>

<h3>Criterios de ordenacin</h3>
<p>
Los criterios de ordenacin disponibles son:
</p>
<ul>
<li> Fecha (las partidas ms antiguas primero) </li>
<li> Ao (igual que fecha, pero usando slo el ao) </li>
<li> Nombre del evento </li>
<li> Nombre del lugar </li>
<li> Nacin (las ltimas 3 letras del nombre del lugar) </li>
<li> Nombre de la ronda </li>
<li> Nombre de las blancas </li>
<li> Elo (media del Elo de las blancas y las negras, el ms alto primero) </li>
<li> Nombre de las negras </li>
<li> Resultado (primero blancas ganan, luego tablas y luego negras ganan) </li>
<li> Longitud (nmero total de movimientos de una partida) </li>
<li> ECO (el <a ECO>cdigo de la Encycolpedia of Chess Openings</a>) </li>
</ul>

<h3>Resultados de la ordenacin</h3>
<p>
Cuando ordenas una base de datos Scid que no es de slo lectura, el resultado de la ordenacin es guardado, por lo que el orden de las partidas en la base de datos cambia de manera permanente. Si quieres que el resultado de la ordenacin sea temporal, haz primero que la base de datos sea de slo lectura usando el comando del men <b>Archivo: Slo lectura</b>.
</p>
<p>
Cuando ordenas una base de datos que es de slo lectura o que es un archivo PGN, el resultado de la ordenacin no puede ser guardado por lo que el orden de las partidas se pierde cuando se cierra el archivo.
</p>
<p>
Ten encuenta que la ordenacin de una base de datos anula el <a Searches Filter>filtro de bsqueda</a> para as contener todas las partidas.
</p>

<h3>Nota importante sobre la ordenacin de bases de datos:</h3>
<p>
Cuando una base de datos es ordenada, se altera el archivo del ndice, pero el archivo de partidas permanece inalterado. Esto significa que ordenando una base de datos el registro del archivo de partidas se queda desordenado en relacin con el archivo del ndice. Esto puede <b>enlentecer</b> el <a Tree>rbol</a>, las <a Searches>bsquedas</a> por posicin y por material/modelo, por lo que deberas de reordenar el archivo de partidas mediante la <a Compact>compactacin</a> despus de la ordenacin para as mantener el buen rendimiento de la bsqueda.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Flags help:

set helpTitle(S,Flags) "Game Flags"
set helpText(S,Flags) {<h1>Game Flags</h1>

<p>
A <term>flag</term> is an indicator of some chess characteristic
that can be turned on or off for each game in the database.
There are 13 user-settable flags that you can directly set for
each game. Of these, only the Delete flag has any special
significance: games with the Delete flag turned on are marked
for deletion and will removed when the database is
<a Compact>compacted</a>.
</p>
<p>
The other 12 user-settable flags and their symbols are:
</p>

<ul>
<li>White opening (W)</li>
<li>Black opening (B)</li>
<li>Middlegame (M)</li>
<li>Endgame (E)</li>
<li>Novelty (N)</li>
<li>Pawn structure (P)</li>
<li>Tactics (T)</li>
<li>Queenside play (Q)</li>
<li>Kingside play (K)</li>
<li>Brilliancy (!)</li>
<li>Blunder (?)</li>
<li>User-defined (U)</li>
</ul>

<p>
A flag can be set for the current game, all filter games, or all
database games using the <a Maintenance>maintenance</a> window.
</p>
<p>
You can use a <a Searches Header>header search</a> to find all
games in a database that have a particular flag turned on or off,
or use flags as part of more complex searches.
</p>
<p>
Since all the user-settable flags (except the Delete flag) have
no significance to Scid, you can use them for any purpose that
suits your needs. For example, you could use the Kingside (K)
flag for kingside pawn storms, or kingside heavy piece attacks,
or even for endgames with all pawns on the kingside.
</p>

<p><footer>(Actualizado: Scid 3.0, Noviembre 2001)</footer></p>
}

####################
### Analysis window help:

set helpTitle(S,Analysis) "Ventana de Anlisis"
set helpText(S,Analysis) {<h1>La ventana de Anlisis</h1>
<p>
La ventana de anlisis de Scid muestra el anlisis que realiza un programa de ajedrez de la posicin actual del tablero. Cada vez que el tablero cambia, Scid manda la nueva posicin al programa de anlisis.
</p>
<p>
La puntuacin mostrada en la ventana de anlisis es siempre desde la perspectiva de las blancas, por lo que una puntuacin negativa indica que las negras estn mejor.
</p>

<h3>Aadir el anlisis a la partida</h3>
<p>
El botn <term>Aadir a comentario</term> en la ventana de anlisis aade la puntuacin y la mejor lnea de juego actual al comentario del movimiento en la partida.
</p>
<p>
Puedes hacer esto automticamente para una serie de movimientos anotando la partida, iniciando el <a MainWindow Autoplay>modo de automovimiento</a>.
Cuando se usa el modo de automovimiento, y la ventana de anlisis est abierta, se aade automticamente un comentario que contiene la puntuacin y la mejor lnea de juego de cada posicin de la partida por la que pasa el modo de automovimiento. Slo son anotadas las posiciones desde la actual hasta el final de la partida (o hasta salir del modo de automovimiento), por lo que puedes omitir la anotacin de los movimientos de la apertura yendo a una posicin media de la partida antes de iniciar el modo de automovimiento.
</p>
<p>
Puedes incrementar el tiempo de demora entre movimientos para aumentar la calidad del anlisis desde el men <menu>Opciones: Movimientos</menu>.
</p>
<p>
Para cancelar la anotacin en cualquier momento, slo desactiva el modo de automovimiento; por ejemplo presionando la tecla de escape en la ventana principal.
</p>

<h3>Detalles de la interconexin</h3>
<p>
Para usar la ventana de anlisis necesitars un programa de ajedrez que soporte los comandos estndar de <term>Xboard</term>. En concreto, Scid enva los comandos <b>xboard</b> y <b>post</b> al programa cuando este se inicia.
</p>
<p>
Si Scid distingue a "Crafty" al principio de una lnea de salida del programa de ajedrez usar los comandos especficos de crafty, tales como <b>setboard</b> para actualizar cada posicin.
</p>
<p>
Para todos los dems programas, Scid manda los siguientes comandos cada vez que la posicin cambia:  <b>new</b> y <b>force</b>, luego los movimientos de la partida en la posicin actual, y despus <b>go</b>.
</p>
<p>
El excelente programa gratuito de Bob Hyatt <term>crafty</term> es el que yo uso y recomiendo para la ventana de anlisis de Scid, pero yo tambin he usado otros programas exitosamente con Scid, como son Phalanx y Gnuchess.
</p>
<p>
Crafty puede ser descargado de: <br>
<url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url>
</p>
<p>
Gnuchess est disponible: <br>
<url http://www.gnu.org/software/chess/chess.html>http://www.gnu.org/software/chess/chess.html</url>
</p>
<p>
El sitio de descarga de Phalanx es: <br>
<url ftp://ftp.math.muni.cz/pub/math/people/Dobes/>ftp://ftp.math.muni.cz/pub/math/people/Dobes/</url>
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### EPD files help:

set helpTitle(S,EPD) "Archivos de posiciones"
set helpText(S,EPD) {<h1>Archivos posiciones</h1>
<p>
Un archivo de posiciones Scid (extensin ".epd") es simplemente una coleccin de posiciones, en el que cada posicin tiene cierto texto asociado. Las antiguas versiones de Scid usaban un formato especial (extensin ".sbk") para los archivos de posiciones, pero desde la versin 1.6 Scid usa el formato estndar de archivos <term>EPD</term> (extended position description).
</p>
<p>
Un archivo EPD tiene un nmero definido de <term>opcodes</term> (campos), los cuales son almacenados separados por punto y coma (<b>;</b>) en el archivo, pero son mostrados en distintas lneas en la ventana de archivos de posiciones de Scid para facilitar su edicin. Un punto y coma dentro de un campo EPD es almacenado por Scid como "<b>\s</b>" para distinguirlo de una marca de fin de campo. Cada posicin y sus opcodes son almacenados en una lnea en el archivo EPD.
</p>
<p>
Los opcodes EPD estndar incluyen:
<ul>
<li> <b>acd</b> Recuento de anlisis: profundidad de bsqueda.</li>
<li> <b>acn</b> Recuento de anlisis: nmero de nodos buscados.</li>
<li> <b>acs</b> Recuento de anlisis: tiempo de bsqueda en segundos.</li>
<li> <b>bm</b> Mejores movimientos: movimiento(s) que se ha juzgado como mejor por alguna razn.</li>
<li> <b>ce</b> Evaluacin en centsimas de pen: evaluacin en centsimas de pen desde la perspectiva del <b>lado que mueve</b> -- date cuenta que esto difiere de la ventana de anlisis, la cual muestra las evaluaciones en peones desde la perspectiva de las blancas. </li>
<li> <b>cX</b> Comentario (donde <b>X</b> es un nmero, 0-9).</li>
<li> <b>eco</b> Cdigo del sistema de aperturas <a ECO>ECO</a>.</li>
<li> <b>id</b> nica Identificacin para esta posicin.</li>
<li> <b>nic</b> Cdigo del sistema de aperturas <i>New In Chess</i>.</li>
<li> <b>pm</b> Movimiento previsto: el primer movimiento de la PV (variacin prevista).</li>
<li> <b>pv</b> Variacin prevista: la lnea con mejor juego.</li>
</ul>

<p>
Los archivos de posiciones tienen distintos usos: Scid usa un archivo de posiciones para clasificar las partidas segn el sistema de la <a ECO>Encyclopaedia of Chess Openings</a> (ECO), y tu puedes hacer un archivo de posiciones para tu repertorio de aperturas, aadiendo comentarios en las posiciones que alcanzas asiduamente en las partidas.
</p>
<p>
Puedes crear un nuevo archivo de posiciones o abrir uno desde el submen
<menu>Archivo de posiciones</menu> del men <menu>Archivo</menu>. Como mximo se pueden abrir cuatro archivos de posiciones al mismo tiempo.
</p>

<h3>Ventanas de posiciones</h3>
<p>
Para cada archivo de posiciones abierto se muestra una ventana que muestra el texto de la posicin actual. No necesitas apretar el botn Almacenar para guardar los cambios hechos en el texto de una posicin; el texto ser almacenado cada vez que te muevas a una nueva posicin de la partida.
</p>

<h3>Navegando por los archivos de posicin</h3>
<p>
Para moverte a travs de las posiciones usa los comandos <menu>Siguiente posicin</menu> y <menu>Posicin anterior</menu> del men <menu>Herramientas</menu> de la ventana de posiciones, o usa las combinaciones de teclas <b>Ctrl+Flecha abajo</b> y <b>Ctrl+Flecha arriba</b>. Estos comandos mueven a la siguiente/anterior posicin del archivo, quitando de en medio la partida actual y colocando su posicin de inicio.
</p>

<h3>Eliminando campos EPD</h3>
<p>
Los archivos EPD que encuentras en internet pueden contener campos que no te interesan, los cuales pueden consumir gran cantidad de espacio en un archivo. Por ejemplo, un archivo EPD de evaluacin de ordenadores puede tener los campos ce, acd, acn, pm, pv e id pero tu puedes necesitar tan slo los campos ce y pv.
</p>
<p>
Puedes eliminar un opcode EPD de todas las posiciones del archivo usando <menu>Eliminar campos EPD</menu> desde el men <menu>Herramientas</menu> de la ventana de posiciones.
</p>

<h3>La barra de estado de la ventana de posiciones</h3>
<p>
La barra de estado de cada ventana de posiciones muestra:
<ul>
<li>- el estado del archivo (<b>--</b> significa sin cambios, <b>XX</b> significa cambiado, y <b>%%</b> significa slo lectura); </li>
<li>- el nombre del archivo; </li>
<li>- el nmero de posiciones del archivo; </li>
<li>- movimientos legales desde la posicin actual que alcanzan otra posicin de este archivo de posiciones.</li>
</ul>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

######################
### Email window help:

set helpTitle(S,Email) "Ventana de Email"
set helpText(S,Email) {<h1>Ventana de Email</h1>
<p>
La ventana de administracin de emails te proporciona una manera para manejar
las partidas de ajedrez por correspondencia jugadas por email. Si no juegas
partidas de ajedrez por email esto no ser de inters para ti. Pero si juegas
al ajedrez mediante emails puedes mandar tus mensajes directamente desde Scid!
</p>
<p>
No olvides que el administrador de emails est actualmente solo disponible para
Scid en plataformas Unix/Linux. No est disponible para usuarios de Windows.
</p>
<p>
Para usar el administrador de emails:
<ul>
<li><b>1)</b> Crear la(s) partidas(s) para tu oponente en la base de datos.
</li>
<li><b>2)</b> En la ventana del administrador de email selecciona <b>Aadir</b>
e ingresa los detalles de tu oponente: nombre, direccin de email, y los nmeros
de partida en la base de datos. </li>
<li><b>3)</b> Selecciona <b>Enviar email</b> en la ventana de email cada vez que
hayas aadido movimientos a la(s) partida(s) y quieras enviar un mensaje. </li>
</ul>

<p>
Cuando envas un mensaje de email, Scid crea el mensaje con las partidas en
formato PGN <b>sin</b> ningn comentario, anotacin o variacin, dado que
habitualmente tu no debes querer que tu oponente vea tus anlisis. Puedes editar
el mensaje antes de enviarlo para aadir movimientos potenciales u otro texto.
</p>
<p>
Para cada oponente puedes tener cualquier nmero de partidas; una o dos es lo
ms comn. Advierte que Scid no comprueba si los nmeros de partida cambian, as
que despus de introducir los datos de tu oponente debes ser cuidadoso para
evitar borrar partidas u ordenar tu base de datos de partidas de email, puesto
que esto reubicara las partidas, siendo el nmero de las partidas de cada
oponente incorrecto.
</p>

<h3>Limitaciones</h3>
<p>
Scid no tiene todava ninguna capacidad para consultar tu carpeta de email, por lo que todava necesitas aadir los movimientos de tu oponente a las partidas manualmente.
</p>

<h3>Configuracin</h3>
<p>
Una copia de cada mensaje de email es guardada por Scid en el archivo <b>.scid_sent_emails</b> en tu directorio "home". Si deseas que sean guardados en un archivo diferente tendrs que editar el archivo <b>tcl/start.tcl</b> y recompilar Scid.
</p>
<p>
Para usar el administrador de email tienes que tener instalado en tu sistema
<term>sendmail</term>; muchos sistemas Unix/Linux usan <term>sendmail</term> para enviar los mensajes de email. Si tu programa sendmail no tiene la ruta <b>/usr/lib/sendmail</b> tendrs que editar <b>tcl/start.tcl</b> y recompilar Scid. La siguiente localizacin ms comn de sendmail es <b>/usr/sbin/sendmail</b>.
</p>
<p>
Scid guarda los detalles del oponente de una base de datos en un archivo con el mismo nombre que la base de datos con el sufijo "<b>.sem</b>".
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

####################
### Opening Report help:

set helpTitle(S,OpReport) "Informe de la Apertura"
set helpText(S,OpReport) {<h1>Informe de la Apertura</h1>
<p>
Scid puede generar un <term>informe de la apertura</term> que muestra datos interesantes sobre una apertura. Para producir un informe de la apertura, primero asegrate que se muestra la posicin de la cual quieres el informe, entonces selecciona <b>Informe de la Apertura</b> en el men <b>Herramientas</b>.
</p>
<p>
La ventana del <term>Informe de la Apertura</term> muestra el resultado del informe producido por Scid. El men <b>Archivo</b> tiene comandos para guardar el informe en archivos de texto sin formato, HTML o en formato <a LaTeX>LaTeX</a>.
</p>
<p>
Las primeras secciones del informe muestran informacin sobre las partidas que llegan hasta la posicin del informe, y los movimientos realizados desde esa posicin. Puedes ver si la apertura se est haciendo ms popular, si tiene muchas tablas de corta duracin, y que orden de movimientos (transposiciones)
se han usado para llegar a esa posicin.
<p>
La parte ltima, y ms larga, es la tabla terica. Cuando guardes el informe en un archivo puedes escoger entre guardar slo la tabla terica, un informe compacto sin la tabla terica o la totalidad del informe.

<h3>Lmites</h3>
<p>
Hay un lmite de 2000 partidas para la mayora de los datos generados por el informe, as que si el informe de la posicin tiene lugar en ms de 2000 partidas algunos resultados pueden ser ligeramente incorrectos.
</p>
<p>
Adems, hay un lmite de 500 partidas para la tabla ECO. Si la posicin del informe tiene lugar en ms de 500 partidas slo las 500 partidas con el mayor promedio de clasificacin Elo sern utilizadas para producir la tabla ECO.
</p>

<h3>Exhibicin preliminar LaTeX</h3>
<p>
El botn <b>Exhibicin preliminar LaTeX</b> en la esquina inferior izquierda de la ventana del informe (no disponible en las versiones Windows) guarda el informe como un archivo temporal de formato LaTeX; pon a funcionar <b>latex</b> en l, y ejecuta <b>xdvi</b> para visualizar los resultados. Esto <b>slo</b> funcionar si tienes latex, xdvi y todos los paquetes latex necesarios instalados en tu ordenador; ver la pgina de ayuda <a LaTeX>Usando LaTeX con Scid</a>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Player Info help:

set helpTitle(S,PInfo) "Ventana de Informacin del Jugador"
set helpText(S,PInfo) {<h1>La ventana de Informacin del Jugador</h1>
<p>
La ventana <term>Informacin del Jugador</term> es producida o actualizada cada vez que aprietas el botn izquierdo en el rea de informacin (debajo del tablero) o en la ventan de <a Crosstable>tabla cruzada</a> sobre el nombre de un jugador.
</p>
<p>
Muestra (optimstamente) informacin de utilidad sobre el jugador, incluyendo sus xitos con blancas y negras, aperturas favoritas (segn <a ECO>cdigos ECO</a>),
y la historia de su Elo.
</p>
<p>
Todos los porcentajes mostrados son una puntuacin esperada (ndice de acierto), desde la perspectiva del jugador -- por lo que cuanto ms altos son mejor es para el jugador, tanto si juega con blancas como si lo hace con negras.
</p>
<p>
Puedes ver la historia del Elo de un jugador en un grfico presionando el botn
<a Graphs Rating>Grfico Elo</a>.
</p>
<p>
Cualquier nmero impreso en rojo puede se apretado con el botn izquierdo del ratn para poner las partidas que representa en el <a Searches Filter>filtro</a>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Graphs help:

set helpTitle(S,Graphs) "Ventanas de grficos"
set helpText(S,Graphs) {<h1>Ventanas de grficos</h1>
<p>
Scid tiene una serie de ventanas que muestran informacin de manera grfica. Estas son explicadas a continuacin.
</p>

<h3><name Rating>Ventana del Grfico Elo</name></h3>
<p>
La ventana del <term>Grfico Elo</term> muestra la historia del Elo de un jugador o de los dos jugadores de la partida actual. Puedes producir el grfico para un nico jugador presionando el botn <b>Grfico Elo</b> en la ventana <a PInfo>informacin del jugador</a>, o generarlo para los dos jugadores de la partida actual seleccionando <b>Grfico Elo</b> en el men <menu>Herramientas</menu>.
</p>

<h3><name Score>Ventana del Grfico de Puntuacin</name></h3>
<p>
La ventana del <term>Grfico de Puntuacin</term> muestra la evaluacin numrica (puntuacin) almacenada en los comentarios de la actual partida en forma grfica. Puedes apretar el botn izquierdo del ratn en cualquier parte del grfico de puntuacin para ir a la posicin correspondiente de la partida.
</p>
<p>
Son reconocidos dos tipos de comentarios de evaluacin: aquellos producidos por la ventana de <a Analysis>anlisis</a> de Scid (que tienen el formato
<ul>
<li><b>1.e4 {"+0.25 ...."}</b></li>
</ul>
y son siempre puntuados desde la perspectiva de las blancas) y aquellos por el comando anotar de Crafty (el cual tiene el formato
<ul>
<li><b>1.e4 ({9:+0.25} ....)</b></li>
</ul>
y son puntuados desde la perspectiva de las blancas).
</p>

<h3><name Tree>Ventana del Grfico de rbol</name></h3>
<p>
La ventana del <term>Grfico de rbol</term> esta disponible desde la ventana de rbol. Muestra el rendimiento de los movimientos ms usuales desde la posicin actual. Hay ms informacin disponible sobre esto en la pgina de ayuda del <a Tree Graph>rbol</a>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Tablebases help:

set helpTitle(S,TB) "Tablebases"
set helpText(S,TB) {<h1>Tablebases</h1>

<p>
Una <term>tablebase</term> es un archivo que contiene la informacin de un resultado perfecto de todas las posiciones con una distribucin de material concreta, como Rey y Torre contra Rey y Pen. Se han realizado tablebases de situaciones con material de hasta cinco piezas (incluidos los reyes), y algunas tablebases simples para seis piezas tambin estn disponibles.
</p>
<p>
Scid puede usar tablebases en formato Nalimov, formato que es usado por muchos motores de ajedrez modernos. Estos amenudo terminan con el sufijo <b>.nbw.emd</b> o <b>.nbb.emd</b>.
</p>

<h3>Uso de las tablebases en Scid</h3>
<p>
Para usar un directorio de archivos de tablebase en Scid, simplemente ubica el directorio seleccionando <b>Directorio de las TB...</b> en el men <menu>Opciones</menu>.
</p>
<p>
Cuando se encuentra una posicin que se encuentra en un archivo de tablebase, el rea de informacin de la partida (debajo del tablero de ajedrez) muestra informacin de la tablebase. Puedes configurar la cantidad de informacin mostrada pinchando con el botn derecho del ratn en este area o seleccionando   <b>Informacin de la partida</b> en el men <menu>Opciones</menu>. Seleccionando la opcin "resultado y mejor movimiento" se obtiene la mayor cantidad de informacin, pero es amenudo mucho ms lento que la opcin "slo resultado".

<h3>La ventana de Tablebase</h3>
<p>
Puedes obtener ms informacin sobre la posicin actual abriendo la <term>ventana de Tablebase</term> (men <menu>Ventanas</menu>,
atajo: Ctrl+Shift+T). Esta ventana muestra el resultado, con un juego perfecto, de todos los movimientos legales desde la actual posicin.
</p>

<h3>Obtener archivos de Tablebases</h3>
<p>
Ver la seccin de <a Author Related>links relacionados</a> para obtener ayuda para encontrar archivos de tablebases en internet.
</p>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}


####################
### Bookmarks help:

set helpTitle(S,Bookmarks) "Bookmarks"
set helpText(S,Bookmarks) {<h1>Bookmarks</h1>
<p>
Scid allows you to <term>bookmark</term> important games for easy
future reference. The bookmarks menu is available from the
<menu>File</menu> menu, the toolbar, or the <B>Ctrl+B</b> shortcut key.
</p>
<p>
When you select a bookmarked game from the Bookmarks menu, Scid will
open its database if necessary, find that game, and move to the game
position at which it was bookmarked.
</p>
<p>
Only games in a Scid format database (not a PGN file or the clipbase)
can be bookmarked.
</p>
<p>
If the database of a bookmarked game is sorted or compacted, the bookmark
details may become out of date. When that happens, Scid will search the
database for the best matching game (comparing player names, site, etc)
when the bookmark is selected, so the bookmarked game should still be
loaded. However, if details of the bookmarked game change, it is possible
that a different game will match the bookmark details better and be
loaded instead. So it is a good idea to re-bookmark a game if you edit
its players, site, result, round or year.
</p>

<h3>Editing bookmarks</h3>
<p>
With the bookmark editor, you can change the menu text displayed for
each bookmarked game and add folders to categorize bookmarks.
</p>

<h3>Hints</h3>
<p>
You can use bookmarks for fast access to databases you use often
by bookmarking a game from each database. Another good use for
bookmarks is to add important games you find when studying a
particular chess opening.
</p>
<p>
The bookmarks menu contains an entry for controlling the display of
bookmark folders: they can be shown as submenus (useful when there are
many bookmarks), or as a single list.
</p>

<p><footer>(Actualizado: Scid 3.0, Noviembre 2001)</footer></p>
}

#################
### Pgnscid help:

set helpTitle(S,Pgnscid) "Pgnscid"
set helpText(S,Pgnscid) {<h1>Pgnscid</h1>
<p>
<term>Pgnscid</term> es un programa aparte que necesitas usar (eso era antes) para convertir archivos PGN (portable game notation) en bases de datos Scid.
</p>
Para convertir un archivo llamado <i>miarchivo.pgn</i>, simplemente escribe:
<ul>
<li> <b>pgnscid miarchivo.pgn</b> </li>
</ul>
y la base de datos Scid (consistente en <i>miarchivo.si</i>, <i>miarchivo.sg</i> y <i>miarchivo.sn</i>) ser creada. Cualquier error o advertencia ser escrita en el archivo <i>miarchivo.err</i>.
</p>
<p>
Si quieres que la base de datos sea creada en un directorio diferente o que tenga un nombre diferente puedes aadir el nombre de la base de datos en la lnea de comandos, por ejemplo:
<ul>
<li> <b>pgnscid miarchivo.pgn mibase</b> </li>
</ul>
crear una base de datos consistente en los archivos <i>mibase.si</i>,
<i>mibase.sg</i> y <i>mibase.sn</i>.
</p>
<p>
Advierte que pgnscid (y scid) pueden leer archivos comprimidos en Gzip (ej. <b>mibase.pgn.gz</b>) directamente, por lo que, si tienes un gran archivo PGN comprimido con Gzip para ahorrar espacio, no necesitas descomprimirlo primero.
</p>

<h3>Opciones</h3>
<p>
Hay dos argumentos opcionales que pgnscid puede aceptar delante del nombre del fichero:
<b>-f</b> y <b>-x</b>.
</p>
<p>
La opcin <b>-f</b> fuerza a sobrescribir una base de datos existente; por defecto, pgnscid no convierte a una base de datos que ya existe.
</p>
<p>
La opcin <b>-x</b> provoca que pgnscid ignore todo el texto entre partidas. Por defecto, el texto entre partidas es guardado como un comentario de la partida que le sigue. Esta opcin slo afecta al texto entre partidas; los comentarios estndar dentro de cada partida son, an as, convertidos y guardados.
</p>

<h3>Formateo de nombres de jugadores</h3>
<p>
Para reducir el nmero de ortografas que hacen referencia al mismo jugador, pgnscid hace un formateo bsico de los nombre de los jugadores. Por ejemplo, el nmero de espacios despus de cada coma se estandariza a uno, se borra cualquier espacio al principio y final de un nombre, y se borran los puntos al final de un nombre. Los prefijos holandeses como "van den" y "Van Der" se normalizan para que tengan la V mayscula y la d minscula.
</p>
<p>
Puedes editar (e incluso revisar ortogrficamente de manera automtica) los nombres de los jugadores, eventos, lugares y rondas con Scid; ver las pginas de ayuda de <a Maintenance Editing>Mantenimiento</a> para obtener ms detalles.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### Options and Fonts help:

set helpTitle(S,Options) "Opciones"
set helpText(S,Options) {<h1>Opciones y preferencias</h1>
<p>
Muchas opciones y preferencias de Scid (como pueden ser: tamao del tablero, colores, fuentes y valores por defecto) son ajustables desde el men  <menu>Opciones</menu>.
Todas estas (y ms, como el ltimo directorio desde el que tu cargaste una base de datos y el tamao de algunas ventanas) son guardadas en el archivo opciones cuando seleccionas en el men Opciones <b>Guardar opciones</b>. El archivo opciones es cargado cada vez que se inicia Scid.
</p>
<p>
Si usas Windows, el archivo opciones es <b>scid.opt</b> el cual se encuentra en el directorio donde se encuentra el archivo del programa Scid, <b>scid.exe</b>. Para los usuarios del sistema operativo Unix (como puede ser Solaris o Unix) el archivo es: <b>~/.scid</b> --
es decir, el archivo <b>.scid</b> de tu directorio personal.
</p>

<h3><name Fonts>Tipos de fuentes</name></h3>
<p>
Scid tiene tres tipos de fuentes bsicas que usa en la mayora de sus ventanas, y que puedes personalizar. Estas son llamadas <b>habitual</b>, <b>pequea</b> y <b>fijada</b>.
</p>
<p>
La fuente fijada tiene una anchura de fuente fija (no proporcional). Es usada en las ventanas <a Tree>rbol</a> y <a Crosstable>tabla cruzada</a>.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### File formats help:

set helpTitle(S,Formats) "Formatos de archivo"
set helpText(S,Formats) {<h1>Los formatos de archivo de Scid</h1>
<p>
Las bases de datos Scid consisten en tres archivos esenciales: un archivo ndice, un archivo de Nombres y un archivo de Partidas. Todos tienen una extensin de dos letras que empieza con la letra "s": ".si" para los archivos ndice, ".sn" para los archivos de nombres, y ".sg" para los archivos de partidas.
</p>

<h3>El archivo ndice (.si)</h3>
<p>
Este archivo contiene una descripcin para la base de datos y pequea entrada de tamao fijo para cada partida. El actual tamao es de 41 bytes por partida. De estos, alrededor de 28 bytes son informacin esencial como el resultado, fecha, nmeros de identificacin de los nombres del jugador/evento/lugar (el nombre existente est en el archivo de Nombres), etc.
</p>
<p>
Los 13 bytes restantes contienen informacin repetida, pero til, sobre la partida; es usada para aumentar la velocidad de las bsquedas por posicin, material y modelo. Ver la seccin <a Formats Fast>Bsquedas rpidas</a> ms adelante para obtener ms informacin.
</p>

<h3>El archivo de Nombres (.sn)</h3>
<p>
Este archivo contiene todos los nombres de jugadores, eventos, lugares y rondas de la base de datos. Cada nombre es almacenado slo una vez, incluso si este aparece en muchas partidas. El archivo de nombres normalmente es el ms pequeo de los tres archivos esenciales de una base de datos.
</p>

<h3>El archivo de Partidas (.sg)</h3>
<p>
Este archivo contiene los movimientos, variaciones y comentarios de cada partida. El formato de codificacin de los movimientos es muy compacto: la mayora de los movimientos ocupan slo un byte de almacenamiento.
</p>
<p>
Cuando una partida es reemplazada, su nueva versin es guardada al <i>final</i> del archivo de partidas, por lo que se puede acumular con el tiempo espacio intil. Puedes restablecer una base de datos a su mnimo tamao mediante su <a Compact>compactacin</a>.
</p>

<h3>Otros archivos Scid</h3>
<p>
Un archivo <a EPD>EPD</a> (sufijo: ".epd") contiene una serie de posiciones, cada una con un comentario de texto. El formato de archivo EPD se describe en el <a Author Related>estndar PGN</a>.
</p>
<p>
Un archivo de E-mail (sufijo: ".sem") para una base de datos almacena detalles de los oponentes a los que mandas mensajes.
</p>
<p>
Un archivo de Opciones de Bsqueda (sufijo: ".sso") contiene opciones de bsqueda de Scid de <a Searches Header>cabecera</a> o de <a Searches Material>material/modelo</a>.
</p>

<h3><name Fast>Bsquedas rpidas en Scid</name></h3>
<p>
Como se a mencionado ms arriba el archivo de ndice almacena alguna informacin repetida pero til sobre cada partida para acelerar las bsquedas de posicin o material.
</p>
<p>
Por ejemplo, se guarda el material de la posicin final. Si buscas finales de torre y pen, entonces todas las partidas que terminen con una dama, alfil o caballo sobre el tablero (y no tienen promocin de peones) sern rpidamente saltadas.
</p>
<p>
Otro segmento de informacin guardado de utilidad es el orden en el que los peones dejan su casilla inicial (por moverse o por ser capturados). Esto es usado para aumentar la velocidad del rbol o de las bsquedas por posicin exacta, especialmente para posiciones de apertura. Por ejemplo, cuando se busca la posicin inicial de la defensa francesa (1.e4 e6), se saltan todas las partidas que empiezan con 1.e4 c5, o 1.d4, etc, pero las partidas que empiezan con 1.e4 e5 todava podrn ser utilizadas en la bsqueda.
</p>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

####################
### NAG values help:

set helpTitle(S,NAGs) "Valores NAG"
set helpText(S,NAGs) {<h1>Valores NAG estndares</h1>
<p>
Los valores NAG (Numeric Annotation Symbol) estndares definidos en el <a Author Related>estndar PGN</a> son:
</p>
<cyan>
<ul>
<li>  1   Buen movimiento (!) </li>
<li>  2   Mal movimiento (?) </li>
<li>  3   Excelente movimiento (!!) </li>
<li>  4   Error garrafal (??) </li>
<li>  5   Movimiento interesante (!?) </li>
<li>  6   Movimiento dudoso (?!) </li>
<li>  7   Movimiento forzado </li>
<li>  8   Movimiento singular; no hay alternativas razonables </li>
<li>  9   Movimiento que conlleva la derrota </li>
<li> 10   Posicin de tablas (=) </li>
<li> 11   Oportunidades iguales, posicin tranquila (=) </li>
<li> 12   Oportunidades iguales, posicin activa (=) </li>
<li> 13   Posicin incierta (~) </li>
<li> 14   Las blancas tienen una pequea ventaja (+=) </li>
<li> 15   Las negras tienen una pequea ventaja (=+) </li>
<li> 16   Las blancas tienen una moderada ventaja (+/-) </li>
<li> 17   Las negras tienen una moderada ventaja (-/+) </li>
<li> 18   Las blancas tienen una ventaja decisiva (+-) </li>
<li> 19   Las negras tienen una ventaja decisiva (-+) </li>
<li> 20   Las blancas tienen una ventaja aplastante (+-) </li>
<li> 21   Las negras tienen una ventaja aplastante (-+) </li>
<li> 22   Las blancas desearan pasar </li>
<li> 23   Las negras desearan pasar </li>
<li> 24   Las blancas tienen una pequea ventaja espacial </li>
<li> 25   Las negras tienen una pequea ventaja espacial </li>
<li> 26   Las blancas tienen una moderada ventaja espacial </li>
<li> 27   Las negras tienen una moderada ventaja espacial </li>
<li> 28   Las blancas tienen una ventaja espacial decisiva </li>
<li> 29   Las negras tienen una ventaja espacial decisiva </li>
<li> 30   Las blancas tienen una pequea ventaja de tiempo (desarrollo) </li>
<li> 31   Las negras tienen una pequea ventaja de tiempo (desarrollo) </li>
<li> 32   Las blancas tienen una moderada ventaja de tiempo (desarrollo) </li>
<li> 33   Las negras tienen una moderada ventaja de tiempo (desarrollo) </li>
<li> 34   Las blancas tienen una decisiva ventaja de tiempo (desarrollo) </li>
<li> 35   Las negras tienen una decisiva ventaja de tiempo (desarrollo) </li>
<li> 36   Las blancas tienen la iniciativa </li>
<li> 37   Las negras tienen la iniciativa </li>
<li> 38   Las blancas tienen una iniciativa duradera </li>
<li> 39   Las negras tienen una iniciativa duradera </li>
<li> 40   Las blancas llevan el ataque </li>
<li> 41   Las negras llevan el ataque </li>
<li> 42   Las blancas tienen una insuficiente compensacin para el dficit de material </li>
<li> 43   Las negras tienen una insuficiente compensacin para el dficit de material </li>
<li> 44   Las blancas tienen suficiente compensacin para el dficit de material </li>
<li> 45   Las negras tienen suficiente compensacin para el dficit de material </li>
<li> 46   Las blancas tienen una ms que adecuada compensacin para el dficit de material </li>
<li> 47   Las negras tienen una ms que adecuada compensacin para el dficit de material </li>
<li> 48   Las blancas tienen una pequea ventaja en el control del centro </li>
<li> 49   Las negras tienen una pequea ventaja en el control del centro </li>
<li> 50   Las blancas tienen una moderada ventaja en el control del centro </li>
<li> 51   Las negras tienen una moderada ventaja en el control del centro </li>
<li> 52   Las blancas tienen una ventaja decisiva en el control del centro </li>
<li> 53   Las negras tienen una ventaja decisiva en el control del centro </li>
<li> 54   Las blancas tienen una pequea ventaja en el control del ala del rey </li>
<li> 55   Las negras tienen una pequea ventaja en el control del ala del rey </li>
<li> 56   Las blancas tienen una moderada ventaja en el control del ala del rey </li>
<li> 57   Las negras tienen una moderada ventaja en el control del ala del rey </li>
<li> 58   Las blancas tienen una ventaja decisiva en el control del ala del rey </li>
<li> 59   Las negras tienen una ventaja decisiva en el control del ala del rey </li>
<li> 60   Las blancas tienen una pequea ventaja en el control del ala de la dama </li>
<li> 61   Las negras tienen una pequea ventaja en el control del ala de la dama </li>
<li> 62   Las blancas tienen una moderada ventaja en el control del ala de la dama </li>
<li> 63   Las negras tienen una moderada ventaja en el control del ala de la dama </li>
<li> 64   Las blancas tienen una ventaja decisiva en el control del ala de la dama </li>
<li> 65   Las negras tienen una ventaja decisiva en el control del ala de la dama </li>
<li> 66   Las blancas tienen una primera fila vulnerable </li>
<li> 67   Las negras tienen una primera fila vulnerable </li>
<li> 68   Las blancas tienen una primera fila bien protegida </li>
<li> 69   Las negras tienen una primera fila bien protegida </li>
<li> 70   Las blancas tienen un rey mal protegido </li>
<li> 71   Las negras tienen un rey mal protegido </li>
<li> 72   Las blancas tienen un rey bien protegido </li>
<li> 73   Las negras tienen un rey bien protegido </li>
<li> 74   Las blancas tienen un rey mal colocado </li>
<li> 75   Las negras tienen un rey mal colocado </li>
<li> 76   Las blancas tienen un rey bien colocado </li>
<li> 77   Las negras tienen un rey bien colocado </li>
<li> 78   Las blancas tienen una estructura de peones muy dbil </li>
<li> 79   Las negras tienen una estructura de peones muy dbil </li>
<li> 80   Las blancas tienen una estructura de peones moderadamente dbil </li>
<li> 81   Las negras tienen una estructura de peones moderadamente dbil </li>
<li> 82   Las blancas tienen una estructura de peones moderadamente fuerte </li>
<li> 83   Las negras tienen una estructura de peones moderadamente fuerte </li>
<li> 84   Las blancas tienen una estructura de peones muy fuerte </li>
<li> 85   Las negras tienen una estructura de peones muy fuerte </li>
<li> 86   Las blancas tienen un mal emplazamiento del caballo </li>
<li> 87   Las negras tienen un mal emplazamiento del caballo </li>
<li> 88   Las blancas tienen un buen emplazamiento del caballo </li>
<li> 89   Las negras tienen un buen emplazamiento del caballo </li>
<li> 90   Las blancas tienen un mal emplazamiento del alfil </li>
<li> 91   Las negras tienen un mal emplazamiento del alfil </li>
<li> 92   Las blancas tienen un buen emplazamiento del alfil </li>
<li> 93   Las negras tienen un buen emplazamiento del alfil </li>
<li> 94   Las blancas tienen un mal emplazamiento de la torre </li>
<li> 95   Las negras tienen un mal emplazamiento de la torre </li>
<li> 96   Las blancas tienen un buen emplazamiento de la torre </li>
<li> 97   Las negras tienen un buen emplazamiento de la torre </li>
<li> 98   Las blancas tienen un mal emplazamiento de la dama </li>
<li> 99   Las negras tienen un mal emplazamiento de la dama </li>
<li>100   Las blancas tienen un buen emplazamiento de la dama </li>
<li>101   Las negras tienen un buen emplazamiento de la dama </li>
<li>102   Las blancas tienen una mala coordinacin de piezas </li>
<li>103   Las negras tienen una mala coordinacin de piezas </li>
<li>104   Las blancas tienen una buena coordinacin de piezas </li>
<li>105   Las negras tienen una buena coordinacin de piezas </li>
<li>106   Las blancas han jugado una abertura muy mala </li>
<li>107   Las negras han jugado una abertura muy mala </li>
<li>108   Las blancas han jugado una abertura mala </li>
<li>109   Las negras han jugado una abertura mala </li>
<li>110   Las blancas han jugado una buena abertura </li>
<li>111   Las negras han jugado una buena abertura </li>
<li>112   Las blancas han jugado una muy buena abertura </li>
<li>113   Las negras han jugado una muy buena abertura </li>
<li>114   Las blancas han jugado el medio juego muy mal </li>
<li>115   Las negras han jugado el medio juego muy mal </li>
<li>116   Las blancas han jugado el medio juego mal </li>
<li>117   Las negras han jugado el medio juego mal </li>
<li>118   Las blancas han jugado el medio juego bien </li>
<li>119   Las negras han jugado el medio juego bien </li>
<li>120   Las blancas han jugado el medio juego muy bien </li>
<li>121   Las negras han jugado el medio juego muy bien </li>
<li>122   Las blancas han jugado el final muy mal </li>
<li>123   Las negras han jugado el final muy mal </li>
<li>124   Las blancas han jugado el final mal </li>
<li>125   Las negras han jugado el final mal </li>
<li>126   Las blancas han jugado el final bien </li>
<li>127   Las negras han jugado el final bien </li>
<li>128   Las blancas han jugado el final muy bien </li>
<li>129   Las negras han jugado el final muy bien </li>
<li>130   Las blancas tienen una dbil oportunidad de contraatacar </li>
<li>131   Las negras tienen una dbil oportunidad de contraatacar  </li>
<li>132   Las blancas tienen una pequea oportunidad de contraatacar  </li>
<li>133   Las negras tienen una pequea oportunidad de contraatacar  </li>
<li>134   Las blancas tienen una decisiva oportunidad de contraatacar  </li>
<li>135   Las negras tienen una decisiva oportunidad de contraatacar  </li>
<li>136   Las blancas tienen una moderada presin en el control de tiempo </li>
<li>137   Las negras tienen una moderada presin en el control de tiempo </li>
<li>138   Las blancas tienen una gran presin en el control de tiempo </li>
<li>139   Las negras tienen una gran presin en el control de tiempo </li>
</ul>
</cyan>

<p>
Otros valores NAG propuestos por Chess Informant incluyen:
</p>
<cyan>
<ul>
<li>140   con la idea ... </li>
<li>141   Apuntar contra ... </li>
<li>142   Mejor movimiento </li>
<li>143   Peor movimiento </li>
<li>144   Movimiento equivalente </li>
<li>145   Comentario del editor ("CE") </li>
<li>146   Novedad ("N") </li>
<li>147   Punto dbil </li>
<li>148   Final de la partida </li>
<li>149   Lnea </li>
<li>150   Diagonal </li>
<li>151   Las blancas tienen el par de alfiles </li>
<li>152   Las negras tienen el par de alfiles </li>
<li>153   Alfiles de colores opuestos </li>
<li>154   Alfiles de igual color </li>
</ul>
</cyan>

<p>
Otros valores sugeridos son:
</p>
<cyan>
<ul>
<li>190   Etc. </li>
<li>191   Peones doblados </li>
<li>192   Pen aislado </li>
<li>193   Peones conectados </li>
<li>194   Peones colgados </li>
<li>195   Pen trasero </li>
</ul>
</cyan>

<p>
Smbolos definidos por Scid para su propio uso:
</p>
<cyan>
<ul>
<il>201   Diagrama ("D", a veces designado con "#") </il>
</ul>
</cyan>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

###################
### ECO guide help:

set helpTitle(S,ECO) "Gua ECO"
set helpText(S,ECO) {<h1>Clasificacin de aperturas por ECO</h1>
<p>
Scid puede clasificar las partidas de acuerdo con la clasificacin de aperturas <b>ECO</b> (Encyclopaedia of Chess Openings).
Un cdigo ECO estndar consiste en una letra (A..E) seguida por dos dgitos, por lo que hay 500 cdigos ECO estndar distintos.
</p>
<p>
El sistema ECO es muy limitado y no es suficiente para las partidas actuales: algunos de los 500 cdigos casi no se vuelven a ver ms, mientras que otros se ven frecuentemente. Para mejorar esta situacin, Scid permite una extensin opcional a los cdigos ECO bsicos: cada cdigo puede ser ampliado con una letra (a..z), y con una extensin supletoria (otro dgito, 1..4) que no es usado todava en el archivo ECO estndar de Scid. Por lo que un cdigo ECO extendido por Scid se ve como "<b>A41e</b>" o "<b>E99b2</b>". Gran nmero de los cdigos ECO ms comnmente encontrados en las partidas actuales de los maestros tienen una extensin definida en el archivo ECO de Scid.
</p>

<h3><name Browser>La ventana del Buscador ECO</name></h3>
<p>
La ventana del <term>Buscador ECO</term> muestra la posicin que es usada para clasificar cada cdigo ECO, y la frecuencia y rendimiento de los cdigos ECO en la base de datos actual.
</p>
<p>
El panel superior muestra la frecuencia de cada cdigo ECO en la base de datos actual. Las barras del grfico tienen tres secciones: la inferior (de color ms claro) muestra el nmero de partidas ganadas por las blancas, la del medio muestra el nmero de tablas, y la superior (la ms oscura) muestra el nmero de las ganadas por las negras. Esto te permite ver de un vistazo las caractersticas de una apertura: por ejemplo, si las blancas puntan muy bien, o si son muy comunes las tablas.
</p>
<p>
Para ir a un nivel ECO ms profundo, aprieta el botn izquierdo del ratn sobre una barra del grfico (o escribe la letra o el dgito que corresponda). Para retroceder al nivel superior, aprieta el botn derecho del ratn en cualquier sitio del grfico, o aprieta la tecla de la flecha hacia la izquierda (o suprimir o espacio atrs (borrar)).
</p>
<p>
El panel inferior muestra las posiciones que incluye un cdigo ECO en particular, segn el archivo ECO que tengas cargado.
</p>

<h3>Cargando el archivo ECO de Scid</h3>
<p>
El archivo ECO que viene con Scid se llama <b>scid.eco</b>; Scid trata de cargarlo siempre que se enciende. Si Scid no puede encontrarlo, tendrs que hacer lo siguiente para habilitar la clasificacin ECO:
<ul>
<li>(a) En Scid, usa el comando del men
       <menu>Opciones: Cargar archivo ECO</menu>
       y selecciona el archivo <b>scid.eco</b>. </li>
<li>(b) Guardar opciones (desde el men <menu>Opciones</menu>). </li>
</ul>
Despus de hacer esto, el archivo ECO ser cargado cada vez que inicies Scid.
</p>

<h3>Sistema de cdigos ECO</h3>
<p>
La estructura bsica del sistema ECO es:
</p>
<p>
<li><b><blue><run updateEcoWin A>A</run></blue></b>   1.d4 Nf6 2...;  1.d4 ...;  1.c4;  1.various
<ul>
<li>  <b>A0</b>  1.Nf3;  1.f4;  1.<i>various</i>
      (<b>A02-A03</b>  1.f4: <i>Bird's Opening</i>;
       <b>A04-A09</b>  1.Nf3: <i>Reti; King's Indian Attack</i>) </li>
<li>  <b>A1</b>  1.c4 ...: <i>English</i> </li>
<li>  <b>A2</b>  1.c4 e5: <i>King's English</i> </li>
<li>  <b>A3</b>  1.c4 c5: <i>English, Symmetrical </i> </li>
<li>  <b>A4</b>  1.d4 ...: <i>Queen's Pawn</i> </li>
<li>  <b>A5</b>  1.d4 Nf6 2.c4 ..: <i>Indian Defence </i> </li>
<li>  <b>A6</b>  1.d4 Nf6 2.c4 c5 3.d5 e6: <i>Modern Benoni</i> </li>
<li>  <b>A7</b>  A6 + 4.Nc3 exd5 5.cxd5 d6 6.e4 g6 7.Nf3 </li>
<li>  <b>A8</b>  1.d4 f5: <i>Dutch Defence</i> </li>
<li>  <b>A9</b>  1.d4 f5 2.c4 e6: <i>Dutch Defence</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin B>B</run></blue></b>   1.e4 c5;  1.e4 c6;  1.e4 d6;  1.e4 <i>various</i>
<ul>
<li>  <b>B0</b>  1.e4 ...
      (<b>B02-B05</b>  1.e4 Nf6: <i>Alekhine Defence</i>;
       <b>B07-B09</b>  1.e4 d6: <i>Pirc</i>) </li>
<li>  <b>B1</b>  1.e4 c6: <i>Caro-Kann</i> </li>
<li>  <b>B2</b>  1.e4 c5: <i>Sicilian Defence </i> </li>
<li>  <b>B3</b>  1.e4 c5 2.Nf3 Nc6: <i>Sicilian</i> </li>
<li>  <b>B4</b>  1.e4 c5 2.Nf3 e6: <i>Sicilian</i> </li>
<li>  <b>B5</b>  1.e4 c5 2.Nf3 d6: <i>Sicilian</i> </li>
<li>  <b>B6</b>  B5 + 3.d4 cxd4 4.Nxd4 Nf6 5.Nc3 Nc6 </li>
<li>  <b>B7</b>  B5 + 4.Nxd4 Nf6 5.Nc3 g6: <i>Sicilian Dragon</i> </li>
<li>  <b>B8</b>  B5 + 4.Nxd4 Nf6 5.Nc3 e6: <i>Sicilian Scheveningen</i> </li>
<li>  <b>B9</b>  B5 + 4.Nxd4 Nf6 5.Nc3 a6: <i>Sicilian Najdorf</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin C>C</run></blue></b>   1.e4 e5;  1.e4 e6
<ul>
<li>  <b>C0</b>  1.e4 e6: <i>French Defence</i> </li>
<li>  <b>C1</b>  1.e4 e6 2.d4 d5 3.Nc3: <i>French, Winawer/Classical</i> </li>
<li>  <b>C2</b>  1.e4 e5: <i>Open Game</i> </li>
<li>  <b>C3</b>  1.e4 e5 2.f4: <i>King's Gambit</i> </li>
<li>  <b>C4</b>  1.e4 e5 2.Nf3: <i>Open Game</i> </li>
<li>  <b>C5</b>  1.e4 e5 2.Nf3 Nc6 3.Bc4: <i>Italian; Two Knights</i> </li>
<li>  <b>C6</b>  1.e4 e5 2.Nf3 Nc6 3.Bb5: <i>Spanish (Ruy Lopez)<i> </li>
<li>  <b>C7</b>  1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4: <i>Spanish</i> </li>
<li>  <b>C8</b>  C7 + 4...Nf6 5.O-O: <i>Spanish, Closed and Open</i>
        (<b>C80-C83</b>  5.O-O Nxe4: <i>Spanish, Open System</i>;
         <b>C84-C89</b>  5.O-O Be7: <i>Spanish, Closed System</i>) </li>
<li>  <b>C9</b>  C8 + 5...Be7 6.Re1 b5 7.Bb3 d6: <i>Spanish, Closed</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin D>D</run></blue></b>   1.d4 d5; 1.d4 Nf6 2.c4 g6 with 3...d5
<ul>
<li>  <b>D0</b>   1.d4 d5: <i>Queen's Pawn</i> </li>
<li>  <b>D1</b>   1.d4 d5 2.c4 c6: <i>Slav Defence</i> </li>
<li>  <b>D2</b>  1.d4 d5 2.c4 dxc4: <i>Queen's Gambit Accepted (QGA)</i> </li>
<li>  <b>D3</b>  1.d4 d5 2.c4 e6: <i>Queen's Gambit Declined (QGD)</i> </li>
<li>  <b>D4</b>  D3 + 3.Nc3 Nf6 4.Nf3 c5/c6: <i>Semi-Tarrasch; Semi-Slav</i> </li>
<li>  <b>D5</b>  D3 + 3.Nc3 Nf6 4.Bg5: <i>QGD Classical</i> </li>
<li>  <b>D6</b>  D5 + 4...Be7 5.e3 O-O 6.Nf3 Nbd7: <i>QGD Orthodox</i> </li>
<li>  <b>D7</b>  1.d4 Nf6 2.c4 g6 with 3...d5: <i>Grunfeld</i> </li>
<li>  <b>D8</b>  1.d4 Nf6 2.c4 g6 3.Nc3 d5: <i>Grunfeld</i> </li>
<li>  <b>D9</b>  1.d4 Nf6 2.c4 g6 3.Nc3 d5 4.Nf3: <i>Grunfeld</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin E>E</run></blue></b>   1.d4 Nf6 2.c4 e6; 1.d4 Nf6 2.c4 g6
<ul>
<li>  <b>E0</b>  1.d4 Nf6 2.c4 e6: <i>Catalan, etc</i> </li>
<li>  <b>E1</b>  1.d4 Nf6 2.c4 e6 3.Nf3 (b6): <i>Queen's Indian, etc</i> </li>
<li>  <b>E2</b>  1.d4 Nf6 2.c4 e6 3.Nc3 (Bb4): <i>Nimzo-Indian, etc</i> </li>
<li>  <b>E3</b>  E2 + 4.Bg5 or 4.Qc2: <i>Nimzo-Indian</i> </li>
<li>  <b>E4</b>  E2 + 4.e3: <i>Nimzo-Indian, Rubinstein</i> </li>
<li>  <b>E5</b>  E4 + 4...O-O 5.Nf3: <i>Nimzo-Indian, main line</i> </li>
<li>  <b>E6</b>  1.d4 Nf6 2.c4 g6: <i>King's Indian</i> </li>
<li>  <b>E7</b>  1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.e4: <i>King's Indian</i> </li>
<li>  <b>E8</b>  E7 + 4...d6 5.f3: <i>King's Indian, Samisch</i> </li>
<li>  <b>E9</b>  E7 + 4...d6 5.Nf3: <i>King's Indian, main lines</i> </li>
</ul>

<p><footer>(Actualizado: Scid 2.5, Junio 2001)</footer></p>
}

#############################
### Contact information help:

set helpTitle(S,Author) "Informacin de contacto"
set helpText(S,Author) {<h1>Informacin de contacto</h1>
<p>
La pgina de Scid se encuentra en:: <br>
<li><b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>
</p>
<p>
Esta tiene la ltima versin de Scid para bajarse y cualquier otro archivo extra que est disponible.
</p>
<p>
Por favor enva cualquier comentario, pregunta, sugerencia o informe de errores al autor de Scid, Shane Hudson, al E-mail:<br>
<li><b>shane@cosc.canterbury.ac.nz</b>
</p>

<h3><name Related>Links relacionados</name></h3>
<p>
Si disfrutas con Scid, encontrars los siguientes sitios web interesantes:
</p>
<ul>
<li><url http://www.tim-mann.org/chess.html>http://www.tim_mann.org/chess.html</url> --
Pgina personal del programa <b>xboard y winboard</b> de Tim Mann, el cual es un lector PGN y un interfaz para los servidores de ajedrez de internet. Adems tiene informacin interesante sobre Crafty, GNUchess y otros programas gratuitos.</li>

<li><url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url> --
El fuerte programa de ajedrez Crafty: El subdirectorio llamado <b>TB</b> tiene gran nmero de archivos de finales (tablebase) en formato Nalimov, los cuales puedes usar en muchos programas de ajedrez y en Scid.</li>

<li><url http://www.chesscenter.com/twic/>http://www.chesscenter.com/twic/</url> -- TWIC (the week in chess), un excelente boletn semanal de partidas de ajedrez disponibles en formato PGN.</li>

<li><url http://scid.sourceforge.net/standard.txt>http://scid.sourceforge.net/standard.txt</url> -- El <b>Estndar PGN</b>, creado por Steven J. Edwards en 1994. Este archivo de texto explica los formatos PGN y EPD detalladamente.</li>
</ul>

<p><footer>(Actualizado: Scid 2.6, Agosto 2001)</footer></p>
}

# end of spanish.tcl
# portbr.tcl:
# Scid in Brazilian Portuguese.
# Translated by Gilberto de Almeida Peres.

addLanguage B {Brazil Portuguese} 0

proc setLanguage_B {} {

# File menu:
menuText B File "Arquivo" 0
menuText B FileNew "Novo..." 0 {Cria uma nova base de dados Scid}
menuText B FileOpen "Abrir..." 0 {Abre uma base de dados Scid existente}
menuText B FileClose "Fechar" 0 {Fecha a base de dados Scid ativa}
menuText B FileFinder "Buscador" 0 {Abre a janela do Buscador de Arquivos}
menuText B FileBookmarks "Favoritos" 0 {Menu de Favoritos (atalho: Ctrl+B)}
menuText B FileBookmarksAdd "Adicionar a Favoritos" 0 \
  {Adiciona o posicao do jogo do banco de dados atual}
menuText B FileBookmarksFile "Arquivar Favorito" 0 \
  {Arquiva um Favorito para a posicao do jogo atual}
menuText B FileBookmarksEdit "Editar favoritos..." 0 \
  {Editar o menu de favoritos}
menuText B FileBookmarksList "Mostrar pastas como lista" 0 \
  {Mostra as pastas de favoritos em lista unica}
menuText B FileBookmarksSub "Mostrar pastas como submenus" 0 \
  {Mostra as pastas de favoritos como submenus}
menuText B FileMaint "Manutencao" 0 {Ferramentas de manutencao de bases de dados Scid}
menuText B FileMaintWin "Janela de Manutencao" 0 \
  {Abre/Fecha a janela de manutencao de bases de dados Scid}
menuText B FileMaintCompact "Compactar base de dados..." 0 \
  {Compacta arquivos de bases de dados, removendo jogos deletados e nomes nao utilizados}
menuText B FileMaintClass "Classificar jogos por ECO..." 2 \
  {Recalcula o codigo ECO de todos os jogos}
menuText B FileMaintSort "Ordenar base de dados..." 0 \
  {Ordena todos os jogos da base de dados}
menuText B FileMaintDelete "Apagar jogos duplicados..." 13 \
  {Encontra jogos duplicados e os marca para exclusao}
menuText B FileMaintTwin "Janela de verificacao de duplicatas" 10 \
  {Abre/atualiza a janela de verificacao de duplicatas}
menuText B FileMaintName "Ortografia de nomes" 14 {Ferramentas de edicao e correcao ortografica de nomes}
menuText B FileMaintNameEditor "Editor de Nomes" 0 \
  {Abre/fecha a janela do editor de nomes}
menuText B FileMaintNamePlayer "Verificacao Ortografica de Nomes de Jogadores..." 11 \
  {Verifica a correcao dos nomes dos jogadores de acordo com o arquivo de correcao ortografica}
menuText B FileMaintNameEvent "Verificacao Ortografica de Nomes de Eventos..." 11 \
  {Verifica a correcao dos nomes de eventos de acordo com o arquivo de verificacao ortografica}
menuText B FileMaintNameSite "Verificacao Ortografica de Lugares..." 11 \
  {Verifica a correcao dos nomes de lugares usando o arquivo de correcao ortografica}
menuText B FileMaintNameRound "Verificacao Ortografica de Rodadas..." 11 \
  {Verificacao dos nomes de rodadas usando o arquivo de correcao ortografica}
menuText B FileReadOnly "Apenas Leitura..." 7 \
  {Trata a base de dados corrente como arquivo de leitura, impedindo mudancas}
menuText B FileExit "Sair" 0 {Encerrar o Scid}

# Edit menu:
menuText B Edit "Editar" 0
menuText B EditAdd "Adiciona variante" 0 {Adiciona variante do movimento}
menuText B EditDelete "Deleta Variante" 0 {Exclui variante do movimento}
menuText B EditFirst "Converte para Primeira Variante" 14 \
  {Faz com que uma variante seja a primeira da lista}
menuText B EditMain "Converte variante para Linha Principal" 24 \
  {Faz com que uma variante se torne a Linha Principal}
menuText B EditTrial "Experimentar variante" 0 \
  {Inicia/Para experimentacao, para testar alguma nova ideia no tabuleiro}
menuText B EditStrip "Limpar Comentarios e Variantes" 2 \
  {Limpa comentarios e variantes no jogo atual}
menuText B EditStripComments "Limpar Comentarios" 0 \
  {Limpa comentarios e anotacoes no jogo atual}
menuText B EditStripVars "Limpar Variantes" 0 \
  {Limpa todas as variantes no jogo atual}
menuText B EditReset "Limpar a base de trabalho" 0 \
  {Limpa completamente a base de trabalho}
menuText B EditCopy "Copiar jogo para a base de trabalho" 0 \
  {Copia o jogo corrente para a base de trabalho}
menuText B EditPaste "Colar jogo da base de trabalho" 1 \
  {Cola o jogo ativo da base de trabalho}
menuText B EditSetup "Configura posicao inicial..." 12 \
  {Configura a posicao inicial para o jogo}
menuText B EditPasteBoard "Colar Posicao" 12 \
  {Configura a posicao inicial a partir da area de transferencia}

# Game menu:
menuText B Game "Jogo" 0
menuText B GameNew "Limpar Jogo" 0 \
  {Limpa o jogo corrente, descartando qualquer alteracao}
menuText B GameFirst "Primeiro Jogo" 5 {Carrega o primeiro jogo filtrado}
menuText B GamePrev "Jogo Anterior" 5 {Carrega o jogo anterior}
menuText B GameReload "Recarrega o Jogo atual" 3 \
  {Recarrega o jogo, descartando qualquer alteracao}
menuText B GameNext "Proximo Jogo" 5 {Carrega o proximo jogo}
menuText B GameLast "Ultimo Jogo" 8 {Carrega o ultimo jogo}
menuText B GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText B GameNumber "Carrega Jogo Numero..." 5 \
  {Carrega um jogo pelo seu numero}
menuText B GameReplace "Salvar: Substituir Jogo..." 8 \
  {Salva o jogo e substitui a versao antiga}
menuText B GameAdd "Salvar: Adicionar Jogo..." 9 \
  {Salva este jogo como um novo jogo na base de dados}
menuText B GameDeepest "Identificar Abertura" 0 \
  {Vai para a posicao mais avancada da partida, de acordo com o codigo ECO}
menuText B GameGotoMove "Ir para o movimento numero..." 5 \
  {Avanca o jogo ate o movimento desejado}
menuText B GameNovelty "Pesquisa Novidade..." 7 \
  {Procura o primeiro movimento deste jogo que nao tenha sido jogado antes}

# Search Menu:
menuText B Search "Pesquisa" 0
menuText B SearchReset "Limpar Filtragem" 0 {Limpa o criterio de pesquisa para incluir todos os jogos}
menuText B SearchNegate "Inverter Filtragem" 0 {Inverte o criterio de pesquisa para incluir apenas os jogos que nao atendem o criterio}
menuText B SearchCurrent "Posicao Atual..." 0 {Pesquisa a posicao atual do tabuleiro}
menuText B SearchHeader "Cabecalho..." 0 {Pesquisa por cabecalho (jogador, evento, etc)}
menuText B SearchMaterial "Material/Padrao..." 0 {Pesquisa por material ou padrao de posicao}
menuText B SearchUsing "Usar arquivo de opcoes de filtro..." 0 {Pesquisa usando arquivo com opcoes de filtro}

# Windows menu:
menuText B Windows "Janelas" 0
menuText B WindowsComment "Editor de Comentarios" 0 {Abre/fecha o editor de comentarios}
menuText B WindowsGList "Lista de Jogos" 0 {Abre/fecha a janela com a lista de jogos}
menuText B WindowsPGN "Notacao PGN" 0 \
  {Abre/fecha a janela com a notacao PGN do jogo}
menuText B WindowsTmt "Buscador de Torneio" 2 {Abre/Fecha o buscador de torneio}
menuText B WindowsSwitcher "Intercambio de bases de dados" 0 \
  {Abre/fecha a janela de intercambio de bases de dados}
menuText B WindowsMaint "Manutencao" 0 \
  {Abre/fecha a janela de manutencao}
menuText B WindowsECO "Listagem ECO" 0 {Abre/fecha a janela de listagem de codigo ECO}
menuText B WindowsRepertoire "Editor de Repertorio" 0 \
  {Abre/fecha a janela do editor de repertorio}
menuText B WindowsStats "Estatisticas" 0 \
  {Abre/fecha a janela de estatisticas}
menuText B WindowsTree "Arvore" 0 {Abre/fecha a janela da Arvore de pesquisa}
menuText B WindowsTB "Tabela base de Finais" 1 \
  {Abre/fecha a janela da tabela base de finais}

# Tools menu:
menuText B Tools "Ferramentas" 0
menuText B ToolsAnalysis "Analisador #1..." 0 \
  {Inicia ou para o 1o. Analisador}
menuText B ToolsAnalysis2 "Analisador #2..." 17 \
  {Inicia ou para o 2o. Analisador}
menuText B ToolsCross "Tabela de Cruzamento" 0 {Mostra a tabela de cruzamentos do torneio para o jogo corrente}
menuText B ToolsEmail "Gerenciador de e-mails" 0 \
  {Abre/fecha a janela do gerenciador de e-mails}
menuText B ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText B ToolsOpReport "Relatorio de abertura" 0 \
  {Gera um relatorio de abertura para a posicao corrente}
menuText B ToolsTracker "Piece Tracker"  0 {Open the Piece Tracker window} ;# ***
menuText B ToolsPInfo "Informacao do Jogador"  0 \
  {Abre/atualiza a janela de informacao do jogador}
menuText B ToolsRating "Grafico de Rating" 0 \
  {Mostra, em um grafico, a evolucao do rating de um jogador}
menuText B ToolsScore "Grafico de Resultados" 0 {Mostra a janela com o grafico dos resultados}
menuText B ToolsExpCurrent "Exporta jogo corrente" 8 \
  {Grava o jogo corrente em um arquivo texto}
menuText B ToolsExpCurrentPGN "Exporta para PGN..." 15 \
  {Grava o jogo corrente em um arquivo PGN}
menuText B ToolsExpCurrentHTML "Exporta para HTML..." 15 \
  {Grava o jogo corrente em um arquivo HTML}
menuText B ToolsExpCurrentLaTeX "Exporta para LaTex..." 15 \
  {Grava o jogo corrente em um arquivo LaTex}
menuText B ToolsExpFilter "Exporta jogos filtrados" 1 \
  {Exporta todos os jogos filtrados para um arquivo texto}
menuText B ToolsExpFilterPGN "Exporta jogos filtrados - PGN..." 17 \
  {Exporta todos os jogos filtrados para um arquivo PGN}
menuText B ToolsExpFilterHTML "Exporta jogos filtrados - HTML..." 17 \
  {Exporta todos os jogos filtrados para um arquivo HTML}
menuText B ToolsExpFilterLaTeX "Exporta jogos filtrados - LaTex..." 17 \
  {Exporta todos os jogos filtrados para um arquivo LaTex}
menuText B ToolsImportOne "Importa PGN texto..." 0 \
  {Importa jogo de um texto em PGN}
menuText B ToolsImportFile "Importa arquivo de jogos PGN..." 7 \
  {Importa jogos de um arquivo PGN}

# Options menu:
menuText B Options "Opcoes" 0
menuText B OptionsSize "Tamanho do Tabuleiro" 0 {Muda o tamanho do tabuleiro}
menuText B OptionsPieces "Estilo de Pecas no Tabuleiro" 10 \
  {Muda o estilo das pecas mostradas no tabuleiro}
menuText B OptionsColors "Cores..." 0 {Muda as cores do tabuleiro}
menuText B OptionsExport "Exportacao" 0 {Muda as opcoes de exportacao de texto}
menuText B OptionsFonts "Fontes" 0 {Muda os fontes}
menuText B OptionsFontsRegular "Normal" 0 {Fonte Normal}
menuText B OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText B OptionsFontsSmall "Pequeno" 0 {Fonte pequeno}
menuText B OptionsFontsFixed "Fixo" 0 {Fonte de largura fixa}
menuText B OptionsGInfo "Informacoes do Jogo" 0 {Opcoes de informacao do jogo}
menuText B OptionsLanguage "Linguagem" 0 {Menu de selecao de linguagem}
menuText B OptionsMoves "Movimentos" 0 {Opcoes para entrada dos movimentos}
menuText B OptionsMovesAsk "Perguntar antes de substituir movimentos" 0 \
  {Pergunta antes de substituir movimentos existentes}
menuText B OptionsMovesDelay "Tempo de atraso p/ Jogo automatico..." 1 \
  {Define o tempo de espera antes de entrar no modo de jogo automatico}
menuText B OptionsMovesCoord "Entrada de movimentos por coordenadas" 0 \
  {Aceita o estilo de entrada de movimentos por coordenadas ("g1f3")}
menuText B OptionsMovesSuggest "Mostrar movimentos sugeridos" 0 \
  {Liga/desliga sugestao de movimentos}
menuText B OptionsMovesKey "Auto completar" 0 \
  {Liga/desliga auto completar a partir do que for digitado}
menuText B OptionsNumbers "Formato de Numeros" 0 {Selecione o formato usado para numeros}
menuText B OptionsStartup "Iniciar" 1 \
  {Seleciona janelas que serao abertas ao iniciar o programa}
menuText B OptionsWindows "Janelas" 0 {Opcoes para Janelas}
menuText B OptionsWindowsIconify "Auto-iconizar" 5 \
  {Iconizar todas as janelas quando a janela principal eh iconizada}
menuText B OptionsWindowsRaise "Manter no topo" 0 \
  {Mantem no topo certas janelas (ex. barras de progresso) sempre que sao obscurecidas por outras}
menuText B OptionsToolbar "Barra de Ferramentas da Janela Principal" 12 \
  {Exibe/Oculta a barra de ferramentas da janela principal}
menuText B OptionsECO "Carregar arquivo ECO..." 7 {Carrega o arquivo com a classificacao ECO}
menuText B OptionsSpell "Carregar arquivo de verificacao ortografica..." 6 \
  {Carrega o arquivo de verificacao ortografica do Scid}
menuText B OptionsTable "Diretorio de tabelas de base..." 0 \
  {Selecione um arquivo de tabela de base; todas as tabelas nesse diretorio serao usadas}
menuText B OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText B OptionsSave "Salvar Configuracao" 0 \
  "Salva a configuracao no arquivo $::optionsFile"
menuText B OptionsAutoSave "Salva Opcoes ao sair" 0 \
  {Salva automaticamente todas as opcoes quando sair do Scid}

# Help menu:
menuText B Help "Ajuda" 0
menuText B HelpIndex "Indice" 0 {Indice da Ajuda}
menuText B HelpGuide "Consulta Rapida" 0 {Mostra a pagina de consulta rapida}
menuText B HelpHints "Dicas" 0 {Mostra a pagina de dicas}
menuText B HelpContact "Informacoes para contato" 0 {Mostra a pagina com informacoes para contato}
menuText B HelpTip "Dica do dia" 0 {Mostra uma dica util do Scid}
menuText B HelpStartup "Janela de Inicializacao" 0 {Mostra a janela de inicializacao}
menuText B HelpAbout "Sobre Scid" 0 {Informacoes sobre o Scid}

# Game info box popup menu:
menuText B GInfoHideNext "Ocultar proximo movimento" 0
menuText B GInfoMaterial "Mostra valor de material" 0
menuText B GInfoFEN "Mostra Diagrama FEN" 16
menuText B GInfoMarks "Mostra setas e casas coloridas" 7
menuText B GInfoWrap "Quebra de linhas longas" 0
menuText B GInfoFullComment "Mostrar comentario completo" 8
menuText B GInfoTBNothing "Tabelas de Base: nada" 12
menuText B GInfoTBResult "Tabelas de Base: apenas resultado" 12
menuText B GInfoTBAll "Tabelas de Base: resultado e melhores movimentos" 19
menuText B GInfoDelete "Recuperar este jogo" 0
menuText B GInfoMark "Desmarcar este jogo" 0

# Main window buttons:
helpMsg B .button.start {Ir para o inicio do jogo  (tecla: Home)}
helpMsg B .button.end {Ir para o final do jogo  (tecla: End)}
helpMsg B .button.back {Retroceder um movimento  (tecla: Seta Esquerda)}
helpMsg B .button.forward {Avancar um movimento  (tecla: Seta Direita)}
helpMsg B .button.intoVar {Entrar na variante  (tecla de atalho: v)}
helpMsg B .button.exitVar {Sair da variante  (tecla de atalho: z)}
helpMsg B .button.flip {Girar tabuleiro  (tecla de atalho: .)}
helpMsg B .button.coords {Liga/desliga coordenadas  (tecla de atalho: 0)}
helpMsg B .button.autoplay {Jogo automatico  (tecla: Ctrl+Z)}

# General buttons:
translate B Back {Voltar}
translate B Cancel {Cancelar}
translate B Clear {Limpar}
translate B Close {Fechar}
translate B Defaults {Defaults}
translate B Delete {Deletar}
translate B Graph {Grafico}
translate B Help {Ajuda}
translate B Import {Importar}
translate B Index {Indice}
translate B LoadGame {Carrega jogo}
translate B BrowseGame {Listar jogo}
translate B MergeGame {Fazer merge do jogo}
translate B Preview {Visualizacao}
translate B Revert {Reverter}
translate B Save {Salvar}
translate B Search {Pesquisar}
translate B Stop {Parar}
translate B Store {Guardar}
translate B Update {Atualizar}
translate B ChangeOrient {Muda orientacao da janela}
translate B None {Nenhum}
translate B First {Primeiro}
translate B Current {Atual}
translate B Last {Ultimo}

# General messages:
translate B game {jogo}
translate B games {jogos}
translate B move {movimento}
translate B moves {movimentos}
translate B all {tudo}
translate B Yes {Sim}
translate B No {Nao}
translate B Both {Ambos}
translate B King {Rei}
translate B Queen {Dama}
translate B Rook {Torre}
translate B Bishop {Bispo}
translate B Knight {Cavalo}
translate B Pawn {Peao}
translate B White {Branco}
translate B Black {Preto}
translate B Player {Jogador}
translate B Rating {Rating}
translate B RatingDiff {Diferenca de Rating (Brancas - Pretas)}
translate B Event {Evento}
translate B Site {Lugar}
translate B Country {Pais}
translate B IgnoreColors {Ignorar cores}
translate B Date {Data}
translate B EventDate {Evento data}
translate B Decade {Decade} ;# ***
translate B Year {Ano}
translate B Month {Mes}
translate B Months {Janeiro Fevereiro Marco Abril Maio Junho
  Julho Agosto Setembro Outubro Novembro Dezembro}
translate B Days {Dom Seg Ter Qua Qui Sex Sab}
translate B YearToToday {Anos ate hoje}
translate B Result {Resultado}
translate B Round {Rodada}
translate B Length {Tamanho}
translate B ECOCode {ECO}
translate B ECO {ECO}
translate B Deleted {Apagado}
translate B SearchResults {Resultados da Pesquisa}
translate B OpeningTheDatabase {Abrindo a Base de Dados}
translate B Database {Base de dados}
translate B Filter {Filtro}
translate B noGames {nenhum jogo}
translate B allGames {todos os jogos}
translate B empty {vazio}
translate B clipbase {base de trabalho}
translate B score {Pontuacao}
translate B StartPos {Posicao Inicial}
translate B Total {Total}

# Game information:
translate B twin {duplicata}
translate B deleted {apagado}
translate B comment {comentario}
translate B hidden {oculto}
translate B LastMove {Ultimo movimento}
translate B NextMove {Proximo}
translate B GameStart {Inicio do jogo}
translate B LineStart {Inicio da linha}
translate B GameEnd {Fim do jogo}
translate B LineEnd {Fim da linha}

# Player information:
translate B PInfoAll {Resultados para <b>todos</b> os jogos}
translate B PInfoFilter {Resultados para os jogos <b>filtrados</b>}
translate B PInfoAgainst {Resultados contra}
translate B PInfoMostWhite {Aberturas mais comuns com as Brancas}
translate B PInfoMostBlack {Aberturas mais comuns com as Pretas}
translate B PInfoRating {Historico de Rating}
translate B PInfoBio {Biografia}

# Tablebase information:
translate B Draw {Empate}
translate B stalemate {mate afogado}
translate B withAllMoves {com todos os movimentos}
translate B withAllButOneMove {com um movimento a menos}
translate B with {com}
translate B only {apenas}
translate B lose {derrota}
translate B loses {derrotas}
translate B allOthersLose {qualquer outro perde}
translate B matesIn {mate em}
translate B hasCheckmated {recebeu xeque-mate}
translate B longest {mais longo}

# Tip of the day:
translate B Tip {Dica}
translate B TipAtStartup {Dica ao iniciar}

# Tree window menus: ***
menuText B TreeFile "Arquivo" 0
menuText B TreeFileSave "Salvar arquivo de cache" 0 \
  {Salvar o arquivo de cache da arvore (.stc)}
menuText B TreeFileFill "Criar arquivo de cache" 0 \
  {Enche o arquivo de cache com as posicoes comuns na abertura}
menuText B TreeFileBest "Best games list" 0 \
  {Mostra a lista dos melhores jogos da arvore}
menuText B TreeFileGraph "Janela de Grafico" 0 \
  {Mostra o grafico para este galho da arvore}
menuText B TreeFileCopy "Copiar texto da arvore para a area de transferencia" \
  1 {Copiar texto da arvore para a area de transferencia}
menuText B TreeFileClose "Fechar janela de arvore" 0 {Fechar janela de arvore}
menuText B TreeSort "Ordenar" 0
menuText B TreeSortAlpha "Alfabetica" 0
menuText B TreeSortECO "ECO" 0
menuText B TreeSortFreq "Frequencia" 0
menuText B TreeSortScore "Pontuacao" 0
menuText B TreeOpt "Opcoes" 0
menuText B TreeOptLock "Lock" 0 {Trava/Destrava a arvore para o banco corrente}
menuText B TreeOptTraining "Treinamento" 0 \
  {Liga/Desliga o modo treinamento na arvore}
menuText B TreeOptAutosave "Salvar automaticamente arquivo de cache" 0 \
  {Salvar automaticamente o arquivo de cache quando fechar a janela de arvore}
menuText B TreeHelp "Ajuda" 0
menuText B TreeHelpTree "Ajuda para arvore" 0
menuText B TreeHelpIndex "Indice da Ajuda" 0
translate B SaveCache {Salvar Cache}
translate B Training {Treinamento}
translate B LockTree {Travamento}
translate B TreeLocked {Travada} ;# ***
translate B TreeBest {Melhor}
translate B TreeBestGames {Melhores jogos da arvore}

# Finder window:
menuText B FinderFile "Arquivo" 0
menuText B FinderFileSubdirs "Buscar nos subdiretorios" 0
menuText B FinderFileClose "Fecha buscador de arquivos" 0
menuText B FinderSort "Ordenar" 0
menuText B FinderSortType "Tipo" 0
menuText B FinderSortSize "Tamanho" 0
menuText B FinderSortMod "Modificado" 0
menuText B FinderSortName "Nome" 0
menuText B FinderSortPath "Caminho" 0
menuText B FinderTypes "Tipos" 0
menuText B FinderTypesScid "Bases Scid" 0
menuText B FinderTypesOld "Bases Scid antigas" 0
menuText B FinderTypesPGN "Arquivos PGN" 0
menuText B FinderTypesEPD "Arquivos EPD (book)" 0
menuText B FinderTypesRep "Arquivos de Repertorio" 0
menuText B FinderHelp "Ajuda" 0
menuText B FinderHelpFinder "Ajuda do Buscador" 0
menuText B FinderHelpIndex "Indice da Ajuda" 0
translate B FileFinder {Buscador de Arquivos}
translate B FinderDir {Diretorio}
translate B FinderDirs {Diretorios}
translate B FinderFiles {Arquivos}
translate B FinderUpDir {Acima}

# Tournament finder:
menuText B TmtFile "Arquivo" 0
menuText B TmtFileUpdate "Atualizar" 0
menuText B TmtFileClose "Fecha Buscador de Torneios" 0
menuText B TmtSort "Ordenar" 0
menuText B TmtSortDate "Data" 0
menuText B TmtSortPlayers "Jogadores" 0
menuText B TmtSortGames "Jogos" 0
menuText B TmtSortElo "Elo" 0
menuText B TmtSortSite "Lugar" 0
menuText B TmtSortEvent "Evento" 1
menuText B TmtSortWinner "Vencedor" 0
translate B TmtLimit "Limite de Lista"
translate B TmtMeanElo "Menor Elo"
translate B TmtNone "Nenhum torneio encontrado."

# Graph windows:
menuText B GraphFile "Arquivo" 0
menuText B GraphFileColor "Salvar como Postscript Colorido..." 12
menuText B GraphFileGrey "Salvar como Postscript Cinza..." 23
menuText B GraphFileClose "Fecha janela" 6
menuText B GraphOptions "Opcoes" 0
menuText B GraphOptionsWhite "Branco" 0
menuText B GraphOptionsBlack "Preto" 0
menuText B GraphOptionsBoth "Ambos" 0
menuText B GraphOptionsPInfo "Informacao do Jogador" 0
translate B GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate B AddVariation {Adicionar variante}
translate B AddMove {Adicionar movimento}
translate B Annotate {Anotar}
translate B AnalysisCommand {Comando de Analise}
translate B PreviousChoices {Escolhas Anteriores}
translate B AnnotateTime {Define o tempo entre movimentos em segundos}
translate B AnnotateWhich {Adiciona variante}
translate B AnnotateAll {Para movimentos de ambos os lados}
translate B AnnotateWhite {Apenas para movimentos das Brancas}
translate B AnnotateBlack {Apenas para movimentos das Pretas}
translate B AnnotateNotBest {Quando o movimento do jogo nao for o melhor movimento}

# Analysis Engine open dialog:
translate B EngineList {Lista de Programas de Analise}
translate B EngineName {Nome}
translate B EngineCmd {Comando}
translate B EngineArgs {Parametros}
translate B EngineDir {Diretorio}
translate B EngineElo {Elo}
translate B EngineTime {Data}
translate B EngineNew {Novo}
translate B EngineEdit {Editar}
translate B EngineRequired {Fields in bold are required; others are optional}

# Stats window menus:
menuText B StatsFile "Arquivo" 0
menuText B StatsFilePrint "Imprimir para arquivo..." 0
menuText B StatsFileClose "Fecha janela" 0
menuText B StatsOpt "Opcoes" 0

# PGN window menus:
menuText B PgnFile "Arquivo" 0
menuText B PgnFilePrint "Imprimir para arquivo..." 0
menuText B PgnFileClose "Fechar janela PGN" 0
menuText B PgnOpt "Monitor" 0
menuText B PgnOptColor "Monitor Colorido" 0
menuText B PgnOptShort "Cabecalho curto (3 linhas)" 0
menuText B PgnOptSymbols "Anotacoes simbolicas" 0
menuText B PgnOptIndentC "Identar comentarios" 0
menuText B PgnOptIndentV "Identar variantes" 7
menuText B PgnOptColumn "Estilo Coluna (um movimento por linha)" 0
menuText B PgnOptSpace "Espaco apos o numero do movimento" 0
menuText B PgnOptStripMarks "Strip out colored square/arrow codes" 1 ;# ***
menuText B PgnColor "Cores" 0
menuText B PgnColorHeader "Cabecalho..." 0
menuText B PgnColorAnno "Anotacoes..." 0
menuText B PgnColorComments "Comentarios..." 0
menuText B PgnColorVars "Variantes..." 0
menuText B PgnColorBackground "Cor de fundo..." 0
menuText B PgnHelp "Ajuda" 0
menuText B PgnHelpPgn "Ajuda PGN" 0
menuText B PgnHelpIndex "Indice" 0

# Crosstable window menus:
menuText B CrosstabFile "Arquivo" 0
menuText B CrosstabFileText "Imprime para arquivo texto..." 9
menuText B CrosstabFileHtml "Imprime para arquivo HTML..." 9
menuText B CrosstabFileLaTeX "Imprime para arquivo LaTex..." 9
menuText B CrosstabFileClose "Fechar tabela de cruzamentos" 0
menuText B CrosstabEdit "Editar" 0
menuText B CrosstabEditEvent "Evento" 0
menuText B CrosstabEditSite "Lugar" 0
menuText B CrosstabEditDate "Data" 0
menuText B CrosstabOpt "Monitor" 0
menuText B CrosstabOptAll "Todos contra todos" 0
menuText B CrosstabOptSwiss "Swiss" 0
menuText B CrosstabOptKnockout "Knockout" 0
menuText B CrosstabOptAuto "Automatico" 0
menuText B CrosstabOptAges "Idade em anos" 0
menuText B CrosstabOptNats "Nacionalidades" 0
menuText B CrosstabOptRatings "Ratings" 0
menuText B CrosstabOptTitles "Titulos" 0
menuText B CrosstabOptBreaks "Scores de desempate" 0
menuText B CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText B CrosstabOptColors "Cores (apenas para tabela Swiss)" 0
menuText B CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2 ;# ***
menuText B CrosstabOptGroup "Pontuacao do Grupo" 0
menuText B CrosstabSort "Ordenar" 0
menuText B CrosstabSortName "Nome" 0
menuText B CrosstabSortRating "Rating" 0
menuText B CrosstabSortScore "Pontuacao" 0
menuText B CrosstabColor "Cor" 0
menuText B CrosstabColorPlain "Texto puro" 0
menuText B CrosstabColorHyper "Hipertexto" 0
menuText B CrosstabHelp "Ajuda" 0
menuText B CrosstabHelpCross "Ajuda para tabela de cruzamentos" 0
menuText B CrosstabHelpIndex "Indice da Ajuda" 0
translate B SetFilter {Setar filtro}
translate B AddToFilter {Adicionar ao filtro}
translate B Swiss {Swiss}

# Opening report window menus:
menuText B OprepFile "Arquivo" 0
menuText B OprepFileText "Imprimir para arquivo texto..." 9
menuText B OprepFileHtml "Imprimir para arquivo HTML..." 9
menuText B OprepFileLaTeX "Imprimir para arquivo LaTex..." 9
menuText B OprepFileOptions "Opcoes..." 0
menuText B OprepFileClose "Fechar janela de relatorio" 0
menuText B OprepHelp "Ajuda" 0
menuText B OprepHelpReport "Ajuda para Relatorio de abertura" 0
menuText B OprepHelpIndex "Indice da Ajuda" 0

# Repertoire editor:
menuText B RepFile "Arquivo" 0
menuText B RepFileNew "Novo" 0
menuText B RepFileOpen "Abrir..." 0
menuText B RepFileSave "Salvar..." 0
menuText B RepFileSaveAs "Salvar como..." 5
menuText B RepFileClose "Fechar janela" 0
menuText B RepEdit "Editar" 0
menuText B RepEditGroup "Adicionar grupo" 4
menuText B RepEditInclude "Adicionar linha incluida" 4
menuText B RepEditExclude "Adicionar linha excluida" 4
menuText B RepView "Visao" 0
menuText B RepViewExpand "Expandir todos os grupos" 0
menuText B RepViewCollapse "Contrair todos os grupos" 0
menuText B RepSearch "Pesquisa" 0
menuText B RepSearchAll "Tudo do repertorio..." 0
menuText B RepSearchDisplayed "Apenas linhas exibidas..." 0
menuText B RepHelp "Ajuda" 0
menuText B RepHelpRep "Ajuda de Repertorio" 0
menuText B RepHelpIndex "Indice da Ajuda" 0
translate B RepSearch "Pesquisa no repertorio"
translate B RepIncludedLines "linhas incluidas"
translate B RepExcludedLines "linhas excluidas"
translate B RepCloseDialog {Este repertorio sofreu alteracoes.

Voce realmente quer continuar e descartar as alteracoes que foram feitas?
}

# Header search:
translate B HeaderSearch {Busca por cabecalho}
translate B GamesWithNoECO {Jogos sem ECO?}
translate B GameLength {Tamanho do jogo}
translate B FindGamesWith {Encontrar jogos com}
translate B StdStart {Inicio padrao}
translate B Promotions {Promocoes}
translate B Comments {Comentarios}
translate B Variations {Variantes}
translate B Annotations {Anotacoes}
translate B DeleteFlag {Delete flag}
translate B WhiteOpFlag {Abertura Brancas}
translate B BlackOpFlag {Abertura Pretas}
translate B MiddlegameFlag {Meio-jogo}
translate B EndgameFlag {Final}
translate B NoveltyFlag {Novidade}
translate B PawnFlag {Estrutura de Peoes}
translate B TacticsFlag {Tatica}
translate B QsideFlag {Jogo na ala da Dama}
translate B KsideFlag {Jogo na ala do Rei}
translate B BrilliancyFlag {Brilhantismo}
translate B BlunderFlag {Erro!!!}
translate B UserFlag {Usuario}
translate B PgnContains {PGN contem texto}

# Game list window:
translate B GlistNumber {Numero}
translate B GlistWhite {Branco}
translate B GlistBlack {Preto}
translate B GlistWElo {B-Elo}
translate B GlistBElo {P-Elo}
translate B GlistEvent {Evento}
translate B GlistSite {Lugar}
translate B GlistRound {Rodada}
translate B GlistDate {Data}
translate B GlistYear {Ano}
translate B GlistEDate {Evento-Data}
translate B GlistResult {Resultado}
translate B GlistLength {Tamanho}
translate B GlistCountry {Pais}
translate B GlistECO {ECO}
translate B GlistOpening {Abertura}
translate B GlistEndMaterial {End-Material}
translate B GlistDeleted {Apagado}
translate B GlistFlags {Sinalizador}
translate B GlistVars {Variantes}
translate B GlistComments {Comentarios}
translate B GlistAnnos {Anotacoes}
translate B GlistStart {Iniciar}
translate B GlistGameNumber {Numero do Jogo}
translate B GlistFindText {Encontrar texto}
translate B GlistMoveField {Mover}
translate B GlistEditField {Configurar}
translate B GlistAddField {Adicionar}
translate B GlistDeleteField {Remover}
translate B GlistWidth {Largura}
translate B GlistAlign {Alinhar}
translate B GlistColor {Cor}
translate B GlistSep {Separador}

# Maintenance window:
translate B DatabaseName {Nome da base de dados:}
translate B TypeIcon {Icone de Tipo:}
translate B NumOfGames {Jogos:}
translate B NumDeletedGames {Jogos deletados:}
translate B NumFilterGames {Jogos no filtro:}
translate B YearRange {Faixa de Anos:}
translate B RatingRange {Faixa de Rating:}
translate B Flag {Sinalizador}
translate B DeleteCurrent {Deletar jogo corrente}
translate B DeleteFilter {Deletar jogos filtrados}
translate B DeleteAll {Deletar todos os jogos}
translate B UndeleteCurrent {Recuperar jogo corrente}
translate B UndeleteFilter {Recuperar jogos filtrados}
translate B UndeleteAll {Recuperar todos os jogos}
translate B DeleteTwins {Deletar duplicatas}
translate B MarkCurrent {Marcar jogo corrente}
translate B MarkFilter {Marcar jogos filtrados}
translate B MarkAll {Marcar todos os jogos}
translate B UnmarkCurrent {Desmarcar jogo corrente}
translate B UnmarkFilter {Desmarcar jogos filtrados}
translate B UnmarkAll {Desmarcar todos os jogos}
translate B Spellchecking {Verificacao Ortografica}
translate B Players {Jogadores}
translate B Events {Eventos}
translate B Sites {Lugares}
translate B Rounds {Rodadas}
translate B DatabaseOps {Operacoes na base de dados}
translate B ReclassifyGames {Jogos classificados por ECO}
translate B CompactDatabase {Compactar base de dados}
translate B SortDatabase {Ordenar base de dados}
translate B AddEloRatings {Adicionar ratings}
translate B AutoloadGame {Carregar autom. o jogo numero}
translate B StripTags {Strip PGN tags} ;# ***
translate B StripTag {Strip tag} ;# ***
translate B Cleaner {Limpador}
translate B CleanerHelp {
O Limpador do Scid executara todas as acoes de manutencao selecionadas da lista abaixo, no banco corrente.

As configuracoes atuais na classificacao por ECO e dialogos de exclusao de duplicatas serao aplicadas se voce escolher estas funcoes.
}
translate B CleanerConfirm {
Uma vez iniciado, o Limpador nao podera ser interrompido!

Esta operacao pode levar muito tempo para ser executada em uma grande base de dados, dependendo das funcoes selecionadas e das configuracoes atuais.

Voce esta certo de que quer iniciar as acoes de manutencao selecionadas?
}

# Comment editor:
translate B AnnotationSymbols  {Simbolos de Anotacao:}
translate B Comment {Comentario:}

# Board search:
translate B BoardSearch {Pesquisa Tabuleiro}
translate B FilterOperation {Operacao no filtro corrente:}
translate B FilterAnd {E (Filtro restrito)}
translate B FilterOr {OU (Adicionar ao filtro)}
translate B FilterIgnore {IGNORAR (Limpar filtro)}
translate B SearchType {Tipo de pesquisa:}
translate B SearchBoardExact {Posicao exata (todas as pecas nas mesmas casas)}
translate B SearchBoardPawns {Peoes (mesmo material, todos os peoes nas mesmas casas)}
translate B SearchBoardFiles {Colunas (mesmo material, todos os peoes na mesma coluna)}
translate B SearchBoardAny {Qualquer (mesmo material, peoes e pecas em qualquer posicao)}
translate B LookInVars {Olhar nas variantes}

# Material search:
translate B MaterialSearch {Pesquisa Material}
translate B Material {Material}
translate B Patterns {Padroes}
translate B Zero {Zero}
translate B Any {Qualquer}
translate B CurrentBoard {Tabuleiro corrente}
translate B CommonEndings {Finais comuns}
translate B CommonPatterns {Padroes comuns}
translate B MaterialDiff {Diferenca de Material}
translate B squares {casas}
translate B SameColor {Mesma cor}
translate B OppColor {Cor oposta}
translate B Either {Qualquer}
translate B MoveNumberRange {Faixa do numero de movimentos}
translate B MatchForAtLeast {Conferem por pelo menos}
translate B HalfMoves {meios movimentos}

# Game saving:
translate B Today {Hoje}
translate B ClassifyGame {Classificar Jogo}

# Setup position:
translate B EmptyBoard {Tabuleiro vazio}
translate B InitialBoard {Tabuleiro Inicial}
translate B SideToMove {Lado que move}
translate B MoveNumber {No. do Movimento}
translate B Castling {Roque}
translate B EnPassentFile {coluna En Passant}
translate B ClearFen {Limpar FEN}
translate B PasteFen {Colar FEN}

# Replace move dialog:
translate B ReplaceMove {Substituir movimento}
translate B AddNewVar {Adicionar nova variante}
translate B ReplaceMoveMessage {Um movimento ja existe nesta posicao.

Voce pode substitui-lo, descartar todos os movimentos que o seguem, ou adicionar seu movimento como uma nova variante.

(Voce pode evitar que esta mensagem apareca no futuro desligando a opcao "Perguntar antes de substituir movimentos" no menu Opcoes:Movimentos.)}

# Make database read-only dialog:
translate B ReadOnlyDialog {Se voce fizer esta base de dados apenas para leitura, nenhuma alteracao sera permitida.
Nenhum jogo podera ser salvo ou substituido, e nenhuma flag de exclusao podera ser alterada.
Qualquer ordenacao ou resultados de classificacao por ECO serao temporarios.

Para poder tornar a base de dados atualizavel novamente, feche-a e abra-a novamente.

Voce realmente quer que esta base de dados seja apenas de leitura?}

# Clear game dialog:
translate B ClearGameDialog {Este jogo foi alterado.

Voce realmente quer continuar e descartar as mudancas feitas?
}

# Exit dialog:
translate B ExitDialog {Voce quer realmente sair do Scid?}
translate B ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.} ;# ***

# Import window:
translate B PasteCurrentGame {Colar jogo corrente}
translate B ImportHelp1 {Introduzir ou colar um jogo em formato PGN no quadro acima.}
translate B ImportHelp2 {Quaisquer erros ao importar o jogo serao mostrados aqui.}

# ECO Browser:
translate B ECOAllSections {todas as secoes ECO}
translate B ECOSection {secao ECO}
translate B ECOSummary {Resumo para}
translate B ECOFrequency {Frequencia de subcodigos para}

# Opening Report:
translate B OprepTitle {Relatorio de Abertura}
translate B OprepReport {Relatorio}
translate B OprepGenerated {Gerado por}
translate B OprepStatsHist {Estatisticas e Historico}
translate B OprepStats {Estatisticas}
translate B OprepStatAll {Todas as partidas do relatorio}
translate B OprepStatBoth {Ambos com rating}
translate B OprepStatSince {Desde}
translate B OprepOldest {Jogos mais antigos}
translate B OprepNewest {Jogos mais recentes}
translate B OprepPopular {Popularidade Atual}
translate B OprepFreqAll {Frequencia em todos os anos:   }
translate B OprepFreq1   {No ultimo ano: }
translate B OprepFreq5   {Nos ultimos 5 anos: }
translate B OprepFreq10  {Nos ultimos 10 anos: }
translate B OprepEvery {uma vez en cada %u jogos}
translate B OprepUp {ate %u%s de todos os anos}
translate B OprepDown {menos que %u%s de todos os anos}
translate B OprepSame {nenhuma mudanca em todos os anos}
translate B OprepMostFrequent {Jogadores mais frequentes}
translate B OprepRatingsPerf {Ratings e Desempenho}
translate B OprepAvgPerf {Ratings e desempenho medios}
translate B OprepWRating {Rating Brancas}
translate B OprepBRating {Rating Pretas}
translate B OprepWPerf {Desempenho Brancas}
translate B OprepBPerf {Desempenho Pretas}
translate B OprepHighRating {Jogos com o maior rating medio}
translate B OprepTrends {Tendencias de Resultados}
translate B OprepResults {Qtd. e frequencia de resultados}
translate B OprepLength {Tamanho do jogo}
translate B OprepFrequency {Frequencia}
translate B OprepWWins {Brancas vencem: }
translate B OprepBWins {Pretas vencem:  }
translate B OprepDraws {Empates:        }
translate B OprepWholeDB {toda a base de dados}
translate B OprepShortest {Vitorias mais rapidas}
translate B OprepMovesThemes {Movimentos e Temas}
translate B OprepMoveOrders {Ordem dos movimentos para atingir a posicao do relatorio}
translate B OprepMoveOrdersOne \
  {Houve apenas uma ordem de movimentos que atinge esta posicao: }
translate B OprepMoveOrdersAll \
  {Houve apenas %u ordens de movimentos que atingem esta posicao:}
translate B OprepMoveOrdersMany \
  {Houve %u ordens de movimentos que atingem esta posicao. As %u primeiras sao:}
translate B OprepMovesFrom {Movimentos da posicao do relatorio}
translate B OprepThemes {Temas Posicionais}
translate B OprepThemeDescription {Frequencia de temas no movimento %u}
translate B OprepThemeSameCastling {Roque do mesmo lado}
translate B OprepThemeOppCastling {Roques opostos}
translate B OprepThemeNoCastling {Ninguem efetuou o roque}
translate B OprepThemeKPawnStorm {Tempestade de Peoes no lado do Rei}
translate B OprepThemeQueenswap {Damas ja trocadas}
translate B OprepThemeIQP {Peao da Dama isolado}
translate B OprepThemeWP567 {Peao Branco na 5/6/7a fila}
translate B OprepThemeBP234 {Peao Preto na 2/3/4a fila}
translate B OprepThemeOpenCDE {Colunas c/d/e abertas}
translate B OprepTheme1BishopPair {Um lado tem o par de Bispos}
translate B OprepEndgames {Finais}
translate B OprepReportGames {Jogos no Relatorio}
translate B OprepAllGames {Todos os jogos}
translate B OprepEndClass {Material ao fim de cada jogo}
translate B OprepTheoryTable {Tabela de Teoria}
translate B OprepTableComment {Gerada a partir dos %u jogos com rating mais alto.}
translate B OprepExtraMoves {Movimentos com nota extra na Tabela de Teoria}
translate B OprepMaxGames {Qtde. Maxima de jogos na tabela de teoria}

# Piece Tracker window:
translate B TrackerSelectSingle {Left mouse button selects this piece.} ;# ***
translate B TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate B TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate B TrackerStat {Statistic}
translate B TrackerGames {% games with move to square}
translate B TrackerTime {% time on each square}
translate B TrackerMoves {Moves}
translate B TrackerMovesStart {Enter the move number where tracking should begin.}
translate B TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate B SelectAllGames {Todos os jogos na base de dados}
translate B SelectFilterGames {Apenas jogos no filtro}
translate B SelectTournamentGames {Somente jogos no torneio atual}
translate B SelectOlderGames {Somente jogos antigos}

# Delete Twins window:
translate B TwinsNote {Para serem duplicatas, dois jogos devem ter pelo menos os mesmos dois jogadores, alem de criterios que voce pode definir abaixo. Quando um par de duplicatas e encontrado, o jogo menor e deletado.
Dica: e melhor fazer a verificacao ortografica da base de dados antes de remover duplicatas, pois isso melhora o processo de deteccao de duplicatas. }
translate B TwinsCriteria {Criterio: Duplicatas devem ter...}
translate B TwinsWhich {Jogos a examinar}
translate B TwinsColors {Jogadores com a mesma cor?}
translate B TwinsEvent {Mesmo evento?}
translate B TwinsSite {Mesmo lugar?}
translate B TwinsRound {Mesma rodada?}
translate B TwinsYear {Mesmo ano?}
translate B TwinsMonth {Mesmo mes?}
translate B TwinsDay {Mesmo dia?}
translate B TwinsResult {Mesmo resultado?}
translate B TwinsECO {Mesmo codigo ECO?}
translate B TwinsMoves {Mesmos movimentos?}
translate B TwinsPlayers {Comparacao dos nomes dos jogadores:}
translate B TwinsPlayersExact {Comparacao exata}
translate B TwinsPlayersPrefix {Primeiras 4 letras apenas}
translate B TwinsWhen {Quando deletar duplicatas}
translate B TwinsSkipShort {Ignorar todos os jogos com menos de 5 movimentos?}
translate B TwinsUndelete {Recuperar todos os jogos antes?}
translate B TwinsSetFilter {Definir filtro para todas as duplicatas deletadas?}
translate B TwinsComments {Manter sempre os jogos com comentarios?}
translate B TwinsVars {Manter sempre os jogos com variantes?}
translate B TwinsDeleteWhich {Delete which game:} ;# ***
translate B TwinsDeleteShorter {Shorter game} ;# ***
translate B TwinsDeleteOlder {Smaller game number} ;# ***
translate B TwinsDeleteNewer {Larger game number} ;# ***
translate B TwinsDelete {Deletar jogos}

# Name editor window:
translate B NameEditType {Tipo de nome para editar}
translate B NameEditSelect {Jogos para editar}
translate B NameEditReplace {Substituir}
translate B NameEditWith {com}
translate B NameEditMatches {Confere: Pressione Ctrl+1 a Ctrl+9 para selecionar}

# Classify window:
translate B Classify {Classificar}
translate B ClassifyWhich {Que jogos devem ser classificados por ECO}
translate B ClassifyAll {Todos os Jogos (substituir codigos ECO antigos)}
translate B ClassifyYear {Todos os jogos do ultimo ano}
translate B ClassifyMonth {Todos os jogos do ultimo mes}
translate B ClassifyNew {Somente jogos ainda sem codigo ECO}
translate B ClassifyCodes {Codigos ECO a serem usados}
translate B ClassifyBasic {Codigos Basicos apenas ("B12", ...)}
translate B ClassifyExtended {Extensoes Scid ("B12j", ...)}

# Compaction:
translate B NameFile {Arquivo de nomes}
translate B GameFile {Arquivo de jogos}
translate B Names {Nomes}
translate B Unused {Nao usado}
translate B SizeKb {Tamanho (kb)}
translate B CurrentState {Estado Atual}
translate B AfterCompaction {Apos compactacao}
translate B CompactNames {Compactar arquivo de nomes}
translate B CompactGames {Compactar arquivo de nomes}

# Sorting:
translate B SortCriteria {Criterio}
translate B AddCriteria {Adicionar criterio}
translate B CommonSorts {Ordenacoes comuns}
translate B Sort {Ordenar}

# Exporting:
translate B AddToExistingFile {Adicionar jogos a um arquivo existente?}
translate B ExportComments {Exportar comentarios?}
translate B ExportVariations {Exportar variantes?}
translate B IndentComments {Identar Comentarios?}
translate B IndentVariations {Identar Variantes?}
translate B ExportColumnStyle {Estilo Coluna (um movimento por linha)?}
translate B ExportSymbolStyle {Estilo de anotacao simbolica:}
translate B ExportStripMarks {Strip square/arrow mark codes from comments?} ;# ***

# Goto game/move dialogs:
translate B LoadGameNumber {Entre o numero do jogo a ser carregado:}
translate B GotoMoveNumber {Ir p/ o lance no.:}

# Copy games dialog:
translate B CopyGames {Copiar jogos}
translate B CopyConfirm {
 Voce realmente quer copiar
 os [thousands $nGamesToCopy] jogos filtrados
 da base de dados "$fromName"
 para a base de dados "$targetName"?
}
translate B CopyErr {Copia nao permitida}
translate B CopyErrSource {a base de dados origem}
translate B CopyErrTarget {a base de dados destino}
translate B CopyErrNoGames {nao tem jogos que atendam o filtro}
translate B CopyErrReadOnly {e apenas de leitura}
translate B CopyErrNotOpen {nao esta aberta}

# Colors:
translate B LightSquares {Casas Brancas}
translate B DarkSquares {Casas Pretas}
translate B SelectedSquares {Casas selecionadas}
translate B SuggestedSquares {Casas Sugeridas}
translate B WhitePieces {Pecas Brancas}
translate B BlackPieces {Pecas Pretas}
translate B WhiteBorder {Borda Branca}
translate B BlackBorder {Borda Preta}

# Novelty window:
translate B FindNovelty {Buscar Novidade}
translate B Novelty {Novidade}
translate B NoveltyInterrupt {Busca interrompida}
translate B NoveltyNone {Nenhuma novidade encontrada}
translate B NoveltyHelp {
Scid buscara o primeiro movimento do jogo atual que alcanca uma posicao nao encontrada na base selecionada ou no arquivo ECO.
}

# Upgrading databases:
translate B Upgrading {Atualizando}
translate B ConfirmOpenNew {
Esta e uma base em formato antigo (Scid 2) que nao pode ser aberta pelo Scid 3, mas uma versao no novo formato (Scid 3) ja foi criada.

Voce quer abrir a nova versao da base Scid 3?
}
translate B ConfirmUpgrade {
Esta e uma base em formato antigo (Scid 2). Uma versao da base no novo formato deve ser criada antes de poder ser usada no Scid 3.

A atualizacao criara uma nova versao da base; isto nao altera nem remove os registros originais.

Este processo pode levar algum tempo, mas so precisa ser feito uma vez e pode ser cancelado se estiver demorando muito.

Voce quer atualizar esta base agora?
}

# Recent files options:
translate B RecentFilesMenu {Number of recent files in File menu} ;# ***
translate B RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}

# end of portbr.tcl
# swedish.tcl:
# Text for menu names and status bar help messages in Swedish.
# Part of Scid (Shane's Chess Information Database).
# Contributed by Martin Skjldebrand, martin@hauntedhousesw.com

addLanguage W Swedish 1

proc setLanguage_W {} {

# File menu:
menuText W File "Arkiv" 0
menuText W FileNew "Ny..." 0 {Skapa en ny Scid databas}
menuText W FileOpen "ppna..." 0 {pnna en befintlig Scid databas}
menuText W FileClose "Stng" 0 {Stng den aktiva Scid databasen}
menuText W FileFinder "Sk filer" 4 {ppna skdialogen}
menuText W FileBookmarks "Bokmrken" 0 {Hantera bokmrken (genvg: Ctrl+B)}
menuText W FileBookmarksAdd "Nytt bokmrke" 0 \
  {Markera den aktiva stllningen i partiet}
menuText W FileBookmarksFile "Spara bokmrke" 0 \
  {Spara bokmrket fr den aktiva stllningen i partiet}
menuText W FileBookmarksEdit "Redigera bokmrken..." 0 \
  {Redigera bokmrken}
menuText W FileBookmarksList "Visa bokmrken som lista" 19 \
  {Visar bokmrkena som lista, inte undermenyer}
menuText W FileBookmarksSub "Visa bokmrken i undermenyer" 17 \
  {Visar bokmrkena som undermenyer, inte lista}
menuText W FileMaint "Databasverktyg" 0 {Scids databasverktyg}
menuText W FileMaintWin "Verktygsfnster" 0 \
  {ppna/ stng verktygsfnstret}
menuText W FileMaintCompact "Komprimera databasen..." 0 \
  {Komprimera databasen, avlgsna raderade partier och oanvnda namn}
menuText W FileMaintClass "Klassificera partier enligt ECO..." 2 \
  {Klassificera om alla partier enligt ECO-systemet}
menuText W FileMaintSort "Sortera databasen..." 0 \
  {Sortera partierna i den aktiva databasen}
menuText W FileMaintDelete "Radera dubbletter..." 0 \
  {Sk dubbletter och markera de som raderingsbara}
menuText W FileMaintTwin "Sk dubbletter" 0 \
  {ppna/ stng dubblettfnstret}
menuText W FileMaintName "Stavningskontroll" 0 {Namnredigering och stavningskontroll}
menuText W FileMaintNameEditor "Redigera namn" 0 \
  {ppna/stng namnredigeringsfnstret}
menuText W FileMaintNamePlayer "Stavningskontrollera namn..." 22 \
  {Stavningskontrollera namn utifrn rttstavningsfilen}
menuText W FileMaintNameEvent "Stavningskontrollera evenemang..." 21 \
  {Stavningskontrollera evenmang utifrn rttstavningsfilen}
menuText W FileMaintNameSite "Stavningskontrollera platser..." 21 \
  {Stavningskontrollera platser utifrn rttstavningsfilen}
menuText W FileMaintNameRound "Stavningskontrollera ronder..." 21 \
  {Stavningskontrollera ronder utifrn rttstavningsfilen}
menuText W FileReadOnly "Enbart lsbar..." 8 \
  {Avlgsna temporrt redigeringsmjligheterna till databasen}
menuText W FileExit "Avsluta" 0 {Avsluta Scid}

# Edit menu:
menuText W Edit "Redigera" 0
menuText W EditAdd "Lgg till variant" 0 {Skapa en variant vid denna stllning}
menuText W EditDelete "Radera variant" 0 {Radera en variant vid denna stllning}
menuText W EditFirst "Skapa huvudvariant" 6 \
  {Gr en av varianterna till huvudvariant}
menuText W EditMain "Skapa nytt textdrag" 11 \
  {Gr en av varianterna till partifortsttning}
menuText W EditTrial "Testa variant" 6 \
  {Starta/ stoppa testlge, undersk en ide p brdet}
menuText W EditStrip "Ta bort" 3 {Avlgsna kommentarer eller varianter frn partiet}
menuText W EditStripComments "Kommentarer" 0 \
  {Avlgsna alla kommentarer och noteringar frn partiet}
menuText W EditStripVars "Varianter" 0 {Avlgsna alla varinter frn partiet}
menuText W EditReset "Tm Clipbase" 1 \
  {Tmmer den temporra databasen}
menuText W EditCopy "Kopiera partiet till Clipbase" 21 \
  {Kopierar det aktuella partiet till Clipbase}
menuText W EditPaste "Klistra in det senaste Clipbasepartiet" 8 \
  {Klistrar in det senaste tillagda i Clipbase i den aktiva databasen}
menuText W EditSetup "Skapa stllning..." 0 \
  {Skapa en utgngsstllning fr aktuellt parti}
menuText W EditPasteBoard "Klistra in utgngsstllning" 10 \
  {Klistra in stllningen frn aktuellt parti i den temporra databasen}

# Game menu:
menuText W Game "Partier" 0
menuText W GameNew "Nytt parti" 0 \
  {terstll brdet infr ett nytt parti (raderar alla ndringar)}
menuText W GameFirst "Ladda det frsta partiet" 10 {Laddar det frsta partiet i filtret}
menuText W GamePrev "Ladda fregende parti" 7 {Ladda fregende parti i filtret}
menuText W GameReload "Brja om partiet" 0 \
  {terstll partiet (raderar alla ndringar)}
menuText W GameNext "Ladda nsta parti" 6 {Ladda nsta parti i filtret}
menuText W GameLast "Ladda det sista partiet" 10 {Ladda det sista partiet i filtret}
menuText W GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText W GameNumber "Ladda parti nummer..." 6 \
  {Ladda ett parti genom att ange dess nummer}
menuText W GameReplace "Spara: Erstt parti..." 7 \
  {Spara partiet och erstt tidigare version}
menuText W GameAdd "Spara: Nytt parti..." 1 \
  {Spara ett nytt parti}
menuText W GameDeepest "Identifiera ppningen" 0 \
  {G till den mest detaljerade stllningen i ECO boken}
menuText W GameGotoMove "G till drag nummer..." 8 \
  {G till ett specifikt drag i partiet}
menuText W GameNovelty "Hitta nyhet..." 7 \
  {Hitta det frsta draget i partiet som inte spelats tidigare}

# Search Menu:
menuText W Search "Sk" 0
menuText W SearchReset "terstll skfilter" 0 {terstll skfiltret s att alla partiet ingr}
menuText W SearchNegate "Omvnt filter" 0 {Ta med partier som utesluts av filtret}
menuText W SearchCurrent "Aktuell position..." 8 {Sk partier med aktuell position p brdet}
menuText W SearchHeader "I huvud..." 2 {Anvnd fast information (spelare, evenemang, plats, mm)}
menuText W SearchMaterial "Material/stllning..." 0 {Skning baserad p material eller stllning}
menuText W SearchUsing "Anvnd skfil..." 10 {Anvnd en fil med lagrade skvillkor}

# Windows menu:
menuText W Windows "Fnster" 0
menuText W WindowsComment "Kommentarseditor" 0 {ppna/ stng kommentarseditorn}
menuText W WindowsGList "Partilista" 5 {ppna/ stng partilistan}
menuText W WindowsPGN "PGN fnster" 0 \
  {ppna/ stng PGN fnstret}
menuText W WindowsTmt "Turneringar" 0 {Lista turneringar}
menuText W WindowsSwitcher "Databasvxlaren" 0 \
  {ppna/ stng databasvxlaren}
menuText W WindowsMaint "Verktygsfnster" 0 \
  {ppna/ stng verktygsfnstret}
menuText W WindowsECO "ECO fnster" 0 {ppna/ stng ECO blddraren}
menuText W WindowsRepertoire "Repertoireditor" 0 \
  {ppna/ stng spelppningsfnstret}
menuText W WindowsStats "Statistikfnster" 0 \
  {ppna/ stng statistikfnstret}
menuText W WindowsTree "Trdfnster" 2 {ppna/ stng varianttrdets fnster}
menuText W WindowsTB "Slutspelsdatabas" 2 \
  {ppna/ stng slutspelsdatabasfnstret}

# Tools menu:
menuText W Tools "Verktyg" 0
menuText W ToolsAnalysis "Analysmotor..." 6 \
  {Starta/ stoppa en analysmotor}
menuText W ToolsAnalysis2 "Analysmotor 2..." 12 \
  {Starta/ stoppa en andra analysmotor}
menuText W ToolsCross "Resultattabell" 0 {Visa en resultattabell fr den aktuella turneringen}
menuText W ToolsEmail "Eposthanterare" 0 \
  {ppna/ stng eposthanteraren}
menuText W ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText W ToolsOpReport "ppningsrapport" 0 \
  {Skapa en ppningsrapport utifrn den aktuella stllningen}
menuText W ToolsTracker "Sk material"  0 {ppnar dialog fr att ska efter en viss materiell balans} 
menuText W ToolsPInfo "Spelarinformation"  0 \
  {ppna/ uppdatera spelarinformation}
menuText W ToolsRating "Rankingdiagram" 0 \
  {Skapa ett ranking diagram fr spelarna i partiet}
menuText W ToolsScore "Resultatdiagram" 8 {Visa resultatdiagrammet}
menuText W ToolsExpCurrent "Exportera aktuellt parti" 1 \
  {Spara aktuellt parti till en textfil}
menuText W ToolsExpCurrentPGN "Exportera till PGN..." 15 \
  {Spara aktuellt parti till en PGN-fil}
menuText W ToolsExpCurrentHTML "Exportera till HTML..." 15 \
  {Spara aktuellt parti till en HTML-fil}
menuText W ToolsExpCurrentLaTeX "Exportera till LaTeX..." 15 \
  {Spara aktuellt parti till en LaTeX-fil}
menuText W ToolsExpFilter "Exportera alla filtrerade partier" 15 \
  {Spara alla filterade partier till en textfil}
menuText W ToolsExpFilterPGN "Exportera till PGN..." 15 \
  {Spara alla filterade partier till en PGN-fil}
menuText W ToolsExpFilterHTML "Exportera till HTML..." 15 \
  {Spara alla filterade partier till en HTML-fil}
menuText W ToolsExpFilterLaTeX "Exportera till LaTeX..." 15 \
  {Spara alla filterade partier till en LaTeX-fil}
menuText W ToolsImportOne "Importera ett parti i PGN-format..." 0 \
  {Importera ett parti i PGN-format}
menuText W ToolsImportFile "Importera flera partier i PGN-format..." 16 \
  {Importera flera partier i PGN-format frn en fil}

# Options menu:
menuText W Options "Alternativ" 2
menuText W OptionsSize "Brdstorlek" 0 {ndra brdets storlek}
menuText W OptionsPieces "Pjsutseende" 1 {ndra pjsernas utseende} 
menuText W OptionsColors "Frger..." 0 {ndra brdets frger}
menuText W OptionsExport "Export" 0 {ndra exportalternativ}
menuText W OptionsFonts "Typsnitt" 0 {ndra typsnitt}
menuText W OptionsFontsRegular "Normal" 0 {ndra det normala typsnittet}
menuText W OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText W OptionsFontsSmall "Liten" 0 {ndra det lilla typsnittet}
menuText W OptionsFontsFixed "Fixerad" 0 {ndra det fixerade typsnittet}
menuText W OptionsGInfo "Partiinformation" 0 {Alternativ fr partiinformation}
menuText W OptionsLanguage "Sprk" 0 {Vlj sprk}
menuText W OptionsMoves "Drag" 0 {Alternativ fr dragangivelse}
menuText W OptionsMovesAsk "Frga fre erstt drag" 0 \
  {Frga innan du erstter befintliga drag}
menuText W OptionsMovesDelay "Frdrjning vid automatspel..." 1 \
  {Ange frdrjning mellan dragen nr datorn spelar sjlv}
menuText W OptionsMovesCoord "Koordinater" 0 \
  {Acceptera koordinater ("g1f3") vid dragangivelse}
menuText W OptionsMovesSuggest "Visa freslagna drag" 0 \
  {Visa/ Dlj freslagna drag}
menuText W OptionsMovesKey "Tangentkomplettering" 0 \
  {Stt p/ stng av dragkomplettering vid tangentinmatning}
menuText W OptionsNumbers "Talformat" 3 {Vlj hur tal visas}
menuText W OptionsStartup "Start" 3 {Vlj vilka fnster som ska ppnas vid start}
menuText W OptionsWindows "Fnster" 1 {Fnsteralternativ}
menuText W OptionsWindowsIconify "Minimera automatiskt" 5 \
  {Minimera alla fnster nr huvufnstret minimeras}
menuText W OptionsWindowsRaise "Autofokus" 0 \
  {Visa ter vissa fnster (t ex. resultatrknare) automatiskt nr de dljs}
menuText W OptionsToolbar "Verktygsflt" 0 \
  {Visa/ dlj huvudfnstrets verktygsflt}
menuText W OptionsECO "Ladda ECO fil..." 7 {Ladda ECO-klassificeringen vid start}
menuText W OptionsSpell "Ladda Rttstavningsfil..." 7 \
  {Ladda rttstavningsfilen vid start}
menuText W OptionsTable "Katalog fr slutspelsdatabaser..." 0 \
  {Vlj en fil som innehller en slutspelsdatabas; alla vriga filer i samma katalog kommer att anvndas}
menuText W OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText W OptionsSave "Spara alternativ" 7 \
  "Spara alla alternativ till en instllnignsfil"
menuText W OptionsAutoSave "Autospara vid avslut" 1 \
  {Spara alla alternativ nr du avslutar Scid}

# Help menu:
menuText W Help "Hjlp" 0
menuText W HelpIndex "Index" 0 {Hjlpsystemets innehllsfrteckning}
menuText W HelpGuide "Snabbguide" 0 {Visa snabbguiden}
menuText W HelpHints "Tips" 0 {Visa tips}
menuText W HelpContact "Kontaktinformation" 0 {Visa kontaktinformation}
menuText W HelpTip "Dagens tips" 0 {Anvndbara Scid tips}
menuText W HelpStartup "Startfnster" 5 {Visa startfnstret}
menuText W HelpAbout "Om Scid" 0 {Information om Scid}

# Game info box popup menu:
menuText W GInfoHideNext "Dlj nsta drag" 0
menuText W GInfoMaterial "Visa materialvrden" 0
menuText W GInfoFEN "Visa FEN" 5
menuText W GInfoMarks "Visa frgade flt och pilar" 22 
menuText W GInfoWrap "Radbrytning" 0
menuText W GInfoFullComment "Visa fullstndiga kommentarer" 18
menuText W GInfoTBNothing "Slutspelsdatabaser: inget" 20
menuText W GInfoTBResult "Slutspelsdatabaser: endast resultat" 28
menuText W GInfoTBAll "Slutspelsdatabaser: resultat och bsta drag" 33
menuText W GInfoDelete "terta/Radera detta parti" 0
menuText W GInfoMark "(Av-)Markera detta parti" 5

# Main window buttons:
helpMsg W .button.start {G till brjan av partiet  (tangent: Home)}
helpMsg W .button.end {G till slutet av partiet  (tangent: End)}
helpMsg W .button.back {Back ett drag (tangent: Vnsterpil)}
helpMsg W .button.forward {G fram ett drag  (tangent: Hgerpil)}
helpMsg W .button.intoVar {G in i variant (genvg: v)}
helpMsg W .button.exitVar {G ur variant  (genvg: z)}
helpMsg W .button.flip {Rotera brdet  (genvg: .)}
helpMsg W .button.coords {Sl av eller p koordinater  (genvg: 0)}
helpMsg W .button.autoplay {Autospel  (tangent: Ctrl+Z)}

# General buttons:
translate W Back {Tillbaka}
translate W Cancel {Avbryt}
translate W Clear {Rensa}
translate W Close {Stng}
translate W Defaults {Standard}
translate W Delete {Radera}
translate W Graph {Diagram}
translate W Help {Hjlp}
translate W Import {Importera}
translate W Index {Index}
translate W LoadGame {Ladda parti}
translate W BrowseGame {Blddra genom partier}
translate W MergeGame {Sl samman partier}
translate W Preview {Frhandsgranska}
translate W Revert {ngra inmatning}
translate W Save {Spara}
translate W Search {Sk}
translate W Stop {Stoppa}
translate W Store {Spara}
translate W Update {Uppdatera}
translate W ChangeOrient {ndra fnstrets orientering}
translate W None {Ingen}
translate W First {Frsta}
translate W Current {Aktuella}
translate W Last {Sista}

# General messages:
translate W game {parti}
translate W games {partier}
translate W move {drag}
translate W moves {drag}
translate W all {alla}
translate W Yes {Ja}
translate W No {Nej}
translate W Both {Bda}
translate W King {Kung}
translate W Queen {Dam}
translate W Rook {Torn}
translate W Bishop {Lpare}
translate W Knight {Springare}
translate W Pawn {Bonde}
translate W White {Vit}
translate W Black {Svart}
translate W Player {Spelare}
translate W Rating {Ranking}
translate W RatingDiff {Rankingskillnad (Vit - Svart)}
translate W Event {Evenemang}
translate W Site {Plats}
translate W Country {Land}
translate W IgnoreColors {Ignorera frger}
translate W Date {Datum}
translate W EventDate {Evenmangsdatum}
translate W Decade {Decade} ;# ***
translate W Year {r}
translate W Month {Mnad}
translate W Months {Januari Februari Mars April Maj Juni
  Juli Augusti September Oktober November December}
translate W Days {Sn Mn Tis Ons Tors Fre Lr}
translate W YearToToday {Idag}
translate W Result {Resultat}
translate W Round {Rond}
translate W Length {Lngd}
translate W ECOCode {ECO kod}
translate W ECO {ECO}
translate W Deleted {Raderad}
translate W SearchResults {Skresultat}
translate W OpeningTheDatabase {ppnar databas}
translate W Database {Databas}
translate W Filter {Filter}
translate W noGames {inga partier}
translate W allGames {alla partier}
translate W empty {tom}
translate W clipbase {temporr databas}
translate W score {resultat}
translate W StartPos {Utgngsstllning}
translate W Total {Totalt}

# Game information:
translate W twin {dubblett}
translate W deleted {raderad}
translate W comment {kommentar}
translate W hidden {dold}
translate W LastMove {Senaste draget}
translate W NextMove {Nsta}
translate W GameStart {Utgngsstllning}
translate W LineStart {Varianten brjar}
translate W GameEnd {Slutstllning}
translate W LineEnd {Varianten slut}

# Player information:
translate W PInfoAll {Resultat fr <b>alla</b> partier}
translate W PInfoFilter {Resultat fr <b>filtrerade</b> partier}
translate W PInfoAgainst {Resultat mot}
translate W PInfoMostWhite {De vanligaste ppningarna som vit}
translate W PInfoMostBlack {De vanligaste ppningarna som svart}
translate W PInfoRating {Rankinghistoria}
translate W PInfoBio {Biografisk information}

# Tablebase information:
translate W Draw {Remi}
translate W stalemate {patt}
translate W withAllMoves {med alla drag}
translate W withAllButOneMove {med alla drag utom ett}
translate W with {med}
translate W only {bara}
translate W lose {frlust}
translate W loses {frluster}
translate W allOthersLose {alla andra frlorar}
translate W matesIn {med matt i}
translate W hasCheckmated {har satt matt}
translate W longest {lngst}

# Tip of the day:
translate W Tip {Tips}
translate W TipAtStartup {Tips vid start}

# Tree window menus:
menuText W TreeFile "Fil" 0
menuText W TreeFileSave "Spara cachefil" 0 {Spara trdcache (.stc) filen}
menuText W TreeFileFill "Fyll cache fil" 0 \
  {Fyll cachefilen med vanliga ppningar}
menuText W TreeFileBest "Lista bsta partier" 0 {Visa lista ver de bstra partierna i trdet}
menuText W TreeFileGraph "Diagramfnster" 0 {Visa diagrammet fr denna gren i trdet}
menuText W TreeFileCopy "Kopiera trd till urklipp" 1 \
  {Kopierar trdrelaterad statistik till urklipp}
menuText W TreeFileClose "Stng trdfnstret" 0 {Stng trdfnstret}
menuText W TreeSort "Sortera" 0
menuText W TreeSortAlpha "Alfabetiskt" 0
menuText W TreeSortECO "ECO kod" 0
menuText W TreeSortFreq "Frekvens" 0
menuText W TreeSortScore "Resultat" 0
menuText W TreeOpt "Options" 0
menuText W TreeOptLock "Ls" 0 {Ls/ ls upp trdet fr den aktuella databasen}
menuText W TreeOptTraining "Trna" 0 {Stt p/ stng av trningslge}
menuText W TreeOptAutosave "Spara cache filen automatiskt" 0 \
  {Spara cache filen automatiskt nr trdfnstret stngs}
menuText W TreeHelp "Hjlp" 0
menuText W TreeHelpTree "Trdhjlp" 0
menuText W TreeHelpIndex "Hjlp index" 0
translate W SaveCache {Spara cache}
translate W Training {Trna}
translate W LockTree {Ls}
translate W TreeLocked {Lst}
translate W TreeBest {Bst}
translate W TreeBestGames {Bsta partier i trdet}

# Finder window:
menuText W FinderFile "Fil" 0
menuText W FinderFileSubdirs "Sk i underkataloger" 0
menuText W FinderFileClose "Stng File Finder" 0
menuText W FinderSort "Sortera" 0
menuText W FinderSortType "Typ" 0
menuText W FinderSortSize "Storlek" 0
menuText W FinderSortMod "Frndrad" 0
menuText W FinderSortName "Namn" 0
menuText W FinderSortPath "Skvg" 0
menuText W FinderTypes "Typer" 0
menuText W FinderTypesScid "Scid databaser" 0
menuText W FinderTypesOld "Scid databaser i ldre format" 0
menuText W FinderTypesPGN "PGN filer" 0
menuText W FinderTypesEPD "EPD filer" 0
menuText W FinderTypesRep "ppningsfiler" 0
menuText W FinderHelp "Hjlp" 0
menuText W FinderHelpFinder "Hjlp fr File Finder" 0
menuText W FinderHelpIndex "Hjlpindex" 0
translate W FileFinder {File Finder}
translate W FinderDir {Katalog}
translate W FinderDirs {Kataloger}
translate W FinderFiles {Filer}
translate W FinderUpDir {upp}

# Tournament finder:
menuText W TmtFile "Fil" 0
menuText W TmtFileUpdate "Uppdatera" 0
menuText W TmtFileClose "Stng turneringshanteraren" 0
menuText W TmtSort "Sortera" 0
menuText W TmtSortDate "Datum" 0
menuText W TmtSortPlayers "Spelare" 0
menuText W TmtSortGames "Partier" 0
menuText W TmtSortElo "Elo" 0
menuText W TmtSortSite "Plats" 0
menuText W TmtSortEvent "Evenemang" 1
menuText W TmtSortWinner "Vinnare" 0
translate W TmtLimit "Listbegrnsningar"
translate W TmtMeanElo "Lgsta snitt Elo"
translate W TmtNone "Inga turneringar hittades."

# Graph windows:
menuText W GraphFile "Fil" 0
menuText W GraphFileColor "Spara som Postscript (frg)" 8
menuText W GraphFileGrey "Spara som Postscript (grskala)" 8
menuText W GraphFileClose "Stng fnster" 6
menuText W GraphOptions "Alternativ" 0
menuText W GraphOptionsWhite "Vit" 0
menuText W GraphOptionsBlack "Svart" 0
menuText W GraphOptionsBoth "Bda" 1
menuText W GraphOptionsPInfo "Spelarinformation" 0
translate W GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate W AddVariation {Lgg till variant}
translate W AddMove {Lgg till drag}
translate W Annotate {Kommentera}
translate W AnalysisCommand {Analysera}
translate W PreviousChoices {Fregende val}
translate W AnnotateTime {Ange tid mellan drag i sekunder}
translate W AnnotateWhich {Lgg till varianter}
translate W AnnotateAll {fr bda sidors drag}
translate W AnnotateWhite {Endast vits drag}
translate W AnnotateBlack {Endast svarts drag}
translate W AnnotateNotBest {Nr partidraget inte r det bsta}

# Analysis Engine open dialog:
translate W EngineList {Lista ver schackprogram}
translate W EngineName {Namn}
translate W EngineCmd {Startkommando}
translate W EngineArgs {Parametrar} 
translate W EngineDir {Katalog}
translate W EngineElo {Elo}
translate W EngineTime {Datum}
translate W EngineNew {Ny}
translate W EngineEdit {Redigera}
translate W EngineRequired {Fet stil indikerar obligatoriska flt; vriga flt r frivilliga} 

# Stats window menus:
menuText W StatsFile "Fil" 0
menuText W StatsFilePrint "Skriv ut till fil..." 0
menuText W StatsFileClose "Stng fnster" 0
menuText W StatsOpt "Alternativ" 0

# PGN window menus:
menuText W PgnFile "Fil" 0
menuText W PgnFilePrint "Skriv ut till..." 0
menuText W PgnFileClose "Stng PGN fnster" 0
menuText W PgnOpt "Presentation" 0
menuText W PgnOptColor "Frg" 0
menuText W PgnOptShort "Kort (3-raders) huvud" 0
menuText W PgnOptSymbols "Symbolbaserad kommentar" 1
menuText W PgnOptIndentC "Indragna kommentarer" 0
menuText W PgnOptIndentV "Indragna varianter" 7
menuText W PgnOptColumn "Spaltstil (ett drag per rad)" 1
menuText W PgnOptSpace "Utrymme efter dragnummer" 1
menuText W PgnOptStripMarks "Avlgnsa koder fr frgade flt och pilar" 1 
menuText W PgnColor "Frger" 0
menuText W PgnColorHeader "Huvud..." 0
menuText W PgnColorAnno "Noteringar..." 0
menuText W PgnColorComments "Kommentarer..." 0
menuText W PgnColorVars "Varianter..." 0
menuText W PgnColorBackground "Bakgrund..." 0
menuText W PgnHelp "Hjlp" 0
menuText W PgnHelpPgn "PGN hjlp" 0
menuText W PgnHelpIndex "Index" 0

# Crosstable window menus:
menuText W CrosstabFile "Fil" 0
menuText W CrosstabFileText "Skriv ut till textfil..." 9
menuText W CrosstabFileHtml "Skriv ut till HTML-fil..." 9
menuText W CrosstabFileLaTeX "Skriv ut till LaTeX-fil..." 9
menuText W CrosstabFileClose "Stng resultattabellsfnstret" 0
menuText W CrosstabEdit "Redigera" 0
menuText W CrosstabEditEvent "Evenemang" 0
menuText W CrosstabEditSite "Plats" 0
menuText W CrosstabEditDate "Datum" 0
menuText W CrosstabOpt "Presentation" 0
menuText W CrosstabOptAll "Alla-mter-alla" 0
menuText W CrosstabOptSwiss "Schweizer" 0
menuText W CrosstabOptKnockout "Knock Out" 0
menuText W CrosstabOptAuto "Auto" 1
menuText W CrosstabOptAges "lder i r" 8
menuText W CrosstabOptNats "Nationalitet" 0
menuText W CrosstabOptRatings "Ranking" 0
menuText W CrosstabOptTitles "Titlar" 0
menuText W CrosstabOptBreaks "Tie-break pong" 4
menuText W CrosstabOptDeleted "Inkludera raderade partier" 8 
menuText W CrosstabOptColors "Frg (endast Schweizer)" 0
menuText W CrosstabOptColumnNumbers "Numrerade kolumner (Endast alla-mot-alla)" 2 
menuText W CrosstabOptGroup "Gruppresultat" 0
menuText W CrosstabSort "Sortera" 0
menuText W CrosstabSortName "Namn" 0
menuText W CrosstabSortRating "Ranking" 0
menuText W CrosstabSortScore "Resultat" 0
menuText W CrosstabColor "Frg" 0
menuText W CrosstabColorPlain "Ren text" 0
menuText W CrosstabColorHyper "Hypertext" 0
menuText W CrosstabHelp "Hjlp" 0
menuText W CrosstabHelpCross "Hjlp fr resultattabell" 0
menuText W CrosstabHelpIndex "Hjlpindex" 0
translate W SetFilter {Bestm filter}
translate W AddToFilter {Utka filter}
translate W Swiss {Schweizer}

# Opening report window menus:
menuText W OprepFile "Fil" 0
menuText W OprepFileText "Skriv ut till textfil..." 9
menuText W OprepFileHtml "Skriv ut till HTML-fil..." 9
menuText W OprepFileLaTeX "Skriv ut till LaTeX-fil..." 9
menuText W OprepFileOptions "Alternativ..." 0
menuText W OprepFileClose "Stng rapportfnstret" 0
menuText W OprepHelp "Hjlp" 0
menuText W OprepHelpReport "Hjlp fr ppningsrapporter" 0
menuText W OprepHelpIndex "Hjlpindex" 0

# Repertoire editor:
menuText W RepFile "Fil" 0
menuText W RepFileNew "Ny" 0
menuText W RepFileOpen "ppna..." 0
menuText W RepFileSave "Spara..." 0
menuText W RepFileSaveAs "Spara som..." 5
menuText W RepFileClose "Stng fnster" 0
menuText W RepEdit "Redigera" 0
menuText W RepEditGroup "Lgg till grupp" 4
menuText W RepEditInclude "Lgg till inkluderad variant" 4
menuText W RepEditExclude "Lgg till exkluderad variant" 4
menuText W RepView "Visa" 0
menuText W RepViewExpand "Expandera alla grupper" 0
menuText W RepViewCollapse "Implodera alla grupper" 0
menuText W RepSearch "Sk" 0
menuText W RepSearchAll "Hela ppningsrepertoaren..." 0
menuText W RepSearchDisplayed "Endast visade varianter..." 0
menuText W RepHelp "Hjlp" 0
menuText W RepHelpRep "Hjlp fr spelppningsrepertoar" 0
menuText W RepHelpIndex "Hjlpindex" 0
translate W RepSearch "Sk i spelppningsrepertoar"
translate W RepIncludedLines "inkluderade varianter"
translate W RepExcludedLines "exkluderade varianter"
translate W RepCloseDialog {Du har osparade ndringar i repertoaren.

Vill du verkligen fortstta och frlora dina frndringar?
}

# Header search:
translate W HeaderSearch {Sk i partihuvud}
translate W GamesWithNoECO {Partier utan ECO kod?}
translate W GameLength {Partilngd}
translate W FindGamesWith {Hitta flaggade partier}
translate W StdStart {Normal utgngsstllning}
translate W Promotions {Frvandlingar}
translate W Comments {Kommentarer}
translate W Variations {Varianter}
translate W Annotations {Noteringar}
translate W DeleteFlag {Raderingsflagga}
translate W WhiteOpFlag {Vits ppning}
translate W BlackOpFlag {Svarts ppning}
translate W MiddlegameFlag {Mittspel}
translate W EndgameFlag {Slutspel}
translate W NoveltyFlag {Nyhet}
translate W PawnFlag {Bondestruktur}
translate W TacticsFlag {Taktiska stllningar}
translate W QsideFlag {Damflygelsinitiativ}
translate W KsideFlag {Kungsflygelsinitiativ}
translate W BrilliancyFlag {Utmrkt parti}
translate W BlunderFlag {Bortsttningar}
translate W UserFlag {Anvndare}
translate W PgnContains {PGN innehller text}

# Game list window:
translate W GlistNumber {Nummer}
translate W GlistWhite {Vit}
translate W GlistBlack {Svart}
translate W GlistWElo {Elo, v}
translate W GlistBElo {Elo, sv}
translate W GlistEvent {Evenemang}
translate W GlistSite {Plats}
translate W GlistRound {Rond}
translate W GlistDate {Datum}
translate W GlistYear {r}
translate W GlistEDate {Startdatum}
translate W GlistResult {Resultat}
translate W GlistLength {Lngd}
translate W GlistCountry {Land}
translate W GlistECO {ECO}
translate W GlistOpening {ppning}
translate W GlistEndMaterial {Slutmaterial}
translate W GlistDeleted {Raderad}
translate W GlistFlags {Flaggor}
translate W GlistVars {Varianter}
translate W GlistComments {Kommentarer}
translate W GlistAnnos {Noteringar}
translate W GlistStart {Start}
translate W GlistGameNumber {Partinummer}
translate W GlistFindText {Sk text}
translate W GlistMoveField {Drag}
translate W GlistEditField {Konfiguration}
translate W GlistAddField {Lgg till}
translate W GlistDeleteField {Ta bort}
translate W GlistWidth {Bredd}
translate W GlistAlign {Justering}
translate W GlistColor {Frg}
translate W GlistSep {Separator}

# Maintenance window:
translate W DatabaseName {Databasnamn:}
translate W TypeIcon {Ikontyp:}
translate W NumOfGames {Partier:}
translate W NumDeletedGames {Raderade partier:}
translate W NumFilterGames {Partier i filter:}
translate W YearRange {Tidsperiod:}
translate W RatingRange {Rankingintervall:}
translate W Flag {Flagga}
translate W DeleteCurrent {Radera aktuellt parti}
translate W DeleteFilter {Radera partierna i filteret}
translate W DeleteAll {Radera alla partier}
translate W UndeleteCurrent {terta aktuellt parti}
translate W UndeleteFilter {terta partierna i filtret}
translate W UndeleteAll {terta alla partier}
translate W DeleteTwins {Radera dubbletter}
translate W MarkCurrent {Markera aktuellt parti}
translate W MarkFilter {Markera partierna i filtret}
translate W MarkAll {Markera alla partier}
translate W UnmarkCurrent {Avmarkera aktuellt parti}
translate W UnmarkFilter {Avmarkera partierna i filtret}
translate W UnmarkAll {Avmarkera alla partier}
translate W Spellchecking {Rttstava}
translate W Players {Spelare}
translate W Events {Evenmang}
translate W Sites {Platser}
translate W Rounds {Ronder}
translate W DatabaseOps {Databashantering}
translate W ReclassifyGames {ECO-klassificera partier}
translate W CompactDatabase {Komprimera databasen}
translate W SortDatabase {Sortera databasen}
translate W AddEloRatings {Lgg till Elo ranking}
translate W AutoloadGame {Ladda partinummer automatiskt}
translate W StripTags {Strip PGN tags} ;# ***
translate W StripTag {Strip tag} ;# ***
translate W Cleaner {Snygga till databasen}
translate W CleanerHelp {
Databasstdaren i Scid genomfr allt det underhll av databasen du kan vlja nedan p den aktiva databasen.

De nuvarande instllningarna i ECO-klassificering och Radera dubbletter kommer att appliceras om du vljer dessa tgrder.
}
translate W CleanerConfirm {
Nr du vl startat Databasstdaren kan du inte avbryta den!

P en stor databas kan detta ta ett bra tag. Tidstgngen beror p valda tgrder och deras instllningar.

r du sker p att du vill pbrja databasunderhllet nu?
}

# Comment editor:
translate W AnnotationSymbols  {Symboler:}
translate W Comment {Kommentar:}

# Board search:
translate W BoardSearch {Positionsskningar}
translate W FilterOperation {Hantering av aktuellt filter:}
translate W FilterAnd {AND (Restriktivt filter)}
translate W FilterOr {OR (Ackumulativt filter)}
translate W FilterIgnore {IGNORE (Anvnd ej filter)}
translate W SearchType {Sktyp:}
translate W SearchBoardExact {Exakt position (alla pjser p samma rutor)}
translate W SearchBoardPawns {Bnder (samma material, alla bnder p samma rutor)}
translate W SearchBoardFiles {Filer (samma material, alla bnder p samma filer)}
translate W SearchBoardAny {Obestmt (samma material, bnder och pjser p valfria rutor)}
translate W LookInVars {Sk i varianter}

# Material search:
translate W MaterialSearch {Materialskning}
translate W Material {Material}
translate W Patterns {Stllningar}
translate W Zero {Inga/-en}
translate W Any {Flera}
translate W CurrentBoard {Aktuell stllning}
translate W CommonEndings {Vanliga slutspel}
translate W CommonPatterns {Vanliga stllningar}
translate W MaterialDiff {Skillnad i material}
translate W squares {flt}
translate W SameColor {Samma frg}
translate W OppColor {Motsatt frg}
translate W Either {Antingen eller}
translate W MoveNumberRange {Dragintervall}
translate W MatchForAtLeast {Trffa minst}
translate W HalfMoves {halvdrag}

# Game saving:
translate W Today {Idag}
translate W ClassifyGame {Klassificera parti}

# Setup position:
translate W EmptyBoard {Tm brdet}
translate W InitialBoard {Utgngsstllning}
translate W SideToMove {Frg vid draget}
translate W MoveNumber {Antal drag}
translate W Castling {Rockad}
translate W EnPassentFile {En Passent fil}
translate W ClearFen {Rensa FEN}
translate W PasteFen {Klistra in FEN}

# Replace move dialog:
translate W ReplaceMove {Erstt drag}
translate W AddNewVar {Lgg till ny variant}
translate W ReplaceMoveMessage {Det finns redan ett drag i denna stllning.

Du kan erstta detta drag, och frlora samtliga fljande, eller lgga till ditt drag som en ny variant.

(Om du stnger av "Frga fre erstt drag" i Alternativ:Drag menyn slipper du denna frga i framtiden.)}

# Make database read-only dialog:
translate W ReadOnlyDialog {Om du ger denna databas endast lsbar kan du inte gra ngra ndringar i den.
Inga partier kan sparas eller ersttas, och du kan inte ndra flaggor fr raderbara partier.
Alla sorteringsinstllningar eller ECO-klassificeringar kommer att vara temporra.

Du kan gra den skrivbar igen genom att helt enkelt stnga och ppna den igen.

Vill du verkligen ange att databasen endast ska vara lsbar?}

# Clear game dialog:
translate W ClearGameDialog {Detta parti har ndrats.

Vill du verkligen fortstta och frlora ndringarna?
}

# Exit dialog:
translate W ExitDialog {Vill du verkligen avsluta Scid?}
translate W ExitUnsaved {De fljande databaserna har osparade frndringar. Om du avslutar nu, kommer dessa frndringar att g frlorade.} 

# Import window:
translate W PasteCurrentGame {Klistra in aktuellt parti}
translate W ImportHelp1 {Ange eller klistra in ett parti i PGN-format i omrdet ovan.}
translate W ImportHelp2 {Eventuella felaktigheter kommer att anges hr.}

# ECO Browser:
translate W ECOAllSections {alla ECO avdelningar}
translate W ECOSection {ECO avdelning}
translate W ECOSummary {Sammanfattning fr}
translate W ECOFrequency {Underkodsfrekvens fr}

# Opening Report:
translate W OprepTitle {ppningsrapport}
translate W OprepReport {Rapport}
translate W OprepGenerated {Skapad av}
translate W OprepStatsHist {Statistik och historik}
translate W OprepStats {Statistik}
translate W OprepStatAll {Rapporterade partier}
translate W OprepStatBoth {Bda med ranking}
translate W OprepStatSince {Sedan}
translate W OprepOldest {De ldsta partierna}
translate W OprepNewest {De yngsta partierna}
translate W OprepPopular {Aktuell popularitet}
translate W OprepFreqAll {Frekvens totalt:   }
translate W OprepFreq1   {Under det senaste ret: }
translate W OprepFreq5   {Under de 5 senaste ren: }
translate W OprepFreq10  {Under de 10 senaste ren: }
translate W OprepEvery {en gng var %u parti}
translate W OprepUp {kat %u%s gentemot samtliga r}
translate W OprepDown {minskat %u%s gentemot samtlliga r}
translate W OprepSame {ingen frndring gentemot samtliga r}
translate W OprepMostFrequent {Spelas mest av}
translate W OprepRatingsPerf {Ranking och resultat}
translate W OprepAvgPerf {Genomsnittranking och resultat}
translate W OprepWRating {Vits ranking}
translate W OprepBRating {Svarts ranking}
translate W OprepWPerf {Vits resultat}
translate W OprepBPerf {Svarts resultat}
translate W OprepHighRating {Partierna med hgst genomsnittranking}
translate W OprepTrends {Resultattrender}
translate W OprepResults {Lngd och frekvens}
translate W OprepLength {Partiets lngd}
translate W OprepFrequency {Frekvens}
translate W OprepWWins {Vita vinster: }
translate W OprepBWins {Svarta vinster: }
translate W OprepDraws {Remier:      }
translate W OprepWholeDB {hela databasen}
translate W OprepShortest {Kortaste vinster}
# translate W OprepShortWhite {De kortaste vita vinsterna}
# translate W OprepShortBlack {De kortaste svarta vinsterna}
translate W OprepMovesThemes {Drag och teman}
translate W OprepMoveOrders {Dragordning fr att n rapportstllningen}
translate W OprepMoveOrdersOne \
  {Stllningen nddes bara genom en dragordning:}
translate W OprepMoveOrdersAll \
  {Det fanns %u dragordningar som ledde fram denna stllning:}
translate W OprepMoveOrdersMany \
  {Det fanns %u dragordningar som ledde fram denna stllning. De %u vanligaste r:}
translate W OprepMovesFrom {Drag frn rapportstllningen}
translate W OprepThemes {Positionella teman}
translate W OprepThemeDescription {Antal teman vid drag %u}
translate W OprepThemeSameCastling {Rockad p samma flygel}
translate W OprepThemeOppCastling {Rockad p olika flyglar}
translate W OprepThemeNoCastling {Ingen har gjort rockad}
translate W OprepThemeKPawnStorm {Bondestorm p kungsflygeln}
translate W OprepThemeQueenswap {Dambyte}
translate W OprepThemeIQP {Isolerad dambonde}
translate W OprepThemeWP567 {Vita bonde p 5/6/7e raden}
translate W OprepThemeBP234 {Svart bonde p 2/3/4e raden}
translate W OprepThemeOpenCDE {ppen c/d/e linje}
translate W OprepTheme1BishopPair {Endast den ena sidan har lparparet}
translate W OprepEndgames {Slutspel}
translate W OprepReportGames {Antal partier i rapporten}
translate W OprepAllGames    {Samtliga partier}
translate W OprepEndClass {Material i slutstllningen}
translate W OprepTheoryTable {Teorisammanstllning}
translate W OprepTableComment {Skapad frn de %u hgst rankade partierna.}
translate W OprepExtraMoves {Ytterligare antal drag i notfrteckningen}
translate W OprepMaxGames {Maximalt antal partier i sammanstllningen}

# Piece Tracker window:
translate W TrackerSelectSingle {Vnsterklicka fr att vlja denna pjs.} 
translate W TrackerSelectPair {Vnsterklicka fr att vlja denna pjs; anvnd hger musknapp fr att ocks vlja den relatede pjsen.}
translate W TrackerSelectPawn {Vnsterklicka fr att vlja denna pjs; anvnd hger musknapp fr att vlja alla 8 bnder.}
translate W TrackerStat {Statistik}
translate W TrackerGames {% partier med drag till rutan}
translate W TrackerTime {% tid p varje ruta}
translate W TrackerMoves {Drag}
translate W TrackerMovesStart {Ange vid vilket drag skningen ska brja.}
translate W TrackerMovesStop {Ange vid vilket drag skningen ska sluta.}

# Game selection dialogs:
translate W SelectAllGames {Alla partier i databasen}
translate W SelectFilterGames {Endast partierna i filtret}
translate W SelectTournamentGames {Endast partierna i den aktuella turneringen}
translate W SelectOlderGames {Endast ldre partier}

# Delete Twins window:
translate W TwinsNote {Partier mste minst ha samma spelare fr att kunna identifieras som dubbletter samt uppfylla andra kriterier du kan ange nedan. Nr dubbletter hittas raderas det kortare partiet.
Tips: det bsta r att anvnda rttstavningen innan dubblettjmfrelsen eftersom detta frbttrar mjligheten fr upptckt av dubbletter.}
translate W TwinsCriteria {Kriterium: Dubbletter mste ha...}
translate W TwinsWhich {Ange vilka partier som ska jmfras}
translate W TwinsColors {Samma frger?}
translate W TwinsEvent {Samma evenemang?}
translate W TwinsSite {Samma plats?}
translate W TwinsRound {Samma rond?}
translate W TwinsYear {Samma r?}
translate W TwinsMonth {Samma mnad?}
translate W TwinsDay {Samma dag?}
translate W TwinsResult {Samma resultat?}
translate W TwinsECO {SammaECO kod?}
translate W TwinsMoves {Samma drag?}
translate W TwinsPlayers {Jmfr spelarnas namn:}
translate W TwinsPlayersExact {Exakt kopia}
translate W TwinsPlayersPrefix {Endast de 4 frsta bokstverna}
translate W TwinsWhen {Nr dubbletter raderas}
translate W TwinsSkipShort {Ignorera alla partier som r kortare n 5 drag?}
translate W TwinsUndelete {terta alla partier frst?}
translate W TwinsSetFilter {Filtrera alla raderade dubbletter?}
translate W TwinsComments {Spara alltid partier med kommentarer?}
translate W TwinsVars {Spara alltid partier med varianter?}
translate W TwinsDeleteWhich {Ange vilket parti som ska raderas:} 
translate W TwinsDeleteShorter {Det kortare pariet} 
translate W TwinsDeleteOlder {Partiet med lgst nummer} 
translate W TwinsDeleteNewer {Partiet med hgst nummer} 
translate W TwinsDelete {Radera partier}

# Name editor window:
translate W NameEditType {Typ av namn att redigera}
translate W NameEditSelect {Partier att redigera}
translate W NameEditReplace {Erstt}
translate W NameEditWith {med}
translate W NameEditMatches {Matchar: Tryck Ctrl+1 till Ctrl+9 fr att vlja}

# Classify window:
translate W Classify {Klassificera}
translate W ClassifyWhich {ECO-klassificera vilka partier}
translate W ClassifyAll {Alla partier (skriv ver gamla ECO koder)}
translate W ClassifyYear {Alla partier spelade under det senaste ret}
translate W ClassifyMonth {Alla partier spelade den senaste mnaden}
translate W ClassifyNew {Endast partier som nnu ej klassificerats}
translate W ClassifyCodes {ECO koder som ska anvndas}
translate W ClassifyBasic {Enbart standardkoder ("B12", ...)}
translate W ClassifyExtended {Scid extensioner ("B12j", ...)}

# Compaction:
translate W NameFile {Namnfil}
translate W GameFile {Partifil}
translate W Names {Namn}
translate W Unused {Ej anvnd}
translate W SizeKb {Storlek (kb)}
translate W CurrentState {Aktuell status}
translate W AfterCompaction {Efter komprimering}
translate W CompactNames {Namn, komprimera namnfil}
translate W CompactGames {Partier, komprimera partifil}

# Sorting:
translate W SortCriteria {Kriterium}
translate W AddCriteria {Lgg till kriterium}
translate W CommonSorts {Normal sortering}
translate W Sort {Sortering}

# Exporting:
translate W AddToExistingFile {Lgg till partier till en existerande fil?}
translate W ExportComments {Exportera kommentarer?}
translate W ExportVariations {Exportera varianter?}
translate W IndentComments {Dra in kommentarer?}
translate W IndentVariations {Dra in varianter?}
translate W ExportColumnStyle {Kolumnstil (ett drag per rad)?}
translate W ExportSymbolStyle {Symbolbaserade kommentarer:}
translate W ExportStripMarks {Avlgsna koder fr flt och pilar frn kommentarerna?} 

# Goto game/move dialogs:
translate W LoadGameNumber {Ange partiets nummer:}
translate W GotoMoveNumber {G till drag nummer:}

# Copy games dialog:
translate W CopyGames {kopiera partier}
translate W CopyConfirm {
 Vill du verkligen kopiera
 de [thousands $nGamesToCopy] filtrerade partierna
 ur databasen "$fromName"
 till databasen "$targetName"?
}
translate W CopyErr {Kan ej kopiera partier}
translate W CopyErrSource {klldatabasen}
translate W CopyErrTarget {mldatabasen}
translate W CopyErrNoGames {har inga partier i filtret}
translate W CopyErrReadOnly {kan bara lsas}
translate W CopyErrNotOpen {r ej ppen}

# Colors:
translate W LightSquares {Ljusa flt}
translate W DarkSquares {Mrka flt}
translate W SelectedSquares {Valda flt}
translate W SuggestedSquares {Freslagna flt}
translate W WhitePieces {Vita pjser}
translate W BlackPieces {Svarta pjser}
translate W WhiteBorder {Vit kantlinje}
translate W BlackBorder {Svart kantlinje}

# Novelty window:
translate W FindNovelty {Hitta nyhet}
translate W Novelty {Nyhet}
translate W NoveltyInterrupt {Nyhetsskningen avbrts}
translate W NoveltyNone {Inga nyheter hittades i detta parti}
translate W NoveltyHelp {
Scid kommer att frska hitta det frsta draget som leder till en position som inte annars finns i denna databas eller i spelppingsboken baserad p ECO.
}

# Upgrading databases:
translate W Upgrading {Uppdaterar}
translate W ConfirmOpenNew {
Denna databas r i ett gammal format (Scid 2) och kan inte ppnas i Scid 3, men en databas i det nya formatet (Scid 3) har redan skapats.

Vill du ppna den senare databasen istllet?
}
translate W ConfirmUpgrade {
Denna databas r i ett gammal format (Scid 2). En databas i det nyare formatet mste skapas innan den kan anvndas i Scid 3.

Genom att uppdatera skapas en databas i det nya formatet med samma innehll; uppdateringen ndrar ingenting i den gamla databasen.

Detta kan ta ett tag men behver bara gras en gng. Om du tycker det tar alltfr lng tid kan du avbryta processen.

Vill du uppdatera denna databas nu?
}

# Recent files options:
translate W RecentFilesMenu {Number of recent files in File menu} ;# ***
translate W RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}


#
##
### Start Swedish tip set
##
#
set tips(W) {
  {
    Scid har ver 30 <a Index>hjlpsidor</a>, och i de flesta fnster kan du
    genom att trycka <b>F1</b> f hjlp om det fnster du fr tillfllet har
    aktivt.
  }
  {
    Vissa fnster (t ex partiinformation och <a Switcher>databasvljaren</a>) 
    har en meny fr hger musknapp. Prova att hgerklicka i varje fnster s
    fr du vilka som har det och vilka funktioner du kommer t den vgen.
  }
  {
    Du kan ange drag p mer n ett stt, s du kan vlja vilket som passar dig
    bst. Du kan anvnda musen (med eller utan dragfrslag) eller tangentbordet
    (med eller utan autokomplettering). Ls hjlpsidan fr 
    <a Moves>att ange drag</a> fr mer information.
  }
  {
    Om du har databaser du ofta ppnar s kan du lgga till ett 
    <a Bookmarks>bokmrke</a> fr varje databas. Du kommer d att kunna ppna 
    databaserna snabbare via bokmrkesmenyn.
  }
  {
    Du kan se alla drag i det aktuella partiet (inklusive varianter och kommentarer)
    genom att ppna <a PGN>PGN-fnstret</a>.
    Du navigerar igenom partiet i PGN-fnstret genom att klicka p valfritt drag med
    vnster musknapp. Genom att klicka p draget med mellan- eller hgermusknapp s
    fr du en frhandsvisning av just den stllningen.
  }
  {
    Du kan kopiera partier mellan databaserna i <a Switcher>databasvljaren</a> genom
    att dra-och-slppa dem mellan respektive databas.
  }
  {
    Scid kan ppna PGN filer, ven de som r komprimerade med Gzip (dvs har en .gz filndelse). 
    PGN filer ppnas med enbart lsrttigheter, s om du vill redigera en PGN fil i Scid 
    mste du kopiera filen till en Scid databas med hjlp av <a Switcher>databasvljaren</a>.
  }
  {
    Om du ofta anvnder <a Tree>Trdfnstret</a> med stora databaser, r det vrt att vlja
    <b>Fyll cache fil</b> frn Arkivmenyn i Trdfnstret. Detta innebr att trdstatistik fr 
    mnga av de vanligare stllningarna sparas, vilket ger en snabbare trdtkomst fr databasen
    ifrga.
  }
  {
    <a Tree>Trdfnstret</a> kan visa alla drag frn den aktuella stllningen. Men om ocks vill 
    se alla dragfljder som har lett till denna stllning kan du f fram det genom att skapa en
   <a OpReport>ppningsrapport</a>.
  }
  {
    Du kan vnster- eller hgerklicka i en kolumn i <a GameList>partilistan</a> fr att ndra 
    dess bredd.
  }
  {
    Med <a PInfo>spelarinformationen</a> aktuell (klicka p endera spelarens namn under brdet i 
    huvudfnstret fr att f fram den) r det enkelt att <a Searches Filter>filtrera</a> fram partier
    av en srskild spelares enskilda resultat. Klicka bara p valfritt vrde som har angivits med
    <red>rd text</red>.
  }
  {
    Nr du studerar ppningar kan det vara en pong att markera valen <b>Bnder</b> eller <b>Filer</b> i 
    <a Searches Board>Sk aktuell position</a>. Genom dessa val kan du hitta andra ppningar som ger
    liknande bondestrukturer.
  }
  {
    Du kan hgerklicka i partiinformationsdelen av huvudfnstret (under brdet) fr att f fram en 
    kontextmeny. Du kan t ex gra s att Scid dljer nsta drag i ett parti, vilket kan vara anvndbart 
    om du vill trna genom att "gissa" nsta drag.
  }
  {
    Om du ofta <a Maintenance>underhller</a> stora databaser kan du utfra flera underhllsuppgifter 
    vid samma tillflle via <a Maintenance Cleaner>databasverktyget</a>.
  }
  {
    Om du har en stor databas dr de flesta partierna har ett evenmangsdatum och du vill ha partierna i 
    datumordning br du vervga att <a Sorting>sortera</a> den p evenemangsdatum i frsta hand och 
    evenmang i andra hand, istllet fr datum och evenemang, d detta kommer att hlla turneringspartierna
    frn olika datum samman. Under frutsttning att alla partier har samma evenemangsdatum naturligtvis).
    Alternativt kan du se till att flten evenemang, rond och datum r s enhetliga och korrekta som mjligt.
    (ms).
  }
  {
    Det kan vara en bra ide att <a Maintenance Spellcheck>stavningskontrollera</a> din databas innan du 
    <a Maintenance Twins>raderar dubbletter</a> d Scid har strre mjlighet att hitta dubbletterna och 
    markera dessa fr borttagning.
  }
  {
    <a Flags>Flaggor</a> r anvndbara fr att markera upp partier med karaktristika du vill ska p senare,
    ssom bondestllning, taktiska finesser, osv. Du kan ska p flaggor nr du sker p flt i partihuvudet.
  }
  {
    Om du gr igenom ett parti, och helt enkelt vill testa en ny variant utan att frndra partiet i sig, kan 
    du sl p Frskslget (Trial mode) genom att trycka <b>Ctrl+space</b> eller frn verktygsraden. terg till
    ursprungspartiet nr du r klar.
  }
  {
    Om du vill hitta det mest betydelsefulla partiet (med hgst rankade spelare) i en viss position kan du
    ppna <a Tree>Trdfnstret</a> och i denna ppna listan med de bsta partierna. I trdfnstret kan du till
    och med begrnsa partierna till endast ett srskilt resultat.
  }
  {
    Ett bra stt att studera en ppning r att i en stor databas sl p trningslget i <a Tree>Trdfnstret</a>, 
    och sedan spela igenom databasen fr att se vilka varianter som frekommer oftast.
  }
  {
    Om du har tv databaser ppna, och vill ha ett varianttrd att studera medan du gr igenom ett parti
    i den andra databasen kan du <b>lsa</b> trdet i den databasen och sedan byta till den andra.
  }
  {
    <a Tmt>Turneringsskaren (tournament finder)</a> r inte bara anvndbar fr att lokalisera en srskild 
    turnering. Du kan ocks anvnda den fr att ska efter turneringar en specifik spelare nyligen deltagit 
    i, eller att blddra genom turneringar som genomfrts i ett visst land.
  }
  {
    Det finns ett antal vanliga stllningstyper definierade i <a Searches Material>Sk material/stllning</a>
    fnstret som du kan ha nytta av nr du studerar ppningar och mittspel.
  }
  {
    Nr du sker p <a Searches Material>material eller stllning</a> kan det ofta vara frdelaktigt att begrnsa
    skningen till sdana partier dr stllningen eller materialet frekommit i tminstone ngra drag. Du slipper
    du f med trffar dr situationen du sker uppkom helt tillflligt.
  }
  {
    Om du har en viktig databas du inte vill radera av misstag kan du vlja  <b>Enbart lsbar</b> frn <b>Arkiv</b>
    menyn efter att du har ppnat den. Alternativt kan du stta dess filrttigheter till enbart lsrttigheter.
  }
  {
    Om du anvnder XBoard eller WinBoard (eller ngot annat program som kan hantera FEN notation via urklippshanteraren)
    och vill kopiera den aktuella stllningen frn ditt program r det snabbaste sttet att gra det s hr:
    Vlj <b>Copy Position</b> frn <b>File</b> menyn i Xboard/Winboard, vlj sedan <b>Klistra in utgngsstllning</b>
    i Redigera menyn i Scid.
  }
  {
    I <a Searches Header>Sk i huvud</a>, r spelare-, evenemang-, plats-, och rondnamn oknsliga fr stora eller sm
    bokstver och ger trffar varhelst de finns i ett namn. Om du vill kan du ange att du istllet vill att skningen <b>ska</b>
    ta kapitler/gemener i beaktande. Genom att anvnda jokertecken inom citationstecken (dr "?" = motsvarar obestmt
    enskilt tecken och "*" = noll eller flera tecken). Om du exempelvis anger "*BEL" (med citationstecken) i det platsfltet
    hittar du alla partier spelade i Belgien, men exkluderar de som spelats i Belgrad.
  }
  {
    Om du vill redigera ett drag i ett parti utan att frlora alla de drag som spelats efter detta kan du ppna
    <a Import>Importera ett parti i PGN-format</a> fnstret i Verktygsmenyn. Klicka dr p <b>Klistra in aktuellt parti</b> 
    , redigera partiet och avsluta med <b>Importera</b>.
  }
  {
    Om du har en ECO klassificeringsfil laddad, kan du n den mest esakt klassificerade stllningen fr det aktuella partiet
    genom att vlja <b>Identifiera ppning</b> i <b>Partier</b> menyn (genvg: Ctrl+Shift+D).
  }
  {
    Nr du vill se hur stor en fil r, eller vill se nr den senast redigerades innan du ppnar den kan du anvnda
    <a Finder>file finder</a> (Arkiv - Sk filer).
  }
  {
    En <a Repertoire>repertoirefil</a> r ett utmrkt stt att hlla koll p dina favoritppningar, eller hitta partier dr
    dr de har spelats. Nr du vl har skapat en repertoirefil kan du genomska nya filer utifrn repertoirefilen, och titta 
    igenom alla partier med just dina ppningar.
  }
  {
    Genom att skapa en <a OpReport>ppningsrapport</a> har du en utmrk mjlighet att lra dig en ny spelppning. Du kan f
    information om resultat, hur remiaktig den r, vilka vanliga positionella teman som dyker upp, och mycket mer.
  }
  {
    Du kan kommentera den aktuella stllningen med de vanligaste symbolerna (!, !?, +=, etc) utan att behva anvnda 
    <a Comment>kommentarseditorn<a>. Dr du exempelvis vill ange ett bra drag skriver du "!" och trycker sedan ENTER
    s lggs "!" symbolen till draget. Se ven hjlpsidan <a Moves>ange drag</a> fr mer detaljerad information.
  }
  {
    Om du blddrar igenom ppningarna i en databas i <a Tree>trdfnstret</a>, fr du en anvndbar verblick ver hur
    vl ppningen fungerar i sentida partier mellan hgrankade spelare om du ppnar statistikfnstret (genvg: Ctrl+I).
  }
  {
    Du ndrar enkelt huvudfnstrets brdstorlek genom att hlla nere <b>Ctrl</b> och <b>Shift</b> tangenterna, samtidigt
    som du trycker hger- eller vnster piltangent.
  }
  {
    Efter genomfrd <a Searches>skning</a>, r det enkelt att navigera genom urvalet genom att hlla nere <b>Ctrl</b> 
    tangenten samtidigt som du trycker upp- eller nerpiltangenterna fr att g till fregende eller nsta parti i 
    <a Searches Filter>urvalet</a>.
  }
}
# end of swedish.tcl

# norsk.tcl
# Text for menu names and status bar help messages in Norwegian.
# First created for Scid 3.2.beta2 by morten.skarstad@sapphire.no.
# Edited for Scid 3.2.beta4
# Thanks to Martin Skjldebrand, swedish.tcl was of great help to me.

addLanguage O Norsk 1

proc setLanguage_O {} {

# File menu:
menuText O File "Fil" 0
menuText O FileNew "Ny..." 0 {Lag en ny Scid-database}
menuText O FileOpen "pne..." 0 {pne en Scid-database}
menuText O FileClose "Lukk" 0 {Lukk aktiv Scid-database}
menuText O FileFinder "Sk" 0 {pne skevinduet}
menuText O FileBookmarks "Bokmerker" 0 {Bokmerkemeny (snarvei: Ctrl+B)}
menuText O FileBookmarksAdd "Legg til bokmerke" 0 \
  {Sett bokmerke til nvrende database, parti og stilling}
menuText O FileBookmarksFile "Lagre bokmerke" 0 \
  {Lagre et bokmerke for nvrende database, parti og stilling}
menuText O FileBookmarksEdit "Ordne bokmerker" 0 \
  {Vedlikehold av bokmerkene}
menuText O FileBookmarksList "Vis kataloger som enkel liste" 24 \
  {Vis bokmerker som liste, ikke undermenyer}
menuText O FileBookmarksSub "Vis kataloger som undermenyer" 18 \
  {Vis bokmerke-katalogene som undermenyer, ikke liste}
menuText O FileMaint "Vedlikehold" 0 {Verkty for  vedlikeholde Scid-databasen}
menuText O FileMaintWin "Vedlikeholdsvindu" 0 \
  {pne/lukk Scids vedlikeholdsvindu}
menuText O FileMaintCompact "Komprimer database..." 0 \
  {Sletter ubrukte partier og navn}
menuText O FileMaintClass "ECO-klassifiser partier..." 0 \
  {Regn om ECO-koden for alle partier}
menuText O FileMaintSort "Sorter database..." 0 \
  {Sorter alle partier i databasen}
menuText O FileMaintDelete "Slett duplikater..." 6 \
  {Finner like partier og merker en av dem for sletting}
menuText O FileMaintTwin "Duplikatsjekkvindu" 1 \
  {pne/oppdatere duplikatsjekkvinduet}
menuText O FileMaintName "Navnestaving" 0 {Redigering og stavekontroll av navn}
menuText O FileMaintNameEditor "Navneredigering" 5 \
  {pne/lukk vinduet for navneredigering}
menuText O FileMaintNamePlayer "Kontroller navn..." 0 \
  {Sammenlign navn med stavekontroll-filen}
menuText O FileMaintNameEvent "Kontroller anledninger..." 11 \
  {Sammenlign anledninger med stavekontroll-filen}
menuText O FileMaintNameSite "Kontroller stedsnavn..." 12 \
  {Sammenlign stedsnavn med stavekontroll-filen}
menuText O FileMaintNameRound "Kontroller runde-navn..." 11 \
  {Sammenlign rundenavn med stavekontroll-filen}
menuText O FileReadOnly "Skrivebeskytt..." 6 \
  {Hindrer endringer p databasen}
menuText O FileExit "Avslutt" 0 {Avslutt Scid}

# Edit menu:
menuText O Edit "Rediger" 0
menuText O EditAdd "Legg til variasjon" 0 {Legg til en variasjon av dette trekket i partiet}
menuText O EditDelete "Slett variasjon" 0 {Slett en variasjon av dette trekket}
menuText O EditFirst "Flytt variasjon verst" 0 \
  {Gjr variasjonen til den verste p listen}
menuText O EditMain "Gjr variasjon til hovedlinje" 0 \
  {Gjr variasjon til hovedlinje}
menuText O EditTrial "Prv variasjon" 0 \
  {Start/avslutt prvemodus, for  teste ut en ide p brettet}
menuText O EditStrip "Fjern" 0 {Fjern kommentarer eller variasjoner fra partiet}
menuText O EditStripComments "Kommentarer" 0 \
  {Fjern alle kommentarer og annotasjoner fra dette partiet}
menuText O EditStripVars "Variasjoner" 0 {Fjern alle variasjoner fra dette partiet}
menuText O EditReset "Rensk utklippsbase" 0 \
  {Tmmer utklippsbasen fullstendig}
menuText O EditCopy "Kopier partiet til utklippsbasen" 0 \
  {Kopier dette partiet til utklippsbasen}
menuText O EditPaste "Lim inn siste parti fra utklippsbasen" 0 \
  {Limer inn gjeldende parti fra utklippsbasen her}
menuText O EditSetup "Still opp stilling..." 0 \
  {Lag en startstilling for dette partiet}
menuText O EditPasteBoard "Lim inn stilling" 0 \
  {Lag en startstilling fra gjeldende utvalg (utklippstavle)}

# Game menu:
menuText O Game "Parti" 0
menuText O GameNew "Nytt parti" 0 \
  {Sletter alle trekk og starter et nytt parti}
menuText O GameFirst "Hent frste parti" 0 {Henter frste parti fra filteret}
menuText O GamePrev "Hent forrige parti" 0 {Henter forrige parti fra filteret}
menuText O GameReload "Hent dette partiet" 0 \
  {Henter dette partiet p nytt og fjerner alle endringer}
menuText O GameNext "Hent neste parti" 0 {Henter neste parti fra filteret}
menuText O GameLast "Hent siste parti" 0 {Henter siste parti fra filteret}
menuText O GameRandom "Hent tilfeldig parti" 8 {Hent tilfeldig parti fra filteret}
menuText O GameNumber "Hent parti nummer..." 0 \
  {Finn et parti ved  angi nummeret}
menuText O GameReplace "Lagre: Erstatt parti..." 0 \
  {Lagre og overskriv dette partiet}
menuText O GameAdd "Lagre som nytt parti..." 0 \
  {Lagre dette partiet som et nytt parti}
menuText O GameDeepest "Identifiser pning" 0 \
  {G til dypeste posisjon i dette partiet listet i ECO-boken}
menuText O GameGotoMove "G til trekk..." 0 \
  {G til et angitt trekk i dette partiet}
menuText O GameNovelty "Finn avvik..." 0 \
  {Finn det frste trekket i dette partiet som ikke har blitt spilt tidligere}

# Search Menu:
menuText O Search "Sk" 0
menuText O SearchReset "Nullstill filter" 0 {Nullstill filteret til  inneholde alle partier}
menuText O SearchNegate "Snu filter" 0 {Reverserer filteret til  kun inneholde eksluderte partier}
menuText O SearchCurrent "Stilling..." 0 {Sk etter denne stillingen}
menuText O SearchHeader "Header..." 0 {Sk etter Header (partier, turnering etc) informasjon}
menuText O SearchMaterial "Kvalitet/stilling..." 0 {Sk p kvalitet eller stilling}
menuText O SearchUsing "Bruk skefil..." 0 {Sk vha lagrede skevilkr}

# Windows menu:
menuText O Windows "Vinduer" 0
menuText O WindowsComment "Kommentarer" 0 {pne/lukk kommentarvinduet}
menuText O WindowsGList "Partioversikt" 0 {pne/lukk partioversikten}
menuText O WindowsPGN "PGN-vindu" 0 \
  {pne/lukk PGN-vinduet}
menuText O WindowsTmt "Turneringsker" 0 {pne/lukk turneringsskeren}
menuText O WindowsSwitcher "Databasebytter" 0 \
  {pne/lukk databasebytteren}
menuText O WindowsMaint "Vedlikeholdsvindu" 0 \
  {pne/lukk vedlikeholdsvinduet}
menuText O WindowsECO "ECO-oversikt" 0 {pne/lukk ECO-oversikten}
menuText O WindowsRepertoire "Repertoirvindu" 0 \
  {pne/lukk pningsreportoiret}
menuText O WindowsStats "Statistikkvindu" 0 \
  {pne/lukk statistikk for filteret}
menuText O WindowsTree "Trevindu" 0 {pne/lukk trevinduet}
menuText O WindowsTB "Sluttspilltabellvindu" 0 \
  {pne/lukk sluttspilltabellen}

# Tools menu:
menuText O Tools "Verkty" 0
menuText O ToolsAnalysis "Analysemotor..." 0 \
  {Start/stopp en sjakkanalysemotor}
menuText O ToolsAnalysis2 "Analysemotor #2..." 0 \
  {Start/stopp enda en sjakkanalysemotor}
menuText O ToolsCross "Krysstabell" 0 {Vis turnerigskrystabellen for dette partiet}
menuText O ToolsEmail "Epostbehandler" 0 \
  {pne/lukk epostbehandlingsvinduet}
menuText O ToolsFilterGraph "Filtergraf" 7 \
  {pne/lukk filtergrafvinduet}
menuText O ToolsOpReport "pningsrapport" 0 \
  {Lager en pningsrapport for denne stillingen}
menuText O ToolsTracker "Brikkesporing"  0 {pne brikkesporingsvinduet}
menuText O ToolsPInfo "Spillerinformasjon"  0 \
  {pne/oppdater informasjonsvinduet for denne spilleren}
menuText O ToolsRating "Ratinggraf" 0 \
  {Tegner ratingen til disse spillerene over tid}
menuText O ToolsScore "Poeng-graf" 0 {Viser poeng-grafen}
menuText O ToolsExpCurrent "Eksporter parti" 0 \
  {Skriv dette partiet til en tekstfil}
menuText O ToolsExpCurrentPGN "Eksporter parti til PGN-fil..." 0 \
  {Skriv dette partiet til en PGN-fil}
menuText O ToolsExpCurrentHTML "Eksporter parti til HTML fil..." 0 \
  {Skriv dette partiet til en HTML-fil}
menuText O ToolsExpCurrentLaTeX "Eksporter partil til LaTeX fil..." 0 \
  {Skriv dette partiet til en LaTeX-fil}
menuText O ToolsExpFilter "Eksporter alle partier i filteret" 0 \
  {Skriv alle partier i filteret til en tekstfil}
menuText O ToolsExpFilterPGN "Eksporter filter til PGN-fil..." 0 \
  {Skriv alle partier i filteret til en PGN-fil}
menuText O ToolsExpFilterHTML "Eksporter filter til HTML-fil..." 0 \
  {Skriv alle partier i filteret til en HTML-fil}
menuText O ToolsExpFilterLaTeX "Eksporter filter til LaTeX-fil..." 0 \
  {Skriv alle partier i filteret til en LaTeX-fil}
menuText O ToolsImportOne "Importer ett PGN-parti..." 0 \
  {Importer ett parti fra en PGN-fil}
menuText O ToolsImportFile "Importer fil med PGN-partier..." 0 \
  {Importer partier fra en PGN-fil}

# Options menu:
menuText O Options "Innstillinger" 0
menuText O OptionsSize "Brettstrrelse" 0 {Endre brettstrrelse}
menuText O OptionsPieces "Brikkeutseende" 6 \
  {Endrer utseendet p brikkene}
menuText O OptionsColors "Farger..." 0 {Endre farger p brettet}
menuText O OptionsExport "Eksport" 0 {Endre innstillinger for eksport av tekst}
menuText O OptionsFonts "Skrifttyper" 0 {Endre skrifttyper}
menuText O OptionsFontsRegular "Vanlig" 0 {Endre den vanlige skrifttypen}
menuText O OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText O OptionsFontsSmall "Liten" 0 {Endre den lille skrifttypen}
menuText O OptionsFontsFixed "Fastbredde" 0 {Endre fastbreddeskrifttypen}
menuText O OptionsGInfo "Partiinformasjon" 0 {Informasjonsinnstillinger}
menuText O OptionsLanguage "Sprk" 0 {Velg menysprk}
menuText O OptionsMoves "Trekk" 0 {Innstillinger for hvordan trekk angis}
menuText O OptionsMovesAsk "Spr fr trekk erstattes" 0 \
  {Spr fr eksisterende trekk erstattes av et nytt}
menuText O OptionsMovesDelay "Autospillforsinkelse..." 0 \
  {Sett forsinkelsen ved automatisk gjennomgang av partiet}
menuText O OptionsMovesCoord "Koordinater" 0 \
  {Tillat angivelse av koordinater ("g1f3")}
menuText O OptionsMovesSuggest "Vis foresltte trekk" 0 \
  {Sl av/p forslag til trekk}
menuText O OptionsMovesKey "Autofullfr" 0 \
  {Sl av/p autofullfriring av tastaturtrekk}
menuText O OptionsNumbers "Tallformat" 0 {Angi tallformat}
menuText O OptionsStartup "Oppstart" 0 {Angi vinduer som skal pne ved oppstart}
menuText O OptionsWindows "Vinduer" 0 {Vindusinnstillinger}
menuText O OptionsWindowsIconify "Auto-minimer" 5 \
  {Minimerer alle vinduer sammen med hovedvinduet}
menuText O OptionsWindowsRaise "Autoheving" 0 \
  {Hever visse vinduer (fremdriftsvisere etc) nr de er skjult}
menuText O OptionsToolbar "Verktylinje i hovedvindu" 0 \
  {Vis/skjul menylinjen i hovedvinduet}
menuText O OptionsECO "Hent ECO-fil..." 0 {Henter filen med ECO-klassifiseringer}
menuText O OptionsSpell "Hent stavekontrollfil..." 0 \
  {Henter filen med stavekontrollen til Scid}
menuText O OptionsTable "Tabellbasekatalog..." 0 \
  {Velg en tabellbase; Alle tabellbaser i katalogen vil bli brukt}
menuText O OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText O OptionsSave "Lagre innstillinger" 0 \
  "Lagre alle instillinger til $::optionsFile"
menuText O OptionsAutoSave "Autolagre innstillinger ved avslutning" 0 \
  {Autolagre alle innstillinger nr Scid avsluttes}

# Help menu:
menuText O Help "Hjelp" 0
menuText O HelpIndex "Innhold" 0 {Hjelpesystemets innhold}
menuText O HelpGuide "Lynguide" 0 {Vis lynguiden}
menuText O HelpHints "Hint" 0 {Vis hint}
menuText O HelpContact "Kontaktinformasjon" 0 {Vis kontaktinformasjon}
menuText O HelpTip "Dagens tips" 0 {Vis et nyttig Scid-tips}
menuText O HelpStartup "Oppstartsvindu" 0 {Vis oppstartsvindu}
menuText O HelpAbout "Om Scid" 0 {Informasjon om Scid}

# Game info box popup menu:
menuText O GInfoHideNext "Skjul neste trekk" 0
menuText O GInfoMaterial "Vis kvalitet" 0
menuText O GInfoFEN "Vis FEN" 0
menuText O GInfoMarks "Vis fargede ruter og piler" 0
menuText O GInfoWrap "Tekstbryting" 0
menuText O GInfoFullComment "Vis full kommentar" 0
menuText O GInfoTBNothing "Tabellbaser: ingenting" 0
menuText O GInfoTBResult "Tabellbaser: kun resultater" 0
menuText O GInfoTBAll "Tabellbaser: resultater og beste trekk" 0
menuText O GInfoDelete "Slett/gjenopprett dette partiet" 0
menuText O GInfoMark "(Av)Merk dette partiet" 0

# Main window buttons:
helpMsg O .button.start {G til begynnelsen av partiet (tast: Home)}
helpMsg O .button.end {G til slutten av partiet (tast: End)}
helpMsg O .button.back {G ett trekk tilbake (tast: LeftArrow)}
helpMsg O .button.forward {G et trekk fremover (tast: RightArrow)}
helpMsg O .button.intoVar {G inn i en variasjon (snarvei: v)}
helpMsg O .button.exitVar {Forlat variasjon (snarvei: z)}
helpMsg O .button.flip {Roter brett (snarvei: .)}
helpMsg O .button.coords {Sl av/p brettkoordinater (snarvei: 0)}
helpMsg O .button.autoplay {Automatisk spill (tast: Ctrl+Z)}

# General buttons:
translate O Back {Tilbake}
translate O Cancel {Avbryt}
translate O Clear {Slett}
translate O Close {Lukk}
translate O Defaults {Standard}
translate O Delete {Slett}
translate O Graph {Graf}
translate O Help {Hjelp}
translate O Import {Importer}
translate O Index {Innhold}
translate O LoadGame {Hent parti}
translate O BrowseGame {Bla gjennom parti}
translate O MergeGame {Smelt parti}
translate O Preview {Forhndsvis}
translate O Revert {Gjr om}
translate O Save {Lagre}
translate O Search {Sk}
translate O Stop {Stopp}
translate O Store {Lagre}
translate O Update {Oppdater}
translate O ChangeOrient {Vend vindu}
translate O None {Ingen}
translate O First {Frste}
translate O Current {Gjeldende}
translate O Last {Siste}

# General messages:
translate O game {parti}
translate O games {partier}
translate O move {trekk}
translate O moves {trekk}
translate O all {alle}
translate O Yes {Ja}
translate O No {Nei}
translate O Both {Begge}
translate O King {Konge}
translate O Queen {Dronning}
translate O Rook {Trn}
translate O Bishop {Lper}
translate O Knight {Springer}
translate O Pawn {Bonde}
translate O White {Hvit}
translate O Black {Sort}
translate O Player {Spiller}
translate O Rating {Rating}
translate O RatingDiff {Ratingforskjell (Hvit - Sort)}
translate O Event {Anledning}
translate O Site {Sted}
translate O Country {Land}
translate O IgnoreColors {Overse farger}
translate O Date {Dato}
translate O EventDate {Anledningsdato}
translate O Decade {Decade} ;# ***
translate O Year {r}
translate O Month {Mned}
translate O Months {Januar Februar Mars April Mai Juni Juli August September Oktober November Desember}
translate O Days {Sn Man Tir Ons Tor Fre Lr}
translate O YearToToday {r til i dag}
translate O Result {Utfall}
translate O Round {Runde}
translate O Length {Lengde}
translate O ECOCode {ECO-kode}
translate O ECO {ECO}
translate O Deleted {Slettet}
translate O SearchResults {Sk i resultater}
translate O OpeningTheDatabase {pningsdatabase}
translate O Database {Database}
translate O Filter {Filter}
translate O noGames {ingen partier}
translate O allGames {alle partier}
translate O empty {tom}
translate O clipbase {utklippsbase}
translate O score {poeng}
translate O StartPos {Utgangsstilling}
translate O Total {Sammenlagt}

# Game information:
translate O twin {duplikat}
translate O deleted {slettet}
translate O comment {kommentar}
translate O hidden {skjult}
translate O LastMove {Siste trekk}
translate O NextMove {Neste}
translate O GameStart {Begynnelse p parti}
translate O LineStart {Begynnelse p linje}
translate O GameEnd {Slutt p parti}
translate O LineEnd {Slutt p linje}

# Player information:
translate O PInfoAll {Resultater for <b>alle</b> partier}
translate O PInfoFilter {Resultater for partier i <b>filteret</b>}
translate O PInfoAgainst {Resultater mot}
translate O PInfoMostWhite {Hyppigste pning som hvit}
translate O PInfoMostBlack {Hyppigste pning som sort}
translate O PInfoRating {Historisk rating}
translate O PInfoBio {Biografi}

# Tablebase information:
translate O Draw {Uavgjort}
translate O stalemate {patt}
translate O withAllMoves {med alle trekk}
translate O withAllButOneMove {med alle trekk unntatt ett}
translate O with {med}
translate O only {kun}
translate O lose {taper} ;# tap?
translate O loses {taper}
translate O allOthersLose {alle andre taper}
translate O matesIn {setter matt i}
translate O hasCheckmated {har satt matt}
translate O longest {lengste}

# Tip of the day:
translate O Tip {Tips}
translate O TipAtStartup {Tips ved oppstart}

# Tree window menus:
menuText O TreeFile "Fil" 0
menuText O TreeFileSave "Lagre hurtigbuffer" 0 {Lagrer hurtigbufferfilen (.stc)}
menuText O TreeFileFill "Fyll hurtigbuffer" 0 \
  {Fyller hurtigbufferet med de hyppigste pningsstillingene}
menuText O TreeFileBest "Idealparti" 0 {Show the best tree games list}
menuText O TreeFileGraph "Grafikk" 0 {Vis grafen for denne grenen av treet}
menuText O TreeFileCopy "Kopier treet til utklippstavlen" 0 \
  {Kopier statistikken for treet til utklippstavlen}
menuText O TreeFileClose "Lukk trevindu" 0 {Lukker trevinduet}
menuText O TreeSort "Sorter" 0
menuText O TreeSortAlpha "Alfabetisk" 0
menuText O TreeSortECO "ECO-kode" 0
menuText O TreeSortFreq "Hyppighet" 0
menuText O TreeSortScore "Poeng" 0
menuText O TreeOpt "Innstillinger" 0
menuText O TreeOptLock "Ls" 0 {Lser treet til nvrende database}
menuText O TreeOptTraining "Trening" 0 {Slr av/p treningsmodus}
menuText O TreeOptAutosave "Autolagre hurtigbuffer" 0 \
  {Autolagrer hurtigbufferet nr vinduet lukkes}
menuText O TreeHelp "Hjelp" 0
menuText O TreeHelpTree "Tre hjelp" 0
menuText O TreeHelpIndex "Innholdsfortegnelse" 0
translate O SaveCache {Lagre hurtigbuffer}
translate O Training {Trening}
translate O LockTree {Ls}
translate O TreeLocked {lst}
translate O TreeBest {Beste}
translate O TreeBestGames {Idealtrepartier}

# Finder window:
menuText O FinderFile "Fil" 0
menuText O FinderFileSubdirs "Let i underkataloger" 0
menuText O FinderFileClose "Lukk skevindu" 0
menuText O FinderSort "Sorter" 0
menuText O FinderSortType "Type" 0
menuText O FinderSortSize "Strrelse" 0
menuText O FinderSortMod "Endret" 0
menuText O FinderSortName "Navn" 0
menuText O FinderSortPath "Sti" 0
menuText O FinderTypes "Typer" 0
menuText O FinderTypesScid "Scid-databaser" 0
menuText O FinderTypesOld "Scid-databaser i gammelt format" 0
menuText O FinderTypesPGN "PGN-filer" 0
menuText O FinderTypesEPD "EPD-filer" 0
menuText O FinderTypesRep "Repertoire-filer" 0
menuText O FinderHelp "Hjelp" 0
menuText O FinderHelpFinder "Skehjelp" 0
menuText O FinderHelpIndex "Innholdsfortegnelse" 0
translate O FileFinder {Skeverkty}
translate O FinderDir {Katalog}
translate O FinderDirs {Kataloger}
translate O FinderFiles {Filer}
translate O FinderUpDir {opp}

# Tournament finder:
menuText O TmtFile "Fil" 0
menuText O TmtFileUpdate "Oppdater" 0
menuText O TmtFileClose "Lukk turneringssker" 0
menuText O TmtSort "Sorter" 0
menuText O TmtSortDate "Dato" 0
menuText O TmtSortPlayers "Players" 0
menuText O TmtSortGames "Partier" 0
menuText O TmtSortElo "Elo" 0
menuText O TmtSortSite "Sted" 0
menuText O TmtSortEvent "Anledning" 1
menuText O TmtSortWinner "Vinner" 0
translate O TmtLimit "Listegrense"
translate O TmtMeanElo "Laveste middel-ELO"
translate O TmtNone "Ingen passende turneringer funnet."

# Graph windows:
menuText O GraphFile "Fil" 0
menuText O GraphFileColor "Lagre som farget PostScript..." 0
menuText O GraphFileGrey "Lagre som grtonet PostScript..." 0
menuText O GraphFileClose "Lukk vindu" 0
menuText O GraphOptions "Innstillinger" 0
menuText O GraphOptionsWhite "Hvit" 0
menuText O GraphOptionsBlack "Sort" 0
menuText O GraphOptionsBoth "Begge" 0
menuText O GraphOptionsPInfo "Spiller Info spiller" 0
translate O GraphFilterTitle "Filtergraf: hyppighet per 1000 partier"

# Analysis window:
translate O AddVariation {Legg til variasjon}
translate O AddMove {Legg til trekk}
translate O Annotate {Annoter}
translate O AnalysisCommand {Analysekommando}
translate O PreviousChoices {Tidligere valg}
translate O AnnotateTime {Tid mellom trekk i sekunder}
translate O AnnotateWhich {Legg til variasjoner}
translate O AnnotateAll {For trekk av begge sider}
translate O AnnotateWhite {Kun for hvite trekk}
translate O AnnotateBlack {Kun for sorte trekk}
translate O AnnotateNotBest {Nr trekket avviker fra beste linje}

# Analysis Engine open dialog:
translate O EngineList {Liste over analysemotorer}
translate O EngineName {Navn}
translate O EngineCmd {Kommandolinje}
translate O EngineArgs {Parametre}
translate O EngineDir {Katalog}
translate O EngineElo {Elo}
translate O EngineTime {Dato}
translate O EngineNew {Ny}
translate O EngineEdit {Rediger}
translate O EngineRequired {Fete felter er ndvendige, de vrige er valgfrie}

# Stats window menus:
menuText O StatsFile "Fil" 0
menuText O StatsFilePrint "Skriv til fil..." 0
menuText O StatsFileClose "Lukk vindu" 0
menuText O StatsOpt "Innstillinger" 0

# PGN window menus:
menuText O PgnFile "Fil" 0
menuText O PgnFilePrint "Skriv til fil..." 0
menuText O PgnFileClose "Lukk PGN-vindu" 0
menuText O PgnOpt "Vis" 0
menuText O PgnOptColor "Vis farger" 0
menuText O PgnOptShort "Kort (3 linjer) header" 0
menuText O PgnOptSymbols "Symbolnotasjon" 0
menuText O PgnOptIndentC "Rykk inn kommentarer" 0
menuText O PgnOptIndentV "Rykk inn variasjoner" 0
menuText O PgnOptColumn "Bruk kolonner (ett trekk per linje)" 0
menuText O PgnOptSpace "Mellomrom etter trekknummer" 0
menuText O PgnOptStripMarks "Fjern fargekoder" 0
menuText O PgnColor "Farger" 0
menuText O PgnColorHeader "Header..." 0
menuText O PgnColorAnno "Annotasjoner..." 0
menuText O PgnColorComments "Kommentarer..." 0
menuText O PgnColorVars "Variasjoner..." 0
menuText O PgnColorBackground "Bakgrunn..." 0
menuText O PgnHelp "Hjelp" 0
menuText O PgnHelpPgn "PGN-hjelp" 0
menuText O PgnHelpIndex "Innholdsfortegnelse" 0

# Crosstable window menus:
menuText O CrosstabFile "Fil" 0
menuText O CrosstabFileText "Skriv til tekstfil..." 0
menuText O CrosstabFileHtml "Skriv til HTML-fil..." 0
menuText O CrosstabFileLaTeX "Skriv til LaTeX-fil..." 0
menuText O CrosstabFileClose "Lukk krysstabellvindu" 0
menuText O CrosstabEdit "Rediger" 0
menuText O CrosstabEditEvent "Anledning" 0
menuText O CrosstabEditSite "Sted" 0
menuText O CrosstabEditDate "Dato" 0
menuText O CrosstabOpt "Vis" 0
menuText O CrosstabOptAll "Alle-mot-alle" 0
menuText O CrosstabOptSwiss "Sveitsisk" 0
menuText O CrosstabOptKnockout "Kun vinnere" 0
menuText O CrosstabOptAuto "Auto" 0
menuText O CrosstabOptAges "Aldre i r" 0
menuText O CrosstabOptNats "Nasjonaliteter" 0
menuText O CrosstabOptRatings "Ratinger" 0
menuText O CrosstabOptTitles "Titler" 0
menuText O CrosstabOptBreaks "Poengfordel" 0
menuText O CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText O CrosstabOptColors "Farger (kun sveitsisk)" 0
menuText O CrosstabOptColumnNumbers "Nummererte kolonner (kun alle-mot-alle-tabeller)" 0
menuText O CrosstabOptGroup "Gruppepoeng" 0
menuText O CrosstabSort "Sorter" 0
menuText O CrosstabSortName "Navn" 0
menuText O CrosstabSortRating "Rating" 0
menuText O CrosstabSortScore "Poeng" 0
menuText O CrosstabColor "Farge" 0
menuText O CrosstabColorPlain "Ren tekst" 0
menuText O CrosstabColorHyper "Hypertekst" 0
menuText O CrosstabHelp "Hjelp" 0
menuText O CrosstabHelpCross "Krysstabell hjelp" 0
menuText O CrosstabHelpIndex "Innholdsfortegnelse" 0
translate O SetFilter {Sett filter}
translate O AddToFilter {Legg til i filter}
translate O Swiss {Sveitsisk}

# Opening report window menus:
menuText O OprepFile "Fil" 0
menuText O OprepFileText "Skriv til tekstfil..." 0
menuText O OprepFileHtml "Skriv til HTML-fil..." 0
menuText O OprepFileLaTeX "Skriv til LaTeX-fil..." 0
menuText O OprepFileOptions "Innstillinger..." 0
menuText O OprepFileClose "Lukk rapport-vindu" 0
menuText O OprepHelp "Hjelp" 0
menuText O OprepHelpReport "pningsrapport hjelp" 0
menuText O OprepHelpIndex "Innholdsfortegnelse" 0

# Repertoire editor:
menuText O RepFile "Fil" 0
menuText O RepFileNew "Ny" 0
menuText O RepFileOpen "pne..." 0
menuText O RepFileSave "Lagre..." 0
menuText O RepFileSaveAs "Lagre som..." 0
menuText O RepFileClose "Lukk vindu" 0
menuText O RepEdit "Rediger" 0
menuText O RepEditGroup "Legg til gruppe" 0
menuText O RepEditInclude "Inkluder" 0
menuText O RepEditExclude "Ekskluder" 0
menuText O RepView "Vis" 0
menuText O RepViewExpand "Utvid alle grupper" 0
menuText O RepViewCollapse "Trekk sammen alle grupper" 0
menuText O RepSearch "Sk" 0
menuText O RepSearchAll "Alle i reportoir..." 0
menuText O RepSearchDisplayed "Kun viste linjer..." 0
menuText O RepHelp "Hjelp" 0
menuText O RepHelpRep "Repertoir hjelp" 0
menuText O RepHelpIndex "Innholdsfortegnelse" 0
translate O RepSearch "Repertoirsk"
translate O RepIncludedLines "inkluderte linjer"
translate O RepExcludedLines "ekskluderte linjer"
translate O RepCloseDialog {Gjeldende reportoir har ulagrede endringer.

Vil du virkelig fortsette og miste disse endringene?
}

# Header search:
translate O HeaderSearch {Headersk}
translate O GamesWithNoECO {Partier uten ECO?}
translate O GameLength {Partilengde}
translate O FindGamesWith {Finn partier merket med...}
translate O StdStart {Vanlig utgangsstilling}
translate O Promotions {Forfremmelser}
translate O Comments {Kommentarer}
translate O Variations {Variasjoner}
translate O Annotations {Annotasjoner}
translate O DeleteFlag {Slettet}
translate O WhiteOpFlag {Hvit pning}
translate O BlackOpFlag {Sort pning}
translate O MiddlegameFlag {Midtspill}
translate O EndgameFlag {Sluttspill}
translate O NoveltyFlag {Avvik}
translate O PawnFlag {Bondestruktur}
translate O TacticsFlag {Taktikk}
translate O QsideFlag {Spill p dronningsiden}
translate O KsideFlag {Spill p kongesiden}
translate O BrilliancyFlag {Brillians}
translate O BlunderFlag {Tabbe}
translate O UserFlag {Bruker}
translate O PgnContains {PGN inneholder tekst}

# Game list window:
translate O GlistNumber {Nummer}
translate O GlistWhite {Hvit}
translate O GlistBlack {Sort}
translate O GlistWElo {H-Elo}
translate O GlistBElo {S-Elo}
translate O GlistEvent {Anledning}
translate O GlistSite {Sted}
translate O GlistRound {Runde}
translate O GlistDate {Dato}
translate O GlistYear {r}
translate O GlistEDate {AnledningDato}
translate O GlistResult {Resultat}
translate O GlistLength {Lengde}
translate O GlistCountry {Land}
translate O GlistECO {ECO}
translate O GlistOpening {pning}
translate O GlistEndMaterial {Slutt-kvalitet}
translate O GlistDeleted {Slettet}
translate O GlistFlags {Flagg}
translate O GlistVars {Variasjoner}
translate O GlistComments {Kommentarer}
translate O GlistAnnos {Annotasjoner}
translate O GlistStart {Start}
translate O GlistGameNumber {Parti nummer}
translate O GlistFindText {Finn tekst}
translate O GlistMoveField {Trekk}
translate O GlistEditField {Still inn}
translate O GlistAddField {Legg til}
translate O GlistDeleteField {Fjern}
translate O GlistWidth {Bredde}
translate O GlistAlign {Justering}
translate O GlistColor {Farge}
translate O GlistSep {Skilletegn}

# Maintenance window:
translate O DatabaseName {Databasenavn:}
translate O TypeIcon {Ikon:}
translate O NumOfGames {Partier:}
translate O NumDeletedGames {Slettede partier:}
translate O NumFilterGames {Partier i filter:}
translate O YearRange {Til/fra r:}
translate O RatingRange {Til/fra rating:}
translate O Flag {Flagg}
translate O DeleteCurrent {Slett gjeldende parti}
translate O DeleteFilter {Slett filtrerte partier}
translate O DeleteAll {Slett alle partier}
translate O UndeleteCurrent {Gjenopprett gjeldende parti}
translate O UndeleteFilter {Gjenopprett filtrerte partier}
translate O UndeleteAll {Gjenopprett alle partier}
translate O DeleteTwins {Slett duplikatpartier}
translate O MarkCurrent {Merk gjeldende parti}
translate O MarkFilter {Merk filtrerte partier}
translate O MarkAll {Merk alle partier}
translate O UnmarkCurrent {Fjern merking p gjeldende parti}
translate O UnmarkFilter {Fjern merking p filtrerte partier}
translate O UnmarkAll {Fjern merking p alle partier}
translate O Spellchecking {Stavekontroll}
translate O Players {Spillere}
translate O Events {Anledninger}
translate O Sites {Steder}
translate O Rounds {Runder}
translate O DatabaseOps {Databasebehandling}
translate O ReclassifyGames {ECO-klassifiser partier}
translate O CompactDatabase {Komprimer database}
translate O SortDatabase {Sorter database}
translate O AddEloRatings {Legg til ELO-ratinger}
translate O AutoloadGame {Start med parti nummer}
translate O StripTags {Fjern PGN-merker}
translate O StripTag {Fjern merke}
translate O Cleaner {Opprydding}
translate O CleanerHelp {
Scid-opprydding vil utfre alle handlinger du velger fra listen under p gjeldende database.

Gjeldende innstillinger i ECO-klassifiseringen og duplikatslettingdialogene vil virke inn om du velger disse funksjonene.
}
translate O CleanerConfirm {
Nr oppryddingen er i gang kan den ikke avbrytes!

Dette kan ta lang tid p en stor databse, avhengig av funksjonene du har valgt og disses gjeldende innstillinger.

Er du sikker p at du vil starte vedlikeholdsfunksjonene du har valgt?
}

# Comment editor:
translate O AnnotationSymbols  {Notasjonssymboler:}
translate O Comment {Kommentar:}

# Board search:
translate O BoardSearch {Stillingsk}
translate O FilterOperation {Operasjoner p gjeldende filter:}
translate O FilterAnd {AND (Kun p filter)}
translate O FilterOr {OR (Legg til filter)}
translate O FilterIgnore {IGNORE (Nullstill filter)}
translate O SearchType {Sketype:}
translate O SearchBoardExact {Nyaktig stilling (alle brikker p samme felt)}
translate O SearchBoardPawns {Bnder (samme kvalitet, alle bnder p samme felt)}
translate O SearchBoardFiles {Kolonner (samme kvalitet, alle bnder p samme kolonner)}
translate O SearchBoardAny {Alle (samme kvalitet, bnder og brikker hvor som helst)}
translate O LookInVars {Sk i variasjoner}

# Material search:
translate O MaterialSearch {Kvalitetssk}
translate O Material {Kvalitet}
translate O Patterns {Mnstre}
translate O Zero {Null}
translate O Any {Hvilke som helst}
translate O CurrentBoard {Gjeldende stilling}
translate O CommonEndings {Vanlige sluttspill}
translate O CommonPatterns {Vanlige mnstre}
translate O MaterialDiff {Kvalitetsforskjell}
translate O squares {felt}
translate O SameColor {Samme farge}
translate O OppColor {Motsatt farge}
translate O Either {Begge}
translate O MoveNumberRange {Fra/til trekk nummer}
translate O MatchForAtLeast {Treff i minst}
translate O HalfMoves {halvtrekk}

# Game saving:
translate O Today {I dag}
translate O ClassifyGame {Klassifiser parti}

# Setup position:
translate O EmptyBoard {Tm brett}
translate O InitialBoard {Utgangsstilling}
translate O SideToMove {Side i trekk}
translate O MoveNumber {Trekk nummer}
translate O Castling {Rokkade}
translate O EnPassentFile {En Passent-kolonne}
translate O ClearFen {Slett FEN}
translate O PasteFen {Lim inn FEN}

# Replace move dialog:
translate O ReplaceMove {Erstatt trekk}
translate O AddNewVar {Legg til ny variasjon}
translate O ReplaceMoveMessage {Et trekk eksisterer allerede her.

Du kan erstatte det og slette alle flgende trekk, eller du kan legge det til som en variasjon.

(Du kan unng denne meldingen i fremtiden ved  sl av Spr fr trekk erstattes-innstillingen i Innstillinger:Trekk-menyen.)}

# Make database read-only dialog:
translate O ReadOnlyDialog {Hvis du skrivebeskytter denne databasen tillates ikke lenger endringer p den. Ingen partier kan lagres eller erstattes, og ingen sletteflagg kan endres. All sortering eller ECO-klassifisering vil vre midlertidig.

Du kan enkelt sl av skrivebeskyttelsen p databasen ved  lukke og gjenpne den.

Vil du virkelig skrivebeskytte denne databasen?}

# Clear game dialog:
translate O ClearGameDialog {Dette partiet har blitt endret.

Vil du virkelig forkaste endringene som er gjort?
}

# Exit dialog:
translate O ExitDialog {Vil du virkelig avslutte Scid?}
translate O ExitUnsaved {Flgende baser har ulagrede endringer i partier. Hvis du avslutter n vil disse endringene g tapt.}

# Import window:
translate O PasteCurrentGame {Lim inn gjeldende parti}
translate O ImportHelp1 {Skriv eller lim inn et PGN-parti i feltet over.}
translate O ImportHelp2 {Feil i importen vil vises her.}

# ECO Browser:
translate O ECOAllSections {alle ECO-deler}
translate O ECOSection {ECO-del}
translate O ECOSummary {Sammendrag for}
translate O ECOFrequency {Hyppighet eller underkoder for}

# Opening Report:
translate O OprepTitle {pningsrapport}
translate O OprepReport {Rapport}
translate O OprepGenerated {Generert av}
translate O OprepStatsHist {Statistikk og historie}
translate O OprepStats {Statistikk}
translate O OprepStatAll {Alle rapporterte partier}
translate O OprepStatBoth {Begge med rating}
translate O OprepStatSince {Siden}
translate O OprepOldest {Eldste partier}
translate O OprepNewest {Nyeste partier}
translate O OprepPopular {Trend}
translate O OprepFreqAll {Frekvens i r:   }
translate O OprepFreq1   {Det siste ret: }
translate O OprepFreq5   {De siste 5 rene: }
translate O OprepFreq10  {De siste 10 rene: }
translate O OprepEvery {hvert %u parti}
translate O OprepUp {opp %u%s fra alle r}
translate O OprepDown {ned %u%s fra alle r}
translate O OprepSame {ingen endring fra alle r}
translate O OprepMostFrequent {Hyppigste spillere}
translate O OprepRatingsPerf {Ratinger og resultater}
translate O OprepAvgPerf {Middelratinger og -resultater}
translate O OprepWRating {Hvit rating}
translate O OprepBRating {Sort rating}
translate O OprepWPerf {Hvite resultater}
translate O OprepBPerf {Sorte resultater}
translate O OprepHighRating {Parti med hyeste gjennomsnittsrating}
translate O OprepTrends {Resultattrend}
translate O OprepResults {Resultatlengde og -hyppighet}
translate O OprepLength {Partilengde}
translate O OprepFrequency {Hyppighet}
translate O OprepWWins {Hvit vinner: }
translate O OprepBWins {Sort vinner: }
translate O OprepDraws {Uavgjort:      }
translate O OprepWholeDB {hele databasen}
translate O OprepShortest {Korteste seire}
translate O OprepMovesThemes {Trekk og temaer}
translate O OprepMoveOrders {Trekkrekkeflger til rapportert stilling}
translate O OprepMoveOrdersOne \
  {Det var kun en trekkrekkeflge som frte til denne stillingen:}
translate O OprepMoveOrdersAll \
  {Det var %u trekkrekkeflger som frte til denne stillingen:}
translate O OprepMoveOrdersMany \
  {There were %u move orders reaching this position. The top %u are:}
translate O OprepMovesFrom {Trekk fra rapportert stilling}
translate O OprepThemes {Stillingstemaer}
translate O OprepThemeDescription {Hyppighet av tema i trekk %u}
translate O OprepThemeSameCastling {Rokkade til samme side}
translate O OprepThemeOppCastling {Rokkade til motsatt side}
translate O OprepThemeNoCastling {Ingen konger rokert}
translate O OprepThemeKPawnStorm {Bondestorm p kongesiden}
translate O OprepThemeQueenswap {Byttede dronninger}
translate O OprepThemeIQP {Isolert dronningbonde}
translate O OprepThemeWP567 {Hvit bonde p rekke 5/6/7}
translate O OprepThemeBP234 {Sort bonde p rekke 2/3/4}
translate O OprepThemeOpenCDE {pen c/d/e-kolonne}
translate O OprepTheme1BishopPair {Kun en side har to lpere}
translate O OprepEndgames {Sluttspill}
translate O OprepReportGames {Rapporterte partier}
translate O OprepAllGames    {Alle partier}
translate O OprepEndClass {Materiale i sluttspillet}
translate O OprepTheoryTable {Teoritabell}
translate O OprepTableComment {Generert fra de %u hyest ratede partiene.}
translate O OprepExtraMoves {Ytterligere trekk notert i teoritabellen}
translate O OprepMaxGames {Maksimalt antall partier i teoritabellen}

# Piece Tracker window:
translate O TrackerSelectSingle {Venstre museknapp merker denne brikken}
translate O TrackerSelectPair {Venstre museknapp merker denne brikken; hyre merker alle brikker av denne typen.}
translate O TrackerSelectPawn {Venstre museknapp merker denne brikken; hyre merker alle brikker av denne typen.}
translate O TrackerStat {Statistikk}
translate O TrackerGames {% partier med trekk til felt}
translate O TrackerTime {% tid p hvert felt}
translate O TrackerMoves {Trekk}
translate O TrackerMovesStart {Oppgi trekket hvor sporingen skal begynne.}
translate O TrackerMovesStop {Oppgi trekket hvor sporingen skal stoppe.}

# Game selection dialogs:
translate O SelectAllGames {Alle partier i databasen}
translate O SelectFilterGames {Kun partier i filteret}
translate O SelectTournamentGames {Kun partier i gjeldende turnering}
translate O SelectOlderGames {Kun eldre partier}

# Delete Twins window:
translate O TwinsNote {For  vre duplikater m to partier minst ha de samme to spillerene, og kriterier du kan angi under. Nr to duplikater finnes blir det korteste partiet slettet. Tips: Det er best  kjre en stavekontroll fr duplikatsjekken, da det forbedrer sket.}
translate O TwinsCriteria {Kriterier: Duplikater m ha...}
translate O TwinsWhich {Undersk hvilke partier}
translate O TwinsColors {Spillere samme farge?}
translate O TwinsEvent {Samme anledning?}
translate O TwinsSite {Samme sted?}
translate O TwinsRound {Samme runde?}
translate O TwinsYear {Samme r?}
translate O TwinsMonth {Samme mned?}
translate O TwinsDay {Samme dag?}
translate O TwinsResult {Samme utfall?}
translate O TwinsECO {Samme ECO-kode?}
translate O TwinsMoves {Samme trekk?}
translate O TwinsPlayers {Sammenlign spillernavn:}
translate O TwinsPlayersExact {Nyaktig like}
translate O TwinsPlayersPrefix {Kun frste 4 bokstaver}
translate O TwinsWhen {Nr duplikatpartier slettes}
translate O TwinsSkipShort {Overse alle partier kortere enn 5 trekk?}
translate O TwinsUndelete {Gjenopprett alle partier frst?}
translate O TwinsSetFilter {Sett filter til alle slettede duplikatpartier?}
translate O TwinsComments {Behold alltid partier med kommentarer?}
translate O TwinsVars {Behold alltid partier med variasjoner?}
translate O TwinsDeleteWhich {Slett hvilket parti:}
translate O TwinsDeleteShorter {Korteste parti}
translate O TwinsDeleteOlder {Laveste partinummer}
translate O TwinsDeleteNewer {Hyeste partinummer}
translate O TwinsDelete {Slett partier}

# Name editor window:
translate O NameEditType {Navnetype som skal redigeres}
translate O NameEditSelect {Partier som skal redigeres}
translate O NameEditReplace {Erstatt}
translate O NameEditWith {med}
translate O NameEditMatches {Treff: Trykk Ctrl+1 til Ctrl+9 for  velge}

# Classify window:
translate O Classify {Klassifiser}
translate O ClassifyWhich {ECO-klassifiser hvilke partier}
translate O ClassifyAll {Alle partier (overskriv gamle ECO-koder)}
translate O ClassifyYear {Aller partier det siste ret}
translate O ClassifyMonth {Alle partier den siste mneden}
translate O ClassifyNew {Kun partier uten ECO-kode}
translate O ClassifyCodes {ECO-koder som skal brukes}
translate O ClassifyBasic {Kun standardkoder ("B12", ...)}
translate O ClassifyExtended {Scid-utvidet ("B12j", ...)}

# Compaction:
translate O NameFile {Navnefil}
translate O GameFile {Partifil}
translate O Names {Navn}
translate O Unused {Ubrukte}
translate O SizeKb {Strrelse (kb)}
translate O CurrentState {Nvrende}
translate O AfterCompaction {Etter komprimering}
translate O CompactNames {Komrimer navnefil}
translate O CompactGames {Komprimer partifil}

# Sorting:
translate O SortCriteria {Kriterier}
translate O AddCriteria {Legg til kriterie}
translate O CommonSorts {Vanlige sorteringer}
translate O Sort {Sorter}

# Exporting:
# These lines do not use the excact notation of the original english.tcl, because this would cause inconsistency with the PGN window menus
translate O AddToExistingFile {Legg partier til en eksisterende fil}
translate O ExportComments {Eksporter kommentarer}
translate O ExportVariations {Eksporter variasjoner}
translate O IndentComments {Rykk inn kommentarer}
translate O IndentVariations {Rykk inn variasjoner}
translate O ExportColumnStyle {Bruk kolonner (ett trekk per linje)}
translate O ExportSymbolStyle {Symbolnotasjoner}
translate O ExportStripMarks {Fjern alle fargekoder og piler fra kommentarer?}

# Goto game/move dialogs:
translate O LoadGameNumber {Angi partinummer som skal lastes inn:}
translate O GotoMoveNumber {G til trekk nummer:}

# Copy games dialog:
translate O CopyGames {Kopier partier}
translate O CopyConfirm {
Vil du virkelig kopiere de [thousands $nGamesToCopy] filtrerte partiene fra "$fromName"
 til databasen "$targetName"?
}
translate O CopyErr {Kan ikke kopiere partiene}
translate O CopyErrSource {kildedatabasen}
translate O CopyErrTarget {mldatabasen}
translate O CopyErrNoGames {har ingen partier i sitt filter}
translate O CopyErrReadOnly {er skrivebeskyttet}
translate O CopyErrNotOpen {er ikke pnet}

# Colors:
translate O LightSquares {Lyse felt}
translate O DarkSquares {Mrke felt}
translate O SelectedSquares {Merkede felt}
translate O SuggestedSquares {Foresltte trekkfelt}
translate O WhitePieces {Hvite brikker}
translate O BlackPieces {Sorte brikker}
translate O WhiteBorder {Hvit ramme}
translate O BlackBorder {Sort ramme}

# Novelty window:
translate O FindNovelty {Finn avvik}
translate O Novelty {Avvik}
translate O NoveltyInterrupt {Avvikssk avbrutt}
translate O NoveltyNone {Ingen avvik ble funnet i dette partiet}
translate O NoveltyHelp {
Scid vil finne det frste trekket i det gjeldende partiet som frer til en stilling som ikke finnes i den valgte databasen eller i ECO-pningsboken.}

# Upgrading databases:
translate O Upgrading {Oppgraderer}
translate O ConfirmOpenNew {
Dette er en database i gammelt format (Scid 2) som ikke kan pnes i Scid 3, men en ny versjon (Scid 3) har allerede blitt opprettet.

Vil du pne versjonen som er i det nye formatet?
}
translate O ConfirmUpgrade {
Dette er en database i gammelt format (Scid2). En versjon i nytt format m opprettes fr den kan brukes i Scid 3.

Oppgradering vil opprette en ny versjon av databasen; det vil ikke redigere eller slette de opprinnelige filene.

Dette kan ta en stund, men det trenger kun  gjres en gang. Du kan avbryte om det tar for lang tid.

nsker du  oppgradere databasen n?
}

# Recent files options:
translate O RecentFilesMenu {Number of recent files in File menu} ;# ***
translate O RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}

# norsk.tcl

# Sjekkliste:
# - Snarveier

### Polish menus for Scid.
# Contributed by Michal Rudolf and Adam Umiastowski.

addLanguage P Polish 0 iso8859-2

proc setLanguage_P {} {

menuText P File "Plik" 0
menuText P FileNew "Nowy..." 0 {Twrz nowa baz Scid}
menuText P FileOpen "Otwrz..." 0 {Otwrz istniejc baz Scid}
menuText P FileClose "Zamknij" 0 {Zamknij aktywna baz Scid}
menuText P FileFinder "Poszukiwacz plikw" 0 {Otwrz okno poszukiwacza plikw}
menuText P FileBookmarks "Zakadki" 2 {Menu zakadek (klawisz: Ctrl+B)}
menuText P FileBookmarksAdd "Dodaj zakadk" 0 \
  {Dodaj zakadk do aktualnej bazy i pozycji}
menuText P FileBookmarksFile "Wstaw zakadk" 0 \
  {Wstaw do wybranego katalogu zakadk do aktualnej bazy i pozycji}
menuText P FileBookmarksEdit "Edycja zakadek..." 0 \
  {Edytuj menu zakadek}
menuText P FileBookmarksList "Wywietlaj katalogi jako list" 0 \
  {Wywietlaj katalogi zakadek jako list, nie jako zagniedone menu}
menuText P FileBookmarksSub "Wywietl katalogi jako menu" 0 \
  {Wywietlaj katalogi zakadek jako zagniedone menu, nie jako list}
menuText P FileMaint "Obsuga" 1 {Narzdzia obsugi bazy Scid}
menuText P FileMaintWin "Obsuga" 0 \
  {Otwrz/zamknij obsug bazy Scid}
menuText P FileMaintCompact "Porzdkuj baz..." 0 \
  {Porzdkuj baz, usuwajc skasowane partie i nieuywane nazwiska}
menuText P FileMaintClass "Klasyfikacja debiutowa partii..." 0 \
  {Przelicz klasyfikacj debiutowa wszystkich partii}
menuText P FileMaintSort "Sortuj baz..." 0 \
  {Sortuj wszystkie partie w bazie}
menuText P FileMaintDelete "Usu podwjne partie..." 0 \
  {Szukaj podwjnych partii i oznacz je do skasowania}
menuText P FileMaintTwin "Wyszukiwanie podwjnych partii" 0 \
  {Otwrz/uaktualnij wyszukiwanie podwjnych partii}
menuText P FileMaintName "Pisownia" 0 \
  {Edycja nazw/nazwisk i kontrola pisowni}
menuText P FileMaintNameEditor "Edytor nazwisk" 0 \
  {Otwrz/zamknij edytor nazwisk}
menuText P FileMaintNamePlayer "Sprawd pisowni nazwisk..." 17 \
  {Sprawd pisowni nazwisk przy pomocy pliku nazwisk}
menuText P FileMaintNameEvent "Sprawd pisowni nazw zawodw..." 22 \
  {Sprawd pisowni nazw zawodw przy pomocy pliku turniejw}
menuText P FileMaintNameSite "Sprawd pisowni nazw miejscowoci..." 22 \
  {Sprawd pisowni nazw miejscowoci przy pomocy pliku miejscowoci}
menuText P FileMaintNameRound "Sprawd numery rund..." 15 \
  {Sprawd numery rund przy pomocy pliku}
menuText P FileReadOnly "Tylko do odczytu..." 0 \
  {Zabezpiecz baz przed zapisem}
menuText P FileExit "Koniec" 0 {Zamknij Scida}

menuText P Edit "Edytuj" 0
menuText P EditAdd "Dodaj wariant" 0 {Dodaj wariant do ruchu w partii}
menuText P EditDelete "Usu wariant" 0 {Usu wariant dla tego posunicia}
menuText P EditFirst "Twrz pierwszy wariant" 0 \
  {Przesu wariant na pierwsze miejsce na licie}
menuText P EditMain "Zmie wariant na tekst partii" 0 \
   {Zamie wariant i tekst partii}
menuText P EditTrial "Sprawd wariant" 0 \
  {Wcz/wycz tryb sprawdzania wariantw}
menuText P EditStrip "Usu" 2 \
  {Usu komentatarze i warianty}
menuText P EditStripComments "Komentarze" 0 \
  {Usu wszystkie komentarze z aktualnej partii}
menuText P EditStripVars "Warianty" 0 \
  {Usu wszystkie warianty z aktualnej partii}
menuText P EditReset "Oprnij schowek" 0 \
  {Oprnij schowek bazy}
menuText P EditCopy "Kopiuj parti do schowka" 0 \
  {Kopiuj parti do schowka}
menuText P EditPaste "Wklej aktywn parti ze schowka" 0 \
  {Wklej aktywn parti ze schowka}
menuText P EditSetup "Ustaw pozycj pocztkow..." 6 \
  {Ustaw pozycj pocztkow partii}
menuText P EditPasteBoard "Ustaw pozycj ze schowka" 3 \
  {Ustaw pozycj ze schowka}

menuText P Game "Partia" 1
menuText P GameNew "Opu parti" 0 \
  {Opu parti, rezygnujc z wszelkich zmian}
menuText P GameFirst "Pierwsza partia" 2 {Zaaduj pierwsz parti z filtra}
menuText P GamePrev "Poka poprzedni parti" 0 \
  {Poka poprzedni wyszukan parti}
menuText P GameReload "Przeaduj aktualn parti"  10 \
  {Przeaduj parti, rezygnujc z wszelkich zmian}
menuText P GameNext "Zaaduj nastpn parti" 0 \
  {Zaaduj nastpn wyszukan parti}
menuText P GameLast "Ostatnia partia" 2 {Zaaduj ostatni parti z filtra}
menuText P GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText P GameNumber "Zaaduj parti numer..." 17 \
  {Zaaduj parti wprowadzajc jej numer}
menuText P GameReplace "Zapisz: zastp parti..." 3 \
  {Zapisz parti, zastp poprzedni wersj}
menuText P GameAdd "Zapisz: dodaj now parti..." 8 \
  {Zapisz t parti jako nowa parti w bazie}
menuText P GameDeepest "Rozpoznaj debiut" 0 \
  {Przejd do najduszego wariantu z ksiki debiutowej}
menuText P GameGotoMove "Przejd do posunicia nr..." 13 \
  {Przejd do posunicia o podanym numerze}
menuText P GameNovelty "Znajd nowink..." 7 \
  {Znajd pierwsze posunicie partii niegrane wczeniej}

menuText P Search "Szukaj" 0
menuText P SearchReset "Resetuj filtr" 0 \
  {Wstaw wszystkie partie do filtra}
menuText P SearchNegate "Odwr filtr" 0 \
  {Zamie partie w filtrze i poza nim}
menuText P SearchCurrent "Aktualna pozycja..." 0 \
  {Szukaj aktualnej pozycji}
menuText P SearchHeader "Nagwek..." 0 \
  {Szukaj informacji o nagwkach (nazwiska, nazwy turnieju itp.)}
menuText P SearchMaterial "Materia/wzorzec..." 0 \
  {Szukaj wedug materiau lub wzorca}
menuText P SearchUsing "Stosuj plik poszukiwania..." 0 \
  {Szukaj stosujc plik z opcjami poszukiwania}

menuText P Windows "Okna" 1
menuText P WindowsComment "Edytor komentarzy" 0 \
  {Otwrz/zamknij edytor komentarzy}
menuText P WindowsGList "Lista partii" 0 {Otwrz/zamknij list partii}
menuText P WindowsPGN "Okno PGN" 0 {Otwrz/zamknij (zapis partii) PGN }
menuText P WindowsTmt "Turnieje" 0 {Otwrz/zamknij przegldark turniejw}
menuText P WindowsSwitcher "Przecznik baz" 12 \
  {Otwrz/zamknij przecznik baz}
menuText P WindowsMaint "Zarzdzanie baz" 0 \
  {Otwrz/zamknij okno zarzdzania baz}
menuText P WindowsECO "Przegldarka kodw debiutowych" 0 \
  {Otwrz/zamknij przegldark kodw debiutowych}
menuText P WindowsRepertoire "Repertuar debiutowy" 0 \
  {Otwrz/zamknij okno repertuaru debiutowego}
menuText P WindowsStats "Statystyka" 0 \
  {Otwrz/zamknij statystyk}
menuText P WindowsTree "Drzewo wariantw" 0 {Otwrz/zamknij drzewo wariantw}
menuText P WindowsTB "Tablica kocwek" 8 \
  {Otwrz/zamknij okno tablicy kocwek}

menuText P Tools "Narzdzia" 0
menuText P ToolsAnalysis "Program analizujcy..." 8 \
  {Uruchom/zatrzymaj program analizujcy}
menuText P ToolsAnalysis2 "Program analizujcy #2..." 21 \
  {Uruchom/zatrzymaj program analizujcy}
menuText P ToolsCross "Tabela turniejowa" 0 \
  {Poka tabel turniejow dla aktualnej partii}
menuText P ToolsEmail "Zarzdzanie poczt e-mail" 0 \
  {Otwrz/zamknij zarzdzanie adresami e-mail}
menuText P ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText P ToolsOpReport "Raport debiutowy" 0 \
  {Utwrz raport debiutowy dla aktualnej pozycji}
menuText P ToolsTracker "ledzenie figur"  10 {Otwrz/zamknij okno ledzenia figur} 
menuText P ToolsPInfo "Informacje o zawodniku"  0 \
  {Otwrz/odwie okno informacji o zawodniku}
menuText P ToolsRating "Wykres rankingu" 0 \
  {Wykres historii rankingu grajcych parti}
menuText P ToolsScore "Wykres wynikw" 1 {Poka wykres wynikw}
menuText P ToolsExpCurrent "Eksportuj parti" 0 \
  {Zapisz parti do pliku tekstowego}
menuText P ToolsExpCurrentPGN "Do pliku PGN..." 9 \
  {Zapisz parti do pliku PGN}
menuText P ToolsExpCurrentHTML "Do pliku HTML..." 9 \
  {Zapisz parti do pliku HTML}
menuText P ToolsExpCurrentLaTeX "Do pliku LaTeX-a..." 9 \
  {Zapisz parti do pliku LaTeX-a}
menuText P ToolsExpFilter "Eksportuj wyszukane partie" 1 \
  {Zapisz wyszukane partie do pliku tekstowego}
menuText P ToolsExpFilterPGN "Do pliku PGN..." 9 \
  {Zapisz wyszukane partie do pliku PGN}
menuText P ToolsExpFilterHTML "Do pliku HTML..." 9 \
  {Zapisz wyszukane partie do pliku HTML}
menuText P ToolsExpFilterLaTeX "Do pliku LaTeX..." 9 \
  {Zapisz wyszukane partie do pliku LaTeX}
menuText P ToolsImportOne "Pobierz parti z pliku PGN..." 0 \
  {Pobierz parti z pliku PGN}
menuText P ToolsImportFile "Pobierz plik PGN..." 2 \
  {Pobierz partie z pliku PGN}

menuText P Options "Opcje" 0
menuText P OptionsSize "Wielko szachownicy" 0 {Zmie wielko szachownicy}
menuText P OptionsPieces "Typ figur" 4 \
  {Zmienia typ wyswietlanych figur} 
menuText P OptionsColors "Kolory..." 0 {Zmie kolory szachownicy}
menuText P OptionsExport "Eksport" 0 {Zmie opcje eksportu tekstu}
menuText P OptionsFonts "Czcionka" 0 {Zmie font}
menuText P OptionsFontsRegular "Podstawowa" 0 {Zmie podstawow czcionk}
menuText P OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText P OptionsFontsSmall "Maa" 0 {Zmie ma czcionk}
menuText P OptionsFontsFixed "Staa" 0 {Zmie czcionk staej szerokoci}
menuText P OptionsGInfo "Informacje o partii" 0 {Sposb wywietlania informacji o partii}
menuText P OptionsLanguage "Jzyk" 0 {Wybierz jzyk}
menuText P OptionsMoves "Posunicia" 0 {Wprowadzanie posuni}
menuText P OptionsMovesAsk "Zapytaj przed zastpieniem posuni" 0 \
  {Zapytaj przed zastpieniem aktualnych posuni}
menuText P OptionsMovesDelay "Automatyczne przegldanie..." 0 \
  {Ustaw opnienie przy automatycznym przegldaniu partii}
menuText P OptionsMovesCoord "Posunicia w formacie \"g1f3\"" 0 \
  {Akceptuj posunicia wprowadzone w formacie "g1f3"}
menuText P OptionsMovesSuggest "Poka proponowane posunicia" 1 \
  {Wcz/wycz proponowanie posuni}
menuText P OptionsMovesKey "Automatyczne dopenianie posuni" 1 \
  {Wcz/wycz automatyczne dopenianie posuni wprowadzanych z klawiatury}
menuText P OptionsNumbers "Format zapisu liczb" 0 {Wybierz format zapisu liczb}
menuText P OptionsStartup "Start" 0 {Wybierz okna, ktre maj by widoczne po uruchomieniu programu}
menuText P OptionsWindows "Okna" 0 {Opcje okien}
menuText P OptionsWindowsIconify "Minimalizuj wszystkie okna" 0 \
  {Schowaj wszystkie okna przy minimalizacji gwnego okna}
menuText P OptionsWindowsRaise "Automatyczne uaktywnianie" 0 \
  {Automatycznie uaktywniaj niektre okna (np. pasek postpu), gdy s zasonite}
menuText P OptionsToolbar "Pasek narzdziowy" 6 \
  {Schowaj/poka pasek narzdziowy}
menuText P OptionsECO "Zaaduj ksik debiutow..." 16 \
  {Zaaduj plik z klasyfikacja debiutw}
menuText P OptionsSpell "Zaaduj plik sprawdzania pisowni..." 13 \
  {Zaaduj plik do sprawdzania pisowni nazwisk i nazw}
menuText P OptionsTable "Katalog z baz kocwek..." 10 \
  {Wybierz baz kocwek; uyte zostan wszystkie bazy z tego katalogu}
menuText P OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText P OptionsSave "Zapamitaj opcje" 0 \
  "Zapamitaj wszystkie ustawienia w pliku $::optionsFile"
menuText P OptionsAutoSave "Automatycznie zapisuj opcje" 0 \
  {Automatycznie zapisz opcje przy zamykaniu programu}

menuText P Help "Pomoc" 2
menuText P HelpIndex "Spis treci" 0 {Poka spis treci pomocy}
menuText P HelpGuide "Krtki przewodnik" 0 {Poka krtki przewodnik}
menuText P HelpHints "Podpowiedzi" 0 {Poka podpowiedzi}
menuText P HelpContact "Informacja o autorze" 0 \
  {Poka informacj o autorze i stronie Scid-a}
menuText P HelpTip "Porada dnia" 0 {Poka porad Scida}
menuText P HelpStartup "Okno powitalne" 2 {Pokazuj okno startowe}
menuText P HelpAbout "O programie" 0 {Informacje o programie Scid}

# Game info box popup menu:
menuText P GInfoHideNext "Ukryj nastpne posunicie" 0
menuText P GInfoMaterial "Poka materia" 0
menuText P GInfoFEN "Poka pozycj w formacie FEN" 16
menuText P GInfoMarks "Pokazuj kolorowe pola i strzaki" 5 
menuText P GInfoWrap "Zawijaj dugie linie" 0
menuText P GInfoFullComment "Poka cay komentarz" 6
menuText P GInfoTBNothing "Tablica kocwek: nic" 0
menuText P GInfoTBResult "Tablica kocwek: tylko wynik" 18
menuText P GInfoTBAll "Tablica kocwek: wszystko" 18
menuText P GInfoDelete "Usu/przywr t parti" 0
menuText P GInfoMark "Wcz/wycz zaznaczenie tej partii" 0

# Main window buttons:
helpMsg P .button.start {Id do pocztku partii (klawisz: Home)}
helpMsg P .button.end {Id na koniec partii  (klawisz: End)}
helpMsg P .button.back {Cofnij o jedno posunicie  (klawisz: strzaka w lewo)}
helpMsg P .button.forward {Jedno posunicie do przodu (klawisz: strzaka w prawo)}
helpMsg P .button.intoVar {Wejd w wariant (klawisz skrtu: v)}
helpMsg P .button.exitVar {Opu wariant (klawisz skrtu: z)}
helpMsg P .button.flip {Obr szachownic  (klawisz skrtu: .)}
helpMsg P .button.coords {Wcz lub wycz opis szachownicy  (klawisz skrtu: 0)}
helpMsg P .button.autoplay \
  {Automatyczne przestawianie bierek (klawisz skrtu: Ctrl+Z)}

# General buttons:
translate P Back {Z powrotem}
translate P Cancel {Anuluj}
translate P Clear {Wyczy}
translate P Close {Zamknij}
translate P Defaults {Domylne}
translate P Delete {Usu}
translate P Graph {Wykres}
translate P Help {Pomoc}
translate P Import {Pobierz}
translate P Index {Indeks}
translate P LoadGame {Wczytaj parti}
translate P BrowseGame {Przegldaj parti}
translate P MergeGame {Docz parti}
translate P Preview {Podgld}
translate P Revert {Odwr}
translate P Save {Zapisz}
translate P Search {Szukaj}
translate P Stop {Stop}
translate P Store {Zapamitaj}
translate P Update {Uaktualnij}
translate P ChangeOrient {Zmie pooenie okna}
translate P None {Brak}
translate P First {Pierwsza}
translate P Current {Aktualn}
translate P Last {Ostatni}

# General messages:
translate P game {partia}
translate P games {partie}
translate P move {posunicie}
translate P moves {pos.}
translate P all {wszystkie}
translate P Yes {Tak}
translate P No {Nie}
translate P Both {Oba}
translate P King {Krl}
translate P Queen {Hetman}
translate P Rook {Wiea}
translate P Bishop {Goniec}
translate P Knight {Skoczek}
translate P Pawn {Pion}
translate P White {Biae}
translate P Black {Czarne}
translate P Player {Gracz}
translate P Rating {Ranking}
translate P RatingDiff {Rnica rankingw}
translate P Event {Turniej}
translate P Site {Miejsce}
translate P Country {Kraj}
translate P IgnoreColors {Ignoruj kolory}
translate P Date {Data}
translate P EventDate {Turniej data}
translate P Decade {Decade} ;# ***
translate P Year {Rok}
translate P Month {Miesic}
translate P Months {Stycze Luty Marzec Kwiecie Maj Czerwiec
  Lipiec Sierpie Wrzesie Padziernik Listopad Grudzie}
translate P Days {N Pn Wt r Cz Pt So}
translate P YearToToday {Ostatni rok}
translate P Result {Wynik}
translate P Round {Runda}
translate P Length {Dugo}
translate P ECOCode {Kod ECO}
translate P ECO {ECO}
translate P Deleted {Usunita}
translate P SearchResults {Wyniki wyszukiwania}
translate P OpeningTheDatabase "Otwieranie bazy"
translate P Database {Bazy}
translate P Filter {Filtr}
translate P noGames {brak partii}
translate P allGames {wszystkie partie}
translate P empty {brak}
translate P clipbase {schowek}
translate P score {punkty}
translate P StartPos {Pozycja pocztkowa}
translate P Total {Razem}

# Game information:
translate P twin {powtrzona}
translate P deleted {usunita}
translate P comment {komentarz}
translate P hidden {ukryte}
translate P LastMove {Poprzednie}
translate P NextMove {nastpne}
translate P GameStart {Pocztek partii}
translate P LineStart {Pocztek wariantu}
translate P GameEnd {Koniec partii}
translate P LineEnd {Koniec wariantu}

# Player information:
translate P PInfoAll {Wyniki - <b>wszystkie</b> partie}
translate P PInfoFilter {Wyniki - partie z <b>filtra</b>}
translate P PInfoAgainst {Wyniki - }
translate P PInfoMostWhite {Najczstsze debiuty biaymi}
translate P PInfoMostBlack {Najczstsze debiuty czarnymi}
translate P PInfoRating {Historia rankingu}
translate P PInfoBio {Biografia}

# Tablebase information:
translate P Draw {remis}
translate P stalemate {pat}
translate P withAllMoves {po dowolnym posuniciu}
translate P withAllButOneMove {po dowolnym posuniciu oprcz}
translate P with {po}
translate P only {tylko}
translate P lose {przegrywaj}
translate P loses {przegrywa}
translate P allOthersLose {inne posunicia przegrywaj}
translate P matesIn {matuj w}
translate P hasCheckmated {matuj}
translate P longest {najlepsze}

# Tip of the day:
translate P Tip {Porada}
translate P TipAtStartup {Poka porad przy starcie}

# Tree window menus:
menuText P TreeFile "Plik" 0
menuText P TreeFileSave "Zapisz bufor" 7 {Zapisz plik bufora (.stc)}
menuText P TreeFileFill "Twrz standardowy plik cache" 0 {Wstaw typowe pozycje debiutowe do bufora}
menuText P TreeFileBest "Najlepsze partie" 0 {Poka list najlepszych partii}
menuText P TreeFileGraph "Poka wykres" 0 {Poka wykres dla tej gazi drzewa}
menuText P TreeFileCopy "Kopiuj drzewo do schowka" 0 \
  {Skopiuj drzewo ze statystykami do schowka}
menuText P TreeFileClose "Zamknij" 0 {Zamknij okno drzewa}
menuText P TreeSort "Sortowanie" 0
menuText P TreeSortAlpha "Alfabetycznie" 0
menuText P TreeSortECO "Kod ECO" 0
menuText P TreeSortFreq "Czsto" 0
menuText P TreeSortScore "Punkty" 0
menuText P TreeOpt "Opcje" 0
menuText P TreeOptLock "Blokada" 0 {Zablokuj/odblokuj drzewo na aktualnej bazie}
menuText P TreeOptTraining "Trening" 0 {Wcz/wycz tryb treningowy}
menuText P TreeOptAutosave "Automatyczny zapis bufora" 0 \
  {Automatycznie zapisz plik bufora przy wyjciu}
menuText P TreeHelp "Pomoc" 2
menuText P TreeHelpTree "Drzewo" 0
menuText P TreeHelpIndex "Spis treci" 0
translate P SaveCache {Zapisz bufor}
translate P Training {Trening}
translate P LockTree {Blokada}
translate P TreeLocked {zablokowane}
translate P TreeBest {Najlepsze}
translate P TreeBestGames {Najlepsze partie}

# Finder window:
menuText P FinderFile "Plik" 0
menuText P FinderFileSubdirs "Przeszukuj podkatalogi" 0
menuText P FinderFileClose "Zamknij wyszukiwacza plikw" 0
menuText P FinderSort "Sortowanie" 0
menuText P FinderSortType "Typ" 0
menuText P FinderSortSize "Rozmiar" 0
menuText P FinderSortMod "Zmieniony" 0
menuText P FinderSortName "Nazwa" 0
menuText P FinderSortPath "cieka" 0
menuText P FinderTypes "Typy" 0
menuText P FinderTypesScid "Bazy Scid-a" 0
menuText P FinderTypesOld "Bazy Scid-a (stary format)" 1
menuText P FinderTypesPGN "Pliki PGN" 0
menuText P FinderTypesEPD "Ksiki debiutowe EPD" 0
menuText P FinderTypesRep "Pliki repertuaru debiutowego" 0
menuText P FinderHelp "Pomoc" 2
menuText P FinderHelpFinder "Pomoc poszukiwacza plikw" 1
menuText P FinderHelpIndex "Spis treci" 0
translate P FileFinder {Poszukiwacz plikw}
translate P FinderDir {Katalog}
translate P FinderDirs {Katalogi}
translate P FinderFiles {Pliki}
translate P FinderUpDir {wyej}

# Tournament finder:
menuText P TmtFile "Plik" 0
menuText P TmtFileUpdate "Uaktualnij" 0
menuText P TmtFileClose "Zamknij turnieje" 0
menuText P TmtSort "Sortowanie" 0
menuText P TmtSortDate "Data" 0
menuText P TmtSortPlayers "Zawodnicy" 0
menuText P TmtSortGames "Partie" 0
menuText P TmtSortElo "Elo" 0
menuText P TmtSortSite "Miejsce" 0
menuText P TmtSortEvent "Turniej" 0
menuText P TmtSortWinner "Zwycizca" 0
translate P TmtLimit "Max. turniejw"
translate P TmtMeanElo "Min. rednie ELO"
translate P TmtNone "Nie znaleziono turniejw."

# Graph windows:
menuText P GraphFile "Plik" 0
menuText P GraphFileColor "Zapisz jako kolorowy PostScript" 12
menuText P GraphFileGrey "Zapisz jako zwyky PostScript..." 0
menuText P GraphFileClose "Zamknij okno" 6
menuText P GraphOptions "Opcje" 0
menuText P GraphOptionsWhite "Biae" 0
menuText P GraphOptionsBlack "Czarne" 0
menuText P GraphOptionsBoth "Oba kolory" 1
menuText P GraphOptionsPInfo "Gracz z Informacji o graczu" 0
translate P GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate P AddVariation {Dodaj wariant}
translate P AddMove {Dodaj posunicie}
translate P Annotate {Komentuj}
translate P AnalysisCommand {Program do analizy}
translate P PreviousChoices {Poprzednie programy}
translate P AnnotateTime {Czas midzy ruchami (w sekundach)}
translate P AnnotateWhich {Dodaj warianty}
translate P AnnotateAll {Dla obu stron}
translate P AnnotateWhite {Dla biaych}
translate P AnnotateBlack {Dla czarnych}
translate P AnnotateNotBest {Tylko dla posuni lepszych ni w partii}

# Analysis Engine open dialog:
translate P EngineList {Programy szachowe}
translate P EngineName {Nazwa}
translate P EngineCmd {Polecenie}
translate P EngineArgs {Parametry} 
translate P EngineDir {Katalog}
translate P EngineElo {Elo}
translate P EngineTime {Data}
translate P EngineNew {Dodaj}
translate P EngineEdit {Edytuj}
translate P EngineRequired {Pola wytuszczone s konieczne; reszta opcjonalna} 

# Stats window menus:
menuText P StatsFile "Plik" 0
menuText P StatsFilePrint "Zapisz do pliku..." 7
menuText P StatsFileClose "Zamknij" 0
menuText P StatsOpt "Opcje" 0

# PGN window menus:
menuText P PgnFile "Plik" 0
menuText P PgnFilePrint "Zapisz do pliku..." 7
menuText P PgnFileClose "Zamknij" 0
menuText P PgnOpt "Wygld" 0
menuText P PgnOptColor "Wywietlanie w kolorach" 0
menuText P PgnOptShort "Krtki (3-wierszowy) nagwek" 0
menuText P PgnOptSymbols "Symbole Informatora" 0
menuText P PgnOptIndentC "Wcinaj komentarze" 7
menuText P PgnOptIndentV "Wcinaj warianty" 7
menuText P PgnOptColumn "Kolumny (jedno posunicie w wierszu)" 0
menuText P PgnOptSpace "Spacja po numerze ruchu" 0
menuText P PgnOptStripMarks "Usu kody kolorowych pl i strzaek" 0
menuText P PgnColor "Kolory" 0
menuText P PgnColorHeader "Nagwek..." 0
menuText P PgnColorAnno "Uwagi..." 3
menuText P PgnColorComments "Komentarze..." 0
menuText P PgnColorVars "Warianty..." 0
menuText P PgnColorBackground "To..." 0
menuText P PgnHelp "Pomoc" 2
menuText P PgnHelpPgn "PGN" 0
menuText P PgnHelpIndex "Spis treci" 0

# Crosstable window menus:
menuText P CrosstabFile "Plik" 0
menuText P CrosstabFileText "Zapisz w pliku tekstowym..." 15
menuText P CrosstabFileHtml "Zapisz w pliku HTML..." 15
menuText P CrosstabFileLaTeX "Zapisz w pliku LaTeX-a..." 15
menuText P CrosstabFileClose "Zamknij" 0
menuText P CrosstabEdit "Edytuj" 0
menuText P CrosstabEditEvent "Turniej" 0
menuText P CrosstabEditSite "Miejsce" 0
menuText P CrosstabEditDate "Data" 0
menuText P CrosstabOpt "Wywietlanie" 0
menuText P CrosstabOptAll "Turniej koowy" 0
menuText P CrosstabOptSwiss "Szwajcar" 0
menuText P CrosstabOptKnockout "Knockout" 0
menuText P CrosstabOptAuto "Automatycznie" 0
menuText P CrosstabOptAges "Wiek" 0
menuText P CrosstabOptNats "Narodowo" 0
menuText P CrosstabOptRatings "Ranking" 0
menuText P CrosstabOptTitles "Tytu" 0
menuText P CrosstabOptBreaks "Punkty pomocnicze" 1
menuText P CrosstabOptDeleted "Uwzgldniaj usunite partie" 0
menuText P CrosstabOptColors "Kolory (tylko szwajcar)" 0
menuText P CrosstabOptColumnNumbers "Numerowane kolumny (tylko turniej koowy)" 0
menuText P CrosstabOptGroup "Grupuj po liczbie punktw" 0
menuText P CrosstabSort "Sortowanie" 0
menuText P CrosstabSortName "Nazwisko" 0
menuText P CrosstabSortRating "Ranking" 0
menuText P CrosstabSortScore "Punkty" 0
menuText P CrosstabColor "Kolor" 0
menuText P CrosstabColorPlain "Zwyky tekst" 0
menuText P CrosstabColorHyper "Hipertekst" 0
menuText P CrosstabHelp "Pomoc" 2
menuText P CrosstabHelpCross "Tabela turniejowa" 0
menuText P CrosstabHelpIndex "Spis treci" 0
translate P SetFilter {Ustaw filtr}
translate P AddToFilter {Dodaj do filtra}
translate P Swiss {Szwajcar}

# Opening report window menus:
menuText P OprepFile "Plik" 0
menuText P OprepFileText "Zapisz w pliku tekstowym..." 15
menuText P OprepFileHtml "Zapisz w pliku HTML..." 15
menuText P OprepFileLaTeX "Zapisz w pliku LaTeX-a..." 15
menuText P OprepFileOptions "Opcje" 2
menuText P OprepFileClose "Zamknij okno raportu" 0
menuText P OprepHelp "Pomoc" 2
menuText P OprepHelpReport "Pomoc raportu debiutowego" 0
menuText P OprepHelpIndex "Spis treci" 0

# Repertoire editor:
menuText P RepFile "Plik" 0
menuText P RepFileNew "Nowy" 0
menuText P RepFileOpen "Otwrz..." 0
menuText P RepFileSave "Zapisz" 0
menuText P RepFileSaveAs "Zapisz jako..." 7
menuText P RepFileClose "Zamknij" 3
menuText P RepEdit "Edytuj" 0
menuText P RepEditGroup "Dodaj grup" 6
menuText P RepEditInclude "Wcz wariant" 0
menuText P RepEditExclude "Wycz wariant" 1
menuText P RepView "Widok" 0
menuText P RepViewExpand "Rozwi wszystkie grupy" 0
menuText P RepViewCollapse "Zwi wszystkie grupy" 0
menuText P RepSearch "Szukaj" 0
menuText P RepSearchAll "Wszystkie warianty..." 0
menuText P RepSearchDisplayed "Tylko widoczne warianty..." 0
menuText P RepHelp "Pomoc" 2
menuText P RepHelpRep "Repertuar debiutowy" 0
menuText P RepHelpIndex "Spis treci" 0
translate P RepSearch "Poszukiwanie wariantw"
translate P RepIncludedLines "wczone warianty"
translate P RepExcludedLines "wyczone warianty"
translate P RepCloseDialog {Ten repertuar ma niezapisane zmiany.

Na pewno zamkn repertuar, rezygnujc z wszelkich zmian?
}

# Header search:
translate P HeaderSearch {Wyszukiwanie wg nagwka}
translate P GamesWithNoECO {Partie bez ECO?}
translate P GameLength {Dugo}
translate P FindGamesWith {Znajd partie}
translate P StdStart {caa partia}
translate P Promotions {z promocj}
translate P Comments {Komentarze}
translate P Variations {Warianty}
translate P Annotations {Uwagi}
translate P DeleteFlag {Usuwanie}
translate P WhiteOpFlag {Debiut - biae}
translate P BlackOpFlag {Debiut - czarne}
translate P MiddlegameFlag {Gra rodkowa}
translate P EndgameFlag {Kocwka}
translate P NoveltyFlag {Nowinka}
translate P PawnFlag {Struktura pionowa}
translate P TacticsFlag {Taktyka}
translate P QsideFlag {Gra na skrzydle hetmaskim}
translate P KsideFlag {Gra na skrzydle krlewskim}
translate P BrilliancyFlag {Nagroda za pikno}
translate P BlunderFlag {Podstawka}
translate P UserFlag {Inne}
translate P PgnContains {PGN zawiera tekst}

# Game list window:
translate P GlistNumber {Numer}
translate P GlistWhite {Biae}
translate P GlistBlack {Czarne}
translate P GlistWElo {B-Elo}
translate P GlistBElo {C-Elo}
translate P GlistEvent {Turniej}
translate P GlistSite {Miejsce}
translate P GlistRound {Runda}
translate P GlistDate {Data}
translate P GlistYear {Rok}
translate P GlistEDate {Turniej-Data}
translate P GlistResult {Wynik}
translate P GlistLength {Dugo}
translate P GlistCountry {Kraj}
translate P GlistECO {ECO}
translate P GlistOpening {Debiut}
translate P GlistEndMaterial {Materia}
translate P GlistDeleted {Usunita}
translate P GlistFlags {Oznaczenie}
translate P GlistVars {Warianty}
translate P GlistComments {Komentarze}
translate P GlistAnnos {Uwagi}
translate P GlistStart {Pozycja pocztkowa}
translate P GlistGameNumber {Numer partii}
translate P GlistFindText {Znajd tekst}
translate P GlistMoveField {Przesu}
translate P GlistEditField {Konfiguruj}
translate P GlistAddField {Dodaj}
translate P GlistDeleteField {Usu}
translate P GlistWidth {Szeroko}
translate P GlistAlign {Wyrwnanie}
translate P GlistColor {Kolor}
translate P GlistSep {Separator}

# Maintenance window:
translate P DatabaseName {Nazwa bazy:}
translate P TypeIcon {Ikona:}
translate P NumOfGames {Liczba partii:}
translate P NumDeletedGames {Liczba usunitych partii:}
translate P NumFilterGames {Liczba partii w filtrze:}
translate P YearRange {Data:}
translate P RatingRange {Ranking:}
translate P Flag {Oznaczenie:}
translate P DeleteCurrent {Usu aktualn parti}
translate P DeleteFilter {Usu partie z filtra}
translate P DeleteAll {Usu wszystkie partie}
translate P UndeleteCurrent {Odzyskaj aktualn parti}
translate P UndeleteFilter {Odzyskaj partie z filtra}
translate P UndeleteAll {Odzyskaj wszystkie partie}
translate P DeleteTwins {Usu powtrzone partie}
translate P MarkCurrent {Zaznacz aktualn parti}
translate P MarkFilter {Zaznacz partie z filtra}
translate P MarkAll {Zaznacz wszystkie partie z filtra}
translate P UnmarkCurrent {Usu zaznaczenie aktualnej partii}
translate P UnmarkFilter {Usu zaznaczenie partii z filtra}
translate P UnmarkAll {Usu zaznaczenie wszystkich partii}
translate P Spellchecking {Pisownia}
translate P Players {Zawodnicy}
translate P Events {Turnieje}
translate P Sites {Miejsca}
translate P Rounds {Rundy}
translate P DatabaseOps {Operacje bazodanowe}
translate P ReclassifyGames {Klasyfikacja debiutowa}
translate P CompactDatabase {Uporzdkuj baz}
translate P SortDatabase {Sortuj baz}
translate P AddEloRatings {Dodaj rankingi ELO}
translate P AutoloadGame {Domylna partia}
translate P StripTags {Strip PGN tags} ;# ***
translate P StripTag {Strip tag} ;# ***
translate P Cleaner {Zestaw zada}
translate P CleanerHelp {
Zestaw zada pozwala wykona od razu kilka operacji porzdkowania bazy. Operacje wybrane z listy
zostan wykonane na aktualnej bazie.

Do klasyfikacji debiutowej i usuwania powtrzonych partii uyte zostan aktualne ustawienia.
}
translate P CleanerConfirm {
Kiedy wykonanie zestawu zada zostanie rozpoczte, nie bdzie mona ju go przerwa.

Na duej bazie moe to zaj duo czasu (zaley to rwnie od wybranego zestawu zada i ich
ustawie).

Na pewno wykona wybrane zadania?
}

# Comment editor:
translate P AnnotationSymbols  {Symbole:}
translate P Comment {Komentarz:}

# Board search:
translate P BoardSearch {Wyszukiwanie wg pozycji}
translate P FilterOperation {Operacje na aktualnym filtrze:}
translate P FilterAnd {I (ogranicz filtr)}
translate P FilterOr {LUB (dodaj do filtr)}
translate P FilterIgnore {NOWY (ignoruj poprzedni filtr)}
translate P SearchType {Typ wyszukiwania:}
translate P SearchBoardExact {Identyczna pozycja (bierki na tych samych polach)}
translate P SearchBoardPawns {Pionki (ten sam materia, pionki na tych samych polach)}
translate P SearchBoardFiles {Kolumny (ten sam materia, pionki na tych samych kolumnach)}
translate P SearchBoardAny {Materia (ten sam materia, pozycja dowolna)}
translate P LookInVars {Przeszukuj warianty}

# Material search:
translate P MaterialSearch {Wyszukiwanie wg materiau}
translate P Material {Materia}
translate P Patterns {Wzorce}
translate P Zero {Brak}
translate P Any {Dowolny}
translate P CurrentBoard {Aktualna pozycja}
translate P CommonEndings {Typowe kocwki}
translate P CommonPatterns {Typowe wzorce}
translate P MaterialDiff {Przewaga materialna}
translate P squares {pola}
translate P SameColor {jednopolowe}
translate P OppColor {rnopolowe}
translate P Either {dowolne}
translate P MoveNumberRange {Zakres posuni}
translate P MatchForAtLeast {Pasuje min.}
translate P HalfMoves {pruchy}

# Game saving:
translate P Today {Dzisiaj}
translate P ClassifyGame {Klasyfikacja debiutowa}

# Setup position:
translate P EmptyBoard {Pusta szachownica}
translate P InitialBoard {Pozycja pocztkowa}
translate P SideToMove {Na posuniciu}
translate P MoveNumber {Posunicie nr}
translate P Castling {Roszada}
translate P EnPassentFile {Bicie w przelocie}
translate P ClearFen {Kopiuj FEN}
translate P PasteFen {Wklej pozycj FEN}

# Replace move dialog:
translate P ReplaceMove {Zmie posunicie}
translate P AddNewVar {Dodaj wariant}
translate P ReplaceMoveMessage {Posunicie ju istnieje.

Moesz je zastpi, usuwajc dalszy cig partii lub doda nowy wariant.

(Mona wyczy to ostrzeenie, wyczajc opcj  "Zapytaj przed zastpieniem posuni" w menu
Opcje:Posunicia)}

# Make database read-only dialog:
translate P ReadOnlyDialog {Jeli zabezpieczysz t baz przed zapisem, zmiany bd zablokowane
adna partia nie bdzie zapisana ani zmodyfikowana, adne flagi nie bd zmienione.
Sortowanie i klasyfikacja debiutowa bd tylko tymczasowe.

eby usun zabezpieczenie przez zapisem, wystarczy zamkn baz i otworzy j ponownie.

Na pewno zabezpieczy baz przed zapisem?}

# Clear game dialog:
translate P ClearGameDialog {Partia zostaa zmieniona.

Na pewno kontynuowa, rezygnujc z wszelkich zmian?
}

# Exit dialog:
translate P ExitDialog {Na pewno zakoczy prac z programem?}
translate P ExitUnsaved {Nastpujce bazy zawieraj niezapisane zmiany. 
Jeli zamkniesz program teraz, zmiany zostan utracone.} 

# Import window:
translate P PasteCurrentGame {Wklej aktualn parti}
translate P ImportHelp1 {Wprowad lub wklej parti w formacie PGN w ponisz ramk.}
translate P ImportHelp2 {Tu bd wywietlane bdy przy importowaniu partii.}

# ECO Browser:
translate P ECOAllSections {Wszystkie kody ECO}
translate P ECOSection {Cz ECO}
translate P ECOSummary {Podsumowanie dla}
translate P ECOFrequency {Czstoci kodw dla}

# Opening Report:
translate P OprepTitle {Raport debiutowy}
translate P OprepReport {Raport}
translate P OprepGenerated {Utworzony przez}
translate P OprepStatsHist {Statystyka i historia}
translate P OprepStats {Statystyka}
translate P OprepStatAll {Wszystkie partie}
translate P OprepStatBoth {Obaj zawodnicy z Elo}
translate P OprepStatSince {Od}
translate P OprepOldest {Najdawniejsze partie}
translate P OprepNewest {Ostatnie partie}
translate P OprepPopular {Popularno}
translate P OprepFreqAll {Czsto w caej bazie:         }
translate P OprepFreq1   {W ostatnim roku:                }
translate P OprepFreq5   {W ostatnich piciu latach:      }
translate P OprepFreq10  {W ostatnich dziesiciu latach:  }
translate P OprepEvery {co %u partii}
translate P OprepUp {wicej o %u%s ni w caej bazie}
translate P OprepDown {mniej o %u%s ni w caej bazie}
translate P OprepSame {jak w caej bazie}
translate P OprepMostFrequent {Zawodnicy najczciej grajcy wariant}
translate P OprepRatingsPerf {Rankingi i wyniki}
translate P OprepAvgPerf {rednie rankingi i wyniki}
translate P OprepWRating {Ranking biaych}
translate P OprepBRating {Ranking czarnych}
translate P OprepWPerf {Wynik biaych}
translate P OprepBPerf {Wynik czarnych}
translate P OprepHighRating {Partie graczy o najwyszym rednim rankingu}
translate P OprepTrends {Wyniki}
translate P OprepResults {Dugo partii i czstoci}
translate P OprepLength {Dugo partii}
translate P OprepFrequency {Czsto}
translate P OprepWWins {Zwycistwa biaych:  }
translate P OprepBWins {Zwycistwa czarnych: }
translate P OprepDraws {Remisy:              }
translate P OprepWholeDB {caa baza}
translate P OprepShortest {Najkrtsze zwycistwa}
translate P OprepMovesThemes {Posunicia i motywy}
translate P OprepMoveOrders {Posunicia prowadzce do badanej pozycji}
translate P OprepMoveOrdersOne \
  {Badana pozycja powstawaa jedynie po posuniciach:}
translate P OprepMoveOrdersAll \
  {Badana pozycja powstawaa na %u sposobw:}
translate P OprepMoveOrdersMany \
  {Badana pozycja powstawaa na %u sposobw. Najczstsze %u to:}
translate P OprepMovesFrom {Posunicia w badanej pozycji}
translate P OprepThemes {Motywy pozycyjne}
translate P OprepThemeDescription {Czsto wystpowania motyww w ruchu %u}
translate P OprepThemeSameCastling {Jednostronne roszady}
translate P OprepThemeOppCastling {Rnostronne roszady}
translate P OprepThemeNoCastling {Obie strony bez roszady}
translate P OprepThemeKPawnStorm {Atak pionowy na skrzydle krlewskim}
translate P OprepThemeQueenswap {Wymiana hetmanw}
translate P OprepThemeIQP {Izolowany pion d}
translate P OprepThemeWP567 {Biay pion na 5/6/7 linii}
translate P OprepThemeBP234 {Czarny pion na 2/3/4 linii}
translate P OprepThemeOpenCDE {Otwarta kolumna c/d/e}
translate P OprepTheme1BishopPair {Jedna ze stron ma par gocw}
translate P OprepEndgames {Kocwki}
translate P OprepReportGames {Partie raportu}
translate P OprepAllGames {Wszystkie partie}
translate P OprepEndClass {Materia w pozycji kocowej}
translate P OprepTheoryTable {Teoria}
translate P OprepTableComment {Utworzono z %u partii o najwyszym rednim rankingu.}
translate P OprepExtraMoves {Dodatkowe posunicia w przypisach}
translate P OprepMaxGames {Maksymalna liczba partii w teorii}

# Piece Tracker window:
translate P TrackerSelectSingle {Lewy przycisk wybiera t figur.} ;# ***
translate P TrackerSelectPair {Lewy przycisk wybiera t figur; prawy obie takie figury.}
translate P TrackerSelectPawn {Lewy przycisk wybiera tego piona; prawy wszystkie 8 pionw.}
translate P TrackerStat {Statystyka}
translate P TrackerGames {% partie z posuniciem na tym pole}
translate P TrackerTime {% czasu na tym polu}
translate P TrackerMoves {Posunicia}
translate P TrackerMovesStart {Podaj numer posunicia, od ktrego zacz ledzenie.}
translate P TrackerMovesStop {Podaj numer posunicia, na ktrym skoczy ledzenie.}

# Game selection dialogs:
translate P SelectAllGames {Wszystkie partie w bazie}
translate P SelectFilterGames {Partie w filtrze}
translate P SelectTournamentGames {Tylko partie z aktualnego turnieju}
translate P SelectOlderGames {Tylko wczeniejsze partie}

# Delete Twins window:
translate P TwinsNote {Partie zostan uznane za identyczne, jeli zostay rozegrane przez tych
samych graczy i speniaj ustawione poniej kryteria. Krtsza z partii zostanie usunita.
Uwaga: dobrze przez wyszukaniem powtrzonych partii sprawdzi pisowni nazwisk.}
translate P TwinsCriteria {Kryteria: co musi by jednakowe w obu partiach?}
translate P TwinsWhich {Przeszukiwane partie}
translate P TwinsColors {Kolory}
translate P TwinsEvent {Turniej:}
translate P TwinsSite {Miejsce:}
translate P TwinsRound {Runda:}
translate P TwinsYear {Rok:}
translate P TwinsMonth {Miesic:}
translate P TwinsDay {Dzie:}
translate P TwinsResult {Wynik:}
translate P TwinsECO {Kod ECO:}
translate P TwinsMoves {Posunicia:}
translate P TwinsPlayers {Porwnywanie nazwisk:}
translate P TwinsPlayersExact {Dokadne}
translate P TwinsPlayersPrefix {Tylko pierwsze 4 litery}
translate P TwinsWhen {Usuwanie znalezionych powtrzonych partii}
translate P TwinsSkipShort {Pomija partie krtsze ni 5 posuni?}
translate P TwinsUndelete {Odzyska wszystkie partie przed poszukiwaniem?}
translate P TwinsSetFilter {Wstawi wszystkie usunite partie do filtra?}
translate P TwinsComments {Zawsze zachowywa partie komentowane?}
translate P TwinsVars {Zawsze zachowywa partie z wariantami?}
translate P TwinsDeleteWhich {Ktr parti usun:} 
translate P TwinsDeleteShorter {Krtsz} 
translate P TwinsDeleteOlder {O niszym numerze}
translate P TwinsDeleteNewer {O wyszym numerze}
translate P TwinsDelete {Usu partie}

# Name editor window:
translate P NameEditType {Nazwa do wyboru}
translate P NameEditSelect {Partie do edycji}
translate P NameEditReplace {Zastp}
translate P NameEditWith {przez}
translate P NameEditMatches {Pasujce: Ctrl+1 do Ctrl+9 wybiera}

# Classify window:
translate P Classify {Przyporzdkowanie ECO}
translate P ClassifyWhich {Partie do przyporzdkowania ECO}
translate P ClassifyAll {Wszystkie partie (zmiana starych kodw ECO)}
translate P ClassifyYear {Wszystkie partie z ostatniego roku}
translate P ClassifyMonth {Wszystkie partie z ostatniego miesica}
translate P ClassifyNew {Tylko partie bez kodu ECO}
translate P ClassifyCodes {Kody ECO}
translate P ClassifyBasic {Tylko podstawowe ("B12", ...)}
translate P ClassifyExtended {Rozszerzone kody Scida ("B12j", ...)}

# Compaction:
translate P NameFile {Plik nazw}
translate P GameFile {Plik z partiami}
translate P Names {Nazwy}
translate P Unused {Nieuywane}
translate P SizeKb {Rozmiar (kb)}
translate P CurrentState {Status}
translate P AfterCompaction {Po uporzdkowaniu}
translate P CompactNames {Uporzdkuj nazwy}
translate P CompactGames {Uporzdkuj partie}

# Sorting:
translate P SortCriteria {Kryteria sortowania}
translate P AddCriteria {Dodaj kryteria}
translate P CommonSorts {Standardowe kryteria}
translate P Sort {Sortuj}

# Exporting:
translate P AddToExistingFile {Doda partie do pliku?}
translate P ExportComments {Eksportowa komentarze?}
translate P ExportVariations {Eksportowa warianty?}
translate P IndentComments {Wcinaj komentarze?}
translate P IndentVariations {Wcinaj warianty?}
translate P ExportColumnStyle {Kolumny (jedno posunicie w wierszu)?}
translate P ExportSymbolStyle {Styl znakw komentarza:}
translate P ExportStripMarks {Usuwa z komentarzy kody kolorowania pl/strzaek?} 

# Goto game/move dialogs:
translate P LoadGameNumber {Podaj numer partii do wczytania:}
translate P GotoMoveNumber {Id do posunicia nr:}

# Copy games dialog:
translate P CopyGames {Kopiuj partie}
translate P CopyConfirm {
 Czy na pewno skopiowa
 [thousands $nGamesToCopy] partii z filtra
 w bazie "$fromName"
 do bazy "$targetName"?
}
translate P CopyErr {Nie mona skopiowa partii}
translate P CopyErrSource {baza rdowa}
translate P CopyErrTarget {baza docelowa}
translate P CopyErrNoGames {nie ma partii w filtrze}
translate P CopyErrReadOnly {jest tylko do odczytu}
translate P CopyErrNotOpen {nie jest otwarta}

# Colors:
translate P LightSquares {Jasne pola}
translate P DarkSquares {Ciemne pola}
translate P SelectedSquares {Wybrane pola}
translate P SuggestedSquares {Wybrane posunicie}
translate P WhitePieces {Biae figury}
translate P BlackPieces {Czarne figury}
translate P WhiteBorder {Kontur biaych figur}
translate P BlackBorder {Kontur czarnych figur}

# Novelty window:
translate P FindNovelty {Znajd nowink}
translate P Novelty {Nowinka}
translate P NoveltyInterrupt {Poszukiwanie nowinki przerwano}
translate P NoveltyNone {Nie znaleziono nowinki w partii}
translate P NoveltyHelp {
Scid znajdzie pierwsze posunicie w partii, po ktrym powstanie pozycja niewystpujca ani w bazie, ani w ksice debiutowej.
}

# Upgrading databases:
translate P Upgrading {Konwersja}
translate P ConfirmOpenNew {
Ta baza jest zapisana w starym formacie (Scid 2) i nie moe zosta otwarta w nowszej wersji
Scid-a. Baza zostaa ju automatycznie przekonwertowana do nowego formatu.

Czy otworzy now wersj bazy?
}
translate P ConfirmUpgrade {
Ta baza jest zapisana w starym formacie (Scid 2) i nie moe zosta otwarta w nowszej wersji Scid-a. eby mc otworzy baz, trzeba przekonwertowa j do nowego formatu.

Konwersja utworzy now wersj bazy - stara wersja nie zostanie zmieniona ani usunita.

Moe to zaj troch czasu, ale jest to operacja jednorazowa. Moesz j przerwa, jeli potrwa za dugo.

Przekonwertowa baz?
}

# Recent files options:
translate P RecentFilesMenu {Number of recent files in File menu} ;# ***
translate P RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}

### Tips of the day in Polish:

set tips(P) {
  {
    Scid ma ponad 30 <a Index>stron pomocy</a> i w wikszoci okien Scida
    nacinicie klawisza <b>F1</b> spowoduje wywietlenie odpowiedniej
    strony.
  }
  {
    Niektre okna Scida (np. informacje pod szachownic,
    <a Switcher>przecznik baz</a>) maj menu przywoywane prawym przyciskiem
    myszy. Sprbuj nacisn prawy przycisk myszy w kadym oknie, by
    sprawdzi, czy menu jest dostpne i jakie funkcje zawiera.
  }
  {
    Scid pozwala wprowadza posunicia na kilka rnych sposobw.
    Moesz uy myszy (z wywietlaniem moliwych posuni lub bez)
    albo klawiatury (z opcjonalnym automatycznym dopenianiem).
    Wicej informacji mona znale na stronie pomocy
    <a Moves>Wprowadzenie posuni</a>.
  }
  {
    Jeli masz kilka baz, ktre otwierasz czsto, dodaj
    <a Bookmarks>zakadk</a> dla kadej z nich. Umoliwi to atwe
    otwieranie baz z menu.
  }
  {
    Moesz obejrze wszystkie posunicia w aktualnej partii
    (z wariantami i komentarzami lub bez) w <a PGN>Oknie PGN</a>.
    W oknie PGN moesz przej do dowolnego posunicia, klikajc
    na nim lewym przyciskiem myszy oraz uy rodkowego lub prawego
    przycisku myszy do obejrzenia aktualnej pozycji.
  }
  {
    Moesz kopiowa partie z bazy do bazy przecigajc je lewym
    przyciskiem myszy w oknie <a Switcher>Przecznika baz</a>.
  }
  {
    Scid moe otwiera pliki PGN, nawet jeli s one skompresowane
    Gzip-em (z rozszerzeniem .gz). Pliki PGN mog by jedynie
    czytane, wic jeli chcesz co zmieni, utwrz now baz Scida
    i skopiuj do niej partie z pliku PGN.
  }
  {
    Jeli masz du baz i czsto uywasz okna <a Tree>Drzewa wariantw</a>,
    warto wybra polecenie <b>Twrz standardowy plik cache/b>
    z menu Plik okna Drzewo wariantw. Statystyki dla najpopularniejszych
    pozycji debiutowych zostan zapamitane w pliku, co przyspieszy
    dziaanie drzewa.
  }
  {
    <a Tree>Drzewo wariantw</a> moe pokaza wszystkie posunicia
    z aktualnej pozycji, ale jeli chcesz zobaczy wszystkie kolejnoci
    posuni prowadzce do aktualnej pozycji, moesz uy
    <a OpReport>Raportu debiutowego</a>.
  }
  {
    W <a GameList>licie partii</a> kliknij lewym lub prawym przyciskiem
    myszy na nagwku wybranej kolumny, by zmieni jej szeroko.
  }
  {
    W oknie <a PInfo>Informacja o graczu</a> (kliknij na nazwisku gracza
    w polu pod szachownic, by je otworzy) moesz atwo ustawi
    <a Searches Filter>filtr</a> zawierajcy wszystkie partie danego
    gracza zakoczeone wybranym wynikiem, klikajc na dowolnej wartoci
    wywietlanej na <red>czerowono</red>.
  }
  {
    Podczas pracy nad debiutem warto uy funkcji
    <a Searches Board>wyszukiwania pozycji</a> z opcj <b>Pionki</b> lub
    <b>Kolumny</b>. Pozowli to znale inne warianty debiutowe z t
    sam struktur pionow.
  }
  {
    W polu informacji o partii (pod szachownic) mona uy prawego
    przycisku myszy, by wywietli menu konfiguracji pola. Mona
    np. ukry nastpne posunicie, co jest przydatne przy rozwizywaniu
    zada.
  }
  {
    Jeli czsto uywasz funkcji <a Maintenance>obsugi</a> na duej
    bazie, moesz uy okna <a Maintenance Cleaner>Zestaw zada</a>
    do wykonania kilka funkcji naraz.
  }
  {
    Jeli masz du baz, w ktrej wikszo partii ma ustawiony
    znacznik EventDate, moesz <a Sorting>posortowa</a> j
    wg tego znacznika (zamiast Daty). Dziki temu wszystkie partie
    z jednego turnieju znajd si koo siebie.
  }
  {
    Przed uyciem funkcji <a Maintenance Twins>usuwania podwjnych partii</a>
    dobrze jest <a Maintenance Spellcheck>sprawdzi pisowni</a>
    nazwisk w bazie, co usprawni wyszukiwanie powtrze.
  }
  {
    <a Flags>Flagi</a> s przydatne do oznaczania partii, ktre
    zawieraj wane motywy taktyczne, strkutury pionowe, nowinki itd.
    Potem moesz znale takie partie
    <a Searches Header>wyszukiwaniem wg nagwka</a>.
  }
  {
    Jeli przegldasz parti i chcesz sprawdzi jaki wariant nie
    zmieniajc partii, moesz wczy tryb testowania wariantu
    (klawisz <b>Ctrl+spacja</b> lub ikona na pasku narzdziowym).
    Po wyczeniu trybu testowania powrcisz do pozycji z partii.
  }
  {
    eby znale najwaniejsze partie (z najsilniejszymi przeciwnikami),
    w ktrych powstaa aktualna pozycja, otwrz <a Tree>Drzewo wariantw</a>
    i wybierz list najlepszych partii. Moesz nawet wybra tylko
    partie zakoczone konkretnym wynikiem.
  }
  {
    Dobr metod na nauk debiutu przy uyciu duej bazy jest
    wczenie trybu treningu w <a Tree>Drzewie wariantw</a>
    i gra z programem. Pozwala to sprawdzi, ktre posunicia s
    grane najczciej.
  }
  {
    Jeli masz otwarte dwie bazy i chcesz obejrze
    <a Tree>Drzewo wariantw</a> dla pierwszej bazy, przegldajc
    parti z drugiej, kliknij przycisk <b>Blokada</b> na drzewie,
    by zablokowa je na pierwszej bazie, a nastpnie przecz si
    do drugiej bazy.
  }
  {
    Okno <a Tmt>Turnieje</a> jest przydatne nie tylko do znajdowania
    turniejw, ale pozwala take sprawdzi, w jakich turniejach gra
    ostatnio dany zawodnik i jakie turnieje s rozgrywane w wybranym
    kraju.
  }
  {
    Moesz uy jednego z wielu typowych wzorcw w oknie
    <a Searches Material>Wyszukiwania wg materiau</a> do znalezienia
    partii do studiowania debiutw lub gry rodkowej.
  }
  {
    W oknie <a Searches Material>Wyszukiwanie wg materiau</a>, moesz
    ograniczy liczb znajdowanych partii przez warunek, by
    podany stosunek materiau utrzymywa si przynajmniej przez
    kilka pruchw.
  }
  {
    Jeli masz wan baz, ktrej nie chcesz przez przypadek zmieni,
    wcz <b>Tylko do odczytu...</b> w menu <b>Plik</b> po jej otwarciu
    (albo zmie prawa dostpu do pliku).
  }
  {
    Jeli uywasz XBoard-a lub WinBoard-a (albo programu szachowego,
    ktry pozwala na skopiowania pozycji w notacji FEN do schowka)
    i chcesz skopiowa aktualn pozycj do Scid-a, wybierz
    <b>Copy position</b> w menu File programu XBoard/Winboard, a potem
    <b>Wklej aktywn parti ze schowka</b> z menu Edycja Scid-a.
  }
  {
    W oknie <a Searches Header>Wyszukiwanie wg nagwka</a>,
    szukane nazwy graczy/turnieju/miejsca/rundy s znajdowane niezalenie
    od wielkoci liter i rwnie wewntrz nazw.
    Zamiast tego moesz uy poszukiwania z symbolami wieloznacznymi
    (gdzie "?" oznacza dowolny znak, za "*" - 0 lub wicej znakw),
    wpisujc szukany tekst w cudzysowie. Wielko liter zostanie
    uwzgldniona. Na przykad "*BEL" znajdzie wszystkie turnieje grane
    w Belgii (ale nie w Belgradzie).
  }
  {
    Jeli chcesz poprawi posunicie nie zmieniajc nastpnych,
    otwrz okno <a Import>Pobierz parti</a>, wcinij
    <b>Wklej aktualn parti</b>, zmie bdne posunicie i wcinij
    <b>Pobierz</b>.
  }
  {
    Jeli plik klasyfikacji debiutowej ECO jest wczytany, moesz przej
    do ostatniej sklasyfikowanej pozycji w partii za pomoc polecenia
    <b>Rozpoznaj debiut</b> w menu <b>Partia</b> (klawisz Ctrl+Shift+D).
  }
  {
    Jeli chcesz sprawdzi wielko lub dat modyfikacji pliku
    przed jego otwarciem, uyj okna <a Finder>Poszukiwacza plikw</a>.
  }
  {
    Plik<a Repertoire>repertuaru debiutowego</a> pozwala na ledzenie
    partii w ulubionych wariantach. Kiedy dodasz grane przez siebie
    debiuty do pliku repertuaru debiutowego, bdziesz mg atwo
    znajdowa je w nowych partiach.
  }
  {
    <a OpReport>Raport debiutowy</a> pozwala dowiedzie si wicej
    o konkretnej pozycji. Moesz zobaczy wyniki, nazwiska najczciej
    grajcych j zawodnikw, typowe motywy pozycyjne itd.
  }
  {
    Moesz doda wikszo typowych symboli (!, !?, += itd.) do
    aktualnego posunicia lub pozycji za pomoc skrtw klawiszowych,
    bez potrzeby otwierania okna <a Comment>Edytora komentarzy</a>
    -- np. wcinicie "!" i Enter spowoduje dodanie symbolu "!".
    Na stronie <a Moves>Wprowadzanie posuni</a> mona znale
    wicej informacji.
  }
  {
    Moesz atwo przeglda debiuty w bazie w oknie
    <a Tree>Drzewo wariantw</a>. W oknie Statystyka (klawisz Ctrl+I)
    mona znale informacje o ostatnich wynikach w wariancie oraz
    o partiach granych przez silnych graczy.
  }
  {
    Moesz zmieni wielko szachownicy, naciskajc <b>lewo</b> lub <b>prawo</b>
    przy wcinitych klawiszach <b>Ctrl</b> i <b>Shift</b>.
  }
  {
    Po <a Searches>wyszukiwaniu</a> moesz atwo przeglda wszystkie
    znalezione partie, naciskajc klawisz <b>gra</b> lub <b>d</b>
    przy wcinitym <b>Ctrl</b> by obejrze poprzedni/nastpn parti
    w filtrze.
  }
}

# end of polish.tcl


# czech.tcl: Czech menus for Scid.
# By Pavel Hanak.
# Untranslated messages are marked with a "***" comment.

addLanguage C Czech 0 iso8859-2

proc setLanguage_C {} {

# File menu:
menuText C File "Soubor" 0
menuText C FileNew "Nov..." 0 {Vytvoit novou Scid databzi}
menuText C FileOpen "Otevt..." 0 {Otevt existujc Scid databzi}
menuText C FileClose "Zavt" 0 {Zavt aktivn Scid databzi}
menuText C FileFinder "Vyhledva" 0 {Otevt okno Vyhledva soubor}
menuText C FileBookmarks "Zloky" 0 {Menu zloek (klvesa: Ctrl+B)}
menuText C FileBookmarksAdd "Pidat zloku" 0 \
  {Zloka aktuln pozice a partie z databze}
menuText C FileBookmarksFile "Zaadit zloku" 0 \
  {Zaadit zloku pro aktuln partii a pozici}
menuText C FileBookmarksEdit "Editovat zloky..." 0 \
  {Editovat menu zloek}
menuText C FileBookmarksList "Zobrazit sloky jako jedin seznam" 0 \
  {Zobrazit sloky se zlokami jako jedin seznam, bez podnabdek}
menuText C FileBookmarksSub "Zobrazit sloky jako podnabdky" 0 \
  {Zobrazit zlokov sloky jako podnabdky, ne jako jedin seznam}
menuText C FileMaint "drba" 1 {Nstroje pro drbu Scid databze}
menuText C FileMaintWin "Okno drby" 0 \
  {Otevt/zavt okno pro drbu Scid databze}
menuText C FileMaintCompact "Komprimace databze..." 0 \
  {Komprimace databzovch soubor, odstrann vymazanch parti a nepouvanch jmen}
menuText C FileMaintClass "ECO klasifikace parti..." 0 \
  {Pepotn ECO kd vech her}
menuText C FileMaintSort "Setdit databzi..." 0 \
  {Stetdit vechny hry v databzi}
menuText C FileMaintDelete "Vymzn zdvojench parti..." 0 \
  {Hledat zdvojen partie a oznait je pro vymazn}
menuText C FileMaintTwin "Kontrola zdvojench parti" 0 \
  {Otevt/aktualizovat okno pro kontrolu zdvojench parti}
menuText C FileMaintName "Jmna" 0 {Editace jmen a kontrola pravopisu}
menuText C FileMaintNameEditor "Editor jmen" 0 \
  {Otevt/zavt editor jmen}
menuText C FileMaintNamePlayer "Kontrola pravopisu hr..." 11 \
  {Kontrola pravopisu jmen hr s vyuitm souboru spellcheck}
menuText C FileMaintNameEvent "Kontrola pravopisu turnaj..." 11 \
  {Kontrola pravopisu nzv turnaj s vyuitm souboru spellcheck}
menuText C FileMaintNameSite "Kontrola pravopisu dji..." 11 \
  {Kontrola pravopisu dji turnaj s vyuitm souboru spellcheck}
menuText C FileMaintNameRound "Kontrola pravopisu kol..." 11 \
  {Kontrola pravopisu kol s vyuitm souboru spellcheck}
menuText C FileReadOnly "Pouze pro ten..." 0 \
  {Nastavit u databze ochranu proti zpisu}
menuText C FileExit "Ukonit" 0 {Ukonit Scid}

# Edit menu:
menuText C Edit "Editace" 0
menuText C EditAdd "Pidat variantu" 0 {Pidat variantu k tomuto tahu v partii}
menuText C EditDelete "Vymazat variantu" 1 {Vymazat variantu k tomuto tahu}
menuText C EditFirst "Zaadit jako prvn variantu" 5 \
  {Zaadit variantu na prvn msto v seznamu variant}
menuText C EditMain "Povit stvajc variantu na hlavn" 21 \
  {Povit stvajc variantu na hlavn variantu}
menuText C EditTrial "Zkusit variantu" 0 \
    {Spustit/Ukonit zkuebn md pro testovn mylenky na achovnici}
menuText C EditStrip "Odstranit" 2 {Odstranit komente nebo varianty z tto partie}
menuText C EditStripComments "Komente" 0 \
  {Odstranit vechny poznmky a anotace z tto partie}
menuText C EditStripVars "Varianty" 0 {Odstranit vechny varianty z tto partie}
menuText C EditReset "Vyprzdnit schrnku" 0 \
  {Kompletn vyprzdnn schrnky}
menuText C EditCopy "Zkoprovat tuto partii do schrnky" 1 \
  {Zkoprovat tuto parti do schrnky s partiemi}
menuText C EditPaste "Vloit posledn partii ze schrnky" 1 \
  {Vloit aktivn partii ze schrnky}
menuText C EditSetup "Nastavit vchoz pozici..." 1 \
  {Nastavit vchoz pozici pro tuto partii}
menuText C EditPasteBoard "Vloit poten pozici" 12 \
  {Nastavit poten pozici z aktulnho textovho vbru (ze schrnky)}

# Game menu:
menuText C Game "Partie" 0
menuText C GameNew "Nov partie" 0 \
  {Nastavit novou partii, vechny proveden zmny budou ztraceny}
menuText C GameFirst "Nathnout prvn partii" 4 {Nathnout prvn partii z filtrovanch parti}
menuText C GamePrev "Nathnout pedchoz partii" 6 {Nathnout pedchoz partii z filtrovanch parti}
menuText C GameReload "Znovunathnout aktuln partii" 3 \
  {Znovunataen aktuln partie, vechny doposud proveden zmny budou ztraceny}
menuText C GameNext "Nathnout nsledujc partii" 13 {Nathnout nsledujc partii z filtrovanch parti}
menuText C GameLast "Nathnout posledn partii" 14 {Nathnout posledn partii z filtrovanch parti}
menuText C GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText C GameNumber "Nathnout partii slo..." 12 \
  {Nathnout partii slo...}
menuText C GameReplace "Uloit: pepsn partie..." 0 \
  {Uloit tuto partii - pepe pvodn verzi}
menuText C GameAdd "Uloit: pidn nov partie..." 18 \
  {Uloit tuto partii jako novou partii v databzi}
menuText C GameDeepest "Identifikace zahjen" 0 \
  {Pejt na koncovou pozici z ECO knihovny, kter odpovd zvolenmu zahjen}
menuText C GameGotoMove "Pejt na tah slo..." 3 \
  {Pejt v aktuln partii do pozice udan slem tahu}
menuText C GameNovelty "Hledat novinku..." 7 \
  {Hledat prvn tah tto partie, kter doposud nebyl hrn}

# Search Menu:
menuText C Search "Hledat" 0
menuText C SearchReset "Vyistit filtr" 0 {Vyistit filtr - vybrny budou vechny partie}
menuText C SearchNegate "Negace filtru" 0 {Negace filtru -  vybrny budou pouze partie vyat pedchzejcm filtrem}
menuText C SearchCurrent "Aktuln pozice..." 0 {Hledat aktuln pozici}
menuText C SearchHeader "Hlavika..." 1 {Hledat podle hlaviky partie (hr, turnaj apod.)}
menuText C SearchMaterial "Materil/Vzor..." 0 {Hledat podle materilu nebo podle pozice}
menuText C SearchUsing "Hledat pomoc souboru voleb..." 0 {Hledat s pouitm voleb zapsanch v souboru}

# Windows menu:
menuText C Windows "Okna" 0
menuText C WindowsComment "Editor koment" 0 {Otevt/zavt editor koment}
menuText C WindowsGList "Seznam parti" 0 {Otevt/zavt okno se seznamem parti}
menuText C WindowsPGN "Okno PGN" 0 {Otevt/zavt okno PGN (okno se zpisem partie)}
menuText C WindowsTmt "Vyhledva turnaj" 0 {Otevt/zavt okno vyhledvae turnaj}
menuText C WindowsSwitcher "Vbr databze" 0 {Otevt/zavt okno pro vbr databz}
menuText C WindowsMaint "Okno drby" 1 {Otevt/zavt okno drby}
menuText C WindowsECO "ECO prohle" 1 {Otevt/zavt browser ECO (kd zahjen)}
menuText C WindowsRepertoire "Editor repertoru" 0 {Otevt/zavt editor repertoru zahjen}
menuText C WindowsStats "Statistick okno" 1 {Otevt/zavt okno se statistikou}
menuText C WindowsTree "Stromov okno" 2 {Otevt/zavt okno se stromem variant}
menuText C WindowsTB "Okno tabulky koncovek" 1 {Otevt/zavt okno tabulky koncovek}

# Tools menu:
menuText C Tools "Nstroje" 0
menuText C ToolsAnalysis "Program pro analzu..." 5 \
  {Spustit/zastavit achov program pro analzu pozice}
menuText C ToolsAnalysis2 "Program pro analzu #2..." 20 \
  {Spustit/zastavit achov program pro analzu pozice}
menuText C ToolsCross "Turnajov tabulka" 0 {Ukzat turnajovou tabulku pro tuto partii}
menuText C ToolsEmail "Email manaer" 0 \
  {Otevt/zavt okno pro sprvu korespondench parti hranch pes email}
menuText C ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText C ToolsOpReport "Pehled zahjen" 3 \
  {Generovat pehled zajmavch fakt o zahjen dan aktuln pozic}
menuText C ToolsTracker "Piece Tracker"  0 {Open the Piece Tracker window} ;# ***
menuText C ToolsPInfo "Informace o hrch"  0 \
  {Otevt/aktualizovat okno s informacemi o hrch}
menuText C ToolsRating "Graf ELO klasifikace" 0 \
  {Graf ELO klasifikace hr aktuln partie}
menuText C ToolsScore "Graf skre" 5 {Ukzat okno s grafem skre}
menuText C ToolsExpCurrent "Export aktuln partie" 1 \
  {Zapsat aktuln partii do textovho souboru}
menuText C ToolsExpCurrentPGN "Export partie do PGN souboru..." 17 \
  {Zapsat aktuln partii do PGN souboru}
menuText C ToolsExpCurrentHTML "Export partie do HTML souboru..." 17 \
  {Zapsat aktuln partii do HTML souboru}
menuText C ToolsExpCurrentLaTeX "Export partie do LaTeX souboru..." 17 \
  {Zapsat aktuln partii do LaTeX souboru}
menuText C ToolsExpFilter "Export filtrovanch parti" 7 \
  {Zapsat vechny filtrovan partie do textovho souboru}
menuText C ToolsExpFilterPGN "Export filtrovanch parti do PGN souboru..." 10 \
  {Zapsat vechny filtrovan partie do PGN souboru}
menuText C ToolsExpFilterHTML "Export filtrovanch parti do HTML souboru..." 11 \
  {Zapsat vechny filtrovan partie do HTML souboru}
menuText C ToolsExpFilterLaTeX "Export filtrovanch parti do LaTeX souboru..." 12 \
  {Zapsat vechny filtrovan partie do LaTeX souboru}
menuText C ToolsImportOne "Import jedn PGN partie..." 0 \
  {Importovat partie z PGN souboru}
menuText C ToolsImportFile "Import vce parti z PGN souboru..." 7 \
  {Importovat parti z PGN souboru}

# Options menu:
menuText C Options "Volby" 0
menuText C OptionsSize "Velikost achovnice" 0 {Zmnit velikost achovnice}
menuText C OptionsPieces "Styl zobrazen figurek" 0 \
  {Zmnit styl zobrazen figurek na achovnici}
menuText C OptionsColors "Barvy..." 0 {Zmnit barvy achovnice}
menuText C OptionsExport "Volby exportu" 6 {Zmnit volby pro textov export}
menuText C OptionsFonts "Psma" 0 {Zmnit psma}
menuText C OptionsFontsRegular "Zkladn psmo" 0 {Zmnit zkladn psmo}
menuText C OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText C OptionsFontsSmall "Mal" 0 {Zmnit mal psmo}
menuText C OptionsFontsFixed "Neproporcionln" 0 {Zmnit neproporcionln psmo}
menuText C OptionsGInfo "Informace o partii" 0 {Volby pro informace o partii}
menuText C OptionsLanguage "Jazyk" 0 {Vybrat jazyk}
menuText C OptionsMoves "Tahy" 0 {Volby pro vkldn tah}
menuText C OptionsMovesAsk "Ptt se ped nahrazenm tah" 15 \
  {Ptt se, zda se maj pepsat existujc tahy nov vkldanmi}
menuText C OptionsMovesDelay "Prodleva pi pehrvn partie..." 3 \
  {Nastavit asovou prodlevu mezi tahy pi automatickm pehrvn}
menuText C OptionsMovesCoord "Vkldn tah zadvnm souadnic" 1 \
  {Povolit vkldn tah pomoc zadvn souadnic z klvesnice ("g1f3")}
menuText C OptionsMovesSuggest "Ukzat navrhovan tahy" 0 \
  {Zapnout/vypnout zobrazovn navrhovanch tah}
menuText C OptionsMovesKey "Doplovn tah" 0 \
  {Zapnout/vypnout automatick doplovn tah zadvanch klvesnic}
menuText C OptionsNumbers "Formt sel" 0 {Zvolit formt sel}
menuText C OptionsStartup "Pi sputn" 3 {Zvolit okna, kter se otevou pi sputn}
menuText C OptionsWindows "Okna" 0 {Volby oken}
menuText C OptionsWindowsIconify "Automatick minimalizace" 12 \
   {Minimalizovat vechna okna pi minimalizovn hlavnho okna}
menuText C OptionsWindowsRaise "Automaticky do poped" 0 \
  {Dt do poped jist okna, jsou-li zakryt}
menuText C OptionsToolbar "Nstrojov lita hlavnho okna" 12 \
  {Zobrazit/skrt nstrojovou litu hlavnho okna}
menuText C OptionsECO "Nathnout ECO soubor..." 7 {Nathnout soubor s klasifikac ECO}
menuText C OptionsSpell "Nathnout soubor pro kontrolu pravopisu..." 6 \
  {Nathnout soubor pro kontrolu pravopisu}
menuText C OptionsTable "Adres pro databze koncovek..." 0 \
  {Vybrat soubor s koncovkami; vechny databze z koncovkami v tomto adresi budou pouity}
menuText C OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText C OptionsSave "Uloit volby" 0 {Uloit volby}
menuText C OptionsAutoSave "Automaticky ukldat volby pi ukonen" 0 \
  {Automaticky ukldat vechny volby pi ukonen programu}

# Help menu:
menuText C Help "Npovda" 0
menuText C HelpIndex "Index" 0 {Ukzat hlavn npovdnou strnku}
menuText C HelpGuide "Rychl prvodce" 0 {Ukzat strnku s rychlm prvodcem npovdou}
menuText C HelpHints "Rady" 1 {Ukzat npovdnou strnku s radami}
menuText C HelpContact "Kontakt" 0 {Ukzat strnku s kontaktnmi informacemi}
menuText C HelpTip "Tip dne" 0 {Ukzat uiten tip Scidu}
menuText C HelpStartup "Startovac okno" 0 {Ukzat startovac okno}
menuText C HelpAbout "O aplikaci Scid" 0 {Informace o aplikaci Scid}

# Game info box popup menu:
menuText C GInfoHideNext "Skrt nsledujc tah" 0
menuText C GInfoMaterial "Ukzat hodnoty materilu" 0
menuText C GInfoFEN "Ukzat FEN" 7
menuText C GInfoMarks "Zobrazovat barevn pole a ipky" 11
menuText C GInfoWrap "Zalamovat dlouh dky" 0
menuText C GInfoFullComment "Zobrazit pln koment" 10
menuText C GInfoTBNothing "Databze koncovek: nic" 0
menuText C GInfoTBResult "Databze koncovek: jen vsledek" 2
menuText C GInfoTBAll "Databze koncovek: vsledek a nejlep tahy" 4
menuText C GInfoDelete "Vymazat/Nemazat tuto partii" 0
menuText C GInfoMark "Oznait/Odznait tuto partii" 0

# Main window buttons:
helpMsg C .button.start {Jdi na zatek partie  (klvesa: Home)}
helpMsg C .button.end {Jdi na konec partie  (klvesa: End)}
helpMsg C .button.back {Jdi o jeden tah nazpt  (klvesa: ipka vlevo)}
helpMsg C .button.forward {Jdi o jeden tah dopedu  (klvesa: RightArrow)}
helpMsg C .button.intoVar {Sko do varianty  (klvesov zkratka: v)}
helpMsg C .button.exitVar {Opus aktuln variantu  (klvesov zkratka: z)}
helpMsg C .button.flip {Oto achovnici  (klvesov zkratka: .)}
helpMsg C .button.coords {Zapnout/Vypnout zobrazovn souadnic achovnice  (klvesov zkratka: 0)}
helpMsg C .button.autoplay {Automatick pehrvn tah  (klvesa: Ctrl+Z)}

# General buttons:
translate C Back {Zpt}
translate C Cancel {Zruit}
translate C Clear {Vyistit}
translate C Close {Zavt}
translate C Defaults {Pedvolen}
translate C Delete {Vymazat}
translate C Graph {Graf}
translate C Help {Npovda}
translate C Import {Import}
translate C Index {Index}
translate C LoadGame {Nathnout partii}
translate C BrowseGame {Prohldnout partii}
translate C MergeGame {Pipojit partii}
translate C Preview {Nhled}
translate C Revert {Vrtit se}
translate C Save {Uloit}
translate C Search {Hledat}
translate C Stop {Stop}
translate C Store {Uschovat}
translate C Update {Aktualizovat}
translate C ChangeOrient {Zmnit orientaci okna}
translate C None {Nic}
translate C First {Prvn}
translate C Current {Aktuln}
translate C Last {Posledn}

# General messages:
translate C game {partie}
translate C games {partie}
translate C move {tah}
translate C moves {tahy}
translate C all {ve}
translate C Yes {Ano}
translate C No {Ne}
translate C Both {Oba}
translate C King {Krl}
translate C Queen {Dma}
translate C Rook {V}
translate C Bishop {Stelec}
translate C Knight {Jezdec}
translate C Pawn {Pec}
translate C White {Bl}
translate C Black {ern}
translate C Player {Hr}
translate C Rating {Rating}
translate C RatingDiff {Rozdl v ratingu (Bl - ern)}
translate C Event {Turnaj}
translate C Site {Msto}
translate C Country {Zem}
translate C IgnoreColors {Ignorovat barvy}
translate C Date {Datum}
translate C EventDate {Turnaj datum}
translate C Decade {Decade} ;# ***
translate C Year {Rok}
translate C Month {Msc}
translate C Months {Leden nor Bezen Duben Kvten erven
  ervenec Srpen Z jen Listopad Prosinec}
translate C Days {Ned Pon te St tv Pt Sob}
translate C YearToToday {Rok zpt}
translate C Result {Vsledek}
translate C Round {Kolo}
translate C Length {Dlka}
translate C ECOCode {ECO kd}
translate C ECO {ECO}
translate C Deleted {Vymazn(a)}
translate C SearchResults {Hledat vsledky}
translate C OpeningTheDatabase {Databze zahjen}
translate C Database {Databze}
translate C Filter {Filtr}
translate C noGames {dn partie}
translate C allGames {vechny partie}
translate C empty {przdn}
translate C clipbase {schrnka}
translate C score {skre}
translate C StartPos {Poten pozice}
translate C Total {Celkem}

# Game information:
translate C twin {zdvojen}
translate C deleted {vymazan}
translate C comment {koment}
translate C hidden {skryt}
translate C LastMove {Posledn tah}
translate C NextMove {Nsledujc}
translate C GameStart {Zatek partie}
translate C LineStart {Zatek srie tah}
translate C GameEnd {Konec partie}
translate C LineEnd {Konec srie tah}

# Player information:
translate C PInfoAll {Vsledky <b>vech</b> parti}
translate C PInfoFilter {Vsledky <b>filtrovanch</b> parti}
translate C PInfoAgainst {Vsledek znovu}
translate C PInfoMostWhite {Nejastj zahjen blch}
translate C PInfoMostBlack {Nejastj zahjen ernch}
translate C PInfoRating {Historie ratingu}
translate C PInfoBio {Biografie}

# Tablebase information:
translate C Draw {Remza}
translate C stalemate {pat}
translate C withAllMoves {se vemi tahy}
translate C withAllButOneMove {se vemi tahy krom poslednho}
translate C with {s}
translate C only {jen}
translate C lose {prohrt}
translate C loses {prohrv}
translate C allOthersLose {vechny ostatn prohrvaj}
translate C matesIn {matuje bhem}
translate C hasCheckmated {zmatoval}
translate C longest {nejdel}

# Tip of the day:
translate C Tip {Tip}
translate C TipAtStartup {Tip pi sputn}

# Tree window menus:
menuText C TreeFile "Soubor" 0
menuText C TreeFileSave "Uloit cache soubor" 0 \
  {Save the tree cache (.stc) file}
menuText C TreeFileFill "Naplnit cache soubor" 0 \
  {Naplnit cache soubor nejastjmi pozicemi ze zahjen}
menuText C TreeFileBest "Seznam nejlepch parti" 0 {Zobrazit stromov seznam nejlepch parti}
menuText C TreeFileGraph "Okno Graf" 0 {Zobrazit graf pro tuto vtev stromu}
menuText C TreeFileCopy "Koprovat text stromu do schrnky" 0 \
  {Koprovat statistiky ze stromu do schrnky}
menuText C TreeFileClose "Zavt stromov okno" 0 {Zavt stromov okno}
menuText C TreeSort "adit" 0
menuText C TreeSortAlpha "abecedn" 0
menuText C TreeSortECO "ECO kd" 0
menuText C TreeSortFreq "etnost" 0
menuText C TreeSortScore "Skre" 0
menuText C TreeOpt "Volby" 0
menuText C TreeOptLock "Zamknout" 0 {Zamknout/odemknout strom pro aktuln databzi}
menuText C TreeOptTraining "Trnink" 0 {Zapnout/vypnout stromov trninkov md}
menuText C TreeOptAutosave "Automatick ukldn cache souboru" 1 \
  {Automatick ukldn cache souboru pi uzaven stromovho okna}
menuText C TreeHelp "Npovda" 0
menuText C TreeHelpTree "Npovda pro strom" 2
menuText C TreeHelpIndex "Index npovdy" 0
translate C SaveCache {Uloit cache}
translate C Training {Trnink}
translate C LockTree {Zamknout}
translate C TreeLocked {Zamknuto}
translate C TreeBest {Nejlep}
translate C TreeBestGames {Nejlep partie stromu}

# Finder window:
menuText C FinderFile "Soubor" 0
menuText C FinderFileSubdirs "Hledat v podadresch" 0
menuText C FinderFileClose "Zavt vyhledva soubor" 0
menuText C FinderSort "adit" 0
menuText C FinderSortType "Typ" 0
menuText C FinderSortSize "Velikost" 0
menuText C FinderSortMod "Zmnno" 0
menuText C FinderSortName "Jmno" 0
menuText C FinderSortPath "Cesta" 0
menuText C FinderTypes "Typy" 0
menuText C FinderTypesScid "Scid databze" 0
menuText C FinderTypesOld "Scid databze se starm formtem" 0
menuText C FinderTypesPGN "PGN soubory" 0
menuText C FinderTypesEPD "EPD (knihovn) soubory" 0
menuText C FinderTypesRep "Soubory s repertorem" 0
menuText C FinderHelp "Npovda" 0
menuText C FinderHelpFinder "Npovda pro vyhledva soubor" 0
menuText C FinderHelpIndex "Index npovdy" 0
translate C FileFinder {Vyhledva soubor}
translate C FinderDir {Adres}
translate C FinderDirs {Adrese}
translate C FinderFiles {Soubory}
translate C FinderUpDir {nahoru}

# Tournament finder:
menuText C TmtFile "Soubor" 0
menuText C TmtFileUpdate "Aktualizovat" 0
menuText C TmtFileClose "Zavt vyhledva soubor" 0
menuText C TmtSort "adit" 0
menuText C TmtSortDate "Datum" 0
menuText C TmtSortPlayers "Hri" 0
menuText C TmtSortGames "Partie" 0
menuText C TmtSortElo "Elo" 0
menuText C TmtSortSite "Msto" 0
menuText C TmtSortEvent "Turnaj" 0
menuText C TmtSortWinner "Vtz" 0
translate C TmtLimit "Limit seznamu"
translate C TmtMeanElo "Nejni prmrn Elo"
translate C TmtNone "dn odpovdajc turnaje nebyly nalezeny."

# Graph windows:
menuText C GraphFile "Soubor" 0
menuText C GraphFileColor "Uloit jako barevn Postscript..." 8
menuText C GraphFileGrey "Uloit jako ernobl Postscript..." 8
menuText C GraphFileClose "Zavt okno" 0
menuText C GraphOptions "Volby" 0
menuText C GraphOptionsWhite "Bl" 0
menuText C GraphOptionsBlack "ern" 1
menuText C GraphOptionsBoth "Oba" 1
menuText C GraphOptionsPInfo "Informace o hri" 0
translate C GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate C AddVariation {Pidat variantu}
translate C AddMove {Pidat tah}
translate C Annotate {Anotace}
translate C AnalysisCommand {Program pro analzu}
translate C PreviousChoices {Pedchoz vybran programy}
translate C AnnotateTime {Nastavit as mezi tahy v sekundch}
translate C AnnotateWhich {Pidat varianty}
translate C AnnotateAll {Pro tahy obou stran}
translate C AnnotateWhite {Pouze pro tahy blho}
translate C AnnotateBlack {Pouze pro tahy ernho}
translate C AnnotateNotBest {Pokud tah v partii nen nejlepm tahem}

# Analysis Engine open dialog:
translate C EngineList {Seznam program pro analzu}
translate C EngineName {Jmno}
translate C EngineCmd {Pkaz}
translate C EngineArgs {Parametry}
translate C EngineDir {Adres}
translate C EngineElo {Elo}
translate C EngineTime {Datum}
translate C EngineNew {Nov}
translate C EngineEdit {Editace}
translate C EngineRequired {Tun vyznaen poloky jsou povinn; ostatn jsou voliteln}

# Stats window menus:
menuText C StatsFile "Soubor" 0
menuText C StatsFilePrint "Vytisknout do souboru..." 0
menuText C StatsFileClose "Zavt okno" 0
menuText C StatsOpt "Volby" 0

# PGN window menus:
menuText C PgnFile "Soubor" 0
menuText C PgnFilePrint "Vytisknout do souboru..." 0
menuText C PgnFileClose "Uzavt okno PGN" 0
menuText C PgnOpt "Zobrazit" 0
menuText C PgnOptColor "Barevn vysvcovn" 0
menuText C PgnOptShort "Krtk (tdkov) hlavika" 0
menuText C PgnOptSymbols "Symbolick anotace" 0
menuText C PgnOptIndentC "Odsazovat komente" 0
menuText C PgnOptIndentV "Odsazovat varianty" 1
menuText C PgnOptColumn "Sloupcov styl (jeden tah na dek)" 1
menuText C PgnOptSpace "Mezera za slem tahu" 0
menuText C PgnOptStripMarks "Strip out colored square/arrow codes" 1 ;# ***
menuText C PgnColor "Barvy" 2
menuText C PgnColorHeader "Hlavika..." 0
menuText C PgnColorAnno "Anotace..." 0
menuText C PgnColorComments "Komente..." 0
menuText C PgnColorVars "Varianty..." 0
menuText C PgnColorBackground "Pozad..." 0
menuText C PgnHelp "Npovda" 0
menuText C PgnHelpPgn "PGN npovda" 0
menuText C PgnHelpIndex "Index" 0

# Crosstable window menus:
menuText C CrosstabFile "Soubor" 0
menuText C CrosstabFileText "Vytisknout do textovho souboru..." 14
menuText C CrosstabFileHtml "Vytisknout do HTML souboru..." 14
menuText C CrosstabFileLaTeX "Vytisknout do LaTeX souboru..." 14
menuText C CrosstabFileClose "Zavt okno s tabulkou" 0
menuText C CrosstabEdit "Editovat" 0
menuText C CrosstabEditEvent "Turnaj" 0
menuText C CrosstabEditSite "Msto" 0
menuText C CrosstabEditDate "Datum" 0
menuText C CrosstabOpt "Zobrazit" 0
menuText C CrosstabOptAll "Vichni-se-vemi" 0
menuText C CrosstabOptSwiss "vcarsk systm" 0
menuText C CrosstabOptKnockout "Knockout" 0
menuText C CrosstabOptAuto "Auto" 0
menuText C CrosstabOptAges "Vk" 8
menuText C CrosstabOptNats "Nrodnost" 0
menuText C CrosstabOptRatings "Elo" 0
menuText C CrosstabOptTitles "Titul" 0
menuText C CrosstabOptBreaks "Vsledky tie-breaku" 4
menuText C CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText C CrosstabOptColors "Barvy (jen pro vcarsk systm)" 0
menuText C CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2 ;# ***
menuText C CrosstabOptGroup "Skupiny podle skre" 0
menuText C CrosstabSort "adit" 0
menuText C CrosstabSortName "Jmno" 0
menuText C CrosstabSortRating "Elo" 0
menuText C CrosstabSortScore "Skre" 0
menuText C CrosstabColor "Barvy" 0
menuText C CrosstabColorPlain "Prost text" 0
menuText C CrosstabColorHyper "Hypertext" 0
menuText C CrosstabHelp "Npovda" 0
menuText C CrosstabHelpCross "Npovda - Tabulka" 11
menuText C CrosstabHelpIndex "Npovda - index" 11
translate C SetFilter {Nastavit filtr}
translate C AddToFilter {Pidat do filtru}
translate C Swiss {vcarsk systm}

# Opening report window menus:
menuText C OprepFile "Soubor" 0
menuText C OprepFileText "Vytisknout do textovho souboru..." 14
menuText C OprepFileHtml "Vytisknout do HTML souboru..." 14
menuText C OprepFileLaTeX "Vytisknout do LaTeX souboru..." 14
menuText C OprepFileOptions "Volby" 0
menuText C OprepFileClose "Zavt okno s pehledem" 0
menuText C OprepHelp "Npovda" 0
menuText C OprepHelpReport "Npovda - Pehled zahjen" 11
menuText C OprepHelpIndex "Npovda - index" 11

# Repertoire editor:
menuText C RepFile "Soubor" 0
menuText C RepFileNew "Nov" 0
menuText C RepFileOpen "Otevt..." 0
menuText C RepFileSave "Uloit..." 0
menuText C RepFileSaveAs "Uloit jako..." 5
menuText C RepFileClose "Zavt okno" 0
menuText C RepEdit "Editace" 0
menuText C RepEditGroup "Pidat skupinu" 4
menuText C RepEditInclude "Zahrnout variantu" 4
menuText C RepEditExclude "Vylouit variantu" 4
menuText C RepView "Zobrazit" 0
menuText C RepViewExpand "Rozbalit vechny skupiny" 0
menuText C RepViewCollapse "Sbalit vechny skupiny" 0
menuText C RepSearch "Hledat" 0
menuText C RepSearchAll "Veker repertor..." 0
menuText C RepSearchDisplayed "Pouze zobrazen varianty..." 0
menuText C RepHelp "Npovda" 0
menuText C RepHelpRep "Npovda pro repertor" 0
menuText C RepHelpIndex "Npovda - index" 11
translate C RepSearch "Vyhledat varianty"
translate C RepIncludedLines "zahrnut varianty"
translate C RepExcludedLines "vylouen varianty"
translate C RepCloseDialog {Zmny v tomto repertoru nebyly uloeny.

Opravdu chcete pokraovat a zruit vechny zmny, kter jste uinili?
}

# Header search:
translate C HeaderSearch {Hledat podle hlaviky}
translate C GamesWithNoECO {Partie bez ECO?}
translate C GameLength {Dlka Partie}
translate C FindGamesWith {Najt partie s}
translate C StdStart {Standardn start}
translate C Promotions {promnami}
translate C Comments {Komente}
translate C Variations {Varianty}
translate C Annotations {Anotace}
translate C DeleteFlag {Vymazn}
translate C WhiteOpFlag {Zahjen - bl}
translate C BlackOpFlag {Zahjen - ern}
translate C MiddlegameFlag {Stedn hra}
translate C EndgameFlag {Koncovka}
translate C NoveltyFlag {Novinka}
translate C PawnFlag {Pcov struktura}
translate C TacticsFlag {Taktika}
translate C QsideFlag {Hra na dmskm kdle}
translate C KsideFlag {Hra na krlovskm kdle}
translate C BrilliancyFlag {Briliantn}
translate C BlunderFlag {Hrubky}
translate C UserFlag {Uivatel}
translate C PgnContains {PGN obsahuje text}

# Game list window:
translate C GlistNumber {slo}
translate C GlistWhite {Bl}
translate C GlistBlack {ern}
translate C GlistWElo {B-Elo}
translate C GlistBElo {-Elo}
translate C GlistEvent {Turnaj}
translate C GlistSite {Msto}
translate C GlistRound {Kolo}
translate C GlistDate {Datum}
translate C GlistYear {Rok}
translate C GlistEDate {Turnaj-Datum}
translate C GlistResult {Vsledek}
translate C GlistLength {Dlka}
translate C GlistCountry {Zem}
translate C GlistECO {ECO}
translate C GlistOpening {Zahjen}
translate C GlistEndMaterial {Materil na konci}
translate C GlistDeleted {Vymazn(a)}
translate C GlistFlags {Pznak}
translate C GlistVars {Varianty}
translate C GlistComments {Komente}
translate C GlistAnnos {Anotace}
translate C GlistStart {Poten pozice}
translate C GlistGameNumber {slo partie}
translate C GlistFindText {Hledat text}
translate C GlistMoveField {Pesunout}
translate C GlistEditField {Konfigurovat}
translate C GlistAddField {Pidat}
translate C GlistDeleteField {Odebrat}
translate C GlistWidth {ka}
translate C GlistAlign {Zarovnat}
translate C GlistColor {Barva}
translate C GlistSep {Oddlova}

# Maintenance window:
translate C DatabaseName {Jmno databze:}
translate C TypeIcon {Symbol:}
translate C NumOfGames {Partie:}
translate C NumDeletedGames {Vymazan partie:}
translate C NumFilterGames {Partie ve filtru:}
translate C YearRange {Rozsah rok:}
translate C RatingRange {Rozsah ELO:}
translate C Flag {Pznak}
translate C DeleteCurrent {Vymazat aktuln partii}
translate C DeleteFilter {Vymazat filtrovan partie}
translate C DeleteAll {Vymazat vechny partie}
translate C UndeleteCurrent {Obnovit aktuln partie po vymazn}
translate C UndeleteFilter {Obnovit filtrovanch parti po vymazn}
translate C UndeleteAll {Obnovit vech parti po vymazn}
translate C DeleteTwins {Vymazat zdvojen partie}
translate C MarkCurrent {Oznait aktivn partii}
translate C MarkFilter {Oznait filtrovan partie}
translate C MarkAll {Oznait vechny partie}
translate C UnmarkCurrent {Odznait aktuln partii}
translate C UnmarkFilter {Odznait filtrovan partie}
translate C UnmarkAll {Odznait vechny partie}
translate C Spellchecking {Kontrola pravopisu}
translate C Players {Hri}
translate C Events {Turnaje}
translate C Sites {Msta}
translate C Rounds {Kola}
translate C DatabaseOps {Databzov operace}
translate C ReclassifyGames {ECO klasifikace parti}
translate C CompactDatabase {Komprivovat databzi}
translate C SortDatabase {adit databzi}
translate C AddEloRatings {Pidat Elo rating}
translate C AutoloadGame {Automaticky otevrat partii .}
translate C StripTags {Strip PGN tags} ;# ***
translate C StripTag {Strip tag} ;# ***
translate C Cleaner {itn databze}
translate C CleanerHelp {
    itn databze Scid provede u aktuln databze vechny drbsk akce, kter zvolte v seznamu.

    Pokud zvolte ECO klasifikaci a mazn zdvojench parti pouij se aktuln nastaven z pslunch dialog.
}
translate C CleanerConfirm {
Jakmile je itn jednou sputno, neme ji bt perueno!

Tato akce me pro velk databze trvat dlouhou dobu v zvislosti na funkcch, kter jste zvolili, a v zvislosti na jejich stvajcm nastaven.

Jste si jisti, e chcete zat s udrbskmi funkcemi, kter jste zvolili?
}

# Comment editor:
translate C AnnotationSymbols  {Anotan symboly:}
translate C Comment {Koment:}

# Board search:
translate C BoardSearch {Hledat pozici}
translate C FilterOperation {Operace s aktulnm filtrem:}
translate C FilterAnd {A (Omezit filtr)}
translate C FilterOr {NEBO (Pidat k filtru)}
translate C FilterIgnore {IGNOROVAT (Ignoruj filtr)}
translate C SearchType {Typ hledn:}
translate C SearchBoardExact {Pesn pozice (vechny figury na stejnch polch)}
translate C SearchBoardPawns {Pci (tent materil, vichni pci na tch polch)}
translate C SearchBoardFiles {ady (tent materil, vichni pci na stejnch adch)}
translate C SearchBoardAny {Materil (tent materil, pci a figury kdekoliv)}
translate C LookInVars {Dvat se do variant}

# Material search:
translate C MaterialSearch {Hledat materil}
translate C Material {Materil}
translate C Patterns {Vzory}
translate C Zero {Nic}
translate C Any {Cokoliv}
translate C CurrentBoard {Aktuln pozice}
translate C CommonEndings {Typick koncovky}
translate C CommonPatterns {Typick pozice}
translate C MaterialDiff {Rozdl v materilu}
translate C squares {pole}
translate C SameColor {Stejnobarevn}
translate C OppColor {Nestejnobarevn}
translate C Either {Oboj}
translate C MoveNumberRange {Rozsah sel tah}
translate C MatchForAtLeast {Shoda pro minimln}
translate C HalfMoves {pltah}

# Game saving:
translate C Today {Dnes}
translate C ClassifyGame {Klasifikovat partii}

# Setup position:
translate C EmptyBoard {Vyprzdnit achovnici}
translate C InitialBoard {Vchoz pozice}
translate C SideToMove {Na tahu je}
translate C MoveNumber {slo tahu}
translate C Castling {Roda}
translate C EnPassentFile {En Passent ada}
translate C ClearFen {Vyistit FEN}
translate C PasteFen {Vloit FEN}

# Replace move dialog:
translate C ReplaceMove {Nahradit tah}
translate C AddNewVar {Pidat novou variantu}
translate C ReplaceMoveMessage {Zde ji existuje tah.

Mete ho nahradit, a zruit tak i vechny nsledujc vloen tahy, nebo mete v tah vloit jako novou variantu.

(Zobrazen tto zprvy mete v budoucnu potlait pepnutm volby "Ptt se ped nahrazenm tah" v menu Volby:Tahy.)}

# Make database read-only dialog:
translate C ReadOnlyDialog {Pokud databzi nastavte jako read-only, nebudou povoleny dn zmny.
dn partie nebude mono uloit a dn pznak nebude mono zmnit.
Vechny vsledky operace azen i ECO klasifikace budou pouze doasn.

Databzi mete uinit opt zapisovatelnou pomoc jejho zaven a optovnho oteven.

Pejete si skuten nastavit tuto databzi jako read-only?}

# Clear game dialog:
translate C ClearGameDialog {Tato partie byla zmnna.

Skuten chcete pokraovat a zruit zmny, kter jste v n uinili?
}

# Exit dialog:
translate C ExitDialog {Opravdu si pejete ukonit Scid?}
translate C ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.} ;# ***

# Import window:
translate C PasteCurrentGame {Vloit aktuln partii}
translate C ImportHelp1 {Zapsat nebo vloit partii ve formtu PGN do rmce nahoe.}
translate C ImportHelp2 {Jakkoli chyby pi importu partie zde budou vysvceny.}

# ECO Browser:
translate C ECOAllSections {vechny ECO sekce}
translate C ECOSection {ECO sekce}
translate C ECOSummary {Souhrn pro}
translate C ECOFrequency {etnost subkd pro}

# Opening Report:
translate C OprepTitle {Report zahjen}
translate C OprepReport {Report}
translate C OprepGenerated {Generovn}
translate C OprepStatsHist {Statistika a historie}
translate C OprepStats {Statistika}
translate C OprepStatAll {Vechny partie}
translate C OprepStatBoth {Oba hri}
translate C OprepStatSince {Od}
translate C OprepOldest {Nejstar partie}
translate C OprepNewest {Nejnovj partie}
translate C OprepPopular {Stvajc popularita}
translate C OprepFreqAll {etnost za vechny roky:   }
translate C OprepFreq1   {Bhem poslednho roku:     }
translate C OprepFreq5   {Bhem poslednch 5 let: }
translate C OprepFreq10  {Bhem poslednch 10 let:  }
translate C OprepEvery {jednou z %u parti}
translate C OprepUp {vce o %u%s v porovnn se vemi roky}
translate C OprepDown {mn o %u%s v porovnn se vemi roky}
translate C OprepSame {dn zmna pi porovnn se vemi roky}
translate C OprepMostFrequent {Nejastj hri}
translate C OprepRatingsPerf {ELO a vkonnost}
translate C OprepAvgPerf {Prmrn ELO a vkonnost}
translate C OprepWRating {ELO bl}
translate C OprepBRating {ELO ern}
translate C OprepWPerf {Vkonnost bl}
translate C OprepBPerf {Vkonnost ern}
translate C OprepHighRating {Partie s nejvym prmrnm ELO}
translate C OprepTrends {Vsledkov trend}
translate C OprepResults {Dlka parti a etnost}
translate C OprepLength {Dlka parti}
translate C OprepFrequency {etnost}
translate C OprepWWins {Vhry bl: }
translate C OprepBWins {Vhry ern: }
translate C OprepDraws {Remzy:      }
translate C OprepWholeDB {cel databze}
translate C OprepShortest {Nejkrat vhry}
translate C OprepMovesThemes {Tahy a motivy}
translate C OprepMoveOrders {Tahy vedouc ke zkouman pozici}
translate C OprepMoveOrdersOne \
  {Nalezena pouze jedna posloupnost tah vedoucch k tto pozici:}
translate C OprepMoveOrdersAll \
  {Nalezeno %u posloupnost tah vedoucch k tto pozici:}
translate C OprepMoveOrdersMany \
  {Nalezeno %u posloupnost tah vedoucch k tto pozici. Prvnch %u jsou:}
translate C OprepMovesFrom {Tahy ze zkouman pozice}
translate C OprepThemes {Pozin motivy}
translate C OprepThemeDescription {etnost motiv k tahu . %u}
translate C OprepThemeSameCastling {Rody na stejnou stranu}
translate C OprepThemeOppCastling {Rody na rzn strany}
translate C OprepThemeNoCastling {Ob strany bez rody}
translate C OprepThemeKPawnStorm {Pcov tok na krlovskm kdle}
translate C OprepThemeQueenswap {Vymnn dmy}
translate C OprepThemeIQP {Isolovan dmsk pec}
translate C OprepThemeWP567 {Bl pec na 5., 6. nebo 7. ad}
translate C OprepThemeBP234 {ern pec na 2., 3. nebo 4. ad}
translate C OprepThemeOpenCDE {Oteven sloupec C, D nebo E}
translate C OprepTheme1BishopPair {Jedna strana m dvojici stelc}
translate C OprepEndgames {Koncovky}
translate C OprepReportGames {Report parti}
translate C OprepAllGames {Vechny partie}
translate C OprepEndClass {Klasifikace materilu na konci kad partie}
translate C OprepTheoryTable {Teorie}
translate C OprepTableComment {Generovno z %u s nejvym prmrnm ELO.}
translate C OprepExtraMoves {Extra poznmkov tahy v tabulce teorie}
translate C OprepMaxGames {Maximum tah v tabulce teorie}

# Piece Tracker window:
translate C TrackerSelectSingle {Left mouse button selects this piece.} ;# ***
translate C TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate C TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate C TrackerStat {Statistic}
translate C TrackerGames {% games with move to square}
translate C TrackerTime {% time on each square}
translate C TrackerMoves {Moves}
translate C TrackerMovesStart {Enter the move number where tracking should begin.}
translate C TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate C SelectAllGames {Vechny partie v databzi}
translate C SelectFilterGames {Jen filtrovan partie}
translate C SelectTournamentGames {Jen partie z aktulnho turnaje}
translate C SelectOlderGames {Jen star partie}

# Delete Twins window:
translate C TwinsNote {Aby byly dv partie vyhodnoceny jako zdvojen, mus bt hrny tmi dvma hri a dle mus splovat kritria, kter nastavte ne. Pokud jsou nalezeny zdvojen partie, pak je krat z nich vymazna.
Rada: je vhodn provst ped vymaznm zdvojench parti kontrolu pravopisu, nebo do zdokonal detekci zdvojench parti.}
translate C TwinsCriteria {Kritria: Zdvojen partie mus mt...}
translate C TwinsWhich {Jak partie prozkoumat?}
translate C TwinsColors {Tyt barvy u hr?}
translate C TwinsEvent {Tent turnaj?}
translate C TwinsSite {Tot msto?}
translate C TwinsRound {Tot kolo?}
translate C TwinsYear {Tent rok?}
translate C TwinsMonth {Tent msc?}
translate C TwinsDay {Tent den?}
translate C TwinsResult {Tent vsledek?}
translate C TwinsECO {Tent ECO kd?}
translate C TwinsMoves {Tyt tahy?}
translate C TwinsPlayers {Porovnn jmen:}
translate C TwinsPlayersExact {Pesn shoda}
translate C TwinsPlayersPrefix {Jen prvn 4 znaky}
translate C TwinsWhen {Pokud se budou mazat zdvojen partie}
translate C TwinsSkipShort {Ignorovat vechny partie krat ne 5 tah?}
translate C TwinsUndelete {obnovit nejprve vechny partie?}
translate C TwinsSetFilter {Nastavit filtr na vechny vymazan zdvojen partie?}
translate C TwinsComments {Vdy zachovat partie s komenti?}
translate C TwinsVars {Vdy zachovat partie s variantami?}
translate C TwinsDeleteWhich {Delete which game:} ;# ***
translate C TwinsDeleteShorter {Shorter game} ;# ***
translate C TwinsDeleteOlder {Smaller game number} ;# ***
translate C TwinsDeleteNewer {Larger game number} ;# ***
translate C TwinsDelete {Vymazat partie}

# Name editor window:
translate C NameEditType {Typ jmna pro editaci}
translate C NameEditSelect {Partie k editaci}
translate C NameEditReplace {Nahradit}
translate C NameEditWith {}
translate C NameEditMatches {Shoduje se: Stiskni Ctrl+1 a Ctrl+9 pro vbr}

# Classify window:
translate C Classify {Klasifikace}
translate C ClassifyWhich {ECO klasifikace parti}
translate C ClassifyAll {Vechny partie (pepsat star ECO kdy)}
translate C ClassifyYear {Vechny partie hran za posledn rok}
translate C ClassifyMonth {Vechny partie hran za posledn msc}
translate C ClassifyNew {Jen partie, kter jsou zatm bez ECO kdu}
translate C ClassifyCodes {Pout tyto ECO kdy}
translate C ClassifyBasic {Jen zkladn kdy ("B12", ...)}
translate C ClassifyExtended {Rozen Scid  ("B12j", ...)}

# Compaction:
translate C NameFile {Jmno souboru}
translate C GameFile {Soubor parti}
translate C Names {Jmna}
translate C Unused {Nepouito}
translate C SizeKb {Velikost (kb)}
translate C CurrentState {Aktuln stav}
translate C AfterCompaction {Po komprimaci}
translate C CompactNames {Jmno komprimovanho souboru}
translate C CompactGames {Komprimovat soubor parti}

# Sorting:
translate C SortCriteria {Kritria}
translate C AddCriteria {Pidat kritria}
translate C CommonSorts {Bn azen}
translate C Sort {azen}

# Exporting:
translate C AddToExistingFile {Pidat partie do existujcho souboru?}
translate C ExportComments {Exportovat komente?}
translate C ExportVariations {Exportovat varianty?}
translate C IndentComments {Odsazovat komente?}
translate C IndentVariations {Odsazovat varianty?}
translate C ExportColumnStyle {Sloupcov styl (jeden tah na dek)?}
translate C ExportSymbolStyle {Styl pro zpis koment:}
translate C ExportStripMarks {Strip square/arrow mark codes from comments?} ;# ***

# Goto game/move dialogs:
translate C LoadGameNumber {Vlote slo partie:}
translate C GotoMoveNumber {Pejt na tah slo:}

# Copy games dialog:
translate C CopyGames {Koprovat partie}
translate C CopyConfirm {
 Skuten chcete koprovat
 [thousands $nGamesToCopy] filtrovanch parti
 z databze "$fromName"
 do databze "$targetName"?
}
translate C CopyErr {Nelze zkoprovat partie}
translate C CopyErrSource {zdrojov databze}
translate C CopyErrTarget {clov databze}
translate C CopyErrNoGames {nem dn partie ve filtru}
translate C CopyErrReadOnly {je pouze pro ten}
translate C CopyErrNotOpen {nen otevena}

# Colors:
translate C LightSquares {Bl pole}
translate C DarkSquares {ern pole}
translate C SelectedSquares {Vybran pole}
translate C SuggestedSquares {Navrhovan tahy}
translate C WhitePieces {Bl figury}
translate C BlackPieces {ern figury}
translate C WhiteBorder {Obrys blch figur}
translate C BlackBorder {Obrys ernch figur}

# Novelty window:
translate C FindNovelty {Hledat novinky}
translate C Novelty {Novinka}
translate C NoveltyInterrupt {Hledn novinek perueno}
translate C NoveltyNone {V tto partii nebyla nalezena dn novinka}
translate C NoveltyHelp {
Scid bude hledat prvn tah aktuln partie, kter doshne pozice, kter se nevyskytla ve vybran databzi ani v ECO knihovn zahjen.
}

# Upgrading databases:
translate C Upgrading {Upgrade}
translate C ConfirmOpenNew {
Toto je star formt (Scid 2) databze, jen nen mono otevt ve Scidu 3. Verze s novm formtem (Scid 3) pitom ji byla vytvoena.

Chcete otevt verzi s novm formtem datbze?
}
translate C ConfirmUpgrade {
Toto je star formt (Scid 2) databze. K oteven ve Scid 3 je nutno databzi nejprve zkonvertovat do novho formtu.

Upgrade vytvo novou verzi databze; originln soubory se nebudou ani editovat, ani mazat.

Tento kon me zabrat trochu asu, ale je teba jej provst pouze jednou. Mete ho peruit, pokud bude trvat pli dlouho.

Chcete tuto databzi upgradovat nyn?
}

# Recent files options:
translate C RecentFilesMenu {Number of recent files in File menu} ;# ***
translate C RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# end of czech.tcl
### serbian.tcl:
# Serbian menus for Scid.
# Contributed by Milos Pejovic.

addLanguage Y Serbian 2 iso8859-2

proc setLanguage_Y {} {

# File menu:
menuText Y File "Fajl" 0
menuText Y FileNew "Novi..." 0 {Kreiraj novu Scid bazu podataka}
menuText Y FileOpen "Otvori..." 0 {Otvori postojeu Scid bazu podataka}
menuText Y FileClose "Zatvori" 0 {Zatvori aktivnu Scid bazu podataka}
menuText Y FileFinder "Traga" 0 {Pokreni Fajl Traga}
menuText Y FileBookmarks "Markeri" 0 {Meni sa markerima (preica: Ctrl+B)}
menuText Y FileBookmarksAdd "Dodaj u markere" 0 \
  {Dodaj u markere tekuu partiju iz baze i poziciju}
menuText Y FileBookmarksFile "Arhiviraj marker" 0 \
  {Arhiviraj marker za tekuu partiju i poziciju}
menuText Y FileBookmarksEdit "Izmeni markere..." 0 \
  {Izmeni menije markera}
menuText Y FileBookmarksList "Prikai foldere kao jedinstvenu listu" 0 \
  {Prikai foldere markera kao jedinstvenu listu, bez podmenija}
menuText Y FileBookmarksSub "Prikai foldere kao podmenije" 0 \
  {Prikai foldere markera kao podmenije, ne jedinstvenu listu}
menuText Y FileMaint "Odravanje" 0 {Alati za odravanje Scid baze podataka}
menuText Y FileMaintWin "Prozor odravanja" 0 \
  {Otvori/zatvori prozor odravanja Scid baze podataka}
menuText Y FileMaintCompact "Komprimuj bazu..." 0 \
  {Uini fajlove baze kompaktnijim, uklanjajui obrisane partije i nekoriena imena}
menuText Y FileMaintClass "EO-Klasifikacija partija..." 2 \
  {Klasifikacija svih partija po otvaranju}
menuText Y FileMaintSort "Sortiraj bazu..." 0 \
  {Sortiraj sve partije u bazi podataka}
menuText Y FileMaintDelete "Izbrii udvojene partije..." 0 \
  {Nai udvojene partije i oznai ih za brisanje}
menuText Y FileMaintTwin "Provera udvojenih partija" 0 \
  {Otvori/osvei prozor za proveru udvojenih partija}
menuText Y FileMaintName "Imena" 0 {Promena imena i kontrola pravopisa}
menuText Y FileMaintNameEditor "Editor imena" 0 \
  {Otvori/zatvori editor imena}
menuText Y FileMaintNamePlayer "Provera pravopisa imena igraa..." 11 \
  {Provera pravopisa imena igraa pomou spellcheck fajla}
menuText Y FileMaintNameEvent "Provera pravopisa imena turnira..." 11 \
  {Provera pravopisa imena turnira pomou spellcheck fajla}
menuText Y FileMaintNameSite "Provera pravopisa imena mesta..." 11 \
  {Provera pravopisa imena mesta pomou spellcheck fajla}
menuText Y FileMaintNameRound "Provera pravopisa kola..." 11 \
  {Provera pravopisa kola pomou spellcheck fajla}
menuText Y FileReadOnly "Read-only..." 0 \
  {Sprei izmene u tekuoj bazi}
menuText Y FileExit "Izai" 1 {Izlazak iz Scid-a}

# Edit menu:
menuText Y Edit "Izmene" 0
menuText Y EditAdd "Dodaj varijantu" 0 {Dodaj varijantu potezu u partiji}
menuText Y EditDelete "Obrii varijantu" 0 {Obrii varijantu za ovaj potez}
menuText Y EditFirst "Postavi prvu varijantu" 5 \
  {Postavi varijantu kao prvu u listi}
menuText Y EditMain "Postavi varijantu na glavnu liniju" 21 \
  {Postavi varijantu na glavnu liniju}
menuText Y EditTrial "Probaj varijantu" 0 \
  {Pokreni/zaustavi mod za testiranje ideje na tabli}
menuText Y EditStrip "Ukloni" 2 {Ukloni komentare ili varijante iz ove partije}
menuText Y EditStripComments "Komentare" 0 \
  {Ukloni sve komentare i napomene iz ove partije}
menuText Y EditStripVars "Varijante" 0 {Ukloni sve varijante iz ove partije}
menuText Y EditReset "Isprazni Clipbase" 0 \
  {Resetuje clipbase da bude potpuno prazan}
menuText Y EditCopy "Kopiraj ovu partiju na Clipbase" 0 \
  {Kopiraj ovu partiju na clipbase partija}
menuText Y EditPaste "Prenesi poslednju clipbase partiju" 0 \
  {Prenesi aktivnu clipbase partiju ovde}
menuText Y EditSetup "Namesti poetnu poziciju..." 0 \
  {Namesti poetnu poziciju za ovu partiju}
menuText Y EditPasteBoard "Prenesi poetnu poziciju" 9 \
  {Postavi poetnu poziciju na osnovu trenutno izabranog teksta (klipbord)}

# Game menu:
menuText Y Game "Partija" 0
menuText Y GameNew "Nova partija" 0 \
  {Pokreni novu partiju, sa gubljenjem svih izmena}
menuText Y GameFirst "Uitaj prvu partiju" 5 {Uitaj prvu filtriranu partiju}
menuText Y GamePrev "Uitaj prethodnu partiju" 5 {Uitaj prethodnu filtriranu partiju}
menuText Y GameReload "Osvei trenutnu partiju" 3 \
  {Osvei ovu partiju, sa gubljenjem svih izmena}
menuText Y GameNext "Uitaj sledeu partiju" 5 {Uitaj sledeu filtriranu partiju}
menuText Y GameLast "Uitaj poslednju partiju" 8 {Uitaj poslednju filtriranu partiju}
menuText Y GameRandom "Load Random Game" 8 {Load a random filtered game} ;# ***
menuText Y GameNumber "Uitaj partiju broj..." 5 \
  {Uitaj partiju, unosei njen broj}
menuText Y GameReplace "Sauvaj: Zameni partiju..." 6 \
  {Sauvaj ovu partiju preko stare partiju u bazi}
menuText Y GameAdd "Sauvaj: Dodaj novu partiju..." 6 \
  {Sauvaj ovu partiju kao novu u bazi}
menuText Y GameDeepest "Identifikuj otvaranje" 0 \
  {Idi na poslednju poziciju partije koja odgovara knjizi otvaranja}
menuText Y GameGotoMove "Idi na potez broj..." 5 \
  {Idi na odreeni broj potez u tekuoj partiji}
menuText Y GameNovelty "Pronai novost..." 8 \
  {Pronai prvi potez ove partije koji nije igran ranije}

# Search Menu:
menuText Y Search "Pretrai" 3
menuText Y SearchReset "Resetuj filter" 0 {Resetuj filter da bi sve partije bile ukljuene}
menuText Y SearchNegate "Invertuj filter" 0 {Invertuj filter da ukljui samo iskljuene partije}
menuText Y SearchCurrent "Tekua pozicija..." 0 {Pretrauj prema tekuoj poziciji na tabli}
menuText Y SearchHeader "Zaglavlje..." 0 {Pretrauj prema informacijama iz zaglavlja (igra, turnir, itd)}
menuText Y SearchMaterial "Materijal/Pozicije..." 0 {Pretrauj prema materijalu i poziciji}
menuText Y SearchUsing "Pomou Search fajla..." 0 {Pretrauj pomou Search fajla}

# Windows menu:
menuText Y Windows "Prozori" 1
menuText Y WindowsComment "Editor komentara" 0 {Otvori/zatvori editor komentara}
menuText Y WindowsGList "Lista partija" 0 {Otvori/zatvori listu partija}
menuText Y WindowsPGN "PGN prozor" 0 \
  {Otvori/zatvori PGN prozor (sa podacima o partiji)}
menuText Y WindowsTmt "Turnir traga" 2 {Otvori/zatvori turnir traga}
menuText Y WindowsSwitcher "Bira baza" 0 \
  {Otvori/zatvori bira baza}
menuText Y WindowsMaint "Prozor odravanja" 0 \
  {Otvori/zatvori prozor odravanja}
menuText Y WindowsECO "EO prikaziva" 0 {Otvori/zatvori EO prikaziva}
menuText Y WindowsRepertoire "Editor repertoara otvaranja" 0 \
  {Otvori/zatvori editor repertoara otvaranja}
menuText Y WindowsStats "Statistiki prozor" 0 \
  {Otvori/zatvori prozor statistika filtera}
menuText Y WindowsTree "Stablo varijanata" 0 {Otvori/zatvori stablo varijanata}
menuText Y WindowsTB "Tabela zavrnica" 1 \
  {Otvori/zatvori tabelu zavrnica}

# Tools menu:
menuText Y Tools "Alati" 0
menuText Y ToolsAnalysis "Program za analizu..." 0 \
  {Pokreni/zaustavi ahovski program za analizu}
menuText Y ToolsAnalysis2 "Program za analizu #2..." 17 \
  {Pokreni/zaustavi drugi ahovski program za analizu}
menuText Y ToolsCross "Tabela turnira" 0 {Pokai tabelu turnira za ovu partiju}
menuText Y ToolsEmail "Email menader" 0 \
  {Otvori/zatvori menader za korespodentske partije preko email-a}
menuText Y ToolsFilterGraph "Filter graph" 7 \
  {Open/close the filter graph window} ;# ***
menuText Y ToolsOpReport "Izvetaj o otvaranjima" 0 \
  {Napravi izvetaj o otvaranjima za trenutnu poziciju}
menuText Y ToolsTracker "Piece Tracker"  0 {Open the Piece Tracker window} ;# ***
menuText Y ToolsPInfo "Informacije o igrau"  0 \
  {Otvori/osvei informacije o igrau}
menuText Y ToolsRating "Grafikon rejtinga" 0 \
  {Iscrtava grafik istorije rejtinga igraa u tekuoj partiji}
menuText Y ToolsScore "Grafikon skora" 0 {Prikai grafikon skora}
menuText Y ToolsExpCurrent "Izvezi tekuu partiju" 8 \
  {Snimi tekuu partiju u tekstualni fajl}
menuText Y ToolsExpCurrentPGN "Izvezi partiju u PGN fajl..." 17 \
  {Snimi tekuu partiju u PGN fajl}
menuText Y ToolsExpCurrentHTML "Izvezi partiju u HTML fajl..." 17 \
  {Snimi tekuu partiju u HTML fajl}
menuText Y ToolsExpCurrentLaTeX "Izvezi partiju u LaTeX fajl..." 17 \
  {Snimi tekuu partiju u LaTeX fajl}
menuText Y ToolsExpFilter "Izvezi sve filtrirane partije" 1 \
  {Snimi sve filtrirane partije u tekstualni fajl}
menuText Y ToolsExpFilterPGN "Izvezi filtrirane partije u PGN fajl..." 28 \
  {Snimi sve filtrirane partije u PGN fajl}
menuText Y ToolsExpFilterHTML "Izvezi filtrirane partije u HTML fajl..." 28 \
  {Snimi sve filtrirane partije u HTML fajl}
menuText Y ToolsExpFilterLaTeX "Izvezi filtrirane partije u LaTeX fajl..." 28 \
  {Snimi sve filtrirane partije u LaTeX fajl}
menuText Y ToolsImportOne "Uvezi jednu PGN partiju..." 0 \
  {Uvezi jednu partiju iz PGN fajla}
menuText Y ToolsImportFile "Uvezi vie PGN partija..." 6 \
  {Uvezi vie partija iz PGN fajla}

# Options menu:
menuText Y Options "Opcije" 0
menuText Y OptionsSize "Veliina table" 0 {Promeni veliinu table}
menuText Y OptionsPieces "Board Piece Style" 6 \
  {Change the board piece style} ;# ***
menuText Y OptionsColors "Boje" 0 {Promeni boje table}
menuText Y OptionsExport "Izvoz" 0 {Promeni opcije tekstualnog izvoza}
menuText Y OptionsFonts "Fontovi" 0 {Promeni fontove}
menuText Y OptionsFontsRegular "Obian" 0 {Promeni obian font}
menuText Y OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText Y OptionsFontsSmall "Mali" 0 {Promeni mali font}
menuText Y OptionsFontsFixed "Neproporcionalni" 0 {Promeni neproporcionalni font}
menuText Y OptionsGInfo "Informacije o Partiji" 0 {Opcije informacija o partiji}
menuText Y OptionsLanguage "Jezik" 0 {Izaberi jezik}
menuText Y OptionsMoves "Potezi" 0 {Opcije unoenja poteza}
menuText Y OptionsMovesAsk "Pitaj pre zamene poteza" 0 \
  {Pitaj, da li se moe postojei zameniti novim potezom}
menuText Y OptionsMovesDelay "Odlaganje izmeu poteza..." 1 \
  {Podesi vreme odlaganja pri automatskom pregledanju poteza}
menuText Y OptionsMovesCoord "Unoenje koordinata poteza" 0 \
  {Prihvati unoenje poteza pomou koordinata ("g1f3")}
menuText Y OptionsMovesSuggest "Pokai preporuene poteze" 0 \
  {Ukljui/iskljui preporuene poteze}
menuText Y OptionsMovesKey "Dopunjavanje poteza" 0 \
  {Ukljui/iskljui dopunjavanje poteza zadatih tastaturom}
menuText Y OptionsNumbers "Format brojeva" 0 {Izaberi format brojeva}
menuText Y OptionsStartup "Startup" 3 {Select windows to open at startup} ;# ***
menuText Y OptionsWindows "Prozori" 0 {Opcije prozora}
menuText Y OptionsWindowsIconify "Auto-iconify" 5 \
  {Iconify all windows when the main window is iconified} ;# ***
menuText Y OptionsWindowsRaise "Auto podizanje" 0 \
  {Podigni odreene prozore kad god su pokriveni}
menuText Y OptionsToolbar "Toolbar glavnog prozora" 12 \
  {Prikai/sakrij toolbar glavnog prozora}
menuText Y OptionsECO "Uitaj EO fajl..." 7 {Uitaj EO klasifikacioni fajl}
menuText Y OptionsSpell "Uitaj fajl za kontrolu pravopisa..." 13 \
  {Uitaj fajl za kontrolu pravopisa}
menuText Y OptionsTable "Direktorijum baza zavrnica..." 0 \
  {Izaberi fajl baze zavrnica; sve baze u direktorijumu e biti koriene}
menuText Y OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText Y OptionsSave "Sauvaj opcije" 0 \
  "Sauvaj sve opcije u fajl $::optionsFile"
menuText Y OptionsAutoSave "Auto-sauvaj opcije na izlasku" 0 \
  {Auto-sauvaj sve opcije pri izlasku iz Scid-a}

# Help menu:
menuText Y Help "Pomo" 2
menuText Y HelpIndex "Sadraj" 0 {Prikai glavnu stranu pomoi}
menuText Y HelpGuide "Brzi vodi" 0 {Prikai brzi vodi}
menuText Y HelpHints "Saveti" 0 {Prikai savete}
menuText Y HelpContact "Kontakt" 0 {Prikai informacije o kontaktu}
menuText Y HelpTip "Tip of the day" 0 {Show a useful Scid tip} ;# ***
menuText Y HelpStartup "Startup prozor" 0 {Prikai startup prozor}
menuText Y HelpAbout "O programu Scid" 0 {Informacije o programu Scid}

# Game info box popup menu:
menuText Y GInfoHideNext "Sakrij sledei potez" 0
menuText Y GInfoMaterial "Prikai vrednosti materijala" 0
menuText Y GInfoFEN "Prikai FEN" 8
menuText Y GInfoMarks "Show colored squares and arrows" 5 ;# ***
menuText Y GInfoWrap "Prelomi dugake linije" 0
menuText Y GInfoFullComment "Show Full Comment" 10 ;# ***
menuText Y GInfoTBNothing "Baza zavrnica: nita" 16
menuText Y GInfoTBResult "Baza zavrnica: samo rezultati" 16
menuText Y GInfoTBAll "Baza zavrnica: rezultat i najbolji potezi" 16
menuText Y GInfoDelete "Obrii/vrati ovu partiju" 0
menuText Y GInfoMark "Mark/Unmark this game" 0 ;# ***

# Main window buttons:
helpMsg Y .button.start {Idi na poetak partije  (taster: Home)}
helpMsg Y .button.end {Idi na kraj partije  (taster: End)}
helpMsg Y .button.back {Idi jedan potez nazad  (taster: Levo)}
helpMsg Y .button.forward {Idi jedan potez napred  (taster: Desno)}
helpMsg Y .button.intoVar {Prei na varijantu  (taster preica: v)}
helpMsg Y .button.exitVar {Ostavi tekuu varijantu  (taster preica: z)}
helpMsg Y .button.flip {Rotiraj tablu  (taster preica: .)}
helpMsg Y .button.coords {Ukljui/iskljui koordinate table  (taster preica: 0)}
helpMsg Y .button.autoplay {Automatski menjaj poteze  (taster: Ctrl+Z)}

# General buttons:
translate Y Back {Nazad}
translate Y Cancel {Poniti}
translate Y Clear {Oisti}
translate Y Close {Zatvori}
translate Y Defaults {Podrazumevano}
translate Y Delete {Obrii}
translate Y Graph {Grafikon}
translate Y Help {Pomo}
translate Y Import {Uvoz}
translate Y Index {Indeks}
translate Y LoadGame {Uitaj partiju}
translate Y BrowseGame {Browse game} ;# ***
translate Y MergeGame {Merge game} ;# ***
translate Y Preview {Preview} ;# ***
translate Y Revert {Vrati se}
translate Y Save {Sauvaj}
translate Y Search {Trai}
translate Y Stop {Stop}
translate Y Store {Sauvaj}
translate Y Update {Osvei}
translate Y ChangeOrient {Promeni orijentaciju prozora}
translate Y None {None} ;# ***
translate Y First {Prvu}
translate Y Current {Trenutna}
translate Y Last {Poslednju}

# General messages:
translate Y game {partija}
translate Y games {partije}
translate Y move {potez}
translate Y moves {potezi}
translate Y all {sve}
translate Y Yes {Da}
translate Y No {Ne}
translate Y Both {Oba}
translate Y King {Kralj}
translate Y Queen {Dama}
translate Y Rook {Top}
translate Y Bishop {Lovac}
translate Y Knight {Skaka}
translate Y Pawn {Peak}
translate Y White {Beli}
translate Y Black {Crni}
translate Y Player {Igra}
translate Y Rating {Rejting}
translate Y RatingDiff {Razlika u rejtingu (Beli - Crni)}
translate Y Event {Turnir}
translate Y Site {Mesto}
translate Y Country {Zemlja}
translate Y IgnoreColors {Ignorii boje}
translate Y Date {Datum}
translate Y EventDate {Datum turnira}
translate Y Decade {Decade} ;# ***
translate Y Year {Godina}
translate Y Month {Mesec}
translate Y Months {Januar Februar Mart April Maj Jun
  Jul Avgust Septembar Oktobar Novembar Decembar}
translate Y Days {Ned Pon Uto Sre et Pet Sub}
translate Y YearToToday {Godina do danas}
translate Y Result {Rezultat}
translate Y Round {Kolo}
translate Y Length {Duina}
translate Y ECOCode {EO kd}
translate Y ECO {EO}
translate Y Deleted {Izbrisano}
translate Y SearchResults {Trai rezultate}
translate Y OpeningTheDatabase {Otvaranje baze}
translate Y Database {Baza}
translate Y Filter {Filter}
translate Y noGames {ni jedna partija}
translate Y allGames {sve partije}
translate Y empty {prazno}
translate Y clipbase {clipbase}
translate Y score {skor}
translate Y StartPos {Poetna pozicija}
translate Y Total {Ukupno}

# Game information:
translate Y twin {udvojena}
translate Y deleted {izbrisana}
translate Y comment {komentar}
translate Y hidden {sakrivena}
translate Y LastMove {Poslednji potez}
translate Y NextMove {Sledei}
translate Y GameStart {Poetak partije}
translate Y LineStart {Poetak serije poteza}
translate Y GameEnd {Kraj partije}
translate Y LineEnd {Kraj serije poteza}

# Player information:
translate Y PInfoAll {Rezultati <b>svih</b> partija}
translate Y PInfoFilter {Rezultati <b>filtriranih</b> partija}
translate Y PInfoAgainst {Rezultati protiv}
translate Y PInfoMostWhite {Najee igrana otvaranja sa belim figurama}
translate Y PInfoMostBlack {Najee igrana otvaranja sa crnim figurama}
translate Y PInfoRating {Istorija rejtinga}
translate Y PInfoBio {Biography} ;# ***

# Tablebase information:
translate Y Draw {Remi}
translate Y stalemate {pat}
translate Y withAllMoves {sa svim potezima}
translate Y withAllButOneMove {sa svim osim jednog poteza}
translate Y with {sa}
translate Y only {samo}
translate Y lose {gubi}
translate Y loses {gubi}
translate Y allOthersLose {svi ostali gube}
translate Y matesIn {matira u}
translate Y hasCheckmated {je matirao}
translate Y longest {najdui}

# Tip of the day:
translate Y Tip {Tip} ;# ***
translate Y TipAtStartup {Tip at startup} ;# ***

# Tree window menus:
menuText Y TreeFile "Fajl" 0
menuText Y TreeFileSave "Sauvaj cache fajl" 0 {Sauvaj cache (.stc) fajl stabla}
menuText Y TreeFileFill "Ispuni cache fajl" 0 \
  {Ispuni cache fajl estim pozicijama otvaranja}
menuText Y TreeFileBest "Lista najboljih partija" 0 {Prikai listu najboljih partija stabla}
menuText Y TreeFileGraph "Prozor grafika" 0 {Prikai grafik za ovu granu stabla}
menuText Y TreeFileCopy "Kopiraj tekst stabla u clipboard" 0 \
  {Kopiraj statistike stabla u clipboard}
menuText Y TreeFileClose "Zatvori stablo varijanata" 0 {Zatvori prozor stabla}
menuText Y TreeSort "Sortiraj" 0
menuText Y TreeSortAlpha "Abecedno" 0
menuText Y TreeSortECO "EO kd" 0
menuText Y TreeSortFreq "Uestalost" 0
menuText Y TreeSortScore "Skor" 0
menuText Y TreeOpt "Opcije" 0
menuText Y TreeOptLock "Zakljuaj" 0 {Zakljuaj/otkljuaj stablo za tekuu bazu}
menuText Y TreeOptTraining "Trening" 0 {Ukljui/iskljui trening mod stabla}
menuText Y TreeOptAutosave "Automatski sauvaj cache fajl" 0 \
  {Automatski sauvaj cache fajl pri zatvaranju prozora stabla}
menuText Y TreeHelp "Pomo" 0
menuText Y TreeHelpTree "Pomo za stablo" 0
menuText Y TreeHelpIndex "Sadraj pomoi" 0
translate Y SaveCache {Sauvaj cache}
translate Y Training {Trening}
translate Y LockTree {Zakljuaj}
translate Y TreeLocked {zakljuano}
translate Y TreeBest {Najbolje}
translate Y TreeBestGames {Najbolje partije stabla}

# Finder window:
menuText Y FinderFile "Fajl" 0
menuText Y FinderFileSubdirs "Pogledaj u poddirektorijumima" 0
menuText Y FinderFileClose "Zatvori Fajl traga" 0
menuText Y FinderSort "Sortiraj" 0
menuText Y FinderSortType "Tip" 0
menuText Y FinderSortSize "Veliina" 0
menuText Y FinderSortMod "Modifikovano" 0
menuText Y FinderSortName "Ime" 0
menuText Y FinderSortPath "Staza" 0
menuText Y FinderTypes "Tipovi" 0
menuText Y FinderTypesScid "Scid baze" 0
menuText Y FinderTypesOld "Scid baze u starom formatu" 0
menuText Y FinderTypesPGN "PGN fajlovi" 0
menuText Y FinderTypesEPD "EPD (book) fajlovi" 0
menuText Y FinderTypesRep "Repertoar fajlovi" 0
menuText Y FinderHelp "Pomo" 0
menuText Y FinderHelpFinder "Pomo - Fajl traga" 0
menuText Y FinderHelpIndex "Sadraj pomoi" 0
translate Y FileFinder {Fajl traga}
translate Y FinderDir {Direktorijum}
translate Y FinderDirs {Direktorijumi}
translate Y FinderFiles {Fajlovi}
translate Y FinderUpDir {gore}

# Tournament finder:
menuText Y TmtFile "Fajl" 0
menuText Y TmtFileUpdate "Osvei" 0
menuText Y TmtFileClose "Zatvori Turnir traga" 0
menuText Y TmtSort "Sortiraj" 0
menuText Y TmtSortDate "Datum" 0
menuText Y TmtSortPlayers "Igrai" 0
menuText Y TmtSortGames "Partije" 0
menuText Y TmtSortElo "Elo" 0
menuText Y TmtSortSite "Mesto" 0
menuText Y TmtSortEvent "Turnir" 1
menuText Y TmtSortWinner "Pobednik" 0
translate Y TmtLimit "Ogranienje liste"
translate Y TmtMeanElo "Najnii Elo"
translate Y TmtNone "Nije pronaen odgovarajui turnir."

# Graph windows:
menuText Y GraphFile "Fajl" 0
menuText Y GraphFileColor "Sauvaj kao Postscript u boji..." 25
menuText Y GraphFileGrey "Sauvaj kao Postscript u sivim nivoima..." 25
menuText Y GraphFileClose "Zatvori prozor" 6
menuText Y GraphOptions "Opcije" 0
menuText Y GraphOptionsWhite "Beli" 0
menuText Y GraphOptionsBlack "Crni" 0
menuText Y GraphOptionsBoth "Oba" 1
menuText Y GraphOptionsPInfo "Informacije o igrau" 0
translate Y GraphFilterTitle "Filter graph: frequency per 1000 games" ;# ***

# Analysis window:
translate Y AddVariation {Dodaj varijantu}
translate Y AddMove {Dodaj potez}
translate Y Annotate {Dodaj napomenu}
translate Y AnalysisCommand {Komanda analize}
translate Y PreviousChoices {Prethodni izbori}
translate Y AnnotateTime {Set the time between moves in seconds} ;# ***
translate Y AnnotateWhich {Add variations} ;# ***
translate Y AnnotateAll {For moves by both sides} ;# ***
translate Y AnnotateWhite {For White moves only} ;# ***
translate Y AnnotateBlack {For Black moves only} ;# ***
translate Y AnnotateNotBest {When game move is not best move} ;# ***

# Analysis Engine open dialog:
translate Y EngineList {Analysis Engine List} ;# ***
translate Y EngineName {Name} ;# ***
translate Y EngineCmd {Command} ;# ***
translate Y EngineArgs {Parameters} ;# ***
translate Y EngineDir {Directory} ;# ***
translate Y EngineElo {Elo}
translate Y EngineTime {Datum}
translate Y EngineNew {New} ;# ***
translate Y EngineEdit {Edit} ;# ***
translate Y EngineRequired {Fields in bold are required; others are optional} ;# ***

# Stats window menus:
menuText Y StatsFile "Fajl" 0
menuText Y StatsFilePrint "Print to file..." 0 ;# ***
menuText Y StatsFileClose "Close window" 0 ;# ***
menuText Y StatsOpt "Opcije" 0

# PGN window menus:
menuText Y PgnFile "Fajl" 0
menuText Y PgnFilePrint "tampaj u fajl..." 1
menuText Y PgnFileClose "Zatvori PGN prozor" 0
menuText Y PgnOpt "Prikaz" 0
menuText Y PgnOptColor "Prikaz u boji" 0
menuText Y PgnOptShort "Kratko (3-linije) zaglavlje" 0
menuText Y PgnOptSymbols "Simboliki komentari" 0
menuText Y PgnOptIndentC "Uvuci pasus kod komentara" 0
menuText Y PgnOptIndentV "Uvuci pasus kod varijanata" 16
menuText Y PgnOptColumn "Pasus stil (jedan potez po liniji)" 1
menuText Y PgnOptSpace "Blanko posle broja poteza" 0
menuText Y PgnOptStripMarks "Strip out colored square/arrow codes" 1 ;# ***
menuText Y PgnColor "Boje" 0
menuText Y PgnColorHeader "Zaglavlje..." 0
menuText Y PgnColorAnno "Napomene..." 0
menuText Y PgnColorComments "Komentari..." 0
menuText Y PgnColorVars "Varijante..." 0
menuText Y PgnColorBackground "Pozadina..." 0
menuText Y PgnHelp "Pomo" 1
menuText Y PgnHelpPgn "PGN pomo" 0
menuText Y PgnHelpIndex "Sadraj" 0

# Crosstable window menus:
menuText Y CrosstabFile "Fajl" 0
menuText Y CrosstabFileText "tampaj u Tekst fajl..." 10
menuText Y CrosstabFileHtml "tampaj u HTML fajl..." 10
menuText Y CrosstabFileLaTeX "tampaj u LaTeX fajl..." 10
menuText Y CrosstabFileClose "Zatvori tabelu turnira" 0
menuText Y CrosstabEdit "Izmena" 0
menuText Y CrosstabEditEvent "Turnir" 0
menuText Y CrosstabEditSite "Mesto" 0
menuText Y CrosstabEditDate "Datum" 0
menuText Y CrosstabOpt "Prikaz" 0
menuText Y CrosstabOptAll "Svako sa svakim" 0
menuText Y CrosstabOptSwiss "vajcarski sistem" 0
menuText Y CrosstabOptKnockout "Nokaut" 0
menuText Y CrosstabOptAuto "Auto" 0 ;# ***
menuText Y CrosstabOptAges "Starost u godinama" 10
menuText Y CrosstabOptNats "Narodnost" 0
menuText Y CrosstabOptRatings "Rejtinzi" 0
menuText Y CrosstabOptTitles "Titule" 0
menuText Y CrosstabOptBreaks "Tie-break rezultati" 4
menuText Y CrosstabOptDeleted "Include deleted games" 8 ;# ***
menuText Y CrosstabOptColors "Boje (samo za vajcarski sistem)" 0
menuText Y CrosstabOptColumnNumbers "Numbered columns (All-play-all table only)" 2 ;# ***
menuText Y CrosstabOptGroup "Grupii rezultate" 0
menuText Y CrosstabSort "Sortiraj" 0
menuText Y CrosstabSortName "Ime" 0
menuText Y CrosstabSortRating "Rejting" 0
menuText Y CrosstabSortScore "Rezultat" 0
menuText Y CrosstabColor "Boja" 0
menuText Y CrosstabColorPlain "Obian tekst" 0
menuText Y CrosstabColorHyper "Hipertekst" 0
menuText Y CrosstabHelp "Pomo" 0
menuText Y CrosstabHelpCross "Pomo - Tabela turnira" 0
menuText Y CrosstabHelpIndex "Sadraj pomoi" 0
translate Y SetFilter {Postavi filter}
translate Y AddToFilter {Dodaj u filter}
translate Y Swiss {vajcarski sistem}

# Opening report window menus:
menuText Y OprepFile "Fajl" 0
menuText Y OprepFileText "tampaj u Tekst fajl..." 10
menuText Y OprepFileHtml "tampaj u HTML fajl..." 10
menuText Y OprepFileLaTeX "tampaj u LaTeX fajl..." 10
menuText Y OprepFileOptions "Opcije..." 0
menuText Y OprepFileClose "Zatvori izvetaj o otvaranjima" 0
menuText Y OprepHelp "Pomo" 0
menuText Y OprepHelpReport "Pomo - Izvetaj o otvaranjima" 0
menuText Y OprepHelpIndex "Sadraj pomoi" 0

# Repertoire editor:
menuText Y RepFile "File" 0
menuText Y RepFileNew "Novi" 0
menuText Y RepFileOpen "Otvori..." 0
menuText Y RepFileSave "Sauvaj..." 0
menuText Y RepFileSaveAs "Sauvaj kao..." 9
menuText Y RepFileClose "Zatvori prozor" 0
menuText Y RepEdit "Izmena" 0
menuText Y RepEditGroup "Dodaj grupu" 6
menuText Y RepEditInclude "Dodaj ukljuenu liniju" 6
menuText Y RepEditExclude "Dodaj iskljuenu liniju" 6
menuText Y RepView "Prikaz" 0
menuText Y RepViewExpand "Razgranaj sve grupe" 0
menuText Y RepViewCollapse "Sami sve grupe" 0
menuText Y RepSearch "Pretrai" 3
menuText Y RepSearchAll "Ceo repertoar..." 0
menuText Y RepSearchDisplayed "Samo prikazane linije..." 0
menuText Y RepHelp "Pomo" 1
menuText Y RepHelpRep "Pomo - repertoar" 0
menuText Y RepHelpIndex "Sadraj pomoi" 0
translate Y RepSearch "Pretraga repertoara"
translate Y RepIncludedLines "ukljuene linije"
translate Y RepExcludedLines "iskljuene linije"
translate Y RepCloseDialog {Ovaj repertoar ima nesauvane izmene.

Da li zaista elite da nastavite i odbacite izmene koje ste napravili?
}

# Header search:
translate Y HeaderSearch {Pretraga zaglavlja}
translate Y GamesWithNoECO {Partije bez EO-a?}
translate Y GameLength {Duina partije}
translate Y FindGamesWith {Pronai partije sa}
translate Y StdStart {standardnim poetkom}
translate Y Promotions {sa promocijama}
translate Y Comments {Komentari}
translate Y Variations {Varijante}
translate Y Annotations {Napomene}
translate Y DeleteFlag {Znak za brisanje}
translate Y WhiteOpFlag {Otvaranje belog}
translate Y BlackOpFlag {Otvaranje crnog}
translate Y MiddlegameFlag {Sredinjica}
translate Y EndgameFlag {Zavrnica}
translate Y NoveltyFlag {Novost}
translate Y PawnFlag {Peaka struktura}
translate Y TacticsFlag {Taktika}
translate Y QsideFlag {Igra na daminom krilu}
translate Y KsideFlag {Igra na kraljevom krilu}
translate Y BrilliancyFlag {Brilijantnost}
translate Y BlunderFlag {Greka}
translate Y UserFlag {Korisnik}
translate Y PgnContains {PGN contains text} ;# ***

# Game list window:
translate Y GlistNumber {Broj}
translate Y GlistWhite {Beli}
translate Y GlistBlack {Crni}
translate Y GlistWElo {B-Elo}
translate Y GlistBElo {C-Elo}
translate Y GlistEvent {Turnir}
translate Y GlistSite {Mesto}
translate Y GlistRound {Kolo}
translate Y GlistDate {Datum}
translate Y GlistYear {Year}
translate Y GlistEDate {Datum turnira}
translate Y GlistResult {Rezultat}
translate Y GlistLength {Duina}
translate Y GlistCountry {Zemlja}
translate Y GlistECO {EO}
translate Y GlistOpening {Otvaranje}
translate Y GlistEndMaterial {End-Material} ;# ***
translate Y GlistDeleted {Izbrisano}
translate Y GlistFlags {Oznaka}
translate Y GlistVars {Varijante}
translate Y GlistComments {Komentari}
translate Y GlistAnnos {Napomene}
translate Y GlistStart {Start} ;# ***
translate Y GlistGameNumber {Broj partije}
translate Y GlistFindText {Nai tekst}
translate Y GlistMoveField {Move} ;# ***
translate Y GlistEditField {Configure} ;# ***
translate Y GlistAddField {Add} ;# ***
translate Y GlistDeleteField {Remove} ;# ***
translate Y GlistWidth {Width} ;# ***
translate Y GlistAlign {Align} ;# ***
translate Y GlistColor {Color} ;# ***
translate Y GlistSep {Separator} ;# ***

# Maintenance window:
translate Y DatabaseName {Ime baze:}
translate Y TypeIcon {Ikona:}
translate Y NumOfGames {Partija:}
translate Y NumDeletedGames {Obrisanih partija:}
translate Y NumFilterGames {Partija u filteru:}
translate Y YearRange {Raspon godina:}
translate Y RatingRange {Raspon rejtinga:}
translate Y Flag {Oznaka}
translate Y DeleteCurrent {Obrii tekuu partiju}
translate Y DeleteFilter {Obrii filtrirane partije}
translate Y DeleteAll {Obrii sve partije}
translate Y UndeleteCurrent {Obnovi tekuu partiju}
translate Y UndeleteFilter {Obnovi filtrirane partije}
translate Y UndeleteAll {Obnovi sve partije}
translate Y DeleteTwins {Obrii udvojene partije}
translate Y MarkCurrent {Markiraj tekuu partiju}
translate Y MarkFilter {Markiraj filtrirane partije}
translate Y MarkAll {Markiraj sve partije}
translate Y UnmarkCurrent {Demarkiraj tekuu partiju}
translate Y UnmarkFilter {Demarkiraj filtrirane partije}
translate Y UnmarkAll {Demarkiraj sve partije}
translate Y Spellchecking {Provera pravopisa}
translate Y Players {Igrai}
translate Y Events {Turniri}
translate Y Sites {Mesta}
translate Y Rounds {Kola}
translate Y DatabaseOps {Operacije sa bazom}
translate Y ReclassifyGames {Klasifikuj partije po EO}
translate Y CompactDatabase {Komprimuj bazu}
translate Y SortDatabase {Sortiraj bazu}
translate Y AddEloRatings {Dodaj Elo rejtinge}
translate Y AutoloadGame {Autoload game number} ;# ***
translate Y StripTags {Strip PGN tags} ;# ***
translate Y StripTag {Strip tag} ;# ***
translate Y Cleaner {ista}
translate Y CleanerHelp {
Scid ista e da primeni sve akcije odravanja koje izaberete iz donje liste, na tekuu bazu.

Trenutna podeavanja u dijalozima EO klasifikacija i brisanje udvojenih partija e se primeniti ako ste izabrali te funkcije.
}
translate Y CleanerConfirm {
Kada je ista jednom pokrenut, ne moe se prekinuti!

Ovo moe potrajati na velikoj bazi, zavisno od funkcija koje ste izabrali i njihovih trenutnih podeavanja.

Da li ste sigurni da elite da ponete funkcije odravanja koje ste izabrali?
}

# Comment editor:
translate Y AnnotationSymbols  {Simboli napomena:}
translate Y Comment {Komentari:}

# Board search:
translate Y BoardSearch {Pretraga po poziciji}
translate Y FilterOperation {Operacije na tekuem filteru:}
translate Y FilterAnd {I (Ogranii filter)}
translate Y FilterOr {ILI (Dodaj u filter)}
translate Y FilterIgnore {IGNORII (Resetuj filter)}
translate Y SearchType {Tip pretrage:}
translate Y SearchBoardExact {Ista pozicija (sve figure na istim poljima)}
translate Y SearchBoardPawns {Peaci (isti materijal, svi peaci na istim poljima)}
translate Y SearchBoardFiles {Linije (isti materijal, svi peaci na istim linijama)}
translate Y SearchBoardAny {Materijal (isti materijal, peaci i figure bilo gde)}
translate Y LookInVars {Pogledaj u varijantama}

# Material search:
translate Y MaterialSearch {Pretraga po materijalu}
translate Y Material {Materijal}
translate Y Patterns {Pozicije}
translate Y Zero {Nita}
translate Y Any {Bilo koje}
translate Y CurrentBoard {Trenutna pozicija}
translate Y CommonEndings {Tipine zavrnice}
translate Y CommonPatterns {Tipine pozicije}
translate Y MaterialDiff {Material difference} ;# ***
translate Y squares {polja}
translate Y SameColor {Ista boja}
translate Y OppColor {Suprotna boja}
translate Y Either {Oba}
translate Y MoveNumberRange {Raspon broja poteza}
translate Y MatchForAtLeast {Nai za najmanje}
translate Y HalfMoves {polupoteza}

# Game saving:
translate Y Today {Danas}
translate Y ClassifyGame {Klasifikuj partiju}

# Setup position:
translate Y EmptyBoard {Isprazni tablu}
translate Y InitialBoard {Poetna pozicija}
translate Y SideToMove {Na potezu je}
translate Y MoveNumber {Broj poteza}
translate Y Castling {Rokada}
translate Y EnPassentFile {En Passent linija}
translate Y ClearFen {Oisti FEN}
translate Y PasteFen {Prenesi FEN}

# Replace move dialog:
translate Y ReplaceMove {Zameni potez}
translate Y AddNewVar {Dodaj novu varijantu}
translate Y ReplaceMoveMessage {Ovde ve postoji potez.

Moete ga zameniti, odbacujui sve poteze posle njega, ili dodajte svoj potez kao novu varijantu.

(Moete izbei pojavljivanje ove poruke ubudue ako iskljuite "Pitaj pre zamene poteza" opciju u meniju Opcije:Potezi.)}

# Make database read-only dialog:
translate Y ReadOnlyDialog {Ako omoguite samo itanje iz ove baze, nee biti dozvoljene izmene.
Nijedna partije nee biti sauvana ili zamenjena, i nijedan znak za brisanje ne moe biti izmenjen.
Bilo kakvo sortiranje ili rezultati EO klasifikacije e biti privremeni.

Moete lako ponovo omoguiti pisanje po bazi, ako je zatvorite i ponovo otvorite.

Da li zaista elite da ova baza bude samo za itanje?}

# Clear game dialog:
translate Y ClearGameDialog {Ova partija je izmenjena.

Da li zaista elite da nastavite i odbacite sve uinjene promene?
}

# Exit dialog:
translate Y ExitDialog {Da li zaista elite da napustite Scid?}
translate Y ExitUnsaved {The following databases have unsaved game changes. If you exit now, these changes will be lost.} ;# ***

# Import window:
translate Y PasteCurrentGame {Prenesi tekuu partiju}
translate Y ImportHelp1 {Unesi ili prenesi partiju u PGN formatu u gornji okvir.}
translate Y ImportHelp2 {Bilo koja greka u uvozu partije e biti prikazana ovde.}

# ECO Browser:
translate Y ECOAllSections {sve EO sekcije}
translate Y ECOSection {EO sekcija}
translate Y ECOSummary {Pregled za}
translate Y ECOFrequency {Uestanost subkodova za}

# Opening Report:
translate Y OprepTitle {Izvetaj o otvaranjima}
translate Y OprepReport {Izvetaj}
translate Y OprepGenerated {Generisao}
translate Y OprepStatsHist {Statistika i Istorija}
translate Y OprepStats {Statistika}
translate Y OprepStatAll {Sve partije iz iz izvetaja}
translate Y OprepStatBoth {Oba sa rejtingom}
translate Y OprepStatSince {Od}
translate Y OprepOldest {Najstarije partije}
translate Y OprepNewest {Najnovije partije}
translate Y OprepPopular {Trenutna popularnost}
translate Y OprepFreqAll {Uetanost za sve godine:    }
translate Y OprepFreq1   {Tokom  1 poslednje godine:  }
translate Y OprepFreq5   {Tokom  5 poslednjih godina: }
translate Y OprepFreq10  {Tokom 10 poslednjih godina: }
translate Y OprepEvery {jednom svakih %u partija}
translate Y OprepUp {vie za %u%s tokom svih godina}
translate Y OprepDown {manje za %u%s tokom svih godina}
translate Y OprepSame {bez promena tokom svih godina}
translate Y OprepMostFrequent {Najei igrai}
translate Y OprepRatingsPerf {Rejtinzi i umenost}
translate Y OprepAvgPerf {Proseni rejtinzi i umenost}
translate Y OprepWRating {Rejting belog}
translate Y OprepBRating {Rejting crnog}
translate Y OprepWPerf {Umenost belog}
translate Y OprepBPerf {Umenost crnog}
translate Y OprepHighRating {Partije sa najveim prosenim rejtingom}
translate Y OprepTrends {Rezultatski trendovi}
translate Y OprepResults {Duine rezultata i uestanosti}
translate Y OprepLength {Duina partije}
translate Y OprepFrequency {Uestanost}
translate Y OprepWWins {Pobede belog: }
translate Y OprepBWins {Pobede crnog: }
translate Y OprepDraws {Remiji:       }
translate Y OprepWholeDB {cela baza}
translate Y OprepShortest {Najkraa pobeda} ;# ***
# translate Y OprepShortWhite {Najkraa pobeda belog}
# translate Y OprepShortBlack {Najkraa pobeda crnog}
translate Y OprepMovesThemes {Potezi i teme}
translate Y OprepMoveOrders {Redosledi poteza koji su dosegli poziciju iz izvetaja}
translate Y OprepMoveOrdersOne \
  {Samo je jedan redosled poteza koji je dostigao ovu poziciju:}
translate Y OprepMoveOrdersAll \
  {Bilo je %u redosleda poteza koji su dostigli ovu poziciju:}
translate Y OprepMoveOrdersMany \
  {Bilo je %u redosleda poteza koji su dostigli ovu poziciju. Prvih %u su:}
translate Y OprepMovesFrom {Potezi iz pozicije iz izvetaja}
translate Y OprepThemes {Pozicione teme}
translate Y OprepThemeDescription {Uestanost tema na potezu br. %u}
translate Y OprepThemeSameCastling {Rokade sa iste strane}
translate Y OprepThemeOppCastling {Rokade sa suprotne strane}
translate Y OprepThemeNoCastling {Obe strane bez rokada}
translate Y OprepThemeKPawnStorm {Prodor peaka na kraljevom krilu}
translate Y OprepThemeQueenswap {Zamena dama}
translate Y OprepThemeIQP {Izolovan damin peak}
translate Y OprepThemeWP567 {Beli peak na 5., 6. ili 7. redu}
translate Y OprepThemeBP234 {Crni peak na 2., 3. ili 4. redu}
translate Y OprepThemeOpenCDE {Otvorena c, d ili e linija}
translate Y OprepTheme1BishopPair {Jedna strana ima par lovaca}
translate Y OprepEndgames {Zavrnice}
translate Y OprepReportGames {Partije iz izvetaja}
translate Y OprepAllGames {Sve partije}
translate Y OprepEndClass {Materijal na kraju svake partije}
translate Y OprepTheoryTable {Tabela teorije}
translate Y OprepTableComment {Generisano iz %u najbolje rejtiranih partija.}
translate Y OprepExtraMoves {Posebno notirani potezi u tabeli teorije}
translate Y OprepMaxGames {Maksimum partija u tabeli teorije}

# Piece Tracker window:
translate Y TrackerSelectSingle {Left mouse button selects this piece.} ;# ***
translate Y TrackerSelectPair {Left mouse button selects this piece; right button also selects its sibling.}
translate Y TrackerSelectPawn {Left mouse button selects this pawn; right button selects all 8 pawns.}
translate Y TrackerStat {Statistic}
translate Y TrackerGames {% games with move to square}
translate Y TrackerTime {% time on each square}
translate Y TrackerMoves {Moves}
translate Y TrackerMovesStart {Enter the move number where tracking should begin.}
translate Y TrackerMovesStop {Enter the move number where tracking should stop.}

# Game selection dialogs:
translate Y SelectAllGames {Sve partije u bazi}
translate Y SelectFilterGames {Samo partije u filteru}
translate Y SelectTournamentGames {Samo partije u tekuem turniru}
translate Y SelectOlderGames {Samo starije partije}

# Delete Twins window:
translate Y TwinsNote {Da bi bile udvojene, dve partije moraju da najmanje imaju istu dvojicu igraa, i kriterijume koje nie moete podesiti. Kada se par udvojenih partija otkrije, kraa partija se brie.
Savet: Najbolje je proveriti pravopis u bazi pre brisanja udvojenih partija, jer to unapreuje detekciju. }
translate Y TwinsCriteria {Kriterijumi: Udvojene partije moraju imati...}
translate Y TwinsWhich {Koje partije da proverim?}
translate Y TwinsColors {Iste boje igraa?}
translate Y TwinsEvent {Isti turnir?}
translate Y TwinsSite {Isto mesto?}
translate Y TwinsRound {Isto kolo?}
translate Y TwinsYear {Ista godina?}
translate Y TwinsMonth {Isti mesec?}
translate Y TwinsDay {Isti dan?}
translate Y TwinsResult {Isti rezultat?}
translate Y TwinsECO {Isti EO kd?}
translate Y TwinsMoves {Isti potezi?}
translate Y TwinsPlayers {Uporeivanje imena igraa:}
translate Y TwinsPlayersExact {Potpuna podudarnost}
translate Y TwinsPlayersPrefix {Samo prva 4 slova}
translate Y TwinsWhen {Kod brisanja udvojenih partija}
translate Y TwinsSkipShort {Ignore all games under 5 moves long?} ;# ***
translate Y TwinsUndelete {Obnovi prvo sve partije?}
translate Y TwinsSetFilter {Postavi filter na sve obrisane udvojene partije?}
translate Y TwinsComments {Uvek sauvaj partije sa komentarima?}
translate Y TwinsVars {Uvek sauvaj partije sa varijantama?}
translate Y TwinsDeleteWhich {Delete which game:} ;# ***
translate Y TwinsDeleteShorter {Shorter game} ;# ***
translate Y TwinsDeleteOlder {Smaller game number} ;# ***
translate Y TwinsDeleteNewer {Larger game number} ;# ***
translate Y TwinsDelete {Obrii partije}

# Name editor window:
translate Y NameEditType {Tip imena za izmenu}
translate Y NameEditSelect {Partije za izmenu}
translate Y NameEditReplace {Zameni}
translate Y NameEditWith {sa}
translate Y NameEditMatches {Podudara se: Pritisni Ctrl+1 do Ctrl+9 za izbor}

# Classify window:
translate Y Classify {Klasifikuj}
translate Y ClassifyWhich {Klasifikuj partije po EO}
translate Y ClassifyAll {Sve partije (prebrii stare EO kdove)}
translate Y ClassifyYear {Sve partije igrane poslednje godine}
translate Y ClassifyMonth {Sve partije igrane poslednjeg meseca}
translate Y ClassifyNew {Samo partije koje su jo bez EO kda}
translate Y ClassifyCodes {Koristi EO kdove}
translate Y ClassifyBasic {Samo osnovne kdove ("B12", ...)}
translate Y ClassifyExtended {Proireni Scid ("B12j", ...)}

# Compaction:
translate Y NameFile {Fajl imena}
translate Y GameFile {Fajl partija}
translate Y Names {Imena}
translate Y Unused {Nekoriena}
translate Y SizeKb {Veliina (kb)}
translate Y CurrentState {Trenutno stanje}
translate Y AfterCompaction {Posle komprimacije}
translate Y CompactNames {Komprimuj fajl imena}
translate Y CompactGames {Komprimuj fajl partija}

# Sorting:
translate Y SortCriteria {Kriterijumi}
translate Y AddCriteria {Dodaj kriterijum}
translate Y CommonSorts {Uobiajena sortiranja}
translate Y Sort {Sortiraj}

# Exporting:
translate Y AddToExistingFile {Dodaj partije u postojei fajl?}
translate Y ExportComments {Izvezi komentare?}
translate Y ExportVariations {Izvezi varijante?}
translate Y IndentComments {Uvuci pasus kod komentara?}
translate Y IndentVariations {Uvuci pasus kod varijanata?}
translate Y ExportColumnStyle {Pasus stil (jedan potez po liniji)?}
translate Y ExportSymbolStyle {Stil simbolikih napomena:}
translate Y ExportStripMarks {Strip square/arrow mark codes from comments?} ;# ***

# Goto game/move dialogs:
translate Y LoadGameNumber {Unesi broj partije za uitavanje:}
translate Y GotoMoveNumber {Idi na potez broj:}

# Copy games dialog:
translate Y CopyGames {Kopiraj partije}
translate Y CopyConfirm {
 Da li zaista elite da kopirate
 [thousands $nGamesToCopy] filtriranih partija
 iz baze "$fromName"
 u bazu "$targetName"?
}
translate Y CopyErr {Ne mogu da kopiram partije}
translate Y CopyErrSource {izvorina baza}
translate Y CopyErrTarget {odredina baza}
translate Y CopyErrNoGames {nema partija u svom filteru}
translate Y CopyErrReadOnly {je samo za itanje}
translate Y CopyErrNotOpen {nije otvorena}

# Colors:
translate Y LightSquares {Svetla polja}
translate Y DarkSquares {Tamna polja}
translate Y SelectedSquares {Izabrana polja}
translate Y SuggestedSquares {Polja preporuenog poteza}
translate Y WhitePieces {Bele figure}
translate Y BlackPieces {Crne figure}
translate Y WhiteBorder {Ivica belih figura}
translate Y BlackBorder {Ivica crnih figura}

# Novelty window:
translate Y FindNovelty {Pronai novost}
translate Y Novelty {Novost}
translate Y NoveltyInterrupt {Traenje novosti prekinuto}
translate Y NoveltyNone {Nijedna novost nije pronaena u ovoj partiji}
translate Y NoveltyHelp {
Scid e nai prvi potez tekue partije, koji dostie poziciju koja nije naena u izabranoj bazi ili u EO knjizi otvaranja.
}

# Upgrading databases:
translate Y Upgrading {Unapreivanje}
translate Y ConfirmOpenNew {
Ovo je baza u starom formatu (Scid 2), koju ne moe da otvori Scid 3, ve je kreirana verzija u novom formatu (Scid 3).

Da li elite da otvorite verziju baze u novom formatu?
}
translate Y ConfirmUpgrade {
Ovo je baza u starom formatu (Scid 2). Verzija baze u novom formatu mora biti kreirana pre korienja u Scid-u 3.

Unapreivanjem e se kreirati nova verzija baze; nee se uklanjati originalni fajlovi.

Ovo moe potrajati, ali treba da se uradi samo jednom. Moete prekinuti ukoliko bude predugo trajalo.

Da li elite da sada unapredite ovu bazu?
}

# Recent files options:
translate Y RecentFilesMenu {Number of recent files in File menu} ;# ***
translate Y RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# end of serbian.tcl
# russian.tcl:
# Russian language translations for Scid.

addLanguage R Russian 0 iso8859-5

proc setLanguage_R {} {

# File menu:
menuText R File "" 0
menuText R FileNew "..." 0 {    Scid}
menuText R FileOpen "..." 0 {    Scid}
menuText R FileClose "" 0 {   }
menuText R FileFinder " " 0 {  }
menuText R FileBookmarks "" 0 {  (: Ctrl+B)}
menuText R FileBookmarksAdd " " 0 \
  {       }
menuText R FileBookmarksFile " " 0 \
  {       }
menuText R FileBookmarksEdit " ..." 0 \
  {  }
menuText R FileBookmarksList "    " 0 \
  {       }
menuText R FileBookmarksSub "   " 0 \
  {    ,     }
menuText R FileMaint "" 0 {    }
menuText R FileMaintWin " " 0 \
  {/   }
menuText R FileMaintCompact " ..." 0 \
  {          }
menuText R FileMaintClass " ECO..." 2 \
  {  ECO   }
menuText R FileMaintSort " ..." 0 \
  {    }
menuText R FileMaintDelete " -..." 0 \
  { -     }
menuText R FileMaintTwin "  -" 0 \
  {/   -}
menuText R FileMaintName " " 0 {     }
menuText R FileMaintNameEditor " " 0 \
  {/   }
menuText R FileMaintNamePlayer " ..." 11 \
  {      }
menuText R FileMaintNameEvent "  ..." 11 \
  {      }
menuText R FileMaintNameSite "  ..." 11 \
  {       }
menuText R FileMaintNameRound "  ..." 11 \
  {      }
menuText R FileReadOnly "  ..." 0 \
  {   }
menuText R FileExit "" 1 {  }

# Edit menu:
menuText R Edit "" 0
menuText R EditAdd " " 0 {    }
menuText R EditDelete " " 0 {    }
menuText R EditFirst "  " 5 \
  {    }
menuText R EditMain "  " 21 \
  {  }
menuText R EditTrial " " 0 \
  {   }
menuText R EditStrip "" 2 {      }
menuText R EditStripComments "" 0 \
  {       }
menuText R EditStripVars "" 0 {    }
menuText R EditReset "  " 0 \
  {     }
menuText R EditCopy "    " 0 \
  {    }
menuText R EditPaste "     " 0 \
  {      }
menuText R EditSetup "  ..." 0 \
  {    }
menuText R EditPasteBoard "  " 12 \
  {        }

# Game menu:
menuText R Game "" 0
menuText R GameNew " " 0 \
  {  ,    }
menuText R GameFirst "  " 5 {    }
menuText R GamePrev "  " 5 {    }
menuText R GameReload "   " 3 \
  {  ,    }
menuText R GameNext "  " 7 {    }
menuText R GameLast "  " 8 {    }
menuText R GameRandom "  " 8 {    }
menuText R GameNumber "  #..." 5 \
  {    }
menuText R GameReplace ":  ..." 6 \
  { ,  }
menuText R GameAdd ":  ..." 6 \
  { ,      }
menuText R GameDeepest "  ECO" 0 \
  {    ,     ECO}
menuText R GameGotoMove "   #..." 5 \
  {     }
menuText R GameNovelty " -..." 7 \
  {  ,         }

# Search Menu:
menuText R Search "" 0
menuText R SearchReset " " 0 {   ,      }
menuText R SearchNegate " " 0 {     ,     }
menuText R SearchCurrent "  ..." 0 {    }
menuText R SearchHeader " ..." 0 {     (,   . .)}
menuText R SearchMaterial "/ ..." 0 {     }
menuText R SearchUsing "   ..." 0 {    }

# Windows menu:
menuText R Windows "" 0
menuText R WindowsComment " " 0 {/   }
menuText R WindowsGList " " 0 {/    }
menuText R WindowsPGN "  PGN" 0 \
  {/       PGN}
menuText R WindowsTmt " " 2 {/ Open/close the tournament finder}
menuText R WindowsSwitcher " " 0 \
  {/     }
menuText R WindowsMaint " " 0 \
  {/  }
menuText R WindowsECO "  ECO" 0 {/    ECO}
menuText R WindowsRepertoire "  " 0 \
  {/    }
menuText R WindowsStats " " 0 \
  {/   }
menuText R WindowsTree "  " 0 {/    }
menuText R WindowsTB "  " 1 \
  {/    }

# Tools menu:
menuText R Tools "" 0
menuText R ToolsAnalysis " ..." 0 \
  {/  }
menuText R ToolsAnalysis2 "  #2..." 17 \
  {/   }
menuText R ToolsCross " " 0 {     }
menuText R ToolsEmail "  " 0 \
  {/    }
menuText R ToolsFilterGraph " " 7 \
  {/   }
menuText R ToolsOpReport "  " 0 \
  {     }
menuText R ToolsTracker " "  0 {     }
menuText R ToolsPInfo "  "  0 \
  {/     }
menuText R ToolsRating " " 0 \
  {      }
menuText R ToolsScore " " 0 {     }
menuText R ToolsExpCurrent "  " 8 \
  {     }
menuText R ToolsExpCurrentPGN "    PGN..." 15 \
  {     PGN}
menuText R ToolsExpCurrentHTML "    HTML..." 15 \
  {     HTML}
menuText R ToolsExpCurrentLaTeX "    LaTeX..." 15 \
  {     LaTeX}
menuText R ToolsExpFilter "   " 1 \
  {      }
menuText R ToolsExpFilterPGN "     PGN..." 17 \
  {      PGN}
menuText R ToolsExpFilterHTML "     HTML..." 17 \
  {      HTML}
menuText R ToolsExpFilterLaTeX "     LaTeX..." 17 \
  {      LaTeX}
menuText R ToolsImportOne "    PGN..." 0 \
  {     PGN}
menuText R ToolsImportFile "  PGN..." 7 \
  {    PGN}

# Options menu:
menuText R Options "" 0
menuText R OptionsSize " " 0 {  }
menuText R OptionsPieces " " 6 {  }
menuText R OptionsColors "..." 0 {    }
menuText R OptionsExport "" 0 {   }
menuText R OptionsFonts "" 0 { }
menuText R OptionsFontsRegular "" 0 {  }
menuText R OptionsFontsMenu "Menu" 0 {Change the menu font} ;# ***
menuText R OptionsFontsSmall "" 0 {  }
menuText R OptionsFontsFixed "" 0 {  }
menuText R OptionsGInfo "  " 0 {   }
menuText R OptionsLanguage "" 0 {   }
menuText R OptionsMoves "" 0 {  }
menuText R OptionsMovesAsk "   " 0 \
  {     }
menuText R OptionsMovesDelay " ..." 1 \
  {    }
menuText R OptionsMovesCoord "   " 0 \
  {     ("g1f3")}
menuText R OptionsMovesSuggest "  " 0 \
  {/   }
menuText R OptionsMovesKey " " 0 \
  {/   }
menuText R OptionsNumbers " " 0 {  }
menuText R OptionsStartup "" 3 {       }
menuText R OptionsWindows "" 0 {Window options}
menuText R OptionsWindowsIconify "" 5 \
  {   ,    }
menuText R OptionsWindowsRaise "" 5 \
  {   (,   ),   }
menuText R OptionsToolbar " " 12 \
  {/    }
menuText R OptionsECO "   ECO..." 7 {    ECO}
menuText R OptionsSpell "  ..." 6 \
  {  }
menuText R OptionsTable "  ..." 10 \
  {    ;        }
menuText R OptionsRecent "Recent files..." 0 \
  {Change the number of recent files displayed in the File menu} ;# ***
menuText R OptionsSave " " 0 \
  "     $::optionsFile"
menuText R OptionsAutoSave "   " 0 \
  {       }

# Help menu:
menuText R Help "" 0
menuText R HelpIndex "" 0 {  }
menuText R HelpGuide " " 0 {  }
menuText R HelpHints "" 0 { }
menuText R HelpContact " " 0 {  }
menuText R HelpTip " " 0 {  }
menuText R HelpStartup " " 0 {  }
menuText R HelpAbout " " 0 {  Scid}

# Game info box popup menu:
menuText R GInfoHideNext "   " 0
menuText R GInfoMaterial "  " 0
menuText R GInfoFEN " FEN" 5
menuText R GInfoMarks "    " 5
menuText R GInfoWrap "  " 0
menuText R GInfoFullComment "  " 10
menuText R GInfoTBNothing " : " 12
menuText R GInfoTBResult " :  " 12
menuText R GInfoTBAll " :    " 19
menuText R GInfoDelete "  ( )" 4
menuText R GInfoMark "  (  )" 4

# Main window buttons:
helpMsg R .button.start {   (: Home)}
helpMsg R .button.end {   (: End)}
helpMsg R .button.back {  (: LeftArrow)}
helpMsg R .button.forward {  (: RightArrow)}
helpMsg R .button.intoVar {   (: v)}
helpMsg R .button.exitVar {   (: z)}
helpMsg R .button.flip {  (: .)}
helpMsg R .button.coords {/  (: 0)}
helpMsg R .button.autoplay {  (: Ctrl+Z)}

# General buttons:
translate R Back {}
translate R Cancel {}
translate R Clear {}
translate R Close {}
translate R Defaults { }
translate R Delete {}
translate R Graph {}
translate R Help {}
translate R Import {}
translate R Index {}
translate R LoadGame { }
translate R BrowseGame { }
translate R MergeGame { }
translate R Preview { }
translate R Revert {}
translate R Save {}
translate R Search {}
translate R Stop {}
translate R Store {}
translate R Update {}
translate R ChangeOrient {  }
translate R None { }
translate R First {}
translate R Current {}
translate R Last {}

# General messages:
translate R game {}
translate R games {}
translate R move {}
translate R moves {}
translate R all {}
translate R Yes {}
translate R No {}
translate R Both {}
translate R King {}
translate R Queen {}
translate R Rook {}
translate R Bishop {}
translate R Knight {}
translate R Pawn {}
translate R White {}
translate R Black {}
translate R Player {}
translate R Rating {}
translate R RatingDiff {   ( - )}
translate R Event {}
translate R Site { }
translate R Country {}
translate R IgnoreColors {  }
translate R Date {}
translate R EventDate { }
translate R Decade {}
translate R Year {}
translate R Month {}
translate R Months {     
       }
translate R Days {      }
translate R YearToToday { }
translate R Result {}
translate R Round {}
translate R Length {}
translate R ECOCode { ECO}
translate R ECO {ECO}
translate R Deleted {}
translate R SearchResults { }
translate R OpeningTheDatabase { }
translate R Database { }
translate R Filter {}
translate R noGames { }
translate R allGames { }
translate R empty {}
translate R clipbase { }
translate R score {}
translate R StartPos { }
translate R Total {}

# Game information:
translate R twin {}
translate R deleted {}
translate R comment {}
translate R hidden {}
translate R LastMove { }
translate R NextMove {}
translate R GameStart { }
translate R LineStart { }
translate R GameEnd { }
translate R LineEnd { }

# Player information:
translate R PInfoAll {  <b></b> }
translate R PInfoFilter {  <b></b> }
translate R PInfoAgainst { }
translate R PInfoMostWhite {    }
translate R PInfoMostBlack {    }
translate R PInfoRating { }
translate R PInfoBio {}

# Tablebase information:
translate R Draw {}
translate R stalemate {}
translate R withAllMoves { }
translate R withAllButOneMove {   }
translate R with {}
translate R only {}
translate R lose {}
translate R loses {}
translate R allOthersLose {  }
translate R matesIn { }
translate R hasCheckmated {}
translate R longest { }

# Tip of the day:
translate R Tip {}
translate R TipAtStartup {  }

# Tree window menus:
menuText R TreeFile "" 0
menuText R TreeFileSave " -" 0 { - (.stc)   }
menuText R TreeFileFill " -" 0 \
  { -   }
menuText R TreeFileBest "  " 0 {        }
menuText R TreeFileGraph " " 0 {      }
menuText R TreeFileCopy "      " 1 \
  {      }
menuText R TreeFileClose " " 0 {    }
menuText R TreeSort "" 0
menuText R TreeSortAlpha " " 0
menuText R TreeSortECO " ECO" 0
menuText R TreeSortFreq " " 0
menuText R TreeSortScore " " 0
menuText R TreeOpt "" 0
menuText R TreeOptLock "" 0 {/   /   }
menuText R TreeOptTraining "" 0 {/     }
menuText R TreeOptAutosave " -" 0 \
  {  -      }
menuText R TreeHelp "" 0
menuText R TreeHelpTree "  " 0
menuText R TreeHelpIndex "" 0
translate R SaveCache { }
translate R Training {}
translate R LockTree {}
translate R TreeLocked {}
translate R TreeBest {}
translate R TreeBestGames {   }

# Finder window:
menuText R FinderFile "" 0
menuText R FinderFileSubdirs "  " 0
menuText R FinderFileClose "  " 0
menuText R FinderSort "" 0
menuText R FinderSortType "" 0
menuText R FinderSortSize "" 0
menuText R FinderSortMod "" 0
menuText R FinderSortName "" 0
menuText R FinderSortPath "" 0
menuText R FinderTypes "" 0
menuText R FinderTypesScid "  Scid" 0
menuText R FinderTypesOld "   Scid" 0
menuText R FinderTypesPGN " PGN" 0
menuText R FinderTypesEPD " EPD" 0
menuText R FinderTypesRep " " 0
menuText R FinderHelp "" 0
menuText R FinderHelpFinder "   " 0
menuText R FinderHelpIndex "" 0
translate R FileFinder { }
translate R FinderDir {}
translate R FinderDirs {}
translate R FinderFiles {}
translate R FinderUpDir {}

# Tournament finder:
menuText R TmtFile "" 0
menuText R TmtFileUpdate "" 0
menuText R TmtFileClose "  " 0
menuText R TmtSort "" 0
menuText R TmtSortDate "" 0
menuText R TmtSortPlayers "" 0
menuText R TmtSortGames "" 0
menuText R TmtSortElo "Elo" 0
menuText R TmtSortSite "" 0
menuText R TmtSortEvent "" 1
menuText R TmtSortWinner "" 0
translate R TmtLimit " "
translate R TmtMeanElo "   Elo"
translate R TmtNone "   ."

# Graph windows:
menuText R GraphFile "" 0
menuText R GraphFileColor "   PostScript..." 8
menuText R GraphFileGrey "  PostScript   ..." 8
menuText R GraphFileClose " " 6
menuText R GraphOptions "" 0
menuText R GraphOptionsWhite "" 0
menuText R GraphOptionsBlack "" 0
menuText R GraphOptionsBoth "" 1
menuText R GraphOptionsPInfo "  " 0
translate R GraphFilterTitle " :   1000 "

# Analysis window:
translate R AddVariation { }
translate R AddMove { }
translate R Annotate {}
translate R AnalysisCommand { }
translate R PreviousChoices { }
translate R AnnotateTime {     .}
translate R AnnotateWhich { }
translate R AnnotateAll {   }
translate R AnnotateWhite {   }
translate R AnnotateBlack {   }
translate R AnnotateNotBest {    }

# Analysis Engine open dialog:
translate R EngineList {  }
translate R EngineName {}
translate R EngineCmd {}
translate R EngineArgs {}
translate R EngineDir {}
translate R EngineElo {Elo}
translate R EngineTime {}
translate R EngineNew {}
translate R EngineEdit {}
translate R EngineRequired {,  , - ;   }

# Stats window menus:
menuText R StatsFile "" 0
menuText R StatsFilePrint "  ..." 0
menuText R StatsFileClose " " 0
menuText R StatsOpt "" 0

# PGN window menus:
menuText R PgnFile "" 0
menuText R PgnFilePrint "  ..." 0
menuText R PgnFileClose "  PGN" 0
menuText R PgnOpt "" 0
menuText R PgnOptColor " " 0
menuText R PgnOptShort " (3 ) " 0
menuText R PgnOptSymbols "  " 1
menuText R PgnOptIndentC "  " 0
menuText R PgnOptIndentV "  " 7
menuText R PgnOptColumn "  (    )" 1
menuText R PgnOptSpace "   " 1
menuText R PgnOptStripMarks "  /" 1
menuText R PgnColor "" 0
menuText R PgnColorHeader "..." 0
menuText R PgnColorAnno "..." 0
menuText R PgnColorComments "..." 0
menuText R PgnColorVars "..." 0
menuText R PgnColorBackground "..." 0
menuText R PgnHelp "" 0
menuText R PgnHelpPgn "  PGN" 0
menuText R PgnHelpIndex "" 0

# Crosstable window menus:
menuText R CrosstabFile "" 0
menuText R CrosstabFileText "   ..." 9
menuText R CrosstabFileHtml "   HTML..." 9
menuText R CrosstabFileLaTeX "   LaTeX..." 9
menuText R CrosstabFileClose "   " 0
menuText R CrosstabEdit "" 0
menuText R CrosstabEditEvent "" 0
menuText R CrosstabEditSite "" 0
menuText R CrosstabEditDate "" 0
menuText R CrosstabOpt "" 0
menuText R CrosstabOptAll "" 0
menuText R CrosstabOptSwiss "" 0
menuText R CrosstabOptKnockout " " 0
menuText R CrosstabOptAuto "" 1
menuText R CrosstabOptAges " ()" 8
menuText R CrosstabOptNats "" 0
menuText R CrosstabOptRatings "" 0
menuText R CrosstabOptTitles "" 0
menuText R CrosstabOptBreaks "  -" 4
menuText R CrosstabOptDeleted "  " 8
menuText R CrosstabOptColors " (  )" 0
menuText R CrosstabOptColumnNumbers "  (   )" 2
menuText R CrosstabOptGroup "  " 0
menuText R CrosstabSort "" 0
menuText R CrosstabSortName "" 0
menuText R CrosstabSortRating "" 0
menuText R CrosstabSortScore "" 0
menuText R CrosstabColor "" 0
menuText R CrosstabColorPlain " " 0
menuText R CrosstabColorHyper "" 0
menuText R CrosstabHelp "" 0
menuText R CrosstabHelpCross "  " 0
menuText R CrosstabHelpIndex " " 0
translate R SetFilter { }
translate R AddToFilter {  }
translate R Swiss {}

# Opening report window menus:
menuText R OprepFile "" 0
menuText R OprepFileText "   ..." 9
menuText R OprepFileHtml "  HTML..." 9
menuText R OprepFileLaTeX "  LaTeX..." 9
menuText R OprepFileOptions "..." 0
menuText R OprepFileClose "  " 0
menuText R OprepHelp "" 0
menuText R OprepHelpReport "   " 0
menuText R OprepHelpIndex " " 0

# Repertoire editor:
menuText R RepFile "" 0
menuText R RepFileNew "" 0
menuText R RepFileOpen "..." 0
menuText R RepFileSave "..." 0
menuText R RepFileSaveAs " ..." 5
menuText R RepFileClose " " 0
menuText R RepEdit "" 0
menuText R RepEditGroup " " 4
menuText R RepEditInclude "  " 4
menuText R RepEditExclude "  " 4
menuText R RepView "" 0
menuText R RepViewExpand "  " 0
menuText R RepViewCollapse "  " 0
menuText R RepSearch "" 0
menuText R RepSearchAll " ..." 0
menuText R RepSearchDisplayed "  ..." 0
menuText R RepHelp "" 0
menuText R RepHelpRep "  " 0
menuText R RepHelpIndex " " 0
translate R RepSearch "  "
translate R RepIncludedLines " "
translate R RepExcludedLines " "
translate R RepCloseDialog {     .

        ?
}

# Header search:
translate R HeaderSearch {  }
translate R GamesWithNoECO {   ECO?}
translate R GameLength { }
translate R FindGamesWith {   }
translate R StdStart { }
translate R Promotions {   8 }
translate R Comments {}
translate R Variations {}
translate R Annotations {}
translate R DeleteFlag { }
translate R WhiteOpFlag {  }
translate R BlackOpFlag {  }
translate R MiddlegameFlag {}
translate R EndgameFlag {}
translate R NoveltyFlag {}
translate R PawnFlag { }
translate R TacticsFlag {}
translate R QsideFlag {   }
translate R KsideFlag {   }
translate R BrilliancyFlag { }
translate R BlunderFlag {}
translate R UserFlag {}
translate R PgnContains { PGN  }

# Game list window:
translate R GlistNumber {}
translate R GlistWhite {}
translate R GlistBlack {}
translate R GlistWElo { Elo}
translate R GlistBElo { Elo}
translate R GlistEvent {}
translate R GlistSite {}
translate R GlistRound {}
translate R GlistDate {}
translate R GlistYear {}
translate R GlistEDate { }
translate R GlistResult {}
translate R GlistLength {}
translate R GlistCountry {}
translate R GlistECO {ECO}
translate R GlistOpening {}
translate R GlistEndMaterial { }
translate R GlistDeleted {}
translate R GlistFlags {}
translate R GlistVars {}
translate R GlistComments {}
translate R GlistAnnos {}
translate R GlistStart {}
translate R GlistGameNumber { }
translate R GlistFindText { }
translate R GlistMoveField {}
translate R GlistEditField {}
translate R GlistAddField {}
translate R GlistDeleteField {}
translate R GlistWidth {}
translate R GlistAlign {}
translate R GlistColor {}
translate R GlistSep {}

# Maintenance window:
translate R DatabaseName { :}
translate R TypeIcon { .:}
translate R NumOfGames {:}
translate R NumDeletedGames { :}
translate R NumFilterGames {  :}
translate R YearRange { :}
translate R RatingRange { :}
translate R Flag {}
translate R DeleteCurrent {  }
translate R DeleteFilter {   }
translate R DeleteAll {  }
translate R UndeleteCurrent {  }
translate R UndeleteFilter {   }
translate R UndeleteAll {  }
translate R DeleteTwins { }
translate R MarkCurrent {  }
translate R MarkFilter {    }
translate R MarkAll {  }
translate R UnmarkCurrent {    }
translate R UnmarkFilter {     }
translate R UnmarkAll {    }
translate R Spellchecking { }
translate R Players {}
translate R Events {}
translate R Sites {}
translate R Rounds {}
translate R DatabaseOps {  }
translate R ReclassifyGames {  ECO}
translate R CompactDatabase { }
translate R SortDatabase { }
translate R AddEloRatings {  Elo}
translate R AutoloadGame {  #}
translate R StripTags {  PGN}
translate R StripTag { }
translate R Cleaner {}
translate R CleanerHelp {
       ,     .

   ECO         .
}
translate R CleanerConfirm {
       !

    ,       ,       .

 ,      ?
}

# Comment editor:
translate R AnnotationSymbols  { :}
translate R Comment {:}

# Board search:
translate R BoardSearch { }
translate R FilterOperation {   :}
translate R FilterAnd { ( )}
translate R FilterOr { (  )}
translate R FilterIgnore { (  )}
translate R SearchType { :}
translate R SearchBoardExact {  (   )}
translate R SearchBoardPawns { (  ,      )}
translate R SearchBoardFiles { (  ,      )}
translate R SearchBoardAny { (  ,     )}
translate R LookInVars {  }

# Material search:
translate R MaterialSearch {  }
translate R Material {}
translate R Patterns {}
translate R Zero {}
translate R Any {}
translate R CurrentBoard { }
translate R CommonEndings { }
translate R CommonPatterns { }
translate R MaterialDiff {  }
translate R squares {}
translate R SameColor {  }
translate R OppColor { }
translate R Either {}
translate R MoveNumberRange { }
translate R MatchForAtLeast {   }
translate R HalfMoves {}

# Game saving:
translate R Today {}
translate R ClassifyGame { }

# Setup position:
translate R EmptyBoard { }
translate R InitialBoard { }
translate R SideToMove { }
translate R MoveNumber { }
translate R Castling {}
translate R EnPassentFile {  - }
translate R ClearFen { FEN}
translate R PasteFen { FEN}

# Replace move dialog:
translate R ReplaceMove { }
translate R AddNewVar {  }
translate R ReplaceMoveMessage {  .

   ,       ,      .

(        "   "   ":".)}

# Make database read-only dialog:
translate R ReadOnlyDialog {     "  ",    .
     ,      ""  .
   ECO  .

      ,     .

       "  "?}

# Clear game dialog:
translate R ClearGameDialog {   .

      ?
}

# Exit dialog:
translate R ExitDialog {     Scid?}
translate R ExitUnsaved {     ,   .
     .}

# Import window:
translate R PasteCurrentGame {  }
translate R ImportHelp1 {      PGN   .}
translate R ImportHelp2 {       .}

# ECO Browser:
translate R ECOAllSections {  ECO}
translate R ECOSection { ECO}
translate R ECOSummary { }
translate R ECOFrequency {  }

# Opening Report:
translate R OprepTitle {  }
translate R OprepReport {}
translate R OprepGenerated {  }
translate R OprepStatsHist {  }
translate R OprepStats {}
translate R OprepStatAll { }
translate R OprepStatBoth { }
translate R OprepStatSince {}
translate R OprepOldest { }
translate R OprepNewest { }
translate R OprepPopular { }
translate R OprepFreqAll {   :   }
translate R OprepFreq1   {  : }
translate R OprepFreq5   { 5  : }
translate R OprepFreq10  { 10  : }
translate R OprepEvery {   %u }
translate R OprepUp { %u%s   }
translate R OprepDown { %u%s   }
translate R OprepSame {    }
translate R OprepMostFrequent {  }
translate R OprepRatingsPerf {  }
translate R OprepAvgPerf {   }
translate R OprepWRating { }
translate R OprepBRating { }
translate R OprepWPerf { }
translate R OprepBPerf { }
translate R OprepHighRating {     }
translate R OprepTrends { }
translate R OprepResults {   }
translate R OprepLength { }
translate R OprepFrequency {}
translate R OprepWWins { : }
translate R OprepBWins { : }
translate R OprepDraws {:      }
translate R OprepWholeDB {  }
translate R OprepShortest {  }
translate R OprepMovesThemes {  }
translate R OprepMoveOrders {    }
translate R OprepMoveOrdersOne \
  {      :}
translate R OprepMoveOrdersAll \
  {%u (-)    :}
translate R OprepMoveOrdersMany \
  { %u     .  %u :}
translate R OprepMovesFrom {   }
translate R OprepThemes { }
translate R OprepThemeDescription {    %u}
translate R OprepThemeSameCastling { }
translate R OprepThemeOppCastling { }
translate R OprepThemeNoCastling {   }
translate R OprepThemeKPawnStorm {    }
translate R OprepThemeQueenswap { }
translate R OprepThemeIQP {  d}
translate R OprepThemeWP567 {   5/6/7 }
translate R OprepThemeBP234 {   2/3/4 }
translate R OprepThemeOpenCDE {  c/d/e}
translate R OprepTheme1BishopPair {  }
translate R OprepEndgames {}
translate R OprepReportGames { }
translate R OprepAllGames    { }
translate R OprepEndClass {    }
translate R OprepTheoryTable { }
translate R OprepTableComment {   %u    .}
translate R OprepExtraMoves {    }
translate R OprepMaxGames {     }

# Piece Tracker window:
translate R TrackerSelectSingle {      .}
translate R TrackerSelectPair {      ;   -     .}
translate R TrackerSelectPawn {      ;    -    8 .}
translate R TrackerStat {}
translate R TrackerGames {%     }
translate R TrackerTime {%    }
translate R TrackerMoves {}
translate R TrackerMovesStart {  ,    .}
translate R TrackerMovesStop {  ,    .}

# Game selection dialogs:
translate R SelectAllGames {   }
translate R SelectFilterGames {   }
translate R SelectTournamentGames {   }
translate R SelectOlderGames {  }

# Delete Twins window:
translate R TwinsNote {   ,         ,    .      ,    .
:         -,     . }
translate R TwinsCriteria {:   ...}
translate R TwinsWhich { , }
translate R TwinsColors {     ?}
translate R TwinsEvent {  ?}
translate R TwinsSite {  ?}
translate R TwinsRound {  ?}
translate R TwinsYear {  ?}
translate R TwinsMonth {  ?}
translate R TwinsDay {  ?}
translate R TwinsResult {  ?}
translate R TwinsECO {   ECO?}
translate R TwinsMoves {  ?}
translate R TwinsPlayers {   :}
translate R TwinsPlayersExact { }
translate R TwinsPlayersPrefix { 4  }
translate R TwinsWhen {  }
translate R TwinsSkipShort {     5 ?}
translate R TwinsUndelete {    ?}
translate R TwinsSetFilter { -   ?}
translate R TwinsComments {   ?}
translate R TwinsVars {    ?}
translate R TwinsDeleteWhich {  :}
translate R TwinsDeleteShorter {  }
translate R TwinsDeleteOlder {   }
translate R TwinsDeleteNewer {   }
translate R TwinsDelete { }

# Name editor window:
translate R NameEditType {  }
translate R NameEditSelect { }
translate R NameEditReplace {}
translate R NameEditWith {}
translate R NameEditMatches {:    Ctrl+1  Ctrl+9  }

# Classify window:
translate R Classify {}
translate R ClassifyWhich {  ECO  }
translate R ClassifyAll {  (   )}
translate R ClassifyYear {   }
translate R ClassifyMonth {   }
translate R ClassifyNew {   }
translate R ClassifyCodes {  ECO}
translate R ClassifyBasic {   ("B12", ...)}
translate R ClassifyExtended {,  Scid ("B12j", ...)}

# Compaction:
translate R NameFile { }
translate R GameFile { }
translate R Names {}
translate R Unused { }
translate R SizeKb { (kb)}
translate R CurrentState {  }
translate R AfterCompaction { }
translate R CompactNames {  }
translate R CompactGames {  }

# Sorting:
translate R SortCriteria {}
translate R AddCriteria { }
translate R CommonSorts {  }
translate R Sort {}

# Exporting:
translate R AddToExistingFile {    ?}
translate R ExportComments { ?}
translate R ExportVariations { ?}
translate R IndentComments {  ?}
translate R IndentVariations {  ?}
translate R ExportColumnStyle {  (    )?}
translate R ExportSymbolStyle {  :}
translate R ExportStripMarks {  /  ?}

# Goto game/move dialogs:
translate R LoadGameNumber {     :}
translate R GotoMoveNumber {   :}

# Copy games dialog:
translate R CopyGames { }
translate R CopyConfirm {
    
 [thousands $nGamesToCopy]  
    "$fromName"
   "$targetName"?
}
translate R CopyErr {   }
translate R CopyErrSource {  }
translate R CopyErrTarget {  }
translate R CopyErrNoGames {    }
translate R CopyErrReadOnly {  }
translate R CopyErrNotOpen { }

# Colors:
translate R LightSquares { }
translate R DarkSquares { }
translate R SelectedSquares { }
translate R SuggestedSquares {   }
translate R WhitePieces { }
translate R BlackPieces { }
translate R WhiteBorder { }
translate R BlackBorder { }

# Novelty window:
translate R FindNovelty {  }
translate R Novelty { }
translate R NoveltyInterrupt {   }
translate R NoveltyNone {      }
translate R NoveltyHelp {
Scid      ,    ,           ECO.
}

# Upgrading databases:
translate R Upgrading {}
translate R ConfirmOpenNew {
     (Scid 2),       Scid 3,      (Scid 3)   .

      ?
}
translate R ConfirmUpgrade {
     (Scid 2). A new-format version of the database must be created before it can be used in Scid 3.
Scid 3       ,   . 

       ,       .

    ,     .    ,      .

       ?
}

# Recent files options:
translate R RecentFilesMenu {Number of recent files in File menu} ;# ***
translate R RecentFilesExtra {Number of recent files in extra submenu} ;# ***

}
# end of russian.tcl
# bookmark.tcl:
# Bookmarks list and Recently-used files list in Scid.

set bookmarks(data) {}
set bookmarks(subMenus) 0

set bookmarks(file) [file join $scidUserDir "scid.bkm"]
catch {source $bookmarks(file)}

namespace eval ::bookmarks {}

# ::bookmarks::postMenu:
#   Posts the bookmarks toolbar menu.
#
proc ::bookmarks::postMenu {} {
  tkMbPost .tb.bkm
  if {[::bookmarks::canAdd]} {
    .tb.bkm.menu activate 0
  } else {
    .tb.bkm.menu activate 2
  }
}

# ::bookmarks::refresh:
#   Updates all bookmarks submenus.
#
proc ::bookmarks::refresh {} {
  foreach menu {.menu.file.bookmarks .tb.bkm.menu} {
    ::bookmarks::refresh_menu $menu
  }
}

proc ::bookmarks::refresh_menu {menu} {
  global bookmarks helpMessage

  ::bookmarks::deleteChildren $menu
  $menu delete 0 end
  # $menu configure -disabledforeground [$menu cget -foreground]
  set len [llength $bookmarks(data)]
  $menu add command -label FileBookmarksAdd -command ::bookmarks::addCurrent
  set helpMessage($menu,0) FileBookmarksAdd
  $menu add cascade -label FileBookmarksFile -menu $menu.file
  menu $menu.file
  set helpMessage($menu,1) FileBookmarksFile
  if {! [::bookmarks::canAdd]} {
    $menu entryconfigure 0 -state disabled
    $menu entryconfigure 1 -state disabled
  }
  $menu add command -label FileBookmarksEdit -command ::bookmarks::edit
  set helpMessage($menu,2) FileBookmarksEdit
  if {$bookmarks(subMenus)} {
    set display List
    set newval 0
  } else {
    set display Sub
    set newval 1
  }
  $menu add command -label FileBookmarks$display \
    -command "set bookmarks(subMenus) $newval; ::bookmarks::refresh"
  set helpMessage($menu,3) FileBookmarks$display
  foreach tag [list Add File Edit $display] {
    configMenuText $menu FileBookmarks$tag FileBookmarks$tag $::language
  }
if {$len == 0} { return }
  $menu add separator

  set current $menu
  set inSubMenu 0
  set nfolders 0
  foreach entry $bookmarks(data) {
    if {$entry == ""} { continue }
    set isfolder [::bookmarks::isfolder $entry]

    if {$isfolder} {
      incr nfolders
      $menu.file add command -label [::bookmarks::text $entry] \
        -command "::bookmarks::addCurrent $nfolders"
    }

    if {! $bookmarks(subMenus)} {
      if {$isfolder} {
        $current add command -label [::bookmarks::itext $entry]
      } elseif {!$isfolder} {
        $current add command -label [::bookmarks::itext $entry] \
          -command [list ::bookmarks::go $entry]
      }
      continue
    }

    # Move out of submenu where necessary:
    if {$isfolder  &&  $inSubMenu} {
      set current [winfo parent $current]
    }

    if {$isfolder} {
      # Menu (folder) entry:
      set current [::bookmarks::newSubMenu $current $entry]
      set inSubMenu 1
    } else {
      # Bookmark entry:
      $current add command -label [::bookmarks::text $entry] \
        -command [list ::bookmarks::go $entry]
    }
  }
}

# ::bookmarks::canAdd:
#   Returns 1 if the current game can be added as a bookmark.
#   It must be in an open database, not a PGN file, and not game number 0.
#
proc ::bookmarks::canAdd {} {
  if {! [sc_base inUse]} { return 0 }
  if {[sc_game number] == 0} { return 0 }
  if {[sc_base current] == [sc_info clipbase]} { return 0 }
  if {[file pathtype [sc_base filename]] != "absolute"} { return 0 }
  foreach suffix {.pgn .PGN .pgn.gz} {
    if {[string match "*$suffix" [sc_base filename]]} { return 0 }
  }
  return 1
}

# ::bookmarks::addCurrent:
#   Adds the current game to the bookmarks list.
#
proc ::bookmarks::addCurrent {{folder 0}} {
  global bookmarks
  if {! [sc_base inUse]} {
    return 
  }
  set text [::bookmarks::new game]
  set len [llength $bookmarks(data)]
  set fcount 0
  for {set i 0} {$i < $len} {incr i} {
    if {[::bookmarks::isfolder [lindex $bookmarks(data) $i]]} {
      if {$fcount == $folder} { break }
      incr fcount
    }
  }
  set bookmarks(data) [linsert $bookmarks(data) $i $text]
  ::bookmarks::save
  ::bookmarks::refresh
}

# city:
#   Returns the city name given a full site.
#
proc city {site} {
  regsub { [A-Z][A-Z][A-Z]$} $site "" site
  return [string trim [surname $site]]
}

# ::bookmarks::new:
#   Returns a bookmarks list entry for the current game or a new folder.
#
proc ::bookmarks::new {type} {
  if {$type == "folder"} { return [list "f" ""] }
  set text "[file tail [sc_base filename]]: [sc_game info result], "
  append text "[surname [sc_game info white]] - "
  append text "[surname [sc_game info black]], "
  append text "[city [sc_game info site]] "
  set round [sc_game info round]
  if {$round != ""  &&  $round != "?"} { append text "($round) " }
  append text "[sc_game info year]"
  set list [list "g" $text]
  sc_game pgn
  lappend list [sc_base filename] [sc_game number] [sc_pos pgnOffset]
  lappend list [sc_game info white] [sc_game info black]
  lappend list [sc_game info year] [sc_game info site]
  lappend list [sc_game info round] [sc_game info result]
  return $list
}

# ::bookmarks::go:
#   Jumps to a selected bookmark.
#
proc ::bookmarks::go {entry} {
  if {[::bookmarks::isfolder $entry]} { return }
  set fname [lindex $entry 2]
  set gnum [lindex $entry 3]
  set ply [lindex $entry 4]
  set slot [sc_base slot $fname]
  if {$slot != 0} {
    sc_base switch $slot
  } else {
    busyCursor .
    if {[catch {openBase [file rootname $fname]} result]} {
      unbusyCursor .
      tk_messageBox -icon warning -type ok -parent . \
        -title "Scid" -message "Unable to load the database:\n$fname\n\n$result"
      return
    }
    unbusyCursor .
    set ::glist 1
    ::recentFiles::add "[file rootname $fname].si3"
  }
  # Find and load the best database game matching the bookmark:
  set white [lindex $entry 5]
  set black [lindex $entry 6]
  set site [lindex $entry 7]
  set round [lindex $entry 8]
  set year [lindex $entry 9]
  set result [lindex $entry 10]

  set best [sc_game find $gnum $white $black $site $round $year $result]
  if {[catch {sc_game load $best}]} {
    tk_messageBox -icon warning -type ok -parent . \
      -title "Scid" -message "Unable to load game number: $best"
  } else {
    sc_move pgn $ply
  }
  updateGList
  ::tree::refresh
  updateStatsWin
  updateMenuStates
  updateBoardAndPgn .board
  updateTitle
  updateStatusBar
}

# ::bookmarks::deleteChildren:
#   Deletes all submenus of a bookmark menu.
#
proc ::bookmarks::deleteChildren {w} {
  foreach child [winfo children $w] {
    ::bookmarks::deleteChildren $child
    destroy $child
  }
}

# ::bookmarks::newSubMenu:
#   Creates a new bookmark submenu.
#
proc ::bookmarks::newSubMenu {w entry} {
  set i 1
  while {[winfo exists $w.m$i]} { incr i }
  $w add cascade -label [::bookmarks::text $entry] -menu $w.m$i
  menu $w.m$i -tearoff 0
  return $w.m$i
}

# Globals used for bookmark editing:
#
set bookmarks(edit) ""
set bookmarks(ismenu) 0

# Button images for bookmark editing:

image create photo bookmark_up -data {
R0lGODdhGAAYAMIAALu7uwAAAMzM/5mZ/2ZmzP///zMzZgAAACwAAAAAGAAYAAADRgi63P4w
ykmrvTirEPQKwtBpYChmpUmMVVAI5kCsbfGqMy25dpzPLAfvNij+gBCDUokjLJUUQ9OAkRpn
1Mvz6el6v+AwOAEAOw==
}

image create photo bookmark_down -data {
R0lGODdhGAAYAMIAALu7uzMzZv///8zM/5mZ/2ZmzAAAAAAAACwAAAAAGAAYAAADSQi63P4w
ykmrvRiHzbcWw0AQRfCFY0l1ATiSLGQINCiSRZ4b0UyjOB1PMgvddIXhxABEKinM1C5jkD4v
1WSGYbhuv+CweExeJAAAOw==
}

# ::bookmarks::edit:
#   Creates the bookmark editing window.
#
proc ::bookmarks::edit {} {
  global bookmarks
  set w .bmedit
  if {[winfo exists $w]} { return }
  set bookmarks(old) $bookmarks(data)
  toplevel $w
  wm title $w "Scid: [tr FileBookmarksEdit]"
  wm transient $w .
  bind $w <F1> {helpWindow Bookmarks}
  entry $w.e -width 40 -foreground black -background white \
    -textvariable bookmarks(edit) -font font_Small -exportselection 0
  bind $w.e <FocusIn>  {.bmedit.e configure -background lightYellow}
  bind $w.e <FocusOut> {.bmedit.e configure -background white}

  trace variable bookmarks(edit) w ::bookmarks::edit_refresh
  pack $w.e -side top -fill x
  pack [frame $w.b2] -side bottom -fill x
  pack [frame $w.b1] -side bottom -fill x
  pack [frame $w.f] -side top -fill both -expand 1
  listbox $w.f.list -width 50 -height 10 -yscrollcommand "$w.f.ybar set" \
    -fg black -bg white -exportselection 0 \
    -selectbackground lightCyan2 -font font_Small -setgrid 1
  scrollbar $w.f.ybar -takefocus 0 -command "$w.f.list yview"
  bind $w.f.list <<ListboxSelect>>  ::bookmarks::edit_select
  pack $w.f.ybar -side right -fill y
  pack $w.f.list -side left -fill x -expand 1
  foreach entry $bookmarks(data) {
    $w.f.list insert end [::bookmarks::itext $entry]
  }
  button $w.b1.newFolder -text "New submenu" \
    -command {::bookmarks::edit_new folder}
  button $w.b1.newGame -text [tr FileBookmarksAdd] \
    -command {::bookmarks::edit_new game}
  if {! [::bookmarks::canAdd]} { $w.b1.newGame configure -state disabled }
  button $w.b1.delete -text $::tr(Delete)  -command ::bookmarks::edit_delete
  button $w.b2.up -image bookmark_up -command {::bookmarks::edit_move up}
  button $w.b2.down -image bookmark_down -command {::bookmarks::edit_move down}
  foreach i [list $w.b2.up $w.b2.down] {
    $i configure -padx 0 -pady 0 -borderwidth 1
  }
  button $w.b2.ok -text "OK" -command ::bookmarks::edit_done
  button $w.b2.cancel -text "Cancel" -command {
    set bookmarks(data) $bookmarks(old)
    catch {grab release .bmedit}
    destroy .bmedit
  }
  pack $w.b1.newFolder $w.b1.newGame $w.b1.delete -side left -padx 2 -pady 2
  pack $w.b2.up $w.b2.down -side left -padx 2 -pady 2
  pack $w.b2.cancel $w.b2.ok -side right -padx 2 -pady 2
  set bookmarks(edit) ""

  wm withdraw $w
  update idletasks
  set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
                 - [winfo vrootx .]}]
  set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
                 - [winfo vrooty .]}]
  wm geom $w +$x+$y
  wm deiconify $w
  update
  catch {grab .bmedit}
}

# ::bookmarks::edit_done:
#    Updates the bookmarks and closes the bookmark editing window.
#
proc ::bookmarks::edit_done {} {
  catch {grab release .bmedit}
  destroy .bmedit
  ::bookmarks::save
  ::bookmarks::refresh
}

# ::bookmarks::edit_refresh:
#   Updates the bookmarks whenever the contents of the bookmark
#   editing entry box are changed.
#
proc ::bookmarks::edit_refresh {args} {
  global bookmarks
  set list .bmedit.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set text $bookmarks(edit)
  set e [lindex $bookmarks(data) $sel]
  set e [::bookmarks::settext $e $text]
  set text [::bookmarks::itext $e]
  set bookmarks(data) [lreplace $bookmarks(data) $sel $sel $e]
  $list insert $sel $text
  $list delete [expr $sel + 1]
  $list selection clear 0 end
  $list selection set $sel
}

# ::bookmarks::edit_select:
#   Sets the bookmark editing entry box when a bookmark is selected.
#
proc ::bookmarks::edit_select {{sel ""}} {
  global bookmarks
  set list .bmedit.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} {
    .bmedit.e delete 0 end
    return
  }
  if {$sel >= [llength $bookmarks(data)]} {
    $list selection clear 0 end
    set bookmarks(edit) ""
    return
  }
  set e [lindex $bookmarks(data) $sel]
  set bookmarks(ismenu) [::bookmarks::isfolder $e]
  set bookmarks(edit) [::bookmarks::text $e]
}

# ::bookmarks::isfolder:
#   Returns 1 if this bookmark entry is a folder (submenu).
#
proc ::bookmarks::isfolder {entry} {
  if {[lindex $entry 0] == "f"} { return 1 }
  return 0
}

# ::bookmarks::text:
#   Returns the entry text of a bookmark.
#
proc ::bookmarks::text {entry} {
  return [lindex $entry 1]
}

proc ::bookmarks::itext {entry} {
  set text ""
  if {[lindex $entry 0] == "f"} {
    append text "\[[lindex $entry 1]\]"
  } else {
    append text "    [lindex $entry 1]"
  }
  return $text
}

proc ::bookmarks::settext {entry text} {
  return [lreplace $entry 1 1 $text]
}

# ::bookmarks::edit_move:
#   Moves the selected bookmark "up" or "down" one place.
#
proc ::bookmarks::edit_move {{dir "up"}} {
  global bookmarks
  set w .bmedit
  set list $w.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set e [lindex $bookmarks(data) $sel]
  set text [::bookmarks::itext $e]
  set newsel $sel
  if {$dir == "up"} {
    incr newsel -1
    if {$newsel < 0} { return }
  } else {
    incr newsel
    if {$newsel >= [$list index end]} { return }
  }
  set bookmarks(data) [lreplace $bookmarks(data) $sel $sel]
  set bookmarks(data) [linsert $bookmarks(data) $newsel $e]
  $list selection clear 0 end
  $list delete $sel
  $list insert $newsel $text
  $list selection set $newsel
}

# ::bookmarks::edit_delete:
#   Deletes the selected bookmark.
#
proc ::bookmarks::edit_delete {} {
  global bookmarks
  set w .bmedit
  set list $w.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set bookmarks(data) [lreplace $bookmarks(data) $sel $sel]
  $list selection clear 0 end
  $list delete $sel
  set bookmarks(edit) ""
}

# ::bookmarks::edit_new:
#   Inserts a new entry ("folder" for a submenu or "game" for the
#   current game) after the selected bookmark.
#
proc ::bookmarks::edit_new {{type "folder"}} {
  global bookmarks
  set w .bmedit
  set list $w.f.list
  set folder 0
  if {[string index $type 0] == "f"} {
    set folder 1
    set entry [::bookmarks::new folder]
  } else {
    set entry [::bookmarks::new game]
  }
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} {
    lappend bookmarks(data) $entry
    set sel [$list index end]
    $list insert end [::bookmarks::itext $entry]
    $list selection clear 0 end
    $list selection set $sel
    $list see $sel
    ::bookmarks::edit_select
    return
  }
  incr sel
  set bookmarks(data) [linsert $bookmarks(data) $sel $entry]
  $list insert $sel [::bookmarks::itext $entry]
  $list selection clear 0 end
  $list selection set $sel
  $list see $sel
  ::bookmarks::edit_select
}

# ::bookmarks::save:
#   Saves the bookmarks file, reporting any error in a message box if
#   reportError is true.
#
proc ::bookmarks::save {{reportError 0}} {
  global bookmarks
  set f {}
  if  {[catch {open [file nativename $bookmarks(file)] w} f]} {
    if {$reportError} {
      tk_messageBox -title "Scid" -type ok -icon warning \
        -message "Unable to write bookmarks file: $bookmarks(file)\n$f"
    }
    return
  }
  puts $f "# Scid [sc_info version] bookmarks file\n"
  foreach i {subMenus data} {
    puts $f "set bookmarks($i) [list [set bookmarks($i)]]"
    puts $f ""
  }
  close $f
}


####################
# Recent files list:

set recentFiles(limit) 10   ;# Maximum number of recent files to remember.
set recentFiles(menu)   5   ;# Maximum number of files to show in File menu.
set recentFiles(extra)  5   ;# Maximum number of files to show in extra menu.
set recentFiles(data)  {}   ;# List of recently used files.

set recentFiles(file) [file join $scidUserDir "scid.rfl"]
catch {source $recentFiles(file)}

namespace eval ::recentFiles {}

# ::recentFiles::save
#   Saves the recent-file-list file, reporting any error in a message box
#   if reportError is true.
#
proc ::recentFiles::save {{reportError 0}} {
  global recentFiles
  set f {}
  if  {[catch {open [file nativename $recentFiles(file)] w} f]} {
    if {$reportError} {
      tk_messageBox -title "Scid" -type ok -icon warning \
        -message "Unable to write file: $recentFiles(file)\n$f"
    }
    return
  }
  puts $f "# Scid [sc_info version] recent files list"
  puts $f ""
  foreach i {limit menu extra data} {
    puts $f "set recentFiles($i) [list [set recentFiles($i)]]"
    puts $f ""
  }
  close $f
}

# ::recentFiles::add
#   Adds a file to the recent files list, or moves it to the front
#   if that file is already in the list.
#
proc ::recentFiles::add {fname} {
  global recentFiles
  set rlist $recentFiles(data)

  # Remove file ot be added from its current place in the
  # list, if it is there:
  while {1} {
    set idx [lsearch -exact $rlist $fname]
    if {$idx < 0} { break }
    set rlist [lreplace $rlist $idx $idx]
  }

  # Insert the current file at the start of the list:
  set rlist [linsert $rlist 0 $fname]

  # Trim the list if necessary:
  if {[llength $rlist] < $recentFiles(limit)} {
    set rlist [lrange $rlist 0 [expr $recentFiles(limit) - 1]]
  }

  set recentFiles(data) $rlist
  # ::recentFiles::save
}

# ::recentFiles::load
#   Loads the selected recent file, or swtches to its database slot
#   if it is already open.
#
proc ::recentFiles::load {fname} {
  set rname $fname
  if {[file extension $rname] == ".si3"} {
    set rname [file rootname $rname]
  }
  for {set i 1} {$i <= [sc_base count total]} {incr i} {
    if {$rname == [sc_base filename $i]} {
      sc_base switch $i
      ::recentFiles::add $fname
      updateGList
      ::tree::refresh
      updateStatsWin
      updateMenuStates
      updateBoardAndPgn .board
      updateTitle
      updateStatusBar
      return
    }
  }
  fileOpen $fname
}

# ::recentFiles::show
#   Adds the recent files to the end of the specified menu.
#   Returns the number of menu entries added.
#
proc ::recentFiles::show {menu} {
  global recentFiles
  set idx [$menu index end]
  incr idx
  set rlist $recentFiles(data)
  set nfiles [llength $rlist]
  set nExtraFiles [expr $nfiles - $recentFiles(menu)]
  if {$nfiles > $recentFiles(menu)} { set nfiles $recentFiles(menu) }
  if {$nExtraFiles > $recentFiles(extra)} {
    set nExtraFiles $recentFiles(extra)
  }
  if {$nExtraFiles < 0} { set nExtraFiles 0 }

  # Add menu commands for the most recent files:

  for {set i 0} {$i < $nfiles} {incr i} {
    set fname [lindex $rlist $i]
    set mname [::recentFiles::menuname $fname]
    set text [file tail $fname]
    $menu add command -label " $mname" \
      -command [list ::recentFiles::load $fname]
    set ::helpMessage($menu,$idx) "  $fname"
    incr idx
  }

  # If no extra submenu of recent files is needed, return now:
  if {$nExtraFiles <= 0} { return $nfiles }

  # Now add the extra submenu of files:
  catch {destroy $menu.recentFiles}
  menu $menu.recentFiles
  $menu add cascade -label "..." -underline 0 -menu $menu.recentFiles
  set i $nfiles
  for {set extra 0} {$extra < $nExtraFiles} {incr extra} {
    set fname [lindex $rlist $i]
    incr i
    set mname [::recentFiles::menuname $fname]
    set text [file tail $fname]
    $menu.recentFiles add command -label " $mname" \
      -command [list ::recentFiles::load $fname]
    set ::helpMessage($menu.recentFiles,extra) "  $fname"
  }
  return [expr $nfiles + 1]
}

# ::recentFiles::menuname
#   Given a full-path filename, returns a possibly shortened
#   version suitable for displaying in a menu, such as
#   "..../my/files/abc.pgn" instead of "/long/path/to/my/files/abc.pgn"
#
proc ::recentFiles::menuname {fname} {
  set mname $fname
  if {[file extension $mname] == ".si3"} {
    set mname [file rootname $mname]
  }
  if {[string length $mname] < 25} { return $mname }

  # Generate a menu name " ..../path/filename" for the file:
  set dir [file dirname $fname]
  while {1} {
    set tail [file join [file tail $dir] $mname]
    set dir [file dirname $dir]
    if {[string length $tail] > 20} { break }
    set mname $tail
  }
  set mname [file join .... $mname]
  return $mname
}

# ::recentFiles::configure
#   Produces a dialog box for configuring the number of recent files
#   to display in the File menu and in a submenu.
#
proc ::recentFiles::configure {} {
  global recentFiles
  set recentFiles(temp_menu) $recentFiles(menu)
  set recentFiles(temp_extra) $recentFiles(extra)
  set w .recentFilesDlg
  toplevel $w 
  wm title $w "Scid: [tr OptionsRecent]"
  label $w.lmenu -text $::tr(RecentFilesMenu)
  scale $w.menu -variable recentFiles(temp_menu) -from 0 -to 10 -length 250 \
    -orient horizontal -showvalue 0 -tickinterval 1 -font font_Small
  frame $w.sep -height 4
  label $w.lextra -text $::tr(RecentFilesExtra)
  scale $w.extra -variable recentFiles(temp_extra) -from 0 -to 10 -length 250 \
    -orient horizontal -showvalue 0 -tickinterval 1 -font font_Small
  pack $w.lmenu $w.menu $w.sep $w.lextra $w.extra -side top -padx 10
  addHorizontalRule $w
  pack [frame $w.b] -side bottom
  button $w.b.ok -text "OK" -command {
    set recentFiles(menu) $recentFiles(temp_menu)
    set recentFiles(extra) $recentFiles(temp_extra)
    catch {grab release .recentFilesDlg}
    destroy .recentFilesDlg
    ::recentFiles::save
    updateMenuStates
  }
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 5
  catch {grab $w}
}


# End of file: bookmark.tcl
# board.tcl: part of Scid
# Copyright (C) 2001 Shane Hudson. All rights reserved.

# images:
#    Array that maps piece letters to their two-character value.
#
array set images [list "R" wr "r" br "N" wn "n" bn "B" wb "b" bb \
                       "Q" wq "q" bq "K" wk "k" bk "P" wp "p" bp "." e]

############################################################
### Board setup window:

set setupBd {}
set setupFen {}

# pasteFEN:
#   Bypasses the board setup window and tries to paste the current
#   text selection as the setup position, producing a message box
#   if the selection does not appear to be a valid FEN string.
#
proc pasteFEN {} {
  set fenStr ""
  catch {selection get} fenStr
  set fenStr [string trim $fenStr]
  if {$fenStr == ""} {
    tk_messageBox -icon info -type ok -title "Scid" \
        -message "The current text selection is empty.\nTo paste the start board, select some text that contains a position in FEN notation."
    return
  }
  if {[catch {sc_game startBoard $fenStr}]} {
    if {[string length $fenStr] > 30} {
      set fenStr [string range $fenStr 0 30]
      append fenStr "..."
    }
    tk_messageBox -icon info -type ok -title "Scid" \
      -message "The current text selection is not a valid chess position in FEN notation.\nThe selected text is:\n\n$fenStr"
    return
  }
  updateBoardAndPgn
}

# makeSetupFen:
#    Reconstructs the FEN string from the current settings in the
#    setupBoard dialog. Check to see if the position is
#    acceptable (a position can be unacceptable by not having exactly
#    one King per side, or by having more than 16 pieces per side).
#
proc makeSetupFen {} {
  global setupFen setupBd moveNum toMove castling epFile
  set fenStr ""
  set errorStr [validateSetup]
  if {$errorStr != ""} {
    set fenStr "Invalid board: "
    append fenStr $errorStr
    return $fenStr
  }
  for {set bRow 56} {$bRow >= 0} {incr bRow -8} {
    if {$bRow < 56} { append fenStr "/" }
    set emptyRun 0
    for {set bCol 0} {$bCol < 8} {incr bCol} {
      set sq [expr $bRow + $bCol]
      set piece [string index $setupBd $sq]
      if {$piece == "."} {
        incr emptyRun
      } else {
        if {$emptyRun > 0} {
          append fenStr $emptyRun
          set emptyRun 0
        }
        append fenStr $piece
      }
    }
    if {$emptyRun > 0} { append fenStr $emptyRun }
  }
  append fenStr " " [string tolower [string index $toMove 0]] " "
  if {$castling == ""} {
    append fenStr "- "
  } else {
    append fenStr $castling " "
  }
  if {$epFile == ""  ||  $epFile == "-"} {
    append fenStr "-"
  } else {
    append fenStr $epFile
    if {$toMove == "White"} {
      append fenStr "6"
    } else {
      append fenStr "3"
    }
  }
  # We assume a halfmove clock of zero:
  append fenStr " 0 " $moveNum
  set setupFen $fenStr
  return $fenStr
}

# validateSetup:
#   Called by makeSetupFen to check that the board is sensible: that is,
#   that there is one king per side and there are at most 16 pieces per
#   side.
#
proc validateSetup {} {
  global setupBd
  set wkCount 0; set bkCount 0; set wCount 0; set bCount 0
  set wpCount 0; set bpCount 0
  for {set i 0} {$i < 64} {incr i} {
    set p [string index $setupBd $i]
    if {$p == "."} {
    } elseif {$p == "P"} { incr wCount; incr wpCount
    } elseif {$p == "p"} { incr bCount; incr bpCount
    } elseif {$p == "N" || $p == "B" || $p == "R" || $p == "Q"} {
      incr wCount
    } elseif {$p == "n" || $p == "b" || $p == "r" || $p == "q"} {
      incr bCount
    } elseif {$p == "K"} { incr wCount; incr wkCount
    } elseif {$p == "k"} { incr bCount; incr bkCount
    } else { return "Invalid piece: $p" }
  }
  if {$wkCount != 1} { return "There must be one white king"
  } elseif {$bkCount != 1} { return "There must be one black king"
  } elseif {$wCount > 16} { return "Too many white pieces"
  } elseif {$bCount > 16} { return "Too many black pieces"
  } elseif {$wpCount > 8} { return "Too many white pawns"
  } elseif {$bpCount > 8} { return "Too many black pawns" }
  return ""
}

# setupBoardPiece:
#    Called by setupBoard to set or clear a square when it is clicked on.
#    Sets that square to containing the active piece (stored in pastePiece)
#    unless it already contains that piece, in which case the square is
#    cleared to be empty.
#    XXX I need to add checking for a pawn, so pawns cannot be added to
#    the first or eighth rank.
#
proc setupBoardPiece { square } {
  global setupBd pastePiece boardSize setupFen
  set oldState $setupBd
  set setupBd {}
  set piece $pastePiece
  if {[string index $oldState $square] == $pastePiece} {
    set piece "."
  }
  if {$piece == "P"  ||  $piece == "p"} {
    if {$square < 8  ||  $square >= 56} {
      set setupBd $oldState
      unset oldState
      return
    }
  }
  append setupBd \
    [string range $oldState 0 [expr $square - 1]] \
    $piece \
    [string range $oldState [expr $square + 1] 63]
  unset oldState
  setBoard .setup.bd $setupBd $boardSize
  set setupFen [makeSetupFen]
}

# switchPastePiece:
#   Changes the active piece selection in the board setup dialog to the
#   next or previous piece in order.
#
proc switchPastePiece { switchType } {
  global pastePiece
  array set nextPiece { K Q Q R R B B N N P P k k q q r r b b n n p p K}
  array set prevPiece { K p Q K R Q B R N B P N k P q k r q b r n b p n}
  if {$switchType == "next"} {
    set pastePiece $nextPiece($pastePiece)
  } else {
    set pastePiece $prevPiece($pastePiece)
  }
}

# Global variables for entry of the start position:
set epFile {}          ;# legal values are empty, or "a"-"h".
set moveNum 1          ;# legal values are 1-999.
set setupStatus {}     ;# stores the FEN string.
set castling KQkq      ;# will be empty or some combination of KQkq letters.
set toMove White       ;# side to move, "White" or "Black".
set pastePiece K       ;# Piece being pasted, "K", "k", "Q", "q", etc.

# Traces to keep entry values sensible:

trace variable moveNum w {forceInt 999 0}
trace variable epFile w {forceRegexp {^(-|[a-h])?$}}
trace variable castling w { forceRegexp {^(-|[KQkq]*)$}}


# List of color schemes: each sublist contains a reference name (not used),
# then lite, dark, highcolor, bestcolor, white, black, w border, b border.
#
set colorSchemes {
  { "Brown" "#d0c0a0" "#a08050" "#b0d0e0" "#bebebe" }
  { "Green-Yellow" "#e0d070" "#70a070" "#b0d0e0" "#bebebe" }
  { "Blue-ish" "#d0e0d0" "#80a0a0" "#b0d0e0" "#f0f0a0" }
  { "M. Thomas" "#e0d8b8" "#047c24" "#1c80e0" "#fe0000" }
  { "KM. Skontorp" "#ffdb86" "#ffa200" "#b0d0e0" "#bebebe" }
}
array set newColors {}

# chooseBoardColors:
#   Dialog for selecting board colors.
#
proc chooseBoardColors {{choice -1}} {
  global lite dark highcolor bestcolor
  global colorSchemes newColors

  set colors {lite dark highcolor bestcolor}

  set w .boardColorDialog

  if {[winfo exists $w]} {
    # Just update the dialog box colors and return:
    if {$choice >= 0} {
      set list [lindex $colorSchemes $choice]
      set newColors(lite) [lindex $list 1]
      set newColors(dark) [lindex $list 2]
      set newColors(highcolor) [lindex $list 3]
      set newColors(bestcolor) [lindex $list 4]
    }
    set nlite $newColors(lite)
    set ndark $newColors(dark)

    foreach i {wr bn wb bq wk bp} {
      $w.bd.$i configure -background $ndark
    }
    foreach i {br wn bb wq bk wp} {
      $w.bd.$i configure -background $nlite
    }
    foreach i $colors {
      $w.select.b$i configure -background $newColors($i)
    }
    return
  }

  toplevel $w
  wm title $w "Scid: [tr OptionsColors]"

  foreach i $colors { set newColors($i) [set $i] }
  set bd $w.bd
  pack [frame $bd] -side top -padx 2 -pady 2
  addHorizontalRule $w
  pack [frame $w.select] -side top -fill x
  addHorizontalRule $w
  pack [frame $w.preset] -side top -fill x
  addHorizontalRule $w
  pack [frame $w.buttons] -side top -fill x

  set column 0
  foreach j {r n b q k p} {
    label $bd.w$j -image w${j}40
    label $bd.b$j -image b${j}40
    grid $bd.b$j -row 0 -column $column
    grid $bd.w$j -row 1 -column $column
    incr column
  }

  set f $w.select
  foreach row {0 1 0 1} column {0 0 2 2} c {
    lite dark highcolor bestcolor
  } n {
    LightSquares DarkSquares SelectedSquares SuggestedSquares
  } {
    button $f.b$c -image e20 -background [set $c] -command "
      set x \[ tk_chooseColor -initialcolor \$newColors($c) -title Scid \]
      if {\$x != \"\"} { set newColors($c) \$x; chooseBoardColors }
    "
    label $f.l$c -text "$::tr($n)  "
    grid $f.b$c -row $row -column $column
    grid $f.l$c -row $row -column [expr $column + 1] -sticky w
  }

  set count 0
  set psize 40
  foreach list $colorSchemes {
    set f $w.preset.p$count
    pack [frame $f] -side left -padx 5
    label $f.blite -image bp40 -background [lindex $list 1]
    label $f.bdark -image bp40 -background [lindex $list 2]
    label $f.wlite -image wp40 -background [lindex $list 1]
    label $f.wdark -image wp40 -background [lindex $list 2]
    button $f.select -text [expr $count + 1] -pady 2 \
      -command "chooseBoardColors $count"
    foreach i {blite bdark wlite wdark} {
      bind $f.$i <1> "chooseBoardColors $count"
    }
    grid $f.blite -row 0 -column 0
    grid $f.bdark -row 0 -column 1
    grid $f.wlite -row 1 -column 1
    grid $f.wdark -row 1 -column 0
    grid $f.select -row 2 -column 0 -columnspan 2 -sticky we
    incr count
  }

  button $w.buttons.ok -text "OK" -command "
    foreach i {lite dark highcolor bestcolor} {
      set \$i \$newColors(\$i)
    }
    ::board::recolor .board
    recolorPieces
    grab release $w
    destroy $w
  "
  button $w.buttons.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  bind $w <Escape> "catch {grab release $w}; destroy $w"
  pack $w.buttons.cancel $w.buttons.ok -side right -padx 2 -pady 2
  chooseBoardColors
  wm resizable $w 0 0
  catch {grab $w}
}

# recolorPieces:
#   Used to recolor the pieces after a color is changed by the user.
#
proc recolorPieces {} {

  # This now does nothing since pieces are transparent photo images
  # and only square colors can be altered.
  return

  # global whitecolor blackcolor whiteborder blackborder boardSizes
  # foreach i $boardSizes {
  #   foreach p { k q r b n p } {
  #     if {[w$p$i cget -maskdata] != ""} {
  #       w${p}$i configure -foreground $whiteborder -background $whitecolor
  #     } else {
  #       w${p}$i configure -foreground $whitecolor
  #     }
  #     if {[b$p$i cget -maskdata] != ""} {
  #       b${p}$i configure -foreground $blackborder -background $blackcolor
  #     } else {
  #       b${p}$i configure -foreground $blackcolor
  #     }
  #   }
  # }
}

# setupBoard:
#   The main procedure for creating the dialog for setting the start board.
#   Calls switchPastePiece and makeSetupFen.
#   On "Setup" button press, calls sc_pos startBoard to try to set the
#   starting board.
#
proc setupBoard {} {
  global boardSize lite dark images setupBd pastePiece toMove epFile moveNum
  global setupStatus castling setupFen highcolor
  if {[winfo exists .setup]} { return }
  set setupBd [sc_pos board]
  toplevel .setup
  wm title .setup "Scid: Set Start Board"

  ### Status entrybox contains the current FEN string.

  frame .setup.statusbar
  pack .setup.statusbar -side bottom -expand yes -fill x

  ### The actual board is created here. Bindings: left mouse sets/clears
  ### a square, middle mouse selects previous piece, right mouse selects
  ### next piece.  I should also set shortcut keys, e.g. "Q" for Queen.

  frame .setup.bd -cursor crosshair
  set sbd .setup.bd
  for {set i 0} {$i < 64} {incr i} {
    label $sbd.$i -image e$boardSize
    set rank [expr 7 - int ($i / 8)]
    set fyle [expr $i % 8 ]
    grid $sbd.$i -row $rank -column $fyle -sticky nesw
    if [expr ($fyle % 2) == ($rank % 2)] {
      $sbd.$i configure -background $lite
    } else {
      $sbd.$i configure -background $dark
    }
    bind $sbd.$i <ButtonPress-1> "setupBoardPiece $i"
    bind $sbd.$i <ButtonPress-2> "switchPastePiece prev"
    bind $sbd.$i <ButtonPress-3> "switchPastePiece next"
  }
  pack $sbd -side left -ipadx 10 -ipady 10
  setBoard $sbd $setupBd $boardSize

  ### Piece Buttons

  frame .setup.r
  set sr .setup.r
  frame $sr.sw; frame $sr.sb
  #set pastePiece P
  #set toMove White
  foreach i {k q r b n p} {
    set i2 [string toupper $i]
    radiobutton $sr.sw.$i -image w${i}$boardSize -indicatoron 0 \
      -variable pastePiece -value $i2 -activebackground $highcolor
    pack $sr.sw.$i -side left
    radiobutton $sr.sb.$i -image b${i}$boardSize -indicatoron 0 \
      -variable pastePiece -value $i -activebackground $highcolor
    pack $sr.sb.$i -side left
  }

  ### Quick Board Setup buttons: Clear Board and Initial Board.

  frame $sr.b
  button $sr.b.clear -textvar ::tr(EmptyBoard) -command {
    set setupBd \
      "................................................................"
    setBoard .setup.bd $setupBd $boardSize
    set castling {}
    set setupFen [makeSetupFen]
  }
  button $sr.b.initial -textvar ::tr(InitialBoard) -command {
    set setupBd \
      "RNBQKBNRPPPPPPPP................................pppppppprnbqkbnr"
    setBoard .setup.bd $setupBd $boardSize
    set castling KQkq
    set setupFen [makeSetupFen]
  }

  ### Side to move frame.

  frame $sr.tomove
  label $sr.tomove.label -textvar ::tr(SideToMove:)
  radiobutton $sr.tomove.w -text $::tr(White) -variable toMove -value White \
    -command {set setupFen [makeSetupFen]}
  radiobutton $sr.tomove.b -text $::tr(Black) -variable toMove -value Black \
    -command {set setupFen [makeSetupFen]}
  pack $sr.tomove.label $sr.tomove.w $sr.tomove.b -side left

  ### Entry boxes: Move number, Castling and En Passent file.

  frame $sr.movenum
  label $sr.movenum.label -textvar ::tr(MoveNumber:)
  entry $sr.movenum.e -width 3 -background white -textvariable moveNum
  pack $sr.movenum.label $sr.movenum.e -side left

  frame $sr.castle
  label $sr.castle.label -textvar ::tr(Castling:)
  entry $sr.castle.e -width 5 -background white -textvariable castling
  pack $sr.castle.label $sr.castle.e -side left

  frame $sr.ep
  label $sr.ep.label -textvar ::tr(EnPassentFile:)
  entry $sr.ep.e -width 2 -background white -textvariable epFile
  set epFile {}
  pack $sr.ep.label $sr.ep.e -side left

  ### Set bindings so the active entrybox is colored and the Fen string
  ###   is updated at any change:

  foreach i "$sr.ep.e $sr.castle.e $sr.movenum.e" {
    bind $i <FocusIn> {%W configure -background lightYellow }
    bind $i <FocusOut> {
      %W configure -background white;
      set setupFen [makeSetupFen]}
  }

  ### Buttons: Setup and Cancel.

  frame $sr.b2
  button $sr.b2.setup -text "OK" -command {
    if {[catch {sc_game startBoard $setupFen} err]} {
      tk_messageBox -icon info -type ok -title "Scid" -message $err
    } else {
      destroy .setup
      updateBoardAndPgn
    }
  }
  button $sr.b2.cancel -textvar ::tr(Cancel) -command {
    destroy .setup
  }
  pack $sr.b2.setup $sr.b2.cancel -side left -ipadx 10 -padx 5

  pack $sr -side right
  pack $sr.sw $sr.sb $sr.b $sr.tomove $sr.movenum $sr.castle $sr.ep \
    $sr.b2 -side top -pady 10
  pack $sr.b.clear $sr.b.initial -side left

  button .setup.paste -textvar ::tr(PasteFen) -command {
    if {[catch {set setupFen [selection get -selection CLIPBOARD]} ]} {
      catch {set setupFen [selection get -selection PRIMARY]}
    }
  }
  button .setup.clear -textvar ::tr(ClearFen) -command {set setupFen ""}
  entry .setup.status -relief sunken -textvariable setupFen \
    -font font_Small -background white
  pack .setup.paste .setup.clear -in .setup.statusbar -side left
  pack .setup.status -in .setup.statusbar -side right -expand yes -fill x -anchor w
  bind .setup.status <FocusIn>  { %W configure -background lightYellow }
  bind .setup.status <FocusOut> { %W configure -background white }

  set setupFen [makeSetupFen]
}


############################################################
### Toolbar and game movement buttons:

image create photo tb_open -data {
R0lGODdhEQARAMIAANnZ2QAAAKmpqf///76+vgAAAAAAAAAAACwAAAAAEQARAAADSQi63B0w
RuFAGDjfQF/WGOd9g9RZEPlFSkC4RCwTpYVKuMtxqgoJu8FsSAAaL8ThjoJMxoCipvMlsgwE
2KzW2Mp5T9twtkJWJAAAOw==
}

image create photo tb_new -data {
R0lGODdhEQARAKEAANnZ2ampqf///wAAACwAAAAAEQARAAACQoRvkaLowECI8Rk2RFaj+y+E
WhBkopiZp7qG5kCyqKcJhnzWpI23ytRDNSRB1xBQHCGSsGUu1zwwj5+q53ggabfHAgA7
}

image create photo tb_save -data {
R0lGODdhEQARAKEAANnZ2QAAAJmZAP///ywAAAAAEQARAAACPISPecHtvkQYtNIAsAnS2hZN
3iWFI6ll3cml7Tm0kfQwQrnd+q67d93AqWgQlY8IMs5quVQG+FBIp1RFAQA7
}

image create photo tb_close -data {
R0lGODdhEQARAIAAANnZ2YsAACwAAAAAEQARAAACJISPqcsXoeB6iTILnpxSN6NhTfiBXhlu
lyVWWIu08KiW9o0bBQA7
}

image create photo tb_finder -data {
R0lGODdhEQARAMIAANnZ2QAAAKmpqf///76+vrDE3gAAAAAAACwAAAAAEQARAAADUgi63B0w
RuFAGDjfQF/WGOd9g9RZEPlFSkC4RCwTpcBJ0jvZghoWwMLNNpi9Cpggh2gMIINCAeUyc0Kj
06LM+sS2BlIpF9vB3SYQRni9ZlUqkAQAOw==
}

image create photo tb_bkm -data {
R0lGODdhEQARAMIAANnZ2YsAAAAAAP///6mpqbDE3gAAAAAAACwAAAAAEQARAAADTgi60ftQ
iBakFXEMqrsgy0VdwxcWKIUWQgkqwqqirQkXVM66Z67WL0AMp9vZhLLGCniSrYzB4XPJu02p
R+SV9QnCLheCVyEum8WQtBqQAAA7
}

image create photo tb_cut -data {
R0lGODdhEQARAKEAANnZ2QAAAKmpqb+/vywAAAAAEQARAAACNYSPqZEhehyS0DD7Kt7aAtp9
AhiSXYBm2piZU2qhkMNiwzUNdyvsjU5x+Bq0iAsgUBmSoVABADs=
}

image create photo tb_copy -data {
R0lGODdhEQARAKEAANnZ2QAAAP///6mpqSwAAAAAEQARAAACPYSPecHtCoKYdIahpNsvVllR
gaE1AndioBWK6mmilye21sucsJPSrD2TrW6GgXEw/GASHMdScYwaIdSqtQAAOw==
}

image create photo tb_paste -data {
R0lGODdhEQARAMIAANnZ2VFR+wAAAKmpqf///76+vgAAAAAAACwAAAAAEQARAAADUggKIb4w
MickpCE3N6IgBUUNg9AtXzGoLGlexFqKtJKuH6HvRAV8sg9N2LmFeLwXUCWk9YogHHKnjDF7
ziqpNNW9fiIs8gvY5qZk1HBkKW/fnQQAOw==
}

image create photo tb_gprev -data {
R0lGODlhEQARAMIAANnZ2RwyggAAAP///6mpqampqampqampqSwAAAAAEQARAAADQgi63P4w
wrCEvViFrcT44CcAWwl4mDUIRMl5Ichq1ZquBN3Fck7WKZSPsuPhdCdbbPYr8pjEU/DicxCu
WKxkywUkAAA7
}

image create photo tb_gnext -data {
R0lGODlhEQARAMIAANnZ2RwyggAAAP///6mpqampqampqampqSwAAAAAEQARAAADQQi63P4w
wrCEvXhRJYb/nqBVA2aVhLIBHfgJKbB2Jh3P7nuTNRr8P1YuRAAGaS2dLCgcwlSV2iXmIFiv
V4l2C0gAADs=
}

image create photo tb_rfilter -data {
R0lGODdhEQARAMIAANnZ2YsAAAAAALDE3v///76+vgAAAAAAACwAAAAAEQARAAADPggQob7v
sTijqwvbypqVnfdd3QhqY+gJrEBxgTDMg6uUt0wQtI3qtJpJFhSOiAOe8RgUFEyKlpMFjbSq
D1YCADs=
}

image create photo tb_bsearch -data {
R0lGODdhEQARAMIAANDAoKCAUAAAANnZ2bDE3v///76+vgAAACwAAAAAEQARAAADSQgarMBB
jDkctEzSu5rSE/d4ADiIookFq9qxrzvCpWBTJ5kRPAGiAkKh0NMAhT3fxMZkJnkm3CDIIyql
OCrUgJU2DbdulykeCxIAOw==
}

image create photo tb_hsearch -data {
R0lGODdhEQARAMIAANnZ2QAngQAAALDE3v///76+vgAAAAAAACwAAAAAEQARAAADPgi63L7h
SRAnrRcHDFWNH7R5JEeR5xl64CW8wjgJQz0IFk0QNi7pttssWPM9aDWecNgrWAAwQeH1ZMCq
i1cCADs=
}

image create photo tb_msearch -data {
R0lGODdhEQARAMIAANnZ2QAngQAAAP///7DE3rLA3L6+vgAAACwAAAAAEQARAAADSQi63A4h
PCfCGHKqem9+Atd9lOhpoUiCKpAKTWh1AmET8GYO9XXnOx5hQCjYgDPa7bdJXmo2Iq4ZqQag
R4PuxQ0ZQppSLrwIJQAAOw==
}

image create photo tb_switcher -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAAP/tuMvFxosAAAAAACwAAAAAFAAUAAADWQi63B0w
ykmrvZiKzbvn0DaMZPmFwkCsLDGkHqqWs9jJLVsWYCC6pdaAt8HlhEQBjjZaDXu/I6uQlDFH
BYOh6ttQv2CtAdoRm8/KLufMHqM+ZS0Zvh73MpYEADs=
}

image create photo tb_pgn -data {
R0lGODdhFAAUAKEAANnZ2QAngf///wAAACwAAAAAFAAUAAACSISPmcHtD6OcFIqLs8Zse90N
IiYOl3kKYYoK5uiqQRy3J2qutfbGel/a5WZBmtBHzLR6rqHRyBzpSMGl7IO9Zj2d7abrzVQo
BQA7
}

image create photo tb_glist -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAAIsAAAAAAAAAAAAAACwAAAAAFAAUAAADQgi63B0w
ykmrvZiKzbvnkDAMX7mFo6AJRNuqgSnDIjl3KCl17hvenxwQFEutegTaEFe0DYUTDlK5PAUc
2Mc1y81gEgA7
}

image create photo tb_tmt -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAAIsAALDE3gAAAAAAACwAAAAAFAAUAAADXgi63B0w
ykmrvZiKzbvnkDCMokCY6HkKoTd8Xji+J52ibACXu0yqpdlr09oNCsjC0GerFTbJV/FzFCSV
OdEPdbxip66k9aub3UTXAUAA0O02QsCo/YbN3HXXIDNZDBIAOw==
}

image create photo tb_maint -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAAMvm/wAAAAAAAAAAACwAAAAAFAAUAAADUAi63B0w
ykmrvZiKzbvn0Cd6oTCc3Tl85aCs5gKDwea+t9y1TjPzPd0G6Lj9ajHcK3a0LQcEwsrVNKFM
UdhVUPJApbaqN8sRp8gs5BiczlgSADs=
}

image create photo tb_eco -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAADZki4sAAAAAAAAAACwAAAAAFAAUAAADVgi63B0w
ykmrvZiKzbvn0DaM4lB6oWCK3Lpu6Wi+bhe3uGoHpeujvI9QQCAIQqaiUKlEEo0fphFZKBau
2CpBe+QloR5pVyfmiJ3i9NQra7tl46E8g0kAADs=
}

image create photo tb_tree -data {
R0lGODdhFAAUAKEAANnZ2QAngf///6CAUCwAAAAAFAAUAAACRISPmcHtD6OcFIqLs8Zsi4GB
WheK5kZm4BpywSXC7EC7pXlm6U3HtlwKXnafnnH08tQ8RCEquVk+lT0mlCf9ebaCCqUAADs=
}

image create photo tb_engine -data {
R0lGODdhFAAUAMIAANnZ2QAngf///7i4uAAAAAAAAAAAAAAAACwAAAAAFAAUAAADUwi63B0w
ykmrvZiKzcXooAB1Q/mdnveNnLmZpSoGHGGHISvcOKjbwKCQ8BsaibSdDTYIwljHIzQ6hMKW
JuxA1yRcvVlkDVhydsXjDm9j0/VwGUwCADs=
}

image create photo tb_crosst -data {
R0lGODdhFAAUAMIAANnZ2QAngf///wAAAIsAAAAAAAAAAAAAACwAAAAAFAAUAAADSQi63B0w
ykmrvZiKzbvnkDCMo1h+QoiuW1iS5qqyaDilApHvehrILJtk99MZW79g7Xc7Fnc+WssjjPCI
0Jk0GW1edUmtFJS5JAAAOw==
}

image create photo tb_help -data {
R0lGODdhEQARAIQAANnZ2QAAAKa/ovD07+vx6uHp4MvayfP289Lf0MPUwazDqLzPuCsrK+bt
5CEuH2WLXoythpa0kbjMtY2tiAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ACwAAAAAEQARAAAFSSAgjkFZjigaCANRGEGqGsdQ3EgsB8mgmIuCgiEDBBoO0k2XgqmEzKIo
cHtEi9QC5Lq7baWkiJbbjZB3JrB6bTx3JW6VZBJXnUMAOw==
}

image create photo b_bargraph -data {
R0lGODdhGAAYAMIAANnZ2QAngf///wAAAIsAAAAAAAAAAAAAACwAAAAAGAAYAAADYwi63P4w
ygmDvThnpnvnXmhxQmmeqBmQaXuuS+DOAqzIwkCjNoDrlhfuxQIOa8dS70ewEJ7NAJSgLCKF
12qsZLwGg9ob1yv7DpdjM1llVavDPu5gTq/T4ckdXp9aikIUgYITCQA7
}

image create photo b_list -data {
R0lGODdhGAAYAKEAANnZ2QAngf///wAAACwAAAAAGAAYAAACT4SPqcvtz4KctFZkc8a6SyyE
4kiKATgM5RqeRyCkgjfNIIu7BizjpA7gqWgS28vHAgqRI2VsSDTumCVnj2qF0qRB6g8DUSjD
CSVxQ06rEQUAOw==
}

frame .tb -relief raised -border 1
button .tb.new -image tb_new -command fileNew
button .tb.open -image tb_open -command fileOpen
button .tb.save -image tb_save -command {
  if {[sc_game number] != 0} {
    busyCursor .
    gameReplace
    catch {.save.buttons.save invoke}
    unbusyCursor .
  } else {
    gameAdd
  }
}
button .tb.close -image tb_close -command fileClose
button .tb.finder -image tb_finder -command fileFinder
menubutton .tb.bkm -image tb_bkm -menu .tb.bkm.menu
menu .tb.bkm.menu
bind . <Control-b> ::bookmarks::postMenu
bind .tb.bkm <ButtonPress-1> "+.tb.bkm configure -relief flat"


frame .tb.space1 -width 12
button .tb.cut -image tb_cut -command gameClear
button .tb.copy -image tb_copy \
  -command {catch {sc_clipbase copy}; updateBoard}
button .tb.paste -image tb_paste \
  -command {catch {sc_clipbase paste}; updateBoardAndPgn}
frame .tb.space2 -width 12
button .tb.gprev -image tb_gprev -command {gameLoadNextPrev previous}
button .tb.gnext -image tb_gnext -command {gameLoadNextPrev next}
frame .tb.space3 -width 12
button .tb.rfilter -image tb_rfilter -command searchReset
button .tb.bsearch -image tb_bsearch -command searchBoard
button .tb.hsearch -image tb_hsearch -command searchHeader
button .tb.msearch -image tb_msearch -command searchMaterial
frame .tb.space4 -width 12
button .tb.switcher -image tb_switcher -command makeBaseWin
button .tb.glist -image tb_glist -command makeGList
button .tb.pgn -image tb_pgn -command makePgnWin
button .tb.tmt -image tb_tmt -command ::tourney::toggle
button .tb.maint -image tb_maint -command makeMaintWin
button .tb.eco -image tb_eco -command openCloseEcoBrowser
button .tb.tree -image tb_tree -command ::tree::make
button .tb.crosst -image tb_crosst -command toggleCrosstabWin
button .tb.engine -image tb_engine -command makeAnalysisWin
button .tb.help -image tb_help -command {helpWindow Index}

foreach i {new open save close finder bkm cut copy paste gprev gnext \
             rfilter bsearch hsearch msearch \
             switcher glist pgn tmt maint eco tree crosst engine help} {
  .tb.$i configure -relief flat -border 1 -highlightthickness 0 -anchor n \
    -takefocus 0
  bind .tb.$i <Any-Enter> "+.tb.$i configure -relief raised"
  bind .tb.$i <Any-Leave> "+.tb.$i configure -relief flat"
}

#pack .tb -side top -fill x -before .button

proc configToolbar {} {
  set w .tbconfig
  toplevel $w
  wm title $w "Scid: [tr OptionsToolbar]"

  array set ::toolbar_temp [array get ::toolbar]
  pack [frame $w.f1] -side top -fill x
  foreach i {new open save close finder bkm} {
    checkbutton $w.f1.$i -indicatoron 1 -image tb_$i -height 20 -width 22 \
      -variable toolbar_temp($i) -relief solid -borderwidth 1 
    pack $w.f1.$i -side left -ipadx 2 -ipady 2
  }
  pack [frame $w.f2] -side top -fill x
  foreach i {gprev gnext} {
    checkbutton $w.f2.$i -indicatoron 1 -image tb_$i -height 20 -width 22 \
      -variable toolbar_temp($i) -relief solid -borderwidth 1
    pack $w.f2.$i -side left -ipadx 1 -ipady 1
  }
  pack [frame $w.f3] -side top -fill x
  foreach i {cut copy paste} {
    checkbutton $w.f3.$i -indicatoron 1 -image tb_$i -height 20 -width 22 \
      -variable toolbar_temp($i) -relief solid -borderwidth 1
    pack $w.f3.$i -side left -ipadx 1 -ipady 1
  }
  pack [frame $w.f4] -side top -fill x
  foreach i {rfilter bsearch hsearch msearch} {
    checkbutton $w.f4.$i -indicatoron 1 -image tb_$i -height 20 -width 22 \
      -variable toolbar_temp($i) -relief solid -borderwidth 1
    pack $w.f4.$i -side left -ipadx 1 -ipady 1
  }
  pack [frame $w.f5] -side top -fill x
  foreach i {switcher glist pgn tmt maint eco tree crosst engine} {
    checkbutton $w.f5.$i -indicatoron 1 -image tb_$i -height 20 -width 22 \
      -variable toolbar_temp($i) -relief solid -borderwidth 1
    pack $w.f5.$i -side left -ipadx 1 -ipady 1
  }

  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.on -text "+ [capital $::tr(all)]" -command {
    foreach i [array names toolbar_temp] { set toolbar_temp($i) 1 }
  }
  button $w.off -text "- [capital $::tr(all)]" -command {
    foreach i [array names toolbar_temp] { set toolbar_temp($i) 0 }
  }
  button $w.ok -text "OK" -command {
    array set toolbar [array get toolbar_temp]
    catch {grab release .tbconfig}
    destroy .tbconfig
    redrawToolbar
  }
  button $w.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.cancel $w.ok -side right -padx 2
  pack $w.on $w.off -side left -padx 2
  catch {grab $w}
}

proc redrawToolbar {} {
  global toolbar
  foreach i [winfo children .tb] { pack forget $i }
  set seenAny 0
  set seen 0
  foreach i {new open save close finder bkm} {
    if {$toolbar($i)} {
      set seen 1; set seenAny 1
      pack .tb.$i -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0
    }
  }
  if {$seen} { pack .tb.space1 -side left }
  set seen 0
  foreach i {gprev gnext} {
    if {$toolbar($i)} {
      set seen 1; set seenAny 1
      pack .tb.$i -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0
    }
  }
  if {$seen} { pack .tb.space2 -side left }
  set seen 0
  foreach i {cut copy paste} {
    if {$toolbar($i)} {
      set seen 1; set seenAny 1
      pack .tb.$i -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0
    }
  }
  if {$seen} { pack .tb.space3 -side left }
  set seen 0
  foreach i {rfilter bsearch hsearch msearch} {
    if {$toolbar($i)} {
      set seen 1; set seenAny 1
      pack .tb.$i -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0
    }
  }
  if {$seen} { pack .tb.space4 -side left }
  set seen 0
  foreach i {switcher glist pgn tmt maint eco tree crosst engine} {
    if {$toolbar($i)} {
      set seen 1; set seenAny 1
      pack .tb.$i -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0
    }
  }
  if {$seenAny} {
    pack .tb -side top -fill x -before .button
  } else {
    pack forget .tb
  }
}

proc setToolbar {x} {
  if {$x} {
    pack .tb -side top -fill x -before .button
  } else {
    pack forget .tb
  }
}

# Set toolbar help status messages:
foreach {b m} {
  new FileNew open FileOpen finder FileFinder
  save GameReplace close FileClose bkm FileBookmarks
  gprev GamePrev gnext GameNext
  cut GameNew copy EditCopy paste EditPaste
  rfilter SearchReset bsearch SearchCurrent
  hsearch SearchHeader msearch SearchMaterial
  switcher WindowsSwitcher glist WindowsGList pgn WindowsPGN tmt WindowsTmt
  maint WindowsMaint eco WindowsECO tree WindowsTree crosst ToolsCross
  engine ToolsAnalysis
} {
  set helpMessage(.tb.$b) $m
}
set helpMessage(.button.addVar) EditAdd
set helpMessage(.button.trial) EditTrial


image create photo tb_start -data {
R0lGODdhFAAUAPAAANnZ2VFR+ywAAAAAFAAUAAACPoSPqQGsf5iDT1JoU5hm96Z5kZh123Q6
ZaqmX+uyKijXs2Szrxnr9HjikUBAVPCHOPJ2oSbyoiFCk9KpFVIAADs=
}

image create photo tb_prev -data {
R0lGODdhFAAUAPAAANnZ2VFR+ywAAAAAFAAUAAACI4SPqcvtD6MJVAKKI95v++aFS0iO5Mec
maNqooRaq0XXNl0AADs=
}


image create photo tb_next -data {
R0lGODdhFAAUAIAAANnZ2VFR+ywAAAAAFAAUAAACI4SPqcvtD1WYEc1bwd1x++eFTUgupCid
FKOCqItVcUbX9q0UADs=
}

image create photo tb_end -data {
R0lGODdhFAAUAIAAANnZ2VFR+ywAAAAAFAAUAAACPoSPqcsBztqLEgZ4rnJWZ59Nz4WR2NSR
hlmKLMeu7kujK/3ao7mretxrpUo+WQpRNN4SoNCJ4oRuRNJodVEAADs=
}

image create photo tb_invar -data {
R0lGODdhFAAUAKEAANnZ2QAngVFR+wAAACwAAAAAFAAUAAACO4SPqcvtf0JQ0ghBZ6rgYsSB
mvdFmhGSJRCyp1q2KWyiZ0fb+pHvrZpp4S4LidDDMN5wDiHE9YxKp4sCADs=
}

image create photo tb_outvar -data {
R0lGODdhFAAUAKEAANnZ2QAngVFR+wAAACwAAAAAFAAUAAACO4SPqcvtf0JQcgkBatLoYh5N
nWeAIOBdpbiOaRseKQmDs1qzxh1n+v4KnWS01ZCIEf4SuB4EcXxKp9QCADs=
}

image create photo tb_addvar -data {
R0lGODdhFAAUAKEAANnZ2QAngc4PNAAAACwAAAAAFAAUAAACNoSPqcvtf0JQ0tV0jxBxYq9x
HZKFJAhk27qmqMq2rlGaJ43a46xslJR7AIMWIORzRCaXzKahAAA7
}

frame .button -relief raised -border 1
button .button.start -image tb_start -command "sc_move start; updateBoard"
button .button.back -image tb_prev -command "sc_move back; updateBoard"
button .button.forward -image tb_next -command "sc_move forward; updateBoard"
button .button.end -image tb_end -command "sc_move end; updateBoard"
frame .button.space -width 15

# The go-into-variation button is a menubutton:
menubutton .button.intoVar -image tb_invar -menu .button.intoVar.menu \
  -relief raised
menu .button.intoVar.menu -tearoff 0 -font font_Regular

button .button.exitVar -image tb_outvar \
  -command {sc_var exit; updateBoard}
button .button.addVar -image tb_addvar \
  -command {sc_var create; updateBoardAndPgn}
frame .button.space2 -width 15

image create photo tb_flip -data {
R0lGODdhFAAUAKEAAAAAANDAoKCAUIsAACwAAAAAFAAUAAACXoSPqcHiHJyA0tDXcHS2jT9s
UyYYEgheY2AKXxaSUPuK6gww3/S66MDJBVK9H7AkHKIiywpAotxFa6ynD8ULpaoOY5YZ69hk
yuBNh9khz1M1EirD4uDjemtFpyv2/AIAOw==
}

image create photo tb_coords -data {
R0lGODdhFAAUAKEAANnZ2QAAANDAoKCAUCwAAAAAFAAUAAACR4QRFsItA+FJyrUoUdjIMjwc
4uKB4gRC1oSmq9aCLxJjM4Wkw11H70YJ6GYjoPF4SiqXTEVTwWE9nZPoEjh6BrPaBA47VRYA
ADs=
}

image create photo tb_trial -data {
R0lGODdhFAAUAKEAANnZ2YsAAAAAAKCAUCwAAAAAFAAUAAACPISPqRAdC52DqhlL48t1AwEK
GWaEIkWWJ+p9IZeYMnik5oDnQ93OMmWCxVZCF61oJFJwCuZSB81Ao0hIAQA7
}

image create photo tb_trial_on -data {
R0lGODdhFAAUAKEAAP//4IsAAAAAAKCAUCwAAAAAFAAUAAACPISPqRAdC52DqhlL48t1AwEK
GWaEIkWWJ+p9IZeYMnik5oDnQ93OMmWCxVZCF61oJFJwCuZSB81Ao0hIAQA7
}

##############################

namespace eval ::board {}

# ::board::new
#   Creates a new board in the specified frame.
#   The psize option should be a piece bitmap size supported
#   in Scid (see the boardSizes variable in start.tcl).
#
proc ::board::new {w {psize 40}} {
  if {[winfo exists $w]} { return }

  set ::board::_size($w) $psize
  set ::board::_coords($w) 1
  set ::board::_flip($w) 0
  set ::board::_data($w) [sc_pos board]
  set ::board::_marks($w) 0
  set ::board::_drag($w) -1
  set bsize [expr {8 * ($psize+2) - 1}]
  frame $w
  canvas $w.bd -width $bsize -height $bsize -cursor crosshair
  grid $w.bd -row 1 -column 1 -rowspan 8 -columnspan 8
  set bd $w.bd

  # Create empty board:
  for {set i 0} {$i < 64} {incr i} {
    set xi [expr $i % 8]
    set yi [expr int($i/8)]
    set x1 [expr $xi * ($psize+2)]
    set y1 [expr (7 - $yi) * ($psize+2)]
    set x2 [expr $x1 + $psize+1]
    set y2 [expr $y1 + $psize+1]
    $bd create rectangle $x1 $y1 $x2 $y2 -tag sq$i
    ::board::colorSquare $w $i
  }

  # Set up coordinate labels:
  for {set i 1} {$i <= 8} {incr i} {
    label $w.lrank$i -text [expr 9 - $i]
    grid $w.lrank$i -row $i -column 0 -sticky e
    label $w.rrank$i -text [expr 9 - $i]
    grid $w.rrank$i -row $i -column 9 -sticky w
  }
  foreach i {1 2 3 4 5 6 7 8} file {a b c d e f g h} {
    label $w.tfile$file -text $file
    grid $w.tfile$file -row 0 -column $i -sticky s
    label $w.bfile$file -text $file
    grid $w.bfile$file -row 9 -column $i -sticky n
  }
  ::board::coords $w
  ::board::update $w
}

# ::board::defaultColor
#   Returns the color (the value of the global
#   variable "lite" or "dark") depending on whether the
#   specified square number (0=a1, 1=b1, ..., 63=h8) is
#   a light or dark square.
#
proc ::board::defaultColor {sq} {
  set x [expr $sq % 8]
  set y [expr int($sq/8)]
  if {($x%2) == ($y%2)} { return $::dark }
  return $::lite
}

# ::board::size
#   Returns the current board size.
#
proc ::board::size {w} {
  return $::board::_size($w)
}

# ::board::resize
#   Resizes the board. Takes a numeric piece size (which should
#   be in the global boardSizes list variable), or "-1" or "+1".
#   Returns the new size of the board.
#
proc ::board::resize {w psize} {
  global boardSizes
  set oldsize $::board::_size($w)
  if {$psize == $oldsize} { return $oldsize }
  if {$psize == "-1"} {
    set index [lsearch -exact $boardSizes $oldsize]
    if {$index == 0} { return $oldsize }
    incr index -1
    set psize [lindex $boardSizes $index]
  } elseif {$psize == "+1"} {
    set index [lsearch -exact $boardSizes $oldsize]
    incr index
    if {$index == [llength $boardSizes]} { return $oldsize }
    set psize [lindex $boardSizes $index]
  }

  # Verify that we have a valid size:
  if {[lsearch -exact $boardSizes $psize] < 0} { return $oldsize }

  set bsize [expr ($psize+2) * 8 - 1]
  $w.bd configure -width $bsize -height $bsize
  set ::board::_size($w) $psize

  # Resize each square:
  for {set i 0} {$i < 64} {incr i} {
    set c [$w.bd coords sq$i]
    set x1 [expr int([lindex $c 0] * ($psize+2) / ($oldsize+2))]
    set y1 [expr int([lindex $c 1] * ($psize+2) / ($oldsize+2))]
    set x2 [expr $x1 + $psize +1]
    set y2 [expr $y1 + $psize +1]
    $w.bd coords sq$i $x1 $y1 $x2 $y2
  }
  ::board::update $w
  return $psize
}

# ::board::getSquare
#   Given a board frame and root-window X and Y screen coordinates,
#   returns the square number (0-63) containing that screen location,
#   or -1 if the location is outside the board.
#
proc ::board::getSquare {w x y} {
  if {[winfo containing $x $y] != "$w.bd"} {
    return -1
  }
  set x [expr $x - [winfo rootx $w.bd]]
  set y [expr $y - [winfo rooty $w.bd]]
  set psize $::board::_size($w)
  set x [expr int($x / ($psize+2))]
  set y [expr int($y / ($psize+2))]
  if {$x < 0  ||  $y < 0  ||  $x > 7  ||  $y > 7} {
    set sq -1
  } else {
    set sq [expr (7-$y)*8 + $x]
    if {$::board::_flip($w)} { set sq [expr 63 - $sq] }
  }
  return $sq
}

# ::board::showMarks
#   Turns on/off the showing of marks (colored squares).
#
proc ::board::showMarks {w value} {
  set ::board::_marks($w) $value
}

# ::board::recolor
#   Recolor every square on the board.
#
proc ::board::recolor {w} {
  for {set i 0} {$i < 64} {incr i} {
    ::board::colorSquare $w $i
  }
}

# ::board::colorSquare
#   Colors the specified square (0-63) of the board.
#   If the color is the empty string, the appropriate
#   color for the square (light or dark) is used.
#
proc ::board::colorSquare {w i {color ""}} {
  if {$color != ""} {
    $w.bd itemconfigure sq$i -outline $color -fill $color
    return
  }
  set color [::board::defaultColor $i]
  $w.bd itemconfigure sq$i -outline $color -fill $color
  if {$::board::_marks($w)  &&  [info exists ::markSquares($i)]} {
    set color $::markSquares($i)
    catch {$w.bd itemconfigure sq$i -outline $color -fill $color}
  }
}

# ::board::midSquare
#   Given a board and square number, returns the canvas X/Y
#   coordinates of the midpoint of that square.
#
proc ::board::midSquare {w sq} {
  set c [$w.bd coords sq$sq]
  set x [expr ([lindex $c 0] + [lindex $c 2]) / 2]
  set y [expr ([lindex $c 1] + [lindex $c 3]) / 2]
  return [list $x $y]
}

# ::board::piece {w sq}
#   Given a board and square number, returns the piece type
#   (e for empty, wp for White Pawn, etc) of the square.
proc ::board::piece {w sq} {
  set p [string index $::board::_data($w) $sq]
  return $::images($p)
}

# ::board::setDragSquare
#   Sets the square from whose piece should be dragged.
#   To drag nothing, the square value should be -1.
#   If the previous value is a valid square (0-63), the
#   piece being dragged is returned to its home square first.
#
proc ::board::setDragSquare {w sq} {
  set oldSq $::board::_drag($w)
  if {$oldSq >= 0  &&  $oldSq <= 63} {
    ::board::drawPiece $w $oldSq [string index $::board::_data($w) $oldSq]
    $w.bd raise arrows
  }
  set ::board::_drag($w) $sq
}

# ::board::dragPiece
#   Drags the piece of the drag-square (as set above) to
#   the specified global (root-window) screen cooordinates.
#
proc ::board::dragPiece {w x y} {
  set sq $::board::_drag($w)
  if {$sq < 0} { return }
  set x [expr $x - [winfo rootx $w.bd]]
  set y [expr $y - [winfo rooty $w.bd]]
  $w.bd coords p$sq $x $y
  $w.bd raise p$sq
}

# ::board::arrow
#   Draws an arrow on the board, from one square to another,
#   in the specified color.
#
proc ::board::arrow {w from to color} {
  if {$from < 0  ||  $from > 63} { return }
  if {$to < 0  ||  $to > 63} { return }
  set fromXY [::board::midSquare $w $from]
  set toXY [::board::midSquare $w $to]
  catch {$w.bd create line [lindex $fromXY 0] [lindex $fromXY 1] \
           [lindex $toXY 0] [lindex $toXY 1] -fill $color \
           -arrow last -width 2 -tag arrows}
  $w.bd raise arrows
}

# ::board::bind
#   Binds the given event on the given square number to
#   the specified action.
#
proc ::board::bind {w sq event action} {
  if {$sq == "all"} {
    for {set i 0} {$i < 64} {incr i} {
      $w.bd bind p$i $event $action
    }
  } else {
    $w.bd bind p$sq $event $action
  }
}

# ::board::drawPiece
#   Draws a piece on a specified square.
#
proc ::board::drawPiece {w sq piece} {
  global images
  set psize $::board::_size($w)
  set flip $::board::_flip($w)
  # Compute the XY coordinates for the centre of the square:
  set midpoint [::board::midSquare $w $sq]
  set xc [lindex $midpoint 0]
  set yc [lindex $midpoint 1]
  # Delete any old image for this square, and add the new one:
  $w.bd delete p$sq
  $w.bd create image $xc $yc -image $images($piece)$psize -tag p$sq
}

# ::board::update
#   Update the board given a 64-character board string as returned
#   by the "sc_pos board" command. If the board string is empty, it
#   defaults to the previous value for this board.
#
proc ::board::update {w {board ""}} {
  global images
  if {$board == ""} {
    set board $::board::_data($w)
  } else {
    set ::board::_data($w) $board
  }
  set psize $::board::_size($w)
  set flip $::board::_flip($w)

  # Remove all arrows from the board:
  $w.bd delete arrows

  for {set sq 0} { $sq < 64 } { incr sq } {
    set piece [string index $board $sq]
    # Compute the XY coordinates for the centre of the square:
    set midpoint [::board::midSquare $w $sq]
    set xc [lindex $midpoint 0]
    set yc [lindex $midpoint 1]
    # Delete any old image for this square, and add the new one:
    $w.bd delete p$sq
    $w.bd create image $xc $yc -image $images($piece)$psize -tag p$sq
  }
}

proc ::board::isFlipped {w} {
  return $::board::_flip($w)
}

proc ::board::flip {w} {
  if {! [info exists ::board::_flip($w)]} { return }
  set flip [expr 1 - $::board::_flip($w)]
  set ::board::_flip($w) $flip

  for {set i 0} {$i < 64} {incr i} {
    set swap [expr 63 - $i]
    set coords [$w.bd coords sq$swap]
    set x1($i) [lindex $coords 0]
    set y1($i) [lindex $coords 1]
    set x2($i) [lindex $coords 2]
    set y2($i) [lindex $coords 3]
  }
  for {set i 0} {$i < 64} {incr i} {
    $w.bd coords sq$i $x1($i) $y1($i) $x2($i) $y2($i)
  }

  # Change coordinate labels:
  for {set i 1} {$i <= 8} {incr i} {
    set value [expr 9 - [$w.lrank$i cget -text]]
    $w.lrank$i configure -text $value
    $w.rrank$i configure -text $value
  }
  if {$flip} {
    foreach file {a b c d e f g h} newvalue {h g f e d c b a} {
      $w.tfile$file configure -text $newvalue
      $w.bfile$file configure -text $newvalue
    }
  } else {
    foreach file {a b c d e f g h} {
      $w.tfile$file configure -text $file
      $w.bfile$file configure -text $file
    }
  }
  ::board::update $w
}

proc ::board::coords {w} {
  set coords [expr 1 - $::board::_coords($w)]
  set ::board::_coords($w) $coords
  if {$coords} {
    for {set i 1} {$i <= 8} {incr i} {
      grid configure $w.lrank$i
      grid configure $w.rrank$i
    }
    foreach i {a b c d e f g h} {
      grid configure $w.tfile$i
      grid configure $w.bfile$i
    }
  } else {
    for {set i 1} {$i <= 8} {incr i} {
      grid remove $w.lrank$i
      grid remove $w.rrank$i
    }
    foreach i {a b c d e f g h} {
      grid remove $w.tfile$i
      grid remove $w.bfile$i
    }
  }
}

proc toggleRotateBoard {} {
  ::board::flip .board
}

proc toggleCoords {} {
  global boardCoords
  set boardCoords [expr 1 - $boardCoords]
  ::board::coords .board
}

frame .button.space3 -width 15
button .button.flip -image tb_flip -takefocus 0 \
  -command "::board::flip .board"

button .button.coords -image tb_coords -takefocus 0 \
  -command toggleCoords
bind . <KeyPress-0> toggleCoords

image create photo autoplay_off -data {
R0lGODdhFAAUAKEAANnZ2QAAAFFR+wAAACwAAAAAFAAUAAACMYSPqbvBb4JLsto7D94StowI
IgOG4ugd55oC6+u98iPXSz0r+Enjcf7jtVyoofGoKAAAOw==
}

image create photo autoplay_on -data {
R0lGODdhFAAUAKEAAP//4AAAAPoTQAAAACwAAAAAFAAUAAACMYSPqbvBb4JLsto7D94StowI
IgOG4ugd55oC6+u98iPXSz0r+Enjcf7jtVyoofGoKAAAOw==
}

button .button.autoplay -image autoplay_off -command toggleAutoplay
button .button.trial -image tb_trial -command {setTrialMode toggle}

foreach i {start back forward end intoVar exitVar addVar autoplay \
             flip coords trial} {
  .button.$i configure -relief flat -border 1 -highlightthickness 0 \
    -anchor n -takefocus 0
  bind .button.$i <Any-Enter> "+.button.$i configure -relief raised"
  bind .button.$i <Any-Leave> "+.button.$i configure -relief flat"
}

pack .button.start .button.back .button.forward .button.end \
  .button.space .button.intoVar .button.exitVar .button.addVar .button.space2 \
  .button.autoplay .button.trial .button.space3 .button.flip .button.coords \
  -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0


############################################################
### The board:

::board::new .board $boardSize
#.board configure -relief solid -border 1
::board::showMarks .board 1
if {$boardCoords} {
  ::board::coords .board
}

# .gameInfo is the game information widget:
#
text .gameInfo -width 20 -height 6 -fg black -bg white \
  -wrap none -relief sunken -state disabled -cursor top_left_arrow \
  -xscroll ".ginfoXbar set" -yscroll ".ginfoYbar set" -setgrid 1
scrollbar .ginfoXbar -width 10 -orient horizontal -command ".gameInfo xview"
scrollbar .ginfoYbar -width 10 -orient vertical -command ".gameInfo yview"
::htext::init .gameInfo

# Right-mouse button menu for gameInfo frame:
menu .gameInfo.menu -tearoff 0

.gameInfo.menu add checkbutton -label GInfoHideNext \
  -variable gameInfo(hideNextMove) -offvalue 0 -onvalue 1 -command updateBoard

.gameInfo.menu add checkbutton -label GInfoMaterial \
  -variable gameInfo(showMaterial) -offvalue 0 -onvalue 1 -command updateBoard

.gameInfo.menu add checkbutton -label GInfoFEN \
  -variable gameInfo(showFEN) -offvalue 0 -onvalue 1 -command updateBoard

.gameInfo.menu add checkbutton -label GInfoMarks \
  -variable gameInfo(showMarks) -offvalue 0 -onvalue 1 -command updateBoard

.gameInfo.menu add checkbutton -label GInfoWrap \
  -variable gameInfo(wrap) -offvalue 0 -onvalue 1 -command updateBoard

.gameInfo.menu add checkbutton -label GInfoFullComment \
  -variable gameInfo(fullComment) -offvalue 0 -onvalue 1 -command updateBoard

#.gameInfo.menu add checkbutton -label Photos \
#  -variable gameInfo(photos) -offvalue 0 -onvalue 1 \
#  -command {updatePlayerPhotos -force}

.gameInfo.menu add separator

.gameInfo.menu add radiobutton -label GInfoTBNothing \
  -variable gameInfo(showTB) -value 0 -command updateBoard

.gameInfo.menu add radiobutton -label GInfoTBResult \
  -variable gameInfo(showTB) -value 1 -command updateBoard

.gameInfo.menu add radiobutton -label GInfoTBAll \
  -variable gameInfo(showTB) -value 2 -command updateBoard

.gameInfo.menu add separator

.gameInfo.menu add command -label GInfoDelete -command {
  catch {sc_game flag delete [sc_game number] invert}
  updateBoard
  updateGList
}

.gameInfo.menu add cascade -label GInfoMark -menu .gameInfo.menu.mark
menu .gameInfo.menu.mark
foreach flag $maintFlaglist {
  .gameInfo.menu.mark add command -label "" -command "
    catch {sc_game flag $flag \[sc_game number\] invert}
    updateBoard
    updateGList
  "
}

bind .gameInfo <ButtonPress-3> "tk_popup .gameInfo.menu %X %Y"
bind . <F9> "tk_popup .gameInfo.menu %X %Y"


# setBoard:
#   Resets the squares of the board according to the board string
#   "boardStr" and the piece bitmap size "psize".
#
proc setBoard {board boardStr psize {rotated 0}} {
  global images
  for {set i 0} { $i < 64 } { incr i } {
    if {$rotated > 0} {
      set piece [string index $boardStr [expr 63 - $i]]
    } else {
      set piece [ string index $boardStr $i ]
    }
    $board.$i configure -image $images($piece)$psize
  }
}

# updateVarMenus:
#   Updates the menus for moving into or deleting an existing variation.
#   Calls sc_var list and sc_var count to get the list of variations.
#
proc updateVarMenus {} {
  set varList [sc_var list]
  set numVars [sc_var count]
  .button.intoVar.menu delete 0 end
  .menu.edit.del delete 0 end
  .menu.edit.first delete 0 end
  .menu.edit.main delete 0 end
  for {set i 0} {$i < $numVars} {incr i} {
    set move [lindex $varList $i]
    set state normal
    if {$move == ""} {
      set move "($::tr(empty))"
      set state disabled
    }
    set str "[expr $i + 1]: $move"
    set commandStr "sc_var moveInto $i; updateBoard"
    if {$i < 9} {
      .button.intoVar.menu add command -label $str -command $commandStr \
        -underline 0
    } else {
      .button.intoVar.menu add command -label $str -command $commandStr
    }
    set commandStr "sc_var delete $i; updateBoardAndPgn"
    .menu.edit.del add command -label $str -command $commandStr
    set commandStr "sc_var first $i; updateBoardAndPgn"
    .menu.edit.first add command -label $str -command $commandStr
    set commandStr "sc_var promote $i; updateBoardAndPgn"
    .menu.edit.main add command -label $str -command $commandStr \
      -state $state
  }
}

bind . <KeyPress-v> {
  if {[sc_var count] == 1} {
    sc_var moveInto 0
    updateBoard
  } else {
    focus .
    update idletasks
    tkMbPost .button.intoVar
  }
}
bind . <KeyPress-z> {.button.exitVar invoke}

# updateBoardAndPgn:
#    Calls updateBoard() with the parameter pgnNeedsUpdate set to true
#    so the PGN representation is regenerated.
proc updateBoardAndPgn {{bd .board}} { updateBoard $bd 1 }

# updateBoard:
#    Updates the main board. Also updates the navigation buttons, disabling
#    those that have no effect at this point in the game.
#    Also ensure all menu settings are up to date.
#    If the optional parameter pgnNeedsUpdate is true, the PGN text
#    is also regenerated.
#
proc updateBoard { {bd .board} {pgnNeedsUpdate 0} } {
  global boardSize gameInfo
  ::board::resize .board $boardSize
  ::board::update .board [sc_pos board]
  set cmt [sc_pos getComment]
  set cmtOrig $cmt
  resetMarkSquares
  if {$gameInfo(showMarks)} {
    while {1} {
      set idx [string first "\[%mark " $cmt]
      if {$idx < 0} { break }
      set cmt [string range $cmt $idx end]
      set cmt [string trim [string range $cmt 7 end]]
      set sq [string range $cmt 0 1]
      set cmt [string trim [string range $cmt 2 end]]
      set end [string first "\]" $cmt]
      set color [string trim [string range $cmt 0 [expr $end - 1]]]
      if {$color == ""} { set color red }
      markSquare $sq $color
    }
    set cmt $cmtOrig
    while {1} {
      set idx [string first "\[%arrow " $cmt]
      if {$idx < 0} { break }
      set cmt [string range $cmt $idx end]
      set cmt [string trim [string range $cmt 7 end]]
      set fromSq [string range $cmt 0 1]
      set cmt [string trim [string range $cmt 2 end]]
      set toSq [string range $cmt 0 1]
      set cmt [string trim [string range $cmt 2 end]]
      set end [string first "\]" $cmt]
      set color [string trim [string range $cmt 0 [expr $end - 1]]]
      if {$color == ""} { set color red }
      arrowSquare $fromSq $toSq $color
    }
  }
  # Update the status of each navigation button:
  if {[sc_pos isAt start]} {
    .button.start configure -state disabled
  } else { .button.start configure -state normal }
  if {[sc_pos isAt end]} {
    .button.end configure -state disabled
  } else { .button.end configure -state normal }
  if {[sc_pos isAt vstart]} {
    .button.back configure -state disabled
  } else { .button.back configure -state normal }
  if {[sc_pos isAt vend]} {
    .button.forward configure -state disabled
  } else { .button.forward configure -state normal }
  # Cannot add a variation to an empty line:
  if {[sc_pos isAt vstart]  &&  [sc_pos isAt vend]} {
    .menu.edit entryconfig [tr EditAdd] -state disabled
    .button.addVar configure -state disabled
    bind . <Control-a> {}
  } else {
    .menu.edit entryconfig [tr EditAdd] -state normal
    .button.addVar configure -state normal
    bind . <Control-a> {sc_var create; updateBoardAndPgn}
  }
  if {[sc_var count] == 0} {
    .button.intoVar configure -state disabled
    .menu.edit entryconfig [tr EditDelete] -state disabled
    .menu.edit entryconfig [tr EditFirst] -state disabled
    .menu.edit entryconfig [tr EditMain] -state disabled
  } else {
    .button.intoVar configure -state normal
    .menu.edit entryconfig [tr EditDelete] -state normal
    .menu.edit entryconfig [tr EditFirst] -state normal
    .menu.edit entryconfig [tr EditMain] -state normal
  }
  updateVarMenus
  if {[sc_var level] == 0} {
    .button.exitVar configure -state disabled
  } else {
    .button.exitVar configure -state normal
  }

  if {![sc_base inUse]  ||  $::trialMode  ||  [sc_base isReadOnly]} {
    .tb.save configure -state disabled
  } else {
    .tb.save configure -state normal
  }
  .gameInfo configure -state normal
  .gameInfo delete 0.0 end
  ::htext::display .gameInfo [sc_game info -hide $gameInfo(hideNextMove) \
                                -material $gameInfo(showMaterial) \
                                -cfull $gameInfo(fullComment) \
                                -fen $gameInfo(showFEN) -tb $gameInfo(showTB)]
  if {$gameInfo(wrap)} {
    .gameInfo configure -wrap word
    .gameInfo tag configure wrap -lmargin2 10
    .gameInfo tag add wrap 1.0 end
  } else {
    .gameInfo configure -wrap none
  }
  .gameInfo configure -state disabled
  updatePlayerPhotos
  updateEpdWins
  if {[winfo exists .analysisWin1]} { updateAnalysis 1 }
  if {[winfo exists .analysisWin2]} { updateAnalysis 2 }
  if {[winfo exists .treeWin]} { ::tree::refresh }
  if {[winfo exists .commentWin]} { updateCommentWin }
  if {[::tb::isopen]} { ::tb::results }
  updateMenuStates
  moveEntry_Clear
  updateStatusBar
  if {[winfo exists .twinchecker]} { updateTwinChecker }
  if {[winfo exists .pgnWin]} { updatePgnWin $pgnNeedsUpdate }
  if {[winfo exists .noveltyWin]} { updateNoveltyWin }
}

image create photo photoW
image create photo photoB
label .photoW -background white -image photoW -anchor ne
label .photoB -background white -image photoB -anchor ne

array set photo {}
catch {source [file join $scidUserDir players.img]}
set photo(oldWhite) {}
set photo(oldBlack) {}

# updatePlayerPhotos
#   Updates the player photos in the game information area
#   for the two players of the current game.
#
proc updatePlayerPhotos {{force ""}} {
  global photo
  if {$force == "-force"} {
    # Force update even if it seems unnecessary. This is done
    # when the user selects to show or hide the photos.
    set photo(oldWhite) {}
    set photo(oldBlack) {}
    place forget .photoW
    place forget .photoB
  }
  if {! $::gameInfo(photos)} { return }
  set white [sc_game info white]
  set black [sc_game info black]
  if {$black != $photo(oldBlack)} {
    set photo(oldBlack) $black
    place forget .photoB
    if {[info exists ::photo($black)]} {
      image create photo photoB -data $::photo($black)
      .photoB configure -image photoB -anchor ne
      place .photoB -in .gameInfo -x -1 -relx 1.0 \
        -rely 0.12 -relheight 0.88 -anchor ne
    }
  }
  if {$white != $photo(oldWhite)} {
    set photo(oldWhite) $white
    place forget .photoW
    if {[info exists ::photo($white)]} {
      image create photo photoW -data $::photo($white)
      .photoW configure -image photoW -anchor ne
      place .photoW -in .gameInfo -x -82 -relx 1.0 \
        -rely 0.12 -relheight 0.88 -anchor ne
    }
  }
}

#########################################################
### Chess move input

# Globals for mouse-based move input:

set selectedSq -1
set currentSq -1
set bestSq -1

set EMPTY 0
set KING 1
set QUEEN 2
set ROOK 3
set BISHOP 4
set KNIGHT 5
set PAWN 6

# getPromoPiece:
#     Called whenever a pawn promotion move is made, to query the user
#     for the promotion piece. I'd prefer this to show the piece bitmaps
#     rather than english names, should change it sometime...
#
proc getPromoPiece {} {
  global EMPTY QUEEN ROOK BISHOP KNIGHT
  if {[catch {tk_dialog .dialog "Select Promotion Piece" \
                "Select the promotion piece:" \
                "" 0 "Queen" "Rook" "Bishop" "Knight"} answer]} {
    return 2
  }
  return [expr $answer + 2]
}

# confirmReplaceMove:
#   Asks the user what to do when adding a move when a move already
#   exists.
#   Returns a string value:
#      "replace" to replace the move, truncating the game.
#      "var" to add the move as a new variation.
#      "cancel" to do nothing.
#
proc confirmReplaceMove {} {
  global askToReplaceMoves trialMode
  if {! $askToReplaceMoves} { return "replace" }
  if {$trialMode} { return "replace" }

  option add *Dialog.msg.wrapLength 4i interactive
  catch {tk_dialog .dialog "Scid: $::tr(ReplaceMove)?" \
           $::tr(ReplaceMoveMessage) "" 0 \
           $::tr(ReplaceMove) $::tr(AddNewVar) [tr EditTrial] \
           $::tr(Cancel)} answer
  option add *Dialog.msg.wrapLength 3i interactive
  if {$answer == 0} { return "replace" }
  if {$answer == 1} { return "var" }
  if {$answer == 2} { setTrialMode 1; return "replace" }
  return "cancel"
}

# addMove:
#   Adds the move indicated by sq1 and sq2 if it is legal. If the move
#   is a promotion, getPromoPiece will be called to get the promotion
#   piece from the user.
#
proc addMove { sq1 sq2 } {
  global EMPTY
  if {[sc_pos isLegal $sq1 $sq2] == 0} { return }
  set promo $EMPTY
  if {[sc_pos isPromotion $sq1 $sq2] == 1} { set promo [getPromoPiece] }
  set action "replace"
  if {![sc_pos isAt vend]} {
    set action [confirmReplaceMove]
  }
  if {$action == "replace"} {
    sc_move add $sq1 $sq2 $promo
  } elseif {$action == "var"} {
    sc_var create
    sc_move add $sq1 $sq2 $promo
  } else {
    return
  }
  moveEntry_Clear
  updateBoardAndPgn
  ::tree::doTraining
}

# highlightSquare:
#   Changes a square's color so it is highlighted, provided there is
#   a legal move to or from that square. Also colors the suggested
#   square for the best matching move.
#
proc highlightSquare {square} {
  global highcolor bestcolor bestSq suggestMoves
  set bestSq -1
  if {$suggestMoves} {
    set bestSq [sc_pos bestSquare $square]
  }
  if {[expr $bestSq != -1]} {
    ::board::colorSquare .board $square $highcolor
    ::board::colorSquare .board $bestSq $bestcolor
  }
}

# resetMarkSquares:
#    Removes all marked square colors.
#
proc resetMarkSquares {} {
  global markSquares
  foreach i [array names markSquares] {
    unset markSquares($i)
  }
  ::board::recolor .board
}

array set markSquares {}

# markSquare:
#    Given a square in a1,h8, etc notation and a color, makes
#    the square that color.
#
proc markSquare {square color} {
  array set files {a 0 b 1 c 2 d 3 e 4 f 5 g 6 h 7}
  set file [string index $square 0]
  set rank [string index $square 1]
  if {! [info exists files($file)]} { return }
  if {$rank < 1  || $rank > 8} { return }
  set rank [expr $rank - 1]
  set sq [expr $files($file) + ($rank * 8)]
  set ::markSquares($sq) $color
  ::board::colorSquare .board $sq $color
}

# arrowSquare:
#    Draws an arrow between the two specified squares.
#
proc arrowSquare {from to color} {
  array set files {a 0 b 1 c 2 d 3 e 4 f 5 g 6 h 7}
  set file [string index $from 0]
  set rank [string index $from 1]
  if {! [info exists files($file)]} { return }
  if {$rank < 1  || $rank > 8} { return }
  set rank [expr $rank - 1]
  set from [expr $files($file) + ($rank * 8)]

  set file [string index $to 0]
  set rank [string index $to 1]
  if {! [info exists files($file)]} { return }
  if {$rank < 1  || $rank > 8} { return }
  set rank [expr $rank - 1]
  set to [expr $files($file) + ($rank * 8)]
  ::board::arrow .board $from $to $color
}

# enterSquare:
#   Called when the mouse pointer enters a board square.
#   Finds the best matching square for a move (if there is a
#   legal move to or from this square), and colors the squares
#   to indicate the suggested move.
#
proc enterSquare { square } {
  global highcolor currentSq bestSq bestcolor selectedSq suggestMoves
  set currentSq $square
  if {$selectedSq == -1} {
    ::board::recolor .board
    set bestSq -1
    if {$suggestMoves} {
      set bestSq [sc_pos bestSquare $square]
    }
    if [expr $bestSq != -1] {
      ::board::colorSquare .board $square $bestcolor
      ::board::colorSquare .board $bestSq $bestcolor
    }
  }
}

# leaveSquare:
#    Called when the mouse pointer leaves a board square.
#    Recolors squares to normal (lite/dark) color.
#
proc leaveSquare { square } {
  global currentSq selectedSq bestSq
  set currentSq -1
  if {$square != $selectedSq} {
    ::board::colorSquare .board $square
  }
  if {$bestSq != -1} {
    ::board::colorSquare .board $bestSq
  }
}

# pressSquare:
#    Called when the left mouse button is pressed on a square. Sets
#    that square to be the selected square.
#
proc pressSquare { square } {
  global selectedSq highcolor
  if {$selectedSq == -1} {
    set selectedSq $square
    ::board::recolor .board
    ::board::colorSquare .board $square $highcolor
    # Drag this piece if it is the same color as the side to move:
    set c [string index [sc_pos side] 0]  ;# will be "w" or "b"
    set p [string index [::board::piece .board $square] 0] ;# "w", "b" or "e"
    if {$c == $p} {
      ::board::setDragSquare .board $square
    }
  } else {
    ::board::setDragSquare .board -1
    ::board::colorSquare .board $selectedSq
    ::board::colorSquare .board $square
    addMove $square $selectedSq
    set selectedSq -1
    enterSquare $square
  }
}

# pressSquare2:
#   Called when the middle mouse button is pressed on a square. This
#   makes the suggested best move.
#
proc pressSquare2 { square } {
  global selectedSq bestSq
  ::board::colorSquare .board $bestSq
  ::board::colorSquare .board $square
  addMove $square $bestSq
  enterSquare $square
}

# releaseSquare:
#   Called when the left mouse button is released over a square.
#   If the square is different to that the button was pressed on, it
#   is a dragged move; otherwise it is just selecting this square as
#   part of a move.
#
proc releaseSquare { w x y } {
  global selectedSq bestSq currentSq

  ::board::setDragSquare .board -1
  set square [::board::getSquare $w $x $y]
  if {$square < 0} {
    set selectedSq -1
    ::board::recolor $w
    return
  }

  if {$square == $selectedSq} {
    if {$::suggestMoves} {
      # User pressed and released on same square, so make the
      # suggested move if there is one:
      set selectedSq -1
      ::board::colorSquare $w $bestSq
      ::board::colorSquare $w $square
      addMove $square $bestSq
      enterSquare $square
    } else {
      # Current square is the square user pressed the button on,
      # so we do nothing.
    }
  } else {
    # User has dragged to another square, so try to add this as a move:
    addMove $square $selectedSq
    ::board::colorSquare $w $selectedSq
    set selectedSq -1
    ::board::colorSquare $w $square
  }
}


# searchReset:
#   Resets the filter to contain all games. Calls sc_filter reset and
#   updates relevant windows.
#
proc searchReset {} {
  global glstart
  sc_filter reset
  set glstart 1
  updateGList
  updateStatsWin
  updateMenuStates
}

# searchNegate:
#   Negates the filter, to include only excluded games.
#
proc searchNegate {} {
  global glstart
  sc_filter negate
  set glstart 1
  updateGList
  updateStatsWin
  updateMenuStates
}


# backSquare:
#    Handles the retracting of a move (when the right mouse button is
#    clicked on a square). Recolors squares to normal color also.
#    If the move is the last in the game or variation, is is removed
#    by truncating the game after retracting the move.
#
proc backSquare {} {
  global selectedSq bestSq
  set lastMoveInLine 0
  if {[sc_pos isAt vend]} {
    set lastMoveInLine 1
  }
  sc_move back
  if {$lastMoveInLine} {
    sc_game truncate
  }
  ::board::colorSquare .board $selectedSq
  ::board::colorSquare .board $bestSq
  set selectedSq -1
  set bestSq -1
  updateBoardAndPgn .board
}


##
## Auto-playing of moves:
##
set autoAnnotate 1
set autoplayMode 0

set tempdelay 0
trace variable tempdelay w {forceRegexp {^[0-9]*\.?[0-9]*$}}

proc setAutoplayDelay {{askAnnotate 0}} {
  global autoplayDelay tempdelay autoplayResult
  set autoplayResult -1
  set tempdelay [expr $autoplayDelay / 1000.0]
  set w .apdialog
  toplevel $w
  wm title $w "Scid"
  wm resizable $w 0 0
  label $w.label -text $::tr(AnnotateTime:)
  pack $w.label -side top -pady 5 -padx 5
  entry $w.entry -background white -width 10 -textvariable tempdelay
  pack $w.entry -side top -pady 5
  bind $w.entry <Escape> { .apdialog.buttons.cancel invoke }
  bind $w.entry <Return> { .apdialog.buttons.ok invoke }

  if {$askAnnotate} {
    addHorizontalRule $w
    label $w.avlabel -text $::tr(AnnotateWhich:)
    radiobutton $w.all -text $::tr(AnnotateAll) \
      -variable annotateMoves -value all -anchor w
    radiobutton $w.white -text $::tr(AnnotateWhite) \
      -variable annotateMoves -value white -anchor w
    radiobutton $w.black -text $::tr(AnnotateBlack) \
      -variable annotateMoves -value black -anchor w
    radiobutton $w.notbest -text $::tr(AnnotateNotBest) \
      -variable annotateMoves -value notbest -anchor w
    pack $w.avlabel -side top
    pack $w.all $w.white $w.black $w.notbest -side top -fill x
  }

  addHorizontalRule $w

  set b [frame $w.buttons]
  pack $b -side top -fill x
  button $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .apdialog
    destroy .apdialog
    focus .
    set autoplayResult 0
  }
  button $b.ok -text "OK" -command {
    grab release .apdialog
    if {$tempdelay < 0.1} { set tempdelay 0.1 }
    set autoplayDelay [expr int($tempdelay * 1000)]
    focus .
    grab release .apdialog
    destroy .apdialog
    focus .
    set autoplayResult 1
  }
  pack $b.cancel $b.ok -side right -padx 5 -pady 5
  focus $w.entry
  update idletasks
  grab $w
  tkwait variable autoplayResult
  return $autoplayResult
}


proc toggleAutoplay {{askForDelay 0}} {
  global autoplayMode annotateMode
  if {$autoplayMode == 0} {
    if {$askForDelay} {
      if {! [setAutoplayDelay 1]} {
        set annotateMode 0
        return
      }
    }
    set autoplayMode 1
    set annotateMode 1
    .button.autoplay configure -image autoplay_on -relief sunken
    autoplay
  } else {
    cancelAutoplay
  }
}

proc autoplay {} {
  global autoplayDelay autoplayMode autoAnnotate
  if {$autoplayMode == 0} { return }
  if {[sc_pos isAt vend]} {
    cancelAutoplay
    return
  }
  if {$autoAnnotate} {
    if {![sc_pos isAt start]} { addAnalysisVariation }
  }
  sc_move forward
  updateBoard .board
  after $autoplayDelay autoplay
}

proc cancelAutoplay {} {
  global autoplayMode annotateMode
  set autoplayMode 0
  set annotateMode 0
  after cancel autoplay
  .button.autoplay configure -image autoplay_off -relief flat
}

bind . <Control-z> {toggleAutoplay; break}
bind . <Escape> cancelAutoplay

set trialMode 0

proc setTrialMode {mode} {
  global trialMode
  if {$mode == "toggle"} {
    set mode [expr 1 - $trialMode]
  }
  if {$mode == $trialMode} { return }
  if {$mode == "update"} { set mode $trialMode }

  if {$mode == 1} {
    set trialMode 1
    sc_game push copy
    .button.trial configure -image tb_trial_on
  } else {
    set trialMode 0
    sc_game pop
    .button.trial configure -image tb_trial
  }
  updateBoardAndPgn .board
}

###
### End of file: board.tcl
###
### tb.tcl:
###   Tablebase display routines for Scid.

set tbWin 0
set tbTraining 0
set tbStatus ""

namespace eval ::tb {}

set tbInfo(section) 21
set tbInfo(material) "kpk"
set tbInfo(sections) [list 21 22 31 32 41]
foreach i $tbInfo(sections) { set tbInfo($i) [list] }

set tbInfo(21) [list kqk krk kbk knk kpk]

set tbInfo(22) [list \
  kqkq kqkr kqkb kqkn kqkp \
  -    krkr krkb krkn krkp \
  -    -    kbkb kbkn kbkp \
  -    -    -    knkn knkp \
  -    -    -    -    kpkp ]

set tbInfo(31) [list \
  kqqk kqrk kqbk kqnk kqpk \
  -    krrk krbk krnk krpk \
  -    -    kbbk kbnk kbpk \
  -    -    -    knnk knpk \
  -    -    -    -    kppk ]

set tbInfo(32) [list \
  kqqkq kqqkr kqqkb kqqkn kqqkp \
  kqrkq kqrkr kqrkb kqrkn kqrkp \
  kqbkq kqbkr kqbkb kqbkn kqbkp \
  kqnkq kqnkr kqnkb kqnkn kqnkp \
  kqpkq kqpkr kqpkb kqpkn kqpkp \
  -     -     -     -     -     \
  krrkq krrkr krrkb krrkn krrkp \
  krbkq krbkr krbkb krbkn krbkp \
  krnkq krnkr krnkb krnkn krnkp \
  krpkq krpkr krpkb krpkn krpkp \
  -     -     -     -     -     \
  kbbkq kbbkr kbbkb kbbkn kbbkp \
  kbnkq kbnkr kbnkb kbnkn kbnkp \
  kbpkq kbpkr kbpkb kbpkn kbpkp \
  -     -     -     -     -     \
  knnkq knnkr knnkb knnkn knnkp \
  knpkq knpkr knpkb knpkn knpkp \
  kppkq kppkr kppkb kppkn kppkp ]

set tbInfo(41) [list \
  kqqqk kqqrk kqqbk kqqnk kqqpk \
  -     kqrrk kqrbk kqrnk kqrpk \
  -     -     kqbbk kqbnk kqbpk \
  -     -     -     kqnnk kqnpk \
  -     -     -     -     kqppk \
  -     krrrk krrbk krrnk krrpk \
  -     -     krbbk krbnk krbpk \
  -     -     -     krnnk krnpk \
  -     -     -     -     krppk \
  -     -     kbbbk kbbnk kbbpk \
  -     -     -     kbnnk kbnpk \
  -     -     -     -     kbppk \
  -     -     -     knnnk knnpk \
  -     -     -     -     knppk \
  -     -     -     -     kpppk ]


# ::tb::isopen
#   Returns boolean value of whether the tablebase window is open.
#
proc ::tb::isopen {} {
  return [winfo exists .tbWin]
}

# ::tb::open
#   Open the tablebase window.
#
proc ::tb::open {} {
  global tbInfo
  set w .tbWin
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: [tr WindowsTB]"
  pack [frame $w.b] -side bottom -fill x
  pack [frame $w.info] -side left -fill y -expand yes
  addVerticalRule $w
  pack [frame $w.pos] -side right -fill y -expand yes

  # Left frame: tablebase browser and summary info

  set f $w.info
  pack [frame $f.sec] -side top -fill x
  foreach i $tbInfo(sections) {
    set name "[string index $i 0]-[string index $i 1]"
    radiobutton $f.sec.b$i -text " $name " \
      -variable tbInfo(section) -value $i \
      -indicatoron 0 -command "::tb::section $i"
    pack $f.sec.b$i -side left -pady 1 -padx 1
  }
  pack [frame $f.list] -side top -fill x
  text $f.list.text -width 35 -height 7 -font font_Fixed -wrap none \
    -foreground black -background white -yscrollcommand "$f.list.ybar set" \
    -cursor top_left_arrow
  scrollbar $f.list.ybar -command "$f.list.text yview" -takefocus 0
  pack $f.list.ybar -side right -fill y
  pack $f.list.text -side left
  pack [frame $f.separator -height 2]
  # addHorizontalRule $f
  pack [frame $f.data] -side top -fill y -expand yes
  text $f.data.text -width 35 -height 14 -font font_Fixed -wrap none \
    -foreground black -background white -yscrollcommand "$f.data.ybar set" \
    -cursor top_left_arrow -setgrid 1
  scrollbar $f.data.ybar -command "$f.data.text yview" -takefocus 0
  pack $f.data.ybar -side right -fill y
  pack $f.data.text -side left -fill both -expand yes

  $f.list.text tag configure avail -foreground blue
  $f.list.text tag configure unavail -foreground gray40
  $f.data.text tag configure fen -foreground blue

  # Right frame: tablebase results for current position

  set f $w.pos
  text $f.text -width 30 -height 10 -font font_Small -wrap word \
    -foreground black -background white -yscrollcommand "$f.ybar set"
  scrollbar $f.ybar -command "$f.text yview" -takefocus 0
  pack $f.ybar -side right -fill y
  pack $f.text -side left -fill both -expand yes

  $f.text tag configure indent -lmargin2 [font measure font_Fixed  "        "]

  button $w.b.random -text "Random" -command ::tb::random
  checkbutton $w.b.training -text $::tr(Training) -variable tbTraining \
    -command ::tb::training -relief raised -padx 4 -pady 5
  button $w.b.help -text $::tr(Help) -command { helpWindow TB }
  button $w.b.close -text $::tr(Close) -command "destroy $w"
  label $w.b.status -width 1 -textvar tbStatus -font font_Small \
    -relief flat -anchor w -height 0
  pack $w.b.close $w.b.help -side right -padx 2 -pady 2
  pack $w.b.random $w.b.training -side left -padx 2 -pady 2
  pack $w.b.status -side left -fill x -expand yes
  bind $w <Destroy> { set tbWin 0; set tbTraining 0 }
  bind $w <F1> { helpWindow TB }
  set ::tbTraining 0
  ::tb::section
  ::tb::summary
  ::tb::results
}

# ::tb::name
#   Converts a material string like "kqkr" or "KQKR" to "KQ-KR".
#
proc ::tb::name {s} {
  set s [string toupper $s]
  set idx [string last "K" $s]
  set new [string range $s 0 [expr $idx - 1]]
  append new "-"
  append new [string range $s $idx end]
  return $new
}

# ::tb::section
#   Updates the tablebase list for the specified section.
#
proc ::tb::section {{sec 0}} {
  global tbInfo
  set w .tbWin
  if {! [winfo exists $w]} { return }
  if {$sec == 0} { set sec $tbInfo(section)}
  set tbInfo(section) $sec
  if {! [info exists tbInfo($sec)]} { return }
  set t $w.info.list.text
  $t configure -state normal
  $t delete 1.0 end
  set count 0
  foreach tb $tbInfo($sec) {
    if {$tb == "-"} {
      $t insert end [format "%-7s" ""]
    } else {
      set avail [sc_info tb available $tb]
      if {$avail} {
        set taglist [list avail $tb]
      } else {
        set taglist [list unavail $tb]
      }
      $t insert end [format "%-6s" [::tb::name $tb]] $taglist
      $t insert end " "
      # Bind tags for enter/leave/buttonpress on this tb:
      $t tag bind $tb <Any-Enter> \
        [list $t tag configure $tb -foreground yellow -background darkBlue]
      $t tag bind $tb <Any-Leave> \
        [list $t tag configure $tb -foreground {} -background {}]
      $t tag bind $tb <ButtonPress-1> [list ::tb::summary $tb]
    }
    incr count
    if {$count == 5} { set count 0; $t insert end "\n" }
  }
  $t configure -state disabled
}

# ::tb::summary
#   Shows the tablebase information for the specified tablebase.
#
proc ::tb::summary {{material ""}} {
  global tbInfo tbs
  set w .tbWin
  if {! [winfo exists $w]} { return }

  if {$material == ""} { set material $tbInfo(material) }
  set tbInfo(material) $material
  set t $w.info.data.text
  $t configure -state normal
  $t delete 1.0 end
  $t insert end [format "%-6s" [::tb::name $material]]
  if {! [info exists tbs($material)]} {
    $t insert end "\nNo summary for this tablebase."
    $t configure -state disabled
    return
  }
  set data $tbs($material)

  $t insert end [format "    %5u games per million\n\n" [lindex $data 0]]

  # Longest-mate and result-percentage stats:

  $t insert end "Side    Longest    %     %     %\n"
  $t insert end "to move   mate    Win  Draw  Loss\n"
  $t insert end "---------------------------------\n"

  # Stats for White:
  $t insert end "White     "
  set len [lindex $data 1]
  set fen [lindex $data 2]
  if {$len == "0"} { set len "-" }
  if {[string length $fen] > 2} {
    append fen " w"
    $t insert end [format "%3s" $len] [list fen $fen]
    $t tag bind $fen <Any-Enter> \
      [list $t tag configure $fen -foreground yellow -background darkBlue]
    $t tag bind $fen <Any-Leave> \
      [list $t tag configure $fen -foreground {} -background {}]
    $t tag bind $fen <ButtonPress-1> [list ::tb::setFEN $fen]
  } else {
    $t insert end [format "%3s" $len]
  }
  $t insert end "  "
  $t insert end [format " %5s" [lindex $data 5]]
  $t insert end [format " %5s" [lindex $data 6]]
  $t insert end [format " %5s" [lindex $data 7]]
  $t insert end "\n"

  # Stats for Black:
  $t insert end "Black     "
  set len [lindex $data 3]
  set fen [lindex $data 4]
  if {$len == "0"} { set len "-" }
  if {[string length $fen] > 2} {
    append fen " b"
    $t insert end [format "%3s" $len] [list fen $fen]
    $t tag bind $fen <Any-Enter> \
      [list $t tag configure $fen -foreground yellow -background darkBlue]
    $t tag bind $fen <Any-Leave> \
      [list $t tag configure $fen -foreground {} -background {}]
    $t tag bind $fen <ButtonPress-1> [list ::tb::setFEN $fen]
  } else {
    $t insert end [format "%3s" $len]
  }
  $t insert end "  "
  $t insert end [format " %5s" [lindex $data 8]]
  $t insert end [format " %5s" [lindex $data 9]]
  $t insert end [format " %5s" [lindex $data 10]]
  $t insert end "\n\n"

  set mzugs [lindex $data 11]
  $t insert end "Mutual zugzwangs: "
  if {$mzugs >= 0} { $t insert end "$mzugs\n" } else { $t insert end "?\n" }
  if {$mzugs <= 0} {
    $t configure -state disabled
    return
  }

  # Extra Zugzwang info:
  set nBtmLoses [lindex $data 12]
  set nWtmLoses [lindex $data 14]
  set nBothLose [lindex $data 16]
  set zugnames [list " White draws, Black loses: " \
                  " Black draws, White loses: " \
                  " Whoever moves loses:      "]
  if {$nBtmLoses > 0} {
    $t insert end [lindex $zugnames 0]
    $t insert end [format "%5d\n" $nBtmLoses]
  }
  if {$nWtmLoses > 0} {
    $t insert end [lindex $zugnames 1]
    $t insert end [format "%5d\n" $nWtmLoses]
  }
  if {$nBothLose > 0} {
    $t insert end [lindex $zugnames 2]
    $t insert end [format "%5d\n" $nBothLose]
  }

  # Selected zugzwang positions:
  set btmFens [lindex $data 13]
  set wtmFens [lindex $data 15]
  set bothFens [lindex $data 17]
  set nBtmFens [llength $btmFens]
  set nWtmFens [llength $wtmFens]
  set nBothFens [llength $bothFens]
  set nTotalFens [expr $nBtmFens + $nWtmFens + $nBothFens]
  if {$nTotalFens == 0} {
    $t configure -state disabled
    return
  }

  # Print the lists of selected zugzwang positions:
  $t insert end "\nSelected zugzwang positions:"
  foreach n [list $nBtmFens $nWtmFens $nBothFens] \
    fenlist [list $btmFens $wtmFens $bothFens] \
    name $zugnames tomove [list b w w] {
      if {$n == 0} { continue }
      $t insert end "\n [string trim $name]"
      set count 0
      for {set count 0} {$count < $n} {incr count} {
        set fen [lindex $fenlist $count]
        if {[expr $count % 10] == 0} {
          $t insert end "\n  "
        }
        $t insert end " "
        append fen " $tomove"
        $t insert end [format "%2d" [expr $count + 1]] [list fen $fen]
        $t tag bind $fen <Any-Enter> \
          [list $t tag configure $fen -foreground yellow -background darkBlue]
        $t tag bind $fen <Any-Leave> \
          [list $t tag configure $fen -foreground {} -background {}]
        $t tag bind $fen <ButtonPress-1> [list ::tb::setFEN $fen]
      }
    }

  $t configure -state disabled
}

# ::tb::results
#   Called when the main window board changes, to display tablebase
#   results for all moves from the current position.
#
proc ::tb::results {} {
  global tbTraining
  set w .tbWin
  if {! [winfo exists $w]} { return }
  set t $w.pos.text
  $t delete 1.0 end
  if {$tbTraining} {
    $t insert end "\n (Training mode; results are hidden)"
  } else {
    $t insert end [sc_pos probe report] indent
  }
}

# ::tb::random
#   Sets up a random position with the material of the tablebase
#   currently displayed in the info frame.
#
proc ::tb::random {} {
  global tbInfo
  if {[catch {sc_game startBoard "random:$tbInfo(material)"} err]} {
    tk_messageBox -title "Scid" -icon warning -type ok -message $err
    return
  }
  # The material is valid, so clear the game and regenerate a
  # random starting position:
  sc_game new
  sc_game startBoard "random:$tbInfo(material)"
  updateBoardAndPgn
}

# ::tb::setFEN
#   Called when an item in the Tablebase info browser with an
#   associated FEN position is selected with the left mouse button,
#   causing the position to be set in the main window.
#
proc ::tb::setFEN {fen} {
  if {[catch {sc_game startBoard $fen} err]} {
    tk_messageBox -title "Scid" -icon info -type ok -message $err
    return
  }
  # The FEN is valid, so clear the game and reset the FEN:
  sc_game new
  sc_game startBoard $fen
  updateBoardAndPgn
}

# ::tb::training
#   Toggle tablebase training mode.
#
proc ::tb::training {} {
  global tbTraining tbStatus gameInfo
  set w .tbWin
  set tbStatus ""
  if {$tbTraining} {
    set gameInfo(showTB_old) $gameInfo(showTB)
    set gameInfo(showTB) 0
  } else {
    if {$gameInfo(showTB) == 0} { set gameInfo(showTB) $gameInfo(showTB_old) }
  }
  updateBoardAndPgn
  ::tb::results
}

# ::tb::move
#   Finds and executes the best move in the current position,
#   if one can be determined from the tablebases.
#
proc ::tb::move {} {
  global tbTraining tbStatus
  if {! $tbTraining} { return }
  set moves [split [sc_pos probe optimal]]
  set len [llength $moves]
  if {$len == 0} {
    set tbStatus "No optimal move was found."
    return
  }
  set i [expr int(rand() * $len)]
  set move [lindex $moves $i]
  if {[catch {sc_move addSan $move}]} {
    set tbStatus "Error playing $move."
  } else {
    set tbStatus "Played $move."
  }
  updateBoardAndPgn
}


# tbs:
#   Summary data about tablebases.
#   Each list has the following elements:
#     (0) Frequency (per million games),
#     (1) Longest-wtm-mate length, (2) Longest-wtm-mate FEN,
#     (3) Longest-btm-mate length, (4) Longest-btm-mate FEN,
#     (5) wtm-win-%, (6) wtm-draw-%, (7) wtm-loss-%,
#     (8) btm-win-%, (9) btm-draw-%, (10) btm-loss-%,
#     (11) number of mutual zugzwangs (-1 if unknown).
#  The longest-mate FENs have a board field only; no side to move, etc.
#
#   There are three types of mutual zugzwang:
#     wtm draws / btm loses, wtm loses / btm draws, wtm loses / btm loses.
#   The first two are "half-point" zugzwangs, the last is "full-point".
#
#   If the number of mutual zugzwangs is known and nonzero,
#   six more items should follow in the list:
#     (12) number of wtm-draws-btm-loses zugzwangs,
#     (13) list of selected wtm-draws-btm-loses zugzwang FENs,
#     (14) number of wtm-loses-btm-draws zugzwangs,
#     (15) list of selected wtm-loses-btm-draws zugzwang FENs,
#     (16) number of whoever-moves-loses (full-point) zugzwangs,
#     (17) list of selected whoever-moves-loses zugzwang FENs.
#   These zugzwang FENs board field only; no side to move, etc.

set tbs(kqk) {
  259 10 {7K/6Q1/8/8/2k5/8/8/8} 0 -
  100.0 0.0 0.0 0.0 10.3 89.7
  0
}

set tbs(krk) {
  543 16 {8/8/2R5/3k4/8/8/8/1K6} 0 -
  100.0 0.0 0.0 0.0 9.9 90.1
  0
}

set tbs(kbk) {
  184 0 - 0 -
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(knk) {
  224 0 - 0 -
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(kpk) {
  2345 28 {8/8/8/1k6/8/8/K5P1/8} 0 -
  76.5 23.5 0.0 0.0 41.9 58.1
  80 80 {} 0 {} 0 {}
}

set tbs(kqkq) {
  221 13 {8/8/8/8/8/8/8/qk1K2Q1} 13 {8/8/8/8/8/8/8/QK1k2q1}
  41.7 57.8 0.5 41.7 57.8 0.5
  0
}

set tbs(kqkr) {
  398 35 {K3r3/8/5k2/Q7/8/8/8/8} 19 {k7/5r2/K7/8/8/8/1Q6/8}
  99.0 0.8 0.2 28.7 5.8 65.5
  0
}

set tbs(kqkb) {
  26 17 {K7/8/8/3k4/4b3/8/8/7Q} 0 -
  99.7 0.3 0.0 0.0 23.1 76.9
  0
}

set tbs(kqkn) {
  72 21 {8/KQ6/2n5/2k5/8/8/8/8} 0 -
  99.3 0.7 0.0 0.0 19.5 80.5
  0
}

set tbs(kqkp) {
  931 28 {3KQ3/8/8/8/8/8/3kp3/8} 29 {8/1p4k1/7Q/8/7K/8/8/8}
  99.4 0.6 0.0 7.7 12.1 80.2
  0
}

set tbs(krkr) {
  417 19 {8/3R4/8/8/5k2/6r1/7K/8} 19 {1k6/2R5/3K4/8/8/8/6r1/8}
  29.1 70.2 0.7 29.1 70.2 0.7
  0
}

set tbs(krkb) {
  321 29 {k7/8/b7/8/K7/R7/8/8} 0 -
  35.2 64.8 0.0 0.0 96.8 3.2
  5  5 {
    4R3/8/8/8/8/b1K5/8/3k4 8/5R2/7b/8/8/2K5/8/1k6 8/8/1b6/5R2/8/3K4/8/2k5
    8/8/8/8/8/1k6/b7/R1K5 8/8/8/8/8/2K5/4k3/R2b4
  } 0 {} 0 {}
}

set tbs(krkn) {
  391 40 {8/8/6R1/2K5/n7/8/8/3k4} 1 {8/8/8/8/1n6/k7/8/KR6}
  48.4 51.6 0.0 0.0 89.0 11.0
  18 18 {
    8/2n5/8/4R3/3K1k2/8/8/8 8/8/5k2/4R3/3K4/2n5/8/8 8/8/8/1k6/2R5/3K4/4n3/8
    8/8/8/2n5/3K4/4R3/5k2/8 8/8/8/3k4/2R5/3K4/n7/8 8/8/8/3k4/4R3/3K4/6n1/8
    8/8/8/4k3/3R4/2K5/1n6/8 8/8/8/5k2/4R3/3K4/2n5/8 8/8/8/6n1/3K4/4R3/3k4/8
    8/8/8/8/2R5/1k1K4/4n3/8 8/8/8/8/3K1k2/4R3/8/2n5 8/8/8/8/3R4/2K1k3/1n6/8
    8/8/8/8/4R3/3K1k2/2n5/8 8/8/8/8/6n1/3K4/4R3/3k4 8/8/8/8/8/2KR4/8/2k2n2
    8/8/8/8/8/2RK4/8/n2k4 8/8/8/8/8/3KR3/8/3k2n1 8/8/8/n7/3K4/2R5/3k4/8
  } 0 {} 0 {}
}

set tbs(krkp) {
  2122 26 {2K5/8/7p/6k1/8/8/R7/8} 43 {8/8/8/8/5R2/2pk4/5K2/8}
  91.4 8.4 0.2 16.4 17.5 66.1
  12 12 {
    8/8/8/8/8/1k6/p7/R1K5   8/8/8/8/8/2k5/1p6/1R1K4 8/8/8/8/8/4k3/5p2/3K1R2
    8/3K4/8/3k4/3p4/8/8/3R4 8/1K6/8/1k6/1p6/8/8/1R6 8/2K5/8/2k5/2p5/8/8/2R5
    8/2K5/8/2k5/3p4/8/8/3R4 8/3K4/8/3k4/4p3/8/8/4R3 8/1K6/8/1k6/2p5/8/8/2R5
    8/2K5/8/2k5/1p6/8/8/1R6 8/3K4/8/3k4/2p5/8/8/2R5 8/K7/8/k7/1p6/8/8/1R6
  } 0 {} 0 {}
}

set tbs(kbkb) {
  51 1 {8/8/8/8/8/K7/7B/kb6} 1 {6BK/8/6k1/8/8/b7/8/8}
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(kbkn) {
  82 1 {knB5/8/1K6/8/8/8/8/8} 1 {K1k1n3/B7/8/8/8/8/8/8}
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(kbkp) {
  380 1 {7k/7p/5K2/8/8/8/1B6/8} 29 {8/1p4k1/7B/8/8/7K/8/8}
  0.0 94.8 5.2 23.6 76.4 0.0
  1 0 {} 1 {8/8/8/8/8/8/1pK5/kB6} 0 {}
}

set tbs(knkn) {
  68 1 {k7/n1K5/8/3N4/8/8/8/8} 1 {8/8/8/8/1n6/1k6/8/KN6}
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(knkp) {
  492 7 {8/8/8/8/pN6/8/2K5/k7} 29 {8/1p6/6kN/8/8/7K/8/8}
  0.0 87.1 12.9 32.6 67.4 0.0
  29 22 {} 7 {} 0 {}
}

set tbs(kpkp) {
  2804 33 {2K5/k7/7p/8/8/8/6P1/8} 33 {8/2p1K3/8/8/8/4P3/8/3k4}
  43.4 33.3 23.2 43.4 33.3 23.2
  121 106 {} 106 {} 15 {
    8/8/8/1Kp5/2Pk4/8/8/8 8/8/8/2Kp4/3Pk3/8/8/8 8/8/8/8/1Kp5/2Pk4/8/8
    8/8/8/8/1pK5/kP6/8/8  8/8/8/8/2Kp4/3Pk3/8/8 8/8/8/8/2pK4/1kP5/8/8
    8/8/8/8/3Kp3/4Pk2/8/8 8/8/8/8/8/1Kp5/2Pk4/8 8/8/8/8/8/1pK5/kP6/8
    8/8/8/8/8/2Kp4/3Pk3/8 8/8/8/8/8/2pK4/1kP5/8 8/8/8/8/8/3Kp3/4Pk2/8
    8/8/8/8/8/Kp6/1Pk5/8  8/8/8/8/Kp6/1Pk5/8/8  8/8/8/Kp6/1Pk5/8/8/8
  }
}

set tbs(kqqk) {
  14 4 {8/8/8/4k3/8/8/1K6/QQ6} 0 -
  100.0 0.0 0.0 0.0 2.1 97.9
  0
}

set tbs(kqrk) {
  18 6 {7Q/8/8/8/4k3/8/8/1R5K} 0 -
  100.0 0.0 0.0 0.0 1.1 98.9
  0
}

set tbs(kqbk) {
  39 8 {8/Q4B2/5k2/8/8/8/8/K7} 0 -
  100.0 0.0 0.0 0.0 9.4 90.6
  0
}

set tbs(kqnk) {
  40 9 {K7/N7/8/8/8/5k2/Q7/8} 0 -
  100.0 0.0 0.0 0.0 9.7 90.3
  0
}

set tbs(kqpk) {
  154 10 {8/8/8/2k5/8/8/4P1Q1/7K} 0 -
  100.0 0.0 0.0 0.0 2.8 97.2
  0
}

set tbs(krrk) {
  9 7 {4R3/3k4/8/8/5R1K/8/8/8} 0 -
  100.0 0.0 0.0 0.0 0.3 99.7
  0
}

set tbs(krbk) {
  47 16 {8/8/3R4/4k3/4B3/8/8/K7} 0 -
  100.0 0.0 0.0 0.0 8.8 91.2
  0
}

set tbs(krnk) {
  12 16 {K7/2R5/3k4/3N4/8/8/8/8} 0 -
  100.0 0.0 0.0 0.0 9.2 90.8
  0
}

set tbs(krpk) {
  335 16 {K7/8/3R4/4kP2/8/8/8/8} 0 -
  100.0 0.0 0.0 0.0 2.5 97.5
  0
}

set tbs(kbbk) {
  33 19 {K7/8/3B4/3k4/8/8/4B3/8} 0 -
  49.3 50.7 0.0 0.0 58.8 41.2
  0
}

set tbs(kbnk) {
  203 33 {7K/4B3/4k3/8/8/8/8/2N5} 0 -
  99.5 0.5 0.0 0.0 18.1 81.9
  0
}

set tbs(kbpk) {
  449 31 {8/3P4/KBk5/8/8/8/8/8} 0 -
  96.0 4.0 0.0 0.0 16.8 83.2
  6 6 {
    1B1K4/8/8/k7/8/P7/8/8 1B6/3K4/8/1k6/8/P7/8/8 1BK5/8/1k6/8/8/P7/8/8
    8/B1k5/K7/P7/8/8/8/8 kB6/8/1PK5/8/8/8/8/8 kB6/8/KP6/8/8/8/8/8
  } 0 {} 0 {}
}

set tbs(knnk) {
  19 1 {k7/3N4/K1N5/8/8/8/8/8} 0 -
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(knpk) {
  426 27 {1N6/8/8/8/8/2k3P1/8/2K5} 0 -
  96.3 3.7 0.0 0.0 18.5 81.5
  75 75 {} 0 {} 0 {}
}

set tbs(kppk) {
  571 32 {8/8/8/8/2k5/6P1/K5P1/8} 0 -
  98.4 1.6 0.0 0.0 7.9 92.1
  43 43 {} 0 {} 0 {}
}

set tbs(kqqkq) {
  49 30 ? 13 ?
  99.1 0.8 0.1 0.6 32.8 66.6
  0
}

set tbs(kqqkr) {
  0 35 ? 19 ?
  100.0 0.0 0.0 0.1 0.2 99.7
  0
}

set tbs(kqqkb) {
  0 15 ? 0 -
  100.0 0.0 0.0 0.0 0.1 99.9
  0
}

set tbs(kqqkn) {
  0 19 ? 0 -
  100.0 0.0 0.0 0.0 0.1 99.9
  0
}

set tbs(kqqkp) {
  7 22 ? 13 ?
  100.0 0.0 0.0 0.0 0.7 99.3
  0
}

set tbs(kqrkq) {
  33 67 ? 38 ?
  97.0 2.8 0.2 24.4 21.2 54.4
  1 1 {8/8/8/8/1R6/k4q2/8/1K2Q3} 0 {} 0 {}
}

set tbs(kqrkr) {
  123 34 {1K2Q3/8/3k4/1r2R3/8/8/8/8} 20 {6rQ/8/8/8/8/7K/5R2/6k1}
  99.8 0.1 0.0 0.3 17.1 82.1
  0
}

set tbs(kqrkb) {
  11 29 ? 0 -
  100.0 0.0 0.0 0.0 11.6 88.4
  0
}

set tbs(kqrkn) {
  2 40 ? 1 ?
  99.9 0.1 0.0 0.0 7.7 92.3
  0
}

set tbs(kqrkp) {
  23 40 ? 43 ?
  100.0 0.0 0.0 0.3 1.4 98.3
  0
}

set tbs(kqbkq) {
  30 33 ? 24 ?
  55.7 44.0 0.3 30.5 62.3 7.2
  25 25 {} 0 {} 0 {}
}

set tbs(kqbkr) {
  21 40 ? 30 ?
  99.3 0.6 0.0 0.7 27.5 71.8
  0
}

set tbs(kqbkb) {
  2 17 ? 2 ?
  99.7 0.3 0.0 0.0 19.8 80.2
  0
}

set tbs(kqbkn) {
  2 21 ? 1 ?
  99.5 0.5 0.0 0.0 16.7 83.3
  0
}

set tbs(kqbkp) {
  23 32 ? 24 ?
  100.0 0.0 0.0 1.0 14.1 84.9
  0
}

set tbs(kqnkq) {
  75 41 ? 24 ?
  50.1 49.6 0.3 33.5 62.2 4.3
  38 38 {} 0 {} 0 {}
}

set tbs(kqnkr) {
  11 38 ? 41 ?
  99.2 0.7 0.0 3.0 27.2 69.8
  0
}

set tbs(kqnkb) {
  7 17 ? 1 ?
  99.8 0.2 0.0 0.0 20.9 79.1
  0
}

set tbs(kqnkn) {
  14 21 ? 1 ?
  99.4 0.6 0.0 0.0 17.8 82.2
  0
}

set tbs(kqnkp) {
  42 30 ? 29 ?
  99.9 0.1 0.0 1.9 15.0 83.1
  0
}

set tbs(kqpkq) {
  1165 124 {4q3/K7/8/8/8/4P3/6Q1/k7} 29 {8/7q/3PK3/8/8/8/Q7/3k4}
  68.4 31.2 0.4 35.2 51.2 13.6
  640 640 {} 0 {} 0 {}
}

set tbs(kqpkr) {
  214 38 ? 33 ?
  99.6 0.3 0.1 19.7 6.1 74.1
  1 1 {k7/8/KQ1r4/P7/8/8/8/8} 0 {} 0 {}
}

set tbs(kqpkb) {
  18 28 ? 2 ?
  99.9 0.1 0.0 0.0 16.7 83.3
  0
}

set tbs(kqpkn) {
  44 30 ? 8 ?
  99.7 0.3 0.0 0.0 12.5 87.5
  0
}

set tbs(kqpkp) {
  601 105 ? 34 ?
  100.0 0.0 0.0 3.3 7.3 89.4
  0
}

set tbs(krrkq) {
  9 29 ? 49 ?
  58.2 36.8 5.1 52.0 37.0 11.0
  10 10 {
    6R1/8/8/8/6R1/7q/1K5k/8 6R1/8/8/8/8/6R1/7q/K6k  8/6R1/8/8/8/3K2R1/7q/7k
    8/6R1/8/8/8/6R1/7q/1K5k 8/8/1R6/8/8/1R1K4/q7/k7 8/8/6R1/8/8/6R1/7q/2K4k
    8/8/8/3R4/8/k7/2KR4/4q3 8/8/8/6R1/8/6R1/7q/3K3k 8/8/8/8/1R6/1R6/q7/k2K4
    8/8/8/8/8/2K5/2R1R3/kq6
  } 0 {} 0 {}
}

set tbs(krrkr) {
  37 31 ? 20 ?
  99.2 0.7 0.0 0.4 33.4 66.2
  0
}

set tbs(krrkb) {
  9 29 ? 0 -
  99.3 0.7 0.0 0.0 22.4 77.6
  1 1 {8/8/8/8/8/b1k5/1R6/1RK5} 0 {} 0 {}
}

set tbs(krrkn) {
  9 40 ? 1 ?
  99.7 0.3 0.0 0.0 15.0 85.0
  0
}

set tbs(krrkp) {
  2 33 ? 50 ?
  100.0 0.0 0.0 1.0 5.7 93.3
  0
}

set tbs(krbkq) {
  21 21 ? 70 ?
  38.7 48.0 13.4 71.2 25.6 3.2
  372 0 {} 372 {3Kn3/8/8/8/8/4r3/7Q/3k4} 0 {}
}

set tbs(krbkr) {
  668 65 {k7/7r/3K4/8/6B1/8/4R3/8} 30 {8/4R2K/8/5k2/8/8/7B/4r3}
  41.3 58.7 0.0 0.8 94.1 5.1
  17 17 {
    8/8/8/8/8/1R1K4/2B5/r1k5 8/8/8/8/8/2KB4/2R5/kr6   8/8/8/8/7B/4r3/5R2/2K1k3
    8/8/8/8/rB6/8/1R6/1K1k4  7k/6R1/7r/8/8/8/1B6/1K6  8/8/8/8/8/2K4B/6R1/3r1k2
    8/8/8/8/4R3/k7/2K1B3/4r3 8/8/8/8/8/2R3Br/k1K5/8   8/8/8/3B1r2/3K4/8/6R1/3k4
    8/8/8/8/8/R2K4/5B2/1r1k4 8/8/8/8/8/3K2R1/8/4k1Br  8/8/8/2B5/8/6r1/k1K4R/8
    8/5r2/8/8/1R4B1/8/3K4/k7 8/8/3B4/1r6/8/2K5/4R3/1k6 8/8/8/8/3KB2r/8/5R2/k7
    8/8/3B4/8/8/5r2/k1K1R3/8 5R2/8/8/8/8/3K4/5Br1/2k5
  } 0 {} 0 {}
}

set tbs(krbkb) {
  18 30 ? 2 ?
  98.2 1.8 0.0 0.0 31.1 68.9
  0
}

set tbs(krbkn) {
  4 40 ? 1 ?
  98.9 1.1 0.0 0.0 24.0 76.0
  0
}

set tbs(krbkp) {
  32 28 ? 70 ?
  99.1 0.9 0.0 2.4 17.1 80.5
  1 1 {1k1K4/7R/8/8/8/8/6p1/7B} 0 {} 0 {}
}

set tbs(krnkq) {
  16 20 ? 69 ?
  35.4 41.1 23.4 78.2 19.7 2.1
  455 0 {} 455 {} 0 {}
}

set tbs(krnkr) {
  435 37 {2k1r3/8/R7/N2K4/8/8/8/8} 41 {4K3/8/1r6/8/5k2/1R4N1/8/8}
  36.7 63.3 0.1 3.2 93.6 3.2
  10 10 {
    2R5/8/8/8/8/k2K4/8/r1N5  8/8/8/8/3N4/1R1K4/8/r1k5 8/8/8/8/3N4/2KR4/8/2k1r3
    8/8/8/8/4N3/7R/k1K5/5r2  8/8/8/8/8/2KRN3/8/2k1r3  8/8/8/8/8/3KN3/3R4/2k1r3
    8/8/8/8/8/5RN1/8/2K1k1r1 8/8/8/8/8/6RN/8/3K1k1r   8/8/8/8/8/NR1K4/8/r1k5
    8/8/8/8/r1N5/2R5/k1K5/8
  } 0 {} 0 {}
}

set tbs(krnkb) {
  7 31 ? 1 ?
  97.7 2.3 0.0 0.0 32.4 67.6
  0
}

set tbs(krnkn) {
  11 37 ? 1 ?
  99.0 1.0 0.0 0.0 24.6 75.4
  3 3 {
    8/8/8/8/4n3/1k6/N7/R1K5 8/8/8/8/8/3n4/N2k4/RK6 8/8/8/8/8/n7/1k6/N1RK4
  } 0 {} 0 {}
}

set tbs(krnkp) {
  32 29 ? 68 ?
  98.5 1.5 0.0 4.5 17.1 78.4
  0
}

set tbs(krpkq) {
  366 68 ? 104 ?
  37.7 11.8 50.5 91.0 7.1 1.8
  243 2 {} 241 {} 0 {}
}

set tbs(krpkr) {
  9138 74 {8/1k6/4R3/8/8/8/6Pr/4K3} 33 {8/1P6/2k5/8/K7/8/8/1r5R}
  66.6 33.0 0.4 20.1 54.4 25.5
  209 209 {} 0 {} 0 {}
}

set tbs(krpkb) {
  615 73 ? 2 ?
  96.4 3.6 0.0 0.0 32.6 67.4
  225 225 {} 0 {} 0 {}
}

set tbs(krpkn) {
  398 54 ? 8 ?
  97.5 2.5 0.0 0.0 24.7 75.3
  413 413 {} 0 {} 0 {} 0 {}
}

set tbs(krpkp) {
  1069 56 ? 103 ?
  99.4 0.4 0.3 10.0 6.6 83.5
  3 0 {} 2 {
    8/8/8/8/8/1p6/kP6/1RK5 8/8/8/8/8/k7/Pp6/RK6
  } 1 {8/8/8/8/8/2p5/1kP5/2RK4}
}

set tbs(kbbkq) {
  4 21 ? 81 ?
  15.3 20.2 64.5 96.5 2.9 0.6
  1 0 {} 1 {8/8/8/8/q7/2BB4/1K6/3k4} 0 {}
}

set tbs(kbbkr) {
  14 23 {4r3/8/8/8/8/4B3/8/k1K4B} 31 {1K4B1/8/3k4/8/B5r1/8/8/8}
  16.5 83.4 0.1 1.3 97.2 1.5
  3 3 {
    8/8/8/8/8/3K1k2/6r1/4B2B 8/8/8/8/8/5k2/6r1/3KB2B 8/8/8/B7/8/3k4/2r5/KB6
  } 0 {} 0 {}
}

set tbs(kbbkb) {
  37 22 {6B1/8/7B/8/b7/2K5/8/k7} 2 {1B5K/5k1B/8/8/8/4b3/8/8}
  15.6 84.3 0.0 0.0 98.6 1.4
  0
}

set tbs(kbbkn) {
  30 78 ? 1 ?
  48.2 51.8 0.0 0.0 66.1 33.9
  1 1 {8/8/8/8/8/6n1/2K4B/kB6} 0 {} 0 {}
}

set tbs(kbbkp) {
  25 74 ? 83 ?
  48.0 50.2 1.8 11.4 54.1 34.5
  1 1 {B1k5/1pB5/3K4/8/8/8/8/8} 0 {} 0 {}
}

set tbs(kbnkq) {
  12 36 ? 53 ?
  25.0 6.4 68.6 97.6 1.7 0.7
  1 0 {} 1 {8/8/q7/8/3K4/2N5/8/k1B5} 0 {}
}

set tbs(kbnkr) {
  65 36 {8/8/8/2N5/8/8/B6K/5kr1} 41 {8/8/1B4N1/5k2/8/1r6/8/4K3}
  26.0 73.8 0.2 3.8 94.6 1.6
  8 6 {
    3r4/8/2B5/8/1N6/8/8/k1K5 8/8/8/8/8/2k5/1r6/B1NK4  8/8/8/8/8/2k5/3r4/1KN1B3
    8/8/8/8/8/3k4/4r3/2KN1B2 8/8/8/8/8/4k3/5r2/3KN1B1 8/8/8/8/B7/1r6/N1k5/K7
  } 2 {8/8/8/8/8/1k3r2/8/1KB4N 8/r7/8/B7/8/8/N1k5/K7} 0 {}
}

set tbs(kbnkb) {
  53 39 {8/7B/8/8/6N1/8/3k4/1Kb5} 2 {KB6/8/k4N2/8/6b1/8/8/8}
  25.5 74.5 0.0 0.0 98.8 1.2
  45 45 {} 0 {} 0 {}
}

set tbs(kbnkn) {
  32 107 {6Bk/8/8/7N/8/7K/6n1/8} 1 {8/8/3N4/8/3n4/8/B7/K1k5}
  32.2 67.8 0.0 0.0 96.1 3.9
  922 922 {} 0 {} 0 {}
}

set tbs(kbnkp) {
  166 104 ? 55 ?
  91.4 5.5 3.2 14.7 23.0 62.4
  62 61 {} 1 {8/8/8/1N6/3K4/B7/5p2/k7} 0 {}
}

set tbs(kbpkq) {
  119 35 ? 50 ?
  21.3 11.5 67.2 96.8 2.8 0.4
  16 0 {} 16 {
    3K4/2P5/B3qk2/8/8/8/8/8   8/1KP1q3/1B1k4/8/8/8/8/8 8/qPK5/8/3k4/1B6/8/8/8
    2q5/2B2P2/3K4/1k6/8/8/8/8 8/2P5/4q3/KB6/8/k7/8/8   8/3P4/5q2/1KB5/8/1k6/8/8
    8/1KP1q3/4k3/B7/8/8/8/8   3K4/q1P5/B4k2/8/8/8/8/8  8/5P2/3K4/8/4k2B/7q/8/8
    8/4P3/6q1/k1K5/2B5/8/8/8  3k4/KP1q4/3B4/8/8/8/8/8  8/3K1P2/1k2Bq2/8/8/8/8/8
    3K4/2P5/2B2k2/8/1q6/8/8/8 8/1P1K4/1qB2k2/8/8/8/8/8 1k6/3K1P2/4Bq2/8/8/8/8/8
    5k2/1P1K4/1qB5/8/8/8/8/8
  } 0 {}
}

set tbs(kbpkr) {
  440 45 ? 39 ?
  30.9 67.3 1.8 23.4 73.1 3.5
  306 4 {} 302 {} 0 {}
}

set tbs(kbpkb) {
  564 51 ? 3 ?
  41.3 58.7 0.0 0.0 86.9 13.1
  160 160 {} 0 {} 0 {}
}

set tbs(kbpkn) {
  449 105 ? 8 ?
  53.7 46.3 0.0 0.0 76.4 23.6
  2125 2112 {} 13 {} 0 {}
}

set tbs(kbpkp) {
  1437 67 ? 51 ?
  86.4 9.5 4.1 16.7 24.1 59.2
  406 403 {} 2 {} 1 {8/8/8/8/8/k1p5/2P5/1BK5}
}

set tbs(knnkq) {
  4 1 {k1N5/2K5/8/3N4/8/5q2/8/8} 72 ?
  0.0 42.8 57.1 94.0 6.0 0.0
  229 0 {} 229 {} 0 {}
}

set tbs(knnkr) {
  16 3 {5r1k/8/7K/4N3/5N2/8/8/8} 41 {8/8/1r4N1/4kN2/8/8/8/4K3}
  0.0 99.6 0.4 6.3 93.7 0.0
  25 0 {} 25 {} 0 {}
}

set tbs(knnkb) {
  2 4 {7k/5K2/8/8/5NN1/8/8/2b5} 1 {8/8/8/8/8/8/N1k5/K1b4N}
  0.0 100.0 0.0 0.0 100.0 0.0
  0
}

set tbs(knnkn) {
  9 7 {7n/8/8/8/1N1KN3/8/8/k7} 1 {K7/N1k5/8/3n4/3N4/8/8/8}
  0.1 99.9 0.0 0.0 100.0 0.0
  362 362 {} 0 {} 0 {}
}

set tbs(knnkp) {
  70 115 ? 74 ?
  31.3 66.4 2.3 12.8 73.6 13.6
  3143 3124 {} 19 {} 0 {}
}

set tbs(knpkq) {
  131 41 ? 55 ?
  17.9 11.9 70.2 97.2 2.3 0.5
  52 0 {} 52 {} 0 {}
}

set tbs(knpkr) {
  424 44 ? 67 ?
  26.7 69.3 4.0 29.3 68.5 2.2
  1181 23 {} 1158 {} 0 {}
}

set tbs(knpkb) {
  740 43 ? 9 ?
  38.8 61.2 0.0 0.0 88.1 11.9
  642 640 {} 2 {} 0 {}
}

set tbs(knpkn) {
  773 97 ? 7 ?
  49.2 50.8 0.0 0.0 77.2 22.8
  4191 4128 {} 63 {} 0 {}
}

set tbs(knpkp) {
  1399 57 ? 58 ?
  78.3 13.6 8.1 21.8 27.6 50.6
  2303 2281 {} 14 {} 8 {
    8/8/8/8/3K4/NkpP4/8/8   8/8/8/8/3K4/3PpkN1/8/8 8/8/8/8/8/1k2p3/4P3/KN6
    8/8/8/8/8/2K5/2PpkN2/8  8/8/8/8/8/3K4/3PpkN1/8 8/8/8/8/8/3K4/NkpP4/8
    8/8/8/8/1p6/1P6/K7/N1k5 8/8/8/8/8/1K6/1PpkN3/8
  }
}

set tbs(kppkq) {
  713 124 {8/5P2/8/8/3K4/3P3q/7k/8} 41 {8/2KP2q1/8/2P5/5k2/8/8/8}
  16.0 12.6 71.4 98.4 1.5 0.1
  2 0 {} 2 {8/2KP3q/2P2k2/8/8/8/8/8 8/2KP3q/8/2P3k1/8/8/8/8} 0 {}
}

set tbs(kppkr) {
  1675 54 {3K4/8/8/4P3/8/2r5/5P2/2k5} 40 {8/8/8/7K/5P2/3Pr3/8/2k5}
  35.4 20.1 44.5 75.2 18.2 6.6
  119 18 {} 99 {} 2 {1r1k4/1P6/1PK5/8/8/8/8/8 8/8/8/8/k7/r1P5/1KP5/8}
}

set tbs(kppkb) {
  522 43 {8/6P1/7k/8/6P1/1K6/8/1b6} 4 {K5b1/P7/1k6/8/8/8/2P5/8}
  54.4 45.6 0.0 0.0 75.4 24.6
  212 211 {} 1 {8/8/8/8/8/b2k4/P2P4/1K6} 0 {}
}

set tbs(kppkn) {
  703 50 {3n4/5P2/8/8/3K2P1/8/k7/8} 17 {7K/8/4k2P/8/8/8/5P2/5n2}
  64.7 35.3 0.0 0.0 62.4 37.6
  1077 920 {} 157 {} 0 {}
}

set tbs(kppkp) {
  5096 127 {8/8/8/8/1p2P3/1k1KP3/8/8} 43 {7K/8/4P3/5P2/3k4/7p/8/8}
  77.1 10.3 12.6 27.7 19.1 53.2
  4237 4179 {} 52 {} 6 {
    8/8/8/8/2k5/K1p5/P3P3/8   8/8/8/8/3k4/1K1p4/1P3P2/8
    8/8/8/8/4k3/2K1p3/2P3P1/8 8/8/8/2k5/K1p5/P3P3/8/8
    8/8/8/8/5k2/3K1p2/3P3P/8  8/8/8/k7/p1K5/2P5/2P5/8
  }
}

set tbs(kqppk) {
  68 9 ? 0 -
  100.0 0.0 0.0 0.0 0.7 99.3
}

set tbs(krppk) {
  119 15 ? 0 -
  100.0 0.0 0.0 0.0 0.2 98.8
  0
}

set tbs(kbppk) {
  91 25 ? 0 -
  99.8 0.2 0.0 0.0 1.3 98.7
  6 6 {
    8/B1k5/K7/P7/P7/8/8/8 K7/8/1k6/1P6/BP6/8/8/8 K7/8/Bk6/1P6/1P6/8/8/8
    KBk5/P1P5/8/8/8/8/8/8 kB6/8/1PK5/1P6/8/8/8/8 kB6/8/KP6/1P6/8/8/8/8
  } 0 {} 0 {}
}

set tbs(knppk) {
  96 32 ? 0 -
  100.0 0.0 0.0 0.0 1.0 99.0
  93 93 {} 0 {} 0 {}
}

set tbs(kpppk) {
  98 33 {7K/5k2/8/8/1P6/1P6/1P6/8} 0 -
  99.9 0.1 0.0 0.0 0.6 99.4
  11 11 {
    1k6/1P6/K7/P7/P7/8/8/8  1k6/1P6/K7/PP6/8/8/8/8  2k5/2P5/3K4/P7/P7/8/8/8
    8/1k6/1P6/KP6/1P6/8/8/8 8/8/1k6/1P6/KP6/1P6/8/8 8/8/8/1k1P4/8/PK6/P7/8
    8/8/8/1k6/1P6/KP6/1P6/8 8/K1k5/P1P5/P7/8/8/8/8  K1k5/2P5/P1P5/8/8/8/8/8
    K1k5/8/P1P5/P7/8/8/8/8  k7/8/KP6/PP6/8/8/8/8
  } 0 {} 0 {}
}

# End of file: tb.tcl

# end.tcl: part of Scid.
# Copyright (C) 2001 Shane Hudson.

############################################################
### Main window title, etc:


# updateTitle:
#   Updates the main Scid window title.
#
proc updateTitle {} {
  set title "Scid [sc_info version]: "
  set fname [sc_base filename]
  set fname [file tail $fname]
  append title "$fname ($::tr(game) "
  append title "[thousands [sc_game number]] / "
  append title "[thousands [sc_base numGames]])"
  wm title . $title
}

# filterText: returns text describing state of filter for specified
#   database, e.g. "no games" or "all / 400" or "1,043 / 2,057"
#
proc filterText {{base 0} {kilo 0}} {
  # Default to current base if no base specified:
  if {$base == 0} { set base [sc_base current] }
  set filterCount [sc_filter count $base]
  set gameCount [sc_base numGames $base]
  if {$gameCount == 0} { return $::tr(noGames) }
  if {$gameCount == $filterCount} {
    return "$::tr(all) / [thousands $gameCount $kilo]"
  }
  return "[thousands $filterCount $kilo] / [thousands $gameCount $kilo]"
}

# updateStatusBar:
#   Updates the main Scid window status bar.
#
proc updateStatusBar {} {
  global statusBar moveEntry
  updateBaseWin
  updateMaintWin
  set statusBar "  "

  if {$moveEntry(Text) != ""} {
    append statusBar "Enter move: \[" $moveEntry(Text) "\]  "
    foreach thisMove $moveEntry(List) {
      append statusBar $thisMove " "
    }
    return
  }

  # Check if translations have not been set up yet:
  if {! [info exists ::tr(Database)]} { return }

  # Show "%%" if base is read-only, "XX" if game altered, "--" otherwise:
  if {[sc_base isReadOnly]} {
    append statusBar "%%"
  } elseif {[sc_game altered]} {
    append statusBar "XX"
  } else {
    append statusBar "--"
  }
  append statusBar "  $::tr(Database) "
  append statusBar [sc_base current]
  append statusBar ": "
  set fname [sc_base filename]
  set fname [file tail $fname]
  if {$fname == ""} { set fname "<none>" }
  append statusBar $fname

  # Show filter count:
  append statusBar "   $::tr(Filter)"
  append statusBar ": [filterText]"
}


############################################################
### Menu/etc Functions:

# fileExit:
#    Prompt for confirmation then exit.
#
proc fileExit {}  {
  # Check for altered game in all bases except the clipbase:
  set unsavedCount 0
  set savedBase [sc_base current]
  set msg ""
  set nbases [sc_base count total]
  for {set i 1} {$i < [sc_base count total]} {incr i} {
    sc_base switch $i
    if {[sc_base inUse] && [sc_game altered] && ![sc_base isReadOnly]} {
      if {$unsavedCount == 0} {
        append msg $::tr(ExitUnsaved)
        append msg "\n\n"
      }
      incr unsavedCount
      set fname [file tail [sc_base filename]]
      set g [sc_game number]
      append msg "   Base $i: $fname "
      append msg "($::tr(game) $g)"
      append msg "\n"
    }
  }
  # Switch back to original database:
  sc_base switch $savedBase

  if {$msg != ""} {
    append msg "\n"
  }
  append msg $::tr(ExitDialog)

  set answer [tk_dialog .exitDialog "Scid: [tr FileExit]" \
                $msg "" 0 $::tr(Yes) $::tr(No)]
  if {$answer == 0} { 
    if {$::optionsAutoSave} { .menu.options invoke [tr OptionsSave] }
    ::recentFiles::save
    destroy . 
  }
}

proc fastExit {} {
  if {$::optionsAutoSave} { .menu.options invoke [tr OptionsSave] }
  ::recentFiles::save
  destroy . 
}

# fileNew:
#   Opens file-save dialog and creates a new database.
#
proc fileNew {} {
  if {[sc_base count free] == 0} {
    tk_messageBox -title "Scid" -type ok -icon info \
      -message "Too many databases open; close one first"
    return
  }
  set ftype { 
    { "Scid databases, EPD files" {".si3" ".epd"} }
    { "Scid databases" {".si3"} }
    { "EPD files" {".epd"} }
  }
  set fName [tk_getSaveFile -initialdir $::initialDir(base) -filetypes $ftype -title "Create a Scid database"]
  if {$fName == ""} {
    # do nothing
  } elseif {[file extension $fName] == ".epd"} {
    newEpdWin create $fName
    return
  } else {
    set fName [file rootname $fName]
    if {[catch {sc_base create $fName} result]} {
      tk_messageBox -icon warning -type ok -parent . \
        -title "Scid: Unable to create base" -message $result
    }
  }
  updateGList
  ::tree::refresh
  updateMenuStates
  updateTitle
  updateStatusBar
}

# fileOpen:
#    Opens file-open dialog and opens the selected Scid database.
#
proc fileOpen {{fName ""}} {
  global glstart
  if {[sc_base count free] == 0} {
    tk_messageBox -type ok -icon info -title "Scid" \
      -message "Too many databases are open; close one first"
    return
  }

  if {[sc_info gzip]} {
    set ftype {
      { "All Scid files" {".si3" ".si" ".pgn" ".pgn.gz" ".epd" ".epd.gz" ".sor"} }
      { "Scid databases, PGN files" {".si3" ".si" ".pgn" ".PGN" ".pgn.gz"} }
      { "Scid databases" {".si3" ".si"} }
      { "PGN files" {".pgn" ".PGN" ".pgn.gz"} }
      { "EPD files" {".epd" ".EPD" ".epd.gz"} }
      { "Repertoire files" {".sor"} }
    }
  } else {
    set ftype {
      { "All Scid files" {".si3" ".si" ".pgn" ".epd" ".sor"} }
      { "Scid databases, PGN files" {".si3" ".si" ".pgn" ".PGN"} }
      { "Scid databases" {".si3" ".si"} }
      { "PGN files" {".pgn" ".PGN"} }
      { "EPD files" {".epd" ".EPD"} }
      { "Repertoire files" {".sor"} }
    }
  }
  if {$fName == ""} {
    set fName [tk_getOpenFile -initialdir $::initialDir(base) -filetypes $ftype -title "Open a Scid file"]
    if {$fName == ""} { return }
  }

  if {[file extension $fName] == ""} {
    set fName "$fName.si3"
  }

  if {[file extension $fName] == ".sor"} {
    if {[catch {::rep::openWithFile $fName} err]} {
      tk_messageBox -parent . -type ok -icon info -title "Scid" \
        -message "Unable to open \"$fName\": $err"
    }
    return
  }

  if {[file extension $fName] == ".si"} {
    fileUpgrade [file rootname $fName]
    return
  }

  set err 0
  busyCursor .
  if {[file extension $fName] == ".si3"} {
    set fName [file rootname $fName]
    if {[catch {openBase $fName} result]} {
      set err 1
      tk_messageBox -icon warning -type ok -parent . \
        -title "Scid: Error opening file" -message $result
    } else {
      set ::initialDir(base) [file dirname $fName]
      ::recentFiles::add "$fName.si3"
    }
  } elseif {[regexp {\.epd} [string tolower $fName]]} {
    # EPD file:
    newEpdWin open $fName
  } else {
    # PGN file:
    set result "This file is not readable."
    if {(![file readable $fName])  || \
          [catch {sc_base create $fName true} result]} {
      set err 1
      tk_messageBox -icon warning -type ok -parent . \
        -title "Scid: Error opening file" -message $result
    } else {
      doPgnFileImport $fName "Opening [file tail $fName] read-only...\n"
      sc_base type [sc_base current] 3
      ::recentFiles::add $fName
    }
  }

  if {$err == 0} { catch {sc_game load auto} }
  unbusyCursor .
  set glstart 1
  updateGList
  ::tree::refresh
  updateStatsWin
  updateMenuStates
  updateBoardAndPgn
  updateTitle
  updateStatusBar
}

# fileUpgrade:
#   Upgrades an old (version 2) Scid database to version 3.
#
proc fileUpgrade {name} {
  if {[file readable "$name.si3"]} {
    set msg [string trim $::tr(ConfirmOpenNew)]
    set res [tk_messageBox -title "Scid" -type yesno -icon info -message $msg]
    if {$res == "no"} { return }
    fileOpen "$name.si3"
    return
  }

  set msg [string trim $::tr(ConfirmUpgrade)]
  set res [tk_messageBox -title "Scid" -type yesno -icon info -message $msg]
  if {$res == "no"} { return }
  progressWindow "Scid" "$::tr(Upgrading): [file tail $name]..."\
    $::tr(Cancel) "sc_progressBar"
  busyCursor .
  update
  set err [catch {sc_base upgrade $name} res]
  unbusyCursor .
  closeProgressWindow
  if {$err} {
    tk_messageBox -title "Scid" -type ok -icon warning \
      -message "Unable to upgrade the database:\n$res"
    return
  }
  fileOpen "$name.si3"
}

# openBase:
#    Opens a Scid database, showing a progress bar in a separate window
#    if the database is around 1 Mb or larger in size.
#
proc openBase {name} {
  set bsize 0
  set gfile "[file rootname $name].sg3"
  if {! [catch {file size $gfile} err]} { set bsize $err }
  set showProgress 0
  if {$bsize > 1000000} { set showProgress 1 }
  if {$showProgress} {
    progressWindow "Scid" "$::tr(OpeningTheDatabase): [file tail $name]..."
  }
  set err [catch {sc_base open $name} result]
  if {$showProgress} { closeProgressWindow }
  if {$err} { return -code error $result }
  return $result
}


# fileClose:
#   Closes the active base.
#
proc fileClose {} {
  if {[sc_base inUse]} {
    if ![confirmDiscardGame] { return }
    sc_base close
    updateGList
    # Close Tree and Email windows whenever a base is closed/switched:
    #if {[winfo exists .treeWin]} { destroy .treeWin }
    if {[winfo exists .emailWin]} { destroy .emailWin }
    updatePgnWin
    updateBoard
  }
  updateMenuStates
  updateStatusBar
  updateTitle
}


# confirmDiscardGame:
#   Prompts the user if they want to discard the changes to the
#   current game. Returns 1 if they selected yes, 0 otherwise.
#
proc confirmDiscardGame {} {
  if {$::trialMode} { return 1 }
  if {[sc_base isReadOnly]} { return 1 }
  if {! [sc_game altered]} { return 1 }
  set answer [ tk_dialog .cgDialog "Scid: [tr GameNew]" \
                 $::tr(ClearGameDialog) "" 0 $::tr(Yes) $::tr(No) ]
  if {$answer == 1} { return  0 }
  return 1
}

# gameClear:
#   Clears the active game, checking first if it is altered.
#   Updates any affected windows.
#
proc gameClear {} {
  if {![confirmDiscardGame]} { return }
  setTrialMode 0
  sc_game new
  updateBoardAndPgn
  updateTitle
  updateMenuStates
}

# gameStrip:
#   Strips all comments or variations from a game
#
proc gameStrip {type} {
  if {[catch {sc_game strip $type} result]} {
    tk_messageBox -parent . -type ok -icon info -title "Scid" -message $result
    return
  }
  updateBoardAndPgn
  updateTitle
}

# gameLoadNextPrev:
#   Loads the next or previous filtered game in the database.
#   The parameter <action> should be "previous" or "next".
#
proc gameLoadNextPrev {action} {
  global pgnWin statusBar
  if {![sc_base inUse]} {
    set statusBar "  There is no $action game: this is an empty database."
    return
  }
  set number [sc_filter $action]
  if {$number == 0} {
    set statusBar "  There is no $action game in the current filter."
    return
  }
  if {![confirmDiscardGame]} { return }
  setTrialMode 0
  sc_game load $number
  updateBoardAndPgn
  updateGList
  updateTitle
}

# gameReload:
#   Reloads the current game.
#
proc gameReload {} {
  if ![sc_base inUse] { return }
  if {[sc_game number] < 1} { return }
  if {![confirmDiscardGame]} { return }
  setTrialMode 0
  sc_game load [sc_game number]
  updateBoardAndPgn
  updateGList
  updateTitle
}

# gameLoadRandom:
#   Loads a random game from the database.
#
proc gameLoadRandom {} {
  set ngames [sc_filter size]
  if {$ngames == 0} { return }
  set r [expr (int (rand() * $ngames)) + 1 ]
  set gnum [sc_filter index $r]
  if {[catch {sc_game load $gnum} result]} {
    tk_messageBox -type ok -icon info -title "Scid" -message $result
  }
  updateBoardAndPgn
  updateGList
  updateTitle
}


# gameLoadNumber:
#    Prompts for the number of the game to load
set glEntryNumber ""
trace variable glEntryNumber w {forceRegexp {^[0-9]*$}}

proc gameLoadNumber {} {
  global glEntryNumber
  set glEntryNumber ""
  if {![sc_base inUse]} { return }
  if {[sc_base numGames] < 1} { return }
  set w [toplevel .glnumDialog]
  wm title $w "Scid: [tr GameNumber]"
  grab $w

  label $w.label -text $::tr(LoadGameNumber)
  pack $w.label -side top -pady 5 -padx 5

  entry $w.entry -background white -width 10 -textvariable glEntryNumber
  bind $w.entry <Escape> { .glnumDialog.buttons.cancel invoke }
  bind $w.entry <Return> { .glnumDialog.buttons.load invoke }
  pack $w.entry -side top -pady 5

  set b [frame $w.buttons]
  pack $b -side top -fill x
  button $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .glnumDialog
    destroy .glnumDialog
    focus .
  }
  button $b.load -text "OK" -command {
    grab release .glnumDialog
    if {[catch {sc_game load $glEntryNumber} result]} {
      tk_messageBox -type ok -icon info -title "Scid" -message $result
    }
    focus .
    destroy .glnumDialog
    updateBoardAndPgn
    updateGList
    updateTitle
  }
  pack $b.cancel $b.load -side right -padx 5 -pady 5

  set x [ expr [winfo width .] / 4 + [winfo rootx .] ]
  set y [ expr [winfo height .] / 4 + [winfo rooty .] ]
  wm geometry $w "+$x+$y"

  focus $w.entry
}

# gameLoad:
#   Loads a specified game from the active database.
#
proc gameLoad { selection } {
  # If an invalid game number, just return:
  if {$selection < 1} { return }
  if {$selection > [sc_base numGames]} { return }
  setTrialMode 0
  sc_game load $selection
  updateBoardAndPgn
  updateGList
  updateTitle
}

# gameLoadMenu:
#   Produces a popup dialog for loading a game or other actions
#   such as merging it into the current game.
#
proc gameLoadMenu {w base gnum x y} {
  set m $w.gLoadMenu
  if {! [winfo exists $m]} {
    menu $m
    $m add command -label $::tr(BrowseGame)
    $m add command -label $::tr(LoadGame)
    $m add command -label $::tr(MergeGame)
  }
  $m entryconfigure 0 -command "::gbrowser::new $base $gnum"
  $m entryconfigure 1 -command "sc_base switch $base; gameLoad $gnum"
  $m entryconfigure 2 -command "mergeGame $base $gnum"
  event generate $w <ButtonRelease-1>
  $m post $x $y
  event generate $m <ButtonPress-1>
}

# gotoMoveNumber:
#    Prompts for the move number to go to in the current game.
set moveEntryNumber ""
trace variable moveEntryNumber w {forceRegexp {^[0-9]*$}}

proc gotoMoveNumber {} {
  global moveEntryNumber
  set moveEntryNumber ""
  set w [toplevel .mnumDialog]
  wm title $w "Scid: [tr GameGotoMove]"
  grab $w

  label $w.label -text $::tr(GotoMoveNumber)
  pack $w.label -side top -pady 5 -padx 5

  entry $w.entry -background white -width 10 -textvariable moveEntryNumber
  bind $w.entry <Escape> { .mnumDialog.buttons.cancel invoke }
  bind $w.entry <Return> { .mnumDialog.buttons.load invoke }
  pack $w.entry -side top -pady 5

  set b [frame $w.buttons]
  pack $b -side top -fill x
  button $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .mnumDialog
    destroy .mnumDialog
    focus .
  }
  button $b.load -text "OK" -command {
    grab release .mnumDialog
    if {$moveEntryNumber > 0} {
      catch {sc_move ply [expr ($moveEntryNumber - 1) * 2]}
    }
    focus .
    destroy .mnumDialog
    updateBoardAndPgn
  }
  pack $b.cancel $b.load -side right -padx 5 -pady 5

  set x [ expr [winfo width .] / 4 + [winfo rootx .] ]
  set y [ expr [winfo height .] / 4 + [winfo rooty .] ]
  wm geometry $w "+$x+$y"

  focus $w.entry
}

# findNovelty:
#   Searches the for first position in the current game not
#   found in the selected database.

set noveltyOlder 0

proc findNovelty {} {
  global noveltyBase noveltyOlder
  set noveltyBase [sc_base current]
  set w .noveltyWin
  if {[winfo exists $w]} {
    updateNoveltyWin
    return
  }
  toplevel $w
  wm title $w "Scid: $::tr(FindNovelty)"

  pack [frame $w.help] -side top -fill x
  text $w.help.text -width 1 -height 5 -wrap word \
    -relief ridge -cursor top_left_arrow -yscrollcommand "$w.help.ybar set"
  scrollbar $w.help.ybar -orient vertical -command "$w.help.text yview" \
    -takefocus 0 -width 10
  pack $w.help.ybar -side right -fill y
  pack $w.help.text -side left -fill x -expand yes
  $w.help.text insert end [string trim $::tr(NoveltyHelp)]
  $w.help.text configure -state disabled

  label $w.title -text $::tr(Database:) -font font_Bold
  pack $w.title -side top
  set numBases [sc_base count total]
  for {set i 1} {$i <= $numBases} {incr i} {
    radiobutton $w.b$i -text "" -variable noveltyBase -value $i -underline 5
    pack $w.b$i -side top -anchor w -padx 10
  }
  addHorizontalRule $w

  label $w.which -text $::tr(TwinsWhich:) -font font_Bold
  pack $w.which -side top
  radiobutton $w.all -text $::tr(SelectAllGames) \
    -variable noveltyOlder -value 0
  radiobutton $w.older -text $::tr(SelectOlderGames) \
    -variable noveltyOlder -value 1
  pack $w.all $w.older -side top -anchor w -padx 10

  addHorizontalRule $w

  label $w.status -text "" -width 1 -font font_Small -relief sunken -anchor w
  pack $w.status -side bottom -fill x
  pack [frame $w.b] -side top -fill x
  button $w.b.stop -textvar ::tr(Stop) -state disabled \
    -command sc_progressBar
  button $w.b.go -text $::tr(FindNovelty) -command {
    .noveltyWin.b.stop configure -state normal
    .noveltyWin.b.go configure -state disabled
    .noveltyWin.b.close configure -state disabled
    busyCursor .
    .noveltyWin.status configure -text " ... "
    update
    grab .noveltyWin.b.stop
    if {$noveltyOlder} {
      set err [catch {sc_game novelty -older -updatelabel .noveltyWin.status $noveltyBase} result]
    } else {
      set err [catch {sc_game novelty -updatelabel .noveltyWin.status $noveltyBase} result]
    }
    grab release .noveltyWin.b.stop
    if {! $err} { set result "$::tr(Novelty): $result" }
    unbusyCursor .
    .noveltyWin.b.stop configure -state disabled
    .noveltyWin.b.go configure -state normal
    .noveltyWin.b.close configure -state normal
    .noveltyWin.status configure -text $result
    updateBoard
  }
  button $w.b.close -textvar ::tr(Close) -command {
    catch {destroy .noveltyWin}
  }
  pack $w.b.close $w.b.go $w.b.stop -side right -padx 5 -pady 2
  wm resizable $w 0 0
  focus $w.b.go
  bind $w <KeyPress-1> "$w.b1 invoke"
  bind $w <KeyPress-2> "$w.b2 invoke"
  bind $w <KeyPress-3> "$w.b3 invoke"
  bind $w <KeyPress-4> "$w.b4 invoke"
  updateNoveltyWin
}

proc updateNoveltyWin {} {
  set w .noveltyWin
  if {! [winfo exists $w]} { return }
  set numBases [sc_base count total]
  $w.older configure -text "$::tr(SelectOlderGames) (< [sc_game info date])"
  for {set i 1} {$i <= $numBases} {incr i} {
    set name [file tail [sc_base filename $i]]
    set ng [thousands [sc_base numGames $i]]
    set text "Base $i: $name ($ng $::tr(games))"
    $w.b$i configure -state normal -text $text
    if {$ng == 0} { $w.b$i configure -state disabled }
  }
}

set merge(ply) 40

# mergeGame:
#   Produces a dialog for the user to merge a selected game into
#   the current game.
#
proc mergeGame {{base 0} {gnum 0}} {
  global merge glNumber
  if {$base == 0} {
    if {$glNumber < 1} { return }
    if {$glNumber > [sc_base numGames]} { return }
    set base [sc_base current]
    set gnum $glNumber
  }
  sc_game push copy
  set err [catch {sc_game merge $base $gnum} result]
  sc_game pop
  if {$err} {
    tk_messageBox -title "Scid" -type ok -icon info \
      -message "Unable to merge the selected game:\n$result"
    return
  }
  set merge(base) $base
  set merge(gnum) $gnum
  set w .mergeDialog
  toplevel $w
  wm title $w "Scid: $::tr(MergeGame)"
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <F1> {helpWindow GameList Browsing}
  label $w.title -text $::tr(Preview:) -font font_Bold
  pack $w.title -side top
  pack [frame $w.b] -side bottom -fill x
  frame $w.f
  text $w.f.text -background white -wrap word -width 60 -height 20 \
    -font font_Small -yscrollcommand "$w.f.ybar set"
  scrollbar $w.f.ybar -takefocus 0 -command "$w.f.text yview"
  event generate $w.f.text <ButtonRelease-1>
  pack $w.f.ybar -side right -fill y
  pack $w.f.text -side left -fill both -expand yes
  pack $w.f -fill both -expand yes
  set small font_Small
  label $w.b.label -text "Up to move:" -font $small
  pack $w.b.label -side left
  foreach i {5 10 15 20 25 30 35 40} {
    radiobutton $w.b.m$i -text $i -variable merge(ply) -value [expr $i * 2] \
      -indicatoron 0 -padx 2 -pady 1 -font $small -command updateMergeGame
    pack $w.b.m$i -side left
  }
  radiobutton $w.b.all -text [capital $::tr(all)] \
    -variable merge(ply) -value 1000 -indicatoron 0 -padx 2 -pady 1 \
    -font $small -command updateMergeGame
  pack $w.b.all -side left
  button $w.b.ok -text "OK" -command {
    sc_game merge $merge(base) $merge(gnum) $merge(ply)
    catch {grab release .mergeDialog}
    destroy .mergeDialog
    updateBoardAndPgn
  }
  button $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 2
  grab $w
  updateMergeGame
}

proc updateMergeGame {args} {
  global merge
  set w .mergeDialog
  if {! [winfo exists $w]} { return }
  sc_game push copy
  sc_game merge $merge(base) $merge(gnum) $merge(ply)
  set pgn [sc_game pgn -indentV 1 -short 1 -width 60]
  sc_game pop
  $w.f.text configure -state normal
  $w.f.text tag configure red -foreground darkRed
  $w.f.text tag configure blue -foreground darkBlue
  $w.f.text delete 1.0 end
  foreach line [split $pgn "\n"] {
    if {[string index $line 0] == " "} {
      $w.f.text insert end $line blue
    } else {
      $w.f.text insert end $line
    }
    $w.f.text insert end "\n"
  }
  $w.f.text tag add red 1.0 4.0
  #$w.f.text insert end $pgn
  $w.f.text configure -state disabled
}

# setExportText:
#   Allows the user to modify the text printed at the start and end of a
#   file for a particular export format
#
proc setExportText {exportType} {
  global exportStartFile exportEndFile

  switch -- $exportType {
    "PGN" {
      set title "Set PGN file export text"
    }
    "HTML" {
      set title "Set HTML file export text"
    }
    "LaTeX" {
      set title "Set LaTeX file export text"
    }
    default {
      return
    }
  }

  set w .setExportText$exportType
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: $title"

  frame $w.buttons
  pack $w.buttons -side bottom -fill x -anchor e

  set pane [::pane::create $w.pane start end 500 400]
  ::pane::range $w.pane 0.3 0.7
  pack $pane -side top -expand true -fill both
  foreach f [list $pane.start $pane.end] type {start end} {
    label $f.title -font font_Bold -text "Text at $type of $exportType file:"
    text $f.text -wrap none -background white \
      -yscroll "$f.ybar set" -xscroll "$f.xbar set"
    scrollbar $f.ybar -orient vertical -command "$f.text yview"
    scrollbar $f.xbar -orient horizontal -command "$f.text xview"
    bind $f.text <FocusIn> {%W configure -background lightYellow}
    bind $f.text <FocusOut> {%W configure -background white}
    grid $f.title -row 0 -column 0 -sticky w
    grid $f.text -row 1 -column 0 -sticky nesw
    grid $f.ybar -row 1 -column 1 -sticky nesw
    grid $f.xbar -row 2 -column 0 -sticky nesw
    grid rowconfig $f 1 -weight 1 -minsize 0
    grid columnconfig $f 0 -weight 1 -minsize 0
  }

  $pane.start.text insert end $exportStartFile($exportType)
  $pane.end.text insert end $exportEndFile($exportType)

  button $w.buttons.default -text "Reset to Default" -command "
    $pane.start.text delete 1.0 end
    $pane.start.text insert end \$default_exportStartFile($exportType)
    $pane.end.text delete 1.0 end
    $pane.end.text insert end \$default_exportEndFile($exportType)
  "
  button $w.buttons.ok -text "OK" -command "
    set exportStartFile($exportType) \[$pane.start.text get 1.0 end-1c\]
    set exportEndFile($exportType) \[$pane.end.text get 1.0 end-1c\]
    focus .
    destroy $w
  "
  button $w.buttons.cancel -text "Cancel" -command "focus .; destroy $w"
  pack $w.buttons.default -side left -padx 5 -pady 2
  pack $w.buttons.cancel $w.buttons.ok -side right -padx 5 -pady 2
  focus $pane.start.text
}

image create photo htmldiag0 -data {
R0lGODdhbgBkAIAAAAAAAP///ywAAAAAbgBkAAAC/oyPqcvtD6OctNqLs968+w+G4kiW5omm
6moAgQu/ckzPdo3fes7vfv5wsYQtBFF2OCqNzCPrs4xEi0mQEyWcApxbqhfpvYa2ZCNZeQ4y
k122YgqGNs7oMtu+aH9f6XT1vydm5ddCyIenlkB3KAgnePFIJzm5yECkRVmpuPbokflpaLl2
eKeHCNcRCQo6F3e52qY3Gve04QhbJkvrGYQb+jbrB8sHaJPi25mnGItLvDmRnLwnCpH1luUb
WGwpLdUsIdaFHLtdHe09bM45Lkw9p4uRXfHKbseFntibnk9fT/4XDR6kb+BKsfrkrFuhc+b2
OYhh0J+1Z+8U6ltVMGIm/kaTpnnL95DgQzPpMC6RJtCCPArMOmqsNDFjq4YYq5lZGKokxZEc
Vtok5pIkwl2p0NXsZZDUsmH3fmpIuWxeUKEHy828yo0dT6p5sk3sZrGrP6dWx3kMCRKYykhE
xcpD1fWpxK1tOX4LK9OtVneuliKjAnEEIqkMA9UrgjctTokCY+4a29fvL6OM2ZabW3co1peH
rwVb3DmM5lpSRlV2DHryrGPFEidqShrS59azz2Zw/TTyF0e168aG1ps3bRG4bz8pvqmH8h/M
lztvDj0wVuG7g/sW3Bv48Orbr7Purky3eOpgkMsenxcuX/XHs3NzzzG8NsJQ38EnG2Uq+rWa
/s7bVrvfRtwBxhIlLHWnEHUCklegfumtpgx5AloHjYHAMTjdahbeB46D+EG4Hoj68YaXh3Sx
B9IVrADo3TUTHmjVTHA5pFuCR70G4oeSaYZiRTemyGJcw72lIWWj2TckjKLRKN5FKypZHj/B
iBQZWFS6g2GIVI3Wo15HApljFTMSlKWLP4oyo45L8himkxuq2eJ+nK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AIOn6qGhwShAGDU
EYyQbmghBr3gNXpYWArtRLwTTGxACeBdc4qjxO81w18ZMkavTqi3rlGjV8tJ/gFi3KZF/SRt
ExSQWTqUVar7bO4EDyhVBOVRKsrYBI1qtOInisOjg6zCXiWwjOBa4BGVpSqLfRyRHtuANfuQ
Ih2AZA5xDCmRgVDSBHzMRH1coZMI+c0MmcjhKdRFvOIED4j06CTW/nYHAcVAf2hi5QjmWIkH
lBJVK3hiOjrYAljuYpbj81AsQUmK5wwkJ5JkJEwGl68oCvOXZhgh7mRJCYdACYmE4B4KqhiY
GEBTBCfTIyQMB7iaeK864SHjGDwRNV0OBIY/gSYEzClNF6TOdnD4yEIeoE64xasn2kTBPdHV
hHp6Shr4tJNDMKTMYTLPOT3ZHTQQSlAMrGsGn8tH/hHXeKBVxkB26QgjDDLKKErRhaTSoqU2
PkmHiAzOna8ACEpLUKMYzDQOETgNQQZwGoOs7VUoqEBOC0SQBHAKniJJKE51Gsx7YbEXFiAq
cFYiArZMAyMUyFZPCsDLgzz1ElJdBQ2gOkfN/GIaKDhMr4DaKKw5hDT5EBmFoIJWL/KqV8iE
RuQwINcOHZFR50wPBg4glC2xDAAB3SsGAquTfKSBdKqJrGQ5RQK/hGOymFUNUqOxicdi9pWK
QEDicPBGIsCSE6PFwXUqwoALiCACbmrAJJrCJwq0tote/MFqxXBbhugsaRXsYiYz10QlALCU
OwPCImmwXLqk7blniy50waebXN1qTbgeHd5elfZQsN1Afg5NyPpOJ7UiGOh1/STudqWSIu/i
AL0Nrdz6WMgz815zitkVb2iD21331gCb4dXcfJlW3zAAWL77dYsZBunf/+KXpfr1GQ/rgNTy
LuHBARbKgInZ3wbDYBvDvS7ojsvhMJg4xNodMX8/12EPvwDFEQ7d0kqMgMQSzrwwFnCCZxy3
LDbXxfnVsYQD+Dn2PMK8M1GvihXcYyP/2MUIHjJF40veGy8hyjKecCYyKSUYhAAAOw==
}

# exportOptions:
#   Prompts the user to select exporting options.
#
proc exportOptions {exportType} {
  global exportFlags

  set w .exportFlagsWin
  set exportFlags(ok) -1
  toplevel $w
  wm title $w "Scid: [tr OptionsExport]"
  wm transient $w .
  wm protocol $w WM_DELETE_WINDOW { }
  bind $w <Escape> "$w.b.cancel invoke"
  bind $w <Return> "$w.b.ok invoke"

  pack [frame $w.o] -side top -fill x -pady 5 -padx 5
  label $w.o.append -text $::tr(AddToExistingFile)
  radiobutton $w.o.appendYes -text $::tr(Yes) \
    -variable exportFlags(append) -value 1
  radiobutton $w.o.appendNo -text $::tr(No) \
    -variable exportFlags(append) -value 0
  label $w.o.comments -text $::tr(ExportComments)
  radiobutton $w.o.commentsOn -text $::tr(Yes) \
    -variable exportFlags(comments) -value 1
  radiobutton $w.o.commentsOff -text $::tr(No) \
    -variable exportFlags(comments) -value 0
  label $w.o.stripMarks -text $::tr(ExportStripMarks)
  radiobutton $w.o.stripMarksOn -text $::tr(Yes) \
    -variable exportFlags(stripMarks) -value 1
  radiobutton $w.o.stripMarksOff -text $::tr(No) \
    -variable exportFlags(stripMarks) -value 0
  label $w.o.indentc -text $::tr(IndentComments)
  radiobutton $w.o.indentcOn -text $::tr(Yes) \
    -variable exportFlags(indentc) -value 1
  radiobutton $w.o.indentcOff -text $::tr(No) \
    -variable exportFlags(indentc) -value 0
  label $w.o.vars -text $::tr(ExportVariations)
  radiobutton $w.o.varsOn -text $::tr(Yes) -variable exportFlags(vars) -value 1
  radiobutton $w.o.varsOff -text $::tr(No) -variable exportFlags(vars) -value 0
  label $w.o.indentv -text $::tr(IndentVariations)
  radiobutton $w.o.indentvOn -text $::tr(Yes) \
    -variable exportFlags(indentv) -value 1
  radiobutton $w.o.indentvOff -text $::tr(No) \
    -variable exportFlags(indentv) -value 0
  label $w.o.column -text $::tr(ExportColumnStyle)
  radiobutton $w.o.columnOn -text $::tr(Yes) \
    -variable exportFlags(column) -value 1
  radiobutton $w.o.columnOff -text $::tr(No) \
    -variable exportFlags(column) -value 0
  label $w.o.symbols -text $::tr(ExportSymbolStyle)
  radiobutton $w.o.symbolsOn -text "! +=" \
    -variable exportFlags(symbols) -value 1
  radiobutton $w.o.symbolsOff -text {$2 $14} \
    -variable exportFlags(symbols) -value 0
  grid $w.o.append -row 0 -column 0 -sticky w
  grid $w.o.appendYes -row 0 -column 1 -sticky w
  grid $w.o.appendNo -row 0 -column 2 -sticky w
  grid $w.o.comments -row 1 -column 0 -sticky w
  grid $w.o.commentsOn -row 1 -column 1 -sticky w
  grid $w.o.commentsOff -row 1 -column 2 -sticky w
  grid $w.o.stripMarks -row 2 -column 0 -sticky w
  grid $w.o.stripMarksOn -row 2 -column 1 -sticky w
  grid $w.o.stripMarksOff -row 2 -column 2 -sticky w
  grid $w.o.indentc -row 3 -column 0 -sticky w
  grid $w.o.indentcOn -row 3 -column 1 -sticky w
  grid $w.o.indentcOff -row 3 -column 2 -sticky w
  grid $w.o.vars -row 4 -column 0 -sticky w
  grid $w.o.varsOn -row 4 -column 1 -sticky w
  grid $w.o.varsOff -row 4 -column 2 -sticky w
  grid $w.o.indentv -row 5 -column 0 -sticky w
  grid $w.o.indentvOn -row 5 -column 1 -sticky w
  grid $w.o.indentvOff -row 5 -column 2 -sticky w
  grid $w.o.column -row 6 -column 0 -sticky w
  grid $w.o.columnOn -row 6 -column 1 -sticky w
  grid $w.o.columnOff -row 6 -column 2 -sticky w
  grid $w.o.symbols -row 7 -column 0 -sticky w
  grid $w.o.symbolsOn -row 7 -column 1 -sticky w
  grid $w.o.symbolsOff -row 7 -column 2 -sticky w

  if {$exportType == "HTML"} {
    label $w.o.space -text ""
    label $w.o.hdiag -text "Diagram"
    radiobutton $w.o.hb0 -text "bitmaps" \
      -variable exportFlags(htmldiag) -value 0
    radiobutton $w.o.hb1 -text "bitmaps2" \
      -variable exportFlags(htmldiag) -value 1
    label $w.o.hl0 -image htmldiag0
    label $w.o.hl1 -image htmldiag1
    grid $w.o.space -row 8 -column 0
    grid $w.o.hdiag -row 9 -column 0 -sticky w
    grid $w.o.hb0 -row 9 -column 1 -sticky w
    grid $w.o.hb1 -row 9 -column 2 -sticky w
    grid $w.o.hl0 -row 10 -column 1
    grid $w.o.hl1 -row 10 -column 2
  }

  addHorizontalRule $w
  pack [frame $w.b] -side top
  button $w.b.ok -text "OK" -command {
    set exportFlags(ok) 1
  }
  button $w.b.cancel -text $::tr(Cancel) -command {
    set exportFlags(ok) 0
  }
  pack $w.b.ok $w.b.cancel -side left -padx 5 -pady 5

  wm withdraw $w
  update idletasks
  set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
                 - [winfo vrootx [winfo parent $w]]}]
  set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
                 - [winfo vrooty [winfo parent $w]]}]
  wm geom $w +$x+$y
  wm deiconify $w

  grab $w
  tkwait variable exportFlags(ok)
  grab release $w
  destroy $w
  return $exportFlags(ok)
}

# exportGames:
#   exports current game or all filtered games to a new PGN, LaTeX or Html file.
#
proc exportGames {selection exportType} {
  global pgnMoveNumSpace exportStartFile exportEndFile exportFlags
  set exportFilter 0
  if {$selection == "filter"} { set exportFilter 1 }
  if {$exportFilter} {
    # Check that we have some games to export:
    if {![sc_base inUse]} {
      tk_messageBox -title "Scid: Empty database" -type ok -icon info \
        -message "This is an empty database, there are no games to export."
      return
    }
    if {[sc_filter count] == 0} {
      tk_messageBox -title "Scid: Filter empty" -type ok -icon info \
        -message "The filter contains no games."
      return
    }
  }

  if {[exportOptions $exportType] == 0} { return }
  sc_info html $exportFlags(htmldiag)

  switch -- $exportType {
    "PGN" {
      set ftype {
        { "PGN files" {".pgn"} }
        { "All files" {"*"} }
      }
      set title "a PGN file"
      set idir $::initialDir(base)
      set default ".pgn"
    }
    "HTML" {
      set ftype {
        { "HTML files" {".html" ".htm"} }
        { "All files" {"*"} }
      }
      set title "an HTML file"
      set idir $::initialDir(html)
      set default ".html"
    }
    "LaTeX" {
      set ftype {
        { "LaTeX files" {".tex" ".ltx"} }
        { "All files" {"*"} }
      }
      set title "a LaTeX file"
      set idir $::initialDir(tex)
      set default ".tex"
    }
    default { return }
  }

  if {$exportFlags(append)} { 
    set getfile tk_getOpenFile 
    set title "Add games to $title"
  } else {
    set getfile tk_getSaveFile
    set title "Create $title"
  }
  set fName [$getfile -initialdir $idir -filetypes $ftype \
               -defaultextension $default -title $title]
  if {$fName == ""} { return }

  if {$exportFilter} {
    progressWindow "Scid" "Exporting games..." $::tr(Cancel) "sc_progressBar"
  }
  busyCursor .
  sc_base export $selection $exportType $fName -append $exportFlags(append) \
    -starttext $exportStartFile($exportType) \
    -endtext $exportEndFile($exportType) \
    -comments $exportFlags(comments) -variations $exportFlags(vars) \
    -space $pgnMoveNumSpace -symbols $exportFlags(symbols) \
    -indentC $exportFlags(indentc) -indentV $exportFlags(indentv) \
    -column $exportFlags(column) -noMarkCodes $exportFlags(stripMarks)
  unbusyCursor .
  if {$exportFilter} {
    closeProgressWindow
  }
}



proc copyFilter {frombaseNum tobaseNum} {
  # Check status of source and target bases:
  set currentBaseNum [sc_base current]
  sc_base switch $frombaseNum
  set nGamesToCopy [sc_filter count]
  set fromInUse [sc_base inUse]
  set fromName [file tail [sc_base filename]]
  sc_base switch $tobaseNum
  set targetInUse [sc_base inUse]
  set targetName [file tail [sc_base filename]]
  set targetReadOnly [sc_base isReadOnly]
  sc_base switch $currentBaseNum
  set err ""
  if {$nGamesToCopy == 0} {
    set err "$::tr(CopyErrSource) $::tr(CopyErrNoGames)."
  }
  if {$targetReadOnly} {
    set err "$::tr(CopyErrTarget) ($targetName) $::tr(CopyErrReadOnly)."
  }
  if {! $targetInUse} {set err "$::tr(CopyErrTarget) $::tr(CopyErrNotOpen)."}
  if {! $fromInUse} {set err "$::tr(CopyErrSource) $::tr(CopyErrNotOpen)."}
  if {$frombaseNum == $tobaseNum} {
    set err "$::tr(CopyErrSource) == $::tr(CopyErrTarget)."
  }

  if {$err != ""} {
    tk_messageBox -type ok -icon info -title "Scid" \
      -message "$::tr(CopyErr) \n\"$fromName\" -> \"$targetName\": \n$err"
    return
  }

  # If copying to the clipbase, do not bother asking for confirmation:
  if {$tobaseNum == [sc_info clipbase]} {
    progressWindow "Scid" "$::tr(CopyGames)..." $::tr(Cancel) "sc_progressBar"
    busyCursor .
    set copyErr [catch {sc_filter copy $frombaseNum $tobaseNum} result]
    unbusyCursor .
    closeProgressWindow
    if {$copyErr} {
      tk_messageBox -type ok -icon info -title "Scid" -message $result
    }
    return
  }

  set w [toplevel .fcopyWin]
  wm title $w "Scid: $::tr(CopyGames)"
  label $w.text -text [subst $::tr(CopyConfirm)]
  frame $w.b
  button $w.b.go -text $::tr(CopyGames) -command "
    busyCursor .
    $w.b.cancel configure -command \"sc_progressBar\"
    $w.b.cancel configure -text $::tr(Stop)
    sc_progressBar $w.bar bar 301 21 time
    grab $w.b.cancel
    if {\[catch {sc_filter copy $frombaseNum $tobaseNum} result\]} {
      tk_messageBox -type ok -icon info \
        -title \"Scid\" -message \$result
    }
    unbusyCursor .
    focus .
    destroy $w
    updateStatusBar
  "
  button $w.b.cancel -text $::tr(Cancel) -command "focus .; destroy $w"
  canvas $w.bar -width 300 -height 20 -bg white -relief solid -border 1
  $w.bar create rectangle 0 0 0 0 -fill blue -outline blue -tags bar
  $w.bar create text 295 10 -anchor e -font font_Regular -tags time \
    -fill black -text "0:00 / 0:00"

  pack $w.text $w.b -side top -pady 5
  pack $w.bar -side bottom
  pack $w.b.go $w.b.cancel -side left -padx 10 -pady 10
  grab $w
  bind $w <Return> "$w.b.go invoke"
  bind $w <Escape> "$w.b.cancel invoke"
  focus $w.b.go
}


###########################################################################
### Global variables used in gameSave:
set date 0; set year 0; set month 0; set day 0; set white 0; set black 0
set resultVal 0; set event 0; set site 0; set round 0
set whiteElo 0; set blackElo 0; set eco 0; set extraTags ""
set whiteRType "Elo"; set blackRType "Elo"
set edate 0; set eyear 0; set emonth 0; set eday 0

# Traces on game-save dialog variables to ensure sane values:

trace variable resultVal w  forceResult
trace variable whiteElo w {forceInt [sc_info limit elo] 0}
trace variable blackElo w {forceInt [sc_info limit elo] 0}
trace variable year w {forceInt [sc_info limit year] 1}
trace variable month w {forceInt 12 1}
trace variable day w {forceInt 31 1}
trace variable eyear w {forceInt [sc_info limit year] 1}
trace variable emonth w {forceInt 12 1}
trace variable eday w {forceInt 31 1}

set gsaveNum 0
set i 0; set j 0
set temp 0

array set nameMatches {}
set nameMatchCount 0

# updateMatchList:
#    Called from gameSave to update the matching name list as the user
#    types a player/site/event/round name.
#
proc updateMatchList { tw nametype maxMatches name el op } {
  global nameMatches nameMatchCount
  global $name editNameType
  if {![winfo exists $tw]} return

  if {$nametype == ""} { set nametype $editNameType }
  if {$nametype == "rating"} { set nametype "player" }
  set val [set $name]
  $tw configure -state normal
  $tw delete 0.0 end
  set matches {}
  catch {set matches [sc_name match $nametype $val $maxMatches]}
  set count [llength $matches]
  set nameMatchCount [expr $count / 2]
  for {set i 0} { $i < $count } {incr i 2} {
    set nameMatchCount [expr ($i / 2) + 1]
    set nameMatches($nameMatchCount) [lindex $matches [expr $i + 1]]
    set str "$nameMatchCount:\t[lindex $matches $i]\t$nameMatches($nameMatchCount)\n"
    $tw insert end $str
  }
  $tw configure -state disabled
}

proc clearMatchList { tw } {
  global nameMatches nameMatchCount
  set nameMatchCount 0
  $tw configure -state normal
  $tw delete 0.0 end
  $tw configure -state disabled
}

# Traces to update the match list as names are typed in:

trace variable event w { updateMatchList .save.g.list e 9 }
trace variable site  w { updateMatchList .save.g.list s 9 }
trace variable white w { updateMatchList .save.g.list p 9 }
trace variable black w { updateMatchList .save.g.list p 9 }
trace variable round w { updateMatchList .save.g.list r 9 }

set editName ""
set editNameNew ""
set editNameType "player"
set editNameSelect "all"
set editNameRating ""
set editNameRType "Elo"
set editDate ""
set editDateNew ""

trace variable editNameRating w {forceInt [sc_info limit elo] 0}
trace variable editName w { updateMatchList .nedit.g.list "" 9 }
trace variable editDate w forceDate
trace variable editDateNew w forceDate

proc editNameNewProc { tw nametype maxMatches name el op } {
  global editNameNew
  if {! [winfo exists .nedit]} { return } 
  if {[string compare $editNameNew ""]} {
    .nedit.buttons.replace configure -state normal
  } else {
    .nedit.buttons.replace configure -state disabled
  }
  catch {updateMatchList $tw $nametype $maxMatches $name $el $op}
}

trace variable editNameNew w { editNameNewProc .nedit.g.list "" 9 }


set nameEditorWin 0

proc makeNameEditor {} {
  if {! [winfo exists .nedit]} { nameEditor }
}

proc setNameEditorType {type} {
  if {! [winfo exists .nedit]} { return }
  catch {.nedit.typeButtons.$type invoke}
}

proc nameEditor {} {
  global editName editNameType editNameNew nameEditorWin editNameSelect
  global editNameRating editDate editDateNew

  set w .nedit
  if {[winfo exists $w]} {
    destroy $w
    return
  }
  toplevel $w
  wm title $w "Scid: [tr FileMaintNameEditor]"
  set nameEditorWin 1
  setWinLocation $w
  bind $w <Configure> "recordWinSize $w"

  label $w.typeLabel -textvar ::tr(NameEditType:) -font font_Bold
  frame $w.typeButtons
  pack $w.typeLabel $w.typeButtons -side top -pady 5
  foreach i { "Player" "Event" "Site" "Round"} {
    set j [string tolower $i]
    radiobutton $w.typeButtons.$j -textvar ::tr($i) -variable editNameType \
      -value $j -indicatoron false -pady 5 -padx 5 -command {
        grid remove .nedit.g.ratingE
        grid remove .nedit.g.rtype
        grid remove .nedit.g.fromD
        grid remove .nedit.g.toD
        grid .nedit.g.toL -row 1 -column 1 -sticky e
        grid .nedit.g.fromE -row 0 -column 2 -sticky w
        grid .nedit.g.toE -row 1 -column 2 -sticky w
      }
    pack $w.typeButtons.$j -side left -padx 5
  }
  radiobutton $w.typeButtons.rating -textvar ::tr(Rating) -variable editNameType \
    -value rating -indicatoron false -pady 5 -padx 5 -command {
      grid remove .nedit.g.toE
      grid remove .nedit.g.toL
      grid remove .nedit.g.fromD
      grid remove .nedit.g.toD
      grid .nedit.g.fromE -row 0 -column 2 -sticky w
      grid .nedit.g.rtype -row 1 -column 0 -columnspan 2 -sticky e
      grid .nedit.g.ratingE -row 1 -column 2 -sticky w
    }
  radiobutton $w.typeButtons.date -textvar ::tr(Date) -variable editNameType \
    -value date -indicatoron false -pady 5 -padx 5 -command {
      grid remove .nedit.g.toE
      grid remove .nedit.g.fromE
      grid remove .nedit.g.ratingE
      grid remove .nedit.g.rtype
      grid .nedit.g.fromD -row 0 -column 2 -sticky w
      grid .nedit.g.toL -row 1 -column 1 -sticky e
      grid .nedit.g.toD -row 1 -column 2 -sticky w
    }
  pack $w.typeButtons.rating $w.typeButtons.date -side left -padx 5

  addHorizontalRule .nedit

  label $w.selectLabel -textvar ::tr(NameEditSelect) -font font_Bold
  frame $w.selectButtons
  pack $w.selectLabel $w.selectButtons -side top -pady 5
  foreach i {all filter crosstable} row {0 1 2} text {
    SelectAllGames 
    SelectFilterGames 
    SelectTournamentGames
  } {
    radiobutton $w.selectButtons.$i -textvar ::tr($text) \
      -variable editNameSelect -value $i -pady 5 -padx 5 -indicatoron false
    grid $w.selectButtons.$i -row $row -column 0 -sticky we
  }

  addHorizontalRule $w

  pack [frame $w.g] -side top
  label $w.g.space -text "    "
  grid $w.g.space $w.g.space -row 0 -column 0
  label $w.g.fromL -textvar ::tr(NameEditReplace:) -font font_Bold -anchor e
  entry $w.g.fromE -width 40 -background white -relief sunken \
    -textvariable editName
  entry $w.g.fromD -width 15 -background white -relief sunken \
    -textvariable editDate
  grid $w.g.fromL -row 0 -column 1 -sticky e
  grid $w.g.fromE -row 0 -column 2 -sticky we

  label $w.g.toL -textvar ::tr(NameEditWith:) -font font_Bold -anchor e
  entry $w.g.toE -width 40 -background white -relief sunken \
    -textvariable editNameNew
  entry $w.g.toD -width 15 -background white -relief sunken \
    -textvariable editDateNew
  grid $w.g.toL -row 1 -column 1 -sticky e
  grid $w.g.toE -row 1 -column 2 -sticky we

  entry $w.g.ratingE -width 5 -background white -relief sunken \
    -textvariable editNameRating -justify right
  eval tk_optionMenu $w.g.rtype editNameRType [sc_info ratings]
  $w.g.rtype configure -pady 2

  label $w.g.title -textvar ::tr(NameEditMatches) \
    -font font_Bold
  text $w.g.list -height 9 -width 40 -relief sunken \
    -background grey90 -tabs {2c right 2.5c left} -wrap none

  label $w.g.padding -text ""
  grid $w.g.padding -row 2 -column 0

  grid $w.g.title -row 3 -column 1 -columnspan 2 -sticky n
  grid $w.g.list -row 4 -column 1 -rowspan 9 -columnspan 2 -sticky n

  updateMatchList $w.g.list "" 9 editName "" w

  foreach i {fromE toE ratingE fromD toD} {
    bind $w.g.$i <FocusIn> { %W configure -background lightYellow }
    bind $w.g.$i <FocusOut> { %W configure -background white }
  }
  foreach {i j} {.nedit.g.fromE "editName"  .nedit.g.toE "editNameNew" } {
    for {set z 1} {$z <= 9} {incr z} {
      bind $i [format "<Control-Key-%d>" $z] \
        [format "eval {if {\$nameMatchCount >= %d} { \
                         set %s \$nameMatches(%d)}}; break" $z $j $z ]
    }
  }

  addHorizontalRule $w

  frame $w.buttons
  button $w.buttons.replace -textvar ::tr(NameEditReplace) -command {
    if {$editNameType == "rating"} {
      set err [catch {sc_name edit $editNameType $editNameSelect $editName $editNameRating $editNameRType} result]
    } elseif {$editNameType == "date"} {
      set err [catch {sc_name edit $editNameType $editNameSelect $editDate $editDateNew} result]
    } else {
      set err [catch {sc_name edit $editNameType $editNameSelect $editName $editNameNew} result]
    }
    if {$err} {
      tk_messageBox -type ok -icon info -parent .nedit -title "Scid" \
        -message $result
    } else {
      .nedit.status configure -text $result
    }
    sc_game tags reload
    updateBoardAndPgn
    updateGList
  }

  button $w.buttons.cancel -textvar ::tr(Close) -command {focus .; destroy .nedit}
  pack $w.buttons -side top -pady 5
  pack $w.buttons.replace $w.buttons.cancel -side left -padx 10

  label $w.status -text "" -width 1 -font font_Small -relief sunken -anchor w
  pack $w.status -side bottom -fill x

  wm resizable $w 0 0
  bind $w <Escape> { focus .; destroy .nedit }
  bind $w <Return> {.nedit.buttons.replace invoke}
  bind $w <Destroy> {set nameEditorWin 0}
  bind $w <F1> {helpWindow Maintenance Editing}
  standardShortcuts $w
  focus $w
  $w.typeButtons.$editNameType invoke
}


# addGameSaveEntry:
#   used in gameSave for setting up the simpler labels and entry boxes.
#
proc addGameSaveEntry { name row textname } {
  label .save.g.${name}label -textvar $textname
  entry .save.g.${name}entry -width 30 -background white -relief sunken \
    -textvariable $name
  grid .save.g.${name}label -row $row -column 0 -sticky w
  grid .save.g.${name}entry -row $row -column 1 -columnspan 7 -sticky w
}

# gameSave:
#   The game save dialog. Used for adding and replacing games. If the
#   value gnum is zero, it is to add a new game; otherwise it is to
#   replace game number gnum.
#
proc gameSave { gnum } {
  global date year month day white black resultVal event site round
  global whiteElo blackElo whiteRType blackRType eco extraTags gsaveNum
  global edate eyear emonth eday

  if {![sc_base inUse]} {
    # We can't load a game, no database is open
    tk_messageBox -title "Scid: No database open" -type ok -icon info \
      -message "No database is open; open or create one first."
    return
  }

  # Make a new toplevel that contains the game save dialog:
  set w .save
  toplevel $w
  if {$gnum == 0} {
    wm title $w "Scid: [tr GameAdd]"
  } else {
    wm title $w "Scid: [tr GameReplace]"
  }
  set gsaveNum $gnum
  catch {grab $w}

  set f [frame $w.g]
  pack $f -side top

  label $f.title -textvar ::tr(NameEditMatches)
  text $f.list -height 9 -width 40 -relief sunken -background grey90 \
    -tabs {2c right 2.5c left} -wrap none

  # Get current values of tags:
  set year [sc_game tag get Year];    set eyear [sc_game tag get EYear]
  set month [sc_game tag get Month];  set emonth [sc_game tag get EMonth]
  set day [sc_game tag get Day];      set eday [sc_game tag get EDay]
  set white [sc_game tag get White];  set black [sc_game tag get Black]
  set event [sc_game tag get Event];  set site [sc_game tag get Site]
  set resultVal [sc_game tag get Result];  set round [sc_game tag get Round]
  set whiteElo [sc_game tag get WhiteElo]
  set blackElo [sc_game tag get BlackElo]
  set whiteRType [sc_game tag get WhiteRType]
  set blackRType [sc_game tag get BlackRType]
  set eco [sc_game tag get ECO];  set extraTags [sc_game tag get Extra]
  clearMatchList $f.list

  # Use question marks instead of zero values in date:
  if {$year == 0} { set year "????" }
  if {$month == 0} { set month "??" }
  if {$day == 0} { set day "??" }
  if {$eyear == 0} { set eyear "????" }
  if {$emonth == 0} { set emonth "??" }
  if {$eday == 0} { set eday "??" }

  addGameSaveEntry event 0 ::tr(Event:)
  addGameSaveEntry site 1 ::tr(Site:)

  frame $f.dateframe
  label $f.datelabel -textvar ::tr(Date:)
  entry $f.dateyear -width 6 -background white -relief sunken \
    -textvariable year -justify right
  label $f.datedot1 -text "."
  entry $f.datemonth -width 3 -background white -relief sunken \
    -textvariable month -justify right
  label $f.datedot2 -text "."
  entry $f.dateday -width 3 -background white -relief sunken \
    -textvariable day -justify right
  grid $f.datelabel -row 2 -column 0 -sticky w
  grid $f.dateframe -row 2 -column 1 -columnspan 5 -sticky w
  button $f.datechoose -image calendar -command {
    set newdate [::date::chooser "$year-$month-$day"]
    if {[llength $newdate] == 3} {
      set year [lindex $newdate 0]
      set month [lindex $newdate 1]
      set day [lindex $newdate 2]
    }
  }
  button $f.today -textvar ::tr(Today) -command {
    set year [::date::today year]
    set month [::date::today month]
    set day [::date::today day]
  }
  pack $f.dateyear $f.datedot1 $f.datemonth $f.datedot2 $f.dateday \
    -in $f.dateframe -side left
  if {$::tcl_version >= 8.3} {
    pack $f.datechoose -in $f.dateframe -side left
  }
  pack $f.today -in $f.dateframe -side left

  frame $f.edateframe
  label $f.edatelabel -textvar ::tr(EventDate:)
  entry $f.edateyear -width 6 -background white -relief sunken \
    -textvariable eyear -justify right
  label $f.edatedot1 -text "."
  entry $f.edatemonth -width 3 -background white -relief sunken \
    -textvariable emonth -justify right
  label $f.edatedot2 -text "."
  entry $f.edateday -width 3 -background white -relief sunken \
    -textvariable eday -justify right
  grid $f.edatelabel -row 3 -column 0 -sticky w
  grid $f.edateframe -row 3 -column 1 -columnspan 5 -sticky w
  button $f.edatechoose -image calendar -command {
    set newdate [::date::chooser "$eyear-$emonth-$eday"]
    if {[llength $newdate] == 3} {
      set eyear [lindex $newdate 0]
      set emonth [lindex $newdate 1]
      set eday [lindex $newdate 2]
    }
  }
  button $f.esame -text "=$::tr(Date)" -command {
    set eyear $year
    set emonth $month
    set eday $day
  }
  pack $f.edateyear $f.edatedot1 $f.edatemonth $f.edatedot2 $f.edateday \
    -in $f.edateframe -side left
  if {$::tcl_version >= 8.3} {
    pack $f.edatechoose -in $f.edateframe -side left
  }
  pack $f.esame -in $f.edateframe -side left

  addGameSaveEntry round 4 ::tr(Round:)
  addGameSaveEntry white 5 ::tr(White:)
  addGameSaveEntry black 6 ::tr(Black:)

  label $f.reslabel -textvar ::tr(Result:)
  entry $f.resentry -width 2 -background white -relief sunken \
    -textvariable resultVal
  label $f.rescomment -text "(1, =, 0, *)"
  grid $f.reslabel -row 7 -column 0 -sticky w
  grid $f.resentry -row 7 -column 1 -sticky w
  grid $f.rescomment -row 7 -column 2 -columnspan 4 -sticky w

  label $f.welolabel -text "$::tr(White) "
  eval tk_optionMenu $f.wrtype whiteRType [sc_info ratings]
  $f.wrtype configure -indicatoron 0 -width 7 -takefocus 1
  entry $f.weloentry -width 5 -background white -relief sunken \
    -textvariable whiteElo -justify right

  label $f.belolabel -text "$::tr(Black) "
  eval tk_optionMenu $f.brtype blackRType [sc_info ratings]
  $f.brtype configure -indicatoron 0 -width 7 -takefocus 1
  entry $f.beloentry -width 5 -background white -relief sunken \
    -textvariable blackElo -justify right

  grid $f.welolabel -row 8 -column 0 -sticky w
  grid $f.wrtype -row 8 -column 1 -sticky w
  grid $f.weloentry -row 8 -column 2 -sticky w
  grid $f.belolabel -row 9 -column 0 -sticky w
  grid $f.brtype -row 9 -column 1 -sticky w
  grid $f.beloentry -row 9 -column 2 -sticky w

  label $f.ecolabel -text "ECO Code:"
  entry $f.ecoentry -width 6 -background white -relief sunken \
    -textvariable eco
  grid $f.ecolabel -row 10 -column 0 -sticky w
  grid $f.ecoentry -row 10 -column 1 -sticky w

  button $f.ecob -textvar ::tr(ClassifyGame) -command {set eco [sc_eco game]}
  grid $f.ecob -row 10 -column 2 -sticky w

  grid $f.title -row 0 -column 8 -sticky n -padx 10
  grid $f.list -row 1 -column 8 -rowspan 9 -sticky nw -padx 10

  frame .save.bar -height 2 -borderwidth 1 -relief sunken
  pack .save.bar -fill x -pady 4

  label .save.extralabel -text \
    "Extra Tags: (example format: Annotator \"Anand, V\") "
  pack .save.extralabel -side top
  frame .save.extra
  text .save.extra.text -height 4 -width 40 -bg white -wrap none \
    -yscrollcommand ".save.extra.scroll set"
  # Override tab-binding for this text widget:
  bind .save.extra.text <Key-Tab> "[bind all <Key-Tab>]; break"
  scrollbar .save.extra.scroll -command ".save.extra.text yview" \
    -takefocus 0
  button .save.extra.last -text "Use\nlast\ngame's\ntags" -command {
    set extraTags [sc_game tag get -last Extra]
    .save.extra.text delete 1.0 end
    .save.extra.text insert 1.0 $extraTags
  }
  pack .save.extra -side top -ipady 10
  pack .save.extra.text -side left -fill both -expand 1
  if {$gnum == 0} {
    pack .save.extra.last -side right -padx 10
  }
  pack .save.extra.scroll -side right -fill y
  .save.extra.text insert 1.0 $extraTags

  foreach i {evententry siteentry dateyear datemonth dateday \
               roundentry whiteentry blackentry resentry \
               weloentry beloentry ecoentry edateyear edatemonth edateday} {
    bind $f.$i <FocusIn> {%W configure -background lightYellow }
    bind $f.$i <FocusOut> {%W configure -background white }
  }
  bind .save.extra.text <FocusIn> {%W configure -background lightYellow }
  bind .save.extra.text <FocusOut> {%W configure -background white }

  # Bindings so Ctrl-1 to Ctrl-9 select a matching name in the player,
  # site, event and round entryboxes:

  set j 0
  foreach {i j} {evententry "event" siteentry "site"
      whiteentry "white" blackentry "black"
      roundentry "round" } {
    for {set z 1} {$z <= 9} {incr z} {
      bind $f.$i [format "<Control-Key-%d>" $z] \
        [format "eval {if {\$nameMatchCount >= %d} \
                         {set %s \$nameMatches(%d)}}" $z $j $z ]
    }
  }

  frame .save.bar2 -height 2 -borderwidth 1 -relief sunken
  pack .save.bar2 -fill x -pady 10
  frame .save.buttons
  if {$gnum == 0} {
    button .save.buttons.prev -text "As last game" -command {
    }
  }
  button .save.buttons.save -textvar ::tr(Save) -underline 0 -command {
    set extraTags [.save.extra.text get 1.0 end-1c]
    gsave $gsaveNum;
    destroy .save
  }

  button .save.buttons.cancel -textvar ::tr(Cancel) -command {destroy .save}
  pack .save.buttons -side bottom -pady 10 -fill x
  if {$gnum == 0} {
    #pack .save.buttons.prev -side left -padx 10
  }
  pack .save.buttons.cancel .save.buttons.save -side right -padx 10

  bind .save <Alt-s> {
    set extraTags [.save.extra.text get 1.0 end-1c]
    gsave $gsaveNum;
    focus .
    destroy .save
    break
  }
  bind .save <Escape> { focus .; destroy .save; }
  focus .save
  if {$gnum > 0} { focus .save.buttons.save }
}

# gsave:
#    Called by gameSave when the user presses the "Save" button
#    to save the game. Attempts to save and reports the result.
#
proc gsave { gnum } {
  global date year month day white black resultVal event site round
  global whiteElo blackElo whiteRType blackRType eco extraTags
  global edate eyear emonth eday

  set date [format "%s.%s.%s" $year $month $day]
  set edate [format "%s.%s.%s" $eyear $emonth $eday]
  set extraTagsList [split $extraTags "\n"]
  sc_game tags set -event $event -site $site -date $date -round $round \
    -white $white -black $black -result $resultVal \
    -whiteElo $whiteElo -whiteRatingType $whiteRType \
    -blackElo $blackElo -blackRatingType $blackRType \
    -eco $eco -eventdate $edate -extra $extraTagsList
  set res [sc_game save $gnum]
  if {$res != ""} {
    tk_messageBox -type ok -icon info -parent .save \
      -title "Scid" -message $res
  }
  updateBoardAndPgn
  updateGList
  updateTitle
}

# gameAdd:
#   Calls gameSave with a game number of zero.
#
proc gameAdd {} { gameSave 0 }

# gameReplace:
#   Calls gameSave with the current game number, which should be nonzero.
#
proc gameReplace {} { gameSave [sc_game number] }


# helpAbout:
#    Displays information about Scid.
#
proc helpAbout {} {
  set str {}
  append str "Scid: Shane's chess information database\n\n"
  append str "Version [sc_info version], [sc_info version date]\n"
  append str "Using Tcl/Tk version: [info patchlevel]\n\n"
  append str "Author: Shane Hudson\n"
  append str "Email: shane@cosc.canterbury.ac.nz\n"
  append str "Website: scid.sourceforge.net\n\n"
  append str "Copyright (C) Shane Hudson 1999-2001.\n"
  append str "Scid is freeware, but you are welcome to make "
  append str "a small donation for it -- just email the author for details."
  set asserts [sc_info asserts]
  if {$asserts > 0} {
    append str "\n\n[thousands $asserts] asserts tested."
  }
  tk_messageBox -title "About Scid" -message $str -type ok
}


############################################################
# Keyboard move entry:
#   Handles letters, digits and BackSpace/Delete keys.
#   Note that king- and queen-side castling moves are denoted
#   "OK" and "OQ" respectively.
#   The letters n, r, q, k, o and l are promoted to uppercase
#   automatically. A "b" can match to a b-pawn or Bishop move,
#   so in some rare cases, a capital B may be needed for the
#   Bishop move to distinguish it from the pawn move.

set moveEntry(Text) ""
set moveEntry(List) {}

# Bind Alt+letter key to nothing, to stop Alt+letter from
# matching the move entry bindings, so Alt+letter ONLY invokes
# the menus:
foreach key {a b c d e f g h i j k l m n o p q r s t u v w x y z} {
  bind . <Alt-$key> { 
    # nothing
  }
}

proc moveEntry_Clear {} {
  global moveEntry
  set moveEntry(Text) ""
  set moveEntry(List) {}
}

proc moveEntry_Complete {} {
  global moveEntry
  set len [llength $moveEntry(List)]
  if {$len > 0} {
    if {$moveEntry(AutoExpand)} { bell }
    set move [lindex $moveEntry(List) 0]
    if {$move == "OK"} { set move "O-O" }
    if {$move == "OQ"} { set move "O-O-O" }
    set action "replace"
    if {![sc_pos isAt vend]} { set action [confirmReplaceMove] }
    if {$action == "replace"} {
      sc_move addSan $move
    } elseif {$action == "var"} {
      sc_var create
      sc_move addSan $move
    }
    moveEntry_Clear
    updateBoardAndPgn
    if {$action == "replace"} { ::tree::doTraining }
  }
}

proc moveEntry_Backspace {} {
  global moveEntry
  set moveEntry(Text) [string range $moveEntry(Text) 0 \
                         [expr [string length $moveEntry(Text)] - 2]]
  set moveEntry(List) [sc_pos matchMoves $moveEntry(Text) $moveEntry(Coord)]
  updateStatusBar
}

proc moveEntry_Char {ch} {
  global moveEntry
  set oldMoveText $moveEntry(Text)
  set oldMoveList $moveEntry(List)
  append moveEntry(Text) $ch
  set moveEntry(List) [sc_pos matchMoves $moveEntry(Text) $moveEntry(Coord)]
  set len [llength $moveEntry(List)]
  if {$len == 0} {
    # No matching moves, so do not accept this character as input:
    set moveEntry(Text) $oldMoveText
    set moveEntry(List) $oldMoveList
  } elseif {$len == 1} {
    # Exactly one matching move, so make it if AutoExpand is on,
    # or if it equals the move entered. Note the comparison is
    # case insensitive to allow for 'b' to match both pawn and
    # Bishop moves.
    set move [string tolower [lindex $moveEntry(List) 0]]

    if {$moveEntry(AutoExpand) > 0  ||
        ![string compare [string tolower $moveEntry(Text)] $move]} {
      moveEntry_Complete
    }
  } elseif {$len == 2} {
    # Check for the special case where the user has entered a b-pawn
    # capture that clashes with a Bishop move (e.g. bxc4 and Bxc4):
    set first [string tolower [lindex $moveEntry(List) 0]]
    set second [string tolower [lindex $moveEntry(List) 1]]
    if {[string equal $first $second]} {
        set moveEntry(List) [list $moveEntry(Text)]
        moveEntry_Complete
    }
  }
  updateStatusBar
}


# preMoveCommand: called before making a move to store text in the comment
#   editor window and EPD windows.
proc preMoveCommand {} {
  resetAnalysis
  storeComment
  storeEpdTexts
}

sc_info preMoveCmd preMoveCommand


############################################################
#### Square Bindings:

for {set i 0} { $i < 64 } { incr i } {
  ::board::bind .board $i <Enter> "enterSquare $i"
  ::board::bind .board $i <Leave> "leaveSquare $i"
  ::board::bind .board $i <ButtonPress-1> "pressSquare $i"
  ::board::bind .board $i <B1-Motion> "::board::dragPiece .board %X %Y"
  ::board::bind .board $i <ButtonRelease-1> "releaseSquare .board %X %Y"
  ::board::bind .board $i <ButtonPress-2> "pressSquare $i"
  ::board::bind .board $i <ButtonPress-3> backSquare
}

foreach i {o q r n k O Q R B N K} {
  bind . <$i> "moveEntry_Char [string toupper $i]"
}
foreach i {a b c d e f g h 1 2 3 4 5 6 7 8} {
  bind . <Key-$i> "moveEntry_Char $i"
}

bind . <Control-BackSpace> backSquare
bind . <Control-Delete> backSquare
bind . <BackSpace> moveEntry_Backspace
bind . <Delete> moveEntry_Backspace
bind . <space> moveEntry_Complete


###  Other Key bindings:

# Bindings for quick move annotation entry in the main window:

bind . <exclam><Return> "sc_pos addNag !; updateBoardAndPgn .board"
bind . <exclam><exclam><Return> "sc_pos addNag !!; updateBoardAndPgn .board"
bind . <exclam><question><Return> "sc_pos addNag !?; updateBoardAndPgn .board"
bind . <question><Return> "sc_pos addNag ?; updateBoardAndPgn .board"
bind . <question><question><Return> "sc_pos addNag ??; updateBoardAndPgn .board"
bind . <question><exclam><Return> "sc_pos addNag ?!; updateBoardAndPgn .board"

bind . <plus><minus> "sc_pos addNag +-; updateBoardAndPgn .board"
bind . <plus><slash> "sc_pos addNag +/-; updateBoardAndPgn .board"
bind . <plus><equal> "sc_pos addNag +=; updateBoardAndPgn .board"
bind . <equal><Return> "sc_pos addNag =; updateBoardAndPgn .board"
bind . <minus><plus> "sc_pos addNag -+; updateBoardAndPgn .board"
bind . <minus><slash> "sc_pos addNag -/+; updateBoardAndPgn .board"
bind . <equal><plus> "sc_pos addNag =+; updateBoardAndPgn .board"
# bind . <asciitilde><Return> "sc_pos addNag ~; updateBoardAndPgn .board"

# Arrow keys, Home and End:
bind . <Home> {if {!$tree(refresh)} {sc_move start; updateBoard .board}}
bind . <Up> {if {!$tree(refresh)} {sc_move back 10; updateBoard .board}}
bind . <Left> {if {!$tree(refresh)} {sc_move back; updateBoard .board}}
bind . <Down> {if {!$tree(refresh)} {sc_move forward 10; updateBoard .board}}
bind . <Right> {if {!$tree(refresh)} {sc_move forward; updateBoard .board}}
bind . <End> {if {!$tree(refresh)} {sc_move end; updateBoard .board}}

bind . <period> {if {!$tree(refresh)} {toggleRotateBoard}}


############################################################
### Packing the main window:

pack .button -side top -ipadx 0 -pady 3

label .statusbar -textvariable statusBar -relief sunken -anchor w -width 1 \
  -font font_Small
pack .statusbar -side bottom -fill x
bind .statusbar <1> gotoNextBase

proc gotoNextBase {} {
  set n [sc_base current]
  set cb [sc_info clipbase]
  while {1} {
    incr n; if {$n > $cb} { set n 1 }
    sc_base switch $n
    if {[sc_base inUse]} { break }
  }
  updateBoardAndPgn .board
  updateTitle
  updateMenuStates
  updateStatusBar
  updateGList
}

pack .board -side top -padx 5 -pady 5

pack .ginfoXbar -side bottom -fill x
pack .ginfoYbar -side right -fill y
pack .gameInfo -side bottom -fill both -expand yes

#setToolbar $showToolbar
redrawToolbar

wm resizable . 0 1
wm minsize . 0 0
wm iconname . "Scid"


#################
# Open files and databases:

# Check for arguments starting with "-" (or "/" on Windows):

set loadAtStart(spell) 1
set loadAtStart(eco) 1
set loadAtStart(tb) 1

proc getCommandLineOptions {} {
  global argc argv windowsOS loadAtStart
  while {$argc > 0} {
    set arg [lindex $argv 0]
    set firstChar [string index $arg 0]
    if {$firstChar == "-"  ||  ($windowsOS  &&  $firstChar == "/")} {
      # Seen option argument:
      incr argc -1
      set argv [lrange $argv 1 end]

      # Special argument "--" means no more options:
      if {$arg == "--"} { return }

      # Check for known option names:
      #   -f (/f), -fast (/fast): Fast start with no tablebases, etc.
      #   -xeco, -xe: Do not load ECO file.
      #   -xspell, -xs: Do not load spellcheck file.
      #   -xtb, -xt: Do not check tablebase directory.

      set argName [string range $arg 1 end]
      switch $argName {
        "f"    -
        "fast" {
          addSplash "Fast start: no tablebases, ECO or spelling file loaded."
          set loadAtStart(spell) 0
          set loadAtStart(eco) 0
          set loadAtStart(tb) 0
        }
        "xt" -
        "xtb" {
          set loadAtStart(tb) 0
        }
        "xe" -
        "xeco" {
          set loadAtStart(eco) 0
        }
        "xs" -
        "xspell" {
          set loadAtStart(spell) 0
        }
        "s1"  { set ::boardSize 21 }
        "s2"  { set ::boardSize 25 }
        "s3"  { set ::boardSize 29 }
        "s4"  { set ::boardSize 33 }
        "s5"  { set ::boardSize 37 }
        "s6"  { set ::boardSize 40 }
        "s7"  { set ::boardSize 45 }
        "s8"  { set ::boardSize 49 }
        "s9"  { set ::boardSize 54 }
        "s10" { set ::boardSize 58 }
        "s11" { set ::boardSize 64 }
        "s12" { set ::boardSize 72 }
        default {
          addSplash "Warning: unknown option: \"$arg\""
        }
      }
    } else {
      # Seen first non-option argument:
      return
    }
  }
}

getCommandLineOptions


setLanguage $language

updateTitle
updateBoard .board
updateStatusBar
update idle

# Try to find tablebases:
if {$loadAtStart(tb)} {
  if {[sc_info tb]} {
    addSplash "Checking for endgame tablebase files..."
    set tbDirs {}
    foreach i {1 2 3 4} {
      if {$initialDir(tablebase$i) != ""} {
        if {$tbDirs != ""} { append tbDirs ";" }
        append tbDirs $initialDir(tablebase$i)
      }
    }
    set result 0
    if {$tbDirs != ""} {
      set result [sc_info tb $tbDirs]
    }
    if {$result == 0} {
      addSplash "    No tablebases were found."
    } else {
      addSplash "    Tablebases with up to $result pieces were found."
    }
  }
}

# Try to open the ECO classification file:
set result 0
set ecoFile_fullname [file nativename $ecoFile]

if {$loadAtStart(eco)} {
  addSplash "Trying to load the ECO openings file..."
  if {[catch { sc_eco read $ecoFile_fullname } result]} {
    # Could not load, so try "scid.eco" in the current directory:
    if [catch {sc_eco read "scid.eco"} result] {
      # Neither attempt worked, so do not use ECO classification
      addSplash "    Unable to open the ECO file: $ecoFile"
    } else {
      addSplash "    ECO file \"./scid.eco\" loaded: $result positions."
    }
  } else {
    addSplash "    ECO file \"[file tail $ecoFile_fullname]\"  loaded: $result positions."
  }
}

###
# Try to load the spellcheck file:
if {$loadAtStart(spell)} {
  if {[catch {sc_name read $spellCheckFile} result]} {
    #addSplash "Unable to load the default spellcheck file: $spellCheckFile"
  } else {
    addSplash "Spellcheck file \"[file tail $spellCheckFile]\" loaded:"
    addSplash "    [lindex $result 0] players, [lindex $result 1] events, [lindex $result 2] sites, [lindex $result 3] rounds."
  }
}

# fullname:
#   Given a file name, returns its absolute name.
#
proc fullname {fname} {
  if {[file pathtype $fname] == "absolute"} { return $fname }
  set old [pwd]
  if {[catch {cd [file dirname $fname]}]} { return $fname }
  set fname [file join [pwd] [file tail $fname]]
  catch {cd $old}
  return $fname
}

# Loading a database if specified on the command line:
# Need to check file type: .epd, .pgn, .pgn.gz, etc

while {$argc > 0} {
  set startbase [fullname [lindex $argv 0]]
  if {! [catch {sc_game startBoard $startbase}]} {
    set argc 0
    break
  }
  if {! [catch {sc_game startBoard [join $argv " "]}]} {
    set argc 0
    break
  }
  if {[string match "*.epd*" $startbase]} {
    addSplash "Opening EPD file: $startbase..."
    if {![newEpdWin openSilent $startbase]} {
      addSplash "   Error opening EPD file: $startbase"
    }
    set initialDir(epd) [file dirname $startbase]
  } elseif {[string match "*.sor" $startbase]} {
    addSplash "Opening repertoire file: $startbase..."
    if {[catch {::rep::openWithFile $startbase} err]} {
      addSplash "Error opening $startbase: $err"
    }
  } else {
    busyCursor .
    addSplash "Opening database: $startbase ..."
    set err 0
    set errMessage ""
    if {[string match "*.pgn" $startbase] || \
        [string match "*.PGN" $startbase] || \
        [string match "*.pgn.gz" $startbase]} {
      set err [catch {sc_base create $startbase true} errMessage]
      if {$err == 0} {
        doPgnFileImport $startbase "\nOpening [file tail $startbase] read-only...\n"
        sc_base type [sc_base current] 3
        ::recentFiles::add $startbase
      }
    } else {
      set err [catch {openBase [file rootname $startbase]} errMessage]
      if {! $err} { ::recentFiles::add "[file rootname $startbase].si3" }
    }
    if {$err} {
      addSplash "   Error: could not open database \"$startbase\":\n  $errMessage"
    } else {
      addSplash "   Database \"$startbase\" opened: [sc_base numGames] games."
      set initialDir(base) [file dirname $startbase]
      catch {sc_game load auto}
    }
  }
  unbusyCursor .
  incr argc -1
  set argv [lrange $argv 1 end]
}

addSplash "\nStartup completed."
addSplash "Scid has over 35 online help pages; just press F1 for help!"
bind . <Configure> "recordWinSize ."
setWinLocation .
wm deiconify .
wm protocol . WM_DELETE_WINDOW { fileExit }

if {$startup(switcher)} { makeBaseWin }
if {$startup(pgn)} { makePgnWin }
if {$startup(gamelist)} { makeGList }
if {$startup(tree)} { ::tree::make }
if {$startup(stats)} { makeStatsWin }
if {$startup(crosstable)} { crosstabWin }
if {$startup(finder)} { fileFinder }


updateBoard .board
updateStatusBar
updateTitle
updateLocale
update

# Bindings to map/unmap all windows when main window is mapped:
bind .statusbar <Map> {showHideAllWindows deiconify}
bind .statusbar <Unmap> {showHideAllWindows iconify}

# showHideAllWindows:
#   Arranges for all major Scid windows to be shown/hidden
#   Should be called type = "iconify" or "deiconify"
#
proc showHideAllWindows {type} {
  # Don't do this if user option is off:
  if {! $::autoIconify} { return }

  # Some window managers like KDE generate Unmap events for other
  # situations like switching to another desktop, etc.
  # So if the main window is still mapped, do not iconify others:
  if {($type == "iconify")  && ([winfo ismapped .] == 1)} { return }

  # Now iconify/deiconify all the major Scid windows that exist:
  foreach w {.baseWin .glistWin .pgnWin .tourney .maintWin \
               .ecograph .crosstabWin .treeWin .analysisWin1 .anslysisWin2 \
               .playerInfoWin .commentWin .repWin .statsWin .tbWin \
               .sb .sh .sm .noveltyWin .emailWin .oprepWin \
               .rgraph .sgraph .importWin .helpWin .tipsWin} {
    if {[winfo exists $w]} { catch {wm $type $w} }
  }
}

if {$startup(tip)} { ::tip::show }

after 1500 {
  if {$autoCloseSplash} {wm withdraw .splash}
}

### End of file: end.tcl
