Changeset 785 for trunk/gui/scripts/imageresult.tcl
- Timestamp:
- Jul 19, 2007, 5:21:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/imageresult.tcl
r767 r785 36 36 37 37 protected method _rebuild {args} 38 protected method _top image {}38 protected method _top {what} 39 39 protected method _zoom {option args} 40 40 protected method _move {option args} … … 63 63 max 1.0 64 64 current 1.0 65 default 1 65 66 x 0 66 67 y 0 … … 70 71 pack propagate $itk_component(hull) no 71 72 73 Rappture::Panes $itk_interior.panes -sashwidth 1 -sashrelief solid -sashpadding 2 74 pack $itk_interior.panes -expand yes -fill both 75 set main [$itk_interior.panes pane 0] 76 $itk_interior.panes fraction 0 1 77 72 78 itk_component add controls { 73 frame $ itk_interior.cntls79 frame $main.cntls 74 80 } { 75 81 usual … … 122 128 123 129 itk_component add image { 124 label $ itk_interior.image -image $_image(final)130 label $main.image -image $_image(final) 125 131 } { 126 132 keep -background -foreground -cursor -font … … 140 146 bind $itk_component(image) <ButtonRelease-1> \ 141 147 [itcl::code $this _move release %x %y] 148 149 # 150 # Add area at the bottom for notes. 151 # 152 set notes [$itk_interior.panes insert end -fraction 0.15] 153 $itk_interior.panes visibility 1 off 154 Rappture::Scroller $notes.scr -xscrollmode auto -yscrollmode auto 155 pack $notes.scr -expand yes -fill both 156 itk_component add notes { 157 Rappture::HTMLviewer $notes.scr.html 158 } 159 $notes.scr contents $notes.scr.html 142 160 143 161 eval itk_initialize $args … … 287 305 } 288 306 now { 289 set top [_top image]307 set top [_top image] 290 308 if {$top == ""} { 291 309 return "" … … 331 349 } 332 350 } 333 if {$_scale(current) == "?"} { 334 _zoom reset 351 if {$_scale(current) == "?" || $_scale(default)} { 352 set _scale(current) $_scale(max) 353 set _scale(x) 0 354 set _scale(y) 0 335 355 } 336 356 … … 343 363 $_image(final) put $bg -to 0 0 $w $h 344 364 345 set imh [_top image]365 set imh [_top image] 346 366 if {$imh != ""} { 347 367 if {$_scale(current) <= 1.0} { … … 369 389 } 370 390 } 371 } 372 373 # ---------------------------------------------------------------------- 374 # USAGE: _topimage 391 392 set note [_top note] 393 if {[string length $note] > 0} { 394 if {[regexp {^html://} $note]} { 395 set note [string range $note 7 end] 396 } else { 397 regexp {&} $note {\007} note 398 regexp {<} $note {\<} note 399 regexp {>} $note {\>} note 400 regexp {\007} $note {\&} note 401 regexp "\n\n" $note {<br/>} note 402 set note "<html><body>$note</body></html>" 403 } 404 set notes [$itk_interior.panes pane 1] 405 $itk_component(notes) load $note -in [file join [_top tooldir] docs] 406 $itk_interior.panes visibility 1 on 407 } else { 408 $itk_interior.panes visibility 1 off 409 } 410 } 411 412 # ---------------------------------------------------------------------- 413 # USAGE: _top image|note|tooldir 375 414 # 376 415 # Used internally to get the topmost image currently being displayed. 377 416 # ---------------------------------------------------------------------- 378 itcl::body Rappture::ImageResult::_top image {} {417 itcl::body Rappture::ImageResult::_top {option} { 379 418 set top $_topmost 380 419 if {"" == $top} { … … 382 421 } 383 422 if {"" != $top} { 384 return [$top tkimage] 423 switch -- $option { 424 image { return [$top tkimage] } 425 note { return [$top hints note] } 426 tooldir { return [$top hints tooldir] } 427 default { error "bad option \"$option\": should be image, note, tooldir" } 428 } 385 429 } 386 430 return "" … … 418 462 reset { 419 463 set _scale(current) $_scale(max) 464 set _scale(default) 1 420 465 set _scale(x) 0 421 466 set _scale(y) 0 … … 423 468 in { 424 469 set _scale(current) [expr {$_scale(current)*0.5}] 470 set _scale(default) 0 425 471 } 426 472 out { … … 442 488 } 443 489 } 490 set _scale(default) 0 444 491 } 445 492 }
Note: See TracChangeset
for help on using the changeset viewer.