Scid  4.7.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
options.tcl
Go to the documentation of this file.
1 # Scid (Shane's Chess Information Database)
2 #
3 # Copyright (C) 1999-2004 Shane Hudson
4 # Copyright (C) 2006-2009 Pascal Georges
5 # Copyright (C) 2008-2011 Alexander Wagner
6 # Copyright (C) 2013-2015 Fulvio Benini
7 #
8 # Scid is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation.
11 
12 
13 ####################################################
14 # Set default values
15 
16 proc InitDefaultToolbar {} {
17  foreach {tbicon status} {
18  newdb 0 open 0 save 0 closedb 0
19  finder 0 bkm 0 gprev 0 gnext 0
20  newgame 0 copy 0 paste 0
21  boardsearch 0 headersearch 0 materialsearch 0
22  switcher 0 glist 0 pgn 0 tmt 0 maint 0 eco 0 tree 0 crosstab 0 engine 0
23  } {
24  set ::toolbar_state($tbicon) $status
25  }
26 }
27 
28 proc InitWinsDefaultGeometry {} {
29  global winWidth winHeight
30 
31  # Default window size:
32  set winWidth(.) 1024
33  set winHeight(.) 570
34 
35  # Default help window size:
36  set winWidth(.helpWin) 50
37  set winHeight(.helpWin) 32
38 
39  # Default stats window size:
40  set winWidth(.statsWin) 60
41  set winHeight(.statsWin) 13
42 
43  # Default spellcheck results window size:
44  set winWidth(.spellcheckWin) 55
45  set winHeight(.spellcheckWin) 25
46 
47  # Default Correspondence Chess window size:
48  set winWidth(.ccWindow) 10
49  set winHeight(.ccWindow) 20
50 
51  # List of saved layouts : 3 slots available
52  set ::docking::layout_list(1) {}
53  set ::docking::layout_list(2) {{MainWindowGeometry 540x650+0+0} {{.pw vertical {}} {TNotebook .nb .fdockmain}}}
54  set ::docking::layout_list(3) {{MainWindowGeometry 1024x532+0+0} {{.pw vertical {}} {TPanedwindow {{.pw.pw0 horizontal 413} {TNotebook .nb .fdockmain} {TPanedwindow {{.pw.pw0.pw1 vertical 270} {TNotebook .tb2 {.fdockanalysisWin1 .fdockpgnWin}} {TNotebook .tb3 .fdockglistWin1}}}}}}}
55  set ::docking::layout_list(auto) {{MainWindowGeometry 1024x532+0+0} {{.pw vertical {}} {TPanedwindow {{.pw.pw0 horizontal 413} {TNotebook .nb .fdockmain} {TPanedwindow {{.pw.pw0.pw1 vertical 270} {TNotebook .tb2 {.fdockanalysisWin1 .fdockpgnWin}} {TNotebook .tb3 .fdockglistWin1}}}}}}}
56 }
57 
58 proc InitDefaultStats {} {
59  # Default stats window lines:
60  array set ::windows::stats::display {
61  r2600 1
62  r2500 1
63  r2400 1
64  r2300 1
65  r2200 0
66  r2100 0
67  r2000 0
68  y1900 0
69  y1950 0
70  y1960 0
71  y1970 0
72  y1980 0
73  y1990 0
74  y1995 0
75  y2000 1
76  y2002 1
77  y2004 1
78  y2006 1
79  y2007 1
80  y2008 1
81  }
82 
83  # Enable stats for subsequent years
84  for { set year [clock format [clock seconds] -format {%Y}]} \
85  { $year>2008 && ![info exists ::windows::stats::display([subst {y$year}])] } \
86  { incr year -1} {
87  set ::windows::stats::display([subst {y$year}]) 1
88  }
89 }
90 
91 proc InitDefaultFonts {} {
92  global fontOptions
93  if {$::windowsOS} {
94  set fontOptions(Regular) [list Tahoma 10 normal roman]
95  set fontOptions(Menu) [list system 9 normal roman]
96  set fontOptions(Small) [list Tahoma 8 normal roman]
97  set fontOptions(Tiny) [list Arial 7 normal roman]
98  set fontOptions(Fixed) [list courier 9 normal roman]
99  } elseif {$::macOS} {
100  set fontOptions(Regular) [list system 11 normal roman]
101  set fontOptions(Menu) [list menu 14 normal roman]
102  set fontOptions(Small) [list system 10 normal roman]
103  set fontOptions(Tiny) [list system 9 normal roman]
104  set fontOptions(Fixed) [list Monaco 10 normal roman]
105  } else {
106  set fontOptions(Regular) [list {DejaVu Sans} 10 normal roman]
107  set fontOptions(Menu) [list {DejaVu Sans} 10 normal roman]
108  set fontOptions(Small) [list {DejaVu Sans} 9 normal roman]
109  set fontOptions(Tiny) [list {DejaVu Sans} 8 normal roman]
110  set fontOptions(Fixed) [list {DejaVu Sans Mono} 10 normal roman]
111  }
112 }
113 
114 proc InitDefaultGListLayouts {} {
115  set ::glist_Layouts {RatingDate DateEvent Full}
116  set ::glist_ColOrder(RatingDate) {{7} {1} {2} {3} {4} {5} {6} {23} {22} {8} {9} {10} {11} {12} {13} {14} {15} {16} {0}}
117  set ::glist_ColWidth(RatingDate) {{50} {50} {50} {120} {40} {120} {40} {80} {200} {30} {200} {30} {20} {20} {20} {20} {35} {50} {30} {100} {40} {40} {50} {140}}
118  set ::glist_ColAnchor(RatingDate) {{e} {c} {c} {w} {c} {w} {c} {w} {w} {e} {w} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {w}}
119  set ::glist_Sort(RatingDate) { {22} {-} {7} {-} }
120  set ::glist_FindBar(RatingDate) 0
121  set ::glist_ColOrder(DateEvent) {7 3 4 5 6 1 23 8 9 10 0}
122  set ::glist_ColWidth(DateEvent) {50 50 50 120 40 120 40 80 145 30 112 30 20 20 20 20 35 50 30 100 40 40 50 153}
123  set ::glist_ColAnchor(DateEvent) {{e} {c} {c} {w} {c} {w} {c} {w} {w} {e} {w} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {w}}
124  set ::glist_Sort(DateEvent) {7 - 8 - 9 -}
125  set ::glist_FindBar(DateEvent) 0
126  set ::glist_ColOrder(Full) {20 7 3 4 5 6 1 2 23 8 19 10 9 16 17 22 21 18 11 12 13 14 15 0}
127  set ::glist_ColWidth(Full) {50 50 39 120 40 120 40 70 200 30 200 30 20 20 20 20 35 119 30 78 40 40 50 155}
128  set ::glist_ColAnchor(Full) {{e} {c} {c} {w} {c} {w} {c} {w} {w} {e} {w} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {c} {w}}
129  set ::glist_Sort(Full) {0 +}
130  set ::glist_FindBar(Full) 0
131 }
132 
138 
139 #Default textures for lite and dark squares
140 set boardfile_dark "LightWood3-d"
141 set boardfile_lite "LightWood3-l"
142 
143 # boardSize: Default board size.
144 set boardSize 40
145 
146 # boardStyle: Default board piece set.
147 set boardStyle Merida1
148 if { $macOS } { set boardStyle Merida}
149 
150 # Colors: dark and lite are square colors
151 # whitecolor/blackcolor are piece colors
152 # highcolor is the color when something is selected.
153 # bestcolor is used to indicate a suggested move square.
154 # set dark "\#70a070"
155 # set lite "\#e0d070"
156 set lite "\#f3f3f3"
157 set dark "\#7389b6"
158 set whitecolor "\#ffffff"
159 set blackcolor "\#000000"
160 set whiteborder "\#000000"
161 set blackborder "\#ffffff"
162 set highcolor "\#b0d0e0"
163 set bestcolor "\#bebebe"
164 set buttoncolor "\#b0c0d0"
165 set borderwidth 0
166 
167 # Square markers color and type
168 set ::markColor green
169 set ::markType full
170 
171 # boardCoords: 1 to show board Coordinates, 0 to hide them.
172 set boardCoords 0
173 
174 # autoResizeBoard:
175 # resize the board to fit the container
176 set autoResizeBoard 1
177 
178 # showGameInfo:
179 # The game info panel below the main board
180 set showGameInfo 0
181 
182 # language for help pages and messages:
183 set language E
184 
185 # Default theme
186 set ::lookTheme "default"
187 set ::ThemePackageFile ""
188 
189 # Auto-save options when exiting:
190 set optionsAutoSave 1
191 
192 # Numeric locale: first char is decimal, second is thousands.
193 # Example: ".," for "1,234.5" format; ",." for "1.234,5" format.
194 set locale(numeric) ".,"
195 
196 # Ask for piece translations (first letter)
197 set translatePieces 1
198 
199 # Highlight the last move played
200 set arrowLastMove 0
201 set highlightLastMove 1
202 set highlightLastMoveWidth 2
203 set highlightLastMoveColor "grey"
204 set highlightLastMovePattern {} ; # this option is not saved
205 
206 # Gloss Of Danger
207 set glossOfDanger 0
208 
209 # Ask before replacing existing moves: on by default
210 set askToReplaceMoves 1
211 
212 # Show suggested moves: on by default
213 set suggestMoves 1
214 
215 # Show variations popup window
216 set showVarPopup 0
217 set showVarArrows 1
218 
219 # Keyboard Move entry options:
220 set moveEntry(On) 1
221 set moveEntry(AutoExpand) 0
222 set moveEntry(Coord) 1
223 
224 # windowsDock:
225 # if true, most of toplevel windows are dockable and embedded in a main window
226 # windows can be moves among tabs (drag and drop) or undocked (right-clicking on tab)
227 set windowsDock 1
228 
229 
230 set ::tactics::analysisTime 3
231 
232 set ::tacgame::threshold 0.9
233 set ::tacgame::blunderwarning false
234 set ::tacgame::blunderwarningvalue 0.0
235 set ::tacgame::levelMin 1200
236 set ::tacgame::levelMax 2200
237 set ::tacgame::levelFixed 1500
238 set ::tacgame::randomLevel 0
239 set ::tacgame::isLimitedAnalysisTime 1
240 set ::tacgame::showblunder 1
241 set ::tacgame::showblundervalue 1
242 set ::tacgame::showblunderfound 1
243 set ::tacgame::showmovevalue 1
244 set ::tacgame::showevaluation 1
245 set ::tacgame::isLimitedAnalysisTime 1
246 set ::tacgame::analysisTime 10
247 set ::tacgame::openingType new
248 set ::tacgame::chosenOpening 0
249 
250 # Analysis command: to start chess analysis engine.
251 set analysisCommand ""
252 if {$windowsOS} {
253  set analysisChoices {wcrafty.exe}
254 } else {
255  set analysisChoices {crafty}
256 }
257 
258 # Default Tree sort method:
259 set tree(order) frequency
260 
261 ### Tree/mask options:
262 set ::tree::mask::recentMask {}
263 
264 # Defaults for the PGN window:
265 # if ::pgn::showColor is 1, the PGN text will be colorized.
266 set ::pgn::showColor 1
267 set ::pgn::indentVars 1
268 set ::pgn::indentComments 1
269 set ::pgn::symbolicNags 1
270 set ::pgn::moveNumberSpaces 0
271 set ::pgn::shortHeader 1
272 set ::pgn::boldMainLine 1
273 set ::pgn::columnFormat 0
274 set ::pgn::stripMarks 0
275 set ::pgn::showPhoto 1
276 set pgnColor(Header) "\#00008b"
277 set pgnColor(Main) "\#000000"
278 set pgnColor(Var) "\#0000ee"
279 set pgnColor(Nag) "\#ee0000"
280 set pgnColor(Comment) "\#008b00"
281 set pgnColor(Current) lightSteelBlue
282 set pgnColor(Background) "\#ffffff"
283 
284 # Defaults for FICS
285 set ::fics::use_timeseal 0
286 set ::fics::timeseal_exec "timeseal"
287 set ::fics::port_fics 5000
288 set ::fics::port_timeseal 5001
289 set ::fics::login ""
290 set ::fics::password ""
291 set ::fics::usedefaultvars 1
292 set ::fics::findopponent(initTime) 15
293 set ::fics::findopponent(incTime) 20
294 set ::fics::findopponent(rated) "rated"
295 set ::fics::findopponent(color) ""
296 set ::fics::findopponent(limitrating) 1
297 set ::fics::findopponent(rating1) 1500
298 set ::fics::findopponent(rating2) 3000
299 set ::fics::findopponent(manual) "auto"
300 set ::fics::findopponent(formula) ""
301 set ::fics::consolebg black
302 set ::fics::consolefg LimeGreen
303 set ::fics::consoleheight 10
304 set ::fics::consolewidth 40
305 set ::fics::colseeking coral
306 set ::fics::colgame grey70
307 set ::fics::colgameresult SlateBlue1
308 set ::fics::colficspercent khaki1
309 set ::fics::colficshelpnext blue
310 set ::fics::server_ip "0.0.0.0"
311 set ::fics::premoveEnabled 1
312 set ::fics::playing 0
313 
314 # default resolvers for player info
315 set ::pinfo::wikipAPI "http://de.wikipedia.org/w/api.php?action=query&format=xml"
316 # Appers PND resolver
317 set ::pinfo::wikipurl "http://toolserver.org/~apper/pd/person/pnd-redirect"
318 # SeeAlso resolver for PND -> WikiPedia
319 set ::pinfo::SeeAlsoPND2WP "http://ws.gbv.de/seealso/pnd2wikipedia/?format=seealso&id="
320 # Deutsche NationalBibliothek
321 set ::pinfo::dnburl "http://d-nb.info/gnd"
322 # all other ID resolvers come from [scidConfigFile resolvers]
323 
324 # Defaults for Novag Citrine
325 set ::novag::referee "OFF"
326 
327 # Defaults for serious game training
328 set ::sergame::isOpening 0
329 set ::sergame::chosenOpening 0
330 set ::sergame::chosenEngine 0
331 set ::sergame::useBook 1
332 set ::sergame::bookToUse ""
333 set ::sergame::startFromCurrent 0
334 set ::sergame::coachIsWatching 0
335 set ::sergame::timeMode "timebonus"
336 set ::sergame::depth 3
337 set ::sergame::movetime 0
338 set ::sergame::nodes 10000
339 set ::sergame::ponder 0
340 set ::uci::uciInfo(wtime3) [expr 5 * 60 * 1000]
341 set ::uci::uciInfo(winc3) [expr 10 * 1000]
342 set ::uci::uciInfo(btime3) [expr 5 * 60 * 1000]
343 set ::uci::uciInfo(binc3) [expr 10 * 1000]
344 
345 # Defaults for initial directories:
346 set initialDir(base) "."
347 set initialDir(pgn) "."
348 set initialDir(book) "."
349 set initialDir(html) "."
350 set initialDir(tex) "."
351 set initialDir(stm) "."
352 set initialDir(report) "."
353 set initialDir(tablebase1) ""
354 set initialDir(tablebase2) ""
355 set initialDir(tablebase3) ""
356 set initialDir(tablebase4) ""
357 
358 # Default PGN display options:
359 set pgnStyle(Tags) 1
360 set pgnStyle(Comments) 1
361 set pgnStyle(Vars) 1
362 
363 # Autoplay and animation delays in milliseconds:
364 set autoplayDelay 5000
365 set animateDelay 200
366 set autoplayMode 0
367 
368 # Blunder Threshold
369 set blunderThreshold 1.0
370 
371 # Geometry of windows:
372 array set geometry {}
373 
374 # startup:
375 # Stores which windows should be opened on startup.
376 set startup(tip) 1
377 set startup(finder) 0
378 set startup(stats) 0
379 
380 
381 # Game information area options:
382 set gameInfo(photos) 1
383 set gameInfo(hideNextMove) 0
384 set gameInfo(showMaterial) 0
385 set gameInfo(showFEN) 0
386 set gameInfo(showMarks) 1
387 set gameInfo(wrap) 0
388 set gameInfo(fullComment) 0
389 set gameInfo(showTB) 0
390 if {[sc_info tb]} { set gameInfo(showTB) 2}
391 
392 # Twin deletion options:
393 
394 array set twinSettings {
395  players No
396  colors No
397  event No
398  site Yes
399  round Yes
400  year Yes
401  month Yes
402  day No
403  result No
404  eco No
405  moves Yes
406  skipshort Yes
407  setfilter Yes
408  undelete Yes
409  comments Yes
410  variations Yes
411  usefilter No
412  delete Shorter
413 }
414 array set twinSettingsDefaults [array get twinSettings]
415 
416 # Opening report options:
417 array set optable {
418  Stats 1
419  Oldest 5
420  Newest 5
421  Popular 1
422  MostFrequent 6
423  MostFrequentWhite 1
424  MostFrequentBlack 1
425  AvgPerf 1
426  HighRating 8
427  Results 1
428  Shortest 5
429  ShortestWhite 1
430  ShortestBlack 1
431  MoveOrders 8
432  MovesFrom 1
433  Themes 1
434  Endgames 1
435  MaxGames 500
436  ExtraMoves 1
437 }
438 array set optableDefaults [array get optable]
439 
440 # Player report options
441 array set preport {
442  Stats 1
443  Oldest 5
444  Newest 5
445  MostFrequentOpponents 6
446  AvgPerf 1
447  HighRating 8
448  Results 1
449  MostFrequentEcoCodes 6
450  Themes 1
451  Endgames 1
452  MaxGames 500
453  ExtraMoves 1
454 }
455 array set preportDefaults [array get preport]
456 
457 # Analysis options (Informant values)
458 # The different threshold values for !? ?? += etc
459 array set informant {}
460 set informant("!?") 0.5
461 set informant("?") 1.5
462 set informant("??") 3.0
463 set informant("?!") 0.5
464 set informant("+=") 0.5
465 set informant("+/-") 1.5
466 set informant("+-") 3.0
467 set informant("++-") 5.5
468 
469 # Export file options:
470 set exportFlags(comments) 1
471 set exportFlags(indentc) 0
472 set exportFlags(vars) 1
473 set exportFlags(indentv) 0
474 set exportFlags(column) 0
475 set exportFlags(append) 0
476 set exportFlags(symbols) 0
477 set exportFlags(htmldiag) 0
478 set exportFlags(stripMarks) 0
479 set exportFlags(convertNullMoves) 0
480 set default_exportStartFile(PGN) {}
481 set default_exportEndFile(PGN) {}
482 
483 set default_exportStartFile(LaTeX) {\documentclass[10pt,twocolumn]{article}
484  % This is a LaTeX file generated by Scid.
485  % You must have the "chess12" package installed to typeset this file.
486 
487  \usepackage{times}
488  \usepackage{a4wide}
489  \usepackage{chess}
490  \usepackage[T1]{fontenc}
491 
492  \setlength{\columnsep}{7mm}
493  \setlength{\parindent}{0pt}
494 
495  % Macros for variations and diagrams:
496  \newenvironment{variation}{\begin{quote}}{\end{quote}}
497  \newenvironment{diagram}{\begin{nochess}}{$$\showboard$$\end{nochess}}
498 
499  \begin{document}
500 }
501 set default_exportEndFile(LaTeX) {\end{document}
502 }
503 
504 
505 set default_exportStartFile(HTML) {<html>
506  <head>
507  <title>Scid export</title>
508  <style>
509  @media print {
510  table { page-break-inside: avoid; }
511  }
512  </style>
513  </head>
514  <body bgcolor="#ffffff">
515 
516 }
517 set default_exportEndFile(HTML) {</body>
518  </html>
519 }
520 
521 foreach type {PGN HTML LaTeX} {
522  set exportStartFile($type) $default_exportStartFile($type)
523  set exportEndFile($type) $default_exportEndFile($type)
524 }
525 
526 # autoRaise: defines whether the "raise" command should be used to raise
527 # certain windows (like progress bars) when they become obscured.
528 # Some Unix window managers (e.g. some versions of Enlightenment and sawfish,
529 # so I have heard) have a bug where the Tcl/Tk "raise" command times out
530 # and takes a few seconds. Setting autoRaise to 0 will help avoid this.
531 
532 set autoRaise 1
533 
534 proc raiseWin {w} {
535  global autoRaise
536  if {$autoRaise} { raise $w}
537  return
538 }
539 
540 # autoIconify:
541 # Specified whether Scid should iconify all other Scid windows when
542 # the main window is iconified. Most people like this behaviour but
543 # some window managers send an "UnMap" event when the user switches
544 # to another virtual window without iconifying the Scid window so
545 # users of such managers will probably want to turn this off.
546 
547 set autoIconify 1
548 
549 # Email configuration:
550 set email(logfile) [file join $scidLogDir "scidmail.log"]
551 set email(oldlogfile) [file join $scidUserDir "scidmail.log"]
552 set email(smtp) 1
553 set email(smproc) "/usr/lib/sendmail"
554 set email(server) localhost
555 set email(from) ""
556 set email(bcc) ""
557 # Rename old email log file if necessary:
558 if {[file readable $email(oldlogfile)] && ![file readable $email(logfile)]} {
559  catch {file rename $email(oldlogfile) $email(logfile)}
560 }
561 
562 ### Audio move announcement options:
563 set ::utils::sound::soundFolder [file nativename [file join $::scidShareDir sounds]]
564 set ::utils::sound::announceNew 0
565 set ::utils::sound::announceForward 0
566 set ::utils::sound::announceBack 0
567 
568 # Spell-checking file: default is "spelling.ssp".
569 set spellCheckFile [file join $scidShareDir "spelling.ssp"]
570 
571 # book configuration
572 set ::book::lastBook "" ; # book name without extension (.bin)
573 
574 # Engines list file: -- OLD NAMES, NO LONGER USED
575 #set engines(file) [file join $scidUserDir "engines.lis"]
576 #set engines(backup) [file join $scidUserDir "engines.bak"]
577 
578 # Engines data:
579 set engines(list) {}
580 set engines(sort) Time
581 set engineCoach1 {}
582 set engineCoach2 {}
583 
584 
585 
586 # scidConfigFile:
587 # Returns the full path and name of a Scid configuration file,
588 # given its configuration type.
589 #
590 proc scidConfigFile {type} {
591  global scidConfigDir
592 
593  foreach {cfgtype fname} {
594  options "options.dat"
595  engines "engines.dat"
596  engines.bak "engines.dat"
597  recentfiles "recent.dat"
598  history "history.dat"
599  bookmarks "bookmarks.dat"
600  reports "reports.dat"
601  optrainer "optrainer.dat"
602  resolvers "resolvers.dat"
603  xfccstate "xfccstate.dat"
604  correspondence "correspondence.dat"
605  ExtHardware "hardware.dat"
606  treecache "treecache.dat"
607  } {
608  if { $type == $cfgtype } {
609  return [file nativename [file join $scidConfigDir $fname]]
610  }
611  }
612 
613  return -code error "No such config file type: $type"
614 }
615 
616 set optionsFile [scidConfigFile options]
617 
618 ################################################################################
619 # Load options file. All default values should be set before this point or new saved values will be overwritten by default ones
620 ################################################################################
621 if {[file exists $optionsFile] && [catch {source $optionsFile}]} {
622  tk_messageBox -message $::errorInfo
623 }
624 
625 # Now, if the options file was written by Scid 3.5 or older, it has a lot of
626 # yucky variable names in the global namespace. So convert them to the new
627 # namespace variables:
628 #
629 proc ConvertOldOptionVariables {} {
630  set oldNewNames {
631  doColorPgn ::pgn::showColor
632  pgnIndentVars ::pgn::indentVars
633  pgnIndentComments ::pgn::indentComments
634  pgnShortHeader ::pgn::shortHeader
635  pgnMoveFont ::pgn::boldMainLine
636  pgnMoveNumSpace ::pgn::moveNumberSpaces
637  pgnStripMarks ::pgn::stripMarks
638  pgnSymbolicNags ::pgn::symbolicNags
639  pgnColumn ::pgn::columnFormat
640  }
641 
642  foreach {old new} $oldNewNames {
643  if {[info exists ::$old]} {
644  set $new [set ::$old]
645  }
646  }
647 }
649 
650 proc options.write {} {
651  uplevel #0 {
652  set optionF ""
653  if {[catch {open [scidConfigFile options] w} optionF]} {
654  tk_messageBox -title "Scid: Unable to write file" -type ok -icon warning \
655  -message "Unable to write options file: [scidConfigFile options]\n$optionF"
656  } else {
657  puts $optionF "# Scid options file"
658  puts $optionF "# Version: $scidVersion"
659  puts $optionF "# This file contains commands in the Tcl language format."
660  puts $optionF "# If you edit this file, you must preserve valid its Tcl"
661  puts $optionF "# format or it will not set your Scid options properly."
662  puts $optionF ""
663  foreach i {boardSize boardStyle language ::pgn::showColor \
664  ::pgn::indentVars ::pgn::indentComments ::pgn::showPhoto \
665  ::pgn::shortHeader ::pgn::boldMainLine ::pgn::stripMarks \
666  ::pgn::symbolicNags ::pgn::moveNumberSpaces ::pgn::columnFormat \
667  tree(order) optionsAutoSave ::tree::mask::recentMask \
668  ecoFile suggestMoves showVarPopup showVarArrows \
669  blunderThreshold autoplayDelay animateDelay boardCoords \
670  moveEntry(AutoExpand) moveEntry(Coord) \
671  translatePieces arrowLastMove highlightLastMove highlightLastMoveWidth highlightLastMoveColor \
672  glossOfDanger askToReplaceMoves locale(numeric) \
673  spellCheckFile autoRaise autoIconify windowsDock showGameInfo \
674  exportFlags(comments) exportFlags(vars) \
675  exportFlags(indentc) exportFlags(indentv) \
676  exportFlags(column) exportFlags(symbols) \
677  exportFlags(htmldiag) exportFlags(convertNullMoves) \
678  email(smtp) email(smproc) email(server) \
679  email(from) email(bcc) \
680  gameInfo(photos) gameInfo(hideNextMove) gameInfo(wrap) \
681  gameInfo(fullComment) gameInfo(showMarks) \
682  gameInfo(showMaterial) gameInfo(showFEN) gameInfo(showTB) \
683  engineCoach1 engineCoach2 scidBooksDir scidBasesDir ::book::lastBook \
684  ::utils::sound::soundFolder ::utils::sound::announceNew \
685  ::utils::sound::announceForward ::utils::sound::announceBack \
686  ::tacgame::threshold ::tacgame::blunderwarning ::tacgame::blunderwarningvalue \
687  ::tacgame::levelMin ::tacgame::levelMax ::tacgame::levelFixed ::tacgame::randomLevel \
688  ::tacgame::isLimitedAnalysisTime ::tacgame::showblunder ::tacgame::showblundervalue \
689  ::tacgame::showblunderfound ::tacgame::showmovevalue ::tacgame::showevaluation \
690  ::tacgame::isLimitedAnalysisTime ::tacgame::analysisTime ::tacgame::openingType ::tacgame::chosenOpening \
691  ::sergame::chosenOpening ::sergame::chosenEngine ::sergame::useBook ::sergame::bookToUse \
692  ::sergame::startFromCurrent ::sergame::coachIsWatching ::sergame::timeMode \
693  ::sergame::depth ::sergame::movetime ::sergame::nodes ::sergame::ponder ::sergame::isOpening \
694  ::uci::uciInfo(wtime3) ::uci::uciInfo(winc3) ::uci::uciInfo(btime3) ::uci::uciInfo(binc3) \
695  boardfile_lite boardfile_dark \
696  FilterMaxMoves FilterMinMoves FilterStepMoves FilterMaxElo FilterMinElo FilterStepElo \
697  FilterMaxYear FilterMinYear FilterStepYear FilterGuessELO lookTheme ThemePackageFile autoResizeBoard } {
698  puts $optionF "set $i [list [set $i]]"
699  }
700 
701  foreach i [lsort [array names menuColor]] {
702  puts $optionF "set menuColor($i) [list $menuColor($i)]"
703  }
704  foreach i [lsort [array names menuBarColor]] {
705  puts $optionF "set menuBarColor($i) [list $menuBarColor($i)]"
706  }
707  puts $optionF ""
708  foreach i [lsort [array names winWidth]] {
709  puts $optionF "set winWidth($i) [expr $winWidth($i)]"
710  puts $optionF "set winHeight($i) [expr $winHeight($i)]"
711  }
712  puts $optionF ""
713  foreach i [lsort [array names winX]] {
714  puts $optionF "set winX($i) [expr $winX($i)]"
715  puts $optionF "set winY($i) [expr $winY($i)]"
716  }
717  puts $optionF ""
718  puts $optionF "set analysisCommand [list $analysisCommand]"
719  puts $optionF "set analysisChoices [list $analysisChoices]"
720  puts $optionF ""
721  foreach i {lite dark whitecolor blackcolor highcolor bestcolor \
722  whiteborder blackborder borderwidth \
723  pgnColor(Header) pgnColor(Main) pgnColor(Var) \
724  pgnColor(Nag) pgnColor(Comment) pgnColor(Background) \
725  pgnColor(Current) } {
726  puts $optionF "set $i [list [set $i]]"
727  }
728  puts $optionF ""
729  foreach i [lsort [array names optable]] {
730  puts $optionF "set optable($i) [list $optable($i)]"
731  }
732  foreach i [lsort [array names ::windows::stats::display]] {
733  puts $optionF "set ::windows::stats::display($i) [list $::windows::stats::display($i)]"
734  }
735  foreach i [lsort [array names startup]] {
736  puts $optionF "set startup($i) [list $startup($i)]"
737  }
738  foreach i [lsort [array names toolbar_state]] {
739  puts $optionF "set toolbar_state($i) [list $toolbar_state($i)]"
740  }
741  foreach i [lsort [array names twinSettings]] {
742  puts $optionF "set twinSettings($i) [list $twinSettings($i)]"
743  }
744  puts $optionF ""
745  foreach i {Regular Menu Small Tiny Fixed} {
746  puts $optionF "set fontOptions($i) [list $fontOptions($i)]"
747  }
748  puts $optionF ""
749  foreach type [array names initialDir] {
750  puts $optionF "set initialDir($type) [list $initialDir($type)]"
751  }
752  puts $optionF ""
753  foreach type {PGN HTML LaTeX} {
754  puts $optionF "set exportStartFile($type) [list $exportStartFile($type)]"
755  puts $optionF "set exportEndFile($type) [list $exportEndFile($type)]"
756  }
757  puts $optionF ""
758  foreach i [lsort [array names informant]] {
759  puts $optionF "set informant($i) [list $informant($i)]"
760  }
761  puts $optionF ""
762 
763  # save FICS config
764  foreach i { use_timeseal timeseal_exec port_fics port_timeseal login password usedefaultvars premoveEnabled \
765  consolebg consolefg consoleheight consolewidth colseeking colgame colgameresult colficspercent server_ip } {
766  puts $optionF "set ::fics::$i [list [set ::fics::$i]]"
767  }
768  foreach i [lsort [array names ::fics::profileVars]] {
769  puts $optionF "set ::fics::profileVars($i) [list $::fics::profileVars($i)]"
770  }
771 
772  # save pinfo config
773  foreach i { wikipurl dnburl SeeAlsoPND2WP wikipAPI} {
774  puts $optionF "set ::pinfo::$i [list [set ::pinfo::$i]]"
775  }
776 
777  # save NOVAG config
778  foreach i { referee } {
779  puts $optionF "set ::novag::$i [list [set ::novag::$i]]"
780  }
781 
782  # Save layouts
783  ::docking::layout_save "auto"
784  foreach slot {1 2 3 auto} {
785  puts $optionF "set ::docking::layout_list($slot) [list $::docking::layout_list($slot)]"
786  }
787  foreach wnd [array names ::winGeometry] {
788  if {[winfo exists $wnd]} {
789  ::win::saveWinGeometry $wnd
790  }
791  if {$::winGeometry($wnd) ne ""} {
792  puts $optionF "set ::winGeometry($wnd) $::winGeometry($wnd)"
793  }
794  }
795 
796 
797  # Save var that was added with options.save()
798  if {[info exists ::autosave_opt]} {
799  puts $optionF ""
800  puts $optionF "set ::autosave_opt [list $::autosave_opt]"
801  foreach {var} $::autosave_opt {
802  upvar #0 $var a
803  puts $optionF "set $var [list $a]"
804  }
805  }
806 
807  close $optionF
808  set ::statusBar "Options were saved to: [scidConfigFile options]"
809  }
810  }
811 }
812 
813 proc options.autoSaveHack {} {
814  catch {
815  set optionF [open [scidConfigFile options] "a"]
816  puts $optionF "set ::optionsAutoSave $::optionsAutoSave"
817  close $optionF
818  }
819 }
820 
821 # For better modularity default value can be set in a module with:
822 # if {![info exists varname]} { set varname defaultvalue }
823 # options.save varname
824 #
825 proc options.save {varname} {
826  if {![info exists ::autosave_opt] || [lsearch -exact $::autosave_opt $varname] == -1} {
827  lappend ::autosave_opt $varname
828  }
829 }
830 proc options.save_cancel {varname} {
831  set idx [lsearch -exact $::autosave_opt $varname]
832  if {$idx != -1} {
833  set ::autosave_opt [lreplace $::autosave_opt $idx $idx]
834  }
835 }
836 
837 
838 ###
839 ### End of file: options.tcl