Index: branches/1.3/gui/scripts/vtkglyphviewer.tcl
===================================================================
--- branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 5013)
+++ branches/1.3/gui/scripts/vtkglyphviewer.tcl	(revision 5014)
@@ -1,4 +1,3 @@
 # -*- mode: tcl; indent-tabs-mode: nil -*- 
-
 # ----------------------------------------------------------------------
 #  COMPONENT: vtkglyphviewer - Vtk 3D glyphs object viewer
@@ -8,5 +7,5 @@
 # ======================================================================
 #  AUTHOR:  Michael McLennan, Purdue University
-#  Copyright (c) 2004-2005  Purdue Research Foundation
+#  Copyright (c) 2004-2014  HUBzero Foundation, LLC
 #
 #  See the file "license.terms" for information on usage and
@@ -58,5 +57,4 @@
     public method get {args}
     public method isconnected {}
-    public method limits { colormap }
     public method parameters {title args} { 
         # do nothing 
@@ -64,21 +62,6 @@
     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 {}
@@ -89,4 +72,9 @@
     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 } 
@@ -96,9 +84,20 @@
     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 } 
@@ -106,4 +105,8 @@
     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 ""
@@ -119,5 +122,4 @@
     # heightmaps displayed.
     private variable _currentColormap ""
-    private variable _currentOpacity ""
 
     private variable _dataset2style    ;# maps dataobj-component to transfunc
@@ -146,5 +148,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 
@@ -184,15 +186,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"
 
     #
@@ -205,51 +207,57 @@
     # Initialize the view to some default parameters.
     array set _view {
-        qw              0.853553
-        qx              -0.353553
-        qy              0.353553
-        qz              0.146447
-        zoom            1.0 
-        xpan            0
-        ypan            0
-        ortho           0
+        -ortho           0
+        -qw              0.853553
+        -qx              -0.353553
+        -qy              0.353553
+        -qz              0.146447
+        -xpan            0
+        -ypan            0
+        -zoom            1.0
     }
     set _arcball [blt::arcball create 100 100]
-    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-    $_arcball quaternion $q
+    $_arcball quaternion [ViewToQuaternion]
 
     array set _settings [subst {
-	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
+        -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
     }]
     array set _changed {
-        glyphOpacity            0
-        colormap                0
+        -colormap               0
+        -glyphopacity           0
     }
 
@@ -331,6 +339,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
@@ -344,6 +352,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) \
@@ -462,6 +470,5 @@
 
 itcl::body Rappture::VtkGlyphViewer::DoRotate {} {
-    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-    SendCmd "camera orient $q" 
+    SendCmd "camera orient [ViewToQuaternion]" 
     set _rotatePending 0
 }
@@ -487,5 +494,5 @@
 
 itcl::body Rappture::VtkGlyphViewer::EventuallyRotate { q } {
-    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
+    QuaternionToView $q
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -542,11 +549,10 @@
 }
 
-
 # ----------------------------------------------------------------------
 # 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.
 #
 # ----------------------------------------------------------------------
@@ -798,5 +804,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 {} {
@@ -815,6 +821,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 {} {
@@ -833,5 +839,4 @@
     array unset _data 
     array unset _colormaps 
-    array unset _seeds 
     array unset _dataset2style 
     array unset _obj2datasets 
@@ -855,6 +860,7 @@
     if { $info(-type) == "image" } {
         if 0 {
-            set f [open "last.ppm" "w"] 
-            puts $f $bytes
+            set f [open "last.ppm" "w"]
+            fconfigure $f -encoding binary
+            puts -nonewline $f $bytes
             close $f
         }
@@ -944,7 +950,6 @@
         # Reset the camera and other view parameters
         #
-        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-        $_arcball quaternion $q
-        if {$_view(ortho)} {
+        $_arcball quaternion [ViewToQuaternion]
+        if {$_view(-ortho)} {
             SendCmd "camera mode ortho"
         } else {
@@ -954,9 +959,7 @@
         PanCamera
         set _first ""
-        InitSettings axisXGrid axisYGrid axisZGrid axisMode \
-            axesVisible axisLabelsVisible 
-        foreach axis { x y z } {
-	    SendCmd "axis lformat $axis %g"
-	}
+        InitSettings -xgrid -ygrid -zgrid -axismode \
+            -axesvisible -axislabels -axisminorticks
+        #SendCmd "axis lformat all %g"
         StopBufferingCommands
         SendCmd "imgflush"
@@ -974,8 +977,9 @@
             if { ![info exists _datasets($tag)] } {
                 set bytes [$dataobj vtkdata $comp]
-		if 0 { 
-		    set f [open "/tmp/glyph.vtk" "w"]
-		    puts $f $bytes
-		    close $f
+                if 0 { 
+                    set f [open "/tmp/glyph.vtk" "w"]
+                    fconfigure $f -translation binary -encoding binary
+                    puts -nonewline $f $bytes
+                    close $f
                 }
                 set length [string length $bytes]
@@ -992,5 +996,5 @@
                     SendCmd "clientinfo [list $info]"
                 }
-                append _outbuf "dataset add $tag data follows $length\n"
+                SendCmd "dataset add $tag data follows $length"
                 append _outbuf $bytes
                 set _datasets($tag) 1
@@ -1001,5 +1005,5 @@
                 # Setting dataset visible enables outline 
                 # and glyphs
-		SendCmd "dataset visible 1 $tag"
+                SendCmd "dataset visible 1 $tag"
             }
         }
@@ -1007,7 +1011,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] {
@@ -1035,29 +1039,28 @@
         $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 \
-            glyphLighting \
-            field \
-            glyphEdges glyphLighting glyphOpacity \
-	    glyphWireframe
-
-        #cutplaneXPosition cutplaneYPosition cutplaneZPosition \
-	    cutplaneXVisible cutplaneYVisible cutplaneZVisible \
-            cutplanePreinterp 
+            -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 } {
@@ -1130,20 +1133,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
-                zoom   1.0
-                xpan   0
-                ypan   0
+                -qw      0.853553
+                -qx      -0.353553
+                -qy      0.353553
+                -qz      0.146447
+                -xpan    0
+                -ypan    0
+                -zoom    1.0
             }
             if { $_first != "" } {
@@ -1153,6 +1156,5 @@
                 }
             }
-            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-            $_arcball quaternion $q
+            $_arcball quaternion [ViewToQuaternion]
             DoRotate
             SendCmd "camera reset"
@@ -1162,9 +1164,8 @@
 
 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"
 }
-
 
 # ----------------------------------------------------------------------
@@ -1222,5 +1223,5 @@
 itcl::body Rappture::VtkGlyphViewer::Pick {x y} {
     foreach tag [CurrentDatasets -visible] {
-        SendCmdNoSplash "dataset getscalar pixel $x $y $tag"
+        SendCmd "dataset getscalar pixel $x $y $tag"
     } 
 }
@@ -1241,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
@@ -1264,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
         }
@@ -1287,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
@@ -1298,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 ""}} {
@@ -1307,30 +1308,34 @@
     }
     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(axesVisible)
+                -plotforeground $fgcolors($bgcolor)
+            $itk_component(view) delete "legend"
+            DrawLegend
+        }
+        "-axesvisible" {
+            set bool $_settings($what)
             SendCmd "axis visible all $bool"
         }
-        "axisLabelsVisible" {
-            set bool $_settings(axisLabelsVisible)
+        "-axislabels" {
+            set bool $_settings($what)
             SendCmd "axis labels all $bool"
         }
-        "axisXGrid" - "axisYGrid" - "axisZGrid" {
-            set axis [string tolower [string range $what 4 4]]
+        "-axisminorticks" {
+            set bool $_settings($what)
+            SendCmd "axis minticks all $bool"
+        }
+        "-xgrid" - "-ygrid" - "-zgrid" {
+            set axis [string tolower [string range $what 1 1]]
             set bool $_settings($what)
             SendCmd "axis grid $axis $bool"
         }
-        "axisMode" {
+        "-axismode" {
             set mode [$itk_component(axisMode) value]
             set mode [$itk_component(axisMode) translate $mode]
@@ -1338,31 +1343,36 @@
             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" {
+            SendCmd "cutplane visible 0"
+            if { $bool } {
+                foreach tag [CurrentDatasets -visible] {
+                    SendCmd "cutplane visible $bool $tag"
+                }
+            }
+        }
+        "-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 8 8]]
+        "-cutplanexvisible" - "-cutplaneyvisible" - "-cutplanezvisible" {
+            set axis [string tolower [string range $what 9 9]]
             set bool $_settings($what)
             if { $bool } {
@@ -1373,39 +1383,44 @@
                     -troughcolor grey82
             }
-	    SendCmd "cutplane axis $axis $bool"
-        }
-        "cutplaneXPosition" - "cutplaneYPosition" - "cutplaneZPosition" {
-            set axis [string tolower [string range $what 8 8]]
+            SendCmd "cutplane axis $axis $bool"
+        }
+        "-cutplanexposition" - "-cutplaneyposition" - "-cutplanezposition" {
+            set axis [string tolower [string range $what 9 9]]
             set pos [expr $_settings($what) * 0.01]
             SendCmd "cutplane slice ${axis} ${pos}"
             set _cutplanePending 0
         }
-        "colormap" {
-            set _changed(colormap) 1
+        "-colormap" {
+            set _changed($what) 1
             StartBufferingCommands
             set color [$itk_component(colormap) value]
-            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
-	    }
+            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
+            }
             StopBufferingCommands
-	    EventuallyRequestLegend
-        }
-        "glyphWireframe" {
-            set bool $_settings(glyphWireframe)
-	    SendCmd "glyphs wireframe $bool"
-        }
-        "glyphVisible" {
-            set bool $_settings(glyphVisible)
-	    SendCmd "glyphs visible $bool"
+            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"
+                }
+            }
             if { $bool } {
                 Rappture::Tooltip::for $itk_component(glyphs) \
@@ -1415,27 +1430,58 @@
                     "Show the glyph"
             }
-	    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)
+            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)
             set sval [expr { 0.01 * double($val) }]
-	    SendCmd "glyphs opacity $sval"
-        }
-        "field" {
+            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" {
             set label [$itk_component(field) value]
             set fname [$itk_component(field) translate $label]
-            set _settings(field) $fname
+            set _settings($what) $fname
             if { [info exists _fields($fname)] } {
                 foreach { label units components } $_fields($fname) break
@@ -1451,14 +1497,18 @@
                 return
             }
-            #SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
+            #if { ![info exists _limits($_curFldName)] } {
+            #    SendCmd "dataset maprange all"
+            #} else {
+            #    SendCmd "dataset maprange explicit $_limits($_curFldName) $_curFldName"
+            #}
             #SendCmd "cutplane colormode $_colorMode $_curFldName"
             SendCmd "glyphs colormode $_colorMode $_curFldName"
             DrawLegend
         }
-        "legendVisible" {
-            if { !$_settings(legendVisible) } {
+        "-legendvisible" {
+            if { !$_settings($what) } {
                 $itk_component(view) delete legend
-	    }
-	    DrawLegend
+            }
+            DrawLegend
         }
         default {
@@ -1468,42 +1518,37 @@
 }
 
-
 #
 # 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 font "Arial 8"
+    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
-    set font "Arial 8"
-    set lineht [font metrics $font -linespace]
-    set w 12
-    set h [expr {$_height - 2 * ($lineht + 2)}]
-    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
@@ -1511,8 +1556,11 @@
         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"
     }
 }
@@ -1534,16 +1582,8 @@
     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]
 }
 
@@ -1560,36 +1600,83 @@
     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"
 
@@ -1603,20 +1690,34 @@
         "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.scale_l -text "Scale" -font "Arial 9"
-    ::scale $inner.scale -from 1 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(glyphs-scale)] \
+        -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)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting glyphs-scale]
+        -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)"
 
     itk_component add field_l {
@@ -1629,5 +1730,5 @@
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting field]
+        [itcl::code $this AdjustSetting -field]
 
     label $inner.colormap_l -text "Colormap" -font "Arial 9" 
@@ -1635,40 +1736,24 @@
         Rappture::Combobox $inner.colormap -width 10 -editable no
     }
-    $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"   
-
+
+    $inner.colormap choices insert end [GetColormapList]
     $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
@@ -1687,29 +1772,34 @@
 
     checkbutton $inner.visible \
-        -text "Show Axes" \
-        -variable [itcl::scope _settings(axesVisible)] \
-        -command [itcl::code $this AdjustSetting axesVisible] \
+        -text "Axes" \
+        -variable [itcl::scope _settings(-axesvisible)] \
+        -command [itcl::code $this AdjustSetting -axesvisible] \
         -font "Arial 9"
 
     checkbutton $inner.labels \
-        -text "Show Axis Labels" \
-        -variable [itcl::scope _settings(axisLabelsVisible)] \
-        -command [itcl::code $this AdjustSetting axisLabelsVisible] \
+        -text "Axis Labels" \
+        -variable [itcl::scope _settings(-axislabels)] \
+        -command [itcl::code $this AdjustSetting -axislabels] \
         -font "Arial 9"
-
-    checkbutton $inner.gridx \
-        -text "Show X Grid" \
-        -variable [itcl::scope _settings(axisXGrid)] \
-        -command [itcl::code $this AdjustSetting axisXGrid] \
+    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] \
         -font "Arial 9"
-    checkbutton $inner.gridy \
-        -text "Show Y Grid" \
-        -variable [itcl::scope _settings(axisYGrid)] \
-        -command [itcl::code $this AdjustSetting axisYGrid] \
+    checkbutton $inner.ygrid \
+        -text "Y" \
+        -variable [itcl::scope _settings(-ygrid)] \
+        -command [itcl::code $this AdjustSetting -ygrid] \
         -font "Arial 9"
-    checkbutton $inner.gridz \
-        -text "Show Z Grid" \
-        -variable [itcl::scope _settings(axisZGrid)] \
-        -command [itcl::code $this AdjustSetting axisZGrid] \
+    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] \
         -font "Arial 9"
 
@@ -1724,20 +1814,22 @@
         "furthest_triad"  "farthest" \
         "outer_edges"     "outer"         
-    $itk_component(axisMode) value "static"
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisMode]
+    $itk_component(axisMode) value $_settings(-axismode)
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axismode]
 
     blt::table $inner \
-        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 
+        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
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r7 c1 -resize expand
-}
-
+    blt::table configure $inner r7 c6 -resize expand
+    blt::table configure $inner r3 -height 0.125i
+}
 
 itcl::body Rappture::VtkGlyphViewer::BuildCameraTab {} {
@@ -1759,4 +1851,5 @@
         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 }
@@ -1765,7 +1858,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} <KeyPress-Return> \
-            [itcl::code $this camera set ${tag}]
+            -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}]
         blt::table $inner \
             $row,0 $inner.${tag}label -anchor e -pady 2 \
@@ -1776,6 +1871,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 \
@@ -1784,5 +1879,5 @@
     incr row
 
-    blt::table configure $inner c* r* -resize none
+    blt::table configure $inner c* -resize none
     blt::table configure $inner c2 -resize expand
     blt::table configure $inner r$row -resize expand
@@ -1801,39 +1896,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...
@@ -1842,6 +1937,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) \
@@ -1853,6 +1948,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
@@ -1870,6 +1965,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) \
@@ -1882,6 +1977,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
@@ -1899,9 +1994,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) \
@@ -1914,6 +2009,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
@@ -1926,24 +2021,21 @@
 
     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
 }
-
-
 
 #
@@ -1956,13 +2048,13 @@
         }
         "set" {
-            set who [lindex $args 0]
-            set x $_view($who)
+            set what [lindex $args 0]
+            set x $_view($what)
             set code [catch { string is double $x } result]
             if { $code != 0 || !$result } {
                 return
             }
-            switch -- $who {
-                "ortho" {
-                    if {$_view(ortho)} {
+            switch -- $what {
+                "-ortho" {
+                    if {$_view($what)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -1970,14 +2062,14 @@
                     }
                 }
-                "xpan" - "ypan" {
+                "-xpan" - "-ypan" {
                     PanCamera
                 }
-                "qx" - "qy" - "qz" - "qw" {
-                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+                "-qx" - "-qy" - "-qz" - "-qw" {
+                    set q [ViewToQuaternion]
                     $_arcball quaternion $q
                     EventuallyRotate $q
                 }
-                "zoom" {
-                    SendCmd "camera zoom $_view(zoom)"
+                "-zoom" {
+                    SendCmd "camera zoom $_view($what)"
                 }
              }
@@ -2097,16 +2189,25 @@
     # the code to handle aberrant cases.
 
-    if { $_changed(glyphOpacity) } {
-        set style(-opacity) $_settings(glyphOpacity)
-    }
-    if { $_changed(colormap) } {
-        set style(-color) $_settings(colormap)
+    if { $_changed(-glyphopacity) } {
+        set style(-opacity) [expr $_settings(-glyphopacity) * 0.01]
+    }
+    if { $_changed(-colormap) } {
+        set style(-color) $_settings(-colormap)
     }
     if { $_currentColormap == "" } {
         $itk_component(colormap) value $style(-color)
     }
-    set _currentOpacity $style(-opacity)
+
+    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} {
@@ -2116,9 +2217,7 @@
         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)
-    set _settings(glyphEdges) $style(-edges)
+    set _settings(-glyphnormscale) $style(-normscale)
+    set _settings(-glyphscale) $style(-gscale)
+
     # constant color only used if colormode set to constant
     SendCmd "glyphs color [Color2RGB $itk_option(-plotforeground)] $tag"
@@ -2126,17 +2225,19 @@
     # 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 $_currentOpacity $tag"
-    set _settings(glyphOpacity) $style(-opacity)
+    SendCmd "glyphs opacity $style(-opacity) $tag"
+    set _settings(-glyphopacity) [expr $style(-opacity) * 100.0]
     SetCurrentColormap $style(-color) 
     SendCmd "glyphs wireframe $style(-wireframe) $tag"
-    set _settings(glyphWireframe) $style(-wireframe)
-    set _settings(glyphOpacity) [expr $style(-opacity) * 100.0]
+    set _settings(-glyphwireframe) $style(-wireframe)
 }
 
@@ -2192,14 +2293,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.
@@ -2233,5 +2334,4 @@
 }
 
-
 # ----------------------------------------------------------------------
 # USAGE: Slice move x|y|z <newval>
@@ -2267,7 +2367,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 } {
@@ -2283,6 +2383,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"
         }
     }
@@ -2292,5 +2392,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 {} {
@@ -2303,45 +2403,47 @@
     
     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 
-	    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 
+        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]
     }
     set x2 $x
@@ -2357,6 +2459,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
@@ -2364,6 +2466,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
     }
@@ -2407,5 +2509,5 @@
         invoke {
             $itk_component(field) value $_curFldLabel
-            AdjustSetting field
+            AdjustSetting -field
         }
         default {
@@ -2431,5 +2533,5 @@
 # BuildColormap --
 #
-#       Build the designated colormap on the server.
+#    Build the designated colormap on the server.
 #
 itcl::body Rappture::VtkGlyphViewer::BuildColormap { name } {
@@ -2451,14 +2553,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 [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
+    }
+    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
-}
-
+    set _view(-xpan) 0
+    set _view(-ypan) 0
+    set _view(-zoom) 1.0
+}
