#!/bin/sh

# Scid (Shane's Chess Information Database)
#
# Copyright (C) 1999-2004  Shane Hudson. All rights reserved.
#
# This is freely redistributable software; see the file named "COPYING"
# or "copying.txt" that came with this program.
#
# To contact the author, email Shane at: sgh@users.sourceforge.net

#
# The following few 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.6"

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

# A lot of code assumes tcl_platform is either windows or unix, so
# lotsa stuff may break if this is not the case.
#
if {(! $windowsOS)  &&  (! $unixOS)} {
  # What to do here? Warn the user...?
}


# Check that on Unix, the version of tkscid matches the version of this
# script or on Windows, that the scid.exe and scid.gui versions are identical.
#
if {[string compare [sc_info version] $scidVersion]} {
  wm withdraw .
  if {$windowsOS} {
    set msg "This is Scid version [sc_info version], but the scid.gui data\n"
    append msg "file has the version number $scidVersion.\n"
  } else {
    set msg "This program,\n\"$argv0\",\nis version $scidVersion,\nbut the "
    append msg "tkscid program \nit uses is version [sc_info version].\n"
    append msg "Check that the path to tkscid is correct." 
  }
  tk_messageBox -type ok -icon error -title "Scid: Version Error" -message $msg
  exit 1
}

# Alter the version if any patches have been made to the Tcl code only:
set scidVersion "3.6.1"
set scidVersionDate "03 March 2004"

#############################################################
#
# NAMESPACES
#
# The main Tcl/Tk namespaces used in the Scid application are
# initialized here, so that default values can be set up and
# altered when the user options file is loaded.
#
foreach ns {
  ::splash
  ::utils
    ::utils::date ::utils::font ::utils::history ::utils::pane ::utils::string
    ::utils::sound ::utils::validate ::utils::win
  ::file
    ::file::finder ::file::maint ::maint
    ::bookmarks
  ::edit
  ::game
    ::gbrowser
  ::search
    ::search::filter ::search::board ::search::header ::seach::material
  ::windows
    ::windows::gamelist ::windows::stats ::tree ::windows::tree
    ::windows::switcher ::windows::eco ::crosstab ::pgn
  ::tools
    ::tools::analysis ::tools::email
    ::tools::graphs
      ::tools::graphs::filter ::tools::graphs::rating ::tools::graphs::score
    ::tb ::optable
  ::board ::move
} {
  namespace eval $ns {}
}


#############################################################
# 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"]
}

# scidConfigDir, scidDataDir, scidLogDir:
#   Location of Scid configuration, data and log files.
set scidConfigDir [file nativename [file join $scidUserDir "config"]]
set scidDataDir [file nativename [file join $scidUserDir "data"]]
set scidLogDir [file nativename [file join $scidUserDir "log"]]

# 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 $scidDataDir "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 40

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

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

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

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

# boardSTM: 1 to show side-to-move icon, 0 to hide it.
set boardSTM 1

# 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           10 normal roman]
  set fontOptions(Menu)    [list {MS Sans Serif}  9 normal roman]
  set fontOptions(Small)   [list Arial            9 normal roman]
  set fontOptions(Tiny)    [list Arial            8 normal roman]
  set fontOptions(Fixed)   [list Courier          9 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(Tiny)    [list helvetica  9 normal roman]
  set fontOptions(Fixed)   [list fixed     10 normal roman]
}

createFont Regular
createFont Menu
createFont Small
createFont Tiny
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        "\#70a070"
set lite        "\#e0d070"
set whitecolor  "\#ffffff"
set blackcolor  "\#000000"
set whiteborder "\#000000"
set blackborder "\#ffffff"
set highcolor   "\#b0d0e0"
set bestcolor   "\#bebebe"
set buttoncolor "\#b0c0d0"
set borderwidth 1

# Defaults for the PGN window:
# if ::pgn::showColor is 1, the PGN text will be colorized.
set ::pgn::showColor 1
set ::pgn::indentVars 1
set ::pgn::indentComments 1
set ::pgn::symbolicNags 1
set ::pgn::moveNumberSpaces 0
set ::pgn::shortHeader 0
set ::pgn::boldMainLine 1
set ::pgn::columnFormat 0
set ::pgn::stripMarks 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(epd) "."
set initialDir(html) "."
set initialDir(tex)  "."
set initialDir(report) "."
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} {
  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)  40
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 switcher window size:
set winWidth(.baseWin) 310
set winHeight(.baseWin) 110

# Default stats window lines:
array set ::windows::stats::display {
  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 0
  y1998 1
  y2000 1
  y2001 1
  y2002 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 1

#  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

# Autoplay and animation delays in milliseconds:
set autoplayDelay 5000
set animateDelay 200

# 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 }

# myPlayerNames:
#   List of player name patterns for which the chessboard should be
#   flipped each time a game is loaded to show the board from that
#   players perspective.
#
set myPlayerNames {}


# 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]

# Player report options
array set preport {
  Stats 1
  Oldest 5
  Newest 5
  MostFrequentOpponents 6
  AvgPerf 1
  HighRating 8
  Results 1
  MostFrequentEcoCodes 6
  Themes 1
  Endgames 1
  MaxGames 500
  ExtraMoves 1
}
array set preportDefaults [array get preport]

# 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 exportFlags(convertNullMoves) 1
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)
}


# ::windows::switcher::vertical
#
#   If 1, Switcher frames are arranged vertically.
#
set ::windows::switcher::vertical 0
set ::windows::switcher::icons 1

# 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 $scidLogDir "scidmail.log"]
set email(oldlogfile) [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) ""


### Audio move announcement options:

set ::utils::sound::soundFolder [file nativename [file join $::scidExeDir sounds]]
set ::utils::sound::announceNew 0
set ::utils::sound::announceForward 0
set ::utils::sound::announceBack 0


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

# Engines list file: -- OLD NAMES, NO LONGER USED
#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

# Set up Scid icon in Windows:
if {$::windowsOS} {
  # Look in each of the following directories for a file named scid.ico:
  set iconFileDirs [list \
    $scidExeDir $scidUserDir $scidConfigDir [file join $scidExeDir "src"]]

  foreach iconFileDir $iconFileDirs {
    set scidIconFile [file join $iconFileDir "scid.ico"]
    if {[file readable $scidIconFile]} {
      catch {wm iconbitmap . -default $scidIconFile}
    }
  }
}

# Add empty updateStatusBar proc to avoid errors caused by early
# closing of the splash window:
#
proc updateStatusBar {} {}

# Start up splash screen:

set ::splash::autoclose 1

proc ::splash::make {} {
  wm withdraw .
  set w [toplevel .splash]
  wm withdraw $w
  wm protocol $w WM_DELETE_WINDOW [list wm withdraw $w]
  wm title $w "Welcome to Scid $::scidVersion"
  frame $w.f
  frame $w.b
  text $w.t -height 15 -width 60 -cursor top_left_arrow \
    -background white -font font_Regular -wrap word \
    -yscrollcommand [list $w.ybar set] -setgrid 1
  scrollbar $w.ybar -command [list $w.t yview]
  checkbutton $w.auto -text "Auto-close after startup" \
    -variable ::splash::autoclose -font font_Small -pady 5 -padx 5
  button $w.dismiss -text Close -width 8 -command [list wm withdraw $w] \
    -font font_Small
  pack $w.f -side top -expand yes -fill both
  pack $w.b -side top -fill x
  pack $w.auto -side left -in .splash.b -pady 2 -ipadx 10 -padx 10
  pack $w.dismiss -side right -in .splash.b -pady 2 -ipadx 10 -padx 10
  pack $w.ybar -in $w.f -side right -fill y
  pack $w.t -in $w.f -side left -fill both -expand yes

  # Centre the splash window:
  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

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

  $w.t tag configure indent -lmargin2 20

  $w.t image create end -image splash
  $w.t insert end "Shane's Chess Information Database"
}


# 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/MyGn8TU3hmFFljB9EENscxnVkxE2ovcX8OBHs0
Wi6kT2uuO5ZXbqACescm/bA24qYXPwJX/hwm4+rmCJdAnrz3CNa/X5k9DuisJ/BLlNtJjQlI
lH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4Nsp/9ySMA2iB/VwqvlxBbcqAIuiVrUKAZ0AlR0CA7
IAwSOm36qXPoqZ9MMZ9r4AeHcAim4KGx4CnYOaIkmp3W8AmHoDYpqhIrqjaJIAxHYgo60Akl
WqPY+QHlcCWJcAgTOgYrGiPC0KGHsKOBgDAjGptOkgzgtaRM2qRNKl5ZEJtSagxVUAWwaaWv
+QHGoANO2qVOGgXFMKWxaaVYeqXGUAp84KQL4QfZEZHk2T86QZ6hYwp80SYkwjoMwTo2UQzp
5zuJ8KeACqh0aierhCMiQ9AiUDIih1odCnEin5AIdGoKifA0D8ElBLIhEYloS8MjPuIU22ky
6tUwQVIJ34Ah3SSpgXqZH6INMcKqTQMhnBk0+PE0JqIAKSKpAhE0GZAMUdCqCqJDXTMgDcIH
sAMvnAk1yBoM7KEWv9olFXN+Q0OdoJIB6WAoS1IhLUJBvTogUPGrS3MR5REuQIOs8LIw3Lk3
eoGp4WkYkYCVQ6MQF/MBwZAr3xkQADs=
}

::splash::make

proc ::splash::add {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
}

::splash::add "Copyright (C) 1999-2004 Shane Hudson  (sgh@users.sourceforge.net)"
::splash::add "This is Scid $::scidVersion, released $::scidVersionDate."
::splash::add "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(oldTiny) $fontOptions(Tiny)
set fontOptions(oldFixed) $fontOptions(Fixed)

# New configuration file names:
set scidConfigFiles(options) "options.dat"
set scidConfigFiles(engines) "engines.dat"
set scidConfigFiles(engines.bak) "engines.dat"
set scidConfigFiles(recentfiles) "recent.dat"
set scidConfigFiles(history) "history.dat"
set scidConfigFiles(bookmarks) "bookmarks.dat"
set scidConfigFiles(reports) "reports.dat"

# scidConfigFile:
#   Returns the full path and name of a Scid configuration file,
#   given its configuration type.
#
proc scidConfigFile {type} {
  global scidConfigDir scidConfigFiles
  if {! [info exists scidConfigFiles($type)]} {
    return -code error "No such config file type: $type"
  }
  return [file nativename [file join $scidConfigDir $scidConfigFiles($type)]]
}


# Try to load saved options:
#if {$unixOS} {
#  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]} {
    ::splash::add "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)}
  }
}

# Create the config, data and log directories if they do not exist:
proc makeScidDir {dir} {
  if {! [file isdirectory $dir]} {
    if {[catch {file mkdir $dir} err]} {
      ::splash::add "Error creating directory $dir: $err"
    } else {
      ::splash::add "Created directory: $dir"
    }
  }
}

makeScidDir $scidConfigDir
makeScidDir $scidDataDir
makeScidDir $scidLogDir

# Rename old email log file if necessary:
if {[file readable $email(oldlogfile)]  &&  ![file readable $email(logfile)]} {
  catch {file rename $email(oldlogfile) $email(logfile)}
}

# moveOldConfigFiles
#   Moves configuration files from the old (3.4 and earlier) names
#   to the new file names used since Scid 3.5.
#
proc moveOldConfigFiles {} {
  global scidUserDir scidConfigDir
  foreach {oldname newname} {
    scidrc options.dat
    scid.opt options.dat
    scid.bkm bookmarks.dat
    scid.rfl recentfiles.dat
    engines.lis engines.dat
  } {
    set oldpath [file nativename [file join $scidUserDir $oldname]]
    set newpath [file nativename [file join $scidConfigDir $newname]]
    if {[file readable $oldpath]  &&  ![file readable $newpath]} {
      if {[catch {file rename $oldpath $newpath} err]} {
        ::splash::add "Error moving $oldpath to $newpath: $err"
      } else {
        ::splash::add "Moved old config file $oldname to $newpath"
      }
    }
  }
}

moveOldConfigFiles

set optionsFile [scidConfigFile options]

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

# Now, if the options file was written by Scid 3.5 or older, it has a lot of
# yucky variable names in the global namespace. So convert them to the new
# namespace variables:
#
proc ConvertOldOptionVariables {} {

  set oldNewNames {
    autoCloseSplash ::splash::autoclose
    switcherVertical ::windows::switcher::vertical
    doColorPgn ::pgn::showColor
    pgnIndentVars ::pgn::indentVars
    pgnIndentComments ::pgn::indentComments
    pgnShortHeader ::pgn::shortHeader
    pgnMoveFont ::pgn::boldMainLine
    pgnMoveNumSpace ::pgn::moveNumberSpaces
    pgnStripMarks ::pgn::stripMarks
    pgnSymbolicNags ::pgn::symbolicNags
    pgnColumn ::pgn::columnFormat
  }

  foreach {old new} $oldNewNames {
    if {[info exists ::$old]} {
      set $new [set ::$old]
    }
  }
}

ConvertOldOptionVariables


# Reconfigure fonts if necessary:
foreach i {Regular Menu Small Tiny 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

# Use font_Menu for menu entries:
option add *Menu*Font font_Menu
# option add *Menubutton*Font font_Menu

if {$unixOS} {
  option add Scrollbar*borderWidth 1
}

# Set the radiobutton and checkbutton background color if desired.
# I find the maroon color on Unix ugly!
if {$unixOS} {
  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

# Start in the clipbase, if no database is loaded at startup.
sc_base switch clipbase

###
### 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+5CbEgyYAAQCuJHlNYZo1wHDo7VyOjSAebQxS69R25UCvVlmMXIp
TrmhSGgB4S5LzoVQegK+YJtWwLWEFjnzGVL7ftYQMoGQggerZ3CrLealoxomXxJIX1kNCQA7
}

image create photo p20 -data {
R0lGODlh8AAUAMIAAH9/fz8/P7+/vwAAAP///////////////yH5BAEKAAcALAAAAADwABQA
AAP+eLrc/jDKSau9OOvNu/8VAIBkJAhl2ohqe5xuCgTBGL/oQaMwJew30KwWhAkGA0Vv8gvk
LALRUxJ9BTSAk40qFXWzkKZWCmQit5Uo2GdDW4ZuiFQ9koZ33mxZAjhjBidJFDNIRBgBhRQD
Q4t9NH0NP3o1BEgEYjNTDix/SIITfQOIcROIooOFpouekV6PlQMEQ2qaK6QSsZUholGit5GA
BJeAuMIixgDCnwrJAbKLsMPNsiY0VxeeyxGhnoZm2cTb4OMrP88C0X3NVWF+2CLaELnCUTRm
6CfDtQuUwv7G1xb8iHUkmSV1lZy0GpErSZR9DbJVUOULCUQl3VRdPDL+rtsKRM8MxuqDjlcr
FBIflkomK+CdLP8I2Ivg5NIOmxIe5RnygOSzhDKlLGqg01LCGjMhUHQpj1AhmfEYmHIy8JSJ
jlZXAHIUDWRBojWcFnK1zZk/bw9oBLt09lcuMcpA7eS0CU8WVyIeMTBHD9ARdMjkjPt14BhF
QEkddDuhSm7MqIUrrgJ0ZhSDvJIr+7o14x9dB3z9zTtCE3A+nHxiUpNXsFKgXj+mHPN3pKa/
z5cH48LqJJwDVWoT8enYDis4W9k4cjzjliWk0p5ZBn5QcKdvOardXqqXN1nJVjFpxMTNgJw4
4zypj3V6kRlxecYl7g0+mZtewcLQ/vYMjTb+U6lh5fXfJtmVNcpOj/xnGzL/kHaeO/AZ1xtN
AaY3nHk9dZOHKnH0th43M1D4T2KXzebEbKKVFcoMhDEz1y8cvUjIPo3AU2MmNI0zYGEU2eiJ
a3JUqF9PFT6nnnd5GHMdRrScQMeSC3Q23oCdxXaEapAdMI+Sisy1I0YyQslMgOi48iU34AzY
yxlQJTfUA1hRoJMXYmJkHESOLIXIl1v+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
k9TKAS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TqrIKyuMtxq
NGySEArBxKiuT0rAZtYQTNzETvzEUBzFUjzFVFzFVnzFWJzFWrzFXNzFXvzFYBzGYjzGZFzG
ZnzGaJzGarzGbNzGbvzGcBzHcjzHT5AAADs=
}


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

lappend boardStyles Leipzig

set pieceImageData(Leipzig,25) {
R0lGODlhLAEZAMIAAH9/f7+/vz8/P////wAAAP///////////yH5BAEKAAcALAAAAAAsARkA
AAP+eLrc/jDKSau9OOvNu/8gBYQkFgBAoKDjcaZZW3LybD+verBKHt+ZgAAg0AErrGEtQhwq
hoKVwHlBRY+VAGFrxEoABGIYuW1tCasyRkC4er+AAaoD8xB9IitLrp9fBANuGkSENGdLGHV0
BCeMZG0oh2JjF2eLahsofBsBQoIaQkldTHEDpqeofhFaOqw9jlUsiBZgmEGeHkJtbKMQtWfA
wLMMri6wxbRQwxWWmUqUQYCmRZ++SrLYVEyBC2gr3BMyKUXiGc2DZ9omwLh5fNgpmxLn3gfn
TAuE2ss4cYoXQkzFYcPPQcA9Q3oZLAMvEqwIStK0iAhB15lGYFIAK5L+5SIodqHWleHycFWw
k1wmEJT4BJpBNhd/aUyn0EGRAUKioTKlhSOzAHKCypsQquEdCBSpZHxyhccCLQxrAYLJwqPK
dEFOkvNJAdiAdAV7JNx5gmsDTEopTUkjCGopXVDaAJWTUgKbuNXmvSBbV8KJQP4AqQoH9GbA
E9tagFnhh5I/BrVQhZIjjactpMHyRoAE8yIyk5Aohwn7BAXcF5rtOfa21J7iLZDDnK5MTXbr
ioFOAarpQNROnLDDDQyMk/QBaaWEpm4iRcXjQsfVlfkN5Xctv1+98m6QEWqwTvWYbBki2uW8
Mnd/MVm7w9HS1lNqbMnODvjG7Crn4kzNvXL+qlO3+VKKPwIZp8yBgz3QhgtE7CDHcTAsdlYY
PM01nkBzXWdXZrSgFIZnBf1CAH3mQYRhCgNOsGBP7Y3AS3sOzMeFdyDJGF5vyWFIwRS/mcKI
hTc+MKBQCW6mnEBfEebPOIGUhRNi3FH4V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NAR1kpSdEd1deWXiq9p3+FDSQn+YvEBUi8vlrhlmYzkkm4WmQUAViBUmMuJSW
l2ebqplmWOIuyCZuwDkxCLdPpGlAv6mOdacyJ1ZupPaZbsImvcFYzAVHA9qegXRT1scd3zah
GWpaObln+Iii+7memYULDZpuTYMlLCZYIuo7stegDIii0iljkUeVFVqRXQSfquUwmeF481Mg
REad0PGXOUqYtWIjFUKla1lYZWU3xaCK+0lvL2qZgWgm5GYOnRYePvOlrghKPLqlprKmfcCl
zkmWaFqFdXlGnTYKI9KZaGqg4XaEJXmYWACcTIRvUymnX0qnnMKEd6qalzmnayioIEoJfkqZ
V0qbzriGlppVqYvJGG3ABh8yUK+oqUIpqaHBExMiJaIKGpiaqpeKlZz6qU+xlVgZqqxaqtNx
qlyBq9Wwq7zaq776q8AarMI6rMRarMZ6rMiarMq6rMzarM76rAuQAAA7
}

set pieceImageData(Leipzig,55) {
R0lGODlhlAI3AMIAAL+/v39/fwAAAD8/P////////////////yH5BAEKAAcALAAAAACUAjcA
AAP+eLrc/jDKSau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBp7gADgyOwE
nlAHdCqdBl7LpiyZ1Xor1msjLGaEsV8XQMAWDLpp1KC9XLMHp3bbod83+gItc2xwcSZ2d4WG
JIMCdW14JoB8k399gnSLJ3ZQhJqSbwNXAQJPgZKlAXN8ok+rf61sLKQABGuKnx6Ieri5HXqj
enmXlsQMlSqkvL4ic7UEtm7MIo4Eqgel0KWo0KR8AdDWp8fgBLIrT+HbNmRPNo16kdMf8djA
qMLF+cfGKcptZWi0CyiDTTht42oo6TFA1DZSqhKOMCguTLZuqaZcPJf+bIA6ggUBcZwhcqTA
XjUaBfNTApBFl1aQ+esDMkZJiTYFHDSHMyTKGf8WZOImTmS5oi4RsljjytGNO+EG2biJw9OO
oAqGtrzJtevSPj9buFH5igZFdT2XdrmzA8AciAcaoaCYhMwzW+2emezg1o2if4r6LmThJtuc
siRLzgCwVpqOvmyuyB3WtbJ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dA7/jzMi+KP/lsjwZMAPhYT/lYIoOarfmG
fWiNf/jCAfm3J/meX/iYUPnPqPo50fqu//qwH/uyP/u0X/u2f/u4n/u6v/u83/u+//vAH/zC
P/zEX/zGf/y8nwAAOw==
}


####################
# Merida:

lappend boardStyles Merida

set pieceImageData(Merida,25) {
R0lGODlhLAEZAMIAAL+/v39/fz8/PwAAAP///////////////yH5BAEKAAcALAAAAAAsARkA
AAP+eLrc/jDKSau9OOvNu/9gKI5kaZ5oqmJAAGTCq8heS1etqwT8zt+P1kIwECx0mcHHBqMB
N8xLTsYL+JARoYJo3D0pyk5AMLZeikaAoNshsytls1sxKEvU4x3BXH9TWnVfcAOEZhaEaUUf
hGEWAYV0hJF1d4iTl1KPWEkEnY0VAwRqoWSbGAIEfhM8BIwBe4x7hgujAGqtW3kHpLZFgrSa
vxOMkmeIrqbGnxSPxM6uDgCEvcVck9TCB4DJh524Fy5rr1Vr2Q+aGKze6949DaE9jzSN0las
yxD4GM7phcjlGtCBe0Zw1iR7A+bRotRMnwOHjl6RkbKGHYBOeFigigH+rlSVjzwmNqjlY0Ej
d9I4TrDGoaHBSkUaxhAl0oK0aeBesWPnjsFNKoZOmvlJgWXAhLBeQpipc2cqpUFQdVL5h4zT
TmMEIdElkJI2qFoOzAzL7ZwzqA64EHE2s+aEm4zMzfAIkpxWKl26DgVraKyhsg3GsHMbIVSR
q57MVVy35oK4uo0jcNVR5aucl/V41AnlSZPmbA2JoWVQJxVBpAmLElQVYfFg1kfypkZXL1e0
OpoftWrlWd4wpxCB/VjXFCNsWlJ3T5VLB/gqhkI2HnCB0OAt4qXlDRZ2OviMhKE3I6L5llir
uGfqPnpeXawidAKRi2LVO7uLVNydr7y4kzP+Y2F+BTLfGfplsd4rShi2yx67mDKTRRvxt44a
EnSnGkHnFYKfBGslt9Zo75xWnhLN7CIJJDgxEMNa09wSA1yBHCeWhMatUpw3LeykSz7r+PcN
KAW2hsceLtIXw0s+EqdOfxyu9txqoaGy4wPOZFgMKCI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DmrPDtThX24bXqUzR9y9dO2GshbKremqWGqZqa61+y6ST6qgvybQ4WTfWmUvChBZFF0yA
kl/UZaOLtLZ4aqoxsVYww6rTWqxG95JfK2TjqrMMS7nyY555C7BMZ4MGy3Pbyl6aujweFLUt
txiAe6nSIoiv2qUkckAJaVcSS1ma6kvXmKKGm1Bj+aEx5KrSNJaSm2drS7v+Z6t/QHhn+6Au
uhND+wrQ5lUSxLLYe6zeOnzda5loC77CN3SyG1RW0rf+trtpT/ZXyHCTMWmewSu8FgmjXukp
H5qi63lObJix65t80iugnBiog+m8pFu5u2ZOkPejkWpJzNuCsqjAt5e+1dGskjqpb4o+Qkkf
CYVIfUisvIA4E1a/Y+aUEMGmU+SmDPG6J4pUX4vBcAV54MhONAgIBsx9CdxIpvu8B5jAPkQi
2eug/grDijPEAtOj4KoTiIJukInEmPO0V+vByyu2RbxN2Fu8xHpbGPW1olq9WFuLi7PEH8Fr
eLvDB5jDxOimanyxVQidU0u5qFOnjoCkhEiidEEfJdtjO0zBo2CufAZwzkS009qecxjHazvH
MiSZY3ILeVwhw1A8NtjHt9qCxr0hyApbsVAMMOjKspv8kVnwyXr6GlbcmdTqbaV8daQjH6IM
yovRygGDrnwAy5hDyoB8mbIcuWN7ynPQy74cBZ7syr88zMRcBcH8CLJczMq8zMzczM78zNAc
zdI8zdRczdZ8zdiczdq8zdzczd78zeAczuI8zuRczuZ8zuiczkSQAAA7}

set pieceImageData(Merida,70) {
R0lGODlhSANGAMIAAH9/fz8/PwAAAL+/v////////////////yH5BAEKAAcALAAAAABIA0YA
AAP+eLrc/jDKSau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqPyKRyyWw6
n9CodEqtWq/YrHbL7Xq/4LB4TIYMyugXYA1Io8/uOIrdlosBggBcu7azBgKBgntGgX4ceHpc
fYcpgIKBhEWGSQABgQF1NniYkgyAnkaXgpo0kKelB5ynAqmrrCmrqQuCAaMCELI8lEiWmLMy
q4pmAqFFt603rKQNr5C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+rSqwBMq76At9/UtB/6sfAYy4
dHCkaOtAyVuB17q9iSqsJWxCiYqrO7q9fhvBLay/1ftXFWJSzOJmt+m52SpIi0sxZKcHIque
9EFabdcWWpuaPQW7rNrD1GTBYvur7mlS2nbDUUlqHeUOLgzBX/qWpuudFLyMShvBw6rCMCy6
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$font$size -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$font$size -from $x 0 [expr $x + $size - 1] [expr $size - 1]
    incr x $size
  }
  image delete tempPieces$font$size
}

# 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
### lang.tcl: Support for multiple-language menus, buttons, etc.
### Part of Scid. Copyright 2001-2003 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) != ""  &&  $::tcl_version <= 8.3} {
    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) != ""  &&  $::tcl_version <= 8.3} {
    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
  regsub {\\n} $label "\n" label
  if {$hasEncoding  &&  $langEncoding($lang) != ""  &&  $::tcl_version <= 8.3} {
    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 future reference.
#
proc translateECO {lang pairList} {
  global hasEncoding langEncoding
  foreach {from to} $pairList {
    if {$hasEncoding  &&  $langEncoding($lang) != ""  &&  $::tcl_version <= 8.3} {
      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 tr
  if {$lang == ""} {set lang $::language}
  if {$lang == "X"} {return $tag}
  # First, look for a menu label
  if {[info exists menuLabel($lang,$tag)]} {
    return $menuLabel($lang,$tag)
  }
  if {[info exists menuLabel(E,$tag)]} {
    return $menuLabel(E,$tag)
  }
  # Now look for a regular button/message translation
  if {[info exists tr($tag)]} {
    return $tr($tag)
  }
  # Finally, just give up and return the original tag
  return $tag
}

proc setLanguage {{lang ""}} {
  global menuLabel menuUnder oldLang hasEncoding langEncoding

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

  if {[catch {setLanguage_$lang} err]} { puts "Error: $err" }
  # TODO: Check this:
  if {$hasEncoding  &&  $langEncoding($lang) != ""} {
      encoding system $langEncoding($lang)
  }


  # 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



# 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 true, numbers >= 100,000 are divided by 1000 and have
#   the unit "K" appended while values over 1 million appear as "1.00M"
#
proc ::utils::thousands {n {kilo 0}} {
  global locale
  set commaChar [string index $locale(numeric) 1]
  set unit ""
  if {$kilo} {
    if {$n >= 1000000} {
      set decimalChar [string index $locale(numeric) 0]
      set decimalPart [format "%02d" [expr {(int($n / 10000)) % 100}]]
      set n [expr {int($n) / 1000000}]
      set unit "${decimalChar}${decimalPart}M"
    } elseif {$n >= 100000} {
      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 ::utils::percentFormat {num denom} {
  # Ensure denominator is not zero:
  if {$denom == 0} {set denom 1}
  return "[::utils::thousands $num] ([expr $num * 100 / $denom]%)"
}

namespace eval ::utils::date {}

# ::utils::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 ::utils::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 ::utils::date::calendar -data {
R0lGODdhFgAUAMIAANnZ2VFR+wAAAP////oTQP//AAAAAAAAACwAAAAAFgAUAAADTwi63A4h
yklrVAFruDO0lCCO5NMIw4CqqWAya9ySdG3LbI7He+vrsxthSLiJfitCoUBAzpwDJRNqFBCL
RqpW1QN6q+DRdrfomsvh2mvtSAAAOw==
}

# ::utils::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 ::utils::date::chooser {{date "now"}} {
  set time [clock seconds]
  if {$date != "now"} {
    catch {set time [clock scan $date]}
  }
  set ::utils::date::_time $time
  set ::utils::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 ::utils::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 "::utils::date::_month $win -12"
  button $win.cal.prev -image tb_prev -command "::utils::date::_month $win -1"
  button $win.cal.next -image tb_next -command "::utils::date::_month $win +1"
  button $win.cal.nextY -image tb_end -command "::utils::date::_month $win +12"
  bind $win.cal <Configure> "::utils::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> "::utils::date::_day $win -7"
  bind $win <Down> "::utils::date::_day $win +7"
  bind $win <Left> "::utils::date::_day $win -1"
  bind $win <Right> "::utils::date::_day $win +1"

  wm minsize $win 250 200
  wm title $win "Scid: Choose Date"
  focus $win
  grab $win
  tkwait window $win
  if {$::utils::date::_selected == ""} { return {} }
  set time [clock scan $::utils::date::_selected]
  return [list \
          [clock format $time -format "%Y"] \
          [clock format $time -format "%m"] \
          [clock format $time -format "%d"] \
         ]
}

proc ::utils::date::_day {win delta} {
  set unit "day"
  if {$delta < 0} {set unit "day ago"}
  set time [clock scan "[expr abs($delta)] $unit" -base $::utils::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"]
  ::utils::date::_select $win "$year-$month-$day"
}

proc ::utils::date::_month {win delta} {
  set dir [expr {($delta > 0) ? 1 : -1} ]
  set day [string trimleft [clock format $::utils::date::_time -format "%d"] 0]
  set month [string trimleft [clock format $::utils::date::_time -format "%m"] 0]
  set year [clock format $::utils::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"}]} {
    ::utils::date::_select $win "$year-$month-28"
  }
}

proc ::utils::date::_redraw {win} {
  $win.cal delete all
  set time $::utils::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 [::utils::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 == $::utils::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> "::utils::date::_select $win $date"
  }

  if {$current != ""} {
    $win.cal itemconfigure $current-sensor -outline red -width 3
    $win.cal raise $current-sensor
  } elseif {$::utils::date::_selected == ""} {
    set date [clock format $time -format "%Y-%m-%d"]
    ::utils::date::_select $win $date
  }
}

proc ::utils::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 ::utils::date::_select {win date} {
  set time [clock scan $date]
  set date [clock format $time -format "%Y-%m-%d"]

  set currentMonth [clock format $::utils::date::_time -format "%m %Y"]
  set selectedMonth [clock format $time -format "%m %Y"]
  set ::utils::date::_time $time
  set ::utils::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 {
    ::utils::date::_redraw $win
  }
}
########################################
### utils/font.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
# utils/graph.tcl: Graph plotting package for Scid.
#

namespace eval ::utils::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 ::utils::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 ::utils::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 ::utils::graph::_options(data) {
  points lines bars color outline radius linewidth barwidth coords key
}
set ::utils::graph::_defaults(data) \
  { -points 0 -lines 1 -bars 0 -color red -outline black -radius 2 \
    -linewidth 1 -barwidth 1.0 -key {} -coords {} }

set ::utils::graph::_graphs {}
array set ::utils::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 ::utils::graph::create args {
  set graph [lindex $args 0]
  lappend ::utils::graph::_graphs $graph
  
  # Remove any existing data for this graph name:
  foreach key [array names ::utils::graph::_data] {
    if {[string match "$graph,*" $key]} { unset ::utils::graph::_data($key) }
  }
  set ::utils::graph::_data($graph,sets) {}

  set args [concat graph $graph $::utils::graph::_defaults(graph) [lrange $args 1 end]]
  set extraArgs [eval "::utils::graph::_configure $args"]
  if {$extraArgs != ""} {
    error "Unrecognised arguments: $extraArgs"
  }
  return $graph
}


# delete:
#    Removes all privately stored information about a graph.
#
proc ::utils::graph::delete {graph} {
  # Remove from the list of available graphs:
  set index [lindex $::utils::graph::_graphs $graph]
  if {$index < 0} { return }
  set ::utils::graph::_graphs [lreplace $::utils::graph::_graphs $index $index]
  # Remove all configuration data for the graph:
  foreach key [array names ::utils::graph::_data] {
    if {[string match "$graph,*" $key]} {
      unset ::utils::graph::_data($key)
    }
  }
}


# isgraph:
#    Returns true if the named graph exists.
#
proc ::utils::graph::isgraph {graph} {
  if {[lsearch $::utils::graph::_graphs $graph] >= 0} { return 1 }
  return 0
}


# data:
#    Adds a new data set to the graph, or modifies an existing one.
#
proc ::utils::graph::data args {
  variable _data
  variable _defaults
  set graph [lindex $args 0]
  set dataset [lindex $args 1]

  set args [concat data $graph,$dataset $_defaults(data) \
              [lrange $args 2 end]]

  set extraArgs [eval "::utils::graph::_configure $args"]
  if {$extraArgs != ""} {
    error "Unrecognised graph data options: $extraArgs"
  }

  set marklist $_data($graph,sets)
  if {[lsearch -exact $marklist $dataset] < 0} {
    lappend _data($graph,sets) $dataset
  }

  set datalength 0
  set ncoords [llength $_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?
  #::utils::graph::redraw $graph
}


# cget:
#    Return a stored attribute of a graph.
#
proc ::utils::graph::cget {graph opt} {
  variable _data
  # 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]} { ::utils::graph::set_range $graph }

  if {! [info exists _data($graph,$opt)]} {
    error "No such graph option: $opt"
  }
  return $_data($graph,$opt)
}

# configure:
#    Modify stored attributes for a graph.
#
proc ::utils::graph::configure args {
  set newargs [concat "graph" [lindex $args 0] [lrange $args 1 end]]
  eval "::utils::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 ::utils::graph::_configure args {
  variable _data
  set type [lindex $args 0]
  set dataset [lindex $args 1]
  set args [lrange $args 2 end]

  set optionList $::utils::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 _data($dataset,$option) [lindex $args [expr {$i + 1}]]
    }
  }
}


# redraw:
#    Redraw the entire graph, axes and data.
#
proc ::utils::graph::redraw {graph} {
  if {! [::utils::graph::isgraph $graph]} { error "$graph: no such graph" }
  if {! [info exists ::utils::graph::_data($graph,canvas)]} { return }
  $::utils::graph::_data($graph,canvas) delete -withtag g$graph
  ::utils::graph::plot_axes $graph
  ::utils::graph::plot_data $graph
}

# plot_axes:
#    Replot the graph axes.
#
proc ::utils::graph::plot_axes {graph} {
  variable _data
  # Set ranges and scaling factors:
  ::utils::graph::set_range $graph
  ::utils::graph::rescale $graph

  set xmin $_data($graph,axmin)
  set xmax $_data($graph,axmax)
  set ymin $_data($graph,aymin)
  set ymax $_data($graph,aymax)

  set xminc [xmap $graph $xmin]
  set xmaxc [xmap $graph $xmax]
  set yminc [ymap $graph $ymin]
  set ymaxc [ymap $graph $ymax]

  set canvas $_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 $_data($graph,$attr)
  }

  $canvas create rectangle $xminc $yminc $xmaxc $ymaxc -outline $tickcolor \
    -fill $_data($graph,background) -tag $tag

  set brect $_data($graph,brect)
  for {set i 0} {$i < [llength $brect]} {incr i} {
    set item [lindex $brect $i]
    set x1 [xmap $graph [lindex $item 0]]
    set y1 [ymap $graph [lindex $item 1]]
    set x2 [xmap $graph [lindex $item 2]]
    set y2 [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 $_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 [xmap $graph $xmin]
    set xmaxvalue [xmap $graph $xmax]
    if {$type == "at"} {
      # Plot just one line:
      set xvalue [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 [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 $_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 [ymap $graph $ymin]
    set ymaxvalue [ymap $graph $ymax]
    if {$type == "at"} {
      set yvalue [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 [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 [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 [::utils::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 [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 [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 [::utils::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 [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 ::utils::graph::plot_data {graph} {
  variable _data
  set canvas $_data($graph,canvas)

  foreach dataset $_data($graph,sets) {
    set color $_data($graph,$dataset,color)
    set outline $_data($graph,$dataset,outline)
    set tag g$graph
    set coords [scale_data $graph $_data($graph,$dataset,coords)]
    set ncoords [expr {[llength $coords] - 1}]

    # Draw key:
    if {$_data($graph,$dataset,key) != ""} {
      set key $_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 $_data($graph,$dataset,key) \
                 -font $_data($graph,font) -anchor $anchor}
      }
    }

    # Plot line:
    if {$_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 $_data($graph,$dataset,linewidth) -tag $tag"}
    }

    # Plot points:
    if {$_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 $_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 {$_data($graph,$dataset,bars)} {
      set base [ymap $graph $_data($graph,aymin)]
      set hwidth [xmap $graph $_data($graph,$dataset,barwidth)]
      set hwidth [expr {$hwidth - [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
      }
    }
  }
}


# 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 ::utils::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 ::utils::graph::point_visible {graph x y} {
  variable data
  set xmin $_data($graph,xtop)
  set ymin $_data($graph,ytop)
  set xmax [expr {$xmin + $_data($graph,width)}]
  set ymax [expr {$ymin + $_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 ::utils::graph::rescale {graph} {
  variable _data
  set width $_data($graph,width)
  set height $_data($graph,height)
  set xdelta [expr {double($_data($graph,axmax) - $_data($graph,axmin))}]
  set ydelta [expr {double($_data($graph,aymax) - $_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 _data($graph,xfac) [expr {double($width)/$xdelta}]
  set _data($graph,yfac) [expr {double($height)/$ydelta}]
}


# xmap:
#    Map a graph X coordinate to its canvas unit equivalent.
#
proc ::utils::graph::xmap {graph x} {
  variable _data
  return [expr {int(($x - $_data($graph,axmin)) * \
            $_data($graph,xfac) + $_data($graph,xtop))}]
}

# ymap:
#    Map a graph Y coordinate to its canvas unit equivalent.
#
proc ::utils::graph::ymap {graph y} {
  variable _data
if {$y == ""} { error "y is empty" }
  return [expr {int(($_data($graph,aymax) - $y) * \
            $_data($graph,yfac) + $_data($graph,ytop))}]
}

# Xunmap:
#    Transform a canvas unit to its graph X coordinate equivalent.
#
proc ::utils::graph::xunmap {graph cx} {
  variable _data
  return [expr {$_data($graph,axmin) + \
            double($cx - $_data($graph,xtop)) / \
            double($_data($graph,xfac))}]
}

# Yunmap:
#    Transform a canvas unit to its graph Y coordinate equivalent.
#
proc ::utils::graph::yunmap {graph cy} {
  variable _data
  return [expr {$_data($graph,aymax) - \
            double($cy - $_data($graph,ytop)) / \
            double($_data($graph,yfac))}]
}

# scale_data:
#    Transforms an even-sized list of graph coordinates to canvas units.
#
proc ::utils::graph::scale_data {graph coords} {
  set result {}
  for {set i 0} {$i < [llength $coords] - 1} {incr i 2} {
    lappend result [xmap $graph [lindex $coords $i]]
    lappend result [ymap $graph [lindex $coords [expr {$i + 1}]]]
  }
  return $result
}

# set_range:
#    Sets any range boundaries that are not already set for a graph.
#
proc ::utils::graph::set_range {graph} {
  variable _data

  set xmin 1000000000; set xmax -100000000
  set ymin 1000000000; set ymax -100000000

  foreach dataset $_data($graph,sets) {
    set coords $_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 $_data($graph,xtick)
  set ytick $_data($graph,ytick)
  set _data($graph,axmin) [expr {floor($xmin/$xtick) * $xtick}]
  set _data($graph,axmax) [expr {floor($xmax/$xtick) * $xtick + $xtick}]
  set _data($graph,aymin) [expr {floor($ymin/$ytick) * $ytick}]
  set _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 _data($graph,$coord)]} {
      set _data($graph,a$coord) $_data($graph,$coord)
    }
  }
}

### history.tcl
### Text entry history functions for Scid.
### Copyright (C) 2004 Shane Hudson.

namespace eval ::utils::history {}


set ::utils::history::defaultListLength 10
array set ::utils::history::listLength {}
array set ::utils::history::comboboxWidget {}

if {! [info exists ::utils::history::listData]} {
  array set ::utils::history::listData {}
}

# Load any history lists that were saved in the last session:
catch {source [scidConfigFile history]}


proc ::utils::history::SetList {key list} {
  set ::utils::history::listData($key) $list
}


proc ::utils::history::GetList {key} {
  variable listData
  if {[info exists listData($key)]} {
    return $listData($key)
  }
  return {}
}


#  ::utils::history::AddEntry
#
#   Inserts an entry at the top of the list of the specified key and
#   ensures that only one copy of the entry exists in the list.
#   The list is then pruned to the limit size is necessary.
#
proc ::utils::history::AddEntry {key entry} {
  variable listData

  # We do not add the empty string to a history list:
  if {$entry == ""} { return }

  if {[info exists listData($key)]} {
    # Take out this entry if it exists, so it will not appear twice:
    set index [lsearch -exact $listData($key) $entry]
    if {$index == 0} {
      # The entry is already at the start of the list; nothing to do
      return
    } elseif {$index > 0} {
      set listData($key) [lreplace $listData($key) $index $index]
    }
    set listData($key) [linsert $listData($key) 0 $entry]
    ::utils::history::PruneList $key
  } else {
    set listData($key) [list $entry]
  }
  RefillCombobox $key
}


proc ::utils::history::SetLimit {key length} {
  set ::utils::history::listLength($key) $length
  ::utils::history::PruneList $key
}


proc ::utils::history::GetLimit {key} {
  variable listLength
  variable defaultListLength
  if {[info exists ::utils::history::listLength($key)]} {
    return $::utils::history::listLength($key)
  }
  return $defaultListLength
}


proc ::utils::history::PruneList {key {length -1}} {
  variable data
  if {! [info exists data($key)]} { return }
  if {$length < 0} {
    set length [::utils::history::GetLimit $key]
  }
  set data($key) [lrange $data($key) 0 [expr {$length - 1}]]
}



# ::utils::history::SetCombobox
#
#   Returns the combobox widget associated with this history key.
#
proc ::utils::history::GetCombobox {key} {
  variable comboboxWidget
  if {[info exists comboboxWidget($key)]} {
    return $comboboxWidget($key)
  }
  return ""
}


# ::utils::history::SetCombobox
#
#   Associates the specified widget (which must be a megawidget created
#   with ::combobox::combobox, see contrib/combobox.tcl) with the specifiec
#   history key. Whenever the list for this history key is modified, the
#   combobox widget will be updated.
#
proc ::utils::history::SetCombobox {key cbWidget} {
  set ::utils::history::comboboxWidget($key) $cbWidget
  RefillCombobox $key
}


# ::utils::history::SetCombobox
#
#   Refills the history list of the combobox associated with the specified
#   history key, if there is one.
#
proc ::utils::history::RefillCombobox {key} {
  variable comboboxWidget
  
  set cbWidget [GetCombobox $key]
  if {$cbWidget == ""} { return }

  # If the combobox widget is part of a dialog which is generated as needed,
  # it may not exist right now:
  if {! [winfo exists $cbWidget]} { return }

  $cbWidget list delete 0 end
  set entries [GetList $key]
  foreach entry $entries {
    $cbWidget list insert end $entry
  }
}


# ::utils::history::Save
#   Saves the combobox history file, reporting any error in a message box
#   if reportError is true.
#
proc ::utils::history::Save {{reportError 0}} {
  variable listData

  set f {}
  set filename [scidConfigFile history]

  if  {[catch {open $filename w} f]} {
    if {$reportError} {
      tk_messageBox -title "Scid" -type ok -icon warning \
        -message "Unable to write file: $filename\n$f"
    }
    return
  }

  puts $f "# Scid [sc_info version] combobox history lists"
  puts $f ""
  foreach i [lsort [array names listData]] {
    puts $f "set ::utils::history::listData($i) [list $listData($i)]"
  }
  close $f
}

# The following paned window code is loosely based on code 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
#
# Many modifications and improvements for use in Scid have been made,
# including namespacing the code.

namespace eval ::utils::pane {}

array set ::utils::pane::_data {}

# Create
#
#   Create a paned window.
#
proc ::utils::pane::Create {win pane1 pane2 width height {ratio 0.5} {orient vert}} {
  variable _data
  set _data($win,1) $pane1
  set _data($win,2) $pane2
  set _data($win,drag) 1
  set vertical 1
  if {[string index $orient 0] == "h"} { set vertical 0 }
  set _data($win,vertical) $vertical
  # Default minimum size of each frame is 10%:
  set _data($win,min) 0.1
  set _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 2 -borderwidth 2 -relief groove \
      -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>           "::utils::pane::Enter $win"
  #bind $win.pane_grip <Leave>           "::utils::pane::Leave $win"
  #bind $win.pane_sash <Enter>           "::utils::pane::Enter $win"
  #bind $win.pane_sash <Leave>           "::utils::pane::Leave $win"

  if {$vertical} { set c "%Y" } else { set c "%X" }
  bind $win.pane_grip <ButtonPress-1>   "::utils::pane::Grab $win"
  bind $win.pane_grip <B1-Motion>       "::utils::pane::Drag $win $c"
  bind $win.pane_grip <ButtonRelease-1> "::utils::pane::Drop $win $c"
  bind $win.pane_sash <ButtonPress-1>   "::utils::pane::Grab $win"
  bind $win.pane_sash <B1-Motion>       "::utils::pane::Drag $win $c"
  bind $win.pane_sash <ButtonRelease-1> "::utils::pane::Drop $win $c"

  ::utils::pane::Divide $win $ratio
  return $win
}

proc ::utils::pane::SetDrag {win bool} {
  set ::utils::pane::_data($win,drag) $bool
}

proc ::utils::pane::SetRange {win min max} {
  set ::utils::pane::_data($win,min) $min
  set ::utils::pane::_data($win,max) $max
}

proc ::utils::pane::Enter {win} {
  $win.pane_sash configure -background yellow
  $win.pane_grip configure -background yellow
}

proc ::utils::pane::Leave {win} {
  $win.pane_sash configure -background black
  $win.pane_grip configure -background black
}

proc ::utils::pane::Grab {win} {
  $win.pane_sash configure -background red
  $win.pane_grip configure -background red
}

proc ::utils::pane::Drag {win y} {
  variable _data
  set vertical $_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 < $_data($win,min)} {set frac $_data($win,min)}
  if {$frac > $_data($win,max)} {set frac $_data($win,max)}

  if {$_data($win,drag)} {
    ::utils::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 ::utils::pane::Drop {win y} {
  set frac [::utils::pane::Drag $win $y]
  ::utils::pane::Divide $win $frac
  $win.pane_sash configure -background black
  $win.pane_grip configure -background gray
}

proc ::utils::pane::Divide {win frac} {
  if {$::utils::pane::_data($win,vertical)} {
    place $win.pane_sash -rely $frac
    place $win.pane_grip -rely $frac
    place $win.$::utils::pane::_data($win,1) -relheight $frac
    place $win.$::utils::pane::_data($win,2) -relheight [expr {1.0 - $frac}]
  } else {
    place $win.pane_sash -relx $frac
    place $win.pane_grip -relx $frac
    place $win.$::utils::pane::_data($win,1) -relwidth $frac
    place $win.$::utils::pane::_data($win,2) -relwidth [expr {1.0 - $frac}]
  }
}
### sound.tcl
### Functions for playing sound files to announce moves.
### Part of Scid. Copyright (C) Shane Hudson 2004.
###
### Uses the free Tcl/Tk sound package "Snack", which comes with
### most Tcl distributions. See http://www.speech.kth.se/snack/

namespace eval ::utils::sound {}

set ::utils::sound::hasSnackPackage 0
set ::utils::sound::isPlayingSound 0
set ::utils::sound::soundQueue {}
set ::utils::sound::soundFiles [list \
    King Queen Rook Bishop Knight CastleQ CastleK Back Mate Promote \
    a b c d e f g h x 1 2 3 4 5 6 7 8]

# soundMap
#
#   Maps characters in a move to sounds.
#   Before this map is used, "O-O-O" is converted to "q" and "O-O" to "k"
#   Also note that "U" (undo) is used for taking back a move.
#
array set ::utils::sound::soundMap {
    K King Q Queen R Rook B Bishop N Knight k CastleK q CastleQ
    x x U Back # Mate = Promote
    a a b b c c d d e e f f g g h h
    1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8
}


# ::utils::sound::Setup
#
#   Called once at startup to load the Snack package and set up sounds.
#
proc ::utils::sound::Setup {} {
  variable hasSnackPackage
  variable soundFiles
  variable soundFolder

  ::splash::add "Setting up audio move announcement..."
  if {[catch {package require snack 2.0}]} {
    set hasSnackPackage 0
    ::splash::add "    Move speech disabled - Snack sound package not found"
    return
  }

  ::splash::add "    Move speech enabled - Snack sound package found"
  set hasSnackPackage 1

  # Set up sounds. Each sound will be empty until a WAV file for it is found.
  foreach soundFile $soundFiles {
    ::snack::sound sound_$soundFile
  }

  set numSounds [::utils::sound::ReadFolder]
  set numSought [llength $soundFiles]
  ::splash::add "Searching sounds folder for move announcement sounds..."
  ::splash::add "   Found $numSounds of $numSought sound files in $soundFolder"
}


# ::utils::sound::ReadFolder
#
#   Reads sound files from the specified directory.
#   Returns the number of Scid sound files found in that directory.
#
proc ::utils::sound::ReadFolder {{newFolder ""}} {
  variable soundFiles
  variable soundFolder

  if {$newFolder != ""} { set soundFolder "" }

  set count 0
  foreach soundFile $soundFiles {
    set f [file join $soundFolder $soundFile.wav]
    if {[file readable $f]} {
      sound_$soundFile configure -file $f
      incr count
    }
  }
  return $count
}



proc ::utils::sound::AnnounceMove {move} {
  variable hasSnackPackage
  variable soundMap

  if {! $hasSnackPackage} { return }

  if {[string range $move 0 4] == "O-O-O"} { set move q }
  if {[string range $move 0 2] == "O-O"} { set move k }
  set parts [split $move ""]
  set soundList {}
  foreach part $parts {
    if {[info exists soundMap($part)]} {
      lappend soundList sound_$soundMap($part)
    }
  }
  if {[llength $soundList] > 0} {
    CancelSounds
    foreach s $soundList { PlaySound $s }
  }
}


proc ::utils::sound::AnnounceNewMove {move} {
  if {$::utils::sound::announceNew} { AnnounceMove $move }
}


proc ::utils::sound::AnnounceForward {move} {
  if {$::utils::sound::announceForward} { AnnounceMove $move }
}


proc ::utils::sound::AnnounceBack {} {
  if {$::utils::sound::announceBack} { AnnounceMove U }
}


proc ::utils::sound::SoundFinished {} {
  set ::utils::sound::isPlayingSound 0
  CheckSoundQueue
}


proc ::utils::sound::CancelSounds {} {
  if {! $::utils::sound::hasSnackPackage} { return }

  snack::audio stop
  set ::utils::sound::soundQueue {}
  set ::utils::sound::isPlayingSound 0
}


proc ::utils::sound::PlaySound {sound} {
  if {! $::utils::sound::hasSnackPackage} { return }
  lappend ::utils::sound::soundQueue $sound
  after idle ::utils::sound::CheckSoundQueue
}


# ::utils::sound::CheckSoundQueue
#
#   Starts playing the next available sound, if there is one waiting
#   and no sound is currently playing. Called whenever a sound is
#   added to the queue or a sound has finished playing.
#
proc ::utils::sound::CheckSoundQueue {} {
  variable soundQueue
  variable isPlayingSound

  if {$isPlayingSound} { return }
  if {[llength $soundQueue] == 0} { return }

  set next [lindex $soundQueue 0]
  set soundQueue [lrange $soundQueue 1 end]
  set isPlayingSound 1

  $next play -blocking 0 -command ::utils::sound::SoundFinished
}


# ::utils::sound::OptionsDialog
#
#   Dialog window for configuring move sounds.
#
#   TODO: language translations for this dialog.
#
proc ::utils::sound::OptionsDialog {} {
  set w .soundOptions

  foreach v {soundFolder announceNew announceForward announceBack} {
    set ::utils::sound::${v}_temp [set ::utils::sound::$v]
  }

  toplevel $w
  wm title $w "Scid: Sound Options"
  wm transient $w .


  label $w.status -text ""
  if {! $::utils::sound::hasSnackPackage} {
    $w.status configure -text "Scid could not find the Snack audio package at startup; Sound is disabled."
    pack $w.status -side bottom
  }
  pack [frame $w.b] -side bottom -fill x -pady 2
  pack [frame $w.f -relief groove -borderwidth 2] \
    -side top -fill x -padx 5 -pady 5 -ipadx 4 -ipady 4

  set f $w.f
  set r 0

  label $f.ftitle -text $::tr(SoundsFolder) -font font_Bold
  grid $f.ftitle -row $r -column 0 -columnspan 3 -pady 4
  incr r

  entry $f.folderEntry -width 40 -textvariable ::utils::sound::soundFolder_temp
  grid $f.folderEntry -row $r -column 0 -columnspan 2 -sticky we
  button $f.folderBrowse -text " $::tr(Browse)... " \
    -command ::utils::sound::OptionsDialogChooseFolder
  grid $f.folderBrowse -row $r -column 2
  incr r

  label $f.folderHelp -text $::tr(SoundsFolderHelp)
  grid $f.folderHelp -row $r -column 0 -columnspan 3
  incr r

  grid [frame $f.gap$r -height 5] -row $r -column -0; incr r

  label $f.title -text $::tr(SoundsAnnounceOptions) -font font_Bold
  grid $f.title -row $r -column 0 -columnspan 3 -pady 4
  incr r

  checkbutton $f.announceNew -text $::tr(SoundsAnnounceNew) \
    -variable ::utils::sound::announceNew_temp
  grid $f.announceNew -row $r -column 0 -columnspan 2 -sticky w
  incr r

  grid [frame $f.gap$r -height 5] -row $r -column -0; incr r

  checkbutton $f.announceForward -text $::tr(SoundsAnnounceForward) \
    -variable ::utils::sound::announceForward_temp
  grid $f.announceForward -row $r -column 0 -columnspan 2 -sticky w
  incr r

  grid [frame $f.gap$r -height 5] -row $r -column -0; incr r

  checkbutton $f.announceBack -text $::tr(SoundsAnnounceBack) \
    -variable ::utils::sound::announceBack_temp
  grid $f.announceBack -row $r -column 0 -columnspan 2 -sticky w
  incr r

  dialogbutton $w.b.ok -text OK -command ::utils::sound::OptionsDialogOK
  dialogbutton $w.b.cancel -text $::tr(Cancel) -command [list destroy $w]
  packbuttons right $w.b.cancel $w.b.ok
  bind $w <Return> [list $w.b.ok invoke]
  bind $w <Escape> [list $w.b.cancel invoke]
  ::utils::win::Centre $w
  wm resizable $w 0 0
  raiseWin $w
  grab $w
  focus $w.f.folderEntry
}

proc ::utils::sound::OptionsDialogChooseFolder {} {
  set newFolder [tk_chooseDirectory \
        -initialdir $::utils::sound::soundFolder_temp \
        -parent .soundOptions \
        -title "Scid: $::tr(SoundsFolder)"]
  if {$newFolder != ""} {
    set ::utils::sound::soundFolder_temp [file nativename $newFolder]
  }
}

proc ::utils::sound::OptionsDialogOK {} {
  variable soundFolder

  # Destroy the Sounds options dialog
  set w .soundOptions
  catch {grab release $w}
  destroy $w

  set isNewSoundFolder 0
  if {$soundFolder != $::utils::sound::soundFolder_temp} {
    set isNewSoundFolder 1
  }

  # Update the user-settable sound variables:
  foreach v {soundFolder announceNew announceForward announceBack} {
    set ::utils::sound::$v [set ::utils::sound::${v}_temp]
  }

  # If the user selected a different folder to look in, read it
  # and tell the user how many sound files were found there.

  if {$isNewSoundFolder  &&  $soundFolder != ""} {
    set numSoundFiles [::utils::sound::ReadFolder]
    tk_messageBox -title "Scid: Sound Files" -type ok -icon info \
      -message "Found $numSoundFiles of [llength $::utils::sound::soundFiles] sound files in $::utils::sound::soundFolder"
  }
}


# Read the sound files at startup:

::utils::sound::Setup

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


proc ::utils::string::CityName {siteName} {
  regsub { [A-Z][A-Z][A-Z]$} $siteName "" siteName
  return [string trim [::utils::string::Surname $siteName]]
}


# ::utils::string::Capital
#
#    Returns a string with the first character capitalised.
#
proc ::utils::string::Capital {str} {
  set s [string toupper [string index $str 0]]
  append s [string range $str 1 end]
  return $s
}

# PadLeft
#
#   Given a string and a length, pads the string with padChar to have
#   the required length.
#
proc ::utils::string::PadLeft {str length {padChar " "}} {
  set s $str
  for {set actual [string length $s]} {$actual < $length} {incr actual} {
    append s $padChar
  }
  return $s
}

# Pad
#
#   Same as PadLeft.
#
proc ::utils::string::Pad {str length {padChar " "}} {
  return [::utils::string::PadLeft $str $length $padChar]
}

# PadRight
#
#   Like PadLeft, but adds the padding characters to the start of the string.
#
proc ::utils::string::PadRight {str length {padChar " "}} {
  set s $str
  for {set actual [string length $s]} {$actual < $length} {incr actual} {
    set s "$padChar$s"
  }
  return $s
}

# PadCenter
#
#   Like PadLeft and PadRight, but centers the specified string.
#
proc ::utils::string::PadCenter {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
}

###
#
# ToolTips
#

namespace eval ::utils::tooltip {}

set ::utils::tooltip::showToolTips 1
set ::utils::tooltip::time 0
set ::utils::tooltip::enteredWidget {}
set ::utils::tooltip::tooltipDelay 400

array set ::utils::tooltip::message {}

# Construct tooltip window:
#
toplevel .tooltip
label .tooltip.text -relief solid -borderwidth 1 -justify left \
  -background lightYellow -padx 3 -pady 1
pack .tooltip.text -side left
wm overrideredirect .tooltip 1
wm withdraw .tooltip


# ::utils::tooltip::Set
#
#   Set the tooltip message for <button> to be <msg>
#
proc ::utils::tooltip::Set {button msg} {
  variable message
  set msg [string trim $msg]
  if {$msg == ""} { return }
  regsub {\\n} $msg "\n" msg
  set message($button) $msg
  bind $button <Any-Enter> +[list ::utils::tooltip::Enter $button]
  bind $button <Any-Leave> +[list ::utils::tooltip::Leave $button]
}

# ::utils::tooltip::Enter
#
#   Handles the mouse entering a button which has a tooltip.
#
proc ::utils::tooltip::Enter {button} {
  variable showToolTips
  variable enteredWidget
  variable tooltipDelay

  if {! $showToolTips} { return }
  set enteredWidget $button
  after $tooltipDelay [list ::utils::tooltip::Check $button]
}


# ::utils::tooltip::Check
#
#   Called a set time after the mouse has entered a button with a
#   tooltip, to check if it is still there. If so, the tooltip
#   message is displayed.
#
proc ::utils::tooltip::Check {button} {
  variable enteredWidget

  if {$enteredWidget != $button} {
    # The mouse cursor has moved somewhere else; display no tooltip
    return
  }

  if {! [info exists ::utils::tooltip::message($button)]} { return }

  .tooltip.text configure -text [tr $::utils::tooltip::message($button)]
  set x [winfo pointerx .]
  set y [winfo pointery .]
  incr x 10
  incr y 4
  catch {wm transient .tooltip [winfo toplevel $button]}
  catch {wm geometry .tooltip +$x+$y}
  wm deiconify .tooltip
  raiseWin .tooltip
}


# ::utils::tooltip::Leave
#
#   Handles the mouse leaving a button which has a tooltip.
#
proc ::utils::tooltip::Leave {button} {
  variable showToolTips
  if {! $showToolTips} { return }
  wm withdraw .tooltip
  after cancel [list ::utils::tooltip::Check $button]
}



# ::utils::validate::Integer
#
#   Used to check the size of integers in entry boxes.
#
proc ::utils::validate::Integer {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]
}



# ::utils::validate::Date
#
#    Used to check the validity of a date string as it is entered.
#
proc ::utils::validate::Date {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]
}

# ::utils::validate::Result
#
#    Used to check the validity of a result entrybox value.
#    Result can be empty, "1", "0", "=", or "*".
#
proc ::utils::validate::Result {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]
}

# ::utils::validate::Alpha
#
#    Used to check that an entrybox contains only letters.
#
proc ::utils::validate::Alpha {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]

}

# ::utils::validate::Regexp
#
#    Used to check the validity of an entrybox given a regular expression.
#    Used to verify a file is "a-h", for example.
#
proc ::utils::validate::Regexp {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]
}


# ::utils::win::Centre
#
#   Centres a window on the screen.
#
proc ::utils::win::Centre {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
}
###
### misc.tcl: part of Scid.
### Copyright (C) 2001  Shane Hudson.
###
### Miscellaneous routines called by other Tcl functions



# bindFocusColors:
#   Configures a text or entry widget so it turns lightYellow when it
#   gets the focus, and turns white again when it loses focus.
#
# THIS IS CURRENTLY DISABLED since it works fine with regular entry widgets
# but causes problems with our combobox widgets, not sure why!
#
proc bindFocusColors {w {inColor lightYellow} {outColor white}} {
  $w configure -background $outColor
  #bind $w <FocusIn> "+$w configure -background $inColor"
  #bind $w <FocusOut> "+$w configure -background $outColor"
}


# bindMouseWheel:
#   Given a window and a text frame within that window, binds
#   the mouse wheel to scroll the text frame vertically.
#
proc bindMouseWheel {win text} {
  bind $win <MouseWheel> \
    "$text yview scroll \[expr -(%D / 120)\] units"
  if {! $::windowsOS} {
    bind $win <Button-4> [list $text yview scroll -1 units]
    bind $win <Button-5> [list $text yview scroll  1 units]
  }
}

# dialogbuttonframe:
#   Creates a frame that will be shown at the bottom of a
#   dialog window. It takes two parameters: the frame widget
#   name to create, and a list of button args. Each element
#   should contain a widget name, and button arguments.
#
proc dialogbuttonframe {frame buttonlist} {
  frame $frame
  set bnames {}
  set maxlength 0
  foreach buttonargs $buttonlist {
    set bname $frame.[lindex $buttonargs 0]
    set bargs [lrange $buttonargs 1 end]
    eval button $bname $bargs
    set bnames [linsert $bnames 0 $bname]
    set length [string length [$bname cget -text]]
    if {$length > $maxlength} { set length $maxlength}
  }
  if {$maxlength < 7} { set maxlength 7 }
  foreach b $bnames {
    $b configure -width $maxlength -padx 4
    pack $b -side right -padx 4 -pady 4
  }
}

# packbuttons
#   Packs a row of dialog buttons to the left/right of their frame
#   with a standard amount of padding.
#
proc packbuttons {side args} {
  eval pack $args -side $side -padx 5 -pady 3
}

# dialogbutton:
#   Creates a button that will be shown in a dialog box, so it
#   is given a minumin width.
#
proc dialogbutton {w args} {
  set retval [eval button $w $args]
  set length [string length [$w cget -text]]
  if {$length < 7} { set length 7 }
  $w configure -width $length -pady 1
  return retval
}

# autoscrollframe
#   Creates and returns a frame containing a widget which is gridded
#   with scrollbars that automatically hide themselves when they are
#   not needed.
#   The frame and widget may already exist; they are created if needed.
#   Usage:
#      autoscrolltext [-bars none|x|y|both] frame type w args
#
proc autoscrollframe {args} {
  global _autoscroll
  set bars both
  if {[lindex $args 0] == "-bars"} {
    set bars [lindex $args 1]
    if {$bars != "x" && $bars != "y" && $bars != "none" && $bars != "both"} {
      return -code error "Invalid parameter: -bars $bars"
    }
    set args [lrange $args 2 end]
  }
  if {[llength $args] < 3} {
    return -code error "Insufficient number of parameters"
  }
  set frame [lindex $args 0]
  set type [lindex $args 1]
  set w [lindex $args 2]
  set args [lrange $args 3 end]

  set retval $frame
  if {! [winfo exists $frame]} { frame $frame }
  $frame configure -relief sunken -borderwidth 2
  if {! [winfo exists $w]} {
    $type $w
  }
  if {[llength $args] > 0} {
    eval $w configure $args
  }
  $w configure -relief flat -borderwidth 0
  grid $w -in $frame -row 0 -column 0 -sticky news
  set setgrid 0
  catch {set setgrid [$w cget -setgrid]}

  if {$bars == "y"  ||  $bars == "both"} {
    scrollbar $frame.ybar -command [list $w yview] -takefocus 0 -borderwidth 0
    $w configure -yscrollcommand [list _autoscroll $frame.ybar]
    grid $frame.ybar -row 0 -column 1 -sticky ns
    set _autoscroll($frame.ybar) 1
    set _autoscroll(time:$frame.ybar) [clock clicks -milli]
    if {! $setgrid} {
      # bind $frame.ybar <Map> [list _autoscrollMap $frame]
    }
  }
  if {$bars == "x"  ||  $bars == "both"} {
    scrollbar $frame.xbar -command [list $w xview] -takefocus 0 \
      -borderwidth 0 -orient horizontal
    $w configure -xscrollcommand [list _autoscroll $frame.xbar]
    grid $frame.xbar -row 1 -column 0 -sticky we
    set _autoscroll($frame.xbar) 1
    set _autoscroll(time:$frame.xbar) [clock clicks -milli]
    if {! $setgrid} {
      # bind $frame.xbar <Map> [list _autoscrollMap $frame]
    }
  }
  grid rowconfigure $frame 0 -weight 1
  grid columnconfigure $frame 0 -weight 1
  grid rowconfigure $frame 1 -weight 0
  grid columnconfigure $frame 1 -weight 0
  return $retval
}

array set _autoscroll {}

# _autoscroll
#   This is the "set" command called for auto-scrollbars.
#   If the bar is shown but should not be, it is hidden.
#   If the bar is hidden but should be shown, it is redrawn.
#   Note that once a bar is shown, it will not be removed again for
#   at least a few milliseconds; this is to overcome problematic
#   interactions between the x and y scrollbars where hiding one
#   causes the other to be shown etc. This usually happens because
#   the stupid Tcl/Tk text widget doesn't handle scrollbars well.
#
proc _autoscroll {bar args} {
  #global _autoscroll
  #if {[llength $args] == 2} {
  #  set min [lindex $args 0]
  #  set max [lindex $args 1]
  #  if {$min > 0.0  ||  $max < 1.0} {
  #    if {! $_autoscroll($bar)} {
  #      grid configure $bar
  #      set _autoscroll($bar) 1
  #      set _autoscroll(time:$bar) [clock clicks -milli]
  #    }
  #  } else {
  #    if {[clock clicks -milli] > [expr {$_autoscroll(time:$bar) + 100}]} {
  #      grid remove $bar
  #      set _autoscroll($bar) 0
  #    }
  #  }
  ## update idletasks
  #}
  eval $bar set $args
}

proc _autoscrollMap {frame} {
  # wm geometry [winfo toplevel $frame] [wm geometry [winfo toplevel $frame]]
}


# 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
}


# 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
}

###################
# 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.contents -textvar ::tr(Contents) -command { helpWindow Contents }
    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.contents $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.contents configure -state normal
  if {$name == "Contents"} { $w.b.contents 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)
  if { $::::pgn::boldMainLine } {
     $w tag configure nag -foreground $::pgnColor(Nag) -font font_Regular
     $w tag configure var -foreground $::pgnColor(Var) -font font_Regular
  } else {
     $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 start [clock clicks -milli]
  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 {}"
      } elseif {[strIsPrefix "url " $tagName]} {
        # Check if it is a URL tag:
        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 {}"
      } elseif {[strIsPrefix "run " $tagName]} {
        # Check if it is a Tcl command tag:
        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 {}"
      } elseif {[strIsPrefix "go " $tagName]} {
        # Check if it is a goto tag:
        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 {}"
      } elseif {[strIsPrefix "pi " $tagName]} {
        # Check if it is a player info tag:
        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 {}"
      } elseif {[strIsPrefix "g_" $tagName]} {
        # Check if it is a game-load tag:
        set gameTag $tagName
        set tagName "g"
        set gnum [string range $gameTag 2 end]
        set glCommand "::game::LoadMenu $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 {}"
      } elseif {[strIsPrefix "m_" $tagName]} {
        # Check if it is a move tag:
        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 {}"
      } elseif {[strIsPrefix "c_" $tagName]} {
        # Check if it is a comment tag:
        set commentTag $tagName
        set tagName "c"
        if { $::::pgn::boldMainLine } {
          $w tag configure $commentTag -foreground $::pgnColor(Comment) \
            -font font_Regular
        } else {
           $w tag configure $commentTag -foreground $::pgnColor(Comment) 
        }
        $w tag bind $commentTag <ButtonRelease-1> \
          "sc_move pgn [string range $commentTag 2 end]; updateBoard; ::commenteditor::Open"
        $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 -background white
      $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
  # set elapsed [expr {[clock clicks -milli] - $start}]
}


# 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 .
}
######################################################################
#
# The following code is a freely redistributable Tcl combobox
# implementation written by Bryan Oakley.
#
# No modifications for Scid have yet been made except for comments
# whitespace and indentation.
#
######################################################################

# Copyright (c) 1998-2003, Bryan Oakley
# All Rights Reservered
#
# Bryan Oakley
# oakley@bardo.clearlight.com
#
# combobox v2.3 August 16, 2003
#
# a combobox / dropdown listbox (pick your favorite name) widget
# written in pure tcl
#
# this code is freely distributable without restriction, but is
# provided as-is with no warranty expressed or implied.
#
# thanks to the following people who provided beta test support or
# patches to the code (in no particular order):
#
# Scott Beasley     Alexandre Ferrieux      Todd Helfter
# Matt Gushee       Laurent Duperval        John Jackson
# Fred Rapp         Christopher Nelson
# Eric Galluzzo     Jean-Francois Moine            Oliver Bienert
#
# A special thanks to Martin M. Hunt who provided several good ideas,
# and always with a patch to implement them. Jean-Francois Moine,
# Todd Helfter and John Jackson were also kind enough to send in some
# code patches.
#
# ... and many others over the years.

package require Tk 8.0
package provide combobox 2.3

namespace eval ::combobox {

  # this is the public interface
  namespace export combobox

  # these contain references to available options
  variable widgetOptions

  # these contain references to available commands and subcommands
  variable widgetCommands
  variable scanCommands
  variable listCommands
}

# ::combobox::combobox --
#
#   This is the command that gets exported. It creates a new
#   combobox widget.
#
# Arguments:
#
#   w        path of new widget to create
#   args     additional option/value pairs (eg: -background white, etc.)
#
# Results:
#
#   It creates the widget and sets up all of the default bindings
#
# Returns:
#
#   The name of the newly create widget
#
proc ::combobox::combobox {w args} {
  variable widgetOptions
  variable widgetCommands
  variable scanCommands
  variable listCommands

  # perform a one time initialization
  if {![info exists widgetOptions]} {
    Init
  }

  # build it...
  eval Build $w $args

  # set some bindings...
  SetBindings $w

  # and we are done!
  return $w
}


# ::combobox::Init --
#
#     Initialize the namespace variables. This should only be called
#     once, immediately prior to creating the first instance of the
#     widget
#
# Arguments:
#
#    none
#
# Results:
#
#     All state variables are set to their default values; all of
#     the option database entries will exist.
#
# Returns:
#
#     empty string

proc ::combobox::Init {} {
  variable widgetOptions
  variable widgetCommands
  variable scanCommands
  variable listCommands
  variable defaultEntryCursor

  array set widgetOptions [list \
    -background          {background          Background} \
    -bd                  -borderwidth \
    -bg                  -background \
    -borderwidth         {borderWidth         BorderWidth} \
    -buttonbackground    {buttonBackground    Background} \
    -command             {command             Command} \
    -commandstate        {commandState        State} \
    -cursor              {cursor              Cursor} \
    -disabledbackground  {disabledBackground  DisabledBackground} \
    -disabledforeground  {disabledForeground  DisabledForeground} \
    -dropdownwidth       {dropdownWidth       DropdownWidth} \
    -editable            {editable            Editable} \
    -elementborderwidth  {elementBorderWidth  BorderWidth} \
    -fg                  -foreground \
    -font                {font                Font} \
    -foreground          {foreground          Foreground} \
    -height              {height              Height} \
    -highlightbackground {highlightBackground HighlightBackground} \
    -highlightcolor      {highlightColor      HighlightColor} \
    -highlightthickness  {highlightThickness  HighlightThickness} \
    -image               {image               Image} \
    -justify             {justify             Justify} \
    -listvar             {listVariable        Variable} \
    -maxheight           {maxHeight           Height} \
    -opencommand         {opencommand         Command} \
    -relief              {relief              Relief} \
    -selectbackground    {selectBackground    Foreground} \
    -selectborderwidth   {selectBorderWidth   BorderWidth} \
    -selectforeground    {selectForeground    Background} \
    -state               {state               State} \
    -takefocus           {takeFocus           TakeFocus} \
    -textvariable        {textVariable        Variable} \
    -value               {value               Value} \
    -width               {width               Width} \
    -xscrollcommand      {xScrollCommand      ScrollCommand} \
  ]


  set widgetCommands [list \
    bbox      cget     configure    curselection \
    delete    get      icursor      index        \
    insert    list     scan         selection    \
    xview     select   toggle       open         \
    close    subwidget  \
  ]

  set listCommands [list delete get index insert size]

  set scanCommands [list mark dragto]

  # why check for the Tk package? This lets us be sourced into
  # an interpreter that doesn't have Tk loaded, such as the slave
  # interpreter used by pkg_mkIndex. In theory it should have no
  # side effects when run
  if {[lsearch -exact [package names] "Tk"] != -1} {

    ##################################################################
    #- this initializes the option database. Kinda gross, but it works
    #- (I think).
    ##################################################################

    # the image used for the button...
    if {$::tcl_platform(platform) == "windows"} {
      image create bitmap ::combobox::bimage -data {
        #define down_arrow_width 12
        #define down_arrow_height 12
        static char down_arrow_bits[] = {
          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
          0xfc,0xf1,0xf8,0xf0,0x70,0xf0,0x20,0xf0,
          0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00;
        }
      }
    } else {
      image create bitmap ::combobox::bimage -data  {
        #define down_arrow_width 15
        #define down_arrow_height 15
        static char down_arrow_bits[] = {
          0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,
          0x00,0x80,0xf8,0x8f,0xf0,0x87,0xe0,0x83,
          0xc0,0x81,0x80,0x80,0x00,0x80,0x00,0x80,
          0x00,0x80,0x00,0x80,0x00,0x80
        }
      }
    }

    # compute a widget name we can use to create a temporary widget
    set tmpWidget ".__tmp__"
    set count 0
    while {[winfo exists $tmpWidget] == 1} {
      set tmpWidget ".__tmp__$count"
      incr count
    }

    # get the scrollbar width. Because we try to be clever and draw our
    # own button instead of using a tk widget, we need to know what size
    # button to create. This little hack tells us the width of a scroll
    # bar.
    #
    # NB: we need to be sure and pick a window that doesn't already
    # exist...
    scrollbar $tmpWidget
    set sb_width [winfo reqwidth $tmpWidget]
    set bbg [$tmpWidget cget -background]
    destroy $tmpWidget

    # steal options from the entry widget
    # we want darn near all options, so we'll go ahead and do
    # them all. No harm done in adding the one or two that we
    # don't use.
    entry $tmpWidget
    foreach foo [$tmpWidget configure] {
      # the cursor option is special, so we'll save it in
      # a special way
      if {[lindex $foo 0] == "-cursor"} {
        set defaultEntryCursor [lindex $foo 4]
      }
      if {[llength $foo] == 5} {
        set option [lindex $foo 1]
        set value [lindex $foo 4]
        option add *Combobox.$option $value widgetDefault

        # these options also apply to the dropdown listbox
        if {[string compare $option "foreground"] == 0 \
              || [string compare $option "background"] == 0 \
              || [string compare $option "font"] == 0} {
          option add *Combobox*ComboboxListbox.$option $value \
              widgetDefault
        }
      }
    }
    destroy $tmpWidget

    # these are unique to us...
    option add *Combobox.elementBorderWidth  1      widgetDefault
    option add *Combobox.buttonBackground    $bbg   widgetDefault
    option add *Combobox.dropdownWidth       {}     widgetDefault
    option add *Combobox.openCommand         {}     widgetDefault
    option add *Combobox.cursor              {}     widgetDefault
    option add *Combobox.commandState        normal widgetDefault
    option add *Combobox.editable            1      widgetDefault
    option add *Combobox.maxHeight           10     widgetDefault
    option add *Combobox.height              0
  }

  # set class bindings
  SetClassBindings
}

# ::combobox::SetClassBindings --
#
#    Sets up the default bindings for the widget class
#
#    this proc exists since it's The Right Thing To Do, but
#    I haven't had the time to figure out how to do all the
#    binding stuff on a class level. The main problem is that
#    the entry widget must have focus for the insertion cursor
#    to be visible. So, I either have to have the entry widget
#    have the Combobox bindtag, or do some fancy juggling of
#    events or some such. What a pain.
#
# Arguments:
#
#    none
#
# Returns:
#
#    empty string

proc ::combobox::SetClassBindings {} {

  # make sure we clean up after ourselves...
  bind Combobox <Destroy> [list ::combobox::DestroyHandler %W]

  # this will (hopefully) close (and lose the grab on) the
  # listbox if the user clicks anywhere outside of it. Note
  # that on Windows, you can click on some other app and
  # the listbox will still be there, because tcl won't see
  # that button click
  set this {[::combobox::convert %W -W]}
  bind Combobox <Any-ButtonPress>   "$this close"
  bind Combobox <Any-ButtonRelease> "$this close"

  # this helps (but doesn't fully solve) focus issues. The general
  # idea is, whenever the frame gets focus it gets passed on to
  # the entry widget
  bind Combobox <FocusIn> {+::combobox::tkTabToWindow \
                             [::combobox::convert %W -W].entry}

  # this closes the listbox if we get hidden
  bind Combobox <Unmap> {[::combobox::convert %W -W] close}

  return ""
}

# ::combobox::SetBindings --
#
#    here's where we do most of the binding foo. I think there's probably
#    a few bindings I ought to add that I just haven't thought
#    about...
#
#    I'm not convinced these are the proper bindings. Ideally all
#    bindings should be on "Combobox", but because of my juggling of
#    bindtags I'm not convinced thats what I want to do. But, it all
#    seems to work, its just not as robust as it could be.
#
# Arguments:
#
#    w    widget pathname
#
# Returns:
#
#    empty string

proc ::combobox::SetBindings {w} {
  upvar ::combobox::${w}::widgets  widgets
  upvar ::combobox::${w}::options  options

  # juggle the bindtags. The basic idea here is to associate the
  # widget name with the entry widget, so if a user does a bind
  # on the combobox it will get handled properly since it is
  # the entry widget that has keyboard focus.
  bindtags $widgets(entry) \
      [concat $widgets(this) [bindtags $widgets(entry)]]

  bindtags $widgets(button) \
      [concat $widgets(this) [bindtags $widgets(button)]]

  # override the default bindings for tab and shift-tab. The
  # focus procs take a widget as their only parameter and we
  # want to make sure the right window gets used (for shift-
  # tab we want it to appear as if the event was generated
  # on the frame rather than the entry.
  bind $widgets(entry) <Tab> \
      "::combobox::tkTabToWindow \[tk_focusNext $widgets(entry)\]; break"
  bind $widgets(entry) <Shift-Tab> \
      "::combobox::tkTabToWindow \[tk_focusPrev $widgets(this)\]; break"

  # this makes our "button" (which is actually a label)
  # do the right thing
  bind $widgets(button) <ButtonPress-1> [list $widgets(this) toggle]

  # this lets the autoscan of the listbox work, even if they
  # move the cursor over the entry widget.
  bind $widgets(entry) <B1-Enter> "break"

  bind $widgets(listbox) <ButtonRelease-1> \
      "::combobox::Select [list $widgets(this)] \[$widgets(listbox) nearest %y\]; break"

  bind $widgets(vsb) <ButtonPress-1>   {continue}
  bind $widgets(vsb) <ButtonRelease-1> {continue}

  bind $widgets(listbox) <Any-Motion> {
    %W selection clear 0 end
    %W activate @%x,%y
    %W selection anchor @%x,%y
    %W selection set @%x,%y @%x,%y
    # need to do a yview if the cursor goes off the top
    # or bottom of the window... (or do we?)
  }

  # these events need to be passed from the entry widget
  # to the listbox, or otherwise need some sort of special
  # handling.
  foreach event [list <Up> <Down> <Tab> <Return> <Escape> \
                    <Next> <Prior> <Double-1> <1> <Any-KeyPress> \
                    <FocusIn> <FocusOut>] {
    bind $widgets(entry) $event \
      [list ::combobox::HandleEvent $widgets(this) $event]
  }

  # like the other events, <MouseWheel> needs to be passed from
  # the entry widget to the listbox. However, in this case we
  # need to add an additional parameter
  catch {
      bind $widgets(entry) <MouseWheel> \
        [list ::combobox::HandleEvent $widgets(this) <MouseWheel> %D]
  }
}

# ::combobox::Build --
#
#    This does all of the work necessary to create the basic
#    combobox.
#
# Arguments:
#
#    w        widget name
#    args     additional option/value pairs
#
# Results:
#
#    Creates a new widget with the given name. Also creates a new
#    namespace patterened after the widget name, as a child namespace
#    to ::combobox
#
# Returns:
#
#    the name of the widget

proc ::combobox::Build {w args } {
  variable widgetOptions

  if {[winfo exists $w]} {
    error "window name \"$w\" already exists"
  }

  # create the namespace for this instance, and define a few
  # variables
  namespace eval ::combobox::$w {

    variable ignoreTrace 0
    variable oldFocus    {}
    variable oldGrab     {}
    variable oldValue    {}
    variable options
    variable this
    variable widgets

    set widgets(foo) foo  ;# coerce into an array
    set options(foo) foo  ;# coerce into an array

    unset widgets(foo)
    unset options(foo)
  }

  # import the widgets and options arrays into this proc so
  # we don't have to use fully qualified names, which is a
  # pain.
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  # this is our widget -- a frame of class Combobox. Naturally,
  # it will contain other widgets. We create it here because
  # we need it in order to set some default options.
  set widgets(this)   [frame  $w -class Combobox -takefocus 0]
  set widgets(entry)  [entry  $w.entry -takefocus 1]
  set widgets(button) [label  $w.button -takefocus 0]

  # this defines all of the default options. We get the
  # values from the option database. Note that if an array
  # value is a list of length one it is an alias to another
  # option, so we just ignore it
  foreach name [array names widgetOptions] {
    if {[llength $widgetOptions($name)] == 1} {
      continue
    }

    set optName  [lindex $widgetOptions($name) 0]
    set optClass [lindex $widgetOptions($name) 1]

    set value [option get $w $optName $optClass]
    set options($name) $value
  }

  # a couple options aren't available in earlier versions of
  # tcl, so we'll set them to sane values. For that matter, if
  # they exist but are empty, set them to sane values.
  if {[string length $options(-disabledforeground)] == 0} {
    set options(-disabledforeground) $options(-foreground)
  }
  if {[string length $options(-disabledbackground)] == 0} {
    set options(-disabledbackground) $options(-background)
  }

  # if -value is set to null, we'll remove it from our
  # local array. The assumption is, if the user sets it from
  # the option database, they will set it to something other
  # than null (since it's impossible to determine the difference
  # between a null value and no value at all).
  if {[info exists options(-value)] \
        && [string length $options(-value)] == 0} {
    unset options(-value)
  }

  # we will later rename the frame's widget proc to be our
  # own custom widget proc. We need to keep track of this
  # new name, so we'll define and store it here...
  set widgets(frame) ::combobox::${w}::$w

  # gotta do this sooner or later. Might as well do it now
  pack $widgets(button) -side right -fill y    -expand no
  pack $widgets(entry)  -side left  -fill both -expand yes

  # I should probably do this in a catch, but for now it's
  # good enough... What it does, obviously, is put all of
  # the option/values pairs into an array. Make them easier
  # to handle later on...
  array set options $args

  # now, the dropdown list... the same renaming nonsense
  # must go on here as well...
  set widgets(dropdown)   [toplevel  $w.top]
  set widgets(listbox) [listbox   $w.top.list]
  set widgets(vsb)     [scrollbar $w.top.vsb]

  pack $widgets(listbox) -side left -fill both -expand y

  # fine tune the widgets based on the options (and a few
  # arbitrary values...)

  # NB: we are going to use the frame to handle the relief
  # of the widget as a whole, so the entry widget will be
  # flat. This makes the button which drops down the list
  # to appear "inside" the entry widget.

  $widgets(vsb) configure \
    -borderwidth 1 \
    -command "$widgets(listbox) yview" \
    -highlightthickness 0

  $widgets(button) configure \
    -background $options(-buttonbackground) \
    -highlightthickness 0 \
    -borderwidth $options(-elementborderwidth) \
    -relief raised \
    -width [expr {[winfo reqwidth $widgets(vsb)] - 2}]

  $widgets(entry) configure \
    -borderwidth 0 \
    -relief flat \
    -highlightthickness 0

  $widgets(dropdown) configure \
    -borderwidth $options(-elementborderwidth) \
    -relief sunken

  $widgets(listbox) configure \
    -selectmode browse \
    -background [$widgets(entry) cget -bg] \
    -yscrollcommand "$widgets(vsb) set" \
    -exportselection false \
    -borderwidth 0


#  trace variable ::combobox::${w}::entryTextVariable w \
#    [list ::combobox::EntryTrace $w]

  # do some window management foo on the dropdown window
  wm overrideredirect $widgets(dropdown) 1
  wm transient        $widgets(dropdown) [winfo toplevel $w]
  wm group            $widgets(dropdown) [winfo parent $w]
  wm resizable        $widgets(dropdown) 0 0
  wm withdraw         $widgets(dropdown)

  # this moves the original frame widget proc into our
  # namespace and gives it a handy name
  rename ::$w $widgets(frame)

  # now, create our widget proc. Obviously (?) it goes in
  # the global namespace. All combobox widgets will actually
  # share the same widget proc to cut down on the amount of
  # bloat.
  proc ::$w {command args} \
    "eval ::combobox::WidgetProc $w \$command \$args"


  # ok, the thing exists... let's do a bit more configuration.
  if {[catch "::combobox::Configure [list $widgets(this)] [array get options]" error]} {
    catch {destroy $w}
    error "internal error: $error"
  }

  return ""

}

# ::combobox::HandleEvent --
#
#    this proc handles events from the entry widget that we want
#    handled specially (typically, to allow navigation of the list
#    even though the focus is in the entry widget)
#
# Arguments:
#
#    w       widget pathname
#    event   a string representing the event (not necessarily an
#            actual event)
#    args    additional arguments required by particular events

proc ::combobox::HandleEvent {w event args} {
  upvar ::combobox::${w}::widgets  widgets
  upvar ::combobox::${w}::options  options
  upvar ::combobox::${w}::oldValue oldValue

  # for all of these events, if we have a special action we'll
  # do that and do a "return -code break" to keep additional
  # bindings from firing. Otherwise we'll let the event fall
  # on through.
  switch $event {

    "<MouseWheel>" {
      if {[winfo ismapped $widgets(dropdown)]} {
        set D [lindex $args 0]
        # the '120' number in the following expression has
        # it's genesis in the tk bind manpage, which suggests
        # that the smallest value of %D for mousewheel events
        # will be 120. The intent is to scroll one line at a time.
        $widgets(listbox) yview scroll [expr {-($D/120)}] units
      }
    }

    "<Any-KeyPress>" {
      # if the widget is editable, clear the selection.
      # this makes it more obvious what will happen if the
      # user presses <Return> (and helps our code know what
      # to do if the user presses return)
      if {$options(-editable)} {
        $widgets(listbox) see 0
        $widgets(listbox) selection clear 0 end
        $widgets(listbox) selection anchor 0
        $widgets(listbox) activate 0
      }
    }

    "<FocusIn>" {
      set oldValue [$widgets(entry) get]
    }

    "<FocusOut>" {
      if {![winfo ismapped $widgets(dropdown)]} {
        # did the value change?
        set newValue [$widgets(entry) get]
        if {$oldValue != $newValue} {
          CallCommand $widgets(this) $newValue
        }
      }
    }

    "<1>" {
      set editable [::combobox::GetBoolean $options(-editable)]
      if {!$editable} {
        if {[winfo ismapped $widgets(dropdown)]} {
          $widgets(this) close
          return -code break;
        } else {
          if {$options(-state) != "disabled"} {
            $widgets(this) open
            return -code break;
          }
        }
      }
    }

    "<Double-1>" {
      if {$options(-state) != "disabled"} {
        $widgets(this) toggle
        return -code break;
      }
    }

    "<Tab>" {
      if {[winfo ismapped $widgets(dropdown)]} {
        ::combobox::Find $widgets(this) 0
        return -code break;
      } else {
        ::combobox::SetValue $widgets(this) [$widgets(this) get]
      }
    }

    "<Escape>" {
#      $widgets(entry) delete 0 end
#      $widgets(entry) insert 0 $oldValue
      if {[winfo ismapped $widgets(dropdown)]} {
        $widgets(this) close
        return -code break;
      }
    }

    "<Return>" {
      # did the value change?
      set newValue [$widgets(entry) get]
      if {$oldValue != $newValue} {
        CallCommand $widgets(this) $newValue
      }

      if {[winfo ismapped $widgets(dropdown)]} {
        ::combobox::Select $widgets(this) [$widgets(listbox) curselection]
        return -code break;
      }
    }

    "<Next>" {
      $widgets(listbox) yview scroll 1 pages
      set index [$widgets(listbox) index @0,0]
      $widgets(listbox) see $index
      $widgets(listbox) activate $index
      $widgets(listbox) selection clear 0 end
      $widgets(listbox) selection anchor $index
      $widgets(listbox) selection set $index
    }

    "<Prior>" {
      $widgets(listbox) yview scroll -1 pages
      set index [$widgets(listbox) index @0,0]
      $widgets(listbox) activate $index
      $widgets(listbox) see $index
      $widgets(listbox) selection clear 0 end
      $widgets(listbox) selection anchor $index
      $widgets(listbox) selection set $index
    }

    "<Down>" {
      if {[winfo ismapped $widgets(dropdown)]} {
        ::combobox::tkListboxUpDown $widgets(listbox) 1
        return -code break;
      } else {
        if {$options(-state) != "disabled"} {
          $widgets(this) open
          return -code break;
        }
      }
    }

    "<Up>" {
      if {[winfo ismapped $widgets(dropdown)]} {
        ::combobox::tkListboxUpDown $widgets(listbox) -1
        return -code break;
      } else {
        if {$options(-state) != "disabled"} {
          $widgets(this) open
          return -code break;
        }
      }
    }
  }

  return ""
}

# ::combobox::DestroyHandler {w} --
#
#    Cleans up after a combobox widget is destroyed
#
# Arguments:
#
#    w    widget pathname
#
# Results:
#
#    The namespace that was created for the widget is deleted,
#    and the widget proc is removed.

proc ::combobox::DestroyHandler {w} {

  catch {
    # if the widget actually being destroyed is of class Combobox,
    # remove the namespace and associated proc.
    if {[string compare [winfo class $w] "Combobox"] == 0} {
      # delete the namespace and the proc which represents
      # our widget
      namespace delete ::combobox::$w
      rename $w {}
    }
  }
  return ""
}

# ::combobox::Find
#
#    finds something in the listbox that matches the pattern in the
#    entry widget and selects it
#
#    N.B. I'm not convinced this is working the way it ought to. It
#    works, but is the behavior what is expected? I've also got a gut
#    feeling that there's a better way to do this, but I'm too lazy to
#    figure it out...
#
# Arguments:
#
#    w      widget pathname
#    exact  boolean; if true an exact match is desired
#
# Returns:
#
#    Empty string

proc ::combobox::Find {w {exact 0}} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  ## *sigh* this logic is rather gross and convoluted. Surely
  ## there is a more simple, straight-forward way to implement
  ## all this. As the saying goes, I lack the time to make it
  ## shorter...

  # use what is already in the entry widget as a pattern
  set pattern [$widgets(entry) get]

  if {[string length $pattern] == 0} {
    # clear the current selection
    $widgets(listbox) see 0
    $widgets(listbox) selection clear 0 end
    $widgets(listbox) selection anchor 0
    $widgets(listbox) activate 0
    return
  }

  # we're going to be searching this list...
  set list [$widgets(listbox) get 0 end]

  # if we are doing an exact match, try to find,
  # well, an exact match
  set exactMatch -1
  if {$exact} {
    set exactMatch [lsearch -exact $list $pattern]
  }

  # search for it. We'll try to be clever and not only
  # search for a match for what they typed, but a match for
  # something close to what they typed. We'll keep removing one
  # character at a time from the pattern until we find a match
  # of some sort.
  set index -1
  while {$index == -1 && [string length $pattern]} {
    set index [lsearch -glob $list "$pattern*"]
    if {$index == -1} {
      regsub {.$} $pattern {} pattern
    }
  }

  # this is the item that most closely matches...
  set thisItem [lindex $list $index]

  # did we find a match? If so, do some additional munging...
  if {$index != -1} {

    # we need to find the part of the first item that is
    # unique WRT the second... I know there's probably a
    # simpler way to do this...

    set nextIndex [expr {$index + 1}]
    set nextItem [lindex $list $nextIndex]

    # we don't really need to do much if the next
    # item doesn't match our pattern...
    if {[string match $pattern* $nextItem]} {
      # ok, the next item matches our pattern, too
      # now the trick is to find the first character
      # where they *don't* match...
      set marker [string length $pattern]
      while {$marker <= [string length $pattern]} {
        set a [string index $thisItem $marker]
        set b [string index $nextItem $marker]
        if {[string compare $a $b] == 0} {
          append pattern $a
          incr marker
        } else {
          break
        }
      }
    } else {
      set marker [string length $pattern]
    }

  } else {
    set marker end
    set index 0
  }

  # ok, we know the pattern and what part is unique;
  # update the entry widget and listbox appropriately
  if {$exact && $exactMatch == -1} {
    # this means we didn't find an exact match
    $widgets(listbox) selection clear 0 end
    $widgets(listbox) see $index

  } elseif {!$exact}  {
    # this means we found something, but it isn't an exact
    # match. If we find something that *is* an exact match we
    # don't need to do the following, since it would merely
    # be replacing the data in the entry widget with itself
    set oldstate [$widgets(entry) cget -state]
    $widgets(entry) configure -state normal
    $widgets(entry) delete 0 end
    $widgets(entry) insert end $thisItem
    $widgets(entry) selection clear
    $widgets(entry) selection range $marker end
    $widgets(listbox) activate $index
    $widgets(listbox) selection clear 0 end
    $widgets(listbox) selection anchor $index
    $widgets(listbox) selection set $index
    $widgets(listbox) see $index
    $widgets(entry) configure -state $oldstate
  }
}

# ::combobox::Select --
#
#    selects an item from the list and sets the value of the combobox
#    to that value
#
# Arguments:
#
#    w      widget pathname
#    index  listbox index of item to be selected
#
# Returns:
#
#    empty string

proc ::combobox::Select {w index} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  # the catch is because I'm sloppy -- presumably, the only time
  # an error will be caught is if there is no selection.
  if {![catch {set data [$widgets(listbox) get [lindex $index 0]]}]} {
    ::combobox::SetValue $widgets(this) $data

    $widgets(listbox) selection clear 0 end
    $widgets(listbox) selection anchor $index
    $widgets(listbox) selection set $index
  }

  $widgets(entry) selection range 0 end
  $widgets(entry) icursor end
  $widgets(this) close

  return ""
}

# ::combobox::HandleScrollbar --
#
#    causes the scrollbar of the dropdown list to appear or disappear
#    based on the contents of the dropdown listbox
#
# Arguments:
#
#    w       widget pathname
#    action  the action to perform on the scrollbar
#
# Returns:
#
#    an empty string

proc ::combobox::HandleScrollbar {w {action "unknown"}} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  if {$options(-height) == 0} {
    set hlimit $options(-maxheight)
  } else {
    set hlimit $options(-height)
  }

  switch $action {
    "grow" {
      if {$hlimit > 0 && [$widgets(listbox) size] > $hlimit} {
        pack forget $widgets(listbox)
        pack $widgets(vsb) -side right -fill y -expand n
        pack $widgets(listbox) -side left -fill both -expand y
      }
    }

    "shrink" {
      if {$hlimit > 0 && [$widgets(listbox) size] <= $hlimit} {
        pack forget $widgets(vsb)
      }
    }

    "crop" {
      # this means the window was cropped and we definitely
      # need a scrollbar no matter what the user wants
      pack forget $widgets(listbox)
      pack $widgets(vsb) -side right -fill y -expand n
      pack $widgets(listbox) -side left -fill both -expand y
    }

    default {
      if {$hlimit > 0 && [$widgets(listbox) size] > $hlimit} {
        pack forget $widgets(listbox)
        pack $widgets(vsb) -side right -fill y -expand n
        pack $widgets(listbox) -side left -fill both -expand y
      } else {
        pack forget $widgets(vsb)
      }
    }
  }

  return ""
}

# ::combobox::ComputeGeometry --
#
#    computes the geometry of the dropdown list based on the size of the
#    combobox...
#
# Arguments:
#
#    w     widget pathname
#
# Returns:
#
#    the desired geometry of the listbox

proc ::combobox::ComputeGeometry {w} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  if {$options(-height) == 0 && $options(-maxheight) != "0"} {
    # if this is the case, count the items and see if
    # it exceeds our maxheight. If so, set the listbox
    # size to maxheight...
    set nitems [$widgets(listbox) size]
    if {$nitems > $options(-maxheight)} {
      # tweak the height of the listbox
      $widgets(listbox) configure -height $options(-maxheight)
    } else {
      # un-tweak the height of the listbox
      $widgets(listbox) configure -height 0
    }
    # update idletasks
  }

  # compute height and width of the dropdown list
  set bd [$widgets(dropdown) cget -borderwidth]
  set height [expr {[winfo reqheight $widgets(dropdown)] + $bd + $bd}]
  if {[string length $options(-dropdownwidth)] == 0 ||
    $options(-dropdownwidth) == 0} {
    set width [winfo width $widgets(this)]
  } else {
    set m [font measure [$widgets(listbox) cget -font] "m"]
    set width [expr {$options(-dropdownwidth) * $m}]
  }

  # figure out where to place it on the screen, trying to take into
  # account we may be running under some virtual window manager
  set screenWidth  [winfo screenwidth $widgets(this)]
  set screenHeight [winfo screenheight $widgets(this)]
  set rootx        [winfo rootx $widgets(this)]
  set rooty        [winfo rooty $widgets(this)]
  set vrootx       [winfo vrootx $widgets(this)]
  set vrooty       [winfo vrooty $widgets(this)]

  # the x coordinate is simply the rootx of our widget, adjusted for
  # the virtual window. We won't worry about whether the window will
  # be offscreen to the left or right -- we want the illusion that it
  # is part of the entry widget, so if part of the entry widget is off-
  # screen, so will the list. If you want to change the behavior,
  # simply change the if statement... (and be sure to update this
  # comment!)
  set x  [expr {$rootx + $vrootx}]
  if {0} {
    set rightEdge [expr {$x + $width}]
    if {$rightEdge > $screenWidth} {
      set x [expr {$screenWidth - $width}]
    }
    if {$x < 0} {set x 0}
  }

  # the y coordinate is the rooty plus vrooty offset plus
  # the height of the static part of the widget plus 1 for a
  # tiny bit of visual separation...
  set y [expr {$rooty + $vrooty + [winfo reqheight $widgets(this)] + 1}]
  set bottomEdge [expr {$y + $height}]

  if {$bottomEdge >= $screenHeight} {
    # ok. Fine. Pop it up above the entry widget isntead of
    # below.
    set y [expr {($rooty - $height - 1) + $vrooty}]

    if {$y < 0} {
      # this means it extends beyond our screen. How annoying.
      # Now we'll try to be real clever and either pop it up or
      # down, depending on which way gives us the biggest list.
      # then, we'll trim the list to fit and force the use of
      # a scrollbar

      # (sadly, for windows users this measurement doesn't
      # take into consideration the height of the taskbar,
      # but don't blame me -- there isn't any way to detect
      # it or figure out its dimensions. The same probably
      # applies to any window manager with some magic windows
      # glued to the top or bottom of the screen)

      if {$rooty > [expr {$screenHeight / 2}]} {
        # we are in the lower half of the screen --
        # pop it up. Y is zero; that parts easy. The height
        # is simply the y coordinate of our widget, minus
        # a pixel for some visual separation. The y coordinate
        # will be the topof the screen.
        set y 1
        set height [expr {$rooty - 1 - $y}]

      } else {
        # we are in the upper half of the screen --
        # pop it down
        set y [expr {$rooty + $vrooty + \
                [winfo reqheight $widgets(this)] + 1}]
        set height [expr {$screenHeight - $y}]
      }

      # force a scrollbar
      HandleScrollbar $widgets(this) crop
    }
  }

  if {$y < 0} {
    # hmmm. Bummer.
    set y 0
    set height $screenheight
  }

  set geometry [format "=%dx%d+%d+%d" $width $height $x $y]

  return $geometry
}

# ::combobox::DoInternalWidgetCommand --
#
#    perform an internal widget command, then mung any error results
#    to look like it came from our megawidget. A lot of work just to
#    give the illusion that our megawidget is an atomic widget
#
# Arguments:
#
#    w           widget pathname
#    subwidget   pathname of the subwidget
#    command     subwidget command to be executed
#    args        arguments to the command
#
# Returns:
#
#    The result of the subwidget command, or an error

proc ::combobox::DoInternalWidgetCommand {w subwidget command args} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  set subcommand $command
  set command [concat $widgets($subwidget) $command $args]
  if {[catch $command result]} {
    # replace the subwidget name with the megawidget name
    regsub $widgets($subwidget) $result $widgets(this) result

    # replace specific instances of the subwidget command
    # with our megawidget command
    switch $subwidget,$subcommand {
      listbox,index  {regsub "index"  $result "list index"  result}
      listbox,insert {regsub "insert" $result "list insert" result}
      listbox,delete {regsub "delete" $result "list delete" result}
      listbox,get    {regsub "get"    $result "list get"    result}
      listbox,size   {regsub "size"   $result "list size"   result}
    }
    error $result

  } else {
    return $result
  }
}


# ::combobox::WidgetProc --
#
#    This gets uses as the widgetproc for an combobox widget.
#    Notice where the widget is created and you'll see that the
#    actual widget proc merely evals this proc with all of the
#    arguments intact.
#
#    Note that some widget commands are defined "inline" (ie:
#    within this proc), and some do most of their work in
#    separate procs. This is merely because sometimes it was
#    easier to do it one way or the other.
#
# Arguments:
#
#    w         widget pathname
#    command   widget subcommand
#    args      additional arguments; varies with the subcommand
#
# Results:
#
#    Performs the requested widget command

proc ::combobox::WidgetProc {w command args} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options
  upvar ::combobox::${w}::oldFocus oldFocus
  upvar ::combobox::${w}::oldFocus oldGrab

  set command [::combobox::Canonize $w command $command]

  # this is just shorthand notation...
  set doWidgetCommand \
        [list ::combobox::DoInternalWidgetCommand $widgets(this)]

  if {$command == "list"} {
    # ok, the next argument is a list command; we'll
    # rip it from args and append it to command to
    # create a unique internal command
    #
    # NB: because of the sloppy way we are doing this,
    # we'll also let the user enter our secret command
    # directly (eg: listinsert, listdelete), but we
    # won't document that fact
    set command "list-[lindex $args 0]"
    set args [lrange $args 1 end]
  }

  set result ""

  # many of these commands are just synonyms for specific
  # commands in one of the subwidgets. We'll get them out
  # of the way first, then do the custom commands.
  switch $command {
    bbox -
    delete -
    get -
    icursor -
    index -
    insert -
    scan -
    selection -
    xview {
      set result [eval $doWidgetCommand entry $command $args]
    }
    list-get {set result [eval $doWidgetCommand listbox get $args]}
    list-index {set result [eval $doWidgetCommand listbox index $args]}
    list-size {set result [eval $doWidgetCommand listbox size $args]}

    select {
      if {[llength $args] == 1} {
        set index [lindex $args 0]
        set result [Select $widgets(this) $index]
      } else {
        error "usage: $w select index"
      }
    }

    subwidget {
      set knownWidgets [list button entry listbox dropdown vsb]
      if {[llength $args] == 0} {
        return $knownWidgets
      }

      set name [lindex $args 0]
      if {[lsearch $knownWidgets $name] != -1} {
        set result $widgets($name)
      } else {
        error "unknown subwidget $name"
      }
    }

    curselection {
      set result [eval $doWidgetCommand listbox curselection]
    }

    list-insert {
      eval $doWidgetCommand listbox insert $args
      set result [HandleScrollbar $w "grow"]
    }

    list-delete {
      eval $doWidgetCommand listbox delete $args
      set result [HandleScrollbar $w "shrink"]
    }

    toggle {
      # ignore this command if the widget is disabled...
      if {$options(-state) == "disabled"} return

      # pops down the list if it is not, hides it
      # if it is...
      if {[winfo ismapped $widgets(dropdown)]} {
        set result [$widgets(this) close]
      } else {
        set result [$widgets(this) open]
      }
    }

    open {
      # if this is an editable combobox, the focus should
      # be set to the entry widget
      if {$options(-editable)} {
        focus $widgets(entry)
        $widgets(entry) select range 0 end
        $widgets(entry) icursor end
      }

      # if we are disabled, we won't allow this to happen
      if {$options(-state) == "disabled"} {
        return 0
      }

      # if there is a -opencommand, execute it now
      if {[string length $options(-opencommand)] > 0} {
        # hmmm... should I do a catch, or just let the normal
        # error handling handle any errors? For now, the latter...
        uplevel \#0 $options(-opencommand)
      }

      # compute the geometry of the window to pop up, and set
      # it, and force the window manager to take notice
      # (even if it is not presently visible).
      #
      # this isn't strictly necessary if the window is already
      # mapped, but we'll go ahead and set the geometry here
      # since its harmless and *may* actually reset the geometry
      # to something better in some weird case.
      set geometry [::combobox::ComputeGeometry $widgets(this)]
      wm geometry $widgets(dropdown) $geometry
      #update idletasks

      # if we are already open, there's nothing else to do
      if {[winfo ismapped $widgets(dropdown)]} {
        return 0
      }

      # save the widget that currently has the focus; we'll restore
      # the focus there when we're done
      set oldFocus [focus]

      # ok, tweak the visual appearance of things and
      # make the list pop up
      $widgets(button) configure -relief sunken
      wm deiconify $widgets(dropdown)
      update idletasks
      raise $widgets(dropdown)

      # force focus to the entry widget so we can handle keypress
      # events for traversal
      focus -force $widgets(entry)

      # select something by default, but only if its an
      # exact match...
      ::combobox::Find $widgets(this) 1

      # save the current grab state for the display containing this
      # widget. We'll restore it when we close the dropdown list
      set status "none"
      set grab [grab current $widgets(this)]
      if {$grab != ""} {set status [grab status $grab]}
      set oldGrab [list $grab $status]
      unset grab status

      # *gasp* do a global grab!!! Mom always told me not to
      # do things like this, but sometimes a man's gotta do
      # what a man's gotta do.
      grab -global $widgets(this)

      # fake the listbox into thinking it has focus. This is
      # necessary to get scanning initialized properly in the
      # listbox.
      event generate $widgets(listbox) <B1-Enter>

      return 1
    }

    close {
      # if we are already closed, don't do anything...
      if {![winfo ismapped $widgets(dropdown)]} {
        return 0
      }

      # restore the focus and grab, but ignore any errors...
      # we're going to be paranoid and release the grab before
      # trying to set any other grab because we really really
      # really want to make sure the grab is released.
      catch {focus $oldFocus} result
      catch {grab release $widgets(this)}
      catch {
        set status [lindex $oldGrab 1]
        if {$status == "global"} {
          grab -global [lindex $oldGrab 0]
        } elseif {$status == "local"} {
          grab [lindex $oldGrab 0]
        }
        unset status
      }

      # hides the listbox
      $widgets(button) configure -relief raised
      wm withdraw $widgets(dropdown)

      # select the data in the entry widget. Not sure
      # why, other than observation seems to suggest that's
      # what windows widgets do.
      set editable [::combobox::GetBoolean $options(-editable)]
      if {$editable} {
        $widgets(entry) selection range 0 end
        $widgets(button) configure -relief raised
      }


      # magic tcl stuff (see tk.tcl in the distribution
      # lib directory)
      ::combobox::tkCancelRepeat

      return 1
    }

    cget {
      if {[llength $args] != 1} {
        error "wrong # args: should be $w cget option"
      }
      set opt [::combobox::Canonize $w option [lindex $args 0]]

      if {$opt == "-value"} {
        set result [$widgets(entry) get]
      } else {
        set result $options($opt)
      }
    }

    configure {
      set result [eval ::combobox::Configure {$w} $args]
    }

    default {
      error "bad option \"$command\""
    }
  }

  return $result
}

# ::combobox::Configure --
#
#    Implements the "configure" widget subcommand
#
# Arguments:
#
#    w      widget pathname
#    args   zero or more option/value pairs (or a single option)
#
# Results:
#
#    Performs typcial "configure" type requests on the widget

proc ::combobox::Configure {w args} {
  variable widgetOptions
  variable defaultEntryCursor

  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  if {[llength $args] == 0} {
    # hmmm. User must be wanting all configuration information
    # note that if the value of an array element is of length
    # one it is an alias, which needs to be handled slightly
    # differently
    set results {}
    foreach opt [lsort [array names widgetOptions]] {
      if {[llength $widgetOptions($opt)] == 1} {
        set alias $widgetOptions($opt)
        set optName $widgetOptions($alias)
        lappend results [list $opt $optName]
      } else {
        set optName  [lindex $widgetOptions($opt) 0]
        set optClass [lindex $widgetOptions($opt) 1]
        set default [option get $w $optName $optClass]
        if {[info exists options($opt)]} {
          lappend results [list $opt $optName $optClass \
                             $default $options($opt)]
        } else {
            lappend results [list $opt $optName $optClass \
                              $default ""]
        }
      }
    }

    return $results
  }

  # one argument means we are looking for configuration
  # information on a single option
  if {[llength $args] == 1} {
    set opt [::combobox::Canonize $w option [lindex $args 0]]
    set optName  [lindex $widgetOptions($opt) 0]
    set optClass [lindex $widgetOptions($opt) 1]
    set default [option get $w $optName $optClass]
    set results [list $opt $optName $optClass $default $options($opt)]
    return $results
  }

  # if we have an odd number of values, bail.
  if {[expr {[llength $args]%2}] == 1} {
    # hmmm. An odd number of elements in args
    error "value for \"[lindex $args end]\" missing"
  }

  # Great. An even number of options. Let's make sure they
  # are all valid before we do anything. Note that Canonize
  # will generate an error if it finds a bogus option; otherwise
  # it returns the canonical option name
  foreach {name value} $args {
    set name [::combobox::Canonize $w option $name]
    set opts($name) $value
  }

  # process all of the configuration options
  # some (actually, most) options require us to
  # do something, like change the attributes of
  # a widget or two. Here's where we do that...
  #
  # note that the handling of disabledforeground and
  # disabledbackground is a little wonky. First, we have
  # to deal with backwards compatibility (ie: tk 8.3 and below
  # didn't have such options for the entry widget), and
  # we have to deal with the fact we might want to disable
  # the entry widget but use the normal foreground/background
  # for when the combobox is not disabled, but not editable either.

  set updateVisual 0
  foreach option [array names opts] {
    set newValue $opts($option)
    if {[info exists options($option)]} {
      set oldValue $options($option)
    }

    switch -- $option {

      -buttonbackground {
        $widgets(button) configure -background $newValue
      }

      -background {
        set updateVisual 1
        set options($option) $newValue
      }

      -borderwidth {
        $widgets(frame) configure -borderwidth $newValue
        set options($option) $newValue
      }

      -command {
        # nothing else to do...
        set options($option) $newValue
      }

      -commandstate {
        # do some value checking...
        if {$newValue != "normal" && $newValue != "disabled"} {
          set options($option) $oldValue
          set message "bad state value \"$newValue\";"
          append message " must be normal or disabled"
          error $message
        }
        set options($option) $newValue
      }

      -cursor {
        # This is disabled since it does not work well with our busy cursor routine.
        #$widgets(frame) configure -cursor $newValue
        #$widgets(entry) configure -cursor $newValue
        #$widgets(listbox) configure -cursor $newValue
        set options($option) $newValue
      }

      -disabledforeground {
        set updateVisual 1
        set options($option) $newValue
      }

      -disabledbackground {
        set updateVisual 1
        set options($option) $newValue
      }

      -dropdownwidth {
        set options($option) $newValue
      }

      -editable {
        set updateVisual 1
        if {$newValue} {
          # it's editable...
          $widgets(entry) configure \
            -state normal \
            -cursor $defaultEntryCursor
        } else {
          $widgets(entry) configure \
            -state disabled \
            -cursor $options(-cursor)
        }
        set options($option) $newValue
      }

      -elementborderwidth {
        $widgets(button) configure -borderwidth $newValue
        $widgets(vsb) configure -borderwidth $newValue
        $widgets(dropdown) configure -borderwidth $newValue
        set options($option) $newValue
      }

      -font {
        $widgets(entry) configure -font $newValue
        $widgets(listbox) configure -font $newValue
        set options($option) $newValue
      }

      -foreground {
        set updateVisual 1
        set options($option) $newValue
      }

      -height {
        $widgets(listbox) configure -height $newValue
        HandleScrollbar $w
        set options($option) $newValue
      }

      -highlightbackground {
        $widgets(frame) configure -highlightbackground $newValue
        set options($option) $newValue
      }

      -highlightcolor {
        $widgets(frame) configure -highlightcolor $newValue
        set options($option) $newValue
      }

      -highlightthickness {
        $widgets(frame) configure -highlightthickness $newValue
        set options($option) $newValue
      }

      -image {
        if {[string length $newValue] > 0} {
          puts "old button width: [$widgets(button) cget -width]"
          $widgets(button) configure \
            -image $newValue \
            -width [expr {[image width $newValue] + 2}]
          puts "new button width: [$widgets(button) cget -width]"

        } else {
          $widgets(button) configure -image ::combobox::bimage
        }
        set options($option) $newValue
      }

      -justify {
        $widgets(entry) configure -justify $newValue
      }

      -listvar {
        if {[catch {$widgets(listbox) cget -listvar}]} {
          return -code error \
            "-listvar not supported with this version of tk"
        }
        $widgets(listbox) configure -listvar $newValue
        set options($option) $newValue
      }

      -maxheight {
        # ComputeGeometry may dork with the actual height
        # of the listbox, so let's undork it
        $widgets(listbox) configure -height $options(-height)
        HandleScrollbar $w
        set options($option) $newValue
      }

      -opencommand {
        # nothing else to do...
        set options($option) $newValue
      }

      -relief {
        $widgets(frame) configure -relief $newValue
        set options($option) $newValue
      }

      -selectbackground {
        $widgets(entry) configure -selectbackground $newValue
        $widgets(listbox) configure -selectbackground $newValue
        set options($option) $newValue
      }

      -selectborderwidth {
        $widgets(entry) configure -selectborderwidth $newValue
        $widgets(listbox) configure -selectborderwidth $newValue
        set options($option) $newValue
      }

      -selectforeground {
        $widgets(entry) configure -selectforeground $newValue
        $widgets(listbox) configure -selectforeground $newValue
        set options($option) $newValue
      }

      -state {
        if {$newValue == "normal"} {
          set updateVisual 1
          # it's enabled

          set editable [::combobox::GetBoolean $options(-editable)]
          if {$editable} {
            $widgets(entry) configure -state normal
            $widgets(entry) configure -takefocus 1
          }

          # note that $widgets(button) is actually a label,
          # not a button. And being able to disable labels
          # wasn't possible until tk 8.3. (makes me wonder
          # why I chose to use a label, but that answer is
          # lost to antiquity)
          if {[info patchlevel] >= 8.3} {
            $widgets(button) configure -state normal
          }

        } elseif {$newValue == "disabled"}  {
          set updateVisual 1
          # it's disabled
          $widgets(entry) configure -state disabled
          $widgets(entry) configure -takefocus 0
          # note that $widgets(button) is actually a label,
          # not a button. And being able to disable labels
          # wasn't possible until tk 8.3. (makes me wonder
          # why I chose to use a label, but that answer is
          # lost to antiquity)
          if {$::tcl_version >= 8.3} {
            $widgets(button) configure -state disabled
          }

        } else {
          set options($option) $oldValue
          set message "bad state value \"$newValue\";"
          append message " must be normal or disabled"
          error $message
        }

        set options($option) $newValue
      }

      -takefocus {
        $widgets(entry) configure -takefocus $newValue
        set options($option) $newValue
      }

      -textvariable {
        $widgets(entry) configure -textvariable $newValue
        set options($option) $newValue
      }

      -value {
        ::combobox::SetValue $widgets(this) $newValue
        set options($option) $newValue
      }

      -width {
        $widgets(entry) configure -width $newValue
        $widgets(listbox) configure -width $newValue
        set options($option) $newValue
      }

      -xscrollcommand {
        $widgets(entry) configure -xscrollcommand $newValue
        set options($option) $newValue
      }
    }

    if {$updateVisual} {UpdateVisualAttributes $w}
  }
}

# ::combobox::UpdateVisualAttributes --
#
# sets the visual attributes (foreground, background mostly)
# based on the current state of the widget (normal/disabled,
# editable/non-editable)
#
# why a proc for such a simple thing? Well, in addition to the
# various states of the widget, we also have to consider the
# version of tk being used -- versions from 8.4 and beyond have
# the notion of disabled foreground/background options for various
# widgets. All of the permutations can get nasty, so we encapsulate
# it all in one spot.
#
# note also that we don't handle all visual attributes here; just
# the ones that depend on the state of the widget. The rest are
# handled on a case by case basis
#
# Arguments:
#    w                widget pathname
#
# Returns:
#    empty string

proc ::combobox::UpdateVisualAttributes {w} {
  upvar ::combobox::${w}::widgets     widgets
  upvar ::combobox::${w}::options     options

  if {$options(-state) == "normal"} {
    set foreground $options(-foreground)
    set background $options(-background)
  } elseif {$options(-state) == "disabled"} {
    set foreground $options(-disabledforeground)
    set background $options(-disabledbackground)
  }

  $widgets(entry)   configure -foreground $foreground -background $background
  $widgets(listbox) configure -foreground $foreground -background $background
  $widgets(button)  configure -foreground $foreground
  $widgets(vsb)     configure -background $background -troughcolor $background
  $widgets(frame)   configure -background $background

  # we need to set the disabled colors in case our widget is disabled.
  # We could actually check for disabled-ness, but we also need to
  # check whether we're enabled but not editable, in which case the
  # entry widget is disabled but we still want the enabled colors. It's
  # easier just to set everything and be done with it.

  if {$::tcl_version >= 8.4} {
    $widgets(entry) configure \
      -disabledforeground $foreground \
      -disabledbackground $background
    $widgets(button)  configure -disabledforeground $foreground
    $widgets(listbox) configure -disabledforeground $foreground
  }
}

# ::combobox::SetValue --
#
#    sets the value of the combobox and calls the -command,
#    if defined
#
# Arguments:
#
#    w          widget pathname
#    newValue   the new value of the combobox
#
# Returns
#
#    Empty string

proc ::combobox::SetValue {w newValue} {
  upvar ::combobox::${w}::widgets     widgets
  upvar ::combobox::${w}::options     options
  upvar ::combobox::${w}::ignoreTrace ignoreTrace
  upvar ::combobox::${w}::oldValue    oldValue

  if {[info exists options(-textvariable)] \
        && [string length $options(-textvariable)] > 0} {
    set variable ::$options(-textvariable)
    set $variable $newValue
  } else {
    set oldstate [$widgets(entry) cget -state]
    $widgets(entry) configure -state normal
    $widgets(entry) delete 0 end
    $widgets(entry) insert 0 $newValue
    $widgets(entry) configure -state $oldstate
  }

  # set our internal textvariable; this will cause any public
  # textvariable (ie: defined by the user) to be updated as
  # well
#  set ::combobox::${w}::entryTextVariable $newValue

  # redefine our concept of the "old value". Do it before running
  # any associated command so we can be sure it happens even
  # if the command somehow fails.
  set oldValue $newValue


  # call the associated command. The proc will handle whether or
  # not to actually call it, and with what args
  CallCommand $w $newValue

  return ""
}

# ::combobox::CallCommand --
#
#   calls the associated command, if any, appending the new
#   value to the command to be called.
#
# Arguments:
#
#    w         widget pathname
#    newValue  the new value of the combobox
#
# Returns
#
#    empty string

proc ::combobox::CallCommand {w newValue} {
  upvar ::combobox::${w}::widgets widgets
  upvar ::combobox::${w}::options options

  # call the associated command, if defined and -commandstate is
  # set to "normal"
  if {$options(-commandstate) == "normal" && \
        [string length $options(-command)] > 0} {
    set args [list $widgets(this) $newValue]
    uplevel \#0 $options(-command) $args
  }
}


# ::combobox::GetBoolean --
#
#     returns the value of a (presumably) boolean string (ie: it should
#     do the right thing if the string is "yes", "no", "true", 1, etc
#
# Arguments:
#
#     value       value to be converted
#     errorValue  a default value to be returned in case of an error
#
# Returns:
#
#     a 1 or zero, or the value of errorValue if the string isn't
#     a proper boolean value

proc ::combobox::GetBoolean {value {errorValue 1}} {
  if {[catch {expr {([string trim $value])?1:0}} res]} {
    return $errorValue
  } else {
    return $res
  }
}

# ::combobox::convert --
#
#     public routine to convert %x, %y and %W binding substitutions.
#     Given an x, y and or %W value relative to a given widget, this
#     routine will convert the values to be relative to the combobox
#     widget. For example, it could be used in a binding like this:
#
#     bind .combobox <blah> {doSomething [::combobox::convert %W -x %x]}
#
#     Note that this procedure is *not* exported, but is intended for
#     public use. It is not exported because the name could easily
#     clash with existing commands.
#
# Arguments:
#
#     w     a widget path; typically the actual result of a %W
#           substitution in a binding. It should be either a
#           combobox widget or one of its subwidgets
#
#     args  should one or more of the following arguments or
#           pairs of arguments:
#
#           -x <x>      will convert the value <x>; typically <x> will
#                       be the result of a %x substitution
#           -y <y>      will convert the value <y>; typically <y> will
#                       be the result of a %y substitution
#           -W (or -w)  will return the name of the combobox widget
#                       which is the parent of $w
#
# Returns:
#
#     a list of the requested values. For example, a single -w will
#     result in a list of one items, the name of the combobox widget.
#     Supplying "-x 10 -y 20 -W" (in any order) will return a list of
#     three values: the converted x and y values, and the name of
#     the combobox widget.

proc ::combobox::convert {w args} {
  set result {}
  if {![winfo exists $w]} {
    error "window \"$w\" doesn't exist"
  }

  while {[llength $args] > 0} {
    set option [lindex $args 0]
    set args [lrange $args 1 end]

    switch -exact -- $option {
      -x {
        set value [lindex $args 0]
        set args [lrange $args 1 end]
        set win $w
        while {[winfo class $win] != "Combobox"} {
          incr value [winfo x $win]
          set win [winfo parent $win]
          if {$win == "."} break
        }
        lappend result $value
      }

      -y {
        set value [lindex $args 0]
        set args [lrange $args 1 end]
        set win $w
        while {[winfo class $win] != "Combobox"} {
          incr value [winfo y $win]
          set win [winfo parent $win]
          if {$win == "."} break
        }
        lappend result $value
      }

      -w -
      -W {
        set win $w
        while {[winfo class $win] != "Combobox"} {
          set win [winfo parent $win]
          if {$win == "."} break;
        }
        lappend result $win
      }
    }
  }

  return $result
}

# ::combobox::Canonize --
#
#    takes a (possibly abbreviated) option or command name and either
#    returns the canonical name or an error
#
# Arguments:
#
#    w        widget pathname
#    object   type of object to canonize; must be one of "command",
#             "option", "scan command" or "list command"
#    opt      the option (or command) to be canonized
#
# Returns:
#
#    Returns either the canonical form of an option or command,
#    or raises an error if the option or command is unknown or
#    ambiguous.

proc ::combobox::Canonize {w object opt} {
  variable widgetOptions
  variable columnOptions
  variable widgetCommands
  variable listCommands
  variable scanCommands

  switch $object {
    command {
      if {[lsearch -exact $widgetCommands $opt] >= 0} {
        return $opt
      }

      # command names aren't stored in an array, and there
      # isn't a way to get all the matches in a list, so
      # we'll stuff the commands in a temporary array so
      # we can use [array names]
      set list $widgetCommands
      foreach element $list {
        set tmp($element) ""
      }
      set matches [array names tmp ${opt}*]
    }

    {list command} {
      if {[lsearch -exact $listCommands $opt] >= 0} {
        return $opt
      }

      set list $listCommands
      foreach element $list {
        set tmp($element) ""
      }
      set matches [array names tmp ${opt}*]
    }

    {scan command} {
      if {[lsearch -exact $scanCommands $opt] >= 0} {
        return $opt
      }

      set list $scanCommands
      foreach element $list {
        set tmp($element) ""
      }
      set matches [array names tmp ${opt}*]
    }

    option {
      if {[info exists widgetOptions($opt)] \
            && [llength $widgetOptions($opt)] == 2} {
        return $opt
      }
      set list [array names widgetOptions]
      set matches [array names widgetOptions ${opt}*]
    }

  }

  if {[llength $matches] == 0} {
    set choices [HumanizeList $list]
    error "unknown $object \"$opt\"; must be one of $choices"

  } elseif {[llength $matches] == 1} {
    set opt [lindex $matches 0]

    # deal with option aliases
    switch $object {
      option {
        set opt [lindex $matches 0]
        if {[llength $widgetOptions($opt)] == 1} {
          set opt $widgetOptions($opt)
        }
      }
    }

    return $opt

  } else {
    set choices [HumanizeList $list]
    error "ambiguous $object \"$opt\"; must be one of $choices"
  }
}

# ::combobox::HumanizeList --
#
#    Returns a human-readable form of a list by separating items
#    by columns, but separating the last two elements with "or"
#    (eg: foo, bar or baz)
#
# Arguments:
#
#    list    a valid tcl list
#
# Results:
#
#    A string which as all of the elements joined with ", " or
#    the word " or "

proc ::combobox::HumanizeList {list} {

  if {[llength $list] == 1} {
    return [lindex $list 0]
  } else {
    set list [lsort $list]
    set secondToLast [expr {[llength $list] -2}]
    set most [lrange $list 0 $secondToLast]
    set last [lindex $list end]

    return "[join $most {, }] or $last"
  }
}

# This is some backwards-compatibility code to handle TIP 44
# (http://purl.org/tcl/tip/44.html). For all private tk commands
# used by this widget, we'll make duplicates of the procs in the
# combobox namespace.
#
# I'm not entirely convinced this is the right thing to do. I probably
# shouldn't even be using the private commands. Then again, maybe the
# private commands really should be public. Oh well; it works so it
# must be OK...
#
foreach command {TabToWindow CancelRepeat ListboxUpDown} {
  if {[llength [info commands ::combobox::tk$command]] == 1} break;

  set tmp [info commands tk$command]
  set proc ::combobox::tk$command
  if {[llength [info commands tk$command]] == 1} {
    set command [namespace which [lindex $tmp 0]]
    proc $proc {args} "uplevel $command \$args"
  } else {
    if {[llength [info commands ::tk::$command]] == 1} {
      proc $proc {args} "uplevel ::tk::$command \$args"
    }
  }
}

# end of combobox.tcl


# ::file::Exit
#
#    Prompt for confirmation then exit.
#
proc ::file::Exit {}  {
  # 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)

  # Only ask before exiting if there are unsaved changes:
  if {$unsavedCount > 0} {
    set answer [tk_messageBox -title "Scid: [tr FileExit]" \
                  -message $msg -type yesno -icon question]
    if {$answer != "yes"} { return }
  }
  if {$::optionsAutoSave} { .menu.options invoke [tr OptionsSave] }
  ::recentFiles::save
  ::utils::history::Save
  destroy .
}

proc ::file::ExitFast {} {
  if {$::optionsAutoSave} { .menu.options invoke [tr OptionsSave] }
  ::recentFiles::save
  destroy .
}

# ::file::New
#
#   Opens file-save dialog and creates a new database.
#
proc ::file::New {} {
  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
    }
  }
  ::windows::gamelist::Refresh
  ::tree::refresh
  updateMenuStates
  updateTitle
  updateStatusBar
}

# ::file::Open
#
#    Opens file-open dialog and opens the selected Scid database.
#
proc ::file::Open {{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"} {
    ::file::Upgrade [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 {[string match "*.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}
    flipBoardForPlayerNames $::myPlayerNames
  }
  unbusyCursor .
  set glstart 1
  ::windows::gamelist::Refresh
  ::tree::refresh
  ::windows::stats::Refresh
  updateMenuStates
  updateBoard -pgn
  updateTitle
  updateStatusBar
}

# ::file::Upgrade
#
#   Upgrades an old (version 2) Scid database to version 3.
#
proc ::file::Upgrade {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 }
    ::file::Open "$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
  }
  ::file::Open "$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
}


# ::file::Close:
#   Closes the active base.
#
proc ::file::Close {{base -1}} {
  # Remember the current base:
  set current [sc_base current]
  if {$base < 0} { set base $current] }

  # Switch to the base which will be closed, and check for changes:
  sc_base switch $base
  if {[sc_base inUse]} {
    if {![::game::ConfirmDiscard]} {
      sc_base switch $current
      return
    }
    sc_base close
    # Now switch back to the original base
    sc_base switch $current

    ::windows::gamelist::Refresh
    # Close Tree and Email windows whenever a base is closed/switched:
    #if {[winfo exists .treeWin]} { destroy .treeWin }
    if {[winfo exists .emailWin]} { destroy .emailWin }
    ::pgn::Refresh
    updateBoard
  }
  updateMenuStates
  updateStatusBar
  updateTitle
}


proc ::file::SwitchToBase {b} {
  sc_base switch $b
  # Close email window when a base is switched:
  if {[winfo exists .emailWin]} { destroy .emailWin }
  updateBoard -pgn
  updateTitle
  updateMenuStates
  updateStatusBar
  ::windows::gamelist::Refresh
}

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

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

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

proc ::file::finder::Open {} {
  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 ::file::finder::data(recurse) -onvalue 1 -offvalue 0 \
    -command ::file::finder::Refresh
  $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 ::file::finder::data(sort) -value $value \
      -command {::file::finder::Refresh -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 ::file::finder::data($type) -onvalue 1 -offvalue 0 \
      -command ::file::finder::Refresh
  }
  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 ::file::finder::data(menu) [tk_optionMenu $w.d.mb ::file::finder::data(dir) ""]
  $w.d.mb configure -font font_Small -width 1 -anchor e
  $::file::finder::data(menu) configure -font font_Small
  button $w.d.up -image ::file::finder::updir -command {::file::finder::Refresh ..}
  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
  bindMouseWheel $w $w.t.text

  checkbutton $w.b.sub -text [tr FinderFileSubdirs] \
    -variable ::file::finder::data(recurse) -onvalue 1 -offvalue 0 \
    -command ::file::finder::Refresh
  dialogbutton $w.b.stop -textvar ::tr(Stop) -command {set finder(stop) 1 }
  dialogbutton $w.b.help -textvar ::tr(Help) -command {helpWindow Finder}
  dialogbutton $w.b.close -textvar ::tr(Close) -command "destroy $w"
  bind $w <Escape> "$w.b.stop invoke"

  pack $w.b -side bottom -fill x
  packbuttons right $w.b.close $w.b.help $w.b.stop
  packbuttons left $w.b.sub
  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
  ::file::finder::ConfigMenus
  ::file::finder::Refresh
}

proc ::file::finder::Refresh {{newdir ""}} {
  variable data
  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 $data(dir)] }
  if {$newdir != ""} { set data(dir) $newdir }

  busyCursor .
  set data(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 $data(flist)
  } else {
    set flist [::file::finder::GetFiles $data(dir)]
    set data(flist) $flist
  }

  switch $data(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 ::file::finder::Refresh $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 $data(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 ::file::finder::Refresh $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 data(sort) $v; ::file::finder::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 "$::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 [::utils::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 $data(dir)/$dir/$tail
    $t tag bind f$path <ButtonPress-1> "::file::Open [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 "$data(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:
  $data(menu) delete 0 end
  set mlist {}
  set d {}
  foreach subdir [file split $data(dir)] {
    set d [file join $d $subdir]
    lappend mlist $d
  }
  foreach m $mlist {
    $data(menu) add command -label $m -command "::file::finder::Refresh [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 ::file::finder::ConfigMenus {{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 ::file::finder::GetFiles {dir {len -1}} {
  variable data
  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 data($type)]  &&  $data($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 {$data(stop)} { break }
  }
  if {$data(recurse)} {
    foreach f $dlist {
      foreach i [::file::finder::GetFiles $f $len] {
        lappend flist $i
        update
        if {$data(stop)} { break }
      }
    }
  }
  return $flist
}

# bookmark.tcl:
# Bookmarks list and Recently-used files list in Scid.

set bookmarks(data) {}
set bookmarks(subMenus) 0

# Read the bookmarks file if it exists:
catch {source [scidConfigFile bookmarks]}


namespace eval ::bookmarks {}

# ::bookmarks::PostMenu:
#   Posts the bookmarks toolbar menu.
#
proc ::bookmarks::PostMenu {} {
  .tb.bkm.menu post [winfo pointerx .] [winfo pointery .]
  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::RefreshMenu $menu
  }
}

proc ::bookmarks::RefreshMenu {menu} {
  global bookmarks helpMessage

  ::bookmarks::DeleteChildren $menu
  $menu delete 0 end
  # $menu configure -disabledforeground [$menu cget -foreground]
  set numBookmarkEntries [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 {$numBookmarkEntries == 0} { return }
  $menu add separator

  # Add each bookmark entry:
  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::IndexText $entry]
      } elseif {!$isfolder} {
        $current add command -label [::bookmarks::IndexText $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
}

# ::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 "[::utils::string::Surname [sc_game info white]] - "
  append text "[::utils::string::Surname [sc_game info black]], "
  append text "[::utils::string::CityName [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 year  [lindex $entry 7]
  set site  [lindex $entry 8]
  set round [lindex $entry 9]
  set result [lindex $entry 10]

  set best [sc_game find $gnum $white $black $site $round $year $result]
  if {[catch {::game::Load $best}]} {
    tk_messageBox -icon warning -type ok -parent . \
      -title "Scid" -message "Unable to load game number: $best"
  } else {
    sc_move pgn $ply
    flipBoardForPlayerNames $::myPlayerNames
  }
  ::windows::gamelist::Refresh
  ::tree::refresh
  ::windows::stats::Refresh
  updateMenuStates
  updateBoard -pgn
  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::EditRefresh
  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 -font font_Small -setgrid 1
  scrollbar $w.f.ybar -takefocus 0 -command "$w.f.list yview"
  bind $w.f.list <<ListboxSelect>>  ::bookmarks::EditSelect
  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::IndexText $entry]
  }
  dialogbutton $w.b1.newFolder -text "New submenu" \
    -command {::bookmarks::EditNew folder}
  dialogbutton $w.b1.newGame -text [tr FileBookmarksAdd] \
    -command {::bookmarks::EditNew game}
  if {! [::bookmarks::CanAdd]} { $w.b1.newGame configure -state disabled }
  dialogbutton $w.b1.delete -text $::tr(Delete)  -command ::bookmarks::EditDelete
  button $w.b2.up -image bookmark_up -command {::bookmarks::EditMove up}
  button $w.b2.down -image bookmark_down -command {::bookmarks::EditMove down}
  foreach i [list $w.b2.up $w.b2.down] {
    $i configure -padx 0 -pady 0 -borderwidth 1
  }
  dialogbutton $w.b2.ok -text "OK" -command ::bookmarks::EditDone
  dialogbutton $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::EditDone
#
#    Updates the bookmarks and closes the bookmark editing window.
#
proc ::bookmarks::EditDone {} {
  catch {grab release .bmedit}
  destroy .bmedit
  ::bookmarks::Save
  ::bookmarks::Refresh
}

# ::bookmarks::EditRefresh
#
#   Updates the bookmarks whenever the contents of the bookmark
#   editing entry box are changed.
#
proc ::bookmarks::EditRefresh {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::IndexText $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::EditSelect
#
#   Sets the bookmark editing entry box when a bookmark is selected.
#
proc ::bookmarks::EditSelect {{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::IndexText {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::EditMove
#
#   Moves the selected bookmark "up" or "down" one place.
#
proc ::bookmarks::EditMove {{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::IndexText $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::EditDelete
#
#   Deletes the selected bookmark.
#
proc ::bookmarks::EditDelete {} {
  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::EditNew
#
#   Inserts a new entry ("folder" for a submenu or "game" for the
#   current game) after the selected bookmark.
#
proc ::bookmarks::EditNew {{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::IndexText $entry]
    $list selection clear 0 end
    $list selection set $sel
    $list see $sel
    ::bookmarks::EditSelect
    return
  }
  incr sel
  set bookmarks(data) [linsert $bookmarks(data) $sel $entry]
  $list insert $sel [::bookmarks::IndexText $entry]
  $list selection clear 0 end
  $list selection set $sel
  $list see $sel
  ::bookmarks::EditSelect
}

# ::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 {}
  set filename [scidConfigFile bookmarks]
  if  {[catch {open $filename w} f]} {
    if {$reportError} {
      tk_messageBox -title "Scid" -type ok -icon warning \
        -message "Unable to write bookmarks file: $filename\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
}


# End of file: bookmark.tcl

####################
# 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.

catch {source [scidConfigFile recentfiles]}

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 {}
  set filename [scidConfigFile recentfiles]
  if  {[catch {open $filename w} f]} {
    if {$reportError} {
      tk_messageBox -title "Scid" -type ok -icon warning \
        -message "Unable to write file: $filename\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
      ::windows::gamelist::Refresh
      ::tree::refresh
      ::windows::stats::Refresh
      updateMenuStates
      updateBoard -pgn
      updateTitle
      updateStatusBar
      return
    }
  }
  ::file::Open $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]
    set num [expr {$i + 1} ]
    set underline -1
    if {$num <= 9} { set underline 0 }
    if {$num == 10} { set underline 1 }
    $menu add command -label "$num: $mname" -underline $underline \
      -command [list ::recentFiles::load $fname]
    set ::helpMessage($menu,$idx) "  [file nativename $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]
    set num [expr {$extra + 1} ]
    set underline -1
    if {$num <= 9} { set underline 0 }
    if {$num == 10} { set underline 1 }
    $menu.recentFiles add command -label "$num: $mname" -underline $underline \
      -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
  set mname [file nativename $mname]
  if {[file extension $mname] == [sc_info suffix index]} {
    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]
  set mname [file nativename $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}
}

# 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
  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; updateBoard -pgn"
  bind $w <Control-Down> "sc_epd next $id; updateBoard -pgn; break"
  $m add command -label "Previous position in file" \
    -accelerator "Ctrl+UpArrow" -underline 0 \
    -command "sc_epd prev $id; updateBoard -pgn"
  bind $w <Control-Up> "sc_epd prev $id; updateBoard -pgn; 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
}
### spellchk.tcl
### Part of Scid.
### Copyright (C) 2000-2003 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
    updateBoard -pgn
    ::windows::gamelist::Refresh
  }
  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
}


# maint.tcl:   Maintenance-related functions
# Part of Scid.
# Copyright (C) 2000-2004 Shane Hudson.

namespace eval ::maint {}

### TODO: Move procedures and variables into the maint namespace.
### TODO: Make sub-namespaces (sort, compact, cleaner, etc)


# ::maint::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 ::maint::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
  ::windows::gamelist::Refresh
  ::maint::Refresh
  ::windows::stats::Refresh
}

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
}


set maintWin 0

# ::maint::OpenClose
#
#   Creates the database maintenance window.
#
proc ::maint::OpenClose {} {
  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]}
  frame $w.title.desc
  label $w.title.desc.lab -text $::tr(Description:) -font font_SmallBold
  label $w.title.desc.text -width 1 -font $font -relief sunken -anchor w
  button $w.title.desc.edit -text "[tr Edit]..." -font $font \
    -command ::maint::ChangeBaseDescription
  pack $w.title.desc.lab -side left
  pack $w.title.desc.edit -side right -padx 2
  pack $w.title.desc.text -side left -fill x -expand yes

  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
  grid $w.title.desc -row $row -column 0 -columnspan 5 -sticky we

  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; ::maint::Refresh"
  }
  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 "::maint::SetGameFlags $flag [string tolower $b] 1"
      button $w.$flag.off$b -textvar "::tr($off$b)" -font $font \
        -command "::maint::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 ::maint::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

  dialogbutton $w.buttons.help -textvar ::tr(Help) -command {helpWindow Maintenance}
  dialogbutton $w.buttons.close -textvar ::tr(Close) -command "destroy $w"
  packbuttons right $w.buttons.close $w.buttons.help
  bind $w <Alt-h> "$w.buttons.help invoke"
  bind $w <Alt-c> "destroy $w; break"
  standardShortcuts $w
  ::maint::Refresh
}

proc ::maint::ChangeBaseDescription {} {
  set w .bdesc
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: $::tr(Description): [file tail [sc_base filename]]"
  set font font_Small
  entry $w.entry -width 50 -relief sunken -background white
  $w.entry insert end [sc_base description]
  pack $w.entry -side top -pady 4
  frame $w.b
  button $w.b.ok -text OK -command {
    catch {sc_base description [.bdesc.entry get]}
    grab release .bdesc
    destroy .bdesc
    ::maint::Refresh
  }
  button $w.b.cancel -text $::tr(Cancel) -command "grab release $w; destroy $w"
  pack $w.b -side bottom -fill x
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  wm resizable $w 0 0
  catch {grab $w}
}


proc ::maint::Refresh {} {
  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 [::utils::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 [::utils::percentFormat $deleted $ng]
  $w.title.vmark configure -text [::utils::percentFormat $marked $ng]
  $w.title.vfilter configure -text [::utils::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
  $w.title.desc.text configure -text [sc_base description]

  # 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.title.desc.edit 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
}


set autoloadGame 0
trace variable autoloadGame w {::utils::validate::Integer 9999999 0}

# ::maint::SetAutoloadGame
#
#   Creates a dialog for setting the autoload game number of the
#   current database.
#
proc ::maint::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
  ::utils::win::Centre $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]
      checkbutton $w.g.b$n -text $::tr(Twins$name) \
        -variable twinSettings($n) -onvalue Yes -offvalue No
      #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.b$n -row $row -column $col -sticky w
      incr col
      #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 >= 4} {
        incr row; set col 0
      } else {
        grid [label $w.g.space$n -text "   "] -row $row -column $col
        incr col
      }
    }
    frame $w.players
    label $w.players.label -text $::tr(TwinsPlayers) -font $small
    radiobutton $w.players.yes -variable twinSettings(players) -value Yes \
      -text $::tr(TwinsPlayersExact) -font $small
    radiobutton $w.players.no -variable twinSettings(players) -value No \
      -text $::tr(TwinsPlayersPrefix) -font $small
    
    pack $w.players -side top
    pack $w.players.label $w.players.yes $w.players.no -side left
  }


  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
  set col 0
  foreach n {skipshort undelete setfilter comments variations} \
       name {SkipShort Undelete SetFilter Comments Vars} {
    #label $w.g3.l$n -text "" -font $small
    #radiobutton $w.g3.yes$n -variable twinSettings($n) -value Yes \
    #  -text $::tr(Yes) -font $small
    #radiobutton $w.g3.no$n -variable twinSettings($n) -value No \
    #    -text $::tr(No) -font $small
    checkbutton $w.g3.b$n -text $::tr(Twins$name) -variable twinSettings($n) \
      -onvalue Yes -offvalue No
    grid $w.g3.b$n -row $row -column $col -sticky w
    #grid $w.g3.yes$n -row $row -column 1 -sticky w
    #grid $w.g3.no$n -row $row -column 2 -sticky w
    incr col
    if {$col >= 2} {
      incr row; set col 0
    } else {
      grid [label $w.g3.space$n -text "   "] -row $row -column $col
      incr col
    }
  }
  #$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 font_Bold
  grid $w.g3.ldelete -row $row -column 0 -sticky we -columnspan 3
  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 3

  #foreach g {g2 g3} {
  #  grid columnconfigure $w.$g 0 -weight 1
  #}

  addHorizontalRule $w
  frame $w.b
  dialogbutton $w.b.defaults -textvar ::tr(Defaults) -command {
    array set twinSettings [array get twinSettingsDefaults]
  }
  dialogbutton $w.b.help -text $::tr(Help) -font $small \
    -command "helpWindow Maintenance Twins; focus $w"
  dialogbutton $w.b.go -text $::tr(TwinsDelete) -font $small -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 }
    }
  }

  dialogbutton $w.b.cancel -text $::tr(Cancel) -font $small \
    -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
  packbuttons right  $w.b.cancel $w.b.go
  packbuttons left $w.b.defaults $w.b.help
  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
  }
  ::maint::Refresh
  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)
  frame $w.g
  radiobutton $w.g.all -textvar ::tr(ClassifyAll) \
    -variable classifyOption(AllGames) -value all
  radiobutton $w.g.filter -textvar ::tr(SelectFilterGames) \
    -variable classifyOption(AllGames) -value filter
  set year [::utils::date::today year]
  set month [::utils::date::today month]
  set day [::utils::date::today day]
  radiobutton $w.g.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.g.month -textvar ::tr(ClassifyMonth) \
    -variable classifyOption(AllGames) \
    -value "date:$year.$month.$day"
  radiobutton $w.g.new -textvar ::tr(ClassifyNew) \
    -variable classifyOption(AllGames) -value nocode
  set row 0
  foreach f {all filter year month new} {
    grid $w.g.$f -row $row -column 0 -sticky w
    incr row
  }
  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)
    ::windows::gamelist::Refresh
  }
  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.g -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 -relief sunken
      pack $f.tmt -side bottom -fill x
      autoscrollframe $f.t text $f.t.text \
        -height 16 -width 40 -background white \
        -takefocus 0 -wrap word
      $f.t.text tag configure h -background lightSteelBlue
      pack $f.t -side top -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 {::game::LoadNextPrev previous}
    button $w.b.next -text "Next pair" -underline 0 \
      -command {::game::LoadNextPrev 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> {::game::LoadNextPrev previous}
    bind $w <KeyPress-p> {::game::LoadNextPrev previous}
    bind $w <Alt-n> {::game::LoadNextPrev next}
    bind $w <KeyPress-n> {::game::LoadNextPrev 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
  updateBoard -pgn
  ::windows::gamelist::Refresh
}

# 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 "  [::utils::thousands [lindex $ndata $idx]]"
    incr idx
    label $w.names.u$n -text "  [::utils::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 "  [::utils::string::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 "  [::utils::thousands [lindex $ndata $idx]]"
    incr idx
    set kbytes [expr {int(([lindex $ndata $idx] + 512) / 1024)} ]
    label $w.games.s$g -text "  [::utils::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
  ::windows::gamelist::Refresh
  ::maint::Refresh
}

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
  ::windows::gamelist::Refresh
  ::maint::Refresh
}

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
  ::windows::gamelist::Refresh
  ::maint::Refresh
}

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 [::utils::thousands [lindex $result 0]]
    set g [::utils::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]} {
    raise $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 [::utils::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 \
      [::utils::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
  ::windows::stats::Refresh
}


# 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 8 -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
  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
  # Remove the scrollbar if it is not needed:
  update
  set yview [$w.help.text yview]
  if {[lindex $yview 0] <= 0.01  &&  [lindex $yview 1] >= 0.99} {
      pack forget $w.help.ybar
  }
  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 [::utils::thousands [lindex $result 0]]
      set g [::utils::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
  ::windows::gamelist::Refresh
  ::maint::Refresh
  $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
}


# copyFEN
#
#   Copies the FEN of the current position to the text clipboard.
#
proc copyFEN {} {
  set fen [sc_pos fen]
  # Create a text widget to hold the fen so it can be the owner
  # of the current text selection:
  set w .tempFEN
  if {! [winfo exists $w]} { text $w }
  $w delete 1.0 end
  $w insert end $fen sel
  clipboard clear
  clipboard append $fen
  selection own $w
  selection get
}

# 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 ""
  if {[catch {set fenStr [selection get -selection CLIPBOARD]} ]} {
    catch {set fenStr [selection get -selection PRIMARY]}
  }
  set fenStr [string trim $fenStr]

  set fenExplanation {
FEN is the standard text representation of a chess position.
As an example, the FEN representation of the standard starting position is:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
}

  if {$fenStr == ""} {
    set msg "The current text selection is empty.\n"
    append msg "To paste the start board, select some text that contains\n"
    append msg "a position in FEN notation.\n"
    append msg $fenExplanation
    tk_messageBox -icon info -type ok -title "Scid: Invalid FEN" -message $msg
    return
  }
  if {[catch {sc_game startBoard $fenStr}]} {
    if {[string length $fenStr] > 80} {
      set fenStr [string range $fenStr 0 80]
      append fenStr "..."
    }
    set msg "The current text selection is not a valid chess position in FEN notation.\n"
    append msg "The selected text is:\n\n$fenStr\n"
    append msg $fenExplanation
    tk_messageBox -icon info -type ok -title "Scid: Invalid FEN" -message $msg
    return
  }
  updateBoard -pgn
}

############################################################
### Board setup window:

set setupBd {}
set setupFen {}

# 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.
#
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 {::utils::validate::Integer 999 0}
trace variable epFile w {::utils::validate::Regexp {^(-|[a-h])?$}}
trace variable castling w {::utils::validate::Regexp {^(-|[KQkq]*)$}}


# 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 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 Passant 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:)
  ::combobox::combobox $sr.castle.e -width 5 -background white -textvariable castling
  pack $sr.castle.label $sr.castle.e -side left
  foreach c {KQkq KQ kq -} {
    $sr.castle.e list insert end $c
  }

  frame $sr.ep
  label $sr.ep.label -textvar ::tr(EnPassantFile:)
  ::combobox::combobox $sr.ep.e -width 2 -background white -textvariable epFile
  set epFile {}
  pack $sr.ep.label $sr.ep.e -side left
  foreach f {- a b c d e f g h} {
    $sr.ep.e list insert end $f
  }

  # Set bindings so the Fen string is updated at any change. The "after idle"
  # is needed to ensure any keypress which causes a text edit is processed
  # before we regenerate the FEN text.

  foreach i "$sr.ep.e $sr.castle.e $sr.movenum.e" {
    bind $i <Any-KeyPress> {after idle {set setupFen [makeSetupFen]}}
    bind $i <FocusOut> {
      after idle {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 {
      ::utils::history::AddEntry setupFen $setupFen
      destroy .setup
      updateBoard -pgn
    }
  }
  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 ""}
  ::combobox::combobox .setup.status -relief sunken -textvariable setupFen \
    -font font_Small -background white
  ::utils::history::SetCombobox setupFen .setup.status
  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]
}


# ::game::ConfirmDiscard
#
#   Prompts the user if they want to discard the changes to the
#   current game. Returns 1 if they selected yes, 0 otherwise.
#
proc ::game::ConfirmDiscard {} {
  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
}

# ::game::Clear
#
#   Clears the active game, checking first if it is altered.
#   Updates any affected windows.
#
proc ::game::Clear {} {
  if {![::game::ConfirmDiscard]} { return }
  setTrialMode 0
  sc_game new
  updateBoard -pgn
  updateTitle
  updateMenuStates
}

# ::game::Strip
#
#   Strips all comments or variations from a game
#
proc ::game::Strip {type} {
  if {[catch {sc_game strip $type} result]} {
    tk_messageBox -parent . -type ok -icon info -title "Scid" -message $result
    return
  }
  updateBoard -pgn
  updateTitle
}

# ::game::TruncateBegin
#
proc ::game::TruncateBegin {} {
  if {[catch {sc_game truncate -start} result]} {
    tk_messageBox -parent . -type ok -icon info -title "Scid" -message $result
    return
  }
  updateBoard -pgn
  updateTitle
}

# ::game::Truncate
#
proc ::game::Truncate {} {
  if {[catch {sc_game truncate} result]} {
    tk_messageBox -parent . -type ok -icon info -title "Scid" -message $result
    return
  }
  updateBoard -pgn
  updateTitle
}

# game::LoadNextPrev
#
#   Loads the next or previous filtered game in the database.
#   The parameter <action> should be "previous" or "next".
#
proc ::game::LoadNextPrev {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
  }
  ::game::Load $number
}

# ::game::Reload
#
#   Reloads the current game.
#
proc ::game::Reload {} {
  if {![sc_base inUse]} { return }
  if {[sc_game number] < 1} { return }
  ::game::Load [sc_game number]
}

# ::game::LoadRandom
#
#   Loads a random game from the database.
#
proc ::game::LoadRandom {} {
  set ngames [sc_filter size]
  if {$ngames == 0} { return }
  set r [expr {(int (rand() * $ngames)) + 1} ]
  set gnumber [sc_filter index $r]
  ::game::Load $gnumber
}


# ::game::LoadNumber
#
#    Prompts for the number of the game to load.
#
set ::game::entryLoadNumber ""
trace variable ::game::entryLoadNumber w {::utils::validate::Regexp {^[0-9]*$}}

proc ::game::LoadNumber {} {
  set ::game::entryLoadNumber ""
  if {![sc_base inUse]} { return }
  if {![::game::ConfirmDiscard]} { 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 ::game::entryLoadNumber
  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
  dialogbutton $b.load -text "OK" -command {
    grab release .glnumDialog
    if {[catch {sc_game load $::game::entryLoadNumber} result]} {
      tk_messageBox -type ok -icon info -title "Scid" -message $result
    }
    focus .
    destroy .glnumDialog
    flipBoardForPlayerNames $::myPlayerNames
    updateBoard -pgn
    ::windows::gamelist::Refresh
    updateTitle
  }
  dialogbutton $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .glnumDialog
    destroy .glnumDialog
    focus .
  }
  packbuttons right $b.cancel $b.load

  set x [ expr {[winfo width .] / 4 + [winfo rootx .] }]
  set y [ expr {[winfo height .] / 4 + [winfo rooty .] }]
  wm geometry $w "+$x+$y"

  focus $w.entry
}

# ::game::Load
#
#   Loads a specified game from the active database.
#
proc ::game::Load { selection } {
  # If an invalid game number, just return:
  if {$selection < 1} { return }
  if {$selection > [sc_base numGames]} { return }
  if {![::game::ConfirmDiscard]} { return }
  setTrialMode 0
  sc_game load $selection
  flipBoardForPlayerNames $::myPlayerNames
  updateBoard -pgn
  ::windows::gamelist::Refresh
  updateTitle
}

# ::game::LoadMenu
#
#   Produces a popup dialog for loading a game or other actions
#   such as merging it into the current game.
#
proc ::game::LoadMenu {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; ::game::Load $gnum"
  $m entryconfigure 2 -command "mergeGame $base $gnum"
  event generate $w <ButtonRelease-1>
  $m post $x $y
  event generate $m <ButtonPress-1>
}


# ::game::moveEntryNumber
#
#   Entry variable for GotoMoveNumber dialog.
#
set ::game::moveEntryNumber ""
trace variable ::game::moveEntryNumber w {::utils::validate::Regexp {^[0-9]*$}}

# ::game::GotoMoveNumber
#
#    Prompts for the move number to go to in the current game.
#
proc ::game::GotoMoveNumber {} {
  set ::game::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 ::game::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
  dialogbutton $b.load -text "OK" -command {
    grab release .mnumDialog
    if {$::game::moveEntryNumber > 0} {
      catch {sc_move ply [expr {($::game::moveEntryNumber - 1) * 2}]}
    }
    focus .
    destroy .mnumDialog
    updateBoard -pgn
  }
  dialogbutton $b.cancel -text $::tr(Cancel) -command {
    focus .
    grab release .mnumDialog
    destroy .mnumDialog
    focus .
  }
  packbuttons right $b.cancel $b.load

  set x [ expr {[winfo width .] / 4 + [winfo rootx .] } ]
  set y [ expr {[winfo height .] / 4 + [winfo rooty .] } ]
  wm geometry $w "+$x+$y"

  focus $w.entry
}

####################
# 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
  autoscrollframe $w.t text $w.t.text \
    -foreground black -background white -wrap word \
    -width 45 -height 12 -font font_Small -setgrid 1
  pack $w.t -side right -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"
  frame $w.b.gap -width 3
  button $w.b.autoplay -image autoplay_off -command "::gbrowser::autoplay $n"
  frame $w.b.gap2 -width 3
  set ::gbrowser::flip($n) [::board::isFlipped .board]
  button $w.b.flip -image tb_flip -command "::gbrowser::flip $n"

  pack $w.b.start $w.b.back $w.b.forward $w.b.end $w.b.gap \
    $w.b.autoplay $w.b.gap2 $w.b.flip -side left -padx 3 -pady 1

  set ::gbrowser::autoplay($n) 0

  if {$gnum > 0} {
    button $w.b.load -textvar ::tr(LoadGame) \
      -command "sc_base switch $base; ::game::Load $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] 1

  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

  if {$::gbrowser::autoplay($n)} {
    if {$ply >= $max} {
      ::gbrowser::autoplay $n
    } else {
      after cancel "::gbrowser::update $n +1"
      after $::autoplayDelay "::gbrowser::update $n +1"
    }
  }
}

proc ::gbrowser::autoplay {n} {
  if {$::gbrowser::autoplay($n)} {
    set ::gbrowser::autoplay($n) 0
    .gb$n.b.autoplay configure -image autoplay_off
    return
  } else {
    set ::gbrowser::autoplay($n) 1
    .gb$n.b.autoplay configure -image autoplay_on
    ::gbrowser::update $n +1
  }
}

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


namespace eval ::windows {

    # TODO
}

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

set treeWin 0
set pgnWin 0
set commentWin 0
set filterGraph 0

set nagValue 0

# recordWinSize:
#   Records window width and height, for saving in options file.
#
proc recordWinSize {win} {
  global winWidth winHeight winX winY
  if {![winfo exists $win]} { return }
  set temp [wm geometry $win]

  set n [scan $temp "%dx%d+%d+%d" width height x y]
  if {$n == 4} {
    set winWidth($win) $width
    set winHeight($win) $height
    set winX($win) $x
    set winY($win) $y
  }
}

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

proc setWinSize {win} {
  global winWidth winHeight
  if {[info exists winWidth($win)]  &&  [info exists winHeight($win)]  &&  \
    $winWidth($win) > 0  &&  $winHeight($win) > 0} {
    catch [list wm geometry $win "$winWidth($win)x$winHeight($win)"]
  }
}


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

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

set ::windows::gamelist::isOpen 0
set glstart 1
set glSelection 0
set glNumber 0

array set ::windows::gamelist::names {
  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 overrideredirect .glistExtra 1
wm withdraw .glistExtra
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 ::windows::gamelist::findtext ""
set ::windows::gamelist::goto ""
trace variable ::windows::gamelist::goto w {::utils::validate::Regexp {^[0-9]*$}}


proc ::windows::gamelist::FindText {} {
  global glstart
  variable findtext
  busyCursor .glistWin 1
  ::utils::history::AddEntry ::windows::gamelist::findtext $findtext
  set temp [sc_filter textfind $glstart $findtext]
  busyCursor .glistWin 0
  if {$temp < 1} { set temp 1 }
  set glstart $temp
  ::windows::gamelist::Refresh
}


proc ::windows::gamelist::Open {} {
  global glstart glistSize highcolor glSelection helpMessage
  global glistFields glNumber buttoncolor
  if {[winfo exists .glistWin]} {
    focus .
    destroy .glistWin
    set ::windows::gamelist::isOpen 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 ::windows::gamelist::SetStart \
    -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 ::windows::gamelist::names($code)]} {
      set name $::windows::gamelist::names($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> \
      "::windows::gamelist::SetSelection $code %x %y; ::game::Load \$glNumber; break"
    bind $w.c$code.text <Button-1> \
      "::windows::gamelist::SetSelection $code %x %y; ::windows::gamelist::Highlight \$glSelection; break"
    bind $w.c$code.text <ButtonRelease-1> \
      "::windows::gamelist::SetSelection $code %x %y; ::windows::gamelist::Dehighlight; break"

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

    bind $w.c$code.text <ButtonPress-2> \
      "::windows::gamelist::SetSelection $code %x %y; ::windows::gamelist::ShowMoves %X %Y; break"
    bind $w.c$code.text <ButtonRelease-2> \
      "wm withdraw .glistExtra; ::windows::gamelist::Dehighlight; 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 {::game::Load $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 {::windows::gamelist::ToggleFlag delete}
  $w.popup add command -label "Delete all games in filter" \
    -command {catch {sc_game flag delete filter 1}; ::windows::gamelist::Refresh}
  $w.popup add command -label "Undelete all games in filter" \
    -command {catch {sc_game flag delete filter 0}; ::windows::gamelist::Refresh}

  button $w.b.start -image tb_start -command {set glstart 1; ::windows::gamelist::Refresh}
  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 };
    ::windows::gamelist::Refresh
  }
  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 }
    ::windows::gamelist::Refresh
  }
  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}
    ::windows::gamelist::Refresh
  }
  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}
    ::windows::gamelist::Refresh
  }

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

  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 ::windows::gamelist::goto
  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 $::windows::gamelist::goto]
    if {$glstart < 1} { set glstart 1}
    set ::windows::gamelist::goto ""
    ::windows::gamelist::Refresh
  }

  label $w.b.findlabel -textvar ::tr(GlistFindText:)
  ::combobox::combobox $w.b.find -background white -width 15 \
    -textvariable ::windows::gamelist::findtext
  ::utils::history::SetCombobox ::windows::gamelist::findtext $w.b.find
  bind $w.b.find <Return> ::windows::gamelist::FindText
  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 ::windows::gamelist::isOpen 1
  bind $w <F1> { helpWindow GameList }
  bind $w <Destroy> { set ::windows::gamelist::isOpen 0 }
  bind $w <Escape> "$w.b.close invoke"
  standardShortcuts $w

  # MouseWheel bindings:
  bind $w <MouseWheel> {::windows::gamelist::Scroll [expr {- (%D / 120)}]}
  if {! $::windowsOS} {
    bind $w <Button-4> {::windows::gamelist::Scroll -1}
    bind $w <Button-5> {::windows::gamelist::Scroll 1}
  }

  # 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
      ::windows::gamelist::Refresh
    }
  }

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

proc ::windows::gamelist::Scroll {nlines} {
  global glstart
  set glstart [expr {$glstart + $nlines}]
  if {$glstart > [sc_filter count] } {
    set glstart [sc_filter count]
  }
  if {$glstart < 1} { set glstart 1 }
  ::windows::gamelist::Refresh
}

proc ::windows::gamelist::SetSelection {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 ::windows::gamelist::Dehighlight {} {
  global glistFields glistSize
  foreach column $glistFields {
    set code [lindex $column 0]
    .glistWin.c$code.text tag remove highlight 1.0 end
  }
}

proc ::windows::gamelist::Highlight {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 $::windows::gamelist::names($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
  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 "$::windows::gamelist::names($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
  ::utils::win::Centre $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
  ::windows::gamelist::Open
}

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
  ::windows::gamelist::Open
}

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
  ::windows::gamelist::Open
}

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
  ::windows::gamelist::Open
}

proc popupGLmenu {code xcoord ycoord xscreen yscreen} {
  global glSelection glNumber
  ::windows::gamelist::SetSelection $code $xcoord $ycoord
  if {$glNumber < 1} {return}
  ::windows::gamelist::Highlight $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 ::windows::gamelist::SetStart { start } {
  global glstart
  set glstart $start
  ::windows::gamelist::Refresh
}

proc ::windows::gamelist::ToggleFlag {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}
  ::windows::gamelist::Refresh
}

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
  }
  ::windows::stats::Refresh
  ::windows::gamelist::Refresh
}

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

  ::windows::gamelist::Highlight $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 ::windows::gamelist::Refresh {} {
  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 [::utils::thousands $glstart] " .. " \
      [::utils::thousands $glend] " / " [::utils::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
}

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

namespace eval ::pgn {}

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

proc ::pgn::ConfigMenus {{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 1 3} tag {Copy Print Close} {
    configMenuText $m.file.m $idx PgnFile$tag $lang
  }
  foreach idx {0 1 2 3 4 5 6 7 8} tag {
      Color Short Symbols IndentC IndentV Space Column StripMarks BoldMainLine
  } {
    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 ::pgn::OpenClose {} {
  global pgnWin pgnHeight pgnWidth pgnColor
  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 PgnFileCopy -command {
     set pgnStr [sc_game pgn -width 75 -indentComments $::pgn::indentComments \
        -indentVariations $::pgn::indentVars -space $::pgn::moveNumberSpaces]
     set wt .tempFEN
     if {! [winfo exists $wt]} { text $wt }
     $wt delete 1.0 end
     $wt insert end $pgnStr sel
     clipboard clear
     clipboard append $pgnStr
     selection own $wt
     selection get
  }

  $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 $::pgn::symbolicNags \
             -indentVar $::pgn::indentVars -indentCom $::pgn::indentComments \
             -space $::pgn::moveNumberSpaces -format plain -column $::pgn::columnFormat \
             -markCodes $::::pgn::stripMarks]
        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 ::pgn::showColor -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptShort \
    -variable ::pgn::shortHeader -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptSymbols \
    -variable ::pgn::symbolicNags -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptIndentC \
    -variable ::pgn::indentComments -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptIndentV \
    -variable ::pgn::indentVars -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptSpace \
    -variable ::pgn::moveNumberSpaces -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptColumn \
    -variable ::pgn::columnFormat -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptStripMarks \
    -variable ::pgn::stripMarks -command {updateBoard -pgn}
  $w.menu.opt.m add checkbutton -label PgnOptBoldMainLine \
    -variable ::pgn::boldMainLine -command {updateBoard -pgn}

  $w.menu.color.m add command -label PgnColorHeader \
    -command {::pgn::ChooseColor Header "header text"}
  $w.menu.color.m add command -label PgnColorAnno \
    -command {::pgn::ChooseColor Nag annotation}
  $w.menu.color.m add command -label PgnColorComments \
    -command {::pgn::ChooseColor Comment comment}
  $w.menu.color.m add command -label PgnColorVars \
    -command {::pgn::ChooseColor Var variation}
  $w.menu.color.m add command -label PgnColorBackground \
    -command {::pgn::ChooseColor 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}

  ::pgn::ConfigMenus

  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}
  if { $::pgn::boldMainLine } {
    $w.text configure -font font_Bold
  }
  
  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> "::pgn::ShowBoard .pgnWin.text 5 %x %y %X %Y"
  bind $w <ButtonRelease-2> ::pgn::HideBoard
  bind $w <ButtonPress-3> "::pgn::ShowBoard .pgnWin.text 5 %x %y %X %Y"
  bind $w <ButtonRelease-3> ::pgn::HideBoard

  # set the same arrow key, etc bindings that the main window has:
  bind $w <F1> { helpWindow PGN }
  bind $w <Home>  ::move::Start
  bind $w <Up>    {::move::Back 10}
  bind $w <Left>  ::move::Back
  bind $w <Down>  {::move::Forward 10}
  bind $w <Right> ::move::Forward
  bind $w <End>   ::move::End
  bind $w <Escape> {focus .; destroy .pgnWin}
  standardShortcuts $w
  bindMouseWheel $w $w.text

  # 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
  ::pgn::ResetColors
}

# ::pgn::ShowBoard:
#    Produces a popup window showing the board position in the
#    game at the current mouse location in the PGN window.
#
proc ::pgn::ShowBoard {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
}


# ::pgn::HideBoard
#
#    Hides the window produced by ::pgn::ShowBoard.
#
proc ::pgn::HideBoard {} {
  wm withdraw .pgnPopup
}


# ::pgn::ResetColors
#
#    Reconfigures the pgn Colors, after a color is changed by the user
#
proc ::pgn::ResetColors {} {
  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
  ::pgn::Refresh 1
}

# ::pgn::Refresh
#
#    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 ::pgn::Refresh {{pgnNeedsUpdate 0}} {

  if {![winfo exists .pgnWin]} { return }

  set format plain
  if {$::pgn::showColor} {set format color}

  set pgnStr [sc_game pgn -symbols $::pgn::symbolicNags \
                -indentVar $::pgn::indentVars -indentCom $::pgn::indentComments \
                -space $::pgn::moveNumberSpaces -format $format -column $::pgn::columnFormat \
                -short $::pgn::shortHeader -markCodes $::pgn::stripMarks]

  if {$pgnNeedsUpdate} {
    busyCursor .
    set windowTitle [format $::tr(PgnWindowTitle) [sc_game number]]
    wm title .pgnWin "Scid: $windowTitle"
    .pgnWin.text configure -state normal
    .pgnWin.text delete 1.0 end
    if {$::pgn::showColor} {
      #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 {$::pgn::showColor} {
     if { $::pgn::boldMainLine } {
        .pgnWin.text configure -font font_Bold
     } else {
        .pgnWin.text configure -font font_Regular
     }
    # 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

namespace eval ::commenteditor {

    namespace export open close update storeComment addNag

    # List of colors and types used to mark a square

    variable  colorList {}  markTypeList {}
    lappend   colorList red orange yellow   \
                        green blue darkBlue \
                        purple white black
    # Each list is a set of buttons in the dialog menu:
    lappend   markTypeList [list full circle disk x + - = ? !]
    lappend   markTypeList [list 1 2 3 4 5 6 7 8 9]

    # IO state of the comment editor
    variable  State
    array set State [list isOpen 0 \
                     markColor red  markType full  text "" \
                     pending ""]

    proc addMark {args} {eval ::board::mark::add $args}
    proc delMark {args} {eval ::board::mark::remove $args}
}

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

proc makeCommentWin {} {
  if {[winfo exists .commentWin]} {
    ::commenteditor::close
  } else {
    ::commenteditor::Open
  }
}

# ::commenteditor::Open --
#
#	TODO: brief description (abstract)
#
# Arguments:
#	none
# Results:
#	TODO: detailed description
#
proc ::commenteditor::Open {} {
  global commentWin nagValue highcolor helpMessage
  variable colorList
  variable markTypeList
  variable State

  set commentWin 1
  set State(isOpen) 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> [namespace code {set commentWin 0; set State(isOpen) 0}]
  bind $w <Configure> "recordWinSize $w"

  set mark [frame $w.markFrame]
  pack $mark -side left -fill x -padx 2 -anchor n

  # 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 }

  # 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
  set i 0
  set row 0
  set column 0
  foreach {nag description} {
      ! GoodMove
      ? PoorMove
      !! ExcellentMove
      ?? Blunder
      !? InterestingMove
      ?! DubiousMove
      +- WhiteDecisiveAdvantage
      -+ BlackDecisiveAdvantage
      +/- WhiteClearAdvantage
      -/+ BlackClearAdvantage
      += WhiteSlightAdvantage
      =+ BlackSlightAdvantage
      = Equality
      ~ Unclear
      N Novelty
      D Diagram
  } {
    button $nagbuttons.b$i -takefocus 0 -text "$nag" -width 2 \
             -command [namespace code [list addNag "$nag"]]
    # set helpMessage(E,$nagbuttons.b$i) $description
    ::utils::tooltip::Set $nagbuttons.b$i $description
    grid $nagbuttons.b$i -row [expr {$i % 2}] -column [expr {int($i / 2)}] -padx 2 -pady 2
    incr i
  }

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

  button $w.nf.tf.clear -textvar ::tr(Clear) -command {
      .commentWin.nf.tf.text delete 0 end
      ::commenteditor::storeComment
      ::pgn::Refresh 1
      updateBoard
  }
  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

  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 -pady 2
  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

  # Main buttons:

  dialogbutton $w.b.clear -textvar ::tr(Clear) \
    -command [namespace code [list ClearComments .commentWin]]
  set helpMessage(E,$w.b.clear) {Clear this comment}
  dialogbutton $w.b.revert -textvar ::tr(Revert) \
    -command ::commenteditor::Refresh
  set helpMessage(E,$w.b.revert) {Revert to the stored comment}
  dialogbutton $w.b.store -textvar ::tr(Store) \
    -command [namespace code {storeComment; ::pgn::Refresh 1; updateBoard}]
  set helpMessage(E,$w.b.store) {Store this comment in the game}
  frame $w.b.space -width 10
  dialogbutton $w.b.close -textvar ::tr(Close) \
    -command { 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 -padx 2

  ### Insert-mark frame

  label $mark.header -font font_Bold -text $::tr(InsertMark:)
  pack $mark.header -side top -ipady 1 -fill x -padx 1

  pack [frame [set usage $mark.usage]] -side bottom -pady 1 -expand true
  pack [label [set usage $usage.text] \
          -text [string trim $::tr(InsertMarkHelp)] -justify left]

  # Subframes for insert board and two button rows:
  pack [frame [set colorButtons $mark.colorButtons]] \
          -side top -pady 1 -anchor n
  pack [frame [set insertBoard $mark.insertBoard]] \
          -side top -pady 1
  pack [frame [set typeButtons $mark.typeButtons]] \
          -side top -pady 1 -anchor s

  # Left subframe: color (radio)buttons
  foreach color $colorList {
    image create photo markColor_$color -width 18 -height 18
    markColor_$color put $color -to 1 1 16 16
    radiobutton $colorButtons.c$color \
            -image markColor_$color \
            -variable [namespace current]::State(markColor) \
            -value $color \
            -indicatoron 0 \
            -takefocus 0 \
            -command [namespace code [list SetMarkColor $color]]
    pack $colorButtons.c$color -side left -padx 0 -pady 3
  }

  # Central subframe: a small board
  set board [::board::new $insertBoard.board 20]
  ::board::showMarks $board 1
  set ::board::_mark($board) $::board::_mark(.board)
  ::board::update $board
  pack $board -side top
  # TODO?: move this for loop into a new proc (e.g. 'BindSquares')
  for {set square 0} {$square < 64} {incr square} {
      ::board::bind $board $square <ButtonPress-1> [namespace code \
               [list InsertMark $board $square]]
      ::board::bind $board $square <ButtonRelease-1> [namespace code \
              [list ButtonReleased $board %b %X %Y]]
      #::board::bind $board $square <ButtonPress-2> [namespace code \
      #        [list InsertMark $board [expr {$square + 64}]]]
      ::board::bind $board $square <ButtonPress-3> [namespace code \
              [list InsertMark $board [expr {$square + 64}]]]
  }

  # Right subframe: type/shape (pseudo-radio)buttons
  set size 20	;# button/rectangle size
  pack [set types [frame $typeButtons.all]] -side left -padx 10
  set row 0
  foreach buttons $markTypeList {
    set column 0
    foreach shape $buttons {
      set color [::board::defaultColor [expr {($column + $row) % 2}]]
      # Create and draw a button:
      set button [frame $types.button_${shape} -class PseudoButton]
      grid $button -row $row -column $column -padx 1 -pady 1
      # The "board" is a 1x1 board, containing one single square.
      set board1x1 [canvas $button.bd \
              -height $size -width $size -highlightthickness 0 \
              -borderwidth 2 -relief raised]
      $board1x1 create rectangle 0 0 $size $size \
              -fill $color -outline "" \
              -tag [list sq0 button${shape}]
      ::board::mark::add $types.button_${shape} \
              $shape 0 $State(markColor) "false"
      pack $board1x1
      bind $board1x1 <Button-1> \
              [namespace code [list SetMarkType $board $shape]]
      incr column
    } ;# foreach shape
    incr row
  } ;# foreach button_line
  # "Press" button:
  SetMarkType $board $State(markType)

  ### Start editing

  wm title $w "Scid: [tr {Comment editor}]"
  wm iconname $w "Scid: [tr {Comment editor}]"
  ::commenteditor::Refresh
  focus $w.cf.text
}

# ::commenteditor::SetMarkColor --
#
#	Called when a color is selected.
#
# Arguments:
#	color	The selected color.
# Results:
#	TODO
#
proc ::commenteditor::SetMarkColor {color} {
    variable   markTypeList
    variable   State
    set path   .commentWin.markFrame.typeButtons.all
    set square 0	;# square number of a 1x1-board
    foreach buttons $markTypeList {
        foreach shape $buttons {
            set button $path.button_${shape}
            if {$shape == "square"} {
                $button.bd itemconfigure sq$square \
                        -fill $color -outline $color
            } else {
                $button.bd delete mark
                addMark $button $shape $square $color "false"
            }
        }
    }
    set State(markColor) $color
}

# ::commenteditor::SetMarkType --
#
# Arguments:
#	board	The frame variable of the board.
#	type	The selected type/shape, e.g. "circle", "1", etc.
# Results:
#	TODO
#
proc ::commenteditor::SetMarkType {board type} {
    variable State
    set cur_type $State(markType)
    set path .commentWin.markFrame.typeButtons.all
    $path.button_${cur_type}.bd configure -relief raised
    $path.button_${type}.bd configure -relief sunken
    set State(markType) $type
}

# ::commenteditor::InsertMark --
#
#	Called when a square is selected on the insert board.
#
# Arguments:
#	board	The frame variable of the board.
#	from	Number (0-63) of the selected square
#		(+64 if right mouse button used).
#	to	Number of destination square (0-63) if an
#		arrow is to be drawn (+64 if right mouse button).
# Results:
#	TODO
#
proc ::commenteditor::InsertMark {board square} {
    variable State
    set textwin .commentWin.cf.text
    if {![string length $State(pending)]} {
        set State(pending) $square
        return
    }
    # Right mouse click results in square-no + 64:
    set from [expr {$State(pending) % 64}]
    set to   [expr {$square         % 64}]

    set key $::board::mark::Command
    array set tag [list remove 0 value {}]
    if {$square == $State(pending)} {
        if {$square >= 64} { return }
        if {[lsearch [$textwin tag names] $square] >= 0} {
            array set tag [list remove 1 value $square]
            delMark $board $square
        } else {
            set tag(value) $square
            addMark $board $State(markType) $square $State(markColor)
            set to [::board::san $square]
            set State(text) "\[%$key $State(markType),$to,$State(markColor)\]"
        }
    } else {
        if {($square & 64) != ($State(pending) & 64)} {
            if {$square < 64} { set State(pending) $square }
            return
        }
        if {[lsearch [$textwin tag names] ${from}:${to}] >= 0} {
            set tag(remove) 1
            set tag(value)  [list ${from}:${to} ${to}:${from}]
            delMark $board $from $to
        } else {
            set tag(value) [list ${from}:${to} ${to}:${from}]
            addMark $board arrow $from $to $State(markColor)
            set from [::board::san $from]
            set to   [::board::san $to]
            set State(text) "\[%$key arrow,$from,$to,$State(markColor)\]"
        }
    }
    set State(pending) ""

    if {$tag(remove)} {
        set remove [lindex $tag(value) 0]
        if [llength [$textwin tag range $remove]] {
            $textwin delete $remove.first $remove.last
        }
        eval $textwin tag delete $tag(value)
    } else {
        $textwin insert insert $State(text) $tag(value)
    }
}

# ::commenteditor::ClearComments --
#
#	Called when the 'Clear' button is pressed.
#
# Arguments:
#	win	The window variable.
# Results:
#	Clears text area and chess board of the comment editor.
#
proc ::commenteditor::ClearComments {win} {
    ${win}.cf.text delete 0.0 end
    set board ${win}.markFrame.insertBoard.board
    ::board::mark::clear $board
    ::board::update $board
}

# ::commenteditor::ButtonReleased --
#
#	Auxiliary routine:
#	Called when a button is released over a square.
#
# Arguments:
#	board	The frame variable of the board.
#	button	The number (%b) of the button that was released.
#	x_root	The x-coodinate (%X) from the event.
#	y_root	The y-coodinate (%Y) from the event.
# Results:
#
proc ::commenteditor::ButtonReleased {board button x_root y_root} {
    set square [::board::getSquare $board $x_root $y_root]
    if {$square < 0}  {
        set $State(pending) ""
        return
    }
    if {$button != 1} {set square [expr {$square + 64}]}
    InsertMark $board $square
}

# ::commenteditor::storeComment --
#
#	Set the comment of the current position to
#	the text of the commenteditor.
#
proc ::commenteditor::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
    ::pgn::Refresh 1
    updateBoard
  }
}

# ::commenteditor::Refresh --
#
#	(Re)builds textwindow and board of the comment editor.
#
proc ::commenteditor::Refresh {} {
  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
  }
  # Rewrite text window, tag embedded commands,
  # and draw marks according to text window commands.
  set text  .commentWin.cf.text
  set board .commentWin.markFrame.insertBoard.board
  set comment [sc_pos getComment]
  set offset  0
  ::board::mark::clear $board
  $text delete 1.0 end
  foreach {mark pos} [::board::mark::getEmbeddedCmds $comment] {
      foreach {type square arg color} $mark {begin end} $pos {break}  ;# set
      set square [::board::sq $square]
      regsub -all -- {[^[:alnum:]]} $color {_} _color
      switch -- $type {
          arrow   { set arg  [::board::sq $arg]
                    set tags [list ${square}:${arg} ${arg}:${square} \
                              ${square}:${arg}:$_color]
                  }
          default { set tags [list $square ${square}:$type:$_color] }
      }
      $text insert insert [string range $comment $offset [expr {$begin-1}]]
      $text insert insert [string range $comment $begin $end] $tags
      set offset [expr {$end + 1}]
      addMark $board $type $square $arg $color 1
  }
  $text insert insert [string range $comment $offset end]
  ::board::update $board
}

### End of namespace ::commenteditor

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

set ::windows::eco::code ""
set ::windows::eco::count 0
set ::windows::eco::isOpen 0

proc ::windows::eco::OpenClose {} {
  if {[winfo exists .ecograph]} {
    destroy .ecograph
  } else {
    ::windows::eco::Refresh
  }
}

# ::windows::eco::Refresh
#
#    Updates the ECO Browser window, opening it if necessary.
#    If the ECO code "code" is "x", then the value of the
#    variable ::windows::eco::code is used instead.
#
proc ::windows::eco::Refresh {{code "x"}} {
  set w .ecograph
  set graph $w.pane.graph
  set text $w.pane.text
  if {$code != "x"} { set ::windows::eco::code $code }
  if {! [winfo exists $w]} {
    set ::windows::eco::isOpen 1
    toplevel $w
    wm minsize $w 200 100
    setWinLocation $w
    bind $w <Escape> "destroy $w"
    bind $w <F1> {helpWindow ECO}
    bind $w <Destroy> {set ::windows::eco::isOpen 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
    dialogbutton $w.b.help -textvar ::tr(Help) -command {helpWindow ECO}
    dialogbutton $w.b.close -textvar ::tr(Close) -command "destroy $w"
    pack $w.b.classify -side left -padx 5 -pady 5
    packbuttons right $w.b.close $w.b.help
    set pane [::utils::pane::Create $w.pane graph text 500 400 0.5]
    ::utils::pane::SetRange $w.pane 0.3 0.7
    ::utils::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> "::windows::eco::KeyPress $i"
    }

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

    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
    bindMouseWheel $w $w.pane.text.text

    bind $graph.c <1> { ::windows::eco::Select %x }
    bind $graph.c <3> { ::windows::eco::KeyPress "<" }

    bind $graph <Configure> {
      ::utils::graph::configure eco -height [expr {[winfo height .ecograph.pane.graph.c] - 50} ]
      ::utils::graph::configure eco -width [expr {[winfo width .ecograph.pane.graph.c] - 60} ]
      ::utils::graph::redraw eco
    }
    bind $w <Configure> {
      ::utils::graph::configure eco -height [expr {[winfo height .ecograph.pane.graph.c] - 50} ]
      ::utils::graph::configure eco -width [expr {[winfo width .ecograph.pane.graph.c] - 60} ]
      ::utils::graph::redraw eco
    }
    wm title $w "Scid: [tr WindowsECO]"
    ::utils::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 $::windows::eco::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 }

  ::utils::graph::create eco -width $width -height $height -xtop 50 -ytop 20 \
    -xmin 0.5 -xtick 1 -ytick $hline -font font_Small -canvas $graph.c
  ::utils::graph::data eco data -color SteelBlue4 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $data
  ::utils::graph::data eco draws -color SteelBlue3 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $draws
  ::utils::graph::data eco wins -color SteelBlue1 -points 0 -lines 0 -bars 1 \
    -barwidth 0.8 -outline black -coords $wins
  ::utils::graph::data eco bounds -points 0 -lines 0 -bars 0 -coords {1 0 1 1}
  ::utils::graph::configure eco -ymin 0 -xmin 0.4 -xmax [expr {$count + 0.6} ] \
    -xlabels $xlabels -hline [list [list gray80 1 each $hline]]
  ::utils::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 ::windows::eco::count $count
}

proc ::windows::eco::Select {xc} {
  variable count
  variable code

  set x [::utils::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
  }
  ::windows::eco::Refresh
}

# ::windows::eco::KeyPress
#
#    Handles keyboard events in ECO browser window
#
proc ::windows::eco::KeyPress {key} {
  set code $::windows::eco::code
  set len [string length $code]
  if {$key == "<"} {
    set ::windows::eco::code [string range $code 0 [expr {$len - 2} ]]
    ::windows::eco::Refresh
    return
  }
  if {$key == "top"} {
    set ::windows::eco::code ""
    ::windows::eco::Refresh
    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 ::windows::eco::code "$code$key"
    ::windows::eco::Refresh
  }
}

###
### windows/stats.tcl: Filter Statistics window for Scid
###

set ::windows::stats::isOpen 0

proc ::windows::stats::Open {} {
  set w .statsWin
  if {[winfo exists $w]} {
    focus .
    destroy $w
    set ::windows::stats::isOpen 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 ::windows::stats::display r*]] {
    set elo [string range $i 1 end]
    $w.menu.opt.m.elo add checkbutton -label "$::tr(OprepStatBoth) $elo+" \
      -variable ::windows::stats::display($i) -command ::windows::stats::Refresh
  }
  $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 ::windows::stats::display y*]] {
    set year [string range $i 1 end]
    $w.menu.opt.m.year add checkbutton \
      -label "$::tr(OprepStatSince) $year.01.01" \
      -variable ::windows::stats::display($i) -command ::windows::stats::Refresh
  }

  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 ::windows::stats::isOpen 1
  bind $w <Control-q> "destroy $w"
  bind $w <Escape> "destroy $w"
  bind $w <F1> { helpWindow Index }
  bind $w <Destroy> {
    set ::windows::stats::isOpen 0
  }
  standardShortcuts $w
  wm resizable $w 1 0
  ::windows::stats::ConfigMenus
  ::windows::stats::Refresh
}

proc ::windows::stats::Refresh {} {
  variable display
  if {[winfo exists .playerInfoWin]} { playerInfo }
  ::windows::gamelist::Refresh
  ::maint::Refresh
  updateStatusBar
  ::tools::graphs::filter::Refresh
  if {! [winfo exists .statsWin]} { return }

  # Set up variables for translated phrases:
  set all [::utils::string::Capital $::tr(allGames)]
  set both $::tr(OprepStatBoth)
  set since $::tr(OprepStatSince)
  set games [::utils::string::Capital $::tr(games)]
  set score [::utils::string::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 display r*]]
  set ylist [lsort [array names display y*]]

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

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

  set s ""
  set stat ""
  append s " [::utils::string::Pad $stat [expr $len - 4]] [::utils::string::PadRight $games 10]"
  append s "     1-0     =-=     0-1 [::utils::string::PadRight $score 8]\n"
  append s "------------------------------------------------------------------------"
  append s "\n [::utils::string::Pad $all $len]" [sc_filter stats all]

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

  if {$years} {
    append s "\n"
    foreach i $ylist {
      if {$display($i)} {
        incr height
        set year [string range $i 1 end]
        set stat "$since $year.01.01"
        append s "\n [::utils::string::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 ::windows::stats::ConfigMenus {{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
  }
}

############################################################
### 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

  autoscrollframe $w.f listbox $w.f.tl \
    -width $::winWidth($w) -height $::winHeight($w) \
    -font font_Fixed -foreground black -background white \
    -selectmode browse -setgrid 1
  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
  bindMouseWheel $w $w.f.tl

  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

  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) -command ::tree::toggleLock
  checkbutton $w.buttons.training -textvar ::tr(Training) \
    -variable tree(training) -command ::tree::toggleTraining

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

  dialogbutton $w.buttons.stop -textvar ::tr(Stop) -command { sc_progressBar }
  dialogbutton $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 3 -pady 2
  packbuttons right $w.buttons.close $w.buttons.stop
  $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 }
  set move [sc_tree move $tree(base) random]
  addSanMove $move -animate -notraining
  updateBoard -pgn
}

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 }
  .treeWin.f.tl selection clear 0 end
  if {$selection == 0} {
    sc_move back
    updateBoard -pgn
    return
  }
  set move [sc_tree move $tree(base) $selection]
  if {$move == ""} { return }
  addSanMove $move -animate
  updateBoard -pgn
}

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
  ::windows::stats::Refresh
  if {[winfo exists .treeGraph]} ::tree::graph
  ::windows::gamelist::Refresh
  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))" }
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e4 c6 2.d4}
  {1.e4 c6 2.d4 d5}
  {1.e4 c6 2.d4 d5 3.e5}
  {1.e4 c6 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)"
    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 [::utils::pane::Create $w.pane blist bpgn 520 320 0.6]
    ::utils::pane::SetRange $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 \
      -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 -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> "::pgn::ShowBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-1> ::pgn::HideBoard
    bind $t <ButtonPress-2> "::pgn::ShowBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-2> ::pgnHideBoard
    bind $t <ButtonPress-3> "::pgn::ShowBoard $pane.bpgn.text 4 %x %y %X %Y"
    bind $t <ButtonRelease-3> :::pgn::HideBoard

    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
    bind $w <Configure> "recordWinSize $w"
    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) }
  ::game::Load $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
      ::utils::graph::configure tree -height [expr {[winfo height .treeGraph.c] - 100}]
      ::utils::graph::configure tree -width [expr {[winfo width .treeGraph.c] - 50}]
      ::utils::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}]
  ::utils::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]

  set numTreeLines [llength $treeData]
  set totalLineIndex [expr $numTreeLines - 2]

  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 {$i == $totalLineIndex} {
      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  &&  $totalGames > 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:
  ::utils::graph::data tree bounds -points 0 -lines 0 -bars 0 -coords {1 41 1 64}

  # Replot the graph:
  ::utils::graph::data tree data -color red -points 0 -lines 0 -bars 1 \
    -barwidth 0.75 -outline black -coords $data
  ::utils::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]]

  ::utils::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 ([::utils::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
  }
}

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

namespace eval ::crosstab {}

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 ::crosstab::ConfigMenus {{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 ::crosstab::RefreshIfOpen {} {
  set w .crosstabWin
  if {[winfo exists $w]} { crosstabWin }
}

proc ::crosstab::Open {} {
  global crosstab
  set w .crosstabWin
  if {[winfo exists $w]} {
    ::crosstab::Refresh
    return
  }

  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}

  ::crosstab::ConfigMenus

  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 {
    ::search::filter::reset
    ::search::filter::negate
    sc_game crosstable filter
    ::windows::gamelist::Refresh
  }
  button $w.b.addfilter -textvar ::tr(AddToFilter) -command {
    sc_game crosstable filter
    ::windows::gamelist::Refresh
  }
  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

  # MouseWheel Bindings:
  bind $w <MouseWheel> { .crosstabWin.f.text yview scroll [expr {- (%D / 120)}] units}
  if {! $::windowsOS} {
    bind $w <Button-4> { .crosstabWin.f.text yview scroll -1 units }
    bind $w <Button-5> { .crosstabWin.f.text yview scroll  1 units }
  }

  ::crosstab::Refresh
}

proc crosstabWin {} {
  ::crosstab::Open
}

proc ::crosstab::Refresh {} {
  global crosstab
  set w .crosstabWin
  if {! [winfo exists $w]} { return }

  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
}


####################
# Player List window

namespace eval ::plist {}

set plistWin 0

set ::plist::sort Name

proc ::plist::defaults {} {
  set ::plist::name ""
  set ::plist::minGames 0
  set ::plist::maxGames 9999
  set ::plist::minElo 0
  set ::plist::maxElo [sc_info limit elo]
  set ::plist::size 50
}

::plist::defaults

trace variable ::plist::minElo w [list ::utils::validate::Integer [sc_info limit elo] 0]
trace variable ::plist::maxElo w [list ::utils::validate::Integer [sc_info limit elo] 0]
trace variable ::plist::minGames w [list ::utils::validate::Integer 9999 0]
trace variable ::plist::maxGames w [list ::utils::validate::Integer 9999 0]

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

proc ::plist::Open {} {
  global plistWin
  set w .plist
  if {[winfo exists .plist]} { return }
  set plistWin 1

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

  bind $w <F1> {helpWindow PList}
  bind $w <Escape> "$w.b.close invoke"
  bind $w <Return> ::plist::refresh
  bind $w <Destroy> { set plistWin 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"
  #bindMouseWheel $w $w.t.text

  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 ::plist::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 {Name Elo Games Oldest Newest} {
    $w.menu.sort.m add radiobutton -label $name -variable ::plist::sort \
      -value $name -command ::plist::refresh
  }
  pack $w.menu.file $w.menu.sort -side left

  foreach i {t o1 o2 o3 b} {frame $w.$i}
  $w.t configure -relief sunken -borderwidth 1
  text $w.t.text -width 55 -height 25 -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" -borderwidth 0
  scrollbar $w.t.ybar -command "$w.t.text yview" -takefocus 0
  scrollbar $w.t.xbar -orient horiz -command "$w.t.text xview" -takefocus 0
  set xwidth [font measure [$w.t.text cget -font] "0"]
  set tablist {}
  foreach {tab justify} {4 r 10 r 18 r 24 r 32 r 35 l} {
    set tabwidth [expr {$xwidth * $tab} ]
    lappend tablist $tabwidth $justify
  }
  $w.t.text configure -tabs $tablist
  $w.t.text tag configure ng -foreground darkBlue
  $w.t.text tag configure date -foreground darkRed
  $w.t.text tag configure elo -foreground darkGreen
  $w.t.text tag configure name -foreground black
  $w.t.text tag configure title -background lightSteelBlue; #-font font_SmallBold

  set font font_Small
  set fbold font_SmallBold

  set f $w.o1
  label $f.nlabel -text $::tr(Player:) -font $fbold
  ::combobox::combobox $f.name -textvariable ::plist::name -width 20 -font $font
  ::utils::history::SetCombobox ::plist::name $f.name
  bindFocusColors $f.name
  focus $f.name
  label $f.size -text $::tr(TmtLimit:) -font $fbold
  ::combobox::combobox $f.esize -width 4 -justify right -textvar ::plist::size \
    -font $font
  trace variable ::plist::size w {::utils::validate::Integer 1000 0}
  bindFocusColors $f.esize
  foreach n {50 100 200 500 1000} {
    $f.esize list insert end $n
  }
  pack $f.esize $f.size -side right
  pack $f.nlabel $f.name -side left

  set f $w.o2
  label $f.elo -text "[tr PListSortElo]:" -font $fbold
  entry $f.emin -textvariable ::plist::minElo
  label $f.eto -text "-"
  entry $f.emax -textvariable ::plist::maxElo
  label $f.games -text "[tr PListSortGames]:" -font $fbold
  entry $f.gmin -textvariable ::plist::minGames
  label $f.gto -text "-"
  entry $f.gmax -textvariable ::plist::maxGames

  foreach entry {emin emax gmin gmax} {
    $f.$entry configure -width 4 -justify right -font $font
    bindFocusColors $f.$entry
    bind $f.$entry <FocusOut> +::plist::check
  }
  pack $f.elo $f.emin $f.eto $f.emax -side left
  pack $f.gmax $f.gto $f.gmin $f.games -side right

  dialogbutton $w.b.defaults -text $::tr(Defaults) -command ::plist::defaults
  dialogbutton $w.b.update -text $::tr(Update) -command ::plist::refresh
  dialogbutton $w.b.close -text $::tr(Close) -command "destroy $w"
  packbuttons left $w.b.defaults
  packbuttons right $w.b.close $w.b.update

  pack $w.b -side bottom -fill x
  pack $w.o3 -side bottom -fill x -padx 2 -pady 2
  pack $w.o2 -side bottom -fill x -padx 2 -pady 2
  pack $w.o1 -side bottom -fill x -padx 2 -pady 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

  ::plist::ConfigMenus
  ::plist::refresh
}

proc ::plist::ConfigMenus {{lang ""}} {
  set w .plist
  if {! [winfo exists $w]} { return }
  if {$lang == ""} { set lang $::language }
  set m $w.menu
  foreach menu {file sort} tag {File Sort} {
    configMenuName $m.$menu PList$tag $lang
  }
  foreach idx {0 2} tag {Update Close} {
    configMenuText $m.file.m $idx PListFile$tag $lang
  }
  foreach idx {0 1 2 3 4 5} tag {Name Elo Games Oldest Newest} {
    configMenuText $m.sort.m $idx PListSort$tag $lang
  }
}

proc ::plist::refresh {} {
  set w .plist
  if {! [winfo exists $w]} { return }

  busyCursor .
  ::utils::history::AddEntry ::plist::name $::plist::name
  set t $w.t.text
  $t configure -state normal
  $t delete 1.0 end

  $t insert end "\t" title
  foreach i {Games Oldest Newest Elo Name} {
    #$t tag configure s$i -font font_SmallBold
    $t tag bind s$i <1> "set ::plist::sort $i; ::plist::refresh"
    $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" title
    $t insert end $i [list title s$i]
  }
  $t insert end "\n" title

  update
  set err [catch {sc_name plist -name $::plist::name -size $::plist::size \
            -minGames $::plist::minGames -maxGames $::plist::maxGames \
            -minElo $::plist::minElo -maxElo $::plist::maxElo \
                -sort [string tolower $::plist::sort]} pdata]
  if {$err} {
    $t insert end "\n$pdata\n"
    unbusyCursor .
    return
  }

  set hc yellow
  set count 0
  foreach player $pdata {
    incr count
    set ng [lindex $player 0]
    set oldest [lindex $player 1]
    set newest [lindex $player 2]
    set elo [lindex $player 3]
    set name [lindex $player 4]

    $t tag bind p$count <ButtonPress-1> [list playerInfo $name]
    #$t tag bind p$count <ButtonPress-3> [list playerInfo $name]
    $t tag bind p$count <Any-Enter> \
      "$t tag configure p$count -background $hc"
    $t tag bind p$count <Any-Leave> \
      "$t tag configure p$count -background {}"
    $t insert end "\n"
    $t insert end "\t$count\t" p$count
    $t insert end $ng [list ng p$count]
    $t insert end "\t" p$count
    $t insert end $oldest [list date p$count]
    $t insert end "\t" p$count
    $t insert end "- $newest" [list date p$count]
    $t insert end "\t" p$count
    $t insert end $elo [list elo p$count]
    $t insert end "\t" p$count
    $t insert end $name [list name p$count]
  }
  $t insert end "\n"
  $t configure -state disabled
  unbusyCursor .
}

proc ::plist::check {} {
  if {$::plist::minGames > $::plist::maxGames} {
    set ::plist::maxGames $::plist::minGames
  }
  if {$::plist::minElo > $::plist::maxElo} {
    set ::plist::maxElo $::plist::minElo
  }
}

####################
# 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 maxElo 4000 sort Date \
                 country "" site "" event "" player "" size 50} {
  set ::tourney::$n $v
}

trace variable ::tourney::start w ::utils::validate::Date
trace variable ::tourney::end w ::utils::validate::Date
foreach {n v} {minPlayers 999 maxPlayers 999 minGames 9999 maxGames 9999 \
                 minElo [sc_info limit elo] maxElo [sc_info limit elo]} {
  trace variable ::tourney::$n w [list ::utils::validate::Integer $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"
  bindMouseWheel $w $w.t.text

  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
  ::combobox::combobox $f.ecn -width 4 -font $font -textvar ::tourney::country
  foreach c {{} AUT CZE DEN ENG ESP FRA GER GRE HUN ITA NED POL RUS \
             SCG SUI SWE USA YUG} {
    $f.ecn list insert end $c
  }
  bindFocusColors $f.ecn
  bind $f.ecn <FocusOut> +::tourney::check
  pack $f.cn $f.ecn -side left

  label $f.size -text $::tr(TmtLimit:) -font $fbold
  ::combobox::combobox $f.esize -width 4 -justify right -font $font \
    -textvar ::tourney::size
  trace variable ::tourney::size w {::utils::validate::Integer 1000 0}
  bindFocusColors $f.esize
  foreach n {10 20 50 100 200} {
    $f.esize list insert end $n
  }
  pack $f.esize $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.elomin -textvariable ::tourney::minElo \
    -width 5 -justify right -font $font
  bindFocusColors $f.elomin
  label $f.eto -text "-" -font $font
  entry $f.elomax -textvariable ::tourney::maxElo \
    -width 5 -justify right -font $font
  bindFocusColors $f.elomax
  pack $f.elomax $f.eto $f.elomin $f.elolab -side right

  set f $w.o3
  label $f.sitelab -text "$::tr(Site):" -font $fbold
  ::combobox::combobox $f.site -textvariable ::tourney::site -width 12 -font $font
  ::utils::history::SetCombobox ::tourney::site $f.site
  bindFocusColors $f.site
  pack $f.sitelab $f.site -side left

  label $f.eventlab -text "   $::tr(Event):" -font $fbold
  ::combobox::combobox $f.event -textvariable ::tourney::event -width 12 -font $font
  ::utils::history::SetCombobox ::tourney::event $f.event
  bindFocusColors $f.event
  pack $f.eventlab $f.event -side left

  label $f.playerlab -text "$::tr(Player):" -font $fbold
  ::combobox::combobox $f.player -textvariable ::tourney::player -width 12 -font $font
  ::utils::history::SetCombobox ::tourney::player $f.player
  bindFocusColors $f.player
  pack $f.player $f.playerlab -side right
  focus $f.site

  dialogbutton $w.b.defaults -textvar ::tr(Defaults) -command ::tourney::defaults
  dialogbutton $w.b.help -textvar ::tr(Help) -command {helpWindow Tmt}
  dialogbutton $w.b.update -textvar ::tr(Update) -command ::tourney::refresh
  dialogbutton $w.b.close -textvar ::tr(Close) -command "destroy $w"
  pack $w.b -side bottom -fill x
  packbuttons right $w.b.close $w.b.update $w.b.help
  packbuttons left $w.b.defaults
  pack $w.o3 -side bottom -fill x -padx 2 -pady 2
  pack $w.o2 -side bottom -fill x -padx 2 -pady 2
  pack $w.o1 -side bottom -fill x -padx 2 -pady 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 [::utils::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::maxElo 4000
  set ::tourney::country ""
  set ::tourney::site ""
  set ::tourney::event ""
  set ::tourney::player ""
}

proc ::tourney::refresh {{option ""}} {
  set w .tourney
  if {! [winfo exists $w]} { return }

  busyCursor $w
  ::utils::history::AddEntry ::tourney::site $::tourney::site
  ::utils::history::AddEntry ::tourney::event $::tourney::event
  ::utils::history::AddEntry ::tourney::player $::tourney::player

  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 \
                  -maxElo $::tourney::maxElo \
                  -country [string toupper $::tourney::country] \
                  -site $::tourney::site \
                  -event $::tourney::event \
                  -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 [::utils::string::Surname [lindex $tmt 7]]
    set welo [lindex $tmt 8]
    set wscore [lindex $tmt 9]
    set black [::utils::string::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
  if {$::tourney::country == "---"} {
    set ::tourney::country ""
  }
}

proc ::tourney::select {gnum {openCrosstable 0}} {
  if {[catch {::game::Load $gnum} result]} {
    tk_messageBox -type ok -icon info -title "Scid" -message $result
    return
  }
  flipBoardForPlayerNames $::myPlayerNames
  updateBoard -pgn
  updateTitle
  if {$openCrosstable} {
    crosstabWin
  } else {
    ::crosstab::RefreshIfOpen
  }
}

###
### windows/switcher.tcl: part of Scid
### Copyright (C) 2000-2004  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

  dialogbutton $w.b.set -text "OK" -command \
    "catch {sc_base type $baseNum \$temp_dbtype}; ::windows::switcher::Refresh;
     focus .; destroy $w"

  dialogbutton $w.b.cancel -text $::tr(Cancel) -command "focus .; destroy $w"
  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 ::windows::switcher::pressMouseEvent {i} {
  if {! [winfo exists .baseWin]} {return}
  foreach win {"" .img .name .ngames} {
    .baseWin.c.f$i$win configure -cursor exchange
  }
}

proc ::windows::switcher::releaseMouseEvent {fromBase x y} {
  if {! [winfo exists .baseWin]} {return}
  foreach win {"" .img .name .ngames} {
    .baseWin.c.f$fromBase$win configure -cursor {}
  }
  set dropPoint [winfo containing $x $y]
  if {! [string match ".baseWin.c.f*" $dropPoint]} {return}
  set toBase [string range $dropPoint 12 12]
  if {$toBase == $fromBase} {::file::SwitchToBase $toBase} else {
    copyFilter $fromBase $toBase
  }
}

set baseWin 0

proc ::windows::switcher::Open {} {
  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"
  bind $w <Configure> "+::windows::switcher::Refresh"
  setWinLocation $w

  #wm resizable $w false false
  wm title $w "Scid: [tr WindowsSwitcher]"

  bind $w <Escape> ::windows::switcher::Open
  bind $w <Destroy> { set baseWin 0 }
  bind $w <F1> { helpWindow Switcher }
  standardShortcuts $w

  canvas $w.c -width 300 -height 100 -yscrollcommand [list $w.ybar set]
  scrollbar $w.ybar -takefocus 0 -command [list $w.c yview]
  label $w.status -width 1 -anchor w -relief sunken -borderwidth 1

  grid $w.c -row 0 -column 0 -sticky news
  grid $w.ybar -row 0 -column 1 -sticky ns
  grid $w.status -row 1 -column 0 -sticky we
  grid rowconfigure $w 0 -weight 1
  grid columnconfigure $w 0 -weight 1

  #set side left
  #if {$::windows::switcher::vertical} { set side top }
  set numBases [sc_base count total]

  for {set i 1} {$i <= $numBases} {incr i} {
    set f [frame $w.c.f$i -background white -borderwidth 2 -relief ridge]
    $w.c create window 0 0 -window $w.c.f$i -anchor nw -tag tag$i

    set f $w.c.f$i
    label $f.img -image dbt0 -relief solid -borderwidth 1
    label $f.name -width 11 -anchor w -font font_Small
    label $f.ngames -text "0" -width 11 -anchor e -font font_Tiny
    grid $f.img -row 0 -column 0 -rowspan 2 -padx 2 -pady 2
    grid $f.name -row 0 -column 1 -padx 2 -pady 0 -sticky we
    grid $f.ngames -row 1 -column 1 -padx 2 -pady 0 -sticky we

    foreach win {"" .img .name .ngames} {
      bind $f$win <ButtonPress-1> [list ::windows::switcher::pressMouseEvent $i]
      bind $f$win <ButtonRelease-1> [list ::windows::switcher::releaseMouseEvent $i %X %Y]
    }

    menu $f.menu -tearoff 0
    $f.menu add command -label [tr SearchReset] \
      -command "sc_filter reset $i; ::windows::stats::Refresh"
    $f.menu add command -label "Change icon..." -command "changeBaseType $i"
    $f.menu add separator
    $f.menu add command -label [tr FileOpen] -command ::file::Open
    set closeLabel [tr FileClose]
    if {$i == [sc_info clipbase]} { set closeLabel [tr EditReset] }
    $f.menu add command -label $closeLabel \
      -command [list ::file::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 checkbutton -label "Icons" -variable ::windows::switcher::icons \
      -command ::windows::switcher::Refresh
    #$f.menu add separator
    #$f.menu add command -label $::tr(ChangeOrient) -command ::windows::switcher::Orientate
  }
  setWinSize $w
  ::windows::switcher::Refresh
}

proc ::windows::switcher::Orientate {} {
  #variable vertical
  #if {$vertical} {
  #  set vertical 0
  #  set side left
  #} else {
  #  set vertical 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 ::windows::switcher::Refresh {} {
  global numBaseTypeIcons
  variable icons
  set w .baseWin

  if {! [winfo exists $w]} { return }
  set numBases [sc_base count total]
  set current [sc_base current]
  set clipbase [sc_info clipbase]

  # Get the canvas width and icon dimensions, to compute the correct
  # scroll region.

  for {set i 1} {$i <= $numBases} {incr i} {
    if {$icons} {
      grid $w.c.f$i.img -row 0 -column 0 -rowspan 2 -padx 2 -pady 2
    } else {
      grid forget $w.c.f$i.img
    }
  }

  set canvasWidth [winfo width $w.c]
  set iconWidth [winfo width $w.c.f$clipbase]
  incr iconWidth 5
  set iconHeight [winfo height $w.c.f$clipbase]
  incr iconHeight 5

  # Compute the number of columns that can fit in the canvas
  set numColumns [expr {int($canvasWidth / $iconWidth)}]
  if {$numColumns < 1} { set numColumns 1 }
  set numDisplayed 0

  set row 0
  set column 0
  set x 0
  set y 0
  set status ""

  for {set i 1} {$i <= $numBases} {incr i} {
    if {[sc_base inUse $i]} {
      set color white
      set filename [file nativename [sc_base filename $i]]
      set n $i
      # Do we want to call the clipbase base number "C"?
      # Only if we do it everywhere else for consistency.
      # if {$i == $clipbase} { set n "C" }

      # Set a different color for the current database.
      if {$i == $current} {
        set color lightSteelBlue
        set status $filename
        if {[sc_base isReadOnly]} { append status " ($::tr(readonly))" }
      }

      $w.c.f$i configure -background $color
      set dbtype [sc_base type $i]
      if {$dbtype >= $numBaseTypeIcons} { set dbtype 0 }
      if {$icons} {
        $w.c.f$i.img configure -image dbt$dbtype -background $color
      } else {
        $w.c.f$i.img configure -image ""
      }
      if {$i == $clipbase} {
        set name [sc_base filename $i]
        $w.c.f$i.name configure -background $color \
      } else {
        set name "$n: [file tail [sc_base filename $i]]"
      }
      $w.c.f$i.name configure -background $color -text $name
      $w.c.f$i.ngames configure -background $color \
        -text "[filterText $i 100000]"
      $w.c itemconfigure tag$i -state normal
      $w.c coords tag$i [expr $x + 2] [expr $y + 2]
      incr column
      if {$column == $numColumns} {
        set column 0
        set x 0
        incr y $iconHeight
        incr row
      } else {
        incr x $iconWidth
      }
      incr numDisplayed
    } else {
      $w.c itemconfigure tag$i -state hidden
    }
  }

  set numRows [expr {int( ($numDisplayed + $numColumns - 1) / $numColumns)}]
  if {$numRows < 1} { set numRows 1 }
  set top 0
  set left 0
  set right [expr {$numColumns * $iconWidth}]
  set bottom [expr {$numRows * $iconHeight}]
  $w.c configure -scrollregion [list $left $top $right $bottom]
  if {[winfo height $w.c] >= $bottom} {
    grid forget $w.ybar
  } else {
    grid $w.ybar -row 0 -column 1 -sticky ns
  }
  $w.status configure -text $status
}
###
### search.tcl: Search routines for Scid.
###

namespace eval ::search {}

# searchType: set to Header or Material in a SearchOptions file
set searchType 0

set ::search::filter::operation 2


# TODO: Rename to ::search::filter::text
# 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) / [::utils::thousands $gameCount $kilo]"
  }
  return "[::utils::thousands $filterCount $kilo] / [::utils::thousands $gameCount $kilo]"
}


# search::filter::reset
#   Resets the filter to contain all games. Calls sc_filter reset and
#   updates relevant windows.
#
proc ::search::filter::reset {} {
  global glstart
  sc_filter reset
  set glstart 1
  ::windows::gamelist::Refresh
  ::windows::stats::Refresh
  updateMenuStates
}

# ::search::filter::negate
#
#   Negates the filter, to include only excluded games.
#
proc ::search::filter::negate {} {
  global glstart
  sc_filter negate
  set glstart 1
  ::windows::gamelist::Refresh
  ::windows::stats::Refresh
  updateMenuStates
}



# ::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:
proc ::search::addFilterOpFrame {w {small 0}} {
  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 ::search::filter::operation \
    -value 0 -pady 5 -padx 5 -font $regular
  radiobutton $f.or -textvar ::tr(FilterOr) -variable ::search::filter::operation \
    -value 1 -pady 5 -padx 5 -font $regular
  radiobutton $f.ignore -textvar ::tr(FilterIgnore) -variable ::search::filter::operation \
    -value 2 -pady 5 -padx 5 -font $regular
  pack $f.title -side top
  pack $f.and $f.or $f.ignore -side left
}


# ::search::Config
#
#   Sets state of Search button in Header, Board and Material windows
#
proc ::search::Config {{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 ::search::usefile {} {
  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" { ::search::material }
      "Header"   { ::search::header }
      default    { return }
    }
  }
}


###
### search/board.tcl: Board Search routines for Scid.
###

set searchInVars 0
set sBoardIgnoreCols 0
set sBoardSearchType Exact

# ::search::board
#   Opens the search window for the current board position.
#
proc ::search::board {} {
  global glstart 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.b2
  pack $w.b2 -side top
  frame $w.b
  pack $w.b -side top -fill x
  checkbutton $w.b2.vars -textvar ::tr(LookInVars) -padx 10 -pady 5 \
    -onvalue 1 -offvalue 0 -variable searchInVars
  checkbutton $w.b2.flip -textvar ::tr(IgnoreColors) -padx 10 -pady 5 \
    -onvalue 1 -offvalue 0 -variable sBoardIgnoreCols

  dialogbutton $w.b.stop -textvar ::tr(Stop) -command sc_progressBar
  $w.b.stop configure -state disabled

  dialogbutton $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 \
               $::search::filter::operation \
               $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
    ::windows::gamelist::Refresh
    ::windows::stats::Refresh
  }
  dialogbutton $w.b.cancel -textvar ::tr(Close) -command "focus .; destroy $w"
  pack $w.b2.vars $w.b2.flip -side left -pady 2 -padx 5
  packbuttons right $w.b.cancel .sb.b.search .sb.b.stop
  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
  ::search::Config
  focus $w.b.search
}
###
### search/header.tcl: Header Search routines for Scid.
###

namespace eval ::search::header {}

set sWhite "";  set sBlack "";  set sEvent ""; set sSite "";  set sRound ""
set sWhiteEloMin 0; set sWhiteEloMax [sc_info limit elo]
set sBlackEloMin 0; set sBlackEloMax [sc_info limit elo]
set sEloDiffMin "-[sc_info limit elo]"; set sEloDiffMax "+[sc_info limit elo]"
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 sSideToMove wb
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 ::utils::validate::Date
trace variable sDateMax w ::utils::validate::Date

foreach i {sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax} {
  trace variable $i w [list ::utils::validate::Integer [sc_info limit elo] 0]
}
trace variable sEloDiffMin w [list ::utils::validate::Integer "-[sc_info limit elo]" 0]
trace variable sEloDiffMax w [list ::utils::validate::Integer "-[sc_info limit elo]" 0]

trace variable sGlMin w {::utils::validate::Integer 9999 0}
trace variable sGlMax w {::utils::validate::Integer 9999 0}

trace variable sGnumMin w {::utils::validate::Integer -9999999 0}
trace variable sGnumMax w {::utils::validate::Integer -9999999 0}

# Forcing ECO entry to be valid ECO codes:
foreach i {sEcoMin sEcoMax} {
  trace variable $i w {::utils::validate::Regexp {^$|^[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" }
}

proc ::search::header::defaults {} {
  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
  global sPgntext sTitles

  set sWhite "";  set sBlack ""
  set sEvent ""; set sSite "";  set sRound ""
  set sWhiteEloMin 0; set sWhiteEloMax [sc_info limit elo]
  set sBlackEloMin 0; set sBlackEloMax [sc_info limit elo]
  set sEloDiffMin "-[sc_info limit elo]"
  set sEloDiffMax "+[sc_info limit elo]"
  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
  set sSideToMove wb
  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
  }
}

::search::header::defaults

set sHeaderFlagFrame 0

# ::search::header
#
#   Opens the window for searching by header information.
#
proc search::header {} {
  global sWhite sBlack sEvent sSite sRound sDateMin sDateMax sIgnoreCol
  global sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax
  global sEloDiffMin sEloDiffMax sSideToMove
  global sEco sEcoMin sEcoMax sHeaderFlags sGlMin sGlMax sTitleList sTitles
  global sResWin sResLoss sResDraw sResOther glstart sPgntext

  set w .sh
  if {[winfo exists $w]} {
    wm deiconify $w
    raiseWin $w
    return
  }

  toplevel $w
  wm title $w "Scid: $::tr(HeaderSearch)"
  foreach frame {cWhite cBlack ignore tw tb eventsite dateround res gl ends 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} {
    pack $w.c$color -side top -fill x
    label $w.c$color.lab -textvar ::tr($color:) -font $bold -width 9 -anchor w
    ::combobox::combobox $w.c$color.e -textvariable "s$color" -width 40 -font $regular
    ::utils::history::SetCombobox HeaderSearch$color $w.c$color.e
    label $w.c$color.space
    label $w.c$color.elo1 -textvar ::tr(Rating:) -font $bold
    entry $w.c$color.elomin -textvar s${color}EloMin -width 6 -justify right \
      -font $regular
    label $w.c$color.elo2 -text "-" -font $regular
    entry $w.c$color.elomax -textvar s${color}EloMax -width 6 -justify right \
      -font $regular
    bindFocusColors $w.c$color.e
    bindFocusColors $w.c$color.elomin
    bindFocusColors $w.c$color.elomax
    pack $w.c$color.lab $w.c$color.e $w.c$color.space -side left
    pack $w.c$color.elomax $w.c$color.elo2 $w.c$color.elomin $w.c$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
    ::combobox::combobox $f.e$i -textvariable s$i -width 30 -font $regular
    ::utils::history::SetCombobox HeaderSearch$i $f.e$i
    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 ::utils::date::calendar -padx 0 -pady 0 -command {
    regsub -all {[.]} $sDateMin "-" newdate
    set ndate [::utils::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 ::utils::date::calendar -padx 0 -pady 0 -command {
    regsub -all {[.]} $sDateMax "-" newdate
    set ndate [::utils::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 [::utils::date::today year]-1].[::utils::date::today month].[::utils::date::today day]"
    set sDateMax [::utils::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 "  "1/2-1/2 "  "0-1 "  "* "} {
    checkbutton $w.res.e$i -text $text -variable $v -offvalue 0 -onvalue 1
    pack $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.ends.label -textvar ::tr(EndSideToMove:) -font $bold
  frame $w.ends.sep1 -width 5
  frame $w.ends.sep2 -width 5
  radiobutton $w.ends.white -textvar ::tr(White) -variable sSideToMove -value w
  radiobutton $w.ends.black -textvar ::tr(Black) -variable sSideToMove -value b
  radiobutton $w.ends.both -textvar ::tr(Both) -variable sSideToMove -value wb
  pack $w.ends.label $w.ends.white $w.ends.sep1 \
    $w.ends.black $w.ends.sep2 $w.ends.both -side left
  pack $w.ends -side top -fill x

  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 [::utils::string::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 ::search::header::defaults
  button $w.b.save -textvar ::tr(Save...) -padx 20 -command ::search::header::save
  button $w.b.stop -textvar ::tr(Stop) -command sc_progressBar
  button $w.b.search -textvar ::tr(Search) -padx 20 -command {
    ::utils::history::AddEntry HeaderSearchWhite $sWhite
    ::utils::history::AddEntry HeaderSearchBlack $sBlack
    ::utils::history::AddEntry HeaderSearchEvent $sEvent
    ::utils::history::AddEntry HeaderSearchSite $sSite

    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] \
               -toMove $sSideToMove \
               -gameNumber [list $sGnumMin $sGnumMax] \
               -flip $sIgnoreCol -filter $::search::filter::operation \
               -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
    ::windows::gamelist::Refresh
    ::windows::stats::Refresh
  }

  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
  ::search::Config
  focus $w.cWhite.e
}

proc ::search::header::save {} {
  global sWhite sBlack sEvent sSite sRound sDateMin sDateMax sIgnoreCol
  global sWhiteEloMin sWhiteEloMax sBlackEloMin sBlackEloMax
  global sEloDiffMin sEloDiffMax sGlMin sGlMax
  global sEco sEcoMin sEcoMax sHeaderFlags sSideToMove
  global sResWin sResLoss sResDraw sResOther glstart 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 sEloDiffMin sEloDiffMax
     sIgnoreCol sSideToMove sGlMin sGlMax ::search::filter::operation} {
    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 -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

###
### search/material.tcl: Material Search routine for Scid.
###

namespace eval ::search::material {}

image create photo button_oneplus -data {
R0lGODlhFAAUAIAAAAAAAP///yH5BAEKAAEALAAAAAAUABQAAAIpjI+py+0P
FwCSzVnlzZaaC3oJNooadyqmun4OGR1wHMxQ2HYgzfd+UgAAOw==
}

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 {::utils::validate::Integer 999 0}
trace variable maxMoveNum w {::utils::validate::Integer 999 0}
trace variable minHalfMoves w {::utils::validate::Integer 99 0}
trace variable minMatDiff w {::utils::validate::Integer -99 0}
trace variable maxMatDiff w {::utils::validate::Integer -99 0}

set nPatterns 10

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
  ::utils::validate::Integer 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 makeBoolMenu {w varName} {
  upvar #0 $varName var
  if {![info exists var]} { set var "Yes" }
  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 Yes -image ::rep::_tick \
    -variable $varName -value Yes \
    -command "$w configure -image ::rep::_tick" ;# -hidemargin 1
  $w.menu add radiobutton -label No -image ::rep::_cross \
    -variable $varName -value No \
    -command "$w configure -image ::rep::_cross" ;# -hidemargin 1
  return $w.menu
}

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 pattBool
  if {! [winfo exists .sm]} { return }
  for {set i 1} {$i <= $nPatterns} {incr i} {
    if {$pattBool($i) == "Yes"} {
      .sm.mp.patt.grid.b$i configure -image ::rep::_tick
    } else {
      .sm.mp.patt.grid.b$i configure -image ::rep::_cross
    }
    if {$pattPiece($i) == "?"} {
      .sm.mp.patt.grid.p$i configure -image e20
    } else {
      .sm.mp.patt.grid.p$i configure -image "$pattPiece($i)20"
    }
  }
}

# ::search::material::zero
#
#   Called to clear all material minumum/maximum values to zero.
#
proc ::search::material::zero {} {
  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 ::search::material::any {} {
  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


# ::search::material
#
#   Opens the window for searching by material or patterns.
#
proc ::search::material {} {
  global glstart dark pMin pMax ignoreColors 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
#    }
#  }

  bind $w <F1> { helpWindow Searches Material }
  bind $w <Escape> "$w.b3.cancel invoke"
  bind $w <Return> "$w.b3.search invoke"

  pack [frame $w.mp] -side top
  pack [frame $w.mp.material] -side left

  label $w.mp.material.title -font font_Bold -textvar ::tr(Material:)
  pack $w.mp.material.title -side top -pady 3

  foreach piece {q r b n m p} {
    frame $w.mp.material.$piece
    pack $w.mp.material.$piece -side top ;# -padx 2
  }

  foreach i {q r b n m p} {
    set f $w.mp.material.$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 -pady 1

    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 -pady 1

    foreach b {0 1 2 a 1p} {
      $f.w$b configure -width 2 -pady 0 -padx 1 -takefocus 0 -font $small
      $f.b$b configure -width 2 -pady 0 -padx 1 -takefocus 0 -font $small
    }
    foreach widget {wmin wmax bmin bmax} {
      bindFocusColors $f.$widget
    }
    if {$i == "p"} {
      $f.w1p configure -command "set pMin(wp) 1; set pMax(wp) 8"
      $f.wa configure -command "set pMin(wp) 0; set pMax(wp) 8"
      $f.b1p configure -command "set pMin(bp) 1; set pMax(bp) 8"
      $f.ba configure -command "set pMin(bp) 0; set pMax(bp) 8"
    }
    if {$i == "m"} {
      $f.w1p configure -command "set pMin(wm) 1; set pMax(wm) 4"
      $f.wa configure -command "set pMin(wm) 0; set pMax(wm) 4"
      $f.b1p configure -command "set pMin(bm) 1; set pMax(bm) 4"
      $f.ba configure -command "set pMin(bm) 0; set pMax(bm) 4"
    }
  }

  # Buttons that manipulate material settings:
  set f $w.mp.material.b1
  pack [frame $f] -side top -ipady 2

  dialogbutton $f.zero -textvar ::tr(Zero) -font $small -command ::search::material::zero
  dialogbutton $f.reset -textvar ::tr(Any) -font $small -command ::search::material::any
  dialogbutton $f.current -textvar ::tr(CurrentBoard) -font $small -command {
      ::search::material::zero
      set bd [sc_pos board]
      for {set i 0} {$i < 64} {incr i} {
        set piece $::board::letterToPiece([ string index $bd $i ])
        if {$piece != "e"  &&  $piece != "wk"  &&  $piece != "bk"} {
          incr pMin($piece); set pMax($piece) $pMin($piece)
        }
      }
    }

  menubutton $f.common -textvar ::tr(CommonEndings...) \
    -menu $f.common.m -relief raised -font $small
  menu $f.common.m -font $small
  set m $f.common.m
  $m add command -label [tr EndingPawns] -command {
    ::search::material::zero
    array set pMin {wp 1 bp 1}
    array set pMax {wp 8 bp 8}
  }
  $m add command -label [tr EndingRookVsPawns] -command {
    ::search::material::zero
    array set pMin {wr 1 bp 1}
    array set pMax {wr 1 bp 8}
  }
  $m add command -label [tr EndingRookPawnVsRook] -command {
    ::search::material::zero
    array set pMin {wr 1 br 1 wp 1}
    array set pMax {wr 1 br 1 wp 1}
  }
  $m add command -label [tr EndingRookPawnsVsRook] -command {
    ::search::material::zero
    array set pMin {wr 1 br 1 wp 1}
    array set pMax {wr 1 br 1 wp 8}
  }
  $m add command -label [tr EndingRooks] -command {
    ::search::material::zero
    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 [tr EndingRooksPassedA] -command {
    ::search::material::zero
    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 [tr EndingRooksDouble] -command {
    ::search::material::zero
    array set pMin {wr 2 br 2}
    array set pMax {wr 2 br 2 wp 8 bp 8}
  }
  $m add command -label [tr EndingBishops] -command {
    ::search::material::zero
    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 [tr EndingBishopVsKnight] -command {
    ::search::material::zero
    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 [tr EndingKnights] -command {
    ::search::material::zero
    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 [tr EndingQueens] -command {
    ::search::material::zero
    array set pMin {wq 1 bq 1}
    array set pMax {wq 1 bq 1 wp 8 bp 8}
  }
  $m add command -label [tr EndingQueenPawnVsQueen] -command {
    ::search::material::zero
    array set pMin {wq 1 bq 1 wp 1}
    array set pMax {wq 1 bq 1 wp 1}
  }
  $m add command -label [tr BishopPairVsKnightPair] -command {
    ::search::material::zero
    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.mp.material.mdiff
  pack [frame $f] -side top
  label $f.label -font font_SmallBold -textvar ::tr(MaterialDiff:)
  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.min $f.sep $f.max -side left
  pack $f.sep2 $f.any $f.w1 $f.equal $f.b1 -side left
  set f [frame $w.mp.material.mdiff2]
  pack $f -side top
  label $f.explan -font $small \
    -text "($::tr(MaterialDiff) = $::tr(White) - $::tr(Black); Q=9 R=5 B=3 N=3 P=1)"
  pack $f.explan -side top

  addVerticalRule $w.mp

  set f [frame $w.mp.patt]
  pack $f -side top
  
  #dialogbutton $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
  #  }
  #}
  label $w.mp.patt.title -textvar ::tr(Patterns:) -font font_Bold
  pack $w.mp.patt.title -side top -pady 3

  pack [frame $f.grid] -side top
  for { set i 1 } { $i <= $nPatterns } { incr i } {
    makeBoolMenu $f.grid.b$i pattBool($i)
    set menuPiece1 [ makePieceMenu $f.grid.p$i pattPiece($i) ]
    tk_optionMenu $f.grid.f$i pattFyle($i) "?" a b c d e f g h
    tk_optionMenu $f.grid.r$i pattRank($i) "?" 1 2 3 4 5 6 7 8
    $f.grid.b$i configure -indicatoron 0 ;# -width 4
    $f.grid.f$i configure -indicatoron 0 -width 1 -pady 1
    $f.grid.r$i configure -indicatoron 0 -width 1 -pady 1
    set column [expr {5 * (($i - 1) / 5)} ]
    set row [expr {($i - 1) % 5} ]
    grid $f.grid.b$i -row $row -column $column -padx 0; incr column
    grid $f.grid.p$i -row $row -column $column -padx 0; incr column
    grid $f.grid.f$i -row $row -column $column -padx 0; incr column
    grid $f.grid.r$i -row $row -column $column -padx 0; incr column
    if {$column == 4  ||  $column == 9} {
      label $f.grid.sp_$i -text "  "
      grid $f.grid.sp_$i -row $row -column $column
    }
  }

  updatePatternImages

  ### Buttons that manipulate patterns:
  set f .sm.mp.patt.b2
  frame $f
  dialogbutton $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 [tr PatternWhiteIQP] -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 [tr PatternWhiteIQPBreakE6] -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 [tr PatternWhiteIQPBreakC6] -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 c 6 Yes} {bp e ? No} {bp d ? No}}
  }
  $f.common.m add command -label [tr PatternBlackIQP] -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 [tr PatternWhiteBlackIQP] -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 [tr PatternCoupleC3D4] -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 [tr PatternHangingC5D5] -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 [tr PatternMaroczy] -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 [tr PatternRookSacC3] -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 [tr PatternKc1Kg8] -command {
    setPatterns { {wk c 1 Yes} {bk g 8 Yes} }
  }
  $f.common.m add command -label [tr PatternKg1Kc8] -command {
    setPatterns { {wk g 1 Yes} {bk c 8 Yes} }
  }
  $f.common.m add command -label [tr PatternLightFian] -command {
    set pMin(wb) 1; set pMin(bb) 1
    setPatterns { {wb g 2 Yes} {bb b 7 Yes} }
  }
  $f.common.m add command -label [tr PatternDarkFian] -command {
    set pMin(wb) 1; set pMin(bb) 1
    setPatterns { {wb b 2 Yes} {bb g 7 Yes} }
  }
  $f.common.m add command -label [tr PatternFourFian] -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
  #}
  updatePatternImages

  addHorizontalRule $w

  ### Now the move counter:

  set f $w.bishops
  pack [frame $f] -side top
  label $f.t1 -text "1" -font font_Small
  label $f.t2 -image wb20
  label $f.t3 -text "- 1" -font font_Small
  label $f.t4 -image bb20
  label $f.t5 -textvar ::tr(squares:) -font font_Small
  radiobutton $f.same -textvar ::tr(SameColor) -variable oppBishops \
    -value "Same" -padx 5 -pady 4 -font font_Small
  radiobutton $f.opp -textvar ::tr(OppColor) -variable oppBishops \
    -value "Opposite" -padx 5 -pady 4 -font font_Small
  radiobutton $f.either -textvar ::tr(Either) -variable oppBishops \
    -value "Either" -padx 5 -pady 4 -font font_Small
  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 -padx 4

  dialogbutton $f.save -textvar ::tr(Save...) -padx 10 -command ::search::material::save

  dialogbutton $f.stop -textvar ::tr(Stop) -command sc_progressBar
  $f.stop configure -state disabled

  dialogbutton $f.search -textvar ::tr(Search) -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 $::search::filter::operation \
               -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)" \
               -patt "$pattBool(10) $pattPiece(10) $pattFyle(10) $pattRank(10)" ]
    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
    ::windows::gamelist::Refresh
    ::windows::stats::Refresh
  }

  dialogbutton $f.cancel -textvar ::tr(Close) \
    -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
  ::search::Config
  focus $f.search
}

proc ::search::material::save {} {
  global pMin pMax ignoreColors 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 minMoveNum maxMoveNum minHalfMoves oppBishops
    ::search::filter::operation
  } {
    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
}

# 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
	}
    }
}
###
### tools/email.tcl: part of Scid.
### Copyright (C) 1999-2003  Shane Hudson.
###

# Email manager window: closed by default
set emailWin 0


# ::tools::email
#
#   Opens the email chess manager window, for sending moves to opponents.
#
proc ::tools::email {} {
  global emailWin emailData
  set w .emailWin
  if {[winfo exists $w]} {
    destroy .emailWin
    set emailWin 0
    return
  }
  set emailWin 1
  toplevel $w
  wm title $w "Scid: Email Manager"
  wm minsize $w 25 10

  bind $w <Destroy> { set .emailWin 0 }
  bind $w <F1> { helpWindow Email }

  frame $w.f
  frame $w.b
  pack $w.f -side left -fill y
  addVerticalRule $w
  pack $w.b -side right -fill y

  set f $w.f
  label $f.title -text "Opponent list" -font font_Bold
  listbox $f.list -height 16 -width 40 -exportselection false \
    -selectmode browse -selectbackground lightBlue -font font_Fixed \
    -yscrollcommand "$f.scroll set" -background white -setgrid 1
  scrollbar $f.scroll -command "$w.list yview" -takefocus 0
  pack $f -side left -expand true -fill both
  pack $f.title -side top
  pack $f.scroll -side right -fill y
  pack $f.list -side right -expand true -fill both

  bind $f.list <ButtonRelease-1> ::tools::email::refreshButtons
  bind $f.list <Enter> ::tools::email::refreshButtons
  bind $f.list <Key-Up> ::tools::email::refreshButtons
  bind $f.list <Key-Down> ::tools::email::refreshButtons

  bind $f.list <Key-a> {.emailWin.b.add invoke}
  bind $f.list <Key-e> {.emailWin.b.edit invoke}
  bind $f.list <Key-d> {.emailWin.b.delete invoke}
  bind $f.list <Key-l> {.emailWin.b.load invoke}
  bind $f.list <Key-s> {.emailWin.b.send invoke}
  bind $f.list <Key-t> {.emailWin.b.time.m post [winfo pointerx .] [winfo pointery .]}

  set b .emailWin.b

  button $b.add -text "Add..." -underline 0 -command {
    set idx [llength $emailData]
    lappend emailData [list "" "" "" "" ""]
    modifyEmailDetails $idx
    ::tools::email::refresh
  }

  button $b.edit -text "Edit..." -underline 0 -command ::tools::email::EditButton
  button $b.delete -text "Delete..." -underline 0 -command ::tools::email::DeleteButton
  button $b.load -text "Load game" -underline 0 -command ::tools::email::LoadButton
  button $b.send -text "Send email..." -underline 0 -command ::tools::email::SendButton
  menubutton $b.time -text "Time" -underline 0 -indicatoron 1 \
    -menu $b.time.m -relief raised
  menu $b.time.m
  $b.time.m add command -label "Received today" -underline 0 \
    -command {::tools::email::TimesButton r}
  $b.time.m add command -label "Sent today" -underline 0 \
    -command {::tools::email::TimesButton s}
  $b.time.m add command -label "Edit..." -underline 0 \
    -command {::tools::email::TimesButton e}

  button $b.config -text "Settings..." -command ::tools::email::config
  button $b.help -text $::tr(Help) -command { helpWindow Email }
  button $b.close -text $::tr(Close) -command { destroy .emailWin }

  foreach i {add edit delete load send time config help close} {
    $b.$i configure -font font_Small
  }
  pack $b.add $b.edit $b.delete $b.load $b.send $b.time \
    -side top -pady 1 -padx 5 -fill x
  pack $b.close $b.help $b.config -side bottom -pady 1 -padx 5  -fill x

  bind $w <Destroy> { set emailWin 0 }
  set emailData [::tools::email::readOpponentFile]
  focus $w.f.list
  ::tools::email::refresh
}

proc ::tools::email::config {} {
  global email
  set w .emailConfig
  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 invoke [tr OptionsSave]
    catch {grab release .emailConfig}
    destroy .emailConfig
  }
  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 ::tools::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
    }
  }
  ::tools::email::refresh
}

proc ::tools::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]
    ::tools::email::writeOpponentFile $emailData
    ::tools::email::refresh
  }
}

proc ::tools::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 {::game::Load [lindex [lindex $details 3] 0]} result]} {
      tk_messageBox -type ok -icon warning -title "Scid" -message $result
    } else {
      sc_move end
    }
  }
}

proc ::tools::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 ::tools::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"} {
    ::tools::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]
    ::tools::email::writeOpponentFile $emailData
    grab release .emailTimesWin
    ::tools::email::refresh 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 ::tools::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 {::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 [::utils::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]
  ::tools::email::writeOpponentFile $emailData
  ::tools::email::refresh 0
}

proc ::tools::email::refreshButtons {} {
  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 ::tools::email::refresh {{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
  }
  ::tools::email::refreshButtons
}

#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 ::tools::email::helpBar ""

# Force the game numbers list to be digits and spaces only:
trace variable emailData_glist w {::utils::validate::Regexp {^[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 "::tools::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 ::tools::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 {::tools::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 {
    ::tools::email::addSentReceived $idx s
    tk_messageBox -icon info -type ok -title "Scid" -message $result
    destroy $w
  }
}

proc ::tools::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"} ::tools::email::id]} {
      close $copy_id
      return -code error "Scid could not find the sendmail program: $email(smproc)"
    }
    if {[string trim $from] != ""} {
      puts $::tools::email::id "From: $from"
    }
    puts $::tools::email::id "To: $to"
    puts $::tools::email::id "Subject: $subject"
    if {[string trim $bcc] != ""} {
      puts $::tools::email::id "Bcc: $bcc"
    }
    puts $::tools::email::id ""
    puts $::tools::email::id $message
    close $::tools::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 ::tools::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 ::tools::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 ::tools::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 ::tools::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 ::tools::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 \$::tools::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 [::tools::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]]]
      ::tools::email::writeOpponentFile $emailData
      destroy .emailEditor
      ::tools::email::refresh
    }
  }
  button $f.cancel -text "Cancel" -command {
    set emailData [::tools::email::readOpponentFile]
    destroy .emailEditor
    ::tools::email::refresh
  }
  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 ::tools::email::validGameNumbers {numberList} {
  foreach i $numberList {
    if {$i < 1  ||  $i > [sc_base numGames]} { return $i }
  }
  return -1
}

proc ::tools::email::opponentFilename {} {
  set filename [sc_base filename]
  append filename ".sem"
  return $filename
}

proc ::tools::email::readOpponentFile {} {
  set filename [::tools::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 ::tools::email::writeOpponentFile {data} {
  set filename [::tools::email::opponentFilename]
  if {[catch {set f [open $filename "w"]} ]} {
    # puts "Unable to write opponent file"
    return {}
  }
  puts $f $data
  close $f
}

###
### 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 [::utils::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 80 -wrap none -background white \
    -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} {
      updateBoard -pgn
      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 }
  # bind $w.pane.edit.text <Any-KeyRelease> { .importWin.b.ok invoke }
  focus $w.pane.edit.text
}


proc importClipboardGame {} {
  importPgnGame
  catch {event generate .importWin.pane.edit.text <<Paste>>}
}

proc importPgnLine {line} {
  importPgnGame
  set w .importWin.pane.edit.text
  $w delete 1.0 end
  $w insert end $line
  $w tag add sel 1.0 end
  focus $w
}

proc importMoveList {line} {
  sc_move start
  sc_move addSan $line
  updateBoard -pgn
}

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 ""
  set err [catch {sc_base import file $fname} result]
  set warnings ""
  $w.text configure -state normal
  $w.text configure -cursor top_left_arrow
  if {$err} {
    $w.text insert end $result
  } else {
    set nImported [lindex $result 0]
    set warnings [lindex $result 1]
    set str "Imported $nImported "
    if {$nImported == 1} { append str "game" } else { append str "games" }
    if {$warnings == ""} {
      append str " with no PGN errors or warnings."
    } else {
      append str ".\nPGN errors/warnings:\n$warnings"
    }
    $w.text insert end $str
  }
  $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 .
  # Auto-close import progress window if there were no errors/warnings?
  if {!$err  &&  $warnings == ""} { destroy $w }
  updateTitle
  updateMenuStates
  ::windows::switcher::Refresh
  ::maint::Refresh
  update
}

###
### End of file: import.tcl
###

### optable.tcl: Opening report and theory table generation.
### Part of Scid. Copyright 2001-2003 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>[OprepTitle]</title>
  <style type="text/css">
  <!--
    h1 { color:#990000 }
    h2 { color:#990000 }
    h3 { color:#990000 }
    .player {
      color:darkblue
    }
    .elo {
      color:green
      font-style:italic
    }
    sup {
      color:red
    }
  -->
  </style>
</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 favorites help} tag {File Favorites 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 2} tag {Add Edit Generate} {
    configMenuText $m.favorites.m $idx OprepFavorites$tag $lang
  }
  foreach idx {0 1} tag {Report Index} {
    configMenuText $m.help.m $idx OprepHelp$tag $lang
  }
}

proc ::optable::makeReportWin {args} {
  if {! [sc_base inUse]} { return }
  set showProgress 1
  set args [linsert $args 0 "args"]
  if {[lsearch -exact $args "-noprogress"] >= 0} { set showProgress 0 }
  if {$showProgress} {
    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 {$showProgress} {
    if {$::optable::_interrupt} {
      unbusyCursor .
      grab release $w.b.cancel
      destroy $w
      return
    }
    sc_progressBar $w.c2 bar 401 21 time
  }
  sc_report opening create $::optable(ExtraMoves) $::optable(MaxGames)\
    $::optable::_data(exclude)
  if {$showProgress} {
    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]

  if {[lsearch -exact $args "-nodisplay"] >= 0} { return }

  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.favorites -text OprepFavorites -menu $w.menu.favorites.m
    menubutton $w.menu.help -text OprepHelp -menu $w.menu.help.m
    foreach i {file favorites 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.favorites.m add command -label OprepFavoritesAdd \
      -command ::optable::addFavoriteDlg
    $w.menu.favorites.m add command -label OprepFavoritesEdit \
      -command ::optable::editFavoritesDlg
    $w.menu.favorites.m add command -label OprepFavoritesGenerate \
      -command ::optable::generateFavoriteReports
    $w.menu.favorites.m add separator
    $w.menu.help.m add command -label OprepHelpReport \
      -accelerator F1 -command {helpWindow Reports Opening}
    $w.menu.help.m add command -label OprepHelpIndex \
      -command {helpWindow Index}
    ::optable::updateFavoritesMenu

    bind $w <F1> {helpWindow Reports Opening}
    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"
    bindMouseWheel $w $w.text

    text $w.text -height 30 -width 85 -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.previewLaTeX -textvar ::tr(OprepViewLaTeX) \
      -command ::optable::previewLaTeX
    button $w.b.previewHTML -textvar ::tr(OprepViewHTML) \
      -command ::optable::previewHTML
    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 Reports Opening}
    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.previewLaTeX -side left -padx 1 -pady 2
    } else {
      pack $w.b.previewHTML -side left -padx 1 -pady 2
    }
    pack $w.b.opts $w.b.lexclude $w.b.exclude -side left -padx 1 -pady 2
    ::optable::ConfigMenus
    ::utils::win::Centre $w
  }

  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 .
  ::windows::gamelist::Refresh
  ::windows::stats::Refresh
}

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
  }
  set left 0
  set right 1
  foreach i {Stats Oldest Newest Popular MostFrequent sep \
               AvgPerf HighRating sep \
               Results Shortest col \
               MoveOrders MovesFrom Themes Endgames gap sep \
               MaxGames ExtraMoves sep} {
    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 == "col"} {
      incr left 4
      frame $w.f.colsep$left -width 8
      grid $w.f.colsep$left -row 0 -column $left
      incr left
      set right [expr {$left + 1}]
      set row 0
    } elseif {$i == "gap"} {
      # nothing
    } elseif {$i == "sep"} {
      frame $w.f.fsep$row$left -height 2 -borderwidth 2 -relief sunken -bg white
      frame $w.f.tsep$row$left -height 2 -borderwidth 2 -relief sunken -bg white
      grid $w.f.fsep$row$left -row $row -column $left -sticky we -columnspan 4
      #grid $w.f.tsep$row$left -row $row -column $right -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
      checkbutton $w.f.f$i -variable ::optable($i) -onvalue 1 -offvalue 0
      label $w.f.t$i -textvar ::tr(Oprep$i) -font font_Small
      grid $w.f.f$i -row $row -column $left -sticky n
      grid $w.f.t$i -row $row -column $right -sticky w -columnspan 3
    } else {
#      scale $w.f.s$i -variable ::optable($i) -from $from -to $to \
#        -width 8 -length 160 -tickinterval $tick -orient horizontal \
#        -font font_Small -resolution $res -showvalue 0 -sliderlength 20
      ::combobox::combobox $w.f.s$i -textvariable ::optable($i) \
        -editable false -width 2 -height 11 -justify right -font font_Small
      if {$i == "MaxGames"} {
        $w.f.s$i configure -width 3
      }
      for {set x $from} {$x <= $to} {incr x $res} {
        $w.f.s$i list insert end $x
      }
      label $w.f.t$i -textvar ::tr(Oprep$i) -font font_Small
      grid $w.f.s$i -row $row -column $left ;# -sticky e
      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 $right -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 $right -sticky w -columnspan 3
      }
    }
    grid rowconfigure $w.f $row -pad 2
    if {$i != "col"} { incr row }
  }
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  dialogbutton $w.b.defaults -textvar ::tr(Defaults) -command {
    array set ::optable [array get ::optableDefaults]
  }
  dialogbutton $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)}
  }
  dialogbutton $w.b.cancel -textvar ::tr(Cancel) -command {
    array set ::optable [array get ::optable::backup]
    destroy .oprepOptions
  }
  packbuttons left $w.b.defaults
  packbuttons right $w.b.cancel $w.b.ok
  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 $::scidLogDir
  set tmpfile "TempOpeningReport"
  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 .
}

# previewHTML:
#   Saves the report to a temporary file, and invokes the user's web
#   browser to display it.
#
proc ::optable::previewHTML {} {
  busyCursor .
  set tmpdir $::scidLogDir
  set tmpfile "TempOpeningReport"
  set fname [file join $tmpdir $tmpfile]
  if {[catch {set tempfile [open $fname.html w]}]} {
    tk_messageBox -title "Scid: Error writing report" -type ok -icon warning \
      -message "Unable to write the file: $fname.html"
  }
  puts $tempfile [::optable::report html 1 $::optable::_flip]
  close $tempfile
  if {[string match $::tcl_platform(os) "Windows NT"]} {
    catch {exec $::env(COMSPEC) /c start $fname.html &}
  } else {
    catch {exec start $fname.html &}
  }
  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_report opening create $::optable(ExtraMoves) $::optable(MaxGames)
  ::optable::setupRatios
}

# latexifyTree
#   Convert the plain text tree output used for text/html reports
#   to a table for LaTeX output.
#
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@{:}rrrrrr}\n\\hline\n"
  append ltree " & Move & ECO & \\multicolumn{2}{c}{Frequency}"
  append ltree " & Score & \$\\mu\$Elo & Perf & \$\\mu\$Year & \\% Draws \\\\ \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 pctDraw [string range $line 59 61]
    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 & $pctDraw\\% \\\\ \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 [::utils::date::today year]-$y]"
    append year ".[::utils::date::today month].[::utils::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 fmt} {
  set p "%"
  if {$fmt == "latex"} { set p "\\%" }
  return "[expr $x / 10][sc_info decimal][expr $x % 10]$p"
}

proc ::optable::results {reportType fmt} {
  set s {}

  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 [::utils::string::Capital $::tr(score)]
  set slen [string length $score]
  if {$slen < 7} { set slen 7 }

  append s " [::utils::string::Pad {} $len] $next"
  append s "[::utils::string::PadRight $score $slen] $next"
  if {$fmt == "latex"} {
    append s "\\multicolumn{3}{c}{$::tr(OprepLength)} & "
    append s "\\multicolumn{3}{c}{$::tr(OprepFrequency)} $n "
  } else {
    append s "[::utils::string::PadCenter $::tr(OprepLength) 19] $next"
    append s "[::utils::string::PadCenter $::tr(OprepFrequency) 22] $n"
  }

  append s " [::utils::string::Pad {} $len] $next"
  append s "[::utils::string::PadRight {} $slen] $next"
  append s "[::utils::string::PadRight $white 5] $next"
  append s "[::utils::string::PadRight $draw  5] $next"
  append s "[::utils::string::PadRight $black 5] $next"
  append s "[::utils::string::PadRight $white 5]  $next"
  append s "[::utils::string::PadRight $draw  5]  $next"
  append s "[::utils::string::PadRight $black 5]  $n"
  if {$fmt == "latex"} { append s "\\hline\n" }

  set sc [sc_report $reportType score]
  set wlen [sc_report $reportType avgLength 1]
  set dlen [sc_report $reportType avgLength =]
  set blen [sc_report $reportType avgLength 0]
  set wf [sc_report $reportType freq 1]
  set df [sc_report $reportType freq =]
  set bf [sc_report $reportType freq 0]

  append s " [::utils::string::Pad $::tr(OprepReportGames) $len] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $sc 0] $fmt] $slen] $next"
  append s "[::utils::string::PadRight [lindex $wlen 0] 5] $next"
  append s "[::utils::string::PadRight [lindex $dlen 0] 5] $next"
  append s "[::utils::string::PadRight [lindex $blen 0] 5] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $wf 0] $fmt] 6] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $df 0] $fmt] 6] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $bf 0] $fmt] 6] $n"

  append s " [::utils::string::Pad $::tr(OprepAllGames) $len] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $sc 1] $fmt] $slen] $next"
  append s "[::utils::string::PadRight [lindex $wlen 1] 5] $next"
  append s "[::utils::string::PadRight [lindex $dlen 1] 5] $next"
  append s "[::utils::string::PadRight [lindex $blen 1] 5] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $wf 1] $fmt] 6] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $df 1] $fmt] 6] $next"
  append s "[::utils::string::PadRight [::optable::_percent [lindex $bf 1] $fmt] 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 {fmt} {
  global stats
  set s {}
  set all $::tr(OprepStatAll)
  set both $::tr(OprepStatBoth)
  set since $::tr(OprepStatSince)
  set games [::utils::string::Capital $::tr(games)]
  set score [::utils::string::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 {$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 {$fmt == "html"} { append s "<pre>\n" }
  if {$fmt == "ctext"} { append s "<tt>" }
  set stat ""
  append s " [::utils::string::Pad $stat [expr $len - 4]] [::utils::string::PadRight $games 10]"
  append s "     1-0     =-=     0-1 [::utils::string::PadRight $score 8]\n"
  append s "-----------------------------------------------------------"
  append s "\n [::utils::string::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 [::utils::string::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 [::utils::string::Pad $stat $len]"   [sc_filter stats year $year]
      }
    }
  }
  append s "\n-----------------------------------------------------------\n"
  if {$fmt == "html"} { append s "</pre>\n" }
  if {$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_report opening 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_report opening 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_report opening count]
  set rgames [lindex $counts 0]
  set tgames [lindex $counts 1]

  set r {}
  append r $::optable::_docStart($fmt)
  set title $::tr(OprepTitle)
  set r [string map [list "\[OprepTitle\]" $title] $r]
  append r [::optable::_title]
  append r "$tr(Database): [file tail [sc_base filename]] "
  append r "([::utils::thousands [sc_base numGames]] $games)$n"
  append r "$tr(OprepReport): [sc_report opening line] ("
  if {$fmt == "ctext"} {
    append r "<darkblue><run sc_report opening select all 0; ::windows::stats::Refresh>"
  }
  append r "$rgames"
  if {$fmt == "ctext"} { append r "</run></darkblue>"; }
  append r " $games)$n"
  set eco [sc_report opening eco]
  if {$eco != ""} {
    append r "$tr(ECO): $eco$n"
  }
  append r "$::tr(OprepGenerated) Scid [sc_info version], [::utils::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 $fmt]
  }
  if {$::optable(Oldest) > 0} {
    append r [::optable::_subsec $tr(OprepOldest)]
    append r [sc_report opening best o $::optable(Oldest)]
  }
  if {$::optable(Newest) > 0} {
    append r [::optable::_subsec $tr(OprepNewest)]
    append r [sc_report opening 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 [::utils::string::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 [::utils::string::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 [::utils::string::PadCenter $range 8]
    }
    append r $n
    append r [::utils::string::Pad $sEvery $len]
    foreach y {1800 1900 1950 1970 1980 1990 2000} {
      append r $next
      append r [::utils::string::PadCenter $::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_report opening players white $::optable(MostFrequent)]
  }
  if {$::optable(MostFrequent) > 0  &&  $::optable(MostFrequentBlack)} {
    append r [::optable::_subsec "$tr(OprepMostFrequent) ($tr(Black))"]
    append r [sc_report opening 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_report opening 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_report opening 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_report opening 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::_subsec $::tr(OprepResults)]
    append r [::optable::results opening $fmt]
  }
  if {$::optable(Shortest) > 0  &&  $::optable(ShortestWhite)} {
    append r [::optable::_subsec "$tr(OprepShortest) ($tr(White))"]
    append r [sc_report opening best w $::optable(Shortest)]
  }
  if {$::optable(Shortest) > 0  &&  $::optable(ShortestBlack)} {
    append r [::optable::_subsec "$tr(OprepShortest) ($tr(Black))"]
    append r [sc_report opening 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_report opening 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_report opening 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_report opening themes $tr(OprepThemeDescription:) \
                $tr(OprepThemeSameCastling:) $tr(OprepThemeOppCastling:) \
                $tr(OprepThemeKPawnStorm:) $tr(OprepThemeQueenswap:) \
                $tr(OprepTheme1BishopPair:) \
                $tr(OprepThemeWIQP:) $tr(OprepThemeBIQP:) \
                $tr(OprepThemeWP567:) $tr(OprepThemeBP234:) \
                $tr(OprepThemeOpenCDE:) ]
  }

  if {$::optable(Endgames) > 0} {
    append r [::optable::_subsec $tr(OprepEndgames)]
    append r "$tr(OprepEndClass:)$n"
    append r [sc_report opening 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_report opening 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_report opening format $fmt
  set ::optable::_data(fmt) $fmt
  set r {}
  append r $::optable::_docStart($fmt)
  set r [string map [list "\[OprepTitle\]" $::tr(OprepTitle)] $r]
  append r [sc_report opening print]
  append r $::optable::_docEnd($fmt)
  return $r
}


set reportFavorites {}

# updateFavoritesMenu
#   Update the Favorites menu in the report window, adding a
#   command for each favorite report position.
#
proc ::optable::updateFavoritesMenu {} {
  set m .oprepWin.menu.favorites.m
  $m delete 3 end
  $m add separator
  foreach entry $::reportFavorites {
    set name [lindex $entry 0]
    set moves [lindex $entry 1]
    $m add command -label $name \
      -command "importMoveList [list $moves]; ::optable::makeReportWin"
  }
  if {[llength $::reportFavorites] == 0} {
    $m entryconfigure 1 -state disabled
    $m entryconfigure 2 -state disabled
  } else {
    $m entryconfigure 1 -state normal
    $m entryconfigure 2 -state normal
  }
}

# favoriteReportNames
#   Return a list of the favorite report names.
#
proc ::optable::favoriteReportNames {} {
  set reportNames {}
  foreach entry $::reportFavorites {
    lappend reportNames [lindex $entry 0]
  }
  return $reportNames
}

# addFavoriteDlg
#   Adds the current position to the opening report favorites list.
#
proc ::optable::addFavoriteDlg {} {
  set w .addFavoriteDlg
  toplevel $w
  wm title $w "Scid: Add Opening Report Favorite"
  label $w.name -text "Enter a name for the opening report of this position:"
  pack $w.name -side top
  # label $w.name2 -text "(Use letters, digits, spaces and undercores only)"
  # pack $w.name2 -side top
  entry $w.e -width 40
  pack $w.e -side top -fill x -padx 2
  addHorizontalRule $w
  label $w.old -text "Existing favorite report names:"
  pack $w.old -side top
  pack [frame $w.existing] -side top -fill x -padx 2
  text $w.existing.list -width 30 -height 10 -background gray90 \
    -yscrollcommand [list $w.existing.ybar set]
  scrollbar $w.existing.ybar -command [list $w.existing.list yview]
  pack $w.existing.ybar -side right -fill y
  pack $w.existing.list -side left -fill both -expand yes
  foreach entry $::reportFavorites {
      $w.existing.list insert end "[lindex $entry 0]\n"
  }
  $w.existing.list configure -state disabled
  addHorizontalRule $w
  frame $w.b
  pack $w.b -side bottom -fill x
  button $w.b.ok -text OK -command ::optable::addFavoriteOK
  button $w.b.cancel -text $::tr(Cancel) -command "grab release $w; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 5
  focus $w.e
  grab $w
}

proc ::optable::addFavoriteOK {} {
  global reportFavorites
  set w .addFavoriteDlg
  set reportName [$w.e get]
  set err ""
  if {$reportName == ""} {
    set err "The report name must not be empty."
  } elseif {[lsearch -exact [::optable::favoriteReportNames] $reportName] >= 0} {
    set err "That name is already used for another favorite report position."
  } else {
    lappend reportFavorites [list $reportName [sc_game moves]]
    ::optable::saveFavorites
    ::optable::updateFavoritesMenu
    grab release $w
    destroy $w
    return
  }
  tk_messageBox -title Scid -icon info -type ok -message $err
}

set reportFavoritesName ""

# editFavoritesDlg
#   Open the dialog box for editing the list of opening report
#   favorite positions.
#
proc ::optable::editFavoritesDlg {} {
  global reportFavorites reportFavoritesTemp reportFavoritesName
  set w .editFavoritesDlg
  if {[winfo exists $w]} { return }

  set ::reportFavoritesTemp $::reportFavorites
  toplevel $w
  wm title $w "Scid: [tr OprepFavoritesEdit]"
  wm transient $w .
  bind $w <F1> {helpWindow Reports Opening}
  entry $w.e -width 60 -foreground black -background white \
    -textvariable reportFavoritesName -font font_Small -exportselection 0
  bind $w.e <FocusIn>  "$w.e configure -background lightYellow"
  bind $w.e <FocusOut> "$w.e configure -background white"

  trace variable reportFavoritesName w ::optable::editFavoritesRefresh
  pack $w.e -side top -fill x
  pack [frame $w.b] -side bottom -fill x
  autoscrollframe $w.f listbox $w.f.list -width 50 -height 10 \
    -fg black -bg white -exportselection 0 -font font_Small -setgrid 1
  pack $w.f -side top -fill both -expand yes
  bind $w.f.list <<ListboxSelect>>  ::optable::editFavoritesSelect
  foreach entry $::reportFavoritesTemp {
    set name [lindex $entry 0]
    set moves [lindex $entry 1]
    $w.f.list insert end "$name \[$moves\]"
  }
  button $w.b.delete -text $::tr(Delete)  -command ::optable::editFavoritesDelete
  button $w.b.up -image bookmark_up -command {::optable::editFavoritesMove up}
  button $w.b.down -image bookmark_down -command {::optable::editFavoritesMove down}
  foreach i [list $w.b.up $w.b.down] {
    $i configure -padx 0 -pady 0 -borderwidth 1
  }
  button $w.b.ok -text "OK" -command ::optable::editFavoritesOK
  button $w.b.cancel -text "Cancel" -command {
    catch {grab release .editFavoritesDlg}
    destroy .editFavoritesDlg
  }
  pack $w.b.delete $w.b.up $w.b.down -side left -padx 2 -pady 2
  pack $w.b.cancel $w.b.ok -side right -padx 2 -pady 2
  set editFavoritesName ""

  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 protocol $w WM_DELETE_WINDOW [list $w.b.cancel invoke]
  wm deiconify $w
  update
  catch {grab $w}
}

proc ::optable::editFavoritesRefresh {args} {
  global reportFavoritesTemp reportFavoritesName
  set list .editFavoritesDlg.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set name $reportFavoritesName
  set e [lindex $reportFavoritesTemp $sel]
  set moves [lindex $e 1]
  set e [lreplace $e 0 0 $name]
  set reportFavoritesTemp [lreplace $reportFavoritesTemp $sel $sel $e]
  $list insert $sel "$name \[$moves\]"
  $list delete [expr $sel + 1]
  $list selection clear 0 end
  $list selection set $sel
}

proc ::optable::editFavoritesSelect {} {
  set list .editFavoritesDlg.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} {
    set ::reportFavoritesName ""
    return
  }
  if {$sel >= [llength $::reportFavoritesTemp]} {
    $list selection clear 0 end
    set ::reportFavoritesName ""
    return
  }
  set e [lindex $::reportFavoritesTemp $sel]
  set ::reportFavoritesName [lindex $e 0]
}

proc ::optable::editFavoritesDelete {} {
  global reportFavoritesTemp
  set w .editFavoritesDlg
  set list $w.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set reportFavoritesTemp [lreplace $reportFavoritesTemp $sel $sel]
  $list selection clear 0 end
  $list delete $sel
  set ::reportFavoritesName ""

}

proc ::optable::editFavoritesMove {dir} {
  global reportFavoritesTemp
  set w .editFavoritesDlg
  set list $w.f.list
  set sel [lindex [$list curselection] 0]
  if {$sel == ""} { return }
  set e [lindex $reportFavoritesTemp $sel]
  set name [lindex $e 0]
  set moves [lindex $e 1]
  set text "$name \[$moves\]"

  set newsel $sel
  if {$dir == "up"} {
    incr newsel -1
    if {$newsel < 0} { return }
  } else {
    incr newsel
    if {$newsel >= [$list index end]} { return }
  }
  set reportFavoritesTemp [lreplace $reportFavoritesTemp $sel $sel]
  set reportFavoritesTemp [linsert $reportFavoritesTemp $newsel $e]
  $list selection clear 0 end
  $list delete $sel
  $list insert $newsel $text
  $list selection set $newsel
}

proc ::optable::editFavoritesOK {} {
  set w .editFavoritesDlg
  catch {grab release $w}
  destroy $w
  set ::reportFavorites $::reportFavoritesTemp
  ::optable::saveFavorites
  ::optable::updateFavoritesMenu
}

proc ::optable::favoritesFilename {} {
  return [scidConfigFile reports]
}

proc ::optable::saveFavorites {} {
  set fname [::optable::favoritesFilename]
  if {[catch {open $fname w} f]} {
    # tk_messageBox ...
    return
  }
  puts $f "# Scid opening report favorites file"
  puts $f ""
  puts $f "set reportFavorites [list $::reportFavorites]"
  close $f
}

proc ::optable::loadFavorites {} {
  global reportFavorites
  set fname [::optable::favoritesFilename]
  catch {source $fname}
}

::optable::loadFavorites

set reportFormat html
set reportType full

proc ::optable::generateFavoriteReports {} {
  global reportFavorites
  if {[llength $reportFavorites] == 0} {
    tk_messageBox -title "Scid" -type ok -icon info \
      -message "You have no favorite report positions."
    return
  }
  set ::reportDir $::initialDir(report)

  set w .reportFavoritesDlg
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: Generate Reports..."
  pack [label $w.typelabel -text "Select the report type:" -font font_Bold] -side top
  pack [frame $w.type] -side top -padx 2
  radiobutton $w.type.full -text "Full" -variable reportType -value full
  radiobutton $w.type.compact -text "Compact (no theory table)" -variable reportType -value compact
  radiobutton $w.type.theory -text "Theory table only" -variable reportType -value theory
  pack $w.type.full $w.type.compact $w.type.theory -side left -padx 4
  addHorizontalRule $w
  pack [label $w.fmtlabel -text "Select the report file format:" -font font_Bold] -side top
  pack [frame $w.fmt] -side top -padx 2
  radiobutton $w.fmt.text -text "Plain text (.txt)" -variable reportFormat -value text
  radiobutton $w.fmt.html -text "HTML" -variable reportFormat -value html
  radiobutton $w.fmt.latex -text "LaTeX" -variable reportFormat -value latex
  pack $w.fmt.text $w.fmt.html $w.fmt.latex -side left -padx 4
  addHorizontalRule $w
  pack [frame $w.dir] -side top -padx 2 -pady 2
  label $w.dir.label -text "Save reports in the folder: " -font font_Bold
  entry $w.dir.entry -background white -textvariable ::reportDir
  button $w.dir.choose -text $::tr(Browse...) -command {
    set tmpdir [tk_chooseDirectory -parent .reportFavoritesDlg \
      -title "Scid: Choose Report Folder"]
    if {$tmpdir != ""} {
      set ::reportDir [file nativename $tmpdir]
    }
  }
  pack $w.dir.label -side left
  pack $w.dir.choose -side right
  pack $w.dir.entry -side left -fill x
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  button $w.b.ok -text "OK"\
    -command "::optable::reportFavoritesOK; grab release $w; destroy $w; ::optable::makeReportWin"
  button $w.b.cancel -text $::tr(Cancel) -command "grab release $w; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 5
  grab $w
}

proc ::optable::reportFavoritesOK {} {
  global reportDir reportFormat reportType
  set ::initialDir(report) $reportDir
  set fmt $reportFormat
  switch $reportFormat {
    "html" { set suffix ".html" }
    "text" { set suffix ".txt" }
    "latex" { set suffix "tex" }
  }

  set w .reportsProgress
  toplevel $w
  wm withdraw $w
  wm title $w "Scid: Generating Reports"
  bind $w <Visibility> "raiseWin $w"
  pack [label $w.t -width 40 -text "Generating reports. Please wait..." -font font_Bold] -side top -pady 5
  pack [label $w.report] -side top -pady 5
  ::utils::win::Centre $w
  wm deiconify $w
  grab $w
  update

  set count 0
  set total [llength $::reportFavorites]
  foreach entry $::reportFavorites {
    set name [lindex $entry 0]
    set moves [lindex $entry 1]
    set fname [file join $reportDir "$name$suffix"]
    if {[catch {open $fname w} f]} {
      tk_messageBox -title "Scid" -icon warning -type ok \
        -message "Unable to write file: $fname\n$f"
      grab release $w
      destroy $w
      return
    }
    incr count
    $w.report configure -text "$count / $total: $name$suffix"
    update
    sc_game push
    sc_move addSan $moves
    ::optable::makeReportWin -nodisplay -noprogress
    if {$reportType == "theory"} {
      set report [::optable::table $fmt]
    } elseif {$reportType == "compact"} {
      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]}
    }
    sc_game pop
    puts $f $report
    close $f
  }
  grab release $w
  destroy $w
}

# end of optable.tcl
# end of optable.tcl
# preport.tcl: Player reports.
# Part of Scid. Copyright 2003 Shane Hudson

namespace eval ::preport {}
array set ::preport::_data {}

set preport(MaxGames) 400

set ::preport::_player ""
set ::preport::_color white
set ::preport::_pos start
set ::preport::_clipbase 0

# preportDlg
#   Present a dialog allowing the user to select the
#   player and color for which to generate a player report.
#
proc ::preport::preportDlg {args} {

  # Set default player and color if parameters are provided
  if {[llength $args] >= 1} {
    set ::preport::_player [lindex $args 0]
    if {$::preport::_player == [sc_game info white]} {
      set ::preport::_color white
    } elseif {$::preport::_player == [sc_game info black]} {
      set ::preport::_color black
    }
  }
  if {[llength $args] >= 2} {
    set ::preport::_color [lindex $args 1]
  }

  set w .preportDlg
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: [tr ToolsPlayerReport]"
  wm resizable $w 0 0
  pack [label $w.plabel -text "Generate Player Report"]
  pack [frame $w.g] -side top -fill x -expand yes -padx 2
  label $w.g.where -text "Player:"
  grid $w.g.where -row 0 -column 0 -sticky w
  ::combobox::combobox $w.g.player -width 40 -textvariable ::preport::_player
  ::utils::history::SetCombobox ::preport::_player $w.g.player
  grid $w.g.player -row 0 -column 1 -sticky we
  label $w.g.has -text "Color:"
  grid $w.g.has -row 1 -column 0 -sticky w
  frame $w.g.color
  radiobutton $w.g.color.white -text $::tr(White) \
    -variable ::preport::_color -value white
  frame $w.g.color.gap -width 5
  radiobutton $w.g.color.black -text $::tr(Black) \
    -variable ::preport::_color -value black
  pack $w.g.color.white $w.g.color.gap $w.g.color.black -side left
  grid $w.g.color -row 1 -column 1 -sticky w
  label $w.g.pos -text "Start position:"
  grid $w.g.pos -row 2 -column 0
  frame $w.g.pselect
  radiobutton $w.g.pselect.start -text "Standard start position" \
    -variable ::preport::_pos -value start
  radiobutton $w.g.pselect.current -text "Current board position" \
    -variable ::preport::_pos -value current
  pack $w.g.pselect.start $w.g.pselect.current -side left
  grid $w.g.pselect -row 2 -column 1 -sticky w
  checkbutton $w.g.clipbase -text $::tr(PReportClipbase) \
    -variable ::preport::_clipbase
  grid $w.g.clipbase -row 3 -column 1 -sticky w
  addHorizontalRule $w
  pack [frame $w.b] -side bottom -fill x
  pack [frame $w.b2] -side bottom -fill x
  set whiteName [sc_game info white]
  set blackName [sc_game info black]
  dialogbutton $w.b2.white -text "$::tr(White) ($whiteName)" -command {
    set ::preport::_player [sc_game info white]
    set ::preport::_color white
  } -font font_Small
  dialogbutton $w.b2.black -text "$::tr(Black) ($blackName)" -command {
    set ::preport::_player [sc_game info black]
    set ::preport::_color black
  } -font font_Small
  if {$whiteName == ""  ||  $whiteName == "?"} {
    $w.b2.white configure -state disabled
  }
  if {$blackName == ""  ||  $blackName == "?"} {
    $w.b2.black configure -state disabled
  }

  dialogbutton $w.b.help -text $::tr(Help) \
    -command {helpWindow Reports Player}
  dialogbutton $w.b.ok -text OK \
    -command "catch {grab release $w}; destroy $w; ::preport::makeReportWin"
  dialogbutton $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  foreach button {help ok cancel} {
    $w.b.$button configure -font font_Small
  }
  if {$whiteName != ""  &&  $whiteName != "?"} {
    packbuttons left $w.b2.white
  }
  if {$blackName != ""  &&  $blackName != "?"} {
    packbuttons right $w.b2.black
  }
  packbuttons right $w.b.cancel $w.b.ok
  packbuttons left $w.b.help
  if {[sc_base current] == [sc_info clipbase]} {
    $w.g.clipbase configure -state disabled
  }
  bind $w <Return> [list $w.b.ok invoke]
  bind $w <Escape> [list $w.b.cancel invoke]
  ::utils::win::Centre $w
  grab $w
  focus $w.g.player
}

proc ::preport::ConfigMenus {{lang ""}} {
  if {! [winfo exists .preportWin]} { return }
  if {$lang == ""} { set lang $::language }
  set m .preportWin.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 ::preport::makeReportWin {args} {
  if {! [sc_base inUse]} { return }
  set showProgress 1
  set args [linsert $args 0 "args"]
  if {[lsearch -exact $args "-noprogress"] >= 0} { set showProgress 0 }
  if {$showProgress} {
    set w .progress
    toplevel $w
    wm withdraw $w
    wm title $w "Scid: [tr ToolsPlayerReport]"
    bind $w <Visibility> "raiseWin $w"

    pack [frame $w.b] -side bottom -fill x
    set ::preport::_interrupt 0
    button $w.b.cancel -text $::tr(Cancel) -command {
      set ::preport::_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 searchArgs {}
  lappend searchArgs -filter RESET
  lappend searchArgs "-$::preport::_color"
  lappend searchArgs "\"$::preport::_player\""
  eval sc_search header $searchArgs
  if {$showProgress} {
    if {$::preport::_interrupt} {
      unbusyCursor .
      catch {grab release $w.b.cancel}
      destroy $w
      return
    }
    sc_progressBar $w.c2 bar 401 21 time
  }

  ::utils::history::AddEntry ::preport::_player $::preport::_player

  if {$::preport::_pos == "start"} { sc_game push }
  sc_search board AND Exact false
  sc_report player create $::preport(ExtraMoves) $::preport(MaxGames)
  if {$::preport::_pos == "start"} { sc_game pop }
  if {$::preport::_clipbase} {
    if {[sc_base current] != [sc_info clipbase]} {
      sc_clipbase clear
      sc_filter copy [sc_base current] [sc_info clipbase]
    }
  }
  if {$showProgress} {
    unbusyCursor .
    catch {grab release $w.b.cancel}
    destroy $w
    if {$::preport::_interrupt} { return }
  }
  set report [::preport::report ctext 1]

  if {[lsearch -exact $args "-nodisplay"] >= 0} { return }

  set w .preportWin
  if {![winfo exists $w]} {
    toplevel $w
    wm title $w "Scid: $::tr(PReportTitle)"
    frame $w.menu
    pack $w.menu -side top -fill x
    $w configure -menu $w.menu
    menubutton $w.menu.file -text File -menu $w.menu.file.m
    menubutton $w.menu.help -text Help -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 {::preport::saveReport text}
    $w.menu.file.m add command -label OprepFileHtml \
      -command {::preport::saveReport html}
    $w.menu.file.m add command -label OprepFileLaTeX \
      -command {::preport::saveReport latex}
    $w.menu.file.m add separator
    $w.menu.file.m add command -label OprepFileOptions \
      -command ::preport::setOptions
    $w.menu.file.m add separator
    $w.menu.file.m add command -label Close \
      -command "$w.b.close invoke"
    $w.menu.help.m add command -label "Player Report Help" \
      -accelerator F1 -command {helpWindow Reports Player}
    $w.menu.help.m add command -label "Index" \
      -command {helpWindow Index}

    bind $w <F1> {helpWindow Reports Player}
    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"
    bindMouseWheel $w $w.text

    autoscrollframe -bars y $w.scroll text $w.text \
      -height 30 -width 85 -font font_Small -setgrid 1 -wrap word \
      -background white -foreground black -cursor top_left_arrow
    ::htext::init $w.text
    frame $w.b
    button $w.b.opts -text [tr OprepFileOptions] -command ::preport::setOptions
    button $w.b.help -textvar ::tr(Help) -command {helpWindow Reports Player}
    button $w.b.viewHTML -text $::tr(OprepViewHTML) \
      -command ::preport::previewHTML
    button $w.b.update -textvar ::tr(Update...) -command {
      ::preport::preportDlg
    }
    button $w.b.close -textvar ::tr(Close) -command "focus .; destroy $w"
    pack $w.b -side bottom -fill x
    pack $w.scroll -side top -fill both -expand yes
    pack $w.b.close $w.b.update -side right -padx 2 -pady 2
    if {$::windowsOS} {
      pack $w.b.viewHTML -side left -padx 2 -pady 2
    }
    pack $w.b.opts -side left -padx 2 -pady 2
    ::preport::ConfigMenus
    ::utils::win::Centre $w
  }

  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 .
  ::windows::gamelist::Refresh
  ::windows::stats::Refresh
}


proc ::preport::setOptions {} {
  set w .preportOptions
  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 AvgPerf Results MovesFrom Themes Endgames} {
    set yesno($i) 1
  }
  foreach i {Stats Oldest Newest MostFrequentOpponents Results sep \
               AvgPerf HighRating sep \
               MostFrequentEcoCodes 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 ::preport($i) -value 1 \
        -text "$::tr(Yes)   " -font font_Small
      radiobutton $w.f.f$i.no -variable ::preport($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 ::preport($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
      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 ::preport [array get ::preportDefaults]
  }
  button $w.b.ok -text "OK" -command {
    destroy .preportOptions
    catch {set ::preport::_data(yview) [lindex [.preportWin.text yview] 0]}
    ::preport::makeReportWin
    catch {.preportWin.text yview moveto $::preport::_data(yview)}
  }
  button $w.b.cancel -textvar ::tr(Cancel) -command {
    array set ::preport [array get ::preport::backup]
    destroy .preportOptions
  }
  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 ::preport::backup [array get ::preport]
  wm resizable $w 0 0
  wm title $w  "Scid: [tr ToolsPlayerReport]: [tr OprepFileOptions]"
  bind $w <Escape> "$w.b.cancel invoke"
}


# previewHTML:
#   Saves the report to a temporary file, and invokes the user's web
#   browser to display it.
#
proc ::preport::previewHTML {} {
  busyCursor .
  set tmpdir $::scidLogDir
  set tmpfile "TempPlayerReport"
  set fname [file join $tmpdir $tmpfile]
  if {[catch {set tempfile [open $fname.html w]}]} {
    tk_messageBox -title "Scid: Error writing report" -type ok -icon warning \
      -message "Unable to write the file: $fname.html"
  }
  puts $tempfile [::preport::report html 1]
  close $tempfile
  if {[string match $::tcl_platform(os) "Windows NT"]} {
    catch {exec $::env(COMSPEC) /c start $fname.html &}
  } else {
    catch {exec start $fname.html &}
  }
  unbusyCursor .
}

proc ::preport::saveReport {fmt} {
  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 {
    set report [::preport::report $fmt 1]
    if {$::hasEncoding  &&  $::langEncoding($::language) != ""} {
      catch {set report [encoding convertto $::langEncoding($::language) $report]}
    }
    puts $tempfile $report
    close $tempfile
  }
  unbusyCursor .
}

proc ::preport::_reset {} {
  set ::preport::_data(sec) 0
  set ::preport::_data(subsec) 0
}

proc ::preport::_title {} {
  set fmt $::preport::_data(fmt)
  set title $::tr(PReportTitle)
  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 ::preport::_sec {text} {
  set fmt $::preport::_data(fmt)
  incr ::preport::_data(sec)
  set ::preport::_data(subsec) 0
  if {$fmt == "latex"} {
    return "\n\n\\section{$text}\n"
  } elseif {$fmt == "html"} {
    return "\n<h2>$::preport::_data(sec). $text</h2>\n"
  } elseif {$fmt == "ctext"} {
    return "<h4>$::preport::_data(sec). $text</h4>"
  }
  set line "$::preport::_data(sec). [string toupper $text]"
  set underline "-----------------------------------------------------"
  return "\n\n$line\n[string range $underline 1 [string length $line]]\n"
}

proc ::preport::_subsec {text} {
  set fmt $::preport::_data(fmt)
  incr ::preport::_data(subsec)
  if {$fmt == "latex"} {
    return "\n\\subsection{$text}\n\n"
  } elseif {$fmt == "html"} {
    return "\n<h3>$::preport::_data(sec).$::preport::_data(subsec) $text</h3>\n\n"
  } elseif {$fmt == "ctext"} {
    return "\n<maroon><b>$::preport::_data(sec).$::preport::_data(subsec) $text</b></maroon>\n\n"
  }
  return "\n$::preport::_data(sec).$::preport::_data(subsec)  $text\n\n"
}


proc ::preport::report {fmt {withTable 1}} {
  global tr preport
  sc_report player format $fmt
  set fmt [string tolower $fmt]
  set ::preport::_data(fmt) $fmt
  ::preport::_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_report player 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_report player count]
  set rgames [lindex $counts 0]
  set tgames [lindex $counts 1]

  set r {}
  append r $::optable::_docStart($fmt)
  set r [string map [list "\[OprepTitle\]" $tr(PReportTitle)] $r]
  append r [::preport::_title]
  append r "$tr(Player): \"$::preport::_player\""
  if {$::preport::_color == "white"} {
    append r " $tr(PReportColorWhite)"
  } else {
    append r " $tr(PReportColorBlack)"
  }
  set eco ""
  if {$::preport::_pos == "current"  &&  ![sc_pos isAt start]} {
    append r " [format $tr(PReportMoves) [sc_report player line]]"
    set eco [sc_report player eco]
  }
  append r " ("
  if {$fmt == "ctext"} {
    append r "<darkblue><run sc_report player select all 0; ::windows::stats::Refresh>"
  }
  append r "$rgames"
  if {$fmt == "ctext"} { append r "</run></darkblue>"; }
  append r " $games)$n"
  append r "$tr(Database): [file tail [sc_base filename]] "
  append r "([::utils::thousands [sc_base numGames]] $games)$n"
  if {$eco != ""} {
    append r "$tr(ECO): $eco$n"
  }
  append r "$::tr(OprepGenerated) Scid [sc_info version], [::utils::date::today]$n"

  if {$preport(Stats)  ||  $preport(Oldest) > 0  ||  $preport(Newest) > 0  ||
      $preport(MostFrequentOpponents) > 0  ||  $preport(Results)} {
    append r [::preport::_sec $tr(OprepStatsHist)]
  }
  if {$preport(Stats)} {
    append r [::preport::_subsec $tr(OprepStats)]
    append r [::optable::stats $fmt]
  }
  if {$preport(Oldest) > 0} {
    append r [::preport::_subsec $tr(OprepOldest)]
    append r [sc_report player best o $preport(Oldest)]
  }
  if {$preport(Newest) > 0} {
    append r [::preport::_subsec $tr(OprepNewest)]
    append r [sc_report player best n $preport(Newest)]
  }
  if {$preport(MostFrequentOpponents) > 0} {
    append r [::preport::_subsec "$tr(OprepMostFrequentOpponents)"]
    if {$::preport::_color == "white"} {
      append r [sc_report player players black $preport(MostFrequentOpponents)]
    } else {
      append r [sc_report player players white $preport(MostFrequentOpponents)]
    }
  }
  if {$preport(Results)} {
    append r [::preport::_subsec $::tr(OprepResults)]
    append r [::optable::results player $fmt]
  }

  if {$preport(AvgPerf)  ||  $preport(HighRating)} {
    append r [::preport::_sec $tr(OprepRatingsPerf)]
  }
  if {$preport(AvgPerf)} {
    append r [::preport::_subsec $tr(OprepAvgPerf)]
    set e [sc_report player 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_report player 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 {$preport(HighRating) > 0} {
    append r [::preport::_subsec $tr(OprepHighRating)]
    append r [sc_report player best a $preport(HighRating)]
  }

  if {$preport(Themes)  ||  $preport(MostFrequentEcoCodes) > 0  ||
      $preport(Endgames)} {
    append r [::preport::_sec $tr(OprepMovesThemes)]
  }
  if {$preport(MostFrequentEcoCodes) > 0} {
    append r [::preport::_subsec $tr(PReportOpenings)]
    append r [sc_report player eco $preport(MostFrequentEcoCodes)]
  }
  if {$preport(Themes)} {
    append r [::preport::_subsec $tr(OprepThemes)]
    append r [sc_report player themes $tr(OprepThemeDescription:) \
                $tr(OprepThemeSameCastling:) $tr(OprepThemeOppCastling:) \
                $tr(OprepThemeKPawnStorm:) $tr(OprepThemeQueenswap:) \
                $tr(OprepTheme1BishopPair:) \
                $tr(OprepThemeWIQP:) $tr(OprepThemeBIQP:) \
                $tr(OprepThemeWP567:) $tr(OprepThemeBP234:) \
                $tr(OprepThemeOpenCDE:) ]
  }
  if {$preport(Endgames)} {
    append r [::preport::_subsec $tr(OprepEndgames)]
    append r "$tr(OprepEndClass:)$n"
    append r [sc_report player endmat]
  }

  if {$withTable  &&  $::preport(MaxGames) > 0} {
    set sec [::preport::_sec $tr(OprepTheoryTable)]
    set comment ""
    if {$tgames > $::preport(MaxGames)} {
      set comment [format $tr(OprepTableComment) $::preport(MaxGames)]
    }
    append r [sc_report player 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
}

####################
# 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: [tr ToolsPInfo]"
    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 [tr ToolsRating] \
      -command {::tools::graphs::rating::Refresh player $playerInfoName}
    button $w.b.edit -text $::tr(PInfoEditRatings) -command {
      makeNameEditor
      setNameEditorType rating
      set editName $playerInfoName
      set editNameSelect crosstable
    }
    button $w.b2.report -text [tr ToolsPlayerReport] \
      -command {::preport::preportDlg $playerInfoName}
    dialogbutton $w.b2.help -textvar ::tr(Help) -command {helpWindow PInfo}
    dialogbutton $w.b2.update -textvar ::tr(Update) -command {playerInfo $playerInfoName}
    dialogbutton $w.b2.close -textvar ::tr(Close) -command "focus .; destroy $w"
    packbuttons right $w.b2.close $w.b2.update $w.b2.help
    packbuttons left $w.b.graph $w.b.edit
    packbuttons left $w.b2.report

    autoscrollframe $w.frame text $w.text -font font_Regular -background white \
      -width $::winWidth($w) -height $::winHeight($w) -setgrid 1 -wrap none
    #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
    pack $w.frame -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
  ::windows::gamelist::Refresh
  ::maint::Refresh
  #raiseWin $w
}

###
### analysis.tcl: part of Scid.
### Copyright (C) 1999-2003  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 (kilo)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?
  set analysis(priority$n) normal     ;# CPU priority: idle/normal
}

resetEngine 1
resetEngine 2

set annotateMode 0
set annotateMoves all

 
# calculateNodes:
#   Divides string-represented node count by 1000
#
proc calculateNodes {{n}} {
  set len [string length $n]
  if { $len < 4 } {
     return 0 
  } else {
     set shortn [string range $n 0 [expr {$len - 4}]]
     scan $shortn "%d" nd
     return $nd
  }
}


# 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 [scidConfigFile engines]}
}

# ::enginelist::write:
#   Writes the user Engine list file.
#
proc ::enginelist::write {} {
  global engines
  set enginesFile [scidConfigFile engines]
  set enginesBackupFile [scidConfigFile engines.bak]
  # Try to rename old file to backup file and open new file:
  catch {file rename -force $enginesFile $enginesBackupFile}
  if {[catch {open $enginesFile w} f]} {
    catch {file rename $enginesBackupFile $enginesFile}
    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 with Scidlet and Crafty:
  set cmd scidlet
  if {$::windowsOS} {
    set cmd [file join $::scidExeDir scidlet.exe]
  }
  engine [list \
    Name Scidlet \
    Cmd  $cmd \
    Dir  . \
  ]
  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 \
    -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
  dialogbutton $f.add -text $::tr(EngineNew...) -command {::enginelist::edit -1}
  dialogbutton $f.edit -text $::tr(EngineEdit...) -command {
    ::enginelist::edit [lindex [.enginelist.list.list curselection] 0]
  }
  dialogbutton $f.delete -text $::tr(Delete...) -command {
    ::enginelist::delete [lindex [.enginelist.list.list curselection] 0]
  }
  label $f.sep -text "   "
  dialogbutton $f.ok -text "OK" -command {
    set engines(selection) [lindex [.enginelist.list.list curselection] 0]
    destroy .enginelist
  }
  dialogbutton $f.cancel -text $::tr(Cancel) -command {
    set engines(selection) ""
    destroy .enginelist
  }
  packbuttons right $f.cancel $f.ok
  pack $f.add $f.edit $f.delete -side left -padx 1

  ::enginelist::sort
  ::utils::win::Centre $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) ""
  catch {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 [list ::utils::validate::Integer [sc_info limit elo] 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
  catch {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
  updateBoard -pgn
  # Update score graph if it is open:
  if {[winfo exists .sgraph]} { ::tools::graphs::score::Refresh }
}

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
  }
  ::pgn::Refresh 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 }
  updateBoard -pgn -animate
  ::utils::sound::AnnounceNewMove $move
  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 the 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 $::scidLogDir "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 }
  setWinLocation $w

  ::board::new $w.bd 25
  $w.bd configure -relief solid -borderwidth 1
  set analysis(showBoard$n) 0

  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"
  button $w.b1.showboard -image tb_coords -command "toggleAnalysisBoard $n"
  ::utils::tooltip::Set $w.b1.showboard "Show Analysis Board"
  if {$n == 1} {
    checkbutton $w.b2.annotate -textvar ::tr(Annotate...) \
      -variable annotateMode -relief raised -pady 5 -padx 4 \
      -command {toggleAutoplay 1}
  }
  checkbutton $w.b2.priority -text $::tr(LowPriority) \
      -variable analysis(priority$n) -onvalue idle -offvalue normal \
      -command "setAnalysisPriority $n"
  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.b1.showboard -side right -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
  }
  pack $w.b2.priority -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"
  bind $w <Configure> "recordWinSize $w"
  wm minsize $w 45 0
  bindMouseWheel $w $w.hist.text

  fileevent $analysis(pipe$n) readable "processAnalysisInput $n"

  after 1000 "checkAnalysisStarted $n"
}

# setAnalysisPriority
#   Sets the priority class (in Windows) or nice level (in Unix)
#   of a running analysis engine.
#
proc setAnalysisPriority {n} {
  global analysis

  # Get the process ID of the analysis engine:
  if {$analysis(pipe$n) == ""} { return }
  set pidlist [pid $analysis(pipe$n)]
  if {[llength $pidlist] < 1} { return }
  set pid [lindex $pidlist 0]

  # Set the priority class (idle or normal):
  if {$::windowsOS} {
    catch {sc_info priority $pid $analysis(priority$n)}
  } else {
    set priority 0
    if {$analysis(priority$n) == "idle"} { set priority 15 }
    catch {sc_info priority $pid $priority}
  }

  # Re-read the priority class for confirmation:
  if {[catch {sc_info priority $pid} newpriority]} { return }
  if {$::windowsOS} {
    if {$newpriority == "idle"  ||  $newpriority == "normal"} {
      set analysis(priority$n) $newpriority
    }
  } else {
    set priority normal
    if {$newpriority > 0} { set priority idle }
    set analysis(priority$n) $priority
  }
}

# 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 {[string match "*analyze=1*" $line]} { set analysis(has_analyze$n) 1 }
    if {[string match "*setboard=1*" $line]} { set analysis(has_setboard$n) 1 }
    if {[string match "*usermove=1*" $line]} { set analysis(wants_usermove$n) 1 }
    if {[string match "*sigint=1*" $line]} { set analysis(send_sigint$n) 1 }
    if {[string match "*myname=*" $line] && \
        [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 {! [string compare [string range $line 0 5] "Crafty"]} {
    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 %s %\[^\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) [calculateNodes $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 %s %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) [calculateNodes $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: %6uK (%u kn/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..... "
    }
    $t insert end $moves blue
    $t configure -state disabled
    updateAnalysisBoard $n ""
    return
  }

  set moves $analysis(moves$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

  updateAnalysisBoard $n $moves
}

# toggleAnalysisBoard
#   Toggle whether the small analysis board is shown.
#
proc toggleAnalysisBoard {n} {
  global analysis
  if {$analysis(showBoard$n)} {
    set analysis(showBoard$n) 0
    pack forget .analysisWin$n.bd
  } else {
    set analysis(showBoard$n) 1
    pack .analysisWin$n.bd -side right -before .analysisWin$n.b2 \
      -padx 4 -pady 4 -anchor n
  }
}

# updateAnalysisBoard
#   Update the small analysis board in the analysis window,
#   showing the position after making the specified moves
#   from the current main board position.
#
proc updateAnalysisBoard {n moves} {
  global analysis
  # if {! $analysis(showBoard$n)} { return }

  set bd .analysisWin$n.bd
  # Temporarily wipe the premove command:
  sc_info preMoveCmd {}
  # Push a temporary copy of the current game:
  sc_game push copy

  # Make the engine moves and update the board:
  catch {sc_move addSan $moves}
  ::board::update $bd [sc_pos board]

  # Pop the temporary game:
  sc_game pop
  # Restore pre-move command:
  sc_info preMoveCmd preMoveCommand
}

# 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 {::utils::validate::Regexp {^[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 .
    catch {grab release .apdialog}
    destroy .apdialog
    focus .
    set dialogResult Cancel
  }
  button $b.ok -text "OK" -command {
    catch {grab release .apdialog}
    if {$temptime < 0.1} { set temptime 0.1 }
    set analysis(automoveTime$tempn) [expr {int($temptime * 1000)} ]
    focus .
    catch {grab release .apdialog}
    destroy .apdialog
    focus .
    set dialogResult OK
  }
  pack $b.cancel $b.ok -side right -padx 5 -pady 5
  focus $w.entry
  update
  catch {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
      updateBoard -pgn
      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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 containing only "Chess", to detect the use of
  # GNU Chess 4, which issues time in whole seconds rather than in
  # centiseconds.
  #if {! [string compare $engineOutput "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 {[string match "*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 {[string match "*Gromit3*" $engineOutput]  ||  [string match "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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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 {[string match "*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
  }


  # Check for a line containing "Phalanx" to detect use of the
  # Phalanx Winboard engine, which supports "analyze"
  # but not "setboard" or "protover".
  if {[string match "*Phalanx*" $engineOutput] } {
    logEngineNote $n {Seen "Phalanx"; assuming analyze command.}
    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-2002 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} ]]

    # If the next character in the line is a "-", it means we have a
    # situation with both the castling moves "O-O" and "O-O-O".
    # To avoid "O-O-O" looking like a child line of "O-O", we need to
    # deliberately ignore this possibility.
    if {[string length $v] > $len  &&  [string index $v $len] == "-"} { continue }

    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
  ::rep::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} {
    # Group or line already exists.
    if {! $group} {
      set ::rep::_data($w:$v:include) $include
      ::rep::updateStatus $w
    }
    return $v
    #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_messageBox -parent .repWin \
                  -type yesno -icon question \
                  -title "Scid: [tr RepFileClose]" \
                  -message $::tr(RepCloseDialog)]
    if {$answer != "yes"} { 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

  # Toolbar:
  set f [frame $w.toolbar -relief raised -border 1]
  pack $f -side top -fill x
  button $f.new -image tb_new -command "::rep::newFile $w.f.w.rep"
  button $f.open -image tb_open -command "::rep::OpenFile $w.f.w.rep"
  button $f.save -image tb_save -command "::rep::saveFile $w.f.w.rep"
  button $f.close -image tb_close -command "destroy $w"
  frame $f.space1 -width 12
  button $f.group -image ::rep::_tb_group \
    -command "::rep::AddCurrentBoard $w.f.w.rep group"
  button $f.include -image ::rep::_tb_include \
    -command "::rep::AddCurrentBoard $w.f.w.rep include"
  button $f.exclude -image ::rep::_tb_exclude \
    -command "::rep::AddCurrentBoard $w.f.w.rep exclude"

  foreach i {new open save close group include exclude} {
    $f.$i configure -relief flat -border 1 -highlightthickness 0 -anchor n \
      -takefocus 0
    bind $f.$i <Any-Enter> "+$f.$i configure -relief groove"
    bind $f.$i <Any-Leave> "+$f.$i configure -relief flat"
  }
  foreach {b m} {
    new RepFileNew open RepFileOpen save RepFileSave
    group RepEditGroup include RepEditInclude exclude RepEditExclude
  } {
    set ::helpMessage($f.$b) [tr $m]
  }
  pack $f.new $f.open $f.save $f.close $f.space1 \
    $f.group $f.include $f.exclude \
    -side left -padx 0 -ipadx 0 -pady 0 -ipady 0

  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 [::utils::pane::Create $w.f w text 600 300 0.5 h]
  ::utils::pane::SetRange $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> \
    "::rep::singleClick $w.f.w.rep \[::rep::labelAtXY %W %x %y\]"
  $w.f.w.rep bind x <Double-Button-1> \
    "::rep::doubleClick $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} { importMoveList \[$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 ::rep::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::doubleClick
#   Called whenever the left mouse button is double-clicked on a group or
#   line in the repertoire.
#
proc ::rep::doubleClick {w label} {
  ::rep::setSelection $w $label
  if {$label == ""} { return }
  set moves [::rep::_decode $label]
  catch {sc_game import $moves}
  updateBoard -pgn
}

# ::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: [::utils::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]\"};
              updateBoard -pgn"
  $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}} {
  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 $::search::filter::operation} 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
    ::windows::gamelist::Refresh
    ::windows::stats::Refresh
  }
  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=
}

image create photo ::rep::_tb_group -data {
R0lGODlhEQARAIQAANnZ2QICBMa6la6ehJaJda6ihPbu6ubcwNbGtN7V2c7Dp97Opc66m8a1
lLaniqmpqe7q2Xp0cHJuW+7m1LaulKaYfL6zl25mWJ6ObYJ5a1pVTScznicznicznicznicz
niwAAAAAEQARAAAFdiAgjmRpnigQrEE6BsIQt2kwEHdBsCwZGAeg0IBIHBQ01UGwYDQXgoZD
sHuIAhDoMzp1RAJWpdMpEHQLEvB18myYBQVKJR0OHJyWt8NRqVzUKmxuUwV8GAR/dQcRBBkV
GY0SFxcagCo8mCsPYSKbnp+eLqKjIyEAOw==
}

image create photo ::rep::_tb_include -data {
R0lGODlhEQARAKEAAP///9nZ2QAAAFFR+ywAAAAAEQARAAACOYyPecLtvoCcVIpY8zUizzEA
W9B5YDiW1WlhFNtyACjBMTmH9t2ddJWq7XifkMbl4T2WDIXzCVUUAAA7
}

image create photo ::rep::_tb_exclude -data {
R0lGODlhEQARAKEAANnZ2QAAAP////oTQCwAAAAAEQARAAACOoSPecHtvoScVIZY8zVBjvwJ
G9AJQ+iFY2mG57RS5wtjE11z8kzF6W/B4FpBXabiO+ZIjyZDAY1KFQUAOw==
}

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
###

# ::tools::graphs::Save
#
#   Saves a graph (e.g. tree graph, filter graph, rating graph) to a
#   color or greyscale Postscript file.
#
#   The mode should be "color" or "gray".
#
proc ::tools::graphs::Save {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 graph window

# ::tools::graphs::filter::type
#   can be "decade", "year" or "elo"
#
set ::tools::graphs::filter::type decade

proc tools::graphs::filter::Open {} {
  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
  ::utils::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}]
    ::utils::graph::configure filter -height [expr {[winfo height .fgraph.c] - 80}]
    ::utils::graph::configure filter -width [expr {[winfo width .fgraph.c] - 60}]
    ::utils::graph::redraw filter
  }
  bind $w.c <1> tools::graphs::filter::Switch
  bind $w.c <3> ::tools::graphs::filter::Refresh

  foreach {name text} {decade Decade year Year elo Rating} {
    radiobutton $w.b.$name -padx 4 -pady 3 -text $::tr($text) \
      -variable ::tools::graphs::filter::type -value $name \
      -command ::tools::graphs::filter::Refresh
    pack $w.b.$name -side left -padx 1 -pady 2
  }
  dialogbutton $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

  ::tools::graphs::filter::Refresh
}

proc tools::graphs::filter::Switch {} {
  variable type
  switch $type {
    "decade" { set type "year" }
    "year" { set type "elo" }
    "elo" { set type "decade" }
  }
  ::tools::graphs::filter::Refresh
}

proc ::tools::graphs::filter::Refresh {} {
  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 {$::tools::graphs::filter::type == "elo"} {
    # Vertical lines for Elo-range graph:
    for {set i 1} {$i < 9} { incr i } {
      lappend vlines [list gray80 1 at $i.5]
    }
  } elseif {$::tools::graphs::filter::type == "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]
    }
  }
  ::utils::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
  ::utils::graph::redraw filter
  busyCursor .
  update

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

  # Generate plot values and labels:
  if {$::tools::graphs::filter::type == "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 {$::tools::graphs::filter::type == "year"} {
    set ftype date
    set typeName $::tr(Year)
    set endYear [::utils::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::
  #::utils::graph::data decade bounds -points 0 -lines 0 -bars 0 -coords {1 0.0 1 0.0}

  ::utils::graph::data filter data -color darkBlue -points 1 -lines 1 -bars 0 \
    -linewidth 2 -radius 4 -outline darkBlue -coords $dlist
  ::utils::graph::configure filter -xlabels $xlabels -ytick $ytick \
    -hline $hlines -ymin 0 -xmin 0.5 -xmax [expr {$count + 0.5}]
  ::utils::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
}



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

proc ::tools::graphs::score::Refresh {} {
  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 "::tools::graphs::Save color $w.c"
    $w.menu.file.m add command -label GraphFileGrey \
      -command "::tools::graphs::Save 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
      ::utils::graph::configure score -height [expr {[winfo height .sgraph.c] - 90}]
      ::utils::graph::configure score -width [expr {[winfo width .sgraph.c] - 100}]
      ::utils::graph::redraw score
    }
    bind $w.c <3> ::tools::graphs::score::Refresh
    bind $w.c <1> {::tools::graphs::score::Move %x}
    wm title $w "Scid: [tr ToolsScore]"
    ::tools::graphs::score::ConfigMenus
  }

  $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} ]
  ::utils::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:
  ::utils::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 {::utils::graph::data score data -color $linecolor -points 1 -lines 1 \
             -linewidth $linewidth -radius $psize -outline $linecolor \
             -coords [sc_game scores]}
  ::utils::graph::redraw score
  unbusyCursor $w
  update
}

proc ::tools::graphs::score::ConfigMenus {{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 ::tools::graphs::score::Move {xc} {
  set x [expr {round([::utils::graph::xunmap score $xc] * 2)} ]
  sc_move start
  sc_move forward $x
  updateBoard
}


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

set ::tools::graphs::rating::year 1900
set ::tools::graphs::rating::type both
set ::tools::graphs::rating::player ""

proc ::tools::graphs::rating::Refresh {{type ""} {player ""}} {
  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 $::tools::graphs::rating::type }
  if {$player == ""} { set player $::tools::graphs::rating::player }
  set ::tools::graphs::rating::type $type
  set ::tools::graphs::rating::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 "::tools::graphs::Save color $w.c"
    $w.menu.file.m add command -label GraphFileGrey \
      -command "::tools::graphs::Save 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 ::tools::graphs::rating::type -value $j \
        -command "::tools::graphs::rating::Refresh"
    }
    $w.menu.options.m add separator
    foreach i {1900 1980 1985 1990 1995 2000} {
      $w.menu.options.m add radiobutton -label "Since $i" \
        -variable ::tools::graphs::rating::year -value $i \
        -command "::tools::graphs::rating::Refresh"
    }
    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
      ::utils::graph::configure ratings -height [expr {[winfo height .rgraph.c] - 70} ]
      ::utils::graph::configure ratings -width [expr {[winfo width .rgraph.c] - 100} ]
      ::utils::graph::configure ratings -logy 10
      ::utils::graph::redraw ratings
    }
    bind $w.c <Button-1> "::tools::graphs::rating::Refresh"
    bind $w.c <Button-3> "::tools::graphs::rating::Refresh"
    wm title $w "Scid: [tr ToolsRating]"
    ::tools::graphs::rating::ConfigMenus
  }

  $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} ]
  ::utils::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}}
  ::utils::graph::redraw ratings
  busyCursor $w
  update

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

proc ::tools::graphs::rating::ConfigMenus {{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
  }
}

### tools/tablebase.tcl:
###   Tablebase display routines for Scid.

set ::tb::isOpen 0
set tbTraining 0
set tbBoard 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 ]

set tbInfo(42) [list \
  kqqqkq kqqqkr kqqqkb kqqqkn kqqqkp \
  kqqrkq kqqrkr kqqrkb kqqrkn kqqrkp \
  kqqbkq kqqbkr kqqbkb kqqbkn kqqbkp \
  kqqnkq kqqnkr kqqnkb kqqnkn kqqnkp \
  kqqpkq kqqpkr kqqpkb kqqpkn kqqpkp \
  kqrrkq kqrrkr kqrrkb kqrrkn kqrrkp \
  kqrbkq kqrbkr kqrbkb kqrbkn kqrbkp \
  kqrnkq kqrnkr kqrnkb kqrnkn kqrnkp \
  kqrpkq kqrpkr kqrpkb kqrpkn kqrpkp \
  kqbbkq kqbbkr kqbbkb kqbbkn kqbbkp \
  kqbnkq kqbnkr kqbnkb kqbnkn kqbnkp \
  kqbpkq kqbpkr kqbpkb kqbpkn kqbpkp \
  kqnnkq kqnnkr kqnnkb kqnnkn kqnnkp \
  kqnpkq kqnpkr kqnpkb kqnpkn kqnpkp \
  kqppkq kqppkr kqppkb kqppkn kqppkp \
  krrrkq krrrkr krrrkb krrrkn krrrkp \
  krrbkq krrbkr krrbkb krrbkn krrbkp \
  krrnkq krrnkr krrnkb krrnkn krrnkp \
  krrpkq krrpkr krrpkb krrpkn krrpkp \
  krbbkq krbbkr krbbkb krbbkn krbbkp \
  krbnkq krbnkr krbnkb krbnkn krbnkp \
  krbpkq krbpkr krbpkb krbpkn krbpkp \
  krnnkq krnnkr krnnkb krnnkn krnnkp \
  krnpkq krnpkr krnpkb krnpkn krnpkp \
  krppkq krppkr krppkb krppkn krppkp \
  kbbbkq kbbbkr kbbbkb kbbbkn kbbbkp \
  kbbnkq kbbnkr kbbnkb kbbnkn kbbnkp \
  kbbpkq kbbpkr kbbpkb kbbpkn kbbpkp \
  kbnnkq kbnnkr kbnnkb kbnnkn kbnnkp \
  kbnpkq kbnpkr kbnpkb kbnpkn kbnpkp \
  kbppkq kbppkr kbppkb kbppkn kbppkp \
  knnnkq knnnkr knnnkb knnnkn knnnkp \
  knnpkq knnpkr knnpkb knnpkn knnpkp \
  knppkq knppkr knppkb knppkn knppkp \
  kpppkq kpppkr kpppkb kpppkn kpppkp ]

# ::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
  setWinLocation $w
  wm title $w "Scid: [tr WindowsTB]"
  pack [frame $w.b] -side bottom -fill x
  pack [frame $w.info] -side left -fill y
  addVerticalRule $w
  pack [frame $w.pos] -side right -fill both -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
  }
  autoscrollframe $f.list text $f.list.text \
    -width 35 -height 7 -font font_Fixed -wrap none \
    -foreground black -background white -cursor top_left_arrow
  pack $f.list -side top
  pack [frame $f.separator -height 2]
  # addHorizontalRule $f

  autoscrollframe $f.data text $f.data.text \
    -width 35 -height 0 -font font_Fixed -wrap none \
    -foreground black -background white -cursor top_left_arrow
  pack $f.data -side top -fill y -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
  autoscrollframe $f text $f.text -width 30 -height 20 -font font_Small \
    -wrap word -foreground black -background white -setgrid 1
  $f.text tag configure indent -lmargin2 [font measure font_Fixed  "        "]

  ::board::new $f.board 25
  $f.board configure -relief solid -borderwidth 1
  for {set i 0} {$i < 64} {incr i} {
    ::board::bind $f.board $i <Button-1> [list ::tb::resultsBoard $i]
  }
  if {$::tbBoard} {
    grid $f.board -row 0 -column 2 -rowspan 2
  }

  checkbutton $w.b.training -text $::tr(Training) -variable tbTraining \
    -command ::tb::training -relief raised -padx 4 -pady 5
  button $w.b.random -text "Random" -command ::tb::random
  button $w.b.showboard -image tb_coords -command ::tb::showBoard
  dialogbutton $w.b.help -text $::tr(Help) -command { helpWindow TB }
  dialogbutton $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
  packbuttons right $w.b.close $w.b.help
  pack $w.b.training $w.b.random $w.b.showboard -side left -padx 2 -pady 2
  pack $w.b.status -side left -fill x -expand yes
  bind $w <Destroy> { set ::tb::isOpen 0; set tbTraining 0 }
  bind $w <F1> { helpWindow TB }
  bind $w <Configure> "recordWinSize $w"
  wm minsize $w 15 20
  set ::tbTraining 0
  ::tb::section
  ::tb::summary
  ::tb::results
}

# ::tb::showBoard
#   Toggles the results board.
#
proc ::tb::showBoard {} {
  global tbBoard
  set f .tbWin.pos
  if {$tbBoard} {
    set tbBoard 0
    grid forget $f.board
  } else {
    set tbBoard 1
    grid $f.board -row 0 -column 2 -rowspan 2
  }
}

# ::tb::resultsBoard
#   Updates theresultsBoard board for a particular square.
#
proc ::tb::resultsBoard {sq} {
  set f .tbWin.pos
  set board [sc_pos board]
  # If selected square is empty, take no action:
  if {[string index $board $sq] == "."} { return }
  # Clear any previous results:
  ::board::recolor $f.board
  ::board::clearText $f.board
  # Highlight the selected square:
  ::board::colorSquare $f.board $sq $::highcolor
  # Retrieve tablebase scores:
  busyCursor .
  set scores [sc_pos probe board $sq]
  set text(X) X; set color(X) red
  set text(=) =; set color(=) blue
  set text(?) "?"; set color(?) red
  set text(+) "#"; set text(-) "#"
  if {[sc_pos side] == "white"} {
    set color(+) white; set color(-) black
  } else {
    set color(+) black; set color(-) white
  }
  for {set i 0} {$i < 64} {incr i} {
    # Skip squares that have a piece.
    if {[string index $board $i] != "."} { continue }
    # Draw the score on this square:
    set score [string index $scores $i]
    catch {::board::drawText $f.board $i $text($score) $color($score)}
  }
  unbusyCursor .
}

# ::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
  $t configure -height 10
  set count 0
  set linecount 1
  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; incr linecount; $t insert end "\n" }
  }
  if {$linecount > 10} { set linecount 10 }
  $t configure -height $linecount
  $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 }

  # Reset results board:
  ::board::recolor $w.pos.board
  ::board::clearText $w.pos.board
  ::board::update $w.pos.board [sc_pos board]

  # Update results panel:
  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)"
  updateBoard -pgn
}

# ::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
  updateBoard -pgn
}

# ::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) }
  }
  updateBoard -pgn
  ::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."
  }
  updateBoard -pgn
}


# 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) {
  257 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) {
  542 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) {
  194 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) {
  2352 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) {
  222 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) {
  400 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) {
  25 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) {
  74 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) {
  937 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) {
  423 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) {
  322 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) {
  397 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/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.0 9.7 90.3
  0
}

set tbs(kqpk) {
  156 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) {
  8 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) {
  46 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) {
  15 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) {
  333 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) {
  31 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) {
  206 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) {
  453 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) {
  20 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) {
  563 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) {
  51 30 {2K5/8/1k6/5q2/8/8/6Q1/7Q} 13 {7Q/7K/8/6Qk/8/8/7q/8}
  99.1 0.8 0.1 0.6 32.8 66.6
  0
}

set tbs(kqqkr) {
  0 35 {Kr6/8/8/8/8/3Q4/4Q3/2k5} 19 {6Q1/8/8/8/8/7K/2r4Q/7k}
  100.0 0.0 0.0 0.1 0.2 99.7
  0
}

set tbs(kqqkb) {
  0 15 {8/8/7Q/5k1K/7Q/5b2/8/8} 0 -
  100.0 0.0 0.0 0.0 0.1 99.9
  0
}

set tbs(kqqkn) {
  0 19 {5K2/3n4/4k3/2Q5/8/8/8/1Q6} 0 -
  100.0 0.0 0.0 0.0 0.1 99.9
  0
}

set tbs(kqqkp) {
  7 22 {8/8/8/3Q4/7Q/2k5/1p6/K7} 13 ?
  100.0 0.0 0.0 0.0 0.7 99.3
  0
}

set tbs(kqrkq) {
  36 67 {8/8/8/8/q7/6k1/8/KR5Q} 38 {8/8/q7/8/8/6R1/2K4Q/k7}
  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) {
  132 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) {
  12 29 {2k5/5b2/8/8/2K5/8/Q7/6R1} 0 -
  100.0 0.0 0.0 0.0 11.6 88.4
  0
}

set tbs(kqrkn) {
  2 40 ? 1 {8/8/8/8/1n6/k7/8/KR5Q}
  99.9 0.1 0.0 0.0 7.7 92.3
  0
}

set tbs(kqrkp) {
  25 40 ? 43 ?
  100.0 0.0 0.0 0.3 1.4 98.3
  0
}

set tbs(kqbkq) {
  28 33 {5q2/8/8/5B2/k1K4Q/8/8/8} 24 {6KQ/8/1B6/6k1/8/6q1/8/8}
  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) {
  25 32 ? 24 ?
  100.0 0.0 0.0 1.0 14.1 84.9
  0
}

set tbs(kqnkq) {
  74 41 {8/7q/8/k7/2K5/2N5/8/4Q3} 24 {7K/8/1N6/Q5k1/8/8/6q1/8}
  50.1 49.6 0.3 33.5 62.2 4.3
  38 38 {} 0 {} 0 {}
}

set tbs(kqnkr) {
  12 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) {
  13 21 ? 1 ?
  99.4 0.6 0.0 0.0 17.8 82.2
  0
}

set tbs(kqnkp) {
  46 30 ? 29 ?
  99.9 0.1 0.0 1.9 15.0 83.1
  0
}

set tbs(kqpkq) {
  1179 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) {
  216 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) {
  16 28 ? 2 ?
  99.9 0.1 0.0 0.0 16.7 83.3
  0
}

set tbs(kqpkn) {
  41 30 ? 8 ?
  99.7 0.3 0.0 0.0 12.5 87.5
  0
}

set tbs(kqpkp) {
  622 105 {8/8/8/8/3P2Q1/8/1p6/K1k5} 34 ?
  100.0 0.0 0.0 3.3 7.3 89.4
  0
}

set tbs(krrkq) {
  8 29 {3R4/1R6/8/8/q7/7K/8/k7} 49 {7R/1q6/3K4/8/k7/8/2R5/8}
  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) {
  38 31 {8/1R6/8/8/8/5r1K/4R3/k7} 20 {1k6/2R5/7r/3K3R/8/8/8/8}
  99.2 0.7 0.0 0.4 33.4 66.2
  0
}

set tbs(krrkb) {
  8 29 {8/8/8/2b5/8/4KR2/1k6/6R1} 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) {
  8 40 {4k3/6R1/8/7n/5K2/1R6/8/8} 1 {8/8/8/8/1n6/k7/8/KR1R4}
  99.7 0.3 0.0 0.0 15.0 85.0
  0
}

set tbs(krrkp) {
  3 33 ? 50 ?
  100.0 0.0 0.0 1.0 5.7 93.3
  0
}

set tbs(krbkq) {
  23 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) {
  649 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) {
  20 30 ? 2 ?
  98.2 1.8 0.0 0.0 31.1 68.9
  0
}

set tbs(krbkn) {
  5 40 ? 1 ?
  98.9 1.1 0.0 0.0 24.0 76.0
  0
}

set tbs(krbkp) {
  33 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) {
  15 20 ? 69 ?
  35.4 41.1 23.4 78.2 19.7 2.1
  455 0 {} 455 {} 0 {}
}

set tbs(krnkr) {
  430 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) {
  12 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) {
  367 68 ? 104 ?
  37.7 11.8 50.5 91.0 7.1 1.8
  243 2 {} 241 {} 0 {}
}

set tbs(krpkr) {
  9184 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) {
  626 73 ? 2 ?
  96.4 3.6 0.0 0.0 32.6 67.4
  225 225 {} 0 {} 0 {}
}

set tbs(krpkn) {
  397 54 ? 8 ?
  97.5 2.5 0.0 0.0 24.7 75.3
  413 413 {} 0 {} 0 {} 0 {}
}

set tbs(krpkp) {
  1092 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) {
  3 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) {
  13 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) {
  35 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) {
  28 78 {8/K7/8/8/8/5k2/6n1/2B4B} 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) {
  23 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) {
  13 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) {
  64 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) {
  54 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) {
  36 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) {
  165 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) {
  117 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) {
  451 45 ? 39 ?
  30.9 67.3 1.8 23.4 73.1 3.5
  306 4 {} 302 {} 0 {}
}

set tbs(kbpkb) {
  570 51 ? 3 ?
  41.3 58.7 0.0 0.0 86.9 13.1
  160 160 {} 0 {} 0 {}
}

set tbs(kbpkn) {
  497 105 ? 8 ?
  53.7 46.3 0.0 0.0 76.4 23.6
  2125 2112 {} 13 {} 0 {}
}

set tbs(kbpkp) {
  1443 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) {
  5 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) {
  15 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) {
  8 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) {
  71 115 ? 74 ?
  31.3 66.4 2.3 12.8 73.6 13.6
  3143 3124 {} 19 {} 0 {}
}

set tbs(knpkq) {
  130 41 ? 55 ?
  17.9 11.9 70.2 97.2 2.3 0.5
  52 0 {} 52 {} 0 {}
}

set tbs(knpkr) {
  433 44 ? 67 ?
  26.7 69.3 4.0 29.3 68.5 2.2
  1181 23 {} 1158 {} 0 {}
}

set tbs(knpkb) {
  728 43 ? 9 ?
  38.8 61.2 0.0 0.0 88.1 11.9
  642 640 {} 2 {} 0 {}
}

set tbs(knpkn) {
  781 97 ? 7 ?
  49.2 50.8 0.0 0.0 77.2 22.8
  4191 4128 {} 63 {} 0 {}
}

set tbs(knpkp) {
  1410 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) {
  726 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) {
  1652 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) {
  519 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) {
  705 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) {
  5080 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(kqqqk) {
  0 3 ? 0 -
  100.0 0.0 0.0 0.0 4.0 96.0
  0
}

set tbs(kqqrk) {
  0 4 ? 0 -
  100.0 0.0 0.0 0.0 3.1 96.9
  0
}

set tbs(kqqbk) {
  3 4 ? 0 -
  100.0 0.0 0.0 0.0 2.7 97.3
  0
}

set tbs(kqqnk) {
  2 4 ? 0 -
  100.0 0.0 0.0 0.0 2.4 97.6
  0
}

set tbs(kqqpk) {
  12 4 ? 0 -
  100.0 0.0 0.0 0.0 2.1 97.9
  0
}

set tbs(kqrrk) {
  0 4 ? 0 -
  100.0 0.0 0.0 0.0 2.0 98.0
  0
}

set tbs(kqrbk) {
  3 5 ? 0 -
  100.0 0.0 0.0 0.0 1.7 98.3
  0
}

set tbs(kqrnk) {
  3 5 ? 0 -
  100.0 0.0 0.0 0.0 1.4 98.6
  0
}

set tbs(kqrpk) {
  26 7 ? 0 -
  100.0 0.0 0.0 0.0 1.1 98.9
  0
}

set tbs(kqbbk) {
  3 6 ? 0 -
  100.0 0.0 0.0 0.0 5.0 95.0
  0
}

set tbs(kqbnk) {
  5 7 ? 0 -
  100.0 0.0 0.0 0.0 1.1 98.9
  0
}

set tbs(kqbpk) {
  31 9 ? 0 -
  100.0 0.0 0.0 0.0 1.2 98.8
  0
}

set tbs(kqnnk) {
  0 8 ? 0 -
  100.0 0.0 0.0 0.0 9.1 90.9
  0
}

set tbs(kqnpk) {
  10 9 ? 0 -
  100.0 0.0 0.0 0.0 1.0 99.0
  0
}

set tbs(kqppk) {
  64 9 ? 0 -
  100.0 0.0 0.0 0.0 0.7 99.3
}

set tbs(krrrk) {
  2 5 ? 0 -
  100.0 0.0 0.0 0.0 0.9 99.1
  0
}

set tbs(krrbk) {
  0 10 ? 0 -
  100.0 0.0 0.0 0.0 0.8 99.2
  0
}

set tbs(krrnk) {
  0 10 ? 0 -
  100.0 0.0 0.0 0.0 0.6 99.4
  0
}

set tbs(krrpk) {
  7 14 ? 0 -
  100.0 0.0 0.0 0.0 0.3 99.7
  0
}

set tbs(krbbk) {
  0 12 ? 0 -
  100.0 0.0 0.0 0.0 4.3 95.7
  0
}

set tbs(krbnk) {
  3 29 ? 0 -
  100.0 0.0 0.0 0.0 0.5 99.5
  0
}

set tbs(krbpk) {
  23 16 ? 0 -
  100.0 0.0 0.0 0.0 0.6 99.4
  0
}

set tbs(krnnk) {
  0 15 ? 0 -
  100.0 0.0 0.0 0.0 8.5 91.5
  0
}

set tbs(krnpk) {
  16 17 ? 0 -
  100.0 0.0 0.0 0.0 0.5 99.5
  0
}

set tbs(krppk) {
  119 15 {8/8/4k3/8/8/3P4/3P4/5R1K} 0 -
  100.0 0.0 0.0 0.0 0.2 98.8
  0
}

set tbs(kbbbk) {
  0 16 ? 0 -
  74.0 26.0 0.0 0.0 31.6 68.4
  0
}

set tbs(kbbnk) {
  3 33 ? 0 -
  100.0 0.0 0.0 0.0 4.1 95.9
  0
}

set tbs(kbbpk) {
  5 30 ? 0 -
  98.3 1.7 0.0 0.0 6.8 93.2
  0
}

set tbs(kbnnk) {
  0 34 ? 0 -
  100.0 0.0 0.0 0.0 8.4 91.6
  0
}

set tbs(kbnpk) {
  26 33 ? 0 -
  100.0 0.0 0.0 0.0 0.8 99.2
  0
}

set tbs(kbppk) {
  100 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(knnnk) {
  0 21 ? 0 -
  98.7 1.3 0.0 0.0 25.0 75.0
  0
}

set tbs(knnpk) {
  7 28 ? 0 -
  98.4 1.6 0.0 0.0 12.0 88.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) {
  97 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


####################
# 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 {::utils::validate::Integer 999 0}
trace variable ::ptrack::moves(end) w {::utils::validate::Integer 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]"
  setWinLocation $w
  bind $w <Escape> "destroy $w"
  bind $w <F1> {helpWindow PTracker}
  image create photo ptrack -width $::ptrack::psize -height $::ptrack::psize
  label $w.status -width 1 -anchor w -relief sunken -font font_Small
  pack $w.status -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
  bind $w <Configure> "recordWinSize $w"
  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] [::utils::thousands $best] $pct]
    $text insert end "$line\n"
    set status "  [::ptrack::sq $idx]: [::utils::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
  }
}
### help.tcl: Help pages for Scid.

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

set helpTitle(Contents) "Contents"
set helpText(Contents) {<h1>Scid Help Contents</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>
<li><a Annotating><b>Annotating games</b></a></li>
</ul>

<h4>Other Scid windows</h4>
<ul>
<li><a Analysis><b>Analysis</b> window</a></li>
<li><a Comment><b>Comment editor</b> window</a></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></li>
<li><a Import><b>Import game</b> window</a></li>
<li><a Reports><b>Reports</b></a> <red>(updated!)</red></li>
<li><a PGN><b>PGN</b> (game text) window</a></li>
<li><a PTracker><b>Piece Tracker</b></a></li>
<li><a PList><b>Player Finder</b> window</a></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></li>
<li><a Tree><b>Tree</b> window</a></li>
<li><a Graphs><b>Graph</b> windows</a></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> <red>(updated!)</red></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> <red>(updated!)</red></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.5, December 2003)</footer></p>
}

###############
### Topic Index

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

<h3>A</h3>
<ul>
<li><a Analysis>Analysis</a> window</li>
<li><a Annotating>Annotating games</a></li>
<li><a NAGs>Annotation symbols</a></li>
<li><a Author>Author, contacting</a></li>
<li><a MainWindow Autoplay>Autoplay mode</a></li>
</ul>

<h3>B</h3>
<ul>
<li><a Tree Best>Best games</a> window</li>
<li><a Searches Board>Board searches</a></li>
<li><a Bookmarks>Bookmarks</a></li>
<li><a GameList Browsing>Browsing games</a></li>
</ul>

<h3>C</h3>
<ul>
<li><a Maintenance Cleaner>Cleaner</a></li>
<li><a Clipbase>Clipbase</a></li>
<li><a Cmdline>Command-line options</a></li>
<li><a Comment>Comment editor</a></li>
<li><a Compact>Compacting a database</a></li>
<li><a Author>Contact information</a></li>
<li><a Contents>Contents</a></li>
<li><a Crosstable>Crosstable</a> window</li>
</ul>

<h3>D</h3>
<ul>
<li><a Compact>Database compaction</a></li>
<li><a Formats>Database file formats</a></li>
<li><a Maintenance>Database maintenance</a></li>
<li><a Sorting>Database sorting</a></li>
<li><a Switcher>Database switcher</a> window</li>
<li><a Maintenance Twins>Deleting twin games</a></li>
</ul>

<h3>E</h3>
<ul>
<li><a ECO Browser>ECO Browser</a> window</li>
<li><a ECO Codes>ECO code system</a></li>
<li><a ECO>ECO openings classification</a></li>
<li><a Menus Edit>Edit menu</a></li>
<li><a Email>Email manager</a> window</li>
<li><a Analysis List>Engines list</a></li>
<li><a Moves>Entering chess moves</a></li>
<li><a EPD>EPD files</a></li>
<li><a Export>Exporting games to text files</a></li>
</ul>

<h3>F</h3>
<ul>
<li><a Finder>File Finder</a></li>
<li><a Formats>File formats</a></li>
<li><a Menus File>File menu</a></li>
<li><a Searches Filter>Filter</a></li>
<li><a Export>Filter, exporting</a></li>
<li><a Graphs Filter>Filter graph</a></li>
<li><a Flags>Flags</a></li>
<li><a Options Fonts>Fonts</a></li>
</ul>

<h3>G</h3>
<ul>
<li><a Flags>Game flags</a></li>
<li><a GameList>Game List</a> window</li>
<li><a Menus Game>Game menu</a></li>
<li><a Graphs>Graph windows</a></li>
</ul>

<h3>H</h3>
<ul>
<li><a Searches Header>Header searches</a></li>
<li><a Menus Help>Help menu</a></li>
<li><a Hints>Hints</a></li>
</ul>

<h3>I</h3>
<ul>
<li><a Import>Import</a> window</li>
</ul>

<h3>L</h3>
<ul>
<li><a LaTeX>LaTeX</a> output format</li>
</ul>

<h3>M</h3>
<ul>
<li><a MainWindow>Main Window</a></li>
<li><a Maintenance>Maintenance tools</a></li>
<li><a Searches Material>Material/pattern searches</a></li>
<li><a Menus>Menus</a></li>
<li><a GameList Browsing>Merging games</a></li>
<li><a Moves>Move entry</a></li>
</ul>

<h3>N</h3>
<ul>
<li><a Maintenance Editing>Names, editing</a></li>
<li><a Maintenance Spellcheck>Names, spellchecking</a></li>
<li><a NAGs>NAG annotation values</a></li>
<li><a Annotating Null>Null moves</a></li>
</ul>

<h3>O</h3>
<ul>
<li><a ECO>Opening classification (ECO)</a></li>
<li><a Repertoire>Opening repertoires</a></li>
<li><a Reports Opening>Opening report</a> window</li>
<li><a Options>Options</a></li>
</ul>

<h3>P</h3>
<ul>
<li><a PGN>PGN</a> window</li>
<li><a Pgnscid>Pgnscid</a></li>
<li><a PTracker>Piece Tracker</a> window</li>
<li><a PList>Player Finder</a> window</li>
<li><a PInfo>Player Info</a> window</li>
<li><a Reports Player>Player report</a> window</li>
</ul>

<h3>Q</h3>
<ul>
<li><a Guide>Quick guide to using Scid</a></li>
</ul>

<h3>R</h3>
<ul>
<li><a Graphs Rating>Rating graph</a></li>
<li><a Repertoire>Repertoire editor</a></li>
</ul>

<h3>S</h3>
<ul>
<li><a Searches Filter>Search filter</a></li>
<li><a Menus Search>Search menu</a></li>
<li><a Searches>Searches</a></li>
<li><a Sorting>Sorting a database</a></li>
<li><a Maintenance Spellcheck>Spellchecking names</a></li>
<li><a Switcher>Switcher</a> window</li>
</ul>

<h3>T</h3>
<ul>
<li><a TB>Tablebases</a></li>
<li><a Menus Tools>Tools menu</a></li>
<li><a Tmt>Tournament finder</a></li>
<li><a Tree>Tree window</a></li>
<li><a Moves Trial>Trial mode</a></li>
<li><a Maintenance Twins>Twin (duplicate) games</a></li>
</ul>

<h3>V</h3>
<ul>
<li><a Annotating Vars>Variations</a></li>
</ul>

<h3>W</h3>
<ul>
<li><a Menus Windows>Windows menu</a></li>
</ul>

<p><footer>(Updated: Scid 3.5, February 2003)</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><name Edit>Edit</name></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><name Game>Game</name></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><name Search>Search</name></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><name Windows>Windows</name></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><name Tools>Tools</name></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 Reports Opening>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><name Options>Options</name></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><name Help>Help</name></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.5, February 2003)</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>

<h3><name Null>Entering null moves</name></h3>
<p>
<a Annotating Null>Null</a> (empty) moves can be useful in variations, where
you want to skip a move for one side. You can enter a null move with the
mouse by capturing one king with the other king, or with the keyboard by
typing "<b>--</b>" (that is, pressing the minus key twice).
</p>

<h3>Entering common annotation symbols</h3>
<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 3.4, July 2002)</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>
}

#################################
### Variations and comments help:

set helpTitle(Annotating) "Annotating games"
set helpText(Annotating) {<h1>Annotating games</h1>
<p>
Scid lets you add notes to games. There are three types of
annotation you can add after a move: symbols, a comment,
and variations.
</p>

<h3>Symbols and comments</h3>
<p>
Symbols are used to indicate an evaluation of the position (such as
"+-" or "=") or point out good ("!") and bad ("?") moves, while
comments can be any text. To add symbols and comments to a game, use
the <a Comment>Comment editor</a> window.
There is also a help page listing <a NAGs>standard symbol values</a>.
</p>
<p>
Note that each move can have more than one annotation symbol, but only
one comment. A comment before the first move of the game is printed as text
before the start of the game.
</p>

<h3><name Vars>Variations</name></h3>
<p>
A <term>variation</term> of a move is an alternative sequence of
moves at a particular point in a game. Variations can contain
comments and even recursively have sub-variations. The buttons
above the board with a "<b>V</b>" symbol, and commands in the
<menu>Edit</menu> menu, can be used to create, navigate and edit
variations.
</p>

<h4>Keyboard shortcuts</h4>
<p>
When a move has variations, they are shown in the game information
area. The first will be named <b>v1</b>, the second <b>v2</b>, etc.
You can click on a variation to enter it, or press "<b>v</b>" followed
by the variation number. (If there is only one variation, simply
pressing <b>v</b> will enter it.)
To leave a variation, you can use the "<b>z</b>" shortcut key.
</p>

<h3><name Null>Null moves</name></h3>
<p>
Sometimes, you may find it useful in a variation to skip over a move
for one side. For example, you may want to add the move 14.Bd3 to
a variation and point out that it threatens 15.Bxh7+ Kxh7 16.Ng5+
with an attack. You can do this by making a <term>null move</term>
between 14.Bd3 and 15.Bxh7+, in the above example. A null move is
displayed as "<b>--</b>" and can be inserted using the mouse by making
an illegal move of capturing one king with the other, or from the
keyboard by typing "<b>--</b>" (two minus signs).
</p>
<p>
Note that null moves are not a part of the PGN standard, so if you
export games with null moves to a PGN file, Scid will provide (among
other export options) an option to preserve null moves or convert them
to comments for compatibility with other software.
See the <a Export>Exporting</a> help page for more details.
</p>

<p><footer>(Updated: Scid 3.4, July 2002)</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 Reports Opening>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><name Null>Null moves in PGN Export</name></h3>
<p>
Scid allows <a Annotating Null>null (empty) moves</a> to be stored in
games, as they can be helpful when annotating games using variations.
However, the PGN standard has no null move concept. So if you export
Scid games with null moves to a PGN file, other PGN-reading software
will not be able to read the null moves.
</p>
<p>
To solve this problem, Scid provides an extra option,
<b>Convert null moves to comments</b>, when exporting games in PGN format.
If you want to create a PGN file that other software can use, turn this
option on and variations containing null moves will be converted to
comments. However, if you want to create a PGN file that can be imported
back into Scid later with null moves preserved, leave the option off.
</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 3.4, July 2002)</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>Analysis board</h3>
<p>
Pressing the chessboard-icon button in an analysis window will show
or hide the analysis board, which shows the position at the end of
the current best line of play found by the engine. This works for
most Scid-compatible engines but may not work for all; it depends on
the move notation an engine uses.
</p>

<h3>Engine priority</h3>
<p>
If an engine is using too much CPU time and affecting the use of Scid
or other applications, turning on the <b>Low CPU priority</b> checkbox
may help; it gives the engine a low priority for CPU scheduling.
</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.4, September 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>
}

####################
### Reports help:

set helpTitle(Reports) "Reports"
set helpText(Reports) {<h1>Reports</h1>
<p>
A <term>Report</term> in Scid is a document containing information about
a particular position and/or player. There are two types of report Scid can
generate: Opening Reports and Player Reports.
</p>

<h3><name Opening>Opening Reports</name></h3>
<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 Positional Themes section reports the frequency of certain common
positional themes in the report games. For this, the first 20 moves of
each game (hence the first 40 positions of each game after the starting
position) are examined. To be counted as containing a theme, a game must
contain that particular theme in at least 4 positions of its first 20
moves. This avoids the brief occurrence of a theme (such as an isolated
Queen pawn which is quickly captured) distorting results.
</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>

<h4>Favorites</h4>
<p>
The <menu>Favorites</menu> menu in the report window lets you maintain a
collection of favorite opening report positions and generate the opening
reports for all those positions easily. Selecting "Add Report..." from
the Favorites menu will add the current position as a favorite report
position; you will be prompted to enter a name that will be used as
the filename when favorite reports are generated.
</p>
<p>
Select "Generate Reports..." from the Favorites menu to generate a report
for each of your favorite reports using the current database. A dialog
box will appear allowing you to specify the report type and format, and
a directory where report files will be saved. A suitable suffix for the
format you selected (e.g. ".html" for HTML format) will be added to each
report file name.
</p>

<h3><name Player>Player Reports</name></h3>
<p>
A <term>Player Report</term> is very similar to an opening report, but it
contains information about the games of a single player with the white or
black pieces. You can generate a player report from the Tools menu, or from
the <a PInfo>Player Info</a> window.
</p>
<p>
A player report can be generated either for all games by the specified player
with the specified pieces, or for only the subset of those games which reach
the current position on the main window chessboard.
</p>

<h3>Limits</h3>
<p>
There is a limit of 2000 games for most data generated by reports, 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 Report options.
</p>

<p><footer>(Updated: Scid 3.5, February 2003)</footer></p>
}


####################
### Player List help:

set helpTitle(PList) "Player Finder window"
set helpText(PList) {<h1>The Player Finder window</h1>
<p>
The <term>Player Finder</term> window displays a list of names of
players in the current database. Selecting a player will open the
<a PInfo>Player Info</a> window to display more detailed information
about that player.
</p>
<p>
Five columns are displayed showing each player's name, peak Elo
rating, number of games played and the year of their oldest and
newest game.
Click on any column title at the top of the list to sort the
list by that column.
</p>
<p>
The controls below the list allow you to filter the list contents.
You can alter the maximum list size, enter a case-insensitive player
name prefix (such as "ada" to search for "Adams"), and restrict the
ranges of Elo rating and number of games played.
</p>

<p><footer>(Updated: Scid 3.4, July 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 more than
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>

<h4>The results board</h4>
<p>
In a tablebase position, it is often useful what the tablebase results
would be if all the pieces in the current position were on their
current squares but one particular piece was moved somewhere else.
For example, you may want to determine how close a king has to be to
a passed pawn to win or draw a particular position. In endgame books
this information is often called the <i>winning zone</i> or
<i>drawing zone</i> of a piece in a position.
</p>
<p>
You can find this information in Scid by pressing the button with an
image of a chessboard, to show the <term>results board</term> in the
tablebase window.
When you press the left mouse button on any piece in this board, a
symbol is drawn in each empty square showing what the tablebase result
would be (with the same side to move as the current main window position)
if the selected piece was on that square.
</p>
<p>
There are five different symbols a square can have:
a white <b>#</b> means White wins;
a black <b>#</b> means Black wins;
a blue <b>=</b> means the position is drawn;
a red <b>X</b> means the position is illegal (because the kings are
adjacent or the side to move is giving check); and
a red <b>?</b> means the result is unknown because the necessary
tablebase file is not available.
</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.4, September 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 MyPlayerNames>Setting your player names</name></h3>
<p>
There may be a player name (or several names) for whom, whenever a game
is loaded, you would like the main window chessboard to be displayed from
the perspective of that player. You can configure a list of such names
using <b>My Player Names...</b> from the <menu>Options/Chessboard</menu>
menu. In the dialog box that appears, enter one player name on each line.
Wildcard characters ("<b>?</b>" for exactly one character and "<b>*</b>"
for a sequence of zero or more characters) can be used.
</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 3.5, February 2003)</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><name Codes>ECO code system</name></h3>
<p>
The basic structure of the ECO system is:
</p>
<p>
<b><blue><run ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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>sgh@users.sourceforge.net</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)
    dialogbutton $w.b.prev -text "<" -font font_Small
    dialogbutton $w.b.next -text ">" -font font_Small
    dialogbutton $w.b.close -textvar ::tr(Close) -font font_Small \
      -command "destroy $w"
    pack $w.b.start -side left -padx 2
    packbuttons right $w.b.close $w.b.next $w.b.prev

    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"
    ::utils::win::Centre $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) != ""  &&  $::tcl_version <= 8.3} {
    # Convert tip charset, e.g. from is08859-2 coding in Tcl/Tk 8.3:
    # 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.
  }
}

### Menus.tcl: part of Scid.
### Copyright (C) 2001-2003 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 first {.#} $window] != -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 Menu <<MenuSelect>> {+
  if {[catch {%W index active} tempMenuIndex]} {
    statusBarRestore %W
  } else {
    statusBarHelp %W $tempMenuIndex
  }
}

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 ::file::New
bind . <Control-n> ::file::New
set helpMessage($m,0) FileNew

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

$m add command -label FileClose -acc "Ctrl+W" -command ::file::Close
bind . <Control-w> ::file::Close
set helpMessage($m,2) FileClose

$m add command -label FileFinder -acc "Ctrl+/" -command ::file::finder::Open
bind . <Control-slash> ::file::finder::Open
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 ::maint::OpenClose
bind . <Control-m> ::maint::OpenClose
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
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> ::windows::switcher::Open

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

#$m add separator

$m add cascade -label FileSwitch -menu $m.switch
set helpMessage($m,8) FileSwitch
menu $m.switch

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.switch add radiobutton -variable currentSlot -value $i \
    -label "Base $i: <none>" \
    -underline 5 -accelerator "Ctrl+$i" -command [list ::file::SwitchToBase $i]
  set helpMessage($m.switch,[expr {$i - 1} ]) "Switch to base slot $i"
  if {$i == $clipbaseSlot} {
    set helpMessage($m.switch,[expr {$i - 1} ]) "Switch to the clipbase database"
  }
  bind . "<Control-Key-$i>" [list ::file::SwitchToBase $i]
}

$m add separator

$m add command -label FileExit -accelerator "Ctrl+Q" -command ::file::Exit
bind . <Control-q> ::file::Exit
set helpMessage($m,10) FileExit


### Edit menu:

set m .menu.edit
$m add command -label EditAdd \
  -accel "Ctrl+A" -command {sc_var create; updateBoard -pgn}
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 {::game::Strip comments}
set helpMessage($m.strip,0) EditStripComments
$m.strip add command -label EditStripVars -command {::game::Strip variations}
set helpMessage($m.strip,1) EditStripVars
$m.strip add command -label EditStripBegin -command {::game::TruncateBegin}
set helpMessage($m.strip,2) EditStripBegin
$m.strip add command -label EditStripEnd -command {::game::Truncate}
set helpMessage($m.strip,3) EditStripEnd

$m add separator

$m add command -label EditReset -command {
  sc_clipbase clear
  updateBoard -pgn
  ::windows::gamelist::Refresh
  updateTitle
}
set helpMessage($m,7) EditReset

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

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

$m add command -label EditPastePGN -command importClipboardGame
set helpMessage($m,10) EditPastePGN

$m add separator

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

$m add command -label EditCopyBoard -accelerator "Ctrl+Shift+C" \
  -command copyFEN
bind . <Control-C> copyFEN
set helpMessage($m,13) EditCopyBoard

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


### Game menu:

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

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

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

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

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

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

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

$m add command -label GameNumber -command ::game::LoadNumber -accelerator "Ctrl+G"
bind . <Control-g> ::game::LoadNumber
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
}
bind . <Control-D> {sc_move ply [sc_eco game ply]; updateBoard}
set helpMessage($m,12) GameDeepest

$m add command -label GameGotoMove -accelerator "Ctrl+U" \
  -command ::game::GotoMoveNumber
set helpMessage($m,13) GameGotoMove
bind . <Control-u> ::game::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 ::search::filter::reset
bind . <Control-f> search::filter::reset
set helpMessage($m,0) SearchReset

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

$m  add separator

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

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

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

$m  add separator

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

### 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 ::windows::gamelist::isOpen -command ::windows::gamelist::Open  -accelerator "Ctrl+L"
bind . <Control-l> ::windows::gamelist::Open
set helpMessage($m,1) WindowsGList

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

$m add checkbutton -label WindowsPList \
  -variable plistWin -command ::plist::toggle -accelerator "Ctrl+Shift+P"
bind . <Control-P> ::plist::toggle
set helpMessage($m,3) WindowsPList

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

$m add separator

$m add checkbutton -label WindowsSwitcher \
  -variable baseWin -accelerator "Ctrl+D" -command ::windows::switcher::Open
set helpMessage($m,6) WindowsSwitcher

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

$m add separator

$m add checkbutton -label WindowsECO -accelerator "Ctrl+Y" \
  -variable ::windows::eco::isOpen -command {::windows::eco::OpenClose}
bind . <Control-y> ::windows::eco::OpenClose
set helpMessage($m,9) WindowsECO

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

$m add checkbutton -label WindowsStats -variable ::windows::stats::isOpen \
  -accelerator "Ctrl+I" -command ::windows::stats::Open
bind . <Control-i> ::windows::stats::Open
set helpMessage($m,11) 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,12) WindowsTree

$m add checkbutton -label WindowsTB -variable ::tb::isOpen -command ::tb::Open \
  -accelerator "Ctrl+="
bind . <Control-equal> ::tb::Open
set helpMessage($m,13) 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 ::tools::email
bind . <Control-E> ::tools::email
set helpMessage($m,3) ToolsEmail

$m add checkbutton -label ToolsFilterGraph \
  -accelerator "Ctrl+Shift+G" -variable filterGraph -command tools::graphs::filter::Open
bind . <Control-G> tools::graphs::filter::Open
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 ToolsPlayerReport -command ::preport::preportDlg
set helpMessage($m.9) ToolsPlayerReport

$m add command -label ToolsRating -command {::tools::graphs::rating::Refresh both}
# bind . <Control-R> {::tools::graphs::rating::Refresh both}
set helpMessage($m,10) ToolsRating

$m add command -label ToolsScore \
  -accelerator "Ctrl+Shift+Z" -command ::tools::graphs::score::Refresh
bind . <Control-Z> ::tools::graphs::score::Refresh
set helpMessage($m,11) ToolsScore

$m add separator

menu $m.exportcurrent

$m add cascade -label ToolsExpCurrent -menu $m.exportcurrent
set helpMessage($m,13) 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,14) 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,16) ToolsImportOne

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

### Options menu:

set m .menu.options
set optMenus {board export fonts ginfo language entry numbers startup windows}
set optLabels {Board Export Fonts GInfo Language Moves Numbers Startup Windows}
set i 0
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 OptionsSounds -command ::utils::sound::OptionsDialog
set helpMessage($m,9) OptionsSounds

$m add command -label OptionsToolbar -command configToolbar
set helpMessage($m,10) 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,12) OptionsECO

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

$m add command -label OptionsTable -command setTableBaseDir
set helpMessage($m,14) OptionsTable
if {![sc_info tb]} { $m entryconfigure 13 -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 [file nativename $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,15) OptionsRecent

$m add separator

$m add command -label OptionsSave -command {
  set optionF ""
  if {[catch {open [scidConfigFile options] w} optionF]} {
    tk_messageBox -title "Scid: Unable to write file" -type ok -icon warning \
      -message "Unable to write options file: [scidConfigFile options]\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 ::pgn::showColor \
                 ::pgn::indentVars ::pgn::indentComments \
                 ::pgn::shortHeader ::pgn::boldMainLine \
                 ::pgn::symbolicNags ::pgn::moveNumberSpaces ::pgn::columnFormat myPlayerNames \
                 tree(order) tree(autoSave) optionsAutoSave \
                 ecoFile suggestMoves glistSize glexport \
                 autoplayDelay animateDelay boardCoords boardSTM \
                 moveEntry(AutoExpand) moveEntry(Coord) \
                 askToReplaceMoves ::windows::switcher::vertical locale(numeric) \
                 spellCheckFile ::splash::autoclose autoRaise autoIconify \
                 exportFlags(comments) exportFlags(vars) \
                 exportFlags(indentc) exportFlags(indentv) \
                 exportFlags(column) exportFlags(symbols) \
                 exportFlags(htmldiag) exportFlags(convertNullMoves) \
                 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) \
                 ::utils::sound::soundFolder ::utils::sound::announceNew \
                 ::utils::sound::announceForward ::utils::sound::announceBack} {
      puts $optionF "set $i [list [set $i]]"
    }
    puts $optionF ""
    foreach i [lsort [array names winWidth]] {
      puts $optionF "set winWidth($i)  [expr $winWidth($i)]"
      puts $optionF "set winHeight($i) [expr $winHeight($i)]"
    }
    puts $optionF ""
    foreach i [lsort [array names winX]] {
      puts $optionF "set winX($i)  [expr $winX($i)]"
      puts $optionF "set winY($i)  [expr $winY($i)]"
    }
    puts $optionF ""
    puts $optionF "set analysisCommand [list $analysisCommand]"
    puts $optionF "set analysisChoices [list $analysisChoices]"
    puts $optionF ""
    foreach i {lite dark whitecolor blackcolor highcolor bestcolor \
               whiteborder blackborder borderwidth \
               pgnColor(Header) pgnColor(Main) pgnColor(Var) \
               pgnColor(Nag) pgnColor(Comment) pgnColor(Background) \
               pgnColor(Current) pgnColor(NextMove) } {
      puts $optionF "set $i [list [set $i]]"
    }
    puts $optionF ""
    foreach i [lsort [array names optable]] {
      puts $optionF "set optable($i) [list $optable($i)]"
    }
    foreach i [lsort [array names ::windows::stats::display]] {
      puts $optionF "set ::windows::stats::display($i) [list $::windows::stats::display($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)]"
    }
    puts $optionF ""
    foreach i {Regular Menu Small Tiny Fixed} {
      puts $optionF "set fontOptions($i) [list $fontOptions($i)]"
    }
    puts $optionF ""
    puts $optionF "set glistFields [list $glistFields]"
    foreach type {base book html tex tablebase1 tablebase2 tablebase3 tablebase4} {
      puts $optionF "set initialDir($type) [list $initialDir($type)]"
    }
    puts $optionF ""
    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: [scidConfigFile options]"
  }
}
set helpMessage($m,17) OptionsSave

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

menu $m.ginfo
$m.ginfo add checkbutton -label GInfoHideNext \
  -variable gameInfo(hideNextMove) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoMaterial \
  -variable gameInfo(showMaterial) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoFEN \
  -variable gameInfo(showFEN) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoMarks \
  -variable gameInfo(showMarks) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoWrap \
  -variable gameInfo(wrap) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoFullComment \
  -variable gameInfo(fullComment) -offvalue 0 -onvalue 1 -command updateBoard
$m.ginfo add checkbutton -label GInfoPhotos \
  -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
$m.ginfo add radiobutton -label GInfoTBResult \
  -variable gameInfo(showTB) -value 1 -command updateBoard
$m.ginfo add radiobutton -label GInfoTBAll \
  -variable gameInfo(showTB) -value 2 -command updateBoard

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

$m.entry add cascade -label OptionsMovesAnimate -menu $m.entry.animate
menu $m.entry.animate
foreach i {0 100 150 200 250 300 400 500 600 800 1000} {
  $m.entry.animate add radiobutton -label "$i ms" \
    -variable animateDelay -value $i
}
set helpMessage($m.entry,1) OptionsMovesAnimate

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

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

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

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

proc updateLocale {} {
  global locale
  sc_info decimal $locale(numeric)
  ::windows::gamelist::Refresh
  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) OptionsFontsSmall

$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)

set m .menu.options.board
menu $m

# Menu for changing board size:
$m add cascade -label OptionsBoardSize -menu $m.bdsize
set helpMessage($m,0) OptionsBoardSize

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

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

$m add separator

$m add command -label OptionsBoardNames -command editMyPlayerNames
set helpMessage($m,4) OptionsBoardNames

menu $m.bdsize
set count 0
foreach i $boardSizes {
  incr count
  set underline -1
  if {$count < 10} {set underline 0}
  if {$count == 10} {set underline 1}
  $m.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 $m.pieces
foreach i $boardStyles {
  $m.pieces add radio -label $i \
    -variable boardStyle -value $i \
    -underline 0 -command "setPieceFont $i"
}

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

$m add separator

$m  add command -label HelpAbout -command helpAbout
set helpMessage($m,9) HelpAbout

bind . <F1> {helpWindow Contents}

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

# 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.switch entryconfig [expr {$i - 1} ] -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 10
  $m.file delete $idx end
  set nrecent [::recentFiles::show $m.file]
  if {$nrecent > 0} {
    $m.file add separator
  }
  set idx [$m.file index end]
  incr idx
  $m.file add command -label [tr FileExit] -accelerator "Ctrl+Q" \
    -command ::file::Exit
  set helpMessage($m.file,$idx) FileExit

  # Configure File menu entry states::
  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:
    $m.tools entryconfig [tr ToolsEmail] -state normal
    $m.tools entryconfig [tr ToolsOpReport] -state normal
    $m.tools entryconfig [tr ToolsPlayerReport] -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
    $m.tools entryconfig [tr ToolsPlayerReport] -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

  ::search::Config
  ::windows::switcher::Refresh
  ::maint::Refresh
  ::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 Switch 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 PastePGN Setup
               CopyBoard PasteBoard} {
    configMenuText .menu.edit [tr Edit$tag $oldLang] Edit$tag $lang
  }
  foreach tag {Comments Vars Begin End} {
    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 PList 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
               PlayerReport} {
    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 {Board Export Fonts GInfo Language Moves Numbers
               Startup Sounds 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 {Size Pieces Colors Names} {
    configMenuText .menu.options.board [tr OptionsBoard$tag $oldLang] \
      OptionsBoard$tag $lang
  }
  foreach tag {HideNext Material FEN Marks Wrap FullComment Photos \
                 TBNothing TBResult TBAll} {
    configMenuText .menu.options.ginfo [tr GInfo$tag $oldLang] \
      GInfo$tag $lang
  }
  foreach tag {Ask Animate 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 {Contents 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 Photos \
                 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
  }

  ::pgn::ConfigMenus
  ::windows::stats::ConfigMenus
  ::tree::ConfigMenus
  ::crosstab::ConfigMenus
  ::optable::ConfigMenus
  ::preport::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> ::file::Open
  bind $w <Control-w> ::file::Close
  bind $w <Control-slash> ::file::finder::Open
  bind $w <Control-m> ::maint::OpenClose
  bind $w <Control-d> ::windows::switcher::Open
  bind $w <Control-q> ::file::Exit
  bind $w <Control-L> ::game::Reload
  bind $w <Control-Shift-Up> {::game::LoadNextPrev first}
  bind $w <Control-Shift-Down> {::game::LoadNextPrev last}
  bind $w <Control-Up> {::game::LoadNextPrev previous}
  bind $w <Control-Down> {::game::LoadNextPrev next}
  bind $w <Control-question> ::game::LoadRandom
  bind $w <Control-g> ::game::LoadNumber
  bind $w <Control-f> ::search::filter::reset
  bind $w <Control-B> ::search::board
  bind $w <Control-H> ::search::header
  bind $w <Control-M> ::search::material
  bind $w <Control-KeyPress-U> ::search:::usefile
  bind $w <Control-e> makeCommentWin
  bind $w <Control-l> ::windows::gamelist::Open
  bind $w <Control-p> ::pgn::OpenClose
  bind $w <Control-T> ::tourney::toggle
  bind $w <Control-i> ::windows::stats::Open
  bind $w <Control-t> ::tree::make
  bind $w <Control-A> makeAnalysisWin
  bind $w <Control-X> crosstabWin
  bind $w <Control-E> ::tools::email
  bind $w <Control-O> ::optable::makeReportWin
  # bind $w <Control-R> {::tools::graphs::rating::Refresh both}
  bind $w <Control-R> ::rep::OpenCloseWindow
  bind $w <Control-Z> ::tools::graphs::score::Refresh
  bind $w <Control-I> importPgnGame
  for {set i 1} { $i <= $::totalBaseSlots} {incr i} {
    bind $w "<Control-Key-$i>" "::file::SwitchToBase $i"
  }
}

### End of file: menus.tcl

# board.tcl: part of Scid
# Copyright (C) 2001-2003 Shane Hudson. All rights reserved.

# letterToPiece
#    Array that maps piece letters to their two-character value.
#
array set ::board::letterToPiece [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 \
]

# 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 {
  { "Green-Yellow" "#e0d070" "#70a070" "#b0d0e0" "#bebebe" }
  { "Brown" "#d0c0a0" "#a08050" "#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
    }
    $w.bd.bb configure -background $newColors(highcolor)
    $w.bd.wk configure -background $newColors(bestcolor)
    foreach i $colors {
      $w.select.b$i configure -background $newColors($i)
    }

    foreach i {0 1 2 3} {
      set c $w.border.c$i
      $c itemconfigure dark -fill $dark -outline $dark
      $c itemconfigure lite -fill $lite -outline $lite
    }

    return
  }

  toplevel $w
  wm title $w "Scid: [tr OptionsBoardColors]"

  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.border] -side top
  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
  }

  # Border width option:
  set f $w.border
  #label $f.label -text "Border width"
  #pack $f.label -side left -padx 5
  foreach i {0 1 2 3} {
    if {$i != 0} { pack [frame $f.gap$i -width 20] -side left -padx 1 }
    set b $f.b$i
    radiobutton $b -text "$i:" -variable newborderwidth -value $i
    set c $f.c$i
    canvas $c -height 40 -width 40 -background black
    $c create rectangle 0 0 [expr {20 - $i}] [expr {20 - $i}] -tag dark
    $c create rectangle [expr {20 + $i}] [expr {20 + $i}] 40 40 -tag dark
    $c create rectangle 0 [expr {20 + $i}] [expr 20 - $i] 40 -tag lite
    $c create rectangle [expr {20 + $i}] 0 40 [expr {20 - $i}] -tag lite
    pack $b $c -side left -padx 1
    bind $c <Button-1> "set newborderwidth $i"
  }
  set ::newborderwidth $::borderwidth

  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
  }

  dialogbutton $w.buttons.ok -text "OK" -command "
    foreach i {lite dark highcolor bestcolor} {
      set \$i \$newColors(\$i)
    }
    set borderwidth \$newborderwidth
    ::board::border .board \$borderwidth
    ::board::recolor .board
    recolorPieces
    grab release $w
    destroy $w
  "
  dialogbutton $w.buttons.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  bind $w <Escape> "catch {grab release $w}; destroy $w"
  packbuttons right $w.buttons.cancel $w.buttons.ok
  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
  #     }
  #   }
  # }
}

############################################################
### Toolbar and game movement buttons:

image create photo tb_open -data {
R0lGODdhEQARAMIAANnZ2QAAAKmpqf///76+vgAAAAAAAAAAACwAAAAAEQARAAADSQi63B0w
RuFAGDjfQF/WGOd9g9RZEPlFSkC4RCwTpYVKuMtxqgoJu8FsSAAaL8ThjoJMxoCipvMlsgwE
2KzW2Mp5T9twtkJWJAAAOw==
}

image create photo tb_new -data {
R0lGODlhEQARAMIAANnZ2ampqf///wAAAP///////////////yH5BAEKAAAA
LAAAAAARABEAAANECLoaLY5JAEGodSo4RHdDKI5C6QVBZ5qdurpvqQ4ozIqe
oNhrjuq8mOMSZEUsRdkRkDwxmrRnrxddQJejrGi5QHm/ywQAOw==
}

image create photo tb_save -data {
R0lGODdhEQARAKEAANnZ2QAAAJmZAP///ywAAAAAEQARAAACPISPecHtvkQYtNIAsAnS2hZN
3iWFI6ll3cml7Tm0kfQwQrnd+q67d93AqWgQlY8IMs5quVQG+FBIp1RFAQA7
}

image create photo tb_close -data {
R0lGODlhEQARAKEAANnZ2YsAAP///////yH5BAEKAAAALAAAAAARABEAAAIk
hI+pyxeh4HqJMguenFI3o2FN+IFeGW6XJVZYi7TwqJb2jRsFADs=
}

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 {
R0lGODlhEQARACIAACH5BAkAAAAALAAAAAARABEAotnZ2YsAALDE3gAAAP//
/76+vgAAAAAAAAM+CBChvu+xOKOrC9vKmpWd913dCGpj6A3sQHHBIMyCq5S3
TBC0jeq0mkkWFI6IAp7xGBwUTIqWkwWNtKoPVgIAOw==
}

image create photo tb_bsearch -data {
R0lGODlhEQARACIAACH5BAkAAAAALAAAAAARABEAotnZ2aCAUNDAoAAAALDE
3v///76+vgAAAANJKBqswmGACRy0TNK7mtIT93gCCIiiiQWr2rGvO8LlYFMn
mRE8AaIDQqHQ0wCFPd/ExmQmeSYcIMgjKqU4KtSAlTYNt26XKR4PEgA7
}

image create photo tb_hsearch -data {
R0lGODlhEQARACIAACH5BAkAAAAALAAAAAARABEAotnZ2QAngbDE3gAAAP//
/76+vgAAAAAAAAM+CLrcvuFJECetFwcMVY0ftHkkR5HnGXrgNbzDOA1CLQwW
TRA2Lum22yxY8z1oNZ5w2CtYALBB4fVkwKqLVwIAOw==
}

image create photo tb_msearch -data {
R0lGODlhEQARACIAACH5BAkAAAAALAAAAAARABEAotnZ2QAAAP///wAngbDE
3rLA3MDAwAAAAANLCLrcDmM8F4YQcqp6b34B132U6GmhSIIqkAZNaHVBYRfw
Zgr1Rdi5Ha8g+BEIwRntyERulJfaseh0Ra6RQDNg0L2+IUNIU8qRF6EEADs=
}

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==
}

set tb .tb
frame $tb -relief raised -border 1
button $tb.new -image tb_new -command ::file::New
button .tb.open -image tb_open -command ::file::Open
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 ::file::Close
button .tb.finder -image tb_finder -command ::file::finder::Open
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 ::game::Clear
button .tb.copy -image tb_copy \
  -command {catch {sc_clipbase copy}; updateBoard}
button .tb.paste -image tb_paste \
  -command {catch {sc_clipbase paste}; updateBoard -pgn}
frame .tb.space2 -width 12
button .tb.gprev -image tb_gprev -command {::game::LoadNextPrev previous}
button .tb.gnext -image tb_gnext -command {::game::LoadNextPrev next}
frame .tb.space3 -width 12
button .tb.rfilter -image tb_rfilter -command ::search::filter::reset
button .tb.bsearch -image tb_bsearch -command ::search::board
button .tb.hsearch -image tb_hsearch -command ::search::header
button .tb.msearch -image tb_msearch -command ::search::material
frame .tb.space4 -width 12
button .tb.switcher -image tb_switcher -command ::windows::switcher::Open
button .tb.glist -image tb_glist -command ::windows::gamelist::Open
button .tb.pgn -image tb_pgn -command ::pgn::OpenClose
button .tb.tmt -image tb_tmt -command ::tourney::toggle
button .tb.maint -image tb_maint -command ::maint::OpenClose
button .tb.eco -image tb_eco -command ::windows::eco::OpenClose
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 groove"
  bind .tb.$i <Any-Leave> "+.tb.$i configure -relief flat; statusBarRestore %W; break"
}

#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 "+ [::utils::string::Capital $::tr(all)]" -command {
    foreach i [array names toolbar_temp] { set toolbar_temp($i) 1 }
  }
  button $w.off -text "- [::utils::string::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} {
    grid .tb -row 0 -column 0 -columnspan 3 -sticky we
  } else {
    grid forget .tb
  }
}

proc setToolbar {x} {
  if {$x} {
    grid .tb -row 0 -column 0 -columnspan 3 -sticky we
  } else {
    grid 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
  # ::utils::tooltip::Set $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 ::move::Start
button .button.back -image tb_prev -command ::move::Back
button .button.forward -image tb_next -command ::move::Forward
button .button.end -image tb_end -command ::move::End
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 -animate}
button .button.addVar -image tb_addvar \
  -command {sc_var create; updateBoard -pgn -animate}
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_stm -data {
R0lGODlhFAAUAMIAANDAoKCAUAAAAP///////////////////yH5BAEKAAQALAAAAAAUABQA
AANHSLHMQjDKRp+8tNkbs+OTF2ygOIKdSHJA67qPIM/Wa8dDntc2TAi6HaTnAwZ5RNxxSAQo
dchejCZjJlFWKfZHpW2/4LAYmwAAOw==
}

image create photo tb_trial -data {
R0lGODlhFAAUABEAACH5BAkAAAAALAAAAAAUABQAodnZ2QAAAKCAUIsAAAI8
hI+pMD0LnYOqGUvjy3WDAAYZZoQiRZYn6n0hl5gyeKSmgOdC3c4yZYLFVkIX
rWgkUnAK5lIHzUCjSEgBADs=
}

image create photo tb_trial_on -data {
R0lGODdhFAAUAKEAAP//4IsAAAAAAKCAUCwAAAAAFAAUAAACPISPqRAdC52DqhlL48t1AwEK
GWaEIkWWJ+p9IZeYMnik5oDnQ93OMmWCxVZCF61oJFJwCuZSB81Ao0hIAQA7
}

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

namespace eval ::board {

    namespace export sq san recolor colorSquare isFlipped

    # List of square names in order; used by sq procedure.
    variable squareIndex [list a1 b1 c1 d1 e1 f1 g1 h1 a2 b2 c2 d2 e2 f2 g2 h2 \
                               a3 b3 c3 d3 e3 f3 g3 h3 a4 b4 c4 d4 e4 f4 g4 h4 \
                               a5 b5 c5 d5 e5 f5 g5 h5 a6 b6 c6 d6 e6 f6 g6 h6 \
                               a7 b7 c7 d7 e7 f7 g7 h7 a8 b8 c8 d8 e8 f8 g8 h8]
}

# ::board::sq:
#    Given a square name, returns its index as used in board
#    representations, or -1 if the square name is invalid.
#    Examples: [sq h8] == 63; [sq a1] = 0; [sq notASquare] = -1.
#
proc ::board::sq {sqname} {
  variable squareIndex
  return [lsearch -exact $squareIndex $sqname]
}

# ::board::san --
#
#	Convert a square number (0-63) used in board representations
#	to the SAN square name (a1, a2, ..., h8).
#
# Arguments:
#	sqno	square number 0-63.
# Results:
#	Returns square name "a1"-"h8".
#
proc ::board::san {sqno} {
    if {($sqno < 0) || ($sqno > 63)} { return }
    return [format %c%c \
                   [expr {($sqno % 8) + [scan a %c]}] \
                   [expr {($sqno / 8) + [scan 1 %c]}]]

}

# ::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::_border($w) $::borderwidth
  set ::board::_coords($w) 1
  set ::board::_flip($w) 0
  set ::board::_data($w) [sc_pos board]
  set ::board::_stm($w) 1
  set ::board::_showMarks($w) 0
  set ::board::_mark($w) {}
  set ::board::_drag($w) -1
  set bsize [expr {8 * ($psize+2)} + $::board::_border($w)]
  frame $w -class Board
  canvas $w.bd -width $bsize -height $bsize -cursor crosshair -background black
  grid $w.bd -row 1 -column 1 -rowspan 8 -columnspan 8
  set bd $w.bd
  set border $::board::_border($w)

  # 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) + $border + 1} ]
    set y1 [expr {(7 - $yi) * ($psize+2) + $border + 1} ]
    set x2 [expr {$x1 + $psize+1 - $border} ]
    set y2 [expr {$y1 + $psize+1 - $border} ]
    $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
  }

  # Set up side-to-move icons:
  frame $w.stmgap -width 3
  frame $w.stm
  frame $w.wtm -background white -relief solid -borderwidth 1
  frame $w.btm -background black -relief solid -borderwidth 1
  grid $w.stmgap -row 1 -column 10
  grid $w.stm -row 4 -column 11 -padx 2
  grid $w.wtm -row 8 -column 11
  grid $w.btm -row 1 -column 11

  ::board::stm $w
  ::board::coords $w
  ::board::resize $w redraw
  ::board::update $w
  return $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} {
  return [expr {($sq + ($sq / 8)) % 2 ? "$::lite" : "$::dark"}]
}

# ::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".
#   If the size argument is "redraw", the board is redrawn.
#   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 == "redraw"} { set psize $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 border $::board::_border($w)
  set bsize [expr {($psize+2) * 8 + $border} ]
  $w.bd configure -width $bsize -height $bsize
  set ::board::_size($w) $psize

  # Resize each square:
  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) + $border + 1}]
    set y1 [expr {(7 - $yi) * ($psize+2) + $border + 1}]
    set x2 [expr {$x1 + $psize +1 - $border}]
    set y2 [expr {$y1 + $psize +1 - $border}]
    # Windows seems to draw the squares off by one:
    if {$::windowsOS} {
      incr x1; incr y1; incr x2; incr y2
    }
    $w.bd coords sq$i $x1 $y1 $x2 $y2
  }

  # Resize the side-to-move icons:
  set stmsize [expr {round($psize / 4) + 5}]
  $w.stm configure -width $stmsize
  $w.wtm configure -height $stmsize -width $stmsize
  $w.btm configure -height $stmsize -width $stmsize

  ::board::update $w
  return $psize
}

# ::board::border
#   Get or set the border width.
#   If the optional argument is missing or the empty string, returns
#   the width of the board.
#   Otherwise, the board sqyare borders are set to the specified width.
#
proc ::board::border {w {border ""}} {
  if {$border == ""} {
    return $::board::_border($w)
  } else {
    set ::board::_border($w) $border
    ::board::resize $w redraw
  }
}

# ::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::_showMarks($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 {$i < 0  ||  $i > 63} { return }
  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::_showMarks($w) && [info exists ::board::_mark($w)]} {}
  if {[info exists ::board::_mark($w)]} {
    set color ""
    foreach mark $::board::_mark($w) {
      set type   [lindex $mark 0]
      set square [lindex $mark 1]
      if {$square == $i} {
          if {$type == "full"} { set color [lindex $mark 3] }
          if {$type == "DEL"}  { set color "" }
      }
    }
    if {![string equal $color ""]} {
      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]
}

### Namespace ::board::mark

namespace eval ::board::mark {

    namespace export getEmbeddedCmds
    namespace export add drawAll clear remove

    namespace import [namespace parent]::sq
    #namespace import [namespace parent]::isFlipped

    # Regular expression constants for
    # matching Scid's embedded commands in PGN files.

    variable StartTag {\[%}
    variable ScidKey  {mark|arrow}
    variable Command  {draw}
    variable Type     {full|square|arrow|circle|disk|tux}
    variable Text     {[-+=?!A-Za-z0-9]}
    variable Square   {[a-h][1-8]\M}
    variable Color    {[\w#][^]]*\M}	;# FIXME: too lax for #nnnnnn!
    variable EndTag   {\]}

    # Current (non-standard) version:
    variable ScidCmdRegex \
        "$StartTag              # leading tag
         ($ScidKey)\\\ +        # (old) command name + space chars
         ($Square)              # mandatory square (e.g. 'a4')
         (?:\\ +($Square))?     # optional: another (destination) square
         (?:\\ *($Color))?      # optional: color name
         $EndTag                # closing tag
        "
    # Proposed new version, according to the
    # PGN Specification and Implementation Guide (Supplement):
    variable StdCmdRegex \
        "${StartTag}            # leading tag
         ${Command}             # command name
         \\                     # a space character
         (?:(${Type}|$Text),)?  # keyword, e.g. 'arrow' (may be omitted)
                                # or single char (indicating type 'text')
         ($Square)              # mandatory square (e.g. 'a4')
         (?:,($Square))?        # optional: (destination) square
         (?:,($Color))?         # optional: color name
         $EndTag                # closing tag
        "
}

# ::board::mark::getEmbeddedCmds --
#
#	Scans a game comment string and extracts embedded commands
#	used by Scid to mark squares or draw arrows.
#
# Arguments:
#	comment     The game comment string, containing
#	            embedded commands, e.g.:
#	            	[%mark e4 green],
#	            	[%arrow c4 f7],
#	            	[%draw e4],
#	            	[%draw circle,f7,blue].
# Results:
#	Returns a list of embedded Scid commands,
#		{command indices ?command indices...?},
#	where 'command' is a list representing the embedded command:
#		'{type square ?arg? color}',
#		e.g. '{circle f7 red}' or '{arrow c4 f7 green}',
#	and 'indices' is a list containing start and end position
#	of the command string within the comment.
#
proc ::board::mark::getEmbeddedCmds {comment} {
    if {$comment == ""} {return}
    variable ScidCmdRegex
    variable StdCmdRegex
    set result {}

    # Build regex and search script for embedded commands:
    set regex  ""
    foreach r [list $ScidCmdRegex $StdCmdRegex] {
        if {[string equal $regex ""]} {set regex $r} else {append regex "|$r"}
    }
    set locateScript  {regexp -expanded -indices -start $start \
            $regex $comment indices}

    # Loop over all embedded commands contained in comment string:

    for {set start 0} {[eval $locateScript]} {incr start} {
        foreach {first last} $indices {}	;# just a multi-assign
        foreach re [list $ScidCmdRegex $StdCmdRegex] {
            # Assing matching subexpressions to variables:
            if {![regexp -expanded $re [string range $comment $first $last] \
                    match type arg1 arg2 color]} {
                continue
            }
            # Settings of (default) type and arguments:
            if {[string equal $color ""]} { set color "red" }
            switch -glob -- $type {
              ""   {set type [expr {[string length $arg2] ? "arrow" : "full"}]}
              mark {set type "full"	;# new syntax}
              ?    {if {[string length $arg2]} break else {
                        set arg2 $type; set type "text"}
                   }
            }
            # Construct result list:
            lappend result [list $type $arg1 $arg2 $color]
            lappend result $indices
            set start $last	;# +1 by for-loop
        }
    }
    return $result
}

# ::board::mark::drawAll --
#
#	Draws all kind of marks for the board.
#
# Arguments:
#	win	A frame containing a board '$win.bd'.
# Results:
#	Reads the current marked square information of the
#	board and adds (i.e. draws) them to the board.
#
proc ::board::mark::drawAll {win} {
    if {![info exists ::board::_mark($win)]} {return}
    foreach mark $::board::_mark($win) {
        # 'mark' is a list: {type arg1 ?arg2? color}
        eval add $win $mark "false"
    }
}

# ::board::mark::remove --
#
#	Removes a specified mark.
#
# Arguments:
#	win	A frame containing a board '$win.bd'.
#	args	List of one or two squares.
# Results:
#	Appends a dummy mark to the bord's list of marks
#	which causes the add routine to delete all marks for
#	the specified square(s).
#
proc ::board::mark::remove {win args} {
    if {[llength $args] == 2} {
        eval add $win arrow $args nocolor 1
    } else {
        add $win DEL [lindex $args 0] "" nocolor 1
    }
}

# ::board::mark::clear --
#
#	Clears all marked square information for the board:
#	colored squares, arrows, circles, etc.
#
# Arguments:
#	win	A frame containing a board '$win.bd'.
# Results:
#	Removes all marked squares information, recolors
#	squares (set to default square colors), but does not
#	delete the canvas objects drawn on the board.
#	Returns nothing.
#
proc ::board::mark::clear {win} {
    # Clear all marked square information:
    set ::board::_mark($win) {}
    for {set square 0} {$square < 64} {incr square} {
        ::board::colorSquare $win $square
    }
}

# ::board::mark::add --
#
#	Draws arrow or mark on the specified square(s).
#
# Arguments:
#	win		A frame containing a board 'win.bd'.
#	args		What kind of mark:
#	  type  	  Either type id (e.g., square, circle) or
#			    a single character, which is of type 'text'.
#	  square	  Square number 0-63 (0=a1, 1=a2, ...).
#	  ?arg2?	  Optional: additional type-specific parameter.
#	  color 	  Color to use for marking the square (mandatory).
#	  ?new? 	  Optional: whether or not this mark should be
#			    added to the list of marks; defaults to 'true'.
# Results:
#	For a given square, mark type, color, and optional (type-specific)
#	destination arguments, creates the proper canvas object.
#
proc ::board::mark::add {win args} {
    # Rearrange list if "type" is simple character:
    if {[string length [lindex $args 0]] == 1} {
        # ... e.g.,  {c e4 red} --> {text e4 c red}
        set args [linsert $args 1 "text"]
        set args [linsert [lrange $args 1 end] 2 [lindex $args 0]]
    }
    # Add default arguments:
    if {![regexp true|false|1|0 [lindex $args end]]} {
        lappend args "true"
    }
    if {[llength $args] == 4} { set args [linsert $args 2 ""]}

    # Here we (should) have: args == <type> <square> ?<arg>? <color> <new>
    foreach {type square dest color new} $args {break}	;# assign
    if {[llength $args] != 5 } { return }

    set board $win.bd
    set type  [lindex $args 0]

    # Remove existing marks:
    if {$type == "arrow"} {
        $board delete "mark${square}:${dest}" "mark${dest}:${square}"
        if {[string equal $color "nocolor"]} { set type DEL }
    } else {
        $board delete "mark${square}"
        ::board::colorSquare $win $square [::board::defaultColor $square]
    }

    switch -- $type {
        full    { ::board::colorSquare $win $square $color }
        DEL     { set new 1 }
        default {
            # Find a subroutine to draw the canvas object:
            set drawingScript "Draw[string totitle $type]"
            if {![llength [info procs $drawingScript]]} { return }

            # ... and try it:
            if {[catch {eval $drawingScript $board $square $dest $color}]} {
                return
            }
        }
    }
    if {$new} { lappend ::board::_mark($win) [lrange $args 0 end-1] }
}

# ::board::mark::DrawXxxxx --
#
#	Draws specified canvas object,
#	where "Xxxxx" is some required type, e.g. "Circle".
#
# Arguments:
#	pathName	Name of the canvas widget.
#	args		Type-specific arguments, e.g.
#				<square> <color>,
#				<square> <square> <color>,
#				<square> <char> <color>.
# Results:
#	Constructs and evaluates the proper canvas command
#	    "pathName create type coordinates options"
#	for the specified object.
#

# ::board::mark::DrawCircle --
#
proc ::board::mark::DrawCircle {pathName square color} {
    # Some "constants":
    set size 0.6	;# inner (enclosing) box size, 0.0 <  $size < 1.0
    set width 0.1	;# outline around circle, 0.0 < $width < 1.0

    set box [GetBox $pathName $square $size]
    lappend pathName create oval [lrange $box 0 3] \
            -tag [list mark circle mark$square p$square]
    if {$width > 0.5} {
        ;# too thick, draw a disk instead
        lappend pathName -fill $color
    } else {
        set width [expr {[lindex $box 4] * $width}]
        if {$width <= 0.0} {set width 1.0}
        lappend pathName -fill "" -outline $color -width $width
    }
    eval $pathName
}

# ::board::mark::DrawDisk --
#
proc ::board::mark::DrawDisk {pathName square color} {
    # Size of the inner (enclosing) box within the square:
    set size 0.6	;# 0.0 <  $size < 1.0 = size of rectangle

    set box [GetBox $pathName $square $size]
    eval $pathName \
            {create oval [lrange $box 0 3]} \
            -fill $color \
            {-tag [list mark disk mark$square p$square]}
}

# ::board::mark::DrawText --
#
proc ::board::mark::DrawText {pathName square char color {size 0}} {
    set box [GetBox $pathName $square 0.8]
    set len [expr {($size > 0) ? $size : int([lindex $box 4])}]
    set x   [lindex $box 5]
    set y   [lindex $box 6]
    $pathName delete text$square mark$square
    eval $pathName \
            create text $x $y -fill $color     \
            {-font [list helvetica $len bold]} \
            {-text [string index $char 0]}     \
            {-anchor c} \
            {-tag  [list mark text text$square mark$square p$square]}
}

# ::board::mark::DrawArrow --
#
proc ::board::mark::DrawArrow {pathName from to color} {
    if {$from < 0  ||  $from > 63} { return }
    if {$to   < 0  ||  $to   > 63} { return }
    set coord [GetArrowCoords $pathName $from $to]
    eval $pathName \
            {create line $coord} \
            -fill $color -arrow last -width 2 \
            {-tag [list mark arrows "mark${from}:${to}"]}
}

# ::board::mark::DrawTux --
#
image create photo tux16x16 -data \
{R0lGODlhEAAQAPUyAAAAABQVFiIcBi0tLTc0Kj4+PkQ3CU9ADVVFD1hJFV1X
P2pXFWJUKHttLnttOERERVVWWWRjYWlqcYNsGJR5GrSUIK6fXsKdGMCdI8er
ItCuNtm2KuS6KebAKufBOvjJIfnNM/3TLP/aMP/lM+/We//lQ//jfoGAgJaU
jpiYmqKipczBmv/wk97e3v//3Ojo6f/96P7+/v///wAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEBADIALAAAAAAQABAAAAbm
QJlMJpMBAAAAQCaTyWQymUwmAwQAAQAAIJPJZDKZTCYDQCInCQAgk8lkMplM
JgMwOBoHACCTyYAymUwmkwEao5IFAADIZDKZTCaTAVQu2GsAAMhkMplMJgMU
YrFY7AQAAGQymUwmA6RisVjsFQAAATKZTCYDBF6xWCwWewAAAJlMJjMoYrFY
LBaDAAAAmUwW+oBWsVgsxlokFgCZTBYChS6oWCxmAn5CHYNMJhOJQiFS7JXS
iEQjCkAmw3BCow0hAMiMNggAQCYDAAyTAwAASEwEAABAJpPJAAAAAACUAQAA
gEwmCwIAOw==}
set ::board::mark::tux16x16 tux16x16

image create photo tux32x32 -data \
{R0lGODlhIAAgAPU0AAAAABANAxERESAaBiwkCDAnCSQkJEM2DEA3GVBBDllJ
EFNKLG5aFHBbFHpkFnZoMkBAQFBQUGBgYHBwcIBpF4xyGZ+DHZ+GKqmKHq+T
Lb+hNsynJNSuJtu0J9+6NeW8Kc+wQPnMLPTJMP7QLv/UO//aVf/dYv/ifIiI
hp+fn6+vr7+/v//lif/ol//rpM/Pz9/f3//22O/u6v/55f///////wAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEBADUALAAAAAAgACAAAAb+
wFqtVqvVarVarQYAAAAAAABQq9VqtVqtVqvVarVarVar1Wq1Wg0AAAAAAAAA
AKjVarVarVar1YC1Wq1Wq9VqtVqtBg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AAAAAAAAAAIBarVar
1Wq1Wq1WqwEAAAAAAKjVarUaAAAAAAC1Wq1Wq9VqwFqtVqvVarVarVar1Wq1
Wq1Wq9VqtVqtVqvVarUgADs=
}
set ::board::mark::tux32x32 tux32x32

proc ::board::mark::DrawTux {pathName square discard} {
    variable tux16x16
    variable tux32x32
    set box [::board::mark::GetBox $pathName $square]
    for {set len [expr {int([lindex $box 4])}]} {$len > 0} {incr len -1} {
        if {[info exists tux${len}x${len}]} break
    }
    if {!$len} return
    $pathName create image [lrange $box 5 6] \
            -image tux${len}x${len} \
            -tag [list mark "mark$square" tux]
}

# ::board::mark::GetArrowCoords --
#
#	Auxiliary function:
#	Similar to '::board::midSquare', but this function returns
#	coordinates of two (optional adjusted) squares.
#
# Arguments:
#	board	A board canvas ('win.bd' for a frame 'win').
#	from	Source square number (0-63).
#	to	Destination square number (0-63).
#	shrink	Optional shrink factor (0.0 - 1.0):
#		  0.0 = no shrink, i.e. just return midpoint coordinates,
#		  1.0 = start and end at edge (unless adjacent squares).
# Results:
#	Returns a list of coodinates {x1 y1 x2 y2} for drawing
#	an arrow "from" --> "to".
#
proc ::board::mark::GetArrowCoords {board from to {shrink 0.6}} {
    if {$shrink < 0.0} {set shrink 0.0}
    if {$shrink > 1.0} {set shrink 1.0}

    # Get left, top, right, bottom, length, midpoint_x, midpoint_y:
    set fromXY [GetBox $board $from]
    set toXY   [GetBox $board $to]
    # Get vector (dX,dY) = to(x,y) - from(x,y)
    # (yes, misusing the foreach multiple features)
    foreach {x0 y0} [lrange $fromXY 5 6] {x1 y1} [lrange $toXY 5 6] {break}
    set dX [expr {$x1 - $x0}]
    set dY [expr {$y1 - $y0}]

    # Check if we have good coordinates and shrink factor:
    if {($shrink == 0.0) || ($dX == 0.0 && $dY == 0.0)} {
        return [list $x0 $y0 $x1 $y1]
    }

    # Solve equation: "midpoint + (lamda * vector) = edge point":
    if {abs($dX) > abs($dY)} {
        set edge [expr {($dX > 0) ? [lindex $fromXY 2] : [lindex $fromXY 0]}]
        set lambda [expr {($edge - $x0) / $dX}]
    } else {
        set edge [expr {($dY > 0) ? [lindex $fromXY 3] : [lindex $fromXY 1]}]
        set lambda [expr {($edge - $y0) / $dY}]
    }

    # Check and adjust shrink factor for adjacent squares
    # (i.e. don't make arrows too short):
    set maxShrinkForAdjacent 0.667
    if {$shrink > $maxShrinkForAdjacent} {
        set dFile [expr {($to % 8) - ($from % 8)}]
        set dRank [expr {($from / 8) - ($to / 8)}]
        if {(abs($dFile) <= 1) && (abs($dRank) <= 1)} {
            set shrink $maxShrinkForAdjacent
        }
    }

    # Return shrinked line coordinates {x0', y0', x1', y1'}:
    set shrink [expr {$shrink * $lambda}]
    return [list [expr {$x0 + $shrink * $dX}] [expr {$y0 + $shrink * $dY}]\
                 [expr {$x1 - $shrink * $dX}] [expr {$y1 - $shrink * $dY}]]
}

# ::board::mark::GetBox --
#
#	Auxiliary function:
#	Get coordinates of an inner box for a specified square.
#
# Arguments:
#	pathName	Name of a canvas widget containing squares.
#	square		Square number (0..63).
#	portion		Portion (length inner box) / (length square)
#			(1.0 means: box == square).
# Results:
#	Returns a list whose elements are upper left and lower right
#	corners, length, and midpoint (x,y) of the inner box.
#
proc ::board::mark::GetBox {pathName square {portion 1.0}} {
    set coord [$pathName coords sq$square]
    set len [expr {[lindex $coord 2] - [lindex $coord 0]}]
    if {$portion < 1.0} {
        set dif [expr {$len * (1.0 -$portion) * 0.5}]
        foreach i {0 1} { lappend box [expr {[lindex $coord $i] + $dif}] }
        foreach i {2 3} { lappend box [expr {[lindex $coord $i] - $dif}] }
    } else {
        set box $coord
    }
    lappend box [expr { [lindex $box 2] - [lindex $box 0]     }]
    lappend box [expr {([lindex $box 0] + [lindex $box 2]) / 2}]
    lappend box [expr {([lindex $box 1] + [lindex $box 3]) / 2}]
    return $box
}

### End of namespace ::board::mark

# ::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 $::board::letterToPiece($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::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} {
  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 $::board::letterToPiece($piece)$psize -tag p$sq
}

# ::board::clearText
#   Remove all text annotations from the board.
#
proc ::board::clearText {w} {
  $w.bd delete texts
}

# ::board::drawText
#   Draws the specified text on the specified square.
#   Additional arguments are treated as canvas text parameters.
#
proc ::board::drawText {w sq text color args} {
    mark::DrawText ${w}.bd $sq $text $color \
        [expr {[catch {font actual font_Bold -size} size] ? 11 : $size}]
    #if {[llength $args] > 0} {
    #  catch {eval $w.bd itemconfigure text$sq $args}
    #}
}

# ::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.
#   If the optional paramater "animate" is 1 and the changes from
#   the previous board state appear to be a valid chess move, the
#   move is animated.
#
proc ::board::update {w {board ""} {animate 0}} {
  set oldboard $::board::_data($w)
  if {$board == ""} {
    set board $::board::_data($w)
  } else {
    set ::board::_data($w) $board
  }
  set psize $::board::_size($w)
  set flip $::board::_flip($w)

  # Cancel any current animation:
  after cancel "::board::_animate $w"

  # Remove all marks (incl. arrows) from the board:
  $w.bd delete mark

  # Draw each square:
  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 $::board::letterToPiece($piece)$psize -tag p$sq
  }

  # Update side-to-move icon:
  grid remove $w.wtm $w.btm
  if {$::board::_stm($w)} {
    set side [string index $::board::_data($w) 65]
    if {$side == "w"} { grid configure $w.wtm }
    if {$side == "b"} { grid configure $w.btm }
  }

  # Redraw marks and arrows if required:
  if {$::board::_showMarks($w)} {
    ::board::mark::drawAll $w
  }

  # Animate board changes if requested:
  if {$animate  &&  $board != $oldboard} {
    ::board::animate $w $oldboard $board
  }
}

proc ::board::isFlipped {w} {
  return $::board::_flip($w)
}

# ::board::flip
#   Rotate the board 180 degrees.
#
proc ::board::flip {w {newstate -1}} {
  if {! [info exists ::board::_flip($w)]} { return }
  if {$newstate == $::board::_flip($w)} { return }
  set flip [expr {1 - $::board::_flip($w)} ]
  set ::board::_flip($w) $flip

  # Swap squares:
  for {set i 0} {$i < 32} {incr i} {
    set swap [expr {63 - $i}]
    set coords(South) [$w.bd coords sq$i]
    set coords(North) [$w.bd coords sq$swap]
    $w.bd coords sq$i    $coords(North)
    $w.bd coords sq$swap $coords(South)
  }

  # 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
      grid configure $w.wtm -row 1
      grid configure $w.btm -row 8
    }
  } else {
    foreach file {a b c d e f g h} {
      $w.tfile$file configure -text $file
      $w.bfile$file configure -text $file
      grid configure $w.wtm -row 8
      grid configure $w.btm -row 1
    }
  }
  ::board::update $w
  return $w
}

# ::board::stm
#   Add or remove the side-to-move icon.
#
proc ::board::stm {w} {
  set stm [expr {1 - $::board::_stm($w)} ]
  set ::board::_stm($w) $stm
  if {$stm} {
    grid configure $w.stmgap
    grid configure $w.stm
  } else {
    grid remove $w.stmgap $w.stm $w.wtm $w.btm
  }
  ::board::update $w
}

# ::board::coords
#   Add or remove coordinates around the edge of the board.
#
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
    }
  }
}

# ::board::animate
#   Check for board changes that appear to be a valid chess move,
#   and start animating the move if applicable.
#
proc ::board::animate {w oldboard newboard} {
  global animateDelay
  if {$animateDelay <= 0} { return }

  # Find which squares differ between the old and new boards:
  set diffcount 0
  set difflist [list]
  for {set i 0} {$i < 64} {incr i} {
    if {[string index $oldboard $i] != [string index $newboard $i]} {
      incr diffcount
      lappend difflist $i
    }
  }

  # Check the number of differences could mean a valid move:
  if {$diffcount < 2  ||  $diffcount > 4} { return }

  for {set i 0} {$i < $diffcount} {incr i} {
    set sq($i) [lindex $difflist $i]
    set old($i) [string index $oldboard $sq($i)]
    set new($i) [string index $newboard $sq($i)]
  }

  set from -1
  set to -1
  set captured -1
  set capturedPiece "."

  if {$diffcount == 4} {
    # Check for making/unmaking a castling move:
    set castlingList [list [sq e1] [sq g1] [sq h1] [sq f1] \
                           [sq e8] [sq g8] [sq h8] [sq f8] \
                           [sq e1] [sq c1] [sq a1] [sq d1] \
                           [sq e8] [sq c8] [sq a8] [sq d8]]

    foreach {kfrom kto rfrom rto} $castlingList {
      if {[lsort $difflist] == [lsort [list $kfrom $kto $rfrom $rto]]} {
        if {[string tolower [string index $oldboard $kfrom]] == "k"  &&
            [string tolower [string index $oldboard $rfrom]] == "r"  &&
            [string tolower [string index $newboard $kto]] == "k"  &&
            [string tolower [string index $newboard $rto]] == "r"} {
          # A castling move animation.
          # Move the rook back to initial square until animation is complete:
          # TODO: It may look nicer if the rook was animated as well...
          eval $w.bd coords p$rto [::board::midSquare $w $rfrom]
          set from $kfrom
          set to $kto
        } elseif {[string tolower [string index $newboard $kfrom]] == "k"  &&
                  [string tolower [string index $newboard $rfrom]] == "r"  &&
                  [string tolower [string index $oldboard $kto]] == "k"  &&
                  [string tolower [string index $oldboard $rto]] == "r"} {
          # An undo-castling animation. No need to move the rook.
          set from $kto
          set to $kfrom
        }
      }
    }
  }

  if {$diffcount == 3} {
    # Three squares are different, so check for an En Passant capture:
    foreach i {0 1 2} {
      foreach j {0 1 2} {
        foreach k {0 1 2} {
          if {$i == $j  ||  $i == $k  ||  $j == $k} { continue }
          # Check for an en passant capture from i to j with the enemy
          # pawn on k:
          if {$old($i) == $new($j) && $old($j) == "." && $new($k) == "."  &&
                (($old($i) == "p" && $old($k) == "P") ||
                 ($old($i) == "P" && $old($k) == "p"))} {
            set from $sq($i)
            set to $sq($j)
          }
          # Check for undoing an en-passant capture from j to i with
          # the enemy pawn on k:
          if {$old($i) == $new($j) && $old($k) == "." && $new($i) == "."  &&
                (($old($i) == "p" && $new($k) == "P") ||
                 ($old($i) == "P" && $new($k) == "p"))} {
            set from $sq($i)
            set to $sq($j)
            set captured $sq($k)
            set capturedPiece $new($k)
          }
        }
      }
    }
  }

  if {$diffcount == 2} {
    # Check for a regular move or capture: one old square should have the
    # same (non-empty) piece as the other new square, and at least one
    # of the old or new squares should be empty.

    if {$old(0) != "." && $old(1) != "." && $new(0) != "." && $new(1) != "."} {
      return
    }

    foreach i {0 1} {
      foreach j {0 1} {
        if {$i == $j} { continue }
        if {$old($i) == $new($j)  &&  $old($i) != "."} {
          set from $sq($i)
          set to $sq($j)
          set captured $sq($j)
          set capturedPiece $old($j)
        }

        # Check for a (white or black) pawn promotion from i to j:
        if {($old($i) == "P"  &&  [string is upper $new($j)]  &&
             $sq($j) >= [sq a8]  &&  $sq($j) <= [sq h8])  ||
            ($old($i) == "p"  &&  [string is lower $new($j)]  &&
             $sq($j) >= [sq a1]  &&  $sq($j) <= [sq h1])} {
          set from $sq($i)
          set to $sq($j)
        }

        # Check for undoing a pawn promotion from j to i:
        if {($new($j) == "P"  &&  [string is upper $old($i)]  &&
             $sq($i) >= [sq a8]  &&  $sq($i) <= [sq h8])  ||
            ($new($j) == "p"  &&  [string is lower $old($i)]  &&
             $sq($i) >= [sq a1]  &&  $sq($i) <= [sq h1])} {
          set from $sq($i)
          set to $sq($j)
          set captured $sq($j)
          set capturedPiece $old($j)
        }
      }
    }
  }

  # Check that we found a valid-looking move to animate:
  if {$from < 0  ||  $to < 0} { return }

  # Redraw the captured piece during the animation if necessary:
  if {$capturedPiece != "."  &&  $captured >= 0} {
    ::board::drawPiece $w $from $capturedPiece
    eval $w.bd coords p$from [::board::midSquare $w $captured]
  }

  # Move the animated piece back to its starting point:
  eval $w.bd coords p$to [::board::midSquare $w $from]
  $w.bd raise p$to

  # Remove side-to-move icon while animating:
  grid remove $w.wtm $w.btm

  # Start the animation:
  set start [clock clicks -milli]
  set ::board::_animate($w,start) $start
  set ::board::_animate($w,end) [expr {$start + $::animateDelay} ]
  set ::board::_animate($w,from) $from
  set ::board::_animate($w,to) $to
  ::board::_animate $w
}

# ::board::_animate
#   Internal procedure for updating a board move animation.
#
proc ::board::_animate {w} {
  if {! [winfo exists $w]} { return }
  set from $::board::_animate($w,from)
  set to $::board::_animate($w,to)
  set start $::board::_animate($w,start)
  set end $::board::_animate($w,end)
  set now [clock clicks -milli]
  if {$now > $end} {
    ::board::update $w
    return
  }

  # Compute where the moving piece should be displayed and move it:
  set ratio [expr {double($now - $start) / double($end - $start)} ]
  set fromMid [::board::midSquare $w $from]
  set toMid [::board::midSquare $w $to]
  set fromX [lindex $fromMid 0]
  set fromY [lindex $fromMid 1]
  set toX [lindex $toMid 0]
  set toY [lindex $toMid 1]
  set x [expr {$fromX + round(($toX - $fromX) * $ratio)} ]
  set y [expr {$fromY + round(($toY - $fromY) * $ratio)} ]
  $w.bd coords p$to $x $y
  $w.bd raise p$to

  # Schedule another animation update in a few milliseconds:
  after 5 "::board::_animate $w"
}


###
### End of file: board.tcl
###
### move.tcl
### Functions for moving within a game.

namespace eval ::move {}

proc ::move::Start {} {
  if {$::tree(refresh)} { return }
  sc_move start
  updateBoard
}

proc ::move::End {} {
  if {$::tree(refresh)} { return }
  sc_move end
  updateBoard
}

proc ::move::Back {{count 1}} {
  if {$::tree(refresh)} { return }
  if {[sc_pos isAt start]  ||  [sc_pos isAt vstart]} { return }
  sc_move back $count
  if {$count == 1} {
    # Do animation and speech:
    updateBoard -animate
    ::utils::sound::AnnounceBack
  } else {
    updateBoard
  }
}

proc ::move::Forward {{count 1}} {
  if {$::tree(refresh)} { return }
  if {[sc_pos isAt end]  ||  [sc_pos isAt vend]} { return }
  set move [sc_game info next]
  sc_move forward $count
  if {$count == 1} {
    # Animate and speak this move:
    updateBoard -animate
    ::utils::sound::AnnounceForward $move
  } else {
    updateBoard
  }
}


###
### main.tcl: Routines for creating and updating the main window.
###


############################################################
# 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)} {
      # Play a bell sound to let the user know the move was accepted already,
      # but only if move announcement is off?
      # 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
    updateBoard -pgn -animate
    ::utils::sound::AnnounceNewMove $move
    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
  ::commenteditor::storeComment
  storeEpdTexts
}

sc_info preMoveCmd preMoveCommand


# updateTitle:
#   Updates the main Scid window title.
#
proc updateTitle {} {
  set title "Scid - "
  set fname [sc_base filename]
  set fname [file tail $fname]
  append title "$fname ($::tr(game) "
  append title "[::utils::thousands [sc_game number]] / "
  append title "[::utils::thousands [sc_base numGames]])"
  wm title . $title
}

# updateStatusBar:
#   Updates the main Scid window status bar.
#
proc updateStatusBar {} {
  global statusBar moveEntry
  ::windows::switcher::Refresh
  ::maint::Refresh
  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 "--"
  }

  set current [sc_base current]
  append statusBar "  $::tr(Database)"
  if {$current != [sc_info clipbase]} {
    append statusBar " $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]"
}


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

button .button.stm -image tb_stm -takefocus 0 -command toggleSTM

proc toggleSTM {} {
  global boardSTM
  set boardSTM [expr {1 - $boardSTM} ]
  ::board::stm .board
}

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 stm trial} {
  .button.$i configure -relief flat -border 1 -highlightthickness 0 \
    -anchor n -takefocus 0
  bind .button.$i <Any-Enter> "+.button.$i configure -relief groove"
  bind .button.$i <Any-Leave> "+.button.$i configure -relief flat; statusBarRestore %W; break"
}

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 \
  .button.stm -side left -pady 1 -padx 0 -ipadx 0 -pady 0 -ipady 0


############################################################
### The board:

::board::new .board $boardSize
#.board.bd configure -relief solid -border 2
::board::showMarks .board 1
if {$boardCoords} {
  ::board::coords .board
}
if {$boardSTM} {
  ::board::stm .board
}

# .gameInfo is the game information widget:
#
autoscrollframe .gameInfoFrame text .gameInfo
.gameInfo configure -width 20 -height 6 -fg black -bg white -wrap none \
  -state disabled -cursor top_left_arrow -setgrid 1
::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 GInfoPhotos \
  -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
  ::windows::gamelist::Refresh
}

.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
    ::windows::gamelist::Refresh
  "
}

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}} {
  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 $::board::letterToPiece($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; updateBoard -pgn"
    .menu.edit.del add command -label $str -command $commandStr
    set commandStr "sc_var first $i; updateBoard -pgn"
    .menu.edit.first add command -label $str -command $commandStr
    set commandStr "sc_var promote $i; updateBoard -pgn"
    .menu.edit.main add command -label $str -command $commandStr \
      -state $state
  }
}

# V and Z key bindings: move into/out of a variation.
#
bind . <KeyPress-v> {
  if {[sc_var count] == 1} {
    # There is only one variation, so enter it
    sc_var moveInto 0
    updateBoard
  } else {
    # Present a menu of the possible variations
    focus .
    update idletasks
    .button.intoVar.menu post [winfo pointerx .] [winfo pointery .]
  }
}
bind . <KeyPress-z> {.button.exitVar invoke}

# editMyPlayerNames
#   Present the dialog box for editing the list of player
#   names from whose perspective the board should be shown
#   whenever a game is loaded.
#
proc editMyPlayerNames {} {
  global myPlayerNames
  set w .editMyPlayerNames
  if {[winfo exists $w]} { return }
  toplevel $w
  wm title $w "Scid: [tr OptionsBoardNames]"
  pack [frame $w.b] -side bottom -fill x

  autoscrollframe $w.desc text $w.desc.text \
    -foreground black -background gray90 \
    -width 50 -height 8 -wrap word -cursor top_left_arrow
  $w.desc.text insert end [string trim $::tr(MyPlayerNamesDescription)]
  $w.desc.text configure -state disabled
  pack $w.desc -side top -fill x
  autoscrollframe $w.f text $w.f.text \
    -background white -width 50 -height 10 -wrap none
  foreach name $myPlayerNames {
    $w.f.text insert end "\n\"$name\""
  }
  pack $w.f -side top -fill both -expand yes
  button $w.b.white -text $::tr(White) -command {
      .editMyPlayerNames.f.text insert end "\"[sc_game info white]\"\n"
  }
  button $w.b.black -text $::tr(Black) -command {
      .editMyPlayerNames.f.text insert end "\"[sc_game info black]\"\n"
  }
  button $w.b.help -text $::tr(Help) \
    -command {helpWindow Options MyPlayerNames}
  button $w.b.ok -text OK -command editMyPlayerNamesOK
  button $w.b.cancel -text $::tr(Cancel) -command "grab release $w; destroy $w"
  pack $w.b.cancel $w.b.ok -side right -padx 5 -pady 5
  pack $w.b.white $w.b.black $w.b.help -side left -padx 5 -pady 5
  grab $w
}

proc editMyPlayerNamesOK {} {
  global myPlayerNames
  set w .editMyPlayerNames
  set text [string trim [$w.f.text get 1.0 end]]
  set myPlayerNames {}
  foreach name [split $text "\n"] {
      set name [string trim $name]
      if {[string match "\"*\"" $name]} {
        set name [string trim $name "\""]
      }
      if {$name != ""} { lappend myPlayerNames $name }
  }
  grab release $w
  destroy $w
}

# flipBoardForPlayerNames
#   Check if either player in the current game has a name that matches
#   a pattern in the specified list and if so, flip the board if
#   necessary to show from that players perspective.
#
proc flipBoardForPlayerNames {namelist {board .board}} {
  set white [sc_game info white]
  set black [sc_game info black]
  foreach pattern $namelist {
    if {[string match $pattern $white]} {
      ::board::flip $board 0
      return
    }
    if {[string match $pattern $black]} {
      ::board::flip $board 1
      return
    }
  }
}

# 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 a parameter "-pgn" is specified, the PGN text is also regenerated.
#    If a parameter "-animate" is specified, board changes are animated.
#
proc updateBoard {args} {
  global boardSize gameInfo
  set pgnNeedsUpdate 0
  set animate 0
  foreach arg $args {
   if {! [string compare $arg "-pgn"]} { set pgnNeedsUpdate 1 }
   if {! [string compare $arg "-animate"]} { set animate 1 }
  }

  # Remove marked squares informations.
  # (This must be done _before_ updating the board!)
  ::board::mark::clear .board

  ::board::resize .board $boardSize
  ::board::update .board [sc_pos board] $animate

  # Draw arrows and marks, color squares:

  foreach {cmd discard} [::board::mark::getEmbeddedCmds [sc_pos getComment]] {
      set type   [lindex $cmd 0]
      set square [::board::sq [lindex $cmd 1]]
      set color  [lindex $cmd end]
      if {[llength $cmd] < 4} { set cmd [linsert $cmd 2 ""] }
      set dest   [expr {[string match {[a-h][1-8]} [lindex $cmd 2]] \
                  ? [::board::sq [lindex $cmd 2]] : [lindex $cmd 2]}]
      # add mark to board
      eval ::board::mark::add .board $type $square $dest $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; updateBoard -pgn}
  }
  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]} { ::commenteditor::Refresh }
  if {[::tb::isopen]} { ::tb::results }
  updateMenuStates
  moveEntry_Clear
  updateStatusBar
  if {[winfo exists .twinchecker]} { updateTwinChecker }
  if {[winfo exists .pgnWin]} { ::pgn::Refresh $pgnNeedsUpdate }
  if {[winfo exists .noveltyWin]} { updateNoveltyWin }
}

# Set up player photos:

image create photo photoW
image create photo photoB
label .photoW -background white -image photoW -anchor ne
label .photoB -background white -image photoB -anchor ne

proc readPhotoFile {fname} {
  set oldcount [array size ::photo]
  if {! [file readable $fname]} { return }
  catch {source $fname}
  set newcount [expr {[array size ::photo] - $oldcount}]
  if {$newcount > 0} {
    ::splash::add "Found $newcount player photos in [file tail $fname]"
  }
}

proc photo {player data} {
  set ::photo($player) $data
}

array set photo {}

# Read all Scid photo (*.spf) files in the Scid data/user/config directories:
foreach photofile [glob -nocomplain -directory $scidDataDir "*.spf"] {
  readPhotoFile $photofile
}
foreach photofile [glob -nocomplain -directory $scidUserDir "*.spf"] {
  readPhotoFile $photofile
}
foreach photofile [glob -nocomplain -directory $scidConfigDir "*.spf"] {
  readPhotoFile $photofile
}

# Read players.img for compatibility with older versions:
readPhotoFile [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"
}

proc addNullMove {} {
    addMove null null
}

# 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.
#   If the optional parameter is "-animate", the move will be animated.
#
proc addMove { sq1 sq2 {animate ""}} {
  global EMPTY
  set nullmove 0
  if {$sq1 == "null"  &&  $sq2 == "null"} { set nullmove 1 }
  if {!$nullmove  &&  [sc_pos isLegal $sq1 $sq2] == 0} {
    # Illegal move, but if it is King takes king then treat it as
    # entering a null move:
    set board [sc_pos board]
    set k1 [string tolower [string index $board $sq1]]
    set k2 [string tolower [string index $board $sq2]]
    if {$k1 == "k"  &&  $k2 == "k"} { set nullmove 1 } else { 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"} {
    # nothing
  } elseif {$action == "var"} {
    sc_var create
  } else {
    # Do not add the move at all:
    return
  }
  if {$nullmove} {
    sc_move addSan null
  } else {
    # if {[winfo exists .commentWin]} { .commentWin.cf.text delete 0.0 end }
    sc_move add $sq1 $sq2 $promo
    set san [sc_game info previous]
    after idle [list ::utils::sound::AnnounceNewMove $san]
  }
  moveEntry_Clear
  updateBoard -pgn $animate
  ::tree::doTraining
}

# addSanMove
#   Like addMove above, but takes the move in SAN notation instead of
#   a pair of squares.
#
proc addSanMove {san {animate ""} {noTraining ""}} {
  set action "replace"
  if {![sc_pos isAt vend]} {
    set action [confirmReplaceMove]
  }
  if {$action == "replace"} {
    # nothing
  } elseif {$action == "var"} {
    sc_var create
  } else {
    # Do not add the move at all:
    return
  }
  # if {[winfo exists .commentWin]} { .commentWin.cf.text delete 0.0 end }
  sc_move addSan $san
  moveEntry_Clear
  updateBoard -pgn $animate
  ::utils::sound::AnnounceNewMove $san
  if {$noTraining != "-notraining"} {
    ::tree::doTraining
  }
}

# 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
    if {$square != $selectedSq} {
      addMove $square $selectedSq -animate
    }
    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 -animate
  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 $w -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 -animate
      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
  }
}


# 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
  updateBoard -pgn -animate
  ::utils::sound::AnnounceBack
}


##
## Auto-playing of moves:
##
set autoAnnotate 1
set autoplayMode 0

set tempdelay 0
trace variable tempdelay w {::utils::validate::Regexp {^[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 }
  }
  ::move::Forward
  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
  }
  updateBoard -pgn
}


# 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, B=Brasil Portuguese,
#      P=Polish, N=Nederlands, W=Swedish, O=Norsk, C=Czech, H=Hungarian,
#      Y=Serbian.
#
# (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: sgh@users.sourceforge.net


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 FileSwitch "Switch to Database" 0 \
  {Switch to a different opened database}
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 EditStripBegin "Moves from the beginning" 1 \
  {Strip moves from the beginning of the game}
menuText E EditStripEnd "Moves to the end" 0 \
  {Strip moves to the end of the 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 EditPastePGN "Paste Clipboard text as PGN game..." 18 \
  {Interpret the clipboard text as a game in PGN notation and paste it here}
menuText E EditSetup "Setup Start Board..." 0 \
  {Set the start position for this game}
menuText E EditCopyBoard "Copy Position" 6 \
  {Copy the current board in FEN notation to the text selection (clipboard)}
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 WindowsPList "Player Finder" 2 {Open/close the player finder}
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 ToolsPlayerReport "Player Report..." 3 \
  {Generate a player report}
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 OptionsBoard "Chessboard" 0 {Chess board appearance options}
menuText E OptionsBoardSize "Size" 0 {Change the board size}
menuText E OptionsBoardPieces "Piece Style" 6 {Change the board piece style}
menuText E OptionsBoardColors "Colors..." 0 {Change board colors}
menuText E OptionsBoardNames "My Player Names..." 0 {Edit my player names}
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 OptionsMovesAnimate "Animation Time" 1 \
  {Set the amount of time used to animate 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 (e.g. "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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds}
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 HelpContents "Contents" 0 {Show the help contents page}
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" 1 {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 GInfoPhotos "Show Photos" 5
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.stm {Turn the side-to-move icon on or off}
helpMsg E .button.autoplay {Autoplay moves  (key: Ctrl+Z)}

# General buttons:
translate E Back {Back}
translate E Browse {Browse}
translate E Cancel {Cancel}
translate E Clear {Clear}
translate E Close {Close}
translate E Contents {Contents}
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 ShowIcons {Show Icons}
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 AverageRating {Average Rating}
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}
translate E readonly {read-only}

# Standard error messages:
translate E ErrNotOpen {This is not an open database.}
translate E ErrReadOnly {This database is read-only; it cannot be altered.}
translate E ErrSearchInterrupted {Search was interrupted; results are incomplete.}

# 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}
translate E PInfoEditRatings {Edit Ratings}

# 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}
translate E WinningMoves {Winning moves}
translate E DrawingMoves {Drawing moves}
translate E LosingMoves {Losing moves}
translate E UnknownMoves {Unknown-result moves}

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate E TreeTitleRow \
  {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws}
translate E TreeTotal {TOTAL}

# 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}

# Player finder:
menuText E PListFile "File" 0
menuText E PListFileUpdate "Update" 0
menuText E PListFileClose "Close Player Finder" 0
menuText E PListSort "Sort" 0
menuText E PListSortName "Name" 0
menuText E PListSortElo "Elo" 0
menuText E PListSortGames "Games" 0
menuText E PListSortOldest "Oldest" 0
menuText E PListSortNewest "Newest" 2

# 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 "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}
translate E LowPriority {Low CPU Priority}

# 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 PgnFileCopy "Copy Game to Clipboard" 0
menuText E PgnFilePrint "Print to File..." 0
menuText E PgnFileClose "Close PGN Window" 10
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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4
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
translate E PgnWindowTitle {Game Notation - game %u}

# 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}
translate E Category {Category}

# 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 OprepFavorites "Favorites" 1
menuText E OprepFavoritesAdd "Add Report..." 0
menuText E OprepFavoritesEdit "Edit Report Favorites..." 0
menuText E OprepFavoritesGenerate "Generate Reports..." 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 EndSideToMove {Side to move at end of game}
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 Description {Description}
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:}
translate E InsertMark {Insert mark}
translate E InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
}

# Nag buttons in comment editor:
translate E GoodMove {Good move}
translate E PoorMove {Poor move}
translate E ExcellentMove {Excellent move}
translate E Blunder {Blunder}
translate E InterestingMove {Interesting move}
translate E DubiousMove {Dubious move}
translate E WhiteDecisiveAdvantage {White has a decisive advantage}
translate E BlackDecisiveAdvantage {Black has a decisive advantage}
translate E WhiteClearAdvantage {White has a clear advantage}
translate E BlackClearAdvantage {Black has a clear advantage}
translate E WhiteSlightAdvantage {White has a slight advantage}
translate E BlackSlightAdvantage {Black has a slight advantage}
translate E Equality {Equality}
translate E Unclear {Unclear}
translate E Diagram {Diagram}

# 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}

# Common endings in material search:
translate E EndingPawns {Pawn endings}
translate E EndingRookVsPawns {Rook vs. Pawn(s)}
translate E EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook}
translate E EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook}
translate E EndingRooks {Rook vs. Rook endings}
translate E EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn}
translate E EndingRooksDouble {Double Rook endings}
translate E EndingBishops {Bishop vs. Bishop endings}
translate E EndingBishopVsKnight {Bishop vs. Knight endings}
translate E EndingKnights {Knight vs. Knight endings}
translate E EndingQueens {Queen vs. Queen endings}
translate E EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen}
translate E BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame}

# Common patterns in material search:
translate E PatternWhiteIQP {White IQP}
translate E PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6}
translate E PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6}
translate E PatternBlackIQP {Black IQP}
translate E PatternWhiteBlackIQP {White IQP vs. Black IQP}
translate E PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple}
translate E PatternHangingC5D5 {Black Hanging Pawns on c5 and d5}
translate E PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)}
translate E PatternRookSacC3 {Rook Sacrifice on c3}
translate E PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)}
translate E PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)}
translate E PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)}
translate E PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)}
translate E PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)}

# 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 EnPassantFile {En Passant 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 OprepMostFrequentOpponents {Most frequent opponents}
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 OprepMostFrequentEcoCodes {Most frequent ECO codes}
translate E OprepThemes {Positional Themes}
translate E OprepThemeDescription {Frequency of themes in the first %u moves of each game}
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 OprepThemeWIQP {White Isolated Queen Pawn}
translate E OprepThemeBIQP {Black 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}
translate E OprepViewHTML {View HTML}
translate E OprepViewLaTeX {View LaTeX}

# Player Report:
translate E PReportTitle {Player Report}
translate E PReportColorWhite {with the White pieces}
translate E PReportColorBlack {with the Black pieces}
translate E PReportMoves {after %s}
translate E PReportOpenings {Openings}
translate E PReportClipbase {Empty clipbase and copy matching games to it}

# 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 [::utils::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.
}

# Sounds configuration:
translate E SoundsFolder {Sound Files Folder}
translate E SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc}
translate E SoundsAnnounceOptions {Move Announcement Options}
translate E SoundsAnnounceNew {Announce new moves as they are made}
translate E SoundsAnnounceForward {Announce moves when moving forward one move}
translate E SoundsAnnounceBack {Announce when retracting or moving back one move}

# 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}

# My Player Names options:
translate E MyPlayerNamesDescription {
Enter a list of preferred player names below, one name per line. Wildcards (e.g. "?" for any single character, "*" for any sequence of characters) are permitted.

Every time a game with a player in the list is loaded, the main window chessboard will be rotated if necessary to show the game from that players perspective.
}

}
# 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.
#
#  Hinweis (aus tcl/lang/english.tcl):
#
# (4) [...]
#
#     A menu command has the format:
#         menuText L tag "Name..." underline {HelpMessage...}
#
#     [...]
#
#     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.

addLanguage D Deutsch 0 iso8859-1

proc setLanguage_D {} {

# File menu:
menuText D File "Datei" 0
menuText D FileNew "Neu..." 0 {Neue Scid-Datenbank anlegen}
menuText D FileOpen "ffnen..." 0 {Existierende Scid-Datenbank ffnen}
menuText D FileClose "Schlieen" 0 {Aktive Scid-Datenbank schlieen}
menuText D FileFinder "Finder" 0 {Dateifinderfenster ffnen}
menuText D FileBookmarks "Lesezeichen" 0 {Lesezeichenmen (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 \
  {Lesezeichen bearbeiten}
menuText D FileBookmarksList "Listenansicht" 1 \
  {Lesezeichen als Liste zeigen, ohne Unterverzeichnisse}
menuText D FileBookmarksSub "Verzeichnisansicht" 3 \
  {Lesezeichen in Verzeichnissen zeigen, nicht als Gesamtliste}
menuText D FileMaint "Wartung" 0 {Das Scid-Datenbankwartungsfenster}
menuText D FileMaintWin "Wartungfenster" 0 \
  {Datenbank-Wartungsfenster ffnen/schlieen}
menuText D FileMaintCompact "Datenbank komprimieren..." 10 \
  {Datenbank komprimieren, gelschte Spiele und unbenutzte Namen entfernen}
menuText D FileMaintClass "Partien ECO-klassifizieren..." 8 \
{Neuklassifizierung aller Partien nach dem ECO-Code}
menuText D FileMaintSort "Sortieren..." 0 \
  {Alle Partien in der aktuellen Datenbank sortieren}
menuText D FileMaintDelete "Dubletten lschen..." 0 \
  {Dubletten finden und Lschkennzeichen setzen}
menuText D FileMaintTwin "Dubletten prfen" 10 \
  {Dublettenfenster ffnen/erneuern}
menuText D FileMaintName "Namen" 0 \
  {Namenseditor und Rechtschreibprfung}
menuText D FileMaintNameEditor "Namenseditor" 0 \
  {Namenseditorfenster ffnen/schlieen}
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 \
  {Datenbank als schreibgeschtzt behandeln, nderungen verhindern}
menuText D FileSwitch "Datenbank wechseln" 0 \
  {Zu einer anderen geffneten Datenbank umschalten}
menuText D FileExit "Ende" 0 {Scid beenden}

# Edit menu:
menuText D Edit "Bearbeiten" 0
menuText D EditAdd "Variante hinzufgen" 0 \
  {Fge zu diesem Zug eine Variante hinzu}
menuText D EditDelete "Variante lschen" 9 \
  {Lsche eine Variante zu diesen Zug}
menuText D EditFirst "Als erste Variante setzen" 4 \
  {Variante an erste Stelle in der Liste setzten}
menuText D EditMain "Variante als Partiefortsetzung" 13 \
  {Variante zur Partiefolge machen (und umgekehrt)}
menuText D EditTrial "Variante testen" 9 \
  {Testmodus starten/stoppen, um eine Idee am Brett auszuprobieren}
menuText D EditStrip "Entfernen" 1 \
   {Kommentare oder Varianten aus der Partie entfernen}
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 EditStripBegin "Zge ab Anfang" 8 \
  {Entferne Zge ab Partieanfang}
menuText D EditStripEnd "Zge bis Ende" 9 \
  {Entferne Zge bis Partieende}
menuText D EditReset "Ablage leeren" 0 \
   {Inhalt der Ablage-Datenbank lschen}
menuText D EditCopy "Partie in Ablage kopieren" 17 \
  {Diese Partie in die Ablage-Datenbank kopieren}
menuText D EditPaste "Partie aus Ablage einfgen" 19 \
  {Aktive Partie aus der Ablage hier einfgen}
menuText D EditPastePGN "PGN-Partie aus Ablage einfgen..." 1 \
  {Interpretiere den Inhalt der Zwischenablage als PGN-Notation und fge ihn hier ein}
menuText D EditSetup "Stellungseingabe..." 0 \
  {Neue Stellung eingeben (FEN oder manuell)}
menuText D EditCopyBoard "Stellung kopieren" 10 \
  {Aktuelle Brettposition in die Zwischenablage kopieren (im FEN-Format)}
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, dabei alle nderungen verwerfen}
menuText D GameFirst "Erste Partie laden" 0 {Erste Partie im Filter laden}
menuText D GamePrev "Vorherige Partie laden" 0 \
  {Vorherige Partie im Filter laden}
menuText D GameReload "Partie wiederladen" 7 \
  {Diese Partie erneut laden, dabei alle nderungen verwerfen}
menuText D GameNext "Nchste Partie laden" 0 {Nchste Partie im Filter laden}
menuText D GameLast "Letzte Partie laden" 0 {Letzte Partie im Filter laden}
menuText D GameRandom "Zufllige Partie laden" 1 \
  {Zufllig ausgewhlte Partie im Filter laden}
menuText D GameNumber "Lade Partie Nummer..." 14 \
  {Partie durch Angabe der Nummer laden}
menuText D GameReplace "Partie ersetzen..." 8 \
  {Diese Partie sichern, dabei alte Version berschreiben}
menuText D GameAdd "Partie speichern..." 7 \
  {Diese Partie als neue Partie in der Datenbank sichern}
menuText D GameDeepest "Erffnung identifizieren" 10 \
  {Zur Position der lngstmglichen Zugfolge nach ECO-Klassifikation gehen}
menuText D GameGotoMove "Zugnummer..." 0 \
  {Zur angegebenen Zugnummer in der aktuellen Partie gehen}
menuText D GameNovelty "Finde Neuerung..." 0 \
  {Ersten Zug dieser Partie finden, der vorher noch nie gespielt wurde}

# Search menu:
menuText D Search "Suchen" 0
menuText D SearchReset "Filter zurcksetzen" 0 \
  {Alle Partien in den Filter einschlieen}
menuText D SearchNegate "Filter invertieren" 7 \
  {Alle ausgeschlossenen Partien in den Filter nehmen}
menuText D SearchCurrent "Brett..." 0 \
  {Aktuelle Brettposition suchen}
menuText D SearchHeader "Partiedaten..." 0 \
  {Partiedaten (Spieler, Turnier etc.) suchen}
menuText D SearchMaterial "Material/Muster..." 0 \
  {Nach Material- oder Stellungsmustern suchen}
menuText D SearchUsing "Mit Suchoptionsdatei..." 4 \
  {Mit Suchoptionsdatei suchen}

# Windows menu:
menuText D Windows "Fenster" 0
menuText D WindowsComment "Kommentareditor" 0 {Kommentareditor ffnen/schlieen}
menuText D WindowsGList "Partieliste" 6 {Partieliste ffnen/schlieen}
menuText D WindowsPGN "PGN-Fenster" 0 {PGN-Fenster (Partienotation) ffnen/schlieen}
menuText D WindowsPList "Spielersuche" 0 {Spielerfinder ffnen/schlieen}
menuText D WindowsTmt "Turniersuche" 0 {Turnierfinder ffnen/schlieen}
menuText D WindowsSwitcher "Datenbank-Umschalter" 0 \
  {Datenbank-Umschalter ffnen/schlieen}
menuText D WindowsMaint "Wartungsfenster" 0 {(Datenbank-)Wartungsfenster ffnen/schlieen}
menuText D WindowsECO "ECO-Auswertung" 0 {ECO-Auswertung ffnen/schlieen}
menuText D WindowsRepertoire "Repertoire-Editor" 0 {Erffnungsrepertoire-Editor ffnen/schlieen}
menuText D WindowsStats "Statistik" 4 {Filterstatistik ffnen/schlieen}
menuText D WindowsTree "Zugbaum" 0 {Zugbaum ffnen/schlieen}
menuText D WindowsTB "Endspieltabellen..." 1 {Endspieltabellen ffnen/schlieen}

# 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 \
  {E-Mail-Manager ffnen/schlieen}
menuText D ToolsFilterGraph "Filtergrafik" 6 \
  {Filtergrafik ffnen/schlieen}
menuText D ToolsOpReport "Erffnungsbericht" 0 \
  {Ausfhrliche Erffnungsbersicht fr die aktuelle Position erstellen}
menuText D ToolsTracker "Figurenverteilung"  7 \
  {Figurenverteilungsfenster ffnen}
menuText D ToolsPInfo "Spielerinformation"  0 \
  {Spielerinformation ffnen/schlieen}
menuText D ToolsPlayerReport "Spielerbericht..." 7 \
  {Erzeuge einen Spielerbericht}
menuText D ToolsRating "ELO-Zahl-Verlauf" 4 \
  {Wertungsverlauf beider Spieler grafisch darstellen}
menuText D ToolsScore "Partiebewertungsgraph" 0 {Partie-Bewertungsgraph zeigen}
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 OptionsBoard "Schachbrett" 6 {Schachbrettoptionen}
menuText D OptionsBoardSize "Brettgre" 0 {Brettgre ndern}
menuText D OptionsBoardPieces "Figurensatz" 2 {Figurensatz wechseln}
menuText D OptionsBoardColors "Farben..." 0 {Brettfarben ndern}
menuText D OptionsBoardNames "Meine Spielernamen..." 0 {Editiere meine Spielernamen}
menuText D OptionsExport "Export" 1 {Textausgabeoptionen ndern}
menuText D OptionsFonts "Zeichenstze" 3 {Zeichenstze wechseln}
menuText D OptionsFontsRegular "Normal" 0 {Standardzeichensatz}
menuText D OptionsFontsMenu "Men" 0 {Zeichensatz fr Mens}
menuText D OptionsFontsSmall "Klein" 0 {Kleine Zeichen}
menuText D OptionsFontsFixed "Fest" 0 {Zeichensatz mit fester Breite (nicht-proportional)}
menuText D OptionsGInfo "Partieinformation" 0 {Optionen fr Informationsbereich}
menuText D OptionsLanguage "Sprache" 0 {Sprache whlen}
menuText D OptionsMoves "Zge" 0 {Zugeingabeoptionen}
menuText D OptionsMovesAsk "Fragen vor Ersetzen" 0 \
  {Vor berschreiben existierender Zge nachfragen}
menuText D OptionsMovesAnimate "Animation" 0 \
  {Zeit fr Zuganimation einstellen}
menuText D OptionsMovesDelay "Autom. Vorspielen..." 7 \
  {Zeit fr automatisches Vorspielen einstellen}
menuText D OptionsMovesCoord "Tastatureingabe" 0 \
  {Zugeingabe ber Koordinaten ("g1f3") akzeptieren}
menuText D OptionsMovesSuggest "Zugvorschlag zeigen" 0 \
  {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 zum ffnen bei Start auswhlen}
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 OptionsSounds "Tne..." 0 {Tne fr Zugankndigung einstellen} ;# *** Hmm, :-|
menuText D OptionsToolbar "Werkzeugleiste" 0 {Werkzeug- bzw. Symbolleiste Ein/Aus}
menuText D OptionsECO "ECO-Datei laden..." 0 {ECO-Klassifikationsdatei laden}
menuText D OptionsSpell "Schreibkorrekturdatei laden..." 7 \
  {Datei fr Scid-Rechtschreibprfung laden}
menuText D OptionsTable "Endspieltabellenverzeichnis..." 16 \
  {Eine Endspieltabellendatei whlen (und damit alle Tabellen in diesem Verzeichnis)}
menuText D OptionsRecent "Aktuelle Dateien..." 9 \
  {Anzahl der aktuellen Dateien im Dateimen ndern}
menuText D OptionsSave "Optionen speichern" 0 \
  "Alle einstellbaren Optionen in der Datei $::optionsFile sichern"
menuText D OptionsAutoSave "Autom. speichern bei Beenden" 0 \
  {Alle Optionen beim Beenden von Scid automatisch speichern}

# Help menu:
menuText D Help "Hilfe" 0
menuText D HelpContents "Inhalt" 0 {Gehe zum Inhaltsverzeichnis}
menuText D HelpIndex "Index" 4 {Gehe zum Hilfeindex}
menuText D HelpGuide "Kurzanleitung" 4 {Ein Scid-Schnelldurchgang}
menuText D HelpHints "Hinweise" 0 {Die Scid-Kurztips}
menuText D HelpContact "Kontaktinformation" 0 {Hilfe zur Kontaktinformation}
menuText D HelpTip "Tagestip" 0 {Zeigt einen ntzlichen Tip an}
menuText D HelpStartup "Startfenster" 0 {Startfenster zeigen}
menuText D HelpAbout "ber Scid" 0 {Informationen zu Scid}

# Game info box popup menu:
menuText D GInfoHideNext "Nchsten Zug verstecken" 13
menuText D GInfoMaterial "Materialwerte zeigen" 0
menuText D GInfoFEN "FEN zeigen" 0
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 GInfoPhotos "Fotos zeigen" 1
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 einen Zug zurck  (Taste: LinksPfeil)}
helpMsg D .button.forward {Gehe einen 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.stm {Anzeige "Wer ist am Zug" an oder aus}
helpMsg D .button.autoplay {Automatisches Vorspielen  (Taste: Strg+Z)}

# General buttons:
translate D Back {Zurck}
translate D Browse {Blttern}
translate D Cancel {Abbrechen}
translate D Clear {Leeren}
translate D Close {Schlieen}
translate D Contents {Inhalt}
translate D Defaults {Standard}
translate D Delete {Lsche}
translate D Graph {Grafik}
translate D Help {Hilfe}
translate D Import {Importieren}
translate D Index {Index}
translate D LoadGame {Partie laden}
translate D BrowseGame {Partie betrachten}
translate D MergeGame {Partien kombinieren} ;# mischen?! einfgen!?
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 ShowIcons {Show Icons} ;# ***
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}
translate D Black {Schwarz}
translate D Player {Spieler}
translate D Rating {Elo}
translate D RatingDiff {Elo-Differenz (Wei - Schwarz)}
translate D AverageRating {Elo-Durchschnitt}
translate D Event {Turnier}
translate D Site {Ort}
translate D Country {Land}
translate D IgnoreColors {Farben ignorieren}
translate D Date {Datum}
translate D EventDate {Turnierdatum}
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}
translate D readonly {schreibgeschtzt}

# Standard error messages:
translate D ErrNotOpen {Dies ist keine geffnete Datenbank.}
translate D ErrReadOnly \
  {Diese Datenbank ist schreibgeschtzt; sie kann nicht gendert werden.}
translate D ErrSearchInterrupted \
  {Suche wurde unterbrochen; Ergebnisse sind unvollstndig.}

# 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 {Biographie}
translate D PInfoEditRatings {Editiere Ratings}

# 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}
translate D WinningMoves {Gewinnzge}
translate D DrawingMoves {Remiszge}
translate D LosingMoves {Verlustzge}
translate D UnknownMoves {Zge mit unbekanntem Resultat}

# 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-Cache-Datei (.stc)}
menuText D TreeFileFill "Cache-Datei fllen" 12 \
  {Flle die Cache-Datei mit hufigen Erffnungspositionen}
menuText D TreeFileBest "Beste Partien" 0 \
  {Zeige die Liste bester Partien im Baum}
menuText D TreeFileGraph "Grafikfenster" 0 \
  {Zeige die Grafik fr diesen Ast}
menuText D TreeFileCopy "Kopiere Baumfenster in Zwischenablage" 0 \
  {Kopiere die Zugbaum-Statistik in die Zwischenablage}
menuText D TreeFileClose "Baumfenster schlieen" 12 {Schliee Zugbaum}
menuText D TreeSort "Sortieren" 0
menuText D TreeSortAlpha "Alphabetisch" 0
menuText D TreeSortECO "ECO-Code" 0
menuText D TreeSortFreq "Hufigkeit" 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 {Trainingsmodus 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 "Zugbaumhilfe" 0
menuText D TreeHelpIndex "Index" 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 Zugbaumpartien}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate D TreeTitleRow \
  {    Zug    ECO       Hufigkeit    Pkte   Elo  Erflg Jahr %Remis}
translate D TreeTotal {SUMME}

# Finder window:
menuText D FinderFile "Datei" 0
menuText D FinderFileSubdirs "Unterverzeichnisse beachten" 0
menuText D FinderFileClose "Dateifinder 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 "Datenbanken im alten Format" 0
menuText D FinderTypesPGN "PGN-Dateien" 0
menuText D FinderTypesEPD "EPD-Dateien" 0
menuText D FinderTypesRep "Repertoiredateien" 0
menuText D FinderHelp "Hilfe" 0
menuText D FinderHelpFinder "Dateifinderhilfe" 0
menuText D FinderHelpIndex "Index" 0
translate D FileFinder {Dateifinder}
translate D FinderDir {Verzeichnis}
translate D FinderDirs {Verzeichnisse}
translate D FinderFiles {Dateien}
translate D FinderUpDir {hoch}

# Player finder:
menuText D PListFile "Datei" 0
menuText D PListFileUpdate "Aktualisieren" 0
menuText D PListFileClose "Spielerfinder schlieen" 7
menuText D PListSort "Sortieren" 0
menuText D PListSortName "Name" 0
menuText D PListSortElo "Elo" 0
menuText D PListSortGames "Partien" 0
menuText D PListSortOldest "lteste" 0
menuText D PListSortNewest "Neueste" 0

# Tournament finder:
menuText D TmtFile "Datei" 0
menuText D TmtFileUpdate "Aktualisieren" 0
menuText D TmtFileClose "Turnierfinder 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 "Spielerinfo Spieler" 1
translate D GraphFilterTitle "Filtergrafik: Hufigkeit pro 1000 Partien"

# Analysis window:
translate D AddVariation {Variante hinzufgen}
translate D AddMove {Zug hinzufgen}
translate D Annotate {Autom. kommentieren}
translate D AnalysisCommand {Analysebefehl}
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}
translate D LowPriority {Niedrige CPU-Prioritt}

# 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 PgnFileCopy "Kopiere Spiel in Zwischenablage" 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) Vorspann (Header)" 8
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 "Farbfelder-/Pfeile-Zeichen entfernen" 27
menuText D PgnOptBoldMainLine "Partiezge in Fettdruck" 0
menuText D PgnColor "Farben" 0
menuText D PgnColorHeader "Vorspann..." 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
translate D PgnWindowTitle {Partienotation - Partie %u}

# Crosstable window menus:
menuText D CrosstabFile "Datei" 0
menuText D CrosstabFileText "Ausgabe in Textdatei..." 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 "Stichkampfpunkte" 10
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}
translate D Category {Kategorie}

# Opening report window menus:
menuText D OprepFile "Datei" 0
menuText D OprepFileText "Ausgabe in Textdatei..." 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 OprepFavorites "Favoriten" 0
menuText D OprepFavoritesAdd "Bericht hinzufgen..." 8
menuText D OprepFavoritesEdit "Favoritenbericht editieren..." 0
menuText D OprepFavoritesGenerate "Berichte erzeugen..." 9

menuText D OprepHelp "Hilfe" 0
menuText D OprepHelpReport "Erffnungsbericht-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 "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 {Partiedatensuche}
translate D EndSideToMove {Wer ist beim Partieende am Zug?}
translate D GamesWithNoECO {Partien ohne ECO?}
translate D GameLength {Partielnge}
translate D FindGamesWith {Finde Partien mit den Markierungen (Flags)}
translate D StdStart {Standardausgangsposition}
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 {Grober 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 {Turnierdatum}
translate D GlistResult {Ergebnis}
translate D GlistLength {Lnge}
translate D GlistCountry {Land}
translate D GlistECO {ECO}
translate D GlistOpening {Erffnung}
translate D GlistEndMaterial {Endmaterial}
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 {Datenbankname:}
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 Description {Beschreibung}
translate D Flag {Markierung}
translate D DeleteCurrent {Lsche aktuelle Partie}
translate D DeleteFilter {Lsche Partien im Filter}
translate D DeleteAll {Lsche alle Partien}
translate D UndeleteCurrent {Aktuelle Partie wiederherstellen}
translate D UndeleteFilter {Partien im Filter wiederherstellen}
translate D UndeleteAll {Alle Partien wiederherstellen}
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 {Datenbankoperationen}
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 ausgewhlt 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:}
translate D InsertMark {Markierung einfgen}
translate D InsertMarkHelp {
Markierung einfgen/lschen: Farbe, Typ, Feld whlen.
Pfeil einfgen/lschen: Rechtsklick auf zwei Felder.
}

# Nag buttons in comment editor:
translate D GoodMove {Guter Zug}
translate D PoorMove {Schwacher Zug}
translate D ExcellentMove {Ausgezeichneter Zug}
translate D Blunder {Grober Fehler}
translate D InterestingMove {Interessanter Zug}
translate D DubiousMove {Zweifelhafter Zug}
translate D WhiteDecisiveAdvantage {Wei hat Vorteil}
translate D BlackDecisiveAdvantage {Schwarz hat Vorteil}
translate D WhiteClearAdvantage {Wei hat klaren Vorteil}
translate D BlackClearAdvantage {Schwarz hat klaren Vorteil}
translate D WhiteSlightAdvantage {Wei hat leichten Vorteil}
translate D BlackSlightAdvantage {Schwarz hat leichten Vorteil}
translate D Equality {Gleiche Chancen}
translate D Unclear {Unklar}
translate D Diagram {Diagramm}

# Board search:
translate D BoardSearch {Brettsuchen}
translate D FilterOperation {Durchfhrung am aktuellen Filter:}
translate D FilterAnd {UND (Beschrnke Filter)}
translate D FilterOr {ODER (Zum Filter hinzufgen)}
translate D FilterIgnore {IGNORIERE (Filter zurcksetzen)}
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 {Zutreffend fr mindestens}
translate D HalfMoves {Halbzge}

# Common endings in material search:
translate D EndingPawns {Bauernendspiele}
translate D EndingRookVsPawns {Turm gegen Bauer(n)}
translate D EndingRookPawnVsRook {Turm und 1 Bauer gegen Turm}
translate D EndingRookPawnsVsRook {Turm und Bauer(n) gegen Turm}
translate D EndingRooks {Turm gegen Turm}
translate D EndingRooksPassedA {Turm gegen Turm mit Freibauer}
translate D EndingRooksDouble {Doppelturm-Endspiele}
translate D EndingBishops {Lufer gegen Lufer}
translate D EndingBishopVsKnight {Lufer gegen Springer}
translate D EndingKnights {Springer gegen Springer}
translate D EndingQueens {Dame gegen Dame} ;# *** Damenendspiele !?
translate D EndingQueenPawnVsQueen {Dame und 1 Bauer gegen Dame}
translate D BishopPairVsKnightPair {Zwei Lufer gegen zwei Springer im Mittelspiel}

# Common patterns in material search:
translate D PatternWhiteIQP {Weier isolierter Damenbauer}
translate D PatternWhiteIQPBreakE6 {Weier Isolani: Durchbruch d4-d5 gegen e6}
translate D PatternWhiteIQPBreakC6 {Weier Isolani: Durchbruch d4-d5 gegen c6}
translate D PatternBlackIQP {Schwarzer isolierter Damenbauer}
translate D PatternWhiteBlackIQP {Weier gegen schwarzer Damenbauerisolani}
translate D PatternCoupleC3D4 {Isoliertes Bauernpaar c3+d4}
translate D PatternHangingC5D5 {Hngende Bauern c5 und d5 von Schwarz}
translate D PatternMaroczy {Maroczy-Zentrum (mit Bauern auf c4 und e4)}
translate D PatternRookSacC3 {Turmopfer auf c3}
translate D PatternKc1Kg8 {0-0-0 gegen 0-0 (Kc1 gegen Kg8)}
translate D PatternKg1Kc8 {0-0 gegen 0-0-0 (Kg1 gegen Kc8)}
translate D PatternLightFian {Weifeldrige Fianchettos (Lufer g2 gegen Lufer b7)}
translate D PatternDarkFian {Schwarzfeldrige Fianchettos (Lufer b2 gegen Lufer g7)}
translate D PatternFourFian {Beiderseitiges Doppelfianchetto (Lufer auf b2,g2,b7,g7)}

# 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 EnPassantFile {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 Option "Fragen vor Ersetzen"
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-Klassifikationsergebnisse 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 {Erffnungsbericht}
translate D OprepReport {Bericht}
translate D OprepGenerated {Erzeugt durch}
translate D OprepStatsHist {Statistiken und Geschichte}
translate D OprepStats {Statistiken}
translate D OprepStatAll {Alle Berichtspartien}
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 {Eine 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 OprepMostFrequentOpponents {Hufigste Gegner}
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 {Ergebnistrend}
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 Berichtsposition}
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 Berichtsposition}
translate D OprepMostFrequentEcoCodes {Hufigste ECO-Codes}
translate D OprepThemes {Themen}
translate D OprepThemeDescription {Hufigkeit der Themen in den ersten %u Zgen jeder Partie}
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 OprepThemeWIQP {Weier isolierter Damenbauer}
translate D OprepThemeBIQP {Schwarzer 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 {Berichtspartien}
translate D OprepAllGames {Alle Partien}
translate D OprepEndClass {Materialklassifikation von Endspielstellungen}
translate D OprepTheoryTable {Theorietabelle}
translate D OprepTableComment {Erzeugt aus %u Partien mit hchster ELO-Zahl.}
translate D OprepExtraMoves {Zustzliche Zge in Anmerkungen zur Theorietabelle}
translate D OprepMaxGames {Maximum an Partien in Theorietabelle}
translate D OprepViewHTML {Zeige HTML}
translate D OprepViewLaTeX {Zeige LaTeX}

# Player Report:
translate D PReportTitle {Spielerbericht}
translate D PReportColorWhite {mit den weien Steinen}
translate D PReportColorBlack {mit den schwarzen Steinen}
translate D PReportMoves {nach %s}
translate D PReportOpenings {Erffnungen}
translate D PReportClipbase {Leere Zwischenablage und kopiere gefundene Spiele}

# 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 das Finden 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 setzen?}
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-klassifizieren}
translate D ClassifyAll {Alle Spiele (berschreibe alte ECO-Codes)}
translate D ClassifyYear {Alle Spiele  aus dem letzten 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-/Pfeilemarkierzeichen aus den Kommentaren entfernen?}

# Goto game/move dialogs:
translate D LoadGameNumber {Geben Sie die zu ladende Spielnr. ein:}
translate D GotoMoveNumber {Gehe zu Zugnr.:}

# Copy games dialog:
translate D CopyGames {Kopiere Spiele}
translate D CopyConfirm {
 Mchten sie wirklich die [::utils::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 {Ausgewhlte Felder}
translate D SuggestedSquares {Zugvorschlagsfelder}
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 {Neuerungensuche 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.
}

# Sounds configuration:
translate D SoundsFolder {Sounddateien-Verzeichnis}
translate D SoundsFolderHelp {Das Verzeichnis sollte enthalten: King.wav, a.wav, 1.wav etc.}
translate D SoundsAnnounceOptions {Optionen fr Zugankndigung}
	# *** Ist das so gemeint? Ich kann's nicht ausprobieren (keine Soundkarte...).
translate D SoundsAnnounceNew {Kndige neue Zge an, wenn sie ausgefhrt werden}
translate D SoundsAnnounceForward {Knde Zug an beim Vorwrtspielen}
translate D SoundsAnnounceBack {Kndige Zug an beim Zurckgehen}

# 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 im neuen Format ffnen?
}
translate D ConfirmUpgrade {
Dies ist eine Datenbank im alten (Scid 2.x) Format. Vor der Verwendung in
Scid 3 mu eine Version im neuen Format der Datenbank erstellt werden.

Beim Erstellen der neuen Version der Datenbank bleiben die Dateien der alten Version erhalten.

Dieser Vorgang kann eine Zeitlang dauern, mu 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 {Anzahl der aktuellen Dateien im Dateimen}
translate D RecentFilesExtra {Anzahl der aktuellen Dateien im zustzlichen Untermen}

# My Player Names options:
translate D MyPlayerNamesDescription {
Geben Sie unten eine Liste der bevorzugten Spielernamen ein, ein Name pro Zeile. Platzhalterzeichen (z.B. "?" fr ein beliebiges einzelnes Zeichen, "*" fr jede beliebige Folge von Zeichen) sind erlaubt.

Jedesmal, wenn ein Spiel mit einem aufgelisteten Spielernamen geladen wird, wird das Schachbrett im Hauptfenster erforderlichenfalls gedreht, um das Spiel aus der Sicht des betreffenden Spielers zu zeigen.
}

}

##########
#
# ECO Opening name translations:

translateECO D {
  Accelerated {, Beschleunigt}
  {: Accelerated} Beschleunigt
  Accepted {, Angenommen}
  {: Accepted} Angenommen
  Advance Vorsto
  {as Black} {mit Schwarz}
  Attack Angriff
  Bishop Lufer
  Bishop's Lufer
  Classical Klassisch
  Closed Geschlossen
  {Closed System} {Geschlossenes System}
  Counterattack Gegenangriff
  Countergambit Gegengambit
  Declined {, Abgelehnt}
  Defence Verteidigung
  deferred verzgert
  Deferred {, verzgert}
  Early Frhe
  Exchange Abtausch
  Game Partie
  Improved verbessert
  King's Knigs
  Knight Springer
  Line Variante
  {Main Line} Hauptvariante
  Open Offen
  Opening Erffnung
  Queen's Damen
  Queenswap Damentausch
  Symmetrical Symmetrisch
  Variation Variante
  Wing Flgel
  with mit
  without ohne

  Alekhine Aljechin
  Averbakh Awerbach
  Botvinnik Botwinnik
  Chigorin Tschigorin
  Polugaevsky Polugajewski
  Rauzer Rauser
  Sveshnikov Sweschnikow

  Austrian sterreichisch
  Berlin Berliner
  Bremen Bremer
  Catalan Katalanisch
  Czech Tschechisch
  Dutch Hollndisch
  English Englisch
  French Franzsisch
  Hungarian Ungarisch
  Indian Indisch
  Italian Italienisch
  Latvian Lettisch
  Meran Meraner
  Moscow Moskau
  Polish Polnisch
  Prague Prager
  Russian Russisch
  Scandinavian Skandinavisch
  Scheveningen Scheveninger
  Scotch Schottisch
  Sicilian Sizilianisch
  Slav Slawisch
  Spanish Spanisch
  Swedish Schwedisch
  Swiss Schweizer
  Vienna Wiener
  Yugoslav Jugoslawisch

  {Accelerated Fianchetto} {Beschleunigtes Fianchetto}
  {Accelerated Pterodactyl} {Beschleunigter Pterodactylus}
  {Alekhine Defence} Aljechin-Verteidigung
  {Alekhine Variation} Aljechin-Variante
  {Alekhine: Smisch Attack} {Aljechin: Wiener System (Smisch-Angriff)}
  {Anderssen Opening} Anderssen-Erffnung
  {Anti-King's Indian} Anti-Knigsindisch
  {Austrian Attack} {sterreichischer Angriff}
  {Benko Gambit} Wolga-Gambit
  {Benko Opening} Benk-Erffnung
  {Berlin Defence} {Berliner Verteidigung}
  Chameleon Chamleon
  Chelyabinsk Tscheljabinsk
  {Classical Defence} {Klassische Verteidigung}
  {Spanish: Classical Defence} {Spanisch: Klassische (Cordel-) Verteidigung}
  {Classical Exchange} {Klassischer Abtausch}
  {Classical Variation} {Klassische Variante}
  {Closed Berlin} {Geschlossener Berliner}
  {Open Berlin} {Offener Berliner}
  {Bird's,} {Bird,}
  {Bird's Defence} Bird-Verteidigung
  {Bird's Deferred} {Verzgerte Bird}
  {Bishop's Opening} Luferspiel
  {Botvinnik System} Botwinnik-System
  {Central Variation} Zentralvariante
  {Centre Attack} Zentrumsangriff
  {Centre Game} Mittelgambit
  {Danish Gambit} {Nordisches Gambit}
  Dragon Drachen
  {Dutch Variation} {Hollndische Variante}
  {Early Exchange} {Frher Abtausch}
  {Early Queenswap} {Frher Damentausch}
  {English Attack} {Englischer Angriff}
  {English: King's} {Englisch: Knigsbauer}
  {English Variation} {Englische Variante}
  {Englund Gambit} Englund-Gambit
  {Exchange Variation} Abtauschvariante
  {Fianchetto Variation} Fianchettovariante
  {Flohr Variation} Flohr-Variante
  {Four Knights} Vierspringer
  {Four Knights Game} Vierspringerspiel
  {Four Pawns} Vierbauern
  {Four Pawns Attack} Vierbauernangriff
  {French Variation} {Franzsische Variante}
  {From Gambit} {Froms Gambit}
  {Goring Gambit} {Gring-Gambit}
  {Grob Gambit} {Grobs Gambit}
  {Hungarian Defence} {Ungarische Verteidigung}
  {Indian Variation} {Indische Variante}
  {Italian Game} {Italienische Partie}
  KGD {Abgel. Knigsgambit}
  {Classical KGD} {Klassisches abgelehntes Knigsgambit}
  {Keres Variation} Keres-Variante
  KGA {Angen. Knigsgambit}
  {KGA: Bishop's Gambit} Knigslufergambit
  {KGA: King's Knight Gambit} Knigsspringergambit
  {King's Gambit} Knigsgambit
  {King's Gambit Accepted} {Angen. Knigsgambit}
  {King's Gambit Accepted (KGA)} {Angen. Knigsgambit}
  {King's Indian} Knigsindisch
  KIA {Knigsindischer Angriff}
  {King's Knight Gambit} Knigsspringergambit
  {King's Pawn} Knigsbauer
  {Lasker Variation} {Lasker-Variante}
  {Latvian Gambit} {Lettisches Gambit}
  {Maroczy Bind} {Maroczy-Aufbau}
  {Marshall Variation} Marshall-Variante
  {Modern Attack} {Moderner Angriff}
  {Modern Steinitz} {Moderne Steinitz}
  {Modern Variation} {Moderne Variante}
  {Moscow Variation} {Moskauer Variante}
  Nimzo-Indian Nimzoindisch
  {Old Benoni} {Klassisches Benoni}
  {Old Indian} Altindisch
  {Old Indian Attack} {Altindisch i.A.}
  {Old Steinitz} Steinitz-Verteidigung
  {Open Game} {Offene Partie}
  {Poisoned Pawn} {Vergifteter Bauer}
  {Polish Variation} {Polnische Variante}
  {Polugaevsky Variation} {Polugajewski-Variante}
  {Queen's Gambit} Damengambit
  {Queen's Gambit Accepted} {Angen. Damengambit}
  QGA {Angen. Damengambit}
  {Queen's Gambit Accepted (QGA)} {Angenommenes Damengambit}
  {Reversed QGA} {Angen. Damengambit i.A.}
  QGD {Abgel. Damengambit}
  {Queen's Gambit Declined (QGD)} {Abgelehntes Damengambit}
  {Reversed QGD} {Abgel. Damengambit i.A.}
  {Queen's Indian} Damenindisch
  {Queen's Pawn} Damenbauer
  {Queen's Pawn Game} Damenbauerspiel
  {Reversed Slav} {Slawisch i.A.}
  {Rubinstein Variation} Rubinstein-Variante
  {Russian Game} {Russische Partie}
  {Russian Game (Petroff Defence)} {Russische Partie}
  {Russian-Three Knights Game} {Russisches Dreispringerspiel}
  {Scandinavian (Centre Counter)} Skandinavisch
  Schliemann Jnisch
  {Schliemann (Jnisch)} {Jnisch-Gambit (Schliemann)}
  {Scotch Opening} {Schottische Erffnung}
  {Sicilian Defence} {Sizilianische Verteidigung}
  {Sicilian Variation} {Sizilianische Variante}
  {Slav Defence} {Slawische Verteidigung}
  Smith-Morra Morra
  {Smith-Morra Accepted} {Angenommenes Morra-Gambit}
  {Smith-Morra Gambit} Morra-Gambit
  {Spanish (Ruy Lopez)} {Spanische Partie}
  {Start position} Ausgangsstellung
  {Steinitz Deferred} Rubinstein-Aufbau
  {Swedish Variation} {Schwedische Variante}
  {Swiss Variation} {Schweizer Variante}
  {Tarrasch's Gambit} {Tarrasch-Gambit}
  {Three Knights} Dreispringer
  {3 Knights} Dreispringer
  {Three Knights Game} Dreispringerspiel
  {Three Pawns Attack} Dreibauernangriff
  {Two Knights} Zweispringer
  {Two Knights Defence} Zweispringer-Verteidigung
  {Two Knights Variation} Zweispringer-Variante
  {Two Pawns} Zweibauern
  {Two Pawns Attack} Zweibauernangriff
  {Wing Gambit} Flgel-Gambit
  {Yugoslav Attack} {Jugoslawischer Angriff}
}


############################################################
#
# German help pages:


##########
# Contents
#
set helpTitle(D,Contents) "Inhaltsverzeichnis"
set helpText(D,Contents) {<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></li>
<li><a Moves><b>Zge</b> eingeben</a> <red>(Aktualisiert!)</red></li>
<li><a Searches><b>Suchen</b> in Scid</a></li>
<li><a Clipbase>Die <b>Ablage</b>-Datenbank</a></li>
<li><a Annotating>Partien <b>kommentieren</b></a> <red>(Neu!)</red></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 Reports><b>Berichte</b></a> <red>(Aktualisiert!)</red></li>
<li><a Email><b>E-Mail</b>-Schach-Manager</a></li>
<li><a PTracker><b>Figurenverteilung</b></a></li>
<li><a Comment><b>Kommentareditor</b></a></li>
<li><a Crosstable><b>Kreuztabellen</b>-Fenster</a></li>
<li><a GameList><b>Partieliste</b>-Fenster</a></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 PList><b>Spielerfinder</b></a> <red>(Neu!)</red></li>
<li><a PInfo><b>Spieler-Information</b></a></li>
<li><a Tmt><b>Turnierfinder</b></a></li>
<li><a Tree><b>Zugbaum</b>-Fenster</a></red></li>
<li><a Graphs><b>Grafik</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> <red>(Aktualisiert!)</red></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> <red>(Aktualisiert!)</red></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.5, Dezember 2003)</footer></p>
}


###############
### Topic Index

set helpTitle(D,Index) "Hilfe-Index"
set helpText(D,Index) {<h1>Scid: Hilfe-Index</h1>

<h3>A</h3>
<ul>
<li><a Clipbase>Ablage-Datenbank</a></li>
<li><a Analysis List>Analyse-Engines, Liste der</a></li>
<li><a Analysis>Analysefenster</a></li>
<li><a MainWindow Autoplay>Automatisches Vorspielen</a></li>
<li><a Author>Autor, Kontaktaufnahme</a></li>
</ul>

<h3>B</h3>
<ul>
<li><a Menus Edit>Bearbeiten-Men</a></li>
<li><a Maintenance Cleaner>Bereiniger</a></li>
<li><a Tree Best>Beste Partien</a></li>
<li><a Graphs Rating>Bewertungsgraph</a></li>
<li><a GameList Browsing>Blttern in Partien</a></li>
<li><a Searches Board>Brettsuche</a></li>
</ul>

<h3>D</h3>
<ul>
<li><a Finder>Dateifinder</a></li>
<li><a Formats>Dateiformate</a></li>
<li><a Menus File>Datei-Men</a></li>
<li><a Formats>Datenbank-Dateiformate</a></li>
<li><a Compact>Datenbank-Komprimierung</a></li>
<li><a Sorting>Datenbank sortieren</a></li>
<li><a Switcher>Datenbank-Umschalter</a></li>
<li><a Maintenance>Datenbank-Wartung</a></li>
<li><a Maintenance Twins>Dubletten (doppelte Partien)</a></li>
</ul>

<h3>E</h3>
<ul>
<li><a ECO Browser>ECO-Auswertung</a></li>
<li><a ECO Codes>ECO-Codesystem</a></li>
<li><a ECO>ECO-Erffnungsklassifikation</a></li>
<li><a Email>E-Mail</a></li>
<li><a TB>Endspieltabellen</a></li>
<li><a EPD>EPD-Dateien</a></li>
<li><a Reports Opening>Erffnungsbericht</a></li>
<li><a ECO>Erffnungsklassifizierung (ECO)</a></li>
<li><a Repertoire>Erffnungsrepertoire</a></li>
<li><a Export>Exportieren, Partien in Textdateien</a></li>
</ul>

<h3>F</h3>
<ul>
<li><a Menus Windows>Fenster-Men</a></li>
<li><a PTracker>Figurenverteilungs-Fenster</a></li>
<li><a Searches Filter>Filter</a></li>
<li><a Export>Filter, exportieren</a></li>
<li><a Graphs Filter>Filtergrafik</a></li>
</ul>

<h3>G</h3>
<ul>
<li><a Graphs>Grafikfenster</a></li>
</ul>

<h3>H</h3>
<ul>
<li><a MainWindow>Hauptfenster</a></li>
<li><a Menus Help>Hilfe-Men</a></li>
<li><a Hints>Hinweise</a></li>
</ul>

<h3>I</h3>
<ul>
<li><a Import>Importieren</a></li>
<li><a Contents>Inhaltsverzeichnis</a></li>
</ul>

<h3>K</h3>
<ul>
<li><a Cmdline>Kommandozeilen-Optionen</a></li>
<li><a Comment>Kommentareditor</a></li>
<li><a NAGs>Kommentarzeichen</a></li>
<li><a Annotating>Kommentieren</a></li>
<li><a Compact>Komprimieren (Datenbank)</a></li>
<li><a Author>Kontaktinformation</a></li>
<li><a Crosstable>Kreuztabellen</a></li>
<li><a Guide>Kurzanleitung fr Scid</a></li>
</ul>

<h3>L</h3>
<ul>
<li><a LaTeX>LaTeX</a>-Ausgabeformat</li>
<li><a Bookmarks>Lesezeichen</a></li>
<li><a Maintenance Twins>Lschen, Dubletten</a></li>
</ul>

<h3>M</h3>
<ul>
<li><a Flags>Markierungen</a></li>
<li><a Searches Material>Material-/Muster-Suche</a></li>
<li><a Menus>Mens</a></li>
</ul>

<h3>N</h3>
<ul>
<li><a NAGs>NAG-Kommentarwerte</a></li>
<li><a Maintenance Editing>Namen bearbeiten</a></li>
<li><a Maintenance Spellcheck>Namen, Schreibweisen</a></li>
<li><a Annotating Null>Nullzge</a></li>
</ul>

<h3>O</h3>
<ul>
<li><a Options>Optionen</a></li>
</ul>

<h3>P</h3>
<ul>
<li><a Searches Header>Partiedaten-Suche</a></li>
<li><a GameList>Partielisten</a></li>
<li><a Flags>Partie-Markierungen</a></li>
<li><a Menus Game>Partie-Men</a></li>
<li><a PGN>PGN-Fenster</a></li>
<li><a Pgnscid>Pgnscid</a></li>
</ul>

<h3>R</h3>
<ul>
<li><a Repertoire>Repertoire-Editor</a></li>
</ul>

<h3>S</h3>
<ul>
<li><a Moves>Schachzge eingeben</a></li>
<li><a Maintenance Spellcheck>Schreibkorrektur von Namen</a></li>
<li><a Sorting>Sortieren einer Datenbank</a></li>
<li><a Reports Player>Spielerbericht</a></li>
<li><a PInfo>Spielerinformation</a></li>
<li><a PList>Spielersuche</a></li>
<li><a Searches>Suchen</a></li>
<li><a Menus Search>Suchen-Men</a></li>
<li><a Searches Filter>Such-Filter</a></li>
</ul>

<h3>T</h3>
<ul>
<li><a Moves Trial>Testmodus</a></li>
<li><a Tmt>Turnierfinder</a></li>
</ul>

<h3>V</h3>
<ul>
<li><a Annotating Vars>Varianten</a></li>
</ul>

<h3>W</h3>
<ul>
<li><a Maintenance>Wartung</a></li>
<li><a Menus Tools>Werkzeug-Men</a></li>
</ul>

<h3>Z</h3>
<ul>
<li><a Options Fonts>Zeichenstze</a></li>
<li><a Tree>Zugbaumfenster</a></li>
<li><a Moves>Zge eingeben</a></li>
<li><a GameList Browsing>Zusammenfhren, Partien</a></li>
</ul>

<p><footer>(Updated: Scid 3.5, February 2003)</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 grafischen
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 lesen Sie bitte die anderen
Hilfe-Seiten, die im <a Index>Index</a> aufgefhrt sind.
</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-Index</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-Erffnungsschlssel der aktuellen Position
ermitteln?</h4>
<p>
Der ECO-Schlssel wird in der letzten Zeile des Informationsbereichs
angezeigt, unterhalb des Schachbretts im <a MainWindow>Hauptfenster</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-Umschalterfenster</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 Partielistenfenster?</h4>
<p>
Klicken Sie die jeweilige Spaltenberschrift mit der linken oder
rechten Maustaste an und whlen Sie <b>Konfigurieren</b>.
</p>

<h4>Wie kann ich das Zugbaumfenster 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 Zugbaumfenster
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 Gromeisterpartien. Wie kann ich eine
meiner Partien mit denen in der groen Datenbank vergleichen?</h4>
<p>
ffnen Sie das <a Tree>Zugbaumfenster</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>Analysefenster</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>Analysefenster</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 Indexdatei; 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>Dateifinder</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>Wartungsfenster</menu>: ffnet/schliet das
      Datenbank-Wartungsfenster.</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><name Edit>Bearbeiten</name></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><name Game>Partie</name></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><name Search>Suchen</name></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 Suchoptionsdatei</menu>: Sucht mit Hilfe von
    <a Searches Settings>Einstellungen</a> aus einer Suchoptionsdatei.</li>
</ul>

<h3><name Windows>Fenster</name></h3>
<ul>
<li><menu>Kommentareditor</menu>: ffnet/schliet das
    <a Comment>Kommentareditor</a>-Fenster.</li>
<li><menu>Partieliste</menu>: ffnet/schliet das
    <a GameList>Partielistenfenster</a>.</li>
<li><menu>PGN-Fenster</menu>: ffnet/schliet das
    <a PGN>PGN-Fenster</a>.</li>
<li><menu>Turnierfinder</menu>: ffnet/schliet den
    <a Tmt>Turnierfinder</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-Statistikfenster</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>Zugbaumfenster</a>.</li>
<li><menu>Endspieltabellen</menu>: ffnet/schliet das Fenster, das
    die <a TB>Endspieltabellen</a>-Informationen ausgibt.</li>
</ul>

<h3><name Tools>Werkzeuge</name></h3>
<ul>
<li><menu>Analyse-Engine</menu>: Startet/beendet die "Schachanalyse-Engine",
    die die Auswertung der aktuellen Position
    im <a Analysis>Analysefenster</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>Erffnungsbericht</menu>: Erstellt einen <a Reports Opening>Erffnungsbericht</a>
    zur aktuellen Position.</li>
<li><menu>Figurenverteilung</menu>: ffnet das Fenster <a PTracker>Figurenverteilung</a>.
    </li>
<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 Textdatei 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>Importfenster</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><name Options>Optionen</name></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 Startfenster, welches Informationen
ber die Dateien liefert, die Scid beim Programmstart geladen hat.
</p>

<p><footer>(Aktualisiert: Scid 3.5, Februar 2003)</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>

<h3><name Null>Nullzge eingeben</name></h3>
<p>
<a Annotating Null>Null</a>- (leere) Zge knnen in Varianten ntzlich
sein, wenn Sie den Zug einer Seite auslassen wollen. Sie knnen einen
Nullzug mit der Maus eingeben, indem Sie einen Knig mit dem anderen
schlagen, oder mit der Tastatur, indem Sie "<b>--</b>" eingeben (d.h.
die Minustaste zweimal drcken).
</p>

<h3>Standard-Kommentarzeichen eingeben</h3>
<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 3.4, Juli 2002)</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>Suchen: Partiedaten</name></h3>
<p>
Mit dieser Suche knnen Sie Partiedaten finden, die im Vorspann ("Header")
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 Suchoptionsdatei (.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>Zugbaumfenster</a> das Erffnungsrepertoire 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>
}


#################################
### Variations and comments help:

set helpTitle(D,Annotating) "Partien kommentieren"
set helpText(D,Annotating) {<h1>Partien kommentieren</h1>
<p>
Mit Scid knnen Sie den Partien Anmerkungen hinzufgen. Es gibt
drei Arten von Anmerkungen, die Sie nach einem Zug eingeben knnen:
Symbole, ein Kommentar und Varianten.
</p>

<h3>Symbole und Kommentare</h3>
<p>
Symbole verwendet man, um eine Stellungsbeurteilung anzuzeigen
(etwa "+-" or "=") oder um auf gute ("!") und schlechte ("?")
Zge hinzuweisen, whrend ein Kommentar ein beliebiger Text sein
kann. Zur Eingabe von Symbolen und Kommentaren benutzen Sie den
<a Comment>Kommentar-Editor</a>. Es gibt auch eine Hilfeseite, in
der die <a NAGs>Standard-Symbolwerte</a> aufgelistet sind.
</p>
<p>
Beachten Sie, da jeder Zug mehr als ein Anmerkungssymbol haben kann,
aber nur einen Kommentar. Ein Kommentar vor dem ersten Partiezug wird
als Text vor dem Beginn der Partie ausgegeben.
</p>

<h3><name Vars>Varianten</name></h3>
<p>
Eine <term>Variante</term> eines Zuges ist eine alternative Zugfolge
an einem bestimmten Punkt der Partie. Varianten knnen Kommentare
enthalten und sogar rekursiv Untervarianten. Mit den Schaltern oberhalb
des Schachbretts mit einem "<b>V</b>"-Symbol sowie den Kommandos im
Men <menu>Bearbeiten</menu> kann man Varianten erstellen, editieren
und sich darin bewegen.
</p>

<h4>Tastatureingaben</h4>
<p>
Wenn es zu einem Zug Varianten gibt, werden sie im Informationsbereich
angezeigt. Die erste wird mit <b>v1</b> bezeichnet, die zweite mit
<b>v2</b> etc. Um in eine Variante zu gehen, knnen Sie sie anklicken
oder "<b>v</b>" gefolgt von der Variantennummer eingeben. (Falls es
nur eine Variante gibt, gengt die Eingabe von <b>v</b>.)
Mit der Taste "<b>z</b>" verlassen Sie die Variante wieder.
</p>

<h3><name Null>Nullzge</name></h3>
<p>
Gelegentlich kann es in einer Variante ntzlich sein, den Zug einer
Seite auszulassen. Beispiel: Sie wollen den Zug 14.Ld3 als Variante
hinzufgen und mchten darauf hinweisen, da er 15.Lxh7+ Kxh7 16.Sg5+
mit Angriff droht. Das knnen Sie erreichen, indem Sie im obigen
Beispiel einen <term>Nullzug</term> zwischen 14.Ld3 und 15.Bxh7+
ausfhren. Ein Nullzug wird als "<b>--</b>" dargestellt und kann
eingefgt werden, indem Sie mit der Maus den illegalen Zug "Knig
schlgt Knig" ausfhren oder mit der Tastatur "<b>--</b>" (zwei
Minuszeichen) eingeben.
</p>
<p>
Beachten Sie, da Nullzge nicht zum PGN-Standard gehren, wenn Sie
also Partien mit Nullzgen in eine PGN-Datei exportieren, wird Scid
(neben einigen anderen Exportoptionen) eine Option anbieten,
Nullzge zu erhalten oder sie in Kommentare umzuwandeln, damit
Kompatibilitt zu anderen Programmen gewahrt bleibt.
Siehe auch die <a Export>Export</a>-Hilfeseite.
</p>

<p><footer>(Aktualisiert: Scid 3.4, Juli 2002)</footer></p>
}


####################
### Analysis window:

set helpTitle(D,Analysis) "Analysefenster"
set helpText(D,Analysis) {<h1>Das Analysefenster</h1>
<p>
Scids Analysefenster 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 im Analysefenster erfolgt 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 Problemen beim Start einer Engine ist die Wahl
des Verzeichnisses, in dem die Engine laufen soll. Einige Engines
bentigen eine Initialisierung oder eine Erffnungsbuchdatei 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 Analysefenster 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>Das Analysebrett</h3>
<p>
Anklicken des Schachbrett-Icons in einem Analysefenster zeigt oder
versteckt das Analysebrett, welches die Position nach der aktuell
besten Variante der Engine zeigt. Das funktioniert fr die meisten
Scid-kompatiblen Engines, aber nicht unbedingt fr alle; es hngt
ganz davon ab, welche Zugnotation eine Engine verwendet.
</p>

<h3>Engine-Prioritt</h3>
<p>
Falls eine Engine zu viel CPU-Zeit verbraucht und die Benutzung von
Scid oder anderen Applikationen beeintrchtigt, kann das Einschalten
der Checkbox <b>Niedrige CPU-Prioritt</b> helfen; es weist der
Engine eine geringe Prioritt frs Proze-Scheduling zu.
</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> zur 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.4, September 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 Kreuztabellenfenster</h1>
<p>
Das Kreuztabellenfenster zeigt die Turnierkreuztabelle zur aktuellen
Partie. Jedesmal, wenn sie das Fenster aktualisieren (indem Sie den
"Aktualisieren"-Schalter anklicken, im Kreuztabellenfenster 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 Kreuztabellenfensters zum
<a Searches Filter>Filter</a> hinzufgen.
</p>

<h4>Mens des Kreuztabellenfensters</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 Dateifinderfenster</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
Repertoiredateien 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 Partielistenfenster</h1>
<p>
Das Partielistenfenster 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 Partielistenfensters 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 Reports Opening>Erffnungsbericht</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) "Importfenster"
set helpText(D,Import) {<h1>Das Importfenster</h1>
<p>
Scids Importfenster 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 Importfenster bearbeiten</h3>
<p>
Das Importfenster bietet auch eine weitere, bequeme Mglichkeit fr
nderungen an der aktuellen Partie: Sie knnen die aktuelle Partie in
das Importfenster einfgen (mit dem Schalter <b>Aktuelle Partie
einfgen</b>), den Text editieren und danach auf <b>Import</b> klicken.
</p>

<h3>PGN-Tags im Importfenster</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>
}


########################
### Reports help:

set helpTitle(D,Reports) "Berichte"
set helpText(D,Reports) {<h1>Berichte</h1>
<p>
Bei Scid ist ein <term>Bericht</term> ein Dokument, das Informationen ber
eine bestimmte Position und/oder einen bestimmten Spieler enthlt. Scid
kann zwei Berichtstypen erstellen: Erffnungsberichte und Spielerberichte.
</p>

<h3><name Opening>Erffnungsberichte</name></h3>
<p>
Scid kann einen <term>Erffnungsbericht</term> erstellen, der interessante
Informationen ber die aktuelle Erffnungsposition ausgibt. Um den
Erffnungsbericht zu erstellen, vergewissern Sie sich als erstes, da die
dargestellte Position auch die ist, fr die Sie den Bericht haben wollen,
dann whlen Sie <b>Erffnungsbericht</b> im Men <menu>Werkzeuge</menu>.
</p>
<p>
Das <term>Erffnungsberichts</term>-Fenster gibt die Ergebnisse des von
Scid erstellten Berichts aus. Das <b>Datei</b>-Men enthlt Optionen,
um den Bericht 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 Abschnitt ber positionelle Themen informiert ber die Hufigkeit
bestimmter typischer Themen der Berichtspartien. Zu diesem Zweck werden
die ersten 20 Zge (also die ersten 40 Positionen ab Ausgangsstellung)
jeder Partie untersucht. Um als eine Partie eingestuft zu werden, die
ein bestimmtes Thema enthlt, mu dieses Thema mindestens viermal
innerhalb der ersten 20 Zge der Partie vorkommen. Damit wird vermieden,
da durch kurzzeitiges Auftreten eines Themas (wie etwa ein isolierter
Damenbauer, der sofort geschlagen wird) die Ergebnisse verflscht werden.
</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 Erffnungsberichts-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 Mausklick 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>

<h4>Favoriten</h4>
<p>
Mit dem <menu>Favoriten</menu>-Men des Berichtsfensters haben Sie die
Mglichkeit, eine Liste bevorzugter Erffnungsbericht-Positionen zu
verwalten und sehr einfach Berichte fr genau diese Positionen zu
erstellen. Wenn Sie "Bericht hinzufgen..." im Favoriten-Men
whlen, wird die aktuelle Stellung als besondere Berichtsposition
aufgenommen. Sie werden aufgefordert, einen Namen anzugeben, der dann
als Dateiname verwendet wird, wenn Favoritenberichte erstellt werden.
</p>
<p>
Whlen Sie "Berichte erzeugen..." im Favoriten-Men, um einen Bericht
fr jede Ihrer bevorzugten Positionen aus der aktuellen Datenbank zu
erstellen. In einem Dialogfenster knnen Sie dann Typ und Format der
Berichte angeben sowie ein Verzeichnis, wo die Berichtsdateien
gespeichert werden sollen. Die passende Dateiendung fr das gewhlte
Ausgabeformat wird dann automatisch ergnzt (z.B. ".html" fr das
HTML-Format).
</p>

<h3><name Player>Spielerberichte</name></h3>
<p>
Ein <term>Spielerbericht</term> hnelt sehr stark einem Erffnungsbericht,
enthlt aber Informationen ber Partien eines einzelnen Spielers mit
Wei oder mit Schwarz. Sie knnen einen Spielerbericht ber das
Werkzeuge-Men oder aus dem <a PInfo>Spielerinformations</a>-Fenster
heraus erzeugen.
</p>
<p>
Ein Spielerbericht kann entweder fr alle Partien eines bestimmten Spielers
mit einer bestimmten Farbe erstellt werden oder nur fr die Partien, die
die aktuelle Stellung des Hauptfenster-Bretts erreicht haben.
</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>

<p><footer>(Aktualisiert: Scid 3.5, Februar 2003)</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 Vorspann ("Header"), 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 Figurenverteilungsfenster</h1>
<p>
Die <term>Figurenverteilung </term> bzw. das Figurenverteilungsfenster
ist ein Werkzeug, um die Bewegungen bestimmter Figuren in allen Partien
des aktuellen Filters nachzuvollziehen und ein Bewegungsmuster (eine
"Fuspur") zu erstellen, 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 Wei-Partien 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 grafische "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 erstellt 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>

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

#####################
### Player List help:

set helpTitle(D,PList) "Spielersuche"
set helpText(D,PList) {<h1>Der Spielerfinder</h1>
<p>
Der <term>Spielerfinder</term> gibt eine Namensliste von Spielern
aus der aktuellen Datenbank aus. Die Auswahl eines Spielers ffnet
das <a PInfo>Spieler-Informations</a>-Fenster mit detaillierteren
Informationen ber diesen Spieler.
</p>
<p>
Es werden 5 Spalten ausgegeben, die jeweils den Namen, die hchste
Elo-Zahl, Anzahl der gespielten Partien sowie das Jahr der
ltesten und neueste Partie anzeigen.
Ein Klick auf eine Spalten-berschrift sortiert die Liste nach
dieser Spalte.
</p>
<p>
Die Kontrollschalter unterhalb der Liste ermglichen Ihnen, den
Inhalt der Liste zu filtern. Sie knnen die maximale Listengre
ndern, einen Spielernamen-Anfang eingeben (Gro-/Kleinschreibung
wird ignoriert, z.B. sucht "ada" nach "Adams") sowie den
Elozahlen-Bereich oder die Anzahl der gespielten Partien eingrenzen.
</p>

<p><footer>(Aktualisiert: Scid 3.4, August 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 grafisch 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 Repertoiredatei 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>Repertoire-Gruppen 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>weitestverzweigte</i> Repertoire-Position 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) "Turnierfinder"
set helpText(D,Tmt) {<h1>Der Turnierfinder</h1>
<p>
Der <term>Turnierfinder</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.
Wenn Sie statt dessen die rechte Maustaste drcken, wird die Partie
geladen und das Kreuztabellenfenster geffnet, auch wenn es vorher
geschlossen war.
</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 Zugbaumfenster</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 Zugbaumfenster 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 Zugbaumfenster
fgt diesen Zug der Partie hinzu.
</p>

<h3>Inhalt des Zugbaumfensters</h3>
<p>
Das Zugbaumfenster 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 Zugbaumfenster 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 Zugbaumfenster 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>Zugbaumgrafik</name></h3>
<p>
Das Zugbaumfenster enthlt einen mit <term>Grafik</term> bezeichneten
Schalter, der eine grafische 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 Zugbaumgrafik 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 Zugbaumfenster anbinden</name></h3>
<p>
Mit dem Schalter <term>Anbinden</term> im Zugbaumfenster 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 Zugbaumfenster 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 Zugbaumfenster
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 Zugbaumfenster praktisch sofort aktualisiert
wird, wenn die gesuchte Stellung im Cachespeicher ist.
</p>
<p>
Das Zugbaumfenster 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
Zugbaumfensters 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-Cache-Datei (.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) "Grafikfenster"
set helpText(D,Graphs) {<h1>Grafikfenster</h1>
<p>
Scid hat einige Fenster, die Informationen grafisch darstellen.
Diese werden im nachfolgenden erklrt.
</p>

<h3><name Filter>Filtergrafik</name></h3>
<p>
Das Fenster <term>Filtergrafik</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 Grafik 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 Filtergrafik nach Elo-Zahl ausgegeben wird, verwendet Scid
fr jede Partie die durchschnittliche (mittlere) Wertung. Geschtzte
Elo-Zahlen (wie z.B. aus der Schreibkorrekturdatei) 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>

<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>Zugbaumgrafik</name></h3>
<p>
Das Fenster <term>Zugbaumgrafik</term> ist aus dem Zugbaumfenster
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 Endspieltabellendateien 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 Endspieltabellendateien 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>Partieinformation</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 Endspieltabellenfenster</h3>
<p>
Sie knnen sogar noch mehr Endspieltabellen-Informationen zur aktuellen
Position erhalten, indem Sie das <term>Endspieltabellenfenster</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>
<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>

<h4>Das Ergebnisbrett</h4>
<p>
In einer Endspieltabellenstellung ist es oft ntzlich zu wissen,
wie die Ergebnisse ausshen, wenn alle Steine in ihrer gegenwrtigen
blieben, aber ein bestimmter Stein woanders stnde. Zum Beispiel
wenn Sie feststellen mchten, wie nah ein Knig einem Freibauern sein
mu, um eine bestimmte Stellung zu gewinnen oder Remis zu machen.
In Endspielbchern wird diese Information oft die <i>Gewinnzone</i>
bzw. <i>Remiszone</i> eines Steins in einer bestimmten Stellung
genannt.
</p>
<p>
Mit Hilfe von Scid knnen Sie diese Information erhalten, wenn Sie
den Schalter mit dem Schachbrett anklicken, um das
<term>Ergebnisbrett</term> im Endspieltabellenfenster zu zeigen.
Wenn Sie mit der linken Maustaste irgendeinen Stein auf dem Brett
anklicken, erscheint auf jedem freien Feld ein Symbol mit dem Resultat
der Endspieltabelle, wenn der Stein auf diesem Feld stnde (mit derselben
Seite am Zug wie in der aktuellen Position des Hauptfensters).
</p>
<p>
Ein Feld kann fnf mgliche Symbole haben:
ein weies "<b>#</b>" bedeutet, Wei gewinnt;
ein schwarzes "<b>#</b>" bedeutet, Schwarz gewinnt;
ein blaues "<b>=</b>" bedeutet, die Stellung ist remis;
ein rotes "<b>X</b>" bedeutet, die Position ist illegal (weil die Knige
nebeneinander stehen oder die Seite am Zug Schach bietet); und
ein rotes "<b>?</b>" heit, das Result ist unbekannt, weil die ntige
Endspieltabellendatei nicht zur Verfgung steht.
</p>

<h3>Endspieltabellen-Quellen</h3>
<p>
Zur Hilfe beim Auffinden von Endspieltabellendateien im Internet
siehe die entsprechenden <a Author Related>Links</a>.
</p>

<p><footer>(Aktualisiert: Scid 3.4, September 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 Korrekturdatei 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 Schreibkorrekturdatei 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 Schreibkorrekturdatei 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 Grafik 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 Grafik (oder tippen Sie den
korrespondierenden Buchstaben (bzw. Ziffer) ein). Um auf ein hheres
Niveau zurckzugehen, klicken Sie mit der rechten Maustaste irgendwo
auf die Grafik 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 ::windows::eco::Refresh 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 Analysefenster
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 Zeichen "#" beginnender <a Comment>Kommentar</a>
in der Partie vorkommt.
</p>

<h3><name Null>Nullzge beim PGN-Export</name></h3>
<p>
Scid erlaubt es, in einer Partie <a Annotating Null>Null- (leere)
Zge</a> zu speichern, da diese beim Kommentieren mit Varianten
hilfreich sein knnen. Allerdings gibt es im PGN-Standard keine
Nullzge. Wenn Sie also Scid-Partien mit Nullzgen in eine PGN-Datei
exportieren, werden andere Programme zum PGN-Lesen nicht in der Lage
sein, die Nullzge zu lesen.
</p>
<p>
Um dieses Problem zu lsen, stellt Scid eine weitere Option bereit,
<b>Nullzge in Kommentare umwandeln</b>, wenn Partien in PGN-Format
exportiert werden. Wenn Sie eine PGN-Datei erstellen wollen, die von
anderer Software verwendet werden kann, schalten Sie diese Option ein,
und Varianten, die Nullzge enthalten, werden in Kommentare umgewandelt.
Wenn Sie jedoch eine PGN-Dateie erstellen wollen, die spter wieder
unter Beibehaltung der Nullzge von Scid importiert werden kann,
lassen Sie diese Option aus.
</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 3.4, Juli 2002)</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 Optionendatei gesichert, wenn Sie im Optionen-Men
<b>Optionen speichern</b> whlen.
Jedesmal, wenn Sie Scid starten, wird die Optionendatei geladen.
</p>
<p>
Wenn Sie mit Windows arbeiten, ist die Optionendatei <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 MyPlayerNames>Ihre Spielernamen festlegen</name></h3>
<p>
Es kann sein, da Sie fr einen (oder mehrere) Spieler das Brett im
Haupfenster aus der Sicht dieses Spielers aufgestellt haben mchten,
wenn eine seiner Partien geladen wird. Sie knnen eine Liste solcher
Namen mit <b>Meine Spielernamen...</b> im Men <menu>Optionen/Schachbrett</menu>
anlegen. In dem Dialogfenster geben Sie dann einen Spielernamen pro Zeile
ein. Jokerzeichen ("<b>?</b>" fr genau ein beliebiges Zeichen, "<b>*</b>"
fr eine Zeichenkette von null oder mehr Zeichen) sind erlaubt.
</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 3.5, Februar 2003)</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   Ausgeglichene 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-, Ortsnamen (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 Suchoptionsdatei (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>sgh@users.sourceforge.net</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 Datenbanken 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>Zugbaumfenster</a> nutzen, lohnt es sich,
    <b>Cache-Datei fllen</b> im Dateimen des Zugbaumfensters 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 Reports Opening>Erffnungsbericht</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
    Turniereintrag besitzen und Sie wollen die Partien nach Datum
    sortiert haben, erwgen Sie ein <a Sorting>Sortieren</a> nach
    Turnierdatum 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 Turnierdatum haben).
  }
  {
    Es ist eine gute Idee, vor einem <a Maintenance Twins>Dubletten
    lschen</a> eine <a Maintenance Spellcheck>Schreibkorrektur</a>
    Ihrer Datenbank durchzufhren, da es dies Scid ermglicht, 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 Symbol 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 Zugbaumfenster, um die
    Partie an die erste Datenbank zu binden, und wechseln dann zur
    zweiten Datenbank.
  }
  {
    Der <a Tmt>Turnierfinder</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
    Platzhalterzeichen 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 weitest klassifizierten Position der aktuellen Partie mit
    <b>Erffnung identifizieren</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>Dateifinder</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 Reports Opening>Erffnungsbericht</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 Statistikfenster
    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 {Maintenance de la base}
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 FileSwitch "Changer de base" 0 \
  {Changer vers une base ouverte diffrente}
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 {purer 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 EditStripBegin "Coups depuis le dbut" 1 \
  {purer cette partie des coups depuis le dbut}
menuText F EditStripEnd "Coups jusqu' la fin" 0 \
  {purer cette partie des coups jusqu' la fin}
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText F EditSetup "Position de dpart" 0 \
  {Choisir une position de dpart pour cette partie}
menuText F EditCopyBoard "Copier la position" 6 \
  {Copier la position en cours en notation FEN vers la slection de texte (presse-papier)}
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 numro..." 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 WindowsPList "Chercher un joueur" 2 {Ouvrir/fermer la recherche de joueur}
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 \
  {Ouvrir/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 ToolsPlayerReport "Rapport pour le joueur..." 3 \
  {Gnrer un rapport pour le joueur}
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 OptionsBoard "Chessboard" 0 {Options d'aspect de l'chiquier}
menuText F OptionsBoardSize "Taille chiquier" 0 {Changer la taille de l'chiquier}
menuText F OptionsBoardPieces "Style des pices" 6 {Changer le style des pices}
menuText F OptionsBoardColors "Couleurs..." 0 {Changer les couleurs}
menuText F OptionsBoardNames "Mes noms de joueurs..." 0 {Editer mes noms de joueurs}
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 {Changer la police des menus}
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 OptionsMovesAnimate "Temps d'animation" 1 \
  {Fixe le temps utilis pour l'animation des coups}
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 {Slectionner le format des nombres}
menuText F OptionsStartup "Dmarrage" 3 {Slectionner 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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
menuText F OptionsToolbar "Barre d'outils de la fentre principale" 12 \
  {Montrer/Cacher dans 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 "Fichiers rcents..." 0 \
  {Changer le nombre de fichiers rcents affichs dans le menu Fichier}
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 HelpContents "Contenu" 0 {Montrer la page du contenu de l'aide}
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 GInfoPhotos "Montrer les Photos" 5
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.stm {Afficher/Enlever l'icone du joueur ayant le trait}
helpMsg F .button.autoplay {Jeu automatique  (Raccourci clavier: Ctrl+Z)}

# General buttons:
translate F Back {Retour}
translate F Browse {Parcourir}
translate F Cancel {Annuler}
translate F Clear {Effacer}
translate F Close {Fermer}
translate F Contents {Contenu}
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 ShowIcons {Show Icons} ;# ***
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 {Diffrence de classement ELO (Blancs - Noirs)}
translate F AverageRating {Classement moyen}
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}
translate F readonly {read-only} ;# ***

# Standard error messages:
translate F ErrNotOpen {Ceci n'est pas une base ouverte.}
translate F ErrReadOnly {Cette base est en lecture seule; elle ne peut tre modifie.}
translate F ErrSearchInterrupted {La recherche a t interrompue; les rsultats sont incomplets.}

# 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}
translate F PInfoEditRatings {Editer les Classements}

# 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}
translate F WinningMoves {Coups gagnants}
translate F DrawingMoves {Coups faisant nulle}
translate F LosingMoves {Coups perdants}
translate F UnknownMoves {Coups dont le rsultat est inconnu}

# 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 {Graphique de l'arbre}
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 "Alphabtique" 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 "Entranement" 0 {Dmarrer/Arrter l'arbre du mode d'entranement}
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 {Entranement}
translate F LockTree {Verrouiller}
translate F TreeLocked {verrouill}
translate F TreeBest {Meilleur}
translate F TreeBestGames {Arbre des meilleures parties}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate F TreeTitleRow \
  {    Coup   ECO        Frquence   Score EloMoy Perf AnneMoy %Nulle}
translate F TreeTotal {TOTAL}

# 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}

# Player finder:
menuText F PListFile "Fichier" 0
menuText F PListFileUpdate "Mettre  jour" 0
menuText F PListFileClose "Fermer la recherche de joueur" 0
menuText F PListSort "Trier" 0
menuText F PListSortName "Nom" 0
menuText F PListSortElo "Elo" 0
menuText F PListSortGames "Parties" 0
menuText F PListSortOldest "Les plus vieux" 0
menuText F PListSortNewest "Les plus rcents" 0

# 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}
translate F LowPriority {Priorit au microprocesseur lent}

# 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 PgnFileCopy "Copier la partie dans le Presse-papier" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate F PgnWindowTitle {Game Notation - game %u} ;# ***

# 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 "KO" 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}
translate F Category {Catgorie}

# 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 OprepFavorites "Favoris" 1
menuText F OprepFavoritesAdd "Ajouter au rapport..." 0
menuText F OprepFavoritesEdit "Editer les favoris de rapport..." 0
menuText F OprepFavoritesGenerate "Gnrer les rapports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Description}
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:}
translate F InsertMark {Insre une marque}
translate F InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate F GoodMove {Good move} ;# ***
translate F PoorMove {Poor move} ;# ***
translate F ExcellentMove {Excellent move} ;# ***
translate F Blunder {Gaffe}
translate F InterestingMove {Interesting move} ;# ***
translate F DubiousMove {Dubious move} ;# ***
translate F WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate F BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate F WhiteClearAdvantage {White has a clear advantage} ;# ***
translate F BlackClearAdvantage {Black has a clear advantage} ;# ***
translate F WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate F BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate F Equality {Equality} ;# ***
translate F Unclear {Unclear} ;# ***
translate F Diagram {Diagram} ;# ***

# 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}

# Common endings in material search:
translate F EndingPawns {Pawn endings} ;# ***
translate F EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate F EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate F EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate F EndingRooks {Rook vs. Rook endings} ;# ***
translate F EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate F EndingRooksDouble {Double Rook endings} ;# ***
translate F EndingBishops {Bishop vs. Bishop endings} ;# ***
translate F EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate F EndingKnights {Knight vs. Knight endings} ;# ***
translate F EndingQueens {Queen vs. Queen endings} ;# ***
translate F EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate F BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate F PatternWhiteIQP {White IQP} ;# ***
translate F PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate F PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate F PatternBlackIQP {Black IQP} ;# ***
translate F PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate F PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate F PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate F PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate F PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate F PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate F PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate F PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate F PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate F PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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-initialiser l'chiquier}
translate F SideToMove {Cot qui a le trait}
translate F MoveNumber {Coup numro}
translate F Castling {Roque}
translate F EnPassantFile {Prise en passant}
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 accessible en criture, 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 ici.}

# 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 {Gnr 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 OprepMostFrequentOpponents {Adversaires 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 OprepMostFrequentEcoCodes {Codes ECO les plus frquents}
translate F OprepThemes {Thmes positionnels}
translate F OprepThemeDescription {Frquence des thmes dans les premiers %u coups de chaque partie}
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 OprepThemeWIQP {Pion Dame blanc isol}
translate F OprepThemeBIQP {Pion Dame noir 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}
translate F OprepViewHTML {Voir en HTML}
translate F OprepViewLaTeX {Voir en LaTeX}

# Player Report:
translate F PReportTitle {Rapport du joueur}
translate F PReportColorWhite {avec les Blancs pices}
translate F PReportColorBlack {avec les Noirs pices}
translate F PReportMoves {aprs %s}
translate F PReportOpenings {Ouvertures}
translate F PReportClipbase {Vider le presse-papier et copier dedans toutes les parties qui correspondent}

# 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 pice; 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 efface.
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 effacant 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 anciens 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 [milliers $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 {Pices blanches}
translate F BlackPieces {Pices 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.
}

# Sounds configuration:
translate F SoundsFolder {Sound Files Folder} ;# ***
translate F SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate F SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate F SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate F SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate F SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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 {Nombre de fichiers rcents dans le menu Fichier}
translate F RecentFilesExtra {Nombre de fichiers rcents dans le sous-menu complmentaire}

# My Player Names options:
translate F MyPlayerNamesDescription {
Entrer ci-dessous une liste des noms des joueurs prfrs, un nom par ligne. Les caractres spciaux (i.e. "?" pour un seul caractre, "*" pour n'importe quelle suite de caractres) sont autoriss.

Chaque fois qu'une partie avec un joueur de la liste est charge, l'chiquier de la fentre principale sera tourn si ncessaire de faon  montrer la partie selon le point de vue du joueur.
}

}
# end of francais.tcl
### italian.tcl:
# Italian language support for Scid.
# Added by Giancarlo Bassi.
# Updated by Paolo Montrasi.
# Updated by Michele Rinesi on 19/02/2004.
# 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 FileSwitch "Attiva un database" 0 \
  {Attiva uno fra i database aperti}
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 EditStripBegin "Mosse dall'inizio" 1 \
  {Elimina le mosse dall'inizio della partita}
menuText I EditStripEnd "Mosse rimanenti" 0 \
  {Elimina le mosse rimanenti}
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText I EditSetup "Posizione definita..." 10 \
  {Definisce una posizione per la partita corrente}
menuText I EditCopyBoard "Copia posizione" 6 \
  {Copia la posizione della scacchiera corrente in notazione FEN come testo (clipboard)}
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 del filtro}
menuText I GamePrev "Carica la precedente Partita" 10 {Carica la precedente partita del filtro}
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 del filtro}
menuText I GameRandom "Carica una partica casuale" 8 {Carica una partita casuale del filtro}
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 WindowsPList "Player Finder" 2 {Apre/chiude la finestra Player Finder}
menuText I WindowsTmt "Tournament Finder" 2 {Apre/chiude la finestra 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 \
  {Apre/chiude la finestra Filter Graph}
menuText I ToolsOpReport "Rapporto di Apertura" 0 \
  {Genera un rapporto di apertura per l'attuale posizione}
menuText I ToolsTracker "Piece Tracker"  0 {Apre la finestra Piece Tracker}
menuText I ToolsPInfo "Informazioni sul giocatore"  17 \
  {Apre/agiorna la finestra di Informazione del giocatore}
menuText I ToolsPlayerReport "Report del giocatore ..." 3 \
  {Genera un Report 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 OptionsBoard "Scacchiera" 0 {Opzioni di visualizzazione della scacchiera}
menuText I OptionsBoardSize "Dimensione della scacchiera" 0 {Cambia la dimensione della scacchiera}
menuText I OptionsBoardPieces "Stile dei pezzi" 6 \
  {Modifica lo stile dei pezzi della scacchiera}
menuText I OptionsBoardColors "Colori..." 0 {Cambia i colori della scacchiera}
menuText I OptionsBoardNames "I nomi dei miei giocatori ..." 0 {Edita i nomi dei miei giocatori}
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 {Cambia il font dei menu}
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 OptionsMovesAnimate "Intervallo di tempo per le mosse animate" 1 \
  {Definisce l'intervallo di tempo per le mosse animate}
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
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 "File utilizzati di recente..." 0 \
  {Cambia il numero di file recentemente utilizzati visualizzato nel menu file}
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 HelpContents "Contents" 0 {Mostra la pagina "contents" dell'aiuto}
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 GInfoPhotos "Visualizza foto" 5
menuText I GInfoTBNothing "Tablebases: nulla" 12
menuText I GInfoTBResult "Tablebases: solo risultato" 12
menuText I GInfoTBAll "Tablebases: risultato 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.stm {Visualizza l'icona di chi ha la mossa (si/no)}
helpMsg I .button.autoplay {Mosse automatiche  (chiave: Ctrl+Z)}

# General buttons:
translate I Back {Indietro}
translate I Browse {Browse}
translate I Cancel {Cancella}
translate I Clear {Annulla}
translate I Close {Chiudi}
translate I Contents {Contents}
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 {Visualizza partita}
translate I MergeGame {Fondi 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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Punteggio medio}
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 {Decennio}
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}
translate I readonly {sola-lettura}

# Standard error messages:
translate I ErrNotOpen {Questo database non  aperto.}
translate I ErrReadOnly {Questo database  a sola lettura; non puo' essere modificato.}
translate I ErrSearchInterrupted {Ricerca interrotta; il risultato e' incompleto.}

# 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}
translate I PInfoEditRatings {Edita i Ratings}

# 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}
translate I WinningMoves {Mosse vincenti}
translate I DrawingMoves {Mosse pattanti}
translate I LosingMoves {Mosse perdenti}
translate I UnknownMoves {Mosse senza risultato}

# 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 cache 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate I TreeTitleRow \
  {    Mossa  ECO       Frequenza    Punt.  AvElo Perf AvAnno %Patta}
translate I TreeTotal {TOTALE}

# 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 "Dimensione" 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 {Trova File}
translate I FinderDir {Trova Directory}
translate I FinderDirs {Trova Directories}
translate I FinderFiles {Trova Files}
translate I FinderUpDir {Su}

# Player finder:
menuText I PListFile "File" 0
menuText I PListFileUpdate "Aggiorna" 0
menuText I PListFileClose "Chiudi Player Finder" 0
menuText I PListSort "Ordina" 0
menuText I PListSortName "Nome" 0
menuText I PListSortElo "Elo" 0
menuText I PListSortGames "Partite" 0
menuText I PListSortOldest "Pi vecchie" 0
menuText I PListSortNewest "Pi recenti" 0

# 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 "Info sul giocatore" 0
translate I GraphFilterTitle "Filter Graph: frequenza ogni 1000 partite"

# 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}
translate I LowPriority {Imposta la priorit della CPU a bassa}

# 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 PgnFileCopy "Copia la partita verso la Clipboard" 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" 1
menuText I PgnOptColumn "Stile della colonna (una mossa per riga)" 0
menuText I PgnOptSpace "Spazio dopo i numeri delle mosse" 0
menuText I PgnOptStripMarks "Elimina i codici colorati delle caselle/frecce" 0
menuText I PgnOptBoldMainLine "Usa il grassetto per le mosse della linea principale" 4
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
translate I PgnWindowTitle {Notazione - partita %u}

# 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 della 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 "Inserisce le partite cancellate" 8
menuText I CrosstabOptColors "Colori (solo girone Svizzero)" 0
menuText I CrosstabOptColumnNumbers "A colonne (Solo la tabella dei tornei all'italiana)" 3
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}
translate I Category {Categoria}

# 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 OprepFavorites "Preferiti" 1
menuText I OprepFavoritesAdd "Aggiungi Report..." 0
menuText I OprepFavoritesEdit "Edita i Report preferiti..." 0
menuText I OprepFavoritesGenerate "Genera Reports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 {Identificatore}
translate I GlistVars {Varianti}
translate I GlistComments {Commenti}
translate I GlistAnnos {Annotazioni}
translate I GlistStart {Inizio}
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 Description {Descrizione}
translate I Flag {Identificatore}
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 {Numero della partita che si caricher automaticamente}
translate I StripTags {Toglie i PGN tags}
translate I StripTag {Toglie i tag}
translate I Cleaner {Manutentore Globale}
translate I CleanerHelp {La finestra Manutentore Globale effettura' tutte le operazioni che verranno selezionate dalla lista sottostante, sul database corrente.

Le impostazioni correnti nelle finestre della classificazione 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 grosso database, 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:}
translate I InsertMark {Inserisci marcatore}
translate I InsertMarkHelp {
Inserisci/togli marcatore: Seleziona colore, tipo, casella.
Inserisci/togli freccia: Doppio-click due caselle.
}

# Nag buttons in comment editor:
translate I GoodMove {Mossa buona}
translate I PoorMove {Mossa debole}
translate I ExcellentMove {Mossa ottima}
translate I Blunder {Svista}
translate I InterestingMove {Mossa interessante}
translate I DubiousMove {Mossa dubbia}
translate I WhiteDecisiveAdvantage {Il Bianco  in vantaggio decisivo}
translate I BlackDecisiveAdvantage {Il Nero  in vantaggio decisivo}
translate I WhiteClearAdvantage {Il Bianco sta meglio}
translate I BlackClearAdvantage {Il Nero sta meglio}
translate I WhiteSlightAdvantage {Il Bianco sta leggermente meglio}
translate I BlackSlightAdvantage {Il Nero sta leggermente meglio}
translate I Equality {Parit}
translate I Unclear {Incerta}
translate I Diagram {Diagramma}

# 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}

# Common endings in material search:
translate I EndingPawns {Pawn endings} ;# ***
translate I EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate I EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate I EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate I EndingRooks {Rook vs. Rook endings} ;# ***
translate I EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate I EndingRooksDouble {Double Rook endings} ;# ***
translate I EndingBishops {Bishop vs. Bishop endings} ;# ***
translate I EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate I EndingKnights {Knight vs. Knight endings} ;# ***
translate I EndingQueens {Queen vs. Queen endings} ;# ***
translate I EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate I BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate I PatternWhiteIQP {White IQP} ;# ***
translate I PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate I PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate I PatternBlackIQP {Black IQP} ;# ***
translate I PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate I PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate I PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate I PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate I PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate I PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate I PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate I PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate I PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate I PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {Fila En Passant}
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 identificatore' puo' essere alterato.
Ogni 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 {Il database ha partite modificate e non salvate. Se esci adesso queste modifiche saranno perse.}

# 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 OprepMostFrequentOpponents {Avversari pi 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 {Risultato lunghezza e frequenza}
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 OprepMostFrequentEcoCodes {Codici ECO pi frequenti}
translate I OprepThemes {Temi Posizionali}
translate I OprepThemeDescription {Frequenza dei Temi nelle prime %u mosse di ogni partita}
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 OprepThemeWIQP {Pedone di donna Bianco isolato}
translate I OprepThemeBIQP {Pedone di donna Nero 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}
translate I OprepViewHTML {Vedi HTML}
translate I OprepViewLaTeX {Vedi LaTeX}

# Player Report:
translate I PReportTitle {Report sul giocatore}
translate I PReportColorWhite {con i pezzi Bianchi}
translate I PReportColorBlack {con i pezzi Neri}
translate I PReportMoves {dopo %s}
translate I PReportOpenings {Aperture}
translate I PReportClipbase {Svuota la Clipbase e copia le partite risultanti in essa}

# Piece Tracker window:
translate I TrackerSelectSingle {Il tasto sinistro del mouse seleziona questo pezzo.}
translate I TrackerSelectPair {Il tasto sinistro del mouse seleziona questo pezzo; il tasto destro seleziona il suo sibling.}
translate I TrackerSelectPawn {Il tasto sinistro del mouse seleziona questo pedone; il tasto destro seleziona tutti gli 8 pedoni.}
translate I TrackerStat {Statistiche}
translate I TrackerGames {% di partite con mosse in questa casella}
translate I TrackerTime {% di tempo su ogni casella}
translate I TrackerMoves {Mosse}
translate I TrackerMovesStart {Inserisci il numero di mossa da dove iniziare il tracciamento.}
translate I TrackerMovesStop {Inserisci il numero di mossa dove finire il tracciamento.}

# 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 {Stesso 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 {Quale partita cancellare:}
translate I TwinsDeleteShorter {La partita pi corta}
translate I TwinsDeleteOlder {La partita inserita prima nel database}
translate I TwinsDeleteNewer {La partita inserita dopo nel database}
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 {Dimensioni (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 {Togliere i codici di casella/freccia dai commenti?}

# 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 [::utils::thousands $nGamesToCopy] partite dal filtro
 del database "$fromName"
 nel database "$targetName"?
}
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.
}

# Sounds configuration:
translate I SoundsFolder {Sound Files Folder} ;# ***
translate I SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate I SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate I SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate I SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate I SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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 {Numero di file recentemente utilizzati nel Menu File}
translate I RecentFilesExtra {Numero di file recentemente utilizzati nel submenu extra}

# My Player Names options:
translate I MyPlayerNamesDescription {
Inserisci sotto una lista di giocatori preferiti, un nome per linea. Wildcards (e.g. "?" per ogni singolo carattere, "*" per ogni sequenza di caratteri) sono accettati.

Ogni volta che viene caricata una partita con un giocatore nella lista, la finestra principale della scacchiera se necessario ruoter e vi proporr la partita dal punto di vista di quel giocatore.
}

}

############################################################
#
# Italian tips section:

set tips(I) {
  {
    SCID ha oltre 30 <a Index>pagine di help</a>, e in molte finestre 
    premendo il tasto funzionale <b>F1</b> apparira' una pagina di help
    relativa alla finestra.
  }
  {
    Molte finestre di SCID (p.e. il database <a Switcher>database switcher</a>,
    ecc.) hanno un menu' collegato al pulsante destro del mouse. Prova a
    premerlo in ogni finestra per vedere se c'e' e quali funzionalita' permette.
  }
  {
    SCID ti consente piu' di una modalit per inserire le mosse, scegli
    quale preferisci. Puoi utilizzare il mouse (con o senza il suggerimento
    della mossa) o la tastiera (con o senza il completamento della mossa).
    Leggi la pagina di help <a Moves>inserire le mosse</a> per maggiori dettagli. 
  }
  {
    Se utilizzi pochi database che apri spesso, aggiungi un
    <a Bookmarks>segnalibro</a> a ognuno di essi e poi puoi aprirlo piu'
    velocemente con il Menu Segnalibri.
  }
  {
    Puoi visualizzare tutte le mosse della partita caricata (con ogni
    variante e/o commento) utilizzando la <a PGN>Finestra PGN</a>.
    Nella Finestra PGN puoi andare a ogni mossa premendo il tasto sinistro
    del mouse quando sei sulla mossa oppure visualizzare la posizione
    premendo il tasto centrale/destro del mouse.
  }
  {
    Puoi copiare partite da un database ad un'altro usando la tecnica del
    drag and drop utilizzando il tasto sinistro del mouse nella finestra 
    <a Switcher>database switcher</a>.
  }
  {
    SCID puo' aprire file PGN, anche se sono compressi con Gzip (con il
    suffisso .gz). I file PGN aperti sono a sola lettura cosi' puoi
    modificare un file PGN in SCID, creando un nuovo database SCID e copiando
    il file PGN in esso utilizzando il <a Switcher>database switcher</a>.
  }
  {
    Se hai un grosso database e usi spesso la finestra <a Tree>albero</a>,
    e' il caso di utilizzare <b>riempi il file cache</b> dalla Finestra
    Albero (menu file). Cio' memorizza le statistiche dell'albero delle
    piu' comuni posizioni di apertura rendendo piu' veloci gli accessi
    all'albero per quel database.
  }
  {
    La finestra <a Tree>albero</a> visualizza tutte le mosse giocate dalla
    posizione caricata, ma se vuoi vedere tutti gli ordini di mosse che
    raggiungono la posizione devi generare un <a OpReport>report di apertura</a>.
  }
  {
    Nella finestra <a GameList>elenco partite</a> premendo il tasto sinistro
    o desto del mouse sulla testata di ogni colonna puoi modificarne la
    larghezza.
  }
  {
    Con la finestra <a PInfo>informazioni sul giocatore</a> (che ottieni
    cliccando sui nomi dei giocatori nella info area sotto la finestra
    con la scacchiera) tu puoi facilmente, utilizzando il
    <a Searches Filter>filtro</a>, ottenere tutte le partite di un certo
    giocatore con i suoi risultati cliccando su ogni campo che appare
    <red>in rosso</red>.
  }
  {
    Quando studi un'apertura puo' essere utile effettuare una
    <a Searches Board>ricerca su scacchiera</a> con le opzioni
    <b>Pedoni</b> oppure <b>Colonne</b> sulla posizione che ti
    interessa, in maniera da evidenziarti se altre aperture 
    raggiungono la stessa struttura di pedoni.
  }
  {
    Nell'Area di informazioni sulla partita (sotto la scacchiera) tu puoi
    premere il tasto destro del mouse per ottenere un menu' per 
    personalizzarla. Per esempio puoi nascondere la prossima mossa e cio'
    e' utile quando visualizzi una partita per allenamento e vuoi pensare
    le mosse successive. 
  }
  {
    Se tu effettui spesso <a Maintenance>manutenzione</a> di un database
    di grosse dimensioni puoi effettuare tutte le attivita' in un colpo
    solo utilizzando il <a Maintenance Cleaner>pulitore</a>.
  }
  {
    Se tu hai un grosso database dove molte partite hanno il campo EventDate
    valorizzato e tu vuoi le partite in ordine di data utilizza
    <a Sorting>ordinamento</a> per EventDate/Event invece di Date/Event
    cosicche' otterrai insieme le partite dello stesso torneo anche se hanno
    date diverse (partendo dal presupposto che abbiano la stessa EventDate).
  }
  {
    Prima di <a Maintenance Twins>cancellare le partite doppie</a> e' meglio
    utilizzare il <a Maintenance Spellcheck>controllo ortografico</a> sul tuo
    database permettendo a SCID di identificare un numero maggiore di
    partite doppie e contrassegnarle per la cancellazione.
  }
  {
    <a Flags>Gli identificatori</a>  sono utili per evidenziare partite con
    caratteristiche particolari da ricercare successivamente (p.e. struttura
    di pedoni, tattica, ecc.). Puoi ricercare le partite contrassegnate
    utilizzando <a Searches Header>ricerca per intestazione</a>.
  }
  {
    Se stai visualizzando una partita e vuoi provare qualche altra mossa
    senza modificare la partita puoi entrare nel Modo Prova (con lo
    shortcut <b>Ctrl+space</b> oppure cliccando l'apposita icona).
    Quando hai finito puoi deselezionare il Modo Prova ritornando
    alla partita originale.
  }
  {
    Per cercare le partite maggiormente rilevanti (quelle con i giocatori
    con l'Elo piu' alto) in una posizione, apri la finestra <a Tree>albero</a>
    e da quella apri la Lista Migliori Partite.
    Puoi personalizzare la lista ottenendo solo le partite con un
    certo risultato che ti interessa.
  }
  {
    Un buon modo per studiare le aperture utilizzando un grosso database
    e' attivare il Modo Esercizio nella finestra <a Tree>albero</a> e
    giocare contro il database per vedere quali linee appaiono spesso.
  }
  {
    Se hai due database aperti e vuoi visualizzare le statistiche
    dell'<a Tree>albero</a> del primo database mentre esamini una
    partita del secondo database premi il pulsante <b>Blocca</b> nella
    finestra albero per bloccare il primo database ed allora selezionare
    il secondo database.
  }
  {
    Il <a Tmt>tournament finder</a> non e' solo utile per trovare un
    certo torneo, ma puo' essere usato anche per vedere quali tornei
    ha giocato recentemente un certo giocatore oppure vedere i tornei
    piu' importanti giocati in una certa nazione.
  }
  {
    La finestra <a Searches Material>Materiale/Schema</a> ti propone
    alcune possibilita', fra le piu' comuni, facilitandoti ricerche
    per aperture o centri partita a fine di studio.
  }
  {
    Quando effettui una ricerca per una particolare posizione
    nella finestra <a Searches Material>Materiale/Schema</a> e'
    spesso utile restringere la ricerca a partite che permangono
    nella posizione voluta almeno qualche mezza mossa eliminando
    partite che raggiungono la posizione voluta solo una volta. 
  }
  {
    Se tu hai un importante database e non vuoi correre il rischio
    di effettuare modifiche inopportune, seleziona <b>solo lettura...</b>
    dal <b>File</b> menu dopo averlo aperto, oppure cambia gli
    attributi a solo lettura.
  }
  {
    Se usi XBoard oppure WinBoard (oppure altri programmi scacchistici
    che possono copiare sulla clipboard la posizione attuale in notazione
    standard FEN) e vuoi copiare la tua posizione su SCID, il modo piu'
    facile e veloce e' selezionare <b>Copia Positione</b> dal menu File
    in XBoard/WinBoard e poi <b>Copia come posizione di partenza</b> dal
    menu Edita in SCID.  
  }
  {
    In una <a Searches Header>ricerca per intestazione</a>,
    giocatore/evento/luogo/turno non sono sensibili alle maiuscole e
    vengono cercate anche all'interno dei nomi. Puoi scegliere di
    fare una ricerca sensibile alle maiuscole (dove "?" = ogni singolo
    carattere e "*" = zero o piu' caratteri) digitando la stringa che
    vuoi trovare fra "virgolette". Per esempio digitando "*BEL" (con
    le virgolette) nel campo luogo otterrai tutte le partite giocate
    in Belgio ma non a Belgrado.
  }
  {
    Se vuoi correggere una mossa in una partita senza perdere le mosse
    giocate successivamente, apri la finestra <a Import>Importa</a>
    premi l'icona b>Incolla la partica corrente</b>, edita la mossa
    sbagliata e poi premi l'icona <b>Importa</b>.
  }
  {
    Se hai caricato un file di classificazione ECO, puoi andare alla
    posizione classificata piu' profonda della partita correntemente
    caricata con <b>Identifica apertura</b> nel menu <b>Partita</b>
    (shortcut: Ctrl+Shift+D).
  }
  {
    Se vuoi verificare le dimensioni di un file o la sua data di ultima
    modifica prima di aprirlo, utilizza <a Finder>file finder</a> per
    aprirlo.
  }
  {
    Un file di <a Repertoire>repertorio</a> e' un grande strumento per
    monitorare le tue aperture preferite e per trovare le partite nelle
    quali queste linee sono state giocate. Dopo aver memorizzato le tue
    aperture in un file di repertorio puoi effettuare ricerche tutte le
    volte che acquisisci nuovi file di partite e visualizzare le partite
    che ti interessano.
  }
  {
    Un <a OpReport>rapporto di apertura</a> e' molto utile per apprendere
    ulteriori informazioni su una particolare posizione. Puoi vedere il
    punteggio percentuale che raggiunge, se porta a rapide patte, i temi
    posizionali piu' comuni e molto altro.
  }
  {
    Puoi aggiungere i piu' comuni simboli di annotazione (!, !?, +=, ecc)
    alla posizione attualmente caricata con scorciatoie da tastiera senza
    necessita' di utilizzare <a Comment>l'editor di commenti<a>.
    Per esempio digitando "!" seguito dal tasto Conferma/Enter/Return
    aggiungerete il simbolo "!". Guarda la pagina di help
    <a Moves>Inserire le mosse</a> per maggiori informazioni.
  }
  {
    Se stai visualizzando un'apertura in un database con <a Tree>l'albero</a>
    puoi facilmente vedere i risultati percentuali dell'apertura che stai
    guardando (recenti e fra giocatori di Elo alto) aprendo la finestra
    Statistiche (shortcut: Ctrl+I).
  }
  {
    Puoi cambiare le dimensioni della scacchiera premendo i tasti
    <b>Ctrl</b> e <b>Shift</b>, e regolare le dimensioni premendo i tasti
    freccia <b>Left</b> o <b>Right</b> .
  }
  {
    Dopo una <a Searches>ricerca</a> puoi facilmente visualizzare tutte le
    partite trovate premendo <b>Ctrl</b> e con i tasti <b>Su</b> o <b>Giu'</b>
    caricare la precedente o successiva partita del <a Searches Filter>filtro</a>.
  }
}


# end of italian.tcl
#  nederlan.tcl:
#  Dutch language support for Scid.
#  Added by J.Kees Hofkamp.
#  Changes by J. Krabbenbos.
#  Changes by Leander Laruelle.
# Untranslated messages are marked with a "***" comment.


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 FileSwitch "Switch to database" 0 \
  {Switch to a different opened database} ;# ***
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 EditStripBegin "Moves from the beginning" 1 \
  {Strip moves from the beginning of the game} ;# ***
menuText N EditStripEnd "Moves to the end" 0 \
  {Strip moves to the end of the game} ;# ***
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText N EditSetup "Stelling opzetten..." 0 \
  {Kies een start-stelling voor de partij}
menuText N EditCopyBoard "Copy position" 6 \
  {Copy the current board in FEN notation to the text selection (clipboard)} ;# ***
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 "Laad willekeurige partij" 8 {Laad een willekeurige partij}
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 WindowsPList "Player Finder" 2 {Open/close the player finder} ;# ***
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 \
  {Openen/sluiten grafisch filter venster}
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 ToolsPlayerReport "Player Report..." 3 \
  {Generate a player report} ;# ***
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 OptionsBoard "Chessboard" 0 {Chess board appearance options} ;# ***
menuText N OptionsBoardSize "Grootte van bord" 0 {Wijzig bord grootte}
menuText N OptionsBoardPieces "Bord Stukken Stijl" 6 \
  {Wijzig de stijl van bord en/of stukken}
menuText N OptionsBoardColors "Kleuren..." 0 {Wijzig bord kleuren}
menuText N OptionsBoardNames "My Player Names..." 0 {Edit my player names} ;# ***
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 {Wijzig het menu lettertype}
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 OptionsMovesAnimate "Animation time" 1 \
  {Set the amount of time used to animate moves} ;# ***
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
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 "Recente bestanden..." 0 \
  {Wijzig het aantal recent gebruikte bestanden in het Bestand 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 HelpContents "Contents" 0 {Show the help contents page} ;# ***
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 GInfoPhotos "Show Photos" 5 ;# ***
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.stm {Turn the side-to-move icon on or off} ;# ***
helpMsg N .button.autoplay {Speel zetten automatisch  (toets: Ctrl+Z)}

# General buttons:
translate N Back {Terug}
translate N Browse {Browse} ;# ***
translate N Cancel {Annuleren}
translate N Clear {Leegmaken}
translate N Close {Sluiten}
translate N Contents {Contents} ;# ***
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Average Rating} ;# ***
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 {Decennium}
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}
translate N readonly {alleen-lezen}

# Standard error messages:
translate N ErrNotOpen {This is not an open database.} ;# ***
translate N ErrReadOnly {This database is read-only; it cannot be altered.} ;# ***
translate N ErrSearchInterrupted {Search was interrupted; results are incomplete.} ;# ***

# 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}
translate N PInfoEditRatings {Edit Ratings} ;# ***

# 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}
translate N WinningMoves {Winning moves} ;# ***
translate N DrawingMoves {Drawing moves} ;# ***
translate N LosingMoves {Losing moves} ;# ***
translate N UnknownMoves {Unknown-result moves} ;# ***

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate N TreeTitleRow \
  {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws} ;# ***
translate N TreeTotal {TOTAAL}

# 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}

# Player finder:
menuText N PListFile "Bestand" 0
menuText N PListFileUpdate "Nijwerken" 0
menuText N PListFileClose "Close Player Finder" 0 ;# ***
menuText N PListSort "Sorteren" 0
menuText N PListSortName "Name" 0 ;# ***
menuText N PListSortElo "Elo" 0
menuText N PListSortGames "Partijen" 0 ;# ***
menuText N PListSortOldest "Oldest" 0 ;# ***
menuText N PListSortNewest "Newest" 0 ;# ***

# 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 "Filtergrafiek: frequentie per 1000 partijen"

# 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.}
translate N LowPriority {Low CPU priority} ;# ***

# 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 PgnFileCopy "Copy Game to Clipboard" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate N PgnWindowTitle {Game Notation - game %u} ;# ***

# 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}
translate N Category {Category} ;# ***

# 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 OprepFavorites "Favorites" 1 ;# ***
menuText N OprepFavoritesAdd "Add Report..." 0 ;# ***
menuText N OprepFavoritesEdit "Edit Report Favorites..." 0 ;# ***
menuText N OprepFavoritesGenerate "Generate Reports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Description} ;# ***
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 {Verwijder PGN labels}
translate N StripTag {Verwijder label}
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:}
translate N InsertMark {Insert mark} ;# ***
translate N InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate N GoodMove {Good move} ;# ***
translate N PoorMove {Poor move} ;# ***
translate N ExcellentMove {Excellent move} ;# ***
translate N Blunder {Blunder}
translate N InterestingMove {Interesting move} ;# ***
translate N DubiousMove {Dubious move} ;# ***
translate N WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate N BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate N WhiteClearAdvantage {White has a clear advantage} ;# ***
translate N BlackClearAdvantage {Black has a clear advantage} ;# ***
translate N WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate N BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate N Equality {Equality} ;# ***
translate N Unclear {Unclear} ;# ***
translate N Diagram {Diagram} ;# ***

# 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}

# Common endings in material search:
translate N EndingPawns {Pawn endings} ;# ***
translate N EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate N EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate N EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate N EndingRooks {Rook vs. Rook endings} ;# ***
translate N EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate N EndingRooksDouble {Double Rook endings} ;# ***
translate N EndingBishops {Bishop vs. Bishop endings} ;# ***
translate N EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate N EndingKnights {Knight vs. Knight endings} ;# ***
translate N EndingQueens {Queen vs. Queen endings} ;# ***
translate N EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate N BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate N PatternWhiteIQP {White IQP} ;# ***
translate N PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate N PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate N PatternBlackIQP {Black IQP} ;# ***
translate N PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate N PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate N PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate N PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate N PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate N PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate N PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate N PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate N PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate N PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {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 OprepMostFrequentOpponents {Most frequent opponents} ;# ***
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 OprepMostFrequentEcoCodes {Most frequent ECO codes} ;# ***
translate N OprepThemes {Positionnele Thema's}
translate N OprepThemeDescription {Frequency of themes in the first %u moves of each game} ;# ***
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 OprepThemeWIQP {White Isolated Queen Pawn} ;# ***
translate N OprepThemeBIQP {Black Isolated Queen Pawn} ;# ***
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}
translate N OprepViewHTML {View HTML} ;# ***
translate N OprepViewLaTeX {View LaTeX} ;# ***

# Player Report:
translate N PReportTitle {Player Report} ;# ***
translate N PReportColorWhite {with the White pieces} ;# ***
translate N PReportColorBlack {with the Black pieces} ;# ***
translate N PReportMoves {after %s} ;# ***
translate N PReportOpenings {Openings} ;# ***
translate N PReportClipbase {Empty clipbase and copy matching games to it} ;# ***

# 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 [::utils::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.
}

# Sounds configuration:
translate N SoundsFolder {Sound Files Folder} ;# ***
translate N SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate N SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate N SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate N SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate N SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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 {Aantal recente bestanden in Bestand menu}
translate N RecentFilesExtra {Aantal recente bestand in extra submenu}

# My Player Names options:
translate N MyPlayerNamesDescription {
Enter a list of preferred player names below, one name per line. Wildcards (e.g. "?" for any single character, "*" for any sequence of characters) are permitted.

Every time a game with a player in the list is loaded, the main window chessboard will be rotated if necessary to show the game from that players perspective.
} ;# ***

}
# End of nederlan.tcl
# spanish.tcl:
# Spanish translations for Scid.
# Contributed by Jordi Gonzlez Boada.
# Updated by Enrique Lopez.
# Untranslated messages are marked with a "***" comment.

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 FileSwitch "Cambiar de base de datos" 0 \
  {Cambia a una base de dator abierta diferente}
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 \
  {Quita todos los comentarios y variaciones de esta partida}
menuText S EditStripVars "Variaciones" 0 {Quita todas las variaciones de esta partida}
menuText S EditStripBegin "Movimientos desde el principio" 1 \
  {Quita los movimientos desde el principio de la partida}
menuText S EditStripEnd "Movimientos hasta el final" 0 \
  {Quita los movimientos hasta el final de la partida}
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpreta el texto  de la base de trabajo (clipbase) como una partida en notacion PGN y la pega aqu}
menuText S EditSetup "Iniciar tablero de posicin..." 26 \
  {Inicia el tablero de posicin con la posicin de la partida}
menuText S EditCopyBoard "Copiar posicin" 8 \
  {Copia el tablero actual en notacin FEN a la seleccin de texto (clipboard)}
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 "Cargar partida aleatoria" 16 {Carga aleatoriamente una partida filtrada}
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 WindowsPList "Buscador de jugadores" 2 {Abre/cierra el buscador de jugadores}
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 "Filtro grfico" 7 \
  {Abre/cierra la ventana del filtro grfico}
menuText S ToolsOpReport "Informe de la apertura" 1 \
  {Crea un informe de la apertura para la posicin actual}
menuText S ToolsTracker "Rastreador de piezas"  14 {Abre la ventana del rastreador de piezas}
menuText S ToolsPInfo "Informacin del Jugador" 16 \
  {Abrir/actualizar la ventana de Informacin del Jugador}
menuText S ToolsPlayerReport "Informe del jugador..." 3 \
  {Crea un informe sobre un 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 OptionsBoard "Tablero" 0 {Opciones sobre el aspecto del tablero}
menuText S OptionsBoardSize "Tamao del tablero" 0 {Cambia el tamao del tablero}
menuText S OptionsBoardPieces "Estilo de piezas" 10 \
  {Cambia el estilo de piezas del tablero}
menuText S OptionsBoardColors "Colores..." 0 {Cambia los colores del tablero}
menuText S OptionsBoardNames "Mis nombres de jugador..." 0 {Edita mis nombres de jugador}
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 "Men" 0 {Cambia la fuente del men}
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 OptionsMovesAnimate "Velocidad de la animacin" 1 \
  {Pone el tiempo usado para animar las jugadas}
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 "Autominimizar" 4 \
  {Minimiza todas las ventanas cuando la ventana principal es minimizada}
menuText S OptionsWindowsRaise "Poner a la vista automticamente" 0 \
  {Hace visibles ciertas ventanas (ej. barras de progreso) siempre que sean tapadas}
menuText S OptionsSounds "Sounds..." 2 {Configura el sonido del anuncio de las jugadas}
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 "Archivos recientes..." 9 \
  {Cambia el nmero de archivos recientes mostrados en el men Archivo}
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 HelpContents "Contenidos" 0 {Show the help contents page}
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 "Mostrar casillas y flechas coloreadas" 29
menuText S GInfoWrap "Dividir lneas largas" 0
menuText S GInfoFullComment "Mostrar comentarios completos" 8
menuText S GInfoPhotos "Mostrar fotos" 5
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.stm {Activa/Desactiva el icono de Turno de Juego}
helpMsg S .button.autoplay {Automovimiento de los movimientos  (Tecla: Ctrl+Z)}

# General buttons:
translate S Back {Atrs}
translate S Browse {Navegar}
translate S Cancel {Cancelar}
translate S Clear {Limpiar}
translate S Close {Cerrar}
translate S Contents {Contenidos}
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 {Buscar partida}
translate S MergeGame {Incorporar partida}
translate S Preview {Vista previa}
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Clasificacin promedio}
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 {Dcada}
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}
translate S readonly {slo lectura}

# Standard error messages:
translate S ErrNotOpen {Esta base de datos no est abierta.}
translate S ErrReadOnly {Esta base de datos es de slo lectura; no puede ser cambiada.}
translate S ErrSearchInterrupted {La busqueda se interrumpio; los resultados son incompletos.}

# 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 {Resultados contra}
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}
translate S PInfoEditRatings {Editar elos}

# 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}
translate S WinningMoves {Movimientos ganadores}
translate S DrawingMoves {Movimientos para tablas}
translate S LosingMoves {Movimientos perdedores}
translate S UnknownMoves {Movimientos de resultado desconocido}

# 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 \
  {Construir archivo cach con posiciones de apertura comunes}
menuText S TreeFileBest "Lista de mejores partidas" 9 {Muestra la lista del rbol de mejores partidas}
menuText S TreeFileGraph "Ventana del grfico" 0 \
  {Muestra el grfico para esta rama del rbol}
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 "Bloquear" 1 {Bloquea/desbloquea el rbol de la base de datos actual}
menuText S TreeOptTraining "Entrenamiento" 2 {Activa/desactiva el modo de entrenamiento de rbol}
menuText S TreeOptAutosave "Autoguardar archivo cach" 0 \
  {Guarda automticamente el archivo cach cuuando se cierra la ventana de rbol}
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 {Bloqueado}
translate S TreeBest {Mejor}
translate S TreeBestGames {Mejores partidas del rbol}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate S TreeTitleRow \
  {    Movim. ECO       Frecuencia   Puntu. AvElo Perf AvAo %Tablas}
translate S TreeTotal {TOTAL}

# 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}

# Player finder:
menuText S PListFile "Archivo" 0
menuText S PListFileUpdate "Actualizar" 0
menuText S PListFileClose "Cierra el Buscador de Jugadores" 0
menuText S PListSort "Ordenar" 0
menuText S PListSortName "Nombre" 0
menuText S PListSortElo "Elo" 0
menuText S PListSortGames "Partidas" 0
menuText S PListSortOldest "Ms antiguo" 10
menuText S PListSortNewest "Ms nuevo" 4

# 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 "Filtro grfico: frecuencia por 1000 partidas"

# 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}
translate S LowPriority {Baja prioridad del procesador}

# Analysis Engine open dialog:
translate S EngineList {Lista de Motores de Anlisis}
translate S EngineName {Nombre}
translate S EngineCmd {Orden}
translate S EngineArgs {Parmetros}
translate S EngineDir {Directorio}
translate S EngineElo {Elo}
translate S EngineTime {Fecha}
translate S EngineNew {Neevo}
translate S EngineEdit {Editar}
translate S EngineRequired {Los campos en negrita son obligatorios; los dems opcionales}

# 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 PgnFileCopy "Copiar partida al portapapeles" 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 "Quitar cdigos de color en casilla/flecha" 3
menuText S PgnOptBoldMainLine "Usar texto en negrita para las jugadas principales" 4
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
translate S PgnWindowTitle {Planilla - partida %u}

# 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 "Puntuaciones de desempate" 0
menuText S CrosstabOptDeleted "Incluir partidas borradas" 17
menuText S CrosstabOptColors "Colores (slo en tabla de Suizos)" 0
menuText S CrosstabOptColumnNumbers "Columnas numeradas (Slo en tabla todos contra todos)" 11
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 "Hipertexto" 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}
translate S Category {Categora}

# 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 OprepFavorites "Favoritos" 1
menuText S OprepFavoritesAdd "Aadir informe..." 0
menuText S OprepFavoritesEdit "Editar informe favorito..." 0
menuText S OprepFavoritesGenerate "Generar informe..." 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 EndSideToMove {Bando a mover al final de la partida}
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 Description {Descripcin}
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 {Quitar etiquetas PGN}
translate S StripTag {Quitar etiquetas}
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:}
translate S InsertMark {Insertar marca}
translate S InsertMarkHelp {
Insertar/quitar marca: Selecciona color, tipo, casilla.
Insertar/quitar flecha: Botn derecho sobre dos casillas.
}

# Nag buttons in comment editor:
translate S GoodMove {Buena jugada}
translate S PoorMove {Mala jugada}
translate S ExcellentMove {Jugada excelente}
translate S Blunder {Error}
translate S InterestingMove {Jugada interesante}
translate S DubiousMove {Jugada dudosa}
translate S WhiteDecisiveAdvantage {Las blancas tienen decisiva ventaja}
translate S BlackDecisiveAdvantage {Las negras tienen decisiva ventaja}
translate S WhiteClearAdvantage {Las blancas tienen clara ventaja}
translate S BlackClearAdvantage {Las negras tienen clara ventaja}
translate S WhiteSlightAdvantage {Las blancas tienen ligera ventaja}
translate S BlackSlightAdvantage {Las negras tienen ligera ventaja}
translate S Equality {Igualdad}
translate S Unclear {Incierto}
translate S Diagram {Diagrama}

# 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}

# Common endings in material search:
translate S EndingPawns {Finales de peones}
translate S EndingRookVsPawns {Torre vs. peon(es)}
translate S EndingRookPawnVsRook {Torre y 1 pen vs. torre}
translate S EndingRookPawnsVsRook {Torre y peon(es) vs. torre}
translate S EndingRooks {Finales de torre vs. torre}
translate S EndingRooksPassedA {Finales de torre vs. torre con pen pasado}
translate S EndingRooksDouble {Finales de dos torres}
translate S EndingBishops {Finales de alfil vs. alfil}
translate S EndingBishopVsKnight {Finales de alfil vs. caballo}
translate S EndingKnights {Finales de caballo vs. caballo}
translate S EndingQueens {Finales de dama vs. dama}
translate S EndingQueenPawnVsQueen {Dama y 1 pen vs. dama}
translate S BishopPairVsKnightPair {Medio juego de dos alfiles vs. dos caballos}

# Common patterns in material search:
translate S PatternWhiteIQP {PDA blanco}
translate S PatternWhiteIQPBreakE6 {PDA blanco: d4-d5 ruptura vs. e6}
translate S PatternWhiteIQPBreakC6 {PDA blanco: d4-d5 ruptura vs. c6}
translate S PatternBlackIQP {PDA negro}
translate S PatternWhiteBlackIQP {PDA blanco vs. PDA negro}
translate S PatternCoupleC3D4 {Pareja de peones aislados blancos c3+d4}
translate S PatternHangingC5D5 {Peones colgantes negros en c5 y d5}
translate S PatternMaroczy {Centro Maroczy (con peones en c4 y e4)}
translate S PatternRookSacC3 {Sacrificio de torre en c3}
translate S PatternKc1Kg8 {O-O-O vs. O-O (Rc1 vs. Rg8)}
translate S PatternKg1Kc8 {O-O vs. O-O-O (Rg1 vs. Rc8)}
translate S PatternLightFian {Fianchettos de casillas claras (Alfil-g2 vs. Alfil-b7)}
translate S PatternDarkFian {Fianchettos de casillas oscuras (Alfil-b2 vs. Alfil-g7)}
translate S PatternFourFian {Cuatro Fianchettos (Alfiles en b2,g2,b7,g7)}

# 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 EnPassantFile {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 {La siguiente base de datos tiene cambios en partidas no guardados. Si sales ahora se perdern estos cambios.}

# 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 OprepMostFrequentOpponents {Rivales 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 OprepMostFrequentEcoCodes {Aperturas ms frecuentes}
translate S OprepThemes {Temas Posicionales}
translate S OprepThemeDescription {Frecuencia de los temas en las primeras %u jugadas de cada partida}
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 OprepThemeWIQP {Pen de dama aislado de las blancas}
translate S OprepThemeBIQP {Pen de dama aislado de las negras}
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}
translate S OprepViewHTML {Ver HTML}
translate S OprepViewLaTeX {Ver LaTeX}

# Player Report:
translate S PReportTitle {Informe del jugador}
translate S PReportColorWhite {con las piezas blancas}
translate S PReportColorBlack {con las piezas negras}
translate S PReportMoves {%s despus}
translate S PReportOpenings {Aperturas}
translate S PReportClipbase {Vaciar portapapeles y copiar las partidas}

# Piece Tracker window:
translate S TrackerSelectSingle {El botn izquierdo selecciona esta pieza.}
translate S TrackerSelectPair {El botn izquierdo selecciona esta pieza; el botn derecho tambin selecciona su hermana.}
translate S TrackerSelectPawn {El botn izquierdo selecciona este pen; el botn derecho selecciona los 8 peones.}
translate S TrackerStat {Estadstica}
translate S TrackerGames {% de partidas con movimiento a esta casilla}
translate S TrackerTime {% de tiempo en esta casilla}
translate S TrackerMoves {Movimientos}
translate S TrackerMovesStart {Escribe el nmero del movimiento desde donde debe empezar el rastreo.}
translate S TrackerMovesStop {Escribe el nmero del movimiento donde debe parar el rastreo.}

# 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 {Qu partida borrar:}
translate S TwinsDeleteShorter {Partida ms corta}
translate S TwinsDeleteOlder {Nmero de partida menor}
translate S TwinsDeleteNewer {Nmero de partida mayor}
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 {Quitar marca de cdigos de casilla/flecha de los comentarios?}

# 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 [::utils::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.
}

# Sounds configuration:
translate S SoundsFolder {Directorio de los archivos de sonido}
translate S SoundsFolderHelp {El directorio debe contener los archivos King.wav, a.wav, 1.wav, etc}
translate S SoundsAnnounceOptions {Opciones de anunciamiento de movimientos}
translate S SoundsAnnounceNew {Anunciar nuevos movimientos cuando sean hechos}
translate S SoundsAnnounceForward {Anunciar movimientos cuando avancemos un movimiento}
translate S SoundsAnnounceBack {Anunciar movimiento cuando rectifiquemos o retrocedamos una jugada}

# 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 {Nmero de archivos recientes en el men Archivo}
translate S RecentFilesExtra {Nmero de archivos recientes en submen extra}

# My Player Names options:
translate S MyPlayerNamesDescription {
Escriba una lista de nombres de jugadores preferidos, un nombre por cada lnea. Estn permitidos los comodines (por ejemplo "?" para un slo caracter, "*" para varios caracteres).

Cada vez que carge una partida con un jugador de la lista se girar el tablero, si fuese necesario, para ver la partida desde la perspectiva del jugador.
}

}
# 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 FileSwitch "Switch to database" 0 \
  {Switch to a different opened database} ;# ***
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 EditStripBegin "Moves from the beginning" 1 \
  {Strip moves from the beginning of the game} ;# ***
menuText B EditStripEnd "Moves to the end" 0 \
  {Strip moves to the end of the game} ;# ***
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText B EditSetup "Configura posicao inicial..." 12 \
  {Configura a posicao inicial para o jogo}
menuText B EditCopyBoard "Copy position" 6 \
  {Copy the current board in FEN notation to the text selection (clipboard)} ;# ***
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 WindowsPList "Player Finder" 2 {Open/close the player finder} ;# ***
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 ToolsPlayerReport "Player Report..." 3 \
  {Generate a player report} ;# ***
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 OptionsBoard "Chessboard" 0 {Chess board appearance options} ;# ***
menuText B OptionsBoardSize "Tamanho do Tabuleiro" 0 {Muda o tamanho do tabuleiro}
menuText B OptionsBoardPieces "Estilo de Pecas no Tabuleiro" 10 \
  {Muda o estilo das pecas mostradas no tabuleiro}
menuText B OptionsBoardColors "Cores..." 0 {Muda as cores do tabuleiro}
menuText B OptionsBoardNames "My Player Names..." 0 {Edit my player names} ;# ***
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 OptionsMovesAnimate "Animation time" 1 \
  {Set the amount of time used to animate moves} ;# ***
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
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 HelpContents "Contents" 0 {Show the help contents page} ;# ***
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 GInfoPhotos "Show Photos" 5 ;# ***
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.stm {Turn the side-to-move icon on or off} ;# ***
helpMsg B .button.autoplay {Jogo automatico  (tecla: Ctrl+Z)}

# General buttons:
translate B Back {Voltar}
translate B Browse {Browse} ;# ***
translate B Cancel {Cancelar}
translate B Clear {Limpar}
translate B Close {Fechar}
translate B Contents {Contents} ;# ***
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Average Rating} ;# ***
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}
translate B readonly {apenas leitura}

# Standard error messages:
translate B ErrNotOpen {This is not an open database.} ;# ***
translate B ErrReadOnly {This database is read-only; it cannot be altered.} ;# ***
translate B ErrSearchInterrupted {Search was interrupted; results are incomplete.} ;# ***

# 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}
translate B PInfoEditRatings {Edit Ratings} ;# ***

# 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}
translate B WinningMoves {Winning moves} ;# ***
translate B DrawingMoves {Drawing moves} ;# ***
translate B LosingMoves {Losing moves} ;# ***
translate B UnknownMoves {Unknown-result moves} ;# ***

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate B TreeTitleRow \
  {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws} ;# ***
translate B TreeTotal {TOTAL}

# 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}

# Player finder:
menuText B PListFile "Arquivo" 0
menuText B PListFileUpdate "Atualizar" 0
menuText B PListFileClose "Close Player Finder" 0 ;# ***
menuText B PListSort "Ordenar" 0
menuText B PListSortName "Name" 0 ;# ***
menuText B PListSortElo "Elo" 0
menuText B PListSortGames "Jogos" 0
menuText B PListSortOldest "Oldest" 0 ;# ***
menuText B PListSortNewest "Newest" 0 ;# ***

# 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}
translate B LowPriority {Low CPU priority} ;# ***

# 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 PgnFileCopy "Copy Game to Clipboard" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate B PgnWindowTitle {Game Notation - game %u} ;# ***

# 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}
translate B Category {Category} ;# ***

# 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 OprepFavorites "Favorites" 1 ;# ***
menuText B OprepFavoritesAdd "Add Report..." 0 ;# ***
menuText B OprepFavoritesEdit "Edit Report Favorites..." 0 ;# ***
menuText B OprepFavoritesGenerate "Generate Reports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Description} ;# ***
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:}
translate B InsertMark {Insert mark} ;# ***
translate B InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate B GoodMove {Good move} ;# ***
translate B PoorMove {Poor move} ;# ***
translate B ExcellentMove {Excellent move} ;# ***
translate B Blunder {Blunder} ;# ***
translate B InterestingMove {Interesting move} ;# ***
translate B DubiousMove {Dubious move} ;# ***
translate B WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate B BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate B WhiteClearAdvantage {White has a clear advantage} ;# ***
translate B BlackClearAdvantage {Black has a clear advantage} ;# ***
translate B WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate B BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate B Equality {Equality} ;# ***
translate B Unclear {Unclear} ;# ***
translate B Diagram {Diagram} ;# ***

# 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}

# Common endings in material search:
translate B EndingPawns {Pawn endings} ;# ***
translate B EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate B EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate B EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate B EndingRooks {Rook vs. Rook endings} ;# ***
translate B EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate B EndingRooksDouble {Double Rook endings} ;# ***
translate B EndingBishops {Bishop vs. Bishop endings} ;# ***
translate B EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate B EndingKnights {Knight vs. Knight endings} ;# ***
translate B EndingQueens {Queen vs. Queen endings} ;# ***
translate B EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate B BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate B PatternWhiteIQP {White IQP} ;# ***
translate B PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate B PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate B PatternBlackIQP {Black IQP} ;# ***
translate B PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate B PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate B PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate B PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate B PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate B PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate B PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate B PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate B PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate B PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {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 OprepMostFrequentOpponents {Most frequent opponents} ;# ***
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 OprepMostFrequentEcoCodes {Most frequent ECO codes} ;# ***
translate B OprepThemes {Temas Posicionais}
translate B OprepThemeDescription {Frequency of themes in the first %u moves of each game} ;# ***
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 OprepThemeWIQP {White Isolated Queen Pawn} ;# ***
translate B OprepThemeBIQP {Black Isolated Queen Pawn} ;# ***
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}
translate B OprepViewHTML {View HTML} ;# ***
translate B OprepViewLaTeX {View LaTeX} ;# ***

# Player Report:
translate B PReportTitle {Player Report} ;# ***
translate B PReportColorWhite {with the White pieces} ;# ***
translate B PReportColorBlack {with the Black pieces} ;# ***
translate B PReportMoves {after %s} ;# ***
translate B PReportOpenings {Openings} ;# ***
translate B PReportClipbase {Empty clipbase and copy matching games to it} ;# ***

# 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 [::utils::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.
}

# Sounds configuration:
translate B SoundsFolder {Sound Files Folder} ;# ***
translate B SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate B SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate B SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate B SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate B SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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} ;# ***

# My Player Names options:
translate B MyPlayerNamesDescription {
Enter a list of preferred player names below, one name per line. Wildcards (e.g. "?" for any single character, "*" for any sequence of characters) are permitted.

Every time a game with a player in the list is loaded, the main window chessboard will be rotated if necessary to show the game from that players perspective.
} ;# ***

}

# 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@skjoldebrand.org
# Thanks to: Hans Eriksson, for looking over the translation file

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 {ppna 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 (kortkommando: 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 fr att ska dubblettpartier}
menuText W FileMaintName "Stavningskontroll" 0 {Namnredigering och stavningskontroll}
menuText W FileMaintNameEditor "Redigera namn" 0 \
  {Redigera spelarnamn utifrn rttstavningsfilen}
menuText W FileMaintNamePlayer "Stavningskontrollera namn..." 22 \
  {Stavningskontrollera namn utifrn rttstavningsfilen}
menuText W FileMaintNameEvent "Stavningskontrollera evenemang..." 21 \
  {Stavningskontrollera evenemang 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 FileSwitch "Byt databas" 0 \
  {Byt till en annan ppnad databas} 
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 varianter frn partiet}
menuText W EditStripBegin "Avlgsna tidigare drag" 9 \
  {Avlgsna dragen fram till den aktuella stllningen} 
menuText W EditStripEnd "Avlgsna resterande drag" 0 \
  {Avlgsna partiets resterande drag} 
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 EditPastePGN "Klistra in Clipbasetext som PGNparti..." 10 \
  {Tolka Clipbasetexten som ett parti i PGN notation och klistra in det hr}
menuText W EditSetup "Skapa stllning..." 0 \
  {Skapa en utgngsstllning fr aktuellt parti}
menuText W EditCopyBoard "Kopiera stllning" 0 \
  {Kopiera den aktuella stllningen i FEN kod till urklippshanteraren} 
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 "Ladda parti slumpmssigt" 14 \
  {Ladda ett av datorn slumpmssigt valt parti} 
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 WindowsPList "Spelarfrteckning" 7 {ppna/ stng en frteckning ver spelarna i den aktiva databasen} 
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 "Repetoareditor" 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 "Filterdiagram" 7 \
  {ppna/ stng filterdiagramfnstret} 
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 ToolsPlayerReport "Spelarrapport..." 3 \
  {Skapa en spelarrapport}
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 OptionsBoard "Brdet" 0 {ndra brdets utseende}
menuText W OptionsBoardSize "Brdstorlek" 0 {ndra brdets storlek}
menuText W OptionsBoardPieces "Pjsutseende" 1 {ndra pjsernas utseende} 
menuText W OptionsBoardColors "Frger..." 0 {ndra brdets frger}
menuText W OptionsBoardNames "Spelarnamn..." 0 {Redigera spelares namn}
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 {ndra menytypsnittet}
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 OptionsMovesAnimate "Animation time" 1 \
  {Ange tid mellan varje drag nr dragen grs automatiskt}
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 OptionsSounds "Ljud..." 2 {Konfigurera ljud fr att annonsera drag}
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 "Senast anvnda filer..." 16 \
  {ndra antalet senast anvnda filer som visas i Arkivmenyn} 
menuText W OptionsSave "Spara alternativ" 7 \
  "Spara alla alternativ till en instllningsfil"
menuText W OptionsAutoSave "Autospara vid avslut" 1 \
  {Spara alla alternativ nr du avslutar Scid}

# Help menu:
menuText W Help "Hjlp" 0
menuText W HelpContents "Innehll" 0 {Visa innehll} 
menuText W HelpIndex "Index" 0 {Hjlpsystemets indexsida}
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 GInfoPhotos "Visa bilder" 5 ;
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  (kortkommando: Home)}
helpMsg W .button.end {G till slutet av partiet  (kortkommando: End)}
helpMsg W .button.back {Backa ett drag (kortkommando: Vnsterpil)}
helpMsg W .button.forward {G fram ett drag  (kortkommando: Hgerpil)}
helpMsg W .button.intoVar {G in i variant (kortkommando: v)}
helpMsg W .button.exitVar {G ur variant  (kortkommando: z)}
helpMsg W .button.flip {Rotera brdet  (kortkommando: .)}
helpMsg W .button.coords {Visa (inte) koordinater  (kortkommando: 0)}
helpMsg W .button.stm {Visa (inte) vilken sida som r vid draget}
helpMsg W .button.autoplay {Autospel  (kortkommando: Ctrl+Z)}

# General buttons:
translate W Back {Tillbaka}
translate W Browse {Blddra}
translate W Cancel {Avbryt}
translate W Clear {Rensa}
translate W Close {Stng}
translate W Contents {Innehll}
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Medelranking} 
translate W Event {Evenemang}
translate W Site {Plats}
translate W Country {Land}
translate W IgnoreColors {Ignorera frger}
translate W Date {Datum}
translate W EventDate {Evenemangsdatum}
translate W Decade {Decennium}
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}
translate W readonly {read-only} ;# ***

# Standard error messages:
translate W ErrNotOpen {Databasen r inte ppen.}
translate W ErrReadOnly {Databasen r skrivskyddad. Du kan inte ndra den.}
translate W ErrSearchInterrupted {Skningen avbrts; resultatet r inte fullstndigt.}

# 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}
translate W PInfoEditRatings {Redigera ranking} 

# 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}
translate W WinningMoves {Vinstdrag} 
translate W DrawingMoves {Remidrag} 
translate W LosingMoves {Frlustdrag} 
translate W UnknownMoves {Oknt resultat} 

# 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 bsta 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate W TreeTitleRow \
  { Drag      ECO     Frekvens      Res.    Elo~  Niv  r~   %Remi} 
translate W TreeTotal {TOTALT} 

# 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}

# Player finder:
menuText W PListFile "Fil" 0
menuText W PListFileUpdate "Uppdatera" 0
menuText W PListFileClose "Stng spelarfrteckningen" 1 
menuText W PListSort "Sortera" 0
menuText W PListSortName "Namn" 0
menuText W PListSortElo "Elo" 0
menuText W PListSortGames "Partier" 0
menuText W PListSortOldest "ldst" 0 
menuText W PListSortNewest "Yngst" 0

# 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 "Filterdiagram: antal per 1000 partier"

# 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}
translate W LowPriority {Kr som lgprioriterad process} 

# 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 PgnFileCopy "Kopiera partiet till urklippsdatabasen" 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 "Avlgsna koder fr frgade flt och pilar" 1 
menuText W PgnOptBoldMainLine "Anvnd Fet Text fr Huvudvariantdrag" 4
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
translate W PgnWindowTitle {PGN version av partiet %u} 

# 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}
translate W Category {Kategori} 

# 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 OprepFavorites "Favoriter" 1 
menuText W OprepFavoritesAdd "Lgg till rapport..." 0 
menuText W OprepFavoritesEdit "Redigera favoritrapport..." 0 
menuText W OprepFavoritesGenerate "Skapa rapport..." 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 ppningsrepetoaren..." 0
menuText W RepSearchDisplayed "Endast visade varianter..." 0
menuText W RepHelp "Hjlp" 0
menuText W RepHelpRep "Hjlp fr spelppningsrepetoar" 0
menuText W RepHelpIndex "Hjlpindex" 0
translate W RepSearch "Sk i spelppningsrepetoar"
translate W RepIncludedLines "inkluderade varianter"
translate W RepExcludedLines "exkluderade varianter"
translate W RepCloseDialog {Du har osparade ndringar i repetoaren.

Vill du verkligen fortstta och frlora dina frndringar?
}

# Header search:
translate W HeaderSearch {Sk i partihuvud}
translate W EndSideToMove {Sida vid draget vid slutet av partiet}
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 Description {Beskrivning} 
translate W Flag {Flagga}
translate W DeleteCurrent {Radera aktuellt parti}
translate W DeleteFilter {Radera partierna i filtret}
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 {Evenemang}
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 {Avlgsna PGN taggar}
translate W StripTag {Avlgsna taggar}
translate W Cleaner {Snygga till databasen}
translate W CleanerHelp {
Databasstdaren i Scid genomfr allt det underhll av databasen du vljer 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:}
translate W InsertMark {Infoga symbol} 
translate W InsertMarkHelp {
Infoga/ta bort markering: Vlj frg, typ av markering samt ruta .
Infoga/ta bort pil: Hger-klicka tv rutor.
}

# Nag buttons in comment editor:
translate W GoodMove {Bra drag}
translate W PoorMove {Dligt drag}
translate W ExcellentMove {Utmrkt drag}
translate W Blunder {Blunder}
translate W InterestingMove {Intressant drag}
translate W DubiousMove {Tveksamt drag}
translate W WhiteDecisiveAdvantage {Vit har en avgrande frdel}
translate W BlackDecisiveAdvantage {Svart har en avgrande frdel}
translate W WhiteClearAdvantage {Vit har en klar frdel}
translate W BlackClearAdvantage {Svart har en klar frdel}
translate W WhiteSlightAdvantage {Vit har en liten frdel}
translate W BlackSlightAdvantage {Svart har en liten frdel}
translate W Equality {Jmnvikt}
translate W Unclear {Oklar}
translate W Diagram {Diagram}

# 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}

# Common endings in material search:
translate W EndingPawns {Bondeslutspel}
translate W EndingRookVsPawns {Torn mot Bonde (Bnder)}
translate W EndingRookPawnVsRook {Torn och 1 Bonde mot Torn}
translate W EndingRookPawnsVsRook {Torn och Bonde (Bnder) mot Torn}
translate W EndingRooks {Torn mot Torn slutspel}
translate W EndingRooksPassedA {Torn mot Torn slutspel med en fri a-bonde}
translate W EndingRooksDouble {Dubbla Torn slutspel}
translate W EndingBishops {Lpare mot Lpare slutspel}
translate W EndingBishopVsKnight {Lpare mot Springare slutspel}
translate W EndingKnights {Springare mot Springare slutspel}
translate W EndingQueens {Dam mot Dam slutspel}
translate W EndingQueenPawnVsQueen {Dam och 1 Bonde mot Dam}
translate W BishopPairVsKnightPair {Tv Lpare mot Tv Springare mittspel}

# Common patterns in material search:
translate W PatternWhiteIQP {Vit Isolerad dambonde}
translate W PatternWhiteIQPBreakE6 {Vit Isolerad dambonde: d4-d5 brott mot e6}
translate W PatternWhiteIQPBreakC6 {Vit Isolerad dambonde: d4-d5 brott mot c6}
translate W PatternBlackIQP {Svart Isolerad dambonde}
translate W PatternWhiteBlackIQP {Vit Isolerad dambonde mot Svart Isolerad dambonde}
translate W PatternCoupleC3D4 {Vit c3+d4 Isolaterat Bondepar}
translate W PatternHangingC5D5 {Svart Hngande Bnder p c5 och d5}
translate W PatternMaroczy {Maroczy Center (med Bnder p c4 och e4)}
translate W PatternRookSacC3 {Tornoffer p c3}
translate W PatternKc1Kg8 {O-O-O mot O-O (Kc1 mot Kg8)}
translate W PatternKg1Kc8 {O-O mot O-O-O (Kg1 mot Kc8)}
translate W PatternLightFian {Ljus-Ruta Fianchetton (Lpare-g2 mot Lpare-b7)}
translate W PatternDarkFian {Mrk-Ruta Fianchetton (Lpare-b2 mot Lpare-g7)}
translate W PatternFourFian {Fyra Fianchettob (Lpare p b2,g2,b7,g7)}

# 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 EnPassantFile {En Passant 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 samtliga r}
translate W OprepSame {ingen frndring gentemot samtliga r}
translate W OprepMostFrequent {Spelas mest av}
translate W OprepMostFrequentOpponents {Vanligaste motstndaren}
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 genomsnittsranking}
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 OprepMostFrequentEcoCodes {De mest frekommande ECO-koderna}
translate W OprepThemes {Positionella teman}
translate W OprepThemeDescription {Temanfrekvens de frsta %u dragen av varje parti}
# 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 OprepThemeWIQP {Isolerad vit dambonde} 
translate W OprepThemeBIQP {Isolerad svart dambonde}
translate W OprepThemeWP567 {Vit 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}
translate W OprepViewHTML {Visa HTML}
translate W OprepViewLaTeX {Visa LaTeX}

# Player Report:
translate W PReportTitle {Spelarrapport} 
translate W PReportColorWhite {med de vita pjserna} 
translate W PReportColorBlack {med de svarta pjserna} 
translate W PReportMoves {efter %s} 
translate W PReportOpenings {ppningar} 
translate W PReportClipbase {Tm urklippsdatabasen och kopiera liknande partier dit} 


# 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 relaterade 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 partiet} 
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 [::utils::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.
}

# Sounds configuration:
translate W SoundsFolder {Ljudfilskatalog}
translate W SoundsFolderHelp {Katalogen ska ha filerna King.wav, a.wav, 1.wav, etc}
translate W SoundsAnnounceOptions {Instllningar fr Dragannonsering}
translate W SoundsAnnounceNew {Annonsera nya drag nr de grs}
translate W SoundsAnnounceForward {Annonsera drag nr gr fram ett drag}
translate W SoundsAnnounceBack {Annonsera drag nr gr fram eller tillbaka ett drag}

# 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 {Antal senast ppnade filer i Arkivmenyn}
translate W RecentFilesExtra {Antal senast ppnade filer i extra undermeny}

# My Player Names options:
translate W MyPlayerNamesDescription {
Ange en lista p dina favoritspelare hr nedanfr. Skriv ett namn per rad. Jokertecken ("?", t ex, motsvarar ett enstaka tecken medan "*" str fr flera tecken) r tilltna.

Varje gng ett parti med en spelare vars namn str i denna lista ppnas kommer brdet automatiskt att vridas s att partiet visas frn spelarens perspektiv.
} 

}


############################################################
#
# Swedish tips section:

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
    ser 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 evenemangsdatum och du vill ha partierna i 
    datumordning br du vervga att <a Sorting>sortera</a> den p evenemangsdatum i frsta hand och 
    evenemang 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+Mellanslag</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 versaler/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 exakt klassificerade stllningen fr det aktuella partiet
    genom att vlja <b>Identifiera ppning</b> i <b>Partier</b> menyn (kortkommando: 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 repetoire>repetoarfil</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 repetoarfil kan du genomska nya filer utifrn repetoarfilen, och titta 
    igenom alla partier med just dina ppningar.
  }
  {
    Genom att skapa en <a OpReport>ppningsrapport</a> har du en utmrkt 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 (kortkommando: 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>.
  }
{
  Du kan relativt enkelt rita pilar och frga rutor till dina kommentarer. ppna <b>Kommentarseditorn</b>, klicka p <b>Infoga symbol</b> och vlj nskad frg. Om du nu klicka p en frsta ruta, och drefter klickar p en andra s dras en pil i nskad frg frn den frsta till den andra rutan. Klickar du bara p en ruta, blir den frgad.
  }
}



############################################################
#
# Swedish help pages:

# Basic help pages completed, no links no other sections.

##########
# Contents
#
set helpTitle(W,Contents) "Innehllsfrteckning"
set helpText(W,Contents) {<h1>Hjlp med Scid: Innehllsfrteckning</h1>

<h3>Komma igng och allmnt om Scid</h3>
<h5>Under versttning</h5>
<p>Fljande texter och dess lnkar r under versttning. Detta pbrjades i Scid 3.4 beta 1. 
Detta betyder att menyerna r versatta. Rubriktexterna br kunna vara versatta till Scid 3.4 men alla lnkar
frn rubriktexterna r frmodligen inte det. /Martin S.</p>

<ul>
<li><a Guide><b>Komma igng</b> med Scid</a> <red>(Ls detta frst)</red></li>
<li><a Hints><b>Tips</b> om hur du fr ut mer av Scid</a></li>
<li><a MainWindow><b>Huvudfnstret</b></a></li>
<li><a Menus><b>Menyerna</b></a> <red>(uppdaterad!)</red></li>
<li><a Moves>Ange <b>drag</b></a> <red>(uppdaterad!)</red></li>
<li><a Searches><b>Ska</b> i Scid</a></li>
<li><a Clipbase>Att anvnda <b>Clipbase (urklippsdatabasen)</b></a></li>
<li><a Annotating><b>Kommentera partier</b></a> <red>(Ny!)</red></li>
</ul>


<h3>Other Scid windows</h3>
<h5>Ej versatta</h5>
<p>versttningen av fljande hjlpavsnitt har nnu (2002 07 27) inte pbrjats. Detta betyder att menyerna r p engelska, likas samtliga 
rubriktexter. Dremot <b>kan det hnda</b> att vissa lnktexter har versatts i samband med versttningen av fregende hjlpavsnitt. 
/Martin S.</p>

<ul>
<li><a Analysis><b>Analysis</b> window</a></li>
<li><a Comment><b>Comment editor</b> window</a></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></li>
<li><a Import><b>Import game</b> window</a></li>
<li><a OpReport><b>Opening Report</b> window</a></li>
<li><a PGN><b>PGN</b> (game text) window</a></li>
<li><a PTracker><b>Piece Tracker</b></a></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></li>
<li><a Tree><b>Tree</b> window</a></li>
<li><a Graphs><b>Graph</b> windows</a></li>
<li><a TB>Using <b>Tablebases</b> in Scid</a></li>
</ul>

<h3>Other utilities and information</h3>
<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> <red>(updated!)</red></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>(Uppdaterad: Scid 3.4, Juli 2002)</footer></p>
}
### Slut index


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

set helpTitle(W,Guide) "Komma igng med Scid"
set helpText(W,Guide) {<h1>Komma igng med Scid</h1>
<p>
Scid r en schackdatabashanterare som du kan anvnda till att blddra och <a Searches>ska</a> (enligt kriterier du stller upp) igenom 
databaser med schackpartier. Du kan ocks redigera de partier du vill.
</p>
<p>
Scid anvnder sitt eget <a Formats>database format</a> baserat p tre filer. Det r mycket kompakt och snabbt, men kan konvertera svl 
till som frn PGN (Portable Game Notation) standarden om man s nskar. Scids <a PGN>PGN fnster</a> visar texten till det aktuella
partiet i PGN format.
</p>
<p>
Du kan anvnda Scid till att lgga till och radera partier i en databas genom att anvnda svl mus som tangentbordet fr att skriva in
drag. Se vidare <a Moves>att skriva in drag</a> fr en noggrannare beskrivning.
</p>
<p>
Du kan ocks anvnda Scid fr att hantera <a PGN>PGN</a> filer genom att klistra in PGN-text i Scids <a Import>Importfnster</a> 
eller genom att ppna en PGN-fil i Scid. PGN-filer kan dock inte redigeras av Scid (de ppnas skrivskyddade). Eftersom PGN-filer
anvnder mer minne och laddas lngsammare rekommenderas du att konvertera stora PGN-filer till en Scid databas med verktyget
<a Pgnscid>pgnscid</a>.
</p>
<p>
Scids <a MainWindow>huvudfnster</a> (den med schackbrdet) visar det aktuella partiet och databasen i detalj. Du kan nr som helst ppna 
upp till fyra databaser (fem om du rknar med urklippsdatabasen <a Clipbase>clipbase</a>). Var och ett av dessa kommer att ha sitt eget aktuella
parti. (Partier med ID-numret 0 visar att detta r ett parti som nnu inte ingr i den aktuella databasen). Du blddrar mellan de ppnade databaserna
via <a Menus File>Filmenyn</a>.
</p>
<p>
Ls grna vriga hjlpsidor i <a Index>Innehllsfrteckningen</a> fr mer information.
</p>
<p>
Ls <a Author>kontaktinformationssidan</a> om du vill komma i kontakt med skaparen av Scid. Fr frgor om den svenska versttningen ska du
<b>inte</b> kontakta upphovsmannen utan istllet <a Translator>versttaren</a>.
</p>

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


set helpTitle(W,Author) "Kontaktinformation"
set helpText(W,Author) {<h1>Kontaktinformation</h1>
<p>
Scids webbsajt finns p: <br>
<b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>
</p>
<p>
Dr kan du hmta den senaste versionen av Scid och andra de filerna till Scid som du kan ha behov av.
</p>
<p>
Skicka grna kommentarer, frgor, frslag eller buggrapporter till Scids skapare, Shane Hudson, p adressen:<br>
<b>sgh@users.sourceforge.net</b>
</p>

<p>Den svenska versttningen av Scid har gjorts av Martin Skjldebrand. Synpunkter p versttningen ska <b>inte</b>
skickas till Shane. Dremot fr du grna skicka kommentarer, frgor och frslag till rttningar till versttaren p adressen:<br>
<b>martin@skjoldebrand.org</b>
</p>
}

####################
### Hints page:
set helpTitle(W,Hints) "Scid Tips"
set helpText(W,Hints) {<h1>Scid Tips</h1>
<p>
Denna sida innehller anvndbara tips i form av frgor och svar. Genom att lsa igenom denna sida, kan du senare komma att
anvnda Scid bttre. Om du nyligen brjat anvnda Scid, s ls till en brjan <a Guide>Kom igng</a>.
Det mesta av informationen p denna sida finns refererad mer utfrligt p andra sidor i hjlpen. Du finner dem i <a Index>innehllsfrteckningen</a>.
Om har ngot du tips du tycker passar bra fr denna sida, s skicka den till <a Author>upphovsmannen</a>.
</p>

<h4>Kan Scid ladda en databas nr den startas?</h4>
<p>
Ja, du kan ange databaser, PGN filer eller <a EPD>EPD filer</a>
p kommandoraden som t ex;
<ul>
<li> <b>scid  mybase  games.pgn.gz</b> </li>
</ul>
som laddar Scid databasen <b>mybase</b> och dessutom laddar den Gzip-komprimerade PGN filen <b>games.pgn.gz</b>.
</p>

<h4>Finns det enklare stt att ndra storleken p brdet n via Alternativmenyn?</h4>
<p>
Ja, du kan anvnda kortkommandorna <b>Ctrl+Shift+VnsterPil</b> och <b>Ctrl+Shift+HgerPil</b> fr att frminska eller 
frstora brdets storlek.
</p>

<h4>Jag brukar trna genom att spela igenom partier, s jag vill inte att Scid visar nsta drag i partiinformationen
nedanfr brdet. Kan jag dlja detta p ngot stt?</h4>
<p>
Du kan dlja nsta drag genom att hgerklicka partiinformationen och vlja  <b>Dlj nsta drag</b> i menyn som ppnas.
</p>

<h4>Var finner jag ECO-koden fr ppningen p brdet?</h4>
<p>
ECO-koden visas p sista raden i partiinformationen nedanfr brdet i  <a MainWindow>huvudfnstret</a>,
om du har laddat ECO klassificeringsfilen (<b>scid.eco</b>). <br>
Hjlpsidan fr <a ECO>ECO koder</a> frklarar hur man laddar ECO klassificeringsfilen och stller in programmet s att
den laddas varje gng man startar Scid.
</p>

<h4>Jag hller p och matar in ett parti och befinner mig nu vid drag 30. Nu ser jag att drag 10 blev fel. Hur kan jag ndra
detta utan att gra om alltihop?</h4>
<p>
Du kan anvnda <a Import>Importfnstret</a>; se vidare <a Moves Mistakes>mata in drag</a> fr mer information.
</p>

<h4>Hur kopierar jag partier frn en databas till en annan?</h4>
<p>
Anvnd <a Switcher>databasvxlaren</a>. Drag frn klldatabasen till mldatabasen s kopierar du allt i klldatabasen till
mldatabasen. Genom att anvnda <a Searches Filter>filter</a> kan du begrnsa det du kopierar frn den ena databasen till den andra.
</p>

<h4>Varje gng jag anger ett drag som redan finns fr jag frgan "Erstt drag?". Hur undviker jag detta?</h4>
<p>
Du kan antingen stnga av <b>Frga fre erstt drag</b> valmjligheten i menyn <menu>Altervativ: Drag</menu</menu>; eller
tnk p att gra ndringarna genom att ta tillbaka dragen genom att hgerklicka. Det senare alternativet raderar drag helt ur
partiet.
</p>

<h4>Hur ndrar kolumnbredden i partilistan?</h4>
<p>
Hger- eller vnsterklicka p kolumntiteln fr den kolumn du vill ndra.
</p>

<h4>Hur anvnder jag trdfnstret fr ett filtrerade partier - till skillnad mot att anvnda den fr hela databasen?</h4>
<p>
Anvnd <a Clipbase>urklippsdatabasen (Clipbase)</a>. Filtera databasen att visa endast de partier du vill anvnda i trdet, 
kopiera sedan partierna till urklippsdatabasen (Clipbase) via <a Switcher>databasvxlaren</a>. ppna drefter trdfnstret
med den senare databasen som aktiv.
</p>

<h4>Trdet r lngsamt nr jag jobbar med stora databaser. Gr det att snabba upp den?</h4>
<p>
Spara trdcachen ofta s sparar du resultaten fr framtida anvndning. Se vidare cache-sektionen i hjlpen fr 
<a Tree>trdet</a> fr mer detaljerad information.
</p>

<h4>Kan jag redigera PGN texten fr ett parti direkt?</h4>
<p>
Du kan inte anvnda <a PGN>PGN</a> fnstret till att redigera det aktuella partiet, dremot kan du anvnda 
<a Import>Importfnstret</a>. ppna fnstret (kortkommando: <b>Ctrl+Shift+I</b>) och klicka p klistra in aktuellt parti
<b>Paste current game</b>, redigera partiet och klicka sedan p <b>Importera</b>.
</p>

<h4>I min databas finns mnga spelarnamn som r felstavade. Hur rttar jag allt detta?</h4>
<p>
Du kan rtta enstaka namn, eller gra en stavningskontroll fr hela databasen via menyvalen i <menu>Arkiv: Databasverktyg</menu>.
Se vidare hjlpen fr <a Maintenance Editing>databasunderhll</a>.
</p>

<h4>Jag har tv databaser ppna: den ena innehller mina egna partier, den andra r en massor med stormstarpartier.
Hur jmfr jag ett av mina egna partier mot partierna i databasen med stormstarpartier?</h4>
<p>
ppna <a Tree>trdfnstret</a> i databasen med stormstarpartier och vlj <term>Ls</term> fr att lsa trdet i den databasen. 
Nr du sedan byter till den andra databasen kommer trdet att fortstta visa informationen frn databasen med stormstarpartier.
</p>

<p><footer>(Uppdaterad: Scid 2.6,  augusti 2001)</footer></p>
}


#################
# Authors, translators
#

set helpTitle(W,Translator) "Den svenska versttningen"
set helpText(W,Translator) {<h1>Den svenska versttningen</h1>
<p>
Scids webbsajt finns p: <br>
<b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>. Dr kan du hmta den senaste versionen av Scid och 
andra de filerna till programmet som du kan ha behov av. Dr finns ocks den senaste versionen av den svenska sprkfilen.
</p>
<p>Den svenska versttningen av Scid har gjorts av Martin Skjldebrand. Skicka grna kommentarer, frgor och frslag till rttningar
till versttaren p adressen:<br>
<b>martin@skjoldebrand.org</b>
</p>
}

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

set helpTitle(W,MainWindow) "Huvudfnstret"
set helpText(W,MainWindow) {<h1>Scid: huvudfnstret</h1>
<p>
P brdet i huvudfnstret visas den aktuella stllningen i det aktiva partiet. Du fr ocks information om partiet och den
aktiva databasen. Fr ytterligare information om <a Menus>menyerna</a> och olika stt att <a Moves>ange drag</a> hnvisas till
andra hjlpsidor.
</p>

<h3>Att navigera i partier</h3>
<p>
Navigationsknapparna vid brdet har fljande funktioner (frn vnster till hger):
<ul>
<li> <button tb_start> G till utgngsstllningen. </li>
<li> <button tb_prev> Tillbaka ett drag. </li>
<li> <button tb_next> Framt ett drag. </li>
<li> <button tb_end> G till slutstllningen. </li>
<li> <button tb_invar> G in i varianten. </li>
<li> <button tb_outvar> G ur varianten. </li>
<li> <button tb_addvar> Lgg till ny variant. </li>
<li> <button autoplay_off> Start/stopp fr autospelslge (se nedan). </li>
<li> <button tb_trial> Start/stopp fr <a Moves Trial>frskslge</a>. </li>
<li> <button tb_flip> Rotera brdet 180 grader. </li>
<li> <button tb_coords> Visa/dlj koordinater. </li>
</ul>

<h4><name Autoplay>Autospelslge</name></h4>
<p>
I autospelslge gr Scid automatiskt bda spelarnas drag i det aktuella partiet. Frdrjningen mellan varje drag kan anges i
menyn <menu>Alternativ: Drag</menu> och sparas nr du sparar ndringarna av instllningsmjligheterna.
</p>
<p>
Kortkommandot <b>Ctrl+Z</b> startar eller avbryter autospelslget. Du kan ocks g ur autospelslge genom att trycka
 <b>Esc</b> tangenten.
</p>
<p>
Om du startar autospelslge nr <a Analysis>analysfnstret</a> r ppet <term>kommenteras</term> partiet: stllningsbedmningen 
och analysen av varje stllning lggs till som en ny variant vid varje drag.
Se hjlpen fr <a Analysis>analysfnstret</a> fr mer information.
</p>

<h3>Partiinformation</h3>
<p>
Nedanfr brdet visas information om det aktuella partiet. Denna del av huvudskrmen kallas <term>partiinformationsomrdet</term>.
P de tre frsta raderna ges grundinformation ssom spelarnas namn, resultat, datum och spelplats. Den fjrde raden aktuell
stllning och nsta drag.
</p>
<p>
Rad fem visar <a ECO>ECO</a> (Encyclopedia of Chess
Openings) koden fr den aktuella stllningen, om stllningen ingr i den ECO-fil som anvnds.
</p>
<p>
Nr man hgerklickar p partiinformationsomrdet visas en meny med instllningsmjligheter som r relevanta just fr denna del av
programmet. Du kan t ex vlja att dlja nsta drag (anvndbart om du trnar genom att "gissa" nsta drag i  partiet) eller radera
/terta det aktuella partiet. Kortkommandot fr denna funktion r funktionsknappen F9.
</p>

<h4>Slutspelsdatabaser</h4>
<p>
Partiinformationsomrdet visar och resultaten frn slutspelsdatabaserna om du har ngra installerade och om stllningen terfinns 
i dessa. Se hjlpsidan fr <a TB>slutspelsdatabaser</a> fr mer information.
</p>

<h3>Statusraden</h3>
<p>
Statusraden (lngst ner i huvudfnstret) visar information om den aktuella databasen.
Det frsta fltet visar partiets status: <b>XX</b> betyder att det har frndrats men nnu inte sparats, medan <b>--</b> 
betyder att partiet inte har ndrats, <b>%%</b>, slutligen, betyder att databasen r skrivskyddad (det gr inte att ndra i partiet.).
</p>
<p>
Om du vill, kan du ppna databasen skrivskyddad. ndra rttigheterna till scid-filerna (eller enbart indexfilen) genom att i UNIX(-lika)
system ge kommandot:
<b>chmod a-w myfile.si3</b>
vid kommandoraden.
</p>
<p>
Statusraden visar ocks hur mnga partiet som ingr i det aktiva <a Searches Filter>filtret</a>.
</p>

<p><footer>(Uppdaterad: Scid 3.1, december 2001)</footer></p>
}

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

set helpTitle(W,Menus) "Menyerna"
set helpText(W,Menus) {<h1>Menyerna</h1>

<h3><name File>Arkiv</name></h3>
<ul>
<li><menu>Ny</menu>: Skapar en ny, tom, Scid databas.</li>
<li><menu>ppna</menu>: ppnar en befintlig Scid databas.</li>
<li><menu>Stng</menu>: Stnger den aktiva Scid databasen.</li>
<li><menu>Sk filer</menu>: ppna <a Finder>skdialogen</a> fr filer.</li>
<li><menu>Bokmrken</menu>: Hanterar <a Bookmarks>bokmrken</a>.</li>
	<ul>
	<li><menu>Nytt bokmrke</menu>: Markerar den aktiva stllningen i partiet som ett bokmrke.</li>
	<li><menu>Spara bokmrke</menu>: Sparar bokmrket fr den aktiva stllningen i partiet.</li>
	<li><menu>Redigera bokmrken</menu>: Redigerar dina bokmrken.</li>
	<li><menu>Visa bokmrken som lista</menu>: Visar bokmrkena som lista, inte undermenyer.</li>
	<li><menu>Visa bokmrken i undermenyer</menu>: Visar bokmrkena som undermenyer, inte lista.</li>
	</ul>
<li><menu>Databasverktyg</menu>: <a Maintenance>Underhll</a> databasen.</li>
	<ul>
	<li><menu>Verktygsfnster</menu>: ppna/ stng verktygsfnstret.</li>
	<li><menu>Komprimera databasen</menu>: Komprimera databasen, avlgsna raderade partier och oanvnda namn.</li>
	<li><menu>Klassificera partier enligt ECO</menu>: Klassificera alla partier enligt ECO-systemet.</li>
	<li><menu>Sortera databasen</menu>: Sortera partierna i den aktiva databasen.</li>
  	<li><menu>Radera dubbletter</menu>: Raderar <a Maintenance Twins>dubblettpartier</a> i databasen.</li>
	<li><menu>Sk dubbletter"</menu>: ppna/ stng dubblettfnstret fr att ska dubblettpartier.</li>
	<li><menu>Stavningskontroll</menu>: Namnredigering och stavningskontroll.</li>
		<ul>
		<li><menu>Redigera namn</menu>: Redigerar spelarnamn utifrn rttstavningsfilen.</li>
		<li><menu>Stavningskontrollera namn</menu>: Stavningskontrollera namn utifrn rttstavningsfilen.</li>
		<li><menu>Stavningskontrollera evenemang</menu>: Stavningskontrollera evenemang utifrn rttstavningsfilen.</li>
		<li><menu>Stavningskontrollera platser</menu>: Stavningskontrollera platser utifrn rttstavningsfilen.</li>
		<li><menu>Stavningskontrollera ronder</menu>: Stavningskontrollera ronder utifrn rttstavningsfilen.</li>
  		</ul>
	</ul>	
<li><menu>Skrivskyddad</menu>: Avlgsna temporrt redigeringsmjligheterna till databasen.</li>
<li><menu>Byt databas</menu>: Byt till en annan ppnad databas.</li>
	<ul>
		<li><menu>Base 1/2/3/4/5</menu>: Hr byter du mellan de olika databaserna i databasvxlarna, inklusive <a Clipbase>urklippsdatabasen</a>.</li>
	</ul>
<li><menu>Avsluta</menu>: Avslutar Scid. </li>
</ul>

<h3>Redigera</h3>
<ul>
<li><menu>Lgg till variant</menu>: Skapar en variant vid denna stllning. Antingen fr nsta drag, eller fr fregende drag om det r det frsta draget.</li>
<li><menu>Radera variant</menu>: Visar en undermeny med de raderbara varianterna.</li>
<li><menu>Skapa huvudvariant</menu>: Upphjer en av varianterna till huvudvariant.</li>
<li><menu>Skapa nytt textdrag</menu>: Gr en av varianterna till nytt partidrag.</li>
<li><menu>Testa en id</menu>: Slr p <a Moves Trial>testlge</a> fr att tillflligt testa en id. Frndrar inte partiet.</li>
<li><menu>Ta bort</menu>: Avlgsna kommentarer eller varianter ur partiet.</li>
<br>
<li><menu>Tm Clipbase</menu>: Tmmer den urklippsdatabasen <a Clipbase>clipbase</a> p partier.</li>
<li><menu>Kopiera partiet till Clipbase</menu>: Kopierar det aktuella partiet till urklippsdatabasen <a Clipbase>clipbase</a>.</li>
<li><menu>Klistra in det senaste Clipbasepartiet</menu>: Klistrar in det aktiva partiet i <a Clipbase>Clipbase</a> i den aktiva databasen och gr det aktivt.</li>
<br>
<li><menu>Skapa stllning</menu>: Skapa en utgngsstllning fr aktuellt parti.</li>
<li><menu>Kopiera stllning</menu>: Kopiera den aktuella stllningen i FEN kod till urklippshanteraren.</li>
<li><menu>Klistra in utgngsstllning</menu>: Klistra in stllningen frn aktuellt parti i den temporra databasen.</li>
</ul>

<h3>Partier</h3>
<ul>
<li><menu>Nytt parti</menu>: terstll brdet infr ett nytt parti (raderar alla ndringar).</li>
<li><menu>Ladda frsta/fregende/nsta/sista partiet</menu>: Dessa laddar respektive parti i <a Searches Filter>skfiltret</a>.</li>
<li><menu>Ladda om partiet</menu>: Laddar om aktuellt parti och slnger alla gjorda ndringar..</li>
<li><menu>Ladda parti slumpmssigt</menu>:  Ladda ett av datorn slumpmssigt valt parti.</li> 
<li><menu>Ladda parti nummer...</menu>: Ladda ett parti genom att ange dess nummer.</li>
<br>
<li><menu>Spara: Erstt parti...</menu>: Spara partiet och erstt tidigare version.</li>
<li><menu>Spara: Nytt parti...</menu>: Spara det aktuella partiet, lgg till det till databasen.</li>
<br>
<li><menu>Identifiera ppningen</menu>: G till den mest detaljerade stllningen i ECO boken.</li>
<li><menu>G till drag nummer...</menu>: G till ett specifikt drag i partiet.</li>
<li><menu>Hitta nyhet...</menu>: Hitta det frsta draget i partiet som inte spelats tidigare.</li>
</ul>

<h3>Sk</h3>
<ul>
<li><menu>terstll skfilter</menu>: terstller <a Searches Filter>skfiltret</a> s att alla partiet ingr i urvalet.</li>
<li><menu>Omvnt filter</menu>: Ta med de partier som utesluts av filtret.</li>
<br>
<li><menu>Aktuell stllning...</menu>: Sk partier med <a Searches Board>den aktuella stllningen</a> p brdet.</li>
<li><menu>I huvud...</menu>: Anvnd <a Searches Header>fast information</a> (spelare, evenemang, plats, mm).</li>
<li><menu>Material/stllning...</menu>: Skning baserad p <a Searches Material>material</a> eller <a Searches Pattern>stllning</a>.</li>
<br>
<li><menu>Anvnd skfil...</menu>: Anvnd en fil med <a Searches Settings>lagrade</a>.</li>
</ul>

<h3>Fnster</h3>
<ul>
<li><menu>Kommentarseditor</menu>: ppna/ stng <a Comment>kommentarseditorn</a>.</li>
<li><menu>Partilista</menu>: ppna/ stng <a GameList>partilistan</a>.</li>
<li><menu>PGN fnster</menu>: ppna/ stng <a PGN>PGN fnstret</a>.</li>
<li><menu>Spelarfrteckning</menu>: ppna/ stng en frteckning ver spelarna i den aktiva databasen.</li> 
<li><menu>Turneringar</menu>: Lista <a Tmt>turneringar</a>.</li>
<br>
<li><menu>Databasvxlaren</menu>: ppna/ stng <a Switcher>databasvxlaren</a>. Databasvxlaren underlttar byte mellan olika databaser
och kopiering av partier frn den ena databasen till den andra.</li>
<li><menu>Databasverktyg</menu>: ppna/ stng <a Maintenance>verktygsfnstret</a>.</li>
<br>
<li><menu>ECO fnster</menu>: ppna/ stng <a ECO browser>ECO blddraren</a>.</li>
<li><menu>Repetoareditor</menu>: ppna/ stng verktyget fr <a repetoire>spelppningshantering</a>.</li>
<li><menu>Statistikfnster</menu>: ppna/ stng <term>statistikfnstret</term>. Hr hittar en statistisk sammanfattning av partierna i  
 <a Searches Filter>skfiltret</a>.</li>
<li><menu>Trdfnster</menu>: ppna/ stng <a Tree>varianttrdet</a>.</li>
<li><menu>Slutspelsdatabas</menu>: ppna/ stng slutspelsdatabasfnstret som ger dig viss information om <a TB>slutspelsdatabaserna</a>.</li>
</ul>

<h3>Verktyg</h3>
<ul>
<li><menu>Analysmotor...</menu>: Starta/ stoppa en analysmotor, t ex Crafty, som kontinuerligt bedmmer den aktuella stllningen
p brdet i ett <a Analysis>analysfnster</a>.</li>
<li><menu>Analysmotor 2...</menu>: Starta/ stoppa en andra analysmotor, t ex Crafty.</li>
<li><menu>Resultattabell</menu>: Skapa en <a Crosstable>resultattabell</a> fr den aktuella turneringen/matchen som det aktuella partiet ingr i</li>
<li><menu>Eposthanteraren</menu>: ppna/ stng <a Email>eposthanteraren</a> fr hantering av korrespondensschack.</li>
<br>
<li><menu>ppningsrapport</menu>: Skapa en <a OpReport>ppningsrapport</a> utifrn den aktuella stllningen.</li>
<li><menu>Sk material</menu>: ppnar dialog fr att <a PTracker>ska efter en viss materiell balans</a>.</li>
<br>
<li><menu>Spelarinformation</menu>: Visa/ uppdatera <a PInfo>spelarinformation</a> fr den ene av tv spelare i det aktuella partiet.</li>
<li><menu>Rankingdiagram</menu>: Skapa ett <a Graphs Rating>ranking diagram</a> fr spelarna i partiet.</li>
<li><menu>Resultatdiagram</menu>: Visa <a Graphs Score>resultatdiagrammet</a>.</li>
<br>
<li><menu>Exportera aktuellt parti ...</menu>: Spara aktuellt parti till olika format; text, HTML eller LaTeX. Se vidare
   hjlpsidan fr  att <a Export>exportera</a> partier.</li>
<li><menu>Exportera alla filtrerade partier</menu>: Spara alla <a Searches Filter>filterade</a> partier till olika format; text, HTML eller LaTeX. Se vidare
   hjlpsidan fr  att <a Export>exportera</a> partier.</li>
<br>
<li><menu>Importera ett parti i PGN-format...</menu>: ppnar <a Import>Importfnstret</a> fr att ange eller klistra in ett parti i 
 <a PGN>PGN format</a> fr import till en Scid databas.</li>
<li><menu>Importera flera partier i PGN-format...</menu>: Importera flera partier i PGN-format frn en fil.</li>
</ul>

<h3>Alternativ</h3>
<p>
Denna meny ger tillgng till de flesta av de parametrar som styr hur Scid fungerar.
Menyvalet <menu>Spara alternativ</menu> sparar de aktuella instllningarna till filen
 "<b>~/.scid/scidrc</b>" (eller <b>scid.opt</b> i katalogen som innehller den exekverbara
scid-filen vad gller Windows); denna fil laddas varje gng du startar Scid.
</p>

<h3>Hjlp</h3>
<p>
Denna meny innehller hjlpfunktioner och ger tillgng till bl a fnstret "Dagens tips"
och startfnstret som informerar om vilka filer Scid laddat vid uppstart. 
</p>

<p><footer>(Uppdaterad: Scid 3.3, april 2002)</footer></p>
}

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

set helpTitle(W,Moves) "Ange drag"
set helpText(W,Moves) {<h1>Ange drag</h1>
<p>
I Scid, kan du ange partidrag svl med musen som med tangentbordet. Nr du rr musmarkren ver en ruta p
brdet kommer du att mrka att svl rutan som ytterligare en ruta fr en annan frg. Om det finns ett legalt
drag till eller frn den ruta du fr musmarkren ver. Detta r det <term>freslagna draget</term>.
Du utfr detta drag genom att <term>vnsterklicka</term> med musen. Om detta str dig kan du stnga av funktionen
i Alternativmenyn.

</p>
<p>
Fr att utfra ett annat drag kan du <term>klicka och hlla nere vnster</term> musknapp: flytta sedan musen till nskad
 ruta och slpp musknappen.
</p>
<p>
Om du vill kan du utfra drag genom att klicka tv gnger istllet fr att anvnda klicka-och-drag tekniken. Klicka d 
frst p utgngsrutan med den <term>mittersta musknappen</term> och klicka sedan med samma musknapp p destinationsrutan.
(Tipset gller kanske ffa anvndare av UNIX(-lika) system som ofta har stor nytta av 3-knappsmss).
</p>

<h4>Ta tillbaka ett drag</h4>
<p>
Man kan ta tillbaka ett drag genom att hgerklicka musen. Detta backar ett drag och raderar det senast utfrda draget i partiet
eller varianten.
</p>

<h4>Erstt tidigare drag</h4>
<p>
Om du anger ett drag i en stllning dr ett drag redan angivits kommer Scid att frga om du verkligen vill erstta den tidigare
draget (draget och alla varianter lngre fram som r beroende av draget tas bort), eller om du vill skapa en ny variant istllet.
En del anvnder tycker att frgan r strande och vill alltid erstta det tidigare draget, s man kan konfigurera Scid till att inte
stlla denna frga. Du hittar mjligheten i  menyn <menu>Alternativ: Drag</menu> "<i>Frga fre erstt drag</i>".
</p>

<h4><name Trial>Testlge</name></h4>
<p>
Om du gr igenom ett parti och kommer till en stllning dr du vill testa en id utan att pverka det registrerade partiet s vljer du
<b>Testa en id</b> frn menyn <menu>Redigera</menu> fr att stta p testlge. I testlge kan du gra drag och frndringar av partiet som
r temporra, dvs de sparas inte nr du tergr frn testlge.
</p>

<h3><name Mistakes>Rtta fel</name></h3>
<p>
Om du skriver in ett parti och pltsligt upptcker ett fel flera drag tidigare r det mjligt att rtta till detta utan att 
behva gra om alla drag efter feldraget. Det enda sttet r att redigera PGN-versionen av partiet: ppna <a Import>Importfnstret</a>, 
vlj Klistra in aktivt parti, korrigera felet och vlj drefter "Importera".
</p>

<h3>Ange drag via tangentbordet</h3>
<p>
Du kan ange drag via tangentbordet genom att helt enkelt skriva in dem med bokstver och siffror. Lgg mrke till att dragen
ska anges i <term>SAN notation</term>, <i>utan</i> (x) tecknet fr slag eller (=) tecknet fr promovering. Dragnotationen r 
inte versal/gemenknslig s t ex:
[n][f][3] r samma drag som Nf3 -- men kontrollera med noten nedan fr drag som str i konflikt med varandra.
</p>
<p>
Fr att skerstlla att inga drag r prefix fr ett annat drag s anvnds en srskild metod att ange rockad. Kort och lng rockad
representeras med hjlp av bokstver som fljer:
kort rockad anges med  [O][K]
lng rockad anges med [O][Q] istllet fr det vanliga O-O and O-O-O.
</p>
<p>
Nr du anger drag kommer du i statusraden att se en lista ver giltiga drag. Du kan, genom att trycka [mellanslag] vlja det frsta i listan och fra in det
i partiet. Fr att radera tecken anvnder du de vanliga raderingstangenterna.
</p>
<p>
<b>OBS</b> gemena tecken kopplas i frsta hand till bnder, vilket betyder att [b]kan betyda b-bonden istllet fr lparen (Bishop). Om du hamnar
i situationer nr konflikter uppstr mste du istllet ange pjserna med versaler (B) i detta fallet.
</p>
<b>versttarens kommentar</b> Scid frstr inte svenska. Detta betyder att du inte kan anvnda de svenska frkortningarna till att ange drag. [s][f][6] 
frsts inte av Scid (dremot funkar [n][f][6] utmrkt). Om du vill anvnda tangentbordet att skriva in drag fr du istllet anvnda notationen [g][8][f][6] fr
samma drag.
</p>
<h4>Autokomplettering</h4>
<p>
I Alternativmenyn kan du sl p eller av <term>Autokomplettering</term>
av drag.
Med denna pslagen grs draget s fort du skrivit in tillrckligt mycket fr att srskilja det frn andra mjliga drag. Exempelvis rcker det att skriva [n][f] istllet
fr [n][f][3] fr draget <b>Nf3</b>i utgngsstllningen.
</p>
<p><b>versttarens kommentar</b> Scid frstr som sagt inte svenska. Dremot fungerar det med rutangivelsen om t ex pjsen p g1 bara har ett flt 
att g till.</p>

<h3><name Null>Ange null-drag</name></h3>
<p>
<a Annotating Null>Null</a> (tomma, planerade) drag kan vara anvndbara i  kommentarer fr att hoppa ver den ena spelarens drag. Du anger null-drag
genom att sl den ena kungen med den andra, eller via tangentbordet genom att skriva  "<b>--</b>" (minustecknet tv gnger).
</p>
<p><b>versttarens kommentar</b> "null" r en dataterm fr att beskriva ingenting (till skillnad mot noll som har ett vrde om dock noll, null har inget vrde).
Shane anvnder termen null hr, ngon som har frslag p bttre i den svenska versttningen? Kolla intro sidan fr att fresl ngot.</p>

<h3>Ange de vanligaste kommentarsymbolerna</h3>
<p>
Du kan ven ange <a NAGs>kommentarsymboler</a> via tangentbordet utan att behva anvnda <a Comment>kommentarseditorn</a>. 
Fljande lista kan anges via tangentbordet:
<ul>
<li> !	: [!][ENTER] </li>
<li> ?	: [?][ENTER] </li>
<li> !?	: [!][?][ENTER] </li>
<li> ?!	: [?][!][ENTER] </li>
<li> !!	: [!][!][ENTER] </li>
<li> ??	: [?][?][ENTER] </li>
<li> </li>
<li> +-	: [+][-] </li>
<li> +/-	: [+][/] </li>
<li> +=	: [+][=] </li>
<li> =	: [=][ENTER] </li>
<li> -+	: [-][+] </li>
<li> -/+	: [-][/] </li>
<li> =+	: [=][+] </li>
</ul>

<p><footer>(Uppdaterad: Scid 3.4,  juli 2002)</footer></p>
}


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

set helpTitle(W,Searches) "Ska i Scid"
set helpText(W,Searches) {<h1>Ska i Scid</h1>
<p>
I Scid kan man ska information p flera olika stt. 
Det finns tre huvudmetoder att anvnda sig av beroende p vilken typ av information man
r ute efter:
<ul>
<li><b>1)</b> utifrn den aktuella stllningen p brdet, </li>
<li><b>2)</b> utifrn specifikt material eller en specifik stllningstyp; och </li>
<li><b>3)</b> utifrn fast information, t ex spelare, ort, resultat eller datum. </li>
</ul>
<p>
Utver dessa metoder kan man anvnda sig av en automatisk skfunktion, <a Tree>trdfnstret</a>, som frklaras
separat.
</p>

<h3><name Filter>Skfiltret</name></h3>
<p>
Skningar baseras i  Scid p <term>filter</term>.
Ett filter representerar en delmngd av den aktiva databasen. Vid varje specifikt tillflle kommer ett parti att antingen vara
del av denna delmngd (filtret) eller uteslutas av detta. I varje typ av skning (se ovan) kan du vlja att begrnsa, utka eller
ignorera det aktiva filtret och istllet ska i hela databasen. Detta gr att man stegvis kan bygga komplicerade skningar. 
Du kan ocks kopiera alla filtrerade partier frn den ena databasen till den andra genom att anvnda <a Switcher>databasvxlaren</a>.
</p>

<p>
Nr du sker p exakt stllning, <a Tree>trd</a> eller material/stllningstyp, sparas dragnumret i den frsta stllningen och varje
parti med identisk stllning lagras i minnet s att man, nr man senare laddar de framskta partierna, automatiskt kommer till den stllning
som var av intresse (som skningen grundades p).
</p>
<p>
<b>OBS</b> skningen gller endast textdragen, inte varianterna.
</p>

<h3><name Board>Sk: Aktuell stllning</name></h3>
<p>
Med denna metod hittas partier med samma stllning som det p brdet i huvudfnstret. Rockadmjligheter och 
rttigheter att gra <i>en passant</i> ignoreras. Det finns fyra undertyper att vlja p, samtliga krver att stllningen har exakt samma material och spelare vid draget fr att en trff ska
anses ha intrffat:
<ul>
<li> [1] exakt (de bda stllningarna mste vara exakt lika), </li>
<li> [2] bnder (bondestrukturen mste vara identisk, men de vriga pjsernas placering kan variera), </li>
<li> [3] linjer (antalet vita och svarta bnder p varje linje mste vara identisk - i vrigt kan pjsplaceringen variera), och slutligen; </li>
<li> [4] material (bnder och pjser kan st var som helst p brdet.). </li>
</ul>
<p>
Att ska p bondestllning r anvndbart nr man studerar spelppningar med likartad bondstruktur, medan att ska p linjer och material r lmpliga metoder
att finna liknande stllningar i slutspel. Nr man sker p specifika stllningar kan man skapa den frst (frn menyvalet <menu>Redigera: Skapa stllning</menu>) och starta skningen drifrn.
(Man kan naturligtvis ocks spela upp stllningen p brdet, <i>vers anm</i>).
</p>
<p>
Du kan ange att skningen ven ska leta i varianter (istllet fr att bara inkludera de egentliga partidragen) genom att markera kryssrutan <b>Sk i varianter</b>, 
men detta kan gra skningen lngsammare om databasen r stor och har mnga partier med varianter.
</p>

<h3><name Material>Sk: Material/stllningstyp</name></h3>
<p>
Denna skning r anvndbar nr man vill finna slut- eller mittspelsteman. Du kan specificera minimalt och maximalt antal av varje pjstyp, och hitta stllningar
av typen "Lpare p f7" eller "Bonde p f-linjen". Det finns ett antal vanliga stllningstyper frdefinierade, t ex "Torn och Bondeslutspel" eller "Isolerade d-bnder".
</p>
<p>
<b>Tips:</b><br>
Tidstgngen fr denna typ av skning kan variera kraftigt. Man kan minska tiden som behvs genom att anvnda sig av frnuftiga begrnsningar.
Om man, som exempel,  vill underska slutspel. kan man stta det minimala antalet drag partiet ska innehlla till 20. D kommer alla partier 
med frre n 20 drag att ignoreras.
</p>

<h3><name Header>Sk: fasta uppgifter ("header search")</name></h3>
<p>
Denna skning anvnds fr att finna aspekter p partier som lagras i partiets huvud (jmf eposthuvud) ssom datum, resultat, plats och rankingtal. Den
krver ingen avkodning av dragen i partiet. Fr att en trff ska registreras krvs att alla flt du specificerar stmmer verens. Namnflten  (Vit, Svart, 
Evenemang, Plats och Rond) r versal/gementoleranta. Trffar registrerars p all text i dessa flt och mellanslag ignoreras .
</p>
<p>
Du kan generera exakta skningar och anvnda jokertecken i huvudflten som nmnts ovan. Jokertecknet  <b>?</b> betyder "ett
valfritt tecken" medan <b>*</b> betyder "inget eller flera valfria tecken". Man genererar exakta skningar genom att innesluta den text man
nskar hitta i citattecken ("). Exempel:
</p>

<p>
En skning p platsen <b>USA</b> kommer att generera amerikanska stder, men ven <b>Lausanne SUI</b>, vilket du frmodligen inte var ute efter! 
Detta lser man genom att istllet ska efter platsen <b>"*USA"</b> (notera citattecknen) som endast kommer att presentera stder i USA.</p>
<p>
Om du sker efter en srskild spelare (eller tv srskilda spelare) som vit eller svart och det inte spelar ngon roll vet som har vilken frg vljer du med 
frdel <b>Ignorera frg</b> i stllet fr svart/vit i frgangivelsen.
</p>
<p>
Avslutningsvis kan fasta skningar gras fr att hitta valfri text (versal/gemen intolerant och utan jokertecken) i PGN versionen av partierna. Du kan
ange upp till tre textstrngar, och alla mste finnas i ett parti fr att de ska rknas som en trff. Denna skning r mycket anvndbar nr det gller
kommentarsfltet eller extra mrkord i partierna (exempelvis  <b>frlorar p tid</b> eller <b>Kommentator</b>), eller fr en dragfljd som 
<b>Bxh7+</b> och <b>Kxh7</b> nr en lpare har offrats (och accepterats) p h7.

Tnk dock p att denna typ av skningar kan vara <i>mycket</i> tidskrvande eftersom alla partier som mter vissa kriterier mste avkodas och
genomskas efter textstrngen/-arna. Det r drfr en bra ide att begrnsa denna typ av skning s mycket som mjligt. Exempel:
</p>

<p>
Fr att hitta partier med underpromovering till torn sker man p <b>=R</b> och stter <b>Frvandlingar</b> flaggan till Ja.
Fr att hitta text i kommentarer stter du flaggan <b>Kommentarer</b> till Ja.
Om du sker p dragen <b>Bxh7+</b> och <b>Kxh7</b>, kan det vara en ide att begrnsa partierna till de som har resultatet  1-0 result och innehller
minst 20 halvdrag. Eller gr en Material/Stllningstypsskning fr att hitta partier dr lparen flyttas till h7.
</p>

<h3><name Settings>Spara skkriterierna</name></h3>
<p>
I Material/Stllningstyp and Huvudskningsfnstrena finns valet att  
<term>Spara instllningarna</term>. Detta ger dig mjligheten att spara de aktuella skkriterierna fr senare anvndning.
Kriterierna sparas till en <term>skningsfil</term> med filndelsen  .sso. Fr att teranvnda en tidigare sparad skningfil
vljer du <menu>ppna ...</menu> frn menyn <menu>Sk</menu>.
</p>

<h3>Sktider och ignorerade partier</h3>
<p>
De flesta skningar meddelar en hur lng tid skningen tog och hur mnga partier som <term>ignorerades</term>. Ignorerade partier
r de som exkluderats frn en skning utan att ngot av dess drag har avkodats (frn Scids databasformat). Detta baseras p information
som lagrats i index. Se vidare hjlpfilen om <a Formats>filformat</a> fr ytterligare information. 
</p>

<p><footer>(Uppdaterad: Scid 3.0, november 2001)</footer></p>
}

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

set helpTitle(W,Clipbase) "Urklippsdatabasen"
set helpText(W,Clipbase) {<h1>Urklippsdatabasen</h1>
<p>
Frutom de databaser du ppnar sjlv, ppnar Scid ytterligare en - <term>urklippsdatabasen</term>. Urklippsdatabasen,
fungerar precis som alla andra databaser, med ett undantag. Den existerar bara i datorns arbetsminne och sparar inte data
ngonstans permanent. Urklippsdatabasen tms sledes nr du stnger av datorn.
</p>
<p>
Urklippsdatabasen r anvndbar som en tillfllig lagringsplats, fr att sl samman skresultat frn olika databaser, eller fr att man dr
kan behandla resultat frn en skning som en egen databas. 
</p>
<p>
Antag, exempelvis, att du vill frbereda dig fr en srskild motstndare. Du har skt igenom databasen efter partier av denne dr motstndaren
spelar vit. Kopiera alla partier i <a Searches Filter>skfiltret</a> till urklippsdatabasen. Du kan gra det genom att i <a Switcher>databasvxlaren</a>
 dra dem frn deras ordinarie databas till urklippsdatabasen. Drefter kan du ppna urklippsdatabasen och underska partierna i  <a Tree>trdfnstret</a>, 
till exempel fr att kartlgga motstndarens ppningsrepetoar.
</p>
<p>
Observera att du kan kopiera partier frn en databas till en annan utan att anvnda urklippsdatabasen som mellanlagringsplats. Notera ocks att
urklippsdatabasen <i>inte</i> kan stngas via menyvalet <menu>Arkiv: Stng</menu>medan du r i urklippsdatabasen. Det som hnder d r
motsvarigheten till  <menu>Redigera: terstll urklippsdatabasen</menu>, dvs databasen tms.
</p>
<p>
Du kan maximalt ha 20,000 partier i minnet samtidigt.
</p>

<p><footer>(Uppdaterad: Scid 2.5,  juni 2001)</footer></p>
}

#################################
### Variations and comments help:

set helpTitle(W,Annotating) "Kommentera partier"
set helpText(W,Annotating) {<h1>Kommentera partier</h1>
<p>
I Scid kan lgga till noter till partierna. Det finns tre typer av anteckningar du kan lgga till till varje drag:
symboler, kommentarer och varianter.
</p>

<h3>Symboler och kommentarer</h3>
<p>
Symboler anvnds fr stllningsbedmningar om vem som str bst (t ex "+-" eller "=") , om draget som just gjordes var bra eller dligt
(t ex "!" eller "?") medan kommentarer kan best av valfri text. Fr att lgga till symboler och kommentarer anvnder man
<a Comment>kommentarseditorn</a>. Det finns ocks en srskild hjlpsida fr <a NAGs>standardsymbolerna</a>.
</p>
<p>
Tnk p att ven om varje drag kan ha fler symboler, kan det bara ha en kommentar. En kommentar fr frsta draget skrivs ut som 
text fre partidragen. 
</p>

<h3><name Vars>Varianter</name></h3>
<p>
En <term>variant</term> r en alternativ fortsttning av partiet som skulle ha kunnat utfras vid ngot
tillflle i partiet. Varianter kan innehlla kommentarer, symboler och varianter. Knappen mrkt "<b>V</b>" 
ovanfr brdet i huvudfnstret, samt valmjligheter frn menyn <menu>Redigera</menu> kan anvndas till att skapa,
navigera i och redigera varianter.
</p>

<h4>Kortkommandon</h4>
<p>
Nr det finns varianter till ett drag visas dem i partiinformationsomrdet. Den frsta varianten r <b>v1</b>, den andra
r <b>v2</b>, osv. Fr att flja en variant kan man klicka p den, eller trycka  "<b>v</b>" fljt av variantens nummer 
(Om det bara finns en variant rcker det med att trycka <b>v</b>.). Kortkommandot fr att g ur en variant r "<b>z</b>".
</p>

<h3><name Null>Null-drag</name></h3>
<p>
Det kan ibland vara anvndbart att hoppa ver drag i varianter. Du kan exempelvis till draget 14.Bd3 lgga till en variant och
nmna att det hotar 15.Bxh7+ Kxh7 16.Ng5+ med angrepp. Du kan ocks gra detta genom att anvnda <term>null-drag</term>
mellan 14.Bd3 och 15.Bxh7+, i exemplet ovan. Ett null-drag visas som "<b>--</b>" och infogas genom att med musen utfra det
ogiltiga draget att med kungen sl den andra kungen, eller att helt enkelt skriva in "<b>--</b>" (tv minustecken).
</p>
<p>
Observera att null-drag inte ingr i PGN standarden, s om du vill exportera partier som innehller null-drag till en PGN-fil mste du 
vlja mellan att bevara null-dragen(-t) eller konvertera dem till kommentarer fr att bibehlla exportmjligheter till andra
program. Se hjlpsidan fr att <a Export>exportera</a> partier fr mer information.
</p>

<p><footer>(Uppdaterad: Scid 3.4, juli 2002)</footer></p>
}


# 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 FileSwitch "Switch to database" 0 \
  {Switch to a different opened database} ;# ***
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 EditStripBegin "Moves from the beginning" 1 \
  {Strip moves from the beginning of the game} ;# ***
menuText O EditStripEnd "Moves to the end" 0 \
  {Strip moves to the end of the game} ;# ***
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText O EditSetup "Still opp stilling..." 0 \
  {Lag en startstilling for dette partiet}
menuText O EditCopyBoard "Copy position" 6 \
  {Copy the current board in FEN notation to the text selection (clipboard)} ;# ***
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 WindowsPList "Player Finder" 2 {Open/close the player finder} ;# ***
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 ToolsPlayerReport "Player Report..." 3 \
  {Generate a player report} ;# ***
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 OptionsBoard "Chessboard" 0 {Chess board appearance options} ;# ***
menuText O OptionsBoardSize "Brettstrrelse" 0 {Endre brettstrrelse}
menuText O OptionsBoardPieces "Brikkeutseende" 6 \
  {Endrer utseendet p brikkene}
menuText O OptionsBoardColors "Farger..." 0 {Endre farger p brettet}
menuText O OptionsBoardNames "My Player Names..." 0 {Edit my player names} ;# ***
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 OptionsMovesAnimate "Animation time" 1 \
  {Set the amount of time used to animate moves} ;# ***
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
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 HelpContents "Contents" 0 {Show the help contents page} ;# ***
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 GInfoPhotos "Show Photos" 5 ;# ***
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.stm {Turn the side-to-move icon on or off} ;# ***
helpMsg O .button.autoplay {Automatisk spill (tast: Ctrl+Z)}

# General buttons:
translate O Back {Tilbake}
translate O Browse {Browse} ;# ***
translate O Cancel {Avbryt}
translate O Clear {Slett}
translate O Close {Lukk}
translate O Contents {Contents} ;# ***
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Average Rating} ;# ***
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}
translate O readonly {skrivebeskyttet}

# Standard error messages:
translate O ErrNotOpen {This is not an open database.} ;# ***
translate O ErrReadOnly {This database is read-only; it cannot be altered.} ;# ***
translate O ErrSearchInterrupted {Search was interrupted; results are incomplete.} ;# ***

# 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}
translate O PInfoEditRatings {Edit Ratings} ;# ***

# 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}
translate O WinningMoves {Winning moves} ;# ***
translate O DrawingMoves {Drawing moves} ;# ***
translate O LosingMoves {Losing moves} ;# ***
translate O UnknownMoves {Unknown-result moves} ;# ***

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate O TreeTitleRow \
  {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws} ;# ***
translate O TreeTotal {SAMMENLAGT}

# 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}

# Player finder:
menuText O PListFile "Fil" 0
menuText O PListFileUpdate "Oppdater" 0
menuText O PListFileClose "Close Player Finder" 0 ;# ***
menuText O PListSort "Sorter" 0
menuText O PListSortName "Name" 0 ;# ***
menuText O PListSortElo "Elo" 0
menuText O PListSortGames "Partier" 0
menuText O PListSortOldest "Oldest" 0 ;# ***
menuText O PListSortNewest "Newest" 0 ;# ***

# 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}
translate O LowPriority {Low CPU priority} ;# ***

# 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 PgnFileCopy "Copy Game to Clipboard" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate O PgnWindowTitle {Game Notation - game %u} ;# ***

# 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}
translate O Category {Category} ;# ***

# 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 OprepFavorites "Favorites" 1 ;# ***
menuText O OprepFavoritesAdd "Add Report..." 0 ;# ***
menuText O OprepFavoritesEdit "Edit Report Favorites..." 0 ;# ***
menuText O OprepFavoritesGenerate "Generate Reports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Description} ;# ***
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:}
translate O InsertMark {Insert mark} ;# ***
translate O InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate O GoodMove {Good move} ;# ***
translate O PoorMove {Poor move} ;# ***
translate O ExcellentMove {Excellent move} ;# ***
translate O Blunder {Tabbe}
translate O InterestingMove {Interesting move} ;# ***
translate O DubiousMove {Dubious move} ;# ***
translate O WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate O BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate O WhiteClearAdvantage {White has a clear advantage} ;# ***
translate O BlackClearAdvantage {Black has a clear advantage} ;# ***
translate O WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate O BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate O Equality {Equality} ;# ***
translate O Unclear {Unclear} ;# ***
translate O Diagram {Diagram} ;# ***

# 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}

# Common endings in material search:
translate O EndingPawns {Pawn endings} ;# ***
translate O EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate O EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate O EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate O EndingRooks {Rook vs. Rook endings} ;# ***
translate O EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate O EndingRooksDouble {Double Rook endings} ;# ***
translate O EndingBishops {Bishop vs. Bishop endings} ;# ***
translate O EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate O EndingKnights {Knight vs. Knight endings} ;# ***
translate O EndingQueens {Queen vs. Queen endings} ;# ***
translate O EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate O BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate O PatternWhiteIQP {White IQP} ;# ***
translate O PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate O PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate O PatternBlackIQP {Black IQP} ;# ***
translate O PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate O PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate O PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate O PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate O PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate O PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate O PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate O PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate O PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate O PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {En Passant-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 OprepMostFrequentOpponents {Most frequent opponents} ;# ***
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 OprepMostFrequentEcoCodes {Most frequent ECO codes} ;# ***
translate O OprepThemes {Stillingstemaer}
translate O OprepThemeDescription {Frequency of themes in the first %u moves of each game} ;# ***
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 OprepThemeWIQP {White Isolated Queen Pawn} ;# ***
translate O OprepThemeBIQP {Black Isolated Queen Pawn} ;# ***
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}
translate O OprepViewHTML {View HTML} ;# ***
translate O OprepViewLaTeX {View LaTeX} ;# ***

# Player Report:
translate O PReportTitle {Player Report} ;# ***
translate O PReportColorWhite {with the White pieces} ;# ***
translate O PReportColorBlack {with the Black pieces} ;# ***
translate O PReportMoves {after %s} ;# ***
translate O PReportOpenings {Openings} ;# ***
translate O PReportClipbase {Empty clipbase and copy matching games to it} ;# ***

# 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 [::utils::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.}

# Sounds configuration:
translate O SoundsFolder {Sound Files Folder} ;# ***
translate O SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate O SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate O SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate O SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate O SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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} ;# ***

# My Player Names options:
translate O MyPlayerNamesDescription {
Enter a list of preferred player names below, one name per line. Wildcards (e.g. "?" for any single character, "*" for any sequence of characters) are permitted.

Every time a game with a player in the list is loaded, the main window chessboard will be rotated if necessary to show the game from that players perspective.
} ;# ***

}

# 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 aktywn 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 FileSwitch "Przecz baz" 1 \
  {Przecz na inn otwart baz} 
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 EditStripBegin "Poprzednie posunicia" 0 \
  {Usu wszystkie posunicia do biecej pozycji}
menuText P EditStripEnd "Nastpne posunicia" 0 \
  {Usu wszystkie posunicia od biecej pozycji do koca 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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText P EditSetup "Ustaw pozycj pocztkow..." 6 \
  {Ustaw pozycj pocztkow partii}
menuText P EditCopyBoard "Kopiuj pozycj" 7 \
  {Kopiuj aktualn pozycj w notacji FEN do schowka}
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 {Wczytaj pierwsz parti z filtra}
menuText P GamePrev "Poka poprzedni parti" 0 \
  {Wczytaj poprzedni wyszukan parti}
menuText P GameReload "Przeaduj aktualn parti"  10 \
  {Wczytaj parti ponownie, rezygnujc z wszelkich zmian}
menuText P GameNext "Nastpna partia" 0 \
  {Wczytaj nastpn wyszukan parti}
menuText P GameLast "Ostatnia partia" 5 {Wczytaj ostatni parti z filtra}
menuText P GameRandom "Losowa partia z filtra" 8 {Wczytaj losow parti z filtra}
menuText P GameNumber "Wczytaj parti numer..." 17 \
  {Wczytaj 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 WindowsPList "Zawodnicy" 2 {Otwrz/zamknij przegldark zawodnikw}
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 "Wykres filtra" 7 \
  {Otwrz/zamknij wykres filtra}
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 ToolsPlayerReport "Raport o graczu..." 9 \
  {Utwrz raport o graczu} 
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 "Wklej parti w formacie PGN..." 0 \
  {Pobierz parti z pliku PGN}
menuText P ToolsImportFile "Importuj plik PGN..." 2 \
  {Pobierz partie z pliku PGN}

menuText P Options "Opcje" 0
menuText P OptionsBoard "Szachownica" 0 {Konfiguracja wygldu szachownicy}
menuText P OptionsBoardSize "Wielko" 0 {Zmie wielko szachownicy}
menuText P OptionsBoardPieces "Typ figur" 4 \
  {Zmienia typ wyswietlanych figur} 
menuText P OptionsBoardColors "Kolory..." 0 {Zmie kolory szachownicy}
menuText P OptionsBoardNames "Moje nazwiska" 0 {Modyfikuj list moich graczy}
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 {Zmie czcionk menu} 
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 OptionsMovesAnimate "Szybko animacji" 1 \
  {Ustaw czas przeznaczony na animacj jednego posunicia} 
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
menuText P OptionsToolbar "Pasek narzdziowy" 6 \
  {Schowaj/poka pasek narzdziowy}
menuText P OptionsECO "Wczytaj ksik debiutow..." 16 \
  {Wczytaj plik z klasyfikacja debiutw}
menuText P OptionsSpell "Wczytaj plik sprawdzania pisowni..." 13 \
  {Wczytaj 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 "Ostatnie pliki..." 0 \
  {Zmie liczb ostatnio otwartych plikw, wywietlanych w menu Plik} 
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 HelpContents "Contents" 0 {Poka spis treci pomocy} 
menuText P HelpIndex "Spis treci" 0 {Poka indeks 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 GInfoPhotos "Poka zdjcia" 5
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 {Przecz wywietlanie opisu szachownicy  (klawisz skrtu: 0)}
helpMsg P .button.stm {Przecz wywietlanie ikony koloru strony na posuniciu} 
helpMsg P .button.autoplay \
  {Automatyczne przestawianie bierek (klawisz skrtu: Ctrl+Z)}

# General buttons:
translate P Back {Z powrotem}
translate P Browse {Przegldaj}
translate P Cancel {Anuluj}
translate P Clear {Wyczy}
translate P Close {Zamknij}
translate P Contents {Spis treci}
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {redni ranking}
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 {Dekada} 
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}
translate P readonly {tylko do odczytu}

# Standard error messages:
translate P ErrNotOpen {To nie jest otwarta baza.} 
translate P ErrReadOnly {Ta baza jest tylko do odczytu; nie mona jej zmieni.}
translate P ErrSearchInterrupted {Wyszukiwanie zostao przerwane. Wyniki bd niepene.}

# 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}
translate P PInfoEditRatings {Modyfikuj rankingi} 

# 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}
translate P WinningMoves {Wygrywajce posunicia}
translate P DrawingMoves {Remisujce posunicia} 
translate P LosingMoves {Przegrywajce posunicia} 
translate P UnknownMoves {Posunicia o nieznanej ocenie} 

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate P TreeTitleRow \
  {    Pos.   ECO       Czsto     Wynik  Rav   Rperf Rok   %Remis}
# {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws}
translate P TreeTotal {RAZEM}

# 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}

# Player finder:
menuText P PListFile "Plik" 0
menuText P PListFileUpdate "Uaktualnij" 0
menuText P PListFileClose "Zamknij przegldark zawodnikw" 0
menuText P PListSort "Sortowanie" 0
menuText P PListSortName "Nazwisko" 0
menuText P PListSortElo "Elo" 0
menuText P PListSortGames "Partie" 0
menuText P PListSortOldest "Najstarsza" 0
menuText P PListSortNewest "Najnowsza" 0

# 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 "Wielko listy"
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 "Filtr: czsto na 1000 partii" 

# 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}
translate P LowPriority {Niski priorytet CPU} 

# 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 PgnFileCopy "Kopiuj parti do schowka" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate P PgnWindowTitle {Game Notation - game %u} ;# ***

# 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}
translate P Category {Kategoria} 

# 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 OprepFavorites "Ulubione" 1 
menuText P OprepFavoritesAdd "Dodaj raport..." 0 
menuText P OprepFavoritesEdit "Modyfikuj ulubione..." 0
menuText P OprepFavoritesGenerate "Twrz raporty..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Opis} 
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 {Usu znaczniki PGN} 
translate P StripTag {Usu znacznik}
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:}
translate P InsertMark {Wstaw znak}
translate P InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate P GoodMove {Good move} ;# ***
translate P PoorMove {Poor move} ;# ***
translate P ExcellentMove {Excellent move} ;# ***
translate P Blunder {Podstawka}
translate P InterestingMove {Interesting move} ;# ***
translate P DubiousMove {Dubious move} ;# ***
translate P WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate P BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate P WhiteClearAdvantage {White has a clear advantage} ;# ***
translate P BlackClearAdvantage {Black has a clear advantage} ;# ***
translate P WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate P BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate P Equality {Equality} ;# ***
translate P Unclear {Unclear} ;# ***
translate P Diagram {Diagram} ;# ***

# 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 filtra)}
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}

# Common endings in material search:
translate P EndingPawns {Pawn endings} ;# ***
translate P EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate P EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate P EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate P EndingRooks {Rook vs. Rook endings} ;# ***
translate P EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate P EndingRooksDouble {Double Rook endings} ;# ***
translate P EndingBishops {Bishop vs. Bishop endings} ;# ***
translate P EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate P EndingKnights {Knight vs. Knight endings} ;# ***
translate P EndingQueens {Queen vs. Queen endings} ;# ***
translate P EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate P BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate P PatternWhiteIQP {White IQP} ;# ***
translate P PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate P PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate P PatternBlackIQP {Black IQP} ;# ***
translate P PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate P PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate P PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate P PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate P PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate P PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate P PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate P PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate P PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate P PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {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 {Gracze najczciej stosujcy wariant}
translate P OprepMostFrequentOpponents {Przeciwnicy} 
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 OprepMostFrequentEcoCodes {Najczstsze kody ECO} 
translate P OprepThemes {Motywy pozycyjne}
translate P OprepThemeDescription {Czsto motyww w pierwszych %u posuniciach partii} 
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 OprepThemeWIQP {Izolowany pion biaych} 
translate P OprepThemeBIQP {Izolowany pion czarnych}
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}
translate P OprepViewHTML {rdo HTML} 
translate P OprepViewLaTeX {rdo LaTeX} 

# Player Report:
translate P PReportTitle {Raport o graczu}
translate P PReportColorWhite {with the White pieces} ;# ***
translate P PReportColorBlack {with the Black pieces} ;# ***
translate P PReportMoves {po %s}
translate P PReportOpenings {Debiuty}
translate P PReportClipbase {Wyczy schowek i skopiuj do niego wybrane partie}

# 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
 [::utils::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.
}

# Sounds configuration:
translate P SoundsFolder {Sound Files Folder} ;# ***
translate P SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate P SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate P SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate P SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate P SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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 {Liczba ostatnich plikw w menu Plik} 
translate P RecentFilesExtra {Liczba ostatnich plikw w dodatkowym podmenu} 

# My Player Names options:
translate P MyPlayerNamesDescription {
Podaj list preferowanych nazwisk graczy, po jednym w wierszu. W nazwiskach mona stosowa znaki specjalne (np. "?" - dowolny znak, "*" - dowolna sekwencja znakw).

Wszystkie partie grane przez jednego z graczy z listy bd wywietlane z jego perspektywy.
}

}

### 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 and help for Scid.
# Contributed by Pavel Hanak and Vlastimil Babula
# 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" 2 {Otevt okno vyhledvae soubor}
menuText C FileBookmarks "Zloky" 2 {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" 9 \
  {Zobrazit zlokov sloky jako podnabdky, ne jako jedin seznam}
menuText C FileMaint "drba" 2 {Nstroje pro drbu databze Scidu}
menuText C FileMaintWin "Okno drby" 0 \
  {Otevt/zavt okno pro drbu Scid databze}
menuText C FileMaintCompact "Kompaktovn databze..." 13 \
  {Kompaktovn databzovch soubor, odstrann vymazanch parti a nepouvanch jmen}
menuText C FileMaintClass "ECO klasifikace parti..." 0 \
  {Pepotn ECO kd vech parti}
menuText C FileMaintSort "Setdit databzi..." 0 \
  {Setdit vechny partie v databzi}
menuText C FileMaintDelete "Vymazn 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..." 19 \
  {Kontrola pravopisu jmen hr s vyuitm souboru pro kontrolu pravopisu}
menuText C FileMaintNameEvent "Kontrola pravopisu turnaj..." 19 \
  {Kontrola pravopisu nzv turnaj s vyuitm souboru pro kontrolu pravopisu}
menuText C FileMaintNameSite "Kontrola pravopisu mst..." 19 \
  {Kontrola pravopisu mst turnaj s vyuitm souboru pro kontrolu pravopisu}
menuText C FileMaintNameRound "Kontrola pravopisu kol..." 19 \
  {Kontrola pravopisu kol s vyuitm souboru pro kontrolu pravopisu}
menuText C FileReadOnly "Pouze pro ten..." 0 \
  {Nastavit aktuln databzi jako jen ke ten, a zabrnit tak zmnm}
menuText C FileSwitch "Pepnout se do databze" 15 \
  {Pepnout se do jin oteven databze}
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" 0 {Vymazat variantu k tomuto tahu}
menuText C EditFirst "Zaadit jako prvn variantu" 0 \
  {Zaadit variantu na prvn msto v seznamu variant}
menuText C EditMain "Povit stvajc variantu na hlavn" 30 \
  {Povit stvajc variantu na hlavn variantu}
menuText C EditTrial "Zkusit variantu" 1 \
    {Spustit/Ukonit zkuebn md pro testovn mylenky na achovnici}
menuText C EditStrip "Odstranit" 0 {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 EditStripBegin "Tahy ze zatku" 5 \
  {Odstranit tahy ze zatku partie}
menuText C EditStripEnd "Tahy do konce" 5 \
  {Odstranit tahy do konce partie}
menuText C EditReset "Vyprzdnit schrnku" 11 \
  {Kompletn vyprzdnn databze schrnka}
menuText C EditCopy "Zkoprovat tuto partii do schrnky" 23 \
  {Zkoprovat tuto parti do databze schrnka}
menuText C EditPaste "Vloit posledn partii ze schrnky" 24 \
  {Vloit aktivn partii z databze schrnka}
menuText C EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText C EditSetup "Nastavit vchoz pozici..." 0 \
  {Nastavit vchoz pozici pro tuto partii}
menuText C EditCopyBoard "Koprovat pozici" 4 \
  {Koprovat aktuln pozici ve FEN notaci do textovho vbru (do clipboardu)}
menuText C EditPasteBoard "Vloit poten pozici" 1 \
  {Nastavit poten pozici z aktulnho textovho vbru (z clipboardu)}

# 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" 10 {Nathnout prvn partii z filtrovanch parti}
menuText C GamePrev "Nathnout pedchoz partii" 13 {Nathnout pedchoz partii z filtrovanch parti}
menuText C GameReload "Znovunathnout aktuln partii" 0 \
  {Znovunataen aktuln partie, vechny doposud proveden zmny budou ztraceny}
menuText C GameNext "Nathnout nsledujc partii" 14 {Nathnout nsledujc partii z filtrovanch parti}
menuText C GameLast "Nathnout posledn partii" 11 {Nathnout posledn partii z filtrovanch parti}
menuText C GameRandom "Nathnout partii nhodn" 1 {Nathnout nhodn vybranou partii z filtru}
menuText C GameNumber "Nathnout partii slo..." 19 \
  {Nathnout partii slo...}
menuText C GameReplace "Uloit: pepsn partie..." 0 \
  {Uloit tuto partii - pepe pvodn verzi}
menuText C GameAdd "Uloit: pidn nov partie..." 1 \
  {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..." 10 \
  {Pejt v aktuln partii do pozice udan slem tahu}
menuText C GameNovelty "Hledat novinku..." 0 \
  {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..." 0 {Hledat podle hlaviky partie (hr, turnaj apod.)}
menuText C SearchMaterial "Materil/Vzor..." 0 {Hledat podle materilu nebo podle vzoru}
menuText C SearchUsing "Hledat pomoc souboru voleb..." 14 {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" 2 {Otevt/zavt okno se seznamem parti}
menuText C WindowsPGN "Okno PGN" 5 {Otevt/zavt okno PGN}
menuText C WindowsPList "Vyhledva hr" 11 {Otevt/zavt okno vyhledvae hr}
menuText C WindowsTmt "Vyhledva turnaj" 11 {Otevt/zavt okno vyhledvae turnaj}
menuText C WindowsSwitcher "Vbr databze" 0 {Otevt/zavt okno pro vbr databz}
menuText C WindowsMaint "Okno drby" 6 {Otevt/zavt okno drby}
menuText C WindowsECO "ECO prohle" 1 {Otevt/zavt okno ECO prohlee}
menuText C WindowsRepertoire "Editor repertoru" 7 {Otevt/zavt editor repertoru zahjen}
menuText C WindowsStats "Statistick okno" 0 {Otevt/zavt statistick okno filtru}
menuText C WindowsTree "Stromov okno" 4 {Otevt/zavt stromov okno}
menuText C WindowsTB "Okno tabulky koncovek" 13 {Otevt/zavt okno tabulek koncovek}

# Tools menu:
menuText C Tools "Nstroje" 3
menuText C ToolsAnalysis "Program pro analzu..." 0 \
  {Spustit/zastavit achov program pro analzu pozice}
menuText C ToolsAnalysis2 "Program pro analzu #2..." 20 \
  {Spustit/zastavit druh achov program pro analzu pozice}
menuText C ToolsCross "Turnajov tabulka" 0 {Ukzat turnajovou tabulku pro tuto partii}
menuText C ToolsEmail "Email manaer" 1 \
  {Otevt/zavt okno emailovho manaera}
menuText C ToolsFilterGraph "Graf filtru" 0 \
  {Otevt/zavt okno grafu filtru}
menuText C ToolsOpReport "Profil zahjen" 7 \
  {Generovat profil zahjen pro aktuln pozic}
menuText C ToolsTracker "Stopa figur"  0 {Otevt okno stopae figur}
menuText C ToolsPInfo "Informace o hrch"  0 \
  {Otevt/aktualizovat okno s informacemi o hrch}
menuText C ToolsPlayerReport "Profil hre..." 7 \
  {Generovat profil hre}
menuText C ToolsRating "Graf ratingu" 5 \
  {Zobrazit graf vvoje ratingu hr aktuln partie}
menuText C ToolsScore "Graf skre" 6  {Zobrazit okno grafu skre}
menuText C ToolsExpCurrent "Export aktuln partie" 7 \
  {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..." 30 \
  {Zapsat vechny filtrovan partie do PGN souboru}
menuText C ToolsExpFilterHTML "Export filtrovanch parti do HTML souboru..." 30 \
  {Zapsat vechny filtrovan partie do HTML souboru}
menuText C ToolsExpFilterLaTeX "Export filtrovanch parti do LaTeX souboru..." 30 \
  {Zapsat vechny filtrovan partie do LaTeX souboru}
menuText C ToolsImportOne "Import jedn PGN partie..." 7 \
  {Importovat partii z PGN zpisu}
menuText C ToolsImportFile "Import souboru PGN parti..." 10 \
  {Importovat partie z PGN souboru}

# Options menu:
menuText C Options "Volby" 0
menuText C OptionsBoard "achovnice" 1 {Volby zobrazen achovnice}
menuText C OptionsBoardSize "Velikost achovnice" 0 {Zmnit velikost achovnice}
menuText C OptionsBoardPieces "Styl figur" 0 \
  {Zmnit styl zobrazen figur}
menuText C OptionsBoardColors "Barvy..." 0 {Zmnit barvy achovnice}
menuText C OptionsBoardNames "Jmna mch hr..." 0 {Editovat jmna mch hr}
menuText C OptionsExport "Volby exportu" 7 {Zmnit volby pro textov export}
menuText C OptionsFonts "Fonty" 2 {Zmnit fonty}
menuText C OptionsFontsRegular "Zkladn" 0 {Zmnit zkladn font}
menuText C OptionsFontsMenu "Menu" 1 {Zmnit font pro menu}
menuText C OptionsFontsSmall "Mal" 0 {Zmnit mal font}
menuText C OptionsFontsFixed "Fixn" 0 {Zmnit font fixn ky}
menuText C OptionsGInfo "Informace o partii" 0 {Volby pro informace o partii}
menuText C OptionsLanguage "Jazyk" 0 {Vybrat jazyk menu}
menuText C OptionsMoves "Tahy" 0 {Volby pro zadvn tah}
menuText C OptionsMovesAsk "Ptt se ped nahrazenm tah" 0 \
  {Ptt se vdy ped pepsnm existujcho tahu}
menuText C OptionsMovesAnimate "as animace" 4 \
  {Nastavit as pouit na animaci tah}
menuText C OptionsMovesDelay "Prodleva pi automatickm pehrvn..." 1 \
  {Nastavit asovou prodlevu pi automatickm pehrvn}
menuText C OptionsMovesCoord "Souadnicov zadvn tah" 0 \
  {Povolit zadvn tah pomoc souadnic (nap. "g1f3")}
menuText C OptionsMovesSuggest "Ukzat navrhovan tahy" 0 \
  {Zapnout/vypnout zobrazovn navrhovanch tah}
menuText C OptionsMovesKey "Klvesnicov doplovn" 13 \
  {Zapnout/vypnout automatick doplovn tah zadvanch klvesnic}
menuText C OptionsNumbers "Formt sel" 0 {Zvolit formt sel}
menuText C OptionsStartup "Pi sputn" 4 {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" 15 \
  {Dt do poped jist okna, jsou-li zakryt}
menuText C OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
menuText C OptionsToolbar "Nstrojov lita..." 11 \
  {Konfigurovat nstrojovou litu hlavnho okna}
menuText C OptionsECO "Nathnout ECO soubor..." 10 {Nathnout soubor s klasifikac ECO}
menuText C OptionsSpell "Nathnout soubor pro kontrolu pravopisu..." 21 \
  {Nathnout soubor Scidu pro kontrolu pravopisu}
menuText C OptionsTable "Adres pro tabulky koncovek..." 14 \
  {Vybrat soubor s tabulkami koncovek; vechny tabulky koncovek v jeho adresi budou pouity}
menuText C OptionsRecent "Nedvn soubory..." 0 \
  {Zmnit poet nedvnch soubor zobrazovanch v menu Soubor}
menuText C OptionsSave "Uloit volby" 0 \
  "Uloit vechny nastaviteln volby do souboru $::optionsFile"
menuText C OptionsAutoSave "Automaticky ukldat volby pi ukonen" 20 \
  {Automaticky ukldat vechny volby pi ukonen Scidu}

# Help menu:
menuText C Help "Npovda" 0
menuText C HelpContents "Obsah" 0 {Zobrazit strnku npovdy s obsahem}
menuText C HelpIndex "Index" 0 {Zobrazit strnku npovdy s indexem}
menuText C HelpGuide "Rychl prvodce" 7 {Zobrazit strnku npovdy s rychlm prvodcem}
menuText C HelpHints "Rady" 0 {Zobrazit strnku npovdy s radami}
menuText C HelpContact "Kontakt" 0 {Zobrazit strnku npovdy s kontaktnmi informacemi}
menuText C HelpTip "Tip dne" 4 {Zobrazit uiten tip Scidu}
menuText C HelpStartup "Startovac okno" 0 {Zobrazit startovac okno}
menuText C HelpAbout "O aplikaci Scid" 2 {Informace o aplikaci Scid}

# Game info box popup menu:
menuText C GInfoHideNext "Skrt nsledujc tah" 0
menuText C GInfoMaterial "Ukzat hodnoty materilu" 15
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" 15
menuText C GInfoPhotos "Zobrazit fotky" 10
menuText C GInfoTBNothing "Tabulky koncovek: nic" 19
menuText C GInfoTBResult "Tabulky koncovek: jen vsledek" 23
menuText C GInfoTBAll "Tabulky koncovek: vsledek a nejlep tahy" 39
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: ipkaVlevo)}
helpMsg C .button.forward {Jdi o jeden tah dopedu  (klvesa: ipkaVpravo)}
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.stm {Zapnout/Vypnout zobrazovn ikony strany, kter je na tahu}
helpMsg C .button.autoplay {Automatick pehrvn tah  (klvesa: Ctrl+Z)}

# General buttons:
translate C Back {Zpt}
translate C Browse {Prohlet}
translate C Cancel {Zruit}
translate C Clear {Vyistit}
translate C Close {Zavt}
translate C Contents {Obsah}
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Prmrn rating}
translate C Event {Turnaj}
translate C Site {Msto}
translate C Country {Zem}
translate C IgnoreColors {Ignorovat barvy}
translate C Date {Datum}
translate C EventDate {Datum turnaje}
translate C Decade {Dekda}
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}
translate C readonly {read-only} ;# ***

# Standard error messages:
translate C ErrNotOpen {To nen oteven databze.}
translate C ErrReadOnly {Tato databze je jen ke ten; neme bt zmnna.}
translate C ErrSearchInterrupted {Hledn bylo perueno; vsledky nejsou kompletn.}

# 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 tah}
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 {Vsledky proti}
translate C PInfoMostWhite {Nejastj zahjen za bl}
translate C PInfoMostBlack {Nejastj zahjen za ern}
translate C PInfoRating {Historie ratingu}
translate C PInfoBio {Biografie}
translate C PInfoEditRatings {Editovat ratingy}

# 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}
translate C WinningMoves {vyhrvajc tahy}
translate C DrawingMoves {remizujc tahy}
translate C LosingMoves {prohrvajc tahy}
translate C UnknownMoves {tahy s neznmm vsledkem}

# 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 \
  {Uloit stromov cache (.stc) soubor}
menuText C TreeFileFill "Naplnit cache soubor" 0 \
  {Naplnit cache soubor nejbnjmi pozicemi zahjen}
menuText C TreeFileBest "Seznam nejlepch parti" 0 {Zobrazit seznam nejlepch parti  stromu}
menuText C TreeFileGraph "Okno grafu" 0 {Zobrazit graf pro tuto vtev stromu}
menuText C TreeFileCopy "Koprovat text stromu do clipboardu" 0 \
  {Koprovat stromov statistiky do textovho vbru}
menuText C TreeFileClose "Zavt stromov okno" 0 {Zavt stromov okno}
menuText C TreeSort "adit" 2
menuText C TreeSortAlpha "Abecedn" 0
menuText C TreeSortECO "ECO kd" 0
menuText C TreeSortFreq "Frekvence" 0
menuText C TreeSortScore "Skre" 0
menuText C TreeOpt "Volby" 0
menuText C TreeOptLock "Zamknout" 0 {Zamknout/Odemknout strom k aktuln databzi}
menuText C TreeOptTraining "Trnink" 0 {Zapnout/Vypnout stromov trninkov md}
menuText C TreeOptAutosave "Automatick ukldn cache souboru" 0 \
  {Automatick ukldn cache souboru pi uzaven stromovho okna}
menuText C TreeHelp "Npovda" 0
menuText C TreeHelpTree "Npovda - Strom" 11
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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate C TreeTitleRow \
  {    Tah    ECO       Frekvence    Skre  PrElo Perf  PrRok %remz}
translate C TreeTotal {CELKEM}

# 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" 2
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 "Databze Scidu" 0
menuText C FinderTypesOld "Databze Scidu starho formtu" 15
menuText C FinderTypesPGN "PGN soubory" 0
menuText C FinderTypesEPD "EPD soubory" 0
menuText C FinderTypesRep "Repertorov soubory" 0
menuText C FinderHelp "Npovda" 0
menuText C FinderHelpFinder "Npovda - Vyhledva soubor" 11
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}

# Player finder:
menuText C PListFile "Soubor" 0
menuText C PListFileUpdate "Aktualizovat" 0
menuText C PListFileClose "Zavt vyhledva hr" 0
menuText C PListSort "adit" 2
menuText C PListSortName "Jmno" 0
menuText C PListSortElo "ELO" 0
menuText C PListSortGames "Partie" 0
menuText C PListSortOldest "Nejstar" 3
menuText C PListSortNewest "Nejnovj" 3

# Tournament finder:
menuText C TmtFile "Soubor" 0
menuText C TmtFileUpdate "Aktualizovat" 0
menuText C TmtFileClose "Zavt vyhledva soubor" 0
menuText C TmtSort "adit" 2
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 "Prmrn ELO"
translate C TmtNone "dn odpovdajc turnaje nebyly nalezeny."

# Graph windows:
menuText C GraphFile "Soubor" 0
menuText C GraphFileColor "Uloit jako barevn Postscript..." 12
menuText C GraphFileGrey "Uloit jako ernobl Postscript..." 13
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" 0
menuText C GraphOptionsPInfo "Informace o hri" 0
translate C GraphFilterTitle "Graf filtru: etnost na 1000 parti"

# 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}
translate C LowPriority {Nzk CPU priorita}

# 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 PgnFileCopy "Koprovat partii do clipboardu" 0
menuText C PgnFilePrint "Vytisknout do souboru..." 0
menuText C PgnFileClose "Zavt okno PGN" 0
menuText C PgnOpt "Zobrazit" 0
menuText C PgnOptColor "Barevn zobrazen" 0
menuText C PgnOptShort "Krtk (tdkov) hlavika" 20
menuText C PgnOptSymbols "Symbolick anotace" 0
menuText C PgnOptIndentC "Odsazovat komente" 10
menuText C PgnOptIndentV "Odsazovat varianty" 10
menuText C PgnOptColumn "Sloupcov styl (jeden tah na dek)" 1
menuText C PgnOptSpace "Mezera za slem tahu" 0
menuText C PgnOptStripMarks "Odstranit kdy barevnch pol a ipek" 0
menuText C PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
menuText C PgnColor "Barvy" 0
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 "Npovda - Okno PGN " 16
menuText C PgnHelpIndex "Index npovdy" 0
translate C PgnWindowTitle {Game Notation - game %u} ;# ***

# 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 turnajov tabulky" 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 "Kad s kadm" 0
menuText C CrosstabOptSwiss "vcarsk systm" 3
menuText C CrosstabOptKnockout "Vyazovac" 4
menuText C CrosstabOptAuto "Auto" 0
menuText C CrosstabOptAges "Vk" 0
menuText C CrosstabOptNats "Nrodnost" 0
menuText C CrosstabOptRatings "Rating" 0
menuText C CrosstabOptTitles "Titul" 0
menuText C CrosstabOptBreaks "Vsledky tie-breaku" 10
menuText C CrosstabOptDeleted "Vetn vymazanch parti" 9
menuText C CrosstabOptColors "Barvy (jen pro vcarsk systm)" 0
menuText C CrosstabOptColumnNumbers "slovan sloupce (jen v tabulkch 'kad s kadm')" 3
menuText C CrosstabOptGroup "Skupiny podle skre" 0
menuText C CrosstabSort "adit" 2
menuText C CrosstabSortName "Jmno" 0
menuText C CrosstabSortRating "Rating" 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 - Turnajovou tabulku" 11
menuText C CrosstabHelpIndex "Index npovdy" 0
translate C SetFilter {Nastavit filtr}
translate C AddToFilter {Pidat do filtru}
translate C Swiss {vcarsk systm}
translate C Category {Kategorie}

# 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 profilem" 0
menuText C OprepFavorites "Oblben" 0
menuText C OprepFavoritesAdd "Pidat profil..." 0
menuText C OprepFavoritesEdit "Editovat oblben profily..." 0
menuText C OprepFavoritesGenerate "Generovat profil..." 0
menuText C OprepHelp "Npovda" 0
menuText C OprepHelpReport "Npovda - Profil zahjen" 11
menuText C OprepHelpIndex "Index npovdy" 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..." 7
menuText C RepFileClose "Zavt okno" 0
menuText C RepEdit "Editace" 0
menuText C RepEditGroup "Pidat skupinu" 0
menuText C RepEditInclude "Zahrnout variantu" 0
menuText C RepEditExclude "Vylouit variantu" 0
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 - Repertor" 11
menuText C RepHelpIndex "Index npovdy" 0
translate C RepSearch "Repertorov vyhledvn"
translate C RepIncludedLines "zahrnut varianty"
translate C RepExcludedLines "vylouen varianty"
translate C RepCloseDialog {Tento repertor obsahuje neuloen zmny.

Opravdu chcete pokraovat a zruit vechny zmny, kter jste uinili?
}

# Header search:
translate C HeaderSearch {Hledat podle hlaviky}
translate C EndSideToMove {Side to move at end of game} ;# ***
translate C GamesWithNoECO {Partie bez ECO?}
translate C GameLength {Dlka Partie}
translate C FindGamesWith {Najt partie s pznaky}
translate C StdStart {Nestandardn start}
translate C Promotions {Promny}
translate C Comments {Komente}
translate C Variations {Varianty}
translate C Annotations {Anotace}
translate C DeleteFlag {Mazac pznak}
translate C WhiteOpFlag {Zahjen blho}
translate C BlackOpFlag {Zahjen ernho}
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 {Brilantn}
translate C BlunderFlag {Hrubka}
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 {Datum turnaje}
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 ratingu:}
translate C Description {Popis}
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 filtrovan partie po vymazn}
translate C UndeleteAll {Obnovit vechny partie 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 {Kompaktovat databzi}
translate C SortDatabase {adit databzi}
translate C AddEloRatings {Pidat ELO rating}
translate C AutoloadGame {Automaticky otevrat partii .}
translate C StripTags {Odstranit PGN znaky}
translate C StripTag {Odstranit znaku}
translate C Cleaner {itn databze}
translate C CleanerHelp {
    itnm 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 drbskmi funkcemi, kter jste zvolili?
}

# Comment editor:
translate C AnnotationSymbols  {Anotan symboly:}
translate C Comment {Koment:}
translate C InsertMark {Vloit znaku}
translate C InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate C GoodMove {Good move} ;# ***
translate C PoorMove {Poor move} ;# ***
translate C ExcellentMove {Excellent move} ;# ***
translate C Blunder {Hrubka}
translate C InterestingMove {Interesting move} ;# ***
translate C DubiousMove {Dubious move} ;# ***
translate C WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate C BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate C WhiteClearAdvantage {White has a clear advantage} ;# ***
translate C BlackClearAdvantage {Black has a clear advantage} ;# ***
translate C WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate C BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate C Equality {Equality} ;# ***
translate C Unclear {Unclear} ;# ***
translate C Diagram {Diagram} ;# ***

# 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 stejnch polch)}
translate C SearchBoardFiles {Sloupce (tent materil, vichni pci na stejnch sloupcch)}
translate C SearchBoardAny {Jakkoliv (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 vzory}
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 tah}
translate C MatchForAtLeast {Shoda pro minimln}
translate C HalfMoves {pltah}

# Common endings in material search:
translate C EndingPawns {Pawn endings} ;# ***
translate C EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate C EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate C EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate C EndingRooks {Rook vs. Rook endings} ;# ***
translate C EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate C EndingRooksDouble {Double Rook endings} ;# ***
translate C EndingBishops {Bishop vs. Bishop endings} ;# ***
translate C EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate C EndingKnights {Knight vs. Knight endings} ;# ***
translate C EndingQueens {Queen vs. Queen endings} ;# ***
translate C EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate C BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate C PatternWhiteIQP {White IQP} ;# ***
translate C PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate C PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate C PatternBlackIQP {Black IQP} ;# ***
translate C PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate C PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate C PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate C PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate C PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate C PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate C PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate C PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate C PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate C PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {En Passant sloupec}
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 tahy, nebo mete v tah pidat 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 jen ke ten, nebudou povoleny dn zmny.
dn partie nebude mono uloit ani pepsat a dn mazac 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 jen ke ten?}

# 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 {Nsledujc databze obsahuj partie s neuloenmi zmnami. Pokud nyn skonte, budou tyto zmny ztraceny.}

# 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 budou zobrazeny zde.}

# ECO Browser:
translate C ECOAllSections {vechny ECO sekce}
translate C ECOSection {ECO sekce}
translate C ECOSummary {Souhrn pro}
translate C ECOFrequency {Frekvence subkd pro}

# Opening Report:
translate C OprepTitle {Profil zahjen}
translate C OprepReport {Profil}
translate C OprepGenerated {Generovn}
translate C OprepStatsHist {Statistika a historie}
translate C OprepStats {Statistika}
translate C OprepStatAll {Vechny partie profilu}
translate C OprepStatBoth {Oba ratingovan}
translate C OprepStatSince {Od}
translate C OprepOldest {Nejstar partie}
translate C OprepNewest {Nejnovj partie}
translate C OprepPopular {Stvajc popularita}
translate C OprepFreqAll {Frekvence 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 OprepMostFrequentOpponents {Nejastj soupei}
translate C OprepRatingsPerf {Ratingy a performance}
translate C OprepAvgPerf {Prmrn ratingy a performance}
translate C OprepWRating {Rating bl}
translate C OprepBRating {Rating ern}
translate C OprepWPerf {Performance bl}
translate C OprepBPerf {Performance ern}
translate C OprepHighRating {Partie s nejvym prmrnm ratingem}
translate C OprepTrends {Vsledkov trend}
translate C OprepResults {Dlka parti a frekvence}
translate C OprepLength {Dlka parti}
translate C OprepFrequency {Frekvence}
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 tmata}
translate C OprepMoveOrders {Posloupnosti tah vedouc k profilovan 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 z profilovan pozice}
translate C OprepMostFrequentEcoCodes {Nejastj ECO kdy}
translate C OprepThemes {Pozin tmata}
translate C OprepThemeDescription {Frekvence tmat v prvnch %u tazch kad partie}
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 OprepThemeWIQP {Bl izolovan dmsk pec}
translate C OprepThemeBIQP {ern izolovan 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 {Profilovan partie}
translate C OprepAllGames {Vechny partie}
translate C OprepEndClass {Materilu na konci kad partie}
translate C OprepTheoryTable {Tabulka teorie}
translate C OprepTableComment {Generovno z %u parti s nejvym prmrnm ratingem.}
translate C OprepExtraMoves {Extra poznmkov tahy v tabulce teorie}
translate C OprepMaxGames {Maximum tah v tabulce teorie}
translate C OprepViewHTML {Zobrazit HTML}
translate C OprepViewLaTeX {Zobrazit LaTeX}

# Player Report:
translate C PReportTitle {Profil hre}
translate C PReportColorWhite {blmi figurami}
translate C PReportColorBlack {ernmi figurami}
translate C PReportMoves {po %s}
translate C PReportOpenings {Zahjen}
translate C PReportClipbase {Vyprzdnit schrnku a zkoprovat do n odpovdajc partie}

# Piece Tracker window:
translate C TrackerSelectSingle {Levm tlatkem myi se tato figura vybere.}
translate C TrackerSelectPair {Levm tlatkem se tato figura vybere; pravm se vyberou ob stejn figury.}
translate C TrackerSelectPawn {Levm tlatkem se vybere tento pec; pravm se vybere vech 8 pc.}
translate C TrackerStat {Statistika}
translate C TrackerGames {% parti s tahem na pole}
translate C TrackerTime {% asu na kadm poli}
translate C TrackerMoves {Tahy}
translate C TrackerMovesStart {Vlote slo tahu, kterm m stopovn zat.}
translate C TrackerMovesStop {Vlote slo tahu, kterm m stopovn skonit.}

# 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 to 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 {Kterou partii vymazat:}
translate C TwinsDeleteShorter {Krat partii}
translate C TwinsDeleteOlder {Partii s nim slem}
translate C TwinsDeleteNewer {Partii s vym slem}
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 kterch 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 Scidu  ("B12j", ...)}

# Compaction:
translate C NameFile {Jmenn soubor}
translate C GameFile {Partiov soubor}
translate C Names {Jmna}
translate C Unused {Nepouito}
translate C SizeKb {Velikost (kb)}
translate C CurrentState {Aktuln stav}
translate C AfterCompaction {Po kompaktovn}
translate C CompactNames {Kompaktovat jmenn soubor}
translate C CompactGames {Kompaktovat partiov soubor}

# Sorting:
translate C SortCriteria {Kritria}
translate C AddCriteria {Pidat kritria}
translate C CommonSorts {Bn azen}
translate C Sort {Setdit}

# 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 symbolick anotace:}
translate C ExportStripMarks {Odstranit kdov znaky pol/ipek z koment?}

# 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 ke 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 {Pole navrhovanch tah}
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 novinku}
translate C Novelty {Novinka}
translate C NoveltyInterrupt {Hledn novinky 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 knihovn zahjen ECO.
}

# Sounds configuration:
translate C SoundsFolder {Sound Files Folder} ;# ***
translate C SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate C SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate C SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate C SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate C SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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 Scidu 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 {Poet nedvnch soubor v menu Soubor}
translate C RecentFilesExtra {Poet nedvnch soubor v extra podmenu}

# My Player Names options:
translate C MyPlayerNamesDescription {
Oteve seznam se jmny preferovanch hr, kad jmno na jeden dek. Zstupn znaky (tj. "?" pro jakkoliv jeden znak, "*" pro jakoukoliv sekvenci znak) jsou povoleny.

Vdy, kdy se nathne partie hre uvedenho v seznamu, achovnice v hlavnm okn se oto, jestlie je to nutn k zobrazen partie z perspektivy tohoto hre.
}

}


############################################################
#
# Czech help pages:


#############
### Contents:

set helpTitle(C,Contents) "Obsah"
set helpText(C,Contents) {<h1>Obsah npovdy Scidu</h1>

<h4>Start a veobecn npovda</h4>
<ul>
<li><a Guide><b>Rychl prvodce</b> pouvnm Scidu</a> <red>(tte
 nejprve)</red></li>
<li><a Hints><b>Rady</b> na zefektivnn prce se Scidem</a></li>
<li><a MainWindow><b>Hlavn okno</b> Scidu</a></li>
<li><a Menus><b>Menu</b> Scidu</a> <red>(aktualizovno!)</red></li>
<li><a Moves>Zadvn <b>tah</b></a></li>
<li><a Searches><b>Vyhledvn</b> Scidem</a></li>
<li><a Clipbase>Pouit databze <b>schrnka</b></a></li>
<li><a Annotating><b>Anotace parti</b></a></li>
</ul>

<h4>Ostatn okna Scidu</h4>
<ul>
<li><a Analysis><b>Analytick</b> okno</a></li>
<li><a Comment>Okno <b>editoru koment</b></a></li>
<li><a Crosstable>Okno <b>turnajov tabulky</b></a></li>
<li><a Switcher>Okno <b>vbru databze</b></a></li>
<li><a Email>Okno <b>emailovho</b> manaera</a></li>
<li><a Finder>Okno <b>vyhledvae soubor</b></a></li>
<li><a GameList>Okno <b>seznamu parti</b></a></li>
<li><a Import>Okno <b>importu parti</b></a></li>
<li><a Reports><b>Profily</b></a> <red>(aktualizovno!)</red></li>
<li><a PGN>Okno <b>PGN</b> (text partie)</a></li>
<li><a PTracker><b>Stopa figur</b></a></li>
<li><a PList>Okno <b>vyhledvae hr</b></a></li>
<li><a PInfo>Okno <b>informac o hri</b></a></li>
<li><a Repertoire>Okno <b>editoru repertoru</b></a></li>
<li><a Tmt>Okno <b>vyhledvae turnaj</b></a></li>
<li><a Tree><b>Stromov</b> okno</a></li>
<li><a Graphs>Okno <b>graf</b></a></li>
<li><a TB>Pouit <b>tabulek koncovek</b></a>
 <red>(aktualizovno!)</red></li>
</ul>

<h4>Ostatn pomocn programy a informace</h4>
<ul>
<li><a Bookmarks><b>Zloky</b></a></li>
<li><a Cmdline>Volby z pkazovho dku</a></li>
<li><a Compact><b>Kompaktovn</b> databze</a></li>
<li><a Maintenance>Nstroje <b>drby databze</b></a></li>
<li><a ECO>Klasifikace zahjen <b>ECO</b></a></li>
<li><a EPD>Soubory <b>EPD</b></a></li>
<li><a Export><b>Export</b> parti do textovch soubor</a>
 <red>(aktualizovno!)</red></li>
<li><a Flags><b>Pznaky</b> u parti</a></li>
<li><a LaTeX>Pouit <b>LaTeXu</b> se Scidem</a></li>
<li><a Options><b>Volby</b> a preference</a> <red>(aktualizovno!)</red></li>
<li><a Sorting><b>Tdn</b> databze</a></li>
<li><a Pgnscid><b>Pgnscid</b>: konverze soubor PGN</a></li>
<li><a NAGs>Standardn <b>NAG</b> numerick hodnocen</a></li>
<li><a Formats><b>Formt soubor</b> Scidu</a></li>
<li><a Author>Kontaktn informace</a></li>
</ul>

<p><footer>(Aktualizovno: Scid 3.5, Prosinec 2003)</footer></p>
}


###############
### Topic Index

set helpTitle(C,Index) "Index npovdy Scidu"
set helpText(C,Index) {<h1>Index npovdy Scidu</h1>

<h3>A</h3>
<ul>
<li><a Analysis>Analytick</a> okno</li>
<li><a Annotating>Anotace parti</a></li>
<li><a NAGs>Anotan symboly</a></li>
<li><a MainWindow Autoplay>Automatick pehrvn</a></li>
<li><a Author>Autor, kontaktovn</a></li>
</ul>

<h3></h3>
<ul>
<li><a Maintenance Cleaner>itn</a></li>
</ul>

<h3>D</h3>
<ul>
<li><a Compact>Databze, kompaktovn</a></li>
<li><a Formats>Databze, formty soubor</a></li>
<li><a Maintenance>Databze, drba</a></li>
<li><a Sorting>Databze, tdn</a></li>
<li><a Switcher>Databze</a>, okno vbru</li>
</ul>

<h3>E</h3>
<ul>
<li><a ECO Browser>ECO prohle</a>, okno</li>
<li><a ECO Codes>ECO, systm kd </a></li>
<li><a ECO>ECO, klasifikace zahjen </a></li>
<li><a Menus Edit>Editace, menu</a></li>
<li><a Email>Emailov manaer</a>, okno</li>
<li><a EPD>EPD soubory</a></li>
<li><a Export>Export parti do textovch soubor</a></li>
</ul>

<h3>F</h3>
<ul>
<li><a Searches Filtr>Filtr</a></li>
<li><a Export>Filtr, exportovn</a></li>
<li><a Graphs Filtr>Filtr, graf</a></li>
<li><a Options Fonts>Fonty</a></li>
</ul>

<h3>G</h3>
<ul>
<li><a Graphs>Graf, okna</a></li>
</ul>

<h3>H</h3>
<ul>
<li><a Searches Header>Hlavika, vyhledvn</a></li>
<li><a MainWindow>Hlavn okno</a></li>
<li><a Menus Search>Hledat, menu</a></li>
<li><a PList>Hr</a>, okno vyhledvae</li>
<li><a PInfo>Hr</a>, okno informac</li>
<li><a Reports Player>Hr</a>, okno profilu</li>
</ul>

<h3>I</h3>
<ul>
<li><a Import>Import</a>, okno</li>
</ul>

<h3>J</h3>
<ul>
<li><a Maintenance Editing>Jmna, editace</a></li>
<li><a Maintenance Spellcheck>Jmna, kontrola pravopisu</a></li>
</ul>

<h3>K</h3>
<ul>
<li><a Comment>Koment</a>, okno editoru</li>
<li><a Compact>Kompaktovn databze</a></li>
<li><a Author>Kontaktn informace</a></li>
</ul>

<h3>L</h3>
<ul>
<li><a LaTeX>LaTeX</a>, vstupn formt</li>
</ul>

<h3>M</h3>
<ul>
<li><a Maintenance Twins>Mazn zdvojench parti</a></li>
<li><a Analysis List>Motory</a>, seznam</li>
<li><a Searches Material>Materil/vzor, vyhledvn</a></li>
<li><a Menus>Menu</a></li>
</ul>

<h3>N</h3>
<ul>
<li><a Menus Help>Npovda, menu</a></li>
<li><a Menus Tools>Nstroje, menu</a></li>
<li><a Tree Best>Nejlep partie</a>, okno</li>
<li><a NAGs>NAG anotan hodnoty</a></li>
<li><a Annotating Null>Nulov tahy</a></li>
</ul>

<h3>O</h3>
<ul>
<li><a Contents>Obsah</a></li>
<li><a Menus Windows>Okna, menu</a></li>
</ul>

<h3>P</h3>
<ul>
<li><a Menus Game>Partie, menu</a></li>
<li><a GameList>Partie</a>, okno seznamu</li>
<li><a Flags>Partie, pznaky</a></li>
<li><a Searches Board>Pozice, vyhledvn</a></li>
<li><a Maintenance Spellcheck>Pravopis jmen, kontrola</a></li>
<li><a GameList Browsing>Prohlen parti</a></li>
<li><a Cmdline>Pkazov dek, volby</a></li>
<li><a GameList Browsing>Pipojovn parti</a></li>
<li><a Flags>Pznaky</a></li>
<li><a PGN>PGN</a>, okno</li>
<li><a Pgnscid>Pgnscid</a></li>
</ul>

<h3>R</h3>
<ul>
<li><a Hints>Rady</a></li>
<li><a Guide>Rychl prvodce pouvnm Scidu</a></li>
<li><a Graphs Rating>Rating, graf</a></li>
<li><a Repertoire>Repertor, editor</a></li>
</ul>

<h3>S</h3>
<ul>
<li><a Clipbase>Schrnka</a></li>
<li><a Formats>Soubor, formty</a></li>
<li><a Menus File>Soubor, menu</a></li>
<li><a Finder>Soubor, vyhledva</a></li>
<li><a PTracker>Stopa figur</a>, okno</li>
<li><a Tree>Stromov okno</a></li>
</ul>

<h3>T</h3>
<ul>
<li><a TB>Tabulky koncovek</a></li>
<li><a Moves>Tahy, zadvn</a></li>
<li><a Sorting>Tdn databze</a></li>
<li><a Crosstable>Turnajov tabulka</a>, okno</li>
<li><a Tmt>Turnaj, vyhledva</a></li>
</ul>

<h3>U</h3>
<ul>
<li><a Maintenance>drba, nstroje</a></li>
</ul>

<h3>V</h3>
<ul>
<li><a Options>Volby</a></li>
<li><a Switcher>Vbr databze</a>, okno</li>
<li><a Searches Filter>Vyhledvac filtr</a></li>
<li><a Searches>Vyhledvn</a></li>
<li><a Annotating Vars>Varianty</a></li>
</ul>

<h3>Z</h3>
<ul>
<li><a Moves>Zadvn tah</a></li>
<li><a ECO>Zahjen, klasifikace (ECO)</a></li>
<li><a Reports Opening>Zahjen</a>, okno profilu</a>
<li><a Repertoire>Zahjen, repertory</a></li>
<li><a Bookmarks>Zloky</a></li>
<li><a Maintenance Twins>Zdvojen (duplicitn) partie</a></li>
<li><a Moves Trial>Zkuebn md</a></li>
</ul>

<p><footer>(Aktualizovno: Scid 3.5, nor 2003)</footer></p>
}


################
### Quick guide:

set helpTitle(C,Guide) "Rychl prvodce pouvnm Scidu"
set helpText(C,Guide) {<h1>Rychl prvodce pouvnm Scidu</h1>
<p>
Scid je achov databzov aplikace; mete s n prohlet databze achovch
parti, partie editovat a pouitm rznch kritri partie <a Searches>vyhledvat</a>.
</p>
<p>
Scid pouv svj vlastn <a Formats>formt dat</a>, sestvajc ze t soubor,
kter je velmi kompaktn a rychl, ale me bt obousmrn konvertovn mezi
standardnm PGN (Portable Game Notation) formtem.
<a PGN>Okno PGN</a> Scidu zobrazuje zpis aktuln partie v PGN formtu.
</p>
<p>
Scid mete pout k pidn partie do databze, tahy lze zadvat klvesnic i
my. Pro dal informace se podvejte na strnky npovdy o
<a Moves>zadvn tah</a>.
</p>
<p>
Scid mete tak pout jako prohle <a PGN>PGN</a> soubor, bu vloenm PGN
notace do okna <a Import>Importu</a> Scidu nebo otevenm PGN souboru ve Scidu.
Avak PGN soubory nemohou bt ve Scidu editovny (jsou oteveny jen ke ten),
jsou nron na pam a pomaleji se otevraj. Z tchto dvod se doporuuje
velk PGN soubory nejprve zkonvertovat do formtu Scidu pouitm pomocnho
programu <a Pgnscid>pgnscid</a>.
</p>
<p>
<a MainWindow>Hlavn okno</a> Scidu (s grafickou achovnic) zobrazuje detaily
aktuln partie a databze. Kdykoliv mete mt oteveny a tyi databze
souasn (s <a Clipbase>databz schrnka</a> pt) a kad z nich bude mt svou
aktuln partii.
(Partie slo 0 indikuje zadvn partie, kter nen soust
aktuln databze).
Mezi otevenmi databzemi lze pepnat v
<a Menus File>menu Soubor</a>.
</p>
<p>
Pro vce informac si prosm pette ostatn strnky npovdy v 
<a Index>indexu npovdy</a>.
</p>
<p>
Jestlie chcete kontaktovat autora Scidu, jdte na strnku s
<a Author>kontaktnmi informacemi</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}


###############
### Hints page:

set helpTitle(C,Hints) "Rady k pouvn"
set helpText(C,Hints) {<h1>Rady k pouvn</h1>
<p>
Tato strnka obsahuje ve form otzek a odpovd uiten rady, kter vm
pomohou Scid lpe pouvat. Jestlie s programem Scid teprve zante, pette
si prosm nejdve <a Guide>rychlho prvodce</a>.
Vtina informac na tto strnce je probrna detailn na dalch strnkch
npovdy, viz <a Index>index</a>.
Jestlie chcete pispt na tuto stnku njakou svoj uitenou radou, polete ji
<a  Author>autorovi Scidu</a>. </p>

<h4>Mohu spustit Scid pmo se zvolenou databz?</h4>
<p>
Ano, na pkazov dek sta pidat databze, PGN soubory nebo
<a EPD>EPD soubory</a>. Nap.
<ul>
<li> <b>scid  mybase  games.pgn.gz</b> </li>
</ul>
oteve databzi ve formtu Scidu <b>mybase</b> a rovn PGN soubor komprimovan
Gzipem <b>games.pgn.gz</b>.
</p>

<h4>Existuje jednodu monost jak zmnit velikost achovnice ne pouitm menu
Volby?</h4>
<p>
Ano, pouijte klvesovou zkratku <b>Control+Shift+ipkaVlevo</b> pro zmenen achovnice
a <b>Control+Shift+ipkaVpravo</b> pro zvten.
</p>

<h4>Pi trninku si pehrvm partii, a tm pdem nechci, aby Scid zobrazoval
nsledujc tah v informan zn partie pod achovnic. Je mon ho
skrt?</h4>
<p>
Nsledujc tah lze skrt tak, e v informan zn partie stisknte
<b>prav</b> tlatko myi a z menu, kter se objev, vyberete
<b>Skrt nsledujc tah</b>.
</p>

<h4>Jak mohu vidt ECO kd zahjen pro aktuln pozici?</h4>
<p>
Jestlie byl nahrn klasifikan soubor ECO (<b>scid.eco</b>), ECO kd je
zobrazen na poslednm dku informan zny, pod achovnic v
<a MainWindow>hlavnm okn</a>. <br>
Strnka npovdy <a ECO>ECO kdu</a> vysvtluje, jak nahrt
klasifikan soubor ECO a uloit nastaven tak, aby se nahrl  pi kadm
sputn Scidu. </p>

<h4>Zadvm partii a jsem okolo 30. tahu, ale najednou zjistm, e 10. tah jsem
zadal patn. Jak ho mohu opravit, abych neztratil nsledujc tahy?</h4>
<p>
Mete pout okno <a Import>importu</a>; pro dal informace se podvejte na
strnku npovdy o <a Moves Mistakes>zadvn tah</a>.
</p>

<h4>Jak zkopruji partie z jedn databze do druh?</h4>
<p>
Pouijte <a Switcher>okno vbru databze</a>; petaenm ze zdrojov databze
do clov databze zkoprujete vechny partie z <a Searches Filter>filtru</a>
zdrojov databze.
</p>

<h4>Kdykoliv kdy zadvm tah, kde u njak existuje, objev se dialogov okno
"Nahradit tah?". Jak tomu mohu zabrnit?</h4>
<p>
Vypnte volbu <b>Ptt se ped nahrazenm tah</b> v menu
<menu>Volby: Tahy</menu>. Nebo si zvyknte na vrcen tahu zptky pouvat
prav tlatko myi, tak vlastn dojde k odstrann tahu z partie, je-li to jej
posledn tah.
</p>

<h4>Jak zmnm v Okn seznamu parti ku sloupc?</h4>
<p>
Kliknte levm nebo pravm tlatkem myi na kad titulek sloupce.
</p>

<h4>Jak mohu pout okno stromu s vbrem parti, ne s celou databz?</h4>
<p>
Pouijte <a Clipbase>databzi schrnka</a>. Nastavte filtr databze tak, aby
obsahoval partie, kter chcete pout pro strom, a zkoprujte je pomoc okna
<a Switcher>vbru databze</a> do databze schrnka.  Pak v databzi schrnka
otevete okno stromu.
</p>

<h4>Pro velk databze je strom pomal. Jak ho urychlm?</h4>
<p>
Pro pro dal pouit daj stromu asto ukldejte cache stromu. Dal
detaily najdete na strnkch npovdy <a Tree>stromu</a>, v sekci o cache.
</p>

<h4>Jak mohu pmo editovat PGN zpis partie?</h4>
<p>
K editaci aktuln partie nemete pout okno <a PGN>PGN</a>, ale mete
editovat jej PGN zpis pouitm okna <a Import>importu partie</a>.  Otevete ho
(klvesov zkratka <b>Control+Shift+I</b>) a zvolte
<b>Vloit aktuln partii</b>, pak mete partii editovat a nakonec zvolte
<b>Import</b>.
</p>

<h4>Moje databze obsahuje rzn tvary jmen nkterch hr. Jak je mohu vechny
opravit?</h4>
<p>
Pouitm pkaz v menu <menu>Soubor: drba</menu> mete editovat
individuln jmna hr nebo opravit vechna jmna v databzi. tte strnku
<a Maintenance Editing>drba</a>.
</p>

<h4>Mm oteveny dv databze: prvn s mmi vlastnmi partiemi a druhou velkou s
velmistrovskmi partiemi. Jak porovnm jednu z mch parti s tmi ve velk
databzi?</h4>
<p>
Ve velk databzi si otevete <a Tree>okno stromu</a> a zvolte
<term>Zamknout</term>, aby jste zamknuli strom k tto databzi. Potom se
pepnte do druh databze a strom bude dle pokraovat v zobrazovn daj pro
velkou databzi.
</p>

<p><footer>(Aktualizovno: Scid 2.6, Srpen 2001)</footer></p>
}


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

set helpTitle(C,MainWindow) "Hlavn okno Scidu"
set helpText(C,MainWindow) {<h1>Hlavn okno Scidu</h1>
<p>
Hlavn okno Scidu zobrazuje achovnici s aktuln pozic aktivn partie a
informace o tto partii a o oteven databzi. Jednotliv strnky npovdy
popisuj <a Menus>menu</a> hlavnho okna a <a Moves>zpsoby zadvn tah</a>.
</p>

<h3>Tlatka navigace v partii</h3>
<p>
Navigan tlatka nad achovnic maj tyto vznamy, zleva doprava:
<ul>
<li> <button tb_start> Jdi na zatek partie. </li>
<li> <button tb_prev> Jdi o jeden tah nazpt. </li>
<li> <button tb_next> Jdi o jeden tah dopedu. </li>
<li> <button tb_end> Jdi na konec partie. </li>
<li> <button tb_invar> Sko do varianty. </li>
<li> <button tb_outvar> Opus aktuln variantu. </li>
<li> <button tb_addvar> Pidej variantu k tomuto tahu v partii. </li>
<li> <button autoplay_off> Spus/Ukoni automatick pehrvn tah (viz
 ne). </li>
<li> <button tb_trial> Spus/Ukoni <a Moves Trial>zkuebn md</a>. </li>
<li> <button tb_flip> Oto achovnici. </li>
<li> <button tb_coords>  Zapni/Vypni zobrazovn souadnic achovnice. </li>
</ul>

<h4><name Autoplay>Automatick pehrvn</name></h4>
<p>
V reimu automatickho pehrvn Scid automaticky pehrv smrem dopedu
aktuln partii, dokud nedojde na jej konec. asov interval mezi tahy lze
nastavit z menu <menu>Volby: Tahy</menu>, pi uloen voleb je uloen do
vaeho souboru voleb.
</p>
<p>
Reim automatickho pehrvn spout nebo ukonuje klvesov zkratka
<b>Control+Z</b>, ukonit ho lze rovn klvesou <b>Escape</b>.
</p>
<p>
Jestlie spustte reim automatickho pehrvn pi otevenm
<a Analysis>analytickm okn</a>, partie se bude
<term>komentovat</term>: ped provedenm kadho tahu bude jako nov varianta
pidna analza programu a jeho hodnocen. Podrobnosti se dotete na strnce
npovdy o <a Analysis>analytickm okn</a>.
</p>

<h3>Informan zna partie</h3>
<p>
Oblast pod achovnic zobrazujc informace o partii se nazv
<term>informan zna partie</term>.
Jej prvn ti dky zobrazuj jmna hr,
vsledek, datum a msto.
tvrt dek indikuje souasnou pozici partie a
nsledujc tah.
</p>
<p>
Pt dek zobrazuje <a ECO>ECO</a> (Encyclopedia of Chess Openings, tj.
Encyklopedie achovch zahjen) kd aktuln pozice, jestlie se tato pozice
nalz v pouvanm ECO souboru.
</p>
<p>
Pravm tlatkem mete v informan zn partie aktivovat menu, kde lze nap.
skrt nsledujc tah (uiten pi trninku, kdy hdte jednotliv tahy
partie) a smazat nebo obnovit aktuln partii. Toto menu lze aktivovat i bez
myi stisknutm funkn klvesy <b>[F9]</b>.
</p>

<h4>Tabulky koncovek (tablebases)</h4>
<p>
Kdykoliv aktuln pozice doshne materiln konfiguraci nalezenou v databzovm
souboru tabulek koncovek, informan zna partie rovn zobrazuje jej
hodnocen podle tto tabulky. Detaily hledejte na strnce npovdy o
<a TB>tabulkch koncovek</a>.
</p>

<h3>Stavov lita</h3>
<p>
Stavov lita zobrazuje informace o aktuln databzi. Prvn pole indikuje stav
partie: <b>XX</b> znamen, e partie byla zmnna, ale jet neuloena, zatmco
<b>--</b> znamen, e zmnna nebyla, a <b>%%</b> indikuje, e databze je jen
ke ten (ned se zmnit).
</p>
<p>
Jestlie chcete, aby databze byla otevena jen ke ten, nastavte
adekvtn pstupov prva k jejm souborm, minimln aspo k jejmu indexovmu
souboru, nap. na pkazovm dku zadejte
<b>chmod a-w myfile.si3</b>
a tato databze pak bude Scidem otevena jen ke ten.
</p>
<p>
Stavov lita rovn zobrazuje, kolik parti je aktuln ve
<a Searches Filter>filtru</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}


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

set helpTitle(C,Menus) "Menu"
set helpText(C,Menus) {<h1>Menu Scidu</h1>

<h3><name File>Soubor</name></h3>
<ul>
<li><menu>Nov</menu>: Vytvo novou databzi.</li>
<li><menu>Otevt</menu>: Oteve existujc databzi.</li>
<li><menu>Zavt</menu>: Zave aktuln databzi.</li>
<li><menu>Vyhledva</menu>: Oteve <a Finder>Vyhledva soubor</a>.</li>
<li><menu>Zloky</menu>: <a Bookmarks>Zloky</a> a jejich funkce.</li>
<li><menu>drba</menu>: Funkce <a Maintenance>drby</a> databze.</li>
<ul>
  <li><menu>Okno drby</menu>: Otevr/Zavr okno drby databze.</li>
  <li><menu>Vymazn zdvojench parti</menu>: Nalezne v databzi
      <a Maintenance Twins>zdvojen</a> partie.</li>
  <li><menu>ECO klasifikace partie</menu>: Pepot
      <a ECO>ECO kdy</a> vech parti v databzi.</li>
  <li><menu>Editor jmen</menu>: Nahrad vechny vskyty jmna hre, msta
      turnaje a kola.</li>
</ul>
<li><menu>Pouze pro ten</menu>: Nastav aktuln databzi jen ke ten.</li>
<li><menu>Base 1/2/3/4/5</menu>: Tmito pkazy lze pepnat a mezi tymi
    aktivnmi databzemi a <a Clipbase>databz schrnka</a>.</li>
<li><menu>Ukonit</menu>: Ukon program Scid.</li>
</ul>

<h3><name Edit>Editace</name></h3>
<ul>
<li><menu>Pidat variantu</menu>: Pid novou przdnou variantu k nsledujcmu
    tahu nebo k poslednmu, jestlie za nm u dn jin tah nensleduje.</li>
<li><menu>Vymazat variantu</menu>: Zobraz submenu variant k aktulnmu (tj.
    nsledujcmu) tahu, kter lze vymazat.</li>
<li><menu>Zaadit jako prvn variantu</menu>: Zaad vybranou variantu k
    aktulnmu tahu na prvn msto.</li>
<li><menu>Povit stvajc variantu na hlavn</menu>: Pov vybranou variantu
    na hlavn vmnou se souasnou hlavn variantou.</li>
<li><menu>Zkusit variantu</menu>: Spust <a Moves Trial>zkuebn md</a> pro
    testovn varianty bez zsahu do aktuln partie.</li>
<li><menu>Odstranit</menu>: Odstran z aktuln partie vechny komente nebo
    varianty.</li>
<br>
<li><menu>Vyprzdnit schrnku</menu>: Vyprzdn
    <a Clipbase>databzi schrnka</a>, take neobsahuje dn partie.</li>
<li><menu>Zkoprovat tuto partii do schrnky</menu>: Zkopruje aktuln partii
    do <a Clipbase>databze schrnka</a>.</li>
<li><menu>Vloit posledn partii ze schrnky</menu>: Vlo aktivn partii z
    <a Clipbase>databze schrnka</a> do aktuln databze.</li>
<br>
<li><menu>Nastavit vchoz pozici</menu>: Nastav vchoz pozici aktuln
    partie.</li>
<li><menu>Vloit poten pozici</menu>: Vlo poten pozici z
    aktulnho vybranho textu (v clipboardu).</li>
</ul>

<h3><name Game>Partie</name></h3>
<ul>
<li><menu>Nov partie</menu>: Nastav aktuln partii do poten pozice a
    zru vechny jej neuloen zmny.</li>
<li><menu>Nathnout prvn/pedchoz/nsledujc/posledn partii</menu>: Nathne
    prvn/pedchoz/nsledujc/posledn partii do
    <a Searches Filter>filtru</a>.</li>
<li><menu>Znovunathnout aktuln partii</menu>: Znovunathne aktuln partii a
    zru vechny jej neuloen zmny.</li>
<li><menu>Nathnout partii slo</menu>: Nathne z aktuln databze partii
    danho sla.</li>
<br>
<li><menu>Uloit: pepsn partie</menu>: Ulo aktuln partii pepsnm jej
    originln verze v databzi</li>
<li><menu>Uloit: pidn nov partie</menu>: Ulo aktuln partii jako novou
    partii pidnm na konec databze.</li>
<br>
<li><menu>Identifikace zahjen</menu>: Najde nejhlub pozici z aktuln
    partie, kter se jet nachz v ECO souboru.</li>
<li><menu>Pejt na tah slo</menu>: Pejde na specifikovan tah aktuln
    partie.</li>
<li><menu>Hledat novinku</menu>: Najde prvn tah aktuln partie, kter se jet
    pedtm nehrl. </li>
</ul>

<h3><name Search>Hledat</name></h3>
<ul>
<li><menu>Vyistit filter</menu>: Vyist <a Searches Filter>filter</a>,
    take obsahuje vechny partie.</li>
<li><menu>Negace filtru</menu>: Invertuje filtr tak, e obsahuje jen partie,
    kter neobsahoval.</li>
<br>
<li><menu>Aktuln pozice</menu>: Vyhledv
    <a Searches Board>aktuln pozici</a> na achovnici.</li>
<li><menu>Hlavika: Vyhledv podle informac v
    <a Searches Header>hlavice</a>, nap. podle jmen hr.</li>
<li><menu>Materil/Vzor</menu>: Vyhledv podle
    <a Searches Material>materilu</a> nebo vzor.</li>
<br>
<li><menu>Hledat pomoc souboru voleb</menu>: Vyhledv pouitm
    <a Searches Settings>nastaven</a> ze souboru vyhledvacch voleb.</li>
</ul>

<h3><name Windows>Okna</name></h3>
<ul>
<li><menu>Editor koment</menu>: Otevr/Zavr okno
    <a Comment>editoru koment</a>.</li>
<li><menu>Seznam parti</menu>: Otevr/Zavr
    <a GameList>okno seznamu parti</a>.</li>
<li><menu>Okno PGN</menu>: Otevr/Zavr
    <a PGN>okno PGN</a>.</li>
<li><menu>Vyhledva turnaj</menu>: Otevr/Zavr okno
    <a Tmt>vyhledvae turnaj</a>.</li>
<br>
<li><menu>Vbr databze</menu>: Otevr/Zavr okno
    <a Switcher>vbru databze</a>, kde se lze pepnout do jin databze nebo
    jednodue koprovat partie mezi databzemi.</li>
<li><menu>Okno drby</menu>: Otevr/Zavr okno
    <a Maintenance>drby</a> databze.</li>
<br>
<li><menu>ECO prohle</menu>: Otevr/Zavr okno
    <a ECO browser>ECO prohlee</a>.</li>
<li><menu>Editor repertoru</menu>: Otevr/Zavr
    <a Repertoire>editor repertoru</a>.</li>
<li><menu>Statistick okno</menu>: Otevr/Zavr
    <term>Statistick okno filtru</term>, kter zobrazuje pehled vher/proher
    parti ve <a Searches Filter>filtru</a>.</li>
<li><menu>Stromov okno</menu>: Otevr/Zavr
    <a Tree>stromov okno</a>.</li>
<li><menu>Okno tabulky koncovek</menu>: Otevr/Zavr okno, kter zobrazuje
    informace z <a TB>tabulek koncovek</a>.</li>
</ul>

<h3><name Tools>Nstroje</name></h3>
<ul>
<li><menu>Program pro analzu</menu>: Spout/Zastavuje achov program pro
    analzu pozice, kter zobrazuje v
    <a Analysis>analytickm okn</a> hodnocen souasn pozice.</li>
<li><menu>Program pro analzu #2</menu>: Spout/Zastavuje druh achov program
    pro analzu pozice.</li>
<li><menu>Turnajov tabulka</menu>: Zkonstruuje a zobraz
    <a Crosstable>turnajovou tabulku</a> pro aktuln partii.</li>
<li><menu>Email manaer</menu>: Otevr/Zavr okno
    <a Email>emailovho manaera</a> pro sprvu korespondennch parti hranch
    emailem.</li>
<br>
<li><menu>Profil zahjen</menu>: Generuje
    <a Reports Opening>profil zahjen</a> pro aktuln pozic.</li>
<li><menu>Stopa figur</menu>: Otevr okno
    <a PTracker>stopae figur</a>.</li>
<br>
<li><menu>Informace o hrch</menu>: Zobraz
    <a PInfo>informace o hrch</a> aktuln partie.</li>
<li><menu>Graf ratingu </menu>: Zobraz
    <a Graphs Rating>graf ratingu</a>.</li>
<li><menu>Graf skre</menu>: Zobraz
    <a Graphs Score>graf skre</a>.</li>
<br>
<li><menu>Export aktuln partie</menu>: Zape aktuln partii do textovho
    souboru ve formtu PGN, HTML nebo LaTeX. tte strnku npovdy o
    <a Export>exportu</a>.</li>
<li><menu>Export filtrovanch parti</menu>: Zape vechny partie ve
    vyhledvacm <a Searches Filter>filtru</a> do textovho souboru ve formtu
    PGN, HTML nebo LaTeX. tte strnku npovdy o <a Export>exportu</a>.</li>
<br>
<li><menu>Import jedn PGN partie</menu>: Oteve <a Import>okno Importu</a> pro
    zadvn partie nebo jej vloen v <a PGN>PGN formtu</a>.</li>
<li><menu>Import souboru PGN parti</menu>: Importuje cel soubor parti
    v PGN formtu do aktuln databze.</li>
</ul>

<h3><name Options>Volby</name></h3>
<p>
Toto menu poskytuje pkazy pro nastaven takka vech konfigurovatelnch voleb
Scidu. Pkaz <menu>Uloit volby</menu> ulo aktuln nastaven voleb do
souboru "<b>~/.scid/scidrc</b>" (nebo <b>scid.opt</b> v adresi Scidu pro
uivatele Windows); tento soubor se nat pi kadm startu Scidu.
</p>

<h3><name Help>Npovda</name></h3>
<p>
Toto menu obsahuje funkce npovdy a pstup k oknu tip dne nebo k startovacmu
oknu, kter poskytuje informace o souborech, kter Scid naetl pi startu.
</p>

<p><footer>(Aktualizovno: Scid 3.5, nor 2003)</footer></p>
}


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

set helpTitle(C,Moves) "Zadvn tah"
set helpText(C,Moves) {<h1>Zadvn tah</h1>
<p>
Ve Scidu mete zadvat tahy partie pouitm myi nebo klvesnice. Kdy pohnete
my na njak pole achovnice, toto pole spolu s dalm zmn barvu, jestlie
existuje z tohoto nebo na toto pole mon tah. Jedn se o
<term>navrhovan tah</term>. Chcete-li zadat tento tah, jednodue kliknte
<term>levm</term> tlatkem myi. Jestlie vs navrhovn tah ru, mete ho
vypnout v menu Volby.
</p>
<p>
Jestlie chcete zadat jin tah ne navrhovan, mete pout <term>lev</term>
tlatko myi; stisknte tlatko na jednom poli a uvolnte na druhm.
</p>
<p>
Jestlie upednostujete zadvat tahy dvma kliknutm myi ped jejm taenm
se stisknutm tlatkem, mete pout <term>prostedn</term> tlatko;
kliknte na jedno pole a pak na druh.
</p>

<h4>Vrcen tahu zpt</h4>
<p>
Chcete-li vrtit posledn tah zpt, kliknte pravm tlatkem myi. Vrtte se
tak jeden tah nazpt a tah se smae, jestlie byl posledn v partii nebo ve
variant.
</p>

<h4>Nhrada pvodnch tah</h4>
<p>
Kdy zadte tah v takovm mst partie, kde u njak tah existuje, Scid zobraz
dialogov okno, zda opravdu chcete nahradit pvodn tah (pvodn tah a vechny
tahy za nm budou ztraceny) nebo chcete pidat nov tah jako variantu. Nkterm
lidem me toto dialogov okno vadit, protoe vdy chtj nahradit pvodn tahy,
z tohoto dvodu to lze v menu <menu>Volby: Tahy</menu> volbou
"<i>Ptt se ped nahrazenm tah</i>" vypnout.
</p>

<h4><name Trial>Zkuebn md</name></h4>
<p>
Jestlie studujete partii a dojdete do pozice, kde chcete zkusit alternativn
variantu beze zmny partie, vyberte z menu <menu>Editace</menu> pkaz
<b>Zkusit variantu</b> pro sputn zkuebnho mdu. V tomto mdu mete zadvat
tahy a jinak doasn mnit partii, po ukonen zkuebnho mdu se pak vrtte do
pozice, kde jste tento md spustili.</p>

<h3><name Mistakes>Oprava chyb</name></h3>
<p>
Kdy zadvte partii a najednou uvidte chybn tah nkolik tah dv, je mon
chybu opravit bez ztrty nsledujcch, ji zadanch tah. Jedinm zpsobem je
editace PGN reprezentace partie: otevete okno <a Import>Importu</a>, zadejte
"Vloit aktuln partii", opravte chybn tah a zadejte "Import".
</p>

<h3>Zadvn tah z klvesnice</h3>
<p>
Pro zadvn tah z klvesnice jednodue stisknte odpovdajc klvesy psmene
a slice. Vimnte si, e akceptovateln tahy mus bt v
<term>SAN notaci</term>, <i>bez</i> symbol bran (x) a promny (=). Pi zadvn
se nerozliuje velikost psmen, take nap. msto Nf3 mete zadat [n][f][3] --
pette si ale poznmku ne o konfliktech u pcovch tah.
</p>
<p>
Aby nedochzelo k problmm, notace pro krtkou a dlouhou rodu je [O][K] resp.
[O][Q] msto bnch oznaen O-O a O-O-O.
</p>
<p>
Pi zadvn tah stavov lita ukazuje adekvtn mon tahy. Kdykoliv mete
stiskem [space] vybrat ze seznamu prvn tah a pidat ho tak do partie. Chcete-li
smazat njak znak, stisknte [Backspace] nebo [Delete].
</p>
<p>
<b>Vimnte si</b>, e pi malch psmenech se nejprve navrhuj tahy pci,
take [b] me odpovdat pci nebo stelci (Bishop), ale v ppad konfliktu
muste pro tah stelcem pout velk psmeno [B].</p>

<h4>Doplovn tah</h4>
<p>
V menu Volby mete zapnout nebo vypnout automatick
<term>doplovn tah</term>. Pi zapnutm doplovn tah je tah zahrn,
jakmile jste zadali dostatek informac pro jeho rozeznn mezi ostatnmi monmi
tahmi. Nap. pi zapnutm doplovn sta pro tah <b>Jf3</b> v poten pozici
zadat [n][f] msto [n][f][3].</p>

<h3><name Null>Zadvn nulovch tah</name></h3>
<p>
<a Annotating Null>Nulov</a> (przdn) tahy mohou bt uiten ve variantch,
 kde
chcete peskoit tah jedn strany. Nulov tah mete zadat my vzetm jednoho
krle druhm krlem nebo klvesnic zadnm "<b>--</b>" (tj. dvakrt stisknout
tlatko mnus).</p>

<h3>Zadvn bnch anotanch symbol</h3>
<p>
Rovn mete v hlavnm okn s pomoc klvesnice zadvat bn
<a NAGs>anotan symboly</a>, bez nutnosti pout okno
<a Comment>editoru koment</a>. Nsledujc seznam ukazuje,kter symboly mete
zadat a jejich klvesov zkratky:
<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>(Aktualizovno: Scid 3.4, ervenec 2002)</footer></p>
}


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

set helpTitle(C,Searches) "Vyhledvn"
set helpText(C,Searches) {<h1>Vyhledvn Scidem</h1>
<p>
Scid me v databzi vyhledvat podle rznch typ. Ti hlavn typy vyhledvn
 jsou:
<ul>
<li><b>1)</b> podle aktuln pozice na achovnici, </li>
<li><b>2)</b> podle specifikovanch vzor materilu nebo figur, a </li>
<li><b>3)</b> podle informac v hlavice jako nap. hri, vsledek, datum.
 </li>
</ul>
<p>
K tmto tem typm vyhledvn navc existuje automatick vyhledvac md zvan
<a Tree>Okno stromu</a>, kter je objasnn zvlṻ.
</p>

<h3><name Filter>Vyhledvac filtr</name></h3>
<p>
Vyhledvn ve Scidu jsou zaloeny na pojmu <term>filtr</term>. Filtr
reprezentuje podmnoinu aktuln databze: v kadm okamiku je kad partie bu
ve filtru obsaena nebo z filtru vyata.
</p>
<p>
U kadho typu vyhledvn mete vyhledvn omezit na existujc filtr, pidat
k existujcmu filtru nebo filtr ignorovat a prohledat tak celou databzi.
</p>
<p>
Mete rovn vechny partie jedn databze obsaen ve filtru zkoprovat do
jin databze pouitm okna <a Switcher>vbru databze</a>.
</p>
<p>
Pi vyhledvn podle pozice, podle materilu/vzoru nebo pi
<a Tree>stromovch</a> vyhledvnch se slo tahu prvn odpovdajc pozice
kad odpovdajc partie zapamatuje, take pi nahrn kad partie bude
automaticky zobrazena odpovdajc pozice.
</p>
<p>
<b>Vimnte si</b>, e vyhledvn probh jen v hlavn variant kad partie, ne
v ostatnch variantch. </p>

<h3><name Board>Vyhledvn podle aktuln pozice</name></h3>
<p>
Tento zpsob vyhledvn nalezne partie, kter obsahuj aktuln zobrazenou
pozici, pi ignorovn prv rody a bran mimochodem (<i>en passant</i>).
</p>
<p>
Existuj tyi typy vyhledvn podle pozice. Vechny tyi vyaduj tent
materil a shodu u strany, kter m bt na tahu. Tyto typy jsou:
<ul>
<li> [1] pesn pozice (vechny figury na stejnch polch), </li>
<li> [2] pci (vichni pci na stejnch polch, figury mohou bt kdekoliv),
     </li>
<li> [3] sloupce (vichni pci na stejnch sloupcch, figury mohou bt
     kdekoliv), a </li>
<li> [4] materil (pci a figury mohou bt kdekoliv). </li>
</ul>
<p>
Vyhledvn podle pc je uiten pi studiu zahjen podle pcov struktury,
vyhledvn podle ad a materilu je zase uiten pro nalezen podobnch pozic
v koncovce.
</p>
<p>
Chcete-li hledat libovolnou pozici, mete si pozici nejprve nastavit na
achovnici (z menu <menu>Editace: Nastavit vchoz pozici</menu>) a potom
spustit jej vyhledvn. </p>
<p>
Vbrem <b>Dvat se do variant</b> mete poadovat vyhledvn i ve variantch
(msto jen v hlavn variant partie), ale to me vyhledvn znan zpomalit,
je-li databze velk a obsahuje mnoho parti s variantami.
</p>

<h3><name Material>Vyhledvn podle materilu/vzoru</name></h3>
<p>
Tento zpsob vyhledvn je vhodn pro hledn tmat z koncovek a stedn hry.
Mete specifikovat minimln a maximln poet jednotlivch kamen a hledat
vzory jako nap. stelec na f7 nebo pec na f sloupci.
</p>
<p>
Je peddefinovno mnostv bnch materilnch sestav a vzor, jako nap.
koncovky v proti pci nebo dmsk izolovan pec.
</p>
<p>
<b>Rada:</b><br>
Rychlost vyhledvn podle vzoru se me iroce liit. Nastavenm inteligentnch
omezen mete vyhledvac as redukovat. Nap. jestlie pi hledn koncovky
nastavte minimln slo tahu na 20, vechny partie konc pod 20 tah mohou
bt peskoeny.
</p>

<h3><name Header>Vyhledvn podle hlaviky</name></h3>
<p>
Tento zpsob vyhledvn me bt pouit na hledn takovch aspekt partie,
kter jsou uloeny v jej hlavice (jako datum, vsledek, jmna, pznaky a
ratingy), take nevyaduje dn dekdovn tah.
</p>
<p>
Aby partie vyhovovala vyhledvn podle hlaviky, mus vyhovovat <b>vechna</b>
pole, kter jste specifikovali.
</p>
<p>
Pi vyhledvn podle pol jmen (Bl, ern, Turnaj, Msto a Kolo) vyhovuje
jakkoliv text obsahujc zadan jmno, pitom se nerozliuje velikost psmen a
ignoruj se mezery. </p>
<p>
Pro tato pole jmen mete pouvat bn zstupn znaky (<b>?</b> reprezentujc
jeden jakkoliv znak a <b>*</b> reprezentujc nulu nebo vce znak) a provdt
vyhledvn s rozliovnm velikosti psmen uzavenm hledanho textu do
uvozovek.  Nap. vyhledvn Msto <b>USA</b> najde americk msta a tak
<b>Lausanne SUI</b>, co pravdpodobn nen to, eho jste chtli doshnout! Ale
vyhledvn Msto <b>"*USA"</b> (nezapomete pout uvozovky) opravdu najde jen
msta ve Spojench Sttech. </p>
<p>
Jestlie hledte jednotlivho hre (nebo dvojici soupe) jako Bl nebo ern
a nezle na tom, jakmi barvami hrli, zvolte <b>Ignorovat barvy</b>.
</p>
<p>
Konen, vyhledvn podle hlaviky me bt pouito na nalezen jakhokoliv
textu (pi rozliovn velikosti psmen a bez pouit zstupnch znak)v PGN
reprezentaci kad partie. Mete zadat a ti textov etzce, kter se vechny
mus objevit v partii, aby partie vyhovovala.
Tento zpsob vyhledvn je velmi uiten pro hledn v komentch nebo
zvltnch poznmek (jako nap. <b>prohra na as</b> nebo <b>Komenttor</b>),
nebo pro sekvenci tah jako <b>Sxh7+</b> a <b>Kxh7</b> pro pijatou ob stelce
na h7.
Avak tento typ vyhledvn me bt <i>velmi</i> pomal, protoe vechny
partie, vyhovujc ostatnm kritrium, mus bt dekdovny a prohledny na
vskyt tchto textovch etzc.
Proto je dobrou ideou tato vyhledvn co nejvc omezit.
Zde jsou njak pklady.
Hledte-li partie s promnou pce na v, zadejte <b>=V</b> a rovn nastavte
pznak <b>Promny</b> na Ano. Hledte-li text, kter by se mohl objevit v
komentch, nastavte pznak <b>Komente</b> na Ano.
Hledte-li tahy <b>Sxh7+</b> a <b>Kxh7</b>, budete mon nap. chtt vyhledvn
omezit na partie s vsledkem 1-0 a nejmn s 40 pltahy, nebo nejprve provst
vyhledvn podle materilu/vzoru, kde bl stelec thnul na h7.
</p>

<h3><name Settings>Uloen vyhledvacch nastaven</name></h3>
<p>
Okna vyhledvn podle materilu/vzoru a podle hlaviky poskytuj tlatko
<term>Uloit</term>. To vm dovoluje uloit svoje aktuln nastaven vyhledvn
pro pozdj pouit, kter se ulo do <term>souboru vyhledvacch voleb</term>
(SearchOption, ppona .sso).
Chcete-li provdt vyhledvn pouitm dve uloenho souboru vyhledvacch
voleb (.sso), z menu <menu>Hledat</menu> vyberte <menu>Hledat pomoc souboru
voleb</menu>.
</p>

<h3>Vyhledvac asy a peskoen partie</h3>
<p>
Vtina vyhledvn produkuje zprvu indikujc spotebovan as a poet parti,
kter byly <term>peskoeny</term>. Peskoen partie je takov partie, kter
me bt z vyhledvn vyata na zklad informac uloench v indexu, bez
dekdovn jakhokoliv jejho tahu. Pro vce informac se podvejte na strnku
npovdy o <a Formats>formtech soubor</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.0, Listopad 2001)</footer></p>
}


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

set helpTitle(C,Clipbase) "Schrnka"
set helpText(C,Clipbase) {<h1>Databze schrnka</h1>
<p>
K databzm, kter mte oteven, Scid navc poskytuje databzi
<term>schrnka</term>, kter je stejn jako ostatn databze krom toho, e
existuje jen v pamti a nem dn soubory pro trval uloen.
</p>
<p>
Tato schrnka je uiten jako doasn databze, pro sjednocovn vsledk
vyhledvn ve vce ne jedn databzi nebo jako samostatn databze pro
zpracovn vsledk vyhledvn.
</p>
<p>
Pedpokldejme nap., e se chcete pipravit na soupee a prohledali jste
databzi, take <a Searches Filter>filtr</a> obsahuje jen partie, kde soupe
hrl blma.
Tyto partie mete zkoprovat do schrnky (taenm z jejich databze do schrnky
v okn <a Switcher>vbru databze</a>), pepnout se do databze schrnka a
otevenm <a Tree>okna stromu</a> prozkoumat repertor tohoto hre. </p>
<p>
Vimnte si, e partie ve filtru z jedn databze mete pmo zkoprovat do
jin oteven databze (bez pouit schrnky jako zprostedkujcho msta)
pouitm okna <a Switcher>vbru databze</a>.
</p>
<p>
Vimnte si, e schrnka <i>neme</i> bt zavena; nachzte-li se ve schrnce,
pkaz <menu>Soubor: Zavt</menu> je ekvivalentn pkazu
<menu>Editace: Vyprzdnit schrnku</menu>, kter vyprzdn schrnku.
</p>
<p>
Velikost schrnky je trvale omezena 20,000 partiemi, protoe existuje jen v
pamti.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

#################################
### Variations and comments help:

set helpTitle(C,Annotating) "Anotace parti"
set helpText(C,Annotating) {<h1>Anotace parti</h1>
<p>
Scid vm umouje k partii pidat poznmky. Jsou ti typy anotac, kter mete
pidat za tah: symboly, koment a varianty.
</p>

<h3>Symboly a komente</h3>
<p>
Symboly se pouvaj pro indikaci hodnocen pozice (jako nap. "+-" nebo "=")
nebo k oznaen dobrch ("!") a patnch ("?") tah, zatmco koment me bt
libovoln text. Chcete-li k partii pidat symboly, pouijte okno
<a Comment>Editoru koment</a>.
Je zde tak strnka npovdy se seznamem
<a NAGs>standardnch symbolickch hodnot</a>. </p>
<p>
Uvdomte si, e kad tah me mt vce ne jeden anotan symbol, ale pouze
jeden koment. Koment ped prvnm tahem partie je zobrazen jako text ped
zatkem partie.
</p>

<h3><name Vars>Varianty</name></h3>
<p>
<term>Varianta</term> tahu je alternativn posloupnost tah v uritm mst
partie. Varianty mohou obsahovat komente a dokonce rekurzivn mohou mt
podvarianty. Pro vytvoen, navigaci a editaci variant lze pout tlatka nad
achovnic se symbolem "<b>V</b>" a pkazy v menu <menu>Edit</menu>.
</p>

<h4>Klvesov zkratky</h4>
<p>
Kdy m tah varianty, jsou zobrazeny v informan zn partie. Prvn bude
oznaena <b>v1</b>, druh <b>v2</b> atd.
Kliknutm na variantu mete do n skoit nebo stisknte "<b>v</b>" nsledovan
slem varianty. (Jestlie k tahu existuje jen jedna varianta, jednoduch stisk
<b>v</b> do n sko.)
Chcete-li variantu opustit, mete pout klvesovou zkratku "<b>z</b>".
</p>

<h3><name Null>Nulov tahy</name></h3>
<p>
Nkdy mete shledat uitenm ve variant peskoit tah jedn strany. Nap.
mete chtt pidat do varianty tah 14.Sd3 a poukzat, e hroz 15.Sxh7+ Kxh7
16.Jg5+ s tokem. To mete udlat provedenm <term>nulovho tahu</term>, v
pkladu ve mezi 14.Sd3 a 15.Sxh7+. Nulov tah je zobrazen jako  "<b>--</b>"
a me bt zadn pouitm myi provedenm nemonho tahu vzet jednoho krle
druhm nebo z klvesnice zadnm "<b>--</b>" (dv znamnka mnus).
</p>
<p>
Uvdomte si, e nulov tahy nejsou soust PGN standardu, take jestlie
exportujete partie s nulovmi tahy do PGN souboru, Scid poskytne (krom jinch
voleb exportu) volbu uchovat nulov tahy nebo je zkonvertovat na komente pro
kompatibilitu s jinm softwarem.
Pro vce detail tte strnku npovdy o <a Export>exportovn</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.4, ervenec 2002)</footer></p>
}

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

set helpTitle(C,Comment) "Okno editoru koment"
set helpText(C,Comment) {<h1>Okno editoru koment</h1>
<p>
Okno editoru koment umouje pidvat nebo editovat komente a symbolick
anotan znaky k tahm aktivn partie.
</p>

<h3>Anotan symboly</h3>
<p>
Scid pouv pro anotan symboly <a Author Related>PGN standard</a> spolu s
<a NAGs>NAG (numeric annotation glyph)</a> anotanmi hodnotami. Nkter z vtiny
bnch znak (jako "!" nebo "+-") jsou zobrazeny jako znaky a pro rychl pouit
je pro n v okn editoru koment tlatko. Pro ostatn symboly mete zadat
odpovdajc  numerickou NAG hodnotu, kter je slo od 1 do 255.
Nap. NAG hodnota 36 znamen  "Bl m iniciativu" a bude v
<a PGN>PGN zpisu</a> partie zobrazena jako "$36".
</p>
<p>
Pette si strnku npovdy o <a NAGs>NAG hodnotch</a> definovanch
PGN standardem.
</p>
<p>
<b>Rada:</b> Bn hodnotc symboly k tahm (!, ?, !!, ??, !? and ?!)
mete zadat v hlavnm okn, bez pouit okna editoru koment, stiskem
odpovdajcho znaku nsledovanho klvesou [Return].
To je velmi uiten, zvlt pi <a Moves>zadvn tah</a> z klvesnice.
</p>

<h3>Komente</h3>
<p>
Komente mete editovat zpisem v poskytovan textov oblasti a pouitm
tlatek Vyistit, Vrtit se a Uschovat.
K schov komente nen poteba neustle pouvat tlatko Uschovat; koment
je automaticky uschovn, kdykoliv pejdete k jin pozici partie.</p>

<h3>Barevn znaen pol</h3>
<p>
Pouitm specilnho vloenho pkazu, kter se me objevit kdekoliv v
komenti, mete libovolnou barvou barevn oznait libovoln pole achovnice.
Formt tohoto pkazu je:
</p>
<ul>
<li><b>[%mark square color]</b><li>
</ul>
<p>
kde <b>square</b> (tj. pole) je oznaen pole jako nap. d4 a <b>color</b> (tj.
barva) je libovoln znm jmno barvy (jako nap. red, blue4, darkGreen,
lightSteelBlue atd.) nebo RGB kd (znak <b>#</b> nsledovan estic
hexadecimlnch slic, jako nap. #a0b0c8). Jestlie color je vynechno,
pouije se implicitn <red>red</red>.
</p>
<p>
Koment me obsahovat libovoln poet tchto pkaz, ale kad mus mt sv
vlastn <b>[%mark ...]</b> oznaen. Nap. text komente
</p>
<p>
  Nyn je d6 [%mark d6] slab a me bt napadeno jezdcem z b5.
  [%mark b5 #000070]
</p>
<p>
ozna d6 <red>erven</red> a b5 tmavomodrou barvou
<darkblue>#000070</darkblue>.
</p>

<h3>Kreslen ipek</h3>
<p>
Pouitm specilnho komentovacho pkazu podobnmu pedchozmu mete
nakreslit ipku z jednoho pole k druhmu. Formt tohoto pkazu je:
</p>
<ul>
<li><b>[%arrow fromSquare toSquare color]</b><li>
</ul>
<p>
kde <b>fromSquare</b> (tj. z pole) a <b>toSquare</b> (tj. na pole) jsou oznaen
pol jako nap. d4 a <b>color</b> (tj. barva) je libovoln znm jmno barvy
(nap. red, blue4 atd.) nebo RGB kd (nap. #a0b0c8). Jestlie color je
vynechno, pouije se implicitn <red>red</red>.
</p>
<p>
Nap. text komente
</p>
<p>
  Jezdec c3 a stelec c4 kontroluj slab pole d5.
  [%arrow c3 d5 red] [%arrow c4 d5 blue]
</p>
<p>
nakresl ervenou ipku z c3 na d5 a modrou z c4 na d5.
</p>

<p><footer>(Aktualizovno: Scid 3.2, nor 2002)</footer></p>
}

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

set helpTitle(C,Crosstable) "Okno turnajov tabulky"
set helpText(C,Crosstable) {<h1>Okno turnajov tabulky</h1>
<p>
Okno turnajov tabulky zobrazuje turnajovou tabulku pro aktuln partii.
Kdykoliv zvolte aktualizaci tohoto okna (stiskem tlatka Aktualizovat nebo
stiskem klvesy <b>Return</b> v okn turnajov tabulky nebo klvesovou zkratkou
<b>Control+Shift+X</b> v <a MainWindow>hlavnm okn</a> nebo v
<a GameList>okn seznamu parti</a>), Scid vyhled vechny partie toho turnaje,
z kterho je aktuln partie.
</p>
<p>
Partie se povauje ze stejnho turnaje jako je aktuln partie, jestlie se
hrla v <b>asovm intervalu maximln t msc</b> od aktuln partie a m
<b>pesn stejn speciln oznaen Event</b> (turnaj) a <b>Site</b> (msto).
</p>
<p>
Kliknutm levm tlatkem myi na kterkoliv vsledek v tabulce lze nathnout
odpovdajc partii.
Pomoc tlatka <b>Pidat do filtru</b> v okn turnajov tabulky mete vechny
partie turnaje pidat do <a Searches Filter>filtru</a>.
</p>

<h4>Menu okna turnajov tabulky</h4>
<p>
Menu <menu>Soubor</menu> umouje tisk aktuln tabulky do textovho, LaTeX
nebo HTML souboru.
</p>
<p>
Menu <menu>Zobrazit</menu> umouje vybrat formt tabulky:
<b>Kad s kadm</b>, <b>vcarsk systm</b> nebo <b>Vyazovac</b> nebo
<b>Auto</b>.
</p>
<p>
Formt kad s kadm (pro kruhov turnaje) je omezen potem 30 hr, ale
vcarsk systm (pro turnaje s mnoha hri) me zobrazit a 200 hr a a 20
kol. Formt <b>auto</b>, kter pro kad turnaj automaticky vybere nejlep
formt, je nastaven implicitn.
</p>
<p>
Uvdomte si, e Scid pouv k pprav tabulky vcarskho systmu speciln
oznaen <b>Round</b> (Kolo) kad partie, take v turnajov tabulce vcarskho
systmu neuvidte dn partie, jestlie jeho partie nebudou mt numerick
oznaen kol: 1, 2, 3, atd.
</p>
<p>
Menu Zobrazit vm rovn umouje pizpsobit si prezentovan daje pidnm
nebo odebrnm rating, zem a titul hr. Mete rovn zvolit, zda maj bt
v tabulce indikovny barvy (jen pro vcarsk systm).
</p>
<p>
Volba <b>Skupiny podle skre</b> ovlivuje zobrazen tabulky jen tehdy, kdy
jsou hri seazeni podle bod: mezi skupiny hr se stejnm potem bod je pro
lep pehlednost vloen przdn dek.
</p>
<p>
Menu <menu>adit</menu> umouje seadit hre podle jmna, ratingu nebo podle
skre; implicitn jsou azeni podle skre.
</p>
<p>
Menu <menu>Barvy</menu> umouje zapnout nebo vypnout barevn (hypertextov)
zobrazovn. Protoe vak formtovn a zobrazen velk tabulky v hypertextu
me trvat velmi dlouho, volbou <b>Prost text</b> pro velk turnaje uette
spoustu asu.
Avak v textovm mdu nelze klikat na hre i partie.
</p>

<h4>Duplicitn partie v tabulce</h4>
<p>
Abyste dostali v turnajov tabulce sprvn vsledky, je poteba oznait k
vmazu duplicitn partie a partie mus mt shodn tvary jmen hr, turnaj a
mst.
Pro dal npovdu o mazn duplicitnch parti a editaci (nebo kontrole
pravopisu) jmen hr, turnaj, mst tte strnku
<a Maintenance>drby databze</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}


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

set helpTitle(C,Switcher) "Vbr databze"
set helpText(C,Switcher) {<h1>Okno vbru databze</h1>
<p>
Okno vbru databze poskytuje pohled, kter umouje jednodue se pepnat a
koprovat partie mezi databzemi.
Je zobrazeno jmno, stav <a Searches Filter>filtru</a> a graficky typ ikony
kad databze, aktivn databze je zvraznna lutm pozadm.
</p>
<p>
Okno vbru databze mete otevt z menu <menu>Okna</menu> nebo jeho
klvesovou zkratkou: <b>Control+D</b>.
</p>
<p>
Chcete-li zkoprovat vechny filtrovan partie jedn databze do druh,
thnte stisknutm levm tlatkem myi od zdrojov databze do clov. Jestlie
partie mohou bt zkoprovny, uvidte potvrzovac dialog (jestlie clov
databze nen <a Clipbase>schrnka</a>), jestlie partie nemohou bt
zkoprovny, uvidte chybovou zprvu.
</p>
<p>
Stisk pravho tlatka myi nad databz vyvol vyskakovac menu
tkajc se tto databze, z kterho lze zmnit typ ikony databze nebo
resetovat jej <a Searches Filter>filtr</a>. Toto menu lze rovn pout ke
zmn orientace okna (vertikln nebo horizontln), co je uiten pro
men obrazovky.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}


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

set helpTitle(C,Finder) "Okno vyhledvae soubor"
set helpText(C,Finder) {<h1>Okno vyhledvae soubor</h1>
<p>
<term>Vyhledva soubor</term> vm pomh pi hledn soubor vech typ, kter
lze ve Scidu pout: databz, <a PGN>PGN</a> soubor, <a EPD>EPD</a> soubor a
<a Repertoire>repertorovch</a> soubor.
</p>
<p>
Vyhledva zobrazuje o kadm souboru uiten informace jako jeho velikost
(tte ne) a datum posledn modifikace. Kterkoliv zobrazen soubor lze
otevt jeho vybrnm jednoduchm kliknutm levm tlatkem myi.
</p>

<h3>Hledn v podadresch</h3>
<p>
Jestlie chcete nalzt vechny soubory ve vech podadresch souasnho
adrese, zapnte volbu <b>Hledat v podadresch</b>. Takto bude Scid
rekurzivn hledat ve vech podadresch soubory, kter lze ve Scidu otevt.
Pro mnoho podadres to me trvat velmi dlouho, take nen vhodn to provdt
pro adres blzko koenovho adrese souborovho systmu. Vyhledvn soubor
lze zastavit tlatkem <b>Stop</b>.
</p>

<h3>Velikost souboru</h3>
<p>
Vznam velikosti souboru zobrazen vyhledvaem zvis na typu souboru. Pro
databze Scidu a PGN soubory znamen poet parti. Pro EPD soubory znamen poet
pozic. Pro repertorov soubory znamen poet (zahrnutm nebo vylouench)
variant.
</p>
<p>
Pro vechny typy soubor krom databzi Scidu je velikost souboru
odhad vytvoen prohldnutm jen prvnch 64 kilobyt souboru, take velikost
soubor vtch ne 64 kb nemus bt sprvn. Odhadnut velikosti jsou zobrazeny
se znakem tilda (~), indikujc tak, e nejsou pesn.
</p>

<p><footer>(Aktualizovno: Scid 2.7, Z 2001)</footer></p>
}

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

set helpTitle(C,Tmt) "Okno vyhledvae turnaj"
set helpText(C,Tmt) {<h1>Okno vyhledvae turnaj</h1>
<p>
<term>Vyhledva turnaj</term> vm umouje najt turnaje v aktuln databzi.
Prochz vechny partie databze a ovuje daje o nalezench turnajch.
Vimnte si, e dv partie se povauj za partie ze stejnho turnaje, jestlie
maj stejn speciln oznaen Event (Turnaj), stejn speciln oznaen Site
(Msto) a hrly se v asovm intervalu maximln t msc od sebe.
</p>
<p>
Editac pol pod seznamem turnaj a nslednm stiskem tlatka
<b>Aktualizovat</b> mete seznam omezit potem hr a parti, datumem,
prmrnm Elo ratingem a zem.
</p>
<p>
Zobrazen seznam me bt setdn podle data, potem hr, potem parti,
prmrnm Elo ratingem, mstem, turnajem nebo pjmenm vtze. Kategorii
vyberte z menu <menu>adit</menu> nebo kliknte na titulek poadovanho sloupce.
</p>
<p>
Chcete-li nathnout prvn partii libovolnho zobrazenho turnaje, sta kliknout
levm tlatkem myi, kdy je dek poadovanho turnaje zvraznn. Tak dojde
rovn k aktualizaci okna <a Crosstable>turnajov tabulky</a>, je-li oteveno.
Jestlie msto toho kliknete pravm tlatkem myi, partie se nathne a okno
turnajov tabulky se oteve, i kdy bylo zaveno.
</p>
<p>
Pro urychlen procesu vyhledvn turnaj je dobrou ideou nastavit docela mal
asov rozsah (jako nanejve nkolik let) nebo vybrat uritou zemi (jejm
tznakovm standardnm kdem). To znan zredukuje poet parti, kter Scid
mus vzt do vahy pi zformovn turnaj z parti v databzi.
</p>

<p><footer>(Aktualizovno: Scid 3.3, Duben 2002)</footer></p>
}

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

set helpTitle(C,GameList) "Okno seznamu parti"
set helpText(C,GameList) {<h1>Okno seznamu parti</h1>
<p>
Okno seznamu parti zobrazuje jednodkov souhrn informac pro kadou partii
obsaenou v aktulnm <term>filtru</term>.
</p>

<h3>Navigace v seznamu parti</h3>
<p>
V seznamu parti se mete pohybovat pomoc posuvn lity nebo pouitm ty
tlatek pod seznamem. V seznamu se lze pohybovat rovn pomoc klvesnice, a to
klvesami [Home], [End], [Page Up], [Page Down] a ipkami.
</p>
<p>
Pouitm oknka <b>Hledat text</b> lze vyhledvat nsledujc partii v seznamu,
kter obsahuje v poli Bl, ern, Turnaj nebo Msto jist text.
</p>

<h3>Akce s partiemi v seznamu</h3>
<p>
Nathnout partii ze seznamu lze dvojklikem levho tlatka na partii.
Kliknutm prostednho tlatka myi se zobraz poten tahy partie; to me
bt uiten na kontrolu zahjen partie ped jejm nataenm.
</p>
<p>
Prav tlatko myi vyvol pro vybranou partii menu, v kterm mete prohldnout
nebo pipojit partii (viz ne), smazat (nebo obnovit) partii nebo ji vyjmout z
filtru.
Uvdomte si, e smazan partie jen zapne jej mazac pznak; partie zstane a
do <a Compact>kompaktovn</a> v databzi.
</p>

<h3>Konfigurace seznamu parti</h3>
<p>
Ke konfiguraci seznamu parti kliknte levm nebo pravm tlatkem myi na
titulku sloupce. Mete tak zmnit ku sloupce, pidat nebo odebrat sloupce a
zmnit bravu pro kad sloupec.
</p>
<p>
Chcete-li jen zmnit velikost sloupce, lze pout klvesovou zkratku; pidrenm
klvesy <b>Control</b> (nebo <b>Shift</b>) a souasnm stiskem levho tlatka
myi na titulku sloupce ho zte a stiskem pravho tlatka rozte.
</p>

<h3>Zmna velikosti seznamu parti</h3>
<p>
Velikost okna seznamu parti se zape do souboru voleb pi kadm uloen
voleb.
Take chcete-li, aby seznam parti zobrazoval implicitn 10 parti, zmte
velikost okna seznamu parti a zadejte pkaz <menu>Uloit volby</menu> z menu
<menu>Volby</menu>.
</p>

<h3><name Browsing>Prohlen a pipojovn parti</name></h3>
<p>
Menu vyvolan pravm tlatkem myi v seznamu parti (a tak jin okna jako
okno <a Reports Opening>profilu zahjen</a> a
<a Tree Best>seznam nejlepch parti</a> v okn <a Tree>stromu</a>) poskytuje
vbr nataen, prohldnut a pipojen partie.
</p>
<p>
Pi volb <term>Prohldnout partii</term> jsou tahy vybran partie (bez
koment nebo variant) zobrazovny v samostatnm okn. To je uiten cesta k
prohldnut jin partie bez ovlivnn aktuln nataen partie.
</p>
<p>
Volba <term>Pipojit partii</term> poskytuje zpsob k pipojen vybran partie
jako varianty k aktuln partii. Scid nalezne nejhlub msto, kde se vybran
partie li od aktuln partie (pehozen tah se berou v vahu), a v tto
pozici pid vybranou partii jako variantu. Mete rovn zmnit poet pidanch
tah vybran partie podle toho, jestli chcete pipojit celou partii nebo jen
jej zahjen.
</p>

<p><footer>(Aktualizovno: Scid 3.2, nor 2002)</footer></p>
}


#######################
### Import window help:

set helpTitle(C,Import) "Okno importu parti"
set helpText(C,Import) {<h1>Okno importu parti</h1>
<p>
Okno importu Scidu vm poskytuje jednoduch zpsob ke vkldn partie v
<a PGN>PGN formtu</a> z jin aplikace nebo okna do Scidu.
</p>
<p>
Velk bl rmec v okn je msto, kam zapete nebo vlote text partie v PGN
formtu, ed rmec pod poskytuje zptnou vazbu vech chyb a varovn.
</p>

<h3>Editace aktuln partie prostednictvm okna importu</h3>
<p>
Okno importu lze rovn pout jako ikovn prostedek k proveden nkolika mlo
zmn v aktuln partii: mete vloit aktuln partii do okna importu (pouitm
tlatka <b>Vloit aktuln partii</b>), editovat jej text a po skonen
kliknout <b>Import</b>.
</p>

<h3>Speciln oznaen PGN v okn importu</h3>
<p>
Scid oekv ped vemi tahmi speciln hlavikov oznaen PGN jako nap.
<ul>
<li> <b>[Result "*"]</b>, </li>
</ul>
ale klidn mete vloit partii jako
<ul>
<li> <b>1.e4 e5 2.Sc4 Sc5 3.Dh5?! Jf6?? 4.Dxf7# 1-0</b> </li>
</ul>
bez vech specilnch hlavikovch oznaen a Scid ji importuje.
</p>

<h3>Pouvn PGN soubor ve Scidu</h3>
<p>
Jestlie chcete ve Scidu pouvat formt soubor PGN, ale nechcete ho nejprve
zkonvertovat pouitm <a Pgnscid>pgnscid</a>, existuj zde dv cesty.
</p>
<p>
Za prv mete importovat partie v souboru do existujc databze pouitm
pkazu menu <menu>Nstroje: Import souboru PGN parti...</menu>.
</p>
<p>
Alternativou je oteven PGN souboru pmo ve Scidu. Avak soubory formtu PGN
jsou oteveny pouze ke ten a spotebovvaj vce pamti ne porovnateln
databze Scidu, take to lze doporuit jen pro relativn mal PGN soubory.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

###################
### Exporting help:

set helpTitle(C,Export) "Export parti"
set helpText(C,Export) {<h1>Export parti</h1>
<p>
K exportu aktuln partie nebo vech parti v aktulnm filtru do textovho
souboru mete pout pkazy v menu <menu>Nstroje</menu>.
</p>
<p>
Textov soubor je k dispozici ve tech formtech: <a PGN>PGN</a> (portable game
notation), HTML (pro webov strnky) a LaTeX (populrn szec systm).
</p>
<p>
Pi exportovn si mete vybrat, zda-li chcete vytvoit nov soubor nebo pidat
partie k existujcmu souboru parti exportovanch Scidem.
</p>

<h3>Diagramy</h3>
<p>
Pi exportu v HTML nebo LaTeX formtu Scid automaticky pid diagram, kdykoliv
se v partii objev diagramov <a NAGs>nag</a> ("D") nebo <a Comment>koment</a>
zanajc znakem "#".
</p>

<h3><name Null>Nulov tahy v PGN exportu</name></h3>
<p>
Scid umouje ukldat do partie <a Annotating Null>nulov (przdn) tahy</a>,
protoe mohou bt uiten pi anotaci parti variantami.
Avak  PGN standard pojem nulov tah neobsahuje. Take exportujete-li partie
Scidu s nulovmi tahy do PGN souboru, ostatn PGN tec software nebude schopen
nulov tahy pest.
</p>
<p>
K een tohoto problmu Scid poskytuje pi exportu parti do PGN formtu navc
volbu <b>Convert null moves to comments</b>.
Chcete-li vytvoit PGN soubor, kter me pout jin software, tuto volbu
zapnte a varianty obsahujc nulov tah budou konvertovny na komente. Avak
chcete-li vytvoit PGN soubor, kter me bt pozdji importovn zpt do Scidu
se zachovanmi nulovmi tahmi, ponechte tuto volbu vypnutou.
</p>

<h3>HTML export</h3>
<p>
Scid me exportovat partie do HTML souboru. Aby se zobrazily diagramy, je
potebovat, aby obrzky diagram (distribuovan spolen se Scidem v adresi
"<b>bitmaps/</b>") byly v podadresi <b>bitmaps/</b> pod adresem, kde se
nachz HTML soubor.
</p>

<h3>LaTeX export</h3>
<p>
Scid me exportovat partie do LaTeX souboru.
Partie jsou szeny ve dvou sloupcch na stranu a tahy jsou v symbolick
algebraick notaci.
</p>
<p>
Pro vce informac tte strnku npovdy <a LaTeX>Pouit LaTeXu se Scidem</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.4, ervenec 2002)</footer></p>
}

###############
### LaTeX help:

set helpTitle(C,LaTeX) "Scid a LaTeX"
set helpText(C,LaTeX) {<h1>Pouit LaTeXu se Scidem</h1>
<p>
Scid me partie a profily zahjen ukldat do soubor v LaTeX formtu. LaTeX
je rozen TeXu, populrnho szecho systmu.
</p>
<p>
Chcete-li szet LaTeX soubory vytvoen Scidem, muste mt (samozejm) LaTeX a
muste mt nainstalovan balk achovch font "chess12". Tento balk font
obvykle nen soust standardn instalace LaTeXu, take klidn mete mt LaTeX
a nemuste mt achov fonty.
</p>
<p>
Pro informace o staen a instalaci achovch font navtivte strnku
<url http://scid.sourceforge.net/latex.html>Pouit LaTeXu se Scidem</url>
na <url http://scid.sourceforge.net/>webov strnce Scidu</url>.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

####################
### PGN window help:

set helpTitle(C,PGN) "Okno PGN"
set helpText(C,PGN) {<h1>Okno PGN</h1>
<p>
Okno PGN Scidu zobrazuje obsah aktuln partie ve standardn PGN reprezentaci. V
zpisu tah jsou komente {ve sloench zvorkch} a varianty (v zvorkch).
</p>

<h3>PGN formt</h3>
<p>
PGN (Portable Game Notation) je obecn standard pro penos achovch parti mezi
potaovmi programy.
PGN partie se skld ze dvou sekc. Prvn je hlavika, kter obsahuje speciln
oznaen jako nap.
<b>[White "Kasparov, Gary"]</b>
a
<b>[Result "1/2-1/2"]</b>.
</p>
<p>
Druh sekce obsahuje skuten tahy partie ve standardn algebraick notaci
(standard algebraic notation, SAN) spolen se vemi variantami,
<a NAGs>anotanmi symboly</a> a <a Comment>komenti</a>.
</p>

<h3>Akce v okn PGN</h3>
<p>
Okno PGN mete pout k navigaci v partii: kliknutm levm tlatkem myi na
tah skote do pozice po tomto tahu. Kliknutm levm tlatkem myi na koment
spustte jeho editaci.
Navigan klvesy (tj. ipky) (a klvesy <b>v</b> a <b>z</b> pro skok do a z
varianty) umouj navigaci v partii jako v hlavnm okn.
</p>

<h3>Volby zobrazen PGN</h3>
<p>
Menu okna PGN obsahuj volby, kter ovlivuj vzhled okna PGN. Scid me
zobrazit partii barevn nebo jako obyejn text -- viz menu
<menu>Zobrazit</menu> v okn PGN.
Barevn zobrazen se snadnji te a dovoluje vm vbr tah a koment pouitm
myi, ale je mnohem pomalej na aktualizaci. Pro velmi dlouh partie budete
mon chtt zvolit zobrazen jako obyejn text.
</p>
<p>
Pro vt itelnost mete rovn zmnit formt koment a
variant volbou jejich odsazovn na nov dek.
</p>
<p>
Volby zobrazen PGN a velikost okna PGN se ulo do souboru voleb vdy, kdy
zadte pkaz <b>Uloit volby</b> z menu <menu>Volby</menu> v hlavnm okn.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}


#######################
### Piece Tracker help:

set helpTitle(C,PTracker) "Stopa figur"
set helpText(C,PTracker) {<h1>Okno stopae figur</h1>
<p>
<term>Stopa figur</term> je nstroj, kter zaznamenv pohyb jednotliv figury
ve vech partich v aktulnm filtru a generuje "stopu", kter zobrazuje, jak
asto bylo kad pole figurou navtveno.
</p>
<p>
Chcete-li pout stopae figur, nejprve se ujistte, e filtr obsahuje ty
partie, o kter mte zjem, jako nap. partie, ve kterch se vyskytla urit
pozice zahjen, nebo vechny partie jistho hre blmi figurami. Potom
vyberte figuru, kterou chcete stopovat a nastavte dal stopovac volby; jsou
vysvtleny ne. Pak stisknte tlatko <b>Aktualizovat</b>.
</p>
<p>
Informace o pohybu stopovan figury jsou zobrazeny dvma zpsoby: grafickou
"stopou" a textovm seznamem s jednm dkem daj pro jednotliv pole.
</p>

<h3>Vbr stopovan figury</h3>
<p>
achov figury jsou zobrazeny pod grafem stopy na svch potenm pozicch.
Jednotlivou figuru (jako nap. blho jezdce b1 nebo ernho pce d7) lze
vybrat levm tlatkem myi a vechny figury stejnho typu a barvy (jako nap.
vechny bl pce nebo ob ern ve) lze vybrat pravm tlatkem myi.
</p>

<h3>Ostatn volby stopae figur</h3>
<p>
Rozsah tah uruje, odkud m zat a kde m skonit stopovn v kad partii.
Implicitn rozsah 1-20 (znamenajc konec stopovn po 20. tahu ernho) je
vhodn pro studium motiv zahjen, ale (nap.) rozsah jako 15-35 bude lep pro
sledovn trend stedn hry.
</p>
<p>
Stopaem lze generovat dva typy statistik:
<ul>
<li> <b>% games with move to square</b>: zobrazuje podl parti ve filtru, kter
 obsahuj
     tah stopovan figury na kad pole. To je implicitn a vtinou
     nejvhodnj volba.
<li> <b>% time in each square</b>: zobrazuje podl asu, kter stopovan
     figura strvila na kadm poli.
</ul>
</p>

<h3>Rady</h3>
<p>
Existuj (aspo) ti dobr pouit pro stopae figur: pprava zahjen, motivy
stedn hry a pprava na hre.
</p>
<p>
Pro ppravu zahjen pouvejte stopae figur spolen s otevenm
<a Tree>stromem</a>. Stopovnm figur mete zjistit trendy v aktulnm zahjen
jako nap. obvykl postupy pc, pedsunut jezdcov posty a kam se nejastji
rozmisuj stelci. Mete shledat uitenm nastavit rozsah tah tak, aby
zanal aktulnm tahem partie, take tahy k dosaen aktuln pozice nebudou ve
statistice zahrnuty.
</p>
<p>
Pro motivy stedn hry me bt stopa figur uiten tehdy, kdy filtr byl
nastaven tak, e obsahuje urit rozsah ECO (pouitm
<a Searches Header>Vyhledvn podle hlaviky</a>) nebo i vzor jako nap. bl
izolovan dmsk pec (White IQP) (pouitm
<a Searches Material>Vyhledvn podle materilu/vzoru</a>). Nastavte njak
vhodn (nap. 20-40) rozsah tah a ze "stopy" figur mete vidt nap. postupy
pc v pozdn stedn he nebo ran koncovce.
</p>
<p>
Pro ppravu na hre pouijte <a Searches Header>Vyhledvn podle hlaviky</a>
nebo <a PInfo>Okno informac o hri</a>, abyste nali vechny partie jistho
hre jednou barvou. Pak me bt stopa figur uiten k vyptrn nap. toho,
jak pravdpodobn soupe fianchetuje stelce, rouje nadlouho nebo stav pcov
kln d5 nebo e5.
</p>

<p><footer>(Aktualizovno: Scid 3.3, Duben 2002)</footer></p>
}


###########################
### Repertoire editor help:

set helpTitle(C,Repertoire) "Editor repertoru"
set helpText(C,Repertoire) {<h1>Okno editoru repertoru</h1>
<p>
Editor repertoru vm umouje vytvoit, prohlet a editovat
<term>repertorov</term> soubory. Repertorov soubor (.sor) je seznam pozic
zahjen, kterch chcete doshnout nebo kterm se chcete vyhnout, a lze ho
pout ke sprv vaich preferovanch pozic zahjen a tak k vyhledvn v
databzch ve Scidu.
</p>

<h3>Repertorov skupiny a varianty</h3>
<p>
Repertor obsahuje dva typy element: <term>skupiny</term> a
<term>varianty</term>. Skupiny vlastn nejsou st vaeho repertoru; pouvaj
se jen k jeho uspodn stejn jako adrese k uspodn soubor na disku
potae.
</p>
<p>
Varianty v repertoru jsou dvou typ: <term>zahrnut</term> varianty, kter
reprezentuj pozice zahjen, kter vs zajmaj a kterch chcete doshnout, a
<term>vylouen</term> varianty, kter nemte zjem hrt a chcete se jim
vyhnout.
Nap. hrajete-li ernma pijat dmsk gambit (1.d4 d5 2.c4 dxc4) a po 3.e4
hrajete vechny tahy krom 3...Jf6, budete mt 1.d4 d5 2.c4 dxc4 3.e4 jako
zahrnutou variantu a 1.d4 d5 2.c4 dxc4 3.e4 Nf6 jako vylouenou variantu.
</p>

<h3>Komente a poznmky</h3>
<p>
Kad skupina nebo varianta me mt k sob pipojen koment. Existuj dva
typy: krtk (jednodkov) komente jsou zobrazeny (erven) v hierarchii
repertoru vedle tah skupiny nebo varianty, zatmco dlouh (vcedkov)
koment se zobraz, jen kdy je skupina nebo varianta vybrna.
</p>

<h3>Pouit okna editoru repertoru</h3>
<p>
<b>Lev</b> strana okna zobrazuje hierarchii repertoru. Kliknutm na ikonu
sloky mete rozbalit nebo sbalit skupinu a kliknutm na tahy skupiny nebo
varianty ji vybrat a prohldnout si jej koment.
Zahrnut varianty jsou oznaeny modrou zakrtvac ikonou a vylouen varianty
maj erven kek.
</p>
<p>
Jestlie m varianta nebo skupina krtk koment, je zobrazen za tahmi.
Jestlie m dlouh koment, je indikovn <b><red>**</red></b> za tahmi. Skupiny
maj za svmi tahmi v zvorkch slo, kter uruje poet variant (zahrnutch
nebo vylouench), kter skupiny obsahuj.
</p>
<p>
Kliknut pravm tlatkem myi na skupinu nebo variantu vyvol pro ni menu
funkc, jako nap. jej vmaz nebo zmnu jejho stavu (zahrnut/vylouen).
</p>
<p>
<b>Prav</b> strana okna obsahuje ti rmce. Prvn rmec je seznam tah aktuln
vybran varianty nebo skupiny. Kliknutm levho tlatka myi na nj mete
vloit tyto tahy do okna <a Import>importu</a>, co je uiten k nastaven
aktuln partie tak, aby zanala touto variantou repertoru.
Druh rmec obsahuje krtk koment k variant nebo skupin a tet rmec
obsahuje jej dlouh koment.
</p>

<h3>Pidvn skupin a variant do repertoru</h3>
<p>
Chcete-li do okna pidat variantu nebo skupinu, udlejte na achovnici v hlavnm
okn jej tahy a pak pouitm menu <menu>Editace</menu> v editoru repertoru ji
pidejte jako skupinu, zahrnutou variantu nebo vylouenou variantu.
</p>
<p>
Chcete-li smazat skupinu nebo variantu, kliknte na ni pravm tlatkem myi a z
menu, kter se objev, vyberte poadovan pkaz.
</p>

<h3><name Search>Vyhledvn v databzch pouitm repertorovch
 soubor</name></h3>
<p>
Menu <menu>Hledat</menu> v editoru repertoru vm umouje vyhledvat v aktuln
databzi pouitm repertoru. V kad partii se budou vyhledvat pozice z
repertoru a partie bude vyhovovat, jen kdy nalezen <i>nejhlub</i>
repertorov pozice je v <i>zahrnut</i> variant.
</p>
<p>
Mete si zvolit mezi vyhledvnm pouitm celho repertoru nebo pouze
pouitm zobrazench variant. Vyhledvn pouitm pouze zobrazench variant je
uiten, kdy chcete pout jen st repertoru. Nap. repertor me mt na
nejvy rovni dv hlavn skupiny, jednu pro 1.e4 a druhou pro 1.d4. Jestlie
vs zajmaj jen varianty po 1.e4, jednodue sbalte vtev 1.d4 a potom
vyhledvejte pouze pouitm zobrazench variant.
</p>

<h3>Rady navc</h3>
<p>
Repertorov soubor je skvl pro nalezen novch parti pro v systm
zahjen. Nap. kdykoliv zskte nov PGN soubor pro pipojen k va hlavn
databzi (jako nap. vynikajc tdenn PGN soubor z
<url http://www.chesscenter.com/twic/>The Week In Chess</url>),
otevete tento PGN soubor ve Scidu a provete repertorov vyhledvn.
Prohldnutm filtrovanch parti pak zjistte vechny nov partie, kter jsou ve
vaem repertoru.
</p>
<p>
Mon budete chtt mt dva repertorov soubory: jeden pro ern a
druh pro bl, take budete moct vyhledvat pouitm kadho souboru zvlṻ.
</p>
<p>
Repertorov soubor lze otevt z pkazov dky, nap.: <br>
<b>scid mybase white.sor</b>
</p>
<p>
Repertorov soubor(.sor) mete editovat v libovolnm textovm editoru, bute
vak opatrn, abyste zachovali jeho formt nebo jinak ho nebude mon nathnout
nebo pout k vyhledvn.
</p>

<p><footer>(Aktualizovno: Scid 2.6, Srpen 2001)</footer></p>
}

#####################
### Tree window help:

set helpTitle(C,Tree) "Stromov okno"
set helpText(C,Tree) {<h1>Stromov okno</h1>
<p>
<term>Stromov</term> okno zobrazuje informace o vech tazch zahranch v
aktuln pozici v partich databze. Ve stromovm mdu je okno stromu
aktualizovno automaticky, kdykoliv se v hlavnm okn zmn pozice na
achovnici. Pro velk databze to me bt pomal.
</p>
<p>
Vimnte si, e kdykoliv je stromov okno aktualizovno,
<a Searches Filter>filtr</a> je znovu nastaven tak, e zahrnuje jen partie,
kter obsahuj aktuln pozici.
</p>
<p>
Kliknut levm tlatkem myi na tah ve stromovm okn pid tento tah do
partie.
</p>

<h3>Obsah stromovho okna</h3>
<p>
Stromov okno zobrazuje <a ECO>ECO kd</a> (je-li njak), frekvenci (jednak
 jako poet
parti, jednak procento) a skre kadho tahu.
<term>Skre</term> je vdy potno z perspektivy <b>blho</b>, take 100%
znamen sam vhry blho a 0% znamen sam vhry ernho.
</p>
<p>
Tahy v okn stromu mohou bt azeny podle tahu (abecedn), ECO kdu, frekvence
nebo skre. Pouitm menu <menu>adit</menu> mete metodu azen zmnit.
</p>

<h3><name Best>Okno nejlepch parti</name></h3>
<p>
Stromov okno m tlatko a v souborovm menu pkaz pro oteven okna
<term>nejlepch parti</term>, kter zobrazuje seznam nejcennjch parti v
aktuln zobrazen vtvi stromu.
Partie jsou azeny podle prmrnho ratingu a tento seznam mete omezit tak,
aby zobrazoval jen partie s uritm vsledkem.
</p>

<h3><name Graph>Okno grafu stromu</name></h3>
<p>
Tlatka stromovho okna zahrnuj tlatko oznaen <term>Graf</term>, kter
vyvolv grafick zobrazen relativn spnosti kadho tahu hranho v aktuln
pozici.
Zobrazeny jsou vechny tahy, kter se hrly nejmn v 1% parti a
nejmn 5 krt.
Procentn skre jsou vdy z perspektivy blho, i kdy je na
tahu ern.
</p>
<p>
V grafu stromu je nakreslena erven ra zobrazujc prmrnou spnost ze
vech parti obsahujc aktuln pozici a oblast mezi 50 a 55% (kde le
oekvan spnost standardnch zahjen) je kvli snadnjmu porovnn tah
zobrazena mode. Vimnte si, e na mistrovsk rovni bl obyejn dosahuj
spnosti okolo 55%.
</p>

<h3><name Lock>Zamknut okna stromu</name></h3>
<p>
Tlatko <term>Zamknout</term> ve stromovm okn me bt pouito k zamknut
stromu k aktuln databzi. To znamen, e strom bude nadle pouvat tuto
databzi, i kdy se pepnete do jin oteven databze. To je uiten, kdy
chcete pout velkou databzi jako referenn pi pehrvn partie z jin
databze: jednodue otevete strom pro referenn databzi, zamknte ho a potom
se pepnte do druh databze.
</p>

<h3><name Training>Trnink</name></h3>
<p>
Kdy aktivujete tlatko <term>Trnink</term>, vdy, kdy zahrajete svj
tah, Scid nhodn provede tah.
Tah, kter Scid zvol, zvis na databzov statistice tak, e tah zahran v 80%
parti databze bude Scidem zvolen s 80% pravdpodobnost.
Dobrm zpsobem, jak si otestovat znalosti svho repertoru zahjen, je zapnout
tuto funkci, potom skrt (nebo minimalizovat) stromov okno a hrt zahjen
proti velk databzi.
</p>

<h3>Pouit stromu s otevenmi EPD soubory</h3>
<p>
Pro kad oteven <a EPD>EPD soubor</a> stromov okno obsahuje jeden sloupec
 navc, kter
zobrazuje krtk (ptiznakov) souhrn obsahu EPD souboru pro kadou pozici,
dosaenou tahy v seznamu.
</p>
<p>
Souhrn me bt hodnocen, kd zahjen nebo navren tah; bude to obsah prvnho
EPD pole nalezenho v nsledujcm seznamu: <b>ce, eco, nic, pv, pm, bm, id</b>
nebo jen prvn EPD pole, jestlie vechny z uvedench chyb.
</p>
<p>
Pro popis EPD pol si pette strnku npovdy o <a EPD>EPD souborech</a>.
Vimnte si, e jestlie je souhrn z <b>ce</b> pole, je zobrazen z dvodu lep 
itelnosti jako hodnocen v pcch z perspektivy blho (radji ne skre 
v setinch pc z perspektivy strany, kter je na tahu, jako je jeho vlastn 
formt uloen v EPD souboru).
</p>

<h3>Pouvn cache pro rychlej vsledky</h3>
<p>
Scid pouv cache pro stromov vyhledvac vsledky pro pozice, kterm odpovd
nejvce parti. Jestlie se ve stromovm mdu posunete v partii o tah dopedu a
zpt, aktualizace okna stromu se provede tm okamit, jestlie vyhledvan
pozice je v cache.
</p>
<p>
Okno stromu obsahuje v souborovm menu pkaz <term>Uloit cache soubor</term>.
Kdy ho zadte, aktuln obsah stromov cache v pamti se zape do souboru (s
pponou <b>.stc</b>) a dojde tak ke zrychlen budoucho pouit tto databze
ve stromovm mdu.
</p>
<p>
Pkaz <term>Naplnit cache soubor</term> v souborovm menu okna
stromu napln cache soubor daji pro mnoho pozic zahjen.
Provede se stromov vyhledvn pro asi 100 nejbnjch pozic zahjen a pot
se ulo cache soubor.
</p>
<p>
Uvdomte si, e stromov cache (.stc) soubor je cel nadbyten; mete
ho smazat bez toho, aby jste ovlivnili danou databzi, a ve skutenosti je
Scidem smazn vdy, kdy se objev operace, po kter by zstal neaktuln --
nap. pidn nebo nahrazen partie nebo tdn databze.
</p>

<p><footer>(Aktualizovno: Scid 3.0, Listopad 2001)</footer></p>
}



####################
### Compaction help:

set helpTitle(C,Compact) "Kompaktovn databze"
set helpText(C,Compact) {<h1>Kompaktovn databze</h1>
<p>
<term>Kompaktovn</term> databze je specifick typ <a Maintenance>drby</a>,
kterm se databze uchovv co mon nejmen a nejvkonnj.
Kompaktovn databze znamen odstrann vechno nevyuitho prostoru v jejch
souborech.
Existuj dva druhy kompaktovn: jmennho souboru a partiovho
souboru.
</p>

<h3>Kompaktovn jmennho souboru</h3>
<p>
asem mon zjistte, e databze zan obsahovat mnostv jmen hr, turnaj,
mst a kol, kter u nejsou v dn partii pouita. To se asto stane po
kontrole pravopisu jmen. Nepouit jmna v jmennm souboru zbyten zabraj
msto a mohou zpomalit vyhledvn podle jmen.
Kompaktovn jmennho souboru odstran vechny jmna, kter nejsou pouita v
dn partii.
</p>

<h3>Kompaktovn partiovho souboru</h3>
<p>
Kdykoliv je partie nahrazena nebo smazna, zstane v partiovm souboru
(nejvt ze t soubor tvoc databzi Scidu) zbyten voln msto.
Kompaktovn partiovho souboru odstran vechno zbyten voln msto, nesmazan
partie ponech v databzi. Uvdomte si, e tato operace je nevratn: po
kompaktovn jsou smazan partie navdy pry!
</p>
<p>
Kompaktovn partiovho souboru se doporuuje tak po <a Sorting>tdn</a>
databze, aby se udrel stav partiovho souboru konzistentn se setdnm
indexovm souborem.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}


####################################
### Database maintenance tools help:

set helpTitle(C,Maintenance) "drba databze"
set helpText(C,Maintenance) {<h1>drba databze</h1>
<p>
Scid poskytuje mnostv nstroj pro drbu databze, jsou dostupn z menu Scidu
<a Menus File>Soubor</a>. <a Compact>Kompaktovn</a> databze a
<a Sorting>tdc</a> funkce jsou vysvtleny na samostatnch strnkch
npovdy.
</p>

<h3>Okno drby</h3>
<p>
Vtinu drby databze ve formtu Scidu lze provst z okna drby, kter mete
otevt z menu <menu>Soubor: drba</menu> nebo z menu <menu>Okna</menu> nebo
pouitm klvesov zkratky <b>Ctrl+M</b>.
</p>
<p>
Toto okno mete pout k drb <a Flags>pznak parti</a>, kontrole
pravopisu jmen, <a Compact>kompaktovn</a> nebo <a Sorting>tdn</a>
databze. Vimnte si, e vechny operace, kter nejsou pro aktuln databzi
dostupn (nap. protoe je jen ke ten nebo je PGN soubor), budou zobrazeny
edou barvou.
</p>

<h3><name Twins>Mazn zdvojench parti</name></h3>
<p>
Menu <menu>Soubor: drba</menu> obsahuje pkaz
<menu>Vymazn zdvojench parti...</menu> pro detekci dalch kopi (dvojnk)
parti v databzi.
Tento pkaz nalezne vechny pry parti, kter jsou dvojnky, a pro kad pr
nastav pznak krat partie na smazan a pznak del partie ponech na
nesmazan.
Dv partie jsou pokldny za dvojnky, jestlie se jejich hri (a libovoln
jin speciln oznaen, kter mete voliteln specifikovat) pesn shoduj.
</p>
<p>
Jestlie specifikujete volbu "tyt tahy", kad pr parti mus mt stejn
aktuln tahy a do dlky krat partie (nebo do 60. tahu kterkoliv), aby byli
partie pokldny za dvojnky.
</p>
<p>
Jestlie jste provedli mazn dvojnk, je dobrou mylenkou ovit si, jestlie
kad smazan partie je opravdu kopi druh partie.
To mete jednodue provst, jestlie v dialogovm okn mazn zdvojench parti
vyberete volbu "<b>Nastavit filtr na vechny vymazan zdvojen partie</b>".
Filtr budu potom obsahovat vechny smazan partie.
Mete si je prohldnout (pouitm klves <b>p</b> a <b>n</b>) pouitm okna
<term>kontroly zdvojench parti</term> (dostupn z menu drby nebo pouitm
klvesov zkratky <b>Ctrl+Shift+T</b>) a ovit si, e partie jsou smazan,
protoe jsou skuten dvojnky jin partie.
</p>

<h3><name Editing>Editace jmen hr, turnaj, mst a kol</name></h3>
<p>
Ve va databzi mete najt patn napsan jmna a chcete je opravit.
To mete provst ve Scidu pouitm okna <term>editoru jmen</term> (klvesov
zkratka: <b>Control+Shift+N</b>), dostupnho z podmenu
<menu>Soubor: drba</menu>.
</p>
<p>
Kad jedinen jmno je uloeno v jmennm souboru jen jednou,
take jeho zmna vlastn zmn vechny jeho vskyty.
</p>

<h3><name Spellcheck>Kontrola pravopisu jmen</name></h3>
<p>
Scid se distribuuje spolen se souborem <term>pro kontrolu pravopisu</term>
pojmenovanm <b>spelling.ssp</b>, pouvanm pro opravu jmen hr, turnaj,
mst a kol.
Scid se pokou nahrt soubor pro kontrolu pravopisu pi kadm startu; jestlie
se nenathne, mete ho nathnout z menu <menu>Volby</menu>.
</p>
<p>
Kdy u je soubor pro kontrolu pravopisu nataen, mete ho pout pro databze
ve formtu Scidu prostednictvm pkaz pro kontrolu pravopisu v menu
<menu>Soubor: drba</menu> nebo z okna drby.
</p>
<p>
Kdy kontrolujete pravopis jmen databze, Scid produkuje seznam korekc, kter
mete ped jejich vlastnm provedenm editovat, take mete odstranit vechny
korekce, kter provst nechcete.
</p>
<p>
Kontrola pravopisu je zvlṻ uiten pro standardizaci databze, aby vechny
pklady jednotlivho jmna mli stejn tvar.
Nap. se standardnm souborem pro kontrolu pravopisu by byla jmna "Kramnik,V.",
"Vladimir Kramnik", and "V. Kramnik" opravena na "Kramnik, Vladimir".
</p>
<p>
Soubor pro kontrolu pravopisu m jedno pouit navc: kdy je nataen, jeho
daje o hrch jsou pouity k rozen okna <a PInfo>informac o hri</a> a
 okna
<a Crosstable>turnajov tabulky</a>: pro kadho hre obsaenho v souboru pro
kontrolu pravopisu uvidte jeho mistrovsk titul FIDE (<b>gm</b> = mezinrodn
velmistr, <b>im</b> = mezinrodn mistr atd.) a jeho zemi. Soubor
<b>spelling.ssp</b>, distribuovan spolen se Scidem, obsahuje pes 6500
silnch hr minulosti a ptomnosti.
</p>

<h3><name Ratings>Pidn Elo rating do parti</name></h3>
<p>
Tlatko "Pidat Elo ratingy..." v okn drby zpsob, e Scid vyhled v
aktuln databzi partie, v kterch hr nem rating, ale soubor pro kontrolu
pravopisu jeho rating k datu partie obsahuje. Scid vechny takov ratingy
automaticky pid. To je velmi uiten pro databze mistrovskch parti, kter
maj mlo rating.
</p>
<p>
Soubor pro kontrolu pravopisu "spelling.ssp", dodvan spolen se Scidem,
neobsahuje informace o Elo ratingch potebnch pro tuto funkci, ale jeho vt
verze s nzvem "ratings.ssp" je dostupn na <a Author>webov strnce Scidu</a>.
</p>

<h3><name Cleaner>itn databze</name></h3>
<p>
<term>itn databze</term> (dostupn z okna drby) je nstroj pro vykonvn
vce operac drby databze narz. Mete si vybrat, kter operace chcete
provst, a Scid je s aktuln databz provede bez nutnosti uivatelskho
zsahu. To je zvlṻ uiten pro drbu velkch databz.
</p>

<h3>Vbr automaticky otevran partie</h3>
<p>
<term>Automaticky otevran</term> partie databze je partie, kter se
automaticky nathne pi kadm oteven databze. Chcete-li zmnit automaticky
otevranou partii databze, pouijte tlatko  "Automaticky otevrat partii
slo...". Jestlie chcete, aby se nathla vdy posledn partie databze (bez
ohledu na skuten poet parti v databzi), nastavte ji na velmi vysok slo
nap. 9999999.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Prosinec 2001)</footer></p>
}

#################
### Sorting help:

set helpTitle(C,Sorting) "Tdn databze"
set helpText(C,Sorting) {<h1>Tdn databze</h1>
<p>
<term>Tdc</term> funkce td vechny partie v databzi. Mete si vybrat
mnostv tdcch kritri.
Kdy jsou dv partie rovnocenn podle prvnho kritria, jsou setdny podle
druhho kritria atd. </p>

<h3>Tdc kritria</h3>
<p>
Dostupn tdc kritria jsou:
</p>
<ul>
<li> Datum (nejstar partie prvn)
<li> Rok (stejn jako datum, ale pouije se jen rok)
<li> Jmno turnaje
<li> Jmno msta
<li> Zem (posledn 3 psmena jmna msta)
<li> Jmno kola
<li> Jmno blho
<li> Rating (prmr ratingu blho a ernho, nejvy prvn)
<li> Jmno ernho
<li> Vsledek (vhry blho, remzy a pak vhry ernho)
<li> Dlka (poet kompletnch tah v partii)
<li> ECO (<a ECO>kd Encyklopedie achovch zahjen</a>)
</ul>

<h3>Vsledky tdn</h3>
<p>
Kdy tdte databzi Scidu, kter nen jen ke ten, vsledky tdn jsou
uloeny, take poad parti v databzi je trvale zmnno. Jestlie chcete, aby
setdn bylo jen doasn, pouitm pkazu menu <b>Soubor: Pouze pro ten</b>
nastavte nejprve databzi jen ke ten.
</p>
<p>
Kdy tdte databzi, kter je jen ke ten nebo je skuten PGN soubor,
vsledky tdn nemohou bt uloeny, take po zaven souboru bude setdn
poad parti ztraceno.
</p>
<p>
Vimnte si, e tdn databze znovu nastav
<a Searches Filter>vyhledvac filtr</a> tak, e obsahuje vechny partie.
</p>

<h3>Dleit poznmka k tdn databz:</h3>
<p>
Pi tdn databze je zmnn indexov soubor, ale partiov soubor nikoliv. To
znamen, e tdn databze zanech zznamy v partiovm souboru pomchan
vzhledem k indexovmu souboru. To me vznamn <b>zpomalit</b> <a
 Tree>stromov</a>
vyhledvn, <a Searches>vyhledvn</a> podle pozice a podle materilu/vzoru,
 take abyste
udreli dobr vyhledvac vsledky, mli byste po setdn databze
reorganizovat partiov soubor jeho <a Compact>kompaktovnm</a>.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

###############
### Flags help:

set helpTitle(C,Flags) "Pznaky partie"
set helpText(C,Flags) {<h1>Pznaky partie</h1>
<p>
<term>Pznak</term> je indiktor njakch achovch charakteristik, kter me
bt zapnut nebo vypnut pro kadou partii v databzi.
Ve Scidu existuje 13 uivatel nastavitelnch pznak, kter mete pmo
nastavit pro kadou partii. Z nich jen mazac pznak m speciln vznam:
partie se zapnutm mazacm pznakem jsou oznaeny k vmazu a pi
<a Compact>kompaktovn</a> databze budou odstranny.
</p>
<p>
12 ostatnch uivatelem nastavitelnch pznak a jejich symboly jsou:
</p>

<ul>
<li>Zahjen blho (W)</li>
<li>Zahjen ernho (B)</li>
<li>Stedn hra (M)</li>
<li>Koncovka (E)</li>
<li>Novinka (N)</li>
<li>Pcov struktura (P)</li>
<li>Taktika (T)</li>
<li>Hra na dmskm kdle (Q)</li>
<li>Hra na krlovsk kdle (K)</li>
<li>Brilantn (!)</li>
<li>Hrubka (?)</li>
<li>Uivatel (U)</li>
</ul>

<p>
Pznak me bt nastaven pro aktuln partii, pro vechny partie filtru nebo
pro vechny partie databze pouitm okna <a Maintenance>drby</a>.
</p>
<p>
Mete pout <a Searches Header>vyhledvn podle hlaviky</a> pro nalezen
vech parti v databzi, kter maj konkrtn pznak zapnut nebo vypnut, nebo
pout pznaky jako st komplexnjch vyhledvn.
</p>
<p>
Protoe vechny uivatelem nastaviteln pznaky (krom mazacho pznaku)
nemaj pro Scid dn vznam, mete je pouvat pro jakkoliv el, vhodn pro
vae poteby. Nap. mete pout pznak hry na krlovskm kdle (K) pro
pcov toky na krlovsk kdle nebo pro tok na krlovskm kdle tkmi
figurami nebo dokonce pro koncovky se vemi pci na krlovskm kdle.
</p>

<p><footer>(Aktualizovno: Scid 3.0, Listopad 2001)</footer></p>
}

#########################
### Analysis window help:

set helpTitle(C,Analysis) "Analytick okno"
set helpText(C,Analysis) {<h1>Analytick okno</h1>
<p>
Analytick okno ve Scidu zobrazuje analzu achovho programu
(oznaovanho jako <term>motor</term>) souasn pozice na achovnici. Pi kad
zmn na achovnici posl Scid motoru novou pozici a zobrazuje jeho hodnocen
tto pozice.
</p>
<p>
Skre zobrazen v tomto analytickm okn je vdy z perspektivy
blho, take negativn skre indikuje lep pozici ernho.
Spodn rmec v tomto okn (s posuvnkem) zobrazuje historii hodnocen tto
pozice produkovan motorem, take si mete prohldnout, jak se hodnocen
mnila.
</p>
<p>
Chcete-li pidat nejlep tah vybran motorem jako nov tah aktuln partie,
stisknte tlatko <b>Pidat tah</b>.
</p>

<h3><name List>Seznam analytickch motor</name></h3>
<p>
Scid si udruje seznam pouvanch motor, spolu s odhadem jejich Elo ratingu
(jestli njak mte) a datem jejich poslednho pouit. Seznam motor lze
setdit podle jmna, Elo ratingu nebo data.
Chcete-li do seznamu pidat nov motor nebo editovat detaily existujcho
motoru, stisknte tlatko <b>Nov</b> nebo <b>Editace</b>.
</p>

<h3><name Start>Pkazy a adrese motor</name></h3>
<p>
Pro kad motor muste specifikovat jeho spustiteln soubor a adres, kde m
bt Scidem sputn.
</p>
<p>
Dvodem vtiny problm se startem motor je vbr adrese, v kterm m bt
motor sputn. Nkter motory vyaduj ke svmu dnmu startu ve svm
startovacm adresi existenci inicializanho souboru nebo souboru knihoven
zahjen.
Jin motory (jako Crafty) zapisuj do adrese, kde byly sputny, tzv. logovac
soubory, take je nutn je spustit v takovch adresch, kde mte pstupov
prvo zpisu.
Jestlie nastaven adrese pro motor je ".", Scid nastartuje tento motor v
aktulnm adresi.
</p>
<p>
Take jestlie njak motor, kter by ml ve Scidu skvle pracovat, nelze
nastartovat, zkuste zmnit nastaven jeho adrese. Chcete-li zabrnit vzniku
logovacch soubor v mnoha rznch adresch, doporuuji vm spoutt motory v
adresi uivatelskch soubor Scidu (tj. tam, kde se nachz soubor
<b>scid.exe</b> pro Windows nebo v adresi <b>~/.scid/</b> pro Unix); v
dialogovm okn pro editaci detail motoru je tlatko oznaen
<b>scid.exe dir</b> pro Windows nebo <b>~/.scid</b> pro Unix, kterm mete
nastavit spoutn motoru v tomto adresi.
</p>

<h3>Trnink</h3>
<p>
Tlatkem <b>Trnink</b> mete proti analytickmu motoru hrt. as na kad tah
je pevn dan a v trninkovm mdu nejsou zobrazeny vsledky analzy.
</p>

<h3>Anotace partie</h3>
<p>
Tlatko <b>Pidat variantu</b> v analytickm okn pid do partie aktuln
skre a nejlep pokraovn za ob strany jako novou variantu.
</p>
<p>
Anotaci srie tah (i cel partie) mete provst automaticky stiskem tlatka
<b>Anotace</b>. Budete dotzni na urit nastaven anotace a potom se spust
reim automatickho pehrvn.
V reimu automatickho pehrvn pi otevenm analytickm okn je pro kadou
pozici (pehranou v automatickm reimu) samoinn pidna varianta obsahujc
skre a nejlep pokraovn za ob strany.
Anotovny jsou pouze pozice od aktuln pozice do konce partie (nebo dokud
neukonte reim automatickho pehrvn), take pesunem do pozice ze stedn
hry ped sputnm reimu automatickho pehrvn mete peskoit anotaci
zahjen.
</p>
<p>
Chcete-li kdykoliv anotaci ukonit, sta jen ukonit reim automatickho
pehrvn, nap. stiskem klvesy <b>Escape</b> v hlavnm okn.
</p>
<p>
Vimnte si, e pro zjednoduen je tlatko <b>Anotace</b> pstupn jen v okn
analytickho motoru 1. Jestlie spustte motor jako analytick motor 2, nebudete
ho moci pout k anotaci partie.
</p>

<h3>Analytick achovnice</h3>
<p>
Stisk tlatka ikony achovnice v analytickm okn zobraz nebo skryje
analytickou achovnici, kter zobrazuje pozici na konci aktuln nejlep
varianty hry nalezenou motorem. Funguje to pro vtinu motor kompatibilnch se
Scidem, ale nemus pro vechny; zle to na tom, jakou notaci tah motor
pouv.
</p>

<h3>Priorita motoru</h3>
<p>
Jestlie motor vyuv pli mnoho asu CPU (tj. procesoru) a negativn
tak ovlivuje pouvn Scidu nebo jinch aplikac, me pomoct zapnut
tlatka <b>Nzk CPU priorita</b>; tm dte motoru nzkou prioritu pi
plnovn CPU. </p>

<h3>Detaily rozhran</h3>
<p>
Abyste mohli pouvat analytick okno, budete potebovat achov program, kter
podporuje <term>WinBoard/Xboard</term> protokol.
</p>
<p>
Scid posl motoru pi jeho startu pkazy <b>xboard</b>, <b>post</b> a
<b>protover 2</b> a jestlie motor svou odpovd indikuje, e je podporuje, Scid
pouije pro efektivnj komunikaci s motorem pkazy <b>setboard</b> a
<b>analyze</b>.
Jestlie motor nepodporuje pkaz <b>setboard</b>, nebude schopen poskytovat
analzu dn partie, kter zan s nestandardn poten pozic.
</p>
<p>
Programm, kter nepodporuj pkaz <b>analyze</b>, Scid pi kad zmn pozice
posl nsledujc pkazy: <b>new</b> a <b>force</b>, tm se pesune do partie
do aktuln pozice a pak <b>go</b>.
</p>
<p>
J pouvm a doporuuji pro analytick okno Scidu znamenit achov freeware
program <term>Crafty</term> od Boba Hyatta, ale se Scidem bylo spn pouito
mnoho dalch WinBoard nebo XBoard kompatibilnch program. Ne je seznam
webovch strnek pro staen nkolika motor.
</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>(Aktualizovno: Scid 3.4, Z 2002)</footer></p>
}

###################
### EPD files help:

set helpTitle(C,EPD) "EPD soubory"
set helpText(C,EPD) {<h1>EPD soubory</h1>
<p>
EPD (extended position description, tj. rozen popisova pozice) soubor je
kolekce pozic, kde kad pozice m njak doprovodn text. Jako <a PGN>PGN</a>,
je to obecn standard pro achov informace.
</p>
<p>
EPD soubor m poet definovanch <term>opkd (opcodes)</term> (pol), kter
jsou uloeny v souboru oddleny stednkem(<b>;</b>), ale v okn EPD Scidu jsou
kvli jednodu editaci zobrazeny na samostatnch dcch.
Stednk uvnit EPD pole je uloen Scidem jako "<b>\s</b>", aby byl odlien od
znaku konce pole.
Kad pozice a k n asociovan opkdy jsou uloeny na jedn dce v EPD
souboru.
</p>
<p>
Standardn EPD opkdy zahrnuj:
<ul>
<li> <b>acd</b> analytick poet: hloubka vyhledvn.</li>
<li> <b>acn</b> analytick poet: poet uzl (nodes) vyhledvn.</li>
<li> <b>acs</b> analytick poet: doba vyhledvn v sekundch.</li>
<li> <b>bm</b> nejlep tahy: tah(y) ocenn() nejlpe z njakho dvodu.</li>
<li> <b>ce</b> setinopcov hodnocen: hodnocen v setinch pc z perspektivy
     <b>strany, kter je na tahu</b> -- vimnte si rozdlu proti oknu analzy,
     kter zobrazuje hodnocen v pcch z perspektivy blho.</li>
<li> <b>cX</b> koment (kde <b>X</b> je slo, 0-9).</li>
<li> <b>eco</b> kd zahjen podle <a ECO>ECO</a> systmu.</li>
<li> <b>id</b> jedinen identifikace pro tuto pozici.</li>
<li> <b>nic</b> kd zahjen podle <i>New In Chess</i> systmu.</li>
<li> <b>pm</b> pedpokldan tah: prvn tah PV.</li>
<li> <b>pv</b> pedpokldan varianta: varianta nejlep hry.</li>
</ul>

<p>
EPD soubory maj mnoho pouit: Scid pouv EPD soubor ke klasifikaci parti
podle systmu <a ECO>Encyklopedie achovch zahjen</a> (Encyclopedia of Chess
Openings, ECO) a vy sami si mete vytvoit EPD soubor pro v repertor
zahjen pidnm koment k pozicm, kter se ve vaich partich pravideln
vyskytuj.
</p>
<p>
Vytvoit nov EPD soubor nebo otevt u existujc mete pkazy
<menu>Nov</menu> a <menu>Otevt</menu> z menu <menu>Soubor</menu>. Kdykoliv
me bt oteveno nejve tyi EPD soubory.
</p>

<h3>EPD okna</h3>
<p>
Pro kad oteven EPD soubor uvidte jedno okno, kter zobrazuje text k
aktuln pozici. Chcete-li uloit zmny v textu k pozici, nen poteba
stisknout tlatko Uloit; text bude uloen vdy, kdy se pesunete k jin
pozici v partii.
</p>

<h3>Navigace v EPD souborech</h3>
<p>
Chcete-li si prohldnout pozice v EPD souboru, pouijte pkazy
<menu>Next position</menu> a <menu>Previous position</menu> z menu
<menu>Tools</menu> v EPD okn nebo pouijte klvesov zkratky
<b>Ctrl+ipkaDol</b> a <b>Ctrl+ipkaNahoru</b>.
Tyto pkazy zpsob pesun na nsledujc/pedchzejc pozici v souboru spolu
s odstrannm aktuln partie a nastavenm jej poten pozice.
</p>

<h3>Odstrann EPD pol</h3>
<p>
EPD soubory, kter naleznete na Internetu, mohou obsahovat pole, kter vs
nezajmaj a mohou tak zbyten zabrat mnoho msta v souboru.
Nap. EPD soubor hodnocen achovho programu me mt pole ce, acd, acn, pm, pv
a id, ale mon budete potebovat jen pole ce a pv.
</p>
<p>
EPD opkd mete odstranit ze vech pozic v EPD souboru pouitm pkazu
<menu>Strip out EPD field</menu> z menu <menu>Tools</menu> v EPD okn.
</p>

<h3>Stavov lita EPD okna</h3>
<p>
Stavov lita kadho EPD okna ukazuje:
<ul>
<li>- status souboru (<b>--</b> znamen nezmnn, <b>XX</b> znamen zmnn
      a <b>%%</b> znamen jen ke ten); </li>
<li>- jmno souboru; </li>
<li>- poet pozic v souboru; </li>
<li>- legln tahy z aktuln pozici vedouc do jin pozice v tomto EPD
      souboru.</li>
</ul>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

######################
### Email window help:

set helpTitle(C,Email) "Emailov okno"
set helpText(C,Email) {<h1>Emailov okno</h1>
<p>
Okno emailovho manaera Scidu vm poskytuje prostedky ke sprv
korespondennch parti hranch emailem.
Jestlie nehrajete achy pes email, nebude vs to zajmat.
Ale jestlie hrajete korespondenn partie pes email, mete emailov zprvy
poslat pmo ze Scidu!
</p>
<p>
Pouit emailovho manaera:
<ul>
<li><b>1)</b> Vytvote v databzi partii(e) pro vaeho soupee. </li>
<li><b>2)</b> V okn emailovho manaera zvolte <b>Add</b> a zadejte daje o
vaem soupei: jmno, emailov adresa a sla parti v databzi. </li>
<li><b>3)</b> V emailovm okn zvolte <b>Send email</b> vdy, kdy jste pidali
tahy do partie() a chcete odeslat zprvu. </li>
</ul>

<p>
Pi odesln emailov zprvy Scid vygeneruje zprvu s parti v PGN formtu
<b>bez</b> jakchkoliv koment, anotac a variant, protoe obvykle nebudete
chtt, aby soupe vidl vae analzy.
Ped odeslnm mete zprvu editovat pidnm podmnnch tah nebo jinho
textu.
</p>
<p>
Pro kadho soupee mete mt libovoln poet parti; nejastji jednu nebo
dv. Uvdomte si, e Scid nekontroluje zmny sel parti, take po zadan daj
o vaem soupei dvejte pozor, abyste databzi vaich emailovch parti
netdili ani v n nemazali dn partie, protoe tak by dolo k peuspodn
parti a sla parti pro kadho soupee by byla patn.
</p>

<h3>Omezen</h3>
<p>
Scid dosud nedisponuje dnou funkc kontroly vaich emailovch poada, take
je stle nutn pidvat tahy vaeho soupee do partie manuln.</p>

<h3>Konfigurace</h3>
<p>
Kopie vech emailovch zprv odeslanch Scidem je uloena v souboru
<b>~/.scid/scidmail.log</b>. Jestlie chcete, aby byly uloeny v jinm souboru,
budete muset editovat soubor <b>tcl/start.tcl</b> a rekompilovat Scid.
</p>
<p>
Scid me poslat zprvy pouitm SMTP serveru nebo pkazu sendmail. Ke
specifikaci va volby pouijte tlatko <b>Settings</b> v okn emailovho
manaera.
</p>
<p>
Scid ukld daje o soupech z databze vaich emailovch parti v
souboru se stejnm jmnem jako tato databze a pponou "<b>.sem</b>".
</p>

<p><footer>(Aktualizovno: Scid 3.0, Listopad 2001)</footer></p>
}

########################
### Reports help:

set helpTitle(C,Reports) "Profily"
set helpText(C,Reports) {<h1>Profily</h1>
<p>
<term>Profil</term> ve Scidu je dokument obsahujc informace o urit pozici nebo uritm hri. Existuj dva typy profil, kter me Scid generovat: profil zahjen a profil hre.
</p>

<h3><name Opening>Profily zahjen</name></h3>
<p>
Scid me vytvoit <term>profil zahjen</term>, kter zobrazuje zajmav
informace o pozici zahjen. Chcete-li vytvoit profil zahjen, nejprve se
ujistte, e zobrazen pozice je ta, pro kterou profil chcete, a potom zvolte
<b>Profil zahjen</b> z menu <b>Nstroje</b>.
</p>
<p>
Okno <term>profilu zahjen</term> zobrazuje vsledek profilu vygenerovanho
Scidem. Menu <b>Soubor</b> obsahuje pkazy pro uloen (vytitn) profilu do
textovho souboru, do HTML souboru nebo <a LaTeX>LaTeX</a> souboru.
</p>
<p>
Prvn sekce profilu prezentuj informace na partich, kter doshly pozice
profilu, a na tazch hranch od tto pozice. Lze zde vidt, jestli se zahjen
stv vce populrnm, jestli m mnoho krtkch remz a jak poad tah
(transpozice) se pouvaj k jej dosaen.
</p>
<p>
Sekce pozinch tmat zobrazuje  frekvenci uritch bnch pozinch tmat v profilovanch partich. K tomu se pouije prvnch 20 tah kad partie (tedy prvnch 40 pozic kad partie po poten pozici). Partie se zapote jako partie obsahujc urit tma, jestlie obsahuje dan tma alespo ve 4 pozicch v prvnch 20 tazch partie. Tak se zabrn ovlivnn vsledku krtkm vskytem tmat (jako nap. izolovan dmsk pec, kter je okamit vzat).
</p>
<p>
Posledn a nejvt st profilu je tabulka teorie. Pi ukldn profilu do
souboru si mete vybrat mezi uloenm jen tabulky teorie, kompaktnm profilem
bez tabulky teorie nebo celm profilem.
</p>
<p>
Skoro vechny sekce profilu mohou bt zapnuty nebo vypnuty nebo upraveny
prostednictvm voleb profilu zahjen, take si mete profil pizpsobit
tak, aby zobrazoval jen informace, kter vs zajmaj.
</p>
<p>
Vtina informac v profilu zahjen, kter jsou zobrazeny barevn, vyvolaj
pi vbru levm tlatkem myi njakou akci. Napklad pi kliknut na
referenci partie dojde k jej nataen, pi kliknut na pozin motiv dojde k
nastaven filtru tak, e bude obsahovat jen partie profilu, ve kterch se tento
motiv vyskytl.
</p>

<h4>Oblben</h4>
<p>
Menu <menu>Oblben</menu> v okn profilu umouje udrovat sbrku oblbench pozic profilu zahjen a jednodue generovat profil zahjen pro vechny tyto pozice. Vbrem "Add Report..." z menu Oblben pidte aktuln pozici jako oblbenou profilovanou pozici; budete vyzvni k zadn jmna, kter bude pouito jako jmno souboru pi generovn oblbench profil.
</p>
<p>
Chcete-li generovat profil pro kad oblben profil pi pouit aktuln databze, zvolte z menu Oblben "Generovat profil...". Objev se dialogov okno, kter Vm umon specifikovat typ a formt profilu a adres, kde budou uloeny soubory profil. Podle formtu, kter jste zvolili, bude ke kadmu souboru profilu pidna vhodn ppona (nap. ".html" pro HTML formt).
</p>

<h3><name Player>Profily hr</name></h3>
<p>
<term>Profil hre</term> je velmi podobn profilu zahjen, ale obsahuje informace o partich jednoho hre blmi nebo ernmi figurami. Profil hre mete generovat z menu Nstroje nebo z okna <a PInfo>Informac o hri</a>.
</p>
<p>
Profil hre me bt generovn bu pro vechny partie danho hre danmi figurami nebo jen pro podmnoinu tch parti, kter doshly aktuln pozici na achovnici v hlavnm okn.
</p>


<h3>Omezen</h3>
<p>
Pro vtinu dat generovanch profilem existuje limit 2000 parti, take
jestlie se pozice profilu vyskytuje ve vce ne 2000 partich, njak vsledky
mohou bt trochu nesprvn.
</p>
<p>
Rovn pro tabulku teorie existuje limit 500 parti. Jestlie se pozice profilu
vyskytuje ve vce ne 500 partich, jen 500 parti s nejvym prmrnm Elo
ratingem se pouije ke generovn tabulky teorie. Poet parti pouitch ke
generovn tabulky teorie mete upravit ve volbch Profilu zahjen.
</p>

<p><footer>(Aktualizovno: Scid 3.5, nor 2003)</footer></p>
}


#####################
### Player List help:

set helpTitle(C,PList) "Okno vyhledvae hr"
set helpText(C,PList) {<h1>Okno vyhledvae hr</h1>
<p>
Okno <term> vyhledvae hr</term> zobrazuje seznam jmen
hr v aktuln databzi. Vbrem hre se oteve okno
<a PInfo>informac o hri</a> s podrobnjmi informacemi o tomto hri.
</p>
<p>
Zobrazuje se pt sloupc, kter zobrazuj jmno kadho hre, jeho nejvy
rating, poet jeho parti a rok jeho nejstar a nejnovj partie.
Chcete-li setdit seznam podle nkterho sloupce, kliknte na jeho titulek
nahoe v seznamu.
</p>
<p>
Obsah seznamu mete filtrovat pomoc ovldn dole pod seznamem. Mete zmnit
limit seznamu, zadat bez ohledu na velikost psmen pedponu jmna hre (jako
teba "ada" pro vyhledn "Adams") a omezit rozsah Elo ratingu a potu parti.
</p>

<p><footer>(Aktualizovno: Scid 3.4, ervenec 2002)</footer></p>
}

#####################
### Player Info help:

set helpTitle(C,PInfo) "Okno informac o hri"
set helpText(C,PInfo) {<h1>Okno informac o hri</h1>
<p>
Okno <term>informac o hri</term> se oteve nebo aktualizuje vdy, kdy
kliknete levm tlatkem myi na jmno hre v informan zn partie (pod
achovnic) nebo v okn <a Crosstable>turnajov tabulky</a>.
</p>
<p>
Okno zobrazuje (doufm) uiten informace o hri, zejmna jejich spnost
blma a ernma, oblben zahjen (podle <a ECO>kdu ECO</a>) a historii
ratingu.
</p>
<p>
Vechna zobrazen procenta jsou oekvan vsledek (mra spnosti) z
perspektivy hre -- take vy procento je vdy lep pro hre, nezvisle na
tom, je-li bl i ern.
</p>
<p>
Stiskem tlatka <a Graphs Rating>Graf ratingu</a> mete vidt graf historie
ratingu hre.
</p>
<p>
Kliknutm levm tlatkem myi na libovoln erven slo nastavte
<a Searches Filter>filtr</a> na ty partie, kter dan slo reprezentuje.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

################
### Graphs help:

set helpTitle(C,Graphs) "Okna graf"
set helpText(C,Graphs) {<h1>Okna graf</h1>
<p>
Scid m nkolik oken, kter zobrazuj informace graficky.
Jsou vysvtleny ne.
</p>

<h3><name Filter>Okno grafu filtru</name></h3>
<p>
Okno <term>grafu filtru</term> zobrazuje trendy parti v aktulnm filtru ve
srovnn s celou databz, a to podle podle data nebo podle Elo ratingu. Nap.
kdy mte oteven <a Tree>strom</a>, okno grafu je uiten jako nstroj
zobrazujc, jak se mnila popularita aktuln pozice zahjen v poslednch
letech nebo dekdch nebo jestli je zvlt oblben mezi hri s vtm
ratingem jako velmistry.
Kad bod grafu reprezentuje pro jednotliv rozsah data nebo Elo ratingu poet
parti ve filtru na 1000 parti v cel databzi.
</p>
<p>
Pi kreslen grafu filtru podle ratingu, Scid pouv pro kadou partii prmrn
(stedn) rating. Odhady rating (jako nap. ty z pravopisnho souboru) se
nepouij. Jestlie jeden hr partie rating m, ale jeho soupe nikoliv, pak se
a do hranice 2200 Elo pedpokld, e soupe m stejn rating.
Nap. jestlie jeden hr m 2500 Elo a soupe nem dn rating, stedn rating
je (2500+2200)/2=2350.
</p>

<h3><name Rating>Okno grafu ratingu</name></h3>
<p>
Okno <term>grafu ratingu</term> zobrazuje historii ratingu jednoho nebo obou
hr aktuln partie.
Pro jednoho hre mete graf vyvolat stiskem tlatka <b>Graf ratingu</b> v
okn <a PInfo>informac o hri</a> nebo pro oba hre aktuln partie vbrem
<b>Graf ratingu</b> z menu <menu>Nstroje</menu>.
</p>

<h3><name Score>Okno grafu skre</name></h3>
<p>
Okno <term>grafu skre</term> zobrazuje numerick hodnocen (skre) uloen v
komentch aktuln partie jako graf.
Kliknutm levm tlatkem myi kdekoliv v grafu skre se mete dostat do
korespondujc pozice partie.
</p>
<p>
Jsou rozeznvny dva druhy hodnotcch koment: ty, kter produkuje
<a Analysis>analytick</a> okno Scidu (kter maj formt
<ul>
<li><b>1.e4 {"+0.25 ...."}</b></li>
</ul>
a jsou brny vdy z perspektivy blho) a ty, kter jsou produkovny Craftyho
anotanm pkazem (kter maj formt
<ul>
<li><b>1.e4 ({9:+0.25} ....)</b></li>
</ul>
a jsou rovn brny vdy z perspektivy blho).
</p>

<h3><name Tree>Okno grafu stromu</name></h3>
<p>
Okno <term>grafu stromu</term> je dostupn ze stromovho okna. Zobrazuje
spnost nejpopulrnjch tah v aktuln pozici. Vce informac naleznete na
strnce npovdy <a Tree Graph>stromu</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.3, Duben 2002)</footer></p>
}

####################
### Tablebases help:

set helpTitle(C,TB) "Tabulky koncovek"
set helpText(C,TB) {<h1>Tabulky koncovek</h1>

<p>
<term>Tabulka koncovek</term> (tablebase) je soubor obsahujc  pesn informace
o vsledku vech pozic s uritm materilem, jako nap. krl a v proti krli a
pci. Byly generovny tabulky vech koncovek s materilem a do pti kamen
(brno i s krli) a jsou rovn k dispozici i nkter estikamenov tabulky
koncovek.
</p>
<p>
Scid me pouvat tabulky koncovek v Nalimovov formtu, kter vyuvaj mnoh
modernch achov motory. Tyto tabulky vtinou kon pponou <b>.nbw.emd</b>
nebo <b>.nbb.emd</b>. Ve Scidu mohou bt pouity vechny 3, 4 a 5 kamenov
Nalimovovy tabulky koncovek.
</p>

<h3>Pouit tabulek koncovek ve Scidu</h3>
<p>
Chcete-li pouvat ve Scidu tabulky koncovek, sta nastavit jejich adres
vbrem <b>Adres pro tabulky koncovek ...</b> z menu <menu>Volby</menu>.
Mete vybrat a 4 adrese, kde jsou vae tabulky koncovek uloeny.
Stiskem tlatka <b>...</b> napravo mete vybrat soubor a tm urit, e m bt
pouit adres tohoto souboru.
</p>
<p>
Kdy doshnete pozice, kter je nalezen v souboru tabulky koncovek, informan
zna partie (pod achovnic) zobraz informace z tabulky. Mnostv zobrazench
informac mete konfigurovat kliknutm pravho tlatka myi v tto zn nebo
vbrem <b>Informace o partii</b> z menu <menu>Volby</menu>. Volba "vsledek a
nejlep tahy" dv nejuitenj informace, ale je velmi asto pomalej ne
volba "jen vsledek".
</p>

<h3>Okno tabulky koncovek</h3>
<p>
Z tabulky koncovek mete zskat jet vce informac o aktuln pozici
otevenm <term>okna tabulky koncovek</term> (menu <menu>Okna</menu>, klvesov
zkratka: Ctrl+=). Toto okno zobrazuje vsledek s precizn hrou na vechny mon
tahy v aktuln pozici.
</p>
<p>
Toto okno m dv hlavn sti. Souhrnn rmec (nalevo) zobrazuje, kter tabulky
koncovek Scid nalezl na vaem potai a pehled pro kadou tabulku. Vsledkov
rmec (napravo) zobrazuje optimln vsledky pro vechny tahy v aktuln pozici
v hlavnm okn.
</p>

<h4>Souhrnn rmec</h4>
<p>
Horn st souhrnnho rmce vm umouje vbr konkrtn tabulky koncovek.
Tabulky, kter mte k dispozici, jsou zobrazeny mode a ty, kter jsou
nedostupn, jsou zobrazeny ed, ale mete vybrat libovolnou tabulku.
Doln st souhrnnho rmce zobrazuje pehled informac pro zvolenou tabulku
koncovek. (Jet ne vechny tabulky maj ve Scidu uloen pehled).
</p>
<p>
Pehled zahrnuje frekvenci (poet parti na milin, kter doshly pozice s tmto
materilem, spoteno z databze tm 600,000 mistrovskch parti), nejdel mat
za ob strany a poet vzjemnch (nebo "recipronch") zugzwang. Vzjemn
zugwang je takov pozice, kde bl pi svm tahu remizuje a ern pi svm tahu
prohraje nebo kde ta strana, kter je na tahu, prohrv.
</p>
<p>
Pro nkter tabulky koncovek se vzjemnmi zugzwangy pehled zahrnuje tak vet
vech zugzwangovch pozic nebo jejich vbr. pln vet pro kadou tabulku
koncovek nen provediteln, protoe nkter tabulky maj tisce vzjemnch
zugzwang.
</p>
<p>
Stiskem tlatka <b>Random</b> mete nastavit nhodnou pozici ze zvolen
tabulky koncovek.
</p>

<h4>Vsledkov rmec</h4>
<p>
Vsledkov rmec je aktualizovn kdykoliv se zmn pozice na achovnici v
hlavnm okn. Prvn dek ukazuje kolik tah vyhrv (+), remizuje (=), prohrv
(-) nebo m neznm vsledek(?). Zbytek rmce udv podrobnj seznam vsledk,
v poad od nejkratch k nejdelm vhrm, potom remzy a  nakonec od
nejdelch k nejkratm prohrm. Vechny vzdlenosti jsou potny k matu.
</p>

<h4>Vsledkov achovnice</h4>
<p>
V pozici obsaen v tabulkch koncovek je asto uiten, jak by byl vsledek,
kdyby vechny kameny v aktuln pozici byly na svch souasnch mstech, ale
pozice jedn urit figury by byla jin.
Nap. mete chtt rozhodnout, jak blzko mus bt krl k volnmu pci, aby
urit pozice byla vyhran nebo remzov. V knihch koncovek je tato informace
asto nazvna jako <i>vtzn zna</i> nebo <i>remzov zna</i> figury v
pozici.
</p>
<p>
Tuto informaci mete zjistit ve Scidu stiskem tlatka s obrzkem
achovnice, v okn tabulky koncovek se pot zobraz
<term>vsledkov achovnice</term>.
Stisknete-li lev tlatko myi na kterkoliv figue na tto achovnici, na
kadm przdnm poli se nakresl symbol urujc jak by byl vsledek (pi tahu
stejn strany jako v pozici v hlavnm okn), kdyby vybran figura byla na
takovm poli.
</p>
<p>
Je pt druh symbol, kter pole me mt:
bl <b>#</b> znamen vhru blho;
ern <b>#</b> znamen vhru ernho;
modr <b>=</b> znamen, e pozice je remzov;
erven <b>X</b> znamen, e pozice je ilegln (kvli sousedcm krlm nebo
protoe strana na tahu dv ach); a
erven <b>?</b> znamen, e vsledek nen znm, protoe potebn soubor tabulek
koncovek nen k dispozici.
</p>

<h3>Obstarn soubor tabulek koncovek</h3>
<p>
Pro pomoc ohledn vyhledn soubor tabulek koncovek na internetu tte
<a Author Related>pbuzn odkazy</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.4, Z 2002)</footer></p>
}

###################
### Bookmarks help:

set helpTitle(C,Bookmarks) "Zloky"
set helpText(C,Bookmarks) {<h1>Zloky</h1>
<p>
Scid vm umouje pro snadn budouc pstup pout pro dleit partie
<term>zloky</term>. Menu zloek je dostupn z menu <menu>Soubor</menu>, z
nstrojov lity nebo prostednictvm klvesov zkratky <B>Ctrl+B</b>.
</p>
<p>
Kdy z menu Zloky vyberete zaloenou partii, Scid, jestlie je to nutn,
oteve jej databzi, nalezne tuto partii a pesune se do t pozice v partii, v
kter byla zaloena.
</p>
<p>
Zloky mohou bt pouity jen pro databze ve formtu Scidu (ne pro PGN soubory
nebo pro databzi schrnka).
</p>
<p>
Pi tdn nebo kompaktovn databze obsahujc zaloenou partii se detaily
zloky mohou stt zastaralmi. Kdy se tak stane, pi vbru takov zloky
Scid vyhled v databzi nejlpe odpovdajc partii (srovnnm jmen hr,
msta, atd.), take zaloen partie by mla i tak bt nataena. Avak jestlie
se zmn detaily zaloen partie, je mon, e detailm zloky bude lpe
odpovdat jin partie a bude nataena msto n. Take je dobrou mylenkou znovu
zaloit partii, jestlie edituje jej hre, msto, vsledek, kolo nebo rok.
</p>

<h3>Editace zloek</h3>
<p>
Pomoc editoru zloek mete zmnit text menu zobrazen pro kadou zaloenou
partii a pidat sloku ke kategorizaci zloek.
</p>

<h3>Rady</h3>
<p>
Zloky mete pouvat pro rychl pstup k databzm, kter asto pouvte, a
to tak, e z kad databze si zalote partii. Dalm dobrm pouitm zloek
je pidvn dleitch parti pi studiu jednotlivch achovch zahjen.
</p>
<p>
Menu zloek obsahuje poloku pro kontrolu zobrazovn sloek zloek: mohou bt
zobrazovny jako podmenu (uiten pi velkm potu zloek) nebo jako jedin
seznam.
</p>

<p><footer>(Aktualizovno: Scid 3.0, Listopad 2001)</footer></p>
}

##############################
### Command-line options help:

set helpTitle(C,Cmdline) "Volby pkazovho dku"
set helpText(C,Cmdline) {<h1>Volby pkazovho dku</h1>
<p>
Kdy spoutte Scid z shellu nebo z konsole, mete specifikovat rzn volby
pkazovho dku. Mete zadat databzi ve formtu Scidu (s nebo bez ppony
souboru jako nap. ".si3") a PGN soubor, kter se maj otevt, nap. pkaz:
<ul>
<li>scid mybase newgames.pgn</li>
</ul>
spust Scid a oteve databzi Scidu pojmenovanou mybase a PGN soubor pojmenovan
newgames.pgn.
</p>
<p>
Jsou zde tak voliteln argumenty slouc ke kontrole soubor, kter m Scid
prohledat a pout pi svm startu. Volbou <b>-xtb</b> (nebo <b>-xt</b>) mete
vypnout pouvn <a TB>tabulek koncovek</a>, volbou <b>-xeco</b> nebo
<b>-xe</b> mete zruit natahovn souboru
<a ECO>klasifikace zahjen ECO</a> a volbou <b>-xspell</b> nebo <b>-xs</b>
mete zruit natahovn <a Maintenance Spellcheck>pravopisnho souboru</a>.
Zrove existuje volba <b>-fast</b> nebo <b>-f</b>, kter dl vechno, co ti
pedchoz volby dohromady, take pkaz <b>scid -f</b> je ekvivalentn pkazu
<b>scid -xeco -xspell -xtb</b>.
</p>

<p><footer>(Aktualizovno: Scid 3.1, Listopad 2001)</footer></p>
}

#################
### Pgnscid help:

set helpTitle(C,Pgnscid) "Pgnscid"
set helpText(C,Pgnscid) {<h1>Pgnscid</h1>
<p>
<term>Pgnscid</term> je separtn program, kter je poteba ke konverzi PGN
(portable game notation) soubor na databze Scidu.
</p>
<p>
Chcete-li zkonvertovat soubor pojmenovan <i>myfile.pgn</i>, jednodue zadejte:
<ul>
<li> <b>pgnscid myfile.pgn</b> </li>
</ul>
a databze Scidu (skldajc se z <i>myfile.si3</i>, <i>myfile.sg3</i>
a <i>myfile.sn3</i>) bude vytvoena.
Veker chyby a varovn budou zapsny do souboru <i>myfile.err</i>.
</p>
<p>
Chcete-li, aby databze byla vytvoena v jinm adresi nebo mla jin jmno,
mete jmno databze pidat do pkazovho dku, nap.:
<ul>
<li> <b>pgnscid myfile.pgn mybase</b> </li>
</ul>
vytvo databzi skldajc se ze soubor <i>mybase.si3</i>,
<i>mybase.sg3</i> a <i>mybase.sn3</i>.
</p>
<p>
Vimnte si, e pgnscid (a scid) me st PGN soubory komprimovan Gzipem
(t.j. <b>mybase.pgn.gz</b>) pmo, take mte-li velk PGN soubor k ueten
msta komprimovan Gzipem, nen poteba ho nejprve dekomprimovat.
</p>

<h3>Volby</h3>
<p>
Pgnscid akceptuje ped jmnem souboru dva voliteln parametry: <b>-f</b> a
<b>-x</b>.
</p>
<p>
Pouitm parametru <b>-f</b> dojde k nsilnmu pepsan existujc databze;
implicitn pgnscid neprovede konverzi na databzi, kter u existuje.
</p>
<p>
Parametr <b>-x</b> zpsob, e pgnscid bude ignorovat vechen text mezi
partiemi.
Implicitn je text mezi partiemi uloen jako pedpartiov koment k partii,
kter nsleduje. Tato volba ovlivuje jen text mezi partiemi; standardn
komente uvnit kad partie jsou i tak zkonvertovny a uloeny.
</p>

<h3>Formtovn jmen hr</h3>
<p>
Aby se zredukoval poet vcensobnho pravopisu jmen, kter odkazuj na stejnho
hre, pgnscid provd nkter zkladn formtovn jmen hr. Nap. poet
mezer za kadou rkou je standardizovn na jednu, vechny mezery na zatku a
na konci jmna jsou odstranny a teka na konci jmna je odstranna.
Holandsk pedpony jako "van den" a "Van Der" jsou rovn normalizovny tak, e
maj velk psmeno V a mal d.
</p>
<p>
Jmna hr, turnaj, mst a kol lze ve Scidu editovat (a dokonce kontrolovat
jejich pravopis); detaily najdete na strnce npovdy
<a Maintenance Editing>drba</a>.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}


######################
### File formats help:

set helpTitle(C,Formats) "Formty soubor"
set helpText(C,Formats) {<h1>Formty soubor Scidu</h1>
<p>
Databze Scidu se skldaj ze t zkladnch soubor: Indexov soubor, Jmenn
soubor a Partiov soubor. Vechny maj dvoupsmennou pponu zanajc na "s":
".si" pro indexov (index) soubory, ".sn" pro jmenn (name) soubory a ".sg" pro
partiov (game) soubory.
</p>

<h3>Indexov (.si) soubor</h3>
<p>
Tento soubor obsahuje popis databze a mal zznam pevn velikosti pro kadou
partii. Souasn velikost je 41 byt na partii. 28 byt z tto velikosti jsou
zkladn informace jako nap. vsledek, datum, identifikan sla jmen hr,
turnaje, msta (skuten jmna jsou v Jmennm souboru), atd.
</p>
<p>
Zbvajcch 13 byt obsahuje nadbyten, ale uiten informace o partii, kter
se pouvaj k urychlen vyhledvn podle pozice, materilu a vzoru. Pro vce
informac tte ne sekci <a Formats Fast>Rychl vyhledvn</a>.
</p>

<h3>Jmenn (.sn) soubor</h3>
<p>
Tento soubor obsahuje vechny jmna hr, turnaj, mst a kol pouitch v
databzi. Kad jmno je uloeno jen jednou, i kdy se vyskytuje ve vce
partich. Jmenn soubor je obvykle nejmen ze t zkladnch soubor v
databzi.
</p>

<h3>Partiov (.sg) soubor</h3>
<p>
Tento soubor obsahuje skuten tahy, varianty a komente kad partie.
Formt kdovn tah je velmi sporn: vtina tah zabr pouze jeden byte
msta.
</p>
<p>
Kdy je partie nahrazena, je jej nov verze uloena na <i>konec</i> partiovho
souboru, take asem me dojt k nahromadn zbyten nepouitho msta.
Databzi mete navrtit do jej minimln velikosti jejm
<a Compact>kompaktovnm</a>.
</p>

<h3>Ostatn soubory Scidu</h3>
<p>
<a EPD>EPD</a> soubor (ppona: ".epd") obsahuje mnostv achovch pozic,
kadou s textovm komentem.
Formt EPD souboru je popsn v <a Author Related>PGN standardu</a>.
</p>
<p>
V emailovm (ppona: ".sem") souboru pro databzi jsou uloeny detaily
oponent, kterm poslte emailov zprvy.
</p>
<p>
Soubor vyhledvacch voleb (ppona: ".sso") obsahuje nastaven pro vyhledvn
podle <a Searches Header>hlaviky</a> nebo podle
<a Searches Material>materilu/vzoru</a>.
</p>

<h3><name Fast>Rychl vyhledvn ve Scidu</name></h3>
<p>
Jak bylo eeno ve, indexov soubor uchovv nkter nadbyten, ale uiten
informace o kad partii za elem urychlen vyhledvn podle pozice nebo podle
materilu.
</p>
<p>
Nap. je uloen materil konen pozice. Jestlie hledte vov a pcov
koncovky, pak vechny partie, kter kon s dmou, stelcem nebo jezdcem na
achovnici (a nemaj dn promny pc) budou rychle peskoeny.
</p>
<p>
Dal uiten informace, kter je uloena, je poad, s jakou pci opoutj
sv poten postaven (bu svm tahem nebo vzetm). To se pouije k urychlen
stromovch vyhledvn nebo vyhledvn podle pesn pozice, zvlt pak pro
pozice zahjen. Nap. hledte-li poten pozici francouzsk obrany (1.e4 e6),
kad partie zanajc 1.e4 c5 nebo 1.d4 atd. bude peskoena, ale partie
zanajc 1.e4 e5 bude teba jet prohledat.
</p>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

###########################
### Options and Fonts help:

set helpTitle(C,Options) "Volby"
set helpText(C,Options) {<h1>Volby a preference</h1>
<p>
Mnoho voleb a preferenc Scidu (jako nap. velikost achovnice, barvy, fonty a
implicitn nastaven) mete nastavit v menu <menu>Volby</menu>.
Kdy z menu Volby zvolte <b>Uloit volby</b>, tato nastaven (a jet dal,
jako nap. posledn adres, z kterho se nathla databze a velikosti nkterch
oken) jsou uloeny do souboru voleb.
Tento soubor voleb se nate pi kadm sputn Scidu.
</p>
<p>
Jestlie pouvte Windows, soubor voleb je <b>scid.opt</b> v adresi, kde se
nachz spustiteln soubor Scidu <b>scid.exe</b>. Pro uivatele unixovch
operanch  systm (jako nap. Solaris nebo Linux) je soubor voleb
<b>~/.scid/scidrc</b>.
</p>

<h3><name MyPlayerNames>Nastaven jmen vaich hr</name></h3>
<p>
Me bt takov jmno hre (nebo nkolik jmen), pro kter byste chtli, aby kdykoliv se nathne jeho partie, achovnice v hlavnm okn byla zobrazena z perspektivy tohoto hre. Pouitm <b>Jmna mch hr...</b> z menu <menu>Volby/achovnice</menu> mete konfigurovat seznam takovch jmen. V dialogovm okn, kter se objev, zadejte na kad dek jedno jmno hre. Zstupn znaky ("<b>?</b>" pro pesn jeden znak a "<b>*</b>" pro sekvenci nula nebo vce znak) mohou bt pouity.
</p>

<h3><name Fonts>Nastaven font</name></h3>
<p>
Scid m ti zkladn fonty, kter pouv ve vtin svch oken, a vechny z
nich si mete pizpsobit. Nazvaj se <b>zkladn</b>, <b>mal</b> a
<b>fixn</b>.
</p>
<p>
Fixn font mus mt pevnou ku fontu (neproporcionln). Pouv se pro okna
<a Tree>stromu</a> a <a Crosstable>turnajov tabulky</a>.
</p>

<p><footer>(Aktualizovno: Scid 3.5, nor 2003)</footer></p>
}

####################
### NAG values help:

set helpTitle(C,NAGs) "NAG hodnoty"
set helpText(C,NAGs) {<h1>Standardn NAG hodnoty</h1>
<p>
Standardn NAG (Numeric Annotation Glyph, tj. numerick anotan piktograf)
hodnoty definovan v <a Author Related>PGN standardu</a> jsou:
</p>
<cyan>
<ul>
<li>  1   siln tah (!) </li>
<li>  2   patn tah (?) </li>
<li>  3   velmi siln tah (!!) </li>
<li>  4   hrub chyba (??) </li>
<li>  5   zajmav tah (!?) </li>
<li>  6   pochybn tah (?!) </li>
<li>  7   vynucen tah </li>
<li>  8   jedin tah; dn rozumn alternativy </li>
<li>  9   nejhor tah </li>
<li> 10   remzov pozice (=) </li>
<li> 11   vyrovnan ance, klidn pozice (=) </li>
<li> 12   vyrovnan ance, iv pozice (=) </li>
<li> 13   nejasn pozice (~) </li>
<li> 14   bl m malou vhodu (+=) </li>
<li> 15   ern m malou vhodu (=+) </li>
<li> 16   bl m vhodu (+/-) </li>
<li> 17   ern m vhodu (-/+) </li>
<li> 18   bl m rozhodujc vhodu (+-) </li>
<li> 19   ern m rozhodujc vhodu (-+) </li>
<li> 20   bl m drtivou vhodu (+-) </li>
<li> 21   ern m drtivou vhodu (-+) </li>
<li> 22   bl je v nevhod tahu (zugzwang) </li>
<li> 23   ern je v nevhod tahu (zugzwang) </li>
<li> 24   bl m malou prostorovou pevahu </li>
<li> 25   ern m malou prostorovou pevahu </li>
<li> 26   bl m prostorovou pevahu </li>
<li> 27   ern m prostorovou pevahu </li>
<li> 28   bl m rozhodujc prostorovou pevahu </li>
<li> 29   ern m rozhodujc prostorovou pevahu </li>
<li> 30   bl m mal nskok ve vvinu </li>
<li> 31   ern m mal nskok ve vvinu </li>
<li> 32   bl m nskok ve vvinu </li>
<li> 33   ern m nskok ve vvinu </li>
<li> 34   bl m rozhodujc nskok ve vvinu </li>
<li> 35   ern m rozhodujc nskok ve vvinu </li>
<li> 36   bl m iniciativu </li>
<li> 37   ern m iniciativu </li>
<li> 38   bl m trvalou iniciativu </li>
<li> 39   ern m trvalou iniciativu </li>
<li> 40   bl m tok </li>
<li> 41   ern m tok </li>
<li> 42   bl m nedostatenou kompenzaci za materiln jmu </li>
<li> 43   ern m nedostatenou kompenzaci za materiln jmu </li>
<li> 44   bl m dostatenou kompenzaci za materiln jmu </li>
<li> 45   ern m dostatenou kompenzaci za materiln jmu </li>
<li> 46   bl m vce ne adekvtn kompenzaci za materiln jmu </li>
<li> 47   ern m vce ne adekvtn kompenzaci za materiln jmu </li>
<li> 48   bl s malou vhodou kontroluje centrum </li>
<li> 49   ern s malou vhodou kontroluje centrum </li>
<li> 50   bl s vhodou kontroluje centrum </li>
<li> 51   ern s vhodou kontroluje centrum </li>
<li> 52   bl s rozhodujc vhodou kontroluje centrum </li>
<li> 53   ern s rozhodujc vhodou kontroluje centrum </li>
<li> 54   bl s malou vhodou kontroluje krlovsk kdlo </li>
<li> 55   ern s malou vhodou kontroluje krlovsk kdlo </li>
<li> 56   bl s vhodou kontroluje krlovsk kdlo </li>
<li> 57   ern s vhodou kontroluje krlovsk kdlo </li>
<li> 58   bl s rozhodujc vhodou kontroluje krlovsk kdlo </li>
<li> 59   ern s rozhodujc vhodou kontroluje krlovsk kdlo </li>
<li> 60   bl s malou vhodou kontroluje dmsk kdlo </li>
<li> 61   ern s malou vhodou kontroluje dmsk kdlo </li>
<li> 62   bl s vhodou kontroluje dmsk kdlo </li>
<li> 63   ern s vhodou kontroluje dmsk kdlo </li>
<li> 64   bl s rozhodujc vhodou kontroluje dmsk kdlo </li>
<li> 65   ern s rozhodujc vhodou kontroluje dmsk kdlo </li>
<li> 66   bl m slabou prvn adu </li>
<li> 67   ern m slabou prvn adu </li>
<li> 68   bl m dobe chrnnou prvn adu </li>
<li> 69   ern m dobe chrnnou prvn adu </li>
<li> 70   bl m patn chrnnho krle </li>
<li> 71   ern m patn chrnnho krle </li>
<li> 72   bl m dobe chrnnho krle </li>
<li> 73   ern m dobe chrnnho krle </li>
<li> 74   bl m patn postavenho krle </li>
<li> 75   ern m slab postavenho krle </li>
<li> 76   bl m dobe postavenho krle </li>
<li> 77   ern m dobe postavenho krle </li>
<li> 78   bl m velmi patnou pcovou strukturu </li>
<li> 79   ern m velmi patnou pcovou strukturu </li>
<li> 80   bl m patnou pcovou strukturu </li>
<li> 81   ern m patnou pcovou strukturu </li>
<li> 82   bl m dobrou pcovou strukturu </li>
<li> 83   ern m dobrou pcovou strukturu </li>
<li> 84   bl m velmi dobrou pcovou strukturu </li>
<li> 85   ern m velmi dobrou pcovou strukturu </li>
<li> 86   bl m patn postavenho jezdce </li>
<li> 87   ern m patn postavenho jezdce </li>
<li> 88   bl m dobe postavenho jezdce </li>
<li> 89   ern m dobe postavenho jezdce </li>
<li> 90   bl m patn postavenho stelce </li>
<li> 91   ern m patn postavenho stelce </li>
<li> 92   bl m dobe postavenho stelce </li>
<li> 93   ern m dobe postavenho stelce </li>
<li> 94   bl m patn postavenou v </li>
<li> 95   ern m patn postavenou v </li>
<li> 96   bl m dobe postavenou v </li>
<li> 97   ern m dobe postavenou v </li>
<li> 98   bl m patn postavenou dmu </li>
<li> 99   ern m patn postavenou dmu </li>
<li>100   bl m dobe postavenou dmu </li>
<li>101   ern m dobe postavenou dmu </li>
<li>102   bl m patnou souhru figur </li>
<li>103   ern m patnou souhru figur </li>
<li>104   bl m dobrou souhru figur </li>
<li>105   ern m dobrou souhru figur </li>
<li>106   bl sehrl zahjen velmi slab </li>
<li>107   ern sehrl zahjen velmi slab </li>
<li>108   bl sehrl zahjen slab </li>
<li>109   ern sehrl zahjen slab </li>
<li>110   bl sehrl zahjen dobe </li>
<li>111   ern sehrl zahjen dobe </li>
<li>112   bl sehrl zahjen velmi dobe </li>
<li>113   ern sehrl zahjen velmi dobe </li>
<li>114   bl sehrl stedn hru velmi slab </li>
<li>115   ern sehrl stedn hru velmi slab </li>
<li>116   bl sehrl stedn hru slab </li>
<li>117   ern sehrl stedn hru slab </li>
<li>118   bl sehrl stedn hru dobe </li>
<li>119   ern sehrl stedn hru dobe </li>
<li>120   bl sehrl stedn hru velmi dobe </li>
<li>121   ern sehrl stedn hru velmi dobe </li>
<li>122   bl sehrl koncovku velmi slab </li>
<li>123   ern sehrl koncovku velmi slab </li>
<li>124   bl sehrl koncovku slab </li>
<li>125   ern sehrl koncovku slab </li>
<li>126   bl sehrl koncovku dobe </li>
<li>127   ern sehrl koncovku dobe </li>
<li>128   bl sehrl koncovku velmi dobe </li>
<li>129   ern sehrl koncovku velmi dobe </li>
<li>130   bl m mrnou protihru </li>
<li>131   ern m mrnou protihru </li>
<li>132   bl m protihru </li>
<li>133   ern m protihru </li>
<li>134   bl m rozhodujc protihru </li>
<li>135   ern m rozhodujc protihru </li>
<li>136   bl m asovou tse </li>
<li>137   ern m asovou tse </li>
<li>138   bl m obrovskou asovou tse </li>
<li>139   ern m obrovskou asovou tse </li>
</ul>
</cyan>

<p>
Ostatn pedloen NAG hodnoty pro symboly publikac achovho Informtoru
(Chess Informant) obsahuj:
</p>
<cyan>
<ul>
<li>140   s mylenkou ... </li>
<li>141   nameno proti ... </li>
<li>142   lep tah </li>
<li>143   hor tah </li>
<li>144   rovnocenn tah </li>
<li>145   poznmka redakce ("RR") </li>
<li>146   novinka ("N") </li>
<li>147   slab bod </li>
<li>148   koncovka </li>
<li>149   sloupec; ada </li>
<li>150   diagonla </li>
<li>151   bl m dvojici stelc </li>
<li>152   ern m dvojici stelc </li>
<li>153   rznobarevn stelci </li>
<li>154   stejnobarevn stelci </li>
</ul>
</cyan>

<p>
Ostatn navren hodnoty jsou:
</p>
<cyan>
<ul>
<li>190   atd. </li>
<li>191   zdvojen pci </li>
<li>192   izolovan pci </li>
<li>193   spojen pci </li>
<li>194   visc pci </li>
<li>195   opodn pec </li>
</ul>
</cyan>

<p>
Symboly definovan Scidem pro jeho vlastn pouit jsou:
</p>
<cyan>
<ul>
<li>201   Diagram ("D", nkdy oznaovan "#") </li>
</ul>
</cyan>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

##############
### ECO guide:

set helpTitle(C,ECO) "ECO prvodce"
set helpText(C,ECO) {<h1>Klasifikace zahjen ECO</h1>
<p>
Scid me klasifikovat achov partie podle klasifikace achovch zahjen
<b>ECO</b> (Encyclopedia of Chess Openings, tj. Encyklopedie achovch
zahjen).
Standardn ECO kd se skld z psmene (A..E) nsledovanho dvma slicemi,
take existuje 500 rozdlnch standardnch ECO kd.
</p>

<h3>Rozen ECO systmu podporovan Scidem</h3>
<p>
ECO systm je velmi omezen a nedostaten pro modern partie: nkter z 500
kd se skoro vbec nevyskytuj, zatmco nkter se vyskytuj velmi asto. Pro
zlepen tto situace Scid umouje voliteln rozen zkladnch ECO kd:
kad kd me bt rozen psmenem (a..z), dal rozen (slic, 1..4)
jsou mon, ale jet nejsou pouity ve standardnm ECO souboru Scidu.
Take rozen ECO kd Scidu vypad asi jako "<b>A41e</b>" nebo "<b>E99b2</b>".
Mnoho nejbnjch ECO kd z modernch mistrovskch parti maj rozen
definovan v ECO souboru Scidu.
</p>

<h3><name Browser>Okno ECO prohlee</name></h3>
<p>
Okno <term>ECO prohlee</term> vm zobrazuje pozice, kter jsou pouvny ke
klasifikaci kadho ECO kdu a etnost a spnost ECO kd v aktuln databzi.
</p>
<p>
Horn pole zobrazuje etnost kadho ECO kdu v aktuln databzi. Lita v grafu
m ti seky: nejni (nejsvtlej barva) je poet vher blho, prostedn je
poet remz a nejvy (nejtmav) je poet vher ernho. To vm umouje
rychle zjistit charakteristiky zahjen: nap. jestli bl skruj velmi dobe
nebo jestli jsou velmi ast remzy.
</p>
<p>
Chcete-li jt do hlub ECO rovn, kliknte levm tlatkem myi na litu v
grafu (nebo zadejte korespondujc psmeno nebo slici). Chcete-li jt zpt do
vy rovn, kliknte pravm tlatkem myi kamkoliv v grafu nebo stisknte
klvesu lev ipky (nebo Delete nebo Backspace).
</p>
<p>
Doln pole zobrazuje pozice, kter obsahuje jednotliv ECO kd, podle ECO
souboru, kter jste nathli.
</p>

<h3>Nataen ECO souboru Scidu</h3>
<p>
ECO soubor distribuovan spolen se Scidem se jmenuje <b>scid.eco</b> a Scid se
ho pokou pi svm startu nathnout.
Jestlie ho Scid neme najt, bude poteba, aby byla mon ECO klasifikace,
udlat nsledujc:
<ul>
<li>(a) Ve Scidu, pouijte pkaz menu
        <menu>Volby: Nathnout ECO
        soubor...</menu> a vyberte soubor <b>scid.eco</b>. </li>
<li>(b) Ulote volby (z menu <menu>Volby</menu>). </li>
</ul>
Pot, co to provedete, ECO soubor bude nataen pi kadm sputn Scidu.
</p>

<h3><name Codes>Systm kd ECO</name></h3>
<p>
Zkladn struktura ECO systmu je:
</p>
<p>
<b><blue><run updateEcoWin A>A</run></blue></b>
   1.d4 Jf6 2...;  1.d4 ...;  1.c4;  1.rzn
<ul>
<li>  <b>A0</b>  1.<i>rzn</i>
      (<b>A02-A03</b> 1.f4: <i>Birdovo zahjen</i>,
      <b>A04-A09</b>  1.Jf3: <i>Rtiho, Krlovsk indick tok</i>) </li>
<li>  <b>A1</b>  1.c4 ...: <i>Anglick</i> </li>
<li>  <b>A2</b>  1.c4 e5: <i>Anglick krlovsk</i> </li>
<li>  <b>A3</b>  1.c4 c5: <i>Anglick symetrick</i> </li>
<li>  <b>A4</b>  1.d4 ...: <i>Dmskm pcem</i> </li>
<li>  <b>A5</b>  1.d4 Jf6 2.c4 ..: <i>Indick obrana</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.Jc3 exd5 5.cxd5 d6 6.e4 g6 7.Jf3 </li>
<li>  <b>A8</b>  1.d4 f5: <i>Holandsk obrana</i> </li>
<li>  <b>A9</b>  1.d4 f5 2.c4 e6: <i>Holandsk obrana</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>rzn</i>
<ul>
<li>  <b>B0</b>  1.e4 ...
      (<b>B02-B05</b>  1.e4 Jf6: <i>Alechinova obrana</i>;
      <b>B07-B09</b>  1.e4 d6: <i>Pircova</i>) </li>
<li>  <b>B1</b>  1.e4 c6: <i>Caro-Kann</i> </li>
<li>  <b>B2</b>  1.e4 c5: <i>Sicilsk obrana</i> </li>
<li>  <b>B3</b>  1.e4 c5 2.Jf3 Jc6: <i>Sicilsk</i> </li>
<li>  <b>B4</b>  1.e4 c5 2.Jf3 e6: <i>Sicilsk</i> </li>
<li>  <b>B5</b>  1.e4 c5 2.Jf3 d6: <i>Sicilsk</i> </li>
<li>  <b>B6</b>  B5 + 3.d4 cxd4 4.Jxd4 Jf6 5.Jc3 Jc6 </li>
<li>  <b>B7</b>  B5 + 4.Jxd4 Jf6 5.Jc3 g6: <i>Sicilsk dra</i> </li>
<li>  <b>B8</b>  B5 + 4.Nxd4 Nf6 5.Nc3 e6: <i>Sicilsk Scheveningen</i> </li>
<li>  <b>B9</b>  B5 + 4.Nxd4 Nf6 5.Nc3 a6: <i>Sicilsk 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>Francouzsk obrana</i> </li>
<li>  <b>C1</b>  1.e4 e6 2.d4 d5 3.Jc3: <i>Francouzsk, Winawer/klasick</i>
  </li>
<li>  <b>C2</b>  1.e4 e5: <i>Oteven hra</i> </li>
<li>  <b>C3</b>  1.e4 e5 2.f4: <i>Krlovsk gambit</i> </li>
<li>  <b>C4</b>  1.e4 e5 2.Jf3: <i>Oteven hra</i> </li>
<li>  <b>C5</b>  1.e4 e5 2.Jf3 Jc6 3.Sc4: <i>Italsk; Hra dvou jezdc</i> </li>
<li>  <b>C6</b>  1.e4 e5 2.Jf3 Jc6 3.Sb5: <i>panlsk</i> </li>
<li>  <b>C7</b>  1.e4 e5 2.Jf3 Jc6 3.Sb5 a6 4.Sa4: <i>panlsk</i> </li>
<li>  <b>C8</b>  C7 + 4...Jf6 5.O-O: <i>panlsk, zaven a oteven</i>
      (<b>C80-C83</b>  5.O-O Jxe4: <i>panlsk, oteven systm</i>;
      <b>C84-C89</b>  5.O-O Se7: <i>panlsk, zaven systm</i>) </li>
<li>  <b>C9</b>  C8 + 5...Se7 6.Ve1 b5 7.Sb3 d6: <i>panlsk, zaven</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin D>D</run></blue></b>
   1.d4 d5; 1.d4 Jf6 2.c4 g6 s 3...d5
<ul>
<li>  <b>D0</b>  1.d4 d5: <i>Dmskm pcem</i> </li>
<li>  <b>D1</b>  1.d4 d5 2.c4 c6: <i>Slovansk obrana</i> </li>
<li>  <b>D2</b>  1.d4 d5 2.c4 dxc4: <i>Dmsk gambit pijat</i> </li>
<li>  <b>D3</b>  1.d4 d5 2.c4 e6: <i>Dmsk gambit odmtnut</i> </li>
<li>  <b>D4</b>  D3 + 3.Jc3 Jf6 4.Jf3 c5/c6: <i>Semi-Tarraschova;
  Poloslovansk</i>  </li>
<li>  <b>D5</b>  D3 + 3.Jc3 Jf6 4.Sg5: <i>Dmsk gambit odmtnut klasick</i>
 </li>
<li>  <b>D6</b>  D5 + 4...Se7 5.e3 O-O 6.Jf3 Jbd7: <i>Dmsk gambit
 odmtnut  ortodoxn</i> </li>
<li>  <b>D7</b>  1.d4 Jf6 2.c4 g6 s 3...d5: <i>Grunfeldova obrana</i> </li>
<li>  <b>D8</b>  1.d4 Jf6 2.c4 g6 3.Jc3 d5: <i>Grunfeldova</i> </li>
<li>  <b>D9</b>  1.d4 Jf6 2.c4 g6 3.Jc3 d5 4.Jf3: <i>Grunfeldova</i> </li>
</ul>

<p>
<b><blue><run updateEcoWin E>E</run></blue></b>
   1.d4 Jf6 2.c4 e6; 1.d4 Jf6 2.c4 g6 </li>
<ul>
<li>  <b>E0</b>  1.d4 Jf6 2.c4 e6: <i>Katalnsk, atd.</i> </li>
<li>  <b>E1</b>  1.d4 Jf6 2.c4 e6 3.Jf3 (b6): <i>Dmsk indick, atd.</i> </li>
<li>  <b>E2</b>  1.d4 Jf6 2.c4 e6 3.Jc3 (Sb4): <i>Nimcoviova indick, atd.</i>
 </li>
<li>  <b>E3</b>  E2 + 4.Sg5 nebo 4.Dc2: <i>Nimcoviova indick</i> </li>
<li>  <b>E4</b>  E2 + 4.e3: <i>Nimcoviova indick, Rubinstein</i> </li>
<li>  <b>E5</b>  E4 + 4...O-O 5.Jf3: <i>Nimcoviova indick, hlavn varianta</i>
 </li>
<li>  <b>E6</b>  1.d4 Jf6 2.c4 g6: <i>Krlovsk indick</i> </li>
<li>  <b>E7</b>  1.d4 Jf6 2.c4 g6 3.Jc3 Sg7 4.e4: <i>Krlovsk indick</i> </li>
<li>  <b>E8</b>  E7 + 4...d6 5.f3: <i>Krlovsk indick, Samisch</i> </li>
<li>  <b>E9</b>  E7 + 4...d6 5.Jf3: <i>Krlovsk indick, hlavn
 varianty</i> </li>
</ul>

<p><footer>(Aktualizovno: Scid 2.5, erven 2001)</footer></p>
}

#################
### Contact info:


set helpTitle(C,Author) "Kontaktn informace"
set helpText(C,Author) {<h1>Kontaktn informace</h1>
<p>
Webov strnka Scidu je: <br>
<b><url http://scid.sourceforge.net/>http://scid.sourceforge.net/</url></b>
</p>
<p>
Mete si tam sthnout posledn verzi Scidu a k dispozici jsou i jin soubory.
</p>
<p>
Veker komente, dotazy, nvrhy a informace o chybch poslejte prosm autorovi
Scidu, Shaneovi Hudsonovi, na emailovou adresu:<br>
<b>sgh@users.sourceforge.net</b>
</p>

<h3><name Related>Pbuzn odkazy</name></h3>
<p>
Jestlie se vm Scid lb, mon vs budou zajmat nsledujc webov strnky:
</p>
<ul>
<li><url http://www.tim-mann.org/chess.html>http://www.tim_mann.org/chess.html</url> --
Domovsk strnka programu Tima Manna <b>xboard & winboard</b>, kter lze pout ke
ten PGN a jako rozhran pro internetov achov servery. Jeho strnka obsahuje
rovn dobr informace o Crafty, GNUchess a dalch voln iitelnch achovch
programech. </li>

<li><url ftp://ftp.cis.uab.edu/pub/hyatt/>ftp://ftp.cis.uab.edu/pub/hyatt/</url> --
siln achy hrajc program Crafty. Podadres pojmenovan <b>TB</b> obsahuje mnoho
soubor tabulek koncovek (tablebase) v Nalimovov formtu, kter lze pout v
nkolika achovch programech a rovn ve Scidu.</li>

<li><url http://www.chesscenter.com/twic/>http://www.chesscenter.com/twic/</url> --
TWIC (the week in chess), znamenit tdenn zpravodaj mezinrodnch achovch
parti dostupn v PGN formtu.</li>

<li><url http://scid.sourceforge.net/doc/standard.txt>http://scid.sourceforge.net/doc/standard.txt</url> --
<b>PGN Standard</b>, vytvoen Stevenem J. Edwardsem v roce 1994. Tento text
vysvtluje detailn formty PGN a EPD.</li> </ul>

<p><footer>(Aktualizovno: Scid 2.6, Srpen 2001)</footer></p>
}

# end of czech.tcl

# hungary.tcl:
# Hungarian text for menu names and status bar help messages for SCID
# Translated by: Gbor Szts

addLanguage H Hungarian 0 ;# iso8859-2

proc setLanguage_H {} {

# File menu:
menuText H File "Fjl" 0
menuText H FileNew "j..." 0 {j SCID-adatbzis ltrehozsa}
menuText H FileOpen "Megnyit..." 3 {Meglv SCID-adatbzis megnyitsa}
menuText H FileClose "Bezr" 2 {Az aktv SCID-adatbzis bezrsa}
menuText H FileFinder "Fjlkeres" 0 {Kinyitja a Fjlkeres ablakot.}
menuText H FileBookmarks "Knyvjelzk" 0 {Knyvjelzmen (gyorsbillenty: Ctrl+B)}
menuText H FileBookmarksAdd "j knyvjelz" 0 \
  {Megjelli az aktulis jtszmt s llst.}
menuText H FileBookmarksFile "Knyvjelz mentse" 11 \
  {Az llshoz tartoz knyvjelzt kln knyvtrba teszi.}
menuText H FileBookmarksEdit "Knyvjelzk szerkesztse..." 13 \
  {Knyvjelzk szerkesztse}
menuText H FileBookmarksList "Megjelents listaknt" 13 \
  {A knyvjelzk knyvtrai nem almenknt, hanem listaknt jelennek meg.}
menuText H FileBookmarksSub "Megjelents almenknt" 13 \
  {A knyvjelzk knyvtrai nem listaknt, hanem almenknt jelennek meg.}
menuText H FileMaint "Gondozs" 0 {SCID adatbzisgondoz eszkzk}
menuText H FileMaintWin "Adatbzisgondoz ablak" 0 \
  {Kinyitja/becsukja az SCID adatbzisgondoz ablakot.}
menuText H FileMaintCompact "Adatbzis tmrtse..." 10 \
  {Eltvoltja az adatbzisbl a trlt jtszmkat s a hasznlaton kvl ll neveket.}
menuText H FileMaintClass "Osztlyba sorols..." 0 \
  {jra kiszmtja az sszes jtszma ECO-kdjt.}
menuText H FileMaintSort "Rendezs..." 0 \
  {Rendezi az adatbzis sszes jtszmjt.}
menuText H FileMaintDelete "Ikerjtszmk trlse..." 0 \
  {Megkeresi az ikerjtszmkat, s megjelli ket trlsre.}
menuText H FileMaintTwin "Ikerkeres ablak" 4 \
  {Kinyitja/becsukja az ikerkeres ablakot.}
menuText H FileMaintName "Nevek helyesrsa" 0 {Nvszerkeszt s helyesrsi eszkzk}
menuText H FileMaintNameEditor "Nvszerkeszt" 0 \
  {Kinyitja/becsukja a nvszerkeszt ablakot.}
menuText H FileMaintNamePlayer "Jtkosnevek ellenrzse..." 0 \
  {A helyesrs-ellenrz fjl segtsgvel ellenrzi a jtkosok nevt.}
menuText H FileMaintNameEvent "Esemnynevek ellenrzse..." 0 \
  {A helyesrs-ellenrz fjl segtsgvel ellenrzi esemnyek nevt.}
menuText H FileMaintNameSite "Helynevek ellenrzse..." 0 \
  {A helyesrs-ellenrz fjl segtsgvel ellenrzi a helysznek nevt.}
menuText H FileMaintNameRound "Fordulnevek ellenrzse..." 0 \
  {A helyesrs-ellenrz fjl segtsgvel ellenrzi a fordulk nevt.}
menuText H FileReadOnly "rsvdelem..." 0 \
  {Az aktulis adatbzist csak olvashatv teszi, nehogy meg lehessen vltoztatni.}
menuText H FileSwitch "Adatbzisvlts" 0 \
  {tvlt egy msik megnyitott adatbzisra.}
menuText H FileExit "Kilp" 2 {Kilp SCID-bl.}

# Edit menu:
menuText H Edit "Szerkeszts" 1
menuText H EditAdd "j vltozat" 0 {Ennl a lpsnl j vltozatot szr be a jtszmba.}
menuText H EditDelete "Vltozat trlse" 9 {Trl egy vltozatot ennl a lpsnl.}
menuText H EditFirst "Els vltozatt tesz" 0 \
  {Els helyre teszi a vltozatot a listn.}
menuText H EditMain "Fvltozatt tesz" 0 \
  {A vltozatot fvltozatt lpteti el.}
menuText H EditTrial "Vltozat kiprblsa" 11 \
  {Elindtja/meglltja a prbazemmdot, amellyel egy elgondolst lehet a tbln kiprblni.}
menuText H EditStrip "Lecsupaszt" 2 {Eltvoltja a megjegyzseket vagy a vltozatokat ebbl a jtszmbl.}
menuText H EditStripComments "Megjegyzsek" 0 \
  {Eltvoltja az sszes megjegyzst s elemzst ebbl a jtszmbl.}
menuText H EditStripVars "Vltozatok" 0 {Eltvoltja az sszes vltozatot ebbl a jtszmbl.}
menuText H EditStripBegin "Az elejtl" 3 \
  {Levgja a jtszma elejt}
menuText H EditStripEnd "A vgig" 2 \
  {Levgja a jtszma vgt}
menuText H EditReset "Kirti a Vgasztalt" 2 \
  {Alaphelyzetbe hozza a Vgasztalt, hogy az teljesen res legyen.}
menuText H EditCopy "A Vgasztalra msolja ezt a jtszmt." 15 \
  {Ezt a jtszmt tmsolja a Vgasztal adatbzisba.}
menuText H EditPaste "Beilleszti az utols jtszmt a Vgasztalrl." 0 \
  {A Vgasztal aktv jtszmjt beilleszti ide.}
menuText H EditPastePGN "A vglap tartalmt PGN-jtszmaknt beilleszti" 20 \
  {A vglap tartalmt PGN-jells jtszmnak tekinti, s idemsolja.}
menuText H EditSetup "Kezdlls fellltsa..." 14 \
  {Fellltja a kezdllst ehhez a jtszmhoz.}
menuText H EditCopyBoard "lls msolsa FEN-knt" 17 \
  {Az aktulis llst FEN-jellssel a vglapra msolja.}
menuText H EditPasteBoard "Kezdlls beillesztse" 13 \
  {Fellltja a kezdllst kijellt szveg (vglap) alapjn.}

# Game menu:
menuText H Game "Jtszma" 0
menuText H GameNew "j jtszma" 0 \
  {j jtszmt kezd; a vltoztatsokat elveti.}
menuText H GameFirst "Betlti az els jtszmt." 11 {Betlti az els szrt jtszmt.}
menuText H GamePrev "Betlti az elz jtszmt." 12 {Betlti az elz szrt jtszmt.}
menuText H GameReload "Ismt betlti az aktulis jtszmt." 0 \
  {jra betlti ezt a jtszmt; elvet minden vltoztatst.}
menuText H GameNext "Betlti a kvetkez jtszmt." 10 {Betlti a kvetkez szrt jtszmt.}
menuText H GameLast "Betlti az utols jtszmt." 11 {Betlti az utols szrt jtszmt.}
menuText H GameRandom "Vletlenszeren betlt egy jtszmt." 0 {Vletlenszeren betlt egy szrt jtszmt.}
menuText H GameNumber "Megadott sorszm jtszma betltse..." 9 \
  {Betlti a sorszmmal megadott jtszmt.}
menuText H GameReplace "Ments cservel..." 7 \
  {Elmenti ezt a jtszmt; fellrja a rgi vltozatot.}
menuText H GameAdd "Ments j jtszmaknt..." 0 \
  {Elmenti ezt a jtszmt; j jtszmt hoz ltre az adatbzisban.}
menuText H GameDeepest "Megnyits azonostsa" 10 \
  {Az ECO-knyvben szerepl legnagyobb mlysgig megy bele a jtszmba.}
menuText H GameGotoMove "Ugrs megadott sorszm lpshez..." 1 \
  {Megadott sorszm lpshez ugrik az aktulis jtszmban.}
menuText H GameNovelty "jts keresse..." 2 \
  {Megkeresi ebben a jtszmban az els olyan lpst, amely korbban nem fordult el.}

# Search Menu:
menuText H Search "Keress" 0
menuText H SearchReset "Szr trlse" 6 {Alaphelyzetbe hozza a szrt, hogy az sszes jtszma benne legyen.}
menuText H SearchNegate "Szr neglsa" 6 {Neglja a szrt, hogy csak a kizrt jtszmk legyenek benne.}
menuText H SearchCurrent "Aktulis lls..." 0 {A tbln lv llst keresi.}
menuText H SearchHeader "Fejlc..." 0 {Keress fejlc (jtkos, esemny, stb.) alapjn}
menuText H SearchMaterial "Anyag/szerkezet..." 6 {Keress anyag vagy llsszerkezet alapjn}
menuText H SearchUsing "Keresfjl hasznlata..." 0 {Keress SearchOptions fjl hasznlatval}

# Windows menu:
menuText H Windows "Ablakok" 0
menuText H WindowsComment "Megjegyzsszerkeszt" 0 {Megnyitja/bezrja a megjegyzsszerkesztt.}
menuText H WindowsGList "Jtszmk listja" 9 {Kinyitja/becsukja a jtszmk listjt mutat ablakot.}
menuText H WindowsPGN "PGN" 0 \
  {Kinyitja/becsukja a PGN-(jtszmajegyzs)-ablakot.}
menuText H WindowsPList "Jtkoskeres" 0 {Kinyitja/becsukja a jtkoskerest.}
menuText H WindowsTmt "Versenykeres" 0 {Kinyitja/becsukja a versenykerest.}
menuText H WindowsSwitcher "Adatbzisvlt" 0 \
  {Kinyitja/becsukja az adatbzisvlt ablakot.}
menuText H WindowsMaint "Adatbzisgondoz" 9 \
  {Kinyitja/becsukja az adatbzisgondoz ablakot.}
menuText H WindowsECO "ECO-bngsz" 0 {Kinyitja/becsukja az ECO-bngsz ablakot.}
menuText H WindowsRepertoire "Repertorszerkeszt" 0 \
  {Megnyitja/bezrja a megnyitsi repertorszerkesztt.}
menuText H WindowsStats "Statisztika" 0 \
  {Kinyitja/becsukja a szrsi statisztika ablakt.}
menuText H WindowsTree "Faszerkezet" 0 {Kinyitja/becsukja a faszerkezet-ablakot.}
menuText H WindowsTB "Vgjtktblzatok" 8 \
  {Kinyitja/becsukja a vgjtktblzatok ablakt.}

# Tools menu:
menuText H Tools "Eszkzk" 0
menuText H ToolsAnalysis "Elemz motor..." 0 \
  {Elindt/lellt egy sakkelemz programot.}
menuText H ToolsAnalysis2 "2. elemz motor..." 0 \
  {Elindtja/lelltja a 2. sakkelemz programot.}
menuText H ToolsCross "Versenytblzat" 0 {Megmutatja az ehhez a jtszmhoz tartoz verseny tblzatt.}
menuText H ToolsEmail "Levelezsi sakk" 0 \
  {Kinyitja/becsukja az elektronikus sakklevelezs lebonyoltsra szolgl ablakot.}
menuText H ToolsFilterGraph "Szrgrafikon" 0 \
  {Kinyitja/becsukja a szrgrafikont mutat ablakot.}
menuText H ToolsOpReport "Megnyitsi sszefoglal" 0 \
  {Ismertett kszt az aktulis llshoz tartoz megnyitsrl.}
menuText H ToolsTracker "Figurakvet"  0 {Kinyitja/becsukja a figurakvet ablakot.}
menuText H ToolsPInfo "Jtkosinformci"  0 \
  {Kinyitja/frissti a jtkos adatait tartalmaz ablakot.}
menuText H ToolsPlayerReport "sszefoglal jtkosrl..." 0 \
    {sszefoglalt kszt a jtkosrl}
menuText H ToolsRating "rtkszm alakulsa" 0\
  {Grafikusan brzolja, hogyan alakult az aktulis jtszma rsztvevinek rtkszma.}
menuText H ToolsScore "Eredmny alakulsa" 1 {Megmutatja az eredmnygrafikont.}
menuText H ToolsExpCurrent "Az aktulis jtszma exportlsa" 21 \
  {Szvegfjlba rja az aktulis jtszmt.}
menuText H ToolsExpCurrentPGN "Exportls PGN-fjlba..." 11 \
  {PGN-fjlba rja az aktulis jtszmt.}
menuText H ToolsExpCurrentHTML "Exportls HTML-fjlba..." 11 \
  {HTML-fjlba rja az aktulis jtszmt.}
menuText H ToolsExpCurrentLaTeX "Exportls LaTeX-fjlba..." 11 \
  {LaTeX-fjlba rja az aktulis jtszmt.}
menuText H ToolsExpFilter "Az sszes szrt jtszma exportlsa" 10 \
  {Szvegfjlba rja az sszes szrt jtszmt.}
menuText H ToolsExpFilterPGN "Szr exportlsa PGN-fjlba..." 18 \
  {PGN-fjlba rja az sszes szrt jtszmt.}
menuText H ToolsExpFilterHTML "Szr exportlsa HTML-fjlba..." 18 \
  {HTML-fjlba rja az sszes szrt jtszmt.}
menuText H ToolsExpFilterLaTeX "Szr exportlsa LaTeX-fjlba..." 18 \
  {LaTeX-fjlba rja az sszes szrt jtszmt.}
menuText H ToolsImportOne "PGN-jtszma importlsa..." 0 \
  {PGN-formtum jtszma importlsa}
menuText H ToolsImportFile "PGN-fjl importlsa..." 2 \
  {PGN-fjl sszes jtszmjnak importlsa}

# Options menu:
menuText H Options "Belltsok" 0
menuText H OptionsBoard "Sakktbla" 0 {Sakktbla megjelensnek megvltoztatsa}
menuText H OptionsBoardSize "Tblamret" 0 {A tbla mretnek vltoztatsa}
menuText H OptionsBoardPieces "Figurk stlusa" 0 {A figurk megjelensi formjnak vltoztatsa}
menuText H OptionsBoardColors "Sznek..." 0 {A tbla szneinek vltoztatsa}
menuText H OptionsBoardNames "Jtkosnevek..." 0 {Jtkosnevek tszerkesztse}
menuText H OptionsExport "Exportls" 1 {Exportlsi belltsok vltoztatsa}
menuText H OptionsFonts "Karakterkszlet" 0 {Karakterkszlet vltoztatsa}
menuText H OptionsFontsRegular "Szoksos" 0 {A szoksos karakterkszlet vltoztatsa}
menuText H OptionsFontsMenu "Men" 0 {A menk karakterkszletnek a vltoztatsa}
menuText H OptionsFontsSmall "Kisbets" 0 {A kisbets karakterkszlet vltoztatsa}
menuText H OptionsFontsFixed "Rgztett" 0 {A rgztett szlessg karakterkszlet vltoztatsa}
menuText H OptionsGInfo "Jtszmainformci" 0 {Jtszmainformci vltoztatsa}
menuText H OptionsLanguage "Nyelv" 0 {A men nyelvnek kivlasztsa}
menuText H OptionsMoves "Lpsek" 0 {Lpsek bevitelnek belltsai}
menuText H OptionsMovesAsk "Lps cserje eltt rkrdez." 6 \
  {Mieltt trna egy meglev lpst, rkrdez.}
menuText H OptionsMovesAnimate "Megelevents ideje" 0 \
  {Belltja az idt lpsek megeleventshez.}
menuText H OptionsMovesDelay "Automatikus visszajtszs ksleltetse..." 0 \
  {Belltja a ksleltetst automatikus visszajtszshoz.}
menuText H OptionsMovesCoord "Lps megadsa koordintkkal" 15 \
  {Koordintkkal megadott lpst ("g1f3") is elfogad.}
menuText H OptionsMovesSuggest "Javaslat" 0 \
  {Be/kikapcsolja a lpsjavaslatot.}
menuText H OptionsMovesKey "Billenty-kiegszts" 0 \
  {Be/kikapcsolja a billentyzettel rszlegesen bevitt lpsek automatikus kiegsztst.}
menuText H OptionsNumbers "Szmformtum" 1 {Szmformtum kivlasztsa}
menuText H OptionsStartup "Indts" 0 {Az indtskor kinyitand ablakok kivlasztsa}
menuText H OptionsWindows "Ablakok" 0 {Ablakbelltsok}
menuText H OptionsWindowsIconify "Automatikus ikonizls" 12 \
  {A f ablak ikonizlsakor az sszes tbbit is ikonizlja.}
menuText H OptionsWindowsRaise "Automatikus elhozs" 12 \
  {Elhoz bizonyos ablakokat (pl. elrehalads-svokat), amikor el vannak takarva.}
menuText H OptionsSounds "Hangok..." 3 {Lpseket bejelent hangok definilsa}
menuText H OptionsToolbar "Eszkztr" 0 {A f ablak eszkztrnak sszelltsa}
menuText H OptionsECO "ECO-fjl betltse..." 2 {Betlti az ECO-osztlyoz fjlt.}
menuText H OptionsSpell "Helyesrs-ellenrz fjl betltse..." 0 \
  {Betlti a helyesrs-ellenrz fjlt.}
menuText H OptionsTable "Vgjtktblzatok knyvtra..." 0 \
  {Vgjtktblzat-fjl kivlasztsa; a knyvtrban lev sszes vgjtktblzatot hasznlatba veszi.}
menuText H OptionsRecent "Aktulis fjlok..." 3 \
  {A Fjl menben megjelentett aktulis fjlok szmnak megvltoztatsa}
menuText H OptionsSave "Belltsok mentse" 12 \
  "Minden bellthat rtket elment a $::optionsFile fjlba."
menuText H OptionsAutoSave "Belltsok automatikus mentse kilpskor." 0 \
  {Automatikusan elment minden belltst, amikor kilpsz SCID-bl.}

# Help menu:
menuText H Help "Segtsg" 0
menuText H HelpContents "Tartalomjegyzk" 0 {Megjelenti a tartalomjegyzket}
menuText H HelpIndex "Trgymutat" 0 {Megjelenti a trgymutatt}
menuText H HelpGuide "Rvid ismertet" 0 {Rvid ismertett nyjt a program hasznlatrl.}
menuText H HelpHints "Krds-felelet" 0 {Nhny hasznos tancs}
menuText H HelpContact "Cmek" 0 {Fontosabb internetcmek}
menuText H HelpTip "A nap tippje" 2 {Hasznos tipp SCID hasznlathoz}
menuText H HelpStartup "Indul ablak" 0 {A program indtsakor megjelen ablak}
menuText H HelpAbout "SCID-rl" 0 {Tjkoztats SCID-rl}

# Game info box popup menu:
menuText H GInfoHideNext "Elrejti a kvetkez lpst." 0
menuText H GInfoMaterial "Mutatja az anyagi helyzetet" 11
menuText H GInfoFEN "FEN-formtum megmutatsa" 0
menuText H GInfoMarks "Mutatja a sznes mezket s nyilakat." 10
menuText H GInfoWrap "Hossz sorok trdelse" 0
menuText H GInfoFullComment "A teljes kommentrt megmutatja." 9
menuText H GInfoPhotos "Mutatja a fnykpeket" 1
menuText H GInfoTBNothing "Vgjtktblzatok: nincs informci" 20
menuText H GInfoTBResult "Vgjtktblzatok: csak eredmny" 25
menuText H GInfoTBAll "Vgjtktblzatok: eredmny s a legjobb lpsek" 42
menuText H GInfoDelete "Trli/helyrelltja ezt a jtszmt." 0
menuText H GInfoMark "Megjelli ezt a jtszmt/megsznteti a jellst." 0

# Main window buttons:
helpMsg H .button.start {Ugrs a jtszma elejre  (billenty: Home)}
helpMsg H .button.end {Ugrs a jtszma vgre  (billenty: End)}
helpMsg H .button.back {Vissza egy lpssel  (billenty: balra mutat nyl)}
helpMsg H .button.forward {Elre egy lpssel  (billenty: jobbra mutat nyl)}
helpMsg H .button.intoVar {Belp egy vltozatba  (gyorsbillenty: v).}
helpMsg H .button.exitVar {Kilp az aktulis vltozatbl  (gyorsbillenty: z).}
helpMsg H .button.flip {Tbla elforgatsa  (gyorsbillenty: .)}
helpMsg H .button.coords {Koordintk be- vagy kikapcsolsa  (gyorsbillenty: 0)}
helpMsg H .button.stm {Be- vagy kikapcsolja a lpsjogot mutat ikont}
helpMsg H .button.autoplay {Automatikus visszajtszs  (billenty: Ctrl+Z)}

# General buttons:
translate H Back {Vissza}
translate H Browse {Browse}
translate H Cancel {Mgse}
translate H Clear {Trl}
translate H Close {Bezr}
translate H Contents {Contents}
translate H Defaults {Alaprtkek}
translate H Delete {Trl}
translate H Graph {Grafikon}
translate H Help {Segtsg}
translate H Import {Import}
translate H Index {Tartalom}
translate H LoadGame {Jtszma betltse}
translate H BrowseGame {Jtszma nzegetse}
translate H MergeGame {Jtszma beolvasztsa}
translate H Preview {Elnzet}
translate H Revert {Elvet}
translate H Save {Ment}
translate H Search {Keres}
translate H Stop {llj}
translate H Store {Trol}
translate H Update {Frisst}
translate H ChangeOrient {Ablak elhelyezkedsnek vltoztatsa}
translate H ShowIcons {Show Icons} ;# ***
translate H None {Nincs}
translate H First {Els}
translate H Current {Aktulis}
translate H Last {Utols}

# General messages:
translate H game {jtszma}
translate H games {jtszma}
translate H move {lps}
translate H moves {lps}
translate H all {mind}
translate H Yes {Igen}
translate H No {Nem}
translate H Both {Mindkett}
translate H King {Kirly}
translate H Queen {Vezr}
translate H Rook {Bstya}
translate H Bishop {Fut}
translate H Knight {Huszr}
translate H Pawn {Gyalog}
translate H White {Vilgos}
translate H Black {Stt}
translate H Player {Jtkos}
translate H Rating {rtkszm}
translate H RatingDiff {rtkszmklnbsg (vilgos - stt)}
translate H AverageRating {tlagos rtkszm}
translate H Event {Esemny}
translate H Site {Helyszn}
translate H Country {Orszg}
translate H IgnoreColors {A szn kzmbs}
translate H Date {Dtum}
translate H EventDate {Az esemny dtuma}
translate H Decade {vtized}
translate H Year {v}
translate H Month {Hnap}
translate H Months {janur februr mrcius prilis mjus jnius
  jlius augusztus szeptember oktber november december}
translate H Days {vasrnap htf kedd szerda cstrtk pntek szombat}
translate H YearToToday {Az utols egy vben}
translate H Result {Eredmny}
translate H Round {Fordul}
translate H Length {Hossz}
translate H ECOCode {ECO-kd}
translate H ECO {ECO}
translate H Deleted {trlt}
translate H SearchResults {A keress eredmnye}
translate H OpeningTheDatabase {Adatbzis megnyitsa}
translate H Database {Adatbzis}
translate H Filter {Szr}
translate H noGames {Nincs tallat}
translate H allGames {sszes jtszma}
translate H empty {res}
translate H clipbase {vgasztal}
translate H score {Eredmny}
translate H StartPos {Kezdlls}
translate H Total {sszesen}
translate H readonly {read-only} ;# ***

# Standard error messages:
translate H ErrNotOpen {Ez az adatbzis nincs megnyitva.}
translate H ErrReadOnly {Ez az adatbzis csak olvashat; nem lehet megvltoztatni.}
translate H ErrSearchInterrupted {Keress megszaktva; az eredmnyek hinyosak.}

# Game information:
translate H twin {iker}
translate H deleted {trlt}
translate H comment {megjegyzs}
translate H hidden {rejtett}
translate H LastMove {Utols lps}
translate H NextMove {Kvetkez}
translate H GameStart {Jtszma eleje}
translate H LineStart {Elgazs eleje}
translate H GameEnd {Jtszma vge}
translate H LineEnd {Elgazs vge}

# Player information:
translate H PInfoAll {Eredmnyek az <b>sszes</b> jtszma alapjn}
translate H PInfoFilter {Eredmnyek a <b>szrt</b> jtszmk alapjn}
translate H PInfoAgainst {Eredmnyek, ha az ellenfl}
translate H PInfoMostWhite {Leggyakoribb megnyitsok vilgosknt}
translate H PInfoMostBlack {Leggyakoribb megnyitsok sttknt}
translate H PInfoRating {rtkszm alakulsa}
translate H PInfoBio {letrajz}
translate H PInfoEditRatings {rtkszmok tszerkesztse}

# Tablebase information:
translate H Draw {Dntetlen}
translate H stalemate {patt}
translate H withAllMoves {az sszes lpssel}
translate H withAllButOneMove {egy hjn az sszes lpssel}
translate H with {with}
translate H only {csak}
translate H lose {vesztenek}
translate H loses {veszt}
translate H allOthersLose {minden ms veszt}
translate H matesIn {mates in}
translate H hasCheckmated {mattot adott}
translate H longest {leghosszabb}
translate H WinningMoves {Nyer lps}
translate H DrawingMoves {Dntetlenre vezet lps}
translate H LosingMoves {Veszt lps}
translate H UnknownMoves {Bizonytalan kimenetel lps}

# Tip of the day:
translate H Tip {Tipp}
translate H TipAtStartup {Tipp indulskor}

# Tree window menus:
menuText H TreeFile "Fjl" 0
menuText H TreeFileSave "Cache-fjl mentse" 11 {Elmenti a faszerkezet-cache-fjlt (.stc)}
menuText H TreeFileFill "Cache-fjl feltltse" 14 \
  {Feltlti a cache-fjlt gyakori megnyitsokkal.}
menuText H TreeFileBest "Legjobb jtszmk listja" 0 {Megmutatja a legjobb jtszmkat a frl.}
menuText H TreeFileGraph "Grafikon" 0 {Megmutatja ennek a fagnak a grafikonjt.}
menuText H TreeFileCopy "Szveg msolsa a vglapra" 0 \
  {A kirt statisztikai adatokat a vglapra msolja.}
menuText H TreeFileClose "Faablak bezrsa" 10 {Bezrja a faszerkezet-ablakot.}
menuText H TreeSort "Rendezs" 0
menuText H TreeSortAlpha "ABC" 0
menuText H TreeSortECO "ECO-kd" 0
menuText H TreeSortFreq "Gyakorisg" 0
menuText H TreeSortScore "Pontszm" 0
menuText H TreeOpt "Belltsok" 0
menuText H TreeOptLock "Rgzts" 0 {A ft az aktulis adatbzishoz kti ill. a ktst feloldja.}
menuText H TreeOptTraining "Edzs" 0 {Edzszemmd be- vagy kikapcsolsa}
menuText H TreeOptAutosave "Cache-fjl automatikus mentse" 11 \
  {A faablak bezrsakor automatikusan elmenti a cache-fjlt.}
menuText H TreeHelp "Segtsg" 0
menuText H TreeHelpTree "Segtsg a fhoz" 0
menuText H TreeHelpIndex "Tartalom" 0
translate H SaveCache {Cache mentse}
translate H Training {Edzs}
translate H LockTree {Rgzts}
translate H TreeLocked {rgztve}
translate H TreeBest {Legjobb}
translate H TreeBestGames {A fa legjobb jtszmi}
translate H TreeTitleRow \
  {    Lps  ECO       Gyakorisg  Eredm. tll Telj. tl.v}
translate H TreeTotal {SSZESEN}

# Finder window:
menuText H FinderFile "Fjl" 0
menuText H FinderFileSubdirs "Keress az alknyvtrakban" 0
menuText H FinderFileClose "A fjlkeres bezrsa" 15
menuText H FinderSort "Rendezs" 0
menuText H FinderSortType "Tpus" 0
menuText H FinderSortSize "Mret" 0
menuText H FinderSortMod "Id" 0
menuText H FinderSortName "Nv" 0
menuText H FinderSortPath "tvonal" 0
menuText H FinderTypes "Tpusok" 0
menuText H FinderTypesScid "SCID-adatbzisok" 0
menuText H FinderTypesOld "Rgi formtum SCID-adatbzisok" 5
menuText H FinderTypesPGN "PGN-fjlok" 0
menuText H FinderTypesEPD "EPD-fjlok" 0
menuText H FinderTypesRep "Repertorfjlok" 0
menuText H FinderHelp "Segtsg" 0
menuText H FinderHelpFinder "Segtsg a fjlkereshz" 0
menuText H FinderHelpIndex "Tartalom" 0
translate H FileFinder {Fjlkeres}
translate H FinderDir {Knyvtr}
translate H FinderDirs {Knyvtrak}
translate H FinderFiles {Fjlok}
translate H FinderUpDir {fel}

# Player finder:
menuText H PListFile "Fjl" 0
menuText H PListFileUpdate "Frisst" 0
menuText H PListFileClose "Jtkoskeres bezrsa" 16
menuText H PListSort "Rendezs" 0
menuText H PListSortName "Nv" 0
menuText H PListSortElo "l" 0
menuText H PListSortGames "Jtszmk" 0
menuText H PListSortOldest "Legrgibb" 0
menuText H PListSortNewest "Legjabb" 3

# Tournament finder:
menuText H TmtFile "Fjl" 0
menuText H TmtFileUpdate "Frisst" 0
menuText H TmtFileClose "A versenykeres bezrsa" 18
menuText H TmtSort "Rendezs" 0
menuText H TmtSortDate "Dtum" 0
menuText H TmtSortPlayers "Jtkosok" 0
menuText H TmtSortGames "Jtszmk" 1
menuText H TmtSortElo "l" 0
menuText H TmtSortSite "Helyszn" 0
menuText H TmtSortEvent "Esemny" 0
menuText H TmtSortWinner "Gyztes" 0
translate H TmtLimit "Lista hossza"
translate H TmtMeanElo "Legkisebb tlagos l"
translate H TmtNone "Nem talltam hozz versenyt."

# Graph windows:
menuText H GraphFile "Fjl" 0
menuText H GraphFileColor "Ments Color PostScript-knt..." 7
menuText H GraphFileGrey "Ments Greyscale PostScript-knt..." 7
menuText H GraphFileClose "Ablak bezrsa" 8
menuText H GraphOptions "Belltsok" 0
menuText H GraphOptionsWhite "Vilgos" 0
menuText H GraphOptionsBlack "Stt" 0
menuText H GraphOptionsBoth "Mindkett" 1
menuText H GraphOptionsPInfo "A jtkosinformci jtkosa" 0
translate H GraphFilterTitle "Szrgrafikon: gyakorisg 1000 jtszmnknt"

# Analysis window:
translate H AddVariation {Vltozat beszrsa}
translate H AddMove {Lps beszrsa}
translate H Annotate {rtkel jelekkel lt el}
translate H AnalysisCommand {Elemzsparancs}
translate H PreviousChoices {Korbbi vlasztsok}
translate H AnnotateTime {Kt lps kztti id msodpercben}
translate H AnnotateWhich {Vltozatok hozzadsa}
translate H AnnotateAll {Mindkt fl lpseihez}
translate H AnnotateWhite {Csak vilgos lpseihez}
translate H AnnotateBlack {Csak stt lpseihez}
translate H AnnotateNotBest {Ha a jtszmban nem a legjobbat lptk}
translate H LowPriority {Alacsony CPU-priorits}

# Analysis Engine open dialog:
translate H EngineList {Elemz motorok listja}
translate H EngineName {Nv}
translate H EngineCmd {Parancssor}
translate H EngineArgs {Paramterek}
translate H EngineDir {Knyvtr}
translate H EngineElo {l}
translate H EngineTime {Dtum}
translate H EngineNew {j}
translate H EngineEdit {Szerkeszts}
translate H EngineRequired {A vastagbets mezk szksgesek, a tbbiek kihagyhatk.}

# Stats window menus:
menuText H StatsFile "Fjl" 0
menuText H StatsFilePrint "Nyomtats fjlba..." 0
menuText H StatsFileClose "Ablak bezrsa" 8
menuText H StatsOpt "Belltsok" 0

# PGN window menus:
menuText H PgnFile "Fjl" 0
menuText H PgnFileCopy "A vglapra msolja a jtszmt" 2
menuText H PgnFilePrint "Nyomtats fjlba..." 0
menuText H PgnFileClose "PGN-ablak bezrsa" 12
menuText H PgnOpt "Megjelents" 0
menuText H PgnOptColor "Sznes szveg" 0
menuText H PgnOptShort "Rvid (3-soros) fejlc" 0
menuText H PgnOptSymbols "Szimblumok hasznlata" 1
menuText H PgnOptIndentC "Megjegyzsek behzsa" 0
menuText H PgnOptIndentV "Vltozatok behzsa" 0
menuText H PgnOptColumn "Oszlopok stlusa (soronknt egy lps)" 0
menuText H PgnOptSpace "Szkz a lps sorszma utn" 3
menuText H PgnOptStripMarks "Sznes mezk s nyilak kifejtse" 2
menuText H PgnOptBoldMainLine "A fvltozat lpsei vastag betvel" 21
menuText H PgnColor "Sznek" 1
menuText H PgnColorHeader "Fejlc..." 0
menuText H PgnColorAnno "rtkel jelek..." 0
menuText H PgnColorComments "Megjegyzsek..." 0
menuText H PgnColorVars "Vltozatok..." 0
menuText H PgnColorBackground "Httr..." 0
menuText H PgnHelp "Segtsg" 0
menuText H PgnHelpPgn "Segtsg PGN-hez" 9
menuText H PgnHelpIndex "Tartalom" 0
translate H PgnWindowTitle {Jtszmajegyzs - %u. jtszma}

# Crosstable window menus:
menuText H CrosstabFile "Fjl" 0
menuText H CrosstabFileText "Nyomtats szvegfjlba..." 10
menuText H CrosstabFileHtml "Nyomtats HTML-fjlba..." 10
menuText H CrosstabFileLaTeX "Nyomtats LaTeX-fjlba..." 10
menuText H CrosstabFileClose "Ablak bezrsa" 8
menuText H CrosstabEdit "Szerkeszts" 1
menuText H CrosstabEditEvent "Esemny" 0
menuText H CrosstabEditSite "Helyszn" 0
menuText H CrosstabEditDate "Dtum" 0
menuText H CrosstabOpt "Megjelents" 0
menuText H CrosstabOptAll "Krmrkzs" 0
menuText H CrosstabOptSwiss "Svjci" 0
menuText H CrosstabOptKnockout "Kiesses" 1
menuText H CrosstabOptAuto "Talld ki!" 0
menuText H CrosstabOptAges "letkor vben" 0
menuText H CrosstabOptNats "Nemzetisg" 0
menuText H CrosstabOptRatings "rtkszmok" 1
menuText H CrosstabOptTitles "Cmek" 0
menuText H CrosstabOptBreaks "Pontszm holtverseny eldntshez" 0
menuText H CrosstabOptDeleted "Trlt jtszmkkal egytt" 0
menuText H CrosstabOptColors "Sznek (csak svjci rendszer esetn)" 2
menuText H CrosstabOptColumnNumbers "Szmozott oszlopok (csak krmrkzshez)" 2
menuText H CrosstabOptGroup "Pontcsoportok" 1
menuText H CrosstabSort "Rendezs" 0
menuText H CrosstabSortName "Nv" 0
menuText H CrosstabSortRating "rtkszm" 0
menuText H CrosstabSortScore "Pontszm" 0
menuText H CrosstabColor "Szn" 2
menuText H CrosstabColorPlain "Kznsges szveg" 0
menuText H CrosstabColorHyper "Hypertext" 0
menuText H CrosstabHelp "Segtsg" 0
menuText H CrosstabHelpCross "Segtsg versenytblzathoz" 0
menuText H CrosstabHelpIndex "Tartalom" 0
translate H SetFilter {Szr belltsa}
translate H AddToFilter {Hozzadja a szrhz}
translate H Swiss {Svjci}
translate H Category {Kategria}

# Opening report window menus:
menuText H OprepFile "Fjl" 0
menuText H OprepFileText "Nyomtats szvegfjlba..." 10
menuText H OprepFileHtml "Nyomtats HTML-fjlba..." 10
menuText H OprepFileLaTeX "Nyomtats LaTeX-fjlba..." 10
menuText H OprepFileOptions "Belltsok..." 0
menuText H OprepFileClose "Ablak bezrsa" 8
menuText H OprepFavorites "Kedvencek" 0
menuText H OprepFavoritesAdd "sszefoglal hozzadsa..." 0
menuText H OprepFavoritesEdit "Kedvencek tszerkesztse..." 0
menuText H OprepFavoritesGenerate "sszefoglal ksztse..." 0
menuText H OprepHelp "Segtsg" 0
menuText H OprepHelpReport "Segtsg a megnyitsi sszefoglalhoz" 0
menuText H OprepHelpIndex "Trgymutat" 0

# Repertoire editor:
menuText H RepFile "Fjl" 0
menuText H RepFileNew "j" 0
menuText H RepFileOpen "Megnyits..." 3
menuText H RepFileSave "Ments..." 0
menuText H RepFileSaveAs "Ments msknt..." 5
menuText H RepFileClose "Ablak bezrsa" 8
menuText H RepEdit "Szerkeszts" 1
menuText H RepEditGroup "Csoport hozzadsa" 0
menuText H RepEditInclude "Beveend elgazs" 0
menuText H RepEditExclude "Kizrand elgazs" 0
menuText H RepView "Nzet" 0
menuText H RepViewExpand "Az sszes csoportot kibontja" 20
menuText H RepViewCollapse "Az sszes csoportot sszehzza" 20
menuText H RepSearch "Keress" 0
menuText H RepSearchAll "Az egsz repertorban..." 3
menuText H RepSearchDisplayed "Csak a megjelentett elgazsokban..." 0
#Ez igen gyans!
menuText H RepHelp "Segtsg" 0
menuText H RepHelpRep "Segtsg a repertorhoz" 0
menuText H RepHelpIndex "Tartalom" 0
translate H RepSearch "Keress a repertorban"
translate H RepIncludedLines "beveend elgazsok"
translate H RepExcludedLines "kizrand elgazsok"
translate H RepCloseDialog {Ebben a repertorban elmentetlen vltoztatsok vannak.

Tnyleg folytatni akarod, s elvetni a ltrehozott vltoztatsokat?
}

# Header search:
translate H HeaderSearch {Keress fejlc alapjn}
translate H EndSideToMove {Aki a jtszma vgn lpsre kvetkezik}
translate H GamesWithNoECO {Jtszmk ECO nlkl?}
translate H GameLength {Jtszmahossz}
translate H FindGamesWith {Megjellt jtszmk}
translate H StdStart {Klnleges kezds}
translate H Promotions {Gyalogtvltozsok}
translate H Comments {Megjegyzsek}
translate H Variations {Vltozatok}
translate H Annotations {rtkel jelek}
translate H DeleteFlag {Megjells trlse}
translate H WhiteOpFlag {Megnyits vilgossal}
translate H BlackOpFlag {Megnyits stttel}
translate H MiddlegameFlag {Kzpjtk}
translate H EndgameFlag {Vgjtk}
translate H NoveltyFlag {jts}
translate H PawnFlag {Gyalogszerkezet}
translate H TacticsFlag {Taktika}
translate H QsideFlag {Vezrszrnyi jtk}
translate H KsideFlag {Kirlyszrnyi jtk}
translate H BrilliancyFlag {Csillogs}
translate H BlunderFlag {Elnzs}
translate H UserFlag {Felhasznl}
translate H PgnContains {Szveg a PGN-ben}

# Game list window:
translate H GlistNumber {Szm}
translate H GlistWhite {Vilgos}
translate H GlistBlack {Stt}
translate H GlistWElo {Vilgos lje}
translate H GlistBElo {Stt lje}
translate H GlistEvent {Esemny}
translate H GlistSite {Helyszn}
translate H GlistRound {Fordul}
translate H GlistDate {Dtum}
translate H GlistYear {v}
translate H GlistEDate {Az esemny dtuma}
translate H GlistResult {Eredmny}
translate H GlistLength {Hossz}
translate H GlistCountry {Orszg}
translate H GlistECO {ECO}
translate H GlistOpening {Megnyits}
translate H GlistEndMaterial {Vgs anyagi helyzet}
translate H GlistDeleted {Trlt}
translate H GlistFlags {Megjellsek}
translate H GlistVars {Variations}
translate H GlistComments {Megjegyzsek}
translate H GlistAnnos {rtkel jelek}
translate H GlistStart {Kezdet}
translate H GlistGameNumber {A jtszma sorszma}
translate H GlistFindText {Szveg keresse}
translate H GlistMoveField {Lps}
translate H GlistEditField {Konfigurls}
translate H GlistAddField {Hozzad}
translate H GlistDeleteField {Eltvolt}
translate H GlistWidth {Szlessg}
translate H GlistAlign {Igazt}
translate H GlistColor {Szn}
translate H GlistSep {Elvlaszt}

# Maintenance window:
translate H DatabaseName {Az adatbzis neve:}
translate H TypeIcon {Tpusikon:}
translate H NumOfGames {Jtszmk:}
translate H NumDeletedGames {Trlt jtszmk:}
translate H NumFilterGames {Szrt jtszmk:}
translate H YearRange {vtartomny:}
translate H RatingRange {rtkszmtartomny:}
translate H Description {Lers}
translate H Flag {Megjells}
translate H DeleteCurrent {Trli az aktulis jtszmt.}
translate H DeleteFilter {Trli a szrt jtszmkat.}
translate H DeleteAll {Minden jtszmt trl.}
translate H UndeleteCurrent {Helyrelltja az aktulis jtszmt.}
translate H UndeleteFilter {Helyrelltja a szrt jtszmkat.}
translate H UndeleteAll {Minden jtszmt helyrellt.}
translate H DeleteTwins {Trli az ikerjtszmkat.}
translate H MarkCurrent {Megjelli az aktulis jtszmt.}
translate H MarkFilter {Megjelli a szrt jtszmkat.}
translate H MarkAll {Minden jtszmt megjell.}
translate H UnmarkCurrent {Eltvoltja az aktulis jtszma megjellst.}
translate H UnmarkFilter {Eltvoltja a szrt jtszmk megjellst.}
translate H UnmarkAll {Minden jtszma megjellst eltvoltja.}
translate H Spellchecking {Helyesrs-ellenrzs}
translate H Players {Jtkosok}
translate H Events {Esemnyek}
translate H Sites {Helysznek}
translate H Rounds {Fordulk}
translate H DatabaseOps {Adatbzismveletek}
translate H ReclassifyGames {ECO alapjn osztlyozza a jtszmkat.}
translate H CompactDatabase {Adatbzis tmrtse}
translate H SortDatabase {Adatbzis rendezse}
translate H AddEloRatings {l-rtkszmok hozzadsa}
translate H AutoloadGame {Jtszmasorszm automatikus betltse}
#Igaz ez?
translate H StripTags {PGN-cmkk eltntetse}
translate H StripTag {Cmke eltntetse}
translate H Cleaner {Takart}
translate H CleanerHelp {
SCID Takartja el fogja vgezni az aktulis adatbzison az sszes olyan gondozsi feladatot, amelyet az albbi listrl kijellsz.

Az ECO-osztlyozsra s az ikertrlsre vonatkoz jelenlegi belltsok akkor jutnak rvnyre, ha ezeket a feladatokat is kijelld.
}
translate H CleanerConfirm {
Ha a Takart mr elindult, tbb nem lehet meglltani!

Nagy adatbzison a kivlasztott feladatoktl s aktulis belltsaiktl fggen a mvelet sokig eltarthat.

Biztos, hogy neki akarsz ltni a kijellt gondozsi feladatoknak?
}

# Comment editor:
translate H AnnotationSymbols  {rtkel szimblumok:}
translate H Comment {Megjegyzs:}
translate H InsertMark {Megjells beszrsa}
translate H InsertMarkHelp {
Megjells beszrsa/trlse: szn, tpus, mez kivlasztsa.
Nyl beszrsa/trlse: Kattints a jobb gombbal kt mezn.
}

# Nag buttons in comment editor:
translate H GoodMove {J lps}
translate H PoorMove {Rossz lps}
translate H ExcellentMove {Kitn lps}
translate H Blunder {Elnzs}
translate H InterestingMove {rdekes lps}
translate H DubiousMove {Ktes rtk lps}
translate H WhiteDecisiveAdvantage {Vilgosnak dnt elnye van.}
translate H BlackDecisiveAdvantage {Sttnek dnt elnye van.}
translate H WhiteClearAdvantage {Vilgos elnye nyilvnval.}
translate H BlackClearAdvantage {Stt elnye nyilvnval.}
translate H WhiteSlightAdvantage {Vilgos valamivel jobban ll.}
translate H BlackSlightAdvantage {Stt valamivel jobban ll.}
translate H Equality {Egyenl lls}
translate H Unclear {Tisztzatlan lls}
translate H Diagram {Diagram}

# Board search:
translate H BoardSearch {lls keresse}
translate H FilterOperation {Elvgzend mvelet az aktulis szrn:}
translate H FilterAnd {S (Szr szktse)}
translate H FilterOr {VAGY (Szr bvtse)}
translate H FilterIgnore {SEMMI (Szr trlse)}
translate H SearchType {A keress fajtja:}
translate H SearchBoardExact {Pontos lls (minden figura azonos mezn)}
translate H SearchBoardPawns {Gyalogok (azonos anyag, minden gyalog azonos mezn)}
translate H SearchBoardFiles {Vonalak (azonos anyag, minden gyalog azonos vonalon)}
translate H SearchBoardAny {Brmi (azonos anyag, gyalogok s figurk brhol)}
translate H LookInVars {Vltozatokban is keres.}

# Material search:
translate H MaterialSearch {Keress anyagra}
translate H Material {Anyag}
translate H Patterns {Alakzatok}
translate H Zero {Nullzs}
translate H Any {Brmi}
translate H CurrentBoard {Aktulis lls}
translate H CommonEndings {Gyakori vgjtkok}
translate H CommonPatterns {Gyakori alakzatok}
translate H MaterialDiff {Anyagklnbsg}
translate H squares {mezk}
translate H SameColor {Azonos szn}
translate H OppColor {Ellenkez szn}
translate H Either {Brmelyik}
translate H MoveNumberRange {Lpstartomny}
translate H MatchForAtLeast {Egyezzen legalbb}
translate H HalfMoves {fl lpsig.}

# Common endings in material search:
translate H EndingPawns {Gyalogvgjtkok}
translate H EndingRookVsPawns {Bstya gyalog(ok) ellen}
translate H EndingRookPawnVsRook {Bstya s 1 gyalog bstya ellen}
translate H EndingRookPawnsVsRook {Bstya s gyalogok bstya ellen}
translate H EndingRooks {Bstyavgjtkok}
translate H EndingRooksPassedA {Bstyavgjtkok szabad a-gyaloggal}
translate H EndingRooksDouble {Ketts bstyavgjtkok}
translate H EndingBishops {Futvgjtkok}
translate H EndingBishopVsKnight {Fut huszr ellen}
translate H EndingKnights {Huszrvgjtkok}
translate H EndingQueens {Vezrvgjtkok}
translate H EndingQueenPawnVsQueen {Vezr s 1 gyalog vezr ellen}
translate H BishopPairVsKnightPair {Futpr huszrpr ellen a kzpjtkban}

# Common patterns in material search:
translate H PatternWhiteIQP {Izollt vilgos vezrgyalog}
translate H PatternWhiteIQPBreakE6 {d4-d5 ttrs e6 ellen}
translate H PatternWhiteIQPBreakC6 {d4-d5 ttrs c6 ellen}
translate H PatternBlackIQP {Izollt stt vezrgyalog}
translate H PatternWhiteBlackIQP {Izollt vilgos d-gyalog izollt stt d-gyalog ellen}
translate H PatternCoupleC3D4 {Izollt vilgos c3-d4 gyalogpr}
translate H PatternHangingC5D5 {Lg stt gyalogok c5-n s d5-n}
translate H PatternMaroczy {Marczy-centrum (gyalogok c4-en s e4-en)}
translate H PatternRookSacC3 {Bstyaldozat c3-on}
translate H PatternKc1Kg8 {O-O-O O-O ellen (Kc1 s Kg8)}
translate H PatternKg1Kc8 {O-O O-O-O ellen (Kg1 s Kc8)}
translate H PatternLightFian {Vilgos mezej fianchetto (g2 fut b7 fut ellen)}
translate H PatternDarkFian {Stt mezej fianchetto (b2 fut g7 fut ellen)}
translate H PatternFourFian {Ngyes fianchetto (futk b2-n, g2-n, b7-en s g7-en)}

# Game saving:
translate H Today {Ma}
translate H ClassifyGame {Jtszma osztlyozsa}

# Setup position:
translate H EmptyBoard {Tbla letakartsa}
translate H InitialBoard {Alaplls}
translate H SideToMove {Ki lp?}
translate H MoveNumber {Lps szma}
translate H Castling {Sncols}
translate H EnPassantFile {"en passant"-vonal}
translate H ClearFen {FEN trlse}
translate H PasteFen {FEN beillesztse}

# Replace move dialog:
translate H ReplaceMove {Lps cserje}
translate H AddNewVar {j vltozat beszrsa}
translate H ReplaceMoveMessage {Itt mr van lps.

Kicserlheted, miltal az sszes t kvet lps elvsz, vagy lpsedet beszrhatod j vltozatknt.

(Ha a jvben nem akarod ltni ezt az zenetet, kapcsold ki a Belltsok:Lpsek menben a "Lps cserje eltt rkrdez." belltst.)}

# Make database read-only dialog:
translate H ReadOnlyDialog {Ha ezt az adatbzist kizrlag olvashatv teszed, nem lehet vltoztatsokat vgezni rajta. Nem lehet jtszmkat elmenteni vagy kicserlni, sem a trlskijellseket megvltoztatni. Minden rendezs vagy ECO-osztlyozs csak tmeneti lesz.

Knnyen jra rhatv teheted az adatbzist, ha bezrod, majd jbl megnyitod.

Tnyleg kizrlag olvashatv akarod tenni ezt az adatbzist?}

# Clear game dialog:
translate H ClearGameDialog {Ez a jtszma megvltozott.

Tnyleg folytatni akarod, s elvetni a ltrehozott vltoztatsokat?
}

# Exit dialog:
translate H ExitDialog {Tnyleg ki akarsz lpni SCID-bl?}
translate H ExitUnsaved {A kvetkez adatbzisokban elmentetlen jtszmavltoztatsok vannak. Ha most kilpsz, ezek a vltoztatsok elvesznek.}

# Import window:
translate H PasteCurrentGame {Beilleszti az aktulis jtszmt.}
translate H ImportHelp1 {Bevisz vagy beilleszt egy PGN-formtum jtszmt a fenti keretbe.}
translate H ImportHelp2 {Itt jelennek meg az importls kzben fellp hibk.}

# ECO Browser:
translate H ECOAllSections {sszes ECO-osztly}
translate H ECOSection {ECO-osztly}
translate H ECOSummary {sszefoglals:}
translate H ECOFrequency {Alkdok gyakorisga:}

# Opening Report:
translate H OprepTitle {Megnyitsi sszefoglal}
translate H OprepReport {sszefoglal}
translate H OprepGenerated {Ksztette:}
#Lehet, hogy ez "kszlt"?
translate H OprepStatsHist {Statisztika s trtnet}
translate H OprepStats {Statisztika}
translate H OprepStatAll {Az sszefoglal sszes jtszmja}
translate H OprepStatBoth {Mindkett}
translate H OprepStatSince {Idszak kezdete:}
translate H OprepOldest {A legrgibb jtszmk}
translate H OprepNewest {A legjabb jtszmk}
translate H OprepPopular {Jelenlegi npszersg}
translate H OprepFreqAll {Gyakorisg a teljes idszakban:   }
translate H OprepFreq1   {Az utbbi 1 vben: }
translate H OprepFreq5   {Az utbbi 5 vben: }
translate H OprepFreq10  {Az utbbi 10 vben: }
translate H OprepEvery {minden %u jtszmban egyszer}
translate H OprepUp {%u%s nvekeds az vek sorn}
translate H OprepDown {%u%s cskkens az vek sorn}
translate H OprepSame {nincs vltozs az vek sorn}
translate H OprepMostFrequent {Leggyakoribb jtkosok}
translate H OprepMostFrequentOpponents {Leggyakoribb ellenfelek}
translate H OprepRatingsPerf {rtkszm s teljestmny}
translate H OprepAvgPerf {tlagos rtkszm s teljestmny}
translate H OprepWRating {Vilgos rtkszma}
translate H OprepBRating {Stt rtkszma}
translate H OprepWPerf {Vilgos teljestmnye}
translate H OprepBPerf {Stt teljestmnye}
translate H OprepHighRating {A legnagyobb tlagrtkszm jtszmk}
translate H OprepTrends {Tendencik}
translate H OprepResults {Eredmny hosszsg s gyakorisg szerint}
translate H OprepLength {Jtszmahossz}
translate H OprepFrequency {Gyakorisg}
translate H OprepWWins {Vilgos nyer: }
translate H OprepBWins {Stt nyer:   }
translate H OprepDraws {Dntetlen:    }
translate H OprepWholeDB {teljes adatbzis}
translate H OprepShortest {A legrvidebb gyzelmek}
translate H OprepMovesThemes {Lpsek s tmk}
translate H OprepMoveOrders {A vizsglt llshoz vezet lpssorrendek}
translate H OprepMoveOrdersOne \
  {Csak egy lpssorrend vezetett ehhez az llshoz:}
translate H OprepMoveOrdersAll \
  {%u lpssorrend vezetett ehhez az llshoz:}
translate H OprepMoveOrdersMany \
  {%u lpssorrend vezetett ehhez az llshoz. Az els %u:}
translate H OprepMovesFrom {A vizsglt llsban tett lpsek}
translate H OprepMostFrequentEcoCodes {Leggyakoribb ECO-kdok}
translate H OprepThemes {Pozcis tmk}
translate H OprepThemeDescription {Tmk gyakorisga az egyes jtszmk els %u lpsben}
translate H OprepThemeSameCastling {Sncols azonos oldalra}
translate H OprepThemeOppCastling {Sncols ellenkez oldalra}
translate H OprepThemeNoCastling {Egyik kirly sem sncolt.}
translate H OprepThemeKPawnStorm {Kirlyszrnyi gyalogroham}
translate H OprepThemeQueenswap {Vezrcsere}
translate H OprepThemeWIQP {Elszigetelt vilgos vezrgyalog}
translate H OprepThemeBIQP {Elszigetelt stt vezrgyalog}
translate H OprepThemeWP567 {Vilgos gyalog az 5./6./7. soron}
translate H OprepThemeBP234 {Stt gyalog a 4./3./2. soron}
translate H OprepThemeOpenCDE {Nylt c/d/e-vonal}
translate H OprepTheme1BishopPair {Csak az egyik flnek van futprja.}
translate H OprepEndgames {Vgjtkok}
translate H OprepReportGames {Az sszefoglal jtszmi}
translate H OprepAllGames    {sszes jtszma}
translate H OprepEndClass {Anyagi viszonyok az egyes jtszmk vgn}
translate H OprepTheoryTable {Elmlettblzat}
translate H OprepTableComment {a legnagyobb rtkszm %u jtszma alapjn}
translate H OprepExtraMoves {A kln megjegyzssel elltott lpsek szma az elmlettblzatban}
translate H OprepMaxGames {Az elmlettblzat ltrehozshoz felhasznlhat jtszmk maximlis szma}
translate H OprepViewHTML {HTML megtekintse}
translate H OprepViewLaTeX {LaTeX megtekintse}

# Player Report:
translate H PReportTitle {sszefoglal jtkosrl}
translate H PReportColorWhite {vilgossal}
translate H PReportColorBlack {stttel}
translate H PReportMoves {%s utn}
translate H PReportOpenings {Megnyitsok}
translate H PReportClipbase {Kirti a vglapot, s odamsolja a felttelnek megfelel jtszmkat}

# Piece Tracker window:
translate H TrackerSelectSingle {A bal egrgomb kivlasztja ezt a figurt.}
translate H TrackerSelectPair {A bal egrgomb kivlasztja ezt a figurt; a jobb egrgomb a prjt is kivlasztja.}
translate H TrackerSelectPawn {A bal egrgomb kivlasztja ezt a gyalogot; a jobb egrgomb az sszes gyalogot kivlasztja.}
translate H TrackerStat {Statisztika}
translate H TrackerGames {Jtszmk %-a, amelyekben erre a mezre lpett}
translate H TrackerTime {Id %-a, amelyet az egyes mezkn tlttt}
translate H TrackerMoves {Lpsek}
translate H TrackerMovesStart {Add meg a lps szmt, amelynl a nyomkvetsnek el kell kezddnie.}
translate H TrackerMovesStop {Add meg a lps szmt, amelynl a nyomkvetsnek be kell fejezdnie.}

# Game selection dialogs:
translate H SelectAllGames {Az adatbzis sszes jtszmja}
translate H SelectFilterGames {Csak a szrt jtszmk}
translate H SelectTournamentGames {Csak az aktulis verseny jtszmi}
translate H SelectOlderGames {Csak rgebbi jtszmk}

# Delete Twins window:
translate H TwinsNote {Kt jtszma akkor iker, ha ugyanazok jtsszk ket, s megfelelnek az alant meghatrozhat kritriumoknak. Az ikerprbl a rvidebb jtszma trldik.
Javaslat: ikrek trlse eltt rdemes helyesrs-ellenrzst vgezni az adatbzison, mert az javtja az ikerfeldertst.}
translate H TwinsCriteria {Kritriumok: Az ikerjtszmk kzs tulajdonsgai...}
translate H TwinsWhich {A megvizsgland jtszmk}
translate H TwinsColors {Azonos szn?}
translate H TwinsEvent {Ugyanaz az esemny?}
translate H TwinsSite {Azonos helyszn?}
translate H TwinsRound {Ugyanaz a fordul?}
translate H TwinsYear {Azonos v?}
translate H TwinsMonth {Azonos hnap?}
translate H TwinsDay {Ugyanaz a nap?}
translate H TwinsResult {Azonos eredmny?}
translate H TwinsECO {Azonos ECO-kd?}
translate H TwinsMoves {Azonos lpsek?}
translate H TwinsPlayers {A jtkosok nevnek sszehasonltsakor:}
translate H TwinsPlayersExact {Teljes egyezs kell.}
translate H TwinsPlayersPrefix {Elg az els 4 betnek egyeznie.}
translate H TwinsWhen {Ikerjtszmk trlsekor}
translate H TwinsSkipShort {Hagyjuk figyelmen kvl az 5 lpsnl rvidebb jtszmkat?}
translate H TwinsUndelete {Elszr lltsuk helyre az sszes jtszmt?}
translate H TwinsSetFilter {A szrt lltsuk az sszes trlt ikerjtszmra?}
translate H TwinsComments {A megjegyzsekkel elltott jtszmkat mindig tartsuk meg?}
translate H TwinsVars {A vltozatokat tartalmaz jtszmkat mindig tartsuk meg?}
translate H TwinsDeleteWhich {Melyik jtszmt trljem?}
translate H TwinsDeleteShorter {A rvidebbet}
translate H TwinsDeleteOlder {A kisebb sorszmt}
translate H TwinsDeleteNewer {A nagyobb sorszmt}
translate H TwinsDelete {Jtszmk trlse}

# Name editor window:
translate H NameEditType {Szerkesztend nvtpus}
translate H NameEditSelect {Szerkesztend jtszmk}
translate H NameEditReplace {Cserl}
translate H NameEditWith {Erre}
translate H NameEditMatches {Egyezsek: Ctrl+1...Ctrl+9 vlaszt.}

# Classify window:
translate H Classify {Osztlyoz}
translate H ClassifyWhich {Mely jtszmk essenek t ECO-osztlyozson?}
translate H ClassifyAll {Az sszes (rja fell a rgi ECO-kdokat)}
translate H ClassifyYear {Az utbbi vben jtszott jtszmk}
translate H ClassifyMonth {Az utbbi hnapban jtszott jtszmk}
translate H ClassifyNew {Csak az eddig mg nem osztlyozott jtszmk}
translate H ClassifyCodes {Hasznland ECO-kdok}
translate H ClassifyBasic {Csak az alapkdok ("B12", ...)}
translate H ClassifyExtended {Kiterjesztett SCID-kdok ("B12j", ...)}

# Compaction:
translate H NameFile {Nvfjl}
translate H GameFile {Jtszmafjl}
translate H Names {Nevek}
translate H Unused {Hasznlaton kvl}
translate H SizeKb {Mret (kB)}
translate H CurrentState {Jelenlegi llapot}
translate H AfterCompaction {Tmrts utn}
translate H CompactNames {Nvfjl tmrtse}
translate H CompactGames {Jtszmafjl tmrtse}

# Sorting:
translate H SortCriteria {Kritriumok}
translate H AddCriteria {Kritriumok hozzadsa}
translate H CommonSorts {Szoksos rendezsek}
translate H Sort {Rendezs}

# Exporting:
translate H AddToExistingFile {Jtszmk hozzadsa ltez fjlhoz?}
translate H ExportComments {Megjegyzsek exportlsa?}
translate H ExportVariations {Vltozatok exportlsa?}
translate H IndentComments {Megjegyzsek igaztsa?}
translate H IndentVariations {Vltozatok igaztsa?}
translate H ExportColumnStyle {Oszlop stlusa (soronknt egy lps)?}
translate H ExportSymbolStyle {Szimblumok stlusa:}
translate H ExportStripMarks {Kivegye a megjegyzsekbl a mez- s nylmegjellseket?}

# Goto game/move dialogs:
translate H LoadGameNumber {A betltend jtszma sorszma:}
translate H GotoMoveNumber {Ugrs a kvetkez lpshez:}

# Copy games dialog:
translate H CopyGames {Jtszmk msolsa}
translate H CopyConfirm {
 Tnyleg t akarod msolni
 a [::utils::thousands $nGamesToCopy] szrt jtszmt
 a "$fromName" adatbzisbl
 a "$targetName" adatbzisba?
}
translate H CopyErr {Nem tudom tmsolni a jtszmkat.}
translate H CopyErrSource {forrs}
translate H CopyErrTarget {cl}
translate H CopyErrNoGames {szrjben nincsenek jtszmk.}
translate H CopyErrReadOnly {kizrlag olvashat.}
translate H CopyErrNotOpen {nincs megnyitva.}

# Colors:
translate H LightSquares {Vilgos mezk}
translate H DarkSquares {Stt mezk}
translate H SelectedSquares {Kivlasztott mezk}
translate H SuggestedSquares {Javasolt lpsek mezi}
translate H WhitePieces {Vilgos figurk}
translate H BlackPieces {Stt figurk}
translate H WhiteBorder {Vilgos krvonal}
translate H BlackBorder {Stt krvonal}

# Novelty window:
translate H FindNovelty {jts keresse}
translate H Novelty {jts}
translate H NoveltyInterrupt {jtskeress lelltva}
translate H NoveltyNone {Ebben a jtszmban nem talltam jtst.}
translate H NoveltyHelp {
SCID megkeresi az aktulis jtszma els olyan lpst, amely nem szerepel sem a kivlasztott adatbzisban, sem az ECO megnyitstrban.
}

# Sounds configuration:
translate H SoundsFolder {Hangfjlok knyvtra}
translate H SoundsFolderHelp {A knyvtrban a King.wav, a.wav, 1.wav, s..t. fjloknak kell szerepelnik.}
translate H SoundsAnnounceOptions {Lpsbemondsok belltsai}
translate H SoundsAnnounceNew {j lps bemondsa amint megtesszk}
translate H SoundsAnnounceForward {Lps bemondsa amikor egy lpst elre lpnk}
translate H SoundsAnnounceBack {Lps bemondsa amikor visszavesznk vagy egy lpst htra lpnk}

# Upgrading databases:
translate H Upgrading {Feljts}
translate H ConfirmOpenNew {
Ez rgi formtum (SCID 2) adatbzis, amelyet SCID 3 nem tud megnyitni, de mr ltrehozott egy j formtum (SCID 3) verzit.

Szeretnd megnyitni az adatbzis j formtum verzijt?
}
translate H ConfirmUpgrade {
Ez rgi formtum (SCID 2) adatbzis. j formtum verzit kell ltrehozni belle, hogy SCID 3 hasznlni tudja.

A feljts j verzit hoz ltre az adatbzisbl. Az eredeti fjlok srtetlenl megmaradnak.

Az eljrs eltarthat egy darabig, de csak egyszer kell elvgezni. Megszakthatod, ha tl sokig tart.

Szeretnd most feljtani ezt az adatbzist?
}

# Recent files options:
translate H RecentFilesMenu {Az aktulis fjlok szma a Fjl menben}
translate H RecentFilesExtra {Az aktulis fjlok szma a kiegszt almenben}

# My Player Names options:
translate H MyPlayerNamesDescription {
Add meg az ltalad kedvelt jtkosok nevt, soronknt egyet. Helyettest karaktereket (pl. "?" tetszleges karakter helyett, "*" tetszleges karaktersorozat helyett) is hasznlhatsz.

Amikor betltd egy a listn szerepl jtkos jtszmjt, a fablak sakktblja szksg esetn elfordul, hogy a jtszmt annak a jtkosnak a szemszgbl mutassa.
}

}

# Tips of the day in Hungarian

set tips(H) {
  {
    Scid-ben tbb mint 30 oldalnyi <a Index>segtsg</a> van, s a legtbb Scid-ablakban
    az <b>F1</b> billenty megnyomsra elbukkan egy arra az ablakra vonatkoz
    segt szveg.
  }
  {
    Egyes Scid-ablakoknak (pl. a jtszmainformcis terlet, az
    <a Switcher>adatbzisvlt</a>) jobbegrgombos menjk van.
    Nyomd meg a jobb egrgombot az egyes ablakokban, s megltod,
    hogy ott is van-e, s milyen lehetsgeket knl.
  }
  {
    Scid tbb lehetsget is knl lpsek bevitelre, amelyek
    kzl kedved szerint vlaszthatsz. Hasznlhatod az egeret
    (lpsjavaslattal vagy anlkl) vagy a billentyzetet
    (lpskiegsztssel vagy anlkl). Olvasd el a rszleteket a
    <a Moves>Lpsek bevitele</a> cm segtlapon.
  }
  {
    Ha bizonyos adatbzisokat gyakran hasznlsz, jelld meg ket egy-egy
    <a Bookmarks>knyvjelz</a> segtsgvel, s ezutn a knyvjelzmen
    tjn gyorsabban tudod megnyitni ket.
  }
  {
    A <a PGN>PGN-ablak</a> rvn az aktulis jtszma sszes
    lpst lthatod (elgazsokkal s megjegyzsekkel).
    A PGN-ablakban brmelyik lpshez elugorhatsz, ha rkattintasz a bal
    egrgombbal; a kzps vagy a jobb egrgomb hasznlatval pedig
    a lpshez tartoz llst tekintheted meg.
  }
  {
    A bal egrgomb rvn thzssal egyik adatbzisbl a msikba
    msolhatsz jtszmkat az <a Switcher>adatbzisvlt</a> ablakban.
  }
  {
    Scid meg tud nyitni PGN-fjlokat, mg akkor is, ha Gzip tjn
    tmrtve vannak (.gz fjlnv-kiterjesztssel). A megnyitott PGN-fjlok
    csak olvashatak, ezrt ha egy PGN-fjlt Scidben akarsz tszerkeszteni,
    hozz ltre j Scid-adatbzist, s az <a Switcher>adatbzisvlt</a>
    segtsgvel msold bele a PGN-fjl jtszmit.
  }
  {
    Ha egy nagy adatbzist gyakran hasznlsz a <a Tree>faszerkezet</a>-ablakkal,
    rdemes a <b>Cache-fjl feltltse</b> pontot vlasztani a faszerkezet-ablak
    Fjl menjbl. Ez megjegyzi sok gyakori megnyits faszerkezet-adatait,
    miltal gyorsabb lesz a hozzfrs az adatbzishoz.
  }
  {
    A <a Tree>faszerkezet</a>-ablak megmutatja az sszes lpst, amelyet
    az adott llsban tettek, de ha az sszes lpssorrendet ltni akarod,
    amely ehhez az llshoz vezetett, <a OpReport>megnyitsi sszefoglal</a>
    ltrehozsval megkaphatod.
  }
  {
    A <a GameList>jtszmk listja</a> ablakban egy oszlop fejlcre
    kattintva mdosthatod az oszlop szlessgt.
  }
  {
    A <a PInfo>jtkosinformci</a>-ablak segtsgvel (kinyitshoz
    egyszeren kattints valamelyik jtkos nevre a fablak sakktblja alatt
    tallhat jtszmainformcis terleten) knnyedn bellthat gy
    a <a Searches Filter>szr</a>, hogy bizonyos jtkos bizonyos eredmnnyel
    vgzdtt sszes jtszmjt tartalmazza. Ehhez csak a <red>piros szn</red>
    rtkek valamelyikre kell kattintani.
  }
  {
    Megnyits tanulmnyozsakor egy fontos llsban nagyon hasznos lehet a
    <a Searches Board>pozcikeress</a> <b>Gyalogok</b> vagy
    <b>Oszlopok</b> belltssal, mert ez megmutathatja,
    hogy mg mely megnyitsok vezetnek ugyanehhez a gyalogszerkezethez.
  }
  {
    Ha a jtszmainformcis terleten (a sakktbla alatt) megnyomod
    a jobb egrgombot, elbukkan egy men, amellyel testre szabhat. 
    Pldul megkrheted Scidet, hogy rejtse el a kvetkez lpst, ami
    edzsnl hasznos, ha egy jtszma lpseit ki akarod tallni.
  }
  {
    Ha gyakran vgzel <a Maintenance>gondozs</a>t nagy adatbzison,
    egyszerre hajthatsz vgre tbb gondozsi feladatot a
    <a Maintenance Cleaner>takart</a> segtsgvel.
  }
  {
    Ha nagy adatbzisod van, amelyben a legtbb jtszmnl az esemny ideje
    is fel van tntetve, s a jtszmkat id szerint szeretnd rendezni, vgezd
    a <a Sorting>rendezs</a>t az esemny ideje majd esemny szerint,
    s ne fordtva. gy ugyanannak a versenynek a klnbz keltezs jtszmi
    egytt fognak maradni (termszetesen csak akkor, ha mindegyiknl azonos
    az esemny keltezse).
  }
  {
    <a Maintenance Twins>Ikerjtszmk trlse</a> eltt clszer
    <a Maintenance Spellcheck>helyesrsellenrzs</a> al vetni
    az adatbzist, mert gy Scid tbb ikret tud megtallni s trlsre kijellni.
  }
  {
    <a Flags>Megjellsek</a> rvn az adatbzis jtszminak olyan
    jellegzetessgeit lehet kiemelni, amelyek alapjn ksbb keresst
    akarsz vgezni (gyalogszerkezet, taktikai motvum stb.).
    Megjellsekre <a Searches Header>keress fejlc alapjn</a> lehet
    keresni.
  }
  {
    Ha egy jtszmt tanulmnyozva szeretnl kiprblni lpseket
    a jtszma megvltoztatsa nlkl, egyszeren kapcsold be a
    Vltozat kiprblsa zemmdot (a <b>Ctrl+space</b>
    billentykombincival vagy az eszkztr ikonjval), majd kapcsold ki,
    ha vgeztl, s vissza akarsz trni az eredeti jtszmhoz.
  }
  {
    Ha meg akarod keresni egy adott llshoz vezet legkiemelkedbb
    jtszmkat (nagy rtkszm ellenfelek kztt), nyisd ki a
    <a Tree>faszerkezet</a>-ablakot, majd onnan nyisd ki a legjobb
    jtszmk listjt. Mg ezt a listt is szktheted, hogy csak
    meghatrozott eredmnnyel vgzd jtszmkat mutasson.
  }
  {
    Remekl lehet megnyitst tanulmnyozni nagy adatbzisra
    tmaszkodva oly mdon, hogy a <a Tree>faszerkezet</a>-ablakban
    bekapcsolod az edzst, majd az adatbzis ellen jtszva megnzheted,
    mely elgazsok fordulnak el gyakran.
  }
  {
    Ha kt adatbzisod van nyitva, s ltni szeretnd az els adatbzis
    <a Tree>faszerkezet</a>-adatait, mikzben a msiknak egyik
    jtszmjt tanulmnyozod, a <b>Rgzts</b> gomb megnyomsval
    rgztsd a ft az els adatbzishoz, majd vlts t a msikra.
  }
  {
    A <a Tmt>versenykeres</a> nemcsak arra val, hogy megkeress
    vele egy versenyt. Arra is hasznlhat, hogy megnzd, hogy egy jtkos
    mely versenyeken indult mostanban, vagy vgignzd egy adott orszgban
    rendezett legkiemelkedbb versenyeket.
  }
  {
    Az <a Searches Material>Anyag/szerkezet</a> keresablakban
    megtallhat nhny gyakran elfordul llsszerkezet, amely
    hasznos lehet megnyits vagy kzpjtk tanulmnyozsakor.
  }
  {
    Ha meghatrozott anyagi helyzetre keresel az
    <a Searches Material>Anyag/szerkezet</a> keresablakban, sokszor clszer
    a keresst olyan jtszmkra korltozni, amelyek tbb lpsen keresztl
    megfelelnek a feltteleknek. Ily mdon ki lehet zrni azokat a jtszmkat,
    amelyekben a keresett helyzet csak rvid ideig llt fenn.
  }
  {
    Ha egy fontos adatbzist nem szeretnl vletlenl megvltoztatni,
    megnyitsa utn vlaszd az <b>rsvdelem...</b> pontot a
    <b>Fjl</b> menbl, vagy lltsd t attribtumt csak olvashatra.
  }
  {
    Ha XBoardot vagy WinBoardot hasznlod (vagy ms olyan sakkprogramot,
    amely egy sakkllst szabvnyos FEN-jellssel a vglapra tud msolni),
    s t akarod msolni a rajta lv llst Scidbe, ennek leggyorsabb s
    legegyszerbb mdja az, hogy XBoard/WinBoard File menjbl
    <b>Copy Position</b> rvn, majd Scid Szerkeszts menjbl
    <b>Kezdlls beillesztse</b> tjn temeled az llst.
  }
  {
    <a Searches Header>Keress fejlc alapjn</a> esetben a
    jtkos-, esemny-, helyszn- s fordulnevek nem rzkenyek
    kis- vagy nagybet szempontjbl, s az egyezs nv belsejben is lehet.
    Ehelyett vgeztethetsz kis- vagy nagybet szempontjbl rzkeny
    dzskerkeresst is (ahol "?" = brmilyen karakter, "*" = esetleges
    tovbbi karakterek), ha a keresend szveget "idzjelben" adod meg.
    Pldul rj "*BEL"-t (idzjelekkel) a helysznmezbe, ha meg akarod tallni
    a Belgiumban jtszott jtszmkat, de a Belgrdban jtszottakat nem.
  }
  {
    Ha egy jtszmban helyesbteni akarsz egy lpst, de nem szeretnd,
    ha az t kvet lpsek elvesznnek, nyisd ki az <a Import>Import</a>
    ablakot, nyomd meg a <b>Beilleszti az aktulis jtszmt.</b> gombot,
    javtsd ki a tves lpst, majd nyomd meg az <b>Import</b> gombot.
  }
  {
    Ha van betltve ECO-osztlyoz fjlod, a <b>Jtszma</b> menbl
    <b>Megnyits azonostsa</b> tjn (gyorsbillenty: Ctrl+Shift+D)
    elugorhatsz az aktulis jtszmban elfordul legmlyebb osztlyozott llshoz.
    .
  }
  {
    Ha meg akarod nzni egy fjl mrett vagy utols mdostsnak
    idpontjt, mieltt megnyitnd, hasznld megnyitsra a
    <a Finder>fjlkeres</a>t.
  }
  {
    A <a Repertoire>repertor</a>fjl remek md kedvelt megnyitsaid
    nyilvntartsra, emellett meg lehet vele keresni azokat a jtszmkat,
    amelyekben e megnyitsok elfordultak. Ha megnyitsaidat repertorfjlban
    tartod, minden j jtszmagyjtemnyt tszrhetsz vele,
    s vgignzheted azokat a jtszmkat, amelyekben kedvelt megnyitsaid
    elfordulnak.
  }
  {
    A <a OpReport>megnyitsi sszefoglal</a> nagyszer lehetsget nyjt
    egy lls megismersre. Megnzheted, mennyire eredmnyes,
    gyakran vezet-e rvid dntetlenre, megmutatja a gyakran elfordul
    pozcis tmkat.
  }
  {
    A leghasznlatosabb rtkel jeleket (!, !?, += stb.) a
    <a Comment>megjegyzsszerkeszt<a> hasznlata nlkl,
    billentyzssel is hozz lehet fzni az aktulis lpshez vagy llshoz.
    Pldul "!", majd Enter letsvel be tudod szrni a "!" jelet.
    Bvebb ismertetst a <a Moves>Lpsek bevitele</a> cm segtlap
    nyjt.
  }
  {
    Ha egy adatbzis megnyitsai kztt <a Tree>faszerkezet</a> segtsgvel
    bngszel, hasznos sszefoglalt kaphatsz arrl, hogy a vizsglt megnyits
    milyen eredmnyes volt az utbbi idben ers jtkosok kztt. Ehhez nyisd ki
    a Statisztika ablakot (gyorsbillenty: Ctrl+I).
  }
  {
    Megvltoztathatod a fablak sakktbljnak mrett, ha a <b>Ctrl</b>
    s a <b>Shift</b> billentyk nyomva tartsa mellett megnyomod a
    <b>bal</b> vagy a <b>jobb</b> nyilat.
  }
  {
    <a Searches>Keress</a> utn knnyszerrel vgignzheted a tallt
    jtszmkat. Tartsd nyomva a <b>Ctrl</b> billentyt, s nyomd meg a
    <b>fel</b> vagy a <b>le</b> nyilat az elz vagy a kvetkez
    <a Searches Filter>szr</a>jtszma betltshez.
  }
}

# end of hungary.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 FileSwitch "Switch to database" 0 \
  {Switch to a different opened database} ;# ***
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 EditStripBegin "Moves from the beginning" 1 \
  {Strip moves from the beginning of the game} ;# ***
menuText Y EditStripEnd "Moves to the end" 0 \
  {Strip moves to the end of the game} ;# ***
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 EditPastePGN "Paste Clipboard text as PGN game..." 10 \
  {Interpret the clipboard text as a game in PGN notation and paste it here} ;# ***
menuText Y EditSetup "Namesti poetnu poziciju..." 0 \
  {Namesti poetnu poziciju za ovu partiju}
menuText Y EditCopyBoard "Copy position" 6 \
  {Copy the current board in FEN notation to the text selection (klipbord)} ;# ***
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 WindowsPList "Player Finder" 2 {Open/close the player finder} ;# ***
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 ToolsPlayerReport "Player Report..." 3 \
  {Generate a player report} ;# ***
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 OptionsBoard "Chessboard" 0 {Chess board appearance options} ;# ***
menuText Y OptionsBoardSize "Veliina table" 0 {Promeni veliinu table}
menuText Y OptionsBoardPieces "Board Piece Style" 6 \
  {Change the board piece style} ;# ***
menuText Y OptionsBoardColors "Boje" 0 {Promeni boje table}
menuText Y OptionsBoardNames "My Player Names..." 0 {Edit my player names} ;# ***
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 OptionsMovesAnimate "Animation time" 1 \
  {Set the amount of time used to animate moves} ;# ***
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 OptionsSounds "Sounds..." 2 {Configure move announcement sounds} ;# ***
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 HelpContents "Contents" 0 {Show the help contents page} ;# ***
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 GInfoPhotos "Show Photos" 5 ;# ***
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.stm {Turn the side-to-move icon on or off} ;# ***
helpMsg Y .button.autoplay {Automatski menjaj poteze  (taster: Ctrl+Z)}

# General buttons:
translate Y Back {Nazad}
translate Y Browse {Browse} ;# ***
translate Y Cancel {Poniti}
translate Y Clear {Oisti}
translate Y Close {Zatvori}
translate Y Contents {Contents} ;# ***
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 ShowIcons {Show Icons} ;# ***
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 AverageRating {Average Rating} ;# ***
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}
translate Y readonly {read-only} ;# ***

# Standard error messages:
translate Y ErrNotOpen {This is not an open database.} ;# ***
translate Y ErrReadOnly {This database is read-only; it cannot be altered.} ;# ***
translate Y ErrSearchInterrupted {Search was interrupted; results are incomplete.} ;# ***

# 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} ;# ***
translate Y PInfoEditRatings {Edit Ratings} ;# ***

# 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}
translate Y WinningMoves {Winning moves} ;# ***
translate Y DrawingMoves {Drawing moves} ;# ***
translate Y LosingMoves {Losing moves} ;# ***
translate Y UnknownMoves {Unknown-result moves} ;# ***

# 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}
# Note: the next message is the tree window title row. After editing it,
# check the tree window to make sure it lines up with the actual columns.
translate Y TreeTitleRow \
  {    Move   ECO       Frequency    Score  AvElo Perf AvYear %Draws} ;# ***
translate Y TreeTotal {UKUPNO}

# 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}

# Player finder:
menuText Y PListFile "Fajl" 0
menuText Y PListFileUpdate "Osvei" 0
menuText Y PListFileClose "Close Player Finder" 0 ;# ***
menuText Y PListSort "Sortiraj" 0
menuText Y PListSortName "Name" 0 ;# ***
menuText Y PListSortElo "Elo" 0
menuText Y PListSortGames "Partije" 0
menuText Y PListSortOldest "Oldest" 0 ;# ***
menuText Y PListSortNewest "Newest" 0 ;# ***

# 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} ;# ***
translate Y LowPriority {Low CPU priority} ;# ***

# 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 PgnFileCopy "Copy Game to Clipboard" 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 PgnOptBoldMainLine "Use Bold Text for Main Line Moves" 4 ;# ***
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
translate Y PgnWindowTitle {Game Notation - game %u} ;# ***

# 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}
translate Y Category {Category} ;# ***

# 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 OprepFavorites "Favorites" 1 ;# ***
menuText Y OprepFavoritesAdd "Add Report..." 0 ;# ***
menuText Y OprepFavoritesEdit "Edit Report Favorites..." 0 ;# ***
menuText Y OprepFavoritesGenerate "Generate Reports..." 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 EndSideToMove {Side to move at end of game} ;# ***
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 Description {Description} ;# ***
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:}
translate Y InsertMark {Insert mark} ;# ***
translate Y InsertMarkHelp {
Insert/remove mark: Select color, type, square.
Insert/remove arrow: Right-click two squares.
} ;# ***

# Nag buttons in comment editor:
translate Y GoodMove {Good move} ;# ***
translate Y PoorMove {Poor move} ;# ***
translate Y ExcellentMove {Excellent move} ;# ***
translate Y Blunder {Blunder} ;# ***
translate Y InterestingMove {Interesting move} ;# ***
translate Y DubiousMove {Dubious move} ;# ***
translate Y WhiteDecisiveAdvantage {White has a decisive advantage} ;# ***
translate Y BlackDecisiveAdvantage {Black has a decisive advantage} ;# ***
translate Y WhiteClearAdvantage {White has a clear advantage} ;# ***
translate Y BlackClearAdvantage {Black has a clear advantage} ;# ***
translate Y WhiteSlightAdvantage {White has a slight advantage} ;# ***
translate Y BlackSlightAdvantage {Black has a slight advantage} ;# ***
translate Y Equality {Equality} ;# ***
translate Y Unclear {Unclear} ;# ***
translate Y Diagram {Diagram} ;# ***

# 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}

# Common endings in material search:
translate Y EndingPawns {Pawn endings} ;# ***
translate Y EndingRookVsPawns {Rook vs. Pawn(s)} ;# ***
translate Y EndingRookPawnVsRook {Rook and 1 Pawn vs. Rook} ;# ***
translate Y EndingRookPawnsVsRook {Rook and Pawn(s) vs. Rook} ;# ***
translate Y EndingRooks {Rook vs. Rook endings} ;# ***
translate Y EndingRooksPassedA {Rook vs. Rook endings with a passed a-pawn} ;# ***
translate Y EndingRooksDouble {Double Rook endings} ;# ***
translate Y EndingBishops {Bishop vs. Bishop endings} ;# ***
translate Y EndingBishopVsKnight {Bishop vs. Knight endings} ;# ***
translate Y EndingKnights {Knight vs. Knight endings} ;# ***
translate Y EndingQueens {Queen vs. Queen endings} ;# ***
translate Y EndingQueenPawnVsQueen {Queen and 1 Pawn vs. Queen} ;# ***
translate Y BishopPairVsKnightPair {Two Bishops vs. Two Knights middlegame} ;# ***

# Common patterns in material search:
translate Y PatternWhiteIQP {White IQP} ;# ***
translate Y PatternWhiteIQPBreakE6 {White IQP: d4-d5 break vs. e6} ;# ***
translate Y PatternWhiteIQPBreakC6 {White IQP: d4-d5 break vs. c6} ;# ***
translate Y PatternBlackIQP {Black IQP} ;# ***
translate Y PatternWhiteBlackIQP {White IQP vs. Black IQP} ;# ***
translate Y PatternCoupleC3D4 {White c3+d4 Isolated Pawn Couple} ;# ***
translate Y PatternHangingC5D5 {Black Hanging Pawns on c5 and d5} ;# ***
translate Y PatternMaroczy {Maroczy Center (with Pawns on c4 and e4)} ;# ***
translate Y PatternRookSacC3 {Rook Sacrifice on c3} ;# ***
translate Y PatternKc1Kg8 {O-O-O vs. O-O (Kc1 vs. Kg8)} ;# ***
translate Y PatternKg1Kc8 {O-O vs. O-O-O (Kg1 vs. Kc8)} ;# ***
translate Y PatternLightFian {Light-Square Fianchettos (Bishop-g2 vs. Bishop-b7)} ;# ***
translate Y PatternDarkFian {Dark-Square Fianchettos (Bishop-b2 vs. Bishop-g7)} ;# ***
translate Y PatternFourFian {Four Fianchettos (Bishops on b2,g2,b7,g7)} ;# ***

# 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 EnPassantFile {En Passant 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 OprepMostFrequentOpponents {Most frequent opponents} ;# ***
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 OprepMostFrequentEcoCodes {Most frequent ECO codes} ;# ***
translate Y OprepThemes {Pozicione teme}
translate Y OprepThemeDescription {Frequency of themes in the first %u moves of each game} ;# ***
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 OprepThemeWIQP {White Isolated Queen Pawn} ;# ***
translate Y OprepThemeBIQP {Black Isolated Queen Pawn} ;# ***
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}
translate Y OprepViewHTML {View HTML} ;# ***
translate Y OprepViewLaTeX {View LaTeX} ;# ***

# Player Report:
translate Y PReportTitle {Player Report} ;# ***
translate Y PReportColorWhite {with the White pieces} ;# ***
translate Y PReportColorBlack {with the Black pieces} ;# ***
translate Y PReportMoves {after %s} ;# ***
translate Y PReportOpenings {Openings} ;# ***
translate Y PReportClipbase {Empty clipbase and copy matching games to it} ;# ***

# 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
 [::utils::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.
}

# Sounds configuration:
translate Y SoundsFolder {Sound Files Folder} ;# ***
translate Y SoundsFolderHelp {The folder should contain the files King.wav, a.wav, 1.wav, etc} ;# ***
translate Y SoundsAnnounceOptions {Move Announcement Options} ;# ***
translate Y SoundsAnnounceNew {Announce new moves as they are made} ;# ***
translate Y SoundsAnnounceForward {Announce moves when moving forward one move} ;# ***
translate Y SoundsAnnounceBack {Announce when retracting or moving back one move} ;# ***

# 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} ;# ***

# My Player Names options:
translate Y MyPlayerNamesDescription {
Enter a list of preferred player names below, one name per line. Wildcards (e.g. "?" for any single character, "*" for any sequence of characters) are permitted.

Every time a game with a player in the list is loaded, the main window chessboard will be rotated if necessary to show the game from that players perspective.
} ;# ***

}
# end of serbian.tcl
# end.tcl: part of Scid.
# Copyright (C) 2000-2003 Shane Hudson.

############################################################
### Main window title, etc:



############################################################
### Menu/etc Functions:


# 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
  dialogbutton $w.b.stop -textvar ::tr(Stop) -state disabled \
    -command sc_progressBar
  dialogbutton $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
  }
  dialogbutton $w.b.close -textvar ::tr(Close) -command {
    catch {destroy .noveltyWin}
  }
  packbuttons right $w.b.close $w.b.go $w.b.stop
  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 [::utils::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 [::utils::string::Capital $::tr(all)] \
    -variable merge(ply) -value 1000 -indicatoron 0 -padx 2 -pady 1 \
    -font $small -command updateMergeGame
  pack $w.b.all -side left
  dialogbutton $w.b.ok -text "OK" -command {
    sc_game merge $merge(base) $merge(gnum) $merge(ply)
    catch {grab release .mergeDialog}
    destroy .mergeDialog
    updateBoard -pgn
  }
  dialogbutton $w.b.cancel -text $::tr(Cancel) \
    -command "catch {grab release $w}; destroy $w"
  packbuttons right $w.b.cancel $w.b.ok
  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 [::utils::pane::Create $w.pane start end 500 400]
  ::utils::pane::SetRange $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)
  "
  dialogbutton $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
  "
  dialogbutton $w.buttons.cancel -text $::tr(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+nKV0UoUvgvlfhmb2x2FI
JsL505hPDmjjoDx1qeWWEyK655d6tunMNGbt5N2kaF0Wlop7DejnX9qRJGWj++TnJpMUhVPf
bJhBOqehWqompmmQgbejT8Bgkup4s8aZ2pU71VGYK4xVp8qqLAJriREXw1LqpaV0xXeoqJ4C
Uuyuz2g62KvL5tnqmb8uhhS128Imra03iZvtsz2xikU8CFLInXkqvVsavZwyekKZTcArZ5Pt
6vutvf3GBjC7VrRX1HMKR8fwwg4bo26+/Eq4729FCUyxHEPcO7FpFtvSscC8DJExx9vI+3G/
JfNK1ncqh4zybyuvLEEBADs=
}

image create photo htmldiag1 -data {
R0lGODdhbgBkAIQAAAAAAAsLCxYWFiAgICsrKzY2NkBAQEtLS1VVVWBgYGtra3V1dYCAgIuL
i5WVlaCgoKqqqrW1tcDAwMrKytXV1eDg4Orq6vX19f//////////////////////////////
/ywAAAAAbgBkAAAF/iAmjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgsGo/IJBGAYTqb0Kc0
Sp1aq9irNst9vphLkYWAEFEEkFGEIkIQLJhxGUMhsDGQ9wis7MnNaCducH90diJ5cBgVQ3xC
AIVnaSMLiHqRh3h6GAgNUCsRBgd3NRIAp3ymqKcMe6gSKQdzkiIScAYKJJh3iW1zLBWoAzGO
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FwXUqwoALiCACbmrAJJrCJwq0tote/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"
  bind $w <F1> {helpWindow Export}

  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

  # Extra option for PGN format: handling of null moves
  if {$exportType == "PGN"} {
    label $w.o.space -text ""
    grid $w.o.space -row 8 -column 0 -sticky w
    label $w.o.nullMoves -text "Convert null moves to comments"
    radiobutton $w.o.convertNullMoves -text $::tr(Yes) \
      -variable exportFlags(convertNullMoves) -value 1
    radiobutton $w.o.keepNullMoves -text $::tr(No) \
      -variable exportFlags(convertNullMoves) -value 0
    grid $w.o.nullMoves -row 9 -column 0 -sticky w
    grid $w.o.convertNullMoves -row 9 -column 1 -sticky w
    grid $w.o.keepNullMoves -row 9 -column 2 -sticky w
  }

  # Extra option for HTML format: diagram image set
  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
  dialogbutton $w.b.ok -text "OK" -command {
    set exportFlags(ok) 1
  }
  dialogbutton $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 ::pgn::moveNumberSpaces 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 $::pgn::moveNumberSpaces -symbols $exportFlags(symbols) \
    -indentC $exportFlags(indentc) -indentV $exportFlags(indentv) \
    -column $exportFlags(column) -noMarkCodes $exportFlags(stripMarks) \
    -convertNullMoves $exportFlags(convertNullMoves)
  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
  dialogbutton $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
  "
  dialogbutton $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  ::utils::validate::Result
trace variable whiteElo w {::utils::validate::Integer [sc_info limit elo] 0}
trace variable blackElo w {::utils::validate::Integer [sc_info limit elo] 0}
trace variable year w {::utils::validate::Integer [sc_info limit year] 1}
trace variable month w {::utils::validate::Integer 12 1}
trace variable day w {::utils::validate::Integer 31 1}
trace variable eyear w {::utils::validate::Integer [sc_info limit year] 1}
trace variable emonth w {::utils::validate::Integer 12 1}
trace variable eday w {::utils::validate::Integer 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 {::utils::validate::Integer [sc_info limit elo] 0}
trace variable editName w { updateMatchList .nedit.g.list "" 9 }
trace variable editDate w ::utils::validate::Date
trace variable editDateNew w ::utils::validate::Date

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
    }
  radiobutton $w.typeButtons.edate -textvar ::tr(EventDate) \
    -variable editNameType -value edate -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 $w.typeButtons.edate \
    -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
    grid $w.selectButtons.$i -row $row -column 0 -sticky w
  }

  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"  ||  $editNameType == "edate"} {
      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
    updateBoard -pgn
    ::windows::gamelist::Refresh
  }

  dialogbutton $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.label$name -textvar $textname
  entry .save.g.entry$name -width 30 -background white -relief sunken \
    -textvariable $name
  grid .save.g.label$name -row $row -column 0 -sticky w
  grid .save.g.entry$name -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 ::utils::date::calendar -command {
    set newdate [::utils::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 [::utils::date::today year]
    set month [::utils::date::today month]
    set day [::utils::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 ::utils::date::calendar -command {
    set newdate [::utils::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 {entryevent entrysite dateyear datemonth dateday \
               entryround entrywhite entryblack resentry \
               weloentry beloentry ecoentry edateyear edatemonth edateday} {
    bind $f.$i <Return> {.save.buttons.save invoke}
    # 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} {entryevent "event" entrysite "site"
      entrywhite "white" entryblack "black"
      entryround "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 {
    }
  }
  dialogbutton .save.buttons.save -textvar ::tr(Save) -underline 0 -command {
    set extraTags [.save.extra.text get 1.0 end-1c]
    gsave $gsaveNum;
    destroy .save
  }

  dialogbutton .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
  }
  packbuttons right .save.buttons.cancel .save.buttons.save

  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; }
  ::utils::win::Centre .save
  focus .save.g.entryevent
  .save.g.entryevent selection range 0 end
  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
  }
  updateBoard -pgn
  ::windows::gamelist::Refresh
  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 $::scidVersion, $::scidVersionDate\n"
  append str "Using Tcl/Tk version: [info patchlevel]\n\n"
  append str "Author: Shane Hudson\n"
  append str "Email: sgh@users.sourceforge.net\n"
  append str "Website: scid.sourceforge.net\n\n"
  append str "Copyright (C) Shane Hudson 1999-2003.\n\n"
  append str "Scid is freeware, but you are welcome to make "
  append str "a small donation for it.\n"
  append str "See the Scid website for details."
  set asserts [sc_info asserts]
  if {$asserts > 0} {
    append str "\n\n[::utils::thousands $asserts] asserts tested."
  }
  tk_messageBox -title "About Scid" -message $str -type ok
}



############################################################
#### 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 !; updateBoard -pgn"
bind . <exclam><exclam><Return> "sc_pos addNag !!; updateBoard -pgn"
bind . <exclam><question><Return> "sc_pos addNag !?; updateBoard -pgn"
bind . <question><Return> "sc_pos addNag ?; updateBoard -pgn"
bind . <question><question><Return> "sc_pos addNag ??; updateBoard -pgn"
bind . <question><exclam><Return> "sc_pos addNag ?!; updateBoard -pgn"

bind . <plus><minus> "sc_pos addNag +-; updateBoard -pgn"
bind . <plus><slash> "sc_pos addNag +/-; updateBoard -pgn"
bind . <plus><equal> "sc_pos addNag +=; updateBoard -pgn"
bind . <equal><Return> "sc_pos addNag =; updateBoard -pgn"
bind . <minus><plus> "sc_pos addNag -+; updateBoard -pgn"
bind . <minus><slash> "sc_pos addNag -/+; updateBoard -pgn"
bind . <equal><plus> "sc_pos addNag =+; updateBoard -pgn"
bind . <asciitilde><Return> "sc_pos addNag ~; updateBoard -pgn"
bind . <asciitilde><equal><Return> "sc_pos addNag ~=; updateBoard -pgn"

# Null move entry:
bind . <minus><minus> "addMove null null"

# Arrow keys, Home and End:
bind . <Home> ::move::Start
bind . <Up> {::move::Back 10}
bind . <Left> ::move::Back
bind . <Down> {::move::Forward 10}
bind . <Right> ::move::Forward
bind . <End> ::move::End

bind . <period> {if {!$tree(refresh)} {toggleRotateBoard}}

# MouseWheel in main window:
bind . <MouseWheel> {
  if {[expr -%D] < 0} { ::move::Back }
  if {[expr -%D] > 0} { ::move::Forward }
}
bind . <Shift-MouseWheel> {
    if {[expr -%D] < 0} { ::move::Back 10 }
    if {[expr -%D] > 0} { ::move::Forward 10}
}
if {! $windowsOS} {
  bind . <Button-4> ::move::Back
  bind . <Button-5> ::move::Forward
  bind . <Shift-Button-4> {::move::Back 10}
  bind . <Shift-Button-5> {::move::Forward 10}
}


############################################################
### Packing the main window:


label .statusbar -textvariable statusBar -relief sunken -anchor w -width 1 \
  -font font_Small
grid .statusbar -row 4 -column 0 -columnspan 3 -sticky we
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 }
  }
  updateBoard -pgn
  updateTitle
  updateMenuStates
  updateStatusBar
  ::windows::gamelist::Refresh
}

#frame .sep -width 2 -borderwidth 2 -relief groove
#frame .panels
#grid .boardframe -row 1 -column 0 -columnspan 3 -sticky news
#grid .sep -row 1 -column 1 -rowspan 3 -sticky ns -padx 4
#grid .panels -row 1 -column 2 -rowspan 3 -sticky news -pady 2
grid columnconfigure . 0 -weight 1
grid rowconfigure . 3 -weight 1

grid .button -row 1 -column 0 -pady 5 -padx 5

grid .board -row 2 -column 0 -sticky we -padx 5 -pady 5


grid .gameInfoFrame -row 3 -column 0 -sticky news -padx 2

#set p .panels
#::utils::pane::Create $p.pane top bottom 200 100 0.3
#pack $p.pane -side top -fill both -expand yes
#label $p.pane.top.db -font font_Bold -foreground white -background darkBlue -text "Databases" -anchor w
#pack $p.pane.top.db -side top -fill x
#autoscrollframe -bars y $p.pane.top.f canvas $p.pane.top.f.c
#pack $p.pane.top.f -side top -fill both -expand yes

#label $p.pane.bottom.title -font font_Bold -foreground white -background darkBlue -text "Notation" -anchor w
#pack $p.pane.bottom.title -side top -fill x
#autoscrollframe -bars y $p.pane.bottom.f text $p.pane.bottom.f.text -width 0 
#pack $p.pane.bottom.f -side top -fill both -expand yes
#::htext::init $p.pane.bottom.f.text

#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" {
          ::splash::add "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 {
          ::splash::add "Warning: unknown option: \"$arg\""
        }
      }
    } else {
      # Seen first non-option argument:
      return
    }
  }
}

getCommandLineOptions


setLanguage $language

updateTitle
updateBoard
updateStatusBar
update idle

# Try to find tablebases:
if {$loadAtStart(tb)} {
  if {[sc_info tb]} {
    ::splash::add "Checking for endgame tablebase files..."
    set tbDirs {}
    foreach i {1 2 3 4} {
      if {$initialDir(tablebase$i) != ""} {
        if {$tbDirs != ""} { append tbDirs ";" }
        append tbDirs [file nativename $initialDir(tablebase$i)]
      }
    }
    set result 0
    if {$tbDirs != ""} {
      set result [sc_info tb $tbDirs]
    }
    if {$result == 0} {
      ::splash::add "    No tablebases were found."
    } else {
      ::splash::add "    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)} {
  ::splash::add "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
      ::splash::add "    Unable to open the ECO file: $ecoFile"
    } else {
      ::splash::add "    ECO file \"./scid.eco\" loaded: $result positions."
    }
  } else {
    ::splash::add "    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]} {
    #::splash::add "Unable to load the default spellcheck file: $spellCheckFile"
  } else {
    ::splash::add "Spellcheck file \"[file tail $spellCheckFile]\" loaded:"
    ::splash::add "    [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]} {
    ::splash::add "Opening EPD file: $startbase..."
    if {![newEpdWin openSilent $startbase]} {
      ::splash::add "   Error opening EPD file: $startbase"
    }
    set initialDir(epd) [file dirname $startbase]
  } elseif {[string match "*.sor" $startbase]} {
    ::splash::add "Opening repertoire file: $startbase..."
    if {[catch {::rep::OpenWithFile $startbase} err]} {
      ::splash::add "Error opening $startbase: $err"
    }
  } else {
    busyCursor .
    ::splash::add "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} {
      ::splash::add "   Error: could not open database \"$startbase\":\n  $errMessage"
    } else {
      ::splash::add "   Database \"$startbase\" opened: [sc_base numGames] games."
      set initialDir(base) [file dirname $startbase]
      catch {sc_game load auto}
      flipBoardForPlayerNames $::myPlayerNames
    }
  }
  unbusyCursor .
  incr argc -1
  set argv [lrange $argv 1 end]
}

::splash::add "\nStartup completed."
::splash::add "Scid has over 35 online help pages; just press F1 for help!"
setWinLocation .
wm deiconify .
wm protocol . WM_DELETE_WINDOW { ::file::Exit }

if {$startup(switcher)} { ::windows::switcher::Open }
if {$startup(pgn)} { ::pgn::OpenClose }
if {$startup(gamelist)} { ::windows::gamelist::Open }
if {$startup(tree)} { ::tree::make }
if {$startup(stats)} { ::windows::stats::Open }
if {$startup(crosstable)} { crosstabWin }
if {$startup(finder)} { ::file::finder::Open }


updateBoard
updateStatusBar
updateTitle
updateLocale
update
bind . <Configure> "recordWinSize ."

# 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 .plist \
               .rgraph .sgraph .importWin .helpWin .tipsWin} {
    if {[winfo exists $w]} { catch {wm $type $w} }
  }
}

proc raiseAllWindows {} {
  # Don't do this if auto-raise option is turned off:
  if {! $::autoRaise} { return }
  foreach w {.baseWin .glistWin .pgnWin .tourney .maintWin \
               .ecograph .crosstabWin .treeWin .analysisWin1 .anslysisWin2 \
               .playerInfoWin .commentWin .repWin .statsWin .tbWin \
               .sb .sh .sm .noveltyWin .emailWin .oprepWin .plist \
               .rgraph .sgraph .importWin .helpWin .tipsWin} {
    if {[winfo exists $w]} { catch {raise $w} }
  }
}

# Bind double-click in main Scid window to raise all Scid windows:
bind . <Double-Button-1> raiseAllWindows

# Hack to extract gif images out of Scid:
#
if {1} {
  proc dumpGifImages {dir} {
    package require base64
    file mkdir $dir
    set images [image names]
    foreach i $images {
      set data [string trim [$i cget -data]]
      if {$data == ""} { continue }
      if {[catch {set d [::base64::decode $data]}]} { continue }
      regsub -all {:} $i {_} i
      set fname [file join $dir $i.gif]
      set f [open $fname w]
      fconfigure $f -translation binary -encoding binary
      puts -nonewline $f $d
      close $f
    }
  }

  bind . <Control-Shift-F7> {dumpGifImages C:/TEMP/ScidImages}
}


if {$startup(tip)} { ::tip::show }

after 500 {
  if {$::splash::autoclose} {wm withdraw .splash}
}


### End of file: end.tcl
