/usr/share/scid/tcl/windows.tcl is in scid-data 1:4.6.4+dfsg1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | ###
### windows.tcl: part of Scid.
### Copyright (C) 1999-2003 Shane Hudson.
###
namespace eval ::windows {
# TODO
}
########################################################################
### Optional windows: all off initially.
set treeWin 0
set pgnWin 0
set commentWin 0
set filterGraph 0
################################################################################
# Creates a toplevel window depending of the docking option
################################################################################
proc createToplevel { {w} {closeto ""} } {
set name [string range $w 1 end]
set f .fdock$name
# Raise window if already exist
if { [winfo exists $w] } {
if {! $::docking::USE_DOCKING } {
tk::PlaceWindow $w
} else {
if { [::docking::isUndocked $w] } {
tk::PlaceWindow $f
} else {
[::docking::find_tbn $f] select $f
}
}
return "already_exists"
}
if { $::docking::USE_DOCKING } {
set old_dest $::docking::layout_dest_notebook
if {$old_dest == "" && $closeto != ""} {
set tab [string range $closeto 1 end]
set ::docking::layout_dest_notebook [::docking::find_tbn .fdock$tab]
}
frame $f -container 1
toplevel .$name -use [ winfo id $f ]
docking::add_tab $f
set ::docking::layout_dest_notebook $old_dest
} else {
toplevel $w
}
}
################################################################################
# In the case of a window closed without the context menu in docked mode, arrange for the tabs to be cleaned up
# Alternative way : directly call ::docking::cleanup $w when closing window
################################################################################
proc createToplevelFinalize {w} {
if { $::docking::USE_DOCKING } {
bind $w <Destroy> +[ namespace code "::docking::cleanup $w %W"]
}
}
################################################################################
# if undocked window : sets the title of the toplevel window
# if docked : sets the name of the tab
# w : name of the toplevel window
proc setTitle { w title } {
set f .fdock[ string range $w 1 end ]
if { [catch {set nb [ ::docking::find_tbn $f ]} ]} {
set nb ""
}
if { $nb == "" } {
wm title $w $title
} else {
# in docked mode trim down title to spare space
if { [ string range $title 0 5 ] == "Scid: " && [ string length $title ] > 6 } {
set title [string range $title 6 end]
}
$nb tab $f -text $title
}
}
################################################################################
# Sets the menu for a new window : in docked mode the menu is displayed by clicking on the tab of the notebook
################################################################################
proc setMenu { w m} {
if { ! $::docking::USE_DOCKING } {
$w configure -menu $m
}
}
# recordWinSize:
# Records window width and height, for saving in options file.
#
proc recordWinSize {win} {
global winWidth winHeight winX winY
if {![winfo exists $win]} { return }
if { $::docking::USE_DOCKING && ! [ ::docking::isUndocked $win ]} { return }
set temp [wm geometry $win]
set suffix ""
set n [scan $temp "%dx%d+%d+%d" width height x y]
if {$n == 4} {
set winWidth${suffix}($win) $width
set winHeight${suffix}($win) $height
set winX${suffix}($win) $x
set winY${suffix}($win) $y
}
}
proc setWinLocation {win} {
global winX winY
set suffix ""
if {[info exists winX${suffix}($win)] && [info exists winY${suffix}($win)] && \
[set winX${suffix}($win)] >= 0 && [set winY${suffix}($win)] >= 0} {
catch [list wm geometry $win "+[set winX${suffix}($win)]+[set winY${suffix}($win)]"]
}
}
proc setWinSize {win} {
global winWidth winHeight
set suffix ""
if {[info exists winWidth${suffix}($win)] && [info exists winHeight${suffix}($win)] && \
[set winWidth${suffix}($win) ] > 0 && [set winHeight${suffix}($win) ] > 0 } {
catch [list wm geometry $win "[set winWidth${suffix}($win) ]x[set winHeight${suffix}($win) ]"]
}
}
###
### End of file: windows.tcl
###
|