Changeset 5732 for branches/1.4/gui/scripts/molvisviewer.tcl
- Timestamp:
- Jun 22, 2015, 1:47:32 PM (9 years ago)
- Location:
- branches/1.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.4
-
branches/1.4/gui/scripts/molvisviewer.tcl
r5728 r5732 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 2004-201 2HUBzero Foundation, LLC10 # Copyright (c) 2004-2015 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and … … 230 230 }] 231 231 232 itk_component add 3dview {232 itk_component add view { 233 233 label $itk_component(plotarea).view -image $_image(plot) \ 234 234 -highlightthickness 0 -borderwidth 0 … … 237 237 ignore -highlightthickness -borderwidth -background 238 238 } 239 bind $itk_component( 3dview) <Control-F1> [itcl::code $this ToggleConsole]239 bind $itk_component(view) <Control-F1> [itcl::code $this ToggleConsole] 240 240 241 241 set f [$itk_component(main) component controls] … … 312 312 BuildSettingsTab 313 313 314 # HACK ALERT. Initially force a requested width of the 3dview label.315 316 # It's a chicken-and-the-egg problem. The size of the 3dview label is set314 # HACK ALERT. Initially force a requested width of the view label. 315 316 # It's a chicken-and-the-egg problem. The size of the view label is set 317 317 # from the size of the image retrieved from the server. But the size of 318 318 # the image is specified by the viewport which is the size of the label. … … 324 324 # (that's why we're using the blt::table to manage the geometry). It has 325 325 # to be big, because we don't know how big the user may want to stretch 326 # the window. This at least forces the sidebarframe to give the 3dview326 # the window. This at least forces the sidebarframe to give the view 327 327 # the maximum size available, which is perfect for an initially closed 328 328 # sidebar. 329 329 330 330 blt::table $itk_component(plotarea) \ 331 0,0 $itk_component( 3dview) -fill both -reqwidth 10000331 0,0 $itk_component(view) -fill both -reqwidth 10000 332 332 # 333 333 # RENDERING AREA … … 338 338 if { $_useVmouseEvents } { 339 339 # set up bindings to bridge mouse events to server 340 bind $itk_component( 3dview) <ButtonPress> \340 bind $itk_component(view) <ButtonPress> \ 341 341 [itcl::code $this Vmouse click %b %s %x %y] 342 bind $itk_component( 3dview) <ButtonRelease> \342 bind $itk_component(view) <ButtonRelease> \ 343 343 [itcl::code $this Vmouse release %b %s %x %y] 344 bind $itk_component( 3dview) <B1-Motion> \344 bind $itk_component(view) <B1-Motion> \ 345 345 [itcl::code $this Vmouse drag 1 %s %x %y] 346 bind $itk_component( 3dview) <B2-Motion> \346 bind $itk_component(view) <B2-Motion> \ 347 347 [itcl::code $this Vmouse drag 2 %s %x %y] 348 bind $itk_component( 3dview) <B3-Motion> \348 bind $itk_component(view) <B3-Motion> \ 349 349 [itcl::code $this Vmouse drag 3 %s %x %y] 350 bind $itk_component( 3dview) <Motion> \350 bind $itk_component(view) <Motion> \ 351 351 [itcl::code $this Vmouse move 0 %s %x %y] 352 352 } else { 353 353 # set up bindings for rotation with mouse 354 bind $itk_component( 3dview) <ButtonPress-1> \354 bind $itk_component(view) <ButtonPress-1> \ 355 355 [itcl::code $this Rotate click %x %y] 356 bind $itk_component( 3dview) <B1-Motion> \356 bind $itk_component(view) <B1-Motion> \ 357 357 [itcl::code $this Rotate drag %x %y] 358 bind $itk_component( 3dview) <ButtonRelease-1> \358 bind $itk_component(view) <ButtonRelease-1> \ 359 359 [itcl::code $this Rotate release %x %y] 360 360 361 361 # set up bindings for panning with mouse 362 bind $itk_component( 3dview) <ButtonPress-2> \362 bind $itk_component(view) <ButtonPress-2> \ 363 363 [itcl::code $this Pan click %x %y] 364 bind $itk_component( 3dview) <B2-Motion> \364 bind $itk_component(view) <B2-Motion> \ 365 365 [itcl::code $this Pan drag %x %y] 366 bind $itk_component( 3dview) <ButtonRelease-2> \366 bind $itk_component(view) <ButtonRelease-2> \ 367 367 [itcl::code $this Pan release %x %y] 368 368 369 369 # scroll wheel zoom 370 370 if {[string equal "x11" [tk windowingsystem]]} { 371 bind $itk_component( 3dview) <4> [itcl::code $this Zoom out 2]372 bind $itk_component( 3dview) <5> [itcl::code $this Zoom in 2]371 bind $itk_component(view) <4> [itcl::code $this Zoom out 2] 372 bind $itk_component(view) <5> [itcl::code $this Zoom in 2] 373 373 } 374 374 } 375 375 376 376 # Set up bindings for panning with keyboard 377 bind $itk_component( 3dview) <KeyPress-Left> \377 bind $itk_component(view) <KeyPress-Left> \ 378 378 [itcl::code $this Pan set -10 0] 379 bind $itk_component( 3dview) <KeyPress-Right> \379 bind $itk_component(view) <KeyPress-Right> \ 380 380 [itcl::code $this Pan set 10 0] 381 bind $itk_component( 3dview) <KeyPress-Up> \381 bind $itk_component(view) <KeyPress-Up> \ 382 382 [itcl::code $this Pan set 0 -10] 383 bind $itk_component( 3dview) <KeyPress-Down> \383 bind $itk_component(view) <KeyPress-Down> \ 384 384 [itcl::code $this Pan set 0 10] 385 bind $itk_component( 3dview) <Shift-KeyPress-Left> \385 bind $itk_component(view) <Shift-KeyPress-Left> \ 386 386 [itcl::code $this Pan set -50 0] 387 bind $itk_component( 3dview) <Shift-KeyPress-Right> \387 bind $itk_component(view) <Shift-KeyPress-Right> \ 388 388 [itcl::code $this Pan set 50 0] 389 bind $itk_component( 3dview) <Shift-KeyPress-Up> \389 bind $itk_component(view) <Shift-KeyPress-Up> \ 390 390 [itcl::code $this Pan set 0 -50] 391 bind $itk_component( 3dview) <Shift-KeyPress-Down> \391 bind $itk_component(view) <Shift-KeyPress-Down> \ 392 392 [itcl::code $this Pan set 0 50] 393 393 394 394 # Set up bindings for zoom with keyboard 395 bind $itk_component( 3dview) <KeyPress-Prior> \395 bind $itk_component(view) <KeyPress-Prior> \ 396 396 [itcl::code $this Zoom out 2] 397 bind $itk_component( 3dview) <KeyPress-Next> \397 bind $itk_component(view) <KeyPress-Next> \ 398 398 [itcl::code $this Zoom in 2] 399 399 400 bind $itk_component( 3dview) <Enter> "focus $itk_component(3dview)"401 402 bind $itk_component( 3dview) <Configure> \400 bind $itk_component(view) <Enter> "focus $itk_component(view)" 401 402 bind $itk_component(view) <Configure> \ 403 403 [itcl::code $this EventuallyResize %w %h] 404 bind $itk_component( 3dview) <Unmap> \404 bind $itk_component(view) <Unmap> \ 405 405 [itcl::code $this Unmap] 406 bind $itk_component( 3dview) <Map> \406 bind $itk_component(view) <Map> \ 407 407 [itcl::code $this Map] 408 408 … … 1106 1106 # Set or restore viewing parameters. We do this for the first 1107 1107 # model and assume this works for everything else. 1108 set w [winfo width $itk_component( 3dview)]1109 set h [winfo height $itk_component( 3dview)]1108 set w [winfo width $itk_component(view)] 1109 set h [winfo height $itk_component(view)] 1110 1110 SendCmd "reset" 1111 1111 SendCmd "screen $w $h" … … 1240 1240 } 1241 1241 if { $option == "click" } { 1242 $itk_component( 3dview) configure -cursor hand11242 $itk_component(view) configure -cursor hand1 1243 1243 } 1244 1244 if { $option == "drag" || $option == "release" } { … … 1253 1253 set _mevent(y) $y 1254 1254 if { $option == "release" } { 1255 $itk_component( 3dview) configure -cursor ""1255 $itk_component(view) configure -cursor "" 1256 1256 } 1257 1257 } … … 1307 1307 unset _rocker(afterid) 1308 1308 } 1309 if { ![winfo viewable $itk_component( 3dview)] } {1309 if { ![winfo viewable $itk_component(view)] } { 1310 1310 return 1311 1311 } … … 1379 1379 } 1380 1380 if { $option == "click" } { 1381 $itk_component( 3dview) configure -cursor fleur1381 $itk_component(view) configure -cursor fleur 1382 1382 } 1383 1383 if { $option == "drag" || $option == "release" } { … … 1388 1388 return 1389 1389 } 1390 set w [winfo width $itk_component( 3dview)]1391 set h [winfo height $itk_component( 3dview)]1390 set w [winfo width $itk_component(view)] 1391 set h [winfo height $itk_component(view)] 1392 1392 if {$w <= 0 || $h <= 0} { 1393 1393 return … … 1430 1430 set _mevent(time) $now 1431 1431 if { $option == "release" } { 1432 $itk_component( 3dview) configure -cursor ""1432 $itk_component(view) configure -cursor "" 1433 1433 } 1434 1434 } … … 1452 1452 switch -- $option { 1453 1453 click { 1454 $itk_component( 3dview) configure -cursor fleur1454 $itk_component(view) configure -cursor fleur 1455 1455 set _click(x) $x 1456 1456 set _click(y) $y … … 1462 1462 Rotate.old click $x $y 1463 1463 } else { 1464 set w [winfo width $itk_component( 3dview)]1465 set h [winfo height $itk_component( 3dview)]1464 set w [winfo width $itk_component(view)] 1465 set h [winfo height $itk_component(view)] 1466 1466 if {$w <= 0 || $h <= 0} { 1467 1467 return … … 1528 1528 release { 1529 1529 Rotate.old drag $x $y 1530 $itk_component( 3dview) configure -cursor ""1530 $itk_component(view) configure -cursor "" 1531 1531 catch {unset _click} 1532 1532 }
Note: See TracChangeset
for help on using the changeset viewer.