11 set waitBetweenMessages 0
17 set serial $::ExtHardware::port
22 pack [ttk::panedwindow $w.f -orient vertical] -expand 1 -fill both
25 ttk::frame $w.f.bottom
26 $w.f add $w.f.top -weight 1
27 $w.f add $w.f.bottom -weight 1
29 ttk::scrollbar $w.f.top.ysc -command { .novag.f.top.output yview }
30 text $w.f.top.output -width 20 -height 20 -wrap word -yscrollcommand ".novag.f.top.ysc set"
31 pack $w.f.top.ysc -side left -fill y -side right
32 pack .novag.f.top.output -side left -fill both -expand 1 -side right
34 entry $w.f.bottom.input -width 20
35 ttk::button $w.f.bottom.send -text Send -command {
36 ::novag::send [.novag.f.bottom.input get]
37 .novag.f.bottom.input delete 0 end
39 bind $w.f.bottom.input <Return> " $w.f.bottom.send invoke "
40 bind $w <Destroy> { catch ::novag::disconnect }
41 bind $w <F1> { helpWindow Novag}
44 ttk::checkbutton $w.f.bottom.cbref -text [
tr "NovagReferee"] -variable ::novag::referee -offvalue "OFF" -onvalue "ON" -command { ::novag::send "U $::novag::referee" }
46 pack $w.f.top.output -fill both -expand 1
47 pack $w.f.bottom.input $w.f.bottom.send $w.f.bottom.cbref -side left
53 if {[
catch {
set fd [open $serial r+]} err]} {
54 tk_messageBox -type ok -icon error -parent . -title "Novag Citrine" -message "Connection error for $serial \n $err"
60 fconfigure $fd -mode 57600,n,8,1 -blocking 0 -buffering line
61 fileevent $fd readable ::novag::recv
72 set ::novag::connected 1
81 set ::novag::connected 0
87 if {[
string length $san] == 5} {
88 set san "[
string range $san 0 3]/[
string range $san 4 end]"
92 if { [
string first "x" [
sc_game info previousMove]] != -1 } {
109 set output .novag.f.top.output
112 if { $l == "" } {
return}
113 $output insert end "$l\n"
114 $output yview moveto 1
116 if {[
string match -nocase "New Game*" $l]} {
123 if {[
lindex $l 0] == "M"} {
125 if {[
sc_pos side] == "white" && [
string index [
lindex $l 1] end] == ","} {
return}
126 if {[
sc_pos side] == "black" && [
string index [
lindex $l 1] end] != ","} {
return}
129 set m [regsub -- "-" $m ""]
130 set m [regsub -- "/" $m ""]
131 if { [
catch {
sc_move addSan $m} err] } {
134 if {[
winfo exists .fics]} {
135 if { $::fics::playing == 1} {
144 if {[
lindex $l 0] == "T"} {
153 after $ms {set ::novag::waitBetweenMessages 1}
154 vwait ::novag::waitBetweenMessages