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