Changeset 2688 for trunk


Ignore:
Timestamp:
Nov 16, 2011, 12:56:37 PM (13 years ago)
Author:
gah
Message:
 
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.in

    r2663 r2688  
    135135done
    136136
    137 
    138137AC_ARG_WITH(
    139138    [ffmpeg],
     
    165164 
    166165TCL_INC_SPEC="$TCL_INCLUDE_SPEC"
    167 
    168166
    169167AC_ARG_WITH(
     
    244242# is all taken from the tclConfig.sh file.
    245243#--------------------------------------------------------------------
    246 
    247244
    248245if test -f "${exec_prefix}/lib/tclConfig.sh" ; then
  • trunk/gui/apps/Makefile.in

    r2577 r2688  
    2929                $(srcdir)/vtkviewer-test \
    3030                $(srcdir)/flowvis-test \
     31                $(srcdir)/rpdiff \
    3132                rappture \
    3233                rappture.env \
     
    3435                rappture.use \
    3536                rerun \
    36                 rpdiff \
    3737                simsim  \
    3838                xmldiff \
     
    5656
    5757distclean: clean
    58         $(RM) encodedata rappture.env rappture rappture.use rerun rpdiff simsim xmldiff
     58        $(RM) encodedata rappture.env rappture rappture.use rerun simsim xmldiff
    5959        $(RM) Makefile *~
    6060
  • trunk/gui/scripts/heightmapviewer.tcl

    r2671 r2688  
    7272    private method BuildCameraTab {}
    7373    private method PanCamera {}
     74
     75    private method AddImageControls { frame widget }
     76    private method SetWaitVariable { value } {
     77        set _getimage $value
     78    }
     79    private method GetWaitVariable {} {
     80        return $_getimage
     81    }
     82    private method WaitForImage {} {
     83        tkwait variable [itcl::scope _getimage]
     84        return $_getimage
     85    }
     86
    7487    protected method CurrentSurfaces {{what -all}}
    7588    protected method Rebuild {}
     
    104117    private variable _resizePending 0
    105118    private variable _resizeLegendPending 0
     119    private variable _frame 0;          # Current frame number.
     120    private variable _getimage 0;
     121    private variable _downloadPopup
    106122}
    107123
     
    138154    $_parser alias legend [itcl::code $this ReceiveLegend]
    139155
     156    array set _downloadPopup {
     157        format image
     158        image_controls ""
     159    }
    140160    # Initialize the view to some default parameters.
    141161    array set _view {
     
    482502        }
    483503        controls {
    484             # no controls for this download yet
    485             return ""
     504            set popup .heightmapviewerdownload
     505            if {![winfo exists $popup]} {
     506                # If we haven't created the popup yet, do it now
     507                Rappture::Balloon $popup \
     508                    -title "[Rappture::filexfer::label downloadWord] as..."
     509                set inner [$popup component inner]
     510                label $inner.summary -text "" -anchor w
     511                pack $inner.summary -side top
     512                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     513                    -variable \
     514                    ::Rappture::HeightmapViewer::_downloadPopup(format) \
     515                    -font "Arial 10 " \
     516                    -value image
     517                Rappture::Tooltip::for $inner.image "Save as image."
     518                pack $inner.image -anchor w
     519                button $inner.go -text [Rappture::filexfer::label download] \
     520                    -command [lindex $args 0]
     521                pack $inner.go -side bottom -pady 4
     522                $inner.image select
     523            } else {
     524                set inner [$popup component inner]
     525            }
     526            set num [llength [get]]
     527            set num [expr {($num == 1) ? "1 result" : "$num results"}]
     528            set word [Rappture::filexfer::label downloadWord]
     529            $inner.summary configure -text "$word $num in the following format:"
     530            update idletasks ;          # Fix initial sizes
     531            return $popup
    486532        }
    487533        now {
    488             # Get the image data (as base64) and decode it back to binary.
    489             # This is better than writing to temporary files.  When we switch
    490             # to the BLT picture image it won't be necessary to decode the
    491             # image data.
    492             set bytes [$_image(download) data -format "jpeg -quality 100"]
    493             set bytes [Rappture::encoding::decode -as b64 $bytes]
    494             return [list .jpg $bytes]
     534            set popup .heightmapviewerdownload
     535            if { [winfo exists $popup] } {
     536                $popup deactivate
     537            }
     538            switch -- $_downloadPopup(format) {
     539                "image" {
     540                    set popup .heightmapviewerimage
     541                    if { ![winfo exists $popup] } {
     542                        # Create the balloon popup and and the print image
     543                        # dialog widget to it.
     544                        Rappture::Balloon $popup -title "Save as image..." \
     545                            -deactivatecommand \
     546                            [itcl::code $this SetWaitVariable 0]
     547                        set inner [$popup component inner]
     548                        AddImageControls $inner [lindex $args 0]
     549                    } else {
     550                        set inner [$popup component inner]
     551                    }                   
     552                    set _downloadPopup(image_controls) $inner
     553                    update
     554                    # Activate the popup and call for the output.
     555                    foreach { widget toolName plotName } $args break
     556                    SetWaitVariable 0
     557                    $popup activate $widget left
     558                    set bool [WaitForImage]
     559                    $popup deactivate
     560                    if { $bool } {
     561                        set inner $_downloadPopup(image_controls)
     562                        set fmt [$inner.format translate [$inner.format value]]
     563                        # Get the image data (as base64) and decode it back to
     564                        # binary.  This is better than writing to temporary
     565                        # files.  When we switch to the BLT picture image it
     566                        # won't be necessary to decode the image data.
     567                        switch $fmt {
     568                            "jpg" {
     569                                set bytes [$_image(download) data \
     570                                               -format "jpeg -quality 100"]
     571                            }
     572                            "png" {
     573                                set bytes [$_image(download) data -format "png"]
     574                            }
     575                            "gif" {
     576                                set bytes [$_image(download) data -format "gif"]
     577                            }
     578                            default {
     579                                return ""
     580                            }
     581                        }
     582                        set bytes [Rappture::encoding::decode -as b64 $bytes]
     583                        return [list .$fmt $bytes]
     584                    }
     585                }
     586            }
     587            return ""
    495588        }
    496589        default {
     
    12781371    return $img
    12791372}
     1373
     1374
     1375itcl::body Rappture::HeightmapViewer::AddImageControls { inner widget } {
     1376    label $inner.size_l -text "Size:" -font "Arial 9"
     1377    set _downloadPopup(image_controls) $inner
     1378    set img $_image(plot)
     1379    set res "[image width $img]x[image height $img]"
     1380    Rappture::Combobox $inner.size -width 30 -editable no
     1381    $inner.size choices insert end \
     1382        "draft"  "Draft ($res)"         
     1383
     1384    label $inner.bgcolor_l -text "Background:" -font "Arial 9"
     1385    Rappture::Combobox $inner.bgcolor -width 30 -editable no
     1386    $inner.bgcolor choices insert end \
     1387        "black"  "Black" \
     1388        "white"  "White"
     1389
     1390    label $inner.format_l -text "Format:" -font "Arial 9"
     1391    Rappture::Combobox $inner.format -width 30 -editable no
     1392    $inner.format choices insert end \
     1393        "png"  "PNG (Portable Network Graphics format)" \
     1394        "jpg"  "JPEG (Joint Photographic Experts Group format)"
     1395
     1396    button $inner.go -text [Rappture::filexfer::label download] \
     1397        -command [itcl::code $this SetWaitVariable 1]
     1398
     1399    blt::table $inner \
     1400        0,0 $inner.format_l -anchor e \
     1401        0,1 $inner.format -anchor w -fill x  \
     1402        1,0 $inner.size_l -anchor e \
     1403        1,1 $inner.size -anchor w -fill x \
     1404        2,0 $inner.bgcolor_l -anchor e \
     1405        2,1 $inner.bgcolor -anchor w -fill x \
     1406        6,0 $inner.go -cspan 2 -pady 5
     1407    $inner.bgcolor value "Black"
     1408    $inner.size value "Draft ($res)"
     1409    $inner.format value  "PNG (Portable Network Graphics format)"
     1410}
  • trunk/gui/scripts/histogramresult.tcl

    r2547 r2688  
    792792        }
    793793    }
     794    set stepsize 1.0
    794795    if { [array size _xlabels] > 0 } {
    795796        set command [itcl::code $this FormatLabels]
     797        if { [array size _xlabels] > 20 } {
     798           set stepsize 0.0
     799        }
    796800    } else {
    797801        set command ""
    798802    }
    799     $g axis configure x -command $command
     803    $g axis configure x -command $command -stepsize $stepsize
    800804    $g configure -invertxy $invert
    801805    $itk_component(legend) reset
  • trunk/gui/scripts/molvisviewer.tcl

    r2671 r2688  
    4141    itk_option define -device device Device ""
    4242
    43 
    4443    private variable _icon 0
     44    private variable _getimage 0
    4545
    4646    private variable _mevent;           # info used for mouse event operations
     
    107107    private method ReceiveImage { size cacheid frame rock }
    108108    private method WaitIcon { option widget }
    109     private method DownloadPopup { popup command }
    110     private method EnableDownload { popup what }
     109
     110    private method AddImageControls { frame widget }
     111    private method SetWaitVariable { value } {
     112        set _getimage $value
     113    }
     114    private method WaitForResponse {} {
     115        tkwait variable [itcl::scope _getimage]
     116        return $_getimage
     117    }
    111118
    112119    protected method Map {}
     
    116123    protected method SendCmd { string }
    117124    protected method Unmap {}
    118     protected method Update { args }
    119125    protected method Vmouse  {option b m x y}
    120126    protected method Vmouse2 {option b m x y}
     
    133139        # do nothing
    134140    }
     141
     142    private method UpdateState { args }
     143
    135144    public method snap { w h }
    136145    private method Opacity {option}
     
    166175    $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
    167176
    168     # Update event
     177    # Update state event
    169178    $_dispatcher register !update
    170179    $_dispatcher dispatch $this !update "[itcl::code $this DoUpdate]; list"
     
    559568        controls {
    560569            set popup .molvisviewerdownload
    561             if { ![winfo exists .molvisviewerdownload] } {
    562                 set inner [DownloadPopup $popup [lindex $args 0]]
     570            if {![winfo exists $popup]} {
     571                # if we haven't created the popup yet, do it now
     572                Rappture::Balloon $popup \
     573                    -title "[Rappture::filexfer::label downloadWord] as..."
     574                set inner [$popup component inner]
     575                label $inner.summary -text "" -anchor w
     576                radiobutton $inner.pdb \
     577                    -text "PDB Protein Data Bank Format File" \
     578                    -variable [itcl::scope _downloadPopup(format)] \
     579                    -font "Arial 10 " \
     580                    -value pdb 
     581                Rappture::Tooltip::for $inner.pdb \
     582                    "Save as PDB Protein Data Bank format file."
     583                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     584                    -variable [itcl::scope _downloadPopup(format)] \
     585                    -font "Arial 10 " \
     586                    -value image
     587                Rappture::Tooltip::for $inner.image \
     588                    "Save as image."
     589                set f [frame $inner.frame]
     590                button $f.ok -text "Save" \
     591                    -highlightthickness 0 -pady 3 -padx 3 \
     592                    -command [lindex $args 0] \
     593                    -compound left \
     594                    -image [Rappture::icon download]
     595                button $f.cancel -text "Cancel" \
     596                    -highlightthickness 0 -pady 3 -padx 3 \
     597                    -command [list $popup deactivate] \
     598                    -compound left \
     599                    -image [Rappture::icon cancel]
     600                blt::table $f \
     601                    0,0 $f.ok \
     602                    0,1 $f.cancel
     603                blt::table $inner \
     604                    0,0 $inner.pdb -anchor w \
     605                    1,0 $inner.image -anchor w \
     606                    2,0 $f -fill x -pady 4
     607                $inner.pdb select
    563608            } else {
    564609                set inner [$popup component inner]
    565610            }
    566             set _downloadPopup(image_controls) $inner.image_frame
    567611            set num [llength [get]]
    568612            set num [expr {($num == 1) ? "1 result" : "$num results"}]
     
    573617        }
    574618        now {
    575 
    576619            set popup .molvisviewerdownload
    577             if {[winfo exists .molvisviewerdownload]} {
     620            if {[winfo exists $popup]} {
    578621                $popup deactivate
    579622            }
    580623            switch -- $_downloadPopup(format) {
    581                 "image" {
    582                     return [$this GetImage [lindex $args 0]]
    583                 }
    584624                "pdb" {
    585625                    return [list .pdb $_pdbdata]
    586                 }
     626                }
     627                "image" {
     628                    set popup .molvisviewerimage
     629                    if { ![winfo exists $popup] } {
     630                        # Create the balloon popup and and the print image
     631                        # dialog widget to it.
     632                        Rappture::Balloon $popup -title "Save as image..." \
     633                            -deactivatecommand \
     634                            [itcl::code $this SetWaitVariable 0]
     635                        set inner [$popup component inner]
     636                        # Add image controls to the ballon popup
     637                        AddImageControls $inner [lindex $args 0]
     638                    } else {
     639                        set inner [$popup component inner]
     640                    }                   
     641                    update
     642                    # Activate the popup and call for the output.
     643                    foreach { widget toolName plotName } $args break
     644                    SetWaitVariable 0
     645                    $popup activate $widget left
     646                    set bool [WaitForResponse]
     647                    $popup deactivate
     648                    if { $bool } {
     649                        return [GetImage $widget]
     650                    }
     651                    return ""
     652                }
    587653            }
    588654        }
     
    688754set count 0
    689755itcl::body Rappture::MolvisViewer::ReceiveImage { size cacheid frame rock } {
     756    puts stderr "ReceiveImage size=$size cacheid=$cacheid frame=$frame rock=$rock"
    690757    global readyForNextFrame
    691758    set readyForNextFrame 1
     
    700767    set data [ReceiveBytes $size]
    701768    #debug "success: reading $size bytes from proxy\n"
    702     if { $cacheid == "print" } {
     769    if { [string match "print*" $cacheid] } {
    703770        # $frame is the token that we sent to the proxy.
    704         set _hardcopy($this-$frame) $data
     771        set _hardcopy($this-$cacheid) $data
     772        puts stderr "setting _hardcopy($this-$cacheid)"
    705773    } else {
    706774        set _imagecache($tag) $data
    707775        #debug "CACHED: $tag,$cacheid"
    708776        $_image(plot) configure -data $data
    709         if 0 {
    710         $_image(plot) write dummy.jpg -format jpeg
    711         puts stderr "image width=[image width $_image(plot)] height=[image height $_image(plot)]"
    712         puts stderr "screen width=$_width height=$_height"
    713         }
    714777        set _image(id) $tag
    715778    }
     
    10331096    } else {
    10341097        set _state(client) $state
    1035         Update
     1098        UpdateState
    10361099        set flush 0
    10371100    }
     
    11311194itcl::body Rappture::MolvisViewer::DoRotate {} {
    11321195    SendCmd "rotate $_view(a) $_view(b) $_view(c)"
     1196    array unset _imagecache
    11331197    set _rotatePending 0
    11341198}
     
    11451209
    11461210itcl::body Rappture::MolvisViewer::DoUpdate { } {
    1147     set scale  $_settings($this-spherescale)
    1148     set radius $_settings($this-stickradius)
    1149     set overridescale [expr $scale * 0.8]
    1150     set overrideradius [expr $radius * 0.8]
    1151     SendCmd "spherescale -model all $overridescale"
    1152     SendCmd "stickradius -model all $overrideradius"
     1211    array unset _imagecache
    11531212    set models [array names _mlist]
    1154     foreach model $models {
    1155         if { [info exists _active($model)] } {
    1156             SendCmd "spherescale -model $model $scale"
    1157             SendCmd "stickradius -model $model $radius"
    1158         }
    1159     }
     1213    SphereScale $_settings($this-spherescale) $models
     1214    StickRadius $_settings($this-stickradius) $models
    11601215    set _updatePending 0
    11611216}
     
    11821237        set _view(x) [expr $_view(x) + $dx]
    11831238        set _view(y) [expr $_view(y) + $dy]
     1239        array unset _imagecache
    11841240        SendCmd "pan $dx $dy"
    11851241        return
     
    11961252        set _view(x) [expr $_view(x) + $dx]
    11971253        set _view(y) [expr $_view(y) + $dy]
     1254        array unset _imagecache
    11981255        SendCmd "pan $dx $dy"
    11991256    }
     
    12281285        }
    12291286    }
    1230 }
    1231 
    1232 itcl::body Rappture::MolvisViewer::Update { args } {
     1287    array unset _imagecache
     1288}
     1289
     1290itcl::body Rappture::MolvisViewer::UpdateState { args } {
    12331291    set tag "$_state(client),$_rocker(client)"
    12341292    if { $_image(id) != "$tag" } {
     
    12691327            SendCmd "rock $_rocker(client)"
    12701328        }
    1271         Update
     1329        UpdateState
    12721330    }
    12731331    if { $_rocker(on) && $option != "pause" } {
     
    14921550        set option $_settings($this-model)
    14931551    }
     1552    array unset _imagecache
    14941553    if { $option == "sticks" } {
    14951554        set _settings($this-modelimg) [Rappture::icon lines]
     
    15041563    set _settings($this-model) $option
    15051564    set _mrep $option
    1506 
    15071565
    15081566    foreach model [array names _mlist] {
     
    15301588# ----------------------------------------------------------------------
    15311589itcl::body Rappture::MolvisViewer::OrthoProjection {option} {
     1590    array unset _imagecache
    15321591    switch -- $option {
    15331592        "orthoscopic" {
     
    15911650        return
    15921651    }
     1652    array unset _imagecache
    15931653    if { $cell } {
    15941654        Rappture::Tooltip::for $itk_component(ortho) \
     
    16611721
    16621722    set controls $_downloadPopup(image_controls)
    1663     set combo $controls.size_combo
     1723    set combo $controls.size
    16641724    set size [$combo translate [$combo value]]
    16651725    switch -- $size {
     
    16771737        }
    16781738        default {
    1679             error "unknown image size [$inner.image_size_combo value]"
     1739            error "unknown image size [$combo value]"
    16801740        }
    16811741    }
     
    17031763        set inner [$popup component inner]
    17041764    }
    1705     set combo $controls.bgcolor_combo
     1765    set combo $controls.bgcolor
    17061766    set bgcolor [$combo translate [$combo value]]
    17071767   
     
    17281788
    17291789    if { $_hardcopy($this-$token) != "" } {
    1730         set combo $controls.type_combo
    1731         set type [$combo translate [$combo value]]
    1732         switch -- $type {
     1790        set combo $controls.format
     1791        set fmt [$combo translate [$combo value]]
     1792        switch -- $fmt {
    17331793            "jpg" {
    17341794                set img [image create photo -data $_hardcopy($this-$token)]
     
    18351895
    18361896itcl::body Rappture::MolvisViewer::Opacity { option } {
     1897    array unset _imagecache
    18371898    if { $option == "update" } {
    18381899        set opacity $_settings($this-opacity)
     
    18751936        error "bad option \"$option\""
    18761937    }
     1938    # Clear the image cache
     1939    array unset _imagecache
    18771940    set _settings($this-showlabels) $showlabels
    18781941    if { $models == "all" } {
     
    18981961# ----------------------------------------------------------------------
    18991962itcl::body Rappture::MolvisViewer::CartoonTrace {option {models "all"}} {
     1963    array unset _imagecache
    19001964    set trace $_settings($this-cartoontrace)
    19011965    if { $option == "update" } {
     
    19211985}
    19221986
    1923 itcl::body Rappture::MolvisViewer::DownloadPopup { popup command } {
    1924     Rappture::Balloon $popup \
    1925         -title "[Rappture::filexfer::label downloadWord] as..."
    1926     set inner [$popup component inner]
    1927     label $inner.summary -text "" -anchor w -font "Arial 11 bold"
    1928     radiobutton $inner.pdb_button -text "PDB Protein Data Bank Format File" \
    1929         -variable [itcl::scope _downloadPopup(format)] \
    1930         -command [itcl::code $this EnableDownload $popup pdb] \
    1931         -font "Arial 10 " \
    1932         -value pdb 
    1933     Rappture::Tooltip::for $inner.pdb_button \
    1934         "Save as PDB Protein Data Bank format file."
    1935     radiobutton $inner.image_button -text "Image File" \
    1936         -variable [itcl::scope _downloadPopup(format)] \
    1937         -command [itcl::code $this EnableDownload $popup image] \
    1938         -font "Arial 10 " \
    1939         -value image
    1940     Rappture::Tooltip::for $inner.image_button \
    1941         "Save as digital image."
    1942 
    1943     set controls [frame $inner.image_frame -bd 2 -relief groove]
    1944     label $controls.size_label -text "Size:" \
    1945         -font "Arial 9"
     1987itcl::body Rappture::MolvisViewer::AddImageControls { inner widget } {
     1988    label $inner.size_l -text "Size:" -font "Arial 9"
     1989    set _downloadPopup(image_controls) $inner
    19461990    set img $_image(plot)
    19471991    set res "[image width $img]x[image height $img]"
    1948     Rappture::Combobox $controls.size_combo -width 20 -editable no
    1949     $controls.size_combo choices insert end \
     1992    Rappture::Combobox $inner.size -width 30 -editable no
     1993    $inner.size choices insert end \
    19501994        "draft"  "Draft (400x400)"         \
    19511995        "standard"  "Standard (1200x1200)"          \
    19521996        "highquality"  "High Quality (2400x2400)"
    19531997
    1954     label $controls.bgcolor_label -text "Background:" \
    1955         -font "Arial 9"
    1956     Rappture::Combobox $controls.bgcolor_combo -width 20 -editable no
    1957     $controls.bgcolor_combo choices insert end \
     1998    label $inner.bgcolor_l -text "Background:" -font "Arial 9"
     1999    Rappture::Combobox $inner.bgcolor -width 30 -editable no
     2000    $inner.bgcolor choices insert end \
    19582001        "black"  "Black" \
    19592002        "white"  "White" \
    19602003        "none"  "Transparent (PNG only)"         
    19612004
    1962     label $controls.type_label -text "Type:" \
    1963         -font "Arial 9"
    1964     Rappture::Combobox $controls.type_combo -width 20 -editable no
    1965     $controls.type_combo choices insert end \
    1966         "jpg"  "JPEG Joint Photographic Experts Group Format (*.jpg)" \
    1967         "png"  "PNG Portable Network Graphics Format (*.png)"         
    1968 
    1969     button $inner.go -text [Rappture::filexfer::label download] \
    1970         -command $command
    1971 
    1972     blt::table $controls \
    1973         1,0 $controls.size_label -anchor e \
    1974         1,1 $controls.size_combo -anchor w -fill x \
    1975         2,0 $controls.bgcolor_label -anchor e \
    1976         2,1 $controls.bgcolor_combo -anchor w -fill x \
    1977         3,0 $controls.type_label -anchor e \
    1978         3,1 $controls.type_combo -anchor w -fill x 
    1979     blt::table configure $controls r0 -height 16
    1980     blt::table configure $controls -padx 4 -pady {0 6}
     2005    label $inner.format_l -text "Format:" -font "Arial 9"
     2006    Rappture::Combobox $inner.format -width 30 -editable no
     2007    $inner.format choices insert end \
     2008        "png"  "PNG (Portable Network Graphics format)" \
     2009        "jpg"  "JPEG (Joint Photographic Experts Group format)" \
     2010        "gif"  "GIF (GIF Graphics Interchange Format)"
     2011
     2012    set f [frame $inner.frame]
     2013    button $f.ok -text "Save" \
     2014        -highlightthickness 0 -pady 3 -padx 3 \
     2015        -command [itcl::code $this SetWaitVariable 1] \
     2016        -compound left \
     2017        -image [Rappture::icon download
     2018]
     2019    button $f.cancel -text "Cancel" \
     2020        -highlightthickness 0 -pady 3 -padx 3 \
     2021        -command [itcl::code $this SetWaitVariable 0] \
     2022        -compound left \
     2023        -image [Rappture::icon cancel]
     2024    blt::table $f \
     2025        0,0 $f.ok  \
     2026        0,1 $f.cancel
     2027
    19812028    blt::table $inner \
    1982         0,0 $inner.summary -cspan 2 \
    1983         1,0 $inner.pdb_button -cspan 2 -anchor w \
    1984         2,0 $inner.image_button -cspan 2 -rspan 2 -anchor nw -ipadx 2 -ipady 2 \
    1985         3,1 $controls -fill both \
    1986         6,0 $inner.go -cspan 2 -pady 5
    1987     blt::table configure $inner c0 -width 11
    1988     blt::table configure $inner r2 -height 11
    1989     #blt::table configure $inner c1 -width 8
    1990     raise $inner.image_button
    1991     $inner.pdb_button invoke
    1992     $controls.bgcolor_combo value "Black"
    1993     $controls.size_combo value "Draft (400x400)"
    1994     $controls.type_combo value  "PNG Portable Network Graphics Format (*.png)"
    1995     return $inner
    1996 }
    1997 
    1998 itcl::body Rappture::MolvisViewer::EnableDownload { popup what } {
    1999     set inner [$popup component inner]
    2000     switch -- $what {
    2001         "pdb" {
    2002             foreach w [winfo children $inner.image_frame] {
    2003                 $w configure -state disabled
    2004             }
    2005         }
    2006         "image" {
    2007             foreach w [winfo children $inner.image_frame] {
    2008                 $w configure -state normal
    2009             }
    2010         }
    2011         default {
    2012             error "unknown type of download"
    2013         }
    2014     }
     2029        0,0 $inner.format_l -anchor e \
     2030        0,1 $inner.format -anchor w -fill x  \
     2031        1,0 $inner.size_l -anchor e \
     2032        1,1 $inner.size -anchor w -fill x \
     2033        2,0 $inner.bgcolor_l -anchor e \
     2034        2,1 $inner.bgcolor -anchor w -fill x \
     2035        3,0 $f -cspan 2 -fill x
     2036    blt::table configure $inner r0 r1 r2 r3 -pady { 4 0 }
     2037    blt::table configure $inner r3 -pady { 4 4 }
     2038    $inner.bgcolor value "Black"
     2039    $inner.size value "Draft (400x400)"
     2040    $inner.format value  "PNG (Portable Network Graphics format)"
    20152041}
    20162042
     
    21252151}
    21262152
     2153
     2154
  • trunk/lang/tcl/scripts/library.tcl

    r2616 r2688  
    1 
    21# ----------------------------------------------------------------------
    32#  COMPONENT: library - provides access to the XML library
  • trunk/packages/vizservers/pymolproxy/pymolproxy2.c

    r2637 r2688  
    9494static FILE *frecord;
    9595static int recording = FALSE;
     96static int pymolIsAlive = TRUE;
    9697
    9798#define WANT_DEBUG      0
     
    723724{
    724725    PymolProxy *p = clientData;
    725     int i, push, defer, state, size;
     726    int i, push, defer, bool, size;
    726727    const char *model;
    727728
     
    729730    model = "all";
    730731    size = 14;
    731     state = TRUE;
     732    bool = TRUE;
    732733    push = defer = FALSE;
    733734    for(i = 1; i < argc; i++) {
     
    744745                size = atoi(argv[i]);
    745746            }
    746         } else if (Tcl_GetBoolean(interp, argv[i], &state) != TCL_OK) {
     747        } else if (Tcl_GetBoolean(interp, argv[i], &bool) != TCL_OK) {
    747748            return TCL_ERROR;
    748749        }
     
    757758    SendCmd(p, "set label_color,white,%s\nset label_size,%d,%s\n",
    758759            model, size, model);
    759     if (state) {
     760    if (bool) {
    760761        SendCmd(p, "label %s,\"%%s%%s\" %% (ID,name)\n", model);
    761762    } else {
     
    843844        p->flags |= FORCE_UPDATE;
    844845    }
     846    p->cacheId = state;
    845847
    846848    /* Does not invalidate cache? */
     
    984986    /* Force pymol to update the current scene. */
    985987    SendCmd(p, "refresh\n");
    986 #ifdef notdef
    987     SendCmd(p, "png \"- %d %d %d\"\n", p->frame, p->cacheId, p->rockOffset);
    988 #endif
    989     SendCmd(p, "png -\n");
     988    /* This is a hack. We're encoding the filename to pass extra information
     989     * to the MyPNGWrite routine inside of pymol. Ideally these would be
     990     * parameters of a new "molvispng" command that would be passed all the
     991     * way through to MyPNGWrite.
     992     *
     993     * The extra information is contained in the token we get from the
     994     * molvisviewer client, the frame number, and rock offset. */
     995    SendCmd(p, "png -:%d:%d:%d\n", p->cacheId, p->frame, p->rockOffset);
    990996    return p->status;
    991997}
     
    10011007    /* Force pymol to update the current scene. */
    10021008    SendCmd(p, "refresh\n");
    1003 #ifdef notdef
    1004     SendCmd(p, "png \"- %d %d %d\",format=1\n", p->frame, p->cacheId,
     1009    /* This is a hack. We're encoding the filename to pass extra information
     1010     * to the MyPNGWrite routine inside of pymol. Ideally these would be
     1011     * parameters of a new "molvispng" command that would be passed all the
     1012     * way through to MyPNGWrite.
     1013     *
     1014     * The extra information is contained in the token we get from the
     1015     * molvisviewer client, the frame number, and rock offset. */
     1016    SendCmd(p, "png -:%d:%d:%d,format=1\n", p->cacheId, p->frame,
    10051017            p->rockOffset);
    1006 #endif
    1007     SendCmd(p, "png -,format=1\n");
    10081018    p->flags &= ~(UPDATE_PENDING|FORCE_UPDATE);
    10091019    return p->status;
     
    10421052        SendCmd(p, "bg_color %s\nrefresh\n", bgcolor);
    10431053    }
    1044     SendCmd(p, "ray %d,%d\n", width, height);
    1045 #ifdef notdef
    1046     SendCmd(p, "png \"- print 0 0\",dpi=300\nbg_color black\n");
    1047 #endif
    1048     SendCmd(p, "png -,dpi=300\nbg_color black\n");
     1054    /* This is a hack. We're encoding the filename to pass extra information
     1055     * to the MyPNGWrite routine inside of pymol. Ideally these would be
     1056     * parameters of a new "molvispng" command that would be passed all the
     1057     * way through to MyPNGWrite. 
     1058     *
     1059     * The extra information is contained in the token we get from the
     1060     * molvisviewer client, the frame number, and rock offset.
     1061     */
     1062    SendCmd(p, "png -:%s:0:0,width=%d,height=%d,ray=1,dpi=300\n",
     1063            token, width, height);
     1064    SendCmd(p, "bg_color black\n");
    10491065    return p->status;
    10501066}
     
    18911907{
    18921908    ERROR("pymol (%d) died unexpectedly", stats.pid);
     1909    pymolIsAlive = FALSE;
    18931910    /*DoExit(1);*/
    18941911}
     
    19872004        exit(-1);
    19882005    } else {
     2006        pymolIsAlive = TRUE;
    19892007        signal(SIGCHLD, ChildHandler);
    19902008    }
     
    21042122#endif
    21052123    Tcl_DStringInit(&command);
    2106     for (;;) {
     2124    while (pymolIsAlive) {
    21072125        tvPtr = NULL;
    21082126#if READ_DEBUG
    21092127        DEBUG("Start I/O set");
    21102128#endif
    2111         while (WaitForNextLine(&p->client, tvPtr)) {
     2129        while ((pymolIsAlive) && (WaitForNextLine(&p->client, tvPtr))) {
    21122130            size_t numBytes;
    21132131            const char *line;
     
    21822200#endif
    21832201    list.headPtr = list.tailPtr = NULL;
    2184     for (;;) {
     2202    while (pymolIsAlive) {
    21852203        while (WaitForNextLine(bp, NULL)) {
    21862204            Image *imgPtr;
     
    22002218                return NULL;
    22012219            }
    2202             if (strncmp(line, "ppm image follows: ", 16) != 0) {
     2220#if WRITE_DEBUG
     2221            DEBUG("Writer: line found is %s\n", line);
     2222#endif
     2223            if (strncmp(line, "image follows: ", 15) != 0) {
    22032224                continue;
    22042225            }
    2205 #ifdef notdef
    22062226            if (sscanf(line, "image follows: %d %s %d %d\n", &numBytes, cacheId,
    22072227                       &frameNum, &rockOffset) != 4) {
     
    22102230                return NULL;
    22112231            }
    2212 #endif
    2213             if (sscanf(line, "ppm image follows: %d\n", &numBytes) != 1) {
    2214                 ERROR("can't get # bytes from \"%s\"", line);
    2215                 DEBUG("Leaving Writer thread");
    2216                 return NULL;
    2217             }
    22182232#if WRITE_DEBUG
    22192233            DEBUG("found image line \"%.*s\"", numBytes, line);
    22202234#endif
    2221             strcpy(cacheId, "0");
    2222             frameNum = 0;
    2223             rockOffset = 0;
    2224             sprintf(header, "nv>image %d %s %d %d\n", numBytes, cacheId, frameNum,
    2225                     rockOffset);
     2235            sprintf(header, "nv>image %d %s %d %d\n", numBytes, cacheId,
     2236                    frameNum, rockOffset);
    22262237            hdrLength = strlen(header);
    22272238#if WRITE_DEBUG
    2228             DEBUG("Queueing image numBytes=%d frameNum=%d, rockOffset=%d size=%d\n", numBytes, frameNum, rockOffset, numBytes + hdrLength);
     2239            DEBUG("Queueing image numBytes=%d cacheId=%s, frameNum=%d, rockOffset=%d size=%d\n", numBytes, cacheId, frameNum, rockOffset, numBytes + hdrLength);
    22292240#endif
    22302241            imgPtr = NewImage(&list, numBytes + hdrLength);
Note: See TracChangeset for help on using the changeset viewer.