/usr/share/xcrysden/Tcl/dispModes.tcl is in xcrysden-data 1.5.60-1.
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | #############################################################################
# Author: #
# ------ #
# Anton Kokalj Email: Tone.Kokalj@ijs.si #
# Department of Physical and Organic Chemistry Phone: x 386 1 477 3523 #
# Jozef Stefan Institute Fax: x 386 1 477 3811 #
# Jamova 39, SI-1000 Ljubljana #
# SLOVENIA #
# #
# Source: $XCRYSDEN_TOPDIR/Tcl/dispModes.tcl
# ------ #
# Copyright (c) 1996-2003 by Anton Kokalj #
#############################################################################
proc Lighting {var} {
global dispmode xcFonts xcMisc
# var -- can be On ro Off
# On - 3D displayModes
# Off - 2D displaymodes
if { ![info exists dispmode(mode3D_ModeFrame)] } {
set dispmode(mode3D_ModeFrame) {}
}
if { $var == "Off" } {
# if 3D widgets exists delete them
if {[winfo exists .ctrl.c.f.fr3.canv.mode3D]} {
destroy .ctrl.c.f.fr3.canv.mode3D
}
if {[winfo exists $dispmode(mode3D_ModeFrame)]} {
#xcDisableAll $dispmode(mode3D_ModeFrame)
destroy $dispmode(mode3D_ModeFrame)
}
pack forget .ctrl.c.f.fr3.2
# if 2D widgets already exists, just return silently
if {[winfo exists .ctrl.c.f.fr3.canv.mode2D]} { return }
set f [frame .ctrl.c.f.fr3.canv.mode2D -bd 0]
set ff [frame $f.2d]
.ctrl.c.f.fr3.canv create window 0 0 \
-tags frame -anchor nw \
-width [winfo width .ctrl.c.f.fr3.canv] \
-height [winfo height .ctrl.c.f.fr3.canv] -window $f
set b1 [radiobutton $ff.wire -text "WireFrame" -image wireframes_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value WF \
-command [list Display2D WF]]
set b2 [radiobutton $ff.point -text "PointLine" -image pointlines_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value PL \
-command [list Display2D PL]]
set b3 [radiobutton $ff.pipe -text "Pipe&Ball" -image pipeballs_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value PB \
-command [list Display2D PB]]
set b4 [radiobutton $ff.ball1 -text "BallStick-1" -image ballsticks1_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value BS1 \
-command [list Display2D BS1]]
set b5 [radiobutton $ff.ball2 -text "BallStick-2" -image ballsticks2_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value BS2 \
-command [list Display2D BS2]]
set b6 [radiobutton $ff.fill -text "SpaceFill" -image spacefills_2d \
-indicatoron 0 -variable dispmode(mode2D_name) -selectcolor \#44ff44 -value SF \
-command [list Display2D SF]]
#set i15 [expr round(15 * $xcMisc(resolution_ratio1))]
#pack $b1 $b2 $b3 $b4 $b5 $b6 -side top -padx $i15 -pady 1 -fill x
grid $b1 -row 0 -column 0 -pady 1 -padx 1 -sticky nswe
grid $b2 -row 0 -column 1 -pady 1 -padx 1 -sticky nswe
grid $b3 -row 1 -column 0 -pady 1 -padx 1 -sticky nswe
grid $b4 -row 1 -column 1 -pady 1 -padx 1 -sticky nswe
grid $b5 -row 2 -column 0 -pady 1 -padx 1 -sticky nswe
grid $b6 -row 2 -column 1 -pady 1 -padx 1 -sticky nswe
foreach {wid text} [list \
$b1 "WireFrame display-mode" \
$b2 "PointLine display-mode" \
$b3 "Pipe&Ball display-mode" \
$b4 "BallStick-1 display-mode" \
$b5 "BallStick-2 display-mode" \
$b6 "SpaceFill display-mode"] {
DynamicHelp::register $wid balloon $text
}
pack $ff -side top
#new
set _h [expr [winfo reqheight $b1] * 3 + 10]
.ctrl.c.f.fr3.canv configure -height $_h
.ctrl.c.f.fr3.canv itemconfigure frame -height $_h
#/
bind $b4 <Visibility> ConfigControlWid
From3Dto2D
} elseif { $var == "On" } {
# if 2D widgets exists delete them
if [winfo exists .ctrl.c.f.fr3.canv.mode2D] {
destroy .ctrl.c.f.fr3.canv.mode2D
}
# if 3D widgets already exists, just return silently
if {[winfo exists .ctrl.c.f.fr3.canv.mode3D]} { return }
eval pack .ctrl.c.f.fr3.2 $dispmode(mode3D_f2_packinfo) -after .ctrl.c.f.fr3.1
set f [frame .ctrl.c.f.fr3.canv.mode3D -bd 0]
.ctrl.c.f.fr3.canv create window 0 0 \
-tags frame -anchor nw \
-width [winfo width .ctrl.c.f.fr3.canv] \
-height [winfo height .ctrl.c.f.fr3.canv] -window $f
if ![info exists dispmode(mode3D)] {
set dispmode(mode3D) "Preset"
}
global radio_but_cmd_frame
#if { ![winfo exists $dispmode(mode3D_ModeFrame)] } {
# ;
#} else {
# xcEnableAll $dispmode(mode3D_ModeFrame)
#}
set rbs [RadioButCmd .ctrl.c.f.fr3.2 "Mode:" dispmode(mode3D) \
Mode3D top left 1 1 5 "Preset" "Logic"]
foreach r [lrange $rbs 1 end] {
$r config -indicatoron 0 -selectcolor \#4444ff -font $xcFonts(small)
pack configure $r -padx 1 -pady 3 -ipadx 5 -ipady 1 -fill x -expand 1
}
set dispmode(mode3D_ModeFrame) $radio_but_cmd_frame
#set rb1 [lindex $rbs 1]
#set rb2 [lindex $rbs 2]
#$rb1 configure -font $xcFonts(small)
#$rb2 configure -font $xcFonts(small)
# display widgets for $dispmode(mode3D)
Mode3D $dispmode(mode3D)
# what displayMode3D to render
From2Dto3D
} else {
puts stderr "invalid value \"$var\" submitted to proc DispMode, must be one of On, Off"
flush stderr
}
# add the additional created widgets to the control-toolbar scrolling
scrollControlToolboxCmd .ctrl.c
return
}
#==============================================================
# instead of xc_displayMode2D this proc should be used !!!!!!!!
# ^^^^^^^^^^^^^^^^
proc Display2D {mode} {
global mode2D dispmode
set mode2D(WF) Off
set mode2D(PL) Off
set mode2D(PB) Off
set mode2D(BS1) Off
set mode2D(BS2) Off
set mode2D(SF) Off
if { $mode == "WF" } {
set mode2D(WF) On
set dispmode(mode2D_name) WF
xc_displayMode2D .mesa WF
} elseif { $mode == "PL" } {
set mode2D(PL) On
set dispmode(mode2D_name) PL
xc_displayMode2D .mesa PL
} elseif { $mode == "PB" } {
set mode2D(PB) On
set dispmode(mode2D_name) PB
xc_displayMode2D .mesa PB
} elseif { $mode == "BS1" } {
set mode2D(BS1) On
set dispmode(mode2D_name) BS1
xc_displayMode2D .mesa BS1
} elseif { $mode == "BS2" } {
set mode2D(BS2) On
set dispmode(mode2D_name) BS2
xc_displayMode2D .mesa BS2
} elseif { $mode == "SF" } {
set mode2D(SF) On
set dispmode(mode2D_name) SF
xc_displayMode2D .mesa SF
} else {
puts stderr "invalid value \"$mode\" submitted to proc Display2D, must be one of WF, PL, PB, BS1, BS2, SF"
flush stderr
}
return
}
proc Mode3D {mode} {
global mode3D xcMisc
set f .ctrl.c.f.fr3.canv.mode3D
if { $mode == "Preset" } {
# if "Boolean/Logic" buttons CheckButtons exists, delete them
if { [winfo exists $f.bool] } {
destroy $f.bool
}
if { [winfo exists $f.over] } {
return
}
set f [frame $f.over]
set b1 [radiobutton $f.over1 -text "Stick" -image sticks_3d \
-indicatoron 0 -variable dispmode(mode3D_name) -selectcolor \#44ff44 -value S \
-command [list DisplayOver3D S]]
set b2 [radiobutton $f.over1a -text "Pipe&Ball" -image pipeballs_3d \
-indicatoron 0 -variable dispmode(mode3D_name) -selectcolor \#44ff44 -value PB \
-command [list DisplayOver3D PB]]
set b3 [radiobutton $f.over2 -text "BallStick" -image ballsticks_3d \
-indicatoron 0 -variable dispmode(mode3D_name) -selectcolor \#44ff44 -value BS \
-command [list DisplayOver3D BS]]
set b4 [radiobutton $f.over3 -text "SpaceFill" -image spacefills_3d \
-indicatoron 0 -variable dispmode(mode3D_name) -selectcolor \#44ff44 -value SF \
-command [list DisplayOver3D SF]]
#set i15 [expr round(15 * $xcMisc(resolution_ratio1))]
#pack $b1 $b2 $b3 $b4 -side top -padx $i15 -pady 1 -fill x -ipadx 0 -ipady 0
grid $b1 -row 0 -column 0 -pady 1 -padx 1 -sticky nswe
grid $b2 -row 0 -column 1 -pady 1 -padx 1 -sticky nswe
grid $b3 -row 1 -column 0 -pady 1 -padx 1 -sticky nswe
grid $b4 -row 1 -column 1 -pady 1 -padx 1 -sticky nswe
pack $f -side top
foreach {wid text} [list \
$b1 "Stick display-mode" \
$b2 "Pipe&Ball display-mode" \
$b3 "BallStick display-mode" \
$b4 "SpaceFill display-mode"] {
DynamicHelp::register $wid balloon $text
}
bind $b4 <Visibility> ConfigControlWid
#new
set _h [expr [winfo reqheight $b1] * 2 + 10]
.ctrl.c.f.fr3.canv configure -height $_h
.ctrl.c.f.fr3.canv itemconfigure frame -height $_h
#/
} elseif { $mode == "Logic" } {
# Logic stands for Boolean
if { [winfo exists $f.over] } {
destroy $f.over
}
# create frame where CheckButtons will be displayed
set ff [frame $f.bool]
pack $ff -side top
if { ![info exists mode3D(pipe)] } { set mode3D(pipe) "Off" }
if { ![info exists mode3D(sticks)] } { set mode3D(sticks) "Off" }
if { ![info exists mode3D(balls)] } { set mode3D(balls) "Off" }
if { ![info exists mode3D(space)] } { set mode3D(space) "Off" }
set f1 [frame $ff.1]
set f2 [frame $ff.2]
set f3 [frame $ff.3]
checkbutton $f1.cb -variable mode3D(sticks) \
-onvalue On -offvalue Off -text "STICK" \
-command [list DispBool3D mode3D(sticks)] -anchor sw
checkbutton $f2.cb -variable mode3D(balls) \
-onvalue On -offvalue Off -text "BALL" \
-command [list DispBool3D mode3D(balls)] -anchor sw
checkbutton $f3.cb -variable mode3D(space) \
-onvalue On -offvalue Off -text "SPACEFILL" \
-command [list DispBool3D mode3D(space)] -anchor sw
pack $f1.cb $f2.cb $f3.cb -side top -fill both \
-padx 0 -pady 0 -ipadx 0 -ipady 0
pack $f1 $f2 $f3 -side top -fill x -expand 1
bind $f3 <Visibility> ConfigControlWid
#new
set _h [expr [winfo reqheight $f1.cb] * 3 + 10]
.ctrl.c.f.fr3.canv configure -height $_h
.ctrl.c.f.fr3.canv itemconfigure frame -height $_h
#/
} else {
ErrorDialog "invalid value \"$mode\" submitted to proc Mode3D, must be one of Preset, Boolean"
}
# add the additional created widgets to the control-toolbar scrolling
scrollControlToolboxCmd .ctrl.c
return
}
# ============================================================================
# istead of "xc_displayMode3D over" this proc should be used
# ^^^^^^^^^^^^^^^^^^^^^
proc DisplayOver3D {mode} {
global mode3D dispmode
set mode3D(sticks) Off
set mode3D(balls) Off
set mode3D(space) Off
if { $mode == "S" } {
set mode3D(sticks) On
set dispmode(mode3D_name) S
xc_displayMode3D .mesa over S
} elseif { $mode == "PB" } {
set mode3D(pipe) On
set mode3D(sticks) On
set mode3D(balls) On
set dispmode(mode3D_name) PB
xc_displayMode3D .mesa over PB
} elseif { $mode == "BS" } {
set mode3D(pipe) Off
set mode3D(sticks) On
set mode3D(balls) On
set dispmode(mode3D_name) BS
xc_displayMode3D .mesa over BS
} elseif { $mode == "SF" } {
set mode3D(space) On
set dispmode(mode3D_name) SF
xc_displayMode3D .mesa over SF
} else {
ErrorDialog "invalid value \"$mode\" submitted to proc DisplayOver3D, must be one of S, PB, BS, SF"
}
return
}
# ============================================================================
# istead of "xc_displayMode3D boolean" this proc should be used
# ^^^^^^^^^^^^^^^^^^^^^^^^
proc DispBool3D {var} {
global mode3D
if { $var == "mode3D(sticks)" } {
set mode3D(space) Off
Invert3D mode3D(sticks)
xc_displayMode3D .mesa boolean S
} elseif { $var == "mode3D(balls)" } {
set mode3D(space) Off
Invert3D mode3D(balls)
xc_displayMode3D .mesa boolean B
} elseif { $var == "mode3D(space)" } {
set mode3D(sticks) Off
set mode3D(balls) Off
Invert3D mode3D(space)
xc_displayMode3D .mesa boolean SF
}
From3Dto3D
return
}
proc From3Dto3D {} {
global mode3D dispmode
if { $mode3D(sticks) == "On" && $mode3D(balls) == "Off" } {
set dispmode(mode3D_name) S
} elseif { $mode3D(balls) == "On" && $mode3D(pipe) =="Off" } {
set dispmode(mode3D_name) BS
} elseif { $mode3D(balls) == "On" && $mode3D(pipe) == "On" } {
set dispmode(mode3D_name) PB
} else {
set dispmode(mode3D_name) SF
}
return
}
# this proc is for DispBool3D
proc Invert3D {var} {
upvar #0 $var value
if { $value == "On" } {
set $var Off
} else {
set $var On
}
}
# this proc map from 2D to 3D and display in 3D
proc From2Dto3D {} {
global mode2D mode3D dispmode
# mapping
# (WF & PL) --> Sticks (B)
# (BS1 & BS2) --> BallSticks (BS)
if ![info exists dispmode(mode3D)] { set dispmode(mode3D) Preset }
if { $mode2D(WF) == "On" } {
set mode3D(sticks) On
set dispmode(mode3D_name) S
xc_displayMode3D .mesa over S
} elseif { $mode2D(PL) == "On" || $mode2D(PB) == "On" } {
set mode3D(pipe) On
set mode3D(sticks) On
set mode3D(balls) On
set dispmode(mode3D_name) PB
xc_displayMode3D .mesa over PB
} elseif { $mode2D(BS1) == "On" || $mode2D(BS2) == "On" } {
set mode3D(pipe) Off
set mode3D(sticks) On
set mode3D(balls) On
set dispmode(mode3D_name) BS
xc_displayMode3D .mesa over BS
} else {
set mode3D(sticks) Off
set mode3D(balls) Off
set mode3D(space) On
set dispmode(mode3D_name) SF
xc_displayMode3D .mesa over SF
}
set mode2D(WF) Off
set mode2D(PL) Off
set mode2D(PB) Off
set mode2D(BS1) Off
set mode2D(BS2) Off
set mode2D(SF) Off
# enable menubuttons for shade-model & draw-style
set dispmode(style) 3D
xcUpdateState
return
}
# this proc map from 3D to 2D and display in 2D
proc From3Dto2D {} {
global mode2D mode3D dispmode
# mapping:
# (S || ~B) --> WF
# (B) --> BS2
# (SF) --> BS2
# if dispmode(mode3D) do not exists, just return silenlty, because
# we were not yet on 3D modes and thus going from 3D to 2D is absurd
if ![info exists dispmode(mode3D)] {
puts stdout "3D NOT EXIST"
return }
if { $mode3D(sticks) == "On" && $mode3D(balls) == "Off" } {
set mode2D(WF) On
set dispmode(mode2D_name) WF
xc_displayMode2D .mesa WF
} elseif { $mode3D(balls) == "On" && $mode3D(pipe) =="Off" } {
set mode2D(BS2) On
set dispmode(mode2D_name) BS2
xc_displayMode2D .mesa BS2
} elseif { $mode3D(balls) == "On" && $mode3D(pipe) == "On" } {
set mode2D(PB) On
set dispmode(mode2D_name) PB
xc_displayMode2D .mesa PB
} else {
set mode2D(SF) On
set dispmode(mode2D_name) SF
xc_displayMode2D .mesa SF
}
set mode3D(pipe) Off
set mode3D(sticks) Off
set mode3D(balls) Off
set mode3D(space) Off
# enable menubuttons for shade-model & draw-style
set dispmode(style) 2D
xcUpdateState
return
}
# this proc deletes all child-widgets of parent
proc DeleteWid {parent} {
set child [pack slaves $parent]
puts stdout "CHILD = $child\n"
foreach widget $child {
puts stdout "WIDGET = $widget\n"
destroy $widget
}
}
# reset mode2D and mode3D arrays
proc ResetDispModes {} {
global mode2D mode3D light
set light Off
set mode2D(WF) Off
set mode2D(PL) On
set mode2D(BS1) Off
set mode2D(BS2) Off
set dispmode(mode2D_name) PL
set mode3D(sticks) Off
set mode3D(balls) Off
set mode3D(space) Off
if { [info exists dispmode(mode3D)] } { unset dispmode(mode3D) }
}
proc ConfigControlWid {} {
global widsize
set width [expr [winfo width .ctrl] - $widsize(scrW)]
set height [winfo height .ctrl]
set h [winfo reqheight .ctrl.c.f]
.ctrl.c config -width $width -height $height \
-scrollregion "0 0 $width $h"
}
proc DisplayDefaultMode {} {
global light
set light On
Lighting On
Mode3D Preset
DisplayOver3D BS
}
proc DisplayMode3D {} {
global light
set light On
Lighting On
}
proc DisplayMode2D {} {
global light
set light Off
Lighting Off
}
|