Changeset 2745 for branches


Ignore:
Timestamp:
Dec 27, 2011, 2:46:12 PM (13 years ago)
Author:
gah
Message:

sync with trunk

Location:
branches/blt4/gui/scripts
Files:
2 added
50 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/gui/scripts/analyzer.tcl

    r2690 r2745  
    445445            set ::errorInfo "\n\n== RAPPTURE INPUT ==\n[$_tool xml xml]"
    446446            Rappture::bugreport::register "Problem launching job:\n$result"
    447             Rappture::bugreport::attachment [$_tool xml xml]
     447            Rappture::bugreport::attachment [$_tool xml xml]
    448448            Rappture::bugreport::send
    449449        }
     
    567567                _autoLabel $xmlobj output.$item "Sequence" counters
    568568            }
    569             default {
    570                 if 0 {
    571                     puts stderr "unknown output $item"
    572                 }
    573             }
     569            default {
     570                if 0 {
     571                    puts stderr "unknown output $item"
     572                }
     573            }
    574574        }
    575575        set label [$xmlobj get output.$item.about.group]
     
    596596            }
    597597            set hidden [$xmlobj get output.$item.hide]
    598             if { $hidden == "" } {
    599                 set hidden 0
    600             }
     598            if { $hidden == "" } {
     599                set hidden 0
     600            }
    601601            if {"" != $label && !$hidden} {
    602602                if {![info exists _label2page($label)]} {
     
    668668    foreach label [array names _label2page] {
    669669        set page $_label2page($label)
    670         destroy $page.rviewer
     670        destroy $page.rviewer
    671671        #$page.rviewer clear
    672672    }
     
    12491249                set line [string trim $line]
    12501250                if { $line == "" } {
    1251                     continue;           # Skip blank lines.
     1251                    continue;           # Skip blank lines.
    12521252                }
    12531253                if { [string match "ENDMDL*" $line] } {
     
    12951295        set line [string trim $line]
    12961296        if { $line == "" } {
    1297             continue;                   # Skip blank lines
     1297            continue;                   # Skip blank lines
    12981298        }
    12991299        if {[regexp {^[\t ]*ITEM:[ \t]+ATOMS} $line] } {
     
    13311331# USAGE: _trajToSequence <xmlobj> ?<path>?
    13321332#
    1333 #       Check for PDB and LAMMPS trajectories in molecule data and rewrite
    1334 #       the individual models as a sequence of molecules.  Used internally
    1335 #       to detect any molecule output elements that contain trajectory data.
    1336 #       Trajectories will be converted into sequences of individual molecules.
    1337 #       All other elements will be unaffected. Scans the entire xml tree if a
    1338 #       starting path is not specified. 
     1333#       Check for PDB and LAMMPS trajectories in molecule data and rewrite
     1334#       the individual models as a sequence of molecules.  Used internally
     1335#       to detect any molecule output elements that contain trajectory data.
     1336#       Trajectories will be converted into sequences of individual molecules.
     1337#       All other elements will be unaffected. Scans the entire xml tree if a
     1338#       starting path is not specified. 
    13391339#
    13401340# ----------------------------------------------------------------------
     
    13501350            set isTraj [$xmlobj get ${current}.components.molecule.trajectory]
    13511351            if { $isTraj == "" || !$isTraj } {
    1352                 continue;               # Not a trajectory.
     1352                continue;               # Not a trajectory.
    13531353            }
    13541354            # Look for trajectory if molecule element found.  Check both pdb
  • branches/blt4/gui/scripts/bugreport.tcl

    r2690 r2745  
    8686        set w [winfo reqwidth .bugreport]
    8787        set h [winfo reqheight .bugreport]
    88         #gah@purdue: temporary hack to force view of dismiss button
    89         incr h 300
     88        #gah@purdue: temporary hack to force view of dismiss button
     89        incr h 300
    9090        set x [expr {([winfo screenwidth .bugreport]-$w)/2}]
    9191        if {$x < 0} {set x "+0"} else {set x "+$x"}
     
    471471    set toolFile ""
    472472    if { [info exists details(attachment)] } {
    473         set toolFile "/tmp/tool[pid].xml"
    474         set f [open $toolFile "w"]
    475         puts $f $details(attachment)
    476         close $f
    477         unset details(attachment)
     473        set toolFile "/tmp/tool[pid].xml"
     474        set f [open $toolFile "w"]
     475        puts $f $details(attachment)
     476        close $f
     477        unset details(attachment)
    478478    }
    479479    set query [http::formatQuery \
     
    496496    set url [Rappture::Tool::resources -huburl]
    497497    if { $url == "" } {
    498         set url "http://hubzero.org"
     498        set url "http://hubzero.org"
    499499    }
    500500    if {[string index $url end] == "/"} {
     
    514514
    515515    if { $toolFile != "" } {
    516         file delete $toolFile
     516        file delete $toolFile
    517517    }
    518518    if {[regexp {Ticket #[0-9]* +\(.*?\) +[0-9]+ +times} $info match]} {
  • branches/blt4/gui/scripts/datatable.tcl

    r2287 r2745  
    3636
    3737    protected method Build {}
    38     private variable _xmlobj ""  ;      # ref to lib obj with datatable data
    39     private variable _datatable "";     # lib obj representing this datatable
     38    private variable _xmlobj ""  ;      # ref to lib obj with datatable data
     39    private variable _datatable "";     # lib obj representing this datatable
    4040    private variable _columns ""
    41     private variable _hints      ;      # cache of hints stored in XML
     41    private variable _hints      ;      # cache of hints stored in XML
    4242    private variable _tree ""
    4343}
     
    132132    # Sniff for column information: label, descriptions, and style
    133133    foreach cname [$_datatable children -type "column"] {
    134         set label        [$_datatable get "$cname.label"]
     134        set label        [$_datatable get "$cname.label"]
    135135        set description  [$_datatable get "$cname.description"]
    136         set style        [$_datatable get "$cname.style"]
    137         set format      [$_datatable get "$cname.format"]
     136        set style        [$_datatable get "$cname.style"]
     137        set format      [$_datatable get "$cname.format"]
    138138        lappend _columns $label $description $style $format
    139139    }
     
    141141    set _tree [blt::tree create]
    142142    if {"" != $csvdata} {
    143         set d0 [blt::datatable create]
    144         package require blt_datatable_csv
    145         $d0 import csv -data $csvdata
     143        set d0 [blt::datatable create]
     144        package require blt_datatable_csv
     145        $d0 import csv -data $csvdata
    146146        for { set row 1 } { $row <= [$d0 numrows] } { incr row } {
    147147            set child [$_tree insert 0]
    148148            set c 0
    149             set values [$d0 row values $row]
     149            set values [$d0 row values $row]
    150150            foreach value $values {label description style format} $_columns {
    151151                if { $label == "" } {
     
    156156            }
    157157        }
    158         blt::datatable destroy $d0
     158        blt::datatable destroy $d0
    159159    }
    160160}
  • branches/blt4/gui/scripts/datatableresult.tcl

    r2287 r2745  
    6868    private variable _dataobj2dashes ;# maps dataobj => BLT -dashes list
    6969    private variable _dataobj2raise  ;# maps dataobj => raise flag 0/1
    70     private variable _raised    "";
     70    private variable _raised    "";
    7171    common _downloadPopup          ;# download options from popup
    7272}
     
    246246                    # generate the comma-separated value data for these objects
    247247
    248                     # This is at least better than what was there.
    249                     # For each datatable object convert the values
    250                     # in the tree by loading it into a blt::datatable
    251                     # and then exporting the comma separated values
     248                    # This is at least better than what was there.
     249                    # For each datatable object convert the values
     250                    # in the tree by loading it into a blt::datatable
     251                    # and then exporting the comma separated values
    252252                    set csvdata ""
    253253                    foreach dataobj $dlist {
    254                         set tree [$dataobj values]
    255                         set d0 [blt::datatable create]
    256                         package require blt_datatable_tree
    257                         $d0 import tree $tree 0
     254                        set tree [$dataobj values]
     255                        set d0 [blt::datatable create]
     256                        package require blt_datatable_tree
     257                        $d0 import tree $tree 0
    258258                        append csvdata "[string repeat - 60]\n"
    259259                        append csvdata " [$dataobj hints label]\n"
     
    267267                        }
    268268                        append csvdata "[string repeat - 60]\n"
    269                         $d0 column delete 1
    270                         append csvdata [$d0 export csv -columnlabels]
     269                        $d0 column delete 1
     270                        append csvdata [$d0 export csv -columnlabels]
    271271                        append csvdata "\n"
    272                         blt::datatable destroy $d0
     272                        blt::datatable destroy $d0
    273273                    }
    274274                    return [list .csv $csvdata]
     
    324324                $itk_component(treeview) column bind $c <Leave> \
    325325                    { Rappture::Tooltip::tooltip cancel }
    326                 if { $fmt != "" } {
    327                     $itk_component(treeview) column configure $c \
    328                         -formatcommand [itcl::code $this FormatColumn $fmt]
    329                 }
     326                if { $fmt != "" } {
     327                    $itk_component(treeview) column configure $c \
     328                        -formatcommand [itcl::code $this FormatColumn $fmt]
     329                }
    330330            }
    331331        }   
  • branches/blt4/gui/scripts/deviceViewer1D.tcl

    r1923 r2745  
    362362        foreach name $tabs {
    363363            $itk_component(tabs) insert end $name
    364 #               -activebackground $itk_option(-background)
     364#               -activebackground $itk_option(-background)
    365365        }
    366366        $itk_component(tabs) select 0
  • branches/blt4/gui/scripts/dispatcher.tcl

    r1923 r2745  
    224224# ----------------------------------------------------------------------
    225225# USAGE: cancel ?!event ...?
    226 #        cancel all
     226#        cancel all
    227227#
    228228# Used to cancel any event notifications pending for the specified
  • branches/blt4/gui/scripts/drawing.tcl

    r2534 r2745  
    7575                set _styles($elem) [$_xmlobj get $path.$elem.about.style]
    7676                set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    77                 set _types($elem) polydata
    78             }
     77                set _types($elem) polydata
     78            }
    7979            streamlines* {
    8080                set _data($elem) [$_xmlobj get $path.$elem.vtk]
    8181                set _styles($elem) [$_xmlobj get $path.$elem.about.style]
    8282                set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    83                 set _types($elem) streamlines
    84             }
     83                set _types($elem) streamlines
     84            }
    8585            spheres* {
    8686                set _data($elem) [$_xmlobj get $path.$elem.vtk]
    8787                set _styles($elem) [$_xmlobj get $path.$elem.about.style]
    8888                set _labels($elem) [$_xmlobj get $path.$elem.about.label]
    89                 set _types($elem) spheres
     89                set _types($elem) spheres
    9090            }
    9191        }
     
    9595        label   about.label
    9696        color   about.color
    97         camera  about.camera
     97        camera  about.camera
    9898        type    about.type
    9999        xlabel  xaxis.label
     
    139139# label --
    140140#
    141 #       Returns the label of the named drawing element.
     141#       Returns the label of the named drawing element.
    142142#
    143143itcl::body Rappture::Drawing::label { elem } {
     
    151151# type --
    152152#
    153 #       Returns the type of the named drawing element.
     153#       Returns the type of the named drawing element.
    154154#
    155155itcl::body Rappture::Drawing::type { elem } {
     
    163163# style --
    164164#
    165 #       Returns the style string of the named drawing element.
     165#       Returns the style string of the named drawing element.
    166166#
    167167itcl::body Rappture::Drawing::style { elem } {
     
    175175# data --
    176176#
    177 #       Returns the data of the named drawing element.
     177#       Returns the data of the named drawing element.
    178178#
    179179itcl::body Rappture::Drawing::data { elem } {
     
    186186# ----------------------------------------------------------------------
    187187# method values
    188 #       Returns a base64 encoded, gzipped Tcl list that represents the
    189 #       Tcl command and data to recreate the uniform rectangular grid
    190 #       on the nanovis server.
     188#       Returns a base64 encoded, gzipped Tcl list that represents the
     189#       Tcl command and data to recreate the uniform rectangular grid
     190#       on the nanovis server.
    191191# ----------------------------------------------------------------------
    192192itcl::body Rappture::Drawing::values { elem } {
     
    203203# ----------------------------------------------------------------------
    204204# method limits <axis>
    205 #       Returns a list {min max} representing the limits for the
    206 #       specified axis.
     205#       Returns a list {min max} representing the limits for the
     206#       specified axis.
    207207# ----------------------------------------------------------------------
    208208itcl::body Rappture::Drawing::limits {which} {
  • branches/blt4/gui/scripts/field.tcl

    r2742 r2745  
    4040    protected method _getValue {expr}
    4141
    42     private variable _xmlobj ""  ;      # ref to XML obj with device data
    43     private variable _path "";          # Path of this object in the XML
    44     private variable _units ""   ;      # system of units for this field
     42    private variable _xmlobj ""  ;      # ref to XML obj with device data
     43    private variable _path "";          # Path of this object in the XML
     44    private variable _units ""   ;      # system of units for this field
    4545    private variable _limits     ;# maps box name => {z0 z1} limits
    4646    private variable _zmax 0     ;# length of the device
     
    233233    }
    234234    if { [info exists _comp2vtkstreamlines($what)] } {
    235         # FIXME: Need to process the vtk file data to pull out the field's
    236         # values.
    237         error "vtkstreamlines: values not implements"
     235        # FIXME: Need to process the vtk file data to pull out the field's
     236        # values.
     237        error "vtkstreamlines: values not implements"
    238238        return [lindex $_comp2vtkstreamlines($what) 1]
    239239    }
     
    272272    }
    273273    if { [info exists _comp2vtkstreamlines($what)] } {
    274         # Return the contents of the vtk file.
     274        # Return the contents of the vtk file.
    275275        return $_comp2vtkstreamlines($what)
    276276    }
     
    538538    set hints(path) $_path
    539539    if 0 {
    540         # to be compatible with curve objects
    541         set hints(xlabel) "Position"
     540        # to be compatible with curve objects
     541        set hints(xlabel) "Position"
    542542    }
    543543    if {[info exists hints(group)] && [info exists hints(label)]} {
     
    607607            set type "points-on-mesh"
    608608        } elseif {[$_field element $cname.vtk] != ""} {
    609             if { [$_field get "about.view"] == "streamlines" } {
    610                 set type "vtkstreamlines"
    611             } else {
    612                 set type "vtk"
    613             }
     609            if { [$_field get "about.view"] == "streamlines" } {
     610                set type "vtkstreamlines"
     611            } else {
     612                set type "vtk"
     613            }
    614614        } elseif {[$_field element $cname.opendx] != ""} {
    615             global env
    616             if { [info exists env(VTKVOLUME)] } {
    617                 set type "vtkvolume"
    618             } else {
    619                 set type "dx"
    620             }
     615            global env
     616            if { [info exists env(VTKVOLUME)] } {
     617                set type "vtkvolume"
     618            } else {
     619                set type "dx"
     620            }
    621621        } elseif {[$_field element $cname.dx] != ""} {
    622             global env
    623             if { [info exists env(VTKVOLUME)] } {
    624                 set type "vtkvolume"
    625             } else {
    626                 set type "dx"
    627             }
     622            global env
     623            if { [info exists env(VTKVOLUME)] } {
     624                set type "vtkvolume"
     625            } else {
     626                set type "dx"
     627            }
    628628        }
    629629        set _comp2style($cname) ""
     
    636636        }
    637637        set _comp2extents($cname) $extents
    638         set _type $type
     638        set _type $type
    639639        if {$type == "1D"} {
    640640            #
     
    798798        } elseif {$type == "vtkstreamlines"} {
    799799            set _comp2dims($cname) "3D"
    800             # Allow redirects to another element.
     800            # Allow redirects to another element.
    801801            set vtkdata [$_field get $cname.vtk]
    802             if { ![string match "!*" $vtkdata] } {
    803                 set _comp2vtkstreamlines($cname) $vtkdata
    804             } else {
    805                 set path [string range $vtkdata 1 end]
    806                 if { [$_xmlobj element $path] == "" } {
    807                     error "bad redirection path \"$path\""
    808                 }
    809                 puts stderr path=$path
    810                 set element [$_xmlobj element -as type $path]
    811                 if { $element != "vtk" } {
    812                     error "bad path \"$path\": must redirect to a vtk element"
    813                 }
    814                 set _comp2vtkstreamlines($cname) [$_xmlobj get $path]
    815             }
     802            if { ![string match "!*" $vtkdata] } {
     803                set _comp2vtkstreamlines($cname) $vtkdata
     804            } else {
     805                set path [string range $vtkdata 1 end]
     806                if { [$_xmlobj element $path] == "" } {
     807                    error "bad redirection path \"$path\""
     808                }
     809                puts stderr path=$path
     810                set element [$_xmlobj element -as type $path]
     811                if { $element != "vtk" } {
     812                    error "bad path \"$path\": must redirect to a vtk element"
     813                }
     814                set _comp2vtkstreamlines($cname) [$_xmlobj get $path]
     815            }
    816816            set _comp2style($cname) [$_field get $cname.style]
    817817            incr _counter
    818818        } elseif {$type == "vtkvolume"} {
    819819            set _comp2dims($cname) "3D"
    820             # Allow redirects to another element.
    821             set data [$_field get -decode no $cname.dx]
     820            # Allow redirects to another element.
     821            set data [$_field get -decode no $cname.dx]
    822822            set data [Rappture::encoding::decode -as zb64 $data]
    823             if 1 {
    824             set file "/tmp/$cname.dx"
    825             set f [open $file "w"]
    826             puts $f $data
    827             close $f
    828             }
    829             set data [Rappture::ConvertDxToVtk $data]
    830             if 1 {
    831             set file "/tmp/$cname.vtk"
    832             set f [open $file "w"]
    833             puts $f $data
    834             close $f
    835             }
    836             set _comp2vtkvolume($cname) $data
     823            if 1 {
     824            set file "/tmp/$cname.dx"
     825            set f [open $file "w"]
     826            puts $f $data
     827            close $f
     828            }
     829            set data [Rappture::ConvertDxToVtk $data]
     830            if 1 {
     831            set file "/tmp/$cname.vtk"
     832            set f [open $file "w"]
     833            puts $f $data
     834            close $f
     835            }
     836            set _comp2vtkvolume($cname) $data
    837837            set _comp2style($cname) [$_field get $cname.style]
    838838            incr _counter
     
    850850            set _comp2dims($cname) "3D"
    851851            set _comp2dx($cname)  [$_field get -decode no $cname.dx]
    852             if 1 {
     852            if 1 {
    853853            set data  [$_field get -decode yes $cname.dx]
    854             set file "/tmp/junk.dx"
    855             set f [open $file "w"]
    856             puts $f $data
    857             close $f
    858             if { [string match "<ODX>*" $data] } {
    859                 set data [string range $data 5 end]
    860                 set _comp2dx($cname) \
    861                         [Rappture::encoding::encode -as zb64 $data]
    862             }
    863             }
     854            set file "/tmp/junk.dx"
     855            set f [open $file "w"]
     856            puts $f $data
     857            close $f
     858            if { [string match "<ODX>*" $data] } {
     859                set data [string range $data 5 end]
     860                set _comp2dx($cname) \
     861                        [Rappture::encoding::encode -as zb64 $data]
     862            }
     863            }
    864864            set _comp2style($cname) [$_field get $cname.style]
    865865            if {[$_field element $cname.flow] != ""} {
     
    10251025    }
    10261026    if { [info exists _comp2vtkstreamlines($what)] } {
    1027         # Return the contents of the vtk file.
     1027        # Return the contents of the vtk file.
    10281028        return $_comp2vtkstreamlines($what)
    10291029    }
    10301030    if { [info exists _comp2vtkvolume($what)] } {
    1031         # Return the contents of the vtk file.
     1031        # Return the contents of the vtk file.
    10321032        return $_comp2vtkvolume($what)
    10331033    }
    10341034    if {[info exists _comp2dx($what)]} {
    1035         return $_comp2dx($what)
     1035        return $_comp2dx($what)
    10361036    }
    10371037    if {[info exists _comp2unirect2d($what)]} {
  • branches/blt4/gui/scripts/field2dresult.tcl

    r2742 r2745  
    5858    set servers ""
    5959    switch -- $flags(-mode) {
    60         "auto" - "heightmap" - "flowvis" {
    61             set servers [Rappture::VisViewer::GetServerList "nanovis"]
    62         }
    63         "vtkcontour" - "vtkheightmap" {
    64             set servers [Rappture::VisViewer::GetServerList "vtkvis"]
    65         }
    66         "vtk" {
    67             # Old vtk contour widget
    68         }
    69         default {
    70             puts stderr "unknown render mode \"$flags(-mode)\""
    71         }
    72     }           
     60        "auto" - "heightmap" - "flowvis" {
     61            set servers [Rappture::VisViewer::GetServerList "nanovis"]
     62        }
     63        "vtkcontour" - "vtkheightmap" {
     64            set servers [Rappture::VisViewer::GetServerList "vtkvis"]
     65        }
     66        "vtk" {
     67            # Old vtk contour widget
     68        }
     69        default {
     70            puts stderr "unknown render mode \"$flags(-mode)\""
     71        }
     72    }           
    7373    if {"" != $servers && $flags(-mode) != "vtk"} {
    7474        switch -- $flags(-mode) {
     
    9696                puts stderr "unknown render mode \"$flags(-mode)\""
    9797            }
    98         }               
     98        }               
    9999        pack $itk_component(renderer) -expand yes -fill both
    100100        # can't connect to rendering farm?  then fall back to older viewer
  • branches/blt4/gui/scripts/field3dresult.tcl

    r2742 r2745  
    5656    array set flags $args
    5757    switch -- $flags(-mode) {
    58         "auto" - "nanovis" - "flowvis" {
    59             set servers [Rappture::VisViewer::GetServerList "nanovis"]
    60         }
    61         "vtkcontour" - "vtkstreamlines" - "vtkvolume" - "vtkviewer"  {
    62             set servers [Rappture::VisViewer::GetServerList "vtkvis"]
    63         }
    64         "vtk" {
    65             # Old vtk contour widget
    66             set servers ""
    67         }
    68         default {
    69             puts stderr "unknown render mode \"$flags(-mode)\""
    70         }
    71     }           
     58        "auto" - "nanovis" - "flowvis" {
     59            set servers [Rappture::VisViewer::GetServerList "nanovis"]
     60        }
     61        "vtkcontour" - "vtkstreamlines" - "vtkvolume" - "vtkviewer"  {
     62            set servers [Rappture::VisViewer::GetServerList "vtkvis"]
     63        }
     64        "vtk" {
     65            # Old vtk contour widget
     66            set servers ""
     67        }
     68        default {
     69            puts stderr "unknown render mode \"$flags(-mode)\""
     70        }
     71    }           
    7272    if {"" != $servers && $flags(-mode) != "vtk"} {
    7373        switch -- $flags(-mode) {
     
    8383            }
    8484            "vtkvolume" {
    85                 catch {
     85                catch {
    8686                itk_component add renderer {
    8787                    Rappture::VtkVolumeViewer $itk_interior.ren $servers
    8888                }
    89                 } errs
    90                 puts stderr errs=$errs
     89                } errs
     90                puts stderr errs=$errs
    9191            }
    9292            "vtkstreamlines" {
     
    9898                puts stderr "unknown render mode \"$flags(-mode)\""
    9999            }
    100         }               
     100        }               
    101101        pack $itk_component(renderer) -expand yes -fill both
    102102
  • branches/blt4/gui/scripts/filechoiceentry.tcl

    r1976 r2745  
    211211        }
    212212        # Replace the template with the substituted value.
    213         set files [Glob $glob]
    214         set allfiles [concat $allfiles $files]
     213        set files [Glob $glob]
     214        set allfiles [concat $allfiles $files]
    215215    }
    216216    set first ""
     
    287287    set files ""
    288288    if { [llength $rest] > 0 } {
    289         if { [catch {
    290             glob -nocomplain -type d $pattern
    291         } dirs] != 0 } {
    292             puts stderr "can't glob \"$pattern\": $dirs"
    293             return
    294         }
    295         foreach d $dirs {
    296             set files [concat $files [DoGlob $d $rest]]
    297         }
     289        if { [catch {
     290            glob -nocomplain -type d $pattern
     291        } dirs] != 0 } {
     292            puts stderr "can't glob \"$pattern\": $dirs"
     293            return
     294        }
     295        foreach d $dirs {
     296            set files [concat $files [DoGlob $d $rest]]
     297        }
    298298    } else {
    299         if { [catch {
    300             glob -nocomplain $pattern
    301         } files] != 0 } {
    302             puts stderr "can't glob \"$pattern\": $files"
    303             return
    304         }
     299        if { [catch {
     300            glob -nocomplain $pattern
     301        } files] != 0 } {
     302            puts stderr "can't glob \"$pattern\": $files"
     303            return
     304        }
    305305    }
    306306    return $files
     
    310310# Glob --
    311311#
    312 #       Matches a single pattern for files. This differs from the
    313 #       Tcl glob by
    314 #
    315 #       1. Only matches files, not directories.
    316 #       2. Doesn't stop on errors (e.g. unreadable directories).
     312#       Matches a single pattern for files. This differs from the
     313#       Tcl glob by
     314#
     315#       1. Only matches files, not directories.
     316#       2. Doesn't stop on errors (e.g. unreadable directories).
    317317#
    318318itcl::body Rappture::FileChoiceEntry::Glob { pattern } {
  • branches/blt4/gui/scripts/filelistentry.tcl

    r1976 r2745  
    101101
    102102    # Standard ButtonPress-1
    103     $itk_component(tree) bind Entry <ButtonPress-1> {  
     103    $itk_component(tree) bind Entry <ButtonPress-1> {  
    104104        Rappture::FileListEntry::SetSelectionAnchor %W current yes set
    105105        set blt::TreeView::_private(scroll) 1
     
    122122    }
    123123    # Shift-ButtonPress-1
    124     $itk_component(tree) bind Entry <Shift-ButtonPress-1> {    
     124    $itk_component(tree) bind Entry <Shift-ButtonPress-1> {    
    125125        Rappture::FileListEntry::SetSelectionAnchor %W current yes set
    126126        set blt::TreeView::_private(scroll) 1
     
    146146        set blt::TreeView::_private(scroll) 0
    147147    }
    148     $itk_component(tree) bind Entry <Control-ButtonPress-1> {  
     148    $itk_component(tree) bind Entry <Control-ButtonPress-1> {  
    149149        Rappture::FileListEntry::SetSelectionAnchor %W current no toggle
    150150        set blt::TreeView::_private(scroll) 1
     
    304304        }
    305305        # Replace the template with the substituted value.
    306         set files [Glob $glob]
    307         set allfiles [concat $allfiles $files]
     306        set files [Glob $glob]
     307        set allfiles [concat $allfiles $files]
    308308    }
    309309    set first ""
     
    402402    set files ""
    403403    if { [llength $rest] > 0 } {
    404         if { [catch {
    405             glob -nocomplain -type d $pattern
    406         } dirs] != 0 } {
    407             puts stderr "can't glob \"$pattern\": $dirs"
    408             return
    409         }
    410         foreach d $dirs {
    411             set files [concat $files [DoGlob $d $rest]]
    412         }
     404        if { [catch {
     405            glob -nocomplain -type d $pattern
     406        } dirs] != 0 } {
     407            puts stderr "can't glob \"$pattern\": $dirs"
     408            return
     409        }
     410        foreach d $dirs {
     411            set files [concat $files [DoGlob $d $rest]]
     412        }
    413413    } else {
    414         if { [catch {
    415             glob -nocomplain $pattern
    416         } files] != 0 } {
    417             puts stderr "can't glob \"$pattern\": $files"
    418             return
    419         }
     414        if { [catch {
     415            glob -nocomplain $pattern
     416        } files] != 0 } {
     417            puts stderr "can't glob \"$pattern\": $files"
     418            return
     419        }
    420420    }
    421421    return $files
     
    425425# Glob --
    426426#
    427 #       Matches a single pattern for files. This differs from the
    428 #       Tcl glob by
    429 #
    430 #       1. Only matches files, not directories.
    431 #       2. Doesn't stop on errors (e.g. unreadable directories).
     427#       Matches a single pattern for files. This differs from the
     428#       Tcl glob by
     429#
     430#       1. Only matches files, not directories.
     431#       2. Doesn't stop on errors (e.g. unreadable directories).
    432432#
    433433itcl::body Rappture::FileListEntry::Glob { pattern } {
  • branches/blt4/gui/scripts/filexfer.tcl

    r2173 r2745  
    343343        foreach prog {
    344344              clientaction
    345               /usr/lib/hubzero/clientaction
     345              /usr/lib/hubzero/clientaction
    346346              /apps/bin/clientaction
    347347              /apps/xvnc/bin/clientaction
  • branches/blt4/gui/scripts/flowdial.tcl

    r1923 r2745  
    151151    if { $relval > 1.0 } {
    152152        set relval 1.0
    153     }                                   
     153    }                                   
    154154    set _current $relval
    155155    after cancel [itcl::code $this _redraw]
  • branches/blt4/gui/scripts/flowhints.tcl

    r1923 r2745  
    4040    private method GetSize { obj path varName }
    4141
    42     private variable _boxes "";         # List of boxes for the flow.
    43     private variable _particles "";     # List of particle injection planes.
    44     private variable _hints;            # Array of settings for the flow.
     42    private variable _boxes "";         # List of boxes for the flow.
     43    private variable _particles "";     # List of particle injection planes.
     44    private variable _hints;            # Array of settings for the flow.
    4545    private variable _units ""
    4646}
     
    5555    }
    5656    array set _hints {
    57         "axis"          "x"
     57        "axis"          "x"
    5858        "description"   ""
    59         "outline"       "on"
    60         "position"      "0.0%"
    61         "streams"       "on"
    62         "arrows"        "off"
    63         "volume"        "on"
    64         "duration"      "1:00"
    65         "speed"         "1x"
     59        "outline"       "on"
     60        "position"      "0.0%"
     61        "streams"       "on"
     62        "arrows"        "off"
     63        "volume"        "on"
     64        "duration"      "1:00"
     65        "speed"         "1x"
    6666    }
    6767    set _units $units
     
    8484                array unset data
    8585                array set data {
    86                     "axis"          "x"
    87                     "color"         "blue"
     86                    "axis"          "x"
     87                    "color"         "blue"
    8888                    "description"   ""
    89                     "hide"          "no"
     89                    "hide"          "no"
    9090                    "label"         ""
    91                     "position"      "0.0%"
    92                     "size"          "1.2"
     91                    "position"      "0.0%"
     92                    "size"          "1.2"
    9393                }
    9494                set p [$f element -as object $child]
     
    115115                array unset data
    116116                array set data {
    117                     "color"         "green"
     117                    "color"         "green"
    118118                    "description"   ""
    119                     "hide"          "no"
    120                     "label"         ""
    121                     "linewidth"     "2"
     119                    "hide"          "no"
     120                    "label"         ""
     121                    "linewidth"     "2"
    122122                }
    123123                set b [$f element -as object $child]
  • branches/blt4/gui/scripts/flowvisviewer.tcl

    r2690 r2745  
    137137    private variable _style2objs   ;# maps tf back to list of
    138138                                    # dataobj-components using the tf.
    139     private variable _obj2flow;         # Maps dataobj-component to a flow.
     139    private variable _obj2flow;         # Maps dataobj-component to a flow.
    140140
    141141    private variable _click        ;# info used for rotate operations
     
    230230        psi     0
    231231        zoom    1.0
    232         pan-x   0
    233         pan-y   0
     232        pan-x   0
     233        pan-y   0
    234234    }
    235235    set _limits(vmin) 0.0
     
    237237
    238238    array set _settings [subst {
    239         $this-arrows            0
    240         $this-currenttime       0
    241         $this-duration          1:00
    242         $this-loop              0
    243         $this-pan-x             $_view(pan-x)
    244         $this-pan-y             $_view(pan-y)
    245         $this-phi               $_view(phi)
    246         $this-play              0
    247         $this-psi               $_view(psi)
    248         $this-speed             500
    249         $this-step              0
    250         $this-streams           0
    251         $this-theta             $_view(theta)
    252         $this-volume            1
    253         $this-xcutplane         0
    254         $this-xcutposition      0
    255         $this-ycutplane         0
    256         $this-ycutposition      0
    257         $this-zcutplane         0
    258         $this-zcutposition      0
    259         $this-zoom              $_view(zoom)
     239        $this-arrows            0
     240        $this-currenttime       0
     241        $this-duration          1:00
     242        $this-loop              0
     243        $this-pan-x             $_view(pan-x)
     244        $this-pan-y             $_view(pan-y)
     245        $this-phi               $_view(phi)
     246        $this-play              0
     247        $this-psi               $_view(psi)
     248        $this-speed             500
     249        $this-step              0
     250        $this-streams           0
     251        $this-theta             $_view(theta)
     252        $this-volume            1
     253        $this-xcutplane         0
     254        $this-xcutposition      0
     255        $this-ycutplane         0
     256        $this-ycutposition      0
     257        $this-zcutplane         0
     258        $this-zcutposition      0
     259        $this-zoom              $_view(zoom)
    260260    }]
    261261
     
    484484        0,7 $itk_component(speed) -padx {2 3}
    485485
    486 #       0,6 $itk_component(speedlabel) -padx {2 0}
     486#       0,6 $itk_component(speedlabel) -padx {2 0}
    487487    blt::table configure $itk_component(flowcontrols) c* -resize none
    488488    blt::table configure $itk_component(flowcontrols) c4 -resize both
     
    983983    # Actually write the commands to the server socket.  If it fails, we don't
    984984    # care.  We're finished here.
    985     SendBytes $_outbuf;                 
    986     set _buffering 0;                   # Turn off buffering.
    987     set _outbuf "";                     # Clear the buffer.             
     985    SendBytes $_outbuf;                 
     986    set _buffering 0;                   # Turn off buffering.
     987    set _outbuf "";                     # Clear the buffer.             
    988988}
    989989
     
    11161116# ReceiveData --
    11171117#
    1118 #       The procedure is the response from the render server to each "data
    1119 #       follows" command.  The server sends back a "data" command invoked our
    1120 #       the slave interpreter.  The purpose is to collect the min/max of the
    1121 #       volume sent to the render server.  Since the client (flowvisviewer)
    1122 #       doesn't parse 3D data formats, we rely on the server (flowvis) to
    1123 #       tell us what the limits are.  Once we've received the limits to all
    1124 #       the data we've sent (tracked by _recvObjs) we can then determine
    1125 #       what the transfer functions are for these # volumes.
     1118#       The procedure is the response from the render server to each "data
     1119#       follows" command.  The server sends back a "data" command invoked our
     1120#       the slave interpreter.  The purpose is to collect the min/max of the
     1121#       volume sent to the render server.  Since the client (flowvisviewer)
     1122#       doesn't parse 3D data formats, we rely on the server (flowvis) to
     1123#       tell us what the limits are.  Once we've received the limits to all
     1124#       the data we've sent (tracked by _recvObjs) we can then determine
     1125#       what the transfer functions are for these # volumes.
    11261126#
    11271127#       Note: There is a considerable tradeoff in having the server report
     
    12751275    SendBytes $_outbuf
    12761276    blt::busy release $itk_component(hull)
    1277     set _buffering 0;                   # Turn off buffering.
    1278     set _outbuf "";                     # Clear the buffer.             
     1277    set _buffering 0;                   # Turn off buffering.
     1278    set _outbuf "";                     # Clear the buffer.             
    12791279}
    12801280
     
    13291329                phi     45
    13301330                psi     0
    1331                 zoom    1.0
    1332                 pan-x   0
    1333                 pan-y   0
     1331                zoom    1.0
     1332                pan-x   0
     1333                pan-y   0
    13341334            }
    13351335            if { $_first != "" } {
     
    20732073itcl::body Rappture::FlowvisViewer::BuildViewTab {} {
    20742074    foreach { key value } {
    2075         grid            0
    2076         axes            0
    2077         outline         1
    2078         volume          1
    2079         legend          1
    2080         particles       1
    2081         lic             1
     2075        grid            0
     2076        axes            0
     2077        outline         1
     2078        volume          1
     2079        legend          1
     2080        particles       1
     2081        lic             1
    20822082    } {
    20832083        set _settings($this-$key) $value
     
    20952095        -window $tab.ss.frame
    20962096    pack $tab.ss -fill both -expand yes
    2097     blt::tk::scrollbar $tab.ss.xs               
    2098     blt::tk::scrollbar $tab.ss.ys               
     2097    blt::tk::scrollbar $tab.ss.xs               
     2098    blt::tk::scrollbar $tab.ss.ys               
    20992099    set inner [blt::tk::frame $tab.ss.frame]
    21002100
     
    21672167itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
    21682168    foreach { key value } {
    2169         light           40
    2170         transp          50
    2171         opacity         100
    2172         thickness       350
     2169        light           40
     2170        transp          50
     2171        opacity         100
     2172        thickness       350
    21732173    } {
    21742174        set _settings($this-$key) $value
     
    21832183        -window $tab.ss.frame
    21842184    pack $tab.ss -fill both -expand yes
    2185     blt::tk::scrollbar $tab.ss.xs               
    2186     blt::tk::scrollbar $tab.ss.ys               
     2185    blt::tk::scrollbar $tab.ss.xs               
     2186    blt::tk::scrollbar $tab.ss.ys               
    21872187    set inner [blt::tk::frame $tab.ss.frame]
    21882188    $inner configure -borderwidth 4
     
    22702270        -window $tab.ss.frame
    22712271    pack $tab.ss -fill both -expand yes
    2272     blt::tk::scrollbar $tab.ss.xs               
    2273     blt::tk::scrollbar $tab.ss.ys               
     2272    blt::tk::scrollbar $tab.ss.xs               
     2273    blt::tk::scrollbar $tab.ss.ys               
    22742274    set inner [blt::tk::frame $tab.ss.frame]
    22752275    $inner configure -borderwidth 4
     
    23792379        -window $tab.ss.frame
    23802380    pack $tab.ss -fill both -expand yes
    2381     blt::tk::scrollbar $tab.ss.xs               
    2382     blt::tk::scrollbar $tab.ss.ys               
     2381    blt::tk::scrollbar $tab.ss.xs               
     2382    blt::tk::scrollbar $tab.ss.ys               
    23832383    set inner [blt::tk::frame $tab.ss.frame]
    23842384    $inner configure -borderwidth 4
     
    24302430        -font "Arial 9"
    24312431
    2432     label $inner.particles -text "Particles"    -font "Arial 9 bold"
    2433     label $inner.boxes -text "Boxes"    -font "Arial 9 bold"
     2432    label $inner.particles -text "Particles"    -font "Arial 9 bold"
     2433    label $inner.boxes -text "Boxes"    -font "Arial 9 bold"
    24342434
    24352435    blt::table $inner \
     
    26852685# for flow visualization.
    26862686#
    2687 #       $this flow play
    2688 #       $this flow stop
    2689 #       $this flow toggle
    2690 #       $this flow reset
    2691 #       $this flow pause
    2692 #       $this flow next
     2687#       $this flow play
     2688#       $this flow stop
     2689#       $this flow toggle
     2690#       $this flow reset
     2691#       $this flow pause
     2692#       $this flow next
    26932693#
    26942694itcl::body Rappture::FlowvisViewer::flow { args } {
  • branches/blt4/gui/scripts/heightmapviewer.tcl

    r2690 r2745  
    7575    private method AddImageControls { frame widget }
    7676    private method SetWaitVariable { value } {
    77         set _getimage $value
     77        set _getimage $value
    7878    }
    7979    private method GetWaitVariable {} {
    80         return $_getimage
     80        return $_getimage
    8181    }
    8282    private method WaitForImage {} {
    83         tkwait variable [itcl::scope _getimage]
    84         return $_getimage
     83        tkwait variable [itcl::scope _getimage]
     84        return $_getimage
    8585    }
    8686
     
    117117    private variable _resizePending 0
    118118    private variable _resizeLegendPending 0
    119     private variable _frame 0;          # Current frame number.
     119    private variable _frame 0;          # Current frame number.
    120120    private variable _getimage 0;
    121121    private variable _downloadPopup
     
    157157
    158158    array set _downloadPopup {
    159         format image
    160         image_controls ""
     159        format image
     160        image_controls ""
    161161    }
    162162    # Initialize the view to some default parameters.
     
    166166        psi     0
    167167        zoom    1.0
    168         pan-x   0
    169         pan-y   0
     168        pan-x   0
     169        pan-y   0
    170170    }
    171171    foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} {
     
    173173    }
    174174    array set _settings [subst {
    175         $this-pan-x             $_view(pan-x)
    176         $this-pan-y             $_view(pan-y)
    177         $this-phi               $_view(phi)
    178         $this-psi               $_view(psi)
    179         $this-theta             $_view(theta)
    180         $this-surface           1
    181         $this-xcutplane         0
    182         $this-xcutposition      0
    183         $this-ycutplane         0
    184         $this-ycutposition      0
    185         $this-zcutplane         0
    186         $this-zcutposition      0
    187         $this-zoom              $_view(zoom)
     175        $this-pan-x             $_view(pan-x)
     176        $this-pan-y             $_view(pan-y)
     177        $this-phi               $_view(phi)
     178        $this-psi               $_view(psi)
     179        $this-theta             $_view(theta)
     180        $this-surface           1
     181        $this-xcutplane         0
     182        $this-xcutposition      0
     183        $this-ycutplane         0
     184        $this-ycutposition      0
     185        $this-zcutplane         0
     186        $this-zcutposition      0
     187        $this-zoom              $_view(zoom)
    188188    }]
    189189
     
    509509                label $inner.summary -text "" -anchor w
    510510                pack $inner.summary -side top
    511                 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
    512                     -variable \
    513                     ::Rappture::HeightmapViewer::_downloadPopup(format) \
    514                     -font "Arial 10 " \
    515                     -value image
    516                 Rappture::Tooltip::for $inner.image "Save as image."
     511                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     512                    -variable \
     513                    ::Rappture::HeightmapViewer::_downloadPopup(format) \
     514                    -font "Arial 10 " \
     515                    -value image
     516                Rappture::Tooltip::for $inner.image "Save as image."
    517517                pack $inner.image -anchor w
    518518                button $inner.go -text [Rappture::filexfer::label download] \
    519519                    -command [lindex $args 0]
    520520                pack $inner.go -side bottom -pady 4
    521                 $inner.image select
     521                $inner.image select
    522522            } else {
    523523                set inner [$popup component inner]
     
    527527            set word [Rappture::filexfer::label downloadWord]
    528528            $inner.summary configure -text "$word $num in the following format:"
    529             update idletasks ;          # Fix initial sizes
     529            update idletasks ;          # Fix initial sizes
    530530            return $popup
    531531        }
     
    542542                        # dialog widget to it.
    543543                        Rappture::Balloon $popup -title "Save as image..." \
    544                             -deactivatecommand \
    545                             [itcl::code $this SetWaitVariable 0]
     544                            -deactivatecommand \
     545                            [itcl::code $this SetWaitVariable 0]
    546546                        set inner [$popup component inner]
    547547                        AddImageControls $inner [lindex $args 0]
    548548                    } else {
    549549                        set inner [$popup component inner]
    550                     }                   
    551                     set _downloadPopup(image_controls) $inner
     550                    }                   
     551                    set _downloadPopup(image_controls) $inner
    552552                    update
    553553                    # Activate the popup and call for the output.
    554554                    foreach { widget toolName plotName } $args break
    555                     SetWaitVariable 0
     555                    SetWaitVariable 0
    556556                    $popup activate $widget left
    557                     set bool [WaitForImage]
     557                    set bool [WaitForImage]
    558558                    $popup deactivate
    559                     if { $bool } {
    560                         set inner $_downloadPopup(image_controls)
    561                         set fmt [$inner.format translate [$inner.format value]]
    562                         switch $fmt {
    563                             "jpg" {
    564                                 $_image(download) export jpg -quality 100 \
    565                                     -data bytes
    566                             }
    567                             "png" {
    568                                 $_image(download) export png -data bytes
    569                             }
    570                             "gif" {
    571                                 $_image(download) export gif -data bytes
    572                             }
    573                             default {
    574                                 return ""
    575                             }
    576                         }
    577                         return [list .$fmt $bytes]
    578                     }
    579                 }
    580             }
    581             return ""
     559                    if { $bool } {
     560                        set inner $_downloadPopup(image_controls)
     561                        set fmt [$inner.format translate [$inner.format value]]
     562                        switch $fmt {
     563                            "jpg" {
     564                                $_image(download) export jpg -quality 100 \
     565                                    -data bytes
     566                            }
     567                            "png" {
     568                                $_image(download) export png -data bytes
     569                            }
     570                            "gif" {
     571                                $_image(download) export gif -data bytes
     572                            }
     573                            default {
     574                                return ""
     575                            }
     576                        }
     577                        return [list .$fmt $bytes]
     578                    }
     579                }
     580            }
     581            return ""
    582582        }
    583583        default {
     
    827827    # care.  We're finished here.
    828828    blt::busy hold $itk_component(hull)
    829     SendBytes $_outbuf;                 
     829    SendBytes $_outbuf;                 
    830830    blt::busy release $itk_component(hull)
    831831
    832832    # The "readyForNextFrame" variable throttles the sequence play rate.
    833833    global readyForNextFrame
    834     set readyForNextFrame 0;            # Don't advance to the next frame
    835                                         # until we get an image.
    836     set _buffering 0;                   # Turn off buffering.
    837     set _outbuf "";                     # Clear the buffer.             
     834    set readyForNextFrame 0;            # Don't advance to the next frame
     835                                        # until we get an image.
     836    set _buffering 0;                   # Turn off buffering.
     837    set _outbuf "";                     # Clear the buffer.             
    838838}
    839839
     
    861861                phi     45
    862862                psi     0
    863                 zoom    1.0
    864                 pan-x   0
    865                 pan-y   0
     863                zoom    1.0
     864                pan-x   0
     865                pan-y   0
    866866            }
    867867            if { $_first != "" } {
     
    12331233        -window $tab.ss.frame
    12341234    pack $tab.ss -fill both -expand yes
    1235     blt::tk::scrollbar $tab.ss.xs               
    1236     blt::tk::scrollbar $tab.ss.ys               
     1235    blt::tk::scrollbar $tab.ss.xs               
     1236    blt::tk::scrollbar $tab.ss.ys               
    12371237    set inner [blt::tk::frame $tab.ss.frame]
    12381238    $inner configure -borderwidth 4
    12391239
    12401240    foreach { key value } {
    1241         grid            1
    1242         axes            0
    1243         contourlines    1
    1244         wireframe       fill
    1245         legend          1
     1241        grid            1
     1242        axes            0
     1243        contourlines    1
     1244        wireframe       fill
     1245        legend          1
    12461246    } {
    12471247        set _settings($this-$key) $value
     
    13051305        -window $tab.ss.frame
    13061306    pack $tab.ss -fill both -expand yes
    1307     blt::tk::scrollbar $tab.ss.xs               
    1308     blt::tk::scrollbar $tab.ss.ys               
     1307    blt::tk::scrollbar $tab.ss.xs               
     1308    blt::tk::scrollbar $tab.ss.ys               
    13091309    set inner [blt::tk::frame $tab.ss.frame]
    13101310    $inner configure -borderwidth 4
  • branches/blt4/gui/scripts/histogram.tcl

    r2518 r2745  
    4242    private variable _widths     ;# array of vectors of bin widths
    4343    private variable _yvalues    ;# array of vectors of bin heights along
    44                                 ;# y-axis.
     44                                ;# y-axis.
    4545    private variable _xvalues    ;# array of vectors of bin locations along
    46                                 ;# x-axis.
     46                                ;# x-axis.
    4747    private variable _xlabels    ;# array of labels
    4848    private variable _hints      ;# cache of hints stored in XML
     
    8484itcl::body Rappture::Histogram::mesh { comp } {
    8585    if { [info exists _xvalues($comp)] } {
    86         return $_xvalues($comp)
     86        return $_xvalues($comp)
    8787    }
    8888    return ""
     
    9696itcl::body Rappture::Histogram::values { comp } {
    9797    if { [info exists _yvalues($comp)] } {
    98         return $_yvalues($comp)
     98        return $_yvalues($comp)
    9999    }
    100100    return ""
     
    110110itcl::body Rappture::Histogram::widths { comp } {
    111111    if { [info exists _widths($comp)] } {
    112         return $_widths($comp)
     112        return $_widths($comp)
    113113    }
    114114    return ""
     
    124124itcl::body Rappture::Histogram::xlabels { comp } {
    125125    if { [info exists _xlabels($comp)] } {
    126         return $_xlabels($comp)
     126        return $_xlabels($comp)
    127127    }
    128128    return ""
     
    314314    #
    315315    foreach cname [$_hist children -type component] {
    316         ParseData $cname
     316        ParseData $cname
    317317    }
    318318    # Creates lists of x and y marker data.
     
    338338# ParseData --
    339339#
    340 #       Parse the components data representations.  The following
    341 #       elements may be used <xy>, <xhw>, <namevalue>, <xvector>,
    342 #       <yvector>.  Only one element is used for data. 
     340#       Parse the components data representations.  The following
     341#       elements may be used <xy>, <xhw>, <namevalue>, <xvector>,
     342#       <yvector>.  Only one element is used for data. 
    343343#
    344344itcl::body Rappture::Histogram::ParseData { comp } {
     
    351351    set xydata [$_hist get ${comp}.xy]
    352352    if { $xydata != "" } {
    353         set count 0
     353        set count 0
    354354        foreach line [split $xydata \n] {
    355             foreach {name value} $line break
    356             $_yvalues($comp) append $value
    357             $_xvalues($comp) append $count
    358             lappend _xlabels($comp) $name
    359             incr count
    360         }          
    361         set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
    362         return
     355            foreach {name value} $line break
     356            $_yvalues($comp) append $value
     357            $_xvalues($comp) append $count
     358            lappend _xlabels($comp) $name
     359            incr count
     360        }          
     361        set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
     362        return
    363363    }
    364364    set xhwdata [$_hist get ${comp}.xhw]
    365365    if { $xhwdata != "" } {
    366         set count 0
     366        set count 0
    367367        foreach line [split $xhwdata \n] {
    368368            set n [scan $line {%s %s %s} name h w]
    369             lappend _xlabels($comp) $name
    370             $_xvalues($comp) append $count
    371             $_yvalues($comp) append $h
     369            lappend _xlabels($comp) $name
     370            $_xvalues($comp) append $count
     371            $_yvalues($comp) append $h
    372372            if { $n == 3 } {
    373373                $_widths($comp) append $w
    374374            }
    375             incr count
    376         }          
    377         set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
    378         return
     375            incr count
     376        }          
     377        set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
     378        return
    379379
    380380        # FIXME:  There must be a width specified for each bin location.
    381         #         If this isn't true, we default to uniform widths
    382         #         (zero-length _widths vector == uniform).
     381        #         If this isn't true, we default to uniform widths
     382        #         (zero-length _widths vector == uniform).
    383383        if { [$_xvalues($comp) length] != [$_widths($comp) length] } {
    384384            $_widths($comp) set {}
    385385        }
    386         set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
    387         return
     386        set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
     387        return
    388388    }
    389389    set xv [$_hist get $comp.xvector]
    390390    set yv [$_hist get $comp.yvector]
    391391    if { $xv != "" && $yv != "" } {
    392         $_yvalues($comp) set $yv
    393         $_xvalues($comp) seq 0 [$yv length]
    394         set _xlabels($comp)
     392        $_yvalues($comp) set $yv
     393        $_xvalues($comp) seq 0 [$yv length]
     394        set _xlabels($comp)
    395395    }
    396396    set _comp2hist($comp) [list $_xvalues($comp) $_yvalues($comp)]
     
    399399itcl::body Rappture::Histogram::Clear { {comp ""} } {
    400400    if { $comp == "" } {
    401         foreach name [array names _widths] {
    402             blt::vector destroy $_widths($name)
    403         }
    404         array unset _widths
    405         foreach name [array names _yvalues] {
    406             blt::vector destroy $_yvalues($name)
    407         }
    408         array unset _yvalues
    409         foreach name [array names _xvalues] {
    410             blt::vector destroy $_xvalues($name)
    411         }
    412         array unset _xvalues
    413         array unset _xlabels
    414         array unset _comp2hist
    415         return
     401        foreach name [array names _widths] {
     402            blt::vector destroy $_widths($name)
     403        }
     404        array unset _widths
     405        foreach name [array names _yvalues] {
     406            blt::vector destroy $_yvalues($name)
     407        }
     408        array unset _yvalues
     409        foreach name [array names _xvalues] {
     410            blt::vector destroy $_xvalues($name)
     411        }
     412        array unset _xvalues
     413        array unset _xlabels
     414        array unset _comp2hist
     415        return
    416416    }
    417417    if { [info exists _widths($comp)] } {
    418         blt::vector destroy $_widths($comp)
     418        blt::vector destroy $_widths($comp)
    419419    }
    420420    if { [info exists _yvalues($comp)] } {
    421         blt::vector destroy $_yvalues($comp)
     421        blt::vector destroy $_yvalues($comp)
    422422    }
    423423    if { [info exists _xvalues($comp)] } {
    424         blt::vector destroy $_xvalues($comp)
     424        blt::vector destroy $_xvalues($comp)
    425425    }
    426426    array unset _xvalues $comp
  • branches/blt4/gui/scripts/histogramresult.tcl

    r2560 r2745  
    363363    foreach obj $_dlist {
    364364        if {[info exists _dataobj2raise($obj)] && $_dataobj2raise($obj)} {
    365             lappend top $obj
    366         } else {
    367             lappend bottom $obj
    368         }
     365            lappend top $obj
     366        } else {
     367            lappend bottom $obj
     368        }
    369369    }
    370370    set _dlist [concat $bottom $top]
     
    689689        foreach {mapx mapy} [GetAxes $dataobj] break
    690690        foreach comp [$dataobj components] {
    691             set xv [$dataobj mesh $comp]
    692             set yv [$dataobj values $comp]
    693             set zv [$dataobj widths $comp]
    694             if {$xv eq "" || $yv eq "" || $zv eq ""} {
    695                 continue
    696             }
    697             if {[info exists _dataobj2color($dataobj)]} {
    698                 set color $_dataobj2color($dataobj)
    699             } else {
    700                 set color [$dataobj hints color]
    701                 if {"" == $color} {
    702                     set color black
    703                 }
    704             }
    705             if {[info exists _dataobj2width($dataobj)]} {
    706                 set lwidth $_dataobj2width($dataobj)
    707             } else {
    708                 set lwidth 2
    709             }
    710             if {[info exists _dataobj2dashes($dataobj)]} {
    711                 set dashes $_dataobj2dashes($dataobj)
    712             } else {
    713                 set dashes ""
    714             }
    715             if {([$xv length] <= 1) || ($lwidth == 0)} {
    716                 set sym square
    717                 set pixels 2
    718             } else {
    719                 set sym ""
    720                 set pixels 6
    721             }
    722             # Compute default bar width for histogram elements.
    723             if { [$zv length] == [$xv length] } {
    724                 foreach x [$xv values] y [$yv values] z [$zv values] {
    725                     set elem "elem[incr count]"
    726                     set _elem2dataobj($elem) $dataobj
    727                     $g element create $elem -x $x -y $y -barwidth $z \
    728                         -label $label -foreground $color \
    729                         -mapx $mapx -mapy $mapy
    730                 }
    731             } else {
    732                 set r [blt::vector expr {max($xv) - min($xv)}]
    733                 set z [expr {$r / ([$xv length]-1) * 0.8}]
    734                 set elem "elem[incr count]"
    735                 set _elem2dataobj($elem) $dataobj
    736                 $g element create $elem -x $xv -y $yv -barwidth $z \
     691            set xv [$dataobj mesh $comp]
     692            set yv [$dataobj values $comp]
     693            set zv [$dataobj widths $comp]
     694            if {$xv eq "" || $yv eq "" || $zv eq ""} {
     695                continue
     696            }
     697            if {[info exists _dataobj2color($dataobj)]} {
     698                set color $_dataobj2color($dataobj)
     699            } else {
     700                set color [$dataobj hints color]
     701                if {"" == $color} {
     702                    set color black
     703                }
     704            }
     705            if {[info exists _dataobj2width($dataobj)]} {
     706                set lwidth $_dataobj2width($dataobj)
     707            } else {
     708                set lwidth 2
     709            }
     710            if {[info exists _dataobj2dashes($dataobj)]} {
     711                set dashes $_dataobj2dashes($dataobj)
     712            } else {
     713                set dashes ""
     714            }
     715            if {([$xv length] <= 1) || ($lwidth == 0)} {
     716                set sym square
     717                set pixels 2
     718            } else {
     719                set sym ""
     720                set pixels 6
     721            }
     722            # Compute default bar width for histogram elements.
     723            if { [$zv length] == [$xv length] } {
     724                foreach x [$xv values] y [$yv values] z [$zv values] {
     725                    set elem "elem[incr count]"
     726                    set _elem2dataobj($elem) $dataobj
     727                    $g element create $elem -x $x -y $y -barwidth $z \
     728                        -label $label -foreground $color \
     729                        -mapx $mapx -mapy $mapy
     730                }
     731            } else {
     732                set r [blt::vector expr {max($xv) - min($xv)}]
     733                set z [expr {$r / ([$xv length]-1) * 0.8}]
     734                set elem "elem[incr count]"
     735                set _elem2dataobj($elem) $dataobj
     736                $g element create $elem -x $xv -y $yv -barwidth $z \
    737737                    -label $label -foreground $color \
    738738                    -mapx $mapx -mapy $mapy
    739             }
    740             set index 0
    741             foreach label [$dataobj xlabels $comp] {
    742                 if  { [string length $label] > 3 } {
    743                     set invert 1
    744                 }
    745                 set _xlabels($index) $label
    746                 incr index
    747             }
    748         }
     739            }
     740            set index 0
     741            foreach label [$dataobj xlabels $comp] {
     742                if  { [string length $label] > 3 } {
     743                    set invert 1
     744                }
     745                set _xlabels($index) $label
     746                incr index
     747            }
     748        }
    749749    }
    750750    foreach dataobj $_dlist {
    751         set xmin -Inf
    752         set ymin -Inf
    753         set xmax Inf
    754         set ymax Inf
    755         #
    756         # Create text/line markers for each *axis.marker specified.
     751        set xmin -Inf
     752        set ymin -Inf
     753        set xmax Inf
     754        set ymax Inf
     755        #
     756        # Create text/line markers for each *axis.marker specified.
    757757        #
    758758        foreach m [$dataobj xmarkers] {
     
    799799    set stepsize 1.0
    800800    if { [array size _xlabels] > 0 } {
    801         set command [itcl::code $this FormatLabels]
     801        set command [itcl::code $this FormatLabels]
    802802        if { [array size _xlabels] > 20 } {
    803803           set stepsize 0.0
    804804        }
    805805    } else {
    806         set command ""
     806        set command ""
    807807    }
    808808    $g axis configure x -command $command -stepsize $stepsize
     
    820820    set g $itk_component(plot)
    821821    foreach axis [$g axis names] {
    822         $g axis configure $axis -min "" -max ""
     822        $g axis configure $axis -min "" -max ""
    823823    }
    824824}
     
    876876            set results [$g element closest $x $y -interpolate no]
    877877            if { $results != "" } {
    878                 array set info $results
     878                array set info $results
    879879
    880880                set x [$g axis transform $mapx $info(x)]
     
    895895                append tip " @ $xval"
    896896                set tip [string trim $tip]
    897                 set index $info(index)
     897                set index $info(index)
    898898            }
    899899            set state 1
     
    915915                set x [$g axis transform $mapx $info(x)]
    916916                set y [$g axis transform $mapy $info(y)]
    917                 if { [$g cget -invertxy] } {
    918                     set tmp $x
    919                     set x $y
    920                     set y $tmp
    921                 }
     917                if { [$g cget -invertxy] } {
     918                    set tmp $x
     919                    set x $y
     920                    set y $tmp
     921                }
    922922               if {[info exists _elem2dataobj($elem)]} {
    923923                    set dataobj $_elem2dataobj($elem)
     
    934934                append tip " @ $xval"
    935935                set tip [string trim $tip]
    936                 set index $info(index)
     936                set index $info(index)
    937937                set state 1
    938938            } else {
     
    954954            Rappture::Tooltip::tooltip cancel
    955955        }
    956         if { $index != "" } {
    957             $g element activate $elem $index
    958             set _hilite(index) $index
    959         }
     956        if { $index != "" } {
     957            $g element activate $elem $index
     958            set _hilite(index) $index
     959        }
    960960        set _hilite(elem) $elem
    961961
     
    11111111            foreach { axis x y } $args break
    11121112            set g $itk_component(plot)
    1113             if { [$g cget -invertxy] } {
    1114                 set tmp $x
    1115                 set x $y
    1116                 set y $tmp
    1117             }
     1113            if { [$g cget -invertxy] } {
     1114                set tmp $x
     1115                set x $y
     1116                set y $tmp
     1117            }
    11181118
    11191119            set _axis(moved) 0
     
    11341134            foreach { axis x y } $args break
    11351135            set g $itk_component(plot)
    1136             if { [$g cget -invertxy] } {
    1137                 set tmp $x
    1138                 set x $y
    1139                 set y $tmp
    1140             }
     1136            if { [$g cget -invertxy] } {
     1137                set tmp $x
     1138                set x $y
     1139                set y $tmp
     1140            }
    11411141
    11421142            if {[info exists _axis(click-x)] && [info exists _axis(click-y)]} {
     
    11951195            foreach { axis x y } $args break
    11961196            set g $itk_component(plot)
    1197             if { [$g cget -invertxy] } {
    1198                 set tmp $x
    1199                 set x $y
    1200                 set y $tmp
    1201             }
     1197            if { [$g cget -invertxy] } {
     1198                set tmp $x
     1199                set x $y
     1200                set y $tmp
     1201            }
    12021202
    12031203            if {!$_axis(moved)} {
     
    14071407            set axis [lindex $args 0]
    14081408            set value [lindex $args 2]
    1409             if { $axis == "x" } {
    1410                 return [FormatLabels $itk_component(plot) $value]
    1411             }
     1409            if { $axis == "x" } {
     1410                return [FormatLabels $itk_component(plot) $value]
     1411            }
    14121412            if {[$itk_component(plot) axis cget $axis -logscale]} {
    14131413                set fmt "%.6g"
     
    15851585    set index [expr round($value)]
    15861586    if { [info exists _xlabels($index)] } {
    1587         return $_xlabels($index)
     1587        return $_xlabels($index)
    15881588    }
    15891589    return " "
  • branches/blt4/gui/scripts/icons.tcl

    r1923 r2745  
    8787            return ""
    8888        }
    89     }      
     89    }      
    9090    return $bytes
    9191}
  • branches/blt4/gui/scripts/imageentry.tcl

    r1932 r2745  
    176176    set fmt [$_owner xml get $_path.convert]
    177177    if {"" != $fmt && "" != $_imh} {
    178         switch -- $fmt {
    179             "pgm" - "ppm" {
    180                 $_imh export pbm -data bytes
    181             }
    182             "jpeg" {
    183                 $_imh export jpg -data bytes
    184             }
    185             "tiff" {
    186                 $_imh export tif -data bytes
    187             }
    188             "bmp" - "png" - "xbm" - "xpm" {
    189                 $_imh export $fmt -data bytes
    190             }
    191             default {
    192                 error "unknown image format \"$fmt\""
    193             }
    194         }
     178        switch -- $fmt {
     179            "pgm" - "ppm" {
     180                $_imh export pbm -data bytes
     181            }
     182            "jpeg" {
     183                $_imh export jpg -data bytes
     184            }
     185            "tiff" {
     186                $_imh export tif -data bytes
     187            }
     188            "bmp" - "png" - "xbm" - "xpm" {
     189                $_imh export $fmt -data bytes
     190            }
     191            default {
     192                error "unknown image format \"$fmt\""
     193            }
     194        }
    195195    }
    196196    return $bytes
  • branches/blt4/gui/scripts/imageresult.tcl

    r2048 r2745  
    4343    private method AddImageControls { frame widget }
    4444    private method SetWaitVariable { value } {
    45         set _getimage $value
     45        set _getimage $value
    4646    }
    4747    private method GetWaitVariable {} {
    48         return $_getimage
     48        return $_getimage
    4949    }
    5050    private method WaitForImage {} {
    51         tkwait variable [itcl::scope _getimage]
    52         return $_getimage
     51        tkwait variable [itcl::scope _getimage]
     52        return $_getimage
    5353    }
    5454
     
    8484    }
    8585    array set _downloadPopup {
    86         format image
    87         image_controls ""
     86        format image
     87        image_controls ""
    8888    }
    8989
     
    330330                label $inner.summary -text "" -anchor w
    331331                pack $inner.summary -side top
    332                 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
    333                     -variable \
    334                     ::Rappture::ImageResult::_downloadPopup(format) \
    335                     -font "Arial 10 " \
    336                     -value image
    337                 Rappture::Tooltip::for $inner.image "Save as image."
     332                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     333                    -variable \
     334                    ::Rappture::ImageResult::_downloadPopup(format) \
     335                    -font "Arial 10 " \
     336                    -value image
     337                Rappture::Tooltip::for $inner.image "Save as image."
    338338                pack $inner.image -anchor w
    339339                button $inner.go -text [Rappture::filexfer::label download] \
    340340                    -command [lindex $args 0]
    341341                pack $inner.go -side bottom -pady 4
    342                 $inner.image select
     342                $inner.image select
    343343            } else {
    344344                set inner [$popup component inner]
     
    348348            set word [Rappture::filexfer::label downloadWord]
    349349            $inner.summary configure -text "$word $num in the following format:"
    350             update idletasks ;          # Fix initial sizes
     350            update idletasks ;          # Fix initial sizes
    351351            return $popup
    352352        }
     
    358358            switch -- $_downloadPopup(format) {
    359359                "image" {
    360                     set top [_top image]
    361                     set top [_top image]
    362                     if {$top == ""} {
    363                         return ""
    364                     }
     360                    set top [_top image]
     361                    set top [_top image]
     362                    if {$top == ""} {
     363                        return ""
     364                    }
    365365                    set popup .imageresultimage
    366366                    if { ![winfo exists $popup] } {
     
    368368                        # dialog widget to it.
    369369                        Rappture::Balloon $popup -title "Save as image..." \
    370                             -deactivatecommand \
    371                             [itcl::code $this SetWaitVariable 0]
     370                            -deactivatecommand \
     371                            [itcl::code $this SetWaitVariable 0]
    372372                        set inner [$popup component inner]
    373373                        AddImageControls $inner [lindex $args 0]
    374374                    } else {
    375375                        set inner [$popup component inner]
    376                     }                   
    377                     set _downloadPopup(image_controls) $inner
     376                    }                   
     377                    set _downloadPopup(image_controls) $inner
    378378                    update
    379379                    # Activate the popup and call for the output.
    380380                    foreach { widget toolName plotName } $args break
    381                     SetWaitVariable 0
     381                    SetWaitVariable 0
    382382                    $popup activate $widget left
    383                     set bool [WaitForImage]
     383                    set bool [WaitForImage]
    384384                    $popup deactivate
    385                     if { $bool } {
    386                         set inner $_downloadPopup(image_controls)
    387                         set fmt [$inner.format translate [$inner.format value]]
    388                         switch $fmt {
    389                             "jpg" {
    390                                 $top export jpg -quality 100 -data bytes
    391                             }
    392                             "png" {
    393                                 $top export png -data bytes
    394                             }
    395                             "gif" {
    396                                 $top export gif -data bytes
    397                             }
    398                             default {
    399                                 return ""
    400                             }
    401                         }
    402                         return [list .$fmt $bytes]
    403                     }
    404                 }
    405             }
    406             return ""
     385                    if { $bool } {
     386                        set inner $_downloadPopup(image_controls)
     387                        set fmt [$inner.format translate [$inner.format value]]
     388                        switch $fmt {
     389                            "jpg" {
     390                                $top export jpg -quality 100 -data bytes
     391                            }
     392                            "png" {
     393                                $top export png -data bytes
     394                            }
     395                            "gif" {
     396                                $top export gif -data bytes
     397                            }
     398                            default {
     399                                return ""
     400                            }
     401                        }
     402                        return [list .$fmt $bytes]
     403                    }
     404                }
     405            }
     406            return ""
    407407        }
    408408        default {
  • branches/blt4/gui/scripts/isomarker.tcl

    r2173 r2745  
    1818
    1919itcl::class Rappture::IsoMarker {
    20     private variable _value     0.0;    # Absolute value of marker.
    21     private variable _label     ""
    22     private variable _tick      ""
    23     private variable _canvas    ""
    24     private variable _nvobj     "";     # Parent nanovis object.
    25     private variable _tf        "";     # Transfer function that this marker is
     20    private variable _value     0.0;    # Absolute value of marker.
     21    private variable _label     ""
     22    private variable _tick      ""
     23    private variable _canvas    ""
     24    private variable _nvobj     "";     # Parent nanovis object.
     25    private variable _tf        "";     # Transfer function that this marker is
    2626                                        # associated with.
    2727    private variable _activeMotion   0
     
    118118            set limits(max) 1.0
    119119        }
    120         if { [catch {expr $limits(vmax) - $limits(vmin)} r] != 0 } {
    121             return 0.0
    122         }          
     120        if { [catch {expr $limits(vmax) - $limits(vmin)} r] != 0 } {
     121            return 0.0
     122        }          
    123123        absval [expr {($x * $r) + $limits(vmin)}]
    124124    }
  • branches/blt4/gui/scripts/loader.tcl

    r2242 r2745  
    243243    set str [$_owner xml get $path.default]
    244244    if { $str != "" } {
    245         bind $itk_component(hull) <Map> [itcl::code $this SetDefaultValue $str]
     245        bind $itk_component(hull) <Map> [itcl::code $this SetDefaultValue $str]
    246246    }
    247247}
     
    323323# SetDefaultValue --
    324324#
    325 #       Sets the designated default value for the loader.  This must be done
    326 #       after the entire application is assembled, otherwise the default
    327 #       values set up by the loader will be overwritten by the various widgets
    328 #       themselves when they try to set their default values. 
    329 #
    330 #       This is called from a  <Map> event to the loader (combobox).  This
    331 #       will get trigger the first time the loader is displayed.  The binding
    332 #       is then removed.
     325#       Sets the designated default value for the loader.  This must be done
     326#       after the entire application is assembled, otherwise the default
     327#       values set up by the loader will be overwritten by the various widgets
     328#       themselves when they try to set their default values. 
     329#
     330#       This is called from a  <Map> event to the loader (combobox).  This
     331#       will get trigger the first time the loader is displayed.  The binding
     332#       is then removed.
    333333#
    334334itcl::body Rappture::Loader::SetDefaultValue { value } {
  • branches/blt4/gui/scripts/main.tcl

    r2535 r2745  
    299299
    300300    if { $style != "wizard" } {
    301         # If only two windows and they're small enough, put them up
    302         # side-by-side
    303         if {$w0+$w1 < $screenw } {
    304             $win.pager configure -arrangement side-by-side
    305             $f.analyze configure -holdwindow [$win.pager page @0]
    306         }
     301        # If only two windows and they're small enough, put them up
     302        # side-by-side
     303        if {$w0+$w1 < $screenw } {
     304            $win.pager configure -arrangement side-by-side
     305            $f.analyze configure -holdwindow [$win.pager page @0]
     306        }
    307307    }
    308308    set type [$tool xml get tool.control]
    309309    if {$type == ""} {
    310         set type [$tool xml get tool.control.type]
     310        set type [$tool xml get tool.control.type]
    311311    }
    312312    set arrangement [$win.pager cget -arrangement]
     
    317317    }
    318318    if { $arrangement != "side-by-side" &&
    319             ($type == "manual" || $type == "auto" || $style == "wizard") } {
    320         # in "auto" mode, we don't need a simulate button
    321         $f.analyze configure -simcontrol off
     319            ($type == "manual" || $type == "auto" || $style == "wizard") } {
     320        # in "auto" mode, we don't need a simulate button
     321        $f.analyze configure -simcontrol off
    322322    } else {
    323         # not in "auto" mode but side-by-side, we always need the button
    324         $f.analyze configure -simcontrol on
     323        # not in "auto" mode but side-by-side, we always need the button
     324        $f.analyze configure -simcontrol on
    325325    }
    326326} elseif {[llength [$win.pager page]] > 2} {
  • branches/blt4/gui/scripts/molvisviewer.tcl

    r2742 r2745  
    4343    private variable _icon 0
    4444    private variable _getimage 0
    45     private variable _mevent;           # info used for mouse event operations
    46     private variable _rocker;           # info used for rock operations
    47     private variable _dlist "";         # list of dataobj objects
    48     private variable _dataobjs;         # data objects on server
     45    private variable _mevent;           # info used for mouse event operations
     46    private variable _rocker;           # info used for rock operations
     47    private variable _dlist "";         # list of dataobj objects
     48    private variable _dataobjs;         # data objects on server
    4949    private variable _dobj2transparency;# maps dataobj => transparency
    50     private variable _dobj2raise;       # maps dataobj => raise flag 0/1
    51 
    52     private variable _active;           # array of active models.
    53     private variable _obj2models;       # array containing list of models
     50    private variable _dobj2raise;       # maps dataobj => raise flag 0/1
     51
     52    private variable _active;           # array of active models.
     53    private variable _obj2models;       # array containing list of models
    5454                                        # for each data object.
    5555    private variable _view
     
    6666    private variable _cacheimage ""
    6767
    68     private common _settings  ;         # Array of settings for all known
     68    private common _settings  ;         # Array of settings for all known
    6969                                        # widgets
    7070    private variable _initialized
    7171
    72     private common _downloadPopup;      # Download options from popup
    73     private variable _pdbdata;          # PDB data from run file sent to pymol
     72    private common _downloadPopup;      # Download options from popup
     73    private variable _pdbdata;          # PDB data from run file sent to pymol
    7474    private common _hardcopy
    7575    private variable _nextToken 0
     
    8181    private variable _width
    8282    private variable _height
    83     private variable _reset 1;  # Restore camera settings
    84     private variable _cell 0;           # Restore camera settings
     83    private variable _reset 1;  # Restore camera settings
     84    private variable _cell 0;           # Restore camera settings
    8585    private variable _flush 1
    8686
     
    108108    private method AddImageControls { frame widget }
    109109    private method SetWaitVariable { value } {
    110         set _getimage $value
     110        set _getimage $value
    111111    }
    112112    private method WaitForResponse {} {
    113         tkwait variable [itcl::scope _getimage]
    114         return $_getimage
     113        tkwait variable [itcl::scope _getimage]
     114        return $_getimage
    115115    }
    116116    protected method Map {}
     
    212212        phi     45
    213213        psi     0
    214         vx      0
    215         vy      0
    216         vz      0
    217         zoom    0
    218         mx      0
    219         my      0
    220         mz      0
    221         x       0
    222         y       0
    223         z       0
    224         width   0
     214        vx      0
     215        vy      0
     216        vz      0
     217        zoom    0
     218        mx      0
     219        my      0
     220        mz      0
     221        x       0
     222        y       0
     223        z       0
     224        width   0
    225225        height  0
    226226    }
     
    237237        $this-rock      no
    238238        $this-showlabels no
    239         $this-showcell  yes
     239        $this-showcell  yes
    240240        $this-showlabels-initialized no
    241241    }]
     
    573573                set inner [$popup component inner]
    574574                label $inner.summary -text "" -anchor w
    575                 radiobutton $inner.pdb \
    576                     -text "PDB Protein Data Bank Format File" \
    577                     -variable [itcl::scope _downloadPopup(format)] \
    578                     -font "Arial 10 " \
    579                     -value pdb 
    580                 Rappture::Tooltip::for $inner.pdb \
    581                     "Save as PDB Protein Data Bank format file."
    582                 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
    583                     -variable [itcl::scope _downloadPopup(format)] \
    584                     -font "Arial 10 " \
    585                     -value image
    586                 Rappture::Tooltip::for $inner.image \
    587                     "Save as image."
    588                 set f [frame $inner.frame]
    589                 button $f.ok -text "Save" \
    590                     -highlightthickness 0 -pady 3 -padx 3 \
     575                radiobutton $inner.pdb \
     576                    -text "PDB Protein Data Bank Format File" \
     577                    -variable [itcl::scope _downloadPopup(format)] \
     578                    -font "Arial 10 " \
     579                    -value pdb 
     580                Rappture::Tooltip::for $inner.pdb \
     581                    "Save as PDB Protein Data Bank format file."
     582                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     583                    -variable [itcl::scope _downloadPopup(format)] \
     584                    -font "Arial 10 " \
     585                    -value image
     586                Rappture::Tooltip::for $inner.image \
     587                    "Save as image."
     588                set f [frame $inner.frame]
     589                button $f.ok -text "Save" \
     590                    -highlightthickness 0 -pady 3 -padx 3 \
    591591                    -command [lindex $args 0] \
    592                     -compound left \
    593                     -image [Rappture::icon download]
    594                 button $f.cancel -text "Cancel" \
    595                     -highlightthickness 0 -pady 3 -padx 3 \
    596                     -command [list $popup deactivate] \
    597                     -compound left \
    598                     -image [Rappture::icon cancel]
    599                 blt::table $f \
    600                     0,0 $f.ok \
    601                     0,1 $f.cancel
    602                 blt::table $inner \
    603                     0,0 $inner.summary -anchor w \
    604                     1,0 $inner.pdb -anchor w \
    605                     2,0 $inner.image -anchor w \
    606                     3,0 $f -fill x -pady 4
    607                 $inner.pdb select
     592                    -compound left \
     593                    -image [Rappture::icon download]
     594                button $f.cancel -text "Cancel" \
     595                    -highlightthickness 0 -pady 3 -padx 3 \
     596                    -command [list $popup deactivate] \
     597                    -compound left \
     598                    -image [Rappture::icon cancel]
     599                blt::table $f \
     600                    0,0 $f.ok \
     601                    0,1 $f.cancel
     602                blt::table $inner \
     603                    0,0 $inner.summary -anchor w \
     604                    1,0 $inner.pdb -anchor w \
     605                    2,0 $inner.image -anchor w \
     606                    3,0 $f -fill x -pady 4
     607                $inner.pdb select
    608608            } else {
    609609                set inner [$popup component inner]
     
    613613            set word [Rappture::filexfer::label downloadWord]
    614614            $inner.summary configure -text "$word $num in the following format:"
    615             update idletasks ;          # Fix initial sizes
     615            update idletasks ;          # Fix initial sizes
    616616            return $popup
    617617        }
     
    624624                "pdb" {
    625625                    return [list .pdb $_pdbdata]
    626                 }
     626                }
    627627                "image" {
    628628                    set popup .molvisviewerimage
     
    631631                        # dialog widget to it.
    632632                        Rappture::Balloon $popup -title "Save as image..." \
    633                             -deactivatecommand \
    634                             [itcl::code $this SetWaitVariable 0]
     633                            -deactivatecommand \
     634                            [itcl::code $this SetWaitVariable 0]
    635635                        set inner [$popup component inner]
    636                         # Add image controls to the ballon popup
     636                        # Add image controls to the ballon popup
    637637                        AddImageControls $inner [lindex $args 0]
    638638                    } else {
    639639                        set inner [$popup component inner]
    640                     }                   
     640                    }                   
    641641                    update
    642642                    # Activate the popup and call for the output.
    643643                    foreach { widget toolName plotName } $args break
    644                     SetWaitVariable 0
     644                    SetWaitVariable 0
    645645                    $popup activate $widget left
    646                     set bool [WaitForResponse]
     646                    set bool [WaitForResponse]
    647647                    $popup deactivate
    648                     if { $bool } {
    649                         return [GetImage $widget]
    650                     }
    651                     return ""
    652                 }
     648                    if { $bool } {
     649                        return [GetImage $widget]
     650                    }
     651                    return ""
     652                }
    653653            }
    654654        }
     
    789789        -window $tab.ss.frame
    790790    pack $tab.ss -fill both -expand yes
    791     blt::tk::scrollbar $tab.ss.xs               
    792     blt::tk::scrollbar $tab.ss.ys               
     791    blt::tk::scrollbar $tab.ss.xs               
     792    blt::tk::scrollbar $tab.ss.ys               
    793793    set inner [blt::tk::frame $tab.ss.frame]
    794794
     
    799799
    800800    itk_component add representation {
    801         Rappture::Combobox $inner.rep -width 20 -editable no
     801        Rappture::Combobox $inner.rep -width 20 -editable no
    802802    }
    803803    $inner.rep choices insert end \
    804804        "ballnstick"  "ball and stick" \
    805805        "spheres"     "spheres"         \
    806         "sticks"      "sticks"          \
    807         "lines"       "lines"           \
    808         "cartoon"     "cartoon"         
     806        "sticks"      "sticks"          \
     807        "lines"       "lines"           \
     808        "cartoon"     "cartoon"         
    809809
    810810    bind $inner.rep <<Value>> [itcl::code $this Representation]
     
    858858
    859859    checkbutton $inner.cell -text "Parallelepiped" \
    860         -command [itcl::code $this Cell toggle] \
     860        -command [itcl::code $this Cell toggle] \
    861861        -font "Arial 9"
    862862    $inner.cell select
     
    868868        2,0 $inner.ortho -anchor w -pady {1 0} \
    869869        3,0 $inner.cartoontrace -anchor w -pady {1 0} \
    870         4,0 $inner.cell -anchor w  -pady {1 0} \
     870        4,0 $inner.cell -anchor w  -pady {1 0} \
    871871        5,0 $inner.rep_l -anchor w -pady { 2 0 } \
    872872        6,0 $inner.rep -anchor w  \
     
    917917        if { ![info exists _mlist($model)] } {  # new, turn on
    918918            set _mlist($model) 2
    919         } elseif { $_mlist($model) == 1 } {     # on, leave on
     919        } elseif { $_mlist($model) == 1 } {     # on, leave on
    920920            set _mlist($model) 3
    921         } elseif { $_mlist($model) == 0 } {     # off, turn on
     921        } elseif { $_mlist($model) == 0 } {     # off, turn on
    922922            set _mlist($model) 2
    923923        }
     
    10201020                }
    10211021                set _dataobjs($model-$state) 1
    1022             }
     1022            }
    10231023        }
    10241024        if { ![info exists _model($model-transparency)] } {
     
    10381038        }
    10391039        set vector [$dataobj get components.parallelepiped.vector]
    1040         if { $vector != "" } {
    1041             set vertices [ComputeParallelepipedVertices $dataobj]
    1042             SendCmd "raw -defer {verts = \[$vertices\]\n}"
    1043             SendCmd "raw -defer {run \$PYMOL_SITE_PATH/rappture/box.py\n}"
    1044             SendCmd "raw -defer {draw_box(verts)\n}"
    1045             set _cell 1
    1046         }
    1047     }
    1048        
     1040        if { $vector != "" } {
     1041            set vertices [ComputeParallelepipedVertices $dataobj]
     1042            SendCmd "raw -defer {verts = \[$vertices\]\n}"
     1043            SendCmd "raw -defer {run \$PYMOL_SITE_PATH/rappture/box.py\n}"
     1044            SendCmd "raw -defer {draw_box(verts)\n}"
     1045            set _cell 1
     1046        }
     1047    }
     1048       
    10491049    # enable/disable models as required (0=off->off, 1=on->off, 2=off->on,
    10501050    # 3=on->on)
     
    11351135    set inner $tab.ss.frame
    11361136    if { $_cell } {
    1137         $inner.cell configure -state normal
     1137        $inner.cell configure -state normal
    11381138    } else {
    1139         $inner.cell configure -state disabled
     1139        $inner.cell configure -state disabled
    11401140    }
    11411141    if { $flush } {
    11421142        global readyForNextFrame
    1143         set readyForNextFrame 0;        # Don't advance to the next frame
     1143        set readyForNextFrame 0;        # Don't advance to the next frame
    11441144                                        # until we get an image.
    1145         #SendCmd "ppm";                 # Flush the results.
    1146         set _flush 0
    1147     }
    1148     set _buffering 0;                   # Turn off buffering.
     1145        #SendCmd "ppm";                 # Flush the results.
     1146        set _flush 0
     1147    }
     1148    set _buffering 0;                   # Turn off buffering.
    11491149
    11501150    blt::busy hold $itk_component(hull)
     
    11521152    # Actually write the commands to the server socket. 
    11531153    # If it fails, we don't care.  We're finished here.
    1154     SendBytes $_outbuf;                 
    1155     set _outbuf "";                     # Clear the buffer.             
     1154    SendBytes $_outbuf;                 
     1155    set _outbuf "";                     # Clear the buffer.             
    11561156    blt::busy release $itk_component(hull)
    11571157
     
    12441244        set _view(x) [expr $_view(x) + $dx]
    12451245        set _view(y) [expr $_view(y) + $dy]
    1246         array unset _imagecache
     1246        array unset _imagecache
    12471247        SendCmd "pan $dx $dy"
    12481248        return
     
    12591259        set _view(x) [expr $_view(x) + $dx]
    12601260        set _view(y) [expr $_view(y) + $dy]
    1261         array unset _imagecache
     1261        array unset _imagecache
    12621262        SendCmd "pan $dx $dy"
    12631263    }
     
    14251425        set _view(mz) [expr {$_view(mz) + $mz}]
    14261426        #SendCmd "rotate $mx $my $mz"
    1427         EventuallyRotate $mx $my $mz
     1427        EventuallyRotate $mx $my $mz
    14281428        debug "_vmmouse: rotate $_view(mx) $_view(my) $_view(mz)"
    14291429    }
     
    15211521                    vz $vz
    15221522                }]
    1523                 EventuallyRotate $a $b $c
     1523                EventuallyRotate $a $b $c
    15241524                #SendCmd "rotate $a $b $c"
    15251525                debug "Rotate $x $y: rotate $_view(vx) $_view(vy) $_view(vz)"
     
    15481548itcl::body Rappture::MolvisViewer::Representation { { option "" } } {
    15491549    if { $option == "" } {
    1550         set value [$itk_component(representation) value]
    1551         set option [$itk_component(representation) translate $value]
     1550        set value [$itk_component(representation) value]
     1551        set option [$itk_component(representation) translate $value]
    15521552    }
    15531553    if { $option == $_mrep } {
     
    16431643        "on" - "off" {
    16441644            set cell $option
    1645         }
     1645        }
    16461646        "toggle" {
    16471647            set cell [expr {$_settings($this-showcell) == 0}]
     
    18551855# ----------------------------------------------------------------------
    18561856# USAGE: StickRadius radius ?models?
    1857 #        StickRadius update ?models?
     1857#        StickRadius update ?models?
    18581858#
    18591859# Used internally to change the stick radius used to render
     
    18911891# ----------------------------------------------------------------------
    18921892# USAGE: Opacity value ?models?
    1893 #        Opacity update ?models?
     1893#        Opacity update ?models?
    18941894#
    18951895# Used internally to change the opacity (transparency) used to render
     
    19221922    SendCmd "transparency -model all $overridetransparency"
    19231923    foreach model $models {
    1924         SendCmd "transparency -model $model $transparency"
     1924        SendCmd "transparency -model $model $transparency"
    19251925    }
    19261926}
     
    20182018    set f [frame $inner.frame]
    20192019    button $f.ok -text "Save" \
    2020         -highlightthickness 0 -pady 3 -padx 3 \
    2021         -command [itcl::code $this SetWaitVariable 1] \
    2022         -compound left \
    2023         -image [Rappture::icon download
     2020        -highlightthickness 0 -pady 3 -padx 3 \
     2021        -command [itcl::code $this SetWaitVariable 1] \
     2022        -compound left \
     2023        -image [Rappture::icon download
    20242024]
    20252025    button $f.cancel -text "Cancel" \
    2026         -highlightthickness 0 -pady 3 -padx 3 \
    2027         -command [itcl::code $this SetWaitVariable 0] \
    2028         -compound left \
    2029         -image [Rappture::icon cancel]
     2026        -highlightthickness 0 -pady 3 -padx 3 \
     2027        -command [itcl::code $this SetWaitVariable 0] \
     2028        -compound left \
     2029        -image [Rappture::icon cancel]
    20302030    blt::table $f \
    2031         0,0 $f.ok  \
    2032         0,1 $f.cancel
     2031        0,0 $f.ok  \
     2032        0,1 $f.cancel
    20332033
    20342034    blt::table $inner \
     
    20732073    # Create a vector for every 3D point
    20742074    blt::vector point0(3) point1(3) point2(3) point3(3) point4(3) point5(3) \
    2075         point6(3) point7(3) origin(3) scale(3)
     2075        point6(3) point7(3) origin(3) scale(3)
    20762076
    20772077    set count 0
    20782078    set parent [$dataobj element -as object "components.parallelepiped"]
    20792079    foreach child [$parent children] {
    2080         if { ![string match "vector*" $child] } {
    2081             continue
    2082         }
    2083         incr count
    2084         set values [$parent get $child]
    2085         regexp -all {,} $values { } values
    2086         point$count set $values
     2080        if { ![string match "vector*" $child] } {
     2081            continue
     2082        }
     2083        incr count
     2084        set values [$parent get $child]
     2085        regexp -all {,} $values { } values
     2086        point$count set $values
    20872087    }
    20882088    itcl::delete object $parent
    20892089    if { $count < 1 || $count > 3 } {
    2090         error "bad number of vectors supplied to parallelepiped"
     2090        error "bad number of vectors supplied to parallelepiped"
    20912091    }
    20922092    point0 set { 0.0 0.0 0.0 }
     
    21002100    scale set { 1.0 1.0 1.0 }
    21012101    if { $n == 1 } {
    2102         set scale(0:2) [lindex $values 0]
     2102        set scale(0:2) [lindex $values 0]
    21032103    } elseif { $n == 2 } {
    2104         set scale(0:1) [lindex $values 0]
     2104        set scale(0:1) [lindex $values 0]
    21052105    } elseif { $n == 3 } {
    2106         scale set $values
     2106        scale set $values
    21072107    }
    21082108    set values [$dataobj get components.parallelepiped.origin]
     
    21102110    origin set { 0.0 0.0 0.0 }
    21112111    if { $n == 1 } {
    2112         set origin(0) [lindex $values 0]
     2112        set origin(0) [lindex $values 0]
    21132113    } elseif { $n == 2 } {
    2114         set origin(0) [lindex $values 0]
    2115         set origin(1) [lindex $values 1]
     2114        set origin(0) [lindex $values 0]
     2115        set origin(1) [lindex $values 1]
    21162116    } elseif { $n == 3 } {
    2117         origin set $values
     2117        origin set $values
    21182118    }
    21192119
    21202120    # Scale and translate points
    21212121    for { set i 0 } { $i < 8 } { incr i } {
    2122         point${i} expr "(point${i} * scale) + origin"
     2122        point${i} expr "(point${i} * scale) + origin"
    21232123    }
    21242124
     
    21262126    set vertices ""
    21272127    foreach n { 0 1 0 2 0 3 1 4 2 4 2 6 1 7 3 7 5 7 4 5 3 6 5 } {
    2128         set values [point${n} values]
    2129         append vertices "\[ [join $values {, }] \], \\\n"
     2128        set values [point${n} values]
     2129        append vertices "\[ [join $values {, }] \], \\\n"
    21302130    }
    21312131    set values [point6 values]
    21322132    append vertices "\[ [join $values {, }] \]  \\\n"
    21332133    blt::vector destroy point0 point1 point2 point3 point4 point5 point6 \
    2134         point7 origin scale
     2134        point7 origin scale
    21352135    return $vertices
    21362136}
  • branches/blt4/gui/scripts/nanovisviewer.tcl

    r2742 r2745  
    1919#
    2020# FIXME:
    21 #       Need to Add DX readers this client to examine the data before
    22 #       it's sent to the server.  This will eliminate 90% of the insanity in
    23 #       computing the limits of all the volumes.  I can rip out all the
    24 #       "receive data" "send transfer function" event crap.
     21#       Need to Add DX readers this client to examine the data before
     22#       it's sent to the server.  This will eliminate 90% of the insanity in
     23#       computing the limits of all the volumes.  I can rip out all the
     24#       "receive data" "send transfer function" event crap.
    2525#
    2626#       This means we can compute the transfer function (relative values) and
    27 #       draw the legend min/max values without waiting for the information to
    28 #       come from the server.  This will also prevent the flashing that occurs
    29 #       when a new volume is drawn (using the default transfer function) and
    30 #       then when the correct transfer function has been sent and linked to
    31 #       the volume. 
     27#       draw the legend min/max values without waiting for the information to
     28#       come from the server.  This will also prevent the flashing that occurs
     29#       when a new volume is drawn (using the default transfer function) and
     30#       then when the correct transfer function has been sent and linked to
     31#       the volume. 
    3232#
    3333option add *NanovisViewer.width 4i widgetDefault
     
    121121    private method AddImageControls { frame widget }
    122122    private method SetWaitVariable { value } {
    123         set _getimage $value
     123        set _getimage $value
    124124    }
    125125    private method GetWaitVariable {} {
    126         return $_getimage
     126        return $_getimage
    127127    }
    128128    private method WaitForImage {} {
    129         tkwait variable [itcl::scope _getimage]
    130         return $_getimage
     129        tkwait variable [itcl::scope _getimage]
     130        return $_getimage
    131131    }
    132132
     
    215215        psi     0
    216216        zoom    1.0
    217         pan-x   0
    218         pan-y   0
     217        pan-x   0
     218        pan-y   0
    219219    }
    220220    set _limits(vmin) 0.0
     
    222222
    223223    array set _settings [subst {
    224         $this-pan-x             $_view(pan-x)
    225         $this-pan-y             $_view(pan-y)
    226         $this-phi               $_view(phi)
    227         $this-psi               $_view(psi)
    228         $this-theta             $_view(theta)
    229         $this-volume            1
    230         $this-xcutplane         0
    231         $this-xcutposition      0
    232         $this-ycutplane         0
    233         $this-ycutposition      0
    234         $this-zcutplane         0
    235         $this-zcutposition      0
    236         $this-zoom              $_view(zoom)
     224        $this-pan-x             $_view(pan-x)
     225        $this-pan-y             $_view(pan-y)
     226        $this-phi               $_view(phi)
     227        $this-psi               $_view(psi)
     228        $this-theta             $_view(theta)
     229        $this-volume            1
     230        $this-xcutplane         0
     231        $this-xcutposition      0
     232        $this-ycutplane         0
     233        $this-ycutposition      0
     234        $this-zcutplane         0
     235        $this-zcutposition      0
     236        $this-zoom              $_view(zoom)
    237237    }]
    238238
     
    572572                label $inner.summary -text "" -anchor w
    573573                pack $inner.summary -side top
    574                 radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
    575                     -variable \
    576                     ::Rappture::NanovisViewer::_downloadPopup(format) \
    577                     -font "Arial 10 " \
    578                     -value image
    579                 Rappture::Tooltip::for $inner.image "Save as image."
     574                radiobutton $inner.image -text "Image (PNG/JPEG/GIF)" \
     575                    -variable \
     576                    ::Rappture::NanovisViewer::_downloadPopup(format) \
     577                    -font "Arial 10 " \
     578                    -value image
     579                Rappture::Tooltip::for $inner.image "Save as image."
    580580                pack $inner.image -anchor w
    581581                button $inner.go -text [Rappture::filexfer::label download] \
    582582                    -command [lindex $args 0]
    583583                pack $inner.go -side bottom -pady 4
    584                 $inner.image select
     584                $inner.image select
    585585            } else {
    586586                set inner [$popup component inner]
     
    590590            set word [Rappture::filexfer::label downloadWord]
    591591            $inner.summary configure -text "$word $num in the following format:"
    592             update idletasks ;          # Fix initial sizes
     592            update idletasks ;          # Fix initial sizes
    593593            return $popup
    594594        }
     
    605605                        # dialog widget to it.
    606606                        Rappture::Balloon $popup -title "Save as image..." \
    607                             -deactivatecommand \
    608                             [itcl::code $this SetWaitVariable 0]
     607                            -deactivatecommand \
     608                            [itcl::code $this SetWaitVariable 0]
    609609                        set inner [$popup component inner]
    610610                        AddImageControls $inner [lindex $args 0]
    611611                    } else {
    612612                        set inner [$popup component inner]
    613                     }                   
    614                     set _downloadPopup(image_controls) $inner
     613                    }                   
     614                    set _downloadPopup(image_controls) $inner
    615615                    update
    616616                    # Activate the popup and call for the output.
    617617                    foreach { widget toolName plotName } $args break
    618                     SetWaitVariable 0
     618                    SetWaitVariable 0
    619619                    $popup activate $widget left
    620                     set bool [WaitForImage]
     620                    set bool [WaitForImage]
    621621                    $popup deactivate
    622                     if { $bool } {
    623                         set inner $_downloadPopup(image_controls)
    624                         set fmt [$inner.format translate [$inner.format value]]
    625                         switch $fmt {
    626                             "jpg" {
    627                                 $_image(download) export jpg -quality 100 \
    628                                     -data bytes
    629                             }
    630                             "png" {
    631                                 $_image(download) export png -data bytes
    632                             }
    633                             "gif" {
    634                                 $_image(download) export gif -data bytes
    635                             }
    636                             default {
    637                                 return ""
    638                             }
    639                         }
    640                         return [list .$fmt $bytes]
    641                     }
    642                 }
    643             }
    644             return ""
     622                    if { $bool } {
     623                        set inner $_downloadPopup(image_controls)
     624                        set fmt [$inner.format translate [$inner.format value]]
     625                        switch $fmt {
     626                            "jpg" {
     627                                $_image(download) export jpg -quality 100 \
     628                                    -data bytes
     629                            }
     630                            "png" {
     631                                $_image(download) export png -data bytes
     632                            }
     633                            "gif" {
     634                                $_image(download) export gif -data bytes
     635                            }
     636                            default {
     637                                return ""
     638                            }
     639                        }
     640                        return [list .$fmt $bytes]
     641                    }
     642                }
     643            }
     644            return ""
    645645        }
    646646        default {
     
    757757        ComputeTransferFunc $tf
    758758        # FIXME: Need to the send information as to what transfer functions
    759         #        to update so that we only update the transfer function
    760         #        as necessary.  Right now, all transfer functions are
    761         #        updated. This makes moving the isomarker slider chunky.
     759        #        to update so that we only update the transfer function
     760        #        as necessary.  Right now, all transfer functions are
     761        #        updated. This makes moving the isomarker slider chunky.
    762762        if { ![info exists _activeTfs($tf)] || !$_activeTfs($tf) } {
    763763            set _activeTfs($tf) 1
     
    785785    ReceiveEcho <<line "<read $info(-bytes) bytes"
    786786    if { $info(-type) == "image" } {
    787         ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"       
     787        ReceiveEcho "for [image width $_image(plot)]x[image height $_image(plot)] image>"       
    788788        $_image(plot) configure -data $bytes
    789789    } elseif { $info(type) == "print" } {
     
    853853    set vol [lindex $vols 0]
    854854    foreach axis {x y z} {
    855         # Turn off cutplanes for all volumes
    856         SendCmd "cutplane state 0 $axis"
    857         if { $_settings($this-${axis}cutplane) } {
    858             # Turn on cutplane for this particular volume and set the position
    859             SendCmd "cutplane state 1 $axis $vol"
    860             set pos [expr {0.01*$_settings($this-${axis}cutposition)}]
    861             SendCmd "cutplane position $pos $axis $vol"
    862         }
     855        # Turn off cutplanes for all volumes
     856        SendCmd "cutplane state 0 $axis"
     857        if { $_settings($this-${axis}cutplane) } {
     858            # Turn on cutplane for this particular volume and set the position
     859            SendCmd "cutplane state 1 $axis $vol"
     860            set pos [expr {0.01*$_settings($this-${axis}cutposition)}]
     861            SendCmd "cutplane position $pos $axis $vol"
     862        }
    863863    }
    864864}
     
    10051005    }
    10061006    foreach axis {x y z} {
    1007         # Turn off cutplanes for all volumes
    1008         SendCmd "cutplane state 0 $axis"
     1007        # Turn off cutplanes for all volumes
     1008        SendCmd "cutplane state 0 $axis"
    10091009    }
    10101010    set _buffering 0;                        # Turn off buffering.
     
    10671067                phi     45
    10681068                psi     0
    1069                 zoom    1.0
    1070                 pan-x   0
    1071                 pan-y   0
     1069                zoom    1.0
     1070                pan-x   0
     1071                pan-y   0
    10721072            }
    10731073            if { $_first != "" } {
     
    13141314            if { [isconnected] } {
    13151315                set vols [CurrentVolumes -cutplanes]
    1316                 set vol [lindex $vols 0]
     1316                set vol [lindex $vols 0]
    13171317                SendCmd "cutplane state $bool $axis $vol"
    13181318            }
     
    16881688itcl::body Rappture::NanovisViewer::BuildViewTab {} {
    16891689    foreach { key value } {
    1690         grid            0
    1691         axes            1
    1692         outline         1
    1693         volume          1
    1694         legend          1
    1695         particles       1
    1696         lic             1
     1690        grid            0
     1691        axes            1
     1692        outline         1
     1693        volume          1
     1694        legend          1
     1695        particles       1
     1696        lic             1
    16971697    } {
    16981698        set _settings($this-$key) $value
     
    17101710        -window $tab.ss.frame
    17111711    pack $tab.ss -fill both -expand yes
    1712     blt::tk::scrollbar $tab.ss.xs               
    1713     blt::tk::scrollbar $tab.ss.ys               
     1712    blt::tk::scrollbar $tab.ss.xs               
     1713    blt::tk::scrollbar $tab.ss.ys               
    17141714    set inner [blt::tk::frame $tab.ss.frame]
    17151715    $inner configure -borderwidth 4
     
    17681768itcl::body Rappture::NanovisViewer::BuildVolumeTab {} {
    17691769    foreach { key value } {
    1770         light           40
    1771         transp          50
    1772         opacity         100
    1773         thickness       350
     1770        light           40
     1771        transp          50
     1772        opacity         100
     1773        thickness       350
    17741774    } {
    17751775        set _settings($this-$key) $value
     
    17841784        -window $tab.ss.frame
    17851785    pack $tab.ss -fill both -expand yes
    1786     blt::tk::scrollbar $tab.ss.xs               
    1787     blt::tk::scrollbar $tab.ss.ys               
     1786    blt::tk::scrollbar $tab.ss.xs               
     1787    blt::tk::scrollbar $tab.ss.ys               
    17881788    set inner [blt::tk::frame $tab.ss.frame]
    17891789    $inner configure -borderwidth 4
     
    18541854        -window $tab.ss.frame
    18551855    pack $tab.ss -fill both -expand yes
    1856     blt::tk::scrollbar $tab.ss.xs               
    1857     blt::tk::scrollbar $tab.ss.ys               
     1856    blt::tk::scrollbar $tab.ss.xs               
     1857    blt::tk::scrollbar $tab.ss.ys               
    18581858    set inner [blt::tk::frame $tab.ss.frame]
    18591859    $inner configure -borderwidth 4
     
    19621962        -yscrollbar $tab.ss.ys \
    19631963        -window $tab.ss.frame
    1964     blt::tk::scrollbar $tab.ss.xs               
    1965     blt::tk::scrollbar $tab.ss.ys               
     1964    blt::tk::scrollbar $tab.ss.xs               
     1965    blt::tk::scrollbar $tab.ss.ys               
    19661966    pack $tab.ss -fill both -expand yes
    19671967    set inner [blt::tk::frame $tab.ss.frame]
     
    20072007            set newpos [expr {0.01*$newval}]
    20082008            set vols [CurrentVolumes -cutplanes]
    2009             set vol [lindex $vols 0]
     2009            set vol [lindex $vols 0]
    20102010            SendCmd "cutplane position $newpos $axis $vol"
    20112011        }
  • branches/blt4/gui/scripts/note.tcl

    r2098 r2745  
    182182        ^xhtml:// {
    183183            set html [string range $info 7 end]
    184             puts stderr "html html=$html"
     184            puts stderr "html html=$html"
    185185            $itk_component(html) load $html
    186186        }
    187187        default {
    188             puts stderr "info=$info"
     188            puts stderr "info=$info"
    189189            set html "<html><body><p>[_revEscapeChars $info]</p></body></html>"
    190             puts stderr "default html=$html"
     190            puts stderr "default html=$html"
    191191            $itk_component(html) load $html
    192192        }
  • branches/blt4/gui/scripts/numberresult.tcl

    r2742 r2745  
    7474
    7575    constructor {args} {
    76         # defined below
     76        # defined below
    7777    }
    7878    destructor {
    79         # defined below
     79        # defined below
    8080    }
    8181    public method add {dataobj {settings ""}}
     
    547547                # if we haven't created the popup yet, do it now
    548548                Rappture::Balloon $popup \
    549                     -title "[Rappture::filexfer::label downloadWord] as..."
     549                    -title "[Rappture::filexfer::label downloadWord] as..."
    550550                set inner [$popup component inner]
    551551                label $inner.summary -text "" -anchor w
     
    577577            }
    578578            switch -- $_downloadPopup(format) {
    579                 csv {
    580                     # March through the values in order and report
    581                     # all data points
    582                     set csvdata ""
    583                     set xtitle [$itk_component(plot) xaxis cget -title]
    584                     set ytitle [$itk_component(plot) yaxis cget -title]
    585                    
    586                     set desc ""
    587                     set dataobj [lindex [get] end]
    588                    
    589                     # the "Simulation" axis shows all values
    590                     # -- no need for assumptions
    591                     if {$xtitle != "Simulation"
    592                         && [info exists _dataobj2desc($dataobj)]} {
    593                         foreach line [split $_dataobj2desc($dataobj) \n] {
    594                             # skip the current axis and the Simulation axis
    595                             # Other values show assumptions about values reported
    596                             if {[string match "$xtitle =*" $line]
    597                                 || [string match "Simulation =*" $line]} {
    598                                 continue
    599                             }
    600                             set indent [expr {("" == $desc) ? "for:" : "    "}]
    601                             append desc " $indent $line\n"
    602                         }
    603                     }
    604                     if {[string length $desc] > 0} {
    605                         append csvdata "[string repeat - 60]\n"
    606                         append csvdata $desc
    607                         append csvdata "[string repeat - 60]\n"
    608                     }
    609                    
    610                     append csvdata "$xtitle, $ytitle\n"
    611                     foreach xval [lsort -real [array names _xval2label]] {
    612                         set dataobj ""
    613                         set param [list $_xval2label($xval) $xval]
    614                         foreach obj $_dlist {
    615                             if {[info exists _dataobj2param($obj)]
    616                                 && [string equal $_dataobj2param($obj) $param]} {
    617                                 set dataobj $obj
    618                                 break
    619                             }
    620                         }
    621                         if {"" != $dataobj} {
    622                             set yval [$dataobj get current]
    623                             append csvdata "$_xval2label($xval), $yval\n"
    624                         }
    625                     }
    626                     return [list .txt $csvdata]
    627                 }
     579                csv {
     580                    # March through the values in order and report
     581                    # all data points
     582                    set csvdata ""
     583                    set xtitle [$itk_component(plot) xaxis cget -title]
     584                    set ytitle [$itk_component(plot) yaxis cget -title]
     585                   
     586                    set desc ""
     587                    set dataobj [lindex [get] end]
     588                   
     589                    # the "Simulation" axis shows all values
     590                    # -- no need for assumptions
     591                    if {$xtitle != "Simulation"
     592                        && [info exists _dataobj2desc($dataobj)]} {
     593                        foreach line [split $_dataobj2desc($dataobj) \n] {
     594                            # skip the current axis and the Simulation axis
     595                            # Other values show assumptions about values reported
     596                            if {[string match "$xtitle =*" $line]
     597                                || [string match "Simulation =*" $line]} {
     598                                continue
     599                            }
     600                            set indent [expr {("" == $desc) ? "for:" : "    "}]
     601                            append desc " $indent $line\n"
     602                        }
     603                    }
     604                    if {[string length $desc] > 0} {
     605                        append csvdata "[string repeat - 60]\n"
     606                        append csvdata $desc
     607                        append csvdata "[string repeat - 60]\n"
     608                    }
     609                   
     610                    append csvdata "$xtitle, $ytitle\n"
     611                    foreach xval [lsort -real [array names _xval2label]] {
     612                        set dataobj ""
     613                        set param [list $_xval2label($xval) $xval]
     614                        foreach obj $_dlist {
     615                            if {[info exists _dataobj2param($obj)]
     616                                && [string equal $_dataobj2param($obj) $param]} {
     617                                set dataobj $obj
     618                                break
     619                            }
     620                        }
     621                        if {"" != $dataobj} {
     622                            set yval [$dataobj get current]
     623                            append csvdata "$_xval2label($xval), $yval\n"
     624                        }
     625                    }
     626                    return [list .txt $csvdata]
     627                }
    628628                image {
    629629                    set popup .numberresultprintdownload
     
    904904
    905905            if { [info exists info(name)] && $info(name) == $elem } {
    906                 set found 1
     906                set found 1
    907907
    908908                set x [$g axis transform $mapx $info(x)]
    909909                set y [$g axis transform $mapy $info(y)]
    910910               
    911                 set tip ""
     911                set tip ""
    912912                if {[info exists _elem2dataobj($elem)]} {
    913913                    set dataobj $_elem2dataobj($elem)
     
    929929            set results [$g element closest $x $y -interpolate no]
    930930            if { $results != ""  } {
    931                 set found 1
     931                set found 1
    932932
    933933                array unset info
     
    975975        #
    976976
    977         $g element deactivate $_hilite(elem)
    978         $g crosshairs configure -hide yes
    979         Rappture::Tooltip::tooltip cancel
     977        $g element deactivate $_hilite(elem)
     978        $g crosshairs configure -hide yes
     979        Rappture::Tooltip::tooltip cancel
    980980
    981981        $g element activate $elem
     
    10531053        # - take down tooltip
    10541054        #
    1055         $g element deactivate $_hilite(elem)
     1055        $g element deactivate $_hilite(elem)
    10561056
    10571057        set allx [$g x2axis use]
  • branches/blt4/gui/scripts/pager.tcl

    r2534 r2745  
    640640# busy --
    641641#
    642 #       If true (this indicates a simulation is occurring), the widget
    643 #       should prevent the user from
    644 #               1) clicking an item previous in the breadcrumbs, and
    645 #               2) using the "back" button.
     642#       If true (this indicates a simulation is occurring), the widget
     643#       should prevent the user from
     644#               1) clicking an item previous in the breadcrumbs, and
     645#               2) using the "back" button.
    646646#
    647647itcl::body Rappture::Pager::busy { bool } {
  • branches/blt4/gui/scripts/panes.tcl

    r1923 r2745  
    4949    private variable _counter 0      ;# counter for auto-generated names
    5050    private variable _frac 0.0       ;# list of fractions
    51     public variable orientation "vertical"
     51    public variable orientation "vertical"
    5252}
    5353
     
    409409            set x [expr {$x + $pw}]
    410410        }
    411     }   
     411    }   
    412412}
    413413
  • branches/blt4/gui/scripts/periodicelement.tcl

    r1923 r2745  
    22# ----------------------------------------------------------------------
    33#  COMPONENT: PeriodicElement - entry widget with a drop-down periodic
    4 #             table.
     4#             table.
    55#
    66#  This widget is a typical periodicelement, an entry widget with a drop-down
  • branches/blt4/gui/scripts/periodicelemententry.tcl

    r1923 r2745  
    6868    if { [llength $active] > 0 } {
    6969        $itk_component(element) element active $active
    70     }           
     70    }           
    7171    if { $defval != "" } {
    7272        $itk_component(element) value $defval
  • branches/blt4/gui/scripts/periodictable.tcl

    r1923 r2745  
    4646    private common _colors
    4747    array set _colors {
    48         actinoid-activebackground                       \#cd679a
    49         actinoid-activeforeground                       white
    50         actinoid-disabledbackground                     \#ff99cc 
    51         actinoid-disabledforeground                     \#D97DAB
    52         actinoid-background                             \#ff99cc
    53         actinoid-foreground                             black
    54         alkali-metal-activebackground                   \#cd3434
    55         alkali-metal-activeforeground                   white
    56         alkali-metal-disabledbackground                 \#ff6666
    57         alkali-metal-disabledforeground                 \#D04747
    58         alkali-metal-background                         \#ff6666
    59         alkali-metal-foreground                         black
    60         alkaline-earth-metal-activebackground           \#cdac7b
    61         alkaline-earth-metal-activeforeground           white
    62         alkaline-earth-metal-disabledbackground         \#ffdead
    63         alkaline-earth-metal-disabledforeground         \#C19A64
    64         alkaline-earth-metal-background                 \#ffdead
    65         alkaline-earth-metal-foreground                 black
    66         halogen-activebackground                        \#cdcd67
    67         halogen-activeforeground                        white
    68         halogen-disabledbackground                      \#ffff99
    69         halogen-disabledforeground                      \#D5D562
    70         halogen-background                              \#ffff99
    71         halogen-foreground                              black
    72         lanthanoid-activebackground                     \#cd8dcd
    73         lanthanoid-activeforeground                     white
    74         lanthanoid-disabledbackground                   \#ffbfff
    75         lanthanoid-disabledforeground                   \#D884D8
    76         lanthanoid-background                           \#ffbfff
    77         lanthanoid-foreground                           black
    78         metalloid-activebackground                      \#9a9a67
    79         metalloid-activeforeground                      white
    80         metalloid-disabledbackground                    \#cccc99
    81         metalloid-disabledforeground                    \#92922C
    82         metalloid-background                            \#cccc99
    83         metalloid-foreground                            black
    84         noble-gas-activebackground                      \#8ecdcd
    85         noble-gas-activeforeground                      white
    86         noble-gas-disabledbackground                    \#c0ffff
    87         noble-gas-disabledforeground                    \#7FC1C1
    88         noble-gas-background                            \#c0ffff
    89         noble-gas-foreground                            black
    90         other-non-metal-activebackground                \#6ecd6e
    91         other-non-metal-activeforeground                white
    92         other-non-metal-disabledbackground              \#a0ffa0
    93         other-non-metal-disabledforeground              \#6ACD6A
    94         other-non-metal-background                      \#a0ffa0
    95         other-non-metal-foreground                      black
    96         post-transition-metal-activebackground          \#9a9a9a       
    97         post-transition-metal-activeforeground          white
    98         post-transition-metal-disabledbackground        \#cccccc
    99         post-transition-metal-disabledforeground        \#999999
    100         post-transition-metal-background                \#cccccc
    101         post-transition-metal-foreground                black
    102         transition-metal-activebackground               \#cd8e8e
    103         transition-metal-activeforeground               white
    104         transition-metal-disabledbackground             \#ffc0c0
    105         transition-metal-disabledforeground             \#C77E7E
    106         transition-metal-background                     \#ffc0c0
    107         transition-metal-foreground                     black
    108         unknown-activebackground                        \#cdcdcd
    109         unknown-activeforeground                        white
    110         unknown-disabledbackground                      \#ffffff
    111         unknown-disabledforeground                      \#B9B9B9
    112         unknown-background                              \#ffffff
    113         unknown-foreground                              black
     48        actinoid-activebackground                       \#cd679a
     49        actinoid-activeforeground                       white
     50        actinoid-disabledbackground                     \#ff99cc 
     51        actinoid-disabledforeground                     \#D97DAB
     52        actinoid-background                             \#ff99cc
     53        actinoid-foreground                             black
     54        alkali-metal-activebackground                   \#cd3434
     55        alkali-metal-activeforeground                   white
     56        alkali-metal-disabledbackground                 \#ff6666
     57        alkali-metal-disabledforeground                 \#D04747
     58        alkali-metal-background                         \#ff6666
     59        alkali-metal-foreground                         black
     60        alkaline-earth-metal-activebackground           \#cdac7b
     61        alkaline-earth-metal-activeforeground           white
     62        alkaline-earth-metal-disabledbackground         \#ffdead
     63        alkaline-earth-metal-disabledforeground         \#C19A64
     64        alkaline-earth-metal-background                 \#ffdead
     65        alkaline-earth-metal-foreground                 black
     66        halogen-activebackground                        \#cdcd67
     67        halogen-activeforeground                        white
     68        halogen-disabledbackground                      \#ffff99
     69        halogen-disabledforeground                      \#D5D562
     70        halogen-background                              \#ffff99
     71        halogen-foreground                              black
     72        lanthanoid-activebackground                     \#cd8dcd
     73        lanthanoid-activeforeground                     white
     74        lanthanoid-disabledbackground                   \#ffbfff
     75        lanthanoid-disabledforeground                   \#D884D8
     76        lanthanoid-background                           \#ffbfff
     77        lanthanoid-foreground                           black
     78        metalloid-activebackground                      \#9a9a67
     79        metalloid-activeforeground                      white
     80        metalloid-disabledbackground                    \#cccc99
     81        metalloid-disabledforeground                    \#92922C
     82        metalloid-background                            \#cccc99
     83        metalloid-foreground                            black
     84        noble-gas-activebackground                      \#8ecdcd
     85        noble-gas-activeforeground                      white
     86        noble-gas-disabledbackground                    \#c0ffff
     87        noble-gas-disabledforeground                    \#7FC1C1
     88        noble-gas-background                            \#c0ffff
     89        noble-gas-foreground                            black
     90        other-non-metal-activebackground                \#6ecd6e
     91        other-non-metal-activeforeground                white
     92        other-non-metal-disabledbackground              \#a0ffa0
     93        other-non-metal-disabledforeground              \#6ACD6A
     94        other-non-metal-background                      \#a0ffa0
     95        other-non-metal-foreground                      black
     96        post-transition-metal-activebackground          \#9a9a9a       
     97        post-transition-metal-activeforeground          white
     98        post-transition-metal-disabledbackground        \#cccccc
     99        post-transition-metal-disabledforeground        \#999999
     100        post-transition-metal-background                \#cccccc
     101        post-transition-metal-foreground                black
     102        transition-metal-activebackground               \#cd8e8e
     103        transition-metal-activeforeground               white
     104        transition-metal-disabledbackground             \#ffc0c0
     105        transition-metal-disabledforeground             \#C77E7E
     106        transition-metal-background                     \#ffc0c0
     107        transition-metal-foreground                     black
     108        unknown-activebackground                        \#cdcdcd
     109        unknown-activeforeground                        white
     110        unknown-disabledbackground                      \#ffffff
     111        unknown-disabledforeground                      \#B9B9B9
     112        unknown-background                              \#ffffff
     113        unknown-foreground                              black
    114114    }
    115115    private common _tableData {
    116         Hydrogen        1  H  1.0079    1 1     other-non-metal
    117         Helium          2  He 4.0026    1 18    noble-gas
    118         Lithium         3  Li 6.941(2)  2 1     alkali-metal
    119         Beryllium       4  Be 9.0122    2 2     alkaline-earth-metal
    120         Boron           5  B  10.811(7) 2 13    metalloid
    121         Carbon          6  C  12.011    2 14    other-non-metal
    122         Nitrogen        7  N  14.007    2 15    other-non-metal
    123         Oxygen          8  O  15.999    2 16    other-non-metal
    124         Fluorine        9  F  18.998    2 17    halogen
    125         Neon            10 Ne 20.180    2 18    noble-gas
     116        Hydrogen        1  H  1.0079    1 1     other-non-metal
     117        Helium          2  He 4.0026    1 18    noble-gas
     118        Lithium         3  Li 6.941(2)  2 1     alkali-metal
     119        Beryllium       4  Be 9.0122    2 2     alkaline-earth-metal
     120        Boron           5  B  10.811(7) 2 13    metalloid
     121        Carbon          6  C  12.011    2 14    other-non-metal
     122        Nitrogen        7  N  14.007    2 15    other-non-metal
     123        Oxygen          8  O  15.999    2 16    other-non-metal
     124        Fluorine        9  F  18.998    2 17    halogen
     125        Neon            10 Ne 20.180    2 18    noble-gas
    126126       
    127         Sodium          11 Na 22.990    3 1     alkali-metal
    128         Magnesium       12 Mg 24.305    3 2     alkaline-earth-metal
    129         Aluminium       13 Al 26.982    3 13    post-transition-metal
    130         Silicon         14 Si 28.086    3 14    metalloid
    131         Phosphorus      15 P  30.974    3 15    other-non-metal
    132         Sulfur          16 S  32.066(6) 3 16    other-non-metal
    133         Chlorine        17 Cl 35.453    3 17    halogen
    134         Argon           18 Ar 39.948(1) 3 18    noble-gas
     127        Sodium          11 Na 22.990    3 1     alkali-metal
     128        Magnesium       12 Mg 24.305    3 2     alkaline-earth-metal
     129        Aluminium       13 Al 26.982    3 13    post-transition-metal
     130        Silicon         14 Si 28.086    3 14    metalloid
     131        Phosphorus      15 P  30.974    3 15    other-non-metal
     132        Sulfur          16 S  32.066(6) 3 16    other-non-metal
     133        Chlorine        17 Cl 35.453    3 17    halogen
     134        Argon           18 Ar 39.948(1) 3 18    noble-gas
    135135       
    136         Potassium       19 K  39.098    4 1     alkali-metal
    137         Calcium         20 Ca 40.078(4) 4 2     alkaline-earth-metal
    138         Scandium        21 Sc 44.956    4 3     transition-metal
    139         Titanium        22 Ti 47.867(1) 4 4     transition-metal
    140         Vanadium        23 V  50.942(1) 4 5     transition-metal
    141         Chromium        24 Cr 51.996    4 6     transition-metal
    142         Manganese       25 Mn 54.938    4 7     transition-metal
    143         Iron            26 Fe 55.845(2) 4 8     transition-metal
    144         Cobalt          27 Co 58.933    4 9     transition-metal
    145         Nickel          28 Ni 58.693    4 10    transition-metal
    146         Copper          29 Cu 63.546(3) 4 11    transition-metal
    147         Zinc            30 Zn 65.39(2)  4 12    transition-metal
    148         Gallium         31 Ga 69.723(1) 4 13    post-transition-metal
    149         Germanium       32 Ge 72.61(2)  4 14    metalloid
    150         Arsenic         33 As 74.922    4 15    metalloid
    151         Selenium        34 Se 78.96(3)  4 16    other-non-metal
    152         Bromine         35 Br 79.904(1) 4 17    halogen
    153         Krypton         36 Kr 83.80(1)  4 18    noble-gas
     136        Potassium       19 K  39.098    4 1     alkali-metal
     137        Calcium         20 Ca 40.078(4) 4 2     alkaline-earth-metal
     138        Scandium        21 Sc 44.956    4 3     transition-metal
     139        Titanium        22 Ti 47.867(1) 4 4     transition-metal
     140        Vanadium        23 V  50.942(1) 4 5     transition-metal
     141        Chromium        24 Cr 51.996    4 6     transition-metal
     142        Manganese       25 Mn 54.938    4 7     transition-metal
     143        Iron            26 Fe 55.845(2) 4 8     transition-metal
     144        Cobalt          27 Co 58.933    4 9     transition-metal
     145        Nickel          28 Ni 58.693    4 10    transition-metal
     146        Copper          29 Cu 63.546(3) 4 11    transition-metal
     147        Zinc            30 Zn 65.39(2)  4 12    transition-metal
     148        Gallium         31 Ga 69.723(1) 4 13    post-transition-metal
     149        Germanium       32 Ge 72.61(2)  4 14    metalloid
     150        Arsenic         33 As 74.922    4 15    metalloid
     151        Selenium        34 Se 78.96(3)  4 16    other-non-metal
     152        Bromine         35 Br 79.904(1) 4 17    halogen
     153        Krypton         36 Kr 83.80(1)  4 18    noble-gas
    154154       
    155         Rubidium        37 Rb 85.468    5 1     alkali-metal
    156         Strontium       38 Sr 87.62(1)  5 2     alkaline-earth-metal
    157         Yttrium         39 Y  88.906    5 3     transition-metal
    158         Zirconium       40 Zr 91.224(2) 5 4     transition-metal
    159         Niobium         41 Nb 92.906    5 5     transition-metal
    160         Molybdenum      42 Mo 95.94(1)  5 6     transition-metal
    161         Technetium      43 Tc [97.907]  5 7     transition-metal
    162         Ruthenium       44 Ru 101.07(2) 5 8     transition-metal
    163         Rhodium         45 Rh 102.906   5 9     transition-metal
    164         Palladium       46 Pd 106.42(1) 5 10    transition-metal
    165         Silver          47 Ag 107.868   5 11    transition-metal
    166         Cadmium         48 Cd 112.411(8) 5 12   transition-metal
    167         Indium          49 In 114.818(3) 5 13   post-transition-metal
    168         Tin             50 Sn 118.710(7) 5 14   post-transition-metal
    169         Antimony        51 Sb 121.760(1) 5 15   metalloid
    170         Tellurium       52 Te 127.60(3) 5 16    metalloid
    171         Iodine          53 I  126.904   5 17    halogen
    172         Xenon           54 Xe 131.29(2) 5 18    noble-gas
     155        Rubidium        37 Rb 85.468    5 1     alkali-metal
     156        Strontium       38 Sr 87.62(1)  5 2     alkaline-earth-metal
     157        Yttrium         39 Y  88.906    5 3     transition-metal
     158        Zirconium       40 Zr 91.224(2) 5 4     transition-metal
     159        Niobium         41 Nb 92.906    5 5     transition-metal
     160        Molybdenum      42 Mo 95.94(1)  5 6     transition-metal
     161        Technetium      43 Tc [97.907]  5 7     transition-metal
     162        Ruthenium       44 Ru 101.07(2) 5 8     transition-metal
     163        Rhodium         45 Rh 102.906   5 9     transition-metal
     164        Palladium       46 Pd 106.42(1) 5 10    transition-metal
     165        Silver          47 Ag 107.868   5 11    transition-metal
     166        Cadmium         48 Cd 112.411(8) 5 12   transition-metal
     167        Indium          49 In 114.818(3) 5 13   post-transition-metal
     168        Tin             50 Sn 118.710(7) 5 14   post-transition-metal
     169        Antimony        51 Sb 121.760(1) 5 15   metalloid
     170        Tellurium       52 Te 127.60(3) 5 16    metalloid
     171        Iodine          53 I  126.904   5 17    halogen
     172        Xenon           54 Xe 131.29(2) 5 18    noble-gas
    173173       
    174         Cesium          55 Cs 132.905   6 1     alkali-metal
    175         Barium          56 Ba 137.327(7) 6 2    alkaline-earth-metal
    176         Lanthanides     57-71 * *       6 3     lanthanoid
    177         Hafnium         72 Hf 178.49(2) 6 4     transition-metal
    178         Tantalum        73 Ta 180.948   6 5     transition-metal
    179         Tungsten        74 W  183.84(1) 6 6     transition-metal
    180         Rhenium         75 Re 186.207(1) 6 7    transition-metal
    181         Osmium          76 Os 190.23(3) 6 8     transition-metal
    182         Iridium         77 Ir 192.217(3) 6 9    transition-metal
    183         Platinum        78 Pt 195.084(9) 6 10   transition-metal
    184         Gold            79 Au 196.967 6 11      transition-metal
    185         Mercury         80 Hg 200.59(2) 6 12    transition-metal
    186         Thallium        81 Tl 204.383   6 13    post-transition-metal
    187         Lead            82 Pb 207.2(1) 6 14     post-transition-metal
    188         Bismuth         83 Bi 208.980   6 15    post-transition-metal
    189         Polonium        84 Po [208.982] 6 16    metalloid
    190         Astatine        85 At [209.987] 6 17    halogen
    191         Radon           86 Rn [222.018] 6 18    noble-gas
     174        Cesium          55 Cs 132.905   6 1     alkali-metal
     175        Barium          56 Ba 137.327(7) 6 2    alkaline-earth-metal
     176        Lanthanides     57-71 * *       6 3     lanthanoid
     177        Hafnium         72 Hf 178.49(2) 6 4     transition-metal
     178        Tantalum        73 Ta 180.948   6 5     transition-metal
     179        Tungsten        74 W  183.84(1) 6 6     transition-metal
     180        Rhenium         75 Re 186.207(1) 6 7    transition-metal
     181        Osmium          76 Os 190.23(3) 6 8     transition-metal
     182        Iridium         77 Ir 192.217(3) 6 9    transition-metal
     183        Platinum        78 Pt 195.084(9) 6 10   transition-metal
     184        Gold            79 Au 196.967 6 11      transition-metal
     185        Mercury         80 Hg 200.59(2) 6 12    transition-metal
     186        Thallium        81 Tl 204.383   6 13    post-transition-metal
     187        Lead            82 Pb 207.2(1) 6 14     post-transition-metal
     188        Bismuth         83 Bi 208.980   6 15    post-transition-metal
     189        Polonium        84 Po [208.982] 6 16    metalloid
     190        Astatine        85 At [209.987] 6 17    halogen
     191        Radon           86 Rn [222.018] 6 18    noble-gas
    192192       
    193         Francium        87 Fr [223.020] 7 1     alkali-metal
    194         Radium          88 Ra [226.0254] 7 2    alkaline-earth-metal
    195         Actinides       89-103 * * 7 3          actinoid
    196         Rutherfordium   104 Rf [263.113] 7 4    transition-metal
    197         Dubnium         105 Db [262.114] 7 5    transition-metal
    198         Seaborgium      106 Sg [266.122] 7 6    transition-metal
    199         Bohrium         107 Bh [264.1247] 7 7   transition-metal
    200         Hassium         108 Hs [269.134] 7 8    transition-metal
    201         Meitnerium      109 Mt [268.139] 7 9    transition-metal
    202         Darmstadtium    110 Ds [272.146] 7 10   transition-metal
    203         Roentgenium     111 Rg [272.154] 7 11   transition-metal
    204         Ununbium        112 Uub [277]   7 12    transition-metal
    205         Ununtrium       113 Uut [284] 7 13      post-transition-metal
    206         Ununquadium     114 Uuq [289] 7 14      post-transition-metal
    207         Ununpentium     115 Uup [288] 7 15      post-transition-metal
    208         Ununhexium      116 Uuh [292]  7 16     post-transition-metal
    209         Ununseptium     117 Uus ? 7 17          unknown
    210         Ununoctium      118 Uuo [294] 7 18      unknown
     193        Francium        87 Fr [223.020] 7 1     alkali-metal
     194        Radium          88 Ra [226.0254] 7 2    alkaline-earth-metal
     195        Actinides       89-103 * * 7 3          actinoid
     196        Rutherfordium   104 Rf [263.113] 7 4    transition-metal
     197        Dubnium         105 Db [262.114] 7 5    transition-metal
     198        Seaborgium      106 Sg [266.122] 7 6    transition-metal
     199        Bohrium         107 Bh [264.1247] 7 7   transition-metal
     200        Hassium         108 Hs [269.134] 7 8    transition-metal
     201        Meitnerium      109 Mt [268.139] 7 9    transition-metal
     202        Darmstadtium    110 Ds [272.146] 7 10   transition-metal
     203        Roentgenium     111 Rg [272.154] 7 11   transition-metal
     204        Ununbium        112 Uub [277]   7 12    transition-metal
     205        Ununtrium       113 Uut [284] 7 13      post-transition-metal
     206        Ununquadium     114 Uuq [289] 7 14      post-transition-metal
     207        Ununpentium     115 Uup [288] 7 15      post-transition-metal
     208        Ununhexium      116 Uuh [292]  7 16     post-transition-metal
     209        Ununseptium     117 Uus ? 7 17          unknown
     210        Ununoctium      118 Uuo [294] 7 18      unknown
    211211       
    212         Lanthanum       57 La 138.905 8 3       lanthanoid
    213         Cerium          58 Ce 140.116(1) 8 4    lanthanoid
    214         Praseodymium    59 Pr 140.908 8 5       lanthanoid
    215         Neodymium       60 Nd 144.242(3) 8 6    lanthanoid
    216         Promethium      61 Pm [144.913] 8 7     lanthanoid
    217         Samarium        62 Sm 150.36(2) 8 8     lanthanoid
    218         Europium        63 Eu 151.964(1) 8 9    lanthanoid
    219         Gadolinium      64 Gd 157.25(3) 8 10    lanthanoid
    220         Terbium         65 Tb 158.925   8 11    lanthanoid
    221         Dysprosium      66 Dy 162.500(1) 8 12   lanthanoid
    222         Holmium         67 Ho 164.930 8 13      lanthanoid
    223         Erbium          68 Er 167.259(3) 8 14   lanthanoid
    224         Thulium         69 Tm 168.934   8 15    lanthanoid
    225         Ytterbium       70 Yb 173.04(3) 8 16    lanthanoid
    226         Lutetium        71 Lu 174.967(1) 8 17   lanthanoid
     212        Lanthanum       57 La 138.905 8 3       lanthanoid
     213        Cerium          58 Ce 140.116(1) 8 4    lanthanoid
     214        Praseodymium    59 Pr 140.908 8 5       lanthanoid
     215        Neodymium       60 Nd 144.242(3) 8 6    lanthanoid
     216        Promethium      61 Pm [144.913] 8 7     lanthanoid
     217        Samarium        62 Sm 150.36(2) 8 8     lanthanoid
     218        Europium        63 Eu 151.964(1) 8 9    lanthanoid
     219        Gadolinium      64 Gd 157.25(3) 8 10    lanthanoid
     220        Terbium         65 Tb 158.925   8 11    lanthanoid
     221        Dysprosium      66 Dy 162.500(1) 8 12   lanthanoid
     222        Holmium         67 Ho 164.930 8 13      lanthanoid
     223        Erbium          68 Er 167.259(3) 8 14   lanthanoid
     224        Thulium         69 Tm 168.934   8 15    lanthanoid
     225        Ytterbium       70 Yb 173.04(3) 8 16    lanthanoid
     226        Lutetium        71 Lu 174.967(1) 8 17   lanthanoid
    227227       
    228         Actinium        89 Ac [227.027] 9 3     actinoid
    229         Thorium         90 Th 232.038   9 4     actinoid
    230         Protactinium    91 Pa 231.036 9 5       actinoid
    231         Uranium         92 U 238.029 9 6        actinoid
    232         Neptunium       93 Np [237.048] 9 7     actinoid
    233         Plutonium       94 Pu [244.064] 9 8     actinoid
    234         Americium       95 Am [243.061] 9 9     actinoid
    235         Curium          96 Cm [247.070] 9 10    actinoid
    236         Berkelium       97 Bk [247.070] 9 11    actinoid
    237         Californium     98 Cf [251.080] 9 12    actinoid
    238         Einsteinium     99 Es [252.083] 9 13    actinoid
    239         Fermium         100 Fm [257.095] 9 14   actinoid
    240         Mendelevium     101 Md [258.098] 9 15   actinoid
    241         Nobelium        102 No [259.101] 9 16   actinoid
    242         Lawrencium      103 Lr [262.110] 9 17   actinoid
     228        Actinium        89 Ac [227.027] 9 3     actinoid
     229        Thorium         90 Th 232.038   9 4     actinoid
     230        Protactinium    91 Pa 231.036 9 5       actinoid
     231        Uranium         92 U 238.029 9 6        actinoid
     232        Neptunium       93 Np [237.048] 9 7     actinoid
     233        Plutonium       94 Pu [244.064] 9 8     actinoid
     234        Americium       95 Am [243.061] 9 9     actinoid
     235        Curium          96 Cm [247.070] 9 10    actinoid
     236        Berkelium       97 Bk [247.070] 9 11    actinoid
     237        Californium     98 Cf [251.080] 9 12    actinoid
     238        Einsteinium     99 Es [252.083] 9 13    actinoid
     239        Fermium         100 Fm [257.095] 9 14   actinoid
     240        Mendelevium     101 Md [258.098] 9 15   actinoid
     241        Nobelium        102 No [259.101] 9 16   actinoid
     242        Lawrencium      103 Lr [262.110] 9 17   actinoid
    243243    }
    244244    private common _types
     
    247247            Actinides Actinium Americium Berkelium Californium Curium
    248248            Einsteinium Fermium Mendelevium Neptunium Plutonium Protactinium
    249             Thorium Uranium Lawrencium Nobelium 
     249            Thorium Uranium Lawrencium Nobelium 
    250250        }
    251251        alkali-metal {
    252             Cesium Francium Lithium Potassium Rubidium Sodium           
     252            Cesium Francium Lithium Potassium Rubidium Sodium           
    253253        }
    254254        alkaline-earth-metal {
    255             Barium Beryllium Calcium Magnesium Radium Strontium 
     255            Barium Beryllium Calcium Magnesium Radium Strontium 
    256256        }
    257257        halogen {
    258             Astatine Bromine Chlorine Fluorine Iodine           
     258            Astatine Bromine Chlorine Fluorine Iodine           
    259259        }
    260260        lanthanoid {
    261             Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum     
     261            Cerium Erbium Europium Gadolinium Holmium Lanthanides Lanthanum     
    262262            Lutetium Neodymium Praseodymium Promethium Samarium Terbium
    263             Thulium Ytterbium Dysprosium       
     263            Thulium Ytterbium Dysprosium       
    264264        }
    265265        metalloid {
    266             Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 
     266            Arsenic Boron Germanium Polonium Silicon Tellurium Antimony 
    267267        }
    268268        noble-gas {
     
    270270        }
    271271        other-non-metal {
    272             Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 
     272            Carbon Hydrogen Nitrogen Sulfur Oxygen Phosphorus Selenium 
    273273        }
    274274        post-transition-metal {
    275275            Aluminium Bismuth Gallium Indium Lead Thallium Tin Ununhexium
    276             Ununpentium Ununquadium Ununtrium   
     276            Ununpentium Ununquadium Ununtrium   
    277277        }
    278278        transition-metal {
    279             Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium         
    280             Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium         
     279            Chromium Cobalt Copper Dubnium Gold Hafnium Hassium Iridium         
     280            Iron Manganese Meitnerium Mercury Molybdenum Nickel Niobium         
    281281            Osmium Palladium Rhenium Rhodium Roentgenium Ruthenium
    282282            Rutherfordium Scandium Seaborgium Silver Tantalum Technetium
    283283            Titanium Tungsten Ununbium Vanadium Yttrium Zinc Zirconium
    284             Bohrium Cadmium Darmstadtium Platinum       
     284            Bohrium Cadmium Darmstadtium Platinum       
    285285        }
    286286        unknown {
    287             Ununoctium 
    288             Ununseptium 
     287            Ununoctium 
     288            Ununseptium 
    289289        }
    290290    }
     
    346346# active <list of elements>
    347347#
    348 #       Enables zero or more elements in the periodic table so that
    349 #       they can be selected.  All elements are first disabled.  Each
    350 #       argument can one of the following forms:
    351 #       1. element name.
    352 #       2. element symbol.
    353 #       3. element number.
    354 #       4. type of element.  The argument is expanded into all
    355 #          elements of that type.
     348#       Enables zero or more elements in the periodic table so that
     349#       they can be selected.  All elements are first disabled.  Each
     350#       argument can one of the following forms:
     351#       1. element name.
     352#       2. element symbol.
     353#       3. element number.
     354#       4. type of element.  The argument is expanded into all
     355#          elements of that type.
    356356#
    357357itcl::body Rappture::PeriodicTable::active { list } {
     
    390390# inactive <list of elements>
    391391#
    392 #       Disables zero or more elements in the periodic table so that
    393 #       they can't be selected.  All elements are first enabled.  Each
    394 #       argument can one of the following forms:
    395 #       1. element name.
    396 #       2. element symbol.
    397 #       3. element number.
    398 #       4. type of element.  The argument is expanded into all
    399 #          elements of that type.
     392#       Disables zero or more elements in the periodic table so that
     393#       they can't be selected.  All elements are first enabled.  Each
     394#       argument can one of the following forms:
     395#       1. element name.
     396#       2. element symbol.
     397#       3. element number.
     398#       4. type of element.  The argument is expanded into all
     399#          elements of that type.
    400400#
    401401itcl::body Rappture::PeriodicTable::inactive { list } {
  • branches/blt4/gui/scripts/resultset.tcl

    r2742 r2745  
    228228    }
    229229    pack $itk_component(options) -expand yes -fill both
    230     blt::tk::scrollbar $inner.scrl.xs           
    231     blt::tk::scrollbar $inner.scrl.ys           
     230    blt::tk::scrollbar $inner.scrl.xs           
     231    blt::tk::scrollbar $inner.scrl.ys           
    232232    itk_component add popup {
    233233        frame $inner.scrl.frame
     
    10951095    }
    10961096    if { $_active == "" } {
    1097         return;                         # Nothing active. Don't do anything.
     1097        return;                         # Nothing active. Don't do anything.
    10981098    }
    10991099    eval lappend params [_getValues $_active all]
     
    15281528                    set val "#[expr {$which+1}]"
    15291529                } else {
    1530                     # Be careful giving singleton elements as the "columns"
    1531                     # argument to "Tuples::get". It is expecting a list.
    1532                     set val [lindex [$_results get -format [list $col] $which] 0]
     1530                    # Be careful giving singleton elements as the "columns"
     1531                    # argument to "Tuples::get". It is expecting a list.
     1532                    set val [lindex [$_results get -format [list $col] $which] 0]
    15331533                }
    15341534                if {[info exists label2val($val)]} {
     
    16221622            foreach col $_cntlInfo($this-all) {
    16231623                set quantity $_cntlInfo($this-$col-label)
    1624                 # Be careful giving singleton elements as the "columns"
    1625                 # argument to "Tuples::get". It is expecting a list.
     1624                # Be careful giving singleton elements as the "columns"
     1625                # argument to "Tuples::get". It is expecting a list.
    16261626                set val [lindex [$_results get -format [list $col] $index] 0]
    16271627                if {$col == "xmlobj"} {
  • branches/blt4/gui/scripts/resultviewer.tcl

    r2742 r2745  
    218218            set mode "vtkviewer"
    219219            if {![info exists _mode2widget($mode)]} {
    220                 set servers [Rappture::VisViewer::GetServerList "vtkvis"]
     220                set servers [Rappture::VisViewer::GetServerList "vtkvis"]
    221221                set w $itk_interior.vtkviewer
    222                 Rappture::VtkViewer $w $servers
     222                Rappture::VtkViewer $w $servers
    223223                set _mode2widget($mode) $w
    224224            }
     
    264264                    if {![info exists _mode2widget($mode)]} {
    265265                        if { [$dataobj isunirect2d] } {
    266                             if { [$dataobj hints type] == "contour" } {
    267                                 set resultMode "vtkcontour"
    268                             } elseif { [info exists env(VTKHEIGHTMAP)] } {
    269                                 set resultMode "vtkheightmap"
    270                             } else {
    271                                 set resultMode "heightmap"
    272                             }
     266                            if { [$dataobj hints type] == "contour" } {
     267                                set resultMode "vtkcontour"
     268                            } elseif { [info exists env(VTKHEIGHTMAP)] } {
     269                                set resultMode "vtkheightmap"
     270                            } else {
     271                                set resultMode "heightmap"
     272                            }
    273273                        } else {
    274274                            set resultMode "vtk"
     
    289289                    if {![info exists _mode2widget($mode)]} {
    290290                        switch -- [$dataobj type] {
    291                             "vtk" {
    292                                 set fmt "vtk"
    293                             }
    294                             "opendx" - "dx" - "points-on-mesh" {
    295                                 set fmt "nanovis"
    296                                 set extents [$dataobj extents]
    297                                 if { $extents > 1 } {
    298                                     set fmt "flowvis"
    299                                 }
    300                             }
    301                             "vtkvolume" {
    302                                 set fmt "vtkvolume"
    303                             }
    304                             "vtkstreamlines" {
    305                                 set fmt "vtkstreamlines"
    306                             }
    307                         }
     291                            "vtk" {
     292                                set fmt "vtk"
     293                            }
     294                            "opendx" - "dx" - "points-on-mesh" {
     295                                set fmt "nanovis"
     296                                set extents [$dataobj extents]
     297                                if { $extents > 1 } {
     298                                    set fmt "flowvis"
     299                                }
     300                            }
     301                            "vtkvolume" {
     302                                set fmt "vtkvolume"
     303                            }
     304                            "vtkstreamlines" {
     305                                set fmt "vtkstreamlines"
     306                            }
     307                        }
    308308                        set w $itk_interior.field3D
    309309                        Rappture::Field3DResult $w -mode $fmt
  • branches/blt4/gui/scripts/sequenceresult.tcl

    r2742 r2745  
    2929
    3030    constructor {args} {
    31         # defined below
     31        # defined below
    3232    }
    3333    destructor {
    34         # defined below
     34        # defined below
    3535    }
    3636    public method add {dataobj {settings ""}}
     
    3939    public method scale {args}
    4040    public method parameters {title args} {
    41         # do nothing
     41        # do nothing
    4242    }
    4343    public method download {option args}
     
    5555    private method BuildViewer { viewer }
    5656    private method AnimationPopup { popup info }
    57     private variable _dispatcher "" ;   # dispatcher for !events
    58     private variable _dlist ""      ;   # list of data objects
    59     private variable _topmost ""    ;   # topmost data object in _dlist
    60     private variable _indices ""    ;   # list of active indices
    61     private variable _pos 0         ;   # current position in the animation
    62     private variable _afterId ""    ;   # current "after" event for play op
    63 
    64     private variable _viewerclass "";   # Class of viewer.
    65     private variable _animate   0 ;     # Indicates if the sequence can be
    66                                         # animated (i.e. produce an animated
    67                                         # gif or mpeg video).
    68     private variable _popup "";         # Popup window for dialog.
    69     private common _play            ;   # options for "play" operation
    70 
    71     private variable _class "";         # Class of element in sequence.
    72     private variable _dim 0;            # Dimension elements in sequence.
    73     private variable _mode "";          # Mode of viewer.
     57    private variable _dispatcher "" ;   # dispatcher for !events
     58    private variable _dlist ""      ;   # list of data objects
     59    private variable _topmost ""    ;   # topmost data object in _dlist
     60    private variable _indices ""    ;   # list of active indices
     61    private variable _pos 0         ;   # current position in the animation
     62    private variable _afterId ""    ;   # current "after" event for play op
     63
     64    private variable _viewerclass "";   # Class of viewer.
     65    private variable _animate   0 ;     # Indicates if the sequence can be
     66                                        # animated (i.e. produce an animated
     67                                        # gif or mpeg video).
     68    private variable _popup "";         # Popup window for dialog.
     69    private common _play            ;   # options for "play" operation
     70
     71    private variable _class "";         # Class of element in sequence.
     72    private variable _dim 0;            # Dimension elements in sequence.
     73    private variable _mode "";          # Mode of viewer.
    7474
    7575    set _play(speed) 60
     
    310310itcl::body Rappture::SequenceResult::download {option args} {
    311311    if { ![winfo exists $itk_component(area).viewer] } {
    312         return "";      # No data, no viewer, no download.
     312        return "";      # No data, no viewer, no download.
    313313    }
    314314    switch $option {
     
    318318        controls {
    319319            set _popup \
    320                 [eval $itk_component(area).viewer download controls $args]
    321             if { $_animate } {
    322                 # Add the animation button to the download dialog
     320                [eval $itk_component(area).viewer download controls $args]
     321            if { $_animate } {
     322                # Add the animation button to the download dialog
    323323                set inner [$_popup component inner]
    324                 if { ![winfo exists $inner.animation] } {
    325                     radiobutton $inner.animation -text "Animation (GIF/MPEG)" \
    326                         -variable ${_viewerclass}::_downloadPopup(format) \
    327                         -value animation
    328                     pack $inner.animation -anchor w
    329                     update
    330                 }
    331             }
    332             return $_popup
     324                if { ![winfo exists $inner.animation] } {
     325                    radiobutton $inner.animation -text "Animation (GIF/MPEG)" \
     326                        -variable ${_viewerclass}::_downloadPopup(format) \
     327                        -value animation
     328                    pack $inner.animation -anchor w
     329                    update
     330                }
     331            }
     332            return $_popup
    333333        }
    334334        now {
    335             if { $_animate } {
    336                 # Examine the radiobutton variable to see if an animated GIF
    337                 # of MPEG movie was selected for download.
    338                 set fmt [set ${_viewerclass}::_downloadPopup(format)]
    339                 if { $fmt == "animation" } {
    340                     if { [winfo exists $_popup] } {
    341                         $_popup deactivate
    342                     }
    343                     set popup .sequenceanimationdownload
    344                     return [AnimationPopup $popup $args]
    345                 }
    346             }
    347             # Otherwise, return download of single frame
    348             return [eval $itk_component(area).viewer download now $args]
     335            if { $_animate } {
     336                # Examine the radiobutton variable to see if an animated GIF
     337                # of MPEG movie was selected for download.
     338                set fmt [set ${_viewerclass}::_downloadPopup(format)]
     339                if { $fmt == "animation" } {
     340                    if { [winfo exists $_popup] } {
     341                        $_popup deactivate
     342                    }
     343                    set popup .sequenceanimationdownload
     344                    return [AnimationPopup $popup $args]
     345                }
     346            }
     347            # Otherwise, return download of single frame
     348            return [eval $itk_component(area).viewer download now $args]
    349349        }
    350350        default {
     
    362362itcl::body Rappture::SequenceResult::play {} {
    363363    if { [llength $_indices] == 0 } {
    364         return;                         # No frames (i.e. no data).
     364        return;                         # No frames (i.e. no data).
    365365    }
    366366    # Stop any existing animation.
     
    378378
    379379    global readyForNextFrame
    380     set readyForNextFrame 1;            # By default, always ready
     380    set readyForNextFrame 1;            # By default, always ready
    381381    # Schedule the first frame
    382382    set delay [expr {int(ceil(pow($_play(speed)/10.0+2,2.0)*15))}]
     
    396396    }
    397397    global readyForNextFrame
    398     set readyForNextFrame 1;            # By default, always ready
    399                                        
     398    set readyForNextFrame 1;            # By default, always ready
     399                                       
    400400    # Check if the play button still exists. We may be in the process
    401401    # of destroying the widget.
    402402    if { [info exists itk_component(play)] } {
    403         # toggle the button to "play" mode
    404         $itk_component(play) configure \
    405             -bitmap [Rappture::icon play] \
    406             -command [itcl::code $this play]
     403        # toggle the button to "play" mode
     404        $itk_component(play) configure \
     405            -bitmap [Rappture::icon play] \
     406            -command [itcl::code $this play]
    407407    }
    408408}
     
    446446            return
    447447        }
    448         pack $viewer -expand yes -fill both
    449         pack $itk_component(player) -side bottom -fill x
     448        pack $viewer -expand yes -fill both
     449        pack $itk_component(player) -side bottom -fill x
    450450    } else {
    451451        if { "" == $_topmost } {
    452452            return
    453453        }
    454         BuildViewer $viewer
     454        BuildViewer $viewer
    455455    }
    456456
     
    502502        set delay [expr {int(ceil(pow($_play(speed)/10.0+2,2.0)*15))}]
    503503    } else {
    504         set delay 50;                   # Poll for completion
     504        set delay 50;                   # Poll for completion
    505505    }
    506506    set _afterId [after $delay [itcl::code $this _playFrame]]
     
    596596    }
    597597    set save $_pos
    598     $viewer delete                      ;# Delete all objects from the viewer
     598    $viewer delete                      ;# Delete all objects from the viewer
    599599    for { set i 0 } { $i < [llength $_indices] } { incr i } {
    600         set dataobj [$_topmost value $i]
    601         set val [$itk_component(dial) get -format label @$i]
    602         set _pos [lsearch -glob $_indices $val*]
    603         set settings "-color autoreset -width 2"
    604         if {[catch {$dataobj hints style} style] == 0} {
    605             eval lappend settings $style
    606         }
    607         if { [catch {$dataobj hints type} type] == 0} {
    608             if {"" != $type} {
    609                 lappend settings -type $type
    610             }
    611         }
    612         $viewer add $dataobj $settings
    613         set img [$viewer snap $x $y]
    614         # add caption to frame.
     600        set dataobj [$_topmost value $i]
     601        set val [$itk_component(dial) get -format label @$i]
     602        set _pos [lsearch -glob $_indices $val*]
     603        set settings "-color autoreset -width 2"
     604        if {[catch {$dataobj hints style} style] == 0} {
     605            eval lappend settings $style
     606        }
     607        if { [catch {$dataobj hints type} type] == 0} {
     608            if {"" != $type} {
     609                lappend settings -type $type
     610            }
     611        }
     612        $viewer add $dataobj $settings
     613        set img [$viewer snap $x $y]
     614        # add caption to frame.
    615615        if { $val != "" } {
    616616            $img draw text "$label $val" 10 10 \
    617617                -font "Arial 10" -color white -shadow 1
    618618        }
    619         $viewer delete
     619        $viewer delete
    620620        lappend imageList $img
    621621    }
     
    624624    set settings "-color autoreset -width 2"
    625625    if {[catch {$dataobj hints style} style] == 0} {
    626         eval lappend settings $style
     626        eval lappend settings $style
    627627    }
    628628    if { [catch {$dataobj hints type} type] == 0} {
    629         if {"" != $type} {
    630             lappend settings -type $type
    631         }
     629        if {"" != $type} {
     630            lappend settings -type $type
     631        }
    632632    }
    633633    $viewer add $dataobj $settings
     
    645645# VerifySequence --
    646646#
    647 #       Verifies the correctness of the sequence.  The sequence must
    648 #       contain a homogenous set of elements.  If the element is a
    649 #       "field", then also the dimensions of every component must be
    650 #       the same.
     647#       Verifies the correctness of the sequence.  The sequence must
     648#       contain a homogenous set of elements.  If the element is a
     649#       "field", then also the dimensions of every component must be
     650#       the same.
    651651#
    652652itcl::body Rappture::SequenceResult::VerifySequence {} {
    653653
    654     # Step 1:   Use the topmost object as the standard.  Check whether it
    655     #           can be sequenced.
     654    # Step 1:   Use the topmost object as the standard.  Check whether it
     655    #           can be sequenced.
    656656    set dataobj [lindex [$_topmost value 0] 0]
    657657    set _class [$dataobj info class]
     
    659659    set mode ""
    660660    switch -- $_class {
    661         ::Rappture::Curve -
    662         ::Rappture::DataTable -
    663         ::Rappture::Image {
    664             # empty
    665         }
    666         ::Rappture::Field {
    667             set _dim [lindex [$dataobj components -dimensions] 0]
    668             switch $_dim {
    669                 2D {
    670                     if { [$dataobj isunirect2d] } {
    671                         if { [$dataobj hints type] == "contour" } {
    672                             set mode "vtkcontour"
    673                         } else {
    674                             set mode "heightmap"
    675                         }
    676                     } else {
    677                         set mode "vtk"
    678                     }
    679                     Rappture::Field2DResult $viewer -mode $mode
    680                 }
    681                 "3D" {
    682                     # empty
    683                 }
    684                 default {
    685                     error "Found field element $_class with $_dim dimensions"
    686                 }
    687             }
    688         }
    689         ::Rappture::LibraryObj {
    690             set type [$dataobj element -as type]
    691             if { $type != "structure" } {
    692                 error "Don't know how to view sequences of $type"
    693             }
    694         }
    695         default {
    696             puts stderr "Don't know how to view sequences of type \"$_class\""
    697             puts stderr "Is the sequence empty?"
    698             return 0
    699         }
     661        ::Rappture::Curve -
     662        ::Rappture::DataTable -
     663        ::Rappture::Image {
     664            # empty
     665        }
     666        ::Rappture::Field {
     667            set _dim [lindex [$dataobj components -dimensions] 0]
     668            switch $_dim {
     669                2D {
     670                    if { [$dataobj isunirect2d] } {
     671                        if { [$dataobj hints type] == "contour" } {
     672                            set mode "vtkcontour"
     673                        } else {
     674                            set mode "heightmap"
     675                        }
     676                    } else {
     677                        set mode "vtk"
     678                    }
     679                    Rappture::Field2DResult $viewer -mode $mode
     680                }
     681                "3D" {
     682                    # empty
     683                }
     684                default {
     685                    error "Found field element $_class with $_dim dimensions"
     686                }
     687            }
     688        }
     689        ::Rappture::LibraryObj {
     690            set type [$dataobj element -as type]
     691            if { $type != "structure" } {
     692                error "Don't know how to view sequences of $type"
     693            }
     694        }
     695        default {
     696            puts stderr "Don't know how to view sequences of type \"$_class\""
     697            puts stderr "Is the sequence empty?"
     698            return 0
     699        }
    700700    }
    701701
    702     # Step 2:   Review all the data objects.  They must be all of the same
    703     #           class (e.g. can't mix curves with images).  Also check that
    704     #           fields are all the same dimension.
     702    # Step 2:   Review all the data objects.  They must be all of the same
     703    #           class (e.g. can't mix curves with images).  Also check that
     704    #           fields are all the same dimension.
    705705    foreach dataobj $_dlist {
    706         set dataobj [lindex [$dataobj value 0] 0]
    707         set class [$dataobj info class]
    708         if { $_class != $class } {
    709             puts stderr "Found element \"$class\" in sequence of \"$_class\""
    710             continue
    711         }
    712         if { $class == "::Rappture::Field" } {
    713             # check to see if the dimensions are the same for all components
    714             # in the elements of the field. I dont think we can display fields
    715             # of differing dimensions within the same field object.
    716             foreach dim [$dataobj components -dimensions]  {
    717                 if { $_dim != $dim } {
    718                     error "Found field element of dimension \"$dim\" in sequence of $_dim dimension elements"
    719                 }
    720             }
    721             continue
    722         }
     706        set dataobj [lindex [$dataobj value 0] 0]
     707        set class [$dataobj info class]
     708        if { $_class != $class } {
     709            puts stderr "Found element \"$class\" in sequence of \"$_class\""
     710            continue
     711        }
     712        if { $class == "::Rappture::Field" } {
     713            # check to see if the dimensions are the same for all components
     714            # in the elements of the field. I dont think we can display fields
     715            # of differing dimensions within the same field object.
     716            foreach dim [$dataobj components -dimensions]  {
     717                if { $_dim != $dim } {
     718                    error "Found field element of dimension \"$dim\" in sequence of $_dim dimension elements"
     719                }
     720            }
     721            continue
     722        }
    723723    }
    724724    if { $_class == "" } {
    725         puts stderr "Don't know how to view sequences of class \"$_class\""
    726         puts stderr "Is the sequence empty?"
    727         return 0
     725        puts stderr "Don't know how to view sequences of class \"$_class\""
     726        puts stderr "Is the sequence empty?"
     727        return 0
    728728    }
    729729}
     
    731731itcl::body Rappture::SequenceResult::AnimationPopup { popup info } {
    732732    if { ![winfo exists $popup] } {
    733         # Create a popup for the print dialog
    734         Rappture::Balloon $popup -title "Save as animation..."
    735         set inner [$popup component inner]
    736 
    737         # Create the print dialog widget and add it to the the balloon popup.
    738         Rappture::SequenceAnimation $inner.print $this
    739         $popup configure -deactivatecommand [list $inner.print reset]
    740         blt::table $inner 0,0 $inner.print -fill both
     733        # Create a popup for the print dialog
     734        Rappture::Balloon $popup -title "Save as animation..."
     735        set inner [$popup component inner]
     736
     737        # Create the print dialog widget and add it to the the balloon popup.
     738        Rappture::SequenceAnimation $inner.print $this
     739        $popup configure -deactivatecommand [list $inner.print reset]
     740        blt::table $inner 0,0 $inner.print -fill both
    741741    }
    742742    update
     
    753753itcl::body Rappture::SequenceResult::BuildViewer { viewer } {
    754754    switch -- $_class {
    755         ::Rappture::Curve {
    756             Rappture::XyResult $viewer
    757             set _viewerclass ::Rappture::XyResult
    758             set _animate 1
    759         }
    760         ::Rappture::DataTable {
    761             Rappture::DataTable $viewer
    762             set _viewerclass ::Rappture::DataTable
    763         }
    764         ::Rappture::Image {
    765             Rappture::ImageResult $viewer
    766             set _viewerclass ::Rappture::ImageResult
    767             set _animate 1
    768         }
    769         ::Rappture::Field {
    770             switch -- $_dim {
    771                 2D {
    772                     Rappture::Field2DResult $viewer -mode $mode
    773                     if { $_mode == "heightmap" } {
    774                         set _viewerclass ::Rappture::HeightmapViewer
    775                         set _animate 1
    776                     }
    777                 }
    778                 3D {
    779                     Rappture::Field3DResult $viewer
    780                     set _viewerclass ::Rappture::NanovisViewer
    781                     set _animate 1
    782                 }
    783             }
    784         }
    785         ::Rappture::LibraryObj {
    786             Rappture::DeviceResult $viewer
    787             set _viewerclass ::Rappture::MolvisViewer
    788             set _animate 1
    789         }
     755        ::Rappture::Curve {
     756            Rappture::XyResult $viewer
     757            set _viewerclass ::Rappture::XyResult
     758            set _animate 1
     759        }
     760        ::Rappture::DataTable {
     761            Rappture::DataTable $viewer
     762            set _viewerclass ::Rappture::DataTable
     763        }
     764        ::Rappture::Image {
     765            Rappture::ImageResult $viewer
     766            set _viewerclass ::Rappture::ImageResult
     767            set _animate 1
     768        }
     769        ::Rappture::Field {
     770            switch -- $_dim {
     771                2D {
     772                    Rappture::Field2DResult $viewer -mode $mode
     773                    if { $_mode == "heightmap" } {
     774                        set _viewerclass ::Rappture::HeightmapViewer
     775                        set _animate 1
     776                    }
     777                }
     778                3D {
     779                    Rappture::Field3DResult $viewer
     780                    set _viewerclass ::Rappture::NanovisViewer
     781                    set _animate 1
     782                }
     783            }
     784        }
     785        ::Rappture::LibraryObj {
     786            Rappture::DeviceResult $viewer
     787            set _viewerclass ::Rappture::MolvisViewer
     788            set _animate 1
     789        }
    790790    }
    791791    pack $viewer -expand yes -fill both
  • branches/blt4/gui/scripts/sidebarframe.tcl

    r2742 r2745  
    4848    public method pop {what}
    4949    public method width { size } {
    50         set _width $size
     50        set _width $size
    5151    }
    5252    public method enable { which }
     
    198198    #
    199199    # Note:  Bugs in BLT 2.4 tabset/VNC server crashes the server
    200     #        when -outerpad is set to 0.
     200    #        when -outerpad is set to 0.
    201201    #
    202202    itk_component add tabs {
     
    214214    }
    215215    pack $itk_component(tabs) -side top -expand yes -anchor e -padx {4 0} \
    216         -fill y
     216        -fill y
    217217
    218218    eval itk_initialize $args
  • branches/blt4/gui/scripts/textentry.tcl

    r2534 r2745  
    8787    set icon [$_owner xml get $path.about.icon]
    8888    if {[string length $icon] > 0} {
    89         set _icon [image create photo -data $icon]
     89        set _icon [image create photo -data $icon]
    9090    }
    9191    if {[string length $hints] > 0} {
     
    362362                    frame $itk_interior.bin
    363363                }
    364                 set icon $_icon
    365                 if { $icon == "" } {
    366                     set icon [Rappture::icon binary]
    367                 }
     364                set icon $_icon
     365                if { $icon == "" } {
     366                    set icon [Rappture::icon binary]
     367                }
    368368                itk_component add binicon {
    369369                    ::label $itk_component(binary).binicon \
  • branches/blt4/gui/scripts/tool.tcl

    r2742 r2745  
    205205                -error ::Rappture::Tool::job(error) $cmd} result]
    206206
    207             if { $status != 0 } {
    208                 foreach {code pid mesg} $::Rappture::Tool::job(control) break
    209                 if { $code != "EXITED" } {
    210                     set result "Abnormal program termination \"$code\": $mesg"
    211                     return [list $status $result]
    212                 }
    213             }
    214         }
     207            if { $status != 0 } {
     208                foreach {code pid mesg} $::Rappture::Tool::job(control) break
     209                if { $code != "EXITED" } {
     210                    set result "Abnormal program termination \"$code\": $mesg"
     211                    return [list $status $result]
     212                }
     213            }
     214        }
    215215        # ...job is finished
    216216        array set times [Rappture::rusage measure]
  • branches/blt4/gui/scripts/unirect2d.tcl

    r2534 r2745  
    3232    private method GetSize { obj path varName }
    3333
    34     private variable _axisOrder "x y"
    35     private variable _xMax      0
    36     private variable _xMin      0
    37     private variable _xNum      0
    38     private variable _yMax      0
    39     private variable _yMin      0
    40     private variable _yNum      0
    41     private variable _compNum   1
    42     private variable _values    "";     # BLT vector containing the z-values
     34    private variable _axisOrder "x y"
     35    private variable _xMax      0
     36    private variable _xMin      0
     37    private variable _xNum      0
     38    private variable _yMax      0
     39    private variable _yMin      0
     40    private variable _yNum      0
     41    private variable _compNum   1
     42    private variable _values    "";     # BLT vector containing the z-values
    4343    private variable _hints
    4444}
     
    7979        ymin    yaxis.min
    8080        ymax    yaxis.max
    81         type    about.type
     81        type    about.type
    8282    } {
    8383        set str [$m get $path]
     
    117117# ----------------------------------------------------------------------
    118118# method blob
    119 #       Returns a base64 encoded, gzipped Tcl list that represents the
    120 #       Tcl command and data to recreate the uniform rectangular grid
    121 #       on the nanovis server.
     119#       Returns a base64 encoded, gzipped Tcl list that represents the
     120#       Tcl command and data to recreate the uniform rectangular grid
     121#       on the nanovis server.
    122122# ----------------------------------------------------------------------
    123123itcl::body Rappture::Unirect2d::blob {} {
     
    140140# ----------------------------------------------------------------------
    141141# method mesh.old
    142 #       Returns a base64 encoded, gzipped Tcl list that represents the
    143 #       Tcl command and data to recreate the uniform rectangular grid
    144 #       on the nanovis server.
     142#       Returns a base64 encoded, gzipped Tcl list that represents the
     143#       Tcl command and data to recreate the uniform rectangular grid
     144#       on the nanovis server.
    145145# ----------------------------------------------------------------------
    146146itcl::body Rappture::Unirect2d::mesh.old {} {
     
    160160# ----------------------------------------------------------------------
    161161# method mesh
    162 #       Returns a base64 encoded, gzipped Tcl list that represents the
    163 #       Tcl command and data to recreate the uniform rectangular grid
    164 #       on the nanovis server.
     162#       Returns a base64 encoded, gzipped Tcl list that represents the
     163#       Tcl command and data to recreate the uniform rectangular grid
     164#       on the nanovis server.
    165165# ----------------------------------------------------------------------
    166166itcl::body Rappture::Unirect2d::mesh {} {
     
    171171# ----------------------------------------------------------------------
    172172# method values
    173 #       Returns a base64 encoded, gzipped Tcl list that represents the
    174 #       Tcl command and data to recreate the uniform rectangular grid
    175 #       on the nanovis server.
     173#       Returns a base64 encoded, gzipped Tcl list that represents the
     174#       Tcl command and data to recreate the uniform rectangular grid
     175#       on the nanovis server.
    176176# ----------------------------------------------------------------------
    177177itcl::body Rappture::Unirect2d::values {} {
     
    184184# ----------------------------------------------------------------------
    185185# method limits <axis>
    186 #       Returns a list {min max} representing the limits for the
    187 #       specified axis.
     186#       Returns a list {min max} representing the limits for the
     187#       specified axis.
    188188# ----------------------------------------------------------------------
    189189itcl::body Rappture::Unirect2d::limits {which} {
  • branches/blt4/gui/scripts/unirect3d.tcl

    r1923 r2745  
    3434    private method GetSize { obj path varName }
    3535
    36     private variable _axisOrder  "x y z"
    37     private variable _xMax      0
    38     private variable _xMin      0
    39     private variable _xNum       0;     # Number of points along x-axis.
    40     private variable _yMax      0
    41     private variable _yMin      0
    42     private variable _yNum       0;     # Number of points along y-axis.
    43     private variable _zMax      0
    44     private variable _zMin      0
    45     private variable _zNum       0;     # Number of points along z-axis.
    46     private variable _compNum    1;     # Number of components in values.
    47     private variable _values     "";    # BLT vector containing the z-values
     36    private variable _axisOrder  "x y z"
     37    private variable _xMax      0
     38    private variable _xMin      0
     39    private variable _xNum       0;     # Number of points along x-axis.
     40    private variable _yMax      0
     41    private variable _yMin      0
     42    private variable _yNum       0;     # Number of points along y-axis.
     43    private variable _zMax      0
     44    private variable _zMin      0
     45    private variable _zNum       0;     # Number of points along z-axis.
     46    private variable _compNum    1;     # Number of components in values.
     47    private variable _values     "";    # BLT vector containing the z-values
    4848    private variable _hints
    4949}
     
    8989# ----------------------------------------------------------------------
    9090# method blob
    91 #       Returns a base64 encoded, gzipped Tcl list that represents the
    92 #       Tcl command and data to recreate the uniform rectangular grid
    93 #       on the nanovis server.
     91#       Returns a base64 encoded, gzipped Tcl list that represents the
     92#       Tcl command and data to recreate the uniform rectangular grid
     93#       on the nanovis server.
    9494# ----------------------------------------------------------------------
    9595itcl::body Rappture::Unirect3d::blob {} {
     
    107107# ----------------------------------------------------------------------
    108108# method mesh
    109 #       Returns a base64 encoded, gzipped Tcl list that represents the
    110 #       Tcl command and data to recreate the uniform rectangular grid
    111 #       on the nanovis server.
     109#       Returns a base64 encoded, gzipped Tcl list that represents the
     110#       Tcl command and data to recreate the uniform rectangular grid
     111#       on the nanovis server.
    112112# ----------------------------------------------------------------------
    113113itcl::body Rappture::Unirect3d::mesh {} {
     
    131131# ----------------------------------------------------------------------
    132132# method values
    133 #       Returns a base64 encoded, gzipped Tcl list that represents the
    134 #       Tcl command and data to recreate the uniform rectangular grid
    135 #       on the nanovis server.
     133#       Returns a base64 encoded, gzipped Tcl list that represents the
     134#       Tcl command and data to recreate the uniform rectangular grid
     135#       on the nanovis server.
    136136# ----------------------------------------------------------------------
    137137itcl::body Rappture::Unirect3d::values {} {
     
    144144# ----------------------------------------------------------------------
    145145# method limits <axis>
    146 #       Returns a list {min max} representing the limits for the
    147 #       specified axis.
     146#       Returns a list {min max} representing the limits for the
     147#       specified axis.
    148148# ----------------------------------------------------------------------
    149149itcl::body Rappture::Unirect3d::limits {which} {
  • branches/blt4/gui/scripts/visviewer.tcl

    r2742 r2745  
    2626
    2727    protected variable _serverType "???";# Type of server.
    28     protected variable _sid ""      ;   # socket connection to server
    29     private common _done            ;   # Used to indicate status of send.
    30     private variable _buffer        ;   # buffer for incoming/outgoing commands
     28    protected variable _sid ""      ;   # socket connection to server
     29    private common _done            ;   # Used to indicate status of send.
     30    private variable _buffer        ;   # buffer for incoming/outgoing commands
    3131    private variable _initialized
    3232    private variable _isOpen 0
     
    4141    #private variable _idleTimeout 0;       # No timeout
    4242
    43     protected variable _dispatcher "";  # dispatcher for !events
    44     protected variable _hosts ""    ;   # list of hosts for server
    45     protected variable _parser ""   ;   # interpreter for incoming commands
     43    protected variable _dispatcher "";  # dispatcher for !events
     44    protected variable _hosts ""    ;   # list of hosts for server
     45    protected variable _parser ""   ;   # interpreter for incoming commands
    4646    protected variable _image
    4747    protected variable _hostname
     
    8989    }
    9090    public proc SetServerList { type namelist } {
    91         # Convert the comma separated list into a Tcl list.  OGRE also adds
    92         # a trailing comma that we want to ignore.
     91        # Convert the comma separated list into a Tcl list.  OGRE also adds
     92        # a trailing comma that we want to ignore.
    9393        regsub -all "," $namelist " " namelist
    9494        CheckNameList $namelist
     
    9696    }
    9797    public proc RemoveServerFromList { type server } {
    98         if { ![info exists _servers($type)] } {
    99             error "unknown server type \"$type\""
    100         }
    101         set i [lsearch $_servers($type) $server]
    102         if { $i < 0 } {
    103             return
    104         }
    105         set _servers($type) [lreplace $_servers($type) $i $i]
     98        if { ![info exists _servers($type)] } {
     99            error "unknown server type \"$type\""
     100        }
     101        set i [lsearch $_servers($type) $server]
     102        if { $i < 0 } {
     103            return
     104        }
     105        set _servers($type) [lreplace $_servers($type) $i $i]
    106106    }
    107107    public proc SetPymolServerList { namelist } {
     
    228228    foreach server [Shuffle $hostlist] {
    229229        puts stderr "connecting to $server..."
    230         foreach {hostname port} [split $server ":"] break
     230        foreach {hostname port} [split $server ":"] break
    231231        if { [catch {socket $hostname $port} _sid] != 0 } {
    232             set _sid ""
    233             RemoveServerFromList $_serverType $server
    234             continue
    235         }
    236         set _hostname $server
     232            set _sid ""
     233            RemoveServerFromList $_serverType $server
     234            continue
     235        }
     236        set _hostname $server
    237237        fconfigure $_sid -translation binary -encoding binary
    238        
     238       
    239239        # Read back the server identification string.
    240240        if { [gets $_sid data] <= 0 } {
    241             set _sid ""
    242             puts stderr "reading from server"
    243             RemoveServerFromList $_serverType $server
    244             continue
    245         }
    246         puts stderr "render server is $data"
    247         # We're connected. Cancel any pending serverDown events and
    248         # release the busy window over the hull.
    249         $_dispatcher cancel !serverDown
    250         if { $_idleTimeout > 0 } {
    251             $_dispatcher event -after $_idleTimeout !timeout
    252         }
    253         blt::busy release $itk_component(hull)
    254         fconfigure $_sid -buffering line
    255         fileevent $_sid readable [itcl::code $this ReceiveHelper]
    256         return 1
     241            set _sid ""
     242            puts stderr "reading from server"
     243            RemoveServerFromList $_serverType $server
     244            continue
     245        }
     246        puts stderr "render server is $data"
     247        # We're connected. Cancel any pending serverDown events and
     248        # release the busy window over the hull.
     249        $_dispatcher cancel !serverDown
     250        if { $_idleTimeout > 0 } {
     251            $_dispatcher event -after $_idleTimeout !timeout
     252        }
     253        blt::busy release $itk_component(hull)
     254        fconfigure $_sid -buffering line
     255        fileevent $_sid readable [itcl::code $this ReceiveHelper]
     256        return 1
    257257    }
    258258    blt::busy release $itk_component(hull)
     
    284284itcl::body Rappture::VisViewer::IsConnected {} {
    285285    if { $_sid == "" } {
    286         return 0
     286        return 0
    287287    }
    288288    if { [eof $_sid] } {
    289         set _sid ""
    290         return 0
     289        set _sid ""
     290        return 0
    291291    }
    292292    return 1
     
    304304    $_dispatcher cancel !timeout
    305305    if { $_idleTimeout > 0 } {
    306         $_dispatcher event -after $_idleTimeout !timeout
     306        $_dispatcher event -after $_idleTimeout !timeout
    307307    }
    308308    if { [IsConnected] } {
    309         return 1
     309        return 1
    310310    }
    311311    if { $_sid != "" } {
    312         fileevent $_sid writable ""
     312        fileevent $_sid writable ""
    313313    }
    314314    # If we aren't connected, assume it's because the connection to the
     
    355355    puts -nonewline $_sid $_buffer(out)
    356356    flush $_sid
    357     set _done($this) 1;                 # Success
     357    set _done($this) 1;                 # Success
    358358}
    359359
     
    569569    set _afterId -1
    570570    if { $state } {
    571         if { [winfo exists $itk_component(plotarea).view.splash] } {
    572             return
    573         }
    574         set inner [frame $itk_component(plotarea).view.splash]
    575         $inner configure -relief raised -bd 2
    576         label $inner.text1 -text "Rendering, please wait." \
    577             -font "Arial 10"
    578         label $inner.icon
    579         pack $inner -expand yes -anchor c
    580         blt::table $inner \
    581             0,0 $inner.text1 -anchor w \
    582             0,1 $inner.icon
    583         Waiting start $inner.icon
     571        if { [winfo exists $itk_component(plotarea).view.splash] } {
     572            return
     573        }
     574        set inner [frame $itk_component(plotarea).view.splash]
     575        $inner configure -relief raised -bd 2
     576        label $inner.text1 -text "Rendering, please wait." \
     577            -font "Arial 10"
     578        label $inner.icon
     579        pack $inner -expand yes -anchor c
     580        blt::table $inner \
     581            0,0 $inner.text1 -anchor w \
     582            0,1 $inner.icon
     583        Waiting start $inner.icon
    584584    } else {
    585         if { ![winfo exists $itk_component(plotarea).view.splash] } {
    586             return
    587         }
    588         Waiting stop $itk_component(plotarea).view.splash
    589         destroy $itk_component(plotarea).view.splash
     585        if { ![winfo exists $itk_component(plotarea).view.splash] } {
     586            return
     587        }
     588        Waiting stop $itk_component(plotarea).view.splash
     589        destroy $itk_component(plotarea).view.splash
    590590    }
    591591}
  • branches/blt4/gui/scripts/vtkcontourviewer.tcl

    r2742 r2745  
    168168
    169169    array set _outline {
    170         id -1
    171         afterId -1
    172         x1 -1
    173         y1 -1
    174         x2 -1
    175         y2 -1
     170        id -1
     171        afterId -1
     172        x1 -1
     173        y1 -1
     174        x2 -1
     175        y2 -1
    176176    }
    177177
    178178    # Initialize the view to some default parameters.
    179179    array set _view {
    180         qx              0
    181         qy              0
    182         qz              0
    183         qw              1
    184         zoom            1.0
    185         pan-x           0
    186         pan-y           0
     180        qx              0
     181        qy              0
     182        qz              0
     183        qw              1
     184        zoom            1.0
     185        pan-x           0
     186        pan-y           0
    187187        ortho-x         0.0
    188188        ortho-y         0.0
    189         ortho-w         -1.0
    190         ortho-h         -1.0
     189        ortho-w         -1.0
     190        ortho-h         -1.0
    191191    }
    192192    set _arcball [blt::arcball create 100 100]
     
    198198
    199199    array set _settings [subst {
    200         $this-axes              1
    201         $this-edges             0
    202         $this-lighting          1
    203         $this-opacity           100
    204         $this-volume            1
    205         $this-isolines          1
    206         $this-wireframe         0
    207         $this-legend            1
    208         $this-colormap          1
     200        $this-axes              1
     201        $this-edges             0
     202        $this-lighting          1
     203        $this-opacity           100
     204        $this-volume            1
     205        $this-isolines          1
     206        $this-wireframe         0
     207        $this-legend            1
     208        $this-colormap          1
    209209    }]
    210210
     
    374374itcl::body Rappture::VtkContourViewer::DoResize {} {
    375375    if { $_width < 2 } {
    376         set _width 500
     376        set _width 500
    377377    }
    378378    if { $_height < 2 } {
    379         set _height 500
     379        set _height 500
    380380    }
    381381    SendCmd "screen size $_width $_height"
    382382    if { $_settings($this-legend) } {
    383         EventuallyResizeLegend
     383        EventuallyResizeLegend
    384384    }
    385385    set _resizePending 0
     
    419419        -description ""
    420420        -param ""
    421         -type ""
     421        -type ""
    422422    }
    423423    foreach {opt val} $settings {
     
    589589            set word [Rappture::filexfer::label downloadWord]
    590590            $inner.summary configure -text "$word $num in the following format:"
    591             update idletasks            ;# Fix initial sizes
     591            update idletasks            ;# Fix initial sizes
    592592            return $popup
    593593        }
     
    731731    if {$w > 0 && $h > 0 && $_first != "" } {
    732732        set tag [lindex [CurrentDatasets] 0]
    733         puts stderr "tag=$tag [info exists _dataset2style($tag)]"
     733        puts stderr "tag=$tag [info exists _dataset2style($tag)]"
    734734        if { [info exists _dataset2style($tag)] } {
    735735            SendCmd "legend $_dataset2style($tag) scalar {} $w $h 0"
     
    743743# DrawLegend --
    744744#
    745 #       Draws the legend in it's own canvas which resides to the right
    746 #       of the contour plot area.
     745#       Draws the legend in it's own canvas which resides to the right
     746#       of the contour plot area.
    747747#
    748748itcl::body Rappture::VtkContourViewer::DrawLegend {} {
     
    754754   
    755755    if { $_settings($this-legend) } {
    756         if { [$c find withtag "legend"] == "" } {
    757             $c create image [expr {$w-2}] [expr {$lineht+2}] -anchor ne \
    758                 -image $_image(legend) -tags "transfunc legend"
    759             $c create text [expr {$w-2}] 2 -anchor ne \
    760                 -fill $itk_option(-plotforeground) -tags "vmax legend" \
    761                 -font "Arial 6"
    762             $c create text [expr {$w-2}] [expr {$h-2}] -anchor se \
    763                 -fill $itk_option(-plotforeground) -tags "vmin legend" \
    764                 -font "Arial 6"
    765         }
    766         # Reset the item coordinates according the current size of the plot.
    767         $c coords transfunc [expr {$w-2}] [expr {$lineht+2}]
    768         if { $_limits(vmin) != "" } {
    769             $c itemconfigure vmin -text [format %g $_limits(vmin)]
    770         }
    771         if { $_limits(vmax) != "" } {
    772             $c itemconfigure vmax -text [format %g $_limits(vmax)]
    773         }
    774         $c coords vmin [expr {$w-2}] [expr {$h-2}]
    775         $c coords vmax [expr {$w-2}] 2
     756        if { [$c find withtag "legend"] == "" } {
     757            $c create image [expr {$w-2}] [expr {$lineht+2}] -anchor ne \
     758                -image $_image(legend) -tags "transfunc legend"
     759            $c create text [expr {$w-2}] 2 -anchor ne \
     760                -fill $itk_option(-plotforeground) -tags "vmax legend" \
     761                -font "Arial 6"
     762            $c create text [expr {$w-2}] [expr {$h-2}] -anchor se \
     763                -fill $itk_option(-plotforeground) -tags "vmin legend" \
     764                -font "Arial 6"
     765        }
     766        # Reset the item coordinates according the current size of the plot.
     767        $c coords transfunc [expr {$w-2}] [expr {$lineht+2}]
     768        if { $_limits(vmin) != "" } {
     769            $c itemconfigure vmin -text [format %g $_limits(vmin)]
     770        }
     771        if { $_limits(vmax) != "" } {
     772            $c itemconfigure vmax -text [format %g $_limits(vmax)]
     773        }
     774        $c coords vmin [expr {$w-2}] [expr {$h-2}]
     775        $c coords vmax [expr {$w-2}] 2
    776776    }
    777777}
     
    793793        $_image(legend) configure -data $bytes
    794794        puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    795         DrawLegend
     795        DrawLegend
    796796    }
    797797}
     
    806806    set option [lindex $args 0]
    807807    switch -- $option {
    808         "scalar" {
    809             set option [lindex $args 1]
    810             switch -- $option {
    811                 "world" {
    812                     foreach { x y z value tag } [lrange $args 2 end] break
    813                     puts stderr "world x=$x y=$y z=$z value=$value tag=$tag"
    814                 }
    815                 "pixel" {
    816                     foreach { x y value tag } [lrange $args 2 end] break
    817                     puts stderr "pixel x=$x y=$y value=$value tag=$tag"
    818                 }
    819             }
    820         }
    821         "vector" {
    822             set option [lindex $args 1]
    823             switch -- $option {
    824                 "world" {
    825                     foreach { x y z vx vy vz tag } [lrange $args 2 end] break
     808        "scalar" {
     809            set option [lindex $args 1]
     810            switch -- $option {
     811                "world" {
     812                    foreach { x y z value tag } [lrange $args 2 end] break
     813                    puts stderr "world x=$x y=$y z=$z value=$value tag=$tag"
     814                }
     815                "pixel" {
     816                    foreach { x y value tag } [lrange $args 2 end] break
     817                    puts stderr "pixel x=$x y=$y value=$value tag=$tag"
     818                }
     819            }
     820        }
     821        "vector" {
     822            set option [lindex $args 1]
     823            switch -- $option {
     824                "world" {
     825                    foreach { x y z vx vy vz tag } [lrange $args 2 end] break
    826826                    puts stderr "world x=$x y=$y z=$z value=$vx $xy $vz tag=$tag"
    827                 }
    828                 "pixel" {
    829                     foreach { x y vx vy vz tag } [lrange $args 2 end] break
     827                }
     828                "pixel" {
     829                    foreach { x y vx vy vz tag } [lrange $args 2 end] break
    830830                    puts stderr "pixel x=$x y=$y value=$vx $xy $vz tag=$tag"
    831                 }
    832             }
    833         }
    834         "names" {
     831                }
     832            }
     833        }
     834        "names" {
    835835            foreach { name } [lindex $args 1] {
    836836                puts stderr "Dataset: $name"
    837837            }
    838         }
    839         default {
    840             error "unknown dataset option \"$option\" from server"
    841         }
     838        }
     839        default {
     840            error "unknown dataset option \"$option\" from server"
     841        }
    842842    }
    843843}
     
    875875                append _outbuf "dataset add $tag data follows $length\n"
    876876                append _outbuf $bytes
    877                 append _outbuf "heightmap add numcontours [expr {$style(-levels)+1}] 0 $tag\n"
    878                 SetStyles $dataobj $comp
     877                append _outbuf "heightmap add numcontours [expr {$style(-levels)+1}] 0 $tag\n"
     878                SetStyles $dataobj $comp
    879879                set _datasets($tag) 1
    880                 foreach {min max} [$dataobj limits v] break
    881                 if { ($_limits(vmin) == "") || ($min < $_limits(vmin)) } {
    882                     set _limits(vmin) $min
    883                 }
    884                 if { ($_limits(vmax) == "") || ($max < $_limits(vmax)) } {
    885                     set _limits(vmax) $max
    886                 }
    887             }
     880                foreach {min max} [$dataobj limits v] break
     881                if { ($_limits(vmin) == "") || ($min < $_limits(vmin)) } {
     882                    set _limits(vmin) $min
     883                }
     884                if { ($_limits(vmax) == "") || ($max < $_limits(vmax)) } {
     885                    set _limits(vmax) $max
     886                }
     887            }
    888888        }
    889889    }
     
    913913    # Nothing to send -- activate the proper ivol
    914914    foreach tag [CurrentDatasets] {
    915         SendCmd "dataset visible 0 $tag"
     915        SendCmd "dataset visible 0 $tag"
    916916    }
    917917    set _first [lindex [get] 0]
     
    954954        set tag $_first-$comp
    955955        if { [info exists _datasets($tag)] && $_datasets($tag) } {
    956             lappend rlist $tag
     956            lappend rlist $tag
    957957        }
    958958    }
     
    972972        "in" {
    973973            set _view(zoom) [expr {$_view(zoom)*1.25}]
    974             SendCmd "camera zoom $_view(zoom)"
     974            SendCmd "camera zoom $_view(zoom)"
    975975        }
    976976        "out" {
    977977            set _view(zoom) [expr {$_view(zoom)*0.8}]
    978             SendCmd "camera zoom $_view(zoom)"
     978            SendCmd "camera zoom $_view(zoom)"
    979979        }
    980980        "reset" {
    981981            array set _view {
    982                 qx      0
     982                qx      0
    983983                qy      0
    984984                qz      0
     
    996996            }
    997997            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    998             $_arcball quaternion $q
     998            $_arcball quaternion $q
    999999        }
    10001000    }
     
    10411041                }
    10421042                set q [$_arcball rotate $x $y $_click(x) $_click(y)]
    1043                 foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     1043                foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
    10441044                SendCmd "camera orient $q"
    10451045                set _click(x) $x
     
    10741074itcl::body Rappture::VtkContourViewer::Pan {option x y} {
    10751075    switch -- $option {
    1076         "set" {
    1077             set w [winfo width $itk_component(view)]
    1078             set h [winfo height $itk_component(view)]
    1079             set x [expr $x / double($w)]
    1080             set y [expr $y / double($h)]
    1081             set _view(pan-x) [expr $_view(pan-x) + $x]
    1082             set _view(pan-y) [expr $_view(pan-y) + $y]
    1083             PanCamera
    1084             return
    1085         }
    1086         "click" {
    1087             set _click(x) $x
    1088             set _click(y) $y
    1089             $itk_component(view) configure -cursor hand1
    1090         }
    1091         "drag" {
    1092             set w [winfo width $itk_component(view)]
    1093             set h [winfo height $itk_component(view)]
    1094             set dx [expr ($_click(x) - $x)/double($w)]
    1095             set dy [expr ($_click(y) - $y)/double($h)]
    1096             set _click(x) $x
    1097             set _click(y) $y
    1098             set _view(pan-x) [expr $_view(pan-x) - $dx]
    1099             set _view(pan-y) [expr $_view(pan-y) - $dy]
    1100             PanCamera
    1101         }
    1102         "release" {
    1103             Pan drag $x $y
    1104             $itk_component(view) configure -cursor ""
    1105         }
    1106         default {
    1107             error "unknown option \"$option\": should set, click, drag, or release"
    1108         }
     1076        "set" {
     1077            set w [winfo width $itk_component(view)]
     1078            set h [winfo height $itk_component(view)]
     1079            set x [expr $x / double($w)]
     1080            set y [expr $y / double($h)]
     1081            set _view(pan-x) [expr $_view(pan-x) + $x]
     1082            set _view(pan-y) [expr $_view(pan-y) + $y]
     1083            PanCamera
     1084            return
     1085        }
     1086        "click" {
     1087            set _click(x) $x
     1088            set _click(y) $y
     1089            $itk_component(view) configure -cursor hand1
     1090        }
     1091        "drag" {
     1092            set w [winfo width $itk_component(view)]
     1093            set h [winfo height $itk_component(view)]
     1094            set dx [expr ($_click(x) - $x)/double($w)]
     1095            set dy [expr ($_click(y) - $y)/double($h)]
     1096            set _click(x) $x
     1097            set _click(y) $y
     1098            set _view(pan-x) [expr $_view(pan-x) - $dx]
     1099            set _view(pan-y) [expr $_view(pan-y) - $dy]
     1100            PanCamera
     1101        }
     1102        "release" {
     1103            Pan drag $x $y
     1104            $itk_component(view) configure -cursor ""
     1105        }
     1106        default {
     1107            error "unknown option \"$option\": should set, click, drag, or release"
     1108        }
    11091109    }
    11101110}
     
    11231123                set val $_settings($this-opacity)
    11241124                set sval [expr { 0.01 * double($val) }]
    1125                 foreach dataset [CurrentDatasets] {
    1126                     SendCmd "heightmap opacity $sval $dataset"
    1127                 }
     1125                foreach dataset [CurrentDatasets] {
     1126                    SendCmd "heightmap opacity $sval $dataset"
     1127                }
    11281128            }
    11291129        }
    11301130        "wireframe" {
    11311131            if {[isconnected]} {
    1132                 set bool $_settings($this-wireframe)
    1133                 foreach dataset [CurrentDatasets] {
    1134                     SendCmd "heightmap wireframe $bool $dataset"
    1135                 }
     1132                set bool $_settings($this-wireframe)
     1133                foreach dataset [CurrentDatasets] {
     1134                    SendCmd "heightmap wireframe $bool $dataset"
     1135                }
    11361136            }
    11371137        }
    11381138        "colormap" {
    11391139            if {[isconnected]} {
    1140                 set bool $_settings($this-colormap)
    1141                 foreach dataset [CurrentDatasets] {
    1142                     SendCmd "heightmap surface $bool $dataset"
    1143                 }
     1140                set bool $_settings($this-colormap)
     1141                foreach dataset [CurrentDatasets] {
     1142                    SendCmd "heightmap surface $bool $dataset"
     1143                }
    11441144            }
    11451145        }
    11461146        "isolines" {
    11471147            if {[isconnected]} {
    1148                 set bool $_settings($this-isolines)
    1149                 foreach dataset [CurrentDatasets] {
    1150                     SendCmd "heightmap isolines $bool $dataset"
    1151                 }
     1148                set bool $_settings($this-isolines)
     1149                foreach dataset [CurrentDatasets] {
     1150                    SendCmd "heightmap isolines $bool $dataset"
     1151                }
    11521152            }
    11531153        }
    11541154        "edges" {
    11551155            if {[isconnected]} {
    1156                 set bool $_settings($this-edges)
    1157                 foreach dataset [CurrentDatasets] {
    1158                     SendCmd "heightmap edges $bool $dataset"
    1159                 }
     1156                set bool $_settings($this-edges)
     1157                foreach dataset [CurrentDatasets] {
     1158                    SendCmd "heightmap edges $bool $dataset"
     1159                }
    11601160            }
    11611161        }
    11621162        "lighting" {
    11631163            if {[isconnected]} {
    1164                 set bool $_settings($this-lighting)
    1165                 foreach dataset [CurrentDatasets] {
    1166                     SendCmd "heightmap lighting $bool $dataset"
    1167                 }
     1164                set bool $_settings($this-lighting)
     1165                foreach dataset [CurrentDatasets] {
     1166                    SendCmd "heightmap lighting $bool $dataset"
     1167                }
    11681168            }
    11691169        }
    11701170        "axes" {
    11711171            if { [isconnected] } {
    1172                 set bool $_settings($this-axes)
     1172                set bool $_settings($this-axes)
    11731173                SendCmd "axis visible all $bool"
    11741174            }
     
    12041204    set colormap "$style(-color):$style(-levels):$style(-opacity)"
    12051205    if { [info exists _colormaps($colormap)] } {
    1206         puts stderr "Colormap $colormap already built"
     1206        puts stderr "Colormap $colormap already built"
    12071207    }
    12081208    if { ![info exists _dataset2style($tag)] } {
    1209         set _dataset2style($tag) $colormap
    1210         lappend _style2datasets($colormap) $tag
     1209        set _dataset2style($tag) $colormap
     1210        lappend _style2datasets($colormap) $tag
    12111211    }
    12121212    if { ![info exists _colormaps($colormap)] } {
    1213         # Build the pseudo colormap if it doesn't exist.
    1214         BuildColormap $colormap $dataobj $comp
    1215         set _colormaps($colormap) 1
     1213        # Build the pseudo colormap if it doesn't exist.
     1214        BuildColormap $colormap $dataobj $comp
     1215        set _colormaps($colormap) 1
    12161216    }
    12171217    #SendCmd "heightmap numcontours $style(-levels) $tag\n"
     
    12431243    }
    12441244    if { [llength $cmap] == 0 } {
    1245         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     1245        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    12461246    }
    12471247    set tag $this-$colormap
     
    14291429                "qx" - "qy" - "qz" - "qw" {
    14301430                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1431                     $_arcball quaternion $q
     1431                    $_arcball quaternion $q
    14321432                    #SendCmd "camera orient $q"
    14331433                }
     
    15241524# MarchingAnts --
    15251525#
    1526 #       Called from "after" timer events.  This routine is changes
    1527 #       the dash offset of the selection outline rectangle to simulate
    1528 #       marching ants.
     1526#       Called from "after" timer events.  This routine is changes
     1527#       the dash offset of the selection outline rectangle to simulate
     1528#       marching ants.
    15291529#
    15301530itcl::body Rappture::VtkContourViewer::MarchingAnts {} {
    15311531    set c $itk_component(view)
    15321532    if { [winfo exists $c] && ![winfo viewable $c] } {
    1533         KillSelectionRectangle
    1534         return
     1533        KillSelectionRectangle
     1534        return
    15351535    }
    15361536    $c itemconfigure $_outline(id) -dashoffset $_outline(offset)
     
    15421542# BeginSelectionRectangle --
    15431543#
    1544 #       Called from ButtonPress-1 events.  This routine creates the
    1545 #       the selection outline rectangle.  It also clears the selection
    1546 #       in the sensor tree.
     1544#       Called from ButtonPress-1 events.  This routine creates the
     1545#       the selection outline rectangle.  It also clears the selection
     1546#       in the sensor tree.
    15471547#
    15481548itcl::body Rappture::VtkContourViewer::BeginSelectionRectangle { x y } {
     
    15511551    set y [$c canvasy $y]
    15521552    if { $_outline(id) >= 0 } {
    1553         after cancel $_outline(afterId)
    1554         set _outline(afterId) -1
    1555         $c delete $_outline(id)
    1556         set _outline(id) -1
     1553        after cancel $_outline(afterId)
     1554        set _outline(afterId) -1
     1555        $c delete $_outline(id)
     1556        set _outline(id) -1
    15571557    }
    15581558    set _outline(offset) 0
     
    15601560    set _outline(y1) $y
    15611561    set _outline(id) \
    1562         [$c create line $x $y $x $y -dash "4 4" -width 2 -fill black]
     1562        [$c create line $x $y $x $y -dash "4 4" -width 2 -fill black]
    15631563    MarchingAnts
    15641564}
     
    15671567# AdjustSelectionRectangle --
    15681568#
    1569 #       Called from B1-Motion events.  This routine redraws the selection
    1570 #       outline rectangle and redraws the sensors using the "selected"
    1571 #       icon.
     1569#       Called from B1-Motion events.  This routine redraws the selection
     1570#       outline rectangle and redraws the sensors using the "selected"
     1571#       icon.
    15721572#
    15731573itcl::body Rappture::VtkContourViewer::AdjustSelectionRectangle { x y } {
     
    15761576    set y [$c canvasy $y]
    15771577    $c coords $_outline(id) $_outline(x1) $_outline(y1) $_outline(x1) $y \
    1578         $x $y $x $_outline(y1) $_outline(x1) $_outline(y1)
     1578        $x $y $x $_outline(y1) $_outline(x1) $_outline(y1)
    15791579    set _outline(x2) $x
    15801580    set _outline(y2) $y
     
    15841584# KillSelectionRectangle --
    15851585#
    1586 #       Removes the outline rectangle and adjusts the sensor icon
    1587 #       according to the sensor's selected/deselected status.
     1586#       Removes the outline rectangle and adjusts the sensor icon
     1587#       according to the sensor's selected/deselected status.
    15881588#
    15891589itcl::body Rappture::VtkContourViewer::KillSelectionRectangle { } {
     
    15981598# EndSelectionRectangle --
    15991599#
    1600 #       Called from the ButtonRelease event to finish the outline of the
    1601 #       selection rectangle.  If the outline is too small (less than 10
    1602 #       pixels in length or width) the outline is removed and the selection
    1603 #       is ignored.  Otherwise a popup menu is automatically generated and
    1604 #       displayed.
     1600#       Called from the ButtonRelease event to finish the outline of the
     1601#       selection rectangle.  If the outline is too small (less than 10
     1602#       pixels in length or width) the outline is removed and the selection
     1603#       is ignored.  Otherwise a popup menu is automatically generated and
     1604#       displayed.
    16051605#
    16061606itcl::body Rappture::VtkContourViewer::EndSelectionRectangle { x y } {
     
    16121612    set ch [winfo height $c]
    16131613    if { abs($_outline(x1) - $cx) < 10 && abs($_outline(y1) - $cy) < 10 }  {
    1614         KillSelectionRectangle
     1614        KillSelectionRectangle
    16151615    } else {
    16161616        # Need x,y coordinates to be in the bottom left for camera ortho
     
    16291629            set h [expr int($_outline(y1) - $_outline(y2))]
    16301630        }
    1631         SendCmd "camera ortho pixel $ox $oy $w $h"
    1632         KillSelectionRectangle
     1631        SendCmd "camera ortho pixel $ox $oy $w $h"
     1632        KillSelectionRectangle
    16331633    }
    16341634}
     
    16391639        foreach comp [$dataobj components] {
    16401640            set tag $dataobj-$comp
    1641             set contents [ConvertToVtkData $dataobj $comp]
    1642             append bytes "$contents\n\n"
     1641            set contents [ConvertToVtkData $dataobj $comp]
     1642            append bytes "$contents\n\n"
    16431643        }
    16441644    }
     
    16481648itcl::body Rappture::VtkContourViewer::GetImage { args } {
    16491649    if { [image width $_image(download)] > 0 &&
    1650         [image height $_image(download)] > 0 } {
    1651         set bytes [$_image(download) data -format "jpeg -quality 100"]
    1652         set bytes [Rappture::encoding::decode -as b64 $bytes]
    1653         return [list .jpg $bytes]
     1650        [image height $_image(download)] > 0 } {
     1651        set bytes [$_image(download) data -format "jpeg -quality 100"]
     1652        set bytes [Rappture::encoding::decode -as b64 $bytes]
     1653        return [list .jpg $bytes]
    16541654    }
    16551655    return ""
     
    16731673
    16741674    button $inner.ok -text "Save" \
    1675         -highlightthickness 0 -pady 2 -padx 3 \
     1675        -highlightthickness 0 -pady 2 -padx 3 \
    16761676        -command $command \
    1677         -compound left \
    1678         -image [Rappture::icon download]
     1677        -compound left \
     1678        -image [Rappture::icon download]
    16791679
    16801680    button $inner.cancel -text "Cancel" \
    1681         -highlightthickness 0 -pady 2 -padx 3 \
    1682         -command [list $popup deactivate] \
    1683         -compound left \
    1684         -image [Rappture::icon cancel]
     1681        -highlightthickness 0 -pady 2 -padx 3 \
     1682        -command [list $popup deactivate] \
     1683        -compound left \
     1684        -image [Rappture::icon cancel]
    16851685
    16861686    blt::table $inner \
  • branches/blt4/gui/scripts/vtkstreamlinesviewer.tcl

    r2742 r2745  
    114114
    115115    private variable _arcball ""
    116     private variable _outbuf       ;    # buffer for outgoing commands
    117 
    118     private variable _dlist ""     ;    # list of data objects
     116    private variable _outbuf       ;    # buffer for outgoing commands
     117
     118    private variable _dlist ""     ;    # list of data objects
    119119    private variable _obj2datasets
    120     private variable _obj2ovride   ;    # maps dataobj => style override
    121     private variable _datasets     ;    # contains all the dataobj-component
    122                                    ;    # datasets in the server
    123     private variable _colormaps    ;    # contains all the colormaps
    124                                    ;    # in the server.
     120    private variable _obj2ovride   ;    # maps dataobj => style override
     121    private variable _datasets     ;    # contains all the dataobj-component
     122                                   ;    # datasets in the server
     123    private variable _colormaps    ;    # contains all the colormaps
     124                                   ;    # in the server.
    125125    private variable _dataset2style    ;# maps dataobj-component to transfunc
    126126
    127     private variable _click        ;    # info used for rotate operations
    128     private variable _limits       ;    # autoscale min/max for all axes
    129     private variable _view         ;    # view params for 3D view
     127    private variable _click        ;    # info used for rotate operations
     128    private variable _limits       ;    # autoscale min/max for all axes
     129    private variable _view         ;    # view params for 3D view
    130130    private variable _settings
    131     private variable _style;            # Array of current component styles.
    132     private variable _initialStyle;     # Array of initial component styles.
    133     private variable _reset 1;          # indicates if camera needs to be reset
    134                                         # to starting position.
    135 
    136     private variable _first ""     ;    # This is the topmost dataset.
     131    private variable _style;            # Array of current component styles.
     132    private variable _initialStyle;     # Array of initial component styles.
     133    private variable _reset 1;          # indicates if camera needs to be reset
     134                                        # to starting position.
     135
     136    private variable _first ""     ;    # This is the topmost dataset.
    137137    private variable _start 0
    138138    private variable _buffering 0
     
    140140    private variable _seeds
    141141
    142     common _downloadPopup;              # download options from popup
     142    common _downloadPopup;              # download options from popup
    143143    private common _hardcopy
    144144    private variable _width 0
     
    154154    private variable _fields
    155155    private variable _currentField ""
    156     private variable _field      ""
     156    private variable _field      ""
    157157    private variable _numSeeds 200
    158158    private variable _colorMode "vmag";#  Mode of colormap (vmag or scalar)
     
    194194    $_dispatcher register !xcutplane
    195195    $_dispatcher dispatch $this !xcutplane \
    196         "[itcl::code $this AdjustSetting cutplane-xposition]; list"
     196        "[itcl::code $this AdjustSetting cutplane-xposition]; list"
    197197
    198198    # Y-Cutplane event
    199199    $_dispatcher register !ycutplane
    200200    $_dispatcher dispatch $this !ycutplane \
    201         "[itcl::code $this AdjustSetting cutplane-yposition]; list"
     201        "[itcl::code $this AdjustSetting cutplane-yposition]; list"
    202202
    203203    # Z-Cutplane event
    204204    $_dispatcher register !zcutplane
    205205    $_dispatcher dispatch $this !zcutplane \
    206         "[itcl::code $this AdjustSetting cutplane-zposition]; list"
     206        "[itcl::code $this AdjustSetting cutplane-zposition]; list"
    207207
    208208    #
     
    214214
    215215    array set _outline {
    216         id -1
    217         afterId -1
    218         x1 -1
    219         y1 -1
    220         x2 -1
    221         y2 -1
     216        id -1
     217        afterId -1
     218        x1 -1
     219        y1 -1
     220        x2 -1
     221        y2 -1
    222222    }
    223223    # Initialize the view to some default parameters.
    224224    array set _view {
    225         qw              1
    226         qx              0
    227         qy              0
    228         qz              0
    229         zoom            1.0
    230         xpan            0
    231         ypan            0
    232         ortho           0
     225        qw              1
     226        qx              0
     227        qy              0
     228        qz              0
     229        zoom            1.0
     230        xpan            0
     231        ypan            0
     232        ortho           0
    233233    }
    234234    set _arcball [blt::arcball create 100 100]
     
    240240
    241241    array set _settings [subst {
    242         axis-xgrid              0
    243         axis-ygrid              0
    244         axis-zgrid              0
    245         axis-xcutplane          0
    246         axis-ycutplane          0
    247         axis-zcutplane          0
    248         axis-xposition          0
    249         axis-yposition          0
    250         axis-zposition          0
    251         axis-visible            1
    252         axis-labels             1
    253         cutplane-edges          0
    254         cutplane-xvisible       0
    255         cutplane-yvisible       0
    256         cutplane-zvisible       0
    257         cutplane-xposition      50
    258         cutplane-yposition      50
    259         cutplane-zposition      50
    260         cutplane-visible        1
    261         cutplane-wireframe      0
    262         cutplane-opacity        100
    263         volume-edges            0
    264         volume-lighting         1
    265         volume-opacity          40
    266         volume-visible          1
    267         volume-wireframe        0
    268         streamlines-seeds       0
    269         streamlines-visible     1
    270         streamlines-opacity     100
    271         streamlines-numpoints   200
    272         streamlines-lighting    1
    273         streamlines-scale       1
    274         legend-visible          1
     242        axis-xgrid              0
     243        axis-ygrid              0
     244        axis-zgrid              0
     245        axis-xcutplane          0
     246        axis-ycutplane          0
     247        axis-zcutplane          0
     248        axis-xposition          0
     249        axis-yposition          0
     250        axis-zposition          0
     251        axis-visible            1
     252        axis-labels             1
     253        cutplane-edges          0
     254        cutplane-xvisible       0
     255        cutplane-yvisible       0
     256        cutplane-zvisible       0
     257        cutplane-xposition      50
     258        cutplane-yposition      50
     259        cutplane-zposition      50
     260        cutplane-visible        1
     261        cutplane-wireframe      0
     262        cutplane-opacity        100
     263        volume-edges            0
     264        volume-lighting         1
     265        volume-opacity          40
     266        volume-visible          1
     267        volume-wireframe        0
     268        streamlines-seeds       0
     269        streamlines-visible     1
     270        streamlines-opacity     100
     271        streamlines-numpoints   200
     272        streamlines-lighting    1
     273        streamlines-scale       1
     274        legend-visible          1
    275275    }]
    276276
     
    285285    itk_component add fieldmenu {
    286286        menu $itk_component(plotarea).menu -bg black -fg white -relief flat \
    287             -tearoff no
     287            -tearoff no
    288288    } {
    289         usual
    290         ignore -background -foreground -relief -tearoff
     289        usual
     290        ignore -background -foreground -relief -tearoff
    291291    }
    292292    set c $itk_component(view)
     
    350350            -onimage [Rappture::icon volume-on] \
    351351            -offimage [Rappture::icon volume-off] \
    352             -variable [itcl::scope _settings(volume-visible)] \
    353             -command [itcl::code $this AdjustSetting volume-visible]
     352            -variable [itcl::scope _settings(volume-visible)] \
     353            -command [itcl::code $this AdjustSetting volume-visible]
    354354    }
    355355    $itk_component(volume) select
     
    362362            -onimage [Rappture::icon streamlines-on] \
    363363            -offimage [Rappture::icon streamlines-off] \
    364             -variable [itcl::scope _settings(streamlines-visible)] \
    365             -command [itcl::code $this AdjustSetting streamlines-visible] \
     364            -variable [itcl::scope _settings(streamlines-visible)] \
     365            -command [itcl::code $this AdjustSetting streamlines-visible] \
    366366    }
    367367    $itk_component(streamlines) select
     
    374374            -onimage [Rappture::icon cutbutton] \
    375375            -offimage [Rappture::icon cutbutton] \
    376             -variable [itcl::scope _settings(cutplane-visible)] \
    377             -command [itcl::code $this AdjustSetting cutplane-visible]
     376            -variable [itcl::scope _settings(cutplane-visible)] \
     377            -command [itcl::code $this AdjustSetting cutplane-visible]
    378378    }
    379379    $itk_component(cutplane) select
     
    384384
    385385    if { [catch {
    386         BuildVolumeTab
    387         BuildStreamsTab
    388         BuildCutplaneTab
    389         BuildAxisTab
    390         BuildCameraTab
     386        BuildVolumeTab
     387        BuildStreamsTab
     388        BuildCutplaneTab
     389        BuildAxisTab
     390        BuildCameraTab
    391391    } errs] != 0 } {
    392         puts stderr errs=$errs
     392        puts stderr errs=$errs
    393393    }
    394394    # Legend
     
    488488itcl::body Rappture::VtkStreamlinesViewer::DoResize {} {
    489489    if { $_width < 2 } {
    490         set _width 500
     490        set _width 500
    491491    }
    492492    if { $_height < 2 } {
    493         set _height 500
     493        set _height 500
    494494    }
    495495    set _start [clock clicks -milliseconds]
     
    513513itcl::body Rappture::VtkStreamlinesViewer::DoReseed {} {
    514514    foreach dataset [CurrentDatasets -visible] {
    515         foreach {dataobj comp} [split $dataset -] break
    516         # This command works for either random or fmesh seeds
    517         SendCmd "streamlines seed numpts $_numSeeds $dataset"
     515        foreach {dataobj comp} [split $dataset -] break
     516        # This command works for either random or fmesh seeds
     517        SendCmd "streamlines seed numpts $_numSeeds $dataset"
    518518    }
    519519    set _reseedPending 0
     
    544544    if { !$_rotatePending } {
    545545        set _rotatePending 1
    546         global rotate_delay
     546        global rotate_delay
    547547        $_dispatcher event -after $rotate_delay !rotate
    548548    }
     
    572572        -description ""
    573573        -param ""
    574         -type ""
     574        -type ""
    575575    }
    576576    array set params $settings
     
    589589    set pos [lsearch -exact $dataobj $_dlist]
    590590    if {$pos < 0} {
    591         lappend _dlist $dataobj
     591        lappend _dlist $dataobj
    592592    }
    593593    set _obj2ovride($dataobj-color) $params(-color)
     
    614614    foreach dataobj $args {
    615615        set pos [lsearch -exact $_dlist $dataobj]
    616         if { $pos < 0 } {
    617             continue;                   # Don't know anything about it.
    618         }
    619         # Remove it from the dataobj list.
    620         set _dlist [lreplace $_dlist $pos $pos]
    621         SendCmd "dataset visible 0"
    622         array unset _obj2ovride $dataobj-*
    623         array unset _settings $dataobj-*
    624         # Append to the end of the dataobj list.
    625         lappend _dlist $dataobj
    626         set changed 1
     616        if { $pos < 0 } {
     617            continue;                   # Don't know anything about it.
     618        }
     619        # Remove it from the dataobj list.
     620        set _dlist [lreplace $_dlist $pos $pos]
     621        SendCmd "dataset visible 0"
     622        array unset _obj2ovride $dataobj-*
     623        array unset _settings $dataobj-*
     624        # Append to the end of the dataobj list.
     625        lappend _dlist $dataobj
     626        set changed 1
    627627    }
    628628    # If anything changed, then rebuild the plot
     
    648648    set op [lindex $args 0]
    649649    switch -- $op {
    650         "-objects" {
    651             # put the dataobj list in order according to -raise options
    652             set dlist {}
    653             foreach dataobj $_dlist {
    654                 if { ![IsValidObject $dataobj] } {
    655                     continue
    656                 }
    657                 if {[info exists _obj2ovride($dataobj-raise)] &&
    658                     $_obj2ovride($dataobj-raise)} {
    659                     set dlist [linsert $dlist 0 $dataobj]
    660                 } else {
    661                     lappend dlist $dataobj
    662                 }
    663             }
    664             return $dlist
    665         }
    666         "-visible" {
    667             set dlist {}
    668             foreach dataobj $_dlist {
    669                 if { ![IsValidObject $dataobj] } {
    670                     continue
    671                 }
    672                 if { ![info exists _obj2ovride($dataobj-raise)] } {
    673                     # No setting indicates that the object isn't visible.
    674                     continue
    675                 }
    676                 # Otherwise use the -raise parameter to put the object to
    677                 # the front of the list.
    678                 if { $_obj2ovride($dataobj-raise) } {
    679                     set dlist [linsert $dlist 0 $dataobj]
    680                 } else {
    681                     lappend dlist $dataobj
    682                 }
    683             }
    684             return $dlist
    685         }          
    686         -image {
    687             if {[llength $args] != 2} {
    688                 error "wrong # args: should be \"get -image view\""
    689             }
    690             switch -- [lindex $args end] {
    691                 view {
    692                     return $_image(plot)
    693                 }
    694                 default {
    695                     error "bad image name \"[lindex $args end]\": should be view"
    696                 }
    697             }
    698         }
    699         default {
    700             error "bad option \"$op\": should be -objects or -image"
    701         }
     650        "-objects" {
     651            # put the dataobj list in order according to -raise options
     652            set dlist {}
     653            foreach dataobj $_dlist {
     654                if { ![IsValidObject $dataobj] } {
     655                    continue
     656                }
     657                if {[info exists _obj2ovride($dataobj-raise)] &&
     658                    $_obj2ovride($dataobj-raise)} {
     659                    set dlist [linsert $dlist 0 $dataobj]
     660                } else {
     661                    lappend dlist $dataobj
     662                }
     663            }
     664            return $dlist
     665        }
     666        "-visible" {
     667            set dlist {}
     668            foreach dataobj $_dlist {
     669                if { ![IsValidObject $dataobj] } {
     670                    continue
     671                }
     672                if { ![info exists _obj2ovride($dataobj-raise)] } {
     673                    # No setting indicates that the object isn't visible.
     674                    continue
     675                }
     676                # Otherwise use the -raise parameter to put the object to
     677                # the front of the list.
     678                if { $_obj2ovride($dataobj-raise) } {
     679                    set dlist [linsert $dlist 0 $dataobj]
     680                } else {
     681                    lappend dlist $dataobj
     682                }
     683            }
     684            return $dlist
     685        }          
     686        -image {
     687            if {[llength $args] != 2} {
     688                error "wrong # args: should be \"get -image view\""
     689            }
     690            switch -- [lindex $args end] {
     691                view {
     692                    return $_image(plot)
     693                }
     694                default {
     695                    error "bad image name \"[lindex $args end]\": should be view"
     696                }
     697            }
     698        }
     699        default {
     700            error "bad option \"$op\": should be -objects or -image"
     701        }
    702702    }
    703703}
     
    715715    array unset _limits
    716716    foreach dataobj $args {
    717         set string [limits $dataobj]
    718         if { $string == "" } {
    719             continue
    720         }
    721         array set bounds $string
    722         if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
    723             set _limits(xmin) $bounds(xmin)
    724         }
    725         if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
    726             set _limits(xmax) $bounds(xmax)
    727         }
    728 
    729         if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
    730             set _limits(ymin) $bounds(ymin)
    731         }
    732         if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
    733             set _limits(ymax) $bounds(ymax)
    734         }
    735 
    736         if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
    737             set _limits(zmin) $bounds(zmin)
    738         }
    739         if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
    740             set _limits(zmax) $bounds(zmax)
    741         }
     717        set string [limits $dataobj]
     718        if { $string == "" } {
     719            continue
     720        }
     721        array set bounds $string
     722        if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
     723            set _limits(xmin) $bounds(xmin)
     724        }
     725        if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
     726            set _limits(xmax) $bounds(xmax)
     727        }
     728
     729        if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
     730            set _limits(ymin) $bounds(ymin)
     731        }
     732        if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
     733            set _limits(ymax) $bounds(ymax)
     734        }
     735
     736        if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
     737            set _limits(zmin) $bounds(zmin)
     738        }
     739        if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
     740            set _limits(zmax) $bounds(zmax)
     741        }
    742742    }
    743743}
     
    775775            set word [Rappture::filexfer::label downloadWord]
    776776            $inner.summary configure -text "$word $num in the following format:"
    777             update idletasks            ;# Fix initial sizes
     777            update idletasks            ;# Fix initial sizes
    778778            return $popup
    779779        }
     
    884884    } else {
    885885        SendBytes "$string\n"
    886         StartWaiting
     886        StartWaiting
    887887    }
    888888}
     
    920920    StopWaiting
    921921    if { $info(-type) == "image" } {
    922         if 0 {
    923             set f [open "last.ppm" "w"]
    924             puts $f $bytes
    925             close $f
    926         }
     922        if 0 {
     923            set f [open "last.ppm" "w"]
     924            puts $f $bytes
     925            close $f
     926        }
    927927        $_image(plot) configure -data $bytes
    928         set time [clock seconds]
    929         set date [clock format $time]
     928        set time [clock seconds]
     929        set date [clock format $time]
    930930        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"       
    931         if { $_start > 0 } {
    932             set finish [clock clicks -milliseconds]
    933             #puts stderr "round trip time [expr $finish -$_start] milliseconds"
    934             set _start 0
    935         }
     931        if { $_start > 0 } {
     932            set finish [clock clicks -milliseconds]
     933            #puts stderr "round trip time [expr $finish -$_start] milliseconds"
     934            set _start 0
     935        }
    936936    } elseif { $info(type) == "print" } {
    937937        set tag $this-print-$info(-token)
     
    939939    }
    940940    if { $_legendPending } {
    941         RequestLegend
     941        RequestLegend
    942942    }
    943943}
     
    952952    set option [lindex $args 0]
    953953    switch -- $option {
    954         "scalar" {
    955             set option [lindex $args 1]
    956             switch -- $option {
    957                 "world" {
    958                     foreach { x y z value tag } [lrange $args 2 end] break
    959                 }
    960                 "pixel" {
    961                     foreach { x y value tag } [lrange $args 2 end] break
    962                 }
    963             }
    964         }
    965         "vector" {
    966             set option [lindex $args 1]
    967             switch -- $option {
    968                 "world" {
    969                     foreach { x y z vx vy vz tag } [lrange $args 2 end] break
    970                 }
    971                 "pixel" {
    972                     foreach { x y vx vy vz tag } [lrange $args 2 end] break
    973                 }
    974             }
    975         }
    976         "names" {
     954        "scalar" {
     955            set option [lindex $args 1]
     956            switch -- $option {
     957                "world" {
     958                    foreach { x y z value tag } [lrange $args 2 end] break
     959                }
     960                "pixel" {
     961                    foreach { x y value tag } [lrange $args 2 end] break
     962                }
     963            }
     964        }
     965        "vector" {
     966            set option [lindex $args 1]
     967            switch -- $option {
     968                "world" {
     969                    foreach { x y z vx vy vz tag } [lrange $args 2 end] break
     970                }
     971                "pixel" {
     972                    foreach { x y vx vy vz tag } [lrange $args 2 end] break
     973                }
     974            }
     975        }
     976        "names" {
    977977            foreach { name } [lindex $args 1] {
    978978                #puts stderr "Dataset: $name"
    979979            }
    980         }
    981         default {
    982             error "unknown dataset option \"$option\" from server"
    983         }
     980        }
     981        default {
     982            error "unknown dataset option \"$option\" from server"
     983        }
    984984    }
    985985}
     
    997997    set h [winfo height $itk_component(view)]
    998998    if { $w < 2 || $h < 2 } {
    999         $_dispatcher event -idle !rebuild
    1000         return
     999        $_dispatcher event -idle !rebuild
     1000        return
    10011001    }
    10021002
     
    10241024    set _first ""
    10251025    InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    1026         axis-visible axis-labels cutplane-visible \
    1027         cutplane-xposition cutplane-yposition cutplane-zposition \
    1028         cutplane-xvisible cutplane-yvisible cutplane-zvisible
     1026        axis-visible axis-labels cutplane-visible \
     1027        cutplane-xposition cutplane-yposition cutplane-zposition \
     1028        cutplane-xvisible cutplane-yvisible cutplane-zvisible
    10291029
    10301030    SendCmd "imgflush"
     
    10341034    set _first ""
    10351035    foreach dataobj [get -objects] {
    1036         if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    1037             set _first $dataobj
    1038         }
    1039         set _obj2datasets($dataobj) ""
     1036        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
     1037            set _first $dataobj
     1038        }
     1039        set _obj2datasets($dataobj) ""
    10401040        foreach comp [$dataobj components] {
    10411041            set tag $dataobj-$comp
     
    10461046                append _outbuf $bytes
    10471047                set _datasets($tag) 1
    1048                 SetObjectStyle $dataobj $comp
    1049             }
    1050             lappend _obj2datasets($dataobj) $tag
    1051             if { [info exists _obj2ovride($dataobj-raise)] } {
    1052                 SendCmd "dataset visible 1 $tag"
    1053             } else {
    1054                 SendCmd "dataset visible 0 $tag"
    1055             }
     1048                SetObjectStyle $dataobj $comp
     1049            }
     1050            lappend _obj2datasets($dataobj) $tag
     1051            if { [info exists _obj2ovride($dataobj-raise)] } {
     1052                SendCmd "dataset visible 1 $tag"
     1053            } else {
     1054                SendCmd "dataset visible 0 $tag"
     1055            }
    10561056        }
    10571057    }
     
    10621062        }
    10631063
    1064         if 0 {
    1065             # Tell the server the name of the tool, the version, and dataset
    1066             # that we are rendering.  Have to do it here because we don't know
    1067             # what data objects are using the renderer until be get here.
    1068             set args ""
    1069             lappend args tool [$_first hints toolId]
    1070             lappend args version [$_first hints toolRevision]
    1071             lappend args dataset [$_first hints label]
    1072             SendCmd "clientinfo $args"
    1073         }
    1074 
    1075         foreach axis { x y z } {
    1076             set label [$_first hints ${axis}label]
    1077             if { $label != "" } {
    1078                 SendCmd "axis name $axis $label"
    1079             }
    1080             set units [$_first hints ${axis}units]
    1081             if { $units != "" } {
    1082                 SendCmd "axis units $axis $units"
    1083             }
    1084         }
    1085         array unset _scalarFields
    1086         array unset _vectorFields
    1087         set _currentField [$_first hints default]
    1088         $itk_component(field) choices delete 0 end
    1089         $itk_component(fieldmenu) delete 0 end
    1090         array unset _fields
    1091         foreach { name title units } [$_first hints vectors] {
    1092             set _vectorFields($title) $name
    1093             $itk_component(field) choices insert end "$name" "$title"
    1094             $itk_component(fieldmenu) add radiobutton -label "$title" \
    1095                 -value $title -variable [itcl::scope _currentField] \
    1096                 -selectcolor red \
    1097                 -activebackground black \
    1098                 -activeforeground white \
    1099                 -font "Arial 8" \
    1100                 -command [itcl::code $this Combo invoke]
    1101             set _fields($name) [list $title $units]
    1102         }
    1103         foreach { name title units } [$_first hints scalars] {
    1104             set _scalarFields($title) $name
    1105             $itk_component(field) choices insert end "$name" "$title"
    1106             $itk_component(fieldmenu) add radiobutton -label "$title" \
    1107                 -value $title -variable [itcl::scope _currentField] \
    1108                 -selectcolor red \
    1109                 -activebackground black \
    1110                 -activeforeground white \
    1111                 -font "Arial 8" \
    1112                 -command [itcl::code $this Combo invoke]
    1113             set _fields($name) [list $title $units]
    1114         }
    1115         $itk_component(field) value $_currentField
     1064        if 0 {
     1065            # Tell the server the name of the tool, the version, and dataset
     1066            # that we are rendering.  Have to do it here because we don't know
     1067            # what data objects are using the renderer until be get here.
     1068            set args ""
     1069            lappend args tool [$_first hints toolId]
     1070            lappend args version [$_first hints toolRevision]
     1071            lappend args dataset [$_first hints label]
     1072            SendCmd "clientinfo $args"
     1073        }
     1074
     1075        foreach axis { x y z } {
     1076            set label [$_first hints ${axis}label]
     1077            if { $label != "" } {
     1078                SendCmd "axis name $axis $label"
     1079            }
     1080            set units [$_first hints ${axis}units]
     1081            if { $units != "" } {
     1082                SendCmd "axis units $axis $units"
     1083            }
     1084        }
     1085        array unset _scalarFields
     1086        array unset _vectorFields
     1087        set _currentField [$_first hints default]
     1088        $itk_component(field) choices delete 0 end
     1089        $itk_component(fieldmenu) delete 0 end
     1090        array unset _fields
     1091        foreach { name title units } [$_first hints vectors] {
     1092            set _vectorFields($title) $name
     1093            $itk_component(field) choices insert end "$name" "$title"
     1094            $itk_component(fieldmenu) add radiobutton -label "$title" \
     1095                -value $title -variable [itcl::scope _currentField] \
     1096                -selectcolor red \
     1097                -activebackground black \
     1098                -activeforeground white \
     1099                -font "Arial 8" \
     1100                -command [itcl::code $this Combo invoke]
     1101            set _fields($name) [list $title $units]
     1102        }
     1103        foreach { name title units } [$_first hints scalars] {
     1104            set _scalarFields($title) $name
     1105            $itk_component(field) choices insert end "$name" "$title"
     1106            $itk_component(fieldmenu) add radiobutton -label "$title" \
     1107                -value $title -variable [itcl::scope _currentField] \
     1108                -selectcolor red \
     1109                -activebackground black \
     1110                -activeforeground white \
     1111                -font "Arial 8" \
     1112                -command [itcl::code $this Combo invoke]
     1113            set _fields($name) [list $title $units]
     1114        }
     1115        $itk_component(field) value $_currentField
    11161116    }
    11171117
     
    11191119
    11201120    if { $_reset } {
    1121         InitSettings streamlines-seeds streamlines-opacity \
    1122             streamlines-numpoints streamlines-lighting \
    1123             streamlines-palette streamlines-field \
    1124             volume-edges volume-lighting volume-opacity volume-wireframe
    1125         Zoom reset
    1126         set _reset 0
     1121        InitSettings streamlines-seeds streamlines-opacity \
     1122            streamlines-numpoints streamlines-lighting \
     1123            streamlines-palette streamlines-field \
     1124            volume-edges volume-lighting volume-opacity volume-wireframe
     1125        Zoom reset
     1126        set _reset 0
    11271127    }
    11281128    set _buffering 0;                        # Turn off buffering.
     
    11461146    set flag [lindex $args 0]
    11471147    switch -- $flag {
    1148         "-all" {
    1149             if { [llength $args] > 1 } {
    1150                 error "CurrentDatasets: can't specify dataobj after \"-all\""
    1151             }
    1152             set dlist [get -objects]
    1153         }
    1154         "-visible" {
    1155             if { [llength $args] > 1 } {
    1156                 set dlist {}
    1157                 set args [lrange $args 1 end]
    1158                 foreach dataobj $args {
    1159                     if { [info exists _obj2ovride($dataobj-raise)] } {
    1160                         lappend dlist $dataobj
    1161                     }
    1162                 }
    1163             } else {
    1164                 set dlist [get -visible]
    1165             }
    1166         }          
    1167         default {
    1168             set dlist $args
    1169         }
     1148        "-all" {
     1149            if { [llength $args] > 1 } {
     1150                error "CurrentDatasets: can't specify dataobj after \"-all\""
     1151            }
     1152            set dlist [get -objects]
     1153        }
     1154        "-visible" {
     1155            if { [llength $args] > 1 } {
     1156                set dlist {}
     1157                set args [lrange $args 1 end]
     1158                foreach dataobj $args {
     1159                    if { [info exists _obj2ovride($dataobj-raise)] } {
     1160                        lappend dlist $dataobj
     1161                    }
     1162                }
     1163            } else {
     1164                set dlist [get -visible]
     1165            }
     1166        }          
     1167        default {
     1168            set dlist $args
     1169        }
    11701170    }
    11711171    set rlist ""
    11721172    foreach dataobj $dlist {
    1173         foreach comp [$dataobj components] {
    1174             set tag $dataobj-$comp
    1175             if { [info exists _datasets($tag)] && $_datasets($tag) } {
    1176                 lappend rlist $tag
    1177             }
    1178         }
     1173        foreach comp [$dataobj components] {
     1174            set tag $dataobj-$comp
     1175            if { [info exists _datasets($tag)] && $_datasets($tag) } {
     1176                lappend rlist $tag
     1177            }
     1178        }
    11791179    }
    11801180    return $rlist
     
    11931193        "in" {
    11941194            set _view(zoom) [expr {$_view(zoom)*1.25}]
    1195             SendCmd "camera zoom $_view(zoom)"
     1195            SendCmd "camera zoom $_view(zoom)"
    11961196        }
    11971197        "out" {
    11981198            set _view(zoom) [expr {$_view(zoom)*0.8}]
    1199             SendCmd "camera zoom $_view(zoom)"
     1199            SendCmd "camera zoom $_view(zoom)"
    12001200        }
    12011201        "reset" {
    12021202            array set _view {
    1203                 qw      1
    1204                 qx      0
    1205                 qy      0
    1206                 qz      0
     1203                qw      1
     1204                qx      0
     1205                qy      0
     1206                qz      0
    12071207                zoom    1.0
    12081208                xpan   0
     
    12161216                }
    12171217            }
    1218             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1219             $_arcball quaternion $q
    1220             DoRotate
     1218            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1219            $_arcball quaternion $q
     1220            DoRotate
    12211221        }
    12221222    }
     
    12621262                    return
    12631263                }
    1264                 if { $dx == 0 && $dy == 0 } {
    1265                     return
    1266                 }
    1267                 set q [$_arcball rotate $x $y $_click(x) $_click(y)]
    1268                 EventuallyRotate $q
     1264                if { $dx == 0 && $dy == 0 } {
     1265                    return
     1266                }
     1267                set q [$_arcball rotate $x $y $_click(x) $_click(y)]
     1268                EventuallyRotate $q
    12691269                set _click(x) $x
    12701270                set _click(y) $y
     
    12981298itcl::body Rappture::VtkStreamlinesViewer::Pan {option x y} {
    12991299    switch -- $option {
    1300         "set" {
    1301             set w [winfo width $itk_component(view)]
    1302             set h [winfo height $itk_component(view)]
    1303             set x [expr $x / double($w)]
    1304             set y [expr $y / double($h)]
    1305             set _view(xpan) [expr $_view(xpan) + $x]
    1306             set _view(ypan) [expr $_view(ypan) + $y]
    1307             PanCamera
    1308             return
    1309         }
    1310         "click" {
    1311             set _click(x) $x
    1312             set _click(y) $y
    1313             $itk_component(view) configure -cursor hand1
    1314         }
    1315         "drag" {
    1316             if { ![info exists _click(x)] } {
    1317                 set _click(x) $x
    1318             }
    1319             if { ![info exists _click(y)] } {
    1320                 set _click(y) $y
    1321             }
    1322             set w [winfo width $itk_component(view)]
    1323             set h [winfo height $itk_component(view)]
    1324             set dx [expr ($_click(x) - $x)/double($w)]
    1325             set dy [expr ($_click(y) - $y)/double($h)]
    1326             set _click(x) $x
    1327             set _click(y) $y
    1328             set _view(xpan) [expr $_view(xpan) - $dx]
    1329             set _view(ypan) [expr $_view(ypan) - $dy]
    1330             PanCamera
    1331         }
    1332         "release" {
    1333             Pan drag $x $y
    1334             $itk_component(view) configure -cursor ""
    1335         }
    1336         default {
    1337             error "unknown option \"$option\": should set, click, drag, or release"
    1338         }
     1300        "set" {
     1301            set w [winfo width $itk_component(view)]
     1302            set h [winfo height $itk_component(view)]
     1303            set x [expr $x / double($w)]
     1304            set y [expr $y / double($h)]
     1305            set _view(xpan) [expr $_view(xpan) + $x]
     1306            set _view(ypan) [expr $_view(ypan) + $y]
     1307            PanCamera
     1308            return
     1309        }
     1310        "click" {
     1311            set _click(x) $x
     1312            set _click(y) $y
     1313            $itk_component(view) configure -cursor hand1
     1314        }
     1315        "drag" {
     1316            if { ![info exists _click(x)] } {
     1317                set _click(x) $x
     1318            }
     1319            if { ![info exists _click(y)] } {
     1320                set _click(y) $y
     1321            }
     1322            set w [winfo width $itk_component(view)]
     1323            set h [winfo height $itk_component(view)]
     1324            set dx [expr ($_click(x) - $x)/double($w)]
     1325            set dy [expr ($_click(y) - $y)/double($h)]
     1326            set _click(x) $x
     1327            set _click(y) $y
     1328            set _view(xpan) [expr $_view(xpan) - $dx]
     1329            set _view(ypan) [expr $_view(ypan) - $dy]
     1330            PanCamera
     1331        }
     1332        "release" {
     1333            Pan drag $x $y
     1334            $itk_component(view) configure -cursor ""
     1335        }
     1336        default {
     1337            error "unknown option \"$option\": should set, click, drag, or release"
     1338        }
    13391339    }
    13401340}
     
    13491349itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
    13501350    foreach spec $args {
    1351         if { [info exists _settings($_first-$spec)] } {
    1352             # Reset global setting with dataobj specific setting
    1353             set _settings($spec) $_settings($_first-$spec)
    1354         }
    1355         AdjustSetting $spec
     1351        if { [info exists _settings($_first-$spec)] } {
     1352            # Reset global setting with dataobj specific setting
     1353            set _settings($spec) $_settings($_first-$spec)
     1354        }
     1355        AdjustSetting $spec
    13561356    }
    13571357}
     
    13601360# AdjustSetting --
    13611361#
    1362 #       Changes/updates a specific setting in the widget.  There are
    1363 #       usually user-setable option.  Commands are sent to the render
    1364 #       server.
     1362#       Changes/updates a specific setting in the widget.  There are
     1363#       usually user-setable option.  Commands are sent to the render
     1364#       server.
    13651365#
    13661366itcl::body Rappture::VtkStreamlinesViewer::AdjustSetting {what {value ""}} {
    13671367    if { ![isconnected] } {
    1368         return
     1368        return
    13691369    }
    13701370    switch -- $what {
    13711371        "volume-opacity" {
    1372             set val $_settings(volume-opacity)
    1373             set sval [expr { 0.01 * double($val) }]
    1374             foreach dataset [CurrentDatasets -visible] {
    1375                 SendCmd "polydata opacity $sval $dataset"
    1376             }
     1372            set val $_settings(volume-opacity)
     1373            set sval [expr { 0.01 * double($val) }]
     1374            foreach dataset [CurrentDatasets -visible] {
     1375                SendCmd "polydata opacity $sval $dataset"
     1376            }
    13771377        }
    13781378        "volume-wireframe" {
    1379             set bool $_settings(volume-wireframe)
    1380             foreach dataset [CurrentDatasets -visible] {
    1381                 SendCmd "polydata wireframe $bool $dataset"
     1379            set bool $_settings(volume-wireframe)
     1380            foreach dataset [CurrentDatasets -visible] {
     1381                SendCmd "polydata wireframe $bool $dataset"
    13821382            }
    13831383        }
    13841384        "volume-visible" {
    1385             set bool $_settings(volume-visible)
    1386             foreach dataset [CurrentDatasets -visible] {
    1387                 SendCmd "polydata visible $bool $dataset"
    1388             }
    1389             if { $bool } {
    1390                 Rappture::Tooltip::for $itk_component(volume) \
    1391                     "Hide the volume"
    1392             } else {
    1393                 Rappture::Tooltip::for $itk_component(volume) \
    1394                     "Show the volume"
    1395             }
     1385            set bool $_settings(volume-visible)
     1386            foreach dataset [CurrentDatasets -visible] {
     1387                SendCmd "polydata visible $bool $dataset"
     1388            }
     1389            if { $bool } {
     1390                Rappture::Tooltip::for $itk_component(volume) \
     1391                    "Hide the volume"
     1392            } else {
     1393                Rappture::Tooltip::for $itk_component(volume) \
     1394                    "Show the volume"
     1395            }
    13961396        }
    13971397        "volume-lighting" {
    1398             set bool $_settings(volume-lighting)
    1399             foreach dataset [CurrentDatasets -visible] {
    1400                 SendCmd "polydata lighting $bool $dataset"
     1398            set bool $_settings(volume-lighting)
     1399            foreach dataset [CurrentDatasets -visible] {
     1400                SendCmd "polydata lighting $bool $dataset"
    14011401            }
    14021402        }
    14031403        "volume-edges" {
    1404             set bool $_settings(volume-edges)
    1405             foreach dataset [CurrentDatasets -visible] {
    1406                 SendCmd "polydata edges $bool $dataset"
     1404            set bool $_settings(volume-edges)
     1405            foreach dataset [CurrentDatasets -visible] {
     1406                SendCmd "polydata edges $bool $dataset"
    14071407            }
    14081408        }
    14091409        "axis-visible" {
    1410             set bool $_settings(axis-visible)
    1411             SendCmd "axis visible all $bool"
     1410            set bool $_settings(axis-visible)
     1411            SendCmd "axis visible all $bool"
    14121412        }
    14131413        "axis-labels" {
    1414             set bool $_settings(axis-labels)
    1415             SendCmd "axis labels all $bool"
     1414            set bool $_settings(axis-labels)
     1415            SendCmd "axis labels all $bool"
    14161416        }
    14171417        "axis-xgrid" - "axis-ygrid" - "axis-zgrid" {
    1418             set axis [string range $what 5 5]
    1419             set bool $_settings($what)
    1420             SendCmd "axis grid $axis $bool"
     1418            set axis [string range $what 5 5]
     1419            set bool $_settings($what)
     1420            SendCmd "axis grid $axis $bool"
    14211421        }
    14221422        "axis-mode" {
    1423             set mode [$itk_component(axismode) value]
    1424             set mode [$itk_component(axismode) translate $mode]
    1425             set _settings($what) $mode
    1426             SendCmd "axis flymode $mode"
     1423            set mode [$itk_component(axismode) value]
     1424            set mode [$itk_component(axismode) translate $mode]
     1425            set _settings($what) $mode
     1426            SendCmd "axis flymode $mode"
    14271427        }
    14281428        "cutplane-edges" {
    1429             set bool $_settings($what)
    1430             foreach dataset [CurrentDatasets -visible] {
    1431                 SendCmd "cutplane edges $bool $dataset"
     1429            set bool $_settings($what)
     1430            foreach dataset [CurrentDatasets -visible] {
     1431                SendCmd "cutplane edges $bool $dataset"
    14321432            }
    14331433        }
    14341434        "cutplane-visible" {
    1435             set bool $_settings($what)
    1436             foreach dataset [CurrentDatasets -visible] {
    1437                 SendCmd "cutplane visible $bool $dataset"
     1435            set bool $_settings($what)
     1436            foreach dataset [CurrentDatasets -visible] {
     1437                SendCmd "cutplane visible $bool $dataset"
    14381438            }
    14391439        }
    14401440        "cutplane-wireframe" {
    1441             set bool $_settings($what)
    1442             foreach dataset [CurrentDatasets -visible] {
    1443                 SendCmd "cutplane wireframe $bool $dataset"
     1441            set bool $_settings($what)
     1442            foreach dataset [CurrentDatasets -visible] {
     1443                SendCmd "cutplane wireframe $bool $dataset"
    14441444            }
    14451445        }
    14461446        "cutplane-lighting" {
    1447             set bool $_settings($what)
    1448             foreach dataset [CurrentDatasets -visible] {
    1449                 SendCmd "cutplane lighting $bool $dataset"
     1447            set bool $_settings($what)
     1448            foreach dataset [CurrentDatasets -visible] {
     1449                SendCmd "cutplane lighting $bool $dataset"
    14501450            }
    14511451        }
    14521452        "cutplane-opacity" {
    1453             set val $_settings($what)
    1454             set sval [expr { 0.01 * double($val) }]
    1455             foreach dataset [CurrentDatasets -visible] {
    1456                 SendCmd "cutplane opacity $sval $dataset"
    1457             }
    1458         }
    1459         "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
    1460             set axis [string range $what 9 9]
    1461             set bool $_settings($what)
     1453            set val $_settings($what)
     1454            set sval [expr { 0.01 * double($val) }]
     1455            foreach dataset [CurrentDatasets -visible] {
     1456                SendCmd "cutplane opacity $sval $dataset"
     1457            }
     1458        }
     1459        "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
     1460            set axis [string range $what 9 9]
     1461            set bool $_settings($what)
    14621462            if { $bool } {
    14631463                $itk_component(${axis}CutScale) configure -state normal \
     
    14671467                    -troughcolor grey82
    14681468            }
    1469             SendCmd "cutplane axis $axis $bool"
    1470         }
    1471         "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
    1472             set axis [string range $what 9 9]
    1473             set pos [expr $_settings($what) * 0.01]
    1474             SendCmd "cutplane slice ${axis} ${pos}"
    1475             set _cutplanePending 0
    1476         }
     1469            SendCmd "cutplane axis $axis $bool"
     1470        }
     1471        "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
     1472            set axis [string range $what 9 9]
     1473            set pos [expr $_settings($what) * 0.01]
     1474            SendCmd "cutplane slice ${axis} ${pos}"
     1475            set _cutplanePending 0
     1476        }
    14771477        "streamlines-seeds" {
    1478             set bool $_settings($what)
    1479             foreach dataset [CurrentDatasets -visible] {
    1480                 SendCmd "streamlines seed visible $bool $dataset"
    1481             }
     1478            set bool $_settings($what)
     1479            foreach dataset [CurrentDatasets -visible] {
     1480                SendCmd "streamlines seed visible $bool $dataset"
     1481            }
    14821482        }
    14831483        "streamlines-numpoints" {
    1484             set density $_settings($what)
    1485             EventuallyReseed $density
     1484            set density $_settings($what)
     1485            EventuallyReseed $density
    14861486        }
    14871487        "streamlines-visible" {
    1488             set bool $_settings($what)
    1489             foreach dataset [CurrentDatasets -visible] {
    1490                 SendCmd "streamlines visible $bool $dataset"
    1491             }
    1492             if { $bool } {
    1493                 Rappture::Tooltip::for $itk_component(streamlines) \
    1494                     "Hide the streamlines"
    1495             } else {
    1496                 Rappture::Tooltip::for $itk_component(streamlines) \
    1497                     "Show the streamlines"
    1498             }
     1488            set bool $_settings($what)
     1489            foreach dataset [CurrentDatasets -visible] {
     1490                SendCmd "streamlines visible $bool $dataset"
     1491            }
     1492            if { $bool } {
     1493                Rappture::Tooltip::for $itk_component(streamlines) \
     1494                    "Hide the streamlines"
     1495            } else {
     1496                Rappture::Tooltip::for $itk_component(streamlines) \
     1497                    "Show the streamlines"
     1498            }
    14991499        }
    15001500        "streamlines-mode" {
    1501             set mode [$itk_component(streammode) value]
    1502             set _settings(streamlines-mode) $mode
    1503             foreach dataset [CurrentDatasets -visible] {
    1504                 switch -- $mode {
    1505                     "lines" {
    1506                         SendCmd "streamlines lines $dataset"
    1507                     }
    1508                     "ribbons" {
    1509                         SendCmd "streamlines ribbons 3 0 $dataset"
    1510                     }
    1511                     "tubes" {
    1512                         SendCmd "streamlines tubes 5 3 $dataset"
    1513                     }
    1514                 }
     1501            set mode [$itk_component(streammode) value]
     1502            set _settings(streamlines-mode) $mode
     1503            foreach dataset [CurrentDatasets -visible] {
     1504                switch -- $mode {
     1505                    "lines" {
     1506                        SendCmd "streamlines lines $dataset"
     1507                    }
     1508                    "ribbons" {
     1509                        SendCmd "streamlines ribbons 3 0 $dataset"
     1510                    }
     1511                    "tubes" {
     1512                        SendCmd "streamlines tubes 5 3 $dataset"
     1513                    }
     1514                }
    15151515            }
    15161516        }
    15171517        "streamlines-palette" {
    1518             set palette [$itk_component(palette) value]
    1519             set _settings(streamlines-palette) $palette
    1520             foreach dataset [CurrentDatasets -visible $_first] {
    1521                 foreach {dataobj comp} [split $dataset -] break
    1522                 ChangeColormap $dataobj $comp $palette
    1523             }
    1524             set _legendPending 1
     1518            set palette [$itk_component(palette) value]
     1519            set _settings(streamlines-palette) $palette
     1520            foreach dataset [CurrentDatasets -visible $_first] {
     1521                foreach {dataobj comp} [split $dataset -] break
     1522                ChangeColormap $dataobj $comp $palette
     1523            }
     1524            set _legendPending 1
    15251525        }
    15261526        "streamlines-opacity" {
    1527             set val $_settings(streamlines-opacity)
    1528             set sval [expr { 0.01 * double($val) }]
    1529             foreach dataset [CurrentDatasets -visible $_first] {
    1530                 SendCmd "streamlines opacity $sval $dataset"
    1531             }
     1527            set val $_settings(streamlines-opacity)
     1528            set sval [expr { 0.01 * double($val) }]
     1529            foreach dataset [CurrentDatasets -visible $_first] {
     1530                SendCmd "streamlines opacity $sval $dataset"
     1531            }
    15321532        }
    15331533        "streamlines-scale" {
    1534             set val $_settings(streamlines-scale)
    1535             set sval [expr { 0.01 * double($val) }]
    1536             foreach dataset [CurrentDatasets -visible $_first] {
    1537                 SendCmd "streamlines scale $sval $sval $sval $dataset"
    1538             }
     1534            set val $_settings(streamlines-scale)
     1535            set sval [expr { 0.01 * double($val) }]
     1536            foreach dataset [CurrentDatasets -visible $_first] {
     1537                SendCmd "streamlines scale $sval $sval $sval $dataset"
     1538            }
    15391539        }
    15401540        "streamlines-lighting" {
    1541             set bool $_settings(streamlines-lighting)
    1542             foreach dataset [CurrentDatasets -visible $_first] {
    1543                 SendCmd "streamlines lighting $bool $dataset"
     1541            set bool $_settings(streamlines-lighting)
     1542            foreach dataset [CurrentDatasets -visible $_first] {
     1543                SendCmd "streamlines lighting $bool $dataset"
    15441544            }
    15451545        }
    15461546        "streamlines-field" {
    1547             set new [$itk_component(field) value]
    1548             set value [$itk_component(field) translate $new]
    1549             set _settings(streamlines-field) $value
    1550             if { [info exists _scalarFields($new)] } {
    1551                 set name $_scalarFields($new)
    1552                 set _colorMode scalar
    1553                 set _currentField $new
    1554             } elseif { [info exists _vectorFields($new)] } {
    1555                 set name $_vectorFields($new)
    1556                 set _colorMode vmag
    1557                 set _currentField $new
    1558             } else {
    1559                 puts stderr "unknown field \"$new\""
    1560                 return
    1561             }
    1562             foreach dataset [CurrentDatasets -visible] {
    1563                 puts stderr "streamlines colormode $_colorMode ${name} $dataset"
    1564                 puts stderr "cutplane colormode $_colorMode ${name} $dataset"
    1565                 SendCmd "streamlines colormode $_colorMode ${name} $dataset"
    1566                 SendCmd "cutplane colormode $_colorMode ${name} $dataset"
    1567             }
    1568             set _legendPending 1
     1547            set new [$itk_component(field) value]
     1548            set value [$itk_component(field) translate $new]
     1549            set _settings(streamlines-field) $value
     1550            if { [info exists _scalarFields($new)] } {
     1551                set name $_scalarFields($new)
     1552                set _colorMode scalar
     1553                set _currentField $new
     1554            } elseif { [info exists _vectorFields($new)] } {
     1555                set name $_vectorFields($new)
     1556                set _colorMode vmag
     1557                set _currentField $new
     1558            } else {
     1559                puts stderr "unknown field \"$new\""
     1560                return
     1561            }
     1562            foreach dataset [CurrentDatasets -visible] {
     1563                puts stderr "streamlines colormode $_colorMode ${name} $dataset"
     1564                puts stderr "cutplane colormode $_colorMode ${name} $dataset"
     1565                SendCmd "streamlines colormode $_colorMode ${name} $dataset"
     1566                SendCmd "cutplane colormode $_colorMode ${name} $dataset"
     1567            }
     1568            set _legendPending 1
    15691569        }
    15701570        default {
     
    15771577# RequestLegend --
    15781578#
    1579 #       Request a new legend from the server.  The size of the legend
    1580 #       is determined from the height of the canvas.  It will be rotated
    1581 #       to be vertical when drawn.
     1579#       Request a new legend from the server.  The size of the legend
     1580#       is determined from the height of the canvas.  It will be rotated
     1581#       to be vertical when drawn.
    15821582#
    15831583itcl::body Rappture::VtkStreamlinesViewer::RequestLegend {} {
     
    15881588    set h [expr {$_height - 3 * ($lineht + 2)}]
    15891589    if { $h < 1} {
    1590         return
     1590        return
    15911591    }
    15921592    if { [info exists _scalarFields($_currentField)] } {
    1593         set name $_scalarFields($_currentField)
     1593        set name $_scalarFields($_currentField)
    15941594    } elseif { [info exists _vectorFields($_currentField)] } {
    1595         set name $_vectorFields($_currentField)
     1595        set name $_vectorFields($_currentField)
    15961596    } else {
    1597         return
     1597        return
    15981598    }
    15991599    # Set the legend on the first streamlines dataset.
    16001600    foreach dataset [CurrentDatasets -visible $_first] {
    1601         foreach {dataobj comp} [split $dataset -] break
    1602         if { [info exists _dataset2style($dataset)] } {
     1601        foreach {dataobj comp} [split $dataset -] break
     1602        if { [info exists _dataset2style($dataset)] } {
    16031603            SendCmdNoWait \
    1604                 "legend $_dataset2style($dataset) $_colorMode $name {} $w $h 0"
    1605             break;
     1604                "legend $_dataset2style($dataset) $_colorMode $name {} $w $h 0"
     1605            break;
    16061606        }
    16071607    }
     
    16141614    set tag $dataobj-$comp
    16151615    if { ![info exist _style($tag)] } {
    1616         error "no initial colormap"
     1616        error "no initial colormap"
    16171617    }
    16181618    array set style $_style($tag)
     
    16331633    set tag $dataobj-$comp
    16341634    if { ![info exists _initialStyle($tag)] } {
    1635         # Save the initial component style.
    1636         set _initialStyle($tag) [$dataobj style $comp]
     1635        # Save the initial component style.
     1636        set _initialStyle($tag) [$dataobj style $comp]
    16371637    }
    16381638
     
    16411641
    16421642    if { ![info exists _style($tag)] } {
    1643         set _style($tag) [array get style]
     1643        set _style($tag) [array get style]
    16441644    }
    16451645    # Override initial style with current style.
     
    16481648    set name "$style(-color):$style(-levels):$style(-opacity)"
    16491649    if { ![info exists _colormaps($name)] } {
    1650         BuildColormap $name [array get style]
    1651         set _colormaps($name) 1
     1650        BuildColormap $name [array get style]
     1651        set _colormaps($name) 1
    16521652    }
    16531653    if { ![info exists _dataset2style($tag)] ||
    1654         $_dataset2style($tag) != $name } {
    1655         SendCmd "streamlines colormap $name $tag"
    1656         SendCmd "cutplane colormap $name $tag"
    1657         set _dataset2style($tag) $name
     1654        $_dataset2style($tag) != $name } {
     1655        SendCmd "streamlines colormap $name $tag"
     1656        SendCmd "cutplane colormap $name $tag"
     1657        set _dataset2style($tag) $name
    16581658    }
    16591659}
     
    16611661itcl::body Rappture::VtkStreamlinesViewer::ColorsToColormap { colors } {
    16621662    switch -- $colors {
    1663         "grey-to-blue" {
    1664             return {
    1665                 0.0                      0.200 0.200 0.200
    1666                 0.14285714285714285      0.400 0.400 0.400
    1667                 0.2857142857142857      0.600 0.600 0.600
    1668                 0.42857142857142855      0.900 0.900 0.900
    1669                 0.5714285714285714      0.800 1.000 1.000
    1670                 0.7142857142857143      0.600 1.000 1.000
    1671                 0.8571428571428571      0.400 0.900 1.000
    1672                 1.0                      0.000 0.600 0.800
    1673             }
    1674         }
    1675         "blue-to-grey" {
    1676             return {
    1677                 0.0                     0.000 0.600 0.800
    1678                 0.14285714285714285     0.400 0.900 1.000
    1679                 0.2857142857142857      0.600 1.000 1.000
    1680                 0.42857142857142855     0.800 1.000 1.000
    1681                 0.5714285714285714      0.900 0.900 0.900
    1682                 0.7142857142857143      0.600 0.600 0.600
    1683                 0.8571428571428571      0.400 0.400 0.400
    1684                 1.0                     0.200 0.200 0.200
    1685             }
    1686         }
    1687         "blue" {
    1688             return {
    1689                 0.0                     0.900 1.000 1.000
    1690                 0.1111111111111111      0.800 0.983 1.000
    1691                 0.2222222222222222      0.700 0.950 1.000
    1692                 0.3333333333333333      0.600 0.900 1.000
    1693                 0.4444444444444444      0.500 0.833 1.000
    1694                 0.5555555555555556      0.400 0.750 1.000
    1695                 0.6666666666666666      0.300 0.650 1.000
    1696                 0.7777777777777778      0.200 0.533 1.000
    1697                 0.8888888888888888      0.100 0.400 1.000
    1698                 1.0                     0.000 0.250 1.000
    1699             }
    1700         }
    1701         "brown-to-blue" {
    1702             return {
    1703                 0.0                             0.200   0.100   0.000
    1704                 0.09090909090909091             0.400   0.187   0.000
    1705                 0.18181818181818182             0.600   0.379   0.210
    1706                 0.2727272727272727              0.800   0.608   0.480
    1707                 0.36363636363636365             0.850   0.688   0.595
    1708                 0.45454545454545453             0.950   0.855   0.808
    1709                 0.5454545454545454              0.800   0.993   1.000
    1710                 0.6363636363636364              0.600   0.973   1.000
    1711                 0.7272727272727273              0.400   0.940   1.000
    1712                 0.8181818181818182              0.200   0.893   1.000
    1713                 0.9090909090909091              0.000   0.667   0.800
    1714                 1.0                             0.000   0.480   0.600
    1715             }
    1716         }
    1717         "blue-to-brown" {
    1718             return {
    1719                 0.0                             0.000   0.480   0.600
    1720                 0.09090909090909091             0.000   0.667   0.800
    1721                 0.18181818181818182             0.200   0.893   1.000
    1722                 0.2727272727272727              0.400   0.940   1.000
    1723                 0.36363636363636365             0.600   0.973   1.000
    1724                 0.45454545454545453             0.800   0.993   1.000
    1725                 0.5454545454545454              0.950   0.855   0.808
    1726                 0.6363636363636364              0.850   0.688   0.595
    1727                 0.7272727272727273              0.800   0.608   0.480
    1728                 0.8181818181818182              0.600   0.379   0.210
    1729                 0.9090909090909091              0.400   0.187   0.000
    1730                 1.0                             0.200   0.100   0.000
    1731             }
    1732         }
    1733         "blue-to-orange" {
    1734             return {
    1735                 0.0                             0.000   0.167   1.000
    1736                 0.09090909090909091             0.100   0.400   1.000
    1737                 0.18181818181818182             0.200   0.600   1.000
    1738                 0.2727272727272727              0.400   0.800   1.000
    1739                 0.36363636363636365             0.600   0.933   1.000
    1740                 0.45454545454545453             0.800   1.000   1.000
    1741                 0.5454545454545454              1.000   1.000   0.800
    1742                 0.6363636363636364              1.000   0.933   0.600
    1743                 0.7272727272727273              1.000   0.800   0.400
    1744                 0.8181818181818182              1.000   0.600   0.200
    1745                 0.9090909090909091              1.000   0.400   0.100
    1746                 1.0                             1.000   0.167   0.000
    1747             }
    1748         }
    1749         "orange-to-blue" {
    1750             return {
    1751                 0.0                             1.000   0.167   0.000
    1752                 0.09090909090909091             1.000   0.400   0.100
    1753                 0.18181818181818182             1.000   0.600   0.200
    1754                 0.2727272727272727              1.000   0.800   0.400
    1755                 0.36363636363636365             1.000   0.933   0.600
    1756                 0.45454545454545453             1.000   1.000   0.800
    1757                 0.5454545454545454              0.800   1.000   1.000
    1758                 0.6363636363636364              0.600   0.933   1.000
    1759                 0.7272727272727273              0.400   0.800   1.000
    1760                 0.8181818181818182              0.200   0.600   1.000
    1761                 0.9090909090909091              0.100   0.400   1.000
    1762                 1.0                             0.000   0.167   1.000
    1763             }
    1764         }
    1765         "rainbow" {
    1766             set clist {
    1767                 "#EE82EE"
    1768                 "#4B0082"
    1769                 "blue"
    1770                 "#008000"
    1771                 "yellow"
    1772                 "#FFA500"
    1773                 "red"
    1774             }
    1775         }
    1776         "BGYOR" {
    1777             set clist {
    1778                 "blue"
    1779                 "#008000"
    1780                 "yellow"
    1781                 "#FFA500"
    1782                 "red"
    1783             }
    1784         }
    1785         "ROYGB" {
    1786             set clist {
    1787                 "red"
    1788                 "#FFA500"
    1789                 "yellow"
    1790                 "#008000"
    1791                 "blue"
    1792             }
    1793         }
    1794         "RYGCB" {
    1795             set clist {
    1796                 "red"
    1797                 "yellow"
    1798                 "green"
    1799                 "cyan"
    1800                 "blue"
    1801             }
    1802         }
    1803         "BCGYR" {
    1804             set clist {
    1805                 "blue"
    1806                 "cyan"
    1807                 "green"
    1808                 "yellow"
    1809                 "red"
    1810             }
    1811         }
    1812         "spectral" {
    1813             return {
    1814                 0.0 0.150 0.300 1.000
    1815                 0.1 0.250 0.630 1.000
    1816                 0.2 0.450 0.850 1.000
    1817                 0.3 0.670 0.970 1.000
    1818                 0.4 0.880 1.000 1.000
    1819                 0.5 1.000 1.000 0.750
    1820                 0.6 1.000 0.880 0.600
    1821                 0.7 1.000 0.680 0.450
    1822                 0.8 0.970 0.430 0.370
    1823                 0.9 0.850 0.150 0.196
    1824                 1.0 0.650 0.000 0.130
    1825             }
    1826         }
    1827         "green-to-magenta" {
    1828             return {
    1829                 0.0 0.000 0.316 0.000
    1830                 0.06666666666666667 0.000 0.526 0.000
    1831                 0.13333333333333333 0.000 0.737 0.000
    1832                 0.2 0.000 0.947 0.000
    1833                 0.26666666666666666 0.316 1.000 0.316
    1834                 0.3333333333333333 0.526 1.000 0.526
    1835                 0.4 0.737 1.000 0.737
    1836                 0.4666666666666667 1.000 1.000 1.000
    1837                 0.5333333333333333 1.000 0.947 1.000
    1838                 0.6 1.000 0.737 1.000
    1839                 0.6666666666666666 1.000 0.526 1.000
    1840                 0.7333333333333333 1.000 0.316 1.000
    1841                 0.8 0.947 0.000 0.947
    1842                 0.8666666666666667 0.737 0.000 0.737
    1843                 0.9333333333333333 0.526 0.000 0.526
    1844                 1.0 0.316 0.000 0.316
    1845             }
    1846         }
    1847         "greyscale" {
    1848             return {
    1849                 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
    1850             }
    1851         }
    1852         "nanohub" {
    1853             set clist "white yellow green cyan blue magenta"
    1854         }
    1855         default {
    1856             set clist $colors
    1857         }
     1663        "grey-to-blue" {
     1664            return {
     1665                0.0                      0.200 0.200 0.200
     1666                0.14285714285714285      0.400 0.400 0.400
     1667                0.2857142857142857      0.600 0.600 0.600
     1668                0.42857142857142855      0.900 0.900 0.900
     1669                0.5714285714285714      0.800 1.000 1.000
     1670                0.7142857142857143      0.600 1.000 1.000
     1671                0.8571428571428571      0.400 0.900 1.000
     1672                1.0                      0.000 0.600 0.800
     1673            }
     1674        }
     1675        "blue-to-grey" {
     1676            return {
     1677                0.0                     0.000 0.600 0.800
     1678                0.14285714285714285     0.400 0.900 1.000
     1679                0.2857142857142857      0.600 1.000 1.000
     1680                0.42857142857142855     0.800 1.000 1.000
     1681                0.5714285714285714      0.900 0.900 0.900
     1682                0.7142857142857143      0.600 0.600 0.600
     1683                0.8571428571428571      0.400 0.400 0.400
     1684                1.0                     0.200 0.200 0.200
     1685            }
     1686        }
     1687        "blue" {
     1688            return {
     1689                0.0                     0.900 1.000 1.000
     1690                0.1111111111111111      0.800 0.983 1.000
     1691                0.2222222222222222      0.700 0.950 1.000
     1692                0.3333333333333333      0.600 0.900 1.000
     1693                0.4444444444444444      0.500 0.833 1.000
     1694                0.5555555555555556      0.400 0.750 1.000
     1695                0.6666666666666666      0.300 0.650 1.000
     1696                0.7777777777777778      0.200 0.533 1.000
     1697                0.8888888888888888      0.100 0.400 1.000
     1698                1.0                     0.000 0.250 1.000
     1699            }
     1700        }
     1701        "brown-to-blue" {
     1702            return {
     1703                0.0                             0.200   0.100   0.000
     1704                0.09090909090909091             0.400   0.187   0.000
     1705                0.18181818181818182             0.600   0.379   0.210
     1706                0.2727272727272727              0.800   0.608   0.480
     1707                0.36363636363636365             0.850   0.688   0.595
     1708                0.45454545454545453             0.950   0.855   0.808
     1709                0.5454545454545454              0.800   0.993   1.000
     1710                0.6363636363636364              0.600   0.973   1.000
     1711                0.7272727272727273              0.400   0.940   1.000
     1712                0.8181818181818182              0.200   0.893   1.000
     1713                0.9090909090909091              0.000   0.667   0.800
     1714                1.0                             0.000   0.480   0.600
     1715            }
     1716        }
     1717        "blue-to-brown" {
     1718            return {
     1719                0.0                             0.000   0.480   0.600
     1720                0.09090909090909091             0.000   0.667   0.800
     1721                0.18181818181818182             0.200   0.893   1.000
     1722                0.2727272727272727              0.400   0.940   1.000
     1723                0.36363636363636365             0.600   0.973   1.000
     1724                0.45454545454545453             0.800   0.993   1.000
     1725                0.5454545454545454              0.950   0.855   0.808
     1726                0.6363636363636364              0.850   0.688   0.595
     1727                0.7272727272727273              0.800   0.608   0.480
     1728                0.8181818181818182              0.600   0.379   0.210
     1729                0.9090909090909091              0.400   0.187   0.000
     1730                1.0                             0.200   0.100   0.000
     1731            }
     1732        }
     1733        "blue-to-orange" {
     1734            return {
     1735                0.0                             0.000   0.167   1.000
     1736                0.09090909090909091             0.100   0.400   1.000
     1737                0.18181818181818182             0.200   0.600   1.000
     1738                0.2727272727272727              0.400   0.800   1.000
     1739                0.36363636363636365             0.600   0.933   1.000
     1740                0.45454545454545453             0.800   1.000   1.000
     1741                0.5454545454545454              1.000   1.000   0.800
     1742                0.6363636363636364              1.000   0.933   0.600
     1743                0.7272727272727273              1.000   0.800   0.400
     1744                0.8181818181818182              1.000   0.600   0.200
     1745                0.9090909090909091              1.000   0.400   0.100
     1746                1.0                             1.000   0.167   0.000
     1747            }
     1748        }
     1749        "orange-to-blue" {
     1750            return {
     1751                0.0                             1.000   0.167   0.000
     1752                0.09090909090909091             1.000   0.400   0.100
     1753                0.18181818181818182             1.000   0.600   0.200
     1754                0.2727272727272727              1.000   0.800   0.400
     1755                0.36363636363636365             1.000   0.933   0.600
     1756                0.45454545454545453             1.000   1.000   0.800
     1757                0.5454545454545454              0.800   1.000   1.000
     1758                0.6363636363636364              0.600   0.933   1.000
     1759                0.7272727272727273              0.400   0.800   1.000
     1760                0.8181818181818182              0.200   0.600   1.000
     1761                0.9090909090909091              0.100   0.400   1.000
     1762                1.0                             0.000   0.167   1.000
     1763            }
     1764        }
     1765        "rainbow" {
     1766            set clist {
     1767                "#EE82EE"
     1768                "#4B0082"
     1769                "blue"
     1770                "#008000"
     1771                "yellow"
     1772                "#FFA500"
     1773                "red"
     1774            }
     1775        }
     1776        "BGYOR" {
     1777            set clist {
     1778                "blue"
     1779                "#008000"
     1780                "yellow"
     1781                "#FFA500"
     1782                "red"
     1783            }
     1784        }
     1785        "ROYGB" {
     1786            set clist {
     1787                "red"
     1788                "#FFA500"
     1789                "yellow"
     1790                "#008000"
     1791                "blue"
     1792            }
     1793        }
     1794        "RYGCB" {
     1795            set clist {
     1796                "red"
     1797                "yellow"
     1798                "green"
     1799                "cyan"
     1800                "blue"
     1801            }
     1802        }
     1803        "BCGYR" {
     1804            set clist {
     1805                "blue"
     1806                "cyan"
     1807                "green"
     1808                "yellow"
     1809                "red"
     1810            }
     1811        }
     1812        "spectral" {
     1813            return {
     1814                0.0 0.150 0.300 1.000
     1815                0.1 0.250 0.630 1.000
     1816                0.2 0.450 0.850 1.000
     1817                0.3 0.670 0.970 1.000
     1818                0.4 0.880 1.000 1.000
     1819                0.5 1.000 1.000 0.750
     1820                0.6 1.000 0.880 0.600
     1821                0.7 1.000 0.680 0.450
     1822                0.8 0.970 0.430 0.370
     1823                0.9 0.850 0.150 0.196
     1824                1.0 0.650 0.000 0.130
     1825            }
     1826        }
     1827        "green-to-magenta" {
     1828            return {
     1829                0.0 0.000 0.316 0.000
     1830                0.06666666666666667 0.000 0.526 0.000
     1831                0.13333333333333333 0.000 0.737 0.000
     1832                0.2 0.000 0.947 0.000
     1833                0.26666666666666666 0.316 1.000 0.316
     1834                0.3333333333333333 0.526 1.000 0.526
     1835                0.4 0.737 1.000 0.737
     1836                0.4666666666666667 1.000 1.000 1.000
     1837                0.5333333333333333 1.000 0.947 1.000
     1838                0.6 1.000 0.737 1.000
     1839                0.6666666666666666 1.000 0.526 1.000
     1840                0.7333333333333333 1.000 0.316 1.000
     1841                0.8 0.947 0.000 0.947
     1842                0.8666666666666667 0.737 0.000 0.737
     1843                0.9333333333333333 0.526 0.000 0.526
     1844                1.0 0.316 0.000 0.316
     1845            }
     1846        }
     1847        "greyscale" {
     1848            return {
     1849                0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
     1850            }
     1851        }
     1852        "nanohub" {
     1853            set clist "white yellow green cyan blue magenta"
     1854        }
     1855        default {
     1856            set clist $colors
     1857        }
    18581858    }
    18591859    set cmap {}
     
    18731873    set cmap [ColorsToColormap $style(-color)]
    18741874    if { [llength $cmap] == 0 } {
    1875         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     1875        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    18761876    }
    18771877    if { ![info exists _settings(volume-opacity)] } {
     
    19091909    array unset _limits $dataobj-*
    19101910    foreach comp [$dataobj components] {
    1911         set tag $dataobj-$comp
    1912         if { ![info exists _limits($tag)] } {
    1913             set data [$dataobj blob $comp]
    1914             set tmpfile file[pid].vtk
    1915             set f [open "$tmpfile" "w"]
    1916             fconfigure $f -translation binary -encoding binary
    1917             puts $f $data
    1918             close $f
    1919             set reader [vtkDataSetReader $tag-xvtkDataSetReader]
    1920             $reader SetFileName $tmpfile
    1921             $reader ReadAllScalarsOn
    1922             $reader ReadAllVectorsOn
    1923             $reader ReadAllFieldsOn
    1924             $reader Update
    1925             set output [$reader GetOutput]
    1926             set _limits($tag) [$output GetBounds]
    1927             set pointData [$output GetPointData]
    1928             puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
    1929             puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
    1930             puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
    1931             set fieldData [$output GetFieldData]
    1932             set pointData [$output GetPointData]
    1933             puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
    1934             for { set i 0 } { $i < [$fieldData GetNumberOfArrays] } { incr i } {
    1935                 puts stderr [$fieldData GetArrayName $i]
    1936             }
    1937             puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
    1938             for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } {
    1939                 set name [$pointData GetArrayName $i]
    1940                 if { ![info exists _fields($name)] } {
    1941                     $itk_component(field) choices insert end "$name" "$name"
    1942                     set _fields($name) 1
    1943                 }
    1944             }
    1945             puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
    1946             puts stderr "point \#components=[$pointData GetNumberOfComponents]"
    1947             puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]"
    1948             puts stderr "point \#tuples=[$pointData GetNumberOfTuples]"
    1949             puts stderr "point \#scalars=[$pointData GetScalars]"
    1950             puts stderr vectors=[$pointData GetVectors]
    1951             rename $output ""
    1952             rename $reader ""
    1953             file delete $tmpfile
    1954         }
     1911        set tag $dataobj-$comp
     1912        if { ![info exists _limits($tag)] } {
     1913            set data [$dataobj blob $comp]
     1914            set tmpfile file[pid].vtk
     1915            set f [open "$tmpfile" "w"]
     1916            fconfigure $f -translation binary -encoding binary
     1917            puts $f $data
     1918            close $f
     1919            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
     1920            $reader SetFileName $tmpfile
     1921            $reader ReadAllScalarsOn
     1922            $reader ReadAllVectorsOn
     1923            $reader ReadAllFieldsOn
     1924            $reader Update
     1925            set output [$reader GetOutput]
     1926            set _limits($tag) [$output GetBounds]
     1927            set pointData [$output GetPointData]
     1928            puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
     1929            puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
     1930            puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
     1931            set fieldData [$output GetFieldData]
     1932            set pointData [$output GetPointData]
     1933            puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
     1934            for { set i 0 } { $i < [$fieldData GetNumberOfArrays] } { incr i } {
     1935                puts stderr [$fieldData GetArrayName $i]
     1936            }
     1937            puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
     1938            for { set i 0 } { $i < [$pointData GetNumberOfArrays] } { incr i } {
     1939                set name [$pointData GetArrayName $i]
     1940                if { ![info exists _fields($name)] } {
     1941                    $itk_component(field) choices insert end "$name" "$name"
     1942                    set _fields($name) 1
     1943                }
     1944            }
     1945            puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
     1946            puts stderr "point \#components=[$pointData GetNumberOfComponents]"
     1947            puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]"
     1948            puts stderr "point \#tuples=[$pointData GetNumberOfTuples]"
     1949            puts stderr "point \#scalars=[$pointData GetScalars]"
     1950            puts stderr vectors=[$pointData GetVectors]
     1951            rename $output ""
     1952            rename $reader ""
     1953            file delete $tmpfile
     1954        }
    19551955        foreach { xMin xMax yMin yMax zMin zMax} $_limits($tag) break
    1956         if {![info exists limits(xmin)] || $limits(xmin) > $xMin} {
    1957             set limits(xmin) $xMin
    1958         }
    1959         if {![info exists limits(xmax)] || $limits(xmax) < $xMax} {
    1960             set limits(xmax) $xMax
    1961         }
    1962         if {![info exists limits(ymin)] || $limits(ymin) > $yMin} {
    1963             set limits(ymin) $xMin
    1964         }
    1965         if {![info exists limits(ymax)] || $limits(ymax) < $yMax} {
    1966             set limits(ymax) $yMax
    1967         }
    1968         if {![info exists limits(zmin)] || $limits(zmin) > $zMin} {
    1969             set limits(zmin) $zMin
    1970         }
    1971         if {![info exists limits(zmax)] || $limits(zmax) < $zMax} {
    1972             set limits(zmax) $zMax
    1973         }
     1956        if {![info exists limits(xmin)] || $limits(xmin) > $xMin} {
     1957            set limits(xmin) $xMin
     1958        }
     1959        if {![info exists limits(xmax)] || $limits(xmax) < $xMax} {
     1960            set limits(xmax) $xMax
     1961        }
     1962        if {![info exists limits(ymin)] || $limits(ymin) > $yMin} {
     1963            set limits(ymin) $xMin
     1964        }
     1965        if {![info exists limits(ymax)] || $limits(ymax) < $yMax} {
     1966            set limits(ymax) $yMax
     1967        }
     1968        if {![info exists limits(zmin)] || $limits(zmin) > $zMin} {
     1969            set limits(zmin) $zMin
     1970        }
     1971        if {![info exists limits(zmax)] || $limits(zmax) < $zMax} {
     1972            set limits(zmax) $zMax
     1973        }
    19741974    }
    19751975    return [array get limits]
     
    20152015        -width 10 \
    20162016        -showvalue off \
    2017         -command [itcl::code $this AdjustSetting volume-opacity]
     2017        -command [itcl::code $this AdjustSetting volume-opacity]
    20182018
    20192019    blt::table $inner \
     
    20602060    label $inner.mode_l -text "Mode" -font "Arial 9"
    20612061    itk_component add streammode {
    2062         Rappture::Combobox $inner.mode -width 10 -editable no
     2062        Rappture::Combobox $inner.mode -width 10 -editable no
    20632063    }
    20642064    $inner.mode choices insert end \
     
    20742074        -width 10 \
    20752075        -showvalue off \
    2076         -command [itcl::code $this AdjustSetting streamlines-opacity]
     2076        -command [itcl::code $this AdjustSetting streamlines-opacity]
    20772077
    20782078    label $inner.density_l -text "Number of Seeds" -font "Arial 9"
     
    20812081        -width 10 \
    20822082        -showvalue on \
    2083         -command [itcl::code $this AdjustSetting streamlines-numpoints]
     2083        -command [itcl::code $this AdjustSetting streamlines-numpoints]
    20842084
    20852085    label $inner.scale_l -text "Scale" -font "Arial 9"
     
    20882088        -width 10 \
    20892089        -showvalue off \
    2090         -command [itcl::code $this AdjustSetting streamlines-scale]
     2090        -command [itcl::code $this AdjustSetting streamlines-scale]
    20912091
    20922092    label $inner.field_l -text "Field" -font "Arial 9"
    20932093    itk_component add field {
    2094         Rappture::Combobox $inner.field -width 10 -editable no
     2094        Rappture::Combobox $inner.field -width 10 -editable no
    20952095    }
    20962096    bind $inner.field <<Value>> \
    2097         [itcl::code $this AdjustSetting streamlines-field]
     2097        [itcl::code $this AdjustSetting streamlines-field]
    20982098
    20992099    label $inner.palette_l -text "Palette" -font "Arial 9"
    21002100    itk_component add palette {
    2101         Rappture::Combobox $inner.palette -width 10 -editable no
     2101        Rappture::Combobox $inner.palette -width 10 -editable no
    21022102    }
    21032103    $inner.palette choices insert end \
    2104         "BCGYR"              "BCGYR"            \
    2105         "BGYOR"              "BGYOR"            \
    2106         "blue"               "blue"             \
    2107         "blue-to-brown"      "blue-to-brown"    \
    2108         "blue-to-orange"     "blue-to-orange"   \
    2109         "blue-to-grey"       "blue-to-grey"     \
    2110         "green-to-magenta"   "green-to-magenta" \
    2111         "greyscale"          "greyscale"        \
    2112         "nanohub"            "nanohub"          \
    2113         "rainbow"            "rainbow"          \
    2114         "spectral"           "spectral"         \
    2115         "ROYGB"              "ROYGB"            \
    2116         "RYGCB"              "RYGCB"            \
    2117         "brown-to-blue"      "brown-to-blue"    \
    2118         "grey-to-blue"       "grey-to-blue"     \
    2119         "orange-to-blue"     "orange-to-blue"   
     2104        "BCGYR"              "BCGYR"            \
     2105        "BGYOR"              "BGYOR"            \
     2106        "blue"               "blue"             \
     2107        "blue-to-brown"      "blue-to-brown"    \
     2108        "blue-to-orange"     "blue-to-orange"   \
     2109        "blue-to-grey"       "blue-to-grey"     \
     2110        "green-to-magenta"   "green-to-magenta" \
     2111        "greyscale"          "greyscale"        \
     2112        "nanohub"            "nanohub"          \
     2113        "rainbow"            "rainbow"          \
     2114        "spectral"           "spectral"         \
     2115        "ROYGB"              "ROYGB"            \
     2116        "RYGCB"              "RYGCB"            \
     2117        "brown-to-blue"      "brown-to-blue"    \
     2118        "grey-to-blue"       "grey-to-blue"     \
     2119        "orange-to-blue"     "orange-to-blue"   
    21202120
    21212121    $itk_component(palette) value "BCGYR"
    21222122    bind $inner.palette <<Value>> \
    2123         [itcl::code $this AdjustSetting streamlines-palette]
     2123        [itcl::code $this AdjustSetting streamlines-palette]
    21242124
    21252125    blt::table $inner \
     
    21372137        9,0 $inner.palette_l   -anchor w -pady 2  \
    21382138        9,1 $inner.palette     -anchor w -pady 2  \
    2139        
     2139       
    21402140
    21412141    blt::table configure $inner r* c* -resize none
     
    21842184
    21852185    itk_component add axismode {
    2186         Rappture::Combobox $inner.mode -width 10 -editable no
     2186        Rappture::Combobox $inner.mode -width 10 -editable no
    21872187    }
    21882188    $inner.mode choices insert end \
     
    22492249    set inner [$itk_component(main) insert end \
    22502250        -title "Cutplane Settings" \
    2251         -icon [Rappture::icon cutbutton]]
     2251        -icon [Rappture::icon cutbutton]]
    22522252
    22532253    $inner configure -borderwidth 4
     
    22822282        -width 10 \
    22832283        -showvalue off \
    2284         -command [itcl::code $this AdjustSetting cutplane-opacity]
     2284        -command [itcl::code $this AdjustSetting cutplane-opacity]
    22852285    $inner.opacity set $_settings(cutplane-opacity)
    22862286
     
    23672367
    23682368    blt::table $inner \
    2369         0,0 $inner.visible              -anchor w -pady 2 -cspan 4 \
    2370         1,0 $inner.lighting             -anchor w -pady 2 -cspan 4 \
    2371         2,0 $inner.wireframe            -anchor w -pady 2 -cspan 4 \
    2372         3,0 $inner.edges                -anchor w -pady 2 -cspan 4 \
    2373         4,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
    2374         5,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
     2369        0,0 $inner.visible              -anchor w -pady 2 -cspan 4 \
     2370        1,0 $inner.lighting             -anchor w -pady 2 -cspan 4 \
     2371        2,0 $inner.wireframe            -anchor w -pady 2 -cspan 4 \
     2372        3,0 $inner.edges                -anchor w -pady 2 -cspan 4 \
     2373        4,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
     2374        5,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
    23752375        6,0 $itk_component(xCutButton)  -anchor e -padx 2 -pady 2 \
    23762376        7,0 $itk_component(xCutScale)   -fill y \
     
    24142414                "qx" - "qy" - "qz" - "qw" {
    24152415                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    2416                     $_arcball quaternion $q
    2417                     EventuallyRotate $q
     2416                    $_arcball quaternion $q
     2417                    EventuallyRotate $q
    24182418                }
    24192419                "zoom" {
     
    24492449        foreach comp [$dataobj components] {
    24502450            set tag $dataobj-$comp
    2451             #set contents [ConvertToVtkData $dataobj $comp]
    2452             set contents [$dataobj blob $comp]
    2453             append bytes "$contents\n\n"
     2451            #set contents [ConvertToVtkData $dataobj $comp]
     2452            set contents [$dataobj blob $comp]
     2453            append bytes "$contents\n\n"
    24542454        }
    24552455    }
     
    24592459itcl::body Rappture::VtkStreamlinesViewer::GetImage { args } {
    24602460    if { [image width $_image(download)] > 0 &&
    2461         [image height $_image(download)] > 0 } {
    2462         set bytes [$_image(download) data -format "jpeg -quality 100"]
    2463         set bytes [Rappture::encoding::decode -as b64 $bytes]
    2464         return [list .jpg $bytes]
     2461        [image height $_image(download)] > 0 } {
     2462        set bytes [$_image(download) data -format "jpeg -quality 100"]
     2463        set bytes [Rappture::encoding::decode -as b64 $bytes]
     2464        return [list .jpg $bytes]
    24652465    }
    24662466    return ""
     
    24842484
    24852485    button $inner.ok -text "Save" \
    2486         -highlightthickness 0 -pady 2 -padx 3 \
     2486        -highlightthickness 0 -pady 2 -padx 3 \
    24872487        -command $command \
    2488         -compound left \
    2489         -image [Rappture::icon download]
     2488        -compound left \
     2489        -image [Rappture::icon download]
    24902490
    24912491    button $inner.cancel -text "Cancel" \
    2492         -highlightthickness 0 -pady 2 -padx 3 \
    2493         -command [list $popup deactivate] \
    2494         -compound left \
    2495         -image [Rappture::icon cancel]
     2492        -highlightthickness 0 -pady 2 -padx 3 \
     2493        -command [list $popup deactivate] \
     2494        -compound left \
     2495        -image [Rappture::icon cancel]
    24962496
    24972497    blt::table $inner \
     
    25132513    set style [$dataobj style $comp]
    25142514    array set settings {
    2515         -color \#808080
    2516         -edges 0
    2517         -edgecolor black
    2518         -linewidth 1.0
    2519         -opacity 0.4
    2520         -wireframe 0
    2521         -lighting 1
    2522         -seeds 1
    2523         -seedcolor white
    2524         -visible 1
     2515        -color \#808080
     2516        -edges 0
     2517        -edgecolor black
     2518        -linewidth 1.0
     2519        -opacity 0.4
     2520        -wireframe 0
     2521        -lighting 1
     2522        -seeds 1
     2523        -seedcolor white
     2524        -visible 1
    25252525    }
    25262526    if { $dataobj != $_first } {
    2527         set settings(-opacity) 1
     2527        set settings(-opacity) 1
    25282528    }
    25292529    array set settings $style
     
    25322532    set seeds [$dataobj hints seeds]
    25332533    if { $seeds != "" && ![info exists _seeds($dataobj)] } {
    2534         set length [string length $seeds]
    2535         SendCmd "streamlines seed fmesh 200 data follows $length $tag"
    2536         SendCmd "$seeds"
    2537         set _seeds($dataobj) 1
     2534        set length [string length $seeds]
     2535        SendCmd "streamlines seed fmesh 200 data follows $length $tag"
     2536        SendCmd "$seeds"
     2537        set _seeds($dataobj) 1
    25382538    }
    25392539    SendCmd "cutplane add $tag"
     
    25452545    #SendCmd "cutplane visible $tag"
    25462546    foreach axis { x y z } {
    2547         SendCmd "cutplane slice $axis 1.0 $tag"
    2548         SendCmd "cutplane axis $axis 0 $tag"
     2547        SendCmd "cutplane slice $axis 1.0 $tag"
     2548        SendCmd "cutplane axis $axis 0 $tag"
    25492549    }
    25502550
     
    25672567itcl::body Rappture::VtkStreamlinesViewer::IsValidObject { dataobj } {
    25682568    if {[catch {$dataobj isa Rappture::Field} valid] != 0 || !$valid} {
    2569         return 0
     2569        return 0
    25702570    }
    25712571    return 1
     
    25932593        $_image(legend) configure -data $bytes
    25942594        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    2595         if { [catch {DrawLegend $_title} errs] != 0 } {
    2596             puts stderr errs=$errs
    2597         }
     2595        if { [catch {DrawLegend $_title} errs] != 0 } {
     2596            puts stderr errs=$errs
     2597        }
    25982598    }
    25992599}
     
    26022602# DrawLegend --
    26032603#
    2604 #       Draws the legend in it's own canvas which resides to the right
    2605 #       of the contour plot area.
     2604#       Draws the legend in it's own canvas which resides to the right
     2605#       of the contour plot area.
    26062606#
    26072607itcl::body Rappture::VtkStreamlinesViewer::DrawLegend { name } {
     
    26132613   
    26142614    if { [info exists _fields($name)] } {
    2615         foreach { title units } $_fields($name) break
    2616         if { $units != "" } {
    2617             set title [format "%s (%s)" $title $units]
    2618         }
     2615        foreach { title units } $_fields($name) break
     2616        if { $units != "" } {
     2617            set title [format "%s (%s)" $title $units]
     2618        }
    26192619    } else {
    2620         set title $name
     2620        set title $name
    26212621    }
    26222622    if { $_settings(legend-visible) } {
    2623         set x [expr $w - 2]
    2624         if { [$c find withtag "legend"] == "" } {
    2625             set y 2
    2626             $c create text $x $y \
    2627                 -anchor ne \
    2628                 -fill $itk_option(-plotforeground) -tags "title legend" \
    2629                 -font $font
    2630             incr y $lineht
    2631             $c create text $x $y \
    2632                 -anchor ne \
    2633                 -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2634                 -font $font
    2635             incr y $lineht
    2636             $c create image $x $y \
    2637                 -anchor ne \
    2638                 -image $_image(legend) -tags "colormap legend"
    2639             $c create text $x [expr {$h-2}] \
    2640                 -anchor se \
    2641                 -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2642                 -font $font
    2643             #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
    2644             $c bind colormap <Leave> [itcl::code $this LeaveLegend]
    2645             $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    2646         }
    2647         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2648         $c bind title <Enter> [itcl::code $this Combo activate]
    2649         $c bind title <Leave> [itcl::code $this Combo deactivate]
    2650         # Reset the item coordinates according the current size of the plot.
    2651         $c itemconfigure title -text $title
    2652         if { $_limits(vmin) != "" } {
    2653             $c itemconfigure vmin -text [format %g $_limits(vmin)]
    2654         }
    2655         if { $_limits(vmax) != "" } {
    2656             $c itemconfigure vmax -text [format %g $_limits(vmax)]
    2657         }
    2658         set y 2
    2659         $c coords title $x $y
    2660         incr y $lineht
    2661         $c coords vmax $x $y
    2662         incr y $lineht
    2663         $c coords colormap $x $y
    2664         $c coords vmin $x [expr {$h - 2}]
     2623        set x [expr $w - 2]
     2624        if { [$c find withtag "legend"] == "" } {
     2625            set y 2
     2626            $c create text $x $y \
     2627                -anchor ne \
     2628                -fill $itk_option(-plotforeground) -tags "title legend" \
     2629                -font $font
     2630            incr y $lineht
     2631            $c create text $x $y \
     2632                -anchor ne \
     2633                -fill $itk_option(-plotforeground) -tags "vmax legend" \
     2634                -font $font
     2635            incr y $lineht
     2636            $c create image $x $y \
     2637                -anchor ne \
     2638                -image $_image(legend) -tags "colormap legend"
     2639            $c create text $x [expr {$h-2}] \
     2640                -anchor se \
     2641                -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2642                -font $font
     2643            #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
     2644            $c bind colormap <Leave> [itcl::code $this LeaveLegend]
     2645            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
     2646        }
     2647        $c bind title <ButtonPress> [itcl::code $this Combo post]
     2648        $c bind title <Enter> [itcl::code $this Combo activate]
     2649        $c bind title <Leave> [itcl::code $this Combo deactivate]
     2650        # Reset the item coordinates according the current size of the plot.
     2651        $c itemconfigure title -text $title
     2652        if { $_limits(vmin) != "" } {
     2653            $c itemconfigure vmin -text [format %g $_limits(vmin)]
     2654        }
     2655        if { $_limits(vmax) != "" } {
     2656            $c itemconfigure vmax -text [format %g $_limits(vmax)]
     2657        }
     2658        set y 2
     2659        $c coords title $x $y
     2660        incr y $lineht
     2661        $c coords vmax $x $y
     2662        incr y $lineht
     2663        $c coords colormap $x $y
     2664        $c coords vmin $x [expr {$h - 2}]
    26652665    }
    26662666}
     
    27062706
    27072707    if { [info exists _fields($_title)] } {
    2708         foreach { title units } $_fields($_title) break
    2709         if { $units != "" } {
    2710             set title [format "%s (%s)" $title $units]
    2711         }
     2708        foreach { title units } $_fields($_title) break
     2709        if { $units != "" } {
     2710            set title [format "%s (%s)" $title $units]
     2711        }
    27122712    } else {
    2713         set title $_title
     2713        set title $_title
    27142714    }
    27152715    # Make a swatch of the selected color
    27162716    if { [catch { $_image(legend) get 10 $imgY } pixel] != 0 } {
    2717         #puts stderr "out of range: $imgY"
    2718         return
     2717        #puts stderr "out of range: $imgY"
     2718        return
    27192719    }
    27202720    if { ![info exists _image(swatch)] } {
    2721         set _image(swatch) [image create photo -width 24 -height 24]
     2721        set _image(swatch) [image create photo -width 24 -height 24]
    27222722    }
    27232723    set color [eval format "\#%02x%02x%02x" $pixel]
     
    27282728    # Compute the value of the point
    27292729    if { [info exists _limits(vmax)] && [info exists _limits(vmin)] } {
    2730         set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
    2731         set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
     2730        set t [expr 1.0 - (double($imgY) / double($imgHeight-1))]
     2731        set value [expr $t * ($_limits(vmax) - $_limits(vmin)) + $_limits(vmin)]
    27322732    } else {
    2733         set value 0.0
     2733        set value 0.0
    27342734    }
    27352735    set tipx [expr $x + 15]
     
    27602760            SendCmd "cutplane slice $axis $newpos"
    27612761        }
    2762         "tooltip" {
    2763             set axis [lindex $args 0]
    2764             set val [$itk_component(${axis}CutScale) get]
    2765             return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
    2766         }
     2762        "tooltip" {
     2763            set axis [lindex $args 0]
     2764            set val [$itk_component(${axis}CutScale) get]
     2765            return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
     2766        }
    27672767        default {
    27682768            error "bad option \"$option\": should be axis, move, or tooltip"
     
    27872787    switch -- $option {
    27882788        post {
    2789             foreach { x1 y1 x2 y2 } [$c bbox title] break
    2790             set x1 [expr [winfo width $itk_component(view)] - [winfo reqwidth $itk_component(fieldmenu)]]
    2791             set x [expr $x1 + [winfo rootx $itk_component(view)]]
    2792             set y [expr $y2 + [winfo rooty $itk_component(view)]]
    2793             puts stderr "combo x=$x y=$y"
    2794             tk_popup $itk_component(fieldmenu) $x $y
     2789            foreach { x1 y1 x2 y2 } [$c bbox title] break
     2790            set x1 [expr [winfo width $itk_component(view)] - [winfo reqwidth $itk_component(fieldmenu)]]
     2791            set x [expr $x1 + [winfo rootx $itk_component(view)]]
     2792            set y [expr $y2 + [winfo rooty $itk_component(view)]]
     2793            puts stderr "combo x=$x y=$y"
     2794            tk_popup $itk_component(fieldmenu) $x $y
    27952795        }
    27962796        activate {
    2797             $c itemconfigure title -fill red
     2797            $c itemconfigure title -fill red
    27982798        }
    27992799        deactivate {
    2800             $c itemconfigure title -fill white
    2801         }
    2802         invoke {
    2803             $itk_component(field) value $_currentField
    2804             AdjustSetting streamlines-field
    2805         }
     2800            $c itemconfigure title -fill white
     2801        }
     2802        invoke {
     2803            $itk_component(field) value $_currentField
     2804            AdjustSetting streamlines-field
     2805        }
    28062806        default {
    28072807            error "bad option \"$option\": should be post, unpost, select"
  • branches/blt4/gui/scripts/vtkviewer-obsolete.tcl

    r2538 r2745  
    108108   
    109109    array set _limits {
    110         xMin    0
    111         xMax    1
    112         yMin    0
    113         yMax    1
    114         zMin    0
    115         zMax    1
    116         vMin    0
    117         vMax    1
     110        xMin    0
     111        xMax    1
     112        yMin    0
     113        yMax    1
     114        zMin    0
     115        zMax    1
     116        vMin    0
     117        vMax    1
    118118    }
    119119
    120120
    121121    foreach { key value } {
    122         edges           1
    123         axes            1
    124         smallaxes       0
    125         wireframe       0
     122        edges           1
     123        axes            1
     124        smallaxes       0
     125        wireframe       0
    126126    } {
    127127        set _settings($this-$key) $value
     
    161161    pack $itk_component(reset) -padx 4 -pady 4
    162162    Rappture::Tooltip::for $itk_component(reset) \
    163         "Reset the view to the default zoom level"
     163        "Reset the view to the default zoom level"
    164164
    165165    itk_component add zoomin {
     
    172172        ignore -borderwidth
    173173        rename -highlightbackground -controlbackground controlBackground \
    174             Background
     174            Background
    175175    }
    176176    pack $itk_component(zoomin) -padx 4 -pady 4
     
    186186        ignore -borderwidth
    187187        rename -highlightbackground -controlbackground controlBackground \
    188             Background
     188            Background
    189189    }
    190190    pack $itk_component(zoomout) -padx 4 -pady 4
     
    205205            -width 1 -height 1
    206206    } {
    207         # empty
     207        # empty
    208208    }
    209209    pack $itk_component(plot) -expand yes -fill both
     
    299299        set _obj2width($dataobj) $params(-width)
    300300        set _obj2raise($dataobj) $params(-raise)
    301        
     301       
    302302        after cancel [itcl::code $this Rebuild]
    303303        after idle [itcl::code $this Rebuild]
     
    346346            catch {unset _obj2width($dataobj)}
    347347            catch {unset _obj2raise($dataobj)}
    348             foreach actor $_actors($dataobj) {
    349                 $_renderer RemoveActor $actor
    350             }
    351             array unset _actors $dataobj
    352             array unset _dataobj2vtk $dataobj-*
     348            foreach actor $_actors($dataobj) {
     349                $_renderer RemoveActor $actor
     350            }
     351            array unset _actors $dataobj
     352            array unset _dataobj2vtk $dataobj-*
    353353            set changed 1
    354354        }
     
    413413            FixSettings smallaxes
    414414
    415             set img [image create photo -file junk.jpg]
     415            set img [image create photo -file junk.jpg]
    416416            set bytes [$img data -format "jpeg -quality 100"]
    417417            set bytes [Rappture::encoding::decode -as b64 $bytes]
    418             image delete $img
     418            image delete $img
    419419            return [list .jpg $bytes]
    420420        }
     
    442442    }
    443443    foreach dataobj $_dlist {
    444         foreach actor $_actors($dataobj) {
    445             $_renderer RemoveActor $actor
    446         }
     444        foreach actor $_actors($dataobj) {
     445            $_renderer RemoveActor $actor
     446        }
    447447    }
    448448    array unset _actors
     
    474474            $_renderer ResetCamera
    475475            _3dView 90 -90
    476             array set camera {
    477                 xpos 1.73477e-06 ypos 74.7518 zpos -1.73477e-06
    478                 xviewup 5.38569e-16 yviewup 2.32071e-08 zviewup 1.0
    479                 xfocal 0.0 yfocal 0.0 zfocal 0.0
    480                 angle 30
    481             }
    482             set dataobj [lindex $_dlist end]
    483             if { $dataobj != "" } {
    484                 array set camera [$dataobj hints camera]
    485             }
    486             if { [info exists camera(clipmin)] } {
    487                 $cam SetClippingRange $camera(clipmin) $camera(clipmax)
    488             }
    489             if { [info exists camera(parallelscale)] } {
    490                 $cam SetParallelScale $camera(parallelscale)
    491             }
    492             $cam SetViewAngle $camera(angle)
    493             $cam SetFocalPoint $camera(xfocal) $camera(yfocal) $camera(zfocal)
    494             $cam SetPosition $camera(xpos) $camera(ypos) $camera(zpos)
    495             $cam SetViewUp $camera(xviewup) $camera(yviewup) $camera(zviewup)
    496             foreach key [array names camera] {
    497                 set _settings($this-$key) $camera($key)
    498             }
    499             $cam ComputeViewPlaneNormal
     476            array set camera {
     477                xpos 1.73477e-06 ypos 74.7518 zpos -1.73477e-06
     478                xviewup 5.38569e-16 yviewup 2.32071e-08 zviewup 1.0
     479                xfocal 0.0 yfocal 0.0 zfocal 0.0
     480                angle 30
     481            }
     482            set dataobj [lindex $_dlist end]
     483            if { $dataobj != "" } {
     484                array set camera [$dataobj hints camera]
     485            }
     486            if { [info exists camera(clipmin)] } {
     487                $cam SetClippingRange $camera(clipmin) $camera(clipmax)
     488            }
     489            if { [info exists camera(parallelscale)] } {
     490                $cam SetParallelScale $camera(parallelscale)
     491            }
     492            $cam SetViewAngle $camera(angle)
     493            $cam SetFocalPoint $camera(xfocal) $camera(yfocal) $camera(zfocal)
     494            $cam SetPosition $camera(xpos) $camera(ypos) $camera(zpos)
     495            $cam SetViewUp $camera(xviewup) $camera(yviewup) $camera(zviewup)
     496            foreach key [array names camera] {
     497                set _settings($this-$key) $camera($key)
     498            }
     499            $cam ComputeViewPlaneNormal
    500500            $_window Render
    501501        }
     
    535535                    # Shift the contour plot in 2D
    536536                    #
    537                     foreach dataobj $_dlist {
    538                         foreach actor $_actors($dataobj) {
    539                             foreach {ax ay az} [$actor GetPosition] break
    540                             $actor SetPosition [expr {$ax+$dx}] \
    541                                 [expr {$ay-$dy}] 0
    542                         }
    543                     }
     537                    foreach dataobj $_dlist {
     538                        foreach actor $_actors($dataobj) {
     539                            foreach {ax ay az} [$actor GetPosition] break
     540                            $actor SetPosition [expr {$ax+$dx}] \
     541                                [expr {$ay-$dy}] 0
     542                        }
     543                    }
    544544                    $_window Render
    545545                } elseif {$_dims == "3D"} {
     
    551551                    if {$theta > 178} { set theta 178 }
    552552                    set phi [expr {$_view(phi) - $dx*360}]
    553                    
     553                   
    554554                    _3dView $theta $phi
    555555                    $_window Render
     
    618618    $_window Render
    619619    if 0 {
    620         $this-vtkRenderWindow2 Render
     620        $this-vtkRenderWindow2 Render
    621621    }
    622622}
     
    644644    $_window Render
    645645    if 0 {
    646         $this-vtkRenderer2 SetBackground $r $g $b
    647         $this-vtkRenderWindow2 Render
     646        $this-vtkRenderer2 SetBackground $r $g $b
     647        $this-vtkRenderWindow2 Render
    648648    }
    649649}
     
    704704   
    705705    if 1 {
    706         #
    707         # LOOKUP TABLE FOR COLOR CONTOURS
    708         #
    709         # Use vmin/vmax if possible, otherwise get from data
    710         if {$_limits(vMin) == "" || $_limits(vMax) == ""} {
    711             set v0 0
    712             set v1 1
    713             if { [info exists _dataobj2vtk($dataobj)] } {
    714                 set pd [lindex $_dataobj2vtk($dataobj) 0]
    715                 if {"" != $pd} {
    716                     foreach {v0 v1} [$pd GetScalarRange] break
    717                 }
    718             }
    719         } else {
    720             set v0 $_limits(vMin)
    721             set v1 $_limits(vMax)
    722         }
    723     }   
     706        #
     707        # LOOKUP TABLE FOR COLOR CONTOURS
     708        #
     709        # Use vmin/vmax if possible, otherwise get from data
     710        if {$_limits(vMin) == "" || $_limits(vMax) == ""} {
     711            set v0 0
     712            set v1 1
     713            if { [info exists _dataobj2vtk($dataobj)] } {
     714                set pd [lindex $_dataobj2vtk($dataobj) 0]
     715                if {"" != $pd} {
     716                    foreach {v0 v1} [$pd GetScalarRange] break
     717                }
     718            }
     719        } else {
     720            set v0 $_limits(vMin)
     721            set v1 $_limits(vMax)
     722        }
     723    }   
    724724    # scan through all data objects and build the contours
    725725    set firstobj 1
    726726    foreach dataobj $_dlist {
    727         foreach comp [$dataobj components] {
    728             set tag $dataobj-$comp
    729             if { ![info exists _dataobj2vtk($tag)] } {
    730                 set actor [$dataobj values $comp]
    731                 set style [$dataobj style $comp]
    732                 set _dataobj2vtk($tag) $actor
    733                 lappend _actors($dataobj) $actor
    734                 $_renderer AddActor $actor
    735                 SetActorProperties $actor $style
    736                 incr id
    737             }
    738         }
    739         set firstobj 0
     727        foreach comp [$dataobj components] {
     728            set tag $dataobj-$comp
     729            if { ![info exists _dataobj2vtk($tag)] } {
     730                set actor [$dataobj values $comp]
     731                set style [$dataobj style $comp]
     732                set _dataobj2vtk($tag) $actor
     733                lappend _actors($dataobj) $actor
     734                $_renderer AddActor $actor
     735                SetActorProperties $actor $style
     736                incr id
     737            }
     738        }
     739        set firstobj 0
    740740    }
    741741    set top [lindex [get] end]
    742742    if { $top != "" } {
    743         foreach axis { x y z } {
    744             set title [$top hints ${axis}label]
    745             set units [$top hints ${axis}units]
    746             set method Set[string toupper $axis]Title
    747             set label "$title"
    748             if { $units != "" } {
    749                 append label " ($units)"
    750             }      
    751             $_cubeAxesActor $method $label
    752         }
     743        foreach axis { x y z } {
     744            set title [$top hints ${axis}label]
     745            set units [$top hints ${axis}units]
     746            set method Set[string toupper $axis]Title
     747            set label "$title"
     748            if { $units != "" } {
     749                append label " ($units)"
     750            }      
     751            $_cubeAxesActor $method $label
     752        }
    753753    }
    754754    if 1 {
    755         _fixLimits
    756         Zoom reset
     755        _fixLimits
     756        Zoom reset
    757757
    758758    }
     
    796796        -window $tab.ss.frame
    797797    pack $tab.ss -fill both -expand yes
    798     blt::tk::scrollbar $tab.ss.xs               
    799     blt::tk::scrollbar $tab.ss.ys               
     798    blt::tk::scrollbar $tab.ss.xs               
     799    blt::tk::scrollbar $tab.ss.ys               
    800800    set inner [blt::tk::frame $tab.ss.frame]
    801801    $inner configure -borderwidth 4
     
    844844itcl::body Rappture::VtkViewerObsolete::BuildVolumeTab {} {
    845845    foreach { key value } {
    846         light           40
    847         transp          50
    848         opacity         1000
     846        light           40
     847        transp          50
     848        opacity         1000
    849849    } {
    850850        set _settings($this-$key) $value
     
    861861        -window $tab.ss.frame
    862862    pack $tab.ss -fill both -expand yes
    863     blt::tk::scrollbar $tab.ss.xs               
    864     blt::tk::scrollbar $tab.ss.ys               
     863    blt::tk::scrollbar $tab.ss.xs               
     864    blt::tk::scrollbar $tab.ss.ys               
    865865    set inner [blt::tk::frame $tab.ss.frame]
    866866    $inner configure -borderwidth 4
     
    917917            pt  [$cam GetFocalPoint] \
    918918            up  [$cam GetViewUp] \
    919             pos [$cam GetPosition] {
    920         set _settings($this-${key}focal) $pt
    921         set _settings($this-${key}up) $up
    922         set _settings($this-${key}pos) $pos
     919            pos [$cam GetPosition] {
     920        set _settings($this-${key}focal) $pt
     921        set _settings($this-${key}up) $up
     922        set _settings($this-${key}pos) $pos
    923923    }
    924924    foreach {min max} [$cam GetClippingRange] break
     
    928928    set _settings($this-angle) [$cam GetViewAngle]
    929929    foreach key { xpos ypos zpos xviewup yviewup zviewup
    930         xfocal yfocal zfocal angle clipmin clipmax parallelscale
     930        xfocal yfocal zfocal angle clipmin clipmax parallelscale
    931931    } {
    932         set out($key) $_settings($this-$key)
     932        set out($key) $_settings($this-$key)
    933933    }
    934934    puts \"[array get out]\"
     
    944944    label $inner.xposl -text "Position"
    945945    entry $inner.xpos -bg white \
    946         -textvariable [itcl::scope _settings($this-xpos)]
     946        -textvariable [itcl::scope _settings($this-xpos)]
    947947    entry $inner.ypos -bg white \
    948         -textvariable [itcl::scope _settings($this-ypos)]
     948        -textvariable [itcl::scope _settings($this-ypos)]
    949949    entry $inner.zpos -bg white \
    950         -textvariable [itcl::scope _settings($this-zpos)]
     950        -textvariable [itcl::scope _settings($this-zpos)]
    951951    label $inner.xviewupl -text "View Up"
    952952    entry $inner.xviewup -bg white \
    953         -textvariable [itcl::scope _settings($this-xviewup)]
     953        -textvariable [itcl::scope _settings($this-xviewup)]
    954954    entry $inner.yviewup -bg white \
    955         -textvariable [itcl::scope _settings($this-yviewup)]
     955        -textvariable [itcl::scope _settings($this-yviewup)]
    956956    entry $inner.zviewup -bg white \
    957         -textvariable [itcl::scope _settings($this-zviewup)]
     957        -textvariable [itcl::scope _settings($this-zviewup)]
    958958    label $inner.xfocall -text "Focal Point"
    959959    entry $inner.xfocal -bg white \
    960         -textvariable [itcl::scope _settings($this-xfocal)]
     960        -textvariable [itcl::scope _settings($this-xfocal)]
    961961    entry $inner.yfocal -bg white \
    962         -textvariable [itcl::scope _settings($this-yfocal)]
     962        -textvariable [itcl::scope _settings($this-yfocal)]
    963963    entry $inner.zfocal -bg white \
    964         -textvariable [itcl::scope _settings($this-zfocal)]
     964        -textvariable [itcl::scope _settings($this-zfocal)]
    965965    label $inner.anglel -text "View Angle"
    966966    entry $inner.angle -bg white \
    967         -textvariable [itcl::scope _settings($this-angle)]
     967        -textvariable [itcl::scope _settings($this-angle)]
    968968    label $inner.clipl -text "Clipping Range"
    969969    entry $inner.clipmin -bg white \
    970         -textvariable [itcl::scope _settings($this-clipmin)]
     970        -textvariable [itcl::scope _settings($this-clipmin)]
    971971    entry $inner.clipmax -bg white \
    972         -textvariable [itcl::scope _settings($this-clipmax)]
     972        -textvariable [itcl::scope _settings($this-clipmax)]
    973973    label $inner.pscalel -text "Parallel Scale"
    974974    entry $inner.pscale -bg white \
    975         -textvariable [itcl::scope _settings($this-parallelscale)]
     975        -textvariable [itcl::scope _settings($this-parallelscale)]
    976976
    977977    button $inner.refresh -text "Refresh" \
    978         -command [itcl::code $this UpdateCameraInfo]
     978        -command [itcl::code $this UpdateCameraInfo]
    979979    blt::table $inner \
    980         0,0 $inner.xposl -anchor w -pady 2 \
    981         1,0 $inner.xpos -pady 2 -fill x\
    982         2,0 $inner.ypos -pady 2 -fill x\
    983         3,0 $inner.zpos -pady 2 -fill x\
    984         4,0 $inner.xviewupl -anchor w -pady 2 \
    985         5,0 $inner.xviewup -pady 2 -fill x \
    986         6,0 $inner.yviewup -pady 2 -fill x \
    987         7,0 $inner.zviewup -pady 2 -fill x \
    988         8,0 $inner.xfocall -anchor w -pady 2 \
    989         9,0 $inner.xfocal -pady 2 -fill x \
    990         10,0 $inner.yfocal -pady 2 -fill x \
    991         11,0 $inner.zfocal -pady 2 -fill x \
    992         16,0 $inner.anglel -anchor w -pady 2 \
    993         17,0 $inner.angle -pady 2 -fill x \
    994         18,0 $inner.clipl -anchor w -pady 2 \
    995         19,0 $inner.clipmin -pady 2 -fill x \
    996         20,0 $inner.clipmax -pady 2 -fill x \
    997         21,0 $inner.pscalel -anchor w -pady 2 \
    998         22,0 $inner.pscale -pady 2 -fill x \
    999         23,0 $inner.refresh
     980        0,0 $inner.xposl -anchor w -pady 2 \
     981        1,0 $inner.xpos -pady 2 -fill x\
     982        2,0 $inner.ypos -pady 2 -fill x\
     983        3,0 $inner.zpos -pady 2 -fill x\
     984        4,0 $inner.xviewupl -anchor w -pady 2 \
     985        5,0 $inner.xviewup -pady 2 -fill x \
     986        6,0 $inner.yviewup -pady 2 -fill x \
     987        7,0 $inner.zviewup -pady 2 -fill x \
     988        8,0 $inner.xfocall -anchor w -pady 2 \
     989        9,0 $inner.xfocal -pady 2 -fill x \
     990        10,0 $inner.yfocal -pady 2 -fill x \
     991        11,0 $inner.zfocal -pady 2 -fill x \
     992        16,0 $inner.anglel -anchor w -pady 2 \
     993        17,0 $inner.angle -pady 2 -fill x \
     994        18,0 $inner.clipl -anchor w -pady 2 \
     995        19,0 $inner.clipmin -pady 2 -fill x \
     996        20,0 $inner.clipmax -pady 2 -fill x \
     997        21,0 $inner.pscalel -anchor w -pady 2 \
     998        22,0 $inner.pscale -pady 2 -fill x \
     999        23,0 $inner.refresh
    10001000
    10011001    blt::table configure $inner r* c* -resize none
  • branches/blt4/gui/scripts/vtkviewer.tcl

    r2742 r2745  
    126126    private variable _volume
    127127    private variable _axis
    128     private variable _reset 1      ;# indicates if camera needs to be reset
     128    private variable _reset 1      ;# indicates if camera needs to be reset
    129129                                    # to starting position.
    130130    private variable _haveSpheres 0
     
    178178
    179179    array set _outline {
    180         id -1
    181         afterId -1
    182         x1 -1
    183         y1 -1
    184         x2 -1
    185         y2 -1
     180        id -1
     181        afterId -1
     182        x1 -1
     183        y1 -1
     184        x2 -1
     185        y2 -1
    186186    }
    187187    # Initialize the view to some default parameters.
    188188    array set _view {
    189         qw              1
    190         qx              0
    191         qy              0
    192         qz              0
    193         zoom            1.0
    194         xpan            0
    195         ypan            0
    196         ortho           0
     189        qw              1
     190        qx              0
     191        qy              0
     192        qz              0
     193        zoom            1.0
     194        xpan            0
     195        ypan            0
     196        ortho           0
    197197    }
    198198    set _arcball [blt::arcball create 100 100]
     
    204204
    205205    array set _axis [subst {
    206         xgrid           0
    207         ygrid           0
    208         zgrid           0
    209         xcutaway        0
    210         ycutaway        0
    211         zcutaway        0
    212         xposition       0
    213         yposition       0
    214         zposition       0
    215         xdirection      -1
    216         ydirection      -1
    217         zdirection      -1
    218         visible         1
    219         labels          1
     206        xgrid           0
     207        ygrid           0
     208        zgrid           0
     209        xcutaway        0
     210        ycutaway        0
     211        zcutaway        0
     212        xposition       0
     213        yposition       0
     214        zposition       0
     215        xdirection      -1
     216        ydirection      -1
     217        zdirection      -1
     218        visible         1
     219        labels          1
    220220    }]
    221221    array set _volume [subst {
    222         edges           1
    223         lighting        1
    224         opacity         40
    225         visible         1
    226         wireframe       0
     222        edges           1
     223        lighting        1
     224        opacity         40
     225        visible         1
     226        wireframe       0
    227227    }]
    228228    array set _settings [subst {
    229         legend          1
     229        legend          1
    230230    }]
    231231
     
    300300    BuildCameraTab
    301301    } errs] != 0 } {
    302         puts stderr errs=$errs
     302        puts stderr errs=$errs
    303303    }
    304304    # Legend
     
    400400itcl::body Rappture::VtkViewer::DoResize {} {
    401401    if { $_width < 2 } {
    402         set _width 500
     402        set _width 500
    403403    }
    404404    if { $_height < 2 } {
    405         set _height 500
     405        set _height 500
    406406    }
    407407    #puts stderr "DoResize screen size $_width $_height"
     
    441441    if { !$_rotatePending } {
    442442        set _rotatePending 1
    443         global rotate_delay
     443        global rotate_delay
    444444        $_dispatcher event -after $rotate_delay !rotate
    445445    }
     
    462462        -description ""
    463463        -param ""
    464         -type ""
     464        -type ""
    465465    }
    466466    array set params $settings
     
    479479    set pos [lsearch -exact $dataobj $_dlist]
    480480    if {$pos < 0} {
    481         lappend _dlist $dataobj
     481        lappend _dlist $dataobj
    482482    }
    483483    set _allDataObjs($dataobj) 1
     
    505505    foreach dataobj $args {
    506506        set pos [lsearch -exact $_dlist $dataobj]
    507         if { $pos < 0 } {
    508             continue;                   # Don't know anything about it.
    509         }
    510         # Remove it from the dataobj list.
    511         set _dlist [lreplace $_dlist $pos $pos]
    512         foreach comp [$dataobj components] {
    513             SendCmd "dataset visible 0 $dataobj-$comp"
    514         }
    515         array unset _obj2ovride $dataobj-*
    516         # Append to the end of the dataobj list.
    517         lappend _dlist $dataobj
    518         set changed 1
     507        if { $pos < 0 } {
     508            continue;                   # Don't know anything about it.
     509        }
     510        # Remove it from the dataobj list.
     511        set _dlist [lreplace $_dlist $pos $pos]
     512        foreach comp [$dataobj components] {
     513            SendCmd "dataset visible 0 $dataobj-$comp"
     514        }
     515        array unset _obj2ovride $dataobj-*
     516        # Append to the end of the dataobj list.
     517        lappend _dlist $dataobj
     518        set changed 1
    519519    }
    520520    # If anything changed, then rebuild the plot
     
    540540    set op [lindex $args 0]
    541541    switch -- $op {
    542         "-objects" {
    543             # put the dataobj list in order according to -raise options
    544             set dlist {}
    545             foreach dataobj $_dlist {
    546                 if { ![IsValidObject $dataobj] } {
    547                     continue
    548                 }
    549                 if {[info exists _obj2ovride($dataobj-raise)] &&
    550                     $_obj2ovride($dataobj-raise)} {
    551                     set dlist [linsert $dlist 0 $dataobj]
    552                 } else {
    553                     lappend dlist $dataobj
    554                 }
    555             }
    556             return $dlist
    557         }
    558         "-visible" {
    559             set dlist {}
    560             foreach dataobj $_dlist {
    561                 if { ![IsValidObject $dataobj] } {
    562                     continue
    563                 }
    564                 if { ![info exists _obj2ovride($dataobj-raise)] } {
    565                     # No setting indicates that the object isn't invisible.
    566                     continue
    567                 }
    568                 # Otherwise use the -raise parameter to put the object to
    569                 # the front of the list.
    570                 if { $_obj2ovride($dataobj-raise) } {
    571                     set dlist [linsert $dlist 0 $dataobj]
    572                 } else {
    573                     lappend dlist $dataobj
    574                 }
    575             }
    576             return $dlist
    577         }          
    578         -image {
    579             if {[llength $args] != 2} {
    580                 error "wrong # args: should be \"get -image view\""
    581             }
    582             switch -- [lindex $args end] {
    583                 view {
    584                     return $_image(plot)
    585                 }
    586                 default {
    587                     error "bad image name \"[lindex $args end]\": should be view"
    588                 }
    589             }
    590         }
    591         default {
    592             error "bad option \"$op\": should be -objects or -image"
    593         }
     542        "-objects" {
     543            # put the dataobj list in order according to -raise options
     544            set dlist {}
     545            foreach dataobj $_dlist {
     546                if { ![IsValidObject $dataobj] } {
     547                    continue
     548                }
     549                if {[info exists _obj2ovride($dataobj-raise)] &&
     550                    $_obj2ovride($dataobj-raise)} {
     551                    set dlist [linsert $dlist 0 $dataobj]
     552                } else {
     553                    lappend dlist $dataobj
     554                }
     555            }
     556            return $dlist
     557        }
     558        "-visible" {
     559            set dlist {}
     560            foreach dataobj $_dlist {
     561                if { ![IsValidObject $dataobj] } {
     562                    continue
     563                }
     564                if { ![info exists _obj2ovride($dataobj-raise)] } {
     565                    # No setting indicates that the object isn't invisible.
     566                    continue
     567                }
     568                # Otherwise use the -raise parameter to put the object to
     569                # the front of the list.
     570                if { $_obj2ovride($dataobj-raise) } {
     571                    set dlist [linsert $dlist 0 $dataobj]
     572                } else {
     573                    lappend dlist $dataobj
     574                }
     575            }
     576            return $dlist
     577        }          
     578        -image {
     579            if {[llength $args] != 2} {
     580                error "wrong # args: should be \"get -image view\""
     581            }
     582            switch -- [lindex $args end] {
     583                view {
     584                    return $_image(plot)
     585                }
     586                default {
     587                    error "bad image name \"[lindex $args end]\": should be view"
     588                }
     589            }
     590        }
     591        default {
     592            error "bad option \"$op\": should be -objects or -image"
     593        }
    594594    }
    595595}
     
    608608    foreach dataobj $args {
    609609        array set bounds [limits $dataobj]
    610         if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
    611             set _limits(xmin) $bounds(xmin)
    612         }
    613         if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
    614             set _limits(xmax) $bounds(xmax)
    615         }
    616 
    617         if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
    618             set _limits(ymin) $bounds(ymin)
    619         }
    620         if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
    621             set _limits(ymax) $bounds(ymax)
    622         }
    623 
    624         if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
    625             set _limits(zmin) $bounds(zmin)
    626         }
    627         if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
    628             set _limits(zmax) $bounds(zmax)
    629         }
     610        if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
     611            set _limits(xmin) $bounds(xmin)
     612        }
     613        if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
     614            set _limits(xmax) $bounds(xmax)
     615        }
     616
     617        if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
     618            set _limits(ymin) $bounds(ymin)
     619        }
     620        if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
     621            set _limits(ymax) $bounds(ymax)
     622        }
     623
     624        if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
     625            set _limits(zmin) $bounds(zmin)
     626        }
     627        if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
     628            set _limits(zmax) $bounds(zmax)
     629        }
    630630    }
    631631}
     
    663663            set word [Rappture::filexfer::label downloadWord]
    664664            $inner.summary configure -text "$word $num in the following format:"
    665             update idletasks            ;# Fix initial sizes
     665            update idletasks            ;# Fix initial sizes
    666666            return $popup
    667667        }
     
    702702    set result [VisViewer::Connect $_hosts]
    703703    if { $result } {
    704         #puts stderr "Connected to $_hostname sid=$_sid"
     704        #puts stderr "Connected to $_hostname sid=$_sid"
    705705        set w [winfo width $itk_component(view)]
    706706        set h [winfo height $itk_component(view)]
     
    781781    set bytes [ReceiveBytes $info(-bytes)]
    782782    if { $info(-type) == "image" } {
    783         if 0 {
    784             set f [open "last.ppm" "w"]
    785             puts $f $bytes
    786             close $f
    787         }
     783        if 0 {
     784            set f [open "last.ppm" "w"]
     785            puts $f $bytes
     786            close $f
     787        }
    788788        $_image(plot) configure -data $bytes
    789         set time [clock seconds]
    790         set date [clock format $time]
     789        set time [clock seconds]
     790        set date [clock format $time]
    791791        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"       
    792         if { $_start > 0 } {
    793             set finish [clock clicks -milliseconds]
    794             #puts stderr "round trip time [expr $finish -$_start] milliseconds"
    795             set _start 0
    796         }
     792        if { $_start > 0 } {
     793            set finish [clock clicks -milliseconds]
     794            #puts stderr "round trip time [expr $finish -$_start] milliseconds"
     795            set _start 0
     796        }
    797797    } elseif { $info(type) == "print" } {
    798798        set tag $this-print-$info(-token)
     
    810810    set option [lindex $args 0]
    811811    switch -- $option {
    812         "scalar" {
    813             set option [lindex $args 1]
    814             switch -- $option {
    815                 "world" {
    816                     foreach { x y z value tag } [lrange $args 2 end] break
    817                 }
    818                 "pixel" {
    819                     foreach { x y value tag } [lrange $args 2 end] break
    820                 }
    821             }
    822         }
    823         "vector" {
    824             set option [lindex $args 1]
    825             switch -- $option {
    826                 "world" {
    827                     foreach { x y z vx vy vz tag } [lrange $args 2 end] break
    828                 }
    829                 "pixel" {
    830                     foreach { x y vx vy vz tag } [lrange $args 2 end] break
    831                 }
    832             }
    833         }
    834         "names" {
     812        "scalar" {
     813            set option [lindex $args 1]
     814            switch -- $option {
     815                "world" {
     816                    foreach { x y z value tag } [lrange $args 2 end] break
     817                }
     818                "pixel" {
     819                    foreach { x y value tag } [lrange $args 2 end] break
     820                }
     821            }
     822        }
     823        "vector" {
     824            set option [lindex $args 1]
     825            switch -- $option {
     826                "world" {
     827                    foreach { x y z vx vy vz tag } [lrange $args 2 end] break
     828                }
     829                "pixel" {
     830                    foreach { x y vx vy vz tag } [lrange $args 2 end] break
     831                }
     832            }
     833        }
     834        "names" {
    835835            foreach { name } [lindex $args 1] {
    836836                #puts stderr "Dataset: $name"
    837837            }
    838         }
    839         default {
    840             error "unknown dataset option \"$option\" from server"
    841         }
     838        }
     839        default {
     840            error "unknown dataset option \"$option\" from server"
     841        }
    842842    }
    843843}
     
    855855    set h [winfo height $itk_component(view)]
    856856    if { $w < 2 || $h < 2 } {
    857         $_dispatcher event -idle !rebuild
    858         return
     857        $_dispatcher event -idle !rebuild
     858        return
    859859    }
    860860
     
    882882    set _first [lindex [get -objects] 0]
    883883    if { $_reset || $_first == "" } {
    884         Zoom reset
    885         set _reset 0
     884        Zoom reset
     885        set _reset 0
    886886    }
    887887    FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
    888         axis-visible axis-labels \
    889         volume-edges volume-lighting volume-opacity volume-visible \
    890         volume-wireframe
     888        axis-visible axis-labels \
     889        volume-edges volume-lighting volume-opacity volume-visible \
     890        volume-wireframe
    891891
    892892    #SendCmd "imgflush"
     
    896896    set _first ""
    897897    foreach dataobj [get -objects] {
    898         if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    899             set _first $dataobj
    900         }
    901         set _obj2datasets($dataobj) ""
     898        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
     899            set _first $dataobj
     900        }
     901        set _obj2datasets($dataobj) ""
    902902        foreach comp [$dataobj components] {
    903903            set tag $dataobj-$comp
     
    907907                append _outbuf "dataset add $tag data follows $length\n"
    908908                append _outbuf $bytes
    909                 if { [$dataobj type $comp] != "spheres" } {
    910                 }
     909                if { [$dataobj type $comp] != "spheres" } {
     910                }
    911911                set _datasets($tag) 1
    912             }
    913             lappend _obj2datasets($dataobj) $tag
    914             if { [info exists _obj2ovride($dataobj-raise)] } {
    915                 SendCmd "dataset visible 1 $tag"
    916             } else {
    917                 SendCmd "dataset visible 0 $tag"
    918             }
    919             SetObjectStyle $dataobj $comp
     912            }
     913            lappend _obj2datasets($dataobj) $tag
     914            if { [info exists _obj2ovride($dataobj-raise)] } {
     915                SendCmd "dataset visible 1 $tag"
     916            } else {
     917                SendCmd "dataset visible 0 $tag"
     918            }
     919            SetObjectStyle $dataobj $comp
    920920        }
    921921    }
     
    927927    }
    928928    foreach axis { x y z } {
    929         set label [$_first hints ${axis}label]
    930         if { $label != "" } {
    931             SendCmd "axis name $axis $label"
    932         }
    933         set units [$_first hints ${axis}units]
    934         if { $units != "" } {
    935             SendCmd "axis units $axis $units"
    936         }
    937     }
    938        
     929        set label [$_first hints ${axis}label]
     930        if { $label != "" } {
     931            SendCmd "axis name $axis $label"
     932        }
     933        set units [$_first hints ${axis}units]
     934        if { $units != "" } {
     935            SendCmd "axis units $axis $units"
     936        }
     937    }
     938       
    939939    set _buffering 0;                        # Turn off buffering.
    940940
     
    957957    set flag [lindex $args 0]
    958958    switch -- $flag {
    959         "-all" {
    960             if { [llength $args] > 1 } {
    961                 error "CurrentDatasets: can't specify dataobj after \"-all\""
    962             }
    963             set dlist [get -objects]
    964         }
    965         "-visible" {
    966             if { [llength $args] > 1 } {
    967                 set dlist {}
    968                 set args [lrange $args 1 end]
    969                 foreach dataobj $args {
    970                     if { [info exists _obj2ovride($dataobj-raise)] } {
    971                         lappend dlist $dataobj
    972                     }
    973                 }
    974             } else {
    975                 set dlist [get -visible]
    976             }
    977         }          
    978         default {
    979             set dlist $args
    980         }
     959        "-all" {
     960            if { [llength $args] > 1 } {
     961                error "CurrentDatasets: can't specify dataobj after \"-all\""
     962            }
     963            set dlist [get -objects]
     964        }
     965        "-visible" {
     966            if { [llength $args] > 1 } {
     967                set dlist {}
     968                set args [lrange $args 1 end]
     969                foreach dataobj $args {
     970                    if { [info exists _obj2ovride($dataobj-raise)] } {
     971                        lappend dlist $dataobj
     972                    }
     973                }
     974            } else {
     975                set dlist [get -visible]
     976            }
     977        }          
     978        default {
     979            set dlist $args
     980        }
    981981    }
    982982    set rlist ""
    983983    foreach dataobj $dlist {
    984         foreach comp [$dataobj components] {
    985             set tag $dataobj-$comp
    986             if { [info exists _datasets($tag)] && $_datasets($tag) } {
    987                 lappend rlist $tag
    988             }
    989         }
     984        foreach comp [$dataobj components] {
     985            set tag $dataobj-$comp
     986            if { [info exists _datasets($tag)] && $_datasets($tag) } {
     987                lappend rlist $tag
     988            }
     989        }
    990990    }
    991991    return $rlist
     
    10041004        "in" {
    10051005            set _view(zoom) [expr {$_view(zoom)*1.25}]
    1006             SendCmd "camera zoom $_view(zoom)"
     1006            SendCmd "camera zoom $_view(zoom)"
    10071007        }
    10081008        "out" {
    10091009            set _view(zoom) [expr {$_view(zoom)*0.8}]
    1010             SendCmd "camera zoom $_view(zoom)"
     1010            SendCmd "camera zoom $_view(zoom)"
    10111011        }
    10121012        "reset" {
    10131013            array set _view {
    1014                 qw      1
    1015                 qx      0
    1016                 qy      0
    1017                 qz      0
     1014                qw      1
     1015                qx      0
     1016                qy      0
     1017                qz      0
    10181018                zoom    1.0
    10191019                xpan   0
     
    10271027                }
    10281028            }
    1029             set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1030             $_arcball quaternion $q
    1031             DoRotate
     1029            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1030            $_arcball quaternion $q
     1031            DoRotate
    10321032        }
    10331033    }
     
    10731073                    return
    10741074                }
    1075                 if { $dx == 0 && $dy == 0 } {
    1076                     return
    1077                 }
    1078                 set q [$_arcball rotate $x $y $_click(x) $_click(y)]
    1079                 EventuallyRotate $q
     1075                if { $dx == 0 && $dy == 0 } {
     1076                    return
     1077                }
     1078                set q [$_arcball rotate $x $y $_click(x) $_click(y)]
     1079                EventuallyRotate $q
    10801080                set _click(x) $x
    10811081                set _click(y) $y
     
    11091109itcl::body Rappture::VtkViewer::Pan {option x y} {
    11101110    switch -- $option {
    1111         "set" {
    1112             set w [winfo width $itk_component(view)]
    1113             set h [winfo height $itk_component(view)]
    1114             set x [expr $x / double($w)]
    1115             set y [expr $y / double($h)]
    1116             set _view(xpan) [expr $_view(xpan) + $x]
    1117             set _view(ypan) [expr $_view(ypan) + $y]
    1118             PanCamera
    1119             return
    1120         }
    1121         "click" {
    1122             set _click(x) $x
    1123             set _click(y) $y
    1124             $itk_component(view) configure -cursor hand1
    1125         }
    1126         "drag" {
    1127             if { ![info exists _click(x)] } {
    1128                 set _click(x) $x
    1129             }
    1130             if { ![info exists _click(y)] } {
    1131                 set _click(y) $y
    1132             }
    1133             set w [winfo width $itk_component(view)]
    1134             set h [winfo height $itk_component(view)]
    1135             set dx [expr ($_click(x) - $x)/double($w)]
    1136             set dy [expr ($_click(y) - $y)/double($h)]
    1137             set _click(x) $x
    1138             set _click(y) $y
    1139             set _view(xpan) [expr $_view(xpan) - $dx]
    1140             set _view(ypan) [expr $_view(ypan) - $dy]
    1141             PanCamera
    1142         }
    1143         "release" {
    1144             Pan drag $x $y
    1145             $itk_component(view) configure -cursor ""
    1146         }
    1147         default {
    1148             error "unknown option \"$option\": should set, click, drag, or release"
    1149         }
     1111        "set" {
     1112            set w [winfo width $itk_component(view)]
     1113            set h [winfo height $itk_component(view)]
     1114            set x [expr $x / double($w)]
     1115            set y [expr $y / double($h)]
     1116            set _view(xpan) [expr $_view(xpan) + $x]
     1117            set _view(ypan) [expr $_view(ypan) + $y]
     1118            PanCamera
     1119            return
     1120        }
     1121        "click" {
     1122            set _click(x) $x
     1123            set _click(y) $y
     1124            $itk_component(view) configure -cursor hand1
     1125        }
     1126        "drag" {
     1127            if { ![info exists _click(x)] } {
     1128                set _click(x) $x
     1129            }
     1130            if { ![info exists _click(y)] } {
     1131                set _click(y) $y
     1132            }
     1133            set w [winfo width $itk_component(view)]
     1134            set h [winfo height $itk_component(view)]
     1135            set dx [expr ($_click(x) - $x)/double($w)]
     1136            set dy [expr ($_click(y) - $y)/double($h)]
     1137            set _click(x) $x
     1138            set _click(y) $y
     1139            set _view(xpan) [expr $_view(xpan) - $dx]
     1140            set _view(ypan) [expr $_view(ypan) - $dy]
     1141            PanCamera
     1142        }
     1143        "release" {
     1144            Pan drag $x $y
     1145            $itk_component(view) configure -cursor ""
     1146        }
     1147        default {
     1148            error "unknown option \"$option\": should set, click, drag, or release"
     1149        }
    11501150    }
    11511151}
     
    11601160itcl::body Rappture::VtkViewer::FixSettings { args } {
    11611161    foreach setting $args {
    1162         AdjustSetting $setting
     1162        AdjustSetting $setting
    11631163    }
    11641164}
     
    11671167# AdjustSetting --
    11681168#
    1169 #       Changes/updates a specific setting in the widget.  There are
    1170 #       usually user-setable option.  Commands are sent to the render
    1171 #       server.
     1169#       Changes/updates a specific setting in the widget.  There are
     1170#       usually user-setable option.  Commands are sent to the render
     1171#       server.
    11721172#
    11731173itcl::body Rappture::VtkViewer::AdjustSetting {what {value ""}} {
    11741174    if { ![isconnected] } {
    1175         return
     1175        return
    11761176    }
    11771177    switch -- $what {
    11781178        "volume-opacity" {
    1179             set val $_volume(opacity)
    1180             set sval [expr { 0.01 * double($val) }]
    1181             foreach dataset [CurrentDatasets -visible $_first] {
    1182                 SendCmd "polydata opacity $sval $dataset"
    1183             }
     1179            set val $_volume(opacity)
     1180            set sval [expr { 0.01 * double($val) }]
     1181            foreach dataset [CurrentDatasets -visible $_first] {
     1182                SendCmd "polydata opacity $sval $dataset"
     1183            }
    11841184        }
    11851185        "volume-wireframe" {
    1186             set bool $_volume(wireframe)
    1187             foreach dataset [CurrentDatasets -visible $_first] {
    1188                 SendCmd "polydata wireframe $bool $dataset"
     1186            set bool $_volume(wireframe)
     1187            foreach dataset [CurrentDatasets -visible $_first] {
     1188                SendCmd "polydata wireframe $bool $dataset"
    11891189            }
    11901190        }
    11911191        "volume-visible" {
    1192             set bool $_volume(visible)
    1193             foreach dataset [CurrentDatasets -visible $_first] {
    1194                 SendCmd "polydata visible $bool $dataset"
     1192            set bool $_volume(visible)
     1193            foreach dataset [CurrentDatasets -visible $_first] {
     1194                SendCmd "polydata visible $bool $dataset"
    11951195            }
    11961196        }
    11971197        "volume-lighting" {
    1198             set bool $_volume(lighting)
    1199             foreach dataset [CurrentDatasets -visible $_first] {
    1200                 SendCmd "polydata lighting $bool $dataset"
     1198            set bool $_volume(lighting)
     1199            foreach dataset [CurrentDatasets -visible $_first] {
     1200                SendCmd "polydata lighting $bool $dataset"
    12011201            }
    12021202        }
    12031203        "volume-edges" {
    1204             set bool $_volume(edges)
    1205             foreach dataset [CurrentDatasets -visible $_first] {
    1206                 SendCmd "polydata edges $bool $dataset"
     1204            set bool $_volume(edges)
     1205            foreach dataset [CurrentDatasets -visible $_first] {
     1206                SendCmd "polydata edges $bool $dataset"
    12071207            }
    12081208        }
    12091209        "axis-visible" {
    1210             set bool $_axis(visible)
    1211             SendCmd "axis visible all $bool"
     1210            set bool $_axis(visible)
     1211            SendCmd "axis visible all $bool"
    12121212        }
    12131213        "axis-labels" {
    1214             set bool $_axis(labels)
    1215             SendCmd "axis labels all $bool"
     1214            set bool $_axis(labels)
     1215            SendCmd "axis labels all $bool"
    12161216        }
    12171217        "axis-xgrid" {
    1218             set bool $_axis(xgrid)
    1219             SendCmd "axis grid x $bool"
     1218            set bool $_axis(xgrid)
     1219            SendCmd "axis grid x $bool"
    12201220        }
    12211221        "axis-ygrid" {
    1222             set bool $_axis(ygrid)
    1223             SendCmd "axis grid y $bool"
     1222            set bool $_axis(ygrid)
     1223            SendCmd "axis grid y $bool"
    12241224        }
    12251225        "axis-zgrid" {
    1226             set bool $_axis(zgrid)
    1227             SendCmd "axis grid z $bool"
     1226            set bool $_axis(zgrid)
     1227            SendCmd "axis grid z $bool"
    12281228        }
    12291229        "axis-mode" {
    1230             set mode [$itk_component(axismode) value]
    1231             set mode [$itk_component(axismode) translate $mode]
    1232             SendCmd "axis flymode $mode"
    1233         }
    1234         "axis-xcutaway" - "axis-ycutaway" - "axis-zcutaway" {
    1235             set axis [string range $what 5 5]
    1236             set bool $_axis(${axis}cutaway)
     1230            set mode [$itk_component(axismode) value]
     1231            set mode [$itk_component(axismode) translate $mode]
     1232            SendCmd "axis flymode $mode"
     1233        }
     1234        "axis-xcutaway" - "axis-ycutaway" - "axis-zcutaway" {
     1235            set axis [string range $what 5 5]
     1236            set bool $_axis(${axis}cutaway)
    12371237            if { $bool } {
    1238                 set pos [expr $_axis(${axis}position) * 0.01]
    1239                 set dir $_axis(${axis}direction)
     1238                set pos [expr $_axis(${axis}position) * 0.01]
     1239                set dir $_axis(${axis}direction)
    12401240                $itk_component(${axis}CutScale) configure -state normal \
    12411241                    -troughcolor white
    1242                 SendCmd "renderer clipplane $axis $pos $dir"
     1242                SendCmd "renderer clipplane $axis $pos $dir"
    12431243            } else {
    12441244                $itk_component(${axis}CutScale) configure -state disabled \
    12451245                    -troughcolor grey82
    1246                 SendCmd "renderer clipplane $axis 1 -1"
    1247             }
    1248         }
    1249         "axis-xposition" - "axis-yposition" - "axis-zposition" -
    1250         "axis-xdirection" - "axis-ydirection" - "axis-zdirection" {
    1251             set axis [string range $what 5 5]
    1252             #set dir $_axis(${axis}direction)
    1253             set pos [expr $_axis(${axis}position) * 0.01]
    1254             SendCmd "renderer clipplane ${axis} $pos -1"
    1255         }
     1246                SendCmd "renderer clipplane $axis 1 -1"
     1247            }
     1248        }
     1249        "axis-xposition" - "axis-yposition" - "axis-zposition" -
     1250        "axis-xdirection" - "axis-ydirection" - "axis-zdirection" {
     1251            set axis [string range $what 5 5]
     1252            #set dir $_axis(${axis}direction)
     1253            set pos [expr $_axis(${axis}position) * 0.01]
     1254            SendCmd "renderer clipplane ${axis} $pos -1"
     1255        }
    12561256        default {
    12571257            error "don't know how to fix $what"
     
    12631263# RequestLegend --
    12641264#
    1265 #       Request a new legend from the server.  The size of the legend
    1266 #       is determined from the height of the canvas.  It will be rotated
    1267 #       to be vertical when drawn.
     1265#       Request a new legend from the server.  The size of the legend
     1266#       is determined from the height of the canvas.  It will be rotated
     1267#       to be vertical when drawn.
    12681268#
    12691269itcl::body Rappture::VtkViewer::RequestLegend {} {
     
    12761276    set h [expr {$_height - 2 * ($lineht + 2)}]
    12771277    if { $h < 1} {
    1278         return
     1278        return
    12791279    }
    12801280    # Set the legend on the first dataset.
    12811281    foreach dataset [CurrentDatasets -visible] {
    1282         foreach {dataobj comp} [split $dataset -] break
    1283         if { [info exists _dataset2style($dataset)] } {
    1284             #puts stderr "RequestLegend w=$w h=$h"
     1282        foreach {dataobj comp} [split $dataset -] break
     1283        if { [info exists _dataset2style($dataset)] } {
     1284            #puts stderr "RequestLegend w=$w h=$h"
    12851285            SendCmd "legend $_dataset2style($dataset) vmag {} $w $h 0"
    1286             break;
     1286            break;
    12871287        }
    12881288    }
     
    13021302    set colormap "$style(-color):$style(-levels):$style(-opacity)"
    13031303    if { [info exists _colormaps($colormap)] } {
    1304         puts stderr "Colormap $colormap already built"
    1305         return $colormap
     1304        puts stderr "Colormap $colormap already built"
     1305        return $colormap
    13061306    }
    13071307    if { ![info exists _dataset2style($tag)] } {
    1308         set _dataset2style($tag) $colormap
    1309         lappend _style2datasets($colormap) $tag
     1308        set _dataset2style($tag) $colormap
     1309        lappend _style2datasets($colormap) $tag
    13101310    }
    13111311    if { ![info exists _colormaps($colormap)] } {
    1312         # Build the pseudo colormap if it doesn't exist.
    1313         BuildColormap $colormap $dataobj $comp
    1314         set _colormaps($colormap) 1
     1312        # Build the pseudo colormap if it doesn't exist.
     1313        BuildColormap $colormap $dataobj $comp
     1314        set _colormaps($colormap) 1
    13151315    }
    13161316    switch -- [$dataobj type $comp] {
    1317         "polygon" {
    1318             SendCmd "pseudocolor colormap $colormap $tag"
    1319         }
    1320         "spheres" {
    1321             #SendCmd "glyphs colormap $colormap $tag"
    1322         }
     1317        "polygon" {
     1318            SendCmd "pseudocolor colormap $colormap $tag"
     1319        }
     1320        "spheres" {
     1321            #SendCmd "glyphs colormap $colormap $tag"
     1322        }
    13231323    }
    13241324    return $colormap
     
    13461346    }
    13471347    if { [llength $cmap] == 0 } {
    1348         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     1348        set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
    13491349    }
    13501350    if { ![info exists _volume(opacity)] } {
     
    13821382    array unset _limits $dataobj-*
    13831383    foreach comp [$dataobj components] {
    1384         set tag $dataobj-$comp
    1385         if { ![info exists _limits($tag)] } {
    1386             set data [$dataobj data $comp]
    1387             set tmpfile file[pid].vtk
    1388             set f [open "$tmpfile" "w"]
    1389             fconfigure $f -translation binary -encoding binary
    1390             puts $f $data
    1391             close $f
    1392             set reader [vtkDataSetReader $tag-xvtkDataSetReader]
    1393             $reader SetFileName $tmpfile
    1394             $reader ReadAllNormalsOn
    1395             $reader ReadAllScalarsOn
    1396             $reader ReadAllVectorsOn
    1397             $reader ReadAllFieldsOn
    1398             $reader Update
    1399             set output [$reader GetOutput]
    1400             set _limits($tag) [$output GetBounds]
    1401             set pointData [$output GetPointData]
    1402             puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
    1403             puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]"
    1404             puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]"
    1405             puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]"
    1406             puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
    1407             puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
    1408             set fieldData [$output GetFieldData]
    1409             set pointData [$output GetPointData]
    1410             puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
    1411             puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
    1412             puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
    1413             puts stderr "point \#components=[$pointData GetNumberOfComponents]"
    1414             puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]"
    1415             puts stderr "point \#tuples=[$pointData GetNumberOfTuples]"
    1416             puts stderr "point \#scalars=[$pointData GetScalars]"
    1417             puts stderr vectors=[$pointData GetVectors]
    1418             rename $output ""
    1419             rename $reader ""
    1420             file delete $tmpfile
    1421         }
     1384        set tag $dataobj-$comp
     1385        if { ![info exists _limits($tag)] } {
     1386            set data [$dataobj data $comp]
     1387            set tmpfile file[pid].vtk
     1388            set f [open "$tmpfile" "w"]
     1389            fconfigure $f -translation binary -encoding binary
     1390            puts $f $data
     1391            close $f
     1392            set reader [vtkDataSetReader $tag-xvtkDataSetReader]
     1393            $reader SetFileName $tmpfile
     1394            $reader ReadAllNormalsOn
     1395            $reader ReadAllScalarsOn
     1396            $reader ReadAllVectorsOn
     1397            $reader ReadAllFieldsOn
     1398            $reader Update
     1399            set output [$reader GetOutput]
     1400            set _limits($tag) [$output GetBounds]
     1401            set pointData [$output GetPointData]
     1402            puts stderr "\#scalars=[$reader GetNumberOfScalarsInFile]"
     1403            puts stderr "\#vectors=[$reader GetNumberOfVectorsInFile]"
     1404            puts stderr "\#tensors=[$reader GetNumberOfTensorsInFile]"
     1405            puts stderr "\#normals=[$reader GetNumberOfNormalsInFile]"
     1406            puts stderr "\#fielddata=[$reader GetNumberOfFieldDataInFile]"
     1407            puts stderr "fielddataname=[$reader GetFieldDataNameInFile 0]"
     1408            set fieldData [$output GetFieldData]
     1409            set pointData [$output GetPointData]
     1410            puts stderr "field \#arrays=[$fieldData GetNumberOfArrays]"
     1411            puts stderr "point \#arrays=[$pointData GetNumberOfArrays]"
     1412            puts stderr "field \#components=[$fieldData GetNumberOfComponents]"
     1413            puts stderr "point \#components=[$pointData GetNumberOfComponents]"
     1414            puts stderr "field \#tuples=[$fieldData GetNumberOfTuples]"
     1415            puts stderr "point \#tuples=[$pointData GetNumberOfTuples]"
     1416            puts stderr "point \#scalars=[$pointData GetScalars]"
     1417            puts stderr vectors=[$pointData GetVectors]
     1418            rename $output ""
     1419            rename $reader ""
     1420            file delete $tmpfile
     1421        }
    14221422        foreach { xMin xMax yMin yMax zMin zMax} $_limits($tag) break
    1423         if {![info exists limits(xmin)] || $limits(xmin) > $xMin} {
    1424             set limits(xmin) $xMin
    1425         }
    1426         if {![info exists limits(xmax)] || $limits(xmax) < $xMax} {
    1427             set limits(xmax) $xMax
    1428         }
    1429         if {![info exists limits(ymin)] || $limits(ymin) > $yMin} {
    1430             set limits(ymin) $xMin
    1431         }
    1432         if {![info exists limits(ymax)] || $limits(ymax) < $yMax} {
    1433             set limits(ymax) $yMax
    1434         }
    1435         if {![info exists limits(zmin)] || $limits(zmin) > $zMin} {
    1436             set limits(zmin) $zMin
    1437         }
    1438         if {![info exists limits(zmax)] || $limits(zmax) < $zMax} {
    1439             set limits(zmax) $zMax
    1440         }
     1423        if {![info exists limits(xmin)] || $limits(xmin) > $xMin} {
     1424            set limits(xmin) $xMin
     1425        }
     1426        if {![info exists limits(xmax)] || $limits(xmax) < $xMax} {
     1427            set limits(xmax) $xMax
     1428        }
     1429        if {![info exists limits(ymin)] || $limits(ymin) > $yMin} {
     1430            set limits(ymin) $xMin
     1431        }
     1432        if {![info exists limits(ymax)] || $limits(ymax) < $yMax} {
     1433            set limits(ymax) $yMax
     1434        }
     1435        if {![info exists limits(zmin)] || $limits(zmin) > $zMin} {
     1436            set limits(zmin) $zMin
     1437        }
     1438        if {![info exists limits(zmax)] || $limits(zmax) < $zMax} {
     1439            set limits(zmax) $zMax
     1440        }
    14411441    }
    14421442    return [array get limits]
     
    14821482        -width 10 \
    14831483        -showvalue off \
    1484         -command [itcl::code $this AdjustSetting volume-opacity]
     1484        -command [itcl::code $this AdjustSetting volume-opacity]
    14851485
    14861486    blt::table $inner \
     
    15371537
    15381538    itk_component add axismode {
    1539         Rappture::Combobox $inner.mode -width 10 -editable no
     1539        Rappture::Combobox $inner.mode -width 10 -editable no
    15401540    }
    15411541    $inner.mode choices insert end \
     
    16021602    set inner [$itk_component(main) insert end \
    16031603        -title "Cutaway Along Axis" \
    1604         -icon [Rappture::icon cutbutton]]
     1604        -icon [Rappture::icon cutbutton]]
    16051605
    16061606    $inner configure -borderwidth 4
     
    16361636        Rappture::PushButton $inner.xdir \
    16371637            -onimage [Rappture::icon arrow-down] \
    1638             -onvalue -1 \
     1638            -onvalue -1 \
    16391639            -offimage [Rappture::icon arrow-up] \
    1640             -offvalue 1 \
     1640            -offvalue 1 \
    16411641            -command [itcl::code $this AdjustSetting axis-xdirection] \
    16421642            -variable [itcl::scope _axis(xdirection)]
     
    16761676        Rappture::PushButton $inner.ydir \
    16771677            -onimage [Rappture::icon arrow-down] \
    1678             -onvalue -1 \
     1678            -onvalue -1 \
    16791679            -offimage [Rappture::icon arrow-up] \
    1680             -offvalue 1 \
     1680            -offvalue 1 \
    16811681            -command [itcl::code $this AdjustSetting axis-ydirection] \
    16821682            -variable [itcl::scope _axis(ydirection)]
     
    17161716        Rappture::PushButton $inner.zdir \
    17171717            -onimage [Rappture::icon arrow-down] \
    1718             -onvalue -1 \
     1718            -onvalue -1 \
    17191719            -offimage [Rappture::icon arrow-up] \
    1720             -offvalue 1 \
     1720            -offvalue 1 \
    17211721            -command [itcl::code $this AdjustSetting axis-zdirection] \
    17221722            -variable [itcl::scope _axis(zdirection)]
     
    17681768                "qx" - "qy" - "qz" - "qw" {
    17691769                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    1770                     $_arcball quaternion $q
    1771                     EventuallyRotate $q
     1770                    $_arcball quaternion $q
     1771                    EventuallyRotate $q
    17721772                }
    17731773                "zoom" {
     
    18031803        foreach comp [$dataobj components] {
    18041804            set tag $dataobj-$comp
    1805             set contents [ConvertToVtkData $dataobj $comp]
    1806             append bytes "$contents\n\n"
     1805            set contents [ConvertToVtkData $dataobj $comp]
     1806            append bytes "$contents\n\n"
    18071807        }
    18081808    }
     
    18121812itcl::body Rappture::VtkViewer::GetImage { args } {
    18131813    if { [image width $_image(download)] > 0 &&
    1814         [image height $_image(download)] > 0 } {
    1815         $_image(download) export jpg -quality 100 -data bytes
    1816         return [list .jpg $bytes]
     1814        [image height $_image(download)] > 0 } {
     1815        $_image(download) export jpg -quality 100 -data bytes
     1816        return [list .jpg $bytes]
    18171817    }
    18181818    return ""
     
    18361836
    18371837    button $inner.ok -text "Save" \
    1838         -highlightthickness 0 -pady 2 -padx 3 \
     1838        -highlightthickness 0 -pady 2 -padx 3 \
    18391839        -command $command \
    1840         -compound left \
    1841         -image [Rappture::icon download]
     1840        -compound left \
     1841        -image [Rappture::icon download]
    18421842
    18431843    button $inner.cancel -text "Cancel" \
    1844         -highlightthickness 0 -pady 2 -padx 3 \
    1845         -command [list $popup deactivate] \
    1846         -compound left \
    1847         -image [Rappture::icon cancel]
     1844        -highlightthickness 0 -pady 2 -padx 3 \
     1845        -command [list $popup deactivate] \
     1846        -compound left \
     1847        -image [Rappture::icon cancel]
    18481848
    18491849    blt::table $inner \
     
    18661866    set style [$dataobj style $comp]
    18671867    if { $dataobj != $_first } {
    1868         set settings(-wireframe) 1
     1868        set settings(-wireframe) 1
    18691869    }
    18701870    if { $type == "spheres" } {
    1871         array set settings {
    1872             -color \#808080
    1873             -gscale 1
    1874             -edges 0
    1875             -edgecolor black
    1876             -linewidth 1.0
    1877             -opacity 1.0
    1878             -wireframe 0
    1879             -lighting 1
    1880             -visible 1
    1881         }
    1882         array set settings $style
    1883         SendCmd "glyphs add sphere $tag"
    1884         SendCmd "glyphs normscale 0 $tag"
    1885         SendCmd "glyphs gscale $settings(-gscale) $tag"
    1886         SendCmd "glyphs wireframe $settings(-wireframe) $tag"
    1887         #SendCmd "glyphs ccolor [Color2RGB $settings(-color)] $tag"
    1888         #SendCmd "glyphs colormode ccolor {} $tag"
    1889         SendCmd "glyphs smode vcomp {} $tag"
    1890         SendCmd "glyphs opacity $settings(-opacity) $tag"
    1891         SendCmd "glyphs visible $settings(-visible) $tag"
    1892         set _haveSpheres 1
     1871        array set settings {
     1872            -color \#808080
     1873            -gscale 1
     1874            -edges 0
     1875            -edgecolor black
     1876            -linewidth 1.0
     1877            -opacity 1.0
     1878            -wireframe 0
     1879            -lighting 1
     1880            -visible 1
     1881        }
     1882        array set settings $style
     1883        SendCmd "glyphs add sphere $tag"
     1884        SendCmd "glyphs normscale 0 $tag"
     1885        SendCmd "glyphs gscale $settings(-gscale) $tag"
     1886        SendCmd "glyphs wireframe $settings(-wireframe) $tag"
     1887        #SendCmd "glyphs ccolor [Color2RGB $settings(-color)] $tag"
     1888        #SendCmd "glyphs colormode ccolor {} $tag"
     1889        SendCmd "glyphs smode vcomp {} $tag"
     1890        SendCmd "glyphs opacity $settings(-opacity) $tag"
     1891        SendCmd "glyphs visible $settings(-visible) $tag"
     1892        set _haveSpheres 1
    18931893    } else {
    1894         array set settings {
    1895             -color \#6666FF
    1896             -edges 1
    1897             -edgecolor black
    1898             -linewidth 1.0
    1899             -opacity 1.0
    1900             -wireframe 0
    1901             -lighting 1
    1902             -visible 1
    1903         }
    1904         array set settings $style
    1905         SendCmd "polydata add $tag"
    1906         SendCmd "polydata visible $settings(-visible) $tag"
    1907         set _volume(visible) $settings(-visible)
     1894        array set settings {
     1895            -color \#6666FF
     1896            -edges 1
     1897            -edgecolor black
     1898            -linewidth 1.0
     1899            -opacity 1.0
     1900            -wireframe 0
     1901            -lighting 1
     1902            -visible 1
     1903        }
     1904        array set settings $style
     1905        SendCmd "polydata add $tag"
     1906        SendCmd "polydata visible $settings(-visible) $tag"
     1907        set _volume(visible) $settings(-visible)
    19081908    }
    19091909    if { $type != "spheres" } {
    1910         SendCmd "polydata edges $settings(-edges) $tag"
    1911         set _volume(edges) $settings(-edges)
    1912         SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
    1913         SendCmd "polydata lighting $settings(-lighting) $tag"
    1914         set _volume(lighting) $settings(-lighting)
    1915         SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag"
    1916         SendCmd "polydata linewidth $settings(-linewidth) $tag"
    1917         SendCmd "polydata opacity $settings(-opacity) $tag"
    1918         set _volume(opacity) $settings(-opacity)
    1919         SendCmd "polydata wireframe $settings(-wireframe) $tag"
    1920         set _volume(wireframe) $settings(-wireframe)
     1910        SendCmd "polydata edges $settings(-edges) $tag"
     1911        set _volume(edges) $settings(-edges)
     1912        SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
     1913        SendCmd "polydata lighting $settings(-lighting) $tag"
     1914        set _volume(lighting) $settings(-lighting)
     1915        SendCmd "polydata linecolor [Color2RGB $settings(-edgecolor)] $tag"
     1916        SendCmd "polydata linewidth $settings(-linewidth) $tag"
     1917        SendCmd "polydata opacity $settings(-opacity) $tag"
     1918        set _volume(opacity) $settings(-opacity)
     1919        SendCmd "polydata wireframe $settings(-wireframe) $tag"
     1920        set _volume(wireframe) $settings(-wireframe)
    19211921    }
    19221922    set _volume(opacity) [expr $settings(-opacity) * 100.0]
     
    19261926itcl::body Rappture::VtkViewer::IsValidObject { dataobj } {
    19271927    if {[catch {$dataobj isa Rappture::Drawing} valid] != 0 || !$valid} {
    1928         return 0
     1928        return 0
    19291929    }
    19301930    return 1
     
    19501950        $_image(legend) configure -data $bytes
    19511951        #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
    1952         DrawLegend
     1952        DrawLegend
    19531953    }
    19541954}
     
    19571957# DrawLegend --
    19581958#
    1959 #       Draws the legend in it's own canvas which resides to the right
    1960 #       of the contour plot area.
     1959#       Draws the legend in it's own canvas which resides to the right
     1960#       of the contour plot area.
    19611961#
    19621962itcl::body Rappture::VtkViewer::DrawLegend {} {
     
    19681968   
    19691969    if { $_settings(legend) } {
    1970         set x [expr $w - 2]
    1971         if { [$c find withtag "legend"] == "" } {
    1972             $c create image $x [expr {$lineht+2}] \
    1973                 -anchor ne \
    1974                 -image $_image(legend) -tags "colormap legend"
    1975             $c create text $x 2 \
    1976                 -anchor ne \
    1977                 -fill $itk_option(-plotforeground) -tags "vmax legend" \
    1978                 -font $font
    1979             $c create text $x [expr {$h-2}] \
    1980                 -anchor se \
    1981                 -fill $itk_option(-plotforeground) -tags "vmin legend" \
    1982                 -font $font
    1983             #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
    1984             $c bind colormap <Leave> [itcl::code $this LeaveLegend]
    1985             $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    1986         }
    1987         # Reset the item coordinates according the current size of the plot.
    1988         $c coords colormap $x [expr {$lineht+2}]
    1989         if { $_limits(vmin) != "" } {
    1990             $c itemconfigure vmin -text [format %g $_limits(vmin)]
    1991         }
    1992         if { $_limits(vmax) != "" } {
    1993             $c itemconfigure vmax -text [format %g $_limits(vmax)]
    1994         }
    1995         $c coords vmin $x [expr {$h-2}]
    1996         $c coords vmax $x 2
     1970        set x [expr $w - 2]
     1971        if { [$c find withtag "legend"] == "" } {
     1972            $c create image $x [expr {$lineht+2}] \
     1973                -anchor ne \
     1974                -image $_image(legend) -tags "colormap legend"
     1975            $c create text $x 2 \
     1976                -anchor ne \
     1977                -fill $itk_option(-plotforeground) -tags "vmax legend" \
     1978                -font $font
     1979            $c create text $x [expr {$h-2}] \
     1980                -anchor se \
     1981                -fill $itk_option(-plotforeground) -tags "vmin legend" \
     1982                -font $font
     1983            #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
     1984            $c bind colormap <Leave> [itcl::code $this LeaveLegend]
     1985            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
     1986        }
     1987        # Reset the item coordinates according the current size of the plot.
     1988        $c coords colormap $x [expr {$lineht+2}]
     1989        if { $_limits(vmin) != "" } {
     1990            $c itemconfigure vmin -text [format %g $_limits(vmin)]
     1991        }
     1992        if { $_limits(vmax) != "" } {
     1993            $c itemconfigure vmax -text [format %g $_limits(vmax)]
     1994        }
     1995        $c coords vmin $x [expr {$h-2}]
     1996        $c coords vmax $x 2
    19971997    }
    19981998}
     
    20392039    # Make a swatch of the selected color
    20402040    if { [catch { $_image(legend) get 10 $imgY } pixel] != 0 } {
    2041         #puts stderr "out of range: $imgY"
    2042         return
     2041        #puts stderr "out of range: $imgY"
     2042        return
    20432043    }
    20442044    if { ![info exists _image(swatch)] } {
    2045         set _image(swatch) [image create picture -width 24 -height 24]
     2045        set _image(swatch) [image create picture -width 24 -height 24]
    20462046    }
    20472047    set color [eval format "\#%02x%02x%02x" $pixel]
     
    20822082            SendCmd "renderer clipplane $axis $newpos -1"
    20832083        }
    2084         "tooltip" {
    2085             set axis [lindex $args 0]
    2086             set val [$itk_component(${axis}CutScale) get]
    2087             return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
    2088         }
     2084        "tooltip" {
     2085            set axis [lindex $args 0]
     2086            set val [$itk_component(${axis}CutScale) get]
     2087            return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
     2088        }
    20892089        default {
    20902090            error "bad option \"$option\": should be axis, move, or tooltip"
  • branches/blt4/gui/scripts/xylegend.tcl

    r2742 r2745  
    6161    private variable _lastColorIndex ""
    6262    private variable _dispatcher "" ;# dispatcher for !events
    63     private variable _graph     ""
    64     private variable _tree      ""
    65     private variable _diff      "";     # Polygon marker used for difference.
    66     private variable _rename    "";     # Node selected to be renamed.
     63    private variable _graph     ""
     64    private variable _tree      ""
     65    private variable _diff      "";     # Polygon marker used for difference.
     66    private variable _rename    "";     # Node selected to be renamed.
    6767    private variable _diffelements
    6868    private variable _unmapHidden 0
     
    455455    update
    456456    # Step 1. Get the x-values for each curve, then sort them to get the
    457     #         unique values.
     457    #         unique values.
    458458
    459459    set labels {}
     
    469469
    470470    # Step 2. Now for each curve, generate a cubic spline of that curve
    471     #         and interpolate to get the corresponding y-values for each
    472     #         abscissa.  Normally the abscissa are the same, so we're
    473     #         interpolation the knots.
     471    #         and interpolate to get the corresponding y-values for each
     472    #         abscissa.  Normally the abscissa are the same, so we're
     473    #         interpolation the knots.
    474474
    475475    set x [blt::vector create \#auto -command ""]
     
    492492
    493493    # Step 3.  Create a new curve which is the average. Append it to the
    494     #          the end.
     494    #          the end.
    495495
    496496    set count 0
     
    528528    if { [info exists _diffelements($elem1)] &&
    529529         [info exists _diffelements($elem2)] } {
    530         array unset _diffelements;      # Toggle the difference.
    531         return;                         
     530        array unset _diffelements;      # Toggle the difference.
     531        return;                         
    532532    }
    533533    array unset _diffelements
     
    672672# PopupMenu --
    673673#
    674 #       Builds the popup associated with the sensor map.  The menu
    675 #       is first destroyed if one exists.  This is because the menu
    676 #       bindings callbacks are specific to the current map.  Destroying
    677 #       the menu automatically removes the bindings and callbacks.
     674#       Builds the popup associated with the sensor map.  The menu
     675#       is first destroyed if one exists.  This is because the menu
     676#       bindings callbacks are specific to the current map.  Destroying
     677#       the menu automatically removes the bindings and callbacks.
    678678#
    679679itcl::body Rappture::XyLegend::PopupMenu { x y } {
  • branches/blt4/gui/scripts/xyprint.tcl

    r2742 r2745  
    3434    destructor {}
    3535
    36     private variable _graph "";         # Original graph.
    37     private variable _clone "";         # Cloned graph.
    38     private variable _preview "";       # Preview image.
    39     private variable _savedSettings;    # Array of settings.
     36    private variable _graph "";         # Original graph.
     37    private variable _clone "";         # Cloned graph.
     38    private variable _preview "";       # Preview image.
     39    private variable _savedSettings;    # Array of settings.
    4040
    4141    private common _oldSettingsFile "~/.rpsettings"
     
    297297    # Axis component
    298298    foreach axis [$orig axis names] {
    299         if { $axis == "z" } {
    300             continue
    301         }
     299        if { $axis == "z" } {
     300            continue
     301        }
    302302        if { [$orig axis cget $axis -hide] } {
    303303            continue
     
    386386    set _settings($this-axis-title-fontslant)  roman
    387387    foreach axis [$_clone axis names] {
    388         if { $axis == "z" } {
    389             continue
    390         }
     388        if { $axis == "z" } {
     389            continue
     390        }
    391391        if { [$_clone axis cget $axis -hide] } {
    392392            continue
    393393        }
    394         set _settings($this-$axis-ticks-fontfamily) helvetica
    395         set _settings($this-$axis-ticks-fontsize)   10
    396         set _settings($this-$axis-ticks-fontweight) normal
    397         set _settings($this-$axis-ticks-fontslant)  roman
    398         set _settings($this-$axis-title-fontfamily) helvetica
    399         set _settings($this-$axis-title-fontsize)   10
    400         set _settings($this-$axis-title-fontweight) normal
    401         set _settings($this-$axis-title-fontslant)  roman
    402         set tickfont "helvetica 10 normal roman"
    403         set titlefont "helvetica 10 normal roman"
     394        set _settings($this-$axis-ticks-fontfamily) helvetica
     395        set _settings($this-$axis-ticks-fontsize)   10
     396        set _settings($this-$axis-ticks-fontweight) normal
     397        set _settings($this-$axis-ticks-fontslant)  roman
     398        set _settings($this-$axis-title-fontfamily) helvetica
     399        set _settings($this-$axis-title-fontsize)   10
     400        set _settings($this-$axis-title-fontweight) normal
     401        set _settings($this-$axis-title-fontslant)  roman
     402        set tickfont "helvetica 10 normal roman"
     403        set titlefont "helvetica 10 normal roman"
    404404        $_clone axis configure $axis -ticklength 5  \
    405405            -majorticks {} -minorticks {}
     
    413413            continue
    414414        }
    415         incr count
     415        incr count
    416416        if { [$_clone element cget $elem -linewidth] > 1 } {
    417417            $_clone element configure $elem -linewidth 1 -pixels 3
     
    419419    }
    420420    if { $count == 0 } {
    421         # There are no "line" elements in the graph.
    422         # Remove the symbol and dashes controls.
    423         set page $itk_component(legend_page)
    424         # May have already been forgotten.
    425         catch {
    426             blt::table forget $page.symbol_l
    427             blt::table forget $page.symbol
    428             blt::table forget $page.dashes_l
    429             blt::table forget $page.dashes
    430         }
     421        # There are no "line" elements in the graph.
     422        # Remove the symbol and dashes controls.
     423        set page $itk_component(legend_page)
     424        # May have already been forgotten.
     425        catch {
     426            blt::table forget $page.symbol_l
     427            blt::table forget $page.symbol
     428            blt::table forget $page.dashes_l
     429            blt::table forget $page.dashes
     430        }
    431431    }
    432432}
     
    486486    set maxheight $rh
    487487    if { $maxwidth > $cw } {
    488         set maxwidth $cw
     488        set maxwidth $cw
    489489    }
    490490    if { $maxheight > $ch } {
    491         set maxheight $ch
     491        set maxheight $ch
    492492    }
    493493    set sx [expr double($maxwidth)/$w]
     
    545545    }
    546546    foreach attr { fontfamily fontsize fontweight fontslant } {
    547         set specific $this-$axis-ticks
    548         set general $this-axis-ticks
    549         set _settings(${general}-${attr}) $_settings(${specific}-${attr})
    550         set specific $this-$axis-title
    551         set general $this-axis-title
    552         set _settings(${general}-${attr}) $_settings(${specific}-${attr})
     547        set specific $this-$axis-ticks
     548        set general $this-axis-ticks
     549        set _settings(${general}-${attr}) $_settings(${specific}-${attr})
     550        set specific $this-$axis-title
     551        set general $this-axis-title
     552        set _settings(${general}-${attr}) $_settings(${specific}-${attr})
    553553    }
    554554    set type [GetAxisType $axis]
     
    748748    set _settings($this-legend-anchor)    [$page.anchor current]
    749749    if { $_clone != "" } {
    750         lappend font $_settings($this-legend-fontfamily)
    751         lappend font $_settings($this-legend-fontsize)
    752         lappend font $_settings($this-legend-fontweight)
    753         lappend font $_settings($this-legend-fontslant)
     750        lappend font $_settings($this-legend-fontfamily)
     751        lappend font $_settings($this-legend-fontsize)
     752        lappend font $_settings($this-legend-fontweight)
     753        lappend font $_settings($this-legend-fontslant)
    754754        foreach option { -hide -position -anchor -borderwidth } {
    755755            SetComponentOption legend $option
     
    12911291
    12921292    foreach attr { fontfamily fontsize fontweight fontslant } {
    1293         set specific $this-$axis-ticks
    1294         set general  $this-axis-ticks
    1295         set _settings(${specific}-${attr}) $_settings(${general}-${attr})
    1296         lappend tickfont $_settings(${general}-${attr})
    1297         set specific $this-$axis-title
    1298         set general  $this-axis-title
    1299         set _settings(${specific}-${attr}) $_settings(${general}-${attr})
    1300         lappend titlefont $_settings(${general}-${attr})
     1293        set specific $this-$axis-ticks
     1294        set general  $this-axis-ticks
     1295        set _settings(${specific}-${attr}) $_settings(${general}-${attr})
     1296        lappend tickfont $_settings(${general}-${attr})
     1297        set specific $this-$axis-title
     1298        set general  $this-axis-title
     1299        set _settings(${specific}-${attr}) $_settings(${general}-${attr})
     1300        lappend titlefont $_settings(${general}-${attr})
    13011301    }
    13021302    $_clone axis configure $axis -tickfont $tickfont -titlefont $titlefont
     
    14021402    $itk_component(axis_menu) delete all
    14031403    foreach axis $names {
    1404         if { $axis == "z" } {
    1405             continue
    1406         }
     1404        if { $axis == "z" } {
     1405            continue
     1406        }
    14071407        if { ![$_clone axis cget $axis -hide] } {
    14081408            $itk_component(axis_menu) add -text $axis -value $axis \
     
    14431443itcl::body Rappture::XyPrint::RestoreSettings { toolName plotName } {
    14441444    if { ![file readable $_settingsFile] } {
    1445         return;                         # No file or not readable
     1445        return;                         # No file or not readable
    14461446    }
    14471447    if { [file exists $_oldSettingsFile] } {
     
    15101510    append out "    array set settings {\n"
    15111511    foreach item [array names _settings ${this}-*] {
    1512         set field [string range $item $length end]
    1513         if { [regexp {^element-[0-9]+$} $field] } {
    1514             continue
    1515         }
    1516         set value $_settings($item)
    1517         append out "        [list $field] [list $value]\n"
     1512        set field [string range $item $length end]
     1513        if { [regexp {^element-[0-9]+$} $field] } {
     1514            continue
     1515        }
     1516        set value $_settings($item)
     1517        append out "        [list $field] [list $value]\n"
    15181518    }
    15191519    append out "    }\n"
     
    15881588        append out "        preview marker configure \"${axis}-zero\" -hide $hide\n"
    15891589        append out "    \}\n"
    1590     }   
     1590    }   
    15911591    return $out
    15921592}
  • branches/blt4/gui/scripts/xyresult.tcl

    r2742 r2745  
    299299            set _autoColorI 0
    300300        }
    301         set color [lindex $itk_option(-autocolors) $_autoColorI]
     301        set color [lindex $itk_option(-autocolors) $_autoColorI]
    302302        if { "" == $color} {
    303             set color black
    304         }
     303            set color black
     304        }
    305305        set params(-color) $color
    306306        # set up for next auto color
     
    357357    foreach obj $_dlist {
    358358        if {[info exists _dataobj2raise($obj)] && $_dataobj2raise($obj)} {
    359             lappend top $obj
    360         } else {
    361             lappend bottom $obj
    362         }
     359            lappend top $obj
     360        } else {
     361            lappend bottom $obj
     362        }
    363363    }
    364364    set _dlist [concat $bottom $top]
     
    439439                set id $map($axis)$type
    440440                foreach {min max} [$dataobj limits $axis$type] break
    441                 set amin [$dataobj hints ${axis}min]
    442                 set amax [$dataobj hints ${axis}max]
    443                 if { $amin != "" } {
    444                     set min $amin
    445                 }
    446                 if { $amax != "" } {
    447                     set max $amax
    448                 }
     441                set amin [$dataobj hints ${axis}min]
     442                set amax [$dataobj hints ${axis}max]
     443                if { $amin != "" } {
     444                    set min $amin
     445                }
     446                if { $amax != "" } {
     447                    set max $amax
     448                }
    449449                if {"" != $min && "" != $max} {
    450450                    if {![info exists _limits($id-min)]} {
     
    521521                csv {
    522522                    # generate the comma-separated value data for these objects
    523                     return [ExportCsv]
     523                    return [ExportCsv]
    524524                }
    525525                image {
     
    14701470itcl::body Rappture::XyResult::GetTextMarkerOptions {style} {
    14711471    array set textOptions {
    1472         "-color"        "-outline"
    1473         "-textcolor"    "-outline"
    1474         "-font"         "-font"
    1475         "-xoffset"      "-xoffset"
    1476         "-yoffset"      "-yoffset"
    1477         "-anchor"       "-anchor"
    1478         "-rotate"       "-rotate"
     1472        "-color"        "-outline"
     1473        "-textcolor"    "-outline"
     1474        "-font"         "-font"
     1475        "-xoffset"      "-xoffset"
     1476        "-yoffset"      "-yoffset"
     1477        "-anchor"       "-anchor"
     1478        "-rotate"       "-rotate"
    14791479    }
    14801480    set options {}
     
    14971497    # rebuild if needed, so we know about the axes
    14981498    if 0 {
    1499         # Don't do this. Given dataobj may be deleted in the rebuild
    1500 
    1501         # rebuild if needed, so we know about the axes
    1502         if {[$_dispatcher ispending !rebuild]} {
    1503             $_dispatcher cancel !rebuild
    1504             $_dispatcher event -now !rebuild
    1505         }
     1499        # Don't do this. Given dataobj may be deleted in the rebuild
     1500
     1501        # rebuild if needed, so we know about the axes
     1502        if {[$_dispatcher ispending !rebuild]} {
     1503            $_dispatcher cancel !rebuild
     1504            $_dispatcher event -now !rebuild
     1505        }
    15061506    }
    15071507    # what is the x axis?  x? x2? x3? ...
     
    15911591    # objects themselves) or derived (computed from other data points).
    15921592    set dlist {}
    1593     set derived {}                     
     1593    set derived {}                     
    15941594    foreach e [$g element show] {
    1595         if { [$g element cget $e -hide] || [$g element type $e] != "line" } {
    1596             continue;                   # Hidden or not a line element.
    1597         }
    1598         if { ![info exists _elem2dataobj($e)] } {
    1599             lappend derived $e
    1600             continue;                   # Derived data.
    1601         }
    1602         set dataobj $_elem2dataobj($e)
    1603         if { [info exists dtable($dataobj)] } {
    1604             continue;                   # Already found the data object.
    1605         }
    1606         set dtable($dataobj) $e
    1607         lappend dlist $dataobj
     1595        if { [$g element cget $e -hide] || [$g element type $e] != "line" } {
     1596            continue;                   # Hidden or not a line element.
     1597        }
     1598        if { ![info exists _elem2dataobj($e)] } {
     1599            lappend derived $e
     1600            continue;                   # Derived data.
     1601        }
     1602        set dataobj $_elem2dataobj($e)
     1603        if { [info exists dtable($dataobj)] } {
     1604            continue;                   # Already found the data object.
     1605        }
     1606        set dtable($dataobj) $e
     1607        lappend dlist $dataobj
    16081608    }
    16091609
    16101610    # Handle original data points (data objects from the user)
    16111611    foreach dataobj $dlist {
    1612         set label [$dataobj hints label]
    1613         set xlabel [$dataobj hints xlabel]
    1614         set ylabel [$dataobj hints ylabel]
    1615         set xcol "$xlabel ($label)"
    1616         set ycol "$ylabel ($label)"
    1617         foreach comp [$dataobj components] {
    1618             set row [expr [$table row length] + 1]
    1619             if { [$table column exists $xcol] } {
    1620                 set row [expr [$table row length] + 1]
    1621                 $table row set $row $xcol NaN $ycol NaN
    1622                 $table row unset $row
    1623             }
    1624             set xv [$dataobj mesh $comp]
    1625             set yv [$dataobj values $comp]
    1626             $table import vector $xv $xcol $yv $ycol
    1627         }
     1612        set label [$dataobj hints label]
     1613        set xlabel [$dataobj hints xlabel]
     1614        set ylabel [$dataobj hints ylabel]
     1615        set xcol "$xlabel ($label)"
     1616        set ycol "$ylabel ($label)"
     1617        foreach comp [$dataobj components] {
     1618            set row [expr [$table row length] + 1]
     1619            if { [$table column exists $xcol] } {
     1620                set row [expr [$table row length] + 1]
     1621                $table row set $row $xcol NaN $ycol NaN
     1622                $table row unset $row
     1623            }
     1624            set xv [$dataobj mesh $comp]
     1625            set yv [$dataobj values $comp]
     1626            $table import vector $xv $xcol $yv $ycol
     1627        }
    16281628    }
    16291629
     
    16321632    set yv [blt::vector create \#auto]
    16331633    foreach e $derived {
    1634         set label [$g element cget $e -label]
    1635         set xlabel [$g axis cget [$g element cget $e -mapx] -title]
    1636         set ylabel [$g axis cget [$g element cget $e -mapy] -title]
    1637         set xcol "$xlabel ($label)"
    1638         set ycol "$ylabel ($label)"
    1639         set row [expr [$table row length] + 1]
    1640         if { [$table column exists $xcol] } {
    1641             set row [expr [$table row length] + 1]
    1642             $table row set $row $xcol NaN $ycol NaN
    1643             $table row unset $row
    1644         }
    1645         $xv set [$g element cget $e -x]
    1646         $yv set [$g element cget $e -y]
    1647         $table import vector $xv $xcol $yv $ycol
     1634        set label [$g element cget $e -label]
     1635        set xlabel [$g axis cget [$g element cget $e -mapx] -title]
     1636        set ylabel [$g axis cget [$g element cget $e -mapy] -title]
     1637        set xcol "$xlabel ($label)"
     1638        set ycol "$ylabel ($label)"
     1639        set row [expr [$table row length] + 1]
     1640        if { [$table column exists $xcol] } {
     1641            set row [expr [$table row length] + 1]
     1642            $table row set $row $xcol NaN $ycol NaN
     1643            $table row unset $row
     1644        }
     1645        $xv set [$g element cget $e -x]
     1646        $yv set [$g element cget $e -y]
     1647        $table import vector $xv $xcol $yv $ycol
    16481648    }
    16491649    blt::vector destroy $xv $yv
Note: See TracChangeset for help on using the changeset viewer.