Index: /branches/1.3/gui/scripts/vtkvolumeviewer.tcl
===================================================================
--- /branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 4728)
+++ /branches/1.3/gui/scripts/vtkvolumeviewer.tcl	(revision 4729)
@@ -61,4 +61,12 @@
     }
     public method scale {args}
+
+    private method SetOrientation { side }
+    private method ViewToQuaternion {} { 
+        return [list $_view(-qw) $_view(-qx) $_view(-qy) $_view(-qz)]
+    }
+    private method QuaternionToView { q } { 
+        foreach { _view(-qw) _view(-qx) _view(-qy) _view(-qz) } $q break
+    }
 
     protected method Connect {}
@@ -140,4 +148,5 @@
     private variable _curFldLabel ""
     private variable _colorMode "vmag";#  Mode of colormap (vmag or scalar)
+    private variable _cutplaneCmd "cutplane"
 }
 
@@ -175,15 +184,15 @@
     $_dispatcher register !xcutplane
     $_dispatcher dispatch $this !xcutplane \
-        "[itcl::code $this AdjustSetting cutplane-xposition]; list"
+        "[itcl::code $this AdjustSetting -xcutplaneposition]; list"
 
     # Y-Cutplane event
     $_dispatcher register !ycutplane
     $_dispatcher dispatch $this !ycutplane \
-        "[itcl::code $this AdjustSetting cutplane-yposition]; list"
+        "[itcl::code $this AdjustSetting -ycutplaneposition]; list"
 
     # Z-Cutplane event
     $_dispatcher register !zcutplane
     $_dispatcher dispatch $this !zcutplane \
-        "[itcl::code $this AdjustSetting cutplane-zposition]; list"
+        "[itcl::code $this AdjustSetting -zcutplaneposition]; list"
 
     #
@@ -196,43 +205,43 @@
     # 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
+        -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]
-    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-    $_arcball quaternion $q
+    $_arcball quaternion [ViewToQuaternion]
 
     array set _settings {
-        axis-xgrid              0
-        axis-ygrid              0
-        axis-zgrid              0
-        axesVisible             1
-        axisLabels              1
-	background		black
-        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
-        legendVisible           1
-        outline                 0
-        volumeLighting          1
-        volume-material         80
-        volume-opacity          40
-        volume-quality          50
-        volumeVisible           1
-        legendVisible           1
+        -axesvisible                    1
+        -axisflymode                    static
+        -axislabels                     1
+        -axisminorticks                 1
+        -background                     black
+        -cutplaneedges                  0
+        -cutplanelighting               1
+        -cutplaneopacity                100
+        -cutplanesvisible               0
+        -cutplanewireframe              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
     }
 
@@ -313,6 +322,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
@@ -325,6 +334,6 @@
             -onimage [Rappture::icon cutbutton] \
             -offimage [Rappture::icon cutbutton] \
-            -variable [itcl::scope _settings(cutplaneVisible)] \
-            -command [itcl::code $this AdjustSetting cutplaneVisible] 
+            -variable [itcl::scope _settings(-cutplanesvisible)] \
+            -command [itcl::code $this AdjustSetting -cutplanesvisible] 
     }
     Rappture::Tooltip::for $itk_component(cutplane) \
@@ -446,6 +455,5 @@
 
 itcl::body Rappture::VtkVolumeViewer::DoRotate {} {
-    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-    SendCmd "camera orient $q" 
+    SendCmd "camera orient [ViewToQuaternion]" 
     set _rotatePending 0
 }
@@ -464,5 +472,5 @@
 
 itcl::body Rappture::VtkVolumeViewer::EventuallyRotate { q } {
-    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
+    QuaternionToView $q
     if { !$_rotatePending } {
         set _rotatePending 1
@@ -809,4 +817,10 @@
     array unset _dataset2style 
     array unset _obj2datasets 
+
+    set _resizePending 0
+    set _rotatePending 0
+    set _cutplanePending 0
+    set _legendPending 0
+    set _reset 1
 }
 
@@ -901,4 +915,5 @@
     set w [winfo width $itk_component(view)]
     set h [winfo height $itk_component(view)]
+
     if { $w < 2 || $h < 2 } {
         $_dispatcher event -idle !rebuild
@@ -923,7 +938,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 {
@@ -931,7 +945,7 @@
         }
         DoRotate
-        InitSettings outline background \
-            axis-xgrid axis-ygrid axis-zgrid axisFlyMode \
-            axesVisible axisLabels
+        InitSettings -volumeoutline -background \
+            -xgrid -ygrid -zgrid -axisflymode \
+            -axesvisible -axislabels -axisminorticks
         PanCamera
     }
@@ -1022,11 +1036,13 @@
     }
 
-    InitSettings volume-palette volume-material volume-quality volumeVisible \
-        cutplaneVisible \
-        cutplane-xposition cutplane-yposition cutplane-zposition \
-        cutplane-xvisible cutplane-yvisible cutplane-zvisible
+    InitSettings -volumepalette \
+        -volumematerial \
+        -volumeopacity -volumequality -volumevisible \
+        -cutplanesvisible \
+        -xcutplaneposition -ycutplaneposition -zcutplaneposition \
+        -xcutplanevisible -ycutplanevisible -zcutplanevisible
 
     if { $_reset } {
-        InitSettings volumeLighting
+        InitSettings -volumelighting
         Zoom reset
         set _reset 0
@@ -1095,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
-                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 != "" } {
@@ -1118,6 +1134,5 @@
                 }
             }
-            set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
-            $_arcball quaternion $q
+            $_arcball quaternion [ViewToQuaternion]
             DoRotate
             SendCmd "camera reset"
@@ -1127,6 +1142,6 @@
 
 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"
 }
@@ -1206,6 +1221,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
@@ -1229,6 +1244,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
         }
@@ -1252,7 +1267,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
@@ -1272,6 +1287,7 @@
     }
     switch -- $what {
-        "background" {
+        "-background" {
             set bgcolor [$itk_component(background) value]
+            set _settings($what) $bgcolor
 	    array set fgcolors {
 		"black" "white"
@@ -1284,5 +1300,5 @@
 	    DrawLegend
         }
-        "outline" {
+        "-volumeoutline" {
             set bool $_settings($what)
             SendCmd "outline visible 0"
@@ -1291,12 +1307,11 @@
             }
         }
-        "legendVisible" {
+        "-legendvisible" {
             set bool $_settings($what)
-            set _settings($_current-$what) $bool
-        }
-        "volumeVisible" {
+        }
+        "-volumevisible" {
             set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible] {
-                SendCmd "volume visible $bool $dataset"
+            foreach tag [CurrentDatasets -visible] {
+                SendCmd "volume visible $bool $tag"
             }
             if { $bool } {
@@ -1308,5 +1323,5 @@
             }
         }
-        "volume-material" {
+        "-volumematerial" {
             set val $_settings($what)
             set diffuse [expr {0.01*$val}]
@@ -1314,36 +1329,47 @@
             #set power [expr {sqrt(160*$val+1.0)}]
             set power [expr {$val+1.0}]
-            foreach dataset [CurrentDatasets -visible] {
-                SendCmd "volume shading diffuse $diffuse $dataset"
-                SendCmd "volume shading specular $specular $power $dataset"
-            }
-        }
-        "volumeLighting" {
+            foreach tag [CurrentDatasets -visible] {
+                SendCmd "volume shading diffuse $diffuse $tag"
+                SendCmd "volume shading specular $specular $power $tag"
+            }
+        }
+        "-volumelighting" {
             set bool $_settings($what)
-            foreach dataset [CurrentDatasets -visible] {
-                SendCmd "volume lighting $bool $dataset"
-            }
-        }
-        "volume-quality" {
+            foreach tag [CurrentDatasets -visible] {
+                SendCmd "volume lighting $bool $tag"
+            }
+        }
+        "-volumeopacity" {
             set val $_settings($what)
             set val [expr {0.01*$val}]
-            foreach dataset [CurrentDatasets -visible] {
-                SendCmd "volume quality $val $dataset"
-            }
-        }
-        "axesVisible" {
+            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)
             SendCmd "axis visible all $bool"
         }
-        "axisLabels" {
+        "-axislabels" {
             set bool $_settings($what)
             SendCmd "axis labels all $bool"
         }
-        "axis-xgrid" - "axis-ygrid" - "axis-zgrid" {
-            set axis [string range $what 5 5]
+        "-axisminorticks" {
+            set bool $_settings($what)
+            SendCmd "axis minticks all $bool"
+        }
+        "-xgrid" - "-ygrid" - "-zgrid" {
+            set axis [string range $what 1 1]
             set bool $_settings($what)
             SendCmd "axis grid $axis $bool"
         }
-        "axisFlyMode" {
+        "-axisflymode" {
             set mode [$itk_component(axismode) value]
             set mode [$itk_component(axismode) translate $mode]
@@ -1351,37 +1377,37 @@
             SendCmd "axis flymode $mode"
         }
-        "cutplaneEdges" {
+        "-cutplaneedges" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane edges $bool $dataset"
-            }
-        }
-        "cutplaneVisible" {
+                SendCmd "$_cutplaneCmd edges $bool $dataset"
+            }
+        }
+        "-cutplanesvisible" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane visible $bool $dataset"
-            }
-        }
-        "cutplaneWireframe" {
+                SendCmd "$_cutplaneCmd visible $bool $dataset"
+            }
+        }
+        "-cutplanewireframe" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane wireframe $bool $dataset"
-            }
-        }
-        "cutplaneLighting" {
+                SendCmd "$_cutplaneCmd wireframe $bool $dataset"
+            }
+        }
+        "-cutplanelighting" {
             set bool $_settings($what)
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane lighting $bool $dataset"
-            }
-        }
-        "cutplane-opacity" {
+                SendCmd "$_cutplaneCmd lighting $bool $dataset"
+            }
+        }
+        "-cutplaneopacity" {
             set val $_settings($what)
             set sval [expr { 0.01 * double($val) }]
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane opacity $sval $dataset"
-            }
-        }
-        "cutplane-xvisible" - "cutplane-yvisible" - "cutplane-zvisible" {
-            set axis [string range $what 9 9]
+                SendCmd "$_cutplaneCmd opacity $sval $dataset"
+            }
+        }
+        "-xcutplanevisible" - "-ycutplanevisible" - "-zcutplanevisible" {
+            set axis [string range $what 1 1]
             set bool $_settings($what)
             if { $bool } {
@@ -1393,16 +1419,16 @@
             }
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane axis $axis $bool $dataset"
-            }
-        }
-        "cutplane-xposition" - "cutplane-yposition" - "cutplane-zposition" {
-            set axis [string range $what 9 9]
+                SendCmd "$_cutplaneCmd axis $axis $bool $dataset"
+            }
+        }
+        "-xcutplaneposition" - "-ycutplaneposition" - "-zcutplaneposition" {
+            set axis [string range $what 1 1]
             set pos [expr $_settings($what) * 0.01]
             foreach dataset [CurrentDatasets -visible] {
-                SendCmd "cutplane slice ${axis} ${pos} $dataset"
+                SendCmd "$_cutplaneCmd slice ${axis} ${pos} $dataset"
             }
             set _cutplanePending 0
         }
-        "volume-palette" {
+        "-volumepalette" {
             set palette [$itk_component(palette) value]
             set _settings($what) $palette
@@ -1413,5 +1439,5 @@
             set _legendPending 1
         }
-        "field" {
+        "-field" {
             set label [$itk_component(field) value]
             set fname [$itk_component(field) translate $label]
@@ -1433,5 +1459,5 @@
             foreach dataset [CurrentDatasets -visible $_first] {
                 #SendCmd "volume colormode $_colorMode ${fname} $dataset"
-                SendCmd "cutplane colormode $_colorMode ${fname} $dataset"
+                SendCmd "$_cutplaneCmd colormode $_colorMode ${fname} $dataset"
             }
             SendCmd "camera reset"
@@ -1517,5 +1543,5 @@
          $_dataset2style($tag) != $name } {
         SendCmd "volume colormap $name $tag"
-        SendCmd "cutplane colormap $name-opaque $tag"
+        SendCmd "$_cutplaneCmd colormap $name-opaque $tag"
         set _dataset2style($tag) $name
     }
@@ -1531,8 +1557,8 @@
         set cmap "0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0"
     }
-    if { ![info exists _settings(volume-opacity)] } {
-        set _settings(volume-opacity) $style(-opacity)
-    }
-    set max $_settings(volume-opacity)
+    if { ![info exists _settings(-volumeopacity)] } {
+        set _settings(-volumeopacity) $style(-opacity)
+    }
+    set max $_settings(-volumeopacity)
 
     set opaqueWmap "0.0 1.0 1.0 1.0"
@@ -1565,5 +1591,5 @@
         SendCmd "axis color all $rgb"
         SendCmd "outline color $rgb"
-        SendCmd "cutplane color $rgb"
+        SendCmd "$_cutplaneCmd color $rgb"
         $itk_component(legend) itemconfigure labels -fill $color 
         $itk_component(legend) itemconfigure limits -fill $color 
@@ -1572,6 +1598,6 @@
 
 itcl::body Rappture::VtkVolumeViewer::BuildViewTab {} {
-    set font [option get $itk_component(hull) font Font]
-    #set bfont [option get $itk_component(hull) boldFont Font]
+    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 \
@@ -1582,24 +1608,24 @@
     checkbutton $inner.axes \
         -text "Axes" \
-        -variable [itcl::scope _settings(axesVisible)] \
-        -command [itcl::code $this AdjustSetting axesVisible] \
+        -variable [itcl::scope _settings(-axesvisible)] \
+        -command [itcl::code $this AdjustSetting -axesvisible] \
         -font "Arial 9"
 
     checkbutton $inner.outline \
         -text "Outline" \
-        -variable [itcl::scope _settings(outline)] \
-        -command [itcl::code $this AdjustSetting 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] \
+        -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] \
+        -variable [itcl::scope _settings(-volumevisible)] \
+        -command [itcl::code $this AdjustSetting -volumevisible] \
         -font "Arial 9"
 
@@ -1613,7 +1639,7 @@
         "grey"               "grey"             
 
-    $itk_component(background) value $_settings(background)
+    $itk_component(background) value $_settings(-background)
     bind $inner.background <<Value>> \
-        [itcl::code $this AdjustSetting background]
+        [itcl::code $this AdjustSetting -background]
 
     blt::table $inner \
@@ -1638,109 +1664,109 @@
     $inner configure -borderwidth 4
 
-    checkbutton $inner.volume \
-        -text "Show Volume" \
-        -variable [itcl::scope _settings(volumeVisible)] \
-        -command [itcl::code $this AdjustSetting volumeVisible] \
-        -font "Arial 9"
+    checkbutton $inner.visibility \
+        -text "Visible" \
+        -font $font \
+        -variable [itcl::scope _settings(-volumevisible)] \
+        -command [itcl::code $this AdjustSetting -volumevisible]
 
     checkbutton $inner.lighting \
         -text "Enable Lighting" \
-        -variable [itcl::scope _settings(volumeLighting)] \
-        -command [itcl::code $this AdjustSetting volumeLighting] \
-        -font "Arial 9"
-
-    label $inner.dim_l -text "Dim" -font "Arial 9"
+        -font $font \
+        -variable [itcl::scope _settings(-volumelighting)] \
+        -command [itcl::code $this AdjustSetting -volumelighting]
+
+    label $inner.dim_l -text "Dim" -font $font
     ::scale $inner.material -from 0 -to 100 -orient horizontal \
-        -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"
+        -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
     ::scale $inner.opacity -from 0 -to 100 -orient horizontal \
-        -variable [itcl::scope _settings(volume-opacity)] \
-        -width 10 \
+        -variable [itcl::scope _settings(-volumeopacity)] \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting volume-opacity]
-
-    label $inner.quality_l -text "Quality" -font "Arial 9"
+        -command [itcl::code $this AdjustSetting -volumeopacity]
+
+    label $inner.quality_l -text "Quality" -font $font
     ::scale $inner.quality -from 0 -to 100 -orient horizontal \
-        -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
-    }
+        -variable [itcl::scope _settings(-volumequality)] \
+        -showvalue off \
+        -command [itcl::code $this AdjustSetting -volumequality]
+
+    label $inner.field_l -text "Field" -font $font
     itk_component add field {
-        Rappture::Combobox $inner.field -width 10 -editable no
+        Rappture::Combobox $inner.field -editable no
     }
     bind $inner.field <<Value>> \
-        [itcl::code $this AdjustSetting field]
-
-    label $inner.palette_l -text "Palette" -font "Arial 9" 
+        [itcl::code $this AdjustSetting -field]
+
+    label $inner.palette_l -text "Palette" -font $font
     itk_component add palette {
-        Rappture::Combobox $inner.palette -width 10 -editable no
-    }
-
+        Rappture::Combobox $inner.palette -editable no
+    }
     $inner.palette choices insert end [GetColormapList]
     $itk_component(palette) value "BCGYR"
     bind $inner.palette <<Value>> \
-        [itcl::code $this AdjustSetting volume-palette]
+        [itcl::code $this AdjustSetting -volumepalette]
 
     blt::table $inner \
         0,0 $inner.field_l   -anchor w -pady 2  \
-        0,1 $inner.field     -anchor w -pady 2 -cspan 2 \
-        1,0 $inner.volume    -anchor w -pady 2 -cspan 4 \
+        0,1 $inner.field     -fill x   -pady 2 -cspan 3 \
+        1,0 $inner.visibility -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 \
-        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
+        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.palette_l -anchor w -pady 2  \
+        8,1 $inner.palette   -fill x   -pady 2 -cspan 3 \
+
+    blt::table configure $inner r* c0 c1 c3 -resize none
+    blt::table configure $inner r9 c2 -resize expand
 }
 
 itcl::body Rappture::VtkVolumeViewer::BuildAxisTab {} {
-    set font [option get $itk_component(hull) font Font]
-    #set bfont [option get $itk_component(hull) boldFont Font]
+    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 "Axis Settings" \
-        -icon [Rappture::icon axis1]]
+        -icon [Rappture::icon axis2]]
     $inner configure -borderwidth 4
 
     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(axisLabels)] \
-        -command [itcl::code $this AdjustSetting axisLabels] \
+        -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(axis-xgrid)] \
-        -command [itcl::code $this AdjustSetting axis-xgrid] \
+    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(axis-ygrid)] \
-        -command [itcl::code $this AdjustSetting axis-ygrid] \
+    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(axis-zgrid)] \
-        -command [itcl::code $this AdjustSetting axis-zgrid] \
+    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"
 
@@ -1755,18 +1781,21 @@
         "furthest_triad"  "farthest" \
         "outer_edges"     "outer"         
-    $itk_component(axismode) value "static"
-    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting axisFlyMode]
+    $itk_component(axismode) value $_settings(-axisflymode)
+    bind $inner.mode <<Value>> [itcl::code $this AdjustSetting -axisflymode]
 
     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
 }
 
@@ -1777,14 +1806,29 @@
     $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} <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 \
+            $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
@@ -1793,6 +1837,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 \
@@ -1817,33 +1861,33 @@
     checkbutton $inner.visible \
         -text "Show Cutplanes" \
-        -variable [itcl::scope _settings(cutplaneVisible)] \
-        -command [itcl::code $this AdjustSetting cutplaneVisible] \
+        -variable [itcl::scope _settings(-cutplanesvisible)] \
+        -command [itcl::code $this AdjustSetting -cutplanesvisible] \
         -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(cutplane-opacity)] \
+        -variable [itcl::scope _settings(-cutplaneopacity)] \
         -width 10 \
         -showvalue off \
-        -command [itcl::code $this AdjustSetting cutplane-opacity]
-    $inner.opacity set $_settings(cutplane-opacity)
+        -command [itcl::code $this AdjustSetting -cutplaneopacity]
+    $inner.opacity set $_settings(-cutplaneopacity)
 
     # X-value slicer...
@@ -1852,6 +1896,6 @@
             -onimage [Rappture::icon x-cutplane] \
             -offimage [Rappture::icon x-cutplane] \
-            -command [itcl::code $this AdjustSetting cutplane-xvisible] \
-            -variable [itcl::scope _settings(cutplane-xvisible)]
+            -command [itcl::code $this AdjustSetting -xcutplanevisible] \
+            -variable [itcl::scope _settings(-xcutplanevisible)]
     }
     Rappture::Tooltip::for $itk_component(xCutButton) \
@@ -1864,5 +1908,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane x] \
-            -variable [itcl::scope _settings(cutplane-xposition)]
+            -variable [itcl::scope _settings(-xcutplaneposition)]
     } {
         usual
@@ -1880,6 +1924,6 @@
             -onimage [Rappture::icon y-cutplane] \
             -offimage [Rappture::icon y-cutplane] \
-            -command [itcl::code $this AdjustSetting cutplane-yvisible] \
-            -variable [itcl::scope _settings(cutplane-yvisible)]
+            -command [itcl::code $this AdjustSetting -ycutplanevisible] \
+            -variable [itcl::scope _settings(-ycutplanevisible)]
     }
     Rappture::Tooltip::for $itk_component(yCutButton) \
@@ -1892,5 +1936,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane y] \
-            -variable [itcl::scope _settings(cutplane-yposition)]
+            -variable [itcl::scope _settings(-ycutplaneposition)]
     } {
         usual
@@ -1908,6 +1952,6 @@
             -onimage [Rappture::icon z-cutplane] \
             -offimage [Rappture::icon z-cutplane] \
-            -command [itcl::code $this AdjustSetting cutplane-zvisible] \
-            -variable [itcl::scope _settings(cutplane-zvisible)]
+            -command [itcl::code $this AdjustSetting -zcutplanevisible] \
+            -variable [itcl::scope _settings(-zcutplanevisible)]
     }
     Rappture::Tooltip::for $itk_component(zCutButton) \
@@ -1920,5 +1964,5 @@
             -borderwidth 1 -highlightthickness 0 \
             -command [itcl::code $this EventuallySetCutplane z] \
-            -variable [itcl::scope _settings(cutplane-zposition)]
+            -variable [itcl::scope _settings(-zcutplaneposition)]
     } {
         usual
@@ -1964,6 +2008,6 @@
             }
             switch -- $who {
-                "ortho" {
-                    if {$_view(ortho)} {
+                "-ortho" {
+                    if {$_view(-ortho)} {
                         SendCmd "camera mode ortho"
                     } else {
@@ -1971,14 +2015,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(-zoom)"
                 }
             }
@@ -2071,9 +2115,9 @@
     array set settings $style
     SendCmd "volume add $tag"
-    SendCmd "cutplane add $tag"
-    SendCmd "cutplane visible 0 $tag"
+    SendCmd "$_cutplaneCmd add $tag"
+    SendCmd "$_cutplaneCmd visible 0 $tag"
 
     SendCmd "volume lighting $settings(-lighting) $tag"
-    set _settings(volumeLighting) $settings(-lighting)
+    set _settings(-volumelighting) $settings(-lighting)
     SetColormap $dataobj $comp
     SendCmd "outline add $tag"
@@ -2097,6 +2141,5 @@
 itcl::body Rappture::VtkVolumeViewer::ReceiveLegend { colormap title vmin vmax size } {
     set _legendPending 0
-    #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"
-    if { [IsConnected] } {
+    if { [isconnected] } {
         set bytes [ReceiveBytes $size]
         if { ![info exists _image(legend)] } {
@@ -2133,5 +2176,5 @@
         set title $fname
     }
-    if { $_settings(legendVisible) } {
+    if { $_settings(-legendvisible) } {
         set x [expr $w - 2]
         if { [$c find withtag "legend"] == "" } {
@@ -2270,5 +2313,5 @@
             }
             set newpos [expr {0.01*$newval}]
-            SendCmd "cutplane slice $axis $newpos"
+            SendCmd "$_cutplaneCmd slice $axis $newpos"
         }
         "tooltip" {
@@ -2321,2 +2364,22 @@
 }
 
+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
+}
