Changeset 1646 for branches/blt4/gui/scripts
- Timestamp:
- Jan 28, 2010 8:59:45 AM (14 years ago)
- Location:
- branches/blt4/gui/scripts
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/animover.tcl
r1342 r1646 45 45 set dir [file dirname [info script]] 46 46 private common images 47 set images(bgl) [image create p hoto-file \47 set images(bgl) [image create picture -file \ 48 48 [file join $dir images bgl.gif]] 49 set images(bgr) [image create p hoto-file \49 set images(bgr) [image create picture -file \ 50 50 [file join $dir images bgr.gif]] 51 51 } -
branches/blt4/gui/scripts/balloon.tcl
r1547 r1646 217 217 # window). So for now, better to place the balloon window somewhere 218 218 # than to fail with a bad geometry. 219 # 220 # Update: This answer could be that the root window (deskop) is 221 # resized but XHeightOfScreen XWidthOfScreen still 222 # report the initial size. 219 223 wm geometry $p +$px+$py 220 224 } else { -
branches/blt4/gui/scripts/barresult.tcl
r1550 r1646 577 577 } 578 578 jpg { 579 set img [image create p hoto]579 set img [image create picture] 580 580 $itk_component(plot) snap $img 581 set bytes [$img data -format "jpeg -quality 100"] 582 set bytes [Rappture::encoding::decode -as b64 $bytes] 581 $img export jpg -quality 100 -data bytes 583 582 image delete $img 584 583 return [list .jpg $bytes] 585 584 } 586 585 png { 587 set img [image create p hoto]586 set img [image create picture] 588 587 $itk_component(plot) snap $img 589 set bytes [$img data -format "png"] 590 set bytes [Rappture::encoding::decode -as b64 $bytes] 588 $img export png -data bytes 591 589 image delete $img 592 590 return [list .png $bytes] -
branches/blt4/gui/scripts/booleanentry.tcl
r1342 r1646 56 56 if {$icon != ""} { 57 57 itk_component add icon { 58 set icon [image create p hoto-data $icon]58 set icon [image create picture -data $icon] 59 59 set w [image width $icon] 60 60 set h [image height $icon] -
branches/blt4/gui/scripts/combobox.tcl
r1640 r1646 134 134 $itk_component(entry) configure -state disabled 135 135 } 136 137 after 10 [list catch [list event generate $itk_component(hull) <<Value>>]]136 set cmd [list event generate $itk_component(hull) <<Value>>] 137 after 10 [list catch $cmd] 138 138 } elseif {[llength $args] != 0} { 139 139 error "wrong # args: should be \"value ?newval?\"" -
branches/blt4/gui/scripts/contourresult.tcl
r1343 r1646 17 17 package require vtkinteraction 18 18 package require BLT 19 package require Img19 #package require Img 20 20 21 21 option add *ContourResult.width 4i widgetDefault … … 303 303 304 304 # 305 # Create a p hotofor download snapshots306 # 307 set _download [image create p hoto]305 # Create a picture for download snapshots 306 # 307 set _download [image create picture] 308 308 309 309 eval itk_initialize $args … … 467 467 switch $option { 468 468 coming { 469 if {[catch {blt::winop snap $itk_component(area) $_download}]} { 470 $_download configure -width 1 -height 1 471 $_download put #000000 469 if {[catch {_$download snap $itk_component(area)}]} { 470 $_download blank #000000 472 471 } 473 472 } … … 477 476 } 478 477 now { 479 # Get the image data (as base64) and decode it back to binary. 480 # This is better than writing to temporary files. When we switch 481 # to the BLT picture image it won't be necessary to decode the 482 # image data. 483 set bytes [$_download data -format "jpeg -quality 100"] 484 set bytes [Rappture::encoding::decode -as b64 $bytes] 478 $_download export jpg -quality 100 -data bytes 485 479 return [list .jpg $bytes] 486 480 } -
branches/blt4/gui/scripts/deviceLayout1D.tcl
r1342 r1646 186 186 set imh $_icons($icon) 187 187 } else { 188 set imh [image create p hoto-data $icon]188 set imh [image create picture -data $icon] 189 189 set _icons($icon) $imh 190 190 } … … 334 334 set imh $_icons($icon) 335 335 } else { 336 set imh [image create p hoto-data $icon]336 set imh [image create picture -data $icon] 337 337 set _icons($icon) $imh 338 338 } -
branches/blt4/gui/scripts/deviceViewer1D.tcl
r1402 r1646 16 16 # ====================================================================== 17 17 package require Itk 18 package require Img18 #package require Img 19 19 package require BLT 20 20 … … 839 839 set str [$libObj get $path.icon] 840 840 if {$str != ""} { 841 $w configure -image [image create p hoto-data $str]841 $w configure -image [image create picture -data $str] 842 842 } 843 843 } -
branches/blt4/gui/scripts/flowvisviewer.tcl
r1545 r1646 17 17 package require Itk 18 18 package require BLT 19 package require Img19 #package require Img 20 20 21 21 option add *FlowvisViewer.width 5i widgetDefault … … 322 322 323 323 # Legend 324 set _image(legend) [image create p hoto]324 set _image(legend) [image create picture] 325 325 itk_component add legend { 326 326 canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0 … … 536 536 } 537 537 538 set _image(download) [image create p hoto]538 set _image(download) [image create picture] 539 539 540 540 eval itk_initialize $args … … 752 752 switch $option { 753 753 coming { 754 if {[catch { 755 blt::winop snap $itk_component(plotarea) $_image(download) 756 }]} { 757 $_image(download) configure -width 1 -height 1 758 $_image(download) put #000000 754 if {[catch { $_image(download) snap $itk_component(plotarea)}]} { 755 $_image(download) blank #000000 759 756 } 760 757 } … … 805 802 switch -- $_downloadPopup(format) { 806 803 draft { 807 # Get the image data (as base64) and decode it back to 808 # binary. This is better than writing to temporary 809 # files. When we switch to the BLT picture image it 810 # won't be necessary to decode the image data. 811 set bytes [$_image(plot) data -format "jpeg -quality 100"] 812 set bytes [Rappture::encoding::decode -as b64 $bytes] 804 $_image(plot) export jpeg -quality 100 -data bytes 813 805 return [list .jpg $bytes] 814 806 } -
branches/blt4/gui/scripts/heightmapviewer.tcl
r1545 r1646 16 16 package require Itk 17 17 package require BLT 18 package require Img18 #package require Img 19 19 20 20 option add *HeightmapViewer.width 4i widgetDefault … … 284 284 } 285 285 286 set _image(download) [image create p hoto]286 set _image(download) [image create picture] 287 287 eval itk_initialize $args 288 288 Connect … … 470 470 switch $option { 471 471 coming { 472 if {[catch { 473 blt::winop snap $itk_component(plotarea) $_image(download) 474 }]} { 475 $_image(download) configure -width 1 -height 1 476 $_image(download) put #000000 472 if {[catch {$_image(download) snap $itk_component(plotarea)}]} { 473 $_image(download) blank #000000 477 474 } 478 475 } … … 482 479 } 483 480 now { 484 # Get the image data (as base64) and decode it back to binary. 485 # This is better than writing to temporary files. When we switch 486 # to the BLT picture image it won't be necessary to decode the 487 # image data. 488 set bytes [$_image(download) data -format "jpeg -quality 100"] 489 set bytes [Rappture::encoding::decode -as b64 $bytes] 481 $_image(download) export jpg -quality 100 -data bytes 490 482 return [list .jpg $bytes] 491 483 } … … 591 583 set bytes [ReceiveBytes $size] 592 584 if { ![info exists _image(legend)] } { 593 set _image(legend) [image create p hoto]585 set _image(legend) [image create picture] 594 586 } 595 587 ReceiveEcho <<line "<read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 596 set src [image create p hoto-data $bytes]597 blt::winop image rotate $src $_image(legend)90598 set dst $_image(legend)588 set src [image create picture -data $bytes] 589 $_image(legend) rotate $src 90 590 image delete $src 599 591 600 592 set c $itk_component(3dview) -
branches/blt4/gui/scripts/htmlviewer.tcl
r1641 r1646 13 13 package require Itk 14 14 package require Tkhtml 15 package require Img15 #package require Img 16 16 17 17 option add *HTMLviewer.width 3i widgetDefault … … 335 335 336 336 foreach name $searchlist { 337 if {[catch {image create p hoto-file $name} imh] == 0} {337 if {[catch {image create picture -file $name} imh] == 0} { 338 338 set _file2icon($fileName) $imh 339 339 set _icon2file($imh) $fileName -
branches/blt4/gui/scripts/icons.tcl
r1342 r1646 51 51 switch -- [file extension $file] { 52 52 .gif - .jpg - .png { 53 set imh [image create p hoto-file $file]53 set imh [image create picture -file $file] 54 54 } 55 55 .xbm { -
branches/blt4/gui/scripts/image.tcl
r1342 r1646 41 41 set data [string trim [$xmlobj get $path.current]] 42 42 if {[string length $data] == 0} { 43 set _image [image create p hoto]43 set _image [image create picture] 44 44 } else { 45 set _image [image create p hoto-data $data]45 set _image [image create picture -data $data] 46 46 } 47 47 -
branches/blt4/gui/scripts/imageentry.tcl
r1342 r1646 12 12 # ====================================================================== 13 13 package require Itk 14 package require Img14 #package require Img 15 15 16 16 itcl::class Rappture::ImageEntry { … … 105 105 set newval [lindex $args 0] 106 106 if {[string length $newval] > 0} { 107 set imh [image create p hoto-data $newval]107 set imh [image create picture -data $newval] 108 108 } else { 109 109 set imh "" … … 179 179 auto { 180 180 if {$_resize == ""} { 181 set _resize [image create p hoto]181 set _resize [image create picture] 182 182 } 183 183 set w [winfo width $itk_component(image)] … … 189 189 } 190 190 $_resize configure -width $w -height $h 191 blt::winop resample $_imh $_resize191 $_resize resample $_imh 192 192 $itk_component(image) configure -image $_resize 193 193 } 194 194 width=* - height=* { 195 195 if {$_resize == ""} { 196 set _resize [image create p hoto]196 set _resize [image create picture] 197 197 } 198 198 if {[regexp {^width=([0-9]+)$} $str match size]} { … … 200 200 set h [expr {round($w*$ih/double($iw))}] 201 201 $_resize configure -width $w -height $h 202 blt::winop resample $_imh $_resize202 $_resize resample $_imh 203 203 $itk_component(image) configure -image $_resize \ 204 204 -width $w -height $h … … 207 207 set w [expr {round($h*$iw/double($ih))}] 208 208 $_resize configure -width $w -height $h 209 blt::winop resample $_imh $_resize209 $_resize resample $_imh 210 210 $itk_component(image) configure -image $_resize \ 211 211 -width $w -height $h -
branches/blt4/gui/scripts/imageresult.tcl
r1552 r1646 14 14 package require Itk 15 15 package require BLT 16 package require Img16 #package require Img 17 17 18 18 option add *ImageResult.width 3i widgetDefault … … 124 124 125 125 126 set _image(zoom) [image create p hoto]127 set _image(final) [image create p hoto]126 set _image(zoom) [image create picture] 127 set _image(final) [image create picture] 128 128 129 129 itk_component add image { … … 395 395 $_image(final) configure -width $wf -height $hf 396 396 $_image(zoom) copy $imh -from $sx $sy 397 blt::winop resample $_image(zoom) $_image(final)sinc397 $_image(final) resample $_image(zoom) -filter sinc 398 398 } 399 399 } else { … … 409 409 $_image(zoom) configure -width $wz -height $hz 410 410 $_image(zoom) put $bg -to 0 0 $wz $hz 411 blt::winop resample $imh $_image(zoom) sinc 412 411 $_image(zoom) resample $imh -filter sinc 413 412 $_image(final) configure -width $wz -height $hz 414 413 $_image(final) copy $_image(zoom) -from 0 0 -
branches/blt4/gui/scripts/integerentry.tcl
r1342 r1646 84 84 if {$str != ""} { 85 85 $itk_component(spinner) configure -image \ 86 [image create p hoto-data $str]86 [image create picture -data $str] 87 87 } 88 88 -
branches/blt4/gui/scripts/isomarker.tcl
r1479 r1646 15 15 package require Itk 16 16 package require BLT 17 package require Img18 17 19 18 itcl::class Rappture::IsoMarker { -
branches/blt4/gui/scripts/moleculeViewer.tcl
r1543 r1646 16 16 package require vtkinteraction 17 17 package require BLT 18 package require Img18 #package require Img 19 19 20 20 option add *MoleculeViewer.width 3i widgetDefault … … 192 192 emblems on 193 193 194 # create a p hotofor download snapshots195 set _download [image create p hoto]194 # create a picture for download snapshots 195 set _download [image create picture] 196 196 } 197 197 … … 318 318 switch $option { 319 319 coming { 320 if {[catch {blt::winop snap $itk_component(area) $_download}]} { 321 $_download configure -width 1 -height 1 322 $_download put #000000 320 if {[catch {$_download snap $itk_component(area)]} { 321 $_download blank #000000 323 322 } 324 323 } … … 328 327 } 329 328 now { 330 # Get the image data (as base64) and decode it back to binary. 331 # This is better than writing to temporary files. When we switch 332 # to the BLT picture image it won't be necessary to decode the 333 # image data. 334 set bytes [$_download data -format "jpeg -quality 100"] 335 set bytes [Rappture::encoding::decode -as b64 $bytes] 329 $_download export jpg -quality 100 -data bytes 336 330 return [list .jpg $bytes] 337 331 } -
branches/blt4/gui/scripts/molvisviewer.tcl
r1567 r1646 15 15 package require Itk 16 16 package require BLT 17 package require Img17 #package require Img 18 18 19 19 option add *MolvisViewer.width 4i widgetDefault … … 1571 1571 switch -- $type { 1572 1572 "jpg" { 1573 set img [image create photo -data $_hardcopy($this-$token)] 1574 set bytes [$img data -format "jpeg -quality 100"] 1575 set bytes [Rappture::encoding::decode -as b64 $bytes] 1573 set img [image create picture -data $_hardcopy($this-$token)] 1574 $img export jpg -quality 100 -data bytes 1576 1575 return [list .jpg $bytes] 1577 1576 } 1578 1577 "gif" { 1579 set img [image create photo -data $_hardcopy($this-$token)] 1580 set bytes [$img data -format "gif"] 1581 set bytes [Rappture::encoding::decode -as b64 $bytes] 1578 set img [image create picture -data $_hardcopy($this-$token)] 1579 $img export gif -data bytes 1582 1580 return [list .gif $bytes] 1583 1581 } -
branches/blt4/gui/scripts/nanovisviewer.tcl
r1638 r1646 15 15 package require Itk 16 16 package require BLT 17 package require Img17 #package require Img 18 18 19 19 # … … 284 284 # Legend 285 285 286 set _image(legend) [image create p hoto]286 set _image(legend) [image create picture] 287 287 itk_component add legend { 288 288 canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0 … … 355 355 } 356 356 357 set _image(download) [image create p hoto]357 set _image(download) [image create picture] 358 358 359 359 eval itk_initialize $args … … 542 542 switch $option { 543 543 coming { 544 if {[catch { 545 blt::winop snap $itk_component(plotarea) $_image(download) 546 }]} { 547 $_image(download) configure -width 1 -height 1 548 $_image(download) put #000000 544 if {[catch { $_image(download) snap $itk_component(plotarea)}]} { 545 $_image(download) blank #000000 549 546 } 550 547 } … … 554 551 } 555 552 now { 556 # Get the image data (as base64) and decode it back to binary. 557 # This is better than writing to temporary files. When we switch 558 # to the BLT picture image it won't be necessary to decode the 559 # image data. 560 if { [image width $_image(plot)] > 0 && 561 [image height $_image(plot)] > 0 } { 562 set bytes [$_image(plot) data -format "jpeg -quality 100"] 563 set bytes [Rappture::encoding::decode -as b64 $bytes] 564 return [list .jpg $bytes] 565 } 566 return "" 553 $_image(plot) export jpg -quality 100 -data bytes 554 return [list .jpg $bytes] 567 555 } 568 556 default { -
branches/blt4/gui/scripts/numberentry.tcl
r1527 r1646 106 106 set str [$_owner xml get $path.about.icon] 107 107 if {$str != ""} { 108 $itk_component(gauge) configure -image [image create p hoto-data $str]108 $itk_component(gauge) configure -image [image create picture -data $str] 109 109 } 110 110 -
branches/blt4/gui/scripts/resultviewer.tcl
r1587 r1646 14 14 # ====================================================================== 15 15 package require Itk 16 package require Img17 16 18 17 itcl::class Rappture::ResultViewer { -
branches/blt4/gui/scripts/visviewer.tcl
r1547 r1646 132 132 } 133 133 pack $itk_component(plotarea) -fill both -expand yes 134 set _image(plot) [image create p hoto]134 set _image(plot) [image create picture] 135 135 eval itk_initialize $args 136 136 } -
branches/blt4/gui/scripts/xylegend.tcl
r1644 r1646 220 220 itcl::body Rappture::XyLegend::Add { elem label {flags ""} } { 221 221 set hide [$graph_ element cget $elem -hide] 222 set im [image create p hoto]222 set im [image create picture] 223 223 $graph_ legend icon $elem $im 224 224 set data(show) $hide -
branches/blt4/gui/scripts/xyprint.tcl
r1644 r1646 187 187 set page $itk_component(graph_page) 188 188 set format [$page.format current] 189 189 190 # Handle JPEG or PNG image formats. 190 191 if { $format == "jpg" } { 191 192 set img [image create picture] 193 package require blt_picture_jpg 192 194 $_clone snap $img 193 195 $img export jpg -quality 100 -data bytes … … 197 199 set img [image create picture] 198 200 $_clone snap $img 199 $img datapng -data bytes201 $img export png -data bytes 200 202 image delete $img 201 203 return [list .png $bytes] 202 204 } 203 205 204 206 # Handle encapsulated postscript or portable document format. 205 207 … … 216 218 set psdata [$_clone postscript output] 217 219 220 if 0 { 221 set f [open "junk.raw" "w"] 222 puts -nonewline $f $psdata 223 close $f 224 } 218 225 if { $format == "eps" } { 219 if 0 {220 set f [open "junk.raw" "w"]221 puts -nonewline $f $psdata222 close $f223 }224 226 return [list .$format $psdata] 225 227 } … … 476 478 477 479 itcl::body Rappture::XyPrint::GetAxisType { axis } { 478 return $_clone axis type $axis480 return [$_clone axis type $axis] 479 481 } 480 482 … … 996 998 "18" "18" \ 997 999 "20" "20" 998 bind $page.ti ckfontsize <<Value>> [itcl::code $this ApplyAxisSettings]1000 bind $page.titlefontsize <<Value>> [itcl::code $this ApplyAxisSettings] 999 1001 Rappture::Tooltip::for $page.titlefontsize \ 1000 1002 "Set the size (point) of the title font." … … 1067 1069 -weight $_settings($this-legend-font-weight) \ 1068 1070 -slant $_settings($this-legend-font-slant) 1069 $_clone legend configure -font $_fonts(legend)1071 $_clone legend configure -font fixed -font $_fonts(legend) 1070 1072 ApplyElementSettings 1071 1073 } … … 1090 1092 -weight $_settings($this-axis-tickfont-weight) \ 1091 1093 -slant $_settings($this-axis-tickfont-slant) 1094 $_clone axis configure $axis -tickfont fixed -titlefont fixed 1092 1095 $_clone axis configure $axis -tickfont $axis-ticks -titlefont $axis-title 1096 if 1 { 1097 puts stderr "$_clone axis configure $axis -tickfont $axis-ticks -titlefont $axis-title" 1098 puts stderr "fontconf=[font configure $axis-ticks]" 1099 } 1093 1100 GetAxis 1094 1101 RegeneratePreview … … 1247 1254 } 1248 1255 foreach {name value} [$parser eval "array get general"] { 1249 set _settings($this-graph-$name) $value1256 v set _settings($this-graph-$name) $value 1250 1257 } 1251 1258 interp delete $parser
Note: See TracChangeset
for help on using the changeset viewer.