Index: trunk/gui/scripts/flowvisviewer.tcl
===================================================================
--- trunk/gui/scripts/flowvisviewer.tcl	(revision 1357)
+++ trunk/gui/scripts/flowvisviewer.tcl	(revision 1373)
@@ -72,6 +72,6 @@
     public method OverIsoMarker { m x }
 
-    public method drawer {what who}
     public method camera {option args}
+    public method tab {what who}
 
     protected method Connect {}
@@ -110,7 +110,8 @@
     private method ParseMarkersOption { tf ivol markers }
     private method ParseLevelsOption { tf ivol levels }
-    private method BuildCutplanesDrawer {}
-    private method BuildSettingsDrawer {}
-    private method BuildCameraDrawer {}
+    private method BuildCutplanesTab {}
+    private method BuildViewTab {}
+    private method BuildVolumeTab {}
+    private method BuildCameraTab {}
     private method PanCamera {}
     private method GetMovie { widget width height }
@@ -143,6 +144,6 @@
     common downloadPopup_          ;# download options from popup
 
-    private variable drawer_
     private common hardcopy_
+    private variable headings_
 }
 
@@ -220,5 +221,5 @@
         rename -highlightbackground -controlbackground controlBackground Background
     }
-    pack $itk_component(reset) -side top -padx 2 -pady 1
+    pack $itk_component(reset) -side top -padx 2 -pady 2
     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
 
@@ -233,5 +234,5 @@
         rename -highlightbackground -controlbackground controlBackground Background
     }
-    pack $itk_component(zoomin) -side top -padx 1 -pady 1
+    pack $itk_component(zoomin) -side top -padx 2 -pady 2
     Rappture::Tooltip::for $itk_component(zoomin) "Zoom in"
 
@@ -246,9 +247,9 @@
         rename -highlightbackground -controlbackground controlBackground Background
     }
-    pack $itk_component(zoomout) -side top -padx 2 -pady 1
+    pack $itk_component(zoomout) -side top -padx 2 -pady 2
     Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
 
-    itk_component add settingsButton {
-	label $itk_component(controls).settingsbutton \
+    itk_component add configure_button {
+	label $itk_component(controls).configbutton \
 	    -borderwidth 1 -padx 1 -pady 1 \
 	    -relief "raised" -image [Rappture::icon wrench]
@@ -259,52 +260,4 @@
 	    Background
     }
-    pack $itk_component(settingsButton) -padx 2 -pady 1 \
-	-ipadx 1 -ipady 1
-    Rappture::Tooltip::for $itk_component(settingsButton) \
-	"Configure settings"
-    bind $itk_component(settingsButton) <ButtonPress> \
-	[itcl::code $this drawer toggle settings]
-    pack $itk_component(settingsButton) -side bottom \
-	-padx 2 -pady 2 -anchor e
-
-    BuildSettingsDrawer
-
-    itk_component add cutplanesButton {
-	label $itk_component(controls).cutplanesbutton \
-	    -borderwidth 1 -padx 1 -pady 1 \
-	    -relief "raised" -image [Rappture::icon cutbutton]
-    } {
-	usual
-	ignore -borderwidth
-	rename -highlightbackground -controlbackground controlBackground \
-	    Background
-    }
-    Rappture::Tooltip::for $itk_component(cutplanesButton) \
-	"Set cutplanes"
-    bind $itk_component(cutplanesButton) <ButtonPress> \
-	[itcl::code $this drawer toggle cutplanes]
-    pack $itk_component(cutplanesButton) -side bottom \
-	-padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
-
-    BuildCutplanesDrawer
-
-    itk_component add cameraButton {
-	label $itk_component(controls).camerabutton \
-	    -borderwidth 1 -padx 1 -pady 1 \
-	    -relief "raised" -image [Rappture::icon camera]
-    } {
-	usual
-	ignore -borderwidth
-	rename -highlightbackground -controlbackground controlBackground \
-	    Background
-    }
-    Rappture::Tooltip::for $itk_component(cameraButton) \
-	"Camera settings"
-    bind $itk_component(cameraButton) <ButtonPress> \
-	[itcl::code $this drawer toggle camera]
-    pack $itk_component(cameraButton) -side bottom \
-	-padx 2 -pady 1 -ipadx 1 -ipady 1
-
-    BuildCameraDrawer
 
     #
@@ -325,5 +278,10 @@
     Rappture::Tooltip::for $itk_component(volume) \
         "Toggle the volume cloud on/off"
-    pack $itk_component(volume) -padx 1 -pady 1
+    pack $itk_component(volume) -padx 2 -pady 2
+
+    BuildViewTab
+    BuildVolumeTab
+    BuildCutplanesTab
+    BuildCameraTab
 
     # Legend
@@ -331,5 +289,5 @@
     set _image(legend) [image create photo]
     itk_component add legend {
-        canvas $itk_component(area).legend -height 50 -highlightthickness 0
+        canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0
     } {
         usual
@@ -337,9 +295,15 @@
         rename -background -plotbackground plotBackground Background
     }
-    pack $itk_component(legend) -side bottom -fill x
     bind $itk_component(legend) <Configure> \
         [list $_dispatcher event -idle !legend]
 
-    
+    # Hack around the Tk panewindow.  The problem is that the requested 
+    # size of the 3d view isn't set until an image is retrieved from
+    # the server.  So the panewindow uses the tiny size.
+    set w [expr [winfo reqwidth $itk_component(hull)] - 80]
+    blt::table $itk_component(plotarea) \
+	0,0 $itk_component(3dview) -fill both -reqwidth $w \
+	1,0 $itk_component(legend) -fill both
+        
     # Create flow controls...
 
@@ -475,4 +439,7 @@
     set _image(download) [image create photo]
 
+    $itk_component(scroller) contents $itk_component(view_canvas)
+    $itk_component(title) configure -text "$headings_(view)"
+
     eval itk_initialize $args
 
@@ -662,5 +629,6 @@
     switch $option {
         coming {
-            if {[catch {blt::winop snap $itk_component(area) $_image(download)}]} {
+            if {[catch {blt::winop snap $itk_component(plotarea) \
+			    $_image(download)}]} {
                 $_image(download) configure -width 1 -height 1
                 $_image(download) put #000000
@@ -791,5 +759,5 @@
 #       sent later.
 #
-itcl::body Rappture::FlowvisViewer::SendCmd {string} {
+itcl::body Rappture::FlowvisViewer::SendCmd { string } {
     if {[llength $sendobjs_] > 0} {
         append outbuf_ $string "\n"
@@ -816,7 +784,15 @@
             set data [$dataobj values $comp]
             set nbytes [string length $data]
-            if { ![SendBytes "flow data follows $nbytes"] } {
-                return
-            }
+	    set extents [$dataobj extents $comp]
+
+	    # I have a field. Is a vector field or a volume field?
+	    if { $extents == 1 } {
+		set cmd "volume data follows $nbytes"
+	    } else {
+		set cmd "flow data follows $nbytes $extents"
+	    }
+	    if { ![SendBytes $cmd] } {
+		return
+	    }
             if { ![SendBytes $data] } {
                 return
@@ -1370,5 +1346,4 @@
             if {$op} {
                 $itk_component(${axis}CutButton) configure \
-		    -image [Rappture::icon ${axis}-cutplane-on] \
 		    -relief sunken
                 SendCmd "cutplane state 1 $axis [CurrentVolumeIds -cutplanes]"
@@ -1376,5 +1351,4 @@
             } else {
                 $itk_component(${axis}CutButton) configure \
-		    -image [Rappture::icon ${axis}-cutplane-off] \
 		    -relief raised
                 SendCmd "cutplane state 0 $axis [CurrentVolumeIds -cutplanes]"
@@ -1626,7 +1600,8 @@
 	"legend" {
 	    if { $settings_($this-legend) } {
-		pack $itk_component(legend) -side bottom -fill x
+		blt::table $itk_component(plotarea) \
+		    1,0 $itk_component(legend) -fill x
 	    } else {
-		pack forget $itk_component(legend) 
+		blt::table forget $itk_component(legend)
 	    }
 	    FixLegend
@@ -2059,65 +2034,6 @@
 }
 
-itcl::body Rappture::FlowvisViewer::drawer { what who } {
-    if { [info exists drawer_(current)] && $who != $drawer_(current) } {
-	drawer deactivate $drawer_(current)
-    }
-    switch -- ${what} {
-	"activate" {
-	    $itk_component(drawer) add $itk_component($who) -sticky nsew
-	    after idle [list focus $itk_component($who)]
-	    if { ![info exists drawer_($who)] } {
-		set rw [winfo reqwidth $itk_component($who)]
-		set w [winfo width $itk_component(drawer)]
-		set x [expr $w - $rw]
-		$itk_component(drawer) sash place 0 $x 0
-		set drawer_($who) 1
-	    } else {
-		set w [winfo width $itk_component(drawer)]
-		puts stderr "w of drawer is $w"
-		puts stderr "w of last($who) is $drawer_($who-lastx)"
-		set x [expr $w - $drawer_($who-lastx) - 10]
-		puts stderr "setting sash to $x for $who"
-		$itk_component(drawer) sash place 0 $x 0
-		$itk_component(drawer) paneconfigure $itk_component($who) \
-		    -width $drawer_($who-lastx)
-		$itk_component(3dview) configure -width $x
-	    }
-	    set drawer_(current) $who
-	    $itk_component(${who}Button) configure -relief sunken -bd 1
-	}
-	"deactivate" {
-	    # Save the current width of the drawer.
-	    puts stderr "component=$who"
-	    set width [winfo width $itk_component($who)]
-	    set reqwidth [winfo reqwidth $itk_component($who)]
-	    if { $reqwidth < $width } {
-		set width $reqwidth
-	    }
-	    set x [lindex [$itk_component(drawer) sash coord 0] 0]
-	    puts stderr "sashx=$x"
-	    set drawer_($who-lastx) $width
-	    $itk_component(drawer) forget $itk_component($who)
-	    $itk_component(${who}Button) configure -relief raised -bd 1
-	    unset drawer_(current) 
-	}
-	"toggle" {
-	    set slaves [$itk_component(drawer) panes]
-	    if { [lsearch $slaves $itk_component($who)] >= 0 } {
-		drawer deactivate $who
-	    } else {
-		drawer activate $who
-	    }
-	}
-	"resize" {
-	    set bbox [$itk_component(${who}Canvas) bbox all]
-	    set wid [winfo width $itk_component(${who}Frame)]
-	    $itk_component(${who}Canvas) configure -width $wid \
-		-scrollregion $bbox -yscrollincrement 0.1i
-	}
-    }
-}
-
-itcl::body Rappture::FlowvisViewer::BuildSettingsDrawer {} {
+
+itcl::body Rappture::FlowvisViewer::BuildViewTab {} {
     foreach { key value } {
 	grid		0
@@ -2128,4 +2044,95 @@
 	particles	1
 	lic		1
+    } {
+	set settings_($this-$key) $value
+    }
+    itk_component add view_canvas {
+        canvas $itk_component(scroller).viewcanvas -highlightthickness 0
+    } {
+	ignore -highlightthickness
+    }
+    $itk_component(sidebar) insert end "view" \
+	-image [Rappture::icon wrench] -text ""  -padx 0 -pady 0 \
+	-command [itcl::code $this tab select "view"]
+    set headings_(view) "View Settings"
+
+    itk_component add view_frame {
+	frame $itk_component(view_canvas).frame \
+	    -highlightthickness 0 
+    } {
+	ignore -highlightthickness
+    }
+    $itk_component(view_canvas) create window 0 0 \
+	-anchor nw -window $itk_component(view_frame)
+    bind $itk_component(view_frame) <Configure> \
+	[itcl::code $this tab resize "view"]
+
+    set inner $itk_component(view_frame)
+
+    set fg [option get $itk_component(hull) font Font]
+    #set bfg [option get $itk_component(hull) boldFont Font]
+
+    set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0
+    checkbutton $inner.isosurface \
+        -text "Isosurface shading" \
+        -variable [itcl::scope settings_($this-isosurface)] \
+        -command [itcl::code $this FixSettings isosurface] \
+	-font "Arial 9"
+
+    checkbutton $inner.axes \
+        -text "Axes" \
+        -variable [itcl::scope settings_($this-axes)] \
+        -command [itcl::code $this FixSettings axes] \
+	-font "Arial 9"
+
+    checkbutton $inner.grid \
+        -text "Grid" \
+        -variable [itcl::scope settings_($this-grid)] \
+        -command [itcl::code $this FixSettings grid] \
+	-font "Arial 9"
+
+    checkbutton $inner.outline \
+        -text "Outline" \
+        -variable [itcl::scope settings_($this-outline)] \
+        -command [itcl::code $this FixSettings outline] \
+	-font "Arial 9"
+
+    checkbutton $inner.legend \
+        -text "Legend" \
+        -variable [itcl::scope settings_($this-legend)] \
+        -command [itcl::code $this FixSettings legend] \
+	-font "Arial 9"
+
+    checkbutton $inner.volume \
+        -text "Volume" \
+        -variable [itcl::scope settings_($this-volume)] \
+        -command [itcl::code $this FixSettings volume] \
+	-font "Arial 9"
+
+    checkbutton $inner.particles \
+        -text "Particles" \
+        -variable [itcl::scope settings_($this-particles)] \
+        -command [itcl::code $this FixSettings particles] \
+	-font "Arial 9"
+
+    checkbutton $inner.lic \
+        -text "Lic" \
+        -variable [itcl::scope settings_($this-lic)] \
+        -command [itcl::code $this FixSettings lic] \
+	-font "Arial 9"
+
+    blt::table $inner \
+	0,0 $inner.axes  -columnspan 2 -anchor w \
+	1,0 $inner.grid  -columnspan 2 -anchor w \
+	2,0 $inner.outline  -columnspan 2 -anchor w \
+	3,0 $inner.volume  -columnspan 2 -anchor w \
+	4,0 $inner.legend  -columnspan 2 -anchor w \
+	5,0 $inner.particles  -columnspan 2 -anchor w \
+	6,0 $inner.lic  -columnspan 1 -anchor w \
+
+}
+
+itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
+    foreach { key value } {
 	light		40
 	transp		50
@@ -2135,32 +2142,26 @@
 	set settings_($this-$key) $value
     }
-    itk_component add settings {
-	Rappture::Scroller $itk_component(drawer).settings \
-	    -xscrollmode auto -yscrollmode auto \
-	    -highlightthickness 0
-    }
-
-    itk_component add settingsCanvas {
-        canvas $itk_component(settings).canvas -highlightthickness 0
+    itk_component add volume_canvas {
+        canvas $itk_component(scroller).volumecanvas -highlightthickness 0
     } {
 	ignore -highlightthickness
     }
-    $itk_component(settings) contents $itk_component(settingsCanvas)
-
-    itk_component add settingsFrame {
-	frame $itk_component(settingsCanvas).frame \
+    $itk_component(sidebar) insert end "volume" \
+	-image [Rappture::icon playback-record] -text ""  -padx 0 -pady 0 \
+	-command [itcl::code $this tab select "volume"]
+    set headings_(volume) "Volume Settings"
+
+    itk_component add volume_frame {
+	frame $itk_component(volume_canvas).frame \
 	    -highlightthickness 0 
     } {
 	ignore -highlightthickness
     }
-    $itk_component(settingsCanvas) create window 0 0 \
-	-anchor nw -window $itk_component(settingsFrame)
-    bind $itk_component(settingsFrame) <Configure> \
-	[itcl::code $this drawer resize settings]
-
-    set inner $itk_component(settingsFrame)
-
-    label $inner.title -text "View Settings" -font "Arial 10 bold"
-    label $inner.volset -text "Volume Settings" -font "Arial 10 bold"
+    $itk_component(volume_canvas) create window 0 0 \
+	-anchor nw -window $itk_component(volume_frame)
+    bind $itk_component(volume_frame) <Configure> \
+	[itcl::code $this tab resize "volume"]
+
+    set inner $itk_component(volume_frame)
 
     set fg [option get $itk_component(hull) font Font]
@@ -2195,116 +2196,49 @@
     label $inner.thick -text "Thick" -font $fg
 
-    set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0
-    checkbutton $inner.isosurface \
-        -text "Isosurface shading" \
-        -variable [itcl::scope settings_($this-isosurface)] \
-        -command [itcl::code $this FixSettings isosurface] \
-	-font "Arial 9"
-
-    checkbutton $inner.axes \
-        -text "Axes" \
-        -variable [itcl::scope settings_($this-axes)] \
-        -command [itcl::code $this FixSettings axes] \
-	-font "Arial 9"
-
-    checkbutton $inner.grid \
-        -text "Grid" \
-        -variable [itcl::scope settings_($this-grid)] \
-        -command [itcl::code $this FixSettings grid] \
-	-font "Arial 9"
-
-    checkbutton $inner.outline \
-        -text "Outline" \
-        -variable [itcl::scope settings_($this-outline)] \
-        -command [itcl::code $this FixSettings outline] \
-	-font "Arial 9"
-
-    checkbutton $inner.legend \
-        -text "Legend" \
-        -variable [itcl::scope settings_($this-legend)] \
-        -command [itcl::code $this FixSettings legend] \
-	-font "Arial 9"
-
-    checkbutton $inner.volume \
-        -text "Volume" \
-        -variable [itcl::scope settings_($this-volume)] \
-        -command [itcl::code $this FixSettings volume] \
-	-font "Arial 9"
-
-    checkbutton $inner.particles \
-        -text "Particles" \
-        -variable [itcl::scope settings_($this-particles)] \
-        -command [itcl::code $this FixSettings particles] \
-	-font "Arial 9"
-
-    checkbutton $inner.lic \
-        -text "Lic" \
-        -variable [itcl::scope settings_($this-lic)] \
-        -command [itcl::code $this FixSettings lic] \
-	-font "Arial 9"
-
     blt::table $inner \
-	0,0 $inner.title -anchor w  -columnspan 4 \
-	1,1 $inner.axes  -columnspan 2 -anchor w \
-	2,1 $inner.grid  -columnspan 2 -anchor w \
-	3,1 $inner.outline  -columnspan 2 -anchor w \
-	4,1 $inner.volume  -columnspan 2 -anchor w \
-	1,3 $inner.legend  -columnspan 2 -anchor w \
-	2,3 $inner.particles  -columnspan 2 -anchor w \
-	3,3 $inner.lic  -columnspan 1 -anchor w \
-	9,0 $inner.volset -anchor w  -columnspan 4 \
-	11,1 $inner.dim  -anchor e \
-	11,2 $inner.light -columnspan 2 \
-	11,4 $inner.bright -anchor w \
-	12,1 $inner.fog -anchor e \
-	12,2 $inner.transp -columnspan 2 \
-	12,4 $inner.plastic -anchor w \
-	13,1 $inner.clear -anchor e \
-	13,2 $inner.opacity -columnspan 2 \
-	13,4 $inner.opaque -anchor w \
-	14,1 $inner.thin -anchor e \
-	14,2 $inner.thickness -columnspan 2 \
-	14,4 $inner.thick -anchor w \
-
-    blt::table configure $inner c0 -resize expand -width 4
-}
-
-itcl::body Rappture::FlowvisViewer::BuildCutplanesDrawer {} {
-    itk_component add cutplanes {
-	Rappture::Scroller $itk_component(drawer).cutplanes \
-	    -xscrollmode auto -yscrollmode auto \
-	    -highlightthickness 0
-    }
-
-    #
-    # Create slicer controls...
-    #
-    itk_component add cutplanesCanvas {
-        canvas $itk_component(cutplanes).canvas -highlightthickness 0
+	0,0 $inner.dim  -anchor e \
+	0,1 $inner.light -columnspan 2 \
+	0,3 $inner.bright -anchor w \
+	1,0 $inner.fog -anchor e \
+	1,1 $inner.transp -columnspan 2 \
+	1,3 $inner.plastic -anchor w \
+	2,0 $inner.clear -anchor e \
+	2,1 $inner.opacity -columnspan 2 \
+	2,3 $inner.opaque -anchor w \
+	3,0 $inner.thin -anchor e \
+	3,1 $inner.thickness -columnspan 2 \
+	3,3 $inner.thick -anchor w \
+}
+
+itcl::body Rappture::FlowvisViewer::BuildCutplanesTab {} {
+
+    itk_component add cutplanes_canvas {
+        canvas $itk_component(scroller).cutplanescanvas -highlightthickness 0
     } {
 	ignore -highlightthickness
     }
-    $itk_component(cutplanes) contents $itk_component(cutplanesCanvas)
-
-    itk_component add cutplanesFrame {
-	frame $itk_component(cutplanesCanvas).frame \
+    $itk_component(sidebar) insert end "cutplanes" \
+	-image [Rappture::icon cutbutton] -text ""  -padx 0 -pady 0 \
+	-command [itcl::code $this tab select "cutplanes"]
+    set headings_(cutplanes) "Cutplane Settings"
+
+    itk_component add cutplanes_frame {
+	frame $itk_component(cutplanes_canvas).frame \
 	    -highlightthickness 0 
     }  {
 	ignore -highlightthickness
     }
-    $itk_component(cutplanesCanvas) create window 0 0 \
-	-anchor nw -window $itk_component(cutplanesFrame)
-    bind $itk_component(cutplanesFrame) <Configure> \
-	[itcl::code $this drawer resize cutplanes]
-
-    set inner $itk_component(cutplanesFrame)
-
-    label $inner.title -text "Cutplanes" -font "Arial 10 bold"
+    $itk_component(cutplanes_canvas) create window 0 0 \
+	-anchor nw -window $itk_component(cutplanes_frame)
+    bind $itk_component(cutplanes_frame) <Configure> \
+	[itcl::code $this tab resize cutplanes]
+
+    set inner $itk_component(cutplanes_frame)
 
     # X-value slicer...
     itk_component add xCutButton {
-        label $itk_component(cutplanes).xbutton \
+        label $itk_component(cutplanes_frame).xbutton \
             -borderwidth 1 -relief raised -padx 1 -pady 1 \
-            -image [Rappture::icon x-cutplane-off] \
+            -image [Rappture::icon x-cutplane] \
 	    -highlightthickness 0 
     } {
@@ -2320,7 +2254,7 @@
 
     itk_component add xCutScale {
-        ::scale $itk_component(cutplanes).xval -from 100 -to 0 \
+        ::scale $itk_component(cutplanes_frame).xval -from 100 -to 0 \
             -width 10 -orient vertical -showvalue off \
-            -borderwidth 1 -highlightthickness 0 \
+            -borderwidth 1 -highlightthickness 0 -state disabled \
             -command [itcl::code $this Slice move x]
     } {
@@ -2334,5 +2268,4 @@
     }
     $itk_component(xCutScale) set 50
-    #$itk_component(xCutScale) configure -state disabled
     Rappture::Tooltip::for $itk_component(xCutScale) \
         "@[itcl::code $this SlicerTip x]"
@@ -2340,7 +2273,7 @@
     # Y-value slicer...
     itk_component add yCutButton {
-        label $itk_component(cutplanes).ybutton \
+        label $itk_component(cutplanes_frame).ybutton \
             -borderwidth 1 -relief raised -padx 1 -pady 1 \
-            -image [Rappture::icon y-cutplane-off] \
+            -image [Rappture::icon y-cutplane] \
 	    -highlightthickness 0 
     } {
@@ -2356,7 +2289,7 @@
 
     itk_component add yCutScale {
-        ::scale $itk_component(cutplanes).yval -from 100 -to 0 \
+        ::scale $itk_component(cutplanes_frame).yval -from 100 -to 0 \
             -width 10 -orient vertical -showvalue off \
-            -borderwidth 1 -highlightthickness 0 \
+            -borderwidth 1 -highlightthickness 0 -state disabled \
             -command [itcl::code $this Slice move y]
     } {
@@ -2367,14 +2300,13 @@
         rename -troughcolor -controldarkbackground controlDarkBackground Background
     }
-    $itk_component(yCutScale) set 50
-    #$itk_component(yCutScale) configure -state disabled
     Rappture::Tooltip::for $itk_component(yCutScale) \
         "@[itcl::code $this SlicerTip y]"
+    $itk_component(yCutScale) set 50
 
     # Z-value slicer...
     itk_component add zCutButton {
-        label $itk_component(cutplanes).zbutton \
+        label $itk_component(cutplanes_frame).zbutton \
             -borderwidth 1 -relief raised -padx 1 -pady 1 \
-            -image [Rappture::icon z-cutplane-off] \
+            -image [Rappture::icon z-cutplane] \
 	    -highlightthickness 0 
     } {
@@ -2389,7 +2321,7 @@
 
     itk_component add zCutScale {
-        ::scale $itk_component(cutplanes).zval -from 100 -to 0 \
+        ::scale $itk_component(cutplanes_frame).zval -from 100 -to 0 \
             -width 10 -orient vertical -showvalue off \
-            -borderwidth 1 -highlightthickness 0 \
+            -borderwidth 1 -highlightthickness 0 -state disabled \
             -command [itcl::code $this Slice move z]
     } {
@@ -2406,47 +2338,37 @@
 
     blt::table $inner \
-	0,0 $inner.title -anchor w  -columnspan 4 \
-	3,1 $itk_component(xCutButton) \
-	3,2 $itk_component(yCutButton) \
-	3,3 $itk_component(zCutButton) \
-	2,1 $itk_component(xCutScale) \
-	2,2 $itk_component(yCutScale) \
-	2,3 $itk_component(zCutScale) \
-
-    blt::table configure $inner c0 -resize expand -width 4
-}
-
-itcl::body Rappture::FlowvisViewer::BuildCameraDrawer {} {
-
-    itk_component add camera {
-	Rappture::Scroller $itk_component(drawer).camerascrl \
-	    -xscrollmode auto -yscrollmode auto \
-	    -highlightthickness 0
-    }
-
-    itk_component add cameraCanvas {
-	canvas $itk_component(camera).canvas -highlightthickness 0
+	1,0 $itk_component(xCutButton) \
+	1,1 $itk_component(yCutButton) \
+	1,2 $itk_component(zCutButton) \
+	0,0 $itk_component(xCutScale) \
+	0,1 $itk_component(yCutScale) \
+	0,2 $itk_component(zCutScale) \
+}
+
+itcl::body Rappture::FlowvisViewer::BuildCameraTab {} {
+
+    itk_component add camera_canvas {
+	canvas $itk_component(scroller).cameracanvas -highlightthickness 0
     } {
 	ignore -highlightthickness
     }
-    $itk_component(camera) contents $itk_component(cameraCanvas)
-
-    itk_component add cameraFrame {
-	frame $itk_component(cameraCanvas).frame \
+    $itk_component(sidebar) insert end "camera" \
+	-image [Rappture::icon camera] -text ""  -padx 0 -pady 0 \
+	-command [itcl::code $this tab select "camera"]
+    set headings_(camera) "Camera Settings"
+
+    itk_component add camera_frame {
+	frame $itk_component(camera_canvas).frame \
 	    -highlightthickness 0 
     } 
-    $itk_component(cameraCanvas) create window 0 0 \
-	-anchor nw -window $itk_component(cameraFrame)
-    bind $itk_component(cameraFrame) <Configure> \
-	[itcl::code $this drawer resize camera]
-
-    set inner $itk_component(cameraFrame)
-
-    label $inner.title -text "Camera Settings" -font "Arial 10 bold"
+    $itk_component(camera_canvas) create window 0 0 \
+	-anchor nw -window $itk_component(camera_frame)
+    bind $itk_component(camera_frame) <Configure> \
+	[itcl::code $this tab resize "camera"]
+
+    set inner $itk_component(camera_frame)
 
     set labels { phi theta psi pan-x pan-y zoom }
-    blt::table $inner \
-	0,0 $inner.title -anchor w  -columnspan 4 
-    set row 1
+    set row 0
     foreach tag $labels {
 	label $inner.${tag}label -text $tag -font "Arial 9"
@@ -2456,13 +2378,10 @@
 	    [itcl::code $this camera set ${tag}]
 	blt::table $inner \
-	    $row,1 $inner.${tag}label -anchor e \
-	    $row,2 $inner.${tag} -anchor w 
+	    $row,0 $inner.${tag}label -anchor e \
+	    $row,1 $inner.${tag} -anchor w 
 	incr row
     }
-    bind $inner.title <Shift-ButtonPress> \
-	[itcl::code $this camera show]
-    blt::table configure $inner c0 -resize expand -width 4
-    blt::table configure $inner c1 c2 -resize none
-    blt::table configure $inner c3 -resize expand
+    blt::table configure $inner c0 c1 -resize none
+    blt::table configure $inner c2 -resize expand
 
 }
@@ -2576,2 +2495,23 @@
     return ""
 }
+
+itcl::body Rappture::FlowvisViewer::tab { what who } {
+    switch -- ${what} {
+	"select" {
+	    $itk_component(scroller) contents $itk_component(${who}_canvas)
+	    after idle [list focus $itk_component(${who}_canvas)]
+	    $itk_component(title) configure -text "$headings_($who)"
+	    drawer open
+	}
+	"deselect" {
+	    drawer close 
+	}
+	"resize" {
+	    set bbox [$itk_component(${who}_canvas) bbox all]
+	    set wid [winfo width $itk_component(${who}_frame)]
+	    $itk_component(${who}_canvas) configure -width $wid \
+		-scrollregion $bbox -yscrollincrement 0.1i
+	}
+    }
+}
+
