3
# Scid (Shane's Chess Information Database)
5
# Copyright (C) 1999-2004 Shane Hudson. All rights reserved.
7
# This is freely redistributable software; see the file named "COPYING"
8
# or "copying.txt" that came with this program.
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
17
# The following few comments are only for Unix versions of Scid:
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" "$@"
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.:
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
36
############################################################
38
# Alter the version if any patches have been made to the Tcl code only:
40
set scidVersionDate "February 2011"
42
package require Tcl 8.5
43
package require Tk 8.5
46
# Determine operating system platform: unix, windows or macos
49
if {$tcl_platform(platform) == "windows"} { set windowsOS 1 }
51
if {$tcl_platform(platform) == "unix"} { set unixOS 1 }
53
if {![catch {tk windowingsystem} wsystem] && $wsystem == "aqua"} { set macOS 1 }
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.
58
if {(! $windowsOS) && (! $unixOS)} {
59
# What to do here? Warn the user...?
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.
66
if {[string compare [sc_info version] $scidVersion]} {
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"
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."
76
tk_messageBox -type ok -icon error -title "Scid: Version Error" -message $msg
80
#############################################################
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.
91
::utils::date ::utils::font ::utils::history ::utils::pane ::utils::string
92
::utils::sound ::utils::validate ::utils::win
94
::file::finder ::file::maint ::maint
100
::search::filter ::search::board ::search::header ::search::material
102
::windows::gamelist ::windows::stats ::tree ::tree::mask ::windows::tree
103
::windows::switcher ::windows::eco ::crosstab ::pgn ::book
105
::tools::analysis ::tools::email
107
::tools::graphs::filter ::tools::graphs::absfilter ::tools::graphs::rating ::tools::graphs::score
110
::tacgame ::sergame ::opening ::tactics ::calvar ::uci ::fics ::reviewgame ::novag
115
namespace eval $ns {}
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
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) {}
143
### Tree/mask options:
144
set ::tree::mask::recentMask {}
146
#############################################################
147
# Customisable variables:
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]]]
159
set scidExeDir [file dirname $scidExecutable]
162
# scidUserDir: location of user-specific Scid files.
163
# This is "~/.scid" on Unix, and the Scid exectuable dir on Windows.
165
set scidUserDir $scidExeDir
167
set scidUserDir [file nativename "~/.scid"]
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"]]
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]
180
#load textures for lite and dark squares
181
set boardfile_dark "emptySquare"
182
set boardfile_lite "emptySquare"
184
#[file join $scidExeDir "bitmaps" "empty.gif"] ;# wsquare.gif
186
# boardSize: Default board size. See the available board sizes above.
189
# boardStyle: Default board piece set. See bitmaps.tcl for styles.
192
# language for help pages and messages:
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
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
204
set toolbar($tbicon) $status
207
# boardCoords: 1 to show board Coordinates, 0 to hide them.
210
# boardSTM: 1 to show side-to-move icon, 0 to hide it.
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]
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]
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]
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]
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]
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
266
# Analysis command: to start chess analysis engine.
267
set analysisCommand ""
269
set analysisChoices {wcrafty.exe}
271
set analysisChoices {crafty}
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"
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"
291
set ::tactics::analysisTime 3
292
set ::tactics::findBestMoveRunning 0
293
array set ::tactics::findBestMove_History {}
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"
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
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"
344
set ::commenteditor::showboard 1
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]
356
# Defaults for Novag Citrine
357
set ::novag::referee "OFF"
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 ]
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) ""
391
# glistSize: Number of games displayed in the game list window
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
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
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} {
412
for {set b 1} {$b<=[sc_base count total]} {incr b} {
413
foreach i { .treeWin .treeBest .treeGraph } {
419
# Default PGN window size:
420
set winWidth(.pgnWin) 65
421
set winHeight(.pgnWin) 20
423
# Default help window size:
424
set winWidth(.helpWin) 50
425
set winHeight(.helpWin) 32
427
# Default stats window size:
428
set winWidth(.statsWin) 60
429
set winHeight(.statsWin) 13
431
# Default crosstable window size:
432
set winWidth(.crosstabWin) 65
433
set winHeight(.crosstabWin) 15
435
# Default tree window size:
436
set winWidth(.treeWin) 58
437
set winHeight(.treeWin) 20
439
# Default comment editor size:
440
set winWidth(.commentWin) 40
441
set winHeight(.commentWin) 6
443
# Default spellcheck results window size:
444
set winWidth(.spellcheckWin) 55
445
set winHeight(.spellcheckWin) 25
447
# Default player info window size:
448
set winWidth(.playerInfoWin) 45
449
set winHeight(.playerInfoWin) 20
451
# Default switcher window size:
452
set winWidth(.baseWin) 310
453
set winHeight(.baseWin) 110
455
# Default Correspondence Chess window size:
456
set winWidth(.ccWindow) 10
457
set winHeight(.ccWindow) 20
459
# Default size for input engine console:
460
###---### needs adjustment!
461
set winWidth(.inputengineconsole) 10
462
set winHeight(.inputengineconsole) 20
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)]
471
# Default stats window lines:
472
array set ::windows::stats::display {
495
# Default PGN display options:
497
set pgnStyle(Comments) 1
501
# Default Tree sort method:
502
set tree(order) frequency
504
# Auto-save tree cache when closing tree window:
507
# Auto-save options when exiting:
508
set optionsAutoSave 1
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) ".,"
514
# Ask for piece translations (first letter)
515
set translatePieces 1
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
523
# Ask before replacing existing moves: on by default
524
set askToReplaceMoves 1
526
# Show suggested moves: on by default
529
# Show variations popup window
532
# Keyboard Move entry options:
534
set moveEntry(AutoExpand) 0
535
set moveEntry(Coord) 1
537
# Autoplay and animation delays in milliseconds:
538
set autoplayDelay 5000
542
set blunderThreshold 1.0
544
# Geometry of windows:
545
array set geometry {}
548
set ::lookTheme "default"
551
# Stores which windows should be opened on startup.
553
set startup(switcher) 0
556
set startup(finder) 0
557
set startup(crosstable) 0
558
set startup(gamelist) 0
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)
567
# element 4: true if a separator field should follow
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.
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 }
586
{ m 3 right black 1 }
587
{ o 5 left darkGreen 0 }
588
{ O 6 left darkGreen 1 }
593
{ S 1 left darkRed 0 }
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 }
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.
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
617
set gameInfo(fullComment) 0
618
set gameInfo(showTB) 0
619
if {[sc_info tb]} { set gameInfo(showTB) 2 }
621
# Twin deletion options:
623
array set twinSettings {
643
array set twinSettingsDefaults [array get twinSettings]
645
# Opening report options:
667
array set optableDefaults [array get optable]
669
# Player report options
674
MostFrequentOpponents 6
678
MostFrequentEcoCodes 6
684
array set preportDefaults [array get preport]
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
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) {}
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.
719
\usepackage[T1]{fontenc}
721
\setlength{\columnsep}{7mm}
722
\setlength{\parindent}{0pt}
724
% Macros for variations and diagrams:
725
\newenvironment{variation}{\begin{quote}}{\end{quote}}
726
\newenvironment{diagram}{\begin{nochess}}{$$\showboard$$\end{nochess}}
730
set default_exportEndFile(LaTeX) {\end{document}
734
set default_exportStartFile(HTML) {<html>
735
<head><title>Scid export</title></head>
736
<body bgcolor="#ffffff">
738
set default_exportEndFile(HTML) {</body>
742
foreach type {PGN HTML LaTeX} {
743
set exportStartFile($type) $default_exportStartFile($type)
744
set exportEndFile($type) $default_exportEndFile($type)
748
# ::windows::switcher::vertical
750
# If 1, Switcher frames are arranged vertically.
752
set ::windows::switcher::vertical 0
753
set ::windows::switcher::icons 1
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.
765
if {$autoRaise} { raise $w }
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.
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)
784
# The game info panel below the main board
788
# Automatic loading of layout # 1 at startup (docked windows mode only)
792
# resize the board to fit the container
793
set autoResizeBoard 1
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 ]} ]} {
809
# if target is main board, update the global window instead
810
if { $w == ".main" && $title != [ ::tr "Board" ] } {
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]
817
$nb tab $f -text $title
821
set wdock ".fdock[string range $w 1 end]"
822
if { [winfo exists $wdock ] } { set w $wdock }
827
################################################################################
828
# Creates a toplevel window depending of the docking option
829
################################################################################
830
proc createToplevel { w } {
831
set name [string range $w 1 end]
834
# Raise window if already exist
835
if { [winfo exists $w] } {
836
if {! $::docking::USE_DOCKING } {
839
if { [::docking::isUndocked $w] } {
842
[::docking::find_tbn $f] select $f
845
return "already_exists"
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
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 == "." } {
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"]
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
887
################################################################################
888
# In docked mode, resize board automatically
889
################################################################################
890
proc resizeMainBoard {} {
891
# puts "resizeMainBoard [clock clicks -milliseconds]"
892
if { ! $::docking::USE_DOCKING } { return }
894
bind .main <Configure> {}
896
set w [winfo width .main]
897
set h [winfo height .main]
900
# calculate available height
902
incr height_used [ lindex [grid bbox .main 0 0] 3]
903
incr height_used [ lindex [grid bbox .main 0 1] 3] ;# buttons
905
if { $::board::_coords($bd) == 2 || $::board::_coords($bd) == 0} {
906
incr height_used [ lindex [ grid bbox $bd 0 9 ] 3 ]
908
if { $::board::_coords($bd) == 0 } {
909
incr height_used [ lindex [ grid bbox $bd 0 0 ] 3 ]
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]
923
# utter approximation
924
set game_info_line_height [expr [font configure font_Regular -size] * 1.5]
926
set min_game_info_height [expr int($min_game_info_lines * $game_info_line_height + 6)]
928
incr height_used $min_game_info_height
931
incr height_used [ lindex [grid bbox .main 0 5] 3]
933
set availh [expr $h - $height_used -10]
935
# calculate available width
937
if { $::board::_coords($bd) == 2 || $::board::_coords($bd) == 0} {
938
incr width_used [ lindex [ grid bbox $bd 0 1 ] 2 ]
940
if { $::board::_coords($bd) == 0 } {
941
incr width_used [ lindex [ grid bbox $bd 9 1 ] 2 ]
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 ]
947
if {$::board::_showmat($bd)} {
948
incr width_used [ lindex [ grid bbox $bd 12 1 ] 2 ]
950
set availw [expr $w - $width_used ]
952
if {$availh < $availw} {
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 ] } {
964
set newSize [lindex $::boardSizes [expr $i -1] ]
970
::board::resize2 .main.board $newSize
971
set ::boardSize $newSize
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]
979
.main.gameInfo configure -height $new_game_info_lines
982
bind .main <Configure> { ::docking::handleConfigureEvent ::resizeMainBoard }
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
990
grid forget .main.gameInfoFrame
996
################################################################################
998
# Email configuration:
999
set email(logfile) [file join $scidLogDir "scidmail.log"]
1000
set email(oldlogfile) [file join $scidUserDir "scidmail.log"]
1002
set email(smproc) "/usr/lib/sendmail"
1003
set email(server) localhost
1008
### Audio move announcement options:
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
1015
# Spell-checking file: default is "spelling.ssp".
1017
set spellCheckFile [file join $scidDataDir "spelling.ssp"]
1019
set spellCheckFile "/usr/share/scid/data/spelling.ssp"
1022
# book configuration
1023
set ::book::lastBook "" ; # book name without extension (.bin)
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"]
1030
set engines(list) {}
1031
set engines(sort) Time
1036
set iconFileDirs [list \
1037
$scidExeDir [file join $scidExeDir "../share/scid"]]
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
1049
# Set up Scid icon in Windows:
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"]]
1055
foreach iconFileDir $iconFileDirs {
1056
set scidIconFile [file join $iconFileDir "scid.ico"]
1057
if {[file readable $scidIconFile]} {
1058
catch {wm iconbitmap . -default $scidIconFile}
1063
# Reversed mouse buttons in mac (::MB2 and ::MB3 are middle and right mouse buttons respectively.):
1073
# Opening files by drag & drop on Scid icon on Mac
1077
set isopenBaseready 0
1080
proc dragndrop {args} {
1082
global isopenBaseready
1085
# Un-nest arguments:
1086
set args [join $args]
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."
1095
# Save file names for later use:
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."
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
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."
1127
if {[file extension $file] == ".sem"} {
1131
# SearchOptions file:
1132
if {[file extension $file] == ".sso"} {
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"
1138
switch -- $::searchType {
1139
"Material" { ::search::material }
1140
"Header" { ::search::header }
1141
default { continue }
1147
# Scid doesn't handle well .sg4 and .sn4 files.
1148
if {([file extension $file] == ".sg4") || \
1149
([file extension $file] == ".sn4")} {
1151
set fName [file rootname $file]
1152
set file "$fName$eName"
1154
# Scid doesn't handle well .sg3 and .sn3 files.
1155
if {([file extension $file] == ".sg3") || \
1156
([file extension $file] == ".sn3")} {
1158
set fName [file rootname $file]
1159
set file "$fName$eName"
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."
1167
# All seems good, let's open those files:
1168
catch {::file::Open $file} errmsg
1174
proc tkOpenDocument {args} {
1175
after idle [list dragndrop $args]
1177
rename tkOpenDocument ::tk::mac::OpenDocument
1180
# Add empty updateStatusBar proc to avoid errors caused by early
1181
# closing of the splash window:
1183
proc updateStatusBar {} {}
1185
# Start up splash screen:
1187
set ::splash::autoclose 1
1189
proc ::splash::make {} {
1191
set w [toplevel .splash]
1193
wm protocol $w WM_DELETE_WINDOW [list wm withdraw $w]
1194
wm title $w "Welcome to Scid $::scidVersion"
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
1210
# Centre the splash window:
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 .]}]
1218
# Show the startup window by default
1221
bind $w <F1> {helpWindow Index}
1222
bind $w <Escape> {.splash.dismiss invoke}
1224
$w.t tag configure indent -lmargin2 20
1226
$w.t image create end -image splash
1227
$w.t insert end "Shane's Chess Information Database"
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="
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
rp56ShoyjoVpQaqSYsm2j46KinJ6vrKec7Gmgi4/iop5Z2JOMREmj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QlSmgDJPQBJNwlimgABAwDXcQETeXIHowZRM4gdmwA014b9bgCIbQAgLQl375l31Z
1316
AyJJAKKgAGkRFTnXNvowMzuQcw9wCQ6ANsIADW9xfmwhEBOJH06BENYyE0OQEHcAESipIAbC
1317
LYIjegOhBInQhxDQCcbwmrAZm9NgDBAAAZTgB9PwAwnCLZKjIR/CFekHIpW5EKCzlbzSFApz
1318
nFryDclQJ+7yFbxwETsHE5p5B9Z5ndfZFDD+cQcZgBZ2siQk850Jkn6hwxTnpwctoQeKkQXB
1319
8HrBkBDv6Qnt2Z7y2Z6vdyE60BJKgJ4Nsp/9ySMA2iB/VwqvlxBbcqAIuiVrUKAZ0AlR0CA7
1320
IAwSOm36qXPoqZ9MMZ9r4AeHcAim4KGx4CnYOaIkmp3W8AmHoDYpqhIrqjaJIAxHYgo60Akl
1321
WqPY+QHlcCWJcAgTOgYrGiPC0KGHsKOBgDAjGptOkgzgtaRM2qRNKl5ZEJtSagxVUAWwaaWv
1322
+QHGoANO2qVOGgXFMKWxaaVYeqXGUAp84KQL4QfZEZHk2T86QZ6hYwp80SYkwjoMwTo2UQzp
1323
5zuJ8KeACqh0aierhCMiQ9AiUDIih1odCnEin5AIdGoKifA0D8ElBLIhEYloS8MjPuIU22ky
1324
6tUwQVIJ34Ah3SSpgXqZH6INMcKqTQMhnBk0+PE0JqIAKSKpAhE0GZAMUdCqCqJDXTMgDcIH
1325
sAMvnAk1yBoM7KEWv9olFXN+Q0OdoJIB6WAoS1IhLUJBvTogUPGrS3MR5REuQIOs8LIw3Lk3
1326
eoGp4WkYkYCVQ6MQF/MBwZAr3xkQADs=
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
1336
.splash.t configure -state disabled
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"
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)
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"
1365
# Returns the full path and name of a Scid configuration file,
1366
# given its configuration type.
1368
proc scidConfigFile {type} {
1369
global scidConfigDir scidConfigFiles
1370
if {! [info exists scidConfigFiles($type)]} {
1371
return -code error "No such config file type: $type"
1373
return [file nativename [file join $scidConfigDir $scidConfigFiles($type)]]
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"}
1382
if {[catch {file mkdir $scidUserDir} err]} {
1383
::splash::add "Error creating ~/.scid directory: $err"
1385
catch {file rename "$scidUserDir.old" $optionsFile}
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)}
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"
1399
::splash::add "Created directory: $dir"
1404
makeScidDir $scidConfigDir
1405
makeScidDir $scidDataDir
1406
makeScidDir $scidLogDir
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)}
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.
1417
proc moveOldConfigFiles {} {
1418
global scidUserDir scidConfigDir
1419
foreach {oldname newname} {
1421
scid.opt options.dat
1422
scid.bkm bookmarks.dat
1423
scid.rfl recentfiles.dat
1424
engines.lis engines.dat
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"
1432
::splash::add "Moved old config file $oldname to $newpath"
1440
set optionsFile [scidConfigFile options]
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]"
1450
::splash::add "Your options file \"[file tail $optionsFile]\" was found and loaded."
1453
set ::docking::USE_DOCKING $windowsDock
1455
# depending on the docking mode, change the definition of window "." (ie main window)
1456
if {$::docking::USE_DOCKING} {
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:
1466
proc ConvertOldOptionVariables {} {
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
1482
foreach {old new} $oldNewNames {
1483
if {[info exists ::$old]} {
1484
set $new [set ::$old]
1489
ConvertOldOptionVariables
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]
1502
# New font format in options file:
1507
# Check board size is valid:
1508
set newSize [lindex $boardSizes 0]
1509
foreach sz $boardSizes {
1510
if {$boardSize >= $sz} { set newSize $sz }
1512
set boardSize $newSize
1515
ttk::style theme use $::lookTheme
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
1527
ttk::style configure Bold.TCheckbutton -font font_Bold
1528
ttk::style configure Small.TCheckbutton -font font_Small
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
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
1539
ttk::style configure pad0.TMenubutton -padding 0 -indicatorwidth 0 -indicatorheight 0 -font font_Small
1541
# Check for old (single-directory) tablebase option:
1542
if {[info exists initialDir(tablebase)]} {
1543
set initialDir(tablebase1) $initialDir(tablebase)
1546
# font_Regular is the default font for widgets:
1547
option add *Font font_Regular
1549
# Use font_Menu for menu entries:
1550
option add *Menu*Font font_Menu
1551
# option add *Menubutton*Font font_Menu
1554
option add Scrollbar*borderWidth 1
1557
# Set the radiobutton and checkbutton background color if desired.
1558
# I find the maroon color on Unix ugly!
1560
option add *Radiobutton*selectColor $buttoncolor
1561
option add *Checkbutton*selectColor $buttoncolor
1562
option add *Menu*selectColor $buttoncolor
1565
set fontsize [font configure font_Regular -size]
1566
set font [font configure font_Regular -family]
1568
font create font_Bold -family $font -size $fontsize -weight bold
1569
font create font_BoldItalic -family $font -size $fontsize -weight bold \
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
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
1583
# Start in the clipbase, if no database is loaded at startup.
1584
sc_base switch clipbase
1587
### End of file: start.tcl