~ubuntu-branches/ubuntu/trusty/scid/trusty

« back to all changes in this revision

Viewing changes to .pc/20_soundfolder.diff/tcl/start.tcl

  • Committer: Package Import Robot
  • Author(s): Oliver Korff
  • Date: 2012-03-11 22:53:54 UTC
  • mfrom: (18.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20120311225354-0qdtceosm3263cal
Tags: 1:4.3.0.cvs20120311-1
* New Upstream Version.
* Updated to standards version 3.9.3
* scid now recommends tdom and tcllib, which is necessary for the built-in
  xfcc support. Thanks to Ian Zimmerman for giving this hint. 
  (Closes: #656699) 
* Scid filter mode: "AND" is now working again. Thanks to Ian Zimmerman for
  the Report, and to Fulvio solving the bug upstream. (Closes: #661836) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
# Scid (Shane's Chess Information Database)
 
4
#
 
5
# Copyright (C) 1999-2004  Shane Hudson. All rights reserved.
 
6
#
 
7
# This is freely redistributable software; see the file named "COPYING"
 
8
# or "copying.txt" that came with this program.
 
9
#
 
10
 
 
11
# Scid's current version is an enhanced version of the original Scid, the author of which is
 
12
# Shane Hudson. His email is sgh@users.sourceforge.net
 
13
# To contact the current maintainer of Scid, email to the Scid users
 
14
# list at scid-users@lists.sourceforge.net
 
15
 
 
16
#
 
17
# The following few comments are only for Unix versions of Scid:
 
18
#
 
19
 
 
20
# The "\" at the end of the comment line below is necessary! It means
 
21
#   that the "exec" line is a comment to Tcl/Tk, but not to /bin/sh.
 
22
# The next line restarts using tkscid: \
 
23
exec `dirname $0`/tkscid "$0" "$@"
 
24
# exec tkscid "$0" "$@"
 
25
 
 
26
# The above launches tkscid from the same directory that this startup
 
27
# script was launched from (which feels as a suitable default scenario).
 
28
# Alternatively, you can change the top line of this startup script
 
29
# to start tkscid directly from a specific location, e.g.:
 
30
 
 
31
# For the above to work, tkscid must be in a directory in your PATH.
 
32
# Alternatively, you can set the first line to start tkscid directly
 
33
# by specifying the full name of tkscid, eg:
 
34
# #!/home/myname/bin/tkscid
 
35
 
 
36
############################################################
 
37
 
 
38
# Alter the version if any patches have been made to the Tcl code only:
 
39
set scidVersion "4.3"
 
40
set scidVersionDate "February 2011"
 
41
 
 
42
package require Tcl 8.5
 
43
package require Tk  8.5
 
44
package require Ttk
 
45
 
 
46
# Determine operating system platform: unix, windows or macos
 
47
#
 
48
set windowsOS 0
 
49
if {$tcl_platform(platform) == "windows"} { set windowsOS 1 }
 
50
set unixOS 0
 
51
if {$tcl_platform(platform) == "unix"} { set unixOS 1 }
 
52
set macOS 0
 
53
if {![catch {tk windowingsystem} wsystem] && $wsystem == "aqua"} { set macOS 1 }
 
54
 
 
55
# A lot of code assumes tcl_platform is either windows or unix, so
 
56
# lotsa stuff may break if this is not the case.
 
57
#
 
58
if {(! $windowsOS)  &&  (! $unixOS)} {
 
59
  # What to do here? Warn the user...?
 
60
}
 
61
 
 
62
 
 
63
# Check that on Unix, the version of tkscid matches the version of this
 
64
# script or on Windows, that the scid.exe and scid.gui versions are identical.
 
65
#
 
66
if {[string compare [sc_info version] $scidVersion]} {
 
67
  wm withdraw .
 
68
  if {$windowsOS} {
 
69
    set msg "This is Scid version [sc_info version], but the scid.gui data\n"
 
70
    append msg "file has the version number $scidVersion.\n"
 
71
  } else {
 
72
    set msg "This program,\n\"$argv0\",\nis version $scidVersion,\nbut the "
 
73
    append msg "tkscid program \nit uses is version [sc_info version].\n"
 
74
    append msg "Check that the path to tkscid is correct."
 
75
  }
 
76
  tk_messageBox -type ok -icon error -title "Scid: Version Error" -message $msg
 
77
  exit 1
 
78
}
 
79
 
 
80
#############################################################
 
81
#
 
82
# NAMESPACES
 
83
#
 
84
# The main Tcl/Tk namespaces used in the Scid application are
 
85
# initialized here, so that default values can be set up and
 
86
# altered when the user options file is loaded.
 
87
#
 
88
foreach ns {
 
89
  ::splash
 
90
  ::utils
 
91
  ::utils::date ::utils::font ::utils::history ::utils::pane ::utils::string
 
92
  ::utils::sound ::utils::validate ::utils::win
 
93
  ::file
 
94
  ::file::finder ::file::maint ::maint
 
95
  ::bookmarks
 
96
  ::edit
 
97
  ::game
 
98
  ::gbrowser
 
99
  ::search
 
100
  ::search::filter ::search::board ::search::header ::search::material
 
101
  ::windows
 
102
  ::windows::gamelist ::windows::stats ::tree ::tree::mask ::windows::tree
 
103
  ::windows::switcher ::windows::eco ::crosstab ::pgn ::book
 
104
  ::tools
 
105
  ::tools::analysis ::tools::email
 
106
  ::tools::graphs
 
107
  ::tools::graphs::filter ::tools::graphs::absfilter ::tools::graphs::rating ::tools::graphs::score
 
108
  ::tb ::optable
 
109
  ::board ::move
 
110
  ::tacgame ::sergame ::opening ::tactics ::calvar ::uci ::fics ::reviewgame ::novag
 
111
  ::config ::docking
 
112
  ::pinfo
 
113
  ::commenteditor
 
114
} {
 
115
  namespace eval $ns {}
 
116
}
 
117
 
 
118
set ::tacgame::threshold 0.9
 
119
set ::tacgame::blunderwarning false
 
120
set ::tacgame::blunderwarningvalue 0.0
 
121
set ::tacgame::levelMin 1200
 
122
set ::tacgame::levelMax 2200
 
123
set ::tacgame::levelFixed 1500
 
124
set ::tacgame::randomLevel 0
 
125
set ::tacgame::isLimitedAnalysisTime 1
 
126
set ::tacgame::showblunder 1
 
127
set ::tacgame::showblundervalue 1
 
128
set ::tacgame::showblunderfound 1
 
129
set ::tacgame::showmovevalue 1
 
130
set ::tacgame::showevaluation 1
 
131
set ::tacgame::isLimitedAnalysisTime 1
 
132
set ::tacgame::analysisTime 10
 
133
set ::tacgame::openingType new
 
134
set ::tacgame::chosenOpening 0
 
135
 
 
136
# List of saved layouts : 3 slots available
 
137
array set ::docking::layout_list {}
 
138
# Basic layout : PGN window with main board
 
139
set ::docking::layout_list(1) {{.pw vertical} {TPanedwindow {{.pw.pw0 horizontal} {TNotebook .nb .fdockmain} {TNotebook .tb1 .fdockpgnWin}}}}
 
140
set ::docking::layout_list(2) {}
 
141
set ::docking::layout_list(3) {}
 
142
 
 
143
### Tree/mask options:
 
144
set ::tree::mask::recentMask {}
 
145
 
 
146
#############################################################
 
147
# Customisable variables:
 
148
 
 
149
# scidExeDir: contains the directory of the Scid executable program.
 
150
# Used to determine the location of various relative data directories.
 
151
set scidExecutable [info nameofexecutable]
 
152
if {[file type $scidExecutable] == "link"} {
 
153
  set scidExeDir [file dirname [file readlink $scidExecutable]]
 
154
  if {[file pathtype $scidExeDir] == "relative"} {
 
155
    set scidExeDir [file dirname [file join [file dirname $scidExecutable]\
 
156
      [file readlink $scidExecutable]]]
 
157
  }
 
158
} else {
 
159
  set scidExeDir [file dirname $scidExecutable]
 
160
}
 
161
 
 
162
# scidUserDir: location of user-specific Scid files.
 
163
# This is "~/.scid" on Unix, and the Scid exectuable dir on Windows.
 
164
if {$windowsOS} {
 
165
  set scidUserDir $scidExeDir
 
166
} else {
 
167
  set scidUserDir [file nativename "~/.scid"]
 
168
}
 
169
 
 
170
# scidConfigDir, scidDataDir, scidLogDir:
 
171
#   Location of Scid configuration, data and log files.
 
172
set scidConfigDir [file nativename [file join $scidUserDir "config"]]
 
173
set scidDataDir [file nativename [file join $scidUserDir "data"]]
 
174
set scidLogDir [file nativename [file join $scidUserDir "log"]]
 
175
 
 
176
# boardSizes: a list of the available board sizes.
 
177
set boardSizes [list 25 30 35 40 45 50 55 60 65 70 80]
 
178
set boardSizesOLD [list 21 25 29 33 37 40 45 49 54 58 64 72]
 
179
 
 
180
#load textures for lite and dark squares
 
181
set boardfile_dark "emptySquare"
 
182
set boardfile_lite "emptySquare"
 
183
 
 
184
#[file join $scidExeDir "bitmaps" "empty.gif"] ;# wsquare.gif
 
185
 
 
186
# boardSize: Default board size. See the available board sizes above.
 
187
set boardSize 40
 
188
 
 
189
# boardStyle: Default board piece set. See bitmaps.tcl for styles.
 
190
set boardStyle Alpha
 
191
 
 
192
# language for help pages and messages:
 
193
set language E
 
194
set oldLang X
 
195
 
 
196
# Toolbar configuration:
 
197
foreach {tbicon status}  {
 
198
  new 1 open 1 save 1 close 1
 
199
  finder 1 bkm 1 gprev 1 gnext 1
 
200
  cut 0 copy 0 paste 0
 
201
  rfilter 1 bsearch 1 hsearch 1 msearch 1
 
202
  switcher 1 glist 1 pgn 1 tmt 1 maint 1 eco 1 tree 1 crosst 1 engine 1
 
203
} {
 
204
  set toolbar($tbicon) $status
 
205
}
 
206
 
 
207
# boardCoords: 1 to show board Coordinates, 0 to hide them.
 
208
set boardCoords 0
 
209
 
 
210
# boardSTM: 1 to show side-to-move icon, 0 to hide it.
 
211
set boardSTM 1
 
212
 
 
213
# Default values for fonts:
 
214
proc createFont {name} {
 
215
  set opts $::fontOptions($name)
 
216
  font create font_$name \
 
217
      -family [lindex $opts 0] -size [lindex $opts 1] \
 
218
      -weight [lindex $opts 2] -slant [lindex $opts 3]
 
219
}
 
220
 
 
221
proc configureFont {name} {
 
222
  set opts $::fontOptions($name)
 
223
  font configure font_$name \
 
224
      -family [lindex $opts 0] -size [lindex $opts 1] \
 
225
      -weight [lindex $opts 2] -slant [lindex $opts 3]
 
226
}
 
227
 
 
228
if {$windowsOS} {
 
229
  ## set fontOptions(Regular) [list Arial           10 normal roman]
 
230
  ## set fontOptions(Menu)    [list {MS Sans Serif}  9 normal roman]
 
231
  ## set fontOptions(Small)   [list Arial            9 normal roman]
 
232
  ## set fontOptions(Tiny)    [list Arial            8 normal roman]
 
233
  ## set fontOptions(Fixed)   [list Courier          9 normal roman]
 
234
  set fontOptions(Regular) [list system          10 normal roman]
 
235
  set fontOptions(Menu)    [list system           9 normal roman]
 
236
  set fontOptions(Small)   [list system           9 normal roman]
 
237
  set fontOptions(Tiny)    [list system           8 normal roman]
 
238
  set fontOptions(Fixed)   [list systemfixed      9 normal roman]
 
239
} elseif {$macOS} {
 
240
  set fontOptions(Regular) [list system    11 normal roman]
 
241
  set fontOptions(Menu)    [list menu      14 normal roman]
 
242
  set fontOptions(Small)   [list system    10 normal roman]
 
243
  set fontOptions(Tiny)    [list system     9 normal roman]
 
244
  set fontOptions(Fixed)   [list Monaco    10 normal roman]
 
245
} else {
 
246
  set fontOptions(Regular) [list helvetica 11 normal roman]
 
247
  set fontOptions(Menu)    [list helvetica 10 normal roman]
 
248
  set fontOptions(Small)   [list helvetica 10 normal roman]
 
249
  set fontOptions(Tiny)    [list helvetica  9 normal roman]
 
250
  set fontOptions(Fixed)   [list fixed     10 normal roman]
 
251
}
 
252
 
 
253
createFont Regular
 
254
createFont Menu
 
255
createFont Small
 
256
createFont Tiny
 
257
createFont Fixed
 
258
 
 
259
### TODO
 
260
### Sample for figurine fonts see also htext.tcl
 
261
### Not yet working properly
 
262
### font create font_Figurine_ML  -family {FigurineSymbol T1} -size 10
 
263
### font create font_Figurine_Var -family {FigurineSymbol T1} -size 6
 
264
 
 
265
 
 
266
# Analysis command: to start chess analysis engine.
 
267
set analysisCommand ""
 
268
if {$windowsOS} {
 
269
  set analysisChoices {wcrafty.exe}
 
270
} else {
 
271
  set analysisChoices {crafty}
 
272
}
 
273
 
 
274
# Colors: dark and lite are square colors
 
275
#     whitecolor/blackcolor are piece colors
 
276
#     highcolor is the color when something is selected.
 
277
#     bestcolor is used to indicate a suggested move square.
 
278
# set dark        "\#70a070"
 
279
# set lite        "\#e0d070"
 
280
set lite "\#f3f3f3"
 
281
set dark "\#7389b6"
 
282
set whitecolor  "\#ffffff"
 
283
set blackcolor  "\#000000"
 
284
set whiteborder "\#000000"
 
285
set blackborder "\#ffffff"
 
286
set highcolor   "\#b0d0e0"
 
287
set bestcolor   "\#bebebe"
 
288
set buttoncolor "\#b0c0d0"
 
289
set borderwidth 1
 
290
 
 
291
set ::tactics::analysisTime 3
 
292
set ::tactics::findBestMoveRunning 0
 
293
array set ::tactics::findBestMove_History {}
 
294
    
 
295
# Defaults for the PGN window:
 
296
# if ::pgn::showColor is 1, the PGN text will be colorized.
 
297
set ::pgn::showColor 1
 
298
set ::pgn::indentVars 1
 
299
set ::pgn::indentComments 1
 
300
set ::pgn::symbolicNags 1
 
301
set ::pgn::moveNumberSpaces 0
 
302
set ::pgn::shortHeader 1
 
303
set ::pgn::boldMainLine 1
 
304
set ::pgn::columnFormat 0
 
305
set ::pgn::stripMarks 0
 
306
set pgnColor(Header) "\#00008b"
 
307
set pgnColor(Main) "\#000000"
 
308
set pgnColor(Var) "\#0000ee"
 
309
set pgnColor(Nag) "\#ee0000"
 
310
set pgnColor(Comment) "\#008b00"
 
311
set pgnColor(Current) lightSteelBlue
 
312
set pgnColor(NextMove) "\#fefe80"
 
313
set pgnColor(Background) "\#ffffff"
 
314
 
 
315
# Defaults for FICS
 
316
array set findopponent {}
 
317
set ::fics::use_timeseal 1
 
318
set ::fics::timeseal_exec "timeseal"
 
319
set ::fics::port_fics 5000
 
320
set ::fics::port_timeseal 5001
 
321
set ::fics::login ""
 
322
set ::fics::password ""
 
323
set ::fics::usedefaultvars 1
 
324
set ::fics::findopponent(initTime) 15
 
325
set ::fics::findopponent(incTime) 20
 
326
set ::fics::findopponent(rated) "rated"
 
327
set ::fics::findopponent(color) ""
 
328
set ::fics::findopponent(limitrating) 1
 
329
set ::fics::findopponent(rating1) 1500
 
330
set ::fics::findopponent(rating2) 3000
 
331
set ::fics::findopponent(manual) "auto"
 
332
set ::fics::findopponent(formula) ""
 
333
set ::fics::consolebg     black
 
334
set ::fics::consolefg     LimeGreen
 
335
set ::fics::consoleheight 10
 
336
set ::fics::consolewidth  40
 
337
set ::fics::colseeking     coral
 
338
set ::fics::colgame        grey70
 
339
set ::fics::colgameresult  SlateBlue1
 
340
set ::fics::colficspercent khaki1
 
341
set ::fics::colficshelpnext blue
 
342
set ::fics::server_ip "0.0.0.0"
 
343
 
 
344
set ::commenteditor::showboard 1
 
345
 
 
346
# default resolvers for player info
 
347
set ::pinfo::wikipAPI      "http://de.wikipedia.org/w/api.php?action=query&format=xml"
 
348
# Appers PND resolver
 
349
set ::pinfo::wikipurl      "http://toolserver.org/~apper/pd/person/pnd-redirect"
 
350
# SeeAlso resolver for PND -> WikiPedia
 
351
set ::pinfo::SeeAlsoPND2WP "http://ws.gbv.de/seealso/pnd2wikipedia/?format=seealso&id="
 
352
# Deutsche NationalBibliothek
 
353
set ::pinfo::dnburl        "http://d-nb.info/gnd"
 
354
# all other ID resolvers come from [scidConfigFile resolvers]
 
355
 
 
356
# Defaults for Novag Citrine
 
357
set ::novag::referee "OFF"
 
358
 
 
359
# Defaults for serious game training
 
360
set ::sergame::isOpening 0
 
361
set ::sergame::chosenOpening 0
 
362
set ::sergame::chosenEngine 0
 
363
set ::sergame::useBook 1
 
364
set ::sergame::bookToUse ""
 
365
set ::sergame::startFromCurrent 0
 
366
set ::sergame::coachIsWatching 0
 
367
set ::sergame::timeMode "timebonus"
 
368
set ::sergame::depth 3
 
369
set ::sergame::movetime 0
 
370
set ::sergame::nodes 10000
 
371
set ::sergame::ponder 0
 
372
set ::uci::uciInfo(wtime3) [expr 5 * 60 * 1000 ]
 
373
set ::uci::uciInfo(winc3) [expr 10 * 1000 ]
 
374
set ::uci::uciInfo(btime3) [expr 5 * 60 * 1000 ]
 
375
set ::uci::uciInfo(binc3) [expr 10 * 1000 ]
 
376
 
 
377
# Defaults for initial directories:
 
378
set initialDir(base) "."
 
379
set initialDir(pgn) "."
 
380
set initialDir(book) "."
 
381
set initialDir(epd) "."
 
382
set initialDir(html) "."
 
383
set initialDir(tex)  "."
 
384
set initialDir(stm)  "."
 
385
set initialDir(report) "."
 
386
set initialDir(tablebase1) ""
 
387
set initialDir(tablebase2) ""
 
388
set initialDir(tablebase3) ""
 
389
set initialDir(tablebase4) ""
 
390
 
 
391
# glistSize: Number of games displayed in the game list window
 
392
set glistSize 15
 
393
 
 
394
# glexport: Format for saving Game List to text file.
 
395
set glexportDefault "g6: w13 W4  b13 B4  r3:m2 y4 s11 o4"
 
396
set glexport $glexportDefault
 
397
 
 
398
# glistSelectPly: The number of moves to display in a game list entry
 
399
# when that entry is selected with button-2 to shoe the first moves
 
400
# of a game. E.g., a value of 4 might give: "1.e4 e5 2.Nf3 Nc6".
 
401
set glistSelectPly 80
 
402
 
 
403
 
 
404
# Default window locations:
 
405
foreach i {. .pgnWin .helpWin .crosstabWin .treeWin .commentWin .glist \
 
406
      .playerInfoWin .baseWin .treeBest .treeGraph .tourney .finder \
 
407
      .ecograph .statsWin .glistWin .maintWin .nedit} {
 
408
  set winX($i) -1
 
409
  set winY($i) -1
 
410
}
 
411
 
 
412
for {set b 1} {$b<=[sc_base count total]} {incr b} {
 
413
  foreach i { .treeWin .treeBest .treeGraph } {
 
414
    set winX($i$b) -1
 
415
    set winY($i$b) -1
 
416
  }
 
417
}
 
418
 
 
419
# Default PGN window size:
 
420
set winWidth(.pgnWin)  65
 
421
set winHeight(.pgnWin) 20
 
422
 
 
423
# Default help window size:
 
424
set winWidth(.helpWin)  50
 
425
set winHeight(.helpWin) 32
 
426
 
 
427
# Default stats window size:
 
428
set winWidth(.statsWin) 60
 
429
set winHeight(.statsWin) 13
 
430
 
 
431
# Default crosstable window size:
 
432
set winWidth(.crosstabWin)  65
 
433
set winHeight(.crosstabWin) 15
 
434
 
 
435
# Default tree window size:
 
436
set winWidth(.treeWin)  58
 
437
set winHeight(.treeWin) 20
 
438
 
 
439
# Default comment editor size:
 
440
set winWidth(.commentWin)  40
 
441
set winHeight(.commentWin)  6
 
442
 
 
443
# Default spellcheck results window size:
 
444
set winWidth(.spellcheckWin)  55
 
445
set winHeight(.spellcheckWin) 25
 
446
 
 
447
# Default player info window size:
 
448
set winWidth(.playerInfoWin)  45
 
449
set winHeight(.playerInfoWin) 20
 
450
 
 
451
# Default switcher window size:
 
452
set winWidth(.baseWin) 310
 
453
set winHeight(.baseWin) 110
 
454
 
 
455
# Default Correspondence Chess window size:
 
456
set winWidth(.ccWindow) 10
 
457
set winHeight(.ccWindow) 20
 
458
 
 
459
# Default size for input engine console:
 
460
###---### needs adjustment!
 
461
set winWidth(.inputengineconsole) 10
 
462
set winHeight(.inputengineconsole) 20
 
463
 
 
464
# In docked mode, use same default geometry values
 
465
foreach elt {winX winY winWidth winHeight} {
 
466
  foreach name [array names $elt] {
 
467
    set ${elt}_docked($name) [set ${elt}($name)]
 
468
  }
 
469
}
 
470
 
 
471
# Default stats window lines:
 
472
array set ::windows::stats::display {
 
473
  r2600 1
 
474
  r2500 1
 
475
  r2400 1
 
476
  r2300 1
 
477
  r2200 0
 
478
  r2100 0
 
479
  r2000 0
 
480
  y1900 0
 
481
  y1950 0
 
482
  y1960 0
 
483
  y1970 0
 
484
  y1980 0
 
485
  y1990 0
 
486
  y1995 0
 
487
  y2000 1
 
488
  y2002 1
 
489
  y2004 1
 
490
  y2006 1
 
491
  y2007 1
 
492
  y2008 1
 
493
}
 
494
 
 
495
# Default PGN display options:
 
496
set pgnStyle(Tags) 1
 
497
set pgnStyle(Comments) 1
 
498
set pgnStyle(Vars) 1
 
499
 
 
500
 
 
501
# Default Tree sort method:
 
502
set tree(order) frequency
 
503
 
 
504
# Auto-save tree cache when closing tree window:
 
505
set tree(autoSave) 0
 
506
 
 
507
# Auto-save options when exiting:
 
508
set optionsAutoSave 1
 
509
 
 
510
#  Numeric locale: first char is decimal, second is thousands.
 
511
#  Example: ".," for "1,234.5" format; ",." for "1.234,5" format.
 
512
set locale(numeric) ".,"
 
513
 
 
514
# Ask for piece translations (first letter)
 
515
set translatePieces 1
 
516
 
 
517
# Hightlight the last move played
 
518
set highlightLastMove 1
 
519
set highlightLastMoveWidth 2
 
520
set highlightLastMoveColor "grey"
 
521
set highlightLastMovePattern {} ; # this option is not saved
 
522
 
 
523
# Ask before replacing existing moves: on by default
 
524
set askToReplaceMoves 1
 
525
 
 
526
# Show suggested moves: on by default
 
527
set suggestMoves 1
 
528
 
 
529
# Show variations popup window
 
530
set showVarPopup 1
 
531
 
 
532
# Keyboard Move entry options:
 
533
set moveEntry(On) 1
 
534
set moveEntry(AutoExpand) 0
 
535
set moveEntry(Coord) 1
 
536
 
 
537
# Autoplay and animation delays in milliseconds:
 
538
set autoplayDelay 5000
 
539
set animateDelay 200
 
540
 
 
541
# Blunder Threshold
 
542
set blunderThreshold 1.0
 
543
 
 
544
# Geometry of windows:
 
545
array set geometry {}
 
546
 
 
547
# Default theme
 
548
set ::lookTheme "default"
 
549
 
 
550
# startup:
 
551
#   Stores which windows should be opened on startup.
 
552
set startup(pgn) 0
 
553
set startup(switcher) 0
 
554
set startup(tip) 1
 
555
set startup(tree) 0
 
556
set startup(finder) 0
 
557
set startup(crosstable) 0
 
558
set startup(gamelist) 0
 
559
set startup(stats) 0
 
560
set startup(book) 0
 
561
 
 
562
# glistFields: Layout of the GameList window fields.
 
563
#    element 0: code (e.g. g for gameNumber, w for White name)
 
564
#    element 1: initial width, in characters
 
565
#    element 2: justification (left or right)
 
566
#    element 3: color
 
567
#    element 4: true if a separator field should follow
 
568
#
 
569
#    Note that the "g" (game number) field MUST appear somewhere,
 
570
#    but the fields can be in any order.
 
571
#    See the comments at the start of the function "PrintGameInfo" in
 
572
#    src/index.cpp for a list of available field codes.
 
573
#
 
574
set glistFields {
 
575
  { D  1 left  darkRed    0 }
 
576
  { g  7 right black      1 }
 
577
  { w 14 left  darkBlue   0 }
 
578
  { W  5 right darkGreen  1 }
 
579
  { b 14 left  darkBlue   0 }
 
580
  { B  5 right darkGreen  1 }
 
581
  { e 10 left  black      0 }
 
582
  { s 10 left  black      0 }
 
583
  { n  2 right black      1 }
 
584
  { d  7 left  darkRed    1 }
 
585
  { r  3 left  blue       0 }
 
586
  { m  3 right black      1 }
 
587
  { o  5 left  darkGreen  0 }
 
588
  { O  6 left  darkGreen  1 }
 
589
  { U  2 left  blue       1 }
 
590
  { V  2 right blue       0 }
 
591
  { C  2 right blue       0 }
 
592
  { A  2 right blue       0 }
 
593
  { S  1 left  darkRed    0 }
 
594
}
 
595
 
 
596
set glistDefaultFields $glistFields
 
597
set glistAllFields $glistFields
 
598
lappend glistAllFields { c  3 left  black      0 }
 
599
lappend glistAllFields { E  7 left  darkRed    0 }
 
600
lappend glistAllFields { F  7 left  darkBlue   0 }
 
601
 
 
602
# myPlayerNames:
 
603
#   List of player name patterns for which the chessboard should be
 
604
#   flipped each time a game is loaded to show the board from that
 
605
#   players perspective.
 
606
#
 
607
set myPlayerNames {}
 
608
 
 
609
 
 
610
# Game information area options:
 
611
set gameInfo(photos) 1
 
612
set gameInfo(hideNextMove) 0
 
613
set gameInfo(showMaterial) 0
 
614
set gameInfo(showFEN) 0
 
615
set gameInfo(showMarks) 1
 
616
set gameInfo(wrap) 0
 
617
set gameInfo(fullComment) 0
 
618
set gameInfo(showTB) 0
 
619
if {[sc_info tb]} { set gameInfo(showTB) 2 }
 
620
 
 
621
# Twin deletion options:
 
622
 
 
623
array set twinSettings {
 
624
  players No
 
625
  colors  No
 
626
  event   No
 
627
  site    Yes
 
628
  round   Yes
 
629
  year    Yes
 
630
  month   Yes
 
631
  day     No
 
632
  result  No
 
633
  eco     No
 
634
  moves   Yes
 
635
  skipshort  Yes
 
636
  setfilter  Yes
 
637
  undelete   Yes
 
638
  comments   Yes
 
639
  variations Yes
 
640
  usefilter  No
 
641
  delete     Shorter
 
642
}
 
643
array set twinSettingsDefaults [array get twinSettings]
 
644
 
 
645
# Opening report options:
 
646
array set optable {
 
647
  Stats 1
 
648
  Oldest 5
 
649
  Newest 5
 
650
  Popular 1
 
651
  MostFrequent 6
 
652
  MostFrequentWhite 1
 
653
  MostFrequentBlack 1
 
654
  AvgPerf 1
 
655
  HighRating 8
 
656
  Results 1
 
657
  Shortest 5
 
658
  ShortestWhite 1
 
659
  ShortestBlack 1
 
660
  MoveOrders 8
 
661
  MovesFrom 1
 
662
  Themes 1
 
663
  Endgames 1
 
664
  MaxGames 500
 
665
  ExtraMoves 1
 
666
}
 
667
array set optableDefaults [array get optable]
 
668
 
 
669
# Player report options
 
670
array set preport {
 
671
  Stats 1
 
672
  Oldest 5
 
673
  Newest 5
 
674
  MostFrequentOpponents 6
 
675
  AvgPerf 1
 
676
  HighRating 8
 
677
  Results 1
 
678
  MostFrequentEcoCodes 6
 
679
  Themes 1
 
680
  Endgames 1
 
681
  MaxGames 500
 
682
  ExtraMoves 1
 
683
}
 
684
array set preportDefaults [array get preport]
 
685
 
 
686
# Analysis options (Informant values)
 
687
# The different threshold values for !? ?? += etc
 
688
array set informant {}
 
689
set informant("!?") 0.5
 
690
set informant("?") 1.5
 
691
set informant("??") 3.0
 
692
set informant("?!") 0.5
 
693
set informant("+=") 0.5
 
694
set informant("+/-") 1.5
 
695
set informant("+-") 3.0
 
696
set informant("++-") 5.5
 
697
 
 
698
# Export file options:
 
699
set exportFlags(comments) 1
 
700
set exportFlags(indentc) 0
 
701
set exportFlags(vars) 1
 
702
set exportFlags(indentv) 1
 
703
set exportFlags(column) 0
 
704
set exportFlags(append) 0
 
705
set exportFlags(symbols) 1
 
706
set exportFlags(htmldiag) 0
 
707
set exportFlags(stripMarks) 0
 
708
set exportFlags(convertNullMoves) 1
 
709
set default_exportStartFile(PGN) {}
 
710
set default_exportEndFile(PGN) {}
 
711
 
 
712
set default_exportStartFile(LaTeX) {\documentclass[10pt,twocolumn]{article}
 
713
  % This is a LaTeX file generated by Scid.
 
714
  % You must have the "chess12" package installed to typeset this file.
 
715
  
 
716
  \usepackage{times}
 
717
  \usepackage{a4wide}
 
718
  \usepackage{chess}
 
719
  \usepackage[T1]{fontenc}
 
720
  
 
721
  \setlength{\columnsep}{7mm}
 
722
  \setlength{\parindent}{0pt}
 
723
  
 
724
  % Macros for variations and diagrams:
 
725
  \newenvironment{variation}{\begin{quote}}{\end{quote}}
 
726
  \newenvironment{diagram}{\begin{nochess}}{$$\showboard$$\end{nochess}}
 
727
  
 
728
  \begin{document}
 
729
}
 
730
set default_exportEndFile(LaTeX) {\end{document}
 
731
}
 
732
 
 
733
 
 
734
set default_exportStartFile(HTML) {<html>
 
735
  <head><title>Scid export</title></head>
 
736
  <body bgcolor="#ffffff">
 
737
}
 
738
set default_exportEndFile(HTML) {</body>
 
739
  </html>
 
740
}
 
741
 
 
742
foreach type {PGN HTML LaTeX} {
 
743
  set exportStartFile($type) $default_exportStartFile($type)
 
744
  set exportEndFile($type) $default_exportEndFile($type)
 
745
}
 
746
 
 
747
 
 
748
# ::windows::switcher::vertical
 
749
#
 
750
#   If 1, Switcher frames are arranged vertically.
 
751
#
 
752
set ::windows::switcher::vertical 0
 
753
set ::windows::switcher::icons 1
 
754
 
 
755
# autoRaise: defines whether the "raise" command should be used to raise
 
756
# certain windows (like progress bars) when they become obscured.
 
757
# Some Unix window managers (e.g. some versions of Enlightenment and sawfish,
 
758
# so I have heard) have a bug where the Tcl/Tk "raise" command times out
 
759
# and takes a few seconds. Setting autoRaise to 0 will help avoid this.
 
760
 
 
761
set autoRaise 1
 
762
 
 
763
proc raiseWin {w} {
 
764
  global autoRaise
 
765
  if {$autoRaise} { raise $w }
 
766
  return
 
767
}
 
768
 
 
769
# autoIconify:
 
770
#   Specified whether Scid should iconify all other Scid windows when
 
771
#   the main window is iconified. Most people like this behaviour but
 
772
#   some window managers send an "UnMap" event when the user switches
 
773
#   to another virtual window without iconifying the Scid window so
 
774
#   users of such managers will probably want to turn this off.
 
775
 
 
776
set autoIconify 1
 
777
 
 
778
# windowsDock:
 
779
# if true, most of toplevel windows are dockable and embedded in a main window
 
780
# windows can be moves among tabs (drag and drop) or undocked (right-clicking on tab)
 
781
set windowsDock 1
 
782
 
 
783
# showGameInfo:
 
784
# The game info panel below the main board
 
785
set showGameInfo 1
 
786
 
 
787
# autoLoadLayout :
 
788
# Automatic loading of layout # 1 at startup (docked windows mode only)
 
789
set autoLoadLayout 1
 
790
 
 
791
# autoResizeBoard:
 
792
# resize the board to fit the container
 
793
set autoResizeBoard 1
 
794
 
 
795
################################################################################
 
796
# if undocked window : sets the title of the toplevel window
 
797
# if docked : sets the name of the tab
 
798
# w : name of the toplevel window
 
799
proc setTitle { w title } {
 
800
  if { $::docking::USE_DOCKING && ! [ ::docking::isUndocked $w ]} {
 
801
    set f .fdock[ string range $w 1 end ]
 
802
    if { [catch {set nb [ ::docking::find_tbn $f ]} ]} {
 
803
      set nb ""
 
804
    }
 
805
    
 
806
    if { $nb == "" } {
 
807
      wm title $w $title
 
808
    } else  {
 
809
      # if target is main board, update the global window instead
 
810
      if { $w == ".main" && $title != [ ::tr "Board" ] } {
 
811
        wm title . $title
 
812
      } else  {
 
813
        # in docked mode trim down title to spare space
 
814
        if { [ string range $title 0 5 ] == "Scid: " &&  [ string length $title ] > 6 } {
 
815
          set title [string range $title 6 end]
 
816
        }
 
817
        $nb tab $f -text $title
 
818
      }
 
819
    }
 
820
  } else  {
 
821
    set wdock ".fdock[string range $w 1 end]"
 
822
    if { [winfo exists $wdock ] } { set w $wdock }
 
823
    wm title $w $title
 
824
  }
 
825
  
 
826
}
 
827
################################################################################
 
828
# Creates a toplevel window depending of the docking option
 
829
################################################################################
 
830
proc createToplevel { w } {
 
831
  set name [string range $w 1 end]
 
832
  set f .fdock$name
 
833
 
 
834
  # Raise window if already exist
 
835
  if { [winfo exists $w] } {
 
836
    if {! $::docking::USE_DOCKING } {
 
837
      tk::PlaceWindow $w
 
838
    } else {
 
839
      if { [::docking::isUndocked $w] } {
 
840
        tk::PlaceWindow $f
 
841
      } else {
 
842
        [::docking::find_tbn $f] select $f
 
843
      }
 
844
    }
 
845
    return "already_exists"
 
846
  }
 
847
 
 
848
  if { $::docking::USE_DOCKING && ! [ ::docking::isUndocked $w ] } {
 
849
    frame $f  -container 1
 
850
    toplevel .$name -use [ winfo id $f ]
 
851
    docking::add_tab $f e
 
852
    
 
853
    # auto focus mode : when the mouse enters a toplevel, it gets a forced focus to handle mouse wheel
 
854
    # only the highest stacked window can get the focus forced or on windows any time the mouse enters the main window, it will be raised
 
855
    bind .$name <Enter> {
 
856
      set tl [winfo toplevel %W]
 
857
      set atTop [lindex [wm stackorder . ] end]
 
858
      if { $tl == $atTop || $atTop == "." } {
 
859
        focus -force $tl
 
860
      }
 
861
    }
 
862
    
 
863
  } else  {
 
864
    toplevel $w
 
865
  }
 
866
  
 
867
}
 
868
 
 
869
################################################################################
 
870
# In the case of a window closed without the context menu in docked mode, arrange for the tabs to be cleaned up
 
871
# Alternative way : directly call ::docking::cleanup $w when closing window
 
872
################################################################################
 
873
proc createToplevelFinalize {w} {
 
874
  if { $::docking::USE_DOCKING } {
 
875
    bind $w <Destroy> +[ namespace code "::docking::cleanup $w %W"]
 
876
  }
 
877
}
 
878
 
 
879
################################################################################
 
880
# Sets the menu for a new window : in docked mode the menu is displayed by clicking on the tab of the notebook
 
881
################################################################################
 
882
proc setMenu { w m} {
 
883
  if { ! $::docking::USE_DOCKING } {
 
884
    $w configure -menu $m
 
885
  }
 
886
}
 
887
################################################################################
 
888
# In docked mode, resize board automatically
 
889
################################################################################
 
890
proc resizeMainBoard {} {
 
891
  # puts "resizeMainBoard [clock clicks -milliseconds]"
 
892
  if { ! $::docking::USE_DOCKING } { return }
 
893
  
 
894
  bind .main <Configure> {}
 
895
  
 
896
  set w [winfo width .main]
 
897
  set h [winfo height .main]
 
898
  set bd .main.board
 
899
  
 
900
  # calculate available height
 
901
  set height_used 0
 
902
  incr height_used [ lindex [grid bbox .main 0 0] 3]
 
903
  incr height_used [ lindex [grid bbox .main 0 1] 3] ;# buttons
 
904
  # coordinates
 
905
  if { $::board::_coords($bd) == 2 || $::board::_coords($bd) == 0} {
 
906
    incr height_used [ lindex [ grid bbox $bd 0 9 ] 3 ]
 
907
  }
 
908
  if { $::board::_coords($bd) == 0 } {
 
909
    incr height_used [ lindex [ grid bbox $bd 0 0 ] 3 ]
 
910
  }
 
911
 
 
912
  # game info
 
913
  set min_game_info_height 6
 
914
  set game_info_line_height 6
 
915
  set min_game_info_lines 1
 
916
  if {$::showGameInfo} {
 
917
    set min_game_info_lines 6
 
918
    set game_info_lines [.main.gameInfo count -displaylines 1.0 end]
 
919
    if { $game_info_lines > 0 } {
 
920
      # probably not very correct, do you know any better way to get this information?
 
921
      set game_info_line_height [expr 1.0 * [.main.gameInfo count -ypixels 1.0 end] / $game_info_lines]
 
922
    } else {
 
923
      # utter approximation
 
924
      set game_info_line_height [expr [font configure font_Regular -size] * 1.5]
 
925
    }
 
926
    set min_game_info_height [expr int($min_game_info_lines * $game_info_line_height + 6)]
 
927
  }
 
928
  incr height_used $min_game_info_height
 
929
  
 
930
  # status bar
 
931
  incr height_used [ lindex [grid bbox .main 0 5] 3]
 
932
  
 
933
  set availh [expr $h - $height_used -10]
 
934
  
 
935
  # calculate available width
 
936
  set width_used 0
 
937
  if { $::board::_coords($bd) == 2 || $::board::_coords($bd) == 0} {
 
938
    incr width_used [ lindex [ grid bbox $bd 0 1 ] 2 ]
 
939
  }
 
940
  if { $::board::_coords($bd) == 0 } {
 
941
    incr width_used [ lindex [ grid bbox $bd 9 1 ] 2 ]
 
942
  }
 
943
  if {$::board::_stm($bd)} {
 
944
    incr width_used [ lindex [ grid bbox $bd 10 1 ] 2 ]
 
945
    incr width_used [ lindex [ grid bbox $bd 11 2 ] 2 ]
 
946
  }
 
947
  if {$::board::_showmat($bd)} {
 
948
    incr width_used [ lindex [ grid bbox $bd 12 1 ] 2 ]
 
949
  }
 
950
  set availw [expr $w - $width_used ]
 
951
  
 
952
  if {$availh < $availw} {
 
953
    set min $availh
 
954
  } else  {
 
955
    set min $availw
 
956
  }
 
957
 
 
958
  if { $::autoResizeBoard } {
 
959
    # find the closest available size
 
960
    for {set i 0} {$i < [llength $::boardSizes]} {incr i} {
 
961
      set newSize [lindex $::boardSizes $i]
 
962
      if { $newSize > [ expr $min / 8 ] } {
 
963
        if {$i > 0} {
 
964
          set newSize [lindex $::boardSizes [expr $i -1] ]
 
965
        }
 
966
        break
 
967
      }
 
968
    }
 
969
    # resize the board
 
970
    ::board::resize2 .main.board $newSize
 
971
    set ::boardSize $newSize
 
972
  }
 
973
 
 
974
  # adjust game info height
 
975
  set new_game_info_lines [expr int(($min_game_info_height+($availh-$::boardSize*8))/$game_info_line_height)]
 
976
  if { $new_game_info_lines > $min_game_info_lines } {
 
977
    set new_game_info_lines [expr $new_game_info_lines - 1]
 
978
  }
 
979
  .main.gameInfo configure -height $new_game_info_lines
 
980
  
 
981
  update idletasks
 
982
  bind .main <Configure> { ::docking::handleConfigureEvent ::resizeMainBoard }
 
983
}
 
984
################################################################################
 
985
# sets visibility of gameInfo panel at the bottom of main board
 
986
proc toggleGameInfo {} {
 
987
  if {$::showGameInfo} {
 
988
    grid .main.gameInfoFrame -row 3 -column 0 -sticky nsew
 
989
  } else  {
 
990
    grid forget .main.gameInfoFrame
 
991
  }
 
992
  updateGameInfo
 
993
  update idletasks
 
994
  resizeMainBoard
 
995
}
 
996
################################################################################
 
997
 
 
998
# Email configuration:
 
999
set email(logfile) [file join $scidLogDir "scidmail.log"]
 
1000
set email(oldlogfile) [file join $scidUserDir "scidmail.log"]
 
1001
set email(smtp) 1
 
1002
set email(smproc) "/usr/lib/sendmail"
 
1003
set email(server) localhost
 
1004
set email(from) ""
 
1005
set email(bcc) ""
 
1006
 
 
1007
 
 
1008
### Audio move announcement options:
 
1009
 
 
1010
set ::utils::sound::soundFolder [file nativename [file join $::scidExeDir sounds]]
 
1011
set ::utils::sound::announceNew 0
 
1012
set ::utils::sound::announceForward 0
 
1013
set ::utils::sound::announceBack 0
 
1014
 
 
1015
# Spell-checking file: default is "spelling.ssp".
 
1016
if {$windowsOS} {
 
1017
  set spellCheckFile [file join $scidDataDir "spelling.ssp"]
 
1018
} else {
 
1019
  set spellCheckFile "/usr/share/scid/data/spelling.ssp"
 
1020
}
 
1021
 
 
1022
# book configuration
 
1023
set ::book::lastBook "" ; # book name without extension (.bin)
 
1024
 
 
1025
# Engines list file: -- OLD NAMES, NO LONGER USED
 
1026
#set engines(file) [file join $scidUserDir "engines.lis"]
 
1027
#set engines(backup) [file join $scidUserDir "engines.bak"]
 
1028
 
 
1029
# Engines data:
 
1030
set engines(list) {}
 
1031
set engines(sort) Time
 
1032
set engineCoach1 {}
 
1033
set engineCoach2 {}
 
1034
 
 
1035
if {$::unixOS} {
 
1036
  set iconFileDirs [list \
 
1037
      $scidExeDir [file join $scidExeDir "../share/scid"]]
 
1038
 
 
1039
  foreach iconFileDir $iconFileDirs {
 
1040
    set scidIconFile [file join $iconFileDir "scid.gif"]
 
1041
    if {[file readable $scidIconFile]} {
 
1042
      set iconimage [image create photo -file "$scidIconFile"]
 
1043
      wm iconphoto . -default $iconimage
 
1044
      break
 
1045
    }
 
1046
  }
 
1047
}
 
1048
 
 
1049
# Set up Scid icon in Windows:
 
1050
if {$::windowsOS} {
 
1051
  # Look in each of the following directories for a file named scid.ico:
 
1052
  set iconFileDirs [list \
 
1053
      $scidExeDir $scidUserDir $scidConfigDir [file join $scidExeDir "src"]]
 
1054
  
 
1055
  foreach iconFileDir $iconFileDirs {
 
1056
    set scidIconFile [file join $iconFileDir "scid.ico"]
 
1057
    if {[file readable $scidIconFile]} {
 
1058
      catch {wm iconbitmap . -default $scidIconFile}
 
1059
    }
 
1060
  }
 
1061
}
 
1062
 
 
1063
# Reversed mouse buttons in mac (::MB2 and ::MB3 are middle and right mouse buttons respectively.):
 
1064
if { $macOS } {
 
1065
  set ::MB2 3
 
1066
  set ::MB3 2
 
1067
} else {
 
1068
  set ::MB2 2
 
1069
  set ::MB3 3
 
1070
}
 
1071
 
 
1072
 
 
1073
# Opening files by drag & drop on Scid icon on Mac
 
1074
if { $macOS } {
 
1075
  # Drag & Drop
 
1076
  set dndisbusy 0
 
1077
  set isopenBaseready 0
 
1078
  set dndargs 0
 
1079
  
 
1080
  proc dragndrop {args} {
 
1081
    global dndisbusy
 
1082
    global isopenBaseready
 
1083
    global dndargs
 
1084
    
 
1085
    # Un-nest arguments:
 
1086
    set args [join $args]
 
1087
    
 
1088
    # Wait for openBase to be ready, if needed.
 
1089
    if {$isopenBaseready == 0} {
 
1090
      if {$dndargs != 0} {
 
1091
        tk_messageBox -type ok -icon info -title "Scid" -message \
 
1092
            "Please, wait until Scid finish starting up."
 
1093
        return
 
1094
      } else {
 
1095
        # Save file names for later use:
 
1096
        set dndargs $args
 
1097
      }
 
1098
      return
 
1099
    }
 
1100
    
 
1101
    # Are we busy opening files? if so, display message and do nothing
 
1102
    if {$dndisbusy != 0} {
 
1103
      tk_messageBox -type ok -icon info -title "Scid" -message \
 
1104
          "Please, wait until the previou(s) database(s) are opened and try again."
 
1105
      return
 
1106
    }
 
1107
    
 
1108
    # Un-nest argumens again if Scid opened on drag & drop
 
1109
    if {$isopenBaseready == 2} {
 
1110
      # Un-nest arguments:
 
1111
      set args [join $args]
 
1112
      set isopenBaseready 1
 
1113
    }
 
1114
    
 
1115
    set dndisbusy 1
 
1116
    set errmsg ""
 
1117
    foreach file $args {
 
1118
      # Check for available slots:
 
1119
      if {[sc_base count free] == 0} {
 
1120
        tk_messageBox -type ok -icon info -title "Scid" \
 
1121
            -message "Too many databases are open; close at least one \n\
 
1122
            before opening more databases"
 
1123
        #::splash::add "No slot available."
 
1124
        return
 
1125
      }
 
1126
      # Email File:
 
1127
      if {[file extension $file] == ".sem"} {
 
1128
        #::tools::email
 
1129
        continue
 
1130
      }
 
1131
      # SearchOptions file:
 
1132
      if {[file extension $file] == ".sso"} {
 
1133
        set ::fName $file
 
1134
        if {[catch {uplevel "#0" {source $::fName}} errmsg]} {
 
1135
          tk_messageBox -title "Scid: Error reading file" -type ok -icon warning \
 
1136
              -message "Unable to open or read SearchOptions file: $file"
 
1137
        } else {
 
1138
          switch -- $::searchType {
 
1139
            "Material" { ::search::material }
 
1140
            "Header"   { ::search::header }
 
1141
            default    { continue }
 
1142
          }
 
1143
        }
 
1144
        continue
 
1145
      }
 
1146
      
 
1147
      # Scid doesn't handle well .sg4 and .sn4 files.
 
1148
      if {([file extension $file] == ".sg4") || \
 
1149
            ([file extension $file] == ".sn4")} {
 
1150
        set eName ".si4"
 
1151
        set fName [file rootname $file]
 
1152
        set file "$fName$eName"
 
1153
      }
 
1154
      # Scid doesn't handle well .sg3 and .sn3 files.
 
1155
      if {([file extension $file] == ".sg3") || \
 
1156
            ([file extension $file] == ".sn3")} {
 
1157
        set eName ".si3"
 
1158
        set fName [file rootname $file]
 
1159
        set file "$fName$eName"
 
1160
      }
 
1161
      
 
1162
      # Check if base is already opened
 
1163
      if {[sc_base slot $file] != 0} {
 
1164
        tk_messageBox -type ok -icon info -title "Scid" -message \
 
1165
            "$file is already opened."
 
1166
      } else  {
 
1167
        # All seems good, let's open those files:
 
1168
        catch {::file::Open $file} errmsg
 
1169
      }
 
1170
    }
 
1171
    set dndisbusy 0
 
1172
    set dndargs 0
 
1173
  }
 
1174
  proc tkOpenDocument {args} {
 
1175
    after idle [list dragndrop $args]
 
1176
  }
 
1177
  rename tkOpenDocument ::tk::mac::OpenDocument
 
1178
}
 
1179
 
 
1180
# Add empty updateStatusBar proc to avoid errors caused by early
 
1181
# closing of the splash window:
 
1182
#
 
1183
proc updateStatusBar {} {}
 
1184
 
 
1185
# Start up splash screen:
 
1186
 
 
1187
set ::splash::autoclose 1
 
1188
 
 
1189
proc ::splash::make {} {
 
1190
  wm withdraw .
 
1191
  set w [toplevel .splash]
 
1192
  wm withdraw $w
 
1193
  wm protocol $w WM_DELETE_WINDOW [list wm withdraw $w]
 
1194
  wm title $w "Welcome to Scid $::scidVersion"
 
1195
  ttk::frame $w.f
 
1196
  ttk::frame $w.b
 
1197
  text $w.t -height 15 -width 60 -cursor top_left_arrow \
 
1198
      -background white -font font_Regular -wrap word \
 
1199
      -yscrollcommand [list $w.ybar set] -setgrid 1
 
1200
  ttk::scrollbar $w.ybar -command [list $w.t yview]
 
1201
  ttk::checkbutton $w.auto -text "Auto-close after startup" -variable ::splash::autoclose -style Small.TCheckbutton ;# -pady 5 -padx 5
 
1202
  ttk::button $w.dismiss -text Close -width 8 -command [list wm withdraw $w] -style Small.TButton
 
1203
  pack $w.f -side top -expand yes -fill both
 
1204
  pack $w.b -side top -fill x
 
1205
  pack $w.auto -side left -in .splash.b -pady 2 -ipadx 10 -padx 10
 
1206
  pack $w.dismiss -side right -in .splash.b -pady 2 -ipadx 10 -padx 10
 
1207
  pack $w.ybar -in $w.f -side right -fill y
 
1208
  pack $w.t -in $w.f -side left -fill both -expand yes
 
1209
  
 
1210
  # Centre the splash window:
 
1211
  update idletasks
 
1212
  set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
 
1213
        - [winfo vrootx .]}]
 
1214
  set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
 
1215
        - [winfo vrooty .]}]
 
1216
  wm geom $w +$x+$y
 
1217
 
 
1218
  # Show the startup window by default
 
1219
  wm deiconify $w
 
1220
  
 
1221
  bind $w <F1> {helpWindow Index}
 
1222
  bind $w <Escape> {.splash.dismiss invoke}
 
1223
  
 
1224
  $w.t tag configure indent -lmargin2 20
 
1225
  
 
1226
  $w.t image create end -image splash
 
1227
  $w.t insert end "Shane's Chess Information Database"
 
1228
}
 
1229
 
 
1230
 
 
1231
# Old Scid logo:
 
1232
image create photo splash -format gif -data \
 
1233
    "R0lGODdhZgAmAMIAAP///6CBUNHBoQAAcAAAAFK4bgAAAAAAACwAAAAAZgAmAAAD/gi63P4w
 
1234
ykkrDThjwTvXmueBmdiRmymggbqirqawMazSt23iuy7KAN7PNyKejB/ki1TDzJTCIjM37VWH
 
1235
moFWiw08r1JQU0wlW83YrXrQ/ZrX8NQ5VKbPSzn4th2E6f9sd3JddoR4PYB8LIB/dYeGg2GF
 
1236
knB8KokccWBHm0mdS2gCmo8KJn+Da1Cqn1Gjg6Uieo+prKoEt4+Sua4tHbAdp6hqq6Ent8eR
 
1237
nKG8Hr+ZssJbRMG9JsfX1YZrosy+ALHQ2dxaNozSLtfITea0pN8ejOLKWex7Kum4NfXDhc7P
 
1238
mJAaBdCDDp+8f2oKgOPnjkS9YsHGtcuADxmKSqAGbgvj/gbDvgG5JPITKU1DRWwgCGbEqKyj
 
1239
x4/iqJEkZ/IkrpQbV+b05KWPw48L280kYfNmBpU61Sgqtw9eOIRsiBbFmZOqvZY+0dRzOmoM
 
1240
xZM/q9JTyjHrpJk5ZToKYDMs2aRXebpMBjXtU0dFCVi9ujcQ1qBMRzXiOSnvLa4Mg9J0B3gK
 
1241
tcEZHxk+BgyaYpD93lUuSSecRpVCJh+uS/MyGn8TU3hmFFljB9EENscxnVkxE2ovcX8OBHs0
 
1242
Wi6kT2uuO5ZXbqACescm/bA24qYXPwJX/hwm4+rmCJdAnrz3CNa/X5k9DuisJ/BLlNtJjQlI
 
1243
lHkhtdNtfZC+1/ig5tZ/L38/GjHz9pWh333z8RegIP7V4oQFDDbo4IMQLpAAADs="
 
1244
 
 
1245
# New Scid logo:
 
1246
image create photo splash -format gif -data {
 
1247
  R0lGODlhZAAtAOcAAAICAj0+QJGGb04/KaSYf2dRNRElfraid3ddOBoYFcCyk4ZuRjs/XgsX
 
1248
  RIpuRY12Usm6kyk+nWZunlJWli4yPj0zIgcPNI2Ba2tkc9bKsU9MaRo4vZaKdHeCvgIJK82+
 
1249
  nicuTStDrVhTRCUhHiQ3hQ4eZmZaZgULJpqXl7aqjktFVDtRsRQSDJmOd5l+U3Z6mIKJs21l
 
1250
  U9bGnio0YBIqnpKCZiInQx04rUxLR5JvRKqWY5R2SzY/dHpiPRksfqaOXR0+yEZLdDcuIdLC
 
1251
  mnZpaxAODBEWKXJeOoiKniNBw5t2R3pwXRwqbLCkjRwiQoJiPLGZb6GHV4R6Z0FSnlxLL8ay
 
1252
  jZ6Sejc4REpESMaugxQslBYiUlhXcCouViI4mkBIf46MmigoOA4bWZ5+T2xYN7qtmUc6Jryk
 
1253
  eGpwlqCRdhsZINbGonJuZDRBfi8qJTk6Z3dqWi5CnzlX1FJanlpGLR8ygy1Hu83CpVZTVhYk
 
1254
  YJp6S1NORb6qhTpKjNLGqQIGIrCefKmGVkxCPDAyOhQeTHFqXqqegqJ6THtyb6J+TZZ6XEJF
 
1255
  VhkcMmpePruukjk5V15ejqOCTiUmMrKkhsm6ntLCnqKaiZZxQic1bg4mlGxYRAoKCraaa8a2
 
1256
  nNLCoqyOYSQ3kTRGkMG1nzoyLhEjb866laJ+UmJibnppTyIuXlxqsAgPLmJSQYJ+gAwYT05M
 
1257
  VBoymaiKWjIuMnJYNSsmIqSSci1JyoZwXNrGpk9CNjw3NEZGRpqCVFhciB0nVDZJnBk6ztbG
 
1258
  rp56ShoyjoVpQ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IOs8LIw3Lk3
 
1326
  eoGp4WkYkYCVQ6MQF/MBwZAr3xkQADs=
 
1327
}
 
1328
 
 
1329
::splash::make
 
1330
 
 
1331
proc ::splash::add {text} {
 
1332
  if {! [winfo exists .splash]} {return}
 
1333
  .splash.t configure -state normal
 
1334
  .splash.t insert end "\n$text" indent
 
1335
  .splash.t see end
 
1336
  .splash.t configure -state disabled
 
1337
  update
 
1338
}
 
1339
 
 
1340
::splash::add "Copyright (C) 1999-2004 Shane Hudson"
 
1341
::splash::add "Copyright (C) 2006-2009 Pascal Georges"
 
1342
::splash::add "Copyright (C) 2010-     The Scid Project"
 
1343
::splash::add "This is Scid $::scidVersion, released $::scidVersionDate."
 
1344
::splash::add "Website: http://scid.sourceforge.net\n"
 
1345
 
 
1346
# Remember old font settings before loading options file:
 
1347
set fontOptions(oldRegular) $fontOptions(Regular)
 
1348
set fontOptions(oldMenu) $fontOptions(Menu)
 
1349
set fontOptions(oldSmall) $fontOptions(Small)
 
1350
set fontOptions(oldTiny) $fontOptions(Tiny)
 
1351
set fontOptions(oldFixed) $fontOptions(Fixed)
 
1352
 
 
1353
# New configuration file names:
 
1354
set scidConfigFiles(options) "options.dat"
 
1355
set scidConfigFiles(engines) "engines.dat"
 
1356
set scidConfigFiles(engines.bak) "engines.dat"
 
1357
set scidConfigFiles(recentfiles) "recent.dat"
 
1358
set scidConfigFiles(history) "history.dat"
 
1359
set scidConfigFiles(bookmarks) "bookmarks.dat"
 
1360
set scidConfigFiles(reports) "reports.dat"
 
1361
set scidConfigFiles(optrainer) "optrainer.dat"
 
1362
set scidConfigFiles(resolvers) "resolvers.dat"
 
1363
 
 
1364
# scidConfigFile:
 
1365
#   Returns the full path and name of a Scid configuration file,
 
1366
#   given its configuration type.
 
1367
#
 
1368
proc scidConfigFile {type} {
 
1369
  global scidConfigDir scidConfigFiles
 
1370
  if {! [info exists scidConfigFiles($type)]} {
 
1371
    return -code error "No such config file type: $type"
 
1372
  }
 
1373
  return [file nativename [file join $scidConfigDir $scidConfigFiles($type)]]
 
1374
}
 
1375
 
 
1376
# Create user ".scid" directory in Unix if necessary:
 
1377
# Since the options file used to be ".scid", rename it:
 
1378
if {! [file isdirectory $scidUserDir]} {
 
1379
  if {[file isfile $scidUserDir]} {
 
1380
    catch {file rename -force $scidUserDir "$scidUserDir.old"}
 
1381
  }
 
1382
  if {[catch {file mkdir $scidUserDir} err]} {
 
1383
    ::splash::add "Error creating ~/.scid directory: $err"
 
1384
  } else {
 
1385
    catch {file rename "$scidUserDir.old" $optionsFile}
 
1386
  }
 
1387
  # Rename old "~/.scid_sent_emails" if necessary:
 
1388
  if {[file isfile [file nativename "~/.scid_sent_emails"]]} {
 
1389
    catch {file rename [file nativename "~/.scid_sent_emails"] $email(logfile)}
 
1390
  }
 
1391
}
 
1392
 
 
1393
# Create the config, data and log directories if they do not exist:
 
1394
proc makeScidDir {dir} {
 
1395
  if {! [file isdirectory $dir]} {
 
1396
    if {[catch {file mkdir $dir} err]} {
 
1397
      ::splash::add "Error creating directory $dir: $err"
 
1398
    } else {
 
1399
      ::splash::add "Created directory: $dir"
 
1400
    }
 
1401
  }
 
1402
}
 
1403
 
 
1404
makeScidDir $scidConfigDir
 
1405
makeScidDir $scidDataDir
 
1406
makeScidDir $scidLogDir
 
1407
 
 
1408
# Rename old email log file if necessary:
 
1409
if {[file readable $email(oldlogfile)]  &&  ![file readable $email(logfile)]} {
 
1410
  catch {file rename $email(oldlogfile) $email(logfile)}
 
1411
}
 
1412
 
 
1413
# moveOldConfigFiles
 
1414
#   Moves configuration files from the old (3.4 and earlier) names
 
1415
#   to the new file names used since Scid 3.5.
 
1416
#
 
1417
proc moveOldConfigFiles {} {
 
1418
  global scidUserDir scidConfigDir
 
1419
  foreach {oldname newname} {
 
1420
    scidrc options.dat
 
1421
    scid.opt options.dat
 
1422
    scid.bkm bookmarks.dat
 
1423
    scid.rfl recentfiles.dat
 
1424
    engines.lis engines.dat
 
1425
  } {
 
1426
    set oldpath [file nativename [file join $scidUserDir $oldname]]
 
1427
    set newpath [file nativename [file join $scidConfigDir $newname]]
 
1428
    if {[file readable $oldpath]  &&  ![file readable $newpath]} {
 
1429
      if {[catch {file rename $oldpath $newpath} err]} {
 
1430
        ::splash::add "Error moving $oldpath to $newpath: $err"
 
1431
      } else {
 
1432
        ::splash::add "Moved old config file $oldname to $newpath"
 
1433
      }
 
1434
    }
 
1435
  }
 
1436
}
 
1437
 
 
1438
moveOldConfigFiles
 
1439
 
 
1440
set optionsFile [scidConfigFile options]
 
1441
 
 
1442
set ecoFile ""
 
1443
 
 
1444
################################################################################
 
1445
#  Load options file. All default values should be set before this point or new saved values will be overwritten by default ones
 
1446
################################################################################
 
1447
if {[catch {source $optionsFile} ]} {
 
1448
  #::splash::add "Unable to find the options file: [file tail $optionsFile]"
 
1449
} else {
 
1450
  ::splash::add "Your options file \"[file tail $optionsFile]\" was found and loaded."
 
1451
}
 
1452
 
 
1453
set ::docking::USE_DOCKING $windowsDock
 
1454
 
 
1455
# depending on the docking mode, change the definition of window "." (ie main window)
 
1456
if {$::docking::USE_DOCKING} {
 
1457
  set dot_w "."
 
1458
} else  {
 
1459
  set dot_w ".main"
 
1460
}
 
1461
 
 
1462
# Now, if the options file was written by Scid 3.5 or older, it has a lot of
 
1463
# yucky variable names in the global namespace. So convert them to the new
 
1464
# namespace variables:
 
1465
#
 
1466
proc ConvertOldOptionVariables {} {
 
1467
  
 
1468
  set oldNewNames {
 
1469
    autoCloseSplash ::splash::autoclose
 
1470
    switcherVertical ::windows::switcher::vertical
 
1471
    doColorPgn ::pgn::showColor
 
1472
    pgnIndentVars ::pgn::indentVars
 
1473
    pgnIndentComments ::pgn::indentComments
 
1474
    pgnShortHeader ::pgn::shortHeader
 
1475
    pgnMoveFont ::pgn::boldMainLine
 
1476
    pgnMoveNumSpace ::pgn::moveNumberSpaces
 
1477
    pgnStripMarks ::pgn::stripMarks
 
1478
    pgnSymbolicNags ::pgn::symbolicNags
 
1479
    pgnColumn ::pgn::columnFormat
 
1480
  }
 
1481
  
 
1482
  foreach {old new} $oldNewNames {
 
1483
    if {[info exists ::$old]} {
 
1484
      set $new [set ::$old]
 
1485
    }
 
1486
  }
 
1487
}
 
1488
 
 
1489
ConvertOldOptionVariables
 
1490
 
 
1491
 
 
1492
# Reconfigure fonts if necessary:
 
1493
foreach i {Regular Menu Small Tiny Fixed} {
 
1494
  if {$fontOptions($i) == $fontOptions(old$i)} {
 
1495
    # Old font format in options file, or no file. Extract new options:
 
1496
    set fontOptions($i) {}
 
1497
    lappend fontOptions($i) [font actual font_$i -family]
 
1498
    lappend fontOptions($i) [font actual font_$i -size]
 
1499
    lappend fontOptions($i) [font actual font_$i -weight]
 
1500
    lappend fontOptions($i) [font actual font_$i -slant]
 
1501
  } else {
 
1502
    # New font format in options file:
 
1503
    configureFont $i
 
1504
  }
 
1505
}
 
1506
 
 
1507
# Check board size is valid:
 
1508
set newSize [lindex $boardSizes 0]
 
1509
foreach sz $boardSizes {
 
1510
  if {$boardSize >= $sz} { set newSize $sz }
 
1511
}
 
1512
set boardSize $newSize
 
1513
 
 
1514
# Load theme
 
1515
ttk::style theme use $::lookTheme
 
1516
 
 
1517
# Use default font everywhere
 
1518
ttk::style configure TLabel -font font_Regular
 
1519
ttk::style configure TButton -font font_Regular
 
1520
ttk::style configure TRadiobutton -font font_Regular
 
1521
ttk::style configure TCheckbutton -font font_Regular
 
1522
ttk::style configure TMenubutton -font font_Regular
 
1523
ttk::style configure TCombobox -font font_Regular
 
1524
ttk::style configure TEntry -font font_Regular
 
1525
 
 
1526
# Style definitions
 
1527
ttk::style configure Bold.TCheckbutton -font font_Bold
 
1528
ttk::style configure Small.TCheckbutton -font font_Small
 
1529
 
 
1530
ttk::style configure Small.TButton -font font_Small
 
1531
ttk::style configure Bold.TButton -font font_Bold
 
1532
ttk::style configure Pad0.Small.TButton -padding 0
 
1533
 
 
1534
ttk::style configure Small.TRadiobutton -font font_Small
 
1535
ttk::style configure Regular.TRadiobutton -font font_Regular
 
1536
ttk::style configure Bold.TRadiobutton -font font_Bold
 
1537
ttk::style configure SmallBold.TRadiobutton -font font_SmallBold
 
1538
 
 
1539
ttk::style configure pad0.TMenubutton -padding 0 -indicatorwidth 0 -indicatorheight 0  -font font_Small
 
1540
 
 
1541
# Check for old (single-directory) tablebase option:
 
1542
if {[info exists initialDir(tablebase)]} {
 
1543
  set initialDir(tablebase1) $initialDir(tablebase)
 
1544
}
 
1545
 
 
1546
# font_Regular is the default font for widgets:
 
1547
option add *Font font_Regular
 
1548
 
 
1549
# Use font_Menu for menu entries:
 
1550
option add *Menu*Font font_Menu
 
1551
# option add *Menubutton*Font font_Menu
 
1552
 
 
1553
if {$unixOS} {
 
1554
  option add Scrollbar*borderWidth 1
 
1555
}
 
1556
 
 
1557
# Set the radiobutton and checkbutton background color if desired.
 
1558
# I find the maroon color on Unix ugly!
 
1559
if {$unixOS} {
 
1560
  option add *Radiobutton*selectColor $buttoncolor
 
1561
  option add *Checkbutton*selectColor $buttoncolor
 
1562
  option add *Menu*selectColor $buttoncolor
 
1563
}
 
1564
 
 
1565
set fontsize [font configure font_Regular -size]
 
1566
set font [font configure font_Regular -family]
 
1567
 
 
1568
font create font_Bold -family $font -size $fontsize -weight bold
 
1569
font create font_BoldItalic -family $font -size $fontsize -weight bold \
 
1570
    -slant italic
 
1571
font create font_Italic -family $font -size $fontsize -slant italic
 
1572
font create font_H1 -family $font -size [expr {$fontsize + 8} ] -weight bold
 
1573
font create font_H2 -family $font -size [expr {$fontsize + 6} ] -weight bold
 
1574
font create font_H3 -family $font -size [expr {$fontsize + 4} ] -weight bold
 
1575
font create font_H4 -family $font -size [expr {$fontsize + 2} ] -weight bold
 
1576
font create font_H5 -family $font -size [expr {$fontsize + 0} ] -weight bold
 
1577
 
 
1578
set fontsize [font configure font_Small -size]
 
1579
set font [font configure font_Small -family]
 
1580
font create font_SmallBold -family $font -size $fontsize -weight bold
 
1581
font create font_SmallItalic -family $font -size $fontsize -slant italic
 
1582
 
 
1583
# Start in the clipbase, if no database is loaded at startup.
 
1584
sc_base switch clipbase
 
1585
 
 
1586
###
 
1587
### End of file: start.tcl