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

« back to all changes in this revision

Viewing changes to tcl/main.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Oliver Korff
  • Date: 2011-07-06 12:56:48 UTC
  • mfrom: (1.2.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20110706125648-tlne3lvva68piwel
Tags: 1:4.3.0.cvs20110706-1
* New Upstream Version.
* Scid Upstream is now a git repository, see copyright.
* Updated standards version to 3.9.2
* Recheck of bug #584923, "flipping board breakes animation". This 
  is working fine now, even in docked mode. (Closes: #584923).

Show diffs side-by-side

added added

removed removed

Lines of Context:
832
832
#    If a parameter "-animate" is specified, board changes are animated.
833
833
#
834
834
proc updateBoard {args} {
835
 
    global boardSize gameInfo
836
835
    set pgnNeedsUpdate 0
837
836
    set animate 0
838
837
    foreach arg $args {
839
838
        if {! [string compare $arg "-pgn"]} { set pgnNeedsUpdate 1 }
840
839
        if {! [string compare $arg "-animate"]} { set animate 1 }
841
840
    }
842
 
   
843
 
    ::board::resize .main.board $boardSize
 
841
 
 
842
    if {$pgnNeedsUpdate} { ::pgn::Refresh $pgnNeedsUpdate }
 
843
 
 
844
    ::board::resize .main.board $::boardSize
844
845
    ::board::setmarks .main.board [sc_pos getComment]
845
846
    ::board::update .main.board [sc_pos board] $animate
846
 
    
847
 
    # Update the status of each navigation button:
 
847
 
 
848
    after cancel updateNavButtons
 
849
    after cancel notifyPosChange
 
850
 
 
851
    update idletasks
 
852
 
 
853
    after idle updateNavButtons
 
854
    after idle notifyPosChange
 
855
}
 
856
 
 
857
# updateNavButtons:
 
858
#    Update the status of each navigation button
 
859
#
 
860
proc updateNavButtons {} {
848
861
    if {[sc_pos isAt start]} {
849
862
        .main.fbutton.button.start configure -state disabled
850
863
    } else { .main.fbutton.button.start configure -state normal }
884
897
    } else {
885
898
        .main.fbutton.button.exitVar configure -state normal
886
899
    }
887
 
    
888
 
    if {![sc_base inUse]  ||  $::trialMode  ||  [sc_base isReadOnly]} {
889
 
        .main.tb.save configure -state disabled
 
900
 
 
901
    wm withdraw .tooltip
 
902
    set comment [sc_pos getComment]
 
903
    # remove technical comments, notify only human readable ones
 
904
    regsub -all {\[%.*\]} $comment {} comment
 
905
    if {$comment != ""} {
 
906
         .main.fbutton.button.comment configure -image comment_avail -relief flat
 
907
         ::utils::tooltip::Set .main.fbutton.button.comment $comment
890
908
    } else {
891
 
        .main.tb.save configure -state normal
 
909
         .main.fbutton.button.comment configure -image comment_unavail -relief flat
 
910
         ::utils::tooltip::UnSet .main.fbutton.button.comment
892
911
    }
 
912
}
 
913
 
 
914
# updateGameInfo:
 
915
#    Update the game status window .main.gameInfo
 
916
#
 
917
proc updateGameInfo {} {
 
918
    global gameInfo
 
919
 
893
920
    .main.gameInfo configure -state normal
894
921
    .main.gameInfo delete 0.0 end
895
922
    ::htext::display .main.gameInfo [sc_game info -hide $gameInfo(hideNextMove) \
905
932
    }
906
933
    .main.gameInfo configure -state disabled
907
934
    updatePlayerPhotos
 
935
}
 
936
 
 
937
# notifyPosChange:
 
938
#    Notify other windows of current position changes
 
939
#
 
940
proc notifyPosChange {} {
 
941
    if {![sc_base inUse]  ||  $::trialMode  ||  [sc_base isReadOnly]} {
 
942
        .main.tb.save configure -state disabled
 
943
    } else {
 
944
        .main.tb.save configure -state normal
 
945
    }
 
946
 
 
947
    if {$::showGameInfo} { updateGameInfo }
 
948
    updateAnalysis 1
 
949
    updateAnalysis 2
908
950
    updateEpdWins
909
 
    if {[winfo exists .analysisWin1]} { updateAnalysis 1 }
910
 
    if {[winfo exists .analysisWin2]} { updateAnalysis 2 }
911
 
    # if {[winfo exists .treeWin]} { ::tree::refresh }
912
 
    ::tree::refresh
913
 
    if {[winfo exists .commentWin]} { ::commenteditor::Refresh }
914
 
    if {[::tb::isopen]} { ::tb::results }
 
951
    ::commenteditor::Refresh
 
952
    ::tb::results
915
953
    updateMenuStates
916
954
    moveEntry_Clear
917
955
    updateStatusBar
918
 
 
919
 
    update idletasks
920
 
    
921
956
    if {[winfo exists .twinchecker]} { updateTwinChecker }
922
 
    if {[winfo exists .pgnWin]} { ::pgn::Refresh $pgnNeedsUpdate }
 
957
    ::pgn::Refresh
923
958
    if {[winfo exists .bookWin]} { ::book::refresh }
924
959
    if {[winfo exists .bookTuningWin]} { ::book::refreshTuning }
925
 
    if {[winfo exists .noveltyWin]} { updateNoveltyWin }
926
 
 
927
 
         wm withdraw .tooltip
928
 
    set comment [sc_pos getComment]
929
 
    # remove technical comments, notify only human readable ones
930
 
    regsub -all {\[%.*\]} $comment {} comment
931
 
    if {$comment != ""} {
932
 
         .main.fbutton.button.comment configure -image comment_avail -relief flat
933
 
         ::utils::tooltip::Set .main.fbutton.button.comment $comment
934
 
    } else {
935
 
         .main.fbutton.button.comment configure -image comment_unavail -relief flat
936
 
         ::utils::tooltip::UnSet .main.fbutton.button.comment
937
 
    }
 
960
    updateNoveltyWin
 
961
    ::tree::refresh
938
962
}
939
963
 
940
964
# Set up player photos: