diff --git a/tcl/board.tcl b/tcl/board.tcl index 59777402d..dac7bb472 100644 --- a/tcl/board.tcl +++ b/tcl/board.tcl @@ -385,18 +385,27 @@ proc ::board::san {sqno} { # Show a pop-up board. # xc and yc are the coordinates of the top-left corner, or the bottom-left # corner if above is not "". -proc ::board::popup {w positionLongStr xc yc {above ""}} { +proc ::board::popup {w positionLongStr xc yc {above ""} {textleft "" } {textright ""}} { set psize 30 if {$psize > $::boardSize} { set psize $::boardSize } if {! [winfo exists $w]} { toplevel $w wm overrideredirect $w 1 + ::applyThemeColor_background $w + ttk::label $w.l + ttk::label $w.r + if { $textleft ne "" || $textright ne "" } { + grid $w.l -sticky w -row 0 -column 0 + grid $w.r -sticky e -row 0 -column 1 + } ::board::new $w.bd $psize - grid $w.bd + grid $w.bd -row 1 -columnspan 2 ::update idletasks } + $w.l configure -text $textleft + $w.r configure -text $textright lassign $positionLongStr pos lastmove ::board::update $w.bd $pos diff --git a/tcl/tools/graphs.tcl b/tcl/tools/graphs.tcl index 0cb6f7870..7f002a673 100644 --- a/tcl/tools/graphs.tcl +++ b/tcl/tools/graphs.tcl @@ -579,10 +579,13 @@ proc MoveTimeList {color add} { proc ::tools::graphs::MoveScoreList { invw invb } { set moveScores { } set mainline { } + set ::tools::graphs::score::Moves { } + set ::tools::graphs::score::Evals [list {}] set base [sc_base current] set gnum [sc_game number] set game [sc_base getGame $base $gnum live] set n [llength $game] + set ::tools::graphs::score::startFen [lindex [lindex $game 0] 2] set movenr 0 for {set i 0} { $i < $n} { incr i } { set RAVd [lindex [lindex $game $i] 0] @@ -590,12 +593,14 @@ proc ::tools::graphs::MoveScoreList { invw invb } { # only search in the mainline if { $RAVd == 0 && $RAVn == 0} { lappend mainline [lindex [lindex $game $i] 4] + lappend ::tools::graphs::score::Moves [lindex [lindex $game $i] 5] } } set movenr 0.0 set side 0 for {set i 1} { $i < $n} { incr i } { set comment [lindex $mainline $i] + lappend ::tools::graphs::score::Evals [getScorefromComment $comment 200] set score [getScorefromComment $comment $::tools::graphs::score::MaxY] if { $score ne "" } { @@ -612,8 +617,8 @@ proc ::tools::graphs::MoveScoreList { invw invb } { proc ::tools::graphs::score::Refresh { {docreate 1 }} { set linecolor red - set firstColor darkgreen - set secondColor blue + set firstColor green + set secondColor dodgerblue3 set linewidth 2 set psize 2 @@ -642,7 +647,8 @@ proc ::tools::graphs::score::Refresh { {docreate 1 }} { -variable ::tools::graphs::score::$i -offvalue "0" -onvalue "1" \ -command "::tools::graphs::score::Refresh" } - canvas $w.c -width 500 -height 300 -selectforeground [ttk::style lookup . -foreground] -background [ttk::style lookup . -background] + canvas $w.c -width 500 -height 300 + applyThemeStyle . $w.c $w.c create text 25 5 -tag text -justify center -width 1 \ -font font_Regular -anchor n @@ -669,6 +675,8 @@ proc ::tools::graphs::score::Refresh { {docreate 1 }} { ::utils::graph::redraw score } bind $w.c <1> {::tools::graphs::score::Move %x} + bind $w.c {::tools::graphs::score::ShowEvalDetails %x %X %Y} + bind $w.c { if {[winfo exists .scorePopup]} {wm withdraw .scorePopup} } wm title $w "Scid: [tr ToolsScore]" ::createToplevelFinalize $w ::tools::graphs::score::ConfigMenus @@ -698,8 +706,8 @@ proc ::tools::graphs::score::Refresh { {docreate 1 }} { } ::utils::graph::create score -width $width -height $height -xtop 25 -ytop 25 \ - -ytick $yticks -xtick 5 -font font_Small -canvas $w.c -textcolor black \ - -hline [list [list gray80 1 each $yticks ]] \ + -ytick $yticks -xtick 5 -font font_Small -canvas $w.c -textcolor [ttk::style lookup $w.c -foreground]\ + -hline [list [list gray80 1 each $yticks ]] -background [ttk::style lookup $w.c -background]\ -vline {{gray80 1 each 1} {steelBlue 1 each 5}} # Create fake dataset with bounds so we see at least -1.0 to 1.0: @@ -710,7 +718,8 @@ proc ::tools::graphs::score::Refresh { {docreate 1 }} { set blackelo [sc_game tag get BlackElo] if {$whiteelo == 0} {set whiteelo ""} else {set whiteelo "($whiteelo)"} if {$blackelo == 0} {set blackelo ""} else {set blackelo "($blackelo)"} - $w.c itemconfigure text -text "[sc_game info white]$whiteelo - [sc_game info black]$blackelo [sc_game info site] [sc_game info date]" + $w.c itemconfigure text -fill [ttk::style lookup $w.c -foreground] \ + -text "[sc_game info white]$whiteelo - [sc_game info black]$blackelo [sc_game info site] [sc_game info date]" busyCursor $w update @@ -756,6 +765,18 @@ proc ::tools::graphs::score::Move {xc} { updateBoard } +proc ::tools::graphs::score::ShowEvalDetails {mc xc yc} { + set x [expr {round([::utils::graph::xunmap score $mc] * 2 + 0.5)} ] + if { $x < 1 || [llength $::tools::graphs::score::Moves] < 2 } { return } + set bd [sc_pos board "position fen $::tools::graphs::score::startFen moves" [lrange $::tools::graphs::score::Moves 0 $x]] + set labelL "[expr int(($x+1) / 2)]. " + if { ! [expr $x % 2] } { append label "... " } + append labelL "[lindex $::tools::graphs::score::Moves $x]" + set labelR "" + set eval [lindex $::tools::graphs::score::Evals $x] + if { $eval ne "" } { set labelR "Eval.: $eval" } + ::board::popup .scorePopup $bd $xc $yc "" $labelL $labelR +} #################### # Rating graph