Index: branches/1.3/gui/scripts/flowvisviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/flowvisviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/flowvisviewer.tcl	(revision 4848)
@@ -63,69 +63,65 @@
     public method get {args}
     public method isconnected {}
-    public method limits { cname }
-    public method overMarker { m x }
+    public method limits { tf }
+    public method overmarker { m x }
     public method parameters {title args} { 
         # do nothing 
     }
-    public method removeDuplicateMarker { m x }
+    public method rmdupmarker { m x }
     public method scale {args}
-    public method updateTransferFunctions {}
+    public method updatetransferfuncs {}
+
+    protected method Connect {}
+    protected method CurrentVolumeIds {{what -all}}
+    protected method Disconnect {}
+    protected method Resize {}
+    protected method ResizeLegend {}
+    protected method AdjustSetting {what {value ""}}
+    protected method InitSettings { args }
+    protected method Pan {option x y}
+    protected method Rebuild {}
+    protected method ReceiveData { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { tf vmin vmax size }
+    protected method Rotate {option x y}
+    protected method SendDataObjs {}
+    protected method SendTransferFuncs {}
+    protected method Slice {option args}
+    protected method SlicerTip {axis}
+    protected method Zoom {option}
 
     # soon to be removed.
-    private method Flow {option args}
-    private method Play {}
-    private method Pause {}
+    protected method Flow {option args}
+    protected method Play {}
+    protected method Pause {}
+
 
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
+
     private method AddIsoMarker { x y }
     private method BuildCameraTab {}
     private method BuildCutplanesTab {}
     private method BuildViewTab {}
-    private method BuildVolumeComponents {}
     private method BuildVolumeTab {}
     private method ComputeTransferFunc { tf }
-    private method Connect {}
-    private method CurrentVolumeIds {{what -all}}
-    private method Disconnect {}
     private method EventuallyResize { w h } 
     private method EventuallyGoto { nSteps } 
     private method EventuallyResizeLegend { } 
     private method FlowCmd { dataobj comp nbytes extents }
-    private method GetDatasetsWithComponent { cname } 
-    private method GetFlowInfo { widget }
     private method GetMovie { widget width height }
     private method GetPngImage { widget width height }
-    private method InitSettings { args }
     private method NameTransferFunc { dataobj comp }
-    private method Pan {option x y}
     private method PanCamera {}
     private method ParseLevelsOption { tf levels }
     private method ParseMarkersOption { tf markers }
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveData { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { tf vmin vmax size }
-    private method Resize {}
-    private method ResizeLegend {}
-    private method Rotate {option x y}
-    private method SendTransferFuncs {}
+    private method WaitIcon { option widget }
+    private method str2millisecs { value } 
+    private method millisecs2str { value } 
+    private method GetFlowInfo { widget }
+    private method particles { tag name } 
+    private method box { tag name } 
+    private method streams { tag name } 
+    private method arrows { tag name } 
     private method SetOrientation { side }
-    private method Slice {option args}
-    private method SlicerTip {axis}
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method WaitIcon { option widget }
-    private method Zoom {option}
-    private method arrows { tag name } 
-    private method box { tag name } 
-    private method millisecs2str { value } 
-    private method particles { tag name } 
-    private method str2millisecs { value } 
-    private method streams { tag name } 
 
     private variable _arcball ""
@@ -135,4 +131,5 @@
     private variable _serverObjs   ;# maps dataobj-component to volume ID 
                                     # in the server
+    private variable _sendobjs ""  ;# list of data objs to send to server
     private variable _recvObjs  ;# list of data objs to send to server
     private variable _obj2style    ;# maps dataobj-component to transfunc
@@ -149,6 +146,4 @@
     private variable _activeTf ""  ;# The currently active transfer function.
     private variable _first ""     ;# This is the topmost volume.
-    private variable _volcomponents   ; # Array of components found 
-    private variable _componentsList   ; # Array of components found 
     private variable _nextToken 0
     private variable _icon 0
@@ -183,4 +178,9 @@
     $_dispatcher dispatch $this !legend "[itcl::code $this ResizeLegend]; list"
 
+    # Send dataobjs event
+    $_dispatcher register !send_dataobjs
+    $_dispatcher dispatch $this !send_dataobjs \
+        "[itcl::code $this SendDataObjs]; list"
+
     # Send transferfunctions event
     $_dispatcher register !send_transfunc
@@ -220,26 +220,28 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -qw      0.853553
-        -qx      -0.353553
-        -qy      0.353553
-        -qz      0.146447
-        -xpan    0
-        -ypan    0
-        -zoom    1.0
+        qw      0.853553
+        qx      -0.353553
+        qy      0.353553
+        qz      0.146447
+        zoom    1.0
+        xpan    0
+        ypan    0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
-
-    set _limits(v) [list 0.0 1.0]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
+
+    set _limits(vmin) 0.0
+    set _limits(vmax) 1.0
     set _reset 1
 
     array set _settings [subst {
-        $this-qw                $_view(-qw)
-        $this-qx                $_view(-qx)
-        $this-qy                $_view(-qy)
-        $this-qz                $_view(-qz)
-        $this-zoom              $_view(-zoom)    
-        $this-xpan              $_view(-xpan)
-        $this-ypan              $_view(-ypan)
+        $this-qw                $_view(qw)
+        $this-qx                $_view(qx)
+        $this-qy                $_view(qy)
+        $this-qz                $_view(qz)
+        $this-zoom              $_view(zoom)    
+        $this-xpan              $_view(xpan)
+        $this-ypan              $_view(ypan)
         $this-arrows            0
         $this-currenttime       0
@@ -251,8 +253,4 @@
         $this-streams           0
         $this-volume            1
-        $this-light             40
-        $this-light2side        1
-        $this-opacity           50
-        $this-thickness         350
         $this-xcutplane         0
         $this-xcutposition      0
@@ -337,5 +335,6 @@
     set _image(legend) [image create photo]
     itk_component add legend {
-        canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0
+        canvas $itk_component(plotarea).legend \
+            -height 50 -highlightthickness 0 -background black
     } {
         usual
@@ -561,5 +560,7 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::FlowvisViewer::destructor {} {
+    set _sendobjs ""  ;# stop any send in progress
     $_dispatcher cancel !rebuild
+    $_dispatcher cancel !send_dataobjs
     $_dispatcher cancel !send_transfunc
     image delete $_image(plot)
@@ -671,5 +672,5 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::FlowvisViewer::delete {args} {
-    flow stop
+     flow stop
     if {[llength $args] == 0} {
         set args $_dlist
@@ -721,48 +722,27 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::FlowvisViewer::scale {args} {
-    array set styles {
-        -color BCGYR
-        -levels 6
-        -markers ""
-        -opacity 0.5
-    }
-    array unset _limits 
-    array unset _volcomponents 
-    foreach dataobj $args {
-        if { ![$dataobj isvalid] } {
-            continue;                     # Object doesn't contain valid data.
-        }
-        foreach cname [$dataobj components] {
-            if { ![info exists _volcomponents($cname)] } {
-                lappend _componentsList $cname
-                array set styles [lindex [$dataobj components -style $cname] 0]
-                set cmap [ColorsToColormap $styles(-color)]
-                set _cname2defaultcolormap($cname) $cmap
-                set _settings($cname-colormap) $styles(-color)
-            }
-            lappend _volcomponents($cname) $dataobj-$cname
-            array unset limits
-            array set limits [$dataobj valueLimits $cname]
-            set _limits($cname) $limits(v)
-        }
-        foreach axis {x y z v} {
-            foreach { min max } [$dataobj limits $axis] break
+    foreach val {xmin xmax ymin ymax vmin vmax} {
+        set _limits($val) ""
+    }
+    foreach obj $args {
+        foreach axis {x y v} {
+
+            foreach { min max } [$obj limits $axis] break
+
             if {"" != $min && "" != $max} {
-                if { ![info exists _limits($axis)] } {
-                    set _limits($axis) [list $min $max]
+                if {"" == $_limits(${axis}min)} {
+                    set _limits(${axis}min) $min
+                    set _limits(${axis}max) $max
                 } else {
-                    foreach {amin amax} $_limits($axis) break
-                    if {$min < $amin} {
-                        set amin $min
+                    if {$min < $_limits(${axis}min)} {
+                        set _limits(${axis}min) $min
                     }
-                    if {$max > $amax} {
-                        set amax $max
+                    if {$max > $_limits(${axis}max)} {
+                        set _limits(${axis}max) $max
                     }
-                    set _limits($axis) [list $amin $amax]
                 }
             }
         }
     }
-    #BuildVolumeComponents
 }
 
@@ -877,5 +857,5 @@
         if { $_reportClientInfo }  {
             # Tell the server the viewer, hub, user and session.
-            # Do this immediately on connect before buffering any commands
+            # Do this immediately on connect before buffing any commands
             global env
 
@@ -934,4 +914,89 @@
     # disconnected -- no more data sitting on server
     array unset _serverObjs
+    set _sendobjs ""
+}
+
+# ----------------------------------------------------------------------
+# USAGE: SendDataObjs
+#
+# Used internally to send a series of volume objects off to the
+# server.  Sends each object, a little at a time, with updates in
+# between so the interface doesn't lock up.
+# ----------------------------------------------------------------------
+itcl::body Rappture::FlowvisViewer::SendDataObjs {} {
+    blt::busy hold $itk_component(hull)
+    foreach dataobj $_sendobjs {
+        foreach comp [$dataobj components] {
+            # Send the data as one huge base64-encoded mess -- yuck!
+            set data [$dataobj blob $comp]
+            set nbytes [string length $data]
+            set extents [$dataobj extents $comp]
+
+            # I have a field. Is a vector field or a volume field?
+            if { $extents == 1 } {
+                set cmd "volume data follows $nbytes $dataobj-$comp\n"
+            } else {
+                set cmd [FlowCmd $dataobj $comp $nbytes $extents]
+                if { $cmd == "" } {
+                    puts stderr "no command"
+                    continue
+                }
+            }
+            f { ![SendBytes $cmd] } {
+                puts stderr "can't send"
+                return
+            }
+            if { ![SendBytes $data] } {
+                puts stderr "can't send"
+                return
+            }
+            NameTransferFunc $dataobj $comp
+            set _recvObjs($dataobj-$comp) 1
+        }
+    }
+    set _sendobjs ""
+    blt::busy release $itk_component(hull)
+
+    # Turn on buffering of commands to the server.  We don't want to
+    # be preempted by a server disconnect/reconnect (which automatically
+    # generates a new call to Rebuild).   
+    StartBufferingCommands
+
+    # activate the proper volume
+    set _first [lindex [get] 0]
+    if { "" != $_first } {
+        set axis [$_first hints updir]
+        if {"" != $axis} {
+            SendCmd "up $axis"
+        }
+
+        if 0 {
+        set location [$_first hints camera]
+        if { $location != "" } {
+            array set _view $location
+        }
+        set _settings($this-qw)    $_view(qw)
+        set _settings($this-qx)    $_view(qx)
+        set _settings($this-qy)    $_view(qy)
+        set _settings($this-qz)    $_view(qz)
+        set _settings($this-xpan)  $_view(xpan)
+        set _settings($this-ypan)  $_view(ypan)
+        set _settings($this-zoom)  $_view(zoom)
+        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+        $_arcball quaternion $q
+        SendCmd "camera orient $q"
+        SendCmd "camera reset"
+        PanCamera
+        SendCmd "camera zoom $_view(zoom)"
+        }
+        # The active transfer function is by default the first component of
+        # the first data object.  This assumes that the data is always
+        # successfully transferred.
+        set comp [lindex [$_first components] 0]
+        set _activeTf [lindex $_obj2style($_first-$comp) 0]
+    }
+
+    SendCmd "flow reset"
+    StopBufferingCommands
 }
 
@@ -950,8 +1015,10 @@
     }
 
-    # Ensure that the global thickness setting (in the slider settings widget)
-    # is used for the active transfer-function. Update the values in the
-    # _settings varible.
-
+    # Ensure that the global opacity and thickness settings (in the slider
+    # settings widgets) are used for the active transfer-function.  Update the
+    # values in the _settings varible.
+    set value $_settings($this-opacity)
+    set opacity [expr { double($value) * 0.01 }]
+    set _settings($this-$tf-opacity) $opacity
     set value $_settings($this-thickness)
     # Scale values between 0.00001 and 0.01000
@@ -1030,22 +1097,28 @@
     set h [winfo height $c]
     set lx 10
+    # FIXME:  I don't know what I have to do this for the 2D flow
+    #         example.  Otherwise the canvas background is white.
+    #         I'll get to this when we add background changes into
+    #         nanvis.
+    $c configure -background black
     set ly [expr {$h - 1}]
-    if {"" == [$c find withtag colorbar]} {
+    if {"" == [$c find withtag transfunc]} {
         $c create image 10 10 -anchor nw \
-            -image $_image(legend) -tags colorbar
+            -image $_image(legend) -tags transfunc
         $c create text $lx $ly -anchor sw \
             -fill $itk_option(-plotforeground) -tags "limits vmin"
         $c create text [expr {$w-$lx}] $ly -anchor se \
             -fill $itk_option(-plotforeground) -tags "limits vmax"
-        $c lower colorbar
-        $c bind colorbar <ButtonRelease-1> [itcl::code $this AddIsoMarker %x %y]
+        $c lower transfunc
+        $c bind transfunc <ButtonRelease-1> \
+            [itcl::code $this AddIsoMarker %x %y]
     }
     # Display the markers used by the active transfer function.
     set tf $_obj2style($tag)
-    foreach {vmin vmax} [limits $tf] break
-    $c itemconfigure vmin -text [format %g $vmin]
+    array set limits [limits $tf]
+    $c itemconfigure vmin -text [format %.2g $limits(vmin)]
     $c coords vmin $lx $ly
 
-    $c itemconfigure vmax -text [format %g $vmax]
+    $c itemconfigure vmax -text [format %.2g $limits(vmax)]
     $c coords vmax [expr {$w-$lx}] $ly
 
@@ -1087,8 +1160,9 @@
     set dataobj [lindex $parts 0]
     set _serverObjs($tag) 0
-    set _limits($tag) [list $values(min) $values(max)]
+    set _limits($tag-min)  $values(min);  # Minimum value of the volume.
+    set _limits($tag-max)  $values(max);  # Maximum value of the volume.
     unset _recvObjs($tag)
     if { [array size _recvObjs] == 0 } {
-        updateTransferFunctions
+        updatetransferfuncs
     }
 }
@@ -1134,14 +1208,6 @@
         foreach comp [$dataobj components] {
             set tag $dataobj-$comp
-            set isvtk 0
-            # FIXME: Would like to use the type method of the dataobj
-            # but the returned value isn't well defined now
-            if {[catch {
-                # Send the data as one huge base64-encoded mess -- yuck!
-                set data [$dataobj blob $comp]
-            }]} {
-                set data [$dataobj vtkdata $comp]
-                set isvtk 1
-            }
+            # Send the data as one huge base64-encoded mess -- yuck!
+            set data [$dataobj blob $comp]
             set nbytes [string length $data]
             if { $_reportClientInfo }  {
@@ -1159,6 +1225,6 @@
             set extents [$dataobj extents $comp]
             # I have a field. Is a vector field or a volume field?
-            if { !$isvtk && $extents == 1 } {
-                SendCmd "volume data follows $nbytes $tag"
+            if { $extents == 1 } {
+                set cmd "volume data follows $nbytes $tag\n"
             } else {
                 set cmd [FlowCmd $dataobj $comp $nbytes $extents]
@@ -1167,6 +1233,6 @@
                     continue
                 }
-                append _outbuf $cmd
-            }
+            }
+            append _outbuf $cmd
             append _outbuf $data
             NameTransferFunc $dataobj $comp
@@ -1178,8 +1244,10 @@
 
     # Reset the camera and other view parameters
-    InitSettings light2side light opacity isosurface grid axes volume outline
-
+    InitSettings light2side light transp isosurface grid axes volume outline
+    
     # nothing to send -- activate the proper volume
     if {"" != $_first} {
+        AdjustSetting light
+        AdjustSetting transp
         set axis [$_first hints updir]
         if {"" != $axis} {
@@ -1192,18 +1260,18 @@
 
     }
-    set _settings($this-qw)    $_view(-qw)
-    set _settings($this-qx)    $_view(-qx)
-    set _settings($this-qy)    $_view(-qy)
-    set _settings($this-qz)    $_view(-qz)
-    set _settings($this-xpan)  $_view(-xpan)
-    set _settings($this-ypan)  $_view(-ypan)
-    set _settings($this-zoom)  $_view(-zoom)
-
-    set q [ViewToQuaternion]
+    set _settings($this-qw)    $_view(qw)
+    set _settings($this-qx)    $_view(qx)
+    set _settings($this-qy)    $_view(qy)
+    set _settings($this-qz)    $_view(qz)
+    set _settings($this-xpan)  $_view(xpan)
+    set _settings($this-ypan)  $_view(ypan)
+    set _settings($this-zoom)  $_view(zoom)
+
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q"
     SendCmd "camera reset"
     PanCamera
-    SendCmd "camera zoom $_view(-zoom)"
+    SendCmd "camera zoom $_view(zoom)"
 
     foreach dataobj [get] {
@@ -1261,10 +1329,10 @@
     foreach key [array names _serverObjs *-*] {
         if {[string match $_first-* $key]} {
-            array set styles {
+            array set style {
                 -cutplanes 1
             }
             foreach {dataobj comp} [split $key -] break
-            array set styles [lindex [$dataobj components -style $comp] 0]
-            if {$what != "-cutplanes" || $styles(-cutplanes)} {
+            array set style [lindex [$dataobj components -style $comp] 0]
+            if {$what != "-cutplanes" || $style(-cutplanes)} {
                 lappend rlist $_serverObjs($key)
             }
@@ -1285,22 +1353,22 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            set _settings($this-zoom) $_view(-zoom)
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            set _settings($this-zoom) $_view(zoom)
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            set _settings($this-zoom) $_view(-zoom)
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            set _settings($this-zoom) $_view(zoom)
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -zoom    1.0
-                -xpan    0
-                -ypan    0
+                qw      0.853553
+                qx      -0.353553
+                qy      0.353553
+                qz      0.146447
+                zoom    1.0
+                xpan   0
+                ypan   0
             }
             if { $_first != "" } {
@@ -1310,15 +1378,15 @@
                 }
             }
-            set q [ViewToQuaternion]
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
             $_arcball quaternion $q
             SendCmd "camera orient $q"
             SendCmd "camera reset"
-            set _settings($this-qw)    $_view(-qw)
-            set _settings($this-qx)    $_view(-qx)
-            set _settings($this-qy)    $_view(-qy)
-            set _settings($this-qz)    $_view(-qz)
-            set _settings($this-xpan)  $_view(-xpan)
-            set _settings($this-ypan)  $_view(-ypan)
-            set _settings($this-zoom)  $_view(-zoom)
+            set _settings($this-qw)    $_view(qw)
+            set _settings($this-qx)    $_view(qx)
+            set _settings($this-qy)    $_view(qy)
+            set _settings($this-qz)    $_view(qz)
+            set _settings($this-xpan)  $_view(xpan)
+            set _settings($this-ypan)  $_view(ypan)
+            set _settings($this-zoom)  $_view(zoom)
         }
     }
@@ -1326,6 +1394,8 @@
 
 itcl::body Rappture::FlowvisViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    #set x [expr ($_view(xpan)) / $_limits(xrange)]
+    #set y [expr ($_view(ypan)) / $_limits(yrange)]
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
@@ -1365,9 +1435,9 @@
 
                 set q [$_arcball rotate $x $y $_click(x) $_click(y)]
-                QuaternionToView $q
-                set _settings($this-qw) $_view(-qw)
-                set _settings($this-qx) $_view(-qx)
-                set _settings($this-qy) $_view(-qy)
-                set _settings($this-qz) $_view(-qz)
+                foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
+                set _settings($this-qw) $_view(qw)
+                set _settings($this-qx) $_view(qx)
+                set _settings($this-qy) $_view(qy)
+                set _settings($this-qz) $_view(qz)
                 SendCmd "camera orient $q"
 
@@ -1402,9 +1472,9 @@
         set x [expr $x / double($w)]
         set y [expr $y / double($h)]
-        set _view(-xpan) [expr $_view(-xpan) + $x]
-        set _view(-ypan) [expr $_view(-ypan) + $y]
+        set _view(xpan) [expr $_view(xpan) + $x]
+        set _view(ypan) [expr $_view(ypan) + $y]
         PanCamera
-        set _settings($this-xpan) $_view(-xpan)
-        set _settings($this-ypan) $_view(-ypan)
+        set _settings($this-xpan) $_view(xpan)
+        set _settings($this-ypan) $_view(ypan)
         return
     }
@@ -1419,9 +1489,9 @@
         set _click(x) $x
         set _click(y) $y
-        set _view(-xpan) [expr $_view(-xpan) - $dx]
-        set _view(-ypan) [expr $_view(-ypan) - $dy]
+        set _view(xpan) [expr $_view(xpan) - $dx]
+        set _view(ypan) [expr $_view(ypan) - $dy]
         PanCamera
-        set _settings($this-xpan) $_view(-xpan)
-        set _settings($this-ypan) $_view(-ypan)
+        set _settings($this-xpan) $_view(xpan)
+        set _settings($this-ypan) $_view(ypan)
     }
     if { $option == "release" } {
@@ -1576,12 +1646,21 @@
             }
         }
-        opacity {
+        transp {
             if { $_first != "" } {
                 set comp [lindex [$_first components] 0]
                 set tag $_first-$comp
+                set opacity [expr { 0.01 * double($_settings($this-transp)) }]
+                SendCmd "$tag configure -opacity $opacity"
+            }
+        }
+        opacity {
+            if { $_first != "" && $_activeTf != "" } {
                 set opacity [expr { 0.01 * double($_settings($this-opacity)) }]
-                SendCmd "$tag configure -opacity $opacity"
-            }
-        }
+                set tf $_activeTf
+                set _settings($this-$tf-opacity) $opacity
+                updatetransferfuncs
+            }
+        }
+
         thickness {
             if { $_first != "" && $_activeTf != "" } {
@@ -1591,5 +1670,5 @@
                 set tf $_activeTf
                 set _settings($this-$tf-thickness) $sval
-                updateTransferFunctions
+                updatetransferfuncs
             }
         }
@@ -1699,15 +1778,20 @@
 #              now.
 #
-itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj cname } {
-    array set styles {
+itcl::body Rappture::FlowvisViewer::NameTransferFunc { dataobj comp } {
+    array set style {
         -color BCGYR
         -levels 6
-        -opacity 0.5
-    }
-    array set styles [lindex [$dataobj components -style $cname] 0]
-    set _settings($this-opacity) [expr $styles(-opacity) * 100]
-    set _obj2style($dataobj-$cname) $cname
-    lappend _style2objs($cname) $dataobj $cname
-    return $cname
+        -opacity 1.0
+        -light 40
+        -transp 50
+    }
+    array set style [lindex [$dataobj components -style $comp] 0]
+    set _settings($this-light) $style(-light)
+    set _settings($this-transp) $style(-transp)
+    set _settings($this-opacity) [expr $style(-opacity) * 100]
+    set tf "$style(-color):$style(-levels):$style(-opacity)"
+    set _obj2style($dataobj-$comp) $tf
+    lappend _style2objs($tf) $dataobj $comp
+    return $tf
 }
 
@@ -1722,8 +1806,10 @@
 #
 itcl::body Rappture::FlowvisViewer::ComputeTransferFunc { tf } {
-    array set styles {
+    array set style {
         -color BCGYR
         -levels 6
-        -opacity 0.5
+        -opacity 1.0
+        -light 40
+        -transp 50
     }
     set dataobj ""; set comp ""
@@ -1732,5 +1818,6 @@
         return 0
     }
-    array set styles [lindex [$dataobj components -style $comp] 0]
+    array set style [lindex [$dataobj components -style $comp] 0]
+
 
     # We have to parse the style attributes for a volume using this
@@ -1749,28 +1836,24 @@
     if { ![info exists _isomarkers($tf)] } {
         # Have to defer creation of isomarkers until we have data limits
-        if { [info exists styles(-markers)] &&
-             [llength $styles(-markers)] > 0  } {
-            ParseMarkersOption $tf $styles(-markers)
+        if { [info exists style(-markers)] &&
+             [llength $style(-markers)] > 0  } {
+            ParseMarkersOption $tf $style(-markers)
         } else {
-            ParseLevelsOption $tf $styles(-levels)
-        }
-    }
-    if { [info exists styles(-nonuniformcolors)] } {
-        foreach { value color } $styles(-nonuniformcolors) {
+            ParseLevelsOption $tf $style(-levels)
+        }
+    }
+    if { [info exists style(-nonuniformcolors)] } {
+        foreach { value color } $style(-nonuniformcolors) {
             append cmap "$value [Color2RGB $color] "
         }
     } else {
-        set cmap [ColorsToColormap $styles(-color)]
-    }
-
-    if { ![info exists _settings($this-opacity)] } {
-        set _settings($this-opacity) [expr $styles(-opacity) * 100]
-    }
-
-    # Transfer function should be normalized with [0,1] range
-    # The volume shading opacity setting is used to scale opacity
-    # in the volume shader.
-    set max 1.0
-
+        set cmap [ColorsToColormap $style(-color)]
+    }
+    set tag $this-$tf
+    if { ![info exists _settings($tag-opacity)] } {
+        set _settings($tag-opacity) $style(-opacity)
+    }
+    set max 1.0 ;#$_settings($tag-opacity)
+    
     set isovalues {}
     foreach m $_isomarkers($tf) {
@@ -1780,5 +1863,4 @@
     set isovalues [lsort -real $isovalues]
 
-    set tag $this-$tf
     if { ![info exists _settings($tag-thickness)]} {
         set _settings($tag-thickness) 0.005
@@ -1835,8 +1917,7 @@
 itcl::configbody Rappture::FlowvisViewer::plotbackground {
     if { [isconnected] } {
-        set color $itk_option(-plotbackground)
-        set rgb [Color2RGB $color]
-        SendCmd "screen bgcolor $rgb"
-        $itk_component(legend) configure -background $color
+        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1847,11 +1928,7 @@
 itcl::configbody Rappture::FlowvisViewer::plotforeground {
     if { [isconnected] } {
-        set color $itk_option(-plotforeground)
-        set rgb [Color2RGB $color]
-        SendCmd "volume outline color $rgb"
-        SendCmd "grid axiscolor $rgb"
-        SendCmd "grid linecolor $rgb"
-        $itk_component(legend) itemconfigure labels -fill $color
-        $itk_component(legend) itemconfigure limits -fill $color
+        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1887,5 +1964,4 @@
             set x [expr {double($i)/($levels+1)}]
             set m [Rappture::IsoMarker \#auto $c $this $tf]
-            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
             $m relval $x
             lappend _isomarkers($tf) $m 
@@ -1894,5 +1970,4 @@
         foreach x $levels {
             set m [Rappture::IsoMarker \#auto $c $this $tf]
-            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
             $m relval $x
             lappend _isomarkers($tf) $m 
@@ -1922,5 +1997,4 @@
             set value [expr {$value * 0.01}]
             set m [Rappture::IsoMarker \#auto $c $this $tf]
-            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
             $m relval $value
             lappend _isomarkers($tf) $m
@@ -1928,5 +2002,4 @@
             # ${n} : Set absolute value.
             set m [Rappture::IsoMarker \#auto $c $this $tf]
-            $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
             $m absval $value
             lappend _isomarkers($tf) $m
@@ -1938,5 +2011,5 @@
 # USAGE: UndateTransferFuncs 
 # ----------------------------------------------------------------------
-itcl::body Rappture::FlowvisViewer::updateTransferFunctions {} {
+itcl::body Rappture::FlowvisViewer::updatetransferfuncs {} {
     $_dispatcher event -after 100 !send_transfunc
 }
@@ -1949,13 +2022,12 @@
     set c $itk_component(legend)
     set m [Rappture::IsoMarker \#auto $c $this $tf]
-    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
     set w [winfo width $c]
     $m relval [expr {double($x-10)/($w-20)}]
     lappend _isomarkers($tf) $m
-    updateTransferFunctions
+    updatetransferfuncs
     return 1
 }
 
-itcl::body Rappture::FlowvisViewer::removeDuplicateMarker { marker x } {
+itcl::body Rappture::FlowvisViewer::rmdupmarker { marker x } {
     set tf [$marker transferfunc]
     set bool 0
@@ -1977,10 +2049,10 @@
         }
         set _isomarkers($tf) $list
-        updateTransferFunctions
+        updatetransferfuncs
     }
     return $bool
 }
 
-itcl::body Rappture::FlowvisViewer::overMarker { marker x } {
+itcl::body Rappture::FlowvisViewer::overmarker { marker x } {
     set tf [$marker transferfunc]
     if { [info exists _isomarkers($tf)] } {
@@ -1997,33 +2069,36 @@
 }
 
-itcl::body Rappture::FlowvisViewer::limits { cname } {
-    set _limits(v) [list 0.0 1.0]
-    if { ![info exists _style2objs($cname)] } {
-        puts stderr "no style2objs for $cname cname=($cname)"
+itcl::body Rappture::FlowvisViewer::limits { tf } {
+    set _limits(vmin) 0.0
+    set _limits(vmax) 1.0
+    if { ![info exists _style2objs($tf)] } {
+        puts stderr "no style2objs for $tf tf=($tf)"
         return [array get _limits]
     }
     set min ""; set max ""
-    foreach tag [GetDatasetsWithComponent $cname] {
+    foreach {dataobj comp} $_style2objs($tf) {
+        set tag $dataobj-$comp
         if { ![info exists _serverObjs($tag)] } {
             puts stderr "$tag not in serverObjs?"
             continue
         }
-        if { ![info exists _limits($tag)] } {
+        if { ![info exists _limits($tag-min)] } {
             puts stderr "$tag no min?"
             continue
         }
-        foreach {vmin vmax} $_limits($tag) break
-        if { $min == "" || $min > $vmin } {
-            set min $vmin
-        }
-        if { $max == "" || $max < $vmax } {
-            set max $vmax
-        }
-    }
-    if { $min != "" && $max != "" } {
-        set _limits(v) [list $min $max]
-        set _limits($cname) [list $min $max]
-    }
-    return $_limits($cname)
+        if { $min == "" || $min > $_limits($tag-min) } {
+            set min $_limits($tag-min)
+        }
+        if { $max == "" || $max < $_limits($tag-max) } {
+            set max $_limits($tag-max)
+        }
+    }
+    if { $min != "" } {
+        set _limits(vmin) $min
+    } 
+    if { $max != "" } {
+        set _limits(vmax) $max
+    }
+    return [array get _limits]
 }
 
@@ -2114,4 +2189,14 @@
 
 itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
+    foreach { key value } {
+        light2side      1
+        light           40
+        transp          50
+        opacity         100
+        thickness       350
+    } {
+        set _settings($this-$key) $value
+    }
+
     set inner [$itk_component(main) insert end \
         -title "Volume Settings" \
@@ -2141,4 +2226,11 @@
     label $inner.bright -text "Surface" -font $fg
 
+    label $inner.fog -text "Clear" -font $fg
+    ::scale $inner.transp -from 0 -to 100 -orient horizontal \
+        -variable [itcl::scope _settings($this-transp)] \
+        -width 10 \
+        -showvalue off -command [itcl::code $this AdjustSetting transp]
+    label $inner.plastic -text "Opaque" -font $fg
+
     label $inner.clear -text "Clear" -font $fg
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
@@ -2160,5 +2252,23 @@
     }
 
-    $inner.colormap choices insert end [GetColormapList -includeNone]
+    $inner.colormap choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   \
+	"none"		     "none"
+
     $itk_component(colormap) value "BCGYR"
     bind $inner.colormap <<Value>> \
@@ -2172,7 +2282,7 @@
         3,1 $inner.light -cspan 2 -pady 2 -fill x \
         3,3 $inner.bright -anchor w -pady 2 \
-        4,0 $inner.clear -anchor e -pady 2 \
-        4,1 $inner.opacity -cspan 2 -pady 2 -fill x \
-        4,3 $inner.opaque -anchor w -pady 2 \
+        4,0 $inner.fog -anchor e -pady 2 \
+        4,1 $inner.transp -cspan 2 -pady 2 -fill x \
+        4,3 $inner.plastic -anchor w -pady 2 \
         5,0 $inner.thin -anchor e -pady 2 \
         5,1 $inner.thickness -cspan 2 -pady 2 -fill x\
@@ -2302,5 +2412,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2 
-    blt::table configure $inner r0 -resize none
 
     set row 1 
@@ -2310,8 +2419,6 @@
         entry $inner.${tag} -font "Arial 9"  -bg white \
             -textvariable [itcl::scope _settings($this-$tag)]
-        bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
-        bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+        bind $inner.${tag} <KeyPress-Return> \
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -2321,5 +2428,5 @@
     }
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -2474,4 +2581,7 @@
 itcl::body Rappture::FlowvisViewer::SlicerTip {axis} {
     set val [$itk_component(${axis}CutScale) get]
+#    set val [expr {0.01*($val-50)
+#        *($_limits(${axis}max)-$_limits(${axis}min))
+#          + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]
     return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
 }
@@ -2515,25 +2625,25 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_settings(${this}${what})
+            set who [lindex $args 0]
+            set x $_settings($this-$who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
-                set _settings(${this}${what}) $_view($what)
+                set _settings($this-$who) $_view($who)
                 return
             }
-            switch -- $what {
-                "-xpan" - "-ypan" {
-                    set _view($what) $_settings(${this}${what})
+            switch -- $who {
+                "xpan" - "ypan" {
+                    set _view($who) $_settings($this-$who)
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set _view($what) $_settings(${this}${what})
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set _view($who) $_settings($this-$who)
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     SendCmd "camera orient $q"
                 }
-                "-zoom" {
-                    set _view($what) $_settings(${this}${what})
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    set _view($who) $_settings($this-$who)
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2913,41 +3023,16 @@
         bottom "0.707107 0.707107 0 0" 
     } 
-    foreach name { -qw -qx -qy -qz } value $positions($side) { 
+    foreach name { qw qx qy qz } value $positions($side) { 
         set _view($name) $value
     } 
-    set q [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q" 
     SendCmd "camera reset"
-    set _view(-xpan) 0.0
-    set _view(-ypan) 0.0
-    set _view(-zoom) 1.0
-    set _settings($this-xpan) $_view(-xpan)
-    set _settings($this-ypan) $_view(-ypan)
-    set _settings($this-zoom) $_view(-zoom)
-}
-
-# Reset global settings from dataset's settings.
-itcl::body Rappture::FlowvisViewer::BuildVolumeComponents {} { 
-    $itk_component(volcomponents) choices delete 0 end
-    foreach name $_componentsList {
-        $itk_component(volcomponents) choices insert end $name $name
-    }
-    set _current [lindex $_componentsList 0]
-    $itk_component(volcomponents) value $_current
-}
-
-# Reset global settings from dataset's settings.
-itcl::body Rappture::FlowvisViewer::GetDatasetsWithComponent { cname } { 
-    if { ![info exists _volcomponents($cname)] } {
-        return ""
-    }
-    set list ""
-    foreach tag $_volcomponents($cname) {
-        if { ![info exists _serverObjs($tag)] } {
-            continue
-        }
-        lappend list $tag
-    }
-    return $list
-}
+    set _view(xpan) 0.0
+    set _view(ypan) 0.0
+    set _view(zoom) 1.0
+    set _settings($this-xpan) $_view(xpan)
+    set _settings($this-ypan) $_view(ypan)
+    set _settings($this-zoom) $_view(zoom)
+}
Index: branches/1.3/gui/scripts/isomarker.tcl
===================================================================
--- branches/1.3/gui/scripts/isomarker.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/isomarker.tcl	(revision 4848)
@@ -30,157 +30,135 @@
     private common   _normalIcon [Rappture::icon nvlegendmark]
     private common   _activeIcon [Rappture::icon nvlegendmark2]
-    private method EnterTick {} 
-    private method LeaveTick {} 
-    private method StartDrag { x y } 
-    private method ContinueDrag { x y } 
-    private method StopDrag { x y } 
 
-    constructor {c obj tf args} {}
-    destructor {} 
-    public method transferfunc {} 
-    public method activate { bool } 
-    public method visible { bool } 
-    public method screenpos {} 
-    public method absval { {x "-get"} } 
-    public method relval  { {x "-get"} }
-}
-
-itcl::body Rappture::IsoMarker::constructor {c obj tf args} { 
-    set _canvas $c
-    set _nvobj $obj
-    set _tf $tf
-    set w [winfo width $_canvas]
-    set h [winfo height $_canvas]
-    set _tick [$c create image 0 $h \
-                   -image $_normalIcon -anchor s \
-                   -tags "tick $this $obj" -state hidden]
-    set _label [$c create text 0 $h \
-                    -anchor n -fill white -font "Helvetica 8" \
-                    -tags "labels $this $obj" -state hidden]
-    $c bind $_tick <Enter>           [itcl::code $this EnterTick]
-    $c bind $_tick <Leave>           [itcl::code $this LeaveTick]
-    $c bind $_tick <ButtonPress-1>   [itcl::code $this StartDrag %x %y]
-    $c bind $_tick <B1-Motion>       [itcl::code $this ContinueDrag %x %y]
-    $c bind $_tick <ButtonRelease-1> [itcl::code $this StopDrag %x %y]
-}
-
-itcl::body Rappture::IsoMarker::destructor {} {
-    $_canvas delete $this
-}
-
-itcl::body Rappture::IsoMarker::transferfunc {} {
-    return $_tf
-}
-
-itcl::body Rappture::IsoMarker::activate { bool } {
-    if  { $bool || $_activePress || $_activeMotion } {
-        $_canvas itemconfigure $_label -state normal
-        $_canvas itemconfigure $_tick -image $_activeIcon
-        $_canvas itemconfigure title -state hidden
-    } else {
-        $_canvas itemconfigure $_label -state hidden
-        $_canvas itemconfigure $_tick -image $_normalIcon
-        $_canvas itemconfigure title -state normal
+    constructor {c obj tf args} { 
+        set _canvas $c
+        set _nvobj $obj
+        set _tf $tf
+        set w [winfo width $_canvas]
+        set h [winfo height $_canvas]
+        set _tick [$c create image 0 $h \
+                -image $_normalIcon -anchor s \
+                -tags "$this $obj" -state hidden]
+        set _label [$c create text 0 $h \
+                -anchor n -fill white -font "Helvetica 8" \
+                -tags "$this $obj" -state hidden]
+        $c bind $_tick <Enter> [itcl::code $this HandleEvent "enter"]
+        $c bind $_tick <Leave> [itcl::code $this HandleEvent "leave"]
+        $c bind $_tick <ButtonPress-1> \
+            [itcl::code $this HandleEvent "start" %x %y]
+        $c bind $_tick <B1-Motion> \
+            [itcl::code $this HandleEvent "update" %x %y]
+        $c bind $_tick <ButtonRelease-1> \
+            [itcl::code $this HandleEvent "end" %x %y]
+    }
+    destructor { 
+        $_canvas delete $this
+    }
+    public method transferfunc {} {
+        return $_tf
+    }
+    public method activate { bool } {
+        if  { $bool || $_activePress || $_activeMotion } {
+            $_canvas itemconfigure $_label -state normal
+            $_canvas itemconfigure $_tick -image $_activeIcon
+        } else {
+            $_canvas itemconfigure $_label -state hidden
+            $_canvas itemconfigure $_tick -image $_normalIcon
+        }
+    }
+    public method visible { bool } {
+        if { $bool } {
+            absval $_value
+            $_canvas itemconfigure $_tick -state normal
+            $_canvas raise $_tick
+        } else {
+            $_canvas itemconfigure $_tick -state hidden
+        }
+    }
+    public method screenpos { } { 
+        set x [relval]
+        if { $x < 0.0 } {
+            set x 0.0
+        } elseif { $x > 1.0 } {
+            set x 1.0 
+        }
+        set low 10 
+        set w [winfo width $_canvas]
+        set high [expr {$w  - 10}]
+        set x [expr {round($x*($high - $low) + $low)}]
+        return $x
+    }
+    public method absval { {x "-get"} } {
+        if { $x != "-get" } {
+            set _value $x
+            set y 31
+            $_canvas itemconfigure $_label -text [format %.2g $_value]
+            set x [screenpos]
+            $_canvas coords $_tick $x [expr {$y+3}]
+            $_canvas coords $_label $x [expr {$y+5}]
+        }
+        return $_value
+    }
+    public method relval  { {x "-get"} } {
+        if { $x == "-get" } {
+            array set limits [$_nvobj limits $_tf] 
+            if { $limits(vmax) == $limits(vmin) } {
+                if { $limits(vmax) == 0.0 } {
+                    set limits(vmin) 0.0
+                    set limits(vmax) 1.0
+                } else {
+                    set limits(vmax) [expr $limits(vmin) + 1.0]
+                }
+            }
+            return [expr {($_value-$limits(vmin))/
+                          ($limits(vmax) - $limits(vmin))}]
+        } 
+        array set limits [$_nvobj limits $_tf] 
+        if { $limits(vmax) == $limits(vmin) } {
+            set limits(vmin) 0.0
+            set limits(vmax) 1.0
+        }
+        if { [catch {expr $limits(vmax) - $limits(vmin)} r] != 0 } {
+            return 0.0
+        }           
+        absval [expr {($x * $r) + $limits(vmin)}]
+    }
+    private method HandleEvent { option args } {
+        switch -- $option {
+            enter {
+                set _activeMotion 1
+                activate yes
+                $_canvas raise $_tick
+            }
+            leave {
+                set _activeMotion 0
+                activate no
+            }
+            start {
+                $_canvas raise $_tick 
+                set _activePress 1
+                activate yes
+                $_canvas itemconfigure limits -state hidden
+            }
+            update {
+                set w [winfo width $_canvas]
+                set x [lindex $args 0]
+                relval [expr {double($x-10)/($w-20)}]
+                $_nvobj overmarker $this $x
+                $_nvobj updatetransferfuncs
+            }
+            end {
+                set x [lindex $args 0]
+                if { ![$_nvobj rmdupmarker $this $x]} {
+                    eval HandleEvent update $args
+                }
+                set _activePress 0
+                activate no
+                $_canvas itemconfigure limits -state normal
+            }
+            default {
+                error "bad option \"$option\": should be start, update, end"
+            }
+        }
     }
 }
-
-itcl::body Rappture::IsoMarker::visible { bool } {
-    if { $bool } {
-        absval $_value
-        $_canvas itemconfigure $_tick -state normal
-        $_canvas raise $_tick
-    } else {
-        $_canvas itemconfigure $_tick -state hidden
-    }
-}
-
-itcl::body Rappture::IsoMarker::screenpos { } { 
-    set x [relval]
-    if { $x < 0.0 } {
-        set x 0.0
-    } elseif { $x > 1.0 } {
-        set x 1.0 
-    }
-    set low 10 
-    set w [winfo width $_canvas]
-    set high [expr {$w  - 10}]
-    set x [expr {round($x*($high - $low) + $low)}]
-    return $x
-}
-
-itcl::body Rappture::IsoMarker::absval { {x "-get"} } {
-    if { $x != "-get" } {
-        set _value $x
-        set y 31
-        $_canvas itemconfigure $_label -text [format %g $_value]
-        set x [screenpos]
-        $_canvas coords $_tick $x [expr {$y+3}]
-        $_canvas coords $_label $x [expr {$y+5}]
-    }
-    return $_value
-}
-
-itcl::body Rappture::IsoMarker::relval  { {x "-get"} } {
-    foreach {min max} [$_nvobj limits $_tf] break
-    if { $x == "-get" } {
-        if { $max == $min } {
-            if { $max == 0.0 } {
-                set min 0.0
-                set max 1.0
-            } else {
-                set max [expr $min + 1.0]
-            }
-        }
-        return [expr {($_value - $min) / ($max - $min)}]
-    } 
-    if { $max == $min } {
-        set min 0.0
-        set max 1.0
-    }
-    if { [catch {expr $max - $min} r] != 0 } {
-        return 0.0
-    }           
-    absval [expr {($x * $r) + $min}]
-}
-
-itcl::body Rappture::IsoMarker::EnterTick {} {
-    set _activeMotion 1
-    activate yes
-    $_canvas raise $_tick
-}
-
-itcl::body Rappture::IsoMarker::LeaveTick {} {
-    set _activeMotion 0
-    activate no
-}
-
-itcl::body Rappture::IsoMarker::StartDrag { x y } {
-    $_canvas raise $_tick 
-    set _activePress 1
-    activate yes
-    $_canvas itemconfigure limits -state hidden
-    $_canvas itemconfigure title -state hidden
-}
-
-itcl::body Rappture::IsoMarker::StopDrag { x y } {
-    if { ![$_nvobj removeDuplicateMarker $this $x]} {
-        ContinueDrag $x $y 
-    }
-    set _activePress 0
-    activate no
-    $_canvas itemconfigure limits -state normal
-    $_canvas itemconfigure title -state normal
-}
-
-itcl::body Rappture::IsoMarker::ContinueDrag { x y } {
-    set w [winfo width $_canvas]
-    relval [expr {double($x-10)/($w-20)}]
-    $_nvobj overMarker $this $x
-    $_nvobj updateTransferFunctions
-    $_canvas raise $_tick 
-    set _activePress 1
-    activate yes
-    $_canvas itemconfigure limits -state hidden
-    $_canvas itemconfigure title -state hidden
-}
-
Index: branches/1.3/gui/scripts/nanovisviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/nanovisviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/nanovisviewer.tcl	(revision 4848)
@@ -1,3 +1,4 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
+
 # ----------------------------------------------------------------------
 #  COMPONENT: nanovisviewer - 3D volume rendering
@@ -75,93 +76,78 @@
     public method isconnected {}
     public method limits { tf }
+    public method overmarker { m x }
     public method parameters {title args} { 
         # do nothing 
     }
+    public method rmdupmarker { m x }
     public method scale {args}
-    public method updateTransferFunctions {}
+    public method updatetransferfuncs {}
+
+    protected method Connect {}
+    protected method CurrentDatasets {{what -all}}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method FixLegend {}
+    protected method AdjustSetting {what {value ""}}
+    protected method InitSettings { args }
+    protected method Pan {option x y}
+    protected method Rebuild {}
+    protected method ReceiveData { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { tf vmin vmax size }
+    protected method Rotate {option x y}
+    protected method SendTransferFuncs {}
+    protected method Slice {option args}
+    protected method SlicerTip {axis}
+    protected method Zoom {option}
 
     # The following methods are only used by this class.
-
-    private method AddNewMarker { x y } 
-    private method AdjustSetting {what {value ""}}
+    private method AddIsoMarker { x y }
     private method BuildCameraTab {}
     private method BuildCutplanesTab {}
     private method BuildViewTab {}
-    private method BuildVolumeComponents {}
     private method BuildVolumeTab {}
-    private method ComputeAlphamap { cname } 
-    private method ComputeTransferFunction { cname }
-    private method Connect {}
-    private method CurrentDatasets {{what -all}}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DrawLegend { cname }
-    private method EventuallyRedrawLegend { } 
+    private method ResetColormap { color }
+    private method ComputeTransferFunc { tf }
     private method EventuallyResize { w h } 
-    private method FixLegend {}
-    private method GetAlphamap { cname color } 
-    private method GetColormap { cname color } 
-    private method GetDatasetsWithComponent { cname } 
+    private method EventuallyResizeLegend { } 
+    private method NameTransferFunc { dataobj comp }
+    private method PanCamera {}
+    private method ParseLevelsOption { tf levels }
+    private method ParseMarkersOption { tf markers }
+    private method volume { tag name }
     private method GetVolumeInfo { w }
-    private method HideAllMarkers {} 
-    private method InitComponentSettings { cname } 
-    private method InitSettings { args }
-    private method NameToAlphamap { name } 
-    private method NameTransferFunction { dataobj comp }
-    private method Pan {option x y}
-    private method PanCamera {}
-    private method ParseLevelsOption { cname levels }
-    private method ParseMarkersOption { cname markers }
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveData { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { tf vmin vmax size }
-    private method RemoveMarker { x y }
-    private method ResetColormap { cname color }
-    private method Rotate {option x y}
-    private method SendTransferFunctions {}
-    private method SetObjectStyle { dataobj cname }
     private method SetOrientation { side }
-    private method Slice {option args}
-    private method SlicerTip {axis}
-    private method SwitchComponent { cname } 
-    private method ToggleVolume { tag name }
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
 
     private variable _dlist ""     ;# list of data objects
+    private variable _allDataObjs
     private variable _obj2ovride   ;# maps dataobj => style override
     private variable _serverDatasets   ;# contains all the dataobj-component 
                                    ;# to volumes in the server
-    private variable _recvdDatasets;    # list of data objs to send to server
-    private variable _dataset2style;    # maps dataobj-component to transfunc
-    private variable _style2datasets;   # maps tf back to list of 
-                                        # dataobj-components using the tf.
-
-    private variable _reset 1;		# Connection to server has been reset.
-    private variable _click;            # Info used for rotate operations.
-    private variable _limits;           # Autoscale min/max for all axes
-    private variable _view;             # View params for 3D view
-    private variable _parsedFunction
-    private variable _transferFunctionEditors
-    private variable _settings
-    private variable _widget
-
-    private variable _first "" ;        # This is the topmost volume.
-    private variable _current "";       # Currently selected component 
-    private variable _volcomponents   ; # Array of components found 
-    private variable _componentsList   ; # Array of components found 
-    private variable _cname2style
-    private variable _cname2transferFunction
-    private variable _cname2defaultcolormap
-    private variable _cname2defaultalphamap
-
+    private variable _serverTfs    ;# contains all the transfer functions 
+                                   ;# in the server.
+    private variable _recvdDatasets    ;# list of data objs to send to server
+    private variable _dataset2style    ;# maps dataobj-component to transfunc
+    private variable _style2datasets   ;# maps tf back to list of 
+                                    # dataobj-components using the tf.
+
+    private variable _reset 1;		# Connection to server has been reset 
+    private variable _click        ;# info used for rotate operations
+    private variable _limits       ;# autoscale min/max for all axes
+    private variable _view         ;# view params for 3D view
+    private variable _isomarkers    ;# array of isosurface level values 0..1
+    private variable  _settings
+    # Array of transfer functions in server.  If 0 the transfer has been
+    # defined but not loaded.  If 1 the transfer function has been named
+    # and loaded.
+    private variable _activeTfs
+    private variable _first ""     ;# This is the topmost volume.
+
+    # This 
+    # indicates which isomarkers and transfer
+    # function to use when changing markers,
+    # opacity, or thickness.
     common _downloadPopup          ;# download options from popup
     private common _hardcopy
@@ -190,5 +176,5 @@
     $_dispatcher register !send_transfunc
     $_dispatcher dispatch $this !send_transfunc \
-        "[itcl::code $this SendTransferFunctions]; list"
+        "[itcl::code $this SendTransferFuncs]; list"
 
     # Rebuild event
@@ -209,50 +195,37 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -qw      0.853553
-        -qx      -0.353553
-        -qy      0.353553
-        -qz      0.146447
-        -xpan    0
-        -ypan    0
-        -zoom    1.0
+        qw      0.853553
+        qx      -0.353553
+        qy      0.353553
+        qz      0.146447
+        zoom    1.0
+        xpan    0
+        ypan    0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
-
-    set _limits(v) [list 0.0 1.0]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
+
+    set _limits(vmin) 0.0
+    set _limits(vmax) 1.0
     set _reset 1
 
-    array set _settings {
-        -axesvisible            1
-        -background             black
-        -colormap               "default"
-        -cutplanesvisible       0
-        -gridvisible            0
-        -isosurfaceshading      0
-        -legendvisible          1
-        -light                  40
-        -light2side             1
-        -outlinevisible         0
-        -qw                     0.853553
-        -qx                     -0.353553
-        -qy                     0.353553
-        -qz                     0.146447
-        -thickness              350
-        -volume                 1
-        -volumeopacity          0.5
-        -volumevisible          1
-        -xcutplaneposition      50
-        -xcutplanevisible       1
-        -xpan                   0
-        -ycutplaneposition      50
-        -ycutplanevisible       1
-        -ypan                   0
-        -zcutplaneposition      50
-        -zcutplanevisible       1
-        -zoom                   1.0
-    }
-    array set _widget {
-        -volumeopacity          50
-    }
+    array set _settings [subst {
+        $this-qw                $_view(qw)
+        $this-qx                $_view(qx)
+        $this-qy                $_view(qy)
+        $this-qz                $_view(qz)
+        $this-zoom              $_view(zoom)    
+        $this-xpan              $_view(xpan)
+        $this-ypan              $_view(ypan)
+        $this-volume            1
+        $this-xcutplane         0
+        $this-xcutposition      0
+        $this-ycutplane         0
+        $this-ycutposition      0
+        $this-zcutplane         0
+        $this-zcutposition      0
+    }]
+
     itk_component add 3dview {
         label $itk_component(plotarea).view -image $_image(plot) \
@@ -275,6 +248,5 @@
     }
     pack $itk_component(reset) -side top -padx 2 -pady 2
-    Rappture::Tooltip::for $itk_component(reset) \
-        "Reset the view to the default zoom level"
+    Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
 
     itk_component add zoomin {
@@ -306,6 +278,6 @@
             -onimage [Rappture::icon volume-on] \
             -offimage [Rappture::icon volume-off] \
-            -command [itcl::code $this AdjustSetting -volume] \
-            -variable [itcl::scope _settings(-volume)]
+            -command [itcl::code $this AdjustSetting volume] \
+            -variable [itcl::scope _settings($this-volume)]
     }
     $itk_component(volume) select
@@ -313,15 +285,4 @@
         "Toggle the volume cloud on/off"
     pack $itk_component(volume) -padx 2 -pady 2
-
-    itk_component add cutplane {
-        Rappture::PushButton $f.cutplane \
-            -onimage [Rappture::icon cutbutton] \
-            -offimage [Rappture::icon cutbutton] \
-            -variable [itcl::scope _settings(-cutplanesvisible)] \
-            -command [itcl::code $this AdjustSetting -cutplanesvisible] 
-    }
-    Rappture::Tooltip::for $itk_component(cutplane) \
-        "Show/Hide cutplanes"
-    pack $itk_component(cutplane) -padx 2 -pady 2
 
     if { [catch {
@@ -336,4 +297,5 @@
 
     # Legend
+
     set _image(legend) [image create photo]
     itk_component add legend {
@@ -345,9 +307,5 @@
     }
     bind $itk_component(legend) <Configure> \
-        [itcl::code $this EventuallyRedrawLegend]
-    bind $itk_component(legend) <KeyPress-Delete> \
-        [itcl::code $this RemoveMarker %x %y]
-    bind $itk_component(legend) <Enter> \
-        [list focus $itk_component(legend)]
+        [itcl::code $this EventuallyResizeLegend]
 
     # Hack around the Tk panewindow.  The problem is that the requested 
@@ -428,9 +386,6 @@
     image delete $_image(legend)
     image delete $_image(download)
-    foreach name [array names _transferFunctionEditors] {
-        itcl::delete object $_transferFunctionEditors($cname)
-    }
     catch { blt::arcball destroy $_arcball }
-    array unset _settings 
+    array unset _settings $this-*
 }
 
@@ -464,4 +419,5 @@
     if {$pos < 0} {
         lappend _dlist $dataobj
+        set _allDataObjs($dataobj) 1
         set _obj2ovride($dataobj-color) $params(-color)
         set _obj2ovride($dataobj-width) $params(-width)
@@ -540,6 +496,6 @@
         if { $pos >= 0 } {
             set _dlist [lreplace $_dlist $pos $pos]
+            array unset _limits $dataobj*
             array unset _obj2ovride $dataobj-*
-            array unset _dataset2style $dataobj-*
             set changed 1
         }
@@ -561,47 +517,28 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::NanovisViewer::scale {args} {
-    array set styles {
-        -color    BCGYR
-        -levels   6
-        -markers  ""
-    }
-    array unset _limits 
-    array unset _volcomponents 
+    foreach val {xmin xmax ymin ymax zmin zmax vmin vmax} {
+        set _limits($val) ""
+    }
     foreach dataobj $args {
         if { ![$dataobj isvalid] } {
             continue;                     # Object doesn't contain valid data.
         }
-        foreach cname [$dataobj components] {
-            if { ![info exists _volcomponents($cname)] } {
-                lappend _componentsList $cname
-                array set styles [lindex [$dataobj components -style $cname] 0]
-                set cmap [ColorsToColormap $styles(-color)]
-                set _cname2defaultcolormap($cname) $cmap
-                set _settings($cname-colormap) $styles(-color)
-            }
-            lappend _volcomponents($cname) $dataobj-$cname
-            array unset limits
-            array set limits [$dataobj valueLimits $cname]
-            set _limits($cname) $limits(v)
-        }
         foreach axis {x y z v} {
             foreach { min max } [$dataobj limits $axis] break
             if {"" != $min && "" != $max} {
-                if { ![info exists _limits($axis)] } {
-                    set _limits($axis) [list $min $max]
+                if {"" == $_limits(${axis}min)} {
+                    set _limits(${axis}min) $min
+                    set _limits(${axis}max) $max
                 } else {
-                    foreach {amin amax} $_limits($axis) break
-                    if {$min < $amin} {
-                        set amin $min
+                    if {$min < $_limits(${axis}min)} {
+                        set _limits(${axis}min) $min
                     }
-                    if {$max > $amax} {
-                        set amax $max
+                    if {$max > $_limits(${axis}max)} {
+                        set _limits(${axis}max) $max
                     }
-                    set _limits($axis) [list $amin $amax]
                 }
             }
         }
     }
-    BuildVolumeComponents
 }
 
@@ -666,5 +603,5 @@
         if { $_reportClientInfo }  {
             # Tell the server the viewer, hub, user and session.
-            # Do this immediately on connect before buffering any commands
+            # Do this immediately on connect before buffing any commands
             global env
 
@@ -726,9 +663,41 @@
 
 # ----------------------------------------------------------------------
-# USAGE: SendTransferFunctions
-# ----------------------------------------------------------------------
-itcl::body Rappture::NanovisViewer::SendTransferFunctions {} {
-    foreach cname [array names _volcomponents] {
-        ComputeTransferFunction $cname
+# USAGE: SendTransferFuncs
+# ----------------------------------------------------------------------
+itcl::body Rappture::NanovisViewer::SendTransferFuncs {} {
+    if { $_first == "" } {
+        puts stderr "first not set"
+        return
+    }
+    # Ensure that the global opacity and thickness settings (in the slider
+    # settings widgets) are used for the active transfer-function.  Update
+    # the values in the _settings varible.
+    set opacity [expr { double($_settings($this-opacity)) * 0.01 }]
+    # Scale values between 0.00001 and 0.01000
+    set thickness [expr {double($_settings($this-thickness)) * 0.0001}]
+
+    foreach tag [CurrentDatasets] {
+        if { ![info exists _serverDatasets($tag)] || !$_serverDatasets($tag) } {
+            # The volume hasn't reached the server yet.  How did we get 
+            # here?
+            puts stderr "Don't have $tag in _serverDatasets"
+            continue
+        }
+        if { ![info exists _dataset2style($tag)] } {
+            puts stderr "don't have style for volume $tag"
+            continue;                        # How does this happen?
+        }
+        set tf $_dataset2style($tag)
+        set _settings($this-$tf-opacity) $opacity
+        set _settings($this-$tf-thickness) $thickness
+        ComputeTransferFunc $tf
+        # FIXME: Need to the send information as to what transfer functions
+        #        to update so that we only update the transfer function 
+        #        as necessary.  Right now, all transfer functions are 
+        #        updated. This makes moving the isomarker slider chunky.
+        if { ![info exists _activeTfs($tf)] || !$_activeTfs($tf) } {
+            set _activeTfs($tf) 1
+        }
+        SendCmd "volume shading transfunc $tf $tag"
     }
     FixLegend
@@ -761,7 +730,24 @@
 
 #
-# DrawLegend --
-#
-itcl::body Rappture::NanovisViewer::DrawLegend { cname } {
+# ReceiveLegend --
+#
+#       The procedure is the response from the render server to each "legend"
+#       command.  The server sends back a "legend" command invoked our
+#       the slave interpreter.  The purpose is to collect data of the image 
+#       representing the legend in the canvas.  In addition, the isomarkers
+#       of the active transfer function are displayed.
+#
+#       I don't know is this is the right place to display the isomarkers.
+#       I don't know all the different paths used to draw the plot. There's 
+#       "Rebuild", "add", etc.
+#
+itcl::body Rappture::NanovisViewer::ReceiveLegend { tf vmin vmax size } {
+    if { ![isconnected] } {
+        return
+    }
+    set bytes [ReceiveBytes $size]
+    $_image(legend) configure -data $bytes
+    ReceiveEcho <<line "<read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
+
     set c $itk_component(legend)
     set w [winfo width $c]
@@ -769,61 +755,47 @@
     set lx 10
     set ly [expr {$h - 1}]
-    if {"" == [$c find withtag colorbar]} {
+    if {"" == [$c find withtag transfunc]} {
         $c create image 10 10 -anchor nw \
-            -image $_image(legend) -tags colorbar
+            -image $_image(legend) -tags transfunc
         $c create text $lx $ly -anchor sw \
-            -fill $itk_option(-plotforeground) -tags "limits text vmin"
+            -fill $itk_option(-plotforeground) -tags "limits vmin"
         $c create text [expr {$w-$lx}] $ly -anchor se \
-            -fill $itk_option(-plotforeground) -tags "limits text vmax"
-        $c create text [expr {$w/2}] $ly -anchor s \
-            -fill $itk_option(-plotforeground) -tags "limits text title"
-        $c lower colorbar
-        $c bind colorbar <ButtonRelease-1> [itcl::code $this AddNewMarker %x %y]
-    }
-
-    # Display the markers used by the current transfer function.
-    HideAllMarkers
-    $_transferFunctionEditors($cname) showMarkers $_limits($cname)
-
-    foreach {min max} $_limits($cname) break
-    $c itemconfigure vmin -text [format %g $min]
+            -fill $itk_option(-plotforeground) -tags "limits vmax"
+        $c lower transfunc
+        $c bind transfunc <ButtonRelease-1> \
+            [itcl::code $this AddIsoMarker %x %y]
+    }
+    # Display the markers used by the active transfer function.
+
+    array set limits [limits $tf]
+    $c itemconfigure vmin -text [format %.2g $limits(min)]
     $c coords vmin $lx $ly
 
-    $c itemconfigure vmax -text [format %g $max]
+    $c itemconfigure vmax -text [format %.2g $limits(max)]
     $c coords vmax [expr {$w-$lx}] $ly
 
-    set title [$_first hints label]
-    set units [$_first hints units]
-    if { $units != "" } {
-        set title "$title ($units)"
-    }
-    $c itemconfigure title -text $title
-    $c coords title [expr {$w/2}] $ly
+    if { [info exists _isomarkers($tf)] } {
+        foreach m $_isomarkers($tf) {
+            $m visible yes
+        }
+    }
 
     # The colormap may have changed. Resync the slicers with the colormap.
-    InitSettings -cutplanesvisible -xcutplanevisible -ycutplanevisible \
-        -zcutplanevisible 
-}
-
-#
-#
-# ReceiveLegend --
-#
-#       The procedure is the response from the render server to each "legend"
-#       command.  The server sends back a "legend" command invoked our
-#       the slave interpreter.  The purpose is to collect data of the image 
-#       representing the legend in the canvas.  In addition, the
-#       active transfer function is displayed.
-#
-#
-itcl::body Rappture::NanovisViewer::ReceiveLegend { cname vmin vmax size } {
-    if { ![isconnected] } {
-        return
-    }
-    set bytes [ReceiveBytes $size]
-    $_image(legend) configure -data $bytes
-    ReceiveEcho <<line "<read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
-
-    DrawLegend $_current
+    set datasets [CurrentDatasets -cutplanes]
+    SendCmd "volume data state $_settings($this-volume) $datasets"
+
+    # Adjust the cutplane for only the first component in the topmost volume
+    # (i.e. the first volume designated in the field).
+    set tag [lindex $datasets 0]
+    foreach axis {x y z} {
+        # Turn off cutplanes for all volumes
+        SendCmd "cutplane state 0 $axis"
+        if { $_settings($this-${axis}cutplane) } {
+            # Turn on cutplane for this particular volume and set the position
+            SendCmd "cutplane state 1 $axis $tag"
+            set pos [expr {0.01*$_settings($this-${axis}cutposition)}]
+            SendCmd "cutplane position $pos $axis $tag"
+        }
+    }
 }
 
@@ -865,13 +837,18 @@
     set dataobj [lindex $parts 0]
     set _serverDatasets($tag) 1
-    if { $_settings(-volumevisible) && $dataobj == $_first } {
+    if { $_settings($this-volume) && $dataobj == $_first } {
         SendCmd "volume state 1 $tag"
     }
-    set _limits($tag) [list $info(min)  $info(max)]
-    set _limits(v)    [list $info(vmin) $info(vmax)]
+    set _limits($tag-min)  $info(min);  # Minimum value of the volume.
+    set _limits($tag-max)  $info(max);  # Maximum value of the volume.
+    set _limits(vmin)      $info(vmin); # Overall minimum value.
+    set _limits(vmax)      $info(vmax); # Overall maximum value.
 
     unset _recvdDatasets($tag)
     if { [array size _recvdDatasets] == 0 } {
-        updateTransferFunctions
+        # The active transfer function is by default the first component of
+        # the first data object.  This assumes that the data is always
+        # successfully transferred.
+        updatetransferfuncs
     }
 }
@@ -897,4 +874,13 @@
     StartBufferingCommands
 
+    # Hide all the isomarkers. Can't remove them. Have to remember the
+    # settings since the user may have created/deleted/moved markers.
+
+    foreach tf [array names _isomarkers] {
+        foreach m $_isomarkers($tf) {
+            $m visible no
+        }
+    }
+
     if { $_width != $w || $_height != $h || $_reset } {
         set _width $w
@@ -903,5 +889,4 @@
         DoResize
     }
-
     foreach dataobj [get] {
         foreach cname [$dataobj components] {
@@ -913,11 +898,10 @@
                         puts stderr "??? $dataobj is invalid"
                     }
-                    set data [$dataobj blob $cname]
+                    set data [$dataobj values $cname]
                 } else {
                     set data [$dataobj vtkdata $cname]
                     if 0 {
                         set f [open "/tmp/volume.vtk" "w"]
-                        fconfigure $f -translation binary -encoding binary
-                        puts -nonewline $f $data
+                        puts $f $data
                         close $f
                     }
@@ -941,11 +925,7 @@
                 set _serverDatasets($tag) 0
             }
-            SetObjectStyle $dataobj $cname
-        }
-    }
-
-    # Outline seems to need to be reset every update.
-    InitSettings -outlinevisible -cutplanesvisible -current
-
+            NameTransferFunc $dataobj $cname
+        }
+    }
     set _first [lindex [get] 0]
     if { $_reset } {
@@ -953,28 +933,24 @@
 	# Reset the camera and other view parameters
 	#
-        set _settings(-qw)    $_view(-qw)
-        set _settings(-qx)    $_view(-qx)
-        set _settings(-qy)    $_view(-qy)
-        set _settings(-qz)    $_view(-qz)
-	set _settings(-xpan)  $_view(-xpan)
-	set _settings(-ypan)  $_view(-ypan)
-	set _settings(-zoom)  $_view(-zoom)
-
-        set q [ViewToQuaternion]
+        set _settings($this-qw)    $_view(qw)
+        set _settings($this-qx)    $_view(qx)
+        set _settings($this-qy)    $_view(qy)
+        set _settings($this-qz)    $_view(qz)
+	set _settings($this-xpan)  $_view(xpan)
+	set _settings($this-ypan)  $_view(ypan)
+	set _settings($this-zoom)  $_view(zoom)
+
+        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
         $_arcball quaternion $q
         SendCmd "camera orient $q"
         SendCmd "camera reset"
 	PanCamera
-	SendCmd "camera zoom $_view(-zoom)"
+	SendCmd "camera zoom $_view(zoom)"
+        InitSettings light2side light transp isosurface grid axes 
 	
-        #cutplane state 0 all
         foreach axis {x y z} {
             # Turn off cutplanes for all volumes
             SendCmd "cutplane state 0 $axis"
         }
-
-        InitSettings -light2side -light -volumeopacity \
-            -isosurfaceshading -gridvisible -axesvisible \
-
 	if {"" != $_first} {
 	    set axis [$_first hints updir]
@@ -988,5 +964,6 @@
 	}
     }
-
+    # Outline seems to need to be reset every update.
+    InitSettings outline
     # nothing to send -- activate the proper ivol
     SendCmd "volume state 0"
@@ -1000,5 +977,5 @@
         set cname [lindex [$_first components] 0]
         if { [info exists _serverDatasets($_first-$cname)] } {
-            updateTransferFunctions
+            updatetransferfuncs
         }
     }
@@ -1026,9 +1003,9 @@
         set tag $_first-$cname
         if { [info exists _serverDatasets($tag)] && $_serverDatasets($tag) } {
-            array set styles {
+            array set style {
                 -cutplanes 1
             }
-            array set styles [lindex [$_first components -style $cname] 0]
-            if { $what != "-cutplanes" || $styles(-cutplanes) } {
+            array set style [lindex [$_first components -style $cname] 0]
+            if { $what != "-cutplanes" || $style(-cutplanes) } {
                 lappend rlist $tag
             }
@@ -1049,22 +1026,22 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            set _settings(-zoom) $_view(-zoom)
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            set _settings($this-zoom) $_view(zoom)
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            set _settings(-zoom) $_view(-zoom)
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            set _settings($this-zoom) $_view(zoom)
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                qw      0.853553
+                qx      -0.353553
+                qy      0.353553
+                qz      0.146447
+                zoom    1.0
+                xpan   0
+                ypan   0
             }
             if { $_first != "" } {
@@ -1074,15 +1051,15 @@
                 }
             }
-            set q [ViewToQuaternion]          
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
             $_arcball quaternion $q
             SendCmd "camera orient $q"
             SendCmd "camera reset"
-            set _settings(-qw)    $_view(-qw)
-            set _settings(-qx)    $_view(-qx)
-            set _settings(-qy)    $_view(-qy)
-            set _settings(-qz)    $_view(-qz)
-            set _settings(-xpan)  $_view(-xpan)
-            set _settings(-ypan)  $_view(-ypan)
-            set _settings(-zoom)  $_view(-zoom)
+            set _settings($this-qw)    $_view(qw)
+            set _settings($this-qx)    $_view(qx)
+            set _settings($this-qy)    $_view(qy)
+            set _settings($this-qz)    $_view(qz)
+            set _settings($this-xpan)  $_view(xpan)
+            set _settings($this-ypan)  $_view(ypan)
+            set _settings($this-zoom)  $_view(zoom)
         }
     }
@@ -1090,6 +1067,8 @@
 
 itcl::body Rappture::NanovisViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    #set x [expr ($_view(xpan)) / $_limits(xrange)]
+    #set y [expr ($_view(ypan)) / $_limits(yrange)]
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
@@ -1130,9 +1109,9 @@
 
                 set q [$_arcball rotate $x $y $_click(x) $_click(y)]
-                QuaternionToView $q
-                set _settings(-qw) $_view(-qw)
-                set _settings(-qx) $_view(-qx)
-                set _settings(-qy) $_view(-qy)
-                set _settings(-qz) $_view(-qz)
+                foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
+                set _settings($this-qw) $_view(qw)
+                set _settings($this-qx) $_view(qx)
+                set _settings($this-qy) $_view(qy)
+                set _settings($this-qz) $_view(qz)
                 SendCmd "camera orient $q"
 
@@ -1167,9 +1146,9 @@
         set x [expr $x / double($w)]
         set y [expr $y / double($h)]
-        set _view(-xpan) [expr $_view(-xpan) + $x]
-        set _view(-ypan) [expr $_view(-ypan) + $y]
+        set _view(xpan) [expr $_view(xpan) + $x]
+        set _view(ypan) [expr $_view(ypan) + $y]
         PanCamera
-        set _settings(-xpan) $_view(-xpan)
-        set _settings(-ypan) $_view(-ypan)
+        set _settings($this-xpan) $_view(xpan)
+        set _settings($this-ypan) $_view(ypan)
         return
     }
@@ -1184,9 +1163,9 @@
         set _click(x) $x
         set _click(y) $y
-        set _view(-xpan) [expr $_view(-xpan) - $dx]
-        set _view(-ypan) [expr $_view(-ypan) - $dy]
+        set _view(xpan) [expr $_view(xpan) - $dx]
+        set _view(ypan) [expr $_view(ypan) - $dy]
         PanCamera
-        set _settings(-xpan) $_view(-xpan)
-        set _settings(-ypan) $_view(-ypan)
+        set _settings($this-xpan) $_view(xpan)
+        set _settings($this-ypan) $_view(ypan)
     }
     if { $option == "release" } {
@@ -1220,53 +1199,65 @@
     }
     switch -- $what {
-        "-axesvisible" {
-            SendCmd "axis visible $_settings($what)"
-        }
-        "-background" {
-            set bgcolor [$itk_component(background) value]
-	    array set fgcolors {
-		"black" "white"
-		"white" "black"
-		"grey"	"black"
-	    }
-            configure -plotbackground $bgcolor \
-		-plotforeground $fgcolors($bgcolor)
- 	    DrawLegend $_current
-        }
-        "-colormap" {
+        light {
+            set val $_settings($this-light)
+            set diffuse [expr {0.01*$val}]
+            set ambient [expr {1.0-$diffuse}]
+            set specularLevel 0.3
+            set specularExp 90.0
+            SendCmd "volume shading ambient $ambient"
+            SendCmd "volume shading diffuse $diffuse"
+            SendCmd "volume shading specularLevel $specularLevel"
+            SendCmd "volume shading specularExp $specularExp"
+        }
+        light2side {
+            set val $_settings($this-light2side)
+            SendCmd "volume shading light2side $val"
+        }
+        transp {
+            set val $_settings($this-transp)
+            set sval [expr { 0.01 * double($val) }]
+            SendCmd "volume shading opacity $sval"
+        }
+        opacity {
+            set val $_settings($this-opacity)
+            set sval [expr { 0.01 * double($val) }]
+            foreach tf [array names _activeTfs] {
+                set _settings($this-$tf-opacity) $sval
+                set _activeTfs($tf) 0
+            }
+            updatetransferfuncs
+        }
+        thickness {
+            if { [array names _activeTfs] > 0 } {
+                set val $_settings($this-thickness)
+                # Scale values between 0.00001 and 0.01000
+                set sval [expr {0.0001*double($val)}]
+                foreach tf [array names _activeTfs] {
+                    set _settings($this-$tf-thickness) $sval
+                    set _activeTfs($tf) 0
+                }
+                updatetransferfuncs
+            }
+        }
+        "outline" {
+            SendCmd "volume outline state $_settings($this-outline)"
+        }
+        "isosurface" {
+            SendCmd "volume shading isosurface $_settings($this-isosurface)"
+        }
+        "colormap" {
             set color [$itk_component(colormap) value]
-            set _settings($what) $color
-            set _settings($_current${what}) $color
-            ResetColormap $_current $color
-        }
-        "-current" {
-            set cname [$itk_component(volcomponents) value]
-            SwitchComponent $cname
-        }
-        "-cutplanesvisible" {
-            set bool $_settings($what)
-            # We only set cutplanes on the first dataset.
-            set datasets [CurrentDatasets -cutplanes]
-            set tag [lindex $datasets 0]
-            if { $bool } {
-                foreach axis { x y z } {
-                    if { $_settings(-${axis}cutplanevisible) } {
-                        SendCmd "cutplane state 1 $axis $tag"
-                    }
-                }
-            } else {
-                foreach axis { x y z } {
-                    SendCmd "cutplane state 0 $axis $tag"
-                }
-            }
-        }
-        "-gridvisible" {
-            SendCmd "grid visible $_settings($what)"
-        }
-        "-isosurfaceshading" {
-            SendCmd "volume shading isosurface $_settings($what)"
-        }
-        "-legendvisible" {
-            if { $_settings($what) } {
+            set _settings(colormap) $color
+            # Only set the colormap on the first volume. Ignore the others.
+            #ResetColormap $color
+        }
+        "grid" {
+            SendCmd "grid visible $_settings($this-grid)"
+        }
+        "axes" {
+            SendCmd "axis visible $_settings($this-axes)"
+        }
+        "legend" {
+            if { $_settings($this-legend) } {
                 blt::table $itk_component(plotarea) \
                     0,0 $itk_component(3dview) -fill both \
@@ -1277,70 +1268,14 @@
             }
         }
-        "-light" {
-            set _settings($_current${what}) $_settings($what)
-            set val $_settings($what)
-            set diffuse [expr {0.01*$val}]
-            set ambient [expr {1.0-$diffuse}]
-            set specularLevel 0.3
-            set specularExp 90.0
-            foreach tag [GetDatasetsWithComponent $_current] {
-                SendCmd "volume shading ambient $ambient $tag"
-                SendCmd "volume shading diffuse $diffuse $tag"
-                SendCmd "volume shading specularLevel $specularLevel $tag"
-                SendCmd "volume shading specularExp $specularExp $tag"
-            }
-        }
-        "-light2side" {
-            set _settings($_current${what}) $_settings($what)
-            set val $_settings($what)
-            foreach tag [GetDatasetsWithComponent $_current] {
-                SendCmd "volume shading light2side $val $tag"
-            }
-        }
-        "-outlinevisible" {
-            SendCmd "volume outline state $_settings($what)"
-        }
-        "-thickness" {
-            set val $_settings($what)
-            set _settings($_current${what}) $val
-            updateTransferFunctions
-        }
-        "-volume" {
-            # This is the global volume visibility control.  It controls the
-            # visibility of all the all volumes.  Whenever it's changed, you
-            # have to synchronize each of the local controls (see below) with
-            # this.
-            set datasets [CurrentDatasets] 
-            set bool $_settings($what)
-            SendCmd "volume data state $bool $datasets"
-            foreach cname $_componentsList {
-                set _settings($cname-volumevisible) $bool
-            }
-            set _settings(-volumevisible) $bool
-        }
-        "-volumeopacity" {
-            set _settings($what) [expr $_widget($what) * 0.01]
-            set _settings($_current${what}) $_settings($what)
-            foreach tag [GetDatasetsWithComponent $_current] {
-                SendCmd "volume shading opacity $_settings($what) $tag"
-            }
-        }
-        "-volumevisible" {
-            # This is the component specific control.  It changes the 
-            # visibility of only the current component.
-            set _settings($_current${what}) $_settings($what)
-            foreach tag [GetDatasetsWithComponent $_current] {
-                SendCmd "volume data state $_settings($what) $tag"
-            }
-        }
-        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
-            set axis [string range $what 1 1]
-            set bool $_settings($what)
-            # We only set cutplanes on the first dataset.
+        "volume" {
+            set datasets [CurrentDatasets -cutplanes] 
+            SendCmd "volume data state $_settings($this-volume) $datasets"
+        }
+        "xcutplane" - "ycutplane" - "zcutplane" {
+            set axis [string range $what 0 0]
+            set bool $_settings($this-$what)
             set datasets [CurrentDatasets -cutplanes] 
             set tag [lindex $datasets 0]
-            if { $_settings(-cutplanesvisible) } {
-                SendCmd "cutplane state $bool $axis $tag"
-            }
+            SendCmd "cutplane state $bool $axis $tag"
             if { $bool } {
                 $itk_component(${axis}CutScale) configure -state normal \
@@ -1369,13 +1304,19 @@
     set w [expr {$_width-20}]
     set h [expr {[winfo height $itk_component(legend)]-20-$lineht}]
-    if {$w > 0 && $h > 0 && $_first != "" } {
-        if { [info exists _cname2transferFunction($_current)] } {
-            SendCmd "legend $_current $w $h"
-        }
-    }
-}
-
-#
-# NameTransferFunction --
+    if {$w > 0 && $h > 0 && [array names _activeTfs] > 0 && $_first != "" } {
+        set tag [lindex [CurrentDatasets] 0]
+        if { [info exists _dataset2style($tag)] } {
+            SendCmd "legend $_dataset2style($tag) $w $h"
+        }
+    } else {
+        # Can't do this as this will remove the items associated with the
+        # isomarkers.
+        
+        #$itk_component(legend) delete all
+    }
+}
+
+#
+# NameTransferFunc --
 #
 #       Creates a transfer function name based on the <style> settings in the
@@ -1385,43 +1326,44 @@
 #       server parses the 3D data and sends back the limits via ReceiveData.]
 #
-itcl::body Rappture::NanovisViewer::NameTransferFunction { dataobj cname } {
-    array set styles {
+#       FIXME: The current way we generate transfer-function names completely
+#              ignores the -markers option.  The problem is that we are forced
+#              to compute the name from an increasing complex set of values:
+#              color, levels, marker, opacity.  I think we're stuck doing it
+#              now.
+#
+itcl::body Rappture::NanovisViewer::NameTransferFunc { dataobj cname } {
+    array set style {
         -color BCGYR
         -levels 6
+        -opacity 1.0
         -markers ""
     }
     set tag $dataobj-$cname
-    array set styles [lindex [$dataobj components -style $cname] 0]
-    if { ![info exists _cname2transferFunction($cname)] } {
-        # Get the colormap right now, since it doesn't change with marker
-        # changes.
-        set cmap [ColorsToColormap $styles(-color)]
-        set wmap [list 0.0 0.0 1.0 1.0]
-        set _cname2transferFunction($cname) [list $cmap $wmap]
-        SendCmd [list transfunc define $cname $cmap $wmap]
-    }
-    SendCmd "volume shading transfunc $cname $tag"
-    if { ![info exists _transferFunctionEditors($cname)] } {
-        set _transferFunctionEditors($cname) \
-            [Rappture::TransferFunctionEditor ::\#auto $itk_component(legend) \
-                 $cname \
-                 -command [itcl::code $this updateTransferFunctions]]
-    }
-    set _dataset2style($tag) $cname
-    lappend _style2datasets($cname) $tag
-    return $cname
-}
-
-#
-# ComputeTransferFunction --
-#
-#       Computes and sends the transfer function to the render server.  It's
-#       assumed that the volume data limits are known and that the global
-#       transfer-functions slider values have been set up.  Both parts are
-#       needed to compute the relative value (location) of the marker, and
-#       the alpha map of the transfer function.
-#
-itcl::body Rappture::NanovisViewer::ComputeTransferFunction { cname } {
-    foreach {cmap wmap} $_cname2transferFunction($cname) break
+    array set style [lindex [$dataobj components -style $cname] 0]
+    set tf "$style(-color):$style(-levels):$style(-opacity)"
+    set _dataset2style($tag) $tf
+    lappend _style2datasets($tf) $tag
+    return $tf
+}
+
+#
+# ComputeTransferFunc --
+#
+#   Computes and sends the transfer function to the render server.  It's
+#   assumed that the volume data limits are known and that the global
+#   transfer-functions slider values have been set up.  Both parts are
+#   needed to compute the relative value (location) of the marker, and
+#   the alpha map of the transfer function.
+#
+itcl::body Rappture::NanovisViewer::ComputeTransferFunc { tf } {
+    array set style {
+        -color BCGYR
+        -levels 6
+        -opacity 1.0
+        -markers ""
+    }
+
+    foreach {dataobj cname} [split [lindex $_style2datasets($tf) 0] -] break
+    array set style [lindex [$dataobj components -style $cname] 0]
 
     # We have to parse the style attributes for a volume using this
@@ -1431,45 +1373,80 @@
     # of the volumes (the first in the list) using the transfer-function as a
     # reference.
-    if { ![info exists _parsedFunction($cname)] } {
-        array set styles {
-            -color BCGYR
-            -levels 6
-            -markers ""
-        }
-        # Accumulate the style from all the datasets using it.
-        foreach tag [GetDatasetsWithComponent $cname] {
-            foreach {dataobj cname} [split [lindex $tag 0] -] break
-            array set styles [lindex [$dataobj components -style $cname] 0]
-        }
-        eval $_transferFunctionEditors($cname) limits $_limits($cname)
+    #
+    # FIXME: The current way we generate transfer-function names completely 
+    #        ignores the -markers option.  The problem is that we are forced 
+    #        to compute the name from an increasing complex set of values: 
+    #        color, levels, marker, opacity.  I think the cow's out of the
+    #        barn on this one.
+
+    if { ![info exists _isomarkers($tf)] } {
         # Have to defer creation of isomarkers until we have data limits
-        if { [info exists styles(-markers)] &&
-             [llength $styles(-markers)] > 0 } {
-            ParseMarkersOption $cname $styles(-markers)
+        if { [info exists style(-markers)] &&
+             [llength $style(-markers)] > 0 } {
+            ParseMarkersOption $tf $style(-markers)
         } else {
-            ParseLevelsOption $cname $styles(-levels)
-        }
-        
-    }
-    set wmap [ComputeAlphamap $cname]
-    set _cname2transferFunction($cname) [list $cmap $wmap]
-    SendCmd [list transfunc define $cname $cmap $wmap]
-}
-
-itcl::body Rappture::NanovisViewer::AddNewMarker { x y } {
-    if { ![info exists _transferFunctionEditors($_current)] } {
-        continue
-    }
-    # Add a new marker to the current transfer function
-    $_transferFunctionEditors($_current) newMarker $x $y normal
-    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
-}
-
-itcl::body Rappture::NanovisViewer::RemoveMarker { x y } {
-    if { ![info exists _transferFunctionEditors($_current)] } {
-        continue
-    }
-    # Add a new marker to the current transfer function
-    $_transferFunctionEditors($_current) deleteMarker $x $y 
+            ParseLevelsOption $tf $style(-levels)
+        }
+    }
+    set cmap [ColorsToColormap $style(-color)]
+    set tag $this-$tf
+    if { ![info exists _settings($tag-opacity)] } {
+        set _settings($tag-opacity) $style(-opacity)
+    }
+    set max 1.0 ;#$_settings($tag-opacity)
+
+    set isovalues {}
+    foreach m $_isomarkers($tf) {
+        lappend isovalues [$m relval]
+    }
+    # Sort the isovalues
+    set isovalues [lsort -real $isovalues]
+
+    if { ![info exists _settings($tag-thickness)]} {
+        set _settings($tag-thickness) 0.005
+    }
+    set delta $_settings($tag-thickness)
+
+    set first [lindex $isovalues 0]
+    set last [lindex $isovalues end]
+    set wmap ""
+    if { $first == "" || $first != 0.0 } {
+        lappend wmap 0.0 0.0
+    }
+    foreach x $isovalues {
+        set x1 [expr {$x-$delta-0.00001}]
+        set x2 [expr {$x-$delta}]
+        set x3 [expr {$x+$delta}]
+        set x4 [expr {$x+$delta+0.00001}]
+        if { $x1 < 0.0 } {
+            set x1 0.0
+        } elseif { $x1 > 1.0 } {
+            set x1 1.0
+        }
+        if { $x2 < 0.0 } {
+            set x2 0.0
+        } elseif { $x2 > 1.0 } {
+            set x2 1.0
+        }
+        if { $x3 < 0.0 } {
+            set x3 0.0
+        } elseif { $x3 > 1.0 } {
+            set x3 1.0
+        }
+        if { $x4 < 0.0 } {
+            set x4 0.0
+        } elseif { $x4 > 1.0 } {
+            set x4 1.0
+        }
+        # add spikes in the middle
+        lappend wmap $x1 0.0
+        lappend wmap $x2 $max
+        lappend wmap $x3 $max
+        lappend wmap $x4 0.0
+    }
+    if { $last == "" || $last != 1.0 } {
+        lappend wmap 1.0 0.0
+    }
+    SendCmd "transfunc define $tf { $cmap } { $wmap }"
 }
 
@@ -1479,8 +1456,7 @@
 itcl::configbody Rappture::NanovisViewer::plotbackground {
     if { [isconnected] } {
-        set color $itk_option(-plotbackground)
-        set rgb [Color2RGB $color]
-        SendCmd "screen bgcolor $rgb"
-        $itk_component(legend) configure -background $color
+        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1491,11 +1467,7 @@
 itcl::configbody Rappture::NanovisViewer::plotforeground {
     if { [isconnected] } {
-        set color $itk_option(-plotforeground)
-        set rgb [Color2RGB $color]
-        SendCmd "volume outline color $rgb"
-        SendCmd "grid axiscolor $rgb"
-        SendCmd "grid linecolor $rgb"
-        $itk_component(legend) itemconfigure labels -fill $color 
-        $itk_component(legend) itemconfigure limits -fill $color 
+        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1524,20 +1496,21 @@
 # marker is a relative value from 0.0 to 1.0.
 #
-itcl::body Rappture::NanovisViewer::ParseLevelsOption { cname levels } {
+itcl::body Rappture::NanovisViewer::ParseLevelsOption { tf levels } {
     set c $itk_component(legend)
-    set list {}
     regsub -all "," $levels " " levels
     if {[string is int $levels]} {
         for {set i 1} { $i <= $levels } {incr i} {
-            lappend list [expr {double($i)/($levels+1)}]
+            set x [expr {double($i)/($levels+1)}]
+            set m [Rappture::IsoMarker \#auto $c $this $tf]
+            $m relval $x
+            lappend _isomarkers($tf) $m 
         }
     } else {
         foreach x $levels {
-            lappend list $x
-        }
-    }
-    set _parsedFunction($cname) 1
-    $_transferFunctionEditors($cname) addMarkers $list
-    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
+            set m [Rappture::IsoMarker \#auto $c $this $tf]
+            $m relval $x
+            lappend _isomarkers($tf) $m 
+        }
+    }
 }
 
@@ -1554,22 +1527,22 @@
 #       not be seen.
 #
-itcl::body Rappture::NanovisViewer::ParseMarkersOption { cname markers } {
+itcl::body Rappture::NanovisViewer::ParseMarkersOption { tf markers } {
     set c $itk_component(legend)
-    set list {}
-    foreach { min max } $_limits($cname) break
     regsub -all "," $markers " " markers
     foreach marker $markers {
         set n [scan $marker "%g%s" value suffix]
         if { $n == 2 && $suffix == "%" } {
-            # $n% : Set relative value (0..1). 
-            lappend list [expr {$value * 0.01}]
+            # ${n}% : Set relative value. 
+            set value [expr {$value * 0.01}]
+            set m [Rappture::IsoMarker \#auto $c $this $tf]
+            $m relval $value
+            lappend _isomarkers($tf) $m
         } else {
-            # $n : absolute value, compute relative
-            lappend list  [expr {(double($value)-$min)/($max-$min)]}
-        }
-    }
-    set _parsedFunction($cname) 1
-    $_transferFunctionEditors($cname) addMarkers $list
-    $itk_component(legend) itemconfigure labels -fill $itk_option(-plotforeground)
+            # ${n} : Set absolute value.
+            set m [Rappture::IsoMarker \#auto $c $this $tf]
+            $m absval $value
+            lappend _isomarkers($tf) $m
+        }
+    }
 }
 
@@ -1577,25 +1550,82 @@
 # USAGE: UndateTransferFuncs 
 # ----------------------------------------------------------------------
-itcl::body Rappture::NanovisViewer::updateTransferFunctions {} {
+itcl::body Rappture::NanovisViewer::updatetransferfuncs {} {
     $_dispatcher event -idle !send_transfunc
 }
 
-itcl::body Rappture::NanovisViewer::limits { cname } {
+itcl::body Rappture::NanovisViewer::AddIsoMarker { x y } {
+    if { $_first == "" } {
+        error "active transfer function isn't set"
+    }
+    set tag [lindex [CurrentDatasets] 0]
+    set tf $_dataset2style($tag)
+    set c $itk_component(legend)
+    set m [Rappture::IsoMarker \#auto $c $this $tf]
+    set w [winfo width $c]
+    $m relval [expr {double($x-10)/($w-20)}]
+    lappend _isomarkers($tf) $m
+    updatetransferfuncs
+    return 1
+}
+
+itcl::body Rappture::NanovisViewer::rmdupmarker { marker x } {
+    set tf [$marker transferfunc]
+    set bool 0
+    if { [info exists _isomarkers($tf)] } {
+        set list {}
+        set marker [namespace tail $marker]
+        foreach m $_isomarkers($tf) {
+            set sx [$m screenpos]
+            if { $m != $marker } {
+                if { $x >= ($sx-3) && $x <= ($sx+3) } {
+                    $marker relval [$m relval]
+                    itcl::delete object $m
+                    bell
+                    set bool 1
+                    continue
+                }
+            }
+            lappend list $m
+        }
+        set _isomarkers($tf) $list
+        updatetransferfuncs
+    }
+    return $bool
+}
+
+itcl::body Rappture::NanovisViewer::overmarker { marker x } {
+    set tf [$marker transferfunc]
+    if { [info exists _isomarkers($tf)] } {
+        set marker [namespace tail $marker]
+        foreach m $_isomarkers($tf) {
+            set sx [$m screenpos]
+            if { $m != $marker } {
+                set bool [expr { $x >= ($sx-3) && $x <= ($sx+3) }]
+                $m activate $bool
+            }
+        }
+    }
+    return ""
+}
+
+itcl::body Rappture::NanovisViewer::limits { tf } {
     set _limits(min) 0.0
     set _limits(max) 1.0
-    if { ![info exists _style2datasets($cname)] } {
+    if { ![info exists _style2datasets($tf)] } {
         return [array get _limits]
     }
     set min ""; set max ""
-    foreach tag [GetDatasetsWithComponent $cname] {
-        if { ![info exists _limits($tag)] } {
+    foreach tag $_style2datasets($tf) {
+        if { ![info exists _serverDatasets($tag)] } {
             continue
         }
-        foreach {amin amax} $_limits($tag) break
-        if { $min == "" || $min > $amin } {
-            set min $amin
-        }
-        if { $max == "" || $max < $amax } {
-            set max $amax
+        if { ![info exists _limits($tag-min)] } {
+            continue
+        }
+        if { $min == "" || $min > $_limits($tag-min) } {
+            set min $_limits($tag-min)
+        }
+        if { $max == "" || $max < $_limits($tag-max) } {
+            set max $_limits($tag-max)
         }
     }
@@ -1606,9 +1636,21 @@
         set _limits(max) $max
     }
-    return [list $_limits(min) $_limits(max)]
+    return [array get _limits]
 }
 
 
 itcl::body Rappture::NanovisViewer::BuildViewTab {} {
+    foreach { key value } {
+        grid            0
+        axes            1
+        outline         0
+        volume          1
+        legend          1
+        particles       1
+        lic             1
+    } {
+        set _settings($this-$key) $value
+    }
+
     set fg [option get $itk_component(hull) font Font]
     #set bfg [option get $itk_component(hull) boldFont Font]
@@ -1619,53 +1661,40 @@
     $inner configure -borderwidth 4
 
-    set ::Rappture::NanovisViewer::_settings(-isosurfaceshading) 0
+    set ::Rappture::NanovisViewer::_settings($this-isosurface) 0
     checkbutton $inner.isosurface \
         -text "Isosurface shading" \
-        -variable [itcl::scope _settings(-isosurfaceshading)] \
-        -command [itcl::code $this AdjustSetting -isosurfaceshading] \
+        -variable [itcl::scope _settings($this-isosurface)] \
+        -command [itcl::code $this AdjustSetting isosurface] \
         -font "Arial 9"
 
     checkbutton $inner.axes \
         -text "Axes" \
-        -variable [itcl::scope _settings(-axesvisible)] \
-        -command [itcl::code $this AdjustSetting -axesvisible] \
+        -variable [itcl::scope _settings($this-axes)] \
+        -command [itcl::code $this AdjustSetting axes] \
         -font "Arial 9"
 
     checkbutton $inner.grid \
         -text "Grid" \
-        -variable [itcl::scope _settings(-gridvisible)] \
-        -command [itcl::code $this AdjustSetting -gridvisible] \
+        -variable [itcl::scope _settings($this-grid)] \
+        -command [itcl::code $this AdjustSetting grid] \
         -font "Arial 9"
 
     checkbutton $inner.outline \
         -text "Outline" \
-        -variable [itcl::scope _settings(-outlinevisible)] \
-        -command [itcl::code $this AdjustSetting -outlinevisible] \
+        -variable [itcl::scope _settings($this-outline)] \
+        -command [itcl::code $this AdjustSetting outline] \
         -font "Arial 9"
 
     checkbutton $inner.legend \
         -text "Legend" \
-        -variable [itcl::scope _settings(-legendvisible)] \
-        -command [itcl::code $this AdjustSetting -legendvisible] \
+        -variable [itcl::scope _settings($this-legend)] \
+        -command [itcl::code $this AdjustSetting legend] \
         -font "Arial 9"
 
     checkbutton $inner.volume \
         -text "Volume" \
-        -variable [itcl::scope _settings(-volume)] \
-        -command [itcl::code $this AdjustSetting -volume] \
+        -variable [itcl::scope _settings($this-volume)] \
+        -command [itcl::code $this AdjustSetting volume] \
         -font "Arial 9"
-
-    label $inner.background_l -text "Background" -font "Arial 9" 
-    itk_component add background {
-        Rappture::Combobox $inner.background -width 10 -editable no
-    }
-    $inner.background choices insert end \
-        "black"              "black"            \
-        "white"              "white"            \
-        "grey"               "grey"             
-
-    $itk_component(background) value $_settings(-background)
-    bind $inner.background <<Value>> \
-        [itcl::code $this AdjustSetting -background]
 
     blt::table $inner \
@@ -1674,7 +1703,5 @@
         2,0 $inner.outline  -cspan 2 -anchor w \
         3,0 $inner.volume  -cspan 2 -anchor w \
-        4,0 $inner.legend  -cspan 2 -anchor w \
-        5,0 $inner.background_l       -anchor e -pady 2 \
-        5,1 $inner.background                   -fill x \
+        4,0 $inner.legend  -cspan 2 -anchor w 
 
     if 0 {
@@ -1682,8 +1709,18 @@
     }
     blt::table configure $inner r* -resize none
-    blt::table configure $inner r6 -resize expand
+    blt::table configure $inner r5 -resize expand
 }
 
 itcl::body Rappture::NanovisViewer::BuildVolumeTab {} {
+    foreach { key value } {
+        light2side      1
+        light           40
+        transp          50
+        opacity         100
+        thickness       350
+    } {
+        set _settings($this-$key) $value
+    }
+
     set inner [$itk_component(main) insert end \
         -title "Volume Settings" \
@@ -1694,75 +1731,85 @@
     #set bfg [option get $itk_component(hull) boldFont Font]
 
+    checkbutton $inner.vol -text "Show volume" -font $fg \
+        -variable [itcl::scope _settings($this-volume)] \
+        -command [itcl::code $this AdjustSetting volume]
     label $inner.shading -text "Shading:" -font $fg
 
     checkbutton $inner.light2side -text "Two-sided lighting" -font $fg \
-        -variable [itcl::scope _settings(-light2side)] \
-        -command [itcl::code $this AdjustSetting -light2side]
-
-    checkbutton $inner.visibility -text "Visible" -font $fg \
-        -variable [itcl::scope _settings(-volumevisible)] \
-        -command [itcl::code $this AdjustSetting -volumevisible]
+        -variable [itcl::scope _settings($this-light2side)] \
+        -command [itcl::code $this AdjustSetting light2side]
 
     label $inner.dim -text "Glow" -font $fg
     ::scale $inner.light -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-light)] \
+        -variable [itcl::scope _settings($this-light)] \
         -width 10 \
-        -showvalue off -command [itcl::code $this AdjustSetting -light]
+        -showvalue off -command [itcl::code $this AdjustSetting light]
     label $inner.bright -text "Surface" -font $fg
 
-    # Opacity
     label $inner.fog -text "Clear" -font $fg
     ::scale $inner.transp -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _widget(-volumeopacity)] \
+        -variable [itcl::scope _settings($this-transp)] \
         -width 10 \
-        -showvalue off -command [itcl::code $this AdjustSetting -volumeopacity]
+        -showvalue off -command [itcl::code $this AdjustSetting transp]
     label $inner.plastic -text "Opaque" -font $fg
 
-    # Tooth thickness
+    label $inner.clear -text "Clear" -font $fg
+    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
+        -variable [itcl::scope _settings($this-opacity)] \
+        -width 10 \
+        -showvalue off -command [itcl::code $this AdjustSetting opacity]
+    label $inner.opaque -text "Opaque" -font $fg
+
     label $inner.thin -text "Thin" -font $fg
     ::scale $inner.thickness -from 0 -to 1000 -orient horizontal \
-        -variable [itcl::scope _settings(-thickness)] \
+        -variable [itcl::scope _settings($this-thickness)] \
         -width 10 \
-        -showvalue off -command [itcl::code $this AdjustSetting -thickness]
+        -showvalue off -command [itcl::code $this AdjustSetting thickness]
     label $inner.thick -text "Thick" -font $fg
 
-    # Colormap 
-    label $inner.colormap_l -text "Colormap" -font $fg
+    label $inner.colormap_l -text "Colormap" -font "Arial 9" 
     itk_component add colormap {
         Rappture::Combobox $inner.colormap -width 10 -editable no
     }
 
-    $inner.colormap choices insert end [GetColormapList -includeDefault -includeNone]
+    $inner.colormap choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   \
+	"none"		     "none"
+
+    $itk_component(colormap) value "BCGYR"
     bind $inner.colormap <<Value>> \
-        [itcl::code $this AdjustSetting -colormap]
-    $itk_component(colormap) value "default"
-    set _settings(-colormap) "default"
-
-    # Component
-    label $inner.volcomponents_l -text "Component" -font $fg
-    itk_component add volcomponents {
-        Rappture::Combobox $inner.volcomponents -editable no
-    }
-    bind $inner.volcomponents <<Value>> \
-        [itcl::code $this AdjustSetting -current]
+        [itcl::code $this AdjustSetting colormap]
 
     blt::table $inner \
-        0,0 $inner.volcomponents_l -anchor e -cspan 2 \
-        0,2 $inner.volcomponents             -cspan 3 -fill x \
+        0,0 $inner.vol -cspan 4 -anchor w -pady 2 \
         1,0 $inner.shading -cspan 4 -anchor w -pady {10 2} \
         2,0 $inner.light2side -cspan 4 -anchor w -pady 2 \
-        3,0 $inner.visibility -cspan 4 -anchor w -pady 2 \
-        4,0 $inner.dim -anchor e -pady 2 \
-        4,1 $inner.light -cspan 2 -pady 2 -fill x \
-        4,3 $inner.bright -anchor w -pady 2 \
-        5,0 $inner.fog -anchor e -pady 2 \
-        5,1 $inner.transp -cspan 2 -pady 2 -fill x \
-        5,3 $inner.plastic -anchor w -pady 2 \
-        6,0 $inner.thin -anchor e -pady 2 \
-        6,1 $inner.thickness -cspan 2 -pady 2 -fill x\
-        6,3 $inner.thick -anchor w -pady 2
+        3,0 $inner.dim -anchor e -pady 2 \
+        3,1 $inner.light -cspan 2 -pady 2 -fill x \
+        3,3 $inner.bright -anchor w -pady 2 \
+        4,0 $inner.fog -anchor e -pady 2 \
+        4,1 $inner.transp -cspan 2 -pady 2 -fill x \
+        4,3 $inner.plastic -anchor w -pady 2 \
+        5,0 $inner.thin -anchor e -pady 2 \
+        5,1 $inner.thickness -cspan 2 -pady 2 -fill x\
+        5,3 $inner.thick -anchor w -pady 2
 
     blt::table configure $inner c0 c1 c3 r* -resize none
-    blt::table configure $inner r7 -resize expand
+    blt::table configure $inner r6 -resize expand
 }
 
@@ -1773,10 +1820,4 @@
     $inner configure -borderwidth 4
 
-    checkbutton $inner.visible \
-        -text "Show Cutplanes" \
-        -variable [itcl::scope _settings(-cutplanesvisible)] \
-        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
-        -font "Arial 9"
-
     # X-value slicer...
     itk_component add xCutButton {
@@ -1784,10 +1825,9 @@
             -onimage [Rappture::icon x-cutplane] \
             -offimage [Rappture::icon x-cutplane] \
-            -command [itcl::code $this AdjustSetting -xcutplanevisible] \
-            -variable [itcl::scope _settings(-xcutplanevisible)]
+            -command [itcl::code $this AdjustSetting xcutplane] \
+            -variable [itcl::scope _settings($this-xcutplane)]
     }
     Rappture::Tooltip::for $itk_component(xCutButton) \
         "Toggle the X cut plane on/off"
-    $itk_component(xCutButton) select
 
     itk_component add xCutScale {
@@ -1796,5 +1836,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this Slice move x] \
-            -variable [itcl::scope _settings(-xcutplaneposition)]
+            -variable [itcl::scope _settings($this-xcutposition)]
     } {
         usual
@@ -1812,10 +1852,9 @@
             -onimage [Rappture::icon y-cutplane] \
             -offimage [Rappture::icon y-cutplane] \
-            -command [itcl::code $this AdjustSetting -ycutplanevisible] \
-            -variable [itcl::scope _settings(-ycutplanevisible)]
+            -command [itcl::code $this AdjustSetting ycutplane] \
+            -variable [itcl::scope _settings($this-ycutplane)]
     }
     Rappture::Tooltip::for $itk_component(yCutButton) \
         "Toggle the Y cut plane on/off"
-    $itk_component(yCutButton) select
 
     itk_component add yCutScale {
@@ -1824,5 +1863,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this Slice move y] \
-            -variable [itcl::scope _settings(-ycutplaneposition)]
+            -variable [itcl::scope _settings($this-ycutposition)]
     } {
         usual
@@ -1840,10 +1879,9 @@
             -onimage [Rappture::icon z-cutplane] \
             -offimage [Rappture::icon z-cutplane] \
-            -command [itcl::code $this AdjustSetting -zcutplanevisible] \
-            -variable [itcl::scope _settings(-zcutplanevisible)]
+            -command [itcl::code $this AdjustSetting zcutplane] \
+            -variable [itcl::scope _settings($this-zcutplane)]
     }
     Rappture::Tooltip::for $itk_component(zCutButton) \
         "Toggle the Z cut plane on/off"
-    $itk_component(zCutButton) select
 
     itk_component add zCutScale {
@@ -1852,5 +1890,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this Slice move z] \
-            -variable [itcl::scope _settings(-zcutplaneposition)]
+            -variable [itcl::scope _settings($this-zcutposition)]
     } {
         usual
@@ -1859,18 +1897,18 @@
     $itk_component(zCutScale) set 50
     $itk_component(zCutScale) configure -state disabled
+    #$itk_component(zCutScale) configure -state disabled
     Rappture::Tooltip::for $itk_component(zCutScale) \
         "@[itcl::code $this SlicerTip z]"
 
     blt::table $inner \
-        0,1 $inner.visible              -anchor w -pady 2 -cspan 4 \
-        1,1 $itk_component(xCutScale) \
-        1,2 $itk_component(yCutScale) \
-        1,3 $itk_component(zCutScale) \
-        2,1 $itk_component(xCutButton) \
-        2,2 $itk_component(yCutButton) \
-        2,3 $itk_component(zCutButton)
-
-    blt::table configure $inner r0 r1 r2 c* -resize none
-    blt::table configure $inner r3 c4 -resize expand
+        1,1 $itk_component(xCutButton) \
+        1,2 $itk_component(yCutButton) \
+        1,3 $itk_component(zCutButton) \
+        0,1 $itk_component(xCutScale) \
+        0,2 $itk_component(yCutScale) \
+        0,3 $itk_component(zCutScale) 
+
+    blt::table configure $inner r0 r1 c* -resize none
+    blt::table configure $inner r2 c4 -resize expand
     blt::table configure $inner c0 -width 2
     blt::table configure $inner c1 c2 c3 -padx 2
@@ -1895,5 +1933,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
 
     set row 1
@@ -1902,9 +1939,9 @@
         label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _settings(-$tag)]
+            -textvariable [itcl::scope _settings($this-$tag)]
         bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
+            [itcl::code $this camera set ${tag}]
         bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -1914,5 +1951,5 @@
     }
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -1955,4 +1992,7 @@
 itcl::body Rappture::NanovisViewer::SlicerTip {axis} {
     set val [$itk_component(${axis}CutScale) get]
+#    set val [expr {0.01*($val-50)
+#        *($_limits(${axis}max)-$_limits(${axis}min))
+#          + 0.5*($_limits(${axis}max)+$_limits(${axis}min))}]
     return "Move the [string toupper $axis] cut plane.\nCurrently:  $axis = $val%"
 }
@@ -1975,5 +2015,5 @@
 }
 
-itcl::body Rappture::NanovisViewer::EventuallyRedrawLegend {} {
+itcl::body Rappture::NanovisViewer::EventuallyResizeLegend {} {
     if { !$_resizeLegendPending } {
         $_dispatcher event -idle !legend
@@ -1990,25 +2030,25 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_settings($what)
+            set who [lindex $args 0]
+            set x $_settings($this-$who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
-                set _settings($what) $_view($what)
+                set _settings($this-$who) $_view($who)
                 return
             }
-            switch -- $what {
-                "-xpan" - "-ypan" {
-                    set _view($what) $_settings($what)
+            switch -- $who {
+                "xpan" - "ypan" {
+                    set _view($who) $_settings($this-$who)
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set _view($what) $_settings($what)
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set _view($who) $_settings($this-$who)
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     SendCmd "camera orient $q"
                 }
-                "-zoom" {
-                    set _view($what) $_settings($what)
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    set _view($who) $_settings($this-$who)
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2050,15 +2090,15 @@
         array set info $vol
         set name $info(name)
-        if { ![info exists _settings(-volumevisible-$name)] } {
-            set _settings(-volumevisible-$name) $info(hide)
+        if { ![info exists _settings($this-volume-$name)] } {
+            set _settings($this-volume-$name) $info(hide)
         }
         checkbutton $inner.vol$row -text $info(label) \
-            -variable [itcl::scope _settings(-volumevisible-$name)] \
+            -variable [itcl::scope _settings($this-volume-$name)] \
             -onvalue 0 -offvalue 1 \
-            -command [itcl::code $this ToggleVolume $key $name] \
+            -command [itcl::code $this volume $key $name] \
             -font "Arial 9"
         Rappture::Tooltip::for $inner.vol$row $info(description)
         blt::table $inner $row,0 $inner.vol$row -anchor w 
-        if { !$_settings(-volume-$name) } {
+        if { !$_settings($this-volume-$name) } {
             $inner.vol$row select
         } 
@@ -2071,7 +2111,7 @@
 }
 
-itcl::body Rappture::NanovisViewer::ToggleVolume { tag name } {
-    set bool $_settings(-volumevisible-$name)
-    SendCmd "volume state $bool $name"
+itcl::body Rappture::NanovisViewer::volume { tag name } {
+    set bool $_settings($this-volume-$name)
+    SendCmd "volume statue $bool $name"
 }
 
@@ -2085,402 +2125,17 @@
         bottom "0.707107 0.707107 0 0"
     }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
+    foreach name { qw qx qy qz } value $positions($side) {
         set _view($name) $value
     } 
-    set q [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q" 
     SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
-    set _settings(-xpan) $_view(-xpan)
-    set _settings(-ypan) $_view(-ypan)
-    set _settings(-zoom) $_view(-zoom)
-}
-
-
-#
-# InitComponentSettings --
-#
-#    Initializes the volume settings for a specific component. This should
-#    match what's used as global settings above. This is called the first
-#    time we try to switch to a given component in SwitchComponent below.
-#
-itcl::body Rappture::NanovisViewer::InitComponentSettings { cname } { 
-    foreach {key value} {
-        -colormap          "default"
-        -light             40
-        -light2side        1
-        -thickness         350
-        -volumeopacity     1.0
-        -volumevisible     1
-    } {
-        if { ![info exists _settings($cname${key})] } {
-            # Don't override existing component settings
-            set _settings($cname${key}) $value
-        }
-    }
-}
-
-#
-# SwitchComponent --
-#
-#    This is called when the current component is changed by the dropdown
-#    menu in the volume tab.  It synchronizes the global volume settings
-#    with the settings of the new current component.
-#
-itcl::body Rappture::NanovisViewer::SwitchComponent { cname } { 
-    if { ![info exists _settings($cname-light)] } {
-        InitComponentSettings $cname
-    }
-    if { $_settings(-colormap) != $_settings($cname-colormap) } {
-        set _settings(-colormap)         $_settings($cname-colormap)
-        EventuallyRedrawLegend
-    }
-    # _settings variables change widgets, except for colormap
-    set _settings(-light)            $_settings($cname-light)
-    set _settings(-light2side)       $_settings($cname-light2side)
-    set _settings(-volumeopacity)    $_settings($cname-volumeopacity)
-    set _settings(-thickness)        $_settings($cname-thickness)
-    set _settings(-volumevisible)    $_settings($cname-volumevisible)
-    $itk_component(colormap) value   $_settings($cname-colormap)
-
-    set _widget(-volumeopacity) [expr $_settings(-volumeopacity) * 100.0]
-
-    set _current $cname;                # Reset the current component
-}
-
-#
-# BuildVolumeComponents --
-#
-#    This is called from the "scale" method which is called when a new
-#    dataset is added or deleted.  It repopulates the dropdown menu of
-#    volume component names.  It sets the current component to the first
-#    component in the list (of components found).  Finally, if there is
-#    only one component, don't display the label or the combobox in the
-#    volume settings tab.
-#
-itcl::body Rappture::NanovisViewer::BuildVolumeComponents {} { 
-    $itk_component(volcomponents) choices delete 0 end
-    foreach name $_componentsList {
-        $itk_component(volcomponents) choices insert end $name $name
-    }
-    set _current [lindex $_componentsList 0]
-    $itk_component(volcomponents) value $_current
-    set parent [winfo parent $itk_component(volcomponents)]
-    if { [llength $_componentsList] <= 1 } {
-        # Unpack the components label and dropdown if there's only one
-        # component. 
-        blt::table forget $parent.volcomponents_l $parent.volcomponents
-    } else {
-        # Pack the components label and dropdown into the table there's 
-        # more than one component to select. 
-        blt::table $parent \
-            0,0 $parent.volcomponents_l -anchor e -cspan 2 \
-            0,2 $parent.volcomponents -cspan 3 -fill x 
-    }
-}
-
-#
-# GetDatasetsWithComponents --
-#
-#    Returns a list of all the datasets (known by the combination of their
-#    data object and component name) that match the given component name.
-#    For example, this is used where we want to change the settings of
-#    volumes that have the current component.
-#
-itcl::body Rappture::NanovisViewer::GetDatasetsWithComponent { cname } { 
-    if { ![info exists _volcomponents($cname)] } {
-        return ""
-    }
-    set list ""
-    foreach tag $_volcomponents($cname) {
-        if { ![info exists _serverDatasets($tag)] } {
-            continue
-        }
-        lappend list $tag
-    }
-    return $list
-}
-
-#
-# HideAllMarkers --
-#
-#    Hide all the markers in all the transfer functions.  Can't simply
-#    delete and recreate markers from the <style> since the user may have
-#    created, deleted, or moved markers.
-#
-itcl::body Rappture::NanovisViewer::HideAllMarkers {} { 
-    foreach cname [array names _transferFunctionEditors] {
-        $_transferFunctionEditors($cname) hideMarkers 
-    }
-}
-
-itcl::body Rappture::NanovisViewer::GetColormap { cname color } { 
-    if { $color == "default" } {
-        return $_cname2defaultcolormap($cname)
-    }
-    return [ColorsToColormap $color]
-}
-
-itcl::body Rappture::NanovisViewer::GetAlphamap { cname name } { 
-    if { $name == "default" } {
-        return $_cname2defaultalphamap($cname)
-    }
-    return [NameToAlphamap $name]
-}
-
-itcl::body Rappture::NanovisViewer::ResetColormap { cname color } { 
-    # Get the current transfer function
-    if { ![info exists _cname2transferFunction($cname)] } {
-        return
-    }
-    foreach { cmap wmap } $_cname2transferFunction($cname) break
-    set cmap [GetColormap $cname $color]
-    set _cname2transferFunction($cname) [list $cmap $wmap]
-    SendCmd [list transfunc define $cname $cmap $wmap]
-    EventuallyRedrawLegend
-}
-
-itcl::body Rappture::NanovisViewer::ComputeAlphamap { cname } { 
-    if { ![info exists _transferFunctionEditors($cname)] } {
-        return [list 0.0 0.0 1.0 1.0]
-    }
-    if { ![info exists _settings($cname-light)] } {
-        InitComponentSettings $cname
-    }
-
-    set isovalues [$_transferFunctionEditors($cname) values]
-
-    # Transfer function should be normalized with [0,1] range
-    # The volume shading opacity setting is used to scale opacity
-    # in the volume shader.
-    set max 1.0
-
-    # Use the component-wise thickness setting from the slider
-    # settings widget
-    # Scale values between 0.00001 and 0.01000
-    set delta [expr {double($_settings($cname-thickness)) * 0.0001}]
-    
-    set first [lindex $isovalues 0]
-    set last [lindex $isovalues end]
-    set wmap ""
-    if { $first == "" || $first != 0.0 } {
-        lappend wmap 0.0 0.0
-    }
-    foreach x $isovalues {
-        set x1 [expr {$x-$delta-0.00001}]
-        set x2 [expr {$x-$delta}]
-        set x3 [expr {$x+$delta}]
-        set x4 [expr {$x+$delta+0.00001}]
-        if { $x1 < 0.0 } {
-            set x1 0.0
-        } elseif { $x1 > 1.0 } {
-            set x1 1.0
-        }
-        if { $x2 < 0.0 } {
-            set x2 0.0
-        } elseif { $x2 > 1.0 } {
-            set x2 1.0
-        }
-        if { $x3 < 0.0 } {
-            set x3 0.0
-        } elseif { $x3 > 1.0 } {
-            set x3 1.0
-        }
-        if { $x4 < 0.0 } {
-            set x4 0.0
-        } elseif { $x4 > 1.0 } {
-            set x4 1.0
-        }
-        # add spikes in the middle
-        lappend wmap $x1 0.0
-        lappend wmap $x2 $max
-        lappend wmap $x3 $max
-        lappend wmap $x4 0.0
-    }
-    if { $last == "" || $last != 1.0 } {
-        lappend wmap 1.0 0.0
-    }
-    return $wmap
-}
-
-itcl::body Rappture::NanovisViewer::NameToAlphamap { name } {
-    switch -- $name {
-        "ramp-up" {
-            set wmap { 
-                0.0 0.0 
-                1.0 1.0 
-            }
-        }
-        "ramp-down" {
-            set wmap { 
-                0.0 1.0 
-                1.0 0.0 
-            }
-        }
-        "vee" {
-            set wmap { 
-                0.0 1.0 
-                0.5 0.0 
-                1.0 1.0 
-            }
-        }
-        "tent-1" {
-            set wmap { 
-                0.0 0.0 
-                0.5 1.0 
-                1.0 0.0 
-            }
-        }
-        "tent-2" {
-            set wmap { 
-                0.0 0.0 
-                0.25 1.0 
-                0.5 0.0 
-                0.75 1.0 
-                1.0 0.0 
-            }
-        }
-        "tent-3" {
-            set wmap { 
-                0.0 0.0 
-                0.16666 1.0
-                0.33333 0.0
-                0.5     1.0
-                0.66666 0.0
-                0.83333 1.0
-                1.0 0.0 
-            }
-        }
-        "tent-4" {
-            set wmap { 
-                0.0     0.0 
-                0.125   1.0
-                0.25    0.0
-                0.375   1.0
-                0.5     0.0        
-                0.625   1.0
-                0.75    0.0
-                0.875   1.0
-                1.0     0.0 
-            }
-        }
-        "sinusoid-1" {
-            set wmap {
-                0.0                     0.000 0.600 0.800 
-                0.14285714285714285     0.400 0.900 1.000 
-                0.2857142857142857      0.600 1.000 1.000 
-                0.42857142857142855     0.800 1.000 1.000 
-                0.5714285714285714      0.900 0.900 0.900 
-                0.7142857142857143      0.600 0.600 0.600 
-                0.8571428571428571      0.400 0.400 0.400 
-                1.0                     0.200 0.200 0.200
-            }
-        }
-        "sinusoid-2" {
-            set wmap { 
-                0.0                     0.900 1.000 1.000 
-                0.1111111111111111      0.800 0.983 1.000 
-                0.2222222222222222      0.700 0.950 1.000 
-                0.3333333333333333      0.600 0.900 1.000 
-                0.4444444444444444      0.500 0.833 1.000 
-                0.5555555555555556      0.400 0.750 1.000 
-                0.6666666666666666      0.300 0.650 1.000 
-                0.7777777777777778      0.200 0.533 1.000 
-                0.8888888888888888      0.100 0.400 1.000 
-                1.0                     0.000 0.250 1.000
-            }
-        }
-        "sinusoid-6" {
-            set wmap {
-                0.0                             0.200   0.100   0.000 
-                0.09090909090909091             0.400   0.187   0.000 
-                0.18181818181818182             0.600   0.379   0.210 
-                0.2727272727272727              0.800   0.608   0.480 
-                0.36363636363636365             0.850   0.688   0.595 
-                0.45454545454545453             0.950   0.855   0.808 
-                0.5454545454545454              0.800   0.993   1.000 
-                0.6363636363636364              0.600   0.973   1.000 
-                0.7272727272727273              0.400   0.940   1.000 
-                0.8181818181818182              0.200   0.893   1.000 
-                0.9090909090909091              0.000   0.667   0.800 
-                1.0                             0.000   0.480   0.600 
-            }
-        }
-        "sinusoid-10" {
-            set wmap {
-                0.0                             0.000   0.480   0.600 
-                0.09090909090909091             0.000   0.667   0.800 
-                0.18181818181818182             0.200   0.893   1.000 
-                0.2727272727272727              0.400   0.940   1.000 
-                0.36363636363636365             0.600   0.973   1.000 
-                0.45454545454545453             0.800   0.993   1.000 
-                0.5454545454545454              0.950   0.855   0.808 
-                0.6363636363636364              0.850   0.688   0.595 
-                0.7272727272727273              0.800   0.608   0.480 
-                0.8181818181818182              0.600   0.379   0.210 
-                0.9090909090909091              0.400   0.187   0.000 
-                1.0                             0.200   0.100   0.000 
-            }
-        }
-        "step-2" {
-            set wmap {
-                0.0                             0.000   0.167   1.000
-                0.09090909090909091             0.100   0.400   1.000
-                0.18181818181818182             0.200   0.600   1.000
-                0.2727272727272727              0.400   0.800   1.000
-                0.36363636363636365             0.600   0.933   1.000
-                0.45454545454545453             0.800   1.000   1.000
-                0.5454545454545454              1.000   1.000   0.800
-                0.6363636363636364              1.000   0.933   0.600
-                0.7272727272727273              1.000   0.800   0.400
-                0.8181818181818182              1.000   0.600   0.200
-                0.9090909090909091              1.000   0.400   0.100
-                1.0                             1.000   0.167   0.000
-            }
-        }
-        "step-5" {
-            set wmap {
-                0.0                             1.000   0.167   0.000
-                0.09090909090909091             1.000   0.400   0.100
-                0.18181818181818182             1.000   0.600   0.200
-                0.2727272727272727              1.000   0.800   0.400
-                0.36363636363636365             1.000   0.933   0.600
-                0.45454545454545453             1.000   1.000   0.800
-                0.5454545454545454              0.800   1.000   1.000
-                0.6363636363636364              0.600   0.933   1.000
-                0.7272727272727273              0.400   0.800   1.000
-                0.8181818181818182              0.200   0.600   1.000
-                0.9090909090909091              0.100   0.400   1.000
-                1.0                             0.000   0.167   1.000
-            }
-        }
-        "step-12" {
-            set wmap {
-                "#EE82EE"
-                "#4B0082" 
-                "blue" 
-                "#008000" 
-                "yellow" 
-                "#FFA500" 
-                "red" 
-            }
-        }
-        default {
-        }
-    }
-    return ""
-}
-
-itcl::body Rappture::NanovisViewer::SetObjectStyle { dataobj cname } {
-    array set styles {
-        -opacity  0.5
-    }
-    array set styles [lindex [$dataobj components -style $cname] 0]
-    set _settings($cname-volumeopacity) $styles(-opacity)
-    set tag $dataobj-$cname
-    SendCmd "volume shading opacity $_settings($cname-volumeopacity) $tag"
-    NameTransferFunction $dataobj $cname
-}
+    set _view(xpan) 0
+    set _view(ypan) 0
+    set _view(zoom) 1.0
+    set _settings($this-xpan) $_view(xpan)
+    set _settings($this-ypan) $_view(ypan)
+    set _settings($this-zoom) $_view(zoom)
+}
+
Index: branches/1.3/gui/scripts/vtkglyphviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 4848)
@@ -1,3 +1,4 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
+
 # ----------------------------------------------------------------------
 #  COMPONENT: vtkglyphviewer - Vtk 3D glyphs object viewer
@@ -7,5 +8,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
+#  Copyright (c) 2004-2005  Purdue Research Foundation
 #
 #  See the file "license.terms" for information on usage and
@@ -57,4 +58,5 @@
     public method get {args}
     public method isconnected {}
+    public method limits { colormap }
     public method parameters {title args} { 
         # do nothing 
@@ -62,6 +64,21 @@
     public method scale {args}
 
+    protected method Connect {}
+    protected method CurrentDatasets {args}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method DoRotate {}
+    protected method AdjustSetting {what {value ""}}
+    protected method InitSettings { args  }
+    protected method Pan {option x y}
+    protected method Pick {x y}
+    protected method Rebuild {}
+    protected method ReceiveDataset { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { colormap title vmin vmax size }
+    protected method Rotate {option x y}
+    protected method Zoom {option}
+
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
     private method BuildAxisTab {}
     private method BuildCameraTab {}
@@ -72,9 +89,4 @@
     private method DrawLegend {}
     private method Combo { option }
-    private method Connect {}
-    private method CurrentDatasets {args}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DoRotate {}
     private method EnterLegend { x y } 
     private method EventuallyResize { w h } 
@@ -84,20 +96,9 @@
     private method GetImage { args } 
     private method GetVtkData { args } 
-    private method InitSettings { args  }
     private method IsValidObject { dataobj } 
     private method LeaveLegend {}
     private method MotionLegend { x y } 
-    private method Pan {option x y}
     private method PanCamera {}
-    private method Pick {x y}
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveDataset { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { colormap title vmin vmax size }
     private method RequestLegend {}
-    private method Rotate {option x y}
     private method SetLegendTip { x y }
     private method SetObjectStyle { dataobj comp } 
@@ -105,8 +106,4 @@
     private method SetCurrentColormap { color }
     private method SetOrientation { side }
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
@@ -122,4 +119,5 @@
     # heightmaps displayed.
     private variable _currentColormap ""
+    private variable _currentOpacity ""
 
     private variable _dataset2style    ;# maps dataobj-component to transfunc
@@ -148,5 +146,5 @@
     private variable _legendPending 0
     private variable _field      ""
-    private variable _colorMode "vmag"; #  Mode of colormap (vmag or scalar)
+    private variable _colorMode "vmag";	#  Mode of colormap (vmag or scalar)
     private variable _fieldNames {} 
     private variable _fields 
@@ -186,15 +184,15 @@
     $_dispatcher register !xcutplane
     $_dispatcher dispatch $this !xcutplane \
-        "[itcl::code $this AdjustSetting -cutplanexposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneXPosition]; list"
 
     # Y-Cutplane event
     $_dispatcher register !ycutplane
     $_dispatcher dispatch $this !ycutplane \
-        "[itcl::code $this AdjustSetting -cutplaneyposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneYPosition]; list"
 
     # Z-Cutplane event
     $_dispatcher register !zcutplane
     $_dispatcher dispatch $this !zcutplane \
-        "[itcl::code $this AdjustSetting -cutplanezposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneZPosition]; list"
 
     #
@@ -207,57 +205,51 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -ortho           0
-        -qw              0.853553
-        -qx              -0.353553
-        -qy              0.353553
-        -qz              0.146447
-        -xpan            0
-        -ypan            0
-        -zoom            1.0
+        qw              0.853553
+        qx              -0.353553
+        qy              0.353553
+        qz              0.146447
+        zoom            1.0 
+        xpan            0
+        ypan            0
+        ortho           0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
 
     array set _settings [subst {
-        -axesvisible		1
-        -axislabels             1
-        -axisminorticks         1
-        -axismode               "static"
-        -background             black
-        -colormap		BCGYR
-        -colormapvisible	1
-        -cutplaneedges          0
-        -cutplanelighting       1
-        -cutplanepreinterp      1
-        -cutplaneopacity	100
-        -cutplanevisible	0
-        -cutplanewireframe	0
-        -cutplanexposition	50
-        -cutplanexvisible	1
-        -cutplaneyposition	50
-        -cutplaneyvisible	1
-        -cutplanezposition	50
-        -cutplanezvisible	1
-        -field			"Default"
-        -glyphedges             0
-        -glyphlighting          1
-        -glyphnormscale         1
-        -glyphopacity           100
-        -glyphorient            1
-        -glyphoutline           0
-        -glyphscale             1
-        -glyphscalemode         "vmag"
-        -glyphshape             "arrow"
-        -glyphvisible           1
-        -glyphwireframe         0
-        -legendvisible		1
-        -saveglyphopacity	100
-        -xgrid                  0
-        -ygrid                  0
-        -zgrid                  0
+	background		black
+	colormap		BCGYR
+	colormapVisible		1
+	field			"Default"
+        axesVisible		1
+        axisLabelsVisible	1
+        axisXGrid		0
+        axisYGrid		0
+        axisZGrid		0
+        cutplaneEdges           0
+        cutplaneLighting        1
+        cutplanePreinterp       1
+        cutplaneOpacity		100
+        cutplaneVisible		0
+        cutplaneWireframe	0
+        cutplaneXPosition	50
+        cutplaneXVisible	1
+        cutplaneYPosition	50
+        cutplaneYVisible	1
+        cutplaneZPosition	50
+        cutplaneZVisible	1
+        glyphEdges              0
+        glyphLighting           1
+        glyphOpacity            100
+        saveGlyphOpacity	100
+        glyphOutline            0
+        glyphVisible            1
+        glyphWireframe          0
+        legendVisible		1
     }]
     array set _changed {
-        -colormap               0
-        -glyphopacity           0
+        glyphOpacity            0
+        colormap                0
     }
 
@@ -339,6 +331,6 @@
             -onimage [Rappture::icon volume-on] \
             -offimage [Rappture::icon volume-off] \
-            -variable [itcl::scope _settings(-glyphvisible)] \
-            -command [itcl::code $this AdjustSetting -glyphvisible] 
+            -variable [itcl::scope _settings(glyphVisible)] \
+            -command [itcl::code $this AdjustSetting glyphVisible] 
     }
     $itk_component(glyphs) select
@@ -352,6 +344,6 @@
             -onimage [Rappture::icon cutbutton] \
             -offimage [Rappture::icon cutbutton] \
-            -variable [itcl::scope _settings(-cutplanevisible)] \
-            -command [itcl::code $this AdjustSetting -cutplanevisible] 
+            -variable [itcl::scope _settings(cutplaneVisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneVisible] 
     }
     Rappture::Tooltip::for $itk_component(cutplane) \
@@ -443,4 +435,5 @@
     eval itk_initialize $args
     Connect
+    update
 }
 
@@ -470,5 +463,6 @@
 
 itcl::body Rappture::VtkGlyphViewer::DoRotate {} {
-    SendCmd "camera orient [ViewToQuaternion]" 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    SendCmd "camera orient $q" 
     set _rotatePending 0
 }
@@ -494,5 +488,5 @@
 
 itcl::body Rappture::VtkGlyphViewer::EventuallyRotate { q } {
-    QuaternionToView $q
+    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -549,10 +543,11 @@
 }
 
+
 # ----------------------------------------------------------------------
 # USAGE: delete ?<dataobj1> <dataobj2> ...?
 #
-#    Clients use this to delete a dataobj from the plot.  If no dataobjs
-#    are specified, then all dataobjs are deleted.  No data objects are
-#    deleted.  They are only removed from the display list.
+#       Clients use this to delete a dataobj from the plot.  If no dataobjs
+#       are specified, then all dataobjs are deleted.  No data objects are
+#       deleted.  They are only removed from the display list.
 #
 # ----------------------------------------------------------------------
@@ -804,5 +799,5 @@
 # isconnected --
 #
-#    Indicates if we are currently connected to the visualization server.
+#       Indicates if we are currently connected to the visualization server.
 #
 itcl::body Rappture::VtkGlyphViewer::isconnected {} {
@@ -821,6 +816,6 @@
 # Disconnect --
 #
-#    Clients use this method to disconnect from the current rendering
-#    server.
+#       Clients use this method to disconnect from the current rendering
+#       server.
 #
 itcl::body Rappture::VtkGlyphViewer::Disconnect {} {
@@ -839,4 +834,5 @@
     array unset _data 
     array unset _colormaps 
+    array unset _seeds 
     array unset _dataset2style 
     array unset _obj2datasets 
@@ -860,7 +856,6 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"]
-            fconfigure $f -encoding binary
-            puts -nonewline $f $bytes
+            set f [open "last.ppm" "w"] 
+            puts $f $bytes
             close $f
         }
@@ -950,6 +945,7 @@
         # Reset the camera and other view parameters
         #
-        $_arcball quaternion [ViewToQuaternion]
-        if {$_view(-ortho)} {
+        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+        $_arcball quaternion $q
+        if {$_view(ortho)} {
             SendCmd "camera mode ortho"
         } else {
@@ -959,7 +955,9 @@
         PanCamera
         set _first ""
-        InitSettings -xgrid -ygrid -zgrid -axismode \
-            -axesvisible -axislabels -axisminorticks
-        #SendCmd "axis lformat all %g"
+        InitSettings axisXGrid axisYGrid axisZGrid axisMode \
+            axesVisible axisLabelsVisible 
+        foreach axis { x y z } {
+	    SendCmd "axis lformat $axis %g"
+	}
         StopBufferingCommands
         SendCmd "imgflush"
@@ -977,9 +975,8 @@
             if { ![info exists _datasets($tag)] } {
                 set bytes [$dataobj vtkdata $comp]
-                if 0 { 
-                    set f [open "/tmp/glyph.vtk" "w"]
-                    fconfigure $f -translation binary -encoding binary
-                    puts -nonewline $f $bytes
-                    close $f
+		if 0 { 
+		    set f [open "/tmp/glyph.vtk" "w"]
+		    puts $f $bytes
+		    close $f
                 }
                 set length [string length $bytes]
@@ -996,5 +993,5 @@
                     SendCmd "clientinfo [list $info]"
                 }
-                SendCmd "dataset add $tag data follows $length"
+                append _outbuf "dataset add $tag data follows $length\n"
                 append _outbuf $bytes
                 set _datasets($tag) 1
@@ -1005,5 +1002,5 @@
                 # Setting dataset visible enables outline 
                 # and glyphs
-                SendCmd "dataset visible 1 $tag"
+		SendCmd "dataset visible 1 $tag"
             }
         }
@@ -1011,7 +1008,7 @@
 
     if { $_first != "" } {
-        $itk_component(field) choices delete 0 end
-        $itk_component(fieldmenu) delete 0 end
-        array unset _fields
+	$itk_component(field) choices delete 0 end
+	$itk_component(fieldmenu) delete 0 end
+	array unset _fields
         set _curFldName ""
         foreach cname [$_first components] {
@@ -1039,31 +1036,32 @@
         $itk_component(field) value $_curFldLabel
     }
-    InitSettings -glyphoutline
-        #-cutplanevisible
+    InitSettings glyphOutline
+        #cutplaneVisible
     if { $_reset } {
-        # These are settings that rely on a dataset being loaded.
+	# These are settings that rely on a dataset being loaded.
         InitSettings \
-            -field \
-            -glyphedges -glyphlighting -glyphopacity \
-            -glyphwireframe
-
-        #-cutplanexposition -cutplaneyposition -cutplanezposition \
-            -cutplanexvisible -cutplaneyvisible -cutplanezvisible \
-            -cutplanepreinterp 
+            glyphLighting \
+            field \
+            glyphEdges glyphLighting glyphOpacity \
+	    glyphWireframe
+
+        #cutplaneXPosition cutplaneYPosition cutplaneZPosition \
+	    cutplaneXVisible cutplaneYVisible cutplaneZVisible \
+            cutplanePreinterp 
 
         Zoom reset
-        foreach axis { x y z } {
+	foreach axis { x y z } {
             # Another problem fixed by a <view>. We looking into a data
             # object for the name of the axes. This should be global to
             # the viewer itself.
-            set label [$_first hints ${axis}label]
-            if { $label == "" } {
+	    set label [$_first hints ${axis}label]
+	    if { $label == "" } {
                 set label [string toupper $axis]
-            }
-            # May be a space in the axis label.
-            SendCmd [list axis name $axis $label]
+	    }
+	    # May be a space in the axis label.
+	    SendCmd [list axis name $axis $label]
         }
         if { [array size _fields] < 2 } {
-            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
+            blt::table forget $itk_component(field) $itk_component(field_l)
         }
         set _reset 0
@@ -1133,20 +1131,20 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                qw     0.853553
+                qx     -0.353553
+                qy     0.353553
+                qz     0.146447
+                zoom   1.0
+                xpan   0
+                ypan   0
             }
             if { $_first != "" } {
@@ -1156,5 +1154,6 @@
                 }
             }
-            $_arcball quaternion [ViewToQuaternion]
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+            $_arcball quaternion $q
             DoRotate
             SendCmd "camera reset"
@@ -1164,8 +1163,9 @@
 
 itcl::body Rappture::VtkGlyphViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
+
 
 # ----------------------------------------------------------------------
@@ -1223,5 +1223,5 @@
 itcl::body Rappture::VtkGlyphViewer::Pick {x y} {
     foreach tag [CurrentDatasets -visible] {
-        SendCmd "dataset getscalar pixel $x $y $tag"
+        SendCmdNoSplash "dataset getscalar pixel $x $y $tag"
     } 
 }
@@ -1242,6 +1242,6 @@
             set x [expr $x / double($w)]
             set y [expr $y / double($h)]
-            set _view(-xpan) [expr $_view(-xpan) + $x]
-            set _view(-ypan) [expr $_view(-ypan) + $y]
+            set _view(xpan) [expr $_view(xpan) + $x]
+            set _view(ypan) [expr $_view(ypan) + $y]
             PanCamera
             return
@@ -1265,6 +1265,6 @@
             set _click(x) $x
             set _click(y) $y
-            set _view(-xpan) [expr $_view(-xpan) - $dx]
-            set _view(-ypan) [expr $_view(-ypan) - $dy]
+            set _view(xpan) [expr $_view(xpan) - $dx]
+            set _view(ypan) [expr $_view(ypan) - $dy]
             PanCamera
         }
@@ -1288,7 +1288,7 @@
 itcl::body Rappture::VtkGlyphViewer::InitSettings { args } {
     foreach spec $args {
-        if { [info exists _settings($_first${spec})] } {
+        if { [info exists _settings($_first-$spec)] } {
             # Reset global setting with dataobj specific setting
-            set _settings($spec) $_settings($_first${spec})
+            set _settings($spec) $_settings($_first-$spec)
         }
         AdjustSetting $spec
@@ -1299,7 +1299,7 @@
 # AdjustSetting --
 #
-#    Changes/updates a specific setting in the widget.  There are
-#    usually user-setable option.  Commands are sent to the render
-#    server.
+#       Changes/updates a specific setting in the widget.  There are
+#       usually user-setable option.  Commands are sent to the render
+#       server.
 #
 itcl::body Rappture::VtkGlyphViewer::AdjustSetting {what {value ""}} {
@@ -1308,34 +1308,30 @@
     }
     switch -- $what {
-        "-background" {
+        "background" {
             set bgcolor [$itk_component(background) value]
-            array set fgcolors {
-                "black" "white"
-                "white" "black"
-                "grey"  "black"
-            }
+	    array set fgcolors {
+		"black" "white"
+		"white" "black"
+		"grey"	"black"
+	    }
             configure -plotbackground $bgcolor \
-                -plotforeground $fgcolors($bgcolor)
-            $itk_component(view) delete "legend"
-            DrawLegend
-        }
-        "-axesvisible" {
-            set bool $_settings($what)
+		-plotforeground $fgcolors($bgcolor)
+	    $itk_component(view) delete "legend"
+	    DrawLegend
+        }
+        "axesVisible" {
+            set bool $_settings(axesVisible)
             SendCmd "axis visible all $bool"
         }
-        "-axislabels" {
-            set bool $_settings($what)
+        "axisLabelsVisible" {
+            set bool $_settings(axisLabelsVisible)
             SendCmd "axis labels all $bool"
         }
-        "-axisminorticks" {
-            set bool $_settings($what)
-            SendCmd "axis minticks all $bool"
-        }
-        "-xgrid" - "-ygrid" - "-zgrid" {
-            set axis [string tolower [string range $what 1 1]]
+        "axisXGrid" - "axisYGrid" - "axisZGrid" {
+            set axis [string tolower [string range $what 4 4]]
             set bool $_settings($what)
             SendCmd "axis grid $axis $bool"
         }
-        "-axismode" {
+        "axisMode" {
             set mode [$itk_component(axisMode) value]
             set mode [$itk_component(axisMode) translate $mode]
@@ -1343,36 +1339,31 @@
             SendCmd "axis flymode $mode"
         }
-        "-cutplaneedges" {
+        "cutplaneEdges" {
             set bool $_settings($what)
             SendCmd "cutplane edges $bool"
         }
-        "-cutplanevisible" {
+        "cutplaneVisible" {
             set bool $_settings($what)
-            SendCmd "cutplane visible 0"
-            if { $bool } {
-                foreach tag [CurrentDatasets -visible] {
-                    SendCmd "cutplane visible $bool $tag"
-                }
-            }
-        }
-        "-cutplanewireframe" {
+            SendCmd "cutplane visible $bool"
+        }
+        "cutplaneWireframe" {
             set bool $_settings($what)
             SendCmd "cutplane wireframe $bool"
         }
-        "-cutplanelighting" {
+        "cutplaneLighting" {
             set bool $_settings($what)
             SendCmd "cutplane lighting $bool"
         }
-        "-cutplaneopacity" {
+        "cutplaneOpacity" {
             set val $_settings($what)
             set sval [expr { 0.01 * double($val) }]
             SendCmd "cutplane opacity $sval"
         }
-        "-cutplanepreinterp" {
+        "cutplanePreinterp" {
             set bool $_settings($what)
             SendCmd "cutplane preinterp $bool"
         }
-        "-cutplanexvisible" - "-cutplaneyvisible" - "-cutplanezvisible" {
-            set axis [string tolower [string range $what 9 9]]
+        "cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" {
+            set axis [string tolower [string range $what 8 8]]
             set bool $_settings($what)
             if { $bool } {
@@ -1383,44 +1374,39 @@
                     -troughcolor grey82
             }
-            SendCmd "cutplane axis $axis $bool"
-        }
-        "-cutplanexposition" - "-cutplaneyposition" - "-cutplanezposition" {
-            set axis [string tolower [string range $what 9 9]]
+	    SendCmd "cutplane axis $axis $bool"
+        }
+        "cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" {
+            set axis [string tolower [string range $what 8 8]]
             set pos [expr $_settings($what) * 0.01]
             SendCmd "cutplane slice ${axis} ${pos}"
             set _cutplanePending 0
         }
-        "-colormap" {
-            set _changed($what) 1
+        "colormap" {
+            set _changed(colormap) 1
             StartBufferingCommands
             set color [$itk_component(colormap) value]
-            set _settings($what) $color
-            if { $color == "none" } {
-                if { $_settings(-colormapvisible) } {
-                    SendCmd "glyphs colormode constant {}"
-                    set _settings(-colormapvisible) 0
-                }
-            } else {
-                if { !$_settings(-colormapvisible) } {
-                    SendCmd "glyphs colormode $_colorMode $_curFldName"
-                    set _settings(-colormapvisible) 1
-                }
-                SetCurrentColormap $color
-            }
+            set _settings(colormap) $color
+	    if { $color == "none" } {
+		if { $_settings(colormapVisible) } {
+		    SendCmd "glyphs colormode constant {}"
+		    set _settings(colormapVisible) 0
+		}
+	    } else {
+		if { !$_settings(colormapVisible) } {
+		    SendCmd "glyphs colormode $_colorMode $_curFldName"
+		    set _settings(colormapVisible) 1
+		}
+		SetCurrentColormap $color
+	    }
             StopBufferingCommands
-            EventuallyRequestLegend
-        }
-        "-glyphwireframe" {
-            set bool $_settings($what)
-            SendCmd "glyphs wireframe $bool"
-        }
-        "-glyphvisible" {
-            set bool $_settings($what)
-            SendCmd "glyphs visible 0"
-            if { $bool } {
-                foreach tag [CurrentDatasets -visible] {
-                    SendCmd "glyphs visible $bool $tag"
-                }
-            }
+	    EventuallyRequestLegend
+        }
+        "glyphWireframe" {
+            set bool $_settings(glyphWireframe)
+	    SendCmd "glyphs wireframe $bool"
+        }
+        "glyphVisible" {
+            set bool $_settings(glyphVisible)
+	    SendCmd "glyphs visible $bool"
             if { $bool } {
                 Rappture::Tooltip::for $itk_component(glyphs) \
@@ -1430,58 +1416,27 @@
                     "Show the glyph"
             }
-            DrawLegend
-        }
-        "-glyphlighting" {
-            set bool $_settings($what)
-            SendCmd "glyphs lighting $bool"
-        }
-        "-glyphedges" {
-            set bool $_settings($what)
-            SendCmd "glyphs edges $bool"
-        }
-        "-glyphoutline" {
-            set bool $_settings($what)
-            SendCmd "outline visible 0"
-            if { $bool } {
-                foreach tag [CurrentDatasets -visible] {
-                    SendCmd "outline visible $bool $tag"
-                }
-            }
-        }
-        "-glyphopacity" {
-            set val $_settings($what)
+	    DrawLegend
+        }
+        "glyphLighting" {
+            set bool $_settings(glyphLighting)
+	    SendCmd "glyphs lighting $bool"
+        }
+        "glyphEdges" {
+            set bool $_settings(glyphEdges)
+	    SendCmd "glyphs edges $bool"
+        }
+        "glyphOutline" {
+            set bool $_settings(glyphOutline)
+	    SendCmd "outline visible $bool"
+        }
+        "glyphOpacity" {
+            set val $_settings(glyphOpacity)
             set sval [expr { 0.01 * double($val) }]
-            SendCmd "glyphs opacity $sval"
-        }
-        "-glyphnormscale" {
-            set bool $_settings($what)
-            SendCmd "glyphs normscale $bool"
-        }
-        "-glyphorient" {
-            set bool $_settings($what)
-            SendCmd "glyphs gorient $bool {}"
-        }
-        "-glyphscale" {
-            set val $_settings($what)
-            if { [string is double $val] } {
-                SendCmd "glyphs gscale $val"
-            }
-        }
-        "-glyphscalemode" {
-            set label [$itk_component(scaleMode) value]
-            set mode [$itk_component(scaleMode) translate $label]
-            set _settings($what) $mode
-            SendCmd "glyphs smode $mode {}"
-        }
-        "-glyphshape" {
-            set label [$itk_component(gshape) value]
-            set shape [$itk_component(gshape) translate $label]
-            set _settings($what) $shape
-            SendCmd "glyphs shape $shape"
-        }
-        "-field" {
+	    SendCmd "glyphs opacity $sval"
+        }
+        "field" {
             set label [$itk_component(field) value]
             set fname [$itk_component(field) translate $label]
-            set _settings($what) $fname
+            set _settings(field) $fname
             if { [info exists _fields($fname)] } {
                 foreach { label units components } $_fields($fname) break
@@ -1497,18 +1452,14 @@
                 return
             }
-            #if { ![info exists _limits($_curFldName)] } {
-            #    SendCmd "dataset maprange all"
-            #} else {
-            #    SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
-            #}
+            #SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
             #SendCmd "cutplane colormode $_colorMode $_curFldName"
             SendCmd "glyphs colormode $_colorMode $_curFldName"
             DrawLegend
         }
-        "-legendvisible" {
-            if { !$_settings($what) } {
+        "legendVisible" {
+            if { !$_settings(legendVisible) } {
                 $itk_component(view) delete legend
-            }
-            DrawLegend
+	    }
+	    DrawLegend
         }
         default {
@@ -1518,37 +1469,42 @@
 }
 
+
 #
 # RequestLegend --
 #
-#    Request a new legend from the server.  The size of the legend
-#    is determined from the height of the canvas.  
+#       Request a new legend from the server.  The size of the legend
+#       is determined from the height of the canvas.  
 #
 # This should be called when
-#    1.  A new current colormap is set.
-#    2.  Window is resized.
-#    3.  The limits of the data have changed.  (Just need a redraw).
-#    4.  Number of glyph have changed. (Just need a redraw).
-#    5.  Legend becomes visible (Just need a redraw).
+#	1.  A new current colormap is set.
+#	2.  Window is resized.
+#	3.  The limits of the data have changed.  (Just need a redraw).
+#	4.  Number of glyph have changed. (Just need a redraw).
+#	5.  Legend becomes visible (Just need a redraw).
 #
 itcl::body Rappture::VtkGlyphViewer::RequestLegend {} {
     set _legendPending 0
+    if { ![info exists _fields($_curFldName)] } {
+        return
+    }
+    set fname $_curFldName
     set font "Arial 8"
+    set lineht [font metrics $font -linespace]
     set w 12
-    set lineht [font metrics $font -linespace]
-    # color ramp height = (canvas height) - (min and max value lines) - 2 
     set h [expr {$_height - 2 * ($lineht + 2)}]
-
-    set fname $_curFldName
+    if { $h < 1 } {
+        return
+    }
     if { [string match "component*" $fname] } {
-        set title ""
+	set title ""
     } else {
-        if { [info exists _fields($fname)] } {
-            foreach { title units } $_fields($fname) break
-            if { $units != "" } {
-                set title [format "%s (%s)" $title $units]
-            }
-        } else {
-            set title $fname
-        }
+	if { [info exists _fields($fname)] } {
+	    foreach { title units } $_fields($fname) break
+	    if { $units != "" } {
+		set title [format "%s (%s)" $title $units]
+	    }
+	} else {
+	    set title $fname
+	}
     }
     # If there's a title too, substract one more line
@@ -1556,11 +1512,8 @@
         incr h -$lineht 
     }
-    if { $h < 1 } {
-        return
-    }
     # Set the legend on the first heightmap dataset.
     if { $_currentColormap != ""  } {
-        set cmap $_currentColormap
-        SendCmdNoWait "legend $cmap $_colorMode $_curFldName {} $w $h 0"
+	set cmap $_currentColormap
+	SendCmdNoWait "legend $cmap $_colorMode $_curFldName {} $w $h 0"
     }
 }
@@ -1582,8 +1535,16 @@
     if { [isconnected] } {
         set rgb [Color2RGB $itk_option(-plotforeground)]
-        SendCmd "axis color all $rgb"
+	SendCmd "axis color all $rgb"
         SendCmd "outline color $rgb"
         #SendCmd "cutplane color $rgb"
     }
+}
+
+itcl::body Rappture::VtkGlyphViewer::limits { dataobj } {
+    foreach { limits(xmin) limits(xmax) } [$dataobj limits x] break
+    foreach { limits(ymin) limits(ymax) } [$dataobj limits y] break
+    foreach { limits(zmin) limits(zmax) } [$dataobj limits z] break
+    foreach { limits(vmin) limits(vmax) } [$dataobj limits v] break
+    return [array get limits]
 }
 
@@ -1600,83 +1561,36 @@
     checkbutton $inner.glyphs \
         -text "Glyphs" \
-        -variable [itcl::scope _settings(-glyphvisible)] \
-        -command [itcl::code $this AdjustSetting -glyphvisible] \
+        -variable [itcl::scope _settings(glyphVisible)] \
+        -command [itcl::code $this AdjustSetting glyphVisible] \
         -font "Arial 9"
-
-    label $inner.gshape_l -text "Glyph shape" -font "Arial 9" 
-    itk_component add gshape {
-        Rappture::Combobox $inner.gshape -width 10 -editable no
-    }
-    $inner.gshape choices insert end \
-        "arrow"              "arrow"           \
-        "cone"               "cone"            \
-        "cube"               "cube"            \
-        "cylinder"           "cylinder"        \
-        "dodecahedron"       "dodecahedron"    \
-        "icosahedron"        "icosahedron"     \
-        "line"               "line"            \
-        "octahedron"         "octahedron"      \
-        "point"              "point"           \
-        "sphere"             "sphere"          \
-        "tetrahedron"        "tetrahedron"
-
-    $itk_component(gshape) value $_settings(-glyphshape)
-    bind $inner.gshape <<Value>> [itcl::code $this AdjustSetting -glyphshape]
-
-    label $inner.scaleMode_l -text "Scale by" -font "Arial 9" 
-    itk_component add scaleMode {
-        Rappture::Combobox $inner.scaleMode -width 10 -editable no
-    }
-    $inner.scaleMode choices insert end \
-        "scalar" "Scalar"            \
-        "vmag"   "Vector magnitude"  \
-        "vcomp"  "Vector components" \
-        "off"    "Constant size"
-
-    $itk_component(scaleMode) value "[$itk_component(scaleMode) label $_settings(-glyphscalemode)]"
-    bind $inner.scaleMode <<Value>> [itcl::code $this AdjustSetting -glyphscalemode]
-
-    checkbutton $inner.normscale \
-        -text "Normalize scaling" \
-        -variable [itcl::scope _settings(-glyphnormscale)] \
-        -command [itcl::code $this AdjustSetting -glyphnormscale] \
-        -font "Arial 9"
-    Rappture::Tooltip::for $inner.normscale "If enabled, field values are normalized to \[0,1\] before scaling and scale factor is relative to a default size"
-
-    checkbutton $inner.gorient \
-        -text "Orient" \
-        -variable [itcl::scope _settings(-glyphorient)] \
-        -command [itcl::code $this AdjustSetting -glyphorient] \
-        -font "Arial 9"
-    Rappture::Tooltip::for $inner.gorient "Orient glyphs by vector field directions"
 
     checkbutton $inner.wireframe \
         -text "Wireframe" \
-        -variable [itcl::scope _settings(-glyphwireframe)] \
-        -command [itcl::code $this AdjustSetting -glyphwireframe] \
+        -variable [itcl::scope _settings(glyphWireframe)] \
+        -command [itcl::code $this AdjustSetting glyphWireframe] \
         -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-glyphlighting)] \
-        -command [itcl::code $this AdjustSetting -glyphlighting] \
+        -variable [itcl::scope _settings(glyphLighting)] \
+        -command [itcl::code $this AdjustSetting glyphLighting] \
         -font "Arial 9"
 
     checkbutton $inner.edges \
         -text "Edges" \
-        -variable [itcl::scope _settings(-glyphedges)] \
-        -command [itcl::code $this AdjustSetting -glyphedges] \
+        -variable [itcl::scope _settings(glyphEdges)] \
+        -command [itcl::code $this AdjustSetting glyphEdges] \
         -font "Arial 9"
 
     checkbutton $inner.outline \
         -text "Outline" \
-        -variable [itcl::scope _settings(-glyphoutline)] \
-        -command [itcl::code $this AdjustSetting -glyphoutline] \
+        -variable [itcl::scope _settings(glyphOutline)] \
+        -command [itcl::code $this AdjustSetting glyphOutline] \
         -font "Arial 9"
 
     checkbutton $inner.legend \
         -text "Legend" \
-        -variable [itcl::scope _settings(-legendvisible)] \
-        -command [itcl::code $this AdjustSetting -legendvisible] \
+        -variable [itcl::scope _settings(legendVisible)] \
+        -command [itcl::code $this AdjustSetting legendVisible] \
         -font "Arial 9"
 
@@ -1690,34 +1604,20 @@
         "grey"               "grey"             
 
-    $itk_component(background) value $_settings(-background)
-    bind $inner.background <<Value>> [itcl::code $this AdjustSetting -background]
+    $itk_component(background) value $_settings(background)
+    bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-glyphopacity)] \
+        -variable [itcl::scope _settings(glyphOpacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -glyphopacity]
-
-    label $inner.gscale_l -text "Scale factor" -font "Arial 9"
-    if {0} {
-    ::scale $inner.gscale -from 1 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-glyphscale)] \
+        -command [itcl::code $this AdjustSetting glyphOpacity]
+
+    label $inner.scale_l -text "Scale" -font "Arial 9"
+    ::scale $inner.scale -from 1 -to 100 -orient horizontal \
+        -variable [itcl::scope _settings(glyphs-scale)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -glyphscale]
-    } else {
-    itk_component add gscale {
-        entry $inner.gscale -font "Arial 9" -bg white \
-            -textvariable [itcl::scope _settings(-glyphscale)]
-    } {
-        ignore -font -background
-    }
-    bind $inner.gscale <Return> \
-        [itcl::code $this AdjustSetting -glyphscale]
-    bind $inner.gscale <KP_Enter> \
-        [itcl::code $this AdjustSetting -glyphscale]
-    }
-    Rappture::Tooltip::for $inner.gscale "Set scaling multiplier (or constant size)"
+        -command [itcl::code $this AdjustSetting glyphs-scale]
 
     itk_component add field_l {
@@ -1730,5 +1630,5 @@
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting -field]
+        [itcl::code $this AdjustSetting field]
 
     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
@@ -1736,24 +1636,40 @@
         Rappture::Combobox $inner.colormap -width 10 -editable no
     }
-
-    $inner.colormap choices insert end [GetColormapList]
+    $inner.colormap choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   
+
     $itk_component(colormap) value "BCGYR"
     bind $inner.colormap <<Value>> \
-        [itcl::code $this AdjustSetting -colormap]
+        [itcl::code $this AdjustSetting colormap]
 
     blt::table $inner \
-        0,0 $inner.field_l      -anchor w -pady 2  \
-        0,1 $inner.field        -anchor w -pady 2  -fill x \
-        1,0 $inner.colormap_l   -anchor w -pady 2  \
-        1,1 $inner.colormap     -anchor w -pady 2  -fill x \
-        3,0 $inner.background_l -anchor w -pady 2 \
-        3,1 $inner.background   -anchor w -pady 2  -fill x \
-        5,0 $inner.wireframe    -anchor w -pady 2 -cspan 2 \
-        6,0 $inner.lighting     -anchor w -pady 2 -cspan 2 \
-        7,0 $inner.edges        -anchor w -pady 2 -cspan 2 \
-        8,0 $inner.outline      -anchor w -pady 2 -cspan 2 \
-        9,0 $inner.legend       -anchor w -pady 2 \
-        10,0 $inner.opacity_l   -anchor w -pady 2 \
-        10,1 $inner.opacity     -fill x   -pady 2 -fill x \
+        0,0 $inner.field_l   -anchor w -pady 2  \
+        0,1 $inner.field     -anchor w -pady 2  -fill x \
+        1,0 $inner.colormap_l -anchor w -pady 2  \
+        1,1 $inner.colormap   -anchor w -pady 2  -fill x \
+	3,0 $inner.background_l -anchor w -pady 2 \
+	3,1 $inner.background -anchor w -pady 2  -fill x \
+        5,0 $inner.wireframe -anchor w -pady 2 -cspan 2 \
+        6,0 $inner.lighting  -anchor w -pady 2 -cspan 2 \
+        7,0 $inner.edges     -anchor w -pady 2 -cspan 2 \
+        8,0 $inner.outline   -anchor w -pady 2 -cspan 2 \
+        9,0 $inner.legend    -anchor w -pady 2 \
+        10,0 $inner.opacity_l -anchor w -pady 2 \
+        10,1 $inner.opacity   -fill x   -pady 2 -fill x \
 
     blt::table configure $inner r* c* -resize none
@@ -1772,34 +1688,29 @@
 
     checkbutton $inner.visible \
-        -text "Axes" \
-        -variable [itcl::scope _settings(-axesvisible)] \
-        -command [itcl::code $this AdjustSetting -axesvisible] \
+        -text "Show Axes" \
+        -variable [itcl::scope _settings(axesVisible)] \
+        -command [itcl::code $this AdjustSetting axesVisible] \
         -font "Arial 9"
 
     checkbutton $inner.labels \
-        -text "Axis Labels" \
-        -variable [itcl::scope _settings(-axislabels)] \
-        -command [itcl::code $this AdjustSetting -axislabels] \
+        -text "Show Axis Labels" \
+        -variable [itcl::scope _settings(axisLabelsVisible)] \
+        -command [itcl::code $this AdjustSetting axisLabelsVisible] \
         -font "Arial 9"
-    label $inner.grid_l -text "Grid" -font "Arial 9" 
-    checkbutton $inner.xgrid \
-        -text "X" \
-        -variable [itcl::scope _settings(-xgrid)] \
-        -command [itcl::code $this AdjustSetting -xgrid] \
+
+    checkbutton $inner.gridx \
+        -text "Show X Grid" \
+        -variable [itcl::scope _settings(axisXGrid)] \
+        -command [itcl::code $this AdjustSetting axisXGrid] \
         -font "Arial 9"
-    checkbutton $inner.ygrid \
-        -text "Y" \
-        -variable [itcl::scope _settings(-ygrid)] \
-        -command [itcl::code $this AdjustSetting -ygrid] \
+    checkbutton $inner.gridy \
+        -text "Show Y Grid" \
+        -variable [itcl::scope _settings(axisYGrid)] \
+        -command [itcl::code $this AdjustSetting axisYGrid] \
         -font "Arial 9"
-    checkbutton $inner.zgrid \
-        -text "Z" \
-        -variable [itcl::scope _settings(-zgrid)] \
-        -command [itcl::code $this AdjustSetting -zgrid] \
-        -font "Arial 9"
-    checkbutton $inner.minorticks \
-        -text "Minor Ticks" \
-        -variable [itcl::scope _settings(-axisminorticks)] \
-        -command [itcl::code $this AdjustSetting -axisminorticks] \
+    checkbutton $inner.gridz \
+        -text "Show Z Grid" \
+        -variable [itcl::scope _settings(axisZGrid)] \
+        -command [itcl::code $this AdjustSetting axisZGrid] \
         -font "Arial 9"
 
@@ -1814,22 +1725,20 @@
         "furthest_triad"  "farthest" \
         "outer_edges"     "outer"         
-    $itk_component(axisMode) value $_settings(-axismode)
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
+    $itk_component(axisMode) value "static"
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisMode]
 
     blt::table $inner \
-        0,0 $inner.visible    -anchor w -cspan 4 \
-        1,0 $inner.labels     -anchor w -cspan 4 \
-        2,0 $inner.minorticks -anchor w -cspan 4 \
-        4,0 $inner.grid_l     -anchor w \
-        4,1 $inner.xgrid      -anchor w \
-        4,2 $inner.ygrid      -anchor w \
-        4,3 $inner.zgrid      -anchor w \
-        5,0 $inner.mode_l     -anchor w -padx { 2 0 } \
-        5,1 $inner.mode       -fill x   -cspan 3
+        0,0 $inner.visible -anchor w -cspan 2 \
+        1,0 $inner.labels  -anchor w -cspan 2 \
+        2,0 $inner.gridx   -anchor w -cspan 2 \
+        3,0 $inner.gridy   -anchor w -cspan 2 \
+        4,0 $inner.gridz   -anchor w -cspan 2 \
+        5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
+        6,0 $inner.mode    -fill x   -cspan 2 
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r7 c6 -resize expand
-    blt::table configure $inner r3 -height 0.125i
-}
+    blt::table configure $inner r7 c1 -resize expand
+}
+
 
 itcl::body Rappture::VtkGlyphViewer::BuildCameraTab {} {
@@ -1851,5 +1760,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
 
     set labels { qx qy qz qw xpan ypan zoom }
@@ -1858,9 +1766,7 @@
         label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _view(-$tag)]
-        bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
-        bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            -textvariable [itcl::scope _view($tag)]
+        bind $inner.${tag} <KeyPress-Return> \
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -1871,6 +1777,6 @@
     checkbutton $inner.ortho \
         -text "Orthographic Projection" \
-        -variable [itcl::scope _view(-ortho)] \
-        -command [itcl::code $this camera set -ortho] \
+        -variable [itcl::scope _view(ortho)] \
+        -command [itcl::code $this camera set ortho] \
         -font "Arial 9"
     blt::table $inner \
@@ -1879,5 +1785,5 @@
     incr row
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -1896,39 +1802,39 @@
     checkbutton $inner.visible \
         -text "Cutplanes" \
-        -variable [itcl::scope _settings(-cutplanevisible)] \
-        -command [itcl::code $this AdjustSetting -cutplanevisible] \
+        -variable [itcl::scope _settings(cutplaneVisible)] \
+        -command [itcl::code $this AdjustSetting cutplaneVisible] \
         -font "Arial 9"
 
     checkbutton $inner.wireframe \
         -text "Wireframe" \
-        -variable [itcl::scope _settings(-cutplanewireframe)] \
-        -command [itcl::code $this AdjustSetting -cutplanewireframe] \
+        -variable [itcl::scope _settings(cutplaneWireframe)] \
+        -command [itcl::code $this AdjustSetting cutplaneWireframe] \
         -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-cutplanelighting)] \
-        -command [itcl::code $this AdjustSetting -cutplanelighting] \
+        -variable [itcl::scope _settings(cutplaneLighting)] \
+        -command [itcl::code $this AdjustSetting cutplaneLighting] \
         -font "Arial 9"
 
     checkbutton $inner.edges \
         -text "Edges" \
-        -variable [itcl::scope _settings(-cutplaneedges)] \
-        -command [itcl::code $this AdjustSetting -cutplaneedges] \
+        -variable [itcl::scope _settings(cutplaneEdges)] \
+        -command [itcl::code $this AdjustSetting cutplaneEdges] \
         -font "Arial 9"
 
     checkbutton $inner.preinterp \
         -text "Interpolate Scalars" \
-        -variable [itcl::scope _settings(-cutplanepreinterp)] \
-        -command [itcl::code $this AdjustSetting -cutplanepreinterp] \
+        -variable [itcl::scope _settings(cutplanePreinterp)] \
+        -command [itcl::code $this AdjustSetting cutplanePreinterp] \
         -font "Arial 9"
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-cutplaneopacity)] \
+        -variable [itcl::scope _settings(cutplaneOpacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -cutplaneopacity]
-    $inner.opacity set $_settings(-cutplaneopacity)
+        -command [itcl::code $this AdjustSetting cutplaneOpacity]
+    $inner.opacity set $_settings(cutplaneOpacity)
 
     # X-value slicer...
@@ -1937,6 +1843,6 @@
             -onimage [Rappture::icon x-cutplane-red] \
             -offimage [Rappture::icon x-cutplane-red] \
-            -command [itcl::code $this AdjustSetting -cutplanexvisible] \
-            -variable [itcl::scope _settings(-cutplanexvisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneXVisible] \
+            -variable [itcl::scope _settings(cutplaneXVisible)] \
     }
     Rappture::Tooltip::for $itk_component(xbutton) \
@@ -1948,6 +1854,6 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane x] \
-            -variable [itcl::scope _settings(-cutplanexposition)] \
-            -foreground red2 -font "Arial 9 bold"
+            -variable [itcl::scope _settings(cutplaneXPosition)] \
+	    -foreground red2 -font "Arial 9 bold"
     } {
         usual
@@ -1965,6 +1871,6 @@
             -onimage [Rappture::icon y-cutplane-green] \
             -offimage [Rappture::icon y-cutplane-green] \
-            -command [itcl::code $this AdjustSetting -cutplaneyvisible] \
-            -variable [itcl::scope _settings(-cutplaneyvisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneYVisible] \
+            -variable [itcl::scope _settings(cutplaneYVisible)] \
     }
     Rappture::Tooltip::for $itk_component(ybutton) \
@@ -1977,6 +1883,6 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane y] \
-            -variable [itcl::scope _settings(-cutplaneyposition)] \
-            -foreground green3 -font "Arial 9 bold"
+            -variable [itcl::scope _settings(cutplaneYPosition)] \
+	    -foreground green3 -font "Arial 9 bold"
     } {
         usual
@@ -1994,9 +1900,9 @@
             -onimage [Rappture::icon z-cutplane-blue] \
             -offimage [Rappture::icon z-cutplane-blue] \
-            -command [itcl::code $this AdjustSetting -cutplanezvisible] \
-            -variable [itcl::scope _settings(-cutplanezvisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneZVisible] \
+            -variable [itcl::scope _settings(cutplaneZVisible)] \
     } {
-        usual
-        ignore -foreground
+	usual
+	ignore -foreground
     }
     Rappture::Tooltip::for $itk_component(zbutton) \
@@ -2009,6 +1915,6 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane z] \
-            -variable [itcl::scope _settings(-cutplanezposition)] \
-            -foreground blue3 -font "Arial 9 bold"
+            -variable [itcl::scope _settings(cutplaneZPosition)] \
+	    -foreground blue3 -font "Arial 9 bold"
     } {
         usual
@@ -2021,21 +1927,24 @@
 
     blt::table $inner \
-        0,0 $inner.visible   -anchor w -pady 2 -cspan 3 \
-        1,0 $inner.lighting  -anchor w -pady 2 -cspan 3 \
-        2,0 $inner.wireframe -anchor w -pady 2 -cspan 3 \
-        3,0 $inner.edges     -anchor w -pady 2 -cspan 3 \
-        4,0 $inner.preinterp -anchor w -pady 2 -cspan 3 \
-        5,0 $inner.opacity_l -anchor w -pady 2 -cspan 1 \
-        5,1 $inner.opacity   -fill x   -pady 2 -cspan 3 \
-        6,0 $inner.xbutton   -anchor w -padx 2 -pady 2 \
-        7,0 $inner.ybutton   -anchor w -padx 2 -pady 2 \
-        8,0 $inner.zbutton   -anchor w -padx 2 -pady 2 \
-        6,1 $inner.xval      -fill y -rspan 4 \
-        6,2 $inner.yval      -fill y -rspan 4 \
-        6,3 $inner.zval      -fill y -rspan 4 \
+        0,0 $inner.visible              -anchor w -pady 2 -cspan 3 \
+        1,0 $inner.lighting             -anchor w -pady 2 -cspan 3 \
+        2,0 $inner.wireframe            -anchor w -pady 2 -cspan 3 \
+        3,0 $inner.edges                -anchor w -pady 2 -cspan 3 \
+        4,0 $inner.preinterp            -anchor w -pady 2 -cspan 3 \
+        5,0 $inner.opacity_l            -anchor w -pady 2 -cspan 1 \
+        5,1 $inner.opacity              -fill x   -pady 2 -cspan 3 \
+        6,0 $inner.xbutton		-anchor w -padx 2 -pady 2 \
+        7,0 $inner.ybutton		-anchor w -padx 2 -pady 2 \
+        8,0 $inner.zbutton		-anchor w -padx 2 -pady 2 \
+        6,1 $inner.xval			-fill y -rspan 4 \
+        6,2 $inner.yval			-fill y -rspan 4 \
+        6,3 $inner.zval			-fill y -rspan 4 \
+
 
     blt::table configure $inner r* c* -resize none
     blt::table configure $inner r9 c4 -resize expand
 }
+
+
 
 #
@@ -2048,13 +1957,13 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_view($what)
+            set who [lindex $args 0]
+            set x $_view($who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
                 return
             }
-            switch -- $what {
-                "-ortho" {
-                    if {$_view($what)} {
+            switch -- $who {
+                "ortho" {
+                    if {$_view(ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -2062,14 +1971,14 @@
                     }
                 }
-                "-xpan" - "-ypan" {
+                "xpan" - "ypan" {
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "-zoom" {
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    SendCmd "camera zoom $_view(zoom)"
                 }
              }
@@ -2189,35 +2098,28 @@
     # the code to handle aberrant cases.
 
-    if { $_changed(-glyphopacity) } {
-        set style(-opacity) [expr $_settings(-glyphopacity) * 0.01]
-    }
-    if { $_changed(-colormap) } {
-        set style(-color) $_settings(-colormap)
+    if { $_changed(glyphOpacity) } {
+        set style(-opacity) $_settings(glyphOpacity)
+    }
+    if { $_changed(colormap) } {
+        set style(-color) $_settings(colormap)
     }
     if { $_currentColormap == "" } {
         $itk_component(colormap) value $style(-color)
     }
-
+    set _currentOpacity $style(-opacity)
+    SendCmd "glyphs add $style(-shape) $tag"
+    SendCmd "glyphs edges $style(-edges) $tag"
+    # normscale=1 and gscale=1 are defaults
+    if {$style(-normscale) != 1} {
+        SendCmd "glyphs normscale $style(-normscale) $tag"
+    }
+    if {$style(-gscale) != 1} {
+        SendCmd "glyphs gscale $style(-gscale) $tag"
+    }
     SendCmd "outline add $tag"
     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
     SendCmd "outline visible $style(-outline) $tag"
-    set _settings(-glyphoutline) $style(-outline)
-
-    SendCmd "glyphs add $style(-shape) $tag"
-    set _settings(-glyphshape) $style(-shape)
-    $itk_component(gshape) value $style(-shape)
-    SendCmd "glyphs edges $style(-edges) $tag"
-    set _settings(-glyphedges) $style(-edges)
-
-    # normscale=1 and gscale=1 are defaults
-    if {$style(-normscale) != 1} {
-        SendCmd "glyphs normscale $style(-normscale) $tag"
-    }
-    if {$style(-gscale) != 1} {
-        SendCmd "glyphs gscale $style(-gscale) $tag"
-    }
-    set _settings(-glyphnormscale) $style(-normscale)
-    set _settings(-glyphscale) $style(-gscale)
-
+    set _settings(glyphOutline) $style(-outline)
+    set _settings(glyphEdges) $style(-edges)
     # constant color only used if colormode set to constant
     SendCmd "glyphs color [Color2RGB $itk_option(-plotforeground)] $tag"
@@ -2225,19 +2127,17 @@
     # defaults to active scalars or vectors depending on mode
     SendCmd "glyphs gorient $style(-orientGlyphs) {} $tag"
-    set _settings(-glyphorient) $style(-orientGlyphs)
     SendCmd "glyphs smode $style(-scaleMode) {} $tag"
-    set _settings(-glyphscalemode) $style(-scaleMode)
-    $itk_component(scaleMode) value "[$itk_component(scaleMode) label $style(-scaleMode)]"
     SendCmd "glyphs quality $style(-quality) $tag"
     SendCmd "glyphs lighting $style(-lighting) $tag"
-    set _settings(-glyphlighting) $style(-lighting)
+    set _settings(glyphLighting) $style(-lighting)
     SendCmd "glyphs linecolor [Color2RGB $style(-edgecolor)] $tag"
     SendCmd "glyphs linewidth $style(-linewidth) $tag"
     SendCmd "glyphs ptsize $style(-ptsize) $tag"
-    SendCmd "glyphs opacity $style(-opacity) $tag"
-    set _settings(-glyphopacity) [expr $style(-opacity) * 100.0]
+    SendCmd "glyphs opacity $_currentOpacity $tag"
+    set _settings(glyphOpacity) $style(-opacity)
     SetCurrentColormap $style(-color) 
     SendCmd "glyphs wireframe $style(-wireframe) $tag"
-    set _settings(-glyphwireframe) $style(-wireframe)
+    set _settings(glyphWireframe) $style(-wireframe)
+    set _settings(glyphOpacity) [expr $style(-opacity) * 100.0]
 }
 
@@ -2293,14 +2193,14 @@
 
     if { [string match "component*" $fname] } {
-        set title ""
+	set title ""
     } else {
-        if { [info exists _fields($fname)] } {
-            foreach { title units } $_fields($fname) break
-            if { $units != "" } {
-                set title [format "%s (%s)" $title $units]
-            }
-        } else {
-            set title $fname
-        }
+	if { [info exists _fields($fname)] } {
+	    foreach { title units } $_fields($fname) break
+	    if { $units != "" } {
+		set title [format "%s (%s)" $title $units]
+	    }
+	} else {
+	    set title $fname
+	}
     }
     # If there's a legend title, increase the offset by the line height.
@@ -2334,4 +2234,5 @@
 }
 
+
 # ----------------------------------------------------------------------
 # USAGE: Slice move x|y|z <newval>
@@ -2367,7 +2268,7 @@
 # ReceiveLegend -- 
 #
-#    Invoked automatically whenever the "legend" command comes in from
-#    the rendering server.  Indicates that binary image data with the
-#    specified <size> will follow.
+#	Invoked automatically whenever the "legend" command comes in from
+#	the rendering server.  Indicates that binary image data with the
+#	specified <size> will follow.
 #
 itcl::body Rappture::VtkGlyphViewer::ReceiveLegend { colormap title min max size } {
@@ -2383,6 +2284,6 @@
         #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>"
         if { [catch {DrawLegend} errs] != 0 } {
-            global errorInfo
-            puts stderr "errs=$errs errorInfo=$errorInfo"
+	    global errorInfo
+	    puts stderr "errs=$errs errorInfo=$errorInfo"
         }
     }
@@ -2392,5 +2293,5 @@
 # DrawLegend --
 #
-#    Draws the legend in the own canvas on the right side of the plot area.
+#       Draws the legend in the own canvas on the right side of the plot area.
 #
 itcl::body Rappture::VtkGlyphViewer::DrawLegend {} {
@@ -2403,47 +2304,45 @@
     
     if { [string match "component*" $fname] } {
-        set title ""
+	set title ""
     } else {
-        if { [info exists _fields($fname)] } {
-            foreach { title units } $_fields($fname) break
-            if { $units != "" } {
-                set title [format "%s (%s)" $title $units]
-            }
-        } else {
-            set title $fname
-        }
+	if { [info exists _fields($fname)] } {
+	    foreach { title units } $_fields($fname) break
+	    if { $units != "" } {
+		set title [format "%s (%s)" $title $units]
+	    }
+	} else {
+	    set title $fname
+	}
     }
     set x [expr $w - 2]
-    if { !$_settings(-legendvisible) } {
-        $c delete legend
-        return
+    if { !$_settings(legendVisible) } {
+	$c delete legend
+	return
     } 
     if { [$c find withtag "legend"] == "" } {
-        set y 2 
-        # If there's a legend title, create a text item for the title.
+	set y 2 
+	# If there's a legend title, create a text item for the title.
         $c create text $x $y \
-            -anchor ne \
-            -fill $itk_option(-plotforeground) -tags "title legend" \
-            -font $font 
-        if { $title != "" } {
-            incr y $lineht
-        }
-        $c create text $x $y \
-            -anchor ne \
-            -fill $itk_option(-plotforeground) -tags "vmax legend" \
-            -font $font
-        incr y $lineht
-        $c create image $x $y \
-            -anchor ne \
-            -image $_image(legend) -tags "colormap legend"
-        $c create rectangle $x $y 1 1 \
-            -fill "" -outline "" -tags "sensor legend"
-        $c create text $x [expr {$h-2}] \
-            -anchor se \
-            -fill $itk_option(-plotforeground) -tags "vmin legend" \
-            -font $font
-        $c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
-        $c bind sensor <Leave> [itcl::code $this LeaveLegend]
-        $c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
+		-anchor ne \
+		-fill $itk_option(-plotforeground) -tags "title legend" \
+		-font $font 
+	    incr y $lineht
+	$c create text $x $y \
+	    -anchor ne \
+	    -fill $itk_option(-plotforeground) -tags "vmax legend" \
+	    -font $font
+	incr y $lineht
+	$c create image $x $y \
+	    -anchor ne \
+	    -image $_image(legend) -tags "colormap legend"
+	$c create rectangle $x $y 1 1 \
+	    -fill "" -outline "" -tags "sensor legend"
+	$c create text $x [expr {$h-2}] \
+	    -anchor se \
+	    -fill $itk_option(-plotforeground) -tags "vmin legend" \
+	    -font $font
+	$c bind sensor <Enter> [itcl::code $this EnterLegend %x %y]
+	$c bind sensor <Leave> [itcl::code $this LeaveLegend]
+	$c bind sensor <Motion> [itcl::code $this MotionLegend %x %y]
     }
     set x2 $x
@@ -2459,6 +2358,6 @@
     if { [info exists _limits($_curFldName)] } {
         foreach { vmin vmax } $_limits($_curFldName) break
-        $c itemconfigure vmin -text [format %g $vmin]
-        $c itemconfigure vmax -text [format %g $vmax]
+	$c itemconfigure vmin -text [format %g $vmin]
+	$c itemconfigure vmax -text [format %g $vmax]
     }
     set y 2
@@ -2466,6 +2365,6 @@
     if { $title != "" } {
         $c itemconfigure title -text $title
-        $c coords title $x $y
-        incr y $lineht
+	$c coords title $x $y
+	incr y $lineht
         $c raise title
     }
@@ -2509,5 +2408,5 @@
         invoke {
             $itk_component(field) value $_curFldLabel
-            AdjustSetting -field
+            AdjustSetting field
         }
         default {
@@ -2533,5 +2432,5 @@
 # BuildColormap --
 #
-#    Build the designated colormap on the server.
+#       Build the designated colormap on the server.
 #
 itcl::body Rappture::VtkGlyphViewer::BuildColormap { name } {
@@ -2553,13 +2452,14 @@
         bottom "0.707107 0.707107 0 0"
     }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
+    foreach name { qw qx qy qz } value $positions($side) {
         set _view($name) $value
-    }
-    set q [ViewToQuaternion]
+    } 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q"
     SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
-}
+    set _view(xpan) 0
+    set _view(ypan) 0
+    set _view(zoom) 1.0
+}
+
Index: branches/1.3/gui/scripts/vtkheightmapviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkheightmapviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/vtkheightmapviewer.tcl	(revision 4848)
@@ -7,5 +7,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
+#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
 #
 #  See the file "license.terms" for information on usage and
@@ -58,4 +58,5 @@
     public method get {args}
     public method isconnected {}
+    public method limits3 { dataobj }
     public method parameters {title args} { 
         # do nothing 
@@ -63,6 +64,23 @@
     public method scale {args}
 
+    protected method CameraReset {}
+    protected method Connect {}
+    protected method CurrentDatasets {args}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method DoRotate {}
+    protected method AdjustSetting {what {value ""}}
+    protected method AdjustMode {}
+    protected method InitSettings { args  }
+    protected method Pan {option x y}
+    protected method Pick {x y}
+    protected method Rebuild {}
+    protected method ReceiveDataset { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { colormap title min max size }
+    protected method Rotate {option x y}
+    protected method Zoom {option}
+
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
     private method BuildAxisTab {}
     private method BuildCameraTab {}
@@ -70,45 +88,24 @@
     private method BuildContourTab {}
     private method BuildDownloadPopup { widget command } 
-    private method CameraReset {}
     private method Combo { option }
-    private method Connect {}
-    private method CurrentDatasets {args}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DoRotate {}
     private method DrawLegend {}
     private method EnterLegend { x y } 
     private method EventuallyRequestLegend {} 
     private method EventuallyResize { w h } 
-    private method EventuallyRotate { q }
-    private method GetHeightmapScale {} 
+    private method EventuallyRotate { q } 
     private method GetImage { args } 
     private method GetVtkData { args } 
-    private method InitSettings { args  }
     private method IsValidObject { dataobj } 
     private method LeaveLegend {}
     private method MotionLegend { x y } 
-    private method Pan {option x y}
     private method PanCamera {}
-    private method Pick {x y}
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveDataset { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { colormap title min max size }
     private method RequestLegend {}
-    private method ResetAxes {}
-    private method Rotate {option x y}
     private method SetCurrentColormap { color }
     private method SetLegendTip { x y }
     private method SetObjectStyle { dataobj comp } 
+    private method GetHeightmapScale {} 
+    private method ResetAxes {}
     private method SetOrientation { side }
     private method UpdateContourList {}
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
@@ -126,4 +123,5 @@
     private variable _currentColormap ""
     private variable _currentNumIsolines -1
+    private variable _currentOpacity ""
 
     private variable _maxScale 100;     # This is the # of times the x-axis
@@ -205,48 +203,48 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -ortho           0
-        -qw              0.36
-        -qx              0.25
-        -qy              0.50
-        -qz              0.70
-        -xpan            0
-        -ypan            0
-        -zoom            1.0
+        qw	0.36
+        qx	0.25
+        qy	0.50
+        qz	0.70
+        zoom	1.0 
+        xpan	0
+        ypan	0
+        ortho	0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
 
     array set _settings {
-        -axisflymode            "static"
-        -axislabels             1
-        -axisminorticks         1
-        -axisvisible            1
-        -colormap               BCGYR
-        -colormapdiscrete       0
-        -colormapvisible        1
-        -edges                  0
-        -field                  "Default"
-        -heightmapscale         50
-        -isheightmap            0
-        -isolinecolor           black
-        -isolinesvisible        1
-        -legendvisible          1
-        -lighting               1
-        -numisolines            10
-        -opacity                100
-        -outline                0
-        -savelighting           1
-        -saveopacity            100
-        -saveoutline            0
-        -stretchtofit           0
-        -wireframe              0
-        -xgrid                  0
-        -ygrid                  0
-        -zgrid                  0
+        axisFlymode		"static"
+        axisMinorTicks		1
+        stretchToFit		0
+        axisLabels              1
+        axisVisible		1
+        axisXGrid		0
+        axisYGrid		0
+        axisZGrid		0
+        colormapVisible         1
+        colormapDiscrete        0
+        edges			0
+        field			"Default"
+        heightmapScale		50
+        isHeightmap		0
+        isolineColor            black
+        isolinesVisible         1
+        legendVisible           1
+        lighting		1
+        saveLighting		1
+        numIsolines		10
+        opacity                 100
+        outline			0
+        wireframe		0
+        saveOpacity		100
+        saveOutline		0
     }
     array set _changed {
-        -colormap               0
-        -numisolines            0
-        -opacity                0
+        opacity                 0
+        colormap                0
+        numIsolines             0
     }
     itk_component add view {
@@ -327,6 +325,6 @@
             -onimage [Rappture::icon surface] \
             -offimage [Rappture::icon surface] \
-            -variable [itcl::scope _settings(-isheightmap)] \
-            -command [itcl::code $this AdjustSetting -isheightmap] \
+            -variable [itcl::scope _settings(isHeightmap)] \
+            -command [itcl::code $this AdjustSetting isHeightmap] \
     }
     Rappture::Tooltip::for $itk_component(mode) \
@@ -338,6 +336,6 @@
             -onimage [Rappture::icon stretchtofit] \
             -offimage [Rappture::icon stretchtofit] \
-            -variable [itcl::scope _settings(-stretchtofit)] \
-            -command [itcl::code $this AdjustSetting -stretchtofit] \
+            -variable [itcl::scope _settings(stretchToFit)] \
+            -command [itcl::code $this AdjustSetting stretchToFit] \
     }
     Rappture::Tooltip::for $itk_component(stretchtofit) \
@@ -444,5 +442,6 @@
 
 itcl::body Rappture::VtkHeightmapViewer::DoRotate {} {
-    SendCmd "camera orient [ViewToQuaternion]" 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    SendCmd "camera orient $q" 
     set _rotatePending 0
 }
@@ -468,5 +467,5 @@
 
 itcl::body Rappture::VtkHeightmapViewer::EventuallyRotate { q } {
-    QuaternionToView $q
+    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -667,5 +666,5 @@
     }
     if { [array size found] > 1 } {
-        set _settings(-stretchtofit) 1
+        set _settings(stretchToFit) 1
     } else {
         # Check if the range of the x and y axes requires that we stretch
@@ -676,5 +675,5 @@
         if { (($xmax - $xmin) > (($ymax -$ymin) * $_maxScale)) ||
              ((($xmax - $xmin) * $_maxScale) < ($ymax -$ymin)) } {
-            set _settings(-stretchtofit) 1
+            set _settings(stretchToFit) 1
         }
     }
@@ -843,7 +842,6 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"]
-            fconfigure $f -encoding binary
-            puts -nonewline $f $bytes
+            set f [open "last.ppm" "w"] 
+            puts $f $bytes
             close $f
         }
@@ -930,6 +928,6 @@
 	$_arcball resize $w $h
 	DoResize
-	if { $_settings(-stretchtofit) } {
-	    AdjustSetting -stretchtofit
+	if { $_settings(stretchToFit) } {
+	    AdjustSetting stretchToFit
 	}
     }
@@ -938,21 +936,15 @@
 	# Reset the camera and other view parameters
 	#
-        InitSettings -isheightmap -background
-
-        # Setting a custom exponent and label format for axes is causing
-        # a problem with rounding.  Near zero ticks aren't rounded by 
-        # the %g format.  The VTK CubeAxes seem to currently work best
-        # when allowed to automatically set the exponent and precision 
-        # based on the axis ranges.  This does tend to result in less 
-        # visual clutter, so I think it is best to use the automatic 
-        # settings by default.  We can test more fine-grained
-        # controls on the axis settings tab if necessary.
-        # -Leif
-        #SendCmd "axis exp 0 0 0 1"
+        InitSettings isHeightmap background
+
+        # Let's see how this goes.  I think it's preferable to overloading the
+        # axis title with the exponent.
+        SendCmd "axis exp 0 0 0 1"
 
 	SendCmd "axis lrot z 90"
-	$_arcball quaternion [ViewToQuaternion]
-        if {$_settings(-isheightmap) } {
-            if { $_view(-ortho)} {
+	set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+	$_arcball quaternion $q 
+        if {$_settings(isHeightmap) } {
+            if { $_view(ortho)} {
                 SendCmd "camera mode ortho"
             } else {
@@ -983,6 +975,5 @@
 		if 0 { 
                     set f [open /tmp/vtkheightmap.vtk "w"]
-                    fconfigure $f -translation binary -encoding binary
-                    puts -nonewline $f $bytes
+                    puts $f $bytes
                     close $f
 		}
@@ -998,5 +989,5 @@
                     lappend info "dataset_size"  $length
                     lappend info "dataset_tag"   $tag
-                    SendCmd "clientinfo [list $info]"
+                    SendCmd [list "clientinfo" $info]
                 }
                 SendCmd "dataset add $tag data follows $length"
@@ -1047,9 +1038,11 @@
         $itk_component(field) value $_curFldLabel
     }
-    InitSettings -stretchtofit -outline
+    InitSettings stretchToFit outline
 
     if { $_reset } {
 	SendCmd "axis tickpos outside"
-        #SendCmd "axis lformat all %g"
+	foreach axis { x y z } {
+	    SendCmd "axis lformat $axis %g"
+	}
         
 	foreach axis { x y z } {
@@ -1074,7 +1067,5 @@
 
 	    if {$axis == "z" && [$_first hints ${axis}units] == ""} {
-                if {$_curFldName != ""} {
-                    set units [lindex $_fields($_curFldName) 1]
-                }
+		set units [lindex $_fields($_curFldName) 1]
 	    } else {
 		set units [$_first hints ${axis}units]
@@ -1089,7 +1080,8 @@
 	#
 	ResetAxes
-	$_arcball quaternion [ViewToQuaternion]
-        if {$_settings(-isheightmap) } {
-            if { $_view(-ortho)} {
+	set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+	$_arcball quaternion $q 
+        if {$_settings(isHeightmap) } {
+            if { $_view(ortho)} {
                 SendCmd "camera mode ortho"
             } else {
@@ -1100,9 +1092,9 @@
         }
 	PanCamera
-	InitSettings -xgrid -ygrid -zgrid \
-	    -axisvisible -axislabels -heightmapscale -field -isheightmap \
-            -numisolines
+	InitSettings axisXGrid axisYGrid axisZGrid \
+	    axisVisible axisLabels heightmapScale field isHeightmap \
+            numIsolines
         if { [array size _fields] < 2 } {
-            catch {blt::table forget $itk_component(field) $itk_component(field_l)}
+            blt::table forget $itk_component(field) $itk_component(field_l)
         }
         RequestLegend
@@ -1166,11 +1158,11 @@
 itcl::body Rappture::VtkHeightmapViewer::CameraReset {} {
     array set _view {
-        -qw      0.36
-        -qx      0.25
-        -qy      0.50
-        -qz      0.70
-        -xpan    0
-        -ypan    0
-        -zoom    1.0
+        qw      0.36
+        qx      0.25
+        qy      0.50
+        qz      0.70
+        zoom    1.0
+        xpan    0
+        ypan    0 
     }
     if { $_first != "" } {
@@ -1180,6 +1172,7 @@
         }
     }
-    $_arcball quaternion [ViewToQuaternion]
-    if {$_settings(-isheightmap) } {
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
+    if {$_settings(isHeightmap) } {
         DoRotate
     }
@@ -1198,16 +1191,16 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                zoom    1.0
+                xpan    0
+                ypan    0 
             }
             SendCmd "camera reset"
@@ -1217,6 +1210,6 @@
 
 itcl::body Rappture::VtkHeightmapViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
@@ -1296,6 +1289,6 @@
             set x [expr $x / double($w)]
             set y [expr $y / double($h)]
-            set _view(-xpan) [expr $_view(-xpan) + $x]
-            set _view(-ypan) [expr $_view(-ypan) + $y]
+            set _view(xpan) [expr $_view(xpan) + $x]
+            set _view(ypan) [expr $_view(ypan) + $y]
             PanCamera
             return
@@ -1319,6 +1312,6 @@
             set _click(x) $x
             set _click(y) $y
-            set _view(-xpan) [expr $_view(-xpan) - $dx]
-            set _view(-ypan) [expr $_view(-ypan) - $dy]
+            set _view(xpan) [expr $_view(xpan) - $dx]
+            set _view(ypan) [expr $_view(ypan) - $dy]
             PanCamera
         }
@@ -1342,7 +1335,7 @@
 itcl::body Rappture::VtkHeightmapViewer::InitSettings { args } {
     foreach spec $args {
-        if { [info exists _settings($_first${spec})] } {
+        if { [info exists _settings($_first-$spec)] } {
             # Reset global setting with dataobj specific setting
-            set _settings($spec) $_settings($_first${spec})
+            set _settings($spec) $_settings($_first-$spec)
         }
         AdjustSetting $spec
@@ -1362,5 +1355,5 @@
     }
     switch -- $what {
-        "-axisflymode" {
+        "axisFlymode" {
             set mode [$itk_component(axisflymode) value]
             set mode [$itk_component(axisflymode) translate $mode]
@@ -1368,17 +1361,24 @@
             SendCmd "axis flymode $mode"
         }
-        "-axislabels" {
+        "axisLabels" {
+            set bool $_settings(axisLabels)
+            SendCmd "axis labels all $bool"
+        }
+        "axisMinorTicks" {
+            set bool $_settings(axisMinorTicks)
+	    foreach axis { x y z } { 
+		SendCmd "axis minticks ${axis} $bool"
+	    }
+        }
+        "axisVisible" {
+            set bool $_settings(axisVisible)
+            SendCmd "axis visible all $bool"
+        }
+        "axisXGrid" - "axisYGrid" - "axisZGrid" {
+            set axis [string tolower [string range $what 4 4]]
             set bool $_settings($what)
-            SendCmd "axis labels all $bool"
-        }
-        "-axisminorticks" {
-            set bool $_settings($what)
-            SendCmd "axis minticks all $bool"
-        }
-        "-axisvisible" {
-            set bool $_settings($what)
-            SendCmd "axis visible all $bool"
-        }
-        "-background" {
+            SendCmd "axis grid $axis $bool"
+        }
+        "background" {
             set bg [$itk_component(background) value]
 	    array set fgcolors {
@@ -1395,22 +1395,22 @@
 	    DrawLegend
         }
-        "-colormap" {
-            set _changed($what) 1
+        "colormap" {
+            set _changed(colormap) 1
             StartBufferingCommands
             set color [$itk_component(colormap) value]
-            set _settings($what) $color
+            set _settings(colormap) $color
 	    if { $color == "none" } {
-		if { $_settings(-colormapvisible) } {
+		if { $_settings(colormapVisible) } {
 		    SendCmd "heightmap surface 0"
-		    set _settings(-colormapvisible) 0
+		    set _settings(colormapVisible) 0
 		}
 	    } else {
-		if { !$_settings(-colormapvisible) } {
+		if { !$_settings(colormapVisible) } {
 		    SendCmd "heightmap surface 1"
-		    set _settings(-colormapvisible) 1
+		    set _settings(colormapVisible) 1
 		}
 		SetCurrentColormap $color
-                if {$_settings(-colormapdiscrete)} {
-                    set numColors [expr $_settings(-numisolines) + 1]
+                if {$_settings(colormapDiscrete)} {
+                    set numColors [expr $_settings(numIsolines) + 1]
                     SendCmd "colormap res $numColors $color"
                 }
@@ -1419,11 +1419,11 @@
 	    EventuallyRequestLegend
         }
-        "-colormapvisible" {
+        "colormapVisible" {
             set bool $_settings($what)
             SendCmd "heightmap surface $bool"
         }
-        "-colormapdiscrete" {
+        "colormapDiscrete" {
             set bool $_settings($what)
-            set numColors [expr $_settings(-numisolines) + 1]
+            set numColors [expr $_settings(numIsolines) + 1]
             StartBufferingCommands
             if {$bool} {
@@ -1439,12 +1439,12 @@
             EventuallyRequestLegend
         }
-        "-edges" {
-            set bool $_settings($what)
+        "edges" {
+            set bool $_settings(edges)
             SendCmd "heightmap edges $bool"
         }
-        "-field" {
+        "field" {
             set label [$itk_component(field) value]
             set fname [$itk_component(field) translate $label]
-            set _settings($what) $fname
+            set _settings(field) $fname
             if { [info exists _fields($fname)] } {
                 foreach { label units components } $_fields($fname) break
@@ -1488,6 +1488,6 @@
             DrawLegend
         }
-        "-heightmapscale" {
-	    if { $_settings(-isheightmap) } {
+        "heightmapScale" {
+	    if { $_settings(isHeightmap) } {
 		set scale [GetHeightmapScale]
                 # Have to set the datasets individually because we are 
@@ -1500,21 +1500,23 @@
 	    }
         }
-        "-isheightmap" {
-	    set bool $_settings($what)
+        "isHeightmap" {
+	    set bool $_settings(isHeightmap)
             set c $itk_component(view)
             StartBufferingCommands
             # Fix heightmap scale: 0 for contours, 1 for heightmaps.
             if { $bool } {
-                set _settings(-heightmapscale) 50
-                set _settings(-opacity) $_settings(-saveopacity)
-                set _settings(-lighting) $_settings(-savelighting)
-                set _settings(-outline) 0
+                set _settings(heightmapScale) 50
+                set _settings(opacity) $_settings(saveOpacity)
+                set _settings(lighting) $_settings(saveLighting)
+                set _settings(outline) 0
             } else {
-                set _settings(-heightmapscale) 0
-                set _settings(-lighting) 0
-                set _settings(-opacity) 100
-                set _settings(-outline)  $_settings(-saveoutline)
-            }
-            InitSettings -lighting -opacity -outline
+                set _settings(heightmapScale) 0
+                set _settings(lighting) 0
+                set _settings(opacity) 100
+                set _settings(outline)  $_settings(saveOutline)
+            }
+            AdjustSetting lighting
+            AdjustSetting opacity
+            AdjustSetting outline
             set scale [GetHeightmapScale]
             # Have to set the datasets individually because we are 
@@ -1531,5 +1533,5 @@
 		$itk_component(scale_l) configure -state normal
 		$itk_component(outline) configure -state disabled
-                if {$_view(-ortho)} {
+                if {$_view(ortho)} {
                     SendCmd "camera mode ortho"
                 } else {
@@ -1545,5 +1547,5 @@
                 SendCmd "camera mode image"
             }
-            if {$_settings(-stretchtofit)} {
+            if {$_settings(stretchToFit)} {
                 if {$scale == 0} {
                     SendCmd "camera aspect window"
@@ -1554,5 +1556,5 @@
             ResetAxes
             if { $bool } {
-                set q [ViewToQuaternion]
+                set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                 $_arcball quaternion $q
                 SendCmd "camera orient $q" 
@@ -1576,15 +1578,15 @@
             StopBufferingCommands
         }
-        "-isolinecolor" {
+        "isolineColor" {
             set color [$itk_component(isolinecolor) value]
 	    if { $color == "none" } {
-		if { $_settings(-isolinesvisible) } {
+		if { $_settings(isolinesVisible) } {
 		    SendCmd "heightmap isolines 0"
-		    set _settings(-isolinesvisible) 0
+		    set _settings(isolinesVisible) 0
 		}
 	    } else {
-		if { !$_settings(-isolinesvisible) } {
+		if { !$_settings(isolinesVisible) } {
 		    SendCmd "heightmap isolines 1"
-		    set _settings(-isolinesvisible) 1
+		    set _settings(isolinesVisible) 1
 		}
 		SendCmd "heightmap isolinecolor [Color2RGB $color]"
@@ -1592,10 +1594,10 @@
 	    DrawLegend
         }
-        "-isolinesvisible" {
+        "isolinesVisible" {
 	    set bool $_settings($what)
             SendCmd "heightmap isolines $bool"
 	    DrawLegend
         }
-        "-legendvisible" {
+        "legendVisible" {
             if { !$_settings($what) } {
 		$itk_component(view) delete legend
@@ -1603,7 +1605,7 @@
 	    DrawLegend
         }
-        "-lighting" {
-	    if { $_settings(-isheightmap) } {
-                set _settings(-savelighting) $_settings($what)
+        "lighting" {
+	    if { $_settings(isHeightmap) } {
+                set _settings(saveLighting) $_settings(lighting)
 		set bool $_settings($what)
 		SendCmd "heightmap lighting $bool"
@@ -1612,12 +1614,12 @@
 	    }
         }
-        "-numisolines" {
-            set _settings($what) [$itk_component(numisolines) value]
-            set _currentNumIsolines $_settings($what)
+        "numIsolines" {
+            set _settings(numIsolines) [$itk_component(numisolines) value]
+            set _currentNumIsolines $_settings(numIsolines)
             UpdateContourList
-            set _changed($what) 1
+            set _changed(numIsolines) 1
             SendCmd "heightmap contourlist [list $_contourList]"
-            if {$_settings(-colormapdiscrete)} {
-                set numColors [expr $_settings($what) + 1]
+            if {$_settings(colormapDiscrete)} {
+                set numColors [expr $_settings(numIsolines) + 1]
                 SendCmd "colormap res $numColors"
                 EventuallyRequestLegend
@@ -1626,24 +1628,25 @@
             }
         }
-        "-opacity" {
-            set _changed($what) 1
-            set val [expr $_settings($what) * 0.01]
-	    if { $_settings(-isheightmap) } {
-                set _settings(-saveopacity) $_settings($what)
-                SendCmd "heightmap opacity $val"
+        "opacity" {
+            set _changed(opacity) 1
+	    if { $_settings(isHeightmap) } {
+                set _settings(saveOpacity) $_settings(opacity)
+                set val $_settings(opacity)
+                set sval [expr { 0.01 * double($val) }]
+                SendCmd "heightmap opacity $sval"
             } else {
-		SendCmd "heightmap opacity 1.0"
-            }
-        }
-        "-outline" {
-	    if { $_settings(-isheightmap) } {
+		SendCmd "heightmap opacity 1"
+            }
+        }
+        "outline" {
+	    if { $_settings(isHeightmap) } {
 		SendCmd "outline visible 0"
             } else {
-                set _settings(-saveoutline) $_settings($what)
-                set bool $_settings($what)
+                set _settings(saveOutline) $_settings(outline)
+                set bool $_settings(outline)
                 SendCmd "outline visible $bool"
             }
 	}
-        "-stretchtofit" {
+        "stretchToFit" {
 	    set bool $_settings($what)
 	    if { $bool } {
@@ -1659,12 +1662,7 @@
             Zoom reset
 	}
-        "-wireframe" {
+        "wireframe" {
             set bool $_settings($what)
             SendCmd "heightmap wireframe $bool"
-        }
-        "-xgrid" - "-ygrid" - "-zgrid" {
-            set axis [string tolower [string range $what 1 1]]
-            set bool $_settings($what)
-            SendCmd "axis grid $axis $bool"
         }
 	default {
@@ -1719,6 +1717,5 @@
     if { $_currentColormap != ""  } {
 	set cmap $_currentColormap
-	#SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
-        SendCmd "legend2 $cmap $w $h"
+	SendCmd "legend $cmap scalar $_curFldName {} $w $h 0"
     }
 }
@@ -1780,4 +1777,5 @@
 }
 
+
 #
 # BuildColormap --
@@ -1800,8 +1798,8 @@
     switch -- $itk_option(-mode) {
 	"heightmap" {
-	    set _settings(-isheightmap) 1
+	    set _settings(isHeightmap) 1
 	}
 	"contour" {
-	    set _settings(-isheightmap) 0
+	    set _settings(isHeightmap) 0
 	} 
 	default {
@@ -1810,5 +1808,5 @@
     }
     if { !$_reset } {
-        AdjustSetting -isheightmap
+        AdjustSetting isHeightmap
     }
 }
@@ -1834,8 +1832,18 @@
         set rgb [Color2RGB $itk_option(-plotforeground)]
         if { !$_reset } {
+            SendCmd "outline color $rgb"
             SendCmd "axis color all $rgb"
-            SendCmd "outline color $rgb"
-        }
-    }
+        }
+    }
+}
+
+itcl::body Rappture::VtkHeightmapViewer::limits3 { dataobj } {
+    lappend limits x [$dataobj limits x]
+    lappend limits y [$dataobj limits y] 
+    if { [catch { $dataobj limits $_curFldName } vlim] != 0 } {
+        set vlim [$dataobj limits v] 
+    }
+    lappend limits v $vlim
+    return $limits
 }
 
@@ -1852,12 +1860,12 @@
     checkbutton $inner.legend \
         -text "Legend" \
-        -variable [itcl::scope _settings(-legendvisible)] \
-        -command [itcl::code $this AdjustSetting -legendvisible] \
+        -variable [itcl::scope _settings(legendVisible)] \
+        -command [itcl::code $this AdjustSetting legendVisible] \
         -font "Arial 9"
 
     checkbutton $inner.wireframe \
         -text "Wireframe" \
-        -variable [itcl::scope _settings(-wireframe)] \
-        -command [itcl::code $this AdjustSetting -wireframe] \
+        -variable [itcl::scope _settings(wireframe)] \
+        -command [itcl::code $this AdjustSetting wireframe] \
         -font "Arial 9"
 
@@ -1865,6 +1873,6 @@
 	checkbutton $inner.lighting \
 	    -text "Enable Lighting" \
-	    -variable [itcl::scope _settings(-lighting)] \
-	    -command [itcl::code $this AdjustSetting -lighting] \
+	    -variable [itcl::scope _settings(lighting)] \
+	    -command [itcl::code $this AdjustSetting lighting] \
 	    -font "Arial 9"
     } {
@@ -1873,6 +1881,6 @@
     checkbutton $inner.edges \
         -text "Edges" \
-        -variable [itcl::scope _settings(-edges)] \
-        -command [itcl::code $this AdjustSetting -edges] \
+        -variable [itcl::scope _settings(edges)] \
+        -command [itcl::code $this AdjustSetting edges] \
         -font "Arial 9"
 
@@ -1880,6 +1888,6 @@
         checkbutton $inner.outline \
             -text "Outline" \
-            -variable [itcl::scope _settings(-outline)] \
-            -command [itcl::code $this AdjustSetting -outline] \
+            -variable [itcl::scope _settings(outline)] \
+            -command [itcl::code $this AdjustSetting outline] \
             -font "Arial 9"
     } {
@@ -1888,18 +1896,18 @@
     checkbutton $inner.stretch \
         -text "Stretch to fit" \
-        -variable [itcl::scope _settings(-stretchtofit)] \
-        -command [itcl::code $this AdjustSetting -stretchtofit] \
+        -variable [itcl::scope _settings(stretchToFit)] \
+        -command [itcl::code $this AdjustSetting stretchToFit] \
         -font "Arial 9"
 
     checkbutton $inner.isolines \
         -text "Isolines" \
-        -variable [itcl::scope _settings(-isolinesvisible)] \
-        -command [itcl::code $this AdjustSetting -isolinesvisible] \
+        -variable [itcl::scope _settings(isolinesVisible)] \
+        -command [itcl::code $this AdjustSetting isolinesVisible] \
         -font "Arial 9"
 
     checkbutton $inner.colormapDiscrete \
         -text "Discrete Colormap" \
-        -variable [itcl::scope _settings(-colormapdiscrete)] \
-        -command [itcl::code $this AdjustSetting -colormapdiscrete] \
+        -variable [itcl::scope _settings(colormapDiscrete)] \
+        -command [itcl::code $this AdjustSetting colormapDiscrete] \
         -font "Arial 9"
 
@@ -1913,5 +1921,5 @@
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting -field]
+        [itcl::code $this AdjustSetting field]
 
     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
@@ -1919,8 +1927,26 @@
         Rappture::Combobox $inner.colormap -width 10 -editable no
     }
-    $inner.colormap choices insert end [GetColormapList -includeNone]
-    $itk_component(colormap) value $_settings(-colormap)
+    $inner.colormap choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   \
+	"none"		     "none"
+
+    $itk_component(colormap) value "BCGYR"
     bind $inner.colormap <<Value>> \
-        [itcl::code $this AdjustSetting -colormap]
+        [itcl::code $this AdjustSetting colormap]
 
     label $inner.isolinecolor_l -text "Isolines Color" -font "Arial 9" 
@@ -1940,7 +1966,7 @@
 	"none"		     "none"
 
-    $itk_component(isolinecolor) value $_settings(-isolinecolor)
+    $itk_component(isolinecolor) value "black"
     bind $inner.isolinecolor <<Value>> \
-	[itcl::code $this AdjustSetting -isolinecolor]
+	[itcl::code $this AdjustSetting isolineColor]
 
     label $inner.background_l -text "Background Color" -font "Arial 9" 
@@ -1954,6 +1980,5 @@
 
     $itk_component(background) value "white"
-    bind $inner.background <<Value>> \
-        [itcl::code $this AdjustSetting -background]
+    bind $inner.background <<Value>> [itcl::code $this AdjustSetting background]
 
     itk_component add opacity_l {
@@ -1964,7 +1989,7 @@
     itk_component add opacity {
         ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-            -variable [itcl::scope _settings(-opacity)] \
+            -variable [itcl::scope _settings(opacity)] \
             -showvalue off \
-            -command [itcl::code $this AdjustSetting -opacity]
+            -command [itcl::code $this AdjustSetting opacity]
     }
     itk_component add scale_l {
@@ -1975,7 +2000,7 @@
     itk_component add scale {
         ::scale $inner.scale -from 0 -to 100 -orient horizontal \
-            -variable [itcl::scope _settings(-heightmapscale)] \
+            -variable [itcl::scope _settings(heightmapScale)] \
             -showvalue off \
-            -command [itcl::code $this AdjustSetting -heightmapscale]
+            -command [itcl::code $this AdjustSetting heightmapScale]
     }
     label $inner.numisolines_l -text "Number of Isolines" -font "Arial 9"
@@ -1984,7 +2009,7 @@
             -min 0 -max 50 -font "arial 9"
     }
-    $itk_component(numisolines) value $_settings(-numisolines)
+    $itk_component(numisolines) value $_settings(numIsolines)
     bind $itk_component(numisolines) <<Value>> \
-        [itcl::code $this AdjustSetting -numisolines]
+        [itcl::code $this AdjustSetting numIsolines]
 
     frame $inner.separator1 -height 2 -relief sunken -bd 1
@@ -2033,33 +2058,34 @@
     checkbutton $inner.visible \
         -text "Axes" \
-        -variable [itcl::scope _settings(-axisvisible)] \
-        -command [itcl::code $this AdjustSetting -axisvisible] \
+        -variable [itcl::scope _settings(axisVisible)] \
+        -command [itcl::code $this AdjustSetting axisVisible] \
         -font "Arial 9"
     checkbutton $inner.labels \
         -text "Axis Labels" \
-        -variable [itcl::scope _settings(-axislabels)] \
-        -command [itcl::code $this AdjustSetting -axislabels] \
+        -variable [itcl::scope _settings(axisLabels)] \
+        -command [itcl::code $this AdjustSetting axisLabels] \
         -font "Arial 9"
     label $inner.grid_l -text "Grid" -font "Arial 9" 
     checkbutton $inner.xgrid \
         -text "X" \
-        -variable [itcl::scope _settings(-xgrid)] \
-        -command [itcl::code $this AdjustSetting -xgrid] \
+        -variable [itcl::scope _settings(axisXGrid)] \
+        -command [itcl::code $this AdjustSetting axisXGrid] \
         -font "Arial 9"
     checkbutton $inner.ygrid \
         -text "Y" \
-        -variable [itcl::scope _settings(-ygrid)] \
-        -command [itcl::code $this AdjustSetting -ygrid] \
+        -variable [itcl::scope _settings(axisYGrid)] \
+        -command [itcl::code $this AdjustSetting axisYGrid] \
         -font "Arial 9"
     checkbutton $inner.zgrid \
         -text "Z" \
-        -variable [itcl::scope _settings(-zgrid)] \
-        -command [itcl::code $this AdjustSetting -zgrid] \
+        -variable [itcl::scope _settings(axisZGrid)] \
+        -command [itcl::code $this AdjustSetting axisZGrid] \
         -font "Arial 9"
     checkbutton $inner.minorticks \
         -text "Minor Ticks" \
-        -variable [itcl::scope _settings(-axisminorticks)] \
-        -command [itcl::code $this AdjustSetting -axisminorticks] \
+        -variable [itcl::scope _settings(axisMinorTicks)] \
+        -command [itcl::code $this AdjustSetting axisMinorTicks] \
         -font "Arial 9"
+
 
     label $inner.mode_l -text "Mode" -font "Arial 9" 
@@ -2073,6 +2099,6 @@
         "furthest_triad"  "farthest" \
         "outer_edges"     "outer"         
-    $itk_component(axisflymode) value $_settings(-axisflymode)
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
+    $itk_component(axisflymode) value "static"
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisFlymode]
 
     blt::table $inner \
@@ -2092,4 +2118,5 @@
 }
 
+
 itcl::body Rappture::VtkHeightmapViewer::BuildCameraTab {} {
     set inner [$itk_component(main) insert end \
@@ -2110,5 +2137,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
 
     set labels { qx qy qz qw xpan ypan zoom }
@@ -2117,9 +2143,9 @@
         label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _view(-$tag)]
+            -textvariable [itcl::scope _view($tag)]
         bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
+            [itcl::code $this camera set ${tag}]
         bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -2130,6 +2156,6 @@
     checkbutton $inner.ortho \
         -text "Orthographic Projection" \
-        -variable [itcl::scope _view(-ortho)] \
-        -command [itcl::code $this camera set -ortho] \
+        -variable [itcl::scope _view(ortho)] \
+        -command [itcl::code $this camera set ortho] \
         -font "Arial 9"
     blt::table $inner \
@@ -2138,5 +2164,5 @@
     incr row
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -2152,13 +2178,13 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_view($what)
+            set who [lindex $args 0]
+            set x $_view($who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
                 return
             }
-            switch -- $what {
-                "-ortho" {
-                    if {$_view($what)} {
+            switch -- $who {
+                "ortho" {
+                    if {$_view(ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -2166,14 +2192,14 @@
                     }
                 }
-                "-xpan" - "-ypan" {
+                "xpan" - "ypan" {
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "-zoom" {
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2259,6 +2285,6 @@
     array set style {
         -color BCGYR
+        -opacity 100
         -levels 10
-        -opacity 1.0
     }
     set stylelist [$dataobj style $comp]
@@ -2275,12 +2301,12 @@
     # the code to handle aberrant cases.
 
-    if { $_changed(-opacity) } {
-        set style(-opacity) [expr $_settings(-opacity) * 0.01]
-    }
-    if { $_changed(-numisolines) } {
-        set style(-levels) $_settings(-numisolines)
-    }
-    if { $_changed(-colormap) } {
-        set style(-color) $_settings(-colormap)
+    if { $_changed(opacity) } {
+        set style(-opacity) $_settings(opacity)
+    }
+    if { $_changed(numIsolines) } {
+        set style(-levels) $_settings(numIsolines)
+    }
+    if { $_changed(colormap) } {
+        set style(-color) $_settings(colormap)
     }
     if { $_currentColormap == "" } {
@@ -2288,10 +2314,11 @@
     }
     if { [info exists style(-stretchtofit)] } {
-        set _settings(-stretchtofit) $style(-stretchtofit)
-        AdjustSetting -stretchtofit
-    }
+        set _settings(stretchToFit) $style(-stretchtofit)
+        AdjustSetting stretchToFit
+    }
+    set _currentOpacity $style(-opacity)
     if { $_currentNumIsolines != $style(-levels) } {
         set _currentNumIsolines $style(-levels)
-        set _settings(-numisolines) $_currentNumIsolines
+        set _settings(numIsolines) $_currentNumIsolines
         $itk_component(numisolines) value $_currentNumIsolines
         UpdateContourList
@@ -2300,18 +2327,16 @@
     SendCmd "outline add $tag"
     SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
-    SendCmd "outline visible $_settings(-outline) $tag"
+    SendCmd "outline visible $_settings(outline) $tag"
     set scale [GetHeightmapScale]
     SendCmd "[list heightmap add contourlist $_contourList $scale $tag]"
-    set _comp2scale($tag) $_settings(-heightmapscale)
-    SendCmd "heightmap edges $_settings(-edges) $tag"
-    SendCmd "heightmap wireframe $_settings(-wireframe) $tag"
-    SetCurrentColormap $style(-color)
+    set _comp2scale($tag) $_settings(heightmapScale)
+    SendCmd "heightmap edges $_settings(edges) $tag"
+    SendCmd "heightmap wireframe $_settings(wireframe) $tag"
+    SetCurrentColormap $style(-color) 
     set color [$itk_component(isolinecolor) value]
     SendCmd "heightmap isolinecolor [Color2RGB $color] $tag"
-    SendCmd "heightmap lighting $_settings(-isheightmap) $tag"
-    SendCmd "heightmap isolines $_settings(-isolinesvisible) $tag"
-    SendCmd "heightmap surface $_settings(-colormapvisible) $tag"
-    SendCmd "heightmap opacity $style(-opacity) $tag"
-    set _settings(-opacity) [expr $style(-opacity) * 100.0]
+    SendCmd "heightmap lighting $_settings(isHeightmap) $tag"
+    SendCmd "heightmap isolines $_settings(isolinesVisible) $tag"
+    SendCmd "heightmap surface $_settings(colormapVisible) $tag"
 }
 
@@ -2372,5 +2397,5 @@
     }
     set x [expr $w - 2]
-    if { !$_settings(-legendvisible) } {
+    if { !$_settings(legendVisible) } {
 	$c delete legend
 	return
@@ -2380,15 +2405,12 @@
 	# If there's a legend title, create a text item for the title.
         $c create text $x $y \
-            -anchor ne \
-            -fill $itk_option(-plotforeground) -tags "title legend" \
-            -font $font
-        if { $title != "" } {
-            incr y $lineht
-        }
+		-anchor ne \
+		-fill $itk_option(-plotforeground) -tags "title legend" \
+		-font $font 
 	$c create text $x $y \
-            -anchor ne \
-            -fill $itk_option(-plotforeground) -tags "vmax legend" \
-            -font $font
-        incr y $lineht
+	    -anchor ne \
+	    -fill $itk_option(-plotforeground) -tags "vmax legend" \
+	    -font $font
+	incr y $lineht
 	$c create image $x $y \
 	    -anchor ne \
@@ -2414,5 +2436,5 @@
     array unset _isolines
     if { $color != "none"  && [info exists _limits($_curFldName)] && 
-         $_settings(-isolinesvisible) && $_currentNumIsolines > 0 } {
+         $_settings(isolinesVisible) && $_currentNumIsolines > 0 } {
 
         foreach { vmin vmax } $_limits($_curFldName) break
@@ -2581,5 +2603,5 @@
         invoke {
             $itk_component(field) value $_curFldLabel
-            AdjustSetting -field
+            AdjustSetting field
         }
         default {
@@ -2590,6 +2612,6 @@
 
 itcl::body Rappture::VtkHeightmapViewer::GetHeightmapScale {} {
-    if {  $_settings(-isheightmap) } {
-	set val $_settings(-heightmapscale)
+    if {  $_settings(isHeightmap) } {
+	set val $_settings(heightmapScale)
 	set sval [expr { $val >= 50 ? double($val)/50.0 : 1.0/(2.0-(double($val)/50.0)) }]
 	return $sval
@@ -2607,14 +2629,14 @@
         bottom "0 1 0 0"
     }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
+    foreach name { qw qx qy qz } value $positions($side) {
         set _view($name) $value
     } 
-    set q [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q"
     SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
+    set _view(xpan) 0
+    set _view(ypan) 0
+    set _view(zoom) 1.0
 }
 
Index: branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/vtkstreamlinesviewer.tcl	(revision 4848)
@@ -1,5 +1,5 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
 # ----------------------------------------------------------------------
-#  COMPONENT: vtkstreamlinesviewer - Vtk streamlines object viewer
+#  COMPONENT: vtkviewer - Vtk drawing object viewer
 #
 #  It connects to the Vtk server running on a rendering farm,
@@ -7,5 +7,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
+#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
 #
 #  See the file "license.terms" for information on usage and
@@ -62,6 +62,22 @@
     public method scale {args}
 
+    protected method Connect {}
+    protected method CurrentDatasets {args}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method DoReseed {}
+    protected method DoRotate {}
+    protected method AdjustSetting {what {value ""}}
+    protected method InitSettings { args  }
+    protected method Pan {option x y}
+    protected method Pick {x y}
+    protected method Rebuild {}
+    protected method ReceiveDataset { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { colormap title vmin vmax size }
+    protected method Rotate {option x y}
+    protected method Zoom {option}
+
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
     private method BuildAxisTab {}
     private method BuildCameraTab {}
@@ -73,10 +89,4 @@
     private method DrawLegend {}
     private method Combo { option }
-    private method Connect {}
-    private method CurrentDatasets {args}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DoReseed {}
-    private method DoRotate {}
     private method EnterLegend { x y } 
     private method EventuallyResize { w h } 
@@ -86,20 +96,9 @@
     private method GetImage { args } 
     private method GetVtkData { args } 
-    private method InitSettings { args  }
     private method IsValidObject { dataobj } 
     private method LeaveLegend {}
     private method MotionLegend { x y } 
-    private method Pan {option x y}
     private method PanCamera {}
-    private method Pick {x y}
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveDataset { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { colormap title vmin vmax size }
     private method RequestLegend {}
-    private method Rotate {option x y}
     private method SetColormap { dataobj comp }
     private method ChangeColormap { dataobj comp color }
@@ -108,8 +107,4 @@
     private method Slice {option args} 
     private method SetOrientation { side }
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
@@ -194,15 +189,15 @@
     $_dispatcher register !xcutplane
     $_dispatcher dispatch $this !xcutplane \
-        "[itcl::code $this AdjustSetting -cutplanexposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneXPosition]; list"
 
     # Y-Cutplane event
     $_dispatcher register !ycutplane
     $_dispatcher dispatch $this !ycutplane \
-        "[itcl::code $this AdjustSetting -cutplaneyposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneYPosition]; list"
 
     # Z-Cutplane event
     $_dispatcher register !zcutplane
     $_dispatcher dispatch $this !zcutplane \
-        "[itcl::code $this AdjustSetting -cutplanezposition]; list"
+        "[itcl::code $this AdjustSetting cutplaneZPosition]; list"
 
     #
@@ -215,48 +210,47 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -ortho           0
-        -qw              0.853553
-        -qx              -0.353553
-        -qy              0.353553
-        -qz              0.146447
-        -xpan            0
-        -ypan            0
-        -zoom            1.0
+        qw              0.853553
+        qx              -0.353553
+        qy              0.353553
+        qz              0.146447
+        zoom            1.0 
+        xpan            0
+        ypan            0
+        ortho           0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
 
     array set _settings [subst {
-        -axesvisible                1
-        -axislabelsvisible          1
-        -axisminorticks             1
-        -axismode                   "static"
-        -cutplaneedges              0
-        -cutplanelighting           1
-        -cutplaneopacity            100
-        -cutplanevisible            0
-        -cutplanewireframe          0
-        -cutplanexposition          50
-        -cutplanexvisible           1
-        -cutplaneyposition          50
-        -cutplaneyvisible           1
-        -cutplanezposition          50
-        -cutplanezvisible           1
-        -legendvisible              1
-        -streamlineslighting        1
-        -streamlinesmode            lines
-        -streamlinesnumseeds        200
-        -streamlinesopacity         100
-        -streamlinesscale           1
-        -streamlinesseedsvisible    0
-        -streamlinesvisible         1
-        -volumeedges                0
-        -volumelighting             1
-        -volumeopacity              40
-        -volumevisible              1
-        -volumewireframe            0
-        -xgrid                      0
-        -ygrid                      0
-        -zgrid                      0
+        axesVisible		1
+        axisLabelsVisible	1
+        axisXGrid		0
+        axisYGrid		0
+        axisZGrid		0
+        cutplaneEdges		0
+        cutplaneLighting	1
+        cutplaneOpacity		100
+        cutplaneVisible		0
+        cutplaneWireframe	0
+        cutplaneXPosition	50
+        cutplaneXVisible	1
+        cutplaneYPosition	50
+        cutplaneYVisible	1
+        cutplaneZPosition	50
+        cutplaneZVisible	1
+        legendVisible           1
+        streamlinesLighting     1
+        streamlinesMode		lines
+        streamlinesNumSeeds	200
+        streamlinesOpacity	100
+        streamlinesScale        1
+        streamlinesSeedsVisible 0
+        streamlinesVisible	1
+        volumeEdges		0
+        volumeLighting		1
+        volumeOpacity		40
+        volumeVisible		1
+        volumeWireframe		0
     }]
 
@@ -337,6 +331,6 @@
             -onimage [Rappture::icon volume-on] \
             -offimage [Rappture::icon volume-off] \
-            -variable [itcl::scope _settings(-volumevisible)] \
-            -command [itcl::code $this AdjustSetting -volumevisible] 
+            -variable [itcl::scope _settings(volumeVisible)] \
+            -command [itcl::code $this AdjustSetting volumeVisible] 
     }
     $itk_component(volume) select
@@ -349,6 +343,6 @@
             -onimage [Rappture::icon streamlines-on] \
             -offimage [Rappture::icon streamlines-off] \
-            -variable [itcl::scope _settings(-streamlinesvisible)] \
-            -command [itcl::code $this AdjustSetting -streamlinesvisible] \
+            -variable [itcl::scope _settings(streamlinesVisible)] \
+            -command [itcl::code $this AdjustSetting streamlinesVisible] \
     }
     $itk_component(streamlines) select
@@ -361,6 +355,6 @@
             -onimage [Rappture::icon cutbutton] \
             -offimage [Rappture::icon cutbutton] \
-            -variable [itcl::scope _settings(-cutplanevisible)] \
-            -command [itcl::code $this AdjustSetting -cutplanevisible] 
+            -variable [itcl::scope _settings(cutplaneVisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneVisible] 
     }
     Rappture::Tooltip::for $itk_component(cutplane) \
@@ -405,5 +399,11 @@
     bind $itk_component(view) <ButtonRelease-1> \
         [itcl::code $this Rotate release %x %y]
-
+    bind $itk_component(view) <Configure> \
+        [itcl::code $this EventuallyResize %w %h]
+
+    if 0 {
+    bind $itk_component(view) <Configure> \
+        [itcl::code $this EventuallyResize %w %h]
+    }
     # Bindings for panning via mouse
     bind $itk_component(view) <ButtonPress-2> \
@@ -453,4 +453,5 @@
     eval itk_initialize $args
     Connect
+    update
 }
 
@@ -480,5 +481,6 @@
 
 itcl::body Rappture::VtkStreamlinesViewer::DoRotate {} {
-    SendCmd "camera orient [ViewToQuaternion]" 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    SendCmd "camera orient $q" 
     set _rotatePending 0
 }
@@ -514,5 +516,5 @@
 
 itcl::body Rappture::VtkStreamlinesViewer::EventuallyRotate { q } {
-    QuaternionToView $q
+    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -786,5 +788,5 @@
         if { $_reportClientInfo }  {
             # Tell the server the viewer, hub, user and session.
-            # Do this immediately on connect before buffering any commands
+            # Do this immediately on connect before buffing any commands
             global env
 
@@ -876,7 +878,6 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"]
-            fconfigure $f -encoding binary
-            puts -nonewline $f $bytes
+            set f [open "last.ppm" "w"] 
+            puts $f $bytes
             close $f
         }
@@ -969,6 +970,6 @@
 	$_arcball resize $w $h
 	DoResize
-	InitSettings -xgrid -ygrid -zgrid -axismode \
-	    -axesvisible -axislabelsvisible -axisminorticks
+	InitSettings axisXGrid axisYGrid axisZGrid axis-mode \
+	    axesVisible axisLabelsVisible 
         # This "imgflush" is to force an image returned before vtkvis starts
         # reading a (big) dataset.  This will display an empty plot with axes
@@ -992,5 +993,5 @@
                     set f [open /tmp/vtkstreamlines.vtk "w"]
                     fconfigure $f -translation binary -encoding binary
-                    puts -nonewline $f $bytes
+                    puts $f $bytes
                     close $f
 		}
@@ -1026,9 +1027,9 @@
             set label [$_first hints ${axis}label]
             if { $label != "" } {
-                SendCmd [list axis name $axis $label]
+                SendCmd "axis name $axis $label"
             }
             set units [$_first hints ${axis}units]
             if { $units != "" } {
-                SendCmd [list axis units $axis $units]
+                SendCmd "axis units $axis $units"
             }
         }
@@ -1063,17 +1064,18 @@
 
     if { $_reset } {
-        InitSettings -streamlinesseedsvisible -streamlinesopacity \
-            -streamlinesvisible -streamlinescolormap \
-            -streamlineslighting \
-            -streamlinescolormap -field \
-            -volumevisible -volumeedges -volumelighting -volumeopacity \
-            -volumewireframe \
-	    -cutplanevisible \
-	    -cutplanexposition -cutplaneyposition -cutplanezposition \
-	    -cutplanexvisible -cutplaneyvisible -cutplanezvisible
+        InitSettings streamlinesSeedsVisible streamlinesOpacity \
+            streamlinesVisible streamlinesColormap \
+            streamlinesLighting \
+            streamlinesColormap field \
+            volumeVisible volumeEdges volumeLighting volumeOpacity \
+            volumeWireframe \
+	    cutplaneVisible \
+	    cutplaneXPosition cutplaneYPosition cutplaneZPosition \
+	    cutplaneXVisible cutplaneYVisible cutplaneZVisible
 
 	# Reset the camera and other view parameters
-	$_arcball quaternion [ViewToQuaternion]
-	if {$_view(-ortho)} {
+	set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+	$_arcball quaternion $q
+	if {$_view(ortho)} {
 	    SendCmd "camera mode ortho"
 	} else {
@@ -1149,20 +1151,20 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                qw      0.853553
+                qx      -0.353553
+                qy      0.353553
+                qz      0.146447
+                zoom    1.0
+                xpan    0
+                ypan    0
             }
             if { $_first != "" } {
@@ -1172,5 +1174,6 @@
                 }
             }
-            $_arcball quaternion [ViewToQuaternion]
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+            $_arcball quaternion $q
             DoRotate
             SendCmd "camera reset"
@@ -1180,8 +1183,9 @@
 
 itcl::body Rappture::VtkStreamlinesViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
+
 
 # ----------------------------------------------------------------------
@@ -1258,6 +1262,6 @@
             set x [expr $x / double($w)]
             set y [expr $y / double($h)]
-            set _view(-xpan) [expr $_view(-xpan) + $x]
-            set _view(-ypan) [expr $_view(-ypan) + $y]
+            set _view(xpan) [expr $_view(xpan) + $x]
+            set _view(ypan) [expr $_view(ypan) + $y]
             PanCamera
             return
@@ -1281,6 +1285,6 @@
             set _click(x) $x
             set _click(y) $y
-            set _view(-xpan) [expr $_view(-xpan) - $dx]
-            set _view(-ypan) [expr $_view(-ypan) - $dy]
+            set _view(xpan) [expr $_view(xpan) - $dx]
+            set _view(ypan) [expr $_view(ypan) - $dy]
             PanCamera
         }
@@ -1304,7 +1308,7 @@
 itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
     foreach spec $args {
-        if { [info exists _settings($_first${spec})] } {
+        if { [info exists _settings($_first-$spec)] } {
             # Reset global setting with dataobj specific setting
-            set _settings($spec) $_settings($_first${spec})
+            set _settings($spec) $_settings($_first-$spec)
         }
         AdjustSetting $spec
@@ -1324,17 +1328,46 @@
     }
     switch -- $what {
-        "-axesvisible" {
+        "volumeOpacity" {
+            set val $_settings(volumeOpacity)
+            set sval [expr { 0.01 * double($val) }]
+            SendCmd "polydata opacity $sval"
+        }
+        "volumeWireframe" {
+            set bool $_settings(volumeWireframe)
+            SendCmd "polydata wireframe $bool"
+        }
+        "volumeVisible" {
+            set bool $_settings(volumeVisible)
+            SendCmd "polydata visible $bool"
+            if { $bool } {
+                Rappture::Tooltip::for $itk_component(volume) \
+                    "Hide the volume"
+            } else {
+                Rappture::Tooltip::for $itk_component(volume) \
+                    "Show the volume"
+            }
+        }
+        "volumeLighting" {
+            set bool $_settings(volumeLighting)
+            SendCmd "polydata lighting $bool"
+        }
+        "volumeEdges" {
+            set bool $_settings(volumeEdges)
+            SendCmd "polydata edges $bool"
+        }
+        "axesVisible" {
+            set bool $_settings(axesVisible)
+            SendCmd "axis visible all $bool"
+        }
+        "axisLabelsVisible" {
+            set bool $_settings(axisLabelsVisible)
+            SendCmd "axis labels all $bool"
+        }
+        "axisXGrid" - "axisYGrid" - "axisZGrid" {
+            set axis [string tolower [string range $what 4 4]]
             set bool $_settings($what)
-            SendCmd "axis visible all $bool"
-        }
-        "-axislabelsvisible" {
-            set bool $_settings($what)
-            SendCmd "axis labels all $bool"
-        }
-        "-axisminorticks" {
-            set bool $_settings($what)
-            SendCmd "axis minticks all $bool"
-        }
-        "-axismode" {
+            SendCmd "axis grid $axis $bool"
+        }
+        "axis-mode" {
             set mode [$itk_component(axismode) value]
             set mode [$itk_component(axismode) translate $mode]
@@ -1342,27 +1375,27 @@
             SendCmd "axis flymode $mode"
         }
-        "-cutplaneedges" {
+        "cutplaneEdges" {
             set bool $_settings($what)
             SendCmd "cutplane edges $bool"
         }
-        "-cutplanevisible" {
+        "cutplaneVisible" {
             set bool $_settings($what)
             SendCmd "cutplane visible $bool"
         }
-        "-cutplanewireframe" {
+        "cutplaneWireframe" {
             set bool $_settings($what)
             SendCmd "cutplane wireframe $bool"
         }
-        "-cutplanelighting" {
+        "cutplaneLighting" {
             set bool $_settings($what)
             SendCmd "cutplane lighting $bool"
         }
-        "-cutplaneopacity" {
+        "cutplaneOpacity" {
             set val $_settings($what)
             set sval [expr { 0.01 * double($val) }]
             SendCmd "cutplane opacity $sval"
         }
-        "-cutplanexvisible" - "-cutplaneyvisible" - "-cutplanezvisible" {
-            set axis [string range $what 9 9]
+        "cutplaneXVisible" - "cutplaneYVisible" - "cutplaneZVisible" {
+            set axis [string tolower [string range $what 8 8]]
             set bool $_settings($what)
             if { $bool } {
@@ -1375,46 +1408,19 @@
             SendCmd "cutplane axis $axis $bool"
         }
-        "-cutplanexposition" - "-cutplaneyposition" - "-cutplanezposition" {
-            set axis [string range $what 9 9]
+        "cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" {
+            set axis [string tolower [string range $what 8 8]]
             set pos [expr $_settings($what) * 0.01]
             SendCmd "cutplane slice ${axis} ${pos}"
             set _cutplanePending 0
         }
-        "-field" {
-            set label [$itk_component(field) value]
-            set fname [$itk_component(field) translate $label]
-            set _settings($what) $fname
-            if { [info exists _fields($fname)] } {
-                foreach { label units components } $_fields($fname) break
-                if { $components > 1 } {
-                    set _colorMode vmag
-                } else {
-                    set _colorMode scalar
-                }
-                set _curFldName $fname
-                set _curFldLabel $label
-            } else {
-                puts stderr "unknown field \"$fname\""
-                return
-            }
-            # Get the new limits because the field changed.
-            if { ![info exists _limits($_curFldName)] } {
-                SendCmd "dataset maprange all"
-            } else {
-                SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
-            }
-            SendCmd "streamlines colormode $_colorMode $_curFldName"
-            SendCmd "cutplane colormode $_colorMode $_curFldName"
-            DrawLegend
-        }
-        "-streamlinesseedsvisible" {
+        "streamlinesSeedsVisible" {
             set bool $_settings($what)
             SendCmd "streamlines seed visible $bool"
         }
-        "-streamlinesnumseeds" {
+        "streamlinesNumSeeds" {
             set density $_settings($what)
             EventuallyReseed $density
         }
-        "-streamlinesvisible" {
+        "streamlinesVisible" {
             set bool $_settings($what)
             SendCmd "streamlines visible $bool"
@@ -1427,7 +1433,7 @@
             }
         }
-        "-streamlinesmode" {
+        "streamlinesMode" {
             set mode [$itk_component(streammode) value]
-            set _settings($what) $mode
+            set _settings(streamlinesMode) $mode
             switch -- $mode {
                 "lines" {
@@ -1442,7 +1448,7 @@
             }
         }
-        "-streamlinescolormap" {
+        "streamlinesColormap" {
             set colormap [$itk_component(colormap) value]
-            set _settings($what) $colormap
+            set _settings(streamlinesColormap) $colormap
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach {dataobj comp} [split $dataset -] break
@@ -1451,50 +1457,40 @@
             set _legendPending 1
         }
-        "-streamlinesopacity" {
-            set val $_settings($what)
+        "streamlinesOpacity" {
+            set val $_settings(streamlinesOpacity)
             set sval [expr { 0.01 * double($val) }]
             SendCmd "streamlines opacity $sval"
         }
-        "-streamlinesscale" {
-            set val $_settings($what)
+        "streamlinesScale" {
+            set val $_settings(streamlinesScale)
             set sval [expr { 0.01 * double($val) }]
             SendCmd "streamlines scale $sval $sval $sval"
         }
-        "-streamlineslighting" {
-            set bool $_settings($what)
+        "streamlinesLighting" {
+            set bool $_settings(streamlinesLighting)
             SendCmd "streamlines lighting $bool"
         }
-        "-volumeopacity" {
-            set val $_settings($what)
-            set sval [expr { 0.01 * double($val) }]
-            SendCmd "polydata opacity $sval"
-        }
-        "-volumewireframe" {
-            set bool $_settings($what)
-            SendCmd "polydata wireframe $bool"
-        }
-        "-volumevisible" {
-            set bool $_settings($what)
-            SendCmd "polydata visible $bool"
-            if { $bool } {
-                Rappture::Tooltip::for $itk_component(volume) \
-                    "Hide the volume"
+        "field" {
+            set label [$itk_component(field) value]
+            set fname [$itk_component(field) translate $label]
+            set _settings(field) $fname
+            if { [info exists _fields($fname)] } {
+                foreach { label units components } $_fields($fname) break
+                if { $components > 1 } {
+                    set _colorMode vmag
+                } else {
+                    set _colorMode scalar
+                }
+                set _curFldName $fname
+                set _curFldLabel $label
             } else {
-                Rappture::Tooltip::for $itk_component(volume) \
-                    "Show the volume"
-            }
-        }
-        "-volumelighting" {
-            set bool $_settings($what)
-            SendCmd "polydata lighting $bool"
-        }
-        "-volumeedges" {
-            set bool $_settings($what)
-            SendCmd "polydata edges $bool"
-        }
-        "-xgrid" - "-ygrid" - "-zgrid" {
-            set axis [string range $what 1 1]
-            set bool $_settings($what)
-            SendCmd "axis grid $axis $bool"
+                puts stderr "unknown field \"$fname\""
+                return
+            }
+            # Get the new limits because the field changed.
+            SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
+            SendCmd "streamlines colormode $_colorMode $_curFldName"
+            SendCmd "cutplane colormode $_colorMode $_curFldName"
+            DrawLegend
         }
         default {
@@ -1514,7 +1510,8 @@
     set font "Arial 8"
     set lineht [font metrics $font -linespace]
+    set c $itk_component(legend)
     set w 12
     set h [expr {$_height - 3 * ($lineht + 2)}]
-    if { $h < 1 } {
+    if { $h < 1} {
         return
     }
@@ -1581,4 +1578,5 @@
 }
 
+
 #
 # BuildColormap --
@@ -1590,8 +1588,8 @@
         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     }
-    if { ![info exists _settings(-volumeopacity)] } {
-        set _settings(-volumeopacity) $style(-opacity)
-    }
-    set max $_settings(-volumeopacity)
+    if { ![info exists _settings(volumeOpacity)] } {
+        set _settings(volumeOpacity) $style(-opacity)
+    }
+    set max $_settings(volumeOpacity)
 
     set wmap "0.0 1.0 1.0 1.0"
@@ -1604,6 +1602,6 @@
 itcl::configbody Rappture::VtkStreamlinesViewer::plotbackground {
     if { [isconnected] } {
-        set rgb [Color2RGB $itk_option(-plotbackground)]
-        SendCmd "screen bgcolor $rgb"
+        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
+        SendCmd "screen bgcolor $r $g $b"
     }
 }
@@ -1614,8 +1612,7 @@
 itcl::configbody Rappture::VtkStreamlinesViewer::plotforeground {
     if { [isconnected] } {
-        set rgb [Color2RGB $itk_option(-plotforeground)]
-        SendCmd "axis color all $rgb"
-        SendCmd "outline color $rgb"
-        SendCmd "cutplane color $rgb"
+        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1633,32 +1630,32 @@
     checkbutton $inner.volume \
         -text "Show Volume" \
-        -variable [itcl::scope _settings(-volumevisible)] \
-        -command [itcl::code $this AdjustSetting -volumevisible] \
+        -variable [itcl::scope _settings(volumeVisible)] \
+        -command [itcl::code $this AdjustSetting volumeVisible] \
         -font "Arial 9"
 
     checkbutton $inner.wireframe \
         -text "Show Wireframe" \
-        -variable [itcl::scope _settings(-volumewireframe)] \
-        -command [itcl::code $this AdjustSetting -volumewireframe] \
+        -variable [itcl::scope _settings(volumeWireframe)] \
+        -command [itcl::code $this AdjustSetting volumeWireframe] \
         -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-volumelighting)] \
-        -command [itcl::code $this AdjustSetting -volumelighting] \
+        -variable [itcl::scope _settings(volumeLighting)] \
+        -command [itcl::code $this AdjustSetting volumeLighting] \
         -font "Arial 9"
 
     checkbutton $inner.edges \
         -text "Show Edges" \
-        -variable [itcl::scope _settings(-volumeedges)] \
-        -command [itcl::code $this AdjustSetting -volumeedges] \
+        -variable [itcl::scope _settings(volumeEdges)] \
+        -command [itcl::code $this AdjustSetting volumeEdges] \
         -font "Arial 9"
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-volumeopacity)] \
+        -variable [itcl::scope _settings(volumeOpacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -volumeopacity]
+        -command [itcl::code $this AdjustSetting volumeOpacity]
 
     blt::table $inner \
@@ -1673,4 +1670,5 @@
 }
 
+
 itcl::body Rappture::VtkStreamlinesViewer::BuildStreamsTab {} {
 
@@ -1685,18 +1683,18 @@
     checkbutton $inner.streamlines \
         -text "Show Streamlines" \
-        -variable [itcl::scope _settings(-streamlinesvisible)] \
-        -command [itcl::code $this AdjustSetting -streamlinesvisible] \
+        -variable [itcl::scope _settings(streamlinesVisible)] \
+        -command [itcl::code $this AdjustSetting streamlinesVisible] \
         -font "Arial 9"
     
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-streamlineslighting)] \
-        -command [itcl::code $this AdjustSetting -streamlineslighting] \
+        -variable [itcl::scope _settings(streamlinesLighting)] \
+        -command [itcl::code $this AdjustSetting streamlinesLighting] \
         -font "Arial 9"
 
     checkbutton $inner.seeds \
         -text "Show Seeds" \
-        -variable [itcl::scope _settings(-streamlinesseedsvisible)] \
-        -command [itcl::code $this AdjustSetting -streamlinesseedsvisible] \
+        -variable [itcl::scope _settings(streamlinesSeedsVisible)] \
+        -command [itcl::code $this AdjustSetting streamlinesSeedsVisible] \
         -font "Arial 9"
 
@@ -1709,27 +1707,27 @@
         "ribbons"   "ribbons" \
         "tubes"     "tubes" 
-    $itk_component(streammode) value $_settings(-streamlinesmode)
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -streamlinesmode]
+    $itk_component(streammode) value $_settings(streamlinesMode)
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting streamlinesMode]
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-streamlinesopacity)] \
+        -variable [itcl::scope _settings(streamlinesOpacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -streamlinesopacity]
+        -command [itcl::code $this AdjustSetting streamlinesOpacity]
 
     label $inner.density_l -text "No. Seeds" -font "Arial 9"
     ::scale $inner.density -from 1 -to 1000 -orient horizontal \
-        -variable [itcl::scope _settings(-streamlinesnumseeds)] \
+        -variable [itcl::scope _settings(streamlinesNumSeeds)] \
         -width 10 \
         -showvalue on \
-        -command [itcl::code $this AdjustSetting -streamlinesnumseeds]
+        -command [itcl::code $this AdjustSetting streamlinesNumSeeds]
 
     label $inner.scale_l -text "Scale" -font "Arial 9"
     ::scale $inner.scale -from 1 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-streamlinesscale)] \
+        -variable [itcl::scope _settings(streamlinesScale)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -streamlinesscale]
+        -command [itcl::code $this AdjustSetting streamlinesScale]
 
     label $inner.field_l -text "Color by" -font "Arial 9" 
@@ -1738,5 +1736,5 @@
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting -field]
+        [itcl::code $this AdjustSetting field]
 
     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
@@ -1744,9 +1742,25 @@
         Rappture::Combobox $inner.colormap -width 10 -editable no
     }
-    $inner.colormap choices insert end [GetColormapList]
+    $inner.colormap choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   
 
     $itk_component(colormap) value "BCGYR"
     bind $inner.colormap <<Value>> \
-        [itcl::code $this AdjustSetting -streamlinescolormap]
+        [itcl::code $this AdjustSetting streamlinesColormap]
 
     blt::table $inner \
@@ -1775,38 +1789,33 @@
     set inner [$itk_component(main) insert end \
         -title "Axis Settings" \
-        -icon [Rappture::icon axis2]]
+        -icon [Rappture::icon axis1]]
     $inner configure -borderwidth 4
 
     checkbutton $inner.visible \
-        -text "Axes" \
-        -variable [itcl::scope _settings(-axesvisible)] \
-        -command [itcl::code $this AdjustSetting -axesvisible] \
+        -text "Show Axes" \
+        -variable [itcl::scope _settings(axesVisible)] \
+        -command [itcl::code $this AdjustSetting axesVisible] \
         -font "Arial 9"
 
     checkbutton $inner.labels \
-        -text "Axis Labels" \
-        -variable [itcl::scope _settings(-axislabelsvisible)] \
-        -command [itcl::code $this AdjustSetting -axislabelsvisible] \
+        -text "Show Axis Labels" \
+        -variable [itcl::scope _settings(axisLabelsVisible)] \
+        -command [itcl::code $this AdjustSetting axisLabelsVisible] \
         -font "Arial 9"
-    label $inner.grid_l -text "Grid" -font "Arial 9" 
+
     checkbutton $inner.xgrid \
-        -text "X" \
-        -variable [itcl::scope _settings(-xgrid)] \
-        -command [itcl::code $this AdjustSetting -xgrid] \
+        -text "Show X Grid" \
+        -variable [itcl::scope _settings(axisXGrid)] \
+        -command [itcl::code $this AdjustSetting axisXGrid] \
         -font "Arial 9"
     checkbutton $inner.ygrid \
-        -text "Y" \
-        -variable [itcl::scope _settings(-ygrid)] \
-        -command [itcl::code $this AdjustSetting -ygrid] \
+        -text "Show Y Grid" \
+        -variable [itcl::scope _settings(axisYGrid)] \
+        -command [itcl::code $this AdjustSetting axisYGrid] \
         -font "Arial 9"
     checkbutton $inner.zgrid \
-        -text "Z" \
-        -variable [itcl::scope _settings(-zgrid)] \
-        -command [itcl::code $this AdjustSetting -zgrid] \
-        -font "Arial 9"
-    checkbutton $inner.minorticks \
-        -text "Minor Ticks" \
-        -variable [itcl::scope _settings(-axisminorticks)] \
-        -command [itcl::code $this AdjustSetting -axisminorticks] \
+        -text "Show Z Grid" \
+        -variable [itcl::scope _settings(axisZGrid)] \
+        -command [itcl::code $this AdjustSetting axisZGrid] \
         -font "Arial 9"
 
@@ -1819,24 +1828,22 @@
         "static_triad"    "static" \
         "closest_triad"   "closest" \
-        "furthest_triad"  "farthest" \
+        "furthest_triad"  "furthest" \
         "outer_edges"     "outer"         
-    $itk_component(axismode) value $_settings(-axismode)
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
+    $itk_component(axismode) value "static"
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axis-mode]
 
     blt::table $inner \
-        0,0 $inner.visible -anchor w -cspan 4 \
-        1,0 $inner.labels  -anchor w -cspan 4 \
-        2,0 $inner.minorticks  -anchor w -cspan 4 \
-        4,0 $inner.grid_l  -anchor w \
-        4,1 $inner.xgrid   -anchor w \
-        4,2 $inner.ygrid   -anchor w \
-        4,3 $inner.zgrid   -anchor w \
-        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
-        5,1 $inner.mode    -fill x   -cspan 3
+        0,0 $inner.visible -anchor w -cspan 2 \
+        1,0 $inner.labels  -anchor w -cspan 2 \
+        2,0 $inner.xgrid   -anchor w -cspan 2 \
+        3,0 $inner.ygrid   -anchor w -cspan 2 \
+        4,0 $inner.zgrid   -anchor w -cspan 2 \
+        5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
+        6,0 $inner.mode    -fill x   -cspan 2 
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r7 c6 -resize expand
-    blt::table configure $inner r3 -height 0.125i
-}
+    blt::table configure $inner r7 c1 -resize expand
+}
+
 
 itcl::body Rappture::VtkStreamlinesViewer::BuildCameraTab {} {
@@ -1858,5 +1865,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
 
     set labels { qx qy qz qw xpan ypan zoom }
@@ -1865,9 +1871,7 @@
         label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _view(-$tag)]
-        bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
-        bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            -textvariable [itcl::scope _view($tag)]
+        bind $inner.${tag} <KeyPress-Return> \
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -1878,6 +1882,6 @@
     checkbutton $inner.ortho \
         -text "Orthographic Projection" \
-        -variable [itcl::scope _view(-ortho)] \
-        -command [itcl::code $this camera set -ortho] \
+        -variable [itcl::scope _view(ortho)] \
+        -command [itcl::code $this camera set ortho] \
         -font "Arial 9"
     blt::table $inner \
@@ -1886,5 +1890,5 @@
     incr row
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -1903,33 +1907,33 @@
     checkbutton $inner.visible \
         -text "Show Cutplanes" \
-        -variable [itcl::scope _settings(-cutplanevisible)] \
-        -command [itcl::code $this AdjustSetting -cutplanevisible] \
+        -variable [itcl::scope _settings(cutplaneVisible)] \
+        -command [itcl::code $this AdjustSetting cutplaneVisible] \
         -font "Arial 9"
 
     checkbutton $inner.wireframe \
         -text "Show Wireframe" \
-        -variable [itcl::scope _settings(-cutplanewireframe)] \
-        -command [itcl::code $this AdjustSetting -cutplanewireframe] \
+        -variable [itcl::scope _settings(cutplaneWireframe)] \
+        -command [itcl::code $this AdjustSetting cutplaneWireframe] \
         -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-cutplanelighting)] \
-        -command [itcl::code $this AdjustSetting -cutplanelighting] \
+        -variable [itcl::scope _settings(cutplaneLighting)] \
+        -command [itcl::code $this AdjustSetting cutplaneLighting] \
         -font "Arial 9"
 
     checkbutton $inner.edges \
         -text "Show Edges" \
-        -variable [itcl::scope _settings(-cutplaneedges)] \
-        -command [itcl::code $this AdjustSetting -cutplaneedges] \
+        -variable [itcl::scope _settings(cutplaneEdges)] \
+        -command [itcl::code $this AdjustSetting cutplaneEdges] \
         -font "Arial 9"
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-cutplaneopacity)] \
+        -variable [itcl::scope _settings(cutplaneOpacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -cutplaneopacity]
-    $inner.opacity set $_settings(-cutplaneopacity)
+        -command [itcl::code $this AdjustSetting cutplaneOpacity]
+    $inner.opacity set $_settings(cutplaneOpacity)
 
     # X-value slicer...
@@ -1938,6 +1942,6 @@
             -onimage [Rappture::icon x-cutplane-red] \
             -offimage [Rappture::icon x-cutplane-red] \
-            -command [itcl::code $this AdjustSetting -cutplanexvisible] \
-            -variable [itcl::scope _settings(-cutplanexvisible)]
+            -command [itcl::code $this AdjustSetting cutplaneXVisible] \
+            -variable [itcl::scope _settings(cutplaneXVisible)]
     }
     Rappture::Tooltip::for $itk_component(xCutButton) \
@@ -1950,5 +1954,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane x] \
-            -variable [itcl::scope _settings(-cutplanexposition)] \
+            -variable [itcl::scope _settings(cutplaneXPosition)] \
 	    -foreground red3 -font "Arial 9 bold"
     } {
@@ -1967,6 +1971,6 @@
             -onimage [Rappture::icon y-cutplane-green] \
             -offimage [Rappture::icon y-cutplane-green] \
-            -command [itcl::code $this AdjustSetting -cutplaneyvisible] \
-            -variable [itcl::scope _settings(-cutplaneyvisible)]
+            -command [itcl::code $this AdjustSetting cutplaneYVisible] \
+            -variable [itcl::scope _settings(cutplaneYVisible)]
     }
     Rappture::Tooltip::for $itk_component(yCutButton) \
@@ -1979,5 +1983,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane y] \
-            -variable [itcl::scope _settings(-cutplaneyposition)] \
+            -variable [itcl::scope _settings(cutplaneYPosition)] \
 	    -foreground green3 -font "Arial 9 bold"
     } {
@@ -1996,6 +2000,6 @@
             -onimage [Rappture::icon z-cutplane-blue] \
             -offimage [Rappture::icon z-cutplane-blue] \
-            -command [itcl::code $this AdjustSetting -cutplanezvisible] \
-            -variable [itcl::scope _settings(-cutplanezvisible)]
+            -command [itcl::code $this AdjustSetting cutplaneZVisible] \
+            -variable [itcl::scope _settings(cutplaneZVisible)]
     }
     Rappture::Tooltip::for $itk_component(zCutButton) \
@@ -2008,5 +2012,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane z] \
-            -variable [itcl::scope _settings(-cutplanezposition)] \
+            -variable [itcl::scope _settings(cutplaneZPosition)] \
 	    -foreground blue3 -font "Arial 9 bold"
     } {
@@ -2045,13 +2049,13 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_view($what)
+            set who [lindex $args 0]
+            set x $_view($who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
                 return
             }
-            switch -- $what {
-                "-ortho" {
-                    if {$_view($what)} {
+            switch -- $who {
+                "ortho" {
+                    if {$_view(ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -2059,14 +2063,14 @@
                     }
                 }
-                "-xpan" - "-ypan" {
+                "xpan" - "ypan" {
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "-zoom" {
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2158,5 +2162,4 @@
     }
     array set settings $style
-    StartBufferingCommands
     SendCmd "streamlines add $tag"
     SendCmd "streamlines seed visible off $tag"
@@ -2165,5 +2168,5 @@
         set length [string length $seeds]
         SendCmd "streamlines seed fmesh 200 data follows $length $tag"
-        append _outbuf $seeds
+        SendCmd "$seeds"
         set _seeds($dataobj) 1
     }
@@ -2171,10 +2174,9 @@
     SendCmd "polydata add $tag"
     SendCmd "polydata colormode constant {} $tag"
-    set _settings(-volumeedges) $settings(-edges)
-    set _settings(-volumelighting) $settings(-lighting)
-    set _settings(-volumeopacity) $settings(-opacity)
-    set _settings(-volumewireframe) $settings(-wireframe)
-    set _settings(-volumeopacity) [expr $settings(-opacity) * 100.0]
-    StopBufferingCommands
+    set _settings(volumeEdges) $settings(-edges)
+    set _settings(volumeLighting) $settings(-lighting)
+    set _settings(volumeOpacity) $settings(-opacity)
+    set _settings(volumeWireframe) $settings(-wireframe)
+    set _settings(volumeOpacity) [expr $settings(-opacity) * 100.0]
     SetColormap $dataobj $comp
 }
@@ -2233,5 +2235,5 @@
         set title $fname
     }
-    if { $_settings(-legendvisible) } {
+    if { $_settings(legendVisible) } {
         set x [expr $w - 2]
         if { [$c find withtag "legend"] == "" } {
@@ -2364,4 +2366,5 @@
         "move" {
             set axis [lindex $args 0]
+            set oldval $_settings(axis-${axis}position)
             set newval [lindex $args 1]
             if {[llength $args] != 2} {
@@ -2411,5 +2414,5 @@
         invoke {
             $itk_component(field) value $_curFldLabel
-            AdjustSetting -field
+            AdjustSetting field
         }
         default {
@@ -2428,13 +2431,13 @@
         bottom "0.707107 0.707107 0 0"
     }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
+    foreach name { qw qx qy qz } value $positions($side) {
         set _view($name) $value
     } 
-    set q [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q" 
     SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
-}
+    set _view(xpan) 0
+    set _view(ypan) 0
+    set _view(zoom) 1.0
+}
Index: branches/1.3/gui/scripts/vtkviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/vtkviewer.tcl	(revision 4848)
@@ -1,3 +1,4 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
+
 # ----------------------------------------------------------------------
 #  COMPONENT: vtkviewer - Vtk drawing object viewer
@@ -7,5 +8,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
+#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
 #
 #  See the file "license.terms" for information on usage and
@@ -57,5 +58,5 @@
     public method get {args}
     public method isconnected {}
-    public method limits { dataobj }
+    public method limits { colormap }
     public method parameters {title args} { 
         # do nothing 
@@ -63,6 +64,21 @@
     public method scale {args}
 
+    protected method Connect {}
+    protected method CurrentDatasets {args}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method DoRotate {}
+    protected method AdjustSetting {what {value ""}}
+    protected method FixSettings { args  }
+    protected method Pan {option x y}
+    protected method Pick {x y}
+    protected method Rebuild {}
+    protected method ReceiveDataset { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { colormap title vmin vmax size }
+    protected method Rotate {option x y}
+    protected method Zoom {option}
+
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
     private method BuildAxisTab {}
     private method BuildCameraTab {}
@@ -70,45 +86,26 @@
     private method BuildCutawayTab {}
     private method BuildDownloadPopup { widget command } 
-    private method BuildGlyphsTab {}
     private method BuildMoleculeTab {}
     private method BuildPolydataTab {}
     private method ChangeColormap { dataobj comp color }
-    private method Connect {}
-    private method CurrentDatasets {args}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DoRotate {}
     private method DrawLegend {}
     private method EnterLegend { x y } 
-    private method EventuallyResize { w h } 
-    private method EventuallyRotate { q } 
     private method EventuallySetAtomScale { args } 
     private method EventuallySetBondScale { args } 
-    private method EventuallySetGlyphsOpacity { args } 
     private method EventuallySetMoleculeOpacity { args } 
     private method EventuallySetMoleculeQuality { args } 
     private method EventuallySetPolydataOpacity { args } 
+    private method EventuallyResize { w h } 
+    private method EventuallyRotate { q } 
     private method GetImage { args } 
     private method GetVtkData { args } 
-    private method InitSettings { args  }
     private method IsValidObject { dataobj } 
     private method LeaveLegend {}
     private method MotionLegend { x y } 
-    private method Pan {option x y}
     private method PanCamera {}
-    private method Pick {x y}
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveDataset { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { colormap title vmin vmax size }
     private method RequestLegend {}
-    private method Rotate {option x y}
     private method SetAtomScale {}
     private method SetBondScale {}
     private method SetColormap { dataobj comp }
-    private method SetGlyphsOpacity {}
     private method SetLegendTip { x y }
     private method SetMoleculeOpacity {}
@@ -119,8 +116,4 @@
     private method SetPolydataOpacity {}
     private method Slice {option args} 
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
@@ -164,4 +157,5 @@
     private variable _polydataOpacityPending 0
     private variable _glyphsOpacityPending 0
+    private variable _updatePending 0;
     private variable _rotateDelay 150
     private variable _scaleDelay 100
@@ -187,4 +181,8 @@
     $_dispatcher register !resize
     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
+
+    # Update state event
+    $_dispatcher register !update
+    $_dispatcher dispatch $this !update "[itcl::code $this DoUpdate]; list"
 
     # Rotate event
@@ -216,30 +214,25 @@
     $_dispatcher dispatch $this !polydataOpacity \
         "[itcl::code $this SetPolydataOpacity]; list"
-
-    # Glyphs opacity event
-    $_dispatcher register !glyphsOpacity
-    $_dispatcher dispatch $this !glyphsOpacity \
-        "[itcl::code $this SetGlyphsOpacity]; list"
-
     #
     # Populate parser with commands handle incoming requests
     #
-    $_parser alias image [itcl::code $this ReceiveImage]
-    $_parser alias dataset [itcl::code $this ReceiveDataset]
-    $_parser alias legend [itcl::code $this ReceiveLegend]
+    $_parser alias image    [itcl::code $this ReceiveImage]
+    $_parser alias dataset  [itcl::code $this ReceiveDataset]
+    $_parser alias legend   [itcl::code $this ReceiveLegend]
 
     # Initialize the view to some default parameters.
     array set _view {
-        -ortho           0
-        -qw              0.853553
-        -qx              -0.353553
-        -qy              0.353553
-        -qz              0.146447
-        -xpan            0
-        -ypan            0
-        -zoom            1.0
+        qw              0.853553
+        qx              -0.353553
+        qy              0.353553
+        qz              0.146447
+        zoom            1.0 
+        xpan            0
+        ypan            0
+        ortho           0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
 
     set _limits(zmin) 0.0
@@ -247,7 +240,4 @@
 
     array set _axis [subst {
-        labels          1
-        minorticks      1
-        visible         1
         xgrid           0
         ygrid           0
@@ -262,24 +252,26 @@
         ydirection      -1
         zdirection      -1
+        visible         1
+        labels          1
     }]
     array set _settings [subst {
-        glyphs-edges            0
-        glyphs-lighting         1
+        legend                  1
         glyphs-opacity          100
-        glyphs-outline          0
-        glyphs-palette          BCGYR
-        glyphs-visible          1
         glyphs-wireframe        0
-        legend                  1
-        molecule-atoms-visible  1
+        polydata-edges          0
+        polydata-lighting       1
+        polydata-opacity        100
+        polydata-palette        rainbow
+        polydata-visible        1
+        polydata-wireframe      0
         molecule-atomscale      0.3
-        molecule-bonds-visible  1
         molecule-bondscale      0.075
         molecule-bondstyle      "cylinder"
+        molecule-atoms-visible  1
+        molecule-bonds-visible  1
         molecule-edges          0
         molecule-labels         0
         molecule-lighting       1
         molecule-opacity        100
-        molecule-outline        0
         molecule-palette        elementDefault
         molecule-quality        1.0
@@ -288,11 +280,4 @@
         molecule-visible        1
         molecule-wireframe      0
-        polydata-edges          0
-        polydata-lighting       1
-        polydata-opacity        100
-        polydata-outline        0
-        polydata-palette        BCGYR
-        polydata-visible        1
-        polydata-wireframe      0
     }]
     itk_component add view {
@@ -362,13 +347,10 @@
     Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
 
-    if { [catch {
-        BuildAxisTab
-        #BuildCutawayTab
-        BuildCameraTab
-    } errs] != 0 } {
-        puts stderr errs=$errs
-    }
+    BuildAxisTab
+    #BuildCutawayTab
+    BuildCameraTab
 
     # Legend
+
     set _image(legend) [image create photo]
     itk_component add legend {
@@ -396,4 +378,6 @@
     bind $itk_component(view) <ButtonRelease-1> \
         [itcl::code $this Rotate release %x %y]
+    bind $itk_component(view) <Configure> \
+        [itcl::code $this EventuallyResize %w %h]
 
     # Bindings for panning via mouse
@@ -473,5 +457,6 @@
 
 itcl::body Rappture::VtkViewer::DoRotate {} {
-    SendCmd "camera orient [ViewToQuaternion]" 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    SendCmd "camera orient $q" 
     set _rotatePending 0
 }
@@ -488,5 +473,5 @@
 
 itcl::body Rappture::VtkViewer::EventuallyRotate { q } {
-    QuaternionToView $q
+    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -521,14 +506,4 @@
 }
 
-itcl::body Rappture::VtkViewer::SetGlyphsOpacity {} {
-    set _glyphsOpacityPending 0
-    foreach dataset [CurrentDatasets -visible $_first] {
-        foreach { dataobj comp } [split $dataset -] break
-        if { [$dataobj type $comp] == "glyphs" } {
-            SetOpacity $dataset
-        }
-    }
-}
-
 itcl::body Rappture::VtkViewer::SetPolydataOpacity {} {
     set _polydataOpacityPending 0
@@ -573,11 +548,4 @@
         set _polydataOpacityPending 1
         $_dispatcher event -after $_scaleDelay !polydataOpacity
-    }
-}
-
-itcl::body Rappture::VtkViewer::EventuallySetGlyphsOpacity { args } {
-    if { !$_glyphsOpacityPending } {
-        set _glyphsOpacityPending 1
-        $_dispatcher event -after $_scaleDelay !glyphsOpacity
     }
 }
@@ -748,30 +716,23 @@
         }
         array set bounds [limits $dataobj]
-        if {[info exists bounds(xmin)] && (![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin))} {
+        if {![info exists _limits(xmin)] || $_limits(xmin) > $bounds(xmin)} {
             set _limits(xmin) $bounds(xmin)
         }
-        if {[info exists bounds(xmax)] && (![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax))} {
+        if {![info exists _limits(xmax)] || $_limits(xmax) < $bounds(xmax)} {
             set _limits(xmax) $bounds(xmax)
         }
 
-        if {[info exists bounds(ymin)] && (![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin))} {
+        if {![info exists _limits(ymin)] || $_limits(ymin) > $bounds(ymin)} {
             set _limits(ymin) $bounds(ymin)
         }
-        if {[info exists bounds(ymax)] && (![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax))} {
+        if {![info exists _limits(ymax)] || $_limits(ymax) < $bounds(ymax)} {
             set _limits(ymax) $bounds(ymax)
         }
 
-        if {[info exists bounds(zmin)] && (![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin))} {
+        if {![info exists _limits(zmin)] || $_limits(zmin) > $bounds(zmin)} {
             set _limits(zmin) $bounds(zmin)
         }
-        if {[info exists bounds(zmax)] && (![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax))} {
+        if {![info exists _limits(zmax)] || $_limits(zmax) < $bounds(zmax)} {
             set _limits(zmax) $bounds(zmax)
-        }
-    }
-    if { $_haveGlyphs } {
-        if { ![$itk_component(main) exists "Glyphs Settings"] } {
-            if { [catch { BuildGlyphsTab } errs ]  != 0 } {
-                puts stderr "errs=$errs"
-            }
         }
     }
@@ -867,5 +828,5 @@
         if { $_reportClientInfo }  {
             # Tell the server the viewer, hub, user and session.
-            # Do this immediately on connect before buffering any commands
+            # Do this immediately on connect before buffing any commands
             global env
 
@@ -924,5 +885,4 @@
 
     # disconnected -- no more data sitting on server
-    set _outbuf ""
     array unset _datasets 
     array unset _data 
@@ -951,5 +911,5 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"]
+            set f [open "last.ppm" "w"] 
             fconfigure $f -encoding binary
             puts -nonewline $f $bytes
@@ -1037,7 +997,11 @@
         $_arcball resize $w $h
         DoResize
-        InitSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
-            axis-visible axis-labels axis-minorticks
-
+        FixSettings axis-xgrid axis-ygrid axis-zgrid axis-mode \
+            axis-visible axis-labels
+
+        if { $_havePolydata } {
+            FixSettings polydata-edges polydata-lighting polydata-opacity \
+                polydata-visible polydata-wireframe 
+        }
         StopBufferingCommands
         SendCmd "imgflush"
@@ -1061,10 +1025,4 @@
                 if { $bytes == "" } {
                     continue
-                }
-                if 0 {
-                    set f [open /tmp/vtkviewer.vtk "w"]
-                    fconfigure $f -translation binary -encoding binary
-                    puts -nonewline $f $bytes
-                    close $f
                 }
                 set length [string length $bytes]
@@ -1079,5 +1037,5 @@
                     lappend info "dataset_size"  $length
                     lappend info "dataset_tag"   $tag
-                    SendCmd "clientinfo [list $info]"
+                    SendCmd [list "clientinfo" $info]
                 }
                 SendCmd "dataset add $tag data follows $length"
@@ -1087,7 +1045,6 @@
             }
             lappend _obj2datasets($dataobj) $tag
-            set type [$dataobj type $comp]
             if { [info exists _obj2ovride($dataobj-raise)] } {
-                SendCmd "$type visible 1 $tag"
+                SendCmd "dataset visible 1 $tag"
                 SetOpacity $tag
             }
@@ -1103,38 +1060,17 @@
             set label [$_first hints ${axis}label]
             if { $label != "" } {
-                SendCmd [list axis name $axis $label]
+                SendCmd "axis name $axis $label"
             }
             set units [$_first hints ${axis}units]
             if { $units != "" } {
-                SendCmd [list axis units $axis $units]
-            }
-        }
-    }
-    if { $_haveGlyphs } {
-        InitSettings glyphs-outline
-    }
-    if { $_haveMolecules } {
-        InitSettings molecule-outline
-    }
-    if { $_havePolydata } {
-        InitSettings polydata-outline
+                SendCmd "axis units $axis $units"
+            }
+        }
     }
     if { $_reset } {
-        if { $_haveGlyphs } {
-            InitSettings glyphs-edges glyphs-lighting glyphs-opacity \
-                glyphs-visible glyphs-wireframe 
-        }
-        if { $_havePolydata } {
-            InitSettings polydata-edges polydata-lighting polydata-opacity \
-                polydata-visible polydata-wireframe 
-        }
-        if { $_haveMolecules } {
-            InitSettings molecule-edges molecule-lighting molecule-opacity \
-                molecule-visible molecule-wireframe molecule-labels
-        }
-
-        $_arcball quaternion [ViewToQuaternion]
+        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+        $_arcball quaternion $q 
         SendCmd "camera reset"
-        if { $_view(-ortho)} {
+        if { $_view(ortho)} {
             SendCmd "camera mode ortho"
         } else {
@@ -1147,5 +1083,5 @@
 
     if { $_haveMolecules } {
-        #InitSettings molecule-representation 
+        #FixSettings molecule-representation 
     }
     set _reset 0
@@ -1217,20 +1153,20 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                qw      0.853553
+                qx      -0.353553
+                qy      0.353553
+                qz      0.146447
+                zoom    1.0
+                xpan    0
+                ypan    0
             }
             if { $_first != "" } {
@@ -1240,5 +1176,6 @@
                 }
             }
-            $_arcball quaternion [ViewToQuaternion]
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+            $_arcball quaternion $q
             DoRotate
             SendCmd "camera reset"
@@ -1248,6 +1185,6 @@
 
 itcl::body Rappture::VtkViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
@@ -1326,6 +1263,6 @@
             set x [expr $x / double($w)]
             set y [expr $y / double($h)]
-            set _view(-xpan) [expr $_view(-xpan) + $x]
-            set _view(-ypan) [expr $_view(-ypan) + $y]
+            set _view(xpan) [expr $_view(xpan) + $x]
+            set _view(ypan) [expr $_view(ypan) + $y]
             PanCamera
             return
@@ -1349,6 +1286,6 @@
             set _click(x) $x
             set _click(y) $y
-            set _view(-xpan) [expr $_view(-xpan) - $dx]
-            set _view(-ypan) [expr $_view(-ypan) - $dy]
+            set _view(xpan) [expr $_view(xpan) - $dx]
+            set _view(ypan) [expr $_view(ypan) - $dy]
             PanCamera
         }
@@ -1364,5 +1301,5 @@
 
 # ----------------------------------------------------------------------
-# USAGE: InitSettings <what> ?<value>?
+# USAGE: FixSettings <what> ?<value>?
 #
 # Used internally to update rendering settings whenever parameters
@@ -1370,5 +1307,5 @@
 # to the back end.
 # ----------------------------------------------------------------------
-itcl::body Rappture::VtkViewer::InitSettings { args } {
+itcl::body Rappture::VtkViewer::FixSettings { args } {
     foreach setting $args {
         AdjustSetting $setting
@@ -1388,76 +1325,4 @@
     }
     switch -- $what {
-        "glyphs-opacity" {
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                if { [$dataobj type $comp] == "glyphs" } {
-                    SetOpacity $dataset
-                }
-            }
-        }
-        "glyphs-outline" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    SendCmd "outline visible $bool $dataset"
-                }
-            }
-        }
-        "glyphs-wireframe" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    SendCmd "$type wireframe $bool $dataset"
-                }
-            }
-        }
-        "glyphs-visible" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    SendCmd "$type visible $bool $dataset"
-                }
-            }
-        }
-        "glyphs-lighting" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    SendCmd "$type lighting $bool $dataset"
-                }
-            }
-        }
-        "glyphs-edges" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    SendCmd "$type edges $bool $dataset"
-                }
-            }
-        }
-        "glyphs-palette" {
-            set palette [$itk_component(glyphspalette) value]
-            set _settings($what) $palette
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach {dataobj comp} [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "glyphs" } {
-                    ChangeColormap $dataobj $comp $palette
-                    # FIXME: fill in current selected fieldname
-                    #SendCmd "glyphs colormode scalar {} $dataset"
-                }
-            }
-            set _legendPending 1
-        }
         "polydata-opacity" {
             foreach dataset [CurrentDatasets -visible $_first] {
@@ -1468,16 +1333,6 @@
             }
         }
-        "polydata-outline" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "polydata" } {
-                    SendCmd "outline visible $bool $dataset"
-                }
-            }
-        }
         "polydata-wireframe" {
-            set bool $_settings($what)
+            set bool $_settings(polydata-wireframe)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1489,5 +1344,5 @@
         }
         "polydata-visible" {
-            set bool $_settings($what)
+            set bool $_settings(polydata-visible)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1499,5 +1354,5 @@
         }
         "polydata-lighting" {
-            set bool $_settings($what)
+            set bool $_settings(polydata-lighting)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1509,5 +1364,5 @@
         }
         "polydata-edges" {
-            set bool $_settings($what)
+            set bool $_settings(polydata-edges)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1520,5 +1375,5 @@
         "polydata-palette" {
             set palette [$itk_component(meshpalette) value]
-            set _settings($what) $palette
+            set _settings(polydata-palette) $palette
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach {dataobj comp} [split $dataset -] break
@@ -1533,4 +1388,6 @@
         }
         "molecule-opacity" {
+            set val $_settings(molecule-opacity)
+            set sval [expr { 0.01 * double($val) }]
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1540,16 +1397,6 @@
             }
         }
-        "molecule-outline" {
-            set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible $_first] {
-                foreach { dataobj comp } [split $dataset -] break
-                set type [$dataobj type $comp]
-                if { $type == "molecule" } {
-                    SendCmd "outline visible $bool $dataset"
-                }
-            }
-        }
         "molecule-wireframe" {
-            set bool $_settings($what)
+            set bool $_settings(molecule-wireframe)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1561,5 +1408,5 @@
         }
         "molecule-visible" {
-            set bool $_settings($what)
+            set bool $_settings(molecule-visible)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1571,5 +1418,5 @@
         }
         "molecule-lighting" {
-            set bool $_settings($what)
+            set bool $_settings(molecule-lighting)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1581,5 +1428,5 @@
         }
         "molecule-edges" {
-            set bool $_settings($what)
+            set bool $_settings(molecule-edges)
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach { dataobj comp } [split $dataset -] break
@@ -1592,5 +1439,5 @@
         "molecule-palette" {
             set palette [$itk_component(moleculepalette) value]
-            set _settings($what) $palette
+            set _moelculeSettings(palette) $palette
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach {dataobj comp} [split $dataset -] break
@@ -1656,5 +1503,5 @@
                     set _settings(molecule-atoms-visible) 0
                     set _settings(molecule-bonds-visible) 1
-                    set _settings(molecule-bondstyle) line
+                    set _settings(molecule-bondstyle) cylinder
                     set _settings(molecule-atomscale) 1.0
                     set _settings(molecule-bondscale) 1.0
@@ -1677,12 +1524,10 @@
                 set type [$dataobj type $comp]
                 if { $type == "molecule" } {
-                    StartBufferingCommands
-                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
-                    SendCmd [subst {molecule ascale $_settings(molecule-atomscale) $dataset}]
-                    SendCmd [subst {molecule bscale $_settings(molecule-bondscale) $dataset}]
-                    SendCmd [subst {molecule bstyle $_settings(molecule-bondstyle) $dataset}]
-                    SendCmd [subst {molecule atoms $_settings(molecule-atoms-visible) $dataset}]
-                    SendCmd [subst {molecule bonds $_settings(molecule-bonds-visible) $dataset}]
-                    StopBufferingCommands
+                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset
+molecule ascale $_settings(molecule-atomscale) $dataset
+molecule bscale $_settings(molecule-bondscale) $dataset
+molecule bstyle $_settings(molecule-bondstyle) $dataset
+molecule atoms $_settings(molecule-atoms-visible) $dataset
+molecule bonds $_settings(molecule-bonds-visible) $dataset}]
                 }
             }
@@ -1691,15 +1536,15 @@
             set value [$itk_component(rscale) value]
             set value [$itk_component(rscale) translate $value]
-            set _settings($what) $value
+            set _settings(molecule-rscale) $value
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach {dataobj comp} [split $dataset -] break
                 set type [$dataobj type $comp]
                 if { $type == "molecule" } {
-                    SendCmd [subst {molecule rscale $_settings($what) $dataset}]
+                    SendCmd [subst {molecule rscale $_settings(molecule-rscale) $dataset}]
                 }
             }
         }
         "molecule-labels" {
-            set bool $_settings($what)
+            set bool $_settings(molecule-labels)
             foreach dataset [CurrentDatasets -visible $_first] {
                foreach { dataobj comp } [split $dataset -] break
@@ -1717,8 +1562,4 @@
             set bool $_axis(labels)
             SendCmd "axis labels all $bool"
-        }
-        "axis-minorticks" {
-            set bool $_axis(minorticks)
-            SendCmd "axis minticks all $bool"
         }
         "axis-xgrid" {
@@ -1777,7 +1618,8 @@
     set font "Arial 8"
     set lineht [font metrics $font -linespace]
+    set c $itk_component(legend)
     set w 12
     set h [expr {$_height - 2 * ($lineht + 2)}]
-    if { $h < 1 } {
+    if { $h < 1} {
         return
     }
@@ -1885,6 +1727,6 @@
 itcl::configbody Rappture::VtkViewer::plotbackground {
     if { [isconnected] } {
-        set rgb [Color2RGB $itk_option(-plotbackground)]
-        SendCmd "screen bgcolor $rgb"
+        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
+        SendCmd "screen bgcolor $r $g $b"
     }
 }
@@ -1895,7 +1737,7 @@
 itcl::configbody Rappture::VtkViewer::plotforeground {
     if { [isconnected] } {
-        set rgb [Color2RGB $itk_option(-plotforeground)]
-        SendCmd "axis color all $rgb"
-        SendCmd "outline color $rgb"
+        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
     }
 }
@@ -1930,8 +1772,4 @@
             file delete $tmpfile
             set output [$reader GetOutput]
-            if { $output == "" } {
-                # Invalid VTK file -- loader failed to parse
-                continue
-            }
             set _limits($tag) [$output GetBounds]
             if {$debug} {
@@ -1992,82 +1830,10 @@
 }
 
-itcl::body Rappture::VtkViewer::BuildGlyphsTab {} {
+itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
 
     set fg [option get $itk_component(hull) font Font]
     #set bfg [option get $itk_component(hull) boldFont Font]
 
-    set inner [$itk_component(main) insert 0 \
-        -title "Glyph Settings" \
-        -icon [Rappture::icon volume-on]]
-    $inner configure -borderwidth 4
-
-    checkbutton $inner.glyphs \
-        -text "Show Glyphs" \
-        -variable [itcl::scope _settings(glyphs-visible)] \
-        -command [itcl::code $this AdjustSetting glyphs-visible] \
-        -font "Arial 9" -anchor w 
-
-    checkbutton $inner.outline \
-        -text "Show Outline" \
-        -variable [itcl::scope _settings(glyphs-outline)] \
-        -command [itcl::code $this AdjustSetting glyphs-outline] \
-        -font "Arial 9" -anchor w 
-
-    checkbutton $inner.wireframe \
-        -text "Show Wireframe" \
-        -variable [itcl::scope _settings(glyphs-wireframe)] \
-        -command [itcl::code $this AdjustSetting glyphs-wireframe] \
-        -font "Arial 9" -anchor w 
-
-    checkbutton $inner.lighting \
-        -text "Enable Lighting" \
-        -variable [itcl::scope _settings(glyphs-lighting)] \
-        -command [itcl::code $this AdjustSetting glyphs-lighting] \
-        -font "Arial 9" -anchor w
-
-    checkbutton $inner.edges \
-        -text "Show Edges" \
-        -variable [itcl::scope _settings(glyphs-edges)] \
-        -command [itcl::code $this AdjustSetting glyphs-edges] \
-        -font "Arial 9" -anchor w
-
-    label $inner.palette_l -text "Palette" -font "Arial 9" -anchor w 
-    itk_component add glyphspalette {
-        Rappture::Combobox $inner.palette -width 10 -editable no
-    }
-    $inner.palette choices insert end [GetColormapList]
-    $itk_component(glyphspalette) value "BCGYR"
-    bind $inner.palette <<Value>> \
-        [itcl::code $this AdjustSetting glyphs-palette]
-
-    label $inner.opacity_l -text "Opacity" -font "Arial 9" -anchor w 
-    ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(glyphs-opacity)] \
-        -width 10 \
-        -showvalue off \
-        -command [itcl::code $this EventuallySetGlyphsOpacity]
-    $inner.opacity set $_settings(glyphs-opacity)
-
-    blt::table $inner \
-        0,0 $inner.glyphs    -cspan 2  -anchor w -pady 2 \
-        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
-        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
-        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
-        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
-        5,0 $inner.opacity_l -anchor w -pady 2 \
-        5,1 $inner.opacity   -fill x   -pady 2 \
-        6,0 $inner.palette_l -anchor w -pady 2 \
-        6,1 $inner.palette   -fill x   -pady 2  
-
-    blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r8 c1 -resize expand
-}
-
-itcl::body Rappture::VtkViewer::BuildPolydataTab {} {
-
-    set fg [option get $itk_component(hull) font Font]
-    #set bfg [option get $itk_component(hull) boldFont Font]
-
-    set inner [$itk_component(main) insert 0 \
+    set inner [$itk_component(main) insert end \
         -title "Mesh Settings" \
         -icon [Rappture::icon mesh]]
@@ -2080,10 +1846,4 @@
         -font "Arial 9" -anchor w 
 
-    checkbutton $inner.outline \
-        -text "Show Outline" \
-        -variable [itcl::scope _settings(polydata-outline)] \
-        -command [itcl::code $this AdjustSetting polydata-outline] \
-        -font "Arial 9" -anchor w 
-
     checkbutton $inner.wireframe \
         -text "Show Wireframe" \
@@ -2108,5 +1868,22 @@
         Rappture::Combobox $inner.palette -width 10 -editable no
     }
-    $inner.palette choices insert end [GetColormapList]
+    $inner.palette choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   
+
     $itk_component(meshpalette) value "BCGYR"
     bind $inner.palette <<Value>> \
@@ -2118,20 +1895,19 @@
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this EventuallySetPolydataOpacity]
+        -command [itcl::code $this AdjustSetting polydata-opacity]
     $inner.opacity set $_settings(polydata-opacity)
 
     blt::table $inner \
         0,0 $inner.mesh      -cspan 2  -anchor w -pady 2 \
-        1,0 $inner.outline   -cspan 2  -anchor w -pady 2 \
-        2,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
-        3,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
-        4,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
-        5,0 $inner.opacity_l -anchor w -pady 2 \
-        5,1 $inner.opacity   -fill x   -pady 2 \
-        6,0 $inner.palette_l -anchor w -pady 2 \
-        6,1 $inner.palette   -fill x   -pady 2  
+        1,0 $inner.wireframe -cspan 2  -anchor w -pady 2 \
+        2,0 $inner.lighting  -cspan 2  -anchor w -pady 2 \
+        3,0 $inner.edges     -cspan 2  -anchor w -pady 2 \
+        4,0 $inner.opacity_l -anchor w -pady 2 \
+        4,1 $inner.opacity   -fill x   -pady 2 \
+        5,0 $inner.palette_l -anchor w -pady 2 \
+        5,1 $inner.palette   -fill x   -pady 2  
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r8 c1 -resize expand
+    blt::table configure $inner r7 c1 -resize expand
 }
 
@@ -2143,9 +1919,9 @@
     set inner [$itk_component(main) insert end \
         -title "Axis Settings" \
-        -icon [Rappture::icon axis2]]
+        -icon [Rappture::icon axis1]]
     $inner configure -borderwidth 4
 
     checkbutton $inner.visible \
-        -text "Axes" \
+        -text "Show Axes" \
         -variable [itcl::scope _axis(visible)] \
         -command [itcl::code $this AdjustSetting axis-visible] \
@@ -2153,29 +1929,24 @@
 
     checkbutton $inner.labels \
-        -text "Axis Labels" \
+        -text "Show Axis Labels" \
         -variable [itcl::scope _axis(labels)] \
         -command [itcl::code $this AdjustSetting axis-labels] \
         -font "Arial 9"
-    label $inner.grid_l -text "Grid" -font "Arial 9" 
-    checkbutton $inner.xgrid \
-        -text "X" \
+
+    checkbutton $inner.gridx \
+        -text "Show X Grid" \
         -variable [itcl::scope _axis(xgrid)] \
         -command [itcl::code $this AdjustSetting axis-xgrid] \
         -font "Arial 9"
-    checkbutton $inner.ygrid \
-        -text "Y" \
+    checkbutton $inner.gridy \
+        -text "Show Y Grid" \
         -variable [itcl::scope _axis(ygrid)] \
         -command [itcl::code $this AdjustSetting axis-ygrid] \
         -font "Arial 9"
-    checkbutton $inner.zgrid \
-        -text "Z" \
+    checkbutton $inner.gridz \
+        -text "Show Z Grid" \
         -variable [itcl::scope _axis(zgrid)] \
         -command [itcl::code $this AdjustSetting axis-zgrid] \
         -font "Arial 9"
-    checkbutton $inner.minorticks \
-        -text "Minor Ticks" \
-        -variable [itcl::scope _axis(minorticks)] \
-        -command [itcl::code $this AdjustSetting axis-minorticks] \
-        -font "Arial 9"
 
     label $inner.mode_l -text "Mode" -font "Arial 9" 
@@ -2187,5 +1958,5 @@
         "static_triad"    "static" \
         "closest_triad"   "closest" \
-        "furthest_triad"  "farthest" \
+        "furthest_triad"  "furthest" \
         "outer_edges"     "outer"         
     $itk_component(axismode) value "static"
@@ -2193,17 +1964,14 @@
 
     blt::table $inner \
-        0,0 $inner.visible -anchor w -cspan 4 \
-        1,0 $inner.labels  -anchor w -cspan 4 \
-        2,0 $inner.minorticks  -anchor w -cspan 4 \
-        4,0 $inner.grid_l  -anchor w \
-        4,1 $inner.xgrid   -anchor w \
-        4,2 $inner.ygrid   -anchor w \
-        4,3 $inner.zgrid   -anchor w \
-        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
-        5,1 $inner.mode    -fill x   -cspan 3
+        0,0 $inner.visible -anchor w -cspan 2 \
+        1,0 $inner.labels  -anchor w -cspan 2 \
+        2,0 $inner.gridx   -anchor w -cspan 2 \
+        3,0 $inner.gridy   -anchor w -cspan 2 \
+        4,0 $inner.gridz   -anchor w -cspan 2 \
+        5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
+        6,0 $inner.mode    -fill x   -cspan 2 
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r7 c6 -resize expand
-    blt::table configure $inner r3 -height 0.125i
+    blt::table configure $inner r7 c1 -resize expand
 }
 
@@ -2226,5 +1994,4 @@
         0,0 $inner.view_l -anchor e -pady 2 \
         0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
 
     set labels { qx qy qz qw xpan ypan zoom }
@@ -2233,9 +2000,7 @@
         label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _view(-$tag)]
-        bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
-        bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            -textvariable [itcl::scope _view($tag)]
+        bind $inner.${tag} <KeyPress-Return> \
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -2246,6 +2011,6 @@
     checkbutton $inner.ortho \
         -text "Orthographic Projection" \
-        -variable [itcl::scope _view(-ortho)] \
-        -command [itcl::code $this camera set -ortho] \
+        -variable [itcl::scope _view(ortho)] \
+        -command [itcl::code $this camera set ortho] \
         -font "Arial 9"
     blt::table $inner \
@@ -2254,5 +2019,5 @@
     incr row
 
-    blt::table configure $inner c* -resize none
+    blt::table configure $inner c* r* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -2372,4 +2137,5 @@
     $itk_component(zCutScale) set 100
     $itk_component(zCutScale) configure -state disabled
+    #$itk_component(zCutScale) configure -state disabled
     Rappture::Tooltip::for $itk_component(zCutScale) \
         "@[itcl::code $this Slice tooltip z]"
@@ -2403,5 +2169,5 @@
     set fg [option get $itk_component(hull) font Font]
 
-    set inner [$itk_component(main) insert 0 \
+    set inner [$itk_component(main) insert end \
         -title "Molecule Settings" \
         -icon [Rappture::icon molecule]]
@@ -2412,10 +2178,4 @@
         -variable [itcl::scope _settings(molecule-visible)] \
         -command [itcl::code $this AdjustSetting molecule-visible] \
-        -font "Arial 9"
-
-    checkbutton $inner.outline \
-        -text "Show Outline" \
-        -variable [itcl::scope _settings(molecule-outline)] \
-        -command [itcl::code $this AdjustSetting molecule-outline] \
         -font "Arial 9"
 
@@ -2482,8 +2242,43 @@
         Rappture::Combobox $inner.palette -width 10 -editable no
     }
-    $inner.palette choices insert end [GetColormapList -includeElementDefault]
+    $inner.palette choices insert end \
+        "elementDefault"     "elementDefault"   \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   
+
     $itk_component(moleculepalette) value "elementDefault"
     bind $inner.palette <<Value>> \
         [itcl::code $this AdjustSetting molecule-palette]
+
+    checkbutton $inner.labels -text "Show labels on atoms" \
+        -command [itcl::code $this labels update] \
+        -variable [itcl::scope _settings(molecule-labels)] \
+        -font "Arial 9"
+    Rappture::Tooltip::for $inner.labels \
+        "Display atom symbol and serial number."
+
+    checkbutton $inner.rock -text "Rock molecule back and forth" \
+        -variable [itcl::scope _settings(molecule-rock)] \
+        -font "Arial 9"
+    Rappture::Tooltip::for $inner.rock \
+        "Rotate the object back and forth around the y-axis."
+
+    checkbutton $inner.cell -text "Parallelepiped" \
+        -font "Arial 9"
+    $inner.cell select
 
     label $inner.atomscale_l -text "Atom Scale" -font "Arial 9"
@@ -2526,24 +2321,23 @@
     blt::table $inner \
         0,0 $inner.molecule     -anchor w -pady {1 0} \
-        1,0 $inner.outline      -anchor w -pady {1 0} \
-        2,0 $inner.label        -anchor w -pady {1 0} \
-        3,0 $inner.edges        -anchor w -pady {1 0} \
-        4,0 $inner.rep_l        -anchor w -pady { 2 0 } \
-        5,0 $inner.rep          -fill x    -pady 2 \
-        6,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
-        7,0 $inner.rscale       -fill x    -pady 2 \
-        8,0 $inner.palette_l    -anchor w  -pady 0 \
-        9,0 $inner.palette      -fill x    -padx 2 \
-        10,0 $inner.atomscale_l  -anchor w -pady {3 0} \
-        11,0 $inner.atomscale   -fill x    -padx 2 \
-        12,0 $inner.bondscale_l -anchor w -pady {3 0} \
-        13,0 $inner.bondscale   -fill x   -padx 2 \
-        14,0 $inner.opacity_l   -anchor w -pady {3 0} \
-        15,0 $inner.opacity     -fill x    -padx 2 \
-        16,0 $inner.quality_l   -anchor w -pady {3 0} \
-        17,0 $inner.quality     -fill x    -padx 2
+        1,0 $inner.label        -anchor w -pady {1 0} \
+        2,0 $inner.edges        -anchor w -pady {1 0} \
+        3,0 $inner.rep_l        -anchor w -pady { 2 0 } \
+        4,0 $inner.rep          -fill x    -pady 2 \
+        5,0 $inner.rscale_l     -anchor w -pady { 2 0 } \
+        6,0 $inner.rscale       -fill x    -pady 2 \
+        7,0 $inner.palette_l    -anchor w  -pady 0 \
+        8,0 $inner.palette      -fill x    -padx 2 \
+        9,0 $inner.atomscale_l  -anchor w -pady {3 0} \
+        10,0 $inner.atomscale   -fill x    -padx 2 \
+        11,0 $inner.bondscale_l -anchor w -pady {3 0} \
+        12,0 $inner.bondscale   -fill x   -padx 2 \
+        13,0 $inner.opacity_l   -anchor w -pady {3 0} \
+        14,0 $inner.opacity     -fill x    -padx 2 \
+        15,0 $inner.quality_l   -anchor w -pady {3 0} \
+        16,0 $inner.quality     -fill x    -padx 2
     
     blt::table configure $inner r* -resize none
-    blt::table configure $inner r18 -resize expand
+    blt::table configure $inner r17 -resize expand
 }
 
@@ -2557,13 +2351,13 @@
         }
         "set" {
-            set what [lindex $args 0]
-            set x $_view($what)
+            set who [lindex $args 0]
+            set x $_view($who)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
                 return
             }
-            switch -- $what {
-                "-ortho" {
-                    if {$_view($what)} {
+            switch -- $who {
+                "ortho" {
+                    if {$_view(ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -2571,14 +2365,14 @@
                     }
                 }
-                "-xpan" - "-ypan" {
+                "xpan" - "ypan" {
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "-zoom" {
-                    SendCmd "camera zoom $_view($what)"
+                "zoom" {
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2661,200 +2455,49 @@
         "glyphs" {
             array set settings {
-                -color white
+                -color \#FFFFFF
+                -gscale 1
+                -edges 0
                 -edgecolor black
-                -edges 0
-                -gscale 1
+                -linewidth 1.0
+                -opacity 1.0
+                -wireframe 0
                 -lighting 1
-                -linewidth 1.0
-                -normscale 0
-                -opacity 1.0
-                -orientGlyphs 0
-                -outline 0
-                -ptsize 1.0
-                -quality 1
-                -scaleMode "vcomp"
-                -shape "sphere"
                 -visible 1
-                -wireframe 0
-            }
+            }
+            set shape [$dataobj shape $comp]
             array set settings $style
-            set shape [$dataobj shape $comp]
-            if {$shape != ""} {
-                set settings(-shape) $shape
-            }
-            SendCmd "outline add $tag"
-            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
-            SendCmd "outline visible $settings(-outline) $tag"
-            set _settings(glyphs-outline) $settings(-outline)
-
-            SendCmd "glyphs add $settings(-shape) $tag"
-            SendCmd "glyphs normscale $settings(-normscale) $tag"
+            SendCmd "glyphs add $shape $tag"
+            SendCmd "glyphs normscale 0 $tag"
             SendCmd "glyphs gscale $settings(-gscale) $tag"
             SendCmd "glyphs wireframe $settings(-wireframe) $tag"
             SendCmd "glyphs color [Color2RGB $settings(-color)] $tag"
             #SendCmd "glyphs colormode constant {} $tag"
-            # Omitting field name for gorient and smode commands
-            # defaults to active scalars or vectors depending on mode
-            SendCmd "glyphs gorient $settings(-orientGlyphs) {} $tag"
-            SendCmd "glyphs smode $settings(-scaleMode) {} $tag"
-            SendCmd "glyphs edges $settings(-edges) $tag"
-            SendCmd "glyphs linecolor [Color2RGB $settings(-edgecolor)] $tag"
-            SendCmd "glyphs linewidth $settings(-linewidth) $tag"
-            SendCmd "glyphs ptsize $settings(-ptsize) $tag"
-            SendCmd "glyphs quality $settings(-quality) $tag"
-            SendCmd "glyphs lighting $settings(-lighting) $tag"
+            SendCmd "glyphs gorient 0 {} $tag"
+            SendCmd "glyphs smode vcomp {} $tag"
             SendCmd "glyphs opacity $settings(-opacity) $tag"
-            set _settings(glyphs-opacity) [expr 100.0 * $settings(-opacity)]
             SendCmd "glyphs visible $settings(-visible) $tag"
             set _settings(glyphs-wireframe) $settings(-wireframe)
         }
         "molecule" {
+            SendCmd "molecule add $tag"
+            SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
+            SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
+            SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
+            SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
+            SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
+            set _haveMolecules 1
+        }
+        "polydata" {
             array set settings {
-                -atomscale 0.3
-                -atomsvisible 1
-                -bondscale 0.075
-                -bondstyle "cylinder"
-                -bondsvisible 1
-                -color "elementDefault"
+                -color \#FFFFFF
+                -edges 1
                 -edgecolor black
-                -edges 0
-                -labels 0
-                -lighting 1
                 -linewidth 1.0
                 -opacity 1.0
-                -outline 0
-                -quality 1.0
-                -representation ""
-                -rscale "covalent"
+                -wireframe 0
+                -lighting 1
                 -visible 1
-                -wireframe 0
             }
             array set settings $style
-
-            SendCmd "outline add $tag"
-            SendCmd "outline color [Color2RGB white] $tag"
-            SendCmd "outline visible $settings(-outline) $tag"
-            set _settings(molecule-outline) $settings(-outline)
-
-            SendCmd "molecule add $tag"
-            if {$settings(-representation) != ""} {
-                switch -- $settings(-representation) {
-                    "ballandstick" {
-                        set _settings(molecule-rscale) covalent
-                        set _settings(molecule-atoms-visible) 1
-                        set _settings(molecule-bonds-visible) 1
-                        set _settings(molecule-bondstyle) cylinder
-                        set _settings(molecule-atomscale) 0.3
-                        set _settings(molecule-bondscale) 0.075
-                    }
-                    "balls" - "spheres" {
-                        set _settings(molecule-rscale) covalent
-                        set _settings(molecule-atoms-visible) 1
-                        set _settings(molecule-bonds-visible) 0
-                        set _settings(molecule-bondstyle) cylinder
-                        set _settings(molecule-atomscale) 0.3
-                        set _settings(molecule-bondscale) 0.075
-                    }
-                    "sticks" {
-                        set _settings(molecule-rscale) none
-                        set _settings(molecule-atoms-visible) 1
-                        set _settings(molecule-bonds-visible) 1
-                        set _settings(molecule-bondstyle) cylinder
-                        set _settings(molecule-atomscale) 0.075
-                        set _settings(molecule-bondscale) 0.075
-                    }
-                    "spacefilling" {
-                        set _settings(molecule-rscale) van_der_waals
-                        set _settings(molecule-atoms-visible) 1
-                        set _settings(molecule-bonds-visible) 0
-                        set _settings(molecule-bondstyle) cylinder
-                        set _settings(molecule-atomscale) 1.0
-                        set _settings(molecule-bondscale) 0.075
-                    }
-                    "rods"  {
-                        set _settings(molecule-rscale) none
-                        set _settings(molecule-atoms-visible) 1
-                        set _settings(molecule-bonds-visible) 1
-                        set _settings(molecule-bondstyle) cylinder
-                        set _settings(molecule-atomscale) 0.1
-                        set _settings(molecule-bondscale) 0.1
-                    }
-                    "wireframe" - "lines" {
-                        set _settings(molecule-rscale) none
-                        set _settings(molecule-atoms-visible) 0
-                        set _settings(molecule-bonds-visible) 1
-                        set _settings(molecule-bondstyle) line
-                        set _settings(molecule-atomscale) 1.0
-                        set _settings(molecule-bondscale) 1.0
-                    }
-                    default {
-                        error "unknown representation $value"
-                    }
-                }
-                SendCmd "molecule rscale $_settings(molecule-rscale) $tag"
-                SendCmd "molecule atoms $_settings(molecule-atoms-visible) $tag"
-                SendCmd "molecule bonds $_settings(molecule-bonds-visible) $tag"
-                SendCmd "molecule bstyle $_settings(molecule-bondstyle) $tag"
-                SendCmd "molecule ascale $_settings(molecule-atomscale) $tag"
-                SendCmd "molecule bscale $_settings(molecule-bondscale) $tag"
-                $itk_component(representation) value [$itk_component(representation) label $settings(-representation)]
-                $itk_component(rscale) value [$itk_component(rscale) label $_settings(molecule-rscale)]
-                switch -- $settings(-representation) {
-                    "ballandstick" - "balls" - "spheres" {
-                        $itk_component(rscale) configure -state normal
-                    }
-                    default {
-                        $itk_component(rscale) configure -state disabled
-                    }
-                }
-            } else {
-                SendCmd "molecule rscale $settings(-rscale) $tag"
-                set _settings(molecule-rscale) $settings(-rscale)
-                SendCmd "molecule atoms $settings(-atomsvisible) $tag"
-                set _settings(molecule-atoms-visible) $settings(-atomsvisible)
-                SendCmd "molecule bonds $settings(-bondsvisible) $tag"
-                set _settings(molecule-bonds-visible) $settings(-bondsvisible)
-                SendCmd "molecule bstyle $settings(-bondstyle) $tag"
-                set _settings(molecule-bondstyle) $settings(-bondstyle)
-                SendCmd "molecule ascale $settings(-atomscale) $tag"
-                set _settings(molecule-atomscale) $settings(-atomscale)
-                SendCmd "molecule bscale $settings(-bondscale) $tag"
-                set _settings(molecule-bondscale) $settings(-bondscale)
-            }
-            SendCmd "molecule labels $settings(-labels) $tag"
-            set _settings(molecule-labels) $settings(-labels)
-            SendCmd "molecule linecolor [Color2RGB $settings(-edgecolor)] $tag"
-            SendCmd "molecule linewidth $settings(-linewidth) $tag"
-            SendCmd "molecule edges $settings(-edges) $tag"
-            set _settings(molecule-edges) $settings(-edges)
-            SendCmd "molecule lighting $settings(-lighting) $tag"
-            set _settings(molecule-lighting) $settings(-lighting)
-            SendCmd "molecule aquality $settings(-quality) $tag"
-            SendCmd "molecule bquality $settings(-quality) $tag"
-            set _settings(molecule-quality) $settings(-quality)
-            SendCmd "molecule visible $settings(-visible) $tag"
-            set _settings(molecule-visible) $settings(-visible)
-            set _haveMolecules 1
-        }
-        "polydata" {
-            array set settings {
-                -cloudstyle "mesh"
-                -color white
-                -edgecolor black
-                -edges 1
-                -lighting 1
-                -linewidth 1.0
-                -opacity 1.0
-                -outline 0
-                -visible 1
-                -wireframe 0
-            }
-            array set settings $style
-
-            SendCmd "outline add $tag"
-            SendCmd "outline color [Color2RGB $settings(-color)] $tag"
-            SendCmd "outline visible $settings(-outline) $tag"
-            set _settings(polydata-outline) $settings(-outline)
-
             SendCmd "polydata add $tag"
             SendCmd "polydata visible $settings(-visible) $tag"
@@ -2862,5 +2505,4 @@
             SendCmd "polydata edges $settings(-edges) $tag"
             set _settings(polydata-edges) $settings(-edges)
-            SendCmd "polydata cloudstyle $settings(-cloudstyle) $tag"
             SendCmd "polydata color [Color2RGB $settings(-color)] $tag"
             #SendCmd "polydata colormode constant {} $tag"
@@ -3023,4 +2665,5 @@
         "move" {
             set axis [lindex $args 0]
+            set oldval $_axis(${axis}position)
             set newval [lindex $args 1]
             if {[llength $args] != 2} {
@@ -3050,14 +2693,14 @@
         bottom "0.707107 0.707107 0 0"
     }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
+    foreach name { qw qx qy qz } value $positions($side) {
         set _view($name) $value
     } 
-    set q [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     $_arcball quaternion $q
     SendCmd "camera orient $q"
     SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
+    set _view(xpan) 0
+    set _view(ypan) 0
+    set _view(zoom) 1.0
 }
 
Index: branches/1.3/gui/scripts/vtkvolumeviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 4828)
+++ branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 4848)
@@ -1,5 +1,6 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
-# ----------------------------------------------------------------------
-#  COMPONENT: vtkvolumeviewer - Vtk volume viewer
+
+# ----------------------------------------------------------------------
+#  COMPONENT: VtkVolumeViewer - Vtk volume viewer
 #
 #  It connects to the Vtk server running on a rendering farm,
@@ -7,5 +8,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
+#  Copyright (c) 2004-2012  HUBzero Foundation, LLC
 #
 #  See the file "license.terms" for information on usage and
@@ -62,11 +63,22 @@
     public method scale {args}
 
-    private method GetDatasetsWithComponent { cname } 
-
-    private variable _volcomponents   ; # Array of components found 
-    private variable _componentsList   ; # List of component names
+    protected method Connect {}
+    protected method CurrentDatasets {args}
+    protected method Disconnect {}
+    protected method DoResize {}
+    protected method DoReseed {}
+    protected method DoRotate {}
+    protected method AdjustSetting {what {value ""}}
+    protected method InitSettings { args  }
+    protected method Pan {option x y}
+    protected method Pick {x y}
+    protected method Rebuild {}
+    protected method ReceiveDataset { args }
+    protected method ReceiveImage { args }
+    protected method ReceiveLegend { colormap title vmin vmax size }
+    protected method Rotate {option x y}
+    protected method Zoom {option}
 
     # The following methods are only used by this class.
-    private method AdjustSetting {what {value ""}}
     private method BuildAxisTab {}
     private method BuildCameraTab {}
@@ -74,46 +86,24 @@
     private method BuildCutplaneTab {}
     private method BuildDownloadPopup { widget command } 
-    private method BuildViewTab {}
     private method BuildVolumeTab {}
     private method DrawLegend {}
-    private method ChangeColormap { dataobj comp color }
     private method Combo { option }
-    private method Connect {}
-    private method CurrentDatasets {args}
-    private method Disconnect {}
-    private method DoResize {}
-    private method DoRotate {}
     private method EnterLegend { x y } 
     private method EventuallyResize { w h } 
-    private method EventuallyRequestLegend {} 
+    private method EventuallyReseed { numPoints } 
     private method EventuallyRotate { q } 
     private method EventuallySetCutplane { axis args } 
     private method GetImage { args } 
     private method GetVtkData { args } 
-    private method InitSettings { args  }
     private method IsValidObject { dataobj } 
     private method LeaveLegend {}
-    private method MotionLegend { x y }
-    private method Pan {option x y}
+    private method MotionLegend { x y } 
     private method PanCamera {}
-    private method Pick {x y}
-    private method QuaternionToView { q } { 
-        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
-    }
-    private method Rebuild {}
-    private method ReceiveDataset { args }
-    private method ReceiveImage { args }
-    private method ReceiveLegend { colormap title vmin vmax size }
     private method RequestLegend {}
     private method SetColormap { dataobj comp }
-    private method Rotate {option x y}
+    private method ChangeColormap { dataobj comp color }
     private method SetLegendTip { x y }
     private method SetObjectStyle { dataobj comp } 
-    private method SetOrientation { side }
     private method Slice {option args} 
-    private method ViewToQuaternion {} { 
-        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
-    }
-    private method Zoom {option}
 
     private variable _arcball ""
@@ -139,4 +129,5 @@
     private variable _start 0
     private variable _title ""
+    private variable _seeds
 
     common _downloadPopup;              # download options from popup
@@ -145,4 +136,5 @@
     private variable _height 0
     private variable _resizePending 0
+    private variable _reseedPending 0
     private variable _rotatePending 0
     private variable _cutplanePending 0
@@ -151,7 +143,5 @@
     private variable _curFldName ""
     private variable _curFldLabel ""
-    private variable _colorMode "scalar"; #  Mode of colormap (vmag or scalar)
-    private variable _cutplaneCmd "cutplane"
-    private variable _allowMultiComponent 0
+    private variable _colorMode "vmag";#  Mode of colormap (vmag or scalar)
 }
 
@@ -168,6 +158,4 @@
     set _serverType "vtkvis"
 
-    EnableWaitDialog 900
-
     # Rebuild event
     $_dispatcher register !rebuild
@@ -178,4 +166,8 @@
     $_dispatcher dispatch $this !resize "[itcl::code $this DoResize]; list"
 
+    # Reseed event
+    $_dispatcher register !reseed
+    $_dispatcher dispatch $this !reseed "[itcl::code $this DoReseed]; list"
+
     # Rotate event
     $_dispatcher register !rotate
@@ -189,15 +181,15 @@
     $_dispatcher register !xcutplane
     $_dispatcher dispatch $this !xcutplane \
-        "[itcl::code $this AdjustSetting -xcutplaneposition]; list"
+        "[itcl::code $this AdjustSetting cutplane-xposition]; list"
 
     # Y-Cutplane event
     $_dispatcher register !ycutplane
     $_dispatcher dispatch $this !ycutplane \
-        "[itcl::code $this AdjustSetting -ycutplaneposition]; list"
+        "[itcl::code $this AdjustSetting cutplane-yposition]; list"
 
     # Z-Cutplane event
     $_dispatcher register !zcutplane
     $_dispatcher dispatch $this !zcutplane \
-        "[itcl::code $this AdjustSetting -zcutplaneposition]; list"
+        "[itcl::code $this AdjustSetting cutplane-zposition]; list"
 
     #
@@ -210,42 +202,40 @@
     # Initialize the view to some default parameters.
     array set _view {
-        -ortho           0
-        -qw              0.853553
-        -qx              -0.353553
-        -qy              0.353553
-        -qz              0.146447
-        -xpan            0
-        -ypan            0
-        -zoom            1.0 
+        qw              0.853553
+        qx              -0.353553
+        qy              0.353553
+        qz              0.146447
+        zoom            1.0 
+        xpan            0
+        ypan            0
+        ortho           0
     }
     set _arcball [blt::arcball create 100 100]
-    $_arcball quaternion [ViewToQuaternion]
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    $_arcball quaternion $q
 
     array set _settings {
-        -axesvisible                    1
-        -axisflymode                    static
-        -axislabels                     1
-        -axisminorticks                 1
-        -background                     black
-        -color                          BCGYR
-        -cutplanelighting               1
-        -cutplaneopacity                100
-        -cutplanesvisible               0
-        -legendvisible                  1
-        -volumelighting                 1
-        -volumematerial                 80
-        -volumeopacity                  50
-        -volumeoutline                  0
-        -volumequality                  80
-        -volumevisible                  1
-        -xcutplaneposition              50
-        -xcutplanevisible               1
-        -xgrid                          0
-        -ycutplaneposition              50
-        -ycutplanevisible               1
-        -ygrid                          0
-        -zcutplaneposition              50
-        -zcutplanevisible               1
-        -zgrid                          0
+        axis-xgrid              0
+        axis-ygrid              0
+        axis-zgrid              0
+        axesVisible             1
+        axisLabels              1
+        cutplaneEdges           0
+        cutplane-xvisible       1
+        cutplane-yvisible       1
+        cutplane-zvisible       1
+        cutplane-xposition      50
+        cutplane-yposition      50
+        cutplane-zposition      50
+        cutplaneVisible         0
+        cutplaneLighting        1
+        cutplaneWireframe       0
+        cutplane-opacity        100
+        volumeLighting          1
+        volume-material         80
+        volume-opacity          40
+        volume-quality          50
+        volumeVisible           1
+        legendVisible           1
     }
 
@@ -326,6 +316,6 @@
             -onimage [Rappture::icon volume-on] \
             -offimage [Rappture::icon volume-off] \
-            -variable [itcl::scope _settings(-volumevisible)] \
-            -command [itcl::code $this AdjustSetting -volumevisible] 
+            -variable [itcl::scope _settings(volumeVisible)] \
+            -command [itcl::code $this AdjustSetting volumeVisible] 
     }
     $itk_component(volume) select
@@ -338,6 +328,6 @@
             -onimage [Rappture::icon cutbutton] \
             -offimage [Rappture::icon cutbutton] \
-            -variable [itcl::scope _settings(-cutplanesvisible)] \
-            -command [itcl::code $this AdjustSetting -cutplanesvisible] 
+            -variable [itcl::scope _settings(cutplaneVisible)] \
+            -command [itcl::code $this AdjustSetting cutplaneVisible] 
     }
     Rappture::Tooltip::for $itk_component(cutplane) \
@@ -347,5 +337,4 @@
 
     if { [catch {
-        BuildViewTab
         BuildVolumeTab
         BuildCutplaneTab
@@ -355,6 +344,6 @@
         puts stderr errs=$errs
     }
-
     # Legend
+
     set _image(legend) [image create photo]
     itk_component add legend {
@@ -382,5 +371,11 @@
     bind $itk_component(view) <ButtonRelease-1> \
         [itcl::code $this Rotate release %x %y]
-
+    bind $itk_component(view) <Configure> \
+        [itcl::code $this EventuallyResize %w %h]
+
+    if 0 {
+    bind $itk_component(view) <Configure> \
+        [itcl::code $this EventuallyResize %w %h]
+    }
     # Bindings for panning via mouse
     bind $itk_component(view) <ButtonPress-2> \
@@ -430,4 +425,5 @@
     eval itk_initialize $args
     Connect
+    update
 }
 
@@ -457,5 +453,6 @@
 
 itcl::body Rappture::VtkVolumeViewer::DoRotate {} {
-    SendCmd "camera orient [ViewToQuaternion]" 
+    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    SendCmd "camera orient $q" 
     set _rotatePending 0
 }
@@ -471,8 +468,9 @@
 }
 
-itcl::body Rappture::VtkVolumeViewer::EventuallyRequestLegend {} {
-    if { !$_legendPending } {
-        set _legendPending 1
-        $_dispatcher event -idle !legend
+itcl::body Rappture::VtkVolumeViewer::EventuallyReseed { numPoints } {
+    set _numSeeds $numPoints
+    if { !$_reseedPending } {
+        set _reseedPending 1
+        $_dispatcher event -after 600 !reseed
     }
 }
@@ -481,5 +479,5 @@
 
 itcl::body Rappture::VtkVolumeViewer::EventuallyRotate { q } {
-    QuaternionToView $q
+    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -504,7 +502,4 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::VtkVolumeViewer::add {dataobj {settings ""}} {
-    if { ![IsValidObject $dataobj] } {
-        return;                         # Ignore invalid objects.
-    }
     array set params {
         -color auto
@@ -649,13 +644,5 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::VtkVolumeViewer::scale {args} {
-    array unset _limits
-    array unset _volcomponents
-    set _componentsList ""
-
     foreach dataobj $args {
-        if { ![$dataobj isvalid] } {
-            continue;                     # Object doesn't contain valid data.
-        }
-        # Determine limits for each axis.
         foreach axis { x y z } {
             set lim [$dataobj limits $axis]
@@ -674,5 +661,4 @@
             set _limits($axis) [list $amin $amax]
         }
-        # Determine limits for each field.
         foreach { fname lim } [$dataobj fieldlimits] {
             if { ![info exists _limits($fname)] } {
@@ -689,26 +675,4 @@
             }
             set _limits($fname) [list $fmin $fmax]
-        }
-        # Get limits for each component.
-        foreach cname [$dataobj components] {
-            if { ![info exists _volcomponents($cname)] } {
-                lappend _componentsList $cname
-            }
-            lappend _volcomponents($cname) $dataobj-$cname
-            array unset limits
-            array set limits [$dataobj valueLimits $cname]
-            if { ![info exists _limits($cname)] } {
-                set _limits($cname) $limits(v)
-                continue
-            }
-            foreach {min max} $limits(v) break
-            foreach {vmin vmax} $_limits($cname) break
-            if { $vmin > $min } {
-                set vmin $min
-            }
-            if { $vmax < $max } {
-                set vmax $max
-            }
-            set _limits($cname) [list $vmin $vmax]
         }
     }
@@ -787,5 +751,5 @@
         if { $_reportClientInfo }  {
             # Tell the server the viewer, hub, user and session.
-            # Do this immediately on connect before buffering any commands
+            # Do this immediately on connect before buffing any commands
             global env
 
@@ -845,4 +809,5 @@
     $_dispatcher cancel !rebuild
     $_dispatcher cancel !resize
+    $_dispatcher cancel !reseed
     $_dispatcher cancel !rotate
     $_dispatcher cancel !xcutplane
@@ -855,12 +820,7 @@
     array unset _data 
     array unset _colormaps 
+    array unset _seeds 
     array unset _dataset2style 
     array unset _obj2datasets 
-
-    set _resizePending 0
-    set _rotatePending 0
-    set _cutplanePending 0
-    set _legendPending 0
-    set _reset 1
 }
 
@@ -883,11 +843,12 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"]
-            fconfigure $f -encoding binary
-            puts -nonewline $f $bytes
+            set f [open "last.ppm" "w"] 
+            puts $f $bytes
             close $f
         }
         $_image(plot) configure -data $bytes
-        #puts stderr "[clock format [clock seconds]]: received image [image width $_image(plot)]x[image height $_image(plot)] image>"
+        set time [clock seconds]
+        set date [clock format $time]
+        #puts stderr "$date: received image [image width $_image(plot)]x[image height $_image(plot)] image>"        
         if { $_start > 0 } {
             set finish [clock clicks -milliseconds]
@@ -954,7 +915,7 @@
 # ----------------------------------------------------------------------
 itcl::body Rappture::VtkVolumeViewer::Rebuild {} {
+    update
     set w [winfo width $itk_component(view)]
     set h [winfo height $itk_component(view)]
-
     if { $w < 2 || $h < 2 } {
         $_dispatcher event -idle !rebuild
@@ -969,16 +930,15 @@
     set _legendPending 1
 
-    if { $_width != $w || $_height != $h || $_reset } {
+    if { $_reset } {
         set _width $w
         set _height $h
         $_arcball resize $w $h
         DoResize
-    }
-    if { $_reset } {
         #
         # Reset the camera and other view parameters
         #
-        $_arcball quaternion [ViewToQuaternion]
-        if {$_view(-ortho)} {
+        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+        $_arcball quaternion $q
+        if {$_view(ortho)} {
             SendCmd "camera mode ortho"
         } else {
@@ -986,13 +946,11 @@
         }
         DoRotate
+        InitSettings axis-xgrid axis-ygrid axis-zgrid axisFlyMode \
+            axesVisible axisLabels
         PanCamera
-        set _first ""
-        InitSettings -background \
-            -xgrid -ygrid -zgrid -axisflymode \
-            -axesvisible -axislabels -axisminorticks
-        StopBufferingCommands
-        SendCmd "imgflush"
-        StartBufferingCommands
-     }
+    }
+    set _first ""
+
+    SendCmd "imgflush"
     set _first ""
 
@@ -1007,10 +965,4 @@
             if { ![info exists _datasets($tag)] } {
                 set bytes [$dataobj vtkdata $comp]
-		if 0 { 
-                    set f [open /tmp/vtkvolume.vtk "w"]
-                    fconfigure $f -translation binary -encoding binary
-                    puts -nonewline $f $bytes
-                    close $f
-		}
                 set length [string length $bytes]
                 if { $_reportClientInfo }  {
@@ -1024,7 +976,7 @@
                     lappend info "dataset_size"  $length
                     lappend info "dataset_tag"   $tag
-                    SendCmd "clientinfo [list $info]"
-                }
-                SendCmd "dataset add $tag data follows $length"
+                    SendCmd [list "clientinfo" $info]
+                }
+                append _outbuf "dataset add $tag data follows $length\n"
                 append _outbuf $bytes
                 set _datasets($tag) 1
@@ -1033,5 +985,5 @@
             lappend _obj2datasets($dataobj) $tag
             if { [info exists _obj2ovride($dataobj-raise)] } {
-                SendCmd "volume visible 1 $tag"
+                SendCmd "dataset visible 1 $tag"
             }
             break
@@ -1047,9 +999,9 @@
             set label [$_first hints ${axis}label]
             if { $label != "" } {
-                SendCmd [list axis name $axis $label]
+                SendCmd "axis name $axis $label"
             }
             set units [$_first hints ${axis}units]
             if { $units != "" } {
-                SendCmd [list axis units $axis $units]
+                SendCmd "axis units $axis $units"
             }
         }
@@ -1066,5 +1018,5 @@
                     [$_first fieldinfo $fname] break
                 # Only scalar fields are valid
-                if {$_allowMultiComponent || $components == 1} {
+                if {$components == 1} {
                     $itk_component(field) choices insert end "$fname" "$label"
                     $itk_component(fieldmenu) add radiobutton -label "$label" \
@@ -1086,12 +1038,11 @@
     }
 
-    InitSettings -color \
-        -volumematerial \
-        -volumelighting -volumeopacity -volumequality -volumeoutline -volumevisible \
-        -cutplanesvisible \
-        -xcutplaneposition -ycutplaneposition -zcutplaneposition \
-        -xcutplanevisible -ycutplanevisible -zcutplanevisible
+    InitSettings volume-palette volume-material volume-quality volumeVisible \
+        cutplaneVisible \
+        cutplane-xposition cutplane-yposition cutplane-zposition \
+        cutplane-xvisible cutplane-yvisible cutplane-zvisible
 
     if { $_reset } {
+        InitSettings volumeLighting
         Zoom reset
         set _reset 0
@@ -1160,20 +1111,20 @@
     switch -- $option {
         "in" {
-            set _view(-zoom) [expr {$_view(-zoom)*1.25}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*1.25}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "out" {
-            set _view(-zoom) [expr {$_view(-zoom)*0.8}]
-            SendCmd "camera zoom $_view(-zoom)"
+            set _view(zoom) [expr {$_view(zoom)*0.8}]
+            SendCmd "camera zoom $_view(zoom)"
         }
         "reset" {
             array set _view {
-                -qw      0.853553
-                -qx      -0.353553
-                -qy      0.353553
-                -qz      0.146447
-                -xpan    0
-                -ypan    0
-                -zoom    1.0
+                qw      0.853553
+                qx      -0.353553
+                qy      0.353553
+                qz      0.146447
+                zoom    1.0
+                xpan   0
+                ypan   0
             }
             if { $_first != "" } {
@@ -1183,5 +1134,6 @@
                 }
             }
-            $_arcball quaternion [ViewToQuaternion]
+            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+            $_arcball quaternion $q
             DoRotate
             SendCmd "camera reset"
@@ -1191,8 +1143,9 @@
 
 itcl::body Rappture::VtkVolumeViewer::PanCamera {} {
-    set x $_view(-xpan)
-    set y $_view(-ypan)
+    set x $_view(xpan)
+    set y $_view(ypan)
     SendCmd "camera pan $x $y"
 }
+
 
 # ----------------------------------------------------------------------
@@ -1269,6 +1222,6 @@
             set x [expr $x / double($w)]
             set y [expr $y / double($h)]
-            set _view(-xpan) [expr $_view(-xpan) + $x]
-            set _view(-ypan) [expr $_view(-ypan) + $y]
+            set _view(xpan) [expr $_view(xpan) + $x]
+            set _view(ypan) [expr $_view(ypan) + $y]
             PanCamera
             return
@@ -1292,6 +1245,6 @@
             set _click(x) $x
             set _click(y) $y
-            set _view(-xpan) [expr $_view(-xpan) - $dx]
-            set _view(-ypan) [expr $_view(-ypan) - $dy]
+            set _view(xpan) [expr $_view(xpan) - $dx]
+            set _view(ypan) [expr $_view(ypan) - $dy]
             PanCamera
         }
@@ -1315,7 +1268,7 @@
 itcl::body Rappture::VtkVolumeViewer::InitSettings { args } {
     foreach spec $args {
-        if { [info exists _settings($_first${spec})] } {
+        if { [info exists _settings($_first-$spec)] } {
             # Reset global setting with dataobj specific setting
-            set _settings($spec) $_settings($_first${spec})
+            set _settings($spec) $_settings($_first-$spec)
         }
         AdjustSetting $spec
@@ -1335,31 +1288,8 @@
     }
     switch -- $what {
-        "-background" {
-            set bgcolor [$itk_component(background) value]
-            set _settings($what) $bgcolor
-	    array set fgcolors {
-		"black" "white"
-		"white" "black"
-		"grey"	"black"
-	    }
-            configure -plotbackground $bgcolor \
-		-plotforeground $fgcolors($bgcolor)
-	    $itk_component(view) delete "legend"
-	    DrawLegend
-        }
-        "-volumeoutline" {
-            set bool $_settings($what)
-            SendCmd "outline visible 0"
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "outline visible $bool $tag"
-            }
-        }
-        "-legendvisible" {
-            set bool $_settings($what)
-        }
-        "-volumevisible" {
-            set bool $_settings($what)
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "volume visible $bool $tag"
+        "volumeVisible" {
+            set bool $_settings(volumeVisible)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "volume visible $bool $dataset"
             }
             if { $bool } {
@@ -1371,53 +1301,42 @@
             }
         }
-        "-volumematerial" {
-            set val $_settings($what)
+        "volume-material" {
+            set val $_settings(volume-material)
             set diffuse [expr {0.01*$val}]
             set specular [expr {0.01*$val}]
             #set power [expr {sqrt(160*$val+1.0)}]
             set power [expr {$val+1.0}]
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "volume shading diffuse $diffuse $tag"
-                SendCmd "volume shading specular $specular $power $tag"
-            }
-        }
-        "-volumelighting" {
-            set bool $_settings($what)
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "volume lighting $bool $tag"
-            }
-        }
-        "-volumeopacity" {
-            set val $_settings($what)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "volume shading diffuse $diffuse $dataset"
+                SendCmd "volume shading specular $specular $power $dataset"
+            }
+        }
+        "volumeLighting" {
+            set bool $_settings(volumeLighting)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "volume lighting $bool $dataset"
+            }
+        }
+        "volume-quality" {
+            set val $_settings(volume-quality)
             set val [expr {0.01*$val}]
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "volume opacity $val $tag"
-            }
-        }
-        "-volumequality" {
-            set val $_settings($what)
-            set val [expr {0.01*$val}]
-            foreach tag [CurrentDatasets -visible] {
-                SendCmd "volume quality $val $tag"
-            }
-        }
-        "-axesvisible" {
-            set bool $_settings($what)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "volume quality $val $dataset"
+            }
+        }
+        "axesVisible" {
+            set bool $_settings(axesVisible)
             SendCmd "axis visible all $bool"
         }
-        "-axislabels" {
-            set bool $_settings($what)
+        "axisLabels" {
+            set bool $_settings(axisLabels)
             SendCmd "axis labels all $bool"
         }
-        "-axisminorticks" {
-            set bool $_settings($what)
-            SendCmd "axis minticks all $bool"
-        }
-        "-xgrid" - "-ygrid" - "-zgrid" {
-            set axis [string range $what 1 1]
+        "axis-xgrid" - "axis-ygrid" - "axis-zgrid" {
+            set axis [string range $what 5 5]
             set bool $_settings($what)
             SendCmd "axis grid $axis $bool"
         }
-        "-axisflymode" {
+        "axisFlyMode" {
             set mode [$itk_component(axismode) value]
             set mode [$itk_component(axismode) translate $mode]
@@ -1425,36 +1344,37 @@
             SendCmd "axis flymode $mode"
         }
-        "-cutplanesvisible" {
+        "cutplaneEdges" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "$_cutplaneCmd visible $bool $dataset"
-            }
-        }
-        "-cutplanelighting" {
+                SendCmd "cutplane edges $bool $dataset"
+            }
+        }
+        "cutplaneVisible" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                if {$_cutplaneCmd != "imgcutplane"} {
-                    SendCmd "$_cutplaneCmd lighting $bool $dataset"
-                } else {
-                    if {$bool} {
-                        set ambient 0.0
-                        set diffuse 1.0
-                    } else {
-                        set ambient 1.0
-                        set diffuse 0.0
-                    }
-                    SendCmd "imgcutplane material $ambient $diffuse $dataset"
-                }
-            }
-        }
-        "-cutplaneopacity" {
+                SendCmd "cutplane visible $bool $dataset"
+            }
+        }
+        "cutplaneWireframe" {
+            set bool $_settings($what)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "cutplane wireframe $bool $dataset"
+            }
+        }
+        "cutplaneLighting" {
+            set bool $_settings($what)
+            foreach dataset [CurrentDatasets -visible] {
+                SendCmd "cutplane lighting $bool $dataset"
+            }
+        }
+        "cutplane-opacity" {
             set val $_settings($what)
             set sval [expr { 0.01 * double($val) }]
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "$_cutplaneCmd opacity $sval $dataset"
-            }
-        }
-        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
-            set axis [string range $what 1 1]
+                SendCmd "cutplane opacity $sval $dataset"
+            }
+        }
+        "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
+            set axis [string range $what 9 9]
             set bool $_settings($what)
             if { $bool } {
@@ -1466,39 +1386,44 @@
             }
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
-            }
-        }
-        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
-            set axis [string range $what 1 1]
+                SendCmd "cutplane axis $axis $bool $dataset"
+            }
+        }
+        "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
+            set axis [string range $what 9 9]
             set pos [expr $_settings($what) * 0.01]
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
+                SendCmd "cutplane slice ${axis} ${pos} $dataset"
             }
             set _cutplanePending 0
         }
-        "-color" {
-            set color [$itk_component(colormap) value]
-            set _settings($what) $color
+        "volume-palette" {
+            set palette [$itk_component(palette) value]
+            set _settings(volume-palette) $palette
             foreach dataset [CurrentDatasets -visible $_first] {
                 foreach {dataobj comp} [split $dataset -] break
-                ChangeColormap $dataobj $comp $color
+                ChangeColormap $dataobj $comp $palette
             }
             set _legendPending 1
         }
-        "-field" {
+        "volume-palette" {
+            set palette [$itk_component(palette) value]
+            set _settings(volume-palette) $palette
+            foreach dataset [CurrentDatasets -visible $_first] {
+                foreach {dataobj comp} [split $dataset -] break
+                ChangeColormap $dataobj $comp $palette
+            }
+            set _legendPending 1
+        }
+        "field" {
             set label [$itk_component(field) value]
             set fname [$itk_component(field) translate $label]
-            set _settings($what) $fname
+            set _settings(field) $fname
             if { [info exists _fields($fname)] } {
                 foreach { label units components } $_fields($fname) break
-                if { !$_allowMultiComponent && $components > 1 } {
+                if { $components > 1 } {
                     puts stderr "Can't use a vector field in a volume"
                     return
                 } else {
-                    if { $components > 1 } {
-                        set _colorMode vmag
-                    } else {
-                        set _colorMode scalar
-                    }
+                    set _colorMode scalar
                 }
                 set _curFldName $fname
@@ -1509,6 +1434,6 @@
             }
             foreach dataset [CurrentDatasets -visible $_first] {
-                #SendCmd "$_cutplaneCmd colormode $_colorMode $_curFldName $dataset"
-                SendCmd "dataset scalar $_curFldName $dataset"
+                #SendCmd "volume colormode $_colorMode ${fname} $dataset"
+                SendCmd "cutplane colormode $_colorMode ${fname} $dataset"
             }
             SendCmd "camera reset"
@@ -1542,6 +1467,5 @@
         if { [info exists _dataset2style($dataset)] } {
             SendCmdNoWait \
-                "legend2 $_dataset2style($dataset) $w $h"
-                #"legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
+                "legend $_dataset2style($dataset) $_colorMode $_curFldName {} $w $h 0"
             break;
         }
@@ -1570,4 +1494,5 @@
         -color BCGYR
         -levels 6
+        -opacity 1.0
     }
     set tag $dataobj-$comp
@@ -1586,5 +1511,5 @@
     array set style $_style($tag)
 
-    set name "$style(-color):$style(-levels)"
+    set name "$style(-color):$style(-levels):$style(-opacity)"
     if { ![info exists _colormaps($name)] } {
         BuildColormap $name [array get style]
@@ -1594,5 +1519,5 @@
          $_dataset2style($tag) != $name } {
         SendCmd "volume colormap $name $tag"
-        SendCmd "$_cutplaneCmd colormap $name-opaque $tag"
+        SendCmd "cutplane colormap $name-opaque $tag"
         set _dataset2style($tag) $name
     }
@@ -1608,5 +1533,8 @@
         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     }
-    set max 1.0
+    if { ![info exists _settings(volume-opacity)] } {
+        set _settings(volume-opacity) $style(-opacity)
+    }
+    set max $_settings(volume-opacity)
 
     set opaqueWmap "0.0 1.0 1.0 1.0"
@@ -1623,8 +1551,6 @@
 itcl::configbody Rappture::VtkVolumeViewer::plotbackground {
     if { [isconnected] } {
-        set color $itk_option(-plotbackground)
-        set rgb [Color2RGB $color]
-        SendCmd "screen bgcolor $rgb"
-        $itk_component(legend) configure -background $color
+        foreach {r g b} [Color2RGB $itk_option(-plotbackground)] break
+        SendCmd "screen bgcolor $r $g $b"
     }
 }
@@ -1635,75 +1561,14 @@
 itcl::configbody Rappture::VtkVolumeViewer::plotforeground {
     if { [isconnected] } {
-        set color $itk_option(-plotforeground)
-        set rgb [Color2RGB $color]
-        SendCmd "axis color all $rgb"
-        SendCmd "outline color $rgb"
-        SendCmd "$_cutplaneCmd color $rgb"
-        $itk_component(legend) itemconfigure labels -fill $color 
-        $itk_component(legend) itemconfigure limits -fill $color 
-    }
-}
-
-itcl::body Rappture::VtkVolumeViewer::BuildViewTab {} {
+        foreach {r g b} [Color2RGB $itk_option(-plotforeground)] break
+        #fix this!
+        #SendCmd "color background $r $g $b"
+    }
+}
+
+itcl::body Rappture::VtkVolumeViewer::BuildVolumeTab {} {
+
     set fg [option get $itk_component(hull) font Font]
     #set bfg [option get $itk_component(hull) boldFont Font]
-
-    set inner [$itk_component(main) insert end \
-        -title "View Settings" \
-        -icon [Rappture::icon wrench]]
-    $inner configure -borderwidth 4
-
-    checkbutton $inner.axes \
-        -text "Axes" \
-        -variable [itcl::scope _settings(-axesvisible)] \
-        -command [itcl::code $this AdjustSetting -axesvisible] \
-        -font "Arial 9"
-
-    checkbutton $inner.outline \
-        -text "Outline" \
-        -variable [itcl::scope _settings(-volumeoutline)] \
-        -command [itcl::code $this AdjustSetting -volumeoutline] \
-        -font "Arial 9"
-
-    checkbutton $inner.legend \
-        -text "Legend" \
-        -variable [itcl::scope _settings(-legendvisible)] \
-        -command [itcl::code $this AdjustSetting -legendvisible] \
-        -font "Arial 9"
-
-    checkbutton $inner.volume \
-        -text "Volume" \
-        -variable [itcl::scope _settings(-volumevisible)] \
-        -command [itcl::code $this AdjustSetting -volumevisible] \
-        -font "Arial 9"
-
-    label $inner.background_l -text "Background" -font "Arial 9" 
-    itk_component add background {
-        Rappture::Combobox $inner.background -width 10 -editable no
-    }
-    $inner.background choices insert end \
-        "black"              "black"            \
-        "white"              "white"            \
-        "grey"               "grey"             
-
-    $itk_component(background) value $_settings(-background)
-    bind $inner.background <<Value>> \
-        [itcl::code $this AdjustSetting -background]
-
-    blt::table $inner \
-        0,0 $inner.axes  -cspan 2 -anchor w \
-        1,0 $inner.outline  -cspan 2 -anchor w \
-        2,0 $inner.volume  -cspan 2 -anchor w \
-        3,0 $inner.legend  -cspan 2 -anchor w \
-        4,0 $inner.background_l       -anchor e -pady 2 \
-        4,1 $inner.background                   -fill x \
-
-    blt::table configure $inner r* -resize none
-    blt::table configure $inner r5 -resize expand
-}
-
-itcl::body Rappture::VtkVolumeViewer::BuildVolumeTab {} {
-    set font [option get $itk_component(hull) font Font]
-    #set bfont [option get $itk_component(hull) boldFont Font]
 
     set inner [$itk_component(main) insert end \
@@ -1712,70 +1577,92 @@
     $inner configure -borderwidth 4
 
-    checkbutton $inner.visibility \
-        -text "Visible" \
-        -font $font \
-        -variable [itcl::scope _settings(-volumevisible)] \
-        -command [itcl::code $this AdjustSetting -volumevisible]
+    checkbutton $inner.volume \
+        -text "Show Volume" \
+        -variable [itcl::scope _settings(volumeVisible)] \
+        -command [itcl::code $this AdjustSetting volumeVisible] \
+        -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -font $font \
-        -variable [itcl::scope _settings(-volumelighting)] \
-        -command [itcl::code $this AdjustSetting -volumelighting]
-
-    label $inner.dim_l -text "Dim" -font $font
+        -variable [itcl::scope _settings(volumeLighting)] \
+        -command [itcl::code $this AdjustSetting volumeLighting] \
+        -font "Arial 9"
+
+    label $inner.dim_l -text "Dim" -font "Arial 9"
     ::scale $inner.material -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-volumematerial)] \
-        -showvalue off -command [itcl::code $this AdjustSetting -volumematerial]
-    label $inner.bright_l -text "Bright" -font $font
-
-    label $inner.opacity_l -text "Opacity" -font $font
+        -variable [itcl::scope _settings(volume-material)] \
+        -width 10 \
+        -showvalue off -command [itcl::code $this AdjustSetting volume-material]
+    label $inner.bright_l -text "Bright" -font "Arial 9"
+
+    label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-volumeopacity)] \
+        -variable [itcl::scope _settings(volume-opacity)] \
+        -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -volumeopacity]
-
-    label $inner.quality_l -text "Quality" -font $font
+        -command [itcl::code $this AdjustSetting volume-opacity]
+
+    label $inner.quality_l -text "Quality" -font "Arial 9"
     ::scale $inner.quality -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-volumequality)] \
-        -showvalue off \
-        -command [itcl::code $this AdjustSetting -volumequality]
-
-    label $inner.field_l -text "Field" -font $font
+        -variable [itcl::scope _settings(volume-quality)] \
+        -width 10 \
+        -showvalue off -command [itcl::code $this AdjustSetting volume-quality]
+
+    itk_component add field_l {
+        label $inner.field_l -text "Field" -font "Arial 9" 
+    } {
+        ignore -font
+    }
     itk_component add field {
-        Rappture::Combobox $inner.field -editable no
+        Rappture::Combobox $inner.field -width 10 -editable no
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting -field]
-
-    label $inner.colormap_l -text "Colormap" -font $font
-    itk_component add colormap {
-        Rappture::Combobox $inner.colormap -editable no
-    }
-    $inner.colormap choices insert end [GetColormapList]
-    bind $inner.colormap <<Value>> \
-        [itcl::code $this AdjustSetting -color]
-    $itk_component(colormap) value $_settings(-color)
+        [itcl::code $this AdjustSetting field]
+
+    label $inner.palette_l -text "Palette" -font "Arial 9" 
+    itk_component add palette {
+        Rappture::Combobox $inner.palette -width 10 -editable no
+    }
+    $inner.palette choices insert end \
+        "BCGYR"              "BCGYR"            \
+        "BGYOR"              "BGYOR"            \
+        "blue"               "blue"             \
+        "blue-to-brown"      "blue-to-brown"    \
+        "blue-to-orange"     "blue-to-orange"   \
+        "blue-to-grey"       "blue-to-grey"     \
+        "green-to-magenta"   "green-to-magenta" \
+        "greyscale"          "greyscale"        \
+        "nanohub"            "nanohub"          \
+        "rainbow"            "rainbow"          \
+        "spectral"           "spectral"         \
+        "ROYGB"              "ROYGB"            \
+        "RYGCB"              "RYGCB"            \
+        "brown-to-blue"      "brown-to-blue"    \
+        "grey-to-blue"       "grey-to-blue"     \
+        "orange-to-blue"     "orange-to-blue"   
+
+    $itk_component(palette) value "BCGYR"
+    bind $inner.palette <<Value>> \
+        [itcl::code $this AdjustSetting volume-palette]
 
     blt::table $inner \
         0,0 $inner.field_l   -anchor w -pady 2  \
-        0,1 $inner.field     -fill x   -pady 2 -cspan 3 \
-        1,0 $inner.visibility -anchor w -pady 2 -cspan 4 \
+        0,1 $inner.field     -anchor w -pady 2 -cspan 2 \
+        1,0 $inner.volume    -anchor w -pady 2 -cspan 4 \
         2,0 $inner.lighting  -anchor w -pady 2 -cspan 4 \
         3,0 $inner.dim_l     -anchor e -pady 2 \
-        3,1 $inner.material  -fill x   -pady 2 -cspan 2 \
-        3,3 $inner.bright_l  -anchor w -pady 2 \
-        4,0 $inner.opacity_l -anchor w -pady 2 -cspan 4 \
-        5,0 $inner.opacity   -fill x   -pady 2 -cspan 4 \
-        6,0 $inner.quality_l -anchor w -pady 2 -cspan 4 \
-        7,0 $inner.quality   -fill x   -pady 2 -cspan 4 \
-        8,0 $inner.colormap_l -anchor w -pady 2  \
-        8,1 $inner.colormap   -fill x   -pady 2 -cspan 3 \
-
-    blt::table configure $inner r* c0 c1 c3 -resize none
-    blt::table configure $inner r9 c2 -resize expand
+        3,1 $inner.material  -fill x   -pady 2 \
+        3,2 $inner.bright_l  -anchor w -pady 2 \
+        4,0 $inner.quality_l -anchor w -pady 2 -cspan 2 \
+        5,0 $inner.quality   -fill x   -pady 2 -cspan 2 \
+        7,0 $inner.palette_l -anchor w -pady 2  \
+        7,1 $inner.palette   -anchor w -pady 2 -cspan 2 \
+
+    blt::table configure $inner r* c* -resize none
+    blt::table configure $inner r8 -resize expand
 }
 
 itcl::body Rappture::VtkVolumeViewer::BuildAxisTab {} {
+
     set fg [option get $itk_component(hull) font Font]
     #set bfg [option get $itk_component(hull) boldFont Font]
@@ -1783,38 +1670,33 @@
     set inner [$itk_component(main) insert end \
         -title "Axis Settings" \
-        -icon [Rappture::icon axis2]]
+        -icon [Rappture::icon axis1]]
     $inner configure -borderwidth 4
 
     checkbutton $inner.visible \
-        -text "Axes" \
-        -variable [itcl::scope _settings(-axesvisible)] \
-        -command [itcl::code $this AdjustSetting -axesvisible] \
+        -text "Show Axes" \
+        -variable [itcl::scope _settings(axesVisible)] \
+        -command [itcl::code $this AdjustSetting axesVisible] \
         -font "Arial 9"
 
     checkbutton $inner.labels \
-        -text "Axis Labels" \
-        -variable [itcl::scope _settings(-axislabels)] \
-        -command [itcl::code $this AdjustSetting -axislabels] \
+        -text "Show Axis Labels" \
+        -variable [itcl::scope _settings(axisLabels)] \
+        -command [itcl::code $this AdjustSetting axisLabels] \
         -font "Arial 9"
-    label $inner.grid_l -text "Grid" -font "Arial 9"
-    checkbutton $inner.xgrid \
-        -text "X" \
-        -variable [itcl::scope _settings(-xgrid)] \
-        -command [itcl::code $this AdjustSetting -xgrid] \
+
+    checkbutton $inner.gridx \
+        -text "Show X Grid" \
+        -variable [itcl::scope _settings(axis-xgrid)] \
+        -command [itcl::code $this AdjustSetting axis-xgrid] \
         -font "Arial 9"
-    checkbutton $inner.ygrid \
-        -text "Y" \
-        -variable [itcl::scope _settings(-ygrid)] \
-        -command [itcl::code $this AdjustSetting -ygrid] \
+    checkbutton $inner.gridy \
+        -text "Show Y Grid" \
+        -variable [itcl::scope _settings(axis-ygrid)] \
+        -command [itcl::code $this AdjustSetting axis-ygrid] \
         -font "Arial 9"
-    checkbutton $inner.zgrid \
-        -text "Z" \
-        -variable [itcl::scope _settings(-zgrid)] \
-        -command [itcl::code $this AdjustSetting -zgrid] \
-        -font "Arial 9"
-    checkbutton $inner.minorticks \
-        -text "Minor Ticks" \
-        -variable [itcl::scope _settings(-axisminorticks)] \
-        -command [itcl::code $this AdjustSetting -axisminorticks] \
+    checkbutton $inner.gridz \
+        -text "Show Z Grid" \
+        -variable [itcl::scope _settings(axis-zgrid)] \
+        -command [itcl::code $this AdjustSetting axis-zgrid] \
         -font "Arial 9"
 
@@ -1827,24 +1709,22 @@
         "static_triad"    "static" \
         "closest_triad"   "closest" \
-        "furthest_triad"  "farthest" \
+        "furthest_triad"  "furthest" \
         "outer_edges"     "outer"         
-    $itk_component(axismode) value $_settings(-axisflymode)
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
+    $itk_component(axismode) value "static"
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisFlyMode]
 
     blt::table $inner \
-        0,0 $inner.visible -anchor w -cspan 4 \
-        1,0 $inner.labels  -anchor w -cspan 4 \
-        2,0 $inner.minorticks  -anchor w -cspan 4 \
-        4,0 $inner.grid_l  -anchor w \
-        4,1 $inner.xgrid   -anchor w \
-        4,2 $inner.ygrid   -anchor w \
-        4,3 $inner.zgrid   -anchor w \
-        5,0 $inner.mode_l  -anchor w -padx { 2 0 } \
-        5,1 $inner.mode    -fill x   -cspan 3
+        0,0 $inner.visible -anchor w -cspan 2 \
+        1,0 $inner.labels  -anchor w -cspan 2 \
+        2,0 $inner.gridx   -anchor w -cspan 2 \
+        3,0 $inner.gridy   -anchor w -cspan 2 \
+        4,0 $inner.gridz   -anchor w -cspan 2 \
+        5,0 $inner.mode_l  -anchor w -cspan 2 -padx { 2 0 } \
+        6,0 $inner.mode    -fill x   -cspan 2 
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r7 c6 -resize expand
-    blt::table configure $inner r3 -height 0.125i
-}
+    blt::table configure $inner r7 c1 -resize expand
+}
+
 
 itcl::body Rappture::VtkVolumeViewer::BuildCameraTab {} {
@@ -1854,29 +1734,14 @@
     $inner configure -borderwidth 4
 
-    label $inner.view_l -text "view" -font "Arial 9"
-    set f [frame $inner.view]
-    foreach side { front back left right top bottom } {
-        button $f.$side  -image [Rappture::icon view$side] \
-            -command [itcl::code $this SetOrientation $side]
-        Rappture::Tooltip::for $f.$side "Change the view to $side"
-        pack $f.$side -side left
-    }
-    blt::table $inner \
-        0,0 $inner.view_l -anchor e -pady 2 \
-        0,1 $inner.view -anchor w -pady 2
-    blt::table configure $inner r0 -resize none
-
-    set row 1
     set labels { qx qy qz qw xpan ypan zoom }
+    set row 0
     foreach tag $labels {
-        label $inner.${tag}-label -text $tag -font "Arial 9"
+        label $inner.${tag}label -text $tag -font "Arial 9"
         entry $inner.${tag} -font "Arial 9"  -bg white \
-            -textvariable [itcl::scope _view(-$tag)]
-        bind $inner.${tag} <Return> \
-            [itcl::code $this camera set -${tag}]
-        bind $inner.${tag} <KP_Enter> \
-            [itcl::code $this camera set -${tag}]
+            -textvariable [itcl::scope _view($tag)]
+        bind $inner.${tag} <KeyPress-Return> \
+            [itcl::code $this camera set ${tag}]
         blt::table $inner \
-            $row,0 $inner.${tag}-label -anchor e -pady 2 \
+            $row,0 $inner.${tag}label -anchor e -pady 2 \
             $row,1 $inner.${tag} -anchor w -pady 2
         blt::table configure $inner r$row -resize none
@@ -1885,6 +1750,6 @@
     checkbutton $inner.ortho \
         -text "Orthographic Projection" \
-        -variable [itcl::scope _view(-ortho)] \
-        -command [itcl::code $this camera set -ortho] \
+        -variable [itcl::scope _view(ortho)] \
+        -command [itcl::code $this camera set ortho] \
         -font "Arial 9"
     blt::table $inner \
@@ -1899,5 +1764,6 @@
 
 itcl::body Rappture::VtkVolumeViewer::BuildCutplaneTab {} {
-    set font [option get $itk_component(hull) font Font]
+
+    set fg [option get $itk_component(hull) font Font]
     
     set inner [$itk_component(main) insert end \
@@ -1909,21 +1775,33 @@
     checkbutton $inner.visible \
         -text "Show Cutplanes" \
-        -variable [itcl::scope _settings(-cutplanesvisible)] \
-        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
+        -variable [itcl::scope _settings(cutplaneVisible)] \
+        -command [itcl::code $this AdjustSetting cutplaneVisible] \
+        -font "Arial 9"
+
+    checkbutton $inner.wireframe \
+        -text "Show Wireframe" \
+        -variable [itcl::scope _settings(cutplaneWireframe)] \
+        -command [itcl::code $this AdjustSetting cutplaneWireframe] \
         -font "Arial 9"
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(-cutplanelighting)] \
-        -command [itcl::code $this AdjustSetting -cutplanelighting] \
+        -variable [itcl::scope _settings(cutplaneLighting)] \
+        -command [itcl::code $this AdjustSetting cutplaneLighting] \
+        -font "Arial 9"
+
+    checkbutton $inner.edges \
+        -text "Show Edges" \
+        -variable [itcl::scope _settings(cutplaneEdges)] \
+        -command [itcl::code $this AdjustSetting cutplaneEdges] \
         -font "Arial 9"
 
     label $inner.opacity_l -text "Opacity" -font "Arial 9"
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(-cutplaneopacity)] \
+        -variable [itcl::scope _settings(cutplane-opacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting -cutplaneopacity]
-    $inner.opacity set $_settings(-cutplaneopacity)
+        -command [itcl::code $this AdjustSetting cutplane-opacity]
+    $inner.opacity set $_settings(cutplane-opacity)
 
     # X-value slicer...
@@ -1932,6 +1810,6 @@
             -onimage [Rappture::icon x-cutplane] \
             -offimage [Rappture::icon x-cutplane] \
-            -command [itcl::code $this AdjustSetting -xcutplanevisible] \
-            -variable [itcl::scope _settings(-xcutplanevisible)]
+            -command [itcl::code $this AdjustSetting cutplane-xvisible] \
+            -variable [itcl::scope _settings(cutplane-xvisible)]
     }
     Rappture::Tooltip::for $itk_component(xCutButton) \
@@ -1944,5 +1822,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane x] \
-            -variable [itcl::scope _settings(-xcutplaneposition)]
+            -variable [itcl::scope _settings(cutplane-xposition)]
     } {
         usual
@@ -1960,6 +1838,6 @@
             -onimage [Rappture::icon y-cutplane] \
             -offimage [Rappture::icon y-cutplane] \
-            -command [itcl::code $this AdjustSetting -ycutplanevisible] \
-            -variable [itcl::scope _settings(-ycutplanevisible)]
+            -command [itcl::code $this AdjustSetting cutplane-yvisible] \
+            -variable [itcl::scope _settings(cutplane-yvisible)]
     }
     Rappture::Tooltip::for $itk_component(yCutButton) \
@@ -1972,5 +1850,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane y] \
-            -variable [itcl::scope _settings(-ycutplaneposition)]
+            -variable [itcl::scope _settings(cutplane-yposition)]
     } {
         usual
@@ -1988,6 +1866,6 @@
             -onimage [Rappture::icon z-cutplane] \
             -offimage [Rappture::icon z-cutplane] \
-            -command [itcl::code $this AdjustSetting -zcutplanevisible] \
-            -variable [itcl::scope _settings(-zcutplanevisible)]
+            -command [itcl::code $this AdjustSetting cutplane-zvisible] \
+            -variable [itcl::scope _settings(cutplane-zvisible)]
     }
     Rappture::Tooltip::for $itk_component(zCutButton) \
@@ -2000,5 +1878,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane z] \
-            -variable [itcl::scope _settings(-zcutplaneposition)]
+            -variable [itcl::scope _settings(cutplane-zposition)]
     } {
         usual
@@ -2013,15 +1891,17 @@
         0,0 $inner.visible              -anchor w -pady 2 -cspan 4 \
         1,0 $inner.lighting             -anchor w -pady 2 -cspan 4 \
-        2,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
-        3,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
-        4,0 $itk_component(xCutButton)  -anchor e -padx 2 -pady 2 \
-        5,0 $itk_component(xCutScale)   -fill y \
-        4,1 $itk_component(yCutButton)  -anchor e -padx 2 -pady 2 \
-        5,1 $itk_component(yCutScale)   -fill y \
-        4,2 $itk_component(zCutButton)  -anchor e -padx 2 -pady 2 \
-        5,2 $itk_component(zCutScale)   -fill y
+        2,0 $inner.wireframe            -anchor w -pady 2 -cspan 4 \
+        3,0 $inner.edges                -anchor w -pady 2 -cspan 4 \
+        4,0 $inner.opacity_l            -anchor w -pady 2 -cspan 3 \
+        5,0 $inner.opacity              -fill x   -pady 2 -cspan 3 \
+        6,0 $itk_component(xCutButton)  -anchor e -padx 2 -pady 2 \
+        7,0 $itk_component(xCutScale)   -fill y \
+        6,1 $itk_component(yCutButton)  -anchor e -padx 2 -pady 2 \
+        7,1 $itk_component(yCutScale)   -fill y \
+        6,2 $itk_component(zCutButton)  -anchor e -padx 2 -pady 2 \
+        7,2 $itk_component(zCutScale)   -fill y \
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r5 c3 -resize expand
+    blt::table configure $inner r7 c3 -resize expand
 }
 
@@ -2042,6 +1922,6 @@
             }
             switch -- $who {
-                "-ortho" {
-                    if {$_view(-ortho)} {
+                "ortho" {
+                    if {$_view(ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -2049,14 +1929,14 @@
                     }
                 }
-                "-xpan" - "-ypan" {
+                "xpan" - "ypan" {
                     PanCamera
                 }
-                "-qx" - "-qy" - "-qz" - "-qw" {
-                    set q [ViewToQuaternion]
+                "qx" - "qy" - "qz" - "qw" {
+                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "-zoom" {
-                    SendCmd "camera zoom $_view(-zoom)"
+                "zoom" {
+                    SendCmd "camera zoom $_view(zoom)"
                 }
             }
@@ -2128,32 +2008,31 @@
 }
 
-itcl::body Rappture::VtkVolumeViewer::SetObjectStyle { dataobj cname } {
+itcl::body Rappture::VtkVolumeViewer::SetObjectStyle { dataobj comp } {
     # Parse style string.
-    set tag $dataobj-$cname
-    array set styles {
-        -lighting   1
-        -opacity    0.5
-        -outline    0
-        -visible    1
-    }
-    array set styles [$dataobj style $cname]
-    set _settings(-volumelighting) $styles(-lighting)
-    set _settings(-volumeopacity) [expr $styles(-opacity) * 100.0]
-    set _settings(-volumeoutline) $styles(-outline)
-    set _settings(-volumevisible) $styles(-visible)
-
-    SendCmd "outline add $tag"
-    SendCmd "outline color [Color2RGB $itk_option(-plotforeground)] $tag"
-    SendCmd "outline visible $styles(-outline) $tag"
-
-    SendCmd "$_cutplaneCmd add $tag"
-    SendCmd "$_cutplaneCmd color [Color2RGB $itk_option(-plotforeground)] $tag"
-    SendCmd "$_cutplaneCmd visible 0 $tag"
-
+    set tag $dataobj-$comp
+    set style [$dataobj style $comp]
+    array set settings {
+        -color \#808080
+        -edges 0
+        -edgecolor black
+        -linewidth 1.0
+        -opacity 0.4
+        -wireframe 0
+        -lighting 1
+        -seeds 1
+        -seedcolor white
+        -visible 1
+    }
+    if { $dataobj != $_first } {
+        set settings(-opacity) 1
+    }
+    array set settings $style
     SendCmd "volume add $tag"
-    SendCmd "volume lighting $styles(-lighting) $tag"
-    SendCmd "volume opacity $styles(-opacity) $tag"
-    SendCmd "volume visible $styles(-visible) $tag"
-    SetColormap $dataobj $cname
+    SendCmd "cutplane add $tag"
+    SendCmd "cutplane visible 0 $tag"
+
+    SendCmd "volume lighting $settings(-lighting) $tag"
+    set _settings(volumeLighting) $settings(-lighting)
+    SetColormap $dataobj $comp
 }
 
@@ -2174,5 +2053,6 @@
 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
     set _legendPending 0
-    if { [isconnected] } {
+    #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"
+    if { [IsConnected] } {
         set bytes [ReceiveBytes $size]
         if { ![info exists _image(legend)] } {
@@ -2209,5 +2089,5 @@
         set title $fname
     }
-    if { $_settings(-legendvisible) } {
+    if { $_settings(legendVisible) } {
         set x [expr $w - 2]
         if { [$c find withtag "legend"] == "" } {
@@ -2346,5 +2226,5 @@
             }
             set newpos [expr {0.01*$newval}]
-            SendCmd "$_cutplaneCmd slice $axis $newpos"
+            SendCmd "cutplane slice $axis $newpos"
         }
         "tooltip" {
@@ -2358,4 +2238,5 @@
     }
 }
+
 
 # ----------------------------------------------------------------------
@@ -2384,9 +2265,9 @@
         }
         deactivate {
-            $c itemconfigure title -fill $itk_option(-plotforeground) 
+            $c itemconfigure title -fill white 
         }
         invoke {
-            $itk_component(field) value $_curFldLabel
-            AdjustSetting -field
+            $itk_component(field) value _curFldLabel
+            AdjustSetting field
         }
         default {
@@ -2396,37 +2277,2 @@
 }
 
-itcl::body Rappture::VtkVolumeViewer::SetOrientation { side } { 
-    array set positions {
-        front "1 0 0 0"
-        back  "0 0 1 0"
-        left  "0.707107 0 -0.707107 0"
-        right "0.707107 0 0.707107 0"
-        top   "0.707107 -0.707107 0 0"
-        bottom "0.707107 0.707107 0 0"
-    }
-    foreach name { -qw -qx -qy -qz } value $positions($side) {
-        set _view($name) $value
-    } 
-    set q [ViewToQuaternion]
-    $_arcball quaternion $q
-    SendCmd "camera orient $q" 
-    SendCmd "camera reset"
-    set _view(-xpan) 0
-    set _view(-ypan) 0
-    set _view(-zoom) 1.0
-}
-
-#
-# GetDatasetsWithComponents --
-#
-#       Returns a list of all the datasets (known by the combination of
-#       their data object and component name) that match the given 
-#       component name.  For example, this is used where we want to change 
-#       the settings of volumes that have the current component.
-#
-itcl::body Rappture::VtkVolumeViewer::GetDatasetsWithComponent { cname } { 
-    if { ![info exists _volcomponents($cname)] } {
-        return ""
-    }
-    return $_volcomponents($cname)
-}
